diff --git a/mounts/zoperepo/__root__/choreo/choreo_table_pt/__source-utf8__.html b/mounts/zoperepo/__root__/choreo/choreo_table_pt/__source-utf8__.html index 2440df8..db7f92a 100644 --- a/mounts/zoperepo/__root__/choreo/choreo_table_pt/__source-utf8__.html +++ b/mounts/zoperepo/__root__/choreo/choreo_table_pt/__source-utf8__.html @@ -1,4 +1,4 @@ - +
diff --git a/mounts/zoperepo/__root__/tf_live_demo/index_html/__meta__ b/mounts/zoperepo/__root__/choreo/fetch_playground/__meta__ similarity index 78% rename from mounts/zoperepo/__root__/tf_live_demo/index_html/__meta__ rename to mounts/zoperepo/__root__/choreo/fetch_playground/__meta__ index 8b64a46..0de1ac2 100644 --- a/mounts/zoperepo/__root__/tf_live_demo/index_html/__meta__ +++ b/mounts/zoperepo/__root__/choreo/fetch_playground/__meta__ @@ -1,11 +1,12 @@ [ - ('args', ''), + ('args', 'choreo_id'), ('bindings', [ ('name_container', 'container'), ('name_context', 'context'), ('name_m_self', 'script'), ('name_subpath', 'traverse_subpath'), ]), + ('owner', (['acl_users'], 'dockerzope')), ('proxy_roles', [ ]), ('title', ''), diff --git a/mounts/zoperepo/__root__/choreo/fetch_playground/__source__.py b/mounts/zoperepo/__root__/choreo/fetch_playground/__source__.py new file mode 100644 index 0000000..64ce3d3 --- /dev/null +++ b/mounts/zoperepo/__root__/choreo/fetch_playground/__source__.py @@ -0,0 +1,19 @@ +import json + +res = context.fetch( + mode='python', + choreo_id=choreo_id, + include_rawdata=True, +)['choreos'][0] + +choreo_json = res['rawdata_json'] + +result = { + 'choreo_json': choreo_json, + 'choreo_name': res['choreo_name'], + 'choreo_author': res['choreo_author'], + 'choreo_id': choreo_id, +} + +context.REQUEST.response.setHeader('Content-Type', 'application/json') +return json.dumps(result) diff --git a/mounts/zoperepo/__root__/choreo/index_html/__source-utf8__.html b/mounts/zoperepo/__root__/choreo/index_html/__source-utf8__.html index 50a8ffd..b70be42 100644 --- a/mounts/zoperepo/__root__/choreo/index_html/__source-utf8__.html +++ b/mounts/zoperepo/__root__/choreo/index_html/__source-utf8__.html @@ -1,25 +1,40 @@

-

Interfaces DB

- +
+ + + +
- - @@ -29,7 +44,8 @@

Interfaces DB

-
+
diff --git a/mounts/zoperepo/__root__/index_html/__source-utf8__.html b/mounts/zoperepo/__root__/index_html/__source-utf8__.html index f8ddc35..78c8508 100644 --- a/mounts/zoperepo/__root__/index_html/__source-utf8__.html +++ b/mounts/zoperepo/__root__/index_html/__source-utf8__.html @@ -1,37 +1,70 @@

-

Interfaces

- - - - - - - Tensorflow-JS local live processing - - - Tensorflow-JS local video processing - - - Database - - - p5js playground - - - MediaPipe live scan - - - - MediaPipe upload scan - + + + +
+ + + +
+ +
+ +
+
+
+ +
+
+
+ + + +
+ +

“Interfaces” is the bridge between dance and computer art. We capture the dynamics and expression of dance and transport them into the world of code generated art.

+

“Interfaces” wants to trigger, push and moderate a dialog between generative artists and choreographers.

+

"Interfaces" is a data and knowledge base loaded with data from choreographies, workflow documentation, sample code, converters, scanners and other open source tools that aim to help creators to run their respective part of collaborations between dance and code art.

+

Be part of “Interfaces” by either providing Your movements as a scan on our servers, or by creating generative art using the json files with the movement data from choreographers in Your code.

+

"Interfaces" is about sharing and remixing. We respect the idea of open source and fair share. So tag the creators of the content You're using and share the profits - fame, coins or just the fun.

+ + + Start Playground + + +
+ +
+
+
+
+ +
+ +
+
+ +
+
+
+

\ No newline at end of file diff --git a/mounts/zoperepo/__root__/landingpage_js/__meta__ b/mounts/zoperepo/__root__/landingpage_js/__meta__ new file mode 100644 index 0000000..07f7e78 --- /dev/null +++ b/mounts/zoperepo/__root__/landingpage_js/__meta__ @@ -0,0 +1,8 @@ +[ + ('owner', (['acl_users'], 'dockerzope')), + ('props', [ + [('id', 'content_type'), ('type', 'string'), ('value', 'text/javascript')], + ]), + ('title', ''), + ('type', 'File'), +] diff --git a/mounts/zoperepo/__root__/landingpage_js/__source__.js b/mounts/zoperepo/__root__/landingpage_js/__source__.js new file mode 100644 index 0000000..891a1b5 --- /dev/null +++ b/mounts/zoperepo/__root__/landingpage_js/__source__.js @@ -0,0 +1,108 @@ +const background_color = '#212529'; +const FPS = 30; +const line_map = { + 0 : [1, 4], + 1 : [2], + 2 : [3], + 3 : [7], + 4 : [5], + 5 : [6], + 6 : [8], + 9 : [10], + 11: [12, 13, 23], + 12: [14, 24], + 13: [15], + 14: [16], + 15: [17, 19, 21], + 16: [18, 20, 22], + 17: [19], + 18: [20], + 23: [24, 25], + 24: [26], + 25: [27], + 26: [28], + 27: [29, 31], + 28: [30, 32], +} + +// basic function to find a joint by index from given frame +// use this as a template to create a function to return joints u desire to use +function find_by_bpindex(frame, bpindex, joint_type) { + for (let joint_index in frame) { + let joint = frame[joint_index] + if ((joint.index == bpindex) && (joint.type == joint_type)) { + return joint + } + } +} + +function create_sketch(data) { + let sketch = function(p) { + var index = 0; + let canvas; + + p.windowResized = function() { + p.resizeCanvas(p.windowWidth, p.windowHeight); + } + + p.setup = function() { + // Feel free to alter setup method HERE! + canvas = p.createCanvas(p.windowWidth, p.windowHeight); + canvas.position(0, 0); + canvas.style('z-index', '-1') + p.background(background_color); + p.frameRate(FPS); + } + + p.draw = function() { + p.clear(); + p.background(background_color); + // fetch current data_chunk aka frame + let data_chunk = data[index]; + + // early exit data check + if (!data_chunk || data_chunk.keypoints) { + return + } + + // loop to create stickman body from line_map + for (let first_bpindex in line_map) { + let point_list = line_map[first_bpindex] + for (let pindex in point_list) { + let second_bpindex = point_list[pindex] + let first_point = find_by_bpindex(data_chunk, first_bpindex, "body") + let second_point = find_by_bpindex(data_chunk, second_bpindex, "body") + + // make sure we've found useful data, skip if not found + if (!first_point || !second_point) { + continue + } + + // make sure to multiply normalized coordinates to get correct coordinates p.windowWidth, p.windowHeight + let x1 = first_point.x * p.windowWidth * 2 - ( p.windowWidth / 2 ) + let x2 = second_point.x * p.windowWidth * 2 - ( p.windowWidth / 2 ) + let y1 = first_point.y * p.windowHeight * 2 - ( p.windowHeight / 2 ) + let y2 = second_point.y * p.windowHeight * 2 - ( p.windowHeight / 2 ) + p.stroke('white') + p.line(x1, y1, x2, y2) + + } + } + + if (index >= data.length - 1) { + index = 0; + } else { + index++ + } + + } + } + let stage = new p5(sketch, 'body'); +} + +$(function() { + $.getJSON( + 'lib/assets/demo/kpop_short', + create_sketch + ) +}); diff --git a/mounts/zoperepo/__root__/mediapipe_upload/__meta__ b/mounts/zoperepo/__root__/lib/assets/demo/__meta__ similarity index 100% rename from mounts/zoperepo/__root__/mediapipe_upload/__meta__ rename to mounts/zoperepo/__root__/lib/assets/demo/__meta__ diff --git a/mounts/zoperepo/__root__/tf_upload_demo/tflw-pose-detection_upload.js/__meta__ b/mounts/zoperepo/__root__/lib/assets/demo/kpop_short/__meta__ similarity index 83% rename from mounts/zoperepo/__root__/tf_upload_demo/tflw-pose-detection_upload.js/__meta__ rename to mounts/zoperepo/__root__/lib/assets/demo/kpop_short/__meta__ index b9386a5..2163d43 100644 --- a/mounts/zoperepo/__root__/tf_upload_demo/tflw-pose-detection_upload.js/__meta__ +++ b/mounts/zoperepo/__root__/lib/assets/demo/kpop_short/__meta__ @@ -1,6 +1,6 @@ [ ('props', [ - [('id', 'content_type'), ('type', 'string'), ('value', 'application/javascript')], + [('id', 'content_type'), ('type', 'string'), ('value', 'application/json')], ]), ('title', ''), ('type', 'File'), diff --git a/mounts/zoperepo/__root__/lib/assets/demo/kpop_short/__source__.json b/mounts/zoperepo/__root__/lib/assets/demo/kpop_short/__source__.json new file mode 100644 index 0000000..0079905 --- /dev/null +++ b/mounts/zoperepo/__root__/lib/assets/demo/kpop_short/__source__.json @@ -0,0 +1 @@ +[[{"x": 0.47686639428138733, "y": 0.7793270349502563, "z": 0.14764170348644257, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2450}, {"x": 0.4788360297679901, "y": 0.38124895095825195, "z": 0.032002199441194534, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2450}, {"x": 0.49125465750694275, "y": 0.3446092903614044, "z": 0.08998425304889679, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2450}, {"x": 0.4768025577068329, "y": 0.37495577335357666, "z": -0.046705566346645355, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2450}, {"x": 0.47537192702293396, "y": 0.37401434779167175, "z": -0.046551547944545746, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2450}, {"x": 0.47862690687179565, "y": 0.3757675886154175, "z": -0.046679895371198654, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2450}, {"x": 0.4922518730163574, "y": 0.8120348453521729, "z": 0.07505448162555695, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2450}, {"x": 0.4707275331020355, "y": 0.7961505055427551, "z": 0.15202689170837402, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2450}, {"x": 0.48610594868659973, "y": 0.5711352825164795, "z": 0.031619757413864136, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2450}, {"x": 0.4574810564517975, "y": 0.3015567362308502, "z": 0.055375535041093826, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2450}, {"x": 0.4834030866622925, "y": 0.6836004257202148, "z": 0.06047184392809868, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2450}, {"x": 0.4599768817424774, "y": 0.2998529374599457, "z": 0.05596217140555382, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2450}, {"x": 0.4871178865432739, "y": 0.43206995725631714, "z": 0.07488858699798584, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2450}, {"x": 0.4596621096134186, "y": 0.30508723855018616, "z": 0.06807482242584229, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2450}, {"x": 0.46707451343536377, "y": 0.3055926263332367, "z": 0.06945131719112396, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2450}, {"x": 0.4745636582374573, "y": 0.3939558267593384, "z": -0.03365279734134674, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2450}, {"x": 0.4673404097557068, "y": 0.3920086920261383, "z": -0.04469836503267288, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2450}, {"x": 0.4720773994922638, "y": 0.3817285895347595, "z": -0.06373477727174759, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2450}, {"x": 0.45652857422828674, "y": 0.7910171151161194, "z": 0.010922925546765327, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2450}, {"x": 0.4601384699344635, "y": 0.37637704610824585, "z": -0.002528908895328641, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2450}, {"x": 0.44956862926483154, "y": 0.5139226317405701, "z": -0.05574852228164673, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2450}, {"x": 0.46582743525505066, "y": 0.37219327688217163, "z": -0.05407306179404259, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2450}, {"x": 0.4687716066837311, "y": 0.37229272723197937, "z": -0.0538928359746933, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2450}, {"x": 0.4633691608905792, "y": 0.372102826833725, "z": -0.05416744947433472, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2450}, {"x": 0.46296796202659607, "y": 0.8297573924064636, "z": -0.07544996589422226, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2450}, {"x": 0.45800310373306274, "y": 0.8048946857452393, "z": 0.014438976533710957, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2450}, {"x": 0.45944565534591675, "y": 0.5684027671813965, "z": -0.03173665702342987, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2450}, {"x": 0.48254480957984924, "y": 0.5154443979263306, "z": -0.1788168102502823, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2450}, {"x": 0.457708477973938, "y": 0.6832581162452698, "z": -0.04118076339364052, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2450}, {"x": 0.481168657541275, "y": 0.5237055420875549, "z": -0.17851242423057556, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2450}, {"x": 0.44507455825805664, "y": 0.44062262773513794, "z": 0.0006724290433339775, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2450}, {"x": 0.4809991419315338, "y": 0.5142573714256287, "z": -0.15129563212394714, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2450}, {"x": 0.4749707281589508, "y": 0.5208641886711121, "z": -0.1486082226037979, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2450}], [{"x": 0.47681060433387756, "y": 0.7794322967529297, "z": 0.1410531997680664, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2451}, {"x": 0.47890549898147583, "y": 0.3817431628704071, "z": 0.010720912367105484, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2451}, {"x": 0.490136057138443, "y": 0.3441073000431061, "z": 0.103289894759655, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2451}, {"x": 0.4768049418926239, "y": 0.375594824552536, "z": -0.06750769168138504, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2451}, {"x": 0.4753310978412628, "y": 0.37473955750465393, "z": -0.06735708564519882, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2451}, {"x": 0.4786122441291809, "y": 0.3763403296470642, "z": -0.06748005002737045, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2451}, {"x": 0.4917618930339813, "y": 0.8115686774253845, "z": 0.0743531733751297, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2451}, {"x": 0.4708690643310547, "y": 0.7961148023605347, "z": 0.14528261125087738, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2451}, {"x": 0.48660850524902344, "y": 0.5711686611175537, "z": 0.031060945242643356, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2451}, {"x": 0.4532311260700226, "y": 0.3157002925872803, "z": 0.1105731874704361, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2451}, {"x": 0.4833163022994995, "y": 0.6839722394943237, "z": 0.05442037433385849, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2451}, {"x": 0.4547259509563446, "y": 0.3125290870666504, "z": 0.11320101469755173, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2451}, {"x": 0.48734888434410095, "y": 0.43209895491600037, "z": 0.06717861443758011, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2451}, {"x": 0.4558664858341217, "y": 0.3176214396953583, "z": 0.11907650530338287, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2451}, {"x": 0.4626680314540863, "y": 0.3058049976825714, "z": 0.12017695605754852, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2451}, {"x": 0.47441715002059937, "y": 0.3940020501613617, "z": -0.05303134396672249, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2451}, {"x": 0.4673377275466919, "y": 0.39234721660614014, "z": -0.062484025955200195, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2451}, {"x": 0.4720339775085449, "y": 0.3822539150714874, "z": -0.08328274637460709, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2451}, {"x": 0.45651352405548096, "y": 0.7914644479751587, "z": 0.010263191536068916, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2451}, {"x": 0.4603208005428314, "y": 0.3767199218273163, "z": -0.018201570957899094, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2451}, {"x": 0.4505440294742584, "y": 0.5144447684288025, "z": -0.05678728595376015, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2451}, {"x": 0.4658588767051697, "y": 0.37304192781448364, "z": -0.07372545450925827, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2451}, {"x": 0.4687700867652893, "y": 0.37320515513420105, "z": -0.07352068275213242, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2451}, {"x": 0.463407963514328, "y": 0.37284713983535767, "z": -0.073843814432621, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2451}, {"x": 0.4628543555736542, "y": 0.8298449516296387, "z": -0.07669590413570404, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2451}, {"x": 0.4578690528869629, "y": 0.8051167130470276, "z": 0.01278434507548809, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2451}, {"x": 0.46018075942993164, "y": 0.5687158703804016, "z": -0.03117995522916317, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2451}, {"x": 0.4859756827354431, "y": 0.5296725034713745, "z": -0.16704139113426208, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2451}, {"x": 0.45834463834762573, "y": 0.6832655668258667, "z": -0.041952382773160934, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2451}, {"x": 0.48469409346580505, "y": 0.5361584424972534, "z": -0.16613776981830597, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2451}, {"x": 0.44625696539878845, "y": 0.44002652168273926, "z": -0.007847349159419537, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2451}, {"x": 0.48411765694618225, "y": 0.5282557606697083, "z": -0.13994352519512177, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2451}, {"x": 0.47845199704170227, "y": 0.5343530178070068, "z": -0.13739913702011108, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2451}], [{"x": 0.47661882638931274, "y": 0.7806316614151001, "z": 0.1288650929927826, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2452}, {"x": 0.4803089499473572, "y": 0.38493260741233826, "z": 0.004674184136092663, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2452}, {"x": 0.4877161979675293, "y": 0.501465380191803, "z": 0.13157185912132263, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2452}, {"x": 0.4795660376548767, "y": 0.3788691461086273, "z": -0.08157800137996674, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2452}, {"x": 0.47788384556770325, "y": 0.37811461091041565, "z": -0.08145125955343246, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2452}, {"x": 0.48092541098594666, "y": 0.37954431772232056, "z": -0.08148138970136642, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2452}, {"x": 0.4925430417060852, "y": 0.8115201592445374, "z": 0.07052972167730331, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2452}, {"x": 0.4697198271751404, "y": 0.7987982034683228, "z": 0.13186079263687134, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2452}, {"x": 0.48727020621299744, "y": 0.5708995461463928, "z": 0.04898962005972862, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2452}, {"x": 0.4826665222644806, "y": 0.5669682621955872, "z": 0.05956514552235603, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2452}, {"x": 0.48349225521087646, "y": 0.6839703321456909, "z": 0.05554620176553726, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2452}, {"x": 0.47898241877555847, "y": 0.570315420627594, "z": 0.07778872549533844, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2452}, {"x": 0.48735493421554565, "y": 0.43728697299957275, "z": 0.08574823290109634, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2452}, {"x": 0.48349061608314514, "y": 0.5606657862663269, "z": 0.07539456337690353, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2452}, {"x": 0.4792880415916443, "y": 0.5558019876480103, "z": 0.08347272127866745, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2452}, {"x": 0.4768608510494232, "y": 0.39586928486824036, "z": -0.06490791589021683, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2452}, {"x": 0.4707770049571991, "y": 0.39399367570877075, "z": -0.08382997661828995, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2452}, {"x": 0.4753122329711914, "y": 0.3848116397857666, "z": -0.09892488270998001, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2452}, {"x": 0.45641034841537476, "y": 0.7919710278511047, "z": -0.07561754435300827, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2452}, {"x": 0.4632851779460907, "y": 0.3797718584537506, "z": -0.057522762566804886, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2452}, {"x": 0.4532128572463989, "y": 0.5091056823730469, "z": -0.10675951093435287, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2452}, {"x": 0.4695471227169037, "y": 0.3763733506202698, "z": -0.09507869929075241, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2452}, {"x": 0.4722467362880707, "y": 0.3767445981502533, "z": -0.09485483169555664, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2452}, {"x": 0.4673042595386505, "y": 0.37599340081214905, "z": -0.09519781172275543, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2452}, {"x": 0.46338504552841187, "y": 0.829410970211029, "z": -0.16425050795078278, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2452}, {"x": 0.45656076073646545, "y": 0.8069124221801758, "z": -0.07655118405818939, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2452}, {"x": 0.46319177746772766, "y": 0.5684565305709839, "z": -0.049093056470155716, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2452}, {"x": 0.49397775530815125, "y": 0.5555948615074158, "z": -0.19305424392223358, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2452}, {"x": 0.4610241651535034, "y": 0.6829742193222046, "z": -0.09555482119321823, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2452}, {"x": 0.49110424518585205, "y": 0.5619908571243286, "z": -0.1954331248998642, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2452}, {"x": 0.45181477069854736, "y": 0.43933701515197754, "z": -0.07068778574466705, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2452}, {"x": 0.4919030964374542, "y": 0.5515820384025574, "z": -0.16671833395957947, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2452}, {"x": 0.4836671054363251, "y": 0.5491762757301331, "z": -0.1668054312467575, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2452}, {"x": 0.5062069296836853, "y": 0.5635905265808105, "z": -0.1719890940003097, "name": "INDEX_FINGER_DIP", "type": "right_hand", "index": 7, "frame_index": 2452}, {"x": 0.49773848056793213, "y": 0.5617231130599976, "z": -0.16881194268353283, "name": "INDEX_FINGER_MCP", "type": "right_hand", "index": 5, "frame_index": 2452}, {"x": 0.5028436183929443, "y": 0.5626369714736938, "z": -0.1705889143049717, "name": "INDEX_FINGER_PIP", "type": "right_hand", "index": 6, "frame_index": 2452}, {"x": 0.5085694193840027, "y": 0.5646288394927979, "z": -0.17294696578755975, "name": "INDEX_FINGER_TIP", "type": "right_hand", "index": 8, "frame_index": 2452}, {"x": 0.5061377286911011, "y": 0.5713109970092773, "z": -0.17185731511563063, "name": "MIDDLE_FINGER_DIP", "type": "right_hand", "index": 11, "frame_index": 2452}, {"x": 0.4981324076652527, "y": 0.5635182857513428, "z": -0.16870316199492663, "name": "MIDDLE_FINGER_MCP", "type": "right_hand", "index": 9, "frame_index": 2452}, {"x": 0.5033115148544312, "y": 0.5675122737884521, "z": -0.17048413981683552, "name": "MIDDLE_FINGER_PIP", "type": "right_hand", "index": 10, "frame_index": 2452}, {"x": 0.5078896880149841, "y": 0.5750535726547241, "z": -0.17274355934932828, "name": "MIDDLE_FINGER_TIP", "type": "right_hand", "index": 12, "frame_index": 2452}, {"x": 0.49872103333473206, "y": 0.5753533244132996, "z": -0.17164002126082778, "name": "PINKY_DIP", "type": "right_hand", "index": 19, "frame_index": 2452}, {"x": 0.4956553280353546, "y": 0.5659855604171753, "z": -0.16921175131574273, "name": "PINKY_MCP", "type": "right_hand", "index": 17, "frame_index": 2452}, {"x": 0.4979229271411896, "y": 0.5711398124694824, "z": -0.17098277900367975, "name": "PINKY_PIP", "type": "right_hand", "index": 18, "frame_index": 2452}, {"x": 0.4988571107387543, "y": 0.5791508555412292, "z": -0.17195313284173608, "name": "PINKY_TIP", "type": "right_hand", "index": 20, "frame_index": 2452}, {"x": 0.5034002661705017, "y": 0.5758258700370789, "z": -0.1722498144954443, "name": "RING_FINGER_DIP", "type": "right_hand", "index": 15, "frame_index": 2452}, {"x": 0.4973759949207306, "y": 0.564966082572937, "z": -0.16888791881501675, "name": "RING_FINGER_MCP", "type": "right_hand", "index": 13, "frame_index": 2452}, {"x": 0.5017511248588562, "y": 0.570412278175354, "z": -0.17097584530711174, "name": "RING_FINGER_PIP", "type": "right_hand", "index": 14, "frame_index": 2452}, {"x": 0.5040770769119263, "y": 0.580653727054596, "z": -0.1729750852100551, "name": "RING_FINGER_TIP", "type": "right_hand", "index": 16, "frame_index": 2452}, {"x": 0.48853862285614014, "y": 0.5606288313865662, "z": -0.16906639095395803, "name": "THUMB_CMC", "type": "right_hand", "index": 1, "frame_index": 2452}, {"x": 0.4968017041683197, "y": 0.5653693675994873, "z": -0.17091869516298175, "name": "THUMB_IP", "type": "right_hand", "index": 3, "frame_index": 2452}, {"x": 0.4930039644241333, "y": 0.563027024269104, "z": -0.17010314436629415, "name": "THUMB_MCP", "type": "right_hand", "index": 2, "frame_index": 2452}, {"x": 0.49961695075035095, "y": 0.5677374601364136, "z": -0.1716239219531417, "name": "THUMB_TIP", "type": "right_hand", "index": 4, "frame_index": 2452}, {"x": 0.48561230301856995, "y": 0.5576706528663635, "z": -0.1668053996626604, "name": "WRIST", "type": "right_hand", "index": 0, "frame_index": 2452}], [{"x": 0.47633177042007446, "y": 0.7811314463615417, "z": 0.1244230717420578, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2453}, {"x": 0.48173120617866516, "y": 0.38477781414985657, "z": 0.010312914848327637, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2453}, {"x": 0.4858223795890808, "y": 0.5105713605880737, "z": 0.13094104826450348, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2453}, {"x": 0.4811663329601288, "y": 0.3795384168624878, "z": -0.07488985359668732, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2453}, {"x": 0.47950515151023865, "y": 0.37907952070236206, "z": -0.07475566864013672, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2453}, {"x": 0.48229408264160156, "y": 0.3799504041671753, "z": -0.07481535524129868, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2453}, {"x": 0.4930168390274048, "y": 0.8108996748924255, "z": 0.06425387412309647, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2453}, {"x": 0.4689105451107025, "y": 0.799808144569397, "z": 0.12707220017910004, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2453}, {"x": 0.4878717064857483, "y": 0.5695493817329407, "z": 0.05180726200342178, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2453}, {"x": 0.488925039768219, "y": 0.5748634934425354, "z": 0.039614226669073105, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2453}, {"x": 0.483662486076355, "y": 0.6839314699172974, "z": 0.05650030076503754, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2453}, {"x": 0.48623329401016235, "y": 0.5762959718704224, "z": 0.058110084384679794, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2453}, {"x": 0.48727843165397644, "y": 0.4381938874721527, "z": 0.09771573543548584, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2453}, {"x": 0.4890771210193634, "y": 0.5692915320396423, "z": 0.057677481323480606, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2453}, {"x": 0.4857999086380005, "y": 0.5620667338371277, "z": 0.06645925343036652, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2453}, {"x": 0.4789246916770935, "y": 0.39639461040496826, "z": -0.05978037044405937, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2453}, {"x": 0.47280117869377136, "y": 0.39464133977890015, "z": -0.07632250338792801, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2453}, {"x": 0.47721195220947266, "y": 0.38602328300476074, "z": -0.09216582775115967, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2453}, {"x": 0.45639124512672424, "y": 0.7919250130653381, "z": -0.07932734489440918, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2453}, {"x": 0.4648999571800232, "y": 0.3803408443927765, "z": -0.04747029393911362, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2453}, {"x": 0.45508578419685364, "y": 0.506633460521698, "z": -0.10845896601676941, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2453}, {"x": 0.47139662504196167, "y": 0.37752342224121094, "z": -0.08694375306367874, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2453}, {"x": 0.4740997850894928, "y": 0.37788116931915283, "z": -0.08673224598169327, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2453}, {"x": 0.4691767394542694, "y": 0.3771102726459503, "z": -0.08704797178506851, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2453}, {"x": 0.46411749720573425, "y": 0.8288668394088745, "z": -0.16911904513835907, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2453}, {"x": 0.45585522055625916, "y": 0.8071727752685547, "z": -0.08068649470806122, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2453}, {"x": 0.4650416970252991, "y": 0.5667504668235779, "z": -0.05191120132803917, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2453}, {"x": 0.4926231801509857, "y": 0.5692404508590698, "z": -0.19617412984371185, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2453}, {"x": 0.46247342228889465, "y": 0.681779682636261, "z": -0.09620837867259979, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2453}, {"x": 0.4899640679359436, "y": 0.5727822184562683, "z": -0.1973346769809723, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2453}, {"x": 0.45524540543556213, "y": 0.4361336827278137, "z": -0.06381061673164368, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2453}, {"x": 0.49098604917526245, "y": 0.5636211037635803, "z": -0.1684388816356659, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2453}, {"x": 0.48387593030929565, "y": 0.5553118586540222, "z": -0.16798874735832214, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2453}, {"x": 0.5029110312461853, "y": 0.5797758102416992, "z": 0.06117621576413512, "name": "INDEX_FINGER_DIP", "type": "left_hand", "index": 7, "frame_index": 2453}, {"x": 0.4960380494594574, "y": 0.572191059589386, "z": 0.06430033291690052, "name": "INDEX_FINGER_MCP", "type": "left_hand", "index": 5, "frame_index": 2453}, {"x": 0.4998944103717804, "y": 0.5770819783210754, "z": 0.0623568925075233, "name": "INDEX_FINGER_PIP", "type": "left_hand", "index": 6, "frame_index": 2453}, {"x": 0.5054892897605896, "y": 0.5816659927368164, "z": 0.06038967240601778, "name": "INDEX_FINGER_TIP", "type": "left_hand", "index": 8, "frame_index": 2453}, {"x": 0.4960354268550873, "y": 0.5864561200141907, "z": 0.06018869485706091, "name": "MIDDLE_FINGER_DIP", "type": "left_hand", "index": 11, "frame_index": 2453}, {"x": 0.4945549964904785, "y": 0.5701387524604797, "z": 0.06310470961034298, "name": "MIDDLE_FINGER_MCP", "type": "left_hand", "index": 9, "frame_index": 2453}, {"x": 0.49584871530532837, "y": 0.5797508358955383, "z": 0.06102462625131011, "name": "MIDDLE_FINGER_PIP", "type": "left_hand", "index": 10, "frame_index": 2453}, {"x": 0.4959140717983246, "y": 0.5915704965591431, "z": 0.05970261013135314, "name": "MIDDLE_FINGER_TIP", "type": "left_hand", "index": 12, "frame_index": 2453}, {"x": 0.4858340620994568, "y": 0.5723484754562378, "z": 0.05992529634386301, "name": "PINKY_DIP", "type": "left_hand", "index": 19, "frame_index": 2453}, {"x": 0.4889337122440338, "y": 0.5649169087409973, "z": 0.060717955231666565, "name": "PINKY_MCP", "type": "left_hand", "index": 17, "frame_index": 2453}, {"x": 0.48736828565597534, "y": 0.5723377466201782, "z": 0.05928174266591668, "name": "PINKY_PIP", "type": "left_hand", "index": 18, "frame_index": 2453}, {"x": 0.4849402606487274, "y": 0.5708363652229309, "z": 0.06069367844611406, "name": "PINKY_TIP", "type": "left_hand", "index": 20, "frame_index": 2453}, {"x": 0.4885675013065338, "y": 0.5755643248558044, "z": 0.06027126545086503, "name": "RING_FINGER_DIP", "type": "left_hand", "index": 15, "frame_index": 2453}, {"x": 0.4921325147151947, "y": 0.5675407648086548, "z": 0.0619367565959692, "name": "RING_FINGER_MCP", "type": "left_hand", "index": 13, "frame_index": 2453}, {"x": 0.4904194176197052, "y": 0.576429009437561, "z": 0.05980873527005315, "name": "RING_FINGER_PIP", "type": "left_hand", "index": 14, "frame_index": 2453}, {"x": 0.4874124825000763, "y": 0.5733832120895386, "z": 0.06096774712204933, "name": "RING_FINGER_TIP", "type": "left_hand", "index": 16, "frame_index": 2453}, {"x": 0.48808518052101135, "y": 0.566473662853241, "z": 0.06628587612067349, "name": "THUMB_CMC", "type": "left_hand", "index": 1, "frame_index": 2453}, {"x": 0.49397310614585876, "y": 0.5781598091125488, "z": 0.06437292066402733, "name": "THUMB_IP", "type": "left_hand", "index": 3, "frame_index": 2453}, {"x": 0.49159127473831177, "y": 0.573360800743103, "z": 0.06546324410010129, "name": "THUMB_MCP", "type": "left_hand", "index": 2, "frame_index": 2453}, {"x": 0.49582090973854065, "y": 0.5813414454460144, "z": 0.0633764408994466, "name": "THUMB_TIP", "type": "left_hand", "index": 4, "frame_index": 2453}, {"x": 0.48525330424308777, "y": 0.5583951473236084, "z": 0.06645928974737103, "name": "WRIST", "type": "left_hand", "index": 0, "frame_index": 2453}, {"x": 0.5006292462348938, "y": 0.580234944820404, "z": -0.17151883291080594, "name": "INDEX_FINGER_DIP", "type": "right_hand", "index": 7, "frame_index": 2453}, {"x": 0.49547243118286133, "y": 0.5697715878486633, "z": -0.16868334158789366, "name": "INDEX_FINGER_MCP", "type": "right_hand", "index": 5, "frame_index": 2453}, {"x": 0.4988875091075897, "y": 0.5762437582015991, "z": -0.1703461348079145, "name": "INDEX_FINGER_PIP", "type": "right_hand", "index": 6, "frame_index": 2453}, {"x": 0.501655101776123, "y": 0.5836536884307861, "z": -0.17235157871618867, "name": "INDEX_FINGER_TIP", "type": "right_hand", "index": 8, "frame_index": 2453}, {"x": 0.49825069308280945, "y": 0.5827573537826538, "z": -0.17245842702686787, "name": "MIDDLE_FINGER_DIP", "type": "right_hand", "index": 11, "frame_index": 2453}, {"x": 0.4944363832473755, "y": 0.5690386891365051, "z": -0.17005687369965017, "name": "MIDDLE_FINGER_MCP", "type": "right_hand", "index": 9, "frame_index": 2453}, {"x": 0.4975862503051758, "y": 0.5775622725486755, "z": -0.17158188577741385, "name": "MIDDLE_FINGER_PIP", "type": "right_hand", "index": 10, "frame_index": 2453}, {"x": 0.498293936252594, "y": 0.586747407913208, "z": -0.17304201563820243, "name": "MIDDLE_FINGER_TIP", "type": "right_hand", "index": 12, "frame_index": 2453}, {"x": 0.4902406930923462, "y": 0.5752049088478088, "z": -0.1731589655391872, "name": "PINKY_DIP", "type": "right_hand", "index": 19, "frame_index": 2453}, {"x": 0.48939189314842224, "y": 0.5672205686569214, "z": -0.17279966082423925, "name": "PINKY_MCP", "type": "right_hand", "index": 17, "frame_index": 2453}, {"x": 0.4900875687599182, "y": 0.5725879669189453, "z": -0.1734275226481259, "name": "PINKY_PIP", "type": "right_hand", "index": 18, "frame_index": 2453}, {"x": 0.49029994010925293, "y": 0.5769206285476685, "z": -0.17300121765583754, "name": "PINKY_TIP", "type": "right_hand", "index": 20, "frame_index": 2453}, {"x": 0.4950840175151825, "y": 0.5813214182853699, "z": -0.17279866570606828, "name": "RING_FINGER_DIP", "type": "right_hand", "index": 15, "frame_index": 2453}, {"x": 0.49236470460891724, "y": 0.568249523639679, "z": -0.17143452423624694, "name": "RING_FINGER_MCP", "type": "right_hand", "index": 13, "frame_index": 2453}, {"x": 0.494721382856369, "y": 0.5764800310134888, "z": -0.17266503581777215, "name": "RING_FINGER_PIP", "type": "right_hand", "index": 14, "frame_index": 2453}, {"x": 0.4951982796192169, "y": 0.5848424434661865, "z": -0.1729240925051272, "name": "RING_FINGER_TIP", "type": "right_hand", "index": 16, "frame_index": 2453}, {"x": 0.48801684379577637, "y": 0.5620570778846741, "z": -0.1674641976132989, "name": "THUMB_CMC", "type": "right_hand", "index": 1, "frame_index": 2453}, {"x": 0.49451756477355957, "y": 0.5736830830574036, "z": -0.16868205415084958, "name": "THUMB_IP", "type": "right_hand", "index": 3, "frame_index": 2453}, {"x": 0.4919738173484802, "y": 0.5689562559127808, "z": -0.1678801182715688, "name": "THUMB_MCP", "type": "right_hand", "index": 2, "frame_index": 2453}, {"x": 0.4961684048175812, "y": 0.5780957937240601, "z": -0.16960693337023258, "name": "THUMB_TIP", "type": "right_hand", "index": 4, "frame_index": 2453}, {"x": 0.4836266338825226, "y": 0.5555996894836426, "z": -0.16798873074489507, "name": "WRIST", "type": "right_hand", "index": 0, "frame_index": 2453}], [{"x": 0.4767715036869049, "y": 0.7811165452003479, "z": 0.12278232723474503, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2454}, {"x": 0.4829564392566681, "y": 0.38486114144325256, "z": 0.018822554498910904, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2454}, {"x": 0.4831034243106842, "y": 0.5084158778190613, "z": 0.14456984400749207, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2454}, {"x": 0.4824524223804474, "y": 0.38043105602264404, "z": -0.0747632309794426, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2454}, {"x": 0.4809647798538208, "y": 0.3800424337387085, "z": -0.07453453540802002, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2454}, {"x": 0.4835883677005768, "y": 0.3807322680950165, "z": -0.07463962584733963, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2454}, {"x": 0.49321475625038147, "y": 0.8106209635734558, "z": 0.06385337561368942, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2454}, {"x": 0.468940794467926, "y": 0.7996020913124084, "z": 0.12549829483032227, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2454}, {"x": 0.4885673522949219, "y": 0.5667507648468018, "z": 0.05547685921192169, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2454}, {"x": 0.49105313420295715, "y": 0.57551509141922, "z": 0.058763038367033005, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2454}, {"x": 0.48389932513237, "y": 0.6827781796455383, "z": 0.05759124457836151, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2454}, {"x": 0.4888633191585541, "y": 0.5776695013046265, "z": 0.07843486219644547, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2454}, {"x": 0.4853399097919464, "y": 0.43747445940971375, "z": 0.10794169455766678, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2454}, {"x": 0.49062997102737427, "y": 0.5692421793937683, "z": 0.07522523403167725, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2454}, {"x": 0.48771563172340393, "y": 0.5570464730262756, "z": 0.08454235643148422, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2454}, {"x": 0.48065832257270813, "y": 0.39713776111602783, "z": -0.05613715201616287, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2454}, {"x": 0.4745241105556488, "y": 0.3955373764038086, "z": -0.07283656299114227, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2454}, {"x": 0.47908148169517517, "y": 0.38729000091552734, "z": -0.08973044902086258, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2454}, {"x": 0.4562934935092926, "y": 0.7918520569801331, "z": -0.07650060951709747, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2454}, {"x": 0.4661160707473755, "y": 0.38064390420913696, "z": -0.046275243163108826, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2454}, {"x": 0.46053388714790344, "y": 0.50503009557724, "z": -0.11280643194913864, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2454}, {"x": 0.47284644842147827, "y": 0.3780975937843323, "z": -0.0832628384232521, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2454}, {"x": 0.47550123929977417, "y": 0.3785477578639984, "z": -0.08305402100086212, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2454}, {"x": 0.470465749502182, "y": 0.3776833117008209, "z": -0.08336233347654343, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2454}, {"x": 0.4644950330257416, "y": 0.8284139633178711, "z": -0.1619998961687088, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2454}, {"x": 0.45491349697113037, "y": 0.8072531223297119, "z": -0.07731916010379791, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2454}, {"x": 0.46814239025115967, "y": 0.5645548105239868, "z": -0.055585265159606934, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2454}, {"x": 0.49192315340042114, "y": 0.5792355537414551, "z": -0.1924484819173813, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2454}, {"x": 0.4641522467136383, "y": 0.680679440498352, "z": -0.09589623659849167, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2454}, {"x": 0.4889630675315857, "y": 0.5800638794898987, "z": -0.19353893399238586, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2454}, {"x": 0.45852479338645935, "y": 0.4324890375137329, "z": -0.06736244261264801, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2454}, {"x": 0.4905191957950592, "y": 0.5739070177078247, "z": -0.16577386856079102, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2454}, {"x": 0.4841756522655487, "y": 0.5611588358879089, "z": -0.16545049846172333, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2454}], [{"x": 0.47700345516204834, "y": 0.7804090976715088, "z": 0.104722760617733, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2455}, {"x": 0.4831869900226593, "y": 0.3848828971385956, "z": 0.03928209841251373, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2455}, {"x": 0.49190911650657654, "y": 0.41949957609176636, "z": 0.2458062320947647, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2455}, {"x": 0.4838329553604126, "y": 0.3816359341144562, "z": -0.042249102145433426, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2455}, {"x": 0.4827340543270111, "y": 0.38149404525756836, "z": -0.04213980212807655, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2455}, {"x": 0.484855979681015, "y": 0.38173115253448486, "z": -0.04218945652246475, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2455}, {"x": 0.4933917820453644, "y": 0.8096528053283691, "z": 0.04983647167682648, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2455}, {"x": 0.4690127670764923, "y": 0.7993733286857605, "z": 0.10662288218736649, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2455}, {"x": 0.48896995186805725, "y": 0.5636910796165466, "z": 0.057572800666093826, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2455}, {"x": 0.4832075834274292, "y": 0.4023222327232361, "z": 0.32336559891700745, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2455}, {"x": 0.484306275844574, "y": 0.6807899475097656, "z": 0.05620722100138664, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2455}, {"x": 0.4830034673213959, "y": 0.41045135259628296, "z": 0.3353285491466522, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2455}, {"x": 0.4834621846675873, "y": 0.4362369179725647, "z": 0.1285146176815033, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2455}, {"x": 0.4864118993282318, "y": 0.4039875566959381, "z": 0.317234605550766, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2455}, {"x": 0.4868229925632477, "y": 0.4092176854610443, "z": 0.319790780544281, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2455}, {"x": 0.4821517765522003, "y": 0.3973144292831421, "z": -0.026773324236273766, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2455}, {"x": 0.47710826992988586, "y": 0.3958664834499359, "z": -0.04757006838917732, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2455}, {"x": 0.48158708214759827, "y": 0.3885003328323364, "z": -0.05878574773669243, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2455}, {"x": 0.4562782645225525, "y": 0.7918586134910583, "z": -0.07375684380531311, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2455}, {"x": 0.46836164593696594, "y": 0.3805995285511017, "z": -0.03371558338403702, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2455}, {"x": 0.46332424879074097, "y": 0.5015988945960999, "z": -0.0799722820520401, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2455}, {"x": 0.4759441912174225, "y": 0.37935158610343933, "z": -0.05651301145553589, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2455}, {"x": 0.47807541489601135, "y": 0.3801232576370239, "z": -0.05628063157200813, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2455}, {"x": 0.47392553091049194, "y": 0.3786465525627136, "z": -0.05664806067943573, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2455}, {"x": 0.4643830955028534, "y": 0.828246533870697, "z": -0.15363158285617828, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2455}, {"x": 0.45462092757225037, "y": 0.8072690963745117, "z": -0.07526618987321854, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2455}, {"x": 0.46983328461647034, "y": 0.5618690848350525, "z": -0.057716693729162216, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2455}, {"x": 0.4898071587085724, "y": 0.5752740502357483, "z": -0.12034290283918381, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2455}, {"x": 0.46610674262046814, "y": 0.6798698306083679, "z": -0.08332263678312302, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2455}, {"x": 0.4865371286869049, "y": 0.5746891498565674, "z": -0.12325909733772278, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2455}, {"x": 0.46116504073143005, "y": 0.42888695001602173, "z": -0.05256113037467003, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2455}, {"x": 0.4887422025203705, "y": 0.5683948397636414, "z": -0.10414662212133408, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2455}, {"x": 0.4838503897190094, "y": 0.5544066429138184, "z": -0.1054847463965416, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2455}, {"x": 0.48932936787605286, "y": 0.5996888875961304, "z": -0.10508315998595208, "name": "INDEX_FINGER_DIP", "type": "right_hand", "index": 7, "frame_index": 2455}, {"x": 0.4894442856311798, "y": 0.583097517490387, "z": -0.10331136547029018, "name": "INDEX_FINGER_MCP", "type": "right_hand", "index": 5, "frame_index": 2455}, {"x": 0.48968106508255005, "y": 0.5942345261573792, "z": -0.10420664260163903, "name": "INDEX_FINGER_PIP", "type": "right_hand", "index": 6, "frame_index": 2455}, {"x": 0.4890672266483307, "y": 0.6030251383781433, "z": -0.10558965234667994, "name": "INDEX_FINGER_TIP", "type": "right_hand", "index": 8, "frame_index": 2455}, {"x": 0.4873974025249481, "y": 0.6004303097724915, "z": -0.10601284768199548, "name": "MIDDLE_FINGER_DIP", "type": "right_hand", "index": 11, "frame_index": 2455}, {"x": 0.48872092366218567, "y": 0.5838866233825684, "z": -0.10460983461234719, "name": "MIDDLE_FINGER_MCP", "type": "right_hand", "index": 9, "frame_index": 2455}, {"x": 0.4881777763366699, "y": 0.5951535701751709, "z": -0.10526508443581406, "name": "MIDDLE_FINGER_PIP", "type": "right_hand", "index": 10, "frame_index": 2455}, {"x": 0.4867539703845978, "y": 0.6040450930595398, "z": -0.10650593705940992, "name": "MIDDLE_FINGER_TIP", "type": "right_hand", "index": 12, "frame_index": 2455}, {"x": 0.48470476269721985, "y": 0.5984992384910583, "z": -0.10701392381452024, "name": "PINKY_DIP", "type": "right_hand", "index": 19, "frame_index": 2455}, {"x": 0.4854033291339874, "y": 0.5844261050224304, "z": -0.1074489273596555, "name": "PINKY_MCP", "type": "right_hand", "index": 17, "frame_index": 2455}, {"x": 0.48516345024108887, "y": 0.593209981918335, "z": -0.10745323542505503, "name": "PINKY_PIP", "type": "right_hand", "index": 18, "frame_index": 2455}, {"x": 0.48420897126197815, "y": 0.6027389764785767, "z": -0.10673732170835137, "name": "PINKY_TIP", "type": "right_hand", "index": 20, "frame_index": 2455}, {"x": 0.4863503575325012, "y": 0.6008766889572144, "z": -0.10656103165820241, "name": "RING_FINGER_DIP", "type": "right_hand", "index": 15, "frame_index": 2455}, {"x": 0.48737403750419617, "y": 0.5843367576599121, "z": -0.10603048134362325, "name": "RING_FINGER_MCP", "type": "right_hand", "index": 13, "frame_index": 2455}, {"x": 0.487005352973938, "y": 0.5956233739852905, "z": -0.10648011812008917, "name": "RING_FINGER_PIP", "type": "right_hand", "index": 14, "frame_index": 2455}, {"x": 0.48578476905822754, "y": 0.6046559810638428, "z": -0.10665018658619374, "name": "RING_FINGER_TIP", "type": "right_hand", "index": 16, "frame_index": 2455}, {"x": 0.48608675599098206, "y": 0.5687373876571655, "z": -0.1043432179139927, "name": "THUMB_CMC", "type": "right_hand", "index": 1, "frame_index": 2455}, {"x": 0.48771750926971436, "y": 0.5869175791740417, "z": -0.10425261547788978, "name": "THUMB_IP", "type": "right_hand", "index": 3, "frame_index": 2455}, {"x": 0.4871239960193634, "y": 0.579051673412323, "z": -0.10403389448765665, "name": "THUMB_MCP", "type": "right_hand", "index": 2, "frame_index": 2455}, {"x": 0.4883102476596832, "y": 0.5930280685424805, "z": -0.10438069445081055, "name": "THUMB_TIP", "type": "right_hand", "index": 4, "frame_index": 2455}, {"x": 0.48461058735847473, "y": 0.5607485771179199, "z": -0.10548474664257168, "name": "WRIST", "type": "right_hand", "index": 0, "frame_index": 2455}], [{"x": 0.4773658812046051, "y": 0.7798848748207092, "z": 0.0772956907749176, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2456}, {"x": 0.48300644755363464, "y": 0.3863106369972229, "z": 0.06015555188059807, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2456}, {"x": 0.4979653060436249, "y": 0.41958022117614746, "z": 0.25873059034347534, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2456}, {"x": 0.4839291274547577, "y": 0.3842885494232178, "z": -0.010954925790429115, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2456}, {"x": 0.4832136929035187, "y": 0.3844469487667084, "z": -0.01085865031927824, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2456}, {"x": 0.48470085859298706, "y": 0.38415494561195374, "z": -0.010909193195402622, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2456}, {"x": 0.49348360300064087, "y": 0.8095054030418396, "z": 0.026124505326151848, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2456}, {"x": 0.4692220687866211, "y": 0.799287736415863, "z": 0.07742580771446228, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2456}, {"x": 0.4888845682144165, "y": 0.5636599659919739, "z": 0.0606888011097908, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2456}, {"x": 0.48304784297943115, "y": 0.389924019575119, "z": 0.33940038084983826, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2456}, {"x": 0.48441797494888306, "y": 0.6799361109733582, "z": 0.05261737480759621, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2456}, {"x": 0.48261159658432007, "y": 0.3934563398361206, "z": 0.35123687982559204, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2456}, {"x": 0.4815133213996887, "y": 0.43581637740135193, "z": 0.14176718890666962, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2456}, {"x": 0.4859106242656708, "y": 0.3925773799419403, "z": 0.33150970935821533, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2456}, {"x": 0.48691242933273315, "y": 0.39969348907470703, "z": 0.33403873443603516, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2456}, {"x": 0.4826171100139618, "y": 0.4008076786994934, "z": 0.0018763637635856867, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2456}, {"x": 0.47907015681266785, "y": 0.39956870675086975, "z": -0.021001581102609634, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2456}, {"x": 0.48274481296539307, "y": 0.3923565745353699, "z": -0.026448773220181465, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2456}, {"x": 0.45615535974502563, "y": 0.7921417355537415, "z": -0.11100341379642487, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2456}, {"x": 0.4704817235469818, "y": 0.3823741376399994, "z": -0.016860786825418472, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2456}, {"x": 0.46743181347846985, "y": 0.5008818507194519, "z": -0.08491779118776321, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2456}, {"x": 0.4782887101173401, "y": 0.3829241693019867, "z": -0.02717316523194313, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2456}, {"x": 0.4799700677394867, "y": 0.38363224267959595, "z": -0.026945967227220535, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2456}, {"x": 0.4766760766506195, "y": 0.38204485177993774, "z": -0.027297768741846085, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2456}, {"x": 0.46452516317367554, "y": 0.8283424377441406, "z": -0.1864059865474701, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2456}, {"x": 0.4532003402709961, "y": 0.8074345588684082, "z": -0.11445163190364838, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2456}, {"x": 0.470627099275589, "y": 0.5616068840026855, "z": -0.06084273010492325, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2456}, {"x": 0.4893341362476349, "y": 0.5731680393218994, "z": -0.12989495694637299, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2456}, {"x": 0.46703511476516724, "y": 0.6791356205940247, "z": -0.09424883872270584, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2456}, {"x": 0.4858555495738983, "y": 0.571673572063446, "z": -0.13266345858573914, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2456}, {"x": 0.4630856215953827, "y": 0.4281369745731354, "z": -0.04704459011554718, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2456}, {"x": 0.48844850063323975, "y": 0.5666451454162598, "z": -0.11384529620409012, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2456}, {"x": 0.4840943217277527, "y": 0.5522084832191467, "z": -0.11496452242136002, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2456}, {"x": 0.48780497908592224, "y": 0.5976523160934448, "z": -0.1141132537741214, "name": "INDEX_FINGER_DIP", "type": "right_hand", "index": 7, "frame_index": 2456}, {"x": 0.4886755645275116, "y": 0.5827948451042175, "z": -0.11249410104937851, "name": "INDEX_FINGER_MCP", "type": "right_hand", "index": 5, "frame_index": 2456}, {"x": 0.4880758821964264, "y": 0.5918318629264832, "z": -0.1131533362204209, "name": "INDEX_FINGER_PIP", "type": "right_hand", "index": 6, "frame_index": 2456}, {"x": 0.48755690455436707, "y": 0.6024888157844543, "z": -0.1148948739937623, "name": "INDEX_FINGER_TIP", "type": "right_hand", "index": 8, "frame_index": 2456}, {"x": 0.4860072731971741, "y": 0.5988366007804871, "z": -0.11492641646327684, "name": "MIDDLE_FINGER_DIP", "type": "right_hand", "index": 11, "frame_index": 2456}, {"x": 0.4875057637691498, "y": 0.5834894180297852, "z": -0.11328524048440158, "name": "MIDDLE_FINGER_MCP", "type": "right_hand", "index": 9, "frame_index": 2456}, {"x": 0.4863740801811218, "y": 0.592920184135437, "z": -0.11390229943208396, "name": "MIDDLE_FINGER_PIP", "type": "right_hand", "index": 10, "frame_index": 2456}, {"x": 0.48585498332977295, "y": 0.6039522886276245, "z": -0.1156987079884857, "name": "MIDDLE_FINGER_TIP", "type": "right_hand", "index": 12, "frame_index": 2456}, {"x": 0.4834034740924835, "y": 0.5934931635856628, "z": -0.11609243438579142, "name": "PINKY_DIP", "type": "right_hand", "index": 19, "frame_index": 2456}, {"x": 0.4844667613506317, "y": 0.5813250541687012, "z": -0.11560719803674147, "name": "PINKY_MCP", "type": "right_hand", "index": 17, "frame_index": 2456}, {"x": 0.4838256239891052, "y": 0.5887560248374939, "z": -0.11612572055310011, "name": "PINKY_PIP", "type": "right_hand", "index": 18, "frame_index": 2456}, {"x": 0.48303958773612976, "y": 0.5976126194000244, "z": -0.11609867285005748, "name": "PINKY_TIP", "type": "right_hand", "index": 20, "frame_index": 2456}, {"x": 0.48475465178489685, "y": 0.5977768301963806, "z": -0.11550934659317136, "name": "RING_FINGER_DIP", "type": "right_hand", "index": 15, "frame_index": 2456}, {"x": 0.4860542416572571, "y": 0.5829285979270935, "z": -0.11438647040631622, "name": "RING_FINGER_MCP", "type": "right_hand", "index": 13, "frame_index": 2456}, {"x": 0.4851638376712799, "y": 0.5921145677566528, "z": -0.1151171388628427, "name": "RING_FINGER_PIP", "type": "right_hand", "index": 14, "frame_index": 2456}, {"x": 0.4845479130744934, "y": 0.6024566888809204, "z": -0.1158056422136724, "name": "RING_FINGER_TIP", "type": "right_hand", "index": 16, "frame_index": 2456}, {"x": 0.4873930513858795, "y": 0.5674851536750793, "z": -0.1149430118057353, "name": "THUMB_CMC", "type": "right_hand", "index": 1, "frame_index": 2456}, {"x": 0.4890841245651245, "y": 0.5864542722702026, "z": -0.11458145262440667, "name": "THUMB_IP", "type": "right_hand", "index": 3, "frame_index": 2456}, {"x": 0.4885592460632324, "y": 0.5780810713768005, "z": -0.11459401829051785, "name": "THUMB_MCP", "type": "right_hand", "index": 2, "frame_index": 2456}, {"x": 0.48963049054145813, "y": 0.5933036804199219, "z": -0.11455185213708319, "name": "THUMB_TIP", "type": "right_hand", "index": 4, "frame_index": 2456}, {"x": 0.48564890027046204, "y": 0.5589728951454163, "z": -0.11496449914587359, "name": "WRIST", "type": "right_hand", "index": 0, "frame_index": 2456}], [{"x": 0.47763025760650635, "y": 0.7798096537590027, "z": 0.056514449417591095, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2457}, {"x": 0.48173046112060547, "y": 0.38687044382095337, "z": 0.08252818137407303, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2457}, {"x": 0.49611976742744446, "y": 0.4552472233772278, "z": 0.26531994342803955, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2457}, {"x": 0.48429203033447266, "y": 0.38575655221939087, "z": 0.02865772508084774, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2457}, {"x": 0.4841267168521881, "y": 0.38616856932640076, "z": 0.028754128143191338, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2457}, {"x": 0.4846591651439667, "y": 0.38537371158599854, "z": 0.02869397960603237, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2457}, {"x": 0.4939590394496918, "y": 0.8095749020576477, "z": 0.006308136973530054, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2457}, {"x": 0.4694076180458069, "y": 0.7992884516716003, "z": 0.055480167269706726, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2457}, {"x": 0.48844629526138306, "y": 0.5627138018608093, "z": 0.061928145587444305, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2457}, {"x": 0.4825443923473358, "y": 0.39930692315101624, "z": 0.34740954637527466, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2457}, {"x": 0.4850371778011322, "y": 0.6765024662017822, "z": 0.04317811504006386, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2457}, {"x": 0.4823574423789978, "y": 0.40165185928344727, "z": 0.35896697640419006, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2457}, {"x": 0.4795730412006378, "y": 0.43567538261413574, "z": 0.15314725041389465, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2457}, {"x": 0.4852571487426758, "y": 0.4023919403553009, "z": 0.3379499614238739, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2457}, {"x": 0.4865468144416809, "y": 0.4020090401172638, "z": 0.3405417501926422, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2457}, {"x": 0.4833712577819824, "y": 0.4039837718009949, "z": 0.03820467367768288, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2457}, {"x": 0.481078177690506, "y": 0.40294745564460754, "z": 0.012309483252465725, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2457}, {"x": 0.4845507740974426, "y": 0.39548224210739136, "z": 0.016011212021112442, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2457}, {"x": 0.4561741054058075, "y": 0.7922067046165466, "z": -0.09456831961870193, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2457}, {"x": 0.472662091255188, "y": 0.383745014667511, "z": -0.003964920993894339, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2457}, {"x": 0.4720185399055481, "y": 0.5004417896270752, "z": -0.08869367092847824, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2457}, {"x": 0.48109063506126404, "y": 0.3849915564060211, "z": 0.010034059174358845, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2457}, {"x": 0.48244568705558777, "y": 0.3856853246688843, "z": 0.010246279649436474, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2457}, {"x": 0.47956764698028564, "y": 0.3841225802898407, "z": 0.009925438091158867, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2457}, {"x": 0.46474382281303406, "y": 0.8288595080375671, "z": -0.16526207327842712, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2457}, {"x": 0.453069269657135, "y": 0.807404100894928, "z": -0.09743643552064896, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2457}, {"x": 0.47142788767814636, "y": 0.56004798412323, "z": -0.062050819396972656, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2457}, {"x": 0.49022728204727173, "y": 0.5731230974197388, "z": -0.12419503182172775, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2457}, {"x": 0.4696851074695587, "y": 0.6777166724205017, "z": -0.08611596375703812, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2457}, {"x": 0.48661357164382935, "y": 0.5717682838439941, "z": -0.12952013313770294, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2457}, {"x": 0.4642387926578522, "y": 0.4259141683578491, "z": -0.045325007289648056, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2457}, {"x": 0.4893803894519806, "y": 0.5668604373931885, "z": -0.11056286841630936, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2457}, {"x": 0.4851604402065277, "y": 0.5519382953643799, "z": -0.11269911378622055, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2457}, {"x": 0.4932895600795746, "y": 0.5959595441818237, "z": -0.11142448999453336, "name": "INDEX_FINGER_DIP", "type": "right_hand", "index": 7, "frame_index": 2457}, {"x": 0.4913915693759918, "y": 0.5810883045196533, "z": -0.1105769444257021, "name": "INDEX_FINGER_MCP", "type": "right_hand", "index": 5, "frame_index": 2457}, {"x": 0.49253347516059875, "y": 0.5904856324195862, "z": -0.11086343438364565, "name": "INDEX_FINGER_PIP", "type": "right_hand", "index": 6, "frame_index": 2457}, {"x": 0.4939969480037689, "y": 0.5998908877372742, "z": -0.11183391156373546, "name": "INDEX_FINGER_TIP", "type": "right_hand", "index": 8, "frame_index": 2457}, {"x": 0.4916330873966217, "y": 0.5964199304580688, "z": -0.11222533622640185, "name": "MIDDLE_FINGER_DIP", "type": "right_hand", "index": 11, "frame_index": 2457}, {"x": 0.4908248782157898, "y": 0.5817047357559204, "z": -0.11103298864327371, "name": "MIDDLE_FINGER_MCP", "type": "right_hand", "index": 9, "frame_index": 2457}, {"x": 0.4914751350879669, "y": 0.5908617377281189, "z": -0.11139732867013663, "name": "MIDDLE_FINGER_PIP", "type": "right_hand", "index": 10, "frame_index": 2457}, {"x": 0.49169033765792847, "y": 0.600919783115387, "z": -0.11278801753360312, "name": "MIDDLE_FINGER_TIP", "type": "right_hand", "index": 12, "frame_index": 2457}, {"x": 0.4869535267353058, "y": 0.594292938709259, "z": -0.11249275176669471, "name": "PINKY_DIP", "type": "right_hand", "index": 19, "frame_index": 2457}, {"x": 0.4876575171947479, "y": 0.5815381407737732, "z": -0.1124109108641278, "name": "PINKY_MCP", "type": "right_hand", "index": 17, "frame_index": 2457}, {"x": 0.48718518018722534, "y": 0.5892773866653442, "z": -0.11252872906334233, "name": "PINKY_PIP", "type": "right_hand", "index": 18, "frame_index": 2457}, {"x": 0.4866138994693756, "y": 0.5987040400505066, "z": -0.1124723185057519, "name": "PINKY_TIP", "type": "right_hand", "index": 20, "frame_index": 2457}, {"x": 0.4890752136707306, "y": 0.5967729091644287, "z": -0.11259057340066647, "name": "RING_FINGER_DIP", "type": "right_hand", "index": 15, "frame_index": 2457}, {"x": 0.4895147979259491, "y": 0.5817604064941406, "z": -0.1116878652246669, "name": "RING_FINGER_MCP", "type": "right_hand", "index": 13, "frame_index": 2457}, {"x": 0.48950111865997314, "y": 0.5909326672554016, "z": -0.11205716140102595, "name": "RING_FINGER_PIP", "type": "right_hand", "index": 14, "frame_index": 2457}, {"x": 0.4885503649711609, "y": 0.6017415523529053, "z": -0.11296674332697876, "name": "RING_FINGER_TIP", "type": "right_hand", "index": 16, "frame_index": 2457}, {"x": 0.4880402386188507, "y": 0.5671351552009583, "z": -0.11264967027454986, "name": "THUMB_CMC", "type": "right_hand", "index": 1, "frame_index": 2457}, {"x": 0.48888450860977173, "y": 0.5854557156562805, "z": -0.11193692754022777, "name": "THUMB_IP", "type": "right_hand", "index": 3, "frame_index": 2457}, {"x": 0.48880642652511597, "y": 0.5775219202041626, "z": -0.1121962447068654, "name": "THUMB_MCP", "type": "right_hand", "index": 2, "frame_index": 2457}, {"x": 0.48899516463279724, "y": 0.5913633108139038, "z": -0.11152514338027686, "name": "THUMB_TIP", "type": "right_hand", "index": 4, "frame_index": 2457}, {"x": 0.4873316287994385, "y": 0.5596972703933716, "z": -0.1126990990985739, "name": "WRIST", "type": "right_hand", "index": 0, "frame_index": 2457}], [{"x": 0.4777781069278717, "y": 0.7802544832229614, "z": 0.07693136483430862, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2458}, {"x": 0.48171868920326233, "y": 0.38770791888237, "z": 0.05977512151002884, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2458}, {"x": 0.4859229326248169, "y": 0.4989604949951172, "z": 0.23519212007522583, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2458}, {"x": 0.4844663441181183, "y": 0.38653045892715454, "z": -0.006869828328490257, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2458}, {"x": 0.48426610231399536, "y": 0.3869984745979309, "z": -0.006767247803509235, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2458}, {"x": 0.4847710430622101, "y": 0.3861450254917145, "z": -0.0067894612438976765, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2458}, {"x": 0.49432677030563354, "y": 0.8096240162849426, "z": 0.017696324735879898, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2458}, {"x": 0.46930548548698425, "y": 0.8001766800880432, "z": 0.07661236822605133, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2458}, {"x": 0.4875096082687378, "y": 0.5624757409095764, "z": 0.062443532049655914, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2458}, {"x": 0.4878433346748352, "y": 0.5707312226295471, "z": 0.09089166671037674, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2458}, {"x": 0.4851154088973999, "y": 0.6755249500274658, "z": 0.04441581293940544, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2458}, {"x": 0.4861782193183899, "y": 0.5700176954269409, "z": 0.10994896292686462, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2458}, {"x": 0.47843658924102783, "y": 0.4360733926296234, "z": 0.13420632481575012, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2458}, {"x": 0.4880436062812805, "y": 0.5624592304229736, "z": 0.10433126240968704, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2458}, {"x": 0.4871302545070648, "y": 0.550298810005188, "z": 0.11379173398017883, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2458}, {"x": 0.48372313380241394, "y": 0.4040778875350952, "z": 0.005367028061300516, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2458}, {"x": 0.48125967383384705, "y": 0.4033527374267578, "z": -0.018327752128243446, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2458}, {"x": 0.48459917306900024, "y": 0.3961490988731384, "z": -0.021421290934085846, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2458}, {"x": 0.45653894543647766, "y": 0.7921185493469238, "z": -0.08883025497198105, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2458}, {"x": 0.4724894165992737, "y": 0.384101539850235, "z": -0.016129285097122192, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2458}, {"x": 0.4745071232318878, "y": 0.49877527356147766, "z": -0.13019980490207672, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2458}, {"x": 0.4805430769920349, "y": 0.38601911067962646, "z": -0.024042511358857155, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2458}, {"x": 0.4821586012840271, "y": 0.3867081105709076, "z": -0.023836305364966393, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2458}, {"x": 0.4787890613079071, "y": 0.3851146399974823, "z": -0.024138370528817177, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2458}, {"x": 0.46467939019203186, "y": 0.8288846015930176, "z": -0.16761860251426697, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2458}, {"x": 0.4532076418399811, "y": 0.8069732189178467, "z": -0.09103871136903763, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2458}, {"x": 0.47251245379447937, "y": 0.5593755841255188, "z": -0.06257046014070511, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2458}, {"x": 0.4914773404598236, "y": 0.5748763084411621, "z": -0.19431854784488678, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2458}, {"x": 0.4718819260597229, "y": 0.6773805022239685, "z": -0.09179787337779999, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2458}, {"x": 0.4883888065814972, "y": 0.5735070705413818, "z": -0.1976906657218933, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2458}, {"x": 0.4661864638328552, "y": 0.42311617732048035, "z": -0.06926727294921875, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2458}, {"x": 0.4907003939151764, "y": 0.5683714747428894, "z": -0.1701972484588623, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2458}, {"x": 0.4873189330101013, "y": 0.5541151762008667, "z": -0.1711346060037613, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2458}, {"x": 0.493502140045166, "y": 0.5963566899299622, "z": 0.11753428401425481, "name": "INDEX_FINGER_DIP", "type": "left_hand", "index": 7, "frame_index": 2458}, {"x": 0.49292874336242676, "y": 0.581194281578064, "z": 0.11770184058696032, "name": "INDEX_FINGER_MCP", "type": "left_hand", "index": 5, "frame_index": 2458}, {"x": 0.49383020401000977, "y": 0.5905717611312866, "z": 0.118037314619869, "name": "INDEX_FINGER_PIP", "type": "left_hand", "index": 6, "frame_index": 2458}, {"x": 0.4934089779853821, "y": 0.6003686785697937, "z": 0.11719181318767369, "name": "INDEX_FINGER_TIP", "type": "left_hand", "index": 8, "frame_index": 2458}, {"x": 0.490524560213089, "y": 0.5973506569862366, "z": 0.11784438230097294, "name": "MIDDLE_FINGER_DIP", "type": "left_hand", "index": 11, "frame_index": 2458}, {"x": 0.49204158782958984, "y": 0.5815963745117188, "z": 0.11789751937612891, "name": "MIDDLE_FINGER_MCP", "type": "left_hand", "index": 9, "frame_index": 2458}, {"x": 0.49176597595214844, "y": 0.5916037559509277, "z": 0.11859519453719258, "name": "MIDDLE_FINGER_PIP", "type": "left_hand", "index": 10, "frame_index": 2458}, {"x": 0.48939451575279236, "y": 0.6015030741691589, "z": 0.11725989519618452, "name": "MIDDLE_FINGER_TIP", "type": "left_hand", "index": 12, "frame_index": 2458}, {"x": 0.48712459206581116, "y": 0.5944727063179016, "z": 0.11873963987454772, "name": "PINKY_DIP", "type": "left_hand", "index": 19, "frame_index": 2458}, {"x": 0.4885557293891907, "y": 0.5810372233390808, "z": 0.11725866654887795, "name": "PINKY_MCP", "type": "left_hand", "index": 17, "frame_index": 2458}, {"x": 0.4879071116447449, "y": 0.5894187688827515, "z": 0.11824485519900918, "name": "PINKY_PIP", "type": "left_hand", "index": 18, "frame_index": 2458}, {"x": 0.4864802956581116, "y": 0.5981818437576294, "z": 0.11902286810800433, "name": "PINKY_TIP", "type": "left_hand", "index": 20, "frame_index": 2458}, {"x": 0.4884834289550781, "y": 0.5964958071708679, "z": 0.1181702883914113, "name": "RING_FINGER_DIP", "type": "left_hand", "index": 15, "frame_index": 2458}, {"x": 0.4904705584049225, "y": 0.5815652012825012, "z": 0.11768641625531018, "name": "RING_FINGER_MCP", "type": "left_hand", "index": 13, "frame_index": 2458}, {"x": 0.48983120918273926, "y": 0.5912045240402222, "z": 0.11843492556363344, "name": "RING_FINGER_PIP", "type": "left_hand", "index": 14, "frame_index": 2458}, {"x": 0.48733457922935486, "y": 0.6002986431121826, "z": 0.11788144195452332, "name": "RING_FINGER_TIP", "type": "left_hand", "index": 16, "frame_index": 2458}, {"x": 0.4879973828792572, "y": 0.5678046941757202, "z": 0.1131547661498189, "name": "THUMB_CMC", "type": "left_hand", "index": 1, "frame_index": 2458}, {"x": 0.48839443922042847, "y": 0.5883510112762451, "z": 0.11413595214253291, "name": "THUMB_IP", "type": "left_hand", "index": 3, "frame_index": 2458}, {"x": 0.488540381193161, "y": 0.579187273979187, "z": 0.11372236535680713, "name": "THUMB_MCP", "type": "left_hand", "index": 2, "frame_index": 2458}, {"x": 0.4882185757160187, "y": 0.5957069993019104, "z": 0.1148074516095221, "name": "THUMB_TIP", "type": "left_hand", "index": 4, "frame_index": 2458}, {"x": 0.4881773591041565, "y": 0.5573558807373047, "z": 0.11379176481379716, "name": "WRIST", "type": "left_hand", "index": 0, "frame_index": 2458}, {"x": 0.48943668603897095, "y": 0.5947358012199402, "z": -0.16916304919868708, "name": "INDEX_FINGER_DIP", "type": "right_hand", "index": 7, "frame_index": 2458}, {"x": 0.4919823110103607, "y": 0.5790179967880249, "z": -0.16811731387861073, "name": "INDEX_FINGER_MCP", "type": "right_hand", "index": 5, "frame_index": 2458}, {"x": 0.4908415377140045, "y": 0.5882015824317932, "z": -0.1684314131271094, "name": "INDEX_FINGER_PIP", "type": "right_hand", "index": 6, "frame_index": 2458}, {"x": 0.488269567489624, "y": 0.5993659496307373, "z": -0.16969257255550474, "name": "INDEX_FINGER_TIP", "type": "right_hand", "index": 8, "frame_index": 2458}, {"x": 0.48887163400650024, "y": 0.5953567624092102, "z": -0.169996777898632, "name": "MIDDLE_FINGER_DIP", "type": "right_hand", "index": 11, "frame_index": 2458}, {"x": 0.49175986647605896, "y": 0.579472005367279, "z": -0.1692844006465748, "name": "MIDDLE_FINGER_MCP", "type": "right_hand", "index": 9, "frame_index": 2458}, {"x": 0.49033671617507935, "y": 0.589106559753418, "z": -0.16935369314160198, "name": "MIDDLE_FINGER_PIP", "type": "right_hand", "index": 10, "frame_index": 2458}, {"x": 0.4874042272567749, "y": 0.6000093817710876, "z": -0.1705357261816971, "name": "MIDDLE_FINGER_TIP", "type": "right_hand", "index": 12, "frame_index": 2458}, {"x": 0.48776209354400635, "y": 0.5931984782218933, "z": -0.17112606650061934, "name": "PINKY_DIP", "type": "right_hand", "index": 19, "frame_index": 2458}, {"x": 0.4892041087150574, "y": 0.5798460841178894, "z": -0.17191177909262478, "name": "PINKY_MCP", "type": "right_hand", "index": 17, "frame_index": 2458}, {"x": 0.4884960353374481, "y": 0.5880440473556519, "z": -0.1715464369917754, "name": "PINKY_PIP", "type": "right_hand", "index": 18, "frame_index": 2458}, {"x": 0.4870036244392395, "y": 0.5973204970359802, "z": -0.17090250265027862, "name": "PINKY_TIP", "type": "right_hand", "index": 20, "frame_index": 2458}, {"x": 0.48843610286712646, "y": 0.5951529741287231, "z": -0.17038057546596974, "name": "RING_FINGER_DIP", "type": "right_hand", "index": 15, "frame_index": 2458}, {"x": 0.4908348321914673, "y": 0.5797969102859497, "z": -0.17057450773427263, "name": "RING_FINGER_MCP", "type": "right_hand", "index": 13, "frame_index": 2458}, {"x": 0.48967695236206055, "y": 0.5892624258995056, "z": -0.17038392834365368, "name": "RING_FINGER_PIP", "type": "right_hand", "index": 14, "frame_index": 2458}, {"x": 0.48727232217788696, "y": 0.5996148586273193, "z": -0.1705062544788234, "name": "RING_FINGER_TIP", "type": "right_hand", "index": 16, "frame_index": 2458}, {"x": 0.48847997188568115, "y": 0.5655893087387085, "z": -0.16985419124830514, "name": "THUMB_CMC", "type": "right_hand", "index": 1, "frame_index": 2458}, {"x": 0.48892924189567566, "y": 0.5809170603752136, "z": -0.16920169827062637, "name": "THUMB_IP", "type": "right_hand", "index": 3, "frame_index": 2458}, {"x": 0.48892664909362793, "y": 0.5746600031852722, "z": -0.1692515251925215, "name": "THUMB_MCP", "type": "right_hand", "index": 2, "frame_index": 2458}, {"x": 0.48859137296676636, "y": 0.5862536430358887, "z": -0.16917688795365393, "name": "THUMB_TIP", "type": "right_hand", "index": 4, "frame_index": 2458}, {"x": 0.4892748296260834, "y": 0.5577059984207153, "z": -0.17113457678991573, "name": "WRIST", "type": "right_hand", "index": 0, "frame_index": 2458}], [{"x": 0.47788238525390625, "y": 0.7808408737182617, "z": 0.08349104225635529, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2459}, {"x": 0.48170366883277893, "y": 0.3886699676513672, "z": 0.05546518787741661, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2459}, {"x": 0.48569193482398987, "y": 0.4990117847919464, "z": 0.15025530755519867, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2459}, {"x": 0.4849826395511627, "y": 0.3885466158390045, "z": -0.002028736984357238, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2459}, {"x": 0.4848833680152893, "y": 0.3890191912651062, "z": -0.0019329929491505027, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2459}, {"x": 0.4851277470588684, "y": 0.3881908655166626, "z": -0.0019475540611892939, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2459}, {"x": 0.49444979429244995, "y": 0.8096679449081421, "z": 0.025721339508891106, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2459}, {"x": 0.46940842270851135, "y": 0.8008453249931335, "z": 0.08332955837249756, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2459}, {"x": 0.48678427934646606, "y": 0.5625725388526917, "z": 0.06208273023366928, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2459}, {"x": 0.4909723401069641, "y": 0.5647608637809753, "z": 0.03619213029742241, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2459}, {"x": 0.485150009393692, "y": 0.675618052482605, "z": 0.04896549880504608, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2459}, {"x": 0.48919230699539185, "y": 0.5737133622169495, "z": 0.05188041925430298, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2459}, {"x": 0.4774625897407532, "y": 0.4358460009098053, "z": 0.12744852900505066, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2459}, {"x": 0.4907931685447693, "y": 0.5609773397445679, "z": 0.05070286989212036, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2459}, {"x": 0.4893353283405304, "y": 0.5517622828483582, "z": 0.05950756371021271, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2459}, {"x": 0.4843085706233978, "y": 0.4058282971382141, "z": 0.009500035084784031, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2459}, {"x": 0.4819956123828888, "y": 0.40481647849082947, "z": -0.015487800352275372, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2459}, {"x": 0.4853062033653259, "y": 0.39801186323165894, "z": -0.014069989323616028, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2459}, {"x": 0.4569772481918335, "y": 0.7919567823410034, "z": -0.07520410418510437, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2459}, {"x": 0.4733179807662964, "y": 0.3850097954273224, "z": -0.02415488474071026, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2459}, {"x": 0.4783293902873993, "y": 0.4991864860057831, "z": -0.1247371956706047, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2459}, {"x": 0.4814186096191406, "y": 0.3879023790359497, "z": -0.02026403322815895, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2459}, {"x": 0.4829396903514862, "y": 0.38862794637680054, "z": -0.020063491538167, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2459}, {"x": 0.479687362909317, "y": 0.38707685470581055, "z": -0.020357806235551834, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2459}, {"x": 0.46476441621780396, "y": 0.8288573026657104, "z": -0.1535416692495346, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2459}, {"x": 0.45329388976097107, "y": 0.806487500667572, "z": -0.07628507167100906, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2459}, {"x": 0.47303488850593567, "y": 0.5591432452201843, "z": -0.062210969626903534, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2459}, {"x": 0.4936847388744354, "y": 0.5800051689147949, "z": -0.17022767663002014, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2459}, {"x": 0.47311073541641235, "y": 0.6772319078445435, "z": -0.08599899709224701, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2459}, {"x": 0.4907290041446686, "y": 0.5785189270973206, "z": -0.17162030935287476, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2459}, {"x": 0.46721550822257996, "y": 0.4220081865787506, "z": -0.07708645612001419, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2459}, {"x": 0.49329954385757446, "y": 0.5739616751670837, "z": -0.14781920611858368, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2459}, {"x": 0.4900783598423004, "y": 0.5597590208053589, "z": -0.14838123321533203, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2459}, {"x": 0.4884229898452759, "y": 0.5928844809532166, "z": -0.14670261030551046, "name": "INDEX_FINGER_DIP", "type": "right_hand", "index": 7, "frame_index": 2459}, {"x": 0.49077531695365906, "y": 0.5794718265533447, "z": -0.1456822999753058, "name": "INDEX_FINGER_MCP", "type": "right_hand", "index": 5, "frame_index": 2459}, {"x": 0.48933061957359314, "y": 0.5875596404075623, "z": -0.14609896973706782, "name": "INDEX_FINGER_PIP", "type": "right_hand", "index": 6, "frame_index": 2459}, {"x": 0.4877455532550812, "y": 0.5971370935440063, "z": -0.14718059240840375, "name": "INDEX_FINGER_TIP", "type": "right_hand", "index": 8, "frame_index": 2459}, {"x": 0.4889068603515625, "y": 0.592986524105072, "z": -0.14814356382703409, "name": "MIDDLE_FINGER_DIP", "type": "right_hand", "index": 11, "frame_index": 2459}, {"x": 0.49119940400123596, "y": 0.5793031454086304, "z": -0.14738810143899173, "name": "MIDDLE_FINGER_MCP", "type": "right_hand", "index": 9, "frame_index": 2459}, {"x": 0.4897279143333435, "y": 0.5877956748008728, "z": -0.1476470194174908, "name": "MIDDLE_FINGER_PIP", "type": "right_hand", "index": 10, "frame_index": 2459}, {"x": 0.48833730816841125, "y": 0.597470223903656, "z": -0.14860612449410837, "name": "MIDDLE_FINGER_TIP", "type": "right_hand", "index": 12, "frame_index": 2459}, {"x": 0.4913526773452759, "y": 0.5860098004341125, "z": -0.1508078589104116, "name": "PINKY_DIP", "type": "right_hand", "index": 19, "frame_index": 2459}, {"x": 0.4917205572128296, "y": 0.5768584609031677, "z": -0.15083217341452837, "name": "PINKY_MCP", "type": "right_hand", "index": 17, "frame_index": 2459}, {"x": 0.4915986955165863, "y": 0.5826345086097717, "z": -0.15098242228850722, "name": "PINKY_PIP", "type": "right_hand", "index": 18, "frame_index": 2459}, {"x": 0.49112197756767273, "y": 0.5889747738838196, "z": -0.1507882378064096, "name": "PINKY_TIP", "type": "right_hand", "index": 20, "frame_index": 2459}, {"x": 0.4901539385318756, "y": 0.5910133123397827, "z": -0.14942874771077186, "name": "RING_FINGER_DIP", "type": "right_hand", "index": 15, "frame_index": 2459}, {"x": 0.4915704131126404, "y": 0.5783368945121765, "z": -0.14914606953971088, "name": "RING_FINGER_MCP", "type": "right_hand", "index": 13, "frame_index": 2459}, {"x": 0.4906735420227051, "y": 0.5864090919494629, "z": -0.1493590873433277, "name": "RING_FINGER_PIP", "type": "right_hand", "index": 14, "frame_index": 2459}, {"x": 0.48983022570610046, "y": 0.5950779914855957, "z": -0.14965199248399585, "name": "RING_FINGER_TIP", "type": "right_hand", "index": 16, "frame_index": 2459}, {"x": 0.4896298944950104, "y": 0.5674728155136108, "z": -0.14634581329301, "name": "THUMB_CMC", "type": "right_hand", "index": 1, "frame_index": 2459}, {"x": 0.48964568972587585, "y": 0.5818520188331604, "z": -0.14551795995794237, "name": "THUMB_IP", "type": "right_hand", "index": 3, "frame_index": 2459}, {"x": 0.48960748314857483, "y": 0.5761429071426392, "z": -0.14559802156873047, "name": "THUMB_MCP", "type": "right_hand", "index": 2, "frame_index": 2459}, {"x": 0.48938748240470886, "y": 0.5863888263702393, "z": -0.14555266685783863, "name": "THUMB_TIP", "type": "right_hand", "index": 4, "frame_index": 2459}, {"x": 0.4903666079044342, "y": 0.5580112934112549, "z": -0.1483812127760462, "name": "WRIST", "type": "right_hand", "index": 0, "frame_index": 2459}], [{"x": 0.4779634177684784, "y": 0.7805317044258118, "z": 0.11070652306079865, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2460}, {"x": 0.4807080626487732, "y": 0.3884623348712921, "z": 0.05951665714383125, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2460}, {"x": 0.4832656681537628, "y": 0.500343918800354, "z": 0.14435675740242004, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2460}, {"x": 0.48554009199142456, "y": 0.38974982500076294, "z": 0.015112269669771194, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2460}, {"x": 0.48600026965141296, "y": 0.3902669847011566, "z": 0.015215770341455936, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2460}, {"x": 0.4852078855037689, "y": 0.3893236517906189, "z": 0.01518480945378542, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2460}, {"x": 0.4945954382419586, "y": 0.8094509840011597, "z": 0.06070900335907936, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2460}, {"x": 0.4694473445415497, "y": 0.8007771968841553, "z": 0.1113075464963913, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2460}, {"x": 0.48594850301742554, "y": 0.5626749396324158, "z": 0.06521046906709671, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2460}, {"x": 0.4898720681667328, "y": 0.5795543193817139, "z": 0.06553181260824203, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2460}, {"x": 0.48517507314682007, "y": 0.6758070588111877, "z": 0.07108146697282791, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2460}, {"x": 0.4881194531917572, "y": 0.5790559649467468, "z": 0.08272378146648407, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2460}, {"x": 0.4755939841270447, "y": 0.43431273102760315, "z": 0.12372712045907974, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2460}, {"x": 0.4898192286491394, "y": 0.5711247324943542, "z": 0.07732779532670975, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2460}, {"x": 0.48880112171173096, "y": 0.5590061545372009, "z": 0.08603373914957047, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2460}, {"x": 0.48493874073028564, "y": 0.4072682559490204, "z": 0.024865809828042984, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2460}, {"x": 0.4838443994522095, "y": 0.40628352761268616, "z": -0.003500406164675951, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2460}, {"x": 0.48710793256759644, "y": 0.39949607849121094, "z": 0.005660234950482845, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2460}, {"x": 0.4571297764778137, "y": 0.7922183275222778, "z": -0.07419652491807938, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2460}, {"x": 0.4757825434207916, "y": 0.38578659296035767, "z": -0.03211317956447601, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2460}, {"x": 0.4781390130519867, "y": 0.49792781472206116, "z": -0.14828282594680786, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2460}, {"x": 0.48427897691726685, "y": 0.3891228139400482, "z": -0.005598795134574175, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2460}, {"x": 0.4853315055370331, "y": 0.3899165093898773, "z": -0.005413977429270744, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2460}, {"x": 0.48307254910469055, "y": 0.38831377029418945, "z": -0.005683401133865118, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2460}, {"x": 0.4651532769203186, "y": 0.8288733959197998, "z": -0.15010659396648407, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2460}, {"x": 0.45337167382240295, "y": 0.8066509962081909, "z": -0.07590317726135254, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2460}, {"x": 0.4730168581008911, "y": 0.5593798756599426, "z": -0.06531894207000732, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2460}, {"x": 0.494461327791214, "y": 0.5781161785125732, "z": -0.19681622087955475, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2460}, {"x": 0.4732531011104584, "y": 0.6773619055747986, "z": -0.08460088819265366, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2460}, {"x": 0.4916367530822754, "y": 0.5771377086639404, "z": -0.2012985646724701, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2460}, {"x": 0.4684351980686188, "y": 0.4218311011791229, "z": -0.0895962193608284, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2460}, {"x": 0.4941238760948181, "y": 0.5721293091773987, "z": -0.17433780431747437, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2460}, {"x": 0.49106308817863464, "y": 0.55720055103302, "z": -0.17546503245830536, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2460}, {"x": 0.4915037155151367, "y": 0.601959228515625, "z": 0.08567650002078153, "name": "INDEX_FINGER_DIP", "type": "left_hand", "index": 7, "frame_index": 2460}, {"x": 0.4886879026889801, "y": 0.588219404220581, "z": 0.08741510240361094, "name": "INDEX_FINGER_MCP", "type": "left_hand", "index": 5, "frame_index": 2460}, {"x": 0.4884184002876282, "y": 0.5996896028518677, "z": 0.08636934086098336, "name": "INDEX_FINGER_PIP", "type": "left_hand", "index": 6, "frame_index": 2460}, {"x": 0.49378302693367004, "y": 0.6006531715393066, "z": 0.0855545675731264, "name": "INDEX_FINGER_TIP", "type": "left_hand", "index": 8, "frame_index": 2460}, {"x": 0.49201875925064087, "y": 0.6021348237991333, "z": 0.08552138059167191, "name": "MIDDLE_FINGER_DIP", "type": "left_hand", "index": 11, "frame_index": 2460}, {"x": 0.48878225684165955, "y": 0.5878345370292664, "z": 0.0863969064084813, "name": "MIDDLE_FINGER_MCP", "type": "left_hand", "index": 9, "frame_index": 2460}, {"x": 0.4889069199562073, "y": 0.6004139184951782, "z": 0.08573306916514412, "name": "MIDDLE_FINGER_PIP", "type": "left_hand", "index": 10, "frame_index": 2460}, {"x": 0.49409472942352295, "y": 0.6004368662834167, "z": 0.08555222890572622, "name": "MIDDLE_FINGER_TIP", "type": "left_hand", "index": 12, "frame_index": 2460}, {"x": 0.49199551343917847, "y": 0.5979605317115784, "z": 0.0841263021575287, "name": "PINKY_DIP", "type": "left_hand", "index": 19, "frame_index": 2460}, {"x": 0.49061262607574463, "y": 0.5855274200439453, "z": 0.08422381896525621, "name": "PINKY_MCP", "type": "left_hand", "index": 17, "frame_index": 2460}, {"x": 0.4906472861766815, "y": 0.5942667722702026, "z": 0.08413539070170373, "name": "PINKY_PIP", "type": "left_hand", "index": 18, "frame_index": 2460}, {"x": 0.49314790964126587, "y": 0.598946213722229, "z": 0.08418268128298223, "name": "PINKY_TIP", "type": "left_hand", "index": 20, "frame_index": 2460}, {"x": 0.4920974671840668, "y": 0.6007862687110901, "z": 0.08542253042105585, "name": "RING_FINGER_DIP", "type": "left_hand", "index": 15, "frame_index": 2460}, {"x": 0.4895167350769043, "y": 0.5867790579795837, "z": 0.0852840231382288, "name": "RING_FINGER_MCP", "type": "left_hand", "index": 13, "frame_index": 2460}, {"x": 0.48938795924186707, "y": 0.5987869501113892, "z": 0.08524441008921713, "name": "RING_FINGER_PIP", "type": "left_hand", "index": 14, "frame_index": 2460}, {"x": 0.49401432275772095, "y": 0.5995703935623169, "z": 0.08550663251662627, "name": "RING_FINGER_TIP", "type": "left_hand", "index": 16, "frame_index": 2460}, {"x": 0.49212947487831116, "y": 0.5732688903808594, "z": 0.08733007882256061, "name": "THUMB_CMC", "type": "left_hand", "index": 1, "frame_index": 2460}, {"x": 0.4924926161766052, "y": 0.5892297029495239, "z": 0.08770268748048693, "name": "THUMB_IP", "type": "left_hand", "index": 3, "frame_index": 2460}, {"x": 0.4922599792480469, "y": 0.5826385617256165, "z": 0.08771965431515127, "name": "THUMB_MCP", "type": "left_hand", "index": 2, "frame_index": 2460}, {"x": 0.49261853098869324, "y": 0.5944048166275024, "z": 0.08784148748964071, "name": "THUMB_TIP", "type": "left_hand", "index": 4, "frame_index": 2460}, {"x": 0.49150633811950684, "y": 0.5641949772834778, "z": 0.08603370207902472, "name": "WRIST", "type": "left_hand", "index": 0, "frame_index": 2460}], [{"x": 0.478027880191803, "y": 0.7798022031784058, "z": 0.11473290622234344, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2461}, {"x": 0.47989338636398315, "y": 0.38815316557884216, "z": 0.04756470024585724, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2461}, {"x": 0.48318058252334595, "y": 0.5001187920570374, "z": 0.1318274289369583, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2461}, {"x": 0.48525765538215637, "y": 0.38906311988830566, "z": -0.0019120625220239162, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2461}, {"x": 0.4855894446372986, "y": 0.38939371705055237, "z": -0.0018062334274873137, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2461}, {"x": 0.4851754605770111, "y": 0.38875746726989746, "z": -0.0018429867923259735, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2461}, {"x": 0.49477991461753845, "y": 0.8090017437934875, "z": 0.06466560810804367, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2461}, {"x": 0.46922871470451355, "y": 0.800667941570282, "z": 0.11492398381233215, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2461}, {"x": 0.4851926267147064, "y": 0.5627235174179077, "z": 0.06708512455224991, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2461}, {"x": 0.48898962140083313, "y": 0.5746021270751953, "z": 0.052179429680109024, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2461}, {"x": 0.48466241359710693, "y": 0.6757689118385315, "z": 0.07834044098854065, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2461}, {"x": 0.48746567964553833, "y": 0.5747226476669312, "z": 0.07047852128744125, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2461}, {"x": 0.4764555096626282, "y": 0.4318191707134247, "z": 0.11370030790567398, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2461}, {"x": 0.48893487453460693, "y": 0.5684576630592346, "z": 0.0647919625043869, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2461}, {"x": 0.4887586832046509, "y": 0.5549875497817993, "z": 0.07398510724306107, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2461}, {"x": 0.48488539457321167, "y": 0.4067287743091583, "z": 0.008683156222105026, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2461}, {"x": 0.48398256301879883, "y": 0.4054710865020752, "z": -0.016510512679815292, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2461}, {"x": 0.486793577671051, "y": 0.3984500467777252, "z": -0.01235298439860344, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2461}, {"x": 0.45733749866485596, "y": 0.7933105230331421, "z": -0.07274384051561356, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2461}, {"x": 0.47624024748802185, "y": 0.38554394245147705, "z": -0.051439713686704636, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2461}, {"x": 0.4786032438278198, "y": 0.4970313310623169, "z": -0.15984295308589935, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2461}, {"x": 0.4839085340499878, "y": 0.38808155059814453, "z": -0.021030645817518234, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2461}, {"x": 0.48490485548973083, "y": 0.38882017135620117, "z": -0.020839573815464973, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2461}, {"x": 0.4828026592731476, "y": 0.38731783628463745, "z": -0.021120421588420868, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2461}, {"x": 0.4656514525413513, "y": 0.8288882970809937, "z": -0.1481325328350067, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2461}, {"x": 0.45342960953712463, "y": 0.8071457147598267, "z": -0.0748000219464302, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2461}, {"x": 0.4728063941001892, "y": 0.5594140291213989, "z": -0.06716670840978622, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2461}, {"x": 0.4946146607398987, "y": 0.5782371163368225, "z": -0.20690439641475677, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2461}, {"x": 0.47500643134117126, "y": 0.6774010062217712, "z": -0.07999388128519058, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2461}, {"x": 0.4919339120388031, "y": 0.5767912864685059, "z": -0.21027611196041107, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2461}, {"x": 0.47114261984825134, "y": 0.4218299686908722, "z": -0.1073184683918953, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2461}, {"x": 0.49412819743156433, "y": 0.5726734399795532, "z": -0.18332363665103912, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2461}, {"x": 0.49089041352272034, "y": 0.5575773119926453, "z": -0.18400952219963074, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2461}, {"x": 0.4931366741657257, "y": 0.599715530872345, "z": 0.07517259602900594, "name": "INDEX_FINGER_DIP", "type": "left_hand", "index": 7, "frame_index": 2461}, {"x": 0.49309805035591125, "y": 0.58540940284729, "z": 0.07678704964928329, "name": "INDEX_FINGER_MCP", "type": "left_hand", "index": 5, "frame_index": 2461}, {"x": 0.49349144101142883, "y": 0.5959041714668274, "z": 0.07603533728979528, "name": "INDEX_FINGER_PIP", "type": "left_hand", "index": 6, "frame_index": 2461}, {"x": 0.49295350909233093, "y": 0.600095808506012, "z": 0.07496117748087272, "name": "INDEX_FINGER_TIP", "type": "left_hand", "index": 8, "frame_index": 2461}, {"x": 0.49323704838752747, "y": 0.6002563834190369, "z": 0.07521599030587822, "name": "MIDDLE_FINGER_DIP", "type": "left_hand", "index": 11, "frame_index": 2461}, {"x": 0.49295341968536377, "y": 0.5852737426757812, "z": 0.07605279074050486, "name": "MIDDLE_FINGER_MCP", "type": "left_hand", "index": 9, "frame_index": 2461}, {"x": 0.49353766441345215, "y": 0.596752941608429, "z": 0.0757957415189594, "name": "MIDDLE_FINGER_PIP", "type": "left_hand", "index": 10, "frame_index": 2461}, {"x": 0.49308574199676514, "y": 0.599963366985321, "z": 0.07501740602310747, "name": "MIDDLE_FINGER_TIP", "type": "left_hand", "index": 12, "frame_index": 2461}, {"x": 0.4901745319366455, "y": 0.5965709090232849, "z": 0.07480915531050414, "name": "PINKY_DIP", "type": "left_hand", "index": 19, "frame_index": 2461}, {"x": 0.4914310872554779, "y": 0.5831530094146729, "z": 0.07411178716574796, "name": "PINKY_MCP", "type": "left_hand", "index": 17, "frame_index": 2461}, {"x": 0.4904320240020752, "y": 0.5920606255531311, "z": 0.07450085080927238, "name": "PINKY_PIP", "type": "left_hand", "index": 18, "frame_index": 2461}, {"x": 0.49029502272605896, "y": 0.5983104109764099, "z": 0.07512126152869314, "name": "PINKY_TIP", "type": "left_hand", "index": 20, "frame_index": 2461}, {"x": 0.49225494265556335, "y": 0.5995295643806458, "z": 0.07496280956547707, "name": "RING_FINGER_DIP", "type": "left_hand", "index": 15, "frame_index": 2461}, {"x": 0.4924051761627197, "y": 0.5845435261726379, "z": 0.07508946140296757, "name": "RING_FINGER_MCP", "type": "left_hand", "index": 13, "frame_index": 2461}, {"x": 0.49243688583374023, "y": 0.5957139134407043, "z": 0.07510380435269326, "name": "RING_FINGER_PIP", "type": "left_hand", "index": 14, "frame_index": 2461}, {"x": 0.49214932322502136, "y": 0.5997987389564514, "z": 0.07500458823051304, "name": "RING_FINGER_TIP", "type": "left_hand", "index": 16, "frame_index": 2461}, {"x": 0.4907126724720001, "y": 0.571801483631134, "z": 0.07489632000215352, "name": "THUMB_CMC", "type": "left_hand", "index": 1, "frame_index": 2461}, {"x": 0.49123111367225647, "y": 0.5894027948379517, "z": 0.0755854434100911, "name": "THUMB_IP", "type": "left_hand", "index": 3, "frame_index": 2461}, {"x": 0.4910927712917328, "y": 0.5820159912109375, "z": 0.07546633633319288, "name": "THUMB_MCP", "type": "left_hand", "index": 2, "frame_index": 2461}, {"x": 0.4914090633392334, "y": 0.5953623652458191, "z": 0.07590498554054648, "name": "THUMB_TIP", "type": "left_hand", "index": 4, "frame_index": 2461}, {"x": 0.4907895028591156, "y": 0.5614075064659119, "z": 0.07398510659071783, "name": "WRIST", "type": "left_hand", "index": 0, "frame_index": 2461}, {"x": 0.4924774467945099, "y": 0.6016584038734436, "z": -0.1834897109074518, "name": "INDEX_FINGER_DIP", "type": "right_hand", "index": 7, "frame_index": 2461}, {"x": 0.4933846592903137, "y": 0.5876749157905579, "z": -0.18143885117024183, "name": "INDEX_FINGER_MCP", "type": "right_hand", "index": 5, "frame_index": 2461}, {"x": 0.49404066801071167, "y": 0.5973206162452698, "z": -0.18229764350689948, "name": "INDEX_FINGER_PIP", "type": "right_hand", "index": 6, "frame_index": 2461}, {"x": 0.49076083302497864, "y": 0.6032664179801941, "z": -0.18408956846542424, "name": "INDEX_FINGER_TIP", "type": "right_hand", "index": 8, "frame_index": 2461}, {"x": 0.49270468950271606, "y": 0.60062575340271, "z": -0.18354342845850624, "name": "MIDDLE_FINGER_DIP", "type": "right_hand", "index": 11, "frame_index": 2461}, {"x": 0.49342310428619385, "y": 0.5865736603736877, "z": -0.18220495572313666, "name": "MIDDLE_FINGER_MCP", "type": "right_hand", "index": 9, "frame_index": 2461}, {"x": 0.4940747916698456, "y": 0.5964208245277405, "z": -0.18250765872653574, "name": "MIDDLE_FINGER_PIP", "type": "right_hand", "index": 10, "frame_index": 2461}, {"x": 0.49116694927215576, "y": 0.6021794676780701, "z": -0.1842580062802881, "name": "MIDDLE_FINGER_TIP", "type": "right_hand", "index": 12, "frame_index": 2461}, {"x": 0.4917851686477661, "y": 0.5947250723838806, "z": -0.18325679807458073, "name": "PINKY_DIP", "type": "right_hand", "index": 19, "frame_index": 2461}, {"x": 0.49241194128990173, "y": 0.5826649069786072, "z": -0.18423074613383505, "name": "PINKY_MCP", "type": "right_hand", "index": 17, "frame_index": 2461}, {"x": 0.4923822581768036, "y": 0.5905464887619019, "z": -0.18373657832853496, "name": "PINKY_PIP", "type": "right_hand", "index": 18, "frame_index": 2461}, {"x": 0.4911641478538513, "y": 0.5971170663833618, "z": -0.18294126202818006, "name": "PINKY_TIP", "type": "right_hand", "index": 20, "frame_index": 2461}, {"x": 0.4921445846557617, "y": 0.5986350774765015, "z": -0.18331385625060648, "name": "RING_FINGER_DIP", "type": "right_hand", "index": 15, "frame_index": 2461}, {"x": 0.49311625957489014, "y": 0.5849393010139465, "z": -0.1831845071283169, "name": "RING_FINGER_MCP", "type": "right_hand", "index": 13, "frame_index": 2461}, {"x": 0.4932631850242615, "y": 0.5944018959999084, "z": -0.18312366085592657, "name": "RING_FINGER_PIP", "type": "right_hand", "index": 14, "frame_index": 2461}, {"x": 0.4909435212612152, "y": 0.6005454063415527, "z": -0.18350353796267882, "name": "RING_FINGER_TIP", "type": "right_hand", "index": 16, "frame_index": 2461}, {"x": 0.49042701721191406, "y": 0.5730740427970886, "z": -0.18340261484263465, "name": "THUMB_CMC", "type": "right_hand", "index": 1, "frame_index": 2461}, {"x": 0.48988690972328186, "y": 0.5916647911071777, "z": -0.18317391845630482, "name": "THUMB_IP", "type": "right_hand", "index": 3, "frame_index": 2461}, {"x": 0.4903993010520935, "y": 0.5837236046791077, "z": -0.18308315612375736, "name": "THUMB_MCP", "type": "right_hand", "index": 2, "frame_index": 2461}, {"x": 0.49001461267471313, "y": 0.5980790853500366, "z": -0.183177882747259, "name": "THUMB_TIP", "type": "right_hand", "index": 4, "frame_index": 2461}, {"x": 0.4913526177406311, "y": 0.562383234500885, "z": -0.1840095026285038, "name": "WRIST", "type": "right_hand", "index": 0, "frame_index": 2461}], [{"x": 0.4776976406574249, "y": 0.77982097864151, "z": 0.10440918803215027, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2462}, {"x": 0.47971251606941223, "y": 0.38806870579719543, "z": 0.059140875935554504, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2462}, {"x": 0.48211902379989624, "y": 0.500580906867981, "z": 0.13944388926029205, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2462}, {"x": 0.48515164852142334, "y": 0.3884507715702057, "z": 0.01564035564661026, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2462}, {"x": 0.485575407743454, "y": 0.38874736428260803, "z": 0.01573888398706913, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2462}, {"x": 0.48506954312324524, "y": 0.3881990313529968, "z": 0.015712657943367958, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2462}, {"x": 0.49487966299057007, "y": 0.8084074258804321, "z": 0.059430018067359924, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2462}, {"x": 0.4685557782649994, "y": 0.8007173538208008, "z": 0.1032380685210228, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2462}, {"x": 0.4843331575393677, "y": 0.5628105998039246, "z": 0.06733565032482147, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2462}, {"x": 0.48833560943603516, "y": 0.5765822529792786, "z": 0.06566265225410461, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2462}, {"x": 0.4846552908420563, "y": 0.6758158206939697, "z": 0.07286190241575241, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2462}, {"x": 0.4853937029838562, "y": 0.5768769383430481, "z": 0.08384941518306732, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2462}, {"x": 0.4765990376472473, "y": 0.43100976943969727, "z": 0.12286984175443649, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2462}, {"x": 0.4883318841457367, "y": 0.5701330900192261, "z": 0.07729674875736237, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2462}, {"x": 0.48692888021469116, "y": 0.5579515695571899, "z": 0.08631855994462967, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2462}, {"x": 0.48524805903434753, "y": 0.4060138761997223, "z": 0.024891259148716927, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2462}, {"x": 0.4847157299518585, "y": 0.40480196475982666, "z": -0.0035270473454147577, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2462}, {"x": 0.48711109161376953, "y": 0.39760449528694153, "z": 0.005966542288661003, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2462}, {"x": 0.45837652683258057, "y": 0.7933772802352905, "z": -0.07772795110940933, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2462}, {"x": 0.47738116979599, "y": 0.38561707735061646, "z": -0.043559178709983826, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2462}, {"x": 0.4781322479248047, "y": 0.4948510527610779, "z": -0.15033277869224548, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2462}, {"x": 0.48436886072158813, "y": 0.3875407576560974, "z": -0.005282203201204538, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2462}, {"x": 0.4852033853530884, "y": 0.3882105350494385, "z": -0.005095102824270725, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2462}, {"x": 0.4834578335285187, "y": 0.3868679404258728, "z": -0.0053674206137657166, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2462}, {"x": 0.4664575159549713, "y": 0.8288966417312622, "z": -0.14824731647968292, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2462}, {"x": 0.4540044963359833, "y": 0.8071197271347046, "z": -0.08000729978084564, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2462}, {"x": 0.47253111004829407, "y": 0.5594910979270935, "z": -0.06742352992296219, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2462}, {"x": 0.4938035011291504, "y": 0.5773798227310181, "z": -0.20015443861484528, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2462}, {"x": 0.4764604866504669, "y": 0.6781249046325684, "z": -0.0799323171377182, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2462}, {"x": 0.4911537170410156, "y": 0.5760521292686462, "z": -0.2041497528553009, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2462}, {"x": 0.4729052484035492, "y": 0.42138993740081787, "z": -0.09442250430583954, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2462}, {"x": 0.4932764768600464, "y": 0.5718315243721008, "z": -0.1771225482225418, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2462}, {"x": 0.49018236994743347, "y": 0.5565467476844788, "z": -0.177958682179451, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2462}, {"x": 0.49323296546936035, "y": 0.6010165214538574, "z": 0.08729030785616487, "name": "INDEX_FINGER_DIP", "type": "left_hand", "index": 7, "frame_index": 2462}, {"x": 0.4949197769165039, "y": 0.5865452885627747, "z": 0.08949449216015637, "name": "INDEX_FINGER_MCP", "type": "left_hand", "index": 5, "frame_index": 2462}, {"x": 0.4958709478378296, "y": 0.5963923335075378, "z": 0.08855375275015831, "name": "INDEX_FINGER_PIP", "type": "left_hand", "index": 6, "frame_index": 2462}, {"x": 0.4906804859638214, "y": 0.602405309677124, "z": 0.08662729794741608, "name": "INDEX_FINGER_TIP", "type": "left_hand", "index": 8, "frame_index": 2462}, {"x": 0.49273374676704407, "y": 0.6006907224655151, "z": 0.08629793008003617, "name": "MIDDLE_FINGER_DIP", "type": "left_hand", "index": 11, "frame_index": 2462}, {"x": 0.4947049021720886, "y": 0.5857025384902954, "z": 0.08814243343658745, "name": "MIDDLE_FINGER_MCP", "type": "left_hand", "index": 9, "frame_index": 2462}, {"x": 0.4954165816307068, "y": 0.5962021350860596, "z": 0.08753298257943243, "name": "MIDDLE_FINGER_PIP", "type": "left_hand", "index": 10, "frame_index": 2462}, {"x": 0.49023741483688354, "y": 0.6017639636993408, "z": 0.08551117696333677, "name": "MIDDLE_FINGER_TIP", "type": "left_hand", "index": 12, "frame_index": 2462}, {"x": 0.49142986536026, "y": 0.5960173010826111, "z": 0.08578676119213924, "name": "PINKY_DIP", "type": "left_hand", "index": 19, "frame_index": 2462}, {"x": 0.49234527349472046, "y": 0.583207905292511, "z": 0.08510625641793013, "name": "PINKY_MCP", "type": "left_hand", "index": 17, "frame_index": 2462}, {"x": 0.49262478947639465, "y": 0.5914741158485413, "z": 0.08541566762141883, "name": "PINKY_PIP", "type": "left_hand", "index": 18, "frame_index": 2462}, {"x": 0.49021807312965393, "y": 0.5981731414794922, "z": 0.08604156956425868, "name": "PINKY_TIP", "type": "left_hand", "index": 20, "frame_index": 2462}, {"x": 0.4918763339519501, "y": 0.5988707542419434, "z": 0.08601357493898831, "name": "RING_FINGER_DIP", "type": "left_hand", "index": 15, "frame_index": 2462}, {"x": 0.493849515914917, "y": 0.584655225276947, "z": 0.08662747970083728, "name": "RING_FINGER_MCP", "type": "left_hand", "index": 13, "frame_index": 2462}, {"x": 0.49416762590408325, "y": 0.5948324799537659, "z": 0.08643853705143556, "name": "RING_FINGER_PIP", "type": "left_hand", "index": 14, "frame_index": 2462}, {"x": 0.4897839426994324, "y": 0.6002320051193237, "z": 0.08570995018817484, "name": "RING_FINGER_TIP", "type": "left_hand", "index": 16, "frame_index": 2462}, {"x": 0.4890410304069519, "y": 0.5745691657066345, "z": 0.08766034222207963, "name": "THUMB_CMC", "type": "left_hand", "index": 1, "frame_index": 2462}, {"x": 0.4891314208507538, "y": 0.5911099910736084, "z": 0.08803627139423043, "name": "THUMB_IP", "type": "left_hand", "index": 3, "frame_index": 2462}, {"x": 0.48957639932632446, "y": 0.584328293800354, "z": 0.08816784468945116, "name": "THUMB_MCP", "type": "left_hand", "index": 2, "frame_index": 2462}, {"x": 0.4888974726200104, "y": 0.5968963503837585, "z": 0.08800147357396781, "name": "THUMB_TIP", "type": "left_hand", "index": 4, "frame_index": 2462}, {"x": 0.49022579193115234, "y": 0.5633789300918579, "z": 0.08631858416860183, "name": "WRIST", "type": "left_hand", "index": 0, "frame_index": 2462}, {"x": 0.4924909770488739, "y": 0.6008598208427429, "z": -0.1759209840092808, "name": "INDEX_FINGER_DIP", "type": "right_hand", "index": 7, "frame_index": 2462}, {"x": 0.49497219920158386, "y": 0.5867516994476318, "z": -0.17423490015789866, "name": "INDEX_FINGER_MCP", "type": "right_hand", "index": 5, "frame_index": 2462}, {"x": 0.49528977274894714, "y": 0.5968245267868042, "z": -0.17480357852764428, "name": "INDEX_FINGER_PIP", "type": "right_hand", "index": 6, "frame_index": 2462}, {"x": 0.4899875223636627, "y": 0.6013597249984741, "z": -0.17646432959008962, "name": "INDEX_FINGER_TIP", "type": "right_hand", "index": 8, "frame_index": 2462}, {"x": 0.49202993512153625, "y": 0.6005027294158936, "z": -0.17672744032461196, "name": "MIDDLE_FINGER_DIP", "type": "right_hand", "index": 11, "frame_index": 2462}, {"x": 0.49460458755493164, "y": 0.5864688158035278, "z": -0.17524192878045142, "name": "MIDDLE_FINGER_MCP", "type": "right_hand", "index": 9, "frame_index": 2462}, {"x": 0.4948064386844635, "y": 0.5967647433280945, "z": -0.17545574088580906, "name": "MIDDLE_FINGER_PIP", "type": "right_hand", "index": 10, "frame_index": 2462}, {"x": 0.48956364393234253, "y": 0.6008032560348511, "z": -0.17756746811210178, "name": "MIDDLE_FINGER_TIP", "type": "right_hand", "index": 12, "frame_index": 2462}, {"x": 0.4905516803264618, "y": 0.5973393321037292, "z": -0.17660177731886506, "name": "PINKY_DIP", "type": "right_hand", "index": 19, "frame_index": 2462}, {"x": 0.4920596182346344, "y": 0.5853632092475891, "z": -0.17763719451613724, "name": "PINKY_MCP", "type": "right_hand", "index": 17, "frame_index": 2462}, {"x": 0.4920002222061157, "y": 0.593576192855835, "z": -0.17698668135562912, "name": "PINKY_PIP", "type": "right_hand", "index": 18, "frame_index": 2462}, {"x": 0.489126592874527, "y": 0.5984115600585938, "z": -0.1763510446762666, "name": "PINKY_TIP", "type": "right_hand", "index": 20, "frame_index": 2462}, {"x": 0.4911822974681854, "y": 0.5991482138633728, "z": -0.17675241793040186, "name": "RING_FINGER_DIP", "type": "right_hand", "index": 15, "frame_index": 2462}, {"x": 0.49364998936653137, "y": 0.5861008763313293, "z": -0.17642783466726542, "name": "RING_FINGER_MCP", "type": "right_hand", "index": 13, "frame_index": 2462}, {"x": 0.49360769987106323, "y": 0.5959633588790894, "z": -0.17622314346954226, "name": "RING_FINGER_PIP", "type": "right_hand", "index": 14, "frame_index": 2462}, {"x": 0.48910894989967346, "y": 0.5994521379470825, "z": -0.17716307227965444, "name": "RING_FINGER_TIP", "type": "right_hand", "index": 16, "frame_index": 2462}, {"x": 0.4894755184650421, "y": 0.5742763876914978, "z": -0.17680682055652142, "name": "THUMB_CMC", "type": "right_hand", "index": 1, "frame_index": 2462}, {"x": 0.4889432489871979, "y": 0.5910066366195679, "z": -0.17601139144971967, "name": "THUMB_IP", "type": "right_hand", "index": 3, "frame_index": 2462}, {"x": 0.4897191524505615, "y": 0.5840467214584351, "z": -0.17612326238304377, "name": "THUMB_MCP", "type": "right_hand", "index": 2, "frame_index": 2462}, {"x": 0.4887782037258148, "y": 0.5966464281082153, "z": -0.1757206639740616, "name": "THUMB_TIP", "type": "right_hand", "index": 4, "frame_index": 2462}, {"x": 0.49021947383880615, "y": 0.5643165707588196, "z": -0.17795865975245917, "name": "WRIST", "type": "right_hand", "index": 0, "frame_index": 2462}], [{"x": 0.4765323996543884, "y": 0.7800456881523132, "z": 0.09610351920127869, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2463}, {"x": 0.47968295216560364, "y": 0.3883990943431854, "z": 0.05332070216536522, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2463}, {"x": 0.47935014963150024, "y": 0.5010635852813721, "z": 0.13224579393863678, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2463}, {"x": 0.48543035984039307, "y": 0.3898939788341522, "z": 0.004378466866910458, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2463}, {"x": 0.486063688993454, "y": 0.3903425931930542, "z": 0.004480128176510334, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2463}, {"x": 0.48507970571517944, "y": 0.38951849937438965, "z": 0.004447744693607092, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2463}, {"x": 0.49487629532814026, "y": 0.808436930179596, "z": 0.054067082703113556, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2463}, {"x": 0.46750137209892273, "y": 0.8006292581558228, "z": 0.09495793282985687, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2463}, {"x": 0.483208030462265, "y": 0.5630814433097839, "z": 0.06753558665513992, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2463}, {"x": 0.48579141497612, "y": 0.5763612389564514, "z": 0.05443178489804268, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2463}, {"x": 0.4840070903301239, "y": 0.6759716272354126, "z": 0.06955209374427795, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2463}, {"x": 0.48243075609207153, "y": 0.5773283243179321, "z": 0.07252392172813416, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2463}, {"x": 0.4746417701244354, "y": 0.4310145378112793, "z": 0.11666680872440338, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2463}, {"x": 0.48653510212898254, "y": 0.5701950788497925, "z": 0.06646903604269028, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2463}, {"x": 0.4839183986186981, "y": 0.5569533705711365, "z": 0.0755847692489624, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2463}, {"x": 0.48585236072540283, "y": 0.40758684277534485, "z": 0.014491559937596321, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2463}, {"x": 0.48550572991371155, "y": 0.40670889616012573, "z": -0.012718350626528263, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2463}, {"x": 0.4879046380519867, "y": 0.3995395302772522, "z": -0.005377305205911398, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2463}, {"x": 0.4589541554450989, "y": 0.793163537979126, "z": -0.0748772919178009, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2463}, {"x": 0.47810956835746765, "y": 0.3871937692165375, "z": -0.05000711977481842, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2463}, {"x": 0.47772830724716187, "y": 0.4948272705078125, "z": -0.16144655644893646, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2463}, {"x": 0.48518818616867065, "y": 0.38949015736579895, "z": -0.015826966613531113, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2463}, {"x": 0.4859600365161896, "y": 0.39010849595069885, "z": -0.015639355406165123, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2463}, {"x": 0.4843415319919586, "y": 0.3888934552669525, "z": -0.015913713723421097, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2463}, {"x": 0.46690264344215393, "y": 0.8295318484306335, "z": -0.14102785289287567, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2463}, {"x": 0.45428943634033203, "y": 0.8068546652793884, "z": -0.07671446353197098, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2463}, {"x": 0.4725925326347351, "y": 0.5599960684776306, "z": -0.06762652844190598, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2463}, {"x": 0.4931465983390808, "y": 0.5793395042419434, "z": -0.20358428359031677, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2463}, {"x": 0.47783687710762024, "y": 0.6781654357910156, "z": -0.07982652634382248, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2463}, {"x": 0.4904712736606598, "y": 0.5778708457946777, "z": -0.20794248580932617, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2463}, {"x": 0.47328948974609375, "y": 0.4217800498008728, "z": -0.10658619552850723, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2463}, {"x": 0.4926849901676178, "y": 0.5739695429801941, "z": -0.1811692863702774, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2463}, {"x": 0.48958832025527954, "y": 0.5584954023361206, "z": -0.18239004909992218, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2463}, {"x": 0.4910838007926941, "y": 0.6012678146362305, "z": 0.07587078446522355, "name": "INDEX_FINGER_DIP", "type": "left_hand", "index": 7, "frame_index": 2463}, {"x": 0.49273550510406494, "y": 0.5870880484580994, "z": 0.07790359831415117, "name": "INDEX_FINGER_MCP", "type": "left_hand", "index": 5, "frame_index": 2463}, {"x": 0.49325746297836304, "y": 0.5965805053710938, "z": 0.07713115925434977, "name": "INDEX_FINGER_PIP", "type": "left_hand", "index": 6, "frame_index": 2463}, {"x": 0.4889247417449951, "y": 0.603050947189331, "z": 0.07509556168224663, "name": "INDEX_FINGER_TIP", "type": "left_hand", "index": 8, "frame_index": 2463}, {"x": 0.49036335945129395, "y": 0.6012501120567322, "z": 0.07596681267023087, "name": "MIDDLE_FINGER_DIP", "type": "left_hand", "index": 11, "frame_index": 2463}, {"x": 0.4919787049293518, "y": 0.5870649814605713, "z": 0.07742239744402468, "name": "MIDDLE_FINGER_MCP", "type": "left_hand", "index": 9, "frame_index": 2463}, {"x": 0.4924125075340271, "y": 0.5967661738395691, "z": 0.07718300702981651, "name": "MIDDLE_FINGER_PIP", "type": "left_hand", "index": 10, "frame_index": 2463}, {"x": 0.4882778823375702, "y": 0.6032323241233826, "z": 0.07506781339179724, "name": "MIDDLE_FINGER_TIP", "type": "left_hand", "index": 12, "frame_index": 2463}, {"x": 0.487918496131897, "y": 0.5973991751670837, "z": 0.07669872720725834, "name": "PINKY_DIP", "type": "left_hand", "index": 19, "frame_index": 2463}, {"x": 0.48850181698799133, "y": 0.585421621799469, "z": 0.07584560045506805, "name": "PINKY_MCP", "type": "left_hand", "index": 17, "frame_index": 2463}, {"x": 0.4887464642524719, "y": 0.5934248566627502, "z": 0.0763033272814937, "name": "PINKY_PIP", "type": "left_hand", "index": 18, "frame_index": 2463}, {"x": 0.4871067404747009, "y": 0.5992521047592163, "z": 0.07693114853464067, "name": "PINKY_TIP", "type": "left_hand", "index": 20, "frame_index": 2463}, {"x": 0.48930540680885315, "y": 0.6002288460731506, "z": 0.07632282451959327, "name": "RING_FINGER_DIP", "type": "left_hand", "index": 15, "frame_index": 2463}, {"x": 0.4906049370765686, "y": 0.5865682363510132, "z": 0.07669349480420351, "name": "RING_FINGER_MCP", "type": "left_hand", "index": 13, "frame_index": 2463}, {"x": 0.49099603295326233, "y": 0.596051812171936, "z": 0.0767338783480227, "name": "RING_FINGER_PIP", "type": "left_hand", "index": 14, "frame_index": 2463}, {"x": 0.48772668838500977, "y": 0.6020393967628479, "z": 0.0759347234852612, "name": "RING_FINGER_TIP", "type": "left_hand", "index": 16, "frame_index": 2463}, {"x": 0.4873315393924713, "y": 0.5716190338134766, "z": 0.07551990624051541, "name": "THUMB_CMC", "type": "left_hand", "index": 1, "frame_index": 2463}, {"x": 0.4880495071411133, "y": 0.5886602401733398, "z": 0.07527193074929528, "name": "THUMB_IP", "type": "left_hand", "index": 3, "frame_index": 2463}, {"x": 0.48803043365478516, "y": 0.5814631581306458, "z": 0.07555420709468308, "name": "THUMB_MCP", "type": "left_hand", "index": 2, "frame_index": 2463}, {"x": 0.4878586530685425, "y": 0.5949018001556396, "z": 0.07512890777434222, "name": "THUMB_TIP", "type": "left_hand", "index": 4, "frame_index": 2463}, {"x": 0.4885696768760681, "y": 0.5626593232154846, "z": 0.07558478946696034, "name": "WRIST", "type": "left_hand", "index": 0, "frame_index": 2463}, {"x": 0.4906981885433197, "y": 0.6009090542793274, "z": -0.1828139772405848, "name": "INDEX_FINGER_DIP", "type": "right_hand", "index": 7, "frame_index": 2463}, {"x": 0.49201256036758423, "y": 0.5869237184524536, "z": -0.1805087123066187, "name": "INDEX_FINGER_MCP", "type": "right_hand", "index": 5, "frame_index": 2463}, {"x": 0.4926650822162628, "y": 0.5960826873779297, "z": -0.18147315655369312, "name": "INDEX_FINGER_PIP", "type": "right_hand", "index": 6, "frame_index": 2463}, {"x": 0.48872509598731995, "y": 0.6030703783035278, "z": -0.18363885127473623, "name": "INDEX_FINGER_TIP", "type": "right_hand", "index": 8, "frame_index": 2463}, {"x": 0.4902343153953552, "y": 0.6008109450340271, "z": -0.18255793482239824, "name": "MIDDLE_FINGER_DIP", "type": "right_hand", "index": 11, "frame_index": 2463}, {"x": 0.4916154742240906, "y": 0.5867514610290527, "z": -0.18090904678683728, "name": "MIDDLE_FINGER_MCP", "type": "right_hand", "index": 9, "frame_index": 2463}, {"x": 0.49212419986724854, "y": 0.5962182283401489, "z": -0.18134287314023823, "name": "MIDDLE_FINGER_PIP", "type": "right_hand", "index": 10, "frame_index": 2463}, {"x": 0.48828792572021484, "y": 0.6031123399734497, "z": -0.18343893915880471, "name": "MIDDLE_FINGER_TIP", "type": "right_hand", "index": 12, "frame_index": 2463}, {"x": 0.48861485719680786, "y": 0.5964178442955017, "z": -0.181950866128318, "name": "PINKY_DIP", "type": "right_hand", "index": 19, "frame_index": 2463}, {"x": 0.4890483319759369, "y": 0.5846856236457825, "z": -0.1823865664857749, "name": "PINKY_MCP", "type": "right_hand", "index": 17, "frame_index": 2463}, {"x": 0.48937928676605225, "y": 0.5924364328384399, "z": -0.18222119826532435, "name": "PINKY_PIP", "type": "right_hand", "index": 18, "frame_index": 2463}, {"x": 0.48782700300216675, "y": 0.5984153747558594, "z": -0.18177059484878555, "name": "PINKY_TIP", "type": "right_hand", "index": 20, "frame_index": 2463}, {"x": 0.48951226472854614, "y": 0.5996150374412537, "z": -0.18229219203203684, "name": "RING_FINGER_DIP", "type": "right_hand", "index": 15, "frame_index": 2463}, {"x": 0.4906529486179352, "y": 0.5860379338264465, "z": -0.18158390995813534, "name": "RING_FINGER_MCP", "type": "right_hand", "index": 13, "frame_index": 2463}, {"x": 0.4910964369773865, "y": 0.5953190326690674, "z": -0.18182391772279516, "name": "RING_FINGER_PIP", "type": "right_hand", "index": 14, "frame_index": 2463}, {"x": 0.48800164461135864, "y": 0.6017348170280457, "z": -0.1826638162310701, "name": "RING_FINGER_TIP", "type": "right_hand", "index": 16, "frame_index": 2463}, {"x": 0.48672980070114136, "y": 0.5714162588119507, "z": -0.18270058117923327, "name": "THUMB_CMC", "type": "right_hand", "index": 1, "frame_index": 2463}, {"x": 0.48769691586494446, "y": 0.5886141061782837, "z": -0.18293517193524167, "name": "THUMB_IP", "type": "right_hand", "index": 3, "frame_index": 2463}, {"x": 0.48741447925567627, "y": 0.5813596248626709, "z": -0.1826943792984821, "name": "THUMB_MCP", "type": "right_hand", "index": 2, "frame_index": 2463}, {"x": 0.48784685134887695, "y": 0.5947957038879395, "z": -0.18305755639448762, "name": "THUMB_TIP", "type": "right_hand", "index": 4, "frame_index": 2463}, {"x": 0.4884699583053589, "y": 0.562791109085083, "z": -0.1823900308015176, "name": "WRIST", "type": "right_hand", "index": 0, "frame_index": 2463}], [{"x": 0.475443959236145, "y": 0.7797552347183228, "z": 0.09758757799863815, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2464}, {"x": 0.47969186305999756, "y": 0.3893623948097229, "z": 0.04602140560746193, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2464}, {"x": 0.4792254567146301, "y": 0.5039064884185791, "z": 0.12516647577285767, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2464}, {"x": 0.4859714210033417, "y": 0.39044642448425293, "z": -0.0007306424085982144, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2464}, {"x": 0.48678258061408997, "y": 0.390766978263855, "z": -0.0006268339930102229, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2464}, {"x": 0.48533275723457336, "y": 0.3902147710323334, "z": -0.0006627122638747096, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2464}, {"x": 0.49462565779685974, "y": 0.8081896305084229, "z": 0.05360424518585205, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2464}, {"x": 0.46676209568977356, "y": 0.8004401922225952, "z": 0.09716197848320007, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2464}, {"x": 0.48256877064704895, "y": 0.5631321668624878, "z": 0.06743943691253662, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2464}, {"x": 0.48576635122299194, "y": 0.5760728716850281, "z": 0.040773507207632065, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2464}, {"x": 0.48402926325798035, "y": 0.6760510206222534, "z": 0.0703028067946434, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2464}, {"x": 0.48248952627182007, "y": 0.5773206949234009, "z": 0.059082332998514175, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2464}, {"x": 0.4749877154827118, "y": 0.4318781793117523, "z": 0.10926850885152817, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2464}, {"x": 0.48643743991851807, "y": 0.5697817206382751, "z": 0.05428415164351463, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2464}, {"x": 0.48380976915359497, "y": 0.5575354099273682, "z": 0.06374232470989227, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2464}, {"x": 0.4865543246269226, "y": 0.40786004066467285, "z": 0.009828362613916397, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2464}, {"x": 0.4863211512565613, "y": 0.4069859981536865, "z": -0.014510363340377808, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2464}, {"x": 0.4889061748981476, "y": 0.3995080888271332, "z": -0.011141432449221611, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2464}, {"x": 0.4609759449958801, "y": 0.7921294569969177, "z": -0.07994762063026428, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2464}, {"x": 0.47886744141578674, "y": 0.3887367248535156, "z": -0.055899880826473236, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2464}, {"x": 0.4762692153453827, "y": 0.49463483691215515, "z": -0.16391901671886444, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2464}, {"x": 0.486022025346756, "y": 0.3899567425251007, "z": -0.019211646169424057, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2464}, {"x": 0.4867989122867584, "y": 0.39047735929489136, "z": -0.019009985029697418, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2464}, {"x": 0.4851839244365692, "y": 0.3894902765750885, "z": -0.019311726093292236, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2464}, {"x": 0.4760756492614746, "y": 0.8253196477890015, "z": -0.14678430557250977, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2464}, {"x": 0.45557159185409546, "y": 0.8067961931228638, "z": -0.08219672739505768, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2464}, {"x": 0.47252118587493896, "y": 0.5601421594619751, "z": -0.06750761717557907, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2464}, {"x": 0.49235624074935913, "y": 0.5792735815048218, "z": -0.21259786188602448, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2464}, {"x": 0.4786241948604584, "y": 0.6781951189041138, "z": -0.08187512308359146, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2464}, {"x": 0.48997196555137634, "y": 0.5782527923583984, "z": -0.2160346359014511, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2464}, {"x": 0.47375059127807617, "y": 0.4237627685070038, "z": -0.1097080409526825, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2464}, {"x": 0.4921146631240845, "y": 0.5735923051834106, "z": -0.18905258178710938, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2464}, {"x": 0.48922035098075867, "y": 0.5585364699363708, "z": -0.1897430568933487, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2464}, {"x": 0.48908427357673645, "y": 0.5992535948753357, "z": 0.06310330220730975, "name": "INDEX_FINGER_DIP", "type": "left_hand", "index": 7, "frame_index": 2464}, {"x": 0.49028557538986206, "y": 0.5831239819526672, "z": 0.06552469916641712, "name": "INDEX_FINGER_MCP", "type": "left_hand", "index": 5, "frame_index": 2464}, {"x": 0.49035754799842834, "y": 0.5929545760154724, "z": 0.06441223301226273, "name": "INDEX_FINGER_PIP", "type": "left_hand", "index": 6, "frame_index": 2464}, {"x": 0.4877268373966217, "y": 0.6034507751464844, "z": 0.06229211110621691, "name": "INDEX_FINGER_TIP", "type": "left_hand", "index": 8, "frame_index": 2464}, {"x": 0.4886990785598755, "y": 0.5993607044219971, "z": 0.0628326044534333, "name": "MIDDLE_FINGER_DIP", "type": "left_hand", "index": 11, "frame_index": 2464}, {"x": 0.4901858866214752, "y": 0.5822029709815979, "z": 0.0642985797021538, "name": "MIDDLE_FINGER_MCP", "type": "left_hand", "index": 9, "frame_index": 2464}, {"x": 0.4899583160877228, "y": 0.5928915739059448, "z": 0.06378951963051804, "name": "MIDDLE_FINGER_PIP", "type": "left_hand", "index": 10, "frame_index": 2464}, {"x": 0.48722270131111145, "y": 0.6037881970405579, "z": 0.062065201927907765, "name": "MIDDLE_FINGER_TIP", "type": "left_hand", "index": 12, "frame_index": 2464}, {"x": 0.4871808588504791, "y": 0.592678964138031, "z": 0.06214843282941729, "name": "PINKY_DIP", "type": "left_hand", "index": 19, "frame_index": 2464}, {"x": 0.4880197048187256, "y": 0.5793362259864807, "z": 0.061599491629749537, "name": "PINKY_MCP", "type": "left_hand", "index": 17, "frame_index": 2464}, {"x": 0.4878130257129669, "y": 0.5873891115188599, "z": 0.06179173546843231, "name": "PINKY_PIP", "type": "left_hand", "index": 18, "frame_index": 2464}, {"x": 0.4864882826805115, "y": 0.596477746963501, "z": 0.062301902449689806, "name": "PINKY_TIP", "type": "left_hand", "index": 20, "frame_index": 2464}, {"x": 0.4877813756465912, "y": 0.5978427529335022, "z": 0.0625811000354588, "name": "RING_FINGER_DIP", "type": "left_hand", "index": 15, "frame_index": 2464}, {"x": 0.4893941581249237, "y": 0.580999493598938, "z": 0.0629605624708347, "name": "RING_FINGER_MCP", "type": "left_hand", "index": 13, "frame_index": 2464}, {"x": 0.4888685643672943, "y": 0.591619610786438, "z": 0.06281364004826173, "name": "RING_FINGER_PIP", "type": "left_hand", "index": 14, "frame_index": 2464}, {"x": 0.4865865409374237, "y": 0.6021842360496521, "z": 0.06226366863120347, "name": "RING_FINGER_TIP", "type": "left_hand", "index": 16, "frame_index": 2464}, {"x": 0.4860534965991974, "y": 0.5694680213928223, "z": 0.0647985904943198, "name": "THUMB_CMC", "type": "left_hand", "index": 1, "frame_index": 2464}, {"x": 0.48754724860191345, "y": 0.5855583548545837, "z": 0.0647855867864564, "name": "THUMB_IP", "type": "left_hand", "index": 3, "frame_index": 2464}, {"x": 0.48691999912261963, "y": 0.5794007778167725, "z": 0.0650376791600138, "name": "THUMB_MCP", "type": "left_hand", "index": 2, "frame_index": 2464}, {"x": 0.487632155418396, "y": 0.5910449028015137, "z": 0.06452554959105328, "name": "THUMB_TIP", "type": "left_hand", "index": 4, "frame_index": 2464}, {"x": 0.4874128997325897, "y": 0.5589814782142639, "z": 0.0637423457027051, "name": "WRIST", "type": "left_hand", "index": 0, "frame_index": 2464}, {"x": 0.48823726177215576, "y": 0.599618136882782, "z": -0.18946915774722584, "name": "INDEX_FINGER_DIP", "type": "right_hand", "index": 7, "frame_index": 2464}, {"x": 0.4893909692764282, "y": 0.5852469801902771, "z": -0.18749692104756832, "name": "INDEX_FINGER_MCP", "type": "right_hand", "index": 5, "frame_index": 2464}, {"x": 0.4894407391548157, "y": 0.5942431688308716, "z": -0.18831259943544865, "name": "INDEX_FINGER_PIP", "type": "right_hand", "index": 6, "frame_index": 2464}, {"x": 0.48697522282600403, "y": 0.6031693816184998, "z": -0.19019020593259484, "name": "INDEX_FINGER_TIP", "type": "right_hand", "index": 8, "frame_index": 2464}, {"x": 0.4879591763019562, "y": 0.5992262959480286, "z": -0.1896440058844746, "name": "MIDDLE_FINGER_DIP", "type": "right_hand", "index": 11, "frame_index": 2464}, {"x": 0.48928481340408325, "y": 0.5841734409332275, "z": -0.18854674173053354, "name": "MIDDLE_FINGER_MCP", "type": "right_hand", "index": 9, "frame_index": 2464}, {"x": 0.4890981614589691, "y": 0.5937524437904358, "z": -0.18879004259360954, "name": "MIDDLE_FINGER_PIP", "type": "right_hand", "index": 10, "frame_index": 2464}, {"x": 0.4866332709789276, "y": 0.6029654741287231, "z": -0.19031488930340856, "name": "MIDDLE_FINGER_TIP", "type": "right_hand", "index": 12, "frame_index": 2464}, {"x": 0.48692241311073303, "y": 0.5929406881332397, "z": -0.19003159989370033, "name": "PINKY_DIP", "type": "right_hand", "index": 19, "frame_index": 2464}, {"x": 0.48798978328704834, "y": 0.580412745475769, "z": -0.19103419233579189, "name": "PINKY_MCP", "type": "right_hand", "index": 17, "frame_index": 2464}, {"x": 0.48767808079719543, "y": 0.588219165802002, "z": -0.19062710728030652, "name": "PINKY_PIP", "type": "right_hand", "index": 18, "frame_index": 2464}, {"x": 0.48617881536483765, "y": 0.5961927771568298, "z": -0.1896640986960847, "name": "PINKY_TIP", "type": "right_hand", "index": 20, "frame_index": 2464}, {"x": 0.48738792538642883, "y": 0.5973594784736633, "z": -0.1896865064445592, "name": "RING_FINGER_DIP", "type": "right_hand", "index": 15, "frame_index": 2464}, {"x": 0.4888373613357544, "y": 0.5826197862625122, "z": -0.18975832449177688, "name": "RING_FINGER_MCP", "type": "right_hand", "index": 13, "frame_index": 2464}, {"x": 0.4883763790130615, "y": 0.5921244025230408, "z": -0.18970297058694996, "name": "RING_FINGER_PIP", "type": "right_hand", "index": 14, "frame_index": 2464}, {"x": 0.48634451627731323, "y": 0.6008239388465881, "z": -0.18978670519936713, "name": "RING_FINGER_TIP", "type": "right_hand", "index": 16, "frame_index": 2464}, {"x": 0.4861011803150177, "y": 0.5706061720848083, "z": -0.18888807418989018, "name": "THUMB_CMC", "type": "right_hand", "index": 1, "frame_index": 2464}, {"x": 0.4874989092350006, "y": 0.5871120095252991, "z": -0.18872135924175382, "name": "THUMB_IP", "type": "right_hand", "index": 3, "frame_index": 2464}, {"x": 0.48701411485671997, "y": 0.5807685256004333, "z": -0.18856986868195236, "name": "THUMB_MCP", "type": "right_hand", "index": 2, "frame_index": 2464}, {"x": 0.48772457242012024, "y": 0.592437744140625, "z": -0.188866920536384, "name": "THUMB_TIP", "type": "right_hand", "index": 4, "frame_index": 2464}, {"x": 0.48704227805137634, "y": 0.5604557991027832, "z": -0.18974303451170904, "name": "WRIST", "type": "right_hand", "index": 0, "frame_index": 2464}], [{"x": 0.4750188887119293, "y": 0.7805121541023254, "z": 0.08235763013362885, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2465}, {"x": 0.47978633642196655, "y": 0.3898291289806366, "z": 0.05843714252114296, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2465}, {"x": 0.4787517189979553, "y": 0.5039822459220886, "z": 0.1291637271642685, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2465}, {"x": 0.4865836799144745, "y": 0.3906049132347107, "z": 0.013211344368755817, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2465}, {"x": 0.48741307854652405, "y": 0.3908865451812744, "z": 0.013301553204655647, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2465}, {"x": 0.48582449555397034, "y": 0.39043018221855164, "z": 0.01327774953097105, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2465}, {"x": 0.4946242868900299, "y": 0.807942271232605, "z": 0.034821417182683945, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2465}, {"x": 0.4665040969848633, "y": 0.8009256720542908, "z": 0.08107606321573257, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2465}, {"x": 0.48134762048721313, "y": 0.5630428194999695, "z": 0.06811198592185974, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2465}, {"x": 0.48604854941368103, "y": 0.5743533968925476, "z": 0.05222219601273537, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2465}, {"x": 0.48373860120773315, "y": 0.6760574579238892, "z": 0.06403320282697678, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2465}, {"x": 0.4831743538379669, "y": 0.5747458338737488, "z": 0.07006817311048508, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2465}, {"x": 0.47519731521606445, "y": 0.4327293336391449, "z": 0.12142570316791534, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2465}, {"x": 0.48652130365371704, "y": 0.5687326788902283, "z": 0.06514980643987656, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2465}, {"x": 0.48387569189071655, "y": 0.5561922192573547, "z": 0.07441557943820953, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2465}, {"x": 0.4873439371585846, "y": 0.40827614068984985, "z": 0.022544628009200096, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2465}, {"x": 0.48696833848953247, "y": 0.40757155418395996, "z": -0.00623960280790925, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2465}, {"x": 0.48970121145248413, "y": 0.3996175229549408, "z": 0.002905681263655424, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2465}, {"x": 0.4626617133617401, "y": 0.7918436527252197, "z": -0.10605510324239731, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2465}, {"x": 0.47871625423431396, "y": 0.3892630934715271, "z": -0.047969650477170944, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2465}, {"x": 0.47549405694007874, "y": 0.49458450078964233, "z": -0.1520950347185135, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2465}, {"x": 0.4863094687461853, "y": 0.3901365399360657, "z": -0.00809730775654316, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2465}, {"x": 0.48720577359199524, "y": 0.39059868454933167, "z": -0.007916022092103958, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2465}, {"x": 0.48534640669822693, "y": 0.3897416293621063, "z": -0.008172017522156239, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2465}, {"x": 0.4837980270385742, "y": 0.822575569152832, "z": -0.1770259439945221, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2465}, {"x": 0.4566200077533722, "y": 0.8071774840354919, "z": -0.10970673710107803, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2465}, {"x": 0.4723801612854004, "y": 0.5602337121963501, "z": -0.0681777149438858, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2465}, {"x": 0.4910048842430115, "y": 0.5791621208190918, "z": -0.2011876106262207, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2465}, {"x": 0.47941312193870544, "y": 0.6776335835456848, "z": -0.09420522302389145, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2465}, {"x": 0.4888485372066498, "y": 0.5788121819496155, "z": -0.20450140535831451, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2465}, {"x": 0.47322896122932434, "y": 0.4241693913936615, "z": -0.09755334258079529, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2465}, {"x": 0.490705668926239, "y": 0.5735142230987549, "z": -0.17874589562416077, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2465}, {"x": 0.4881487190723419, "y": 0.5598085522651672, "z": -0.17969395220279694, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2465}, {"x": 0.49072569608688354, "y": 0.593283474445343, "z": 0.07445432908571092, "name": "INDEX_FINGER_DIP", "type": "left_hand", "index": 7, "frame_index": 2465}, {"x": 0.49015161395072937, "y": 0.5760700702667236, "z": 0.0764762565959245, "name": "INDEX_FINGER_MCP", "type": "left_hand", "index": 5, "frame_index": 2465}, {"x": 0.4907216429710388, "y": 0.5861466526985168, "z": 0.07539023429853842, "name": "INDEX_FINGER_PIP", "type": "left_hand", "index": 6, "frame_index": 2465}, {"x": 0.49062231183052063, "y": 0.5986167192459106, "z": 0.07385901326779276, "name": "INDEX_FINGER_TIP", "type": "left_hand", "index": 8, "frame_index": 2465}, {"x": 0.48905208706855774, "y": 0.5957491993904114, "z": 0.07296075718477368, "name": "MIDDLE_FINGER_DIP", "type": "left_hand", "index": 11, "frame_index": 2465}, {"x": 0.48979827761650085, "y": 0.576431155204773, "z": 0.07432123844773741, "name": "MIDDLE_FINGER_MCP", "type": "left_hand", "index": 9, "frame_index": 2465}, {"x": 0.48974311351776123, "y": 0.5882700681686401, "z": 0.07354680792195722, "name": "MIDDLE_FINGER_PIP", "type": "left_hand", "index": 10, "frame_index": 2465}, {"x": 0.4883476495742798, "y": 0.6010516285896301, "z": 0.07250176486559212, "name": "MIDDLE_FINGER_TIP", "type": "left_hand", "index": 12, "frame_index": 2465}, {"x": 0.4860016405582428, "y": 0.590985894203186, "z": 0.07036930322647095, "name": "PINKY_DIP", "type": "left_hand", "index": 19, "frame_index": 2465}, {"x": 0.48699313402175903, "y": 0.5759122371673584, "z": 0.07015628181397915, "name": "PINKY_MCP", "type": "left_hand", "index": 17, "frame_index": 2465}, {"x": 0.4865989685058594, "y": 0.5850778222084045, "z": 0.07008280418813229, "name": "PINKY_PIP", "type": "left_hand", "index": 18, "frame_index": 2465}, {"x": 0.48546507954597473, "y": 0.5955045223236084, "z": 0.0704588396474719, "name": "PINKY_TIP", "type": "left_hand", "index": 20, "frame_index": 2465}, {"x": 0.4876369535923004, "y": 0.595468282699585, "z": 0.07160472427494824, "name": "RING_FINGER_DIP", "type": "left_hand", "index": 15, "frame_index": 2465}, {"x": 0.48877981305122375, "y": 0.5763089656829834, "z": 0.0721766259521246, "name": "RING_FINGER_MCP", "type": "left_hand", "index": 13, "frame_index": 2465}, {"x": 0.4883536994457245, "y": 0.5883708000183105, "z": 0.0717238774523139, "name": "RING_FINGER_PIP", "type": "left_hand", "index": 14, "frame_index": 2465}, {"x": 0.48698368668556213, "y": 0.6005284190177917, "z": 0.0714018982835114, "name": "RING_FINGER_TIP", "type": "left_hand", "index": 16, "frame_index": 2465}, {"x": 0.4859154522418976, "y": 0.5661540031433105, "z": 0.07688893703743815, "name": "THUMB_CMC", "type": "left_hand", "index": 1, "frame_index": 2465}, {"x": 0.4879850149154663, "y": 0.5822007060050964, "z": 0.07695590890944004, "name": "THUMB_IP", "type": "left_hand", "index": 3, "frame_index": 2465}, {"x": 0.4872789978981018, "y": 0.5753603577613831, "z": 0.07731610396876931, "name": "THUMB_MCP", "type": "left_hand", "index": 2, "frame_index": 2465}, {"x": 0.4884366989135742, "y": 0.5881471037864685, "z": 0.07645806414075196, "name": "THUMB_TIP", "type": "left_hand", "index": 4, "frame_index": 2465}, {"x": 0.48509132862091064, "y": 0.555418074131012, "z": 0.07441559524681374, "name": "WRIST", "type": "left_hand", "index": 0, "frame_index": 2465}, {"x": 0.48958277702331543, "y": 0.595018208026886, "z": -0.18135984719265252, "name": "INDEX_FINGER_DIP", "type": "right_hand", "index": 7, "frame_index": 2465}, {"x": 0.49031296372413635, "y": 0.5772051811218262, "z": -0.17883869668003172, "name": "INDEX_FINGER_MCP", "type": "right_hand", "index": 5, "frame_index": 2465}, {"x": 0.4901832044124603, "y": 0.5877767205238342, "z": -0.18024623929522932, "name": "INDEX_FINGER_PIP", "type": "right_hand", "index": 6, "frame_index": 2465}, {"x": 0.48900970816612244, "y": 0.6003827452659607, "z": -0.18201433192007244, "name": "INDEX_FINGER_TIP", "type": "right_hand", "index": 8, "frame_index": 2465}, {"x": 0.48863089084625244, "y": 0.5964720845222473, "z": -0.18218311970122159, "name": "MIDDLE_FINGER_DIP", "type": "right_hand", "index": 11, "frame_index": 2465}, {"x": 0.489935964345932, "y": 0.5774102210998535, "z": -0.1804625663207844, "name": "MIDDLE_FINGER_MCP", "type": "right_hand", "index": 9, "frame_index": 2465}, {"x": 0.48955878615379333, "y": 0.5891648530960083, "z": -0.181533437455073, "name": "MIDDLE_FINGER_PIP", "type": "right_hand", "index": 10, "frame_index": 2465}, {"x": 0.48776882886886597, "y": 0.601701557636261, "z": -0.1826094405259937, "name": "MIDDLE_FINGER_TIP", "type": "right_hand", "index": 12, "frame_index": 2465}, {"x": 0.4859192371368408, "y": 0.5917326807975769, "z": -0.1836422593332827, "name": "PINKY_DIP", "type": "right_hand", "index": 19, "frame_index": 2465}, {"x": 0.4868658185005188, "y": 0.5765783190727234, "z": -0.1837559575214982, "name": "PINKY_MCP", "type": "right_hand", "index": 17, "frame_index": 2465}, {"x": 0.4865238666534424, "y": 0.5857462882995605, "z": -0.1839553862810135, "name": "PINKY_PIP", "type": "right_hand", "index": 18, "frame_index": 2465}, {"x": 0.4852885901927948, "y": 0.5961044430732727, "z": -0.18343058740720153, "name": "PINKY_TIP", "type": "right_hand", "index": 20, "frame_index": 2465}, {"x": 0.48758018016815186, "y": 0.5960591435432434, "z": -0.18286902084946632, "name": "RING_FINGER_DIP", "type": "right_hand", "index": 15, "frame_index": 2465}, {"x": 0.4887954294681549, "y": 0.5771560668945312, "z": -0.18212356232106686, "name": "RING_FINGER_MCP", "type": "right_hand", "index": 13, "frame_index": 2465}, {"x": 0.48830512166023254, "y": 0.589023232460022, "z": -0.18279589479789138, "name": "RING_FINGER_PIP", "type": "right_hand", "index": 14, "frame_index": 2465}, {"x": 0.4868805706501007, "y": 0.6008983254432678, "z": -0.1829218501225114, "name": "RING_FINGER_TIP", "type": "right_hand", "index": 16, "frame_index": 2465}, {"x": 0.48596274852752686, "y": 0.5661388635635376, "z": -0.17827412812039256, "name": "THUMB_CMC", "type": "right_hand", "index": 1, "frame_index": 2465}, {"x": 0.4879865348339081, "y": 0.5813105702400208, "z": -0.17874018184375018, "name": "THUMB_IP", "type": "right_hand", "index": 3, "frame_index": 2465}, {"x": 0.48722144961357117, "y": 0.5749150514602661, "z": -0.17822030279785395, "name": "THUMB_MCP", "type": "right_hand", "index": 2, "frame_index": 2465}, {"x": 0.4883634150028229, "y": 0.586820125579834, "z": -0.1793418739689514, "name": "THUMB_TIP", "type": "right_hand", "index": 4, "frame_index": 2465}, {"x": 0.48539823293685913, "y": 0.5565735101699829, "z": -0.1796939312358603, "name": "WRIST", "type": "right_hand", "index": 0, "frame_index": 2465}], [{"x": 0.475067675113678, "y": 0.7813761234283447, "z": 0.05417255312204361, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2466}, {"x": 0.4811209440231323, "y": 0.3897091746330261, "z": 0.04703063890337944, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2466}, {"x": 0.4792904853820801, "y": 0.5043531060218811, "z": 0.1295672357082367, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2466}, {"x": 0.48689332604408264, "y": 0.38995248079299927, "z": -0.017391007393598557, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2466}, {"x": 0.487430602312088, "y": 0.39024782180786133, "z": -0.017304886132478714, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2466}, {"x": 0.4864433705806732, "y": 0.3897251784801483, "z": -0.01730431243777275, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2466}, {"x": 0.4948316514492035, "y": 0.8078793287277222, "z": -0.0003706392308231443, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2466}, {"x": 0.46739837527275085, "y": 0.8014249801635742, "z": 0.05165127292275429, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2466}, {"x": 0.4813719093799591, "y": 0.5645448565483093, "z": 0.06724034994840622, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2466}, {"x": 0.48699501156806946, "y": 0.5703134536743164, "z": 0.051755521446466446, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2466}, {"x": 0.4836246073246002, "y": 0.6761369705200195, "z": 0.044645823538303375, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2466}, {"x": 0.48464733362197876, "y": 0.5698837637901306, "z": 0.06980779021978378, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2466}, {"x": 0.4769552946090698, "y": 0.43603333830833435, "z": 0.12001091986894608, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2466}, {"x": 0.48748210072517395, "y": 0.5634728670120239, "z": 0.06559690833091736, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2466}, {"x": 0.48486343026161194, "y": 0.5516504049301147, "z": 0.07485275715589523, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2466}, {"x": 0.48799142241477966, "y": 0.40792059898376465, "z": -0.0054456088691949844, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2466}, {"x": 0.4868926703929901, "y": 0.40721407532691956, "z": -0.032267164438962936, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2466}, {"x": 0.48976680636405945, "y": 0.398943692445755, "z": -0.03154604882001877, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2466}, {"x": 0.4656737446784973, "y": 0.7911086082458496, "z": -0.13838830590248108, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2466}, {"x": 0.4786049723625183, "y": 0.3892313241958618, "z": -0.04675250127911568, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2466}, {"x": 0.4728763699531555, "y": 0.49527978897094727, "z": -0.14803051948547363, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2466}, {"x": 0.48569101095199585, "y": 0.38994091749191284, "z": -0.03713534027338028, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2466}, {"x": 0.4866512417793274, "y": 0.39026984572410583, "z": -0.03693363815546036, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2466}, {"x": 0.48496493697166443, "y": 0.38965463638305664, "z": -0.03721698746085167, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2466}, {"x": 0.48315244913101196, "y": 0.8198242783546448, "z": -0.21857468783855438, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2466}, {"x": 0.4593236744403839, "y": 0.8080191016197205, "z": -0.1440795212984085, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2466}, {"x": 0.47193443775177, "y": 0.561377227306366, "z": -0.06730794161558151, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2466}, {"x": 0.48869046568870544, "y": 0.5779270529747009, "z": -0.20346026122570038, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2466}, {"x": 0.4794374406337738, "y": 0.6774581074714661, "z": -0.10864470154047012, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2466}, {"x": 0.4857935905456543, "y": 0.5781073570251465, "z": -0.20610247552394867, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2466}, {"x": 0.47270211577415466, "y": 0.42600467801094055, "z": -0.09380282461643219, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2466}, {"x": 0.48845189809799194, "y": 0.5722900629043579, "z": -0.1796969771385193, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2466}, {"x": 0.4850636422634125, "y": 0.5591608881950378, "z": -0.18030652403831482, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2466}, {"x": 0.49103158712387085, "y": 0.5898343324661255, "z": 0.07450949097983539, "name": "INDEX_FINGER_DIP", "type": "left_hand", "index": 7, "frame_index": 2466}, {"x": 0.4879641830921173, "y": 0.5750697255134583, "z": 0.0764126805588603, "name": "INDEX_FINGER_MCP", "type": "left_hand", "index": 5, "frame_index": 2466}, {"x": 0.48975256085395813, "y": 0.5838587284088135, "z": 0.07548985036555678, "name": "INDEX_FINGER_PIP", "type": "left_hand", "index": 6, "frame_index": 2466}, {"x": 0.49214550852775574, "y": 0.5942241549491882, "z": 0.07381974020972848, "name": "INDEX_FINGER_TIP", "type": "left_hand", "index": 8, "frame_index": 2466}, {"x": 0.4886767566204071, "y": 0.592851459980011, "z": 0.07332996663171798, "name": "MIDDLE_FINGER_DIP", "type": "left_hand", "index": 11, "frame_index": 2466}, {"x": 0.4879400432109833, "y": 0.5752213001251221, "z": 0.07501451893767808, "name": "MIDDLE_FINGER_MCP", "type": "left_hand", "index": 9, "frame_index": 2466}, {"x": 0.4888032376766205, "y": 0.5859940052032471, "z": 0.07418280659476295, "name": "MIDDLE_FINGER_PIP", "type": "left_hand", "index": 10, "frame_index": 2466}, {"x": 0.48835837841033936, "y": 0.597947359085083, "z": 0.07269906112924218, "name": "MIDDLE_FINGER_TIP", "type": "left_hand", "index": 12, "frame_index": 2466}, {"x": 0.4843595325946808, "y": 0.5911463499069214, "z": 0.07142986101098359, "name": "PINKY_DIP", "type": "left_hand", "index": 19, "frame_index": 2466}, {"x": 0.4849544167518616, "y": 0.5758760571479797, "z": 0.07198883802630007, "name": "PINKY_MCP", "type": "left_hand", "index": 17, "frame_index": 2466}, {"x": 0.48479709029197693, "y": 0.5849767327308655, "z": 0.07154636387713253, "name": "PINKY_PIP", "type": "left_hand", "index": 18, "frame_index": 2466}, {"x": 0.48379039764404297, "y": 0.5959885716438293, "z": 0.07129525044001639, "name": "PINKY_TIP", "type": "left_hand", "index": 20, "frame_index": 2466}, {"x": 0.4867972433567047, "y": 0.5941038131713867, "z": 0.07204314670525491, "name": "RING_FINGER_DIP", "type": "left_hand", "index": 15, "frame_index": 2466}, {"x": 0.4869191348552704, "y": 0.5754084587097168, "z": 0.07350043463520706, "name": "RING_FINGER_MCP", "type": "left_hand", "index": 13, "frame_index": 2466}, {"x": 0.48728519678115845, "y": 0.5867026448249817, "z": 0.07275440939702094, "name": "RING_FINGER_PIP", "type": "left_hand", "index": 14, "frame_index": 2466}, {"x": 0.4861312508583069, "y": 0.5997200608253479, "z": 0.07152132503688335, "name": "RING_FINGER_TIP", "type": "left_hand", "index": 16, "frame_index": 2466}, {"x": 0.48147979378700256, "y": 0.5642510056495667, "z": 0.07582314015598968, "name": "THUMB_CMC", "type": "left_hand", "index": 1, "frame_index": 2466}, {"x": 0.4835027754306793, "y": 0.5773545503616333, "z": 0.07558922725729644, "name": "THUMB_IP", "type": "left_hand", "index": 3, "frame_index": 2466}, {"x": 0.48277223110198975, "y": 0.5720462203025818, "z": 0.07598340499680489, "name": "THUMB_MCP", "type": "left_hand", "index": 2, "frame_index": 2466}, {"x": 0.48383599519729614, "y": 0.5819944143295288, "z": 0.07515678784693591, "name": "THUMB_TIP", "type": "left_hand", "index": 4, "frame_index": 2466}, {"x": 0.4821464419364929, "y": 0.5553743243217468, "z": 0.07485277149201064, "name": "WRIST", "type": "left_hand", "index": 0, "frame_index": 2466}, {"x": 0.49084532260894775, "y": 0.5907357931137085, "z": -0.18126000766642392, "name": "INDEX_FINGER_DIP", "type": "right_hand", "index": 7, "frame_index": 2466}, {"x": 0.48821938037872314, "y": 0.5753655433654785, "z": -0.17902514291927218, "name": "INDEX_FINGER_MCP", "type": "right_hand", "index": 5, "frame_index": 2466}, {"x": 0.4897887408733368, "y": 0.5844084620475769, "z": -0.1801543402398238, "name": "INDEX_FINGER_PIP", "type": "right_hand", "index": 6, "frame_index": 2466}, {"x": 0.4918166697025299, "y": 0.5953398942947388, "z": -0.1819965378381312, "name": "INDEX_FINGER_TIP", "type": "right_hand", "index": 8, "frame_index": 2466}, {"x": 0.48845618963241577, "y": 0.5935613512992859, "z": -0.18226492893882096, "name": "MIDDLE_FINGER_DIP", "type": "right_hand", "index": 11, "frame_index": 2466}, {"x": 0.4880964159965515, "y": 0.5753622055053711, "z": -0.18028992640211072, "name": "MIDDLE_FINGER_MCP", "type": "right_hand", "index": 9, "frame_index": 2466}, {"x": 0.4887272119522095, "y": 0.5863685011863708, "z": -0.18131999904289842, "name": "MIDDLE_FINGER_PIP", "type": "right_hand", "index": 10, "frame_index": 2466}, {"x": 0.4880673885345459, "y": 0.5988697409629822, "z": -0.18291136249899864, "name": "MIDDLE_FINGER_TIP", "type": "right_hand", "index": 12, "frame_index": 2466}, {"x": 0.4844512641429901, "y": 0.5909303426742554, "z": -0.18383593880571425, "name": "PINKY_DIP", "type": "right_hand", "index": 19, "frame_index": 2466}, {"x": 0.48491328954696655, "y": 0.5754608511924744, "z": -0.18309561582282186, "name": "PINKY_MCP", "type": "right_hand", "index": 17, "frame_index": 2466}, {"x": 0.4848552644252777, "y": 0.5846229195594788, "z": -0.18367560277692974, "name": "PINKY_PIP", "type": "right_hand", "index": 18, "frame_index": 2466}, {"x": 0.4839009642601013, "y": 0.595753014087677, "z": -0.18395158182829618, "name": "PINKY_TIP", "type": "right_hand", "index": 20, "frame_index": 2466}, {"x": 0.48659777641296387, "y": 0.5942067503929138, "z": -0.18333184532821178, "name": "RING_FINGER_DIP", "type": "right_hand", "index": 15, "frame_index": 2466}, {"x": 0.4869351387023926, "y": 0.5753628611564636, "z": -0.1816860381513834, "name": "RING_FINGER_MCP", "type": "right_hand", "index": 13, "frame_index": 2466}, {"x": 0.4871805012226105, "y": 0.5866230726242065, "z": -0.18260885728523135, "name": "RING_FINGER_PIP", "type": "right_hand", "index": 14, "frame_index": 2466}, {"x": 0.48587751388549805, "y": 0.5998905897140503, "z": -0.18379145278595388, "name": "RING_FINGER_TIP", "type": "right_hand", "index": 16, "frame_index": 2466}, {"x": 0.48168736696243286, "y": 0.5653385519981384, "z": -0.17956553731346503, "name": "THUMB_CMC", "type": "right_hand", "index": 1, "frame_index": 2466}, {"x": 0.4837301969528198, "y": 0.5797667503356934, "z": -0.17975650617154315, "name": "THUMB_IP", "type": "right_hand", "index": 3, "frame_index": 2466}, {"x": 0.48304441571235657, "y": 0.5737209916114807, "z": -0.17942131799645722, "name": "THUMB_MCP", "type": "right_hand", "index": 2, "frame_index": 2466}, {"x": 0.4841667413711548, "y": 0.5849883556365967, "z": -0.18011045971070416, "name": "THUMB_TIP", "type": "right_hand", "index": 4, "frame_index": 2466}, {"x": 0.4821874797344208, "y": 0.5557123422622681, "z": -0.18030650740121956, "name": "WRIST", "type": "right_hand", "index": 0, "frame_index": 2466}], [{"x": 0.4752963185310364, "y": 0.7816017866134644, "z": 0.06133606284856796, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2467}, {"x": 0.48123112320899963, "y": 0.389618456363678, "z": 0.023412557318806648, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2467}, {"x": 0.4786120057106018, "y": 0.503242552280426, "z": 0.13105244934558868, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2467}, {"x": 0.48694759607315063, "y": 0.38921111822128296, "z": -0.04284881800413132, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2467}, {"x": 0.4874340295791626, "y": 0.38968226313591003, "z": -0.042758163064718246, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2467}, {"x": 0.4865395128726959, "y": 0.3887915313243866, "z": -0.042762868106365204, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2467}, {"x": 0.4949581027030945, "y": 0.8076406121253967, "z": 0.006665046326816082, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2467}, {"x": 0.4692825675010681, "y": 0.8017104268074036, "z": 0.059321947395801544, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2467}, {"x": 0.4815922677516937, "y": 0.5652690529823303, "z": 0.06659550219774246, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2467}, {"x": 0.4881061911582947, "y": 0.5695032477378845, "z": 0.056345898658037186, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2467}, {"x": 0.4832608103752136, "y": 0.6761564016342163, "z": 0.046047136187553406, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2467}, {"x": 0.48544782400131226, "y": 0.5691775679588318, "z": 0.07473301142454147, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2467}, {"x": 0.47884026169776917, "y": 0.43789973855018616, "z": 0.10293430835008621, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2467}, {"x": 0.4884820878505707, "y": 0.562440037727356, "z": 0.06959106028079987, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2467}, {"x": 0.4867161214351654, "y": 0.5461440682411194, "z": 0.0786547139286995, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2467}, {"x": 0.4886331260204315, "y": 0.40672567486763, "z": -0.029963256791234016, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2467}, {"x": 0.48725998401641846, "y": 0.40697434544563293, "z": -0.05586598068475723, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2467}, {"x": 0.490140438079834, "y": 0.3981996178627014, "z": -0.056741293519735336, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2467}, {"x": 0.4690774977207184, "y": 0.7897065281867981, "z": -0.1323104053735733, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2467}, {"x": 0.4782964885234833, "y": 0.38994529843330383, "z": -0.06357616931200027, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2467}, {"x": 0.4671543836593628, "y": 0.4952162504196167, "z": -0.15955719351768494, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2467}, {"x": 0.48526081442832947, "y": 0.38981080055236816, "z": -0.0618928000330925, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2467}, {"x": 0.4863778054714203, "y": 0.3900170922279358, "z": -0.06169290468096733, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2467}, {"x": 0.48451492190361023, "y": 0.3895156979560852, "z": -0.06198140233755112, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2467}, {"x": 0.4847894310951233, "y": 0.8183054327964783, "z": -0.21393348276615143, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2467}, {"x": 0.4632154703140259, "y": 0.8080012202262878, "z": -0.13772179186344147, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2467}, {"x": 0.47170618176460266, "y": 0.5627601742744446, "z": -0.06667307019233704, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2467}, {"x": 0.48657771944999695, "y": 0.5779862999916077, "z": -0.22875498235225677, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2467}, {"x": 0.4793994128704071, "y": 0.6773360371589661, "z": -0.10612063854932785, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2467}, {"x": 0.4827871322631836, "y": 0.5783107280731201, "z": -0.23172901570796967, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2467}, {"x": 0.4724859297275543, "y": 0.4277742803096771, "z": -0.10397912561893463, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2467}, {"x": 0.4864862859249115, "y": 0.5720077753067017, "z": -0.20341219007968903, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2467}, {"x": 0.482313334941864, "y": 0.5590100884437561, "z": -0.2038692981004715, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2467}, {"x": 0.48774561285972595, "y": 0.5888206958770752, "z": 0.07708078599534929, "name": "INDEX_FINGER_DIP", "type": "left_hand", "index": 7, "frame_index": 2467}, {"x": 0.48716476559638977, "y": 0.5717159509658813, "z": 0.07952481374377385, "name": "INDEX_FINGER_MCP", "type": "left_hand", "index": 5, "frame_index": 2467}, {"x": 0.48789259791374207, "y": 0.5817568898200989, "z": 0.07822029461385682, "name": "INDEX_FINGER_PIP", "type": "left_hand", "index": 6, "frame_index": 2467}, {"x": 0.4873333275318146, "y": 0.5942673087120056, "z": 0.07638060487806797, "name": "INDEX_FINGER_TIP", "type": "left_hand", "index": 8, "frame_index": 2467}, {"x": 0.48958098888397217, "y": 0.5883522033691406, "z": 0.07608038163743913, "name": "MIDDLE_FINGER_DIP", "type": "left_hand", "index": 11, "frame_index": 2467}, {"x": 0.4865971505641937, "y": 0.5723250508308411, "z": 0.07813310605706647, "name": "MIDDLE_FINGER_MCP", "type": "left_hand", "index": 9, "frame_index": 2467}, {"x": 0.488554447889328, "y": 0.5819990038871765, "z": 0.07701494614593685, "name": "MIDDLE_FINGER_PIP", "type": "left_hand", "index": 10, "frame_index": 2467}, {"x": 0.49038583040237427, "y": 0.5932834148406982, "z": 0.0754339846316725, "name": "MIDDLE_FINGER_TIP", "type": "left_hand", "index": 12, "frame_index": 2467}, {"x": 0.48346877098083496, "y": 0.5875884294509888, "z": 0.07491962891072035, "name": "PINKY_DIP", "type": "left_hand", "index": 19, "frame_index": 2467}, {"x": 0.482668936252594, "y": 0.5736472606658936, "z": 0.07522244052961469, "name": "PINKY_MCP", "type": "left_hand", "index": 17, "frame_index": 2467}, {"x": 0.48330381512641907, "y": 0.5821486711502075, "z": 0.07483723713085055, "name": "PINKY_PIP", "type": "left_hand", "index": 18, "frame_index": 2467}, {"x": 0.4834442138671875, "y": 0.5920704007148743, "z": 0.07497377903200686, "name": "PINKY_TIP", "type": "left_hand", "index": 20, "frame_index": 2467}, {"x": 0.4877179265022278, "y": 0.5893319845199585, "z": 0.07543996558524668, "name": "RING_FINGER_DIP", "type": "left_hand", "index": 15, "frame_index": 2467}, {"x": 0.48502907156944275, "y": 0.5728939175605774, "z": 0.07667117728851736, "name": "RING_FINGER_MCP", "type": "left_hand", "index": 13, "frame_index": 2467}, {"x": 0.4867689907550812, "y": 0.5828321576118469, "z": 0.07582948729395866, "name": "RING_FINGER_PIP", "type": "left_hand", "index": 14, "frame_index": 2467}, {"x": 0.48826372623443604, "y": 0.5944867730140686, "z": 0.07517130277119577, "name": "RING_FINGER_TIP", "type": "left_hand", "index": 16, "frame_index": 2467}, {"x": 0.4829990565776825, "y": 0.5610775351524353, "z": 0.07968080521095544, "name": "THUMB_CMC", "type": "left_hand", "index": 1, "frame_index": 2467}, {"x": 0.48603305220603943, "y": 0.5753777623176575, "z": 0.07901853532530367, "name": "THUMB_IP", "type": "left_hand", "index": 3, "frame_index": 2467}, {"x": 0.485152930021286, "y": 0.569129228591919, "z": 0.07959561550524086, "name": "THUMB_MCP", "type": "left_hand", "index": 2, "frame_index": 2467}, {"x": 0.4864371120929718, "y": 0.5801433324813843, "z": 0.07839822955429554, "name": "THUMB_TIP", "type": "left_hand", "index": 4, "frame_index": 2467}, {"x": 0.48026859760284424, "y": 0.5538239479064941, "z": 0.07865473685731672, "name": "WRIST", "type": "left_hand", "index": 0, "frame_index": 2467}], [{"x": 0.47651442885398865, "y": 0.7803930640220642, "z": 0.06391354650259018, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2468}, {"x": 0.48315057158470154, "y": 0.3891243636608124, "z": 0.0063259475864470005, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2468}, {"x": 0.4780726730823517, "y": 0.5032854080200195, "z": 0.1404622495174408, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2468}, {"x": 0.48696380853652954, "y": 0.38687053322792053, "z": -0.0760110542178154, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2468}, {"x": 0.48732081055641174, "y": 0.38729721307754517, "z": -0.0759211853146553, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2468}, {"x": 0.4870119094848633, "y": 0.3864078223705292, "z": -0.07591722160577774, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2468}, {"x": 0.495202898979187, "y": 0.8076490759849548, "z": 0.01384762953966856, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2468}, {"x": 0.4719609320163727, "y": 0.7988492846488953, "z": 0.06312913447618484, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2468}, {"x": 0.48351094126701355, "y": 0.5673791170120239, "z": 0.0660342127084732, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2468}, {"x": 0.4885796010494232, "y": 0.5695599317550659, "z": 0.08020209521055222, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2468}, {"x": 0.4835653007030487, "y": 0.6761412024497986, "z": 0.03858713060617447, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2468}, {"x": 0.4863837659358978, "y": 0.5672256946563721, "z": 0.10059142112731934, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2468}, {"x": 0.48317280411720276, "y": 0.43935656547546387, "z": 0.09857248514890671, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2468}, {"x": 0.4889044165611267, "y": 0.562431275844574, "z": 0.0923866406083107, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2468}, {"x": 0.4868827164173126, "y": 0.547403872013092, "z": 0.1014319509267807, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2468}, {"x": 0.48896169662475586, "y": 0.4039209187030792, "z": -0.0599275566637516, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2468}, {"x": 0.48688793182373047, "y": 0.4049557149410248, "z": -0.08277614414691925, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2468}, {"x": 0.4897559881210327, "y": 0.3959212303161621, "z": -0.09261058270931244, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2468}, {"x": 0.47133275866508484, "y": 0.7886815667152405, "z": -0.1712627112865448, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2468}, {"x": 0.47737106680870056, "y": 0.39054247736930847, "z": -0.06999681890010834, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2468}, {"x": 0.4622550904750824, "y": 0.495206356048584, "z": -0.15426866710186005, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2468}, {"x": 0.48340168595314026, "y": 0.3882830739021301, "z": -0.09274282306432724, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2468}, {"x": 0.48498639464378357, "y": 0.3878682851791382, "z": -0.09251908957958221, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2468}, {"x": 0.481837660074234, "y": 0.38882386684417725, "z": -0.09284999221563339, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2468}, {"x": 0.48184940218925476, "y": 0.81928551197052, "z": -0.25401076674461365, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2468}, {"x": 0.46620479226112366, "y": 0.8079423904418945, "z": -0.17767447233200073, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2468}, {"x": 0.47113195061683655, "y": 0.5639806985855103, "z": -0.06610677391290665, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2468}, {"x": 0.48453572392463684, "y": 0.5774407386779785, "z": -0.22583289444446564, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2468}, {"x": 0.47911038994789124, "y": 0.6766366362571716, "z": -0.1311154067516327, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2468}, {"x": 0.48030683398246765, "y": 0.5776882767677307, "z": -0.22835469245910645, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2468}, {"x": 0.4722018539905548, "y": 0.4282546043395996, "z": -0.09974350780248642, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2468}, {"x": 0.4847624599933624, "y": 0.5714712142944336, "z": -0.20102491974830627, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2468}, {"x": 0.4802965521812439, "y": 0.5582921504974365, "z": -0.20149007439613342, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2468}, {"x": 0.4879031777381897, "y": 0.5861169099807739, "z": 0.09862005687318742, "name": "INDEX_FINGER_DIP", "type": "left_hand", "index": 7, "frame_index": 2468}, {"x": 0.48417043685913086, "y": 0.5721224546432495, "z": 0.10052831773646176, "name": "INDEX_FINGER_MCP", "type": "left_hand", "index": 5, "frame_index": 2468}, {"x": 0.486490398645401, "y": 0.5808277726173401, "z": 0.09937633736990392, "name": "INDEX_FINGER_PIP", "type": "left_hand", "index": 6, "frame_index": 2468}, {"x": 0.48911499977111816, "y": 0.5903128385543823, "z": 0.09816471231169999, "name": "INDEX_FINGER_TIP", "type": "left_hand", "index": 8, "frame_index": 2468}, {"x": 0.4816775619983673, "y": 0.5883591771125793, "z": 0.09790250263176858, "name": "MIDDLE_FINGER_DIP", "type": "left_hand", "index": 11, "frame_index": 2468}, {"x": 0.4821765422821045, "y": 0.5720065236091614, "z": 0.09984426270239055, "name": "MIDDLE_FINGER_MCP", "type": "left_hand", "index": 9, "frame_index": 2468}, {"x": 0.48210644721984863, "y": 0.5821501612663269, "z": 0.09866139036603272, "name": "MIDDLE_FINGER_PIP", "type": "left_hand", "index": 10, "frame_index": 2468}, {"x": 0.4813644289970398, "y": 0.5929214358329773, "z": 0.0974844815209508, "name": "MIDDLE_FINGER_TIP", "type": "left_hand", "index": 12, "frame_index": 2468}, {"x": 0.4780828058719635, "y": 0.5695387721061707, "z": 0.09828114160336554, "name": "PINKY_DIP", "type": "left_hand", "index": 19, "frame_index": 2468}, {"x": 0.4778980016708374, "y": 0.5680270195007324, "z": 0.09841108182445168, "name": "PINKY_MCP", "type": "left_hand", "index": 17, "frame_index": 2468}, {"x": 0.4777473509311676, "y": 0.5712826251983643, "z": 0.09785543591715395, "name": "PINKY_PIP", "type": "left_hand", "index": 18, "frame_index": 2468}, {"x": 0.47825267910957336, "y": 0.5674480199813843, "z": 0.0987833277322352, "name": "PINKY_TIP", "type": "left_hand", "index": 20, "frame_index": 2468}, {"x": 0.4795643389225006, "y": 0.5722611546516418, "z": 0.09753257711417973, "name": "RING_FINGER_DIP", "type": "left_hand", "index": 15, "frame_index": 2468}, {"x": 0.48001205921173096, "y": 0.570311427116394, "z": 0.09913019882515073, "name": "RING_FINGER_MCP", "type": "left_hand", "index": 13, "frame_index": 2468}, {"x": 0.47939586639404297, "y": 0.5747603178024292, "z": 0.0978004103526473, "name": "RING_FINGER_PIP", "type": "left_hand", "index": 14, "frame_index": 2468}, {"x": 0.4798171818256378, "y": 0.5696386694908142, "z": 0.09772542025893927, "name": "RING_FINGER_TIP", "type": "left_hand", "index": 16, "frame_index": 2468}, {"x": 0.48065030574798584, "y": 0.5595344305038452, "z": 0.10123158142960165, "name": "THUMB_CMC", "type": "left_hand", "index": 1, "frame_index": 2468}, {"x": 0.482466459274292, "y": 0.5729504227638245, "z": 0.10035017714835703, "name": "THUMB_IP", "type": "left_hand", "index": 3, "frame_index": 2468}, {"x": 0.48244330286979675, "y": 0.5670551657676697, "z": 0.10088136926060542, "name": "THUMB_MCP", "type": "left_hand", "index": 2, "frame_index": 2468}, {"x": 0.48216068744659424, "y": 0.5766313672065735, "z": 0.09988282457925379, "name": "THUMB_TIP", "type": "left_hand", "index": 4, "frame_index": 2468}, {"x": 0.47772663831710815, "y": 0.5531474351882935, "z": 0.10143198844583878, "name": "WRIST", "type": "left_hand", "index": 0, "frame_index": 2468}], [{"x": 0.4768200218677521, "y": 0.7803890109062195, "z": 0.03775830939412117, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2469}, {"x": 0.48415547609329224, "y": 0.3890403211116791, "z": 0.008296878077089787, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2469}, {"x": 0.47818461060523987, "y": 0.5048432946205139, "z": 0.15304945409297943, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2469}, {"x": 0.4869639277458191, "y": 0.3858102262020111, "z": -0.07595708966255188, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2469}, {"x": 0.48724105954170227, "y": 0.3863005042076111, "z": -0.07587926089763641, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2469}, {"x": 0.4874003827571869, "y": 0.3853299915790558, "z": -0.07586494088172913, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2469}, {"x": 0.49521586298942566, "y": 0.807647705078125, "z": -0.013809642754495144, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2469}, {"x": 0.4722272455692291, "y": 0.7991893887519836, "z": 0.036116499453783035, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2469}, {"x": 0.48539578914642334, "y": 0.5689942836761475, "z": 0.0644136592745781, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2469}, {"x": 0.4884338974952698, "y": 0.5683740973472595, "z": 0.10483722388744354, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2469}, {"x": 0.483574241399765, "y": 0.6762163043022156, "z": 0.02077546902000904, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2469}, {"x": 0.4865264296531677, "y": 0.5648109316825867, "z": 0.12490195780992508, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2469}, {"x": 0.4849138855934143, "y": 0.4430619478225708, "z": 0.09994892030954361, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2469}, {"x": 0.4887191355228424, "y": 0.5627683997154236, "z": 0.11542282998561859, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2469}, {"x": 0.4868123233318329, "y": 0.5473200678825378, "z": 0.12394008040428162, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2469}, {"x": 0.4890960156917572, "y": 0.40324893593788147, "z": -0.059777844697237015, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2469}, {"x": 0.48637402057647705, "y": 0.4049310088157654, "z": -0.08212807029485703, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2469}, {"x": 0.4895027279853821, "y": 0.39520102739334106, "z": -0.09310607612133026, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2469}, {"x": 0.47345322370529175, "y": 0.78809654712677, "z": -0.20868618786334991, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2469}, {"x": 0.47588053345680237, "y": 0.3925229609012604, "z": -0.06627334654331207, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2469}, {"x": 0.4581354856491089, "y": 0.4951629638671875, "z": -0.14298410713672638, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2469}, {"x": 0.48149868845939636, "y": 0.38818100094795227, "z": -0.09228654205799103, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2469}, {"x": 0.48350846767425537, "y": 0.38758355379104614, "z": -0.09205801784992218, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2469}, {"x": 0.4796189069747925, "y": 0.3887130618095398, "z": -0.09238888323307037, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2469}, {"x": 0.48521339893341064, "y": 0.8174128532409668, "z": -0.2928961217403412, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2469}, {"x": 0.46880868077278137, "y": 0.8080148100852966, "z": -0.21580758690834045, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2469}, {"x": 0.4707842469215393, "y": 0.5648196935653687, "z": -0.06448426842689514, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2469}, {"x": 0.48162779211997986, "y": 0.5770135521888733, "z": -0.2177744358778, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2469}, {"x": 0.4788406491279602, "y": 0.6762091517448425, "z": -0.1603851020336151, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2469}, {"x": 0.4762859344482422, "y": 0.5773435831069946, "z": -0.22093640267848969, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2469}, {"x": 0.4719664454460144, "y": 0.4298150837421417, "z": -0.0941714197397232, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2469}, {"x": 0.48195043206214905, "y": 0.5710975527763367, "z": -0.19356343150138855, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2469}, {"x": 0.47666844725608826, "y": 0.5579479932785034, "z": -0.19405943155288696, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2469}, {"x": 0.4858134686946869, "y": 0.5844870209693909, "z": 0.12154030846431851, "name": "INDEX_FINGER_DIP", "type": "left_hand", "index": 7, "frame_index": 2469}, {"x": 0.4824545383453369, "y": 0.5706625580787659, "z": 0.12387802301236661, "name": "INDEX_FINGER_MCP", "type": "left_hand", "index": 5, "frame_index": 2469}, {"x": 0.48455458879470825, "y": 0.5789615511894226, "z": 0.12261581572238356, "name": "INDEX_FINGER_PIP", "type": "left_hand", "index": 6, "frame_index": 2469}, {"x": 0.48679935932159424, "y": 0.5889151692390442, "z": 0.12077451520599425, "name": "INDEX_FINGER_TIP", "type": "left_hand", "index": 8, "frame_index": 2469}, {"x": 0.48226749897003174, "y": 0.5898013114929199, "z": 0.12083949404768646, "name": "MIDDLE_FINGER_DIP", "type": "left_hand", "index": 11, "frame_index": 2469}, {"x": 0.4807708263397217, "y": 0.5728028416633606, "z": 0.12301456689601764, "name": "MIDDLE_FINGER_MCP", "type": "left_hand", "index": 9, "frame_index": 2469}, {"x": 0.48190876841545105, "y": 0.5830478072166443, "z": 0.12184830103069544, "name": "MIDDLE_FINGER_PIP", "type": "left_hand", "index": 10, "frame_index": 2469}, {"x": 0.48242518305778503, "y": 0.595243513584137, "z": 0.12017591577023268, "name": "MIDDLE_FINGER_TIP", "type": "left_hand", "index": 12, "frame_index": 2469}, {"x": 0.47716447710990906, "y": 0.5851929783821106, "z": 0.12005103565752506, "name": "PINKY_DIP", "type": "left_hand", "index": 19, "frame_index": 2469}, {"x": 0.47609156370162964, "y": 0.5730736255645752, "z": 0.12088115001097322, "name": "PINKY_MCP", "type": "left_hand", "index": 17, "frame_index": 2469}, {"x": 0.4768657982349396, "y": 0.5804262161254883, "z": 0.12012793682515621, "name": "PINKY_PIP", "type": "left_hand", "index": 18, "frame_index": 2469}, {"x": 0.47723570466041565, "y": 0.589239776134491, "z": 0.12003617244772613, "name": "PINKY_TIP", "type": "left_hand", "index": 20, "frame_index": 2469}, {"x": 0.4797409176826477, "y": 0.5894976854324341, "z": 0.12026589526794851, "name": "RING_FINGER_DIP", "type": "left_hand", "index": 15, "frame_index": 2469}, {"x": 0.47862353920936584, "y": 0.5735233426094055, "z": 0.12198668951168656, "name": "RING_FINGER_MCP", "type": "left_hand", "index": 13, "frame_index": 2469}, {"x": 0.4796205163002014, "y": 0.5830045342445374, "z": 0.12090822239406407, "name": "RING_FINGER_PIP", "type": "left_hand", "index": 14, "frame_index": 2469}, {"x": 0.4797213077545166, "y": 0.5948061347007751, "z": 0.11985728610306978, "name": "RING_FINGER_TIP", "type": "left_hand", "index": 16, "frame_index": 2469}, {"x": 0.4782010614871979, "y": 0.5572298169136047, "z": 0.12359565318911336, "name": "THUMB_CMC", "type": "left_hand", "index": 1, "frame_index": 2469}, {"x": 0.4808933734893799, "y": 0.5691535472869873, "z": 0.1225315616466105, "name": "THUMB_IP", "type": "left_hand", "index": 3, "frame_index": 2469}, {"x": 0.4804598391056061, "y": 0.5633422136306763, "z": 0.12314390460960567, "name": "THUMB_MCP", "type": "left_hand", "index": 2, "frame_index": 2469}, {"x": 0.4806710183620453, "y": 0.5739917755126953, "z": 0.1219292578753084, "name": "THUMB_TIP", "type": "left_hand", "index": 4, "frame_index": 2469}, {"x": 0.47464361786842346, "y": 0.5533725023269653, "z": 0.12394010067643002, "name": "WRIST", "type": "left_hand", "index": 0, "frame_index": 2469}, {"x": 0.48199164867401123, "y": 0.5907476544380188, "z": -0.19575675309170038, "name": "INDEX_FINGER_DIP", "type": "right_hand", "index": 7, "frame_index": 2469}, {"x": 0.48077431321144104, "y": 0.5726600289344788, "z": -0.1933113725972362, "name": "INDEX_FINGER_MCP", "type": "right_hand", "index": 5, "frame_index": 2469}, {"x": 0.4817398190498352, "y": 0.5834387540817261, "z": -0.1945665716775693, "name": "INDEX_FINGER_PIP", "type": "right_hand", "index": 6, "frame_index": 2469}, {"x": 0.48218101263046265, "y": 0.5964780449867249, "z": -0.19659205223433673, "name": "INDEX_FINGER_TIP", "type": "right_hand", "index": 8, "frame_index": 2469}, {"x": 0.4815065860748291, "y": 0.5936199426651001, "z": -0.19661619001999497, "name": "MIDDLE_FINGER_DIP", "type": "right_hand", "index": 11, "frame_index": 2469}, {"x": 0.4804443418979645, "y": 0.5735942721366882, "z": -0.19431682996219024, "name": "MIDDLE_FINGER_MCP", "type": "right_hand", "index": 9, "frame_index": 2469}, {"x": 0.48132771253585815, "y": 0.5857300162315369, "z": -0.19545171898789704, "name": "MIDDLE_FINGER_PIP", "type": "right_hand", "index": 10, "frame_index": 2469}, {"x": 0.48160311579704285, "y": 0.5998276472091675, "z": -0.19743442232720554, "name": "MIDDLE_FINGER_TIP", "type": "right_hand", "index": 12, "frame_index": 2469}, {"x": 0.4796421229839325, "y": 0.5866637229919434, "z": -0.1977022117935121, "name": "PINKY_DIP", "type": "right_hand", "index": 19, "frame_index": 2469}, {"x": 0.4782196283340454, "y": 0.5725151300430298, "z": -0.1967752822674811, "name": "PINKY_MCP", "type": "right_hand", "index": 17, "frame_index": 2469}, {"x": 0.47905072569847107, "y": 0.5808807015419006, "z": -0.19749674014747143, "name": "PINKY_PIP", "type": "right_hand", "index": 18, "frame_index": 2469}, {"x": 0.4800660312175751, "y": 0.5915541052818298, "z": -0.19785432354547083, "name": "PINKY_TIP", "type": "right_hand", "index": 20, "frame_index": 2469}, {"x": 0.48049670457839966, "y": 0.5924761891365051, "z": -0.19726792280562222, "name": "RING_FINGER_DIP", "type": "right_hand", "index": 15, "frame_index": 2469}, {"x": 0.47953012585639954, "y": 0.573560357093811, "z": -0.19551342632621527, "name": "RING_FINGER_MCP", "type": "right_hand", "index": 13, "frame_index": 2469}, {"x": 0.4802943766117096, "y": 0.5849802494049072, "z": -0.19651806657202542, "name": "RING_FINGER_PIP", "type": "right_hand", "index": 14, "frame_index": 2469}, {"x": 0.4805857241153717, "y": 0.5982319116592407, "z": -0.19779246393591166, "name": "RING_FINGER_TIP", "type": "right_hand", "index": 16, "frame_index": 2469}, {"x": 0.47466468811035156, "y": 0.5592972040176392, "z": -0.19403081114796805, "name": "THUMB_CMC", "type": "right_hand", "index": 1, "frame_index": 2469}, {"x": 0.47818228602409363, "y": 0.5733256340026855, "z": -0.19458126137033105, "name": "THUMB_IP", "type": "right_hand", "index": 3, "frame_index": 2469}, {"x": 0.47677794098854065, "y": 0.5671788454055786, "z": -0.194145829496847, "name": "THUMB_MCP", "type": "right_hand", "index": 2, "frame_index": 2469}, {"x": 0.47881245613098145, "y": 0.5780104398727417, "z": -0.19507774792145938, "name": "THUMB_TIP", "type": "right_hand", "index": 4, "frame_index": 2469}, {"x": 0.47360050678253174, "y": 0.5514569282531738, "z": -0.19405940820212209, "name": "WRIST", "type": "right_hand", "index": 0, "frame_index": 2469}], [{"x": 0.47702842950820923, "y": 0.781262218952179, "z": 0.006848153192549944, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2470}, {"x": 0.48493391275405884, "y": 0.3888324797153473, "z": 0.001083961222320795, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2470}, {"x": 0.47834497690200806, "y": 0.507359504699707, "z": 0.1501908004283905, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2470}, {"x": 0.48680198192596436, "y": 0.3846355080604553, "z": -0.08264831453561783, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2470}, {"x": 0.48619017004966736, "y": 0.3851141333580017, "z": -0.08256778120994568, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2470}, {"x": 0.48732250928878784, "y": 0.3842483162879944, "z": -0.08256221562623978, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2470}, {"x": 0.4952603578567505, "y": 0.8082605004310608, "z": -0.049593571573495865, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2470}, {"x": 0.4722842574119568, "y": 0.800506055355072, "z": 0.0034438506700098515, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2470}, {"x": 0.48648256063461304, "y": 0.5690819621086121, "z": 0.06183558329939842, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2470}, {"x": 0.48834365606307983, "y": 0.5699427127838135, "z": 0.09423680603504181, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2470}, {"x": 0.4836021363735199, "y": 0.6762465834617615, "z": 0.006561990361660719, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2470}, {"x": 0.48661404848098755, "y": 0.5649594664573669, "z": 0.11330331116914749, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2470}, {"x": 0.4857173562049866, "y": 0.44399261474609375, "z": 0.09448004513978958, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2470}, {"x": 0.4885909855365753, "y": 0.5640581250190735, "z": 0.1052556186914444, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2470}, {"x": 0.48676103353500366, "y": 0.547591507434845, "z": 0.11354289948940277, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2470}, {"x": 0.48894864320755005, "y": 0.40241315960884094, "z": -0.06650951504707336, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2470}, {"x": 0.48394575715065, "y": 0.40465474128723145, "z": -0.08747018873691559, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2470}, {"x": 0.48693546652793884, "y": 0.3940650224685669, "z": -0.09951078146696091, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2470}, {"x": 0.4740752577781677, "y": 0.7878307104110718, "z": -0.1859760582447052, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2470}, {"x": 0.473056823015213, "y": 0.39234215021133423, "z": -0.0685281753540039, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2470}, {"x": 0.45345354080200195, "y": 0.4952825903892517, "z": -0.13692308962345123, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2470}, {"x": 0.4792473018169403, "y": 0.3878207802772522, "z": -0.09798170626163483, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2470}, {"x": 0.48125332593917847, "y": 0.3869170546531677, "z": -0.09775111079216003, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2470}, {"x": 0.4769724905490875, "y": 0.38865727186203003, "z": -0.09808395802974701, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2470}, {"x": 0.4847365915775299, "y": 0.8173868060112, "z": -0.2654789984226227, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2470}, {"x": 0.469794899225235, "y": 0.8079569339752197, "z": -0.19202308356761932, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2470}, {"x": 0.46966996788978577, "y": 0.5649555921554565, "z": -0.06193733587861061, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2470}, {"x": 0.480195552110672, "y": 0.57659512758255, "z": -0.20719821751117706, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2470}, {"x": 0.47846364974975586, "y": 0.6748984456062317, "z": -0.14820154011249542, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2470}, {"x": 0.4745161235332489, "y": 0.5770761966705322, "z": -0.20909911394119263, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2470}, {"x": 0.47102415561676025, "y": 0.43070900440216064, "z": -0.0931105688214302, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2470}, {"x": 0.4804946780204773, "y": 0.5707519054412842, "z": -0.18457069993019104, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2470}, {"x": 0.4747738838195801, "y": 0.5576804280281067, "z": -0.18535417318344116, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2470}, {"x": 0.4818653464317322, "y": 0.5820736885070801, "z": 0.11002415441907942, "name": "INDEX_FINGER_DIP", "type": "left_hand", "index": 7, "frame_index": 2470}, {"x": 0.4776317775249481, "y": 0.569953978061676, "z": 0.11268386745359749, "name": "INDEX_FINGER_MCP", "type": "left_hand", "index": 5, "frame_index": 2470}, {"x": 0.48039013147354126, "y": 0.577472448348999, "z": 0.1112879253923893, "name": "INDEX_FINGER_PIP", "type": "left_hand", "index": 6, "frame_index": 2470}, {"x": 0.48294520378112793, "y": 0.5859755873680115, "z": 0.10908576427027583, "name": "INDEX_FINGER_TIP", "type": "left_hand", "index": 8, "frame_index": 2470}, {"x": 0.48041510581970215, "y": 0.5861095190048218, "z": 0.10987328481860459, "name": "MIDDLE_FINGER_DIP", "type": "left_hand", "index": 11, "frame_index": 2470}, {"x": 0.4772489666938782, "y": 0.5720000863075256, "z": 0.11250093602575362, "name": "MIDDLE_FINGER_MCP", "type": "left_hand", "index": 9, "frame_index": 2470}, {"x": 0.4794166088104248, "y": 0.580701470375061, "z": 0.11111375386826694, "name": "MIDDLE_FINGER_PIP", "type": "left_hand", "index": 10, "frame_index": 2470}, {"x": 0.481048047542572, "y": 0.590614914894104, "z": 0.10903158131986856, "name": "MIDDLE_FINGER_TIP", "type": "left_hand", "index": 12, "frame_index": 2470}, {"x": 0.4769412577152252, "y": 0.5830691456794739, "z": 0.11019683303311467, "name": "PINKY_DIP", "type": "left_hand", "index": 19, "frame_index": 2470}, {"x": 0.4751691222190857, "y": 0.5721666216850281, "z": 0.11117818858474493, "name": "PINKY_MCP", "type": "left_hand", "index": 17, "frame_index": 2470}, {"x": 0.47638940811157227, "y": 0.578880786895752, "z": 0.1103275294881314, "name": "PINKY_PIP", "type": "left_hand", "index": 18, "frame_index": 2470}, {"x": 0.47724029421806335, "y": 0.5866490602493286, "z": 0.1101344923954457, "name": "PINKY_TIP", "type": "left_hand", "index": 20, "frame_index": 2470}, {"x": 0.478751540184021, "y": 0.585892915725708, "z": 0.11000101105310023, "name": "RING_FINGER_DIP", "type": "left_hand", "index": 15, "frame_index": 2470}, {"x": 0.4764057397842407, "y": 0.5726609826087952, "z": 0.11196891160216182, "name": "RING_FINGER_MCP", "type": "left_hand", "index": 13, "frame_index": 2470}, {"x": 0.478148877620697, "y": 0.580862820148468, "z": 0.11068984516896307, "name": "RING_FINGER_PIP", "type": "left_hand", "index": 14, "frame_index": 2470}, {"x": 0.47906145453453064, "y": 0.5900126695632935, "z": 0.109581985976547, "name": "RING_FINGER_TIP", "type": "left_hand", "index": 16, "frame_index": 2470}, {"x": 0.47113490104675293, "y": 0.5559415221214294, "z": 0.11154439439997077, "name": "THUMB_CMC", "type": "left_hand", "index": 1, "frame_index": 2470}, {"x": 0.4734152853488922, "y": 0.5658266544342041, "z": 0.10951616335660219, "name": "THUMB_IP", "type": "left_hand", "index": 3, "frame_index": 2470}, {"x": 0.4725792407989502, "y": 0.5610087513923645, "z": 0.11050706100650132, "name": "THUMB_MCP", "type": "left_hand", "index": 2, "frame_index": 2470}, {"x": 0.4738401174545288, "y": 0.5693656802177429, "z": 0.10860043531283736, "name": "THUMB_TIP", "type": "left_hand", "index": 4, "frame_index": 2470}, {"x": 0.47027233242988586, "y": 0.5530239939689636, "z": 0.11354291927978011, "name": "WRIST", "type": "left_hand", "index": 0, "frame_index": 2470}, {"x": 0.483598917722702, "y": 0.5830172300338745, "z": -0.18740128865465522, "name": "INDEX_FINGER_DIP", "type": "right_hand", "index": 7, "frame_index": 2470}, {"x": 0.47958457469940186, "y": 0.5698865056037903, "z": -0.18500525489798747, "name": "INDEX_FINGER_MCP", "type": "right_hand", "index": 5, "frame_index": 2470}, {"x": 0.48221996426582336, "y": 0.5779719352722168, "z": -0.18620816915063187, "name": "INDEX_FINGER_PIP", "type": "right_hand", "index": 6, "frame_index": 2470}, {"x": 0.48468735814094543, "y": 0.5870850682258606, "z": -0.1882879533804953, "name": "INDEX_FINGER_TIP", "type": "right_hand", "index": 8, "frame_index": 2470}, {"x": 0.480831116437912, "y": 0.5862659811973572, "z": -0.18777176085859537, "name": "MIDDLE_FINGER_DIP", "type": "right_hand", "index": 11, "frame_index": 2470}, {"x": 0.4779943823814392, "y": 0.5718898773193359, "z": -0.1858385823725257, "name": "MIDDLE_FINGER_MCP", "type": "right_hand", "index": 9, "frame_index": 2470}, {"x": 0.4800775945186615, "y": 0.5810085535049438, "z": -0.18681436404585838, "name": "MIDDLE_FINGER_PIP", "type": "right_hand", "index": 10, "frame_index": 2470}, {"x": 0.4813368320465088, "y": 0.5904102921485901, "z": -0.18848896026611328, "name": "MIDDLE_FINGER_TIP", "type": "right_hand", "index": 12, "frame_index": 2470}, {"x": 0.47482359409332275, "y": 0.5845277905464172, "z": -0.18869854789227247, "name": "PINKY_DIP", "type": "right_hand", "index": 19, "frame_index": 2470}, {"x": 0.4730096459388733, "y": 0.5723809003829956, "z": -0.18824675120413303, "name": "PINKY_MCP", "type": "right_hand", "index": 17, "frame_index": 2470}, {"x": 0.474176287651062, "y": 0.5798178911209106, "z": -0.18875939259305596, "name": "PINKY_PIP", "type": "right_hand", "index": 18, "frame_index": 2470}, {"x": 0.4752402901649475, "y": 0.5886280536651611, "z": -0.18868211307562888, "name": "PINKY_TIP", "type": "right_hand", "index": 20, "frame_index": 2470}, {"x": 0.4780585467815399, "y": 0.5869837999343872, "z": -0.18825359176844358, "name": "RING_FINGER_DIP", "type": "right_hand", "index": 15, "frame_index": 2470}, {"x": 0.47577595710754395, "y": 0.5727046132087708, "z": -0.1869559461483732, "name": "RING_FINGER_MCP", "type": "right_hand", "index": 13, "frame_index": 2470}, {"x": 0.4774339199066162, "y": 0.5817472338676453, "z": -0.18780571944080293, "name": "RING_FINGER_PIP", "type": "right_hand", "index": 14, "frame_index": 2470}, {"x": 0.47841334342956543, "y": 0.5911121368408203, "z": -0.18860504101030529, "name": "RING_FINGER_TIP", "type": "right_hand", "index": 16, "frame_index": 2470}, {"x": 0.47376078367233276, "y": 0.5556293725967407, "z": -0.18600669759325683, "name": "THUMB_CMC", "type": "right_hand", "index": 1, "frame_index": 2470}, {"x": 0.4774603843688965, "y": 0.5659612417221069, "z": -0.1875478932633996, "name": "THUMB_IP", "type": "right_hand", "index": 3, "frame_index": 2470}, {"x": 0.47659873962402344, "y": 0.5609481930732727, "z": -0.18666401668451726, "name": "THUMB_MCP", "type": "right_hand", "index": 2, "frame_index": 2470}, {"x": 0.4773247539997101, "y": 0.5699461698532104, "z": -0.1883782590739429, "name": "THUMB_TIP", "type": "right_hand", "index": 4, "frame_index": 2470}, {"x": 0.4698929488658905, "y": 0.5514004826545715, "z": -0.18535416161571572, "name": "WRIST", "type": "right_hand", "index": 0, "frame_index": 2470}], [{"x": 0.4769110083580017, "y": 0.7822455167770386, "z": -0.022956224158406258, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2471}, {"x": 0.48589566349983215, "y": 0.3888116478919983, "z": 0.01329862792044878, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2471}, {"x": 0.47857755422592163, "y": 0.5081171989440918, "z": 0.16000764071941376, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2471}, {"x": 0.486757755279541, "y": 0.38435059785842896, "z": -0.06790407747030258, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2471}, {"x": 0.4856008291244507, "y": 0.38477760553359985, "z": -0.06783366203308105, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2471}, {"x": 0.48730871081352234, "y": 0.38402843475341797, "z": -0.06781964004039764, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2471}, {"x": 0.49493592977523804, "y": 0.8090233206748962, "z": -0.08538065105676651, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2471}, {"x": 0.47223538160324097, "y": 0.8023250102996826, "z": -0.027431229129433632, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2471}, {"x": 0.4870564043521881, "y": 0.5696218013763428, "z": 0.05919519439339638, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2471}, {"x": 0.48786985874176025, "y": 0.5681161284446716, "z": 0.11514788120985031, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2471}, {"x": 0.4832577109336853, "y": 0.6765027046203613, "z": -0.013461947441101074, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2471}, {"x": 0.48619017004966736, "y": 0.5641190409660339, "z": 0.1329406201839447, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2471}, {"x": 0.4861074388027191, "y": 0.44492417573928833, "z": 0.10280712693929672, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2471}, {"x": 0.48756590485572815, "y": 0.5627186298370361, "z": 0.12416497617959976, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2471}, {"x": 0.48554831743240356, "y": 0.548086941242218, "z": 0.13153129816055298, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2471}, {"x": 0.4883349537849426, "y": 0.40224096179008484, "z": -0.052178166806697845, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2471}, {"x": 0.4815923571586609, "y": 0.4045080244541168, "z": -0.07271607965230942, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2471}, {"x": 0.48500820994377136, "y": 0.3936772346496582, "z": -0.08530473709106445, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2471}, {"x": 0.4742735028266907, "y": 0.7860020399093628, "z": -0.2320321947336197, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2471}, {"x": 0.4713915288448334, "y": 0.3922445774078369, "z": -0.05131811276078224, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2471}, {"x": 0.44984501600265503, "y": 0.4959052801132202, "z": -0.113615021109581, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2471}, {"x": 0.4777092933654785, "y": 0.3874620199203491, "z": -0.08274704962968826, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2471}, {"x": 0.48009246587753296, "y": 0.3865266740322113, "z": -0.0825105756521225, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2471}, {"x": 0.4754527807235718, "y": 0.38830721378326416, "z": -0.0828525498509407, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2471}, {"x": 0.4852619767189026, "y": 0.8160039782524109, "z": -0.3145501911640167, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2471}, {"x": 0.4705854058265686, "y": 0.8058639168739319, "z": -0.2383064478635788, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2471}, {"x": 0.4687991142272949, "y": 0.5655795335769653, "z": -0.05932290107011795, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2471}, {"x": 0.47703662514686584, "y": 0.5760848522186279, "z": -0.18425491452217102, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2471}, {"x": 0.4772605895996094, "y": 0.6739033460617065, "z": -0.18966589868068695, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2471}, {"x": 0.4716794788837433, "y": 0.5767126679420471, "z": -0.18576498329639435, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2471}, {"x": 0.4689842462539673, "y": 0.430847704410553, "z": -0.06821075081825256, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2471}, {"x": 0.4772535562515259, "y": 0.5701323747634888, "z": -0.16261084377765656, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2471}, {"x": 0.47128826379776, "y": 0.5573992133140564, "z": -0.16327902674674988, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2471}, {"x": 0.4817157983779907, "y": 0.5832195281982422, "z": 0.1292479275725782, "name": "INDEX_FINGER_DIP", "type": "left_hand", "index": 7, "frame_index": 2471}, {"x": 0.47749629616737366, "y": 0.5693638324737549, "z": 0.13129288694472052, "name": "INDEX_FINGER_MCP", "type": "left_hand", "index": 5, "frame_index": 2471}, {"x": 0.4802166819572449, "y": 0.5777350068092346, "z": 0.13019892666488886, "name": "INDEX_FINGER_PIP", "type": "left_hand", "index": 6, "frame_index": 2471}, {"x": 0.4828515350818634, "y": 0.5874921679496765, "z": 0.12855463987216353, "name": "INDEX_FINGER_TIP", "type": "left_hand", "index": 8, "frame_index": 2471}, {"x": 0.4788355529308319, "y": 0.5863562226295471, "z": 0.12900025490671396, "name": "MIDDLE_FINGER_DIP", "type": "left_hand", "index": 11, "frame_index": 2471}, {"x": 0.4757406413555145, "y": 0.5720989108085632, "z": 0.13063425826840103, "name": "MIDDLE_FINGER_MCP", "type": "left_hand", "index": 9, "frame_index": 2471}, {"x": 0.47799211740493774, "y": 0.5808948278427124, "z": 0.12978889618534595, "name": "MIDDLE_FINGER_PIP", "type": "left_hand", "index": 10, "frame_index": 2471}, {"x": 0.4793981909751892, "y": 0.5905805826187134, "z": 0.12842916115187109, "name": "MIDDLE_FINGER_TIP", "type": "left_hand", "index": 12, "frame_index": 2471}, {"x": 0.47255048155784607, "y": 0.5859032869338989, "z": 0.12843704828992486, "name": "PINKY_DIP", "type": "left_hand", "index": 19, "frame_index": 2471}, {"x": 0.4703077971935272, "y": 0.5743768811225891, "z": 0.12893180642277002, "name": "PINKY_MCP", "type": "left_hand", "index": 17, "frame_index": 2471}, {"x": 0.47175168991088867, "y": 0.5814989805221558, "z": 0.12845534761436284, "name": "PINKY_PIP", "type": "left_hand", "index": 18, "frame_index": 2471}, {"x": 0.47321873903274536, "y": 0.5896914601325989, "z": 0.12845598347485065, "name": "PINKY_TIP", "type": "left_hand", "index": 20, "frame_index": 2471}, {"x": 0.47606876492500305, "y": 0.5874053239822388, "z": 0.12865571537986398, "name": "RING_FINGER_DIP", "type": "left_hand", "index": 15, "frame_index": 2471}, {"x": 0.4732712209224701, "y": 0.5737029314041138, "z": 0.12983227090444416, "name": "RING_FINGER_MCP", "type": "left_hand", "index": 13, "frame_index": 2471}, {"x": 0.4752466082572937, "y": 0.5820176601409912, "z": 0.12910665455274284, "name": "RING_FINGER_PIP", "type": "left_hand", "index": 14, "frame_index": 2471}, {"x": 0.4767206311225891, "y": 0.5915865898132324, "z": 0.1283167744986713, "name": "RING_FINGER_TIP", "type": "left_hand", "index": 16, "frame_index": 2471}, {"x": 0.47205448150634766, "y": 0.5560811161994934, "z": 0.13109489349881187, "name": "THUMB_CMC", "type": "left_hand", "index": 1, "frame_index": 2471}, {"x": 0.4748370349407196, "y": 0.5678370594978333, "z": 0.12991218047682196, "name": "THUMB_IP", "type": "left_hand", "index": 3, "frame_index": 2471}, {"x": 0.4744577705860138, "y": 0.5617927312850952, "z": 0.13055895420257002, "name": "THUMB_MCP", "type": "left_hand", "index": 2, "frame_index": 2471}, {"x": 0.4745798707008362, "y": 0.5723514556884766, "z": 0.12935301731340587, "name": "THUMB_TIP", "type": "left_hand", "index": 4, "frame_index": 2471}, {"x": 0.4681379795074463, "y": 0.55332350730896, "z": 0.1315313149756836, "name": "WRIST", "type": "left_hand", "index": 0, "frame_index": 2471}, {"x": 0.48188403248786926, "y": 0.5833170413970947, "z": -0.1639110535616055, "name": "INDEX_FINGER_DIP", "type": "right_hand", "index": 7, "frame_index": 2471}, {"x": 0.47770580649375916, "y": 0.5691800713539124, "z": -0.1623997628921643, "name": "INDEX_FINGER_MCP", "type": "right_hand", "index": 5, "frame_index": 2471}, {"x": 0.48038771748542786, "y": 0.5778411030769348, "z": -0.16315982775995508, "name": "INDEX_FINGER_PIP", "type": "right_hand", "index": 6, "frame_index": 2471}, {"x": 0.4830264449119568, "y": 0.5876885652542114, "z": -0.1644922539126128, "name": "INDEX_FINGER_TIP", "type": "right_hand", "index": 8, "frame_index": 2471}, {"x": 0.47897467017173767, "y": 0.5865898132324219, "z": -0.16464233538135886, "name": "MIDDLE_FINGER_DIP", "type": "right_hand", "index": 11, "frame_index": 2471}, {"x": 0.47592735290527344, "y": 0.5718588829040527, "z": -0.1634474800375756, "name": "MIDDLE_FINGER_MCP", "type": "right_hand", "index": 9, "frame_index": 2471}, {"x": 0.4781590402126312, "y": 0.5811117887496948, "z": -0.16400111239636317, "name": "MIDDLE_FINGER_PIP", "type": "right_hand", "index": 10, "frame_index": 2471}, {"x": 0.4795236587524414, "y": 0.5908829569816589, "z": -0.16513913171365857, "name": "MIDDLE_FINGER_TIP", "type": "right_hand", "index": 12, "frame_index": 2471}, {"x": 0.47282376885414124, "y": 0.5862637162208557, "z": -0.16580535797402263, "name": "PINKY_DIP", "type": "right_hand", "index": 19, "frame_index": 2471}, {"x": 0.4704049527645111, "y": 0.5742574334144592, "z": -0.1657942037563771, "name": "PINKY_MCP", "type": "right_hand", "index": 17, "frame_index": 2471}, {"x": 0.47201982140541077, "y": 0.5817130208015442, "z": -0.16599095449782908, "name": "PINKY_PIP", "type": "right_hand", "index": 18, "frame_index": 2471}, {"x": 0.47349563241004944, "y": 0.5901872515678406, "z": -0.1656801907811314, "name": "PINKY_TIP", "type": "right_hand", "index": 20, "frame_index": 2471}, {"x": 0.47639521956443787, "y": 0.5875979661941528, "z": -0.16534879454411566, "name": "RING_FINGER_DIP", "type": "right_hand", "index": 15, "frame_index": 2471}, {"x": 0.4734472930431366, "y": 0.573496401309967, "z": -0.16459892003331333, "name": "RING_FINGER_MCP", "type": "right_hand", "index": 13, "frame_index": 2471}, {"x": 0.4755081534385681, "y": 0.5823003053665161, "z": -0.1650488928426057, "name": "RING_FINGER_PIP", "type": "right_hand", "index": 14, "frame_index": 2471}, {"x": 0.4771200716495514, "y": 0.591688871383667, "z": -0.1656241852324456, "name": "RING_FINGER_TIP", "type": "right_hand", "index": 16, "frame_index": 2471}, {"x": 0.47233253717422485, "y": 0.5566339492797852, "z": -0.16282693113316782, "name": "THUMB_CMC", "type": "right_hand", "index": 1, "frame_index": 2471}, {"x": 0.4749568700790405, "y": 0.5683963894844055, "z": -0.1633768440078711, "name": "THUMB_IP", "type": "right_hand", "index": 3, "frame_index": 2471}, {"x": 0.47470685839653015, "y": 0.5626717209815979, "z": -0.16294930226285942, "name": "THUMB_MCP", "type": "right_hand", "index": 2, "frame_index": 2471}, {"x": 0.4745081961154938, "y": 0.5727584362030029, "z": -0.16376830206718296, "name": "THUMB_TIP", "type": "right_hand", "index": 4, "frame_index": 2471}, {"x": 0.4679564833641052, "y": 0.5523744225502014, "z": -0.16327901143830026, "name": "WRIST", "type": "right_hand", "index": 0, "frame_index": 2471}], [{"x": 0.4769231379032135, "y": 0.7833732962608337, "z": -0.007579085882753134, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2472}, {"x": 0.48785609006881714, "y": 0.38879263401031494, "z": 0.016321765258908272, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2472}, {"x": 0.4786486327648163, "y": 0.5087868571281433, "z": 0.15604548156261444, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2472}, {"x": 0.4865589737892151, "y": 0.3837707042694092, "z": -0.06747227162122726, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2472}, {"x": 0.4847412705421448, "y": 0.3839913010597229, "z": -0.06740432232618332, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2472}, {"x": 0.48727673292160034, "y": 0.383658230304718, "z": -0.0673881322145462, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2472}, {"x": 0.49524354934692383, "y": 0.8102800250053406, "z": -0.07032310962677002, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2472}, {"x": 0.4721096158027649, "y": 0.8035898208618164, "z": -0.011538944207131863, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2472}, {"x": 0.4875182807445526, "y": 0.5698498487472534, "z": 0.054994333535432816, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2472}, {"x": 0.4878847897052765, "y": 0.5670390725135803, "z": 0.10681311786174774, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2472}, {"x": 0.4831731617450714, "y": 0.6769601106643677, "z": -0.004841544199734926, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2472}, {"x": 0.48650503158569336, "y": 0.5607686638832092, "z": 0.1245969608426094, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2472}, {"x": 0.4883034825325012, "y": 0.4453205466270447, "z": 0.10348813235759735, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2472}, {"x": 0.48755747079849243, "y": 0.5611951351165771, "z": 0.11716365069150925, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2472}, {"x": 0.4861833155155182, "y": 0.5444009304046631, "z": 0.12476407736539841, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2472}, {"x": 0.487577348947525, "y": 0.4019368290901184, "z": -0.05185055360198021, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2472}, {"x": 0.48022276163101196, "y": 0.4040851294994354, "z": -0.07031220942735672, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2472}, {"x": 0.48301756381988525, "y": 0.39287930727005005, "z": -0.08499986678361893, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2472}, {"x": 0.473310261964798, "y": 0.7850225567817688, "z": -0.19892822206020355, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2472}, {"x": 0.4714132249355316, "y": 0.3918866515159607, "z": -0.0434441938996315, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2472}, {"x": 0.44598743319511414, "y": 0.4955555200576782, "z": -0.09888061881065369, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2472}, {"x": 0.476495623588562, "y": 0.38690873980522156, "z": -0.08078006654977798, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2472}, {"x": 0.4787875711917877, "y": 0.38576674461364746, "z": -0.08054087311029434, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2472}, {"x": 0.47464093565940857, "y": 0.38787922263145447, "z": -0.08088992536067963, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2472}, {"x": 0.48360130190849304, "y": 0.8166009783744812, "z": -0.28073015809059143, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2472}, {"x": 0.4702933728694916, "y": 0.8043445944786072, "z": -0.20449458062648773, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2472}, {"x": 0.4676794707775116, "y": 0.5657027363777161, "z": -0.05511325225234032, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2472}, {"x": 0.47411537170410156, "y": 0.5743899941444397, "z": -0.16953523457050323, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2472}, {"x": 0.4748303294181824, "y": 0.6726678013801575, "z": -0.16582205891609192, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2472}, {"x": 0.46920105814933777, "y": 0.5763225555419922, "z": -0.17032845318317413, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2472}, {"x": 0.46694740653038025, "y": 0.43159863352775574, "z": -0.05787644907832146, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2472}, {"x": 0.4738883674144745, "y": 0.5682823657989502, "z": -0.14792540669441223, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2472}, {"x": 0.4669329822063446, "y": 0.5569899678230286, "z": -0.14809086918830872, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2472}, {"x": 0.47940149903297424, "y": 0.5827937126159668, "z": 0.12251682090573013, "name": "INDEX_FINGER_DIP", "type": "left_hand", "index": 7, "frame_index": 2472}, {"x": 0.47511717677116394, "y": 0.5703652501106262, "z": 0.1250019598082872, "name": "INDEX_FINGER_MCP", "type": "left_hand", "index": 5, "frame_index": 2472}, {"x": 0.4777127206325531, "y": 0.5778733491897583, "z": 0.12374077516142279, "name": "INDEX_FINGER_PIP", "type": "left_hand", "index": 6, "frame_index": 2472}, {"x": 0.48083195090293884, "y": 0.5869551301002502, "z": 0.12159524485468864, "name": "INDEX_FINGER_TIP", "type": "left_hand", "index": 8, "frame_index": 2472}, {"x": 0.47634443640708923, "y": 0.5858637690544128, "z": 0.12207863479852676, "name": "MIDDLE_FINGER_DIP", "type": "left_hand", "index": 11, "frame_index": 2472}, {"x": 0.4730333685874939, "y": 0.5730735659599304, "z": 0.12423938064603135, "name": "MIDDLE_FINGER_MCP", "type": "left_hand", "index": 9, "frame_index": 2472}, {"x": 0.4752616286277771, "y": 0.5808916687965393, "z": 0.12314948183484375, "name": "MIDDLE_FINGER_PIP", "type": "left_hand", "index": 10, "frame_index": 2472}, {"x": 0.47727441787719727, "y": 0.5901522636413574, "z": 0.12130541447550058, "name": "MIDDLE_FINGER_TIP", "type": "left_hand", "index": 12, "frame_index": 2472}, {"x": 0.4705343246459961, "y": 0.585915744304657, "z": 0.12117892201058567, "name": "PINKY_DIP", "type": "left_hand", "index": 19, "frame_index": 2472}, {"x": 0.46754616498947144, "y": 0.5749493837356567, "z": 0.12208968726918101, "name": "PINKY_MCP", "type": "left_hand", "index": 17, "frame_index": 2472}, {"x": 0.4693087339401245, "y": 0.5816163420677185, "z": 0.1212786347605288, "name": "PINKY_PIP", "type": "left_hand", "index": 18, "frame_index": 2472}, {"x": 0.4716714024543762, "y": 0.5896888375282288, "z": 0.1211559078656137, "name": "PINKY_TIP", "type": "left_hand", "index": 20, "frame_index": 2472}, {"x": 0.47382432222366333, "y": 0.5870980024337769, "z": 0.12169886520132422, "name": "RING_FINGER_DIP", "type": "left_hand", "index": 15, "frame_index": 2472}, {"x": 0.4705033004283905, "y": 0.5745596885681152, "z": 0.12323748250491917, "name": "RING_FINGER_MCP", "type": "left_hand", "index": 13, "frame_index": 2472}, {"x": 0.4726257026195526, "y": 0.582166314125061, "z": 0.12221118132583797, "name": "RING_FINGER_PIP", "type": "left_hand", "index": 14, "frame_index": 2472}, {"x": 0.4749072194099426, "y": 0.5912237763404846, "z": 0.12135167745873332, "name": "RING_FINGER_TIP", "type": "left_hand", "index": 16, "frame_index": 2472}, {"x": 0.47011643648147583, "y": 0.556530773639679, "z": 0.12413433199981228, "name": "THUMB_CMC", "type": "left_hand", "index": 1, "frame_index": 2472}, {"x": 0.47545406222343445, "y": 0.5673738718032837, "z": 0.12312240269966424, "name": "THUMB_IP", "type": "left_hand", "index": 3, "frame_index": 2472}, {"x": 0.47362908720970154, "y": 0.5620571374893188, "z": 0.12370594521053135, "name": "THUMB_MCP", "type": "left_hand", "index": 2, "frame_index": 2472}, {"x": 0.47652116417884827, "y": 0.5717276334762573, "z": 0.12257476849481463, "name": "THUMB_TIP", "type": "left_hand", "index": 4, "frame_index": 2472}, {"x": 0.46532872319221497, "y": 0.5538524389266968, "z": 0.12476409076424666, "name": "WRIST", "type": "left_hand", "index": 0, "frame_index": 2472}, {"x": 0.47947221994400024, "y": 0.5827791690826416, "z": -0.1506382857915014, "name": "INDEX_FINGER_DIP", "type": "right_hand", "index": 7, "frame_index": 2472}, {"x": 0.4752311408519745, "y": 0.5704380869865417, "z": -0.14798496562434593, "name": "INDEX_FINGER_MCP", "type": "right_hand", "index": 5, "frame_index": 2472}, {"x": 0.4778030514717102, "y": 0.5778964161872864, "z": -0.1493162236874923, "name": "INDEX_FINGER_PIP", "type": "right_hand", "index": 6, "frame_index": 2472}, {"x": 0.4808686375617981, "y": 0.5870242118835449, "z": -0.15164208062924445, "name": "INDEX_FINGER_TIP", "type": "right_hand", "index": 8, "frame_index": 2472}, {"x": 0.4764569103717804, "y": 0.5858567953109741, "z": -0.150902388850227, "name": "MIDDLE_FINGER_DIP", "type": "right_hand", "index": 11, "frame_index": 2472}, {"x": 0.47307583689689636, "y": 0.5732128620147705, "z": -0.1486385095049627, "name": "MIDDLE_FINGER_MCP", "type": "right_hand", "index": 9, "frame_index": 2472}, {"x": 0.4753017723560333, "y": 0.5809974074363708, "z": -0.1497718831524253, "name": "MIDDLE_FINGER_PIP", "type": "right_hand", "index": 10, "frame_index": 2472}, {"x": 0.47746530175209045, "y": 0.5901175141334534, "z": -0.15173132461495697, "name": "MIDDLE_FINGER_TIP", "type": "right_hand", "index": 12, "frame_index": 2472}, {"x": 0.4705398678779602, "y": 0.5858142971992493, "z": -0.15161823946982622, "name": "PINKY_DIP", "type": "right_hand", "index": 19, "frame_index": 2472}, {"x": 0.46750181913375854, "y": 0.5749469995498657, "z": -0.15068553923629224, "name": "PINKY_MCP", "type": "right_hand", "index": 17, "frame_index": 2472}, {"x": 0.46927398443222046, "y": 0.5815492868423462, "z": -0.15150215849280357, "name": "PINKY_PIP", "type": "right_hand", "index": 18, "frame_index": 2472}, {"x": 0.47170567512512207, "y": 0.5895767211914062, "z": -0.1516691385768354, "name": "PINKY_TIP", "type": "right_hand", "index": 20, "frame_index": 2472}, {"x": 0.4739312529563904, "y": 0.5870581269264221, "z": -0.15115395141765475, "name": "RING_FINGER_DIP", "type": "right_hand", "index": 15, "frame_index": 2472}, {"x": 0.47048839926719666, "y": 0.5746669769287109, "z": -0.14956975704990327, "name": "RING_FINGER_MCP", "type": "right_hand", "index": 13, "frame_index": 2472}, {"x": 0.47264546155929565, "y": 0.5822010040283203, "z": -0.1506195415277034, "name": "RING_FINGER_PIP", "type": "right_hand", "index": 14, "frame_index": 2472}, {"x": 0.4750809967517853, "y": 0.5911991000175476, "z": -0.1515327903907746, "name": "RING_FINGER_TIP", "type": "right_hand", "index": 16, "frame_index": 2472}, {"x": 0.4701377749443054, "y": 0.5558417439460754, "z": -0.14902402454754338, "name": "THUMB_CMC", "type": "right_hand", "index": 1, "frame_index": 2472}, {"x": 0.4754270315170288, "y": 0.5665687918663025, "z": -0.1502983549144119, "name": "THUMB_IP", "type": "right_hand", "index": 3, "frame_index": 2472}, {"x": 0.47364479303359985, "y": 0.5612123608589172, "z": -0.14960445184260607, "name": "THUMB_MCP", "type": "right_hand", "index": 2, "frame_index": 2472}, {"x": 0.4763956367969513, "y": 0.5707902908325195, "z": -0.15093723335303366, "name": "THUMB_TIP", "type": "right_hand", "index": 4, "frame_index": 2472}, {"x": 0.46531111001968384, "y": 0.5530986785888672, "z": -0.148090855167875, "name": "WRIST", "type": "right_hand", "index": 0, "frame_index": 2472}], [{"x": 0.476820170879364, "y": 0.7835143208503723, "z": -0.0039055512752383947, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2473}, {"x": 0.48884353041648865, "y": 0.388760507106781, "z": 0.01473292987793684, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2473}, {"x": 0.4786578416824341, "y": 0.5099908113479614, "z": 0.14579759538173676, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2473}, {"x": 0.48641878366470337, "y": 0.38359585404396057, "z": -0.06964710354804993, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2473}, {"x": 0.4840119481086731, "y": 0.38373127579689026, "z": -0.06957625597715378, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2473}, {"x": 0.48725974559783936, "y": 0.3835524618625641, "z": -0.06956352293491364, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2473}, {"x": 0.49485644698143005, "y": 0.8106702566146851, "z": -0.07064202427864075, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2473}, {"x": 0.47200316190719604, "y": 0.8034716844558716, "z": -0.007904930040240288, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2473}, {"x": 0.4874928891658783, "y": 0.5698215961456299, "z": 0.0493585579097271, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2473}, {"x": 0.4870169460773468, "y": 0.5721046924591064, "z": 0.09786141663789749, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2473}, {"x": 0.4831790030002594, "y": 0.677064836025238, "z": -0.0030541352462023497, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2473}, {"x": 0.48514601588249207, "y": 0.5722804069519043, "z": 0.11372838914394379, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2473}, {"x": 0.4899810552597046, "y": 0.44643527269363403, "z": 0.09814811497926712, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2473}, {"x": 0.4865776300430298, "y": 0.5661579966545105, "z": 0.1102452203631401, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2473}, {"x": 0.4856339693069458, "y": 0.54792720079422, "z": 0.1160508245229721, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2473}, {"x": 0.48655298352241516, "y": 0.40183454751968384, "z": -0.054189860820770264, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2473}, {"x": 0.47878625988960266, "y": 0.4035300612449646, "z": -0.07088920474052429, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2473}, {"x": 0.4816116392612457, "y": 0.39254477620124817, "z": -0.08702938258647919, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2473}, {"x": 0.47284233570098877, "y": 0.7841859459877014, "z": -0.17818842828273773, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2473}, {"x": 0.4711790084838867, "y": 0.3915064334869385, "z": -0.040471192449331284, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2473}, {"x": 0.44376441836357117, "y": 0.4955655634403229, "z": -0.08759493380784988, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2473}, {"x": 0.4757004976272583, "y": 0.3863769471645355, "z": -0.08165883272886276, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2473}, {"x": 0.4776296019554138, "y": 0.3853081166744232, "z": -0.08142212778329849, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2473}, {"x": 0.4738510549068451, "y": 0.387245237827301, "z": -0.0817696824669838, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2473}, {"x": 0.48063385486602783, "y": 0.8169920444488525, "z": -0.2582961320877075, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2473}, {"x": 0.47026875615119934, "y": 0.8028391003608704, "z": -0.1836410015821457, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2473}, {"x": 0.46653854846954346, "y": 0.5658892393112183, "z": -0.049480538815259933, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2473}, {"x": 0.47180429100990295, "y": 0.5735490322113037, "z": -0.1617119014263153, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2473}, {"x": 0.4725634455680847, "y": 0.6723264455795288, "z": -0.1538853496313095, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2473}, {"x": 0.46699878573417664, "y": 0.5761993527412415, "z": -0.16149663925170898, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2473}, {"x": 0.46427398920059204, "y": 0.4326138198375702, "z": -0.050562936812639236, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2473}, {"x": 0.47148674726486206, "y": 0.5674936175346375, "z": -0.1394215226173401, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2473}, {"x": 0.4644639194011688, "y": 0.5568456053733826, "z": -0.13911741971969604, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2473}, {"x": 0.47749432921409607, "y": 0.5817593336105347, "z": 0.11322099412791431, "name": "INDEX_FINGER_DIP", "type": "left_hand", "index": 7, "frame_index": 2473}, {"x": 0.4724738895893097, "y": 0.5700780749320984, "z": 0.1156507714476902, "name": "INDEX_FINGER_MCP", "type": "left_hand", "index": 5, "frame_index": 2473}, {"x": 0.475598007440567, "y": 0.577240526676178, "z": 0.11435621918644756, "name": "INDEX_FINGER_PIP", "type": "left_hand", "index": 6, "frame_index": 2473}, {"x": 0.47890859842300415, "y": 0.5856373906135559, "z": 0.11242235545068979, "name": "INDEX_FINGER_TIP", "type": "left_hand", "index": 8, "frame_index": 2473}, {"x": 0.4750879406929016, "y": 0.583954930305481, "z": 0.11292013293132186, "name": "MIDDLE_FINGER_DIP", "type": "left_hand", "index": 11, "frame_index": 2473}, {"x": 0.470567911863327, "y": 0.5723459124565125, "z": 0.11512809386476874, "name": "MIDDLE_FINGER_MCP", "type": "left_hand", "index": 9, "frame_index": 2473}, {"x": 0.47344502806663513, "y": 0.5794980525970459, "z": 0.11394629091955721, "name": "MIDDLE_FINGER_PIP", "type": "left_hand", "index": 10, "frame_index": 2473}, {"x": 0.4763107895851135, "y": 0.5878494381904602, "z": 0.11224288656376302, "name": "MIDDLE_FINGER_TIP", "type": "left_hand", "index": 12, "frame_index": 2473}, {"x": 0.4691505432128906, "y": 0.5836772918701172, "z": 0.1125788502395153, "name": "PINKY_DIP", "type": "left_hand", "index": 19, "frame_index": 2473}, {"x": 0.4656500518321991, "y": 0.5733852386474609, "z": 0.11354073276743293, "name": "PINKY_MCP", "type": "left_hand", "index": 17, "frame_index": 2473}, {"x": 0.4676360785961151, "y": 0.5795950293540955, "z": 0.11264286073856056, "name": "PINKY_PIP", "type": "left_hand", "index": 18, "frame_index": 2473}, {"x": 0.4703809916973114, "y": 0.5872501134872437, "z": 0.11264827568084002, "name": "PINKY_TIP", "type": "left_hand", "index": 20, "frame_index": 2473}, {"x": 0.47259095311164856, "y": 0.5851371884346008, "z": 0.11282942816615105, "name": "RING_FINGER_DIP", "type": "left_hand", "index": 15, "frame_index": 2473}, {"x": 0.46825724840164185, "y": 0.5733707547187805, "z": 0.11439933045767248, "name": "RING_FINGER_MCP", "type": "left_hand", "index": 13, "frame_index": 2473}, {"x": 0.4709157645702362, "y": 0.5803382396697998, "z": 0.11326888273470104, "name": "RING_FINGER_PIP", "type": "left_hand", "index": 14, "frame_index": 2473}, {"x": 0.47383105754852295, "y": 0.5891674160957336, "z": 0.11260194820351899, "name": "RING_FINGER_TIP", "type": "left_hand", "index": 16, "frame_index": 2473}, {"x": 0.46747079491615295, "y": 0.5562537908554077, "z": 0.1151981910225004, "name": "THUMB_CMC", "type": "left_hand", "index": 1, "frame_index": 2473}, {"x": 0.4732033908367157, "y": 0.5670782923698425, "z": 0.11410032166168094, "name": "THUMB_IP", "type": "left_hand", "index": 3, "frame_index": 2473}, {"x": 0.4712027907371521, "y": 0.5618491172790527, "z": 0.11466957861557603, "name": "THUMB_MCP", "type": "left_hand", "index": 2, "frame_index": 2473}, {"x": 0.47484323382377625, "y": 0.5713872909545898, "z": 0.11358290910720825, "name": "THUMB_TIP", "type": "left_hand", "index": 4, "frame_index": 2473}, {"x": 0.46305835247039795, "y": 0.5538486242294312, "z": 0.11605083732257437, "name": "WRIST", "type": "left_hand", "index": 0, "frame_index": 2473}, {"x": 0.47778084874153137, "y": 0.5815427303314209, "z": -0.14184585493057966, "name": "INDEX_FINGER_DIP", "type": "right_hand", "index": 7, "frame_index": 2473}, {"x": 0.4728814363479614, "y": 0.5702618956565857, "z": -0.13933122134767473, "name": "INDEX_FINGER_MCP", "type": "right_hand", "index": 5, "frame_index": 2473}, {"x": 0.47595924139022827, "y": 0.577172577381134, "z": -0.14062809792812914, "name": "INDEX_FINGER_PIP", "type": "right_hand", "index": 6, "frame_index": 2473}, {"x": 0.4791829288005829, "y": 0.5853732228279114, "z": -0.1427309897262603, "name": "INDEX_FINGER_TIP", "type": "right_hand", "index": 8, "frame_index": 2473}, {"x": 0.47575944662094116, "y": 0.5844089984893799, "z": -0.14213990326970816, "name": "MIDDLE_FINGER_DIP", "type": "right_hand", "index": 11, "frame_index": 2473}, {"x": 0.4709342420101166, "y": 0.5728589296340942, "z": -0.13982413947815076, "name": "MIDDLE_FINGER_MCP", "type": "right_hand", "index": 9, "frame_index": 2473}, {"x": 0.47396665811538696, "y": 0.5799268484115601, "z": -0.14102566032670438, "name": "MIDDLE_FINGER_PIP", "type": "right_hand", "index": 10, "frame_index": 2473}, {"x": 0.477156400680542, "y": 0.5883469581604004, "z": -0.14288793364539742, "name": "MIDDLE_FINGER_TIP", "type": "right_hand", "index": 12, "frame_index": 2473}, {"x": 0.469338595867157, "y": 0.5847172737121582, "z": -0.14268442592583597, "name": "PINKY_DIP", "type": "right_hand", "index": 19, "frame_index": 2473}, {"x": 0.4657902419567108, "y": 0.5743500590324402, "z": -0.1415413843933493, "name": "PINKY_MCP", "type": "right_hand", "index": 17, "frame_index": 2473}, {"x": 0.46782055497169495, "y": 0.5806455016136169, "z": -0.14251309353858232, "name": "PINKY_PIP", "type": "right_hand", "index": 18, "frame_index": 2473}, {"x": 0.47064054012298584, "y": 0.5883954763412476, "z": -0.14270782005041838, "name": "PINKY_TIP", "type": "right_hand", "index": 20, "frame_index": 2473}, {"x": 0.47295624017715454, "y": 0.58589768409729, "z": -0.14238168927840889, "name": "RING_FINGER_DIP", "type": "right_hand", "index": 15, "frame_index": 2473}, {"x": 0.46856173872947693, "y": 0.5741397738456726, "z": -0.14059615263249725, "name": "RING_FINGER_MCP", "type": "right_hand", "index": 13, "frame_index": 2473}, {"x": 0.47131818532943726, "y": 0.5811618566513062, "z": -0.141802309313789, "name": "RING_FINGER_PIP", "type": "right_hand", "index": 14, "frame_index": 2473}, {"x": 0.4742145836353302, "y": 0.5899373292922974, "z": -0.14270673599094152, "name": "RING_FINGER_TIP", "type": "right_hand", "index": 16, "frame_index": 2473}, {"x": 0.46739429235458374, "y": 0.555552065372467, "z": -0.14027434517629445, "name": "THUMB_CMC", "type": "right_hand", "index": 1, "frame_index": 2473}, {"x": 0.47359499335289, "y": 0.565392017364502, "z": -0.14158327062614262, "name": "THUMB_IP", "type": "right_hand", "index": 3, "frame_index": 2473}, {"x": 0.471412718296051, "y": 0.5604339838027954, "z": -0.14091278437990695, "name": "THUMB_MCP", "type": "right_hand", "index": 2, "frame_index": 2473}, {"x": 0.47523996233940125, "y": 0.5695770978927612, "z": -0.14216681942343712, "name": "THUMB_TIP", "type": "right_hand", "index": 4, "frame_index": 2473}, {"x": 0.46274617314338684, "y": 0.5539506077766418, "z": -0.1391174057963216, "name": "WRIST", "type": "right_hand", "index": 0, "frame_index": 2473}], [{"x": 0.4767601191997528, "y": 0.7839574813842773, "z": -0.0037841787561774254, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2474}, {"x": 0.48924896121025085, "y": 0.38888004422187805, "z": 0.014925527386367321, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2474}, {"x": 0.48020628094673157, "y": 0.5126674771308899, "z": 0.13798284530639648, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2474}, {"x": 0.4863954186439514, "y": 0.3836246728897095, "z": -0.06716922670602798, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2474}, {"x": 0.4839901328086853, "y": 0.38372430205345154, "z": -0.06709353625774384, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2474}, {"x": 0.4874151945114136, "y": 0.38357213139533997, "z": -0.06708783656358719, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2474}, {"x": 0.4948611259460449, "y": 0.8110619783401489, "z": -0.06989611685276031, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2474}, {"x": 0.4719359278678894, "y": 0.803882360458374, "z": -0.008033446036279202, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2474}, {"x": 0.48751506209373474, "y": 0.5697680711746216, "z": 0.04650164023041725, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2474}, {"x": 0.4864792227745056, "y": 0.5807750225067139, "z": 0.08486511558294296, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2474}, {"x": 0.4831993877887726, "y": 0.6774441003799438, "z": -0.000904521846678108, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2474}, {"x": 0.4844764769077301, "y": 0.5827990770339966, "z": 0.10102022439241409, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2474}, {"x": 0.4904840588569641, "y": 0.4478842616081238, "z": 0.09470484405755997, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2474}, {"x": 0.4860611855983734, "y": 0.5744830369949341, "z": 0.097723588347435, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2474}, {"x": 0.4853532016277313, "y": 0.5549922585487366, "z": 0.10419313609600067, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2474}, {"x": 0.48624494671821594, "y": 0.40184518694877625, "z": -0.05201026424765587, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2474}, {"x": 0.47840920090675354, "y": 0.40335890650749207, "z": -0.06846208870410919, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2474}, {"x": 0.4815767705440521, "y": 0.3925190269947052, "z": -0.08395463973283768, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2474}, {"x": 0.4727773368358612, "y": 0.7843946218490601, "z": -0.17303338646888733, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2474}, {"x": 0.4712255597114563, "y": 0.39093175530433655, "z": -0.03739102929830551, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2474}, {"x": 0.4413822591304779, "y": 0.49559342861175537, "z": -0.08347209542989731, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2474}, {"x": 0.4757697880268097, "y": 0.3859331011772156, "z": -0.07892585545778275, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2474}, {"x": 0.4776962697505951, "y": 0.384991854429245, "z": -0.07869565486907959, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2474}, {"x": 0.473980575799942, "y": 0.38664427399635315, "z": -0.07903113216161728, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2474}, {"x": 0.4796280562877655, "y": 0.8171090483665466, "z": -0.2519401013851166, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2474}, {"x": 0.4706191122531891, "y": 0.8030478954315186, "z": -0.17805786430835724, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2474}, {"x": 0.4658450186252594, "y": 0.5658843517303467, "z": -0.04661818966269493, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2474}, {"x": 0.47060713171958923, "y": 0.5723292827606201, "z": -0.16063620150089264, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2474}, {"x": 0.47129514813423157, "y": 0.6723594069480896, "z": -0.1485937535762787, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2474}, {"x": 0.465879887342453, "y": 0.5759583711624146, "z": -0.16016680002212524, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2474}, {"x": 0.4624541997909546, "y": 0.4327786862850189, "z": -0.04613734036684036, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2474}, {"x": 0.4702346920967102, "y": 0.5667665600776672, "z": -0.13813994824886322, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2474}, {"x": 0.4630366265773773, "y": 0.5567254424095154, "z": -0.13759684562683105, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2474}, {"x": 0.47605565190315247, "y": 0.5799610018730164, "z": -0.13923642958980054, "name": "INDEX_FINGER_DIP", "type": "right_hand", "index": 7, "frame_index": 2474}, {"x": 0.47210365533828735, "y": 0.5665920376777649, "z": -0.13723914671572857, "name": "INDEX_FINGER_MCP", "type": "right_hand", "index": 5, "frame_index": 2474}, {"x": 0.47470349073410034, "y": 0.5746583342552185, "z": -0.13833599188365042, "name": "INDEX_FINGER_PIP", "type": "right_hand", "index": 6, "frame_index": 2474}, {"x": 0.4771004915237427, "y": 0.5839560031890869, "z": -0.1398451621644199, "name": "INDEX_FINGER_TIP", "type": "right_hand", "index": 8, "frame_index": 2474}, {"x": 0.47448089718818665, "y": 0.5837200880050659, "z": -0.14011786365881562, "name": "MIDDLE_FINGER_DIP", "type": "right_hand", "index": 11, "frame_index": 2474}, {"x": 0.47006478905677795, "y": 0.5696697235107422, "z": -0.1383111048489809, "name": "MIDDLE_FINGER_MCP", "type": "right_hand", "index": 9, "frame_index": 2474}, {"x": 0.472940057516098, "y": 0.5782789587974548, "z": -0.13925445568747818, "name": "MIDDLE_FINGER_PIP", "type": "right_hand", "index": 10, "frame_index": 2474}, {"x": 0.4759196937084198, "y": 0.5880909562110901, "z": -0.1407004634384066, "name": "MIDDLE_FINGER_TIP", "type": "right_hand", "index": 12, "frame_index": 2474}, {"x": 0.46754172444343567, "y": 0.5853993892669678, "z": -0.14134016633033752, "name": "PINKY_DIP", "type": "right_hand", "index": 19, "frame_index": 2474}, {"x": 0.46393945813179016, "y": 0.5739278793334961, "z": -0.140690854517743, "name": "PINKY_MCP", "type": "right_hand", "index": 17, "frame_index": 2474}, {"x": 0.4661064147949219, "y": 0.5810784697532654, "z": -0.14133105357177556, "name": "PINKY_PIP", "type": "right_hand", "index": 18, "frame_index": 2474}, {"x": 0.46883147954940796, "y": 0.5890675187110901, "z": -0.14126263745129108, "name": "PINKY_TIP", "type": "right_hand", "index": 20, "frame_index": 2474}, {"x": 0.47175198793411255, "y": 0.5859933495521545, "z": -0.14089664560742676, "name": "RING_FINGER_DIP", "type": "right_hand", "index": 15, "frame_index": 2474}, {"x": 0.4673202633857727, "y": 0.5721882581710815, "z": -0.1394902941538021, "name": "RING_FINGER_MCP", "type": "right_hand", "index": 13, "frame_index": 2474}, {"x": 0.4701347053050995, "y": 0.5807052850723267, "z": -0.1404027217067778, "name": "RING_FINGER_PIP", "type": "right_hand", "index": 14, "frame_index": 2474}, {"x": 0.4732901155948639, "y": 0.5901507139205933, "z": -0.1411900024395436, "name": "RING_FINGER_TIP", "type": "right_hand", "index": 16, "frame_index": 2474}, {"x": 0.4663470685482025, "y": 0.5561632513999939, "z": -0.13738147399271838, "name": "THUMB_CMC", "type": "right_hand", "index": 1, "frame_index": 2474}, {"x": 0.4732535779476166, "y": 0.5663567781448364, "z": -0.1380533511401154, "name": "THUMB_IP", "type": "right_hand", "index": 3, "frame_index": 2474}, {"x": 0.4706194996833801, "y": 0.5612545609474182, "z": -0.1375782590603194, "name": "THUMB_MCP", "type": "right_hand", "index": 2, "frame_index": 2474}, {"x": 0.4749395549297333, "y": 0.5706855654716492, "z": -0.13850589300272986, "name": "THUMB_TIP", "type": "right_hand", "index": 4, "frame_index": 2474}, {"x": 0.46089616417884827, "y": 0.5537859201431274, "z": -0.13759683341664797, "name": "WRIST", "type": "right_hand", "index": 0, "frame_index": 2474}], [{"x": 0.47676193714141846, "y": 0.7841347455978394, "z": 0.010901755653321743, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2475}, {"x": 0.48941415548324585, "y": 0.38889890909194946, "z": 0.011573076248168945, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2475}, {"x": 0.48363828659057617, "y": 0.5116653442382812, "z": 0.13075026869773865, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2475}, {"x": 0.48637714982032776, "y": 0.38364043831825256, "z": -0.06994341313838959, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2475}, {"x": 0.4839615225791931, "y": 0.3836502134799957, "z": -0.06986118108034134, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2475}, {"x": 0.48747745156288147, "y": 0.3835912048816681, "z": -0.06986856460571289, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2475}, {"x": 0.49499762058258057, "y": 0.8111822009086609, "z": -0.05295279994606972, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2475}, {"x": 0.47190138697624207, "y": 0.8040419220924377, "z": 0.007656487170606852, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2475}, {"x": 0.48804739117622375, "y": 0.5697081685066223, "z": 0.04479074850678444, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2475}, {"x": 0.4867863357067108, "y": 0.5764064788818359, "z": 0.07014334946870804, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2475}, {"x": 0.4834660291671753, "y": 0.6774089932441711, "z": 0.00661002192646265, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2475}, {"x": 0.48541316390037537, "y": 0.5779595971107483, "z": 0.08574391156435013, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2475}, {"x": 0.4918023347854614, "y": 0.4479844570159912, "z": 0.08980707824230194, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2475}, {"x": 0.486496239900589, "y": 0.5703337788581848, "z": 0.08370473980903625, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2475}, {"x": 0.4864215552806854, "y": 0.5529851913452148, "z": 0.09059750288724899, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2475}, {"x": 0.48575979471206665, "y": 0.4018442928791046, "z": -0.05479125306010246, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2475}, {"x": 0.47766974568367004, "y": 0.4026002287864685, "z": -0.07063079625368118, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2475}, {"x": 0.4813787639141083, "y": 0.3923821449279785, "z": -0.08655759692192078, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2475}, {"x": 0.4724511504173279, "y": 0.784420371055603, "z": -0.1194089874625206, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2475}, {"x": 0.47106537222862244, "y": 0.38973334431648254, "z": -0.040036626160144806, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2475}, {"x": 0.4398595988750458, "y": 0.4967154562473297, "z": -0.08354531973600388, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2475}, {"x": 0.47565460205078125, "y": 0.3848784565925598, "z": -0.0812990814447403, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2475}, {"x": 0.4775395691394806, "y": 0.38426315784454346, "z": -0.08107594400644302, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2475}, {"x": 0.47382333874702454, "y": 0.385258287191391, "z": -0.08140408247709274, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2475}, {"x": 0.47857946157455444, "y": 0.81731778383255, "z": -0.20047630369663239, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2475}, {"x": 0.4702267348766327, "y": 0.8031901121139526, "z": -0.12306908518075943, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2475}, {"x": 0.4658559560775757, "y": 0.5661317110061646, "z": -0.044907767325639725, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2475}, {"x": 0.4688754081726074, "y": 0.5715311765670776, "z": -0.1608341634273529, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2475}, {"x": 0.4706821143627167, "y": 0.6722398400306702, "z": -0.1107969731092453, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2475}, {"x": 0.46420174837112427, "y": 0.5759075880050659, "z": -0.16037103533744812, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2475}, {"x": 0.459521621465683, "y": 0.4331139028072357, "z": -0.047852762043476105, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2475}, {"x": 0.46849319338798523, "y": 0.5661244988441467, "z": -0.13806743919849396, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2475}, {"x": 0.46172401309013367, "y": 0.5566705465316772, "z": -0.13750042021274567, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2475}, {"x": 0.4746832251548767, "y": 0.5791010856628418, "z": -0.1397884211037308, "name": "INDEX_FINGER_DIP", "type": "right_hand", "index": 7, "frame_index": 2475}, {"x": 0.4696100354194641, "y": 0.5690783858299255, "z": -0.13755071070772829, "name": "INDEX_FINGER_MCP", "type": "right_hand", "index": 5, "frame_index": 2475}, {"x": 0.47291287779808044, "y": 0.5752200484275818, "z": -0.1386965410783887, "name": "INDEX_FINGER_PIP", "type": "right_hand", "index": 6, "frame_index": 2475}, {"x": 0.4760749042034149, "y": 0.5824962854385376, "z": -0.14060350507497787, "name": "INDEX_FINGER_TIP", "type": "right_hand", "index": 8, "frame_index": 2475}, {"x": 0.47299817204475403, "y": 0.5832362771034241, "z": -0.14013566356152296, "name": "MIDDLE_FINGER_DIP", "type": "right_hand", "index": 11, "frame_index": 2475}, {"x": 0.46772301197052, "y": 0.5725299715995789, "z": -0.13808966608485207, "name": "MIDDLE_FINGER_MCP", "type": "right_hand", "index": 9, "frame_index": 2475}, {"x": 0.4710526168346405, "y": 0.5790671110153198, "z": -0.1390965370228514, "name": "MIDDLE_FINGER_PIP", "type": "right_hand", "index": 10, "frame_index": 2475}, {"x": 0.47459807991981506, "y": 0.5869462490081787, "z": -0.1408845887053758, "name": "MIDDLE_FINGER_TIP", "type": "right_hand", "index": 12, "frame_index": 2475}, {"x": 0.4655616283416748, "y": 0.5847783088684082, "z": -0.1408318446483463, "name": "PINKY_DIP", "type": "right_hand", "index": 19, "frame_index": 2475}, {"x": 0.46210163831710815, "y": 0.575588583946228, "z": -0.13976314384490252, "name": "PINKY_MCP", "type": "right_hand", "index": 17, "frame_index": 2475}, {"x": 0.46410349011421204, "y": 0.5812951326370239, "z": -0.14070668863132596, "name": "PINKY_PIP", "type": "right_hand", "index": 18, "frame_index": 2475}, {"x": 0.46696335077285767, "y": 0.5877077579498291, "z": -0.14084168546833098, "name": "PINKY_TIP", "type": "right_hand", "index": 20, "frame_index": 2475}, {"x": 0.47025492787361145, "y": 0.5854241847991943, "z": -0.14057917660102248, "name": "RING_FINGER_DIP", "type": "right_hand", "index": 15, "frame_index": 2475}, {"x": 0.4652343988418579, "y": 0.5746849775314331, "z": -0.13887239480391145, "name": "RING_FINGER_MCP", "type": "right_hand", "index": 13, "frame_index": 2475}, {"x": 0.4683133065700531, "y": 0.5812329649925232, "z": -0.13998976652510464, "name": "RING_FINGER_PIP", "type": "right_hand", "index": 14, "frame_index": 2475}, {"x": 0.4719190299510956, "y": 0.5890734791755676, "z": -0.14096080558374524, "name": "RING_FINGER_TIP", "type": "right_hand", "index": 16, "frame_index": 2475}, {"x": 0.46417394280433655, "y": 0.5563556551933289, "z": -0.13837469212012365, "name": "THUMB_CMC", "type": "right_hand", "index": 1, "frame_index": 2475}, {"x": 0.47216713428497314, "y": 0.5632485151290894, "z": -0.1394017537822947, "name": "THUMB_IP", "type": "right_hand", "index": 3, "frame_index": 2475}, {"x": 0.46899136900901794, "y": 0.5597094893455505, "z": -0.13884938380215317, "name": "THUMB_MCP", "type": "right_hand", "index": 2, "frame_index": 2475}, {"x": 0.4743940830230713, "y": 0.5668299198150635, "z": -0.13993679452687502, "name": "THUMB_TIP", "type": "right_hand", "index": 4, "frame_index": 2475}, {"x": 0.4590774178504944, "y": 0.5552905797958374, "z": -0.1375004059074536, "name": "WRIST", "type": "right_hand", "index": 0, "frame_index": 2475}], [{"x": 0.47678840160369873, "y": 0.784258246421814, "z": 0.025423161685466766, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2476}, {"x": 0.48947733640670776, "y": 0.38926830887794495, "z": -0.004014258738607168, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2476}, {"x": 0.4837234914302826, "y": 0.5117988586425781, "z": 0.11116746813058853, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2476}, {"x": 0.48636552691459656, "y": 0.38373810052871704, "z": -0.08398254960775375, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2476}, {"x": 0.483948290348053, "y": 0.38366496562957764, "z": -0.08389152586460114, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2476}, {"x": 0.48749610781669617, "y": 0.38396725058555603, "z": -0.08390843123197556, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2476}, {"x": 0.49514278769493103, "y": 0.8114367723464966, "z": -0.049759235233068466, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2476}, {"x": 0.4720810651779175, "y": 0.8040512204170227, "z": 0.022414185106754303, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2476}, {"x": 0.48850372433662415, "y": 0.5696420073509216, "z": 0.04354376345872879, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2476}, {"x": 0.48738232254981995, "y": 0.5752965807914734, "z": 0.04507218673825264, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2476}, {"x": 0.48373672366142273, "y": 0.6774703860282898, "z": 0.013189622201025486, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2476}, {"x": 0.4854067862033844, "y": 0.5818871855735779, "z": 0.06159362941980362, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2476}, {"x": 0.49210232496261597, "y": 0.44775277376174927, "z": 0.07338172942399979, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2476}, {"x": 0.48711034655570984, "y": 0.5686941742897034, "z": 0.06005223095417023, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2476}, {"x": 0.4865318536758423, "y": 0.5566474199295044, "z": 0.06752172112464905, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2476}, {"x": 0.4852098226547241, "y": 0.4019055664539337, "z": -0.06831672787666321, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2476}, {"x": 0.47707507014274597, "y": 0.4018550515174866, "z": -0.08354251086711884, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2476}, {"x": 0.48122966289520264, "y": 0.3922536075115204, "z": -0.0997161790728569, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2476}, {"x": 0.4722258746623993, "y": 0.7845072150230408, "z": -0.10689277201890945, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2476}, {"x": 0.47102582454681396, "y": 0.38885217905044556, "z": -0.05247475206851959, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2476}, {"x": 0.439069002866745, "y": 0.4982559084892273, "z": -0.09148605912923813, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2476}, {"x": 0.4756333529949188, "y": 0.3841250240802765, "z": -0.09486186504364014, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2476}, {"x": 0.477541446685791, "y": 0.38375675678253174, "z": -0.09464330971240997, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2476}, {"x": 0.47379451990127563, "y": 0.38431084156036377, "z": -0.09496719390153885, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2476}, {"x": 0.47767525911331177, "y": 0.8181741833686829, "z": -0.1887972056865692, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2476}, {"x": 0.4699608087539673, "y": 0.8035217523574829, "z": -0.11027368903160095, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2476}, {"x": 0.4658032953739166, "y": 0.5667157173156738, "z": -0.04364906996488571, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2476}, {"x": 0.46642929315567017, "y": 0.5705575346946716, "z": -0.1686698943376541, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2476}, {"x": 0.4701175093650818, "y": 0.6722702980041504, "z": -0.10152236372232437, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2476}, {"x": 0.4617195725440979, "y": 0.5757942795753479, "z": -0.16801698505878448, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2476}, {"x": 0.4582008719444275, "y": 0.43361377716064453, "z": -0.056140825152397156, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2476}, {"x": 0.46619659662246704, "y": 0.5650905966758728, "z": -0.14542126655578613, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2476}, {"x": 0.45891818404197693, "y": 0.5566011071205139, "z": -0.1447194367647171, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2476}, {"x": 0.47318795323371887, "y": 0.5809939503669739, "z": -0.14746639598160982, "name": "INDEX_FINGER_DIP", "type": "right_hand", "index": 7, "frame_index": 2476}, {"x": 0.468658983707428, "y": 0.570600688457489, "z": -0.1448435944330413, "name": "INDEX_FINGER_MCP", "type": "right_hand", "index": 5, "frame_index": 2476}, {"x": 0.4716213345527649, "y": 0.5768691301345825, "z": -0.14619730622507632, "name": "INDEX_FINGER_PIP", "type": "right_hand", "index": 6, "frame_index": 2476}, {"x": 0.47428882122039795, "y": 0.5844904184341431, "z": -0.1483598849736154, "name": "INDEX_FINGER_TIP", "type": "right_hand", "index": 8, "frame_index": 2476}, {"x": 0.4713989794254303, "y": 0.5840412974357605, "z": -0.1474743983708322, "name": "MIDDLE_FINGER_DIP", "type": "right_hand", "index": 11, "frame_index": 2476}, {"x": 0.4665570557117462, "y": 0.5733919143676758, "z": -0.14526246226159856, "name": "MIDDLE_FINGER_MCP", "type": "right_hand", "index": 9, "frame_index": 2476}, {"x": 0.46966245770454407, "y": 0.5798851251602173, "z": -0.14638511661905795, "name": "MIDDLE_FINGER_PIP", "type": "right_hand", "index": 10, "frame_index": 2476}, {"x": 0.4727676808834076, "y": 0.5875641107559204, "z": -0.1482182601466775, "name": "MIDDLE_FINGER_TIP", "type": "right_hand", "index": 12, "frame_index": 2476}, {"x": 0.46444112062454224, "y": 0.5841366052627563, "z": -0.14795663696713746, "name": "PINKY_DIP", "type": "right_hand", "index": 19, "frame_index": 2476}, {"x": 0.4607604146003723, "y": 0.5753525495529175, "z": -0.14688514894805849, "name": "PINKY_MCP", "type": "right_hand", "index": 17, "frame_index": 2476}, {"x": 0.4628828465938568, "y": 0.5807942748069763, "z": -0.14784895558841527, "name": "PINKY_PIP", "type": "right_hand", "index": 18, "frame_index": 2476}, {"x": 0.46594563126564026, "y": 0.5871587991714478, "z": -0.14791258540935814, "name": "PINKY_TIP", "type": "right_hand", "index": 20, "frame_index": 2476}, {"x": 0.4686448574066162, "y": 0.5850330591201782, "z": -0.14755711471661925, "name": "RING_FINGER_DIP", "type": "right_hand", "index": 15, "frame_index": 2476}, {"x": 0.4639611840248108, "y": 0.5749370455741882, "z": -0.14598586107604206, "name": "RING_FINGER_MCP", "type": "right_hand", "index": 13, "frame_index": 2476}, {"x": 0.4668768644332886, "y": 0.5811764001846313, "z": -0.14710353245027363, "name": "RING_FINGER_PIP", "type": "right_hand", "index": 14, "frame_index": 2476}, {"x": 0.4701922833919525, "y": 0.5884349942207336, "z": -0.14781079697422683, "name": "RING_FINGER_TIP", "type": "right_hand", "index": 16, "frame_index": 2476}, {"x": 0.4625155031681061, "y": 0.5569266080856323, "z": -0.14595798775553703, "name": "THUMB_CMC", "type": "right_hand", "index": 1, "frame_index": 2476}, {"x": 0.47020837664604187, "y": 0.5643941760063171, "z": -0.1472767658997327, "name": "THUMB_IP", "type": "right_hand", "index": 3, "frame_index": 2476}, {"x": 0.4671059846878052, "y": 0.5606369376182556, "z": -0.1465986882103607, "name": "THUMB_MCP", "type": "right_hand", "index": 2, "frame_index": 2476}, {"x": 0.472859650850296, "y": 0.5678552985191345, "z": -0.14788807788863778, "name": "THUMB_TIP", "type": "right_hand", "index": 4, "frame_index": 2476}, {"x": 0.4577418565750122, "y": 0.5563151836395264, "z": -0.1447194208202447, "name": "WRIST", "type": "right_hand", "index": 0, "frame_index": 2476}], [{"x": 0.47679513692855835, "y": 0.7843652367591858, "z": 0.029108576476573944, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2477}, {"x": 0.48938480019569397, "y": 0.38974595069885254, "z": -0.008691820316016674, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2477}, {"x": 0.486907422542572, "y": 0.5110726356506348, "z": 0.10550602525472641, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2477}, {"x": 0.4861883223056793, "y": 0.384328693151474, "z": -0.08916052430868149, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2477}, {"x": 0.48365792632102966, "y": 0.3839889168739319, "z": -0.08906848728656769, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2477}, {"x": 0.48747381567955017, "y": 0.38476014137268066, "z": -0.08909444510936737, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2477}, {"x": 0.4951467216014862, "y": 0.8119829297065735, "z": -0.04522249847650528, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2477}, {"x": 0.4721813499927521, "y": 0.8040215969085693, "z": 0.02647298015654087, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2477}, {"x": 0.4890786111354828, "y": 0.570285975933075, "z": 0.0404711477458477, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2477}, {"x": 0.49003738164901733, "y": 0.5656713247299194, "z": 0.03450965881347656, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2477}, {"x": 0.48406165838241577, "y": 0.6783237457275391, "z": 0.013340655714273453, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2477}, {"x": 0.488614022731781, "y": 0.5768836736679077, "z": 0.05068087577819824, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2477}, {"x": 0.49329516291618347, "y": 0.4474201798439026, "z": 0.06789149343967438, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2477}, {"x": 0.48904576897621155, "y": 0.5633103847503662, "z": 0.05055384337902069, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2477}, {"x": 0.48906347155570984, "y": 0.5547049641609192, "z": 0.05798513442277908, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2477}, {"x": 0.48461052775382996, "y": 0.4022057056427002, "z": -0.07331342995166779, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2477}, {"x": 0.47654473781585693, "y": 0.4018124043941498, "z": -0.08804365992546082, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2477}, {"x": 0.4808688759803772, "y": 0.39226698875427246, "z": -0.10491181910037994, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2477}, {"x": 0.47207432985305786, "y": 0.7846059203147888, "z": -0.10099710524082184, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2477}, {"x": 0.47081488370895386, "y": 0.38862165808677673, "z": -0.0560678206384182, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2477}, {"x": 0.4380074441432953, "y": 0.4999661445617676, "z": -0.08440728485584259, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2477}, {"x": 0.47536978125572205, "y": 0.38400688767433167, "z": -0.09966327995061874, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2477}, {"x": 0.4772009551525116, "y": 0.38374125957489014, "z": -0.0994463637471199, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2477}, {"x": 0.4734845459461212, "y": 0.3841075003147125, "z": -0.09976840019226074, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2477}, {"x": 0.47595247626304626, "y": 0.8196057677268982, "z": -0.18523897230625153, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2477}, {"x": 0.4700066149234772, "y": 0.8036004304885864, "z": -0.10413669049739838, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2477}, {"x": 0.46571099758148193, "y": 0.5681426525115967, "z": -0.04057321697473526, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2477}, {"x": 0.4644791781902313, "y": 0.5692301392555237, "z": -0.16718952357769012, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2477}, {"x": 0.4698103070259094, "y": 0.672759473323822, "z": -0.10065032541751862, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2477}, {"x": 0.4604763686656952, "y": 0.575478196144104, "z": -0.1650354564189911, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2477}, {"x": 0.456198126077652, "y": 0.4359654188156128, "z": -0.05505531653761864, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2477}, {"x": 0.46422702074050903, "y": 0.5637617707252502, "z": -0.14292089641094208, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2477}, {"x": 0.45707622170448303, "y": 0.5565429329872131, "z": -0.1415054202079773, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2477}, {"x": 0.47120338678359985, "y": 0.5802793502807617, "z": -0.1433482504216954, "name": "INDEX_FINGER_DIP", "type": "right_hand", "index": 7, "frame_index": 2477}, {"x": 0.46634629368782043, "y": 0.5686712861061096, "z": -0.1413624877895927, "name": "INDEX_FINGER_MCP", "type": "right_hand", "index": 5, "frame_index": 2477}, {"x": 0.4694921374320984, "y": 0.5757272839546204, "z": -0.14239050343167037, "name": "INDEX_FINGER_PIP", "type": "right_hand", "index": 6, "frame_index": 2477}, {"x": 0.4724193513393402, "y": 0.5837500691413879, "z": -0.14397344272583723, "name": "INDEX_FINGER_TIP", "type": "right_hand", "index": 8, "frame_index": 2477}, {"x": 0.4696122109889984, "y": 0.583755612373352, "z": -0.1433895748341456, "name": "MIDDLE_FINGER_DIP", "type": "right_hand", "index": 11, "frame_index": 2477}, {"x": 0.46442723274230957, "y": 0.5719575881958008, "z": -0.1419003312184941, "name": "MIDDLE_FINGER_MCP", "type": "right_hand", "index": 9, "frame_index": 2477}, {"x": 0.46765023469924927, "y": 0.5793017745018005, "z": -0.14262534212321043, "name": "MIDDLE_FINGER_PIP", "type": "right_hand", "index": 10, "frame_index": 2477}, {"x": 0.4712236821651459, "y": 0.5871586799621582, "z": -0.14388339989818633, "name": "MIDDLE_FINGER_TIP", "type": "right_hand", "index": 12, "frame_index": 2477}, {"x": 0.46359777450561523, "y": 0.5850598812103271, "z": -0.14373481506481767, "name": "PINKY_DIP", "type": "right_hand", "index": 19, "frame_index": 2477}, {"x": 0.45927584171295166, "y": 0.5757641792297363, "z": -0.14345869654789567, "name": "PINKY_MCP", "type": "right_hand", "index": 17, "frame_index": 2477}, {"x": 0.4618307948112488, "y": 0.5814977288246155, "z": -0.14392729080282152, "name": "PINKY_PIP", "type": "right_hand", "index": 18, "frame_index": 2477}, {"x": 0.4650351405143738, "y": 0.5879135131835938, "z": -0.14346526307053864, "name": "PINKY_TIP", "type": "right_hand", "index": 20, "frame_index": 2477}, {"x": 0.4674041271209717, "y": 0.5853615403175354, "z": -0.14343720290344208, "name": "RING_FINGER_DIP", "type": "right_hand", "index": 15, "frame_index": 2477}, {"x": 0.46206745505332947, "y": 0.574298620223999, "z": -0.14261653670109808, "name": "RING_FINGER_MCP", "type": "right_hand", "index": 13, "frame_index": 2477}, {"x": 0.4652847647666931, "y": 0.5811315178871155, "z": -0.1432554041966796, "name": "RING_FINGER_PIP", "type": "right_hand", "index": 14, "frame_index": 2477}, {"x": 0.4691469669342041, "y": 0.5886675715446472, "z": -0.1435155759099871, "name": "RING_FINGER_TIP", "type": "right_hand", "index": 16, "frame_index": 2477}, {"x": 0.4608314633369446, "y": 0.5551109313964844, "z": -0.1420879265642725, "name": "THUMB_CMC", "type": "right_hand", "index": 1, "frame_index": 2477}, {"x": 0.46875980496406555, "y": 0.5636781454086304, "z": -0.14290916442405432, "name": "THUMB_IP", "type": "right_hand", "index": 3, "frame_index": 2477}, {"x": 0.46561166644096375, "y": 0.5588656663894653, "z": -0.1424561056192033, "name": "THUMB_MCP", "type": "right_hand", "index": 2, "frame_index": 2477}, {"x": 0.4711822271347046, "y": 0.5678604245185852, "z": -0.14327919576317072, "name": "THUMB_TIP", "type": "right_hand", "index": 4, "frame_index": 2477}, {"x": 0.45559418201446533, "y": 0.5554909110069275, "z": -0.1415054104020843, "name": "WRIST", "type": "right_hand", "index": 0, "frame_index": 2477}], [{"x": 0.4767998456954956, "y": 0.7848284244537354, "z": 0.028599431738257408, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2478}, {"x": 0.48923224210739136, "y": 0.38985535502433777, "z": -0.004777979571372271, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2478}, {"x": 0.4898434579372406, "y": 0.5102946758270264, "z": 0.10437837988138199, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2478}, {"x": 0.48617613315582275, "y": 0.38440021872520447, "z": -0.08541607111692429, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2478}, {"x": 0.48364952206611633, "y": 0.38399848341941833, "z": -0.08532082289457321, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2478}, {"x": 0.48746368288993835, "y": 0.38492393493652344, "z": -0.08535805344581604, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2478}, {"x": 0.4949633479118347, "y": 0.8125665187835693, "z": -0.04543391615152359, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2478}, {"x": 0.47219228744506836, "y": 0.8040317296981812, "z": 0.026128066703677177, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2478}, {"x": 0.48954933881759644, "y": 0.5713198781013489, "z": 0.03984491899609566, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2478}, {"x": 0.4941217303276062, "y": 0.5563861131668091, "z": 0.019334793090820312, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2478}, {"x": 0.4844318926334381, "y": 0.679174542427063, "z": 0.00965757854282856, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2478}, {"x": 0.4937154948711395, "y": 0.5624797940254211, "z": 0.035995326936244965, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2478}, {"x": 0.4935683012008667, "y": 0.44722187519073486, "z": 0.07042599469423294, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2478}, {"x": 0.49324843287467957, "y": 0.5525370240211487, "z": 0.03749747946858406, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2478}, {"x": 0.4929460287094116, "y": 0.549588143825531, "z": 0.045427728444337845, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2478}, {"x": 0.4843064546585083, "y": 0.402209609746933, "z": -0.06983164697885513, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2478}, {"x": 0.4763447940349579, "y": 0.4013656675815582, "z": -0.0851258710026741, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2478}, {"x": 0.48089176416397095, "y": 0.3921786844730377, "z": -0.10138407349586487, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2478}, {"x": 0.47204849123954773, "y": 0.7846288681030273, "z": -0.11064735054969788, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2478}, {"x": 0.4707328975200653, "y": 0.3878571689128876, "z": -0.05467420443892479, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2478}, {"x": 0.43761521577835083, "y": 0.5013338923454285, "z": -0.07902027666568756, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2478}, {"x": 0.47539621591567993, "y": 0.38369324803352356, "z": -0.09633993357419968, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2478}, {"x": 0.47722285985946655, "y": 0.38353630900382996, "z": -0.09613073617219925, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2478}, {"x": 0.4735383689403534, "y": 0.38367894291877747, "z": -0.09643509984016418, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2478}, {"x": 0.4751611649990082, "y": 0.8208960890769958, "z": -0.19397816061973572, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2478}, {"x": 0.4698505401611328, "y": 0.803608238697052, "z": -0.11385640501976013, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2478}, {"x": 0.4656536281108856, "y": 0.5694988965988159, "z": -0.039949990808963776, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2478}, {"x": 0.46343716979026794, "y": 0.5679901838302612, "z": -0.16663099825382233, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2478}, {"x": 0.4695034325122833, "y": 0.6729756593704224, "z": -0.10914357751607895, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2478}, {"x": 0.46006539463996887, "y": 0.5750977396965027, "z": -0.16310283541679382, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2478}, {"x": 0.4546174108982086, "y": 0.4370787739753723, "z": -0.051093973219394684, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2478}, {"x": 0.4629908502101898, "y": 0.5625558495521545, "z": -0.1413048654794693, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2478}, {"x": 0.4556894898414612, "y": 0.5565091371536255, "z": -0.13921508193016052, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2478}, {"x": 0.4703530967235565, "y": 0.5805326700210571, "z": -0.14036380511242896, "name": "INDEX_FINGER_DIP", "type": "right_hand", "index": 7, "frame_index": 2478}, {"x": 0.46528360247612, "y": 0.569794237613678, "z": -0.13851367321331054, "name": "INDEX_FINGER_MCP", "type": "right_hand", "index": 5, "frame_index": 2478}, {"x": 0.4685191512107849, "y": 0.5762383341789246, "z": -0.13941028442059178, "name": "INDEX_FINGER_PIP", "type": "right_hand", "index": 6, "frame_index": 2478}, {"x": 0.47176527976989746, "y": 0.5838752388954163, "z": -0.14102371968328953, "name": "INDEX_FINGER_TIP", "type": "right_hand", "index": 8, "frame_index": 2478}, {"x": 0.4686692953109741, "y": 0.5835160613059998, "z": -0.1405998523114249, "name": "MIDDLE_FINGER_DIP", "type": "right_hand", "index": 11, "frame_index": 2478}, {"x": 0.46346697211265564, "y": 0.5732851028442383, "z": -0.13914451227901736, "name": "MIDDLE_FINGER_MCP", "type": "right_hand", "index": 9, "frame_index": 2478}, {"x": 0.4667151868343353, "y": 0.5796521902084351, "z": -0.13977225811686367, "name": "MIDDLE_FINGER_PIP", "type": "right_hand", "index": 10, "frame_index": 2478}, {"x": 0.4703534245491028, "y": 0.5866360664367676, "z": -0.14117155596613884, "name": "MIDDLE_FINGER_TIP", "type": "right_hand", "index": 12, "frame_index": 2478}, {"x": 0.4628494083881378, "y": 0.5856468677520752, "z": -0.141003955504857, "name": "PINKY_DIP", "type": "right_hand", "index": 19, "frame_index": 2478}, {"x": 0.4586678743362427, "y": 0.5772919058799744, "z": -0.14086016186047345, "name": "PINKY_MCP", "type": "right_hand", "index": 17, "frame_index": 2478}, {"x": 0.4611395597457886, "y": 0.5825402140617371, "z": -0.14121456653811038, "name": "PINKY_PIP", "type": "right_hand", "index": 18, "frame_index": 2478}, {"x": 0.4643484055995941, "y": 0.5882236957550049, "z": -0.14076156541705132, "name": "PINKY_TIP", "type": "right_hand", "index": 20, "frame_index": 2478}, {"x": 0.4664923846721649, "y": 0.5854963064193726, "z": -0.14065784076228738, "name": "RING_FINGER_DIP", "type": "right_hand", "index": 15, "frame_index": 2478}, {"x": 0.461298406124115, "y": 0.5757753849029541, "z": -0.13994784007081762, "name": "RING_FINGER_MCP", "type": "right_hand", "index": 13, "frame_index": 2478}, {"x": 0.4644547402858734, "y": 0.5819211006164551, "z": -0.1404713517986238, "name": "RING_FINGER_PIP", "type": "right_hand", "index": 14, "frame_index": 2478}, {"x": 0.468250572681427, "y": 0.588435709476471, "z": -0.1407824541674927, "name": "RING_FINGER_TIP", "type": "right_hand", "index": 16, "frame_index": 2478}, {"x": 0.4602796137332916, "y": 0.5565957427024841, "z": -0.13949249181314372, "name": "THUMB_CMC", "type": "right_hand", "index": 1, "frame_index": 2478}, {"x": 0.4682754874229431, "y": 0.5646252632141113, "z": -0.13998886034823954, "name": "THUMB_IP", "type": "right_hand", "index": 3, "frame_index": 2478}, {"x": 0.46520233154296875, "y": 0.5601654052734375, "z": -0.1396579209540505, "name": "THUMB_MCP", "type": "right_hand", "index": 2, "frame_index": 2478}, {"x": 0.4708283841609955, "y": 0.5682167410850525, "z": -0.14025907986797392, "name": "THUMB_TIP", "type": "right_hand", "index": 4, "frame_index": 2478}, {"x": 0.4545985758304596, "y": 0.5567935109138489, "z": -0.1392150727025463, "name": "WRIST", "type": "right_hand", "index": 0, "frame_index": 2478}], [{"x": 0.47683241963386536, "y": 0.7849991321563721, "z": 0.03983369842171669, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2479}, {"x": 0.48910292983055115, "y": 0.39030691981315613, "z": -0.008866866119205952, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2479}, {"x": 0.49182870984077454, "y": 0.5105204582214355, "z": 0.08593833446502686, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2479}, {"x": 0.4861035645008087, "y": 0.3846569061279297, "z": -0.08784099668264389, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2479}, {"x": 0.4835831820964813, "y": 0.38410159945487976, "z": -0.0877424031496048, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2479}, {"x": 0.48744311928749084, "y": 0.38528621196746826, "z": -0.08778552711009979, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2479}, {"x": 0.4948534071445465, "y": 0.812870442867279, "z": -0.031110724434256554, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2479}, {"x": 0.4724677801132202, "y": 0.8039929270744324, "z": 0.03873511031270027, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2479}, {"x": 0.48994600772857666, "y": 0.571336030960083, "z": 0.032756462693214417, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2479}, {"x": 0.49415895342826843, "y": 0.5589461326599121, "z": -0.005359669681638479, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2479}, {"x": 0.48466920852661133, "y": 0.6798263192176819, "z": 0.009085367433726788, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2479}, {"x": 0.49396470189094543, "y": 0.5628407001495361, "z": 0.01094771921634674, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2479}, {"x": 0.49451377987861633, "y": 0.447183221578598, "z": 0.059612393379211426, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2479}, {"x": 0.49374252557754517, "y": 0.5528973340988159, "z": 0.014686853624880314, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2479}, {"x": 0.49318090081214905, "y": 0.5520145297050476, "z": 0.022557534277439117, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2479}, {"x": 0.4840668737888336, "y": 0.40228384733200073, "z": -0.07249758392572403, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2479}, {"x": 0.4762410819530487, "y": 0.40134504437446594, "z": -0.08578252047300339, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2479}, {"x": 0.48079347610473633, "y": 0.39218658208847046, "z": -0.10336162894964218, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2479}, {"x": 0.47203484177589417, "y": 0.7847662568092346, "z": -0.08221451938152313, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2479}, {"x": 0.47058001160621643, "y": 0.3876148462295532, "z": -0.05386245623230934, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2479}, {"x": 0.43698909878730774, "y": 0.50403892993927, "z": -0.06628473848104477, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2479}, {"x": 0.47534215450286865, "y": 0.38361459970474243, "z": -0.09722471237182617, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2479}, {"x": 0.4771791696548462, "y": 0.3835057020187378, "z": -0.09702016413211823, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2479}, {"x": 0.47350943088531494, "y": 0.38355597853660583, "z": -0.0973193347454071, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2479}, {"x": 0.4727412760257721, "y": 0.8230292201042175, "z": -0.16399583220481873, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2479}, {"x": 0.46989428997039795, "y": 0.8033792972564697, "z": -0.08405110239982605, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2479}, {"x": 0.4656045138835907, "y": 0.5698437094688416, "z": -0.032863419502973557, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2479}, {"x": 0.4627479314804077, "y": 0.5677793622016907, "z": -0.15962032973766327, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2479}, {"x": 0.4691934287548065, "y": 0.6736829280853271, "z": -0.09636350721120834, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2479}, {"x": 0.4594968259334564, "y": 0.5750634074211121, "z": -0.15492023527622223, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2479}, {"x": 0.453485369682312, "y": 0.439863383769989, "z": -0.04201216250658035, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2479}, {"x": 0.462327778339386, "y": 0.5624364614486694, "z": -0.1333640068769455, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2479}, {"x": 0.4549342393875122, "y": 0.5566819906234741, "z": -0.13060548901557922, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2479}, {"x": 0.46970564126968384, "y": 0.5830625891685486, "z": -0.13388202898204327, "name": "INDEX_FINGER_DIP", "type": "right_hand", "index": 7, "frame_index": 2479}, {"x": 0.46481573581695557, "y": 0.5733794569969177, "z": -0.1312327131163329, "name": "INDEX_FINGER_MCP", "type": "right_hand", "index": 5, "frame_index": 2479}, {"x": 0.4677431285381317, "y": 0.5792398452758789, "z": -0.13261120580136776, "name": "INDEX_FINGER_PIP", "type": "right_hand", "index": 6, "frame_index": 2479}, {"x": 0.47120922803878784, "y": 0.58603835105896, "z": -0.1348181744106114, "name": "INDEX_FINGER_TIP", "type": "right_hand", "index": 8, "frame_index": 2479}, {"x": 0.4679219126701355, "y": 0.586058497428894, "z": -0.13435965590178967, "name": "MIDDLE_FINGER_DIP", "type": "right_hand", "index": 11, "frame_index": 2479}, {"x": 0.4623434245586395, "y": 0.5760520696640015, "z": -0.13197297975420952, "name": "MIDDLE_FINGER_MCP", "type": "right_hand", "index": 9, "frame_index": 2479}, {"x": 0.4656199514865875, "y": 0.5825693607330322, "z": -0.1331243459135294, "name": "MIDDLE_FINGER_PIP", "type": "right_hand", "index": 10, "frame_index": 2479}, {"x": 0.46989861130714417, "y": 0.5886328816413879, "z": -0.13521852623671293, "name": "MIDDLE_FINGER_TIP", "type": "right_hand", "index": 12, "frame_index": 2479}, {"x": 0.4567236304283142, "y": 0.5844094157218933, "z": -0.13562964787706733, "name": "PINKY_DIP", "type": "right_hand", "index": 19, "frame_index": 2479}, {"x": 0.4556083679199219, "y": 0.5757531523704529, "z": -0.13393518258817494, "name": "PINKY_MCP", "type": "right_hand", "index": 17, "frame_index": 2479}, {"x": 0.4561198651790619, "y": 0.5810036659240723, "z": -0.13528786646202207, "name": "PINKY_PIP", "type": "right_hand", "index": 18, "frame_index": 2479}, {"x": 0.45738595724105835, "y": 0.5874292850494385, "z": -0.13575432263314724, "name": "PINKY_TIP", "type": "right_hand", "index": 20, "frame_index": 2479}, {"x": 0.4642600119113922, "y": 0.5864282250404358, "z": -0.13505396014079452, "name": "RING_FINGER_DIP", "type": "right_hand", "index": 15, "frame_index": 2479}, {"x": 0.45926252007484436, "y": 0.5768599510192871, "z": -0.132910423213616, "name": "RING_FINGER_MCP", "type": "right_hand", "index": 13, "frame_index": 2479}, {"x": 0.4620141386985779, "y": 0.5830814242362976, "z": -0.13424174417741597, "name": "RING_FINGER_PIP", "type": "right_hand", "index": 14, "frame_index": 2479}, {"x": 0.4663388133049011, "y": 0.5893303155899048, "z": -0.13562262384220958, "name": "RING_FINGER_TIP", "type": "right_hand", "index": 16, "frame_index": 2479}, {"x": 0.4596264660358429, "y": 0.5581105351448059, "z": -0.13154564937576652, "name": "THUMB_CMC", "type": "right_hand", "index": 1, "frame_index": 2479}, {"x": 0.4672333002090454, "y": 0.5651807188987732, "z": -0.13268607342615724, "name": "THUMB_IP", "type": "right_hand", "index": 3, "frame_index": 2479}, {"x": 0.46427878737449646, "y": 0.5615597367286682, "z": -0.13209528755396605, "name": "THUMB_MCP", "type": "right_hand", "index": 2, "frame_index": 2479}, {"x": 0.4698858857154846, "y": 0.568043053150177, "z": -0.13330958457663655, "name": "THUMB_TIP", "type": "right_hand", "index": 4, "frame_index": 2479}, {"x": 0.45437195897102356, "y": 0.5579126477241516, "z": -0.13060546629544056, "name": "WRIST", "type": "right_hand", "index": 0, "frame_index": 2479}], [{"x": 0.4769756495952606, "y": 0.7852470278739929, "z": 0.06382198631763458, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2480}, {"x": 0.48902490735054016, "y": 0.39059144258499146, "z": -0.021367302164435387, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2480}, {"x": 0.4916020333766937, "y": 0.5165450572967529, "z": 0.07683244347572327, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2480}, {"x": 0.4860977828502655, "y": 0.38497355580329895, "z": -0.09968505054712296, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2480}, {"x": 0.4835922122001648, "y": 0.38425177335739136, "z": -0.09957843273878098, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2480}, {"x": 0.4874348044395447, "y": 0.38565880060195923, "z": -0.09962878376245499, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2480}, {"x": 0.4948403537273407, "y": 0.8129643797874451, "z": -0.006431388668715954, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2480}, {"x": 0.4729475975036621, "y": 0.8033030033111572, "z": 0.0640951618552208, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2480}, {"x": 0.4905444085597992, "y": 0.5714377164840698, "z": 0.03161837160587311, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2480}, {"x": 0.4933459162712097, "y": 0.5754846930503845, "z": -0.004574227146804333, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2480}, {"x": 0.4847988784313202, "y": 0.6808195114135742, "z": 0.015030981972813606, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2480}, {"x": 0.49281075596809387, "y": 0.5759214758872986, "z": 0.012361874803900719, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2480}, {"x": 0.49462223052978516, "y": 0.44800689816474915, "z": 0.04614029452204704, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2480}, {"x": 0.492969810962677, "y": 0.5701183676719666, "z": 0.014843402430415154, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2480}, {"x": 0.4923454821109772, "y": 0.5627803206443787, "z": 0.022679533809423447, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2480}, {"x": 0.4838963747024536, "y": 0.4025207757949829, "z": -0.08423075079917908, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2480}, {"x": 0.4761274755001068, "y": 0.4013439118862152, "z": -0.09741786122322083, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2480}, {"x": 0.4807946979999542, "y": 0.39220574498176575, "z": -0.11487043648958206, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2480}, {"x": 0.4713369905948639, "y": 0.7850887179374695, "z": -0.07331276684999466, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2480}, {"x": 0.4705784022808075, "y": 0.3872106075286865, "z": -0.06387393921613693, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2480}, {"x": 0.43718308210372925, "y": 0.5067122578620911, "z": -0.07937871664762497, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2480}, {"x": 0.47535404562950134, "y": 0.38352906703948975, "z": -0.10890987515449524, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2480}, {"x": 0.47723808884620667, "y": 0.3834790289402008, "z": -0.10870912671089172, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2480}, {"x": 0.4735695421695709, "y": 0.383417010307312, "z": -0.10900972783565521, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2480}, {"x": 0.4703122675418854, "y": 0.8252485990524292, "z": -0.15625013411045074, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2480}, {"x": 0.4697950780391693, "y": 0.8026725053787231, "z": -0.07394876331090927, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2480}, {"x": 0.46563977003097534, "y": 0.5706769227981567, "z": -0.03171714395284653, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2480}, {"x": 0.4619496762752533, "y": 0.5686395764350891, "z": -0.1755623072385788, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2480}, {"x": 0.4687301814556122, "y": 0.6747087836265564, "z": -0.09878701716661453, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2480}, {"x": 0.45867428183555603, "y": 0.5758084058761597, "z": -0.1693536639213562, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2480}, {"x": 0.4523521661758423, "y": 0.4412834644317627, "z": -0.04816034808754921, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2480}, {"x": 0.46139463782310486, "y": 0.5632369518280029, "z": -0.14669738709926605, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2480}, {"x": 0.4537076950073242, "y": 0.5582948923110962, "z": -0.14211736619472504, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2480}, {"x": 0.46966004371643066, "y": 0.5828249454498291, "z": -0.14426184026524425, "name": "INDEX_FINGER_DIP", "type": "right_hand", "index": 7, "frame_index": 2480}, {"x": 0.4642907381057739, "y": 0.5746510624885559, "z": -0.1421211071512971, "name": "INDEX_FINGER_MCP", "type": "right_hand", "index": 5, "frame_index": 2480}, {"x": 0.4677852988243103, "y": 0.5796539187431335, "z": -0.1431993436999619, "name": "INDEX_FINGER_PIP", "type": "right_hand", "index": 6, "frame_index": 2480}, {"x": 0.47117990255355835, "y": 0.5853551626205444, "z": -0.14500517374835908, "name": "INDEX_FINGER_TIP", "type": "right_hand", "index": 8, "frame_index": 2480}, {"x": 0.4681923985481262, "y": 0.5863465070724487, "z": -0.14394369104411453, "name": "MIDDLE_FINGER_DIP", "type": "right_hand", "index": 11, "frame_index": 2480}, {"x": 0.46272391080856323, "y": 0.5781893134117126, "z": -0.14240970902028494, "name": "MIDDLE_FINGER_MCP", "type": "right_hand", "index": 9, "frame_index": 2480}, {"x": 0.46616071462631226, "y": 0.5835668444633484, "z": -0.14320095698349178, "name": "MIDDLE_FINGER_PIP", "type": "right_hand", "index": 10, "frame_index": 2480}, {"x": 0.46992647647857666, "y": 0.5883994102478027, "z": -0.1444381601177156, "name": "MIDDLE_FINGER_TIP", "type": "right_hand", "index": 12, "frame_index": 2480}, {"x": 0.4620996117591858, "y": 0.588352382183075, "z": -0.14406050078105181, "name": "PINKY_DIP", "type": "right_hand", "index": 19, "frame_index": 2480}, {"x": 0.4580792188644409, "y": 0.58186936378479, "z": -0.14366699859965593, "name": "PINKY_MCP", "type": "right_hand", "index": 17, "frame_index": 2480}, {"x": 0.4604986906051636, "y": 0.586177408695221, "z": -0.14420098718255758, "name": "PINKY_PIP", "type": "right_hand", "index": 18, "frame_index": 2480}, {"x": 0.4634888172149658, "y": 0.5901435613632202, "z": -0.14384741033427417, "name": "PINKY_TIP", "type": "right_hand", "index": 20, "frame_index": 2480}, {"x": 0.46602359414100647, "y": 0.5882038474082947, "z": -0.1438771567773074, "name": "RING_FINGER_DIP", "type": "right_hand", "index": 15, "frame_index": 2480}, {"x": 0.4606643319129944, "y": 0.5805265307426453, "z": -0.14295771776232868, "name": "RING_FINGER_MCP", "type": "right_hand", "index": 13, "frame_index": 2480}, {"x": 0.46391141414642334, "y": 0.5855333209037781, "z": -0.14368585613556206, "name": "RING_FINGER_PIP", "type": "right_hand", "index": 14, "frame_index": 2480}, {"x": 0.46779948472976685, "y": 0.5902478694915771, "z": -0.1439664145000279, "name": "RING_FINGER_TIP", "type": "right_hand", "index": 16, "frame_index": 2480}, {"x": 0.457644522190094, "y": 0.5618050694465637, "z": -0.14311455201823264, "name": "THUMB_CMC", "type": "right_hand", "index": 1, "frame_index": 2480}, {"x": 0.4660670757293701, "y": 0.5662468075752258, "z": -0.1442399846855551, "name": "THUMB_IP", "type": "right_hand", "index": 3, "frame_index": 2480}, {"x": 0.46264946460723877, "y": 0.5633105635643005, "z": -0.1436741838697344, "name": "THUMB_MCP", "type": "right_hand", "index": 2, "frame_index": 2480}, {"x": 0.46868976950645447, "y": 0.5694374442100525, "z": -0.14469933998771012, "name": "THUMB_TIP", "type": "right_hand", "index": 4, "frame_index": 2480}, {"x": 0.4524848461151123, "y": 0.5632811784744263, "z": -0.142117358493846, "name": "WRIST", "type": "right_hand", "index": 0, "frame_index": 2480}], [{"x": 0.477007120847702, "y": 0.7852270603179932, "z": 0.06986808031797409, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2481}, {"x": 0.48896732926368713, "y": 0.39180925488471985, "z": -0.046709705144166946, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2481}, {"x": 0.494225412607193, "y": 0.5192021131515503, "z": 0.05329984799027443, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2481}, {"x": 0.48609402775764465, "y": 0.38582661747932434, "z": -0.12563402950763702, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2481}, {"x": 0.4836057424545288, "y": 0.38475391268730164, "z": -0.12551763653755188, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2481}, {"x": 0.48743268847465515, "y": 0.38666197657585144, "z": -0.12558718025684357, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2481}, {"x": 0.4942023456096649, "y": 0.813101053237915, "z": -0.004480547271668911, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2481}, {"x": 0.4729490280151367, "y": 0.802980363368988, "z": 0.07024533301591873, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2481}, {"x": 0.491099089384079, "y": 0.5714882016181946, "z": 0.02895156480371952, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2481}, {"x": 0.49417299032211304, "y": 0.5824534893035889, "z": -0.030656427145004272, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2481}, {"x": 0.48490676283836365, "y": 0.6814779043197632, "z": 0.018009662628173828, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2481}, {"x": 0.4938347637653351, "y": 0.5814307928085327, "z": -0.013073435053229332, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2481}, {"x": 0.4950394928455353, "y": 0.4491416811943054, "z": 0.021601198241114616, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2481}, {"x": 0.49381086230278015, "y": 0.5773561000823975, "z": -0.009425762109458447, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2481}, {"x": 0.49308955669403076, "y": 0.5675660967826843, "z": -0.0013813612749800086, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2481}, {"x": 0.4835816025733948, "y": 0.40302711725234985, "z": -0.10923247039318085, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2481}, {"x": 0.4755791127681732, "y": 0.40132787823677063, "z": -0.12142495065927505, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2481}, {"x": 0.4807366728782654, "y": 0.3922324776649475, "z": -0.14025476574897766, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2481}, {"x": 0.4704364240169525, "y": 0.7861350774765015, "z": -0.07386347651481628, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2481}, {"x": 0.47052085399627686, "y": 0.38682857155799866, "z": -0.0856470838189125, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2481}, {"x": 0.43825215101242065, "y": 0.5105904340744019, "z": -0.08397907763719559, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2481}, {"x": 0.47537556290626526, "y": 0.3834761381149292, "z": -0.13405843079090118, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2481}, {"x": 0.4773038923740387, "y": 0.3834777772426605, "z": -0.1338619738817215, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2481}, {"x": 0.4736217260360718, "y": 0.38331589102745056, "z": -0.1341562271118164, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2481}, {"x": 0.4703734219074249, "y": 0.8264862895011902, "z": -0.16328687965869904, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2481}, {"x": 0.4694838225841522, "y": 0.8027769923210144, "z": -0.07508952915668488, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2481}, {"x": 0.4656148850917816, "y": 0.5711785554885864, "z": -0.02904478833079338, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2481}, {"x": 0.46136680245399475, "y": 0.5743802785873413, "z": -0.18616703152656555, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2481}, {"x": 0.46807241439819336, "y": 0.6752085089683533, "z": -0.09749791771173477, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2481}, {"x": 0.4579533040523529, "y": 0.5793313980102539, "z": -0.17889820039272308, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2481}, {"x": 0.45092758536338806, "y": 0.4429904818534851, "z": -0.06274505704641342, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2481}, {"x": 0.4609648585319519, "y": 0.568557858467102, "z": -0.15677867829799652, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2481}, {"x": 0.4535635709762573, "y": 0.5619704723358154, "z": -0.15209592878818512, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2481}], [{"x": 0.47718939185142517, "y": 0.7849451303482056, "z": 0.08649998158216476, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2482}, {"x": 0.48902687430381775, "y": 0.3930853605270386, "z": -0.06432763487100601, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2482}, {"x": 0.49532967805862427, "y": 0.5212587714195251, "z": 0.03991271182894707, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2482}, {"x": 0.48612430691719055, "y": 0.3867816925048828, "z": -0.14422455430030823, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2482}, {"x": 0.4837431311607361, "y": 0.385550320148468, "z": -0.1441051959991455, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2482}, {"x": 0.4876422882080078, "y": 0.3877982497215271, "z": -0.14417794346809387, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2482}, {"x": 0.4940928518772125, "y": 0.8130248188972473, "z": 0.012182735837996006, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2482}, {"x": 0.47322002053260803, "y": 0.8020737171173096, "z": 0.08784229308366776, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2482}, {"x": 0.4911307394504547, "y": 0.5714774131774902, "z": 0.028826264664530754, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2482}, {"x": 0.49443185329437256, "y": 0.5900564193725586, "z": -0.04657088965177536, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2482}, {"x": 0.48508813977241516, "y": 0.6816012859344482, "z": 0.02451692335307598, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2482}, {"x": 0.49408215284347534, "y": 0.5884808301925659, "z": -0.028583552688360214, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2482}, {"x": 0.4951460659503937, "y": 0.4496197998523712, "z": 0.006719238590449095, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2482}, {"x": 0.49418750405311584, "y": 0.5858851671218872, "z": -0.02431866154074669, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2482}, {"x": 0.49341660737991333, "y": 0.5736983418464661, "z": -0.016142049804329872, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2482}, {"x": 0.48349371552467346, "y": 0.4038514196872711, "z": -0.12702879309654236, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2482}, {"x": 0.47540128231048584, "y": 0.40143051743507385, "z": -0.13923043012619019, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2482}, {"x": 0.4807884097099304, "y": 0.39253315329551697, "z": -0.15858587622642517, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2482}, {"x": 0.46962183713912964, "y": 0.7871254086494446, "z": -0.07261515408754349, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2482}, {"x": 0.47054141759872437, "y": 0.3868339955806732, "z": -0.10331442207098007, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2482}, {"x": 0.4388735890388489, "y": 0.5138809680938721, "z": -0.09067081660032272, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2482}, {"x": 0.4754191040992737, "y": 0.3835239112377167, "z": -0.15261554718017578, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2482}, {"x": 0.47731903195381165, "y": 0.3836117386817932, "z": -0.15242061018943787, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2482}, {"x": 0.473666250705719, "y": 0.38334909081459045, "z": -0.1527087241411209, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2482}, {"x": 0.470377117395401, "y": 0.8261792063713074, "z": -0.16565562784671783, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2482}, {"x": 0.4691198170185089, "y": 0.8030586242675781, "z": -0.07401885092258453, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2482}, {"x": 0.46538135409355164, "y": 0.5714925527572632, "z": -0.028919240459799767, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2482}, {"x": 0.4606783986091614, "y": 0.5825969576835632, "z": -0.1928364783525467, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2482}, {"x": 0.4677295982837677, "y": 0.675906777381897, "z": -0.09630715101957321, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2482}, {"x": 0.45695096254348755, "y": 0.5859812498092651, "z": -0.18485696613788605, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2482}, {"x": 0.45061591267585754, "y": 0.4442710280418396, "z": -0.07828526943922043, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2482}, {"x": 0.46069395542144775, "y": 0.5776786208152771, "z": -0.16305208206176758, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2482}, {"x": 0.4529542326927185, "y": 0.5696306824684143, "z": -0.15852554142475128, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2482}], [{"x": 0.4773328900337219, "y": 0.7839030623435974, "z": 0.07344348728656769, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2483}, {"x": 0.48900917172431946, "y": 0.39436933398246765, "z": -0.0515521764755249, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2483}, {"x": 0.497835248708725, "y": 0.5204803347587585, "z": 0.05068369209766388, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2483}, {"x": 0.4861986041069031, "y": 0.387622594833374, "z": -0.1312459409236908, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2483}, {"x": 0.4839140474796295, "y": 0.38616466522216797, "z": -0.1311323344707489, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2483}, {"x": 0.48782843351364136, "y": 0.3888927698135376, "z": -0.1311997026205063, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2483}, {"x": 0.49324995279312134, "y": 0.8126088380813599, "z": -0.00115953607019037, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2483}, {"x": 0.47330576181411743, "y": 0.8007169365882874, "z": 0.07399056851863861, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2483}, {"x": 0.4911235272884369, "y": 0.5714578628540039, "z": 0.0288532804697752, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2483}, {"x": 0.4963480830192566, "y": 0.5900296568870544, "z": -0.037355296313762665, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2483}, {"x": 0.4858385920524597, "y": 0.6812714338302612, "z": 0.02279951609671116, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2483}, {"x": 0.496211975812912, "y": 0.5885226130485535, "z": -0.01953238435089588, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2483}, {"x": 0.4955245852470398, "y": 0.44973689317703247, "z": 0.01855410262942314, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2483}, {"x": 0.49623027443885803, "y": 0.5849813222885132, "z": -0.015452294610440731, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2483}, {"x": 0.4968509078025818, "y": 0.5720185041427612, "z": -0.007325512357056141, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2483}, {"x": 0.4834214746952057, "y": 0.4042382538318634, "z": -0.11480720341205597, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2483}, {"x": 0.47532549500465393, "y": 0.4014163315296173, "z": -0.12697909772396088, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2483}, {"x": 0.4808206260204315, "y": 0.3925958275794983, "z": -0.14607052505016327, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2483}, {"x": 0.46837514638900757, "y": 0.7883763313293457, "z": -0.0774732381105423, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2483}, {"x": 0.4705546200275421, "y": 0.3868393301963806, "z": -0.0905969887971878, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2483}, {"x": 0.43901196122169495, "y": 0.5148208141326904, "z": -0.08570678532123566, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2483}, {"x": 0.47548437118530273, "y": 0.3835254907608032, "z": -0.13963793218135834, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2483}, {"x": 0.47747930884361267, "y": 0.38363319635391235, "z": -0.13944268226623535, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2483}, {"x": 0.47369450330734253, "y": 0.3833545744419098, "z": -0.13973011076450348, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2483}, {"x": 0.46987631916999817, "y": 0.8259692192077637, "z": -0.17099176347255707, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2483}, {"x": 0.46833536028862, "y": 0.8038517236709595, "z": -0.07954881340265274, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2483}, {"x": 0.4651729166507721, "y": 0.57157301902771, "z": -0.02896004542708397, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2483}, {"x": 0.4605867266654968, "y": 0.586068332195282, "z": -0.18774978816509247, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2483}, {"x": 0.4673692584037781, "y": 0.6765323877334595, "z": -0.0948411077260971, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2483}, {"x": 0.4566415250301361, "y": 0.5891290903091431, "z": -0.18324409425258636, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2483}, {"x": 0.45055848360061646, "y": 0.444784551858902, "z": -0.07187188416719437, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2483}, {"x": 0.4606899917125702, "y": 0.581415593624115, "z": -0.16228032112121582, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2483}, {"x": 0.452759712934494, "y": 0.5730229020118713, "z": -0.15558408200740814, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2483}, {"x": 0.4666166305541992, "y": 0.5935497283935547, "z": -0.1587184441741556, "name": "INDEX_FINGER_DIP", "type": "right_hand", "index": 7, "frame_index": 2483}, {"x": 0.4616827070713043, "y": 0.5858162045478821, "z": -0.1563258096575737, "name": "INDEX_FINGER_MCP", "type": "right_hand", "index": 5, "frame_index": 2483}, {"x": 0.46465975046157837, "y": 0.5912287831306458, "z": -0.15762286121025681, "name": "INDEX_FINGER_PIP", "type": "right_hand", "index": 6, "frame_index": 2483}, {"x": 0.4682358205318451, "y": 0.5949233174324036, "z": -0.15945790568366647, "name": "INDEX_FINGER_TIP", "type": "right_hand", "index": 8, "frame_index": 2483}, {"x": 0.4651183784008026, "y": 0.595342755317688, "z": -0.15860144817270339, "name": "MIDDLE_FINGER_DIP", "type": "right_hand", "index": 11, "frame_index": 2483}, {"x": 0.4596097767353058, "y": 0.5882061719894409, "z": -0.15679889649618417, "name": "MIDDLE_FINGER_MCP", "type": "right_hand", "index": 9, "frame_index": 2483}, {"x": 0.4629010558128357, "y": 0.5933385491371155, "z": -0.15777356992475688, "name": "MIDDLE_FINGER_PIP", "type": "right_hand", "index": 10, "frame_index": 2483}, {"x": 0.46705466508865356, "y": 0.5962141156196594, "z": -0.15921176504343748, "name": "MIDDLE_FINGER_TIP", "type": "right_hand", "index": 12, "frame_index": 2483}, {"x": 0.45636236667633057, "y": 0.5972581505775452, "z": -0.15891171735711396, "name": "PINKY_DIP", "type": "right_hand", "index": 19, "frame_index": 2483}, {"x": 0.4537874162197113, "y": 0.5896592140197754, "z": -0.15814744401723146, "name": "PINKY_MCP", "type": "right_hand", "index": 17, "frame_index": 2483}, {"x": 0.4550924003124237, "y": 0.5948672294616699, "z": -0.15895984112285078, "name": "PINKY_PIP", "type": "right_hand", "index": 18, "frame_index": 2483}, {"x": 0.45759665966033936, "y": 0.5983480215072632, "z": -0.15875789849087596, "name": "PINKY_TIP", "type": "right_hand", "index": 20, "frame_index": 2483}, {"x": 0.46155086159706116, "y": 0.5963066220283508, "z": -0.1585740251466632, "name": "RING_FINGER_DIP", "type": "right_hand", "index": 15, "frame_index": 2483}, {"x": 0.45693114399909973, "y": 0.5894163846969604, "z": -0.15742867218796164, "name": "RING_FINGER_MCP", "type": "right_hand", "index": 13, "frame_index": 2483}, {"x": 0.45975399017333984, "y": 0.5945172309875488, "z": -0.15840160567313433, "name": "RING_FINGER_PIP", "type": "right_hand", "index": 14, "frame_index": 2483}, {"x": 0.4631578326225281, "y": 0.5968087911605835, "z": -0.15864682593382895, "name": "RING_FINGER_TIP", "type": "right_hand", "index": 16, "frame_index": 2483}, {"x": 0.4568501114845276, "y": 0.5747877955436707, "z": -0.15630135918036103, "name": "THUMB_CMC", "type": "right_hand", "index": 1, "frame_index": 2483}, {"x": 0.46338459849357605, "y": 0.5833116769790649, "z": -0.15758336777798831, "name": "THUMB_IP", "type": "right_hand", "index": 3, "frame_index": 2483}, {"x": 0.46119454503059387, "y": 0.5785688161849976, "z": -0.15691970090847462, "name": "THUMB_MCP", "type": "right_hand", "index": 2, "frame_index": 2483}, {"x": 0.4646940231323242, "y": 0.5877292156219482, "z": -0.1581828286871314, "name": "THUMB_TIP", "type": "right_hand", "index": 4, "frame_index": 2483}, {"x": 0.4521307945251465, "y": 0.5733045339584351, "z": -0.15558407342346836, "name": "WRIST", "type": "right_hand", "index": 0, "frame_index": 2483}], [{"x": 0.47756966948509216, "y": 0.7821663022041321, "z": 0.07809285819530487, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2484}, {"x": 0.48910242319107056, "y": 0.3952762484550476, "z": -0.07013140618801117, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2484}, {"x": 0.501581072807312, "y": 0.5200693011283875, "z": 0.027143385261297226, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2484}, {"x": 0.48633795976638794, "y": 0.38841623067855835, "z": -0.14966869354248047, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2484}, {"x": 0.484085351228714, "y": 0.3867560029029846, "z": -0.14954200387001038, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2484}, {"x": 0.4880385100841522, "y": 0.3898245692253113, "z": -0.14963670074939728, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2484}, {"x": 0.4917915165424347, "y": 0.8125311136245728, "z": 0.00041238812264055014, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2484}, {"x": 0.47371289134025574, "y": 0.7981374263763428, "z": 0.07975123077630997, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2484}, {"x": 0.49163928627967834, "y": 0.5710397958755493, "z": 0.022092662751674652, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2484}, {"x": 0.5023289918899536, "y": 0.5862618088722229, "z": -0.07040952891111374, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2484}, {"x": 0.48582667112350464, "y": 0.681145429611206, "z": 0.01703515648841858, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2484}, {"x": 0.5036821365356445, "y": 0.585567831993103, "z": -0.051952067762613297, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2484}, {"x": 0.4960322082042694, "y": 0.4501623809337616, "z": -0.0036986316554248333, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2484}, {"x": 0.5016208291053772, "y": 0.5811353921890259, "z": -0.044783007353544235, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2484}, {"x": 0.5046612620353699, "y": 0.5688704252243042, "z": -0.036282192915678024, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2484}, {"x": 0.48340633511543274, "y": 0.40454763174057007, "z": -0.13282254338264465, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2484}, {"x": 0.4753040373325348, "y": 0.40142303705215454, "z": -0.14226433634757996, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2484}, {"x": 0.4808334708213806, "y": 0.39266932010650635, "z": -0.16397753357887268, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2484}, {"x": 0.4680083692073822, "y": 0.7885728478431702, "z": -0.03608625382184982, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2484}, {"x": 0.47056302428245544, "y": 0.3869243860244751, "z": -0.09956108778715134, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2484}, {"x": 0.43923303484916687, "y": 0.5177828073501587, "z": -0.0787297859787941, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2484}, {"x": 0.47560518980026245, "y": 0.3835276961326599, "z": -0.15595735609531403, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2484}, {"x": 0.47763457894325256, "y": 0.3836700916290283, "z": -0.15577451884746552, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2484}, {"x": 0.47370922565460205, "y": 0.38335832953453064, "z": -0.1560399830341339, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2484}, {"x": 0.4702198803424835, "y": 0.8258960247039795, "z": -0.12941737473011017, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2484}, {"x": 0.4680580794811249, "y": 0.8038589954376221, "z": -0.03667520359158516, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2484}, {"x": 0.46519768238067627, "y": 0.5714952349662781, "z": -0.02221743017435074, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2484}, {"x": 0.4615231454372406, "y": 0.5864216685295105, "z": -0.18749412894248962, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2484}, {"x": 0.4669651687145233, "y": 0.6770984530448914, "z": -0.07103105634450912, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2484}, {"x": 0.4576006531715393, "y": 0.5896012187004089, "z": -0.18126554787158966, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2484}, {"x": 0.450032114982605, "y": 0.44671502709388733, "z": -0.06934331357479095, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2484}, {"x": 0.4615325331687927, "y": 0.5812598466873169, "z": -0.15952439606189728, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2484}, {"x": 0.4537859261035919, "y": 0.5725681781768799, "z": -0.15541885793209076, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2484}, {"x": 0.46738678216934204, "y": 0.595430850982666, "z": -0.15511941112345085, "name": "INDEX_FINGER_DIP", "type": "right_hand", "index": 7, "frame_index": 2484}, {"x": 0.4626666009426117, "y": 0.5866603255271912, "z": -0.1540015396894887, "name": "INDEX_FINGER_MCP", "type": "right_hand", "index": 5, "frame_index": 2484}, {"x": 0.4655774235725403, "y": 0.5923191905021667, "z": -0.1544967363588512, "name": "INDEX_FINGER_PIP", "type": "right_hand", "index": 6, "frame_index": 2484}, {"x": 0.46874988079071045, "y": 0.5974422097206116, "z": -0.1555051447430742, "name": "INDEX_FINGER_TIP", "type": "right_hand", "index": 8, "frame_index": 2484}, {"x": 0.46770066022872925, "y": 0.595374584197998, "z": -0.1555336008168524, "name": "MIDDLE_FINGER_DIP", "type": "right_hand", "index": 11, "frame_index": 2484}, {"x": 0.46303048729896545, "y": 0.5861828923225403, "z": -0.15460715675726533, "name": "MIDDLE_FINGER_MCP", "type": "right_hand", "index": 9, "frame_index": 2484}, {"x": 0.4659222662448883, "y": 0.5920971632003784, "z": -0.1549852891766932, "name": "MIDDLE_FINGER_PIP", "type": "right_hand", "index": 10, "frame_index": 2484}, {"x": 0.4691128134727478, "y": 0.5978100299835205, "z": -0.15586487835389562, "name": "MIDDLE_FINGER_TIP", "type": "right_hand", "index": 12, "frame_index": 2484}, {"x": 0.4664853811264038, "y": 0.5915666818618774, "z": -0.15576694440096617, "name": "PINKY_DIP", "type": "right_hand", "index": 19, "frame_index": 2484}, {"x": 0.46280452609062195, "y": 0.5836183428764343, "z": -0.1560539593338035, "name": "PINKY_MCP", "type": "right_hand", "index": 17, "frame_index": 2484}, {"x": 0.4651212692260742, "y": 0.5886813402175903, "z": -0.15610525908414274, "name": "PINKY_PIP", "type": "right_hand", "index": 18, "frame_index": 2484}, {"x": 0.4675171375274658, "y": 0.5938866138458252, "z": -0.15544042574765626, "name": "PINKY_TIP", "type": "right_hand", "index": 20, "frame_index": 2484}, {"x": 0.4673575460910797, "y": 0.5944488048553467, "z": -0.15560745932452846, "name": "RING_FINGER_DIP", "type": "right_hand", "index": 15, "frame_index": 2484}, {"x": 0.4630952477455139, "y": 0.5851045250892639, "z": -0.15532270070980303, "name": "RING_FINGER_MCP", "type": "right_hand", "index": 13, "frame_index": 2484}, {"x": 0.4658263325691223, "y": 0.5911204218864441, "z": -0.15559451309673022, "name": "RING_FINGER_PIP", "type": "right_hand", "index": 14, "frame_index": 2484}, {"x": 0.46850451827049255, "y": 0.5968675017356873, "z": -0.1555609433708014, "name": "RING_FINGER_TIP", "type": "right_hand", "index": 16, "frame_index": 2484}, {"x": 0.45700448751449585, "y": 0.5789327621459961, "z": -0.15499888887279667, "name": "THUMB_CMC", "type": "right_hand", "index": 1, "frame_index": 2484}, {"x": 0.46227577328681946, "y": 0.5887994170188904, "z": -0.15471386641729623, "name": "THUMB_IP", "type": "right_hand", "index": 3, "frame_index": 2484}, {"x": 0.46004435420036316, "y": 0.5845157504081726, "z": -0.15475716977380216, "name": "THUMB_MCP", "type": "right_hand", "index": 2, "frame_index": 2484}, {"x": 0.46398040652275085, "y": 0.5911154747009277, "z": -0.15464701305609196, "name": "THUMB_TIP", "type": "right_hand", "index": 4, "frame_index": 2484}, {"x": 0.4550515413284302, "y": 0.5727918744087219, "z": -0.1554188397069023, "name": "WRIST", "type": "right_hand", "index": 0, "frame_index": 2484}], [{"x": 0.4775809347629547, "y": 0.7821798920631409, "z": 0.08034109324216843, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2485}, {"x": 0.4892681837081909, "y": 0.39705365896224976, "z": -0.06448826193809509, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2485}, {"x": 0.5014139413833618, "y": 0.519466757774353, "z": 0.04548061639070511, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2485}, {"x": 0.48744839429855347, "y": 0.3904806971549988, "z": -0.14637427031993866, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2485}, {"x": 0.4855813682079315, "y": 0.3889293372631073, "z": -0.1462501585483551, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2485}, {"x": 0.4888440668582916, "y": 0.3917975127696991, "z": -0.1463358998298645, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2485}, {"x": 0.49117764830589294, "y": 0.812522292137146, "z": 0.005557399708777666, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2485}, {"x": 0.4737936854362488, "y": 0.798366904258728, "z": 0.08156060427427292, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2485}, {"x": 0.49205029010772705, "y": 0.568547785282135, "z": 0.02612450160086155, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2485}, {"x": 0.5051725506782532, "y": 0.5925707221031189, "z": -0.03861897438764572, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2485}, {"x": 0.4858318567276001, "y": 0.6808825135231018, "z": 0.01911349408328533, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2485}, {"x": 0.505724310874939, "y": 0.5912947058677673, "z": -0.019385594874620438, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2485}, {"x": 0.4957987666130066, "y": 0.4507341682910919, "z": 0.00597993191331625, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2485}, {"x": 0.50437331199646, "y": 0.5873315334320068, "z": -0.01588822342455387, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2485}, {"x": 0.5062700510025024, "y": 0.5745423436164856, "z": -0.007359059061855078, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2485}, {"x": 0.4835868179798126, "y": 0.4057356119155884, "z": -0.1292160004377365, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2485}, {"x": 0.4757343530654907, "y": 0.4017127454280853, "z": -0.14231188595294952, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2485}, {"x": 0.4821711778640747, "y": 0.3938726484775543, "z": -0.16136197745800018, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2485}, {"x": 0.46757373213768005, "y": 0.7886350154876709, "z": -0.06436975300312042, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2485}, {"x": 0.47065192461013794, "y": 0.38693371415138245, "z": -0.10653790831565857, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2485}, {"x": 0.43929773569107056, "y": 0.5167283415794373, "z": -0.11117413640022278, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2485}, {"x": 0.47664347290992737, "y": 0.38358235359191895, "z": -0.15537407994270325, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2485}, {"x": 0.4791899621486664, "y": 0.384064257144928, "z": -0.15519537031650543, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2485}, {"x": 0.474721223115921, "y": 0.38335323333740234, "z": -0.1554519534111023, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2485}, {"x": 0.47031059861183167, "y": 0.8253996968269348, "z": -0.15496470034122467, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2485}, {"x": 0.4676978290081024, "y": 0.8039661049842834, "z": -0.06575935333967209, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2485}, {"x": 0.46519801020622253, "y": 0.5701578259468079, "z": -0.026240266859531403, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2485}, {"x": 0.46643078327178955, "y": 0.5835543870925903, "z": -0.22964875400066376, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2485}, {"x": 0.4667133092880249, "y": 0.6770784854888916, "z": -0.08464092761278152, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2485}, {"x": 0.4626106917858124, "y": 0.5835543870925903, "z": -0.22446078062057495, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2485}, {"x": 0.4499437212944031, "y": 0.44613391160964966, "z": -0.08084747940301895, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2485}, {"x": 0.46636709570884705, "y": 0.5782049894332886, "z": -0.19885577261447906, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2485}, {"x": 0.46027153730392456, "y": 0.5642923712730408, "z": -0.19528451561927795, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2485}, {"x": 0.5058698654174805, "y": 0.6179391741752625, "z": -0.00510831899009645, "name": "INDEX_FINGER_DIP", "type": "left_hand", "index": 7, "frame_index": 2485}, {"x": 0.506989598274231, "y": 0.6045020818710327, "z": -0.0038991891779005527, "name": "INDEX_FINGER_MCP", "type": "left_hand", "index": 5, "frame_index": 2485}, {"x": 0.5072412490844727, "y": 0.6134859919548035, "z": -0.004349554888904095, "name": "INDEX_FINGER_PIP", "type": "left_hand", "index": 6, "frame_index": 2485}, {"x": 0.5042786002159119, "y": 0.6201955080032349, "z": -0.005473465076647699, "name": "INDEX_FINGER_TIP", "type": "left_hand", "index": 8, "frame_index": 2485}, {"x": 0.5064723491668701, "y": 0.6185087561607361, "z": -0.006032534525729716, "name": "MIDDLE_FINGER_DIP", "type": "left_hand", "index": 11, "frame_index": 2485}, {"x": 0.5077129006385803, "y": 0.6043694019317627, "z": -0.005249288864433765, "name": "MIDDLE_FINGER_MCP", "type": "left_hand", "index": 9, "frame_index": 2485}, {"x": 0.5078645348548889, "y": 0.614066481590271, "z": -0.0053797028958797455, "name": "MIDDLE_FINGER_PIP", "type": "left_hand", "index": 10, "frame_index": 2485}, {"x": 0.5047739148139954, "y": 0.6205253005027771, "z": -0.006456644041463733, "name": "MIDDLE_FINGER_TIP", "type": "left_hand", "index": 12, "frame_index": 2485}, {"x": 0.5068888068199158, "y": 0.6151072978973389, "z": -0.0071691286721033975, "name": "PINKY_DIP", "type": "left_hand", "index": 19, "frame_index": 2485}, {"x": 0.5074949860572815, "y": 0.6034504175186157, "z": -0.008187100989744067, "name": "PINKY_MCP", "type": "left_hand", "index": 17, "frame_index": 2485}, {"x": 0.5075583457946777, "y": 0.6109840273857117, "z": -0.007638119102921337, "name": "PINKY_PIP", "type": "left_hand", "index": 18, "frame_index": 2485}, {"x": 0.5058541297912598, "y": 0.6175145506858826, "z": -0.006873994949273765, "name": "PINKY_TIP", "type": "left_hand", "index": 20, "frame_index": 2485}, {"x": 0.5067464709281921, "y": 0.6175153255462646, "z": -0.006593382160644978, "name": "RING_FINGER_DIP", "type": "left_hand", "index": 15, "frame_index": 2485}, {"x": 0.5079476833343506, "y": 0.6040480136871338, "z": -0.006718949240166694, "name": "RING_FINGER_MCP", "type": "left_hand", "index": 13, "frame_index": 2485}, {"x": 0.5079198479652405, "y": 0.6133114695549011, "z": -0.006517297122627497, "name": "RING_FINGER_PIP", "type": "left_hand", "index": 14, "frame_index": 2485}, {"x": 0.5052744150161743, "y": 0.6195276379585266, "z": -0.006703235674649477, "name": "RING_FINGER_TIP", "type": "left_hand", "index": 16, "frame_index": 2485}, {"x": 0.5035598874092102, "y": 0.590878427028656, "z": -0.005657541332766414, "name": "THUMB_CMC", "type": "left_hand", "index": 1, "frame_index": 2485}, {"x": 0.5026243329048157, "y": 0.6053957343101501, "z": -0.004952536895871162, "name": "THUMB_IP", "type": "left_hand", "index": 3, "frame_index": 2485}, {"x": 0.5030372142791748, "y": 0.5994722247123718, "z": -0.00497528025880456, "name": "THUMB_MCP", "type": "left_hand", "index": 2, "frame_index": 2485}, {"x": 0.502773106098175, "y": 0.6101619005203247, "z": -0.0048357483465224504, "name": "THUMB_TIP", "type": "left_hand", "index": 4, "frame_index": 2485}, {"x": 0.5055109262466431, "y": 0.5820373296737671, "z": -0.007359037367436372, "name": "WRIST", "type": "left_hand", "index": 0, "frame_index": 2485}, {"x": 0.47017917037010193, "y": 0.6022328734397888, "z": -0.1950535348878475, "name": "INDEX_FINGER_DIP", "type": "right_hand", "index": 7, "frame_index": 2485}, {"x": 0.46744656562805176, "y": 0.5844033360481262, "z": -0.1933559130411595, "name": "INDEX_FINGER_MCP", "type": "right_hand", "index": 5, "frame_index": 2485}, {"x": 0.4687756299972534, "y": 0.5957560539245605, "z": -0.19405635120347142, "name": "INDEX_FINGER_PIP", "type": "right_hand", "index": 6, "frame_index": 2485}, {"x": 0.4716622531414032, "y": 0.6071711778640747, "z": -0.19575099568464793, "name": "INDEX_FINGER_TIP", "type": "right_hand", "index": 8, "frame_index": 2485}, {"x": 0.4684707224369049, "y": 0.6023603081703186, "z": -0.19528435355074691, "name": "MIDDLE_FINGER_DIP", "type": "right_hand", "index": 11, "frame_index": 2485}, {"x": 0.465935081243515, "y": 0.585260272026062, "z": -0.19379975891206414, "name": "MIDDLE_FINGER_MCP", "type": "right_hand", "index": 9, "frame_index": 2485}, {"x": 0.46719035506248474, "y": 0.596056342124939, "z": -0.19431260059354827, "name": "MIDDLE_FINGER_PIP", "type": "right_hand", "index": 10, "frame_index": 2485}, {"x": 0.4697433412075043, "y": 0.6077551245689392, "z": -0.19593805604381487, "name": "MIDDLE_FINGER_TIP", "type": "right_hand", "index": 12, "frame_index": 2485}, {"x": 0.46474888920783997, "y": 0.6001408100128174, "z": -0.1950883468380198, "name": "PINKY_DIP", "type": "right_hand", "index": 19, "frame_index": 2485}, {"x": 0.4627477824687958, "y": 0.5857393741607666, "z": -0.1954612246627221, "name": "PINKY_MCP", "type": "right_hand", "index": 17, "frame_index": 2485}, {"x": 0.46376198530197144, "y": 0.5947951078414917, "z": -0.19552617335284594, "name": "PINKY_PIP", "type": "right_hand", "index": 18, "frame_index": 2485}, {"x": 0.46561986207962036, "y": 0.6046475768089294, "z": -0.19467420753790066, "name": "PINKY_TIP", "type": "right_hand", "index": 20, "frame_index": 2485}, {"x": 0.4668412208557129, "y": 0.6014803051948547, "z": -0.19496905407868326, "name": "RING_FINGER_DIP", "type": "right_hand", "index": 15, "frame_index": 2485}, {"x": 0.4643951952457428, "y": 0.5856984257698059, "z": -0.19453512714244425, "name": "RING_FINGER_MCP", "type": "right_hand", "index": 13, "frame_index": 2485}, {"x": 0.4656127691268921, "y": 0.5957026481628418, "z": -0.1948942627350334, "name": "RING_FINGER_PIP", "type": "right_hand", "index": 14, "frame_index": 2485}, {"x": 0.4679742157459259, "y": 0.6063524484634399, "z": -0.1949779585993383, "name": "RING_FINGER_TIP", "type": "right_hand", "index": 16, "frame_index": 2485}, {"x": 0.46636176109313965, "y": 0.563501238822937, "z": -0.19571434034151025, "name": "THUMB_CMC", "type": "right_hand", "index": 1, "frame_index": 2485}, {"x": 0.470950722694397, "y": 0.5843122601509094, "z": -0.19564148440258577, "name": "THUMB_IP", "type": "right_hand", "index": 3, "frame_index": 2485}, {"x": 0.4694869816303253, "y": 0.5747603178024292, "z": -0.19560422335052863, "name": "THUMB_MCP", "type": "right_hand", "index": 2, "frame_index": 2485}, {"x": 0.4719478487968445, "y": 0.5916931629180908, "z": -0.19545966798614245, "name": "THUMB_TIP", "type": "right_hand", "index": 4, "frame_index": 2485}, {"x": 0.46148377656936646, "y": 0.556677520275116, "z": -0.19528451454638807, "name": "WRIST", "type": "right_hand", "index": 0, "frame_index": 2485}], [{"x": 0.4776199162006378, "y": 0.7822954654693604, "z": 0.08085544407367706, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2486}, {"x": 0.4895409345626831, "y": 0.39861416816711426, "z": -0.09057784825563431, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2486}, {"x": 0.501261293888092, "y": 0.5230371952056885, "z": 0.01545911654829979, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2486}, {"x": 0.4878632128238678, "y": 0.39169037342071533, "z": -0.1687164455652237, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2486}, {"x": 0.48629695177078247, "y": 0.39016014337539673, "z": -0.16856630146503448, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2486}, {"x": 0.4892599284648895, "y": 0.3931960463523865, "z": -0.16869349777698517, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2486}, {"x": 0.4909377098083496, "y": 0.8125929832458496, "z": 0.003734581172466278, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2486}, {"x": 0.47392088174819946, "y": 0.7985326051712036, "z": 0.08188449591398239, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2486}, {"x": 0.49235010147094727, "y": 0.5689029693603516, "z": 0.023406604304909706, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2486}, {"x": 0.5083248019218445, "y": 0.6009949445724487, "z": -0.05482213571667671, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2486}, {"x": 0.48595333099365234, "y": 0.6808528304100037, "z": 0.01889035850763321, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2486}, {"x": 0.5073931217193604, "y": 0.598648726940155, "z": -0.03549428656697273, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2486}, {"x": 0.495752215385437, "y": 0.45146626234054565, "z": -0.025832409039139748, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2486}, {"x": 0.5067793130874634, "y": 0.5961004495620728, "z": -0.032198503613471985, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2486}, {"x": 0.5060738921165466, "y": 0.5848920345306396, "z": -0.02431255392730236, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2486}, {"x": 0.48371782898902893, "y": 0.40652644634246826, "z": -0.15104669332504272, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2486}, {"x": 0.47604048252105713, "y": 0.40221619606018066, "z": -0.16182608902454376, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2486}, {"x": 0.4828319847583771, "y": 0.39458951354026794, "z": -0.18190494179725647, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2486}, {"x": 0.4675251245498657, "y": 0.7886616587638855, "z": -0.06886469572782516, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2486}, {"x": 0.4708873927593231, "y": 0.38732606172561646, "z": -0.12481644004583359, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2486}, {"x": 0.4391402006149292, "y": 0.5157501697540283, "z": -0.14753304421901703, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2486}, {"x": 0.477395236492157, "y": 0.38401299715042114, "z": -0.1758723258972168, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2486}, {"x": 0.48026803135871887, "y": 0.38496166467666626, "z": -0.17570604383945465, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2486}, {"x": 0.4754169285297394, "y": 0.3835725784301758, "z": -0.1759539544582367, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2486}, {"x": 0.4701862335205078, "y": 0.8253740668296814, "z": -0.1580541580915451, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2486}, {"x": 0.4676051437854767, "y": 0.8039335012435913, "z": -0.06905326247215271, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2486}, {"x": 0.46545663475990295, "y": 0.5703983902931213, "z": -0.02350965328514576, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2486}, {"x": 0.4701004922389984, "y": 0.5496060252189636, "z": -0.2915743589401245, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2486}, {"x": 0.4667183458805084, "y": 0.6770704984664917, "z": -0.10522127896547318, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2486}, {"x": 0.4674834609031677, "y": 0.5498749613761902, "z": -0.28819331526756287, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2486}, {"x": 0.4502442479133606, "y": 0.4456114172935486, "z": -0.09132559597492218, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2486}, {"x": 0.4695989191532135, "y": 0.5449691414833069, "z": -0.2604043483734131, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2486}, {"x": 0.46433696150779724, "y": 0.532897412776947, "z": -0.2567957043647766, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2486}, {"x": 0.5022377967834473, "y": 0.6372050642967224, "z": -0.029487171210348606, "name": "INDEX_FINGER_DIP", "type": "left_hand", "index": 7, "frame_index": 2486}, {"x": 0.5054298043251038, "y": 0.618584394454956, "z": -0.02604112948756665, "name": "INDEX_FINGER_MCP", "type": "left_hand", "index": 5, "frame_index": 2486}, {"x": 0.5032415986061096, "y": 0.6296137571334839, "z": -0.028105647768825293, "name": "INDEX_FINGER_PIP", "type": "left_hand", "index": 6, "frame_index": 2486}, {"x": 0.501641035079956, "y": 0.6430123448371887, "z": -0.030281822197139263, "name": "INDEX_FINGER_TIP", "type": "left_hand", "index": 8, "frame_index": 2486}, {"x": 0.5067840814590454, "y": 0.6211985349655151, "z": -0.029724678955972195, "name": "MIDDLE_FINGER_DIP", "type": "left_hand", "index": 11, "frame_index": 2486}, {"x": 0.5085899233818054, "y": 0.6179738640785217, "z": -0.02604117465671152, "name": "MIDDLE_FINGER_MCP", "type": "left_hand", "index": 9, "frame_index": 2486}, {"x": 0.5074944496154785, "y": 0.6257636547088623, "z": -0.02896961197257042, "name": "MIDDLE_FINGER_PIP", "type": "left_hand", "index": 10, "frame_index": 2486}, {"x": 0.5062967538833618, "y": 0.6163334846496582, "z": -0.029391520656645298, "name": "MIDDLE_FINGER_TIP", "type": "left_hand", "index": 12, "frame_index": 2486}, {"x": 0.512370765209198, "y": 0.6118127107620239, "z": -0.027381390100345016, "name": "PINKY_DIP", "type": "left_hand", "index": 19, "frame_index": 2486}, {"x": 0.5147716999053955, "y": 0.6127980351448059, "z": -0.02661665598861873, "name": "PINKY_MCP", "type": "left_hand", "index": 17, "frame_index": 2486}, {"x": 0.5136449337005615, "y": 0.6153531670570374, "z": -0.028029676526784897, "name": "PINKY_PIP", "type": "left_hand", "index": 18, "frame_index": 2486}, {"x": 0.511880099773407, "y": 0.6086862087249756, "z": -0.02634992520324886, "name": "PINKY_TIP", "type": "left_hand", "index": 20, "frame_index": 2486}, {"x": 0.5096604228019714, "y": 0.6149261593818665, "z": -0.02826080610975623, "name": "RING_FINGER_DIP", "type": "left_hand", "index": 15, "frame_index": 2486}, {"x": 0.5117930769920349, "y": 0.6160788536071777, "z": -0.026252842275425792, "name": "RING_FINGER_MCP", "type": "left_hand", "index": 13, "frame_index": 2486}, {"x": 0.5105953812599182, "y": 0.6200074553489685, "z": -0.028740434907376766, "name": "RING_FINGER_PIP", "type": "left_hand", "index": 14, "frame_index": 2486}, {"x": 0.5092698931694031, "y": 0.6105518341064453, "z": -0.0271095207426697, "name": "RING_FINGER_TIP", "type": "left_hand", "index": 16, "frame_index": 2486}, {"x": 0.5059502124786377, "y": 0.60219407081604, "z": -0.026038359384983778, "name": "THUMB_CMC", "type": "left_hand", "index": 1, "frame_index": 2486}, {"x": 0.5070682764053345, "y": 0.6147017478942871, "z": -0.028042274992913008, "name": "THUMB_IP", "type": "left_hand", "index": 3, "frame_index": 2486}, {"x": 0.5056915879249573, "y": 0.6090233325958252, "z": -0.027075021527707577, "name": "THUMB_MCP", "type": "left_hand", "index": 2, "frame_index": 2486}, {"x": 0.5088223218917847, "y": 0.6179165244102478, "z": -0.028972984291613102, "name": "THUMB_TIP", "type": "left_hand", "index": 4, "frame_index": 2486}, {"x": 0.5088678598403931, "y": 0.595375120639801, "z": -0.024312524945164782, "name": "WRIST", "type": "left_hand", "index": 0, "frame_index": 2486}, {"x": 0.4734032452106476, "y": 0.5617893934249878, "z": -0.2596750766970217, "name": "INDEX_FINGER_DIP", "type": "right_hand", "index": 7, "frame_index": 2486}, {"x": 0.4744042456150055, "y": 0.5457248687744141, "z": -0.25705343575100414, "name": "INDEX_FINGER_MCP", "type": "right_hand", "index": 5, "frame_index": 2486}, {"x": 0.47408851981163025, "y": 0.5556138157844543, "z": -0.2585041228448972, "name": "INDEX_FINGER_PIP", "type": "right_hand", "index": 6, "frame_index": 2486}, {"x": 0.47260475158691406, "y": 0.5666213035583496, "z": -0.26046337629668415, "name": "INDEX_FINGER_TIP", "type": "right_hand", "index": 8, "frame_index": 2486}, {"x": 0.46996018290519714, "y": 0.5633417963981628, "z": -0.2598638648632914, "name": "MIDDLE_FINGER_DIP", "type": "right_hand", "index": 11, "frame_index": 2486}, {"x": 0.4722326695919037, "y": 0.5467509627342224, "z": -0.25756151659879833, "name": "MIDDLE_FINGER_MCP", "type": "right_hand", "index": 9, "frame_index": 2486}, {"x": 0.47126391530036926, "y": 0.5572637319564819, "z": -0.25885241967625916, "name": "MIDDLE_FINGER_PIP", "type": "right_hand", "index": 10, "frame_index": 2486}, {"x": 0.4686723053455353, "y": 0.5679677128791809, "z": -0.2605710718780756, "name": "MIDDLE_FINGER_TIP", "type": "right_hand", "index": 12, "frame_index": 2486}, {"x": 0.4652349054813385, "y": 0.5583980679512024, "z": -0.2601184812374413, "name": "PINKY_DIP", "type": "right_hand", "index": 19, "frame_index": 2486}, {"x": 0.46757781505584717, "y": 0.5451193451881409, "z": -0.2592846821062267, "name": "PINKY_MCP", "type": "right_hand", "index": 17, "frame_index": 2486}, {"x": 0.46625298261642456, "y": 0.5531747341156006, "z": -0.2600547857582569, "name": "PINKY_PIP", "type": "right_hand", "index": 18, "frame_index": 2486}, {"x": 0.46430885791778564, "y": 0.5625086426734924, "z": -0.2601580305490643, "name": "PINKY_TIP", "type": "right_hand", "index": 20, "frame_index": 2486}, {"x": 0.46729013323783875, "y": 0.5624694228172302, "z": -0.25999502185732126, "name": "RING_FINGER_DIP", "type": "right_hand", "index": 15, "frame_index": 2486}, {"x": 0.4698992967605591, "y": 0.546592652797699, "z": -0.25835200934670866, "name": "RING_FINGER_MCP", "type": "right_hand", "index": 13, "frame_index": 2486}, {"x": 0.46861687302589417, "y": 0.556763768196106, "z": -0.2595613480079919, "name": "RING_FINGER_PIP", "type": "right_hand", "index": 14, "frame_index": 2486}, {"x": 0.46610409021377563, "y": 0.566663920879364, "z": -0.26026943093165755, "name": "RING_FINGER_TIP", "type": "right_hand", "index": 16, "frame_index": 2486}, {"x": 0.4724383056163788, "y": 0.531234860420227, "z": -0.25775742111727595, "name": "THUMB_CMC", "type": "right_hand", "index": 1, "frame_index": 2486}, {"x": 0.4747949540615082, "y": 0.5484379529953003, "z": -0.25904343626461923, "name": "THUMB_IP", "type": "right_hand", "index": 3, "frame_index": 2486}, {"x": 0.4742622971534729, "y": 0.5403361916542053, "z": -0.25835653592366725, "name": "THUMB_MCP", "type": "right_hand", "index": 2, "frame_index": 2486}, {"x": 0.47518390417099, "y": 0.5549286603927612, "z": -0.2596467814873904, "name": "THUMB_TIP", "type": "right_hand", "index": 4, "frame_index": 2486}, {"x": 0.46943947672843933, "y": 0.5241497159004211, "z": -0.25679567474482035, "name": "WRIST", "type": "right_hand", "index": 0, "frame_index": 2486}], [{"x": 0.47769415378570557, "y": 0.7823077440261841, "z": 0.08987481147050858, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2487}, {"x": 0.4900325834751129, "y": 0.3990366756916046, "z": -0.07527922838926315, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2487}, {"x": 0.5008341073989868, "y": 0.522903561592102, "z": 0.03985552862286568, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2487}, {"x": 0.48843511939048767, "y": 0.39179739356040955, "z": -0.1552387773990631, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2487}, {"x": 0.4870069622993469, "y": 0.39021608233451843, "z": -0.1550847440958023, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2487}, {"x": 0.4900074601173401, "y": 0.39346370100975037, "z": -0.15521499514579773, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2487}, {"x": 0.4905600845813751, "y": 0.8125872611999512, "z": 0.0142799848690629, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2487}, {"x": 0.4740031957626343, "y": 0.7982101440429688, "z": 0.09212620556354523, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2487}, {"x": 0.4924224615097046, "y": 0.569334864616394, "z": 0.02569173462688923, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2487}, {"x": 0.5092980265617371, "y": 0.6021414995193481, "z": -0.03762911632657051, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2487}, {"x": 0.4862734377384186, "y": 0.681219220161438, "z": 0.018820490688085556, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2487}, {"x": 0.5084285140037537, "y": 0.599635124206543, "z": -0.015706920996308327, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2487}, {"x": 0.49577686190605164, "y": 0.45205289125442505, "z": -0.006352592725306749, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2487}, {"x": 0.5075129866600037, "y": 0.5969657897949219, "z": -0.018195969983935356, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2487}, {"x": 0.5066759586334229, "y": 0.5848945379257202, "z": -0.0122192008420825, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2487}, {"x": 0.4841248691082001, "y": 0.406471848487854, "z": -0.1379924863576889, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2487}, {"x": 0.47659388184547424, "y": 0.4014511704444885, "z": -0.15027831494808197, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2487}, {"x": 0.48348158597946167, "y": 0.3945710062980652, "z": -0.16935224831104279, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2487}, {"x": 0.4675883650779724, "y": 0.7884536385536194, "z": -0.04083559662103653, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2487}, {"x": 0.47144004702568054, "y": 0.38718733191490173, "z": -0.11485383659601212, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2487}, {"x": 0.43855515122413635, "y": 0.5150212049484253, "z": -0.16644828021526337, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2487}, {"x": 0.47840243577957153, "y": 0.3838479816913605, "z": -0.16358427703380585, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2487}, {"x": 0.4810602366924286, "y": 0.3849145472049713, "z": -0.16341589391231537, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2487}, {"x": 0.47619929909706116, "y": 0.3833578824996948, "z": -0.16367574036121368, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2487}, {"x": 0.47034314274787903, "y": 0.8253058791160583, "z": -0.12572473287582397, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2487}, {"x": 0.4675523340702057, "y": 0.8031503558158875, "z": -0.03882306069135666, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2487}, {"x": 0.46550390124320984, "y": 0.5707336664199829, "z": -0.025798648595809937, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2487}, {"x": 0.48023805022239685, "y": 0.5044464468955994, "z": -0.3112871050834656, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2487}, {"x": 0.4666261672973633, "y": 0.6773767471313477, "z": -0.09892145544290543, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2487}, {"x": 0.47763141989707947, "y": 0.5093713998794556, "z": -0.31371936202049255, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2487}, {"x": 0.4506163001060486, "y": 0.44531434774398804, "z": -0.0898437425494194, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2487}, {"x": 0.4776584804058075, "y": 0.5032506585121155, "z": -0.2823024094104767, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2487}, {"x": 0.46824154257774353, "y": 0.5048468708992004, "z": -0.2809296250343323, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2487}, {"x": 0.5063619613647461, "y": 0.6239094734191895, "z": -0.01488189771771431, "name": "INDEX_FINGER_DIP", "type": "left_hand", "index": 7, "frame_index": 2487}, {"x": 0.5078473091125488, "y": 0.6181158423423767, "z": -0.010691494797356427, "name": "INDEX_FINGER_MCP", "type": "left_hand", "index": 5, "frame_index": 2487}, {"x": 0.5075337290763855, "y": 0.6262200474739075, "z": -0.013045755389612168, "name": "INDEX_FINGER_PIP", "type": "left_hand", "index": 6, "frame_index": 2487}, {"x": 0.505425751209259, "y": 0.6182978749275208, "z": -0.015534485457465053, "name": "INDEX_FINGER_TIP", "type": "left_hand", "index": 8, "frame_index": 2487}, {"x": 0.5082656145095825, "y": 0.6203441023826599, "z": -0.014565331162884831, "name": "MIDDLE_FINGER_DIP", "type": "left_hand", "index": 11, "frame_index": 2487}, {"x": 0.5100898146629333, "y": 0.6169376373291016, "z": -0.011761572590330616, "name": "MIDDLE_FINGER_MCP", "type": "left_hand", "index": 9, "frame_index": 2487}, {"x": 0.5095808506011963, "y": 0.6236658096313477, "z": -0.013536517508327961, "name": "MIDDLE_FINGER_PIP", "type": "left_hand", "index": 10, "frame_index": 2487}, {"x": 0.5072838664054871, "y": 0.6152735352516174, "z": -0.014812227804213762, "name": "MIDDLE_FINGER_TIP", "type": "left_hand", "index": 12, "frame_index": 2487}, {"x": 0.5144505500793457, "y": 0.6119322776794434, "z": -0.014462410705164075, "name": "PINKY_DIP", "type": "left_hand", "index": 19, "frame_index": 2487}, {"x": 0.5154874324798584, "y": 0.6111345887184143, "z": -0.014464386506006122, "name": "PINKY_MCP", "type": "left_hand", "index": 17, "frame_index": 2487}, {"x": 0.5155935287475586, "y": 0.6150186061859131, "z": -0.015197304310277104, "name": "PINKY_PIP", "type": "left_hand", "index": 18, "frame_index": 2487}, {"x": 0.5136844515800476, "y": 0.6081779599189758, "z": -0.01351231918670237, "name": "PINKY_TIP", "type": "left_hand", "index": 20, "frame_index": 2487}, {"x": 0.511353075504303, "y": 0.6142257452011108, "z": -0.014753366820514202, "name": "RING_FINGER_DIP", "type": "left_hand", "index": 15, "frame_index": 2487}, {"x": 0.5126452445983887, "y": 0.6145637035369873, "z": -0.01311472151428461, "name": "RING_FINGER_MCP", "type": "left_hand", "index": 13, "frame_index": 2487}, {"x": 0.5123207569122314, "y": 0.6185963749885559, "z": -0.0147773795761168, "name": "RING_FINGER_PIP", "type": "left_hand", "index": 14, "frame_index": 2487}, {"x": 0.5106574892997742, "y": 0.6095179319381714, "z": -0.014173581963405013, "name": "RING_FINGER_TIP", "type": "left_hand", "index": 16, "frame_index": 2487}, {"x": 0.5063537359237671, "y": 0.6036515831947327, "z": -0.011690394079778343, "name": "THUMB_CMC", "type": "left_hand", "index": 1, "frame_index": 2487}, {"x": 0.5067145228385925, "y": 0.6184317469596863, "z": -0.012636507774004713, "name": "THUMB_IP", "type": "left_hand", "index": 3, "frame_index": 2487}, {"x": 0.5062587857246399, "y": 0.6119570732116699, "z": -0.011840476508950815, "name": "THUMB_MCP", "type": "left_hand", "index": 2, "frame_index": 2487}, {"x": 0.5075193643569946, "y": 0.6225697994232178, "z": -0.013357375049963593, "name": "THUMB_TIP", "type": "left_hand", "index": 4, "frame_index": 2487}, {"x": 0.5086314082145691, "y": 0.5925840735435486, "z": -0.012219208632032519, "name": "WRIST", "type": "left_hand", "index": 0, "frame_index": 2487}], [{"x": 0.47779756784439087, "y": 0.7822260856628418, "z": 0.09344441443681717, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2488}, {"x": 0.4907211661338806, "y": 0.39995095133781433, "z": -0.027333715930581093, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2488}, {"x": 0.4999111294746399, "y": 0.52322918176651, "z": 0.06363924592733383, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2488}, {"x": 0.4891517758369446, "y": 0.3921245038509369, "z": -0.0998324379324913, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2488}, {"x": 0.4876779615879059, "y": 0.3904608190059662, "z": -0.09967911243438721, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2488}, {"x": 0.49080294370651245, "y": 0.3938763439655304, "z": -0.09981033951044083, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2488}, {"x": 0.49036672711372375, "y": 0.8125742673873901, "z": 0.020247794687747955, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2488}, {"x": 0.4740898013114929, "y": 0.7977136969566345, "z": 0.09649553894996643, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2488}, {"x": 0.492563396692276, "y": 0.5692864656448364, "z": 0.02302892878651619, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2488}, {"x": 0.5083528161048889, "y": 0.601067304611206, "z": -0.0006765838479623199, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2488}, {"x": 0.4866470694541931, "y": 0.6812959313392639, "z": 0.018005678430199623, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2488}, {"x": 0.5073395371437073, "y": 0.5990684032440186, "z": 0.01623738743364811, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2488}, {"x": 0.496308833360672, "y": 0.45283037424087524, "z": 0.026240894570946693, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2488}, {"x": 0.5070931315422058, "y": 0.5957428216934204, "z": 0.017734406515955925, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2488}, {"x": 0.5058897733688354, "y": 0.5829734206199646, "z": 0.024194899946451187, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2488}, {"x": 0.4846888482570648, "y": 0.40663084387779236, "z": -0.08529003709554672, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2488}, {"x": 0.4778520166873932, "y": 0.4013947546482086, "z": -0.09397108107805252, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2488}, {"x": 0.4843389391899109, "y": 0.39463934302330017, "z": -0.1133919209241867, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2488}, {"x": 0.46763768792152405, "y": 0.7884491682052612, "z": -0.03192838653922081, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2488}, {"x": 0.4724053144454956, "y": 0.3871423006057739, "z": -0.05445846542716026, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2488}, {"x": 0.4398767650127411, "y": 0.5146355628967285, "z": -0.13314415514469147, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2488}, {"x": 0.47975045442581177, "y": 0.38386353850364685, "z": -0.10546577721834183, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2488}, {"x": 0.48197391629219055, "y": 0.385055273771286, "z": -0.10529814660549164, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2488}, {"x": 0.4773959517478943, "y": 0.3833431303501129, "z": -0.10556457191705704, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2488}, {"x": 0.47046250104904175, "y": 0.8251545429229736, "z": -0.11510398983955383, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2488}, {"x": 0.46753591299057007, "y": 0.803170382976532, "z": -0.029443247243762016, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2488}, {"x": 0.46550849080085754, "y": 0.5709614157676697, "z": -0.023142093792557716, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2488}, {"x": 0.480835497379303, "y": 0.4630316197872162, "z": -0.2620803117752075, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2488}, {"x": 0.46662983298301697, "y": 0.6774212718009949, "z": -0.0900876596570015, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2488}, {"x": 0.4801877737045288, "y": 0.4688180088996887, "z": -0.2646290361881256, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2488}, {"x": 0.4506555199623108, "y": 0.4450620412826538, "z": -0.03626615181565285, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2488}, {"x": 0.4794158637523651, "y": 0.46759170293807983, "z": -0.23473162949085236, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2488}, {"x": 0.4731997549533844, "y": 0.48250359296798706, "z": -0.2331288605928421, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2488}, {"x": 0.480025053024292, "y": 0.42461729049682617, "z": -0.23570496984757483, "name": "INDEX_FINGER_DIP", "type": "right_hand", "index": 7, "frame_index": 2488}, {"x": 0.4803704619407654, "y": 0.4431249499320984, "z": -0.23269945522770286, "name": "INDEX_FINGER_MCP", "type": "right_hand", "index": 5, "frame_index": 2488}, {"x": 0.48004207015037537, "y": 0.4313218891620636, "z": -0.2342229668283835, "name": "INDEX_FINGER_PIP", "type": "right_hand", "index": 6, "frame_index": 2488}, {"x": 0.48015862703323364, "y": 0.4194406569004059, "z": -0.23674128320999444, "name": "INDEX_FINGER_TIP", "type": "right_hand", "index": 8, "frame_index": 2488}, {"x": 0.4776119291782379, "y": 0.4238571524620056, "z": -0.23649234417825937, "name": "MIDDLE_FINGER_DIP", "type": "right_hand", "index": 11, "frame_index": 2488}, {"x": 0.47827333211898804, "y": 0.4441293776035309, "z": -0.23373943008482456, "name": "MIDDLE_FINGER_MCP", "type": "right_hand", "index": 9, "frame_index": 2488}, {"x": 0.47770556807518005, "y": 0.43168139457702637, "z": -0.23501758475322276, "name": "MIDDLE_FINGER_PIP", "type": "right_hand", "index": 10, "frame_index": 2488}, {"x": 0.4775823950767517, "y": 0.41732126474380493, "z": -0.23754215985536575, "name": "MIDDLE_FINGER_TIP", "type": "right_hand", "index": 12, "frame_index": 2488}, {"x": 0.471551775932312, "y": 0.4375351369380951, "z": -0.23819964518770576, "name": "PINKY_DIP", "type": "right_hand", "index": 19, "frame_index": 2488}, {"x": 0.47434186935424805, "y": 0.45137110352516174, "z": -0.23646143823862076, "name": "PINKY_MCP", "type": "right_hand", "index": 17, "frame_index": 2488}, {"x": 0.47250983119010925, "y": 0.4429185688495636, "z": -0.23776478599756956, "name": "PINKY_PIP", "type": "right_hand", "index": 18, "frame_index": 2488}, {"x": 0.4709474742412567, "y": 0.43313130736351013, "z": -0.2384361200965941, "name": "PINKY_TIP", "type": "right_hand", "index": 20, "frame_index": 2488}, {"x": 0.4748545289039612, "y": 0.42687374353408813, "z": -0.23746998235583305, "name": "RING_FINGER_DIP", "type": "right_hand", "index": 15, "frame_index": 2488}, {"x": 0.47627755999565125, "y": 0.4469907581806183, "z": -0.23504615249112248, "name": "RING_FINGER_MCP", "type": "right_hand", "index": 13, "frame_index": 2488}, {"x": 0.47534477710723877, "y": 0.4347768723964691, "z": -0.2364092473872006, "name": "RING_FINGER_PIP", "type": "right_hand", "index": 14, "frame_index": 2488}, {"x": 0.4746455252170563, "y": 0.4203052520751953, "z": -0.23822114523500204, "name": "RING_FINGER_TIP", "type": "right_hand", "index": 16, "frame_index": 2488}, {"x": 0.4822077751159668, "y": 0.46543213725090027, "z": -0.23363882640842348, "name": "THUMB_CMC", "type": "right_hand", "index": 1, "frame_index": 2488}, {"x": 0.4853176474571228, "y": 0.4462324380874634, "z": -0.23414685775060207, "name": "THUMB_IP", "type": "right_hand", "index": 3, "frame_index": 2488}, {"x": 0.48441869020462036, "y": 0.4543432295322418, "z": -0.23374835326103494, "name": "THUMB_MCP", "type": "right_hand", "index": 2, "frame_index": 2488}, {"x": 0.48519355058670044, "y": 0.440692275762558, "z": -0.2346741899382323, "name": "THUMB_TIP", "type": "right_hand", "index": 4, "frame_index": 2488}, {"x": 0.47806015610694885, "y": 0.4760477542877197, "z": -0.2331288504056479, "name": "WRIST", "type": "right_hand", "index": 0, "frame_index": 2488}], [{"x": 0.477868914604187, "y": 0.782000720500946, "z": 0.08710666000843048, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2489}, {"x": 0.49135908484458923, "y": 0.39989185333251953, "z": 0.001951598096638918, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2489}, {"x": 0.500547468662262, "y": 0.5227420926094055, "z": 0.08163774013519287, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2489}, {"x": 0.4898741543292999, "y": 0.39200857281684875, "z": -0.07049855589866638, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2489}, {"x": 0.4882707893848419, "y": 0.3903409540653229, "z": -0.07034771144390106, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2489}, {"x": 0.4915618300437927, "y": 0.3937860131263733, "z": -0.0704776793718338, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2489}, {"x": 0.49026453495025635, "y": 0.8125699162483215, "z": 0.013609950430691242, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2489}, {"x": 0.4740932881832123, "y": 0.7971379160881042, "z": 0.08952579647302628, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2489}, {"x": 0.4926663637161255, "y": 0.5692360997200012, "z": 0.023659598082304, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2489}, {"x": 0.5130556225776672, "y": 0.5983425378799438, "z": 0.004194207023829222, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2489}, {"x": 0.48741021752357483, "y": 0.6812912821769714, "z": 0.015459786169230938, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2489}, {"x": 0.5123903751373291, "y": 0.5966269373893738, "z": 0.021438652649521828, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2489}, {"x": 0.49677345156669617, "y": 0.45268696546554565, "z": 0.05218198522925377, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2489}, {"x": 0.5107572078704834, "y": 0.592873752117157, "z": 0.02420642040669918, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2489}, {"x": 0.5099003314971924, "y": 0.5805224180221558, "z": 0.031670697033405304, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2489}, {"x": 0.48510462045669556, "y": 0.40648865699768066, "z": -0.056866977363824844, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2489}, {"x": 0.47861340641975403, "y": 0.40051546692848206, "z": -0.06656082719564438, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2489}, {"x": 0.4849449694156647, "y": 0.39444220066070557, "z": -0.08473920822143555, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2489}, {"x": 0.4676660895347595, "y": 0.788703441619873, "z": -0.04014184698462486, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2489}, {"x": 0.473336786031723, "y": 0.38660070300102234, "z": -0.0285707488656044, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2489}, {"x": 0.4442059397697449, "y": 0.5113759636878967, "z": -0.10764438658952713, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2489}, {"x": 0.48076772689819336, "y": 0.3836776316165924, "z": -0.07681675255298615, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2489}, {"x": 0.48269394040107727, "y": 0.38491034507751465, "z": -0.07666140049695969, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2489}, {"x": 0.478475421667099, "y": 0.38303041458129883, "z": -0.07689501345157623, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2489}, {"x": 0.47056907415390015, "y": 0.8251307606697083, "z": -0.12444277852773666, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2489}, {"x": 0.46753403544425964, "y": 0.8034890294075012, "z": -0.03877833113074303, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2489}, {"x": 0.4654897153377533, "y": 0.5709991455078125, "z": -0.023777274414896965, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2489}, {"x": 0.47870010137557983, "y": 0.45676523447036743, "z": -0.2553195059299469, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2489}, {"x": 0.46662983298301697, "y": 0.6774716973304749, "z": -0.088546983897686, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2489}, {"x": 0.4771714508533478, "y": 0.4613340497016907, "z": -0.25763723254203796, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2489}, {"x": 0.45053818821907043, "y": 0.444900780916214, "z": -0.017168322578072548, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2489}, {"x": 0.47814610600471497, "y": 0.4631088972091675, "z": -0.2274683117866516, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2489}, {"x": 0.4721193313598633, "y": 0.47503674030303955, "z": -0.22528472542762756, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2489}, {"x": 0.47932663559913635, "y": 0.42834270000457764, "z": -0.22696409921627492, "name": "INDEX_FINGER_DIP", "type": "right_hand", "index": 7, "frame_index": 2489}, {"x": 0.47485336661338806, "y": 0.4431379735469818, "z": -0.22363416175357997, "name": "INDEX_FINGER_MCP", "type": "right_hand", "index": 5, "frame_index": 2489}, {"x": 0.47714871168136597, "y": 0.4337276816368103, "z": -0.22543288390443195, "name": "INDEX_FINGER_PIP", "type": "right_hand", "index": 6, "frame_index": 2489}, {"x": 0.48141318559646606, "y": 0.42440274357795715, "z": -0.22777261142618954, "name": "INDEX_FINGER_TIP", "type": "right_hand", "index": 8, "frame_index": 2489}, {"x": 0.47883927822113037, "y": 0.4295303523540497, "z": -0.22753479657694697, "name": "MIDDLE_FINGER_DIP", "type": "right_hand", "index": 11, "frame_index": 2489}, {"x": 0.4734500050544739, "y": 0.4446701407432556, "z": -0.22482531584682874, "name": "MIDDLE_FINGER_MCP", "type": "right_hand", "index": 9, "frame_index": 2489}, {"x": 0.47622427344322205, "y": 0.4349745810031891, "z": -0.22646163718309253, "name": "MIDDLE_FINGER_PIP", "type": "right_hand", "index": 10, "frame_index": 2489}, {"x": 0.4812031388282776, "y": 0.4260355234146118, "z": -0.22803612775169313, "name": "MIDDLE_FINGER_TIP", "type": "right_hand", "index": 12, "frame_index": 2489}, {"x": 0.47858574986457825, "y": 0.4523812234401703, "z": -0.22868530149571598, "name": "PINKY_DIP", "type": "right_hand", "index": 19, "frame_index": 2489}, {"x": 0.47198623418807983, "y": 0.4520593285560608, "z": -0.22816872829571366, "name": "PINKY_MCP", "type": "right_hand", "index": 17, "frame_index": 2489}, {"x": 0.477326899766922, "y": 0.4488486647605896, "z": -0.22925603296607733, "name": "PINKY_PIP", "type": "right_hand", "index": 18, "frame_index": 2489}, {"x": 0.4784107208251953, "y": 0.4564872682094574, "z": -0.22781744040548801, "name": "PINKY_TIP", "type": "right_hand", "index": 20, "frame_index": 2489}, {"x": 0.47963064908981323, "y": 0.44888460636138916, "z": -0.2288130889646709, "name": "RING_FINGER_DIP", "type": "right_hand", "index": 15, "frame_index": 2489}, {"x": 0.47232216596603394, "y": 0.44771450757980347, "z": -0.22642030927818269, "name": "RING_FINGER_MCP", "type": "right_hand", "index": 13, "frame_index": 2489}, {"x": 0.4783717691898346, "y": 0.4433938264846802, "z": -0.22872083145193756, "name": "RING_FINGER_PIP", "type": "right_hand", "index": 14, "frame_index": 2489}, {"x": 0.47953537106513977, "y": 0.4545518159866333, "z": -0.22810361394658685, "name": "RING_FINGER_TIP", "type": "right_hand", "index": 16, "frame_index": 2489}, {"x": 0.4775426685810089, "y": 0.46593987941741943, "z": -0.22564226109534502, "name": "THUMB_CMC", "type": "right_hand", "index": 1, "frame_index": 2489}, {"x": 0.48223191499710083, "y": 0.4487666189670563, "z": -0.22736300551332533, "name": "THUMB_IP", "type": "right_hand", "index": 3, "frame_index": 2489}, {"x": 0.4807285964488983, "y": 0.45620980858802795, "z": -0.22618492477340624, "name": "THUMB_MCP", "type": "right_hand", "index": 2, "frame_index": 2489}, {"x": 0.48263561725616455, "y": 0.4424790143966675, "z": -0.22834061016328633, "name": "THUMB_TIP", "type": "right_hand", "index": 4, "frame_index": 2489}, {"x": 0.4713098108768463, "y": 0.47646522521972656, "z": -0.22528467806467845, "name": "WRIST", "type": "right_hand", "index": 0, "frame_index": 2489}], [{"x": 0.4778765141963959, "y": 0.7811765074729919, "z": 0.08716527372598648, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2490}, {"x": 0.4917594790458679, "y": 0.39962413907051086, "z": 0.036637790501117706, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2490}, {"x": 0.5000578761100769, "y": 0.5164674520492554, "z": 0.11847404390573502, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2490}, {"x": 0.4902667701244354, "y": 0.3917311728000641, "z": -0.035936977714300156, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2490}, {"x": 0.4885686933994293, "y": 0.3897194266319275, "z": -0.03579678386449814, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2490}, {"x": 0.49193429946899414, "y": 0.39368972182273865, "z": -0.03591124713420868, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2490}, {"x": 0.49011754989624023, "y": 0.8125655055046082, "z": 0.015937475487589836, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2490}, {"x": 0.47405147552490234, "y": 0.7953466176986694, "z": 0.08935031294822693, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2490}, {"x": 0.4926464855670929, "y": 0.5692459940910339, "z": 0.026139426976442337, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2490}, {"x": 0.5157017707824707, "y": 0.5759871006011963, "z": 0.04016762599349022, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2490}, {"x": 0.48758238554000854, "y": 0.6814442276954651, "z": 0.018104495480656624, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2490}, {"x": 0.5147048234939575, "y": 0.576958417892456, "z": 0.05824308842420578, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2490}, {"x": 0.49667975306510925, "y": 0.45223569869995117, "z": 0.08867023885250092, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2490}, {"x": 0.5125925540924072, "y": 0.5708593726158142, "z": 0.05831311270594597, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2490}, {"x": 0.5100079774856567, "y": 0.5622039437294006, "z": 0.06653917580842972, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2490}, {"x": 0.485373854637146, "y": 0.4060211479663849, "z": -0.02380821481347084, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2490}, {"x": 0.4792359173297882, "y": 0.39940619468688965, "z": -0.0355025976896286, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2490}, {"x": 0.48520755767822266, "y": 0.3932556211948395, "z": -0.05141391232609749, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2490}, {"x": 0.4676080048084259, "y": 0.7884528040885925, "z": -0.02586318366229534, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2490}, {"x": 0.47431305050849915, "y": 0.3859671354293823, "z": -0.0008150498033501208, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2490}, {"x": 0.4510782063007355, "y": 0.5052874684333801, "z": -0.09478645771741867, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2490}, {"x": 0.4813981056213379, "y": 0.3831389844417572, "z": -0.043839480727910995, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2490}, {"x": 0.4831221401691437, "y": 0.38413551449775696, "z": -0.04368859902024269, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2490}, {"x": 0.47936326265335083, "y": 0.3824874758720398, "z": -0.04390735924243927, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2490}, {"x": 0.47070440649986267, "y": 0.8250842094421387, "z": -0.1057618111371994, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2490}, {"x": 0.46725380420684814, "y": 0.802661657333374, "z": -0.024046283215284348, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2490}, {"x": 0.46552956104278564, "y": 0.5708694458007812, "z": -0.0262618325650692, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2490}, {"x": 0.4785424768924713, "y": 0.4520969092845917, "z": -0.25161290168762207, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2490}, {"x": 0.46663349866867065, "y": 0.6775060296058655, "z": -0.07783906906843185, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2490}, {"x": 0.47705474495887756, "y": 0.4574553072452545, "z": -0.2460877150297165, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2490}, {"x": 0.4507138431072235, "y": 0.4438340961933136, "z": -0.0040724813006818295, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2490}, {"x": 0.47816145420074463, "y": 0.45745494961738586, "z": -0.22113947570323944, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2490}, {"x": 0.47220611572265625, "y": 0.4684930145740509, "z": -0.21676619350910187, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2490}], [{"x": 0.4778609275817871, "y": 0.7802931666374207, "z": 0.0855461061000824, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2491}, {"x": 0.4921884536743164, "y": 0.39948371052742004, "z": 0.04532811790704727, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2491}, {"x": 0.4994277060031891, "y": 0.5093212723731995, "z": 0.1090259850025177, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2491}, {"x": 0.4906776547431946, "y": 0.3916855752468109, "z": -0.029375635087490082, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2491}, {"x": 0.4889187812805176, "y": 0.3894563913345337, "z": -0.02924000658094883, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2491}, {"x": 0.4922678768634796, "y": 0.39357495307922363, "z": -0.02934911474585533, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2491}, {"x": 0.4898851811885834, "y": 0.8125611543655396, "z": 0.015594085678458214, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2491}, {"x": 0.4737769365310669, "y": 0.7938218712806702, "z": 0.08783825486898422, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2491}, {"x": 0.49241429567337036, "y": 0.569496750831604, "z": 0.02630259282886982, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2491}, {"x": 0.5145865082740784, "y": 0.5434961915016174, "z": 0.016088880598545074, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2491}, {"x": 0.48774898052215576, "y": 0.6815868616104126, "z": 0.017423788085579872, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2491}, {"x": 0.5142503976821899, "y": 0.5459666848182678, "z": 0.03487439453601837, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2491}, {"x": 0.4965774416923523, "y": 0.4495552182197571, "z": 0.09575359523296356, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2491}, {"x": 0.5116856098175049, "y": 0.5403371453285217, "z": 0.035296548157930374, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2491}, {"x": 0.5087519288063049, "y": 0.5348957180976868, "z": 0.04327407106757164, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2491}, {"x": 0.4855291247367859, "y": 0.4055793583393097, "z": -0.017150552943348885, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2491}, {"x": 0.47982433438301086, "y": 0.3986898362636566, "z": -0.028430890291929245, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2491}, {"x": 0.4855997860431671, "y": 0.39262309670448303, "z": -0.04540814831852913, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2491}, {"x": 0.4671252965927124, "y": 0.7870350480079651, "z": -0.0069639598950743675, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2491}, {"x": 0.4750278890132904, "y": 0.3857077658176422, "z": 0.009346435777842999, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2491}, {"x": 0.45400819182395935, "y": 0.49953922629356384, "z": -0.08748608082532883, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2491}, {"x": 0.4819422960281372, "y": 0.38280385732650757, "z": -0.03700815141201019, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2491}, {"x": 0.4837644398212433, "y": 0.3837442994117737, "z": -0.036857061088085175, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2491}, {"x": 0.48015880584716797, "y": 0.38214802742004395, "z": -0.03707514703273773, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2491}, {"x": 0.4706510007381439, "y": 0.8250318169593811, "z": -0.08102497458457947, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2491}, {"x": 0.4663834273815155, "y": 0.7992163896560669, "z": -0.0037307278253138065, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2491}, {"x": 0.46552616357803345, "y": 0.5709013342857361, "z": -0.026428481563925743, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2491}, {"x": 0.4790729284286499, "y": 0.4500291645526886, "z": -0.24562498927116394, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2491}, {"x": 0.4664697051048279, "y": 0.6775423884391785, "z": -0.07049152255058289, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2491}, {"x": 0.4779197871685028, "y": 0.45513424277305603, "z": -0.24205514788627625, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2491}, {"x": 0.45080533623695374, "y": 0.44307222962379456, "z": 0.0050592925399541855, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2491}, {"x": 0.47852200269699097, "y": 0.45546820759773254, "z": -0.21907755732536316, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2491}, {"x": 0.4727187752723694, "y": 0.4659847021102905, "z": -0.2151530236005783, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2491}], [{"x": 0.4777145981788635, "y": 0.7800067067146301, "z": 0.06913430243730545, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2492}, {"x": 0.4931122362613678, "y": 0.3993968963623047, "z": 0.06256003677845001, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2492}, {"x": 0.4971279799938202, "y": 0.5103179216384888, "z": 0.09422189742326736, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2492}, {"x": 0.4907887876033783, "y": 0.3909982144832611, "z": -0.01097180787473917, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2492}, {"x": 0.48889562487602234, "y": 0.38828784227371216, "z": -0.010857674293220043, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2492}, {"x": 0.4924624264240265, "y": 0.393169105052948, "z": -0.01093344297260046, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2492}, {"x": 0.4898211359977722, "y": 0.812559187412262, "z": 0.0012637486215680838, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2492}, {"x": 0.47276344895362854, "y": 0.7937256693840027, "z": 0.06998755037784576, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2492}, {"x": 0.4923875033855438, "y": 0.5702312588691711, "z": 0.027554119005799294, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2492}, {"x": 0.5127229690551758, "y": 0.5064571499824524, "z": -0.04895440489053726, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2492}, {"x": 0.48786458373069763, "y": 0.681735634803772, "z": 0.016480261459946632, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2492}, {"x": 0.5125253200531006, "y": 0.5146426558494568, "z": -0.03644580394029617, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2492}, {"x": 0.49645423889160156, "y": 0.449712872505188, "z": 0.10858367383480072, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2492}, {"x": 0.5103433728218079, "y": 0.5071540474891663, "z": -0.025640279054641724, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2492}, {"x": 0.5083599090576172, "y": 0.5156620144844055, "z": -0.01764640212059021, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2492}, {"x": 0.4855670928955078, "y": 0.40411847829818726, "z": 0.0004762681492138654, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2492}, {"x": 0.47981566190719604, "y": 0.39738908410072327, "z": -0.011656061746180058, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2492}, {"x": 0.4855514466762543, "y": 0.3912315368652344, "z": -0.027223972603678703, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2492}, {"x": 0.46635958552360535, "y": 0.7861304879188538, "z": -0.02828144282102585, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2492}, {"x": 0.47566238045692444, "y": 0.38486039638519287, "z": 0.02367520146071911, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2492}, {"x": 0.455230712890625, "y": 0.49338892102241516, "z": -0.06790414452552795, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2492}, {"x": 0.4820675253868103, "y": 0.38203394412994385, "z": -0.019285324960947037, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2492}, {"x": 0.48381805419921875, "y": 0.38289588689804077, "z": -0.019131332635879517, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2492}, {"x": 0.48042038083076477, "y": 0.3812331557273865, "z": -0.01934277079999447, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2492}, {"x": 0.47065824270248413, "y": 0.8247244954109192, "z": -0.10305269807577133, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2492}, {"x": 0.4649588465690613, "y": 0.7989383339881897, "z": -0.02647964470088482, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2492}, {"x": 0.4655078947544098, "y": 0.5711721777915955, "z": -0.02767212502658367, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2492}, {"x": 0.4789200723171234, "y": 0.4389951825141907, "z": -0.20008571445941925, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2492}, {"x": 0.4662669599056244, "y": 0.6774373054504395, "z": -0.07763435691595078, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2492}, {"x": 0.478830486536026, "y": 0.4442072808742523, "z": -0.20442456007003784, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2492}, {"x": 0.451270192861557, "y": 0.4416404068470001, "z": 0.016013795509934425, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2492}, {"x": 0.4780942499637604, "y": 0.4436919689178467, "z": -0.17574448883533478, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2492}, {"x": 0.4735097587108612, "y": 0.4547337293624878, "z": -0.17461195588111877, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2492}, {"x": 0.4860524833202362, "y": 0.43934622406959534, "z": -0.17932936223223805, "name": "INDEX_FINGER_DIP", "type": "right_hand", "index": 7, "frame_index": 2492}, {"x": 0.48163655400276184, "y": 0.4405663013458252, "z": -0.17590630159247667, "name": "INDEX_FINGER_MCP", "type": "right_hand", "index": 5, "frame_index": 2492}, {"x": 0.48472991585731506, "y": 0.4357146918773651, "z": -0.1779957797843963, "name": "INDEX_FINGER_PIP", "type": "right_hand", "index": 6, "frame_index": 2492}, {"x": 0.4861130714416504, "y": 0.44337600469589233, "z": -0.17988413106650114, "name": "INDEX_FINGER_TIP", "type": "right_hand", "index": 8, "frame_index": 2492}, {"x": 0.4837687611579895, "y": 0.44429701566696167, "z": -0.18102803779765964, "name": "MIDDLE_FINGER_DIP", "type": "right_hand", "index": 11, "frame_index": 2492}, {"x": 0.47930610179901123, "y": 0.44086554646492004, "z": -0.17690287926234305, "name": "MIDDLE_FINGER_MCP", "type": "right_hand", "index": 9, "frame_index": 2492}, {"x": 0.4828924238681793, "y": 0.4387911260128021, "z": -0.17955907760187984, "name": "MIDDLE_FINGER_PIP", "type": "right_hand", "index": 10, "frame_index": 2492}, {"x": 0.48332157731056213, "y": 0.4489805996417999, "z": -0.18154836725443602, "name": "MIDDLE_FINGER_TIP", "type": "right_hand", "index": 12, "frame_index": 2492}, {"x": 0.47330260276794434, "y": 0.435090035200119, "z": -0.18132928805425763, "name": "PINKY_DIP", "type": "right_hand", "index": 19, "frame_index": 2492}, {"x": 0.47396430373191833, "y": 0.444129079580307, "z": -0.17903273459523916, "name": "PINKY_MCP", "type": "right_hand", "index": 17, "frame_index": 2492}, {"x": 0.47364333271980286, "y": 0.43861037492752075, "z": -0.1807415084913373, "name": "PINKY_PIP", "type": "right_hand", "index": 18, "frame_index": 2492}, {"x": 0.47286704182624817, "y": 0.4318500757217407, "z": -0.18149435799568892, "name": "PINKY_TIP", "type": "right_hand", "index": 20, "frame_index": 2492}, {"x": 0.48097822070121765, "y": 0.44502338767051697, "z": -0.18153708102181554, "name": "RING_FINGER_DIP", "type": "right_hand", "index": 15, "frame_index": 2492}, {"x": 0.4766341745853424, "y": 0.4421447217464447, "z": -0.17801420320756733, "name": "RING_FINGER_MCP", "type": "right_hand", "index": 13, "frame_index": 2492}, {"x": 0.479610413312912, "y": 0.44057556986808777, "z": -0.18056564358994365, "name": "RING_FINGER_PIP", "type": "right_hand", "index": 14, "frame_index": 2492}, {"x": 0.4813244342803955, "y": 0.44849294424057007, "z": -0.18166426988318563, "name": "RING_FINGER_TIP", "type": "right_hand", "index": 16, "frame_index": 2492}, {"x": 0.47861120104789734, "y": 0.45434197783470154, "z": -0.1749076676205732, "name": "THUMB_CMC", "type": "right_hand", "index": 1, "frame_index": 2492}, {"x": 0.48578518629074097, "y": 0.4450768828392029, "z": -0.176506690797396, "name": "THUMB_IP", "type": "right_hand", "index": 3, "frame_index": 2492}, {"x": 0.4829173684120178, "y": 0.4495050311088562, "z": -0.17556707712356, "name": "THUMB_MCP", "type": "right_hand", "index": 2, "frame_index": 2492}, {"x": 0.4870392978191376, "y": 0.44135111570358276, "z": -0.17744945385493338, "name": "THUMB_TIP", "type": "right_hand", "index": 4, "frame_index": 2492}, {"x": 0.4734463095664978, "y": 0.45832809805870056, "z": -0.17461197770063563, "name": "WRIST", "type": "right_hand", "index": 0, "frame_index": 2492}], [{"x": 0.47758159041404724, "y": 0.7790823578834534, "z": 0.0820203498005867, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2493}, {"x": 0.4935581088066101, "y": 0.3993667662143707, "z": 0.0579630471765995, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2493}, {"x": 0.49946558475494385, "y": 0.5111797451972961, "z": 0.04949093982577324, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2493}, {"x": 0.4911651015281677, "y": 0.39022156596183777, "z": -0.014980209991335869, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2493}, {"x": 0.4891178011894226, "y": 0.38710248470306396, "z": -0.014868012629449368, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2493}, {"x": 0.4927579164505005, "y": 0.3926647901535034, "z": -0.014942219480872154, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2493}, {"x": 0.48985210061073303, "y": 0.8123942613601685, "z": 0.008871067315340042, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2493}, {"x": 0.47207096219062805, "y": 0.7928783893585205, "z": 0.0840177908539772, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2493}, {"x": 0.4922771453857422, "y": 0.5702482461929321, "z": 0.027603860944509506, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2493}, {"x": 0.507523238658905, "y": 0.5036196708679199, "z": -0.13677705824375153, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2493}, {"x": 0.48793378472328186, "y": 0.6817511320114136, "z": 0.01847197860479355, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2493}, {"x": 0.5083562731742859, "y": 0.5098753571510315, "z": -0.1272210329771042, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2493}, {"x": 0.49638909101486206, "y": 0.449631005525589, "z": 0.09882485121488571, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2493}, {"x": 0.5051769614219666, "y": 0.5010457634925842, "z": -0.10712964087724686, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2493}, {"x": 0.5067489743232727, "y": 0.5075487494468689, "z": -0.0992727279663086, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2493}, {"x": 0.4857538938522339, "y": 0.4031769633293152, "z": -0.0038720821030437946, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2493}, {"x": 0.4798964560031891, "y": 0.39611703157424927, "z": -0.013736412860453129, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2493}, {"x": 0.48559442162513733, "y": 0.3896902799606323, "z": -0.03110312484204769, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2493}, {"x": 0.4660341143608093, "y": 0.7850079536437988, "z": -0.01760619319975376, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2493}, {"x": 0.4762781858444214, "y": 0.3838897943496704, "z": 0.027038145810365677, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2493}, {"x": 0.45454612374305725, "y": 0.4930671453475952, "z": -0.06811057031154633, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2493}, {"x": 0.4822438359260559, "y": 0.3812209665775299, "z": -0.021558744832873344, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2493}, {"x": 0.48401710391044617, "y": 0.3820631802082062, "z": -0.021421590819954872, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2493}, {"x": 0.4807285666465759, "y": 0.3803083896636963, "z": -0.021611148491501808, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2493}, {"x": 0.47153690457344055, "y": 0.8232854008674622, "z": -0.09714741259813309, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2493}, {"x": 0.46405258774757385, "y": 0.7984639406204224, "z": -0.0152493417263031, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2493}, {"x": 0.4654669761657715, "y": 0.5711117386817932, "z": -0.027721023187041283, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2493}, {"x": 0.4783025085926056, "y": 0.43671682476997375, "z": -0.21469072997570038, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2493}, {"x": 0.4662395119667053, "y": 0.6775162816047668, "z": -0.07275272905826569, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2493}, {"x": 0.47753217816352844, "y": 0.443252295255661, "z": -0.21627753973007202, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2493}, {"x": 0.4516764283180237, "y": 0.43924838304519653, "z": 0.020207567140460014, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2493}, {"x": 0.47748830914497375, "y": 0.4413849413394928, "z": -0.18824109435081482, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2493}, {"x": 0.47240400314331055, "y": 0.45260903239250183, "z": -0.1864495724439621, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2493}], [{"x": 0.47756922245025635, "y": 0.7787442207336426, "z": 0.08160759508609772, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2494}, {"x": 0.4940360486507416, "y": 0.3973252475261688, "z": 0.044829972088336945, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2494}, {"x": 0.5009346604347229, "y": 0.5093256831169128, "z": 0.009018934331834316, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2494}, {"x": 0.49150002002716064, "y": 0.38833871483802795, "z": -0.026509026065468788, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2494}, {"x": 0.4894202947616577, "y": 0.38538894057273865, "z": -0.026406288146972656, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2494}, {"x": 0.49302026629447937, "y": 0.39096924662590027, "z": -0.026466717943549156, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2494}, {"x": 0.4898819923400879, "y": 0.81235671043396, "z": 0.009883360005915165, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2494}, {"x": 0.4719758927822113, "y": 0.7924275994300842, "z": 0.08394605666399002, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2494}, {"x": 0.49226808547973633, "y": 0.57027268409729, "z": 0.024661071598529816, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2494}, {"x": 0.49735206365585327, "y": 0.45167943835258484, "z": -0.17522947490215302, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2494}, {"x": 0.4879089593887329, "y": 0.6818256974220276, "z": 0.01352978777140379, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2494}, {"x": 0.49777188897132874, "y": 0.45684167742729187, "z": -0.171843022108078, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2494}, {"x": 0.4971078336238861, "y": 0.4494379162788391, "z": 0.0828380361199379, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2494}, {"x": 0.49578142166137695, "y": 0.45814087986946106, "z": -0.14773234724998474, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2494}, {"x": 0.4992941617965698, "y": 0.470863938331604, "z": -0.14238356053829193, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2494}, {"x": 0.4866976737976074, "y": 0.40043655037879944, "z": -0.01508145872503519, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2494}, {"x": 0.4806486666202545, "y": 0.39443960785865784, "z": -0.02368726022541523, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2494}, {"x": 0.4861612915992737, "y": 0.38788604736328125, "z": -0.041815679520368576, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2494}, {"x": 0.4660734236240387, "y": 0.7843888401985168, "z": -0.01093294657766819, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2494}, {"x": 0.4771604537963867, "y": 0.38305673003196716, "z": 0.018472177907824516, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2494}, {"x": 0.45380041003227234, "y": 0.49250370264053345, "z": -0.06331208348274231, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2494}, {"x": 0.48262470960617065, "y": 0.37964946031570435, "z": -0.03205433860421181, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2494}, {"x": 0.4845893085002899, "y": 0.3806461691856384, "z": -0.03191152960062027, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2494}, {"x": 0.48122721910476685, "y": 0.3786357641220093, "z": -0.03210609406232834, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2494}, {"x": 0.4726327061653137, "y": 0.8227002024650574, "z": -0.08938351273536682, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2494}, {"x": 0.46384546160697937, "y": 0.7982323169708252, "z": -0.008477519266307354, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2494}, {"x": 0.4654678404331207, "y": 0.5710555911064148, "z": -0.0247871782630682, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2494}, {"x": 0.47787803411483765, "y": 0.43587467074394226, "z": -0.20727509260177612, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2494}, {"x": 0.4663395881652832, "y": 0.6776282787322998, "z": -0.06743660569190979, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2494}, {"x": 0.476826936006546, "y": 0.44099879264831543, "z": -0.2108556479215622, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2494}, {"x": 0.45313531160354614, "y": 0.4369022250175476, "z": 0.02012748457491398, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2494}, {"x": 0.4771084487438202, "y": 0.44128674268722534, "z": -0.1809329092502594, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2494}, {"x": 0.4717946946620941, "y": 0.45145511627197266, "z": -0.1791761964559555, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2494}, {"x": 0.48998215794563293, "y": 0.43683433532714844, "z": -0.14252848931937478, "name": "INDEX_FINGER_DIP", "type": "left_hand", "index": 7, "frame_index": 2494}, {"x": 0.4920305907726288, "y": 0.44930487871170044, "z": -0.14091911760624498, "name": "INDEX_FINGER_MCP", "type": "left_hand", "index": 5, "frame_index": 2494}, {"x": 0.49071407318115234, "y": 0.44123345613479614, "z": -0.1418770902673714, "name": "INDEX_FINGER_PIP", "type": "left_hand", "index": 6, "frame_index": 2494}, {"x": 0.4895971119403839, "y": 0.4333231449127197, "z": -0.14278433957952075, "name": "INDEX_FINGER_TIP", "type": "left_hand", "index": 8, "frame_index": 2494}, {"x": 0.49307844042778015, "y": 0.4338701665401459, "z": -0.14380692318081856, "name": "MIDDLE_FINGER_DIP", "type": "left_hand", "index": 11, "frame_index": 2494}, {"x": 0.4940566420555115, "y": 0.44904381036758423, "z": -0.14179456286365166, "name": "MIDDLE_FINGER_MCP", "type": "left_hand", "index": 9, "frame_index": 2494}, {"x": 0.49371108412742615, "y": 0.4395301043987274, "z": -0.1429903779644519, "name": "MIDDLE_FINGER_PIP", "type": "left_hand", "index": 10, "frame_index": 2494}, {"x": 0.49275699257850647, "y": 0.4296405613422394, "z": -0.1440698535880074, "name": "MIDDLE_FINGER_TIP", "type": "left_hand", "index": 12, "frame_index": 2494}, {"x": 0.495862752199173, "y": 0.44811728596687317, "z": -0.14414767501875758, "name": "PINKY_DIP", "type": "left_hand", "index": 19, "frame_index": 2494}, {"x": 0.4985862672328949, "y": 0.4520609974861145, "z": -0.14400869642850012, "name": "PINKY_MCP", "type": "left_hand", "index": 17, "frame_index": 2494}, {"x": 0.49770259857177734, "y": 0.44765034317970276, "z": -0.14453493431210518, "name": "PINKY_PIP", "type": "left_hand", "index": 18, "frame_index": 2494}, {"x": 0.4945700168609619, "y": 0.4497697055339813, "z": -0.14359140698798, "name": "PINKY_TIP", "type": "left_hand", "index": 20, "frame_index": 2494}, {"x": 0.4933430850505829, "y": 0.44897839426994324, "z": -0.1450554863549769, "name": "RING_FINGER_DIP", "type": "left_hand", "index": 15, "frame_index": 2494}, {"x": 0.4962823688983917, "y": 0.45014235377311707, "z": -0.1428904245258309, "name": "RING_FINGER_MCP", "type": "left_hand", "index": 13, "frame_index": 2494}, {"x": 0.4951026737689972, "y": 0.44549360871315, "z": -0.14461810188367963, "name": "RING_FINGER_PIP", "type": "left_hand", "index": 14, "frame_index": 2494}, {"x": 0.4925686717033386, "y": 0.4531683623790741, "z": -0.14463857701048255, "name": "RING_FINGER_TIP", "type": "left_hand", "index": 16, "frame_index": 2494}, {"x": 0.49220260977745056, "y": 0.46371030807495117, "z": -0.14236575536051532, "name": "THUMB_CMC", "type": "left_hand", "index": 1, "frame_index": 2494}, {"x": 0.49166297912597656, "y": 0.4493613541126251, "z": -0.1430713810841553, "name": "THUMB_IP", "type": "left_hand", "index": 3, "frame_index": 2494}, {"x": 0.49104130268096924, "y": 0.45584893226623535, "z": -0.14246781436668243, "name": "THUMB_MCP", "type": "left_hand", "index": 2, "frame_index": 2494}, {"x": 0.4931964576244354, "y": 0.44639214873313904, "z": -0.14356837479863316, "name": "THUMB_TIP", "type": "left_hand", "index": 4, "frame_index": 2494}, {"x": 0.49574077129364014, "y": 0.47116270661354065, "z": -0.1423835497626742, "name": "WRIST", "type": "left_hand", "index": 0, "frame_index": 2494}], [{"x": 0.4775550067424774, "y": 0.7788113355636597, "z": 0.08663805574178696, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2495}, {"x": 0.4941829741001129, "y": 0.39574792981147766, "z": 0.045287054032087326, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2495}, {"x": 0.506598711013794, "y": 0.5043200850486755, "z": 0.01982676424086094, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2495}, {"x": 0.4914666414260864, "y": 0.3874887526035309, "z": -0.02770467847585678, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2495}, {"x": 0.48949307203292847, "y": 0.38507524132728577, "z": -0.0276101753115654, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2495}, {"x": 0.49300214648246765, "y": 0.38966238498687744, "z": -0.027654673904180527, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2495}, {"x": 0.48986658453941345, "y": 0.8123534321784973, "z": 0.014957337640225887, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2495}, {"x": 0.4719839096069336, "y": 0.7926422953605652, "z": 0.09004024416208267, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2495}, {"x": 0.49224159121513367, "y": 0.5701509118080139, "z": 0.023677190765738487, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2495}, {"x": 0.49154630303382874, "y": 0.4351021945476532, "z": -0.1543228030204773, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2495}, {"x": 0.48788076639175415, "y": 0.6818482279777527, "z": 0.012539072893559933, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2495}, {"x": 0.49214792251586914, "y": 0.439446359872818, "z": -0.15320773422718048, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2495}, {"x": 0.49793100357055664, "y": 0.4459491968154907, "z": 0.08459494262933731, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2495}, {"x": 0.4907534420490265, "y": 0.4419580399990082, "z": -0.12907841801643372, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2495}, {"x": 0.4950332045555115, "y": 0.4548582434654236, "z": -0.12528544664382935, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2495}, {"x": 0.4868304133415222, "y": 0.40054091811180115, "z": -0.015085840597748756, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2495}, {"x": 0.48080721497535706, "y": 0.3946877121925354, "z": -0.02359699457883835, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2495}, {"x": 0.4861741364002228, "y": 0.3881691098213196, "z": -0.04281748831272125, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2495}, {"x": 0.46610164642333984, "y": 0.7844643592834473, "z": -0.0035417729523032904, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2495}, {"x": 0.47712844610214233, "y": 0.3829043209552765, "z": 0.019389750435948372, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2495}, {"x": 0.4533533751964569, "y": 0.4909813702106476, "z": -0.0550885908305645, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2495}, {"x": 0.4826327860355377, "y": 0.379658579826355, "z": -0.03310640901327133, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2495}, {"x": 0.4845428764820099, "y": 0.38065335154533386, "z": -0.03296832740306854, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2495}, {"x": 0.4811709523200989, "y": 0.3786427676677704, "z": -0.03315029665827751, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2495}, {"x": 0.47281932830810547, "y": 0.8226801753044128, "z": -0.08416711539030075, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2495}, {"x": 0.4639177620410919, "y": 0.7984240651130676, "z": -0.0007483718218281865, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2495}, {"x": 0.4654460847377777, "y": 0.5708081126213074, "z": -0.023802420124411583, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2495}, {"x": 0.4775939881801605, "y": 0.42951416969299316, "z": -0.19739460945129395, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2495}, {"x": 0.4667021930217743, "y": 0.6780648231506348, "z": -0.06452488154172897, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2495}, {"x": 0.4767701029777527, "y": 0.4337478280067444, "z": -0.20295928418636322, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2495}, {"x": 0.4537854790687561, "y": 0.4347943663597107, "z": 0.027766192331910133, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2495}, {"x": 0.4769495725631714, "y": 0.43478819727897644, "z": -0.17263466119766235, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2495}, {"x": 0.47201550006866455, "y": 0.4445255398750305, "z": -0.17165638506412506, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2495}, {"x": 0.48529934883117676, "y": 0.42064836621284485, "z": -0.12713361019268632, "name": "INDEX_FINGER_DIP", "type": "left_hand", "index": 7, "frame_index": 2495}, {"x": 0.48778173327445984, "y": 0.4301735758781433, "z": -0.12367863429244608, "name": "INDEX_FINGER_MCP", "type": "left_hand", "index": 5, "frame_index": 2495}, {"x": 0.486724853515625, "y": 0.41978350281715393, "z": -0.12563764452352189, "name": "INDEX_FINGER_PIP", "type": "left_hand", "index": 6, "frame_index": 2495}, {"x": 0.48503053188323975, "y": 0.4244101941585541, "z": -0.12779230973683298, "name": "INDEX_FINGER_TIP", "type": "left_hand", "index": 8, "frame_index": 2495}, {"x": 0.4864937365055084, "y": 0.4284649193286896, "z": -0.12792503042146564, "name": "MIDDLE_FINGER_DIP", "type": "left_hand", "index": 11, "frame_index": 2495}, {"x": 0.48993030190467834, "y": 0.43099990487098694, "z": -0.1249535157403443, "name": "MIDDLE_FINGER_MCP", "type": "left_hand", "index": 9, "frame_index": 2495}, {"x": 0.48794427514076233, "y": 0.42449504137039185, "z": -0.1268636779859662, "name": "MIDDLE_FINGER_PIP", "type": "left_hand", "index": 10, "frame_index": 2495}, {"x": 0.48646700382232666, "y": 0.4333568811416626, "z": -0.12827732902951539, "name": "MIDDLE_FINGER_TIP", "type": "left_hand", "index": 12, "frame_index": 2495}, {"x": 0.49031752347946167, "y": 0.4298308193683624, "z": -0.12822770909406245, "name": "PINKY_DIP", "type": "left_hand", "index": 19, "frame_index": 2495}, {"x": 0.494748592376709, "y": 0.43359506130218506, "z": -0.1280175386928022, "name": "PINKY_MCP", "type": "left_hand", "index": 17, "frame_index": 2495}, {"x": 0.49259787797927856, "y": 0.4285346269607544, "z": -0.1285359552130103, "name": "PINKY_PIP", "type": "left_hand", "index": 18, "frame_index": 2495}, {"x": 0.4890250861644745, "y": 0.4327116012573242, "z": -0.12780418945476413, "name": "PINKY_TIP", "type": "left_hand", "index": 20, "frame_index": 2495}, {"x": 0.48799628019332886, "y": 0.42972761392593384, "z": -0.12803330761380494, "name": "RING_FINGER_DIP", "type": "left_hand", "index": 15, "frame_index": 2495}, {"x": 0.49217119812965393, "y": 0.43215951323509216, "z": -0.1264742307830602, "name": "RING_FINGER_MCP", "type": "left_hand", "index": 13, "frame_index": 2495}, {"x": 0.48990005254745483, "y": 0.4262523353099823, "z": -0.12788676074706018, "name": "RING_FINGER_PIP", "type": "left_hand", "index": 14, "frame_index": 2495}, {"x": 0.4875927269458771, "y": 0.43453311920166016, "z": -0.12781040603294969, "name": "RING_FINGER_TIP", "type": "left_hand", "index": 16, "frame_index": 2495}, {"x": 0.48819342255592346, "y": 0.44569796323776245, "z": -0.12455262301955372, "name": "THUMB_CMC", "type": "left_hand", "index": 1, "frame_index": 2495}, {"x": 0.4835854470729828, "y": 0.4321158528327942, "z": -0.12543761434790213, "name": "THUMB_IP", "type": "left_hand", "index": 3, "frame_index": 2495}, {"x": 0.4852546751499176, "y": 0.43844079971313477, "z": -0.1246432465268299, "name": "THUMB_MCP", "type": "left_hand", "index": 2, "frame_index": 2495}, {"x": 0.48351049423217773, "y": 0.4276571273803711, "z": -0.12615131365600973, "name": "THUMB_TIP", "type": "left_hand", "index": 4, "frame_index": 2495}, {"x": 0.49343210458755493, "y": 0.4533545672893524, "z": -0.12528548584618449, "name": "WRIST", "type": "left_hand", "index": 0, "frame_index": 2495}, {"x": 0.485726922750473, "y": 0.42024874687194824, "z": -0.17950570583343506, "name": "INDEX_FINGER_DIP", "type": "right_hand", "index": 7, "frame_index": 2495}, {"x": 0.4799101650714874, "y": 0.4261619746685028, "z": -0.17457207012921572, "name": "INDEX_FINGER_MCP", "type": "right_hand", "index": 5, "frame_index": 2495}, {"x": 0.48391878604888916, "y": 0.4174974858760834, "z": -0.17759885312989354, "name": "INDEX_FINGER_PIP", "type": "right_hand", "index": 6, "frame_index": 2495}, {"x": 0.48651838302612305, "y": 0.4249475300312042, "z": -0.18043330870568752, "name": "INDEX_FINGER_TIP", "type": "right_hand", "index": 8, "frame_index": 2495}, {"x": 0.4813005030155182, "y": 0.42768654227256775, "z": -0.18059424497187138, "name": "MIDDLE_FINGER_DIP", "type": "right_hand", "index": 11, "frame_index": 2495}, {"x": 0.4770202338695526, "y": 0.4261632561683655, "z": -0.17552457586862147, "name": "MIDDLE_FINGER_MCP", "type": "right_hand", "index": 9, "frame_index": 2495}, {"x": 0.4802057445049286, "y": 0.4222818911075592, "z": -0.1789298001676798, "name": "MIDDLE_FINGER_PIP", "type": "right_hand", "index": 10, "frame_index": 2495}, {"x": 0.4812643826007843, "y": 0.433260053396225, "z": -0.18128614593297243, "name": "MIDDLE_FINGER_TIP", "type": "right_hand", "index": 12, "frame_index": 2495}, {"x": 0.4742700457572937, "y": 0.42661088705062866, "z": -0.18032291531562805, "name": "PINKY_DIP", "type": "right_hand", "index": 19, "frame_index": 2495}, {"x": 0.4710404574871063, "y": 0.4309714138507843, "z": -0.17787357605993748, "name": "PINKY_MCP", "type": "right_hand", "index": 17, "frame_index": 2495}, {"x": 0.4723668396472931, "y": 0.42636439204216003, "z": -0.1800300581380725, "name": "PINKY_PIP", "type": "right_hand", "index": 18, "frame_index": 2495}, {"x": 0.47580358386039734, "y": 0.42851752042770386, "z": -0.18012983351945877, "name": "PINKY_TIP", "type": "right_hand", "index": 20, "frame_index": 2495}, {"x": 0.4781630337238312, "y": 0.42732545733451843, "z": -0.18012080620974302, "name": "RING_FINGER_DIP", "type": "right_hand", "index": 15, "frame_index": 2495}, {"x": 0.47398674488067627, "y": 0.4279589056968689, "z": -0.17666671937331557, "name": "RING_FINGER_MCP", "type": "right_hand", "index": 13, "frame_index": 2495}, {"x": 0.4766896367073059, "y": 0.42398107051849365, "z": -0.1795345265418291, "name": "RING_FINGER_PIP", "type": "right_hand", "index": 14, "frame_index": 2495}, {"x": 0.4787038266658783, "y": 0.4315091073513031, "z": -0.18006075080484152, "name": "RING_FINGER_TIP", "type": "right_hand", "index": 16, "frame_index": 2495}, {"x": 0.4758701026439667, "y": 0.44114020466804504, "z": -0.172821496729739, "name": "THUMB_CMC", "type": "right_hand", "index": 1, "frame_index": 2495}, {"x": 0.482181191444397, "y": 0.43290337920188904, "z": -0.1762016974389553, "name": "THUMB_IP", "type": "right_hand", "index": 3, "frame_index": 2495}, {"x": 0.47999119758605957, "y": 0.4369843602180481, "z": -0.17437113914638758, "name": "THUMB_MCP", "type": "right_hand", "index": 2, "frame_index": 2495}, {"x": 0.4837185740470886, "y": 0.42897269129753113, "z": -0.1780173359438777, "name": "THUMB_TIP", "type": "right_hand", "index": 4, "frame_index": 2495}, {"x": 0.47042614221572876, "y": 0.44533053040504456, "z": -0.17165638473544503, "name": "WRIST", "type": "right_hand", "index": 0, "frame_index": 2495}], [{"x": 0.47755077481269836, "y": 0.7792322039604187, "z": 0.07607328146696091, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2496}, {"x": 0.49479004740715027, "y": 0.3948952257633209, "z": 0.037113387137651443, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2496}, {"x": 0.5072771906852722, "y": 0.4885730743408203, "z": -0.016714690253138542, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2496}, {"x": 0.4914860129356384, "y": 0.3866903483867645, "z": -0.03378390520811081, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2496}, {"x": 0.4894932806491852, "y": 0.38457927107810974, "z": -0.03367964178323746, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2496}, {"x": 0.49310970306396484, "y": 0.388604074716568, "z": -0.03373982384800911, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2496}, {"x": 0.4898628890514374, "y": 0.8124168515205383, "z": 0.0012820946285501122, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2496}, {"x": 0.4719923734664917, "y": 0.7933838963508606, "z": 0.07892309129238129, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2496}, {"x": 0.4921942353248596, "y": 0.5701695680618286, "z": 0.018068956211209297, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2496}, {"x": 0.4873257577419281, "y": 0.4224061369895935, "z": -0.17952655255794525, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2496}, {"x": 0.4876825213432312, "y": 0.6818940043449402, "z": 0.004753832705318928, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2496}, {"x": 0.48759064078330994, "y": 0.4271741807460785, "z": -0.18197321891784668, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2496}, {"x": 0.4987844228744507, "y": 0.4446009397506714, "z": 0.06963600963354111, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2496}, {"x": 0.4871678650379181, "y": 0.4272480607032776, "z": -0.15556035935878754, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2496}, {"x": 0.4914467930793762, "y": 0.44089460372924805, "z": -0.15314432978630066, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2496}, {"x": 0.48692217469215393, "y": 0.4005465805530548, "z": -0.02168678492307663, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2496}, {"x": 0.4807916581630707, "y": 0.39490801095962524, "z": -0.02790282852947712, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2496}, {"x": 0.4861273169517517, "y": 0.3883368670940399, "z": -0.048420872539281845, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2496}, {"x": 0.4661330580711365, "y": 0.7845789790153503, "z": -0.0032451015431433916, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2496}, {"x": 0.4774574637413025, "y": 0.38295742869377136, "z": 0.01944522187113762, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2496}, {"x": 0.4543699622154236, "y": 0.48268380761146545, "z": -0.05866336077451706, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2496}, {"x": 0.48269122838974, "y": 0.379716694355011, "z": -0.03741128742694855, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2496}, {"x": 0.48448407649993896, "y": 0.38066476583480835, "z": -0.037273891270160675, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2496}, {"x": 0.481174111366272, "y": 0.3787524998188019, "z": -0.037451278418302536, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2496}, {"x": 0.47277551889419556, "y": 0.8228799104690552, "z": -0.08431994169950485, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2496}, {"x": 0.4640270173549652, "y": 0.7984852194786072, "z": -0.0008880617097020149, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2496}, {"x": 0.46538886427879333, "y": 0.5708496570587158, "z": -0.018190421164035797, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2496}, {"x": 0.477085143327713, "y": 0.4199283719062805, "z": -0.2022869884967804, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2496}, {"x": 0.4669915735721588, "y": 0.6784214377403259, "z": -0.06129048764705658, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2496}, {"x": 0.47659286856651306, "y": 0.4242466390132904, "z": -0.2077106088399887, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2496}, {"x": 0.4547621011734009, "y": 0.4331999123096466, "z": 0.029689908027648926, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2496}, {"x": 0.47652190923690796, "y": 0.4250040352344513, "z": -0.17812199890613556, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2496}, {"x": 0.4719638228416443, "y": 0.43614521622657776, "z": -0.17680573463439941, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2496}, {"x": 0.48032641410827637, "y": 0.40583425760269165, "z": -0.15474933292716742, "name": "INDEX_FINGER_DIP", "type": "left_hand", "index": 7, "frame_index": 2496}, {"x": 0.48438560962677, "y": 0.4153434932231903, "z": -0.15141453640535474, "name": "INDEX_FINGER_MCP", "type": "left_hand", "index": 5, "frame_index": 2496}, {"x": 0.4826057553291321, "y": 0.4078823924064636, "z": -0.1532093226123834, "name": "INDEX_FINGER_PIP", "type": "left_hand", "index": 6, "frame_index": 2496}, {"x": 0.47861918807029724, "y": 0.4053056836128235, "z": -0.1555665961932391, "name": "INDEX_FINGER_TIP", "type": "left_hand", "index": 8, "frame_index": 2496}, {"x": 0.4824349880218506, "y": 0.40696412324905396, "z": -0.1557137230411172, "name": "MIDDLE_FINGER_DIP", "type": "left_hand", "index": 11, "frame_index": 2496}, {"x": 0.48688238859176636, "y": 0.4158172011375427, "z": -0.15282954918802716, "name": "MIDDLE_FINGER_MCP", "type": "left_hand", "index": 9, "frame_index": 2496}, {"x": 0.48479682207107544, "y": 0.4085824489593506, "z": -0.15450088470242918, "name": "MIDDLE_FINGER_PIP", "type": "left_hand", "index": 10, "frame_index": 2496}, {"x": 0.4805857837200165, "y": 0.4064972400665283, "z": -0.15626319637522101, "name": "MIDDLE_FINGER_TIP", "type": "left_hand", "index": 12, "frame_index": 2496}, {"x": 0.4868572950363159, "y": 0.42145586013793945, "z": -0.15648718154989183, "name": "PINKY_DIP", "type": "left_hand", "index": 19, "frame_index": 2496}, {"x": 0.4921700060367584, "y": 0.420483261346817, "z": -0.1561532572377473, "name": "PINKY_MCP", "type": "left_hand", "index": 17, "frame_index": 2496}, {"x": 0.48896780610084534, "y": 0.41748517751693726, "z": -0.15717493603006005, "name": "PINKY_PIP", "type": "left_hand", "index": 18, "frame_index": 2496}, {"x": 0.4858170449733734, "y": 0.4264489412307739, "z": -0.1555974232032895, "name": "PINKY_TIP", "type": "left_hand", "index": 20, "frame_index": 2496}, {"x": 0.4847519099712372, "y": 0.4202675223350525, "z": -0.15655684401281178, "name": "RING_FINGER_DIP", "type": "left_hand", "index": 15, "frame_index": 2496}, {"x": 0.4895641803741455, "y": 0.41754457354545593, "z": -0.15447684249375015, "name": "RING_FINGER_MCP", "type": "left_hand", "index": 13, "frame_index": 2496}, {"x": 0.4861624836921692, "y": 0.4142244756221771, "z": -0.15649126167409122, "name": "RING_FINGER_PIP", "type": "left_hand", "index": 14, "frame_index": 2496}, {"x": 0.48441821336746216, "y": 0.4265180826187134, "z": -0.15597302722744644, "name": "RING_FINGER_TIP", "type": "left_hand", "index": 16, "frame_index": 2496}, {"x": 0.4842386245727539, "y": 0.43410560488700867, "z": -0.1526659511437174, "name": "THUMB_CMC", "type": "left_hand", "index": 1, "frame_index": 2496}, {"x": 0.4794153571128845, "y": 0.41841062903404236, "z": -0.15400655224220827, "name": "THUMB_IP", "type": "left_hand", "index": 3, "frame_index": 2496}, {"x": 0.4810032248497009, "y": 0.42567044496536255, "z": -0.15299644027254544, "name": "THUMB_MCP", "type": "left_hand", "index": 2, "frame_index": 2496}, {"x": 0.47910207509994507, "y": 0.41423845291137695, "z": -0.15499339753296226, "name": "THUMB_TIP", "type": "left_hand", "index": 4, "frame_index": 2496}, {"x": 0.4898885488510132, "y": 0.442899227142334, "z": -0.15314435451446862, "name": "WRIST", "type": "left_hand", "index": 0, "frame_index": 2496}], [{"x": 0.47751912474632263, "y": 0.7793159484863281, "z": 0.06436435133218765, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2497}, {"x": 0.4947340786457062, "y": 0.39355430006980896, "z": 0.04585593193769455, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2497}, {"x": 0.5061840415000916, "y": 0.47641023993492126, "z": -0.029485471546649933, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2497}, {"x": 0.4916153848171234, "y": 0.38627803325653076, "z": -0.023520780727267265, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2497}, {"x": 0.48968470096588135, "y": 0.3844829201698303, "z": -0.02341892383992672, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2497}, {"x": 0.4933007061481476, "y": 0.38785743713378906, "z": -0.023474836722016335, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2497}, {"x": 0.4898524284362793, "y": 0.8123862147331238, "z": -0.010515826754271984, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2497}, {"x": 0.4720151722431183, "y": 0.7940264940261841, "z": 0.06589080393314362, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2497}, {"x": 0.4921647012233734, "y": 0.5702820420265198, "z": 0.017977571114897728, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2497}, {"x": 0.48836663365364075, "y": 0.4133477807044983, "z": -0.20125308632850647, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2497}, {"x": 0.48729008436203003, "y": 0.6819572448730469, "z": 0.0031848354265093803, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2497}, {"x": 0.4886559545993805, "y": 0.4181327223777771, "z": -0.20468762516975403, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2497}, {"x": 0.4986562728881836, "y": 0.44466620683670044, "z": 0.06952862441539764, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2497}, {"x": 0.4877171814441681, "y": 0.4187846779823303, "z": -0.17678767442703247, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2497}, {"x": 0.49231502413749695, "y": 0.43269437551498413, "z": -0.17403700947761536, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2497}, {"x": 0.4871273636817932, "y": 0.40060660243034363, "z": -0.012981917709112167, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2497}, {"x": 0.4811168313026428, "y": 0.3954812288284302, "z": -0.018806178122758865, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2497}, {"x": 0.4862222969532013, "y": 0.3889591097831726, "z": -0.0387207493185997, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2497}, {"x": 0.4661552309989929, "y": 0.7845979928970337, "z": -0.009466229006648064, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2497}, {"x": 0.47749701142311096, "y": 0.38300469517707825, "z": 0.02924453839659691, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2497}, {"x": 0.4538879692554474, "y": 0.47636112570762634, "z": -0.06240227445960045, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2497}, {"x": 0.4828082323074341, "y": 0.3797774016857147, "z": -0.026933329179883003, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2497}, {"x": 0.48458021879196167, "y": 0.3807174265384674, "z": -0.026804925873875618, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2497}, {"x": 0.4811371862888336, "y": 0.37882715463638306, "z": -0.02695620432496071, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2497}, {"x": 0.47337478399276733, "y": 0.8226068019866943, "z": -0.09042105078697205, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2497}, {"x": 0.46405020356178284, "y": 0.7989498972892761, "z": -0.007784051354974508, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2497}, {"x": 0.4653926491737366, "y": 0.5709307193756104, "z": -0.018098147585988045, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2497}, {"x": 0.4757212996482849, "y": 0.41089630126953125, "z": -0.20166493952274323, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2497}, {"x": 0.4671086072921753, "y": 0.678705632686615, "z": -0.06034223362803459, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2497}, {"x": 0.4764178991317749, "y": 0.4145079255104065, "z": -0.20744439959526062, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2497}, {"x": 0.45641806721687317, "y": 0.4336681067943573, "z": 0.031336404383182526, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2497}, {"x": 0.47530481219291687, "y": 0.4155297875404358, "z": -0.17841674387454987, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2497}, {"x": 0.47175467014312744, "y": 0.4273863136768341, "z": -0.17705686390399933, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2497}], [{"x": 0.4775238037109375, "y": 0.7793379426002502, "z": 0.05508481711149216, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2498}, {"x": 0.4948582053184509, "y": 0.39242562651634216, "z": 0.04328637570142746, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2498}, {"x": 0.5053402781486511, "y": 0.4655861258506775, "z": -0.06944818794727325, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2498}, {"x": 0.4915868639945984, "y": 0.3859597146511078, "z": -0.02428252622485161, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2498}, {"x": 0.48964694142341614, "y": 0.3844178020954132, "z": -0.02417626604437828, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2498}, {"x": 0.4932544529438019, "y": 0.3872060775756836, "z": -0.024237031117081642, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2498}, {"x": 0.48985251784324646, "y": 0.8122867345809937, "z": -0.024261580780148506, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2498}, {"x": 0.4720214307308197, "y": 0.7945252060890198, "z": 0.05561727285385132, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2498}, {"x": 0.49214571714401245, "y": 0.5704615712165833, "z": 0.016161693260073662, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2498}, {"x": 0.4881039261817932, "y": 0.40838703513145447, "z": -0.24463415145874023, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2498}, {"x": 0.4871499836444855, "y": 0.6819708347320557, "z": -0.00043224464752711356, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2498}, {"x": 0.48890018463134766, "y": 0.4137343168258667, "z": -0.2504431903362274, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2498}, {"x": 0.4996689558029175, "y": 0.4454657733440399, "z": 0.05612471327185631, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2498}, {"x": 0.48719021677970886, "y": 0.41392573714256287, "z": -0.2196647971868515, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2498}, {"x": 0.4924878478050232, "y": 0.42751336097717285, "z": -0.21740861237049103, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2498}, {"x": 0.4871457517147064, "y": 0.4006669819355011, "z": -0.014996778219938278, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2498}, {"x": 0.48106831312179565, "y": 0.39646071195602417, "z": -0.01849963888525963, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2498}, {"x": 0.4861558675765991, "y": 0.38944917917251587, "z": -0.03964094817638397, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2498}, {"x": 0.46615082025527954, "y": 0.7848199605941772, "z": -0.014381307177245617, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2498}, {"x": 0.47744446992874146, "y": 0.3844043016433716, "z": 0.03500163182616234, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2498}, {"x": 0.4530216157436371, "y": 0.47119563817977905, "z": -0.06425074487924576, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2498}, {"x": 0.4827950894832611, "y": 0.3800824284553528, "z": -0.025992324575781822, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2498}, {"x": 0.4845311939716339, "y": 0.3807937502861023, "z": -0.02586578018963337, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2498}, {"x": 0.48096928000450134, "y": 0.3796422481536865, "z": -0.02600964531302452, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2498}, {"x": 0.4741467237472534, "y": 0.8223713040351868, "z": -0.09881197661161423, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2498}, {"x": 0.4640708267688751, "y": 0.7996973395347595, "z": -0.011731138452887535, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2498}, {"x": 0.46539270877838135, "y": 0.5711749196052551, "z": -0.01627802476286888, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2498}, {"x": 0.4743685722351074, "y": 0.4060111939907074, "z": -0.21875552833080292, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2498}, {"x": 0.4671173095703125, "y": 0.6787030100822449, "z": -0.05891420319676399, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2498}, {"x": 0.47503358125686646, "y": 0.40975239872932434, "z": -0.22648896276950836, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2498}, {"x": 0.45744138956069946, "y": 0.43399176001548767, "z": 0.032281868159770966, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2498}, {"x": 0.47459056973457336, "y": 0.41088736057281494, "z": -0.1963794231414795, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2498}, {"x": 0.4716416895389557, "y": 0.42352283000946045, "z": -0.1947634071111679, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2498}, {"x": 0.47660425305366516, "y": 0.3911040723323822, "z": -0.19632763171102852, "name": "INDEX_FINGER_DIP", "type": "right_hand", "index": 7, "frame_index": 2498}, {"x": 0.4747562110424042, "y": 0.3968863785266876, "z": -0.193466434488073, "name": "INDEX_FINGER_MCP", "type": "right_hand", "index": 5, "frame_index": 2498}, {"x": 0.47542843222618103, "y": 0.3896431028842926, "z": -0.194998121689423, "name": "INDEX_FINGER_PIP", "type": "right_hand", "index": 6, "frame_index": 2498}, {"x": 0.47766149044036865, "y": 0.3940832018852234, "z": -0.19672418548725545, "name": "INDEX_FINGER_TIP", "type": "right_hand", "index": 8, "frame_index": 2498}, {"x": 0.47347119450569153, "y": 0.39413580298423767, "z": -0.1974386132787913, "name": "MIDDLE_FINGER_DIP", "type": "right_hand", "index": 11, "frame_index": 2498}, {"x": 0.47235599160194397, "y": 0.3970988094806671, "z": -0.19404752971604466, "name": "MIDDLE_FINGER_MCP", "type": "right_hand", "index": 9, "frame_index": 2498}, {"x": 0.47228875756263733, "y": 0.3909246027469635, "z": -0.1959005706012249, "name": "MIDDLE_FINGER_PIP", "type": "right_hand", "index": 10, "frame_index": 2498}, {"x": 0.4743991196155548, "y": 0.3988683223724365, "z": -0.19782649003900588, "name": "MIDDLE_FINGER_TIP", "type": "right_hand", "index": 12, "frame_index": 2498}, {"x": 0.46702858805656433, "y": 0.3867368698120117, "z": -0.19542803190415725, "name": "PINKY_DIP", "type": "right_hand", "index": 19, "frame_index": 2498}, {"x": 0.4677145481109619, "y": 0.399237722158432, "z": -0.19573647010838613, "name": "PINKY_MCP", "type": "right_hand", "index": 17, "frame_index": 2498}, {"x": 0.4673032760620117, "y": 0.39115720987319946, "z": -0.1958932166453451, "name": "PINKY_PIP", "type": "right_hand", "index": 18, "frame_index": 2498}, {"x": 0.4667963683605194, "y": 0.3839038014411926, "z": -0.19480529694556026, "name": "PINKY_TIP", "type": "right_hand", "index": 20, "frame_index": 2498}, {"x": 0.4714755415916443, "y": 0.3956487774848938, "z": -0.19706041109748185, "name": "RING_FINGER_DIP", "type": "right_hand", "index": 15, "frame_index": 2498}, {"x": 0.4699344336986542, "y": 0.39785632491111755, "z": -0.19487223764008377, "name": "RING_FINGER_MCP", "type": "right_hand", "index": 13, "frame_index": 2498}, {"x": 0.4701308608055115, "y": 0.3923911154270172, "z": -0.19649789156392217, "name": "RING_FINGER_PIP", "type": "right_hand", "index": 14, "frame_index": 2498}, {"x": 0.4724898636341095, "y": 0.40022996068000793, "z": -0.19671225175261497, "name": "RING_FINGER_TIP", "type": "right_hand", "index": 16, "frame_index": 2498}, {"x": 0.47546854615211487, "y": 0.41407644748687744, "z": -0.19518889443133958, "name": "THUMB_CMC", "type": "right_hand", "index": 1, "frame_index": 2498}, {"x": 0.47672250866889954, "y": 0.39906448125839233, "z": -0.19604112242814153, "name": "THUMB_IP", "type": "right_hand", "index": 3, "frame_index": 2498}, {"x": 0.4771004319190979, "y": 0.4059962332248688, "z": -0.19540159188909456, "name": "THUMB_MCP", "type": "right_hand", "index": 2, "frame_index": 2498}, {"x": 0.4750160872936249, "y": 0.39528509974479675, "z": -0.196595158893615, "name": "THUMB_TIP", "type": "right_hand", "index": 4, "frame_index": 2498}, {"x": 0.4717561602592468, "y": 0.4212328791618347, "z": -0.19476342549928205, "name": "WRIST", "type": "right_hand", "index": 0, "frame_index": 2498}], [{"x": 0.47752758860588074, "y": 0.7790513634681702, "z": 0.04815017059445381, "name": "LEFT_ANKLE", "type": "body", "index": 27, "frame_index": 2499}, {"x": 0.49482962489128113, "y": 0.39048585295677185, "z": 0.040406566113233566, "name": "LEFT_EAR", "type": "body", "index": 7, "frame_index": 2499}, {"x": 0.5051645636558533, "y": 0.4663974940776825, "z": -0.07635702192783356, "name": "LEFT_ELBOW", "type": "body", "index": 13, "frame_index": 2499}, {"x": 0.491115540266037, "y": 0.38466528058052063, "z": -0.024621838703751564, "name": "LEFT_EYE", "type": "body", "index": 2, "frame_index": 2499}, {"x": 0.48886457085609436, "y": 0.38379377126693726, "z": -0.02451413869857788, "name": "LEFT_EYE_INNER", "type": "body", "index": 1, "frame_index": 2499}, {"x": 0.492850124835968, "y": 0.3853408396244049, "z": -0.024578610435128212, "name": "LEFT_EYE_OUTER", "type": "body", "index": 3, "frame_index": 2499}, {"x": 0.48982876539230347, "y": 0.8122748732566833, "z": -0.03018510527908802, "name": "LEFT_FOOT_INDEX", "type": "body", "index": 31, "frame_index": 2499}, {"x": 0.4720575511455536, "y": 0.794400691986084, "z": 0.04857330024242401, "name": "LEFT_HEEL", "type": "body", "index": 29, "frame_index": 2499}, {"x": 0.49212977290153503, "y": 0.5704033970832825, "z": 0.011555898003280163, "name": "LEFT_HIP", "type": "body", "index": 23, "frame_index": 2499}, {"x": 0.4902898967266083, "y": 0.414922833442688, "z": -0.25466984510421753, "name": "LEFT_INDEX", "type": "body", "index": 19, "frame_index": 2499}, {"x": 0.4871178865432739, "y": 0.6816648840904236, "z": -0.005151366349309683, "name": "LEFT_KNEE", "type": "body", "index": 25, "frame_index": 2499}, {"x": 0.4908156991004944, "y": 0.4214983880519867, "z": -0.25951647758483887, "name": "LEFT_PINKY", "type": "body", "index": 17, "frame_index": 2499}, {"x": 0.5006904006004333, "y": 0.4455775022506714, "z": 0.04912243038415909, "name": "LEFT_SHOULDER", "type": "body", "index": 11, "frame_index": 2499}, {"x": 0.4893485903739929, "y": 0.4193342924118042, "z": -0.22835931181907654, "name": "LEFT_THUMB", "type": "body", "index": 21, "frame_index": 2499}, {"x": 0.49345341324806213, "y": 0.4335714876651764, "z": -0.22570696473121643, "name": "LEFT_WRIST", "type": "body", "index": 15, "frame_index": 2499}, {"x": 0.48714345693588257, "y": 0.4004037380218506, "z": -0.015084930695593357, "name": "MOUTH_LEFT", "type": "body", "index": 9, "frame_index": 2499}, {"x": 0.4810134172439575, "y": 0.39685937762260437, "z": -0.016902493312954903, "name": "MOUTH_RIGHT", "type": "body", "index": 10, "frame_index": 2499}, {"x": 0.48552465438842773, "y": 0.3895036280155182, "z": -0.03883117809891701, "name": "NOSE", "type": "body", "index": 0, "frame_index": 2499}, {"x": 0.4660249352455139, "y": 0.7848559617996216, "z": -0.01409820094704628, "name": "RIGHT_ANKLE", "type": "body", "index": 28, "frame_index": 2499}, {"x": 0.4771411120891571, "y": 0.3846660852432251, "z": 0.037345584481954575, "name": "RIGHT_EAR", "type": "body", "index": 8, "frame_index": 2499}, {"x": 0.4522044062614441, "y": 0.46249067783355713, "z": -0.06495240330696106, "name": "RIGHT_ELBOW", "type": "body", "index": 14, "frame_index": 2499}, {"x": 0.48144087195396423, "y": 0.38049206137657166, "z": -0.02512103132903576, "name": "RIGHT_EYE", "type": "body", "index": 5, "frame_index": 2499}, {"x": 0.4832269847393036, "y": 0.38092416524887085, "z": -0.02498486265540123, "name": "RIGHT_EYE_INNER", "type": "body", "index": 4, "frame_index": 2499}, {"x": 0.4794950485229492, "y": 0.3805186152458191, "z": -0.02514674887061119, "name": "RIGHT_EYE_OUTER", "type": "body", "index": 6, "frame_index": 2499}, {"x": 0.47347819805145264, "y": 0.8230558037757874, "z": -0.09838591516017914, "name": "RIGHT_FOOT_INDEX", "type": "body", "index": 32, "frame_index": 2499}, {"x": 0.4640332758426666, "y": 0.7997550964355469, "z": -0.013082614168524742, "name": "RIGHT_HEEL", "type": "body", "index": 30, "frame_index": 2499}, {"x": 0.46534544229507446, "y": 0.5711421966552734, "z": -0.011668119579553604, "name": "RIGHT_HIP", "type": "body", "index": 24, "frame_index": 2499}, {"x": 0.47431883215904236, "y": 0.40950044989585876, "z": -0.21646879613399506, "name": "RIGHT_INDEX", "type": "body", "index": 20, "frame_index": 2499}, {"x": 0.46710509061813354, "y": 0.6786920428276062, "z": -0.054961349815130234, "name": "RIGHT_KNEE", "type": "body", "index": 26, "frame_index": 2499}, {"x": 0.47510427236557007, "y": 0.4134710431098938, "z": -0.22498485445976257, "name": "RIGHT_PINKY", "type": "body", "index": 18, "frame_index": 2499}, {"x": 0.4587956368923187, "y": 0.4336349666118622, "z": 0.03844403475522995, "name": "RIGHT_SHOULDER", "type": "body", "index": 12, "frame_index": 2499}, {"x": 0.47420838475227356, "y": 0.4131843149662018, "z": -0.19598306715488434, "name": "RIGHT_THUMB", "type": "body", "index": 22, "frame_index": 2499}, {"x": 0.4713901877403259, "y": 0.42414483428001404, "z": -0.19348029792308807, "name": "RIGHT_WRIST", "type": "body", "index": 16, "frame_index": 2499}, {"x": 0.4730430543422699, "y": 0.3887815475463867, "z": -0.19473620678763837, "name": "INDEX_FINGER_DIP", "type": "right_hand", "index": 7, "frame_index": 2499}, {"x": 0.47003138065338135, "y": 0.3955553472042084, "z": -0.19263528293231502, "name": "INDEX_FINGER_MCP", "type": "right_hand", "index": 5, "frame_index": 2499}, {"x": 0.4705258309841156, "y": 0.3889588415622711, "z": -0.193584230459237, "name": "INDEX_FINGER_PIP", "type": "right_hand", "index": 6, "frame_index": 2499}, {"x": 0.47493991255760193, "y": 0.39061301946640015, "z": -0.19513905805069953, "name": "INDEX_FINGER_TIP", "type": "right_hand", "index": 8, "frame_index": 2499}, {"x": 0.46980324387550354, "y": 0.3837072253227234, "z": -0.1933198789774906, "name": "MIDDLE_FINGER_DIP", "type": "right_hand", "index": 11, "frame_index": 2499}, {"x": 0.4685610830783844, "y": 0.39543774724006653, "z": -0.19244484137743711, "name": "MIDDLE_FINGER_MCP", "type": "right_hand", "index": 9, "frame_index": 2499}, {"x": 0.46850407123565674, "y": 0.3880138695240021, "z": -0.1924761577975005, "name": "MIDDLE_FINGER_PIP", "type": "right_hand", "index": 10, "frame_index": 2499}, {"x": 0.47080835700035095, "y": 0.38124391436576843, "z": -0.19386589113855734, "name": "MIDDLE_FINGER_TIP", "type": "right_hand", "index": 12, "frame_index": 2499}, {"x": 0.46725285053253174, "y": 0.3847562074661255, "z": -0.19144007633440197, "name": "PINKY_DIP", "type": "right_hand", "index": 19, "frame_index": 2499}, {"x": 0.46706250309944153, "y": 0.39578598737716675, "z": -0.19278216798556969, "name": "PINKY_MCP", "type": "right_hand", "index": 17, "frame_index": 2499}, {"x": 0.4669990837574005, "y": 0.389089435338974, "z": -0.19216958829201758, "name": "PINKY_PIP", "type": "right_hand", "index": 18, "frame_index": 2499}, {"x": 0.46765783429145813, "y": 0.3820343315601349, "z": -0.19076954945921898, "name": "PINKY_TIP", "type": "right_hand", "index": 20, "frame_index": 2499}, {"x": 0.46854424476623535, "y": 0.3837396204471588, "z": -0.19245596043765545, "name": "RING_FINGER_DIP", "type": "right_hand", "index": 15, "frame_index": 2499}, {"x": 0.4675244688987732, "y": 0.395440936088562, "z": -0.19251537666423246, "name": "RING_FINGER_MCP", "type": "right_hand", "index": 13, "frame_index": 2499}, {"x": 0.46762484312057495, "y": 0.3882274329662323, "z": -0.19234016828704625, "name": "RING_FINGER_PIP", "type": "right_hand", "index": 14, "frame_index": 2499}, {"x": 0.46937087178230286, "y": 0.38103535771369934, "z": -0.19243407470639795, "name": "RING_FINGER_TIP", "type": "right_hand", "index": 16, "frame_index": 2499}, {"x": 0.47224611043930054, "y": 0.41233450174331665, "z": -0.1945255035534501, "name": "THUMB_CMC", "type": "right_hand", "index": 1, "frame_index": 2499}, {"x": 0.4773043692111969, "y": 0.4014586806297302, "z": -0.19513648946303874, "name": "THUMB_IP", "type": "right_hand", "index": 3, "frame_index": 2499}, {"x": 0.47527140378952026, "y": 0.40613818168640137, "z": -0.19484060548711568, "name": "THUMB_MCP", "type": "right_hand", "index": 2, "frame_index": 2499}, {"x": 0.4779461920261383, "y": 0.3975093960762024, "z": -0.195123516372405, "name": "THUMB_TIP", "type": "right_hand", "index": 4, "frame_index": 2499}, {"x": 0.4684976041316986, "y": 0.4165721833705902, "z": -0.1934802727147069, "name": "WRIST", "type": "right_hand", "index": 0, "frame_index": 2499}]] \ No newline at end of file diff --git a/mounts/zoperepo/__root__/tf_upload_demo/tflw-pose-detection_upload.js.map/__meta__ b/mounts/zoperepo/__root__/lib/assets/fonts/Disclaimer-Plain.otf/__meta__ similarity index 78% rename from mounts/zoperepo/__root__/tf_upload_demo/tflw-pose-detection_upload.js.map/__meta__ rename to mounts/zoperepo/__root__/lib/assets/fonts/Disclaimer-Plain.otf/__meta__ index 0d37e4d..c0ceb37 100644 --- a/mounts/zoperepo/__root__/tf_upload_demo/tflw-pose-detection_upload.js.map/__meta__ +++ b/mounts/zoperepo/__root__/lib/assets/fonts/Disclaimer-Plain.otf/__meta__ @@ -2,6 +2,6 @@ ('props', [ [('id', 'content_type'), ('type', 'string'), ('value', 'application/octet-stream')], ]), - ('title', ''), + ('title', 'Disclaimer-Plain.otf'), ('type', 'File'), ] diff --git a/mounts/zoperepo/__root__/lib/assets/fonts/Disclaimer-Plain.otf/__source__.otf b/mounts/zoperepo/__root__/lib/assets/fonts/Disclaimer-Plain.otf/__source__.otf new file mode 100644 index 0000000..0644d49 Binary files /dev/null and b/mounts/zoperepo/__root__/lib/assets/fonts/Disclaimer-Plain.otf/__source__.otf differ diff --git a/mounts/zoperepo/__root__/tf_upload_demo/__meta__ b/mounts/zoperepo/__root__/lib/assets/fonts/__meta__ similarity index 50% rename from mounts/zoperepo/__root__/tf_upload_demo/__meta__ rename to mounts/zoperepo/__root__/lib/assets/fonts/__meta__ index 4797e47..a7b94b7 100644 --- a/mounts/zoperepo/__root__/tf_upload_demo/__meta__ +++ b/mounts/zoperepo/__root__/lib/assets/fonts/__meta__ @@ -1,4 +1,5 @@ [ + ('owner', (['acl_users'], 'dockerzope')), ('title', ''), ('type', 'Folder'), ] diff --git a/mounts/zoperepo/__root__/lib/css/codemirror.css/__source__.css b/mounts/zoperepo/__root__/lib/css/codemirror.css/__source__.css index 0040db3..404e95b 100644 --- a/mounts/zoperepo/__root__/lib/css/codemirror.css/__source__.css +++ b/mounts/zoperepo/__root__/lib/css/codemirror.css/__source__.css @@ -342,3 +342,152 @@ div.CodeMirror-dragcursors { /* Help users use markselection to safely style text background */ span.CodeMirror-selectedtext { background: none; } + + + +/* THEMES START */ +/* + Name: material + Author: Mattia Astorino (http://github.com/equinusocio) + Website: https://material-theme.site/ +*/ + +.cm-s-material.CodeMirror { + background-color: #263238; + color: #EEFFFF; +} + +.cm-s-material .CodeMirror-gutters { + background: #263238; + color: #546E7A; + border: none; +} + +.cm-s-material .CodeMirror-guttermarker, +.cm-s-material .CodeMirror-guttermarker-subtle, +.cm-s-material .CodeMirror-linenumber { + color: #546E7A; +} + +.cm-s-material .CodeMirror-cursor { + border-left: 1px solid #FFCC00; +} +.cm-s-material.cm-fat-cursor .CodeMirror-cursor { + background-color: #5d6d5c80 !important; +} +.cm-s-material .cm-animate-fat-cursor { + background-color: #5d6d5c80 !important; +} + +.cm-s-material div.CodeMirror-selected { + background: rgba(128, 203, 196, 0.2); +} + +.cm-s-material.CodeMirror-focused div.CodeMirror-selected { + background: rgba(128, 203, 196, 0.2); +} + +.cm-s-material .CodeMirror-line::selection, +.cm-s-material .CodeMirror-line>span::selection, +.cm-s-material .CodeMirror-line>span>span::selection { + background: rgba(128, 203, 196, 0.2); +} + +.cm-s-material .CodeMirror-line::-moz-selection, +.cm-s-material .CodeMirror-line>span::-moz-selection, +.cm-s-material .CodeMirror-line>span>span::-moz-selection { + background: rgba(128, 203, 196, 0.2); +} + +.cm-s-material .CodeMirror-activeline-background { + background: rgba(0, 0, 0, 0.5); +} + +.cm-s-material .cm-keyword { + color: #C792EA; +} + +.cm-s-material .cm-operator { + color: #89DDFF; +} + +.cm-s-material .cm-variable-2 { + color: #EEFFFF; +} + +.cm-s-material .cm-variable-3, +.cm-s-material .cm-type { + color: #f07178; +} + +.cm-s-material .cm-builtin { + color: #FFCB6B; +} + +.cm-s-material .cm-atom { + color: #F78C6C; +} + +.cm-s-material .cm-number { + color: #FF5370; +} + +.cm-s-material .cm-def { + color: #82AAFF; +} + +.cm-s-material .cm-string { + color: #C3E88D; +} + +.cm-s-material .cm-string-2 { + color: #f07178; +} + +.cm-s-material .cm-comment { + color: #546E7A; +} + +.cm-s-material .cm-variable { + color: #f07178; +} + +.cm-s-material .cm-tag { + color: #FF5370; +} + +.cm-s-material .cm-meta { + color: #FFCB6B; +} + +.cm-s-material .cm-attribute { + color: #C792EA; +} + +.cm-s-material .cm-property { + color: #C792EA; +} + +.cm-s-material .cm-qualifier { + color: #DECB6B; +} + +.cm-s-material .cm-variable-3, +.cm-s-material .cm-type { + color: #DECB6B; +} + + +.cm-s-material .cm-error { + color: rgba(255, 255, 255, 1.0); + background-color: #FF5370; +} + +.cm-s-material .CodeMirror-matchingbracket { + text-decoration: underline; + color: white !important; +} + + + + diff --git a/mounts/zoperepo/__root__/lib/css/github-dark.min.css/__meta__ b/mounts/zoperepo/__root__/lib/css/github-dark.min.css/__meta__ new file mode 100644 index 0000000..14ceb00 --- /dev/null +++ b/mounts/zoperepo/__root__/lib/css/github-dark.min.css/__meta__ @@ -0,0 +1,8 @@ +[ + ('owner', (['acl_users'], 'dockerzope')), + ('props', [ + [('id', 'content_type'), ('type', 'string'), ('value', 'text/css')], + ]), + ('title', 'github-dark.min.css'), + ('type', 'File'), +] diff --git a/mounts/zoperepo/__root__/lib/css/github-dark.min.css/__source__.css b/mounts/zoperepo/__root__/lib/css/github-dark.min.css/__source__.css new file mode 100644 index 0000000..03b6da8 --- /dev/null +++ b/mounts/zoperepo/__root__/lib/css/github-dark.min.css/__source__.css @@ -0,0 +1,10 @@ +pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}/*! + Theme: GitHub Dark + Description: Dark theme as seen on github.com + Author: github.com + Maintainer: @Hirse + Updated: 2021-05-15 + + Outdated base version: https://github.com/primer/github-syntax-dark + Current colors taken from GitHub's CSS +*/.hljs{color:#c9d1d9;background:#0d1117}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#ff7b72}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#d2a8ff}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable{color:#79c0ff}.hljs-meta .hljs-string,.hljs-regexp,.hljs-string{color:#a5d6ff}.hljs-built_in,.hljs-symbol{color:#ffa657}.hljs-code,.hljs-comment,.hljs-formula{color:#8b949e}.hljs-name,.hljs-quote,.hljs-selector-pseudo,.hljs-selector-tag{color:#7ee787}.hljs-subst{color:#c9d1d9}.hljs-section{color:#1f6feb;font-weight:700}.hljs-bullet{color:#f2cc60}.hljs-emphasis{color:#c9d1d9;font-style:italic}.hljs-strong{color:#c9d1d9;font-weight:700}.hljs-addition{color:#aff5b4;background-color:#033a16}.hljs-deletion{color:#ffdcd7;background-color:#67060c} \ No newline at end of file diff --git a/mounts/zoperepo/__root__/lib/css/show-hint.css/__meta__ b/mounts/zoperepo/__root__/lib/css/show-hint.css/__meta__ new file mode 100644 index 0000000..80db598 --- /dev/null +++ b/mounts/zoperepo/__root__/lib/css/show-hint.css/__meta__ @@ -0,0 +1,8 @@ +[ + ('owner', (['acl_users'], 'dockerzope')), + ('props', [ + [('id', 'content_type'), ('type', 'string'), ('value', 'text/css')], + ]), + ('title', 'show-hint.css'), + ('type', 'File'), +] diff --git a/mounts/zoperepo/__root__/lib/css/show-hint.css/__source__.css b/mounts/zoperepo/__root__/lib/css/show-hint.css/__source__.css new file mode 100644 index 0000000..d41031c --- /dev/null +++ b/mounts/zoperepo/__root__/lib/css/show-hint.css/__source__.css @@ -0,0 +1,37 @@ +.CodeMirror-hints { + position: absolute; + z-index: 10; + overflow: hidden; + list-style: none; + + margin: 0; + padding: 2px; + + -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2); + -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2); + box-shadow: 2px 3px 5px rgba(0,0,0,.2); + border-radius: 3px; + border: 1px solid silver; + + background: white; + font-size: 90%; + font-family: monospace; + + max-height: 20em; + overflow-y: auto; + box-sizing: border-box; +} + +.CodeMirror-hint { + margin: 0; + padding: 0 4px; + border-radius: 2px; + white-space: pre; + color: black; + cursor: pointer; +} + +li.CodeMirror-hint-active { + background: #08f; + color: white; +} diff --git a/mounts/zoperepo/__root__/lib/js/canvas-capture.min.js/__meta__ b/mounts/zoperepo/__root__/lib/js/canvas-capture.min.js/__meta__ new file mode 100644 index 0000000..0e6d6cd --- /dev/null +++ b/mounts/zoperepo/__root__/lib/js/canvas-capture.min.js/__meta__ @@ -0,0 +1,8 @@ +[ + ('owner', (['acl_users'], 'dockerzope')), + ('props', [ + [('id', 'content_type'), ('type', 'string'), ('value', 'text/javascript')], + ]), + ('title', 'canvas-capture.min.js'), + ('type', 'File'), +] diff --git a/mounts/zoperepo/__root__/lib/js/canvas-capture.min.js/__source__.js b/mounts/zoperepo/__root__/lib/js/canvas-capture.min.js/__source__.js new file mode 100644 index 0000000..41b0dcf --- /dev/null +++ b/mounts/zoperepo/__root__/lib/js/canvas-capture.min.js/__source__.js @@ -0,0 +1,14 @@ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.CanvasCapture=e():t.CanvasCapture=e()}(self,()=>(()=>{var r={76:(t,e,r)=>{r(72);const n=r(681)["devDependencies"];t.exports={corePath:`https://unpkg.com/@ffmpeg/core@${n["@ffmpeg/core"].substring(1)}/dist/ffmpeg-core.js`}},339:(t,e,r)=>{const i=r(72);t.exports=async t=>{let e=t;if(void 0===t)return new Uint8Array;if("string"==typeof t)if(/data:_data\/([a-zA-Z]*);base64,([^"]*)/.test(t))e=atob(t.split(",")[1]).split("").map(t=>t.charCodeAt(0));else{const r=await fetch(i(t));e=await r.arrayBuffer()}else(t instanceof File||t instanceof Blob)&&(e=(n=t,await new Promise((t,e)=>{const r=new FileReader;r.onload=()=>{t(r.result)},r.onerror=({target:{error:{code:t}}})=>{e(Error("File could not be read! Code="+t))},r.readAsArrayBuffer(n)})));var n;return new Uint8Array(e)}},440:(t,e,r)=>{const a=r(72),s=r(888)["log"],l=async(t,e)=>{s("info","fetch "+t);var r=await(await fetch(t)).arrayBuffer();s("info",`${t} file size = ${r.byteLength} bytes`);e=new Blob([r],{type:e}),e=URL.createObjectURL(e);return s("info",t+" blob URL = "+e),e};t.exports=async({corePath:t})=>{if("string"!=typeof t)throw Error("corePath should be a string!");const e=a(t),n=await l(e,"application/javascript"),i=await l(e.replace("ffmpeg-core.js","ffmpeg-core.wasm"),"application/wasm"),o=await l(e.replace("ffmpeg-core.js","ffmpeg-core.worker.js"),"application/javascript");return"undefined"==typeof createFFmpegCore?new Promise(t=>{const e=document.createElement("script"),r=()=>{e.removeEventListener("load",r),s("info","ffmpeg-core.js script loaded"),t({createFFmpegCore:createFFmpegCore,corePath:n,wasmPath:i,workerPath:o})};e.src=n,e.type="text/javascript",e.addEventListener("load",r),document.getElementsByTagName("head")[0].appendChild(e)}):(s("info","ffmpeg-core.js script is loaded already"),Promise.resolve({createFFmpegCore:createFFmpegCore,corePath:n,wasmPath:i,workerPath:o}))}},451:(t,e,r)=>{var n=r(76),i=r(440),r=r(339);t.exports={defaultOptions:n,getCreateFFmpegCore:i,fetchFile:r}},617:t=>{t.exports={defaultArgs:["./ffmpeg","-nostdin","-y"],baseOptions:{log:!1,logger:()=>{},progress:()=>{},corePath:""}}},648:(t,e,r)=>{const{defaultArgs:d,baseOptions:f}=r(617),{setLogging:p,setCustomLogger:m,log:g}=r(888),w=r(405),b=r(10),{defaultOptions:y,getCreateFFmpegCore:v}=r(451),_=r(681)["version"],k=Error("ffmpeg.wasm is not ready, make sure you have completed load().");t.exports=(t={})=>{const{log:e,logger:r,progress:n,...i}={...f,...y,...t};let o=null,a=null,s=null,l=!1,h=n;const c=t=>{"FFMPEG_END"===t&&null!==s&&(s(),s=null,l=!1)},u=({type:t,message:e})=>{g(t,e),w(e,h),c(e)};return p(e),m(r),g("info","use ffmpeg.wasm v"+_),{setProgress:t=>{h=t},setLogger:t=>{m(t)},setLogging:p,load:async()=>{if(g("info","load ffmpeg-core"),null!==o)throw Error("ffmpeg.wasm was loaded, you should not load it again, use ffmpeg.isLoaded() to check next time.");{g("info","loading ffmpeg-core");const{createFFmpegCore:t,corePath:e,workerPath:r,wasmPath:n}=await v(i);o=await t({mainScriptUrlOrBlob:e,printErr:t=>u({type:"fferr",message:t}),print:t=>u({type:"ffout",message:t}),locateFile:(t,e)=>{if("undefined"!=typeof window){if(void 0!==n&&t.endsWith("ffmpeg-core.wasm"))return n;if(void 0!==r&&t.endsWith("ffmpeg-core.worker.js"))return r}return e+t}}),a=o.cwrap("proxy_main","number",["number","number"]),g("info","ffmpeg-core loaded")}},isLoaded:()=>null!==o,run:(...r)=>{if(g("info","run ffmpeg command: "+r.join(" ")),null===o)throw k;if(l)throw Error("ffmpeg.wasm can only run one command at a time");return l=!0,new Promise(t=>{var e=[...d,...r].filter(t=>0!==t.length);s=t,a(...b(o,e))})},exit:()=>{if(null===o)throw k;l=!1,o.exit(1),o=null,a=null,s=null},FS:(e,...r)=>{if(g("info",`run FS.${e} `+r.map(t=>"string"==typeof t?t:`<${t.length} bytes binary file>`).join(" ")),null===o)throw k;{let t=null;try{t=o.FS[e](...r)}catch(t){throw"readdir"===e?Error(`ffmpeg.FS('readdir', '${r[0]}') error. Check if the path exists, ex: ffmpeg.FS('readdir', '/')`):"readFile"===e?Error(`ffmpeg.FS('readFile', '${r[0]}') error. Check if the path exists`):Error("Oops, something went wrong in FS operation.")}return t}}}}},888:t=>{let r=!1,n=()=>{};t.exports={logging:r,setLogging:t=>{r=t},setCustomLogger:t=>{n=t},log:(t,e)=>{n({type:t,message:e}),r&&console.log(`[${t}] `+e)}}},10:t=>{t.exports=(n,t)=>{const i=n._malloc(t.length*Uint32Array.BYTES_PER_ELEMENT);return t.forEach((t,e)=>{var r=n._malloc(t.length+1);n.writeAsciiToMemory(t,r),n.setValue(i+Uint32Array.BYTES_PER_ELEMENT*e,r,"i32")}),[t.length,i]}},405:t=>{let n=0,i=0;const o=t=>{var[e,r,t]=t.split(":");return 60*parseFloat(e)*60+60*parseFloat(r)+parseFloat(t)};t.exports=(t,e)=>{var r;"string"==typeof t&&(t.startsWith(" Duration")?(r=t.split(", ")[0].split(": ")[1],e({duration:r=o(r),ratio:i}),(0===n||n>r)&&(n=r)):t.startsWith("frame")||t.startsWith("size")?(r=t.split("time=")[1].split(" ")[0],r=o(r),i=r/n,e({ratio:i,time:r})):t.startsWith("video:")&&(e({ratio:1}),n=0))}},809:(t,e)=>{"use strict";function a(t){var e=-1;n=n||function(){for(var t=new Int32Array(256),e=0;e<256;e++){for(var r=e,n=0;n<8;n++)r=1&r?3988292384^r>>>1:r>>>1;t[e]=r}return t}();for(var r=0;r>>8;return-1^e}Object.defineProperty(e,"__esModule",{value:!0}),e.changeDpiBlob=function(i,o){var e=i.slice(0,33);return new Promise(function(r,t){var n=new FileReader;n.onload=function(){var t=new Uint8Array(n.result),e=i.slice(33),t=g(t,o,i.type);r(new Blob([t,e],{type:i.type}))},n.readAsArrayBuffer(e)})},e.changeDpiDataUrl=function(t,e){var r=t.split(","),n=r[0],i=r[1],o=void 0,t=void 0,r=!1;-1!==n.indexOf(c)&&(o=c,0<=(a=function(t){var e=t.indexOf(d);-1===e&&(e=t.indexOf(f));-1===e&&(e=t.indexOf(p));return e}(i))?(t=4*Math.ceil((a+28)/3),r=!0):t=44);-1!==n.indexOf(u)&&(o=u,t=24);for(var a=i.substring(0,t),t=i.substring(t),s=atob(a),l=new Uint8Array(s.length),h=0;h>8,t[15]=255&e,t[16]=e>>8,t[17]=255&e,t;if(r===c){var i=new Uint8Array(13);e*=39.3701,i[0]=s,i[1]=l,i[2]=h,i[3]=m,i[4]=e>>>24,i[5]=e>>>16,i[6]=e>>>8,i[7]=255&e,i[8]=i[4],i[9]=i[5],i[10]=i[6],i[11]=i[7],i[12]=1;r=a(i),e=new Uint8Array(4);if(e[0]=r>>>24,e[1]=r>>>16,e[2]=r>>>8,e[3]=255&r,n){var o=function(t){for(var e=t.length-1;4<=e;e--)if(9===t[e-4]&&t[e-3]===s&&t[e-2]===l&&t[e-1]===h&&t[e]===m)return e-3}(t);return t.set(i,o),t.set(e,o+13),t}n=new Uint8Array(4);n[0]=0,n[1]=0,n[2]=0,n[3]=9;o=new Uint8Array(54);return o.set(t,0),o.set(n,33),o.set(i,37),o.set(e,50),o}}},162:function(t,e,r){var n;void 0===(n="function"==typeof(n=function(){"use strict";function i(t,e){return"undefined"==typeof e?e={autoBom:!1}:"object"!=typeof e&&(console.warn("Deprecated: Expected third argument to be a object"),e={autoBom:!e}),e.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type)?new Blob(["\ufeff",t],{type:t.type}):t}function c(t,e,r){var n=new XMLHttpRequest;n.open("GET",t),n.responseType="blob",n.onload=function(){s(n.response,e,r)},n.onerror=function(){console.error("could not download file")},n.send()}function o(t){var e=new XMLHttpRequest;e.open("HEAD",t,!1);try{e.send()}catch(t){}return 200<=e.status&&299>=e.status}function a(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(t){var r=document.createEvent("MouseEvents");r.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(r)}}var u="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof r.g&&r.g.global===r.g?r.g:void 0,d=u.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),s=u.saveAs||("object"!=typeof window||window!==u?function(){}:"download"in HTMLAnchorElement.prototype&&!d?function(t,e,r){var n=u.URL||u.webkitURL,i=document.createElement("a");e=e||t.name||"download",i.download=e,i.rel="noopener","string"==typeof t?(i.href=t,i.origin===location.origin?a(i):o(i.href)?c(t,e,r):a(i,i.target="_blank")):(i.href=n.createObjectURL(t),setTimeout(function(){n.revokeObjectURL(i.href)},4e4),setTimeout(function(){a(i)},0))}:"msSaveOrOpenBlob"in navigator?function(t,e,r){if(e=e||t.name||"download","string"!=typeof t)navigator.msSaveOrOpenBlob(i(t,r),e);else if(o(t))c(t,e,r);else{var n=document.createElement("a");n.href=t,n.target="_blank",setTimeout(function(){a(n)})}}:function(t,e,r,n){if(n=n||open("","_blank"),n&&(n.document.title=n.document.body.innerText="downloading..."),"string"==typeof t)return c(t,e,r);var i="application/octet-stream"===t.type,o=/constructor/i.test(u.HTMLElement)||u.safari,a=/CriOS\/[\d]+/.test(navigator.userAgent);if((a||i&&o||d)&&"undefined"!=typeof FileReader){var s=new FileReader;s.onloadend=function(){var t=s.result;t=a?t:t.replace(/^data:[^;]*;/,"data:attachment/file;"),n?n.location.href=t:location=t,n=null},s.readAsDataURL(t)}else{var l=u.URL||u.webkitURL,h=l.createObjectURL(t);n?n.location=h:location.href=h,n=null,setTimeout(function(){l.revokeObjectURL(h)},4e4)}});u.saveAs=s.saveAs=s,true&&(t.exports=s)})?n.apply(e,[]):n)||(t.exports=n)},733:(t,e,r)=>{ +/*! + +JSZip v3.7.1 - A JavaScript class for generating and reading zip files + + +(c) 2009-2016 Stuart Knightley +Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/master/LICENSE.markdown. + +JSZip uses the library pako released under the MIT license : +https://github.com/nodeca/pako/blob/master/LICENSE +*/ +t.exports=function n(i,o,a){function s(e,t){if(!o[e]){if(!i[e]){if(0,l)return l(e,!0);var r=new Error("Cannot find module '"+e+"'");throw r.code="MODULE_NOT_FOUND",r}r=o[e]={exports:{}};i[e][0].call(r.exports,function(t){return s(i[e][1][t]||t)},r,r.exports,n,i,o,a)}return o[e].exports}for(var l=void 0,t=0;t>4,i=1>6:64,o=2>2)+d.charAt(n)+d.charAt(i)+d.charAt(o));return s.join("")},r.decode=function(t){var e,r,n,i,o,a=0,s=0;if("data:"===t.substr(0,"data:".length))throw new Error("Invalid base64 input, it looks like a data url.");var l,h=3*(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"")).length/4;if(t.charAt(t.length-1)===d.charAt(64)&&h--,t.charAt(t.length-2)===d.charAt(64)&&h--,h%1!=0)throw new Error("Invalid base64 input, bad content length.");for(l=new(c.uint8array?Uint8Array:Array)(0|h);a>4,r=(15&n)<<4|(i=d.indexOf(t.charAt(a++)))>>2,n=(3&i)<<6|(o=d.indexOf(t.charAt(a++))),l[s++]=e,64!==i&&(l[s++]=r),64!==o&&(l[s++]=n);return l}},{"./support":30,"./utils":32}],2:[function(t,e,r){"use strict";var n=t("./external"),i=t("./stream/DataWorker"),o=t("./stream/Crc32Probe"),a=t("./stream/DataLengthProbe");function s(t,e,r,n,i){this.compressedSize=t,this.uncompressedSize=e,this.crc32=r,this.compression=n,this.compressedContent=i}s.prototype={getContentWorker:function(){var t=new i(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a("data_length")),e=this;return t.on("end",function(){if(this.streamInfo.data_length!==e.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),t},getCompressedWorker:function(){return new i(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},s.createWorkerFrom=function(t,e,r){return t.pipe(new o).pipe(new a("uncompressedSize")).pipe(e.compressWorker(r)).pipe(new a("compressedSize")).withStreamInfo("compression",e)},e.exports=s},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,e,r){"use strict";var n=t("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(t){return new n("STORE compression")},uncompressWorker:function(){return new n("STORE decompression")}},r.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,e,r){"use strict";var n=t("./utils"),a=function(){for(var t=[],e=0;e<256;e++){for(var r=e,n=0;n<8;n++)r=1&r?3988292384^r>>>1:r>>>1;t[e]=r}return t}();e.exports=function(t,e){return void 0!==t&&t.length?("string"!==n.getTypeOf(t)?function(t,e,r){var n=a,i=0+r;t^=-1;for(var o=0;o>>8^n[255&(t^e[o])];return-1^t}:function(t,e,r){var n=a,i=0+r;t^=-1;for(var o=0;o>>8^n[255&(t^e.charCodeAt(o))];return-1^t})(0|e,t,t.length):0}},{"./utils":32}],5:[function(t,e,r){"use strict";r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],6:[function(t,e,r){"use strict";var n="undefined"!=typeof Promise?Promise:t("lie");e.exports={Promise:n}},{lie:37}],7:[function(t,e,r){"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,i=t("pako"),o=t("./utils"),a=t("./stream/GenericWorker"),s=n?"uint8array":"array";function l(t,e){a.call(this,"FlateWorker/"+t),this._pako=null,this._pakoAction=t,this._pakoOptions=e,this.meta={}}r.magic="\b\0",o.inherits(l,a),l.prototype.processChunk=function(t){this.meta=t.meta,null===this._pako&&this._createPako(),this._pako.push(o.transformTo(s,t.data),!1)},l.prototype.flush=function(){a.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},l.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this._pako=null},l.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},r.compressWorker=function(t){return new l("Deflate",t)},r.uncompressWorker=function(){return new l("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,e,r){"use strict";function v(t,e){for(var r="",n=0;n>>=8;return r}function n(t,e,r,n,i,o){var a,s=t.file,l=t.compression,h=o!==k.utf8encode,c=_.transformTo("string",o(s.name)),u=_.transformTo("string",k.utf8encode(s.name)),d=s.comment,f=_.transformTo("string",o(d)),p=_.transformTo("string",k.utf8encode(d)),m=u.length!==s.name.length,g=p.length!==d.length,w="",b=s.dir,o=s.date,d={crc32:0,compressedSize:0,uncompressedSize:0};e&&!r||(d.crc32=t.crc32,d.compressedSize=t.compressedSize,d.uncompressedSize=t.uncompressedSize);t=0;e&&(t|=8),h||!m&&!g||(t|=2048);e=0,h=0;b&&(e|=16),"UNIX"===i?(h=798,e|=(65535&((i=s.unixPermissions)?i:b?16893:33204))<<16):(h=20,e|=63&(s.dosPermissions||0)),b=o.getUTCHours(),b<<=6,b|=o.getUTCMinutes(),b<<=5,b|=o.getUTCSeconds()/2,s=o.getUTCFullYear()-1980,s<<=4,s|=o.getUTCMonth()+1,s<<=5,s|=o.getUTCDate(),m&&(a=v(1,1)+v(x(c),4)+u,w+="up"+v(a.length,2)+a),g&&(y=v(1,1)+v(x(f),4)+p,w+="uc"+v(y.length,2)+y);var y="";return y+="\n\0",y+=v(t,2),y+=l.magic,y+=v(b,2),y+=v(s,2),y+=v(d.crc32,4),y+=v(d.compressedSize,4),y+=v(d.uncompressedSize,4),y+=v(c.length,2),y+=v(w.length,2),{fileRecord:E.LOCAL_FILE_HEADER+y+c+w,dirRecord:E.CENTRAL_FILE_HEADER+v(h,2)+y+v(f.length,2)+"\0\0\0\0"+v(e,4)+v(n,4)+c+w+f}}var _=t("../utils"),i=t("../stream/GenericWorker"),k=t("../utf8"),x=t("../crc32"),E=t("../signature");function o(t,e,r,n){i.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=e,this.zipPlatform=r,this.encodeFileName=n,this.streamFiles=t,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}_.inherits(o,i),o.prototype.push=function(t){var e=t.meta.percent||0,r=this.entriesCount,n=this._sources.length;this.accumulate?this.contentBuffer.push(t):(this.bytesWritten+=t.data.length,i.prototype.push.call(this,{data:t.data,meta:{currentFile:this.currentFile,percent:r?(e+100*(r-n-1))/r:100}}))},o.prototype.openedSource=function(t){this.currentSourceOffset=this.bytesWritten,this.currentFile=t.file.name;var e=this.streamFiles&&!t.file.dir;e?(e=n(t,e,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName),this.push({data:e.fileRecord,meta:{percent:0}})):this.accumulate=!0},o.prototype.closedSource=function(t){this.accumulate=!1;var e=this.streamFiles&&!t.file.dir,r=n(t,e,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(r.dirRecord),e)this.push({data:(t=t,E.DATA_DESCRIPTOR+v(t.crc32,4)+v(t.compressedSize,4)+v(t.uncompressedSize,4)),meta:{percent:100}});else for(this.push({data:r.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},o.prototype.flush=function(){for(var t=this.bytesWritten,e=0;e=this.index;e--)r=(r<<8)+this.byteAt(e);return this.index+=t,r},readString:function(t){return n.transformTo("string",this.readData(t))},readData:function(t){},lastIndexOfSignature:function(t){},readAndCheckSignature:function(t){},readDate:function(){var t=this.readInt(4);return new Date(Date.UTC(1980+(t>>25&127),(t>>21&15)-1,t>>16&31,t>>11&31,t>>5&63,(31&t)<<1))}},e.exports=i},{"../utils":32}],19:[function(t,e,r){"use strict";var n=t("./Uint8ArrayReader");function i(t){n.call(this,t)}t("../utils").inherits(i,n),i.prototype.readData=function(t){this.checkOffset(t);var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,e,r){"use strict";var n=t("./DataReader");function i(t){n.call(this,t)}t("../utils").inherits(i,n),i.prototype.byteAt=function(t){return this.data.charCodeAt(this.zero+t)},i.prototype.lastIndexOfSignature=function(t){return this.data.lastIndexOf(t)-this.zero},i.prototype.readAndCheckSignature=function(t){return t===this.readData(4)},i.prototype.readData=function(t){this.checkOffset(t);var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=i},{"../utils":32,"./DataReader":18}],21:[function(t,e,r){"use strict";var n=t("./ArrayReader");function i(t){n.call(this,t)}t("../utils").inherits(i,n),i.prototype.readData=function(t){if(this.checkOffset(t),0===t)return new Uint8Array(0);var e=this.data.subarray(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(t,e,r){"use strict";var n=t("../utils"),i=t("../support"),o=t("./ArrayReader"),a=t("./StringReader"),s=t("./NodeBufferReader"),l=t("./Uint8ArrayReader");e.exports=function(t){var e=n.getTypeOf(t);return n.checkSupport(e),"string"!==e||i.uint8array?"nodebuffer"===e?new s(t):i.uint8array?new l(n.transformTo("uint8array",t)):new o(n.transformTo("array",t)):new a(t)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,e,r){"use strict";r.LOCAL_FILE_HEADER="PK",r.CENTRAL_FILE_HEADER="PK",r.CENTRAL_DIRECTORY_END="PK",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",r.ZIP64_CENTRAL_DIRECTORY_END="PK",r.DATA_DESCRIPTOR="PK\b"},{}],24:[function(t,e,r){"use strict";var n=t("./GenericWorker"),i=t("../utils");function o(t){n.call(this,"ConvertWorker to "+t),this.destType=t}i.inherits(o,n),o.prototype.processChunk=function(t){this.push({data:i.transformTo(this.destType,t.data),meta:t.meta})},e.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(t,e,r){"use strict";var n=t("./GenericWorker"),i=t("../crc32");function o(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(o,n),o.prototype.processChunk=function(t){this.streamInfo.crc32=i(t.data,this.streamInfo.crc32||0),this.push(t)},e.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,e,r){"use strict";var n=t("../utils"),i=t("./GenericWorker");function o(t){i.call(this,"DataLengthProbe for "+t),this.propName=t,this.withStreamInfo(t,0)}n.inherits(o,i),o.prototype.processChunk=function(t){var e;t&&(e=this.streamInfo[this.propName]||0,this.streamInfo[this.propName]=e+t.data.length),i.prototype.processChunk.call(this,t)},e.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(t,e,r){"use strict";var n=t("../utils"),i=t("./GenericWorker");function o(t){i.call(this,"DataWorker");var e=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,t.then(function(t){e.dataIsReady=!0,e.data=t,e.max=t&&t.length||0,e.type=n.getTypeOf(t),e.isPaused||e._tickAndRepeat()},function(t){e.error(t)})}n.inherits(o,i),o.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var t=null,e=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":t=this.data.substring(this.index,e);break;case"uint8array":t=this.data.subarray(this.index,e);break;case"array":case"nodebuffer":t=this.data.slice(this.index,e)}return this.index=e,this.push({data:t,meta:{percent:this.max?this.index/this.max*100:0}})},e.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(t,e,r){"use strict";function n(t){this.name=t||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}n.prototype={push:function(t){this.emit("data",t)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(t){this.emit("error",t)}return!0},error:function(t){return!this.isFinished&&(this.isPaused?this.generatedError=t:(this.isFinished=!0,this.emit("error",t),this.previous&&this.previous.error(t),this.cleanUp()),!0)},on:function(t,e){return this._listeners[t].push(e),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(t,e){if(this._listeners[t])for(var r=0;r "+t:t}},e.exports=n},{}],29:[function(t,e,r){"use strict";var h=t("../utils"),i=t("./ConvertWorker"),o=t("./GenericWorker"),c=t("../base64"),n=t("../support"),a=t("../external"),s=null;if(n.nodestream)try{s=t("../nodejs/NodejsStreamOutputAdapter")}catch(t){}function l(t,e,r){var n=e;switch(e){case"blob":case"arraybuffer":n="uint8array";break;case"base64":n="string"}try{this._internalType=n,this._outputType=e,this._mimeType=r,h.checkSupport(n),this._worker=t.pipe(new i(n)),t.lock()}catch(t){this._worker=new o("error"),this._worker.error(t)}}l.prototype={accumulate:function(t){return s=this,l=t,new a.Promise(function(e,r){var n=[],i=s._internalType,o=s._outputType,a=s._mimeType;s.on("data",function(t,e){n.push(t),l&&l(e)}).on("error",function(t){n=[],r(t)}).on("end",function(){try{var t=function(t,e,r){switch(t){case"blob":return h.newBlob(h.transformTo("arraybuffer",e),r);case"base64":return c.encode(e);default:return h.transformTo(t,e)}}(o,function(t,e){for(var r=0,n=null,i=0,o=0;o>>6:(r<65536?e[i++]=224|r>>>12:(e[i++]=240|r>>>18,e[i++]=128|r>>>12&63),e[i++]=128|r>>>6&63),e[i++]=128|63&r);return e}(t)},i.utf8decode=function(t){return l.nodebuffer?s.transformTo("nodebuffer",t).toString("utf-8"):function(t){for(var e,r,n,i=t.length,o=new Array(2*i),a=e=0;a>10&1023,o[e++]=56320|1023&r)}return o.length!==e&&(o.subarray?o=o.subarray(0,e):o.length=e),s.applyFromCharCode(o)}(t=s.transformTo(l.uint8array?"uint8array":"array",t))},s.inherits(a,n),a.prototype.processChunk=function(t){var e=s.transformTo(l.uint8array?"uint8array":"array",t.data);this.leftOver&&this.leftOver.length&&(l.uint8array?(n=e,(e=new Uint8Array(n.length+this.leftOver.length)).set(this.leftOver,0),e.set(n,this.leftOver.length)):e=this.leftOver.concat(e),this.leftOver=null);var r=function(t,e){for(var r=(e=(e=e||t.length)>t.length?t.length:e)-1;0<=r&&128==(192&t[r]);)r--;return!(r<0)&&0!==r&&r+h[t[r]]>e?r:e}(e),n=e;r!==e.length&&(l.uint8array?(n=e.subarray(0,r),this.leftOver=e.subarray(r,e.length)):(n=e.slice(0,r),this.leftOver=e.slice(r,e.length))),this.push({data:i.utf8decode(n),meta:t.meta})},a.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=a,s.inherits(c,n),c.prototype.processChunk=function(t){this.push({data:i.utf8encode(t.data),meta:t.meta})},i.Utf8EncodeWorker=c},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,e,a){"use strict";var s=t("./support"),l=t("./base64"),r=t("./nodejsUtils"),n=t("set-immediate-shim"),h=t("./external");function i(t){return t}function c(t,e){for(var r=0;r>8;this.dir=!!(16&this.externalFileAttributes),0==t&&(this.dosPermissions=63&this.externalFileAttributes),3==t&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(t){var e;this.extraFields[1]&&(e=n(this.extraFields[1].value),this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4)))},readExtraFields:function(t){var e,r,n,i=t.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});t.index+4>>6:(r<65536?e[i++]=224|r>>>12:(e[i++]=240|r>>>18,e[i++]=128|r>>>12&63),e[i++]=128|r>>>6&63),e[i++]=128|63&r);return e},r.buf2binstring=function(t){return c(t,t.length)},r.binstring2buf=function(t){for(var e=new l.Buf8(t.length),r=0,n=e.length;r>10&1023,a[r++]=56320|1023&n)}return c(a,r)},r.utf8border=function(t,e){for(var r=(e=(e=e||t.length)>t.length?t.length:e)-1;0<=r&&128==(192&t[r]);)r--;return!(r<0)&&0!==r&&r+h[t[r]]>e?r:e}},{"./common":41}],43:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){for(var i=65535&t|0,o=t>>>16&65535|0,a=0;0!==r;){for(r-=a=2e3>>1:r>>>1;t[e]=r}return t}();e.exports=function(t,e,r,n){var i=s,o=n+r;t^=-1;for(var a=n;a>>8^i[255&(t^e[a])];return-1^t}},{}],46:[function(t,e,r){"use strict";var s,u=t("../utils/common"),l=t("./trees"),d=t("./adler32"),f=t("./crc32"),n=t("./messages"),h=0,c=0,p=-2,i=2,m=8,o=286,a=30,g=19,w=2*o+1,b=15,y=3,v=258,_=v+y+1,k=42,x=113;function E(t,e){return t.msg=n[e],e}function S(t){return(t<<1)-(4t.avail_out?t.avail_out:r)&&(u.arraySet(t.output,e.pending_buf,e.pending_out,r,t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,0===e.pending&&(e.pending_out=0))}function B(t,e){l._tr_flush_block(t,0<=t.block_start?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,C(t.strm)}function z(t,e){t.pending_buf[t.pending++]=e}function F(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function P(t,e){var r,n,i=t.max_chain_length,o=t.strstart,a=t.prev_length,s=t.nice_match,l=t.strstart>t.w_size-_?t.strstart-(t.w_size-_):0,h=t.window,c=t.w_mask,u=t.prev,d=t.strstart+v,f=h[o+a-1],p=h[o+a];t.prev_length>=t.good_match&&(i>>=2),s>t.lookahead&&(s=t.lookahead);do{if(h[(r=e)+a]===p&&h[r+a-1]===f&&h[r]===h[o]&&h[++r]===h[o+1]){for(o+=2,r++;h[++o]===h[++r]&&h[++o]===h[++r]&&h[++o]===h[++r]&&h[++o]===h[++r]&&h[++o]===h[++r]&&h[++o]===h[++r]&&h[++o]===h[++r]&&h[++o]===h[++r]&&ol&&0!=--i);return a<=t.lookahead?a:t.lookahead}function T(t){var e,r,n,i,o,a,s,l,h,c=t.w_size;do{if(l=t.window_size-t.lookahead-t.strstart,t.strstart>=c+(c-_)){for(u.arraySet(t.window,t.window,c,c,0),t.match_start-=c,t.strstart-=c,t.block_start-=c,e=r=t.hash_size;n=t.head[--e],t.head[e]=c<=n?n-c:0,--r;);for(e=r=c;n=t.prev[--e],t.prev[e]=c<=n?n-c:0,--r;);l+=c}if(0===t.strm.avail_in)break;if(o=t.strm,a=t.window,s=t.strstart+t.lookahead,h=void 0,r=0===(h=(l=l)<(h=o.avail_in)?l:h)?0:(o.avail_in-=h,u.arraySet(a,o.input,o.next_in,h,s),1===o.state.wrap?o.adler=d(o.adler,a,h,s):2===o.state.wrap&&(o.adler=f(o.adler,a,h,s)),o.next_in+=h,o.total_in+=h,h),t.lookahead+=r,t.lookahead+t.insert>=y)for(i=t.strstart-t.insert,t.ins_h=t.window[i],t.ins_h=(t.ins_h<=y&&(t.ins_h=(t.ins_h<=y)if(n=l._tr_tally(t,t.strstart-t.match_start,t.match_length-y),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=y){for(t.match_length--;t.strstart++,t.ins_h=(t.ins_h<=y&&(t.ins_h=(t.ins_h<=y&&t.match_length<=t.prev_length){for(i=t.strstart+t.lookahead-y,n=l._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-y),t.lookahead-=t.prev_length-1,t.prev_length-=2;++t.strstart<=i&&(t.ins_h=(t.ins_h<t.pending_buf_size-5&&(r=t.pending_buf_size-5);;){if(t.lookahead<=1){if(T(t),0===t.lookahead&&e===h)return 1;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var n=t.block_start+r;if((0===t.strstart||t.strstart>=n)&&(t.lookahead=t.strstart-n,t.strstart=n,B(t,!1),0===t.strm.avail_out))return 1;if(t.strstart-t.block_start>=t.w_size-_&&(B(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(B(t,!0),0===t.strm.avail_out?3:4):(t.strstart>t.block_start&&(B(t,!1),t.strm.avail_out),1)}),new R(4,4,8,4,I),new R(4,5,16,8,I),new R(4,6,32,32,I),new R(4,4,16,16,O),new R(8,16,32,32,O),new R(8,16,128,128,O),new R(8,32,128,256,O),new R(32,128,258,1024,O),new R(32,258,258,4096,O)],r.deflateInit=function(t,e){return U(t,e,m,15,8,0)},r.deflateInit2=U,r.deflateReset=M,r.deflateResetKeep=L,r.deflateSetHeader=function(t,e){return!t||!t.state||2!==t.state.wrap?p:(t.state.gzhead=e,c)},r.deflate=function(t,e){var r,n,i,o;if(!t||!t.state||5>8&255),z(r,r.gzhead.time>>16&255),z(r,r.gzhead.time>>24&255),z(r,9===r.level?2:2<=r.strategy||r.level<2?4:0),z(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(z(r,255&r.gzhead.extra.length),z(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(t.adler=f(t.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69):(z(r,0),z(r,0),z(r,0),z(r,0),z(r,0),z(r,9===r.level?2:2<=r.strategy||r.level<2?4:0),z(r,3),r.status=x)):(o=m+(r.w_bits-8<<4)<<8,o|=(2<=r.strategy||r.level<2?0:r.level<6?1:6===r.level?2:3)<<6,0!==r.strstart&&(o|=32),o+=31-o%31,r.status=x,F(r,o),0!==r.strstart&&(F(r,t.adler>>>16),F(r,65535&t.adler)),t.adler=1)),69===r.status)if(r.gzhead.extra){for(n=r.pending;r.gzindex<(65535&r.gzhead.extra.length)&&(r.pending!==r.pending_buf_size||(r.gzhead.hcrc&&r.pending>n&&(t.adler=f(t.adler,r.pending_buf,r.pending-n,n)),C(t),n=r.pending,r.pending!==r.pending_buf_size));)z(r,255&r.gzhead.extra[r.gzindex]),r.gzindex++;r.gzhead.hcrc&&r.pending>n&&(t.adler=f(t.adler,r.pending_buf,r.pending-n,n)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=73)}else r.status=73;if(73===r.status)if(r.gzhead.name){n=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>n&&(t.adler=f(t.adler,r.pending_buf,r.pending-n,n)),C(t),n=r.pending,r.pending===r.pending_buf_size)){i=1;break}}while(i=r.gzindexn&&(t.adler=f(t.adler,r.pending_buf,r.pending-n,n)),0===i&&(r.gzindex=0,r.status=91)}else r.status=91;if(91===r.status)if(r.gzhead.comment){n=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>n&&(t.adler=f(t.adler,r.pending_buf,r.pending-n,n)),C(t),n=r.pending,r.pending===r.pending_buf_size)){i=1;break}}while(i=r.gzindexn&&(t.adler=f(t.adler,r.pending_buf,r.pending-n,n)),0===i&&(r.status=103)}else r.status=103;if(103===r.status&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&C(t),r.pending+2<=r.pending_buf_size&&(z(r,255&t.adler),z(r,t.adler>>8&255),t.adler=0,r.status=x)):r.status=x),0!==r.pending){if(C(t),0===t.avail_out)return r.last_flush=-1,c}else if(0===t.avail_in&&S(e)<=S(a)&&4!==e)return E(t,-5);if(666===r.status&&0!==t.avail_in)return E(t,-5);if(0!==t.avail_in||0!==r.lookahead||e!==h&&666!==r.status){var a=2===r.strategy?function(t,e){for(var r;;){if(0===t.lookahead&&(T(t),0===t.lookahead)){if(e===h)return 1;break}if(t.match_length=0,r=l._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(B(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(B(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(B(t,!1),0===t.strm.avail_out)?1:2}(r,e):3===r.strategy?function(t,e){for(var r,n,i,o,a=t.window;;){if(t.lookahead<=v){if(T(t),t.lookahead<=v&&e===h)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=y&&0t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=y?(r=l._tr_tally(t,1,t.match_length-y),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=l._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(B(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(B(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(B(t,!1),0===t.strm.avail_out)?1:2}(r,e):s[r.level].func(r,e);if(3!==a&&4!==a||(r.status=666),1===a||3===a)return 0===t.avail_out&&(r.last_flush=-1),c;if(2===a&&(1===e?l._tr_align(r):5!==e&&(l._tr_stored_block(r,0,0,!1),3===e&&(A(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),C(t),0===t.avail_out))return r.last_flush=-1,c}return 4!==e?c:r.wrap<=0?1:(2===r.wrap?(z(r,255&t.adler),z(r,t.adler>>8&255),z(r,t.adler>>16&255),z(r,t.adler>>24&255),z(r,255&t.total_in),z(r,t.total_in>>8&255),z(r,t.total_in>>16&255),z(r,t.total_in>>24&255)):(F(r,t.adler>>>16),F(r,65535&t.adler)),C(t),0=r.w_size&&(0===o&&(A(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new u.Buf8(r.w_size),u.arraySet(l,e,h-r.w_size,r.w_size,0),e=l,h=r.w_size),a=t.avail_in,s=t.next_in,l=t.input,t.avail_in=h,t.next_in=0,t.input=e,T(r);r.lookahead>=y;){for(n=r.strstart,i=r.lookahead-(y-1);r.ins_h=(r.ins_h<>>=n=r>>>24,k-=n,0==(n=r>>>16&255))f[d++]=65535&r;else{if(!(16&n)){if(0==(64&n)){r=x[(65535&r)+(_&(1<>>=n,k-=n),k<15&&(_+=c[h++]<>>=n=r>>>24,k-=n,!(16&(n=r>>>16&255))){if(0==(64&n)){r=E[(65535&r)+(_&(1<>>=n,k-=n,(n=d-p)>3,_&=(1<<(k-=i<<3))-1,t.next_in=h,t.next_out=d,t.avail_in=h>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function o(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new z.Buf16(320),this.work=new z.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function a(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=D,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new z.Buf32(n),e.distcode=e.distdyn=new z.Buf32(i),e.sane=1,e.back=-1,O):R}function s(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,a(t)):R}function l(t,e){var r,n;return t&&t.state?(n=t.state,e<0?(r=0,e=-e):(r=1+(e>>4),e<48&&(e&=15)),e&&(e<8||15=i.wsize?(z.arraySet(i.window,e,r-i.wsize,i.wsize,0),i.wnext=0,i.whave=i.wsize):(n<(t=i.wsize-i.wnext)&&(t=n),z.arraySet(i.window,e,r-n,t,i.wnext),(n-=t)?(z.arraySet(i.window,e,r-n,n,0),i.wnext=n,i.whave=i.wsize):(i.wnext+=t,i.wnext===i.wsize&&(i.wnext=0),i.whave>>8&255,r.check=P(r.check,C,2,0),c=h=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg="incorrect header check",r.mode=30;break}if(8!=(15&h)){t.msg="unknown compression method",r.mode=30;break}if(c-=4,k=8+(15&(h>>>=4)),0===r.wbits)r.wbits=k;else if(k>r.wbits){t.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(C[0]=255&h,C[1]=h>>>8&255,r.check=P(r.check,C,2,0)),c=h=0,r.mode=3;case 3:for(;c<32;){if(0===s)break t;s--,h+=n[o++]<>>8&255,C[2]=h>>>16&255,C[3]=h>>>24&255,r.check=P(r.check,C,4,0)),c=h=0,r.mode=4;case 4:for(;c<16;){if(0===s)break t;s--,h+=n[o++]<>8),512&r.flags&&(C[0]=255&h,C[1]=h>>>8&255,r.check=P(r.check,C,2,0)),c=h=0,r.mode=5;case 5:if(1024&r.flags){for(;c<16;){if(0===s)break t;s--,h+=n[o++]<>>8&255,r.check=P(r.check,C,2,0)),c=h=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((f=s<(f=r.length)?s:f)&&(r.head&&(k=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),z.arraySet(r.head.extra,n,o,f,k)),512&r.flags&&(r.check=P(r.check,n,f,o)),s-=f,o+=f,r.length-=f),r.length))break t;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===s)break t;for(f=0;k=n[o+f++],r.head&&k&&r.length<65536&&(r.head.name+=String.fromCharCode(k)),k&&f>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=12;break;case 10:for(;c<32;){if(0===s)break t;s--,h+=n[o++]<>>=7&c,c-=7&c,r.mode=27;break}for(;c<3;){if(0===s)break t;s--,h+=n[o++]<>>=1)){case 0:r.mode=14;break;case 1:if(function(t){if(j){var e;for(M=new z.Buf32(512),U=new z.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(I(1,t.lens,0,288,M,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;I(2,t.lens,0,32,U,0,t.work,{bits:5}),j=!1}t.lencode=M,t.lenbits=9,t.distcode=U,t.distbits=5}(r),r.mode=20,6!==e)break;h>>>=2,c-=2;break t;case 2:r.mode=17;break;case 3:t.msg="invalid block type",r.mode=30}h>>>=2,c-=2;break;case 14:for(h>>>=7&c,c-=7&c;c<32;){if(0===s)break t;s--,h+=n[o++]<>>16^65535)){t.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&h,c=h=0,r.mode=15,6===e)break t;case 15:r.mode=16;case 16:if(f=r.length){if(0===(f=l<(f=s>>=5,c-=5,r.ndist=1+(31&h),h>>>=5,c-=5,r.ncode=4+(15&h),h>>>=4,c-=4,286>>=3,c-=3}for(;r.have<19;)r.lens[B[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,E={bits:r.lenbits},x=I(0,r.lens,0,19,r.lencode,0,r.work,E),r.lenbits=E.bits,x){t.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,b=65535&A,!((g=A>>>24)<=c);){if(0===s)break t;s--,h+=n[o++]<>>=g,c-=g,r.lens[r.have++]=b;else{if(16===b){for(S=g+2;c>>=g,c-=g,0===r.have){t.msg="invalid bit length repeat",r.mode=30;break}k=r.lens[r.have-1],f=3+(3&h),h>>>=2,c-=2}else if(17===b){for(S=g+3;c>>=g)),h>>>=3,c-=3}else{for(S=g+7;c>>=g)),h>>>=7,c-=7}if(r.have+f>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=30;break}for(;f--;)r.lens[r.have++]=k}}if(30===r.mode)break;if(0===r.lens[256]){t.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,E={bits:r.lenbits},x=I(1,r.lens,0,r.nlen,r.lencode,0,r.work,E),r.lenbits=E.bits,x){t.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,E={bits:r.distbits},x=I(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,E),r.distbits=E.bits,x){t.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===e)break t;case 20:r.mode=21;case 21:if(6<=s&&258<=l){t.next_out=a,t.avail_out=l,t.next_in=o,t.avail_in=s,r.hold=h,r.bits=c,T(t,d),a=t.next_out,i=t.output,l=t.avail_out,o=t.next_in,n=t.input,s=t.avail_in,h=r.hold,c=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;w=(A=r.lencode[h&(1<>>16&255,b=65535&A,!((g=A>>>24)<=c);){if(0===s)break t;s--,h+=n[o++]<>y)])>>>16&255,b=65535&A,!(y+(g=A>>>24)<=c);){if(0===s)break t;s--,h+=n[o++]<>>=y,c-=y,r.back+=y}if(h>>>=g,c-=g,r.back+=g,r.length=b,0===w){r.mode=26;break}if(32&w){r.back=-1,r.mode=12;break}if(64&w){t.msg="invalid literal/length code",r.mode=30;break}r.extra=15&w,r.mode=22;case 22:if(r.extra){for(S=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;w=(A=r.distcode[h&(1<>>16&255,b=65535&A,!((g=A>>>24)<=c);){if(0===s)break t;s--,h+=n[o++]<>y)])>>>16&255,b=65535&A,!(y+(g=A>>>24)<=c);){if(0===s)break t;s--,h+=n[o++]<>>=y,c-=y,r.back+=y}if(h>>>=g,c-=g,r.back+=g,64&w){t.msg="invalid distance code",r.mode=30;break}r.offset=b,r.extra=15&w,r.mode=24;case 24:if(r.extra){for(S=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===l)break t;if(r.offset>(f=d-l)){if((f=r.offset-f)>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=30;break}p=f>r.wnext?(f-=r.wnext,r.wsize-f):r.wnext-f,f>r.length&&(f=r.length),m=r.window}else m=i,p=a-r.offset,f=r.length;for(l-=f=lf?(m=T[I+a[y]],B[z+a[y]]):(m=96,0),l=1<<(p=b-E),v=h=1<>E)+(h-=l)]=p<<24|m<<16|g|0,0!==h;);for(l=1<>=1;if(0!==l?(C&=l-1,C+=l):C=0,y++,0==--F[b]){if(b===_)break;b=e[r+a[y]]}if(k>>7)]}function k(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function x(t,e,r){t.bi_valid>o-r?(t.bi_buf|=e<>o-t.bi_valid,t.bi_valid+=r-o):(t.bi_buf|=e<>>=1,r<<=1,0<--e;);return r>>>1}function A(t,e,r){for(var n,i=new Array(16),o=0,a=1;a<=15;a++)i[a]=o=o+r[a-1]<<1;for(n=0;n<=e;n++){var s=t[2*n+1];0!==s&&(t[2*n]=S(i[s]++,s))}}function C(t){for(var e=0;e<286;e++)t.dyn_ltree[2*e]=0;for(e=0;e<30;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function B(t){8>1;1<=e;e--)F(t,i,e);for(n=s;e=t.heap[1],t.heap[1]=t.heap[t.heap_len--],F(t,i,1),r=t.heap[1],t.heap[--t.heap_max]=e,t.heap[--t.heap_max]=r,i[2*n]=i[2*e]+i[2*r],t.depth[n]=(t.depth[e]>=t.depth[r]?t.depth[e]:t.depth[r])+1,i[2*e+1]=i[2*r+1]=n,t.heap[1]=n++,F(t,i,1),2<=t.heap_len;);t.heap[--t.heap_max]=t.heap[1],function(t){for(var e,r,n,i,o,a=m.dyn_tree,s=m.max_code,l=m.stat_desc.static_tree,h=m.stat_desc.has_stree,c=m.stat_desc.extra_bits,u=m.stat_desc.extra_base,d=m.stat_desc.max_length,f=0,p=0;p<=15;p++)t.bl_count[p]=0;for(a[2*t.heap[t.heap_max]+1]=0,e=t.heap_max+1;e<573;e++)d<(p=a[2*a[2*(r=t.heap[e])+1]+1]+1)&&(p=d,f++),a[2*r+1]=p,s>=7;o<30;o++)for(b[o]=n<<7,t=0;t<1<>>=1)if(1&e&&0!==t.dyn_ltree[2*r])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(r=32;r<256;r++)if(0!==t.dyn_ltree[2*r])return 1;return 0}(t)),T(t,t.l_desc),T(t,t.d_desc),a=function(t){var e;for(I(t,t.dyn_ltree,t.l_desc.max_code),I(t,t.dyn_dtree,t.d_desc.max_code),T(t,t.bl_desc),e=18;3<=e&&0===t.bl_tree[2*s[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),i=t.opt_len+3+7>>>3,(o=t.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==e?D(t,e,r,n):4===t.strategy||o===i?(x(t,2+(n?1:0),3),P(t,c,u)):(x(t,4+(n?1:0),3),function(t,e,r,n){var i;for(x(t,e-257,5),x(t,r-1,5),x(t,n-4,4),i=0;i>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&r,t.last_lit++,0===e?t.dyn_ltree[2*r]++:(t.matches++,e--,t.dyn_ltree[2*(f[r]+256+1)]++,t.dyn_dtree[2*_(e)]++),t.last_lit===t.lit_bufsize-1},r._tr_align=function(t){x(t,2,3),E(t,256,c),16===(t=t).bi_valid?(k(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):8<=t.bi_valid&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}},{"../utils/common":41}],53:[function(t,e,r){"use strict";e.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(t,e,r){"use strict";e.exports="function"==typeof setImmediate?setImmediate:function(){var t=[].slice.apply(arguments);t.splice(1,0,0),setTimeout.apply(null,t)}},{}]},{},[10])(10)},560:()=>{HTMLCanvasElement.prototype.toBlob||(HTMLCanvasElement.prototype.toBlob=function(i,o,t){var a=this.toDataURL(o,t).split(",")[1];setTimeout(function(){for(var t=atob(a),e=t.length,r=new Uint8Array(e),n=0;n{"use strict";function n(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,n=new Array(e);ra});var o,s,l,h,c,e=(o=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden])","iframe","object","embed","[contenteditable]",'[tabindex]:not([tabindex^="-"])'],s=function(){function d(t){var e=t.targetModal,r=t.triggers,n=void 0===r?[]:r,i=t.onShow,o=void 0===i?function(){}:i,a=t.onClose,s=void 0===a?function(){}:a,l=t.openTrigger,h=void 0===l?"data-micromodal-trigger":l,c=t.closeTrigger,u=void 0===c?"data-micromodal-close":c,r=t.openClass,i=void 0===r?"is-open":r,a=t.disableScroll,l=void 0!==a&&a,c=t.disableFocus,r=void 0!==c&&c,a=t.awaitCloseAnimation,c=void 0!==a&&a,a=t.awaitOpenAnimation,a=void 0!==a&&a,t=t.debugMode,t=void 0!==t&&t;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,d),this.modal=document.getElementById(e),this.config={debugMode:t,disableScroll:l,openTrigger:h,closeTrigger:u,openClass:i,onShow:o,onClose:s,awaitCloseAnimation:c,awaitOpenAnimation:a,disableFocus:r},0
')),!1},c=function(t){if(t.length<=0)return console.warn("MicroModal: ❗Please specify at least one %c'micromodal-trigger'","background-color: #f8f9fa;color: #50596c;font-weight: bold;","data attribute."),console.warn("%cExample:","background-color: #f8f9fa;color: #50596c;font-weight: bold;",''),!1},{init:function(t){var r,n,e=Object.assign({},{openTrigger:"data-micromodal-trigger"},t),t=f(document.querySelectorAll("[".concat(e.openTrigger,"]"))),i=(r=e.openTrigger,n=[],t.forEach(function(t){var e=t.attributes[r].value;void 0===n[e]&&(n[e]=[]),n[e].push(t)}),n);if(!0!==e.debugMode||!1!==function(t,e){if(c(t),!e)return!0;for(var r in e)h(r);return!0}(t,i))for(var o in i){var a=i[o];e.targetModal=o,e.triggers=f(a),l=new s(e)}},show:function(t,e){e=e||{};e.targetModal=t,!0===e.debugMode&&!1===h(t)||(l&&l.removeEventListeners(),(l=new s(e)).showModal())},close:function(t){t?l.closeModalById(t):l.closeModal()}});const a=window.MicroModal=e},57:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>n});const n="(function(b){function a(b,d){if({}.hasOwnProperty.call(a.cache,b))return a.cache[b];var e=a.resolve(b);if(!e)throw new Error('Failed to resolve module '+b);var c={id:b,require:a,filename:b,exports:{},loaded:!1,parent:d,children:[]};d&&d.children.push(c);var f=b.slice(0,b.lastIndexOf('/')+1);return a.cache[b]=c.exports,e.call(c.exports,c,c.exports,f,b),c.loaded=!0,a.cache[b]=c.exports}a.modules={},a.cache={},a.resolve=function(b){return{}.hasOwnProperty.call(a.modules,b)?a.modules[b]:void 0},a.define=function(b,c){a.modules[b]=c},a.define('/gif.worker.coffee',function(d,e,f,g){var b,c;b=a('/GIFEncoder.js',d),c=function(a){var c,e,d,f;return c=new b(a.width,a.height),a.index===0?c.writeHeader():c.firstFrame=!1,c.setTransparent(a.transparent),c.setRepeat(a.repeat),c.setDelay(a.delay),c.setQuality(a.quality),c.addFrame(a.data),a.last&&c.finish(),d=c.stream(),a.data=d.pages,a.cursor=d.cursor,a.pageSize=d.constructor.pageSize,a.canTransfer?(f=function(c){for(var b=0,d=a.data.length;b=c.pageSize&&this.newPage(),this.pages[this.page][this.cursor++]=a},c.prototype.writeUTFBytes=function(b){for(var c=b.length,a=0;a=0&&(this.dispose=a)},b.prototype.setRepeat=function(a){this.repeat=a},b.prototype.setTransparent=function(a){this.transparent=a},b.prototype.addFrame=function(a){this.image=a,this.getImagePixels(),this.analyzePixels(),this.firstFrame&&(this.writeLSD(),this.writePalette(),this.repeat>=0&&this.writeNetscapeExt()),this.writeGraphicCtrlExt(),this.writeImageDesc(),this.firstFrame||this.writePalette(),this.writePixels(),this.firstFrame=!1},b.prototype.finish=function(){this.out.writeByte(59)},b.prototype.setQuality=function(a){a<1&&(a=1),this.sample=a},b.prototype.writeHeader=function(){this.out.writeUTFBytes('GIF89a')},b.prototype.analyzePixels=function(){var g=this.pixels.length,d=g/3;this.indexedPixels=new Uint8Array(d);var a=new f(this.pixels,this.sample);a.buildColormap(),this.colorTab=a.getColormap();var b=0;for(var c=0;c>16,l=(e&65280)>>8,m=e&255,c=0,d=16777216,j=this.colorTab.length;for(var a=0;a=0&&(a=dispose&7),a<<=2,this.out.writeByte(0|a|0|b),this.writeShort(this.delay),this.out.writeByte(this.transIndex),this.out.writeByte(0)},b.prototype.writeImageDesc=function(){this.out.writeByte(44),this.writeShort(0),this.writeShort(0),this.writeShort(this.width),this.writeShort(this.height),this.firstFrame?this.out.writeByte(0):this.out.writeByte(128|this.palSize)},b.prototype.writeLSD=function(){this.writeShort(this.width),this.writeShort(this.height),this.out.writeByte(240|this.palSize),this.out.writeByte(0),this.out.writeByte(0)},b.prototype.writeNetscapeExt=function(){this.out.writeByte(33),this.out.writeByte(255),this.out.writeByte(11),this.out.writeUTFBytes('NETSCAPE2.0'),this.out.writeByte(3),this.out.writeByte(1),this.writeShort(this.repeat),this.out.writeByte(0)},b.prototype.writePalette=function(){this.out.writeBytes(this.colorTab);var b=768-this.colorTab.length;for(var a=0;a>8&255)},b.prototype.writePixels=function(){var a=new g(this.width,this.height,this.indexedPixels,this.colorDepth);a.encode(this.out)},b.prototype.stream=function(){return this.out},e.exports=b}),a.define('/LZWEncoder.js',function(e,g,h,i){function f(y,D,C,B){function w(a,b){r[f++]=a,f>=254&&t(b)}function x(b){u(a),k=i+2,j=!0,l(i,b)}function u(b){for(var a=0;a=0){y=w-d,d===0&&(y=1);do if((d-=y)<0&&(d+=w),h[d]===g){e=n[d];continue a}while(h[d]>=0)}l(e,r),e=t,k<1<0&&(a.writeByte(f),a.writeBytes(r,0,f),f=0)}function p(a){return(1<0?g|=a<=8)w(g&255,c),g>>=8,e-=8;if((k>m||j)&&(j?(m=p(n_bits=q),j=!1):(++n_bits,n_bits==b?m=1<0)w(g&255,c),g>>=8,e-=8;t(c)}}var s=Math.max(2,B),r=new Uint8Array(256),h=new Int32Array(a),n=new Int32Array(a),g,e=0,f,k=0,m,j=!1,q,i,o;this.encode=z}var c=-1,b=12,a=5003,d=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];e.exports=f}),a.define('/TypedNeuQuant.js',function(A,F,E,D){function C(A,B){function I(){o=[],q=new Int32Array(256),t=new Int32Array(a),y=new Int32Array(a),z=new Int32Array(a>>3);var c,d;for(c=0;c>=b,o[c][1]>>=b,o[c][2]>>=b,o[c][3]=c}function K(b,a,c,e,f){o[a][0]-=b*(o[a][0]-c)/d,o[a][1]-=b*(o[a][1]-e)/d,o[a][2]-=b*(o[a][2]-f)/d}function L(j,e,n,l,k){var h=Math.abs(e-j),i=Math.min(e+j,a),g=e+1,f=e-1,m=1,b,d;while(gh)d=z[m++],gh&&(b=o[f--],b[0]-=d*(b[0]-n)/c,b[1]-=d*(b[1]-l)/c,b[2]-=d*(b[2]-k)/c)}function C(p,s,q){var h=2147483647,k=h,d=-1,m=d,c,j,e,n,l;for(c=0;c>i-b),n>g,y[c]-=l,t[c]+=l<>1,b=f+1;b>1,b=f+1;b<256;b++)q[b]=n}function E(j,i,k){var b,d,c,e=1e3,h=-1,f=q[i],g=f-1;while(f=0)f=e?f=a:(f++,c<0&&(c=-c),b=d[0]-j,b<0&&(b=-b),c+=b,c=0&&(d=o[g],c=i-d[1],c>=e?g=-1:(g--,c<0&&(c=-c),b=d[0]-j,b<0&&(b=-b),c+=b,c>h;for(a<=1&&(a=0),c=0;c=f&&(g-=f),c++,q===0&&(q=1),c%q===0)for(n-=n/D,o-=o/v,a=o>>h,a<=1&&(a=0),e=0;e>g,r=e<>3,h=6,t=1<a[0]&&e[1]{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.css=void 0,e.css='\n/************************** Basic Modal Styles\n**************************/\n\n.modal {\n font-family: -apple-system,BlinkMacSystemFont,avenir next,avenir,helvetica neue,helvetica,ubuntu,roboto,noto,segoe ui,arial,sans-serif;\n}\n\n.modal__overlay {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: rgba(0,0,0,0.6);\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.modal__container {\n background-color: #fff;\n padding: 30px;\n max-width: 500px;\n max-height: 100vh;\n overflow-y: auto;\n box-sizing: border-box;\n}\n\n.modal__header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n.modal__title {\n margin-top: 0;\n margin-bottom: 0;\n font-weight: 600;\n font-size: 1.25rem;\n line-height: 1.25;\n color: #222;\n box-sizing: border-box;\n}\n\n.modal__footer {\n text-align: right;\n}\n\n.modal__footer>.modal__btn {\n margin-right: 8px;\n}\n\n.modal__close {\n background: transparent;\n border: 0;\n}\n\n.modal__header .modal__close:before { content: "✕"; }\n\n.modal__content {\n margin-top: 2rem;\n margin-bottom: 2rem;\n line-height: 1.5;\n color: rgba(0,0,0,.8);\n}\n\n.modal__btn {\n font-size: .875rem;\n padding-left: 1rem;\n padding-right: 1rem;\n padding-top: .5rem;\n padding-bottom: .5rem;\n background-color: #e6e6e6;\n color: rgba(0,0,0,.8);\n border-radius: .25rem;\n border-style: none;\n border-width: 0;\n cursor: pointer;\n -webkit-appearance: button;\n text-transform: none;\n overflow: visible;\n line-height: 1.15;\n margin: 0;\n will-change: transform;\n -moz-osx-font-smoothing: grayscale;\n -webkit-backface-visibility: hidden;\n backface-visibility: hidden;\n -webkit-transform: translateZ(0);\n transform: translateZ(0);\n transition: -webkit-transform .25s ease-out;\n transition: transform .25s ease-out;\n transition: transform .25s ease-out,-webkit-transform .25s ease-out;\n}\n\n.modal__btn:focus, .modal__btn:hover {\n -webkit-transform: scale(1.05);\n transform: scale(1.05);\n}\n\n.modal__btn-primary {\n background-color: #333;\n color: #fff;\n}\n\n\n\n/************************** Demo Animation Style\n**************************/\n@keyframes mmfadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n@keyframes mmfadeOut {\n from { opacity: 1; }\n to { opacity: 0; }\n}\n\n@keyframes mmslideIn {\n from { transform: translateY(15%); }\n to { transform: translateY(0); }\n}\n\n@keyframes mmslideOut {\n from { transform: translateY(0); }\n to { transform: translateY(-10%); }\n}\n\n.micromodal-slide {\n display: none;\n}\n\n.micromodal-slide.is-open {\n display: block;\n}\n\n.micromodal-slide[aria-hidden="false"] .modal__overlay {\n animation: mmfadeIn .3s cubic-bezier(0.0, 0.0, 0.2, 1);\n}\n\n.micromodal-slide[aria-hidden="false"] .modal__container {\n animation: mmslideIn .3s cubic-bezier(0, 0, .2, 1);\n}\n\n.micromodal-slide[aria-hidden="true"] .modal__overlay {\n animation: mmfadeOut .3s cubic-bezier(0.0, 0.0, 0.2, 1);\n}\n\n.micromodal-slide[aria-hidden="true"] .modal__container {\n animation: mmslideOut .3s cubic-bezier(0, 0, .2, 1);\n}\n\n.micromodal-slide .modal__container,\n.micromodal-slide .modal__overlay {\n will-change: transform;\n}\n'},330:function(t,e,r){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r
"),r=document.createElement("div");return r.innerHTML=t,r.firstChild}r.textContent=o.css,document.head.append(r);var l=!1,h=!1,c="alert",u=s(c,"Warning"),d="dialog",f=s(d,"Saving...");e.showWarning=function(t){console.warn(t),a.PARAMS.SHOW_ALERTS&&(l||(l=!0,document.getElementsByTagName("body")[0].appendChild(u)),document.getElementById("modal-".concat(c,"-content")).innerHTML=t,i.default.show("modal-".concat(c)))},e.showDialog=function(t,e,r){a.PARAMS.VERBOSE&&console.log(t,e),a.PARAMS.SHOW_DIALOGS&&(h||(h=!0,document.getElementsByTagName("body")[0].appendChild(f)),document.getElementById("modal-".concat(d,"-title")).innerHTML=t,document.getElementById("modal-".concat(d,"-content")).innerHTML=e,i.default.show("modal-".concat(d)),0<(r=void 0!==(null==r?void 0:r.autoCloseDelay)?r.autoCloseDelay:-1)&&setTimeout(function(){i.default.close("modal-".concat(d))},r))};var p=document.createElement("div");e.initDotWithCSS=function(t){p.id="recordingDot",t=n({background:"red",width:"20px",height:"20px","border-radius":"50%",display:"none",position:"absolute",top:"0",right:"0","z-index":"10",margin:"20px"},t),Object.assign(p.style,t),document.getElementsByTagName("body")[0].appendChild(p)},e.showDot=function(t){a.PARAMS.SHOW_REC_DOT&&(p.style.display=t?"inline-block":"none")}},848:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PARAMS=void 0,e.PARAMS={VERBOSE:!1,SHOW_ALERTS:!1,SHOW_DIALOGS:!1,SHOW_REC_DOT:!1,IS_MANUALLY_CHECKING_HOTKEYS:!1}},886:(f,p,m)=>{var g;f=m.nmd(f),function(){var t,L,e,r;void 0!==f.exports&&(t=m(846),L=m(173),e=m(769),r=m(166));var n={function:!0,object:!0};function i(t){return t&&t.Object===Object?t:null}parseFloat,parseInt;var o,a=n[typeof p]&&p&&!p.nodeType?p:void 0,s=n.object&&f&&!f.nodeType?f:void 0,l=(s&&s.exports,i(a&&s&&"object"==typeof m.g&&m.g)),a=i(n[typeof self]&&self),s=i(n[typeof window]&&window),n=i(n[typeof this]&&this);l||s!==(n&&n.window)&&s||a||n||Function("return this")();function h(t){return String("0000000"+t).slice(-7)}"gc"in window||(window.gc=function(){}),HTMLCanvasElement.prototype.toBlob||Object.defineProperty(HTMLCanvasElement.prototype,"toBlob",{value:function(t,e,r){for(var n=atob(this.toDataURL(e,r).split(",")[1]),i=n.length,o=new Uint8Array(i),a=0;a=l.frameLimit||l.timeLimit&&t>=l.timeLimit)&&(T(),R());var e=new Date(null);e.setSeconds(t),2=h[r].triggerTime&&(I(h[r].callback),h.splice(r,1));for(r=0;r=c[r].triggerTime&&(I(c[r].callback),c[r].triggerTime+=c[r].time);f.forEach(function(t){I(t,n-M)}),f=[]}function R(t){t=t||function(t){return L(t,s.filename+s.extension,s.mimeType),!1},s.save(t)}function D(t){e&&console.log(t)}return{start:function(){!function(){function t(){return this._hooked||(this._hooked=!0,this._hookedTime=this.currentTime||0,this.pause(),P.push(this)),this._hookedTime+l.startTime}D("Capturer start"),i=window.Date.now(),n=i+l.startTime,a=window.performance.now(),o=a+l.startTime,window.Date.prototype.getTime=function(){return n},window.Date.now=function(){return n},window.setTimeout=function(t,e){e={callback:t,time:e,triggerTime:n+e};return h.push(e),D("Timeout set to "+e.time),e},window.clearTimeout=function(t){for(var e=0;e=.5*l.motionBlurFrames?function(){for(var t=b.data,e=0;e=this.settings.autoSaveTime?this.save(function(t){this.filename=this.baseFilename+"-part-"+h(this.part),L(t,this.filename+this.extension,this.mimeType),this.dispose(),this.part++,this.filename=this.baseFilename+"-part-"+h(this.part),this.step()}.bind(this)):this.step()},N.prototype.save=function(t){this.videoWriter.complete().then(t)},N.prototype.dispose=function(t){this.frames=[]},(W.prototype=Object.create(c.prototype)).start=function(){this.encoder.start(this.settings)},W.prototype.add=function(t){this.encoder.add(t)},W.prototype.save=function(t){this.callback=t,this.encoder.end()},W.prototype.safeToProceed=function(){return this.encoder.safeToProceed()},(G.prototype=Object.create(c.prototype)).add=function(t){this.stream||(this.stream=t.captureStream(this.framerate),this.mediaRecorder=new MediaRecorder(this.stream),this.mediaRecorder.start(),this.mediaRecorder.ondataavailable=function(t){this.chunks.push(t.data)}.bind(this)),this.step()},G.prototype.save=function(r){this.mediaRecorder.onstop=function(t){var e=new Blob(this.chunks,{type:"video/webm"});this.chunks=[],r(e)}.bind(this),this.mediaRecorder.stop()},(Z.prototype=Object.create(c.prototype)).add=function(t){this.sizeSet||(this.encoder.setOption("width",t.width),this.encoder.setOption("height",t.height),this.sizeSet=!0),this.canvas.width=t.width,this.canvas.height=t.height,this.ctx.drawImage(t,0,0),this.encoder.addFrame(this.ctx,{copy:!0,delay:this.settings.step}),this.step()},Z.prototype.save=function(t){this.callback=t,this.encoder.render()},(s||a||{}).CCapture=d,void 0===(g=function(){return d}.call(p,m,p,f))||(f.exports=g)}()},173:t=>{function e(e,t,r){var n,i=window,o="application/octet-stream",a=r||o,s=e,l=document,h=l.createElement("a"),r=function(t){return String(t)},c=i.Blob||i.MozBlob||i.WebKitBlob||r,e=i.MSBlobBuilder||i.WebKitBlobBuilder||i.BlobBuilder,u=t||"download";if("true"===String(this)&&(a=(s=[s,a])[0],s=s[1]),String(s).match(/^data\:[\w+\-]+\/[\w+\-]+[,;]/))return navigator.msSaveBlob?navigator.msSaveBlob(function(t){var e=t.split(/[:;,]/),t=e[1],r=("base64"==e[2]?atob:decodeURIComponent)(e.pop()),n=r.length,i=0,o=new Uint8Array(n);for(;i{t.exports=function n(i,o,a){function s(r,t){if(!o[r]){if(!i[r]){if(l)return l(r,!0);var e=new Error("Cannot find module '"+r+"'");throw e.code="MODULE_NOT_FOUND",e}e=o[r]={exports:{}},i[r][0].call(e.exports,function(t){var e=i[r][1][t];return s(e||t)},e,e.exports,n,i,o,a)}return o[r].exports}for(var l=void 0,t=0;tr&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.once=function(t,e){if(!l(e))throw TypeError("listener must be a function");var r=!1;function n(){this.removeListener(t,n),r||(r=!0,e.apply(this,arguments))}return n.listener=e,this.on(t,n),this},n.prototype.removeListener=function(t,e){var r,n,i,o;if(!l(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(i=(r=this._events[t]).length,n=-1,r===e||l(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(h(r)){for(o=i;0=o.pageSize&&this.newPage(),this.pages[this.page][this.cursor++]=t},o.prototype.writeUTFBytes=function(t){for(var e=t.length,r=0;r>16,(65280&t)>>8,255&t,e)},s.prototype.findClosestRGB=function(t,e,r,n){if(null===this.colorTab)return-1;if(this.neuQuant&&!n)return this.neuQuant.lookupRGB(t,e,r);for(var i=0,o=16777216,a=this.colorTab.length,s=0,l=0;s>8&255)},s.prototype.writePixels=function(){new i(this.width,this.height,this.indexedPixels,this.colorDepth).encode(this.out)},s.prototype.stream=function(){return this.out},e.exports=s},{"./LZWEncoder.js":3,"./TypedNeuQuant.js":4}],3:[function(t,e,r){var E=5003,S=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];e.exports=function(e,r,t,n){var i,l,h,c,u,d,o=Math.max(2,n),a=new Uint8Array(256),f=new Int32Array(E),p=new Int32Array(E),s=0,m=0,g=!1;function w(t,e){a[l++]=t,254<=l&&v(e)}function b(t){for(var e=0;e>=8,s-=8;if((h>=8,s-=8;v(e)}}this.encode=function(t){t.writeByte(o),remaining=e*r,curPixel=0,y(o+1,t),t.writeByte(0)}}},{}],4:[function(t,e,r){var E=256,S=1<<18;e.exports=function(b,y){var v,c,_,k,x;function t(){var t,e,r,n,i=b.length,o=30+(y-1)/3,a=i/(3*y),s=~~(a/100),l=1024,h=2048,c=h>>6;for(c<=1&&(c=0),w=0;w>12))>10,k[l]-=n,_[l]+=n<<10;return k[a]+=64,_[a]-=65536,s}(t,e,r),u=l,f=e,p=r,v[d=n][0]-=u*(v[d][0]-t)/1024,v[d][1]-=u*(v[d][1]-f)/1024,v[d][2]-=u*(v[d][2]-p)/1024,0!==c&&function(t,e,r,n,i){for(var o,a,s=Math.abs(e-t),l=Math.min(e+t,E),h=e+1,c=e-1,u=1;h>6)<=1&&(c=0),n=0;n>=4,v[t][1]>>=4,v[t][2]>>=4,v[t][3]=t}(),function(){for(var t,e,r,n,i,o=0,a=0,s=0;s>1,t=o+1;t>1,t=o+1;t<256;t++)c[t]=255}()},this.getColormap=function(){for(var t=[],e=[],r=0;r=this.frames.length))return t=this.frames[this.nextFrame++],e=this.freeWorkers.shift(),t=this.getTask(t),this.log("starting frame "+(t.index+1)+" of "+this.frames.length),this.activeWorkers.push(e),e.postMessage(t)},c.prototype.getContextData=function(t){return t.getImageData(0,0,this.options.width,this.options.height).data},c.prototype.getImageData=function(t){var e;return null==this._canvas&&(this._canvas=document.createElement("canvas"),this._canvas.width=this.options.width,this._canvas.height=this.options.height),(e=this._canvas.getContext("2d")).setFill=this.options.background,e.fillRect(0,0,this.options.width,this.options.height),e.drawImage(t,0,0),this.getContextData(e)},c.prototype.getTask=function(t){var e=this.frames.indexOf(t),e={index:e,last:e===this.frames.length-1,delay:t.delay,dispose:t.dispose,transparent:t.transparent,width:this.options.width,height:this.options.height,quality:this.options.quality,dither:this.options.dither,globalPalette:this.options.globalPalette,repeat:this.options.repeat,canTransfer:"chrome"===i.name};if(null!=t.data)e.data=t.data;else if(null!=t.context)e.data=this.getContextData(t.context);else{if(null==t.image)throw new Error("Invalid frame");e.data=this.getImageData(t.image)}return e},c.prototype.log=function(){var t=1<=arguments.length?h.call(arguments,0):[];if(this.options.debug)return console.log.apply(console,t)},c)},{"./GIFEncoder.js":2,"./browser.coffee":5,"./gif.worker.coffee":7,events:1}],7:[function(t,e,r){var n=t("./GIFEncoder.js"),i=function(i){var o,t=new n(i.width,i.height);return 0===i.index?t.writeHeader():t.firstFrame=!1,t.setTransparent(i.transparent),t.setDispose(i.dispose),t.setRepeat(i.repeat),t.setDelay(i.delay),t.setQuality(i.quality),t.setDither(i.dither),t.setGlobalPalette(i.globalPalette),t.addFrame(i.data),i.last&&t.finish(),!0===i.globalPalette&&(i.globalPalette=t.getGlobalPalette()),t=t.stream(),i.data=t.pages,i.cursor=t.cursor,i.pageSize=t.constructor.pageSize,i.canTransfer?(t=function(){for(var t=i.data,e=[],r=0,n=t.length;r{!function(){"use strict";var a=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"];function o(t){for(var e=new Uint8Array(t),r=0;r>18&63]+a[r>>12&63]+a[r>>6&63]+a[63&r];switch(o.length%4){case 1:o+="=";break;case 2:o+="=="}return o}}(),function(){"use strict";var e,r=window.utils;e=[{field:"fileName",length:100},{field:"fileMode",length:8},{field:"uid",length:8},{field:"gid",length:8},{field:"fileSize",length:12},{field:"mtime",length:12},{field:"checksum",length:8},{field:"type",length:1},{field:"linkName",length:100},{field:"ustar",length:8},{field:"owner",length:32},{field:"group",length:32},{field:"majorNumber",length:8},{field:"minorNumber",length:8},{field:"filenamePrefix",length:155},{field:"padding",length:12}],window.header={},window.header.structure=e,window.header.format=function(i,t){var o=r.clean(512),a=0;return e.forEach(function(t){for(var e=i[t.field]||"",r=0,n=e.length;ri&&(e.push({blocks:o,length:r}),o=[],r=0),o.push(t),r+=t.headerLength+t.inputLength}),e.push({blocks:o,length:r}),e.forEach(function(t){var e=new Uint8Array(t.length),r=0;t.blocks.forEach(function(t){e.set(t.header,r),r+=t.headerLength,e.set(t.input,r),r+=t.inputLength}),n.push(e)}),n.push(new Uint8Array(1024)),new Blob(n,{type:"octet/stream"})},t.prototype.clear=function(){this.written=0,this.out=u.clean(e)},void 0!==r.exports?r.exports=t:window.Tar=t}()},166:t=>{"use strict";function e(t){this.data=new Uint8Array(t),this.pos=0}e.prototype.seek=function(t){this.pos=t},e.prototype.writeBytes=function(t){for(var e=0;e>8,this.data[this.pos++]=t},e.prototype.writeDoubleBE=function(t){for(var e=new Uint8Array(new Float64Array([t]).buffer),r=e.length-1;0<=r;r--)this.writeByte(e[r])},e.prototype.writeFloatBE=function(t){for(var e=new Uint8Array(new Float32Array([t]).buffer),r=e.length-1;0<=r;r--)this.writeByte(e[r])},e.prototype.writeString=function(t){for(var e=0;e>8),this.writeU8(t);break;case 3:this.writeU8(32|t>>16),this.writeU8(t>>8),this.writeU8(t);break;case 4:this.writeU8(16|t>>24),this.writeU8(t>>16),this.writeU8(t>>8),this.writeU8(t);break;case 5:this.writeU8(8|t/4294967296&7),this.writeU8(t>>24),this.writeU8(t>>16),this.writeU8(t>>8),this.writeU8(t);break;default:throw new RuntimeException("Bad EBML VINT size "+e)}},e.prototype.measureEBMLVarInt=function(t){if(t<127)return 1;if(t<16383)return 2;if(t<2097151)return 3;if(t<268435455)return 4;if(t<34359738367)return 5;throw new RuntimeException("EBML VINT size not supported "+t)},e.prototype.writeEBMLVarInt=function(t){this.writeEBMLVarIntWidth(t,this.measureEBMLVarInt(t))},e.prototype.writeUnsignedIntBE=function(t,e){switch(e=void 0===e?this.measureUnsignedInt(t):e){case 5:this.writeU8(Math.floor(t/4294967296));case 4:this.writeU8(t>>24);case 3:this.writeU8(t>>16);case 2:this.writeU8(t>>8);case 1:this.writeU8(t);break;default:throw new RuntimeException("Bad UINT size "+e)}},e.prototype.measureUnsignedInt=function(t){return t<256?1:t<65536?2:t<1<<24?3:t<4294967296?4:5},e.prototype.getAsDataArray=function(){if(this.posthis.length)throw"Seeking beyond the end of file is not allowed";this.pos=t},this.write=function(t){var a={offset:this.pos,data:t,length:function(t){if(t=t.byteLength||t.length||t.size,!Number.isInteger(t))throw"Failed to determine size of element";return t}(t)},r=a.offset>=this.length;this.pos+=a.length,this.length=Math.max(this.length,this.pos),e=e.then(function(){if(s)return new Promise(function(o,t){l(a.data).then(function(t){function n(t,e,r){(i+=e)>=r.length?o():null.write(s,r,i,r.length-i,a.offset+i,n)}var i=0,t=Buffer.from(t.buffer);null.write(s,t,0,t.length,a.offset,n)})});if(i)return new Promise(function(t,e){i.onwriteend=t,i.seek(a.offset),i.write(new Blob([a.data]))});if(!r)for(var t=0;t=e.offset+e.length)){if(a.offsete.offset+e.length)throw new Error("Overwrite crosses blob boundaries");return a.offset==e.offset&&a.length==e.length?void(e.data=a.data):l(e.data).then(function(t){return e.data=t,l(a.data)}).then(function(t){a.data=t,e.data.set(a.data,a.offset-e.offset)})}}n.push(a)})},this.complete=function(r){return e=s||i?e.then(function(){return null}):e.then(function(){for(var t=[],e=0;e 0 and < 127";return e.writeEBMLVarInt(t.trackNumber),e.writeU16BE(t.timecode),e.writeByte(128),{id:163,data:[e.getAsDataArray(),t.frame]}}(c[e]));x(i,g.pos,o),g.write(i.getAsDataArray()),r=l,n=Math.round(u),i=o.offset,m.push({id:187,data:[{id:179,data:n},{id:183,data:[{id:247,data:r},{id:241,data:w(i)}]}]}),c=[],u+=d,d=0}}this.addFrame=function(t){if(h){if(t.width!=n||t.height!=i)throw"Frame size differs from previous frames"}else n=t.width,i=t.height,b(),h=!0;t=_(t,{quality:e.quality});if(!t)throw"Couldn't decode WebP frame, does the browser support WebP?";(t={frame:function(t){var e=t.indexOf("VP8 ");if(-1==e)throw"Failed to identify beginning of keyframe in WebP image";return t.substring(e+="VP8 ".length+4)}(t),duration:e.frameDuration}).trackNumber=l,t.timecode=Math.round(d),c.push(t),d+=t.duration,s<=d&&y()},this.complete=function(){var t,e;return y(),e={id:475249515,data:m},x(t=new v(16+32*m.length),g.pos,e),g.write(t.getAsDataArray()),f.Cues.positionEBML.data=w(e.offset),t=new v(a.size),e=g.pos,x(t,a.dataOffset,a.data),g.seek(a.dataOffset),g.write(t.getAsDataArray()),g.seek(e),t=new v(8),e=g.pos,t.writeDoubleBE(u),g.seek(p.dataOffset),g.write(t.getAsDataArray()),g.seek(e),g.complete("video/webm")},this.getWrittenSize=function(){return g.length},r={},[{quality:.95,fileWriter:null,fd:null,frameDuration:null,frameRate:null},e||{}].forEach(function(t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=t[e])}),e=r,function(){if(!e.frameDuration){if(!e.frameRate)throw"Missing required frameDuration or frameRate setting";e.frameDuration=1e3/e.frameRate}}()}}void 0!==t.exports?t.exports=n(e,r):window.WebMWriter=n(e,r)},681:t=>{"use strict";t.exports=JSON.parse('{"_from":"@ffmpeg/ffmpeg","_id":"@ffmpeg/ffmpeg@0.10.1","_inBundle":false,"_integrity":"sha512-ChQkH7Rh57hmVo1LhfQFibWX/xqneolJKSwItwZdKPcLZuKigtYAYDIvB55pDfP17VtR1R77SxgkB2/UApB+Og==","_location":"/@ffmpeg/ffmpeg","_phantomChildren":{},"_requested":{"type":"tag","registry":true,"raw":"@ffmpeg/ffmpeg","name":"@ffmpeg/ffmpeg","escapedName":"@ffmpeg%2fffmpeg","scope":"@ffmpeg","rawSpec":"","saveSpec":null,"fetchSpec":"latest"},"_requiredBy":["#USER","/"],"_resolved":"https://registry.npmjs.org/@ffmpeg/ffmpeg/-/ffmpeg-0.10.1.tgz","_shasum":"3dacf3985de9c83a95fbf79fe709920cc009b00a","_spec":"@ffmpeg/ffmpeg","_where":"/Users/amandaghassaei/Projects/canvas-capture","author":{"name":"Jerome Wu","email":"jeromewus@gmail.com"},"browser":{"./src/node/index.js":"./src/browser/index.js"},"bugs":{"url":"https://github.com/ffmpegwasm/ffmpeg.wasm/issues"},"bundleDependencies":false,"dependencies":{"is-url":"^1.2.4","node-fetch":"^2.6.1","regenerator-runtime":"^0.13.7","resolve-url":"^0.2.1"},"deprecated":false,"description":"FFmpeg WebAssembly version","devDependencies":{"@babel/core":"^7.12.3","@babel/preset-env":"^7.12.1","@ffmpeg/core":"^0.10.0","@types/emscripten":"^1.39.4","babel-loader":"^8.1.0","chai":"^4.2.0","cors":"^2.8.5","eslint":"^7.12.1","eslint-config-airbnb-base":"^14.1.0","eslint-plugin-import":"^2.22.1","express":"^4.17.1","mocha":"^8.2.1","mocha-headless-chrome":"^2.0.3","npm-run-all":"^4.1.5","wait-on":"^5.3.0","webpack":"^5.3.2","webpack-cli":"^4.1.0","webpack-dev-middleware":"^4.0.0"},"directories":{"example":"examples"},"engines":{"node":">=12.16.1"},"homepage":"https://github.com/ffmpegwasm/ffmpeg.wasm#readme","keywords":["ffmpeg","WebAssembly","video"],"license":"MIT","main":"src/index.js","name":"@ffmpeg/ffmpeg","repository":{"type":"git","url":"git+https://github.com/ffmpegwasm/ffmpeg.wasm.git"},"scripts":{"build":"rimraf dist && webpack --config scripts/webpack.config.prod.js","lint":"eslint src","prepublishOnly":"npm run build","start":"node scripts/server.js","test":"npm-run-all -p -r start test:all","test:all":"npm-run-all wait test:browser:ffmpeg test:node:all","test:browser":"mocha-headless-chrome -a allow-file-access-from-files -a incognito -a no-sandbox -a disable-setuid-sandbox -a disable-logging -t 300000","test:browser:ffmpeg":"npm run test:browser -- -f ./tests/ffmpeg.test.html","test:node":"node --experimental-wasm-threads --experimental-wasm-bulk-memory node_modules/.bin/_mocha --exit --bail --require ./scripts/test-helper.js","test:node:all":"npm run test:node -- ./tests/*.test.js","wait":"rimraf dist && wait-on http://localhost:3000/dist/ffmpeg.dev.js"},"types":"src/index.d.ts","version":"0.10.1"}')}},n={};function i(t){var e=n[t];if(void 0!==e)return e.exports;e=n[t]={id:t,loaded:!1,exports:{}};return r[t].call(e.exports,e,e.exports,i),e.loaded=!0,e.exports}i.d=(t,e)=>{for(var r in e)i.o(e,r)&&!i.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var o={};return(()=>{"use strict";var t=o;Object.defineProperty(t,"__esModule",{value:!0}),t.CanvasCapture=void 0;var e=i(914);t.CanvasCapture=e,t.default=e})(),o})()); +//# sourceMappingURL=canvas-capture.min.js.map \ No newline at end of file diff --git a/mounts/zoperepo/__root__/lib/js/export_hack/__meta__ b/mounts/zoperepo/__root__/lib/js/export_hack/__meta__ new file mode 100644 index 0000000..b72c5a0 --- /dev/null +++ b/mounts/zoperepo/__root__/lib/js/export_hack/__meta__ @@ -0,0 +1,8 @@ +[ + ('owner', (['acl_users'], 'dockerzope')), + ('props', [ + [('id', 'content_type'), ('type', 'string'), ('value', 'text/x-unknown-content-type')], + ]), + ('title', ''), + ('type', 'File'), +] diff --git a/mounts/zoperepo/__root__/lib/js/export_hack/__source__.txt b/mounts/zoperepo/__root__/lib/js/export_hack/__source__.txt new file mode 100644 index 0000000..53d1ed5 --- /dev/null +++ b/mounts/zoperepo/__root__/lib/js/export_hack/__source__.txt @@ -0,0 +1,24 @@ +// make vision_bundle_js a script instead of a module to have everything in +// in global JS namespace +// i know this is very sloppy, but as we inject user written JS into the page +// this is fine for now xD +// in the future we should consider implementing a proper module structure, +// the question will then be how to force users to write JS modules without +// them even noticing .. ?! + +export{ +DrawingUtils_1 as DrawingUtils, +FaceDetector_1 as FaceDetector, +FaceLandmarker_1 as FaceLandmarker, +FaceStylizer_1 as FaceStylizer, +FilesetResolver_1 as FilesetResolver, +GestureRecognizer_1 as GestureRecognizer, +HandLandmarker_1 as HandLandmarker, +ImageClassifier_1 as ImageClassifier, +ImageEmbedder_1 as ImageEmbedder, +ImageSegmenter_1 as ImageSegmenter, +InteractiveSegmenter_1 as InteractiveSegmenter, +MPImage_1 as MPImage,MPMask_1 as MPMask, +ObjectDetector_1 as ObjectDetector, +PoseLandmarker_1 as PoseLandmarker,vision as default +}; diff --git a/mounts/zoperepo/__root__/lib/js/fluid.js/__meta__ b/mounts/zoperepo/__root__/lib/js/fluid.js/__meta__ new file mode 100644 index 0000000..ec0fc53 --- /dev/null +++ b/mounts/zoperepo/__root__/lib/js/fluid.js/__meta__ @@ -0,0 +1,8 @@ +[ + ('owner', (['acl_users'], 'dockerzope')), + ('props', [ + [('id', 'content_type'), ('type', 'string'), ('value', 'text/javascript')], + ]), + ('title', 'fluid.js'), + ('type', 'File'), +] diff --git a/mounts/zoperepo/__root__/lib/js/fluid.js/__source__.js b/mounts/zoperepo/__root__/lib/js/fluid.js/__source__.js new file mode 100644 index 0000000..1983fd3 --- /dev/null +++ b/mounts/zoperepo/__root__/lib/js/fluid.js/__source__.js @@ -0,0 +1,637 @@ +//GPU-IO Physarum by @amandaghassaei +//https://github.com/amandaghassaei/gpu-io + +class Fluid { + constructor(canvas, gui) { + this.canvas = canvas; + this.gui = gui; + + const { + GPUComposer, + GPUProgram, + GPULayer, + SHORT, + INT, + FLOAT, + REPEAT, + NEAREST, + LINEAR, + GLSL1, + GLSL3, + WEBGL1, + WEBGL2, + isWebGL2Supported, + renderSignedAmplitudeProgram, + } = GPUIO; + + this.PARAMS = { + trailLength: 15, + render: 'Fluid', + }; + + // Scaling factor for touch interactions. + const TOUCH_FORCE_SCALE = 2; + // Approx avg num particles per px. + this.PARTICLE_DENSITY = 0.1; + this.MAX_NUM_PARTICLES = 100000; + // How long do the particles last before they are reset. + // If we don't have then reset they tend to clump up. + this.PARTICLE_LIFETIME = 1000; + // How many steps to compute the zero pressure field. + this.NUM_JACOBI_STEPS = 3; + const PRESSURE_CALC_ALPHA = -1; + const PRESSURE_CALC_BETA = 0.25; + // How many steps to move particles between each step of the simulation. + // This helps to make the trails look smoother in cases where the particles are moving >1 px per step. + this.NUM_RENDER_STEPS = 3; + // Compute the velocity at a lower resolution to increase efficiency. + this.VELOCITY_SCALE_FACTOR = 8; + // Put a speed limit on velocity, otherwise touch interactions get out of control. + const MAX_VELOCITY = 30; + // We are storing abs position (2 components) and displacements (2 components) in this buffer. + // This decreases error when rendering to half float. + this.POSITION_NUM_COMPONENTS = 4; + + this.shouldSavePNG = false; + + this.NUM_PARTICLES = this.calcNumParticles(canvas.width, canvas.height); + + // The composer orchestrates all of the GPU operations. + const contextID = isWebGL2Supported() ? WEBGL2 : WEBGL1; + const glslVersion = isWebGL2Supported() ? GLSL3 : GLSL1; + this.composer = new GPUComposer({ canvas, contextID, glslVersion }); + + // Init state. + var width = canvas.clientWidth; + var height = canvas.clientHeight; + if (width == 0 && height == 0) { + width = SCENE_WIDTH; + height = SCENE_HEIGHT; + } + console.log(Math.ceil(width / this.VELOCITY_SCALE_FACTOR), Math.ceil(height / this.VELOCITY_SCALE_FACTOR)); + + this.velocityState = new GPULayer(this.composer, { + name: 'velocity', + dimensions: [Math.ceil(width / this.VELOCITY_SCALE_FACTOR), Math.ceil(height / this.VELOCITY_SCALE_FACTOR)], + type: FLOAT, + filter: LINEAR, + numComponents: 2, + wrapX: REPEAT, + wrapY: REPEAT, + numBuffers: 2, + }); + this.divergenceState = new GPULayer(this.composer, { + name: 'divergence', + dimensions: [this.velocityState.width, this.velocityState.height], + type: FLOAT, + filter: NEAREST, + numComponents: 1, + wrapX: REPEAT, + wrapY: REPEAT, + }); + this.pressureState = new GPULayer(this.composer, { + name: 'pressure', + dimensions: [this.velocityState.width, this.velocityState.height], + type: FLOAT, + filter: NEAREST, + numComponents: 1, + wrapX: REPEAT, + wrapY: REPEAT, + numBuffers: 2, + }); + this.particlePositionState = new GPULayer(this.composer, { + name: 'position', + dimensions: this.NUM_PARTICLES, + type: FLOAT, + numComponents: this.POSITION_NUM_COMPONENTS, + numBuffers: 2, + }); + // We can use the initial state to reset particles after they've died. + this.particleInitialState = new GPULayer(this.composer, { + name: 'initialPosition', + dimensions: this.NUM_PARTICLES, + type: FLOAT, + numComponents: this.POSITION_NUM_COMPONENTS, + numBuffers: 1, + }); + this.particleAgeState = new GPULayer(this.composer, { + name: 'age', + dimensions: this.NUM_PARTICLES, + type: SHORT, + numComponents: 1, + numBuffers: 2, + }); + // Init a render target for trail effect. + this.trailState = new GPULayer(this.composer, { + name: 'trails', + dimensions: [width, height], + type: FLOAT, + filter: NEAREST, + numComponents: 1, + numBuffers: 2, + }); + + // Init programs. + this.advection = new GPUProgram(this.composer, { + name: 'advection', + fragmentShader: ` + in vec2 v_uv; + uniform sampler2D u_state; + uniform sampler2D u_velocity; + uniform vec2 u_dimensions; + out vec2 out_state; + void main() { + // Implicitly solve advection. + out_state = texture(u_state, v_uv - texture(u_velocity, v_uv).xy / u_dimensions).xy; + }`, + uniforms: [ + { + name: 'u_state', + value: 0, + type: INT, + }, + { + name: 'u_velocity', + value: 1, + type: INT, + }, + { + name: 'u_dimensions', + value: [canvas.width, canvas.height], + type: FLOAT, + }, + ], + }); + this.divergence2D = new GPUProgram(this.composer, { + name: 'divergence2D', + fragmentShader: ` + in vec2 v_uv; + uniform sampler2D u_vectorField; + uniform vec2 u_pxSize; + out float out_divergence; + void main() { + float n = texture(u_vectorField, v_uv + vec2(0, u_pxSize.y)).y; + float s = texture(u_vectorField, v_uv - vec2(0, u_pxSize.y)).y; + float e = texture(u_vectorField, v_uv + vec2(u_pxSize.x, 0)).x; + float w = texture(u_vectorField, v_uv - vec2(u_pxSize.x, 0)).x; + out_divergence = 0.5 * ( e - w + n - s); + }`, + uniforms: [ + { + name: 'u_vectorField', + value: 0, + type: INT, + }, + { + name: 'u_pxSize', + value: [1 / this.velocityState.width, 1 / this.velocityState.height], + type: FLOAT, + } + ], + }); + this.jacobi = new GPUProgram(this.composer, { + name: 'jacobi', + fragmentShader: ` + in vec2 v_uv; + uniform float u_alpha; + uniform float u_beta; + uniform vec2 u_pxSize; + uniform sampler2D u_previousState; + uniform sampler2D u_divergence; + out vec4 out_jacobi; + void main() { + vec4 n = texture(u_previousState, v_uv + vec2(0, u_pxSize.y)); + vec4 s = texture(u_previousState, v_uv - vec2(0, u_pxSize.y)); + vec4 e = texture(u_previousState, v_uv + vec2(u_pxSize.x, 0)); + vec4 w = texture(u_previousState, v_uv - vec2(u_pxSize.x, 0)); + vec4 d = texture(u_divergence, v_uv); + out_jacobi = (n + s + e + w + u_alpha * d) * u_beta; + }`, + uniforms: [ + { + name: 'u_alpha', + value: PRESSURE_CALC_ALPHA, + type: FLOAT, + }, + { + name: 'u_beta', + value: PRESSURE_CALC_BETA, + type: FLOAT, + }, + { + name: 'u_pxSize', + value: [1 / this.velocityState.width, 1 / this.velocityState.height], + type: FLOAT, + }, + { + name: 'u_previousState', + value: 0, + type: INT, + }, + { + name: 'u_divergence', + value: 1, + type: INT, + }, + ], + }); + this.gradientSubtraction = new GPUProgram(this.composer, { + name: 'gradientSubtraction', + fragmentShader: ` + in vec2 v_uv; + uniform vec2 u_pxSize; + uniform sampler2D u_scalarField; + uniform sampler2D u_vectorField; + out vec2 out_result; + void main() { + float n = texture(u_scalarField, v_uv + vec2(0, u_pxSize.y)).r; + float s = texture(u_scalarField, v_uv - vec2(0, u_pxSize.y)).r; + float e = texture(u_scalarField, v_uv + vec2(u_pxSize.x, 0)).r; + float w = texture(u_scalarField, v_uv - vec2(u_pxSize.x, 0)).r; + out_result = texture2D(u_vectorField, v_uv).xy - 0.5 * vec2(e - w, n - s); + }`, + uniforms: [ + { + name: 'u_pxSize', + value: [1 / this.velocityState.width, 1 / this.velocityState.height], + type: FLOAT, + }, + { + name: 'u_scalarField', + value: 0, + type: INT, + }, + { + name: 'u_vectorField', + value: 1, + type: INT, + }, + ], + }); + this.renderParticles = new GPUProgram(this.composer, { + name: 'renderParticles', + fragmentShader: ` + #define FADE_TIME 0.1 + in vec2 v_uv; + in vec2 v_uv_position; + uniform isampler2D u_ages; + uniform sampler2D u_velocity; + out float out_state; + void main() { + float ageFraction = float(texture(u_ages, v_uv_position).x) / ${this.PARTICLE_LIFETIME.toFixed(1)}; + // Fade first 10% and last 10%. + float opacity = mix(0.0, 1.0, min(ageFraction * 10.0, 1.0)) * mix(1.0, 0.0, max(ageFraction * 10.0 - 90.0, 0.0)); + vec2 velocity = texture(u_velocity, v_uv).xy; + // Show the fastest regions with darker color. + float multiplier = clamp(dot(velocity, velocity) * 0.05 + 0.7, 0.0, 1.0); + out_state = opacity * multiplier; + }`, + uniforms: [ + { + name: 'u_ages', + value: 0, + type: INT, + }, + { + name: 'u_velocity', + value: 1, + type: INT, + }, + ], + }); + this.ageParticles = new GPUProgram(this.composer, { + name: 'ageParticles', + fragmentShader: ` + in vec2 v_uv; + uniform isampler2D u_ages; + out int out_age; + void main() { + int age = texture(u_ages, v_uv).x + 1; + out_age = stepi(age, ${this.PARTICLE_LIFETIME}) * age; + }`, + uniforms: [ + { + name: 'u_ages', + value: 0, + type: INT, + }, + ], + }); + this.advectParticles = new GPUProgram(this.composer, { + name: 'advectParticles', + fragmentShader: ` + in vec2 v_uv; + uniform vec2 u_dimensions; + uniform sampler2D u_positions; + uniform sampler2D u_velocity; + uniform isampler2D u_ages; + uniform sampler2D u_initialPositions; + out vec4 out_position; + void main() { + // Store small displacements as separate number until they accumulate sufficiently. + // Then add them to the absolution position. + // This prevents small offsets on large abs positions from being lost in float16 precision. + vec4 positionData = texture(u_positions, v_uv); + vec2 absolute = positionData.rg; + vec2 displacement = positionData.ba; + vec2 position = absolute + displacement; + // Forward integrate via RK2. + vec2 pxSize = 1.0 / u_dimensions; + vec2 velocity1 = texture(u_velocity, position * pxSize).xy; + vec2 halfStep = position + velocity1 * 0.5 * ${1 / this.NUM_RENDER_STEPS}; + vec2 velocity2 = texture(u_velocity, halfStep * pxSize).xy; + displacement += velocity2 * ${1 / this.NUM_RENDER_STEPS}; + // Merge displacement with absolute if needed. + float shouldMerge = step(20.0, dot(displacement, displacement)); + // Also wrap absolute position if needed. + absolute = mod(absolute + shouldMerge * displacement + u_dimensions, u_dimensions); + displacement *= (1.0 - shouldMerge); + // If this particle is being reset, give it a random position. + int shouldReset = stepi(texture(u_ages, v_uv).x, 1); + out_position = mix(vec4(absolute, displacement), texture(u_initialPositions, v_uv), float(shouldReset)); + }`, + uniforms: [ + { + name: 'u_positions', + value: 0, + type: INT, + }, + { + name: 'u_velocity', + value: 1, + type: INT, + }, + { + name: 'u_ages', + value: 2, + type: INT, + }, + { + name: 'u_initialPositions', + value: 3, + type: INT, + }, + { + name: 'u_dimensions', + value: [canvas.width, canvas.height], + type: 'FLOAT', + }, + ], + }); + this.fadeTrails = new GPUProgram(this.composer, { + name: 'fadeTrails', + fragmentShader: ` + in vec2 v_uv; + uniform sampler2D u_image; + uniform float u_increment; + out float out_color; + void main() { + out_color = max(texture(u_image, v_uv).x + u_increment, 0.0); + }`, + uniforms: [ + { + name: 'u_image', + value: 0, + type: INT, + }, + { + name: 'u_increment', + value: -1 / this.PARAMS.trailLength, + type: 'FLOAT', + }, + ], + }); + this.renderTrails = new GPUProgram(this.composer, { + name: 'renderTrails', + fragmentShader: ` + in vec2 v_uv; + uniform sampler2D u_trailState; + out vec4 out_color; + void main() { + vec3 background = vec3(0.98, 0.922, 0.843); + vec3 particle = vec3(0, 0, 0.2); + out_color = vec4(mix(background, particle, texture(u_trailState, v_uv).x), 1); + } + `, + }); + this.renderPressure = renderSignedAmplitudeProgram(this.composer, { + name: 'renderPressure', + type: this.pressureState.type, + scale: 0.5, + component: 'x', + }); + + // During touch, copy data from noise over to state. + this.touch = new GPUProgram(this.composer, { + name: 'touch', + fragmentShader: ` + in vec2 v_uv; + in vec2 v_uv_local; + uniform sampler2D u_velocity; + uniform vec2 u_vector; + out vec2 out_velocity; + void main() { + vec2 radialVec = (v_uv_local * 2.0 - 1.0); + float radiusSq = dot(radialVec, radialVec); + vec2 velocity = texture(u_velocity, v_uv).xy + (1.0 - radiusSq) * u_vector * ${TOUCH_FORCE_SCALE.toFixed(1)}; + float velocityMag = length(velocity); + out_velocity = velocity / velocityMag * min(velocityMag, ${MAX_VELOCITY.toFixed(1)}); + }`, + uniforms: [ + { + name: 'u_velocity', + value: 0, + type: INT, + }, + { + name: 'u_vector', + value: [0, 0], + type: FLOAT, + }, + ], + }); + + //this.initGui(); + } + + // Render loop. + draw() { + // Advect the velocity vector field. + this.composer.step({ + program: this.advection, + input: [this.velocityState, this.velocityState], + output: this.velocityState, + }); + // Compute divergence of advected velocity field. + this.composer.step({ + program: this.divergence2D, + input: this.velocityState, + output: this.divergenceState, + }); + // Compute the pressure gradient of the advected velocity vector field (using jacobi iterations). + for (let i = 0; i < this.NUM_JACOBI_STEPS; i++) { + this.composer.step({ + program: this.jacobi, + input: [this.pressureState, this.divergenceState], + output: this.pressureState, + }); + } + // Subtract the pressure gradient from velocity to obtain a velocity vector field with zero divergence. + this.composer.step({ + program: this.gradientSubtraction, + input: [this.pressureState, this.velocityState], + output: this.velocityState, + }); + + if (this.PARAMS.render === 'Pressure') { + this.composer.step({ + program: this.renderPressure, + input: this.pressureState, + }); + } else if (this.PARAMS.render === 'Velocity') { + this.composer.drawLayerAsVectorField({ + layer: this.velocityState, + vectorSpacing: 10, + vectorScale: 2.5, + color: [0, 0, 0], + }); + } else { + // Increment particle age. + this.composer.step({ + program: this.ageParticles, + input: this.particleAgeState, + output: this.particleAgeState, + }); + // Fade current trails. + this.composer.step({ + program: this.fadeTrails, + input: this.trailState, + output: this.trailState, + }); + for (let i = 0; i < this.NUM_RENDER_STEPS; i++) { + // Advect particles. + this.composer.step({ + program: this.advectParticles, + input: [this.particlePositionState, this.velocityState, this.particleAgeState, this.particleInitialState], + output: this.particlePositionState, + }); + // Render particles to texture for trail effect. + this.composer.drawLayerAsPoints({ + layer: this.particlePositionState, + program: this.renderParticles, + input: [this.particleAgeState, this.velocityState], + output: this.trailState, + wrapX: true, + wrapY: true, + }); + } + // Render particle trails to screen. + this.composer.step({ + program: this.renderTrails, + input: this.trailState, + }); + } + if (this.shouldSavePNG) { + this.composer.savePNG({ filename: `fluid` }); + this.shouldSavePNG = false; + } + } + + savePNG() { + this.shouldSavePNG = true; + } + + calcNumParticles(width, height) { + return Math.min(Math.ceil(width * height * ( this.PARTICLE_DENSITY)), this.MAX_NUM_PARTICLES); + } + + // Touch events. + pointerMove(current, last, p) { + this.touch.setUniform('u_vector', [current[0] - last[0], - (current[1] - last[1])]); + this.composer.stepSegment({ + program: this.touch, + input: this.velocityState, + output: this.velocityState, + position1: [current[0], p.height - current[1]], + position2: [last[0], p.height - last[1]], + thickness: 30, + endCaps: true, + }); + } + + resize(width, height) { + // Resize this.composer. + this.composer.resize([width, height]); + + // Re-init textures at new size. + const velocityDimensions = [Math.ceil(width / this.VELOCITY_SCALE_FACTOR), Math.ceil(height / this.VELOCITY_SCALE_FACTOR)]; + this.velocityState.resize(velocityDimensions); + this.divergenceState.resize(velocityDimensions); + this.pressureState.resize(velocityDimensions); + this.trailState.resize([width, height]); + + // Update uniforms. + this.advection.setUniform('u_dimensions', [width, height]); + this.advectParticles.setUniform('u_dimensions', [width, height]); + const velocityPxSize = [1 / velocityDimensions[0], 1 / velocityDimensions[1]]; + this.divergence2D.setUniform('u_pxSize', velocityPxSize); + this.jacobi.setUniform('u_pxSize', velocityPxSize); + this.gradientSubtraction.setUniform('u_pxSize', velocityPxSize); + + // Re-init particles. + this.NUM_PARTICLES = this.calcNumParticles(width, height); + // Init new positions. + const positions = new Float32Array(this.NUM_PARTICLES * 4); + for (let i = 0; i < positions.length / 4; i++) { + positions[this.POSITION_NUM_COMPONENTS * i] = Math.random() * width; + positions[this.POSITION_NUM_COMPONENTS * i + 1] = Math.random() * height; + } + this.particlePositionState.resize(this.NUM_PARTICLES, positions); + this.particleInitialState.resize(this.NUM_PARTICLES, positions); + // Init new ages. + const ages = new Int16Array(this.NUM_PARTICLES); + for (let i = 0; i < this.NUM_PARTICLES; i++) { + ages[i] = Math.round(Math.random() * this.PARTICLE_LIFETIME); + } + this.particleAgeState.resize(this.NUM_PARTICLES, ages); + } + + initGui(){ + this.gui.add(this.PARAMS, 'trailLength', 0, 100, 1).onChange((value) => { + this.fadeTrails.setUniform('u_increment', -1 / this.PARAMS.trailLength); + }).name('Trail Length'); + + this.gui.add(this.PARAMS, 'render', [ + 'Fluid', + 'Pressure', + 'Velocity', + ]).name('Render'); + + this.PARAMS.reset = () => this.resize(this.canvas.width, this.canvas.height); + this.PARAMS.savePNG = this.savePNG; + this.gui.add(this.PARAMS, 'reset').name('Reset'); + this.gui.add(this.PARAMS, 'savePNG').name('Save PNG (p)'); + } + + dispose() { + this.velocityState.dispose(); + this.divergenceState.dispose(); + this.pressureState.dispose(); + this.particlePositionState.dispose(); + this.particleInitialState.dispose(); + this.particleAgeState.dispose(); + this.trailState.dispose(); + this.advection.dispose(); + this.divergence2D.dispose(); + this.jacobi.dispose(); + this.gradientSubtraction.dispose(); + this.renderParticles.dispose(); + this.ageParticles.dispose(); + this.advectParticles.dispose(); + this.renderTrails.dispose(); + this.fadeTrails.dispose(); + this.renderPressure.dispose(); + this.touch.dispose(); + this.composer.dispose(); + } +} \ No newline at end of file diff --git a/mounts/zoperepo/__root__/lib/js/gpu-io.min.js/__meta__ b/mounts/zoperepo/__root__/lib/js/gpu-io.min.js/__meta__ new file mode 100644 index 0000000..a2ba82f --- /dev/null +++ b/mounts/zoperepo/__root__/lib/js/gpu-io.min.js/__meta__ @@ -0,0 +1,8 @@ +[ + ('owner', (['acl_users'], 'dockerzope')), + ('props', [ + [('id', 'content_type'), ('type', 'string'), ('value', 'text/javascript')], + ]), + ('title', 'gpu-io.min.js'), + ('type', 'File'), +] diff --git a/mounts/zoperepo/__root__/lib/js/gpu-io.min.js/__source__.js b/mounts/zoperepo/__root__/lib/js/gpu-io.min.js/__source__.js new file mode 100644 index 0000000..d611879 --- /dev/null +++ b/mounts/zoperepo/__root__/lib/js/gpu-io.min.js/__source__.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.GPUIO=t():e.GPUIO=t()}(self,(()=>(()=>{var e={566:function(e,t){!function(e){"use strict";function t(e){return!Number.isNaN(e)&&"number"==typeof e}function r(e){return t(e)&&Number.isFinite(e)}function n(e){return r(e)&&e%1==0}function o(e){return t(e)&&e>0}function i(e){return n(e)&&e>0}function a(e){return t(e)&&e<0}function c(e){return n(e)&&e<0}function s(e){return t(e)&&e>=0}function u(e){return n(e)&&e>=0}function l(e){return t(e)&&e<=0}function _(e){return n(e)&&e<=0}function p(e,r,n){return t(e)&&e>=r&&e<=n}function f(e,t,r){return n(e)&&e>=t&&e<=r}function d(e){return"string"==typeof e}function h(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function m(e){return Array.isArray(e)||h(e)}function g(e){return!("object"!=typeof e||m(e)||null===e||e instanceof ArrayBuffer||e instanceof DataView)}function y(e){return"boolean"==typeof e}e.isArray=m,e.isBoolean=y,e.isFiniteNumber=r,e.isInteger=n,e.isIntegerInRange=f,e.isNegativeInteger=c,e.isNegativeNumber=a,e.isNonNegativeInteger=u,e.isNonNegativeNumber=s,e.isNonPositiveInteger=_,e.isNonPositiveNumber=l,e.isNumber=t,e.isNumberInRange=p,e.isObject=g,e.isPositiveInteger=i,e.isPositiveNumber=o,e.isString=d,e.isTypedArray=h,Object.defineProperty(e,"__esModule",{value:!0})}(t)},809:(e,t)=>{"use strict";function r(e){var t=-1;n||(n=function(){for(var e=new Int32Array(256),t=0;t<256;t++){for(var r=t,n=0;n<8;n++)r=1&r?3988292384^r>>>1:r>>>1;e[t]=r}return e}());for(var r=0;r>>8;return-1^t}Object.defineProperty(t,"__esModule",{value:!0}),t.changeDpiBlob=function(e,t){var r=e.slice(0,33);return new Promise((function(n,o){var i=new FileReader;i.onload=function(){var r=new Uint8Array(i.result),o=e.slice(33),a=f(r,t,e.type);n(new Blob([a,o],{type:e.type}))},i.readAsArrayBuffer(r)}))},t.changeDpiDataUrl=function(e,t){var r=e.split(","),n=r[0],u=r[1],l=void 0,_=void 0,p=!1;if(-1!==n.indexOf(o)){l=o;var d=function(e){var t=e.indexOf(a);-1===t&&(t=e.indexOf(c));-1===t&&(t=e.indexOf(s));return t}(u);d>=0?(_=4*Math.ceil((d+28)/3),p=!0):_=44}-1!==n.indexOf(i)&&(l=i,_=24);for(var h=u.substring(0,_),m=u.substring(_),g=atob(h),y=new Uint8Array(g.length),v=0;v>8,e[15]=255&t,e[16]=t>>8,e[17]=255&t,e;if(n===o){var c=new Uint8Array(13);t*=39.3701,c[0]=u,c[1]=l,c[2]=_,c[3]=p,c[4]=t>>>24,c[5]=t>>>16,c[6]=t>>>8,c[7]=255&t,c[8]=c[4],c[9]=c[5],c[10]=c[6],c[11]=c[7],c[12]=1;var s=r(c),f=new Uint8Array(4);if(f[0]=s>>>24,f[1]=s>>>16,f[2]=s>>>8,f[3]=255&s,a){var d=function(e){for(var t=e.length-1;t>=4;t--)if(9===e[t-4]&&e[t-3]===u&&e[t-2]===l&&e[t-1]===_&&e[t]===p)return t-3}(e);return e.set(c,d),e.set(f,d+13),e}var h=new Uint8Array(4);h[0]=0,h[1]=0,h[2]=0,h[3]=9;var m=new Uint8Array(54);return m.set(e,0),m.set(h,33),m.set(c,37),m.set(f,50),m}}},162:function(e,t,r){var n,o,i;o=[],n=function(){"use strict";function t(e,t){return void 0===t?t={autoBom:!1}:"object"!=typeof t&&(console.warn("Deprecated: Expected third argument to be a object"),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\ufeff",e],{type:e.type}):e}function n(e,t,r){var n=new XMLHttpRequest;n.open("GET",e),n.responseType="blob",n.onload=function(){s(n.response,t,r)},n.onerror=function(){console.error("could not download file")},n.send()}function o(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return 200<=t.status&&299>=t.status}function i(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(r){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var a="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof r.g&&r.g.global===r.g?r.g:void 0,c=a.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),s=a.saveAs||("object"!=typeof window||window!==a?function(){}:"download"in HTMLAnchorElement.prototype&&!c?function(e,t,r){var c=a.URL||a.webkitURL,s=document.createElement("a");t=t||e.name||"download",s.download=t,s.rel="noopener","string"==typeof e?(s.href=e,s.origin===location.origin?i(s):o(s.href)?n(e,t,r):i(s,s.target="_blank")):(s.href=c.createObjectURL(e),setTimeout((function(){c.revokeObjectURL(s.href)}),4e4),setTimeout((function(){i(s)}),0))}:"msSaveOrOpenBlob"in navigator?function(e,r,a){if(r=r||e.name||"download","string"!=typeof e)navigator.msSaveOrOpenBlob(t(e,a),r);else if(o(e))n(e,r,a);else{var c=document.createElement("a");c.href=e,c.target="_blank",setTimeout((function(){i(c)}))}}:function(e,t,r,o){if((o=o||open("","_blank"))&&(o.document.title=o.document.body.innerText="downloading..."),"string"==typeof e)return n(e,t,r);var i="application/octet-stream"===e.type,s=/constructor/i.test(a.HTMLElement)||a.safari,u=/CriOS\/[\d]+/.test(navigator.userAgent);if((u||i&&s||c)&&"undefined"!=typeof FileReader){var l=new FileReader;l.onloadend=function(){var e=l.result;e=u?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),o?o.location.href=e:location=e,o=null},l.readAsDataURL(e)}else{var _=a.URL||a.webkitURL,p=_.createObjectURL(e);o?o.location=p:location.href=p,o=null,setTimeout((function(){_.revokeObjectURL(p)}),4e4)}});a.saveAs=s.saveAs=s,e.exports=s},void 0===(i="function"==typeof n?n.apply(t,o):n)||(e.exports=i)},484:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=0?t:o(o([],t,!0),[e],!1):t===e||t.layer===e?[t]:[t,e]},e.prototype._passThroughLayerDataFromInputToOutput=function(e){var t=this._copyProgramForType(e._internalType);this.step({program:t,input:e,output:e})},e.prototype._setOutputLayer=function(e,t,r,n){var o=this.gl,i=this.isWebGL2;if(n){for(var c=(0,a.isArray)(n)?n:[n],s=0,u=c.length;s=0)){if(1===_.numBuffers)throw new Error("Cannot use same buffer for input and output of a program. Try increasing the number of buffers in your output layer to at least 2 so you can render to nextState using currentState as an input.");t?_._prepareForWrite(!0):(this._passThroughLayerDataFromInputToOutput(_),_._prepareForWrite(!1))}else t?_._prepareForWrite(!0):(_._usingTextureOverrideForCurrentBuffer()&&this._passThroughLayerDataFromInputToOutput(_),_._prepareForWrite(!1))}var p=c[0],f=void 0,d=[o.COLOR_ATTACHMENT0];if(c.length>1){f=[];for(s=1,u=c.length;sf)throw new Error("Invalid count ".concat(d," for layer parameter of length ").concat(f,"."));c===s.GLSL1&&d>s.MAX_FLOAT_INT&&console.warn("Points positions array length: ".concat(d," is longer than what is supported by GLSL1 : ").concat(s.MAX_FLOAT_INT,"."));var h=e.program;if(void 0===h){h=this._setValueProgramForType(s.FLOAT);var m=e.color||[1,0,0];if(3!==m.length)throw new Error("Color parameter must have length 3, got ".concat(JSON.stringify(m),"."));h.setUniform("u_value",o(o([],m,!0),[1],!1),s.FLOAT)}var g=this._addLayerToInputs(_,e.input),y={};4===_.numComponents&&(y[s.GPUIO_VS_POSITION_W_ACCUM]="1"),e.wrapX&&(y[s.GPUIO_VS_WRAP_X]="1"),e.wrapY&&(y[s.GPUIO_VS_WRAP_Y]="1");var T=this._drawSetup(h,s.LAYER_POINTS_PROGRAM_NAME,y,!1,g,p);h._setVertexUniform(T,"u_gpuio_positions",(0,l.indexOfLayerInArray)(_,g),s.INT);var E=this._width,A=this._height;e.useOutputScale&&(E=(t=this._widthHeightForOutput(h.name,p)).width,A=t.height),h._setVertexUniform(T,"u_gpuio_scale",[1/E,1/A],s.FLOAT);var O=e.pointSize||1;h._setVertexUniform(T,"u_gpuio_pointSize",O,s.FLOAT);var I=[_.width,_.height];if(h._setVertexUniform(T,"u_gpuio_positionsDimensions",I,s.FLOAT),c===s.GLSL1){if(void 0===this._pointIndexBuffer||a&&a.lengths.MAX_FLOAT_INT&&console.warn("Mesh positions array length: ".concat(m," is longer than what is supported by GLSL1 : ").concat(s.MAX_FLOAT_INT,"."));var g=e.program;if(void 0===g){g=this._setValueProgramForType(s.FLOAT);var y=e.color||[1,0,0];if(3!==y.length)throw new Error("Color parameter must have length 3, got ".concat(JSON.stringify(y),"."));g.setUniform("u_value",o(o([],y,!0),[1],!1),s.FLOAT)}var T=this._addLayerToInputs(d,e.input),E={};4===d.numComponents&&(E[s.GPUIO_VS_POSITION_W_ACCUM]="1");var A=this._drawSetup(g,s.LAYER_MESH_PROGRAM_NAME,E,!1,T,h);g._setVertexUniform(A,"u_gpuio_positions",(0,l.indexOfLayerInArray)(d,T),s.INT);var O=a,I=c;e.useOutputScale&&(O=(t=this._widthHeightForOutput(g.name,h)).width,I=t.height),g._setVertexUniform(A,"u_gpuio_scale",[1/O,1/I],s.FLOAT);var P=[d.width,d.height];if(g._setVertexUniform(A,"u_gpuio_positionsDimensions",P,s.FLOAT),u===s.GLSL1){if(void 0===p||f&&f.length{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GPUIndexBuffer=void 0;var n=r(566),o=r(650),i=r(707),a=r(581),c=function(){function e(e,t){if(this._composer=e,!t)throw new Error("Error initing GPUIndexBuffer: must pass params to GPUIndexBuffer(composer, params).");if(!(0,n.isObject)(t))throw new Error("Error initing GPUIndexBuffer: must pass valid params object to GPUIndexBuffer(composer, params), got ".concat(JSON.stringify(t),"."));var r=Object.keys(t);(0,i.checkValidKeys)(r,["indices","name"],"GPUIndexBuffer(composer, params)",t.name),(0,i.checkRequiredKeys)(r,["indices"],"GPUIndexBuffer(composer, params)",t.name);var c,s=t.indices,u=e.gl,l=e.isWebGL2,_=u.createBuffer();switch(u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,_),(0,o.isTypedArray)(s)||(s=new Uint32Array(s)),s.constructor){case Uint8Array:c=u.UNSIGNED_BYTE;break;case Uint16Array:c=u.UNSIGNED_SHORT;break;case Uint32Array:if(!l)if(!(0,a.getExtension)(e,a.OES_ELEMENT_INDEX_UINT,!0)){c=u.UNSIGNED_SHORT,s=Uint16Array.from(s);break}c=u.UNSIGNED_INT}u.bufferData(u.ELEMENT_ARRAY_BUFFER,s,u.STATIC_DRAW),this.buffer=_,this.glType=c,this.count=s.length}return e.prototype.dispose=function(){var e=this._composer,t=this.buffer;e.gl.deleteBuffer(t),delete this._composer,delete this.buffer,delete this.glType,delete this.count},e}();t.GPUIndexBuffer=c},355:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{s(n.next(e))}catch(e){i(e)}}function c(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,c)}s((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]4)throw new Error("Invalid numComponents: ".concat(JSON.stringify(s),' for GPULayer "').concat(n,'", must be number in range [1-4].'));this.numComponents=s;var p=e.calcGPULayerSize(i,n,t.verboseLogging),f=p.length,d=p.width,h=p.height;this._length=f,this._width=d,this._height=h;var m=void 0!==f||c!==l.FLOAT&&c!=l.HALF_FLOAT?l.NEAREST:l.LINEAR,g=void 0!==r.filter?r.filter:m;if(!(0,u.isValidFilter)(g))throw new Error("Invalid filter: ".concat(JSON.stringify(g),' for GPULayer "').concat(n,'", must be one of ').concat(JSON.stringify(l.validFilters),"."));if(g===l.LINEAR&&c!==l.FLOAT&&c!=l.HALF_FLOAT)throw new Error('LINEAR filtering is not supported on integer types, please use NEAREST filtering for GPULayer "'.concat(n,'" with type: ').concat(c,"."));this.filter=g;var y=void 0!==r.wrapX?r.wrapX:l.CLAMP_TO_EDGE;if(!(0,u.isValidWrap)(y))throw new Error("Invalid wrapX: ".concat(JSON.stringify(y),' for GPULayer "').concat(n,'", must be one of ').concat(JSON.stringify(l.validWraps),"."));this.wrapX=y;var v=void 0!==r.wrapY?r.wrapY:l.CLAMP_TO_EDGE;if(!(0,u.isValidWrap)(v))throw new Error("Invalid wrapY: ".concat(JSON.stringify(v),' for GPULayer "').concat(n,'", must be one of ').concat(JSON.stringify(l.validWraps),"."));if(this.wrapY=v,!(0,u.isValidDataType)(c))throw new Error("Invalid type: ".concat(JSON.stringify(c),' for GPULayer "').concat(n,'", must be one of ').concat(JSON.stringify(l.validDataTypes),"."));this.type=c;var T=e.getGPULayerInternalType({composer:t,type:c,name:n});this._internalType=T;var E=e.getGLTextureParameters({composer:t,name:n,numComponents:s,internalType:T}),A=E.glFormat,O=E.glInternalFormat,I=E.glType,P=E.glNumChannels;this._glInternalFormat=O,this._glFormat=A,this._glType=I,this._glNumChannels=P;var R=e.getGPULayerInternalFilter({composer:t,filter:g,wrapX:y,wrapY:v,internalType:T,name:n});this._internalFilter=R,this._glFilter=_[R],this._internalWrapX=e.getGPULayerInternalWrap({composer:t,wrap:y,internalFilter:R,internalType:T,name:n}),this._glWrapS=_[this._internalWrapX],this._internalWrapY=e.getGPULayerInternalWrap({composer:t,wrap:v,internalFilter:R,internalType:T,name:n}),this._glWrapT=_[this._internalWrapY];var N=void 0!==r.numBuffers?r.numBuffers:1;if(!(0,a.isPositiveInteger)(N))throw new Error("Invalid numBuffers: ".concat(JSON.stringify(N),' for GPULayer "').concat(n,'", must be positive integer.'));this.numBuffers=N,void 0!==r.clearValue&&(this.clearValue=r.clearValue),this._initBuffers(r.array)}return e.initFromImageURL=function(t,r){return n(this,void 0,void 0,(function(){return o(this,(function(n){return[2,new Promise((function(n,o){if(!r)throw new Error("Error initing GPULayer: must pass params to GPULayer.initFromImageURL(composer, params).");if(!(0,a.isObject)(r))throw new Error("Error initing GPULayer: must pass valid params object to GPULayer.initFromImageURL(composer, params), got ".concat(JSON.stringify(r),"."));var i=Object.keys(r);(0,u.checkValidKeys)(i,["name","url","filter","wrapX","wrapY","format","type"],"GPULayer.initFromImageURL(composer, params)",r.name),(0,u.checkRequiredKeys)(i,["name","url"],"GPULayer.initFromImageURL(composer, params)",r.name);var c=r.url,s=r.name,_=r.filter,p=r.wrapX,f=r.wrapY,d=r.type,h=r.format;if(!(0,a.isString)(c))throw new Error("Expected GPULayer.initFromImageURL params to have url of type string, got ".concat(c," of type ").concat(typeof c,"."));if(d&&!(0,u.isValidImageType)(d))throw new Error('Invalid type: "'.concat(d,'" for GPULayer.initFromImageURL "').concat(s,'", must be one of ').concat(JSON.stringify(l.validImageTypes),"."));if(h&&!(0,u.isValidImageFormat)(h))throw new Error('Invalid format: "'.concat(h,'" for GPULayer.initFromImageURL "').concat(s,'", must be one of ').concat(JSON.stringify(l.validImageFormats),"."));var m=new e(t,{name:s,type:d||l.FLOAT,filter:_,wrapX:p,wrapY:f,numComponents:h?h.length:4,dimensions:[1,1],numBuffers:1}),g=new Image;g.onload=function(){m.resize([g.width,g.height],g),n(m)},g.onerror=function(e){o(new Error('Error loading image "'.concat(s,'": ').concat(e)))},g.src=c}))]}))}))},Object.defineProperty(e.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){if(!this._length)throw new Error('Cannot access length on 2D GPULayer "'.concat(this.name,'".'));return this._length},enumerable:!1,configurable:!0}),e.prototype.is1D=function(){return void 0!==this._length},e.prototype.is2D=function(){return!this.is1D()},e.prototype._usingTextureOverrideForCurrentBuffer=function(){return!(!this._textureOverrides||!this._textureOverrides[this.bufferIndex])},e.prototype.copyCurrentStateToGPULayer=function(e){var t=this._composer;if(this===e)throw new Error("Can't call GPULayer.copyCurrentStateToGPULayer() on self.");var r=t._copyProgramForType(this._internalType);t.step({program:r,input:this,output:e})},e.prototype._initBuffers=function(t){var r=this,n=r.name,o=r.numBuffers,i=r._composer,c=r._glInternalFormat,s=r._glFormat,u=r._glType,l=r._glFilter,_=r._glWrapS,p=r._glWrapT,f=r.width,d=r.height,h=i.gl,m=i._errorCallback,g=null;(0,a.isArray)(t)?g=e.validateGPULayerArray(t,this):(null==t?void 0:t.constructor)===HTMLImageElement&&(g=t);for(var y=0;y-r&&(e+=r),(e<0||e>=r)&&(console.warn("Out of range buffer index: ".concat(e,' for GPULayer "').concat(this.name,'" with $.numBuffers} buffer').concat(r>1?"s":"",". Was this intentional?")),e<0?e+=r*Math.ceil(Math.abs(e)/r):e%=r);var i=o[e];return n&&n[e]&&(i=n[e]),{texture:i,layer:this}},e.prototype._prepareForWrite=function(e){e&&this.incrementBufferIndex(),this._textureOverrides&&(this._textureOverrides[this.bufferIndex]=void 0)},e.prototype.setFromArray=function(t){var r=this,n=r._composer,o=r._glInternalFormat,i=r._glFormat,a=r._glType,c=r.width,s=r.height,u=r._currentTexture,l=n.gl,_=e.validateGPULayerArray(t,this);l.bindTexture(l.TEXTURE_2D,u),l.texImage2D(l.TEXTURE_2D,0,o,c,s,0,i,a,_),l.bindTexture(l.TEXTURE_2D,null)},e.prototype.resize=function(t,r){var n=this.name,o=this._composer.verboseLogging;o&&console.log('Resizing GPULayer "'.concat(n,'" to ').concat(JSON.stringify(t),"."));var i=e.calcGPULayerSize(t,n,o),a=i.length,c=i.width,s=i.height;this._length=a,this._width=c,this._height=s,this._destroyBuffers(),this._initBuffers(r)},Object.defineProperty(e.prototype,"clearValue",{get:function(){return this._clearValue},set:function(e){var t=this.numComponents,r=this.type;if(!(0,u.isValidClearValue)(e,t,r))throw new Error("Invalid clearValue: ".concat(JSON.stringify(e),' for GPULayer "').concat(this.name,'", expected ').concat(r," or array of ").concat(r," of length ").concat(t,"."));this._clearValue=(0,a.isArray)(e)?e.slice():e,this._clearValueVec4=void 0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clearValueVec4",{get:function(){var e=this._clearValueVec4;if(!e){var t=this.clearValue;if(e=[],(0,a.isFiniteNumber)(t))e.push(t,t,t,t);else{e.push.apply(e,t);for(var r=e.length;r<4;r++)e.push(0)}this._clearValueVec4=e}return e},enumerable:!1,configurable:!0}),e.prototype.clear=function(e){void 0===e&&(e=!1);var t=this,r=t.name,n=t._composer,o=t.clearValueVec4,i=t.numBuffers,a=t.type;n.verboseLogging&&console.log('Clearing GPULayer "'.concat(r,'".'));var c=n._setValueProgramForType(a);c.setUniform("u_value",o),this.decrementBufferIndex();for(var s=e?i:1,u=0;u=_)break;for(var T=0;T1)throw new Error('GPULayer "'.concat(i,'" contains multiple WebGL textures (one for each buffer) that are flip-flopped during compute cycles, please choose a GPULayer with one buffer.'));var s=a.properties.get(e);c.deleteTexture(s.__webglTexture),s.__webglTexture=o.texture,s.__webglInit=!0},e.prototype._destroyBuffers=function(){var e=this._composer,t=this._buffers,r=e.gl;t.forEach((function(e){r.deleteTexture(e),(0,p.disposeFramebuffers)(r,e)})),t.length=0,delete this._textureOverrides},e.prototype.clone=function(e){return this._composer._cloneGPULayer(this,e)},e.prototype.dispose=function(){var e=this.name,t=this._composer,r=t.gl;if(t.verboseLogging&&console.log('Deallocating GPULayer "'.concat(e,'".')),!r)throw new Error("Must call dispose() on all GPULayers before calling dispose() on GPUComposer.");this._destroyBuffers(),delete this._buffers,delete this._composer,this._values&&delete this._values,this._valuesRaw&&delete this._valuesRaw},e}();t.GPULayer=d},191:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.minMaxValuesForType=t.testFilterWrap=t.testWriteSupport=t.shouldCastIntTypeAsFloat=void 0;var n=r(566),o=r(650),i=r(601),a=r(690),c=r(581),s=r(798),u=r(355),l=r(593),_={writeSupport:{},filterWrapSupport:{}};function p(e,t){var r=e.glslVersion,n=e.isWebGL2;return(r!==i.GLSL3||!n)&&(t===i.UNSIGNED_BYTE||t===i.BYTE||t===i.SHORT||t===i.INT||t===i.UNSIGNED_SHORT||t===i.UNSIGNED_INT)}function f(e,t){var r=e.gl,n=e.glslVersion,o=e.isWebGL2,a="".concat(o,",").concat(t,",").concat(n===i.GLSL3?"3":"1");if(void 0!==_.writeSupport[a])return _.writeSupport[a];var c=r.createTexture();if(!c)return _.writeSupport[a]=!1,_.writeSupport[a];r.bindTexture(r.TEXTURE_2D,c);var s=r[i.CLAMP_TO_EDGE],l=r[i.NEAREST];r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,s),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,s),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,l),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,l);var p=u.GPULayer.getGLTextureParameters({composer:e,name:"testWriteSupport",numComponents:1,internalType:t}),f=p.glInternalFormat,d=p.glFormat,h=p.glType;r.texImage2D(r.TEXTURE_2D,0,f,10,10,0,d,h,null);var m=r.createFramebuffer();if(!m)return r.deleteTexture(c),_.writeSupport[a]=!1,_.writeSupport[a];r.bindFramebuffer(r.FRAMEBUFFER,m),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,c,0);var g=r.checkFramebufferStatus(r.FRAMEBUFFER)===r.FRAMEBUFFER_COMPLETE;return r.deleteTexture(c),r.deleteFramebuffer(m),_.writeSupport[a]=g,_.writeSupport[a]}function d(e,t,r,n){var a,c=e.gl,p=e.glslVersion,f=e.intPrecision,d=e.floatPrecision,h=e._errorCallback,m=e.isWebGL2,g="".concat(m,",").concat(t,",").concat(r,",").concat(n,",").concat(p===i.GLSL3?"3":"1");if(void 0!==_.filterWrapSupport[g])return _.filterWrapSupport[g];var y=c.createTexture();if(!y)return _.filterWrapSupport[g]=!1,_.filterWrapSupport[g];c.bindTexture(c.TEXTURE_2D,y);var v=c[n],T=c[r];c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,v),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,v),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,T),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,T);for(var E=u.GPULayer.getGLTextureParameters({composer:e,name:"testFilterWrap",numComponents:1,internalType:t}),A=E.glInternalFormat,O=E.glFormat,I=E.glType,P=E.glNumChannels,R=[3,56.5,834,-53.6,.003,96.2,23,90.2,32],N=u.GPULayer.initArrayForType(t,R.length*P,!0),S=0;Sk){V=!1;break}}_.filterWrapSupport[g]=V,c.deleteProgram(C)}else _.filterWrapSupport[g]=!1;c.deleteShader(x)}else _.filterWrapSupport[g]=!1;return U.dispose(),c.deleteTexture(y),_.filterWrapSupport[g]}function h(e){var t=-1/0,r=1/0;switch(e){case i.UNSIGNED_BYTE:t=i.MIN_UNSIGNED_BYTE,r=i.MAX_UNSIGNED_BYTE;break;case i.BYTE:t=i.MIN_BYTE,r=i.MAX_BYTE;break;case i.UNSIGNED_SHORT:t=i.MIN_UNSIGNED_SHORT,r=i.MAX_UNSIGNED_SHORT;break;case i.SHORT:t=i.MIN_SHORT,r=i.MAX_SHORT;break;case i.UNSIGNED_INT:t=i.MIN_UNSIGNED_INT,r=i.MAX_UNSIGNED_INT;break;case i.INT:t=i.MIN_INT,r=i.MAX_INT}return{min:t,max:r}}u.GPULayer.initArrayForType=function(e,t,r){return void 0===r&&(r=!1),new((0,a.arrayConstructorForType)(e,r))(t)},u.GPULayer.calcGPULayerSize=function(e,t,r){if((0,n.isNumber)(e)){if(!(0,n.isPositiveInteger)(e))throw new Error("Invalid length: ".concat(JSON.stringify(e),' for GPULayer "').concat(t,'", must be positive integer.'));var o=e,i=Math.ceil(Math.sqrt(o)),a=Math.ceil(o/i);return r&&console.log("Using [".concat(i,", ").concat(a,"] for 1D array of length ").concat(e,' in GPULayer "').concat(t,'".')),{width:i,height:a,length:o}}var c=e[0];if(!(0,n.isPositiveInteger)(c))throw new Error("Invalid width: ".concat(JSON.stringify(c),' for GPULayer "').concat(t,'", must be positive integer.'));var s=e[1];if(!(0,n.isPositiveInteger)(s))throw new Error("Invalid height: ".concat(JSON.stringify(s),' for GPULayer "').concat(t,'", must be positive integer.'));return{width:c,height:s}},u.GPULayer.getGPULayerInternalWrap=function(e){var t=e.composer,r=e.wrap,n=e.internalFilter,o=e.internalType;return r===i.CLAMP_TO_EDGE||d(t,o,n,r)?r:i.CLAMP_TO_EDGE},u.GPULayer.getGPULayerInternalFilter=function(e){var t=e.filter;if(t===i.NEAREST)return t;var r=e.composer,n=e.internalType,o=e.wrapX,a=e.wrapY,s=e.name;n===i.HALF_FLOAT&&(((0,c.getExtension)(r,c.OES_TEXTURE_HAlF_FLOAT_LINEAR,!0)||(0,c.getExtension)(r,c.OES_TEXTURE_FLOAT_LINEAR,!0))&&d(r,n,t,o)&&d(r,n,t,a)||(console.warn("This browser does not support ".concat(t," filtering for type ").concat(n," and wrap [").concat(o,", ").concat(a,']. Falling back to NEAREST filter for GPULayer "').concat(s,'" with ').concat(t," polyfill in fragment shader.")),t=i.NEAREST));n===i.FLOAT&&((0,c.getExtension)(r,c.OES_TEXTURE_FLOAT_LINEAR,!0)&&d(r,n,t,o)&&d(r,n,t,a)||(console.warn("This browser does not support ".concat(t," filtering for type ").concat(n," and wrap [").concat(o,", ").concat(a,']. Falling back to NEAREST filter for GPULayer "').concat(s,'" with ').concat(t," polyfill in fragment shader.")),t=i.NEAREST));return t},t.shouldCastIntTypeAsFloat=p,u.GPULayer.getGLTextureParameters=function(e){var t,r,n,o,a=e.composer,s=e.name,u=e.numComponents,l=e.internalType,_=a.gl,p=a.glslVersion;if(a.isWebGL2){if(o=u,3===u&&(o=4),l===i.FLOAT||l===i.HALF_FLOAT)switch(o){case 1:r=_.RED;break;case 2:r=_.RG;break;case 4:r=_.RGBA;break;default:throw new Error("Unsupported glNumChannels: ".concat(o,' for GPULayer "').concat(s,'".'))}else switch(o){case 1:r=_.RED_INTEGER;break;case 2:r=_.RG_INTEGER;break;case 4:r=_.RGBA_INTEGER;break;default:throw new Error("Unsupported glNumChannels: ".concat(o,' for GPULayer "').concat(s,'".'))}switch(l){case i.HALF_FLOAT:switch(t=_.HALF_FLOAT,o){case 1:n=_.R16F;break;case 2:n=_.RG16F;break;case 4:n=_.RGBA16F;break;default:throw new Error("Unsupported glNumChannels: ".concat(o,' for GPULayer "').concat(s,'".'))}break;case i.FLOAT:switch(t=_.FLOAT,o){case 1:n=_.R32F;break;case 2:n=_.RG32F;break;case 4:n=_.RGBA32F;break;default:throw new Error("Unsupported glNumChannels: ".concat(o,' for GPULayer "').concat(s,'".'))}break;case i.UNSIGNED_BYTE:if(t=_.UNSIGNED_BYTE,p===i.GLSL1&&l===i.UNSIGNED_BYTE)n=r;else switch(o){case 1:n=_.R8UI;break;case 2:n=_.RG8UI;break;case 4:n=_.RGBA8UI;break;default:throw new Error("Unsupported glNumChannels: ".concat(o,' for GPULayer "').concat(s,'".'))}break;case i.BYTE:switch(t=_.BYTE,o){case 1:n=_.R8I;break;case 2:n=_.RG8I;break;case 4:n=_.RGBA8I;break;default:throw new Error("Unsupported glNumChannels: ".concat(o,' for GPULayer "').concat(s,'".'))}break;case i.SHORT:switch(t=_.SHORT,o){case 1:n=_.R16I;break;case 2:n=_.RG16I;break;case 4:n=_.RGBA16I;break;default:throw new Error("Unsupported glNumChannels: ".concat(o,' for GPULayer "').concat(s,'".'))}break;case i.UNSIGNED_SHORT:switch(t=_.UNSIGNED_SHORT,o){case 1:n=_.R16UI;break;case 2:n=_.RG16UI;break;case 4:n=_.RGBA16UI;break;default:throw new Error("Unsupported glNumChannels: ".concat(o,' for GPULayer "').concat(s,'".'))}break;case i.INT:switch(t=_.INT,o){case 1:n=_.R32I;break;case 2:n=_.RG32I;break;case 4:n=_.RGBA32I;break;default:throw new Error("Unsupported glNumChannels: ".concat(o,' for GPULayer "').concat(s,'".'))}break;case i.UNSIGNED_INT:switch(t=_.UNSIGNED_INT,o){case 1:n=_.R32UI;break;case 2:n=_.RG32UI;break;case 4:n=_.RGBA32UI;break;default:throw new Error("Unsupported glNumChannels: ".concat(o,' for GPULayer "').concat(s,'".'))}break;default:throw new Error('Unsupported type: "'.concat(l,'" for GPULayer "').concat(s,'".'))}}else{if(u<1||u>4)throw new Error("Unsupported numComponents: ".concat(u,' for GPULayer "').concat(s,'".'));switch(o=4,r=_.RGBA,n=_.RGBA,l){case i.FLOAT:t=_.FLOAT;break;case i.HALF_FLOAT:t=_.HALF_FLOAT||(0,c.getExtension)(a,c.OES_TEXTURE_HALF_FLOAT).HALF_FLOAT_OES;break;default:throw new Error('Unsupported type: "'.concat(l,'" in WebGL 1.0 for GPULayer "').concat(s,'".'))}}if(void 0===t||void 0===r||void 0===n){var f=[];throw void 0===t&&f.push("glType"),void 0===r&&f.push("glFormat"),void 0===n&&f.push("glInternalFormat"),new Error("Invalid type: ".concat(l," for numComponents: ").concat(u,", unable to init parameter").concat(f.length>1?"s":""," ").concat(f.join(", "),' for GPULayer "').concat(s,'".'))}if(void 0===o||u<1||u>4||o 16,777,216 are not supported, on mobile UNSIGNED_INT, INT, UNSIGNED_SHORT, and SHORT with absolute value > 2,048 may not be supported.')),s=i.FLOAT)),o){if(s===i.FLOAT)if((0,c.getExtension)(t,c.EXT_COLOR_BUFFER_FLOAT,!0))f(t,s)||(console.warn('FLOAT not supported for writing operations in this browser, falling back to HALF_FLOAT type for GPULayer "'.concat(r,'".')),s=i.HALF_FLOAT);else console.warn('FLOAT not supported in this browser, falling back to HALF_FLOAT type for GPULayer "'.concat(r,'".')),s=i.HALF_FLOAT;if(s===i.HALF_FLOAT)(0,c.getExtension)(t,c.EXT_COLOR_BUFFER_HALF_FLOAT,!0)||(0,c.getExtension)(t,c.EXT_COLOR_BUFFER_FLOAT,!0),f(t,s)||(console.warn("This browser does not support writing to HALF_FLOAT textures."),n("This browser does not support writing to HALF_FLOAT textures."))}else{if(s===i.FLOAT)if((0,c.getExtension)(t,c.OES_TEXTURE_FLOAT,!0))f(t,s)||(console.warn('FLOAT not supported for writing operations in this browser, falling back to HALF_FLOAT type for GPULayer "'.concat(r,'".')),s=i.HALF_FLOAT);else console.warn('FLOAT not supported in this browser, falling back to HALF_FLOAT type for GPULayer "'.concat(r,'".')),s=i.HALF_FLOAT;if(s===i.HALF_FLOAT)(0,c.getExtension)(t,c.OES_TEXTURE_HALF_FLOAT,!0),f(t,s)||console.warn("This browser does not support writing to HALF_FLOAT textures.")}return s},t.minMaxValuesForType=h,u.GPULayer.validateGPULayerArray=function(e,t){var r=t.numComponents,n=t.width,a=t.height,c=t.name,s=t._glNumChannels,l=t._internalType,_=t.is1D()?t.length:null;if(e.length!==n*a*r&&(!_||_&&e.length!==_*r))throw new Error("Invalid data length: ".concat(e.length,' for GPULayer "').concat(c,'" of ').concat(_?"length ".concat(_," and "):"","dimensions: [").concat(n,", ").concat(a,"] and numComponents: ").concat(r,"."));var p=!1;switch(e.constructor){case Array:p=!0;break;case Float32Array:p=l!==i.FLOAT;break;case Uint8Array:p=l!==i.UNSIGNED_BYTE;break;case Int8Array:p=l!==i.BYTE;break;case Uint16Array:p=l!==i.UNSIGNED_SHORT;break;case Int16Array:p=l!==i.SHORT;break;case Uint32Array:p=l!==i.UNSIGNED_INT;break;case Int32Array:p=l!==i.INT;break;default:throw new Error("Invalid array type: ".concat(e.constructor.name,' for GPULayer "').concat(c,'", please use one of [').concat(i.validArrayTypes.map((function(e){return e.name})).join(", "),"]."))}var f=h(l),d=f.min,m=f.max,g=n*a*s,y=e.length!==g,v=e;if(p||y){v=u.GPULayer.initArrayForType(l,g);for(var T=l===i.HALF_FLOAT&&p?new DataView(v.buffer):null,E=0,A=e.length/r;Em&&(P=m,R=!0),R&&console.warn("Clipping out of range value ".concat(I," to ").concat(P,' for GPULayer "').concat(c,'" with internal type ').concat(l,"."));var N=E*s+O;T?(0,o.setFloat16)(T,2*N,P,!0):v[N]=P}}return v}},664:function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,r=1,n=arguments.length;r4)throw new Error("Invalid uniform value: [".concat(t.join(", "),'] passed to GPUProgram "').concat(this.name,', uniforms must be of type number[] with length <= 4, number, or boolean."'));var f=null===(n=a[e])||void 0===n?void 0:n.type;if(r){var d=(0,c.uniformInternalTypeForValue)(t,r,e,this.name);if(void 0===f)f=d;else if(f!==d)throw new Error('Uniform "'.concat(e,'" for GPUProgram "').concat(this.name,'" cannot change from type ').concat(f," to type ").concat(d,"."))}if(void 0===f)throw new Error('Unknown type for uniform "'.concat(e,'", please pass in type to GPUProgram.setUniform(name, value, type) when initing a new uniform.'));if(this._cacheUniformValue(e,t,f)){var h=l.find((function(t){return t.name===e}));h&&(0,u.isInteger)(t)&&(h.inputIndex=t),_&&console.log('Setting uniform "'.concat(e,'" for program "').concat(this.name,'" to value ').concat(JSON.stringify(t),"."));for(var m=Object.keys(i),g=0,y=m.length;g=0?console.warn("Found > 1 sampler2D uniforms at texture index ".concat(l,' for GPUProgram "').concat(this.name,'".')):o[l]=_}i=0;for(var p=t.length;i{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.wrappedLineColorProgram=t.renderSignedAmplitudeProgram=t.renderAmplitudeProgram=t.zeroProgram=t.setColorProgram=t.setValueProgram=t.multiplyValueProgram=t.addValueProgram=t.addLayersProgram=t.copyProgram=void 0;var n=r(566),o=r(601),i=r(690),a=r(664);function c(e,t){var r=t.type,o=t.value,c=t.precision||"",s=(0,n.isArray)(o)?o.length:1,u=(0,i.glslTypeForType)(r,s),l=1===s?4:s,_=(0,i.glslTypeForType)(r,l),p=t.name||"setValue_".concat(u,"_w_length_").concat(s);return new a.GPUProgram(e,{name:p,fragmentShader:"\nuniform ".concat(c," ").concat(u," u_value;\nout ").concat(c," ").concat(_," out_result;\nvoid main() {\n\tout_result = ").concat(u!==_?_:"","(u_value);\n}"),uniforms:[{name:"u_value",value:o,type:(0,i.uniformTypeForType)(r,e.glslVersion)}]})}t.copyProgram=function(e,t){var r=t.type,n=t.precision||"",c=(0,i.glslTypeForType)(r,4),s=t.name||"copy_".concat((0,i.uniformTypeForType)(r,e.glslVersion),"_layer");return new a.GPUProgram(e,{name:s,fragmentShader:"\nin vec2 v_uv;\nuniform ".concat(n," ").concat((0,i.glslPrefixForType)(r),"sampler2D u_state;\nout ").concat(n," ").concat(c," out_result;\nvoid main() {\n\tout_result = texture(u_state, v_uv);\n}"),uniforms:[{name:"u_state",value:0,type:o.INT}]})},t.addLayersProgram=function(e,t){var r=t.type,n=t.numInputs||2,c=t.precision||"",s=t.components||"xyzw",u=(0,i.glslTypeForType)(r,s.length),l=new Array(n),_=t.name||"".concat(n,"-way_add_").concat((0,i.uniformTypeForType)(r,e.glslVersion),"_").concat(s);return new a.GPUProgram(e,{name:_,fragmentShader:"\nin vec2 v_uv;\n".concat(l.map((function(e,t){return"uniform ".concat(c," ").concat((0,i.glslPrefixForType)(r),"sampler2D u_state").concat(t,";")})).join("\n"),"\nout ").concat(c," ").concat(u," out_result;\nvoid main() {\n\tout_result = ").concat(l.map((function(e,t){return"texture(u_state".concat(t,", v_uv).").concat(s)})).join(" + "),";\n}"),uniforms:l.map((function(e,t){return{name:"u_state".concat(t),value:t,type:o.INT}}))})},t.addValueProgram=function(e,t){var r=t.type,c=t.value,s=t.precision||"",u=(0,n.isArray)(c)?c.length:1,l=(0,i.glslTypeForType)(r,u),_=1===u?4:u,p=(0,i.glslTypeForType)(r,_),f=(0,i.glslComponentSelectionForNumComponents)(_),d=t.name||"addValue_".concat(l,"_w_length_").concat(u);return new a.GPUProgram(e,{name:d,fragmentShader:"\nin vec2 v_uv;\nuniform ".concat(s," ").concat(l," u_value;\nuniform ").concat(s," ").concat((0,i.glslPrefixForType)(r),"sampler2D u_state;\nout ").concat(s," ").concat(p," out_result;\nvoid main() {\n\tout_result = ").concat(l!==p?p:"","(u_value) + texture(u_state, v_uv)").concat(f,";\n}"),uniforms:[{name:"u_state",value:0,type:o.INT},{name:"u_value",value:c,type:(0,i.uniformTypeForType)(r,e.glslVersion)}]})},t.multiplyValueProgram=function(e,t){var r=t.type,c=t.value,s=t.precision||"",u=(0,n.isArray)(c)?c.length:1,l=(0,i.glslTypeForType)(r,u),_=1===u?4:u,p=(0,i.glslTypeForType)(r,_),f=(0,i.glslComponentSelectionForNumComponents)(_),d=t.name||"addValue_".concat(l,"_w_length_").concat(u);return new a.GPUProgram(e,{name:d,fragmentShader:"\nin vec2 v_uv;\nuniform ".concat(s," ").concat(l," u_value;\nuniform ").concat(s," ").concat((0,i.glslPrefixForType)(r),"sampler2D u_state;\nout ").concat(s," ").concat(p," out_result;\nvoid main() {\n\tout_result = ").concat(l!==p?p:"","(u_value) * texture(u_state, v_uv)").concat(f,";\n}"),uniforms:[{name:"u_state",value:0,type:o.INT},{name:"u_value",value:c,type:(0,i.uniformTypeForType)(r,e.glslVersion)}]})},t.setValueProgram=c,t.setColorProgram=function(e,t){var r=t.type,n=t.precision||"",c=void 0===t.opacity?1:t.opacity,s=t.color||[0,0,0],u=t.name||"setColor",l=(0,i.glslTypeForType)(r,4);return new a.GPUProgram(e,{name:u,fragmentShader:"\nuniform ".concat(n," vec3 u_color;\nuniform ").concat(n," float u_opacity;\nout ").concat(n," ").concat(l," out_result;\nvoid main() {\n\tout_result = ").concat(l,"(u_color, u_opacity);\n}"),uniforms:[{name:"u_color",value:s,type:o.FLOAT},{name:"u_opacity",value:c,type:o.FLOAT}]})},t.zeroProgram=function(e,t){return c(e,{type:o.FLOAT,value:0,name:t.name})},t.renderAmplitudeProgram=function(e,t){var r=t.type,n=t.precision||"",c=t.components||"xyzw",s=c.length,u=(0,i.glslTypeForType)(r,s),l=(0,i.glslTypeForType)(o.FLOAT,s),_=(0,i.glslPrefixForType)(r),p=l===u,f=t.name||"renderAmplitude_".concat(u,"_w_").concat(s,"_components");return new a.GPUProgram(e,{name:f,fragmentShader:"\nin vec2 v_uv;\nuniform float u_opacity;\nuniform float u_scale;\nuniform vec3 u_color;\nuniform vec3 u_colorZero;\nuniform ".concat(n," ").concat(_,"sampler2D u_state;\nout vec4 out_result;\nvoid main() {\n\tfloat amplitude = u_scale * ").concat(1===s?"abs":"length","(").concat(p?"":l,"(texture(u_state, v_uv)").concat("xyzw"===c||"rgba"===c||"stpq"===c?"":".".concat(c),"));\n\tvec3 color = mix(u_colorZero, u_color, amplitude);\n\tout_result = vec4(color, u_opacity);\n}"),uniforms:[{name:"u_state",value:0,type:o.INT},{name:"u_scale",value:void 0!==t.scale?t.scale:1,type:o.FLOAT},{name:"u_opacity",value:void 0!==t.opacity?t.opacity:1,type:o.FLOAT},{name:"u_color",value:t.color||[1,1,1],type:o.FLOAT},{name:"u_colorZero",value:t.colorZero||[0,0,0],type:o.FLOAT}]})},t.renderSignedAmplitudeProgram=function(e,t){var r=t.type,n=t.precision||"",c=(0,i.glslTypeForType)(r,1),s=(0,i.glslPrefixForType)(r),u="float"===c,l=t.component||"x",_=t.name||"renderAmplitude_".concat(c,"_").concat(l);return new a.GPUProgram(e,{name:_,fragmentShader:"\nin vec2 v_uv;\nuniform float u_opacity;\nuniform float u_scale;\nuniform float u_bias;\nuniform vec3 u_colorNegative;\nuniform vec3 u_colorPositive;\nuniform vec3 u_colorZero;\nuniform ".concat(n," ").concat(s,"sampler2D u_state;\nout vec4 out_result;\nvoid main() {\n\tfloat signedAmplitude = u_scale * (").concat(u?"":"float","(texture(u_state, v_uv).").concat(l,") - u_bias);\n\tfloat amplitudeSign = sign(signedAmplitude);\n\tvec3 interpColor = mix(u_colorNegative, u_colorPositive, amplitudeSign / 2.0 + 0.5);\n\tvec3 color = mix(u_colorZero, interpColor, signedAmplitude * amplitudeSign);\n\tout_result = vec4(color, u_opacity);\n}"),uniforms:[{name:"u_state",value:0,type:o.INT},{name:"u_scale",value:void 0!==t.scale?t.scale:1,type:o.FLOAT},{name:"u_bias",value:t.bias||0,type:o.FLOAT},{name:"u_opacity",value:void 0!==t.opacity?t.opacity:1,type:o.FLOAT},{name:"u_colorNegative",value:t.colorNegative||[0,0,1],type:o.FLOAT},{name:"u_colorPositive",value:t.colorPositive||[1,0,0],type:o.FLOAT},{name:"u_colorZero",value:t.colorZero||[1,1,1],type:o.FLOAT}]})},t.wrappedLineColorProgram=function(e){return new a.GPUProgram(e,{name:"wrappedLineColor",fragmentShader:"\nin vec2 v_lineWrapping;\nuniform vec4 u_value;\nout vec4 out_result;\nvoid main() {\n\t// Check if this line has wrapped.\n\tif ((v_lineWrapping.x != 0.0 && v_lineWrapping.x != 1.0) || (v_lineWrapping.y != 0.0 && v_lineWrapping.y != 1.0)) {\n\t\t// Render nothing.\n\t\tdiscard;\n\t\treturn;\n\t}\n\tout_result = vec4(u_value);\n}"})}},404:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Vector4=void 0;var r=function(){function e(e,t,r,n){void 0===e&&(e=0),void 0===t&&(t=0),void 0===r&&(r=0),void 0===n&&(n=1),this.x=e,this.y=t,this.z=r,this.w=n}return Object.defineProperty(e.prototype,"width",{get:function(){return this.z},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.w},enumerable:!1,configurable:!0}),e.prototype.copy=function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this},e}();t.Vector4=r},707:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.checkRequiredKeys=t.checkValidKeys=t.isNumberOfType=t.isValidClearValue=t.isValidImageType=t.isValidImageFormat=t.isValidWrap=t.isValidFilter=t.isValidDataType=void 0;var n=r(566),o=r(601);function i(e,t){switch(t){case o.HALF_FLOAT:case o.FLOAT:return(0,n.isFiniteNumber)(e);case o.BYTE:return!(e<-128)&&(!(e>127)&&(0,n.isInteger)(e));case o.SHORT:return!(e<-32768)&&(!(e>32767)&&(0,n.isInteger)(e));case o.INT:return!(e<-2147483648)&&(!(e>2147483647)&&(0,n.isInteger)(e));case o.UNSIGNED_BYTE:return!(e>255)&&(0,n.isNonNegativeInteger)(e);case o.UNSIGNED_SHORT:return!(e>65535)&&(0,n.isNonNegativeInteger)(e);case o.UNSIGNED_INT:return!(e>4294967295)&&(0,n.isNonNegativeInteger)(e);default:throw new Error("Unknown type ".concat(t))}}t.isValidDataType=function(e){return o.validDataTypes.indexOf(e)>-1},t.isValidFilter=function(e){return o.validFilters.indexOf(e)>-1},t.isValidWrap=function(e){return o.validWraps.indexOf(e)>-1},t.isValidImageFormat=function(e){return o.validImageFormats.indexOf(e)>-1},t.isValidImageType=function(e){return o.validImageTypes.indexOf(e)>-1},t.isValidClearValue=function(e,t,r){if((0,n.isArray)(e)){if(e.length!==t)return!1;for(var o=0;o{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LAYER_POINTS_PROGRAM_NAME=t.SEGMENT_PROGRAM_NAME=t.DEFAULT_PROGRAM_NAME=t.BOOL_4D_UNIFORM=t.BOOL_3D_UNIFORM=t.BOOL_2D_UNIFORM=t.BOOL_1D_UNIFORM=t.UINT_4D_UNIFORM=t.UINT_3D_UNIFORM=t.UINT_2D_UNIFORM=t.UINT_1D_UNIFORM=t.INT_4D_UNIFORM=t.INT_3D_UNIFORM=t.INT_2D_UNIFORM=t.INT_1D_UNIFORM=t.FLOAT_4D_UNIFORM=t.FLOAT_3D_UNIFORM=t.FLOAT_2D_UNIFORM=t.FLOAT_1D_UNIFORM=t.PRECISION_HIGH_P=t.PRECISION_MEDIUM_P=t.PRECISION_LOW_P=t.EXPERIMENTAL_WEBGL2=t.EXPERIMENTAL_WEBGL=t.WEBGL1=t.WEBGL2=t.GLSL1=t.GLSL3=t.validImageTypes=t.validImageFormats=t.RGBA=t.RGB=t.validWraps=t.validFilters=t.validDataTypes=t.validArrayTypes=t.REPEAT=t.CLAMP_TO_EDGE=t.LINEAR=t.NEAREST=t.UINT=t.BOOL=t.INT=t.UNSIGNED_INT=t.SHORT=t.UNSIGNED_SHORT=t.BYTE=t.UNSIGNED_BYTE=t.FLOAT=t.HALF_FLOAT=void 0,t.BOUNDARY_RIGHT=t.BOUNDARY_LEFT=t.BOUNDARY_BOTTOM=t.BOUNDARY_TOP=t.GPUIO_FLOAT_PRECISION=t.GPUIO_INT_PRECISION=t.MAX_FLOAT_INT=t.MIN_FLOAT_INT=t.MAX_HALF_FLOAT_INT=t.MIN_HALF_FLOAT_INT=t.MAX_INT=t.MIN_INT=t.MAX_UNSIGNED_INT=t.MIN_UNSIGNED_INT=t.MAX_SHORT=t.MIN_SHORT=t.MAX_UNSIGNED_SHORT=t.MIN_UNSIGNED_SHORT=t.MAX_BYTE=t.MIN_BYTE=t.MAX_UNSIGNED_BYTE=t.MIN_UNSIGNED_BYTE=t.DEFAULT_CIRCLE_NUM_SEGMENTS=t.DEFAULT_ERROR_CALLBACK=t.GPUIO_VS_POSITION_W_ACCUM=t.GPUIO_VS_NORMAL_ATTRIBUTE=t.GPUIO_VS_UV_ATTRIBUTE=t.GPUIO_VS_INDEXED_POSITIONS=t.GPUIO_VS_WRAP_Y=t.GPUIO_VS_WRAP_X=t.LAYER_MESH_PROGRAM_NAME=t.LAYER_VECTOR_FIELD_PROGRAM_NAME=t.LAYER_LINES_PROGRAM_NAME=void 0,t.HALF_FLOAT="HALF_FLOAT",t.FLOAT="FLOAT",t.UNSIGNED_BYTE="UNSIGNED_BYTE",t.BYTE="BYTE",t.UNSIGNED_SHORT="UNSIGNED_SHORT",t.SHORT="SHORT",t.UNSIGNED_INT="UNSIGNED_INT",t.INT="INT",t.BOOL="BOOL",t.UINT="UINT",t.NEAREST="NEAREST",t.LINEAR="LINEAR",t.CLAMP_TO_EDGE="CLAMP_TO_EDGE",t.REPEAT="REPEAT",t.validArrayTypes=[Float32Array,Uint8Array,Int8Array,Uint16Array,Int16Array,Uint32Array,Int32Array,Array],t.validDataTypes=[t.HALF_FLOAT,t.FLOAT,t.UNSIGNED_BYTE,t.BYTE,t.UNSIGNED_SHORT,t.SHORT,t.UNSIGNED_INT,t.INT],t.validFilters=[t.NEAREST,t.LINEAR],t.validWraps=[t.CLAMP_TO_EDGE,t.REPEAT],t.RGB="RGB",t.RGBA="RGBA",t.validImageFormats=[t.RGB,t.RGBA],t.validImageTypes=[t.UNSIGNED_BYTE,t.FLOAT,t.HALF_FLOAT],t.GLSL3="300 es",t.GLSL1="100",t.WEBGL2="webgl2",t.WEBGL1="webgl",t.EXPERIMENTAL_WEBGL="experimental-webgl",t.EXPERIMENTAL_WEBGL2="experimental-webgl2",t.PRECISION_LOW_P="lowp",t.PRECISION_MEDIUM_P="mediump",t.PRECISION_HIGH_P="highp",t.FLOAT_1D_UNIFORM="FLOAT_1D_UNIFORM",t.FLOAT_2D_UNIFORM="FLOAT_2D_UNIFORM",t.FLOAT_3D_UNIFORM="FLOAT_3D_UNIFORM",t.FLOAT_4D_UNIFORM="FLOAT_4D_UNIFORM",t.INT_1D_UNIFORM="INT_1D_UNIFORM",t.INT_2D_UNIFORM="INT_2D_UNIFORM",t.INT_3D_UNIFORM="INT_3D_UNIFORM",t.INT_4D_UNIFORM="INT_4D_UNIFORM",t.UINT_1D_UNIFORM="UINT_1D_UNIFORM",t.UINT_2D_UNIFORM="UINT_2D_UNIFORM",t.UINT_3D_UNIFORM="UINT_3D_UNIFORM",t.UINT_4D_UNIFORM="UINT_4D_UNIFORM",t.BOOL_1D_UNIFORM="BOOL_1D_UNIFORM",t.BOOL_2D_UNIFORM="BOOL_2D_UNIFORM",t.BOOL_3D_UNIFORM="BOOL_3D_UNIFORM",t.BOOL_4D_UNIFORM="BOOL_4D_UNIFORM",t.DEFAULT_PROGRAM_NAME="DEFAULT",t.SEGMENT_PROGRAM_NAME="SEGMENT",t.LAYER_POINTS_PROGRAM_NAME="LAYER_POINTS",t.LAYER_LINES_PROGRAM_NAME="LAYER_LINES",t.LAYER_VECTOR_FIELD_PROGRAM_NAME="LAYER_VECTOR_FIELD",t.LAYER_MESH_PROGRAM_NAME="LAYER_MESH",t.GPUIO_VS_WRAP_X="GPUIO_VS_WRAP_X",t.GPUIO_VS_WRAP_Y="GPUIO_VS_WRAP_Y",t.GPUIO_VS_INDEXED_POSITIONS="GPUIO_VS_INDEXED_POSITIONS",t.GPUIO_VS_UV_ATTRIBUTE="GPUIO_VS_UV_ATTRIBUTE",t.GPUIO_VS_NORMAL_ATTRIBUTE="GPUIO_VS_NORMAL_ATTRIBUTE",t.GPUIO_VS_POSITION_W_ACCUM="GPUIO_VS_POSITION_W_ACCUM";t.DEFAULT_ERROR_CALLBACK=function(e){throw new Error(e)},t.DEFAULT_CIRCLE_NUM_SEGMENTS=18,t.MIN_UNSIGNED_BYTE=0,t.MAX_UNSIGNED_BYTE=Math.pow(2,8)-1,t.MIN_BYTE=-Math.pow(2,7),t.MAX_BYTE=Math.pow(2,7)-1,t.MIN_UNSIGNED_SHORT=0,t.MAX_UNSIGNED_SHORT=Math.pow(2,16)-1,t.MIN_SHORT=-Math.pow(2,15),t.MAX_SHORT=Math.pow(2,15)-1,t.MIN_UNSIGNED_INT=0,t.MAX_UNSIGNED_INT=Math.pow(2,32)-1,t.MIN_INT=-Math.pow(2,31),t.MAX_INT=Math.pow(2,31)-1,t.MIN_HALF_FLOAT_INT=-2048,t.MAX_HALF_FLOAT_INT=2048,t.MIN_FLOAT_INT=-16777216,t.MAX_FLOAT_INT=16777216,t.GPUIO_INT_PRECISION="GPUIO_INT_PRECISION",t.GPUIO_FLOAT_PRECISION="GPUIO_FLOAT_PRECISION",t.BOUNDARY_TOP="BOUNDARY_TOP",t.BOUNDARY_BOTTOM="BOUNDARY_BOTTOM",t.BOUNDARY_LEFT="BOUNDARY_LEFT",t.BOUNDARY_RIGHT="BOUNDARY_RIGHT"},690:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.glslComponentSelectionForNumComponents=t.glslPrefixForType=t.glslTypeForType=t.arrayConstructorForType=t.uniformTypeForType=t.intForPrecision=void 0;var n=r(601);t.intForPrecision=function(e){if(e===n.PRECISION_HIGH_P)return 2;if(e===n.PRECISION_MEDIUM_P)return 1;if(e===n.PRECISION_LOW_P)return 0;throw new Error("Unknown shader precision value: ".concat(JSON.stringify(e),"."))},t.uniformTypeForType=function(e,t){switch(e){case n.HALF_FLOAT:case n.FLOAT:return n.FLOAT;case n.UNSIGNED_BYTE:case n.UNSIGNED_SHORT:case n.UNSIGNED_INT:return t===n.GLSL1?n.INT:n.UINT;case n.BYTE:case n.SHORT:case n.INT:return n.INT;default:throw new Error("Invalid type: ".concat(e," passed to glslKeyForType."))}},t.arrayConstructorForType=function(e,t){switch(void 0===t&&(t=!1),e){case n.HALF_FLOAT:return t?Float32Array:Uint16Array;case n.FLOAT:return Float32Array;case n.UNSIGNED_BYTE:return Uint8Array;case n.BYTE:return Int8Array;case n.UNSIGNED_SHORT:return Uint16Array;case n.SHORT:return Int16Array;case n.UNSIGNED_INT:return Uint32Array;case n.INT:return Int32Array;default:throw new Error('Unsupported type: "'.concat(e,'".'))}},t.glslTypeForType=function(e,t){switch(e){case n.HALF_FLOAT:case n.FLOAT:return 1===t?"float":"vec".concat(t);case n.UNSIGNED_BYTE:case n.UNSIGNED_SHORT:case n.UNSIGNED_INT:return 1===t?"uint":"uvec".concat(t);case n.BYTE:case n.SHORT:case n.INT:return 1===t?"int":"ivec".concat(t)}throw new Error("Invalid type: ".concat(e," passed to glslTypeForType."))},t.glslPrefixForType=function(e){switch(e){case n.HALF_FLOAT:case n.FLOAT:return"";case n.UNSIGNED_BYTE:case n.UNSIGNED_SHORT:case n.UNSIGNED_INT:return"u";case n.BYTE:case n.SHORT:case n.INT:return"i"}throw new Error("Invalid type: ".concat(e," passed to glslPrefixForType."))},t.glslComponentSelectionForNumComponents=function(e){switch(e){case 1:return".x";case 2:return".xy";case 3:return".xyz";case 4:return""}throw new Error("Invalid numComponents: ".concat(e," passed to glslComponentSelectionForNumComponents."))}},581:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getExtension=t.OES_STANDARD_DERIVATIVES=t.OES_ELEMENT_INDEX_UINT=t.OES_VERTEX_ARRAY_OBJECT=t.EXT_COLOR_BUFFER_HALF_FLOAT=t.EXT_COLOR_BUFFER_FLOAT=t.WEBGL_DEPTH_TEXTURE=t.OES_TEXTURE_HAlF_FLOAT_LINEAR=t.OES_TEXTURE_FLOAT_LINEAR=t.OES_TEXTURE_HALF_FLOAT=t.OES_TEXTURE_FLOAT=void 0,t.OES_TEXTURE_FLOAT="OES_texture_float",t.OES_TEXTURE_HALF_FLOAT="OES_texture_half_float",t.OES_TEXTURE_FLOAT_LINEAR="OES_texture_float_linear",t.OES_TEXTURE_HAlF_FLOAT_LINEAR="OES_texture_half_float_linear",t.WEBGL_DEPTH_TEXTURE="WEBGL_depth_texture",t.EXT_COLOR_BUFFER_FLOAT="EXT_color_buffer_float",t.EXT_COLOR_BUFFER_HALF_FLOAT="EXT_color_buffer_half_float",t.OES_VERTEX_ARRAY_OBJECT="OES_vertex_array_object",t.OES_ELEMENT_INDEX_UINT="OES_element_index_uint",t.OES_STANDARD_DERIVATIVES="OES_standard_derivatives",t.getExtension=function(e,t,r){if(void 0===r&&(r=!1),void 0!==e._extensions[t])return e._extensions[t];var n,o=e.gl,i=e._errorCallback,a=e._extensions;e.verboseLogging;try{n=o.getExtension(t)}catch(e){}return n?(a[t]=n,e.verboseLogging&&console.log("Loaded extension: ".concat(t,"."))):(a[t]=!1,e.verboseLogging&&console.log("Unsupported ".concat(r?"optional ":"","extension: ").concat(t,"."))),n||r||i("Required extension unsupported by this device / browser: ".concat(t,".")),n}},798:function(e,t){"use strict";var r=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o15)throw new Error("Can't draw to more than 16 outputs.");for(var s=0,u=n.length;s{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PRECISION_SOURCE=void 0;var n=r(601),o=r(690);t.PRECISION_SOURCE="\n#if (".concat(n.GPUIO_INT_PRECISION," == ").concat((0,o.intForPrecision)(n.PRECISION_LOW_P),")\n\tprecision lowp int;\n\t#if (__VERSION__ == 300)\n\t\tprecision lowp isampler2D;\n\t\tprecision lowp usampler2D;\n\t#endif\n#elif (").concat(n.GPUIO_INT_PRECISION," == ").concat((0,o.intForPrecision)(n.PRECISION_MEDIUM_P),")\n\tprecision mediump int;\n\t#if (__VERSION__ == 300)\n\t\tprecision mediump isampler2D;\n\t\tprecision mediump usampler2D;\n\t#endif\n#else \n\t#ifdef GL_FRAGMENT_PRECISION_HIGH\n\t\tprecision highp int;\n\t\t#if (__VERSION__ == 300)\n\t\t\tprecision highp isampler2D;\n\t\t\tprecision highp usampler2D;\n\t\t#endif\n\t#else\n\t\tprecision mediump int;\n\t\t#if (__VERSION__ == 300)\n\t\t\tprecision mediump isampler2D;\n\t\t\tprecision mediump usampler2D;\n\t\t#endif\n\t#endif\n#endif\n#if (").concat(n.GPUIO_FLOAT_PRECISION," == ").concat((0,o.intForPrecision)(n.PRECISION_LOW_P),")\n\tprecision lowp float;\n\tprecision lowp sampler2D;\n#elif (").concat(n.GPUIO_FLOAT_PRECISION," == ").concat((0,o.intForPrecision)(n.PRECISION_MEDIUM_P),")\n\tprecision mediump float;\n\tprecision mediump sampler2D;\n#else\n\t#ifdef GL_FRAGMENT_PRECISION_HIGH\n\t\tprecision highp float;\n\t\tprecision highp sampler2D;\n\t#else\n\t\tprecision mediump float;\n\t\tprecision mediump sampler2D;\n\t#endif\n#endif\n")},651:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_VERT_SHADER_SOURCE=void 0;var n=r(601);t.DEFAULT_VERT_SHADER_SOURCE="\nin vec2 a_gpuio_position;\n#ifdef ".concat(n.GPUIO_VS_UV_ATTRIBUTE,"\n\tin vec2 a_gpuio_uv;\n#endif\n#ifdef ").concat(n.GPUIO_VS_NORMAL_ATTRIBUTE,"\n\tin vec2 a_gpuio_normal;\n#endif\n\nuniform vec2 u_gpuio_scale;\nuniform vec2 u_gpuio_translation;\n\nout vec2 v_uv;\nout vec2 v_uv_local;\n#ifdef ").concat(n.GPUIO_VS_NORMAL_ATTRIBUTE,"\n\tout vec2 v_normal;\n#endif\n\nvoid main() {\n\t// Optional varyings.\n\t#ifdef ").concat(n.GPUIO_VS_UV_ATTRIBUTE,"\n\t\tv_uv_local = a_gpuio_uv;\n\t#else\n\t\tv_uv_local = 0.5 * (a_gpuio_position + 1.0);\n\t#endif\n\t#ifdef ").concat(n.GPUIO_VS_NORMAL_ATTRIBUTE,"\n\t\tv_normal = a_gpuio_normal;\n\t#endif\n\n\t// Apply transformations.\n\tvec2 position = u_gpuio_scale * a_gpuio_position + u_gpuio_translation;\n\n\t// Calculate a global uv for the viewport.\n\tv_uv = 0.5 * (position + 1.0);\n\n\t// Calculate vertex position.\n\tgl_Position = vec4(position, 0, 1);\n}")},567:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LAYER_LINES_VERTEX_SHADER_SOURCE=void 0;var n=r(601),o=r(324);t.LAYER_LINES_VERTEX_SHADER_SOURCE="\n".concat(o.VERTEX_SHADER_HELPERS_SOURCE,"\n\n#if (__VERSION__ != 300 || ").concat(n.GPUIO_VS_INDEXED_POSITIONS," == 1)\n\t// Cannot use int vertex attributes.\n\t// https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/vertexAttribPointer\n\tin float a_gpuio_index;\n#endif\n\nuniform sampler2D u_gpuio_positions; // Texture lookup with position data.\nuniform vec2 u_gpuio_positionsDimensions;\nuniform vec2 u_gpuio_scale;\n\nout vec2 v_uv;\nout vec2 v_lineWrapping; // Use this to test if line is only half wrapped and should not be rendered.\nflat out int v_index;\n\nvoid main() {\n\t// Calculate a uv based on the point's index attribute.\n\t#if (__VERSION__ != 300 || ").concat(n.GPUIO_VS_INDEXED_POSITIONS," == 1)\n\t\tvec2 positionUV = uvFromIndex(a_gpuio_index, u_gpuio_positionsDimensions);\n\t\tv_index = int(a_gpuio_index);\n\t#else\n\t\tvec2 positionUV = uvFromIndex(gl_VertexID, u_gpuio_positionsDimensions);\n\t\tv_index = gl_VertexID;\n\t#endif\n\n\t// Calculate a global uv for the viewport.\n\t// Lookup vertex position and scale to [0, 1] range.\n\t#ifdef ").concat(n.GPUIO_VS_POSITION_W_ACCUM,"\n\t\t// We have packed a 2D displacement with the position.\n\t\tvec4 positionData = texture(u_gpuio_positions, positionUV);\n\t\t// position = first two components plus last two components (optional accumulation buffer).\n\t\tv_uv = (positionData.rg + positionData.ba) * u_gpuio_scale;\n\t#else\n\t\tv_uv = texture(u_gpuio_positions, positionUV).rg * u_gpuio_scale;\n\t#endif\n\n\t// Wrap if needed.\n\tv_lineWrapping = vec2(0.0);\n\t#ifdef ").concat(n.GPUIO_VS_WRAP_X,"\n\t\tv_lineWrapping.x = max(step(1.0, v_uv.x), step(v_uv.x, 0.0));\n\t\tv_ux.x = fract(v_uv.x + 1.0);\n\t#endif\n\t#ifdef ").concat(n.GPUIO_VS_WRAP_Y,"\n\t\tv_lineWrapping.y = max(step(1.0, v_uv.y), step(v_uv.y, 0.0));\n\t\tv_ux.y = fract(v_uv.y + 1.0);\n\t#endif\n\n\t// Calculate position in [-1, 1] range.\n\tvec2 position = v_uv * 2.0 - 1.0;\n\n\tgl_Position = vec4(position, 0, 1);\n}")},380:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LAYER_MESH_VERTEX_SHADER_SOURCE=void 0;var n=r(601),o=r(324);t.LAYER_MESH_VERTEX_SHADER_SOURCE="\n".concat(o.VERTEX_SHADER_HELPERS_SOURCE,"\n\n#if (__VERSION__ != 300)\n\t// Cannot use int vertex attributes.\n\t// https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/vertexAttribPointer\n\tin float a_gpuio_index;\n#endif\n\nuniform sampler2D u_gpuio_positions; // Texture lookup with position data.\nuniform vec2 u_gpuio_positionsDimensions;\nuniform vec2 u_gpuio_scale;\n\nout vec2 v_uv;\nout vec2 v_uv_position;\nout vec2 v_position;\nflat out int v_index;\n\nvoid main() {\n\t// Calculate a uv based on the point's index attribute.\n\t#if (__VERSION__ == 300)\n\t\tv_uv_position = uvFromIndex(gl_VertexID, u_gpuio_positionsDimensions);\n\t\tv_index = gl_VertexID;\n\t#else\n\t\tv_uv_position = uvFromIndex(a_gpuio_index, u_gpuio_positionsDimensions);\n\t\tv_index = int(a_gpuio_index);\n\t#endif\n\n\t// Calculate a global uv for the viewport.\n\t// Lookup vertex position and scale to [0, 1] range.\n\t#ifdef ").concat(n.GPUIO_VS_POSITION_W_ACCUM,"\n\t\t// We have packed a 2D displacement with the position.\n\t\tvec4 positionData = texture(u_gpuio_positions, v_uv_position);\n\t\t// position = first two components plus last two components (optional accumulation buffer).\n\t\tv_position = positionData.rg + positionData.ba;\n\t\tv_uv = v_position * u_gpuio_scale;\n\t#else\n\t\tv_position = texture(u_gpuio_positions, v_uv_position).rg;\n\t\tv_uv = v_position * u_gpuio_scale;\n\t#endif\n\n\t// Calculate position in [-1, 1] range.\n\tvec2 position = v_uv * 2.0 - 1.0;\n\n\tgl_Position = vec4(position, 0, 1);\n}")},929:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LAYER_POINTS_VERTEX_SHADER_SOURCE=void 0;var n=r(601),o=r(324);t.LAYER_POINTS_VERTEX_SHADER_SOURCE="\n".concat(o.VERTEX_SHADER_HELPERS_SOURCE,"\n\n#if (__VERSION__ != 300)\n\t// Cannot use int vertex attributes.\n\t// https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/vertexAttribPointer\n\tin float a_gpuio_index;\n#endif\n\nuniform sampler2D u_gpuio_positions; // Texture lookup with position data.\nuniform vec2 u_gpuio_positionsDimensions;\nuniform vec2 u_gpuio_scale;\nuniform float u_gpuio_pointSize;\n\nout vec2 v_uv;\nout vec2 v_uv_position;\nout vec2 v_position;\nflat out int v_index;\n\nvoid main() {\n\t// Calculate a uv based on the point's index attribute.\n\t#if (__VERSION__ == 300)\n\t\tv_uv_position = uvFromIndex(gl_VertexID, u_gpuio_positionsDimensions);\n\t\tv_index = gl_VertexID;\n\t#else\n\t\tv_uv_position = uvFromIndex(a_gpuio_index, u_gpuio_positionsDimensions);\n\t\tv_index = int(a_gpuio_index);\n\t#endif\n\n\t// Calculate a global uv for the viewport.\n\t// Lookup vertex position and scale to [0, 1] range.\n\t#ifdef ").concat(n.GPUIO_VS_POSITION_W_ACCUM,"\n\t\t// We have packed a 2D displacement with the position.\n\t\tvec4 positionData = texture(u_gpuio_positions, v_uv_position);\n\t\t// position = first two components plus last two components (optional accumulation buffer).\n\t\tv_position = positionData.rg + positionData.ba;\n\t\tv_uv = v_position * u_gpuio_scale;\n\t#else\n\t\tv_position = texture(u_gpuio_positions, v_uv_position).rg;\n\t\tv_uv = v_position * u_gpuio_scale;\n\t#endif\n\n\t// Wrap if needed.\n\t#ifdef ").concat(n.GPUIO_VS_WRAP_X,"\n\t\tv_uv.x = fract(v_uv.x + ceil(abs(v_uv.x)));\n\t#endif\n\t#ifdef ").concat(n.GPUIO_VS_WRAP_Y,"\n\t\tv_uv.y = fract(v_uv.y + ceil(abs(v_uv.y)));\n\t#endif\n\n\t// Calculate position in [-1, 1] range.\n\tvec2 position = v_uv * 2.0 - 1.0;\n\n\tgl_PointSize = u_gpuio_pointSize;\n\tgl_Position = vec4(position, 0, 1);\n}")},634:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LAYER_VECTOR_FIELD_VERTEX_SHADER_SOURCE=void 0;var n=r(324);t.LAYER_VECTOR_FIELD_VERTEX_SHADER_SOURCE="\n".concat(n.VERTEX_SHADER_HELPERS_SOURCE,"\n\n#if (__VERSION__ != 300)\n\t// Cannot use int vertex attributes.\n\t// https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/vertexAttribPointer\n\tin float a_gpuio_index;\n#endif\n\nuniform sampler2D u_gpuio_vectors; // Texture lookup with vector data.\nuniform vec2 u_gpuio_dimensions;\nuniform vec2 u_gpuio_scale;\n\nout vec2 v_uv;\nflat out int v_index;\n\nvoid main() {\n\t#if (__VERSION__ == 300)\n\t\t// Divide index by 2.\n\t\tint index = gl_VertexID / 2;\n\t\tv_index = index;\n\t#else\n\t\t// Divide index by 2.\n\t\tfloat index = floor((a_gpuio_index + 0.5) / 2.0);\n\t\tv_index = int(index);\n\t#endif\n\n\t// Calculate a uv based on the vertex index attribute.\n\tv_uv = uvFromIndex(index, u_gpuio_dimensions);\n\t#if (__VERSION__ == 300)\n\t\t// Add vector displacement if needed.\n\t\tv_uv += float(gl_VertexID - 2 * index) * texture(u_gpuio_vectors, v_uv).xy * u_gpuio_scale;\n\t#else\n\t\t// Add vector displacement if needed.\n\t\tv_uv += (a_gpuio_index - 2.0 * index) * texture(u_gpuio_vectors, v_uv).xy * u_gpuio_scale;\n\t#endif\n\n\n\t// Calculate position in [-1, 1] range.\n\tvec2 position = v_uv * 2.0 - 1.0;\n\n\tgl_Position = vec4(position, 0, 1);\n}")},946:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SEGMENT_VERTEX_SHADER_SOURCE=void 0,t.SEGMENT_VERTEX_SHADER_SOURCE="\nin vec2 a_gpuio_position;\n\nuniform float u_gpuio_halfThickness;\nuniform vec2 u_gpuio_scale;\nuniform float u_gpuio_length;\nuniform float u_gpuio_rotation;\nuniform vec2 u_gpuio_translation;\n\nout vec2 v_uv_local;\nout vec2 v_uv;\n\nmat2 rotate2d(float _angle){\n\treturn mat2(cos(_angle), -sin(_angle), sin(_angle), cos(_angle));\n}\n\nvoid main() {\n\t// Calculate UV coordinates of current rendered object.\n\tv_uv_local = 0.5 * (a_gpuio_position + 1.0);\n\n\tvec2 position = a_gpuio_position;\n\t// Apply thickness / radius.\n\tposition *= u_gpuio_halfThickness;\n\t// Stretch center of shape to form a round-capped line segment.\n\tfloat signX = sign(position.x);\n\tposition.x += signX * u_gpuio_length / 2.0;\n\tv_uv_local.x = (signX + 1.0) / 2.0;// Set entire cap uv.x to 1 or 0.\n\t// Apply transformations.\n\tposition = u_gpuio_scale * (rotate2d(-u_gpuio_rotation) * position) + u_gpuio_translation;\n\n\t// Calculate a global uv for the viewport.\n\tv_uv = 0.5 * (position + 1.0);\n\n\t// Calculate vertex position.\n\tgl_Position = vec4(position, 0, 1);\n}"},324:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VERTEX_SHADER_HELPERS_SOURCE=void 0,t.VERTEX_SHADER_HELPERS_SOURCE='\n/**\n * Create UV coordinates from a 1D index for data stored in a texture of size "dimensions".\n */\nvec2 uvFromIndex(const float index, const vec2 dimensions) {\n\tfloat y = floor((index + 0.5) / dimensions.x);\n\tfloat x = floor(index - y * dimensions.x + 0.5);\n\treturn vec2(x + 0.5, y + 0.5) / dimensions;\n}\nvec2 uvFromIndex(const int index, const vec2 dimensions) {\n int width = int(dimensions.x);\n int y = index / width;\n\tint x = index - y * width;\n return vec2(float(x) + 0.5, float(y) + 0.5) / dimensions;\n}\nvec2 uvFromIndex(const float index, const ivec2 dimensions) {\n\tfloat width = float(dimensions.x);\n float y = floor((index + 0.5) / width);\n\tfloat x = floor(index - y * width + 0.5);\n return vec2(x + 0.5, y + 0.5) / vec2(dimensions);\n}\nvec2 uvFromIndex(const int index, const ivec2 dimensions) {\n int y = index / dimensions.x;\n\tint x = index - y * dimensions.x;\n return vec2(float(x) + 0.5, float(y) + 0.5) / vec2(dimensions);\n}'},607:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fragmentShaderPolyfills=t.GLSL1Polyfills=t.texturePolyfill=t.SAMPLER2D_DIMENSIONS_UNIFORM=t.SAMPLER2D_HALF_PX_UNIFORM=t.SAMPLER2D_FILTER=t.SAMPLER2D_CAST_INT=t.SAMPLER2D_WRAP_Y=t.SAMPLER2D_WRAP_X=void 0;var n=r(601),o=r(126);function i(e){switch(e){case"int":case"uint":return"float";case"ivec2":case"uvec2":return"vec2";case"ivec3":case"uvec3":return"vec3";case"ivec4":case"uvec4":return"vec4"}throw new Error("Unknown type ".concat(e,"."))}function a(e){return"".concat(e," abs(const ").concat(e," a) { return ").concat(e,"(abs(").concat(i(e),"(a))); }")}function c(e){return"".concat(e," sign(const ").concat(e," a) { return ").concat(e,"(sign(").concat(i(e),"(a))); }")}function s(e){return"".concat(e," trunc(const ").concat(e," a) { return round(a - fract(a) * sign(a)); }")}function u(e){return"".concat(e," round(const ").concat(e," a) { return floor(a + 0.5); }")}function l(e){return"".concat(e," roundEven(const ").concat(e," a) { return 2.0 * round(a / 2.0); }")}function _(e,t){return"".concat(e," min(const ").concat(e," a, const ").concat(t," b) { return ").concat(e,"(min(").concat(i(e),"(a), ").concat(i(t),"(b))); }")}function p(e,t){return"".concat(e," max(const ").concat(e," a, const ").concat(t," b) { return ").concat(e,"(max(").concat(i(e),"(a), ").concat(i(t),"(b))); }")}function f(e,t){return"".concat(e," clamp(const ").concat(e," a, const ").concat(t," min, const ").concat(t," max) { return ").concat(e,"(clamp(").concat(i(e),"(a), ").concat(i(t),"(min), ").concat(i(t),"(max))); }")}function d(e,t){return"".concat(e," mix(const ").concat(e," a, const ").concat(e," b, const ").concat(t," c) { return mix(a, b, ").concat(function(e){switch(e){case"bool":return"float";case"bvec2":return"vec2";case"bvec3":return"vec3";case"bvec4":return"vec4"}throw new Error("Unknown type ".concat(e,"."))}(t),"(c)); }")}function h(e,t,r){return"a[".concat(e,"][").concat(t,"] * a[").concat((e+1)%r,"][").concat((t+1)%r,"] - a[").concat((e+1)%r,"][").concat(t,"] * a[").concat(e,"][").concat((t+1)%r,"]")}function m(e,t,r){return[0,1,2].map((function(n){return"a[".concat(e,"][").concat((t+n)%r,"] * (").concat(h((e+1)%r,(t+1+n)%r,r),")")})).join(" + ")}function g(e,t){return"".concat(e," modi(const ").concat(e," x, const ").concat(t," y) { return x - y * (x / y); }")}function y(e,t){return"".concat(t," stepi(const ").concat(e," x, const ").concat(t," y) { return ").concat(t,"(step(").concat(i(e),"(x), ").concat(i(t),"(y))); }")}function v(e,t){return"".concat(e," bitshiftLeft(const ").concat(e," a, const ").concat(t," b) {\n\t#if (__VERSION__ == 300)\n\t\treturn a << b;\n\t#else\n\t\treturn a * ").concat(e,"(pow(").concat(i(t),"(2.0), ").concat(i(t),"(b)));\n\t#endif\n}")}function T(e,t){return"".concat(e," bitshiftRight(const ").concat(e," a, const ").concat(t," b) {\n\t#if (__VERSION__ == 300)\n\t\treturn a >> b;\n\t#else\n\t\treturn ").concat(e,"(round(").concat(i(e),"(a) / pow(").concat(i(t),"(2.0), ").concat(i(t),"(b))));\n\t#endif\n}")}function E(e){return"int bitwiseOr".concat(32===e?"":e,"(int a, int b) {\n\t#if (__VERSION__ == 300)\n\t\treturn a | b;\n\t#else\n\t\tint result = 0;\n\t\tint n = 1;\n\t\t\n\t\tfor (int i = 0; i < ").concat(e,"; i++) {\n\t\t\tif ((modi(a, 2) == 1) || (modi(b, 2) == 1)) {\n\t\t\t\tresult += n;\n\t\t\t}\n\t\t\ta = a / 2;\n\t\t\tb = b / 2;\n\t\t\tn = n * 2;\n\t\t\tif(!(a > 0 || b > 0)) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t#endif\n}")}function A(e){return"int bitwiseXOR".concat(32===e?"":e,"(int a, int b) {\n\t#if (__VERSION__ == 300)\n\t\treturn a ^ b;\n\t#else\n\t\tint result = 0;\n\t\tint n = 1;\n\t\t\n\t\tfor (int i = 0; i < ").concat(e,"; i++) {\n\t\t\tif ((modi(a, 2) == 1) != (modi(b, 2) == 1)) {\n\t\t\t\tresult += n;\n\t\t\t}\n\t\t\ta = a / 2;\n\t\t\tb = b / 2;\n\t\t\tn = n * 2;\n\t\t\tif(!(a > 0 || b > 0)) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t#endif\n}")}function O(e){return"int bitwiseAnd".concat(32===e?"":e,"(int a, int b) {\n\t#if (__VERSION__ == 300)\n\t\treturn a & b;\n\t#else\n\t\tint result = 0;\n\t\tint n = 1;\n\t\tfor (int i = 0; i < ").concat(e,"; i++) {\n\t\t\tif ((modi(a, 2) == 1) && (modi(b, 2) == 1)) {\n\t\t\t\tresult += n;\n\t\t\t}\n\t\t\ta = a / 2;\n\t\t\tb = b / 2;\n\t\t\tn = n * 2;\n\t\t\tif(!(a > 0 && b > 0)) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t#endif\n}")}function I(e){return"int bitwiseNot".concat(32===e?"":e,"(int a) {\n\t#if (__VERSION__ == 300)\n\t\treturn ~a;\n\t#else\n\t\tint result = 0;\n\t\tint n = 1;\n\n\t\tfor (int i = 0; i < ").concat(e,"; i++) {\n\t\t\tif (modi(a, 2) == 0) {\n\t\t\t\tresult += n;\n\t\t\t}\n\t\t\ta = a / 2;\n\t\t\tn = n * 2;\n\t\t}\n\t\treturn result;\n\t#endif\n}")}t.SAMPLER2D_WRAP_X="GPUIO_WRAP_X",t.SAMPLER2D_WRAP_Y="GPUIO_WRAP_Y",t.SAMPLER2D_CAST_INT="GPUIO_CAST_INT",t.SAMPLER2D_FILTER="GPUIO_FILTER",t.SAMPLER2D_HALF_PX_UNIFORM="u_gpuio_half_px",t.SAMPLER2D_DIMENSIONS_UNIFORM="u_gpuio_dimensions",t.texturePolyfill=function(e){var r=e.match(/\btexture\(/g);if(!r||0===r.length)return{shaderSource:e,samplerUniforms:[]};var n=(0,o.getSampler2DsInProgram)(e);if(0===n.length)return{shaderSource:e,samplerUniforms:n};n.forEach((function(t,r){var n=new RegExp("\\btexture(2D)?\\(\\s?".concat(t,"\\b"),"gs");e=e.replace(n,"GPUIO_TEXTURE_POLYFILL".concat(r,"(").concat(t))}));var i=e.match(/\btexture(2D)?\(/g);(null==i?void 0:i.length)&&console.warn("Fragment shader polyfill has missed some calls to texture().",e);for(var a={},c=0;c{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSampler2DsInProgram=t.stripComments=t.stripPrecision=t.stripVersion=t.highpToMediump=t.glsl1Uint=t.glsl1Sampler2D=t.glsl1Texture=t.checkFragmentShaderForFragColor=t.glsl1FragmentOut=t.getFragmentOuts=t.glsl1FragmentIn=t.glsl1VertexOut=t.castVaryingToFloat=t.glsl1VertexIn=void 0;var n=r(601);function o(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function i(e,t,r){var n=new RegExp("\\b".concat(o(t),"\\s*=\\s*\\S[^;]*;"),"sg"),i=e.match(n);if(i)for(var a=0;an&&(n=d),r[f]={location:d,type:h};e=e.replace(o[0],"")}}t.glsl1VertexIn=function(e){return e.replace(/\bin\b/g,"attribute")},t.castVaryingToFloat=c,t.glsl1VertexOut=function(e){return e=c(e=e.replace(/(\bflat\s+)?\bout\b/g,"varying"))},t.glsl1FragmentIn=function(e){return e=c(e=e.replace(/(\bflat\s+)?\bin\b/g,"varying"))},t.getFragmentOuts=s,t.glsl1FragmentOut=function(e,t){var r=s(e,t);if(0===r.length)return[e];e=e.replace(/\blayout\s*\(\s*location\s*=\s*([0-9]+)\s*\)\s*/g,"");for(var n=[],o=0,i=r.length;o0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]16;_.mediumpVertexPrecision=s?a.PRECISION_MEDIUM_P:a.PRECISION_HIGH_P}return _.mediumpVertexPrecision},t.getFragmentShaderMediumpPrecision=function(){if(void 0===_.mediumpFragmentPrecision){var e=document.createElement("canvas").getContext("webgl");if(!e)throw new Error("Unable to init webgl context.");var t=m(e,a.GLSL1,a.PRECISION_MEDIUM_P,a.PRECISION_MEDIUM_P,"\n\tattribute vec4 position; // needed because of another bug in Safari\n\tvoid main() {\n\t\tgl_Position = position;\n\t\tgl_PointSize = 1.0;\n\t}\n\t\t",e.VERTEX_SHADER,"mediumpPrecisionFragmentTest",a.DEFAULT_ERROR_CALLBACK);if(!t)throw new Error("Unable to init vertex shader.");var r=m(e,a.GLSL1,a.PRECISION_MEDIUM_P,a.PRECISION_MEDIUM_P,"\n\tuniform mediump vec3 v;\n\tvoid main() {\n\t\tgl_FragColor = vec4(normalize(v) * 0.5 + 0.5, 1);\n\t}\n\t\t",e.FRAGMENT_SHADER,"mediumpPrecisionFragmentTest",a.DEFAULT_ERROR_CALLBACK);if(!r)throw new Error("Unable to init fragment shader.");var n=Math.pow(2,31)-1,o=Math.sqrt(n),i=255*(o/Math.sqrt(o*o*3)*.5+.5)|0,c=A("mediumpPrecisionFragmentTest",e,r,t,(function(t){var r=e.getUniformLocation(t,"v");e.uniform3f(r,o,o,o)})),s=Math.abs(c[0]-i)>16;_.mediumpFragmentPrecision=s?a.PRECISION_MEDIUM_P:a.PRECISION_HIGH_P}return _.mediumpFragmentPrecision},t.isPowerOf2=function(e){return e>0&&0==(e&e-1)},t.initSequentialFloatArray=function(e){for(var t=new Float32Array(e),r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getFloat16=function(e,t,...r){return(0,o.convertToNumber)((0,i.DataViewPrototypeGetUint16)(e,t,...(0,n.safeIfNeeded)(r)))},t.setFloat16=function(e,t,r,...a){return(0,i.DataViewPrototypeSetUint16)(e,t,(0,o.roundToFloat16Bits)(r),...(0,n.safeIfNeeded)(a))};var n=r(802),o=r(605),i=r(983)},310:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isFloat16Array=_;var n=r(802),o=r(299),i=r(605),a=r(554),c=r(930),s=r(983),u=r(700);const l=new s.NativeWeakMap;function _(e){return(0,s.WeakMapPrototypeHas)(l,e)||!(0,s.ArrayBufferIsView)(e)&&(0,o.hasFloat16ArrayBrand)(e)}function p(e){if(!_(e))throw(0,s.NativeTypeError)(c.THIS_IS_NOT_A_FLOAT16ARRAY_OBJECT)}function f(e,t){const r=_(e),n=(0,a.isNativeTypedArray)(e);if(!r&&!n)throw(0,s.NativeTypeError)(c.SPECIES_CONSTRUCTOR_DIDNT_RETURN_TYPEDARRAY_OBJECT);if("number"==typeof t){let n;if(r){const t=d(e);n=(0,s.TypedArrayPrototypeGetLength)(t)}else n=(0,s.TypedArrayPrototypeGetLength)(e);if(n(0,a.isCanonicalIntegerIndexString)(t)&&(0,s.ObjectHasOwn)(e,t)?(0,i.convertToNumber)((0,s.ReflectGet)(e,t)):(0,s.WeakSetPrototypeHas)(m,(0,s.ObjectPrototype__lookupGetter__)(e,t))?(0,s.ReflectGet)(e,t):(0,s.ReflectGet)(e,t,r),set:(e,t,r,n)=>(0,a.isCanonicalIntegerIndexString)(t)&&(0,s.ObjectHasOwn)(e,t)?(0,s.ReflectSet)(e,t,(0,i.roundToFloat16Bits)(r)):(0,s.ReflectSet)(e,t,r,n),getOwnPropertyDescriptor(e,t){if((0,a.isCanonicalIntegerIndexString)(t)&&(0,s.ObjectHasOwn)(e,t)){const r=(0,s.ReflectGetOwnPropertyDescriptor)(e,t);return r.value=(0,i.convertToNumber)(r.value),r}return(0,s.ReflectGetOwnPropertyDescriptor)(e,t)},defineProperty:(e,t,r)=>(0,a.isCanonicalIntegerIndexString)(t)&&(0,s.ObjectHasOwn)(e,t)&&(0,s.ObjectHasOwn)(r,"value")?(r.value=(0,i.roundToFloat16Bits)(r.value),(0,s.ReflectDefineProperty)(e,t,r)):(0,s.ReflectDefineProperty)(e,t,r)});class y{constructor(e,t,r){let n;if(_(e))n=(0,s.ReflectConstruct)(s.NativeUint16Array,[d(e)],new.target);else if((0,a.isObject)(e)&&!(0,a.isArrayBuffer)(e)){let t,r;if((0,a.isNativeTypedArray)(e)){t=e,r=(0,s.TypedArrayPrototypeGetLength)(e);const o=(0,s.TypedArrayPrototypeGetBuffer)(e),i=(0,a.isSharedArrayBuffer)(o)?s.NativeArrayBuffer:(0,u.SpeciesConstructor)(o,s.NativeArrayBuffer);if((0,u.IsDetachedBuffer)(o))throw(0,s.NativeTypeError)(c.ATTEMPTING_TO_ACCESS_DETACHED_ARRAYBUFFER);if((0,a.isNativeBigIntTypedArray)(e))throw(0,s.NativeTypeError)(c.CANNOT_MIX_BIGINT_AND_OTHER_TYPES);const l=new i(2*r);n=(0,s.ReflectConstruct)(s.NativeUint16Array,[l],new.target)}else{const o=e[s.SymbolIterator];if(null!=o&&"function"!=typeof o)throw(0,s.NativeTypeError)(c.ITERATOR_PROPERTY_IS_NOT_CALLABLE);null!=o?(0,a.isOrdinaryArray)(e)?(t=e,r=e.length):(t=[...e],r=t.length):(t=e,r=(0,u.ToLength)(t.length)),n=(0,s.ReflectConstruct)(s.NativeUint16Array,[r],new.target)}for(let e=0;e=0?n:r+n;if(!(o<0||o>=r))return(0,i.convertToNumber)(t[o])}map(e,...t){p(this);const r=d(this),n=(0,s.TypedArrayPrototypeGetLength)(r),o=t[0],a=(0,u.SpeciesConstructor)(r,y);if(a===y){const t=new y(n),a=d(t);for(let t=0;t=0;--t)o=e(o,(0,i.convertToNumber)(r[t]),t,this);return o}forEach(e,...t){p(this);const r=d(this),n=(0,s.TypedArrayPrototypeGetLength)(r),o=t[0];for(let t=0;t=0;--t){const n=(0,i.convertToNumber)(r[t]);if((0,s.ReflectApply)(e,o,[n,t,this]))return n}}findLastIndex(e,...t){p(this);const r=d(this),n=(0,s.TypedArrayPrototypeGetLength)(r),o=t[0];for(let t=n-1;t>=0;--t){const n=(0,i.convertToNumber)(r[t]);if((0,s.ReflectApply)(e,o,[n,t,this]))return t}return-1}every(e,...t){p(this);const r=d(this),n=(0,s.TypedArrayPrototypeGetLength)(r),o=t[0];for(let t=0;to)throw(0,s.NativeRangeError)(c.OFFSET_IS_OUT_OF_BOUNDS);for(let e=0;er((0,i.convertToNumber)(e),(0,i.convertToNumber)(t)))),this}slice(e,t){p(this);const r=d(this),n=(0,u.SpeciesConstructor)(r,y);if(n===y){const n=new s.NativeUint16Array((0,s.TypedArrayPrototypeGetBuffer)(r),(0,s.TypedArrayPrototypeGetByteOffset)(r),(0,s.TypedArrayPrototypeGetLength)(r));return new y((0,s.TypedArrayPrototypeGetBuffer)((0,s.TypedArrayPrototypeSlice)(n,e,t)))}const o=(0,s.TypedArrayPrototypeGetLength)(r),a=(0,u.ToIntegerOrInfinity)(e),l=void 0===t?o:(0,u.ToIntegerOrInfinity)(t);let _,h;_=a===-1/0?0:a<0?o+a>0?o+a:0:o0?o+l:0:o0?h-_:0,g=new n(m);if(f(g,m),0===m)return g;const v=(0,s.TypedArrayPrototypeGetBuffer)(r);if((0,u.IsDetachedBuffer)(v))throw(0,s.NativeTypeError)(c.ATTEMPTING_TO_ACCESS_DETACHED_ARRAYBUFFER);let T=0;for(;_=1?(0,u.ToIntegerOrInfinity)(t[0]):n-1;if(o===-1/0)return-1;o>=0?o=o=0;--t)if((0,s.ObjectHasOwn)(r,t)&&(0,i.convertToNumber)(r[t])===e)return t;return-1}includes(e,...t){p(this);const r=d(this),n=(0,s.TypedArrayPrototypeGetLength)(r);let o=(0,u.ToIntegerOrInfinity)(t[0]);if(o===1/0)return!1;o<0&&(o+=n,o<0&&(o=0));const a=(0,s.NumberIsNaN)(e);for(let t=o;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.safeIfNeeded=function(e){if(e[n.SymbolIterator]===n.NativeArrayPrototypeSymbolIterator)return e;const t=(0,n.ObjectCreate)(i);return(0,n.WeakMapPrototypeSet)(o,t,(0,n.ArrayPrototypeSymbolIterator)(e)),t},t.wrap=function(e){const t=(0,n.ObjectCreate)(c);return(0,n.WeakMapPrototypeSet)(a,t,e),t};var n=r(983);const o=new n.NativeWeakMap,i=(0,n.ObjectCreate)(null,{next:{value:function(){const e=(0,n.WeakMapPrototypeGet)(o,this);return(0,n.ArrayIteratorPrototypeNext)(e)}},[n.SymbolIterator]:{value:function(){return this}}});const a=new n.NativeWeakMap,c=(0,n.ObjectCreate)(n.IteratorPrototype,{next:{value:function(){const e=(0,n.WeakMapPrototypeGet)(a,this);return(0,n.GeneratorPrototypeNext)(e)},writable:!0,configurable:!0}});for(const e of(0,n.ReflectOwnKeys)(n.ArrayIteratorPrototype))"next"!==e&&(0,n.ObjectDefineProperty)(c,e,(0,n.ReflectGetOwnPropertyDescriptor)(n.ArrayIteratorPrototype,e))},299:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.hasFloat16ArrayBrand=function(e){if(!(0,n.isObjectLike)(e))return!1;const t=(0,i.ReflectGetPrototypeOf)(e);if(!(0,n.isObjectLike)(t))return!1;const r=t.constructor;if(void 0===r)return!1;if(!(0,n.isObject)(r))throw(0,i.NativeTypeError)(o.THE_CONSTRUCTOR_PROPERTY_VALUE_IS_NOT_AN_OBJECT);return(0,i.ReflectHas)(r,a)};var n=r(554),o=r(930),i=r(983);const a=(0,i.SymbolFor)("__Float16Array__");t.brand=a},605:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.convertToNumber=function(e){const t=e>>10;return a[0]=u[_[t]+(1023&e)]+l[t],i[0]},t.roundToFloat16Bits=function(e){i[0]=e;const t=a[0],r=t>>23&511;return c[r]+((8388607&t)>>s[r])};var n=r(983);const o=new n.NativeArrayBuffer(4),i=new n.NativeFloat32Array(o),a=new n.NativeUint32Array(o),c=new n.NativeUint32Array(512),s=new n.NativeUint32Array(512);for(let e=0;e<256;++e){const t=e-127;t<-27?(c[e]=0,c[256|e]=32768,s[e]=24,s[256|e]=24):t<-14?(c[e]=1024>>-t-14,c[256|e]=1024>>-t-14|32768,s[e]=-t-1,s[256|e]=-t-1):t<=15?(c[e]=t+15<<10,c[256|e]=t+15<<10|32768,s[e]=13,s[256|e]=13):t<128?(c[e]=31744,c[256|e]=64512,s[e]=24,s[256|e]=24):(c[e]=31744,c[256|e]=64512,s[e]=13,s[256|e]=13)}const u=new n.NativeUint32Array(2048),l=new n.NativeUint32Array(64),_=new n.NativeUint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,r=0;for(;0==(8388608&t);)t<<=1,r-=8388608;t&=-8388609,r+=947912704,u[e]=t|r}for(let e=1024;e<2048;++e)u[e]=939524096+(e-1024<<13);for(let e=1;e<31;++e)l[e]=e<<23;l[31]=1199570944,l[32]=2147483648;for(let e=33;e<63;++e)l[e]=2147483648+(e-32<<23);l[63]=3347054592;for(let e=1;e<64;++e)32!==e&&(_[e]=1024)},554:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isArrayBuffer=function(e){try{return(0,n.ArrayBufferPrototypeGetByteLength)(e),!0}catch(e){return!1}},t.isCanonicalIntegerIndexString=function(e){if("string"!=typeof e)return!1;const t=+e;if(e!==t+"")return!1;if(!(0,n.NumberIsFinite)(t))return!1;return t===(0,n.MathTrunc)(t)},t.isNativeBigIntTypedArray=function(e){const t=(0,n.TypedArrayPrototypeGetSymbolToStringTag)(e);return"BigInt64Array"===t||"BigUint64Array"===t},t.isNativeTypedArray=o,t.isObject=function(e){return null!==e&&"object"==typeof e||"function"==typeof e},t.isObjectLike=function(e){return null!==e&&"object"==typeof e},t.isOrdinaryArray=function(e){if(!(0,n.ArrayIsArray)(e))return!1;if(e[n.SymbolIterator]===n.NativeArrayPrototypeSymbolIterator)return!0;return"Array Iterator"===e[n.SymbolIterator]()[n.SymbolToStringTag]},t.isOrdinaryNativeTypedArray=function(e){if(!o(e))return!1;if(e[n.SymbolIterator]===n.NativeTypedArrayPrototypeSymbolIterator)return!0;return"Array Iterator"===e[n.SymbolIterator]()[n.SymbolToStringTag]},t.isSharedArrayBuffer=function(e){if(null===n.NativeSharedArrayBuffer)return!1;try{return(0,n.SharedArrayBufferPrototypeGetByteLength)(e),!0}catch(e){return!1}};var n=r(983);function o(e){return void 0!==(0,n.TypedArrayPrototypeGetSymbolToStringTag)(e)}},930:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.THIS_IS_NOT_AN_OBJECT="This is not an object";t.THIS_IS_NOT_A_FLOAT16ARRAY_OBJECT="This is not a Float16Array object";t.THIS_CONSTRUCTOR_IS_NOT_A_SUBCLASS_OF_FLOAT16ARRAY="This constructor is not a subclass of Float16Array";t.THE_CONSTRUCTOR_PROPERTY_VALUE_IS_NOT_AN_OBJECT="The constructor property value is not an object";t.SPECIES_CONSTRUCTOR_DIDNT_RETURN_TYPEDARRAY_OBJECT="Species constructor didn't return TypedArray object";t.DERIVED_CONSTRUCTOR_CREATED_TYPEDARRAY_OBJECT_WHICH_WAS_TOO_SMALL_LENGTH="Derived constructor created TypedArray object which was too small length";t.ATTEMPTING_TO_ACCESS_DETACHED_ARRAYBUFFER="Attempting to access detached ArrayBuffer";t.CANNOT_CONVERT_UNDEFINED_OR_NULL_TO_OBJECT="Cannot convert undefined or null to object";t.CANNOT_MIX_BIGINT_AND_OTHER_TYPES="Cannot mix BigInt and other types, use explicit conversions";t.ITERATOR_PROPERTY_IS_NOT_CALLABLE="@@iterator property is not callable";t.REDUCE_OF_EMPTY_ARRAY_WITH_NO_INITIAL_VALUE="Reduce of empty array with no initial value";t.OFFSET_IS_OUT_OF_BOUNDS="Offset is out of bounds"},983:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(930);function o(e){return(t,...r)=>a(e,t,r)}function i(e,t){return o(l(e,t).get)}const{apply:a,construct:c,defineProperty:s,get:u,getOwnPropertyDescriptor:l,getPrototypeOf:_,has:p,ownKeys:f,set:d,setPrototypeOf:h}=Reflect;t.ReflectSetPrototypeOf=h,t.ReflectSet=d,t.ReflectOwnKeys=f,t.ReflectHas=p,t.ReflectGetPrototypeOf=_,t.ReflectGetOwnPropertyDescriptor=l,t.ReflectGet=u,t.ReflectDefineProperty=s,t.ReflectConstruct=c,t.ReflectApply=a;const m=Proxy;t.NativeProxy=m;const{MAX_SAFE_INTEGER:g,isFinite:y,isNaN:v}=Number;t.NumberIsNaN=v,t.NumberIsFinite=y,t.MAX_SAFE_INTEGER=g;const{iterator:T,species:E,toStringTag:A,for:O}=Symbol;t.SymbolFor=O,t.SymbolToStringTag=A,t.SymbolSpecies=E,t.SymbolIterator=T;const I=Object;t.NativeObject=I;const{create:P,defineProperty:R,freeze:N,is:S}=I;t.ObjectIs=S,t.ObjectFreeze=N,t.ObjectDefineProperty=R,t.ObjectCreate=P;const b=I.prototype,L=b.__lookupGetter__?o(b.__lookupGetter__):(e,t)=>{if(null==e)throw Ae(n.CANNOT_CONVERT_UNDEFINED_OR_NULL_TO_OBJECT);let r=I(e);do{const e=l(r,t);if(void 0!==e)return U(e,"get")?e.get:void 0}while(null!==(r=_(r)))};t.ObjectPrototype__lookupGetter__=L;const U=I.hasOwn||o(b.hasOwnProperty);t.ObjectHasOwn=U;const F=Array,w=F.isArray;t.ArrayIsArray=w;const G=F.prototype,x=o(G.join);t.ArrayPrototypeJoin=x;const D=o(G.push);t.ArrayPrototypePush=D;const M=o(G.toLocaleString);t.ArrayPrototypeToLocaleString=M;const C=G[T];t.NativeArrayPrototypeSymbolIterator=C;const B=o(C);t.ArrayPrototypeSymbolIterator=B;const V=Math.trunc;t.MathTrunc=V;const k=ArrayBuffer;t.NativeArrayBuffer=k;const H=k.isView;t.ArrayBufferIsView=H;const W=k.prototype,X=o(W.slice);t.ArrayBufferPrototypeSlice=X;const j=i(W,"byteLength");t.ArrayBufferPrototypeGetByteLength=j;const Y="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:null;t.NativeSharedArrayBuffer=Y;const K=Y&&i(Y.prototype,"byteLength");t.SharedArrayBufferPrototypeGetByteLength=K;const z=_(Uint8Array);t.TypedArray=z;const J=z.from,q=z.prototype;t.TypedArrayPrototype=q;const Z=q[T];t.NativeTypedArrayPrototypeSymbolIterator=Z;const Q=o(q.keys);t.TypedArrayPrototypeKeys=Q;const $=o(q.values);t.TypedArrayPrototypeValues=$;const ee=o(q.entries);t.TypedArrayPrototypeEntries=ee;const te=o(q.set);t.TypedArrayPrototypeSet=te;const re=o(q.reverse);t.TypedArrayPrototypeReverse=re;const ne=o(q.fill);t.TypedArrayPrototypeFill=ne;const oe=o(q.copyWithin);t.TypedArrayPrototypeCopyWithin=oe;const ie=o(q.sort);t.TypedArrayPrototypeSort=ie;const ae=o(q.slice);t.TypedArrayPrototypeSlice=ae;const ce=o(q.subarray);t.TypedArrayPrototypeSubarray=ce;const se=i(q,"buffer");t.TypedArrayPrototypeGetBuffer=se;const ue=i(q,"byteOffset");t.TypedArrayPrototypeGetByteOffset=ue;const le=i(q,"length");t.TypedArrayPrototypeGetLength=le;const _e=i(q,A);t.TypedArrayPrototypeGetSymbolToStringTag=_e;const pe=Uint16Array;t.NativeUint16Array=pe;t.Uint16ArrayFrom=(...e)=>a(J,pe,e);const fe=Uint32Array;t.NativeUint32Array=fe;const de=Float32Array;t.NativeFloat32Array=de;const he=_([][T]());t.ArrayIteratorPrototype=he;const me=o(he.next);t.ArrayIteratorPrototypeNext=me;const ge=o(function*(){}().next);t.GeneratorPrototypeNext=ge;const ye=_(he);t.IteratorPrototype=ye;const ve=DataView.prototype,Te=o(ve.getUint16);t.DataViewPrototypeGetUint16=Te;const Ee=o(ve.setUint16);t.DataViewPrototypeSetUint16=Ee;const Ae=TypeError;t.NativeTypeError=Ae;const Oe=RangeError;t.NativeRangeError=Oe;const Ie=WeakSet;t.NativeWeakSet=Ie;const Pe=Ie.prototype,Re=o(Pe.add);t.WeakSetPrototypeAdd=Re;const Ne=o(Pe.has);t.WeakSetPrototypeHas=Ne;const Se=WeakMap;t.NativeWeakMap=Se;const be=Se.prototype,Le=o(be.get);t.WeakMapPrototypeGet=Le;const Ue=o(be.has);t.WeakMapPrototypeHas=Ue;const Fe=o(be.set);t.WeakMapPrototypeSet=Fe},700:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IsDetachedBuffer=function(e){if((0,n.isSharedArrayBuffer)(e))return!1;try{return(0,i.ArrayBufferPrototypeSlice)(e,0,0),!1}catch(e){}return!0},t.SpeciesConstructor=function(e,t){if(!(0,n.isObject)(e))throw(0,i.NativeTypeError)(o.THIS_IS_NOT_AN_OBJECT);const r=e.constructor;if(void 0===r)return t;if(!(0,n.isObject)(r))throw(0,i.NativeTypeError)(o.THE_CONSTRUCTOR_PROPERTY_VALUE_IS_NOT_AN_OBJECT);const a=r[i.SymbolSpecies];if(null==a)return t;return a},t.ToIntegerOrInfinity=a,t.ToLength=function(e){const t=a(e);if(t<0)return 0;return tt)return 1;if(0===e&&0===t){const r=(0,i.ObjectIs)(e,0),n=(0,i.ObjectIs)(t,0);if(!r&&n)return-1;if(r&&!n)return 1}return 0};var n=r(554),o=r(930),i=r(983);function a(e){const t=+e;return(0,i.NumberIsNaN)(t)||0===t?0:(0,i.MathTrunc)(t)}},216:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.hfround=function(e){const t=+e;if(!(0,o.NumberIsFinite)(t)||0===t)return t;const r=(0,n.roundToFloat16Bits)(t);return(0,n.convertToNumber)(r)};var n=r(605),o=r(983)},650:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(310);t.Float16Array=n.Float16Array,t.isFloat16Array=n.isFloat16Array;var o=r(146);t.isTypedArray=o.isTypedArray;var i=r(557);t.getFloat16=i.getFloat16,t.setFloat16=i.setFloat16;var a=r(216);t.hfround=a.hfround},146:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isTypedArray=function(e){return(0,o.isNativeTypedArray)(e)||(0,n.isFloat16Array)(e)};var n=r(310),o=r(554)}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,r),i.exports}return r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r(607)})())); \ No newline at end of file diff --git a/mounts/zoperepo/__root__/lib/js/highlight.min.js/__meta__ b/mounts/zoperepo/__root__/lib/js/highlight.min.js/__meta__ new file mode 100644 index 0000000..a6dd2eb --- /dev/null +++ b/mounts/zoperepo/__root__/lib/js/highlight.min.js/__meta__ @@ -0,0 +1,8 @@ +[ + ('owner', (['acl_users'], 'dockerzope')), + ('props', [ + [('id', 'content_type'), ('type', 'string'), ('value', 'text/javascript')], + ]), + ('title', 'highlight.min.js'), + ('type', 'File'), +] diff --git a/mounts/zoperepo/__root__/lib/js/highlight.min.js/__source__.js b/mounts/zoperepo/__root__/lib/js/highlight.min.js/__source__.js new file mode 100644 index 0000000..d386671 --- /dev/null +++ b/mounts/zoperepo/__root__/lib/js/highlight.min.js/__source__.js @@ -0,0 +1,388 @@ +/*! + Highlight.js v11.9.0 (git: b7ec4bfafc) + (c) 2006-2024 undefined and other contributors + License: BSD-3-Clause + */ +var hljs=function(){"use strict";function e(t){ +return t instanceof Map?t.clear=t.delete=t.set=()=>{ +throw Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=()=>{ +throw Error("set is read-only") +}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach((n=>{ +const i=t[n],s=typeof i;"object"!==s&&"function"!==s||Object.isFrozen(i)||e(i) +})),t}class t{constructor(e){ +void 0===e.data&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1} +ignoreMatch(){this.isMatchIgnored=!0}}function n(e){ +return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'") +}function i(e,...t){const n=Object.create(null);for(const t in e)n[t]=e[t] +;return t.forEach((e=>{for(const t in e)n[t]=e[t]})),n}const s=e=>!!e.scope +;class o{constructor(e,t){ +this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){ +this.buffer+=n(e)}openNode(e){if(!s(e))return;const t=((e,{prefix:t})=>{ +if(e.startsWith("language:"))return e.replace("language:","language-") +;if(e.includes(".")){const n=e.split(".") +;return[`${t}${n.shift()}`,...n.map(((e,t)=>`${e}${"_".repeat(t+1)}`))].join(" ") +}return`${t}${e}`})(e.scope,{prefix:this.classPrefix});this.span(t)} +closeNode(e){s(e)&&(this.buffer+="")}value(){return this.buffer}span(e){ +this.buffer+=``}}const r=(e={})=>{const t={children:[]} +;return Object.assign(t,e),t};class a{constructor(){ +this.rootNode=r(),this.stack=[this.rootNode]}get top(){ +return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){ +this.top.children.push(e)}openNode(e){const t=r({scope:e}) +;this.add(t),this.stack.push(t)}closeNode(){ +if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){ +for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)} +walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){ +return"string"==typeof t?e.addText(t):t.children&&(e.openNode(t), +t.children.forEach((t=>this._walk(e,t))),e.closeNode(t)),e}static _collapse(e){ +"string"!=typeof e&&e.children&&(e.children.every((e=>"string"==typeof e))?e.children=[e.children.join("")]:e.children.forEach((e=>{ +a._collapse(e)})))}}class c extends a{constructor(e){super(),this.options=e} +addText(e){""!==e&&this.add(e)}startScope(e){this.openNode(e)}endScope(){ +this.closeNode()}__addSublanguage(e,t){const n=e.root +;t&&(n.scope="language:"+t),this.add(n)}toHTML(){ +return new o(this,this.options).value()}finalize(){ +return this.closeAllNodes(),!0}}function l(e){ +return e?"string"==typeof e?e:e.source:null}function g(e){return h("(?=",e,")")} +function u(e){return h("(?:",e,")*")}function d(e){return h("(?:",e,")?")} +function h(...e){return e.map((e=>l(e))).join("")}function f(...e){const t=(e=>{ +const t=e[e.length-1] +;return"object"==typeof t&&t.constructor===Object?(e.splice(e.length-1,1),t):{} +})(e);return"("+(t.capture?"":"?:")+e.map((e=>l(e))).join("|")+")"} +function p(e){return RegExp(e.toString()+"|").exec("").length-1} +const b=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./ +;function m(e,{joinWith:t}){let n=0;return e.map((e=>{n+=1;const t=n +;let i=l(e),s="";for(;i.length>0;){const e=b.exec(i);if(!e){s+=i;break} +s+=i.substring(0,e.index), +i=i.substring(e.index+e[0].length),"\\"===e[0][0]&&e[1]?s+="\\"+(Number(e[1])+t):(s+=e[0], +"("===e[0]&&n++)}return s})).map((e=>`(${e})`)).join(t)} +const E="[a-zA-Z]\\w*",x="[a-zA-Z_]\\w*",w="\\b\\d+(\\.\\d+)?",y="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",_="\\b(0b[01]+)",O={ +begin:"\\\\[\\s\\S]",relevance:0},v={scope:"string",begin:"'",end:"'", +illegal:"\\n",contains:[O]},k={scope:"string",begin:'"',end:'"',illegal:"\\n", +contains:[O]},N=(e,t,n={})=>{const s=i({scope:"comment",begin:e,end:t, +contains:[]},n);s.contains.push({scope:"doctag", +begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)", +end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0}) +;const o=f("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/) +;return s.contains.push({begin:h(/[ ]+/,"(",o,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),s +},S=N("//","$"),M=N("/\\*","\\*/"),R=N("#","$");var j=Object.freeze({ +__proto__:null,APOS_STRING_MODE:v,BACKSLASH_ESCAPE:O,BINARY_NUMBER_MODE:{ +scope:"number",begin:_,relevance:0},BINARY_NUMBER_RE:_,COMMENT:N, +C_BLOCK_COMMENT_MODE:M,C_LINE_COMMENT_MODE:S,C_NUMBER_MODE:{scope:"number", +begin:y,relevance:0},C_NUMBER_RE:y,END_SAME_AS_BEGIN:e=>Object.assign(e,{ +"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{ +t.data._beginMatch!==e[1]&&t.ignoreMatch()}}),HASH_COMMENT_MODE:R,IDENT_RE:E, +MATCH_NOTHING_RE:/\b\B/,METHOD_GUARD:{begin:"\\.\\s*"+x,relevance:0}, +NUMBER_MODE:{scope:"number",begin:w,relevance:0},NUMBER_RE:w, +PHRASAL_WORDS_MODE:{ +begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/ +},QUOTE_STRING_MODE:k,REGEXP_MODE:{scope:"regexp",begin:/\/(?=[^/\n]*\/)/, +end:/\/[gimuy]*/,contains:[O,{begin:/\[/,end:/\]/,relevance:0,contains:[O]}]}, +RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~", +SHEBANG:(e={})=>{const t=/^#![ ]*\// +;return e.binary&&(e.begin=h(t,/.*\b/,e.binary,/\b.*/)),i({scope:"meta",begin:t, +end:/$/,relevance:0,"on:begin":(e,t)=>{0!==e.index&&t.ignoreMatch()}},e)}, +TITLE_MODE:{scope:"title",begin:E,relevance:0},UNDERSCORE_IDENT_RE:x, +UNDERSCORE_TITLE_MODE:{scope:"title",begin:x,relevance:0}});function A(e,t){ +"."===e.input[e.index-1]&&t.ignoreMatch()}function I(e,t){ +void 0!==e.className&&(e.scope=e.className,delete e.className)}function T(e,t){ +t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)", +e.__beforeBegin=A,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords, +void 0===e.relevance&&(e.relevance=0))}function L(e,t){ +Array.isArray(e.illegal)&&(e.illegal=f(...e.illegal))}function B(e,t){ +if(e.match){ +if(e.begin||e.end)throw Error("begin & end are not supported with match") +;e.begin=e.match,delete e.match}}function P(e,t){ +void 0===e.relevance&&(e.relevance=1)}const D=(e,t)=>{if(!e.beforeMatch)return +;if(e.starts)throw Error("beforeMatch cannot be used with starts") +;const n=Object.assign({},e);Object.keys(e).forEach((t=>{delete e[t] +})),e.keywords=n.keywords,e.begin=h(n.beforeMatch,g(n.begin)),e.starts={ +relevance:0,contains:[Object.assign(n,{endsParent:!0})] +},e.relevance=0,delete n.beforeMatch +},H=["of","and","for","in","not","or","if","then","parent","list","value"],C="keyword" +;function $(e,t,n=C){const i=Object.create(null) +;return"string"==typeof e?s(n,e.split(" ")):Array.isArray(e)?s(n,e):Object.keys(e).forEach((n=>{ +Object.assign(i,$(e[n],t,n))})),i;function s(e,n){ +t&&(n=n.map((e=>e.toLowerCase()))),n.forEach((t=>{const n=t.split("|") +;i[n[0]]=[e,U(n[0],n[1])]}))}}function U(e,t){ +return t?Number(t):(e=>H.includes(e.toLowerCase()))(e)?0:1}const z={},W=e=>{ +console.error(e)},X=(e,...t)=>{console.log("WARN: "+e,...t)},G=(e,t)=>{ +z[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),z[`${e}/${t}`]=!0) +},K=Error();function F(e,t,{key:n}){let i=0;const s=e[n],o={},r={} +;for(let e=1;e<=t.length;e++)r[e+i]=s[e],o[e+i]=!0,i+=p(t[e-1]) +;e[n]=r,e[n]._emit=o,e[n]._multi=!0}function Z(e){(e=>{ +e.scope&&"object"==typeof e.scope&&null!==e.scope&&(e.beginScope=e.scope, +delete e.scope)})(e),"string"==typeof e.beginScope&&(e.beginScope={ +_wrap:e.beginScope}),"string"==typeof e.endScope&&(e.endScope={_wrap:e.endScope +}),(e=>{if(Array.isArray(e.begin)){ +if(e.skip||e.excludeBegin||e.returnBegin)throw W("skip, excludeBegin, returnBegin not compatible with beginScope: {}"), +K +;if("object"!=typeof e.beginScope||null===e.beginScope)throw W("beginScope must be object"), +K;F(e,e.begin,{key:"beginScope"}),e.begin=m(e.begin,{joinWith:""})}})(e),(e=>{ +if(Array.isArray(e.end)){ +if(e.skip||e.excludeEnd||e.returnEnd)throw W("skip, excludeEnd, returnEnd not compatible with endScope: {}"), +K +;if("object"!=typeof e.endScope||null===e.endScope)throw W("endScope must be object"), +K;F(e,e.end,{key:"endScope"}),e.end=m(e.end,{joinWith:""})}})(e)}function V(e){ +function t(t,n){ +return RegExp(l(t),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(n?"g":"")) +}class n{constructor(){ +this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0} +addRule(e,t){ +t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]), +this.matchAt+=p(e)+1}compile(){0===this.regexes.length&&(this.exec=()=>null) +;const e=this.regexes.map((e=>e[1]));this.matcherRe=t(m(e,{joinWith:"|" +}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex +;const t=this.matcherRe.exec(e);if(!t)return null +;const n=t.findIndex(((e,t)=>t>0&&void 0!==e)),i=this.matchIndexes[n] +;return t.splice(0,n),Object.assign(t,i)}}class s{constructor(){ +this.rules=[],this.multiRegexes=[], +this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){ +if(this.multiRegexes[e])return this.multiRegexes[e];const t=new n +;return this.rules.slice(e).forEach((([e,n])=>t.addRule(e,n))), +t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){ +return 0!==this.regexIndex}considerAll(){this.regexIndex=0}addRule(e,t){ +this.rules.push([e,t]),"begin"===t.type&&this.count++}exec(e){ +const t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex +;let n=t.exec(e) +;if(this.resumingScanAtSamePosition())if(n&&n.index===this.lastIndex);else{ +const t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)} +return n&&(this.regexIndex+=n.position+1, +this.regexIndex===this.count&&this.considerAll()),n}} +if(e.compilerExtensions||(e.compilerExtensions=[]), +e.contains&&e.contains.includes("self"))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.") +;return e.classNameAliases=i(e.classNameAliases||{}),function n(o,r){const a=o +;if(o.isCompiled)return a +;[I,B,Z,D].forEach((e=>e(o,r))),e.compilerExtensions.forEach((e=>e(o,r))), +o.__beforeBegin=null,[T,L,P].forEach((e=>e(o,r))),o.isCompiled=!0;let c=null +;return"object"==typeof o.keywords&&o.keywords.$pattern&&(o.keywords=Object.assign({},o.keywords), +c=o.keywords.$pattern, +delete o.keywords.$pattern),c=c||/\w+/,o.keywords&&(o.keywords=$(o.keywords,e.case_insensitive)), +a.keywordPatternRe=t(c,!0), +r&&(o.begin||(o.begin=/\B|\b/),a.beginRe=t(a.begin),o.end||o.endsWithParent||(o.end=/\B|\b/), +o.end&&(a.endRe=t(a.end)), +a.terminatorEnd=l(a.end)||"",o.endsWithParent&&r.terminatorEnd&&(a.terminatorEnd+=(o.end?"|":"")+r.terminatorEnd)), +o.illegal&&(a.illegalRe=t(o.illegal)), +o.contains||(o.contains=[]),o.contains=[].concat(...o.contains.map((e=>(e=>(e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map((t=>i(e,{ +variants:null},t)))),e.cachedVariants?e.cachedVariants:q(e)?i(e,{ +starts:e.starts?i(e.starts):null +}):Object.isFrozen(e)?i(e):e))("self"===e?o:e)))),o.contains.forEach((e=>{n(e,a) +})),o.starts&&n(o.starts,r),a.matcher=(e=>{const t=new s +;return e.contains.forEach((e=>t.addRule(e.begin,{rule:e,type:"begin" +}))),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:"end" +}),e.illegal&&t.addRule(e.illegal,{type:"illegal"}),t})(a),a}(e)}function q(e){ +return!!e&&(e.endsWithParent||q(e.starts))}class J extends Error{ +constructor(e,t){super(e),this.name="HTMLInjectionError",this.html=t}} +const Y=n,Q=i,ee=Symbol("nomatch"),te=n=>{ +const i=Object.create(null),s=Object.create(null),o=[];let r=!0 +;const a="Could not find the language '{}', did you forget to load/include a language module?",l={ +disableAutodetect:!0,name:"Plain text",contains:[]};let p={ +ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i, +languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-", +cssSelector:"pre code",languages:null,__emitter:c};function b(e){ +return p.noHighlightRe.test(e)}function m(e,t,n){let i="",s="" +;"object"==typeof t?(i=e, +n=t.ignoreIllegals,s=t.language):(G("10.7.0","highlight(lang, code, ...args) has been deprecated."), +G("10.7.0","Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277"), +s=e,i=t),void 0===n&&(n=!0);const o={code:i,language:s};N("before:highlight",o) +;const r=o.result?o.result:E(o.language,o.code,n) +;return r.code=o.code,N("after:highlight",r),r}function E(e,n,s,o){ +const c=Object.create(null);function l(){if(!N.keywords)return void M.addText(R) +;let e=0;N.keywordPatternRe.lastIndex=0;let t=N.keywordPatternRe.exec(R),n="" +;for(;t;){n+=R.substring(e,t.index) +;const s=_.case_insensitive?t[0].toLowerCase():t[0],o=(i=s,N.keywords[i]);if(o){ +const[e,i]=o +;if(M.addText(n),n="",c[s]=(c[s]||0)+1,c[s]<=7&&(j+=i),e.startsWith("_"))n+=t[0];else{ +const n=_.classNameAliases[e]||e;u(t[0],n)}}else n+=t[0] +;e=N.keywordPatternRe.lastIndex,t=N.keywordPatternRe.exec(R)}var i +;n+=R.substring(e),M.addText(n)}function g(){null!=N.subLanguage?(()=>{ +if(""===R)return;let e=null;if("string"==typeof N.subLanguage){ +if(!i[N.subLanguage])return void M.addText(R) +;e=E(N.subLanguage,R,!0,S[N.subLanguage]),S[N.subLanguage]=e._top +}else e=x(R,N.subLanguage.length?N.subLanguage:null) +;N.relevance>0&&(j+=e.relevance),M.__addSublanguage(e._emitter,e.language) +})():l(),R=""}function u(e,t){ +""!==e&&(M.startScope(t),M.addText(e),M.endScope())}function d(e,t){let n=1 +;const i=t.length-1;for(;n<=i;){if(!e._emit[n]){n++;continue} +const i=_.classNameAliases[e[n]]||e[n],s=t[n];i?u(s,i):(R=s,l(),R=""),n++}} +function h(e,t){ +return e.scope&&"string"==typeof e.scope&&M.openNode(_.classNameAliases[e.scope]||e.scope), +e.beginScope&&(e.beginScope._wrap?(u(R,_.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap), +R=""):e.beginScope._multi&&(d(e.beginScope,t),R="")),N=Object.create(e,{parent:{ +value:N}}),N}function f(e,n,i){let s=((e,t)=>{const n=e&&e.exec(t) +;return n&&0===n.index})(e.endRe,i);if(s){if(e["on:end"]){const i=new t(e) +;e["on:end"](n,i),i.isMatchIgnored&&(s=!1)}if(s){ +for(;e.endsParent&&e.parent;)e=e.parent;return e}} +if(e.endsWithParent)return f(e.parent,n,i)}function b(e){ +return 0===N.matcher.regexIndex?(R+=e[0],1):(T=!0,0)}function m(e){ +const t=e[0],i=n.substring(e.index),s=f(N,e,i);if(!s)return ee;const o=N +;N.endScope&&N.endScope._wrap?(g(), +u(t,N.endScope._wrap)):N.endScope&&N.endScope._multi?(g(), +d(N.endScope,e)):o.skip?R+=t:(o.returnEnd||o.excludeEnd||(R+=t), +g(),o.excludeEnd&&(R=t));do{ +N.scope&&M.closeNode(),N.skip||N.subLanguage||(j+=N.relevance),N=N.parent +}while(N!==s.parent);return s.starts&&h(s.starts,e),o.returnEnd?0:t.length} +let w={};function y(i,o){const a=o&&o[0];if(R+=i,null==a)return g(),0 +;if("begin"===w.type&&"end"===o.type&&w.index===o.index&&""===a){ +if(R+=n.slice(o.index,o.index+1),!r){const t=Error(`0 width match regex (${e})`) +;throw t.languageName=e,t.badRule=w.rule,t}return 1} +if(w=o,"begin"===o.type)return(e=>{ +const n=e[0],i=e.rule,s=new t(i),o=[i.__beforeBegin,i["on:begin"]] +;for(const t of o)if(t&&(t(e,s),s.isMatchIgnored))return b(n) +;return i.skip?R+=n:(i.excludeBegin&&(R+=n), +g(),i.returnBegin||i.excludeBegin||(R=n)),h(i,e),i.returnBegin?0:n.length})(o) +;if("illegal"===o.type&&!s){ +const e=Error('Illegal lexeme "'+a+'" for mode "'+(N.scope||"")+'"') +;throw e.mode=N,e}if("end"===o.type){const e=m(o);if(e!==ee)return e} +if("illegal"===o.type&&""===a)return 1 +;if(I>1e5&&I>3*o.index)throw Error("potential infinite loop, way more iterations than matches") +;return R+=a,a.length}const _=O(e) +;if(!_)throw W(a.replace("{}",e)),Error('Unknown language: "'+e+'"') +;const v=V(_);let k="",N=o||v;const S={},M=new p.__emitter(p);(()=>{const e=[] +;for(let t=N;t!==_;t=t.parent)t.scope&&e.unshift(t.scope) +;e.forEach((e=>M.openNode(e)))})();let R="",j=0,A=0,I=0,T=!1;try{ +if(_.__emitTokens)_.__emitTokens(n,M);else{for(N.matcher.considerAll();;){ +I++,T?T=!1:N.matcher.considerAll(),N.matcher.lastIndex=A +;const e=N.matcher.exec(n);if(!e)break;const t=y(n.substring(A,e.index),e) +;A=e.index+t}y(n.substring(A))}return M.finalize(),k=M.toHTML(),{language:e, +value:k,relevance:j,illegal:!1,_emitter:M,_top:N}}catch(t){ +if(t.message&&t.message.includes("Illegal"))return{language:e,value:Y(n), +illegal:!0,relevance:0,_illegalBy:{message:t.message,index:A, +context:n.slice(A-100,A+100),mode:t.mode,resultSoFar:k},_emitter:M};if(r)return{ +language:e,value:Y(n),illegal:!1,relevance:0,errorRaised:t,_emitter:M,_top:N} +;throw t}}function x(e,t){t=t||p.languages||Object.keys(i);const n=(e=>{ +const t={value:Y(e),illegal:!1,relevance:0,_top:l,_emitter:new p.__emitter(p)} +;return t._emitter.addText(e),t})(e),s=t.filter(O).filter(k).map((t=>E(t,e,!1))) +;s.unshift(n);const o=s.sort(((e,t)=>{ +if(e.relevance!==t.relevance)return t.relevance-e.relevance +;if(e.language&&t.language){if(O(e.language).supersetOf===t.language)return 1 +;if(O(t.language).supersetOf===e.language)return-1}return 0})),[r,a]=o,c=r +;return c.secondBest=a,c}function w(e){let t=null;const n=(e=>{ +let t=e.className+" ";t+=e.parentNode?e.parentNode.className:"" +;const n=p.languageDetectRe.exec(t);if(n){const t=O(n[1]) +;return t||(X(a.replace("{}",n[1])), +X("Falling back to no-highlight mode for this block.",e)),t?n[1]:"no-highlight"} +return t.split(/\s+/).find((e=>b(e)||O(e)))})(e);if(b(n))return +;if(N("before:highlightElement",{el:e,language:n +}),e.dataset.highlighted)return void console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",e) +;if(e.children.length>0&&(p.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."), +console.warn("https://github.com/highlightjs/highlight.js/wiki/security"), +console.warn("The element with unescaped HTML:"), +console.warn(e)),p.throwUnescapedHTML))throw new J("One of your code blocks includes unescaped HTML.",e.innerHTML) +;t=e;const i=t.textContent,o=n?m(i,{language:n,ignoreIllegals:!0}):x(i) +;e.innerHTML=o.value,e.dataset.highlighted="yes",((e,t,n)=>{const i=t&&s[t]||n +;e.classList.add("hljs"),e.classList.add("language-"+i) +})(e,n,o.language),e.result={language:o.language,re:o.relevance, +relevance:o.relevance},o.secondBest&&(e.secondBest={ +language:o.secondBest.language,relevance:o.secondBest.relevance +}),N("after:highlightElement",{el:e,result:o,text:i})}let y=!1;function _(){ +"loading"!==document.readyState?document.querySelectorAll(p.cssSelector).forEach(w):y=!0 +}function O(e){return e=(e||"").toLowerCase(),i[e]||i[s[e]]} +function v(e,{languageName:t}){"string"==typeof e&&(e=[e]),e.forEach((e=>{ +s[e.toLowerCase()]=t}))}function k(e){const t=O(e) +;return t&&!t.disableAutodetect}function N(e,t){const n=e;o.forEach((e=>{ +e[n]&&e[n](t)}))} +"undefined"!=typeof window&&window.addEventListener&&window.addEventListener("DOMContentLoaded",(()=>{ +y&&_()}),!1),Object.assign(n,{highlight:m,highlightAuto:x,highlightAll:_, +highlightElement:w, +highlightBlock:e=>(G("10.7.0","highlightBlock will be removed entirely in v12.0"), +G("10.7.0","Please use highlightElement now."),w(e)),configure:e=>{p=Q(p,e)}, +initHighlighting:()=>{ +_(),G("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")}, +initHighlightingOnLoad:()=>{ +_(),G("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.") +},registerLanguage:(e,t)=>{let s=null;try{s=t(n)}catch(t){ +if(W("Language definition for '{}' could not be registered.".replace("{}",e)), +!r)throw t;W(t),s=l} +s.name||(s.name=e),i[e]=s,s.rawDefinition=t.bind(null,n),s.aliases&&v(s.aliases,{ +languageName:e})},unregisterLanguage:e=>{delete i[e] +;for(const t of Object.keys(s))s[t]===e&&delete s[t]}, +listLanguages:()=>Object.keys(i),getLanguage:O,registerAliases:v, +autoDetection:k,inherit:Q,addPlugin:e=>{(e=>{ +e["before:highlightBlock"]&&!e["before:highlightElement"]&&(e["before:highlightElement"]=t=>{ +e["before:highlightBlock"](Object.assign({block:t.el},t)) +}),e["after:highlightBlock"]&&!e["after:highlightElement"]&&(e["after:highlightElement"]=t=>{ +e["after:highlightBlock"](Object.assign({block:t.el},t))})})(e),o.push(e)}, +removePlugin:e=>{const t=o.indexOf(e);-1!==t&&o.splice(t,1)}}),n.debugMode=()=>{ +r=!1},n.safeMode=()=>{r=!0},n.versionString="11.9.0",n.regex={concat:h, +lookahead:g,either:f,optional:d,anyNumberOfTimes:u} +;for(const t in j)"object"==typeof j[t]&&e(j[t]);return Object.assign(n,j),n +},ne=te({});return ne.newInstance=()=>te({}),ne}() +;"object"==typeof exports&&"undefined"!=typeof module&&(module.exports=hljs);/*! `javascript` grammar compiled for Highlight.js 11.9.0 */ +(()=>{var e=(()=>{"use strict" +;const e="[A-Za-z$_][0-9A-Za-z$_]*",n=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends"],a=["true","false","null","undefined","NaN","Infinity"],t=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],s=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],r=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],c=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],i=[].concat(r,t,s) +;return o=>{const l=o.regex,b=e,d={begin:/<[A-Za-z0-9\\._:-]+/, +end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,n)=>{ +const a=e[0].length+e.index,t=e.input[a] +;if("<"===t||","===t)return void n.ignoreMatch();let s +;">"===t&&(((e,{after:n})=>{const a="",$={ +match:[/const|var|let/,/\s+/,b,/\s*/,/=\s*/,/(async\s*)?/,l.lookahead(B)], +keywords:"async",className:{1:"keyword",3:"title.function"},contains:[R]} +;return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:g,exports:{ +PARAMS_CONTAINS:w,CLASS_REFERENCE:k},illegal:/#(?![$_A-z])/, +contains:[o.SHEBANG({label:"shebang",binary:"node",relevance:5}),{ +label:"use_strict",className:"meta",relevance:10, +begin:/^\s*['"]use (strict|asm)['"]/ +},o.APOS_STRING_MODE,o.QUOTE_STRING_MODE,h,N,_,f,v,{match:/\$\d+/},A,k,{ +className:"attr",begin:b+l.lookahead(":"),relevance:0},$,{ +begin:"("+o.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*", +keywords:"return throw case",relevance:0,contains:[v,o.REGEXP_MODE,{ +className:"function",begin:B,returnBegin:!0,end:"\\s*=>",contains:[{ +className:"params",variants:[{begin:o.UNDERSCORE_IDENT_RE,relevance:0},{ +className:null,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0, +excludeEnd:!0,keywords:g,contains:w}]}]},{begin:/,/,relevance:0},{match:/\s+/, +relevance:0},{variants:[{begin:"<>",end:""},{ +match:/<[A-Za-z0-9\\._:-]+\s*\/>/},{begin:d.begin, +"on:begin":d.isTrulyOpeningTag,end:d.end}],subLanguage:"xml",contains:[{ +begin:d.begin,end:d.end,skip:!0,contains:["self"]}]}]},I,{ +beginKeywords:"while if switch catch for"},{ +begin:"\\b(?!function)"+o.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{", +returnBegin:!0,label:"func.def",contains:[R,o.inherit(o.TITLE_MODE,{begin:b, +className:"title.function"})]},{match:/\.\.\./,relevance:0},C,{match:"\\$"+b, +relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"}, +contains:[R]},x,{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/, +className:"variable.constant"},O,M,{match:/\$[(.]/}]}}})() +;hljs.registerLanguage("javascript",e)})(); \ No newline at end of file diff --git a/mounts/zoperepo/__root__/lib/js/javascript-hint.js/__meta__ b/mounts/zoperepo/__root__/lib/js/javascript-hint.js/__meta__ new file mode 100644 index 0000000..242210d --- /dev/null +++ b/mounts/zoperepo/__root__/lib/js/javascript-hint.js/__meta__ @@ -0,0 +1,8 @@ +[ + ('owner', (['acl_users'], 'dockerzope')), + ('props', [ + [('id', 'content_type'), ('type', 'string'), ('value', 'text/javascript')], + ]), + ('title', 'cm autocomplete try'), + ('type', 'File'), +] diff --git a/mounts/zoperepo/__root__/lib/js/javascript-hint.js/__source__.js b/mounts/zoperepo/__root__/lib/js/javascript-hint.js/__source__.js new file mode 100644 index 0000000..9563979 --- /dev/null +++ b/mounts/zoperepo/__root__/lib/js/javascript-hint.js/__source__.js @@ -0,0 +1,162 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: https://codemirror.net/5/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + var Pos = CodeMirror.Pos; + + function forEach(arr, f) { + for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]); + } + + function arrayContains(arr, item) { + if (!Array.prototype.indexOf) { + var i = arr.length; + while (i--) { + if (arr[i] === item) { + return true; + } + } + return false; + } + return arr.indexOf(item) != -1; + } + + function scriptHint(editor, keywords, getToken, options) { + // Find the token at the cursor + var cur = editor.getCursor(), token = getToken(editor, cur); + if (/\b(?:string|comment)\b/.test(token.type)) return; + var innerMode = CodeMirror.innerMode(editor.getMode(), token.state); + if (innerMode.mode.helperType === "json") return; + token.state = innerMode.state; + + // If it's not a 'word-style' token, ignore the token. + if (!/^[\w$_]*$/.test(token.string)) { + token = {start: cur.ch, end: cur.ch, string: "", state: token.state, + type: token.string == "." ? "property" : null}; + } else if (token.end > cur.ch) { + token.end = cur.ch; + token.string = token.string.slice(0, cur.ch - token.start); + } + + var tprop = token; + // If it is a property, find out what it is a property of. + while (tprop.type == "property") { + tprop = getToken(editor, Pos(cur.line, tprop.start)); + if (tprop.string != ".") return; + tprop = getToken(editor, Pos(cur.line, tprop.start)); + if (!context) var context = []; + context.push(tprop); + } + return {list: getCompletions(token, context, keywords, options), + from: Pos(cur.line, token.start), + to: Pos(cur.line, token.end)}; + } + + function javascriptHint(editor, options) { + return scriptHint(editor, javascriptKeywords, + function (e, cur) {return e.getTokenAt(cur);}, + options); + }; + CodeMirror.registerHelper("hint", "javascript", javascriptHint); + + function getCoffeeScriptToken(editor, cur) { + // This getToken, it is for coffeescript, imitates the behavior of + // getTokenAt method in javascript.js, that is, returning "property" + // type and treat "." as independent token. + var token = editor.getTokenAt(cur); + if (cur.ch == token.start + 1 && token.string.charAt(0) == '.') { + token.end = token.start; + token.string = '.'; + token.type = "property"; + } + else if (/^\.[\w$_]*$/.test(token.string)) { + token.type = "property"; + token.start++; + token.string = token.string.replace(/\./, ''); + } + return token; + } + + function coffeescriptHint(editor, options) { + return scriptHint(editor, coffeescriptKeywords, getCoffeeScriptToken, options); + } + CodeMirror.registerHelper("hint", "coffeescript", coffeescriptHint); + + var stringProps = ("charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight " + + "toUpperCase toLowerCase split concat match replace search").split(" "); + var arrayProps = ("length concat join splice push pop shift unshift slice reverse sort indexOf " + + "lastIndexOf every some filter forEach map reduce reduceRight ").split(" "); + var funcProps = "prototype apply call bind".split(" "); + var javascriptKeywords = ("break case catch class const continue debugger default delete do else export extends false finally for function " + + "if in import instanceof new null return super switch this throw true try typeof var void while with yield").split(" "); + var coffeescriptKeywords = ("and break catch class continue delete do else extends false finally for " + + "if in instanceof isnt new no not null of off on or return switch then throw true try typeof until void while with yes").split(" "); + + function forAllProps(obj, callback) { + if (!Object.getOwnPropertyNames || !Object.getPrototypeOf) { + for (var name in obj) callback(name) + } else { + for (var o = obj; o; o = Object.getPrototypeOf(o)) + Object.getOwnPropertyNames(o).forEach(callback) + } + } + + function getCompletions(token, context, keywords, options) { + var found = [], start = token.string, global = options && options.globalScope || window; + function maybeAdd(str) { + if (str.lastIndexOf(start, 0) == 0 && !arrayContains(found, str)) found.push(str); + } + function gatherCompletions(obj) { + if (typeof obj == "string") forEach(stringProps, maybeAdd); + else if (obj instanceof Array) forEach(arrayProps, maybeAdd); + else if (obj instanceof Function) forEach(funcProps, maybeAdd); + forAllProps(obj, maybeAdd) + } + + if (context && context.length) { + // If this is a property, see if it belongs to some object we can + // find in the current environment. + var obj = context.pop(), base; + if (obj.type && obj.type.indexOf("variable") === 0) { + if (options && options.additionalContext) + base = options.additionalContext[obj.string]; + if (!options || options.useGlobalScope !== false) + base = base || global[obj.string]; + } else if (obj.type == "string") { + base = ""; + } else if (obj.type == "atom") { + base = 1; + } else if (obj.type == "function") { + if (global.jQuery != null && (obj.string == '$' || obj.string == 'jQuery') && + (typeof global.jQuery == 'function')) + base = global.jQuery(); + else if (global._ != null && (obj.string == '_') && (typeof global._ == 'function')) + base = global._(); + } + while (base != null && context.length) + base = base[context.pop().string]; + if (base != null) gatherCompletions(base); + } else { + // If not, just look in the global object, any local scope, and optional additional-context + // (reading into JS mode internals to get at the local and global variables) + for (var v = token.state.localVars; v; v = v.next) maybeAdd(v.name); + for (var c = token.state.context; c; c = c.prev) + for (var v = c.vars; v; v = v.next) maybeAdd(v.name) + for (var v = token.state.globalVars; v; v = v.next) maybeAdd(v.name); + if (options && options.additionalContext != null) + for (var key in options.additionalContext) + maybeAdd(key); + if (!options || options.useGlobalScope !== false) + gatherCompletions(global); + forEach(keywords, maybeAdd); + } + return found; + } +}); diff --git a/mounts/zoperepo/__root__/lib/js/show-hint.js/__meta__ b/mounts/zoperepo/__root__/lib/js/show-hint.js/__meta__ new file mode 100644 index 0000000..242210d --- /dev/null +++ b/mounts/zoperepo/__root__/lib/js/show-hint.js/__meta__ @@ -0,0 +1,8 @@ +[ + ('owner', (['acl_users'], 'dockerzope')), + ('props', [ + [('id', 'content_type'), ('type', 'string'), ('value', 'text/javascript')], + ]), + ('title', 'cm autocomplete try'), + ('type', 'File'), +] diff --git a/mounts/zoperepo/__root__/lib/js/show-hint.js/__source__.js b/mounts/zoperepo/__root__/lib/js/show-hint.js/__source__.js new file mode 100644 index 0000000..aaf1f64 --- /dev/null +++ b/mounts/zoperepo/__root__/lib/js/show-hint.js/__source__.js @@ -0,0 +1,523 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: https://codemirror.net/5/LICENSE + +// declare global: DOMRect + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + var HINT_ELEMENT_CLASS = "CodeMirror-hint"; + var ACTIVE_HINT_ELEMENT_CLASS = "CodeMirror-hint-active"; + + // This is the old interface, kept around for now to stay + // backwards-compatible. + CodeMirror.showHint = function(cm, getHints, options) { + if (!getHints) return cm.showHint(options); + if (options && options.async) getHints.async = true; + var newOpts = {hint: getHints}; + if (options) for (var prop in options) newOpts[prop] = options[prop]; + return cm.showHint(newOpts); + }; + + CodeMirror.defineExtension("showHint", function(options) { + options = parseOptions(this, this.getCursor("start"), options); + var selections = this.listSelections() + if (selections.length > 1) return; + // By default, don't allow completion when something is selected. + // A hint function can have a `supportsSelection` property to + // indicate that it can handle selections. + if (this.somethingSelected()) { + if (!options.hint.supportsSelection) return; + // Don't try with cross-line selections + for (var i = 0; i < selections.length; i++) + if (selections[i].head.line != selections[i].anchor.line) return; + } + + if (this.state.completionActive) this.state.completionActive.close(); + var completion = this.state.completionActive = new Completion(this, options); + if (!completion.options.hint) return; + + CodeMirror.signal(this, "startCompletion", this); + completion.update(true); + }); + + CodeMirror.defineExtension("closeHint", function() { + if (this.state.completionActive) this.state.completionActive.close() + }) + + function Completion(cm, options) { + this.cm = cm; + this.options = options; + this.widget = null; + this.debounce = 0; + this.tick = 0; + this.startPos = this.cm.getCursor("start"); + this.startLen = this.cm.getLine(this.startPos.line).length - this.cm.getSelection().length; + + if (this.options.updateOnCursorActivity) { + var self = this; + cm.on("cursorActivity", this.activityFunc = function() { self.cursorActivity(); }); + } + } + + var requestAnimationFrame = window.requestAnimationFrame || function(fn) { + return setTimeout(fn, 1000/60); + }; + var cancelAnimationFrame = window.cancelAnimationFrame || clearTimeout; + + Completion.prototype = { + close: function() { + if (!this.active()) return; + this.cm.state.completionActive = null; + this.tick = null; + if (this.options.updateOnCursorActivity) { + this.cm.off("cursorActivity", this.activityFunc); + } + + if (this.widget && this.data) CodeMirror.signal(this.data, "close"); + if (this.widget) this.widget.close(); + CodeMirror.signal(this.cm, "endCompletion", this.cm); + }, + + active: function() { + return this.cm.state.completionActive == this; + }, + + pick: function(data, i) { + var completion = data.list[i], self = this; + this.cm.operation(function() { + if (completion.hint) + completion.hint(self.cm, data, completion); + else + self.cm.replaceRange(getText(completion), completion.from || data.from, + completion.to || data.to, "complete"); + CodeMirror.signal(data, "pick", completion); + self.cm.scrollIntoView(); + }); + if (this.options.closeOnPick) { + this.close(); + } + }, + + cursorActivity: function() { + if (this.debounce) { + cancelAnimationFrame(this.debounce); + this.debounce = 0; + } + + var identStart = this.startPos; + if(this.data) { + identStart = this.data.from; + } + + var pos = this.cm.getCursor(), line = this.cm.getLine(pos.line); + if (pos.line != this.startPos.line || line.length - pos.ch != this.startLen - this.startPos.ch || + pos.ch < identStart.ch || this.cm.somethingSelected() || + (!pos.ch || this.options.closeCharacters.test(line.charAt(pos.ch - 1)))) { + this.close(); + } else { + var self = this; + this.debounce = requestAnimationFrame(function() {self.update();}); + if (this.widget) this.widget.disable(); + } + }, + + update: function(first) { + if (this.tick == null) return + var self = this, myTick = ++this.tick + fetchHints(this.options.hint, this.cm, this.options, function(data) { + if (self.tick == myTick) self.finishUpdate(data, first) + }) + }, + + finishUpdate: function(data, first) { + if (this.data) CodeMirror.signal(this.data, "update"); + + var picked = (this.widget && this.widget.picked) || (first && this.options.completeSingle); + if (this.widget) this.widget.close(); + + this.data = data; + + if (data && data.list.length) { + if (picked && data.list.length == 1) { + this.pick(data, 0); + } else { + this.widget = new Widget(this, data); + CodeMirror.signal(data, "shown"); + } + } + } + }; + + function parseOptions(cm, pos, options) { + var editor = cm.options.hintOptions; + var out = {}; + for (var prop in defaultOptions) out[prop] = defaultOptions[prop]; + if (editor) for (var prop in editor) + if (editor[prop] !== undefined) out[prop] = editor[prop]; + if (options) for (var prop in options) + if (options[prop] !== undefined) out[prop] = options[prop]; + if (out.hint.resolve) out.hint = out.hint.resolve(cm, pos) + return out; + } + + function getText(completion) { + if (typeof completion == "string") return completion; + else return completion.text; + } + + function buildKeyMap(completion, handle) { + var baseMap = { + Up: function() {handle.moveFocus(-1);}, + Down: function() {handle.moveFocus(1);}, + PageUp: function() {handle.moveFocus(-handle.menuSize() + 1, true);}, + PageDown: function() {handle.moveFocus(handle.menuSize() - 1, true);}, + Home: function() {handle.setFocus(0);}, + End: function() {handle.setFocus(handle.length - 1);}, + Enter: handle.pick, + Tab: handle.pick, + Esc: handle.close + }; + + var mac = /Mac/.test(navigator.platform); + + if (mac) { + baseMap["Ctrl-P"] = function() {handle.moveFocus(-1);}; + baseMap["Ctrl-N"] = function() {handle.moveFocus(1);}; + } + + var custom = completion.options.customKeys; + var ourMap = custom ? {} : baseMap; + function addBinding(key, val) { + var bound; + if (typeof val != "string") + bound = function(cm) { return val(cm, handle); }; + // This mechanism is deprecated + else if (baseMap.hasOwnProperty(val)) + bound = baseMap[val]; + else + bound = val; + ourMap[key] = bound; + } + if (custom) + for (var key in custom) if (custom.hasOwnProperty(key)) + addBinding(key, custom[key]); + var extra = completion.options.extraKeys; + if (extra) + for (var key in extra) if (extra.hasOwnProperty(key)) + addBinding(key, extra[key]); + return ourMap; + } + + function getHintElement(hintsElement, el) { + while (el && el != hintsElement) { + if (el.nodeName.toUpperCase() === "LI" && el.parentNode == hintsElement) return el; + el = el.parentNode; + } + } + + function Widget(completion, data) { + this.id = "cm-complete-" + Math.floor(Math.random(1e6)) + this.completion = completion; + this.data = data; + this.picked = false; + var widget = this, cm = completion.cm; + var ownerDocument = cm.getInputField().ownerDocument; + var parentWindow = ownerDocument.defaultView || ownerDocument.parentWindow; + + var hints = this.hints = ownerDocument.createElement("ul"); + hints.setAttribute("role", "listbox") + hints.setAttribute("aria-expanded", "true") + hints.id = this.id + var theme = completion.cm.options.theme; + hints.className = "CodeMirror-hints " + theme; + this.selectedHint = data.selectedHint || 0; + + var completions = data.list; + for (var i = 0; i < completions.length; ++i) { + var elt = hints.appendChild(ownerDocument.createElement("li")), cur = completions[i]; + var className = HINT_ELEMENT_CLASS + (i != this.selectedHint ? "" : " " + ACTIVE_HINT_ELEMENT_CLASS); + if (cur.className != null) className = cur.className + " " + className; + elt.className = className; + if (i == this.selectedHint) elt.setAttribute("aria-selected", "true") + elt.id = this.id + "-" + i + elt.setAttribute("role", "option") + if (cur.render) cur.render(elt, data, cur); + else elt.appendChild(ownerDocument.createTextNode(cur.displayText || getText(cur))); + elt.hintId = i; + } + + var container = completion.options.container || ownerDocument.body; + var pos = cm.cursorCoords(completion.options.alignWithWord ? data.from : null); + var left = pos.left, top = pos.bottom, below = true; + var offsetLeft = 0, offsetTop = 0; + if (container !== ownerDocument.body) { + // We offset the cursor position because left and top are relative to the offsetParent's top left corner. + var isContainerPositioned = ['absolute', 'relative', 'fixed'].indexOf(parentWindow.getComputedStyle(container).position) !== -1; + var offsetParent = isContainerPositioned ? container : container.offsetParent; + var offsetParentPosition = offsetParent.getBoundingClientRect(); + var bodyPosition = ownerDocument.body.getBoundingClientRect(); + offsetLeft = (offsetParentPosition.left - bodyPosition.left - offsetParent.scrollLeft); + offsetTop = (offsetParentPosition.top - bodyPosition.top - offsetParent.scrollTop); + } + hints.style.left = (left - offsetLeft) + "px"; + hints.style.top = (top - offsetTop) + "px"; + + // If we're at the edge of the screen, then we want the menu to appear on the left of the cursor. + var winW = parentWindow.innerWidth || Math.max(ownerDocument.body.offsetWidth, ownerDocument.documentElement.offsetWidth); + var winH = parentWindow.innerHeight || Math.max(ownerDocument.body.offsetHeight, ownerDocument.documentElement.offsetHeight); + container.appendChild(hints); + cm.getInputField().setAttribute("aria-autocomplete", "list") + cm.getInputField().setAttribute("aria-owns", this.id) + cm.getInputField().setAttribute("aria-activedescendant", this.id + "-" + this.selectedHint) + + var box = completion.options.moveOnOverlap ? hints.getBoundingClientRect() : new DOMRect(); + var scrolls = completion.options.paddingForScrollbar ? hints.scrollHeight > hints.clientHeight + 1 : false; + + // Compute in the timeout to avoid reflow on init + var startScroll; + setTimeout(function() { startScroll = cm.getScrollInfo(); }); + + var overlapY = box.bottom - winH; + if (overlapY > 0) { // Does not fit below + var height = box.bottom - box.top, spaceAbove = box.top - (pos.bottom - pos.top) - 2 + if (winH - box.top < spaceAbove) { // More room at the top + if (height > spaceAbove) hints.style.height = (height = spaceAbove) + "px"; + hints.style.top = ((top = pos.top - height) + offsetTop) + "px"; + below = false; + } else { + hints.style.height = (winH - box.top - 2) + "px"; + } + } + var overlapX = box.right - winW; + if (scrolls) overlapX += cm.display.nativeBarWidth; + if (overlapX > 0) { + if (box.right - box.left > winW) { + hints.style.width = (winW - 5) + "px"; + overlapX -= (box.right - box.left) - winW; + } + hints.style.left = (left = Math.max(pos.left - overlapX - offsetLeft, 0)) + "px"; + } + if (scrolls) for (var node = hints.firstChild; node; node = node.nextSibling) + node.style.paddingRight = cm.display.nativeBarWidth + "px" + + cm.addKeyMap(this.keyMap = buildKeyMap(completion, { + moveFocus: function(n, avoidWrap) { widget.changeActive(widget.selectedHint + n, avoidWrap); }, + setFocus: function(n) { widget.changeActive(n); }, + menuSize: function() { return widget.screenAmount(); }, + length: completions.length, + close: function() { completion.close(); }, + pick: function() { widget.pick(); }, + data: data + })); + + if (completion.options.closeOnUnfocus) { + var closingOnBlur; + cm.on("blur", this.onBlur = function() { closingOnBlur = setTimeout(function() { completion.close(); }, 100); }); + cm.on("focus", this.onFocus = function() { clearTimeout(closingOnBlur); }); + } + + cm.on("scroll", this.onScroll = function() { + var curScroll = cm.getScrollInfo(), editor = cm.getWrapperElement().getBoundingClientRect(); + if (!startScroll) startScroll = cm.getScrollInfo(); + var newTop = top + startScroll.top - curScroll.top; + var point = newTop - (parentWindow.pageYOffset || (ownerDocument.documentElement || ownerDocument.body).scrollTop); + if (!below) point += hints.offsetHeight; + if (point <= editor.top || point >= editor.bottom) return completion.close(); + hints.style.top = newTop + "px"; + hints.style.left = (left + startScroll.left - curScroll.left) + "px"; + }); + + CodeMirror.on(hints, "dblclick", function(e) { + var t = getHintElement(hints, e.target || e.srcElement); + if (t && t.hintId != null) {widget.changeActive(t.hintId); widget.pick();} + }); + + CodeMirror.on(hints, "click", function(e) { + var t = getHintElement(hints, e.target || e.srcElement); + if (t && t.hintId != null) { + widget.changeActive(t.hintId); + if (completion.options.completeOnSingleClick) widget.pick(); + } + }); + + CodeMirror.on(hints, "mousedown", function() { + setTimeout(function(){cm.focus();}, 20); + }); + + // The first hint doesn't need to be scrolled to on init + var selectedHintRange = this.getSelectedHintRange(); + if (selectedHintRange.from !== 0 || selectedHintRange.to !== 0) { + this.scrollToActive(); + } + + CodeMirror.signal(data, "select", completions[this.selectedHint], hints.childNodes[this.selectedHint]); + return true; + } + + Widget.prototype = { + close: function() { + if (this.completion.widget != this) return; + this.completion.widget = null; + if (this.hints.parentNode) this.hints.parentNode.removeChild(this.hints); + this.completion.cm.removeKeyMap(this.keyMap); + var input = this.completion.cm.getInputField() + input.removeAttribute("aria-activedescendant") + input.removeAttribute("aria-owns") + + var cm = this.completion.cm; + if (this.completion.options.closeOnUnfocus) { + cm.off("blur", this.onBlur); + cm.off("focus", this.onFocus); + } + cm.off("scroll", this.onScroll); + }, + + disable: function() { + this.completion.cm.removeKeyMap(this.keyMap); + var widget = this; + this.keyMap = {Enter: function() { widget.picked = true; }}; + this.completion.cm.addKeyMap(this.keyMap); + }, + + pick: function() { + this.completion.pick(this.data, this.selectedHint); + }, + + changeActive: function(i, avoidWrap) { + if (i >= this.data.list.length) + i = avoidWrap ? this.data.list.length - 1 : 0; + else if (i < 0) + i = avoidWrap ? 0 : this.data.list.length - 1; + if (this.selectedHint == i) return; + var node = this.hints.childNodes[this.selectedHint]; + if (node) { + node.className = node.className.replace(" " + ACTIVE_HINT_ELEMENT_CLASS, ""); + node.removeAttribute("aria-selected") + } + node = this.hints.childNodes[this.selectedHint = i]; + node.className += " " + ACTIVE_HINT_ELEMENT_CLASS; + node.setAttribute("aria-selected", "true") + this.completion.cm.getInputField().setAttribute("aria-activedescendant", node.id) + this.scrollToActive() + CodeMirror.signal(this.data, "select", this.data.list[this.selectedHint], node); + }, + + scrollToActive: function() { + var selectedHintRange = this.getSelectedHintRange(); + var node1 = this.hints.childNodes[selectedHintRange.from]; + var node2 = this.hints.childNodes[selectedHintRange.to]; + var firstNode = this.hints.firstChild; + if (node1.offsetTop < this.hints.scrollTop) + this.hints.scrollTop = node1.offsetTop - firstNode.offsetTop; + else if (node2.offsetTop + node2.offsetHeight > this.hints.scrollTop + this.hints.clientHeight) + this.hints.scrollTop = node2.offsetTop + node2.offsetHeight - this.hints.clientHeight + firstNode.offsetTop; + }, + + screenAmount: function() { + return Math.floor(this.hints.clientHeight / this.hints.firstChild.offsetHeight) || 1; + }, + + getSelectedHintRange: function() { + var margin = this.completion.options.scrollMargin || 0; + return { + from: Math.max(0, this.selectedHint - margin), + to: Math.min(this.data.list.length - 1, this.selectedHint + margin), + }; + } + }; + + function applicableHelpers(cm, helpers) { + if (!cm.somethingSelected()) return helpers + var result = [] + for (var i = 0; i < helpers.length; i++) + if (helpers[i].supportsSelection) result.push(helpers[i]) + return result + } + + function fetchHints(hint, cm, options, callback) { + if (hint.async) { + hint(cm, callback, options) + } else { + var result = hint(cm, options) + if (result && result.then) result.then(callback) + else callback(result) + } + } + + function resolveAutoHints(cm, pos) { + var helpers = cm.getHelpers(pos, "hint"), words + if (helpers.length) { + var resolved = function(cm, callback, options) { + var app = applicableHelpers(cm, helpers); + function run(i) { + if (i == app.length) return callback(null) + fetchHints(app[i], cm, options, function(result) { + if (result && result.list.length > 0) callback(result) + else run(i + 1) + }) + } + run(0) + } + resolved.async = true + resolved.supportsSelection = true + return resolved + } else if (words = cm.getHelper(cm.getCursor(), "hintWords")) { + return function(cm) { return CodeMirror.hint.fromList(cm, {words: words}) } + } else if (CodeMirror.hint.anyword) { + return function(cm, options) { return CodeMirror.hint.anyword(cm, options) } + } else { + return function() {} + } + } + + CodeMirror.registerHelper("hint", "auto", { + resolve: resolveAutoHints + }); + + CodeMirror.registerHelper("hint", "fromList", function(cm, options) { + var cur = cm.getCursor(), token = cm.getTokenAt(cur) + var term, from = CodeMirror.Pos(cur.line, token.start), to = cur + if (token.start < cur.ch && /\w/.test(token.string.charAt(cur.ch - token.start - 1))) { + term = token.string.substr(0, cur.ch - token.start) + } else { + term = "" + from = cur + } + var found = []; + for (var i = 0; i < options.words.length; i++) { + var word = options.words[i]; + if (word.slice(0, term.length) == term) + found.push(word); + } + + if (found.length) return {list: found, from: from, to: to}; + }); + + CodeMirror.commands.autocomplete = CodeMirror.showHint; + + var defaultOptions = { + hint: CodeMirror.hint.auto, + completeSingle: true, + alignWithWord: true, + closeCharacters: /[\s()\[\]{};:>,]/, + closeOnPick: true, + closeOnUnfocus: true, + updateOnCursorActivity: true, + completeOnSingleClick: true, + container: null, + customKeys: null, + extraKeys: null, + paddingForScrollbar: true, + moveOnOverlap: true, + }; + + CodeMirror.defineOption("hintOptions", null); +}); diff --git a/mounts/zoperepo/__root__/lib/js/vision_bundle_js/__source__.js b/mounts/zoperepo/__root__/lib/js/vision_bundle_js/__source__.js index 53d2c80..aa61450 100644 --- a/mounts/zoperepo/__root__/lib/js/vision_bundle_js/__source__.js +++ b/mounts/zoperepo/__root__/lib/js/vision_bundle_js/__source__.js @@ -1 +1 @@ -var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},vision={},fileset_resolver={};let supportsSimd;Object.defineProperty(fileset_resolver,"__esModule",{value:!0}),fileset_resolver.FilesetResolver=void 0;const WASM_SIMD_CHECK=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]);async function isSimdSupported(){if(void 0===supportsSimd)try{await WebAssembly.instantiate(WASM_SIMD_CHECK),supportsSimd=!0}catch(e){supportsSimd=!1}return supportsSimd}async function createFileset(e,t=""){const r=await isSimdSupported()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}class FilesetResolver$1{static isSimdSupported(){return isSimdSupported()}static forAudioTasks(e){return createFileset("audio",e)}static forTextTasks(e){return createFileset("text",e)}static forVisionTasks(e){return createFileset("vision",e)}}fileset_resolver.FilesetResolver=FilesetResolver$1;var drawing_utils={};Object.defineProperty(drawing_utils,"__esModule",{value:!0}),drawing_utils.DrawingUtils=void 0;const DEFAULT_OPTIONS={color:"white",lineWidth:4,radius:6};function addDefaultOptions(e){return e=e||{},Object.assign(Object.assign(Object.assign({},DEFAULT_OPTIONS),{fillColor:e.color}),e)}function resolve(e,t){return e instanceof Function?e(t):e}class DrawingUtils$1{constructor(e){this.ctx=e}static clamp(e,t,r){const o=Math.min(t,r),i=Math.max(t,r);return Math.max(o,Math.min(i,e))}static lerp(e,t,r,o,i){const a=o*(1-(e-t)/(r-t))+i*(1-(r-e)/(r-t));return DrawingUtils$1.clamp(a,o,i)}drawLandmarks(e,t){if(!e)return;const r=this.ctx,o=addDefaultOptions(t);r.save();const i=r.canvas;let a=0;for(const t of e){r.fillStyle=resolve(o.fillColor,{index:a,from:t}),r.strokeStyle=resolve(o.color,{index:a,from:t}),r.lineWidth=resolve(o.lineWidth,{index:a,from:t});const e=new Path2D;e.arc(t.x*i.width,t.y*i.height,resolve(o.radius,{index:a,from:t}),0,2*Math.PI),r.fill(e),r.stroke(e),++a}r.restore()}drawConnectors(e,t,r){if(!e||!t)return;const o=this.ctx,i=addDefaultOptions(r);o.save();const a=o.canvas;let n=0;for(const r of t){o.beginPath();const t=e[r.start],s=e[r.end];t&&s&&(o.strokeStyle=resolve(i.color,{index:n,from:t,to:s}),o.lineWidth=resolve(i.lineWidth,{index:n,from:t,to:s}),o.moveTo(t.x*a.width,t.y*a.height),o.lineTo(s.x*a.width,s.y*a.height)),++n,o.stroke()}o.restore()}drawBoundingBox(e,t){const r=this.ctx,o=addDefaultOptions(t);r.save(),r.beginPath(),r.lineWidth=resolve(o.lineWidth,{}),r.strokeStyle=resolve(o.color,{}),r.fillStyle=resolve(o.fillColor,{}),r.moveTo(e.originX,e.originY),r.lineTo(e.originX+e.width,e.originY),r.lineTo(e.originX+e.width,e.originY+e.height),r.lineTo(e.originX,e.originY+e.height),r.lineTo(e.originX,e.originY),r.stroke(),r.fill(),r.restore()}}drawing_utils.DrawingUtils=DrawingUtils$1;var image={},image_shader_context={};Object.defineProperty(image_shader_context,"__esModule",{value:!0}),image_shader_context.MPImageShaderContext=image_shader_context.assertNotNull=void 0;const VERTEX_SHADER="\n attribute vec2 aVertex;\n attribute vec2 aTex;\n varying vec2 vTex;\n void main(void) {\n gl_Position = vec4(aVertex, 0.0, 1.0);\n vTex = aTex;\n }",FRAGMENT_SHADER="\n precision mediump float;\n varying vec2 vTex;\n uniform sampler2D inputTexture;\n void main() {\n gl_FragColor = texture2D(inputTexture, vTex);\n }\n ";function assertNotNull(e,t){if(null===e)throw new Error(`Unable to obtain required WebGL resource: ${t}`);return e}image_shader_context.assertNotNull=assertNotNull;class MPImageShaderBuffers{constructor(e,t,r,o){this.gl=e,this.vertexArrayObject=t,this.vertexBuffer=r,this.textureBuffer=o}bind(){this.gl.bindVertexArray(this.vertexArrayObject)}unbind(){this.gl.bindVertexArray(null)}close(){this.gl.deleteVertexArray(this.vertexArrayObject),this.gl.deleteBuffer(this.vertexBuffer),this.gl.deleteBuffer(this.textureBuffer)}}class MPImageShaderContext{compileShader(e,t){const r=this.gl,o=assertNotNull(r.createShader(t),"Failed to create WebGL shader");if(r.shaderSource(o,e),r.compileShader(o),!r.getShaderParameter(o,r.COMPILE_STATUS)){const e=r.getShaderInfoLog(o);throw new Error(`Could not compile WebGL shader: ${e}`)}return r.attachShader(this.program,o),o}setupShaders(){const e=this.gl;this.program=assertNotNull(e.createProgram(),"Failed to create WebGL program"),this.vertexShader=this.compileShader(VERTEX_SHADER,e.VERTEX_SHADER),this.fragmentShader=this.compileShader(FRAGMENT_SHADER,e.FRAGMENT_SHADER),e.linkProgram(this.program);if(!e.getProgramParameter(this.program,e.LINK_STATUS)){const t=e.getProgramInfoLog(this.program);throw new Error(`Error during program linking: ${t}`)}this.aVertex=e.getAttribLocation(this.program,"aVertex"),this.aTex=e.getAttribLocation(this.program,"aTex")}createBuffers(e){const t=this.gl,r=assertNotNull(t.createVertexArray(),"Failed to create vertex array");t.bindVertexArray(r);const o=assertNotNull(t.createBuffer(),"Failed to create buffer");t.bindBuffer(t.ARRAY_BUFFER,o),t.enableVertexAttribArray(this.aVertex),t.vertexAttribPointer(this.aVertex,2,t.FLOAT,!1,0,0),t.bufferData(t.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),t.STATIC_DRAW);const i=assertNotNull(t.createBuffer(),"Failed to create buffer");t.bindBuffer(t.ARRAY_BUFFER,i),t.enableVertexAttribArray(this.aTex),t.vertexAttribPointer(this.aTex,2,t.FLOAT,!1,0,0);const a=e?[0,1,0,0,1,0,1,1]:[0,0,0,1,1,1,1,0];return t.bufferData(t.ARRAY_BUFFER,new Float32Array(a),t.STATIC_DRAW),t.bindBuffer(t.ARRAY_BUFFER,null),t.bindVertexArray(null),new MPImageShaderBuffers(t,r,o,i)}getShaderBuffers(e){return e?(this.shaderBuffersFlipVertically||(this.shaderBuffersFlipVertically=this.createBuffers(!0)),this.shaderBuffersFlipVertically):(this.shaderBuffersPassthrough||(this.shaderBuffersPassthrough=this.createBuffers(!1)),this.shaderBuffersPassthrough)}maybeInitGL(e){if(this.gl){if(e!==this.gl)throw new Error("Cannot change GL context once initialized")}else this.gl=e}run(e,t,r){this.maybeInitGL(e),this.program||this.setupShaders();const o=this.getShaderBuffers(t);e.useProgram(this.program),o.bind();const i=r();return o.unbind(),i}bindFramebuffer(e,t){this.maybeInitGL(e),this.framebuffer||(this.framebuffer=assertNotNull(e.createFramebuffer(),"Failed to create framebuffe.")),e.bindFramebuffer(e.FRAMEBUFFER,this.framebuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)}unbindFramebuffer(){var e;null===(e=this.gl)||void 0===e||e.bindFramebuffer(this.gl.FRAMEBUFFER,null)}close(){if(this.program){const e=this.gl;e.deleteProgram(this.program),e.deleteShader(this.vertexShader),e.deleteShader(this.fragmentShader)}this.framebuffer&&this.gl.deleteFramebuffer(this.framebuffer),this.shaderBuffersPassthrough&&this.shaderBuffersPassthrough.close(),this.shaderBuffersFlipVertically&&this.shaderBuffersFlipVertically.close()}}image_shader_context.MPImageShaderContext=MPImageShaderContext,Object.defineProperty(image,"__esModule",{value:!0}),image.MPImage=void 0;const image_shader_context_1$2=image_shader_context;var MPImageType;!function(e){e[e.IMAGE_DATA=0]="IMAGE_DATA",e[e.IMAGE_BITMAP=1]="IMAGE_BITMAP",e[e.WEBGL_TEXTURE=2]="WEBGL_TEXTURE"}(MPImageType||(MPImageType={}));class MPImage$1{constructor(e,t,r,o,i,a,n){this.containers=e,this.ownsImageBitmap=t,this.ownsWebGLTexture=r,this.canvas=o,this.shaderContext=i,this.width=a,this.height=n}hasImageData(){return!!this.getContainer(MPImageType.IMAGE_DATA)}hasImageBitmap(){return!!this.getContainer(MPImageType.IMAGE_BITMAP)}hasWebGLTexture(){return!!this.getContainer(MPImageType.WEBGL_TEXTURE)}getAsImageData(){return this.convertToImageData()}getAsImageBitmap(){return this.convertToImageBitmap()}getAsWebGLTexture(){return this.convertToWebGLTexture()}getContainer(e){switch(e){case MPImageType.IMAGE_DATA:return this.containers.find((e=>e instanceof ImageData));case MPImageType.IMAGE_BITMAP:return this.containers.find((e=>"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap));case MPImageType.WEBGL_TEXTURE:return this.containers.find((e=>"undefined"!=typeof WebGLTexture&&e instanceof WebGLTexture));default:throw new Error(`Type is not supported: ${e}`)}}clone(){const e=[];for(const t of this.containers){let r;if(t instanceof ImageData)r=new ImageData(t.data,this.width,this.height);else if(t instanceof WebGLTexture){const e=this.getGL(),t=this.getShaderContext();e.activeTexture(e.TEXTURE1),r=(0,image_shader_context_1$2.assertNotNull)(e.createTexture(),"Failed to create texture"),e.bindTexture(e.TEXTURE_2D,r),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,this.width,this.height,0,e.RGBA,e.UNSIGNED_BYTE,null),t.bindFramebuffer(e,r),t.run(e,!1,(()=>{this.bindTexture(),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.drawArrays(e.TRIANGLE_FAN,0,4),this.unbindTexture()})),t.unbindFramebuffer(),this.unbindTexture()}else{if(!(t instanceof ImageBitmap))throw new Error(`Type is not supported: ${t}`);this.convertToWebGLTexture(),this.bindTexture(),r=this.copyTextureToBitmap(),this.unbindTexture()}e.push(r)}return new MPImage$1(e,this.hasImageBitmap(),this.hasWebGLTexture(),this.canvas,this.shaderContext,this.width,this.height)}getOffscreenCanvas(){if(!(this.canvas instanceof OffscreenCanvas))throw new Error("Conversion to ImageBitmap requires that the MediaPipe Tasks is initialized with an OffscreenCanvas");return this.canvas}getGL(){if(!this.canvas)throw new Error("Conversion to different image formats require that a canvas is passed when iniitializing the image.");return this.gl||(this.gl=(0,image_shader_context_1$2.assertNotNull)(this.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),this.gl}getShaderContext(){return this.shaderContext||(this.shaderContext=new image_shader_context_1$2.MPImageShaderContext),this.shaderContext}convertToImageBitmap(){let e=this.getContainer(MPImageType.IMAGE_BITMAP);return e||(this.convertToWebGLTexture(),e=this.convertWebGLTextureToImageBitmap(),this.containers.push(e),this.ownsImageBitmap=!0),e}convertToImageData(){let e=this.getContainer(MPImageType.IMAGE_DATA);if(!e){const t=this.getGL(),r=this.getShaderContext(),o=new Uint8Array(this.width*this.height*4),i=this.convertToWebGLTexture();r.bindFramebuffer(t,i),t.readPixels(0,0,this.width,this.height,t.RGBA,t.UNSIGNED_BYTE,o),r.unbindFramebuffer(),e=new ImageData(new Uint8ClampedArray(o.buffer),this.width,this.height),this.containers.push(e)}return e}convertToWebGLTexture(){let e=this.getContainer(MPImageType.WEBGL_TEXTURE);if(!e){const t=this.getGL();e=this.bindTexture();const r=this.getContainer(MPImageType.IMAGE_BITMAP)||this.convertToImageData();t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,r),this.unbindTexture()}return e}bindTexture(){const e=this.getGL();e.viewport(0,0,this.width,this.height),e.activeTexture(e.TEXTURE0);let t=this.getContainer(MPImageType.WEBGL_TEXTURE);return t||(t=(0,image_shader_context_1$2.assertNotNull)(e.createTexture(),"Failed to create texture"),this.containers.push(t),this.ownsWebGLTexture=!0),e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),t}unbindTexture(){this.gl.bindTexture(this.gl.TEXTURE_2D,null)}copyTextureToBitmap(){const e=this.getGL();return this.getShaderContext().run(e,!0,(()=>this.runWithResizedCanvas((()=>(e.bindFramebuffer(e.FRAMEBUFFER,null),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.drawArrays(e.TRIANGLE_FAN,0,4),this.getOffscreenCanvas().transferToImageBitmap())))))}convertWebGLTextureToImageBitmap(){this.bindTexture();const e=this.copyTextureToBitmap();return this.unbindTexture(),e}runWithResizedCanvas(e){const t=this.canvas;if(t.width===this.width&&t.height===this.height)return e();const r=t.width,o=t.height;t.width=this.width,t.height=this.height;const i=e();return t.width=r,t.height=o,i}close(){if(this.ownsImageBitmap&&this.getContainer(MPImageType.IMAGE_BITMAP).close(),this.ownsWebGLTexture){this.getGL().deleteTexture(this.getContainer(MPImageType.WEBGL_TEXTURE))}}}image.MPImage=MPImage$1;var mask={};Object.defineProperty(mask,"__esModule",{value:!0}),mask.MPMask=void 0;const image_shader_context_1$1=image_shader_context;var MPMaskType;!function(e){e[e.UINT8_ARRAY=0]="UINT8_ARRAY",e[e.FLOAT32_ARRAY=1]="FLOAT32_ARRAY",e[e.WEBGL_TEXTURE=2]="WEBGL_TEXTURE"}(MPMaskType||(MPMaskType={}));class MPMask$1{constructor(e,t,r,o,i,a){this.containers=e,this.ownsWebGLTexture=t,this.canvas=r,this.shaderContext=o,this.width=i,this.height=a}hasUint8Array(){return!!this.getContainer(MPMaskType.UINT8_ARRAY)}hasFloat32Array(){return!!this.getContainer(MPMaskType.FLOAT32_ARRAY)}hasWebGLTexture(){return!!this.getContainer(MPMaskType.WEBGL_TEXTURE)}getAsUint8Array(){return this.convertToUint8Array()}getAsFloat32Array(){return this.convertToFloat32Array()}getAsWebGLTexture(){return this.convertToWebGLTexture()}getContainer(e){switch(e){case MPMaskType.UINT8_ARRAY:return this.containers.find((e=>e instanceof Uint8Array));case MPMaskType.FLOAT32_ARRAY:return this.containers.find((e=>e instanceof Float32Array));case MPMaskType.WEBGL_TEXTURE:return this.containers.find((e=>"undefined"!=typeof WebGLTexture&&e instanceof WebGLTexture));default:throw new Error(`Type is not supported: ${e}`)}}clone(){const e=[];for(const t of this.containers){let r;if(t instanceof Uint8Array)r=new Uint8Array(t);else if(t instanceof Float32Array)r=new Float32Array(t);else{if(!(t instanceof WebGLTexture))throw new Error(`Type is not supported: ${t}`);{const e=this.getGL(),t=this.getShaderContext();e.activeTexture(e.TEXTURE1),r=(0,image_shader_context_1$1.assertNotNull)(e.createTexture(),"Failed to create texture"),e.bindTexture(e.TEXTURE_2D,r),e.texImage2D(e.TEXTURE_2D,0,e.R32F,this.width,this.height,0,e.RED,e.FLOAT,null),e.bindTexture(e.TEXTURE_2D,null),t.bindFramebuffer(e,r),t.run(e,!1,(()=>{this.bindTexture(),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.drawArrays(e.TRIANGLE_FAN,0,4),this.unbindTexture()})),t.unbindFramebuffer(),this.unbindTexture()}}e.push(r)}return new MPMask$1(e,this.hasWebGLTexture(),this.canvas,this.shaderContext,this.width,this.height)}getGL(){if(!this.canvas)throw new Error("Conversion to different image formats require that a canvas is passed when iniitializing the image.");this.gl||(this.gl=(0,image_shader_context_1$1.assertNotNull)(this.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context."));if(!this.gl.getExtension("EXT_color_buffer_float"))throw new Error("Missing required EXT_color_buffer_float extension");return this.gl}getShaderContext(){return this.shaderContext||(this.shaderContext=new image_shader_context_1$1.MPImageShaderContext),this.shaderContext}convertToFloat32Array(){let e=this.getContainer(MPMaskType.FLOAT32_ARRAY);if(!e){const t=this.getContainer(MPMaskType.UINT8_ARRAY);if(t)e=new Float32Array(t).map((e=>e/255));else{const t=this.getGL(),r=this.getShaderContext();e=new Float32Array(this.width*this.height);const o=this.convertToWebGLTexture();r.bindFramebuffer(t,o),t.readPixels(0,0,this.width,this.height,t.RED,t.FLOAT,e),r.unbindFramebuffer()}this.containers.push(e)}return e}convertToUint8Array(){let e=this.getContainer(MPMaskType.UINT8_ARRAY);if(!e){const t=this.convertToFloat32Array();e=new Uint8Array(t.map((e=>255*e))),this.containers.push(e)}return e}convertToWebGLTexture(){let e=this.getContainer(MPMaskType.WEBGL_TEXTURE);if(!e){const t=this.getGL();e=this.bindTexture();const r=this.convertToFloat32Array();t.texImage2D(t.TEXTURE_2D,0,t.R32F,this.width,this.height,0,t.RED,t.FLOAT,r),this.unbindTexture()}return e}bindTexture(){const e=this.getGL();e.viewport(0,0,this.width,this.height),e.activeTexture(e.TEXTURE0);let t=this.getContainer(MPMaskType.WEBGL_TEXTURE);return t||(t=(0,image_shader_context_1$1.assertNotNull)(e.createTexture(),"Failed to create texture"),this.containers.push(t),this.ownsWebGLTexture=!0),e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),t}unbindTexture(){this.gl.bindTexture(this.gl.TEXTURE_2D,null)}close(){if(this.ownsWebGLTexture){this.getGL().deleteTexture(this.getContainer(MPMaskType.WEBGL_TEXTURE))}}}mask.MPMask=MPMask$1;var face_detector={},calculator_pb={},googleProtobuf={};(function(exports){var $jscomp=$jscomp||{};$jscomp.scope={},$jscomp.findInternal=function(e,t,r){e instanceof String&&(e=String(e));for(var o=e.length,i=0;i=o}}),"es6","es3"),$jscomp.polyfill("Array.prototype.find",(function(e){return e||function(e,t){return $jscomp.findInternal(this,e,t).v}}),"es6","es3"),$jscomp.polyfill("String.prototype.startsWith",(function(e){return e||function(e,t){var r=$jscomp.checkStringArgs(this,e,"startsWith");e+="";var o=r.length,i=e.length;t=Math.max(0,Math.min(0|t,r.length));for(var a=0;a=i}}),"es6","es3"),$jscomp.polyfill("String.prototype.repeat",(function(e){return e||function(e){var t=$jscomp.checkStringArgs(this,null,"repeat");if(0>e||1342177279>>=1)&&(t+=t);return r}}),"es6","es3");var COMPILED=!0,goog=goog||{};goog.global=commonjsGlobal||self,goog.exportPath_=function(e,t,r){e=e.split("."),r=r||goog.global,e[0]in r||void 0===r.execScript||r.execScript("var "+e[0]);for(var o;e.length&&(o=e.shift());)e.length||void 0===t?r=r[o]&&r[o]!==Object.prototype[o]?r[o]:r[o]={}:r[o]=t},goog.define=function(e,t){return t},goog.FEATURESET_YEAR=2012,goog.DEBUG=!0,goog.LOCALE="en",goog.TRUSTED_SITE=!0,goog.STRICT_MODE_COMPATIBLE=!1,goog.DISALLOW_TEST_ONLY_CODE=!goog.DEBUG,goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING=!1,goog.provide=function(e){if(goog.isInModuleLoader_())throw Error("goog.provide cannot be used within a module.");goog.constructNamespace_(e)},goog.constructNamespace_=function(e,t){goog.exportPath_(e,t)},goog.getScriptNonce=function(e){return e&&e!=goog.global?goog.getScriptNonce_(e.document):(null===goog.cspNonce_&&(goog.cspNonce_=goog.getScriptNonce_(goog.global.document)),goog.cspNonce_)},goog.NONCE_PATTERN_=/^[\w+/_-]+[=]{0,2}$/,goog.cspNonce_=null,goog.getScriptNonce_=function(e){return(e=e.querySelector&&e.querySelector("script[nonce]"))&&(e=e.nonce||e.getAttribute("nonce"))&&goog.NONCE_PATTERN_.test(e)?e:""},goog.VALID_MODULE_RE_=/^[a-zA-Z_$][a-zA-Z0-9._$]*$/,goog.module=function(e){if("string"!=typeof e||!e||-1==e.search(goog.VALID_MODULE_RE_))throw Error("Invalid module identifier");if(!goog.isInGoogModuleLoader_())throw Error("Module "+e+" has been loaded incorrectly. Note, modules cannot be loaded as normal scripts. They require some kind of pre-processing step. You're likely trying to load a module via a script tag or as a part of a concatenated bundle without rewriting the module. For more info see: https://github.com/google/closure-library/wiki/goog.module:-an-ES6-module-like-alternative-to-goog.provide.");if(goog.moduleLoaderState_.moduleName)throw Error("goog.module may only be called once per module.");goog.moduleLoaderState_.moduleName=e},goog.module.get=function(e){return goog.module.getInternal_(e)},goog.module.getInternal_=function(e){return null},goog.ModuleType={ES6:"es6",GOOG:"goog"},goog.moduleLoaderState_=null,goog.isInModuleLoader_=function(){return goog.isInGoogModuleLoader_()||goog.isInEs6ModuleLoader_()},goog.isInGoogModuleLoader_=function(){return!!goog.moduleLoaderState_&&goog.moduleLoaderState_.type==goog.ModuleType.GOOG},goog.isInEs6ModuleLoader_=function(){if(goog.moduleLoaderState_&&goog.moduleLoaderState_.type==goog.ModuleType.ES6)return!0;var e=goog.global.$jscomp;return!!e&&("function"==typeof e.getCurrentModulePath&&!!e.getCurrentModulePath())},goog.module.declareLegacyNamespace=function(){goog.moduleLoaderState_.declareLegacyNamespace=!0},goog.declareModuleId=function(e){if(goog.moduleLoaderState_)goog.moduleLoaderState_.moduleName=e;else{var t=goog.global.$jscomp;if(!t||"function"!=typeof t.getCurrentModulePath)throw Error('Module with namespace "'+e+'" has been loaded incorrectly.');t=t.require(t.getCurrentModulePath()),goog.loadedModules_[e]={exports:t,type:goog.ModuleType.ES6,moduleId:e}}},goog.setTestOnly=function(e){if(goog.DISALLOW_TEST_ONLY_CODE)throw e=e||"",Error("Importing test-only code into non-debug environment"+(e?": "+e:"."))},goog.forwardDeclare=function(e){},goog.getObjectByName=function(e,t){e=e.split("."),t=t||goog.global;for(var r=0;r>>0),goog.uidCounter_=0,goog.getHashCode=goog.getUid,goog.removeHashCode=goog.removeUid,goog.cloneObject=function(e){var t=goog.typeOf(e);if("object"==t||"array"==t){if("function"==typeof e.clone)return e.clone();for(var r in t="array"==t?[]:{},e)t[r]=goog.cloneObject(e[r]);return t}return e},goog.bindNative_=function(e,t,r){return e.call.apply(e.bind,arguments)},goog.bindJs_=function(e,t,r){if(!e)throw Error();if(2r?Math.max(0,e.length+r):r,"string"==typeof e)return"string"!=typeof t||1!=t.length?-1:e.indexOf(t,r);for(;r(r=null==r?e.length-1:r)&&(r=Math.max(0,e.length+r)),"string"==typeof e)return"string"!=typeof t||1!=t.length?-1:e.lastIndexOf(t,r);for(;0<=r;r--)if(r in e&&e[r]===t)return r;return-1},goog.array.forEach=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.forEach)?function(e,t,r){goog.asserts.assert(null!=e.length),Array.prototype.forEach.call(e,t,r)}:function(e,t,r){for(var o=e.length,i="string"==typeof e?e.split(""):e,a=0;a(t=goog.array.findIndex(e,t,r))?null:"string"==typeof e?e.charAt(t):e[t]},goog.array.findIndex=function(e,t,r){for(var o=e.length,i="string"==typeof e?e.split(""):e,a=0;a(t=goog.array.findIndexRight(e,t,r))?null:"string"==typeof e?e.charAt(t):e[t]},goog.array.findIndexRight=function(e,t,r){var o=e.length,i="string"==typeof e?e.split(""):e;for(--o;0<=o;o--)if(o in i&&t.call(r,i[o],o,e))return o;return-1},goog.array.contains=function(e,t){return 0<=goog.array.indexOf(e,t)},goog.array.isEmpty=function(e){return 0==e.length},goog.array.clear=function(e){if(!Array.isArray(e))for(var t=e.length-1;0<=t;t--)delete e[t];e.length=0},goog.array.insert=function(e,t){goog.array.contains(e,t)||e.push(t)},goog.array.insertAt=function(e,t,r){goog.array.splice(e,r,0,t)},goog.array.insertArrayAt=function(e,t,r){goog.partial(goog.array.splice,e,r,0).apply(null,t)},goog.array.insertBefore=function(e,t,r){var o;2==arguments.length||0>(o=goog.array.indexOf(e,r))?e.push(t):goog.array.insertAt(e,t,o)},goog.array.remove=function(e,t){var r;return(r=0<=(t=goog.array.indexOf(e,t)))&&goog.array.removeAt(e,t),r},goog.array.removeLast=function(e,t){return 0<=(t=goog.array.lastIndexOf(e,t))&&(goog.array.removeAt(e,t),!0)},goog.array.removeAt=function(e,t){return goog.asserts.assert(null!=e.length),1==Array.prototype.splice.call(e,t,1).length},goog.array.removeIf=function(e,t,r){return 0<=(t=goog.array.findIndex(e,t,r))&&(goog.array.removeAt(e,t),!0)},goog.array.removeAllIf=function(e,t,r){var o=0;return goog.array.forEachRight(e,(function(i,a){t.call(r,i,a,e)&&goog.array.removeAt(e,a)&&o++})),o},goog.array.concat=function(e){return Array.prototype.concat.apply([],arguments)},goog.array.join=function(e){return Array.prototype.concat.apply([],arguments)},goog.array.toArray=function(e){var t=e.length;if(0=arguments.length?Array.prototype.slice.call(e,t):Array.prototype.slice.call(e,t,r)},goog.array.removeDuplicates=function(e,t,r){t=t||e;var o=function(e){return goog.isObject(e)?"o"+goog.getUid(e):(typeof e).charAt(0)+e};r=r||o,o={};for(var i=0,a=0;a>>1),d=r?t.call(i,e[p],p,e):t(o,e[p]);0t?1:e(r=goog.array.binarySearch(e,t,r))&&(goog.array.insertAt(e,t,-(r+1)),!0)},goog.array.binaryRemove=function(e,t,r){return 0<=(t=goog.array.binarySearch(e,t,r))&&goog.array.removeAt(e,t)},goog.array.bucket=function(e,t,r){for(var o={},i=0;i(r=r||1)*(a-i))return[];if(0a;e+=r)o.push(e);return o},goog.array.repeat=function(e,t){for(var r=[],o=0;ot&&Array.prototype.push.apply(e,e.splice(0,-t))),e},goog.array.moveItem=function(e,t,r){goog.asserts.assert(0<=t&&t>=8),t[r++]=i}return t},goog.crypt.byteArrayToString=function(e){if(8192>=e.length)return String.fromCharCode.apply(null,e);for(var t="",r=0;ri?t[r++]=i:(2048>i?t[r++]=i>>6|192:(55296==(64512&i)&&o+1>18|240,t[r++]=i>>12&63|128):t[r++]=i>>12|224,t[r++]=i>>6&63|128),t[r++]=63&i|128)}return t},goog.crypt.utf8ByteArrayToString=function(e){for(var t=[],r=0,o=0;ri)t[o++]=String.fromCharCode(i);else if(191i){var a=e[r++];t[o++]=String.fromCharCode((31&i)<<6|63&a)}else if(239i){a=e[r++];var n=e[r++];i=((7&i)<<18|(63&a)<<12|(63&n)<<6|63&e[r++])-65536,t[o++]=String.fromCharCode(55296+(i>>10)),t[o++]=String.fromCharCode(56320+(1023&i))}else a=e[r++],n=e[r++],t[o++]=String.fromCharCode((15&i)<<12|(63&a)<<6|63&n)}return t.join("")},goog.crypt.xorByteArray=function(e,t){goog.asserts.assert(e.length==t.length,"XOR array lengths must match");for(var r=[],o=0;o"}},goog.dom.asserts.getWindow_=function(e){try{var t=e&&e.ownerDocument,r=t&&(t.defaultView||t.parentWindow);if((r=r||goog.global).Element&&r.Location)return r}catch(e){}return null},goog.functions={},goog.functions.constant=function(e){return function(){return e}},goog.functions.FALSE=function(){return!1},goog.functions.TRUE=function(){return!0},goog.functions.NULL=function(){return null},goog.functions.identity=function(e,t){return e},goog.functions.error=function(e){return function(){throw Error(e)}},goog.functions.fail=function(e){return function(){throw e}},goog.functions.lock=function(e,t){return t=t||0,function(){return e.apply(this,Array.prototype.slice.call(arguments,0,t))}},goog.functions.nth=function(e){return function(){return arguments[e]}},goog.functions.partialRight=function(e,t){var r=Array.prototype.slice.call(arguments,1);return function(){var t=Array.prototype.slice.call(arguments);return t.push.apply(t,r),e.apply(this,t)}},goog.functions.withReturnValue=function(e,t){return goog.functions.sequence(e,goog.functions.constant(t))},goog.functions.equalTo=function(e,t){return function(r){return t?e==r:e===r}},goog.functions.compose=function(e,t){var r=arguments,o=r.length;return function(){var e;o&&(e=r[o-1].apply(this,arguments));for(var t=o-2;0<=t;t--)e=r[t].call(this,e);return e}},goog.functions.sequence=function(e){var t=arguments,r=t.length;return function(){for(var e,o=0;oe?goog.i18n.bidi.Dir.RTL:t?null:goog.i18n.bidi.Dir.NEUTRAL:null==e?null:e?goog.i18n.bidi.Dir.RTL:goog.i18n.bidi.Dir.LTR},goog.i18n.bidi.ltrChars_="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ऀ-῿‎Ⰰ-\ud801\ud804-\ud839\ud83c-\udbff豈-﬜︀-﹯﻽-￿",goog.i18n.bidi.rtlChars_="֑-ۯۺ-ࣿ‏\ud802-\ud803\ud83a-\ud83bיִ-﷿ﹰ-ﻼ",goog.i18n.bidi.htmlSkipReg_=/<[^>]*>|&[^;]+;/g,goog.i18n.bidi.stripHtmlIfNeeded_=function(e,t){return t?e.replace(goog.i18n.bidi.htmlSkipReg_,""):e},goog.i18n.bidi.rtlCharReg_=new RegExp("["+goog.i18n.bidi.rtlChars_+"]"),goog.i18n.bidi.ltrCharReg_=new RegExp("["+goog.i18n.bidi.ltrChars_+"]"),goog.i18n.bidi.hasAnyRtl=function(e,t){return goog.i18n.bidi.rtlCharReg_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,t))},goog.i18n.bidi.hasRtlChar=goog.i18n.bidi.hasAnyRtl,goog.i18n.bidi.hasAnyLtr=function(e,t){return goog.i18n.bidi.ltrCharReg_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,t))},goog.i18n.bidi.ltrRe_=new RegExp("^["+goog.i18n.bidi.ltrChars_+"]"),goog.i18n.bidi.rtlRe_=new RegExp("^["+goog.i18n.bidi.rtlChars_+"]"),goog.i18n.bidi.isRtlChar=function(e){return goog.i18n.bidi.rtlRe_.test(e)},goog.i18n.bidi.isLtrChar=function(e){return goog.i18n.bidi.ltrRe_.test(e)},goog.i18n.bidi.isNeutralChar=function(e){return!goog.i18n.bidi.isLtrChar(e)&&!goog.i18n.bidi.isRtlChar(e)},goog.i18n.bidi.ltrDirCheckRe_=new RegExp("^[^"+goog.i18n.bidi.rtlChars_+"]*["+goog.i18n.bidi.ltrChars_+"]"),goog.i18n.bidi.rtlDirCheckRe_=new RegExp("^[^"+goog.i18n.bidi.ltrChars_+"]*["+goog.i18n.bidi.rtlChars_+"]"),goog.i18n.bidi.startsWithRtl=function(e,t){return goog.i18n.bidi.rtlDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,t))},goog.i18n.bidi.isRtlText=goog.i18n.bidi.startsWithRtl,goog.i18n.bidi.startsWithLtr=function(e,t){return goog.i18n.bidi.ltrDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,t))},goog.i18n.bidi.isLtrText=goog.i18n.bidi.startsWithLtr,goog.i18n.bidi.isRequiredLtrRe_=/^http:\/\/.*/,goog.i18n.bidi.isNeutralText=function(e,t){return e=goog.i18n.bidi.stripHtmlIfNeeded_(e,t),goog.i18n.bidi.isRequiredLtrRe_.test(e)||!goog.i18n.bidi.hasAnyLtr(e)&&!goog.i18n.bidi.hasAnyRtl(e)},goog.i18n.bidi.ltrExitDirCheckRe_=new RegExp("["+goog.i18n.bidi.ltrChars_+"][^"+goog.i18n.bidi.rtlChars_+"]*$"),goog.i18n.bidi.rtlExitDirCheckRe_=new RegExp("["+goog.i18n.bidi.rtlChars_+"][^"+goog.i18n.bidi.ltrChars_+"]*$"),goog.i18n.bidi.endsWithLtr=function(e,t){return goog.i18n.bidi.ltrExitDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,t))},goog.i18n.bidi.isLtrExitText=goog.i18n.bidi.endsWithLtr,goog.i18n.bidi.endsWithRtl=function(e,t){return goog.i18n.bidi.rtlExitDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,t))},goog.i18n.bidi.isRtlExitText=goog.i18n.bidi.endsWithRtl,goog.i18n.bidi.rtlLocalesRe_=/^(ar|ckb|dv|he|iw|fa|nqo|ps|sd|ug|ur|yi|.*[-_](Adlm|Arab|Hebr|Nkoo|Rohg|Thaa))(?!.*[-_](Latn|Cyrl)($|-|_))($|-|_)/i,goog.i18n.bidi.isRtlLanguage=function(e){return goog.i18n.bidi.rtlLocalesRe_.test(e)},goog.i18n.bidi.bracketGuardTextRe_=/(\(.*?\)+)|(\[.*?\]+)|(\{.*?\}+)|(<.*?>+)/g,goog.i18n.bidi.guardBracketInText=function(e,t){return t=(void 0===t?goog.i18n.bidi.hasAnyRtl(e):t)?goog.i18n.bidi.Format.RLM:goog.i18n.bidi.Format.LRM,e.replace(goog.i18n.bidi.bracketGuardTextRe_,t+"$&"+t)},goog.i18n.bidi.enforceRtlInHtml=function(e){return"<"==e.charAt(0)?e.replace(/<\w+/,"$& dir=rtl"):"\n"+e+""},goog.i18n.bidi.enforceRtlInText=function(e){return goog.i18n.bidi.Format.RLE+e+goog.i18n.bidi.Format.PDF},goog.i18n.bidi.enforceLtrInHtml=function(e){return"<"==e.charAt(0)?e.replace(/<\w+/,"$& dir=ltr"):"\n"+e+""},goog.i18n.bidi.enforceLtrInText=function(e){return goog.i18n.bidi.Format.LRE+e+goog.i18n.bidi.Format.PDF},goog.i18n.bidi.dimensionsRe_=/:\s*([.\d][.\w]*)\s+([.\d][.\w]*)\s+([.\d][.\w]*)\s+([.\d][.\w]*)/g,goog.i18n.bidi.leftRe_=/left/gi,goog.i18n.bidi.rightRe_=/right/gi,goog.i18n.bidi.tempRe_=/%%%%/g,goog.i18n.bidi.mirrorCSS=function(e){return e.replace(goog.i18n.bidi.dimensionsRe_,":$1 $4 $3 $2").replace(goog.i18n.bidi.leftRe_,"%%%%").replace(goog.i18n.bidi.rightRe_,goog.i18n.bidi.LEFT).replace(goog.i18n.bidi.tempRe_,goog.i18n.bidi.RIGHT)},goog.i18n.bidi.doubleQuoteSubstituteRe_=/([\u0591-\u05f2])"/g,goog.i18n.bidi.singleQuoteSubstituteRe_=/([\u0591-\u05f2])'/g,goog.i18n.bidi.normalizeHebrewQuote=function(e){return e.replace(goog.i18n.bidi.doubleQuoteSubstituteRe_,"$1״").replace(goog.i18n.bidi.singleQuoteSubstituteRe_,"$1׳")},goog.i18n.bidi.wordSeparatorRe_=/\s+/,goog.i18n.bidi.hasNumeralsRe_=/[\d\u06f0-\u06f9]/,goog.i18n.bidi.rtlDetectionThreshold_=.4,goog.i18n.bidi.estimateDirection=function(e,t){var r=0,o=0,i=!1;for(e=goog.i18n.bidi.stripHtmlIfNeeded_(e,t).split(goog.i18n.bidi.wordSeparatorRe_),t=0;tgoog.i18n.bidi.rtlDetectionThreshold_?goog.i18n.bidi.Dir.RTL:goog.i18n.bidi.Dir.LTR},goog.i18n.bidi.detectRtlDirectionality=function(e,t){return goog.i18n.bidi.estimateDirection(e,t)==goog.i18n.bidi.Dir.RTL},goog.i18n.bidi.setElementDirAndAlign=function(e,t){e&&(t=goog.i18n.bidi.toDir(t))&&(e.style.textAlign=t==goog.i18n.bidi.Dir.RTL?goog.i18n.bidi.RIGHT:goog.i18n.bidi.LEFT,e.dir=t==goog.i18n.bidi.Dir.RTL?"rtl":"ltr")},goog.i18n.bidi.setElementDirByTextDirectionality=function(e,t){switch(goog.i18n.bidi.estimateDirection(t)){case goog.i18n.bidi.Dir.LTR:e.dir="ltr";break;case goog.i18n.bidi.Dir.RTL:e.dir="rtl";break;default:e.removeAttribute("dir")}},goog.i18n.bidi.DirectionalString=function(){},goog.html.TrustedResourceUrl=function(e,t){this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_=e===goog.html.TrustedResourceUrl.CONSTRUCTOR_TOKEN_PRIVATE_&&t||"",this.TRUSTED_RESOURCE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_},goog.html.TrustedResourceUrl.prototype.implementsGoogStringTypedString=!0,goog.html.TrustedResourceUrl.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_.toString()},goog.html.TrustedResourceUrl.prototype.implementsGoogI18nBidiDirectionalString=!0,goog.html.TrustedResourceUrl.prototype.getDirection=function(){return goog.i18n.bidi.Dir.LTR},goog.html.TrustedResourceUrl.prototype.cloneWithParams=function(e,t){var r=goog.html.TrustedResourceUrl.unwrap(this),o=(r=goog.html.TrustedResourceUrl.URL_PARAM_PARSER_.exec(r))[3]||"";return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(r[1]+goog.html.TrustedResourceUrl.stringifyParams_("?",r[2]||"",e)+goog.html.TrustedResourceUrl.stringifyParams_("#",o,t))},goog.DEBUG&&(goog.html.TrustedResourceUrl.prototype.toString=function(){return"TrustedResourceUrl{"+this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_+"}"}),goog.html.TrustedResourceUrl.unwrap=function(e){return goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(e).toString()},goog.html.TrustedResourceUrl.unwrapTrustedScriptURL=function(e){return e instanceof goog.html.TrustedResourceUrl&&e.constructor===goog.html.TrustedResourceUrl&&e.TRUSTED_RESOURCE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_?e.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_:(goog.asserts.fail("expected object of type TrustedResourceUrl, got '"+e+"' of type "+goog.typeOf(e)),"type_error:TrustedResourceUrl")},goog.html.TrustedResourceUrl.format=function(e,t){var r=goog.string.Const.unwrap(e);if(!goog.html.TrustedResourceUrl.BASE_URL_.test(r))throw Error("Invalid TrustedResourceUrl format: "+r);return e=r.replace(goog.html.TrustedResourceUrl.FORMAT_MARKER_,(function(e,o){if(!Object.prototype.hasOwnProperty.call(t,o))throw Error('Found marker, "'+o+'", in format string, "'+r+'", but no valid label mapping found in args: '+JSON.stringify(t));return(e=t[o])instanceof goog.string.Const?goog.string.Const.unwrap(e):encodeURIComponent(String(e))})),goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.TrustedResourceUrl.FORMAT_MARKER_=/%{(\w+)}/g,goog.html.TrustedResourceUrl.BASE_URL_=/^((https:)?\/\/[0-9a-z.:[\]-]+\/|\/[^/\\]|[^:/\\%]+\/|[^:/\\%]*[?#]|about:blank#)/i,goog.html.TrustedResourceUrl.URL_PARAM_PARSER_=/^([^?#]*)(\?[^#]*)?(#[\s\S]*)?/,goog.html.TrustedResourceUrl.formatWithParams=function(e,t,r,o){return goog.html.TrustedResourceUrl.format(e,t).cloneWithParams(r,o)},goog.html.TrustedResourceUrl.fromConstant=function(e){return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(goog.string.Const.unwrap(e))},goog.html.TrustedResourceUrl.fromConstants=function(e){for(var t="",r=0;re.length?"&":"")+encodeURIComponent(o)+"="+encodeURIComponent(String(n)))}}return t},goog.html.TrustedResourceUrl.CONSTRUCTOR_TOKEN_PRIVATE_={},goog.string.internal={},goog.string.internal.startsWith=function(e,t){return 0==e.lastIndexOf(t,0)},goog.string.internal.endsWith=function(e,t){var r=e.length-t.length;return 0<=r&&e.indexOf(t,r)==r},goog.string.internal.caseInsensitiveStartsWith=function(e,t){return 0==goog.string.internal.caseInsensitiveCompare(t,e.substr(0,t.length))},goog.string.internal.caseInsensitiveEndsWith=function(e,t){return 0==goog.string.internal.caseInsensitiveCompare(t,e.substr(e.length-t.length,t.length))},goog.string.internal.caseInsensitiveEquals=function(e,t){return e.toLowerCase()==t.toLowerCase()},goog.string.internal.isEmptyOrWhitespace=function(e){return/^[\s\xa0]*$/.test(e)},goog.string.internal.trim=goog.TRUSTED_SITE&&String.prototype.trim?function(e){return e.trim()}:function(e){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(e)[1]},goog.string.internal.caseInsensitiveCompare=function(e,t){return(e=String(e).toLowerCase())<(t=String(t).toLowerCase())?-1:e==t?0:1},goog.string.internal.newLineToBr=function(e,t){return e.replace(/(\r\n|\r|\n)/g,t?"
":"
")},goog.string.internal.htmlEscape=function(e,t){if(t)e=e.replace(goog.string.internal.AMP_RE_,"&").replace(goog.string.internal.LT_RE_,"<").replace(goog.string.internal.GT_RE_,">").replace(goog.string.internal.QUOT_RE_,""").replace(goog.string.internal.SINGLE_QUOTE_RE_,"'").replace(goog.string.internal.NULL_RE_,"�");else{if(!goog.string.internal.ALL_RE_.test(e))return e;-1!=e.indexOf("&")&&(e=e.replace(goog.string.internal.AMP_RE_,"&")),-1!=e.indexOf("<")&&(e=e.replace(goog.string.internal.LT_RE_,"<")),-1!=e.indexOf(">")&&(e=e.replace(goog.string.internal.GT_RE_,">")),-1!=e.indexOf('"')&&(e=e.replace(goog.string.internal.QUOT_RE_,""")),-1!=e.indexOf("'")&&(e=e.replace(goog.string.internal.SINGLE_QUOTE_RE_,"'")),-1!=e.indexOf("\0")&&(e=e.replace(goog.string.internal.NULL_RE_,"�"))}return e},goog.string.internal.AMP_RE_=/&/g,goog.string.internal.LT_RE_=//g,goog.string.internal.QUOT_RE_=/"/g,goog.string.internal.SINGLE_QUOTE_RE_=/'/g,goog.string.internal.NULL_RE_=/\x00/g,goog.string.internal.ALL_RE_=/[\x00&<>"']/,goog.string.internal.whitespaceEscape=function(e,t){return goog.string.internal.newLineToBr(e.replace(/ /g,"  "),t)},goog.string.internal.contains=function(e,t){return-1!=e.indexOf(t)},goog.string.internal.caseInsensitiveContains=function(e,t){return goog.string.internal.contains(e.toLowerCase(),t.toLowerCase())},goog.string.internal.compareVersions=function(e,t){var r=0;e=goog.string.internal.trim(String(e)).split("."),t=goog.string.internal.trim(String(t)).split(".");for(var o=Math.max(e.length,t.length),i=0;0==r&&it?1:0},goog.html.SafeUrl=function(e,t){this.privateDoNotAccessOrElseSafeUrlWrappedValue_=e===goog.html.SafeUrl.CONSTRUCTOR_TOKEN_PRIVATE_&&t||"",this.SAFE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_},goog.html.SafeUrl.INNOCUOUS_STRING="about:invalid#zClosurez",goog.html.SafeUrl.prototype.implementsGoogStringTypedString=!0,goog.html.SafeUrl.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseSafeUrlWrappedValue_.toString()},goog.html.SafeUrl.prototype.implementsGoogI18nBidiDirectionalString=!0,goog.html.SafeUrl.prototype.getDirection=function(){return goog.i18n.bidi.Dir.LTR},goog.DEBUG&&(goog.html.SafeUrl.prototype.toString=function(){return"SafeUrl{"+this.privateDoNotAccessOrElseSafeUrlWrappedValue_+"}"}),goog.html.SafeUrl.unwrap=function(e){return e instanceof goog.html.SafeUrl&&e.constructor===goog.html.SafeUrl&&e.SAFE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_?e.privateDoNotAccessOrElseSafeUrlWrappedValue_:(goog.asserts.fail("expected object of type SafeUrl, got '"+e+"' of type "+goog.typeOf(e)),"type_error:SafeUrl")},goog.html.SafeUrl.fromConstant=function(e){return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(goog.string.Const.unwrap(e))},goog.html.SAFE_MIME_TYPE_PATTERN_=/^(?:audio\/(?:3gpp2|3gpp|aac|L16|midi|mp3|mp4|mpeg|oga|ogg|opus|x-m4a|x-matroska|x-wav|wav|webm)|image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp|x-icon)|text\/csv|video\/(?:mpeg|mp4|ogg|webm|quicktime|x-matroska))(?:;\w+=(?:\w+|"[\w;,= ]+"))*$/i,goog.html.SafeUrl.isSafeMimeType=function(e){return goog.html.SAFE_MIME_TYPE_PATTERN_.test(e)},goog.html.SafeUrl.fromBlob=function(e){return e=goog.html.SafeUrl.isSafeMimeType(e.type)?goog.fs.url.createObjectUrl(e):goog.html.SafeUrl.INNOCUOUS_STRING,goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.SafeUrl.fromMediaSource=function(e){return goog.asserts.assert("MediaSource"in goog.global,"No support for MediaSource"),e=e instanceof MediaSource?goog.fs.url.createObjectUrl(e):goog.html.SafeUrl.INNOCUOUS_STRING,goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.DATA_URL_PATTERN_=/^data:(.*);base64,[a-z0-9+\/]+=*$/i,goog.html.SafeUrl.fromDataUrl=function(e){var t=(e=e.replace(/(%0A|%0D)/g,"")).match(goog.html.DATA_URL_PATTERN_);return t=t&&goog.html.SafeUrl.isSafeMimeType(t[1]),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(t?e:goog.html.SafeUrl.INNOCUOUS_STRING)},goog.html.SafeUrl.fromTelUrl=function(e){return goog.string.internal.caseInsensitiveStartsWith(e,"tel:")||(e=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.SIP_URL_PATTERN_=/^sip[s]?:[+a-z0-9_.!$%&'*\/=^`{|}~-]+@([a-z0-9-]+\.)+[a-z0-9]{2,63}$/i,goog.html.SafeUrl.fromSipUrl=function(e){return goog.html.SIP_URL_PATTERN_.test(decodeURIComponent(e))||(e=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.SafeUrl.fromFacebookMessengerUrl=function(e){return goog.string.internal.caseInsensitiveStartsWith(e,"fb-messenger://share")||(e=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.SafeUrl.fromWhatsAppUrl=function(e){return goog.string.internal.caseInsensitiveStartsWith(e,"whatsapp://send")||(e=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.SafeUrl.fromSmsUrl=function(e){return goog.string.internal.caseInsensitiveStartsWith(e,"sms:")&&goog.html.SafeUrl.isSmsUrlBodyValid_(e)||(e=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.SafeUrl.isSmsUrlBodyValid_=function(e){var t=e.indexOf("#");if(0+~[\]()=^$|]+$/.test(r))throw Error("Selector allows only [-_a-zA-Z0-9#.:* ,>+~[\\]()=^$|] and strings, got: "+e);if(!goog.html.SafeStyleSheet.hasBalancedBrackets_(r))throw Error("() and [] in selector must be balanced, got: "+e);return t instanceof goog.html.SafeStyle||(t=goog.html.SafeStyle.create(t)),e=e+"{"+goog.html.SafeStyle.unwrap(t).replace(/.":"");if(e.toUpperCase()in goog.html.SafeHtml.NOT_ALLOWED_TAG_NAMES_)throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES?"Tag name <"+e+"> is not allowed for SafeHtml.":"")},goog.html.SafeHtml.createIframe=function(e,t,r,o){e&&goog.html.TrustedResourceUrl.unwrap(e);var i={};return i.src=e||null,i.srcdoc=t&&goog.html.SafeHtml.unwrap(t),e=goog.html.SafeHtml.combineAttributes(i,{sandbox:""},r),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("iframe",e,o)},goog.html.SafeHtml.createSandboxIframe=function(e,t,r,o){if(!goog.html.SafeHtml.canUseSandboxIframe())throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES?"The browser does not support sandboxed iframes.":"");var i={};return i.src=e?goog.html.SafeUrl.unwrap(goog.html.SafeUrl.sanitize(e)):null,i.srcdoc=t||null,i.sandbox="",e=goog.html.SafeHtml.combineAttributes(i,{},r),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("iframe",e,o)},goog.html.SafeHtml.canUseSandboxIframe=function(){return goog.global.HTMLIFrameElement&&"sandbox"in goog.global.HTMLIFrameElement.prototype},goog.html.SafeHtml.createScriptSrc=function(e,t){return goog.html.TrustedResourceUrl.unwrap(e),e=goog.html.SafeHtml.combineAttributes({src:e},{},t),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("script",e)},goog.html.SafeHtml.createScript=function(e,t){for(var r in t){var o=r.toLowerCase();if("language"==o||"src"==o||"text"==o||"type"==o)throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES?'Cannot set "'+o+'" attribute':"")}for(r="",e=goog.array.concat(e),o=0;o does not allow content."),i+=">"):(o=goog.html.SafeHtml.concat(r),i+=">"+goog.html.SafeHtml.unwrap(o)+"",o=o.getDirection()),(e=t&&t.dir)&&(o=/^(ltr|rtl|auto)$/i.test(e)?goog.i18n.bidi.Dir.NEUTRAL:null),goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(i,o)},goog.html.SafeHtml.stringifyAttributes=function(e,t){var r="";if(t)for(var o in t){if(!goog.html.SafeHtml.VALID_NAMES_IN_TAG_.test(o))throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES?'Invalid attribute name "'+o+'".':"");var i=t[o];null!=i&&(r+=" "+goog.html.SafeHtml.getAttrNameAndValue_(e,o,i))}return r},goog.html.SafeHtml.combineAttributes=function(e,t,r){var o,i={};for(o in e)goog.asserts.assert(o.toLowerCase()==o,"Must be lower case"),i[o]=e[o];for(o in t)goog.asserts.assert(o.toLowerCase()==o,"Must be lower case"),i[o]=t[o];if(r)for(o in r){var a=o.toLowerCase();if(a in e)throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES?'Cannot override "'+a+'" attribute, got "'+o+'" with value "'+r[o]+'"':"");a in t&&delete i[a],i[o]=r[o]}return i},goog.html.SafeHtml.DOCTYPE_HTML=goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse("",goog.i18n.bidi.Dir.NEUTRAL),goog.html.SafeHtml.EMPTY=goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse("",goog.i18n.bidi.Dir.NEUTRAL),goog.html.SafeHtml.BR=goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse("
",goog.i18n.bidi.Dir.NEUTRAL),goog.html.uncheckedconversions={},goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract=function(e,t,r){return goog.asserts.assertString(goog.string.Const.unwrap(e),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(e)),"must provide non-empty justification"),goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(t,r||null)},goog.html.uncheckedconversions.safeScriptFromStringKnownToSatisfyTypeContract=function(e,t){return goog.asserts.assertString(goog.string.Const.unwrap(e),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(e)),"must provide non-empty justification"),goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(t)},goog.html.uncheckedconversions.safeStyleFromStringKnownToSatisfyTypeContract=function(e,t){return goog.asserts.assertString(goog.string.Const.unwrap(e),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(e)),"must provide non-empty justification"),goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(t)},goog.html.uncheckedconversions.safeStyleSheetFromStringKnownToSatisfyTypeContract=function(e,t){return goog.asserts.assertString(goog.string.Const.unwrap(e),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(e)),"must provide non-empty justification"),goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(t)},goog.html.uncheckedconversions.safeUrlFromStringKnownToSatisfyTypeContract=function(e,t){return goog.asserts.assertString(goog.string.Const.unwrap(e),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(e)),"must provide non-empty justification"),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(t)},goog.html.uncheckedconversions.trustedResourceUrlFromStringKnownToSatisfyTypeContract=function(e,t){return goog.asserts.assertString(goog.string.Const.unwrap(e),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(e)),"must provide non-empty justification"),goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(t)},goog.dom.safe={},goog.dom.safe.InsertAdjacentHtmlPosition={AFTERBEGIN:"afterbegin",AFTEREND:"afterend",BEFOREBEGIN:"beforebegin",BEFOREEND:"beforeend"},goog.dom.safe.insertAdjacentHtml=function(e,t,r){e.insertAdjacentHTML(t,goog.html.SafeHtml.unwrapTrustedHTML(r))},goog.dom.safe.SET_INNER_HTML_DISALLOWED_TAGS_={MATH:!0,SCRIPT:!0,STYLE:!0,SVG:!0,TEMPLATE:!0},goog.dom.safe.isInnerHtmlCleanupRecursive_=goog.functions.cacheReturnValue((function(){if(goog.DEBUG&&"undefined"==typeof document)return!1;var e=document.createElement("div"),t=document.createElement("div");return t.appendChild(document.createElement("div")),e.appendChild(t),!(goog.DEBUG&&!e.firstChild)&&(t=e.firstChild.firstChild,e.innerHTML=goog.html.SafeHtml.unwrapTrustedHTML(goog.html.SafeHtml.EMPTY),!t.parentElement)})),goog.dom.safe.unsafeSetInnerHtmlDoNotUseOrElse=function(e,t){if(goog.dom.safe.isInnerHtmlCleanupRecursive_())for(;e.lastChild;)e.removeChild(e.lastChild);e.innerHTML=goog.html.SafeHtml.unwrapTrustedHTML(t)},goog.dom.safe.setInnerHtml=function(e,t){if(goog.asserts.ENABLE_ASSERTS){var r=e.tagName.toUpperCase();if(goog.dom.safe.SET_INNER_HTML_DISALLOWED_TAGS_[r])throw Error("goog.dom.safe.setInnerHtml cannot be used to set content of "+e.tagName+".")}goog.dom.safe.unsafeSetInnerHtmlDoNotUseOrElse(e,t)},goog.dom.safe.setOuterHtml=function(e,t){e.outerHTML=goog.html.SafeHtml.unwrapTrustedHTML(t)},goog.dom.safe.setFormElementAction=function(e,t){t=t instanceof goog.html.SafeUrl?t:goog.html.SafeUrl.sanitizeAssertUnchanged(t),goog.dom.asserts.assertIsHTMLFormElement(e).action=goog.html.SafeUrl.unwrap(t)},goog.dom.safe.setButtonFormAction=function(e,t){t=t instanceof goog.html.SafeUrl?t:goog.html.SafeUrl.sanitizeAssertUnchanged(t),goog.dom.asserts.assertIsHTMLButtonElement(e).formAction=goog.html.SafeUrl.unwrap(t)},goog.dom.safe.setInputFormAction=function(e,t){t=t instanceof goog.html.SafeUrl?t:goog.html.SafeUrl.sanitizeAssertUnchanged(t),goog.dom.asserts.assertIsHTMLInputElement(e).formAction=goog.html.SafeUrl.unwrap(t)},goog.dom.safe.setStyle=function(e,t){e.style.cssText=goog.html.SafeStyle.unwrap(t)},goog.dom.safe.documentWrite=function(e,t){e.write(goog.html.SafeHtml.unwrapTrustedHTML(t))},goog.dom.safe.setAnchorHref=function(e,t){goog.dom.asserts.assertIsHTMLAnchorElement(e),t=t instanceof goog.html.SafeUrl?t:goog.html.SafeUrl.sanitizeAssertUnchanged(t),e.href=goog.html.SafeUrl.unwrap(t)},goog.dom.safe.setImageSrc=function(e,t){if(goog.dom.asserts.assertIsHTMLImageElement(e),!(t instanceof goog.html.SafeUrl)){var r=/^data:image\//i.test(t);t=goog.html.SafeUrl.sanitizeAssertUnchanged(t,r)}e.src=goog.html.SafeUrl.unwrap(t)},goog.dom.safe.setAudioSrc=function(e,t){if(goog.dom.asserts.assertIsHTMLAudioElement(e),!(t instanceof goog.html.SafeUrl)){var r=/^data:audio\//i.test(t);t=goog.html.SafeUrl.sanitizeAssertUnchanged(t,r)}e.src=goog.html.SafeUrl.unwrap(t)},goog.dom.safe.setVideoSrc=function(e,t){if(goog.dom.asserts.assertIsHTMLVideoElement(e),!(t instanceof goog.html.SafeUrl)){var r=/^data:video\//i.test(t);t=goog.html.SafeUrl.sanitizeAssertUnchanged(t,r)}e.src=goog.html.SafeUrl.unwrap(t)},goog.dom.safe.setEmbedSrc=function(e,t){goog.dom.asserts.assertIsHTMLEmbedElement(e),e.src=goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(t)},goog.dom.safe.setFrameSrc=function(e,t){goog.dom.asserts.assertIsHTMLFrameElement(e),e.src=goog.html.TrustedResourceUrl.unwrap(t)},goog.dom.safe.setIframeSrc=function(e,t){goog.dom.asserts.assertIsHTMLIFrameElement(e),e.src=goog.html.TrustedResourceUrl.unwrap(t)},goog.dom.safe.setIframeSrcdoc=function(e,t){goog.dom.asserts.assertIsHTMLIFrameElement(e),e.srcdoc=goog.html.SafeHtml.unwrapTrustedHTML(t)},goog.dom.safe.setLinkHrefAndRel=function(e,t,r){goog.dom.asserts.assertIsHTMLLinkElement(e),e.rel=r,goog.string.internal.caseInsensitiveContains(r,"stylesheet")?(goog.asserts.assert(t instanceof goog.html.TrustedResourceUrl,'URL must be TrustedResourceUrl because "rel" contains "stylesheet"'),e.href=goog.html.TrustedResourceUrl.unwrap(t)):e.href=t instanceof goog.html.TrustedResourceUrl?goog.html.TrustedResourceUrl.unwrap(t):t instanceof goog.html.SafeUrl?goog.html.SafeUrl.unwrap(t):goog.html.SafeUrl.unwrap(goog.html.SafeUrl.sanitizeAssertUnchanged(t))},goog.dom.safe.setObjectData=function(e,t){goog.dom.asserts.assertIsHTMLObjectElement(e),e.data=goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(t)},goog.dom.safe.setScriptSrc=function(e,t){goog.dom.asserts.assertIsHTMLScriptElement(e),e.src=goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(t),(t=goog.getScriptNonce())&&e.setAttribute("nonce",t)},goog.dom.safe.setScriptContent=function(e,t){goog.dom.asserts.assertIsHTMLScriptElement(e),e.text=goog.html.SafeScript.unwrapTrustedScript(t),(t=goog.getScriptNonce())&&e.setAttribute("nonce",t)},goog.dom.safe.setLocationHref=function(e,t){goog.dom.asserts.assertIsLocation(e),t=t instanceof goog.html.SafeUrl?t:goog.html.SafeUrl.sanitizeAssertUnchanged(t),e.href=goog.html.SafeUrl.unwrap(t)},goog.dom.safe.assignLocation=function(e,t){goog.dom.asserts.assertIsLocation(e),t=t instanceof goog.html.SafeUrl?t:goog.html.SafeUrl.sanitizeAssertUnchanged(t),e.assign(goog.html.SafeUrl.unwrap(t))},goog.dom.safe.replaceLocation=function(e,t){t=t instanceof goog.html.SafeUrl?t:goog.html.SafeUrl.sanitizeAssertUnchanged(t),e.replace(goog.html.SafeUrl.unwrap(t))},goog.dom.safe.openInWindow=function(e,t,r,o,i){return e=e instanceof goog.html.SafeUrl?e:goog.html.SafeUrl.sanitizeAssertUnchanged(e),t=t||goog.global,r=r instanceof goog.string.Const?goog.string.Const.unwrap(r):r||"",t.open(goog.html.SafeUrl.unwrap(e),r,o,i)},goog.dom.safe.parseFromStringHtml=function(e,t){return goog.dom.safe.parseFromString(e,t,"text/html")},goog.dom.safe.parseFromString=function(e,t,r){return e.parseFromString(goog.html.SafeHtml.unwrapTrustedHTML(t),r)},goog.dom.safe.createImageFromBlob=function(e){if(!/^image\/.*/g.test(e.type))throw Error("goog.dom.safe.createImageFromBlob only accepts MIME type image/.*.");var t=goog.global.URL.createObjectURL(e);return(e=new goog.global.Image).onload=function(){goog.global.URL.revokeObjectURL(t)},goog.dom.safe.setImageSrc(e,goog.html.uncheckedconversions.safeUrlFromStringKnownToSatisfyTypeContract(goog.string.Const.from("Image blob URL."),t)),e},goog.string.DETECT_DOUBLE_ESCAPING=!1,goog.string.FORCE_NON_DOM_HTML_UNESCAPING=!1,goog.string.Unicode={NBSP:" "},goog.string.startsWith=goog.string.internal.startsWith,goog.string.endsWith=goog.string.internal.endsWith,goog.string.caseInsensitiveStartsWith=goog.string.internal.caseInsensitiveStartsWith,goog.string.caseInsensitiveEndsWith=goog.string.internal.caseInsensitiveEndsWith,goog.string.caseInsensitiveEquals=goog.string.internal.caseInsensitiveEquals,goog.string.subs=function(e,t){for(var r=e.split("%s"),o="",i=Array.prototype.slice.call(arguments,1);i.length&&1=e||"€"<=e&&"�">=e},goog.string.stripNewlines=function(e){return e.replace(/(\r\n|\r|\n)+/g," ")},goog.string.canonicalizeNewlines=function(e){return e.replace(/(\r\n|\r|\n)/g,"\n")},goog.string.normalizeWhitespace=function(e){return e.replace(/\xa0|\s/g," ")},goog.string.normalizeSpaces=function(e){return e.replace(/\xa0|[ \t]+/g," ")},goog.string.collapseBreakingSpaces=function(e){return e.replace(/[\t\r\n ]+/g," ").replace(/^[\t\r\n ]+|[\t\r\n ]+$/g,"")},goog.string.trim=goog.string.internal.trim,goog.string.trimLeft=function(e){return e.replace(/^[\s\xa0]+/,"")},goog.string.trimRight=function(e){return e.replace(/[\s\xa0]+$/,"")},goog.string.caseInsensitiveCompare=goog.string.internal.caseInsensitiveCompare,goog.string.numberAwareCompare_=function(e,t,r){if(e==t)return 0;if(!e)return-1;if(!t)return 1;for(var o=e.toLowerCase().match(r),i=t.toLowerCase().match(r),a=Math.min(o.length,i.length),n=0;n",""":'"'},o=t?t.createElement("div"):goog.global.document.createElement("div");return e.replace(goog.string.HTML_ENTITY_PATTERN_,(function(e,t){var i=r[e];return i||("#"==t.charAt(0)&&(t=Number("0"+t.substr(1)),isNaN(t)||(i=String.fromCharCode(t))),i||(goog.dom.safe.setInnerHtml(o,goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract(goog.string.Const.from("Single HTML entity."),e+" ")),i=o.firstChild.nodeValue.slice(0,-1)),r[e]=i)}))},goog.string.unescapePureXmlEntities_=function(e){return e.replace(/&([^;]+);/g,(function(e,t){switch(t){case"amp":return"&";case"lt":return"<";case"gt":return">";case"quot":return'"';default:return"#"!=t.charAt(0)||(t=Number("0"+t.substr(1)),isNaN(t))?e:String.fromCharCode(t)}}))},goog.string.HTML_ENTITY_PATTERN_=/&([^;\s<&]+);?/g,goog.string.whitespaceEscape=function(e,t){return goog.string.newLineToBr(e.replace(/ /g,"  "),t)},goog.string.preserveSpaces=function(e){return e.replace(/(^|[\n ]) /g,"$1"+goog.string.Unicode.NBSP)},goog.string.stripQuotes=function(e,t){for(var r=t.length,o=0;ot&&(e=e.substring(0,t-3)+"..."),r&&(e=goog.string.htmlEscape(e)),e},goog.string.truncateMiddle=function(e,t,r,o){if(r&&(e=goog.string.unescapeEntities(e)),o&&e.length>t){o>t&&(o=t);var i=e.length-o;e=e.substring(0,t-o)+"..."+e.substring(i)}else e.length>t&&(o=Math.floor(t/2),i=e.length-o,e=e.substring(0,o+t%2)+"..."+e.substring(i));return r&&(e=goog.string.htmlEscape(e)),e},goog.string.specialEscapeChars_={"\0":"\\0","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\x0B",'"':'\\"',"\\":"\\\\","<":"\\u003C"},goog.string.jsEscapeCache_={"'":"\\'"},goog.string.quote=function(e){e=String(e);for(var t=['"'],r=0;ri?o:goog.string.escapeChar(o))}return t.push('"'),t.join("")},goog.string.escapeString=function(e){for(var t=[],r=0;rt)var r=e;else 256>t?(r="\\x",(16>t||256t&&(r+="0")),r+=t.toString(16).toUpperCase();return goog.string.jsEscapeCache_[e]=r},goog.string.contains=goog.string.internal.contains,goog.string.caseInsensitiveContains=goog.string.internal.caseInsensitiveContains,goog.string.countOf=function(e,t){return e&&t?e.split(t).length-1:0},goog.string.removeAt=function(e,t,r){var o=e;return 0<=t&&t>>0;return t},goog.string.uniqueStringCounter_=2147483648*Math.random()|0,goog.string.createUniqueString=function(){return"goog_"+goog.string.uniqueStringCounter_++},goog.string.toNumber=function(e){var t=Number(e);return 0==t&&goog.string.isEmptyOrWhitespace(e)?NaN:t},goog.string.isLowerCamelCase=function(e){return/^[a-z]+([A-Z][a-z]*)*$/.test(e)},goog.string.isUpperCamelCase=function(e){return/^([A-Z][a-z]*)+$/.test(e)},goog.string.toCamelCase=function(e){return String(e).replace(/\-([a-z])/g,(function(e,t){return t.toUpperCase()}))},goog.string.toSelectorCase=function(e){return String(e).replace(/([A-Z])/g,"-$1").toLowerCase()},goog.string.toTitleCase=function(e,t){return t="string"==typeof t?goog.string.regExpEscape(t):"\\s",e.replace(new RegExp("(^"+(t?"|["+t+"]+":"")+")([a-z])","g"),(function(e,t,r){return t+r.toUpperCase()}))},goog.string.capitalize=function(e){return String(e.charAt(0)).toUpperCase()+String(e.substr(1)).toLowerCase()},goog.string.parseInt=function(e){return isFinite(e)&&(e=String(e)),"string"==typeof e?/^\s*-?0x/i.test(e)?parseInt(e,16):parseInt(e,10):NaN},goog.string.splitLimit=function(e,t,r){e=e.split(t);for(var o=[];0r&&(r=i)}return-1==r?e:e.slice(r+1)},goog.string.editDistance=function(e,t){var r=[],o=[];if(e==t)return 0;if(!e.length||!t.length)return Math.max(e.length,t.length);for(var i=0;iparseFloat(e))?String(t):e},goog.userAgent.getVersionRegexResult_=function(){var e=goog.userAgent.getUserAgentString();return goog.userAgent.GECKO?/rv:([^\);]+)(\)|;)/.exec(e):goog.userAgent.EDGE?/Edge\/([\d\.]+)/.exec(e):goog.userAgent.IE?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(e):goog.userAgent.WEBKIT?/WebKit\/(\S+)/.exec(e):goog.userAgent.OPERA?/(?:Version)[ \/]?(\S+)/.exec(e):void 0},goog.userAgent.getDocumentMode_=function(){var e=goog.global.document;return e?e.documentMode:void 0},goog.userAgent.VERSION=goog.userAgent.determineVersion_(),goog.userAgent.compare=function(e,t){return goog.string.compareVersions(e,t)},goog.userAgent.isVersionOrHigherCache_={},goog.userAgent.isVersionOrHigher=function(e){return goog.userAgent.ASSUME_ANY_VERSION||goog.reflect.cache(goog.userAgent.isVersionOrHigherCache_,e,(function(){return 0<=goog.string.compareVersions(goog.userAgent.VERSION,e)}))},goog.userAgent.isVersion=goog.userAgent.isVersionOrHigher,goog.userAgent.isDocumentModeOrHigher=function(e){return Number(goog.userAgent.DOCUMENT_MODE)>=e},goog.userAgent.isDocumentMode=goog.userAgent.isDocumentModeOrHigher,goog.userAgent.DOCUMENT_MODE=function(){if(goog.global.document&&goog.userAgent.IE){var e=goog.userAgent.getDocumentMode_();return e||(parseInt(goog.userAgent.VERSION,10)||void 0)}}(),goog.userAgent.product={},goog.userAgent.product.ASSUME_FIREFOX=!1,goog.userAgent.product.ASSUME_IPHONE=!1,goog.userAgent.product.ASSUME_IPAD=!1,goog.userAgent.product.ASSUME_ANDROID=!1,goog.userAgent.product.ASSUME_CHROME=!1,goog.userAgent.product.ASSUME_SAFARI=!1,goog.userAgent.product.PRODUCT_KNOWN_=goog.userAgent.ASSUME_IE||goog.userAgent.ASSUME_EDGE||goog.userAgent.ASSUME_OPERA||goog.userAgent.product.ASSUME_FIREFOX||goog.userAgent.product.ASSUME_IPHONE||goog.userAgent.product.ASSUME_IPAD||goog.userAgent.product.ASSUME_ANDROID||goog.userAgent.product.ASSUME_CHROME||goog.userAgent.product.ASSUME_SAFARI,goog.userAgent.product.OPERA=goog.userAgent.OPERA,goog.userAgent.product.IE=goog.userAgent.IE,goog.userAgent.product.EDGE=goog.userAgent.EDGE,goog.userAgent.product.FIREFOX=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_FIREFOX:goog.labs.userAgent.browser.isFirefox(),goog.userAgent.product.isIphoneOrIpod_=function(){return goog.labs.userAgent.platform.isIphone()||goog.labs.userAgent.platform.isIpod()},goog.userAgent.product.IPHONE=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_IPHONE:goog.userAgent.product.isIphoneOrIpod_(),goog.userAgent.product.IPAD=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_IPAD:goog.labs.userAgent.platform.isIpad(),goog.userAgent.product.ANDROID=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_ANDROID:goog.labs.userAgent.browser.isAndroidBrowser(),goog.userAgent.product.CHROME=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_CHROME:goog.labs.userAgent.browser.isChrome(),goog.userAgent.product.isSafariDesktop_=function(){return goog.labs.userAgent.browser.isSafari()&&!goog.labs.userAgent.platform.isIos()},goog.userAgent.product.SAFARI=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_SAFARI:goog.userAgent.product.isSafariDesktop_(),goog.crypt.base64={},goog.crypt.base64.DEFAULT_ALPHABET_COMMON_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",goog.crypt.base64.ENCODED_VALS=goog.crypt.base64.DEFAULT_ALPHABET_COMMON_+"+/=",goog.crypt.base64.ENCODED_VALS_WEBSAFE=goog.crypt.base64.DEFAULT_ALPHABET_COMMON_+"-_.",goog.crypt.base64.Alphabet={DEFAULT:0,NO_PADDING:1,WEBSAFE:2,WEBSAFE_DOT_PADDING:3,WEBSAFE_NO_PADDING:4},goog.crypt.base64.paddingChars_="=.",goog.crypt.base64.isPadding_=function(e){return goog.string.contains(goog.crypt.base64.paddingChars_,e)},goog.crypt.base64.byteToCharMaps_={},goog.crypt.base64.charToByteMap_=null,goog.crypt.base64.ASSUME_NATIVE_SUPPORT_=goog.userAgent.GECKO||goog.userAgent.WEBKIT&&!goog.userAgent.product.SAFARI||goog.userAgent.OPERA,goog.crypt.base64.HAS_NATIVE_ENCODE_=goog.crypt.base64.ASSUME_NATIVE_SUPPORT_||"function"==typeof goog.global.btoa,goog.crypt.base64.HAS_NATIVE_DECODE_=goog.crypt.base64.ASSUME_NATIVE_SUPPORT_||!goog.userAgent.product.SAFARI&&!goog.userAgent.IE&&"function"==typeof goog.global.atob,goog.crypt.base64.encodeByteArray=function(e,t){goog.asserts.assert(goog.isArrayLike(e),"encodeByteArray takes an array as a parameter"),void 0===t&&(t=goog.crypt.base64.Alphabet.DEFAULT),goog.crypt.base64.init_(),t=goog.crypt.base64.byteToCharMaps_[t];for(var r=[],o=0;o>2;i=(3&i)<<4|n>>4,n=(15&n)<<2|p>>6,p&=63,s||(p=64,a||(n=64)),r.push(t[d],t[i],t[n]||"",t[p]||"")}return r.join("")},goog.crypt.base64.encodeString=function(e,t){return goog.crypt.base64.HAS_NATIVE_ENCODE_&&!t?goog.global.btoa(e):goog.crypt.base64.encodeByteArray(goog.crypt.stringToByteArray(e),t)},goog.crypt.base64.decodeString=function(e,t){if(goog.crypt.base64.HAS_NATIVE_DECODE_&&!t)return goog.global.atob(e);var r="";return goog.crypt.base64.decodeStringInternal_(e,(function(e){r+=String.fromCharCode(e)})),r},goog.crypt.base64.decodeStringToByteArray=function(e,t){var r=[];return goog.crypt.base64.decodeStringInternal_(e,(function(e){r.push(e)})),r},goog.crypt.base64.decodeStringToUint8Array=function(e){goog.asserts.assert(!goog.userAgent.IE||goog.userAgent.isVersionOrHigher("10"),"Browser does not support typed arrays");var t=e.length,r=3*t/4;r%3?r=Math.floor(r):goog.crypt.base64.isPadding_(e[t-1])&&(r=goog.crypt.base64.isPadding_(e[t-2])?r-2:r-1);var o=new Uint8Array(r),i=0;return goog.crypt.base64.decodeStringInternal_(e,(function(e){o[i++]=e})),o.subarray(0,i)},goog.crypt.base64.decodeStringInternal_=function(e,t){function r(t){for(;o>4),64!=n&&(t(a<<4&240|n>>2),64!=s&&t(n<<6&192|s))}},goog.crypt.base64.init_=function(){if(!goog.crypt.base64.charToByteMap_){goog.crypt.base64.charToByteMap_={};for(var e=goog.crypt.base64.DEFAULT_ALPHABET_COMMON_.split(""),t=["+/=","+/","-_=","-_.","-_"],r=0;5>r;r++){var o=e.concat(t[r].split(""));goog.crypt.base64.byteToCharMaps_[r]=o;for(var i=0;i>>0;e=Math.floor((e-t)/jspb.BinaryConstants.TWO_TO_32)>>>0,jspb.utils.split64Low=t,jspb.utils.split64High=e},jspb.utils.splitInt64=function(e){var t=0>e,r=(e=Math.abs(e))>>>0;e=Math.floor((e-r)/jspb.BinaryConstants.TWO_TO_32),e>>>=0,t&&(e=~e>>>0,4294967295<(r=1+(~r>>>0))&&(r=0,4294967295<++e&&(e=0))),jspb.utils.split64Low=r,jspb.utils.split64High=e},jspb.utils.splitZigzag64=function(e){var t=0>e;e=2*Math.abs(e),jspb.utils.splitUint64(e),e=jspb.utils.split64Low;var r=jspb.utils.split64High;t&&(0==e?0==r?r=e=4294967295:(r--,e=4294967295):e--),jspb.utils.split64Low=e,jspb.utils.split64High=r},jspb.utils.splitFloat32=function(e){var t=0>e?1:0;if(0===(e=t?-e:e))0<1/e?(jspb.utils.split64High=0,jspb.utils.split64Low=0):(jspb.utils.split64High=0,jspb.utils.split64Low=2147483648);else if(isNaN(e))jspb.utils.split64High=0,jspb.utils.split64Low=2147483647;else if(e>jspb.BinaryConstants.FLOAT32_MAX)jspb.utils.split64High=0,jspb.utils.split64Low=(t<<31|2139095040)>>>0;else if(e>>0;else{var r=Math.floor(Math.log(e)/Math.LN2);e*=Math.pow(2,-r),16777216<=(e=Math.round(e*jspb.BinaryConstants.TWO_TO_23))&&++r,jspb.utils.split64High=0,jspb.utils.split64Low=(t<<31|r+127<<23|8388607&e)>>>0}},jspb.utils.splitFloat64=function(e){var t=0>e?1:0;if(0===(e=t?-e:e))jspb.utils.split64High=0<1/e?0:2147483648,jspb.utils.split64Low=0;else if(isNaN(e))jspb.utils.split64High=2147483647,jspb.utils.split64Low=4294967295;else if(e>jspb.BinaryConstants.FLOAT64_MAX)jspb.utils.split64High=(t<<31|2146435072)>>>0,jspb.utils.split64Low=0;else if(e>>0,jspb.utils.split64Low=r>>>0}else{var o=0;if(2<=(r=e))for(;2<=r&&1023>o;)o++,r/=2;else for(;1>r&&-1022>>0,jspb.utils.split64High=(t<<31|o+1023<<20|e)>>>0,jspb.utils.split64Low=r}},jspb.utils.splitHash64=function(e){var t=e.charCodeAt(0),r=e.charCodeAt(1),o=e.charCodeAt(2),i=e.charCodeAt(3),a=e.charCodeAt(4),n=e.charCodeAt(5),s=e.charCodeAt(6);e=e.charCodeAt(7),jspb.utils.split64Low=t+(r<<8)+(o<<16)+(i<<24)>>>0,jspb.utils.split64High=a+(n<<8)+(s<<16)+(e<<24)>>>0},jspb.utils.joinUint64=function(e,t){return t*jspb.BinaryConstants.TWO_TO_32+(e>>>0)},jspb.utils.joinInt64=function(e,t){var r=2147483648&t;return r&&(t=~t>>>0,0==(e=1+~e>>>0)&&(t=t+1>>>0)),e=jspb.utils.joinUint64(e,t),r?-e:e},jspb.utils.toZigzag64=function(e,t,r){var o=t>>31;return r(e<<1^o,(t<<1|e>>>31)^o)},jspb.utils.joinZigzag64=function(e,t){return jspb.utils.fromZigzag64(e,t,jspb.utils.joinInt64)},jspb.utils.fromZigzag64=function(e,t,r){var o=-(1&e);return r((e>>>1|t<<31)^o,t>>>1^o)},jspb.utils.joinFloat32=function(e,t){t=2*(e>>31)+1;var r=e>>>23&255;return e&=8388607,255==r?e?NaN:1/0*t:0==r?t*Math.pow(2,-149)*e:t*Math.pow(2,r-150)*(e+Math.pow(2,23))},jspb.utils.joinFloat64=function(e,t){var r=2*(t>>31)+1,o=t>>>20&2047;return e=jspb.BinaryConstants.TWO_TO_32*(1048575&t)+e,2047==o?e?NaN:1/0*r:0==o?r*Math.pow(2,-1074)*e:r*Math.pow(2,o-1075)*(e+jspb.BinaryConstants.TWO_TO_52)},jspb.utils.joinHash64=function(e,t){return String.fromCharCode(e>>>0&255,e>>>8&255,e>>>16&255,e>>>24&255,t>>>0&255,t>>>8&255,t>>>16&255,t>>>24&255)},jspb.utils.DIGITS="0123456789abcdef".split(""),jspb.utils.ZERO_CHAR_CODE_=48,jspb.utils.A_CHAR_CODE_=97,jspb.utils.joinUnsignedDecimalString=function(e,t){function r(e,t){return e=e?String(e):"",t?"0000000".slice(e.length)+e:e}if(2097151>=t)return""+jspb.utils.joinUint64(e,t);var o=(e>>>24|t<<8)>>>0&16777215;return e=(16777215&e)+6777216*o+6710656*(t=t>>16&65535),o+=8147497*t,t*=2,1e7<=e&&(o+=Math.floor(e/1e7),e%=1e7),1e7<=o&&(t+=Math.floor(o/1e7),o%=1e7),r(t,0)+r(o,t)+r(e,1)},jspb.utils.joinSignedDecimalString=function(e,t){var r=2147483648&t;return r&&(t=~t+(0==(e=1+~e>>>0)?1:0)>>>0),e=jspb.utils.joinUnsignedDecimalString(e,t),r?"-"+e:e},jspb.utils.hash64ToDecimalString=function(e,t){jspb.utils.splitHash64(e),e=jspb.utils.split64Low;var r=jspb.utils.split64High;return t?jspb.utils.joinSignedDecimalString(e,r):jspb.utils.joinUnsignedDecimalString(e,r)},jspb.utils.hash64ArrayToDecimalStrings=function(e,t){for(var r=Array(e.length),o=0;or&&(1!==e||0>>=8}jspb.asserts.assert(0e;e++)o[e]=255&~o[e]}(),t(1,1)),goog.crypt.byteArrayToString(o)},jspb.utils.splitDecimalString=function(e){jspb.utils.splitHash64(jspb.utils.decimalStringToHash64(e))},jspb.utils.toHexDigit_=function(e){return String.fromCharCode(10>e?jspb.utils.ZERO_CHAR_CODE_+e:jspb.utils.A_CHAR_CODE_-10+e)},jspb.utils.fromHexCharCode_=function(e){return e>=jspb.utils.A_CHAR_CODE_?e-jspb.utils.A_CHAR_CODE_+10:e-jspb.utils.ZERO_CHAR_CODE_},jspb.utils.hash64ToHexString=function(e){var t=Array(18);t[0]="0",t[1]="x";for(var r=0;8>r;r++){var o=e.charCodeAt(7-r);t[2*r+2]=jspb.utils.toHexDigit_(o>>4),t[2*r+3]=jspb.utils.toHexDigit_(15&o)}return t.join("")},jspb.utils.hexStringToHash64=function(e){e=e.toLowerCase(),jspb.asserts.assert(18==e.length),jspb.asserts.assert("0"==e[0]),jspb.asserts.assert("x"==e[1]);for(var t="",r=0;8>r;r++){var o=jspb.utils.fromHexCharCode_(e.charCodeAt(2*r+2)),i=jspb.utils.fromHexCharCode_(e.charCodeAt(2*r+3));t=String.fromCharCode(16*o+i)+t}return t},jspb.utils.hash64ToNumber=function(e,t){jspb.utils.splitHash64(e),e=jspb.utils.split64Low;var r=jspb.utils.split64High;return t?jspb.utils.joinInt64(e,r):jspb.utils.joinUint64(e,r)},jspb.utils.numberToHash64=function(e){return jspb.utils.splitInt64(e),jspb.utils.joinHash64(jspb.utils.split64Low,jspb.utils.split64High)},jspb.utils.countVarints=function(e,t,r){for(var o=0,i=t;i>7;return r-t-o},jspb.utils.countVarintFields=function(e,t,r,o){var i=0;if(128>(o=8*o+jspb.BinaryConstants.WireType.VARINT))for(;t>=7}if(e[t++]!=a)break;for(i++;0!=(128&(a=e[t++])););}return i},jspb.utils.countFixedFields_=function(e,t,r,o,i){var a=0;if(128>o)for(;t>=7}if(e[t++]!=n)break;a++,t+=i}return a},jspb.utils.countFixed32Fields=function(e,t,r,o){return jspb.utils.countFixedFields_(e,t,r,8*o+jspb.BinaryConstants.WireType.FIXED32,4)},jspb.utils.countFixed64Fields=function(e,t,r,o){return jspb.utils.countFixedFields_(e,t,r,8*o+jspb.BinaryConstants.WireType.FIXED64,8)},jspb.utils.countDelimitedFields=function(e,t,r,o){var i=0;for(o=8*o+jspb.BinaryConstants.WireType.DELIMITED;t>=7}if(e[t++]!=a)break;i++;for(var n=0,s=1;n+=(127&(a=e[t++]))*s,s*=128,0!=(128&a););t+=n}return i},jspb.utils.debugBytesToTextFormat=function(e){var t='"';if(e){e=jspb.utils.byteSourceToUint8Array(e);for(var r=0;re[r]&&(t+="0"),t+=e[r].toString(16)}return t+'"'},jspb.utils.debugScalarToTextFormat=function(e){return"string"==typeof e?goog.string.quote(e):e.toString()},jspb.utils.stringToByteArray=function(e){for(var t=new Uint8Array(e.length),r=0;rjspb.BinaryDecoder.instanceCache_.length&&jspb.BinaryDecoder.instanceCache_.push(this)},jspb.BinaryDecoder.prototype.clone=function(){return jspb.BinaryDecoder.alloc(this.bytes_,this.start_,this.end_-this.start_)},jspb.BinaryDecoder.prototype.clear=function(){this.bytes_=null,this.cursor_=this.end_=this.start_=0,this.error_=!1},jspb.BinaryDecoder.prototype.getBuffer=function(){return this.bytes_},jspb.BinaryDecoder.prototype.setBlock=function(e,t,r){this.bytes_=jspb.utils.byteSourceToUint8Array(e),this.start_=void 0!==t?t:0,this.end_=void 0!==r?this.start_+r:this.bytes_.length,this.cursor_=this.start_},jspb.BinaryDecoder.prototype.getEnd=function(){return this.end_},jspb.BinaryDecoder.prototype.setEnd=function(e){this.end_=e},jspb.BinaryDecoder.prototype.reset=function(){this.cursor_=this.start_},jspb.BinaryDecoder.prototype.getCursor=function(){return this.cursor_},jspb.BinaryDecoder.prototype.setCursor=function(e){this.cursor_=e},jspb.BinaryDecoder.prototype.advance=function(e){this.cursor_+=e,jspb.asserts.assert(this.cursor_<=this.end_)},jspb.BinaryDecoder.prototype.atEnd=function(){return this.cursor_==this.end_},jspb.BinaryDecoder.prototype.pastEnd=function(){return this.cursor_>this.end_},jspb.BinaryDecoder.prototype.getError=function(){return this.error_||0>this.cursor_||this.cursor_>this.end_},jspb.BinaryDecoder.prototype.readSplitVarint64=function(e){for(var t=128,r=0,o=0,i=0;4>i&&128<=t;i++)r|=(127&(t=this.bytes_[this.cursor_++]))<<7*i;if(128<=t&&(r|=(127&(t=this.bytes_[this.cursor_++]))<<28,o|=(127&t)>>4),128<=t)for(i=0;5>i&&128<=t;i++)o|=(127&(t=this.bytes_[this.cursor_++]))<<7*i+3;if(128>t)return e(r>>>0,o>>>0);jspb.asserts.fail("Failed to read varint, encoding is invalid."),this.error_=!0},jspb.BinaryDecoder.prototype.readSplitZigzagVarint64=function(e){return this.readSplitVarint64((function(t,r){return jspb.utils.fromZigzag64(t,r,e)}))},jspb.BinaryDecoder.prototype.readSplitFixed64=function(e){var t=this.bytes_,r=this.cursor_;this.cursor_+=8;for(var o=0,i=0,a=r+7;a>=r;a--)o=o<<8|t[a],i=i<<8|t[a+4];return e(o,i)},jspb.BinaryDecoder.prototype.skipVarint=function(){for(;128&this.bytes_[this.cursor_];)this.cursor_++;this.cursor_++},jspb.BinaryDecoder.prototype.unskipVarint=function(e){for(;128>>=7;this.cursor_--},jspb.BinaryDecoder.prototype.readUnsignedVarint32=function(){var e=this.bytes_,t=e[this.cursor_+0],r=127&t;return 128>t?(this.cursor_+=1,jspb.asserts.assert(this.cursor_<=this.end_),r):(r|=(127&(t=e[this.cursor_+1]))<<7,128>t?(this.cursor_+=2,jspb.asserts.assert(this.cursor_<=this.end_),r):(r|=(127&(t=e[this.cursor_+2]))<<14,128>t?(this.cursor_+=3,jspb.asserts.assert(this.cursor_<=this.end_),r):(r|=(127&(t=e[this.cursor_+3]))<<21,128>t?(this.cursor_+=4,jspb.asserts.assert(this.cursor_<=this.end_),r):(r|=(15&(t=e[this.cursor_+4]))<<28,128>t?(this.cursor_+=5,jspb.asserts.assert(this.cursor_<=this.end_),r>>>0):(this.cursor_+=5,128<=e[this.cursor_++]&&128<=e[this.cursor_++]&&128<=e[this.cursor_++]&&128<=e[this.cursor_++]&&128<=e[this.cursor_++]&&jspb.asserts.assert(!1),jspb.asserts.assert(this.cursor_<=this.end_),r)))))},jspb.BinaryDecoder.prototype.readSignedVarint32=function(){return~~this.readUnsignedVarint32()},jspb.BinaryDecoder.prototype.readUnsignedVarint32String=function(){return this.readUnsignedVarint32().toString()},jspb.BinaryDecoder.prototype.readSignedVarint32String=function(){return this.readSignedVarint32().toString()},jspb.BinaryDecoder.prototype.readZigzagVarint32=function(){var e=this.readUnsignedVarint32();return e>>>1^-(1&e)},jspb.BinaryDecoder.prototype.readUnsignedVarint64=function(){return this.readSplitVarint64(jspb.utils.joinUint64)},jspb.BinaryDecoder.prototype.readUnsignedVarint64String=function(){return this.readSplitVarint64(jspb.utils.joinUnsignedDecimalString)},jspb.BinaryDecoder.prototype.readSignedVarint64=function(){return this.readSplitVarint64(jspb.utils.joinInt64)},jspb.BinaryDecoder.prototype.readSignedVarint64String=function(){return this.readSplitVarint64(jspb.utils.joinSignedDecimalString)},jspb.BinaryDecoder.prototype.readZigzagVarint64=function(){return this.readSplitVarint64(jspb.utils.joinZigzag64)},jspb.BinaryDecoder.prototype.readZigzagVarintHash64=function(){return this.readSplitZigzagVarint64(jspb.utils.joinHash64)},jspb.BinaryDecoder.prototype.readZigzagVarint64String=function(){return this.readSplitZigzagVarint64(jspb.utils.joinSignedDecimalString)},jspb.BinaryDecoder.prototype.readUint8=function(){var e=this.bytes_[this.cursor_+0];return this.cursor_+=1,jspb.asserts.assert(this.cursor_<=this.end_),e},jspb.BinaryDecoder.prototype.readUint16=function(){var e=this.bytes_[this.cursor_+0],t=this.bytes_[this.cursor_+1];return this.cursor_+=2,jspb.asserts.assert(this.cursor_<=this.end_),e<<0|t<<8},jspb.BinaryDecoder.prototype.readUint32=function(){var e=this.bytes_[this.cursor_+0],t=this.bytes_[this.cursor_+1],r=this.bytes_[this.cursor_+2],o=this.bytes_[this.cursor_+3];return this.cursor_+=4,jspb.asserts.assert(this.cursor_<=this.end_),(e<<0|t<<8|r<<16|o<<24)>>>0},jspb.BinaryDecoder.prototype.readUint64=function(){var e=this.readUint32(),t=this.readUint32();return jspb.utils.joinUint64(e,t)},jspb.BinaryDecoder.prototype.readUint64String=function(){var e=this.readUint32(),t=this.readUint32();return jspb.utils.joinUnsignedDecimalString(e,t)},jspb.BinaryDecoder.prototype.readInt8=function(){var e=this.bytes_[this.cursor_+0];return this.cursor_+=1,jspb.asserts.assert(this.cursor_<=this.end_),e<<24>>24},jspb.BinaryDecoder.prototype.readInt16=function(){var e=this.bytes_[this.cursor_+0],t=this.bytes_[this.cursor_+1];return this.cursor_+=2,jspb.asserts.assert(this.cursor_<=this.end_),(e<<0|t<<8)<<16>>16},jspb.BinaryDecoder.prototype.readInt32=function(){var e=this.bytes_[this.cursor_+0],t=this.bytes_[this.cursor_+1],r=this.bytes_[this.cursor_+2],o=this.bytes_[this.cursor_+3];return this.cursor_+=4,jspb.asserts.assert(this.cursor_<=this.end_),e<<0|t<<8|r<<16|o<<24},jspb.BinaryDecoder.prototype.readInt64=function(){var e=this.readUint32(),t=this.readUint32();return jspb.utils.joinInt64(e,t)},jspb.BinaryDecoder.prototype.readInt64String=function(){var e=this.readUint32(),t=this.readUint32();return jspb.utils.joinSignedDecimalString(e,t)},jspb.BinaryDecoder.prototype.readFloat=function(){var e=this.readUint32();return jspb.utils.joinFloat32(e,0)},jspb.BinaryDecoder.prototype.readDouble=function(){var e=this.readUint32(),t=this.readUint32();return jspb.utils.joinFloat64(e,t)},jspb.BinaryDecoder.prototype.readBool=function(){return!!this.bytes_[this.cursor_++]},jspb.BinaryDecoder.prototype.readEnum=function(){return this.readSignedVarint32()},jspb.BinaryDecoder.prototype.readString=function(e){var t=this.bytes_,r=this.cursor_;e=r+e;for(var o=[],i="";ra)o.push(a);else{if(192>a)continue;if(224>a){var n=t[r++];o.push((31&a)<<6|63&n)}else if(240>a){n=t[r++];var s=t[r++];o.push((15&a)<<12|(63&n)<<6|63&s)}else if(248>a){a=(7&a)<<18|(63&(n=t[r++]))<<12|(63&(s=t[r++]))<<6|63&t[r++],a-=65536,o.push(55296+(a>>10&1023),56320+(1023&a))}}8192<=o.length&&(i+=String.fromCharCode.apply(null,o),o.length=0)}return i+=goog.crypt.byteArrayToString(o),this.cursor_=r,i},jspb.BinaryDecoder.prototype.readStringWithLength=function(){var e=this.readUnsignedVarint32();return this.readString(e)},jspb.BinaryDecoder.prototype.readBytes=function(e){if(0>e||this.cursor_+e>this.bytes_.length)return this.error_=!0,jspb.asserts.fail("Invalid byte length!"),new Uint8Array(0);var t=this.bytes_.subarray(this.cursor_,this.cursor_+e);return this.cursor_+=e,jspb.asserts.assert(this.cursor_<=this.end_),t},jspb.BinaryDecoder.prototype.readVarintHash64=function(){return this.readSplitVarint64(jspb.utils.joinHash64)},jspb.BinaryDecoder.prototype.readFixedHash64=function(){var e=this.bytes_,t=this.cursor_,r=e[t+0],o=e[t+1],i=e[t+2],a=e[t+3],n=e[t+4],s=e[t+5],p=e[t+6];return e=e[t+7],this.cursor_+=8,String.fromCharCode(r,o,i,a,n,s,p,e)},jspb.BinaryReader=function(e,t,r){this.decoder_=jspb.BinaryDecoder.alloc(e,t,r),this.fieldCursor_=this.decoder_.getCursor(),this.nextField_=jspb.BinaryConstants.INVALID_FIELD_NUMBER,this.nextWireType_=jspb.BinaryConstants.WireType.INVALID,this.error_=!1,this.readCallbacks_=null},jspb.BinaryReader.instanceCache_=[],jspb.BinaryReader.alloc=function(e,t,r){if(jspb.BinaryReader.instanceCache_.length){var o=jspb.BinaryReader.instanceCache_.pop();return e&&o.decoder_.setBlock(e,t,r),o}return new jspb.BinaryReader(e,t,r)},jspb.BinaryReader.prototype.alloc=jspb.BinaryReader.alloc,jspb.BinaryReader.prototype.free=function(){this.decoder_.clear(),this.nextField_=jspb.BinaryConstants.INVALID_FIELD_NUMBER,this.nextWireType_=jspb.BinaryConstants.WireType.INVALID,this.error_=!1,this.readCallbacks_=null,100>jspb.BinaryReader.instanceCache_.length&&jspb.BinaryReader.instanceCache_.push(this)},jspb.BinaryReader.prototype.getFieldCursor=function(){return this.fieldCursor_},jspb.BinaryReader.prototype.getCursor=function(){return this.decoder_.getCursor()},jspb.BinaryReader.prototype.getBuffer=function(){return this.decoder_.getBuffer()},jspb.BinaryReader.prototype.getFieldNumber=function(){return this.nextField_},goog.exportProperty(jspb.BinaryReader.prototype,"getFieldNumber",jspb.BinaryReader.prototype.getFieldNumber),jspb.BinaryReader.prototype.getWireType=function(){return this.nextWireType_},jspb.BinaryReader.prototype.isDelimited=function(){return this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED},goog.exportProperty(jspb.BinaryReader.prototype,"isDelimited",jspb.BinaryReader.prototype.isDelimited),jspb.BinaryReader.prototype.isEndGroup=function(){return this.nextWireType_==jspb.BinaryConstants.WireType.END_GROUP},goog.exportProperty(jspb.BinaryReader.prototype,"isEndGroup",jspb.BinaryReader.prototype.isEndGroup),jspb.BinaryReader.prototype.getError=function(){return this.error_||this.decoder_.getError()},jspb.BinaryReader.prototype.setBlock=function(e,t,r){this.decoder_.setBlock(e,t,r),this.nextField_=jspb.BinaryConstants.INVALID_FIELD_NUMBER,this.nextWireType_=jspb.BinaryConstants.WireType.INVALID},jspb.BinaryReader.prototype.reset=function(){this.decoder_.reset(),this.nextField_=jspb.BinaryConstants.INVALID_FIELD_NUMBER,this.nextWireType_=jspb.BinaryConstants.WireType.INVALID},jspb.BinaryReader.prototype.advance=function(e){this.decoder_.advance(e)},jspb.BinaryReader.prototype.nextField=function(){if(this.decoder_.atEnd())return!1;if(this.getError())return jspb.asserts.fail("Decoder hit an error"),!1;this.fieldCursor_=this.decoder_.getCursor();var e=this.decoder_.readUnsignedVarint32(),t=e>>>3;return(e&=7)!=jspb.BinaryConstants.WireType.VARINT&&e!=jspb.BinaryConstants.WireType.FIXED32&&e!=jspb.BinaryConstants.WireType.FIXED64&&e!=jspb.BinaryConstants.WireType.DELIMITED&&e!=jspb.BinaryConstants.WireType.START_GROUP&&e!=jspb.BinaryConstants.WireType.END_GROUP?(jspb.asserts.fail("Invalid wire type: %s (at position %s)",e,this.fieldCursor_),this.error_=!0,!1):(this.nextField_=t,this.nextWireType_=e,!0)},goog.exportProperty(jspb.BinaryReader.prototype,"nextField",jspb.BinaryReader.prototype.nextField),jspb.BinaryReader.prototype.unskipHeader=function(){this.decoder_.unskipVarint(this.nextField_<<3|this.nextWireType_)},jspb.BinaryReader.prototype.skipMatchingFields=function(){var e=this.nextField_;for(this.unskipHeader();this.nextField()&&this.getFieldNumber()==e;)this.skipField();this.decoder_.atEnd()||this.unskipHeader()},jspb.BinaryReader.prototype.skipVarintField=function(){this.nextWireType_!=jspb.BinaryConstants.WireType.VARINT?(jspb.asserts.fail("Invalid wire type for skipVarintField"),this.skipField()):this.decoder_.skipVarint()},jspb.BinaryReader.prototype.skipDelimitedField=function(){if(this.nextWireType_!=jspb.BinaryConstants.WireType.DELIMITED)jspb.asserts.fail("Invalid wire type for skipDelimitedField"),this.skipField();else{var e=this.decoder_.readUnsignedVarint32();this.decoder_.advance(e)}},jspb.BinaryReader.prototype.skipFixed32Field=function(){this.nextWireType_!=jspb.BinaryConstants.WireType.FIXED32?(jspb.asserts.fail("Invalid wire type for skipFixed32Field"),this.skipField()):this.decoder_.advance(4)},jspb.BinaryReader.prototype.skipFixed64Field=function(){this.nextWireType_!=jspb.BinaryConstants.WireType.FIXED64?(jspb.asserts.fail("Invalid wire type for skipFixed64Field"),this.skipField()):this.decoder_.advance(8)},jspb.BinaryReader.prototype.skipGroup=function(){for(var e=this.nextField_;;){if(!this.nextField()){jspb.asserts.fail("Unmatched start-group tag: stream EOF"),this.error_=!0;break}if(this.nextWireType_==jspb.BinaryConstants.WireType.END_GROUP){this.nextField_!=e&&(jspb.asserts.fail("Unmatched end-group tag"),this.error_=!0);break}this.skipField()}},jspb.BinaryReader.prototype.skipField=function(){switch(this.nextWireType_){case jspb.BinaryConstants.WireType.VARINT:this.skipVarintField();break;case jspb.BinaryConstants.WireType.FIXED64:this.skipFixed64Field();break;case jspb.BinaryConstants.WireType.DELIMITED:this.skipDelimitedField();break;case jspb.BinaryConstants.WireType.FIXED32:this.skipFixed32Field();break;case jspb.BinaryConstants.WireType.START_GROUP:this.skipGroup();break;default:jspb.asserts.fail("Invalid wire encoding for field.")}},jspb.BinaryReader.prototype.registerReadCallback=function(e,t){null===this.readCallbacks_&&(this.readCallbacks_={}),jspb.asserts.assert(!this.readCallbacks_[e]),this.readCallbacks_[e]=t},jspb.BinaryReader.prototype.runReadCallback=function(e){return jspb.asserts.assert(null!==this.readCallbacks_),e=this.readCallbacks_[e],jspb.asserts.assert(e),e(this)},jspb.BinaryReader.prototype.readAny=function(e){this.nextWireType_=jspb.BinaryConstants.FieldTypeToWireType(e);var t=jspb.BinaryConstants.FieldType;switch(e){case t.DOUBLE:return this.readDouble();case t.FLOAT:return this.readFloat();case t.INT64:return this.readInt64();case t.UINT64:return this.readUint64();case t.INT32:return this.readInt32();case t.FIXED64:return this.readFixed64();case t.FIXED32:return this.readFixed32();case t.BOOL:return this.readBool();case t.STRING:return this.readString();case t.GROUP:jspb.asserts.fail("Group field type not supported in readAny()");case t.MESSAGE:jspb.asserts.fail("Message field type not supported in readAny()");case t.BYTES:return this.readBytes();case t.UINT32:return this.readUint32();case t.ENUM:return this.readEnum();case t.SFIXED32:return this.readSfixed32();case t.SFIXED64:return this.readSfixed64();case t.SINT32:return this.readSint32();case t.SINT64:return this.readSint64();case t.FHASH64:return this.readFixedHash64();case t.VHASH64:return this.readVarintHash64();default:jspb.asserts.fail("Invalid field type in readAny()")}return 0},jspb.BinaryReader.prototype.readMessage=function(e,t){jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var r=this.decoder_.getEnd(),o=this.decoder_.readUnsignedVarint32();o=this.decoder_.getCursor()+o,this.decoder_.setEnd(o),t(e,this),this.decoder_.setCursor(o),this.decoder_.setEnd(r)},goog.exportProperty(jspb.BinaryReader.prototype,"readMessage",jspb.BinaryReader.prototype.readMessage),jspb.BinaryReader.prototype.readGroup=function(e,t,r){jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.START_GROUP),jspb.asserts.assert(this.nextField_==e),r(t,this),this.error_||this.nextWireType_==jspb.BinaryConstants.WireType.END_GROUP||(jspb.asserts.fail("Group submessage did not end with an END_GROUP tag"),this.error_=!0)},goog.exportProperty(jspb.BinaryReader.prototype,"readGroup",jspb.BinaryReader.prototype.readGroup),jspb.BinaryReader.prototype.getFieldDecoder=function(){jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var e=this.decoder_.readUnsignedVarint32(),t=this.decoder_.getCursor(),r=t+e;return e=jspb.BinaryDecoder.alloc(this.decoder_.getBuffer(),t,e),this.decoder_.setCursor(r),e},jspb.BinaryReader.prototype.readInt32=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint32()},goog.exportProperty(jspb.BinaryReader.prototype,"readInt32",jspb.BinaryReader.prototype.readInt32),jspb.BinaryReader.prototype.readInt32String=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint32String()},jspb.BinaryReader.prototype.readInt64=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint64()},goog.exportProperty(jspb.BinaryReader.prototype,"readInt64",jspb.BinaryReader.prototype.readInt64),jspb.BinaryReader.prototype.readInt64String=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint64String()},jspb.BinaryReader.prototype.readUint32=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readUnsignedVarint32()},goog.exportProperty(jspb.BinaryReader.prototype,"readUint32",jspb.BinaryReader.prototype.readUint32),jspb.BinaryReader.prototype.readUint32String=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readUnsignedVarint32String()},jspb.BinaryReader.prototype.readUint64=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readUnsignedVarint64()},goog.exportProperty(jspb.BinaryReader.prototype,"readUint64",jspb.BinaryReader.prototype.readUint64),jspb.BinaryReader.prototype.readUint64String=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readUnsignedVarint64String()},jspb.BinaryReader.prototype.readSint32=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readZigzagVarint32()},goog.exportProperty(jspb.BinaryReader.prototype,"readSint32",jspb.BinaryReader.prototype.readSint32),jspb.BinaryReader.prototype.readSint64=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readZigzagVarint64()},goog.exportProperty(jspb.BinaryReader.prototype,"readSint64",jspb.BinaryReader.prototype.readSint64),jspb.BinaryReader.prototype.readSint64String=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readZigzagVarint64String()},jspb.BinaryReader.prototype.readFixed32=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED32),this.decoder_.readUint32()},goog.exportProperty(jspb.BinaryReader.prototype,"readFixed32",jspb.BinaryReader.prototype.readFixed32),jspb.BinaryReader.prototype.readFixed64=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readUint64()},goog.exportProperty(jspb.BinaryReader.prototype,"readFixed64",jspb.BinaryReader.prototype.readFixed64),jspb.BinaryReader.prototype.readFixed64String=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readUint64String()},jspb.BinaryReader.prototype.readSfixed32=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED32),this.decoder_.readInt32()},goog.exportProperty(jspb.BinaryReader.prototype,"readSfixed32",jspb.BinaryReader.prototype.readSfixed32),jspb.BinaryReader.prototype.readSfixed32String=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED32),this.decoder_.readInt32().toString()},jspb.BinaryReader.prototype.readSfixed64=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readInt64()},goog.exportProperty(jspb.BinaryReader.prototype,"readSfixed64",jspb.BinaryReader.prototype.readSfixed64),jspb.BinaryReader.prototype.readSfixed64String=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readInt64String()},jspb.BinaryReader.prototype.readFloat=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED32),this.decoder_.readFloat()},goog.exportProperty(jspb.BinaryReader.prototype,"readFloat",jspb.BinaryReader.prototype.readFloat),jspb.BinaryReader.prototype.readDouble=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readDouble()},goog.exportProperty(jspb.BinaryReader.prototype,"readDouble",jspb.BinaryReader.prototype.readDouble),jspb.BinaryReader.prototype.readBool=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),!!this.decoder_.readUnsignedVarint32()},goog.exportProperty(jspb.BinaryReader.prototype,"readBool",jspb.BinaryReader.prototype.readBool),jspb.BinaryReader.prototype.readEnum=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint64()},goog.exportProperty(jspb.BinaryReader.prototype,"readEnum",jspb.BinaryReader.prototype.readEnum),jspb.BinaryReader.prototype.readString=function(){jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var e=this.decoder_.readUnsignedVarint32();return this.decoder_.readString(e)},goog.exportProperty(jspb.BinaryReader.prototype,"readString",jspb.BinaryReader.prototype.readString),jspb.BinaryReader.prototype.readBytes=function(){jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var e=this.decoder_.readUnsignedVarint32();return this.decoder_.readBytes(e)},goog.exportProperty(jspb.BinaryReader.prototype,"readBytes",jspb.BinaryReader.prototype.readBytes),jspb.BinaryReader.prototype.readVarintHash64=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readVarintHash64()},jspb.BinaryReader.prototype.readSintHash64=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readZigzagVarintHash64()},jspb.BinaryReader.prototype.readSplitVarint64=function(e){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSplitVarint64(e)},jspb.BinaryReader.prototype.readSplitZigzagVarint64=function(e){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSplitVarint64((function(t,r){return jspb.utils.fromZigzag64(t,r,e)}))},jspb.BinaryReader.prototype.readFixedHash64=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readFixedHash64()},jspb.BinaryReader.prototype.readSplitFixed64=function(e){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readSplitFixed64(e)},jspb.BinaryReader.prototype.readPackedField_=function(e){jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var t=this.decoder_.readUnsignedVarint32();t=this.decoder_.getCursor()+t;for(var r=[];this.decoder_.getCursor()>>7|t<<25)>>>0,t>>>=7;this.buffer_.push(e)},jspb.BinaryEncoder.prototype.writeSplitFixed64=function(e,t){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(t==Math.floor(t)),jspb.asserts.assert(0<=e&&e>>=7;this.buffer_.push(e)},jspb.BinaryEncoder.prototype.writeSignedVarint32=function(e){if(jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_31&&et;t++)this.buffer_.push(127&e|128),e>>=7;this.buffer_.push(1)}},jspb.BinaryEncoder.prototype.writeUnsignedVarint64=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(0<=e&&e=-jspb.BinaryConstants.TWO_TO_63&&e=-jspb.BinaryConstants.TWO_TO_31&&e>31)>>>0)},jspb.BinaryEncoder.prototype.writeZigzagVarint64=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_63&&e>>0,r>>>0)}))},jspb.BinaryEncoder.prototype.writeUint8=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(0<=e&&256>e),this.buffer_.push(e>>>0&255)},jspb.BinaryEncoder.prototype.writeUint16=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(0<=e&&65536>e),this.buffer_.push(e>>>0&255),this.buffer_.push(e>>>8&255)},jspb.BinaryEncoder.prototype.writeUint32=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(0<=e&&e>>0&255),this.buffer_.push(e>>>8&255),this.buffer_.push(e>>>16&255),this.buffer_.push(e>>>24&255)},jspb.BinaryEncoder.prototype.writeUint64=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(0<=e&&ee),this.buffer_.push(e>>>0&255)},jspb.BinaryEncoder.prototype.writeInt16=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(-32768<=e&&32768>e),this.buffer_.push(e>>>0&255),this.buffer_.push(e>>>8&255)},jspb.BinaryEncoder.prototype.writeInt32=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_31&&e>>0&255),this.buffer_.push(e>>>8&255),this.buffer_.push(e>>>16&255),this.buffer_.push(e>>>24&255)},jspb.BinaryEncoder.prototype.writeInt64=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_63&&e=-jspb.BinaryConstants.TWO_TO_63&&+e=-jspb.BinaryConstants.FLOAT32_MAX&&e<=jspb.BinaryConstants.FLOAT32_MAX),jspb.utils.splitFloat32(e),this.writeUint32(jspb.utils.split64Low)},jspb.BinaryEncoder.prototype.writeDouble=function(e){jspb.asserts.assert(1/0===e||-1/0===e||isNaN(e)||e>=-jspb.BinaryConstants.FLOAT64_MAX&&e<=jspb.BinaryConstants.FLOAT64_MAX),jspb.utils.splitFloat64(e),this.writeUint32(jspb.utils.split64Low),this.writeUint32(jspb.utils.split64High)},jspb.BinaryEncoder.prototype.writeBool=function(e){jspb.asserts.assert("boolean"==typeof e||"number"==typeof e),this.buffer_.push(e?1:0)},jspb.BinaryEncoder.prototype.writeEnum=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_31&&eo)this.buffer_.push(o);else if(2048>o)this.buffer_.push(o>>6|192),this.buffer_.push(63&o|128);else if(65536>o)if(55296<=o&&56319>=o&&r+1=i&&(o=1024*(o-55296)+i-56320+65536,this.buffer_.push(o>>18|240),this.buffer_.push(o>>12&63|128),this.buffer_.push(o>>6&63|128),this.buffer_.push(63&o|128),r++)}else this.buffer_.push(o>>12|224),this.buffer_.push(o>>6&63|128),this.buffer_.push(63&o|128)}return this.buffer_.length-t},jspb.arith={},jspb.arith.UInt64=function(e,t){this.lo=e,this.hi=t},jspb.arith.UInt64.prototype.cmp=function(e){return this.hi>>1|(1&this.hi)<<31)>>>0,this.hi>>>1>>>0)},jspb.arith.UInt64.prototype.leftShift=function(){return new jspb.arith.UInt64(this.lo<<1>>>0,(this.hi<<1|this.lo>>>31)>>>0)},jspb.arith.UInt64.prototype.msb=function(){return!!(2147483648&this.hi)},jspb.arith.UInt64.prototype.lsb=function(){return!!(1&this.lo)},jspb.arith.UInt64.prototype.zero=function(){return 0==this.lo&&0==this.hi},jspb.arith.UInt64.prototype.add=function(e){return new jspb.arith.UInt64((this.lo+e.lo&4294967295)>>>0>>>0,((this.hi+e.hi&4294967295)>>>0)+(4294967296<=this.lo+e.lo?1:0)>>>0)},jspb.arith.UInt64.prototype.sub=function(e){return new jspb.arith.UInt64((this.lo-e.lo&4294967295)>>>0>>>0,((this.hi-e.hi&4294967295)>>>0)-(0>this.lo-e.lo?1:0)>>>0)},jspb.arith.UInt64.mul32x32=function(e,t){var r=65535&e,o=65535&t,i=t>>>16;for(t=r*o+65536*(r*i&65535)+65536*((e>>>=16)*o&65535),r=e*i+(r*i>>>16)+(e*o>>>16);4294967296<=t;)t-=4294967296,r+=1;return new jspb.arith.UInt64(t>>>0,r>>>0)},jspb.arith.UInt64.prototype.mul=function(e){var t=jspb.arith.UInt64.mul32x32(this.lo,e);return(e=jspb.arith.UInt64.mul32x32(this.hi,e)).hi=e.lo,e.lo=0,t.add(e)},jspb.arith.UInt64.prototype.div=function(e){if(0==e)return[];var t=new jspb.arith.UInt64(0,0),r=new jspb.arith.UInt64(this.lo,this.hi);e=new jspb.arith.UInt64(e,0);for(var o=new jspb.arith.UInt64(1,0);!e.msb();)e=e.leftShift(),o=o.leftShift();for(;!o.zero();)0>=e.cmp(r)&&(t=t.add(o),r=r.sub(e)),e=e.rightShift(),o=o.rightShift();return[t,r]},jspb.arith.UInt64.prototype.toString=function(){for(var e="",t=this;!t.zero();){var r=(t=t.div(10))[0];e=t[1].lo+e,t=r}return""==e&&(e="0"),e},jspb.arith.UInt64.fromString=function(e){for(var t=new jspb.arith.UInt64(0,0),r=new jspb.arith.UInt64(0,0),o=0;oe[o]||"9">>0>>>0,((this.hi+e.hi&4294967295)>>>0)+(4294967296<=this.lo+e.lo?1:0)>>>0)},jspb.arith.Int64.prototype.sub=function(e){return new jspb.arith.Int64((this.lo-e.lo&4294967295)>>>0>>>0,((this.hi-e.hi&4294967295)>>>0)-(0>this.lo-e.lo?1:0)>>>0)},jspb.arith.Int64.prototype.clone=function(){return new jspb.arith.Int64(this.lo,this.hi)},jspb.arith.Int64.prototype.toString=function(){var e=0!=(2147483648&this.hi),t=new jspb.arith.UInt64(this.lo,this.hi);return e&&(t=new jspb.arith.UInt64(0,0).sub(t)),(e?"-":"")+t.toString()},jspb.arith.Int64.fromString=function(e){var t=0>>=7,this.totalLength_++;e.push(t),this.totalLength_++},jspb.BinaryWriter.prototype.writeSerializedMessage=function(e,t,r){this.appendUint8Array_(e.subarray(t,r))},jspb.BinaryWriter.prototype.maybeWriteSerializedMessage=function(e,t,r){null!=e&&null!=t&&null!=r&&this.writeSerializedMessage(e,t,r)},jspb.BinaryWriter.prototype.reset=function(){this.blocks_=[],this.encoder_.end(),this.totalLength_=0,this.bookmarks_=[]},jspb.BinaryWriter.prototype.getResultBuffer=function(){jspb.asserts.assert(0==this.bookmarks_.length);for(var e=new Uint8Array(this.totalLength_+this.encoder_.length()),t=this.blocks_,r=t.length,o=0,i=0;i=-jspb.BinaryConstants.TWO_TO_31&&t=-jspb.BinaryConstants.TWO_TO_31&&t=-jspb.BinaryConstants.TWO_TO_63&&t=-jspb.BinaryConstants.TWO_TO_31&&t=-jspb.BinaryConstants.TWO_TO_63&&t=-jspb.BinaryConstants.TWO_TO_31&&t=-jspb.BinaryConstants.TWO_TO_63&&t=-jspb.BinaryConstants.TWO_TO_31&&t>>0,t>>>0)}))},jspb.BinaryWriter.prototype.writeRepeatedInt32=function(e,t){if(null!=t)for(var r=0;r>>0,t>>>0)}));this.endDelimited_(e)}},jspb.BinaryWriter.prototype.writePackedInt64String=function(e,t){if(null!=t&&t.length){e=this.beginDelimited_(e);for(var r=0;rt.length?r.length:t.length;for(e.getJsPbMessageId()&&(o[0]=e.getJsPbMessageId(),i=1);i0&&t.writeString(1,r),(r=e.getValue_asU8()).length>0&&t.writeBytes(2,r)},proto.google.protobuf.Any.prototype.getTypeUrl=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.google.protobuf.Any.prototype.setTypeUrl=function(e){return t.Message.setProto3StringField(this,1,e)},proto.google.protobuf.Any.prototype.getValue=function(){return t.Message.getFieldWithDefault(this,2,"")},proto.google.protobuf.Any.prototype.getValue_asB64=function(){return t.Message.bytesAsB64(this.getValue())},proto.google.protobuf.Any.prototype.getValue_asU8=function(){return t.Message.bytesAsU8(this.getValue())},proto.google.protobuf.Any.prototype.setValue=function(e){return t.Message.setProto3BytesField(this,2,e)},r.object.extend(e,proto.google.protobuf),proto.google.protobuf.Any.prototype.getTypeName=function(){return this.getTypeUrl().split("/").pop()},proto.google.protobuf.Any.prototype.pack=function(e,t,r){r||(r="type.googleapis.com/"),"/"!=r.substr(-1)?this.setTypeUrl(r+"/"+t):this.setTypeUrl(r+t),this.setValue(e)},proto.google.protobuf.Any.prototype.unpack=function(e,t){return this.getTypeName()==t?e(this.getValue_asU8()):null}}(any_pb);var mediapipe_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.MediaPipeOptions",null,o),proto.mediapipe.MediaPipeOptions=function(e){t.Message.initialize(this,e,0,1,null,null)},r.inherits(proto.mediapipe.MediaPipeOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.MediaPipeOptions.displayName="proto.mediapipe.MediaPipeOptions"),proto.mediapipe.MediaPipeOptions.extensions={},proto.mediapipe.MediaPipeOptions.extensionsBinary={},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.MediaPipeOptions.prototype.toObject=function(e){return proto.mediapipe.MediaPipeOptions.toObject(e,this)},proto.mediapipe.MediaPipeOptions.toObject=function(e,r){var o={};return t.Message.toObjectExtension(r,o,proto.mediapipe.MediaPipeOptions.extensions,proto.mediapipe.MediaPipeOptions.prototype.getExtension,e),e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.MediaPipeOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.MediaPipeOptions;return proto.mediapipe.MediaPipeOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.MediaPipeOptions.deserializeBinaryFromReader=function(e,r){for(;r.nextField()&&!r.isEndGroup();){r.getFieldNumber();t.Message.readBinaryExtension(e,r,proto.mediapipe.MediaPipeOptions.extensionsBinary,proto.mediapipe.MediaPipeOptions.prototype.getExtension,proto.mediapipe.MediaPipeOptions.prototype.setExtension)}return e},proto.mediapipe.MediaPipeOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.MediaPipeOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.MediaPipeOptions.serializeBinaryToWriter=function(e,r){t.Message.serializeBinaryExtensions(e,r,proto.mediapipe.MediaPipeOptions.extensionsBinary,proto.mediapipe.MediaPipeOptions.prototype.getExtension)},r.object.extend(e,proto.mediapipe)}(mediapipe_options_pb);var packet_factory_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.PacketFactoryConfig",null,o),r.exportSymbol("proto.mediapipe.PacketFactoryOptions",null,o),r.exportSymbol("proto.mediapipe.PacketManagerConfig",null,o),proto.mediapipe.PacketFactoryOptions=function(e){t.Message.initialize(this,e,0,1,null,null)},r.inherits(proto.mediapipe.PacketFactoryOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.PacketFactoryOptions.displayName="proto.mediapipe.PacketFactoryOptions"),proto.mediapipe.PacketFactoryOptions.extensions={},proto.mediapipe.PacketFactoryOptions.extensionsBinary={},proto.mediapipe.PacketFactoryConfig=function(e){t.Message.initialize(this,e,0,500,null,null)},r.inherits(proto.mediapipe.PacketFactoryConfig,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.PacketFactoryConfig.displayName="proto.mediapipe.PacketFactoryConfig"),proto.mediapipe.PacketManagerConfig=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.PacketManagerConfig.repeatedFields_,null)},r.inherits(proto.mediapipe.PacketManagerConfig,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.PacketManagerConfig.displayName="proto.mediapipe.PacketManagerConfig"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.PacketFactoryOptions.prototype.toObject=function(e){return proto.mediapipe.PacketFactoryOptions.toObject(e,this)},proto.mediapipe.PacketFactoryOptions.toObject=function(e,r){var o={};return t.Message.toObjectExtension(r,o,proto.mediapipe.PacketFactoryOptions.extensions,proto.mediapipe.PacketFactoryOptions.prototype.getExtension,e),e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.PacketFactoryOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.PacketFactoryOptions;return proto.mediapipe.PacketFactoryOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.PacketFactoryOptions.deserializeBinaryFromReader=function(e,r){for(;r.nextField()&&!r.isEndGroup();){r.getFieldNumber();t.Message.readBinaryExtension(e,r,proto.mediapipe.PacketFactoryOptions.extensionsBinary,proto.mediapipe.PacketFactoryOptions.prototype.getExtension,proto.mediapipe.PacketFactoryOptions.prototype.setExtension)}return e},proto.mediapipe.PacketFactoryOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.PacketFactoryOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.PacketFactoryOptions.serializeBinaryToWriter=function(e,r){t.Message.serializeBinaryExtensions(e,r,proto.mediapipe.PacketFactoryOptions.extensionsBinary,proto.mediapipe.PacketFactoryOptions.prototype.getExtension)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.PacketFactoryConfig.prototype.toObject=function(e){return proto.mediapipe.PacketFactoryConfig.toObject(e,this)},proto.mediapipe.PacketFactoryConfig.toObject=function(e,r){var o,i={packetFactory:null==(o=t.Message.getField(r,1))?void 0:o,outputSidePacket:null==(o=t.Message.getField(r,2))?void 0:o,externalOutput:null==(o=t.Message.getField(r,1002))?void 0:o,options:(o=r.getOptions())&&proto.mediapipe.PacketFactoryOptions.toObject(e,o)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.PacketFactoryConfig.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.PacketFactoryConfig;return proto.mediapipe.PacketFactoryConfig.deserializeBinaryFromReader(o,r)},proto.mediapipe.PacketFactoryConfig.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setPacketFactory(r);break;case 2:r=t.readString();e.setOutputSidePacket(r);break;case 1002:r=t.readString();e.setExternalOutput(r);break;case 3:r=new proto.mediapipe.PacketFactoryOptions;t.readMessage(r,proto.mediapipe.PacketFactoryOptions.deserializeBinaryFromReader),e.setOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.PacketFactoryConfig.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.PacketFactoryConfig.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.PacketFactoryConfig.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeString(1,o),null!=(o=t.Message.getField(e,2))&&r.writeString(2,o),null!=(o=t.Message.getField(e,1002))&&r.writeString(1002,o),null!=(o=e.getOptions())&&r.writeMessage(3,o,proto.mediapipe.PacketFactoryOptions.serializeBinaryToWriter)},proto.mediapipe.PacketFactoryConfig.prototype.getPacketFactory=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.PacketFactoryConfig.prototype.setPacketFactory=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.PacketFactoryConfig.prototype.clearPacketFactory=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.PacketFactoryConfig.prototype.hasPacketFactory=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.PacketFactoryConfig.prototype.getOutputSidePacket=function(){return t.Message.getFieldWithDefault(this,2,"")},proto.mediapipe.PacketFactoryConfig.prototype.setOutputSidePacket=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.PacketFactoryConfig.prototype.clearOutputSidePacket=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.PacketFactoryConfig.prototype.hasOutputSidePacket=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.PacketFactoryConfig.prototype.getExternalOutput=function(){return t.Message.getFieldWithDefault(this,1002,"")},proto.mediapipe.PacketFactoryConfig.prototype.setExternalOutput=function(e){return t.Message.setField(this,1002,e)},proto.mediapipe.PacketFactoryConfig.prototype.clearExternalOutput=function(){return t.Message.setField(this,1002,void 0)},proto.mediapipe.PacketFactoryConfig.prototype.hasExternalOutput=function(){return null!=t.Message.getField(this,1002)},proto.mediapipe.PacketFactoryConfig.prototype.getOptions=function(){return t.Message.getWrapperField(this,proto.mediapipe.PacketFactoryOptions,3)},proto.mediapipe.PacketFactoryConfig.prototype.setOptions=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.PacketFactoryConfig.prototype.clearOptions=function(){return this.setOptions(void 0)},proto.mediapipe.PacketFactoryConfig.prototype.hasOptions=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.PacketManagerConfig.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.PacketManagerConfig.prototype.toObject=function(e){return proto.mediapipe.PacketManagerConfig.toObject(e,this)},proto.mediapipe.PacketManagerConfig.toObject=function(e,r){var o={packetList:t.Message.toObjectList(r.getPacketList(),proto.mediapipe.PacketFactoryConfig.toObject,e)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.PacketManagerConfig.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.PacketManagerConfig;return proto.mediapipe.PacketManagerConfig.deserializeBinaryFromReader(o,r)},proto.mediapipe.PacketManagerConfig.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new proto.mediapipe.PacketFactoryConfig;t.readMessage(r,proto.mediapipe.PacketFactoryConfig.deserializeBinaryFromReader),e.addPacket(r)}else t.skipField()}return e},proto.mediapipe.PacketManagerConfig.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.PacketManagerConfig.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.PacketManagerConfig.serializeBinaryToWriter=function(e,t){var r;(r=e.getPacketList()).length>0&&t.writeRepeatedMessage(1,r,proto.mediapipe.PacketFactoryConfig.serializeBinaryToWriter)},proto.mediapipe.PacketManagerConfig.prototype.getPacketList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.PacketFactoryConfig,1)},proto.mediapipe.PacketManagerConfig.prototype.setPacketList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.PacketManagerConfig.prototype.addPacket=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.PacketFactoryConfig,r)},proto.mediapipe.PacketManagerConfig.prototype.clearPacketList=function(){return this.setPacketList([])},r.object.extend(e,proto.mediapipe)}(packet_factory_pb);var packet_generator_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.PacketGeneratorConfig",null,o),r.exportSymbol("proto.mediapipe.PacketGeneratorOptions",null,o),proto.mediapipe.PacketGeneratorOptions=function(e){t.Message.initialize(this,e,0,2,null,null)},r.inherits(proto.mediapipe.PacketGeneratorOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.PacketGeneratorOptions.displayName="proto.mediapipe.PacketGeneratorOptions"),proto.mediapipe.PacketGeneratorOptions.extensions={},proto.mediapipe.PacketGeneratorOptions.extensionsBinary={},proto.mediapipe.PacketGeneratorConfig=function(e){t.Message.initialize(this,e,0,500,proto.mediapipe.PacketGeneratorConfig.repeatedFields_,null)},r.inherits(proto.mediapipe.PacketGeneratorConfig,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.PacketGeneratorConfig.displayName="proto.mediapipe.PacketGeneratorConfig"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.PacketGeneratorOptions.prototype.toObject=function(e){return proto.mediapipe.PacketGeneratorOptions.toObject(e,this)},proto.mediapipe.PacketGeneratorOptions.toObject=function(e,r){var o={mergeFields:t.Message.getBooleanFieldWithDefault(r,1,!0)};return t.Message.toObjectExtension(r,o,proto.mediapipe.PacketGeneratorOptions.extensions,proto.mediapipe.PacketGeneratorOptions.prototype.getExtension,e),e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.PacketGeneratorOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.PacketGeneratorOptions;return proto.mediapipe.PacketGeneratorOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.PacketGeneratorOptions.deserializeBinaryFromReader=function(e,r){for(;r.nextField()&&!r.isEndGroup();){if(1===r.getFieldNumber()){var o=r.readBool();e.setMergeFields(o)}else t.Message.readBinaryExtension(e,r,proto.mediapipe.PacketGeneratorOptions.extensionsBinary,proto.mediapipe.PacketGeneratorOptions.prototype.getExtension,proto.mediapipe.PacketGeneratorOptions.prototype.setExtension)}return e},proto.mediapipe.PacketGeneratorOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.PacketGeneratorOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.PacketGeneratorOptions.serializeBinaryToWriter=function(e,r){var o;null!=(o=t.Message.getField(e,1))&&r.writeBool(1,o),t.Message.serializeBinaryExtensions(e,r,proto.mediapipe.PacketGeneratorOptions.extensionsBinary,proto.mediapipe.PacketGeneratorOptions.prototype.getExtension)},proto.mediapipe.PacketGeneratorOptions.prototype.getMergeFields=function(){return t.Message.getBooleanFieldWithDefault(this,1,!0)},proto.mediapipe.PacketGeneratorOptions.prototype.setMergeFields=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.PacketGeneratorOptions.prototype.clearMergeFields=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.PacketGeneratorOptions.prototype.hasMergeFields=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.PacketGeneratorConfig.repeatedFields_=[2,1002,3,1003],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.PacketGeneratorConfig.prototype.toObject=function(e){return proto.mediapipe.PacketGeneratorConfig.toObject(e,this)},proto.mediapipe.PacketGeneratorConfig.toObject=function(e,r){var o,i={packetGenerator:null==(o=t.Message.getField(r,1))?void 0:o,inputSidePacketList:null==(o=t.Message.getRepeatedField(r,2))?void 0:o,externalInputList:null==(o=t.Message.getRepeatedField(r,1002))?void 0:o,outputSidePacketList:null==(o=t.Message.getRepeatedField(r,3))?void 0:o,externalOutputList:null==(o=t.Message.getRepeatedField(r,1003))?void 0:o,options:(o=r.getOptions())&&proto.mediapipe.PacketGeneratorOptions.toObject(e,o)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.PacketGeneratorConfig.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.PacketGeneratorConfig;return proto.mediapipe.PacketGeneratorConfig.deserializeBinaryFromReader(o,r)},proto.mediapipe.PacketGeneratorConfig.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setPacketGenerator(r);break;case 2:r=t.readString();e.addInputSidePacket(r);break;case 1002:r=t.readString();e.addExternalInput(r);break;case 3:r=t.readString();e.addOutputSidePacket(r);break;case 1003:r=t.readString();e.addExternalOutput(r);break;case 4:r=new proto.mediapipe.PacketGeneratorOptions;t.readMessage(r,proto.mediapipe.PacketGeneratorOptions.deserializeBinaryFromReader),e.setOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.PacketGeneratorConfig.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.PacketGeneratorConfig.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.PacketGeneratorConfig.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeString(1,o),(o=e.getInputSidePacketList()).length>0&&r.writeRepeatedString(2,o),(o=e.getExternalInputList()).length>0&&r.writeRepeatedString(1002,o),(o=e.getOutputSidePacketList()).length>0&&r.writeRepeatedString(3,o),(o=e.getExternalOutputList()).length>0&&r.writeRepeatedString(1003,o),null!=(o=e.getOptions())&&r.writeMessage(4,o,proto.mediapipe.PacketGeneratorOptions.serializeBinaryToWriter)},proto.mediapipe.PacketGeneratorConfig.prototype.getPacketGenerator=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.PacketGeneratorConfig.prototype.setPacketGenerator=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.PacketGeneratorConfig.prototype.clearPacketGenerator=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.PacketGeneratorConfig.prototype.hasPacketGenerator=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.PacketGeneratorConfig.prototype.getInputSidePacketList=function(){return t.Message.getRepeatedField(this,2)},proto.mediapipe.PacketGeneratorConfig.prototype.setInputSidePacketList=function(e){return t.Message.setField(this,2,e||[])},proto.mediapipe.PacketGeneratorConfig.prototype.addInputSidePacket=function(e,r){return t.Message.addToRepeatedField(this,2,e,r)},proto.mediapipe.PacketGeneratorConfig.prototype.clearInputSidePacketList=function(){return this.setInputSidePacketList([])},proto.mediapipe.PacketGeneratorConfig.prototype.getExternalInputList=function(){return t.Message.getRepeatedField(this,1002)},proto.mediapipe.PacketGeneratorConfig.prototype.setExternalInputList=function(e){return t.Message.setField(this,1002,e||[])},proto.mediapipe.PacketGeneratorConfig.prototype.addExternalInput=function(e,r){return t.Message.addToRepeatedField(this,1002,e,r)},proto.mediapipe.PacketGeneratorConfig.prototype.clearExternalInputList=function(){return this.setExternalInputList([])},proto.mediapipe.PacketGeneratorConfig.prototype.getOutputSidePacketList=function(){return t.Message.getRepeatedField(this,3)},proto.mediapipe.PacketGeneratorConfig.prototype.setOutputSidePacketList=function(e){return t.Message.setField(this,3,e||[])},proto.mediapipe.PacketGeneratorConfig.prototype.addOutputSidePacket=function(e,r){return t.Message.addToRepeatedField(this,3,e,r)},proto.mediapipe.PacketGeneratorConfig.prototype.clearOutputSidePacketList=function(){return this.setOutputSidePacketList([])},proto.mediapipe.PacketGeneratorConfig.prototype.getExternalOutputList=function(){return t.Message.getRepeatedField(this,1003)},proto.mediapipe.PacketGeneratorConfig.prototype.setExternalOutputList=function(e){return t.Message.setField(this,1003,e||[])},proto.mediapipe.PacketGeneratorConfig.prototype.addExternalOutput=function(e,r){return t.Message.addToRepeatedField(this,1003,e,r)},proto.mediapipe.PacketGeneratorConfig.prototype.clearExternalOutputList=function(){return this.setExternalOutputList([])},proto.mediapipe.PacketGeneratorConfig.prototype.getOptions=function(){return t.Message.getWrapperField(this,proto.mediapipe.PacketGeneratorOptions,4)},proto.mediapipe.PacketGeneratorConfig.prototype.setOptions=function(e){return t.Message.setWrapperField(this,4,e)},proto.mediapipe.PacketGeneratorConfig.prototype.clearOptions=function(){return this.setOptions(void 0)},proto.mediapipe.PacketGeneratorConfig.prototype.hasOptions=function(){return null!=t.Message.getField(this,4)},r.object.extend(e,proto.mediapipe)}(packet_generator_pb);var status_handler_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=mediapipe_options_pb;r.object.extend(proto,i),r.exportSymbol("proto.mediapipe.StatusHandlerConfig",null,o),proto.mediapipe.StatusHandlerConfig=function(e){t.Message.initialize(this,e,0,500,proto.mediapipe.StatusHandlerConfig.repeatedFields_,null)},r.inherits(proto.mediapipe.StatusHandlerConfig,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.StatusHandlerConfig.displayName="proto.mediapipe.StatusHandlerConfig"),proto.mediapipe.StatusHandlerConfig.repeatedFields_=[2,1002],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.StatusHandlerConfig.prototype.toObject=function(e){return proto.mediapipe.StatusHandlerConfig.toObject(e,this)},proto.mediapipe.StatusHandlerConfig.toObject=function(e,r){var o,a={statusHandler:null==(o=t.Message.getField(r,1))?void 0:o,inputSidePacketList:null==(o=t.Message.getRepeatedField(r,2))?void 0:o,externalInputList:null==(o=t.Message.getRepeatedField(r,1002))?void 0:o,options:(o=r.getOptions())&&i.MediaPipeOptions.toObject(e,o)};return e&&(a.$jspbMessageInstance=r),a}),proto.mediapipe.StatusHandlerConfig.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.StatusHandlerConfig;return proto.mediapipe.StatusHandlerConfig.deserializeBinaryFromReader(o,r)},proto.mediapipe.StatusHandlerConfig.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setStatusHandler(r);break;case 2:r=t.readString();e.addInputSidePacket(r);break;case 1002:r=t.readString();e.addExternalInput(r);break;case 3:r=new i.MediaPipeOptions;t.readMessage(r,i.MediaPipeOptions.deserializeBinaryFromReader),e.setOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.StatusHandlerConfig.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.StatusHandlerConfig.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.StatusHandlerConfig.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeString(1,o),(o=e.getInputSidePacketList()).length>0&&r.writeRepeatedString(2,o),(o=e.getExternalInputList()).length>0&&r.writeRepeatedString(1002,o),null!=(o=e.getOptions())&&r.writeMessage(3,o,i.MediaPipeOptions.serializeBinaryToWriter)},proto.mediapipe.StatusHandlerConfig.prototype.getStatusHandler=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.StatusHandlerConfig.prototype.setStatusHandler=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.StatusHandlerConfig.prototype.clearStatusHandler=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.StatusHandlerConfig.prototype.hasStatusHandler=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.StatusHandlerConfig.prototype.getInputSidePacketList=function(){return t.Message.getRepeatedField(this,2)},proto.mediapipe.StatusHandlerConfig.prototype.setInputSidePacketList=function(e){return t.Message.setField(this,2,e||[])},proto.mediapipe.StatusHandlerConfig.prototype.addInputSidePacket=function(e,r){return t.Message.addToRepeatedField(this,2,e,r)},proto.mediapipe.StatusHandlerConfig.prototype.clearInputSidePacketList=function(){return this.setInputSidePacketList([])},proto.mediapipe.StatusHandlerConfig.prototype.getExternalInputList=function(){return t.Message.getRepeatedField(this,1002)},proto.mediapipe.StatusHandlerConfig.prototype.setExternalInputList=function(e){return t.Message.setField(this,1002,e||[])},proto.mediapipe.StatusHandlerConfig.prototype.addExternalInput=function(e,r){return t.Message.addToRepeatedField(this,1002,e,r)},proto.mediapipe.StatusHandlerConfig.prototype.clearExternalInputList=function(){return this.setExternalInputList([])},proto.mediapipe.StatusHandlerConfig.prototype.getOptions=function(){return t.Message.getWrapperField(this,i.MediaPipeOptions,3)},proto.mediapipe.StatusHandlerConfig.prototype.setOptions=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.StatusHandlerConfig.prototype.clearOptions=function(){return this.setOptions(void 0)},proto.mediapipe.StatusHandlerConfig.prototype.hasOptions=function(){return null!=t.Message.getField(this,3)},r.object.extend(e,proto.mediapipe)}(status_handler_pb);var stream_handler_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=mediapipe_options_pb;r.object.extend(proto,i),r.exportSymbol("proto.mediapipe.InputStreamHandlerConfig",null,o),r.exportSymbol("proto.mediapipe.OutputStreamHandlerConfig",null,o),proto.mediapipe.InputStreamHandlerConfig=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.InputStreamHandlerConfig,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.InputStreamHandlerConfig.displayName="proto.mediapipe.InputStreamHandlerConfig"),proto.mediapipe.OutputStreamHandlerConfig=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.OutputStreamHandlerConfig.repeatedFields_,null)},r.inherits(proto.mediapipe.OutputStreamHandlerConfig,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.OutputStreamHandlerConfig.displayName="proto.mediapipe.OutputStreamHandlerConfig"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.InputStreamHandlerConfig.prototype.toObject=function(e){return proto.mediapipe.InputStreamHandlerConfig.toObject(e,this)},proto.mediapipe.InputStreamHandlerConfig.toObject=function(e,r){var o,a={inputStreamHandler:t.Message.getFieldWithDefault(r,1,"DefaultInputStreamHandler"),options:(o=r.getOptions())&&i.MediaPipeOptions.toObject(e,o)};return e&&(a.$jspbMessageInstance=r),a}),proto.mediapipe.InputStreamHandlerConfig.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.InputStreamHandlerConfig;return proto.mediapipe.InputStreamHandlerConfig.deserializeBinaryFromReader(o,r)},proto.mediapipe.InputStreamHandlerConfig.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setInputStreamHandler(r);break;case 3:r=new i.MediaPipeOptions;t.readMessage(r,i.MediaPipeOptions.deserializeBinaryFromReader),e.setOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.InputStreamHandlerConfig.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.InputStreamHandlerConfig.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.InputStreamHandlerConfig.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeString(1,o),null!=(o=e.getOptions())&&r.writeMessage(3,o,i.MediaPipeOptions.serializeBinaryToWriter)},proto.mediapipe.InputStreamHandlerConfig.prototype.getInputStreamHandler=function(){return t.Message.getFieldWithDefault(this,1,"DefaultInputStreamHandler")},proto.mediapipe.InputStreamHandlerConfig.prototype.setInputStreamHandler=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.InputStreamHandlerConfig.prototype.clearInputStreamHandler=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.InputStreamHandlerConfig.prototype.hasInputStreamHandler=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.InputStreamHandlerConfig.prototype.getOptions=function(){return t.Message.getWrapperField(this,i.MediaPipeOptions,3)},proto.mediapipe.InputStreamHandlerConfig.prototype.setOptions=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.InputStreamHandlerConfig.prototype.clearOptions=function(){return this.setOptions(void 0)},proto.mediapipe.InputStreamHandlerConfig.prototype.hasOptions=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.OutputStreamHandlerConfig.repeatedFields_=[2],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.OutputStreamHandlerConfig.prototype.toObject=function(e){return proto.mediapipe.OutputStreamHandlerConfig.toObject(e,this)},proto.mediapipe.OutputStreamHandlerConfig.toObject=function(e,r){var o,a={outputStreamHandler:t.Message.getFieldWithDefault(r,1,"InOrderOutputStreamHandler"),inputSidePacketList:null==(o=t.Message.getRepeatedField(r,2))?void 0:o,options:(o=r.getOptions())&&i.MediaPipeOptions.toObject(e,o)};return e&&(a.$jspbMessageInstance=r),a}),proto.mediapipe.OutputStreamHandlerConfig.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.OutputStreamHandlerConfig;return proto.mediapipe.OutputStreamHandlerConfig.deserializeBinaryFromReader(o,r)},proto.mediapipe.OutputStreamHandlerConfig.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setOutputStreamHandler(r);break;case 2:r=t.readString();e.addInputSidePacket(r);break;case 3:r=new i.MediaPipeOptions;t.readMessage(r,i.MediaPipeOptions.deserializeBinaryFromReader),e.setOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.OutputStreamHandlerConfig.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.OutputStreamHandlerConfig.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.OutputStreamHandlerConfig.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeString(1,o),(o=e.getInputSidePacketList()).length>0&&r.writeRepeatedString(2,o),null!=(o=e.getOptions())&&r.writeMessage(3,o,i.MediaPipeOptions.serializeBinaryToWriter)},proto.mediapipe.OutputStreamHandlerConfig.prototype.getOutputStreamHandler=function(){return t.Message.getFieldWithDefault(this,1,"InOrderOutputStreamHandler")},proto.mediapipe.OutputStreamHandlerConfig.prototype.setOutputStreamHandler=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.OutputStreamHandlerConfig.prototype.clearOutputStreamHandler=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.OutputStreamHandlerConfig.prototype.hasOutputStreamHandler=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.OutputStreamHandlerConfig.prototype.getInputSidePacketList=function(){return t.Message.getRepeatedField(this,2)},proto.mediapipe.OutputStreamHandlerConfig.prototype.setInputSidePacketList=function(e){return t.Message.setField(this,2,e||[])},proto.mediapipe.OutputStreamHandlerConfig.prototype.addInputSidePacket=function(e,r){return t.Message.addToRepeatedField(this,2,e,r)},proto.mediapipe.OutputStreamHandlerConfig.prototype.clearInputSidePacketList=function(){return this.setInputSidePacketList([])},proto.mediapipe.OutputStreamHandlerConfig.prototype.getOptions=function(){return t.Message.getWrapperField(this,i.MediaPipeOptions,3)},proto.mediapipe.OutputStreamHandlerConfig.prototype.setOptions=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.OutputStreamHandlerConfig.prototype.clearOptions=function(){return this.setOptions(void 0)},proto.mediapipe.OutputStreamHandlerConfig.prototype.hasOptions=function(){return null!=t.Message.getField(this,3)},r.object.extend(e,proto.mediapipe)}(stream_handler_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_options_pb;r.object.extend(proto,i);var a=any_pb;r.object.extend(proto,a);var n=mediapipe_options_pb;r.object.extend(proto,n);var s=packet_factory_pb;r.object.extend(proto,s);var p=packet_generator_pb;r.object.extend(proto,p);var d=status_handler_pb;r.object.extend(proto,d);var l=stream_handler_pb;r.object.extend(proto,l),r.exportSymbol("proto.mediapipe.CalculatorGraphConfig",null,o),r.exportSymbol("proto.mediapipe.CalculatorGraphConfig.Node",null,o),r.exportSymbol("proto.mediapipe.ExecutorConfig",null,o),r.exportSymbol("proto.mediapipe.InputCollection",null,o),r.exportSymbol("proto.mediapipe.InputCollection.InputType",null,o),r.exportSymbol("proto.mediapipe.InputCollectionSet",null,o),r.exportSymbol("proto.mediapipe.InputStreamInfo",null,o),r.exportSymbol("proto.mediapipe.ProfilerConfig",null,o),proto.mediapipe.ExecutorConfig=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.ExecutorConfig,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.ExecutorConfig.displayName="proto.mediapipe.ExecutorConfig"),proto.mediapipe.InputCollection=function(e){t.Message.initialize(this,e,0,500,proto.mediapipe.InputCollection.repeatedFields_,null)},r.inherits(proto.mediapipe.InputCollection,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.InputCollection.displayName="proto.mediapipe.InputCollection"),proto.mediapipe.InputCollectionSet=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.InputCollectionSet.repeatedFields_,null)},r.inherits(proto.mediapipe.InputCollectionSet,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.InputCollectionSet.displayName="proto.mediapipe.InputCollectionSet"),proto.mediapipe.InputStreamInfo=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.InputStreamInfo,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.InputStreamInfo.displayName="proto.mediapipe.InputStreamInfo"),proto.mediapipe.ProfilerConfig=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.ProfilerConfig.repeatedFields_,null)},r.inherits(proto.mediapipe.ProfilerConfig,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.ProfilerConfig.displayName="proto.mediapipe.ProfilerConfig"),proto.mediapipe.CalculatorGraphConfig=function(e){t.Message.initialize(this,e,0,500,proto.mediapipe.CalculatorGraphConfig.repeatedFields_,null)},r.inherits(proto.mediapipe.CalculatorGraphConfig,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.CalculatorGraphConfig.displayName="proto.mediapipe.CalculatorGraphConfig"),proto.mediapipe.CalculatorGraphConfig.Node=function(e){t.Message.initialize(this,e,0,500,proto.mediapipe.CalculatorGraphConfig.Node.repeatedFields_,null)},r.inherits(proto.mediapipe.CalculatorGraphConfig.Node,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.CalculatorGraphConfig.Node.displayName="proto.mediapipe.CalculatorGraphConfig.Node"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.ExecutorConfig.prototype.toObject=function(e){return proto.mediapipe.ExecutorConfig.toObject(e,this)},proto.mediapipe.ExecutorConfig.toObject=function(e,r){var o,i={name:t.Message.getFieldWithDefault(r,1,""),type:t.Message.getFieldWithDefault(r,2,""),options:(o=r.getOptions())&&n.MediaPipeOptions.toObject(e,o)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.ExecutorConfig.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.ExecutorConfig;return proto.mediapipe.ExecutorConfig.deserializeBinaryFromReader(o,r)},proto.mediapipe.ExecutorConfig.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setName(r);break;case 2:r=t.readString();e.setType(r);break;case 3:r=new n.MediaPipeOptions;t.readMessage(r,n.MediaPipeOptions.deserializeBinaryFromReader),e.setOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.ExecutorConfig.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.ExecutorConfig.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.ExecutorConfig.serializeBinaryToWriter=function(e,t){var r=void 0;(r=e.getName()).length>0&&t.writeString(1,r),(r=e.getType()).length>0&&t.writeString(2,r),null!=(r=e.getOptions())&&t.writeMessage(3,r,n.MediaPipeOptions.serializeBinaryToWriter)},proto.mediapipe.ExecutorConfig.prototype.getName=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.ExecutorConfig.prototype.setName=function(e){return t.Message.setProto3StringField(this,1,e)},proto.mediapipe.ExecutorConfig.prototype.getType=function(){return t.Message.getFieldWithDefault(this,2,"")},proto.mediapipe.ExecutorConfig.prototype.setType=function(e){return t.Message.setProto3StringField(this,2,e)},proto.mediapipe.ExecutorConfig.prototype.getOptions=function(){return t.Message.getWrapperField(this,n.MediaPipeOptions,3)},proto.mediapipe.ExecutorConfig.prototype.setOptions=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.ExecutorConfig.prototype.clearOptions=function(){return this.setOptions(void 0)},proto.mediapipe.ExecutorConfig.prototype.hasOptions=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.InputCollection.repeatedFields_=[2,1002],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.InputCollection.prototype.toObject=function(e){return proto.mediapipe.InputCollection.toObject(e,this)},proto.mediapipe.InputCollection.toObject=function(e,r){var o,i={name:t.Message.getFieldWithDefault(r,1,""),sidePacketNameList:null==(o=t.Message.getRepeatedField(r,2))?void 0:o,externalInputNameList:null==(o=t.Message.getRepeatedField(r,1002))?void 0:o,inputType:t.Message.getFieldWithDefault(r,3,0),fileName:t.Message.getFieldWithDefault(r,4,"")};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.InputCollection.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.InputCollection;return proto.mediapipe.InputCollection.deserializeBinaryFromReader(o,r)},proto.mediapipe.InputCollection.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setName(r);break;case 2:r=t.readString();e.addSidePacketName(r);break;case 1002:r=t.readString();e.addExternalInputName(r);break;case 3:r=t.readEnum();e.setInputType(r);break;case 4:r=t.readString();e.setFileName(r);break;default:t.skipField()}}return e},proto.mediapipe.InputCollection.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.InputCollection.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.InputCollection.serializeBinaryToWriter=function(e,t){var r=void 0;(r=e.getName()).length>0&&t.writeString(1,r),(r=e.getSidePacketNameList()).length>0&&t.writeRepeatedString(2,r),(r=e.getExternalInputNameList()).length>0&&t.writeRepeatedString(1002,r),0!==(r=e.getInputType())&&t.writeEnum(3,r),(r=e.getFileName()).length>0&&t.writeString(4,r)},proto.mediapipe.InputCollection.InputType={UNKNOWN:0,RECORDIO:1,FOREIGN_RECORDIO:2,FOREIGN_CSV_TEXT:3,INVALID_UPPER_BOUND:4},proto.mediapipe.InputCollection.prototype.getName=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.InputCollection.prototype.setName=function(e){return t.Message.setProto3StringField(this,1,e)},proto.mediapipe.InputCollection.prototype.getSidePacketNameList=function(){return t.Message.getRepeatedField(this,2)},proto.mediapipe.InputCollection.prototype.setSidePacketNameList=function(e){return t.Message.setField(this,2,e||[])},proto.mediapipe.InputCollection.prototype.addSidePacketName=function(e,r){return t.Message.addToRepeatedField(this,2,e,r)},proto.mediapipe.InputCollection.prototype.clearSidePacketNameList=function(){return this.setSidePacketNameList([])},proto.mediapipe.InputCollection.prototype.getExternalInputNameList=function(){return t.Message.getRepeatedField(this,1002)},proto.mediapipe.InputCollection.prototype.setExternalInputNameList=function(e){return t.Message.setField(this,1002,e||[])},proto.mediapipe.InputCollection.prototype.addExternalInputName=function(e,r){return t.Message.addToRepeatedField(this,1002,e,r)},proto.mediapipe.InputCollection.prototype.clearExternalInputNameList=function(){return this.setExternalInputNameList([])},proto.mediapipe.InputCollection.prototype.getInputType=function(){return t.Message.getFieldWithDefault(this,3,0)},proto.mediapipe.InputCollection.prototype.setInputType=function(e){return t.Message.setProto3EnumField(this,3,e)},proto.mediapipe.InputCollection.prototype.getFileName=function(){return t.Message.getFieldWithDefault(this,4,"")},proto.mediapipe.InputCollection.prototype.setFileName=function(e){return t.Message.setProto3StringField(this,4,e)},proto.mediapipe.InputCollectionSet.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.InputCollectionSet.prototype.toObject=function(e){return proto.mediapipe.InputCollectionSet.toObject(e,this)},proto.mediapipe.InputCollectionSet.toObject=function(e,r){var o={inputCollectionList:t.Message.toObjectList(r.getInputCollectionList(),proto.mediapipe.InputCollection.toObject,e)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.InputCollectionSet.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.InputCollectionSet;return proto.mediapipe.InputCollectionSet.deserializeBinaryFromReader(o,r)},proto.mediapipe.InputCollectionSet.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new proto.mediapipe.InputCollection;t.readMessage(r,proto.mediapipe.InputCollection.deserializeBinaryFromReader),e.addInputCollection(r)}else t.skipField()}return e},proto.mediapipe.InputCollectionSet.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.InputCollectionSet.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.InputCollectionSet.serializeBinaryToWriter=function(e,t){var r;(r=e.getInputCollectionList()).length>0&&t.writeRepeatedMessage(1,r,proto.mediapipe.InputCollection.serializeBinaryToWriter)},proto.mediapipe.InputCollectionSet.prototype.getInputCollectionList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.InputCollection,1)},proto.mediapipe.InputCollectionSet.prototype.setInputCollectionList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.InputCollectionSet.prototype.addInputCollection=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.InputCollection,r)},proto.mediapipe.InputCollectionSet.prototype.clearInputCollectionList=function(){return this.setInputCollectionList([])},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.InputStreamInfo.prototype.toObject=function(e){return proto.mediapipe.InputStreamInfo.toObject(e,this)},proto.mediapipe.InputStreamInfo.toObject=function(e,r){var o={tagIndex:t.Message.getFieldWithDefault(r,1,""),backEdge:t.Message.getBooleanFieldWithDefault(r,2,!1)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.InputStreamInfo.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.InputStreamInfo;return proto.mediapipe.InputStreamInfo.deserializeBinaryFromReader(o,r)},proto.mediapipe.InputStreamInfo.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setTagIndex(r);break;case 2:r=t.readBool();e.setBackEdge(r);break;default:t.skipField()}}return e},proto.mediapipe.InputStreamInfo.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.InputStreamInfo.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.InputStreamInfo.serializeBinaryToWriter=function(e,t){var r=void 0;(r=e.getTagIndex()).length>0&&t.writeString(1,r),(r=e.getBackEdge())&&t.writeBool(2,r)},proto.mediapipe.InputStreamInfo.prototype.getTagIndex=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.InputStreamInfo.prototype.setTagIndex=function(e){return t.Message.setProto3StringField(this,1,e)},proto.mediapipe.InputStreamInfo.prototype.getBackEdge=function(){return t.Message.getBooleanFieldWithDefault(this,2,!1)},proto.mediapipe.InputStreamInfo.prototype.setBackEdge=function(e){return t.Message.setProto3BooleanField(this,2,e)},proto.mediapipe.ProfilerConfig.repeatedFields_=[8],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.ProfilerConfig.prototype.toObject=function(e){return proto.mediapipe.ProfilerConfig.toObject(e,this)},proto.mediapipe.ProfilerConfig.toObject=function(e,r){var o,i={histogramIntervalSizeUsec:t.Message.getFieldWithDefault(r,1,0),numHistogramIntervals:t.Message.getFieldWithDefault(r,2,0),enableInputOutputLatency:t.Message.getBooleanFieldWithDefault(r,3,!1),enableProfiler:t.Message.getBooleanFieldWithDefault(r,4,!1),enableStreamLatency:t.Message.getBooleanFieldWithDefault(r,5,!1),usePacketTimestampForAddedPacket:t.Message.getBooleanFieldWithDefault(r,6,!1),traceLogCapacity:t.Message.getFieldWithDefault(r,7,0),traceEventTypesDisabledList:null==(o=t.Message.getRepeatedField(r,8))?void 0:o,traceLogPath:t.Message.getFieldWithDefault(r,9,""),traceLogCount:t.Message.getFieldWithDefault(r,10,0),traceLogIntervalUsec:t.Message.getFieldWithDefault(r,11,0),traceLogMarginUsec:t.Message.getFieldWithDefault(r,12,0),traceLogDurationEvents:t.Message.getBooleanFieldWithDefault(r,13,!1),traceLogIntervalCount:t.Message.getFieldWithDefault(r,14,0),traceLogDisabled:t.Message.getBooleanFieldWithDefault(r,15,!1),traceEnabled:t.Message.getBooleanFieldWithDefault(r,16,!1),traceLogInstantEvents:t.Message.getBooleanFieldWithDefault(r,17,!1),calculatorFilter:t.Message.getFieldWithDefault(r,18,"")};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.ProfilerConfig.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.ProfilerConfig;return proto.mediapipe.ProfilerConfig.deserializeBinaryFromReader(o,r)},proto.mediapipe.ProfilerConfig.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readInt64();e.setHistogramIntervalSizeUsec(r);break;case 2:r=t.readInt64();e.setNumHistogramIntervals(r);break;case 3:r=t.readBool();e.setEnableInputOutputLatency(r);break;case 4:r=t.readBool();e.setEnableProfiler(r);break;case 5:r=t.readBool();e.setEnableStreamLatency(r);break;case 6:r=t.readBool();e.setUsePacketTimestampForAddedPacket(r);break;case 7:r=t.readInt64();e.setTraceLogCapacity(r);break;case 8:for(var o=t.isDelimited()?t.readPackedInt32():[t.readInt32()],i=0;i0&&t.writePackedInt32(8,r),(r=e.getTraceLogPath()).length>0&&t.writeString(9,r),0!==(r=e.getTraceLogCount())&&t.writeInt32(10,r),0!==(r=e.getTraceLogIntervalUsec())&&t.writeInt64(11,r),0!==(r=e.getTraceLogMarginUsec())&&t.writeInt64(12,r),(r=e.getTraceLogDurationEvents())&&t.writeBool(13,r),0!==(r=e.getTraceLogIntervalCount())&&t.writeInt32(14,r),(r=e.getTraceLogDisabled())&&t.writeBool(15,r),(r=e.getTraceEnabled())&&t.writeBool(16,r),(r=e.getTraceLogInstantEvents())&&t.writeBool(17,r),(r=e.getCalculatorFilter()).length>0&&t.writeString(18,r)},proto.mediapipe.ProfilerConfig.prototype.getHistogramIntervalSizeUsec=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.ProfilerConfig.prototype.setHistogramIntervalSizeUsec=function(e){return t.Message.setProto3IntField(this,1,e)},proto.mediapipe.ProfilerConfig.prototype.getNumHistogramIntervals=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.ProfilerConfig.prototype.setNumHistogramIntervals=function(e){return t.Message.setProto3IntField(this,2,e)},proto.mediapipe.ProfilerConfig.prototype.getEnableInputOutputLatency=function(){return t.Message.getBooleanFieldWithDefault(this,3,!1)},proto.mediapipe.ProfilerConfig.prototype.setEnableInputOutputLatency=function(e){return t.Message.setProto3BooleanField(this,3,e)},proto.mediapipe.ProfilerConfig.prototype.getEnableProfiler=function(){return t.Message.getBooleanFieldWithDefault(this,4,!1)},proto.mediapipe.ProfilerConfig.prototype.setEnableProfiler=function(e){return t.Message.setProto3BooleanField(this,4,e)},proto.mediapipe.ProfilerConfig.prototype.getEnableStreamLatency=function(){return t.Message.getBooleanFieldWithDefault(this,5,!1)},proto.mediapipe.ProfilerConfig.prototype.setEnableStreamLatency=function(e){return t.Message.setProto3BooleanField(this,5,e)},proto.mediapipe.ProfilerConfig.prototype.getUsePacketTimestampForAddedPacket=function(){return t.Message.getBooleanFieldWithDefault(this,6,!1)},proto.mediapipe.ProfilerConfig.prototype.setUsePacketTimestampForAddedPacket=function(e){return t.Message.setProto3BooleanField(this,6,e)},proto.mediapipe.ProfilerConfig.prototype.getTraceLogCapacity=function(){return t.Message.getFieldWithDefault(this,7,0)},proto.mediapipe.ProfilerConfig.prototype.setTraceLogCapacity=function(e){return t.Message.setProto3IntField(this,7,e)},proto.mediapipe.ProfilerConfig.prototype.getTraceEventTypesDisabledList=function(){return t.Message.getRepeatedField(this,8)},proto.mediapipe.ProfilerConfig.prototype.setTraceEventTypesDisabledList=function(e){return t.Message.setField(this,8,e||[])},proto.mediapipe.ProfilerConfig.prototype.addTraceEventTypesDisabled=function(e,r){return t.Message.addToRepeatedField(this,8,e,r)},proto.mediapipe.ProfilerConfig.prototype.clearTraceEventTypesDisabledList=function(){return this.setTraceEventTypesDisabledList([])},proto.mediapipe.ProfilerConfig.prototype.getTraceLogPath=function(){return t.Message.getFieldWithDefault(this,9,"")},proto.mediapipe.ProfilerConfig.prototype.setTraceLogPath=function(e){return t.Message.setProto3StringField(this,9,e)},proto.mediapipe.ProfilerConfig.prototype.getTraceLogCount=function(){return t.Message.getFieldWithDefault(this,10,0)},proto.mediapipe.ProfilerConfig.prototype.setTraceLogCount=function(e){return t.Message.setProto3IntField(this,10,e)},proto.mediapipe.ProfilerConfig.prototype.getTraceLogIntervalUsec=function(){return t.Message.getFieldWithDefault(this,11,0)},proto.mediapipe.ProfilerConfig.prototype.setTraceLogIntervalUsec=function(e){return t.Message.setProto3IntField(this,11,e)},proto.mediapipe.ProfilerConfig.prototype.getTraceLogMarginUsec=function(){return t.Message.getFieldWithDefault(this,12,0)},proto.mediapipe.ProfilerConfig.prototype.setTraceLogMarginUsec=function(e){return t.Message.setProto3IntField(this,12,e)},proto.mediapipe.ProfilerConfig.prototype.getTraceLogDurationEvents=function(){return t.Message.getBooleanFieldWithDefault(this,13,!1)},proto.mediapipe.ProfilerConfig.prototype.setTraceLogDurationEvents=function(e){return t.Message.setProto3BooleanField(this,13,e)},proto.mediapipe.ProfilerConfig.prototype.getTraceLogIntervalCount=function(){return t.Message.getFieldWithDefault(this,14,0)},proto.mediapipe.ProfilerConfig.prototype.setTraceLogIntervalCount=function(e){return t.Message.setProto3IntField(this,14,e)},proto.mediapipe.ProfilerConfig.prototype.getTraceLogDisabled=function(){return t.Message.getBooleanFieldWithDefault(this,15,!1)},proto.mediapipe.ProfilerConfig.prototype.setTraceLogDisabled=function(e){return t.Message.setProto3BooleanField(this,15,e)},proto.mediapipe.ProfilerConfig.prototype.getTraceEnabled=function(){return t.Message.getBooleanFieldWithDefault(this,16,!1)},proto.mediapipe.ProfilerConfig.prototype.setTraceEnabled=function(e){return t.Message.setProto3BooleanField(this,16,e)},proto.mediapipe.ProfilerConfig.prototype.getTraceLogInstantEvents=function(){return t.Message.getBooleanFieldWithDefault(this,17,!1)},proto.mediapipe.ProfilerConfig.prototype.setTraceLogInstantEvents=function(e){return t.Message.setProto3BooleanField(this,17,e)},proto.mediapipe.ProfilerConfig.prototype.getCalculatorFilter=function(){return t.Message.getFieldWithDefault(this,18,"")},proto.mediapipe.ProfilerConfig.prototype.setCalculatorFilter=function(e){return t.Message.setProto3StringField(this,18,e)},proto.mediapipe.CalculatorGraphConfig.repeatedFields_=[1,6,7,9,10,15,16,17,14,1002],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.CalculatorGraphConfig.prototype.toObject=function(e){return proto.mediapipe.CalculatorGraphConfig.toObject(e,this)},proto.mediapipe.CalculatorGraphConfig.toObject=function(e,r){var o,i={nodeList:t.Message.toObjectList(r.getNodeList(),proto.mediapipe.CalculatorGraphConfig.Node.toObject,e),packetFactoryList:t.Message.toObjectList(r.getPacketFactoryList(),s.PacketFactoryConfig.toObject,e),packetGeneratorList:t.Message.toObjectList(r.getPacketGeneratorList(),p.PacketGeneratorConfig.toObject,e),numThreads:t.Message.getFieldWithDefault(r,8,0),statusHandlerList:t.Message.toObjectList(r.getStatusHandlerList(),d.StatusHandlerConfig.toObject,e),inputStreamList:null==(o=t.Message.getRepeatedField(r,10))?void 0:o,outputStreamList:null==(o=t.Message.getRepeatedField(r,15))?void 0:o,inputSidePacketList:null==(o=t.Message.getRepeatedField(r,16))?void 0:o,outputSidePacketList:null==(o=t.Message.getRepeatedField(r,17))?void 0:o,maxQueueSize:t.Message.getFieldWithDefault(r,11,0),reportDeadlock:t.Message.getBooleanFieldWithDefault(r,21,!1),inputStreamHandler:(o=r.getInputStreamHandler())&&l.InputStreamHandlerConfig.toObject(e,o),outputStreamHandler:(o=r.getOutputStreamHandler())&&l.OutputStreamHandlerConfig.toObject(e,o),executorList:t.Message.toObjectList(r.getExecutorList(),proto.mediapipe.ExecutorConfig.toObject,e),profilerConfig:(o=r.getProfilerConfig())&&proto.mediapipe.ProfilerConfig.toObject(e,o),pb_package:t.Message.getFieldWithDefault(r,19,""),type:t.Message.getFieldWithDefault(r,20,""),options:(o=r.getOptions())&&n.MediaPipeOptions.toObject(e,o),graphOptionsList:t.Message.toObjectList(r.getGraphOptionsList(),a.Any.toObject,e)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.CalculatorGraphConfig.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.CalculatorGraphConfig;return proto.mediapipe.CalculatorGraphConfig.deserializeBinaryFromReader(o,r)},proto.mediapipe.CalculatorGraphConfig.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new proto.mediapipe.CalculatorGraphConfig.Node;t.readMessage(r,proto.mediapipe.CalculatorGraphConfig.Node.deserializeBinaryFromReader),e.addNode(r);break;case 6:r=new s.PacketFactoryConfig;t.readMessage(r,s.PacketFactoryConfig.deserializeBinaryFromReader),e.addPacketFactory(r);break;case 7:r=new p.PacketGeneratorConfig;t.readMessage(r,p.PacketGeneratorConfig.deserializeBinaryFromReader),e.addPacketGenerator(r);break;case 8:r=t.readInt32();e.setNumThreads(r);break;case 9:r=new d.StatusHandlerConfig;t.readMessage(r,d.StatusHandlerConfig.deserializeBinaryFromReader),e.addStatusHandler(r);break;case 10:r=t.readString();e.addInputStream(r);break;case 15:r=t.readString();e.addOutputStream(r);break;case 16:r=t.readString();e.addInputSidePacket(r);break;case 17:r=t.readString();e.addOutputSidePacket(r);break;case 11:r=t.readInt32();e.setMaxQueueSize(r);break;case 21:r=t.readBool();e.setReportDeadlock(r);break;case 12:r=new l.InputStreamHandlerConfig;t.readMessage(r,l.InputStreamHandlerConfig.deserializeBinaryFromReader),e.setInputStreamHandler(r);break;case 13:r=new l.OutputStreamHandlerConfig;t.readMessage(r,l.OutputStreamHandlerConfig.deserializeBinaryFromReader),e.setOutputStreamHandler(r);break;case 14:r=new proto.mediapipe.ExecutorConfig;t.readMessage(r,proto.mediapipe.ExecutorConfig.deserializeBinaryFromReader),e.addExecutor(r);break;case 18:r=new proto.mediapipe.ProfilerConfig;t.readMessage(r,proto.mediapipe.ProfilerConfig.deserializeBinaryFromReader),e.setProfilerConfig(r);break;case 19:r=t.readString();e.setPackage(r);break;case 20:r=t.readString();e.setType(r);break;case 1001:r=new n.MediaPipeOptions;t.readMessage(r,n.MediaPipeOptions.deserializeBinaryFromReader),e.setOptions(r);break;case 1002:r=new a.Any;t.readMessage(r,a.Any.deserializeBinaryFromReader),e.addGraphOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.CalculatorGraphConfig.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.CalculatorGraphConfig.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.CalculatorGraphConfig.serializeBinaryToWriter=function(e,t){var r=void 0;(r=e.getNodeList()).length>0&&t.writeRepeatedMessage(1,r,proto.mediapipe.CalculatorGraphConfig.Node.serializeBinaryToWriter),(r=e.getPacketFactoryList()).length>0&&t.writeRepeatedMessage(6,r,s.PacketFactoryConfig.serializeBinaryToWriter),(r=e.getPacketGeneratorList()).length>0&&t.writeRepeatedMessage(7,r,p.PacketGeneratorConfig.serializeBinaryToWriter),0!==(r=e.getNumThreads())&&t.writeInt32(8,r),(r=e.getStatusHandlerList()).length>0&&t.writeRepeatedMessage(9,r,d.StatusHandlerConfig.serializeBinaryToWriter),(r=e.getInputStreamList()).length>0&&t.writeRepeatedString(10,r),(r=e.getOutputStreamList()).length>0&&t.writeRepeatedString(15,r),(r=e.getInputSidePacketList()).length>0&&t.writeRepeatedString(16,r),(r=e.getOutputSidePacketList()).length>0&&t.writeRepeatedString(17,r),0!==(r=e.getMaxQueueSize())&&t.writeInt32(11,r),(r=e.getReportDeadlock())&&t.writeBool(21,r),null!=(r=e.getInputStreamHandler())&&t.writeMessage(12,r,l.InputStreamHandlerConfig.serializeBinaryToWriter),null!=(r=e.getOutputStreamHandler())&&t.writeMessage(13,r,l.OutputStreamHandlerConfig.serializeBinaryToWriter),(r=e.getExecutorList()).length>0&&t.writeRepeatedMessage(14,r,proto.mediapipe.ExecutorConfig.serializeBinaryToWriter),null!=(r=e.getProfilerConfig())&&t.writeMessage(18,r,proto.mediapipe.ProfilerConfig.serializeBinaryToWriter),(r=e.getPackage()).length>0&&t.writeString(19,r),(r=e.getType()).length>0&&t.writeString(20,r),null!=(r=e.getOptions())&&t.writeMessage(1001,r,n.MediaPipeOptions.serializeBinaryToWriter),(r=e.getGraphOptionsList()).length>0&&t.writeRepeatedMessage(1002,r,a.Any.serializeBinaryToWriter)},proto.mediapipe.CalculatorGraphConfig.Node.repeatedFields_=[3,4,5,6,8,13,17,1005],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.CalculatorGraphConfig.Node.prototype.toObject=function(e){return proto.mediapipe.CalculatorGraphConfig.Node.toObject(e,this)},proto.mediapipe.CalculatorGraphConfig.Node.toObject=function(e,r){var o,n={name:t.Message.getFieldWithDefault(r,1,""),calculator:t.Message.getFieldWithDefault(r,2,""),inputStreamList:null==(o=t.Message.getRepeatedField(r,3))?void 0:o,outputStreamList:null==(o=t.Message.getRepeatedField(r,4))?void 0:o,inputSidePacketList:null==(o=t.Message.getRepeatedField(r,5))?void 0:o,outputSidePacketList:null==(o=t.Message.getRepeatedField(r,6))?void 0:o,options:(o=r.getOptions())&&i.CalculatorOptions.toObject(e,o),nodeOptionsList:t.Message.toObjectList(r.getNodeOptionsList(),a.Any.toObject,e),sourceLayer:t.Message.getFieldWithDefault(r,9,0),bufferSizeHint:t.Message.getFieldWithDefault(r,10,0),inputStreamHandler:(o=r.getInputStreamHandler())&&l.InputStreamHandlerConfig.toObject(e,o),outputStreamHandler:(o=r.getOutputStreamHandler())&&l.OutputStreamHandlerConfig.toObject(e,o),inputStreamInfoList:t.Message.toObjectList(r.getInputStreamInfoList(),proto.mediapipe.InputStreamInfo.toObject,e),executor:t.Message.getFieldWithDefault(r,14,""),profilerConfig:(o=r.getProfilerConfig())&&proto.mediapipe.ProfilerConfig.toObject(e,o),maxInFlight:t.Message.getFieldWithDefault(r,16,0),optionValueList:null==(o=t.Message.getRepeatedField(r,17))?void 0:o,externalInputList:null==(o=t.Message.getRepeatedField(r,1005))?void 0:o};return e&&(n.$jspbMessageInstance=r),n}),proto.mediapipe.CalculatorGraphConfig.Node.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.CalculatorGraphConfig.Node;return proto.mediapipe.CalculatorGraphConfig.Node.deserializeBinaryFromReader(o,r)},proto.mediapipe.CalculatorGraphConfig.Node.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setName(r);break;case 2:r=t.readString();e.setCalculator(r);break;case 3:r=t.readString();e.addInputStream(r);break;case 4:r=t.readString();e.addOutputStream(r);break;case 5:r=t.readString();e.addInputSidePacket(r);break;case 6:r=t.readString();e.addOutputSidePacket(r);break;case 7:r=new i.CalculatorOptions;t.readMessage(r,i.CalculatorOptions.deserializeBinaryFromReader),e.setOptions(r);break;case 8:r=new a.Any;t.readMessage(r,a.Any.deserializeBinaryFromReader),e.addNodeOptions(r);break;case 9:r=t.readInt32();e.setSourceLayer(r);break;case 10:r=t.readInt32();e.setBufferSizeHint(r);break;case 11:r=new l.InputStreamHandlerConfig;t.readMessage(r,l.InputStreamHandlerConfig.deserializeBinaryFromReader),e.setInputStreamHandler(r);break;case 12:r=new l.OutputStreamHandlerConfig;t.readMessage(r,l.OutputStreamHandlerConfig.deserializeBinaryFromReader),e.setOutputStreamHandler(r);break;case 13:r=new proto.mediapipe.InputStreamInfo;t.readMessage(r,proto.mediapipe.InputStreamInfo.deserializeBinaryFromReader),e.addInputStreamInfo(r);break;case 14:r=t.readString();e.setExecutor(r);break;case 15:r=new proto.mediapipe.ProfilerConfig;t.readMessage(r,proto.mediapipe.ProfilerConfig.deserializeBinaryFromReader),e.setProfilerConfig(r);break;case 16:r=t.readInt32();e.setMaxInFlight(r);break;case 17:r=t.readString();e.addOptionValue(r);break;case 1005:r=t.readString();e.addExternalInput(r);break;default:t.skipField()}}return e},proto.mediapipe.CalculatorGraphConfig.Node.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.CalculatorGraphConfig.Node.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.CalculatorGraphConfig.Node.serializeBinaryToWriter=function(e,t){var r=void 0;(r=e.getName()).length>0&&t.writeString(1,r),(r=e.getCalculator()).length>0&&t.writeString(2,r),(r=e.getInputStreamList()).length>0&&t.writeRepeatedString(3,r),(r=e.getOutputStreamList()).length>0&&t.writeRepeatedString(4,r),(r=e.getInputSidePacketList()).length>0&&t.writeRepeatedString(5,r),(r=e.getOutputSidePacketList()).length>0&&t.writeRepeatedString(6,r),null!=(r=e.getOptions())&&t.writeMessage(7,r,i.CalculatorOptions.serializeBinaryToWriter),(r=e.getNodeOptionsList()).length>0&&t.writeRepeatedMessage(8,r,a.Any.serializeBinaryToWriter),0!==(r=e.getSourceLayer())&&t.writeInt32(9,r),0!==(r=e.getBufferSizeHint())&&t.writeInt32(10,r),null!=(r=e.getInputStreamHandler())&&t.writeMessage(11,r,l.InputStreamHandlerConfig.serializeBinaryToWriter),null!=(r=e.getOutputStreamHandler())&&t.writeMessage(12,r,l.OutputStreamHandlerConfig.serializeBinaryToWriter),(r=e.getInputStreamInfoList()).length>0&&t.writeRepeatedMessage(13,r,proto.mediapipe.InputStreamInfo.serializeBinaryToWriter),(r=e.getExecutor()).length>0&&t.writeString(14,r),null!=(r=e.getProfilerConfig())&&t.writeMessage(15,r,proto.mediapipe.ProfilerConfig.serializeBinaryToWriter),0!==(r=e.getMaxInFlight())&&t.writeInt32(16,r),(r=e.getOptionValueList()).length>0&&t.writeRepeatedString(17,r),(r=e.getExternalInputList()).length>0&&t.writeRepeatedString(1005,r)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getName=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setName=function(e){return t.Message.setProto3StringField(this,1,e)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getCalculator=function(){return t.Message.getFieldWithDefault(this,2,"")},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setCalculator=function(e){return t.Message.setProto3StringField(this,2,e)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getInputStreamList=function(){return t.Message.getRepeatedField(this,3)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setInputStreamList=function(e){return t.Message.setField(this,3,e||[])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.addInputStream=function(e,r){return t.Message.addToRepeatedField(this,3,e,r)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.clearInputStreamList=function(){return this.setInputStreamList([])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getOutputStreamList=function(){return t.Message.getRepeatedField(this,4)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setOutputStreamList=function(e){return t.Message.setField(this,4,e||[])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.addOutputStream=function(e,r){return t.Message.addToRepeatedField(this,4,e,r)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.clearOutputStreamList=function(){return this.setOutputStreamList([])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getInputSidePacketList=function(){return t.Message.getRepeatedField(this,5)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setInputSidePacketList=function(e){return t.Message.setField(this,5,e||[])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.addInputSidePacket=function(e,r){return t.Message.addToRepeatedField(this,5,e,r)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.clearInputSidePacketList=function(){return this.setInputSidePacketList([])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getOutputSidePacketList=function(){return t.Message.getRepeatedField(this,6)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setOutputSidePacketList=function(e){return t.Message.setField(this,6,e||[])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.addOutputSidePacket=function(e,r){return t.Message.addToRepeatedField(this,6,e,r)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.clearOutputSidePacketList=function(){return this.setOutputSidePacketList([])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getOptions=function(){return t.Message.getWrapperField(this,i.CalculatorOptions,7)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setOptions=function(e){return t.Message.setWrapperField(this,7,e)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.clearOptions=function(){return this.setOptions(void 0)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.hasOptions=function(){return null!=t.Message.getField(this,7)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getNodeOptionsList=function(){return t.Message.getRepeatedWrapperField(this,a.Any,8)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setNodeOptionsList=function(e){return t.Message.setRepeatedWrapperField(this,8,e)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.addNodeOptions=function(e,r){return t.Message.addToRepeatedWrapperField(this,8,e,proto.google.protobuf.Any,r)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.clearNodeOptionsList=function(){return this.setNodeOptionsList([])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getSourceLayer=function(){return t.Message.getFieldWithDefault(this,9,0)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setSourceLayer=function(e){return t.Message.setProto3IntField(this,9,e)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getBufferSizeHint=function(){return t.Message.getFieldWithDefault(this,10,0)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setBufferSizeHint=function(e){return t.Message.setProto3IntField(this,10,e)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getInputStreamHandler=function(){return t.Message.getWrapperField(this,l.InputStreamHandlerConfig,11)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setInputStreamHandler=function(e){return t.Message.setWrapperField(this,11,e)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.clearInputStreamHandler=function(){return this.setInputStreamHandler(void 0)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.hasInputStreamHandler=function(){return null!=t.Message.getField(this,11)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getOutputStreamHandler=function(){return t.Message.getWrapperField(this,l.OutputStreamHandlerConfig,12)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setOutputStreamHandler=function(e){return t.Message.setWrapperField(this,12,e)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.clearOutputStreamHandler=function(){return this.setOutputStreamHandler(void 0)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.hasOutputStreamHandler=function(){return null!=t.Message.getField(this,12)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getInputStreamInfoList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.InputStreamInfo,13)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setInputStreamInfoList=function(e){return t.Message.setRepeatedWrapperField(this,13,e)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.addInputStreamInfo=function(e,r){return t.Message.addToRepeatedWrapperField(this,13,e,proto.mediapipe.InputStreamInfo,r)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.clearInputStreamInfoList=function(){return this.setInputStreamInfoList([])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getExecutor=function(){return t.Message.getFieldWithDefault(this,14,"")},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setExecutor=function(e){return t.Message.setProto3StringField(this,14,e)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getProfilerConfig=function(){return t.Message.getWrapperField(this,proto.mediapipe.ProfilerConfig,15)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setProfilerConfig=function(e){return t.Message.setWrapperField(this,15,e)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.clearProfilerConfig=function(){return this.setProfilerConfig(void 0)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.hasProfilerConfig=function(){return null!=t.Message.getField(this,15)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getMaxInFlight=function(){return t.Message.getFieldWithDefault(this,16,0)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setMaxInFlight=function(e){return t.Message.setProto3IntField(this,16,e)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getOptionValueList=function(){return t.Message.getRepeatedField(this,17)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setOptionValueList=function(e){return t.Message.setField(this,17,e||[])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.addOptionValue=function(e,r){return t.Message.addToRepeatedField(this,17,e,r)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.clearOptionValueList=function(){return this.setOptionValueList([])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getExternalInputList=function(){return t.Message.getRepeatedField(this,1005)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setExternalInputList=function(e){return t.Message.setField(this,1005,e||[])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.addExternalInput=function(e,r){return t.Message.addToRepeatedField(this,1005,e,r)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.clearExternalInputList=function(){return this.setExternalInputList([])},proto.mediapipe.CalculatorGraphConfig.prototype.getNodeList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.CalculatorGraphConfig.Node,1)},proto.mediapipe.CalculatorGraphConfig.prototype.setNodeList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.CalculatorGraphConfig.prototype.addNode=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.CalculatorGraphConfig.Node,r)},proto.mediapipe.CalculatorGraphConfig.prototype.clearNodeList=function(){return this.setNodeList([])},proto.mediapipe.CalculatorGraphConfig.prototype.getPacketFactoryList=function(){return t.Message.getRepeatedWrapperField(this,s.PacketFactoryConfig,6)},proto.mediapipe.CalculatorGraphConfig.prototype.setPacketFactoryList=function(e){return t.Message.setRepeatedWrapperField(this,6,e)},proto.mediapipe.CalculatorGraphConfig.prototype.addPacketFactory=function(e,r){return t.Message.addToRepeatedWrapperField(this,6,e,proto.mediapipe.PacketFactoryConfig,r)},proto.mediapipe.CalculatorGraphConfig.prototype.clearPacketFactoryList=function(){return this.setPacketFactoryList([])},proto.mediapipe.CalculatorGraphConfig.prototype.getPacketGeneratorList=function(){return t.Message.getRepeatedWrapperField(this,p.PacketGeneratorConfig,7)},proto.mediapipe.CalculatorGraphConfig.prototype.setPacketGeneratorList=function(e){return t.Message.setRepeatedWrapperField(this,7,e)},proto.mediapipe.CalculatorGraphConfig.prototype.addPacketGenerator=function(e,r){return t.Message.addToRepeatedWrapperField(this,7,e,proto.mediapipe.PacketGeneratorConfig,r)},proto.mediapipe.CalculatorGraphConfig.prototype.clearPacketGeneratorList=function(){return this.setPacketGeneratorList([])},proto.mediapipe.CalculatorGraphConfig.prototype.getNumThreads=function(){return t.Message.getFieldWithDefault(this,8,0)},proto.mediapipe.CalculatorGraphConfig.prototype.setNumThreads=function(e){return t.Message.setProto3IntField(this,8,e)},proto.mediapipe.CalculatorGraphConfig.prototype.getStatusHandlerList=function(){return t.Message.getRepeatedWrapperField(this,d.StatusHandlerConfig,9)},proto.mediapipe.CalculatorGraphConfig.prototype.setStatusHandlerList=function(e){return t.Message.setRepeatedWrapperField(this,9,e)},proto.mediapipe.CalculatorGraphConfig.prototype.addStatusHandler=function(e,r){return t.Message.addToRepeatedWrapperField(this,9,e,proto.mediapipe.StatusHandlerConfig,r)},proto.mediapipe.CalculatorGraphConfig.prototype.clearStatusHandlerList=function(){return this.setStatusHandlerList([])},proto.mediapipe.CalculatorGraphConfig.prototype.getInputStreamList=function(){return t.Message.getRepeatedField(this,10)},proto.mediapipe.CalculatorGraphConfig.prototype.setInputStreamList=function(e){return t.Message.setField(this,10,e||[])},proto.mediapipe.CalculatorGraphConfig.prototype.addInputStream=function(e,r){return t.Message.addToRepeatedField(this,10,e,r)},proto.mediapipe.CalculatorGraphConfig.prototype.clearInputStreamList=function(){return this.setInputStreamList([])},proto.mediapipe.CalculatorGraphConfig.prototype.getOutputStreamList=function(){return t.Message.getRepeatedField(this,15)},proto.mediapipe.CalculatorGraphConfig.prototype.setOutputStreamList=function(e){return t.Message.setField(this,15,e||[])},proto.mediapipe.CalculatorGraphConfig.prototype.addOutputStream=function(e,r){return t.Message.addToRepeatedField(this,15,e,r)},proto.mediapipe.CalculatorGraphConfig.prototype.clearOutputStreamList=function(){return this.setOutputStreamList([])},proto.mediapipe.CalculatorGraphConfig.prototype.getInputSidePacketList=function(){return t.Message.getRepeatedField(this,16)},proto.mediapipe.CalculatorGraphConfig.prototype.setInputSidePacketList=function(e){return t.Message.setField(this,16,e||[])},proto.mediapipe.CalculatorGraphConfig.prototype.addInputSidePacket=function(e,r){return t.Message.addToRepeatedField(this,16,e,r)},proto.mediapipe.CalculatorGraphConfig.prototype.clearInputSidePacketList=function(){return this.setInputSidePacketList([])},proto.mediapipe.CalculatorGraphConfig.prototype.getOutputSidePacketList=function(){return t.Message.getRepeatedField(this,17)},proto.mediapipe.CalculatorGraphConfig.prototype.setOutputSidePacketList=function(e){return t.Message.setField(this,17,e||[])},proto.mediapipe.CalculatorGraphConfig.prototype.addOutputSidePacket=function(e,r){return t.Message.addToRepeatedField(this,17,e,r)},proto.mediapipe.CalculatorGraphConfig.prototype.clearOutputSidePacketList=function(){return this.setOutputSidePacketList([])},proto.mediapipe.CalculatorGraphConfig.prototype.getMaxQueueSize=function(){return t.Message.getFieldWithDefault(this,11,0)},proto.mediapipe.CalculatorGraphConfig.prototype.setMaxQueueSize=function(e){return t.Message.setProto3IntField(this,11,e)},proto.mediapipe.CalculatorGraphConfig.prototype.getReportDeadlock=function(){return t.Message.getBooleanFieldWithDefault(this,21,!1)},proto.mediapipe.CalculatorGraphConfig.prototype.setReportDeadlock=function(e){return t.Message.setProto3BooleanField(this,21,e)},proto.mediapipe.CalculatorGraphConfig.prototype.getInputStreamHandler=function(){return t.Message.getWrapperField(this,l.InputStreamHandlerConfig,12)},proto.mediapipe.CalculatorGraphConfig.prototype.setInputStreamHandler=function(e){return t.Message.setWrapperField(this,12,e)},proto.mediapipe.CalculatorGraphConfig.prototype.clearInputStreamHandler=function(){return this.setInputStreamHandler(void 0)},proto.mediapipe.CalculatorGraphConfig.prototype.hasInputStreamHandler=function(){return null!=t.Message.getField(this,12)},proto.mediapipe.CalculatorGraphConfig.prototype.getOutputStreamHandler=function(){return t.Message.getWrapperField(this,l.OutputStreamHandlerConfig,13)},proto.mediapipe.CalculatorGraphConfig.prototype.setOutputStreamHandler=function(e){return t.Message.setWrapperField(this,13,e)},proto.mediapipe.CalculatorGraphConfig.prototype.clearOutputStreamHandler=function(){return this.setOutputStreamHandler(void 0)},proto.mediapipe.CalculatorGraphConfig.prototype.hasOutputStreamHandler=function(){return null!=t.Message.getField(this,13)},proto.mediapipe.CalculatorGraphConfig.prototype.getExecutorList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.ExecutorConfig,14)},proto.mediapipe.CalculatorGraphConfig.prototype.setExecutorList=function(e){return t.Message.setRepeatedWrapperField(this,14,e)},proto.mediapipe.CalculatorGraphConfig.prototype.addExecutor=function(e,r){return t.Message.addToRepeatedWrapperField(this,14,e,proto.mediapipe.ExecutorConfig,r)},proto.mediapipe.CalculatorGraphConfig.prototype.clearExecutorList=function(){return this.setExecutorList([])},proto.mediapipe.CalculatorGraphConfig.prototype.getProfilerConfig=function(){return t.Message.getWrapperField(this,proto.mediapipe.ProfilerConfig,18)},proto.mediapipe.CalculatorGraphConfig.prototype.setProfilerConfig=function(e){return t.Message.setWrapperField(this,18,e)},proto.mediapipe.CalculatorGraphConfig.prototype.clearProfilerConfig=function(){return this.setProfilerConfig(void 0)},proto.mediapipe.CalculatorGraphConfig.prototype.hasProfilerConfig=function(){return null!=t.Message.getField(this,18)},proto.mediapipe.CalculatorGraphConfig.prototype.getPackage=function(){return t.Message.getFieldWithDefault(this,19,"")},proto.mediapipe.CalculatorGraphConfig.prototype.setPackage=function(e){return t.Message.setProto3StringField(this,19,e)},proto.mediapipe.CalculatorGraphConfig.prototype.getType=function(){return t.Message.getFieldWithDefault(this,20,"")},proto.mediapipe.CalculatorGraphConfig.prototype.setType=function(e){return t.Message.setProto3StringField(this,20,e)},proto.mediapipe.CalculatorGraphConfig.prototype.getOptions=function(){return t.Message.getWrapperField(this,n.MediaPipeOptions,1001)},proto.mediapipe.CalculatorGraphConfig.prototype.setOptions=function(e){return t.Message.setWrapperField(this,1001,e)},proto.mediapipe.CalculatorGraphConfig.prototype.clearOptions=function(){return this.setOptions(void 0)},proto.mediapipe.CalculatorGraphConfig.prototype.hasOptions=function(){return null!=t.Message.getField(this,1001)},proto.mediapipe.CalculatorGraphConfig.prototype.getGraphOptionsList=function(){return t.Message.getRepeatedWrapperField(this,a.Any,1002)},proto.mediapipe.CalculatorGraphConfig.prototype.setGraphOptionsList=function(e){return t.Message.setRepeatedWrapperField(this,1002,e)},proto.mediapipe.CalculatorGraphConfig.prototype.addGraphOptions=function(e,r){return t.Message.addToRepeatedWrapperField(this,1002,e,proto.google.protobuf.Any,r)},proto.mediapipe.CalculatorGraphConfig.prototype.clearGraphOptionsList=function(){return this.setGraphOptionsList([])},r.object.extend(e,proto.mediapipe)}(calculator_pb);var detection_pb={},location_data_pb={},rasterization_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.Rasterization",null,o),r.exportSymbol("proto.mediapipe.Rasterization.Interval",null,o),proto.mediapipe.Rasterization=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.Rasterization.repeatedFields_,null)},r.inherits(proto.mediapipe.Rasterization,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.Rasterization.displayName="proto.mediapipe.Rasterization"),proto.mediapipe.Rasterization.Interval=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.Rasterization.Interval,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.Rasterization.Interval.displayName="proto.mediapipe.Rasterization.Interval"),proto.mediapipe.Rasterization.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.Rasterization.prototype.toObject=function(e){return proto.mediapipe.Rasterization.toObject(e,this)},proto.mediapipe.Rasterization.toObject=function(e,r){var o={intervalList:t.Message.toObjectList(r.getIntervalList(),proto.mediapipe.Rasterization.Interval.toObject,e)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.Rasterization.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.Rasterization;return proto.mediapipe.Rasterization.deserializeBinaryFromReader(o,r)},proto.mediapipe.Rasterization.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new proto.mediapipe.Rasterization.Interval;t.readMessage(r,proto.mediapipe.Rasterization.Interval.deserializeBinaryFromReader),e.addInterval(r)}else t.skipField()}return e},proto.mediapipe.Rasterization.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.Rasterization.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.Rasterization.serializeBinaryToWriter=function(e,t){var r;(r=e.getIntervalList()).length>0&&t.writeRepeatedMessage(1,r,proto.mediapipe.Rasterization.Interval.serializeBinaryToWriter)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.Rasterization.Interval.prototype.toObject=function(e){return proto.mediapipe.Rasterization.Interval.toObject(e,this)},proto.mediapipe.Rasterization.Interval.toObject=function(e,r){var o,i={y:null==(o=t.Message.getField(r,1))?void 0:o,leftX:null==(o=t.Message.getField(r,2))?void 0:o,rightX:null==(o=t.Message.getField(r,3))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.Rasterization.Interval.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.Rasterization.Interval;return proto.mediapipe.Rasterization.Interval.deserializeBinaryFromReader(o,r)},proto.mediapipe.Rasterization.Interval.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readInt32();e.setY(r);break;case 2:r=t.readInt32();e.setLeftX(r);break;case 3:r=t.readInt32();e.setRightX(r);break;default:t.skipField()}}return e},proto.mediapipe.Rasterization.Interval.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.Rasterization.Interval.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.Rasterization.Interval.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeInt32(1,o),null!=(o=t.Message.getField(e,2))&&r.writeInt32(2,o),null!=(o=t.Message.getField(e,3))&&r.writeInt32(3,o)},proto.mediapipe.Rasterization.Interval.prototype.getY=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.Rasterization.Interval.prototype.setY=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.Rasterization.Interval.prototype.clearY=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.Rasterization.Interval.prototype.hasY=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.Rasterization.Interval.prototype.getLeftX=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.Rasterization.Interval.prototype.setLeftX=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.Rasterization.Interval.prototype.clearLeftX=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.Rasterization.Interval.prototype.hasLeftX=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.Rasterization.Interval.prototype.getRightX=function(){return t.Message.getFieldWithDefault(this,3,0)},proto.mediapipe.Rasterization.Interval.prototype.setRightX=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.Rasterization.Interval.prototype.clearRightX=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.Rasterization.Interval.prototype.hasRightX=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.Rasterization.prototype.getIntervalList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.Rasterization.Interval,1)},proto.mediapipe.Rasterization.prototype.setIntervalList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.Rasterization.prototype.addInterval=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.Rasterization.Interval,r)},proto.mediapipe.Rasterization.prototype.clearIntervalList=function(){return this.setIntervalList([])},r.object.extend(e,proto.mediapipe)}(rasterization_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=rasterization_pb;r.object.extend(proto,i),r.exportSymbol("proto.mediapipe.LocationData",null,o),r.exportSymbol("proto.mediapipe.LocationData.BinaryMask",null,o),r.exportSymbol("proto.mediapipe.LocationData.BoundingBox",null,o),r.exportSymbol("proto.mediapipe.LocationData.Format",null,o),r.exportSymbol("proto.mediapipe.LocationData.RelativeBoundingBox",null,o),r.exportSymbol("proto.mediapipe.LocationData.RelativeKeypoint",null,o),proto.mediapipe.LocationData=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.LocationData.repeatedFields_,null)},r.inherits(proto.mediapipe.LocationData,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.LocationData.displayName="proto.mediapipe.LocationData"),proto.mediapipe.LocationData.BoundingBox=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.LocationData.BoundingBox,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.LocationData.BoundingBox.displayName="proto.mediapipe.LocationData.BoundingBox"),proto.mediapipe.LocationData.RelativeBoundingBox=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.LocationData.RelativeBoundingBox,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.LocationData.RelativeBoundingBox.displayName="proto.mediapipe.LocationData.RelativeBoundingBox"),proto.mediapipe.LocationData.BinaryMask=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.LocationData.BinaryMask,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.LocationData.BinaryMask.displayName="proto.mediapipe.LocationData.BinaryMask"),proto.mediapipe.LocationData.RelativeKeypoint=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.LocationData.RelativeKeypoint,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.LocationData.RelativeKeypoint.displayName="proto.mediapipe.LocationData.RelativeKeypoint"),proto.mediapipe.LocationData.repeatedFields_=[5],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.LocationData.prototype.toObject=function(e){return proto.mediapipe.LocationData.toObject(e,this)},proto.mediapipe.LocationData.toObject=function(e,r){var o,i={format:null==(o=t.Message.getField(r,1))?void 0:o,boundingBox:(o=r.getBoundingBox())&&proto.mediapipe.LocationData.BoundingBox.toObject(e,o),relativeBoundingBox:(o=r.getRelativeBoundingBox())&&proto.mediapipe.LocationData.RelativeBoundingBox.toObject(e,o),mask:(o=r.getMask())&&proto.mediapipe.LocationData.BinaryMask.toObject(e,o),relativeKeypointsList:t.Message.toObjectList(r.getRelativeKeypointsList(),proto.mediapipe.LocationData.RelativeKeypoint.toObject,e)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.LocationData.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.LocationData;return proto.mediapipe.LocationData.deserializeBinaryFromReader(o,r)},proto.mediapipe.LocationData.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readEnum();e.setFormat(r);break;case 2:r=new proto.mediapipe.LocationData.BoundingBox;t.readMessage(r,proto.mediapipe.LocationData.BoundingBox.deserializeBinaryFromReader),e.setBoundingBox(r);break;case 3:r=new proto.mediapipe.LocationData.RelativeBoundingBox;t.readMessage(r,proto.mediapipe.LocationData.RelativeBoundingBox.deserializeBinaryFromReader),e.setRelativeBoundingBox(r);break;case 4:r=new proto.mediapipe.LocationData.BinaryMask;t.readMessage(r,proto.mediapipe.LocationData.BinaryMask.deserializeBinaryFromReader),e.setMask(r);break;case 5:r=new proto.mediapipe.LocationData.RelativeKeypoint;t.readMessage(r,proto.mediapipe.LocationData.RelativeKeypoint.deserializeBinaryFromReader),e.addRelativeKeypoints(r);break;default:t.skipField()}}return e},proto.mediapipe.LocationData.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.LocationData.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.LocationData.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeEnum(1,o),null!=(o=e.getBoundingBox())&&r.writeMessage(2,o,proto.mediapipe.LocationData.BoundingBox.serializeBinaryToWriter),null!=(o=e.getRelativeBoundingBox())&&r.writeMessage(3,o,proto.mediapipe.LocationData.RelativeBoundingBox.serializeBinaryToWriter),null!=(o=e.getMask())&&r.writeMessage(4,o,proto.mediapipe.LocationData.BinaryMask.serializeBinaryToWriter),(o=e.getRelativeKeypointsList()).length>0&&r.writeRepeatedMessage(5,o,proto.mediapipe.LocationData.RelativeKeypoint.serializeBinaryToWriter)},proto.mediapipe.LocationData.Format={GLOBAL:0,BOUNDING_BOX:1,RELATIVE_BOUNDING_BOX:2,MASK:3},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.LocationData.BoundingBox.prototype.toObject=function(e){return proto.mediapipe.LocationData.BoundingBox.toObject(e,this)},proto.mediapipe.LocationData.BoundingBox.toObject=function(e,r){var o,i={xmin:null==(o=t.Message.getField(r,1))?void 0:o,ymin:null==(o=t.Message.getField(r,2))?void 0:o,width:null==(o=t.Message.getField(r,3))?void 0:o,height:null==(o=t.Message.getField(r,4))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.LocationData.BoundingBox.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.LocationData.BoundingBox;return proto.mediapipe.LocationData.BoundingBox.deserializeBinaryFromReader(o,r)},proto.mediapipe.LocationData.BoundingBox.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readInt32();e.setXmin(r);break;case 2:r=t.readInt32();e.setYmin(r);break;case 3:r=t.readInt32();e.setWidth(r);break;case 4:r=t.readInt32();e.setHeight(r);break;default:t.skipField()}}return e},proto.mediapipe.LocationData.BoundingBox.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.LocationData.BoundingBox.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.LocationData.BoundingBox.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeInt32(1,o),null!=(o=t.Message.getField(e,2))&&r.writeInt32(2,o),null!=(o=t.Message.getField(e,3))&&r.writeInt32(3,o),null!=(o=t.Message.getField(e,4))&&r.writeInt32(4,o)},proto.mediapipe.LocationData.BoundingBox.prototype.getXmin=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.LocationData.BoundingBox.prototype.setXmin=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.LocationData.BoundingBox.prototype.clearXmin=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.LocationData.BoundingBox.prototype.hasXmin=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.LocationData.BoundingBox.prototype.getYmin=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.LocationData.BoundingBox.prototype.setYmin=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.LocationData.BoundingBox.prototype.clearYmin=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.LocationData.BoundingBox.prototype.hasYmin=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.LocationData.BoundingBox.prototype.getWidth=function(){return t.Message.getFieldWithDefault(this,3,0)},proto.mediapipe.LocationData.BoundingBox.prototype.setWidth=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.LocationData.BoundingBox.prototype.clearWidth=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.LocationData.BoundingBox.prototype.hasWidth=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.LocationData.BoundingBox.prototype.getHeight=function(){return t.Message.getFieldWithDefault(this,4,0)},proto.mediapipe.LocationData.BoundingBox.prototype.setHeight=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.LocationData.BoundingBox.prototype.clearHeight=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.LocationData.BoundingBox.prototype.hasHeight=function(){return null!=t.Message.getField(this,4)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.LocationData.RelativeBoundingBox.prototype.toObject=function(e){return proto.mediapipe.LocationData.RelativeBoundingBox.toObject(e,this)},proto.mediapipe.LocationData.RelativeBoundingBox.toObject=function(e,r){var o,i={xmin:null==(o=t.Message.getOptionalFloatingPointField(r,1))?void 0:o,ymin:null==(o=t.Message.getOptionalFloatingPointField(r,2))?void 0:o,width:null==(o=t.Message.getOptionalFloatingPointField(r,3))?void 0:o,height:null==(o=t.Message.getOptionalFloatingPointField(r,4))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.LocationData.RelativeBoundingBox.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.LocationData.RelativeBoundingBox;return proto.mediapipe.LocationData.RelativeBoundingBox.deserializeBinaryFromReader(o,r)},proto.mediapipe.LocationData.RelativeBoundingBox.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readFloat();e.setXmin(r);break;case 2:r=t.readFloat();e.setYmin(r);break;case 3:r=t.readFloat();e.setWidth(r);break;case 4:r=t.readFloat();e.setHeight(r);break;default:t.skipField()}}return e},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.LocationData.RelativeBoundingBox.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.LocationData.RelativeBoundingBox.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeFloat(1,o),null!=(o=t.Message.getField(e,2))&&r.writeFloat(2,o),null!=(o=t.Message.getField(e,3))&&r.writeFloat(3,o),null!=(o=t.Message.getField(e,4))&&r.writeFloat(4,o)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.getXmin=function(){return t.Message.getFloatingPointFieldWithDefault(this,1,0)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.setXmin=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.clearXmin=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.hasXmin=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.getYmin=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,0)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.setYmin=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.clearYmin=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.hasYmin=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.getWidth=function(){return t.Message.getFloatingPointFieldWithDefault(this,3,0)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.setWidth=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.clearWidth=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.hasWidth=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.getHeight=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,0)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.setHeight=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.clearHeight=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.hasHeight=function(){return null!=t.Message.getField(this,4)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.LocationData.BinaryMask.prototype.toObject=function(e){return proto.mediapipe.LocationData.BinaryMask.toObject(e,this)},proto.mediapipe.LocationData.BinaryMask.toObject=function(e,r){var o,a={width:null==(o=t.Message.getField(r,1))?void 0:o,height:null==(o=t.Message.getField(r,2))?void 0:o,rasterization:(o=r.getRasterization())&&i.Rasterization.toObject(e,o)};return e&&(a.$jspbMessageInstance=r),a}),proto.mediapipe.LocationData.BinaryMask.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.LocationData.BinaryMask;return proto.mediapipe.LocationData.BinaryMask.deserializeBinaryFromReader(o,r)},proto.mediapipe.LocationData.BinaryMask.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readInt32();e.setWidth(r);break;case 2:r=t.readInt32();e.setHeight(r);break;case 3:r=new i.Rasterization;t.readMessage(r,i.Rasterization.deserializeBinaryFromReader),e.setRasterization(r);break;default:t.skipField()}}return e},proto.mediapipe.LocationData.BinaryMask.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.LocationData.BinaryMask.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.LocationData.BinaryMask.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeInt32(1,o),null!=(o=t.Message.getField(e,2))&&r.writeInt32(2,o),null!=(o=e.getRasterization())&&r.writeMessage(3,o,i.Rasterization.serializeBinaryToWriter)},proto.mediapipe.LocationData.BinaryMask.prototype.getWidth=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.LocationData.BinaryMask.prototype.setWidth=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.LocationData.BinaryMask.prototype.clearWidth=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.LocationData.BinaryMask.prototype.hasWidth=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.LocationData.BinaryMask.prototype.getHeight=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.LocationData.BinaryMask.prototype.setHeight=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.LocationData.BinaryMask.prototype.clearHeight=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.LocationData.BinaryMask.prototype.hasHeight=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.LocationData.BinaryMask.prototype.getRasterization=function(){return t.Message.getWrapperField(this,i.Rasterization,3)},proto.mediapipe.LocationData.BinaryMask.prototype.setRasterization=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.LocationData.BinaryMask.prototype.clearRasterization=function(){return this.setRasterization(void 0)},proto.mediapipe.LocationData.BinaryMask.prototype.hasRasterization=function(){return null!=t.Message.getField(this,3)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.LocationData.RelativeKeypoint.prototype.toObject=function(e){return proto.mediapipe.LocationData.RelativeKeypoint.toObject(e,this)},proto.mediapipe.LocationData.RelativeKeypoint.toObject=function(e,r){var o,i={x:null==(o=t.Message.getOptionalFloatingPointField(r,1))?void 0:o,y:null==(o=t.Message.getOptionalFloatingPointField(r,2))?void 0:o,keypointLabel:null==(o=t.Message.getField(r,3))?void 0:o,score:null==(o=t.Message.getOptionalFloatingPointField(r,4))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.LocationData.RelativeKeypoint.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.LocationData.RelativeKeypoint;return proto.mediapipe.LocationData.RelativeKeypoint.deserializeBinaryFromReader(o,r)},proto.mediapipe.LocationData.RelativeKeypoint.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readFloat();e.setX(r);break;case 2:r=t.readFloat();e.setY(r);break;case 3:r=t.readString();e.setKeypointLabel(r);break;case 4:r=t.readFloat();e.setScore(r);break;default:t.skipField()}}return e},proto.mediapipe.LocationData.RelativeKeypoint.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.LocationData.RelativeKeypoint.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.LocationData.RelativeKeypoint.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeFloat(1,o),null!=(o=t.Message.getField(e,2))&&r.writeFloat(2,o),null!=(o=t.Message.getField(e,3))&&r.writeString(3,o),null!=(o=t.Message.getField(e,4))&&r.writeFloat(4,o)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.getX=function(){return t.Message.getFloatingPointFieldWithDefault(this,1,0)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.setX=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.clearX=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.hasX=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.getY=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,0)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.setY=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.clearY=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.hasY=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.getKeypointLabel=function(){return t.Message.getFieldWithDefault(this,3,"")},proto.mediapipe.LocationData.RelativeKeypoint.prototype.setKeypointLabel=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.clearKeypointLabel=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.hasKeypointLabel=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.getScore=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,0)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.setScore=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.clearScore=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.hasScore=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.LocationData.prototype.getFormat=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.LocationData.prototype.setFormat=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.LocationData.prototype.clearFormat=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.LocationData.prototype.hasFormat=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.LocationData.prototype.getBoundingBox=function(){return t.Message.getWrapperField(this,proto.mediapipe.LocationData.BoundingBox,2)},proto.mediapipe.LocationData.prototype.setBoundingBox=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.LocationData.prototype.clearBoundingBox=function(){return this.setBoundingBox(void 0)},proto.mediapipe.LocationData.prototype.hasBoundingBox=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.LocationData.prototype.getRelativeBoundingBox=function(){return t.Message.getWrapperField(this,proto.mediapipe.LocationData.RelativeBoundingBox,3)},proto.mediapipe.LocationData.prototype.setRelativeBoundingBox=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.LocationData.prototype.clearRelativeBoundingBox=function(){return this.setRelativeBoundingBox(void 0)},proto.mediapipe.LocationData.prototype.hasRelativeBoundingBox=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.LocationData.prototype.getMask=function(){return t.Message.getWrapperField(this,proto.mediapipe.LocationData.BinaryMask,4)},proto.mediapipe.LocationData.prototype.setMask=function(e){return t.Message.setWrapperField(this,4,e)},proto.mediapipe.LocationData.prototype.clearMask=function(){return this.setMask(void 0)},proto.mediapipe.LocationData.prototype.hasMask=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.LocationData.prototype.getRelativeKeypointsList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.LocationData.RelativeKeypoint,5)},proto.mediapipe.LocationData.prototype.setRelativeKeypointsList=function(e){return t.Message.setRepeatedWrapperField(this,5,e)},proto.mediapipe.LocationData.prototype.addRelativeKeypoints=function(e,r){return t.Message.addToRepeatedWrapperField(this,5,e,proto.mediapipe.LocationData.RelativeKeypoint,r)},proto.mediapipe.LocationData.prototype.clearRelativeKeypointsList=function(){return this.setRelativeKeypointsList([])},r.object.extend(e,proto.mediapipe)}(location_data_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=location_data_pb;r.object.extend(proto,i),r.exportSymbol("proto.mediapipe.Detection",null,o),r.exportSymbol("proto.mediapipe.Detection.AssociatedDetection",null,o),r.exportSymbol("proto.mediapipe.DetectionList",null,o),proto.mediapipe.Detection=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.Detection.repeatedFields_,null)},r.inherits(proto.mediapipe.Detection,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.Detection.displayName="proto.mediapipe.Detection"),proto.mediapipe.Detection.AssociatedDetection=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.Detection.AssociatedDetection,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.Detection.AssociatedDetection.displayName="proto.mediapipe.Detection.AssociatedDetection"),proto.mediapipe.DetectionList=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.DetectionList.repeatedFields_,null)},r.inherits(proto.mediapipe.DetectionList,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.DetectionList.displayName="proto.mediapipe.DetectionList"),proto.mediapipe.Detection.repeatedFields_=[1,2,3,8,9],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.Detection.prototype.toObject=function(e){return proto.mediapipe.Detection.toObject(e,this)},proto.mediapipe.Detection.toObject=function(e,r){var o,a={labelList:null==(o=t.Message.getRepeatedField(r,1))?void 0:o,labelIdList:null==(o=t.Message.getRepeatedField(r,2))?void 0:o,scoreList:null==(o=t.Message.getRepeatedFloatingPointField(r,3))?void 0:o,locationData:(o=r.getLocationData())&&i.LocationData.toObject(e,o),featureTag:null==(o=t.Message.getField(r,5))?void 0:o,trackId:null==(o=t.Message.getField(r,6))?void 0:o,detectionId:null==(o=t.Message.getField(r,7))?void 0:o,associatedDetectionsList:t.Message.toObjectList(r.getAssociatedDetectionsList(),proto.mediapipe.Detection.AssociatedDetection.toObject,e),displayNameList:null==(o=t.Message.getRepeatedField(r,9))?void 0:o,timestampUsec:null==(o=t.Message.getField(r,10))?void 0:o};return e&&(a.$jspbMessageInstance=r),a}),proto.mediapipe.Detection.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.Detection;return proto.mediapipe.Detection.deserializeBinaryFromReader(o,r)},proto.mediapipe.Detection.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.addLabel(r);break;case 2:for(var o=t.isDelimited()?t.readPackedInt32():[t.readInt32()],a=0;a0&&r.writeRepeatedString(1,o),(o=e.getLabelIdList()).length>0&&r.writePackedInt32(2,o),(o=e.getScoreList()).length>0&&r.writePackedFloat(3,o),null!=(o=e.getLocationData())&&r.writeMessage(4,o,i.LocationData.serializeBinaryToWriter),null!=(o=t.Message.getField(e,5))&&r.writeString(5,o),null!=(o=t.Message.getField(e,6))&&r.writeString(6,o),null!=(o=t.Message.getField(e,7))&&r.writeInt64(7,o),(o=e.getAssociatedDetectionsList()).length>0&&r.writeRepeatedMessage(8,o,proto.mediapipe.Detection.AssociatedDetection.serializeBinaryToWriter),(o=e.getDisplayNameList()).length>0&&r.writeRepeatedString(9,o),null!=(o=t.Message.getField(e,10))&&r.writeInt64(10,o)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.Detection.AssociatedDetection.prototype.toObject=function(e){return proto.mediapipe.Detection.AssociatedDetection.toObject(e,this)},proto.mediapipe.Detection.AssociatedDetection.toObject=function(e,r){var o,i={id:null==(o=t.Message.getField(r,1))?void 0:o,confidence:null==(o=t.Message.getOptionalFloatingPointField(r,2))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.Detection.AssociatedDetection.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.Detection.AssociatedDetection;return proto.mediapipe.Detection.AssociatedDetection.deserializeBinaryFromReader(o,r)},proto.mediapipe.Detection.AssociatedDetection.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readInt32();e.setId(r);break;case 2:r=t.readFloat();e.setConfidence(r);break;default:t.skipField()}}return e},proto.mediapipe.Detection.AssociatedDetection.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.Detection.AssociatedDetection.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.Detection.AssociatedDetection.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeInt32(1,o),null!=(o=t.Message.getField(e,2))&&r.writeFloat(2,o)},proto.mediapipe.Detection.AssociatedDetection.prototype.getId=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.Detection.AssociatedDetection.prototype.setId=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.Detection.AssociatedDetection.prototype.clearId=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.Detection.AssociatedDetection.prototype.hasId=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.Detection.AssociatedDetection.prototype.getConfidence=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,0)},proto.mediapipe.Detection.AssociatedDetection.prototype.setConfidence=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.Detection.AssociatedDetection.prototype.clearConfidence=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.Detection.AssociatedDetection.prototype.hasConfidence=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.Detection.prototype.getLabelList=function(){return t.Message.getRepeatedField(this,1)},proto.mediapipe.Detection.prototype.setLabelList=function(e){return t.Message.setField(this,1,e||[])},proto.mediapipe.Detection.prototype.addLabel=function(e,r){return t.Message.addToRepeatedField(this,1,e,r)},proto.mediapipe.Detection.prototype.clearLabelList=function(){return this.setLabelList([])},proto.mediapipe.Detection.prototype.getLabelIdList=function(){return t.Message.getRepeatedField(this,2)},proto.mediapipe.Detection.prototype.setLabelIdList=function(e){return t.Message.setField(this,2,e||[])},proto.mediapipe.Detection.prototype.addLabelId=function(e,r){return t.Message.addToRepeatedField(this,2,e,r)},proto.mediapipe.Detection.prototype.clearLabelIdList=function(){return this.setLabelIdList([])},proto.mediapipe.Detection.prototype.getScoreList=function(){return t.Message.getRepeatedFloatingPointField(this,3)},proto.mediapipe.Detection.prototype.setScoreList=function(e){return t.Message.setField(this,3,e||[])},proto.mediapipe.Detection.prototype.addScore=function(e,r){return t.Message.addToRepeatedField(this,3,e,r)},proto.mediapipe.Detection.prototype.clearScoreList=function(){return this.setScoreList([])},proto.mediapipe.Detection.prototype.getLocationData=function(){return t.Message.getWrapperField(this,i.LocationData,4)},proto.mediapipe.Detection.prototype.setLocationData=function(e){return t.Message.setWrapperField(this,4,e)},proto.mediapipe.Detection.prototype.clearLocationData=function(){return this.setLocationData(void 0)},proto.mediapipe.Detection.prototype.hasLocationData=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.Detection.prototype.getFeatureTag=function(){return t.Message.getFieldWithDefault(this,5,"")},proto.mediapipe.Detection.prototype.setFeatureTag=function(e){return t.Message.setField(this,5,e)},proto.mediapipe.Detection.prototype.clearFeatureTag=function(){return t.Message.setField(this,5,void 0)},proto.mediapipe.Detection.prototype.hasFeatureTag=function(){return null!=t.Message.getField(this,5)},proto.mediapipe.Detection.prototype.getTrackId=function(){return t.Message.getFieldWithDefault(this,6,"")},proto.mediapipe.Detection.prototype.setTrackId=function(e){return t.Message.setField(this,6,e)},proto.mediapipe.Detection.prototype.clearTrackId=function(){return t.Message.setField(this,6,void 0)},proto.mediapipe.Detection.prototype.hasTrackId=function(){return null!=t.Message.getField(this,6)},proto.mediapipe.Detection.prototype.getDetectionId=function(){return t.Message.getFieldWithDefault(this,7,0)},proto.mediapipe.Detection.prototype.setDetectionId=function(e){return t.Message.setField(this,7,e)},proto.mediapipe.Detection.prototype.clearDetectionId=function(){return t.Message.setField(this,7,void 0)},proto.mediapipe.Detection.prototype.hasDetectionId=function(){return null!=t.Message.getField(this,7)},proto.mediapipe.Detection.prototype.getAssociatedDetectionsList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.Detection.AssociatedDetection,8)},proto.mediapipe.Detection.prototype.setAssociatedDetectionsList=function(e){return t.Message.setRepeatedWrapperField(this,8,e)},proto.mediapipe.Detection.prototype.addAssociatedDetections=function(e,r){return t.Message.addToRepeatedWrapperField(this,8,e,proto.mediapipe.Detection.AssociatedDetection,r)},proto.mediapipe.Detection.prototype.clearAssociatedDetectionsList=function(){return this.setAssociatedDetectionsList([])},proto.mediapipe.Detection.prototype.getDisplayNameList=function(){return t.Message.getRepeatedField(this,9)},proto.mediapipe.Detection.prototype.setDisplayNameList=function(e){return t.Message.setField(this,9,e||[])},proto.mediapipe.Detection.prototype.addDisplayName=function(e,r){return t.Message.addToRepeatedField(this,9,e,r)},proto.mediapipe.Detection.prototype.clearDisplayNameList=function(){return this.setDisplayNameList([])},proto.mediapipe.Detection.prototype.getTimestampUsec=function(){return t.Message.getFieldWithDefault(this,10,0)},proto.mediapipe.Detection.prototype.setTimestampUsec=function(e){return t.Message.setField(this,10,e)},proto.mediapipe.Detection.prototype.clearTimestampUsec=function(){return t.Message.setField(this,10,void 0)},proto.mediapipe.Detection.prototype.hasTimestampUsec=function(){return null!=t.Message.getField(this,10)},proto.mediapipe.DetectionList.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.DetectionList.prototype.toObject=function(e){return proto.mediapipe.DetectionList.toObject(e,this)},proto.mediapipe.DetectionList.toObject=function(e,r){var o={detectionList:t.Message.toObjectList(r.getDetectionList(),proto.mediapipe.Detection.toObject,e)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.DetectionList.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.DetectionList;return proto.mediapipe.DetectionList.deserializeBinaryFromReader(o,r)},proto.mediapipe.DetectionList.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new proto.mediapipe.Detection;t.readMessage(r,proto.mediapipe.Detection.deserializeBinaryFromReader),e.addDetection(r)}else t.skipField()}return e},proto.mediapipe.DetectionList.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.DetectionList.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.DetectionList.serializeBinaryToWriter=function(e,t){var r;(r=e.getDetectionList()).length>0&&t.writeRepeatedMessage(1,r,proto.mediapipe.Detection.serializeBinaryToWriter)},proto.mediapipe.DetectionList.prototype.getDetectionList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.Detection,1)},proto.mediapipe.DetectionList.prototype.setDetectionList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.DetectionList.prototype.addDetection=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.Detection,r)},proto.mediapipe.DetectionList.prototype.clearDetectionList=function(){return this.setDetectionList([])},r.object.extend(e,proto.mediapipe)}(detection_pb);var base_options_pb={},acceleration_pb={},inference_calculator_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a),r.exportSymbol("proto.mediapipe.InferenceCalculatorOptions",null,o),r.exportSymbol("proto.mediapipe.InferenceCalculatorOptions.Delegate",null,o),r.exportSymbol("proto.mediapipe.InferenceCalculatorOptions.Delegate.DelegateCase",null,o),r.exportSymbol("proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu",null,o),r.exportSymbol("proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.Api",null,o),r.exportSymbol("proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.InferenceUsage",null,o),r.exportSymbol("proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi",null,o),r.exportSymbol("proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite",null,o),r.exportSymbol("proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack",null,o),proto.mediapipe.InferenceCalculatorOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.InferenceCalculatorOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.InferenceCalculatorOptions.displayName="proto.mediapipe.InferenceCalculatorOptions"),proto.mediapipe.InferenceCalculatorOptions.Delegate=function(e){t.Message.initialize(this,e,0,-1,null,proto.mediapipe.InferenceCalculatorOptions.Delegate.oneofGroups_)},r.inherits(proto.mediapipe.InferenceCalculatorOptions.Delegate,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.InferenceCalculatorOptions.Delegate.displayName="proto.mediapipe.InferenceCalculatorOptions.Delegate"),proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.displayName="proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite"),proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.displayName="proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu"),proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.displayName="proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi"),proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.displayName="proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.InferenceCalculatorOptions.prototype.toObject=function(e){return proto.mediapipe.InferenceCalculatorOptions.toObject(e,this)},proto.mediapipe.InferenceCalculatorOptions.toObject=function(e,r){var o,i={modelPath:null==(o=t.Message.getField(r,1))?void 0:o,useGpu:t.Message.getBooleanFieldWithDefault(r,2,!1),useNnapi:t.Message.getBooleanFieldWithDefault(r,3,!1),cpuNumThread:t.Message.getFieldWithDefault(r,4,-1),delegate:(o=r.getDelegate())&&proto.mediapipe.InferenceCalculatorOptions.Delegate.toObject(e,o)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.InferenceCalculatorOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.InferenceCalculatorOptions;return proto.mediapipe.InferenceCalculatorOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.InferenceCalculatorOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setModelPath(r);break;case 2:r=t.readBool();e.setUseGpu(r);break;case 3:r=t.readBool();e.setUseNnapi(r);break;case 4:r=t.readInt32();e.setCpuNumThread(r);break;case 5:r=new proto.mediapipe.InferenceCalculatorOptions.Delegate;t.readMessage(r,proto.mediapipe.InferenceCalculatorOptions.Delegate.deserializeBinaryFromReader),e.setDelegate(r);break;default:t.skipField()}}return e},proto.mediapipe.InferenceCalculatorOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.InferenceCalculatorOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.InferenceCalculatorOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeString(1,o),null!=(o=t.Message.getField(e,2))&&r.writeBool(2,o),null!=(o=t.Message.getField(e,3))&&r.writeBool(3,o),null!=(o=t.Message.getField(e,4))&&r.writeInt32(4,o),null!=(o=e.getDelegate())&&r.writeMessage(5,o,proto.mediapipe.InferenceCalculatorOptions.Delegate.serializeBinaryToWriter)},proto.mediapipe.InferenceCalculatorOptions.Delegate.oneofGroups_=[[1,2,3,4]],proto.mediapipe.InferenceCalculatorOptions.Delegate.DelegateCase={DELEGATE_NOT_SET:0,TFLITE:1,GPU:2,NNAPI:3,XNNPACK:4},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.getDelegateCase=function(){return t.Message.computeOneofCase(this,proto.mediapipe.InferenceCalculatorOptions.Delegate.oneofGroups_[0])},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.toObject=function(e){return proto.mediapipe.InferenceCalculatorOptions.Delegate.toObject(e,this)},proto.mediapipe.InferenceCalculatorOptions.Delegate.toObject=function(e,t){var r,o={tflite:(r=t.getTflite())&&proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.toObject(e,r),gpu:(r=t.getGpu())&&proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.toObject(e,r),nnapi:(r=t.getNnapi())&&proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.toObject(e,r),xnnpack:(r=t.getXnnpack())&&proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.InferenceCalculatorOptions.Delegate.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.InferenceCalculatorOptions.Delegate;return proto.mediapipe.InferenceCalculatorOptions.Delegate.deserializeBinaryFromReader(o,r)},proto.mediapipe.InferenceCalculatorOptions.Delegate.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite;t.readMessage(r,proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.deserializeBinaryFromReader),e.setTflite(r);break;case 2:r=new proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu;t.readMessage(r,proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.deserializeBinaryFromReader),e.setGpu(r);break;case 3:r=new proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi;t.readMessage(r,proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.deserializeBinaryFromReader),e.setNnapi(r);break;case 4:r=new proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack;t.readMessage(r,proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.deserializeBinaryFromReader),e.setXnnpack(r);break;default:t.skipField()}}return e},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.InferenceCalculatorOptions.Delegate.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.InferenceCalculatorOptions.Delegate.serializeBinaryToWriter=function(e,t){var r=void 0;null!=(r=e.getTflite())&&t.writeMessage(1,r,proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.serializeBinaryToWriter),null!=(r=e.getGpu())&&t.writeMessage(2,r,proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.serializeBinaryToWriter),null!=(r=e.getNnapi())&&t.writeMessage(3,r,proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.serializeBinaryToWriter),null!=(r=e.getXnnpack())&&t.writeMessage(4,r,proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.serializeBinaryToWriter)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.prototype.toObject=function(e){return proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.toObject(e,this)},proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.toObject=function(e,t){var r={};return e&&(r.$jspbMessageInstance=t),r}),proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite;return proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.deserializeBinaryFromReader(o,r)},proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){t.getFieldNumber();t.skipField()}return e},proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.serializeBinaryToWriter=function(e,t){},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.toObject=function(e){return proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.toObject(e,this)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.toObject=function(e,r){var o,i={useAdvancedGpuApi:t.Message.getBooleanFieldWithDefault(r,1,!1),api:t.Message.getFieldWithDefault(r,4,0),allowPrecisionLoss:t.Message.getBooleanFieldWithDefault(r,3,!0),cachedKernelPath:null==(o=t.Message.getField(r,2))?void 0:o,serializedModelDir:null==(o=t.Message.getField(r,7))?void 0:o,modelToken:null==(o=t.Message.getField(r,8))?void 0:o,usage:t.Message.getFieldWithDefault(r,5,2)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu;return proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.deserializeBinaryFromReader(o,r)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readBool();e.setUseAdvancedGpuApi(r);break;case 4:r=t.readEnum();e.setApi(r);break;case 3:r=t.readBool();e.setAllowPrecisionLoss(r);break;case 2:r=t.readString();e.setCachedKernelPath(r);break;case 7:r=t.readString();e.setSerializedModelDir(r);break;case 8:r=t.readString();e.setModelToken(r);break;case 5:r=t.readEnum();e.setUsage(r);break;default:t.skipField()}}return e},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeBool(1,o),null!=(o=t.Message.getField(e,4))&&r.writeEnum(4,o),null!=(o=t.Message.getField(e,3))&&r.writeBool(3,o),null!=(o=t.Message.getField(e,2))&&r.writeString(2,o),null!=(o=t.Message.getField(e,7))&&r.writeString(7,o),null!=(o=t.Message.getField(e,8))&&r.writeString(8,o),null!=(o=t.Message.getField(e,5))&&r.writeEnum(5,o)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.Api={ANY:0,OPENGL:1,OPENCL:2},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.InferenceUsage={UNSPECIFIED:0,FAST_SINGLE_ANSWER:1,SUSTAINED_SPEED:2},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.getUseAdvancedGpuApi=function(){return t.Message.getBooleanFieldWithDefault(this,1,!1)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.setUseAdvancedGpuApi=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.clearUseAdvancedGpuApi=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.hasUseAdvancedGpuApi=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.getApi=function(){return t.Message.getFieldWithDefault(this,4,0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.setApi=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.clearApi=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.hasApi=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.getAllowPrecisionLoss=function(){return t.Message.getBooleanFieldWithDefault(this,3,!0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.setAllowPrecisionLoss=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.clearAllowPrecisionLoss=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.hasAllowPrecisionLoss=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.getCachedKernelPath=function(){return t.Message.getFieldWithDefault(this,2,"")},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.setCachedKernelPath=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.clearCachedKernelPath=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.hasCachedKernelPath=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.getSerializedModelDir=function(){return t.Message.getFieldWithDefault(this,7,"")},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.setSerializedModelDir=function(e){return t.Message.setField(this,7,e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.clearSerializedModelDir=function(){return t.Message.setField(this,7,void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.hasSerializedModelDir=function(){return null!=t.Message.getField(this,7)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.getModelToken=function(){return t.Message.getFieldWithDefault(this,8,"")},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.setModelToken=function(e){return t.Message.setField(this,8,e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.clearModelToken=function(){return t.Message.setField(this,8,void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.hasModelToken=function(){return null!=t.Message.getField(this,8)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.getUsage=function(){return t.Message.getFieldWithDefault(this,5,2)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.setUsage=function(e){return t.Message.setField(this,5,e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.clearUsage=function(){return t.Message.setField(this,5,void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.hasUsage=function(){return null!=t.Message.getField(this,5)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.toObject=function(e){return proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.toObject(e,this)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.toObject=function(e,r){var o,i={cacheDir:null==(o=t.Message.getField(r,1))?void 0:o,modelToken:null==(o=t.Message.getField(r,2))?void 0:o,acceleratorName:null==(o=t.Message.getField(r,3))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi;return proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.deserializeBinaryFromReader(o,r)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setCacheDir(r);break;case 2:r=t.readString();e.setModelToken(r);break;case 3:r=t.readString();e.setAcceleratorName(r);break;default:t.skipField()}}return e},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeString(1,o),null!=(o=t.Message.getField(e,2))&&r.writeString(2,o),null!=(o=t.Message.getField(e,3))&&r.writeString(3,o)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.getCacheDir=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.setCacheDir=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.clearCacheDir=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.hasCacheDir=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.getModelToken=function(){return t.Message.getFieldWithDefault(this,2,"")},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.setModelToken=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.clearModelToken=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.hasModelToken=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.getAcceleratorName=function(){return t.Message.getFieldWithDefault(this,3,"")},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.setAcceleratorName=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.clearAcceleratorName=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.hasAcceleratorName=function(){return null!=t.Message.getField(this,3)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.prototype.toObject=function(e){return proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.toObject(e,this)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.toObject=function(e,r){var o={numThreads:t.Message.getFieldWithDefault(r,1,-1)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack;return proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.deserializeBinaryFromReader(o,r)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=t.readInt32();e.setNumThreads(r)}else t.skipField()}return e},proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.serializeBinaryToWriter=function(e,r){var o;null!=(o=t.Message.getField(e,1))&&r.writeInt32(1,o)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.prototype.getNumThreads=function(){return t.Message.getFieldWithDefault(this,1,-1)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.prototype.setNumThreads=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.prototype.clearNumThreads=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.prototype.hasNumThreads=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.getTflite=function(){return t.Message.getWrapperField(this,proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite,1)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.setTflite=function(e){return t.Message.setOneofWrapperField(this,1,proto.mediapipe.InferenceCalculatorOptions.Delegate.oneofGroups_[0],e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.clearTflite=function(){return this.setTflite(void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.hasTflite=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.getGpu=function(){return t.Message.getWrapperField(this,proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu,2)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.setGpu=function(e){return t.Message.setOneofWrapperField(this,2,proto.mediapipe.InferenceCalculatorOptions.Delegate.oneofGroups_[0],e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.clearGpu=function(){return this.setGpu(void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.hasGpu=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.getNnapi=function(){return t.Message.getWrapperField(this,proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi,3)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.setNnapi=function(e){return t.Message.setOneofWrapperField(this,3,proto.mediapipe.InferenceCalculatorOptions.Delegate.oneofGroups_[0],e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.clearNnapi=function(){return this.setNnapi(void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.hasNnapi=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.getXnnpack=function(){return t.Message.getWrapperField(this,proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack,4)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.setXnnpack=function(e){return t.Message.setOneofWrapperField(this,4,proto.mediapipe.InferenceCalculatorOptions.Delegate.oneofGroups_[0],e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.clearXnnpack=function(){return this.setXnnpack(void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.hasXnnpack=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.InferenceCalculatorOptions.ext=new t.ExtensionFieldInfo(336783863,{ext:0},proto.mediapipe.InferenceCalculatorOptions,proto.mediapipe.InferenceCalculatorOptions.toObject,0),a.CalculatorOptions.extensionsBinary[336783863]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.InferenceCalculatorOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.InferenceCalculatorOptions.serializeBinaryToWriter,proto.mediapipe.InferenceCalculatorOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[336783863]=proto.mediapipe.InferenceCalculatorOptions.ext,proto.mediapipe.InferenceCalculatorOptions.prototype.getModelPath=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.InferenceCalculatorOptions.prototype.setModelPath=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.InferenceCalculatorOptions.prototype.clearModelPath=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.InferenceCalculatorOptions.prototype.hasModelPath=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.InferenceCalculatorOptions.prototype.getUseGpu=function(){return t.Message.getBooleanFieldWithDefault(this,2,!1)},proto.mediapipe.InferenceCalculatorOptions.prototype.setUseGpu=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.InferenceCalculatorOptions.prototype.clearUseGpu=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.InferenceCalculatorOptions.prototype.hasUseGpu=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.InferenceCalculatorOptions.prototype.getUseNnapi=function(){return t.Message.getBooleanFieldWithDefault(this,3,!1)},proto.mediapipe.InferenceCalculatorOptions.prototype.setUseNnapi=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.InferenceCalculatorOptions.prototype.clearUseNnapi=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.InferenceCalculatorOptions.prototype.hasUseNnapi=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.InferenceCalculatorOptions.prototype.getCpuNumThread=function(){return t.Message.getFieldWithDefault(this,4,-1)},proto.mediapipe.InferenceCalculatorOptions.prototype.setCpuNumThread=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.InferenceCalculatorOptions.prototype.clearCpuNumThread=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.InferenceCalculatorOptions.prototype.hasCpuNumThread=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.InferenceCalculatorOptions.prototype.getDelegate=function(){return t.Message.getWrapperField(this,proto.mediapipe.InferenceCalculatorOptions.Delegate,5)},proto.mediapipe.InferenceCalculatorOptions.prototype.setDelegate=function(e){return t.Message.setWrapperField(this,5,e)},proto.mediapipe.InferenceCalculatorOptions.prototype.clearDelegate=function(){return this.setDelegate(void 0)},proto.mediapipe.InferenceCalculatorOptions.prototype.hasDelegate=function(){return null!=t.Message.getField(this,5)},proto.mediapipe.InferenceCalculatorOptions.ext=new t.ExtensionFieldInfo(336783863,{ext:0},proto.mediapipe.InferenceCalculatorOptions,proto.mediapipe.InferenceCalculatorOptions.toObject,0),a.CalculatorOptions.extensionsBinary[336783863]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.InferenceCalculatorOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.InferenceCalculatorOptions.serializeBinaryToWriter,proto.mediapipe.InferenceCalculatorOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[336783863]=proto.mediapipe.InferenceCalculatorOptions.ext,r.object.extend(e,proto.mediapipe)}(inference_calculator_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=inference_calculator_pb;r.object.extend(proto,i),r.exportSymbol("proto.mediapipe.tasks.core.proto.Acceleration",null,o),r.exportSymbol("proto.mediapipe.tasks.core.proto.Acceleration.DelegateCase",null,o),proto.mediapipe.tasks.core.proto.Acceleration=function(e){t.Message.initialize(this,e,0,-1,null,proto.mediapipe.tasks.core.proto.Acceleration.oneofGroups_)},r.inherits(proto.mediapipe.tasks.core.proto.Acceleration,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.core.proto.Acceleration.displayName="proto.mediapipe.tasks.core.proto.Acceleration"),proto.mediapipe.tasks.core.proto.Acceleration.oneofGroups_=[[1,2,4,5]],proto.mediapipe.tasks.core.proto.Acceleration.DelegateCase={DELEGATE_NOT_SET:0,XNNPACK:1,GPU:2,TFLITE:4,NNAPI:5},proto.mediapipe.tasks.core.proto.Acceleration.prototype.getDelegateCase=function(){return t.Message.computeOneofCase(this,proto.mediapipe.tasks.core.proto.Acceleration.oneofGroups_[0])},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.core.proto.Acceleration.prototype.toObject=function(e){return proto.mediapipe.tasks.core.proto.Acceleration.toObject(e,this)},proto.mediapipe.tasks.core.proto.Acceleration.toObject=function(e,t){var r,o={xnnpack:(r=t.getXnnpack())&&i.InferenceCalculatorOptions.Delegate.Xnnpack.toObject(e,r),gpu:(r=t.getGpu())&&i.InferenceCalculatorOptions.Delegate.Gpu.toObject(e,r),tflite:(r=t.getTflite())&&i.InferenceCalculatorOptions.Delegate.TfLite.toObject(e,r),nnapi:(r=t.getNnapi())&&i.InferenceCalculatorOptions.Delegate.Nnapi.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.core.proto.Acceleration.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.core.proto.Acceleration;return proto.mediapipe.tasks.core.proto.Acceleration.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.core.proto.Acceleration.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new i.InferenceCalculatorOptions.Delegate.Xnnpack;t.readMessage(r,i.InferenceCalculatorOptions.Delegate.Xnnpack.deserializeBinaryFromReader),e.setXnnpack(r);break;case 2:r=new i.InferenceCalculatorOptions.Delegate.Gpu;t.readMessage(r,i.InferenceCalculatorOptions.Delegate.Gpu.deserializeBinaryFromReader),e.setGpu(r);break;case 4:r=new i.InferenceCalculatorOptions.Delegate.TfLite;t.readMessage(r,i.InferenceCalculatorOptions.Delegate.TfLite.deserializeBinaryFromReader),e.setTflite(r);break;case 5:r=new i.InferenceCalculatorOptions.Delegate.Nnapi;t.readMessage(r,i.InferenceCalculatorOptions.Delegate.Nnapi.deserializeBinaryFromReader),e.setNnapi(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.core.proto.Acceleration.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.core.proto.Acceleration.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.core.proto.Acceleration.serializeBinaryToWriter=function(e,t){var r=void 0;null!=(r=e.getXnnpack())&&t.writeMessage(1,r,i.InferenceCalculatorOptions.Delegate.Xnnpack.serializeBinaryToWriter),null!=(r=e.getGpu())&&t.writeMessage(2,r,i.InferenceCalculatorOptions.Delegate.Gpu.serializeBinaryToWriter),null!=(r=e.getTflite())&&t.writeMessage(4,r,i.InferenceCalculatorOptions.Delegate.TfLite.serializeBinaryToWriter),null!=(r=e.getNnapi())&&t.writeMessage(5,r,i.InferenceCalculatorOptions.Delegate.Nnapi.serializeBinaryToWriter)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.getXnnpack=function(){return t.Message.getWrapperField(this,i.InferenceCalculatorOptions.Delegate.Xnnpack,1)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.setXnnpack=function(e){return t.Message.setOneofWrapperField(this,1,proto.mediapipe.tasks.core.proto.Acceleration.oneofGroups_[0],e)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.clearXnnpack=function(){return this.setXnnpack(void 0)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.hasXnnpack=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.getGpu=function(){return t.Message.getWrapperField(this,i.InferenceCalculatorOptions.Delegate.Gpu,2)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.setGpu=function(e){return t.Message.setOneofWrapperField(this,2,proto.mediapipe.tasks.core.proto.Acceleration.oneofGroups_[0],e)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.clearGpu=function(){return this.setGpu(void 0)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.hasGpu=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.getTflite=function(){return t.Message.getWrapperField(this,i.InferenceCalculatorOptions.Delegate.TfLite,4)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.setTflite=function(e){return t.Message.setOneofWrapperField(this,4,proto.mediapipe.tasks.core.proto.Acceleration.oneofGroups_[0],e)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.clearTflite=function(){return this.setTflite(void 0)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.hasTflite=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.getNnapi=function(){return t.Message.getWrapperField(this,i.InferenceCalculatorOptions.Delegate.Nnapi,5)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.setNnapi=function(e){return t.Message.setOneofWrapperField(this,5,proto.mediapipe.tasks.core.proto.Acceleration.oneofGroups_[0],e)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.clearNnapi=function(){return this.setNnapi(void 0)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.hasNnapi=function(){return null!=t.Message.getField(this,5)},r.object.extend(e,proto.mediapipe.tasks.core.proto)}(acceleration_pb);var external_file_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.tasks.core.proto.ExternalFile",null,o),r.exportSymbol("proto.mediapipe.tasks.core.proto.FileDescriptorMeta",null,o),r.exportSymbol("proto.mediapipe.tasks.core.proto.FilePointerMeta",null,o),proto.mediapipe.tasks.core.proto.ExternalFile=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.core.proto.ExternalFile,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.core.proto.ExternalFile.displayName="proto.mediapipe.tasks.core.proto.ExternalFile"),proto.mediapipe.tasks.core.proto.FileDescriptorMeta=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.core.proto.FileDescriptorMeta,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.core.proto.FileDescriptorMeta.displayName="proto.mediapipe.tasks.core.proto.FileDescriptorMeta"),proto.mediapipe.tasks.core.proto.FilePointerMeta=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.core.proto.FilePointerMeta,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.core.proto.FilePointerMeta.displayName="proto.mediapipe.tasks.core.proto.FilePointerMeta"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.core.proto.ExternalFile.prototype.toObject=function(e){return proto.mediapipe.tasks.core.proto.ExternalFile.toObject(e,this)},proto.mediapipe.tasks.core.proto.ExternalFile.toObject=function(e,r){var o,i={fileContent:r.getFileContent_asB64(),fileName:null==(o=t.Message.getField(r,2))?void 0:o,fileDescriptorMeta:(o=r.getFileDescriptorMeta())&&proto.mediapipe.tasks.core.proto.FileDescriptorMeta.toObject(e,o),filePointerMeta:(o=r.getFilePointerMeta())&&proto.mediapipe.tasks.core.proto.FilePointerMeta.toObject(e,o)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.core.proto.ExternalFile.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.core.proto.ExternalFile;return proto.mediapipe.tasks.core.proto.ExternalFile.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.core.proto.ExternalFile.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readBytes();e.setFileContent(r);break;case 2:r=t.readString();e.setFileName(r);break;case 3:r=new proto.mediapipe.tasks.core.proto.FileDescriptorMeta;t.readMessage(r,proto.mediapipe.tasks.core.proto.FileDescriptorMeta.deserializeBinaryFromReader),e.setFileDescriptorMeta(r);break;case 4:r=new proto.mediapipe.tasks.core.proto.FilePointerMeta;t.readMessage(r,proto.mediapipe.tasks.core.proto.FilePointerMeta.deserializeBinaryFromReader),e.setFilePointerMeta(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.core.proto.ExternalFile.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.core.proto.ExternalFile.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeBytes(1,o),null!=(o=t.Message.getField(e,2))&&r.writeString(2,o),null!=(o=e.getFileDescriptorMeta())&&r.writeMessage(3,o,proto.mediapipe.tasks.core.proto.FileDescriptorMeta.serializeBinaryToWriter),null!=(o=e.getFilePointerMeta())&&r.writeMessage(4,o,proto.mediapipe.tasks.core.proto.FilePointerMeta.serializeBinaryToWriter)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.getFileContent=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.getFileContent_asB64=function(){return t.Message.bytesAsB64(this.getFileContent())},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.getFileContent_asU8=function(){return t.Message.bytesAsU8(this.getFileContent())},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.setFileContent=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.clearFileContent=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.hasFileContent=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.getFileName=function(){return t.Message.getFieldWithDefault(this,2,"")},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.setFileName=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.clearFileName=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.hasFileName=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.getFileDescriptorMeta=function(){return t.Message.getWrapperField(this,proto.mediapipe.tasks.core.proto.FileDescriptorMeta,3)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.setFileDescriptorMeta=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.clearFileDescriptorMeta=function(){return this.setFileDescriptorMeta(void 0)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.hasFileDescriptorMeta=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.getFilePointerMeta=function(){return t.Message.getWrapperField(this,proto.mediapipe.tasks.core.proto.FilePointerMeta,4)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.setFilePointerMeta=function(e){return t.Message.setWrapperField(this,4,e)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.clearFilePointerMeta=function(){return this.setFilePointerMeta(void 0)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.hasFilePointerMeta=function(){return null!=t.Message.getField(this,4)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.toObject=function(e){return proto.mediapipe.tasks.core.proto.FileDescriptorMeta.toObject(e,this)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.toObject=function(e,r){var o,i={fd:null==(o=t.Message.getField(r,1))?void 0:o,length:null==(o=t.Message.getField(r,2))?void 0:o,offset:null==(o=t.Message.getField(r,3))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.core.proto.FileDescriptorMeta.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.core.proto.FileDescriptorMeta;return proto.mediapipe.tasks.core.proto.FileDescriptorMeta.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readInt32();e.setFd(r);break;case 2:r=t.readInt64();e.setLength(r);break;case 3:r=t.readInt64();e.setOffset(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.core.proto.FileDescriptorMeta.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeInt32(1,o),null!=(o=t.Message.getField(e,2))&&r.writeInt64(2,o),null!=(o=t.Message.getField(e,3))&&r.writeInt64(3,o)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.getFd=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.setFd=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.clearFd=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.hasFd=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.getLength=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.setLength=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.clearLength=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.hasLength=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.getOffset=function(){return t.Message.getFieldWithDefault(this,3,0)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.setOffset=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.clearOffset=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.hasOffset=function(){return null!=t.Message.getField(this,3)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.core.proto.FilePointerMeta.prototype.toObject=function(e){return proto.mediapipe.tasks.core.proto.FilePointerMeta.toObject(e,this)},proto.mediapipe.tasks.core.proto.FilePointerMeta.toObject=function(e,r){var o,i={pointer:null==(o=t.Message.getField(r,1))?void 0:o,length:null==(o=t.Message.getField(r,2))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.core.proto.FilePointerMeta.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.core.proto.FilePointerMeta;return proto.mediapipe.tasks.core.proto.FilePointerMeta.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.core.proto.FilePointerMeta.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readUint64();e.setPointer(r);break;case 2:r=t.readInt64();e.setLength(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.core.proto.FilePointerMeta.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.core.proto.FilePointerMeta.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.core.proto.FilePointerMeta.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeUint64(1,o),null!=(o=t.Message.getField(e,2))&&r.writeInt64(2,o)},proto.mediapipe.tasks.core.proto.FilePointerMeta.prototype.getPointer=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.tasks.core.proto.FilePointerMeta.prototype.setPointer=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.tasks.core.proto.FilePointerMeta.prototype.clearPointer=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.tasks.core.proto.FilePointerMeta.prototype.hasPointer=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.core.proto.FilePointerMeta.prototype.getLength=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.tasks.core.proto.FilePointerMeta.prototype.setLength=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.core.proto.FilePointerMeta.prototype.clearLength=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.core.proto.FilePointerMeta.prototype.hasLength=function(){return null!=t.Message.getField(this,2)},r.object.extend(e,proto.mediapipe.tasks.core.proto)}(external_file_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=acceleration_pb;r.object.extend(proto,i);var a=external_file_pb;r.object.extend(proto,a),r.exportSymbol("proto.mediapipe.tasks.core.proto.BaseOptions",null,o),proto.mediapipe.tasks.core.proto.BaseOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.core.proto.BaseOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.core.proto.BaseOptions.displayName="proto.mediapipe.tasks.core.proto.BaseOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.core.proto.BaseOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.core.proto.BaseOptions.toObject(e,this)},proto.mediapipe.tasks.core.proto.BaseOptions.toObject=function(e,r){var o,n={modelAsset:(o=r.getModelAsset())&&a.ExternalFile.toObject(e,o),useStreamMode:t.Message.getBooleanFieldWithDefault(r,2,!1),acceleration:(o=r.getAcceleration())&&i.Acceleration.toObject(e,o)};return e&&(n.$jspbMessageInstance=r),n}),proto.mediapipe.tasks.core.proto.BaseOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.core.proto.BaseOptions;return proto.mediapipe.tasks.core.proto.BaseOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.core.proto.BaseOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new a.ExternalFile;t.readMessage(r,a.ExternalFile.deserializeBinaryFromReader),e.setModelAsset(r);break;case 2:r=t.readBool();e.setUseStreamMode(r);break;case 3:r=new i.Acceleration;t.readMessage(r,i.Acceleration.deserializeBinaryFromReader),e.setAcceleration(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.core.proto.BaseOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.core.proto.BaseOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getModelAsset())&&r.writeMessage(1,o,a.ExternalFile.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeBool(2,o),null!=(o=e.getAcceleration())&&r.writeMessage(3,o,i.Acceleration.serializeBinaryToWriter)},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.getModelAsset=function(){return t.Message.getWrapperField(this,a.ExternalFile,1)},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.setModelAsset=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.clearModelAsset=function(){return this.setModelAsset(void 0)},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.hasModelAsset=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.getUseStreamMode=function(){return t.Message.getBooleanFieldWithDefault(this,2,!1)},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.setUseStreamMode=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.clearUseStreamMode=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.hasUseStreamMode=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.getAcceleration=function(){return t.Message.getWrapperField(this,i.Acceleration,3)},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.setAcceleration=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.clearAcceleration=function(){return this.setAcceleration(void 0)},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.hasAcceleration=function(){return null!=t.Message.getField(this,3)},r.object.extend(e,proto.mediapipe.tasks.core.proto)}(base_options_pb);var face_detector_graph_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n),r.exportSymbol("proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions",null,o),proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.displayName="proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.toObject=function(e,r){var o,i={baseOptions:(o=r.getBaseOptions())&&n.BaseOptions.toObject(e,o),minDetectionConfidence:t.Message.getFloatingPointFieldWithDefault(r,2,.5),minSuppressionThreshold:t.Message.getFloatingPointFieldWithDefault(r,3,.5),numFaces:null==(o=t.Message.getField(r,4))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions;return proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=t.readFloat();e.setMinDetectionConfidence(r);break;case 3:r=t.readFloat();e.setMinSuppressionThreshold(r);break;case 4:r=t.readInt32();e.setNumFaces(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getBaseOptions())&&r.writeMessage(1,o,n.BaseOptions.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeFloat(2,o),null!=(o=t.Message.getField(e,3))&&r.writeFloat(3,o),null!=(o=t.Message.getField(e,4))&&r.writeInt32(4,o)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.ext=new t.ExtensionFieldInfo(502141897,{ext:0},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions,proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[502141897]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[502141897]=proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.ext,proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.getMinDetectionConfidence=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,.5)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.setMinDetectionConfidence=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.clearMinDetectionConfidence=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.hasMinDetectionConfidence=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.getMinSuppressionThreshold=function(){return t.Message.getFloatingPointFieldWithDefault(this,3,.5)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.setMinSuppressionThreshold=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.clearMinSuppressionThreshold=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.hasMinSuppressionThreshold=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.getNumFaces=function(){return t.Message.getFieldWithDefault(this,4,0)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.setNumFaces=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.clearNumFaces=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.hasNumFaces=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.ext=new t.ExtensionFieldInfo(502141897,{ext:0},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions,proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[502141897]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[502141897]=proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.face_detector.proto)}(face_detector_graph_options_pb);var detection_result={};Object.defineProperty(detection_result,"__esModule",{value:!0}),detection_result.convertFromDetectionProto=void 0;const DEFAULT_CATEGORY_INDEX=-1;function convertFromDetectionProto(e){var t,r,o,i,a,n,s,p,d,l,g,c,u;const m=e.getScoreList(),f=e.getLabelIdList(),h=e.getLabelList(),y=e.getDisplayNameList(),b={categories:[]};for(let e=0;e{i=i||"audio_header",this.wrapStringPtr(i,(i=>{this.wasmModule._configureAudio(o,i,e,t,r)}))}))}setAutoResizeCanvas(e){this.autoResizeCanvas=e}setAutoRenderToScreen(e){this.wasmModule._setAutoRenderToScreen(e)}bindTextureToStream(e,t){if(!this.wasmModule.canvas)throw new Error("No OpenGL canvas configured.");t?this.wasmModule._bindTextureToStream(t):console.assert(this.wasmModule._bindTextureToCanvas());const r=this.wasmModule.canvas.getContext("webgl2")||this.wasmModule.canvas.getContext("webgl");if(!r)throw new Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");let o,i;return r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,e),e.videoWidth?(o=e.videoWidth,i=e.videoHeight):e.naturalWidth?(o=e.naturalWidth,i=e.naturalHeight):(o=e.width,i=e.height),!this.autoResizeCanvas||o===this.wasmModule.canvas.width&&i===this.wasmModule.canvas.height||(this.wasmModule.canvas.width=o,this.wasmModule.canvas.height=i),[o,i]}processGl(e,t){const[r,o]=this.bindTextureToStream(e),i=this.wasmModule._malloc(16);this.wasmModule.HEAPU32[i/4]=r,this.wasmModule.HEAPU32[i/4+1]=o,this.wasmModule.HEAPF64[i/8+1]=t,this.wasmModule._processGl(i),this.wasmModule._free(i)}wrapStringPtr(e,t){this.hasMultiStreamSupport||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");const r=this.wasmModule.stringToNewUTF8(e);t(r),this.wasmModule._free(r)}wrapStringPtrPtr(e,t){this.hasMultiStreamSupport||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");const r=new Uint32Array(e.length);for(let t=0;t>2),t(o);for(const e of r)this.wasmModule._free(e);this.wasmModule._free(o)}getCalculatorGraphConfig(t,r){const o=e.CALCULATOR_GRAPH_CONFIG_LISTENER_NAME;this.setListener(o,(e=>{t(e)})),this.wrapStringPtr(o,(e=>{this.wasmModule._getGraphConfig(e,r)})),delete this.wasmModule.simpleListeners[o]}setListener(e,t){this.wasmModule.simpleListeners=this.wasmModule.simpleListeners||{},this.wasmModule.simpleListeners[e]=t}setVectorListener(e,t){let r=[];this.wasmModule.simpleListeners=this.wasmModule.simpleListeners||{},this.wasmModule.simpleListeners[e]=(e,o,i)=>{o?(t(r,i),r=[]):r.push(e)}}attachErrorListener(e){this.wasmModule.errorListener=e}attachEmptyPacketListener(e,t){this.wasmModule.emptyPacketListeners=this.wasmModule.emptyPacketListeners||{},this.wasmModule.emptyPacketListeners[e]=t}addAudioToStream(e,t,r){this.addAudioToStreamWithShape(e,0,0,t,r)}addAudioToStreamWithShape(e,t,r,o,i){const a=4*e.length;this.audioSize!==a&&(this.audioPtr&&this.wasmModule._free(this.audioPtr),this.audioPtr=this.wasmModule._malloc(a),this.audioSize=a),this.wasmModule.HEAPF32.set(e,this.audioPtr/4),this.wrapStringPtr(o,(e=>{this.wasmModule._addAudioToInputStream(this.audioPtr,t,r,e,i)}))}addGpuBufferToStream(e,t,r){this.wrapStringPtr(t,(t=>{const[o,i]=this.bindTextureToStream(e,t);this.wasmModule._addBoundTextureToStream(t,o,i,r)}))}addBoolToStream(e,t,r){this.wrapStringPtr(t,(t=>{this.wasmModule._addBoolToInputStream(e,t,r)}))}addDoubleToStream(e,t,r){this.wrapStringPtr(t,(t=>{this.wasmModule._addDoubleToInputStream(e,t,r)}))}addFloatToStream(e,t,r){this.wrapStringPtr(t,(t=>{this.wasmModule._addFloatToInputStream(e,t,r)}))}addIntToStream(e,t,r){this.wrapStringPtr(t,(t=>{this.wasmModule._addIntToInputStream(e,t,r)}))}addStringToStream(e,t,r){this.wrapStringPtr(t,(t=>{this.wrapStringPtr(e,(e=>{this.wasmModule._addStringToInputStream(e,t,r)}))}))}addStringRecordToStream(e,t,r){this.wrapStringPtr(t,(t=>{this.wrapStringPtrPtr(Object.keys(e),(o=>{this.wrapStringPtrPtr(Object.values(e),(i=>{this.wasmModule._addFlatHashMapToInputStream(o,i,Object.keys(e).length,t,r)}))}))}))}addProtoToStream(e,t,r,o){this.wrapStringPtr(r,(r=>{this.wrapStringPtr(t,(t=>{const i=this.wasmModule._malloc(e.length);this.wasmModule.HEAPU8.set(e,i),this.wasmModule._addProtoToInputStream(i,e.length,t,r,o),this.wasmModule._free(i)}))}))}addEmptyPacketToStream(e,t){this.wrapStringPtr(e,(e=>{this.wasmModule._addEmptyPacketToInputStream(e,t)}))}addBoolToInputSidePacket(e,t){this.wrapStringPtr(t,(t=>{this.wasmModule._addBoolToInputSidePacket(e,t)}))}addDoubleToInputSidePacket(e,t){this.wrapStringPtr(t,(t=>{this.wasmModule._addDoubleToInputSidePacket(e,t)}))}addFloatToInputSidePacket(e,t){this.wrapStringPtr(t,(t=>{this.wasmModule._addFloatToInputSidePacket(e,t)}))}addIntToInputSidePacket(e,t){this.wrapStringPtr(t,(t=>{this.wasmModule._addIntToInputSidePacket(e,t)}))}addStringToInputSidePacket(e,t){this.wrapStringPtr(t,(t=>{this.wrapStringPtr(e,(e=>{this.wasmModule._addStringToInputSidePacket(e,t)}))}))}addProtoToInputSidePacket(e,t,r){this.wrapStringPtr(r,(r=>{this.wrapStringPtr(t,(t=>{const o=this.wasmModule._malloc(e.length);this.wasmModule.HEAPU8.set(e,o),this.wasmModule._addProtoToInputSidePacket(o,e.length,t,r),this.wasmModule._free(o)}))}))}attachBoolListener(e,t){this.setListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmModule._attachBoolListener(e)}))}attachBoolVectorListener(e,t){this.setVectorListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmModule._attachBoolVectorListener(e)}))}attachIntListener(e,t){this.setListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmModule._attachIntListener(e)}))}attachIntVectorListener(e,t){this.setVectorListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmModule._attachIntVectorListener(e)}))}attachDoubleListener(e,t){this.setListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmModule._attachDoubleListener(e)}))}attachDoubleVectorListener(e,t){this.setVectorListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmModule._attachDoubleVectorListener(e)}))}attachFloatListener(e,t){this.setListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmModule._attachFloatListener(e)}))}attachFloatVectorListener(e,t){this.setVectorListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmModule._attachFloatVectorListener(e)}))}attachStringListener(e,t){this.setListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmModule._attachStringListener(e)}))}attachStringVectorListener(e,t){this.setVectorListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmModule._attachStringVectorListener(e)}))}attachProtoListener(e,t,r){this.setListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmModule._attachProtoListener(e,r||!1)}))}attachProtoVectorListener(e,t,r){this.setVectorListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmModule._attachProtoVectorListener(e,r||!1)}))}attachAudioListener(e,t,r){this.wasmModule._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),this.setListener(e,((e,r)=>{const o=new Float32Array(e.buffer,e.byteOffset,e.length/4);t(o,r)})),this.wrapStringPtr(e,(e=>{this.wasmModule._attachAudioListener(e,r||!1)}))}finishProcessing(){this.wasmModule._waitUntilIdle()}closeGraph(){this.wasmModule._closeGraph(),this.wasmModule.simpleListeners=void 0,this.wasmModule.emptyPacketListeners=void 0}}async function o(e){if("function"!=typeof importScripts){const t=document.createElement("script");return t.setAttribute("src",e),t.setAttribute("crossorigin","anonymous"),new Promise((e=>{t.addEventListener("load",(()=>{e()}),!1),t.addEventListener("error",(()=>{e()}),!1),document.body.appendChild(t)}))}importScripts(e.toString())}async function i(e,t,r,i,a){const n=[];if(t&&n.push(t),r&&n.push(r),n.length&&await Promise.all(n.map(o)),!self.ModuleFactory)throw new Error("ModuleFactory not set.");if(self.Module&&a){const e=self.Module;e.locateFile=a.locateFile,a.mainScriptUrlOrBlob&&(e.mainScriptUrlOrBlob=a.mainScriptUrlOrBlob)}const s=await self.ModuleFactory(self.Module||a);return self.ModuleFactory=self.Module=void 0,new e(s,i)}e.GraphRunner=r,e.createMediaPipeLib=i,e.createGraphRunner=async function(e,t,o,a){return i(r,e,t,o,a)}}(graph_runner);var register_model_resources_graph_service={};function SupportModelResourcesGraphService(e){return class extends e{registerModelResourcesGraphService(){this.wasmModule._registerModelResourcesGraphService()}}}Object.defineProperty(register_model_resources_graph_service,"__esModule",{value:!0}),register_model_resources_graph_service.SupportModelResourcesGraphService=void 0,register_model_resources_graph_service.SupportModelResourcesGraphService=SupportModelResourcesGraphService,Object.defineProperty(task_runner,"__esModule",{value:!0}),task_runner.TaskRunner=task_runner.createTaskRunner=task_runner.CachedGraphRunner=void 0;const inference_calculator_pb_1=inference_calculator_pb,calculator_pb_1=calculator_pb,acceleration_pb_1=acceleration_pb,external_file_pb_1=external_file_pb,graph_runner_1$1=graph_runner,register_model_resources_graph_service_1$1=register_model_resources_graph_service,NO_ASSETS=void 0,FREE_MEMORY_STREAM="free_memory",UNUSED_STREAM_SUFFIX="_unused_out",CachedGraphRunnerType=(0,register_model_resources_graph_service_1$1.SupportModelResourcesGraphService)(graph_runner_1$1.GraphRunner);class CachedGraphRunner extends CachedGraphRunnerType{}async function createTaskRunner(e,t,r,o){const i={locateFile:()=>r.wasmBinaryPath.toString()},a=await(0,graph_runner_1$1.createMediaPipeLib)(e,r.wasmLoaderPath,NO_ASSETS,t,i);return await a.setOptions(o),a}task_runner.CachedGraphRunner=CachedGraphRunner,task_runner.createTaskRunner=createTaskRunner;class TaskRunner{static async createInstance(e,t,r,o){return createTaskRunner(e,t,r,o)}constructor(e){this.graphRunner=e,this.processingErrors=[],this.latestOutputTimestamp=0,this.graphRunner.setAutoRenderToScreen(!1)}applyOptions(e){var t,r,o,i,a;const n=e.baseOptions||{};if((null===(t=e.baseOptions)||void 0===t?void 0:t.modelAssetBuffer)&&(null===(r=e.baseOptions)||void 0===r?void 0:r.modelAssetPath))throw new Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!((null===(o=this.baseOptions.getModelAsset())||void 0===o?void 0:o.hasFileContent())||(null===(i=e.baseOptions)||void 0===i?void 0:i.modelAssetBuffer)||(null===(a=e.baseOptions)||void 0===a?void 0:a.modelAssetPath)))throw new Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");return this.setAcceleration(n),n.modelAssetPath?fetch(n.modelAssetPath.toString()).then((e=>{if(e.ok)return e.arrayBuffer();throw new Error(`Failed to fetch model: ${n.modelAssetPath} (${e.status})`)})).then((e=>{this.setExternalFile(new Uint8Array(e)),this.refreshGraph(),this.onGraphRefreshed()})):(this.setExternalFile(n.modelAssetBuffer),this.refreshGraph(),this.onGraphRefreshed(),Promise.resolve())}onGraphRefreshed(){}getCalculatorGraphConfig(){let e;if(this.graphRunner.getCalculatorGraphConfig((t=>{e=calculator_pb_1.CalculatorGraphConfig.deserializeBinary(t)})),!e)throw new Error("Failed to retrieve CalculatorGraphConfig");return e}setGraph(e,t){this.graphRunner.attachErrorListener(((e,t)=>{this.processingErrors.push(new Error(t))})),this.graphRunner.registerModelResourcesGraphService(),this.graphRunner.setGraph(e,t),this.keepaliveNode=void 0,this.handleErrors()}finishProcessing(){this.graphRunner.finishProcessing(),this.handleErrors()}setLatestOutputTimestamp(e){this.latestOutputTimestamp=Math.max(this.latestOutputTimestamp,e)}getSynctheticTimestamp(){return this.latestOutputTimestamp+1}handleErrors(){try{const e=this.processingErrors.length;if(1===e)throw new Error(this.processingErrors[0].message);if(e>1)throw new Error("Encountered multiple errors: "+this.processingErrors.map((e=>e.message)).join(", "))}finally{this.processingErrors=[]}}setExternalFile(e){const t=this.baseOptions.getModelAsset()||new external_file_pb_1.ExternalFile;e&&t.setFileContent(e),this.baseOptions.setModelAsset(t)}setAcceleration(e){let t=this.baseOptions.getAcceleration();t||(t=new acceleration_pb_1.Acceleration,t.setTflite(new inference_calculator_pb_1.InferenceCalculatorOptions.Delegate.TfLite)),"delegate"in e&&("GPU"===e.delegate?t.setGpu(new inference_calculator_pb_1.InferenceCalculatorOptions.Delegate.Gpu):t.setTflite(new inference_calculator_pb_1.InferenceCalculatorOptions.Delegate.TfLite)),this.baseOptions.setAcceleration(t)}addKeepaliveNode(e){this.keepaliveNode=new calculator_pb_1.CalculatorGraphConfig.Node,this.keepaliveNode.setCalculator("PassThroughCalculator"),this.keepaliveNode.addInputStream(FREE_MEMORY_STREAM),this.keepaliveNode.addOutputStream(FREE_MEMORY_STREAM+UNUSED_STREAM_SUFFIX),e.addInputStream(FREE_MEMORY_STREAM),e.addNode(this.keepaliveNode)}keepStreamAlive(e){this.keepaliveNode.addInputStream(e),this.keepaliveNode.addOutputStream(e+UNUSED_STREAM_SUFFIX)}freeKeepaliveStreams(){this.graphRunner.addBoolToStream(!0,FREE_MEMORY_STREAM,this.latestOutputTimestamp)}close(){this.keepaliveNode=void 0,this.graphRunner.closeGraph()}}task_runner.TaskRunner=TaskRunner;var graph_runner_image_lib={};function SupportImage(e){return class extends e{get wasmImageModule(){return this.wasmModule}addGpuBufferAsImageToStream(e,t,r){this.wrapStringPtr(t,(t=>{const[o,i]=this.bindTextureToStream(e,t);this.wasmImageModule._addBoundTextureAsImageToStream(t,o,i,r)}))}attachImageListener(e,t){this.setListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmImageModule._attachImageListener(e)}))}attachImageVectorListener(e,t){this.setVectorListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmImageModule._attachImageVectorListener(e)}))}}}Object.defineProperty(graph_runner_image_lib,"__esModule",{value:!0}),graph_runner_image_lib.SupportImage=void 0,graph_runner_image_lib.SupportImage=SupportImage,Object.defineProperty(vision_task_runner,"__esModule",{value:!0}),vision_task_runner.VisionTaskRunner=vision_task_runner.VisionGraphRunner=void 0;const rect_pb_1=rect_pb,task_runner_1=task_runner,image_1$1=image,image_shader_context_1=image_shader_context,mask_1$1=mask,graph_runner_1=graph_runner,graph_runner_image_lib_1=graph_runner_image_lib,platform_utils_1=platform_utils,register_model_resources_graph_service_1=register_model_resources_graph_service,GraphRunnerVisionType=(0,register_model_resources_graph_service_1.SupportModelResourcesGraphService)((0,graph_runner_image_lib_1.SupportImage)(graph_runner_1.GraphRunner));class VisionGraphRunner extends GraphRunnerVisionType{}function createCanvas(){return"undefined"!=typeof OffscreenCanvas&&!(0,platform_utils_1.isWebKit)()?void 0:document.createElement("canvas")}vision_task_runner.VisionGraphRunner=VisionGraphRunner;class VisionTaskRunner extends task_runner_1.TaskRunner{static async createVisionInstance(e,t,r){var o;const i=null!==(o=r.canvas)&&void 0!==o?o:createCanvas();return task_runner_1.TaskRunner.createInstance(e,i,t,r)}constructor(e,t,r,o){super(e),this.graphRunner=e,this.imageStreamName=t,this.normRectStreamName=r,this.roiAllowed=o,this.shaderContext=new image_shader_context_1.MPImageShaderContext}applyOptions(e){if("runningMode"in e){const t=!!e.runningMode&&"IMAGE"!==e.runningMode;this.baseOptions.setUseStreamMode(t)}if(void 0!==e.canvas&&this.graphRunner.wasmModule.canvas!==e.canvas)throw new Error("You must create a new task to reset the canvas.");return super.applyOptions(e)}processImageData(e,t){var r;if(null===(r=this.baseOptions)||void 0===r?void 0:r.getUseStreamMode())throw new Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");this.process(e,t,this.getSynctheticTimestamp())}processVideoData(e,t,r){var o;if(!(null===(o=this.baseOptions)||void 0===o?void 0:o.getUseStreamMode()))throw new Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");this.process(e,t,r)}getImageSourceSize(e){return void 0!==e.videoWidth?[e.videoWidth,e.videoHeight]:void 0!==e.naturalWidth?[e.naturalWidth,e.naturalHeight]:[e.width,e.height]}convertToNormalizedRect(e,t){const r=new rect_pb_1.NormalizedRect;if(null==t?void 0:t.regionOfInterest){if(!this.roiAllowed)throw new Error("This task doesn't support region-of-interest.");const e=t.regionOfInterest;if(e.left>=e.right||e.top>=e.bottom)throw new Error("Expected RectF with left < right and top < bottom.");if(e.left<0||e.top<0||e.right>1||e.bottom>1)throw new Error("Expected RectF values to be in [0,1].");r.setXCenter((e.left+e.right)/2),r.setYCenter((e.top+e.bottom)/2),r.setWidth(e.right-e.left),r.setHeight(e.bottom-e.top)}else r.setXCenter(.5),r.setYCenter(.5),r.setWidth(1),r.setHeight(1);if(null==t?void 0:t.rotationDegrees){if((null==t?void 0:t.rotationDegrees)%90!=0)throw new Error("Expected rotation to be a multiple of 90°.");if(r.setRotation(-Math.PI*t.rotationDegrees/180),(null==t?void 0:t.rotationDegrees)%180!=0){const[t,o]=this.getImageSourceSize(e),i=r.getHeight()*o/t,a=r.getWidth()*t/o;r.setWidth(i),r.setHeight(a)}}return r}process(e,t,r){const o=this.convertToNormalizedRect(e,t);this.graphRunner.addProtoToStream(o.serializeBinary(),"mediapipe.NormalizedRect",this.normRectStreamName,r),this.graphRunner.addGpuBufferAsImageToStream(e,this.imageStreamName,null!=r?r:performance.now()),this.finishProcessing()}convertToMPImage(e,t){const{data:r,width:o,height:i}=e,a=o*i;let n;if(r instanceof Uint8Array)if(r.length===3*a){const e=new Uint8ClampedArray(4*a);for(let t=0;t{this.addJsFaceDetections(e),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(c,(e=>{this.setLatestOutputTimestamp(e)}));const a=e.serializeBinary();this.setGraph(new Uint8Array(a),!0)}}e.FaceDetector=u}(face_detector);var face_landmarker={},classification_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.Classification",null,o),r.exportSymbol("proto.mediapipe.ClassificationList",null,o),r.exportSymbol("proto.mediapipe.ClassificationListCollection",null,o),proto.mediapipe.Classification=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.Classification,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.Classification.displayName="proto.mediapipe.Classification"),proto.mediapipe.ClassificationList=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.ClassificationList.repeatedFields_,null)},r.inherits(proto.mediapipe.ClassificationList,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.ClassificationList.displayName="proto.mediapipe.ClassificationList"),proto.mediapipe.ClassificationListCollection=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.ClassificationListCollection.repeatedFields_,null)},r.inherits(proto.mediapipe.ClassificationListCollection,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.ClassificationListCollection.displayName="proto.mediapipe.ClassificationListCollection"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.Classification.prototype.toObject=function(e){return proto.mediapipe.Classification.toObject(e,this)},proto.mediapipe.Classification.toObject=function(e,r){var o,i={index:null==(o=t.Message.getField(r,1))?void 0:o,score:null==(o=t.Message.getOptionalFloatingPointField(r,2))?void 0:o,label:null==(o=t.Message.getField(r,3))?void 0:o,displayName:null==(o=t.Message.getField(r,4))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.Classification.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.Classification;return proto.mediapipe.Classification.deserializeBinaryFromReader(o,r)},proto.mediapipe.Classification.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readInt32();e.setIndex(r);break;case 2:r=t.readFloat();e.setScore(r);break;case 3:r=t.readString();e.setLabel(r);break;case 4:r=t.readString();e.setDisplayName(r);break;default:t.skipField()}}return e},proto.mediapipe.Classification.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.Classification.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.Classification.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeInt32(1,o),null!=(o=t.Message.getField(e,2))&&r.writeFloat(2,o),null!=(o=t.Message.getField(e,3))&&r.writeString(3,o),null!=(o=t.Message.getField(e,4))&&r.writeString(4,o)},proto.mediapipe.Classification.prototype.getIndex=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.Classification.prototype.setIndex=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.Classification.prototype.clearIndex=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.Classification.prototype.hasIndex=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.Classification.prototype.getScore=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,0)},proto.mediapipe.Classification.prototype.setScore=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.Classification.prototype.clearScore=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.Classification.prototype.hasScore=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.Classification.prototype.getLabel=function(){return t.Message.getFieldWithDefault(this,3,"")},proto.mediapipe.Classification.prototype.setLabel=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.Classification.prototype.clearLabel=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.Classification.prototype.hasLabel=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.Classification.prototype.getDisplayName=function(){return t.Message.getFieldWithDefault(this,4,"")},proto.mediapipe.Classification.prototype.setDisplayName=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.Classification.prototype.clearDisplayName=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.Classification.prototype.hasDisplayName=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.ClassificationList.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.ClassificationList.prototype.toObject=function(e){return proto.mediapipe.ClassificationList.toObject(e,this)},proto.mediapipe.ClassificationList.toObject=function(e,r){var o={classificationList:t.Message.toObjectList(r.getClassificationList(),proto.mediapipe.Classification.toObject,e)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.ClassificationList.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.ClassificationList;return proto.mediapipe.ClassificationList.deserializeBinaryFromReader(o,r)},proto.mediapipe.ClassificationList.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new proto.mediapipe.Classification;t.readMessage(r,proto.mediapipe.Classification.deserializeBinaryFromReader),e.addClassification(r)}else t.skipField()}return e},proto.mediapipe.ClassificationList.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.ClassificationList.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.ClassificationList.serializeBinaryToWriter=function(e,t){var r;(r=e.getClassificationList()).length>0&&t.writeRepeatedMessage(1,r,proto.mediapipe.Classification.serializeBinaryToWriter)},proto.mediapipe.ClassificationList.prototype.getClassificationList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.Classification,1)},proto.mediapipe.ClassificationList.prototype.setClassificationList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.ClassificationList.prototype.addClassification=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.Classification,r)},proto.mediapipe.ClassificationList.prototype.clearClassificationList=function(){return this.setClassificationList([])},proto.mediapipe.ClassificationListCollection.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.ClassificationListCollection.prototype.toObject=function(e){return proto.mediapipe.ClassificationListCollection.toObject(e,this)},proto.mediapipe.ClassificationListCollection.toObject=function(e,r){var o={classificationListList:t.Message.toObjectList(r.getClassificationListList(),proto.mediapipe.ClassificationList.toObject,e)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.ClassificationListCollection.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.ClassificationListCollection;return proto.mediapipe.ClassificationListCollection.deserializeBinaryFromReader(o,r)},proto.mediapipe.ClassificationListCollection.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new proto.mediapipe.ClassificationList;t.readMessage(r,proto.mediapipe.ClassificationList.deserializeBinaryFromReader),e.addClassificationList(r)}else t.skipField()}return e},proto.mediapipe.ClassificationListCollection.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.ClassificationListCollection.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.ClassificationListCollection.serializeBinaryToWriter=function(e,t){var r;(r=e.getClassificationListList()).length>0&&t.writeRepeatedMessage(1,r,proto.mediapipe.ClassificationList.serializeBinaryToWriter)},proto.mediapipe.ClassificationListCollection.prototype.getClassificationListList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.ClassificationList,1)},proto.mediapipe.ClassificationListCollection.prototype.setClassificationListList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.ClassificationListCollection.prototype.addClassificationList=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.ClassificationList,r)},proto.mediapipe.ClassificationListCollection.prototype.clearClassificationListList=function(){return this.setClassificationListList([])},r.object.extend(e,proto.mediapipe)}(classification_pb);var landmark_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.Landmark",null,o),r.exportSymbol("proto.mediapipe.LandmarkList",null,o),r.exportSymbol("proto.mediapipe.LandmarkListCollection",null,o),r.exportSymbol("proto.mediapipe.NormalizedLandmark",null,o),r.exportSymbol("proto.mediapipe.NormalizedLandmarkList",null,o),r.exportSymbol("proto.mediapipe.NormalizedLandmarkListCollection",null,o),proto.mediapipe.Landmark=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.Landmark,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.Landmark.displayName="proto.mediapipe.Landmark"),proto.mediapipe.LandmarkList=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.LandmarkList.repeatedFields_,null)},r.inherits(proto.mediapipe.LandmarkList,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.LandmarkList.displayName="proto.mediapipe.LandmarkList"),proto.mediapipe.LandmarkListCollection=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.LandmarkListCollection.repeatedFields_,null)},r.inherits(proto.mediapipe.LandmarkListCollection,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.LandmarkListCollection.displayName="proto.mediapipe.LandmarkListCollection"),proto.mediapipe.NormalizedLandmark=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.NormalizedLandmark,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.NormalizedLandmark.displayName="proto.mediapipe.NormalizedLandmark"),proto.mediapipe.NormalizedLandmarkList=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.NormalizedLandmarkList.repeatedFields_,null)},r.inherits(proto.mediapipe.NormalizedLandmarkList,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.NormalizedLandmarkList.displayName="proto.mediapipe.NormalizedLandmarkList"),proto.mediapipe.NormalizedLandmarkListCollection=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.NormalizedLandmarkListCollection.repeatedFields_,null)},r.inherits(proto.mediapipe.NormalizedLandmarkListCollection,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.NormalizedLandmarkListCollection.displayName="proto.mediapipe.NormalizedLandmarkListCollection"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.Landmark.prototype.toObject=function(e){return proto.mediapipe.Landmark.toObject(e,this)},proto.mediapipe.Landmark.toObject=function(e,r){var o,i={x:null==(o=t.Message.getOptionalFloatingPointField(r,1))?void 0:o,y:null==(o=t.Message.getOptionalFloatingPointField(r,2))?void 0:o,z:null==(o=t.Message.getOptionalFloatingPointField(r,3))?void 0:o,visibility:null==(o=t.Message.getOptionalFloatingPointField(r,4))?void 0:o,presence:null==(o=t.Message.getOptionalFloatingPointField(r,5))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.Landmark.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.Landmark;return proto.mediapipe.Landmark.deserializeBinaryFromReader(o,r)},proto.mediapipe.Landmark.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readFloat();e.setX(r);break;case 2:r=t.readFloat();e.setY(r);break;case 3:r=t.readFloat();e.setZ(r);break;case 4:r=t.readFloat();e.setVisibility(r);break;case 5:r=t.readFloat();e.setPresence(r);break;default:t.skipField()}}return e},proto.mediapipe.Landmark.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.Landmark.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.Landmark.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeFloat(1,o),null!=(o=t.Message.getField(e,2))&&r.writeFloat(2,o),null!=(o=t.Message.getField(e,3))&&r.writeFloat(3,o),null!=(o=t.Message.getField(e,4))&&r.writeFloat(4,o),null!=(o=t.Message.getField(e,5))&&r.writeFloat(5,o)},proto.mediapipe.Landmark.prototype.getX=function(){return t.Message.getFloatingPointFieldWithDefault(this,1,0)},proto.mediapipe.Landmark.prototype.setX=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.Landmark.prototype.clearX=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.Landmark.prototype.hasX=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.Landmark.prototype.getY=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,0)},proto.mediapipe.Landmark.prototype.setY=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.Landmark.prototype.clearY=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.Landmark.prototype.hasY=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.Landmark.prototype.getZ=function(){return t.Message.getFloatingPointFieldWithDefault(this,3,0)},proto.mediapipe.Landmark.prototype.setZ=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.Landmark.prototype.clearZ=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.Landmark.prototype.hasZ=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.Landmark.prototype.getVisibility=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,0)},proto.mediapipe.Landmark.prototype.setVisibility=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.Landmark.prototype.clearVisibility=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.Landmark.prototype.hasVisibility=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.Landmark.prototype.getPresence=function(){return t.Message.getFloatingPointFieldWithDefault(this,5,0)},proto.mediapipe.Landmark.prototype.setPresence=function(e){return t.Message.setField(this,5,e)},proto.mediapipe.Landmark.prototype.clearPresence=function(){return t.Message.setField(this,5,void 0)},proto.mediapipe.Landmark.prototype.hasPresence=function(){return null!=t.Message.getField(this,5)},proto.mediapipe.LandmarkList.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.LandmarkList.prototype.toObject=function(e){return proto.mediapipe.LandmarkList.toObject(e,this)},proto.mediapipe.LandmarkList.toObject=function(e,r){var o={landmarkList:t.Message.toObjectList(r.getLandmarkList(),proto.mediapipe.Landmark.toObject,e)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.LandmarkList.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.LandmarkList;return proto.mediapipe.LandmarkList.deserializeBinaryFromReader(o,r)},proto.mediapipe.LandmarkList.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new proto.mediapipe.Landmark;t.readMessage(r,proto.mediapipe.Landmark.deserializeBinaryFromReader),e.addLandmark(r)}else t.skipField()}return e},proto.mediapipe.LandmarkList.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.LandmarkList.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.LandmarkList.serializeBinaryToWriter=function(e,t){var r;(r=e.getLandmarkList()).length>0&&t.writeRepeatedMessage(1,r,proto.mediapipe.Landmark.serializeBinaryToWriter)},proto.mediapipe.LandmarkList.prototype.getLandmarkList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.Landmark,1)},proto.mediapipe.LandmarkList.prototype.setLandmarkList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.LandmarkList.prototype.addLandmark=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.Landmark,r)},proto.mediapipe.LandmarkList.prototype.clearLandmarkList=function(){return this.setLandmarkList([])},proto.mediapipe.LandmarkListCollection.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.LandmarkListCollection.prototype.toObject=function(e){return proto.mediapipe.LandmarkListCollection.toObject(e,this)},proto.mediapipe.LandmarkListCollection.toObject=function(e,r){var o={landmarkListList:t.Message.toObjectList(r.getLandmarkListList(),proto.mediapipe.LandmarkList.toObject,e)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.LandmarkListCollection.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.LandmarkListCollection;return proto.mediapipe.LandmarkListCollection.deserializeBinaryFromReader(o,r)},proto.mediapipe.LandmarkListCollection.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new proto.mediapipe.LandmarkList;t.readMessage(r,proto.mediapipe.LandmarkList.deserializeBinaryFromReader),e.addLandmarkList(r)}else t.skipField()}return e},proto.mediapipe.LandmarkListCollection.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.LandmarkListCollection.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.LandmarkListCollection.serializeBinaryToWriter=function(e,t){var r;(r=e.getLandmarkListList()).length>0&&t.writeRepeatedMessage(1,r,proto.mediapipe.LandmarkList.serializeBinaryToWriter)},proto.mediapipe.LandmarkListCollection.prototype.getLandmarkListList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.LandmarkList,1)},proto.mediapipe.LandmarkListCollection.prototype.setLandmarkListList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.LandmarkListCollection.prototype.addLandmarkList=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.LandmarkList,r)},proto.mediapipe.LandmarkListCollection.prototype.clearLandmarkListList=function(){return this.setLandmarkListList([])},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.NormalizedLandmark.prototype.toObject=function(e){return proto.mediapipe.NormalizedLandmark.toObject(e,this)},proto.mediapipe.NormalizedLandmark.toObject=function(e,r){var o,i={x:null==(o=t.Message.getOptionalFloatingPointField(r,1))?void 0:o,y:null==(o=t.Message.getOptionalFloatingPointField(r,2))?void 0:o,z:null==(o=t.Message.getOptionalFloatingPointField(r,3))?void 0:o,visibility:null==(o=t.Message.getOptionalFloatingPointField(r,4))?void 0:o,presence:null==(o=t.Message.getOptionalFloatingPointField(r,5))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.NormalizedLandmark.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.NormalizedLandmark;return proto.mediapipe.NormalizedLandmark.deserializeBinaryFromReader(o,r)},proto.mediapipe.NormalizedLandmark.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readFloat();e.setX(r);break;case 2:r=t.readFloat();e.setY(r);break;case 3:r=t.readFloat();e.setZ(r);break;case 4:r=t.readFloat();e.setVisibility(r);break;case 5:r=t.readFloat();e.setPresence(r);break;default:t.skipField()}}return e},proto.mediapipe.NormalizedLandmark.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.NormalizedLandmark.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.NormalizedLandmark.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeFloat(1,o),null!=(o=t.Message.getField(e,2))&&r.writeFloat(2,o),null!=(o=t.Message.getField(e,3))&&r.writeFloat(3,o),null!=(o=t.Message.getField(e,4))&&r.writeFloat(4,o),null!=(o=t.Message.getField(e,5))&&r.writeFloat(5,o)},proto.mediapipe.NormalizedLandmark.prototype.getX=function(){return t.Message.getFloatingPointFieldWithDefault(this,1,0)},proto.mediapipe.NormalizedLandmark.prototype.setX=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.NormalizedLandmark.prototype.clearX=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.NormalizedLandmark.prototype.hasX=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.NormalizedLandmark.prototype.getY=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,0)},proto.mediapipe.NormalizedLandmark.prototype.setY=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.NormalizedLandmark.prototype.clearY=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.NormalizedLandmark.prototype.hasY=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.NormalizedLandmark.prototype.getZ=function(){return t.Message.getFloatingPointFieldWithDefault(this,3,0)},proto.mediapipe.NormalizedLandmark.prototype.setZ=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.NormalizedLandmark.prototype.clearZ=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.NormalizedLandmark.prototype.hasZ=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.NormalizedLandmark.prototype.getVisibility=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,0)},proto.mediapipe.NormalizedLandmark.prototype.setVisibility=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.NormalizedLandmark.prototype.clearVisibility=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.NormalizedLandmark.prototype.hasVisibility=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.NormalizedLandmark.prototype.getPresence=function(){return t.Message.getFloatingPointFieldWithDefault(this,5,0)},proto.mediapipe.NormalizedLandmark.prototype.setPresence=function(e){return t.Message.setField(this,5,e)},proto.mediapipe.NormalizedLandmark.prototype.clearPresence=function(){return t.Message.setField(this,5,void 0)},proto.mediapipe.NormalizedLandmark.prototype.hasPresence=function(){return null!=t.Message.getField(this,5)},proto.mediapipe.NormalizedLandmarkList.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.NormalizedLandmarkList.prototype.toObject=function(e){return proto.mediapipe.NormalizedLandmarkList.toObject(e,this)},proto.mediapipe.NormalizedLandmarkList.toObject=function(e,r){var o={landmarkList:t.Message.toObjectList(r.getLandmarkList(),proto.mediapipe.NormalizedLandmark.toObject,e)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.NormalizedLandmarkList.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.NormalizedLandmarkList;return proto.mediapipe.NormalizedLandmarkList.deserializeBinaryFromReader(o,r)},proto.mediapipe.NormalizedLandmarkList.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new proto.mediapipe.NormalizedLandmark;t.readMessage(r,proto.mediapipe.NormalizedLandmark.deserializeBinaryFromReader),e.addLandmark(r)}else t.skipField()}return e},proto.mediapipe.NormalizedLandmarkList.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.NormalizedLandmarkList.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.NormalizedLandmarkList.serializeBinaryToWriter=function(e,t){var r;(r=e.getLandmarkList()).length>0&&t.writeRepeatedMessage(1,r,proto.mediapipe.NormalizedLandmark.serializeBinaryToWriter)},proto.mediapipe.NormalizedLandmarkList.prototype.getLandmarkList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.NormalizedLandmark,1)},proto.mediapipe.NormalizedLandmarkList.prototype.setLandmarkList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.NormalizedLandmarkList.prototype.addLandmark=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.NormalizedLandmark,r)},proto.mediapipe.NormalizedLandmarkList.prototype.clearLandmarkList=function(){return this.setLandmarkList([])},proto.mediapipe.NormalizedLandmarkListCollection.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.NormalizedLandmarkListCollection.prototype.toObject=function(e){return proto.mediapipe.NormalizedLandmarkListCollection.toObject(e,this)},proto.mediapipe.NormalizedLandmarkListCollection.toObject=function(e,r){var o={landmarkListList:t.Message.toObjectList(r.getLandmarkListList(),proto.mediapipe.NormalizedLandmarkList.toObject,e)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.NormalizedLandmarkListCollection.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.NormalizedLandmarkListCollection;return proto.mediapipe.NormalizedLandmarkListCollection.deserializeBinaryFromReader(o,r)},proto.mediapipe.NormalizedLandmarkListCollection.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new proto.mediapipe.NormalizedLandmarkList;t.readMessage(r,proto.mediapipe.NormalizedLandmarkList.deserializeBinaryFromReader),e.addLandmarkList(r)}else t.skipField()}return e},proto.mediapipe.NormalizedLandmarkListCollection.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.NormalizedLandmarkListCollection.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.NormalizedLandmarkListCollection.serializeBinaryToWriter=function(e,t){var r;(r=e.getLandmarkListList()).length>0&&t.writeRepeatedMessage(1,r,proto.mediapipe.NormalizedLandmarkList.serializeBinaryToWriter)},proto.mediapipe.NormalizedLandmarkListCollection.prototype.getLandmarkListList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.NormalizedLandmarkList,1)},proto.mediapipe.NormalizedLandmarkListCollection.prototype.setLandmarkListList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.NormalizedLandmarkListCollection.prototype.addLandmarkList=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.NormalizedLandmarkList,r)},proto.mediapipe.NormalizedLandmarkListCollection.prototype.clearLandmarkListList=function(){return this.setLandmarkListList([])},r.object.extend(e,proto.mediapipe)}(landmark_pb);var face_geometry_pb={},matrix_data_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.MatrixData",null,o),r.exportSymbol("proto.mediapipe.MatrixData.Layout",null,o),proto.mediapipe.MatrixData=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.MatrixData.repeatedFields_,null)},r.inherits(proto.mediapipe.MatrixData,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.MatrixData.displayName="proto.mediapipe.MatrixData"),proto.mediapipe.MatrixData.repeatedFields_=[3],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.MatrixData.prototype.toObject=function(e){return proto.mediapipe.MatrixData.toObject(e,this)},proto.mediapipe.MatrixData.toObject=function(e,r){var o,i={rows:null==(o=t.Message.getField(r,1))?void 0:o,cols:null==(o=t.Message.getField(r,2))?void 0:o,packedDataList:null==(o=t.Message.getRepeatedFloatingPointField(r,3))?void 0:o,layout:t.Message.getFieldWithDefault(r,4,0)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.MatrixData.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.MatrixData;return proto.mediapipe.MatrixData.deserializeBinaryFromReader(o,r)},proto.mediapipe.MatrixData.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readInt32();e.setRows(r);break;case 2:r=t.readInt32();e.setCols(r);break;case 3:for(var o=t.isDelimited()?t.readPackedFloat():[t.readFloat()],i=0;i0&&r.writePackedFloat(3,o),null!=(o=t.Message.getField(e,4))&&r.writeEnum(4,o)},proto.mediapipe.MatrixData.Layout={COLUMN_MAJOR:0,ROW_MAJOR:1},proto.mediapipe.MatrixData.prototype.getRows=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.MatrixData.prototype.setRows=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.MatrixData.prototype.clearRows=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.MatrixData.prototype.hasRows=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.MatrixData.prototype.getCols=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.MatrixData.prototype.setCols=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.MatrixData.prototype.clearCols=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.MatrixData.prototype.hasCols=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.MatrixData.prototype.getPackedDataList=function(){return t.Message.getRepeatedFloatingPointField(this,3)},proto.mediapipe.MatrixData.prototype.setPackedDataList=function(e){return t.Message.setField(this,3,e||[])},proto.mediapipe.MatrixData.prototype.addPackedData=function(e,r){return t.Message.addToRepeatedField(this,3,e,r)},proto.mediapipe.MatrixData.prototype.clearPackedDataList=function(){return this.setPackedDataList([])},proto.mediapipe.MatrixData.prototype.getLayout=function(){return t.Message.getFieldWithDefault(this,4,0)},proto.mediapipe.MatrixData.prototype.setLayout=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.MatrixData.prototype.clearLayout=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.MatrixData.prototype.hasLayout=function(){return null!=t.Message.getField(this,4)},r.object.extend(e,proto.mediapipe)}(matrix_data_pb);var mesh_3d_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d",null,o),r.exportSymbol("proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.PrimitiveType",null,o),r.exportSymbol("proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.VertexType",null,o),proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.repeatedFields_,null)},r.inherits(proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.displayName="proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d"),proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.repeatedFields_=[3,4],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.toObject(e,this)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.toObject=function(e,r){var o,i={vertexType:null==(o=t.Message.getField(r,1))?void 0:o,primitiveType:null==(o=t.Message.getField(r,2))?void 0:o,vertexBufferList:null==(o=t.Message.getRepeatedFloatingPointField(r,3))?void 0:o,indexBufferList:null==(o=t.Message.getRepeatedField(r,4))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d;return proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readEnum();e.setVertexType(r);break;case 2:r=t.readEnum();e.setPrimitiveType(r);break;case 3:for(var o=t.isDelimited()?t.readPackedFloat():[t.readFloat()],i=0;i0&&r.writeRepeatedFloat(3,o),(o=e.getIndexBufferList()).length>0&&r.writeRepeatedUint32(4,o)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.VertexType={VERTEX_PT:0},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.PrimitiveType={TRIANGLE:0},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.getVertexType=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.setVertexType=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.clearVertexType=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.hasVertexType=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.getPrimitiveType=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.setPrimitiveType=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.clearPrimitiveType=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.hasPrimitiveType=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.getVertexBufferList=function(){return t.Message.getRepeatedFloatingPointField(this,3)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.setVertexBufferList=function(e){return t.Message.setField(this,3,e||[])},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.addVertexBuffer=function(e,r){return t.Message.addToRepeatedField(this,3,e,r)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.clearVertexBufferList=function(){return this.setVertexBufferList([])},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.getIndexBufferList=function(){return t.Message.getRepeatedField(this,4)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.setIndexBufferList=function(e){return t.Message.setField(this,4,e||[])},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.addIndexBuffer=function(e,r){return t.Message.addToRepeatedField(this,4,e,r)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.clearIndexBufferList=function(){return this.setIndexBufferList([])},r.object.extend(e,proto.mediapipe.tasks.vision.face_geometry.proto)}(mesh_3d_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=matrix_data_pb;r.object.extend(proto,i);var a=mesh_3d_pb;r.object.extend(proto,a),r.exportSymbol("proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry",null,o),proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.displayName="proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.toObject(e,this)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.toObject=function(e,t){var r,o={mesh:(r=t.getMesh())&&a.Mesh3d.toObject(e,r),poseTransformMatrix:(r=t.getPoseTransformMatrix())&&i.MatrixData.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry;return proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new a.Mesh3d;t.readMessage(r,a.Mesh3d.deserializeBinaryFromReader),e.setMesh(r);break;case 2:r=new i.MatrixData;t.readMessage(r,i.MatrixData.deserializeBinaryFromReader),e.setPoseTransformMatrix(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.serializeBinaryToWriter=function(e,t){var r=void 0;null!=(r=e.getMesh())&&t.writeMessage(1,r,a.Mesh3d.serializeBinaryToWriter),null!=(r=e.getPoseTransformMatrix())&&t.writeMessage(2,r,i.MatrixData.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.prototype.getMesh=function(){return t.Message.getWrapperField(this,a.Mesh3d,1)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.prototype.setMesh=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.prototype.clearMesh=function(){return this.setMesh(void 0)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.prototype.hasMesh=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.prototype.getPoseTransformMatrix=function(){return t.Message.getWrapperField(this,i.MatrixData,2)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.prototype.setPoseTransformMatrix=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.prototype.clearPoseTransformMatrix=function(){return this.setPoseTransformMatrix(void 0)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.prototype.hasPoseTransformMatrix=function(){return null!=t.Message.getField(this,2)},r.object.extend(e,proto.mediapipe.tasks.vision.face_geometry.proto)}(face_geometry_pb);var face_landmarker_graph_options_pb={},face_geometry_graph_options_pb={},geometry_pipeline_calculator_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_options_pb;r.object.extend(proto,i);var a=external_file_pb;r.object.extend(proto,a),r.exportSymbol("proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions",null,o),proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.displayName="proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.toObject(e,this)},proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.toObject=function(e,t){var r,o={metadataFile:(r=t.getMetadataFile())&&a.ExternalFile.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions;return proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new a.ExternalFile;t.readMessage(r,a.ExternalFile.deserializeBinaryFromReader),e.setMetadataFile(r)}else t.skipField()}return e},proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.serializeBinaryToWriter=function(e,t){var r;null!=(r=e.getMetadataFile())&&t.writeMessage(1,r,a.ExternalFile.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.ext=new t.ExtensionFieldInfo(512499200,{ext:0},proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions,proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.toObject,0),i.CalculatorOptions.extensionsBinary[512499200]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.deserializeBinaryFromReader,!1),i.CalculatorOptions.extensions[512499200]=proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.ext,proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.prototype.getMetadataFile=function(){return t.Message.getWrapperField(this,a.ExternalFile,1)},proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.prototype.setMetadataFile=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.prototype.clearMetadataFile=function(){return this.setMetadataFile(void 0)},proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.prototype.hasMetadataFile=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.ext=new t.ExtensionFieldInfo(512499200,{ext:0},proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions,proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.toObject,0),i.CalculatorOptions.extensionsBinary[512499200]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.deserializeBinaryFromReader,!1),i.CalculatorOptions.extensions[512499200]=proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.face_geometry)}(geometry_pipeline_calculator_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_options_pb;r.object.extend(proto,i);var a=geometry_pipeline_calculator_pb;r.object.extend(proto,a),r.exportSymbol("proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions",null,o),proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.displayName="proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.toObject=function(e,t){var r,o={geometryPipelineOptions:(r=t.getGeometryPipelineOptions())&&a.FaceGeometryPipelineCalculatorOptions.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions;return proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new a.FaceGeometryPipelineCalculatorOptions;t.readMessage(r,a.FaceGeometryPipelineCalculatorOptions.deserializeBinaryFromReader),e.setGeometryPipelineOptions(r)}else t.skipField()}return e},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.serializeBinaryToWriter=function(e,t){var r;null!=(r=e.getGeometryPipelineOptions())&&t.writeMessage(1,r,a.FaceGeometryPipelineCalculatorOptions.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.ext=new t.ExtensionFieldInfo(515723506,{ext:0},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions,proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.toObject,0),i.CalculatorOptions.extensionsBinary[515723506]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.deserializeBinaryFromReader,!1),i.CalculatorOptions.extensions[515723506]=proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.ext,proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.prototype.getGeometryPipelineOptions=function(){return t.Message.getWrapperField(this,a.FaceGeometryPipelineCalculatorOptions,1)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.prototype.setGeometryPipelineOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.prototype.clearGeometryPipelineOptions=function(){return this.setGeometryPipelineOptions(void 0)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.prototype.hasGeometryPipelineOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.ext=new t.ExtensionFieldInfo(515723506,{ext:0},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions,proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.toObject,0),i.CalculatorOptions.extensionsBinary[515723506]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.deserializeBinaryFromReader,!1),i.CalculatorOptions.extensions[515723506]=proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.face_geometry.proto)}(face_geometry_graph_options_pb);var face_landmarks_detector_graph_options_pb={},face_blendshapes_graph_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n),r.exportSymbol("proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions",null,o),proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.displayName="proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.toObject=function(e,t){var r,o={baseOptions:(r=t.getBaseOptions())&&n.BaseOptions.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions;return proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r)}else t.skipField()}return e},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.serializeBinaryToWriter=function(e,t){var r;null!=(r=e.getBaseOptions())&&t.writeMessage(1,r,n.BaseOptions.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.ext=new t.ExtensionFieldInfo(508981768,{ext:0},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[508981768]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[508981768]=proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.ext,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.ext=new t.ExtensionFieldInfo(508981768,{ext:0},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[508981768]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[508981768]=proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.face_landmarker.proto)}(face_blendshapes_graph_options_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n);var s=face_blendshapes_graph_options_pb;r.object.extend(proto,s),r.exportSymbol("proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions",null,o),proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.displayName="proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.toObject=function(e,r){var o,i={baseOptions:(o=r.getBaseOptions())&&n.BaseOptions.toObject(e,o),minDetectionConfidence:t.Message.getFloatingPointFieldWithDefault(r,2,.5),smoothLandmarks:null==(o=t.Message.getBooleanField(r,4))?void 0:o,faceBlendshapesGraphOptions:(o=r.getFaceBlendshapesGraphOptions())&&s.FaceBlendshapesGraphOptions.toObject(e,o)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions;return proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=t.readFloat();e.setMinDetectionConfidence(r);break;case 4:r=t.readBool();e.setSmoothLandmarks(r);break;case 3:r=new s.FaceBlendshapesGraphOptions;t.readMessage(r,s.FaceBlendshapesGraphOptions.deserializeBinaryFromReader),e.setFaceBlendshapesGraphOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getBaseOptions())&&r.writeMessage(1,o,n.BaseOptions.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeFloat(2,o),null!=(o=t.Message.getField(e,4))&&r.writeBool(4,o),null!=(o=e.getFaceBlendshapesGraphOptions())&&r.writeMessage(3,o,s.FaceBlendshapesGraphOptions.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.ext=new t.ExtensionFieldInfo(508968149,{ext:0},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[508968149]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[508968149]=proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.ext,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.getMinDetectionConfidence=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,.5)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.setMinDetectionConfidence=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.clearMinDetectionConfidence=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.hasMinDetectionConfidence=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.getSmoothLandmarks=function(){return t.Message.getBooleanFieldWithDefault(this,4,!1)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.setSmoothLandmarks=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.clearSmoothLandmarks=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.hasSmoothLandmarks=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.getFaceBlendshapesGraphOptions=function(){return t.Message.getWrapperField(this,s.FaceBlendshapesGraphOptions,3)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.setFaceBlendshapesGraphOptions=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.clearFaceBlendshapesGraphOptions=function(){return this.setFaceBlendshapesGraphOptions(void 0)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.hasFaceBlendshapesGraphOptions=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.ext=new t.ExtensionFieldInfo(508968149,{ext:0},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[508968149]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[508968149]=proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.face_landmarker.proto)}(face_landmarks_detector_graph_options_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n);var s=face_detector_graph_options_pb;r.object.extend(proto,s);var p=face_geometry_graph_options_pb;r.object.extend(proto,p);var d=face_landmarks_detector_graph_options_pb;r.object.extend(proto,d),r.exportSymbol("proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions",null,o),proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.displayName="proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.toObject=function(e,r){var o,i={baseOptions:(o=r.getBaseOptions())&&n.BaseOptions.toObject(e,o),faceDetectorGraphOptions:(o=r.getFaceDetectorGraphOptions())&&s.FaceDetectorGraphOptions.toObject(e,o),faceLandmarksDetectorGraphOptions:(o=r.getFaceLandmarksDetectorGraphOptions())&&d.FaceLandmarksDetectorGraphOptions.toObject(e,o),minTrackingConfidence:t.Message.getFloatingPointFieldWithDefault(r,4,.5),faceGeometryGraphOptions:(o=r.getFaceGeometryGraphOptions())&&p.FaceGeometryGraphOptions.toObject(e,o)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions;return proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=new s.FaceDetectorGraphOptions;t.readMessage(r,s.FaceDetectorGraphOptions.deserializeBinaryFromReader),e.setFaceDetectorGraphOptions(r);break;case 3:r=new d.FaceLandmarksDetectorGraphOptions;t.readMessage(r,d.FaceLandmarksDetectorGraphOptions.deserializeBinaryFromReader),e.setFaceLandmarksDetectorGraphOptions(r);break;case 4:r=t.readFloat();e.setMinTrackingConfidence(r);break;case 5:r=new p.FaceGeometryGraphOptions;t.readMessage(r,p.FaceGeometryGraphOptions.deserializeBinaryFromReader),e.setFaceGeometryGraphOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getBaseOptions())&&r.writeMessage(1,o,n.BaseOptions.serializeBinaryToWriter),null!=(o=e.getFaceDetectorGraphOptions())&&r.writeMessage(2,o,s.FaceDetectorGraphOptions.serializeBinaryToWriter),null!=(o=e.getFaceLandmarksDetectorGraphOptions())&&r.writeMessage(3,o,d.FaceLandmarksDetectorGraphOptions.serializeBinaryToWriter),null!=(o=t.Message.getField(e,4))&&r.writeFloat(4,o),null!=(o=e.getFaceGeometryGraphOptions())&&r.writeMessage(5,o,p.FaceGeometryGraphOptions.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.ext=new t.ExtensionFieldInfo(508968150,{ext:0},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[508968150]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[508968150]=proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.ext,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.getFaceDetectorGraphOptions=function(){return t.Message.getWrapperField(this,s.FaceDetectorGraphOptions,2)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.setFaceDetectorGraphOptions=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.clearFaceDetectorGraphOptions=function(){return this.setFaceDetectorGraphOptions(void 0)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.hasFaceDetectorGraphOptions=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.getFaceLandmarksDetectorGraphOptions=function(){return t.Message.getWrapperField(this,d.FaceLandmarksDetectorGraphOptions,3)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.setFaceLandmarksDetectorGraphOptions=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.clearFaceLandmarksDetectorGraphOptions=function(){return this.setFaceLandmarksDetectorGraphOptions(void 0)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.hasFaceLandmarksDetectorGraphOptions=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.getMinTrackingConfidence=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,.5)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.setMinTrackingConfidence=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.clearMinTrackingConfidence=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.hasMinTrackingConfidence=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.getFaceGeometryGraphOptions=function(){return t.Message.getWrapperField(this,p.FaceGeometryGraphOptions,5)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.setFaceGeometryGraphOptions=function(e){return t.Message.setWrapperField(this,5,e)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.clearFaceGeometryGraphOptions=function(){return this.setFaceGeometryGraphOptions(void 0)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.hasFaceGeometryGraphOptions=function(){return null!=t.Message.getField(this,5)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.ext=new t.ExtensionFieldInfo(508968150,{ext:0},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[508968150]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[508968150]=proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.face_landmarker.proto)}(face_landmarker_graph_options_pb);var classifier_result={};Object.defineProperty(classifier_result,"__esModule",{value:!0}),classifier_result.convertFromClassificationResultProto=classifier_result.convertFromClassifications=void 0;const DEFAULT_INDEX$1=-1,DEFAULT_SCORE=0;function convertFromClassifications(e,t=DEFAULT_INDEX$1,r=""){return{categories:e.map((e=>{var t,r,o,i;return{index:null!==(t=e.getIndex())&&void 0!==t?t:DEFAULT_INDEX$1,score:null!==(r=e.getScore())&&void 0!==r?r:DEFAULT_SCORE,categoryName:null!==(o=e.getLabel())&&void 0!==o?o:"",displayName:null!==(i=e.getDisplayName())&&void 0!==i?i:""}})),headIndex:t,headName:r}}function convertFromClassificationsProto(e){var t,r;return convertFromClassifications(null!==(r=null===(t=e.getClassificationList())||void 0===t?void 0:t.getClassificationList())&&void 0!==r?r:[],e.getHeadIndex(),e.getHeadName())}function convertFromClassificationResultProto(e){const t={classifications:e.getClassificationsList().map((e=>convertFromClassificationsProto(e)))};return e.hasTimestampMs()&&(t.timestampMs=e.getTimestampMs()),t}classifier_result.convertFromClassifications=convertFromClassifications,classifier_result.convertFromClassificationResultProto=convertFromClassificationResultProto;var landmark_result={};function convertToLandmarks(e){var t,r,o;const i=[];for(const a of e.getLandmarkList())i.push({x:null!==(t=a.getX())&&void 0!==t?t:0,y:null!==(r=a.getY())&&void 0!==r?r:0,z:null!==(o=a.getZ())&&void 0!==o?o:0});return i}function convertToWorldLandmarks(e){var t,r,o;const i=[];for(const a of e.getLandmarkList())i.push({x:null!==(t=a.getX())&&void 0!==t?t:0,y:null!==(r=a.getY())&&void 0!==r?r:0,z:null!==(o=a.getZ())&&void 0!==o?o:0});return i}Object.defineProperty(landmark_result,"__esModule",{value:!0}),landmark_result.convertToWorldLandmarks=landmark_result.convertToLandmarks=void 0,landmark_result.convertToLandmarks=convertToLandmarks,landmark_result.convertToWorldLandmarks=convertToWorldLandmarks;var face_landmarks_connections={},exports;exports=face_landmarks_connections,Object.defineProperty(exports,"__esModule",{value:!0}),exports.FACE_LANDMARKS_TESSELATION=exports.FACE_LANDMARKS_CONTOURS=exports.FACE_LANDMARKS_FACE_OVAL=exports.FACE_LANDMARKS_RIGHT_IRIS=exports.FACE_LANDMARKS_RIGHT_EYEBROW=exports.FACE_LANDMARKS_RIGHT_EYE=exports.FACE_LANDMARKS_LEFT_IRIS=exports.FACE_LANDMARKS_LEFT_EYEBROW=exports.FACE_LANDMARKS_LEFT_EYE=exports.FACE_LANDMARKS_LIPS=void 0,exports.FACE_LANDMARKS_LIPS=[{start:61,end:146},{start:146,end:91},{start:91,end:181},{start:181,end:84},{start:84,end:17},{start:17,end:314},{start:314,end:405},{start:405,end:321},{start:321,end:375},{start:375,end:291},{start:61,end:185},{start:185,end:40},{start:40,end:39},{start:39,end:37},{start:37,end:0},{start:0,end:267},{start:267,end:269},{start:269,end:270},{start:270,end:409},{start:409,end:291},{start:78,end:95},{start:95,end:88},{start:88,end:178},{start:178,end:87},{start:87,end:14},{start:14,end:317},{start:317,end:402},{start:402,end:318},{start:318,end:324},{start:324,end:308},{start:78,end:191},{start:191,end:80},{start:80,end:81},{start:81,end:82},{start:82,end:13},{start:13,end:312},{start:312,end:311},{start:311,end:310},{start:310,end:415},{start:415,end:308}],exports.FACE_LANDMARKS_LEFT_EYE=[{start:263,end:249},{start:249,end:390},{start:390,end:373},{start:373,end:374},{start:374,end:380},{start:380,end:381},{start:381,end:382},{start:382,end:362},{start:263,end:466},{start:466,end:388},{start:388,end:387},{start:387,end:386},{start:386,end:385},{start:385,end:384},{start:384,end:398},{start:398,end:362}],exports.FACE_LANDMARKS_LEFT_EYEBROW=[{start:276,end:283},{start:283,end:282},{start:282,end:295},{start:295,end:285},{start:300,end:293},{start:293,end:334},{start:334,end:296},{start:296,end:336}],exports.FACE_LANDMARKS_LEFT_IRIS=[{start:474,end:475},{start:475,end:476},{start:476,end:477},{start:477,end:474}],exports.FACE_LANDMARKS_RIGHT_EYE=[{start:33,end:7},{start:7,end:163},{start:163,end:144},{start:144,end:145},{start:145,end:153},{start:153,end:154},{start:154,end:155},{start:155,end:133},{start:33,end:246},{start:246,end:161},{start:161,end:160},{start:160,end:159},{start:159,end:158},{start:158,end:157},{start:157,end:173},{start:173,end:133}],exports.FACE_LANDMARKS_RIGHT_EYEBROW=[{start:46,end:53},{start:53,end:52},{start:52,end:65},{start:65,end:55},{start:70,end:63},{start:63,end:105},{start:105,end:66},{start:66,end:107}],exports.FACE_LANDMARKS_RIGHT_IRIS=[{start:469,end:470},{start:470,end:471},{start:471,end:472},{start:472,end:469}],exports.FACE_LANDMARKS_FACE_OVAL=[{start:10,end:338},{start:338,end:297},{start:297,end:332},{start:332,end:284},{start:284,end:251},{start:251,end:389},{start:389,end:356},{start:356,end:454},{start:454,end:323},{start:323,end:361},{start:361,end:288},{start:288,end:397},{start:397,end:365},{start:365,end:379},{start:379,end:378},{start:378,end:400},{start:400,end:377},{start:377,end:152},{start:152,end:148},{start:148,end:176},{start:176,end:149},{start:149,end:150},{start:150,end:136},{start:136,end:172},{start:172,end:58},{start:58,end:132},{start:132,end:93},{start:93,end:234},{start:234,end:127},{start:127,end:162},{start:162,end:21},{start:21,end:54},{start:54,end:103},{start:103,end:67},{start:67,end:109},{start:109,end:10}],exports.FACE_LANDMARKS_CONTOURS=[...exports.FACE_LANDMARKS_LIPS,...exports.FACE_LANDMARKS_LEFT_EYE,...exports.FACE_LANDMARKS_LEFT_EYEBROW,...exports.FACE_LANDMARKS_RIGHT_EYE,...exports.FACE_LANDMARKS_RIGHT_EYEBROW,...exports.FACE_LANDMARKS_FACE_OVAL],exports.FACE_LANDMARKS_TESSELATION=[{start:127,end:34},{start:34,end:139},{start:139,end:127},{start:11,end:0},{start:0,end:37},{start:37,end:11},{start:232,end:231},{start:231,end:120},{start:120,end:232},{start:72,end:37},{start:37,end:39},{start:39,end:72},{start:128,end:121},{start:121,end:47},{start:47,end:128},{start:232,end:121},{start:121,end:128},{start:128,end:232},{start:104,end:69},{start:69,end:67},{start:67,end:104},{start:175,end:171},{start:171,end:148},{start:148,end:175},{start:118,end:50},{start:50,end:101},{start:101,end:118},{start:73,end:39},{start:39,end:40},{start:40,end:73},{start:9,end:151},{start:151,end:108},{start:108,end:9},{start:48,end:115},{start:115,end:131},{start:131,end:48},{start:194,end:204},{start:204,end:211},{start:211,end:194},{start:74,end:40},{start:40,end:185},{start:185,end:74},{start:80,end:42},{start:42,end:183},{start:183,end:80},{start:40,end:92},{start:92,end:186},{start:186,end:40},{start:230,end:229},{start:229,end:118},{start:118,end:230},{start:202,end:212},{start:212,end:214},{start:214,end:202},{start:83,end:18},{start:18,end:17},{start:17,end:83},{start:76,end:61},{start:61,end:146},{start:146,end:76},{start:160,end:29},{start:29,end:30},{start:30,end:160},{start:56,end:157},{start:157,end:173},{start:173,end:56},{start:106,end:204},{start:204,end:194},{start:194,end:106},{start:135,end:214},{start:214,end:192},{start:192,end:135},{start:203,end:165},{start:165,end:98},{start:98,end:203},{start:21,end:71},{start:71,end:68},{start:68,end:21},{start:51,end:45},{start:45,end:4},{start:4,end:51},{start:144,end:24},{start:24,end:23},{start:23,end:144},{start:77,end:146},{start:146,end:91},{start:91,end:77},{start:205,end:50},{start:50,end:187},{start:187,end:205},{start:201,end:200},{start:200,end:18},{start:18,end:201},{start:91,end:106},{start:106,end:182},{start:182,end:91},{start:90,end:91},{start:91,end:181},{start:181,end:90},{start:85,end:84},{start:84,end:17},{start:17,end:85},{start:206,end:203},{start:203,end:36},{start:36,end:206},{start:148,end:171},{start:171,end:140},{start:140,end:148},{start:92,end:40},{start:40,end:39},{start:39,end:92},{start:193,end:189},{start:189,end:244},{start:244,end:193},{start:159,end:158},{start:158,end:28},{start:28,end:159},{start:247,end:246},{start:246,end:161},{start:161,end:247},{start:236,end:3},{start:3,end:196},{start:196,end:236},{start:54,end:68},{start:68,end:104},{start:104,end:54},{start:193,end:168},{start:168,end:8},{start:8,end:193},{start:117,end:228},{start:228,end:31},{start:31,end:117},{start:189,end:193},{start:193,end:55},{start:55,end:189},{start:98,end:97},{start:97,end:99},{start:99,end:98},{start:126,end:47},{start:47,end:100},{start:100,end:126},{start:166,end:79},{start:79,end:218},{start:218,end:166},{start:155,end:154},{start:154,end:26},{start:26,end:155},{start:209,end:49},{start:49,end:131},{start:131,end:209},{start:135,end:136},{start:136,end:150},{start:150,end:135},{start:47,end:126},{start:126,end:217},{start:217,end:47},{start:223,end:52},{start:52,end:53},{start:53,end:223},{start:45,end:51},{start:51,end:134},{start:134,end:45},{start:211,end:170},{start:170,end:140},{start:140,end:211},{start:67,end:69},{start:69,end:108},{start:108,end:67},{start:43,end:106},{start:106,end:91},{start:91,end:43},{start:230,end:119},{start:119,end:120},{start:120,end:230},{start:226,end:130},{start:130,end:247},{start:247,end:226},{start:63,end:53},{start:53,end:52},{start:52,end:63},{start:238,end:20},{start:20,end:242},{start:242,end:238},{start:46,end:70},{start:70,end:156},{start:156,end:46},{start:78,end:62},{start:62,end:96},{start:96,end:78},{start:46,end:53},{start:53,end:63},{start:63,end:46},{start:143,end:34},{start:34,end:227},{start:227,end:143},{start:123,end:117},{start:117,end:111},{start:111,end:123},{start:44,end:125},{start:125,end:19},{start:19,end:44},{start:236,end:134},{start:134,end:51},{start:51,end:236},{start:216,end:206},{start:206,end:205},{start:205,end:216},{start:154,end:153},{start:153,end:22},{start:22,end:154},{start:39,end:37},{start:37,end:167},{start:167,end:39},{start:200,end:201},{start:201,end:208},{start:208,end:200},{start:36,end:142},{start:142,end:100},{start:100,end:36},{start:57,end:212},{start:212,end:202},{start:202,end:57},{start:20,end:60},{start:60,end:99},{start:99,end:20},{start:28,end:158},{start:158,end:157},{start:157,end:28},{start:35,end:226},{start:226,end:113},{start:113,end:35},{start:160,end:159},{start:159,end:27},{start:27,end:160},{start:204,end:202},{start:202,end:210},{start:210,end:204},{start:113,end:225},{start:225,end:46},{start:46,end:113},{start:43,end:202},{start:202,end:204},{start:204,end:43},{start:62,end:76},{start:76,end:77},{start:77,end:62},{start:137,end:123},{start:123,end:116},{start:116,end:137},{start:41,end:38},{start:38,end:72},{start:72,end:41},{start:203,end:129},{start:129,end:142},{start:142,end:203},{start:64,end:98},{start:98,end:240},{start:240,end:64},{start:49,end:102},{start:102,end:64},{start:64,end:49},{start:41,end:73},{start:73,end:74},{start:74,end:41},{start:212,end:216},{start:216,end:207},{start:207,end:212},{start:42,end:74},{start:74,end:184},{start:184,end:42},{start:169,end:170},{start:170,end:211},{start:211,end:169},{start:170,end:149},{start:149,end:176},{start:176,end:170},{start:105,end:66},{start:66,end:69},{start:69,end:105},{start:122,end:6},{start:6,end:168},{start:168,end:122},{start:123,end:147},{start:147,end:187},{start:187,end:123},{start:96,end:77},{start:77,end:90},{start:90,end:96},{start:65,end:55},{start:55,end:107},{start:107,end:65},{start:89,end:90},{start:90,end:180},{start:180,end:89},{start:101,end:100},{start:100,end:120},{start:120,end:101},{start:63,end:105},{start:105,end:104},{start:104,end:63},{start:93,end:137},{start:137,end:227},{start:227,end:93},{start:15,end:86},{start:86,end:85},{start:85,end:15},{start:129,end:102},{start:102,end:49},{start:49,end:129},{start:14,end:87},{start:87,end:86},{start:86,end:14},{start:55,end:8},{start:8,end:9},{start:9,end:55},{start:100,end:47},{start:47,end:121},{start:121,end:100},{start:145,end:23},{start:23,end:22},{start:22,end:145},{start:88,end:89},{start:89,end:179},{start:179,end:88},{start:6,end:122},{start:122,end:196},{start:196,end:6},{start:88,end:95},{start:95,end:96},{start:96,end:88},{start:138,end:172},{start:172,end:136},{start:136,end:138},{start:215,end:58},{start:58,end:172},{start:172,end:215},{start:115,end:48},{start:48,end:219},{start:219,end:115},{start:42,end:80},{start:80,end:81},{start:81,end:42},{start:195,end:3},{start:3,end:51},{start:51,end:195},{start:43,end:146},{start:146,end:61},{start:61,end:43},{start:171,end:175},{start:175,end:199},{start:199,end:171},{start:81,end:82},{start:82,end:38},{start:38,end:81},{start:53,end:46},{start:46,end:225},{start:225,end:53},{start:144,end:163},{start:163,end:110},{start:110,end:144},{start:52,end:65},{start:65,end:66},{start:66,end:52},{start:229,end:228},{start:228,end:117},{start:117,end:229},{start:34,end:127},{start:127,end:234},{start:234,end:34},{start:107,end:108},{start:108,end:69},{start:69,end:107},{start:109,end:108},{start:108,end:151},{start:151,end:109},{start:48,end:64},{start:64,end:235},{start:235,end:48},{start:62,end:78},{start:78,end:191},{start:191,end:62},{start:129,end:209},{start:209,end:126},{start:126,end:129},{start:111,end:35},{start:35,end:143},{start:143,end:111},{start:117,end:123},{start:123,end:50},{start:50,end:117},{start:222,end:65},{start:65,end:52},{start:52,end:222},{start:19,end:125},{start:125,end:141},{start:141,end:19},{start:221,end:55},{start:55,end:65},{start:65,end:221},{start:3,end:195},{start:195,end:197},{start:197,end:3},{start:25,end:7},{start:7,end:33},{start:33,end:25},{start:220,end:237},{start:237,end:44},{start:44,end:220},{start:70,end:71},{start:71,end:139},{start:139,end:70},{start:122,end:193},{start:193,end:245},{start:245,end:122},{start:247,end:130},{start:130,end:33},{start:33,end:247},{start:71,end:21},{start:21,end:162},{start:162,end:71},{start:170,end:169},{start:169,end:150},{start:150,end:170},{start:188,end:174},{start:174,end:196},{start:196,end:188},{start:216,end:186},{start:186,end:92},{start:92,end:216},{start:2,end:97},{start:97,end:167},{start:167,end:2},{start:141,end:125},{start:125,end:241},{start:241,end:141},{start:164,end:167},{start:167,end:37},{start:37,end:164},{start:72,end:38},{start:38,end:12},{start:12,end:72},{start:38,end:82},{start:82,end:13},{start:13,end:38},{start:63,end:68},{start:68,end:71},{start:71,end:63},{start:226,end:35},{start:35,end:111},{start:111,end:226},{start:101,end:50},{start:50,end:205},{start:205,end:101},{start:206,end:92},{start:92,end:165},{start:165,end:206},{start:209,end:198},{start:198,end:217},{start:217,end:209},{start:165,end:167},{start:167,end:97},{start:97,end:165},{start:220,end:115},{start:115,end:218},{start:218,end:220},{start:133,end:112},{start:112,end:243},{start:243,end:133},{start:239,end:238},{start:238,end:241},{start:241,end:239},{start:214,end:135},{start:135,end:169},{start:169,end:214},{start:190,end:173},{start:173,end:133},{start:133,end:190},{start:171,end:208},{start:208,end:32},{start:32,end:171},{start:125,end:44},{start:44,end:237},{start:237,end:125},{start:86,end:87},{start:87,end:178},{start:178,end:86},{start:85,end:86},{start:86,end:179},{start:179,end:85},{start:84,end:85},{start:85,end:180},{start:180,end:84},{start:83,end:84},{start:84,end:181},{start:181,end:83},{start:201,end:83},{start:83,end:182},{start:182,end:201},{start:137,end:93},{start:93,end:132},{start:132,end:137},{start:76,end:62},{start:62,end:183},{start:183,end:76},{start:61,end:76},{start:76,end:184},{start:184,end:61},{start:57,end:61},{start:61,end:185},{start:185,end:57},{start:212,end:57},{start:57,end:186},{start:186,end:212},{start:214,end:207},{start:207,end:187},{start:187,end:214},{start:34,end:143},{start:143,end:156},{start:156,end:34},{start:79,end:239},{start:239,end:237},{start:237,end:79},{start:123,end:137},{start:137,end:177},{start:177,end:123},{start:44,end:1},{start:1,end:4},{start:4,end:44},{start:201,end:194},{start:194,end:32},{start:32,end:201},{start:64,end:102},{start:102,end:129},{start:129,end:64},{start:213,end:215},{start:215,end:138},{start:138,end:213},{start:59,end:166},{start:166,end:219},{start:219,end:59},{start:242,end:99},{start:99,end:97},{start:97,end:242},{start:2,end:94},{start:94,end:141},{start:141,end:2},{start:75,end:59},{start:59,end:235},{start:235,end:75},{start:24,end:110},{start:110,end:228},{start:228,end:24},{start:25,end:130},{start:130,end:226},{start:226,end:25},{start:23,end:24},{start:24,end:229},{start:229,end:23},{start:22,end:23},{start:23,end:230},{start:230,end:22},{start:26,end:22},{start:22,end:231},{start:231,end:26},{start:112,end:26},{start:26,end:232},{start:232,end:112},{start:189,end:190},{start:190,end:243},{start:243,end:189},{start:221,end:56},{start:56,end:190},{start:190,end:221},{start:28,end:56},{start:56,end:221},{start:221,end:28},{start:27,end:28},{start:28,end:222},{start:222,end:27},{start:29,end:27},{start:27,end:223},{start:223,end:29},{start:30,end:29},{start:29,end:224},{start:224,end:30},{start:247,end:30},{start:30,end:225},{start:225,end:247},{start:238,end:79},{start:79,end:20},{start:20,end:238},{start:166,end:59},{start:59,end:75},{start:75,end:166},{start:60,end:75},{start:75,end:240},{start:240,end:60},{start:147,end:177},{start:177,end:215},{start:215,end:147},{start:20,end:79},{start:79,end:166},{start:166,end:20},{start:187,end:147},{start:147,end:213},{start:213,end:187},{start:112,end:233},{start:233,end:244},{start:244,end:112},{start:233,end:128},{start:128,end:245},{start:245,end:233},{start:128,end:114},{start:114,end:188},{start:188,end:128},{start:114,end:217},{start:217,end:174},{start:174,end:114},{start:131,end:115},{start:115,end:220},{start:220,end:131},{start:217,end:198},{start:198,end:236},{start:236,end:217},{start:198,end:131},{start:131,end:134},{start:134,end:198},{start:177,end:132},{start:132,end:58},{start:58,end:177},{start:143,end:35},{start:35,end:124},{start:124,end:143},{start:110,end:163},{start:163,end:7},{start:7,end:110},{start:228,end:110},{start:110,end:25},{start:25,end:228},{start:356,end:389},{start:389,end:368},{start:368,end:356},{start:11,end:302},{start:302,end:267},{start:267,end:11},{start:452,end:350},{start:350,end:349},{start:349,end:452},{start:302,end:303},{start:303,end:269},{start:269,end:302},{start:357,end:343},{start:343,end:277},{start:277,end:357},{start:452,end:453},{start:453,end:357},{start:357,end:452},{start:333,end:332},{start:332,end:297},{start:297,end:333},{start:175,end:152},{start:152,end:377},{start:377,end:175},{start:347,end:348},{start:348,end:330},{start:330,end:347},{start:303,end:304},{start:304,end:270},{start:270,end:303},{start:9,end:336},{start:336,end:337},{start:337,end:9},{start:278,end:279},{start:279,end:360},{start:360,end:278},{start:418,end:262},{start:262,end:431},{start:431,end:418},{start:304,end:408},{start:408,end:409},{start:409,end:304},{start:310,end:415},{start:415,end:407},{start:407,end:310},{start:270,end:409},{start:409,end:410},{start:410,end:270},{start:450,end:348},{start:348,end:347},{start:347,end:450},{start:422,end:430},{start:430,end:434},{start:434,end:422},{start:313,end:314},{start:314,end:17},{start:17,end:313},{start:306,end:307},{start:307,end:375},{start:375,end:306},{start:387,end:388},{start:388,end:260},{start:260,end:387},{start:286,end:414},{start:414,end:398},{start:398,end:286},{start:335,end:406},{start:406,end:418},{start:418,end:335},{start:364,end:367},{start:367,end:416},{start:416,end:364},{start:423,end:358},{start:358,end:327},{start:327,end:423},{start:251,end:284},{start:284,end:298},{start:298,end:251},{start:281,end:5},{start:5,end:4},{start:4,end:281},{start:373,end:374},{start:374,end:253},{start:253,end:373},{start:307,end:320},{start:320,end:321},{start:321,end:307},{start:425,end:427},{start:427,end:411},{start:411,end:425},{start:421,end:313},{start:313,end:18},{start:18,end:421},{start:321,end:405},{start:405,end:406},{start:406,end:321},{start:320,end:404},{start:404,end:405},{start:405,end:320},{start:315,end:16},{start:16,end:17},{start:17,end:315},{start:426,end:425},{start:425,end:266},{start:266,end:426},{start:377,end:400},{start:400,end:369},{start:369,end:377},{start:322,end:391},{start:391,end:269},{start:269,end:322},{start:417,end:465},{start:465,end:464},{start:464,end:417},{start:386,end:257},{start:257,end:258},{start:258,end:386},{start:466,end:260},{start:260,end:388},{start:388,end:466},{start:456,end:399},{start:399,end:419},{start:419,end:456},{start:284,end:332},{start:332,end:333},{start:333,end:284},{start:417,end:285},{start:285,end:8},{start:8,end:417},{start:346,end:340},{start:340,end:261},{start:261,end:346},{start:413,end:441},{start:441,end:285},{start:285,end:413},{start:327,end:460},{start:460,end:328},{start:328,end:327},{start:355,end:371},{start:371,end:329},{start:329,end:355},{start:392,end:439},{start:439,end:438},{start:438,end:392},{start:382,end:341},{start:341,end:256},{start:256,end:382},{start:429,end:420},{start:420,end:360},{start:360,end:429},{start:364,end:394},{start:394,end:379},{start:379,end:364},{start:277,end:343},{start:343,end:437},{start:437,end:277},{start:443,end:444},{start:444,end:283},{start:283,end:443},{start:275,end:440},{start:440,end:363},{start:363,end:275},{start:431,end:262},{start:262,end:369},{start:369,end:431},{start:297,end:338},{start:338,end:337},{start:337,end:297},{start:273,end:375},{start:375,end:321},{start:321,end:273},{start:450,end:451},{start:451,end:349},{start:349,end:450},{start:446,end:342},{start:342,end:467},{start:467,end:446},{start:293,end:334},{start:334,end:282},{start:282,end:293},{start:458,end:461},{start:461,end:462},{start:462,end:458},{start:276,end:353},{start:353,end:383},{start:383,end:276},{start:308,end:324},{start:324,end:325},{start:325,end:308},{start:276,end:300},{start:300,end:293},{start:293,end:276},{start:372,end:345},{start:345,end:447},{start:447,end:372},{start:352,end:345},{start:345,end:340},{start:340,end:352},{start:274,end:1},{start:1,end:19},{start:19,end:274},{start:456,end:248},{start:248,end:281},{start:281,end:456},{start:436,end:427},{start:427,end:425},{start:425,end:436},{start:381,end:256},{start:256,end:252},{start:252,end:381},{start:269,end:391},{start:391,end:393},{start:393,end:269},{start:200,end:199},{start:199,end:428},{start:428,end:200},{start:266,end:330},{start:330,end:329},{start:329,end:266},{start:287,end:273},{start:273,end:422},{start:422,end:287},{start:250,end:462},{start:462,end:328},{start:328,end:250},{start:258,end:286},{start:286,end:384},{start:384,end:258},{start:265,end:353},{start:353,end:342},{start:342,end:265},{start:387,end:259},{start:259,end:257},{start:257,end:387},{start:424,end:431},{start:431,end:430},{start:430,end:424},{start:342,end:353},{start:353,end:276},{start:276,end:342},{start:273,end:335},{start:335,end:424},{start:424,end:273},{start:292,end:325},{start:325,end:307},{start:307,end:292},{start:366,end:447},{start:447,end:345},{start:345,end:366},{start:271,end:303},{start:303,end:302},{start:302,end:271},{start:423,end:266},{start:266,end:371},{start:371,end:423},{start:294,end:455},{start:455,end:460},{start:460,end:294},{start:279,end:278},{start:278,end:294},{start:294,end:279},{start:271,end:272},{start:272,end:304},{start:304,end:271},{start:432,end:434},{start:434,end:427},{start:427,end:432},{start:272,end:407},{start:407,end:408},{start:408,end:272},{start:394,end:430},{start:430,end:431},{start:431,end:394},{start:395,end:369},{start:369,end:400},{start:400,end:395},{start:334,end:333},{start:333,end:299},{start:299,end:334},{start:351,end:417},{start:417,end:168},{start:168,end:351},{start:352,end:280},{start:280,end:411},{start:411,end:352},{start:325,end:319},{start:319,end:320},{start:320,end:325},{start:295,end:296},{start:296,end:336},{start:336,end:295},{start:319,end:403},{start:403,end:404},{start:404,end:319},{start:330,end:348},{start:348,end:349},{start:349,end:330},{start:293,end:298},{start:298,end:333},{start:333,end:293},{start:323,end:454},{start:454,end:447},{start:447,end:323},{start:15,end:16},{start:16,end:315},{start:315,end:15},{start:358,end:429},{start:429,end:279},{start:279,end:358},{start:14,end:15},{start:15,end:316},{start:316,end:14},{start:285,end:336},{start:336,end:9},{start:9,end:285},{start:329,end:349},{start:349,end:350},{start:350,end:329},{start:374,end:380},{start:380,end:252},{start:252,end:374},{start:318,end:402},{start:402,end:403},{start:403,end:318},{start:6,end:197},{start:197,end:419},{start:419,end:6},{start:318,end:319},{start:319,end:325},{start:325,end:318},{start:367,end:364},{start:364,end:365},{start:365,end:367},{start:435,end:367},{start:367,end:397},{start:397,end:435},{start:344,end:438},{start:438,end:439},{start:439,end:344},{start:272,end:271},{start:271,end:311},{start:311,end:272},{start:195,end:5},{start:5,end:281},{start:281,end:195},{start:273,end:287},{start:287,end:291},{start:291,end:273},{start:396,end:428},{start:428,end:199},{start:199,end:396},{start:311,end:271},{start:271,end:268},{start:268,end:311},{start:283,end:444},{start:444,end:445},{start:445,end:283},{start:373,end:254},{start:254,end:339},{start:339,end:373},{start:282,end:334},{start:334,end:296},{start:296,end:282},{start:449,end:347},{start:347,end:346},{start:346,end:449},{start:264,end:447},{start:447,end:454},{start:454,end:264},{start:336,end:296},{start:296,end:299},{start:299,end:336},{start:338,end:10},{start:10,end:151},{start:151,end:338},{start:278,end:439},{start:439,end:455},{start:455,end:278},{start:292,end:407},{start:407,end:415},{start:415,end:292},{start:358,end:371},{start:371,end:355},{start:355,end:358},{start:340,end:345},{start:345,end:372},{start:372,end:340},{start:346,end:347},{start:347,end:280},{start:280,end:346},{start:442,end:443},{start:443,end:282},{start:282,end:442},{start:19,end:94},{start:94,end:370},{start:370,end:19},{start:441,end:442},{start:442,end:295},{start:295,end:441},{start:248,end:419},{start:419,end:197},{start:197,end:248},{start:263,end:255},{start:255,end:359},{start:359,end:263},{start:440,end:275},{start:275,end:274},{start:274,end:440},{start:300,end:383},{start:383,end:368},{start:368,end:300},{start:351,end:412},{start:412,end:465},{start:465,end:351},{start:263,end:467},{start:467,end:466},{start:466,end:263},{start:301,end:368},{start:368,end:389},{start:389,end:301},{start:395,end:378},{start:378,end:379},{start:379,end:395},{start:412,end:351},{start:351,end:419},{start:419,end:412},{start:436,end:426},{start:426,end:322},{start:322,end:436},{start:2,end:164},{start:164,end:393},{start:393,end:2},{start:370,end:462},{start:462,end:461},{start:461,end:370},{start:164,end:0},{start:0,end:267},{start:267,end:164},{start:302,end:11},{start:11,end:12},{start:12,end:302},{start:268,end:12},{start:12,end:13},{start:13,end:268},{start:293,end:300},{start:300,end:301},{start:301,end:293},{start:446,end:261},{start:261,end:340},{start:340,end:446},{start:330,end:266},{start:266,end:425},{start:425,end:330},{start:426,end:423},{start:423,end:391},{start:391,end:426},{start:429,end:355},{start:355,end:437},{start:437,end:429},{start:391,end:327},{start:327,end:326},{start:326,end:391},{start:440,end:457},{start:457,end:438},{start:438,end:440},{start:341,end:382},{start:382,end:362},{start:362,end:341},{start:459,end:457},{start:457,end:461},{start:461,end:459},{start:434,end:430},{start:430,end:394},{start:394,end:434},{start:414,end:463},{start:463,end:362},{start:362,end:414},{start:396,end:369},{start:369,end:262},{start:262,end:396},{start:354,end:461},{start:461,end:457},{start:457,end:354},{start:316,end:403},{start:403,end:402},{start:402,end:316},{start:315,end:404},{start:404,end:403},{start:403,end:315},{start:314,end:405},{start:405,end:404},{start:404,end:314},{start:313,end:406},{start:406,end:405},{start:405,end:313},{start:421,end:418},{start:418,end:406},{start:406,end:421},{start:366,end:401},{start:401,end:361},{start:361,end:366},{start:306,end:408},{start:408,end:407},{start:407,end:306},{start:291,end:409},{start:409,end:408},{start:408,end:291},{start:287,end:410},{start:410,end:409},{start:409,end:287},{start:432,end:436},{start:436,end:410},{start:410,end:432},{start:434,end:416},{start:416,end:411},{start:411,end:434},{start:264,end:368},{start:368,end:383},{start:383,end:264},{start:309,end:438},{start:438,end:457},{start:457,end:309},{start:352,end:376},{start:376,end:401},{start:401,end:352},{start:274,end:275},{start:275,end:4},{start:4,end:274},{start:421,end:428},{start:428,end:262},{start:262,end:421},{start:294,end:327},{start:327,end:358},{start:358,end:294},{start:433,end:416},{start:416,end:367},{start:367,end:433},{start:289,end:455},{start:455,end:439},{start:439,end:289},{start:462,end:370},{start:370,end:326},{start:326,end:462},{start:2,end:326},{start:326,end:370},{start:370,end:2},{start:305,end:460},{start:460,end:455},{start:455,end:305},{start:254,end:449},{start:449,end:448},{start:448,end:254},{start:255,end:261},{start:261,end:446},{start:446,end:255},{start:253,end:450},{start:450,end:449},{start:449,end:253},{start:252,end:451},{start:451,end:450},{start:450,end:252},{start:256,end:452},{start:452,end:451},{start:451,end:256},{start:341,end:453},{start:453,end:452},{start:452,end:341},{start:413,end:464},{start:464,end:463},{start:463,end:413},{start:441,end:413},{start:413,end:414},{start:414,end:441},{start:258,end:442},{start:442,end:441},{start:441,end:258},{start:257,end:443},{start:443,end:442},{start:442,end:257},{start:259,end:444},{start:444,end:443},{start:443,end:259},{start:260,end:445},{start:445,end:444},{start:444,end:260},{start:467,end:342},{start:342,end:445},{start:445,end:467},{start:459,end:458},{start:458,end:250},{start:250,end:459},{start:289,end:392},{start:392,end:290},{start:290,end:289},{start:290,end:328},{start:328,end:460},{start:460,end:290},{start:376,end:433},{start:433,end:435},{start:435,end:376},{start:250,end:290},{start:290,end:392},{start:392,end:250},{start:411,end:416},{start:416,end:433},{start:433,end:411},{start:341,end:463},{start:463,end:464},{start:464,end:341},{start:453,end:464},{start:464,end:465},{start:465,end:453},{start:357,end:465},{start:465,end:412},{start:412,end:357},{start:343,end:412},{start:412,end:399},{start:399,end:343},{start:360,end:363},{start:363,end:440},{start:440,end:360},{start:437,end:399},{start:399,end:456},{start:456,end:437},{start:420,end:456},{start:456,end:363},{start:363,end:420},{start:401,end:435},{start:435,end:288},{start:288,end:401},{start:372,end:383},{start:383,end:353},{start:353,end:372},{start:339,end:255},{start:255,end:249},{start:249,end:339},{start:448,end:261},{start:261,end:255},{start:255,end:448},{start:133,end:243},{start:243,end:190},{start:190,end:133},{start:133,end:155},{start:155,end:112},{start:112,end:133},{start:33,end:246},{start:246,end:247},{start:247,end:33},{start:33,end:130},{start:130,end:25},{start:25,end:33},{start:398,end:384},{start:384,end:286},{start:286,end:398},{start:362,end:398},{start:398,end:414},{start:414,end:362},{start:362,end:463},{start:463,end:341},{start:341,end:362},{start:263,end:359},{start:359,end:467},{start:467,end:263},{start:263,end:249},{start:249,end:255},{start:255,end:263},{start:466,end:467},{start:467,end:260},{start:260,end:466},{start:75,end:60},{start:60,end:166},{start:166,end:75},{start:238,end:239},{start:239,end:79},{start:79,end:238},{start:162,end:127},{start:127,end:139},{start:139,end:162},{start:72,end:11},{start:11,end:37},{start:37,end:72},{start:121,end:232},{start:232,end:120},{start:120,end:121},{start:73,end:72},{start:72,end:39},{start:39,end:73},{start:114,end:128},{start:128,end:47},{start:47,end:114},{start:233,end:232},{start:232,end:128},{start:128,end:233},{start:103,end:104},{start:104,end:67},{start:67,end:103},{start:152,end:175},{start:175,end:148},{start:148,end:152},{start:119,end:118},{start:118,end:101},{start:101,end:119},{start:74,end:73},{start:73,end:40},{start:40,end:74},{start:107,end:9},{start:9,end:108},{start:108,end:107},{start:49,end:48},{start:48,end:131},{start:131,end:49},{start:32,end:194},{start:194,end:211},{start:211,end:32},{start:184,end:74},{start:74,end:185},{start:185,end:184},{start:191,end:80},{start:80,end:183},{start:183,end:191},{start:185,end:40},{start:40,end:186},{start:186,end:185},{start:119,end:230},{start:230,end:118},{start:118,end:119},{start:210,end:202},{start:202,end:214},{start:214,end:210},{start:84,end:83},{start:83,end:17},{start:17,end:84},{start:77,end:76},{start:76,end:146},{start:146,end:77},{start:161,end:160},{start:160,end:30},{start:30,end:161},{start:190,end:56},{start:56,end:173},{start:173,end:190},{start:182,end:106},{start:106,end:194},{start:194,end:182},{start:138,end:135},{start:135,end:192},{start:192,end:138},{start:129,end:203},{start:203,end:98},{start:98,end:129},{start:54,end:21},{start:21,end:68},{start:68,end:54},{start:5,end:51},{start:51,end:4},{start:4,end:5},{start:145,end:144},{start:144,end:23},{start:23,end:145},{start:90,end:77},{start:77,end:91},{start:91,end:90},{start:207,end:205},{start:205,end:187},{start:187,end:207},{start:83,end:201},{start:201,end:18},{start:18,end:83},{start:181,end:91},{start:91,end:182},{start:182,end:181},{start:180,end:90},{start:90,end:181},{start:181,end:180},{start:16,end:85},{start:85,end:17},{start:17,end:16},{start:205,end:206},{start:206,end:36},{start:36,end:205},{start:176,end:148},{start:148,end:140},{start:140,end:176},{start:165,end:92},{start:92,end:39},{start:39,end:165},{start:245,end:193},{start:193,end:244},{start:244,end:245},{start:27,end:159},{start:159,end:28},{start:28,end:27},{start:30,end:247},{start:247,end:161},{start:161,end:30},{start:174,end:236},{start:236,end:196},{start:196,end:174},{start:103,end:54},{start:54,end:104},{start:104,end:103},{start:55,end:193},{start:193,end:8},{start:8,end:55},{start:111,end:117},{start:117,end:31},{start:31,end:111},{start:221,end:189},{start:189,end:55},{start:55,end:221},{start:240,end:98},{start:98,end:99},{start:99,end:240},{start:142,end:126},{start:126,end:100},{start:100,end:142},{start:219,end:166},{start:166,end:218},{start:218,end:219},{start:112,end:155},{start:155,end:26},{start:26,end:112},{start:198,end:209},{start:209,end:131},{start:131,end:198},{start:169,end:135},{start:135,end:150},{start:150,end:169},{start:114,end:47},{start:47,end:217},{start:217,end:114},{start:224,end:223},{start:223,end:53},{start:53,end:224},{start:220,end:45},{start:45,end:134},{start:134,end:220},{start:32,end:211},{start:211,end:140},{start:140,end:32},{start:109,end:67},{start:67,end:108},{start:108,end:109},{start:146,end:43},{start:43,end:91},{start:91,end:146},{start:231,end:230},{start:230,end:120},{start:120,end:231},{start:113,end:226},{start:226,end:247},{start:247,end:113},{start:105,end:63},{start:63,end:52},{start:52,end:105},{start:241,end:238},{start:238,end:242},{start:242,end:241},{start:124,end:46},{start:46,end:156},{start:156,end:124},{start:95,end:78},{start:78,end:96},{start:96,end:95},{start:70,end:46},{start:46,end:63},{start:63,end:70},{start:116,end:143},{start:143,end:227},{start:227,end:116},{start:116,end:123},{start:123,end:111},{start:111,end:116},{start:1,end:44},{start:44,end:19},{start:19,end:1},{start:3,end:236},{start:236,end:51},{start:51,end:3},{start:207,end:216},{start:216,end:205},{start:205,end:207},{start:26,end:154},{start:154,end:22},{start:22,end:26},{start:165,end:39},{start:39,end:167},{start:167,end:165},{start:199,end:200},{start:200,end:208},{start:208,end:199},{start:101,end:36},{start:36,end:100},{start:100,end:101},{start:43,end:57},{start:57,end:202},{start:202,end:43},{start:242,end:20},{start:20,end:99},{start:99,end:242},{start:56,end:28},{start:28,end:157},{start:157,end:56},{start:124,end:35},{start:35,end:113},{start:113,end:124},{start:29,end:160},{start:160,end:27},{start:27,end:29},{start:211,end:204},{start:204,end:210},{start:210,end:211},{start:124,end:113},{start:113,end:46},{start:46,end:124},{start:106,end:43},{start:43,end:204},{start:204,end:106},{start:96,end:62},{start:62,end:77},{start:77,end:96},{start:227,end:137},{start:137,end:116},{start:116,end:227},{start:73,end:41},{start:41,end:72},{start:72,end:73},{start:36,end:203},{start:203,end:142},{start:142,end:36},{start:235,end:64},{start:64,end:240},{start:240,end:235},{start:48,end:49},{start:49,end:64},{start:64,end:48},{start:42,end:41},{start:41,end:74},{start:74,end:42},{start:214,end:212},{start:212,end:207},{start:207,end:214},{start:183,end:42},{start:42,end:184},{start:184,end:183},{start:210,end:169},{start:169,end:211},{start:211,end:210},{start:140,end:170},{start:170,end:176},{start:176,end:140},{start:104,end:105},{start:105,end:69},{start:69,end:104},{start:193,end:122},{start:122,end:168},{start:168,end:193},{start:50,end:123},{start:123,end:187},{start:187,end:50},{start:89,end:96},{start:96,end:90},{start:90,end:89},{start:66,end:65},{start:65,end:107},{start:107,end:66},{start:179,end:89},{start:89,end:180},{start:180,end:179},{start:119,end:101},{start:101,end:120},{start:120,end:119},{start:68,end:63},{start:63,end:104},{start:104,end:68},{start:234,end:93},{start:93,end:227},{start:227,end:234},{start:16,end:15},{start:15,end:85},{start:85,end:16},{start:209,end:129},{start:129,end:49},{start:49,end:209},{start:15,end:14},{start:14,end:86},{start:86,end:15},{start:107,end:55},{start:55,end:9},{start:9,end:107},{start:120,end:100},{start:100,end:121},{start:121,end:120},{start:153,end:145},{start:145,end:22},{start:22,end:153},{start:178,end:88},{start:88,end:179},{start:179,end:178},{start:197,end:6},{start:6,end:196},{start:196,end:197},{start:89,end:88},{start:88,end:96},{start:96,end:89},{start:135,end:138},{start:138,end:136},{start:136,end:135},{start:138,end:215},{start:215,end:172},{start:172,end:138},{start:218,end:115},{start:115,end:219},{start:219,end:218},{start:41,end:42},{start:42,end:81},{start:81,end:41},{start:5,end:195},{start:195,end:51},{start:51,end:5},{start:57,end:43},{start:43,end:61},{start:61,end:57},{start:208,end:171},{start:171,end:199},{start:199,end:208},{start:41,end:81},{start:81,end:38},{start:38,end:41},{start:224,end:53},{start:53,end:225},{start:225,end:224},{start:24,end:144},{start:144,end:110},{start:110,end:24},{start:105,end:52},{start:52,end:66},{start:66,end:105},{start:118,end:229},{start:229,end:117},{start:117,end:118},{start:227,end:34},{start:34,end:234},{start:234,end:227},{start:66,end:107},{start:107,end:69},{start:69,end:66},{start:10,end:109},{start:109,end:151},{start:151,end:10},{start:219,end:48},{start:48,end:235},{start:235,end:219},{start:183,end:62},{start:62,end:191},{start:191,end:183},{start:142,end:129},{start:129,end:126},{start:126,end:142},{start:116,end:111},{start:111,end:143},{start:143,end:116},{start:118,end:117},{start:117,end:50},{start:50,end:118},{start:223,end:222},{start:222,end:52},{start:52,end:223},{start:94,end:19},{start:19,end:141},{start:141,end:94},{start:222,end:221},{start:221,end:65},{start:65,end:222},{start:196,end:3},{start:3,end:197},{start:197,end:196},{start:45,end:220},{start:220,end:44},{start:44,end:45},{start:156,end:70},{start:70,end:139},{start:139,end:156},{start:188,end:122},{start:122,end:245},{start:245,end:188},{start:139,end:71},{start:71,end:162},{start:162,end:139},{start:149,end:170},{start:170,end:150},{start:150,end:149},{start:122,end:188},{start:188,end:196},{start:196,end:122},{start:206,end:216},{start:216,end:92},{start:92,end:206},{start:164,end:2},{start:2,end:167},{start:167,end:164},{start:242,end:141},{start:141,end:241},{start:241,end:242},{start:0,end:164},{start:164,end:37},{start:37,end:0},{start:11,end:72},{start:72,end:12},{start:12,end:11},{start:12,end:38},{start:38,end:13},{start:13,end:12},{start:70,end:63},{start:63,end:71},{start:71,end:70},{start:31,end:226},{start:226,end:111},{start:111,end:31},{start:36,end:101},{start:101,end:205},{start:205,end:36},{start:203,end:206},{start:206,end:165},{start:165,end:203},{start:126,end:209},{start:209,end:217},{start:217,end:126},{start:98,end:165},{start:165,end:97},{start:97,end:98},{start:237,end:220},{start:220,end:218},{start:218,end:237},{start:237,end:239},{start:239,end:241},{start:241,end:237},{start:210,end:214},{start:214,end:169},{start:169,end:210},{start:140,end:171},{start:171,end:32},{start:32,end:140},{start:241,end:125},{start:125,end:237},{start:237,end:241},{start:179,end:86},{start:86,end:178},{start:178,end:179},{start:180,end:85},{start:85,end:179},{start:179,end:180},{start:181,end:84},{start:84,end:180},{start:180,end:181},{start:182,end:83},{start:83,end:181},{start:181,end:182},{start:194,end:201},{start:201,end:182},{start:182,end:194},{start:177,end:137},{start:137,end:132},{start:132,end:177},{start:184,end:76},{start:76,end:183},{start:183,end:184},{start:185,end:61},{start:61,end:184},{start:184,end:185},{start:186,end:57},{start:57,end:185},{start:185,end:186},{start:216,end:212},{start:212,end:186},{start:186,end:216},{start:192,end:214},{start:214,end:187},{start:187,end:192},{start:139,end:34},{start:34,end:156},{start:156,end:139},{start:218,end:79},{start:79,end:237},{start:237,end:218},{start:147,end:123},{start:123,end:177},{start:177,end:147},{start:45,end:44},{start:44,end:4},{start:4,end:45},{start:208,end:201},{start:201,end:32},{start:32,end:208},{start:98,end:64},{start:64,end:129},{start:129,end:98},{start:192,end:213},{start:213,end:138},{start:138,end:192},{start:235,end:59},{start:59,end:219},{start:219,end:235},{start:141,end:242},{start:242,end:97},{start:97,end:141},{start:97,end:2},{start:2,end:141},{start:141,end:97},{start:240,end:75},{start:75,end:235},{start:235,end:240},{start:229,end:24},{start:24,end:228},{start:228,end:229},{start:31,end:25},{start:25,end:226},{start:226,end:31},{start:230,end:23},{start:23,end:229},{start:229,end:230},{start:231,end:22},{start:22,end:230},{start:230,end:231},{start:232,end:26},{start:26,end:231},{start:231,end:232},{start:233,end:112},{start:112,end:232},{start:232,end:233},{start:244,end:189},{start:189,end:243},{start:243,end:244},{start:189,end:221},{start:221,end:190},{start:190,end:189},{start:222,end:28},{start:28,end:221},{start:221,end:222},{start:223,end:27},{start:27,end:222},{start:222,end:223},{start:224,end:29},{start:29,end:223},{start:223,end:224},{start:225,end:30},{start:30,end:224},{start:224,end:225},{start:113,end:247},{start:247,end:225},{start:225,end:113},{start:99,end:60},{start:60,end:240},{start:240,end:99},{start:213,end:147},{start:147,end:215},{start:215,end:213},{start:60,end:20},{start:20,end:166},{start:166,end:60},{start:192,end:187},{start:187,end:213},{start:213,end:192},{start:243,end:112},{start:112,end:244},{start:244,end:243},{start:244,end:233},{start:233,end:245},{start:245,end:244},{start:245,end:128},{start:128,end:188},{start:188,end:245},{start:188,end:114},{start:114,end:174},{start:174,end:188},{start:134,end:131},{start:131,end:220},{start:220,end:134},{start:174,end:217},{start:217,end:236},{start:236,end:174},{start:236,end:198},{start:198,end:134},{start:134,end:236},{start:215,end:177},{start:177,end:58},{start:58,end:215},{start:156,end:143},{start:143,end:124},{start:124,end:156},{start:25,end:110},{start:110,end:7},{start:7,end:25},{start:31,end:228},{start:228,end:25},{start:25,end:31},{start:264,end:356},{start:356,end:368},{start:368,end:264},{start:0,end:11},{start:11,end:267},{start:267,end:0},{start:451,end:452},{start:452,end:349},{start:349,end:451},{start:267,end:302},{start:302,end:269},{start:269,end:267},{start:350,end:357},{start:357,end:277},{start:277,end:350},{start:350,end:452},{start:452,end:357},{start:357,end:350},{start:299,end:333},{start:333,end:297},{start:297,end:299},{start:396,end:175},{start:175,end:377},{start:377,end:396},{start:280,end:347},{start:347,end:330},{start:330,end:280},{start:269,end:303},{start:303,end:270},{start:270,end:269},{start:151,end:9},{start:9,end:337},{start:337,end:151},{start:344,end:278},{start:278,end:360},{start:360,end:344},{start:424,end:418},{start:418,end:431},{start:431,end:424},{start:270,end:304},{start:304,end:409},{start:409,end:270},{start:272,end:310},{start:310,end:407},{start:407,end:272},{start:322,end:270},{start:270,end:410},{start:410,end:322},{start:449,end:450},{start:450,end:347},{start:347,end:449},{start:432,end:422},{start:422,end:434},{start:434,end:432},{start:18,end:313},{start:313,end:17},{start:17,end:18},{start:291,end:306},{start:306,end:375},{start:375,end:291},{start:259,end:387},{start:387,end:260},{start:260,end:259},{start:424,end:335},{start:335,end:418},{start:418,end:424},{start:434,end:364},{start:364,end:416},{start:416,end:434},{start:391,end:423},{start:423,end:327},{start:327,end:391},{start:301,end:251},{start:251,end:298},{start:298,end:301},{start:275,end:281},{start:281,end:4},{start:4,end:275},{start:254,end:373},{start:373,end:253},{start:253,end:254},{start:375,end:307},{start:307,end:321},{start:321,end:375},{start:280,end:425},{start:425,end:411},{start:411,end:280},{start:200,end:421},{start:421,end:18},{start:18,end:200},{start:335,end:321},{start:321,end:406},{start:406,end:335},{start:321,end:320},{start:320,end:405},{start:405,end:321},{start:314,end:315},{start:315,end:17},{start:17,end:314},{start:423,end:426},{start:426,end:266},{start:266,end:423},{start:396,end:377},{start:377,end:369},{start:369,end:396},{start:270,end:322},{start:322,end:269},{start:269,end:270},{start:413,end:417},{start:417,end:464},{start:464,end:413},{start:385,end:386},{start:386,end:258},{start:258,end:385},{start:248,end:456},{start:456,end:419},{start:419,end:248},{start:298,end:284},{start:284,end:333},{start:333,end:298},{start:168,end:417},{start:417,end:8},{start:8,end:168},{start:448,end:346},{start:346,end:261},{start:261,end:448},{start:417,end:413},{start:413,end:285},{start:285,end:417},{start:326,end:327},{start:327,end:328},{start:328,end:326},{start:277,end:355},{start:355,end:329},{start:329,end:277},{start:309,end:392},{start:392,end:438},{start:438,end:309},{start:381,end:382},{start:382,end:256},{start:256,end:381},{start:279,end:429},{start:429,end:360},{start:360,end:279},{start:365,end:364},{start:364,end:379},{start:379,end:365},{start:355,end:277},{start:277,end:437},{start:437,end:355},{start:282,end:443},{start:443,end:283},{start:283,end:282},{start:281,end:275},{start:275,end:363},{start:363,end:281},{start:395,end:431},{start:431,end:369},{start:369,end:395},{start:299,end:297},{start:297,end:337},{start:337,end:299},{start:335,end:273},{start:273,end:321},{start:321,end:335},{start:348,end:450},{start:450,end:349},{start:349,end:348},{start:359,end:446},{start:446,end:467},{start:467,end:359},{start:283,end:293},{start:293,end:282},{start:282,end:283},{start:250,end:458},{start:458,end:462},{start:462,end:250},{start:300,end:276},{start:276,end:383},{start:383,end:300},{start:292,end:308},{start:308,end:325},{start:325,end:292},{start:283,end:276},{start:276,end:293},{start:293,end:283},{start:264,end:372},{start:372,end:447},{start:447,end:264},{start:346,end:352},{start:352,end:340},{start:340,end:346},{start:354,end:274},{start:274,end:19},{start:19,end:354},{start:363,end:456},{start:456,end:281},{start:281,end:363},{start:426,end:436},{start:436,end:425},{start:425,end:426},{start:380,end:381},{start:381,end:252},{start:252,end:380},{start:267,end:269},{start:269,end:393},{start:393,end:267},{start:421,end:200},{start:200,end:428},{start:428,end:421},{start:371,end:266},{start:266,end:329},{start:329,end:371},{start:432,end:287},{start:287,end:422},{start:422,end:432},{start:290,end:250},{start:250,end:328},{start:328,end:290},{start:385,end:258},{start:258,end:384},{start:384,end:385},{start:446,end:265},{start:265,end:342},{start:342,end:446},{start:386,end:387},{start:387,end:257},{start:257,end:386},{start:422,end:424},{start:424,end:430},{start:430,end:422},{start:445,end:342},{start:342,end:276},{start:276,end:445},{start:422,end:273},{start:273,end:424},{start:424,end:422},{start:306,end:292},{start:292,end:307},{start:307,end:306},{start:352,end:366},{start:366,end:345},{start:345,end:352},{start:268,end:271},{start:271,end:302},{start:302,end:268},{start:358,end:423},{start:423,end:371},{start:371,end:358},{start:327,end:294},{start:294,end:460},{start:460,end:327},{start:331,end:279},{start:279,end:294},{start:294,end:331},{start:303,end:271},{start:271,end:304},{start:304,end:303},{start:436,end:432},{start:432,end:427},{start:427,end:436},{start:304,end:272},{start:272,end:408},{start:408,end:304},{start:395,end:394},{start:394,end:431},{start:431,end:395},{start:378,end:395},{start:395,end:400},{start:400,end:378},{start:296,end:334},{start:334,end:299},{start:299,end:296},{start:6,end:351},{start:351,end:168},{start:168,end:6},{start:376,end:352},{start:352,end:411},{start:411,end:376},{start:307,end:325},{start:325,end:320},{start:320,end:307},{start:285,end:295},{start:295,end:336},{start:336,end:285},{start:320,end:319},{start:319,end:404},{start:404,end:320},{start:329,end:330},{start:330,end:349},{start:349,end:329},{start:334,end:293},{start:293,end:333},{start:333,end:334},{start:366,end:323},{start:323,end:447},{start:447,end:366},{start:316,end:15},{start:15,end:315},{start:315,end:316},{start:331,end:358},{start:358,end:279},{start:279,end:331},{start:317,end:14},{start:14,end:316},{start:316,end:317},{start:8,end:285},{start:285,end:9},{start:9,end:8},{start:277,end:329},{start:329,end:350},{start:350,end:277},{start:253,end:374},{start:374,end:252},{start:252,end:253},{start:319,end:318},{start:318,end:403},{start:403,end:319},{start:351,end:6},{start:6,end:419},{start:419,end:351},{start:324,end:318},{start:318,end:325},{start:325,end:324},{start:397,end:367},{start:367,end:365},{start:365,end:397},{start:288,end:435},{start:435,end:397},{start:397,end:288},{start:278,end:344},{start:344,end:439},{start:439,end:278},{start:310,end:272},{start:272,end:311},{start:311,end:310},{start:248,end:195},{start:195,end:281},{start:281,end:248},{start:375,end:273},{start:273,end:291},{start:291,end:375},{start:175,end:396},{start:396,end:199},{start:199,end:175},{start:312,end:311},{start:311,end:268},{start:268,end:312},{start:276,end:283},{start:283,end:445},{start:445,end:276},{start:390,end:373},{start:373,end:339},{start:339,end:390},{start:295,end:282},{start:282,end:296},{start:296,end:295},{start:448,end:449},{start:449,end:346},{start:346,end:448},{start:356,end:264},{start:264,end:454},{start:454,end:356},{start:337,end:336},{start:336,end:299},{start:299,end:337},{start:337,end:338},{start:338,end:151},{start:151,end:337},{start:294,end:278},{start:278,end:455},{start:455,end:294},{start:308,end:292},{start:292,end:415},{start:415,end:308},{start:429,end:358},{start:358,end:355},{start:355,end:429},{start:265,end:340},{start:340,end:372},{start:372,end:265},{start:352,end:346},{start:346,end:280},{start:280,end:352},{start:295,end:442},{start:442,end:282},{start:282,end:295},{start:354,end:19},{start:19,end:370},{start:370,end:354},{start:285,end:441},{start:441,end:295},{start:295,end:285},{start:195,end:248},{start:248,end:197},{start:197,end:195},{start:457,end:440},{start:440,end:274},{start:274,end:457},{start:301,end:300},{start:300,end:368},{start:368,end:301},{start:417,end:351},{start:351,end:465},{start:465,end:417},{start:251,end:301},{start:301,end:389},{start:389,end:251},{start:394,end:395},{start:395,end:379},{start:379,end:394},{start:399,end:412},{start:412,end:419},{start:419,end:399},{start:410,end:436},{start:436,end:322},{start:322,end:410},{start:326,end:2},{start:2,end:393},{start:393,end:326},{start:354,end:370},{start:370,end:461},{start:461,end:354},{start:393,end:164},{start:164,end:267},{start:267,end:393},{start:268,end:302},{start:302,end:12},{start:12,end:268},{start:312,end:268},{start:268,end:13},{start:13,end:312},{start:298,end:293},{start:293,end:301},{start:301,end:298},{start:265,end:446},{start:446,end:340},{start:340,end:265},{start:280,end:330},{start:330,end:425},{start:425,end:280},{start:322,end:426},{start:426,end:391},{start:391,end:322},{start:420,end:429},{start:429,end:437},{start:437,end:420},{start:393,end:391},{start:391,end:326},{start:326,end:393},{start:344,end:440},{start:440,end:438},{start:438,end:344},{start:458,end:459},{start:459,end:461},{start:461,end:458},{start:364,end:434},{start:434,end:394},{start:394,end:364},{start:428,end:396},{start:396,end:262},{start:262,end:428},{start:274,end:354},{start:354,end:457},{start:457,end:274},{start:317,end:316},{start:316,end:402},{start:402,end:317},{start:316,end:315},{start:315,end:403},{start:403,end:316},{start:315,end:314},{start:314,end:404},{start:404,end:315},{start:314,end:313},{start:313,end:405},{start:405,end:314},{start:313,end:421},{start:421,end:406},{start:406,end:313},{start:323,end:366},{start:366,end:361},{start:361,end:323},{start:292,end:306},{start:306,end:407},{start:407,end:292},{start:306,end:291},{start:291,end:408},{start:408,end:306},{start:291,end:287},{start:287,end:409},{start:409,end:291},{start:287,end:432},{start:432,end:410},{start:410,end:287},{start:427,end:434},{start:434,end:411},{start:411,end:427},{start:372,end:264},{start:264,end:383},{start:383,end:372},{start:459,end:309},{start:309,end:457},{start:457,end:459},{start:366,end:352},{start:352,end:401},{start:401,end:366},{start:1,end:274},{start:274,end:4},{start:4,end:1},{start:418,end:421},{start:421,end:262},{start:262,end:418},{start:331,end:294},{start:294,end:358},{start:358,end:331},{start:435,end:433},{start:433,end:367},{start:367,end:435},{start:392,end:289},{start:289,end:439},{start:439,end:392},{start:328,end:462},{start:462,end:326},{start:326,end:328},{start:94,end:2},{start:2,end:370},{start:370,end:94},{start:289,end:305},{start:305,end:455},{start:455,end:289},{start:339,end:254},{start:254,end:448},{start:448,end:339},{start:359,end:255},{start:255,end:446},{start:446,end:359},{start:254,end:253},{start:253,end:449},{start:449,end:254},{start:253,end:252},{start:252,end:450},{start:450,end:253},{start:252,end:256},{start:256,end:451},{start:451,end:252},{start:256,end:341},{start:341,end:452},{start:452,end:256},{start:414,end:413},{start:413,end:463},{start:463,end:414},{start:286,end:441},{start:441,end:414},{start:414,end:286},{start:286,end:258},{start:258,end:441},{start:441,end:286},{start:258,end:257},{start:257,end:442},{start:442,end:258},{start:257,end:259},{start:259,end:443},{start:443,end:257},{start:259,end:260},{start:260,end:444},{start:444,end:259},{start:260,end:467},{start:467,end:445},{start:445,end:260},{start:309,end:459},{start:459,end:250},{start:250,end:309},{start:305,end:289},{start:289,end:290},{start:290,end:305},{start:305,end:290},{start:290,end:460},{start:460,end:305},{start:401,end:376},{start:376,end:435},{start:435,end:401},{start:309,end:250},{start:250,end:392},{start:392,end:309},{start:376,end:411},{start:411,end:433},{start:433,end:376},{start:453,end:341},{start:341,end:464},{start:464,end:453},{start:357,end:453},{start:453,end:465},{start:465,end:357},{start:343,end:357},{start:357,end:412},{start:412,end:343},{start:437,end:343},{start:343,end:399},{start:399,end:437},{start:344,end:360},{start:360,end:440},{start:440,end:344},{start:420,end:437},{start:437,end:456},{start:456,end:420},{start:360,end:420},{start:420,end:363},{start:363,end:360},{start:361,end:401},{start:401,end:288},{start:288,end:361},{start:265,end:372},{start:372,end:353},{start:353,end:265},{start:390,end:339},{start:339,end:249},{start:249,end:390},{start:339,end:448},{start:448,end:255},{start:255,end:339}];var face_landmarker_options={};Object.defineProperty(face_landmarker_options,"__esModule",{value:!0});var face_landmarker_result={};Object.defineProperty(face_landmarker_result,"__esModule",{value:!0}),function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,i)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(e,r){for(var o in e)"default"===o||Object.prototype.hasOwnProperty.call(r,o)||t(r,e,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.FaceLandmarker=void 0;const o=calculator_pb,i=calculator_options_pb,a=classification_pb,n=landmark_pb,s=base_options_pb,p=face_detector_graph_options_pb,d=face_geometry_pb,l=face_landmarker_graph_options_pb,g=face_landmarks_detector_graph_options_pb,c=classifier_result,u=landmark_result,m=vision_task_runner,f=face_landmarks_connections;r(face_landmarker_options,e),r(face_landmarker_result,e);const h="image_in",y="norm_rect",b="face_landmarks",_="blendshapes",O="face_geometry",F=.5;class M extends m.VisionTaskRunner{static createFromOptions(e,t){return m.VisionTaskRunner.createVisionInstance(M,e,t)}static createFromModelBuffer(e,t){return m.VisionTaskRunner.createVisionInstance(M,e,{baseOptions:{modelAssetBuffer:t}})}static createFromModelPath(e,t){return m.VisionTaskRunner.createVisionInstance(M,e,{baseOptions:{modelAssetPath:t}})}constructor(e,t){super(new m.VisionGraphRunner(e,t),h,y,!1),this.result={faceLandmarks:[]},this.outputFaceBlendshapes=!1,this.outputFacialTransformationMatrixes=!1,this.options=new l.FaceLandmarkerGraphOptions,this.options.setBaseOptions(new s.BaseOptions),this.faceLandmarksDetectorGraphOptions=new g.FaceLandmarksDetectorGraphOptions,this.options.setFaceLandmarksDetectorGraphOptions(this.faceLandmarksDetectorGraphOptions),this.faceDetectorGraphOptions=new p.FaceDetectorGraphOptions,this.options.setFaceDetectorGraphOptions(this.faceDetectorGraphOptions),this.initDefaults()}get baseOptions(){return this.options.getBaseOptions()}set baseOptions(e){this.options.setBaseOptions(e)}setOptions(e){var t,r,o,i;return"numFaces"in e&&this.faceDetectorGraphOptions.setNumFaces(null!==(t=e.numFaces)&&void 0!==t?t:1),"minFaceDetectionConfidence"in e&&this.faceDetectorGraphOptions.setMinDetectionConfidence(null!==(r=e.minFaceDetectionConfidence)&&void 0!==r?r:F),"minTrackingConfidence"in e&&this.options.setMinTrackingConfidence(null!==(o=e.minTrackingConfidence)&&void 0!==o?o:F),"minFacePresenceConfidence"in e&&this.faceLandmarksDetectorGraphOptions.setMinDetectionConfidence(null!==(i=e.minFacePresenceConfidence)&&void 0!==i?i:F),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"outputFacialTransformationMatrixes"in e&&(this.outputFacialTransformationMatrixes=!!e.outputFacialTransformationMatrixes),this.applyOptions(e)}detect(e,t){return this.resetResults(),this.processImageData(e,t),this.result}detectForVideo(e,t,r){return this.resetResults(),this.processVideoData(e,r,t),this.result}resetResults(){this.result={faceLandmarks:[]},this.outputFaceBlendshapes&&(this.result.faceBlendshapes=[]),this.outputFacialTransformationMatrixes&&(this.result.facialTransformationMatrixes=[])}initDefaults(){this.faceDetectorGraphOptions.setNumFaces(1),this.faceDetectorGraphOptions.setMinDetectionConfidence(F),this.faceLandmarksDetectorGraphOptions.setMinDetectionConfidence(F),this.options.setMinTrackingConfidence(F)}addJsLandmarks(e){for(const t of e){const e=n.NormalizedLandmarkList.deserializeBinary(t);this.result.faceLandmarks.push((0,u.convertToLandmarks)(e))}}addBlenshape(e){var t;if(this.result.faceBlendshapes)for(const r of e){const e=a.ClassificationList.deserializeBinary(r);this.result.faceBlendshapes.push((0,c.convertFromClassifications)(null!==(t=e.getClassificationList())&&void 0!==t?t:[]))}}addFacialTransformationMatrixes(e){var t,r,o;if(this.result.facialTransformationMatrixes)for(const i of e){const e=d.FaceGeometry.deserializeBinary(i).getPoseTransformMatrix();e&&this.result.facialTransformationMatrixes.push({rows:null!==(t=e.getRows())&&void 0!==t?t:0,columns:null!==(r=e.getCols())&&void 0!==r?r:0,data:null!==(o=e.getPackedDataList())&&void 0!==o?o:[]})}}refreshGraph(){const e=new o.CalculatorGraphConfig;e.addInputStream(h),e.addInputStream(y),e.addOutputStream(b);const t=new i.CalculatorOptions;t.setExtension(l.FaceLandmarkerGraphOptions.ext,this.options);const r=new o.CalculatorGraphConfig.Node;r.setCalculator("mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),r.addInputStream("IMAGE:"+h),r.addInputStream("NORM_RECT:"+y),r.addOutputStream("NORM_LANDMARKS:"+b),r.setOptions(t),e.addNode(r),this.graphRunner.attachProtoVectorListener(b,((e,t)=>{this.addJsLandmarks(e),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(b,(e=>{this.setLatestOutputTimestamp(e)})),this.outputFaceBlendshapes&&(e.addOutputStream(_),r.addOutputStream("BLENDSHAPES:"+_),this.graphRunner.attachProtoVectorListener(_,((e,t)=>{this.addBlenshape(e),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(_,(e=>{this.setLatestOutputTimestamp(e)}))),this.outputFacialTransformationMatrixes&&(e.addOutputStream(O),r.addOutputStream("FACE_GEOMETRY:"+O),this.graphRunner.attachProtoVectorListener(O,((e,t)=>{this.addFacialTransformationMatrixes(e),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(O,(e=>{this.setLatestOutputTimestamp(e)})));const a=e.serializeBinary();this.setGraph(new Uint8Array(a),!0)}}e.FaceLandmarker=M,M.FACE_LANDMARKS_LIPS=f.FACE_LANDMARKS_LIPS,M.FACE_LANDMARKS_LEFT_EYE=f.FACE_LANDMARKS_LEFT_EYE,M.FACE_LANDMARKS_LEFT_EYEBROW=f.FACE_LANDMARKS_LEFT_EYEBROW,M.FACE_LANDMARKS_LEFT_IRIS=f.FACE_LANDMARKS_LEFT_IRIS,M.FACE_LANDMARKS_RIGHT_EYE=f.FACE_LANDMARKS_RIGHT_EYE,M.FACE_LANDMARKS_RIGHT_EYEBROW=f.FACE_LANDMARKS_RIGHT_EYEBROW,M.FACE_LANDMARKS_RIGHT_IRIS=f.FACE_LANDMARKS_RIGHT_IRIS,M.FACE_LANDMARKS_FACE_OVAL=f.FACE_LANDMARKS_FACE_OVAL,M.FACE_LANDMARKS_CONTOURS=f.FACE_LANDMARKS_CONTOURS,M.FACE_LANDMARKS_TESSELATION=f.FACE_LANDMARKS_TESSELATION}(face_landmarker);var face_stylizer={},face_stylizer_graph_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n);var s=face_landmarker_graph_options_pb;r.object.extend(proto,s),r.exportSymbol("proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions",null,o),proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.displayName="proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.toObject=function(e,t){var r,o={baseOptions:(r=t.getBaseOptions())&&n.BaseOptions.toObject(e,r),faceLandmarkerGraphOptions:(r=t.getFaceLandmarkerGraphOptions())&&s.FaceLandmarkerGraphOptions.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions;return proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=new s.FaceLandmarkerGraphOptions;t.readMessage(r,s.FaceLandmarkerGraphOptions.deserializeBinaryFromReader),e.setFaceLandmarkerGraphOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.serializeBinaryToWriter=function(e,t){var r=void 0;null!=(r=e.getBaseOptions())&&t.writeMessage(1,r,n.BaseOptions.serializeBinaryToWriter),null!=(r=e.getFaceLandmarkerGraphOptions())&&t.writeMessage(2,r,s.FaceLandmarkerGraphOptions.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.ext=new t.ExtensionFieldInfo(513916220,{ext:0},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions,proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[513916220]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[513916220]=proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.ext,proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.prototype.getFaceLandmarkerGraphOptions=function(){return t.Message.getWrapperField(this,s.FaceLandmarkerGraphOptions,2)},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.prototype.setFaceLandmarkerGraphOptions=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.prototype.clearFaceLandmarkerGraphOptions=function(){return this.setFaceLandmarkerGraphOptions(void 0)},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.prototype.hasFaceLandmarkerGraphOptions=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.ext=new t.ExtensionFieldInfo(513916220,{ext:0},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions,proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[513916220]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[513916220]=proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.face_stylizer.proto)}(face_stylizer_graph_options_pb);var face_stylizer_options={};Object.defineProperty(face_stylizer_options,"__esModule",{value:!0}),function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,i)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(e,r){for(var o in e)"default"===o||Object.prototype.hasOwnProperty.call(r,o)||t(r,e,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.FaceStylizer=void 0;const o=calculator_pb,i=calculator_options_pb,a=base_options_pb,n=face_stylizer_graph_options_pb,s=vision_task_runner;r(face_stylizer_options,e);const p="image_in",d="norm_rect",l="stylized_image";class g extends s.VisionTaskRunner{static createFromOptions(e,t){return s.VisionTaskRunner.createVisionInstance(g,e,t)}static createFromModelBuffer(e,t){return s.VisionTaskRunner.createVisionInstance(g,e,{baseOptions:{modelAssetBuffer:t}})}static createFromModelPath(e,t){return s.VisionTaskRunner.createVisionInstance(g,e,{baseOptions:{modelAssetPath:t}})}constructor(e,t){super(new s.VisionGraphRunner(e,t),p,d,!0),this.options=new n.FaceStylizerGraphOptions,this.options.setBaseOptions(new a.BaseOptions)}get baseOptions(){return this.options.getBaseOptions()}set baseOptions(e){this.options.setBaseOptions(e)}setOptions(e){return super.applyOptions(e)}stylize(e,t,r){const o="function"!=typeof t?t:{};if(this.userCallback="function"==typeof t?t:r,this.processImageData(e,null!=o?o:{}),!this.userCallback)return this.result}stylizeForVideo(e,t,r,o){const i="function"!=typeof r?r:{};if(this.userCallback="function"==typeof r?r:o,this.processVideoData(e,i,t),this.userCallback=void 0,!this.userCallback)return this.result}refreshGraph(){const e=new o.CalculatorGraphConfig;e.addInputStream(p),e.addInputStream(d),e.addOutputStream(l);const t=new i.CalculatorOptions;t.setExtension(n.FaceStylizerGraphOptions.ext,this.options);const r=new o.CalculatorGraphConfig.Node;r.setCalculator("mediapipe.tasks.vision.face_stylizer.FaceStylizerGraph"),r.addInputStream("IMAGE:"+p),r.addInputStream("NORM_RECT:"+d),r.addOutputStream("STYLIZED_IMAGE:"+l),r.setOptions(t),e.addNode(r),this.graphRunner.attachImageListener(l,((e,t)=>{const r=this.convertToMPImage(e,!this.userCallback);this.result=r,this.userCallback&&this.userCallback(r),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(l,(e=>{this.result=null,this.userCallback&&this.userCallback(null),this.setLatestOutputTimestamp(e)}));const a=e.serializeBinary();this.setGraph(new Uint8Array(a),!0)}}e.FaceStylizer=g}(face_stylizer);var gesture_recognizer={},gesture_classifier_graph_options_pb={},classifier_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.tasks.components.processors.proto.ClassifierOptions",null,o),proto.mediapipe.tasks.components.processors.proto.ClassifierOptions=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.repeatedFields_,null)},r.inherits(proto.mediapipe.tasks.components.processors.proto.ClassifierOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.displayName="proto.mediapipe.tasks.components.processors.proto.ClassifierOptions"),proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.repeatedFields_=[4,5],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.toObject(e,this)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.toObject=function(e,r){var o,i={displayNamesLocale:t.Message.getFieldWithDefault(r,1,"en"),maxResults:t.Message.getFieldWithDefault(r,2,-1),scoreThreshold:null==(o=t.Message.getOptionalFloatingPointField(r,3))?void 0:o,categoryAllowlistList:null==(o=t.Message.getRepeatedField(r,4))?void 0:o,categoryDenylistList:null==(o=t.Message.getRepeatedField(r,5))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.components.processors.proto.ClassifierOptions;return proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setDisplayNamesLocale(r);break;case 2:r=t.readInt32();e.setMaxResults(r);break;case 3:r=t.readFloat();e.setScoreThreshold(r);break;case 4:r=t.readString();e.addCategoryAllowlist(r);break;case 5:r=t.readString();e.addCategoryDenylist(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeString(1,o),null!=(o=t.Message.getField(e,2))&&r.writeInt32(2,o),null!=(o=t.Message.getField(e,3))&&r.writeFloat(3,o),(o=e.getCategoryAllowlistList()).length>0&&r.writeRepeatedString(4,o),(o=e.getCategoryDenylistList()).length>0&&r.writeRepeatedString(5,o)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.getDisplayNamesLocale=function(){return t.Message.getFieldWithDefault(this,1,"en")},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.setDisplayNamesLocale=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.clearDisplayNamesLocale=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.hasDisplayNamesLocale=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.getMaxResults=function(){return t.Message.getFieldWithDefault(this,2,-1)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.setMaxResults=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.clearMaxResults=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.hasMaxResults=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.getScoreThreshold=function(){return t.Message.getFloatingPointFieldWithDefault(this,3,0)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.setScoreThreshold=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.clearScoreThreshold=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.hasScoreThreshold=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.getCategoryAllowlistList=function(){return t.Message.getRepeatedField(this,4)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.setCategoryAllowlistList=function(e){return t.Message.setField(this,4,e||[])},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.addCategoryAllowlist=function(e,r){return t.Message.addToRepeatedField(this,4,e,r)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.clearCategoryAllowlistList=function(){return this.setCategoryAllowlistList([])},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.getCategoryDenylistList=function(){return t.Message.getRepeatedField(this,5)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.setCategoryDenylistList=function(e){return t.Message.setField(this,5,e||[])},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.addCategoryDenylist=function(e,r){return t.Message.addToRepeatedField(this,5,e,r)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.clearCategoryDenylistList=function(){return this.setCategoryDenylistList([])},r.object.extend(e,proto.mediapipe.tasks.components.processors.proto)}(classifier_options_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=classifier_options_pb;r.object.extend(proto,n);var s=base_options_pb;r.object.extend(proto,s),r.exportSymbol("proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions",null,o),proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.displayName="proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.toObject=function(e,t){var r,o={baseOptions:(r=t.getBaseOptions())&&s.BaseOptions.toObject(e,r),classifierOptions:(r=t.getClassifierOptions())&&n.ClassifierOptions.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions;return proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new s.BaseOptions;t.readMessage(r,s.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=new n.ClassifierOptions;t.readMessage(r,n.ClassifierOptions.deserializeBinaryFromReader),e.setClassifierOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.serializeBinaryToWriter=function(e,t){var r=void 0;null!=(r=e.getBaseOptions())&&t.writeMessage(1,r,s.BaseOptions.serializeBinaryToWriter),null!=(r=e.getClassifierOptions())&&t.writeMessage(2,r,n.ClassifierOptions.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.ext=new t.ExtensionFieldInfo(478825465,{ext:0},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[478825465]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[478825465]=proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.ext,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,s.BaseOptions,1)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.prototype.getClassifierOptions=function(){return t.Message.getWrapperField(this,n.ClassifierOptions,2)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.prototype.setClassifierOptions=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.prototype.clearClassifierOptions=function(){return this.setClassifierOptions(void 0)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.prototype.hasClassifierOptions=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.ext=new t.ExtensionFieldInfo(478825465,{ext:0},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[478825465]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[478825465]=proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.gesture_recognizer.proto)}(gesture_classifier_graph_options_pb);var gesture_recognizer_graph_options_pb={},hand_gesture_recognizer_graph_options_pb={},gesture_embedder_graph_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n),r.exportSymbol("proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions",null,o),proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.displayName="proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.toObject=function(e,t){var r,o={baseOptions:(r=t.getBaseOptions())&&n.BaseOptions.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions;return proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r)}else t.skipField()}return e},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.serializeBinaryToWriter=function(e,t){var r;null!=(r=e.getBaseOptions())&&t.writeMessage(1,r,n.BaseOptions.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.ext=new t.ExtensionFieldInfo(478825422,{ext:0},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[478825422]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[478825422]=proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.ext,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.ext=new t.ExtensionFieldInfo(478825422,{ext:0},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[478825422]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[478825422]=proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.gesture_recognizer.proto)}(gesture_embedder_graph_options_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n);var s=gesture_classifier_graph_options_pb;r.object.extend(proto,s);var p=gesture_embedder_graph_options_pb;r.object.extend(proto,p),r.exportSymbol("proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions",null,o),proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.displayName="proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.toObject=function(e,t){var r,o={baseOptions:(r=t.getBaseOptions())&&n.BaseOptions.toObject(e,r),gestureEmbedderGraphOptions:(r=t.getGestureEmbedderGraphOptions())&&p.GestureEmbedderGraphOptions.toObject(e,r),cannedGestureClassifierGraphOptions:(r=t.getCannedGestureClassifierGraphOptions())&&s.GestureClassifierGraphOptions.toObject(e,r),customGestureClassifierGraphOptions:(r=t.getCustomGestureClassifierGraphOptions())&&s.GestureClassifierGraphOptions.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions;return proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=new p.GestureEmbedderGraphOptions;t.readMessage(r,p.GestureEmbedderGraphOptions.deserializeBinaryFromReader),e.setGestureEmbedderGraphOptions(r);break;case 3:r=new s.GestureClassifierGraphOptions;t.readMessage(r,s.GestureClassifierGraphOptions.deserializeBinaryFromReader),e.setCannedGestureClassifierGraphOptions(r);break;case 4:r=new s.GestureClassifierGraphOptions;t.readMessage(r,s.GestureClassifierGraphOptions.deserializeBinaryFromReader),e.setCustomGestureClassifierGraphOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.serializeBinaryToWriter=function(e,t){var r=void 0;null!=(r=e.getBaseOptions())&&t.writeMessage(1,r,n.BaseOptions.serializeBinaryToWriter),null!=(r=e.getGestureEmbedderGraphOptions())&&t.writeMessage(2,r,p.GestureEmbedderGraphOptions.serializeBinaryToWriter),null!=(r=e.getCannedGestureClassifierGraphOptions())&&t.writeMessage(3,r,s.GestureClassifierGraphOptions.serializeBinaryToWriter),null!=(r=e.getCustomGestureClassifierGraphOptions())&&t.writeMessage(4,r,s.GestureClassifierGraphOptions.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.ext=new t.ExtensionFieldInfo(463370452,{ext:0},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions,proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[463370452]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[463370452]=proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.ext,proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.getGestureEmbedderGraphOptions=function(){return t.Message.getWrapperField(this,p.GestureEmbedderGraphOptions,2)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.setGestureEmbedderGraphOptions=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.clearGestureEmbedderGraphOptions=function(){return this.setGestureEmbedderGraphOptions(void 0)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.hasGestureEmbedderGraphOptions=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.getCannedGestureClassifierGraphOptions=function(){return t.Message.getWrapperField(this,s.GestureClassifierGraphOptions,3)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.setCannedGestureClassifierGraphOptions=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.clearCannedGestureClassifierGraphOptions=function(){return this.setCannedGestureClassifierGraphOptions(void 0)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.hasCannedGestureClassifierGraphOptions=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.getCustomGestureClassifierGraphOptions=function(){return t.Message.getWrapperField(this,s.GestureClassifierGraphOptions,4)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.setCustomGestureClassifierGraphOptions=function(e){return t.Message.setWrapperField(this,4,e)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.clearCustomGestureClassifierGraphOptions=function(){return this.setCustomGestureClassifierGraphOptions(void 0)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.hasCustomGestureClassifierGraphOptions=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.ext=new t.ExtensionFieldInfo(463370452,{ext:0},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions,proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[463370452]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[463370452]=proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.gesture_recognizer.proto)}(hand_gesture_recognizer_graph_options_pb);var hand_landmarker_graph_options_pb={},hand_detector_graph_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n),r.exportSymbol("proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions",null,o),proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.displayName="proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.toObject=function(e,r){var o,i={baseOptions:(o=r.getBaseOptions())&&n.BaseOptions.toObject(e,o),minDetectionConfidence:t.Message.getFloatingPointFieldWithDefault(r,2,.5),numHands:null==(o=t.Message.getField(r,3))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions;return proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=t.readFloat();e.setMinDetectionConfidence(r);break;case 3:r=t.readInt32();e.setNumHands(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getBaseOptions())&&r.writeMessage(1,o,n.BaseOptions.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeFloat(2,o),null!=(o=t.Message.getField(e,3))&&r.writeInt32(3,o)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.ext=new t.ExtensionFieldInfo(464864288,{ext:0},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions,proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[464864288]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[464864288]=proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.ext,proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.getMinDetectionConfidence=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,.5)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.setMinDetectionConfidence=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.clearMinDetectionConfidence=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.hasMinDetectionConfidence=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.getNumHands=function(){return t.Message.getFieldWithDefault(this,3,0)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.setNumHands=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.clearNumHands=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.hasNumHands=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.ext=new t.ExtensionFieldInfo(464864288,{ext:0},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions,proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[464864288]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[464864288]=proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.hand_detector.proto)}(hand_detector_graph_options_pb);var hand_landmarks_detector_graph_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n),r.exportSymbol("proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions",null,o),proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.displayName="proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.toObject=function(e,r){var o,i={baseOptions:(o=r.getBaseOptions())&&n.BaseOptions.toObject(e,o),minDetectionConfidence:t.Message.getFloatingPointFieldWithDefault(r,2,.5)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions;return proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=t.readFloat();e.setMinDetectionConfidence(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getBaseOptions())&&r.writeMessage(1,o,n.BaseOptions.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeFloat(2,o)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.ext=new t.ExtensionFieldInfo(474472470,{ext:0},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[474472470]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[474472470]=proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.ext,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.prototype.getMinDetectionConfidence=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,.5)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.prototype.setMinDetectionConfidence=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.prototype.clearMinDetectionConfidence=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.prototype.hasMinDetectionConfidence=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.ext=new t.ExtensionFieldInfo(474472470,{ext:0},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[474472470]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[474472470]=proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.hand_landmarker.proto)}(hand_landmarks_detector_graph_options_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n);var s=hand_detector_graph_options_pb;r.object.extend(proto,s);var p=hand_landmarks_detector_graph_options_pb;r.object.extend(proto,p),r.exportSymbol("proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions",null,o),proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.displayName="proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.toObject=function(e,r){var o,i={baseOptions:(o=r.getBaseOptions())&&n.BaseOptions.toObject(e,o),handDetectorGraphOptions:(o=r.getHandDetectorGraphOptions())&&s.HandDetectorGraphOptions.toObject(e,o),handLandmarksDetectorGraphOptions:(o=r.getHandLandmarksDetectorGraphOptions())&&p.HandLandmarksDetectorGraphOptions.toObject(e,o),minTrackingConfidence:t.Message.getFloatingPointFieldWithDefault(r,4,.5)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions;return proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=new s.HandDetectorGraphOptions;t.readMessage(r,s.HandDetectorGraphOptions.deserializeBinaryFromReader),e.setHandDetectorGraphOptions(r);break;case 3:r=new p.HandLandmarksDetectorGraphOptions;t.readMessage(r,p.HandLandmarksDetectorGraphOptions.deserializeBinaryFromReader),e.setHandLandmarksDetectorGraphOptions(r);break;case 4:r=t.readFloat();e.setMinTrackingConfidence(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getBaseOptions())&&r.writeMessage(1,o,n.BaseOptions.serializeBinaryToWriter),null!=(o=e.getHandDetectorGraphOptions())&&r.writeMessage(2,o,s.HandDetectorGraphOptions.serializeBinaryToWriter),null!=(o=e.getHandLandmarksDetectorGraphOptions())&&r.writeMessage(3,o,p.HandLandmarksDetectorGraphOptions.serializeBinaryToWriter),null!=(o=t.Message.getField(e,4))&&r.writeFloat(4,o)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.ext=new t.ExtensionFieldInfo(462713202,{ext:0},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[462713202]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[462713202]=proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.ext,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.getHandDetectorGraphOptions=function(){return t.Message.getWrapperField(this,s.HandDetectorGraphOptions,2)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.setHandDetectorGraphOptions=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.clearHandDetectorGraphOptions=function(){return this.setHandDetectorGraphOptions(void 0)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.hasHandDetectorGraphOptions=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.getHandLandmarksDetectorGraphOptions=function(){return t.Message.getWrapperField(this,p.HandLandmarksDetectorGraphOptions,3)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.setHandLandmarksDetectorGraphOptions=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.clearHandLandmarksDetectorGraphOptions=function(){return this.setHandLandmarksDetectorGraphOptions(void 0)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.hasHandLandmarksDetectorGraphOptions=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.getMinTrackingConfidence=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,.5)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.setMinTrackingConfidence=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.clearMinTrackingConfidence=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.hasMinTrackingConfidence=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.ext=new t.ExtensionFieldInfo(462713202,{ext:0},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[462713202]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[462713202]=proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.hand_landmarker.proto)}(hand_landmarker_graph_options_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n);var s=hand_gesture_recognizer_graph_options_pb;r.object.extend(proto,s);var p=hand_landmarker_graph_options_pb;r.object.extend(proto,p),r.exportSymbol("proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions",null,o),proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.displayName="proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.toObject=function(e,t){var r,o={baseOptions:(r=t.getBaseOptions())&&n.BaseOptions.toObject(e,r),handLandmarkerGraphOptions:(r=t.getHandLandmarkerGraphOptions())&&p.HandLandmarkerGraphOptions.toObject(e,r),handGestureRecognizerGraphOptions:(r=t.getHandGestureRecognizerGraphOptions())&&s.HandGestureRecognizerGraphOptions.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions;return proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=new p.HandLandmarkerGraphOptions;t.readMessage(r,p.HandLandmarkerGraphOptions.deserializeBinaryFromReader),e.setHandLandmarkerGraphOptions(r);break;case 3:r=new s.HandGestureRecognizerGraphOptions;t.readMessage(r,s.HandGestureRecognizerGraphOptions.deserializeBinaryFromReader),e.setHandGestureRecognizerGraphOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.serializeBinaryToWriter=function(e,t){var r=void 0;null!=(r=e.getBaseOptions())&&t.writeMessage(1,r,n.BaseOptions.serializeBinaryToWriter),null!=(r=e.getHandLandmarkerGraphOptions())&&t.writeMessage(2,r,p.HandLandmarkerGraphOptions.serializeBinaryToWriter),null!=(r=e.getHandGestureRecognizerGraphOptions())&&t.writeMessage(3,r,s.HandGestureRecognizerGraphOptions.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.ext=new t.ExtensionFieldInfo(479097054,{ext:0},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[479097054]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[479097054]=proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.ext,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.getHandLandmarkerGraphOptions=function(){return t.Message.getWrapperField(this,p.HandLandmarkerGraphOptions,2)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.setHandLandmarkerGraphOptions=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.clearHandLandmarkerGraphOptions=function(){return this.setHandLandmarkerGraphOptions(void 0)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.hasHandLandmarkerGraphOptions=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.getHandGestureRecognizerGraphOptions=function(){return t.Message.getWrapperField(this,s.HandGestureRecognizerGraphOptions,3)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.setHandGestureRecognizerGraphOptions=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.clearHandGestureRecognizerGraphOptions=function(){return this.setHandGestureRecognizerGraphOptions(void 0)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.hasHandGestureRecognizerGraphOptions=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.ext=new t.ExtensionFieldInfo(479097054,{ext:0},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[479097054]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[479097054]=proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.gesture_recognizer.proto)}(gesture_recognizer_graph_options_pb);var classifier_options={};Object.defineProperty(classifier_options,"__esModule",{value:!0}),classifier_options.convertClassifierOptionsToProto=void 0;const classifier_options_pb_1=classifier_options_pb;function convertClassifierOptionsToProto(e,t){const r=t?t.clone():new classifier_options_pb_1.ClassifierOptions;return void 0!==e.displayNamesLocale?r.setDisplayNamesLocale(e.displayNamesLocale):void 0===e.displayNamesLocale&&r.clearDisplayNamesLocale(),void 0!==e.maxResults?r.setMaxResults(e.maxResults):"maxResults"in e&&r.clearMaxResults(),void 0!==e.scoreThreshold?r.setScoreThreshold(e.scoreThreshold):"scoreThreshold"in e&&r.clearScoreThreshold(),void 0!==e.categoryAllowlist?r.setCategoryAllowlistList(e.categoryAllowlist):"categoryAllowlist"in e&&r.clearCategoryAllowlistList(),void 0!==e.categoryDenylist?r.setCategoryDenylistList(e.categoryDenylist):"categoryDenylist"in e&&r.clearCategoryDenylistList(),r}classifier_options.convertClassifierOptionsToProto=convertClassifierOptionsToProto;var hand_landmarks_connections={};Object.defineProperty(hand_landmarks_connections,"__esModule",{value:!0}),hand_landmarks_connections.HAND_CONNECTIONS=void 0,hand_landmarks_connections.HAND_CONNECTIONS=[{start:0,end:1},{start:1,end:2},{start:2,end:3},{start:3,end:4},{start:0,end:5},{start:5,end:6},{start:6,end:7},{start:7,end:8},{start:5,end:9},{start:9,end:10},{start:10,end:11},{start:11,end:12},{start:9,end:13},{start:13,end:14},{start:14,end:15},{start:15,end:16},{start:13,end:17},{start:0,end:17},{start:17,end:18},{start:18,end:19},{start:19,end:20}];var gesture_recognizer_options={};Object.defineProperty(gesture_recognizer_options,"__esModule",{value:!0});var gesture_recognizer_result={};Object.defineProperty(gesture_recognizer_result,"__esModule",{value:!0}),function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,i)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(e,r){for(var o in e)"default"===o||Object.prototype.hasOwnProperty.call(r,o)||t(r,e,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.GestureRecognizer=void 0;const o=calculator_pb,i=calculator_options_pb,a=classification_pb,n=landmark_pb,s=base_options_pb,p=gesture_classifier_graph_options_pb,d=gesture_recognizer_graph_options_pb,l=hand_gesture_recognizer_graph_options_pb,g=hand_detector_graph_options_pb,c=hand_landmarker_graph_options_pb,u=hand_landmarks_detector_graph_options_pb,m=classifier_options,f=vision_task_runner,h=hand_landmarks_connections;r(gesture_recognizer_options,e),r(gesture_recognizer_result,e);const y="image_in",b="norm_rect",_="hand_gestures",O="hand_landmarks",F="world_hand_landmarks",M="handedness",R=.5;class k extends f.VisionTaskRunner{static createFromOptions(e,t){return f.VisionTaskRunner.createVisionInstance(k,e,t)}static createFromModelBuffer(e,t){return f.VisionTaskRunner.createVisionInstance(k,e,{baseOptions:{modelAssetBuffer:t}})}static createFromModelPath(e,t){return f.VisionTaskRunner.createVisionInstance(k,e,{baseOptions:{modelAssetPath:t}})}constructor(e,t){super(new f.VisionGraphRunner(e,t),y,b,!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handednesses=[],this.options=new d.GestureRecognizerGraphOptions,this.options.setBaseOptions(new s.BaseOptions),this.handLandmarkerGraphOptions=new c.HandLandmarkerGraphOptions,this.options.setHandLandmarkerGraphOptions(this.handLandmarkerGraphOptions),this.handLandmarksDetectorGraphOptions=new u.HandLandmarksDetectorGraphOptions,this.handLandmarkerGraphOptions.setHandLandmarksDetectorGraphOptions(this.handLandmarksDetectorGraphOptions),this.handDetectorGraphOptions=new g.HandDetectorGraphOptions,this.handLandmarkerGraphOptions.setHandDetectorGraphOptions(this.handDetectorGraphOptions),this.handGestureRecognizerGraphOptions=new l.HandGestureRecognizerGraphOptions,this.options.setHandGestureRecognizerGraphOptions(this.handGestureRecognizerGraphOptions),this.handDetectorGraphOptions.setMinDetectionConfidence(R),this.handLandmarkerGraphOptions.setMinTrackingConfidence(R),this.handLandmarksDetectorGraphOptions.setMinDetectionConfidence(R)}get baseOptions(){return this.options.getBaseOptions()}set baseOptions(e){this.options.setBaseOptions(e)}setOptions(e){var t,r,o,i,a,n,s,d;if(this.handDetectorGraphOptions.setNumHands(null!==(t=e.numHands)&&void 0!==t?t:1),"minHandDetectionConfidence"in e&&this.handDetectorGraphOptions.setMinDetectionConfidence(null!==(r=e.minHandDetectionConfidence)&&void 0!==r?r:R),"minTrackingConfidence"in e&&this.handLandmarkerGraphOptions.setMinTrackingConfidence(null!==(o=e.minTrackingConfidence)&&void 0!==o?o:R),"minHandPresenceConfidence"in e&&this.handLandmarksDetectorGraphOptions.setMinDetectionConfidence(null!==(i=e.minHandPresenceConfidence)&&void 0!==i?i:R),e.cannedGesturesClassifierOptions){const t=new p.GestureClassifierGraphOptions;t.setClassifierOptions((0,m.convertClassifierOptionsToProto)(e.cannedGesturesClassifierOptions,null===(a=this.handGestureRecognizerGraphOptions.getCannedGestureClassifierGraphOptions())||void 0===a?void 0:a.getClassifierOptions())),this.handGestureRecognizerGraphOptions.setCannedGestureClassifierGraphOptions(t)}else void 0===e.cannedGesturesClassifierOptions&&(null===(n=this.handGestureRecognizerGraphOptions.getCannedGestureClassifierGraphOptions())||void 0===n||n.clearClassifierOptions());if(e.customGesturesClassifierOptions){const t=new p.GestureClassifierGraphOptions;t.setClassifierOptions((0,m.convertClassifierOptionsToProto)(e.customGesturesClassifierOptions,null===(s=this.handGestureRecognizerGraphOptions.getCustomGestureClassifierGraphOptions())||void 0===s?void 0:s.getClassifierOptions())),this.handGestureRecognizerGraphOptions.setCustomGestureClassifierGraphOptions(t)}else void 0===e.customGesturesClassifierOptions&&(null===(d=this.handGestureRecognizerGraphOptions.getCustomGestureClassifierGraphOptions())||void 0===d||d.clearClassifierOptions());return this.applyOptions(e)}recognize(e,t){return this.resetResults(),this.processImageData(e,t),this.processResults()}recognizeForVideo(e,t,r){return this.resetResults(),this.processVideoData(e,r,t),this.processResults()}resetResults(){this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handednesses=[]}processResults(){return 0===this.gestures.length?{gestures:[],landmarks:[],worldLandmarks:[],handednesses:[]}:{gestures:this.gestures,landmarks:this.landmarks,worldLandmarks:this.worldLandmarks,handednesses:this.handednesses}}toJsCategories(e,t=!0){var r,o,i;const n=[];for(const s of e){const e=a.ClassificationList.deserializeBinary(s),p=[];for(const a of e.getClassificationList()){const e=t&&a.hasIndex()?a.getIndex():-1;p.push({score:null!==(r=a.getScore())&&void 0!==r?r:0,index:e,categoryName:null!==(o=a.getLabel())&&void 0!==o?o:"",displayName:null!==(i=a.getDisplayName())&&void 0!==i?i:""})}n.push(p)}return n}addJsLandmarks(e){var t,r,o;for(const i of e){const e=n.NormalizedLandmarkList.deserializeBinary(i),a=[];for(const i of e.getLandmarkList())a.push({x:null!==(t=i.getX())&&void 0!==t?t:0,y:null!==(r=i.getY())&&void 0!==r?r:0,z:null!==(o=i.getZ())&&void 0!==o?o:0});this.landmarks.push(a)}}adddJsWorldLandmarks(e){var t,r,o;for(const i of e){const e=n.LandmarkList.deserializeBinary(i),a=[];for(const i of e.getLandmarkList())a.push({x:null!==(t=i.getX())&&void 0!==t?t:0,y:null!==(r=i.getY())&&void 0!==r?r:0,z:null!==(o=i.getZ())&&void 0!==o?o:0});this.worldLandmarks.push(a)}}refreshGraph(){const e=new o.CalculatorGraphConfig;e.addInputStream(y),e.addInputStream(b),e.addOutputStream(_),e.addOutputStream(O),e.addOutputStream(F),e.addOutputStream(M);const t=new i.CalculatorOptions;t.setExtension(d.GestureRecognizerGraphOptions.ext,this.options);const r=new o.CalculatorGraphConfig.Node;r.setCalculator("mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),r.addInputStream("IMAGE:"+y),r.addInputStream("NORM_RECT:"+b),r.addOutputStream("HAND_GESTURES:"+_),r.addOutputStream("LANDMARKS:"+O),r.addOutputStream("WORLD_LANDMARKS:"+F),r.addOutputStream("HANDEDNESS:"+M),r.setOptions(t),e.addNode(r),this.graphRunner.attachProtoVectorListener(O,((e,t)=>{this.addJsLandmarks(e),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(O,(e=>{this.setLatestOutputTimestamp(e)})),this.graphRunner.attachProtoVectorListener(F,((e,t)=>{this.adddJsWorldLandmarks(e),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(F,(e=>{this.setLatestOutputTimestamp(e)})),this.graphRunner.attachProtoVectorListener(_,((e,t)=>{this.gestures.push(...this.toJsCategories(e,!1)),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(_,(e=>{this.setLatestOutputTimestamp(e)})),this.graphRunner.attachProtoVectorListener(M,((e,t)=>{this.handednesses.push(...this.toJsCategories(e)),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(M,(e=>{this.setLatestOutputTimestamp(e)}));const a=e.serializeBinary();this.setGraph(new Uint8Array(a),!0)}}e.GestureRecognizer=k,k.HAND_CONNECTIONS=h.HAND_CONNECTIONS}(gesture_recognizer);var hand_landmarker={},hand_landmarker_options={};Object.defineProperty(hand_landmarker_options,"__esModule",{value:!0});var hand_landmarker_result={};Object.defineProperty(hand_landmarker_result,"__esModule",{value:!0}),function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,i)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(e,r){for(var o in e)"default"===o||Object.prototype.hasOwnProperty.call(r,o)||t(r,e,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.HandLandmarker=void 0;const o=calculator_pb,i=calculator_options_pb,a=classification_pb,n=landmark_pb,s=base_options_pb,p=hand_detector_graph_options_pb,d=hand_landmarker_graph_options_pb,l=hand_landmarks_detector_graph_options_pb,g=landmark_result,c=vision_task_runner,u=hand_landmarks_connections;r(hand_landmarker_options,e),r(hand_landmarker_result,e);const m="image_in",f="norm_rect",h="hand_landmarks",y="world_hand_landmarks",b="handedness",_=.5;class O extends c.VisionTaskRunner{static createFromOptions(e,t){return c.VisionTaskRunner.createVisionInstance(O,e,t)}static createFromModelBuffer(e,t){return c.VisionTaskRunner.createVisionInstance(O,e,{baseOptions:{modelAssetBuffer:t}})}static createFromModelPath(e,t){return c.VisionTaskRunner.createVisionInstance(O,e,{baseOptions:{modelAssetPath:t}})}constructor(e,t){super(new c.VisionGraphRunner(e,t),m,f,!1),this.landmarks=[],this.worldLandmarks=[],this.handednesses=[],this.options=new d.HandLandmarkerGraphOptions,this.options.setBaseOptions(new s.BaseOptions),this.handLandmarksDetectorGraphOptions=new l.HandLandmarksDetectorGraphOptions,this.options.setHandLandmarksDetectorGraphOptions(this.handLandmarksDetectorGraphOptions),this.handDetectorGraphOptions=new p.HandDetectorGraphOptions,this.options.setHandDetectorGraphOptions(this.handDetectorGraphOptions),this.initDefaults()}get baseOptions(){return this.options.getBaseOptions()}set baseOptions(e){this.options.setBaseOptions(e)}setOptions(e){var t,r,o,i;return"numHands"in e&&this.handDetectorGraphOptions.setNumHands(null!==(t=e.numHands)&&void 0!==t?t:1),"minHandDetectionConfidence"in e&&this.handDetectorGraphOptions.setMinDetectionConfidence(null!==(r=e.minHandDetectionConfidence)&&void 0!==r?r:_),"minTrackingConfidence"in e&&this.options.setMinTrackingConfidence(null!==(o=e.minTrackingConfidence)&&void 0!==o?o:_),"minHandPresenceConfidence"in e&&this.handLandmarksDetectorGraphOptions.setMinDetectionConfidence(null!==(i=e.minHandPresenceConfidence)&&void 0!==i?i:_),this.applyOptions(e)}detect(e,t){return this.resetResults(),this.processImageData(e,t),this.processResults()}detectForVideo(e,t,r){return this.resetResults(),this.processVideoData(e,r,t),this.processResults()}resetResults(){this.landmarks=[],this.worldLandmarks=[],this.handednesses=[]}processResults(){return{landmarks:this.landmarks,worldLandmarks:this.worldLandmarks,handednesses:this.handednesses}}initDefaults(){this.handDetectorGraphOptions.setNumHands(1),this.handDetectorGraphOptions.setMinDetectionConfidence(_),this.handLandmarksDetectorGraphOptions.setMinDetectionConfidence(_),this.options.setMinTrackingConfidence(_)}toJsCategories(e){var t,r,o,i;const n=[];for(const s of e){const e=a.ClassificationList.deserializeBinary(s),p=[];for(const a of e.getClassificationList())p.push({score:null!==(t=a.getScore())&&void 0!==t?t:0,index:null!==(r=a.getIndex())&&void 0!==r?r:-1,categoryName:null!==(o=a.getLabel())&&void 0!==o?o:"",displayName:null!==(i=a.getDisplayName())&&void 0!==i?i:""});n.push(p)}return n}addJsLandmarks(e){for(const t of e){const e=n.NormalizedLandmarkList.deserializeBinary(t);this.landmarks.push((0,g.convertToLandmarks)(e))}}adddJsWorldLandmarks(e){for(const t of e){const e=n.LandmarkList.deserializeBinary(t);this.worldLandmarks.push((0,g.convertToWorldLandmarks)(e))}}refreshGraph(){const e=new o.CalculatorGraphConfig;e.addInputStream(m),e.addInputStream(f),e.addOutputStream(h),e.addOutputStream(y),e.addOutputStream(b);const t=new i.CalculatorOptions;t.setExtension(d.HandLandmarkerGraphOptions.ext,this.options);const r=new o.CalculatorGraphConfig.Node;r.setCalculator("mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),r.addInputStream("IMAGE:"+m),r.addInputStream("NORM_RECT:"+f),r.addOutputStream("LANDMARKS:"+h),r.addOutputStream("WORLD_LANDMARKS:"+y),r.addOutputStream("HANDEDNESS:"+b),r.setOptions(t),e.addNode(r),this.graphRunner.attachProtoVectorListener(h,((e,t)=>{this.addJsLandmarks(e),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(h,(e=>{this.setLatestOutputTimestamp(e)})),this.graphRunner.attachProtoVectorListener(y,((e,t)=>{this.adddJsWorldLandmarks(e),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(y,(e=>{this.setLatestOutputTimestamp(e)})),this.graphRunner.attachProtoVectorListener(b,((e,t)=>{this.handednesses.push(...this.toJsCategories(e)),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(b,(e=>{this.setLatestOutputTimestamp(e)}));const a=e.serializeBinary();this.setGraph(new Uint8Array(a),!0)}}e.HandLandmarker=O,O.HAND_CONNECTIONS=u.HAND_CONNECTIONS}(hand_landmarker);var image_classifier={},classifications_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=classification_pb;r.object.extend(proto,i),r.exportSymbol("proto.mediapipe.tasks.components.containers.proto.ClassificationResult",null,o),r.exportSymbol("proto.mediapipe.tasks.components.containers.proto.Classifications",null,o),proto.mediapipe.tasks.components.containers.proto.Classifications=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.components.containers.proto.Classifications,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.components.containers.proto.Classifications.displayName="proto.mediapipe.tasks.components.containers.proto.Classifications"),proto.mediapipe.tasks.components.containers.proto.ClassificationResult=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.tasks.components.containers.proto.ClassificationResult.repeatedFields_,null)},r.inherits(proto.mediapipe.tasks.components.containers.proto.ClassificationResult,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.components.containers.proto.ClassificationResult.displayName="proto.mediapipe.tasks.components.containers.proto.ClassificationResult"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.toObject=function(e){return proto.mediapipe.tasks.components.containers.proto.Classifications.toObject(e,this)},proto.mediapipe.tasks.components.containers.proto.Classifications.toObject=function(e,r){var o,a={classificationList:(o=r.getClassificationList())&&i.ClassificationList.toObject(e,o),headIndex:null==(o=t.Message.getField(r,2))?void 0:o,headName:null==(o=t.Message.getField(r,3))?void 0:o};return e&&(a.$jspbMessageInstance=r),a}),proto.mediapipe.tasks.components.containers.proto.Classifications.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.components.containers.proto.Classifications;return proto.mediapipe.tasks.components.containers.proto.Classifications.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.components.containers.proto.Classifications.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 4:var r=new i.ClassificationList;t.readMessage(r,i.ClassificationList.deserializeBinaryFromReader),e.setClassificationList(r);break;case 2:r=t.readInt32();e.setHeadIndex(r);break;case 3:r=t.readString();e.setHeadName(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.components.containers.proto.Classifications.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.components.containers.proto.Classifications.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getClassificationList())&&r.writeMessage(4,o,i.ClassificationList.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeInt32(2,o),null!=(o=t.Message.getField(e,3))&&r.writeString(3,o)},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.getClassificationList=function(){return t.Message.getWrapperField(this,i.ClassificationList,4)},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.setClassificationList=function(e){return t.Message.setWrapperField(this,4,e)},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.clearClassificationList=function(){return this.setClassificationList(void 0)},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.hasClassificationList=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.getHeadIndex=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.setHeadIndex=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.clearHeadIndex=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.hasHeadIndex=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.getHeadName=function(){return t.Message.getFieldWithDefault(this,3,"")},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.setHeadName=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.clearHeadName=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.hasHeadName=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.components.containers.proto.ClassificationResult.prototype.toObject=function(e){return proto.mediapipe.tasks.components.containers.proto.ClassificationResult.toObject(e,this)},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.toObject=function(e,r){var o,i={classificationsList:t.Message.toObjectList(r.getClassificationsList(),proto.mediapipe.tasks.components.containers.proto.Classifications.toObject,e),timestampMs:null==(o=t.Message.getField(r,2))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.components.containers.proto.ClassificationResult.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.components.containers.proto.ClassificationResult;return proto.mediapipe.tasks.components.containers.proto.ClassificationResult.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new proto.mediapipe.tasks.components.containers.proto.Classifications;t.readMessage(r,proto.mediapipe.tasks.components.containers.proto.Classifications.deserializeBinaryFromReader),e.addClassifications(r);break;case 2:r=t.readInt64();e.setTimestampMs(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.components.containers.proto.ClassificationResult.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.serializeBinaryToWriter=function(e,r){var o=void 0;(o=e.getClassificationsList()).length>0&&r.writeRepeatedMessage(1,o,proto.mediapipe.tasks.components.containers.proto.Classifications.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeInt64(2,o)},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.prototype.getClassificationsList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.tasks.components.containers.proto.Classifications,1)},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.prototype.setClassificationsList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.prototype.addClassifications=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.tasks.components.containers.proto.Classifications,r)},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.prototype.clearClassificationsList=function(){return this.setClassificationsList([])},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.prototype.getTimestampMs=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.prototype.setTimestampMs=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.prototype.clearTimestampMs=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.prototype.hasTimestampMs=function(){return null!=t.Message.getField(this,2)},r.object.extend(e,proto.mediapipe.tasks.components.containers.proto)}(classifications_pb);var image_classifier_graph_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=classifier_options_pb;r.object.extend(proto,n);var s=base_options_pb;r.object.extend(proto,s),r.exportSymbol("proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions",null,o),proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.displayName="proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.toObject=function(e,t){var r,o={baseOptions:(r=t.getBaseOptions())&&s.BaseOptions.toObject(e,r),classifierOptions:(r=t.getClassifierOptions())&&n.ClassifierOptions.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions;return proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new s.BaseOptions;t.readMessage(r,s.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=new n.ClassifierOptions;t.readMessage(r,n.ClassifierOptions.deserializeBinaryFromReader),e.setClassifierOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.serializeBinaryToWriter=function(e,t){var r=void 0;null!=(r=e.getBaseOptions())&&t.writeMessage(1,r,s.BaseOptions.serializeBinaryToWriter),null!=(r=e.getClassifierOptions())&&t.writeMessage(2,r,n.ClassifierOptions.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.ext=new t.ExtensionFieldInfo(456383383,{ext:0},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions,proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[456383383]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[456383383]=proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.ext,proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,s.BaseOptions,1)},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.prototype.getClassifierOptions=function(){return t.Message.getWrapperField(this,n.ClassifierOptions,2)},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.prototype.setClassifierOptions=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.prototype.clearClassifierOptions=function(){return this.setClassifierOptions(void 0)},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.prototype.hasClassifierOptions=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.ext=new t.ExtensionFieldInfo(456383383,{ext:0},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions,proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[456383383]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[456383383]=proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.image_classifier.proto)}(image_classifier_graph_options_pb);var image_classifier_options={};Object.defineProperty(image_classifier_options,"__esModule",{value:!0});var image_classifier_result={};Object.defineProperty(image_classifier_result,"__esModule",{value:!0}),function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,i)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(e,r){for(var o in e)"default"===o||Object.prototype.hasOwnProperty.call(r,o)||t(r,e,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.ImageClassifier=void 0;const o=calculator_pb,i=calculator_options_pb,a=classifications_pb,n=base_options_pb,s=image_classifier_graph_options_pb,p=classifier_options,d=classifier_result,l=vision_task_runner,g="input_image",c="norm_rect",u="classifications";r(image_classifier_options,e),r(image_classifier_result,e);class m extends l.VisionTaskRunner{static createFromOptions(e,t){return l.VisionTaskRunner.createVisionInstance(m,e,t)}static createFromModelBuffer(e,t){return l.VisionTaskRunner.createVisionInstance(m,e,{baseOptions:{modelAssetBuffer:t}})}static createFromModelPath(e,t){return l.VisionTaskRunner.createVisionInstance(m,e,{baseOptions:{modelAssetPath:t}})}constructor(e,t){super(new l.VisionGraphRunner(e,t),g,c,!0),this.classificationResult={classifications:[]},this.options=new s.ImageClassifierGraphOptions,this.options.setBaseOptions(new n.BaseOptions)}get baseOptions(){return this.options.getBaseOptions()}set baseOptions(e){this.options.setBaseOptions(e)}setOptions(e){return this.options.setClassifierOptions((0,p.convertClassifierOptionsToProto)(e,this.options.getClassifierOptions())),this.applyOptions(e)}classify(e,t){return this.classificationResult={classifications:[]},this.processImageData(e,t),this.classificationResult}classifyForVideo(e,t,r){return this.classificationResult={classifications:[]},this.processVideoData(e,r,t),this.classificationResult}refreshGraph(){const e=new o.CalculatorGraphConfig;e.addInputStream(g),e.addInputStream(c),e.addOutputStream(u);const t=new i.CalculatorOptions;t.setExtension(s.ImageClassifierGraphOptions.ext,this.options);const r=new o.CalculatorGraphConfig.Node;r.setCalculator("mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),r.addInputStream("IMAGE:"+g),r.addInputStream("NORM_RECT:"+c),r.addOutputStream("CLASSIFICATIONS:"+u),r.setOptions(t),e.addNode(r),this.graphRunner.attachProtoListener(u,((e,t)=>{this.classificationResult=(0,d.convertFromClassificationResultProto)(a.ClassificationResult.deserializeBinary(e)),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(u,(e=>{this.setLatestOutputTimestamp(e)}));const n=e.serializeBinary();this.setGraph(new Uint8Array(n),!0)}}e.ImageClassifier=m}(image_classifier);var image_embedder={},embeddings_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.tasks.components.containers.proto.Embedding",null,o),r.exportSymbol("proto.mediapipe.tasks.components.containers.proto.Embedding.EmbeddingCase",null,o),r.exportSymbol("proto.mediapipe.tasks.components.containers.proto.EmbeddingResult",null,o),r.exportSymbol("proto.mediapipe.tasks.components.containers.proto.FloatEmbedding",null,o),r.exportSymbol("proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding",null,o),proto.mediapipe.tasks.components.containers.proto.FloatEmbedding=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.repeatedFields_,null)},r.inherits(proto.mediapipe.tasks.components.containers.proto.FloatEmbedding,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.displayName="proto.mediapipe.tasks.components.containers.proto.FloatEmbedding"),proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.displayName="proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding"),proto.mediapipe.tasks.components.containers.proto.Embedding=function(e){t.Message.initialize(this,e,0,-1,null,proto.mediapipe.tasks.components.containers.proto.Embedding.oneofGroups_)},r.inherits(proto.mediapipe.tasks.components.containers.proto.Embedding,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.components.containers.proto.Embedding.displayName="proto.mediapipe.tasks.components.containers.proto.Embedding"),proto.mediapipe.tasks.components.containers.proto.EmbeddingResult=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.repeatedFields_,null)},r.inherits(proto.mediapipe.tasks.components.containers.proto.EmbeddingResult,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.displayName="proto.mediapipe.tasks.components.containers.proto.EmbeddingResult"),proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.prototype.toObject=function(e){return proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.toObject(e,this)},proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.toObject=function(e,r){var o,i={valuesList:null==(o=t.Message.getRepeatedFloatingPointField(r,1))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.components.containers.proto.FloatEmbedding;return proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber())for(var r=t.isDelimited()?t.readPackedFloat():[t.readFloat()],o=0;o0&&t.writePackedFloat(1,r)},proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.prototype.getValuesList=function(){return t.Message.getRepeatedFloatingPointField(this,1)},proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.prototype.setValuesList=function(e){return t.Message.setField(this,1,e||[])},proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.prototype.addValues=function(e,r){return t.Message.addToRepeatedField(this,1,e,r)},proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.prototype.clearValuesList=function(){return this.setValuesList([])},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.prototype.toObject=function(e){return proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.toObject(e,this)},proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.toObject=function(e,t){var r={values:t.getValues_asB64()};return e&&(r.$jspbMessageInstance=t),r}),proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding;return proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=t.readBytes();e.setValues(r)}else t.skipField()}return e},proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.serializeBinaryToWriter=function(e,r){var o;null!=(o=t.Message.getField(e,1))&&r.writeBytes(1,o)},proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.prototype.getValues=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.prototype.getValues_asB64=function(){return t.Message.bytesAsB64(this.getValues())},proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.prototype.getValues_asU8=function(){return t.Message.bytesAsU8(this.getValues())},proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.prototype.setValues=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.prototype.clearValues=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.prototype.hasValues=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.components.containers.proto.Embedding.oneofGroups_=[[1,2]],proto.mediapipe.tasks.components.containers.proto.Embedding.EmbeddingCase={EMBEDDING_NOT_SET:0,FLOAT_EMBEDDING:1,QUANTIZED_EMBEDDING:2},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.getEmbeddingCase=function(){return t.Message.computeOneofCase(this,proto.mediapipe.tasks.components.containers.proto.Embedding.oneofGroups_[0])},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.toObject=function(e){return proto.mediapipe.tasks.components.containers.proto.Embedding.toObject(e,this)},proto.mediapipe.tasks.components.containers.proto.Embedding.toObject=function(e,r){var o,i={floatEmbedding:(o=r.getFloatEmbedding())&&proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.toObject(e,o),quantizedEmbedding:(o=r.getQuantizedEmbedding())&&proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.toObject(e,o),headIndex:null==(o=t.Message.getField(r,3))?void 0:o,headName:null==(o=t.Message.getField(r,4))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.components.containers.proto.Embedding.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.components.containers.proto.Embedding;return proto.mediapipe.tasks.components.containers.proto.Embedding.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.components.containers.proto.Embedding.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new proto.mediapipe.tasks.components.containers.proto.FloatEmbedding;t.readMessage(r,proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.deserializeBinaryFromReader),e.setFloatEmbedding(r);break;case 2:r=new proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding;t.readMessage(r,proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.deserializeBinaryFromReader),e.setQuantizedEmbedding(r);break;case 3:r=t.readInt32();e.setHeadIndex(r);break;case 4:r=t.readString();e.setHeadName(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.components.containers.proto.Embedding.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.components.containers.proto.Embedding.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getFloatEmbedding())&&r.writeMessage(1,o,proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.serializeBinaryToWriter),null!=(o=e.getQuantizedEmbedding())&&r.writeMessage(2,o,proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.serializeBinaryToWriter),null!=(o=t.Message.getField(e,3))&&r.writeInt32(3,o),null!=(o=t.Message.getField(e,4))&&r.writeString(4,o)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.getFloatEmbedding=function(){return t.Message.getWrapperField(this,proto.mediapipe.tasks.components.containers.proto.FloatEmbedding,1)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.setFloatEmbedding=function(e){return t.Message.setOneofWrapperField(this,1,proto.mediapipe.tasks.components.containers.proto.Embedding.oneofGroups_[0],e)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.clearFloatEmbedding=function(){return this.setFloatEmbedding(void 0)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.hasFloatEmbedding=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.getQuantizedEmbedding=function(){return t.Message.getWrapperField(this,proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding,2)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.setQuantizedEmbedding=function(e){return t.Message.setOneofWrapperField(this,2,proto.mediapipe.tasks.components.containers.proto.Embedding.oneofGroups_[0],e)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.clearQuantizedEmbedding=function(){return this.setQuantizedEmbedding(void 0)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.hasQuantizedEmbedding=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.getHeadIndex=function(){return t.Message.getFieldWithDefault(this,3,0)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.setHeadIndex=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.clearHeadIndex=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.hasHeadIndex=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.getHeadName=function(){return t.Message.getFieldWithDefault(this,4,"")},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.setHeadName=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.clearHeadName=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.hasHeadName=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.prototype.toObject=function(e){return proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.toObject(e,this)},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.toObject=function(e,r){var o,i={embeddingsList:t.Message.toObjectList(r.getEmbeddingsList(),proto.mediapipe.tasks.components.containers.proto.Embedding.toObject,e),timestampMs:null==(o=t.Message.getField(r,2))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.components.containers.proto.EmbeddingResult;return proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new proto.mediapipe.tasks.components.containers.proto.Embedding;t.readMessage(r,proto.mediapipe.tasks.components.containers.proto.Embedding.deserializeBinaryFromReader),e.addEmbeddings(r);break;case 2:r=t.readInt64();e.setTimestampMs(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.serializeBinaryToWriter=function(e,r){var o=void 0;(o=e.getEmbeddingsList()).length>0&&r.writeRepeatedMessage(1,o,proto.mediapipe.tasks.components.containers.proto.Embedding.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeInt64(2,o)},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.prototype.getEmbeddingsList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.tasks.components.containers.proto.Embedding,1)},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.prototype.setEmbeddingsList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.prototype.addEmbeddings=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.tasks.components.containers.proto.Embedding,r)},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.prototype.clearEmbeddingsList=function(){return this.setEmbeddingsList([])},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.prototype.getTimestampMs=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.prototype.setTimestampMs=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.prototype.clearTimestampMs=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.prototype.hasTimestampMs=function(){return null!=t.Message.getField(this,2)},r.object.extend(e,proto.mediapipe.tasks.components.containers.proto)}(embeddings_pb);var image_embedder_graph_options_pb={},embedder_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.tasks.components.processors.proto.EmbedderOptions",null,o),proto.mediapipe.tasks.components.processors.proto.EmbedderOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.components.processors.proto.EmbedderOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.displayName="proto.mediapipe.tasks.components.processors.proto.EmbedderOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.toObject(e,this)},proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.toObject=function(e,r){var o,i={l2Normalize:null==(o=t.Message.getBooleanField(r,1))?void 0:o,quantize:null==(o=t.Message.getBooleanField(r,2))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.components.processors.proto.EmbedderOptions;return proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readBool();e.setL2Normalize(r);break;case 2:r=t.readBool();e.setQuantize(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeBool(1,o),null!=(o=t.Message.getField(e,2))&&r.writeBool(2,o)},proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.prototype.getL2Normalize=function(){return t.Message.getBooleanFieldWithDefault(this,1,!1)},proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.prototype.setL2Normalize=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.prototype.clearL2Normalize=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.prototype.hasL2Normalize=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.prototype.getQuantize=function(){return t.Message.getBooleanFieldWithDefault(this,2,!1)},proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.prototype.setQuantize=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.prototype.clearQuantize=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.prototype.hasQuantize=function(){return null!=t.Message.getField(this,2)},r.object.extend(e,proto.mediapipe.tasks.components.processors.proto)}(embedder_options_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=embedder_options_pb;r.object.extend(proto,n);var s=base_options_pb;r.object.extend(proto,s),r.exportSymbol("proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions",null,o),proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.displayName="proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.toObject=function(e,t){var r,o={baseOptions:(r=t.getBaseOptions())&&s.BaseOptions.toObject(e,r),embedderOptions:(r=t.getEmbedderOptions())&&n.EmbedderOptions.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions;return proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new s.BaseOptions;t.readMessage(r,s.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=new n.EmbedderOptions;t.readMessage(r,n.EmbedderOptions.deserializeBinaryFromReader),e.setEmbedderOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.serializeBinaryToWriter=function(e,t){var r=void 0;null!=(r=e.getBaseOptions())&&t.writeMessage(1,r,s.BaseOptions.serializeBinaryToWriter),null!=(r=e.getEmbedderOptions())&&t.writeMessage(2,r,n.EmbedderOptions.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.ext=new t.ExtensionFieldInfo(476348187,{ext:0},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions,proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[476348187]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[476348187]=proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.ext,proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,s.BaseOptions,1)},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.prototype.getEmbedderOptions=function(){return t.Message.getWrapperField(this,n.EmbedderOptions,2)},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.prototype.setEmbedderOptions=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.prototype.clearEmbedderOptions=function(){return this.setEmbedderOptions(void 0)},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.prototype.hasEmbedderOptions=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.ext=new t.ExtensionFieldInfo(476348187,{ext:0},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions,proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[476348187]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[476348187]=proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.image_embedder.proto)}(image_embedder_graph_options_pb);var embedder_options={};Object.defineProperty(embedder_options,"__esModule",{value:!0}),embedder_options.convertEmbedderOptionsToProto=void 0;const embedder_options_pb_1=embedder_options_pb;function convertEmbedderOptionsToProto(e,t){const r=t?t.clone():new embedder_options_pb_1.EmbedderOptions;return void 0!==e.l2Normalize?r.setL2Normalize(e.l2Normalize):"l2Normalize"in e&&r.clearL2Normalize(),void 0!==e.quantize?r.setQuantize(e.quantize):"quantize"in e&&r.clearQuantize(),r}embedder_options.convertEmbedderOptionsToProto=convertEmbedderOptionsToProto;var embedder_result={};Object.defineProperty(embedder_result,"__esModule",{value:!0}),embedder_result.convertFromEmbeddingResultProto=void 0;const DEFAULT_INDEX=-1;function convertFromEmbeddingsProto(e){var t,r,o,i;const a={headIndex:null!==(t=e.getHeadIndex())&&void 0!==t?t:DEFAULT_INDEX,headName:null!==(r=e.getHeadName())&&void 0!==r?r:""};if(e.hasFloatEmbedding())a.floatEmbedding=e.getFloatEmbedding().getValuesList();else{const t=null!==(i=null===(o=e.getQuantizedEmbedding())||void 0===o?void 0:o.getValues())&&void 0!==i?i:"";a.quantizedEmbedding="string"==typeof t?Uint8Array.from(atob(t),(e=>e.charCodeAt(0))):t}return a}function convertFromEmbeddingResultProto(e){return{embeddings:e.getEmbeddingsList().map((e=>convertFromEmbeddingsProto(e))),timestampMs:e.getTimestampMs()}}embedder_result.convertFromEmbeddingResultProto=convertFromEmbeddingResultProto;var cosine_similarity={};function computeCosineSimilarity(e,t){if(e.floatEmbedding&&t.floatEmbedding)return compute(e.floatEmbedding,t.floatEmbedding);if(e.quantizedEmbedding&&t.quantizedEmbedding)return compute(convertToBytes(e.quantizedEmbedding),convertToBytes(t.quantizedEmbedding));throw new Error("Cannot compute cosine similarity between quantized and float embeddings.")}function convertToBytes(e){return Array.from(e,(e=>e>127?e-256:e))}function compute(e,t){if(e.length!==t.length)throw new Error(`Cannot compute cosine similarity between embeddings of different sizes (${e.length} vs. ${t.length}).`);let r=0,o=0,i=0;for(let a=0;a{this.addJsImageEmdedding(e),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(m,(e=>{this.setLatestOutputTimestamp(e)}));const a=e.serializeBinary();this.setGraph(new Uint8Array(a),!0)}}e.ImageEmbedder=f}(image_embedder);var image_segmenter={},tensors_to_segmentation_calculator_pb={},segmenter_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions",null,o),r.exportSymbol("proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.Activation",null,o),r.exportSymbol("proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.OutputType",null,o),proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.displayName="proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.toObject(e,this)},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.toObject=function(e,r){var o,i={outputType:null==(o=t.Message.getField(r,1))?void 0:o,activation:t.Message.getFieldWithDefault(r,2,0)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions;return proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readEnum();e.setOutputType(r);break;case 2:r=t.readEnum();e.setActivation(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeEnum(1,o),null!=(o=t.Message.getField(e,2))&&r.writeEnum(2,o)},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.OutputType={UNSPECIFIED:0,CATEGORY_MASK:1,CONFIDENCE_MASK:2},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.Activation={NONE:0,SIGMOID:1,SOFTMAX:2},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.prototype.getOutputType=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.prototype.setOutputType=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.prototype.clearOutputType=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.prototype.hasOutputType=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.prototype.getActivation=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.prototype.setActivation=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.prototype.clearActivation=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.prototype.hasActivation=function(){return null!=t.Message.getField(this,2)},r.object.extend(e,proto.mediapipe.tasks.vision.image_segmenter.proto)}(segmenter_options_pb);var label_map_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.LabelMapItem",null,o),proto.mediapipe.LabelMapItem=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.LabelMapItem.repeatedFields_,null)},r.inherits(proto.mediapipe.LabelMapItem,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.LabelMapItem.displayName="proto.mediapipe.LabelMapItem"),proto.mediapipe.LabelMapItem.repeatedFields_=[3],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.LabelMapItem.prototype.toObject=function(e){return proto.mediapipe.LabelMapItem.toObject(e,this)},proto.mediapipe.LabelMapItem.toObject=function(e,r){var o,i={name:null==(o=t.Message.getField(r,1))?void 0:o,displayName:null==(o=t.Message.getField(r,2))?void 0:o,childNameList:null==(o=t.Message.getRepeatedField(r,3))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.LabelMapItem.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.LabelMapItem;return proto.mediapipe.LabelMapItem.deserializeBinaryFromReader(o,r)},proto.mediapipe.LabelMapItem.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setName(r);break;case 2:r=t.readString();e.setDisplayName(r);break;case 3:r=t.readString();e.addChildName(r);break;default:t.skipField()}}return e},proto.mediapipe.LabelMapItem.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.LabelMapItem.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.LabelMapItem.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeString(1,o),null!=(o=t.Message.getField(e,2))&&r.writeString(2,o),(o=e.getChildNameList()).length>0&&r.writeRepeatedString(3,o)},proto.mediapipe.LabelMapItem.prototype.getName=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.LabelMapItem.prototype.setName=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.LabelMapItem.prototype.clearName=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.LabelMapItem.prototype.hasName=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.LabelMapItem.prototype.getDisplayName=function(){return t.Message.getFieldWithDefault(this,2,"")},proto.mediapipe.LabelMapItem.prototype.setDisplayName=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.LabelMapItem.prototype.clearDisplayName=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.LabelMapItem.prototype.hasDisplayName=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.LabelMapItem.prototype.getChildNameList=function(){return t.Message.getRepeatedField(this,3)},proto.mediapipe.LabelMapItem.prototype.setChildNameList=function(e){return t.Message.setField(this,3,e||[])},proto.mediapipe.LabelMapItem.prototype.addChildName=function(e,r){return t.Message.addToRepeatedField(this,3,e,r)},proto.mediapipe.LabelMapItem.prototype.clearChildNameList=function(){return this.setChildNameList([])},r.object.extend(e,proto.mediapipe)}(label_map_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_options_pb;r.object.extend(proto,i);var a=segmenter_options_pb;r.object.extend(proto,a);var n=label_map_pb;r.object.extend(proto,n),r.exportSymbol("proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions",null,o),proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.displayName="proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.toObject(e,this)},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.toObject=function(e,t){var r,o={segmenterOptions:(r=t.getSegmenterOptions())&&a.SegmenterOptions.toObject(e,r),labelItemsMap:(r=t.getLabelItemsMap())?r.toObject(e,proto.mediapipe.LabelMapItem.toObject):[]};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions;return proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.deserializeBinaryFromReader=function(e,r){for(;r.nextField()&&!r.isEndGroup();){switch(r.getFieldNumber()){case 1:var o=new a.SegmenterOptions;r.readMessage(o,a.SegmenterOptions.deserializeBinaryFromReader),e.setSegmenterOptions(o);break;case 2:o=e.getLabelItemsMap();r.readMessage(o,(function(e,r){t.Map.deserializeBinary(e,r,t.BinaryReader.prototype.readInt64,t.BinaryReader.prototype.readMessage,proto.mediapipe.LabelMapItem.deserializeBinaryFromReader,0,new proto.mediapipe.LabelMapItem)}));break;default:r.skipField()}}return e},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getSegmenterOptions())&&r.writeMessage(1,o,a.SegmenterOptions.serializeBinaryToWriter),(o=e.getLabelItemsMap(!0))&&o.getLength()>0&&o.serializeBinary(2,r,t.BinaryWriter.prototype.writeInt64,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.LabelMapItem.serializeBinaryToWriter)},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.ext=new t.ExtensionFieldInfo(458105876,{ext:0},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions,proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.toObject,0),i.CalculatorOptions.extensionsBinary[458105876]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.serializeBinaryToWriter,proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.deserializeBinaryFromReader,!1),i.CalculatorOptions.extensions[458105876]=proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.ext,proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.prototype.getSegmenterOptions=function(){return t.Message.getWrapperField(this,a.SegmenterOptions,1)},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.prototype.setSegmenterOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.prototype.clearSegmenterOptions=function(){return this.setSegmenterOptions(void 0)},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.prototype.hasSegmenterOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.prototype.getLabelItemsMap=function(e){return t.Message.getMapField(this,2,e,proto.mediapipe.LabelMapItem)},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.prototype.clearLabelItemsMap=function(){return this.getLabelItemsMap().clear(),this},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.ext=new t.ExtensionFieldInfo(458105876,{ext:0},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions,proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.toObject,0),i.CalculatorOptions.extensionsBinary[458105876]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.serializeBinaryToWriter,proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.deserializeBinaryFromReader,!1),i.CalculatorOptions.extensions[458105876]=proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.ext,r.object.extend(e,proto.mediapipe.tasks)}(tensors_to_segmentation_calculator_pb);var image_segmenter_graph_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n);var s=segmenter_options_pb;r.object.extend(proto,s),r.exportSymbol("proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions",null,o),proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.displayName="proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.toObject=function(e,r){var o,i={baseOptions:(o=r.getBaseOptions())&&n.BaseOptions.toObject(e,o),displayNamesLocale:t.Message.getFieldWithDefault(r,2,"en"),segmenterOptions:(o=r.getSegmenterOptions())&&s.SegmenterOptions.toObject(e,o)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions;return proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=t.readString();e.setDisplayNamesLocale(r);break;case 3:r=new s.SegmenterOptions;t.readMessage(r,s.SegmenterOptions.deserializeBinaryFromReader),e.setSegmenterOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getBaseOptions())&&r.writeMessage(1,o,n.BaseOptions.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeString(2,o),null!=(o=e.getSegmenterOptions())&&r.writeMessage(3,o,s.SegmenterOptions.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.ext=new t.ExtensionFieldInfo(458105758,{ext:0},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions,proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[458105758]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[458105758]=proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.ext,proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.getDisplayNamesLocale=function(){return t.Message.getFieldWithDefault(this,2,"en")},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.setDisplayNamesLocale=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.clearDisplayNamesLocale=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.hasDisplayNamesLocale=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.getSegmenterOptions=function(){return t.Message.getWrapperField(this,s.SegmenterOptions,3)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.setSegmenterOptions=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.clearSegmenterOptions=function(){return this.setSegmenterOptions(void 0)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.hasSegmenterOptions=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.ext=new t.ExtensionFieldInfo(458105758,{ext:0},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions,proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[458105758]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[458105758]=proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.image_segmenter.proto)}(image_segmenter_graph_options_pb);var image_segmenter_options={};Object.defineProperty(image_segmenter_options,"__esModule",{value:!0});var image_segmenter_result={};Object.defineProperty(image_segmenter_result,"__esModule",{value:!0}),function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,i)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(e,r){for(var o in e)"default"===o||Object.prototype.hasOwnProperty.call(r,o)||t(r,e,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.ImageSegmenter=void 0;const o=calculator_pb,i=calculator_options_pb,a=base_options_pb,n=tensors_to_segmentation_calculator_pb,s=image_segmenter_graph_options_pb,p=segmenter_options_pb,d=vision_task_runner;r(image_segmenter_options,e),r(image_segmenter_result,e);const l="image_in",g="norm_rect",c="confidence_masks",u="category_mask",m="mediapipe.tasks.TensorsToSegmentationCalculator";class f extends d.VisionTaskRunner{static createFromOptions(e,t){return d.VisionTaskRunner.createVisionInstance(f,e,t)}static createFromModelBuffer(e,t){return d.VisionTaskRunner.createVisionInstance(f,e,{baseOptions:{modelAssetBuffer:t}})}static createFromModelPath(e,t){return d.VisionTaskRunner.createVisionInstance(f,e,{baseOptions:{modelAssetPath:t}})}constructor(e,t){super(new d.VisionGraphRunner(e,t),l,g,!1),this.result={},this.labels=[],this.outputCategoryMask=false,this.outputConfidenceMasks=true,this.options=new s.ImageSegmenterGraphOptions,this.segmenterOptions=new p.SegmenterOptions,this.options.setSegmenterOptions(this.segmenterOptions),this.options.setBaseOptions(new a.BaseOptions)}get baseOptions(){return this.options.getBaseOptions()}set baseOptions(e){this.options.setBaseOptions(e)}setOptions(e){var t,r;return void 0!==e.displayNamesLocale?this.options.setDisplayNamesLocale(e.displayNamesLocale):"displayNamesLocale"in e&&this.options.clearDisplayNamesLocale(),"outputCategoryMask"in e&&(this.outputCategoryMask=null!==(t=e.outputCategoryMask)&&void 0!==t&&t),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=null===(r=e.outputConfidenceMasks)||void 0===r||r),super.applyOptions(e)}onGraphRefreshed(){this.populateLabels()}populateLabels(){var e,t,r;const o=this.getCalculatorGraphConfig().getNodeList().filter((e=>e.getName().includes(m)));if(this.labels=[],o.length>1)throw new Error(`The graph has more than one ${m}.`);if(1===o.length){(null!==(r=null===(t=null===(e=o[0].getOptions())||void 0===e?void 0:e.getExtension(n.TensorsToSegmentationCalculatorOptions.ext))||void 0===t?void 0:t.getLabelItemsMap())&&void 0!==r?r:new Map).forEach(((e,t)=>{this.labels[Number(t)]=e.getName()}))}}segment(e,t,r){const o="function"!=typeof t?t:{};if(this.userCallback="function"==typeof t?t:r,this.reset(),this.processImageData(e,o),!this.userCallback)return this.result}segmentForVideo(e,t,r,o){const i="function"!=typeof r?r:{};if(this.userCallback="function"==typeof r?r:o,this.reset(),this.processVideoData(e,i,t),!this.userCallback)return this.result}getLabels(){return this.labels}reset(){this.result={}}maybeInvokeCallback(){this.outputConfidenceMasks&&!("confidenceMasks"in this.result)||this.outputCategoryMask&&!("categoryMask"in this.result)||this.userCallback&&(this.userCallback(this.result),this.freeKeepaliveStreams())}refreshGraph(){const e=new o.CalculatorGraphConfig;e.addInputStream(l),e.addInputStream(g);const t=new i.CalculatorOptions;t.setExtension(s.ImageSegmenterGraphOptions.ext,this.options);const r=new o.CalculatorGraphConfig.Node;r.setCalculator("mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),r.addInputStream("IMAGE:"+l),r.addInputStream("NORM_RECT:"+g),r.setOptions(t),e.addNode(r),this.addKeepaliveNode(e),this.outputConfidenceMasks&&(e.addOutputStream(c),r.addOutputStream("CONFIDENCE_MASKS:"+c),this.keepStreamAlive(c),this.graphRunner.attachImageVectorListener(c,((e,t)=>{this.result.confidenceMasks=e.map((e=>this.convertToMPMask(e,!this.userCallback))),this.setLatestOutputTimestamp(t),this.maybeInvokeCallback()})),this.graphRunner.attachEmptyPacketListener(c,(e=>{this.result.confidenceMasks=void 0,this.setLatestOutputTimestamp(e),this.maybeInvokeCallback()}))),this.outputCategoryMask&&(e.addOutputStream(u),r.addOutputStream("CATEGORY_MASK:"+u),this.keepStreamAlive(u),this.graphRunner.attachImageListener(u,((e,t)=>{this.result.categoryMask=this.convertToMPMask(e,!this.userCallback),this.setLatestOutputTimestamp(t),this.maybeInvokeCallback()})),this.graphRunner.attachEmptyPacketListener(u,(e=>{this.result.categoryMask=void 0,this.setLatestOutputTimestamp(e),this.maybeInvokeCallback()})));const a=e.serializeBinary();this.setGraph(new Uint8Array(a),!0)}}e.ImageSegmenter=f}(image_segmenter);var interactive_segmenter={},color_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.Color",null,o),r.exportSymbol("proto.mediapipe.ColorMap",null,o),proto.mediapipe.Color=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.Color,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.Color.displayName="proto.mediapipe.Color"),proto.mediapipe.ColorMap=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.ColorMap,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.ColorMap.displayName="proto.mediapipe.ColorMap"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.Color.prototype.toObject=function(e){return proto.mediapipe.Color.toObject(e,this)},proto.mediapipe.Color.toObject=function(e,r){var o,i={r:null==(o=t.Message.getField(r,1))?void 0:o,g:null==(o=t.Message.getField(r,2))?void 0:o,b:null==(o=t.Message.getField(r,3))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.Color.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.Color;return proto.mediapipe.Color.deserializeBinaryFromReader(o,r)},proto.mediapipe.Color.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readInt32();e.setR(r);break;case 2:r=t.readInt32();e.setG(r);break;case 3:r=t.readInt32();e.setB(r);break;default:t.skipField()}}return e},proto.mediapipe.Color.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.Color.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.Color.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeInt32(1,o),null!=(o=t.Message.getField(e,2))&&r.writeInt32(2,o),null!=(o=t.Message.getField(e,3))&&r.writeInt32(3,o)},proto.mediapipe.Color.prototype.getR=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.Color.prototype.setR=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.Color.prototype.clearR=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.Color.prototype.hasR=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.Color.prototype.getG=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.Color.prototype.setG=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.Color.prototype.clearG=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.Color.prototype.hasG=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.Color.prototype.getB=function(){return t.Message.getFieldWithDefault(this,3,0)},proto.mediapipe.Color.prototype.setB=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.Color.prototype.clearB=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.Color.prototype.hasB=function(){return null!=t.Message.getField(this,3)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.ColorMap.prototype.toObject=function(e){return proto.mediapipe.ColorMap.toObject(e,this)},proto.mediapipe.ColorMap.toObject=function(e,t){var r,o={labelToColorMap:(r=t.getLabelToColorMap())?r.toObject(e,proto.mediapipe.Color.toObject):[]};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.ColorMap.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.ColorMap;return proto.mediapipe.ColorMap.deserializeBinaryFromReader(o,r)},proto.mediapipe.ColorMap.deserializeBinaryFromReader=function(e,r){for(;r.nextField()&&!r.isEndGroup();){if(1===r.getFieldNumber()){var o=e.getLabelToColorMap();r.readMessage(o,(function(e,r){t.Map.deserializeBinary(e,r,t.BinaryReader.prototype.readString,t.BinaryReader.prototype.readMessage,proto.mediapipe.Color.deserializeBinaryFromReader,"",new proto.mediapipe.Color)}))}else r.skipField()}return e},proto.mediapipe.ColorMap.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.ColorMap.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.ColorMap.serializeBinaryToWriter=function(e,r){var o=void 0;(o=e.getLabelToColorMap(!0))&&o.getLength()>0&&o.serializeBinary(1,r,t.BinaryWriter.prototype.writeString,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.Color.serializeBinaryToWriter)},proto.mediapipe.ColorMap.prototype.getLabelToColorMap=function(e){return t.Message.getMapField(this,1,e,proto.mediapipe.Color)},proto.mediapipe.ColorMap.prototype.clearLabelToColorMap=function(){return this.getLabelToColorMap().clear(),this},r.object.extend(e,proto.mediapipe)}(color_pb);var render_data_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=color_pb;r.object.extend(proto,i),r.exportSymbol("proto.mediapipe.RenderAnnotation",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.Arrow",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.DataCase",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.FilledOval",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.FilledRectangle",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.FilledRoundedRectangle",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.GradientLine",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.Line",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.Line.LineType",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.Oval",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.Point",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.Rectangle",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.RoundedRectangle",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.Scribble",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.Text",null,o),r.exportSymbol("proto.mediapipe.RenderData",null,o),r.exportSymbol("proto.mediapipe.RenderViewport",null,o),proto.mediapipe.RenderData=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.RenderData.repeatedFields_,null)},r.inherits(proto.mediapipe.RenderData,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderData.displayName="proto.mediapipe.RenderData"),proto.mediapipe.RenderAnnotation=function(e){t.Message.initialize(this,e,0,-1,null,proto.mediapipe.RenderAnnotation.oneofGroups_)},r.inherits(proto.mediapipe.RenderAnnotation,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.displayName="proto.mediapipe.RenderAnnotation"),proto.mediapipe.RenderAnnotation.Rectangle=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.RenderAnnotation.Rectangle,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.Rectangle.displayName="proto.mediapipe.RenderAnnotation.Rectangle"),proto.mediapipe.RenderAnnotation.FilledRectangle=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.RenderAnnotation.FilledRectangle,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.FilledRectangle.displayName="proto.mediapipe.RenderAnnotation.FilledRectangle"),proto.mediapipe.RenderAnnotation.RoundedRectangle=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.RenderAnnotation.RoundedRectangle,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.RoundedRectangle.displayName="proto.mediapipe.RenderAnnotation.RoundedRectangle"),proto.mediapipe.RenderAnnotation.FilledRoundedRectangle=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.RenderAnnotation.FilledRoundedRectangle,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.displayName="proto.mediapipe.RenderAnnotation.FilledRoundedRectangle"),proto.mediapipe.RenderAnnotation.Oval=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.RenderAnnotation.Oval,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.Oval.displayName="proto.mediapipe.RenderAnnotation.Oval"),proto.mediapipe.RenderAnnotation.FilledOval=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.RenderAnnotation.FilledOval,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.FilledOval.displayName="proto.mediapipe.RenderAnnotation.FilledOval"),proto.mediapipe.RenderAnnotation.Point=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.RenderAnnotation.Point,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.Point.displayName="proto.mediapipe.RenderAnnotation.Point"),proto.mediapipe.RenderAnnotation.Line=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.RenderAnnotation.Line,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.Line.displayName="proto.mediapipe.RenderAnnotation.Line"),proto.mediapipe.RenderAnnotation.GradientLine=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.RenderAnnotation.GradientLine,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.GradientLine.displayName="proto.mediapipe.RenderAnnotation.GradientLine"),proto.mediapipe.RenderAnnotation.Scribble=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.RenderAnnotation.Scribble.repeatedFields_,null)},r.inherits(proto.mediapipe.RenderAnnotation.Scribble,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.Scribble.displayName="proto.mediapipe.RenderAnnotation.Scribble"),proto.mediapipe.RenderAnnotation.Arrow=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.RenderAnnotation.Arrow,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.Arrow.displayName="proto.mediapipe.RenderAnnotation.Arrow"),proto.mediapipe.RenderAnnotation.Text=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.RenderAnnotation.Text,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.Text.displayName="proto.mediapipe.RenderAnnotation.Text"),proto.mediapipe.RenderViewport=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.RenderViewport,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderViewport.displayName="proto.mediapipe.RenderViewport"),proto.mediapipe.RenderData.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderData.prototype.toObject=function(e){return proto.mediapipe.RenderData.toObject(e,this)},proto.mediapipe.RenderData.toObject=function(e,r){var o,i={renderAnnotationsList:t.Message.toObjectList(r.getRenderAnnotationsList(),proto.mediapipe.RenderAnnotation.toObject,e),sceneClass:null==(o=t.Message.getField(r,2))?void 0:o,sceneViewport:(o=r.getSceneViewport())&&proto.mediapipe.RenderViewport.toObject(e,o)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.RenderData.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderData;return proto.mediapipe.RenderData.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderData.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new proto.mediapipe.RenderAnnotation;t.readMessage(r,proto.mediapipe.RenderAnnotation.deserializeBinaryFromReader),e.addRenderAnnotations(r);break;case 2:r=t.readString();e.setSceneClass(r);break;case 3:r=new proto.mediapipe.RenderViewport;t.readMessage(r,proto.mediapipe.RenderViewport.deserializeBinaryFromReader),e.setSceneViewport(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderData.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderData.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderData.serializeBinaryToWriter=function(e,r){var o=void 0;(o=e.getRenderAnnotationsList()).length>0&&r.writeRepeatedMessage(1,o,proto.mediapipe.RenderAnnotation.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeString(2,o),null!=(o=e.getSceneViewport())&&r.writeMessage(3,o,proto.mediapipe.RenderViewport.serializeBinaryToWriter)},proto.mediapipe.RenderData.prototype.getRenderAnnotationsList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.RenderAnnotation,1)},proto.mediapipe.RenderData.prototype.setRenderAnnotationsList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.RenderData.prototype.addRenderAnnotations=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.RenderAnnotation,r)},proto.mediapipe.RenderData.prototype.clearRenderAnnotationsList=function(){return this.setRenderAnnotationsList([])},proto.mediapipe.RenderData.prototype.getSceneClass=function(){return t.Message.getFieldWithDefault(this,2,"")},proto.mediapipe.RenderData.prototype.setSceneClass=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.RenderData.prototype.clearSceneClass=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.RenderData.prototype.hasSceneClass=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.RenderData.prototype.getSceneViewport=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderViewport,3)},proto.mediapipe.RenderData.prototype.setSceneViewport=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.RenderData.prototype.clearSceneViewport=function(){return this.setSceneViewport(void 0)},proto.mediapipe.RenderData.prototype.hasSceneViewport=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.RenderAnnotation.oneofGroups_=[[1,2,3,4,5,6,7,8,9,10,14,15]],proto.mediapipe.RenderAnnotation.DataCase={DATA_NOT_SET:0,RECTANGLE:1,FILLED_RECTANGLE:2,OVAL:3,FILLED_OVAL:4,POINT:5,LINE:6,ARROW:7,TEXT:8,ROUNDED_RECTANGLE:9,FILLED_ROUNDED_RECTANGLE:10,GRADIENT_LINE:14,SCRIBBLE:15},proto.mediapipe.RenderAnnotation.prototype.getDataCase=function(){return t.Message.computeOneofCase(this,proto.mediapipe.RenderAnnotation.oneofGroups_[0])},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.toObject(e,this)},proto.mediapipe.RenderAnnotation.toObject=function(e,r){var o,a={rectangle:(o=r.getRectangle())&&proto.mediapipe.RenderAnnotation.Rectangle.toObject(e,o),filledRectangle:(o=r.getFilledRectangle())&&proto.mediapipe.RenderAnnotation.FilledRectangle.toObject(e,o),oval:(o=r.getOval())&&proto.mediapipe.RenderAnnotation.Oval.toObject(e,o),filledOval:(o=r.getFilledOval())&&proto.mediapipe.RenderAnnotation.FilledOval.toObject(e,o),point:(o=r.getPoint())&&proto.mediapipe.RenderAnnotation.Point.toObject(e,o),line:(o=r.getLine())&&proto.mediapipe.RenderAnnotation.Line.toObject(e,o),arrow:(o=r.getArrow())&&proto.mediapipe.RenderAnnotation.Arrow.toObject(e,o),text:(o=r.getText())&&proto.mediapipe.RenderAnnotation.Text.toObject(e,o),roundedRectangle:(o=r.getRoundedRectangle())&&proto.mediapipe.RenderAnnotation.RoundedRectangle.toObject(e,o),filledRoundedRectangle:(o=r.getFilledRoundedRectangle())&&proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.toObject(e,o),gradientLine:(o=r.getGradientLine())&&proto.mediapipe.RenderAnnotation.GradientLine.toObject(e,o),scribble:(o=r.getScribble())&&proto.mediapipe.RenderAnnotation.Scribble.toObject(e,o),thickness:t.Message.getFloatingPointFieldWithDefault(r,11,1),color:(o=r.getColor())&&i.Color.toObject(e,o),sceneTag:null==(o=t.Message.getField(r,13))?void 0:o};return e&&(a.$jspbMessageInstance=r),a}),proto.mediapipe.RenderAnnotation.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation;return proto.mediapipe.RenderAnnotation.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new proto.mediapipe.RenderAnnotation.Rectangle;t.readMessage(r,proto.mediapipe.RenderAnnotation.Rectangle.deserializeBinaryFromReader),e.setRectangle(r);break;case 2:r=new proto.mediapipe.RenderAnnotation.FilledRectangle;t.readMessage(r,proto.mediapipe.RenderAnnotation.FilledRectangle.deserializeBinaryFromReader),e.setFilledRectangle(r);break;case 3:r=new proto.mediapipe.RenderAnnotation.Oval;t.readMessage(r,proto.mediapipe.RenderAnnotation.Oval.deserializeBinaryFromReader),e.setOval(r);break;case 4:r=new proto.mediapipe.RenderAnnotation.FilledOval;t.readMessage(r,proto.mediapipe.RenderAnnotation.FilledOval.deserializeBinaryFromReader),e.setFilledOval(r);break;case 5:r=new proto.mediapipe.RenderAnnotation.Point;t.readMessage(r,proto.mediapipe.RenderAnnotation.Point.deserializeBinaryFromReader),e.setPoint(r);break;case 6:r=new proto.mediapipe.RenderAnnotation.Line;t.readMessage(r,proto.mediapipe.RenderAnnotation.Line.deserializeBinaryFromReader),e.setLine(r);break;case 7:r=new proto.mediapipe.RenderAnnotation.Arrow;t.readMessage(r,proto.mediapipe.RenderAnnotation.Arrow.deserializeBinaryFromReader),e.setArrow(r);break;case 8:r=new proto.mediapipe.RenderAnnotation.Text;t.readMessage(r,proto.mediapipe.RenderAnnotation.Text.deserializeBinaryFromReader),e.setText(r);break;case 9:r=new proto.mediapipe.RenderAnnotation.RoundedRectangle;t.readMessage(r,proto.mediapipe.RenderAnnotation.RoundedRectangle.deserializeBinaryFromReader),e.setRoundedRectangle(r);break;case 10:r=new proto.mediapipe.RenderAnnotation.FilledRoundedRectangle;t.readMessage(r,proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.deserializeBinaryFromReader),e.setFilledRoundedRectangle(r);break;case 14:r=new proto.mediapipe.RenderAnnotation.GradientLine;t.readMessage(r,proto.mediapipe.RenderAnnotation.GradientLine.deserializeBinaryFromReader),e.setGradientLine(r);break;case 15:r=new proto.mediapipe.RenderAnnotation.Scribble;t.readMessage(r,proto.mediapipe.RenderAnnotation.Scribble.deserializeBinaryFromReader),e.setScribble(r);break;case 11:r=t.readDouble();e.setThickness(r);break;case 12:r=new i.Color;t.readMessage(r,i.Color.deserializeBinaryFromReader),e.setColor(r);break;case 13:r=t.readString();e.setSceneTag(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderAnnotation.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getRectangle())&&r.writeMessage(1,o,proto.mediapipe.RenderAnnotation.Rectangle.serializeBinaryToWriter),null!=(o=e.getFilledRectangle())&&r.writeMessage(2,o,proto.mediapipe.RenderAnnotation.FilledRectangle.serializeBinaryToWriter),null!=(o=e.getOval())&&r.writeMessage(3,o,proto.mediapipe.RenderAnnotation.Oval.serializeBinaryToWriter),null!=(o=e.getFilledOval())&&r.writeMessage(4,o,proto.mediapipe.RenderAnnotation.FilledOval.serializeBinaryToWriter),null!=(o=e.getPoint())&&r.writeMessage(5,o,proto.mediapipe.RenderAnnotation.Point.serializeBinaryToWriter),null!=(o=e.getLine())&&r.writeMessage(6,o,proto.mediapipe.RenderAnnotation.Line.serializeBinaryToWriter),null!=(o=e.getArrow())&&r.writeMessage(7,o,proto.mediapipe.RenderAnnotation.Arrow.serializeBinaryToWriter),null!=(o=e.getText())&&r.writeMessage(8,o,proto.mediapipe.RenderAnnotation.Text.serializeBinaryToWriter),null!=(o=e.getRoundedRectangle())&&r.writeMessage(9,o,proto.mediapipe.RenderAnnotation.RoundedRectangle.serializeBinaryToWriter),null!=(o=e.getFilledRoundedRectangle())&&r.writeMessage(10,o,proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.serializeBinaryToWriter),null!=(o=e.getGradientLine())&&r.writeMessage(14,o,proto.mediapipe.RenderAnnotation.GradientLine.serializeBinaryToWriter),null!=(o=e.getScribble())&&r.writeMessage(15,o,proto.mediapipe.RenderAnnotation.Scribble.serializeBinaryToWriter),null!=(o=t.Message.getField(e,11))&&r.writeDouble(11,o),null!=(o=e.getColor())&&r.writeMessage(12,o,i.Color.serializeBinaryToWriter),null!=(o=t.Message.getField(e,13))&&r.writeString(13,o)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.Rectangle.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.Rectangle.toObject(e,this)},proto.mediapipe.RenderAnnotation.Rectangle.toObject=function(e,r){var o,i={left:null==(o=t.Message.getOptionalFloatingPointField(r,1))?void 0:o,top:null==(o=t.Message.getOptionalFloatingPointField(r,2))?void 0:o,right:null==(o=t.Message.getOptionalFloatingPointField(r,3))?void 0:o,bottom:null==(o=t.Message.getOptionalFloatingPointField(r,4))?void 0:o,normalized:t.Message.getBooleanFieldWithDefault(r,5,!1),rotation:null==(o=t.Message.getOptionalFloatingPointField(r,6))?void 0:o,topLeftThickness:null==(o=t.Message.getOptionalFloatingPointField(r,7))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.RenderAnnotation.Rectangle.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation.Rectangle;return proto.mediapipe.RenderAnnotation.Rectangle.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.Rectangle.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readDouble();e.setLeft(r);break;case 2:r=t.readDouble();e.setTop(r);break;case 3:r=t.readDouble();e.setRight(r);break;case 4:r=t.readDouble();e.setBottom(r);break;case 5:r=t.readBool();e.setNormalized(r);break;case 6:r=t.readDouble();e.setRotation(r);break;case 7:r=t.readDouble();e.setTopLeftThickness(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderAnnotation.Rectangle.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.Rectangle.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.Rectangle.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeDouble(1,o),null!=(o=t.Message.getField(e,2))&&r.writeDouble(2,o),null!=(o=t.Message.getField(e,3))&&r.writeDouble(3,o),null!=(o=t.Message.getField(e,4))&&r.writeDouble(4,o),null!=(o=t.Message.getField(e,5))&&r.writeBool(5,o),null!=(o=t.Message.getField(e,6))&&r.writeDouble(6,o),null!=(o=t.Message.getField(e,7))&&r.writeDouble(7,o)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.getLeft=function(){return t.Message.getFloatingPointFieldWithDefault(this,1,0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.setLeft=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.clearLeft=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.hasLeft=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.getTop=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.setTop=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.clearTop=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.hasTop=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.getRight=function(){return t.Message.getFloatingPointFieldWithDefault(this,3,0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.setRight=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.clearRight=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.hasRight=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.getBottom=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.setBottom=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.clearBottom=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.hasBottom=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.getNormalized=function(){return t.Message.getBooleanFieldWithDefault(this,5,!1)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.setNormalized=function(e){return t.Message.setField(this,5,e)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.clearNormalized=function(){return t.Message.setField(this,5,void 0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.hasNormalized=function(){return null!=t.Message.getField(this,5)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.getRotation=function(){return t.Message.getFloatingPointFieldWithDefault(this,6,0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.setRotation=function(e){return t.Message.setField(this,6,e)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.clearRotation=function(){return t.Message.setField(this,6,void 0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.hasRotation=function(){return null!=t.Message.getField(this,6)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.getTopLeftThickness=function(){return t.Message.getFloatingPointFieldWithDefault(this,7,0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.setTopLeftThickness=function(e){return t.Message.setField(this,7,e)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.clearTopLeftThickness=function(){return t.Message.setField(this,7,void 0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.hasTopLeftThickness=function(){return null!=t.Message.getField(this,7)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.FilledRectangle.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.FilledRectangle.toObject(e,this)},proto.mediapipe.RenderAnnotation.FilledRectangle.toObject=function(e,t){var r,o={rectangle:(r=t.getRectangle())&&proto.mediapipe.RenderAnnotation.Rectangle.toObject(e,r),fillColor:(r=t.getFillColor())&&i.Color.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.RenderAnnotation.FilledRectangle.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation.FilledRectangle;return proto.mediapipe.RenderAnnotation.FilledRectangle.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.FilledRectangle.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new proto.mediapipe.RenderAnnotation.Rectangle;t.readMessage(r,proto.mediapipe.RenderAnnotation.Rectangle.deserializeBinaryFromReader),e.setRectangle(r);break;case 2:r=new i.Color;t.readMessage(r,i.Color.deserializeBinaryFromReader),e.setFillColor(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderAnnotation.FilledRectangle.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.FilledRectangle.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.FilledRectangle.serializeBinaryToWriter=function(e,t){var r=void 0;null!=(r=e.getRectangle())&&t.writeMessage(1,r,proto.mediapipe.RenderAnnotation.Rectangle.serializeBinaryToWriter),null!=(r=e.getFillColor())&&t.writeMessage(2,r,i.Color.serializeBinaryToWriter)},proto.mediapipe.RenderAnnotation.FilledRectangle.prototype.getRectangle=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.Rectangle,1)},proto.mediapipe.RenderAnnotation.FilledRectangle.prototype.setRectangle=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.RenderAnnotation.FilledRectangle.prototype.clearRectangle=function(){return this.setRectangle(void 0)},proto.mediapipe.RenderAnnotation.FilledRectangle.prototype.hasRectangle=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.RenderAnnotation.FilledRectangle.prototype.getFillColor=function(){return t.Message.getWrapperField(this,i.Color,2)},proto.mediapipe.RenderAnnotation.FilledRectangle.prototype.setFillColor=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.RenderAnnotation.FilledRectangle.prototype.clearFillColor=function(){return this.setFillColor(void 0)},proto.mediapipe.RenderAnnotation.FilledRectangle.prototype.hasFillColor=function(){return null!=t.Message.getField(this,2)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.RoundedRectangle.toObject(e,this)},proto.mediapipe.RenderAnnotation.RoundedRectangle.toObject=function(e,r){var o,i={rectangle:(o=r.getRectangle())&&proto.mediapipe.RenderAnnotation.Rectangle.toObject(e,o),cornerRadius:t.Message.getFieldWithDefault(r,2,0),lineType:t.Message.getFieldWithDefault(r,3,4)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.RenderAnnotation.RoundedRectangle.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation.RoundedRectangle;return proto.mediapipe.RenderAnnotation.RoundedRectangle.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.RoundedRectangle.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new proto.mediapipe.RenderAnnotation.Rectangle;t.readMessage(r,proto.mediapipe.RenderAnnotation.Rectangle.deserializeBinaryFromReader),e.setRectangle(r);break;case 2:r=t.readInt32();e.setCornerRadius(r);break;case 3:r=t.readInt32();e.setLineType(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.RoundedRectangle.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.RoundedRectangle.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getRectangle())&&r.writeMessage(1,o,proto.mediapipe.RenderAnnotation.Rectangle.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeInt32(2,o),null!=(o=t.Message.getField(e,3))&&r.writeInt32(3,o)},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.getRectangle=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.Rectangle,1)},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.setRectangle=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.clearRectangle=function(){return this.setRectangle(void 0)},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.hasRectangle=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.getCornerRadius=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.setCornerRadius=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.clearCornerRadius=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.hasCornerRadius=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.getLineType=function(){return t.Message.getFieldWithDefault(this,3,4)},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.setLineType=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.clearLineType=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.hasLineType=function(){return null!=t.Message.getField(this,3)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.toObject(e,this)},proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.toObject=function(e,t){var r,o={roundedRectangle:(r=t.getRoundedRectangle())&&proto.mediapipe.RenderAnnotation.RoundedRectangle.toObject(e,r),fillColor:(r=t.getFillColor())&&i.Color.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation.FilledRoundedRectangle;return proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new proto.mediapipe.RenderAnnotation.RoundedRectangle;t.readMessage(r,proto.mediapipe.RenderAnnotation.RoundedRectangle.deserializeBinaryFromReader),e.setRoundedRectangle(r);break;case 2:r=new i.Color;t.readMessage(r,i.Color.deserializeBinaryFromReader),e.setFillColor(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.serializeBinaryToWriter=function(e,t){var r=void 0;null!=(r=e.getRoundedRectangle())&&t.writeMessage(1,r,proto.mediapipe.RenderAnnotation.RoundedRectangle.serializeBinaryToWriter),null!=(r=e.getFillColor())&&t.writeMessage(2,r,i.Color.serializeBinaryToWriter)},proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.prototype.getRoundedRectangle=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.RoundedRectangle,1)},proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.prototype.setRoundedRectangle=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.prototype.clearRoundedRectangle=function(){return this.setRoundedRectangle(void 0)},proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.prototype.hasRoundedRectangle=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.prototype.getFillColor=function(){return t.Message.getWrapperField(this,i.Color,2)},proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.prototype.setFillColor=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.prototype.clearFillColor=function(){return this.setFillColor(void 0)},proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.prototype.hasFillColor=function(){return null!=t.Message.getField(this,2)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.Oval.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.Oval.toObject(e,this)},proto.mediapipe.RenderAnnotation.Oval.toObject=function(e,t){var r,o={rectangle:(r=t.getRectangle())&&proto.mediapipe.RenderAnnotation.Rectangle.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.RenderAnnotation.Oval.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation.Oval;return proto.mediapipe.RenderAnnotation.Oval.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.Oval.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new proto.mediapipe.RenderAnnotation.Rectangle;t.readMessage(r,proto.mediapipe.RenderAnnotation.Rectangle.deserializeBinaryFromReader),e.setRectangle(r)}else t.skipField()}return e},proto.mediapipe.RenderAnnotation.Oval.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.Oval.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.Oval.serializeBinaryToWriter=function(e,t){var r;null!=(r=e.getRectangle())&&t.writeMessage(1,r,proto.mediapipe.RenderAnnotation.Rectangle.serializeBinaryToWriter)},proto.mediapipe.RenderAnnotation.Oval.prototype.getRectangle=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.Rectangle,1)},proto.mediapipe.RenderAnnotation.Oval.prototype.setRectangle=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.RenderAnnotation.Oval.prototype.clearRectangle=function(){return this.setRectangle(void 0)},proto.mediapipe.RenderAnnotation.Oval.prototype.hasRectangle=function(){return null!=t.Message.getField(this,1)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.FilledOval.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.FilledOval.toObject(e,this)},proto.mediapipe.RenderAnnotation.FilledOval.toObject=function(e,t){var r,o={oval:(r=t.getOval())&&proto.mediapipe.RenderAnnotation.Oval.toObject(e,r),fillColor:(r=t.getFillColor())&&i.Color.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.RenderAnnotation.FilledOval.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation.FilledOval;return proto.mediapipe.RenderAnnotation.FilledOval.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.FilledOval.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new proto.mediapipe.RenderAnnotation.Oval;t.readMessage(r,proto.mediapipe.RenderAnnotation.Oval.deserializeBinaryFromReader),e.setOval(r);break;case 2:r=new i.Color;t.readMessage(r,i.Color.deserializeBinaryFromReader),e.setFillColor(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderAnnotation.FilledOval.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.FilledOval.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.FilledOval.serializeBinaryToWriter=function(e,t){var r=void 0;null!=(r=e.getOval())&&t.writeMessage(1,r,proto.mediapipe.RenderAnnotation.Oval.serializeBinaryToWriter),null!=(r=e.getFillColor())&&t.writeMessage(2,r,i.Color.serializeBinaryToWriter)},proto.mediapipe.RenderAnnotation.FilledOval.prototype.getOval=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.Oval,1)},proto.mediapipe.RenderAnnotation.FilledOval.prototype.setOval=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.RenderAnnotation.FilledOval.prototype.clearOval=function(){return this.setOval(void 0)},proto.mediapipe.RenderAnnotation.FilledOval.prototype.hasOval=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.RenderAnnotation.FilledOval.prototype.getFillColor=function(){return t.Message.getWrapperField(this,i.Color,2)},proto.mediapipe.RenderAnnotation.FilledOval.prototype.setFillColor=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.RenderAnnotation.FilledOval.prototype.clearFillColor=function(){return this.setFillColor(void 0)},proto.mediapipe.RenderAnnotation.FilledOval.prototype.hasFillColor=function(){return null!=t.Message.getField(this,2)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.Point.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.Point.toObject(e,this)},proto.mediapipe.RenderAnnotation.Point.toObject=function(e,r){var o,i={x:null==(o=t.Message.getOptionalFloatingPointField(r,1))?void 0:o,y:null==(o=t.Message.getOptionalFloatingPointField(r,2))?void 0:o,normalized:t.Message.getBooleanFieldWithDefault(r,3,!1)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.RenderAnnotation.Point.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation.Point;return proto.mediapipe.RenderAnnotation.Point.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.Point.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readDouble();e.setX(r);break;case 2:r=t.readDouble();e.setY(r);break;case 3:r=t.readBool();e.setNormalized(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderAnnotation.Point.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.Point.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.Point.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeDouble(1,o),null!=(o=t.Message.getField(e,2))&&r.writeDouble(2,o),null!=(o=t.Message.getField(e,3))&&r.writeBool(3,o)},proto.mediapipe.RenderAnnotation.Point.prototype.getX=function(){return t.Message.getFloatingPointFieldWithDefault(this,1,0)},proto.mediapipe.RenderAnnotation.Point.prototype.setX=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.RenderAnnotation.Point.prototype.clearX=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.RenderAnnotation.Point.prototype.hasX=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.RenderAnnotation.Point.prototype.getY=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,0)},proto.mediapipe.RenderAnnotation.Point.prototype.setY=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.RenderAnnotation.Point.prototype.clearY=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.RenderAnnotation.Point.prototype.hasY=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.RenderAnnotation.Point.prototype.getNormalized=function(){return t.Message.getBooleanFieldWithDefault(this,3,!1)},proto.mediapipe.RenderAnnotation.Point.prototype.setNormalized=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.RenderAnnotation.Point.prototype.clearNormalized=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.RenderAnnotation.Point.prototype.hasNormalized=function(){return null!=t.Message.getField(this,3)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.Line.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.Line.toObject(e,this)},proto.mediapipe.RenderAnnotation.Line.toObject=function(e,r){var o,i={xStart:null==(o=t.Message.getOptionalFloatingPointField(r,1))?void 0:o,yStart:null==(o=t.Message.getOptionalFloatingPointField(r,2))?void 0:o,xEnd:null==(o=t.Message.getOptionalFloatingPointField(r,3))?void 0:o,yEnd:null==(o=t.Message.getOptionalFloatingPointField(r,4))?void 0:o,normalized:t.Message.getBooleanFieldWithDefault(r,5,!1),lineType:t.Message.getFieldWithDefault(r,6,1)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.RenderAnnotation.Line.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation.Line;return proto.mediapipe.RenderAnnotation.Line.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.Line.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readDouble();e.setXStart(r);break;case 2:r=t.readDouble();e.setYStart(r);break;case 3:r=t.readDouble();e.setXEnd(r);break;case 4:r=t.readDouble();e.setYEnd(r);break;case 5:r=t.readBool();e.setNormalized(r);break;case 6:r=t.readEnum();e.setLineType(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderAnnotation.Line.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.Line.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.Line.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeDouble(1,o),null!=(o=t.Message.getField(e,2))&&r.writeDouble(2,o),null!=(o=t.Message.getField(e,3))&&r.writeDouble(3,o),null!=(o=t.Message.getField(e,4))&&r.writeDouble(4,o),null!=(o=t.Message.getField(e,5))&&r.writeBool(5,o),null!=(o=t.Message.getField(e,6))&&r.writeEnum(6,o)},proto.mediapipe.RenderAnnotation.Line.LineType={UNKNOWN:0,SOLID:1,DASHED:2},proto.mediapipe.RenderAnnotation.Line.prototype.getXStart=function(){return t.Message.getFloatingPointFieldWithDefault(this,1,0)},proto.mediapipe.RenderAnnotation.Line.prototype.setXStart=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.RenderAnnotation.Line.prototype.clearXStart=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.RenderAnnotation.Line.prototype.hasXStart=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.RenderAnnotation.Line.prototype.getYStart=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,0)},proto.mediapipe.RenderAnnotation.Line.prototype.setYStart=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.RenderAnnotation.Line.prototype.clearYStart=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.RenderAnnotation.Line.prototype.hasYStart=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.RenderAnnotation.Line.prototype.getXEnd=function(){return t.Message.getFloatingPointFieldWithDefault(this,3,0)},proto.mediapipe.RenderAnnotation.Line.prototype.setXEnd=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.RenderAnnotation.Line.prototype.clearXEnd=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.RenderAnnotation.Line.prototype.hasXEnd=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.RenderAnnotation.Line.prototype.getYEnd=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,0)},proto.mediapipe.RenderAnnotation.Line.prototype.setYEnd=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.RenderAnnotation.Line.prototype.clearYEnd=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.RenderAnnotation.Line.prototype.hasYEnd=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.RenderAnnotation.Line.prototype.getNormalized=function(){return t.Message.getBooleanFieldWithDefault(this,5,!1)},proto.mediapipe.RenderAnnotation.Line.prototype.setNormalized=function(e){return t.Message.setField(this,5,e)},proto.mediapipe.RenderAnnotation.Line.prototype.clearNormalized=function(){return t.Message.setField(this,5,void 0)},proto.mediapipe.RenderAnnotation.Line.prototype.hasNormalized=function(){return null!=t.Message.getField(this,5)},proto.mediapipe.RenderAnnotation.Line.prototype.getLineType=function(){return t.Message.getFieldWithDefault(this,6,1)},proto.mediapipe.RenderAnnotation.Line.prototype.setLineType=function(e){return t.Message.setField(this,6,e)},proto.mediapipe.RenderAnnotation.Line.prototype.clearLineType=function(){return t.Message.setField(this,6,void 0)},proto.mediapipe.RenderAnnotation.Line.prototype.hasLineType=function(){return null!=t.Message.getField(this,6)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.GradientLine.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.GradientLine.toObject(e,this)},proto.mediapipe.RenderAnnotation.GradientLine.toObject=function(e,r){var o,a={xStart:null==(o=t.Message.getOptionalFloatingPointField(r,1))?void 0:o,yStart:null==(o=t.Message.getOptionalFloatingPointField(r,2))?void 0:o,xEnd:null==(o=t.Message.getOptionalFloatingPointField(r,3))?void 0:o,yEnd:null==(o=t.Message.getOptionalFloatingPointField(r,4))?void 0:o,normalized:t.Message.getBooleanFieldWithDefault(r,5,!1),color1:(o=r.getColor1())&&i.Color.toObject(e,o),color2:(o=r.getColor2())&&i.Color.toObject(e,o)};return e&&(a.$jspbMessageInstance=r),a}),proto.mediapipe.RenderAnnotation.GradientLine.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation.GradientLine;return proto.mediapipe.RenderAnnotation.GradientLine.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.GradientLine.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readDouble();e.setXStart(r);break;case 2:r=t.readDouble();e.setYStart(r);break;case 3:r=t.readDouble();e.setXEnd(r);break;case 4:r=t.readDouble();e.setYEnd(r);break;case 5:r=t.readBool();e.setNormalized(r);break;case 6:r=new i.Color;t.readMessage(r,i.Color.deserializeBinaryFromReader),e.setColor1(r);break;case 7:r=new i.Color;t.readMessage(r,i.Color.deserializeBinaryFromReader),e.setColor2(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderAnnotation.GradientLine.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.GradientLine.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.GradientLine.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeDouble(1,o),null!=(o=t.Message.getField(e,2))&&r.writeDouble(2,o),null!=(o=t.Message.getField(e,3))&&r.writeDouble(3,o),null!=(o=t.Message.getField(e,4))&&r.writeDouble(4,o),null!=(o=t.Message.getField(e,5))&&r.writeBool(5,o),null!=(o=e.getColor1())&&r.writeMessage(6,o,i.Color.serializeBinaryToWriter),null!=(o=e.getColor2())&&r.writeMessage(7,o,i.Color.serializeBinaryToWriter)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.getXStart=function(){return t.Message.getFloatingPointFieldWithDefault(this,1,0)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.setXStart=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.clearXStart=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.hasXStart=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.getYStart=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,0)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.setYStart=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.clearYStart=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.hasYStart=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.getXEnd=function(){return t.Message.getFloatingPointFieldWithDefault(this,3,0)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.setXEnd=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.clearXEnd=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.hasXEnd=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.getYEnd=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,0)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.setYEnd=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.clearYEnd=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.hasYEnd=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.getNormalized=function(){return t.Message.getBooleanFieldWithDefault(this,5,!1)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.setNormalized=function(e){return t.Message.setField(this,5,e)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.clearNormalized=function(){return t.Message.setField(this,5,void 0)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.hasNormalized=function(){return null!=t.Message.getField(this,5)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.getColor1=function(){return t.Message.getWrapperField(this,i.Color,6)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.setColor1=function(e){return t.Message.setWrapperField(this,6,e)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.clearColor1=function(){return this.setColor1(void 0)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.hasColor1=function(){return null!=t.Message.getField(this,6)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.getColor2=function(){return t.Message.getWrapperField(this,i.Color,7)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.setColor2=function(e){return t.Message.setWrapperField(this,7,e)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.clearColor2=function(){return this.setColor2(void 0)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.hasColor2=function(){return null!=t.Message.getField(this,7)},proto.mediapipe.RenderAnnotation.Scribble.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.Scribble.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.Scribble.toObject(e,this)},proto.mediapipe.RenderAnnotation.Scribble.toObject=function(e,r){var o={pointList:t.Message.toObjectList(r.getPointList(),proto.mediapipe.RenderAnnotation.Point.toObject,e)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.RenderAnnotation.Scribble.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation.Scribble;return proto.mediapipe.RenderAnnotation.Scribble.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.Scribble.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new proto.mediapipe.RenderAnnotation.Point;t.readMessage(r,proto.mediapipe.RenderAnnotation.Point.deserializeBinaryFromReader),e.addPoint(r)}else t.skipField()}return e},proto.mediapipe.RenderAnnotation.Scribble.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.Scribble.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.Scribble.serializeBinaryToWriter=function(e,t){var r;(r=e.getPointList()).length>0&&t.writeRepeatedMessage(1,r,proto.mediapipe.RenderAnnotation.Point.serializeBinaryToWriter)},proto.mediapipe.RenderAnnotation.Scribble.prototype.getPointList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.RenderAnnotation.Point,1)},proto.mediapipe.RenderAnnotation.Scribble.prototype.setPointList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.RenderAnnotation.Scribble.prototype.addPoint=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.RenderAnnotation.Point,r)},proto.mediapipe.RenderAnnotation.Scribble.prototype.clearPointList=function(){return this.setPointList([])},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.Arrow.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.Arrow.toObject(e,this)},proto.mediapipe.RenderAnnotation.Arrow.toObject=function(e,r){var o,i={xStart:null==(o=t.Message.getOptionalFloatingPointField(r,1))?void 0:o,yStart:null==(o=t.Message.getOptionalFloatingPointField(r,2))?void 0:o,xEnd:null==(o=t.Message.getOptionalFloatingPointField(r,3))?void 0:o,yEnd:null==(o=t.Message.getOptionalFloatingPointField(r,4))?void 0:o,normalized:t.Message.getBooleanFieldWithDefault(r,5,!1)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.RenderAnnotation.Arrow.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation.Arrow;return proto.mediapipe.RenderAnnotation.Arrow.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.Arrow.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readDouble();e.setXStart(r);break;case 2:r=t.readDouble();e.setYStart(r);break;case 3:r=t.readDouble();e.setXEnd(r);break;case 4:r=t.readDouble();e.setYEnd(r);break;case 5:r=t.readBool();e.setNormalized(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderAnnotation.Arrow.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.Arrow.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.Arrow.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeDouble(1,o),null!=(o=t.Message.getField(e,2))&&r.writeDouble(2,o),null!=(o=t.Message.getField(e,3))&&r.writeDouble(3,o),null!=(o=t.Message.getField(e,4))&&r.writeDouble(4,o),null!=(o=t.Message.getField(e,5))&&r.writeBool(5,o)},proto.mediapipe.RenderAnnotation.Arrow.prototype.getXStart=function(){return t.Message.getFloatingPointFieldWithDefault(this,1,0)},proto.mediapipe.RenderAnnotation.Arrow.prototype.setXStart=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.RenderAnnotation.Arrow.prototype.clearXStart=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.RenderAnnotation.Arrow.prototype.hasXStart=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.RenderAnnotation.Arrow.prototype.getYStart=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,0)},proto.mediapipe.RenderAnnotation.Arrow.prototype.setYStart=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.RenderAnnotation.Arrow.prototype.clearYStart=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.RenderAnnotation.Arrow.prototype.hasYStart=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.RenderAnnotation.Arrow.prototype.getXEnd=function(){return t.Message.getFloatingPointFieldWithDefault(this,3,0)},proto.mediapipe.RenderAnnotation.Arrow.prototype.setXEnd=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.RenderAnnotation.Arrow.prototype.clearXEnd=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.RenderAnnotation.Arrow.prototype.hasXEnd=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.RenderAnnotation.Arrow.prototype.getYEnd=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,0)},proto.mediapipe.RenderAnnotation.Arrow.prototype.setYEnd=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.RenderAnnotation.Arrow.prototype.clearYEnd=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.RenderAnnotation.Arrow.prototype.hasYEnd=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.RenderAnnotation.Arrow.prototype.getNormalized=function(){return t.Message.getBooleanFieldWithDefault(this,5,!1)},proto.mediapipe.RenderAnnotation.Arrow.prototype.setNormalized=function(e){return t.Message.setField(this,5,e)},proto.mediapipe.RenderAnnotation.Arrow.prototype.clearNormalized=function(){return t.Message.setField(this,5,void 0)},proto.mediapipe.RenderAnnotation.Arrow.prototype.hasNormalized=function(){return null!=t.Message.getField(this,5)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.Text.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.Text.toObject(e,this)},proto.mediapipe.RenderAnnotation.Text.toObject=function(e,r){var o,a={displayText:null==(o=t.Message.getField(r,1))?void 0:o,left:null==(o=t.Message.getOptionalFloatingPointField(r,2))?void 0:o,baseline:null==(o=t.Message.getOptionalFloatingPointField(r,3))?void 0:o,fontHeight:t.Message.getFloatingPointFieldWithDefault(r,4,8),normalized:t.Message.getBooleanFieldWithDefault(r,5,!1),fontFace:t.Message.getFieldWithDefault(r,6,0),centerHorizontally:t.Message.getBooleanFieldWithDefault(r,7,!1),centerVertically:t.Message.getBooleanFieldWithDefault(r,8,!1),outlineThickness:t.Message.getFloatingPointFieldWithDefault(r,11,0),outlineColor:(o=r.getOutlineColor())&&i.Color.toObject(e,o)};return e&&(a.$jspbMessageInstance=r),a}),proto.mediapipe.RenderAnnotation.Text.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation.Text;return proto.mediapipe.RenderAnnotation.Text.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.Text.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setDisplayText(r);break;case 2:r=t.readDouble();e.setLeft(r);break;case 3:r=t.readDouble();e.setBaseline(r);break;case 4:r=t.readDouble();e.setFontHeight(r);break;case 5:r=t.readBool();e.setNormalized(r);break;case 6:r=t.readInt32();e.setFontFace(r);break;case 7:r=t.readBool();e.setCenterHorizontally(r);break;case 8:r=t.readBool();e.setCenterVertically(r);break;case 11:r=t.readDouble();e.setOutlineThickness(r);break;case 12:r=new i.Color;t.readMessage(r,i.Color.deserializeBinaryFromReader),e.setOutlineColor(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderAnnotation.Text.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.Text.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.Text.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeString(1,o),null!=(o=t.Message.getField(e,2))&&r.writeDouble(2,o),null!=(o=t.Message.getField(e,3))&&r.writeDouble(3,o),null!=(o=t.Message.getField(e,4))&&r.writeDouble(4,o),null!=(o=t.Message.getField(e,5))&&r.writeBool(5,o),null!=(o=t.Message.getField(e,6))&&r.writeInt32(6,o),null!=(o=t.Message.getField(e,7))&&r.writeBool(7,o),null!=(o=t.Message.getField(e,8))&&r.writeBool(8,o),null!=(o=t.Message.getField(e,11))&&r.writeDouble(11,o),null!=(o=e.getOutlineColor())&&r.writeMessage(12,o,i.Color.serializeBinaryToWriter)},proto.mediapipe.RenderAnnotation.Text.prototype.getDisplayText=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.RenderAnnotation.Text.prototype.setDisplayText=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.RenderAnnotation.Text.prototype.clearDisplayText=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.RenderAnnotation.Text.prototype.hasDisplayText=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.RenderAnnotation.Text.prototype.getLeft=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,0)},proto.mediapipe.RenderAnnotation.Text.prototype.setLeft=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.RenderAnnotation.Text.prototype.clearLeft=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.RenderAnnotation.Text.prototype.hasLeft=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.RenderAnnotation.Text.prototype.getBaseline=function(){return t.Message.getFloatingPointFieldWithDefault(this,3,0)},proto.mediapipe.RenderAnnotation.Text.prototype.setBaseline=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.RenderAnnotation.Text.prototype.clearBaseline=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.RenderAnnotation.Text.prototype.hasBaseline=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.RenderAnnotation.Text.prototype.getFontHeight=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,8)},proto.mediapipe.RenderAnnotation.Text.prototype.setFontHeight=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.RenderAnnotation.Text.prototype.clearFontHeight=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.RenderAnnotation.Text.prototype.hasFontHeight=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.RenderAnnotation.Text.prototype.getNormalized=function(){return t.Message.getBooleanFieldWithDefault(this,5,!1)},proto.mediapipe.RenderAnnotation.Text.prototype.setNormalized=function(e){return t.Message.setField(this,5,e)},proto.mediapipe.RenderAnnotation.Text.prototype.clearNormalized=function(){return t.Message.setField(this,5,void 0)},proto.mediapipe.RenderAnnotation.Text.prototype.hasNormalized=function(){return null!=t.Message.getField(this,5)},proto.mediapipe.RenderAnnotation.Text.prototype.getFontFace=function(){return t.Message.getFieldWithDefault(this,6,0)},proto.mediapipe.RenderAnnotation.Text.prototype.setFontFace=function(e){return t.Message.setField(this,6,e)},proto.mediapipe.RenderAnnotation.Text.prototype.clearFontFace=function(){return t.Message.setField(this,6,void 0)},proto.mediapipe.RenderAnnotation.Text.prototype.hasFontFace=function(){return null!=t.Message.getField(this,6)},proto.mediapipe.RenderAnnotation.Text.prototype.getCenterHorizontally=function(){return t.Message.getBooleanFieldWithDefault(this,7,!1)},proto.mediapipe.RenderAnnotation.Text.prototype.setCenterHorizontally=function(e){return t.Message.setField(this,7,e)},proto.mediapipe.RenderAnnotation.Text.prototype.clearCenterHorizontally=function(){return t.Message.setField(this,7,void 0)},proto.mediapipe.RenderAnnotation.Text.prototype.hasCenterHorizontally=function(){return null!=t.Message.getField(this,7)},proto.mediapipe.RenderAnnotation.Text.prototype.getCenterVertically=function(){return t.Message.getBooleanFieldWithDefault(this,8,!1)},proto.mediapipe.RenderAnnotation.Text.prototype.setCenterVertically=function(e){return t.Message.setField(this,8,e)},proto.mediapipe.RenderAnnotation.Text.prototype.clearCenterVertically=function(){return t.Message.setField(this,8,void 0)},proto.mediapipe.RenderAnnotation.Text.prototype.hasCenterVertically=function(){return null!=t.Message.getField(this,8)},proto.mediapipe.RenderAnnotation.Text.prototype.getOutlineThickness=function(){return t.Message.getFloatingPointFieldWithDefault(this,11,0)},proto.mediapipe.RenderAnnotation.Text.prototype.setOutlineThickness=function(e){return t.Message.setField(this,11,e)},proto.mediapipe.RenderAnnotation.Text.prototype.clearOutlineThickness=function(){return t.Message.setField(this,11,void 0)},proto.mediapipe.RenderAnnotation.Text.prototype.hasOutlineThickness=function(){return null!=t.Message.getField(this,11)},proto.mediapipe.RenderAnnotation.Text.prototype.getOutlineColor=function(){return t.Message.getWrapperField(this,i.Color,12)},proto.mediapipe.RenderAnnotation.Text.prototype.setOutlineColor=function(e){return t.Message.setWrapperField(this,12,e)},proto.mediapipe.RenderAnnotation.Text.prototype.clearOutlineColor=function(){return this.setOutlineColor(void 0)},proto.mediapipe.RenderAnnotation.Text.prototype.hasOutlineColor=function(){return null!=t.Message.getField(this,12)},proto.mediapipe.RenderAnnotation.prototype.getRectangle=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.Rectangle,1)},proto.mediapipe.RenderAnnotation.prototype.setRectangle=function(e){return t.Message.setOneofWrapperField(this,1,proto.mediapipe.RenderAnnotation.oneofGroups_[0],e)},proto.mediapipe.RenderAnnotation.prototype.clearRectangle=function(){return this.setRectangle(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasRectangle=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.RenderAnnotation.prototype.getFilledRectangle=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.FilledRectangle,2)},proto.mediapipe.RenderAnnotation.prototype.setFilledRectangle=function(e){return t.Message.setOneofWrapperField(this,2,proto.mediapipe.RenderAnnotation.oneofGroups_[0],e)},proto.mediapipe.RenderAnnotation.prototype.clearFilledRectangle=function(){return this.setFilledRectangle(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasFilledRectangle=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.RenderAnnotation.prototype.getOval=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.Oval,3)},proto.mediapipe.RenderAnnotation.prototype.setOval=function(e){return t.Message.setOneofWrapperField(this,3,proto.mediapipe.RenderAnnotation.oneofGroups_[0],e)},proto.mediapipe.RenderAnnotation.prototype.clearOval=function(){return this.setOval(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasOval=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.RenderAnnotation.prototype.getFilledOval=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.FilledOval,4)},proto.mediapipe.RenderAnnotation.prototype.setFilledOval=function(e){return t.Message.setOneofWrapperField(this,4,proto.mediapipe.RenderAnnotation.oneofGroups_[0],e)},proto.mediapipe.RenderAnnotation.prototype.clearFilledOval=function(){return this.setFilledOval(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasFilledOval=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.RenderAnnotation.prototype.getPoint=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.Point,5)},proto.mediapipe.RenderAnnotation.prototype.setPoint=function(e){return t.Message.setOneofWrapperField(this,5,proto.mediapipe.RenderAnnotation.oneofGroups_[0],e)},proto.mediapipe.RenderAnnotation.prototype.clearPoint=function(){return this.setPoint(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasPoint=function(){return null!=t.Message.getField(this,5)},proto.mediapipe.RenderAnnotation.prototype.getLine=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.Line,6)},proto.mediapipe.RenderAnnotation.prototype.setLine=function(e){return t.Message.setOneofWrapperField(this,6,proto.mediapipe.RenderAnnotation.oneofGroups_[0],e)},proto.mediapipe.RenderAnnotation.prototype.clearLine=function(){return this.setLine(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasLine=function(){return null!=t.Message.getField(this,6)},proto.mediapipe.RenderAnnotation.prototype.getArrow=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.Arrow,7)},proto.mediapipe.RenderAnnotation.prototype.setArrow=function(e){return t.Message.setOneofWrapperField(this,7,proto.mediapipe.RenderAnnotation.oneofGroups_[0],e)},proto.mediapipe.RenderAnnotation.prototype.clearArrow=function(){return this.setArrow(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasArrow=function(){return null!=t.Message.getField(this,7)},proto.mediapipe.RenderAnnotation.prototype.getText=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.Text,8)},proto.mediapipe.RenderAnnotation.prototype.setText=function(e){return t.Message.setOneofWrapperField(this,8,proto.mediapipe.RenderAnnotation.oneofGroups_[0],e)},proto.mediapipe.RenderAnnotation.prototype.clearText=function(){return this.setText(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasText=function(){return null!=t.Message.getField(this,8)},proto.mediapipe.RenderAnnotation.prototype.getRoundedRectangle=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.RoundedRectangle,9)},proto.mediapipe.RenderAnnotation.prototype.setRoundedRectangle=function(e){return t.Message.setOneofWrapperField(this,9,proto.mediapipe.RenderAnnotation.oneofGroups_[0],e)},proto.mediapipe.RenderAnnotation.prototype.clearRoundedRectangle=function(){return this.setRoundedRectangle(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasRoundedRectangle=function(){return null!=t.Message.getField(this,9)},proto.mediapipe.RenderAnnotation.prototype.getFilledRoundedRectangle=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.FilledRoundedRectangle,10)},proto.mediapipe.RenderAnnotation.prototype.setFilledRoundedRectangle=function(e){return t.Message.setOneofWrapperField(this,10,proto.mediapipe.RenderAnnotation.oneofGroups_[0],e)},proto.mediapipe.RenderAnnotation.prototype.clearFilledRoundedRectangle=function(){return this.setFilledRoundedRectangle(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasFilledRoundedRectangle=function(){return null!=t.Message.getField(this,10)},proto.mediapipe.RenderAnnotation.prototype.getGradientLine=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.GradientLine,14)},proto.mediapipe.RenderAnnotation.prototype.setGradientLine=function(e){return t.Message.setOneofWrapperField(this,14,proto.mediapipe.RenderAnnotation.oneofGroups_[0],e)},proto.mediapipe.RenderAnnotation.prototype.clearGradientLine=function(){return this.setGradientLine(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasGradientLine=function(){return null!=t.Message.getField(this,14)},proto.mediapipe.RenderAnnotation.prototype.getScribble=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.Scribble,15)},proto.mediapipe.RenderAnnotation.prototype.setScribble=function(e){return t.Message.setOneofWrapperField(this,15,proto.mediapipe.RenderAnnotation.oneofGroups_[0],e)},proto.mediapipe.RenderAnnotation.prototype.clearScribble=function(){return this.setScribble(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasScribble=function(){return null!=t.Message.getField(this,15)},proto.mediapipe.RenderAnnotation.prototype.getThickness=function(){return t.Message.getFloatingPointFieldWithDefault(this,11,1)},proto.mediapipe.RenderAnnotation.prototype.setThickness=function(e){return t.Message.setField(this,11,e)},proto.mediapipe.RenderAnnotation.prototype.clearThickness=function(){return t.Message.setField(this,11,void 0)},proto.mediapipe.RenderAnnotation.prototype.hasThickness=function(){return null!=t.Message.getField(this,11)},proto.mediapipe.RenderAnnotation.prototype.getColor=function(){return t.Message.getWrapperField(this,i.Color,12)},proto.mediapipe.RenderAnnotation.prototype.setColor=function(e){return t.Message.setWrapperField(this,12,e)},proto.mediapipe.RenderAnnotation.prototype.clearColor=function(){return this.setColor(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasColor=function(){return null!=t.Message.getField(this,12)},proto.mediapipe.RenderAnnotation.prototype.getSceneTag=function(){return t.Message.getFieldWithDefault(this,13,"")},proto.mediapipe.RenderAnnotation.prototype.setSceneTag=function(e){return t.Message.setField(this,13,e)},proto.mediapipe.RenderAnnotation.prototype.clearSceneTag=function(){return t.Message.setField(this,13,void 0)},proto.mediapipe.RenderAnnotation.prototype.hasSceneTag=function(){return null!=t.Message.getField(this,13)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderViewport.prototype.toObject=function(e){return proto.mediapipe.RenderViewport.toObject(e,this)},proto.mediapipe.RenderViewport.toObject=function(e,r){var o,i={id:null==(o=t.Message.getField(r,1))?void 0:o,widthPx:null==(o=t.Message.getField(r,2))?void 0:o,heightPx:null==(o=t.Message.getField(r,3))?void 0:o,composeOnVideo:null==(o=t.Message.getBooleanField(r,4))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.RenderViewport.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderViewport;return proto.mediapipe.RenderViewport.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderViewport.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setId(r);break;case 2:r=t.readInt32();e.setWidthPx(r);break;case 3:r=t.readInt32();e.setHeightPx(r);break;case 4:r=t.readBool();e.setComposeOnVideo(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderViewport.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderViewport.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderViewport.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeString(1,o),null!=(o=t.Message.getField(e,2))&&r.writeInt32(2,o),null!=(o=t.Message.getField(e,3))&&r.writeInt32(3,o),null!=(o=t.Message.getField(e,4))&&r.writeBool(4,o)},proto.mediapipe.RenderViewport.prototype.getId=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.RenderViewport.prototype.setId=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.RenderViewport.prototype.clearId=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.RenderViewport.prototype.hasId=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.RenderViewport.prototype.getWidthPx=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.RenderViewport.prototype.setWidthPx=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.RenderViewport.prototype.clearWidthPx=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.RenderViewport.prototype.hasWidthPx=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.RenderViewport.prototype.getHeightPx=function(){return t.Message.getFieldWithDefault(this,3,0)},proto.mediapipe.RenderViewport.prototype.setHeightPx=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.RenderViewport.prototype.clearHeightPx=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.RenderViewport.prototype.hasHeightPx=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.RenderViewport.prototype.getComposeOnVideo=function(){return t.Message.getBooleanFieldWithDefault(this,4,!1)},proto.mediapipe.RenderViewport.prototype.setComposeOnVideo=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.RenderViewport.prototype.clearComposeOnVideo=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.RenderViewport.prototype.hasComposeOnVideo=function(){return null!=t.Message.getField(this,4)},r.object.extend(e,proto.mediapipe)}(render_data_pb);var interactive_segmenter_options={};Object.defineProperty(interactive_segmenter_options,"__esModule",{value:!0});var interactive_segmenter_result={};Object.defineProperty(interactive_segmenter_result,"__esModule",{value:!0}),function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,i)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(e,r){for(var o in e)"default"===o||Object.prototype.hasOwnProperty.call(r,o)||t(r,e,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.InteractiveSegmenter=void 0;const o=calculator_pb,i=calculator_options_pb,a=base_options_pb,n=image_segmenter_graph_options_pb,s=segmenter_options_pb,p=vision_task_runner,d=color_pb,l=render_data_pb;r(interactive_segmenter_options,e),r(interactive_segmenter_result,e);const g="image_in",c="norm_rect_in",u="roi_in",m="confidence_masks",f="category_mask";class h extends p.VisionTaskRunner{static createFromOptions(e,t){return p.VisionTaskRunner.createVisionInstance(h,e,t)}static createFromModelBuffer(e,t){return p.VisionTaskRunner.createVisionInstance(h,e,{baseOptions:{modelAssetBuffer:t}})}static createFromModelPath(e,t){return p.VisionTaskRunner.createVisionInstance(h,e,{baseOptions:{modelAssetPath:t}})}constructor(e,t){super(new p.VisionGraphRunner(e,t),g,c,!1),this.result={},this.outputCategoryMask=false,this.outputConfidenceMasks=true,this.options=new n.ImageSegmenterGraphOptions,this.segmenterOptions=new s.SegmenterOptions,this.options.setSegmenterOptions(this.segmenterOptions),this.options.setBaseOptions(new a.BaseOptions)}get baseOptions(){return this.options.getBaseOptions()}set baseOptions(e){this.options.setBaseOptions(e)}setOptions(e){var t,r;return"outputCategoryMask"in e&&(this.outputCategoryMask=null!==(t=e.outputCategoryMask)&&void 0!==t&&t),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=null===(r=e.outputConfidenceMasks)||void 0===r||r),super.applyOptions(e)}segment(e,t,r,o){const i="function"!=typeof r?r:{};if(this.userCallback="function"==typeof r?r:o,this.reset(),this.processRenderData(t,this.getSynctheticTimestamp()),this.processImageData(e,i),!this.userCallback)return this.result}reset(){this.result={}}maybeInvokeCallback(){this.outputConfidenceMasks&&!("confidenceMasks"in this.result)||this.outputCategoryMask&&!("categoryMask"in this.result)||this.userCallback&&(this.userCallback(this.result),this.freeKeepaliveStreams())}refreshGraph(){const e=new o.CalculatorGraphConfig;e.addInputStream(g),e.addInputStream(u),e.addInputStream(c);const t=new i.CalculatorOptions;t.setExtension(n.ImageSegmenterGraphOptions.ext,this.options);const r=new o.CalculatorGraphConfig.Node;r.setCalculator("mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraph"),r.addInputStream("IMAGE:"+g),r.addInputStream("ROI:"+u),r.addInputStream("NORM_RECT:"+c),r.setOptions(t),e.addNode(r),this.addKeepaliveNode(e),this.outputConfidenceMasks&&(e.addOutputStream(m),r.addOutputStream("CONFIDENCE_MASKS:"+m),this.keepStreamAlive(m),this.graphRunner.attachImageVectorListener(m,((e,t)=>{this.result.confidenceMasks=e.map((e=>this.convertToMPMask(e,!this.userCallback))),this.setLatestOutputTimestamp(t),this.maybeInvokeCallback()})),this.graphRunner.attachEmptyPacketListener(m,(e=>{this.result.confidenceMasks=void 0,this.setLatestOutputTimestamp(e),this.maybeInvokeCallback()}))),this.outputCategoryMask&&(e.addOutputStream(f),r.addOutputStream("CATEGORY_MASK:"+f),this.keepStreamAlive(f),this.graphRunner.attachImageListener(f,((e,t)=>{this.result.categoryMask=this.convertToMPMask(e,!this.userCallback),this.setLatestOutputTimestamp(t),this.maybeInvokeCallback()})),this.graphRunner.attachEmptyPacketListener(f,(e=>{this.result.categoryMask=void 0,this.setLatestOutputTimestamp(e),this.maybeInvokeCallback()})));const a=e.serializeBinary();this.setGraph(new Uint8Array(a),!0)}processRenderData(e,t){const r=new l.RenderData,o=new l.RenderAnnotation,i=new d.Color;if(i.setR(255),o.setColor(i),e.keypoint&&e.scribble)throw new Error("Cannot provide both keypoint and scribble.");if(e.keypoint){const t=new l.RenderAnnotation.Point;t.setNormalized(!0),t.setX(e.keypoint.x),t.setY(e.keypoint.y),o.setPoint(t)}else{if(!e.scribble)throw new Error("Must provide either a keypoint or a scribble.");{const t=new l.RenderAnnotation.Scribble;for(const r of e.scribble){const e=new l.RenderAnnotation.Point;e.setNormalized(!0),e.setX(r.x),e.setY(r.y),t.addPoint(e)}o.setScribble(t)}}r.addRenderAnnotations(o),this.graphRunner.addProtoToStream(r.serializeBinary(),"drishti.RenderData",u,t)}}e.InteractiveSegmenter=h}(interactive_segmenter);var object_detector={},object_detector_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n),r.exportSymbol("proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions",null,o),proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.repeatedFields_,null)},r.inherits(proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.displayName="proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions"),proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.repeatedFields_=[5,6],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.toObject(e,this)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.toObject=function(e,r){var o,i={baseOptions:(o=r.getBaseOptions())&&n.BaseOptions.toObject(e,o),displayNamesLocale:t.Message.getFieldWithDefault(r,2,"en"),maxResults:t.Message.getFieldWithDefault(r,3,-1),scoreThreshold:null==(o=t.Message.getOptionalFloatingPointField(r,4))?void 0:o,categoryAllowlistList:null==(o=t.Message.getRepeatedField(r,5))?void 0:o,categoryDenylistList:null==(o=t.Message.getRepeatedField(r,6))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions;return proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=t.readString();e.setDisplayNamesLocale(r);break;case 3:r=t.readInt32();e.setMaxResults(r);break;case 4:r=t.readFloat();e.setScoreThreshold(r);break;case 5:r=t.readString();e.addCategoryAllowlist(r);break;case 6:r=t.readString();e.addCategoryDenylist(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getBaseOptions())&&r.writeMessage(1,o,n.BaseOptions.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeString(2,o),null!=(o=t.Message.getField(e,3))&&r.writeInt32(3,o),null!=(o=t.Message.getField(e,4))&&r.writeFloat(4,o),(o=e.getCategoryAllowlistList()).length>0&&r.writeRepeatedString(5,o),(o=e.getCategoryDenylistList()).length>0&&r.writeRepeatedString(6,o)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.ext=new t.ExtensionFieldInfo(443442058,{ext:0},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions,proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.toObject,0),a.CalculatorOptions.extensionsBinary[443442058]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[443442058]=proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.ext,proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.getDisplayNamesLocale=function(){return t.Message.getFieldWithDefault(this,2,"en")},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.setDisplayNamesLocale=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.clearDisplayNamesLocale=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.hasDisplayNamesLocale=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.getMaxResults=function(){return t.Message.getFieldWithDefault(this,3,-1)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.setMaxResults=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.clearMaxResults=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.hasMaxResults=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.getScoreThreshold=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,0)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.setScoreThreshold=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.clearScoreThreshold=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.hasScoreThreshold=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.getCategoryAllowlistList=function(){return t.Message.getRepeatedField(this,5)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.setCategoryAllowlistList=function(e){return t.Message.setField(this,5,e||[])},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.addCategoryAllowlist=function(e,r){return t.Message.addToRepeatedField(this,5,e,r)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.clearCategoryAllowlistList=function(){return this.setCategoryAllowlistList([])},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.getCategoryDenylistList=function(){return t.Message.getRepeatedField(this,6)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.setCategoryDenylistList=function(e){return t.Message.setField(this,6,e||[])},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.addCategoryDenylist=function(e,r){return t.Message.addToRepeatedField(this,6,e,r)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.clearCategoryDenylistList=function(){return this.setCategoryDenylistList([])},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.ext=new t.ExtensionFieldInfo(443442058,{ext:0},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions,proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.toObject,0),a.CalculatorOptions.extensionsBinary[443442058]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[443442058]=proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.object_detector.proto)}(object_detector_options_pb);var object_detector_options={};Object.defineProperty(object_detector_options,"__esModule",{value:!0});var object_detector_result={};Object.defineProperty(object_detector_result,"__esModule",{value:!0}),function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,i)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(e,r){for(var o in e)"default"===o||Object.prototype.hasOwnProperty.call(r,o)||t(r,e,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.ObjectDetector=void 0;const o=calculator_pb,i=calculator_options_pb,a=detection_pb,n=base_options_pb,s=object_detector_options_pb,p=detection_result,d=vision_task_runner,l="input_frame_gpu",g="norm_rect",c="detections";r(object_detector_options,e),r(object_detector_result,e);class u extends d.VisionTaskRunner{static createFromOptions(e,t){return d.VisionTaskRunner.createVisionInstance(u,e,t)}static createFromModelBuffer(e,t){return d.VisionTaskRunner.createVisionInstance(u,e,{baseOptions:{modelAssetBuffer:t}})}static async createFromModelPath(e,t){return d.VisionTaskRunner.createVisionInstance(u,e,{baseOptions:{modelAssetPath:t}})}constructor(e,t){super(new d.VisionGraphRunner(e,t),l,g,!1),this.result={detections:[]},this.options=new s.ObjectDetectorOptions,this.options.setBaseOptions(new n.BaseOptions)}get baseOptions(){return this.options.getBaseOptions()}set baseOptions(e){this.options.setBaseOptions(e)}setOptions(e){return void 0!==e.displayNamesLocale?this.options.setDisplayNamesLocale(e.displayNamesLocale):"displayNamesLocale"in e&&this.options.clearDisplayNamesLocale(),void 0!==e.maxResults?this.options.setMaxResults(e.maxResults):"maxResults"in e&&this.options.clearMaxResults(),void 0!==e.scoreThreshold?this.options.setScoreThreshold(e.scoreThreshold):"scoreThreshold"in e&&this.options.clearScoreThreshold(),void 0!==e.categoryAllowlist?this.options.setCategoryAllowlistList(e.categoryAllowlist):"categoryAllowlist"in e&&this.options.clearCategoryAllowlistList(),void 0!==e.categoryDenylist?this.options.setCategoryDenylistList(e.categoryDenylist):"categoryDenylist"in e&&this.options.clearCategoryDenylistList(),this.applyOptions(e)}detect(e,t){return this.result={detections:[]},this.processImageData(e,t),this.result}detectForVideo(e,t,r){return this.result={detections:[]},this.processVideoData(e,r,t),this.result}addJsObjectDetections(e){for(const t of e){const e=a.Detection.deserializeBinary(t);this.result.detections.push((0,p.convertFromDetectionProto)(e))}}refreshGraph(){const e=new o.CalculatorGraphConfig;e.addInputStream(l),e.addInputStream(g),e.addOutputStream(c);const t=new i.CalculatorOptions;t.setExtension(s.ObjectDetectorOptions.ext,this.options);const r=new o.CalculatorGraphConfig.Node;r.setCalculator("mediapipe.tasks.vision.ObjectDetectorGraph"),r.addInputStream("IMAGE:"+l),r.addInputStream("NORM_RECT:"+g),r.addOutputStream("DETECTIONS:"+c),r.setOptions(t),e.addNode(r),this.graphRunner.attachProtoVectorListener(c,((e,t)=>{this.addJsObjectDetections(e),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(c,(e=>{this.setLatestOutputTimestamp(e)}));const a=e.serializeBinary();this.setGraph(new Uint8Array(a),!0)}}e.ObjectDetector=u}(object_detector);var pose_landmarker={},pose_detector_graph_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n),r.exportSymbol("proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions",null,o),proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.displayName="proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.toObject=function(e,r){var o,i={baseOptions:(o=r.getBaseOptions())&&n.BaseOptions.toObject(e,o),minDetectionConfidence:t.Message.getFloatingPointFieldWithDefault(r,2,.5),minSuppressionThreshold:t.Message.getFloatingPointFieldWithDefault(r,3,.5),numPoses:null==(o=t.Message.getField(r,4))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions;return proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=t.readFloat();e.setMinDetectionConfidence(r);break;case 3:r=t.readFloat();e.setMinSuppressionThreshold(r);break;case 4:r=t.readInt32();e.setNumPoses(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getBaseOptions())&&r.writeMessage(1,o,n.BaseOptions.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeFloat(2,o),null!=(o=t.Message.getField(e,3))&&r.writeFloat(3,o),null!=(o=t.Message.getField(e,4))&&r.writeInt32(4,o)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.ext=new t.ExtensionFieldInfo(514774813,{ext:0},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions,proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[514774813]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[514774813]=proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.ext,proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.getMinDetectionConfidence=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,.5)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.setMinDetectionConfidence=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.clearMinDetectionConfidence=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.hasMinDetectionConfidence=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.getMinSuppressionThreshold=function(){return t.Message.getFloatingPointFieldWithDefault(this,3,.5)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.setMinSuppressionThreshold=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.clearMinSuppressionThreshold=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.hasMinSuppressionThreshold=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.getNumPoses=function(){return t.Message.getFieldWithDefault(this,4,0)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.setNumPoses=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.clearNumPoses=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.hasNumPoses=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.ext=new t.ExtensionFieldInfo(514774813,{ext:0},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions,proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[514774813]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[514774813]=proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.pose_detector.proto)}(pose_detector_graph_options_pb);var pose_landmarker_graph_options_pb={},pose_landmarks_detector_graph_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n),r.exportSymbol("proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions",null,o),proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.displayName="proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.toObject=function(e,r){var o,i={baseOptions:(o=r.getBaseOptions())&&n.BaseOptions.toObject(e,o),minDetectionConfidence:t.Message.getFloatingPointFieldWithDefault(r,2,.5)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions;return proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=t.readFloat();e.setMinDetectionConfidence(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getBaseOptions())&&r.writeMessage(1,o,n.BaseOptions.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeFloat(2,o)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.ext=new t.ExtensionFieldInfo(518928384,{ext:0},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[518928384]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[518928384]=proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.ext,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.prototype.getMinDetectionConfidence=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,.5)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.prototype.setMinDetectionConfidence=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.prototype.clearMinDetectionConfidence=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.prototype.hasMinDetectionConfidence=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.ext=new t.ExtensionFieldInfo(518928384,{ext:0},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[518928384]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[518928384]=proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.pose_landmarker.proto)}(pose_landmarks_detector_graph_options_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n);var s=pose_detector_graph_options_pb;r.object.extend(proto,s);var p=pose_landmarks_detector_graph_options_pb;r.object.extend(proto,p),r.exportSymbol("proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions",null,o),proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.displayName="proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.toObject=function(e,r){var o,i={baseOptions:(o=r.getBaseOptions())&&n.BaseOptions.toObject(e,o),poseDetectorGraphOptions:(o=r.getPoseDetectorGraphOptions())&&s.PoseDetectorGraphOptions.toObject(e,o),poseLandmarksDetectorGraphOptions:(o=r.getPoseLandmarksDetectorGraphOptions())&&p.PoseLandmarksDetectorGraphOptions.toObject(e,o),minTrackingConfidence:t.Message.getFloatingPointFieldWithDefault(r,4,.5)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions;return proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=new s.PoseDetectorGraphOptions;t.readMessage(r,s.PoseDetectorGraphOptions.deserializeBinaryFromReader),e.setPoseDetectorGraphOptions(r);break;case 3:r=new p.PoseLandmarksDetectorGraphOptions;t.readMessage(r,p.PoseLandmarksDetectorGraphOptions.deserializeBinaryFromReader),e.setPoseLandmarksDetectorGraphOptions(r);break;case 4:r=t.readFloat();e.setMinTrackingConfidence(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getBaseOptions())&&r.writeMessage(1,o,n.BaseOptions.serializeBinaryToWriter),null!=(o=e.getPoseDetectorGraphOptions())&&r.writeMessage(2,o,s.PoseDetectorGraphOptions.serializeBinaryToWriter),null!=(o=e.getPoseLandmarksDetectorGraphOptions())&&r.writeMessage(3,o,p.PoseLandmarksDetectorGraphOptions.serializeBinaryToWriter),null!=(o=t.Message.getField(e,4))&&r.writeFloat(4,o)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.ext=new t.ExtensionFieldInfo(516587230,{ext:0},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[516587230]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[516587230]=proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.ext,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.getPoseDetectorGraphOptions=function(){return t.Message.getWrapperField(this,s.PoseDetectorGraphOptions,2)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.setPoseDetectorGraphOptions=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.clearPoseDetectorGraphOptions=function(){return this.setPoseDetectorGraphOptions(void 0)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.hasPoseDetectorGraphOptions=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.getPoseLandmarksDetectorGraphOptions=function(){return t.Message.getWrapperField(this,p.PoseLandmarksDetectorGraphOptions,3)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.setPoseLandmarksDetectorGraphOptions=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.clearPoseLandmarksDetectorGraphOptions=function(){return this.setPoseLandmarksDetectorGraphOptions(void 0)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.hasPoseLandmarksDetectorGraphOptions=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.getMinTrackingConfidence=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,.5)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.setMinTrackingConfidence=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.clearMinTrackingConfidence=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.hasMinTrackingConfidence=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.ext=new t.ExtensionFieldInfo(516587230,{ext:0},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[516587230]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[516587230]=proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.pose_landmarker.proto)}(pose_landmarker_graph_options_pb);var pose_landmarker_options={};Object.defineProperty(pose_landmarker_options,"__esModule",{value:!0});var pose_landmarker_result={};Object.defineProperty(pose_landmarker_result,"__esModule",{value:!0}),function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,i)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(e,r){for(var o in e)"default"===o||Object.prototype.hasOwnProperty.call(r,o)||t(r,e,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.PoseLandmarker=void 0;const o=calculator_pb,i=calculator_options_pb,a=landmark_pb,n=base_options_pb,s=pose_detector_graph_options_pb,p=pose_landmarker_graph_options_pb,d=pose_landmarks_detector_graph_options_pb,l=landmark_result,g=vision_task_runner;r(pose_landmarker_options,e),r(pose_landmarker_result,e);const c="image_in",u="norm_rect",m="normalized_landmarks",f="world_landmarks",h="segmentation_masks",y=.5;class b extends g.VisionTaskRunner{static createFromOptions(e,t){return g.VisionTaskRunner.createVisionInstance(b,e,t)}static createFromModelBuffer(e,t){return g.VisionTaskRunner.createVisionInstance(b,e,{baseOptions:{modelAssetBuffer:t}})}static createFromModelPath(e,t){return g.VisionTaskRunner.createVisionInstance(b,e,{baseOptions:{modelAssetPath:t}})}constructor(e,t){super(new g.VisionGraphRunner(e,t),c,u,!1),this.result={},this.outputSegmentationMasks=!1,this.options=new p.PoseLandmarkerGraphOptions,this.options.setBaseOptions(new n.BaseOptions),this.poseLandmarksDetectorGraphOptions=new d.PoseLandmarksDetectorGraphOptions,this.options.setPoseLandmarksDetectorGraphOptions(this.poseLandmarksDetectorGraphOptions),this.poseDetectorGraphOptions=new s.PoseDetectorGraphOptions,this.options.setPoseDetectorGraphOptions(this.poseDetectorGraphOptions),this.initDefaults()}get baseOptions(){return this.options.getBaseOptions()}set baseOptions(e){this.options.setBaseOptions(e)}setOptions(e){var t,r,o,i,a;return"numPoses"in e&&this.poseDetectorGraphOptions.setNumPoses(null!==(t=e.numPoses)&&void 0!==t?t:1),"minPoseDetectionConfidence"in e&&this.poseDetectorGraphOptions.setMinDetectionConfidence(null!==(r=e.minPoseDetectionConfidence)&&void 0!==r?r:y),"minTrackingConfidence"in e&&this.options.setMinTrackingConfidence(null!==(o=e.minTrackingConfidence)&&void 0!==o?o:y),"minPosePresenceConfidence"in e&&this.poseLandmarksDetectorGraphOptions.setMinDetectionConfidence(null!==(i=e.minPosePresenceConfidence)&&void 0!==i?i:y),"outputSegmentationMasks"in e&&(this.outputSegmentationMasks=null!==(a=e.outputSegmentationMasks)&&void 0!==a&&a),this.applyOptions(e)}detect(e,t,r){const o="function"!=typeof t?t:{};if(this.userCallback="function"==typeof t?t:r,this.resetResults(),this.processImageData(e,o),!this.userCallback)return this.result}detectForVideo(e,t,r,o){const i="function"!=typeof r?r:{};if(this.userCallback="function"==typeof r?r:o,this.resetResults(),this.processVideoData(e,i,t),!this.userCallback)return this.result}resetResults(){this.result={}}maybeInvokeCallback(){"landmarks"in this.result&&"worldLandmarks"in this.result&&(this.outputSegmentationMasks&&!("segmentationMasks"in this.result)||this.userCallback&&(this.userCallback(this.result),this.freeKeepaliveStreams()))}initDefaults(){this.poseDetectorGraphOptions.setNumPoses(1),this.poseDetectorGraphOptions.setMinDetectionConfidence(y),this.poseLandmarksDetectorGraphOptions.setMinDetectionConfidence(y),this.options.setMinTrackingConfidence(y)}addJsLandmarks(e){this.result.landmarks=[];for(const t of e){const e=a.NormalizedLandmarkList.deserializeBinary(t);this.result.landmarks.push((0,l.convertToLandmarks)(e))}}adddJsWorldLandmarks(e){this.result.worldLandmarks=[];for(const t of e){const e=a.LandmarkList.deserializeBinary(t);this.result.worldLandmarks.push((0,l.convertToWorldLandmarks)(e))}}refreshGraph(){const e=new o.CalculatorGraphConfig;e.addInputStream(c),e.addInputStream(u),e.addOutputStream(m),e.addOutputStream(f),e.addOutputStream(h);const t=new i.CalculatorOptions;t.setExtension(p.PoseLandmarkerGraphOptions.ext,this.options);const r=new o.CalculatorGraphConfig.Node;r.setCalculator("mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),r.addInputStream("IMAGE:"+c),r.addInputStream("NORM_RECT:"+u),r.addOutputStream("NORM_LANDMARKS:"+m),r.addOutputStream("WORLD_LANDMARKS:"+f),r.setOptions(t),e.addNode(r),this.addKeepaliveNode(e),this.graphRunner.attachProtoVectorListener(m,((e,t)=>{this.addJsLandmarks(e),this.setLatestOutputTimestamp(t),this.maybeInvokeCallback()})),this.graphRunner.attachEmptyPacketListener(m,(e=>{this.result.landmarks=[],this.setLatestOutputTimestamp(e),this.maybeInvokeCallback()})),this.graphRunner.attachProtoVectorListener(f,((e,t)=>{this.adddJsWorldLandmarks(e),this.setLatestOutputTimestamp(t),this.maybeInvokeCallback()})),this.graphRunner.attachEmptyPacketListener(f,(e=>{this.result.worldLandmarks=[],this.setLatestOutputTimestamp(e),this.maybeInvokeCallback()})),this.outputSegmentationMasks&&(r.addOutputStream("SEGMENTATION_MASK:"+h),this.keepStreamAlive(h),this.graphRunner.attachImageVectorListener(h,((e,t)=>{this.result.segmentationMasks=e.map((e=>this.convertToMPMask(e,!this.userCallback))),this.setLatestOutputTimestamp(t),this.maybeInvokeCallback()})),this.graphRunner.attachEmptyPacketListener(h,(e=>{this.result.segmentationMasks=[],this.setLatestOutputTimestamp(e),this.maybeInvokeCallback()})));const a=e.serializeBinary();this.setGraph(new Uint8Array(a),!0)}}e.PoseLandmarker=b,b.POSE_CONNECTIONS=[{start:0,end:1},{start:1,end:2},{start:2,end:3},{start:3,end:7},{start:0,end:4},{start:4,end:5},{start:5,end:6},{start:6,end:8},{start:9,end:10},{start:11,end:12},{start:11,end:13},{start:13,end:15},{start:15,end:17},{start:15,end:19},{start:15,end:21},{start:17,end:19},{start:12,end:14},{start:14,end:16},{start:16,end:18},{start:16,end:20},{start:16,end:22},{start:18,end:20},{start:11,end:23},{start:12,end:24},{start:23,end:24},{start:23,end:25},{start:24,end:26},{start:25,end:27},{start:26,end:28},{start:27,end:29},{start:28,end:30},{start:29,end:31},{start:30,end:32},{start:27,end:31},{start:28,end:32}]}(pose_landmarker),Object.defineProperty(vision,"__esModule",{value:!0});var PoseLandmarker_1=vision.PoseLandmarker=ObjectDetector_1=vision.ObjectDetector=InteractiveSegmenter_1=vision.InteractiveSegmenter=ImageSegmenter_1=vision.ImageSegmenter=ImageEmbedder_1=vision.ImageEmbedder=ImageClassifier_1=vision.ImageClassifier=HandLandmarker_1=vision.HandLandmarker=GestureRecognizer_1=vision.GestureRecognizer=FaceStylizer_1=vision.FaceStylizer=FaceLandmarker_1=vision.FaceLandmarker=FaceDetector_1=vision.FaceDetector=MPMask_1=vision.MPMask=MPImage_1=vision.MPImage=FilesetResolver_1=vision.FilesetResolver=DrawingUtils_1=vision.DrawingUtils=void 0;const fileset_resolver_1=fileset_resolver,drawing_utils_1=drawing_utils,image_1=image,mask_1=mask,face_detector_1=face_detector,face_landmarker_1=face_landmarker,face_stylizer_1=face_stylizer,gesture_recognizer_1=gesture_recognizer,hand_landmarker_1=hand_landmarker,image_classifier_1=image_classifier,image_embedder_1=image_embedder,image_segmenter_1=image_segmenter,interactive_segmenter_1=interactive_segmenter,object_detector_1=object_detector,pose_landmarker_1=pose_landmarker,DrawingUtils=drawing_utils_1.DrawingUtils;var DrawingUtils_1=vision.DrawingUtils=DrawingUtils;const FilesetResolver=fileset_resolver_1.FilesetResolver;var FilesetResolver_1=vision.FilesetResolver=FilesetResolver;const MPImage=image_1.MPImage;var MPImage_1=vision.MPImage=MPImage;const MPMask=mask_1.MPMask;var MPMask_1=vision.MPMask=MPMask;const FaceDetector=face_detector_1.FaceDetector;var FaceDetector_1=vision.FaceDetector=FaceDetector;const FaceLandmarker=face_landmarker_1.FaceLandmarker;var FaceLandmarker_1=vision.FaceLandmarker=FaceLandmarker;const FaceStylizer=face_stylizer_1.FaceStylizer;var FaceStylizer_1=vision.FaceStylizer=FaceStylizer;const GestureRecognizer=gesture_recognizer_1.GestureRecognizer;var GestureRecognizer_1=vision.GestureRecognizer=GestureRecognizer;const HandLandmarker=hand_landmarker_1.HandLandmarker;var HandLandmarker_1=vision.HandLandmarker=HandLandmarker;const ImageClassifier=image_classifier_1.ImageClassifier;var ImageClassifier_1=vision.ImageClassifier=ImageClassifier;const ImageEmbedder=image_embedder_1.ImageEmbedder;var ImageEmbedder_1=vision.ImageEmbedder=ImageEmbedder;const ImageSegmenter=image_segmenter_1.ImageSegmenter;var ImageSegmenter_1=vision.ImageSegmenter=ImageSegmenter;const InteractiveSegmenter=interactive_segmenter_1.InteractiveSegmenter;var InteractiveSegmenter_1=vision.InteractiveSegmenter=InteractiveSegmenter;const ObjectDetector=object_detector_1.ObjectDetector;var ObjectDetector_1=vision.ObjectDetector=ObjectDetector;const PoseLandmarker=pose_landmarker_1.PoseLandmarker;PoseLandmarker_1=vision.PoseLandmarker=PoseLandmarker;export{DrawingUtils_1 as DrawingUtils,FaceDetector_1 as FaceDetector,FaceLandmarker_1 as FaceLandmarker,FaceStylizer_1 as FaceStylizer,FilesetResolver_1 as FilesetResolver,GestureRecognizer_1 as GestureRecognizer,HandLandmarker_1 as HandLandmarker,ImageClassifier_1 as ImageClassifier,ImageEmbedder_1 as ImageEmbedder,ImageSegmenter_1 as ImageSegmenter,InteractiveSegmenter_1 as InteractiveSegmenter,MPImage_1 as MPImage,MPMask_1 as MPMask,ObjectDetector_1 as ObjectDetector,PoseLandmarker_1 as PoseLandmarker,vision as default}; +var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},vision={},fileset_resolver={};let supportsSimd;Object.defineProperty(fileset_resolver,"__esModule",{value:!0}),fileset_resolver.FilesetResolver=void 0;const WASM_SIMD_CHECK=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]);async function isSimdSupported(){if(void 0===supportsSimd)try{await WebAssembly.instantiate(WASM_SIMD_CHECK),supportsSimd=!0}catch(e){supportsSimd=!1}return supportsSimd}async function createFileset(e,t=""){const r=await isSimdSupported()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}class FilesetResolver$1{static isSimdSupported(){return isSimdSupported()}static forAudioTasks(e){return createFileset("audio",e)}static forTextTasks(e){return createFileset("text",e)}static forVisionTasks(e){return createFileset("vision",e)}}fileset_resolver.FilesetResolver=FilesetResolver$1;var drawing_utils={};Object.defineProperty(drawing_utils,"__esModule",{value:!0}),drawing_utils.DrawingUtils=void 0;const DEFAULT_OPTIONS={color:"white",lineWidth:4,radius:6};function addDefaultOptions(e){return e=e||{},Object.assign(Object.assign(Object.assign({},DEFAULT_OPTIONS),{fillColor:e.color}),e)}function resolve(e,t){return e instanceof Function?e(t):e}class DrawingUtils$1{constructor(e){this.ctx=e}static clamp(e,t,r){const o=Math.min(t,r),i=Math.max(t,r);return Math.max(o,Math.min(i,e))}static lerp(e,t,r,o,i){const a=o*(1-(e-t)/(r-t))+i*(1-(r-e)/(r-t));return DrawingUtils$1.clamp(a,o,i)}drawLandmarks(e,t){if(!e)return;const r=this.ctx,o=addDefaultOptions(t);r.save();const i=r.canvas;let a=0;for(const t of e){r.fillStyle=resolve(o.fillColor,{index:a,from:t}),r.strokeStyle=resolve(o.color,{index:a,from:t}),r.lineWidth=resolve(o.lineWidth,{index:a,from:t});const e=new Path2D;e.arc(t.x*i.width,t.y*i.height,resolve(o.radius,{index:a,from:t}),0,2*Math.PI),r.fill(e),r.stroke(e),++a}r.restore()}drawConnectors(e,t,r){if(!e||!t)return;const o=this.ctx,i=addDefaultOptions(r);o.save();const a=o.canvas;let n=0;for(const r of t){o.beginPath();const t=e[r.start],s=e[r.end];t&&s&&(o.strokeStyle=resolve(i.color,{index:n,from:t,to:s}),o.lineWidth=resolve(i.lineWidth,{index:n,from:t,to:s}),o.moveTo(t.x*a.width,t.y*a.height),o.lineTo(s.x*a.width,s.y*a.height)),++n,o.stroke()}o.restore()}drawBoundingBox(e,t){const r=this.ctx,o=addDefaultOptions(t);r.save(),r.beginPath(),r.lineWidth=resolve(o.lineWidth,{}),r.strokeStyle=resolve(o.color,{}),r.fillStyle=resolve(o.fillColor,{}),r.moveTo(e.originX,e.originY),r.lineTo(e.originX+e.width,e.originY),r.lineTo(e.originX+e.width,e.originY+e.height),r.lineTo(e.originX,e.originY+e.height),r.lineTo(e.originX,e.originY),r.stroke(),r.fill(),r.restore()}}drawing_utils.DrawingUtils=DrawingUtils$1;var image={},image_shader_context={};Object.defineProperty(image_shader_context,"__esModule",{value:!0}),image_shader_context.MPImageShaderContext=image_shader_context.assertNotNull=void 0;const VERTEX_SHADER="\n attribute vec2 aVertex;\n attribute vec2 aTex;\n varying vec2 vTex;\n void main(void) {\n gl_Position = vec4(aVertex, 0.0, 1.0);\n vTex = aTex;\n }",FRAGMENT_SHADER="\n precision mediump float;\n varying vec2 vTex;\n uniform sampler2D inputTexture;\n void main() {\n gl_FragColor = texture2D(inputTexture, vTex);\n }\n ";function assertNotNull(e,t){if(null===e)throw new Error(`Unable to obtain required WebGL resource: ${t}`);return e}image_shader_context.assertNotNull=assertNotNull;class MPImageShaderBuffers{constructor(e,t,r,o){this.gl=e,this.vertexArrayObject=t,this.vertexBuffer=r,this.textureBuffer=o}bind(){this.gl.bindVertexArray(this.vertexArrayObject)}unbind(){this.gl.bindVertexArray(null)}close(){this.gl.deleteVertexArray(this.vertexArrayObject),this.gl.deleteBuffer(this.vertexBuffer),this.gl.deleteBuffer(this.textureBuffer)}}class MPImageShaderContext{compileShader(e,t){const r=this.gl,o=assertNotNull(r.createShader(t),"Failed to create WebGL shader");if(r.shaderSource(o,e),r.compileShader(o),!r.getShaderParameter(o,r.COMPILE_STATUS)){const e=r.getShaderInfoLog(o);throw new Error(`Could not compile WebGL shader: ${e}`)}return r.attachShader(this.program,o),o}setupShaders(){const e=this.gl;this.program=assertNotNull(e.createProgram(),"Failed to create WebGL program"),this.vertexShader=this.compileShader(VERTEX_SHADER,e.VERTEX_SHADER),this.fragmentShader=this.compileShader(FRAGMENT_SHADER,e.FRAGMENT_SHADER),e.linkProgram(this.program);if(!e.getProgramParameter(this.program,e.LINK_STATUS)){const t=e.getProgramInfoLog(this.program);throw new Error(`Error during program linking: ${t}`)}this.aVertex=e.getAttribLocation(this.program,"aVertex"),this.aTex=e.getAttribLocation(this.program,"aTex")}createBuffers(e){const t=this.gl,r=assertNotNull(t.createVertexArray(),"Failed to create vertex array");t.bindVertexArray(r);const o=assertNotNull(t.createBuffer(),"Failed to create buffer");t.bindBuffer(t.ARRAY_BUFFER,o),t.enableVertexAttribArray(this.aVertex),t.vertexAttribPointer(this.aVertex,2,t.FLOAT,!1,0,0),t.bufferData(t.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),t.STATIC_DRAW);const i=assertNotNull(t.createBuffer(),"Failed to create buffer");t.bindBuffer(t.ARRAY_BUFFER,i),t.enableVertexAttribArray(this.aTex),t.vertexAttribPointer(this.aTex,2,t.FLOAT,!1,0,0);const a=e?[0,1,0,0,1,0,1,1]:[0,0,0,1,1,1,1,0];return t.bufferData(t.ARRAY_BUFFER,new Float32Array(a),t.STATIC_DRAW),t.bindBuffer(t.ARRAY_BUFFER,null),t.bindVertexArray(null),new MPImageShaderBuffers(t,r,o,i)}getShaderBuffers(e){return e?(this.shaderBuffersFlipVertically||(this.shaderBuffersFlipVertically=this.createBuffers(!0)),this.shaderBuffersFlipVertically):(this.shaderBuffersPassthrough||(this.shaderBuffersPassthrough=this.createBuffers(!1)),this.shaderBuffersPassthrough)}maybeInitGL(e){if(this.gl){if(e!==this.gl)throw new Error("Cannot change GL context once initialized")}else this.gl=e}run(e,t,r){this.maybeInitGL(e),this.program||this.setupShaders();const o=this.getShaderBuffers(t);e.useProgram(this.program),o.bind();const i=r();return o.unbind(),i}bindFramebuffer(e,t){this.maybeInitGL(e),this.framebuffer||(this.framebuffer=assertNotNull(e.createFramebuffer(),"Failed to create framebuffe.")),e.bindFramebuffer(e.FRAMEBUFFER,this.framebuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)}unbindFramebuffer(){var e;null===(e=this.gl)||void 0===e||e.bindFramebuffer(this.gl.FRAMEBUFFER,null)}close(){if(this.program){const e=this.gl;e.deleteProgram(this.program),e.deleteShader(this.vertexShader),e.deleteShader(this.fragmentShader)}this.framebuffer&&this.gl.deleteFramebuffer(this.framebuffer),this.shaderBuffersPassthrough&&this.shaderBuffersPassthrough.close(),this.shaderBuffersFlipVertically&&this.shaderBuffersFlipVertically.close()}}image_shader_context.MPImageShaderContext=MPImageShaderContext,Object.defineProperty(image,"__esModule",{value:!0}),image.MPImage=void 0;const image_shader_context_1$2=image_shader_context;var MPImageType;!function(e){e[e.IMAGE_DATA=0]="IMAGE_DATA",e[e.IMAGE_BITMAP=1]="IMAGE_BITMAP",e[e.WEBGL_TEXTURE=2]="WEBGL_TEXTURE"}(MPImageType||(MPImageType={}));class MPImage$1{constructor(e,t,r,o,i,a,n){this.containers=e,this.ownsImageBitmap=t,this.ownsWebGLTexture=r,this.canvas=o,this.shaderContext=i,this.width=a,this.height=n}hasImageData(){return!!this.getContainer(MPImageType.IMAGE_DATA)}hasImageBitmap(){return!!this.getContainer(MPImageType.IMAGE_BITMAP)}hasWebGLTexture(){return!!this.getContainer(MPImageType.WEBGL_TEXTURE)}getAsImageData(){return this.convertToImageData()}getAsImageBitmap(){return this.convertToImageBitmap()}getAsWebGLTexture(){return this.convertToWebGLTexture()}getContainer(e){switch(e){case MPImageType.IMAGE_DATA:return this.containers.find((e=>e instanceof ImageData));case MPImageType.IMAGE_BITMAP:return this.containers.find((e=>"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap));case MPImageType.WEBGL_TEXTURE:return this.containers.find((e=>"undefined"!=typeof WebGLTexture&&e instanceof WebGLTexture));default:throw new Error(`Type is not supported: ${e}`)}}clone(){const e=[];for(const t of this.containers){let r;if(t instanceof ImageData)r=new ImageData(t.data,this.width,this.height);else if(t instanceof WebGLTexture){const e=this.getGL(),t=this.getShaderContext();e.activeTexture(e.TEXTURE1),r=(0,image_shader_context_1$2.assertNotNull)(e.createTexture(),"Failed to create texture"),e.bindTexture(e.TEXTURE_2D,r),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,this.width,this.height,0,e.RGBA,e.UNSIGNED_BYTE,null),t.bindFramebuffer(e,r),t.run(e,!1,(()=>{this.bindTexture(),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.drawArrays(e.TRIANGLE_FAN,0,4),this.unbindTexture()})),t.unbindFramebuffer(),this.unbindTexture()}else{if(!(t instanceof ImageBitmap))throw new Error(`Type is not supported: ${t}`);this.convertToWebGLTexture(),this.bindTexture(),r=this.copyTextureToBitmap(),this.unbindTexture()}e.push(r)}return new MPImage$1(e,this.hasImageBitmap(),this.hasWebGLTexture(),this.canvas,this.shaderContext,this.width,this.height)}getOffscreenCanvas(){if(!(this.canvas instanceof OffscreenCanvas))throw new Error("Conversion to ImageBitmap requires that the MediaPipe Tasks is initialized with an OffscreenCanvas");return this.canvas}getGL(){if(!this.canvas)throw new Error("Conversion to different image formats require that a canvas is passed when iniitializing the image.");return this.gl||(this.gl=(0,image_shader_context_1$2.assertNotNull)(this.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),this.gl}getShaderContext(){return this.shaderContext||(this.shaderContext=new image_shader_context_1$2.MPImageShaderContext),this.shaderContext}convertToImageBitmap(){let e=this.getContainer(MPImageType.IMAGE_BITMAP);return e||(this.convertToWebGLTexture(),e=this.convertWebGLTextureToImageBitmap(),this.containers.push(e),this.ownsImageBitmap=!0),e}convertToImageData(){let e=this.getContainer(MPImageType.IMAGE_DATA);if(!e){const t=this.getGL(),r=this.getShaderContext(),o=new Uint8Array(this.width*this.height*4),i=this.convertToWebGLTexture();r.bindFramebuffer(t,i),t.readPixels(0,0,this.width,this.height,t.RGBA,t.UNSIGNED_BYTE,o),r.unbindFramebuffer(),e=new ImageData(new Uint8ClampedArray(o.buffer),this.width,this.height),this.containers.push(e)}return e}convertToWebGLTexture(){let e=this.getContainer(MPImageType.WEBGL_TEXTURE);if(!e){const t=this.getGL();e=this.bindTexture();const r=this.getContainer(MPImageType.IMAGE_BITMAP)||this.convertToImageData();t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,r),this.unbindTexture()}return e}bindTexture(){const e=this.getGL();e.viewport(0,0,this.width,this.height),e.activeTexture(e.TEXTURE0);let t=this.getContainer(MPImageType.WEBGL_TEXTURE);return t||(t=(0,image_shader_context_1$2.assertNotNull)(e.createTexture(),"Failed to create texture"),this.containers.push(t),this.ownsWebGLTexture=!0),e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),t}unbindTexture(){this.gl.bindTexture(this.gl.TEXTURE_2D,null)}copyTextureToBitmap(){const e=this.getGL();return this.getShaderContext().run(e,!0,(()=>this.runWithResizedCanvas((()=>(e.bindFramebuffer(e.FRAMEBUFFER,null),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.drawArrays(e.TRIANGLE_FAN,0,4),this.getOffscreenCanvas().transferToImageBitmap())))))}convertWebGLTextureToImageBitmap(){this.bindTexture();const e=this.copyTextureToBitmap();return this.unbindTexture(),e}runWithResizedCanvas(e){const t=this.canvas;if(t.width===this.width&&t.height===this.height)return e();const r=t.width,o=t.height;t.width=this.width,t.height=this.height;const i=e();return t.width=r,t.height=o,i}close(){if(this.ownsImageBitmap&&this.getContainer(MPImageType.IMAGE_BITMAP).close(),this.ownsWebGLTexture){this.getGL().deleteTexture(this.getContainer(MPImageType.WEBGL_TEXTURE))}}}image.MPImage=MPImage$1;var mask={};Object.defineProperty(mask,"__esModule",{value:!0}),mask.MPMask=void 0;const image_shader_context_1$1=image_shader_context;var MPMaskType;!function(e){e[e.UINT8_ARRAY=0]="UINT8_ARRAY",e[e.FLOAT32_ARRAY=1]="FLOAT32_ARRAY",e[e.WEBGL_TEXTURE=2]="WEBGL_TEXTURE"}(MPMaskType||(MPMaskType={}));class MPMask$1{constructor(e,t,r,o,i,a){this.containers=e,this.ownsWebGLTexture=t,this.canvas=r,this.shaderContext=o,this.width=i,this.height=a}hasUint8Array(){return!!this.getContainer(MPMaskType.UINT8_ARRAY)}hasFloat32Array(){return!!this.getContainer(MPMaskType.FLOAT32_ARRAY)}hasWebGLTexture(){return!!this.getContainer(MPMaskType.WEBGL_TEXTURE)}getAsUint8Array(){return this.convertToUint8Array()}getAsFloat32Array(){return this.convertToFloat32Array()}getAsWebGLTexture(){return this.convertToWebGLTexture()}getContainer(e){switch(e){case MPMaskType.UINT8_ARRAY:return this.containers.find((e=>e instanceof Uint8Array));case MPMaskType.FLOAT32_ARRAY:return this.containers.find((e=>e instanceof Float32Array));case MPMaskType.WEBGL_TEXTURE:return this.containers.find((e=>"undefined"!=typeof WebGLTexture&&e instanceof WebGLTexture));default:throw new Error(`Type is not supported: ${e}`)}}clone(){const e=[];for(const t of this.containers){let r;if(t instanceof Uint8Array)r=new Uint8Array(t);else if(t instanceof Float32Array)r=new Float32Array(t);else{if(!(t instanceof WebGLTexture))throw new Error(`Type is not supported: ${t}`);{const e=this.getGL(),t=this.getShaderContext();e.activeTexture(e.TEXTURE1),r=(0,image_shader_context_1$1.assertNotNull)(e.createTexture(),"Failed to create texture"),e.bindTexture(e.TEXTURE_2D,r),e.texImage2D(e.TEXTURE_2D,0,e.R32F,this.width,this.height,0,e.RED,e.FLOAT,null),e.bindTexture(e.TEXTURE_2D,null),t.bindFramebuffer(e,r),t.run(e,!1,(()=>{this.bindTexture(),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.drawArrays(e.TRIANGLE_FAN,0,4),this.unbindTexture()})),t.unbindFramebuffer(),this.unbindTexture()}}e.push(r)}return new MPMask$1(e,this.hasWebGLTexture(),this.canvas,this.shaderContext,this.width,this.height)}getGL(){if(!this.canvas)throw new Error("Conversion to different image formats require that a canvas is passed when iniitializing the image.");this.gl||(this.gl=(0,image_shader_context_1$1.assertNotNull)(this.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context."));if(!this.gl.getExtension("EXT_color_buffer_float"))throw new Error("Missing required EXT_color_buffer_float extension");return this.gl}getShaderContext(){return this.shaderContext||(this.shaderContext=new image_shader_context_1$1.MPImageShaderContext),this.shaderContext}convertToFloat32Array(){let e=this.getContainer(MPMaskType.FLOAT32_ARRAY);if(!e){const t=this.getContainer(MPMaskType.UINT8_ARRAY);if(t)e=new Float32Array(t).map((e=>e/255));else{const t=this.getGL(),r=this.getShaderContext();e=new Float32Array(this.width*this.height);const o=this.convertToWebGLTexture();r.bindFramebuffer(t,o),t.readPixels(0,0,this.width,this.height,t.RED,t.FLOAT,e),r.unbindFramebuffer()}this.containers.push(e)}return e}convertToUint8Array(){let e=this.getContainer(MPMaskType.UINT8_ARRAY);if(!e){const t=this.convertToFloat32Array();e=new Uint8Array(t.map((e=>255*e))),this.containers.push(e)}return e}convertToWebGLTexture(){let e=this.getContainer(MPMaskType.WEBGL_TEXTURE);if(!e){const t=this.getGL();e=this.bindTexture();const r=this.convertToFloat32Array();t.texImage2D(t.TEXTURE_2D,0,t.R32F,this.width,this.height,0,t.RED,t.FLOAT,r),this.unbindTexture()}return e}bindTexture(){const e=this.getGL();e.viewport(0,0,this.width,this.height),e.activeTexture(e.TEXTURE0);let t=this.getContainer(MPMaskType.WEBGL_TEXTURE);return t||(t=(0,image_shader_context_1$1.assertNotNull)(e.createTexture(),"Failed to create texture"),this.containers.push(t),this.ownsWebGLTexture=!0),e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),t}unbindTexture(){this.gl.bindTexture(this.gl.TEXTURE_2D,null)}close(){if(this.ownsWebGLTexture){this.getGL().deleteTexture(this.getContainer(MPMaskType.WEBGL_TEXTURE))}}}mask.MPMask=MPMask$1;var face_detector={},calculator_pb={},googleProtobuf={};(function(exports){var $jscomp=$jscomp||{};$jscomp.scope={},$jscomp.findInternal=function(e,t,r){e instanceof String&&(e=String(e));for(var o=e.length,i=0;i=o}}),"es6","es3"),$jscomp.polyfill("Array.prototype.find",(function(e){return e||function(e,t){return $jscomp.findInternal(this,e,t).v}}),"es6","es3"),$jscomp.polyfill("String.prototype.startsWith",(function(e){return e||function(e,t){var r=$jscomp.checkStringArgs(this,e,"startsWith");e+="";var o=r.length,i=e.length;t=Math.max(0,Math.min(0|t,r.length));for(var a=0;a=i}}),"es6","es3"),$jscomp.polyfill("String.prototype.repeat",(function(e){return e||function(e){var t=$jscomp.checkStringArgs(this,null,"repeat");if(0>e||1342177279>>=1)&&(t+=t);return r}}),"es6","es3");var COMPILED=!0,goog=goog||{};goog.global=commonjsGlobal||self,goog.exportPath_=function(e,t,r){e=e.split("."),r=r||goog.global,e[0]in r||void 0===r.execScript||r.execScript("var "+e[0]);for(var o;e.length&&(o=e.shift());)e.length||void 0===t?r=r[o]&&r[o]!==Object.prototype[o]?r[o]:r[o]={}:r[o]=t},goog.define=function(e,t){return t},goog.FEATURESET_YEAR=2012,goog.DEBUG=!0,goog.LOCALE="en",goog.TRUSTED_SITE=!0,goog.STRICT_MODE_COMPATIBLE=!1,goog.DISALLOW_TEST_ONLY_CODE=!goog.DEBUG,goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING=!1,goog.provide=function(e){if(goog.isInModuleLoader_())throw Error("goog.provide cannot be used within a module.");goog.constructNamespace_(e)},goog.constructNamespace_=function(e,t){goog.exportPath_(e,t)},goog.getScriptNonce=function(e){return e&&e!=goog.global?goog.getScriptNonce_(e.document):(null===goog.cspNonce_&&(goog.cspNonce_=goog.getScriptNonce_(goog.global.document)),goog.cspNonce_)},goog.NONCE_PATTERN_=/^[\w+/_-]+[=]{0,2}$/,goog.cspNonce_=null,goog.getScriptNonce_=function(e){return(e=e.querySelector&&e.querySelector("script[nonce]"))&&(e=e.nonce||e.getAttribute("nonce"))&&goog.NONCE_PATTERN_.test(e)?e:""},goog.VALID_MODULE_RE_=/^[a-zA-Z_$][a-zA-Z0-9._$]*$/,goog.module=function(e){if("string"!=typeof e||!e||-1==e.search(goog.VALID_MODULE_RE_))throw Error("Invalid module identifier");if(!goog.isInGoogModuleLoader_())throw Error("Module "+e+" has been loaded incorrectly. Note, modules cannot be loaded as normal scripts. They require some kind of pre-processing step. You're likely trying to load a module via a script tag or as a part of a concatenated bundle without rewriting the module. For more info see: https://github.com/google/closure-library/wiki/goog.module:-an-ES6-module-like-alternative-to-goog.provide.");if(goog.moduleLoaderState_.moduleName)throw Error("goog.module may only be called once per module.");goog.moduleLoaderState_.moduleName=e},goog.module.get=function(e){return goog.module.getInternal_(e)},goog.module.getInternal_=function(e){return null},goog.ModuleType={ES6:"es6",GOOG:"goog"},goog.moduleLoaderState_=null,goog.isInModuleLoader_=function(){return goog.isInGoogModuleLoader_()||goog.isInEs6ModuleLoader_()},goog.isInGoogModuleLoader_=function(){return!!goog.moduleLoaderState_&&goog.moduleLoaderState_.type==goog.ModuleType.GOOG},goog.isInEs6ModuleLoader_=function(){if(goog.moduleLoaderState_&&goog.moduleLoaderState_.type==goog.ModuleType.ES6)return!0;var e=goog.global.$jscomp;return!!e&&("function"==typeof e.getCurrentModulePath&&!!e.getCurrentModulePath())},goog.module.declareLegacyNamespace=function(){goog.moduleLoaderState_.declareLegacyNamespace=!0},goog.declareModuleId=function(e){if(goog.moduleLoaderState_)goog.moduleLoaderState_.moduleName=e;else{var t=goog.global.$jscomp;if(!t||"function"!=typeof t.getCurrentModulePath)throw Error('Module with namespace "'+e+'" has been loaded incorrectly.');t=t.require(t.getCurrentModulePath()),goog.loadedModules_[e]={exports:t,type:goog.ModuleType.ES6,moduleId:e}}},goog.setTestOnly=function(e){if(goog.DISALLOW_TEST_ONLY_CODE)throw e=e||"",Error("Importing test-only code into non-debug environment"+(e?": "+e:"."))},goog.forwardDeclare=function(e){},goog.getObjectByName=function(e,t){e=e.split("."),t=t||goog.global;for(var r=0;r>>0),goog.uidCounter_=0,goog.getHashCode=goog.getUid,goog.removeHashCode=goog.removeUid,goog.cloneObject=function(e){var t=goog.typeOf(e);if("object"==t||"array"==t){if("function"==typeof e.clone)return e.clone();for(var r in t="array"==t?[]:{},e)t[r]=goog.cloneObject(e[r]);return t}return e},goog.bindNative_=function(e,t,r){return e.call.apply(e.bind,arguments)},goog.bindJs_=function(e,t,r){if(!e)throw Error();if(2r?Math.max(0,e.length+r):r,"string"==typeof e)return"string"!=typeof t||1!=t.length?-1:e.indexOf(t,r);for(;r(r=null==r?e.length-1:r)&&(r=Math.max(0,e.length+r)),"string"==typeof e)return"string"!=typeof t||1!=t.length?-1:e.lastIndexOf(t,r);for(;0<=r;r--)if(r in e&&e[r]===t)return r;return-1},goog.array.forEach=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.forEach)?function(e,t,r){goog.asserts.assert(null!=e.length),Array.prototype.forEach.call(e,t,r)}:function(e,t,r){for(var o=e.length,i="string"==typeof e?e.split(""):e,a=0;a(t=goog.array.findIndex(e,t,r))?null:"string"==typeof e?e.charAt(t):e[t]},goog.array.findIndex=function(e,t,r){for(var o=e.length,i="string"==typeof e?e.split(""):e,a=0;a(t=goog.array.findIndexRight(e,t,r))?null:"string"==typeof e?e.charAt(t):e[t]},goog.array.findIndexRight=function(e,t,r){var o=e.length,i="string"==typeof e?e.split(""):e;for(--o;0<=o;o--)if(o in i&&t.call(r,i[o],o,e))return o;return-1},goog.array.contains=function(e,t){return 0<=goog.array.indexOf(e,t)},goog.array.isEmpty=function(e){return 0==e.length},goog.array.clear=function(e){if(!Array.isArray(e))for(var t=e.length-1;0<=t;t--)delete e[t];e.length=0},goog.array.insert=function(e,t){goog.array.contains(e,t)||e.push(t)},goog.array.insertAt=function(e,t,r){goog.array.splice(e,r,0,t)},goog.array.insertArrayAt=function(e,t,r){goog.partial(goog.array.splice,e,r,0).apply(null,t)},goog.array.insertBefore=function(e,t,r){var o;2==arguments.length||0>(o=goog.array.indexOf(e,r))?e.push(t):goog.array.insertAt(e,t,o)},goog.array.remove=function(e,t){var r;return(r=0<=(t=goog.array.indexOf(e,t)))&&goog.array.removeAt(e,t),r},goog.array.removeLast=function(e,t){return 0<=(t=goog.array.lastIndexOf(e,t))&&(goog.array.removeAt(e,t),!0)},goog.array.removeAt=function(e,t){return goog.asserts.assert(null!=e.length),1==Array.prototype.splice.call(e,t,1).length},goog.array.removeIf=function(e,t,r){return 0<=(t=goog.array.findIndex(e,t,r))&&(goog.array.removeAt(e,t),!0)},goog.array.removeAllIf=function(e,t,r){var o=0;return goog.array.forEachRight(e,(function(i,a){t.call(r,i,a,e)&&goog.array.removeAt(e,a)&&o++})),o},goog.array.concat=function(e){return Array.prototype.concat.apply([],arguments)},goog.array.join=function(e){return Array.prototype.concat.apply([],arguments)},goog.array.toArray=function(e){var t=e.length;if(0=arguments.length?Array.prototype.slice.call(e,t):Array.prototype.slice.call(e,t,r)},goog.array.removeDuplicates=function(e,t,r){t=t||e;var o=function(e){return goog.isObject(e)?"o"+goog.getUid(e):(typeof e).charAt(0)+e};r=r||o,o={};for(var i=0,a=0;a>>1),d=r?t.call(i,e[p],p,e):t(o,e[p]);0t?1:e(r=goog.array.binarySearch(e,t,r))&&(goog.array.insertAt(e,t,-(r+1)),!0)},goog.array.binaryRemove=function(e,t,r){return 0<=(t=goog.array.binarySearch(e,t,r))&&goog.array.removeAt(e,t)},goog.array.bucket=function(e,t,r){for(var o={},i=0;i(r=r||1)*(a-i))return[];if(0a;e+=r)o.push(e);return o},goog.array.repeat=function(e,t){for(var r=[],o=0;ot&&Array.prototype.push.apply(e,e.splice(0,-t))),e},goog.array.moveItem=function(e,t,r){goog.asserts.assert(0<=t&&t>=8),t[r++]=i}return t},goog.crypt.byteArrayToString=function(e){if(8192>=e.length)return String.fromCharCode.apply(null,e);for(var t="",r=0;ri?t[r++]=i:(2048>i?t[r++]=i>>6|192:(55296==(64512&i)&&o+1>18|240,t[r++]=i>>12&63|128):t[r++]=i>>12|224,t[r++]=i>>6&63|128),t[r++]=63&i|128)}return t},goog.crypt.utf8ByteArrayToString=function(e){for(var t=[],r=0,o=0;ri)t[o++]=String.fromCharCode(i);else if(191i){var a=e[r++];t[o++]=String.fromCharCode((31&i)<<6|63&a)}else if(239i){a=e[r++];var n=e[r++];i=((7&i)<<18|(63&a)<<12|(63&n)<<6|63&e[r++])-65536,t[o++]=String.fromCharCode(55296+(i>>10)),t[o++]=String.fromCharCode(56320+(1023&i))}else a=e[r++],n=e[r++],t[o++]=String.fromCharCode((15&i)<<12|(63&a)<<6|63&n)}return t.join("")},goog.crypt.xorByteArray=function(e,t){goog.asserts.assert(e.length==t.length,"XOR array lengths must match");for(var r=[],o=0;o"}},goog.dom.asserts.getWindow_=function(e){try{var t=e&&e.ownerDocument,r=t&&(t.defaultView||t.parentWindow);if((r=r||goog.global).Element&&r.Location)return r}catch(e){}return null},goog.functions={},goog.functions.constant=function(e){return function(){return e}},goog.functions.FALSE=function(){return!1},goog.functions.TRUE=function(){return!0},goog.functions.NULL=function(){return null},goog.functions.identity=function(e,t){return e},goog.functions.error=function(e){return function(){throw Error(e)}},goog.functions.fail=function(e){return function(){throw e}},goog.functions.lock=function(e,t){return t=t||0,function(){return e.apply(this,Array.prototype.slice.call(arguments,0,t))}},goog.functions.nth=function(e){return function(){return arguments[e]}},goog.functions.partialRight=function(e,t){var r=Array.prototype.slice.call(arguments,1);return function(){var t=Array.prototype.slice.call(arguments);return t.push.apply(t,r),e.apply(this,t)}},goog.functions.withReturnValue=function(e,t){return goog.functions.sequence(e,goog.functions.constant(t))},goog.functions.equalTo=function(e,t){return function(r){return t?e==r:e===r}},goog.functions.compose=function(e,t){var r=arguments,o=r.length;return function(){var e;o&&(e=r[o-1].apply(this,arguments));for(var t=o-2;0<=t;t--)e=r[t].call(this,e);return e}},goog.functions.sequence=function(e){var t=arguments,r=t.length;return function(){for(var e,o=0;oe?goog.i18n.bidi.Dir.RTL:t?null:goog.i18n.bidi.Dir.NEUTRAL:null==e?null:e?goog.i18n.bidi.Dir.RTL:goog.i18n.bidi.Dir.LTR},goog.i18n.bidi.ltrChars_="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ऀ-῿‎Ⰰ-\ud801\ud804-\ud839\ud83c-\udbff豈-﬜︀-﹯﻽-￿",goog.i18n.bidi.rtlChars_="֑-ۯۺ-ࣿ‏\ud802-\ud803\ud83a-\ud83bיִ-﷿ﹰ-ﻼ",goog.i18n.bidi.htmlSkipReg_=/<[^>]*>|&[^;]+;/g,goog.i18n.bidi.stripHtmlIfNeeded_=function(e,t){return t?e.replace(goog.i18n.bidi.htmlSkipReg_,""):e},goog.i18n.bidi.rtlCharReg_=new RegExp("["+goog.i18n.bidi.rtlChars_+"]"),goog.i18n.bidi.ltrCharReg_=new RegExp("["+goog.i18n.bidi.ltrChars_+"]"),goog.i18n.bidi.hasAnyRtl=function(e,t){return goog.i18n.bidi.rtlCharReg_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,t))},goog.i18n.bidi.hasRtlChar=goog.i18n.bidi.hasAnyRtl,goog.i18n.bidi.hasAnyLtr=function(e,t){return goog.i18n.bidi.ltrCharReg_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,t))},goog.i18n.bidi.ltrRe_=new RegExp("^["+goog.i18n.bidi.ltrChars_+"]"),goog.i18n.bidi.rtlRe_=new RegExp("^["+goog.i18n.bidi.rtlChars_+"]"),goog.i18n.bidi.isRtlChar=function(e){return goog.i18n.bidi.rtlRe_.test(e)},goog.i18n.bidi.isLtrChar=function(e){return goog.i18n.bidi.ltrRe_.test(e)},goog.i18n.bidi.isNeutralChar=function(e){return!goog.i18n.bidi.isLtrChar(e)&&!goog.i18n.bidi.isRtlChar(e)},goog.i18n.bidi.ltrDirCheckRe_=new RegExp("^[^"+goog.i18n.bidi.rtlChars_+"]*["+goog.i18n.bidi.ltrChars_+"]"),goog.i18n.bidi.rtlDirCheckRe_=new RegExp("^[^"+goog.i18n.bidi.ltrChars_+"]*["+goog.i18n.bidi.rtlChars_+"]"),goog.i18n.bidi.startsWithRtl=function(e,t){return goog.i18n.bidi.rtlDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,t))},goog.i18n.bidi.isRtlText=goog.i18n.bidi.startsWithRtl,goog.i18n.bidi.startsWithLtr=function(e,t){return goog.i18n.bidi.ltrDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,t))},goog.i18n.bidi.isLtrText=goog.i18n.bidi.startsWithLtr,goog.i18n.bidi.isRequiredLtrRe_=/^http:\/\/.*/,goog.i18n.bidi.isNeutralText=function(e,t){return e=goog.i18n.bidi.stripHtmlIfNeeded_(e,t),goog.i18n.bidi.isRequiredLtrRe_.test(e)||!goog.i18n.bidi.hasAnyLtr(e)&&!goog.i18n.bidi.hasAnyRtl(e)},goog.i18n.bidi.ltrExitDirCheckRe_=new RegExp("["+goog.i18n.bidi.ltrChars_+"][^"+goog.i18n.bidi.rtlChars_+"]*$"),goog.i18n.bidi.rtlExitDirCheckRe_=new RegExp("["+goog.i18n.bidi.rtlChars_+"][^"+goog.i18n.bidi.ltrChars_+"]*$"),goog.i18n.bidi.endsWithLtr=function(e,t){return goog.i18n.bidi.ltrExitDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,t))},goog.i18n.bidi.isLtrExitText=goog.i18n.bidi.endsWithLtr,goog.i18n.bidi.endsWithRtl=function(e,t){return goog.i18n.bidi.rtlExitDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,t))},goog.i18n.bidi.isRtlExitText=goog.i18n.bidi.endsWithRtl,goog.i18n.bidi.rtlLocalesRe_=/^(ar|ckb|dv|he|iw|fa|nqo|ps|sd|ug|ur|yi|.*[-_](Adlm|Arab|Hebr|Nkoo|Rohg|Thaa))(?!.*[-_](Latn|Cyrl)($|-|_))($|-|_)/i,goog.i18n.bidi.isRtlLanguage=function(e){return goog.i18n.bidi.rtlLocalesRe_.test(e)},goog.i18n.bidi.bracketGuardTextRe_=/(\(.*?\)+)|(\[.*?\]+)|(\{.*?\}+)|(<.*?>+)/g,goog.i18n.bidi.guardBracketInText=function(e,t){return t=(void 0===t?goog.i18n.bidi.hasAnyRtl(e):t)?goog.i18n.bidi.Format.RLM:goog.i18n.bidi.Format.LRM,e.replace(goog.i18n.bidi.bracketGuardTextRe_,t+"$&"+t)},goog.i18n.bidi.enforceRtlInHtml=function(e){return"<"==e.charAt(0)?e.replace(/<\w+/,"$& dir=rtl"):"\n"+e+""},goog.i18n.bidi.enforceRtlInText=function(e){return goog.i18n.bidi.Format.RLE+e+goog.i18n.bidi.Format.PDF},goog.i18n.bidi.enforceLtrInHtml=function(e){return"<"==e.charAt(0)?e.replace(/<\w+/,"$& dir=ltr"):"\n"+e+""},goog.i18n.bidi.enforceLtrInText=function(e){return goog.i18n.bidi.Format.LRE+e+goog.i18n.bidi.Format.PDF},goog.i18n.bidi.dimensionsRe_=/:\s*([.\d][.\w]*)\s+([.\d][.\w]*)\s+([.\d][.\w]*)\s+([.\d][.\w]*)/g,goog.i18n.bidi.leftRe_=/left/gi,goog.i18n.bidi.rightRe_=/right/gi,goog.i18n.bidi.tempRe_=/%%%%/g,goog.i18n.bidi.mirrorCSS=function(e){return e.replace(goog.i18n.bidi.dimensionsRe_,":$1 $4 $3 $2").replace(goog.i18n.bidi.leftRe_,"%%%%").replace(goog.i18n.bidi.rightRe_,goog.i18n.bidi.LEFT).replace(goog.i18n.bidi.tempRe_,goog.i18n.bidi.RIGHT)},goog.i18n.bidi.doubleQuoteSubstituteRe_=/([\u0591-\u05f2])"/g,goog.i18n.bidi.singleQuoteSubstituteRe_=/([\u0591-\u05f2])'/g,goog.i18n.bidi.normalizeHebrewQuote=function(e){return e.replace(goog.i18n.bidi.doubleQuoteSubstituteRe_,"$1״").replace(goog.i18n.bidi.singleQuoteSubstituteRe_,"$1׳")},goog.i18n.bidi.wordSeparatorRe_=/\s+/,goog.i18n.bidi.hasNumeralsRe_=/[\d\u06f0-\u06f9]/,goog.i18n.bidi.rtlDetectionThreshold_=.4,goog.i18n.bidi.estimateDirection=function(e,t){var r=0,o=0,i=!1;for(e=goog.i18n.bidi.stripHtmlIfNeeded_(e,t).split(goog.i18n.bidi.wordSeparatorRe_),t=0;tgoog.i18n.bidi.rtlDetectionThreshold_?goog.i18n.bidi.Dir.RTL:goog.i18n.bidi.Dir.LTR},goog.i18n.bidi.detectRtlDirectionality=function(e,t){return goog.i18n.bidi.estimateDirection(e,t)==goog.i18n.bidi.Dir.RTL},goog.i18n.bidi.setElementDirAndAlign=function(e,t){e&&(t=goog.i18n.bidi.toDir(t))&&(e.style.textAlign=t==goog.i18n.bidi.Dir.RTL?goog.i18n.bidi.RIGHT:goog.i18n.bidi.LEFT,e.dir=t==goog.i18n.bidi.Dir.RTL?"rtl":"ltr")},goog.i18n.bidi.setElementDirByTextDirectionality=function(e,t){switch(goog.i18n.bidi.estimateDirection(t)){case goog.i18n.bidi.Dir.LTR:e.dir="ltr";break;case goog.i18n.bidi.Dir.RTL:e.dir="rtl";break;default:e.removeAttribute("dir")}},goog.i18n.bidi.DirectionalString=function(){},goog.html.TrustedResourceUrl=function(e,t){this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_=e===goog.html.TrustedResourceUrl.CONSTRUCTOR_TOKEN_PRIVATE_&&t||"",this.TRUSTED_RESOURCE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_},goog.html.TrustedResourceUrl.prototype.implementsGoogStringTypedString=!0,goog.html.TrustedResourceUrl.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_.toString()},goog.html.TrustedResourceUrl.prototype.implementsGoogI18nBidiDirectionalString=!0,goog.html.TrustedResourceUrl.prototype.getDirection=function(){return goog.i18n.bidi.Dir.LTR},goog.html.TrustedResourceUrl.prototype.cloneWithParams=function(e,t){var r=goog.html.TrustedResourceUrl.unwrap(this),o=(r=goog.html.TrustedResourceUrl.URL_PARAM_PARSER_.exec(r))[3]||"";return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(r[1]+goog.html.TrustedResourceUrl.stringifyParams_("?",r[2]||"",e)+goog.html.TrustedResourceUrl.stringifyParams_("#",o,t))},goog.DEBUG&&(goog.html.TrustedResourceUrl.prototype.toString=function(){return"TrustedResourceUrl{"+this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_+"}"}),goog.html.TrustedResourceUrl.unwrap=function(e){return goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(e).toString()},goog.html.TrustedResourceUrl.unwrapTrustedScriptURL=function(e){return e instanceof goog.html.TrustedResourceUrl&&e.constructor===goog.html.TrustedResourceUrl&&e.TRUSTED_RESOURCE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_?e.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_:(goog.asserts.fail("expected object of type TrustedResourceUrl, got '"+e+"' of type "+goog.typeOf(e)),"type_error:TrustedResourceUrl")},goog.html.TrustedResourceUrl.format=function(e,t){var r=goog.string.Const.unwrap(e);if(!goog.html.TrustedResourceUrl.BASE_URL_.test(r))throw Error("Invalid TrustedResourceUrl format: "+r);return e=r.replace(goog.html.TrustedResourceUrl.FORMAT_MARKER_,(function(e,o){if(!Object.prototype.hasOwnProperty.call(t,o))throw Error('Found marker, "'+o+'", in format string, "'+r+'", but no valid label mapping found in args: '+JSON.stringify(t));return(e=t[o])instanceof goog.string.Const?goog.string.Const.unwrap(e):encodeURIComponent(String(e))})),goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.TrustedResourceUrl.FORMAT_MARKER_=/%{(\w+)}/g,goog.html.TrustedResourceUrl.BASE_URL_=/^((https:)?\/\/[0-9a-z.:[\]-]+\/|\/[^/\\]|[^:/\\%]+\/|[^:/\\%]*[?#]|about:blank#)/i,goog.html.TrustedResourceUrl.URL_PARAM_PARSER_=/^([^?#]*)(\?[^#]*)?(#[\s\S]*)?/,goog.html.TrustedResourceUrl.formatWithParams=function(e,t,r,o){return goog.html.TrustedResourceUrl.format(e,t).cloneWithParams(r,o)},goog.html.TrustedResourceUrl.fromConstant=function(e){return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(goog.string.Const.unwrap(e))},goog.html.TrustedResourceUrl.fromConstants=function(e){for(var t="",r=0;re.length?"&":"")+encodeURIComponent(o)+"="+encodeURIComponent(String(n)))}}return t},goog.html.TrustedResourceUrl.CONSTRUCTOR_TOKEN_PRIVATE_={},goog.string.internal={},goog.string.internal.startsWith=function(e,t){return 0==e.lastIndexOf(t,0)},goog.string.internal.endsWith=function(e,t){var r=e.length-t.length;return 0<=r&&e.indexOf(t,r)==r},goog.string.internal.caseInsensitiveStartsWith=function(e,t){return 0==goog.string.internal.caseInsensitiveCompare(t,e.substr(0,t.length))},goog.string.internal.caseInsensitiveEndsWith=function(e,t){return 0==goog.string.internal.caseInsensitiveCompare(t,e.substr(e.length-t.length,t.length))},goog.string.internal.caseInsensitiveEquals=function(e,t){return e.toLowerCase()==t.toLowerCase()},goog.string.internal.isEmptyOrWhitespace=function(e){return/^[\s\xa0]*$/.test(e)},goog.string.internal.trim=goog.TRUSTED_SITE&&String.prototype.trim?function(e){return e.trim()}:function(e){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(e)[1]},goog.string.internal.caseInsensitiveCompare=function(e,t){return(e=String(e).toLowerCase())<(t=String(t).toLowerCase())?-1:e==t?0:1},goog.string.internal.newLineToBr=function(e,t){return e.replace(/(\r\n|\r|\n)/g,t?"
":"
")},goog.string.internal.htmlEscape=function(e,t){if(t)e=e.replace(goog.string.internal.AMP_RE_,"&").replace(goog.string.internal.LT_RE_,"<").replace(goog.string.internal.GT_RE_,">").replace(goog.string.internal.QUOT_RE_,""").replace(goog.string.internal.SINGLE_QUOTE_RE_,"'").replace(goog.string.internal.NULL_RE_,"�");else{if(!goog.string.internal.ALL_RE_.test(e))return e;-1!=e.indexOf("&")&&(e=e.replace(goog.string.internal.AMP_RE_,"&")),-1!=e.indexOf("<")&&(e=e.replace(goog.string.internal.LT_RE_,"<")),-1!=e.indexOf(">")&&(e=e.replace(goog.string.internal.GT_RE_,">")),-1!=e.indexOf('"')&&(e=e.replace(goog.string.internal.QUOT_RE_,""")),-1!=e.indexOf("'")&&(e=e.replace(goog.string.internal.SINGLE_QUOTE_RE_,"'")),-1!=e.indexOf("\0")&&(e=e.replace(goog.string.internal.NULL_RE_,"�"))}return e},goog.string.internal.AMP_RE_=/&/g,goog.string.internal.LT_RE_=//g,goog.string.internal.QUOT_RE_=/"/g,goog.string.internal.SINGLE_QUOTE_RE_=/'/g,goog.string.internal.NULL_RE_=/\x00/g,goog.string.internal.ALL_RE_=/[\x00&<>"']/,goog.string.internal.whitespaceEscape=function(e,t){return goog.string.internal.newLineToBr(e.replace(/ /g,"  "),t)},goog.string.internal.contains=function(e,t){return-1!=e.indexOf(t)},goog.string.internal.caseInsensitiveContains=function(e,t){return goog.string.internal.contains(e.toLowerCase(),t.toLowerCase())},goog.string.internal.compareVersions=function(e,t){var r=0;e=goog.string.internal.trim(String(e)).split("."),t=goog.string.internal.trim(String(t)).split(".");for(var o=Math.max(e.length,t.length),i=0;0==r&&it?1:0},goog.html.SafeUrl=function(e,t){this.privateDoNotAccessOrElseSafeUrlWrappedValue_=e===goog.html.SafeUrl.CONSTRUCTOR_TOKEN_PRIVATE_&&t||"",this.SAFE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_},goog.html.SafeUrl.INNOCUOUS_STRING="about:invalid#zClosurez",goog.html.SafeUrl.prototype.implementsGoogStringTypedString=!0,goog.html.SafeUrl.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseSafeUrlWrappedValue_.toString()},goog.html.SafeUrl.prototype.implementsGoogI18nBidiDirectionalString=!0,goog.html.SafeUrl.prototype.getDirection=function(){return goog.i18n.bidi.Dir.LTR},goog.DEBUG&&(goog.html.SafeUrl.prototype.toString=function(){return"SafeUrl{"+this.privateDoNotAccessOrElseSafeUrlWrappedValue_+"}"}),goog.html.SafeUrl.unwrap=function(e){return e instanceof goog.html.SafeUrl&&e.constructor===goog.html.SafeUrl&&e.SAFE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_?e.privateDoNotAccessOrElseSafeUrlWrappedValue_:(goog.asserts.fail("expected object of type SafeUrl, got '"+e+"' of type "+goog.typeOf(e)),"type_error:SafeUrl")},goog.html.SafeUrl.fromConstant=function(e){return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(goog.string.Const.unwrap(e))},goog.html.SAFE_MIME_TYPE_PATTERN_=/^(?:audio\/(?:3gpp2|3gpp|aac|L16|midi|mp3|mp4|mpeg|oga|ogg|opus|x-m4a|x-matroska|x-wav|wav|webm)|image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp|x-icon)|text\/csv|video\/(?:mpeg|mp4|ogg|webm|quicktime|x-matroska))(?:;\w+=(?:\w+|"[\w;,= ]+"))*$/i,goog.html.SafeUrl.isSafeMimeType=function(e){return goog.html.SAFE_MIME_TYPE_PATTERN_.test(e)},goog.html.SafeUrl.fromBlob=function(e){return e=goog.html.SafeUrl.isSafeMimeType(e.type)?goog.fs.url.createObjectUrl(e):goog.html.SafeUrl.INNOCUOUS_STRING,goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.SafeUrl.fromMediaSource=function(e){return goog.asserts.assert("MediaSource"in goog.global,"No support for MediaSource"),e=e instanceof MediaSource?goog.fs.url.createObjectUrl(e):goog.html.SafeUrl.INNOCUOUS_STRING,goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.DATA_URL_PATTERN_=/^data:(.*);base64,[a-z0-9+\/]+=*$/i,goog.html.SafeUrl.fromDataUrl=function(e){var t=(e=e.replace(/(%0A|%0D)/g,"")).match(goog.html.DATA_URL_PATTERN_);return t=t&&goog.html.SafeUrl.isSafeMimeType(t[1]),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(t?e:goog.html.SafeUrl.INNOCUOUS_STRING)},goog.html.SafeUrl.fromTelUrl=function(e){return goog.string.internal.caseInsensitiveStartsWith(e,"tel:")||(e=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.SIP_URL_PATTERN_=/^sip[s]?:[+a-z0-9_.!$%&'*\/=^`{|}~-]+@([a-z0-9-]+\.)+[a-z0-9]{2,63}$/i,goog.html.SafeUrl.fromSipUrl=function(e){return goog.html.SIP_URL_PATTERN_.test(decodeURIComponent(e))||(e=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.SafeUrl.fromFacebookMessengerUrl=function(e){return goog.string.internal.caseInsensitiveStartsWith(e,"fb-messenger://share")||(e=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.SafeUrl.fromWhatsAppUrl=function(e){return goog.string.internal.caseInsensitiveStartsWith(e,"whatsapp://send")||(e=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.SafeUrl.fromSmsUrl=function(e){return goog.string.internal.caseInsensitiveStartsWith(e,"sms:")&&goog.html.SafeUrl.isSmsUrlBodyValid_(e)||(e=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.SafeUrl.isSmsUrlBodyValid_=function(e){var t=e.indexOf("#");if(0+~[\]()=^$|]+$/.test(r))throw Error("Selector allows only [-_a-zA-Z0-9#.:* ,>+~[\\]()=^$|] and strings, got: "+e);if(!goog.html.SafeStyleSheet.hasBalancedBrackets_(r))throw Error("() and [] in selector must be balanced, got: "+e);return t instanceof goog.html.SafeStyle||(t=goog.html.SafeStyle.create(t)),e=e+"{"+goog.html.SafeStyle.unwrap(t).replace(/.":"");if(e.toUpperCase()in goog.html.SafeHtml.NOT_ALLOWED_TAG_NAMES_)throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES?"Tag name <"+e+"> is not allowed for SafeHtml.":"")},goog.html.SafeHtml.createIframe=function(e,t,r,o){e&&goog.html.TrustedResourceUrl.unwrap(e);var i={};return i.src=e||null,i.srcdoc=t&&goog.html.SafeHtml.unwrap(t),e=goog.html.SafeHtml.combineAttributes(i,{sandbox:""},r),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("iframe",e,o)},goog.html.SafeHtml.createSandboxIframe=function(e,t,r,o){if(!goog.html.SafeHtml.canUseSandboxIframe())throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES?"The browser does not support sandboxed iframes.":"");var i={};return i.src=e?goog.html.SafeUrl.unwrap(goog.html.SafeUrl.sanitize(e)):null,i.srcdoc=t||null,i.sandbox="",e=goog.html.SafeHtml.combineAttributes(i,{},r),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("iframe",e,o)},goog.html.SafeHtml.canUseSandboxIframe=function(){return goog.global.HTMLIFrameElement&&"sandbox"in goog.global.HTMLIFrameElement.prototype},goog.html.SafeHtml.createScriptSrc=function(e,t){return goog.html.TrustedResourceUrl.unwrap(e),e=goog.html.SafeHtml.combineAttributes({src:e},{},t),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("script",e)},goog.html.SafeHtml.createScript=function(e,t){for(var r in t){var o=r.toLowerCase();if("language"==o||"src"==o||"text"==o||"type"==o)throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES?'Cannot set "'+o+'" attribute':"")}for(r="",e=goog.array.concat(e),o=0;o does not allow content."),i+=">"):(o=goog.html.SafeHtml.concat(r),i+=">"+goog.html.SafeHtml.unwrap(o)+"",o=o.getDirection()),(e=t&&t.dir)&&(o=/^(ltr|rtl|auto)$/i.test(e)?goog.i18n.bidi.Dir.NEUTRAL:null),goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(i,o)},goog.html.SafeHtml.stringifyAttributes=function(e,t){var r="";if(t)for(var o in t){if(!goog.html.SafeHtml.VALID_NAMES_IN_TAG_.test(o))throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES?'Invalid attribute name "'+o+'".':"");var i=t[o];null!=i&&(r+=" "+goog.html.SafeHtml.getAttrNameAndValue_(e,o,i))}return r},goog.html.SafeHtml.combineAttributes=function(e,t,r){var o,i={};for(o in e)goog.asserts.assert(o.toLowerCase()==o,"Must be lower case"),i[o]=e[o];for(o in t)goog.asserts.assert(o.toLowerCase()==o,"Must be lower case"),i[o]=t[o];if(r)for(o in r){var a=o.toLowerCase();if(a in e)throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES?'Cannot override "'+a+'" attribute, got "'+o+'" with value "'+r[o]+'"':"");a in t&&delete i[a],i[o]=r[o]}return i},goog.html.SafeHtml.DOCTYPE_HTML=goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse("",goog.i18n.bidi.Dir.NEUTRAL),goog.html.SafeHtml.EMPTY=goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse("",goog.i18n.bidi.Dir.NEUTRAL),goog.html.SafeHtml.BR=goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse("
",goog.i18n.bidi.Dir.NEUTRAL),goog.html.uncheckedconversions={},goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract=function(e,t,r){return goog.asserts.assertString(goog.string.Const.unwrap(e),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(e)),"must provide non-empty justification"),goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(t,r||null)},goog.html.uncheckedconversions.safeScriptFromStringKnownToSatisfyTypeContract=function(e,t){return goog.asserts.assertString(goog.string.Const.unwrap(e),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(e)),"must provide non-empty justification"),goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(t)},goog.html.uncheckedconversions.safeStyleFromStringKnownToSatisfyTypeContract=function(e,t){return goog.asserts.assertString(goog.string.Const.unwrap(e),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(e)),"must provide non-empty justification"),goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(t)},goog.html.uncheckedconversions.safeStyleSheetFromStringKnownToSatisfyTypeContract=function(e,t){return goog.asserts.assertString(goog.string.Const.unwrap(e),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(e)),"must provide non-empty justification"),goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(t)},goog.html.uncheckedconversions.safeUrlFromStringKnownToSatisfyTypeContract=function(e,t){return goog.asserts.assertString(goog.string.Const.unwrap(e),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(e)),"must provide non-empty justification"),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(t)},goog.html.uncheckedconversions.trustedResourceUrlFromStringKnownToSatisfyTypeContract=function(e,t){return goog.asserts.assertString(goog.string.Const.unwrap(e),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(e)),"must provide non-empty justification"),goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(t)},goog.dom.safe={},goog.dom.safe.InsertAdjacentHtmlPosition={AFTERBEGIN:"afterbegin",AFTEREND:"afterend",BEFOREBEGIN:"beforebegin",BEFOREEND:"beforeend"},goog.dom.safe.insertAdjacentHtml=function(e,t,r){e.insertAdjacentHTML(t,goog.html.SafeHtml.unwrapTrustedHTML(r))},goog.dom.safe.SET_INNER_HTML_DISALLOWED_TAGS_={MATH:!0,SCRIPT:!0,STYLE:!0,SVG:!0,TEMPLATE:!0},goog.dom.safe.isInnerHtmlCleanupRecursive_=goog.functions.cacheReturnValue((function(){if(goog.DEBUG&&"undefined"==typeof document)return!1;var e=document.createElement("div"),t=document.createElement("div");return t.appendChild(document.createElement("div")),e.appendChild(t),!(goog.DEBUG&&!e.firstChild)&&(t=e.firstChild.firstChild,e.innerHTML=goog.html.SafeHtml.unwrapTrustedHTML(goog.html.SafeHtml.EMPTY),!t.parentElement)})),goog.dom.safe.unsafeSetInnerHtmlDoNotUseOrElse=function(e,t){if(goog.dom.safe.isInnerHtmlCleanupRecursive_())for(;e.lastChild;)e.removeChild(e.lastChild);e.innerHTML=goog.html.SafeHtml.unwrapTrustedHTML(t)},goog.dom.safe.setInnerHtml=function(e,t){if(goog.asserts.ENABLE_ASSERTS){var r=e.tagName.toUpperCase();if(goog.dom.safe.SET_INNER_HTML_DISALLOWED_TAGS_[r])throw Error("goog.dom.safe.setInnerHtml cannot be used to set content of "+e.tagName+".")}goog.dom.safe.unsafeSetInnerHtmlDoNotUseOrElse(e,t)},goog.dom.safe.setOuterHtml=function(e,t){e.outerHTML=goog.html.SafeHtml.unwrapTrustedHTML(t)},goog.dom.safe.setFormElementAction=function(e,t){t=t instanceof goog.html.SafeUrl?t:goog.html.SafeUrl.sanitizeAssertUnchanged(t),goog.dom.asserts.assertIsHTMLFormElement(e).action=goog.html.SafeUrl.unwrap(t)},goog.dom.safe.setButtonFormAction=function(e,t){t=t instanceof goog.html.SafeUrl?t:goog.html.SafeUrl.sanitizeAssertUnchanged(t),goog.dom.asserts.assertIsHTMLButtonElement(e).formAction=goog.html.SafeUrl.unwrap(t)},goog.dom.safe.setInputFormAction=function(e,t){t=t instanceof goog.html.SafeUrl?t:goog.html.SafeUrl.sanitizeAssertUnchanged(t),goog.dom.asserts.assertIsHTMLInputElement(e).formAction=goog.html.SafeUrl.unwrap(t)},goog.dom.safe.setStyle=function(e,t){e.style.cssText=goog.html.SafeStyle.unwrap(t)},goog.dom.safe.documentWrite=function(e,t){e.write(goog.html.SafeHtml.unwrapTrustedHTML(t))},goog.dom.safe.setAnchorHref=function(e,t){goog.dom.asserts.assertIsHTMLAnchorElement(e),t=t instanceof goog.html.SafeUrl?t:goog.html.SafeUrl.sanitizeAssertUnchanged(t),e.href=goog.html.SafeUrl.unwrap(t)},goog.dom.safe.setImageSrc=function(e,t){if(goog.dom.asserts.assertIsHTMLImageElement(e),!(t instanceof goog.html.SafeUrl)){var r=/^data:image\//i.test(t);t=goog.html.SafeUrl.sanitizeAssertUnchanged(t,r)}e.src=goog.html.SafeUrl.unwrap(t)},goog.dom.safe.setAudioSrc=function(e,t){if(goog.dom.asserts.assertIsHTMLAudioElement(e),!(t instanceof goog.html.SafeUrl)){var r=/^data:audio\//i.test(t);t=goog.html.SafeUrl.sanitizeAssertUnchanged(t,r)}e.src=goog.html.SafeUrl.unwrap(t)},goog.dom.safe.setVideoSrc=function(e,t){if(goog.dom.asserts.assertIsHTMLVideoElement(e),!(t instanceof goog.html.SafeUrl)){var r=/^data:video\//i.test(t);t=goog.html.SafeUrl.sanitizeAssertUnchanged(t,r)}e.src=goog.html.SafeUrl.unwrap(t)},goog.dom.safe.setEmbedSrc=function(e,t){goog.dom.asserts.assertIsHTMLEmbedElement(e),e.src=goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(t)},goog.dom.safe.setFrameSrc=function(e,t){goog.dom.asserts.assertIsHTMLFrameElement(e),e.src=goog.html.TrustedResourceUrl.unwrap(t)},goog.dom.safe.setIframeSrc=function(e,t){goog.dom.asserts.assertIsHTMLIFrameElement(e),e.src=goog.html.TrustedResourceUrl.unwrap(t)},goog.dom.safe.setIframeSrcdoc=function(e,t){goog.dom.asserts.assertIsHTMLIFrameElement(e),e.srcdoc=goog.html.SafeHtml.unwrapTrustedHTML(t)},goog.dom.safe.setLinkHrefAndRel=function(e,t,r){goog.dom.asserts.assertIsHTMLLinkElement(e),e.rel=r,goog.string.internal.caseInsensitiveContains(r,"stylesheet")?(goog.asserts.assert(t instanceof goog.html.TrustedResourceUrl,'URL must be TrustedResourceUrl because "rel" contains "stylesheet"'),e.href=goog.html.TrustedResourceUrl.unwrap(t)):e.href=t instanceof goog.html.TrustedResourceUrl?goog.html.TrustedResourceUrl.unwrap(t):t instanceof goog.html.SafeUrl?goog.html.SafeUrl.unwrap(t):goog.html.SafeUrl.unwrap(goog.html.SafeUrl.sanitizeAssertUnchanged(t))},goog.dom.safe.setObjectData=function(e,t){goog.dom.asserts.assertIsHTMLObjectElement(e),e.data=goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(t)},goog.dom.safe.setScriptSrc=function(e,t){goog.dom.asserts.assertIsHTMLScriptElement(e),e.src=goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(t),(t=goog.getScriptNonce())&&e.setAttribute("nonce",t)},goog.dom.safe.setScriptContent=function(e,t){goog.dom.asserts.assertIsHTMLScriptElement(e),e.text=goog.html.SafeScript.unwrapTrustedScript(t),(t=goog.getScriptNonce())&&e.setAttribute("nonce",t)},goog.dom.safe.setLocationHref=function(e,t){goog.dom.asserts.assertIsLocation(e),t=t instanceof goog.html.SafeUrl?t:goog.html.SafeUrl.sanitizeAssertUnchanged(t),e.href=goog.html.SafeUrl.unwrap(t)},goog.dom.safe.assignLocation=function(e,t){goog.dom.asserts.assertIsLocation(e),t=t instanceof goog.html.SafeUrl?t:goog.html.SafeUrl.sanitizeAssertUnchanged(t),e.assign(goog.html.SafeUrl.unwrap(t))},goog.dom.safe.replaceLocation=function(e,t){t=t instanceof goog.html.SafeUrl?t:goog.html.SafeUrl.sanitizeAssertUnchanged(t),e.replace(goog.html.SafeUrl.unwrap(t))},goog.dom.safe.openInWindow=function(e,t,r,o,i){return e=e instanceof goog.html.SafeUrl?e:goog.html.SafeUrl.sanitizeAssertUnchanged(e),t=t||goog.global,r=r instanceof goog.string.Const?goog.string.Const.unwrap(r):r||"",t.open(goog.html.SafeUrl.unwrap(e),r,o,i)},goog.dom.safe.parseFromStringHtml=function(e,t){return goog.dom.safe.parseFromString(e,t,"text/html")},goog.dom.safe.parseFromString=function(e,t,r){return e.parseFromString(goog.html.SafeHtml.unwrapTrustedHTML(t),r)},goog.dom.safe.createImageFromBlob=function(e){if(!/^image\/.*/g.test(e.type))throw Error("goog.dom.safe.createImageFromBlob only accepts MIME type image/.*.");var t=goog.global.URL.createObjectURL(e);return(e=new goog.global.Image).onload=function(){goog.global.URL.revokeObjectURL(t)},goog.dom.safe.setImageSrc(e,goog.html.uncheckedconversions.safeUrlFromStringKnownToSatisfyTypeContract(goog.string.Const.from("Image blob URL."),t)),e},goog.string.DETECT_DOUBLE_ESCAPING=!1,goog.string.FORCE_NON_DOM_HTML_UNESCAPING=!1,goog.string.Unicode={NBSP:" "},goog.string.startsWith=goog.string.internal.startsWith,goog.string.endsWith=goog.string.internal.endsWith,goog.string.caseInsensitiveStartsWith=goog.string.internal.caseInsensitiveStartsWith,goog.string.caseInsensitiveEndsWith=goog.string.internal.caseInsensitiveEndsWith,goog.string.caseInsensitiveEquals=goog.string.internal.caseInsensitiveEquals,goog.string.subs=function(e,t){for(var r=e.split("%s"),o="",i=Array.prototype.slice.call(arguments,1);i.length&&1=e||"€"<=e&&"�">=e},goog.string.stripNewlines=function(e){return e.replace(/(\r\n|\r|\n)+/g," ")},goog.string.canonicalizeNewlines=function(e){return e.replace(/(\r\n|\r|\n)/g,"\n")},goog.string.normalizeWhitespace=function(e){return e.replace(/\xa0|\s/g," ")},goog.string.normalizeSpaces=function(e){return e.replace(/\xa0|[ \t]+/g," ")},goog.string.collapseBreakingSpaces=function(e){return e.replace(/[\t\r\n ]+/g," ").replace(/^[\t\r\n ]+|[\t\r\n ]+$/g,"")},goog.string.trim=goog.string.internal.trim,goog.string.trimLeft=function(e){return e.replace(/^[\s\xa0]+/,"")},goog.string.trimRight=function(e){return e.replace(/[\s\xa0]+$/,"")},goog.string.caseInsensitiveCompare=goog.string.internal.caseInsensitiveCompare,goog.string.numberAwareCompare_=function(e,t,r){if(e==t)return 0;if(!e)return-1;if(!t)return 1;for(var o=e.toLowerCase().match(r),i=t.toLowerCase().match(r),a=Math.min(o.length,i.length),n=0;n",""":'"'},o=t?t.createElement("div"):goog.global.document.createElement("div");return e.replace(goog.string.HTML_ENTITY_PATTERN_,(function(e,t){var i=r[e];return i||("#"==t.charAt(0)&&(t=Number("0"+t.substr(1)),isNaN(t)||(i=String.fromCharCode(t))),i||(goog.dom.safe.setInnerHtml(o,goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract(goog.string.Const.from("Single HTML entity."),e+" ")),i=o.firstChild.nodeValue.slice(0,-1)),r[e]=i)}))},goog.string.unescapePureXmlEntities_=function(e){return e.replace(/&([^;]+);/g,(function(e,t){switch(t){case"amp":return"&";case"lt":return"<";case"gt":return">";case"quot":return'"';default:return"#"!=t.charAt(0)||(t=Number("0"+t.substr(1)),isNaN(t))?e:String.fromCharCode(t)}}))},goog.string.HTML_ENTITY_PATTERN_=/&([^;\s<&]+);?/g,goog.string.whitespaceEscape=function(e,t){return goog.string.newLineToBr(e.replace(/ /g,"  "),t)},goog.string.preserveSpaces=function(e){return e.replace(/(^|[\n ]) /g,"$1"+goog.string.Unicode.NBSP)},goog.string.stripQuotes=function(e,t){for(var r=t.length,o=0;ot&&(e=e.substring(0,t-3)+"..."),r&&(e=goog.string.htmlEscape(e)),e},goog.string.truncateMiddle=function(e,t,r,o){if(r&&(e=goog.string.unescapeEntities(e)),o&&e.length>t){o>t&&(o=t);var i=e.length-o;e=e.substring(0,t-o)+"..."+e.substring(i)}else e.length>t&&(o=Math.floor(t/2),i=e.length-o,e=e.substring(0,o+t%2)+"..."+e.substring(i));return r&&(e=goog.string.htmlEscape(e)),e},goog.string.specialEscapeChars_={"\0":"\\0","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\x0B",'"':'\\"',"\\":"\\\\","<":"\\u003C"},goog.string.jsEscapeCache_={"'":"\\'"},goog.string.quote=function(e){e=String(e);for(var t=['"'],r=0;ri?o:goog.string.escapeChar(o))}return t.push('"'),t.join("")},goog.string.escapeString=function(e){for(var t=[],r=0;rt)var r=e;else 256>t?(r="\\x",(16>t||256t&&(r+="0")),r+=t.toString(16).toUpperCase();return goog.string.jsEscapeCache_[e]=r},goog.string.contains=goog.string.internal.contains,goog.string.caseInsensitiveContains=goog.string.internal.caseInsensitiveContains,goog.string.countOf=function(e,t){return e&&t?e.split(t).length-1:0},goog.string.removeAt=function(e,t,r){var o=e;return 0<=t&&t>>0;return t},goog.string.uniqueStringCounter_=2147483648*Math.random()|0,goog.string.createUniqueString=function(){return"goog_"+goog.string.uniqueStringCounter_++},goog.string.toNumber=function(e){var t=Number(e);return 0==t&&goog.string.isEmptyOrWhitespace(e)?NaN:t},goog.string.isLowerCamelCase=function(e){return/^[a-z]+([A-Z][a-z]*)*$/.test(e)},goog.string.isUpperCamelCase=function(e){return/^([A-Z][a-z]*)+$/.test(e)},goog.string.toCamelCase=function(e){return String(e).replace(/\-([a-z])/g,(function(e,t){return t.toUpperCase()}))},goog.string.toSelectorCase=function(e){return String(e).replace(/([A-Z])/g,"-$1").toLowerCase()},goog.string.toTitleCase=function(e,t){return t="string"==typeof t?goog.string.regExpEscape(t):"\\s",e.replace(new RegExp("(^"+(t?"|["+t+"]+":"")+")([a-z])","g"),(function(e,t,r){return t+r.toUpperCase()}))},goog.string.capitalize=function(e){return String(e.charAt(0)).toUpperCase()+String(e.substr(1)).toLowerCase()},goog.string.parseInt=function(e){return isFinite(e)&&(e=String(e)),"string"==typeof e?/^\s*-?0x/i.test(e)?parseInt(e,16):parseInt(e,10):NaN},goog.string.splitLimit=function(e,t,r){e=e.split(t);for(var o=[];0r&&(r=i)}return-1==r?e:e.slice(r+1)},goog.string.editDistance=function(e,t){var r=[],o=[];if(e==t)return 0;if(!e.length||!t.length)return Math.max(e.length,t.length);for(var i=0;iparseFloat(e))?String(t):e},goog.userAgent.getVersionRegexResult_=function(){var e=goog.userAgent.getUserAgentString();return goog.userAgent.GECKO?/rv:([^\);]+)(\)|;)/.exec(e):goog.userAgent.EDGE?/Edge\/([\d\.]+)/.exec(e):goog.userAgent.IE?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(e):goog.userAgent.WEBKIT?/WebKit\/(\S+)/.exec(e):goog.userAgent.OPERA?/(?:Version)[ \/]?(\S+)/.exec(e):void 0},goog.userAgent.getDocumentMode_=function(){var e=goog.global.document;return e?e.documentMode:void 0},goog.userAgent.VERSION=goog.userAgent.determineVersion_(),goog.userAgent.compare=function(e,t){return goog.string.compareVersions(e,t)},goog.userAgent.isVersionOrHigherCache_={},goog.userAgent.isVersionOrHigher=function(e){return goog.userAgent.ASSUME_ANY_VERSION||goog.reflect.cache(goog.userAgent.isVersionOrHigherCache_,e,(function(){return 0<=goog.string.compareVersions(goog.userAgent.VERSION,e)}))},goog.userAgent.isVersion=goog.userAgent.isVersionOrHigher,goog.userAgent.isDocumentModeOrHigher=function(e){return Number(goog.userAgent.DOCUMENT_MODE)>=e},goog.userAgent.isDocumentMode=goog.userAgent.isDocumentModeOrHigher,goog.userAgent.DOCUMENT_MODE=function(){if(goog.global.document&&goog.userAgent.IE){var e=goog.userAgent.getDocumentMode_();return e||(parseInt(goog.userAgent.VERSION,10)||void 0)}}(),goog.userAgent.product={},goog.userAgent.product.ASSUME_FIREFOX=!1,goog.userAgent.product.ASSUME_IPHONE=!1,goog.userAgent.product.ASSUME_IPAD=!1,goog.userAgent.product.ASSUME_ANDROID=!1,goog.userAgent.product.ASSUME_CHROME=!1,goog.userAgent.product.ASSUME_SAFARI=!1,goog.userAgent.product.PRODUCT_KNOWN_=goog.userAgent.ASSUME_IE||goog.userAgent.ASSUME_EDGE||goog.userAgent.ASSUME_OPERA||goog.userAgent.product.ASSUME_FIREFOX||goog.userAgent.product.ASSUME_IPHONE||goog.userAgent.product.ASSUME_IPAD||goog.userAgent.product.ASSUME_ANDROID||goog.userAgent.product.ASSUME_CHROME||goog.userAgent.product.ASSUME_SAFARI,goog.userAgent.product.OPERA=goog.userAgent.OPERA,goog.userAgent.product.IE=goog.userAgent.IE,goog.userAgent.product.EDGE=goog.userAgent.EDGE,goog.userAgent.product.FIREFOX=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_FIREFOX:goog.labs.userAgent.browser.isFirefox(),goog.userAgent.product.isIphoneOrIpod_=function(){return goog.labs.userAgent.platform.isIphone()||goog.labs.userAgent.platform.isIpod()},goog.userAgent.product.IPHONE=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_IPHONE:goog.userAgent.product.isIphoneOrIpod_(),goog.userAgent.product.IPAD=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_IPAD:goog.labs.userAgent.platform.isIpad(),goog.userAgent.product.ANDROID=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_ANDROID:goog.labs.userAgent.browser.isAndroidBrowser(),goog.userAgent.product.CHROME=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_CHROME:goog.labs.userAgent.browser.isChrome(),goog.userAgent.product.isSafariDesktop_=function(){return goog.labs.userAgent.browser.isSafari()&&!goog.labs.userAgent.platform.isIos()},goog.userAgent.product.SAFARI=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_SAFARI:goog.userAgent.product.isSafariDesktop_(),goog.crypt.base64={},goog.crypt.base64.DEFAULT_ALPHABET_COMMON_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",goog.crypt.base64.ENCODED_VALS=goog.crypt.base64.DEFAULT_ALPHABET_COMMON_+"+/=",goog.crypt.base64.ENCODED_VALS_WEBSAFE=goog.crypt.base64.DEFAULT_ALPHABET_COMMON_+"-_.",goog.crypt.base64.Alphabet={DEFAULT:0,NO_PADDING:1,WEBSAFE:2,WEBSAFE_DOT_PADDING:3,WEBSAFE_NO_PADDING:4},goog.crypt.base64.paddingChars_="=.",goog.crypt.base64.isPadding_=function(e){return goog.string.contains(goog.crypt.base64.paddingChars_,e)},goog.crypt.base64.byteToCharMaps_={},goog.crypt.base64.charToByteMap_=null,goog.crypt.base64.ASSUME_NATIVE_SUPPORT_=goog.userAgent.GECKO||goog.userAgent.WEBKIT&&!goog.userAgent.product.SAFARI||goog.userAgent.OPERA,goog.crypt.base64.HAS_NATIVE_ENCODE_=goog.crypt.base64.ASSUME_NATIVE_SUPPORT_||"function"==typeof goog.global.btoa,goog.crypt.base64.HAS_NATIVE_DECODE_=goog.crypt.base64.ASSUME_NATIVE_SUPPORT_||!goog.userAgent.product.SAFARI&&!goog.userAgent.IE&&"function"==typeof goog.global.atob,goog.crypt.base64.encodeByteArray=function(e,t){goog.asserts.assert(goog.isArrayLike(e),"encodeByteArray takes an array as a parameter"),void 0===t&&(t=goog.crypt.base64.Alphabet.DEFAULT),goog.crypt.base64.init_(),t=goog.crypt.base64.byteToCharMaps_[t];for(var r=[],o=0;o>2;i=(3&i)<<4|n>>4,n=(15&n)<<2|p>>6,p&=63,s||(p=64,a||(n=64)),r.push(t[d],t[i],t[n]||"",t[p]||"")}return r.join("")},goog.crypt.base64.encodeString=function(e,t){return goog.crypt.base64.HAS_NATIVE_ENCODE_&&!t?goog.global.btoa(e):goog.crypt.base64.encodeByteArray(goog.crypt.stringToByteArray(e),t)},goog.crypt.base64.decodeString=function(e,t){if(goog.crypt.base64.HAS_NATIVE_DECODE_&&!t)return goog.global.atob(e);var r="";return goog.crypt.base64.decodeStringInternal_(e,(function(e){r+=String.fromCharCode(e)})),r},goog.crypt.base64.decodeStringToByteArray=function(e,t){var r=[];return goog.crypt.base64.decodeStringInternal_(e,(function(e){r.push(e)})),r},goog.crypt.base64.decodeStringToUint8Array=function(e){goog.asserts.assert(!goog.userAgent.IE||goog.userAgent.isVersionOrHigher("10"),"Browser does not support typed arrays");var t=e.length,r=3*t/4;r%3?r=Math.floor(r):goog.crypt.base64.isPadding_(e[t-1])&&(r=goog.crypt.base64.isPadding_(e[t-2])?r-2:r-1);var o=new Uint8Array(r),i=0;return goog.crypt.base64.decodeStringInternal_(e,(function(e){o[i++]=e})),o.subarray(0,i)},goog.crypt.base64.decodeStringInternal_=function(e,t){function r(t){for(;o>4),64!=n&&(t(a<<4&240|n>>2),64!=s&&t(n<<6&192|s))}},goog.crypt.base64.init_=function(){if(!goog.crypt.base64.charToByteMap_){goog.crypt.base64.charToByteMap_={};for(var e=goog.crypt.base64.DEFAULT_ALPHABET_COMMON_.split(""),t=["+/=","+/","-_=","-_.","-_"],r=0;5>r;r++){var o=e.concat(t[r].split(""));goog.crypt.base64.byteToCharMaps_[r]=o;for(var i=0;i>>0;e=Math.floor((e-t)/jspb.BinaryConstants.TWO_TO_32)>>>0,jspb.utils.split64Low=t,jspb.utils.split64High=e},jspb.utils.splitInt64=function(e){var t=0>e,r=(e=Math.abs(e))>>>0;e=Math.floor((e-r)/jspb.BinaryConstants.TWO_TO_32),e>>>=0,t&&(e=~e>>>0,4294967295<(r=1+(~r>>>0))&&(r=0,4294967295<++e&&(e=0))),jspb.utils.split64Low=r,jspb.utils.split64High=e},jspb.utils.splitZigzag64=function(e){var t=0>e;e=2*Math.abs(e),jspb.utils.splitUint64(e),e=jspb.utils.split64Low;var r=jspb.utils.split64High;t&&(0==e?0==r?r=e=4294967295:(r--,e=4294967295):e--),jspb.utils.split64Low=e,jspb.utils.split64High=r},jspb.utils.splitFloat32=function(e){var t=0>e?1:0;if(0===(e=t?-e:e))0<1/e?(jspb.utils.split64High=0,jspb.utils.split64Low=0):(jspb.utils.split64High=0,jspb.utils.split64Low=2147483648);else if(isNaN(e))jspb.utils.split64High=0,jspb.utils.split64Low=2147483647;else if(e>jspb.BinaryConstants.FLOAT32_MAX)jspb.utils.split64High=0,jspb.utils.split64Low=(t<<31|2139095040)>>>0;else if(e>>0;else{var r=Math.floor(Math.log(e)/Math.LN2);e*=Math.pow(2,-r),16777216<=(e=Math.round(e*jspb.BinaryConstants.TWO_TO_23))&&++r,jspb.utils.split64High=0,jspb.utils.split64Low=(t<<31|r+127<<23|8388607&e)>>>0}},jspb.utils.splitFloat64=function(e){var t=0>e?1:0;if(0===(e=t?-e:e))jspb.utils.split64High=0<1/e?0:2147483648,jspb.utils.split64Low=0;else if(isNaN(e))jspb.utils.split64High=2147483647,jspb.utils.split64Low=4294967295;else if(e>jspb.BinaryConstants.FLOAT64_MAX)jspb.utils.split64High=(t<<31|2146435072)>>>0,jspb.utils.split64Low=0;else if(e>>0,jspb.utils.split64Low=r>>>0}else{var o=0;if(2<=(r=e))for(;2<=r&&1023>o;)o++,r/=2;else for(;1>r&&-1022>>0,jspb.utils.split64High=(t<<31|o+1023<<20|e)>>>0,jspb.utils.split64Low=r}},jspb.utils.splitHash64=function(e){var t=e.charCodeAt(0),r=e.charCodeAt(1),o=e.charCodeAt(2),i=e.charCodeAt(3),a=e.charCodeAt(4),n=e.charCodeAt(5),s=e.charCodeAt(6);e=e.charCodeAt(7),jspb.utils.split64Low=t+(r<<8)+(o<<16)+(i<<24)>>>0,jspb.utils.split64High=a+(n<<8)+(s<<16)+(e<<24)>>>0},jspb.utils.joinUint64=function(e,t){return t*jspb.BinaryConstants.TWO_TO_32+(e>>>0)},jspb.utils.joinInt64=function(e,t){var r=2147483648&t;return r&&(t=~t>>>0,0==(e=1+~e>>>0)&&(t=t+1>>>0)),e=jspb.utils.joinUint64(e,t),r?-e:e},jspb.utils.toZigzag64=function(e,t,r){var o=t>>31;return r(e<<1^o,(t<<1|e>>>31)^o)},jspb.utils.joinZigzag64=function(e,t){return jspb.utils.fromZigzag64(e,t,jspb.utils.joinInt64)},jspb.utils.fromZigzag64=function(e,t,r){var o=-(1&e);return r((e>>>1|t<<31)^o,t>>>1^o)},jspb.utils.joinFloat32=function(e,t){t=2*(e>>31)+1;var r=e>>>23&255;return e&=8388607,255==r?e?NaN:1/0*t:0==r?t*Math.pow(2,-149)*e:t*Math.pow(2,r-150)*(e+Math.pow(2,23))},jspb.utils.joinFloat64=function(e,t){var r=2*(t>>31)+1,o=t>>>20&2047;return e=jspb.BinaryConstants.TWO_TO_32*(1048575&t)+e,2047==o?e?NaN:1/0*r:0==o?r*Math.pow(2,-1074)*e:r*Math.pow(2,o-1075)*(e+jspb.BinaryConstants.TWO_TO_52)},jspb.utils.joinHash64=function(e,t){return String.fromCharCode(e>>>0&255,e>>>8&255,e>>>16&255,e>>>24&255,t>>>0&255,t>>>8&255,t>>>16&255,t>>>24&255)},jspb.utils.DIGITS="0123456789abcdef".split(""),jspb.utils.ZERO_CHAR_CODE_=48,jspb.utils.A_CHAR_CODE_=97,jspb.utils.joinUnsignedDecimalString=function(e,t){function r(e,t){return e=e?String(e):"",t?"0000000".slice(e.length)+e:e}if(2097151>=t)return""+jspb.utils.joinUint64(e,t);var o=(e>>>24|t<<8)>>>0&16777215;return e=(16777215&e)+6777216*o+6710656*(t=t>>16&65535),o+=8147497*t,t*=2,1e7<=e&&(o+=Math.floor(e/1e7),e%=1e7),1e7<=o&&(t+=Math.floor(o/1e7),o%=1e7),r(t,0)+r(o,t)+r(e,1)},jspb.utils.joinSignedDecimalString=function(e,t){var r=2147483648&t;return r&&(t=~t+(0==(e=1+~e>>>0)?1:0)>>>0),e=jspb.utils.joinUnsignedDecimalString(e,t),r?"-"+e:e},jspb.utils.hash64ToDecimalString=function(e,t){jspb.utils.splitHash64(e),e=jspb.utils.split64Low;var r=jspb.utils.split64High;return t?jspb.utils.joinSignedDecimalString(e,r):jspb.utils.joinUnsignedDecimalString(e,r)},jspb.utils.hash64ArrayToDecimalStrings=function(e,t){for(var r=Array(e.length),o=0;or&&(1!==e||0>>=8}jspb.asserts.assert(0e;e++)o[e]=255&~o[e]}(),t(1,1)),goog.crypt.byteArrayToString(o)},jspb.utils.splitDecimalString=function(e){jspb.utils.splitHash64(jspb.utils.decimalStringToHash64(e))},jspb.utils.toHexDigit_=function(e){return String.fromCharCode(10>e?jspb.utils.ZERO_CHAR_CODE_+e:jspb.utils.A_CHAR_CODE_-10+e)},jspb.utils.fromHexCharCode_=function(e){return e>=jspb.utils.A_CHAR_CODE_?e-jspb.utils.A_CHAR_CODE_+10:e-jspb.utils.ZERO_CHAR_CODE_},jspb.utils.hash64ToHexString=function(e){var t=Array(18);t[0]="0",t[1]="x";for(var r=0;8>r;r++){var o=e.charCodeAt(7-r);t[2*r+2]=jspb.utils.toHexDigit_(o>>4),t[2*r+3]=jspb.utils.toHexDigit_(15&o)}return t.join("")},jspb.utils.hexStringToHash64=function(e){e=e.toLowerCase(),jspb.asserts.assert(18==e.length),jspb.asserts.assert("0"==e[0]),jspb.asserts.assert("x"==e[1]);for(var t="",r=0;8>r;r++){var o=jspb.utils.fromHexCharCode_(e.charCodeAt(2*r+2)),i=jspb.utils.fromHexCharCode_(e.charCodeAt(2*r+3));t=String.fromCharCode(16*o+i)+t}return t},jspb.utils.hash64ToNumber=function(e,t){jspb.utils.splitHash64(e),e=jspb.utils.split64Low;var r=jspb.utils.split64High;return t?jspb.utils.joinInt64(e,r):jspb.utils.joinUint64(e,r)},jspb.utils.numberToHash64=function(e){return jspb.utils.splitInt64(e),jspb.utils.joinHash64(jspb.utils.split64Low,jspb.utils.split64High)},jspb.utils.countVarints=function(e,t,r){for(var o=0,i=t;i>7;return r-t-o},jspb.utils.countVarintFields=function(e,t,r,o){var i=0;if(128>(o=8*o+jspb.BinaryConstants.WireType.VARINT))for(;t>=7}if(e[t++]!=a)break;for(i++;0!=(128&(a=e[t++])););}return i},jspb.utils.countFixedFields_=function(e,t,r,o,i){var a=0;if(128>o)for(;t>=7}if(e[t++]!=n)break;a++,t+=i}return a},jspb.utils.countFixed32Fields=function(e,t,r,o){return jspb.utils.countFixedFields_(e,t,r,8*o+jspb.BinaryConstants.WireType.FIXED32,4)},jspb.utils.countFixed64Fields=function(e,t,r,o){return jspb.utils.countFixedFields_(e,t,r,8*o+jspb.BinaryConstants.WireType.FIXED64,8)},jspb.utils.countDelimitedFields=function(e,t,r,o){var i=0;for(o=8*o+jspb.BinaryConstants.WireType.DELIMITED;t>=7}if(e[t++]!=a)break;i++;for(var n=0,s=1;n+=(127&(a=e[t++]))*s,s*=128,0!=(128&a););t+=n}return i},jspb.utils.debugBytesToTextFormat=function(e){var t='"';if(e){e=jspb.utils.byteSourceToUint8Array(e);for(var r=0;re[r]&&(t+="0"),t+=e[r].toString(16)}return t+'"'},jspb.utils.debugScalarToTextFormat=function(e){return"string"==typeof e?goog.string.quote(e):e.toString()},jspb.utils.stringToByteArray=function(e){for(var t=new Uint8Array(e.length),r=0;rjspb.BinaryDecoder.instanceCache_.length&&jspb.BinaryDecoder.instanceCache_.push(this)},jspb.BinaryDecoder.prototype.clone=function(){return jspb.BinaryDecoder.alloc(this.bytes_,this.start_,this.end_-this.start_)},jspb.BinaryDecoder.prototype.clear=function(){this.bytes_=null,this.cursor_=this.end_=this.start_=0,this.error_=!1},jspb.BinaryDecoder.prototype.getBuffer=function(){return this.bytes_},jspb.BinaryDecoder.prototype.setBlock=function(e,t,r){this.bytes_=jspb.utils.byteSourceToUint8Array(e),this.start_=void 0!==t?t:0,this.end_=void 0!==r?this.start_+r:this.bytes_.length,this.cursor_=this.start_},jspb.BinaryDecoder.prototype.getEnd=function(){return this.end_},jspb.BinaryDecoder.prototype.setEnd=function(e){this.end_=e},jspb.BinaryDecoder.prototype.reset=function(){this.cursor_=this.start_},jspb.BinaryDecoder.prototype.getCursor=function(){return this.cursor_},jspb.BinaryDecoder.prototype.setCursor=function(e){this.cursor_=e},jspb.BinaryDecoder.prototype.advance=function(e){this.cursor_+=e,jspb.asserts.assert(this.cursor_<=this.end_)},jspb.BinaryDecoder.prototype.atEnd=function(){return this.cursor_==this.end_},jspb.BinaryDecoder.prototype.pastEnd=function(){return this.cursor_>this.end_},jspb.BinaryDecoder.prototype.getError=function(){return this.error_||0>this.cursor_||this.cursor_>this.end_},jspb.BinaryDecoder.prototype.readSplitVarint64=function(e){for(var t=128,r=0,o=0,i=0;4>i&&128<=t;i++)r|=(127&(t=this.bytes_[this.cursor_++]))<<7*i;if(128<=t&&(r|=(127&(t=this.bytes_[this.cursor_++]))<<28,o|=(127&t)>>4),128<=t)for(i=0;5>i&&128<=t;i++)o|=(127&(t=this.bytes_[this.cursor_++]))<<7*i+3;if(128>t)return e(r>>>0,o>>>0);jspb.asserts.fail("Failed to read varint, encoding is invalid."),this.error_=!0},jspb.BinaryDecoder.prototype.readSplitZigzagVarint64=function(e){return this.readSplitVarint64((function(t,r){return jspb.utils.fromZigzag64(t,r,e)}))},jspb.BinaryDecoder.prototype.readSplitFixed64=function(e){var t=this.bytes_,r=this.cursor_;this.cursor_+=8;for(var o=0,i=0,a=r+7;a>=r;a--)o=o<<8|t[a],i=i<<8|t[a+4];return e(o,i)},jspb.BinaryDecoder.prototype.skipVarint=function(){for(;128&this.bytes_[this.cursor_];)this.cursor_++;this.cursor_++},jspb.BinaryDecoder.prototype.unskipVarint=function(e){for(;128>>=7;this.cursor_--},jspb.BinaryDecoder.prototype.readUnsignedVarint32=function(){var e=this.bytes_,t=e[this.cursor_+0],r=127&t;return 128>t?(this.cursor_+=1,jspb.asserts.assert(this.cursor_<=this.end_),r):(r|=(127&(t=e[this.cursor_+1]))<<7,128>t?(this.cursor_+=2,jspb.asserts.assert(this.cursor_<=this.end_),r):(r|=(127&(t=e[this.cursor_+2]))<<14,128>t?(this.cursor_+=3,jspb.asserts.assert(this.cursor_<=this.end_),r):(r|=(127&(t=e[this.cursor_+3]))<<21,128>t?(this.cursor_+=4,jspb.asserts.assert(this.cursor_<=this.end_),r):(r|=(15&(t=e[this.cursor_+4]))<<28,128>t?(this.cursor_+=5,jspb.asserts.assert(this.cursor_<=this.end_),r>>>0):(this.cursor_+=5,128<=e[this.cursor_++]&&128<=e[this.cursor_++]&&128<=e[this.cursor_++]&&128<=e[this.cursor_++]&&128<=e[this.cursor_++]&&jspb.asserts.assert(!1),jspb.asserts.assert(this.cursor_<=this.end_),r)))))},jspb.BinaryDecoder.prototype.readSignedVarint32=function(){return~~this.readUnsignedVarint32()},jspb.BinaryDecoder.prototype.readUnsignedVarint32String=function(){return this.readUnsignedVarint32().toString()},jspb.BinaryDecoder.prototype.readSignedVarint32String=function(){return this.readSignedVarint32().toString()},jspb.BinaryDecoder.prototype.readZigzagVarint32=function(){var e=this.readUnsignedVarint32();return e>>>1^-(1&e)},jspb.BinaryDecoder.prototype.readUnsignedVarint64=function(){return this.readSplitVarint64(jspb.utils.joinUint64)},jspb.BinaryDecoder.prototype.readUnsignedVarint64String=function(){return this.readSplitVarint64(jspb.utils.joinUnsignedDecimalString)},jspb.BinaryDecoder.prototype.readSignedVarint64=function(){return this.readSplitVarint64(jspb.utils.joinInt64)},jspb.BinaryDecoder.prototype.readSignedVarint64String=function(){return this.readSplitVarint64(jspb.utils.joinSignedDecimalString)},jspb.BinaryDecoder.prototype.readZigzagVarint64=function(){return this.readSplitVarint64(jspb.utils.joinZigzag64)},jspb.BinaryDecoder.prototype.readZigzagVarintHash64=function(){return this.readSplitZigzagVarint64(jspb.utils.joinHash64)},jspb.BinaryDecoder.prototype.readZigzagVarint64String=function(){return this.readSplitZigzagVarint64(jspb.utils.joinSignedDecimalString)},jspb.BinaryDecoder.prototype.readUint8=function(){var e=this.bytes_[this.cursor_+0];return this.cursor_+=1,jspb.asserts.assert(this.cursor_<=this.end_),e},jspb.BinaryDecoder.prototype.readUint16=function(){var e=this.bytes_[this.cursor_+0],t=this.bytes_[this.cursor_+1];return this.cursor_+=2,jspb.asserts.assert(this.cursor_<=this.end_),e<<0|t<<8},jspb.BinaryDecoder.prototype.readUint32=function(){var e=this.bytes_[this.cursor_+0],t=this.bytes_[this.cursor_+1],r=this.bytes_[this.cursor_+2],o=this.bytes_[this.cursor_+3];return this.cursor_+=4,jspb.asserts.assert(this.cursor_<=this.end_),(e<<0|t<<8|r<<16|o<<24)>>>0},jspb.BinaryDecoder.prototype.readUint64=function(){var e=this.readUint32(),t=this.readUint32();return jspb.utils.joinUint64(e,t)},jspb.BinaryDecoder.prototype.readUint64String=function(){var e=this.readUint32(),t=this.readUint32();return jspb.utils.joinUnsignedDecimalString(e,t)},jspb.BinaryDecoder.prototype.readInt8=function(){var e=this.bytes_[this.cursor_+0];return this.cursor_+=1,jspb.asserts.assert(this.cursor_<=this.end_),e<<24>>24},jspb.BinaryDecoder.prototype.readInt16=function(){var e=this.bytes_[this.cursor_+0],t=this.bytes_[this.cursor_+1];return this.cursor_+=2,jspb.asserts.assert(this.cursor_<=this.end_),(e<<0|t<<8)<<16>>16},jspb.BinaryDecoder.prototype.readInt32=function(){var e=this.bytes_[this.cursor_+0],t=this.bytes_[this.cursor_+1],r=this.bytes_[this.cursor_+2],o=this.bytes_[this.cursor_+3];return this.cursor_+=4,jspb.asserts.assert(this.cursor_<=this.end_),e<<0|t<<8|r<<16|o<<24},jspb.BinaryDecoder.prototype.readInt64=function(){var e=this.readUint32(),t=this.readUint32();return jspb.utils.joinInt64(e,t)},jspb.BinaryDecoder.prototype.readInt64String=function(){var e=this.readUint32(),t=this.readUint32();return jspb.utils.joinSignedDecimalString(e,t)},jspb.BinaryDecoder.prototype.readFloat=function(){var e=this.readUint32();return jspb.utils.joinFloat32(e,0)},jspb.BinaryDecoder.prototype.readDouble=function(){var e=this.readUint32(),t=this.readUint32();return jspb.utils.joinFloat64(e,t)},jspb.BinaryDecoder.prototype.readBool=function(){return!!this.bytes_[this.cursor_++]},jspb.BinaryDecoder.prototype.readEnum=function(){return this.readSignedVarint32()},jspb.BinaryDecoder.prototype.readString=function(e){var t=this.bytes_,r=this.cursor_;e=r+e;for(var o=[],i="";ra)o.push(a);else{if(192>a)continue;if(224>a){var n=t[r++];o.push((31&a)<<6|63&n)}else if(240>a){n=t[r++];var s=t[r++];o.push((15&a)<<12|(63&n)<<6|63&s)}else if(248>a){a=(7&a)<<18|(63&(n=t[r++]))<<12|(63&(s=t[r++]))<<6|63&t[r++],a-=65536,o.push(55296+(a>>10&1023),56320+(1023&a))}}8192<=o.length&&(i+=String.fromCharCode.apply(null,o),o.length=0)}return i+=goog.crypt.byteArrayToString(o),this.cursor_=r,i},jspb.BinaryDecoder.prototype.readStringWithLength=function(){var e=this.readUnsignedVarint32();return this.readString(e)},jspb.BinaryDecoder.prototype.readBytes=function(e){if(0>e||this.cursor_+e>this.bytes_.length)return this.error_=!0,jspb.asserts.fail("Invalid byte length!"),new Uint8Array(0);var t=this.bytes_.subarray(this.cursor_,this.cursor_+e);return this.cursor_+=e,jspb.asserts.assert(this.cursor_<=this.end_),t},jspb.BinaryDecoder.prototype.readVarintHash64=function(){return this.readSplitVarint64(jspb.utils.joinHash64)},jspb.BinaryDecoder.prototype.readFixedHash64=function(){var e=this.bytes_,t=this.cursor_,r=e[t+0],o=e[t+1],i=e[t+2],a=e[t+3],n=e[t+4],s=e[t+5],p=e[t+6];return e=e[t+7],this.cursor_+=8,String.fromCharCode(r,o,i,a,n,s,p,e)},jspb.BinaryReader=function(e,t,r){this.decoder_=jspb.BinaryDecoder.alloc(e,t,r),this.fieldCursor_=this.decoder_.getCursor(),this.nextField_=jspb.BinaryConstants.INVALID_FIELD_NUMBER,this.nextWireType_=jspb.BinaryConstants.WireType.INVALID,this.error_=!1,this.readCallbacks_=null},jspb.BinaryReader.instanceCache_=[],jspb.BinaryReader.alloc=function(e,t,r){if(jspb.BinaryReader.instanceCache_.length){var o=jspb.BinaryReader.instanceCache_.pop();return e&&o.decoder_.setBlock(e,t,r),o}return new jspb.BinaryReader(e,t,r)},jspb.BinaryReader.prototype.alloc=jspb.BinaryReader.alloc,jspb.BinaryReader.prototype.free=function(){this.decoder_.clear(),this.nextField_=jspb.BinaryConstants.INVALID_FIELD_NUMBER,this.nextWireType_=jspb.BinaryConstants.WireType.INVALID,this.error_=!1,this.readCallbacks_=null,100>jspb.BinaryReader.instanceCache_.length&&jspb.BinaryReader.instanceCache_.push(this)},jspb.BinaryReader.prototype.getFieldCursor=function(){return this.fieldCursor_},jspb.BinaryReader.prototype.getCursor=function(){return this.decoder_.getCursor()},jspb.BinaryReader.prototype.getBuffer=function(){return this.decoder_.getBuffer()},jspb.BinaryReader.prototype.getFieldNumber=function(){return this.nextField_},goog.exportProperty(jspb.BinaryReader.prototype,"getFieldNumber",jspb.BinaryReader.prototype.getFieldNumber),jspb.BinaryReader.prototype.getWireType=function(){return this.nextWireType_},jspb.BinaryReader.prototype.isDelimited=function(){return this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED},goog.exportProperty(jspb.BinaryReader.prototype,"isDelimited",jspb.BinaryReader.prototype.isDelimited),jspb.BinaryReader.prototype.isEndGroup=function(){return this.nextWireType_==jspb.BinaryConstants.WireType.END_GROUP},goog.exportProperty(jspb.BinaryReader.prototype,"isEndGroup",jspb.BinaryReader.prototype.isEndGroup),jspb.BinaryReader.prototype.getError=function(){return this.error_||this.decoder_.getError()},jspb.BinaryReader.prototype.setBlock=function(e,t,r){this.decoder_.setBlock(e,t,r),this.nextField_=jspb.BinaryConstants.INVALID_FIELD_NUMBER,this.nextWireType_=jspb.BinaryConstants.WireType.INVALID},jspb.BinaryReader.prototype.reset=function(){this.decoder_.reset(),this.nextField_=jspb.BinaryConstants.INVALID_FIELD_NUMBER,this.nextWireType_=jspb.BinaryConstants.WireType.INVALID},jspb.BinaryReader.prototype.advance=function(e){this.decoder_.advance(e)},jspb.BinaryReader.prototype.nextField=function(){if(this.decoder_.atEnd())return!1;if(this.getError())return jspb.asserts.fail("Decoder hit an error"),!1;this.fieldCursor_=this.decoder_.getCursor();var e=this.decoder_.readUnsignedVarint32(),t=e>>>3;return(e&=7)!=jspb.BinaryConstants.WireType.VARINT&&e!=jspb.BinaryConstants.WireType.FIXED32&&e!=jspb.BinaryConstants.WireType.FIXED64&&e!=jspb.BinaryConstants.WireType.DELIMITED&&e!=jspb.BinaryConstants.WireType.START_GROUP&&e!=jspb.BinaryConstants.WireType.END_GROUP?(jspb.asserts.fail("Invalid wire type: %s (at position %s)",e,this.fieldCursor_),this.error_=!0,!1):(this.nextField_=t,this.nextWireType_=e,!0)},goog.exportProperty(jspb.BinaryReader.prototype,"nextField",jspb.BinaryReader.prototype.nextField),jspb.BinaryReader.prototype.unskipHeader=function(){this.decoder_.unskipVarint(this.nextField_<<3|this.nextWireType_)},jspb.BinaryReader.prototype.skipMatchingFields=function(){var e=this.nextField_;for(this.unskipHeader();this.nextField()&&this.getFieldNumber()==e;)this.skipField();this.decoder_.atEnd()||this.unskipHeader()},jspb.BinaryReader.prototype.skipVarintField=function(){this.nextWireType_!=jspb.BinaryConstants.WireType.VARINT?(jspb.asserts.fail("Invalid wire type for skipVarintField"),this.skipField()):this.decoder_.skipVarint()},jspb.BinaryReader.prototype.skipDelimitedField=function(){if(this.nextWireType_!=jspb.BinaryConstants.WireType.DELIMITED)jspb.asserts.fail("Invalid wire type for skipDelimitedField"),this.skipField();else{var e=this.decoder_.readUnsignedVarint32();this.decoder_.advance(e)}},jspb.BinaryReader.prototype.skipFixed32Field=function(){this.nextWireType_!=jspb.BinaryConstants.WireType.FIXED32?(jspb.asserts.fail("Invalid wire type for skipFixed32Field"),this.skipField()):this.decoder_.advance(4)},jspb.BinaryReader.prototype.skipFixed64Field=function(){this.nextWireType_!=jspb.BinaryConstants.WireType.FIXED64?(jspb.asserts.fail("Invalid wire type for skipFixed64Field"),this.skipField()):this.decoder_.advance(8)},jspb.BinaryReader.prototype.skipGroup=function(){for(var e=this.nextField_;;){if(!this.nextField()){jspb.asserts.fail("Unmatched start-group tag: stream EOF"),this.error_=!0;break}if(this.nextWireType_==jspb.BinaryConstants.WireType.END_GROUP){this.nextField_!=e&&(jspb.asserts.fail("Unmatched end-group tag"),this.error_=!0);break}this.skipField()}},jspb.BinaryReader.prototype.skipField=function(){switch(this.nextWireType_){case jspb.BinaryConstants.WireType.VARINT:this.skipVarintField();break;case jspb.BinaryConstants.WireType.FIXED64:this.skipFixed64Field();break;case jspb.BinaryConstants.WireType.DELIMITED:this.skipDelimitedField();break;case jspb.BinaryConstants.WireType.FIXED32:this.skipFixed32Field();break;case jspb.BinaryConstants.WireType.START_GROUP:this.skipGroup();break;default:jspb.asserts.fail("Invalid wire encoding for field.")}},jspb.BinaryReader.prototype.registerReadCallback=function(e,t){null===this.readCallbacks_&&(this.readCallbacks_={}),jspb.asserts.assert(!this.readCallbacks_[e]),this.readCallbacks_[e]=t},jspb.BinaryReader.prototype.runReadCallback=function(e){return jspb.asserts.assert(null!==this.readCallbacks_),e=this.readCallbacks_[e],jspb.asserts.assert(e),e(this)},jspb.BinaryReader.prototype.readAny=function(e){this.nextWireType_=jspb.BinaryConstants.FieldTypeToWireType(e);var t=jspb.BinaryConstants.FieldType;switch(e){case t.DOUBLE:return this.readDouble();case t.FLOAT:return this.readFloat();case t.INT64:return this.readInt64();case t.UINT64:return this.readUint64();case t.INT32:return this.readInt32();case t.FIXED64:return this.readFixed64();case t.FIXED32:return this.readFixed32();case t.BOOL:return this.readBool();case t.STRING:return this.readString();case t.GROUP:jspb.asserts.fail("Group field type not supported in readAny()");case t.MESSAGE:jspb.asserts.fail("Message field type not supported in readAny()");case t.BYTES:return this.readBytes();case t.UINT32:return this.readUint32();case t.ENUM:return this.readEnum();case t.SFIXED32:return this.readSfixed32();case t.SFIXED64:return this.readSfixed64();case t.SINT32:return this.readSint32();case t.SINT64:return this.readSint64();case t.FHASH64:return this.readFixedHash64();case t.VHASH64:return this.readVarintHash64();default:jspb.asserts.fail("Invalid field type in readAny()")}return 0},jspb.BinaryReader.prototype.readMessage=function(e,t){jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var r=this.decoder_.getEnd(),o=this.decoder_.readUnsignedVarint32();o=this.decoder_.getCursor()+o,this.decoder_.setEnd(o),t(e,this),this.decoder_.setCursor(o),this.decoder_.setEnd(r)},goog.exportProperty(jspb.BinaryReader.prototype,"readMessage",jspb.BinaryReader.prototype.readMessage),jspb.BinaryReader.prototype.readGroup=function(e,t,r){jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.START_GROUP),jspb.asserts.assert(this.nextField_==e),r(t,this),this.error_||this.nextWireType_==jspb.BinaryConstants.WireType.END_GROUP||(jspb.asserts.fail("Group submessage did not end with an END_GROUP tag"),this.error_=!0)},goog.exportProperty(jspb.BinaryReader.prototype,"readGroup",jspb.BinaryReader.prototype.readGroup),jspb.BinaryReader.prototype.getFieldDecoder=function(){jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var e=this.decoder_.readUnsignedVarint32(),t=this.decoder_.getCursor(),r=t+e;return e=jspb.BinaryDecoder.alloc(this.decoder_.getBuffer(),t,e),this.decoder_.setCursor(r),e},jspb.BinaryReader.prototype.readInt32=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint32()},goog.exportProperty(jspb.BinaryReader.prototype,"readInt32",jspb.BinaryReader.prototype.readInt32),jspb.BinaryReader.prototype.readInt32String=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint32String()},jspb.BinaryReader.prototype.readInt64=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint64()},goog.exportProperty(jspb.BinaryReader.prototype,"readInt64",jspb.BinaryReader.prototype.readInt64),jspb.BinaryReader.prototype.readInt64String=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint64String()},jspb.BinaryReader.prototype.readUint32=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readUnsignedVarint32()},goog.exportProperty(jspb.BinaryReader.prototype,"readUint32",jspb.BinaryReader.prototype.readUint32),jspb.BinaryReader.prototype.readUint32String=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readUnsignedVarint32String()},jspb.BinaryReader.prototype.readUint64=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readUnsignedVarint64()},goog.exportProperty(jspb.BinaryReader.prototype,"readUint64",jspb.BinaryReader.prototype.readUint64),jspb.BinaryReader.prototype.readUint64String=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readUnsignedVarint64String()},jspb.BinaryReader.prototype.readSint32=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readZigzagVarint32()},goog.exportProperty(jspb.BinaryReader.prototype,"readSint32",jspb.BinaryReader.prototype.readSint32),jspb.BinaryReader.prototype.readSint64=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readZigzagVarint64()},goog.exportProperty(jspb.BinaryReader.prototype,"readSint64",jspb.BinaryReader.prototype.readSint64),jspb.BinaryReader.prototype.readSint64String=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readZigzagVarint64String()},jspb.BinaryReader.prototype.readFixed32=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED32),this.decoder_.readUint32()},goog.exportProperty(jspb.BinaryReader.prototype,"readFixed32",jspb.BinaryReader.prototype.readFixed32),jspb.BinaryReader.prototype.readFixed64=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readUint64()},goog.exportProperty(jspb.BinaryReader.prototype,"readFixed64",jspb.BinaryReader.prototype.readFixed64),jspb.BinaryReader.prototype.readFixed64String=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readUint64String()},jspb.BinaryReader.prototype.readSfixed32=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED32),this.decoder_.readInt32()},goog.exportProperty(jspb.BinaryReader.prototype,"readSfixed32",jspb.BinaryReader.prototype.readSfixed32),jspb.BinaryReader.prototype.readSfixed32String=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED32),this.decoder_.readInt32().toString()},jspb.BinaryReader.prototype.readSfixed64=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readInt64()},goog.exportProperty(jspb.BinaryReader.prototype,"readSfixed64",jspb.BinaryReader.prototype.readSfixed64),jspb.BinaryReader.prototype.readSfixed64String=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readInt64String()},jspb.BinaryReader.prototype.readFloat=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED32),this.decoder_.readFloat()},goog.exportProperty(jspb.BinaryReader.prototype,"readFloat",jspb.BinaryReader.prototype.readFloat),jspb.BinaryReader.prototype.readDouble=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readDouble()},goog.exportProperty(jspb.BinaryReader.prototype,"readDouble",jspb.BinaryReader.prototype.readDouble),jspb.BinaryReader.prototype.readBool=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),!!this.decoder_.readUnsignedVarint32()},goog.exportProperty(jspb.BinaryReader.prototype,"readBool",jspb.BinaryReader.prototype.readBool),jspb.BinaryReader.prototype.readEnum=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint64()},goog.exportProperty(jspb.BinaryReader.prototype,"readEnum",jspb.BinaryReader.prototype.readEnum),jspb.BinaryReader.prototype.readString=function(){jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var e=this.decoder_.readUnsignedVarint32();return this.decoder_.readString(e)},goog.exportProperty(jspb.BinaryReader.prototype,"readString",jspb.BinaryReader.prototype.readString),jspb.BinaryReader.prototype.readBytes=function(){jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var e=this.decoder_.readUnsignedVarint32();return this.decoder_.readBytes(e)},goog.exportProperty(jspb.BinaryReader.prototype,"readBytes",jspb.BinaryReader.prototype.readBytes),jspb.BinaryReader.prototype.readVarintHash64=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readVarintHash64()},jspb.BinaryReader.prototype.readSintHash64=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readZigzagVarintHash64()},jspb.BinaryReader.prototype.readSplitVarint64=function(e){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSplitVarint64(e)},jspb.BinaryReader.prototype.readSplitZigzagVarint64=function(e){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSplitVarint64((function(t,r){return jspb.utils.fromZigzag64(t,r,e)}))},jspb.BinaryReader.prototype.readFixedHash64=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readFixedHash64()},jspb.BinaryReader.prototype.readSplitFixed64=function(e){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readSplitFixed64(e)},jspb.BinaryReader.prototype.readPackedField_=function(e){jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var t=this.decoder_.readUnsignedVarint32();t=this.decoder_.getCursor()+t;for(var r=[];this.decoder_.getCursor()>>7|t<<25)>>>0,t>>>=7;this.buffer_.push(e)},jspb.BinaryEncoder.prototype.writeSplitFixed64=function(e,t){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(t==Math.floor(t)),jspb.asserts.assert(0<=e&&e>>=7;this.buffer_.push(e)},jspb.BinaryEncoder.prototype.writeSignedVarint32=function(e){if(jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_31&&et;t++)this.buffer_.push(127&e|128),e>>=7;this.buffer_.push(1)}},jspb.BinaryEncoder.prototype.writeUnsignedVarint64=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(0<=e&&e=-jspb.BinaryConstants.TWO_TO_63&&e=-jspb.BinaryConstants.TWO_TO_31&&e>31)>>>0)},jspb.BinaryEncoder.prototype.writeZigzagVarint64=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_63&&e>>0,r>>>0)}))},jspb.BinaryEncoder.prototype.writeUint8=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(0<=e&&256>e),this.buffer_.push(e>>>0&255)},jspb.BinaryEncoder.prototype.writeUint16=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(0<=e&&65536>e),this.buffer_.push(e>>>0&255),this.buffer_.push(e>>>8&255)},jspb.BinaryEncoder.prototype.writeUint32=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(0<=e&&e>>0&255),this.buffer_.push(e>>>8&255),this.buffer_.push(e>>>16&255),this.buffer_.push(e>>>24&255)},jspb.BinaryEncoder.prototype.writeUint64=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(0<=e&&ee),this.buffer_.push(e>>>0&255)},jspb.BinaryEncoder.prototype.writeInt16=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(-32768<=e&&32768>e),this.buffer_.push(e>>>0&255),this.buffer_.push(e>>>8&255)},jspb.BinaryEncoder.prototype.writeInt32=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_31&&e>>0&255),this.buffer_.push(e>>>8&255),this.buffer_.push(e>>>16&255),this.buffer_.push(e>>>24&255)},jspb.BinaryEncoder.prototype.writeInt64=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_63&&e=-jspb.BinaryConstants.TWO_TO_63&&+e=-jspb.BinaryConstants.FLOAT32_MAX&&e<=jspb.BinaryConstants.FLOAT32_MAX),jspb.utils.splitFloat32(e),this.writeUint32(jspb.utils.split64Low)},jspb.BinaryEncoder.prototype.writeDouble=function(e){jspb.asserts.assert(1/0===e||-1/0===e||isNaN(e)||e>=-jspb.BinaryConstants.FLOAT64_MAX&&e<=jspb.BinaryConstants.FLOAT64_MAX),jspb.utils.splitFloat64(e),this.writeUint32(jspb.utils.split64Low),this.writeUint32(jspb.utils.split64High)},jspb.BinaryEncoder.prototype.writeBool=function(e){jspb.asserts.assert("boolean"==typeof e||"number"==typeof e),this.buffer_.push(e?1:0)},jspb.BinaryEncoder.prototype.writeEnum=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_31&&eo)this.buffer_.push(o);else if(2048>o)this.buffer_.push(o>>6|192),this.buffer_.push(63&o|128);else if(65536>o)if(55296<=o&&56319>=o&&r+1=i&&(o=1024*(o-55296)+i-56320+65536,this.buffer_.push(o>>18|240),this.buffer_.push(o>>12&63|128),this.buffer_.push(o>>6&63|128),this.buffer_.push(63&o|128),r++)}else this.buffer_.push(o>>12|224),this.buffer_.push(o>>6&63|128),this.buffer_.push(63&o|128)}return this.buffer_.length-t},jspb.arith={},jspb.arith.UInt64=function(e,t){this.lo=e,this.hi=t},jspb.arith.UInt64.prototype.cmp=function(e){return this.hi>>1|(1&this.hi)<<31)>>>0,this.hi>>>1>>>0)},jspb.arith.UInt64.prototype.leftShift=function(){return new jspb.arith.UInt64(this.lo<<1>>>0,(this.hi<<1|this.lo>>>31)>>>0)},jspb.arith.UInt64.prototype.msb=function(){return!!(2147483648&this.hi)},jspb.arith.UInt64.prototype.lsb=function(){return!!(1&this.lo)},jspb.arith.UInt64.prototype.zero=function(){return 0==this.lo&&0==this.hi},jspb.arith.UInt64.prototype.add=function(e){return new jspb.arith.UInt64((this.lo+e.lo&4294967295)>>>0>>>0,((this.hi+e.hi&4294967295)>>>0)+(4294967296<=this.lo+e.lo?1:0)>>>0)},jspb.arith.UInt64.prototype.sub=function(e){return new jspb.arith.UInt64((this.lo-e.lo&4294967295)>>>0>>>0,((this.hi-e.hi&4294967295)>>>0)-(0>this.lo-e.lo?1:0)>>>0)},jspb.arith.UInt64.mul32x32=function(e,t){var r=65535&e,o=65535&t,i=t>>>16;for(t=r*o+65536*(r*i&65535)+65536*((e>>>=16)*o&65535),r=e*i+(r*i>>>16)+(e*o>>>16);4294967296<=t;)t-=4294967296,r+=1;return new jspb.arith.UInt64(t>>>0,r>>>0)},jspb.arith.UInt64.prototype.mul=function(e){var t=jspb.arith.UInt64.mul32x32(this.lo,e);return(e=jspb.arith.UInt64.mul32x32(this.hi,e)).hi=e.lo,e.lo=0,t.add(e)},jspb.arith.UInt64.prototype.div=function(e){if(0==e)return[];var t=new jspb.arith.UInt64(0,0),r=new jspb.arith.UInt64(this.lo,this.hi);e=new jspb.arith.UInt64(e,0);for(var o=new jspb.arith.UInt64(1,0);!e.msb();)e=e.leftShift(),o=o.leftShift();for(;!o.zero();)0>=e.cmp(r)&&(t=t.add(o),r=r.sub(e)),e=e.rightShift(),o=o.rightShift();return[t,r]},jspb.arith.UInt64.prototype.toString=function(){for(var e="",t=this;!t.zero();){var r=(t=t.div(10))[0];e=t[1].lo+e,t=r}return""==e&&(e="0"),e},jspb.arith.UInt64.fromString=function(e){for(var t=new jspb.arith.UInt64(0,0),r=new jspb.arith.UInt64(0,0),o=0;oe[o]||"9">>0>>>0,((this.hi+e.hi&4294967295)>>>0)+(4294967296<=this.lo+e.lo?1:0)>>>0)},jspb.arith.Int64.prototype.sub=function(e){return new jspb.arith.Int64((this.lo-e.lo&4294967295)>>>0>>>0,((this.hi-e.hi&4294967295)>>>0)-(0>this.lo-e.lo?1:0)>>>0)},jspb.arith.Int64.prototype.clone=function(){return new jspb.arith.Int64(this.lo,this.hi)},jspb.arith.Int64.prototype.toString=function(){var e=0!=(2147483648&this.hi),t=new jspb.arith.UInt64(this.lo,this.hi);return e&&(t=new jspb.arith.UInt64(0,0).sub(t)),(e?"-":"")+t.toString()},jspb.arith.Int64.fromString=function(e){var t=0>>=7,this.totalLength_++;e.push(t),this.totalLength_++},jspb.BinaryWriter.prototype.writeSerializedMessage=function(e,t,r){this.appendUint8Array_(e.subarray(t,r))},jspb.BinaryWriter.prototype.maybeWriteSerializedMessage=function(e,t,r){null!=e&&null!=t&&null!=r&&this.writeSerializedMessage(e,t,r)},jspb.BinaryWriter.prototype.reset=function(){this.blocks_=[],this.encoder_.end(),this.totalLength_=0,this.bookmarks_=[]},jspb.BinaryWriter.prototype.getResultBuffer=function(){jspb.asserts.assert(0==this.bookmarks_.length);for(var e=new Uint8Array(this.totalLength_+this.encoder_.length()),t=this.blocks_,r=t.length,o=0,i=0;i=-jspb.BinaryConstants.TWO_TO_31&&t=-jspb.BinaryConstants.TWO_TO_31&&t=-jspb.BinaryConstants.TWO_TO_63&&t=-jspb.BinaryConstants.TWO_TO_31&&t=-jspb.BinaryConstants.TWO_TO_63&&t=-jspb.BinaryConstants.TWO_TO_31&&t=-jspb.BinaryConstants.TWO_TO_63&&t=-jspb.BinaryConstants.TWO_TO_31&&t>>0,t>>>0)}))},jspb.BinaryWriter.prototype.writeRepeatedInt32=function(e,t){if(null!=t)for(var r=0;r>>0,t>>>0)}));this.endDelimited_(e)}},jspb.BinaryWriter.prototype.writePackedInt64String=function(e,t){if(null!=t&&t.length){e=this.beginDelimited_(e);for(var r=0;rt.length?r.length:t.length;for(e.getJsPbMessageId()&&(o[0]=e.getJsPbMessageId(),i=1);i0&&t.writeString(1,r),(r=e.getValue_asU8()).length>0&&t.writeBytes(2,r)},proto.google.protobuf.Any.prototype.getTypeUrl=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.google.protobuf.Any.prototype.setTypeUrl=function(e){return t.Message.setProto3StringField(this,1,e)},proto.google.protobuf.Any.prototype.getValue=function(){return t.Message.getFieldWithDefault(this,2,"")},proto.google.protobuf.Any.prototype.getValue_asB64=function(){return t.Message.bytesAsB64(this.getValue())},proto.google.protobuf.Any.prototype.getValue_asU8=function(){return t.Message.bytesAsU8(this.getValue())},proto.google.protobuf.Any.prototype.setValue=function(e){return t.Message.setProto3BytesField(this,2,e)},r.object.extend(e,proto.google.protobuf),proto.google.protobuf.Any.prototype.getTypeName=function(){return this.getTypeUrl().split("/").pop()},proto.google.protobuf.Any.prototype.pack=function(e,t,r){r||(r="type.googleapis.com/"),"/"!=r.substr(-1)?this.setTypeUrl(r+"/"+t):this.setTypeUrl(r+t),this.setValue(e)},proto.google.protobuf.Any.prototype.unpack=function(e,t){return this.getTypeName()==t?e(this.getValue_asU8()):null}}(any_pb);var mediapipe_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.MediaPipeOptions",null,o),proto.mediapipe.MediaPipeOptions=function(e){t.Message.initialize(this,e,0,1,null,null)},r.inherits(proto.mediapipe.MediaPipeOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.MediaPipeOptions.displayName="proto.mediapipe.MediaPipeOptions"),proto.mediapipe.MediaPipeOptions.extensions={},proto.mediapipe.MediaPipeOptions.extensionsBinary={},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.MediaPipeOptions.prototype.toObject=function(e){return proto.mediapipe.MediaPipeOptions.toObject(e,this)},proto.mediapipe.MediaPipeOptions.toObject=function(e,r){var o={};return t.Message.toObjectExtension(r,o,proto.mediapipe.MediaPipeOptions.extensions,proto.mediapipe.MediaPipeOptions.prototype.getExtension,e),e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.MediaPipeOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.MediaPipeOptions;return proto.mediapipe.MediaPipeOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.MediaPipeOptions.deserializeBinaryFromReader=function(e,r){for(;r.nextField()&&!r.isEndGroup();){r.getFieldNumber();t.Message.readBinaryExtension(e,r,proto.mediapipe.MediaPipeOptions.extensionsBinary,proto.mediapipe.MediaPipeOptions.prototype.getExtension,proto.mediapipe.MediaPipeOptions.prototype.setExtension)}return e},proto.mediapipe.MediaPipeOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.MediaPipeOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.MediaPipeOptions.serializeBinaryToWriter=function(e,r){t.Message.serializeBinaryExtensions(e,r,proto.mediapipe.MediaPipeOptions.extensionsBinary,proto.mediapipe.MediaPipeOptions.prototype.getExtension)},r.object.extend(e,proto.mediapipe)}(mediapipe_options_pb);var packet_factory_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.PacketFactoryConfig",null,o),r.exportSymbol("proto.mediapipe.PacketFactoryOptions",null,o),r.exportSymbol("proto.mediapipe.PacketManagerConfig",null,o),proto.mediapipe.PacketFactoryOptions=function(e){t.Message.initialize(this,e,0,1,null,null)},r.inherits(proto.mediapipe.PacketFactoryOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.PacketFactoryOptions.displayName="proto.mediapipe.PacketFactoryOptions"),proto.mediapipe.PacketFactoryOptions.extensions={},proto.mediapipe.PacketFactoryOptions.extensionsBinary={},proto.mediapipe.PacketFactoryConfig=function(e){t.Message.initialize(this,e,0,500,null,null)},r.inherits(proto.mediapipe.PacketFactoryConfig,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.PacketFactoryConfig.displayName="proto.mediapipe.PacketFactoryConfig"),proto.mediapipe.PacketManagerConfig=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.PacketManagerConfig.repeatedFields_,null)},r.inherits(proto.mediapipe.PacketManagerConfig,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.PacketManagerConfig.displayName="proto.mediapipe.PacketManagerConfig"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.PacketFactoryOptions.prototype.toObject=function(e){return proto.mediapipe.PacketFactoryOptions.toObject(e,this)},proto.mediapipe.PacketFactoryOptions.toObject=function(e,r){var o={};return t.Message.toObjectExtension(r,o,proto.mediapipe.PacketFactoryOptions.extensions,proto.mediapipe.PacketFactoryOptions.prototype.getExtension,e),e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.PacketFactoryOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.PacketFactoryOptions;return proto.mediapipe.PacketFactoryOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.PacketFactoryOptions.deserializeBinaryFromReader=function(e,r){for(;r.nextField()&&!r.isEndGroup();){r.getFieldNumber();t.Message.readBinaryExtension(e,r,proto.mediapipe.PacketFactoryOptions.extensionsBinary,proto.mediapipe.PacketFactoryOptions.prototype.getExtension,proto.mediapipe.PacketFactoryOptions.prototype.setExtension)}return e},proto.mediapipe.PacketFactoryOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.PacketFactoryOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.PacketFactoryOptions.serializeBinaryToWriter=function(e,r){t.Message.serializeBinaryExtensions(e,r,proto.mediapipe.PacketFactoryOptions.extensionsBinary,proto.mediapipe.PacketFactoryOptions.prototype.getExtension)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.PacketFactoryConfig.prototype.toObject=function(e){return proto.mediapipe.PacketFactoryConfig.toObject(e,this)},proto.mediapipe.PacketFactoryConfig.toObject=function(e,r){var o,i={packetFactory:null==(o=t.Message.getField(r,1))?void 0:o,outputSidePacket:null==(o=t.Message.getField(r,2))?void 0:o,externalOutput:null==(o=t.Message.getField(r,1002))?void 0:o,options:(o=r.getOptions())&&proto.mediapipe.PacketFactoryOptions.toObject(e,o)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.PacketFactoryConfig.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.PacketFactoryConfig;return proto.mediapipe.PacketFactoryConfig.deserializeBinaryFromReader(o,r)},proto.mediapipe.PacketFactoryConfig.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setPacketFactory(r);break;case 2:r=t.readString();e.setOutputSidePacket(r);break;case 1002:r=t.readString();e.setExternalOutput(r);break;case 3:r=new proto.mediapipe.PacketFactoryOptions;t.readMessage(r,proto.mediapipe.PacketFactoryOptions.deserializeBinaryFromReader),e.setOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.PacketFactoryConfig.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.PacketFactoryConfig.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.PacketFactoryConfig.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeString(1,o),null!=(o=t.Message.getField(e,2))&&r.writeString(2,o),null!=(o=t.Message.getField(e,1002))&&r.writeString(1002,o),null!=(o=e.getOptions())&&r.writeMessage(3,o,proto.mediapipe.PacketFactoryOptions.serializeBinaryToWriter)},proto.mediapipe.PacketFactoryConfig.prototype.getPacketFactory=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.PacketFactoryConfig.prototype.setPacketFactory=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.PacketFactoryConfig.prototype.clearPacketFactory=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.PacketFactoryConfig.prototype.hasPacketFactory=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.PacketFactoryConfig.prototype.getOutputSidePacket=function(){return t.Message.getFieldWithDefault(this,2,"")},proto.mediapipe.PacketFactoryConfig.prototype.setOutputSidePacket=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.PacketFactoryConfig.prototype.clearOutputSidePacket=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.PacketFactoryConfig.prototype.hasOutputSidePacket=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.PacketFactoryConfig.prototype.getExternalOutput=function(){return t.Message.getFieldWithDefault(this,1002,"")},proto.mediapipe.PacketFactoryConfig.prototype.setExternalOutput=function(e){return t.Message.setField(this,1002,e)},proto.mediapipe.PacketFactoryConfig.prototype.clearExternalOutput=function(){return t.Message.setField(this,1002,void 0)},proto.mediapipe.PacketFactoryConfig.prototype.hasExternalOutput=function(){return null!=t.Message.getField(this,1002)},proto.mediapipe.PacketFactoryConfig.prototype.getOptions=function(){return t.Message.getWrapperField(this,proto.mediapipe.PacketFactoryOptions,3)},proto.mediapipe.PacketFactoryConfig.prototype.setOptions=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.PacketFactoryConfig.prototype.clearOptions=function(){return this.setOptions(void 0)},proto.mediapipe.PacketFactoryConfig.prototype.hasOptions=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.PacketManagerConfig.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.PacketManagerConfig.prototype.toObject=function(e){return proto.mediapipe.PacketManagerConfig.toObject(e,this)},proto.mediapipe.PacketManagerConfig.toObject=function(e,r){var o={packetList:t.Message.toObjectList(r.getPacketList(),proto.mediapipe.PacketFactoryConfig.toObject,e)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.PacketManagerConfig.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.PacketManagerConfig;return proto.mediapipe.PacketManagerConfig.deserializeBinaryFromReader(o,r)},proto.mediapipe.PacketManagerConfig.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new proto.mediapipe.PacketFactoryConfig;t.readMessage(r,proto.mediapipe.PacketFactoryConfig.deserializeBinaryFromReader),e.addPacket(r)}else t.skipField()}return e},proto.mediapipe.PacketManagerConfig.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.PacketManagerConfig.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.PacketManagerConfig.serializeBinaryToWriter=function(e,t){var r;(r=e.getPacketList()).length>0&&t.writeRepeatedMessage(1,r,proto.mediapipe.PacketFactoryConfig.serializeBinaryToWriter)},proto.mediapipe.PacketManagerConfig.prototype.getPacketList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.PacketFactoryConfig,1)},proto.mediapipe.PacketManagerConfig.prototype.setPacketList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.PacketManagerConfig.prototype.addPacket=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.PacketFactoryConfig,r)},proto.mediapipe.PacketManagerConfig.prototype.clearPacketList=function(){return this.setPacketList([])},r.object.extend(e,proto.mediapipe)}(packet_factory_pb);var packet_generator_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.PacketGeneratorConfig",null,o),r.exportSymbol("proto.mediapipe.PacketGeneratorOptions",null,o),proto.mediapipe.PacketGeneratorOptions=function(e){t.Message.initialize(this,e,0,2,null,null)},r.inherits(proto.mediapipe.PacketGeneratorOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.PacketGeneratorOptions.displayName="proto.mediapipe.PacketGeneratorOptions"),proto.mediapipe.PacketGeneratorOptions.extensions={},proto.mediapipe.PacketGeneratorOptions.extensionsBinary={},proto.mediapipe.PacketGeneratorConfig=function(e){t.Message.initialize(this,e,0,500,proto.mediapipe.PacketGeneratorConfig.repeatedFields_,null)},r.inherits(proto.mediapipe.PacketGeneratorConfig,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.PacketGeneratorConfig.displayName="proto.mediapipe.PacketGeneratorConfig"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.PacketGeneratorOptions.prototype.toObject=function(e){return proto.mediapipe.PacketGeneratorOptions.toObject(e,this)},proto.mediapipe.PacketGeneratorOptions.toObject=function(e,r){var o={mergeFields:t.Message.getBooleanFieldWithDefault(r,1,!0)};return t.Message.toObjectExtension(r,o,proto.mediapipe.PacketGeneratorOptions.extensions,proto.mediapipe.PacketGeneratorOptions.prototype.getExtension,e),e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.PacketGeneratorOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.PacketGeneratorOptions;return proto.mediapipe.PacketGeneratorOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.PacketGeneratorOptions.deserializeBinaryFromReader=function(e,r){for(;r.nextField()&&!r.isEndGroup();){if(1===r.getFieldNumber()){var o=r.readBool();e.setMergeFields(o)}else t.Message.readBinaryExtension(e,r,proto.mediapipe.PacketGeneratorOptions.extensionsBinary,proto.mediapipe.PacketGeneratorOptions.prototype.getExtension,proto.mediapipe.PacketGeneratorOptions.prototype.setExtension)}return e},proto.mediapipe.PacketGeneratorOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.PacketGeneratorOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.PacketGeneratorOptions.serializeBinaryToWriter=function(e,r){var o;null!=(o=t.Message.getField(e,1))&&r.writeBool(1,o),t.Message.serializeBinaryExtensions(e,r,proto.mediapipe.PacketGeneratorOptions.extensionsBinary,proto.mediapipe.PacketGeneratorOptions.prototype.getExtension)},proto.mediapipe.PacketGeneratorOptions.prototype.getMergeFields=function(){return t.Message.getBooleanFieldWithDefault(this,1,!0)},proto.mediapipe.PacketGeneratorOptions.prototype.setMergeFields=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.PacketGeneratorOptions.prototype.clearMergeFields=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.PacketGeneratorOptions.prototype.hasMergeFields=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.PacketGeneratorConfig.repeatedFields_=[2,1002,3,1003],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.PacketGeneratorConfig.prototype.toObject=function(e){return proto.mediapipe.PacketGeneratorConfig.toObject(e,this)},proto.mediapipe.PacketGeneratorConfig.toObject=function(e,r){var o,i={packetGenerator:null==(o=t.Message.getField(r,1))?void 0:o,inputSidePacketList:null==(o=t.Message.getRepeatedField(r,2))?void 0:o,externalInputList:null==(o=t.Message.getRepeatedField(r,1002))?void 0:o,outputSidePacketList:null==(o=t.Message.getRepeatedField(r,3))?void 0:o,externalOutputList:null==(o=t.Message.getRepeatedField(r,1003))?void 0:o,options:(o=r.getOptions())&&proto.mediapipe.PacketGeneratorOptions.toObject(e,o)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.PacketGeneratorConfig.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.PacketGeneratorConfig;return proto.mediapipe.PacketGeneratorConfig.deserializeBinaryFromReader(o,r)},proto.mediapipe.PacketGeneratorConfig.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setPacketGenerator(r);break;case 2:r=t.readString();e.addInputSidePacket(r);break;case 1002:r=t.readString();e.addExternalInput(r);break;case 3:r=t.readString();e.addOutputSidePacket(r);break;case 1003:r=t.readString();e.addExternalOutput(r);break;case 4:r=new proto.mediapipe.PacketGeneratorOptions;t.readMessage(r,proto.mediapipe.PacketGeneratorOptions.deserializeBinaryFromReader),e.setOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.PacketGeneratorConfig.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.PacketGeneratorConfig.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.PacketGeneratorConfig.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeString(1,o),(o=e.getInputSidePacketList()).length>0&&r.writeRepeatedString(2,o),(o=e.getExternalInputList()).length>0&&r.writeRepeatedString(1002,o),(o=e.getOutputSidePacketList()).length>0&&r.writeRepeatedString(3,o),(o=e.getExternalOutputList()).length>0&&r.writeRepeatedString(1003,o),null!=(o=e.getOptions())&&r.writeMessage(4,o,proto.mediapipe.PacketGeneratorOptions.serializeBinaryToWriter)},proto.mediapipe.PacketGeneratorConfig.prototype.getPacketGenerator=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.PacketGeneratorConfig.prototype.setPacketGenerator=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.PacketGeneratorConfig.prototype.clearPacketGenerator=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.PacketGeneratorConfig.prototype.hasPacketGenerator=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.PacketGeneratorConfig.prototype.getInputSidePacketList=function(){return t.Message.getRepeatedField(this,2)},proto.mediapipe.PacketGeneratorConfig.prototype.setInputSidePacketList=function(e){return t.Message.setField(this,2,e||[])},proto.mediapipe.PacketGeneratorConfig.prototype.addInputSidePacket=function(e,r){return t.Message.addToRepeatedField(this,2,e,r)},proto.mediapipe.PacketGeneratorConfig.prototype.clearInputSidePacketList=function(){return this.setInputSidePacketList([])},proto.mediapipe.PacketGeneratorConfig.prototype.getExternalInputList=function(){return t.Message.getRepeatedField(this,1002)},proto.mediapipe.PacketGeneratorConfig.prototype.setExternalInputList=function(e){return t.Message.setField(this,1002,e||[])},proto.mediapipe.PacketGeneratorConfig.prototype.addExternalInput=function(e,r){return t.Message.addToRepeatedField(this,1002,e,r)},proto.mediapipe.PacketGeneratorConfig.prototype.clearExternalInputList=function(){return this.setExternalInputList([])},proto.mediapipe.PacketGeneratorConfig.prototype.getOutputSidePacketList=function(){return t.Message.getRepeatedField(this,3)},proto.mediapipe.PacketGeneratorConfig.prototype.setOutputSidePacketList=function(e){return t.Message.setField(this,3,e||[])},proto.mediapipe.PacketGeneratorConfig.prototype.addOutputSidePacket=function(e,r){return t.Message.addToRepeatedField(this,3,e,r)},proto.mediapipe.PacketGeneratorConfig.prototype.clearOutputSidePacketList=function(){return this.setOutputSidePacketList([])},proto.mediapipe.PacketGeneratorConfig.prototype.getExternalOutputList=function(){return t.Message.getRepeatedField(this,1003)},proto.mediapipe.PacketGeneratorConfig.prototype.setExternalOutputList=function(e){return t.Message.setField(this,1003,e||[])},proto.mediapipe.PacketGeneratorConfig.prototype.addExternalOutput=function(e,r){return t.Message.addToRepeatedField(this,1003,e,r)},proto.mediapipe.PacketGeneratorConfig.prototype.clearExternalOutputList=function(){return this.setExternalOutputList([])},proto.mediapipe.PacketGeneratorConfig.prototype.getOptions=function(){return t.Message.getWrapperField(this,proto.mediapipe.PacketGeneratorOptions,4)},proto.mediapipe.PacketGeneratorConfig.prototype.setOptions=function(e){return t.Message.setWrapperField(this,4,e)},proto.mediapipe.PacketGeneratorConfig.prototype.clearOptions=function(){return this.setOptions(void 0)},proto.mediapipe.PacketGeneratorConfig.prototype.hasOptions=function(){return null!=t.Message.getField(this,4)},r.object.extend(e,proto.mediapipe)}(packet_generator_pb);var status_handler_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=mediapipe_options_pb;r.object.extend(proto,i),r.exportSymbol("proto.mediapipe.StatusHandlerConfig",null,o),proto.mediapipe.StatusHandlerConfig=function(e){t.Message.initialize(this,e,0,500,proto.mediapipe.StatusHandlerConfig.repeatedFields_,null)},r.inherits(proto.mediapipe.StatusHandlerConfig,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.StatusHandlerConfig.displayName="proto.mediapipe.StatusHandlerConfig"),proto.mediapipe.StatusHandlerConfig.repeatedFields_=[2,1002],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.StatusHandlerConfig.prototype.toObject=function(e){return proto.mediapipe.StatusHandlerConfig.toObject(e,this)},proto.mediapipe.StatusHandlerConfig.toObject=function(e,r){var o,a={statusHandler:null==(o=t.Message.getField(r,1))?void 0:o,inputSidePacketList:null==(o=t.Message.getRepeatedField(r,2))?void 0:o,externalInputList:null==(o=t.Message.getRepeatedField(r,1002))?void 0:o,options:(o=r.getOptions())&&i.MediaPipeOptions.toObject(e,o)};return e&&(a.$jspbMessageInstance=r),a}),proto.mediapipe.StatusHandlerConfig.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.StatusHandlerConfig;return proto.mediapipe.StatusHandlerConfig.deserializeBinaryFromReader(o,r)},proto.mediapipe.StatusHandlerConfig.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setStatusHandler(r);break;case 2:r=t.readString();e.addInputSidePacket(r);break;case 1002:r=t.readString();e.addExternalInput(r);break;case 3:r=new i.MediaPipeOptions;t.readMessage(r,i.MediaPipeOptions.deserializeBinaryFromReader),e.setOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.StatusHandlerConfig.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.StatusHandlerConfig.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.StatusHandlerConfig.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeString(1,o),(o=e.getInputSidePacketList()).length>0&&r.writeRepeatedString(2,o),(o=e.getExternalInputList()).length>0&&r.writeRepeatedString(1002,o),null!=(o=e.getOptions())&&r.writeMessage(3,o,i.MediaPipeOptions.serializeBinaryToWriter)},proto.mediapipe.StatusHandlerConfig.prototype.getStatusHandler=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.StatusHandlerConfig.prototype.setStatusHandler=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.StatusHandlerConfig.prototype.clearStatusHandler=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.StatusHandlerConfig.prototype.hasStatusHandler=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.StatusHandlerConfig.prototype.getInputSidePacketList=function(){return t.Message.getRepeatedField(this,2)},proto.mediapipe.StatusHandlerConfig.prototype.setInputSidePacketList=function(e){return t.Message.setField(this,2,e||[])},proto.mediapipe.StatusHandlerConfig.prototype.addInputSidePacket=function(e,r){return t.Message.addToRepeatedField(this,2,e,r)},proto.mediapipe.StatusHandlerConfig.prototype.clearInputSidePacketList=function(){return this.setInputSidePacketList([])},proto.mediapipe.StatusHandlerConfig.prototype.getExternalInputList=function(){return t.Message.getRepeatedField(this,1002)},proto.mediapipe.StatusHandlerConfig.prototype.setExternalInputList=function(e){return t.Message.setField(this,1002,e||[])},proto.mediapipe.StatusHandlerConfig.prototype.addExternalInput=function(e,r){return t.Message.addToRepeatedField(this,1002,e,r)},proto.mediapipe.StatusHandlerConfig.prototype.clearExternalInputList=function(){return this.setExternalInputList([])},proto.mediapipe.StatusHandlerConfig.prototype.getOptions=function(){return t.Message.getWrapperField(this,i.MediaPipeOptions,3)},proto.mediapipe.StatusHandlerConfig.prototype.setOptions=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.StatusHandlerConfig.prototype.clearOptions=function(){return this.setOptions(void 0)},proto.mediapipe.StatusHandlerConfig.prototype.hasOptions=function(){return null!=t.Message.getField(this,3)},r.object.extend(e,proto.mediapipe)}(status_handler_pb);var stream_handler_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=mediapipe_options_pb;r.object.extend(proto,i),r.exportSymbol("proto.mediapipe.InputStreamHandlerConfig",null,o),r.exportSymbol("proto.mediapipe.OutputStreamHandlerConfig",null,o),proto.mediapipe.InputStreamHandlerConfig=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.InputStreamHandlerConfig,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.InputStreamHandlerConfig.displayName="proto.mediapipe.InputStreamHandlerConfig"),proto.mediapipe.OutputStreamHandlerConfig=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.OutputStreamHandlerConfig.repeatedFields_,null)},r.inherits(proto.mediapipe.OutputStreamHandlerConfig,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.OutputStreamHandlerConfig.displayName="proto.mediapipe.OutputStreamHandlerConfig"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.InputStreamHandlerConfig.prototype.toObject=function(e){return proto.mediapipe.InputStreamHandlerConfig.toObject(e,this)},proto.mediapipe.InputStreamHandlerConfig.toObject=function(e,r){var o,a={inputStreamHandler:t.Message.getFieldWithDefault(r,1,"DefaultInputStreamHandler"),options:(o=r.getOptions())&&i.MediaPipeOptions.toObject(e,o)};return e&&(a.$jspbMessageInstance=r),a}),proto.mediapipe.InputStreamHandlerConfig.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.InputStreamHandlerConfig;return proto.mediapipe.InputStreamHandlerConfig.deserializeBinaryFromReader(o,r)},proto.mediapipe.InputStreamHandlerConfig.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setInputStreamHandler(r);break;case 3:r=new i.MediaPipeOptions;t.readMessage(r,i.MediaPipeOptions.deserializeBinaryFromReader),e.setOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.InputStreamHandlerConfig.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.InputStreamHandlerConfig.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.InputStreamHandlerConfig.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeString(1,o),null!=(o=e.getOptions())&&r.writeMessage(3,o,i.MediaPipeOptions.serializeBinaryToWriter)},proto.mediapipe.InputStreamHandlerConfig.prototype.getInputStreamHandler=function(){return t.Message.getFieldWithDefault(this,1,"DefaultInputStreamHandler")},proto.mediapipe.InputStreamHandlerConfig.prototype.setInputStreamHandler=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.InputStreamHandlerConfig.prototype.clearInputStreamHandler=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.InputStreamHandlerConfig.prototype.hasInputStreamHandler=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.InputStreamHandlerConfig.prototype.getOptions=function(){return t.Message.getWrapperField(this,i.MediaPipeOptions,3)},proto.mediapipe.InputStreamHandlerConfig.prototype.setOptions=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.InputStreamHandlerConfig.prototype.clearOptions=function(){return this.setOptions(void 0)},proto.mediapipe.InputStreamHandlerConfig.prototype.hasOptions=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.OutputStreamHandlerConfig.repeatedFields_=[2],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.OutputStreamHandlerConfig.prototype.toObject=function(e){return proto.mediapipe.OutputStreamHandlerConfig.toObject(e,this)},proto.mediapipe.OutputStreamHandlerConfig.toObject=function(e,r){var o,a={outputStreamHandler:t.Message.getFieldWithDefault(r,1,"InOrderOutputStreamHandler"),inputSidePacketList:null==(o=t.Message.getRepeatedField(r,2))?void 0:o,options:(o=r.getOptions())&&i.MediaPipeOptions.toObject(e,o)};return e&&(a.$jspbMessageInstance=r),a}),proto.mediapipe.OutputStreamHandlerConfig.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.OutputStreamHandlerConfig;return proto.mediapipe.OutputStreamHandlerConfig.deserializeBinaryFromReader(o,r)},proto.mediapipe.OutputStreamHandlerConfig.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setOutputStreamHandler(r);break;case 2:r=t.readString();e.addInputSidePacket(r);break;case 3:r=new i.MediaPipeOptions;t.readMessage(r,i.MediaPipeOptions.deserializeBinaryFromReader),e.setOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.OutputStreamHandlerConfig.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.OutputStreamHandlerConfig.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.OutputStreamHandlerConfig.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeString(1,o),(o=e.getInputSidePacketList()).length>0&&r.writeRepeatedString(2,o),null!=(o=e.getOptions())&&r.writeMessage(3,o,i.MediaPipeOptions.serializeBinaryToWriter)},proto.mediapipe.OutputStreamHandlerConfig.prototype.getOutputStreamHandler=function(){return t.Message.getFieldWithDefault(this,1,"InOrderOutputStreamHandler")},proto.mediapipe.OutputStreamHandlerConfig.prototype.setOutputStreamHandler=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.OutputStreamHandlerConfig.prototype.clearOutputStreamHandler=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.OutputStreamHandlerConfig.prototype.hasOutputStreamHandler=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.OutputStreamHandlerConfig.prototype.getInputSidePacketList=function(){return t.Message.getRepeatedField(this,2)},proto.mediapipe.OutputStreamHandlerConfig.prototype.setInputSidePacketList=function(e){return t.Message.setField(this,2,e||[])},proto.mediapipe.OutputStreamHandlerConfig.prototype.addInputSidePacket=function(e,r){return t.Message.addToRepeatedField(this,2,e,r)},proto.mediapipe.OutputStreamHandlerConfig.prototype.clearInputSidePacketList=function(){return this.setInputSidePacketList([])},proto.mediapipe.OutputStreamHandlerConfig.prototype.getOptions=function(){return t.Message.getWrapperField(this,i.MediaPipeOptions,3)},proto.mediapipe.OutputStreamHandlerConfig.prototype.setOptions=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.OutputStreamHandlerConfig.prototype.clearOptions=function(){return this.setOptions(void 0)},proto.mediapipe.OutputStreamHandlerConfig.prototype.hasOptions=function(){return null!=t.Message.getField(this,3)},r.object.extend(e,proto.mediapipe)}(stream_handler_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_options_pb;r.object.extend(proto,i);var a=any_pb;r.object.extend(proto,a);var n=mediapipe_options_pb;r.object.extend(proto,n);var s=packet_factory_pb;r.object.extend(proto,s);var p=packet_generator_pb;r.object.extend(proto,p);var d=status_handler_pb;r.object.extend(proto,d);var l=stream_handler_pb;r.object.extend(proto,l),r.exportSymbol("proto.mediapipe.CalculatorGraphConfig",null,o),r.exportSymbol("proto.mediapipe.CalculatorGraphConfig.Node",null,o),r.exportSymbol("proto.mediapipe.ExecutorConfig",null,o),r.exportSymbol("proto.mediapipe.InputCollection",null,o),r.exportSymbol("proto.mediapipe.InputCollection.InputType",null,o),r.exportSymbol("proto.mediapipe.InputCollectionSet",null,o),r.exportSymbol("proto.mediapipe.InputStreamInfo",null,o),r.exportSymbol("proto.mediapipe.ProfilerConfig",null,o),proto.mediapipe.ExecutorConfig=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.ExecutorConfig,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.ExecutorConfig.displayName="proto.mediapipe.ExecutorConfig"),proto.mediapipe.InputCollection=function(e){t.Message.initialize(this,e,0,500,proto.mediapipe.InputCollection.repeatedFields_,null)},r.inherits(proto.mediapipe.InputCollection,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.InputCollection.displayName="proto.mediapipe.InputCollection"),proto.mediapipe.InputCollectionSet=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.InputCollectionSet.repeatedFields_,null)},r.inherits(proto.mediapipe.InputCollectionSet,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.InputCollectionSet.displayName="proto.mediapipe.InputCollectionSet"),proto.mediapipe.InputStreamInfo=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.InputStreamInfo,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.InputStreamInfo.displayName="proto.mediapipe.InputStreamInfo"),proto.mediapipe.ProfilerConfig=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.ProfilerConfig.repeatedFields_,null)},r.inherits(proto.mediapipe.ProfilerConfig,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.ProfilerConfig.displayName="proto.mediapipe.ProfilerConfig"),proto.mediapipe.CalculatorGraphConfig=function(e){t.Message.initialize(this,e,0,500,proto.mediapipe.CalculatorGraphConfig.repeatedFields_,null)},r.inherits(proto.mediapipe.CalculatorGraphConfig,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.CalculatorGraphConfig.displayName="proto.mediapipe.CalculatorGraphConfig"),proto.mediapipe.CalculatorGraphConfig.Node=function(e){t.Message.initialize(this,e,0,500,proto.mediapipe.CalculatorGraphConfig.Node.repeatedFields_,null)},r.inherits(proto.mediapipe.CalculatorGraphConfig.Node,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.CalculatorGraphConfig.Node.displayName="proto.mediapipe.CalculatorGraphConfig.Node"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.ExecutorConfig.prototype.toObject=function(e){return proto.mediapipe.ExecutorConfig.toObject(e,this)},proto.mediapipe.ExecutorConfig.toObject=function(e,r){var o,i={name:t.Message.getFieldWithDefault(r,1,""),type:t.Message.getFieldWithDefault(r,2,""),options:(o=r.getOptions())&&n.MediaPipeOptions.toObject(e,o)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.ExecutorConfig.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.ExecutorConfig;return proto.mediapipe.ExecutorConfig.deserializeBinaryFromReader(o,r)},proto.mediapipe.ExecutorConfig.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setName(r);break;case 2:r=t.readString();e.setType(r);break;case 3:r=new n.MediaPipeOptions;t.readMessage(r,n.MediaPipeOptions.deserializeBinaryFromReader),e.setOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.ExecutorConfig.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.ExecutorConfig.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.ExecutorConfig.serializeBinaryToWriter=function(e,t){var r=void 0;(r=e.getName()).length>0&&t.writeString(1,r),(r=e.getType()).length>0&&t.writeString(2,r),null!=(r=e.getOptions())&&t.writeMessage(3,r,n.MediaPipeOptions.serializeBinaryToWriter)},proto.mediapipe.ExecutorConfig.prototype.getName=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.ExecutorConfig.prototype.setName=function(e){return t.Message.setProto3StringField(this,1,e)},proto.mediapipe.ExecutorConfig.prototype.getType=function(){return t.Message.getFieldWithDefault(this,2,"")},proto.mediapipe.ExecutorConfig.prototype.setType=function(e){return t.Message.setProto3StringField(this,2,e)},proto.mediapipe.ExecutorConfig.prototype.getOptions=function(){return t.Message.getWrapperField(this,n.MediaPipeOptions,3)},proto.mediapipe.ExecutorConfig.prototype.setOptions=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.ExecutorConfig.prototype.clearOptions=function(){return this.setOptions(void 0)},proto.mediapipe.ExecutorConfig.prototype.hasOptions=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.InputCollection.repeatedFields_=[2,1002],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.InputCollection.prototype.toObject=function(e){return proto.mediapipe.InputCollection.toObject(e,this)},proto.mediapipe.InputCollection.toObject=function(e,r){var o,i={name:t.Message.getFieldWithDefault(r,1,""),sidePacketNameList:null==(o=t.Message.getRepeatedField(r,2))?void 0:o,externalInputNameList:null==(o=t.Message.getRepeatedField(r,1002))?void 0:o,inputType:t.Message.getFieldWithDefault(r,3,0),fileName:t.Message.getFieldWithDefault(r,4,"")};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.InputCollection.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.InputCollection;return proto.mediapipe.InputCollection.deserializeBinaryFromReader(o,r)},proto.mediapipe.InputCollection.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setName(r);break;case 2:r=t.readString();e.addSidePacketName(r);break;case 1002:r=t.readString();e.addExternalInputName(r);break;case 3:r=t.readEnum();e.setInputType(r);break;case 4:r=t.readString();e.setFileName(r);break;default:t.skipField()}}return e},proto.mediapipe.InputCollection.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.InputCollection.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.InputCollection.serializeBinaryToWriter=function(e,t){var r=void 0;(r=e.getName()).length>0&&t.writeString(1,r),(r=e.getSidePacketNameList()).length>0&&t.writeRepeatedString(2,r),(r=e.getExternalInputNameList()).length>0&&t.writeRepeatedString(1002,r),0!==(r=e.getInputType())&&t.writeEnum(3,r),(r=e.getFileName()).length>0&&t.writeString(4,r)},proto.mediapipe.InputCollection.InputType={UNKNOWN:0,RECORDIO:1,FOREIGN_RECORDIO:2,FOREIGN_CSV_TEXT:3,INVALID_UPPER_BOUND:4},proto.mediapipe.InputCollection.prototype.getName=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.InputCollection.prototype.setName=function(e){return t.Message.setProto3StringField(this,1,e)},proto.mediapipe.InputCollection.prototype.getSidePacketNameList=function(){return t.Message.getRepeatedField(this,2)},proto.mediapipe.InputCollection.prototype.setSidePacketNameList=function(e){return t.Message.setField(this,2,e||[])},proto.mediapipe.InputCollection.prototype.addSidePacketName=function(e,r){return t.Message.addToRepeatedField(this,2,e,r)},proto.mediapipe.InputCollection.prototype.clearSidePacketNameList=function(){return this.setSidePacketNameList([])},proto.mediapipe.InputCollection.prototype.getExternalInputNameList=function(){return t.Message.getRepeatedField(this,1002)},proto.mediapipe.InputCollection.prototype.setExternalInputNameList=function(e){return t.Message.setField(this,1002,e||[])},proto.mediapipe.InputCollection.prototype.addExternalInputName=function(e,r){return t.Message.addToRepeatedField(this,1002,e,r)},proto.mediapipe.InputCollection.prototype.clearExternalInputNameList=function(){return this.setExternalInputNameList([])},proto.mediapipe.InputCollection.prototype.getInputType=function(){return t.Message.getFieldWithDefault(this,3,0)},proto.mediapipe.InputCollection.prototype.setInputType=function(e){return t.Message.setProto3EnumField(this,3,e)},proto.mediapipe.InputCollection.prototype.getFileName=function(){return t.Message.getFieldWithDefault(this,4,"")},proto.mediapipe.InputCollection.prototype.setFileName=function(e){return t.Message.setProto3StringField(this,4,e)},proto.mediapipe.InputCollectionSet.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.InputCollectionSet.prototype.toObject=function(e){return proto.mediapipe.InputCollectionSet.toObject(e,this)},proto.mediapipe.InputCollectionSet.toObject=function(e,r){var o={inputCollectionList:t.Message.toObjectList(r.getInputCollectionList(),proto.mediapipe.InputCollection.toObject,e)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.InputCollectionSet.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.InputCollectionSet;return proto.mediapipe.InputCollectionSet.deserializeBinaryFromReader(o,r)},proto.mediapipe.InputCollectionSet.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new proto.mediapipe.InputCollection;t.readMessage(r,proto.mediapipe.InputCollection.deserializeBinaryFromReader),e.addInputCollection(r)}else t.skipField()}return e},proto.mediapipe.InputCollectionSet.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.InputCollectionSet.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.InputCollectionSet.serializeBinaryToWriter=function(e,t){var r;(r=e.getInputCollectionList()).length>0&&t.writeRepeatedMessage(1,r,proto.mediapipe.InputCollection.serializeBinaryToWriter)},proto.mediapipe.InputCollectionSet.prototype.getInputCollectionList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.InputCollection,1)},proto.mediapipe.InputCollectionSet.prototype.setInputCollectionList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.InputCollectionSet.prototype.addInputCollection=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.InputCollection,r)},proto.mediapipe.InputCollectionSet.prototype.clearInputCollectionList=function(){return this.setInputCollectionList([])},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.InputStreamInfo.prototype.toObject=function(e){return proto.mediapipe.InputStreamInfo.toObject(e,this)},proto.mediapipe.InputStreamInfo.toObject=function(e,r){var o={tagIndex:t.Message.getFieldWithDefault(r,1,""),backEdge:t.Message.getBooleanFieldWithDefault(r,2,!1)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.InputStreamInfo.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.InputStreamInfo;return proto.mediapipe.InputStreamInfo.deserializeBinaryFromReader(o,r)},proto.mediapipe.InputStreamInfo.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setTagIndex(r);break;case 2:r=t.readBool();e.setBackEdge(r);break;default:t.skipField()}}return e},proto.mediapipe.InputStreamInfo.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.InputStreamInfo.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.InputStreamInfo.serializeBinaryToWriter=function(e,t){var r=void 0;(r=e.getTagIndex()).length>0&&t.writeString(1,r),(r=e.getBackEdge())&&t.writeBool(2,r)},proto.mediapipe.InputStreamInfo.prototype.getTagIndex=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.InputStreamInfo.prototype.setTagIndex=function(e){return t.Message.setProto3StringField(this,1,e)},proto.mediapipe.InputStreamInfo.prototype.getBackEdge=function(){return t.Message.getBooleanFieldWithDefault(this,2,!1)},proto.mediapipe.InputStreamInfo.prototype.setBackEdge=function(e){return t.Message.setProto3BooleanField(this,2,e)},proto.mediapipe.ProfilerConfig.repeatedFields_=[8],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.ProfilerConfig.prototype.toObject=function(e){return proto.mediapipe.ProfilerConfig.toObject(e,this)},proto.mediapipe.ProfilerConfig.toObject=function(e,r){var o,i={histogramIntervalSizeUsec:t.Message.getFieldWithDefault(r,1,0),numHistogramIntervals:t.Message.getFieldWithDefault(r,2,0),enableInputOutputLatency:t.Message.getBooleanFieldWithDefault(r,3,!1),enableProfiler:t.Message.getBooleanFieldWithDefault(r,4,!1),enableStreamLatency:t.Message.getBooleanFieldWithDefault(r,5,!1),usePacketTimestampForAddedPacket:t.Message.getBooleanFieldWithDefault(r,6,!1),traceLogCapacity:t.Message.getFieldWithDefault(r,7,0),traceEventTypesDisabledList:null==(o=t.Message.getRepeatedField(r,8))?void 0:o,traceLogPath:t.Message.getFieldWithDefault(r,9,""),traceLogCount:t.Message.getFieldWithDefault(r,10,0),traceLogIntervalUsec:t.Message.getFieldWithDefault(r,11,0),traceLogMarginUsec:t.Message.getFieldWithDefault(r,12,0),traceLogDurationEvents:t.Message.getBooleanFieldWithDefault(r,13,!1),traceLogIntervalCount:t.Message.getFieldWithDefault(r,14,0),traceLogDisabled:t.Message.getBooleanFieldWithDefault(r,15,!1),traceEnabled:t.Message.getBooleanFieldWithDefault(r,16,!1),traceLogInstantEvents:t.Message.getBooleanFieldWithDefault(r,17,!1),calculatorFilter:t.Message.getFieldWithDefault(r,18,"")};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.ProfilerConfig.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.ProfilerConfig;return proto.mediapipe.ProfilerConfig.deserializeBinaryFromReader(o,r)},proto.mediapipe.ProfilerConfig.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readInt64();e.setHistogramIntervalSizeUsec(r);break;case 2:r=t.readInt64();e.setNumHistogramIntervals(r);break;case 3:r=t.readBool();e.setEnableInputOutputLatency(r);break;case 4:r=t.readBool();e.setEnableProfiler(r);break;case 5:r=t.readBool();e.setEnableStreamLatency(r);break;case 6:r=t.readBool();e.setUsePacketTimestampForAddedPacket(r);break;case 7:r=t.readInt64();e.setTraceLogCapacity(r);break;case 8:for(var o=t.isDelimited()?t.readPackedInt32():[t.readInt32()],i=0;i0&&t.writePackedInt32(8,r),(r=e.getTraceLogPath()).length>0&&t.writeString(9,r),0!==(r=e.getTraceLogCount())&&t.writeInt32(10,r),0!==(r=e.getTraceLogIntervalUsec())&&t.writeInt64(11,r),0!==(r=e.getTraceLogMarginUsec())&&t.writeInt64(12,r),(r=e.getTraceLogDurationEvents())&&t.writeBool(13,r),0!==(r=e.getTraceLogIntervalCount())&&t.writeInt32(14,r),(r=e.getTraceLogDisabled())&&t.writeBool(15,r),(r=e.getTraceEnabled())&&t.writeBool(16,r),(r=e.getTraceLogInstantEvents())&&t.writeBool(17,r),(r=e.getCalculatorFilter()).length>0&&t.writeString(18,r)},proto.mediapipe.ProfilerConfig.prototype.getHistogramIntervalSizeUsec=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.ProfilerConfig.prototype.setHistogramIntervalSizeUsec=function(e){return t.Message.setProto3IntField(this,1,e)},proto.mediapipe.ProfilerConfig.prototype.getNumHistogramIntervals=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.ProfilerConfig.prototype.setNumHistogramIntervals=function(e){return t.Message.setProto3IntField(this,2,e)},proto.mediapipe.ProfilerConfig.prototype.getEnableInputOutputLatency=function(){return t.Message.getBooleanFieldWithDefault(this,3,!1)},proto.mediapipe.ProfilerConfig.prototype.setEnableInputOutputLatency=function(e){return t.Message.setProto3BooleanField(this,3,e)},proto.mediapipe.ProfilerConfig.prototype.getEnableProfiler=function(){return t.Message.getBooleanFieldWithDefault(this,4,!1)},proto.mediapipe.ProfilerConfig.prototype.setEnableProfiler=function(e){return t.Message.setProto3BooleanField(this,4,e)},proto.mediapipe.ProfilerConfig.prototype.getEnableStreamLatency=function(){return t.Message.getBooleanFieldWithDefault(this,5,!1)},proto.mediapipe.ProfilerConfig.prototype.setEnableStreamLatency=function(e){return t.Message.setProto3BooleanField(this,5,e)},proto.mediapipe.ProfilerConfig.prototype.getUsePacketTimestampForAddedPacket=function(){return t.Message.getBooleanFieldWithDefault(this,6,!1)},proto.mediapipe.ProfilerConfig.prototype.setUsePacketTimestampForAddedPacket=function(e){return t.Message.setProto3BooleanField(this,6,e)},proto.mediapipe.ProfilerConfig.prototype.getTraceLogCapacity=function(){return t.Message.getFieldWithDefault(this,7,0)},proto.mediapipe.ProfilerConfig.prototype.setTraceLogCapacity=function(e){return t.Message.setProto3IntField(this,7,e)},proto.mediapipe.ProfilerConfig.prototype.getTraceEventTypesDisabledList=function(){return t.Message.getRepeatedField(this,8)},proto.mediapipe.ProfilerConfig.prototype.setTraceEventTypesDisabledList=function(e){return t.Message.setField(this,8,e||[])},proto.mediapipe.ProfilerConfig.prototype.addTraceEventTypesDisabled=function(e,r){return t.Message.addToRepeatedField(this,8,e,r)},proto.mediapipe.ProfilerConfig.prototype.clearTraceEventTypesDisabledList=function(){return this.setTraceEventTypesDisabledList([])},proto.mediapipe.ProfilerConfig.prototype.getTraceLogPath=function(){return t.Message.getFieldWithDefault(this,9,"")},proto.mediapipe.ProfilerConfig.prototype.setTraceLogPath=function(e){return t.Message.setProto3StringField(this,9,e)},proto.mediapipe.ProfilerConfig.prototype.getTraceLogCount=function(){return t.Message.getFieldWithDefault(this,10,0)},proto.mediapipe.ProfilerConfig.prototype.setTraceLogCount=function(e){return t.Message.setProto3IntField(this,10,e)},proto.mediapipe.ProfilerConfig.prototype.getTraceLogIntervalUsec=function(){return t.Message.getFieldWithDefault(this,11,0)},proto.mediapipe.ProfilerConfig.prototype.setTraceLogIntervalUsec=function(e){return t.Message.setProto3IntField(this,11,e)},proto.mediapipe.ProfilerConfig.prototype.getTraceLogMarginUsec=function(){return t.Message.getFieldWithDefault(this,12,0)},proto.mediapipe.ProfilerConfig.prototype.setTraceLogMarginUsec=function(e){return t.Message.setProto3IntField(this,12,e)},proto.mediapipe.ProfilerConfig.prototype.getTraceLogDurationEvents=function(){return t.Message.getBooleanFieldWithDefault(this,13,!1)},proto.mediapipe.ProfilerConfig.prototype.setTraceLogDurationEvents=function(e){return t.Message.setProto3BooleanField(this,13,e)},proto.mediapipe.ProfilerConfig.prototype.getTraceLogIntervalCount=function(){return t.Message.getFieldWithDefault(this,14,0)},proto.mediapipe.ProfilerConfig.prototype.setTraceLogIntervalCount=function(e){return t.Message.setProto3IntField(this,14,e)},proto.mediapipe.ProfilerConfig.prototype.getTraceLogDisabled=function(){return t.Message.getBooleanFieldWithDefault(this,15,!1)},proto.mediapipe.ProfilerConfig.prototype.setTraceLogDisabled=function(e){return t.Message.setProto3BooleanField(this,15,e)},proto.mediapipe.ProfilerConfig.prototype.getTraceEnabled=function(){return t.Message.getBooleanFieldWithDefault(this,16,!1)},proto.mediapipe.ProfilerConfig.prototype.setTraceEnabled=function(e){return t.Message.setProto3BooleanField(this,16,e)},proto.mediapipe.ProfilerConfig.prototype.getTraceLogInstantEvents=function(){return t.Message.getBooleanFieldWithDefault(this,17,!1)},proto.mediapipe.ProfilerConfig.prototype.setTraceLogInstantEvents=function(e){return t.Message.setProto3BooleanField(this,17,e)},proto.mediapipe.ProfilerConfig.prototype.getCalculatorFilter=function(){return t.Message.getFieldWithDefault(this,18,"")},proto.mediapipe.ProfilerConfig.prototype.setCalculatorFilter=function(e){return t.Message.setProto3StringField(this,18,e)},proto.mediapipe.CalculatorGraphConfig.repeatedFields_=[1,6,7,9,10,15,16,17,14,1002],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.CalculatorGraphConfig.prototype.toObject=function(e){return proto.mediapipe.CalculatorGraphConfig.toObject(e,this)},proto.mediapipe.CalculatorGraphConfig.toObject=function(e,r){var o,i={nodeList:t.Message.toObjectList(r.getNodeList(),proto.mediapipe.CalculatorGraphConfig.Node.toObject,e),packetFactoryList:t.Message.toObjectList(r.getPacketFactoryList(),s.PacketFactoryConfig.toObject,e),packetGeneratorList:t.Message.toObjectList(r.getPacketGeneratorList(),p.PacketGeneratorConfig.toObject,e),numThreads:t.Message.getFieldWithDefault(r,8,0),statusHandlerList:t.Message.toObjectList(r.getStatusHandlerList(),d.StatusHandlerConfig.toObject,e),inputStreamList:null==(o=t.Message.getRepeatedField(r,10))?void 0:o,outputStreamList:null==(o=t.Message.getRepeatedField(r,15))?void 0:o,inputSidePacketList:null==(o=t.Message.getRepeatedField(r,16))?void 0:o,outputSidePacketList:null==(o=t.Message.getRepeatedField(r,17))?void 0:o,maxQueueSize:t.Message.getFieldWithDefault(r,11,0),reportDeadlock:t.Message.getBooleanFieldWithDefault(r,21,!1),inputStreamHandler:(o=r.getInputStreamHandler())&&l.InputStreamHandlerConfig.toObject(e,o),outputStreamHandler:(o=r.getOutputStreamHandler())&&l.OutputStreamHandlerConfig.toObject(e,o),executorList:t.Message.toObjectList(r.getExecutorList(),proto.mediapipe.ExecutorConfig.toObject,e),profilerConfig:(o=r.getProfilerConfig())&&proto.mediapipe.ProfilerConfig.toObject(e,o),pb_package:t.Message.getFieldWithDefault(r,19,""),type:t.Message.getFieldWithDefault(r,20,""),options:(o=r.getOptions())&&n.MediaPipeOptions.toObject(e,o),graphOptionsList:t.Message.toObjectList(r.getGraphOptionsList(),a.Any.toObject,e)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.CalculatorGraphConfig.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.CalculatorGraphConfig;return proto.mediapipe.CalculatorGraphConfig.deserializeBinaryFromReader(o,r)},proto.mediapipe.CalculatorGraphConfig.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new proto.mediapipe.CalculatorGraphConfig.Node;t.readMessage(r,proto.mediapipe.CalculatorGraphConfig.Node.deserializeBinaryFromReader),e.addNode(r);break;case 6:r=new s.PacketFactoryConfig;t.readMessage(r,s.PacketFactoryConfig.deserializeBinaryFromReader),e.addPacketFactory(r);break;case 7:r=new p.PacketGeneratorConfig;t.readMessage(r,p.PacketGeneratorConfig.deserializeBinaryFromReader),e.addPacketGenerator(r);break;case 8:r=t.readInt32();e.setNumThreads(r);break;case 9:r=new d.StatusHandlerConfig;t.readMessage(r,d.StatusHandlerConfig.deserializeBinaryFromReader),e.addStatusHandler(r);break;case 10:r=t.readString();e.addInputStream(r);break;case 15:r=t.readString();e.addOutputStream(r);break;case 16:r=t.readString();e.addInputSidePacket(r);break;case 17:r=t.readString();e.addOutputSidePacket(r);break;case 11:r=t.readInt32();e.setMaxQueueSize(r);break;case 21:r=t.readBool();e.setReportDeadlock(r);break;case 12:r=new l.InputStreamHandlerConfig;t.readMessage(r,l.InputStreamHandlerConfig.deserializeBinaryFromReader),e.setInputStreamHandler(r);break;case 13:r=new l.OutputStreamHandlerConfig;t.readMessage(r,l.OutputStreamHandlerConfig.deserializeBinaryFromReader),e.setOutputStreamHandler(r);break;case 14:r=new proto.mediapipe.ExecutorConfig;t.readMessage(r,proto.mediapipe.ExecutorConfig.deserializeBinaryFromReader),e.addExecutor(r);break;case 18:r=new proto.mediapipe.ProfilerConfig;t.readMessage(r,proto.mediapipe.ProfilerConfig.deserializeBinaryFromReader),e.setProfilerConfig(r);break;case 19:r=t.readString();e.setPackage(r);break;case 20:r=t.readString();e.setType(r);break;case 1001:r=new n.MediaPipeOptions;t.readMessage(r,n.MediaPipeOptions.deserializeBinaryFromReader),e.setOptions(r);break;case 1002:r=new a.Any;t.readMessage(r,a.Any.deserializeBinaryFromReader),e.addGraphOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.CalculatorGraphConfig.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.CalculatorGraphConfig.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.CalculatorGraphConfig.serializeBinaryToWriter=function(e,t){var r=void 0;(r=e.getNodeList()).length>0&&t.writeRepeatedMessage(1,r,proto.mediapipe.CalculatorGraphConfig.Node.serializeBinaryToWriter),(r=e.getPacketFactoryList()).length>0&&t.writeRepeatedMessage(6,r,s.PacketFactoryConfig.serializeBinaryToWriter),(r=e.getPacketGeneratorList()).length>0&&t.writeRepeatedMessage(7,r,p.PacketGeneratorConfig.serializeBinaryToWriter),0!==(r=e.getNumThreads())&&t.writeInt32(8,r),(r=e.getStatusHandlerList()).length>0&&t.writeRepeatedMessage(9,r,d.StatusHandlerConfig.serializeBinaryToWriter),(r=e.getInputStreamList()).length>0&&t.writeRepeatedString(10,r),(r=e.getOutputStreamList()).length>0&&t.writeRepeatedString(15,r),(r=e.getInputSidePacketList()).length>0&&t.writeRepeatedString(16,r),(r=e.getOutputSidePacketList()).length>0&&t.writeRepeatedString(17,r),0!==(r=e.getMaxQueueSize())&&t.writeInt32(11,r),(r=e.getReportDeadlock())&&t.writeBool(21,r),null!=(r=e.getInputStreamHandler())&&t.writeMessage(12,r,l.InputStreamHandlerConfig.serializeBinaryToWriter),null!=(r=e.getOutputStreamHandler())&&t.writeMessage(13,r,l.OutputStreamHandlerConfig.serializeBinaryToWriter),(r=e.getExecutorList()).length>0&&t.writeRepeatedMessage(14,r,proto.mediapipe.ExecutorConfig.serializeBinaryToWriter),null!=(r=e.getProfilerConfig())&&t.writeMessage(18,r,proto.mediapipe.ProfilerConfig.serializeBinaryToWriter),(r=e.getPackage()).length>0&&t.writeString(19,r),(r=e.getType()).length>0&&t.writeString(20,r),null!=(r=e.getOptions())&&t.writeMessage(1001,r,n.MediaPipeOptions.serializeBinaryToWriter),(r=e.getGraphOptionsList()).length>0&&t.writeRepeatedMessage(1002,r,a.Any.serializeBinaryToWriter)},proto.mediapipe.CalculatorGraphConfig.Node.repeatedFields_=[3,4,5,6,8,13,17,1005],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.CalculatorGraphConfig.Node.prototype.toObject=function(e){return proto.mediapipe.CalculatorGraphConfig.Node.toObject(e,this)},proto.mediapipe.CalculatorGraphConfig.Node.toObject=function(e,r){var o,n={name:t.Message.getFieldWithDefault(r,1,""),calculator:t.Message.getFieldWithDefault(r,2,""),inputStreamList:null==(o=t.Message.getRepeatedField(r,3))?void 0:o,outputStreamList:null==(o=t.Message.getRepeatedField(r,4))?void 0:o,inputSidePacketList:null==(o=t.Message.getRepeatedField(r,5))?void 0:o,outputSidePacketList:null==(o=t.Message.getRepeatedField(r,6))?void 0:o,options:(o=r.getOptions())&&i.CalculatorOptions.toObject(e,o),nodeOptionsList:t.Message.toObjectList(r.getNodeOptionsList(),a.Any.toObject,e),sourceLayer:t.Message.getFieldWithDefault(r,9,0),bufferSizeHint:t.Message.getFieldWithDefault(r,10,0),inputStreamHandler:(o=r.getInputStreamHandler())&&l.InputStreamHandlerConfig.toObject(e,o),outputStreamHandler:(o=r.getOutputStreamHandler())&&l.OutputStreamHandlerConfig.toObject(e,o),inputStreamInfoList:t.Message.toObjectList(r.getInputStreamInfoList(),proto.mediapipe.InputStreamInfo.toObject,e),executor:t.Message.getFieldWithDefault(r,14,""),profilerConfig:(o=r.getProfilerConfig())&&proto.mediapipe.ProfilerConfig.toObject(e,o),maxInFlight:t.Message.getFieldWithDefault(r,16,0),optionValueList:null==(o=t.Message.getRepeatedField(r,17))?void 0:o,externalInputList:null==(o=t.Message.getRepeatedField(r,1005))?void 0:o};return e&&(n.$jspbMessageInstance=r),n}),proto.mediapipe.CalculatorGraphConfig.Node.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.CalculatorGraphConfig.Node;return proto.mediapipe.CalculatorGraphConfig.Node.deserializeBinaryFromReader(o,r)},proto.mediapipe.CalculatorGraphConfig.Node.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setName(r);break;case 2:r=t.readString();e.setCalculator(r);break;case 3:r=t.readString();e.addInputStream(r);break;case 4:r=t.readString();e.addOutputStream(r);break;case 5:r=t.readString();e.addInputSidePacket(r);break;case 6:r=t.readString();e.addOutputSidePacket(r);break;case 7:r=new i.CalculatorOptions;t.readMessage(r,i.CalculatorOptions.deserializeBinaryFromReader),e.setOptions(r);break;case 8:r=new a.Any;t.readMessage(r,a.Any.deserializeBinaryFromReader),e.addNodeOptions(r);break;case 9:r=t.readInt32();e.setSourceLayer(r);break;case 10:r=t.readInt32();e.setBufferSizeHint(r);break;case 11:r=new l.InputStreamHandlerConfig;t.readMessage(r,l.InputStreamHandlerConfig.deserializeBinaryFromReader),e.setInputStreamHandler(r);break;case 12:r=new l.OutputStreamHandlerConfig;t.readMessage(r,l.OutputStreamHandlerConfig.deserializeBinaryFromReader),e.setOutputStreamHandler(r);break;case 13:r=new proto.mediapipe.InputStreamInfo;t.readMessage(r,proto.mediapipe.InputStreamInfo.deserializeBinaryFromReader),e.addInputStreamInfo(r);break;case 14:r=t.readString();e.setExecutor(r);break;case 15:r=new proto.mediapipe.ProfilerConfig;t.readMessage(r,proto.mediapipe.ProfilerConfig.deserializeBinaryFromReader),e.setProfilerConfig(r);break;case 16:r=t.readInt32();e.setMaxInFlight(r);break;case 17:r=t.readString();e.addOptionValue(r);break;case 1005:r=t.readString();e.addExternalInput(r);break;default:t.skipField()}}return e},proto.mediapipe.CalculatorGraphConfig.Node.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.CalculatorGraphConfig.Node.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.CalculatorGraphConfig.Node.serializeBinaryToWriter=function(e,t){var r=void 0;(r=e.getName()).length>0&&t.writeString(1,r),(r=e.getCalculator()).length>0&&t.writeString(2,r),(r=e.getInputStreamList()).length>0&&t.writeRepeatedString(3,r),(r=e.getOutputStreamList()).length>0&&t.writeRepeatedString(4,r),(r=e.getInputSidePacketList()).length>0&&t.writeRepeatedString(5,r),(r=e.getOutputSidePacketList()).length>0&&t.writeRepeatedString(6,r),null!=(r=e.getOptions())&&t.writeMessage(7,r,i.CalculatorOptions.serializeBinaryToWriter),(r=e.getNodeOptionsList()).length>0&&t.writeRepeatedMessage(8,r,a.Any.serializeBinaryToWriter),0!==(r=e.getSourceLayer())&&t.writeInt32(9,r),0!==(r=e.getBufferSizeHint())&&t.writeInt32(10,r),null!=(r=e.getInputStreamHandler())&&t.writeMessage(11,r,l.InputStreamHandlerConfig.serializeBinaryToWriter),null!=(r=e.getOutputStreamHandler())&&t.writeMessage(12,r,l.OutputStreamHandlerConfig.serializeBinaryToWriter),(r=e.getInputStreamInfoList()).length>0&&t.writeRepeatedMessage(13,r,proto.mediapipe.InputStreamInfo.serializeBinaryToWriter),(r=e.getExecutor()).length>0&&t.writeString(14,r),null!=(r=e.getProfilerConfig())&&t.writeMessage(15,r,proto.mediapipe.ProfilerConfig.serializeBinaryToWriter),0!==(r=e.getMaxInFlight())&&t.writeInt32(16,r),(r=e.getOptionValueList()).length>0&&t.writeRepeatedString(17,r),(r=e.getExternalInputList()).length>0&&t.writeRepeatedString(1005,r)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getName=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setName=function(e){return t.Message.setProto3StringField(this,1,e)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getCalculator=function(){return t.Message.getFieldWithDefault(this,2,"")},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setCalculator=function(e){return t.Message.setProto3StringField(this,2,e)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getInputStreamList=function(){return t.Message.getRepeatedField(this,3)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setInputStreamList=function(e){return t.Message.setField(this,3,e||[])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.addInputStream=function(e,r){return t.Message.addToRepeatedField(this,3,e,r)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.clearInputStreamList=function(){return this.setInputStreamList([])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getOutputStreamList=function(){return t.Message.getRepeatedField(this,4)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setOutputStreamList=function(e){return t.Message.setField(this,4,e||[])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.addOutputStream=function(e,r){return t.Message.addToRepeatedField(this,4,e,r)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.clearOutputStreamList=function(){return this.setOutputStreamList([])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getInputSidePacketList=function(){return t.Message.getRepeatedField(this,5)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setInputSidePacketList=function(e){return t.Message.setField(this,5,e||[])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.addInputSidePacket=function(e,r){return t.Message.addToRepeatedField(this,5,e,r)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.clearInputSidePacketList=function(){return this.setInputSidePacketList([])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getOutputSidePacketList=function(){return t.Message.getRepeatedField(this,6)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setOutputSidePacketList=function(e){return t.Message.setField(this,6,e||[])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.addOutputSidePacket=function(e,r){return t.Message.addToRepeatedField(this,6,e,r)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.clearOutputSidePacketList=function(){return this.setOutputSidePacketList([])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getOptions=function(){return t.Message.getWrapperField(this,i.CalculatorOptions,7)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setOptions=function(e){return t.Message.setWrapperField(this,7,e)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.clearOptions=function(){return this.setOptions(void 0)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.hasOptions=function(){return null!=t.Message.getField(this,7)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getNodeOptionsList=function(){return t.Message.getRepeatedWrapperField(this,a.Any,8)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setNodeOptionsList=function(e){return t.Message.setRepeatedWrapperField(this,8,e)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.addNodeOptions=function(e,r){return t.Message.addToRepeatedWrapperField(this,8,e,proto.google.protobuf.Any,r)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.clearNodeOptionsList=function(){return this.setNodeOptionsList([])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getSourceLayer=function(){return t.Message.getFieldWithDefault(this,9,0)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setSourceLayer=function(e){return t.Message.setProto3IntField(this,9,e)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getBufferSizeHint=function(){return t.Message.getFieldWithDefault(this,10,0)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setBufferSizeHint=function(e){return t.Message.setProto3IntField(this,10,e)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getInputStreamHandler=function(){return t.Message.getWrapperField(this,l.InputStreamHandlerConfig,11)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setInputStreamHandler=function(e){return t.Message.setWrapperField(this,11,e)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.clearInputStreamHandler=function(){return this.setInputStreamHandler(void 0)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.hasInputStreamHandler=function(){return null!=t.Message.getField(this,11)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getOutputStreamHandler=function(){return t.Message.getWrapperField(this,l.OutputStreamHandlerConfig,12)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setOutputStreamHandler=function(e){return t.Message.setWrapperField(this,12,e)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.clearOutputStreamHandler=function(){return this.setOutputStreamHandler(void 0)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.hasOutputStreamHandler=function(){return null!=t.Message.getField(this,12)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getInputStreamInfoList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.InputStreamInfo,13)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setInputStreamInfoList=function(e){return t.Message.setRepeatedWrapperField(this,13,e)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.addInputStreamInfo=function(e,r){return t.Message.addToRepeatedWrapperField(this,13,e,proto.mediapipe.InputStreamInfo,r)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.clearInputStreamInfoList=function(){return this.setInputStreamInfoList([])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getExecutor=function(){return t.Message.getFieldWithDefault(this,14,"")},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setExecutor=function(e){return t.Message.setProto3StringField(this,14,e)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getProfilerConfig=function(){return t.Message.getWrapperField(this,proto.mediapipe.ProfilerConfig,15)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setProfilerConfig=function(e){return t.Message.setWrapperField(this,15,e)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.clearProfilerConfig=function(){return this.setProfilerConfig(void 0)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.hasProfilerConfig=function(){return null!=t.Message.getField(this,15)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getMaxInFlight=function(){return t.Message.getFieldWithDefault(this,16,0)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setMaxInFlight=function(e){return t.Message.setProto3IntField(this,16,e)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getOptionValueList=function(){return t.Message.getRepeatedField(this,17)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setOptionValueList=function(e){return t.Message.setField(this,17,e||[])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.addOptionValue=function(e,r){return t.Message.addToRepeatedField(this,17,e,r)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.clearOptionValueList=function(){return this.setOptionValueList([])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getExternalInputList=function(){return t.Message.getRepeatedField(this,1005)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setExternalInputList=function(e){return t.Message.setField(this,1005,e||[])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.addExternalInput=function(e,r){return t.Message.addToRepeatedField(this,1005,e,r)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.clearExternalInputList=function(){return this.setExternalInputList([])},proto.mediapipe.CalculatorGraphConfig.prototype.getNodeList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.CalculatorGraphConfig.Node,1)},proto.mediapipe.CalculatorGraphConfig.prototype.setNodeList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.CalculatorGraphConfig.prototype.addNode=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.CalculatorGraphConfig.Node,r)},proto.mediapipe.CalculatorGraphConfig.prototype.clearNodeList=function(){return this.setNodeList([])},proto.mediapipe.CalculatorGraphConfig.prototype.getPacketFactoryList=function(){return t.Message.getRepeatedWrapperField(this,s.PacketFactoryConfig,6)},proto.mediapipe.CalculatorGraphConfig.prototype.setPacketFactoryList=function(e){return t.Message.setRepeatedWrapperField(this,6,e)},proto.mediapipe.CalculatorGraphConfig.prototype.addPacketFactory=function(e,r){return t.Message.addToRepeatedWrapperField(this,6,e,proto.mediapipe.PacketFactoryConfig,r)},proto.mediapipe.CalculatorGraphConfig.prototype.clearPacketFactoryList=function(){return this.setPacketFactoryList([])},proto.mediapipe.CalculatorGraphConfig.prototype.getPacketGeneratorList=function(){return t.Message.getRepeatedWrapperField(this,p.PacketGeneratorConfig,7)},proto.mediapipe.CalculatorGraphConfig.prototype.setPacketGeneratorList=function(e){return t.Message.setRepeatedWrapperField(this,7,e)},proto.mediapipe.CalculatorGraphConfig.prototype.addPacketGenerator=function(e,r){return t.Message.addToRepeatedWrapperField(this,7,e,proto.mediapipe.PacketGeneratorConfig,r)},proto.mediapipe.CalculatorGraphConfig.prototype.clearPacketGeneratorList=function(){return this.setPacketGeneratorList([])},proto.mediapipe.CalculatorGraphConfig.prototype.getNumThreads=function(){return t.Message.getFieldWithDefault(this,8,0)},proto.mediapipe.CalculatorGraphConfig.prototype.setNumThreads=function(e){return t.Message.setProto3IntField(this,8,e)},proto.mediapipe.CalculatorGraphConfig.prototype.getStatusHandlerList=function(){return t.Message.getRepeatedWrapperField(this,d.StatusHandlerConfig,9)},proto.mediapipe.CalculatorGraphConfig.prototype.setStatusHandlerList=function(e){return t.Message.setRepeatedWrapperField(this,9,e)},proto.mediapipe.CalculatorGraphConfig.prototype.addStatusHandler=function(e,r){return t.Message.addToRepeatedWrapperField(this,9,e,proto.mediapipe.StatusHandlerConfig,r)},proto.mediapipe.CalculatorGraphConfig.prototype.clearStatusHandlerList=function(){return this.setStatusHandlerList([])},proto.mediapipe.CalculatorGraphConfig.prototype.getInputStreamList=function(){return t.Message.getRepeatedField(this,10)},proto.mediapipe.CalculatorGraphConfig.prototype.setInputStreamList=function(e){return t.Message.setField(this,10,e||[])},proto.mediapipe.CalculatorGraphConfig.prototype.addInputStream=function(e,r){return t.Message.addToRepeatedField(this,10,e,r)},proto.mediapipe.CalculatorGraphConfig.prototype.clearInputStreamList=function(){return this.setInputStreamList([])},proto.mediapipe.CalculatorGraphConfig.prototype.getOutputStreamList=function(){return t.Message.getRepeatedField(this,15)},proto.mediapipe.CalculatorGraphConfig.prototype.setOutputStreamList=function(e){return t.Message.setField(this,15,e||[])},proto.mediapipe.CalculatorGraphConfig.prototype.addOutputStream=function(e,r){return t.Message.addToRepeatedField(this,15,e,r)},proto.mediapipe.CalculatorGraphConfig.prototype.clearOutputStreamList=function(){return this.setOutputStreamList([])},proto.mediapipe.CalculatorGraphConfig.prototype.getInputSidePacketList=function(){return t.Message.getRepeatedField(this,16)},proto.mediapipe.CalculatorGraphConfig.prototype.setInputSidePacketList=function(e){return t.Message.setField(this,16,e||[])},proto.mediapipe.CalculatorGraphConfig.prototype.addInputSidePacket=function(e,r){return t.Message.addToRepeatedField(this,16,e,r)},proto.mediapipe.CalculatorGraphConfig.prototype.clearInputSidePacketList=function(){return this.setInputSidePacketList([])},proto.mediapipe.CalculatorGraphConfig.prototype.getOutputSidePacketList=function(){return t.Message.getRepeatedField(this,17)},proto.mediapipe.CalculatorGraphConfig.prototype.setOutputSidePacketList=function(e){return t.Message.setField(this,17,e||[])},proto.mediapipe.CalculatorGraphConfig.prototype.addOutputSidePacket=function(e,r){return t.Message.addToRepeatedField(this,17,e,r)},proto.mediapipe.CalculatorGraphConfig.prototype.clearOutputSidePacketList=function(){return this.setOutputSidePacketList([])},proto.mediapipe.CalculatorGraphConfig.prototype.getMaxQueueSize=function(){return t.Message.getFieldWithDefault(this,11,0)},proto.mediapipe.CalculatorGraphConfig.prototype.setMaxQueueSize=function(e){return t.Message.setProto3IntField(this,11,e)},proto.mediapipe.CalculatorGraphConfig.prototype.getReportDeadlock=function(){return t.Message.getBooleanFieldWithDefault(this,21,!1)},proto.mediapipe.CalculatorGraphConfig.prototype.setReportDeadlock=function(e){return t.Message.setProto3BooleanField(this,21,e)},proto.mediapipe.CalculatorGraphConfig.prototype.getInputStreamHandler=function(){return t.Message.getWrapperField(this,l.InputStreamHandlerConfig,12)},proto.mediapipe.CalculatorGraphConfig.prototype.setInputStreamHandler=function(e){return t.Message.setWrapperField(this,12,e)},proto.mediapipe.CalculatorGraphConfig.prototype.clearInputStreamHandler=function(){return this.setInputStreamHandler(void 0)},proto.mediapipe.CalculatorGraphConfig.prototype.hasInputStreamHandler=function(){return null!=t.Message.getField(this,12)},proto.mediapipe.CalculatorGraphConfig.prototype.getOutputStreamHandler=function(){return t.Message.getWrapperField(this,l.OutputStreamHandlerConfig,13)},proto.mediapipe.CalculatorGraphConfig.prototype.setOutputStreamHandler=function(e){return t.Message.setWrapperField(this,13,e)},proto.mediapipe.CalculatorGraphConfig.prototype.clearOutputStreamHandler=function(){return this.setOutputStreamHandler(void 0)},proto.mediapipe.CalculatorGraphConfig.prototype.hasOutputStreamHandler=function(){return null!=t.Message.getField(this,13)},proto.mediapipe.CalculatorGraphConfig.prototype.getExecutorList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.ExecutorConfig,14)},proto.mediapipe.CalculatorGraphConfig.prototype.setExecutorList=function(e){return t.Message.setRepeatedWrapperField(this,14,e)},proto.mediapipe.CalculatorGraphConfig.prototype.addExecutor=function(e,r){return t.Message.addToRepeatedWrapperField(this,14,e,proto.mediapipe.ExecutorConfig,r)},proto.mediapipe.CalculatorGraphConfig.prototype.clearExecutorList=function(){return this.setExecutorList([])},proto.mediapipe.CalculatorGraphConfig.prototype.getProfilerConfig=function(){return t.Message.getWrapperField(this,proto.mediapipe.ProfilerConfig,18)},proto.mediapipe.CalculatorGraphConfig.prototype.setProfilerConfig=function(e){return t.Message.setWrapperField(this,18,e)},proto.mediapipe.CalculatorGraphConfig.prototype.clearProfilerConfig=function(){return this.setProfilerConfig(void 0)},proto.mediapipe.CalculatorGraphConfig.prototype.hasProfilerConfig=function(){return null!=t.Message.getField(this,18)},proto.mediapipe.CalculatorGraphConfig.prototype.getPackage=function(){return t.Message.getFieldWithDefault(this,19,"")},proto.mediapipe.CalculatorGraphConfig.prototype.setPackage=function(e){return t.Message.setProto3StringField(this,19,e)},proto.mediapipe.CalculatorGraphConfig.prototype.getType=function(){return t.Message.getFieldWithDefault(this,20,"")},proto.mediapipe.CalculatorGraphConfig.prototype.setType=function(e){return t.Message.setProto3StringField(this,20,e)},proto.mediapipe.CalculatorGraphConfig.prototype.getOptions=function(){return t.Message.getWrapperField(this,n.MediaPipeOptions,1001)},proto.mediapipe.CalculatorGraphConfig.prototype.setOptions=function(e){return t.Message.setWrapperField(this,1001,e)},proto.mediapipe.CalculatorGraphConfig.prototype.clearOptions=function(){return this.setOptions(void 0)},proto.mediapipe.CalculatorGraphConfig.prototype.hasOptions=function(){return null!=t.Message.getField(this,1001)},proto.mediapipe.CalculatorGraphConfig.prototype.getGraphOptionsList=function(){return t.Message.getRepeatedWrapperField(this,a.Any,1002)},proto.mediapipe.CalculatorGraphConfig.prototype.setGraphOptionsList=function(e){return t.Message.setRepeatedWrapperField(this,1002,e)},proto.mediapipe.CalculatorGraphConfig.prototype.addGraphOptions=function(e,r){return t.Message.addToRepeatedWrapperField(this,1002,e,proto.google.protobuf.Any,r)},proto.mediapipe.CalculatorGraphConfig.prototype.clearGraphOptionsList=function(){return this.setGraphOptionsList([])},r.object.extend(e,proto.mediapipe)}(calculator_pb);var detection_pb={},location_data_pb={},rasterization_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.Rasterization",null,o),r.exportSymbol("proto.mediapipe.Rasterization.Interval",null,o),proto.mediapipe.Rasterization=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.Rasterization.repeatedFields_,null)},r.inherits(proto.mediapipe.Rasterization,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.Rasterization.displayName="proto.mediapipe.Rasterization"),proto.mediapipe.Rasterization.Interval=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.Rasterization.Interval,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.Rasterization.Interval.displayName="proto.mediapipe.Rasterization.Interval"),proto.mediapipe.Rasterization.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.Rasterization.prototype.toObject=function(e){return proto.mediapipe.Rasterization.toObject(e,this)},proto.mediapipe.Rasterization.toObject=function(e,r){var o={intervalList:t.Message.toObjectList(r.getIntervalList(),proto.mediapipe.Rasterization.Interval.toObject,e)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.Rasterization.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.Rasterization;return proto.mediapipe.Rasterization.deserializeBinaryFromReader(o,r)},proto.mediapipe.Rasterization.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new proto.mediapipe.Rasterization.Interval;t.readMessage(r,proto.mediapipe.Rasterization.Interval.deserializeBinaryFromReader),e.addInterval(r)}else t.skipField()}return e},proto.mediapipe.Rasterization.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.Rasterization.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.Rasterization.serializeBinaryToWriter=function(e,t){var r;(r=e.getIntervalList()).length>0&&t.writeRepeatedMessage(1,r,proto.mediapipe.Rasterization.Interval.serializeBinaryToWriter)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.Rasterization.Interval.prototype.toObject=function(e){return proto.mediapipe.Rasterization.Interval.toObject(e,this)},proto.mediapipe.Rasterization.Interval.toObject=function(e,r){var o,i={y:null==(o=t.Message.getField(r,1))?void 0:o,leftX:null==(o=t.Message.getField(r,2))?void 0:o,rightX:null==(o=t.Message.getField(r,3))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.Rasterization.Interval.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.Rasterization.Interval;return proto.mediapipe.Rasterization.Interval.deserializeBinaryFromReader(o,r)},proto.mediapipe.Rasterization.Interval.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readInt32();e.setY(r);break;case 2:r=t.readInt32();e.setLeftX(r);break;case 3:r=t.readInt32();e.setRightX(r);break;default:t.skipField()}}return e},proto.mediapipe.Rasterization.Interval.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.Rasterization.Interval.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.Rasterization.Interval.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeInt32(1,o),null!=(o=t.Message.getField(e,2))&&r.writeInt32(2,o),null!=(o=t.Message.getField(e,3))&&r.writeInt32(3,o)},proto.mediapipe.Rasterization.Interval.prototype.getY=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.Rasterization.Interval.prototype.setY=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.Rasterization.Interval.prototype.clearY=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.Rasterization.Interval.prototype.hasY=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.Rasterization.Interval.prototype.getLeftX=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.Rasterization.Interval.prototype.setLeftX=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.Rasterization.Interval.prototype.clearLeftX=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.Rasterization.Interval.prototype.hasLeftX=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.Rasterization.Interval.prototype.getRightX=function(){return t.Message.getFieldWithDefault(this,3,0)},proto.mediapipe.Rasterization.Interval.prototype.setRightX=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.Rasterization.Interval.prototype.clearRightX=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.Rasterization.Interval.prototype.hasRightX=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.Rasterization.prototype.getIntervalList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.Rasterization.Interval,1)},proto.mediapipe.Rasterization.prototype.setIntervalList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.Rasterization.prototype.addInterval=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.Rasterization.Interval,r)},proto.mediapipe.Rasterization.prototype.clearIntervalList=function(){return this.setIntervalList([])},r.object.extend(e,proto.mediapipe)}(rasterization_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=rasterization_pb;r.object.extend(proto,i),r.exportSymbol("proto.mediapipe.LocationData",null,o),r.exportSymbol("proto.mediapipe.LocationData.BinaryMask",null,o),r.exportSymbol("proto.mediapipe.LocationData.BoundingBox",null,o),r.exportSymbol("proto.mediapipe.LocationData.Format",null,o),r.exportSymbol("proto.mediapipe.LocationData.RelativeBoundingBox",null,o),r.exportSymbol("proto.mediapipe.LocationData.RelativeKeypoint",null,o),proto.mediapipe.LocationData=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.LocationData.repeatedFields_,null)},r.inherits(proto.mediapipe.LocationData,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.LocationData.displayName="proto.mediapipe.LocationData"),proto.mediapipe.LocationData.BoundingBox=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.LocationData.BoundingBox,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.LocationData.BoundingBox.displayName="proto.mediapipe.LocationData.BoundingBox"),proto.mediapipe.LocationData.RelativeBoundingBox=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.LocationData.RelativeBoundingBox,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.LocationData.RelativeBoundingBox.displayName="proto.mediapipe.LocationData.RelativeBoundingBox"),proto.mediapipe.LocationData.BinaryMask=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.LocationData.BinaryMask,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.LocationData.BinaryMask.displayName="proto.mediapipe.LocationData.BinaryMask"),proto.mediapipe.LocationData.RelativeKeypoint=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.LocationData.RelativeKeypoint,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.LocationData.RelativeKeypoint.displayName="proto.mediapipe.LocationData.RelativeKeypoint"),proto.mediapipe.LocationData.repeatedFields_=[5],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.LocationData.prototype.toObject=function(e){return proto.mediapipe.LocationData.toObject(e,this)},proto.mediapipe.LocationData.toObject=function(e,r){var o,i={format:null==(o=t.Message.getField(r,1))?void 0:o,boundingBox:(o=r.getBoundingBox())&&proto.mediapipe.LocationData.BoundingBox.toObject(e,o),relativeBoundingBox:(o=r.getRelativeBoundingBox())&&proto.mediapipe.LocationData.RelativeBoundingBox.toObject(e,o),mask:(o=r.getMask())&&proto.mediapipe.LocationData.BinaryMask.toObject(e,o),relativeKeypointsList:t.Message.toObjectList(r.getRelativeKeypointsList(),proto.mediapipe.LocationData.RelativeKeypoint.toObject,e)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.LocationData.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.LocationData;return proto.mediapipe.LocationData.deserializeBinaryFromReader(o,r)},proto.mediapipe.LocationData.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readEnum();e.setFormat(r);break;case 2:r=new proto.mediapipe.LocationData.BoundingBox;t.readMessage(r,proto.mediapipe.LocationData.BoundingBox.deserializeBinaryFromReader),e.setBoundingBox(r);break;case 3:r=new proto.mediapipe.LocationData.RelativeBoundingBox;t.readMessage(r,proto.mediapipe.LocationData.RelativeBoundingBox.deserializeBinaryFromReader),e.setRelativeBoundingBox(r);break;case 4:r=new proto.mediapipe.LocationData.BinaryMask;t.readMessage(r,proto.mediapipe.LocationData.BinaryMask.deserializeBinaryFromReader),e.setMask(r);break;case 5:r=new proto.mediapipe.LocationData.RelativeKeypoint;t.readMessage(r,proto.mediapipe.LocationData.RelativeKeypoint.deserializeBinaryFromReader),e.addRelativeKeypoints(r);break;default:t.skipField()}}return e},proto.mediapipe.LocationData.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.LocationData.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.LocationData.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeEnum(1,o),null!=(o=e.getBoundingBox())&&r.writeMessage(2,o,proto.mediapipe.LocationData.BoundingBox.serializeBinaryToWriter),null!=(o=e.getRelativeBoundingBox())&&r.writeMessage(3,o,proto.mediapipe.LocationData.RelativeBoundingBox.serializeBinaryToWriter),null!=(o=e.getMask())&&r.writeMessage(4,o,proto.mediapipe.LocationData.BinaryMask.serializeBinaryToWriter),(o=e.getRelativeKeypointsList()).length>0&&r.writeRepeatedMessage(5,o,proto.mediapipe.LocationData.RelativeKeypoint.serializeBinaryToWriter)},proto.mediapipe.LocationData.Format={GLOBAL:0,BOUNDING_BOX:1,RELATIVE_BOUNDING_BOX:2,MASK:3},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.LocationData.BoundingBox.prototype.toObject=function(e){return proto.mediapipe.LocationData.BoundingBox.toObject(e,this)},proto.mediapipe.LocationData.BoundingBox.toObject=function(e,r){var o,i={xmin:null==(o=t.Message.getField(r,1))?void 0:o,ymin:null==(o=t.Message.getField(r,2))?void 0:o,width:null==(o=t.Message.getField(r,3))?void 0:o,height:null==(o=t.Message.getField(r,4))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.LocationData.BoundingBox.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.LocationData.BoundingBox;return proto.mediapipe.LocationData.BoundingBox.deserializeBinaryFromReader(o,r)},proto.mediapipe.LocationData.BoundingBox.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readInt32();e.setXmin(r);break;case 2:r=t.readInt32();e.setYmin(r);break;case 3:r=t.readInt32();e.setWidth(r);break;case 4:r=t.readInt32();e.setHeight(r);break;default:t.skipField()}}return e},proto.mediapipe.LocationData.BoundingBox.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.LocationData.BoundingBox.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.LocationData.BoundingBox.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeInt32(1,o),null!=(o=t.Message.getField(e,2))&&r.writeInt32(2,o),null!=(o=t.Message.getField(e,3))&&r.writeInt32(3,o),null!=(o=t.Message.getField(e,4))&&r.writeInt32(4,o)},proto.mediapipe.LocationData.BoundingBox.prototype.getXmin=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.LocationData.BoundingBox.prototype.setXmin=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.LocationData.BoundingBox.prototype.clearXmin=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.LocationData.BoundingBox.prototype.hasXmin=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.LocationData.BoundingBox.prototype.getYmin=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.LocationData.BoundingBox.prototype.setYmin=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.LocationData.BoundingBox.prototype.clearYmin=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.LocationData.BoundingBox.prototype.hasYmin=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.LocationData.BoundingBox.prototype.getWidth=function(){return t.Message.getFieldWithDefault(this,3,0)},proto.mediapipe.LocationData.BoundingBox.prototype.setWidth=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.LocationData.BoundingBox.prototype.clearWidth=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.LocationData.BoundingBox.prototype.hasWidth=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.LocationData.BoundingBox.prototype.getHeight=function(){return t.Message.getFieldWithDefault(this,4,0)},proto.mediapipe.LocationData.BoundingBox.prototype.setHeight=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.LocationData.BoundingBox.prototype.clearHeight=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.LocationData.BoundingBox.prototype.hasHeight=function(){return null!=t.Message.getField(this,4)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.LocationData.RelativeBoundingBox.prototype.toObject=function(e){return proto.mediapipe.LocationData.RelativeBoundingBox.toObject(e,this)},proto.mediapipe.LocationData.RelativeBoundingBox.toObject=function(e,r){var o,i={xmin:null==(o=t.Message.getOptionalFloatingPointField(r,1))?void 0:o,ymin:null==(o=t.Message.getOptionalFloatingPointField(r,2))?void 0:o,width:null==(o=t.Message.getOptionalFloatingPointField(r,3))?void 0:o,height:null==(o=t.Message.getOptionalFloatingPointField(r,4))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.LocationData.RelativeBoundingBox.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.LocationData.RelativeBoundingBox;return proto.mediapipe.LocationData.RelativeBoundingBox.deserializeBinaryFromReader(o,r)},proto.mediapipe.LocationData.RelativeBoundingBox.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readFloat();e.setXmin(r);break;case 2:r=t.readFloat();e.setYmin(r);break;case 3:r=t.readFloat();e.setWidth(r);break;case 4:r=t.readFloat();e.setHeight(r);break;default:t.skipField()}}return e},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.LocationData.RelativeBoundingBox.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.LocationData.RelativeBoundingBox.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeFloat(1,o),null!=(o=t.Message.getField(e,2))&&r.writeFloat(2,o),null!=(o=t.Message.getField(e,3))&&r.writeFloat(3,o),null!=(o=t.Message.getField(e,4))&&r.writeFloat(4,o)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.getXmin=function(){return t.Message.getFloatingPointFieldWithDefault(this,1,0)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.setXmin=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.clearXmin=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.hasXmin=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.getYmin=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,0)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.setYmin=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.clearYmin=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.hasYmin=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.getWidth=function(){return t.Message.getFloatingPointFieldWithDefault(this,3,0)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.setWidth=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.clearWidth=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.hasWidth=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.getHeight=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,0)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.setHeight=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.clearHeight=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.hasHeight=function(){return null!=t.Message.getField(this,4)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.LocationData.BinaryMask.prototype.toObject=function(e){return proto.mediapipe.LocationData.BinaryMask.toObject(e,this)},proto.mediapipe.LocationData.BinaryMask.toObject=function(e,r){var o,a={width:null==(o=t.Message.getField(r,1))?void 0:o,height:null==(o=t.Message.getField(r,2))?void 0:o,rasterization:(o=r.getRasterization())&&i.Rasterization.toObject(e,o)};return e&&(a.$jspbMessageInstance=r),a}),proto.mediapipe.LocationData.BinaryMask.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.LocationData.BinaryMask;return proto.mediapipe.LocationData.BinaryMask.deserializeBinaryFromReader(o,r)},proto.mediapipe.LocationData.BinaryMask.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readInt32();e.setWidth(r);break;case 2:r=t.readInt32();e.setHeight(r);break;case 3:r=new i.Rasterization;t.readMessage(r,i.Rasterization.deserializeBinaryFromReader),e.setRasterization(r);break;default:t.skipField()}}return e},proto.mediapipe.LocationData.BinaryMask.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.LocationData.BinaryMask.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.LocationData.BinaryMask.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeInt32(1,o),null!=(o=t.Message.getField(e,2))&&r.writeInt32(2,o),null!=(o=e.getRasterization())&&r.writeMessage(3,o,i.Rasterization.serializeBinaryToWriter)},proto.mediapipe.LocationData.BinaryMask.prototype.getWidth=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.LocationData.BinaryMask.prototype.setWidth=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.LocationData.BinaryMask.prototype.clearWidth=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.LocationData.BinaryMask.prototype.hasWidth=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.LocationData.BinaryMask.prototype.getHeight=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.LocationData.BinaryMask.prototype.setHeight=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.LocationData.BinaryMask.prototype.clearHeight=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.LocationData.BinaryMask.prototype.hasHeight=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.LocationData.BinaryMask.prototype.getRasterization=function(){return t.Message.getWrapperField(this,i.Rasterization,3)},proto.mediapipe.LocationData.BinaryMask.prototype.setRasterization=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.LocationData.BinaryMask.prototype.clearRasterization=function(){return this.setRasterization(void 0)},proto.mediapipe.LocationData.BinaryMask.prototype.hasRasterization=function(){return null!=t.Message.getField(this,3)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.LocationData.RelativeKeypoint.prototype.toObject=function(e){return proto.mediapipe.LocationData.RelativeKeypoint.toObject(e,this)},proto.mediapipe.LocationData.RelativeKeypoint.toObject=function(e,r){var o,i={x:null==(o=t.Message.getOptionalFloatingPointField(r,1))?void 0:o,y:null==(o=t.Message.getOptionalFloatingPointField(r,2))?void 0:o,keypointLabel:null==(o=t.Message.getField(r,3))?void 0:o,score:null==(o=t.Message.getOptionalFloatingPointField(r,4))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.LocationData.RelativeKeypoint.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.LocationData.RelativeKeypoint;return proto.mediapipe.LocationData.RelativeKeypoint.deserializeBinaryFromReader(o,r)},proto.mediapipe.LocationData.RelativeKeypoint.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readFloat();e.setX(r);break;case 2:r=t.readFloat();e.setY(r);break;case 3:r=t.readString();e.setKeypointLabel(r);break;case 4:r=t.readFloat();e.setScore(r);break;default:t.skipField()}}return e},proto.mediapipe.LocationData.RelativeKeypoint.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.LocationData.RelativeKeypoint.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.LocationData.RelativeKeypoint.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeFloat(1,o),null!=(o=t.Message.getField(e,2))&&r.writeFloat(2,o),null!=(o=t.Message.getField(e,3))&&r.writeString(3,o),null!=(o=t.Message.getField(e,4))&&r.writeFloat(4,o)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.getX=function(){return t.Message.getFloatingPointFieldWithDefault(this,1,0)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.setX=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.clearX=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.hasX=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.getY=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,0)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.setY=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.clearY=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.hasY=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.getKeypointLabel=function(){return t.Message.getFieldWithDefault(this,3,"")},proto.mediapipe.LocationData.RelativeKeypoint.prototype.setKeypointLabel=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.clearKeypointLabel=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.hasKeypointLabel=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.getScore=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,0)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.setScore=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.clearScore=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.hasScore=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.LocationData.prototype.getFormat=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.LocationData.prototype.setFormat=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.LocationData.prototype.clearFormat=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.LocationData.prototype.hasFormat=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.LocationData.prototype.getBoundingBox=function(){return t.Message.getWrapperField(this,proto.mediapipe.LocationData.BoundingBox,2)},proto.mediapipe.LocationData.prototype.setBoundingBox=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.LocationData.prototype.clearBoundingBox=function(){return this.setBoundingBox(void 0)},proto.mediapipe.LocationData.prototype.hasBoundingBox=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.LocationData.prototype.getRelativeBoundingBox=function(){return t.Message.getWrapperField(this,proto.mediapipe.LocationData.RelativeBoundingBox,3)},proto.mediapipe.LocationData.prototype.setRelativeBoundingBox=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.LocationData.prototype.clearRelativeBoundingBox=function(){return this.setRelativeBoundingBox(void 0)},proto.mediapipe.LocationData.prototype.hasRelativeBoundingBox=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.LocationData.prototype.getMask=function(){return t.Message.getWrapperField(this,proto.mediapipe.LocationData.BinaryMask,4)},proto.mediapipe.LocationData.prototype.setMask=function(e){return t.Message.setWrapperField(this,4,e)},proto.mediapipe.LocationData.prototype.clearMask=function(){return this.setMask(void 0)},proto.mediapipe.LocationData.prototype.hasMask=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.LocationData.prototype.getRelativeKeypointsList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.LocationData.RelativeKeypoint,5)},proto.mediapipe.LocationData.prototype.setRelativeKeypointsList=function(e){return t.Message.setRepeatedWrapperField(this,5,e)},proto.mediapipe.LocationData.prototype.addRelativeKeypoints=function(e,r){return t.Message.addToRepeatedWrapperField(this,5,e,proto.mediapipe.LocationData.RelativeKeypoint,r)},proto.mediapipe.LocationData.prototype.clearRelativeKeypointsList=function(){return this.setRelativeKeypointsList([])},r.object.extend(e,proto.mediapipe)}(location_data_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=location_data_pb;r.object.extend(proto,i),r.exportSymbol("proto.mediapipe.Detection",null,o),r.exportSymbol("proto.mediapipe.Detection.AssociatedDetection",null,o),r.exportSymbol("proto.mediapipe.DetectionList",null,o),proto.mediapipe.Detection=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.Detection.repeatedFields_,null)},r.inherits(proto.mediapipe.Detection,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.Detection.displayName="proto.mediapipe.Detection"),proto.mediapipe.Detection.AssociatedDetection=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.Detection.AssociatedDetection,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.Detection.AssociatedDetection.displayName="proto.mediapipe.Detection.AssociatedDetection"),proto.mediapipe.DetectionList=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.DetectionList.repeatedFields_,null)},r.inherits(proto.mediapipe.DetectionList,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.DetectionList.displayName="proto.mediapipe.DetectionList"),proto.mediapipe.Detection.repeatedFields_=[1,2,3,8,9],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.Detection.prototype.toObject=function(e){return proto.mediapipe.Detection.toObject(e,this)},proto.mediapipe.Detection.toObject=function(e,r){var o,a={labelList:null==(o=t.Message.getRepeatedField(r,1))?void 0:o,labelIdList:null==(o=t.Message.getRepeatedField(r,2))?void 0:o,scoreList:null==(o=t.Message.getRepeatedFloatingPointField(r,3))?void 0:o,locationData:(o=r.getLocationData())&&i.LocationData.toObject(e,o),featureTag:null==(o=t.Message.getField(r,5))?void 0:o,trackId:null==(o=t.Message.getField(r,6))?void 0:o,detectionId:null==(o=t.Message.getField(r,7))?void 0:o,associatedDetectionsList:t.Message.toObjectList(r.getAssociatedDetectionsList(),proto.mediapipe.Detection.AssociatedDetection.toObject,e),displayNameList:null==(o=t.Message.getRepeatedField(r,9))?void 0:o,timestampUsec:null==(o=t.Message.getField(r,10))?void 0:o};return e&&(a.$jspbMessageInstance=r),a}),proto.mediapipe.Detection.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.Detection;return proto.mediapipe.Detection.deserializeBinaryFromReader(o,r)},proto.mediapipe.Detection.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.addLabel(r);break;case 2:for(var o=t.isDelimited()?t.readPackedInt32():[t.readInt32()],a=0;a0&&r.writeRepeatedString(1,o),(o=e.getLabelIdList()).length>0&&r.writePackedInt32(2,o),(o=e.getScoreList()).length>0&&r.writePackedFloat(3,o),null!=(o=e.getLocationData())&&r.writeMessage(4,o,i.LocationData.serializeBinaryToWriter),null!=(o=t.Message.getField(e,5))&&r.writeString(5,o),null!=(o=t.Message.getField(e,6))&&r.writeString(6,o),null!=(o=t.Message.getField(e,7))&&r.writeInt64(7,o),(o=e.getAssociatedDetectionsList()).length>0&&r.writeRepeatedMessage(8,o,proto.mediapipe.Detection.AssociatedDetection.serializeBinaryToWriter),(o=e.getDisplayNameList()).length>0&&r.writeRepeatedString(9,o),null!=(o=t.Message.getField(e,10))&&r.writeInt64(10,o)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.Detection.AssociatedDetection.prototype.toObject=function(e){return proto.mediapipe.Detection.AssociatedDetection.toObject(e,this)},proto.mediapipe.Detection.AssociatedDetection.toObject=function(e,r){var o,i={id:null==(o=t.Message.getField(r,1))?void 0:o,confidence:null==(o=t.Message.getOptionalFloatingPointField(r,2))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.Detection.AssociatedDetection.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.Detection.AssociatedDetection;return proto.mediapipe.Detection.AssociatedDetection.deserializeBinaryFromReader(o,r)},proto.mediapipe.Detection.AssociatedDetection.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readInt32();e.setId(r);break;case 2:r=t.readFloat();e.setConfidence(r);break;default:t.skipField()}}return e},proto.mediapipe.Detection.AssociatedDetection.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.Detection.AssociatedDetection.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.Detection.AssociatedDetection.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeInt32(1,o),null!=(o=t.Message.getField(e,2))&&r.writeFloat(2,o)},proto.mediapipe.Detection.AssociatedDetection.prototype.getId=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.Detection.AssociatedDetection.prototype.setId=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.Detection.AssociatedDetection.prototype.clearId=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.Detection.AssociatedDetection.prototype.hasId=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.Detection.AssociatedDetection.prototype.getConfidence=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,0)},proto.mediapipe.Detection.AssociatedDetection.prototype.setConfidence=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.Detection.AssociatedDetection.prototype.clearConfidence=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.Detection.AssociatedDetection.prototype.hasConfidence=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.Detection.prototype.getLabelList=function(){return t.Message.getRepeatedField(this,1)},proto.mediapipe.Detection.prototype.setLabelList=function(e){return t.Message.setField(this,1,e||[])},proto.mediapipe.Detection.prototype.addLabel=function(e,r){return t.Message.addToRepeatedField(this,1,e,r)},proto.mediapipe.Detection.prototype.clearLabelList=function(){return this.setLabelList([])},proto.mediapipe.Detection.prototype.getLabelIdList=function(){return t.Message.getRepeatedField(this,2)},proto.mediapipe.Detection.prototype.setLabelIdList=function(e){return t.Message.setField(this,2,e||[])},proto.mediapipe.Detection.prototype.addLabelId=function(e,r){return t.Message.addToRepeatedField(this,2,e,r)},proto.mediapipe.Detection.prototype.clearLabelIdList=function(){return this.setLabelIdList([])},proto.mediapipe.Detection.prototype.getScoreList=function(){return t.Message.getRepeatedFloatingPointField(this,3)},proto.mediapipe.Detection.prototype.setScoreList=function(e){return t.Message.setField(this,3,e||[])},proto.mediapipe.Detection.prototype.addScore=function(e,r){return t.Message.addToRepeatedField(this,3,e,r)},proto.mediapipe.Detection.prototype.clearScoreList=function(){return this.setScoreList([])},proto.mediapipe.Detection.prototype.getLocationData=function(){return t.Message.getWrapperField(this,i.LocationData,4)},proto.mediapipe.Detection.prototype.setLocationData=function(e){return t.Message.setWrapperField(this,4,e)},proto.mediapipe.Detection.prototype.clearLocationData=function(){return this.setLocationData(void 0)},proto.mediapipe.Detection.prototype.hasLocationData=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.Detection.prototype.getFeatureTag=function(){return t.Message.getFieldWithDefault(this,5,"")},proto.mediapipe.Detection.prototype.setFeatureTag=function(e){return t.Message.setField(this,5,e)},proto.mediapipe.Detection.prototype.clearFeatureTag=function(){return t.Message.setField(this,5,void 0)},proto.mediapipe.Detection.prototype.hasFeatureTag=function(){return null!=t.Message.getField(this,5)},proto.mediapipe.Detection.prototype.getTrackId=function(){return t.Message.getFieldWithDefault(this,6,"")},proto.mediapipe.Detection.prototype.setTrackId=function(e){return t.Message.setField(this,6,e)},proto.mediapipe.Detection.prototype.clearTrackId=function(){return t.Message.setField(this,6,void 0)},proto.mediapipe.Detection.prototype.hasTrackId=function(){return null!=t.Message.getField(this,6)},proto.mediapipe.Detection.prototype.getDetectionId=function(){return t.Message.getFieldWithDefault(this,7,0)},proto.mediapipe.Detection.prototype.setDetectionId=function(e){return t.Message.setField(this,7,e)},proto.mediapipe.Detection.prototype.clearDetectionId=function(){return t.Message.setField(this,7,void 0)},proto.mediapipe.Detection.prototype.hasDetectionId=function(){return null!=t.Message.getField(this,7)},proto.mediapipe.Detection.prototype.getAssociatedDetectionsList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.Detection.AssociatedDetection,8)},proto.mediapipe.Detection.prototype.setAssociatedDetectionsList=function(e){return t.Message.setRepeatedWrapperField(this,8,e)},proto.mediapipe.Detection.prototype.addAssociatedDetections=function(e,r){return t.Message.addToRepeatedWrapperField(this,8,e,proto.mediapipe.Detection.AssociatedDetection,r)},proto.mediapipe.Detection.prototype.clearAssociatedDetectionsList=function(){return this.setAssociatedDetectionsList([])},proto.mediapipe.Detection.prototype.getDisplayNameList=function(){return t.Message.getRepeatedField(this,9)},proto.mediapipe.Detection.prototype.setDisplayNameList=function(e){return t.Message.setField(this,9,e||[])},proto.mediapipe.Detection.prototype.addDisplayName=function(e,r){return t.Message.addToRepeatedField(this,9,e,r)},proto.mediapipe.Detection.prototype.clearDisplayNameList=function(){return this.setDisplayNameList([])},proto.mediapipe.Detection.prototype.getTimestampUsec=function(){return t.Message.getFieldWithDefault(this,10,0)},proto.mediapipe.Detection.prototype.setTimestampUsec=function(e){return t.Message.setField(this,10,e)},proto.mediapipe.Detection.prototype.clearTimestampUsec=function(){return t.Message.setField(this,10,void 0)},proto.mediapipe.Detection.prototype.hasTimestampUsec=function(){return null!=t.Message.getField(this,10)},proto.mediapipe.DetectionList.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.DetectionList.prototype.toObject=function(e){return proto.mediapipe.DetectionList.toObject(e,this)},proto.mediapipe.DetectionList.toObject=function(e,r){var o={detectionList:t.Message.toObjectList(r.getDetectionList(),proto.mediapipe.Detection.toObject,e)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.DetectionList.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.DetectionList;return proto.mediapipe.DetectionList.deserializeBinaryFromReader(o,r)},proto.mediapipe.DetectionList.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new proto.mediapipe.Detection;t.readMessage(r,proto.mediapipe.Detection.deserializeBinaryFromReader),e.addDetection(r)}else t.skipField()}return e},proto.mediapipe.DetectionList.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.DetectionList.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.DetectionList.serializeBinaryToWriter=function(e,t){var r;(r=e.getDetectionList()).length>0&&t.writeRepeatedMessage(1,r,proto.mediapipe.Detection.serializeBinaryToWriter)},proto.mediapipe.DetectionList.prototype.getDetectionList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.Detection,1)},proto.mediapipe.DetectionList.prototype.setDetectionList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.DetectionList.prototype.addDetection=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.Detection,r)},proto.mediapipe.DetectionList.prototype.clearDetectionList=function(){return this.setDetectionList([])},r.object.extend(e,proto.mediapipe)}(detection_pb);var base_options_pb={},acceleration_pb={},inference_calculator_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a),r.exportSymbol("proto.mediapipe.InferenceCalculatorOptions",null,o),r.exportSymbol("proto.mediapipe.InferenceCalculatorOptions.Delegate",null,o),r.exportSymbol("proto.mediapipe.InferenceCalculatorOptions.Delegate.DelegateCase",null,o),r.exportSymbol("proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu",null,o),r.exportSymbol("proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.Api",null,o),r.exportSymbol("proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.InferenceUsage",null,o),r.exportSymbol("proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi",null,o),r.exportSymbol("proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite",null,o),r.exportSymbol("proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack",null,o),proto.mediapipe.InferenceCalculatorOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.InferenceCalculatorOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.InferenceCalculatorOptions.displayName="proto.mediapipe.InferenceCalculatorOptions"),proto.mediapipe.InferenceCalculatorOptions.Delegate=function(e){t.Message.initialize(this,e,0,-1,null,proto.mediapipe.InferenceCalculatorOptions.Delegate.oneofGroups_)},r.inherits(proto.mediapipe.InferenceCalculatorOptions.Delegate,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.InferenceCalculatorOptions.Delegate.displayName="proto.mediapipe.InferenceCalculatorOptions.Delegate"),proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.displayName="proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite"),proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.displayName="proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu"),proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.displayName="proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi"),proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.displayName="proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.InferenceCalculatorOptions.prototype.toObject=function(e){return proto.mediapipe.InferenceCalculatorOptions.toObject(e,this)},proto.mediapipe.InferenceCalculatorOptions.toObject=function(e,r){var o,i={modelPath:null==(o=t.Message.getField(r,1))?void 0:o,useGpu:t.Message.getBooleanFieldWithDefault(r,2,!1),useNnapi:t.Message.getBooleanFieldWithDefault(r,3,!1),cpuNumThread:t.Message.getFieldWithDefault(r,4,-1),delegate:(o=r.getDelegate())&&proto.mediapipe.InferenceCalculatorOptions.Delegate.toObject(e,o)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.InferenceCalculatorOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.InferenceCalculatorOptions;return proto.mediapipe.InferenceCalculatorOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.InferenceCalculatorOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setModelPath(r);break;case 2:r=t.readBool();e.setUseGpu(r);break;case 3:r=t.readBool();e.setUseNnapi(r);break;case 4:r=t.readInt32();e.setCpuNumThread(r);break;case 5:r=new proto.mediapipe.InferenceCalculatorOptions.Delegate;t.readMessage(r,proto.mediapipe.InferenceCalculatorOptions.Delegate.deserializeBinaryFromReader),e.setDelegate(r);break;default:t.skipField()}}return e},proto.mediapipe.InferenceCalculatorOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.InferenceCalculatorOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.InferenceCalculatorOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeString(1,o),null!=(o=t.Message.getField(e,2))&&r.writeBool(2,o),null!=(o=t.Message.getField(e,3))&&r.writeBool(3,o),null!=(o=t.Message.getField(e,4))&&r.writeInt32(4,o),null!=(o=e.getDelegate())&&r.writeMessage(5,o,proto.mediapipe.InferenceCalculatorOptions.Delegate.serializeBinaryToWriter)},proto.mediapipe.InferenceCalculatorOptions.Delegate.oneofGroups_=[[1,2,3,4]],proto.mediapipe.InferenceCalculatorOptions.Delegate.DelegateCase={DELEGATE_NOT_SET:0,TFLITE:1,GPU:2,NNAPI:3,XNNPACK:4},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.getDelegateCase=function(){return t.Message.computeOneofCase(this,proto.mediapipe.InferenceCalculatorOptions.Delegate.oneofGroups_[0])},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.toObject=function(e){return proto.mediapipe.InferenceCalculatorOptions.Delegate.toObject(e,this)},proto.mediapipe.InferenceCalculatorOptions.Delegate.toObject=function(e,t){var r,o={tflite:(r=t.getTflite())&&proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.toObject(e,r),gpu:(r=t.getGpu())&&proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.toObject(e,r),nnapi:(r=t.getNnapi())&&proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.toObject(e,r),xnnpack:(r=t.getXnnpack())&&proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.InferenceCalculatorOptions.Delegate.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.InferenceCalculatorOptions.Delegate;return proto.mediapipe.InferenceCalculatorOptions.Delegate.deserializeBinaryFromReader(o,r)},proto.mediapipe.InferenceCalculatorOptions.Delegate.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite;t.readMessage(r,proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.deserializeBinaryFromReader),e.setTflite(r);break;case 2:r=new proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu;t.readMessage(r,proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.deserializeBinaryFromReader),e.setGpu(r);break;case 3:r=new proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi;t.readMessage(r,proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.deserializeBinaryFromReader),e.setNnapi(r);break;case 4:r=new proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack;t.readMessage(r,proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.deserializeBinaryFromReader),e.setXnnpack(r);break;default:t.skipField()}}return e},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.InferenceCalculatorOptions.Delegate.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.InferenceCalculatorOptions.Delegate.serializeBinaryToWriter=function(e,t){var r=void 0;null!=(r=e.getTflite())&&t.writeMessage(1,r,proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.serializeBinaryToWriter),null!=(r=e.getGpu())&&t.writeMessage(2,r,proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.serializeBinaryToWriter),null!=(r=e.getNnapi())&&t.writeMessage(3,r,proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.serializeBinaryToWriter),null!=(r=e.getXnnpack())&&t.writeMessage(4,r,proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.serializeBinaryToWriter)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.prototype.toObject=function(e){return proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.toObject(e,this)},proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.toObject=function(e,t){var r={};return e&&(r.$jspbMessageInstance=t),r}),proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite;return proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.deserializeBinaryFromReader(o,r)},proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){t.getFieldNumber();t.skipField()}return e},proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.serializeBinaryToWriter=function(e,t){},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.toObject=function(e){return proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.toObject(e,this)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.toObject=function(e,r){var o,i={useAdvancedGpuApi:t.Message.getBooleanFieldWithDefault(r,1,!1),api:t.Message.getFieldWithDefault(r,4,0),allowPrecisionLoss:t.Message.getBooleanFieldWithDefault(r,3,!0),cachedKernelPath:null==(o=t.Message.getField(r,2))?void 0:o,serializedModelDir:null==(o=t.Message.getField(r,7))?void 0:o,modelToken:null==(o=t.Message.getField(r,8))?void 0:o,usage:t.Message.getFieldWithDefault(r,5,2)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu;return proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.deserializeBinaryFromReader(o,r)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readBool();e.setUseAdvancedGpuApi(r);break;case 4:r=t.readEnum();e.setApi(r);break;case 3:r=t.readBool();e.setAllowPrecisionLoss(r);break;case 2:r=t.readString();e.setCachedKernelPath(r);break;case 7:r=t.readString();e.setSerializedModelDir(r);break;case 8:r=t.readString();e.setModelToken(r);break;case 5:r=t.readEnum();e.setUsage(r);break;default:t.skipField()}}return e},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeBool(1,o),null!=(o=t.Message.getField(e,4))&&r.writeEnum(4,o),null!=(o=t.Message.getField(e,3))&&r.writeBool(3,o),null!=(o=t.Message.getField(e,2))&&r.writeString(2,o),null!=(o=t.Message.getField(e,7))&&r.writeString(7,o),null!=(o=t.Message.getField(e,8))&&r.writeString(8,o),null!=(o=t.Message.getField(e,5))&&r.writeEnum(5,o)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.Api={ANY:0,OPENGL:1,OPENCL:2},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.InferenceUsage={UNSPECIFIED:0,FAST_SINGLE_ANSWER:1,SUSTAINED_SPEED:2},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.getUseAdvancedGpuApi=function(){return t.Message.getBooleanFieldWithDefault(this,1,!1)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.setUseAdvancedGpuApi=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.clearUseAdvancedGpuApi=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.hasUseAdvancedGpuApi=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.getApi=function(){return t.Message.getFieldWithDefault(this,4,0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.setApi=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.clearApi=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.hasApi=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.getAllowPrecisionLoss=function(){return t.Message.getBooleanFieldWithDefault(this,3,!0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.setAllowPrecisionLoss=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.clearAllowPrecisionLoss=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.hasAllowPrecisionLoss=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.getCachedKernelPath=function(){return t.Message.getFieldWithDefault(this,2,"")},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.setCachedKernelPath=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.clearCachedKernelPath=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.hasCachedKernelPath=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.getSerializedModelDir=function(){return t.Message.getFieldWithDefault(this,7,"")},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.setSerializedModelDir=function(e){return t.Message.setField(this,7,e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.clearSerializedModelDir=function(){return t.Message.setField(this,7,void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.hasSerializedModelDir=function(){return null!=t.Message.getField(this,7)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.getModelToken=function(){return t.Message.getFieldWithDefault(this,8,"")},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.setModelToken=function(e){return t.Message.setField(this,8,e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.clearModelToken=function(){return t.Message.setField(this,8,void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.hasModelToken=function(){return null!=t.Message.getField(this,8)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.getUsage=function(){return t.Message.getFieldWithDefault(this,5,2)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.setUsage=function(e){return t.Message.setField(this,5,e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.clearUsage=function(){return t.Message.setField(this,5,void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.hasUsage=function(){return null!=t.Message.getField(this,5)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.toObject=function(e){return proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.toObject(e,this)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.toObject=function(e,r){var o,i={cacheDir:null==(o=t.Message.getField(r,1))?void 0:o,modelToken:null==(o=t.Message.getField(r,2))?void 0:o,acceleratorName:null==(o=t.Message.getField(r,3))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi;return proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.deserializeBinaryFromReader(o,r)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setCacheDir(r);break;case 2:r=t.readString();e.setModelToken(r);break;case 3:r=t.readString();e.setAcceleratorName(r);break;default:t.skipField()}}return e},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeString(1,o),null!=(o=t.Message.getField(e,2))&&r.writeString(2,o),null!=(o=t.Message.getField(e,3))&&r.writeString(3,o)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.getCacheDir=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.setCacheDir=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.clearCacheDir=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.hasCacheDir=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.getModelToken=function(){return t.Message.getFieldWithDefault(this,2,"")},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.setModelToken=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.clearModelToken=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.hasModelToken=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.getAcceleratorName=function(){return t.Message.getFieldWithDefault(this,3,"")},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.setAcceleratorName=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.clearAcceleratorName=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.hasAcceleratorName=function(){return null!=t.Message.getField(this,3)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.prototype.toObject=function(e){return proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.toObject(e,this)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.toObject=function(e,r){var o={numThreads:t.Message.getFieldWithDefault(r,1,-1)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack;return proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.deserializeBinaryFromReader(o,r)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=t.readInt32();e.setNumThreads(r)}else t.skipField()}return e},proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.serializeBinaryToWriter=function(e,r){var o;null!=(o=t.Message.getField(e,1))&&r.writeInt32(1,o)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.prototype.getNumThreads=function(){return t.Message.getFieldWithDefault(this,1,-1)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.prototype.setNumThreads=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.prototype.clearNumThreads=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.prototype.hasNumThreads=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.getTflite=function(){return t.Message.getWrapperField(this,proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite,1)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.setTflite=function(e){return t.Message.setOneofWrapperField(this,1,proto.mediapipe.InferenceCalculatorOptions.Delegate.oneofGroups_[0],e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.clearTflite=function(){return this.setTflite(void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.hasTflite=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.getGpu=function(){return t.Message.getWrapperField(this,proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu,2)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.setGpu=function(e){return t.Message.setOneofWrapperField(this,2,proto.mediapipe.InferenceCalculatorOptions.Delegate.oneofGroups_[0],e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.clearGpu=function(){return this.setGpu(void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.hasGpu=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.getNnapi=function(){return t.Message.getWrapperField(this,proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi,3)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.setNnapi=function(e){return t.Message.setOneofWrapperField(this,3,proto.mediapipe.InferenceCalculatorOptions.Delegate.oneofGroups_[0],e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.clearNnapi=function(){return this.setNnapi(void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.hasNnapi=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.getXnnpack=function(){return t.Message.getWrapperField(this,proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack,4)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.setXnnpack=function(e){return t.Message.setOneofWrapperField(this,4,proto.mediapipe.InferenceCalculatorOptions.Delegate.oneofGroups_[0],e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.clearXnnpack=function(){return this.setXnnpack(void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.hasXnnpack=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.InferenceCalculatorOptions.ext=new t.ExtensionFieldInfo(336783863,{ext:0},proto.mediapipe.InferenceCalculatorOptions,proto.mediapipe.InferenceCalculatorOptions.toObject,0),a.CalculatorOptions.extensionsBinary[336783863]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.InferenceCalculatorOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.InferenceCalculatorOptions.serializeBinaryToWriter,proto.mediapipe.InferenceCalculatorOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[336783863]=proto.mediapipe.InferenceCalculatorOptions.ext,proto.mediapipe.InferenceCalculatorOptions.prototype.getModelPath=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.InferenceCalculatorOptions.prototype.setModelPath=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.InferenceCalculatorOptions.prototype.clearModelPath=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.InferenceCalculatorOptions.prototype.hasModelPath=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.InferenceCalculatorOptions.prototype.getUseGpu=function(){return t.Message.getBooleanFieldWithDefault(this,2,!1)},proto.mediapipe.InferenceCalculatorOptions.prototype.setUseGpu=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.InferenceCalculatorOptions.prototype.clearUseGpu=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.InferenceCalculatorOptions.prototype.hasUseGpu=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.InferenceCalculatorOptions.prototype.getUseNnapi=function(){return t.Message.getBooleanFieldWithDefault(this,3,!1)},proto.mediapipe.InferenceCalculatorOptions.prototype.setUseNnapi=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.InferenceCalculatorOptions.prototype.clearUseNnapi=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.InferenceCalculatorOptions.prototype.hasUseNnapi=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.InferenceCalculatorOptions.prototype.getCpuNumThread=function(){return t.Message.getFieldWithDefault(this,4,-1)},proto.mediapipe.InferenceCalculatorOptions.prototype.setCpuNumThread=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.InferenceCalculatorOptions.prototype.clearCpuNumThread=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.InferenceCalculatorOptions.prototype.hasCpuNumThread=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.InferenceCalculatorOptions.prototype.getDelegate=function(){return t.Message.getWrapperField(this,proto.mediapipe.InferenceCalculatorOptions.Delegate,5)},proto.mediapipe.InferenceCalculatorOptions.prototype.setDelegate=function(e){return t.Message.setWrapperField(this,5,e)},proto.mediapipe.InferenceCalculatorOptions.prototype.clearDelegate=function(){return this.setDelegate(void 0)},proto.mediapipe.InferenceCalculatorOptions.prototype.hasDelegate=function(){return null!=t.Message.getField(this,5)},proto.mediapipe.InferenceCalculatorOptions.ext=new t.ExtensionFieldInfo(336783863,{ext:0},proto.mediapipe.InferenceCalculatorOptions,proto.mediapipe.InferenceCalculatorOptions.toObject,0),a.CalculatorOptions.extensionsBinary[336783863]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.InferenceCalculatorOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.InferenceCalculatorOptions.serializeBinaryToWriter,proto.mediapipe.InferenceCalculatorOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[336783863]=proto.mediapipe.InferenceCalculatorOptions.ext,r.object.extend(e,proto.mediapipe)}(inference_calculator_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=inference_calculator_pb;r.object.extend(proto,i),r.exportSymbol("proto.mediapipe.tasks.core.proto.Acceleration",null,o),r.exportSymbol("proto.mediapipe.tasks.core.proto.Acceleration.DelegateCase",null,o),proto.mediapipe.tasks.core.proto.Acceleration=function(e){t.Message.initialize(this,e,0,-1,null,proto.mediapipe.tasks.core.proto.Acceleration.oneofGroups_)},r.inherits(proto.mediapipe.tasks.core.proto.Acceleration,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.core.proto.Acceleration.displayName="proto.mediapipe.tasks.core.proto.Acceleration"),proto.mediapipe.tasks.core.proto.Acceleration.oneofGroups_=[[1,2,4,5]],proto.mediapipe.tasks.core.proto.Acceleration.DelegateCase={DELEGATE_NOT_SET:0,XNNPACK:1,GPU:2,TFLITE:4,NNAPI:5},proto.mediapipe.tasks.core.proto.Acceleration.prototype.getDelegateCase=function(){return t.Message.computeOneofCase(this,proto.mediapipe.tasks.core.proto.Acceleration.oneofGroups_[0])},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.core.proto.Acceleration.prototype.toObject=function(e){return proto.mediapipe.tasks.core.proto.Acceleration.toObject(e,this)},proto.mediapipe.tasks.core.proto.Acceleration.toObject=function(e,t){var r,o={xnnpack:(r=t.getXnnpack())&&i.InferenceCalculatorOptions.Delegate.Xnnpack.toObject(e,r),gpu:(r=t.getGpu())&&i.InferenceCalculatorOptions.Delegate.Gpu.toObject(e,r),tflite:(r=t.getTflite())&&i.InferenceCalculatorOptions.Delegate.TfLite.toObject(e,r),nnapi:(r=t.getNnapi())&&i.InferenceCalculatorOptions.Delegate.Nnapi.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.core.proto.Acceleration.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.core.proto.Acceleration;return proto.mediapipe.tasks.core.proto.Acceleration.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.core.proto.Acceleration.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new i.InferenceCalculatorOptions.Delegate.Xnnpack;t.readMessage(r,i.InferenceCalculatorOptions.Delegate.Xnnpack.deserializeBinaryFromReader),e.setXnnpack(r);break;case 2:r=new i.InferenceCalculatorOptions.Delegate.Gpu;t.readMessage(r,i.InferenceCalculatorOptions.Delegate.Gpu.deserializeBinaryFromReader),e.setGpu(r);break;case 4:r=new i.InferenceCalculatorOptions.Delegate.TfLite;t.readMessage(r,i.InferenceCalculatorOptions.Delegate.TfLite.deserializeBinaryFromReader),e.setTflite(r);break;case 5:r=new i.InferenceCalculatorOptions.Delegate.Nnapi;t.readMessage(r,i.InferenceCalculatorOptions.Delegate.Nnapi.deserializeBinaryFromReader),e.setNnapi(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.core.proto.Acceleration.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.core.proto.Acceleration.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.core.proto.Acceleration.serializeBinaryToWriter=function(e,t){var r=void 0;null!=(r=e.getXnnpack())&&t.writeMessage(1,r,i.InferenceCalculatorOptions.Delegate.Xnnpack.serializeBinaryToWriter),null!=(r=e.getGpu())&&t.writeMessage(2,r,i.InferenceCalculatorOptions.Delegate.Gpu.serializeBinaryToWriter),null!=(r=e.getTflite())&&t.writeMessage(4,r,i.InferenceCalculatorOptions.Delegate.TfLite.serializeBinaryToWriter),null!=(r=e.getNnapi())&&t.writeMessage(5,r,i.InferenceCalculatorOptions.Delegate.Nnapi.serializeBinaryToWriter)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.getXnnpack=function(){return t.Message.getWrapperField(this,i.InferenceCalculatorOptions.Delegate.Xnnpack,1)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.setXnnpack=function(e){return t.Message.setOneofWrapperField(this,1,proto.mediapipe.tasks.core.proto.Acceleration.oneofGroups_[0],e)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.clearXnnpack=function(){return this.setXnnpack(void 0)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.hasXnnpack=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.getGpu=function(){return t.Message.getWrapperField(this,i.InferenceCalculatorOptions.Delegate.Gpu,2)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.setGpu=function(e){return t.Message.setOneofWrapperField(this,2,proto.mediapipe.tasks.core.proto.Acceleration.oneofGroups_[0],e)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.clearGpu=function(){return this.setGpu(void 0)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.hasGpu=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.getTflite=function(){return t.Message.getWrapperField(this,i.InferenceCalculatorOptions.Delegate.TfLite,4)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.setTflite=function(e){return t.Message.setOneofWrapperField(this,4,proto.mediapipe.tasks.core.proto.Acceleration.oneofGroups_[0],e)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.clearTflite=function(){return this.setTflite(void 0)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.hasTflite=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.getNnapi=function(){return t.Message.getWrapperField(this,i.InferenceCalculatorOptions.Delegate.Nnapi,5)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.setNnapi=function(e){return t.Message.setOneofWrapperField(this,5,proto.mediapipe.tasks.core.proto.Acceleration.oneofGroups_[0],e)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.clearNnapi=function(){return this.setNnapi(void 0)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.hasNnapi=function(){return null!=t.Message.getField(this,5)},r.object.extend(e,proto.mediapipe.tasks.core.proto)}(acceleration_pb);var external_file_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.tasks.core.proto.ExternalFile",null,o),r.exportSymbol("proto.mediapipe.tasks.core.proto.FileDescriptorMeta",null,o),r.exportSymbol("proto.mediapipe.tasks.core.proto.FilePointerMeta",null,o),proto.mediapipe.tasks.core.proto.ExternalFile=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.core.proto.ExternalFile,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.core.proto.ExternalFile.displayName="proto.mediapipe.tasks.core.proto.ExternalFile"),proto.mediapipe.tasks.core.proto.FileDescriptorMeta=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.core.proto.FileDescriptorMeta,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.core.proto.FileDescriptorMeta.displayName="proto.mediapipe.tasks.core.proto.FileDescriptorMeta"),proto.mediapipe.tasks.core.proto.FilePointerMeta=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.core.proto.FilePointerMeta,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.core.proto.FilePointerMeta.displayName="proto.mediapipe.tasks.core.proto.FilePointerMeta"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.core.proto.ExternalFile.prototype.toObject=function(e){return proto.mediapipe.tasks.core.proto.ExternalFile.toObject(e,this)},proto.mediapipe.tasks.core.proto.ExternalFile.toObject=function(e,r){var o,i={fileContent:r.getFileContent_asB64(),fileName:null==(o=t.Message.getField(r,2))?void 0:o,fileDescriptorMeta:(o=r.getFileDescriptorMeta())&&proto.mediapipe.tasks.core.proto.FileDescriptorMeta.toObject(e,o),filePointerMeta:(o=r.getFilePointerMeta())&&proto.mediapipe.tasks.core.proto.FilePointerMeta.toObject(e,o)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.core.proto.ExternalFile.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.core.proto.ExternalFile;return proto.mediapipe.tasks.core.proto.ExternalFile.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.core.proto.ExternalFile.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readBytes();e.setFileContent(r);break;case 2:r=t.readString();e.setFileName(r);break;case 3:r=new proto.mediapipe.tasks.core.proto.FileDescriptorMeta;t.readMessage(r,proto.mediapipe.tasks.core.proto.FileDescriptorMeta.deserializeBinaryFromReader),e.setFileDescriptorMeta(r);break;case 4:r=new proto.mediapipe.tasks.core.proto.FilePointerMeta;t.readMessage(r,proto.mediapipe.tasks.core.proto.FilePointerMeta.deserializeBinaryFromReader),e.setFilePointerMeta(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.core.proto.ExternalFile.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.core.proto.ExternalFile.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeBytes(1,o),null!=(o=t.Message.getField(e,2))&&r.writeString(2,o),null!=(o=e.getFileDescriptorMeta())&&r.writeMessage(3,o,proto.mediapipe.tasks.core.proto.FileDescriptorMeta.serializeBinaryToWriter),null!=(o=e.getFilePointerMeta())&&r.writeMessage(4,o,proto.mediapipe.tasks.core.proto.FilePointerMeta.serializeBinaryToWriter)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.getFileContent=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.getFileContent_asB64=function(){return t.Message.bytesAsB64(this.getFileContent())},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.getFileContent_asU8=function(){return t.Message.bytesAsU8(this.getFileContent())},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.setFileContent=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.clearFileContent=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.hasFileContent=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.getFileName=function(){return t.Message.getFieldWithDefault(this,2,"")},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.setFileName=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.clearFileName=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.hasFileName=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.getFileDescriptorMeta=function(){return t.Message.getWrapperField(this,proto.mediapipe.tasks.core.proto.FileDescriptorMeta,3)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.setFileDescriptorMeta=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.clearFileDescriptorMeta=function(){return this.setFileDescriptorMeta(void 0)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.hasFileDescriptorMeta=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.getFilePointerMeta=function(){return t.Message.getWrapperField(this,proto.mediapipe.tasks.core.proto.FilePointerMeta,4)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.setFilePointerMeta=function(e){return t.Message.setWrapperField(this,4,e)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.clearFilePointerMeta=function(){return this.setFilePointerMeta(void 0)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.hasFilePointerMeta=function(){return null!=t.Message.getField(this,4)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.toObject=function(e){return proto.mediapipe.tasks.core.proto.FileDescriptorMeta.toObject(e,this)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.toObject=function(e,r){var o,i={fd:null==(o=t.Message.getField(r,1))?void 0:o,length:null==(o=t.Message.getField(r,2))?void 0:o,offset:null==(o=t.Message.getField(r,3))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.core.proto.FileDescriptorMeta.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.core.proto.FileDescriptorMeta;return proto.mediapipe.tasks.core.proto.FileDescriptorMeta.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readInt32();e.setFd(r);break;case 2:r=t.readInt64();e.setLength(r);break;case 3:r=t.readInt64();e.setOffset(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.core.proto.FileDescriptorMeta.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeInt32(1,o),null!=(o=t.Message.getField(e,2))&&r.writeInt64(2,o),null!=(o=t.Message.getField(e,3))&&r.writeInt64(3,o)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.getFd=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.setFd=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.clearFd=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.hasFd=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.getLength=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.setLength=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.clearLength=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.hasLength=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.getOffset=function(){return t.Message.getFieldWithDefault(this,3,0)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.setOffset=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.clearOffset=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.hasOffset=function(){return null!=t.Message.getField(this,3)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.core.proto.FilePointerMeta.prototype.toObject=function(e){return proto.mediapipe.tasks.core.proto.FilePointerMeta.toObject(e,this)},proto.mediapipe.tasks.core.proto.FilePointerMeta.toObject=function(e,r){var o,i={pointer:null==(o=t.Message.getField(r,1))?void 0:o,length:null==(o=t.Message.getField(r,2))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.core.proto.FilePointerMeta.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.core.proto.FilePointerMeta;return proto.mediapipe.tasks.core.proto.FilePointerMeta.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.core.proto.FilePointerMeta.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readUint64();e.setPointer(r);break;case 2:r=t.readInt64();e.setLength(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.core.proto.FilePointerMeta.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.core.proto.FilePointerMeta.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.core.proto.FilePointerMeta.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeUint64(1,o),null!=(o=t.Message.getField(e,2))&&r.writeInt64(2,o)},proto.mediapipe.tasks.core.proto.FilePointerMeta.prototype.getPointer=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.tasks.core.proto.FilePointerMeta.prototype.setPointer=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.tasks.core.proto.FilePointerMeta.prototype.clearPointer=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.tasks.core.proto.FilePointerMeta.prototype.hasPointer=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.core.proto.FilePointerMeta.prototype.getLength=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.tasks.core.proto.FilePointerMeta.prototype.setLength=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.core.proto.FilePointerMeta.prototype.clearLength=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.core.proto.FilePointerMeta.prototype.hasLength=function(){return null!=t.Message.getField(this,2)},r.object.extend(e,proto.mediapipe.tasks.core.proto)}(external_file_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=acceleration_pb;r.object.extend(proto,i);var a=external_file_pb;r.object.extend(proto,a),r.exportSymbol("proto.mediapipe.tasks.core.proto.BaseOptions",null,o),proto.mediapipe.tasks.core.proto.BaseOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.core.proto.BaseOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.core.proto.BaseOptions.displayName="proto.mediapipe.tasks.core.proto.BaseOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.core.proto.BaseOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.core.proto.BaseOptions.toObject(e,this)},proto.mediapipe.tasks.core.proto.BaseOptions.toObject=function(e,r){var o,n={modelAsset:(o=r.getModelAsset())&&a.ExternalFile.toObject(e,o),useStreamMode:t.Message.getBooleanFieldWithDefault(r,2,!1),acceleration:(o=r.getAcceleration())&&i.Acceleration.toObject(e,o)};return e&&(n.$jspbMessageInstance=r),n}),proto.mediapipe.tasks.core.proto.BaseOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.core.proto.BaseOptions;return proto.mediapipe.tasks.core.proto.BaseOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.core.proto.BaseOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new a.ExternalFile;t.readMessage(r,a.ExternalFile.deserializeBinaryFromReader),e.setModelAsset(r);break;case 2:r=t.readBool();e.setUseStreamMode(r);break;case 3:r=new i.Acceleration;t.readMessage(r,i.Acceleration.deserializeBinaryFromReader),e.setAcceleration(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.core.proto.BaseOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.core.proto.BaseOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getModelAsset())&&r.writeMessage(1,o,a.ExternalFile.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeBool(2,o),null!=(o=e.getAcceleration())&&r.writeMessage(3,o,i.Acceleration.serializeBinaryToWriter)},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.getModelAsset=function(){return t.Message.getWrapperField(this,a.ExternalFile,1)},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.setModelAsset=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.clearModelAsset=function(){return this.setModelAsset(void 0)},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.hasModelAsset=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.getUseStreamMode=function(){return t.Message.getBooleanFieldWithDefault(this,2,!1)},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.setUseStreamMode=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.clearUseStreamMode=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.hasUseStreamMode=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.getAcceleration=function(){return t.Message.getWrapperField(this,i.Acceleration,3)},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.setAcceleration=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.clearAcceleration=function(){return this.setAcceleration(void 0)},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.hasAcceleration=function(){return null!=t.Message.getField(this,3)},r.object.extend(e,proto.mediapipe.tasks.core.proto)}(base_options_pb);var face_detector_graph_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n),r.exportSymbol("proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions",null,o),proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.displayName="proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.toObject=function(e,r){var o,i={baseOptions:(o=r.getBaseOptions())&&n.BaseOptions.toObject(e,o),minDetectionConfidence:t.Message.getFloatingPointFieldWithDefault(r,2,.5),minSuppressionThreshold:t.Message.getFloatingPointFieldWithDefault(r,3,.5),numFaces:null==(o=t.Message.getField(r,4))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions;return proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=t.readFloat();e.setMinDetectionConfidence(r);break;case 3:r=t.readFloat();e.setMinSuppressionThreshold(r);break;case 4:r=t.readInt32();e.setNumFaces(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getBaseOptions())&&r.writeMessage(1,o,n.BaseOptions.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeFloat(2,o),null!=(o=t.Message.getField(e,3))&&r.writeFloat(3,o),null!=(o=t.Message.getField(e,4))&&r.writeInt32(4,o)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.ext=new t.ExtensionFieldInfo(502141897,{ext:0},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions,proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[502141897]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[502141897]=proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.ext,proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.getMinDetectionConfidence=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,.5)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.setMinDetectionConfidence=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.clearMinDetectionConfidence=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.hasMinDetectionConfidence=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.getMinSuppressionThreshold=function(){return t.Message.getFloatingPointFieldWithDefault(this,3,.5)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.setMinSuppressionThreshold=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.clearMinSuppressionThreshold=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.hasMinSuppressionThreshold=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.getNumFaces=function(){return t.Message.getFieldWithDefault(this,4,0)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.setNumFaces=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.clearNumFaces=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.hasNumFaces=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.ext=new t.ExtensionFieldInfo(502141897,{ext:0},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions,proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[502141897]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[502141897]=proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.face_detector.proto)}(face_detector_graph_options_pb);var detection_result={};Object.defineProperty(detection_result,"__esModule",{value:!0}),detection_result.convertFromDetectionProto=void 0;const DEFAULT_CATEGORY_INDEX=-1;function convertFromDetectionProto(e){var t,r,o,i,a,n,s,p,d,l,g,c,u;const m=e.getScoreList(),f=e.getLabelIdList(),h=e.getLabelList(),y=e.getDisplayNameList(),b={categories:[]};for(let e=0;e{i=i||"audio_header",this.wrapStringPtr(i,(i=>{this.wasmModule._configureAudio(o,i,e,t,r)}))}))}setAutoResizeCanvas(e){this.autoResizeCanvas=e}setAutoRenderToScreen(e){this.wasmModule._setAutoRenderToScreen(e)}bindTextureToStream(e,t){if(!this.wasmModule.canvas)throw new Error("No OpenGL canvas configured.");t?this.wasmModule._bindTextureToStream(t):console.assert(this.wasmModule._bindTextureToCanvas());const r=this.wasmModule.canvas.getContext("webgl2")||this.wasmModule.canvas.getContext("webgl");if(!r)throw new Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");let o,i;return r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,e),e.videoWidth?(o=e.videoWidth,i=e.videoHeight):e.naturalWidth?(o=e.naturalWidth,i=e.naturalHeight):(o=e.width,i=e.height),!this.autoResizeCanvas||o===this.wasmModule.canvas.width&&i===this.wasmModule.canvas.height||(this.wasmModule.canvas.width=o,this.wasmModule.canvas.height=i),[o,i]}processGl(e,t){const[r,o]=this.bindTextureToStream(e),i=this.wasmModule._malloc(16);this.wasmModule.HEAPU32[i/4]=r,this.wasmModule.HEAPU32[i/4+1]=o,this.wasmModule.HEAPF64[i/8+1]=t,this.wasmModule._processGl(i),this.wasmModule._free(i)}wrapStringPtr(e,t){this.hasMultiStreamSupport||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");const r=this.wasmModule.stringToNewUTF8(e);t(r),this.wasmModule._free(r)}wrapStringPtrPtr(e,t){this.hasMultiStreamSupport||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");const r=new Uint32Array(e.length);for(let t=0;t>2),t(o);for(const e of r)this.wasmModule._free(e);this.wasmModule._free(o)}getCalculatorGraphConfig(t,r){const o=e.CALCULATOR_GRAPH_CONFIG_LISTENER_NAME;this.setListener(o,(e=>{t(e)})),this.wrapStringPtr(o,(e=>{this.wasmModule._getGraphConfig(e,r)})),delete this.wasmModule.simpleListeners[o]}setListener(e,t){this.wasmModule.simpleListeners=this.wasmModule.simpleListeners||{},this.wasmModule.simpleListeners[e]=t}setVectorListener(e,t){let r=[];this.wasmModule.simpleListeners=this.wasmModule.simpleListeners||{},this.wasmModule.simpleListeners[e]=(e,o,i)=>{o?(t(r,i),r=[]):r.push(e)}}attachErrorListener(e){this.wasmModule.errorListener=e}attachEmptyPacketListener(e,t){this.wasmModule.emptyPacketListeners=this.wasmModule.emptyPacketListeners||{},this.wasmModule.emptyPacketListeners[e]=t}addAudioToStream(e,t,r){this.addAudioToStreamWithShape(e,0,0,t,r)}addAudioToStreamWithShape(e,t,r,o,i){const a=4*e.length;this.audioSize!==a&&(this.audioPtr&&this.wasmModule._free(this.audioPtr),this.audioPtr=this.wasmModule._malloc(a),this.audioSize=a),this.wasmModule.HEAPF32.set(e,this.audioPtr/4),this.wrapStringPtr(o,(e=>{this.wasmModule._addAudioToInputStream(this.audioPtr,t,r,e,i)}))}addGpuBufferToStream(e,t,r){this.wrapStringPtr(t,(t=>{const[o,i]=this.bindTextureToStream(e,t);this.wasmModule._addBoundTextureToStream(t,o,i,r)}))}addBoolToStream(e,t,r){this.wrapStringPtr(t,(t=>{this.wasmModule._addBoolToInputStream(e,t,r)}))}addDoubleToStream(e,t,r){this.wrapStringPtr(t,(t=>{this.wasmModule._addDoubleToInputStream(e,t,r)}))}addFloatToStream(e,t,r){this.wrapStringPtr(t,(t=>{this.wasmModule._addFloatToInputStream(e,t,r)}))}addIntToStream(e,t,r){this.wrapStringPtr(t,(t=>{this.wasmModule._addIntToInputStream(e,t,r)}))}addStringToStream(e,t,r){this.wrapStringPtr(t,(t=>{this.wrapStringPtr(e,(e=>{this.wasmModule._addStringToInputStream(e,t,r)}))}))}addStringRecordToStream(e,t,r){this.wrapStringPtr(t,(t=>{this.wrapStringPtrPtr(Object.keys(e),(o=>{this.wrapStringPtrPtr(Object.values(e),(i=>{this.wasmModule._addFlatHashMapToInputStream(o,i,Object.keys(e).length,t,r)}))}))}))}addProtoToStream(e,t,r,o){this.wrapStringPtr(r,(r=>{this.wrapStringPtr(t,(t=>{const i=this.wasmModule._malloc(e.length);this.wasmModule.HEAPU8.set(e,i),this.wasmModule._addProtoToInputStream(i,e.length,t,r,o),this.wasmModule._free(i)}))}))}addEmptyPacketToStream(e,t){this.wrapStringPtr(e,(e=>{this.wasmModule._addEmptyPacketToInputStream(e,t)}))}addBoolToInputSidePacket(e,t){this.wrapStringPtr(t,(t=>{this.wasmModule._addBoolToInputSidePacket(e,t)}))}addDoubleToInputSidePacket(e,t){this.wrapStringPtr(t,(t=>{this.wasmModule._addDoubleToInputSidePacket(e,t)}))}addFloatToInputSidePacket(e,t){this.wrapStringPtr(t,(t=>{this.wasmModule._addFloatToInputSidePacket(e,t)}))}addIntToInputSidePacket(e,t){this.wrapStringPtr(t,(t=>{this.wasmModule._addIntToInputSidePacket(e,t)}))}addStringToInputSidePacket(e,t){this.wrapStringPtr(t,(t=>{this.wrapStringPtr(e,(e=>{this.wasmModule._addStringToInputSidePacket(e,t)}))}))}addProtoToInputSidePacket(e,t,r){this.wrapStringPtr(r,(r=>{this.wrapStringPtr(t,(t=>{const o=this.wasmModule._malloc(e.length);this.wasmModule.HEAPU8.set(e,o),this.wasmModule._addProtoToInputSidePacket(o,e.length,t,r),this.wasmModule._free(o)}))}))}attachBoolListener(e,t){this.setListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmModule._attachBoolListener(e)}))}attachBoolVectorListener(e,t){this.setVectorListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmModule._attachBoolVectorListener(e)}))}attachIntListener(e,t){this.setListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmModule._attachIntListener(e)}))}attachIntVectorListener(e,t){this.setVectorListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmModule._attachIntVectorListener(e)}))}attachDoubleListener(e,t){this.setListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmModule._attachDoubleListener(e)}))}attachDoubleVectorListener(e,t){this.setVectorListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmModule._attachDoubleVectorListener(e)}))}attachFloatListener(e,t){this.setListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmModule._attachFloatListener(e)}))}attachFloatVectorListener(e,t){this.setVectorListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmModule._attachFloatVectorListener(e)}))}attachStringListener(e,t){this.setListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmModule._attachStringListener(e)}))}attachStringVectorListener(e,t){this.setVectorListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmModule._attachStringVectorListener(e)}))}attachProtoListener(e,t,r){this.setListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmModule._attachProtoListener(e,r||!1)}))}attachProtoVectorListener(e,t,r){this.setVectorListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmModule._attachProtoVectorListener(e,r||!1)}))}attachAudioListener(e,t,r){this.wasmModule._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),this.setListener(e,((e,r)=>{const o=new Float32Array(e.buffer,e.byteOffset,e.length/4);t(o,r)})),this.wrapStringPtr(e,(e=>{this.wasmModule._attachAudioListener(e,r||!1)}))}finishProcessing(){this.wasmModule._waitUntilIdle()}closeGraph(){this.wasmModule._closeGraph(),this.wasmModule.simpleListeners=void 0,this.wasmModule.emptyPacketListeners=void 0}}async function o(e){if("function"!=typeof importScripts){const t=document.createElement("script");return t.setAttribute("src",e),t.setAttribute("crossorigin","anonymous"),new Promise((e=>{t.addEventListener("load",(()=>{e()}),!1),t.addEventListener("error",(()=>{e()}),!1),document.body.appendChild(t)}))}importScripts(e.toString())}async function i(e,t,r,i,a){const n=[];if(t&&n.push(t),r&&n.push(r),n.length&&await Promise.all(n.map(o)),!self.ModuleFactory)throw new Error("ModuleFactory not set.");if(self.Module&&a){const e=self.Module;e.locateFile=a.locateFile,a.mainScriptUrlOrBlob&&(e.mainScriptUrlOrBlob=a.mainScriptUrlOrBlob)}const s=await self.ModuleFactory(self.Module||a);return self.ModuleFactory=self.Module=void 0,new e(s,i)}e.GraphRunner=r,e.createMediaPipeLib=i,e.createGraphRunner=async function(e,t,o,a){return i(r,e,t,o,a)}}(graph_runner);var register_model_resources_graph_service={};function SupportModelResourcesGraphService(e){return class extends e{registerModelResourcesGraphService(){this.wasmModule._registerModelResourcesGraphService()}}}Object.defineProperty(register_model_resources_graph_service,"__esModule",{value:!0}),register_model_resources_graph_service.SupportModelResourcesGraphService=void 0,register_model_resources_graph_service.SupportModelResourcesGraphService=SupportModelResourcesGraphService,Object.defineProperty(task_runner,"__esModule",{value:!0}),task_runner.TaskRunner=task_runner.createTaskRunner=task_runner.CachedGraphRunner=void 0;const inference_calculator_pb_1=inference_calculator_pb,calculator_pb_1=calculator_pb,acceleration_pb_1=acceleration_pb,external_file_pb_1=external_file_pb,graph_runner_1$1=graph_runner,register_model_resources_graph_service_1$1=register_model_resources_graph_service,NO_ASSETS=void 0,FREE_MEMORY_STREAM="free_memory",UNUSED_STREAM_SUFFIX="_unused_out",CachedGraphRunnerType=(0,register_model_resources_graph_service_1$1.SupportModelResourcesGraphService)(graph_runner_1$1.GraphRunner);class CachedGraphRunner extends CachedGraphRunnerType{}async function createTaskRunner(e,t,r,o){const i={locateFile:()=>r.wasmBinaryPath.toString()},a=await(0,graph_runner_1$1.createMediaPipeLib)(e,r.wasmLoaderPath,NO_ASSETS,t,i);return await a.setOptions(o),a}task_runner.CachedGraphRunner=CachedGraphRunner,task_runner.createTaskRunner=createTaskRunner;class TaskRunner{static async createInstance(e,t,r,o){return createTaskRunner(e,t,r,o)}constructor(e){this.graphRunner=e,this.processingErrors=[],this.latestOutputTimestamp=0,this.graphRunner.setAutoRenderToScreen(!1)}applyOptions(e){var t,r,o,i,a;const n=e.baseOptions||{};if((null===(t=e.baseOptions)||void 0===t?void 0:t.modelAssetBuffer)&&(null===(r=e.baseOptions)||void 0===r?void 0:r.modelAssetPath))throw new Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!((null===(o=this.baseOptions.getModelAsset())||void 0===o?void 0:o.hasFileContent())||(null===(i=e.baseOptions)||void 0===i?void 0:i.modelAssetBuffer)||(null===(a=e.baseOptions)||void 0===a?void 0:a.modelAssetPath)))throw new Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");return this.setAcceleration(n),n.modelAssetPath?fetch(n.modelAssetPath.toString()).then((e=>{if(e.ok)return e.arrayBuffer();throw new Error(`Failed to fetch model: ${n.modelAssetPath} (${e.status})`)})).then((e=>{this.setExternalFile(new Uint8Array(e)),this.refreshGraph(),this.onGraphRefreshed()})):(this.setExternalFile(n.modelAssetBuffer),this.refreshGraph(),this.onGraphRefreshed(),Promise.resolve())}onGraphRefreshed(){}getCalculatorGraphConfig(){let e;if(this.graphRunner.getCalculatorGraphConfig((t=>{e=calculator_pb_1.CalculatorGraphConfig.deserializeBinary(t)})),!e)throw new Error("Failed to retrieve CalculatorGraphConfig");return e}setGraph(e,t){this.graphRunner.attachErrorListener(((e,t)=>{this.processingErrors.push(new Error(t))})),this.graphRunner.registerModelResourcesGraphService(),this.graphRunner.setGraph(e,t),this.keepaliveNode=void 0,this.handleErrors()}finishProcessing(){this.graphRunner.finishProcessing(),this.handleErrors()}setLatestOutputTimestamp(e){this.latestOutputTimestamp=Math.max(this.latestOutputTimestamp,e)}getSynctheticTimestamp(){return this.latestOutputTimestamp+1}handleErrors(){try{const e=this.processingErrors.length;if(1===e)throw new Error(this.processingErrors[0].message);if(e>1)throw new Error("Encountered multiple errors: "+this.processingErrors.map((e=>e.message)).join(", "))}finally{this.processingErrors=[]}}setExternalFile(e){const t=this.baseOptions.getModelAsset()||new external_file_pb_1.ExternalFile;e&&t.setFileContent(e),this.baseOptions.setModelAsset(t)}setAcceleration(e){let t=this.baseOptions.getAcceleration();t||(t=new acceleration_pb_1.Acceleration,t.setTflite(new inference_calculator_pb_1.InferenceCalculatorOptions.Delegate.TfLite)),"delegate"in e&&("GPU"===e.delegate?t.setGpu(new inference_calculator_pb_1.InferenceCalculatorOptions.Delegate.Gpu):t.setTflite(new inference_calculator_pb_1.InferenceCalculatorOptions.Delegate.TfLite)),this.baseOptions.setAcceleration(t)}addKeepaliveNode(e){this.keepaliveNode=new calculator_pb_1.CalculatorGraphConfig.Node,this.keepaliveNode.setCalculator("PassThroughCalculator"),this.keepaliveNode.addInputStream(FREE_MEMORY_STREAM),this.keepaliveNode.addOutputStream(FREE_MEMORY_STREAM+UNUSED_STREAM_SUFFIX),e.addInputStream(FREE_MEMORY_STREAM),e.addNode(this.keepaliveNode)}keepStreamAlive(e){this.keepaliveNode.addInputStream(e),this.keepaliveNode.addOutputStream(e+UNUSED_STREAM_SUFFIX)}freeKeepaliveStreams(){this.graphRunner.addBoolToStream(!0,FREE_MEMORY_STREAM,this.latestOutputTimestamp)}close(){this.keepaliveNode=void 0,this.graphRunner.closeGraph()}}task_runner.TaskRunner=TaskRunner;var graph_runner_image_lib={};function SupportImage(e){return class extends e{get wasmImageModule(){return this.wasmModule}addGpuBufferAsImageToStream(e,t,r){this.wrapStringPtr(t,(t=>{const[o,i]=this.bindTextureToStream(e,t);this.wasmImageModule._addBoundTextureAsImageToStream(t,o,i,r)}))}attachImageListener(e,t){this.setListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmImageModule._attachImageListener(e)}))}attachImageVectorListener(e,t){this.setVectorListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmImageModule._attachImageVectorListener(e)}))}}}Object.defineProperty(graph_runner_image_lib,"__esModule",{value:!0}),graph_runner_image_lib.SupportImage=void 0,graph_runner_image_lib.SupportImage=SupportImage,Object.defineProperty(vision_task_runner,"__esModule",{value:!0}),vision_task_runner.VisionTaskRunner=vision_task_runner.VisionGraphRunner=void 0;const rect_pb_1=rect_pb,task_runner_1=task_runner,image_1$1=image,image_shader_context_1=image_shader_context,mask_1$1=mask,graph_runner_1=graph_runner,graph_runner_image_lib_1=graph_runner_image_lib,platform_utils_1=platform_utils,register_model_resources_graph_service_1=register_model_resources_graph_service,GraphRunnerVisionType=(0,register_model_resources_graph_service_1.SupportModelResourcesGraphService)((0,graph_runner_image_lib_1.SupportImage)(graph_runner_1.GraphRunner));class VisionGraphRunner extends GraphRunnerVisionType{}function createCanvas(){return"undefined"!=typeof OffscreenCanvas&&!(0,platform_utils_1.isWebKit)()?void 0:document.createElement("canvas")}vision_task_runner.VisionGraphRunner=VisionGraphRunner;class VisionTaskRunner extends task_runner_1.TaskRunner{static async createVisionInstance(e,t,r){var o;const i=null!==(o=r.canvas)&&void 0!==o?o:createCanvas();return task_runner_1.TaskRunner.createInstance(e,i,t,r)}constructor(e,t,r,o){super(e),this.graphRunner=e,this.imageStreamName=t,this.normRectStreamName=r,this.roiAllowed=o,this.shaderContext=new image_shader_context_1.MPImageShaderContext}applyOptions(e){if("runningMode"in e){const t=!!e.runningMode&&"IMAGE"!==e.runningMode;this.baseOptions.setUseStreamMode(t)}if(void 0!==e.canvas&&this.graphRunner.wasmModule.canvas!==e.canvas)throw new Error("You must create a new task to reset the canvas.");return super.applyOptions(e)}processImageData(e,t){var r;if(null===(r=this.baseOptions)||void 0===r?void 0:r.getUseStreamMode())throw new Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");this.process(e,t,this.getSynctheticTimestamp())}processVideoData(e,t,r){var o;if(!(null===(o=this.baseOptions)||void 0===o?void 0:o.getUseStreamMode()))throw new Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");this.process(e,t,r)}getImageSourceSize(e){return void 0!==e.videoWidth?[e.videoWidth,e.videoHeight]:void 0!==e.naturalWidth?[e.naturalWidth,e.naturalHeight]:[e.width,e.height]}convertToNormalizedRect(e,t){const r=new rect_pb_1.NormalizedRect;if(null==t?void 0:t.regionOfInterest){if(!this.roiAllowed)throw new Error("This task doesn't support region-of-interest.");const e=t.regionOfInterest;if(e.left>=e.right||e.top>=e.bottom)throw new Error("Expected RectF with left < right and top < bottom.");if(e.left<0||e.top<0||e.right>1||e.bottom>1)throw new Error("Expected RectF values to be in [0,1].");r.setXCenter((e.left+e.right)/2),r.setYCenter((e.top+e.bottom)/2),r.setWidth(e.right-e.left),r.setHeight(e.bottom-e.top)}else r.setXCenter(.5),r.setYCenter(.5),r.setWidth(1),r.setHeight(1);if(null==t?void 0:t.rotationDegrees){if((null==t?void 0:t.rotationDegrees)%90!=0)throw new Error("Expected rotation to be a multiple of 90°.");if(r.setRotation(-Math.PI*t.rotationDegrees/180),(null==t?void 0:t.rotationDegrees)%180!=0){const[t,o]=this.getImageSourceSize(e),i=r.getHeight()*o/t,a=r.getWidth()*t/o;r.setWidth(i),r.setHeight(a)}}return r}process(e,t,r){const o=this.convertToNormalizedRect(e,t);this.graphRunner.addProtoToStream(o.serializeBinary(),"mediapipe.NormalizedRect",this.normRectStreamName,r),this.graphRunner.addGpuBufferAsImageToStream(e,this.imageStreamName,null!=r?r:performance.now()),this.finishProcessing()}convertToMPImage(e,t){const{data:r,width:o,height:i}=e,a=o*i;let n;if(r instanceof Uint8Array)if(r.length===3*a){const e=new Uint8ClampedArray(4*a);for(let t=0;t{this.addJsFaceDetections(e),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(c,(e=>{this.setLatestOutputTimestamp(e)}));const a=e.serializeBinary();this.setGraph(new Uint8Array(a),!0)}}e.FaceDetector=u}(face_detector);var face_landmarker={},classification_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.Classification",null,o),r.exportSymbol("proto.mediapipe.ClassificationList",null,o),r.exportSymbol("proto.mediapipe.ClassificationListCollection",null,o),proto.mediapipe.Classification=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.Classification,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.Classification.displayName="proto.mediapipe.Classification"),proto.mediapipe.ClassificationList=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.ClassificationList.repeatedFields_,null)},r.inherits(proto.mediapipe.ClassificationList,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.ClassificationList.displayName="proto.mediapipe.ClassificationList"),proto.mediapipe.ClassificationListCollection=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.ClassificationListCollection.repeatedFields_,null)},r.inherits(proto.mediapipe.ClassificationListCollection,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.ClassificationListCollection.displayName="proto.mediapipe.ClassificationListCollection"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.Classification.prototype.toObject=function(e){return proto.mediapipe.Classification.toObject(e,this)},proto.mediapipe.Classification.toObject=function(e,r){var o,i={index:null==(o=t.Message.getField(r,1))?void 0:o,score:null==(o=t.Message.getOptionalFloatingPointField(r,2))?void 0:o,label:null==(o=t.Message.getField(r,3))?void 0:o,displayName:null==(o=t.Message.getField(r,4))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.Classification.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.Classification;return proto.mediapipe.Classification.deserializeBinaryFromReader(o,r)},proto.mediapipe.Classification.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readInt32();e.setIndex(r);break;case 2:r=t.readFloat();e.setScore(r);break;case 3:r=t.readString();e.setLabel(r);break;case 4:r=t.readString();e.setDisplayName(r);break;default:t.skipField()}}return e},proto.mediapipe.Classification.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.Classification.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.Classification.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeInt32(1,o),null!=(o=t.Message.getField(e,2))&&r.writeFloat(2,o),null!=(o=t.Message.getField(e,3))&&r.writeString(3,o),null!=(o=t.Message.getField(e,4))&&r.writeString(4,o)},proto.mediapipe.Classification.prototype.getIndex=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.Classification.prototype.setIndex=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.Classification.prototype.clearIndex=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.Classification.prototype.hasIndex=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.Classification.prototype.getScore=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,0)},proto.mediapipe.Classification.prototype.setScore=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.Classification.prototype.clearScore=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.Classification.prototype.hasScore=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.Classification.prototype.getLabel=function(){return t.Message.getFieldWithDefault(this,3,"")},proto.mediapipe.Classification.prototype.setLabel=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.Classification.prototype.clearLabel=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.Classification.prototype.hasLabel=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.Classification.prototype.getDisplayName=function(){return t.Message.getFieldWithDefault(this,4,"")},proto.mediapipe.Classification.prototype.setDisplayName=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.Classification.prototype.clearDisplayName=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.Classification.prototype.hasDisplayName=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.ClassificationList.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.ClassificationList.prototype.toObject=function(e){return proto.mediapipe.ClassificationList.toObject(e,this)},proto.mediapipe.ClassificationList.toObject=function(e,r){var o={classificationList:t.Message.toObjectList(r.getClassificationList(),proto.mediapipe.Classification.toObject,e)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.ClassificationList.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.ClassificationList;return proto.mediapipe.ClassificationList.deserializeBinaryFromReader(o,r)},proto.mediapipe.ClassificationList.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new proto.mediapipe.Classification;t.readMessage(r,proto.mediapipe.Classification.deserializeBinaryFromReader),e.addClassification(r)}else t.skipField()}return e},proto.mediapipe.ClassificationList.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.ClassificationList.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.ClassificationList.serializeBinaryToWriter=function(e,t){var r;(r=e.getClassificationList()).length>0&&t.writeRepeatedMessage(1,r,proto.mediapipe.Classification.serializeBinaryToWriter)},proto.mediapipe.ClassificationList.prototype.getClassificationList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.Classification,1)},proto.mediapipe.ClassificationList.prototype.setClassificationList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.ClassificationList.prototype.addClassification=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.Classification,r)},proto.mediapipe.ClassificationList.prototype.clearClassificationList=function(){return this.setClassificationList([])},proto.mediapipe.ClassificationListCollection.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.ClassificationListCollection.prototype.toObject=function(e){return proto.mediapipe.ClassificationListCollection.toObject(e,this)},proto.mediapipe.ClassificationListCollection.toObject=function(e,r){var o={classificationListList:t.Message.toObjectList(r.getClassificationListList(),proto.mediapipe.ClassificationList.toObject,e)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.ClassificationListCollection.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.ClassificationListCollection;return proto.mediapipe.ClassificationListCollection.deserializeBinaryFromReader(o,r)},proto.mediapipe.ClassificationListCollection.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new proto.mediapipe.ClassificationList;t.readMessage(r,proto.mediapipe.ClassificationList.deserializeBinaryFromReader),e.addClassificationList(r)}else t.skipField()}return e},proto.mediapipe.ClassificationListCollection.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.ClassificationListCollection.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.ClassificationListCollection.serializeBinaryToWriter=function(e,t){var r;(r=e.getClassificationListList()).length>0&&t.writeRepeatedMessage(1,r,proto.mediapipe.ClassificationList.serializeBinaryToWriter)},proto.mediapipe.ClassificationListCollection.prototype.getClassificationListList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.ClassificationList,1)},proto.mediapipe.ClassificationListCollection.prototype.setClassificationListList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.ClassificationListCollection.prototype.addClassificationList=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.ClassificationList,r)},proto.mediapipe.ClassificationListCollection.prototype.clearClassificationListList=function(){return this.setClassificationListList([])},r.object.extend(e,proto.mediapipe)}(classification_pb);var landmark_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.Landmark",null,o),r.exportSymbol("proto.mediapipe.LandmarkList",null,o),r.exportSymbol("proto.mediapipe.LandmarkListCollection",null,o),r.exportSymbol("proto.mediapipe.NormalizedLandmark",null,o),r.exportSymbol("proto.mediapipe.NormalizedLandmarkList",null,o),r.exportSymbol("proto.mediapipe.NormalizedLandmarkListCollection",null,o),proto.mediapipe.Landmark=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.Landmark,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.Landmark.displayName="proto.mediapipe.Landmark"),proto.mediapipe.LandmarkList=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.LandmarkList.repeatedFields_,null)},r.inherits(proto.mediapipe.LandmarkList,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.LandmarkList.displayName="proto.mediapipe.LandmarkList"),proto.mediapipe.LandmarkListCollection=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.LandmarkListCollection.repeatedFields_,null)},r.inherits(proto.mediapipe.LandmarkListCollection,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.LandmarkListCollection.displayName="proto.mediapipe.LandmarkListCollection"),proto.mediapipe.NormalizedLandmark=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.NormalizedLandmark,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.NormalizedLandmark.displayName="proto.mediapipe.NormalizedLandmark"),proto.mediapipe.NormalizedLandmarkList=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.NormalizedLandmarkList.repeatedFields_,null)},r.inherits(proto.mediapipe.NormalizedLandmarkList,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.NormalizedLandmarkList.displayName="proto.mediapipe.NormalizedLandmarkList"),proto.mediapipe.NormalizedLandmarkListCollection=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.NormalizedLandmarkListCollection.repeatedFields_,null)},r.inherits(proto.mediapipe.NormalizedLandmarkListCollection,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.NormalizedLandmarkListCollection.displayName="proto.mediapipe.NormalizedLandmarkListCollection"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.Landmark.prototype.toObject=function(e){return proto.mediapipe.Landmark.toObject(e,this)},proto.mediapipe.Landmark.toObject=function(e,r){var o,i={x:null==(o=t.Message.getOptionalFloatingPointField(r,1))?void 0:o,y:null==(o=t.Message.getOptionalFloatingPointField(r,2))?void 0:o,z:null==(o=t.Message.getOptionalFloatingPointField(r,3))?void 0:o,visibility:null==(o=t.Message.getOptionalFloatingPointField(r,4))?void 0:o,presence:null==(o=t.Message.getOptionalFloatingPointField(r,5))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.Landmark.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.Landmark;return proto.mediapipe.Landmark.deserializeBinaryFromReader(o,r)},proto.mediapipe.Landmark.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readFloat();e.setX(r);break;case 2:r=t.readFloat();e.setY(r);break;case 3:r=t.readFloat();e.setZ(r);break;case 4:r=t.readFloat();e.setVisibility(r);break;case 5:r=t.readFloat();e.setPresence(r);break;default:t.skipField()}}return e},proto.mediapipe.Landmark.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.Landmark.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.Landmark.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeFloat(1,o),null!=(o=t.Message.getField(e,2))&&r.writeFloat(2,o),null!=(o=t.Message.getField(e,3))&&r.writeFloat(3,o),null!=(o=t.Message.getField(e,4))&&r.writeFloat(4,o),null!=(o=t.Message.getField(e,5))&&r.writeFloat(5,o)},proto.mediapipe.Landmark.prototype.getX=function(){return t.Message.getFloatingPointFieldWithDefault(this,1,0)},proto.mediapipe.Landmark.prototype.setX=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.Landmark.prototype.clearX=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.Landmark.prototype.hasX=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.Landmark.prototype.getY=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,0)},proto.mediapipe.Landmark.prototype.setY=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.Landmark.prototype.clearY=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.Landmark.prototype.hasY=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.Landmark.prototype.getZ=function(){return t.Message.getFloatingPointFieldWithDefault(this,3,0)},proto.mediapipe.Landmark.prototype.setZ=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.Landmark.prototype.clearZ=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.Landmark.prototype.hasZ=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.Landmark.prototype.getVisibility=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,0)},proto.mediapipe.Landmark.prototype.setVisibility=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.Landmark.prototype.clearVisibility=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.Landmark.prototype.hasVisibility=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.Landmark.prototype.getPresence=function(){return t.Message.getFloatingPointFieldWithDefault(this,5,0)},proto.mediapipe.Landmark.prototype.setPresence=function(e){return t.Message.setField(this,5,e)},proto.mediapipe.Landmark.prototype.clearPresence=function(){return t.Message.setField(this,5,void 0)},proto.mediapipe.Landmark.prototype.hasPresence=function(){return null!=t.Message.getField(this,5)},proto.mediapipe.LandmarkList.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.LandmarkList.prototype.toObject=function(e){return proto.mediapipe.LandmarkList.toObject(e,this)},proto.mediapipe.LandmarkList.toObject=function(e,r){var o={landmarkList:t.Message.toObjectList(r.getLandmarkList(),proto.mediapipe.Landmark.toObject,e)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.LandmarkList.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.LandmarkList;return proto.mediapipe.LandmarkList.deserializeBinaryFromReader(o,r)},proto.mediapipe.LandmarkList.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new proto.mediapipe.Landmark;t.readMessage(r,proto.mediapipe.Landmark.deserializeBinaryFromReader),e.addLandmark(r)}else t.skipField()}return e},proto.mediapipe.LandmarkList.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.LandmarkList.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.LandmarkList.serializeBinaryToWriter=function(e,t){var r;(r=e.getLandmarkList()).length>0&&t.writeRepeatedMessage(1,r,proto.mediapipe.Landmark.serializeBinaryToWriter)},proto.mediapipe.LandmarkList.prototype.getLandmarkList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.Landmark,1)},proto.mediapipe.LandmarkList.prototype.setLandmarkList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.LandmarkList.prototype.addLandmark=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.Landmark,r)},proto.mediapipe.LandmarkList.prototype.clearLandmarkList=function(){return this.setLandmarkList([])},proto.mediapipe.LandmarkListCollection.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.LandmarkListCollection.prototype.toObject=function(e){return proto.mediapipe.LandmarkListCollection.toObject(e,this)},proto.mediapipe.LandmarkListCollection.toObject=function(e,r){var o={landmarkListList:t.Message.toObjectList(r.getLandmarkListList(),proto.mediapipe.LandmarkList.toObject,e)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.LandmarkListCollection.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.LandmarkListCollection;return proto.mediapipe.LandmarkListCollection.deserializeBinaryFromReader(o,r)},proto.mediapipe.LandmarkListCollection.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new proto.mediapipe.LandmarkList;t.readMessage(r,proto.mediapipe.LandmarkList.deserializeBinaryFromReader),e.addLandmarkList(r)}else t.skipField()}return e},proto.mediapipe.LandmarkListCollection.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.LandmarkListCollection.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.LandmarkListCollection.serializeBinaryToWriter=function(e,t){var r;(r=e.getLandmarkListList()).length>0&&t.writeRepeatedMessage(1,r,proto.mediapipe.LandmarkList.serializeBinaryToWriter)},proto.mediapipe.LandmarkListCollection.prototype.getLandmarkListList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.LandmarkList,1)},proto.mediapipe.LandmarkListCollection.prototype.setLandmarkListList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.LandmarkListCollection.prototype.addLandmarkList=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.LandmarkList,r)},proto.mediapipe.LandmarkListCollection.prototype.clearLandmarkListList=function(){return this.setLandmarkListList([])},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.NormalizedLandmark.prototype.toObject=function(e){return proto.mediapipe.NormalizedLandmark.toObject(e,this)},proto.mediapipe.NormalizedLandmark.toObject=function(e,r){var o,i={x:null==(o=t.Message.getOptionalFloatingPointField(r,1))?void 0:o,y:null==(o=t.Message.getOptionalFloatingPointField(r,2))?void 0:o,z:null==(o=t.Message.getOptionalFloatingPointField(r,3))?void 0:o,visibility:null==(o=t.Message.getOptionalFloatingPointField(r,4))?void 0:o,presence:null==(o=t.Message.getOptionalFloatingPointField(r,5))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.NormalizedLandmark.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.NormalizedLandmark;return proto.mediapipe.NormalizedLandmark.deserializeBinaryFromReader(o,r)},proto.mediapipe.NormalizedLandmark.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readFloat();e.setX(r);break;case 2:r=t.readFloat();e.setY(r);break;case 3:r=t.readFloat();e.setZ(r);break;case 4:r=t.readFloat();e.setVisibility(r);break;case 5:r=t.readFloat();e.setPresence(r);break;default:t.skipField()}}return e},proto.mediapipe.NormalizedLandmark.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.NormalizedLandmark.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.NormalizedLandmark.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeFloat(1,o),null!=(o=t.Message.getField(e,2))&&r.writeFloat(2,o),null!=(o=t.Message.getField(e,3))&&r.writeFloat(3,o),null!=(o=t.Message.getField(e,4))&&r.writeFloat(4,o),null!=(o=t.Message.getField(e,5))&&r.writeFloat(5,o)},proto.mediapipe.NormalizedLandmark.prototype.getX=function(){return t.Message.getFloatingPointFieldWithDefault(this,1,0)},proto.mediapipe.NormalizedLandmark.prototype.setX=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.NormalizedLandmark.prototype.clearX=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.NormalizedLandmark.prototype.hasX=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.NormalizedLandmark.prototype.getY=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,0)},proto.mediapipe.NormalizedLandmark.prototype.setY=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.NormalizedLandmark.prototype.clearY=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.NormalizedLandmark.prototype.hasY=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.NormalizedLandmark.prototype.getZ=function(){return t.Message.getFloatingPointFieldWithDefault(this,3,0)},proto.mediapipe.NormalizedLandmark.prototype.setZ=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.NormalizedLandmark.prototype.clearZ=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.NormalizedLandmark.prototype.hasZ=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.NormalizedLandmark.prototype.getVisibility=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,0)},proto.mediapipe.NormalizedLandmark.prototype.setVisibility=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.NormalizedLandmark.prototype.clearVisibility=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.NormalizedLandmark.prototype.hasVisibility=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.NormalizedLandmark.prototype.getPresence=function(){return t.Message.getFloatingPointFieldWithDefault(this,5,0)},proto.mediapipe.NormalizedLandmark.prototype.setPresence=function(e){return t.Message.setField(this,5,e)},proto.mediapipe.NormalizedLandmark.prototype.clearPresence=function(){return t.Message.setField(this,5,void 0)},proto.mediapipe.NormalizedLandmark.prototype.hasPresence=function(){return null!=t.Message.getField(this,5)},proto.mediapipe.NormalizedLandmarkList.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.NormalizedLandmarkList.prototype.toObject=function(e){return proto.mediapipe.NormalizedLandmarkList.toObject(e,this)},proto.mediapipe.NormalizedLandmarkList.toObject=function(e,r){var o={landmarkList:t.Message.toObjectList(r.getLandmarkList(),proto.mediapipe.NormalizedLandmark.toObject,e)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.NormalizedLandmarkList.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.NormalizedLandmarkList;return proto.mediapipe.NormalizedLandmarkList.deserializeBinaryFromReader(o,r)},proto.mediapipe.NormalizedLandmarkList.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new proto.mediapipe.NormalizedLandmark;t.readMessage(r,proto.mediapipe.NormalizedLandmark.deserializeBinaryFromReader),e.addLandmark(r)}else t.skipField()}return e},proto.mediapipe.NormalizedLandmarkList.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.NormalizedLandmarkList.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.NormalizedLandmarkList.serializeBinaryToWriter=function(e,t){var r;(r=e.getLandmarkList()).length>0&&t.writeRepeatedMessage(1,r,proto.mediapipe.NormalizedLandmark.serializeBinaryToWriter)},proto.mediapipe.NormalizedLandmarkList.prototype.getLandmarkList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.NormalizedLandmark,1)},proto.mediapipe.NormalizedLandmarkList.prototype.setLandmarkList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.NormalizedLandmarkList.prototype.addLandmark=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.NormalizedLandmark,r)},proto.mediapipe.NormalizedLandmarkList.prototype.clearLandmarkList=function(){return this.setLandmarkList([])},proto.mediapipe.NormalizedLandmarkListCollection.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.NormalizedLandmarkListCollection.prototype.toObject=function(e){return proto.mediapipe.NormalizedLandmarkListCollection.toObject(e,this)},proto.mediapipe.NormalizedLandmarkListCollection.toObject=function(e,r){var o={landmarkListList:t.Message.toObjectList(r.getLandmarkListList(),proto.mediapipe.NormalizedLandmarkList.toObject,e)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.NormalizedLandmarkListCollection.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.NormalizedLandmarkListCollection;return proto.mediapipe.NormalizedLandmarkListCollection.deserializeBinaryFromReader(o,r)},proto.mediapipe.NormalizedLandmarkListCollection.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new proto.mediapipe.NormalizedLandmarkList;t.readMessage(r,proto.mediapipe.NormalizedLandmarkList.deserializeBinaryFromReader),e.addLandmarkList(r)}else t.skipField()}return e},proto.mediapipe.NormalizedLandmarkListCollection.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.NormalizedLandmarkListCollection.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.NormalizedLandmarkListCollection.serializeBinaryToWriter=function(e,t){var r;(r=e.getLandmarkListList()).length>0&&t.writeRepeatedMessage(1,r,proto.mediapipe.NormalizedLandmarkList.serializeBinaryToWriter)},proto.mediapipe.NormalizedLandmarkListCollection.prototype.getLandmarkListList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.NormalizedLandmarkList,1)},proto.mediapipe.NormalizedLandmarkListCollection.prototype.setLandmarkListList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.NormalizedLandmarkListCollection.prototype.addLandmarkList=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.NormalizedLandmarkList,r)},proto.mediapipe.NormalizedLandmarkListCollection.prototype.clearLandmarkListList=function(){return this.setLandmarkListList([])},r.object.extend(e,proto.mediapipe)}(landmark_pb);var face_geometry_pb={},matrix_data_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.MatrixData",null,o),r.exportSymbol("proto.mediapipe.MatrixData.Layout",null,o),proto.mediapipe.MatrixData=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.MatrixData.repeatedFields_,null)},r.inherits(proto.mediapipe.MatrixData,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.MatrixData.displayName="proto.mediapipe.MatrixData"),proto.mediapipe.MatrixData.repeatedFields_=[3],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.MatrixData.prototype.toObject=function(e){return proto.mediapipe.MatrixData.toObject(e,this)},proto.mediapipe.MatrixData.toObject=function(e,r){var o,i={rows:null==(o=t.Message.getField(r,1))?void 0:o,cols:null==(o=t.Message.getField(r,2))?void 0:o,packedDataList:null==(o=t.Message.getRepeatedFloatingPointField(r,3))?void 0:o,layout:t.Message.getFieldWithDefault(r,4,0)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.MatrixData.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.MatrixData;return proto.mediapipe.MatrixData.deserializeBinaryFromReader(o,r)},proto.mediapipe.MatrixData.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readInt32();e.setRows(r);break;case 2:r=t.readInt32();e.setCols(r);break;case 3:for(var o=t.isDelimited()?t.readPackedFloat():[t.readFloat()],i=0;i0&&r.writePackedFloat(3,o),null!=(o=t.Message.getField(e,4))&&r.writeEnum(4,o)},proto.mediapipe.MatrixData.Layout={COLUMN_MAJOR:0,ROW_MAJOR:1},proto.mediapipe.MatrixData.prototype.getRows=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.MatrixData.prototype.setRows=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.MatrixData.prototype.clearRows=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.MatrixData.prototype.hasRows=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.MatrixData.prototype.getCols=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.MatrixData.prototype.setCols=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.MatrixData.prototype.clearCols=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.MatrixData.prototype.hasCols=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.MatrixData.prototype.getPackedDataList=function(){return t.Message.getRepeatedFloatingPointField(this,3)},proto.mediapipe.MatrixData.prototype.setPackedDataList=function(e){return t.Message.setField(this,3,e||[])},proto.mediapipe.MatrixData.prototype.addPackedData=function(e,r){return t.Message.addToRepeatedField(this,3,e,r)},proto.mediapipe.MatrixData.prototype.clearPackedDataList=function(){return this.setPackedDataList([])},proto.mediapipe.MatrixData.prototype.getLayout=function(){return t.Message.getFieldWithDefault(this,4,0)},proto.mediapipe.MatrixData.prototype.setLayout=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.MatrixData.prototype.clearLayout=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.MatrixData.prototype.hasLayout=function(){return null!=t.Message.getField(this,4)},r.object.extend(e,proto.mediapipe)}(matrix_data_pb);var mesh_3d_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d",null,o),r.exportSymbol("proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.PrimitiveType",null,o),r.exportSymbol("proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.VertexType",null,o),proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.repeatedFields_,null)},r.inherits(proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.displayName="proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d"),proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.repeatedFields_=[3,4],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.toObject(e,this)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.toObject=function(e,r){var o,i={vertexType:null==(o=t.Message.getField(r,1))?void 0:o,primitiveType:null==(o=t.Message.getField(r,2))?void 0:o,vertexBufferList:null==(o=t.Message.getRepeatedFloatingPointField(r,3))?void 0:o,indexBufferList:null==(o=t.Message.getRepeatedField(r,4))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d;return proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readEnum();e.setVertexType(r);break;case 2:r=t.readEnum();e.setPrimitiveType(r);break;case 3:for(var o=t.isDelimited()?t.readPackedFloat():[t.readFloat()],i=0;i0&&r.writeRepeatedFloat(3,o),(o=e.getIndexBufferList()).length>0&&r.writeRepeatedUint32(4,o)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.VertexType={VERTEX_PT:0},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.PrimitiveType={TRIANGLE:0},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.getVertexType=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.setVertexType=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.clearVertexType=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.hasVertexType=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.getPrimitiveType=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.setPrimitiveType=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.clearPrimitiveType=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.hasPrimitiveType=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.getVertexBufferList=function(){return t.Message.getRepeatedFloatingPointField(this,3)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.setVertexBufferList=function(e){return t.Message.setField(this,3,e||[])},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.addVertexBuffer=function(e,r){return t.Message.addToRepeatedField(this,3,e,r)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.clearVertexBufferList=function(){return this.setVertexBufferList([])},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.getIndexBufferList=function(){return t.Message.getRepeatedField(this,4)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.setIndexBufferList=function(e){return t.Message.setField(this,4,e||[])},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.addIndexBuffer=function(e,r){return t.Message.addToRepeatedField(this,4,e,r)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.clearIndexBufferList=function(){return this.setIndexBufferList([])},r.object.extend(e,proto.mediapipe.tasks.vision.face_geometry.proto)}(mesh_3d_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=matrix_data_pb;r.object.extend(proto,i);var a=mesh_3d_pb;r.object.extend(proto,a),r.exportSymbol("proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry",null,o),proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.displayName="proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.toObject(e,this)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.toObject=function(e,t){var r,o={mesh:(r=t.getMesh())&&a.Mesh3d.toObject(e,r),poseTransformMatrix:(r=t.getPoseTransformMatrix())&&i.MatrixData.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry;return proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new a.Mesh3d;t.readMessage(r,a.Mesh3d.deserializeBinaryFromReader),e.setMesh(r);break;case 2:r=new i.MatrixData;t.readMessage(r,i.MatrixData.deserializeBinaryFromReader),e.setPoseTransformMatrix(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.serializeBinaryToWriter=function(e,t){var r=void 0;null!=(r=e.getMesh())&&t.writeMessage(1,r,a.Mesh3d.serializeBinaryToWriter),null!=(r=e.getPoseTransformMatrix())&&t.writeMessage(2,r,i.MatrixData.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.prototype.getMesh=function(){return t.Message.getWrapperField(this,a.Mesh3d,1)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.prototype.setMesh=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.prototype.clearMesh=function(){return this.setMesh(void 0)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.prototype.hasMesh=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.prototype.getPoseTransformMatrix=function(){return t.Message.getWrapperField(this,i.MatrixData,2)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.prototype.setPoseTransformMatrix=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.prototype.clearPoseTransformMatrix=function(){return this.setPoseTransformMatrix(void 0)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.prototype.hasPoseTransformMatrix=function(){return null!=t.Message.getField(this,2)},r.object.extend(e,proto.mediapipe.tasks.vision.face_geometry.proto)}(face_geometry_pb);var face_landmarker_graph_options_pb={},face_geometry_graph_options_pb={},geometry_pipeline_calculator_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_options_pb;r.object.extend(proto,i);var a=external_file_pb;r.object.extend(proto,a),r.exportSymbol("proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions",null,o),proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.displayName="proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.toObject(e,this)},proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.toObject=function(e,t){var r,o={metadataFile:(r=t.getMetadataFile())&&a.ExternalFile.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions;return proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new a.ExternalFile;t.readMessage(r,a.ExternalFile.deserializeBinaryFromReader),e.setMetadataFile(r)}else t.skipField()}return e},proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.serializeBinaryToWriter=function(e,t){var r;null!=(r=e.getMetadataFile())&&t.writeMessage(1,r,a.ExternalFile.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.ext=new t.ExtensionFieldInfo(512499200,{ext:0},proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions,proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.toObject,0),i.CalculatorOptions.extensionsBinary[512499200]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.deserializeBinaryFromReader,!1),i.CalculatorOptions.extensions[512499200]=proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.ext,proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.prototype.getMetadataFile=function(){return t.Message.getWrapperField(this,a.ExternalFile,1)},proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.prototype.setMetadataFile=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.prototype.clearMetadataFile=function(){return this.setMetadataFile(void 0)},proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.prototype.hasMetadataFile=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.ext=new t.ExtensionFieldInfo(512499200,{ext:0},proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions,proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.toObject,0),i.CalculatorOptions.extensionsBinary[512499200]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.deserializeBinaryFromReader,!1),i.CalculatorOptions.extensions[512499200]=proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.face_geometry)}(geometry_pipeline_calculator_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_options_pb;r.object.extend(proto,i);var a=geometry_pipeline_calculator_pb;r.object.extend(proto,a),r.exportSymbol("proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions",null,o),proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.displayName="proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.toObject=function(e,t){var r,o={geometryPipelineOptions:(r=t.getGeometryPipelineOptions())&&a.FaceGeometryPipelineCalculatorOptions.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions;return proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new a.FaceGeometryPipelineCalculatorOptions;t.readMessage(r,a.FaceGeometryPipelineCalculatorOptions.deserializeBinaryFromReader),e.setGeometryPipelineOptions(r)}else t.skipField()}return e},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.serializeBinaryToWriter=function(e,t){var r;null!=(r=e.getGeometryPipelineOptions())&&t.writeMessage(1,r,a.FaceGeometryPipelineCalculatorOptions.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.ext=new t.ExtensionFieldInfo(515723506,{ext:0},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions,proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.toObject,0),i.CalculatorOptions.extensionsBinary[515723506]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.deserializeBinaryFromReader,!1),i.CalculatorOptions.extensions[515723506]=proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.ext,proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.prototype.getGeometryPipelineOptions=function(){return t.Message.getWrapperField(this,a.FaceGeometryPipelineCalculatorOptions,1)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.prototype.setGeometryPipelineOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.prototype.clearGeometryPipelineOptions=function(){return this.setGeometryPipelineOptions(void 0)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.prototype.hasGeometryPipelineOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.ext=new t.ExtensionFieldInfo(515723506,{ext:0},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions,proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.toObject,0),i.CalculatorOptions.extensionsBinary[515723506]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.deserializeBinaryFromReader,!1),i.CalculatorOptions.extensions[515723506]=proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.face_geometry.proto)}(face_geometry_graph_options_pb);var face_landmarks_detector_graph_options_pb={},face_blendshapes_graph_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n),r.exportSymbol("proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions",null,o),proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.displayName="proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.toObject=function(e,t){var r,o={baseOptions:(r=t.getBaseOptions())&&n.BaseOptions.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions;return proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r)}else t.skipField()}return e},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.serializeBinaryToWriter=function(e,t){var r;null!=(r=e.getBaseOptions())&&t.writeMessage(1,r,n.BaseOptions.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.ext=new t.ExtensionFieldInfo(508981768,{ext:0},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[508981768]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[508981768]=proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.ext,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.ext=new t.ExtensionFieldInfo(508981768,{ext:0},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[508981768]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[508981768]=proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.face_landmarker.proto)}(face_blendshapes_graph_options_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n);var s=face_blendshapes_graph_options_pb;r.object.extend(proto,s),r.exportSymbol("proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions",null,o),proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.displayName="proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.toObject=function(e,r){var o,i={baseOptions:(o=r.getBaseOptions())&&n.BaseOptions.toObject(e,o),minDetectionConfidence:t.Message.getFloatingPointFieldWithDefault(r,2,.5),smoothLandmarks:null==(o=t.Message.getBooleanField(r,4))?void 0:o,faceBlendshapesGraphOptions:(o=r.getFaceBlendshapesGraphOptions())&&s.FaceBlendshapesGraphOptions.toObject(e,o)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions;return proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=t.readFloat();e.setMinDetectionConfidence(r);break;case 4:r=t.readBool();e.setSmoothLandmarks(r);break;case 3:r=new s.FaceBlendshapesGraphOptions;t.readMessage(r,s.FaceBlendshapesGraphOptions.deserializeBinaryFromReader),e.setFaceBlendshapesGraphOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getBaseOptions())&&r.writeMessage(1,o,n.BaseOptions.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeFloat(2,o),null!=(o=t.Message.getField(e,4))&&r.writeBool(4,o),null!=(o=e.getFaceBlendshapesGraphOptions())&&r.writeMessage(3,o,s.FaceBlendshapesGraphOptions.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.ext=new t.ExtensionFieldInfo(508968149,{ext:0},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[508968149]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[508968149]=proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.ext,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.getMinDetectionConfidence=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,.5)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.setMinDetectionConfidence=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.clearMinDetectionConfidence=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.hasMinDetectionConfidence=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.getSmoothLandmarks=function(){return t.Message.getBooleanFieldWithDefault(this,4,!1)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.setSmoothLandmarks=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.clearSmoothLandmarks=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.hasSmoothLandmarks=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.getFaceBlendshapesGraphOptions=function(){return t.Message.getWrapperField(this,s.FaceBlendshapesGraphOptions,3)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.setFaceBlendshapesGraphOptions=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.clearFaceBlendshapesGraphOptions=function(){return this.setFaceBlendshapesGraphOptions(void 0)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.hasFaceBlendshapesGraphOptions=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.ext=new t.ExtensionFieldInfo(508968149,{ext:0},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[508968149]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[508968149]=proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.face_landmarker.proto)}(face_landmarks_detector_graph_options_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n);var s=face_detector_graph_options_pb;r.object.extend(proto,s);var p=face_geometry_graph_options_pb;r.object.extend(proto,p);var d=face_landmarks_detector_graph_options_pb;r.object.extend(proto,d),r.exportSymbol("proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions",null,o),proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.displayName="proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.toObject=function(e,r){var o,i={baseOptions:(o=r.getBaseOptions())&&n.BaseOptions.toObject(e,o),faceDetectorGraphOptions:(o=r.getFaceDetectorGraphOptions())&&s.FaceDetectorGraphOptions.toObject(e,o),faceLandmarksDetectorGraphOptions:(o=r.getFaceLandmarksDetectorGraphOptions())&&d.FaceLandmarksDetectorGraphOptions.toObject(e,o),minTrackingConfidence:t.Message.getFloatingPointFieldWithDefault(r,4,.5),faceGeometryGraphOptions:(o=r.getFaceGeometryGraphOptions())&&p.FaceGeometryGraphOptions.toObject(e,o)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions;return proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=new s.FaceDetectorGraphOptions;t.readMessage(r,s.FaceDetectorGraphOptions.deserializeBinaryFromReader),e.setFaceDetectorGraphOptions(r);break;case 3:r=new d.FaceLandmarksDetectorGraphOptions;t.readMessage(r,d.FaceLandmarksDetectorGraphOptions.deserializeBinaryFromReader),e.setFaceLandmarksDetectorGraphOptions(r);break;case 4:r=t.readFloat();e.setMinTrackingConfidence(r);break;case 5:r=new p.FaceGeometryGraphOptions;t.readMessage(r,p.FaceGeometryGraphOptions.deserializeBinaryFromReader),e.setFaceGeometryGraphOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getBaseOptions())&&r.writeMessage(1,o,n.BaseOptions.serializeBinaryToWriter),null!=(o=e.getFaceDetectorGraphOptions())&&r.writeMessage(2,o,s.FaceDetectorGraphOptions.serializeBinaryToWriter),null!=(o=e.getFaceLandmarksDetectorGraphOptions())&&r.writeMessage(3,o,d.FaceLandmarksDetectorGraphOptions.serializeBinaryToWriter),null!=(o=t.Message.getField(e,4))&&r.writeFloat(4,o),null!=(o=e.getFaceGeometryGraphOptions())&&r.writeMessage(5,o,p.FaceGeometryGraphOptions.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.ext=new t.ExtensionFieldInfo(508968150,{ext:0},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[508968150]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[508968150]=proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.ext,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.getFaceDetectorGraphOptions=function(){return t.Message.getWrapperField(this,s.FaceDetectorGraphOptions,2)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.setFaceDetectorGraphOptions=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.clearFaceDetectorGraphOptions=function(){return this.setFaceDetectorGraphOptions(void 0)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.hasFaceDetectorGraphOptions=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.getFaceLandmarksDetectorGraphOptions=function(){return t.Message.getWrapperField(this,d.FaceLandmarksDetectorGraphOptions,3)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.setFaceLandmarksDetectorGraphOptions=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.clearFaceLandmarksDetectorGraphOptions=function(){return this.setFaceLandmarksDetectorGraphOptions(void 0)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.hasFaceLandmarksDetectorGraphOptions=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.getMinTrackingConfidence=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,.5)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.setMinTrackingConfidence=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.clearMinTrackingConfidence=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.hasMinTrackingConfidence=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.getFaceGeometryGraphOptions=function(){return t.Message.getWrapperField(this,p.FaceGeometryGraphOptions,5)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.setFaceGeometryGraphOptions=function(e){return t.Message.setWrapperField(this,5,e)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.clearFaceGeometryGraphOptions=function(){return this.setFaceGeometryGraphOptions(void 0)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.hasFaceGeometryGraphOptions=function(){return null!=t.Message.getField(this,5)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.ext=new t.ExtensionFieldInfo(508968150,{ext:0},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[508968150]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[508968150]=proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.face_landmarker.proto)}(face_landmarker_graph_options_pb);var classifier_result={};Object.defineProperty(classifier_result,"__esModule",{value:!0}),classifier_result.convertFromClassificationResultProto=classifier_result.convertFromClassifications=void 0;const DEFAULT_INDEX$1=-1,DEFAULT_SCORE=0;function convertFromClassifications(e,t=DEFAULT_INDEX$1,r=""){return{categories:e.map((e=>{var t,r,o,i;return{index:null!==(t=e.getIndex())&&void 0!==t?t:DEFAULT_INDEX$1,score:null!==(r=e.getScore())&&void 0!==r?r:DEFAULT_SCORE,categoryName:null!==(o=e.getLabel())&&void 0!==o?o:"",displayName:null!==(i=e.getDisplayName())&&void 0!==i?i:""}})),headIndex:t,headName:r}}function convertFromClassificationsProto(e){var t,r;return convertFromClassifications(null!==(r=null===(t=e.getClassificationList())||void 0===t?void 0:t.getClassificationList())&&void 0!==r?r:[],e.getHeadIndex(),e.getHeadName())}function convertFromClassificationResultProto(e){const t={classifications:e.getClassificationsList().map((e=>convertFromClassificationsProto(e)))};return e.hasTimestampMs()&&(t.timestampMs=e.getTimestampMs()),t}classifier_result.convertFromClassifications=convertFromClassifications,classifier_result.convertFromClassificationResultProto=convertFromClassificationResultProto;var landmark_result={};function convertToLandmarks(e){var t,r,o;const i=[];for(const a of e.getLandmarkList())i.push({x:null!==(t=a.getX())&&void 0!==t?t:0,y:null!==(r=a.getY())&&void 0!==r?r:0,z:null!==(o=a.getZ())&&void 0!==o?o:0});return i}function convertToWorldLandmarks(e){var t,r,o;const i=[];for(const a of e.getLandmarkList())i.push({x:null!==(t=a.getX())&&void 0!==t?t:0,y:null!==(r=a.getY())&&void 0!==r?r:0,z:null!==(o=a.getZ())&&void 0!==o?o:0});return i}Object.defineProperty(landmark_result,"__esModule",{value:!0}),landmark_result.convertToWorldLandmarks=landmark_result.convertToLandmarks=void 0,landmark_result.convertToLandmarks=convertToLandmarks,landmark_result.convertToWorldLandmarks=convertToWorldLandmarks;var face_landmarks_connections={},exports;exports=face_landmarks_connections,Object.defineProperty(exports,"__esModule",{value:!0}),exports.FACE_LANDMARKS_TESSELATION=exports.FACE_LANDMARKS_CONTOURS=exports.FACE_LANDMARKS_FACE_OVAL=exports.FACE_LANDMARKS_RIGHT_IRIS=exports.FACE_LANDMARKS_RIGHT_EYEBROW=exports.FACE_LANDMARKS_RIGHT_EYE=exports.FACE_LANDMARKS_LEFT_IRIS=exports.FACE_LANDMARKS_LEFT_EYEBROW=exports.FACE_LANDMARKS_LEFT_EYE=exports.FACE_LANDMARKS_LIPS=void 0,exports.FACE_LANDMARKS_LIPS=[{start:61,end:146},{start:146,end:91},{start:91,end:181},{start:181,end:84},{start:84,end:17},{start:17,end:314},{start:314,end:405},{start:405,end:321},{start:321,end:375},{start:375,end:291},{start:61,end:185},{start:185,end:40},{start:40,end:39},{start:39,end:37},{start:37,end:0},{start:0,end:267},{start:267,end:269},{start:269,end:270},{start:270,end:409},{start:409,end:291},{start:78,end:95},{start:95,end:88},{start:88,end:178},{start:178,end:87},{start:87,end:14},{start:14,end:317},{start:317,end:402},{start:402,end:318},{start:318,end:324},{start:324,end:308},{start:78,end:191},{start:191,end:80},{start:80,end:81},{start:81,end:82},{start:82,end:13},{start:13,end:312},{start:312,end:311},{start:311,end:310},{start:310,end:415},{start:415,end:308}],exports.FACE_LANDMARKS_LEFT_EYE=[{start:263,end:249},{start:249,end:390},{start:390,end:373},{start:373,end:374},{start:374,end:380},{start:380,end:381},{start:381,end:382},{start:382,end:362},{start:263,end:466},{start:466,end:388},{start:388,end:387},{start:387,end:386},{start:386,end:385},{start:385,end:384},{start:384,end:398},{start:398,end:362}],exports.FACE_LANDMARKS_LEFT_EYEBROW=[{start:276,end:283},{start:283,end:282},{start:282,end:295},{start:295,end:285},{start:300,end:293},{start:293,end:334},{start:334,end:296},{start:296,end:336}],exports.FACE_LANDMARKS_LEFT_IRIS=[{start:474,end:475},{start:475,end:476},{start:476,end:477},{start:477,end:474}],exports.FACE_LANDMARKS_RIGHT_EYE=[{start:33,end:7},{start:7,end:163},{start:163,end:144},{start:144,end:145},{start:145,end:153},{start:153,end:154},{start:154,end:155},{start:155,end:133},{start:33,end:246},{start:246,end:161},{start:161,end:160},{start:160,end:159},{start:159,end:158},{start:158,end:157},{start:157,end:173},{start:173,end:133}],exports.FACE_LANDMARKS_RIGHT_EYEBROW=[{start:46,end:53},{start:53,end:52},{start:52,end:65},{start:65,end:55},{start:70,end:63},{start:63,end:105},{start:105,end:66},{start:66,end:107}],exports.FACE_LANDMARKS_RIGHT_IRIS=[{start:469,end:470},{start:470,end:471},{start:471,end:472},{start:472,end:469}],exports.FACE_LANDMARKS_FACE_OVAL=[{start:10,end:338},{start:338,end:297},{start:297,end:332},{start:332,end:284},{start:284,end:251},{start:251,end:389},{start:389,end:356},{start:356,end:454},{start:454,end:323},{start:323,end:361},{start:361,end:288},{start:288,end:397},{start:397,end:365},{start:365,end:379},{start:379,end:378},{start:378,end:400},{start:400,end:377},{start:377,end:152},{start:152,end:148},{start:148,end:176},{start:176,end:149},{start:149,end:150},{start:150,end:136},{start:136,end:172},{start:172,end:58},{start:58,end:132},{start:132,end:93},{start:93,end:234},{start:234,end:127},{start:127,end:162},{start:162,end:21},{start:21,end:54},{start:54,end:103},{start:103,end:67},{start:67,end:109},{start:109,end:10}],exports.FACE_LANDMARKS_CONTOURS=[...exports.FACE_LANDMARKS_LIPS,...exports.FACE_LANDMARKS_LEFT_EYE,...exports.FACE_LANDMARKS_LEFT_EYEBROW,...exports.FACE_LANDMARKS_RIGHT_EYE,...exports.FACE_LANDMARKS_RIGHT_EYEBROW,...exports.FACE_LANDMARKS_FACE_OVAL],exports.FACE_LANDMARKS_TESSELATION=[{start:127,end:34},{start:34,end:139},{start:139,end:127},{start:11,end:0},{start:0,end:37},{start:37,end:11},{start:232,end:231},{start:231,end:120},{start:120,end:232},{start:72,end:37},{start:37,end:39},{start:39,end:72},{start:128,end:121},{start:121,end:47},{start:47,end:128},{start:232,end:121},{start:121,end:128},{start:128,end:232},{start:104,end:69},{start:69,end:67},{start:67,end:104},{start:175,end:171},{start:171,end:148},{start:148,end:175},{start:118,end:50},{start:50,end:101},{start:101,end:118},{start:73,end:39},{start:39,end:40},{start:40,end:73},{start:9,end:151},{start:151,end:108},{start:108,end:9},{start:48,end:115},{start:115,end:131},{start:131,end:48},{start:194,end:204},{start:204,end:211},{start:211,end:194},{start:74,end:40},{start:40,end:185},{start:185,end:74},{start:80,end:42},{start:42,end:183},{start:183,end:80},{start:40,end:92},{start:92,end:186},{start:186,end:40},{start:230,end:229},{start:229,end:118},{start:118,end:230},{start:202,end:212},{start:212,end:214},{start:214,end:202},{start:83,end:18},{start:18,end:17},{start:17,end:83},{start:76,end:61},{start:61,end:146},{start:146,end:76},{start:160,end:29},{start:29,end:30},{start:30,end:160},{start:56,end:157},{start:157,end:173},{start:173,end:56},{start:106,end:204},{start:204,end:194},{start:194,end:106},{start:135,end:214},{start:214,end:192},{start:192,end:135},{start:203,end:165},{start:165,end:98},{start:98,end:203},{start:21,end:71},{start:71,end:68},{start:68,end:21},{start:51,end:45},{start:45,end:4},{start:4,end:51},{start:144,end:24},{start:24,end:23},{start:23,end:144},{start:77,end:146},{start:146,end:91},{start:91,end:77},{start:205,end:50},{start:50,end:187},{start:187,end:205},{start:201,end:200},{start:200,end:18},{start:18,end:201},{start:91,end:106},{start:106,end:182},{start:182,end:91},{start:90,end:91},{start:91,end:181},{start:181,end:90},{start:85,end:84},{start:84,end:17},{start:17,end:85},{start:206,end:203},{start:203,end:36},{start:36,end:206},{start:148,end:171},{start:171,end:140},{start:140,end:148},{start:92,end:40},{start:40,end:39},{start:39,end:92},{start:193,end:189},{start:189,end:244},{start:244,end:193},{start:159,end:158},{start:158,end:28},{start:28,end:159},{start:247,end:246},{start:246,end:161},{start:161,end:247},{start:236,end:3},{start:3,end:196},{start:196,end:236},{start:54,end:68},{start:68,end:104},{start:104,end:54},{start:193,end:168},{start:168,end:8},{start:8,end:193},{start:117,end:228},{start:228,end:31},{start:31,end:117},{start:189,end:193},{start:193,end:55},{start:55,end:189},{start:98,end:97},{start:97,end:99},{start:99,end:98},{start:126,end:47},{start:47,end:100},{start:100,end:126},{start:166,end:79},{start:79,end:218},{start:218,end:166},{start:155,end:154},{start:154,end:26},{start:26,end:155},{start:209,end:49},{start:49,end:131},{start:131,end:209},{start:135,end:136},{start:136,end:150},{start:150,end:135},{start:47,end:126},{start:126,end:217},{start:217,end:47},{start:223,end:52},{start:52,end:53},{start:53,end:223},{start:45,end:51},{start:51,end:134},{start:134,end:45},{start:211,end:170},{start:170,end:140},{start:140,end:211},{start:67,end:69},{start:69,end:108},{start:108,end:67},{start:43,end:106},{start:106,end:91},{start:91,end:43},{start:230,end:119},{start:119,end:120},{start:120,end:230},{start:226,end:130},{start:130,end:247},{start:247,end:226},{start:63,end:53},{start:53,end:52},{start:52,end:63},{start:238,end:20},{start:20,end:242},{start:242,end:238},{start:46,end:70},{start:70,end:156},{start:156,end:46},{start:78,end:62},{start:62,end:96},{start:96,end:78},{start:46,end:53},{start:53,end:63},{start:63,end:46},{start:143,end:34},{start:34,end:227},{start:227,end:143},{start:123,end:117},{start:117,end:111},{start:111,end:123},{start:44,end:125},{start:125,end:19},{start:19,end:44},{start:236,end:134},{start:134,end:51},{start:51,end:236},{start:216,end:206},{start:206,end:205},{start:205,end:216},{start:154,end:153},{start:153,end:22},{start:22,end:154},{start:39,end:37},{start:37,end:167},{start:167,end:39},{start:200,end:201},{start:201,end:208},{start:208,end:200},{start:36,end:142},{start:142,end:100},{start:100,end:36},{start:57,end:212},{start:212,end:202},{start:202,end:57},{start:20,end:60},{start:60,end:99},{start:99,end:20},{start:28,end:158},{start:158,end:157},{start:157,end:28},{start:35,end:226},{start:226,end:113},{start:113,end:35},{start:160,end:159},{start:159,end:27},{start:27,end:160},{start:204,end:202},{start:202,end:210},{start:210,end:204},{start:113,end:225},{start:225,end:46},{start:46,end:113},{start:43,end:202},{start:202,end:204},{start:204,end:43},{start:62,end:76},{start:76,end:77},{start:77,end:62},{start:137,end:123},{start:123,end:116},{start:116,end:137},{start:41,end:38},{start:38,end:72},{start:72,end:41},{start:203,end:129},{start:129,end:142},{start:142,end:203},{start:64,end:98},{start:98,end:240},{start:240,end:64},{start:49,end:102},{start:102,end:64},{start:64,end:49},{start:41,end:73},{start:73,end:74},{start:74,end:41},{start:212,end:216},{start:216,end:207},{start:207,end:212},{start:42,end:74},{start:74,end:184},{start:184,end:42},{start:169,end:170},{start:170,end:211},{start:211,end:169},{start:170,end:149},{start:149,end:176},{start:176,end:170},{start:105,end:66},{start:66,end:69},{start:69,end:105},{start:122,end:6},{start:6,end:168},{start:168,end:122},{start:123,end:147},{start:147,end:187},{start:187,end:123},{start:96,end:77},{start:77,end:90},{start:90,end:96},{start:65,end:55},{start:55,end:107},{start:107,end:65},{start:89,end:90},{start:90,end:180},{start:180,end:89},{start:101,end:100},{start:100,end:120},{start:120,end:101},{start:63,end:105},{start:105,end:104},{start:104,end:63},{start:93,end:137},{start:137,end:227},{start:227,end:93},{start:15,end:86},{start:86,end:85},{start:85,end:15},{start:129,end:102},{start:102,end:49},{start:49,end:129},{start:14,end:87},{start:87,end:86},{start:86,end:14},{start:55,end:8},{start:8,end:9},{start:9,end:55},{start:100,end:47},{start:47,end:121},{start:121,end:100},{start:145,end:23},{start:23,end:22},{start:22,end:145},{start:88,end:89},{start:89,end:179},{start:179,end:88},{start:6,end:122},{start:122,end:196},{start:196,end:6},{start:88,end:95},{start:95,end:96},{start:96,end:88},{start:138,end:172},{start:172,end:136},{start:136,end:138},{start:215,end:58},{start:58,end:172},{start:172,end:215},{start:115,end:48},{start:48,end:219},{start:219,end:115},{start:42,end:80},{start:80,end:81},{start:81,end:42},{start:195,end:3},{start:3,end:51},{start:51,end:195},{start:43,end:146},{start:146,end:61},{start:61,end:43},{start:171,end:175},{start:175,end:199},{start:199,end:171},{start:81,end:82},{start:82,end:38},{start:38,end:81},{start:53,end:46},{start:46,end:225},{start:225,end:53},{start:144,end:163},{start:163,end:110},{start:110,end:144},{start:52,end:65},{start:65,end:66},{start:66,end:52},{start:229,end:228},{start:228,end:117},{start:117,end:229},{start:34,end:127},{start:127,end:234},{start:234,end:34},{start:107,end:108},{start:108,end:69},{start:69,end:107},{start:109,end:108},{start:108,end:151},{start:151,end:109},{start:48,end:64},{start:64,end:235},{start:235,end:48},{start:62,end:78},{start:78,end:191},{start:191,end:62},{start:129,end:209},{start:209,end:126},{start:126,end:129},{start:111,end:35},{start:35,end:143},{start:143,end:111},{start:117,end:123},{start:123,end:50},{start:50,end:117},{start:222,end:65},{start:65,end:52},{start:52,end:222},{start:19,end:125},{start:125,end:141},{start:141,end:19},{start:221,end:55},{start:55,end:65},{start:65,end:221},{start:3,end:195},{start:195,end:197},{start:197,end:3},{start:25,end:7},{start:7,end:33},{start:33,end:25},{start:220,end:237},{start:237,end:44},{start:44,end:220},{start:70,end:71},{start:71,end:139},{start:139,end:70},{start:122,end:193},{start:193,end:245},{start:245,end:122},{start:247,end:130},{start:130,end:33},{start:33,end:247},{start:71,end:21},{start:21,end:162},{start:162,end:71},{start:170,end:169},{start:169,end:150},{start:150,end:170},{start:188,end:174},{start:174,end:196},{start:196,end:188},{start:216,end:186},{start:186,end:92},{start:92,end:216},{start:2,end:97},{start:97,end:167},{start:167,end:2},{start:141,end:125},{start:125,end:241},{start:241,end:141},{start:164,end:167},{start:167,end:37},{start:37,end:164},{start:72,end:38},{start:38,end:12},{start:12,end:72},{start:38,end:82},{start:82,end:13},{start:13,end:38},{start:63,end:68},{start:68,end:71},{start:71,end:63},{start:226,end:35},{start:35,end:111},{start:111,end:226},{start:101,end:50},{start:50,end:205},{start:205,end:101},{start:206,end:92},{start:92,end:165},{start:165,end:206},{start:209,end:198},{start:198,end:217},{start:217,end:209},{start:165,end:167},{start:167,end:97},{start:97,end:165},{start:220,end:115},{start:115,end:218},{start:218,end:220},{start:133,end:112},{start:112,end:243},{start:243,end:133},{start:239,end:238},{start:238,end:241},{start:241,end:239},{start:214,end:135},{start:135,end:169},{start:169,end:214},{start:190,end:173},{start:173,end:133},{start:133,end:190},{start:171,end:208},{start:208,end:32},{start:32,end:171},{start:125,end:44},{start:44,end:237},{start:237,end:125},{start:86,end:87},{start:87,end:178},{start:178,end:86},{start:85,end:86},{start:86,end:179},{start:179,end:85},{start:84,end:85},{start:85,end:180},{start:180,end:84},{start:83,end:84},{start:84,end:181},{start:181,end:83},{start:201,end:83},{start:83,end:182},{start:182,end:201},{start:137,end:93},{start:93,end:132},{start:132,end:137},{start:76,end:62},{start:62,end:183},{start:183,end:76},{start:61,end:76},{start:76,end:184},{start:184,end:61},{start:57,end:61},{start:61,end:185},{start:185,end:57},{start:212,end:57},{start:57,end:186},{start:186,end:212},{start:214,end:207},{start:207,end:187},{start:187,end:214},{start:34,end:143},{start:143,end:156},{start:156,end:34},{start:79,end:239},{start:239,end:237},{start:237,end:79},{start:123,end:137},{start:137,end:177},{start:177,end:123},{start:44,end:1},{start:1,end:4},{start:4,end:44},{start:201,end:194},{start:194,end:32},{start:32,end:201},{start:64,end:102},{start:102,end:129},{start:129,end:64},{start:213,end:215},{start:215,end:138},{start:138,end:213},{start:59,end:166},{start:166,end:219},{start:219,end:59},{start:242,end:99},{start:99,end:97},{start:97,end:242},{start:2,end:94},{start:94,end:141},{start:141,end:2},{start:75,end:59},{start:59,end:235},{start:235,end:75},{start:24,end:110},{start:110,end:228},{start:228,end:24},{start:25,end:130},{start:130,end:226},{start:226,end:25},{start:23,end:24},{start:24,end:229},{start:229,end:23},{start:22,end:23},{start:23,end:230},{start:230,end:22},{start:26,end:22},{start:22,end:231},{start:231,end:26},{start:112,end:26},{start:26,end:232},{start:232,end:112},{start:189,end:190},{start:190,end:243},{start:243,end:189},{start:221,end:56},{start:56,end:190},{start:190,end:221},{start:28,end:56},{start:56,end:221},{start:221,end:28},{start:27,end:28},{start:28,end:222},{start:222,end:27},{start:29,end:27},{start:27,end:223},{start:223,end:29},{start:30,end:29},{start:29,end:224},{start:224,end:30},{start:247,end:30},{start:30,end:225},{start:225,end:247},{start:238,end:79},{start:79,end:20},{start:20,end:238},{start:166,end:59},{start:59,end:75},{start:75,end:166},{start:60,end:75},{start:75,end:240},{start:240,end:60},{start:147,end:177},{start:177,end:215},{start:215,end:147},{start:20,end:79},{start:79,end:166},{start:166,end:20},{start:187,end:147},{start:147,end:213},{start:213,end:187},{start:112,end:233},{start:233,end:244},{start:244,end:112},{start:233,end:128},{start:128,end:245},{start:245,end:233},{start:128,end:114},{start:114,end:188},{start:188,end:128},{start:114,end:217},{start:217,end:174},{start:174,end:114},{start:131,end:115},{start:115,end:220},{start:220,end:131},{start:217,end:198},{start:198,end:236},{start:236,end:217},{start:198,end:131},{start:131,end:134},{start:134,end:198},{start:177,end:132},{start:132,end:58},{start:58,end:177},{start:143,end:35},{start:35,end:124},{start:124,end:143},{start:110,end:163},{start:163,end:7},{start:7,end:110},{start:228,end:110},{start:110,end:25},{start:25,end:228},{start:356,end:389},{start:389,end:368},{start:368,end:356},{start:11,end:302},{start:302,end:267},{start:267,end:11},{start:452,end:350},{start:350,end:349},{start:349,end:452},{start:302,end:303},{start:303,end:269},{start:269,end:302},{start:357,end:343},{start:343,end:277},{start:277,end:357},{start:452,end:453},{start:453,end:357},{start:357,end:452},{start:333,end:332},{start:332,end:297},{start:297,end:333},{start:175,end:152},{start:152,end:377},{start:377,end:175},{start:347,end:348},{start:348,end:330},{start:330,end:347},{start:303,end:304},{start:304,end:270},{start:270,end:303},{start:9,end:336},{start:336,end:337},{start:337,end:9},{start:278,end:279},{start:279,end:360},{start:360,end:278},{start:418,end:262},{start:262,end:431},{start:431,end:418},{start:304,end:408},{start:408,end:409},{start:409,end:304},{start:310,end:415},{start:415,end:407},{start:407,end:310},{start:270,end:409},{start:409,end:410},{start:410,end:270},{start:450,end:348},{start:348,end:347},{start:347,end:450},{start:422,end:430},{start:430,end:434},{start:434,end:422},{start:313,end:314},{start:314,end:17},{start:17,end:313},{start:306,end:307},{start:307,end:375},{start:375,end:306},{start:387,end:388},{start:388,end:260},{start:260,end:387},{start:286,end:414},{start:414,end:398},{start:398,end:286},{start:335,end:406},{start:406,end:418},{start:418,end:335},{start:364,end:367},{start:367,end:416},{start:416,end:364},{start:423,end:358},{start:358,end:327},{start:327,end:423},{start:251,end:284},{start:284,end:298},{start:298,end:251},{start:281,end:5},{start:5,end:4},{start:4,end:281},{start:373,end:374},{start:374,end:253},{start:253,end:373},{start:307,end:320},{start:320,end:321},{start:321,end:307},{start:425,end:427},{start:427,end:411},{start:411,end:425},{start:421,end:313},{start:313,end:18},{start:18,end:421},{start:321,end:405},{start:405,end:406},{start:406,end:321},{start:320,end:404},{start:404,end:405},{start:405,end:320},{start:315,end:16},{start:16,end:17},{start:17,end:315},{start:426,end:425},{start:425,end:266},{start:266,end:426},{start:377,end:400},{start:400,end:369},{start:369,end:377},{start:322,end:391},{start:391,end:269},{start:269,end:322},{start:417,end:465},{start:465,end:464},{start:464,end:417},{start:386,end:257},{start:257,end:258},{start:258,end:386},{start:466,end:260},{start:260,end:388},{start:388,end:466},{start:456,end:399},{start:399,end:419},{start:419,end:456},{start:284,end:332},{start:332,end:333},{start:333,end:284},{start:417,end:285},{start:285,end:8},{start:8,end:417},{start:346,end:340},{start:340,end:261},{start:261,end:346},{start:413,end:441},{start:441,end:285},{start:285,end:413},{start:327,end:460},{start:460,end:328},{start:328,end:327},{start:355,end:371},{start:371,end:329},{start:329,end:355},{start:392,end:439},{start:439,end:438},{start:438,end:392},{start:382,end:341},{start:341,end:256},{start:256,end:382},{start:429,end:420},{start:420,end:360},{start:360,end:429},{start:364,end:394},{start:394,end:379},{start:379,end:364},{start:277,end:343},{start:343,end:437},{start:437,end:277},{start:443,end:444},{start:444,end:283},{start:283,end:443},{start:275,end:440},{start:440,end:363},{start:363,end:275},{start:431,end:262},{start:262,end:369},{start:369,end:431},{start:297,end:338},{start:338,end:337},{start:337,end:297},{start:273,end:375},{start:375,end:321},{start:321,end:273},{start:450,end:451},{start:451,end:349},{start:349,end:450},{start:446,end:342},{start:342,end:467},{start:467,end:446},{start:293,end:334},{start:334,end:282},{start:282,end:293},{start:458,end:461},{start:461,end:462},{start:462,end:458},{start:276,end:353},{start:353,end:383},{start:383,end:276},{start:308,end:324},{start:324,end:325},{start:325,end:308},{start:276,end:300},{start:300,end:293},{start:293,end:276},{start:372,end:345},{start:345,end:447},{start:447,end:372},{start:352,end:345},{start:345,end:340},{start:340,end:352},{start:274,end:1},{start:1,end:19},{start:19,end:274},{start:456,end:248},{start:248,end:281},{start:281,end:456},{start:436,end:427},{start:427,end:425},{start:425,end:436},{start:381,end:256},{start:256,end:252},{start:252,end:381},{start:269,end:391},{start:391,end:393},{start:393,end:269},{start:200,end:199},{start:199,end:428},{start:428,end:200},{start:266,end:330},{start:330,end:329},{start:329,end:266},{start:287,end:273},{start:273,end:422},{start:422,end:287},{start:250,end:462},{start:462,end:328},{start:328,end:250},{start:258,end:286},{start:286,end:384},{start:384,end:258},{start:265,end:353},{start:353,end:342},{start:342,end:265},{start:387,end:259},{start:259,end:257},{start:257,end:387},{start:424,end:431},{start:431,end:430},{start:430,end:424},{start:342,end:353},{start:353,end:276},{start:276,end:342},{start:273,end:335},{start:335,end:424},{start:424,end:273},{start:292,end:325},{start:325,end:307},{start:307,end:292},{start:366,end:447},{start:447,end:345},{start:345,end:366},{start:271,end:303},{start:303,end:302},{start:302,end:271},{start:423,end:266},{start:266,end:371},{start:371,end:423},{start:294,end:455},{start:455,end:460},{start:460,end:294},{start:279,end:278},{start:278,end:294},{start:294,end:279},{start:271,end:272},{start:272,end:304},{start:304,end:271},{start:432,end:434},{start:434,end:427},{start:427,end:432},{start:272,end:407},{start:407,end:408},{start:408,end:272},{start:394,end:430},{start:430,end:431},{start:431,end:394},{start:395,end:369},{start:369,end:400},{start:400,end:395},{start:334,end:333},{start:333,end:299},{start:299,end:334},{start:351,end:417},{start:417,end:168},{start:168,end:351},{start:352,end:280},{start:280,end:411},{start:411,end:352},{start:325,end:319},{start:319,end:320},{start:320,end:325},{start:295,end:296},{start:296,end:336},{start:336,end:295},{start:319,end:403},{start:403,end:404},{start:404,end:319},{start:330,end:348},{start:348,end:349},{start:349,end:330},{start:293,end:298},{start:298,end:333},{start:333,end:293},{start:323,end:454},{start:454,end:447},{start:447,end:323},{start:15,end:16},{start:16,end:315},{start:315,end:15},{start:358,end:429},{start:429,end:279},{start:279,end:358},{start:14,end:15},{start:15,end:316},{start:316,end:14},{start:285,end:336},{start:336,end:9},{start:9,end:285},{start:329,end:349},{start:349,end:350},{start:350,end:329},{start:374,end:380},{start:380,end:252},{start:252,end:374},{start:318,end:402},{start:402,end:403},{start:403,end:318},{start:6,end:197},{start:197,end:419},{start:419,end:6},{start:318,end:319},{start:319,end:325},{start:325,end:318},{start:367,end:364},{start:364,end:365},{start:365,end:367},{start:435,end:367},{start:367,end:397},{start:397,end:435},{start:344,end:438},{start:438,end:439},{start:439,end:344},{start:272,end:271},{start:271,end:311},{start:311,end:272},{start:195,end:5},{start:5,end:281},{start:281,end:195},{start:273,end:287},{start:287,end:291},{start:291,end:273},{start:396,end:428},{start:428,end:199},{start:199,end:396},{start:311,end:271},{start:271,end:268},{start:268,end:311},{start:283,end:444},{start:444,end:445},{start:445,end:283},{start:373,end:254},{start:254,end:339},{start:339,end:373},{start:282,end:334},{start:334,end:296},{start:296,end:282},{start:449,end:347},{start:347,end:346},{start:346,end:449},{start:264,end:447},{start:447,end:454},{start:454,end:264},{start:336,end:296},{start:296,end:299},{start:299,end:336},{start:338,end:10},{start:10,end:151},{start:151,end:338},{start:278,end:439},{start:439,end:455},{start:455,end:278},{start:292,end:407},{start:407,end:415},{start:415,end:292},{start:358,end:371},{start:371,end:355},{start:355,end:358},{start:340,end:345},{start:345,end:372},{start:372,end:340},{start:346,end:347},{start:347,end:280},{start:280,end:346},{start:442,end:443},{start:443,end:282},{start:282,end:442},{start:19,end:94},{start:94,end:370},{start:370,end:19},{start:441,end:442},{start:442,end:295},{start:295,end:441},{start:248,end:419},{start:419,end:197},{start:197,end:248},{start:263,end:255},{start:255,end:359},{start:359,end:263},{start:440,end:275},{start:275,end:274},{start:274,end:440},{start:300,end:383},{start:383,end:368},{start:368,end:300},{start:351,end:412},{start:412,end:465},{start:465,end:351},{start:263,end:467},{start:467,end:466},{start:466,end:263},{start:301,end:368},{start:368,end:389},{start:389,end:301},{start:395,end:378},{start:378,end:379},{start:379,end:395},{start:412,end:351},{start:351,end:419},{start:419,end:412},{start:436,end:426},{start:426,end:322},{start:322,end:436},{start:2,end:164},{start:164,end:393},{start:393,end:2},{start:370,end:462},{start:462,end:461},{start:461,end:370},{start:164,end:0},{start:0,end:267},{start:267,end:164},{start:302,end:11},{start:11,end:12},{start:12,end:302},{start:268,end:12},{start:12,end:13},{start:13,end:268},{start:293,end:300},{start:300,end:301},{start:301,end:293},{start:446,end:261},{start:261,end:340},{start:340,end:446},{start:330,end:266},{start:266,end:425},{start:425,end:330},{start:426,end:423},{start:423,end:391},{start:391,end:426},{start:429,end:355},{start:355,end:437},{start:437,end:429},{start:391,end:327},{start:327,end:326},{start:326,end:391},{start:440,end:457},{start:457,end:438},{start:438,end:440},{start:341,end:382},{start:382,end:362},{start:362,end:341},{start:459,end:457},{start:457,end:461},{start:461,end:459},{start:434,end:430},{start:430,end:394},{start:394,end:434},{start:414,end:463},{start:463,end:362},{start:362,end:414},{start:396,end:369},{start:369,end:262},{start:262,end:396},{start:354,end:461},{start:461,end:457},{start:457,end:354},{start:316,end:403},{start:403,end:402},{start:402,end:316},{start:315,end:404},{start:404,end:403},{start:403,end:315},{start:314,end:405},{start:405,end:404},{start:404,end:314},{start:313,end:406},{start:406,end:405},{start:405,end:313},{start:421,end:418},{start:418,end:406},{start:406,end:421},{start:366,end:401},{start:401,end:361},{start:361,end:366},{start:306,end:408},{start:408,end:407},{start:407,end:306},{start:291,end:409},{start:409,end:408},{start:408,end:291},{start:287,end:410},{start:410,end:409},{start:409,end:287},{start:432,end:436},{start:436,end:410},{start:410,end:432},{start:434,end:416},{start:416,end:411},{start:411,end:434},{start:264,end:368},{start:368,end:383},{start:383,end:264},{start:309,end:438},{start:438,end:457},{start:457,end:309},{start:352,end:376},{start:376,end:401},{start:401,end:352},{start:274,end:275},{start:275,end:4},{start:4,end:274},{start:421,end:428},{start:428,end:262},{start:262,end:421},{start:294,end:327},{start:327,end:358},{start:358,end:294},{start:433,end:416},{start:416,end:367},{start:367,end:433},{start:289,end:455},{start:455,end:439},{start:439,end:289},{start:462,end:370},{start:370,end:326},{start:326,end:462},{start:2,end:326},{start:326,end:370},{start:370,end:2},{start:305,end:460},{start:460,end:455},{start:455,end:305},{start:254,end:449},{start:449,end:448},{start:448,end:254},{start:255,end:261},{start:261,end:446},{start:446,end:255},{start:253,end:450},{start:450,end:449},{start:449,end:253},{start:252,end:451},{start:451,end:450},{start:450,end:252},{start:256,end:452},{start:452,end:451},{start:451,end:256},{start:341,end:453},{start:453,end:452},{start:452,end:341},{start:413,end:464},{start:464,end:463},{start:463,end:413},{start:441,end:413},{start:413,end:414},{start:414,end:441},{start:258,end:442},{start:442,end:441},{start:441,end:258},{start:257,end:443},{start:443,end:442},{start:442,end:257},{start:259,end:444},{start:444,end:443},{start:443,end:259},{start:260,end:445},{start:445,end:444},{start:444,end:260},{start:467,end:342},{start:342,end:445},{start:445,end:467},{start:459,end:458},{start:458,end:250},{start:250,end:459},{start:289,end:392},{start:392,end:290},{start:290,end:289},{start:290,end:328},{start:328,end:460},{start:460,end:290},{start:376,end:433},{start:433,end:435},{start:435,end:376},{start:250,end:290},{start:290,end:392},{start:392,end:250},{start:411,end:416},{start:416,end:433},{start:433,end:411},{start:341,end:463},{start:463,end:464},{start:464,end:341},{start:453,end:464},{start:464,end:465},{start:465,end:453},{start:357,end:465},{start:465,end:412},{start:412,end:357},{start:343,end:412},{start:412,end:399},{start:399,end:343},{start:360,end:363},{start:363,end:440},{start:440,end:360},{start:437,end:399},{start:399,end:456},{start:456,end:437},{start:420,end:456},{start:456,end:363},{start:363,end:420},{start:401,end:435},{start:435,end:288},{start:288,end:401},{start:372,end:383},{start:383,end:353},{start:353,end:372},{start:339,end:255},{start:255,end:249},{start:249,end:339},{start:448,end:261},{start:261,end:255},{start:255,end:448},{start:133,end:243},{start:243,end:190},{start:190,end:133},{start:133,end:155},{start:155,end:112},{start:112,end:133},{start:33,end:246},{start:246,end:247},{start:247,end:33},{start:33,end:130},{start:130,end:25},{start:25,end:33},{start:398,end:384},{start:384,end:286},{start:286,end:398},{start:362,end:398},{start:398,end:414},{start:414,end:362},{start:362,end:463},{start:463,end:341},{start:341,end:362},{start:263,end:359},{start:359,end:467},{start:467,end:263},{start:263,end:249},{start:249,end:255},{start:255,end:263},{start:466,end:467},{start:467,end:260},{start:260,end:466},{start:75,end:60},{start:60,end:166},{start:166,end:75},{start:238,end:239},{start:239,end:79},{start:79,end:238},{start:162,end:127},{start:127,end:139},{start:139,end:162},{start:72,end:11},{start:11,end:37},{start:37,end:72},{start:121,end:232},{start:232,end:120},{start:120,end:121},{start:73,end:72},{start:72,end:39},{start:39,end:73},{start:114,end:128},{start:128,end:47},{start:47,end:114},{start:233,end:232},{start:232,end:128},{start:128,end:233},{start:103,end:104},{start:104,end:67},{start:67,end:103},{start:152,end:175},{start:175,end:148},{start:148,end:152},{start:119,end:118},{start:118,end:101},{start:101,end:119},{start:74,end:73},{start:73,end:40},{start:40,end:74},{start:107,end:9},{start:9,end:108},{start:108,end:107},{start:49,end:48},{start:48,end:131},{start:131,end:49},{start:32,end:194},{start:194,end:211},{start:211,end:32},{start:184,end:74},{start:74,end:185},{start:185,end:184},{start:191,end:80},{start:80,end:183},{start:183,end:191},{start:185,end:40},{start:40,end:186},{start:186,end:185},{start:119,end:230},{start:230,end:118},{start:118,end:119},{start:210,end:202},{start:202,end:214},{start:214,end:210},{start:84,end:83},{start:83,end:17},{start:17,end:84},{start:77,end:76},{start:76,end:146},{start:146,end:77},{start:161,end:160},{start:160,end:30},{start:30,end:161},{start:190,end:56},{start:56,end:173},{start:173,end:190},{start:182,end:106},{start:106,end:194},{start:194,end:182},{start:138,end:135},{start:135,end:192},{start:192,end:138},{start:129,end:203},{start:203,end:98},{start:98,end:129},{start:54,end:21},{start:21,end:68},{start:68,end:54},{start:5,end:51},{start:51,end:4},{start:4,end:5},{start:145,end:144},{start:144,end:23},{start:23,end:145},{start:90,end:77},{start:77,end:91},{start:91,end:90},{start:207,end:205},{start:205,end:187},{start:187,end:207},{start:83,end:201},{start:201,end:18},{start:18,end:83},{start:181,end:91},{start:91,end:182},{start:182,end:181},{start:180,end:90},{start:90,end:181},{start:181,end:180},{start:16,end:85},{start:85,end:17},{start:17,end:16},{start:205,end:206},{start:206,end:36},{start:36,end:205},{start:176,end:148},{start:148,end:140},{start:140,end:176},{start:165,end:92},{start:92,end:39},{start:39,end:165},{start:245,end:193},{start:193,end:244},{start:244,end:245},{start:27,end:159},{start:159,end:28},{start:28,end:27},{start:30,end:247},{start:247,end:161},{start:161,end:30},{start:174,end:236},{start:236,end:196},{start:196,end:174},{start:103,end:54},{start:54,end:104},{start:104,end:103},{start:55,end:193},{start:193,end:8},{start:8,end:55},{start:111,end:117},{start:117,end:31},{start:31,end:111},{start:221,end:189},{start:189,end:55},{start:55,end:221},{start:240,end:98},{start:98,end:99},{start:99,end:240},{start:142,end:126},{start:126,end:100},{start:100,end:142},{start:219,end:166},{start:166,end:218},{start:218,end:219},{start:112,end:155},{start:155,end:26},{start:26,end:112},{start:198,end:209},{start:209,end:131},{start:131,end:198},{start:169,end:135},{start:135,end:150},{start:150,end:169},{start:114,end:47},{start:47,end:217},{start:217,end:114},{start:224,end:223},{start:223,end:53},{start:53,end:224},{start:220,end:45},{start:45,end:134},{start:134,end:220},{start:32,end:211},{start:211,end:140},{start:140,end:32},{start:109,end:67},{start:67,end:108},{start:108,end:109},{start:146,end:43},{start:43,end:91},{start:91,end:146},{start:231,end:230},{start:230,end:120},{start:120,end:231},{start:113,end:226},{start:226,end:247},{start:247,end:113},{start:105,end:63},{start:63,end:52},{start:52,end:105},{start:241,end:238},{start:238,end:242},{start:242,end:241},{start:124,end:46},{start:46,end:156},{start:156,end:124},{start:95,end:78},{start:78,end:96},{start:96,end:95},{start:70,end:46},{start:46,end:63},{start:63,end:70},{start:116,end:143},{start:143,end:227},{start:227,end:116},{start:116,end:123},{start:123,end:111},{start:111,end:116},{start:1,end:44},{start:44,end:19},{start:19,end:1},{start:3,end:236},{start:236,end:51},{start:51,end:3},{start:207,end:216},{start:216,end:205},{start:205,end:207},{start:26,end:154},{start:154,end:22},{start:22,end:26},{start:165,end:39},{start:39,end:167},{start:167,end:165},{start:199,end:200},{start:200,end:208},{start:208,end:199},{start:101,end:36},{start:36,end:100},{start:100,end:101},{start:43,end:57},{start:57,end:202},{start:202,end:43},{start:242,end:20},{start:20,end:99},{start:99,end:242},{start:56,end:28},{start:28,end:157},{start:157,end:56},{start:124,end:35},{start:35,end:113},{start:113,end:124},{start:29,end:160},{start:160,end:27},{start:27,end:29},{start:211,end:204},{start:204,end:210},{start:210,end:211},{start:124,end:113},{start:113,end:46},{start:46,end:124},{start:106,end:43},{start:43,end:204},{start:204,end:106},{start:96,end:62},{start:62,end:77},{start:77,end:96},{start:227,end:137},{start:137,end:116},{start:116,end:227},{start:73,end:41},{start:41,end:72},{start:72,end:73},{start:36,end:203},{start:203,end:142},{start:142,end:36},{start:235,end:64},{start:64,end:240},{start:240,end:235},{start:48,end:49},{start:49,end:64},{start:64,end:48},{start:42,end:41},{start:41,end:74},{start:74,end:42},{start:214,end:212},{start:212,end:207},{start:207,end:214},{start:183,end:42},{start:42,end:184},{start:184,end:183},{start:210,end:169},{start:169,end:211},{start:211,end:210},{start:140,end:170},{start:170,end:176},{start:176,end:140},{start:104,end:105},{start:105,end:69},{start:69,end:104},{start:193,end:122},{start:122,end:168},{start:168,end:193},{start:50,end:123},{start:123,end:187},{start:187,end:50},{start:89,end:96},{start:96,end:90},{start:90,end:89},{start:66,end:65},{start:65,end:107},{start:107,end:66},{start:179,end:89},{start:89,end:180},{start:180,end:179},{start:119,end:101},{start:101,end:120},{start:120,end:119},{start:68,end:63},{start:63,end:104},{start:104,end:68},{start:234,end:93},{start:93,end:227},{start:227,end:234},{start:16,end:15},{start:15,end:85},{start:85,end:16},{start:209,end:129},{start:129,end:49},{start:49,end:209},{start:15,end:14},{start:14,end:86},{start:86,end:15},{start:107,end:55},{start:55,end:9},{start:9,end:107},{start:120,end:100},{start:100,end:121},{start:121,end:120},{start:153,end:145},{start:145,end:22},{start:22,end:153},{start:178,end:88},{start:88,end:179},{start:179,end:178},{start:197,end:6},{start:6,end:196},{start:196,end:197},{start:89,end:88},{start:88,end:96},{start:96,end:89},{start:135,end:138},{start:138,end:136},{start:136,end:135},{start:138,end:215},{start:215,end:172},{start:172,end:138},{start:218,end:115},{start:115,end:219},{start:219,end:218},{start:41,end:42},{start:42,end:81},{start:81,end:41},{start:5,end:195},{start:195,end:51},{start:51,end:5},{start:57,end:43},{start:43,end:61},{start:61,end:57},{start:208,end:171},{start:171,end:199},{start:199,end:208},{start:41,end:81},{start:81,end:38},{start:38,end:41},{start:224,end:53},{start:53,end:225},{start:225,end:224},{start:24,end:144},{start:144,end:110},{start:110,end:24},{start:105,end:52},{start:52,end:66},{start:66,end:105},{start:118,end:229},{start:229,end:117},{start:117,end:118},{start:227,end:34},{start:34,end:234},{start:234,end:227},{start:66,end:107},{start:107,end:69},{start:69,end:66},{start:10,end:109},{start:109,end:151},{start:151,end:10},{start:219,end:48},{start:48,end:235},{start:235,end:219},{start:183,end:62},{start:62,end:191},{start:191,end:183},{start:142,end:129},{start:129,end:126},{start:126,end:142},{start:116,end:111},{start:111,end:143},{start:143,end:116},{start:118,end:117},{start:117,end:50},{start:50,end:118},{start:223,end:222},{start:222,end:52},{start:52,end:223},{start:94,end:19},{start:19,end:141},{start:141,end:94},{start:222,end:221},{start:221,end:65},{start:65,end:222},{start:196,end:3},{start:3,end:197},{start:197,end:196},{start:45,end:220},{start:220,end:44},{start:44,end:45},{start:156,end:70},{start:70,end:139},{start:139,end:156},{start:188,end:122},{start:122,end:245},{start:245,end:188},{start:139,end:71},{start:71,end:162},{start:162,end:139},{start:149,end:170},{start:170,end:150},{start:150,end:149},{start:122,end:188},{start:188,end:196},{start:196,end:122},{start:206,end:216},{start:216,end:92},{start:92,end:206},{start:164,end:2},{start:2,end:167},{start:167,end:164},{start:242,end:141},{start:141,end:241},{start:241,end:242},{start:0,end:164},{start:164,end:37},{start:37,end:0},{start:11,end:72},{start:72,end:12},{start:12,end:11},{start:12,end:38},{start:38,end:13},{start:13,end:12},{start:70,end:63},{start:63,end:71},{start:71,end:70},{start:31,end:226},{start:226,end:111},{start:111,end:31},{start:36,end:101},{start:101,end:205},{start:205,end:36},{start:203,end:206},{start:206,end:165},{start:165,end:203},{start:126,end:209},{start:209,end:217},{start:217,end:126},{start:98,end:165},{start:165,end:97},{start:97,end:98},{start:237,end:220},{start:220,end:218},{start:218,end:237},{start:237,end:239},{start:239,end:241},{start:241,end:237},{start:210,end:214},{start:214,end:169},{start:169,end:210},{start:140,end:171},{start:171,end:32},{start:32,end:140},{start:241,end:125},{start:125,end:237},{start:237,end:241},{start:179,end:86},{start:86,end:178},{start:178,end:179},{start:180,end:85},{start:85,end:179},{start:179,end:180},{start:181,end:84},{start:84,end:180},{start:180,end:181},{start:182,end:83},{start:83,end:181},{start:181,end:182},{start:194,end:201},{start:201,end:182},{start:182,end:194},{start:177,end:137},{start:137,end:132},{start:132,end:177},{start:184,end:76},{start:76,end:183},{start:183,end:184},{start:185,end:61},{start:61,end:184},{start:184,end:185},{start:186,end:57},{start:57,end:185},{start:185,end:186},{start:216,end:212},{start:212,end:186},{start:186,end:216},{start:192,end:214},{start:214,end:187},{start:187,end:192},{start:139,end:34},{start:34,end:156},{start:156,end:139},{start:218,end:79},{start:79,end:237},{start:237,end:218},{start:147,end:123},{start:123,end:177},{start:177,end:147},{start:45,end:44},{start:44,end:4},{start:4,end:45},{start:208,end:201},{start:201,end:32},{start:32,end:208},{start:98,end:64},{start:64,end:129},{start:129,end:98},{start:192,end:213},{start:213,end:138},{start:138,end:192},{start:235,end:59},{start:59,end:219},{start:219,end:235},{start:141,end:242},{start:242,end:97},{start:97,end:141},{start:97,end:2},{start:2,end:141},{start:141,end:97},{start:240,end:75},{start:75,end:235},{start:235,end:240},{start:229,end:24},{start:24,end:228},{start:228,end:229},{start:31,end:25},{start:25,end:226},{start:226,end:31},{start:230,end:23},{start:23,end:229},{start:229,end:230},{start:231,end:22},{start:22,end:230},{start:230,end:231},{start:232,end:26},{start:26,end:231},{start:231,end:232},{start:233,end:112},{start:112,end:232},{start:232,end:233},{start:244,end:189},{start:189,end:243},{start:243,end:244},{start:189,end:221},{start:221,end:190},{start:190,end:189},{start:222,end:28},{start:28,end:221},{start:221,end:222},{start:223,end:27},{start:27,end:222},{start:222,end:223},{start:224,end:29},{start:29,end:223},{start:223,end:224},{start:225,end:30},{start:30,end:224},{start:224,end:225},{start:113,end:247},{start:247,end:225},{start:225,end:113},{start:99,end:60},{start:60,end:240},{start:240,end:99},{start:213,end:147},{start:147,end:215},{start:215,end:213},{start:60,end:20},{start:20,end:166},{start:166,end:60},{start:192,end:187},{start:187,end:213},{start:213,end:192},{start:243,end:112},{start:112,end:244},{start:244,end:243},{start:244,end:233},{start:233,end:245},{start:245,end:244},{start:245,end:128},{start:128,end:188},{start:188,end:245},{start:188,end:114},{start:114,end:174},{start:174,end:188},{start:134,end:131},{start:131,end:220},{start:220,end:134},{start:174,end:217},{start:217,end:236},{start:236,end:174},{start:236,end:198},{start:198,end:134},{start:134,end:236},{start:215,end:177},{start:177,end:58},{start:58,end:215},{start:156,end:143},{start:143,end:124},{start:124,end:156},{start:25,end:110},{start:110,end:7},{start:7,end:25},{start:31,end:228},{start:228,end:25},{start:25,end:31},{start:264,end:356},{start:356,end:368},{start:368,end:264},{start:0,end:11},{start:11,end:267},{start:267,end:0},{start:451,end:452},{start:452,end:349},{start:349,end:451},{start:267,end:302},{start:302,end:269},{start:269,end:267},{start:350,end:357},{start:357,end:277},{start:277,end:350},{start:350,end:452},{start:452,end:357},{start:357,end:350},{start:299,end:333},{start:333,end:297},{start:297,end:299},{start:396,end:175},{start:175,end:377},{start:377,end:396},{start:280,end:347},{start:347,end:330},{start:330,end:280},{start:269,end:303},{start:303,end:270},{start:270,end:269},{start:151,end:9},{start:9,end:337},{start:337,end:151},{start:344,end:278},{start:278,end:360},{start:360,end:344},{start:424,end:418},{start:418,end:431},{start:431,end:424},{start:270,end:304},{start:304,end:409},{start:409,end:270},{start:272,end:310},{start:310,end:407},{start:407,end:272},{start:322,end:270},{start:270,end:410},{start:410,end:322},{start:449,end:450},{start:450,end:347},{start:347,end:449},{start:432,end:422},{start:422,end:434},{start:434,end:432},{start:18,end:313},{start:313,end:17},{start:17,end:18},{start:291,end:306},{start:306,end:375},{start:375,end:291},{start:259,end:387},{start:387,end:260},{start:260,end:259},{start:424,end:335},{start:335,end:418},{start:418,end:424},{start:434,end:364},{start:364,end:416},{start:416,end:434},{start:391,end:423},{start:423,end:327},{start:327,end:391},{start:301,end:251},{start:251,end:298},{start:298,end:301},{start:275,end:281},{start:281,end:4},{start:4,end:275},{start:254,end:373},{start:373,end:253},{start:253,end:254},{start:375,end:307},{start:307,end:321},{start:321,end:375},{start:280,end:425},{start:425,end:411},{start:411,end:280},{start:200,end:421},{start:421,end:18},{start:18,end:200},{start:335,end:321},{start:321,end:406},{start:406,end:335},{start:321,end:320},{start:320,end:405},{start:405,end:321},{start:314,end:315},{start:315,end:17},{start:17,end:314},{start:423,end:426},{start:426,end:266},{start:266,end:423},{start:396,end:377},{start:377,end:369},{start:369,end:396},{start:270,end:322},{start:322,end:269},{start:269,end:270},{start:413,end:417},{start:417,end:464},{start:464,end:413},{start:385,end:386},{start:386,end:258},{start:258,end:385},{start:248,end:456},{start:456,end:419},{start:419,end:248},{start:298,end:284},{start:284,end:333},{start:333,end:298},{start:168,end:417},{start:417,end:8},{start:8,end:168},{start:448,end:346},{start:346,end:261},{start:261,end:448},{start:417,end:413},{start:413,end:285},{start:285,end:417},{start:326,end:327},{start:327,end:328},{start:328,end:326},{start:277,end:355},{start:355,end:329},{start:329,end:277},{start:309,end:392},{start:392,end:438},{start:438,end:309},{start:381,end:382},{start:382,end:256},{start:256,end:381},{start:279,end:429},{start:429,end:360},{start:360,end:279},{start:365,end:364},{start:364,end:379},{start:379,end:365},{start:355,end:277},{start:277,end:437},{start:437,end:355},{start:282,end:443},{start:443,end:283},{start:283,end:282},{start:281,end:275},{start:275,end:363},{start:363,end:281},{start:395,end:431},{start:431,end:369},{start:369,end:395},{start:299,end:297},{start:297,end:337},{start:337,end:299},{start:335,end:273},{start:273,end:321},{start:321,end:335},{start:348,end:450},{start:450,end:349},{start:349,end:348},{start:359,end:446},{start:446,end:467},{start:467,end:359},{start:283,end:293},{start:293,end:282},{start:282,end:283},{start:250,end:458},{start:458,end:462},{start:462,end:250},{start:300,end:276},{start:276,end:383},{start:383,end:300},{start:292,end:308},{start:308,end:325},{start:325,end:292},{start:283,end:276},{start:276,end:293},{start:293,end:283},{start:264,end:372},{start:372,end:447},{start:447,end:264},{start:346,end:352},{start:352,end:340},{start:340,end:346},{start:354,end:274},{start:274,end:19},{start:19,end:354},{start:363,end:456},{start:456,end:281},{start:281,end:363},{start:426,end:436},{start:436,end:425},{start:425,end:426},{start:380,end:381},{start:381,end:252},{start:252,end:380},{start:267,end:269},{start:269,end:393},{start:393,end:267},{start:421,end:200},{start:200,end:428},{start:428,end:421},{start:371,end:266},{start:266,end:329},{start:329,end:371},{start:432,end:287},{start:287,end:422},{start:422,end:432},{start:290,end:250},{start:250,end:328},{start:328,end:290},{start:385,end:258},{start:258,end:384},{start:384,end:385},{start:446,end:265},{start:265,end:342},{start:342,end:446},{start:386,end:387},{start:387,end:257},{start:257,end:386},{start:422,end:424},{start:424,end:430},{start:430,end:422},{start:445,end:342},{start:342,end:276},{start:276,end:445},{start:422,end:273},{start:273,end:424},{start:424,end:422},{start:306,end:292},{start:292,end:307},{start:307,end:306},{start:352,end:366},{start:366,end:345},{start:345,end:352},{start:268,end:271},{start:271,end:302},{start:302,end:268},{start:358,end:423},{start:423,end:371},{start:371,end:358},{start:327,end:294},{start:294,end:460},{start:460,end:327},{start:331,end:279},{start:279,end:294},{start:294,end:331},{start:303,end:271},{start:271,end:304},{start:304,end:303},{start:436,end:432},{start:432,end:427},{start:427,end:436},{start:304,end:272},{start:272,end:408},{start:408,end:304},{start:395,end:394},{start:394,end:431},{start:431,end:395},{start:378,end:395},{start:395,end:400},{start:400,end:378},{start:296,end:334},{start:334,end:299},{start:299,end:296},{start:6,end:351},{start:351,end:168},{start:168,end:6},{start:376,end:352},{start:352,end:411},{start:411,end:376},{start:307,end:325},{start:325,end:320},{start:320,end:307},{start:285,end:295},{start:295,end:336},{start:336,end:285},{start:320,end:319},{start:319,end:404},{start:404,end:320},{start:329,end:330},{start:330,end:349},{start:349,end:329},{start:334,end:293},{start:293,end:333},{start:333,end:334},{start:366,end:323},{start:323,end:447},{start:447,end:366},{start:316,end:15},{start:15,end:315},{start:315,end:316},{start:331,end:358},{start:358,end:279},{start:279,end:331},{start:317,end:14},{start:14,end:316},{start:316,end:317},{start:8,end:285},{start:285,end:9},{start:9,end:8},{start:277,end:329},{start:329,end:350},{start:350,end:277},{start:253,end:374},{start:374,end:252},{start:252,end:253},{start:319,end:318},{start:318,end:403},{start:403,end:319},{start:351,end:6},{start:6,end:419},{start:419,end:351},{start:324,end:318},{start:318,end:325},{start:325,end:324},{start:397,end:367},{start:367,end:365},{start:365,end:397},{start:288,end:435},{start:435,end:397},{start:397,end:288},{start:278,end:344},{start:344,end:439},{start:439,end:278},{start:310,end:272},{start:272,end:311},{start:311,end:310},{start:248,end:195},{start:195,end:281},{start:281,end:248},{start:375,end:273},{start:273,end:291},{start:291,end:375},{start:175,end:396},{start:396,end:199},{start:199,end:175},{start:312,end:311},{start:311,end:268},{start:268,end:312},{start:276,end:283},{start:283,end:445},{start:445,end:276},{start:390,end:373},{start:373,end:339},{start:339,end:390},{start:295,end:282},{start:282,end:296},{start:296,end:295},{start:448,end:449},{start:449,end:346},{start:346,end:448},{start:356,end:264},{start:264,end:454},{start:454,end:356},{start:337,end:336},{start:336,end:299},{start:299,end:337},{start:337,end:338},{start:338,end:151},{start:151,end:337},{start:294,end:278},{start:278,end:455},{start:455,end:294},{start:308,end:292},{start:292,end:415},{start:415,end:308},{start:429,end:358},{start:358,end:355},{start:355,end:429},{start:265,end:340},{start:340,end:372},{start:372,end:265},{start:352,end:346},{start:346,end:280},{start:280,end:352},{start:295,end:442},{start:442,end:282},{start:282,end:295},{start:354,end:19},{start:19,end:370},{start:370,end:354},{start:285,end:441},{start:441,end:295},{start:295,end:285},{start:195,end:248},{start:248,end:197},{start:197,end:195},{start:457,end:440},{start:440,end:274},{start:274,end:457},{start:301,end:300},{start:300,end:368},{start:368,end:301},{start:417,end:351},{start:351,end:465},{start:465,end:417},{start:251,end:301},{start:301,end:389},{start:389,end:251},{start:394,end:395},{start:395,end:379},{start:379,end:394},{start:399,end:412},{start:412,end:419},{start:419,end:399},{start:410,end:436},{start:436,end:322},{start:322,end:410},{start:326,end:2},{start:2,end:393},{start:393,end:326},{start:354,end:370},{start:370,end:461},{start:461,end:354},{start:393,end:164},{start:164,end:267},{start:267,end:393},{start:268,end:302},{start:302,end:12},{start:12,end:268},{start:312,end:268},{start:268,end:13},{start:13,end:312},{start:298,end:293},{start:293,end:301},{start:301,end:298},{start:265,end:446},{start:446,end:340},{start:340,end:265},{start:280,end:330},{start:330,end:425},{start:425,end:280},{start:322,end:426},{start:426,end:391},{start:391,end:322},{start:420,end:429},{start:429,end:437},{start:437,end:420},{start:393,end:391},{start:391,end:326},{start:326,end:393},{start:344,end:440},{start:440,end:438},{start:438,end:344},{start:458,end:459},{start:459,end:461},{start:461,end:458},{start:364,end:434},{start:434,end:394},{start:394,end:364},{start:428,end:396},{start:396,end:262},{start:262,end:428},{start:274,end:354},{start:354,end:457},{start:457,end:274},{start:317,end:316},{start:316,end:402},{start:402,end:317},{start:316,end:315},{start:315,end:403},{start:403,end:316},{start:315,end:314},{start:314,end:404},{start:404,end:315},{start:314,end:313},{start:313,end:405},{start:405,end:314},{start:313,end:421},{start:421,end:406},{start:406,end:313},{start:323,end:366},{start:366,end:361},{start:361,end:323},{start:292,end:306},{start:306,end:407},{start:407,end:292},{start:306,end:291},{start:291,end:408},{start:408,end:306},{start:291,end:287},{start:287,end:409},{start:409,end:291},{start:287,end:432},{start:432,end:410},{start:410,end:287},{start:427,end:434},{start:434,end:411},{start:411,end:427},{start:372,end:264},{start:264,end:383},{start:383,end:372},{start:459,end:309},{start:309,end:457},{start:457,end:459},{start:366,end:352},{start:352,end:401},{start:401,end:366},{start:1,end:274},{start:274,end:4},{start:4,end:1},{start:418,end:421},{start:421,end:262},{start:262,end:418},{start:331,end:294},{start:294,end:358},{start:358,end:331},{start:435,end:433},{start:433,end:367},{start:367,end:435},{start:392,end:289},{start:289,end:439},{start:439,end:392},{start:328,end:462},{start:462,end:326},{start:326,end:328},{start:94,end:2},{start:2,end:370},{start:370,end:94},{start:289,end:305},{start:305,end:455},{start:455,end:289},{start:339,end:254},{start:254,end:448},{start:448,end:339},{start:359,end:255},{start:255,end:446},{start:446,end:359},{start:254,end:253},{start:253,end:449},{start:449,end:254},{start:253,end:252},{start:252,end:450},{start:450,end:253},{start:252,end:256},{start:256,end:451},{start:451,end:252},{start:256,end:341},{start:341,end:452},{start:452,end:256},{start:414,end:413},{start:413,end:463},{start:463,end:414},{start:286,end:441},{start:441,end:414},{start:414,end:286},{start:286,end:258},{start:258,end:441},{start:441,end:286},{start:258,end:257},{start:257,end:442},{start:442,end:258},{start:257,end:259},{start:259,end:443},{start:443,end:257},{start:259,end:260},{start:260,end:444},{start:444,end:259},{start:260,end:467},{start:467,end:445},{start:445,end:260},{start:309,end:459},{start:459,end:250},{start:250,end:309},{start:305,end:289},{start:289,end:290},{start:290,end:305},{start:305,end:290},{start:290,end:460},{start:460,end:305},{start:401,end:376},{start:376,end:435},{start:435,end:401},{start:309,end:250},{start:250,end:392},{start:392,end:309},{start:376,end:411},{start:411,end:433},{start:433,end:376},{start:453,end:341},{start:341,end:464},{start:464,end:453},{start:357,end:453},{start:453,end:465},{start:465,end:357},{start:343,end:357},{start:357,end:412},{start:412,end:343},{start:437,end:343},{start:343,end:399},{start:399,end:437},{start:344,end:360},{start:360,end:440},{start:440,end:344},{start:420,end:437},{start:437,end:456},{start:456,end:420},{start:360,end:420},{start:420,end:363},{start:363,end:360},{start:361,end:401},{start:401,end:288},{start:288,end:361},{start:265,end:372},{start:372,end:353},{start:353,end:265},{start:390,end:339},{start:339,end:249},{start:249,end:390},{start:339,end:448},{start:448,end:255},{start:255,end:339}];var face_landmarker_options={};Object.defineProperty(face_landmarker_options,"__esModule",{value:!0});var face_landmarker_result={};Object.defineProperty(face_landmarker_result,"__esModule",{value:!0}),function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,i)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(e,r){for(var o in e)"default"===o||Object.prototype.hasOwnProperty.call(r,o)||t(r,e,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.FaceLandmarker=void 0;const o=calculator_pb,i=calculator_options_pb,a=classification_pb,n=landmark_pb,s=base_options_pb,p=face_detector_graph_options_pb,d=face_geometry_pb,l=face_landmarker_graph_options_pb,g=face_landmarks_detector_graph_options_pb,c=classifier_result,u=landmark_result,m=vision_task_runner,f=face_landmarks_connections;r(face_landmarker_options,e),r(face_landmarker_result,e);const h="image_in",y="norm_rect",b="face_landmarks",_="blendshapes",O="face_geometry",F=.5;class M extends m.VisionTaskRunner{static createFromOptions(e,t){return m.VisionTaskRunner.createVisionInstance(M,e,t)}static createFromModelBuffer(e,t){return m.VisionTaskRunner.createVisionInstance(M,e,{baseOptions:{modelAssetBuffer:t}})}static createFromModelPath(e,t){return m.VisionTaskRunner.createVisionInstance(M,e,{baseOptions:{modelAssetPath:t}})}constructor(e,t){super(new m.VisionGraphRunner(e,t),h,y,!1),this.result={faceLandmarks:[]},this.outputFaceBlendshapes=!1,this.outputFacialTransformationMatrixes=!1,this.options=new l.FaceLandmarkerGraphOptions,this.options.setBaseOptions(new s.BaseOptions),this.faceLandmarksDetectorGraphOptions=new g.FaceLandmarksDetectorGraphOptions,this.options.setFaceLandmarksDetectorGraphOptions(this.faceLandmarksDetectorGraphOptions),this.faceDetectorGraphOptions=new p.FaceDetectorGraphOptions,this.options.setFaceDetectorGraphOptions(this.faceDetectorGraphOptions),this.initDefaults()}get baseOptions(){return this.options.getBaseOptions()}set baseOptions(e){this.options.setBaseOptions(e)}setOptions(e){var t,r,o,i;return"numFaces"in e&&this.faceDetectorGraphOptions.setNumFaces(null!==(t=e.numFaces)&&void 0!==t?t:1),"minFaceDetectionConfidence"in e&&this.faceDetectorGraphOptions.setMinDetectionConfidence(null!==(r=e.minFaceDetectionConfidence)&&void 0!==r?r:F),"minTrackingConfidence"in e&&this.options.setMinTrackingConfidence(null!==(o=e.minTrackingConfidence)&&void 0!==o?o:F),"minFacePresenceConfidence"in e&&this.faceLandmarksDetectorGraphOptions.setMinDetectionConfidence(null!==(i=e.minFacePresenceConfidence)&&void 0!==i?i:F),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"outputFacialTransformationMatrixes"in e&&(this.outputFacialTransformationMatrixes=!!e.outputFacialTransformationMatrixes),this.applyOptions(e)}detect(e,t){return this.resetResults(),this.processImageData(e,t),this.result}detectForVideo(e,t,r){return this.resetResults(),this.processVideoData(e,r,t),this.result}resetResults(){this.result={faceLandmarks:[]},this.outputFaceBlendshapes&&(this.result.faceBlendshapes=[]),this.outputFacialTransformationMatrixes&&(this.result.facialTransformationMatrixes=[])}initDefaults(){this.faceDetectorGraphOptions.setNumFaces(1),this.faceDetectorGraphOptions.setMinDetectionConfidence(F),this.faceLandmarksDetectorGraphOptions.setMinDetectionConfidence(F),this.options.setMinTrackingConfidence(F)}addJsLandmarks(e){for(const t of e){const e=n.NormalizedLandmarkList.deserializeBinary(t);this.result.faceLandmarks.push((0,u.convertToLandmarks)(e))}}addBlenshape(e){var t;if(this.result.faceBlendshapes)for(const r of e){const e=a.ClassificationList.deserializeBinary(r);this.result.faceBlendshapes.push((0,c.convertFromClassifications)(null!==(t=e.getClassificationList())&&void 0!==t?t:[]))}}addFacialTransformationMatrixes(e){var t,r,o;if(this.result.facialTransformationMatrixes)for(const i of e){const e=d.FaceGeometry.deserializeBinary(i).getPoseTransformMatrix();e&&this.result.facialTransformationMatrixes.push({rows:null!==(t=e.getRows())&&void 0!==t?t:0,columns:null!==(r=e.getCols())&&void 0!==r?r:0,data:null!==(o=e.getPackedDataList())&&void 0!==o?o:[]})}}refreshGraph(){const e=new o.CalculatorGraphConfig;e.addInputStream(h),e.addInputStream(y),e.addOutputStream(b);const t=new i.CalculatorOptions;t.setExtension(l.FaceLandmarkerGraphOptions.ext,this.options);const r=new o.CalculatorGraphConfig.Node;r.setCalculator("mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),r.addInputStream("IMAGE:"+h),r.addInputStream("NORM_RECT:"+y),r.addOutputStream("NORM_LANDMARKS:"+b),r.setOptions(t),e.addNode(r),this.graphRunner.attachProtoVectorListener(b,((e,t)=>{this.addJsLandmarks(e),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(b,(e=>{this.setLatestOutputTimestamp(e)})),this.outputFaceBlendshapes&&(e.addOutputStream(_),r.addOutputStream("BLENDSHAPES:"+_),this.graphRunner.attachProtoVectorListener(_,((e,t)=>{this.addBlenshape(e),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(_,(e=>{this.setLatestOutputTimestamp(e)}))),this.outputFacialTransformationMatrixes&&(e.addOutputStream(O),r.addOutputStream("FACE_GEOMETRY:"+O),this.graphRunner.attachProtoVectorListener(O,((e,t)=>{this.addFacialTransformationMatrixes(e),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(O,(e=>{this.setLatestOutputTimestamp(e)})));const a=e.serializeBinary();this.setGraph(new Uint8Array(a),!0)}}e.FaceLandmarker=M,M.FACE_LANDMARKS_LIPS=f.FACE_LANDMARKS_LIPS,M.FACE_LANDMARKS_LEFT_EYE=f.FACE_LANDMARKS_LEFT_EYE,M.FACE_LANDMARKS_LEFT_EYEBROW=f.FACE_LANDMARKS_LEFT_EYEBROW,M.FACE_LANDMARKS_LEFT_IRIS=f.FACE_LANDMARKS_LEFT_IRIS,M.FACE_LANDMARKS_RIGHT_EYE=f.FACE_LANDMARKS_RIGHT_EYE,M.FACE_LANDMARKS_RIGHT_EYEBROW=f.FACE_LANDMARKS_RIGHT_EYEBROW,M.FACE_LANDMARKS_RIGHT_IRIS=f.FACE_LANDMARKS_RIGHT_IRIS,M.FACE_LANDMARKS_FACE_OVAL=f.FACE_LANDMARKS_FACE_OVAL,M.FACE_LANDMARKS_CONTOURS=f.FACE_LANDMARKS_CONTOURS,M.FACE_LANDMARKS_TESSELATION=f.FACE_LANDMARKS_TESSELATION}(face_landmarker);var face_stylizer={},face_stylizer_graph_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n);var s=face_landmarker_graph_options_pb;r.object.extend(proto,s),r.exportSymbol("proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions",null,o),proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.displayName="proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.toObject=function(e,t){var r,o={baseOptions:(r=t.getBaseOptions())&&n.BaseOptions.toObject(e,r),faceLandmarkerGraphOptions:(r=t.getFaceLandmarkerGraphOptions())&&s.FaceLandmarkerGraphOptions.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions;return proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=new s.FaceLandmarkerGraphOptions;t.readMessage(r,s.FaceLandmarkerGraphOptions.deserializeBinaryFromReader),e.setFaceLandmarkerGraphOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.serializeBinaryToWriter=function(e,t){var r=void 0;null!=(r=e.getBaseOptions())&&t.writeMessage(1,r,n.BaseOptions.serializeBinaryToWriter),null!=(r=e.getFaceLandmarkerGraphOptions())&&t.writeMessage(2,r,s.FaceLandmarkerGraphOptions.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.ext=new t.ExtensionFieldInfo(513916220,{ext:0},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions,proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[513916220]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[513916220]=proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.ext,proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.prototype.getFaceLandmarkerGraphOptions=function(){return t.Message.getWrapperField(this,s.FaceLandmarkerGraphOptions,2)},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.prototype.setFaceLandmarkerGraphOptions=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.prototype.clearFaceLandmarkerGraphOptions=function(){return this.setFaceLandmarkerGraphOptions(void 0)},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.prototype.hasFaceLandmarkerGraphOptions=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.ext=new t.ExtensionFieldInfo(513916220,{ext:0},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions,proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[513916220]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[513916220]=proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.face_stylizer.proto)}(face_stylizer_graph_options_pb);var face_stylizer_options={};Object.defineProperty(face_stylizer_options,"__esModule",{value:!0}),function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,i)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(e,r){for(var o in e)"default"===o||Object.prototype.hasOwnProperty.call(r,o)||t(r,e,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.FaceStylizer=void 0;const o=calculator_pb,i=calculator_options_pb,a=base_options_pb,n=face_stylizer_graph_options_pb,s=vision_task_runner;r(face_stylizer_options,e);const p="image_in",d="norm_rect",l="stylized_image";class g extends s.VisionTaskRunner{static createFromOptions(e,t){return s.VisionTaskRunner.createVisionInstance(g,e,t)}static createFromModelBuffer(e,t){return s.VisionTaskRunner.createVisionInstance(g,e,{baseOptions:{modelAssetBuffer:t}})}static createFromModelPath(e,t){return s.VisionTaskRunner.createVisionInstance(g,e,{baseOptions:{modelAssetPath:t}})}constructor(e,t){super(new s.VisionGraphRunner(e,t),p,d,!0),this.options=new n.FaceStylizerGraphOptions,this.options.setBaseOptions(new a.BaseOptions)}get baseOptions(){return this.options.getBaseOptions()}set baseOptions(e){this.options.setBaseOptions(e)}setOptions(e){return super.applyOptions(e)}stylize(e,t,r){const o="function"!=typeof t?t:{};if(this.userCallback="function"==typeof t?t:r,this.processImageData(e,null!=o?o:{}),!this.userCallback)return this.result}stylizeForVideo(e,t,r,o){const i="function"!=typeof r?r:{};if(this.userCallback="function"==typeof r?r:o,this.processVideoData(e,i,t),this.userCallback=void 0,!this.userCallback)return this.result}refreshGraph(){const e=new o.CalculatorGraphConfig;e.addInputStream(p),e.addInputStream(d),e.addOutputStream(l);const t=new i.CalculatorOptions;t.setExtension(n.FaceStylizerGraphOptions.ext,this.options);const r=new o.CalculatorGraphConfig.Node;r.setCalculator("mediapipe.tasks.vision.face_stylizer.FaceStylizerGraph"),r.addInputStream("IMAGE:"+p),r.addInputStream("NORM_RECT:"+d),r.addOutputStream("STYLIZED_IMAGE:"+l),r.setOptions(t),e.addNode(r),this.graphRunner.attachImageListener(l,((e,t)=>{const r=this.convertToMPImage(e,!this.userCallback);this.result=r,this.userCallback&&this.userCallback(r),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(l,(e=>{this.result=null,this.userCallback&&this.userCallback(null),this.setLatestOutputTimestamp(e)}));const a=e.serializeBinary();this.setGraph(new Uint8Array(a),!0)}}e.FaceStylizer=g}(face_stylizer);var gesture_recognizer={},gesture_classifier_graph_options_pb={},classifier_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.tasks.components.processors.proto.ClassifierOptions",null,o),proto.mediapipe.tasks.components.processors.proto.ClassifierOptions=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.repeatedFields_,null)},r.inherits(proto.mediapipe.tasks.components.processors.proto.ClassifierOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.displayName="proto.mediapipe.tasks.components.processors.proto.ClassifierOptions"),proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.repeatedFields_=[4,5],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.toObject(e,this)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.toObject=function(e,r){var o,i={displayNamesLocale:t.Message.getFieldWithDefault(r,1,"en"),maxResults:t.Message.getFieldWithDefault(r,2,-1),scoreThreshold:null==(o=t.Message.getOptionalFloatingPointField(r,3))?void 0:o,categoryAllowlistList:null==(o=t.Message.getRepeatedField(r,4))?void 0:o,categoryDenylistList:null==(o=t.Message.getRepeatedField(r,5))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.components.processors.proto.ClassifierOptions;return proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setDisplayNamesLocale(r);break;case 2:r=t.readInt32();e.setMaxResults(r);break;case 3:r=t.readFloat();e.setScoreThreshold(r);break;case 4:r=t.readString();e.addCategoryAllowlist(r);break;case 5:r=t.readString();e.addCategoryDenylist(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeString(1,o),null!=(o=t.Message.getField(e,2))&&r.writeInt32(2,o),null!=(o=t.Message.getField(e,3))&&r.writeFloat(3,o),(o=e.getCategoryAllowlistList()).length>0&&r.writeRepeatedString(4,o),(o=e.getCategoryDenylistList()).length>0&&r.writeRepeatedString(5,o)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.getDisplayNamesLocale=function(){return t.Message.getFieldWithDefault(this,1,"en")},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.setDisplayNamesLocale=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.clearDisplayNamesLocale=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.hasDisplayNamesLocale=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.getMaxResults=function(){return t.Message.getFieldWithDefault(this,2,-1)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.setMaxResults=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.clearMaxResults=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.hasMaxResults=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.getScoreThreshold=function(){return t.Message.getFloatingPointFieldWithDefault(this,3,0)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.setScoreThreshold=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.clearScoreThreshold=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.hasScoreThreshold=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.getCategoryAllowlistList=function(){return t.Message.getRepeatedField(this,4)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.setCategoryAllowlistList=function(e){return t.Message.setField(this,4,e||[])},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.addCategoryAllowlist=function(e,r){return t.Message.addToRepeatedField(this,4,e,r)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.clearCategoryAllowlistList=function(){return this.setCategoryAllowlistList([])},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.getCategoryDenylistList=function(){return t.Message.getRepeatedField(this,5)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.setCategoryDenylistList=function(e){return t.Message.setField(this,5,e||[])},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.addCategoryDenylist=function(e,r){return t.Message.addToRepeatedField(this,5,e,r)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.clearCategoryDenylistList=function(){return this.setCategoryDenylistList([])},r.object.extend(e,proto.mediapipe.tasks.components.processors.proto)}(classifier_options_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=classifier_options_pb;r.object.extend(proto,n);var s=base_options_pb;r.object.extend(proto,s),r.exportSymbol("proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions",null,o),proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.displayName="proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.toObject=function(e,t){var r,o={baseOptions:(r=t.getBaseOptions())&&s.BaseOptions.toObject(e,r),classifierOptions:(r=t.getClassifierOptions())&&n.ClassifierOptions.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions;return proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new s.BaseOptions;t.readMessage(r,s.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=new n.ClassifierOptions;t.readMessage(r,n.ClassifierOptions.deserializeBinaryFromReader),e.setClassifierOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.serializeBinaryToWriter=function(e,t){var r=void 0;null!=(r=e.getBaseOptions())&&t.writeMessage(1,r,s.BaseOptions.serializeBinaryToWriter),null!=(r=e.getClassifierOptions())&&t.writeMessage(2,r,n.ClassifierOptions.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.ext=new t.ExtensionFieldInfo(478825465,{ext:0},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[478825465]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[478825465]=proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.ext,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,s.BaseOptions,1)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.prototype.getClassifierOptions=function(){return t.Message.getWrapperField(this,n.ClassifierOptions,2)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.prototype.setClassifierOptions=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.prototype.clearClassifierOptions=function(){return this.setClassifierOptions(void 0)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.prototype.hasClassifierOptions=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.ext=new t.ExtensionFieldInfo(478825465,{ext:0},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[478825465]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[478825465]=proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.gesture_recognizer.proto)}(gesture_classifier_graph_options_pb);var gesture_recognizer_graph_options_pb={},hand_gesture_recognizer_graph_options_pb={},gesture_embedder_graph_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n),r.exportSymbol("proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions",null,o),proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.displayName="proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.toObject=function(e,t){var r,o={baseOptions:(r=t.getBaseOptions())&&n.BaseOptions.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions;return proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r)}else t.skipField()}return e},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.serializeBinaryToWriter=function(e,t){var r;null!=(r=e.getBaseOptions())&&t.writeMessage(1,r,n.BaseOptions.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.ext=new t.ExtensionFieldInfo(478825422,{ext:0},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[478825422]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[478825422]=proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.ext,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.ext=new t.ExtensionFieldInfo(478825422,{ext:0},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[478825422]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[478825422]=proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.gesture_recognizer.proto)}(gesture_embedder_graph_options_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n);var s=gesture_classifier_graph_options_pb;r.object.extend(proto,s);var p=gesture_embedder_graph_options_pb;r.object.extend(proto,p),r.exportSymbol("proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions",null,o),proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.displayName="proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.toObject=function(e,t){var r,o={baseOptions:(r=t.getBaseOptions())&&n.BaseOptions.toObject(e,r),gestureEmbedderGraphOptions:(r=t.getGestureEmbedderGraphOptions())&&p.GestureEmbedderGraphOptions.toObject(e,r),cannedGestureClassifierGraphOptions:(r=t.getCannedGestureClassifierGraphOptions())&&s.GestureClassifierGraphOptions.toObject(e,r),customGestureClassifierGraphOptions:(r=t.getCustomGestureClassifierGraphOptions())&&s.GestureClassifierGraphOptions.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions;return proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=new p.GestureEmbedderGraphOptions;t.readMessage(r,p.GestureEmbedderGraphOptions.deserializeBinaryFromReader),e.setGestureEmbedderGraphOptions(r);break;case 3:r=new s.GestureClassifierGraphOptions;t.readMessage(r,s.GestureClassifierGraphOptions.deserializeBinaryFromReader),e.setCannedGestureClassifierGraphOptions(r);break;case 4:r=new s.GestureClassifierGraphOptions;t.readMessage(r,s.GestureClassifierGraphOptions.deserializeBinaryFromReader),e.setCustomGestureClassifierGraphOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.serializeBinaryToWriter=function(e,t){var r=void 0;null!=(r=e.getBaseOptions())&&t.writeMessage(1,r,n.BaseOptions.serializeBinaryToWriter),null!=(r=e.getGestureEmbedderGraphOptions())&&t.writeMessage(2,r,p.GestureEmbedderGraphOptions.serializeBinaryToWriter),null!=(r=e.getCannedGestureClassifierGraphOptions())&&t.writeMessage(3,r,s.GestureClassifierGraphOptions.serializeBinaryToWriter),null!=(r=e.getCustomGestureClassifierGraphOptions())&&t.writeMessage(4,r,s.GestureClassifierGraphOptions.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.ext=new t.ExtensionFieldInfo(463370452,{ext:0},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions,proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[463370452]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[463370452]=proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.ext,proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.getGestureEmbedderGraphOptions=function(){return t.Message.getWrapperField(this,p.GestureEmbedderGraphOptions,2)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.setGestureEmbedderGraphOptions=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.clearGestureEmbedderGraphOptions=function(){return this.setGestureEmbedderGraphOptions(void 0)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.hasGestureEmbedderGraphOptions=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.getCannedGestureClassifierGraphOptions=function(){return t.Message.getWrapperField(this,s.GestureClassifierGraphOptions,3)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.setCannedGestureClassifierGraphOptions=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.clearCannedGestureClassifierGraphOptions=function(){return this.setCannedGestureClassifierGraphOptions(void 0)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.hasCannedGestureClassifierGraphOptions=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.getCustomGestureClassifierGraphOptions=function(){return t.Message.getWrapperField(this,s.GestureClassifierGraphOptions,4)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.setCustomGestureClassifierGraphOptions=function(e){return t.Message.setWrapperField(this,4,e)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.clearCustomGestureClassifierGraphOptions=function(){return this.setCustomGestureClassifierGraphOptions(void 0)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.hasCustomGestureClassifierGraphOptions=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.ext=new t.ExtensionFieldInfo(463370452,{ext:0},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions,proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[463370452]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[463370452]=proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.gesture_recognizer.proto)}(hand_gesture_recognizer_graph_options_pb);var hand_landmarker_graph_options_pb={},hand_detector_graph_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n),r.exportSymbol("proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions",null,o),proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.displayName="proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.toObject=function(e,r){var o,i={baseOptions:(o=r.getBaseOptions())&&n.BaseOptions.toObject(e,o),minDetectionConfidence:t.Message.getFloatingPointFieldWithDefault(r,2,.5),numHands:null==(o=t.Message.getField(r,3))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions;return proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=t.readFloat();e.setMinDetectionConfidence(r);break;case 3:r=t.readInt32();e.setNumHands(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getBaseOptions())&&r.writeMessage(1,o,n.BaseOptions.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeFloat(2,o),null!=(o=t.Message.getField(e,3))&&r.writeInt32(3,o)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.ext=new t.ExtensionFieldInfo(464864288,{ext:0},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions,proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[464864288]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[464864288]=proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.ext,proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.getMinDetectionConfidence=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,.5)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.setMinDetectionConfidence=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.clearMinDetectionConfidence=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.hasMinDetectionConfidence=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.getNumHands=function(){return t.Message.getFieldWithDefault(this,3,0)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.setNumHands=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.clearNumHands=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.hasNumHands=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.ext=new t.ExtensionFieldInfo(464864288,{ext:0},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions,proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[464864288]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[464864288]=proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.hand_detector.proto)}(hand_detector_graph_options_pb);var hand_landmarks_detector_graph_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n),r.exportSymbol("proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions",null,o),proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.displayName="proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.toObject=function(e,r){var o,i={baseOptions:(o=r.getBaseOptions())&&n.BaseOptions.toObject(e,o),minDetectionConfidence:t.Message.getFloatingPointFieldWithDefault(r,2,.5)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions;return proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=t.readFloat();e.setMinDetectionConfidence(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getBaseOptions())&&r.writeMessage(1,o,n.BaseOptions.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeFloat(2,o)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.ext=new t.ExtensionFieldInfo(474472470,{ext:0},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[474472470]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[474472470]=proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.ext,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.prototype.getMinDetectionConfidence=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,.5)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.prototype.setMinDetectionConfidence=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.prototype.clearMinDetectionConfidence=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.prototype.hasMinDetectionConfidence=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.ext=new t.ExtensionFieldInfo(474472470,{ext:0},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[474472470]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[474472470]=proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.hand_landmarker.proto)}(hand_landmarks_detector_graph_options_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n);var s=hand_detector_graph_options_pb;r.object.extend(proto,s);var p=hand_landmarks_detector_graph_options_pb;r.object.extend(proto,p),r.exportSymbol("proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions",null,o),proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.displayName="proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.toObject=function(e,r){var o,i={baseOptions:(o=r.getBaseOptions())&&n.BaseOptions.toObject(e,o),handDetectorGraphOptions:(o=r.getHandDetectorGraphOptions())&&s.HandDetectorGraphOptions.toObject(e,o),handLandmarksDetectorGraphOptions:(o=r.getHandLandmarksDetectorGraphOptions())&&p.HandLandmarksDetectorGraphOptions.toObject(e,o),minTrackingConfidence:t.Message.getFloatingPointFieldWithDefault(r,4,.5)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions;return proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=new s.HandDetectorGraphOptions;t.readMessage(r,s.HandDetectorGraphOptions.deserializeBinaryFromReader),e.setHandDetectorGraphOptions(r);break;case 3:r=new p.HandLandmarksDetectorGraphOptions;t.readMessage(r,p.HandLandmarksDetectorGraphOptions.deserializeBinaryFromReader),e.setHandLandmarksDetectorGraphOptions(r);break;case 4:r=t.readFloat();e.setMinTrackingConfidence(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getBaseOptions())&&r.writeMessage(1,o,n.BaseOptions.serializeBinaryToWriter),null!=(o=e.getHandDetectorGraphOptions())&&r.writeMessage(2,o,s.HandDetectorGraphOptions.serializeBinaryToWriter),null!=(o=e.getHandLandmarksDetectorGraphOptions())&&r.writeMessage(3,o,p.HandLandmarksDetectorGraphOptions.serializeBinaryToWriter),null!=(o=t.Message.getField(e,4))&&r.writeFloat(4,o)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.ext=new t.ExtensionFieldInfo(462713202,{ext:0},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[462713202]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[462713202]=proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.ext,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.getHandDetectorGraphOptions=function(){return t.Message.getWrapperField(this,s.HandDetectorGraphOptions,2)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.setHandDetectorGraphOptions=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.clearHandDetectorGraphOptions=function(){return this.setHandDetectorGraphOptions(void 0)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.hasHandDetectorGraphOptions=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.getHandLandmarksDetectorGraphOptions=function(){return t.Message.getWrapperField(this,p.HandLandmarksDetectorGraphOptions,3)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.setHandLandmarksDetectorGraphOptions=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.clearHandLandmarksDetectorGraphOptions=function(){return this.setHandLandmarksDetectorGraphOptions(void 0)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.hasHandLandmarksDetectorGraphOptions=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.getMinTrackingConfidence=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,.5)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.setMinTrackingConfidence=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.clearMinTrackingConfidence=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.hasMinTrackingConfidence=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.ext=new t.ExtensionFieldInfo(462713202,{ext:0},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[462713202]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[462713202]=proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.hand_landmarker.proto)}(hand_landmarker_graph_options_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n);var s=hand_gesture_recognizer_graph_options_pb;r.object.extend(proto,s);var p=hand_landmarker_graph_options_pb;r.object.extend(proto,p),r.exportSymbol("proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions",null,o),proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.displayName="proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.toObject=function(e,t){var r,o={baseOptions:(r=t.getBaseOptions())&&n.BaseOptions.toObject(e,r),handLandmarkerGraphOptions:(r=t.getHandLandmarkerGraphOptions())&&p.HandLandmarkerGraphOptions.toObject(e,r),handGestureRecognizerGraphOptions:(r=t.getHandGestureRecognizerGraphOptions())&&s.HandGestureRecognizerGraphOptions.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions;return proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=new p.HandLandmarkerGraphOptions;t.readMessage(r,p.HandLandmarkerGraphOptions.deserializeBinaryFromReader),e.setHandLandmarkerGraphOptions(r);break;case 3:r=new s.HandGestureRecognizerGraphOptions;t.readMessage(r,s.HandGestureRecognizerGraphOptions.deserializeBinaryFromReader),e.setHandGestureRecognizerGraphOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.serializeBinaryToWriter=function(e,t){var r=void 0;null!=(r=e.getBaseOptions())&&t.writeMessage(1,r,n.BaseOptions.serializeBinaryToWriter),null!=(r=e.getHandLandmarkerGraphOptions())&&t.writeMessage(2,r,p.HandLandmarkerGraphOptions.serializeBinaryToWriter),null!=(r=e.getHandGestureRecognizerGraphOptions())&&t.writeMessage(3,r,s.HandGestureRecognizerGraphOptions.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.ext=new t.ExtensionFieldInfo(479097054,{ext:0},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[479097054]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[479097054]=proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.ext,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.getHandLandmarkerGraphOptions=function(){return t.Message.getWrapperField(this,p.HandLandmarkerGraphOptions,2)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.setHandLandmarkerGraphOptions=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.clearHandLandmarkerGraphOptions=function(){return this.setHandLandmarkerGraphOptions(void 0)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.hasHandLandmarkerGraphOptions=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.getHandGestureRecognizerGraphOptions=function(){return t.Message.getWrapperField(this,s.HandGestureRecognizerGraphOptions,3)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.setHandGestureRecognizerGraphOptions=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.clearHandGestureRecognizerGraphOptions=function(){return this.setHandGestureRecognizerGraphOptions(void 0)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.hasHandGestureRecognizerGraphOptions=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.ext=new t.ExtensionFieldInfo(479097054,{ext:0},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[479097054]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[479097054]=proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.gesture_recognizer.proto)}(gesture_recognizer_graph_options_pb);var classifier_options={};Object.defineProperty(classifier_options,"__esModule",{value:!0}),classifier_options.convertClassifierOptionsToProto=void 0;const classifier_options_pb_1=classifier_options_pb;function convertClassifierOptionsToProto(e,t){const r=t?t.clone():new classifier_options_pb_1.ClassifierOptions;return void 0!==e.displayNamesLocale?r.setDisplayNamesLocale(e.displayNamesLocale):void 0===e.displayNamesLocale&&r.clearDisplayNamesLocale(),void 0!==e.maxResults?r.setMaxResults(e.maxResults):"maxResults"in e&&r.clearMaxResults(),void 0!==e.scoreThreshold?r.setScoreThreshold(e.scoreThreshold):"scoreThreshold"in e&&r.clearScoreThreshold(),void 0!==e.categoryAllowlist?r.setCategoryAllowlistList(e.categoryAllowlist):"categoryAllowlist"in e&&r.clearCategoryAllowlistList(),void 0!==e.categoryDenylist?r.setCategoryDenylistList(e.categoryDenylist):"categoryDenylist"in e&&r.clearCategoryDenylistList(),r}classifier_options.convertClassifierOptionsToProto=convertClassifierOptionsToProto;var hand_landmarks_connections={};Object.defineProperty(hand_landmarks_connections,"__esModule",{value:!0}),hand_landmarks_connections.HAND_CONNECTIONS=void 0,hand_landmarks_connections.HAND_CONNECTIONS=[{start:0,end:1},{start:1,end:2},{start:2,end:3},{start:3,end:4},{start:0,end:5},{start:5,end:6},{start:6,end:7},{start:7,end:8},{start:5,end:9},{start:9,end:10},{start:10,end:11},{start:11,end:12},{start:9,end:13},{start:13,end:14},{start:14,end:15},{start:15,end:16},{start:13,end:17},{start:0,end:17},{start:17,end:18},{start:18,end:19},{start:19,end:20}];var gesture_recognizer_options={};Object.defineProperty(gesture_recognizer_options,"__esModule",{value:!0});var gesture_recognizer_result={};Object.defineProperty(gesture_recognizer_result,"__esModule",{value:!0}),function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,i)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(e,r){for(var o in e)"default"===o||Object.prototype.hasOwnProperty.call(r,o)||t(r,e,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.GestureRecognizer=void 0;const o=calculator_pb,i=calculator_options_pb,a=classification_pb,n=landmark_pb,s=base_options_pb,p=gesture_classifier_graph_options_pb,d=gesture_recognizer_graph_options_pb,l=hand_gesture_recognizer_graph_options_pb,g=hand_detector_graph_options_pb,c=hand_landmarker_graph_options_pb,u=hand_landmarks_detector_graph_options_pb,m=classifier_options,f=vision_task_runner,h=hand_landmarks_connections;r(gesture_recognizer_options,e),r(gesture_recognizer_result,e);const y="image_in",b="norm_rect",_="hand_gestures",O="hand_landmarks",F="world_hand_landmarks",M="handedness",R=.5;class k extends f.VisionTaskRunner{static createFromOptions(e,t){return f.VisionTaskRunner.createVisionInstance(k,e,t)}static createFromModelBuffer(e,t){return f.VisionTaskRunner.createVisionInstance(k,e,{baseOptions:{modelAssetBuffer:t}})}static createFromModelPath(e,t){return f.VisionTaskRunner.createVisionInstance(k,e,{baseOptions:{modelAssetPath:t}})}constructor(e,t){super(new f.VisionGraphRunner(e,t),y,b,!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handednesses=[],this.options=new d.GestureRecognizerGraphOptions,this.options.setBaseOptions(new s.BaseOptions),this.handLandmarkerGraphOptions=new c.HandLandmarkerGraphOptions,this.options.setHandLandmarkerGraphOptions(this.handLandmarkerGraphOptions),this.handLandmarksDetectorGraphOptions=new u.HandLandmarksDetectorGraphOptions,this.handLandmarkerGraphOptions.setHandLandmarksDetectorGraphOptions(this.handLandmarksDetectorGraphOptions),this.handDetectorGraphOptions=new g.HandDetectorGraphOptions,this.handLandmarkerGraphOptions.setHandDetectorGraphOptions(this.handDetectorGraphOptions),this.handGestureRecognizerGraphOptions=new l.HandGestureRecognizerGraphOptions,this.options.setHandGestureRecognizerGraphOptions(this.handGestureRecognizerGraphOptions),this.handDetectorGraphOptions.setMinDetectionConfidence(R),this.handLandmarkerGraphOptions.setMinTrackingConfidence(R),this.handLandmarksDetectorGraphOptions.setMinDetectionConfidence(R)}get baseOptions(){return this.options.getBaseOptions()}set baseOptions(e){this.options.setBaseOptions(e)}setOptions(e){var t,r,o,i,a,n,s,d;if(this.handDetectorGraphOptions.setNumHands(null!==(t=e.numHands)&&void 0!==t?t:1),"minHandDetectionConfidence"in e&&this.handDetectorGraphOptions.setMinDetectionConfidence(null!==(r=e.minHandDetectionConfidence)&&void 0!==r?r:R),"minTrackingConfidence"in e&&this.handLandmarkerGraphOptions.setMinTrackingConfidence(null!==(o=e.minTrackingConfidence)&&void 0!==o?o:R),"minHandPresenceConfidence"in e&&this.handLandmarksDetectorGraphOptions.setMinDetectionConfidence(null!==(i=e.minHandPresenceConfidence)&&void 0!==i?i:R),e.cannedGesturesClassifierOptions){const t=new p.GestureClassifierGraphOptions;t.setClassifierOptions((0,m.convertClassifierOptionsToProto)(e.cannedGesturesClassifierOptions,null===(a=this.handGestureRecognizerGraphOptions.getCannedGestureClassifierGraphOptions())||void 0===a?void 0:a.getClassifierOptions())),this.handGestureRecognizerGraphOptions.setCannedGestureClassifierGraphOptions(t)}else void 0===e.cannedGesturesClassifierOptions&&(null===(n=this.handGestureRecognizerGraphOptions.getCannedGestureClassifierGraphOptions())||void 0===n||n.clearClassifierOptions());if(e.customGesturesClassifierOptions){const t=new p.GestureClassifierGraphOptions;t.setClassifierOptions((0,m.convertClassifierOptionsToProto)(e.customGesturesClassifierOptions,null===(s=this.handGestureRecognizerGraphOptions.getCustomGestureClassifierGraphOptions())||void 0===s?void 0:s.getClassifierOptions())),this.handGestureRecognizerGraphOptions.setCustomGestureClassifierGraphOptions(t)}else void 0===e.customGesturesClassifierOptions&&(null===(d=this.handGestureRecognizerGraphOptions.getCustomGestureClassifierGraphOptions())||void 0===d||d.clearClassifierOptions());return this.applyOptions(e)}recognize(e,t){return this.resetResults(),this.processImageData(e,t),this.processResults()}recognizeForVideo(e,t,r){return this.resetResults(),this.processVideoData(e,r,t),this.processResults()}resetResults(){this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handednesses=[]}processResults(){return 0===this.gestures.length?{gestures:[],landmarks:[],worldLandmarks:[],handednesses:[]}:{gestures:this.gestures,landmarks:this.landmarks,worldLandmarks:this.worldLandmarks,handednesses:this.handednesses}}toJsCategories(e,t=!0){var r,o,i;const n=[];for(const s of e){const e=a.ClassificationList.deserializeBinary(s),p=[];for(const a of e.getClassificationList()){const e=t&&a.hasIndex()?a.getIndex():-1;p.push({score:null!==(r=a.getScore())&&void 0!==r?r:0,index:e,categoryName:null!==(o=a.getLabel())&&void 0!==o?o:"",displayName:null!==(i=a.getDisplayName())&&void 0!==i?i:""})}n.push(p)}return n}addJsLandmarks(e){var t,r,o;for(const i of e){const e=n.NormalizedLandmarkList.deserializeBinary(i),a=[];for(const i of e.getLandmarkList())a.push({x:null!==(t=i.getX())&&void 0!==t?t:0,y:null!==(r=i.getY())&&void 0!==r?r:0,z:null!==(o=i.getZ())&&void 0!==o?o:0});this.landmarks.push(a)}}adddJsWorldLandmarks(e){var t,r,o;for(const i of e){const e=n.LandmarkList.deserializeBinary(i),a=[];for(const i of e.getLandmarkList())a.push({x:null!==(t=i.getX())&&void 0!==t?t:0,y:null!==(r=i.getY())&&void 0!==r?r:0,z:null!==(o=i.getZ())&&void 0!==o?o:0});this.worldLandmarks.push(a)}}refreshGraph(){const e=new o.CalculatorGraphConfig;e.addInputStream(y),e.addInputStream(b),e.addOutputStream(_),e.addOutputStream(O),e.addOutputStream(F),e.addOutputStream(M);const t=new i.CalculatorOptions;t.setExtension(d.GestureRecognizerGraphOptions.ext,this.options);const r=new o.CalculatorGraphConfig.Node;r.setCalculator("mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),r.addInputStream("IMAGE:"+y),r.addInputStream("NORM_RECT:"+b),r.addOutputStream("HAND_GESTURES:"+_),r.addOutputStream("LANDMARKS:"+O),r.addOutputStream("WORLD_LANDMARKS:"+F),r.addOutputStream("HANDEDNESS:"+M),r.setOptions(t),e.addNode(r),this.graphRunner.attachProtoVectorListener(O,((e,t)=>{this.addJsLandmarks(e),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(O,(e=>{this.setLatestOutputTimestamp(e)})),this.graphRunner.attachProtoVectorListener(F,((e,t)=>{this.adddJsWorldLandmarks(e),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(F,(e=>{this.setLatestOutputTimestamp(e)})),this.graphRunner.attachProtoVectorListener(_,((e,t)=>{this.gestures.push(...this.toJsCategories(e,!1)),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(_,(e=>{this.setLatestOutputTimestamp(e)})),this.graphRunner.attachProtoVectorListener(M,((e,t)=>{this.handednesses.push(...this.toJsCategories(e)),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(M,(e=>{this.setLatestOutputTimestamp(e)}));const a=e.serializeBinary();this.setGraph(new Uint8Array(a),!0)}}e.GestureRecognizer=k,k.HAND_CONNECTIONS=h.HAND_CONNECTIONS}(gesture_recognizer);var hand_landmarker={},hand_landmarker_options={};Object.defineProperty(hand_landmarker_options,"__esModule",{value:!0});var hand_landmarker_result={};Object.defineProperty(hand_landmarker_result,"__esModule",{value:!0}),function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,i)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(e,r){for(var o in e)"default"===o||Object.prototype.hasOwnProperty.call(r,o)||t(r,e,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.HandLandmarker=void 0;const o=calculator_pb,i=calculator_options_pb,a=classification_pb,n=landmark_pb,s=base_options_pb,p=hand_detector_graph_options_pb,d=hand_landmarker_graph_options_pb,l=hand_landmarks_detector_graph_options_pb,g=landmark_result,c=vision_task_runner,u=hand_landmarks_connections;r(hand_landmarker_options,e),r(hand_landmarker_result,e);const m="image_in",f="norm_rect",h="hand_landmarks",y="world_hand_landmarks",b="handedness",_=.5;class O extends c.VisionTaskRunner{static createFromOptions(e,t){return c.VisionTaskRunner.createVisionInstance(O,e,t)}static createFromModelBuffer(e,t){return c.VisionTaskRunner.createVisionInstance(O,e,{baseOptions:{modelAssetBuffer:t}})}static createFromModelPath(e,t){return c.VisionTaskRunner.createVisionInstance(O,e,{baseOptions:{modelAssetPath:t}})}constructor(e,t){super(new c.VisionGraphRunner(e,t),m,f,!1),this.landmarks=[],this.worldLandmarks=[],this.handednesses=[],this.options=new d.HandLandmarkerGraphOptions,this.options.setBaseOptions(new s.BaseOptions),this.handLandmarksDetectorGraphOptions=new l.HandLandmarksDetectorGraphOptions,this.options.setHandLandmarksDetectorGraphOptions(this.handLandmarksDetectorGraphOptions),this.handDetectorGraphOptions=new p.HandDetectorGraphOptions,this.options.setHandDetectorGraphOptions(this.handDetectorGraphOptions),this.initDefaults()}get baseOptions(){return this.options.getBaseOptions()}set baseOptions(e){this.options.setBaseOptions(e)}setOptions(e){var t,r,o,i;return"numHands"in e&&this.handDetectorGraphOptions.setNumHands(null!==(t=e.numHands)&&void 0!==t?t:1),"minHandDetectionConfidence"in e&&this.handDetectorGraphOptions.setMinDetectionConfidence(null!==(r=e.minHandDetectionConfidence)&&void 0!==r?r:_),"minTrackingConfidence"in e&&this.options.setMinTrackingConfidence(null!==(o=e.minTrackingConfidence)&&void 0!==o?o:_),"minHandPresenceConfidence"in e&&this.handLandmarksDetectorGraphOptions.setMinDetectionConfidence(null!==(i=e.minHandPresenceConfidence)&&void 0!==i?i:_),this.applyOptions(e)}detect(e,t){return this.resetResults(),this.processImageData(e,t),this.processResults()}detectForVideo(e,t,r){return this.resetResults(),this.processVideoData(e,r,t),this.processResults()}resetResults(){this.landmarks=[],this.worldLandmarks=[],this.handednesses=[]}processResults(){return{landmarks:this.landmarks,worldLandmarks:this.worldLandmarks,handednesses:this.handednesses}}initDefaults(){this.handDetectorGraphOptions.setNumHands(1),this.handDetectorGraphOptions.setMinDetectionConfidence(_),this.handLandmarksDetectorGraphOptions.setMinDetectionConfidence(_),this.options.setMinTrackingConfidence(_)}toJsCategories(e){var t,r,o,i;const n=[];for(const s of e){const e=a.ClassificationList.deserializeBinary(s),p=[];for(const a of e.getClassificationList())p.push({score:null!==(t=a.getScore())&&void 0!==t?t:0,index:null!==(r=a.getIndex())&&void 0!==r?r:-1,categoryName:null!==(o=a.getLabel())&&void 0!==o?o:"",displayName:null!==(i=a.getDisplayName())&&void 0!==i?i:""});n.push(p)}return n}addJsLandmarks(e){for(const t of e){const e=n.NormalizedLandmarkList.deserializeBinary(t);this.landmarks.push((0,g.convertToLandmarks)(e))}}adddJsWorldLandmarks(e){for(const t of e){const e=n.LandmarkList.deserializeBinary(t);this.worldLandmarks.push((0,g.convertToWorldLandmarks)(e))}}refreshGraph(){const e=new o.CalculatorGraphConfig;e.addInputStream(m),e.addInputStream(f),e.addOutputStream(h),e.addOutputStream(y),e.addOutputStream(b);const t=new i.CalculatorOptions;t.setExtension(d.HandLandmarkerGraphOptions.ext,this.options);const r=new o.CalculatorGraphConfig.Node;r.setCalculator("mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),r.addInputStream("IMAGE:"+m),r.addInputStream("NORM_RECT:"+f),r.addOutputStream("LANDMARKS:"+h),r.addOutputStream("WORLD_LANDMARKS:"+y),r.addOutputStream("HANDEDNESS:"+b),r.setOptions(t),e.addNode(r),this.graphRunner.attachProtoVectorListener(h,((e,t)=>{this.addJsLandmarks(e),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(h,(e=>{this.setLatestOutputTimestamp(e)})),this.graphRunner.attachProtoVectorListener(y,((e,t)=>{this.adddJsWorldLandmarks(e),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(y,(e=>{this.setLatestOutputTimestamp(e)})),this.graphRunner.attachProtoVectorListener(b,((e,t)=>{this.handednesses.push(...this.toJsCategories(e)),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(b,(e=>{this.setLatestOutputTimestamp(e)}));const a=e.serializeBinary();this.setGraph(new Uint8Array(a),!0)}}e.HandLandmarker=O,O.HAND_CONNECTIONS=u.HAND_CONNECTIONS}(hand_landmarker);var image_classifier={},classifications_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=classification_pb;r.object.extend(proto,i),r.exportSymbol("proto.mediapipe.tasks.components.containers.proto.ClassificationResult",null,o),r.exportSymbol("proto.mediapipe.tasks.components.containers.proto.Classifications",null,o),proto.mediapipe.tasks.components.containers.proto.Classifications=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.components.containers.proto.Classifications,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.components.containers.proto.Classifications.displayName="proto.mediapipe.tasks.components.containers.proto.Classifications"),proto.mediapipe.tasks.components.containers.proto.ClassificationResult=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.tasks.components.containers.proto.ClassificationResult.repeatedFields_,null)},r.inherits(proto.mediapipe.tasks.components.containers.proto.ClassificationResult,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.components.containers.proto.ClassificationResult.displayName="proto.mediapipe.tasks.components.containers.proto.ClassificationResult"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.toObject=function(e){return proto.mediapipe.tasks.components.containers.proto.Classifications.toObject(e,this)},proto.mediapipe.tasks.components.containers.proto.Classifications.toObject=function(e,r){var o,a={classificationList:(o=r.getClassificationList())&&i.ClassificationList.toObject(e,o),headIndex:null==(o=t.Message.getField(r,2))?void 0:o,headName:null==(o=t.Message.getField(r,3))?void 0:o};return e&&(a.$jspbMessageInstance=r),a}),proto.mediapipe.tasks.components.containers.proto.Classifications.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.components.containers.proto.Classifications;return proto.mediapipe.tasks.components.containers.proto.Classifications.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.components.containers.proto.Classifications.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 4:var r=new i.ClassificationList;t.readMessage(r,i.ClassificationList.deserializeBinaryFromReader),e.setClassificationList(r);break;case 2:r=t.readInt32();e.setHeadIndex(r);break;case 3:r=t.readString();e.setHeadName(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.components.containers.proto.Classifications.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.components.containers.proto.Classifications.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getClassificationList())&&r.writeMessage(4,o,i.ClassificationList.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeInt32(2,o),null!=(o=t.Message.getField(e,3))&&r.writeString(3,o)},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.getClassificationList=function(){return t.Message.getWrapperField(this,i.ClassificationList,4)},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.setClassificationList=function(e){return t.Message.setWrapperField(this,4,e)},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.clearClassificationList=function(){return this.setClassificationList(void 0)},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.hasClassificationList=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.getHeadIndex=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.setHeadIndex=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.clearHeadIndex=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.hasHeadIndex=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.getHeadName=function(){return t.Message.getFieldWithDefault(this,3,"")},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.setHeadName=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.clearHeadName=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.hasHeadName=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.components.containers.proto.ClassificationResult.prototype.toObject=function(e){return proto.mediapipe.tasks.components.containers.proto.ClassificationResult.toObject(e,this)},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.toObject=function(e,r){var o,i={classificationsList:t.Message.toObjectList(r.getClassificationsList(),proto.mediapipe.tasks.components.containers.proto.Classifications.toObject,e),timestampMs:null==(o=t.Message.getField(r,2))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.components.containers.proto.ClassificationResult.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.components.containers.proto.ClassificationResult;return proto.mediapipe.tasks.components.containers.proto.ClassificationResult.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new proto.mediapipe.tasks.components.containers.proto.Classifications;t.readMessage(r,proto.mediapipe.tasks.components.containers.proto.Classifications.deserializeBinaryFromReader),e.addClassifications(r);break;case 2:r=t.readInt64();e.setTimestampMs(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.components.containers.proto.ClassificationResult.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.serializeBinaryToWriter=function(e,r){var o=void 0;(o=e.getClassificationsList()).length>0&&r.writeRepeatedMessage(1,o,proto.mediapipe.tasks.components.containers.proto.Classifications.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeInt64(2,o)},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.prototype.getClassificationsList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.tasks.components.containers.proto.Classifications,1)},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.prototype.setClassificationsList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.prototype.addClassifications=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.tasks.components.containers.proto.Classifications,r)},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.prototype.clearClassificationsList=function(){return this.setClassificationsList([])},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.prototype.getTimestampMs=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.prototype.setTimestampMs=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.prototype.clearTimestampMs=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.prototype.hasTimestampMs=function(){return null!=t.Message.getField(this,2)},r.object.extend(e,proto.mediapipe.tasks.components.containers.proto)}(classifications_pb);var image_classifier_graph_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=classifier_options_pb;r.object.extend(proto,n);var s=base_options_pb;r.object.extend(proto,s),r.exportSymbol("proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions",null,o),proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.displayName="proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.toObject=function(e,t){var r,o={baseOptions:(r=t.getBaseOptions())&&s.BaseOptions.toObject(e,r),classifierOptions:(r=t.getClassifierOptions())&&n.ClassifierOptions.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions;return proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new s.BaseOptions;t.readMessage(r,s.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=new n.ClassifierOptions;t.readMessage(r,n.ClassifierOptions.deserializeBinaryFromReader),e.setClassifierOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.serializeBinaryToWriter=function(e,t){var r=void 0;null!=(r=e.getBaseOptions())&&t.writeMessage(1,r,s.BaseOptions.serializeBinaryToWriter),null!=(r=e.getClassifierOptions())&&t.writeMessage(2,r,n.ClassifierOptions.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.ext=new t.ExtensionFieldInfo(456383383,{ext:0},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions,proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[456383383]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[456383383]=proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.ext,proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,s.BaseOptions,1)},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.prototype.getClassifierOptions=function(){return t.Message.getWrapperField(this,n.ClassifierOptions,2)},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.prototype.setClassifierOptions=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.prototype.clearClassifierOptions=function(){return this.setClassifierOptions(void 0)},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.prototype.hasClassifierOptions=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.ext=new t.ExtensionFieldInfo(456383383,{ext:0},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions,proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[456383383]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[456383383]=proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.image_classifier.proto)}(image_classifier_graph_options_pb);var image_classifier_options={};Object.defineProperty(image_classifier_options,"__esModule",{value:!0});var image_classifier_result={};Object.defineProperty(image_classifier_result,"__esModule",{value:!0}),function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,i)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(e,r){for(var o in e)"default"===o||Object.prototype.hasOwnProperty.call(r,o)||t(r,e,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.ImageClassifier=void 0;const o=calculator_pb,i=calculator_options_pb,a=classifications_pb,n=base_options_pb,s=image_classifier_graph_options_pb,p=classifier_options,d=classifier_result,l=vision_task_runner,g="input_image",c="norm_rect",u="classifications";r(image_classifier_options,e),r(image_classifier_result,e);class m extends l.VisionTaskRunner{static createFromOptions(e,t){return l.VisionTaskRunner.createVisionInstance(m,e,t)}static createFromModelBuffer(e,t){return l.VisionTaskRunner.createVisionInstance(m,e,{baseOptions:{modelAssetBuffer:t}})}static createFromModelPath(e,t){return l.VisionTaskRunner.createVisionInstance(m,e,{baseOptions:{modelAssetPath:t}})}constructor(e,t){super(new l.VisionGraphRunner(e,t),g,c,!0),this.classificationResult={classifications:[]},this.options=new s.ImageClassifierGraphOptions,this.options.setBaseOptions(new n.BaseOptions)}get baseOptions(){return this.options.getBaseOptions()}set baseOptions(e){this.options.setBaseOptions(e)}setOptions(e){return this.options.setClassifierOptions((0,p.convertClassifierOptionsToProto)(e,this.options.getClassifierOptions())),this.applyOptions(e)}classify(e,t){return this.classificationResult={classifications:[]},this.processImageData(e,t),this.classificationResult}classifyForVideo(e,t,r){return this.classificationResult={classifications:[]},this.processVideoData(e,r,t),this.classificationResult}refreshGraph(){const e=new o.CalculatorGraphConfig;e.addInputStream(g),e.addInputStream(c),e.addOutputStream(u);const t=new i.CalculatorOptions;t.setExtension(s.ImageClassifierGraphOptions.ext,this.options);const r=new o.CalculatorGraphConfig.Node;r.setCalculator("mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),r.addInputStream("IMAGE:"+g),r.addInputStream("NORM_RECT:"+c),r.addOutputStream("CLASSIFICATIONS:"+u),r.setOptions(t),e.addNode(r),this.graphRunner.attachProtoListener(u,((e,t)=>{this.classificationResult=(0,d.convertFromClassificationResultProto)(a.ClassificationResult.deserializeBinary(e)),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(u,(e=>{this.setLatestOutputTimestamp(e)}));const n=e.serializeBinary();this.setGraph(new Uint8Array(n),!0)}}e.ImageClassifier=m}(image_classifier);var image_embedder={},embeddings_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.tasks.components.containers.proto.Embedding",null,o),r.exportSymbol("proto.mediapipe.tasks.components.containers.proto.Embedding.EmbeddingCase",null,o),r.exportSymbol("proto.mediapipe.tasks.components.containers.proto.EmbeddingResult",null,o),r.exportSymbol("proto.mediapipe.tasks.components.containers.proto.FloatEmbedding",null,o),r.exportSymbol("proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding",null,o),proto.mediapipe.tasks.components.containers.proto.FloatEmbedding=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.repeatedFields_,null)},r.inherits(proto.mediapipe.tasks.components.containers.proto.FloatEmbedding,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.displayName="proto.mediapipe.tasks.components.containers.proto.FloatEmbedding"),proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.displayName="proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding"),proto.mediapipe.tasks.components.containers.proto.Embedding=function(e){t.Message.initialize(this,e,0,-1,null,proto.mediapipe.tasks.components.containers.proto.Embedding.oneofGroups_)},r.inherits(proto.mediapipe.tasks.components.containers.proto.Embedding,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.components.containers.proto.Embedding.displayName="proto.mediapipe.tasks.components.containers.proto.Embedding"),proto.mediapipe.tasks.components.containers.proto.EmbeddingResult=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.repeatedFields_,null)},r.inherits(proto.mediapipe.tasks.components.containers.proto.EmbeddingResult,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.displayName="proto.mediapipe.tasks.components.containers.proto.EmbeddingResult"),proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.prototype.toObject=function(e){return proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.toObject(e,this)},proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.toObject=function(e,r){var o,i={valuesList:null==(o=t.Message.getRepeatedFloatingPointField(r,1))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.components.containers.proto.FloatEmbedding;return proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber())for(var r=t.isDelimited()?t.readPackedFloat():[t.readFloat()],o=0;o0&&t.writePackedFloat(1,r)},proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.prototype.getValuesList=function(){return t.Message.getRepeatedFloatingPointField(this,1)},proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.prototype.setValuesList=function(e){return t.Message.setField(this,1,e||[])},proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.prototype.addValues=function(e,r){return t.Message.addToRepeatedField(this,1,e,r)},proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.prototype.clearValuesList=function(){return this.setValuesList([])},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.prototype.toObject=function(e){return proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.toObject(e,this)},proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.toObject=function(e,t){var r={values:t.getValues_asB64()};return e&&(r.$jspbMessageInstance=t),r}),proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding;return proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=t.readBytes();e.setValues(r)}else t.skipField()}return e},proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.serializeBinaryToWriter=function(e,r){var o;null!=(o=t.Message.getField(e,1))&&r.writeBytes(1,o)},proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.prototype.getValues=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.prototype.getValues_asB64=function(){return t.Message.bytesAsB64(this.getValues())},proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.prototype.getValues_asU8=function(){return t.Message.bytesAsU8(this.getValues())},proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.prototype.setValues=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.prototype.clearValues=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.prototype.hasValues=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.components.containers.proto.Embedding.oneofGroups_=[[1,2]],proto.mediapipe.tasks.components.containers.proto.Embedding.EmbeddingCase={EMBEDDING_NOT_SET:0,FLOAT_EMBEDDING:1,QUANTIZED_EMBEDDING:2},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.getEmbeddingCase=function(){return t.Message.computeOneofCase(this,proto.mediapipe.tasks.components.containers.proto.Embedding.oneofGroups_[0])},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.toObject=function(e){return proto.mediapipe.tasks.components.containers.proto.Embedding.toObject(e,this)},proto.mediapipe.tasks.components.containers.proto.Embedding.toObject=function(e,r){var o,i={floatEmbedding:(o=r.getFloatEmbedding())&&proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.toObject(e,o),quantizedEmbedding:(o=r.getQuantizedEmbedding())&&proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.toObject(e,o),headIndex:null==(o=t.Message.getField(r,3))?void 0:o,headName:null==(o=t.Message.getField(r,4))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.components.containers.proto.Embedding.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.components.containers.proto.Embedding;return proto.mediapipe.tasks.components.containers.proto.Embedding.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.components.containers.proto.Embedding.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new proto.mediapipe.tasks.components.containers.proto.FloatEmbedding;t.readMessage(r,proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.deserializeBinaryFromReader),e.setFloatEmbedding(r);break;case 2:r=new proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding;t.readMessage(r,proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.deserializeBinaryFromReader),e.setQuantizedEmbedding(r);break;case 3:r=t.readInt32();e.setHeadIndex(r);break;case 4:r=t.readString();e.setHeadName(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.components.containers.proto.Embedding.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.components.containers.proto.Embedding.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getFloatEmbedding())&&r.writeMessage(1,o,proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.serializeBinaryToWriter),null!=(o=e.getQuantizedEmbedding())&&r.writeMessage(2,o,proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.serializeBinaryToWriter),null!=(o=t.Message.getField(e,3))&&r.writeInt32(3,o),null!=(o=t.Message.getField(e,4))&&r.writeString(4,o)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.getFloatEmbedding=function(){return t.Message.getWrapperField(this,proto.mediapipe.tasks.components.containers.proto.FloatEmbedding,1)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.setFloatEmbedding=function(e){return t.Message.setOneofWrapperField(this,1,proto.mediapipe.tasks.components.containers.proto.Embedding.oneofGroups_[0],e)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.clearFloatEmbedding=function(){return this.setFloatEmbedding(void 0)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.hasFloatEmbedding=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.getQuantizedEmbedding=function(){return t.Message.getWrapperField(this,proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding,2)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.setQuantizedEmbedding=function(e){return t.Message.setOneofWrapperField(this,2,proto.mediapipe.tasks.components.containers.proto.Embedding.oneofGroups_[0],e)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.clearQuantizedEmbedding=function(){return this.setQuantizedEmbedding(void 0)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.hasQuantizedEmbedding=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.getHeadIndex=function(){return t.Message.getFieldWithDefault(this,3,0)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.setHeadIndex=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.clearHeadIndex=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.hasHeadIndex=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.getHeadName=function(){return t.Message.getFieldWithDefault(this,4,"")},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.setHeadName=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.clearHeadName=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.hasHeadName=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.prototype.toObject=function(e){return proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.toObject(e,this)},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.toObject=function(e,r){var o,i={embeddingsList:t.Message.toObjectList(r.getEmbeddingsList(),proto.mediapipe.tasks.components.containers.proto.Embedding.toObject,e),timestampMs:null==(o=t.Message.getField(r,2))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.components.containers.proto.EmbeddingResult;return proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new proto.mediapipe.tasks.components.containers.proto.Embedding;t.readMessage(r,proto.mediapipe.tasks.components.containers.proto.Embedding.deserializeBinaryFromReader),e.addEmbeddings(r);break;case 2:r=t.readInt64();e.setTimestampMs(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.serializeBinaryToWriter=function(e,r){var o=void 0;(o=e.getEmbeddingsList()).length>0&&r.writeRepeatedMessage(1,o,proto.mediapipe.tasks.components.containers.proto.Embedding.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeInt64(2,o)},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.prototype.getEmbeddingsList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.tasks.components.containers.proto.Embedding,1)},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.prototype.setEmbeddingsList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.prototype.addEmbeddings=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.tasks.components.containers.proto.Embedding,r)},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.prototype.clearEmbeddingsList=function(){return this.setEmbeddingsList([])},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.prototype.getTimestampMs=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.prototype.setTimestampMs=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.prototype.clearTimestampMs=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.prototype.hasTimestampMs=function(){return null!=t.Message.getField(this,2)},r.object.extend(e,proto.mediapipe.tasks.components.containers.proto)}(embeddings_pb);var image_embedder_graph_options_pb={},embedder_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.tasks.components.processors.proto.EmbedderOptions",null,o),proto.mediapipe.tasks.components.processors.proto.EmbedderOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.components.processors.proto.EmbedderOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.displayName="proto.mediapipe.tasks.components.processors.proto.EmbedderOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.toObject(e,this)},proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.toObject=function(e,r){var o,i={l2Normalize:null==(o=t.Message.getBooleanField(r,1))?void 0:o,quantize:null==(o=t.Message.getBooleanField(r,2))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.components.processors.proto.EmbedderOptions;return proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readBool();e.setL2Normalize(r);break;case 2:r=t.readBool();e.setQuantize(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeBool(1,o),null!=(o=t.Message.getField(e,2))&&r.writeBool(2,o)},proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.prototype.getL2Normalize=function(){return t.Message.getBooleanFieldWithDefault(this,1,!1)},proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.prototype.setL2Normalize=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.prototype.clearL2Normalize=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.prototype.hasL2Normalize=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.prototype.getQuantize=function(){return t.Message.getBooleanFieldWithDefault(this,2,!1)},proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.prototype.setQuantize=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.prototype.clearQuantize=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.prototype.hasQuantize=function(){return null!=t.Message.getField(this,2)},r.object.extend(e,proto.mediapipe.tasks.components.processors.proto)}(embedder_options_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=embedder_options_pb;r.object.extend(proto,n);var s=base_options_pb;r.object.extend(proto,s),r.exportSymbol("proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions",null,o),proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.displayName="proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.toObject=function(e,t){var r,o={baseOptions:(r=t.getBaseOptions())&&s.BaseOptions.toObject(e,r),embedderOptions:(r=t.getEmbedderOptions())&&n.EmbedderOptions.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions;return proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new s.BaseOptions;t.readMessage(r,s.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=new n.EmbedderOptions;t.readMessage(r,n.EmbedderOptions.deserializeBinaryFromReader),e.setEmbedderOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.serializeBinaryToWriter=function(e,t){var r=void 0;null!=(r=e.getBaseOptions())&&t.writeMessage(1,r,s.BaseOptions.serializeBinaryToWriter),null!=(r=e.getEmbedderOptions())&&t.writeMessage(2,r,n.EmbedderOptions.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.ext=new t.ExtensionFieldInfo(476348187,{ext:0},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions,proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[476348187]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[476348187]=proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.ext,proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,s.BaseOptions,1)},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.prototype.getEmbedderOptions=function(){return t.Message.getWrapperField(this,n.EmbedderOptions,2)},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.prototype.setEmbedderOptions=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.prototype.clearEmbedderOptions=function(){return this.setEmbedderOptions(void 0)},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.prototype.hasEmbedderOptions=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.ext=new t.ExtensionFieldInfo(476348187,{ext:0},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions,proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[476348187]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[476348187]=proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.image_embedder.proto)}(image_embedder_graph_options_pb);var embedder_options={};Object.defineProperty(embedder_options,"__esModule",{value:!0}),embedder_options.convertEmbedderOptionsToProto=void 0;const embedder_options_pb_1=embedder_options_pb;function convertEmbedderOptionsToProto(e,t){const r=t?t.clone():new embedder_options_pb_1.EmbedderOptions;return void 0!==e.l2Normalize?r.setL2Normalize(e.l2Normalize):"l2Normalize"in e&&r.clearL2Normalize(),void 0!==e.quantize?r.setQuantize(e.quantize):"quantize"in e&&r.clearQuantize(),r}embedder_options.convertEmbedderOptionsToProto=convertEmbedderOptionsToProto;var embedder_result={};Object.defineProperty(embedder_result,"__esModule",{value:!0}),embedder_result.convertFromEmbeddingResultProto=void 0;const DEFAULT_INDEX=-1;function convertFromEmbeddingsProto(e){var t,r,o,i;const a={headIndex:null!==(t=e.getHeadIndex())&&void 0!==t?t:DEFAULT_INDEX,headName:null!==(r=e.getHeadName())&&void 0!==r?r:""};if(e.hasFloatEmbedding())a.floatEmbedding=e.getFloatEmbedding().getValuesList();else{const t=null!==(i=null===(o=e.getQuantizedEmbedding())||void 0===o?void 0:o.getValues())&&void 0!==i?i:"";a.quantizedEmbedding="string"==typeof t?Uint8Array.from(atob(t),(e=>e.charCodeAt(0))):t}return a}function convertFromEmbeddingResultProto(e){return{embeddings:e.getEmbeddingsList().map((e=>convertFromEmbeddingsProto(e))),timestampMs:e.getTimestampMs()}}embedder_result.convertFromEmbeddingResultProto=convertFromEmbeddingResultProto;var cosine_similarity={};function computeCosineSimilarity(e,t){if(e.floatEmbedding&&t.floatEmbedding)return compute(e.floatEmbedding,t.floatEmbedding);if(e.quantizedEmbedding&&t.quantizedEmbedding)return compute(convertToBytes(e.quantizedEmbedding),convertToBytes(t.quantizedEmbedding));throw new Error("Cannot compute cosine similarity between quantized and float embeddings.")}function convertToBytes(e){return Array.from(e,(e=>e>127?e-256:e))}function compute(e,t){if(e.length!==t.length)throw new Error(`Cannot compute cosine similarity between embeddings of different sizes (${e.length} vs. ${t.length}).`);let r=0,o=0,i=0;for(let a=0;a{this.addJsImageEmdedding(e),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(m,(e=>{this.setLatestOutputTimestamp(e)}));const a=e.serializeBinary();this.setGraph(new Uint8Array(a),!0)}}e.ImageEmbedder=f}(image_embedder);var image_segmenter={},tensors_to_segmentation_calculator_pb={},segmenter_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions",null,o),r.exportSymbol("proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.Activation",null,o),r.exportSymbol("proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.OutputType",null,o),proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.displayName="proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.toObject(e,this)},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.toObject=function(e,r){var o,i={outputType:null==(o=t.Message.getField(r,1))?void 0:o,activation:t.Message.getFieldWithDefault(r,2,0)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions;return proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readEnum();e.setOutputType(r);break;case 2:r=t.readEnum();e.setActivation(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeEnum(1,o),null!=(o=t.Message.getField(e,2))&&r.writeEnum(2,o)},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.OutputType={UNSPECIFIED:0,CATEGORY_MASK:1,CONFIDENCE_MASK:2},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.Activation={NONE:0,SIGMOID:1,SOFTMAX:2},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.prototype.getOutputType=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.prototype.setOutputType=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.prototype.clearOutputType=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.prototype.hasOutputType=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.prototype.getActivation=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.prototype.setActivation=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.prototype.clearActivation=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.prototype.hasActivation=function(){return null!=t.Message.getField(this,2)},r.object.extend(e,proto.mediapipe.tasks.vision.image_segmenter.proto)}(segmenter_options_pb);var label_map_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.LabelMapItem",null,o),proto.mediapipe.LabelMapItem=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.LabelMapItem.repeatedFields_,null)},r.inherits(proto.mediapipe.LabelMapItem,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.LabelMapItem.displayName="proto.mediapipe.LabelMapItem"),proto.mediapipe.LabelMapItem.repeatedFields_=[3],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.LabelMapItem.prototype.toObject=function(e){return proto.mediapipe.LabelMapItem.toObject(e,this)},proto.mediapipe.LabelMapItem.toObject=function(e,r){var o,i={name:null==(o=t.Message.getField(r,1))?void 0:o,displayName:null==(o=t.Message.getField(r,2))?void 0:o,childNameList:null==(o=t.Message.getRepeatedField(r,3))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.LabelMapItem.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.LabelMapItem;return proto.mediapipe.LabelMapItem.deserializeBinaryFromReader(o,r)},proto.mediapipe.LabelMapItem.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setName(r);break;case 2:r=t.readString();e.setDisplayName(r);break;case 3:r=t.readString();e.addChildName(r);break;default:t.skipField()}}return e},proto.mediapipe.LabelMapItem.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.LabelMapItem.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.LabelMapItem.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeString(1,o),null!=(o=t.Message.getField(e,2))&&r.writeString(2,o),(o=e.getChildNameList()).length>0&&r.writeRepeatedString(3,o)},proto.mediapipe.LabelMapItem.prototype.getName=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.LabelMapItem.prototype.setName=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.LabelMapItem.prototype.clearName=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.LabelMapItem.prototype.hasName=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.LabelMapItem.prototype.getDisplayName=function(){return t.Message.getFieldWithDefault(this,2,"")},proto.mediapipe.LabelMapItem.prototype.setDisplayName=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.LabelMapItem.prototype.clearDisplayName=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.LabelMapItem.prototype.hasDisplayName=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.LabelMapItem.prototype.getChildNameList=function(){return t.Message.getRepeatedField(this,3)},proto.mediapipe.LabelMapItem.prototype.setChildNameList=function(e){return t.Message.setField(this,3,e||[])},proto.mediapipe.LabelMapItem.prototype.addChildName=function(e,r){return t.Message.addToRepeatedField(this,3,e,r)},proto.mediapipe.LabelMapItem.prototype.clearChildNameList=function(){return this.setChildNameList([])},r.object.extend(e,proto.mediapipe)}(label_map_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_options_pb;r.object.extend(proto,i);var a=segmenter_options_pb;r.object.extend(proto,a);var n=label_map_pb;r.object.extend(proto,n),r.exportSymbol("proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions",null,o),proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.displayName="proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.toObject(e,this)},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.toObject=function(e,t){var r,o={segmenterOptions:(r=t.getSegmenterOptions())&&a.SegmenterOptions.toObject(e,r),labelItemsMap:(r=t.getLabelItemsMap())?r.toObject(e,proto.mediapipe.LabelMapItem.toObject):[]};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions;return proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.deserializeBinaryFromReader=function(e,r){for(;r.nextField()&&!r.isEndGroup();){switch(r.getFieldNumber()){case 1:var o=new a.SegmenterOptions;r.readMessage(o,a.SegmenterOptions.deserializeBinaryFromReader),e.setSegmenterOptions(o);break;case 2:o=e.getLabelItemsMap();r.readMessage(o,(function(e,r){t.Map.deserializeBinary(e,r,t.BinaryReader.prototype.readInt64,t.BinaryReader.prototype.readMessage,proto.mediapipe.LabelMapItem.deserializeBinaryFromReader,0,new proto.mediapipe.LabelMapItem)}));break;default:r.skipField()}}return e},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getSegmenterOptions())&&r.writeMessage(1,o,a.SegmenterOptions.serializeBinaryToWriter),(o=e.getLabelItemsMap(!0))&&o.getLength()>0&&o.serializeBinary(2,r,t.BinaryWriter.prototype.writeInt64,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.LabelMapItem.serializeBinaryToWriter)},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.ext=new t.ExtensionFieldInfo(458105876,{ext:0},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions,proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.toObject,0),i.CalculatorOptions.extensionsBinary[458105876]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.serializeBinaryToWriter,proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.deserializeBinaryFromReader,!1),i.CalculatorOptions.extensions[458105876]=proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.ext,proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.prototype.getSegmenterOptions=function(){return t.Message.getWrapperField(this,a.SegmenterOptions,1)},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.prototype.setSegmenterOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.prototype.clearSegmenterOptions=function(){return this.setSegmenterOptions(void 0)},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.prototype.hasSegmenterOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.prototype.getLabelItemsMap=function(e){return t.Message.getMapField(this,2,e,proto.mediapipe.LabelMapItem)},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.prototype.clearLabelItemsMap=function(){return this.getLabelItemsMap().clear(),this},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.ext=new t.ExtensionFieldInfo(458105876,{ext:0},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions,proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.toObject,0),i.CalculatorOptions.extensionsBinary[458105876]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.serializeBinaryToWriter,proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.deserializeBinaryFromReader,!1),i.CalculatorOptions.extensions[458105876]=proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.ext,r.object.extend(e,proto.mediapipe.tasks)}(tensors_to_segmentation_calculator_pb);var image_segmenter_graph_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n);var s=segmenter_options_pb;r.object.extend(proto,s),r.exportSymbol("proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions",null,o),proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.displayName="proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.toObject=function(e,r){var o,i={baseOptions:(o=r.getBaseOptions())&&n.BaseOptions.toObject(e,o),displayNamesLocale:t.Message.getFieldWithDefault(r,2,"en"),segmenterOptions:(o=r.getSegmenterOptions())&&s.SegmenterOptions.toObject(e,o)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions;return proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=t.readString();e.setDisplayNamesLocale(r);break;case 3:r=new s.SegmenterOptions;t.readMessage(r,s.SegmenterOptions.deserializeBinaryFromReader),e.setSegmenterOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getBaseOptions())&&r.writeMessage(1,o,n.BaseOptions.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeString(2,o),null!=(o=e.getSegmenterOptions())&&r.writeMessage(3,o,s.SegmenterOptions.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.ext=new t.ExtensionFieldInfo(458105758,{ext:0},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions,proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[458105758]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[458105758]=proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.ext,proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.getDisplayNamesLocale=function(){return t.Message.getFieldWithDefault(this,2,"en")},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.setDisplayNamesLocale=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.clearDisplayNamesLocale=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.hasDisplayNamesLocale=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.getSegmenterOptions=function(){return t.Message.getWrapperField(this,s.SegmenterOptions,3)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.setSegmenterOptions=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.clearSegmenterOptions=function(){return this.setSegmenterOptions(void 0)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.hasSegmenterOptions=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.ext=new t.ExtensionFieldInfo(458105758,{ext:0},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions,proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[458105758]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[458105758]=proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.image_segmenter.proto)}(image_segmenter_graph_options_pb);var image_segmenter_options={};Object.defineProperty(image_segmenter_options,"__esModule",{value:!0});var image_segmenter_result={};Object.defineProperty(image_segmenter_result,"__esModule",{value:!0}),function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,i)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(e,r){for(var o in e)"default"===o||Object.prototype.hasOwnProperty.call(r,o)||t(r,e,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.ImageSegmenter=void 0;const o=calculator_pb,i=calculator_options_pb,a=base_options_pb,n=tensors_to_segmentation_calculator_pb,s=image_segmenter_graph_options_pb,p=segmenter_options_pb,d=vision_task_runner;r(image_segmenter_options,e),r(image_segmenter_result,e);const l="image_in",g="norm_rect",c="confidence_masks",u="category_mask",m="mediapipe.tasks.TensorsToSegmentationCalculator";class f extends d.VisionTaskRunner{static createFromOptions(e,t){return d.VisionTaskRunner.createVisionInstance(f,e,t)}static createFromModelBuffer(e,t){return d.VisionTaskRunner.createVisionInstance(f,e,{baseOptions:{modelAssetBuffer:t}})}static createFromModelPath(e,t){return d.VisionTaskRunner.createVisionInstance(f,e,{baseOptions:{modelAssetPath:t}})}constructor(e,t){super(new d.VisionGraphRunner(e,t),l,g,!1),this.result={},this.labels=[],this.outputCategoryMask=false,this.outputConfidenceMasks=true,this.options=new s.ImageSegmenterGraphOptions,this.segmenterOptions=new p.SegmenterOptions,this.options.setSegmenterOptions(this.segmenterOptions),this.options.setBaseOptions(new a.BaseOptions)}get baseOptions(){return this.options.getBaseOptions()}set baseOptions(e){this.options.setBaseOptions(e)}setOptions(e){var t,r;return void 0!==e.displayNamesLocale?this.options.setDisplayNamesLocale(e.displayNamesLocale):"displayNamesLocale"in e&&this.options.clearDisplayNamesLocale(),"outputCategoryMask"in e&&(this.outputCategoryMask=null!==(t=e.outputCategoryMask)&&void 0!==t&&t),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=null===(r=e.outputConfidenceMasks)||void 0===r||r),super.applyOptions(e)}onGraphRefreshed(){this.populateLabels()}populateLabels(){var e,t,r;const o=this.getCalculatorGraphConfig().getNodeList().filter((e=>e.getName().includes(m)));if(this.labels=[],o.length>1)throw new Error(`The graph has more than one ${m}.`);if(1===o.length){(null!==(r=null===(t=null===(e=o[0].getOptions())||void 0===e?void 0:e.getExtension(n.TensorsToSegmentationCalculatorOptions.ext))||void 0===t?void 0:t.getLabelItemsMap())&&void 0!==r?r:new Map).forEach(((e,t)=>{this.labels[Number(t)]=e.getName()}))}}segment(e,t,r){const o="function"!=typeof t?t:{};if(this.userCallback="function"==typeof t?t:r,this.reset(),this.processImageData(e,o),!this.userCallback)return this.result}segmentForVideo(e,t,r,o){const i="function"!=typeof r?r:{};if(this.userCallback="function"==typeof r?r:o,this.reset(),this.processVideoData(e,i,t),!this.userCallback)return this.result}getLabels(){return this.labels}reset(){this.result={}}maybeInvokeCallback(){this.outputConfidenceMasks&&!("confidenceMasks"in this.result)||this.outputCategoryMask&&!("categoryMask"in this.result)||this.userCallback&&(this.userCallback(this.result),this.freeKeepaliveStreams())}refreshGraph(){const e=new o.CalculatorGraphConfig;e.addInputStream(l),e.addInputStream(g);const t=new i.CalculatorOptions;t.setExtension(s.ImageSegmenterGraphOptions.ext,this.options);const r=new o.CalculatorGraphConfig.Node;r.setCalculator("mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),r.addInputStream("IMAGE:"+l),r.addInputStream("NORM_RECT:"+g),r.setOptions(t),e.addNode(r),this.addKeepaliveNode(e),this.outputConfidenceMasks&&(e.addOutputStream(c),r.addOutputStream("CONFIDENCE_MASKS:"+c),this.keepStreamAlive(c),this.graphRunner.attachImageVectorListener(c,((e,t)=>{this.result.confidenceMasks=e.map((e=>this.convertToMPMask(e,!this.userCallback))),this.setLatestOutputTimestamp(t),this.maybeInvokeCallback()})),this.graphRunner.attachEmptyPacketListener(c,(e=>{this.result.confidenceMasks=void 0,this.setLatestOutputTimestamp(e),this.maybeInvokeCallback()}))),this.outputCategoryMask&&(e.addOutputStream(u),r.addOutputStream("CATEGORY_MASK:"+u),this.keepStreamAlive(u),this.graphRunner.attachImageListener(u,((e,t)=>{this.result.categoryMask=this.convertToMPMask(e,!this.userCallback),this.setLatestOutputTimestamp(t),this.maybeInvokeCallback()})),this.graphRunner.attachEmptyPacketListener(u,(e=>{this.result.categoryMask=void 0,this.setLatestOutputTimestamp(e),this.maybeInvokeCallback()})));const a=e.serializeBinary();this.setGraph(new Uint8Array(a),!0)}}e.ImageSegmenter=f}(image_segmenter);var interactive_segmenter={},color_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.Color",null,o),r.exportSymbol("proto.mediapipe.ColorMap",null,o),proto.mediapipe.Color=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.Color,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.Color.displayName="proto.mediapipe.Color"),proto.mediapipe.ColorMap=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.ColorMap,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.ColorMap.displayName="proto.mediapipe.ColorMap"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.Color.prototype.toObject=function(e){return proto.mediapipe.Color.toObject(e,this)},proto.mediapipe.Color.toObject=function(e,r){var o,i={r:null==(o=t.Message.getField(r,1))?void 0:o,g:null==(o=t.Message.getField(r,2))?void 0:o,b:null==(o=t.Message.getField(r,3))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.Color.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.Color;return proto.mediapipe.Color.deserializeBinaryFromReader(o,r)},proto.mediapipe.Color.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readInt32();e.setR(r);break;case 2:r=t.readInt32();e.setG(r);break;case 3:r=t.readInt32();e.setB(r);break;default:t.skipField()}}return e},proto.mediapipe.Color.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.Color.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.Color.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeInt32(1,o),null!=(o=t.Message.getField(e,2))&&r.writeInt32(2,o),null!=(o=t.Message.getField(e,3))&&r.writeInt32(3,o)},proto.mediapipe.Color.prototype.getR=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.Color.prototype.setR=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.Color.prototype.clearR=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.Color.prototype.hasR=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.Color.prototype.getG=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.Color.prototype.setG=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.Color.prototype.clearG=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.Color.prototype.hasG=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.Color.prototype.getB=function(){return t.Message.getFieldWithDefault(this,3,0)},proto.mediapipe.Color.prototype.setB=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.Color.prototype.clearB=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.Color.prototype.hasB=function(){return null!=t.Message.getField(this,3)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.ColorMap.prototype.toObject=function(e){return proto.mediapipe.ColorMap.toObject(e,this)},proto.mediapipe.ColorMap.toObject=function(e,t){var r,o={labelToColorMap:(r=t.getLabelToColorMap())?r.toObject(e,proto.mediapipe.Color.toObject):[]};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.ColorMap.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.ColorMap;return proto.mediapipe.ColorMap.deserializeBinaryFromReader(o,r)},proto.mediapipe.ColorMap.deserializeBinaryFromReader=function(e,r){for(;r.nextField()&&!r.isEndGroup();){if(1===r.getFieldNumber()){var o=e.getLabelToColorMap();r.readMessage(o,(function(e,r){t.Map.deserializeBinary(e,r,t.BinaryReader.prototype.readString,t.BinaryReader.prototype.readMessage,proto.mediapipe.Color.deserializeBinaryFromReader,"",new proto.mediapipe.Color)}))}else r.skipField()}return e},proto.mediapipe.ColorMap.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.ColorMap.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.ColorMap.serializeBinaryToWriter=function(e,r){var o=void 0;(o=e.getLabelToColorMap(!0))&&o.getLength()>0&&o.serializeBinary(1,r,t.BinaryWriter.prototype.writeString,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.Color.serializeBinaryToWriter)},proto.mediapipe.ColorMap.prototype.getLabelToColorMap=function(e){return t.Message.getMapField(this,1,e,proto.mediapipe.Color)},proto.mediapipe.ColorMap.prototype.clearLabelToColorMap=function(){return this.getLabelToColorMap().clear(),this},r.object.extend(e,proto.mediapipe)}(color_pb);var render_data_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=color_pb;r.object.extend(proto,i),r.exportSymbol("proto.mediapipe.RenderAnnotation",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.Arrow",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.DataCase",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.FilledOval",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.FilledRectangle",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.FilledRoundedRectangle",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.GradientLine",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.Line",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.Line.LineType",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.Oval",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.Point",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.Rectangle",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.RoundedRectangle",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.Scribble",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.Text",null,o),r.exportSymbol("proto.mediapipe.RenderData",null,o),r.exportSymbol("proto.mediapipe.RenderViewport",null,o),proto.mediapipe.RenderData=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.RenderData.repeatedFields_,null)},r.inherits(proto.mediapipe.RenderData,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderData.displayName="proto.mediapipe.RenderData"),proto.mediapipe.RenderAnnotation=function(e){t.Message.initialize(this,e,0,-1,null,proto.mediapipe.RenderAnnotation.oneofGroups_)},r.inherits(proto.mediapipe.RenderAnnotation,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.displayName="proto.mediapipe.RenderAnnotation"),proto.mediapipe.RenderAnnotation.Rectangle=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.RenderAnnotation.Rectangle,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.Rectangle.displayName="proto.mediapipe.RenderAnnotation.Rectangle"),proto.mediapipe.RenderAnnotation.FilledRectangle=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.RenderAnnotation.FilledRectangle,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.FilledRectangle.displayName="proto.mediapipe.RenderAnnotation.FilledRectangle"),proto.mediapipe.RenderAnnotation.RoundedRectangle=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.RenderAnnotation.RoundedRectangle,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.RoundedRectangle.displayName="proto.mediapipe.RenderAnnotation.RoundedRectangle"),proto.mediapipe.RenderAnnotation.FilledRoundedRectangle=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.RenderAnnotation.FilledRoundedRectangle,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.displayName="proto.mediapipe.RenderAnnotation.FilledRoundedRectangle"),proto.mediapipe.RenderAnnotation.Oval=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.RenderAnnotation.Oval,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.Oval.displayName="proto.mediapipe.RenderAnnotation.Oval"),proto.mediapipe.RenderAnnotation.FilledOval=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.RenderAnnotation.FilledOval,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.FilledOval.displayName="proto.mediapipe.RenderAnnotation.FilledOval"),proto.mediapipe.RenderAnnotation.Point=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.RenderAnnotation.Point,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.Point.displayName="proto.mediapipe.RenderAnnotation.Point"),proto.mediapipe.RenderAnnotation.Line=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.RenderAnnotation.Line,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.Line.displayName="proto.mediapipe.RenderAnnotation.Line"),proto.mediapipe.RenderAnnotation.GradientLine=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.RenderAnnotation.GradientLine,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.GradientLine.displayName="proto.mediapipe.RenderAnnotation.GradientLine"),proto.mediapipe.RenderAnnotation.Scribble=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.RenderAnnotation.Scribble.repeatedFields_,null)},r.inherits(proto.mediapipe.RenderAnnotation.Scribble,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.Scribble.displayName="proto.mediapipe.RenderAnnotation.Scribble"),proto.mediapipe.RenderAnnotation.Arrow=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.RenderAnnotation.Arrow,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.Arrow.displayName="proto.mediapipe.RenderAnnotation.Arrow"),proto.mediapipe.RenderAnnotation.Text=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.RenderAnnotation.Text,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.Text.displayName="proto.mediapipe.RenderAnnotation.Text"),proto.mediapipe.RenderViewport=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.RenderViewport,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderViewport.displayName="proto.mediapipe.RenderViewport"),proto.mediapipe.RenderData.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderData.prototype.toObject=function(e){return proto.mediapipe.RenderData.toObject(e,this)},proto.mediapipe.RenderData.toObject=function(e,r){var o,i={renderAnnotationsList:t.Message.toObjectList(r.getRenderAnnotationsList(),proto.mediapipe.RenderAnnotation.toObject,e),sceneClass:null==(o=t.Message.getField(r,2))?void 0:o,sceneViewport:(o=r.getSceneViewport())&&proto.mediapipe.RenderViewport.toObject(e,o)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.RenderData.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderData;return proto.mediapipe.RenderData.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderData.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new proto.mediapipe.RenderAnnotation;t.readMessage(r,proto.mediapipe.RenderAnnotation.deserializeBinaryFromReader),e.addRenderAnnotations(r);break;case 2:r=t.readString();e.setSceneClass(r);break;case 3:r=new proto.mediapipe.RenderViewport;t.readMessage(r,proto.mediapipe.RenderViewport.deserializeBinaryFromReader),e.setSceneViewport(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderData.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderData.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderData.serializeBinaryToWriter=function(e,r){var o=void 0;(o=e.getRenderAnnotationsList()).length>0&&r.writeRepeatedMessage(1,o,proto.mediapipe.RenderAnnotation.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeString(2,o),null!=(o=e.getSceneViewport())&&r.writeMessage(3,o,proto.mediapipe.RenderViewport.serializeBinaryToWriter)},proto.mediapipe.RenderData.prototype.getRenderAnnotationsList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.RenderAnnotation,1)},proto.mediapipe.RenderData.prototype.setRenderAnnotationsList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.RenderData.prototype.addRenderAnnotations=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.RenderAnnotation,r)},proto.mediapipe.RenderData.prototype.clearRenderAnnotationsList=function(){return this.setRenderAnnotationsList([])},proto.mediapipe.RenderData.prototype.getSceneClass=function(){return t.Message.getFieldWithDefault(this,2,"")},proto.mediapipe.RenderData.prototype.setSceneClass=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.RenderData.prototype.clearSceneClass=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.RenderData.prototype.hasSceneClass=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.RenderData.prototype.getSceneViewport=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderViewport,3)},proto.mediapipe.RenderData.prototype.setSceneViewport=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.RenderData.prototype.clearSceneViewport=function(){return this.setSceneViewport(void 0)},proto.mediapipe.RenderData.prototype.hasSceneViewport=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.RenderAnnotation.oneofGroups_=[[1,2,3,4,5,6,7,8,9,10,14,15]],proto.mediapipe.RenderAnnotation.DataCase={DATA_NOT_SET:0,RECTANGLE:1,FILLED_RECTANGLE:2,OVAL:3,FILLED_OVAL:4,POINT:5,LINE:6,ARROW:7,TEXT:8,ROUNDED_RECTANGLE:9,FILLED_ROUNDED_RECTANGLE:10,GRADIENT_LINE:14,SCRIBBLE:15},proto.mediapipe.RenderAnnotation.prototype.getDataCase=function(){return t.Message.computeOneofCase(this,proto.mediapipe.RenderAnnotation.oneofGroups_[0])},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.toObject(e,this)},proto.mediapipe.RenderAnnotation.toObject=function(e,r){var o,a={rectangle:(o=r.getRectangle())&&proto.mediapipe.RenderAnnotation.Rectangle.toObject(e,o),filledRectangle:(o=r.getFilledRectangle())&&proto.mediapipe.RenderAnnotation.FilledRectangle.toObject(e,o),oval:(o=r.getOval())&&proto.mediapipe.RenderAnnotation.Oval.toObject(e,o),filledOval:(o=r.getFilledOval())&&proto.mediapipe.RenderAnnotation.FilledOval.toObject(e,o),point:(o=r.getPoint())&&proto.mediapipe.RenderAnnotation.Point.toObject(e,o),line:(o=r.getLine())&&proto.mediapipe.RenderAnnotation.Line.toObject(e,o),arrow:(o=r.getArrow())&&proto.mediapipe.RenderAnnotation.Arrow.toObject(e,o),text:(o=r.getText())&&proto.mediapipe.RenderAnnotation.Text.toObject(e,o),roundedRectangle:(o=r.getRoundedRectangle())&&proto.mediapipe.RenderAnnotation.RoundedRectangle.toObject(e,o),filledRoundedRectangle:(o=r.getFilledRoundedRectangle())&&proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.toObject(e,o),gradientLine:(o=r.getGradientLine())&&proto.mediapipe.RenderAnnotation.GradientLine.toObject(e,o),scribble:(o=r.getScribble())&&proto.mediapipe.RenderAnnotation.Scribble.toObject(e,o),thickness:t.Message.getFloatingPointFieldWithDefault(r,11,1),color:(o=r.getColor())&&i.Color.toObject(e,o),sceneTag:null==(o=t.Message.getField(r,13))?void 0:o};return e&&(a.$jspbMessageInstance=r),a}),proto.mediapipe.RenderAnnotation.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation;return proto.mediapipe.RenderAnnotation.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new proto.mediapipe.RenderAnnotation.Rectangle;t.readMessage(r,proto.mediapipe.RenderAnnotation.Rectangle.deserializeBinaryFromReader),e.setRectangle(r);break;case 2:r=new proto.mediapipe.RenderAnnotation.FilledRectangle;t.readMessage(r,proto.mediapipe.RenderAnnotation.FilledRectangle.deserializeBinaryFromReader),e.setFilledRectangle(r);break;case 3:r=new proto.mediapipe.RenderAnnotation.Oval;t.readMessage(r,proto.mediapipe.RenderAnnotation.Oval.deserializeBinaryFromReader),e.setOval(r);break;case 4:r=new proto.mediapipe.RenderAnnotation.FilledOval;t.readMessage(r,proto.mediapipe.RenderAnnotation.FilledOval.deserializeBinaryFromReader),e.setFilledOval(r);break;case 5:r=new proto.mediapipe.RenderAnnotation.Point;t.readMessage(r,proto.mediapipe.RenderAnnotation.Point.deserializeBinaryFromReader),e.setPoint(r);break;case 6:r=new proto.mediapipe.RenderAnnotation.Line;t.readMessage(r,proto.mediapipe.RenderAnnotation.Line.deserializeBinaryFromReader),e.setLine(r);break;case 7:r=new proto.mediapipe.RenderAnnotation.Arrow;t.readMessage(r,proto.mediapipe.RenderAnnotation.Arrow.deserializeBinaryFromReader),e.setArrow(r);break;case 8:r=new proto.mediapipe.RenderAnnotation.Text;t.readMessage(r,proto.mediapipe.RenderAnnotation.Text.deserializeBinaryFromReader),e.setText(r);break;case 9:r=new proto.mediapipe.RenderAnnotation.RoundedRectangle;t.readMessage(r,proto.mediapipe.RenderAnnotation.RoundedRectangle.deserializeBinaryFromReader),e.setRoundedRectangle(r);break;case 10:r=new proto.mediapipe.RenderAnnotation.FilledRoundedRectangle;t.readMessage(r,proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.deserializeBinaryFromReader),e.setFilledRoundedRectangle(r);break;case 14:r=new proto.mediapipe.RenderAnnotation.GradientLine;t.readMessage(r,proto.mediapipe.RenderAnnotation.GradientLine.deserializeBinaryFromReader),e.setGradientLine(r);break;case 15:r=new proto.mediapipe.RenderAnnotation.Scribble;t.readMessage(r,proto.mediapipe.RenderAnnotation.Scribble.deserializeBinaryFromReader),e.setScribble(r);break;case 11:r=t.readDouble();e.setThickness(r);break;case 12:r=new i.Color;t.readMessage(r,i.Color.deserializeBinaryFromReader),e.setColor(r);break;case 13:r=t.readString();e.setSceneTag(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderAnnotation.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getRectangle())&&r.writeMessage(1,o,proto.mediapipe.RenderAnnotation.Rectangle.serializeBinaryToWriter),null!=(o=e.getFilledRectangle())&&r.writeMessage(2,o,proto.mediapipe.RenderAnnotation.FilledRectangle.serializeBinaryToWriter),null!=(o=e.getOval())&&r.writeMessage(3,o,proto.mediapipe.RenderAnnotation.Oval.serializeBinaryToWriter),null!=(o=e.getFilledOval())&&r.writeMessage(4,o,proto.mediapipe.RenderAnnotation.FilledOval.serializeBinaryToWriter),null!=(o=e.getPoint())&&r.writeMessage(5,o,proto.mediapipe.RenderAnnotation.Point.serializeBinaryToWriter),null!=(o=e.getLine())&&r.writeMessage(6,o,proto.mediapipe.RenderAnnotation.Line.serializeBinaryToWriter),null!=(o=e.getArrow())&&r.writeMessage(7,o,proto.mediapipe.RenderAnnotation.Arrow.serializeBinaryToWriter),null!=(o=e.getText())&&r.writeMessage(8,o,proto.mediapipe.RenderAnnotation.Text.serializeBinaryToWriter),null!=(o=e.getRoundedRectangle())&&r.writeMessage(9,o,proto.mediapipe.RenderAnnotation.RoundedRectangle.serializeBinaryToWriter),null!=(o=e.getFilledRoundedRectangle())&&r.writeMessage(10,o,proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.serializeBinaryToWriter),null!=(o=e.getGradientLine())&&r.writeMessage(14,o,proto.mediapipe.RenderAnnotation.GradientLine.serializeBinaryToWriter),null!=(o=e.getScribble())&&r.writeMessage(15,o,proto.mediapipe.RenderAnnotation.Scribble.serializeBinaryToWriter),null!=(o=t.Message.getField(e,11))&&r.writeDouble(11,o),null!=(o=e.getColor())&&r.writeMessage(12,o,i.Color.serializeBinaryToWriter),null!=(o=t.Message.getField(e,13))&&r.writeString(13,o)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.Rectangle.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.Rectangle.toObject(e,this)},proto.mediapipe.RenderAnnotation.Rectangle.toObject=function(e,r){var o,i={left:null==(o=t.Message.getOptionalFloatingPointField(r,1))?void 0:o,top:null==(o=t.Message.getOptionalFloatingPointField(r,2))?void 0:o,right:null==(o=t.Message.getOptionalFloatingPointField(r,3))?void 0:o,bottom:null==(o=t.Message.getOptionalFloatingPointField(r,4))?void 0:o,normalized:t.Message.getBooleanFieldWithDefault(r,5,!1),rotation:null==(o=t.Message.getOptionalFloatingPointField(r,6))?void 0:o,topLeftThickness:null==(o=t.Message.getOptionalFloatingPointField(r,7))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.RenderAnnotation.Rectangle.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation.Rectangle;return proto.mediapipe.RenderAnnotation.Rectangle.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.Rectangle.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readDouble();e.setLeft(r);break;case 2:r=t.readDouble();e.setTop(r);break;case 3:r=t.readDouble();e.setRight(r);break;case 4:r=t.readDouble();e.setBottom(r);break;case 5:r=t.readBool();e.setNormalized(r);break;case 6:r=t.readDouble();e.setRotation(r);break;case 7:r=t.readDouble();e.setTopLeftThickness(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderAnnotation.Rectangle.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.Rectangle.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.Rectangle.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeDouble(1,o),null!=(o=t.Message.getField(e,2))&&r.writeDouble(2,o),null!=(o=t.Message.getField(e,3))&&r.writeDouble(3,o),null!=(o=t.Message.getField(e,4))&&r.writeDouble(4,o),null!=(o=t.Message.getField(e,5))&&r.writeBool(5,o),null!=(o=t.Message.getField(e,6))&&r.writeDouble(6,o),null!=(o=t.Message.getField(e,7))&&r.writeDouble(7,o)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.getLeft=function(){return t.Message.getFloatingPointFieldWithDefault(this,1,0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.setLeft=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.clearLeft=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.hasLeft=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.getTop=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.setTop=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.clearTop=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.hasTop=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.getRight=function(){return t.Message.getFloatingPointFieldWithDefault(this,3,0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.setRight=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.clearRight=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.hasRight=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.getBottom=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.setBottom=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.clearBottom=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.hasBottom=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.getNormalized=function(){return t.Message.getBooleanFieldWithDefault(this,5,!1)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.setNormalized=function(e){return t.Message.setField(this,5,e)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.clearNormalized=function(){return t.Message.setField(this,5,void 0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.hasNormalized=function(){return null!=t.Message.getField(this,5)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.getRotation=function(){return t.Message.getFloatingPointFieldWithDefault(this,6,0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.setRotation=function(e){return t.Message.setField(this,6,e)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.clearRotation=function(){return t.Message.setField(this,6,void 0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.hasRotation=function(){return null!=t.Message.getField(this,6)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.getTopLeftThickness=function(){return t.Message.getFloatingPointFieldWithDefault(this,7,0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.setTopLeftThickness=function(e){return t.Message.setField(this,7,e)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.clearTopLeftThickness=function(){return t.Message.setField(this,7,void 0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.hasTopLeftThickness=function(){return null!=t.Message.getField(this,7)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.FilledRectangle.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.FilledRectangle.toObject(e,this)},proto.mediapipe.RenderAnnotation.FilledRectangle.toObject=function(e,t){var r,o={rectangle:(r=t.getRectangle())&&proto.mediapipe.RenderAnnotation.Rectangle.toObject(e,r),fillColor:(r=t.getFillColor())&&i.Color.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.RenderAnnotation.FilledRectangle.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation.FilledRectangle;return proto.mediapipe.RenderAnnotation.FilledRectangle.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.FilledRectangle.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new proto.mediapipe.RenderAnnotation.Rectangle;t.readMessage(r,proto.mediapipe.RenderAnnotation.Rectangle.deserializeBinaryFromReader),e.setRectangle(r);break;case 2:r=new i.Color;t.readMessage(r,i.Color.deserializeBinaryFromReader),e.setFillColor(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderAnnotation.FilledRectangle.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.FilledRectangle.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.FilledRectangle.serializeBinaryToWriter=function(e,t){var r=void 0;null!=(r=e.getRectangle())&&t.writeMessage(1,r,proto.mediapipe.RenderAnnotation.Rectangle.serializeBinaryToWriter),null!=(r=e.getFillColor())&&t.writeMessage(2,r,i.Color.serializeBinaryToWriter)},proto.mediapipe.RenderAnnotation.FilledRectangle.prototype.getRectangle=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.Rectangle,1)},proto.mediapipe.RenderAnnotation.FilledRectangle.prototype.setRectangle=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.RenderAnnotation.FilledRectangle.prototype.clearRectangle=function(){return this.setRectangle(void 0)},proto.mediapipe.RenderAnnotation.FilledRectangle.prototype.hasRectangle=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.RenderAnnotation.FilledRectangle.prototype.getFillColor=function(){return t.Message.getWrapperField(this,i.Color,2)},proto.mediapipe.RenderAnnotation.FilledRectangle.prototype.setFillColor=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.RenderAnnotation.FilledRectangle.prototype.clearFillColor=function(){return this.setFillColor(void 0)},proto.mediapipe.RenderAnnotation.FilledRectangle.prototype.hasFillColor=function(){return null!=t.Message.getField(this,2)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.RoundedRectangle.toObject(e,this)},proto.mediapipe.RenderAnnotation.RoundedRectangle.toObject=function(e,r){var o,i={rectangle:(o=r.getRectangle())&&proto.mediapipe.RenderAnnotation.Rectangle.toObject(e,o),cornerRadius:t.Message.getFieldWithDefault(r,2,0),lineType:t.Message.getFieldWithDefault(r,3,4)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.RenderAnnotation.RoundedRectangle.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation.RoundedRectangle;return proto.mediapipe.RenderAnnotation.RoundedRectangle.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.RoundedRectangle.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new proto.mediapipe.RenderAnnotation.Rectangle;t.readMessage(r,proto.mediapipe.RenderAnnotation.Rectangle.deserializeBinaryFromReader),e.setRectangle(r);break;case 2:r=t.readInt32();e.setCornerRadius(r);break;case 3:r=t.readInt32();e.setLineType(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.RoundedRectangle.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.RoundedRectangle.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getRectangle())&&r.writeMessage(1,o,proto.mediapipe.RenderAnnotation.Rectangle.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeInt32(2,o),null!=(o=t.Message.getField(e,3))&&r.writeInt32(3,o)},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.getRectangle=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.Rectangle,1)},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.setRectangle=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.clearRectangle=function(){return this.setRectangle(void 0)},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.hasRectangle=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.getCornerRadius=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.setCornerRadius=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.clearCornerRadius=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.hasCornerRadius=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.getLineType=function(){return t.Message.getFieldWithDefault(this,3,4)},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.setLineType=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.clearLineType=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.hasLineType=function(){return null!=t.Message.getField(this,3)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.toObject(e,this)},proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.toObject=function(e,t){var r,o={roundedRectangle:(r=t.getRoundedRectangle())&&proto.mediapipe.RenderAnnotation.RoundedRectangle.toObject(e,r),fillColor:(r=t.getFillColor())&&i.Color.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation.FilledRoundedRectangle;return proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new proto.mediapipe.RenderAnnotation.RoundedRectangle;t.readMessage(r,proto.mediapipe.RenderAnnotation.RoundedRectangle.deserializeBinaryFromReader),e.setRoundedRectangle(r);break;case 2:r=new i.Color;t.readMessage(r,i.Color.deserializeBinaryFromReader),e.setFillColor(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.serializeBinaryToWriter=function(e,t){var r=void 0;null!=(r=e.getRoundedRectangle())&&t.writeMessage(1,r,proto.mediapipe.RenderAnnotation.RoundedRectangle.serializeBinaryToWriter),null!=(r=e.getFillColor())&&t.writeMessage(2,r,i.Color.serializeBinaryToWriter)},proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.prototype.getRoundedRectangle=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.RoundedRectangle,1)},proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.prototype.setRoundedRectangle=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.prototype.clearRoundedRectangle=function(){return this.setRoundedRectangle(void 0)},proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.prototype.hasRoundedRectangle=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.prototype.getFillColor=function(){return t.Message.getWrapperField(this,i.Color,2)},proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.prototype.setFillColor=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.prototype.clearFillColor=function(){return this.setFillColor(void 0)},proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.prototype.hasFillColor=function(){return null!=t.Message.getField(this,2)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.Oval.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.Oval.toObject(e,this)},proto.mediapipe.RenderAnnotation.Oval.toObject=function(e,t){var r,o={rectangle:(r=t.getRectangle())&&proto.mediapipe.RenderAnnotation.Rectangle.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.RenderAnnotation.Oval.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation.Oval;return proto.mediapipe.RenderAnnotation.Oval.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.Oval.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new proto.mediapipe.RenderAnnotation.Rectangle;t.readMessage(r,proto.mediapipe.RenderAnnotation.Rectangle.deserializeBinaryFromReader),e.setRectangle(r)}else t.skipField()}return e},proto.mediapipe.RenderAnnotation.Oval.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.Oval.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.Oval.serializeBinaryToWriter=function(e,t){var r;null!=(r=e.getRectangle())&&t.writeMessage(1,r,proto.mediapipe.RenderAnnotation.Rectangle.serializeBinaryToWriter)},proto.mediapipe.RenderAnnotation.Oval.prototype.getRectangle=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.Rectangle,1)},proto.mediapipe.RenderAnnotation.Oval.prototype.setRectangle=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.RenderAnnotation.Oval.prototype.clearRectangle=function(){return this.setRectangle(void 0)},proto.mediapipe.RenderAnnotation.Oval.prototype.hasRectangle=function(){return null!=t.Message.getField(this,1)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.FilledOval.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.FilledOval.toObject(e,this)},proto.mediapipe.RenderAnnotation.FilledOval.toObject=function(e,t){var r,o={oval:(r=t.getOval())&&proto.mediapipe.RenderAnnotation.Oval.toObject(e,r),fillColor:(r=t.getFillColor())&&i.Color.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.RenderAnnotation.FilledOval.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation.FilledOval;return proto.mediapipe.RenderAnnotation.FilledOval.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.FilledOval.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new proto.mediapipe.RenderAnnotation.Oval;t.readMessage(r,proto.mediapipe.RenderAnnotation.Oval.deserializeBinaryFromReader),e.setOval(r);break;case 2:r=new i.Color;t.readMessage(r,i.Color.deserializeBinaryFromReader),e.setFillColor(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderAnnotation.FilledOval.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.FilledOval.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.FilledOval.serializeBinaryToWriter=function(e,t){var r=void 0;null!=(r=e.getOval())&&t.writeMessage(1,r,proto.mediapipe.RenderAnnotation.Oval.serializeBinaryToWriter),null!=(r=e.getFillColor())&&t.writeMessage(2,r,i.Color.serializeBinaryToWriter)},proto.mediapipe.RenderAnnotation.FilledOval.prototype.getOval=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.Oval,1)},proto.mediapipe.RenderAnnotation.FilledOval.prototype.setOval=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.RenderAnnotation.FilledOval.prototype.clearOval=function(){return this.setOval(void 0)},proto.mediapipe.RenderAnnotation.FilledOval.prototype.hasOval=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.RenderAnnotation.FilledOval.prototype.getFillColor=function(){return t.Message.getWrapperField(this,i.Color,2)},proto.mediapipe.RenderAnnotation.FilledOval.prototype.setFillColor=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.RenderAnnotation.FilledOval.prototype.clearFillColor=function(){return this.setFillColor(void 0)},proto.mediapipe.RenderAnnotation.FilledOval.prototype.hasFillColor=function(){return null!=t.Message.getField(this,2)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.Point.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.Point.toObject(e,this)},proto.mediapipe.RenderAnnotation.Point.toObject=function(e,r){var o,i={x:null==(o=t.Message.getOptionalFloatingPointField(r,1))?void 0:o,y:null==(o=t.Message.getOptionalFloatingPointField(r,2))?void 0:o,normalized:t.Message.getBooleanFieldWithDefault(r,3,!1)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.RenderAnnotation.Point.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation.Point;return proto.mediapipe.RenderAnnotation.Point.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.Point.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readDouble();e.setX(r);break;case 2:r=t.readDouble();e.setY(r);break;case 3:r=t.readBool();e.setNormalized(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderAnnotation.Point.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.Point.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.Point.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeDouble(1,o),null!=(o=t.Message.getField(e,2))&&r.writeDouble(2,o),null!=(o=t.Message.getField(e,3))&&r.writeBool(3,o)},proto.mediapipe.RenderAnnotation.Point.prototype.getX=function(){return t.Message.getFloatingPointFieldWithDefault(this,1,0)},proto.mediapipe.RenderAnnotation.Point.prototype.setX=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.RenderAnnotation.Point.prototype.clearX=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.RenderAnnotation.Point.prototype.hasX=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.RenderAnnotation.Point.prototype.getY=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,0)},proto.mediapipe.RenderAnnotation.Point.prototype.setY=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.RenderAnnotation.Point.prototype.clearY=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.RenderAnnotation.Point.prototype.hasY=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.RenderAnnotation.Point.prototype.getNormalized=function(){return t.Message.getBooleanFieldWithDefault(this,3,!1)},proto.mediapipe.RenderAnnotation.Point.prototype.setNormalized=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.RenderAnnotation.Point.prototype.clearNormalized=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.RenderAnnotation.Point.prototype.hasNormalized=function(){return null!=t.Message.getField(this,3)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.Line.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.Line.toObject(e,this)},proto.mediapipe.RenderAnnotation.Line.toObject=function(e,r){var o,i={xStart:null==(o=t.Message.getOptionalFloatingPointField(r,1))?void 0:o,yStart:null==(o=t.Message.getOptionalFloatingPointField(r,2))?void 0:o,xEnd:null==(o=t.Message.getOptionalFloatingPointField(r,3))?void 0:o,yEnd:null==(o=t.Message.getOptionalFloatingPointField(r,4))?void 0:o,normalized:t.Message.getBooleanFieldWithDefault(r,5,!1),lineType:t.Message.getFieldWithDefault(r,6,1)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.RenderAnnotation.Line.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation.Line;return proto.mediapipe.RenderAnnotation.Line.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.Line.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readDouble();e.setXStart(r);break;case 2:r=t.readDouble();e.setYStart(r);break;case 3:r=t.readDouble();e.setXEnd(r);break;case 4:r=t.readDouble();e.setYEnd(r);break;case 5:r=t.readBool();e.setNormalized(r);break;case 6:r=t.readEnum();e.setLineType(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderAnnotation.Line.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.Line.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.Line.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeDouble(1,o),null!=(o=t.Message.getField(e,2))&&r.writeDouble(2,o),null!=(o=t.Message.getField(e,3))&&r.writeDouble(3,o),null!=(o=t.Message.getField(e,4))&&r.writeDouble(4,o),null!=(o=t.Message.getField(e,5))&&r.writeBool(5,o),null!=(o=t.Message.getField(e,6))&&r.writeEnum(6,o)},proto.mediapipe.RenderAnnotation.Line.LineType={UNKNOWN:0,SOLID:1,DASHED:2},proto.mediapipe.RenderAnnotation.Line.prototype.getXStart=function(){return t.Message.getFloatingPointFieldWithDefault(this,1,0)},proto.mediapipe.RenderAnnotation.Line.prototype.setXStart=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.RenderAnnotation.Line.prototype.clearXStart=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.RenderAnnotation.Line.prototype.hasXStart=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.RenderAnnotation.Line.prototype.getYStart=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,0)},proto.mediapipe.RenderAnnotation.Line.prototype.setYStart=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.RenderAnnotation.Line.prototype.clearYStart=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.RenderAnnotation.Line.prototype.hasYStart=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.RenderAnnotation.Line.prototype.getXEnd=function(){return t.Message.getFloatingPointFieldWithDefault(this,3,0)},proto.mediapipe.RenderAnnotation.Line.prototype.setXEnd=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.RenderAnnotation.Line.prototype.clearXEnd=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.RenderAnnotation.Line.prototype.hasXEnd=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.RenderAnnotation.Line.prototype.getYEnd=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,0)},proto.mediapipe.RenderAnnotation.Line.prototype.setYEnd=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.RenderAnnotation.Line.prototype.clearYEnd=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.RenderAnnotation.Line.prototype.hasYEnd=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.RenderAnnotation.Line.prototype.getNormalized=function(){return t.Message.getBooleanFieldWithDefault(this,5,!1)},proto.mediapipe.RenderAnnotation.Line.prototype.setNormalized=function(e){return t.Message.setField(this,5,e)},proto.mediapipe.RenderAnnotation.Line.prototype.clearNormalized=function(){return t.Message.setField(this,5,void 0)},proto.mediapipe.RenderAnnotation.Line.prototype.hasNormalized=function(){return null!=t.Message.getField(this,5)},proto.mediapipe.RenderAnnotation.Line.prototype.getLineType=function(){return t.Message.getFieldWithDefault(this,6,1)},proto.mediapipe.RenderAnnotation.Line.prototype.setLineType=function(e){return t.Message.setField(this,6,e)},proto.mediapipe.RenderAnnotation.Line.prototype.clearLineType=function(){return t.Message.setField(this,6,void 0)},proto.mediapipe.RenderAnnotation.Line.prototype.hasLineType=function(){return null!=t.Message.getField(this,6)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.GradientLine.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.GradientLine.toObject(e,this)},proto.mediapipe.RenderAnnotation.GradientLine.toObject=function(e,r){var o,a={xStart:null==(o=t.Message.getOptionalFloatingPointField(r,1))?void 0:o,yStart:null==(o=t.Message.getOptionalFloatingPointField(r,2))?void 0:o,xEnd:null==(o=t.Message.getOptionalFloatingPointField(r,3))?void 0:o,yEnd:null==(o=t.Message.getOptionalFloatingPointField(r,4))?void 0:o,normalized:t.Message.getBooleanFieldWithDefault(r,5,!1),color1:(o=r.getColor1())&&i.Color.toObject(e,o),color2:(o=r.getColor2())&&i.Color.toObject(e,o)};return e&&(a.$jspbMessageInstance=r),a}),proto.mediapipe.RenderAnnotation.GradientLine.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation.GradientLine;return proto.mediapipe.RenderAnnotation.GradientLine.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.GradientLine.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readDouble();e.setXStart(r);break;case 2:r=t.readDouble();e.setYStart(r);break;case 3:r=t.readDouble();e.setXEnd(r);break;case 4:r=t.readDouble();e.setYEnd(r);break;case 5:r=t.readBool();e.setNormalized(r);break;case 6:r=new i.Color;t.readMessage(r,i.Color.deserializeBinaryFromReader),e.setColor1(r);break;case 7:r=new i.Color;t.readMessage(r,i.Color.deserializeBinaryFromReader),e.setColor2(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderAnnotation.GradientLine.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.GradientLine.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.GradientLine.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeDouble(1,o),null!=(o=t.Message.getField(e,2))&&r.writeDouble(2,o),null!=(o=t.Message.getField(e,3))&&r.writeDouble(3,o),null!=(o=t.Message.getField(e,4))&&r.writeDouble(4,o),null!=(o=t.Message.getField(e,5))&&r.writeBool(5,o),null!=(o=e.getColor1())&&r.writeMessage(6,o,i.Color.serializeBinaryToWriter),null!=(o=e.getColor2())&&r.writeMessage(7,o,i.Color.serializeBinaryToWriter)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.getXStart=function(){return t.Message.getFloatingPointFieldWithDefault(this,1,0)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.setXStart=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.clearXStart=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.hasXStart=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.getYStart=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,0)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.setYStart=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.clearYStart=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.hasYStart=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.getXEnd=function(){return t.Message.getFloatingPointFieldWithDefault(this,3,0)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.setXEnd=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.clearXEnd=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.hasXEnd=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.getYEnd=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,0)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.setYEnd=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.clearYEnd=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.hasYEnd=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.getNormalized=function(){return t.Message.getBooleanFieldWithDefault(this,5,!1)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.setNormalized=function(e){return t.Message.setField(this,5,e)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.clearNormalized=function(){return t.Message.setField(this,5,void 0)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.hasNormalized=function(){return null!=t.Message.getField(this,5)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.getColor1=function(){return t.Message.getWrapperField(this,i.Color,6)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.setColor1=function(e){return t.Message.setWrapperField(this,6,e)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.clearColor1=function(){return this.setColor1(void 0)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.hasColor1=function(){return null!=t.Message.getField(this,6)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.getColor2=function(){return t.Message.getWrapperField(this,i.Color,7)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.setColor2=function(e){return t.Message.setWrapperField(this,7,e)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.clearColor2=function(){return this.setColor2(void 0)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.hasColor2=function(){return null!=t.Message.getField(this,7)},proto.mediapipe.RenderAnnotation.Scribble.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.Scribble.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.Scribble.toObject(e,this)},proto.mediapipe.RenderAnnotation.Scribble.toObject=function(e,r){var o={pointList:t.Message.toObjectList(r.getPointList(),proto.mediapipe.RenderAnnotation.Point.toObject,e)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.RenderAnnotation.Scribble.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation.Scribble;return proto.mediapipe.RenderAnnotation.Scribble.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.Scribble.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new proto.mediapipe.RenderAnnotation.Point;t.readMessage(r,proto.mediapipe.RenderAnnotation.Point.deserializeBinaryFromReader),e.addPoint(r)}else t.skipField()}return e},proto.mediapipe.RenderAnnotation.Scribble.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.Scribble.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.Scribble.serializeBinaryToWriter=function(e,t){var r;(r=e.getPointList()).length>0&&t.writeRepeatedMessage(1,r,proto.mediapipe.RenderAnnotation.Point.serializeBinaryToWriter)},proto.mediapipe.RenderAnnotation.Scribble.prototype.getPointList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.RenderAnnotation.Point,1)},proto.mediapipe.RenderAnnotation.Scribble.prototype.setPointList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.RenderAnnotation.Scribble.prototype.addPoint=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.RenderAnnotation.Point,r)},proto.mediapipe.RenderAnnotation.Scribble.prototype.clearPointList=function(){return this.setPointList([])},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.Arrow.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.Arrow.toObject(e,this)},proto.mediapipe.RenderAnnotation.Arrow.toObject=function(e,r){var o,i={xStart:null==(o=t.Message.getOptionalFloatingPointField(r,1))?void 0:o,yStart:null==(o=t.Message.getOptionalFloatingPointField(r,2))?void 0:o,xEnd:null==(o=t.Message.getOptionalFloatingPointField(r,3))?void 0:o,yEnd:null==(o=t.Message.getOptionalFloatingPointField(r,4))?void 0:o,normalized:t.Message.getBooleanFieldWithDefault(r,5,!1)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.RenderAnnotation.Arrow.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation.Arrow;return proto.mediapipe.RenderAnnotation.Arrow.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.Arrow.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readDouble();e.setXStart(r);break;case 2:r=t.readDouble();e.setYStart(r);break;case 3:r=t.readDouble();e.setXEnd(r);break;case 4:r=t.readDouble();e.setYEnd(r);break;case 5:r=t.readBool();e.setNormalized(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderAnnotation.Arrow.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.Arrow.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.Arrow.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeDouble(1,o),null!=(o=t.Message.getField(e,2))&&r.writeDouble(2,o),null!=(o=t.Message.getField(e,3))&&r.writeDouble(3,o),null!=(o=t.Message.getField(e,4))&&r.writeDouble(4,o),null!=(o=t.Message.getField(e,5))&&r.writeBool(5,o)},proto.mediapipe.RenderAnnotation.Arrow.prototype.getXStart=function(){return t.Message.getFloatingPointFieldWithDefault(this,1,0)},proto.mediapipe.RenderAnnotation.Arrow.prototype.setXStart=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.RenderAnnotation.Arrow.prototype.clearXStart=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.RenderAnnotation.Arrow.prototype.hasXStart=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.RenderAnnotation.Arrow.prototype.getYStart=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,0)},proto.mediapipe.RenderAnnotation.Arrow.prototype.setYStart=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.RenderAnnotation.Arrow.prototype.clearYStart=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.RenderAnnotation.Arrow.prototype.hasYStart=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.RenderAnnotation.Arrow.prototype.getXEnd=function(){return t.Message.getFloatingPointFieldWithDefault(this,3,0)},proto.mediapipe.RenderAnnotation.Arrow.prototype.setXEnd=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.RenderAnnotation.Arrow.prototype.clearXEnd=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.RenderAnnotation.Arrow.prototype.hasXEnd=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.RenderAnnotation.Arrow.prototype.getYEnd=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,0)},proto.mediapipe.RenderAnnotation.Arrow.prototype.setYEnd=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.RenderAnnotation.Arrow.prototype.clearYEnd=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.RenderAnnotation.Arrow.prototype.hasYEnd=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.RenderAnnotation.Arrow.prototype.getNormalized=function(){return t.Message.getBooleanFieldWithDefault(this,5,!1)},proto.mediapipe.RenderAnnotation.Arrow.prototype.setNormalized=function(e){return t.Message.setField(this,5,e)},proto.mediapipe.RenderAnnotation.Arrow.prototype.clearNormalized=function(){return t.Message.setField(this,5,void 0)},proto.mediapipe.RenderAnnotation.Arrow.prototype.hasNormalized=function(){return null!=t.Message.getField(this,5)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.Text.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.Text.toObject(e,this)},proto.mediapipe.RenderAnnotation.Text.toObject=function(e,r){var o,a={displayText:null==(o=t.Message.getField(r,1))?void 0:o,left:null==(o=t.Message.getOptionalFloatingPointField(r,2))?void 0:o,baseline:null==(o=t.Message.getOptionalFloatingPointField(r,3))?void 0:o,fontHeight:t.Message.getFloatingPointFieldWithDefault(r,4,8),normalized:t.Message.getBooleanFieldWithDefault(r,5,!1),fontFace:t.Message.getFieldWithDefault(r,6,0),centerHorizontally:t.Message.getBooleanFieldWithDefault(r,7,!1),centerVertically:t.Message.getBooleanFieldWithDefault(r,8,!1),outlineThickness:t.Message.getFloatingPointFieldWithDefault(r,11,0),outlineColor:(o=r.getOutlineColor())&&i.Color.toObject(e,o)};return e&&(a.$jspbMessageInstance=r),a}),proto.mediapipe.RenderAnnotation.Text.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation.Text;return proto.mediapipe.RenderAnnotation.Text.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.Text.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setDisplayText(r);break;case 2:r=t.readDouble();e.setLeft(r);break;case 3:r=t.readDouble();e.setBaseline(r);break;case 4:r=t.readDouble();e.setFontHeight(r);break;case 5:r=t.readBool();e.setNormalized(r);break;case 6:r=t.readInt32();e.setFontFace(r);break;case 7:r=t.readBool();e.setCenterHorizontally(r);break;case 8:r=t.readBool();e.setCenterVertically(r);break;case 11:r=t.readDouble();e.setOutlineThickness(r);break;case 12:r=new i.Color;t.readMessage(r,i.Color.deserializeBinaryFromReader),e.setOutlineColor(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderAnnotation.Text.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.Text.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.Text.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeString(1,o),null!=(o=t.Message.getField(e,2))&&r.writeDouble(2,o),null!=(o=t.Message.getField(e,3))&&r.writeDouble(3,o),null!=(o=t.Message.getField(e,4))&&r.writeDouble(4,o),null!=(o=t.Message.getField(e,5))&&r.writeBool(5,o),null!=(o=t.Message.getField(e,6))&&r.writeInt32(6,o),null!=(o=t.Message.getField(e,7))&&r.writeBool(7,o),null!=(o=t.Message.getField(e,8))&&r.writeBool(8,o),null!=(o=t.Message.getField(e,11))&&r.writeDouble(11,o),null!=(o=e.getOutlineColor())&&r.writeMessage(12,o,i.Color.serializeBinaryToWriter)},proto.mediapipe.RenderAnnotation.Text.prototype.getDisplayText=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.RenderAnnotation.Text.prototype.setDisplayText=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.RenderAnnotation.Text.prototype.clearDisplayText=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.RenderAnnotation.Text.prototype.hasDisplayText=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.RenderAnnotation.Text.prototype.getLeft=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,0)},proto.mediapipe.RenderAnnotation.Text.prototype.setLeft=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.RenderAnnotation.Text.prototype.clearLeft=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.RenderAnnotation.Text.prototype.hasLeft=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.RenderAnnotation.Text.prototype.getBaseline=function(){return t.Message.getFloatingPointFieldWithDefault(this,3,0)},proto.mediapipe.RenderAnnotation.Text.prototype.setBaseline=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.RenderAnnotation.Text.prototype.clearBaseline=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.RenderAnnotation.Text.prototype.hasBaseline=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.RenderAnnotation.Text.prototype.getFontHeight=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,8)},proto.mediapipe.RenderAnnotation.Text.prototype.setFontHeight=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.RenderAnnotation.Text.prototype.clearFontHeight=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.RenderAnnotation.Text.prototype.hasFontHeight=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.RenderAnnotation.Text.prototype.getNormalized=function(){return t.Message.getBooleanFieldWithDefault(this,5,!1)},proto.mediapipe.RenderAnnotation.Text.prototype.setNormalized=function(e){return t.Message.setField(this,5,e)},proto.mediapipe.RenderAnnotation.Text.prototype.clearNormalized=function(){return t.Message.setField(this,5,void 0)},proto.mediapipe.RenderAnnotation.Text.prototype.hasNormalized=function(){return null!=t.Message.getField(this,5)},proto.mediapipe.RenderAnnotation.Text.prototype.getFontFace=function(){return t.Message.getFieldWithDefault(this,6,0)},proto.mediapipe.RenderAnnotation.Text.prototype.setFontFace=function(e){return t.Message.setField(this,6,e)},proto.mediapipe.RenderAnnotation.Text.prototype.clearFontFace=function(){return t.Message.setField(this,6,void 0)},proto.mediapipe.RenderAnnotation.Text.prototype.hasFontFace=function(){return null!=t.Message.getField(this,6)},proto.mediapipe.RenderAnnotation.Text.prototype.getCenterHorizontally=function(){return t.Message.getBooleanFieldWithDefault(this,7,!1)},proto.mediapipe.RenderAnnotation.Text.prototype.setCenterHorizontally=function(e){return t.Message.setField(this,7,e)},proto.mediapipe.RenderAnnotation.Text.prototype.clearCenterHorizontally=function(){return t.Message.setField(this,7,void 0)},proto.mediapipe.RenderAnnotation.Text.prototype.hasCenterHorizontally=function(){return null!=t.Message.getField(this,7)},proto.mediapipe.RenderAnnotation.Text.prototype.getCenterVertically=function(){return t.Message.getBooleanFieldWithDefault(this,8,!1)},proto.mediapipe.RenderAnnotation.Text.prototype.setCenterVertically=function(e){return t.Message.setField(this,8,e)},proto.mediapipe.RenderAnnotation.Text.prototype.clearCenterVertically=function(){return t.Message.setField(this,8,void 0)},proto.mediapipe.RenderAnnotation.Text.prototype.hasCenterVertically=function(){return null!=t.Message.getField(this,8)},proto.mediapipe.RenderAnnotation.Text.prototype.getOutlineThickness=function(){return t.Message.getFloatingPointFieldWithDefault(this,11,0)},proto.mediapipe.RenderAnnotation.Text.prototype.setOutlineThickness=function(e){return t.Message.setField(this,11,e)},proto.mediapipe.RenderAnnotation.Text.prototype.clearOutlineThickness=function(){return t.Message.setField(this,11,void 0)},proto.mediapipe.RenderAnnotation.Text.prototype.hasOutlineThickness=function(){return null!=t.Message.getField(this,11)},proto.mediapipe.RenderAnnotation.Text.prototype.getOutlineColor=function(){return t.Message.getWrapperField(this,i.Color,12)},proto.mediapipe.RenderAnnotation.Text.prototype.setOutlineColor=function(e){return t.Message.setWrapperField(this,12,e)},proto.mediapipe.RenderAnnotation.Text.prototype.clearOutlineColor=function(){return this.setOutlineColor(void 0)},proto.mediapipe.RenderAnnotation.Text.prototype.hasOutlineColor=function(){return null!=t.Message.getField(this,12)},proto.mediapipe.RenderAnnotation.prototype.getRectangle=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.Rectangle,1)},proto.mediapipe.RenderAnnotation.prototype.setRectangle=function(e){return t.Message.setOneofWrapperField(this,1,proto.mediapipe.RenderAnnotation.oneofGroups_[0],e)},proto.mediapipe.RenderAnnotation.prototype.clearRectangle=function(){return this.setRectangle(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasRectangle=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.RenderAnnotation.prototype.getFilledRectangle=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.FilledRectangle,2)},proto.mediapipe.RenderAnnotation.prototype.setFilledRectangle=function(e){return t.Message.setOneofWrapperField(this,2,proto.mediapipe.RenderAnnotation.oneofGroups_[0],e)},proto.mediapipe.RenderAnnotation.prototype.clearFilledRectangle=function(){return this.setFilledRectangle(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasFilledRectangle=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.RenderAnnotation.prototype.getOval=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.Oval,3)},proto.mediapipe.RenderAnnotation.prototype.setOval=function(e){return t.Message.setOneofWrapperField(this,3,proto.mediapipe.RenderAnnotation.oneofGroups_[0],e)},proto.mediapipe.RenderAnnotation.prototype.clearOval=function(){return this.setOval(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasOval=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.RenderAnnotation.prototype.getFilledOval=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.FilledOval,4)},proto.mediapipe.RenderAnnotation.prototype.setFilledOval=function(e){return t.Message.setOneofWrapperField(this,4,proto.mediapipe.RenderAnnotation.oneofGroups_[0],e)},proto.mediapipe.RenderAnnotation.prototype.clearFilledOval=function(){return this.setFilledOval(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasFilledOval=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.RenderAnnotation.prototype.getPoint=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.Point,5)},proto.mediapipe.RenderAnnotation.prototype.setPoint=function(e){return t.Message.setOneofWrapperField(this,5,proto.mediapipe.RenderAnnotation.oneofGroups_[0],e)},proto.mediapipe.RenderAnnotation.prototype.clearPoint=function(){return this.setPoint(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasPoint=function(){return null!=t.Message.getField(this,5)},proto.mediapipe.RenderAnnotation.prototype.getLine=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.Line,6)},proto.mediapipe.RenderAnnotation.prototype.setLine=function(e){return t.Message.setOneofWrapperField(this,6,proto.mediapipe.RenderAnnotation.oneofGroups_[0],e)},proto.mediapipe.RenderAnnotation.prototype.clearLine=function(){return this.setLine(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasLine=function(){return null!=t.Message.getField(this,6)},proto.mediapipe.RenderAnnotation.prototype.getArrow=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.Arrow,7)},proto.mediapipe.RenderAnnotation.prototype.setArrow=function(e){return t.Message.setOneofWrapperField(this,7,proto.mediapipe.RenderAnnotation.oneofGroups_[0],e)},proto.mediapipe.RenderAnnotation.prototype.clearArrow=function(){return this.setArrow(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasArrow=function(){return null!=t.Message.getField(this,7)},proto.mediapipe.RenderAnnotation.prototype.getText=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.Text,8)},proto.mediapipe.RenderAnnotation.prototype.setText=function(e){return t.Message.setOneofWrapperField(this,8,proto.mediapipe.RenderAnnotation.oneofGroups_[0],e)},proto.mediapipe.RenderAnnotation.prototype.clearText=function(){return this.setText(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasText=function(){return null!=t.Message.getField(this,8)},proto.mediapipe.RenderAnnotation.prototype.getRoundedRectangle=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.RoundedRectangle,9)},proto.mediapipe.RenderAnnotation.prototype.setRoundedRectangle=function(e){return t.Message.setOneofWrapperField(this,9,proto.mediapipe.RenderAnnotation.oneofGroups_[0],e)},proto.mediapipe.RenderAnnotation.prototype.clearRoundedRectangle=function(){return this.setRoundedRectangle(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasRoundedRectangle=function(){return null!=t.Message.getField(this,9)},proto.mediapipe.RenderAnnotation.prototype.getFilledRoundedRectangle=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.FilledRoundedRectangle,10)},proto.mediapipe.RenderAnnotation.prototype.setFilledRoundedRectangle=function(e){return t.Message.setOneofWrapperField(this,10,proto.mediapipe.RenderAnnotation.oneofGroups_[0],e)},proto.mediapipe.RenderAnnotation.prototype.clearFilledRoundedRectangle=function(){return this.setFilledRoundedRectangle(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasFilledRoundedRectangle=function(){return null!=t.Message.getField(this,10)},proto.mediapipe.RenderAnnotation.prototype.getGradientLine=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.GradientLine,14)},proto.mediapipe.RenderAnnotation.prototype.setGradientLine=function(e){return t.Message.setOneofWrapperField(this,14,proto.mediapipe.RenderAnnotation.oneofGroups_[0],e)},proto.mediapipe.RenderAnnotation.prototype.clearGradientLine=function(){return this.setGradientLine(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasGradientLine=function(){return null!=t.Message.getField(this,14)},proto.mediapipe.RenderAnnotation.prototype.getScribble=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.Scribble,15)},proto.mediapipe.RenderAnnotation.prototype.setScribble=function(e){return t.Message.setOneofWrapperField(this,15,proto.mediapipe.RenderAnnotation.oneofGroups_[0],e)},proto.mediapipe.RenderAnnotation.prototype.clearScribble=function(){return this.setScribble(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasScribble=function(){return null!=t.Message.getField(this,15)},proto.mediapipe.RenderAnnotation.prototype.getThickness=function(){return t.Message.getFloatingPointFieldWithDefault(this,11,1)},proto.mediapipe.RenderAnnotation.prototype.setThickness=function(e){return t.Message.setField(this,11,e)},proto.mediapipe.RenderAnnotation.prototype.clearThickness=function(){return t.Message.setField(this,11,void 0)},proto.mediapipe.RenderAnnotation.prototype.hasThickness=function(){return null!=t.Message.getField(this,11)},proto.mediapipe.RenderAnnotation.prototype.getColor=function(){return t.Message.getWrapperField(this,i.Color,12)},proto.mediapipe.RenderAnnotation.prototype.setColor=function(e){return t.Message.setWrapperField(this,12,e)},proto.mediapipe.RenderAnnotation.prototype.clearColor=function(){return this.setColor(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasColor=function(){return null!=t.Message.getField(this,12)},proto.mediapipe.RenderAnnotation.prototype.getSceneTag=function(){return t.Message.getFieldWithDefault(this,13,"")},proto.mediapipe.RenderAnnotation.prototype.setSceneTag=function(e){return t.Message.setField(this,13,e)},proto.mediapipe.RenderAnnotation.prototype.clearSceneTag=function(){return t.Message.setField(this,13,void 0)},proto.mediapipe.RenderAnnotation.prototype.hasSceneTag=function(){return null!=t.Message.getField(this,13)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderViewport.prototype.toObject=function(e){return proto.mediapipe.RenderViewport.toObject(e,this)},proto.mediapipe.RenderViewport.toObject=function(e,r){var o,i={id:null==(o=t.Message.getField(r,1))?void 0:o,widthPx:null==(o=t.Message.getField(r,2))?void 0:o,heightPx:null==(o=t.Message.getField(r,3))?void 0:o,composeOnVideo:null==(o=t.Message.getBooleanField(r,4))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.RenderViewport.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderViewport;return proto.mediapipe.RenderViewport.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderViewport.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setId(r);break;case 2:r=t.readInt32();e.setWidthPx(r);break;case 3:r=t.readInt32();e.setHeightPx(r);break;case 4:r=t.readBool();e.setComposeOnVideo(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderViewport.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderViewport.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderViewport.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeString(1,o),null!=(o=t.Message.getField(e,2))&&r.writeInt32(2,o),null!=(o=t.Message.getField(e,3))&&r.writeInt32(3,o),null!=(o=t.Message.getField(e,4))&&r.writeBool(4,o)},proto.mediapipe.RenderViewport.prototype.getId=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.RenderViewport.prototype.setId=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.RenderViewport.prototype.clearId=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.RenderViewport.prototype.hasId=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.RenderViewport.prototype.getWidthPx=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.RenderViewport.prototype.setWidthPx=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.RenderViewport.prototype.clearWidthPx=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.RenderViewport.prototype.hasWidthPx=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.RenderViewport.prototype.getHeightPx=function(){return t.Message.getFieldWithDefault(this,3,0)},proto.mediapipe.RenderViewport.prototype.setHeightPx=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.RenderViewport.prototype.clearHeightPx=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.RenderViewport.prototype.hasHeightPx=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.RenderViewport.prototype.getComposeOnVideo=function(){return t.Message.getBooleanFieldWithDefault(this,4,!1)},proto.mediapipe.RenderViewport.prototype.setComposeOnVideo=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.RenderViewport.prototype.clearComposeOnVideo=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.RenderViewport.prototype.hasComposeOnVideo=function(){return null!=t.Message.getField(this,4)},r.object.extend(e,proto.mediapipe)}(render_data_pb);var interactive_segmenter_options={};Object.defineProperty(interactive_segmenter_options,"__esModule",{value:!0});var interactive_segmenter_result={};Object.defineProperty(interactive_segmenter_result,"__esModule",{value:!0}),function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,i)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(e,r){for(var o in e)"default"===o||Object.prototype.hasOwnProperty.call(r,o)||t(r,e,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.InteractiveSegmenter=void 0;const o=calculator_pb,i=calculator_options_pb,a=base_options_pb,n=image_segmenter_graph_options_pb,s=segmenter_options_pb,p=vision_task_runner,d=color_pb,l=render_data_pb;r(interactive_segmenter_options,e),r(interactive_segmenter_result,e);const g="image_in",c="norm_rect_in",u="roi_in",m="confidence_masks",f="category_mask";class h extends p.VisionTaskRunner{static createFromOptions(e,t){return p.VisionTaskRunner.createVisionInstance(h,e,t)}static createFromModelBuffer(e,t){return p.VisionTaskRunner.createVisionInstance(h,e,{baseOptions:{modelAssetBuffer:t}})}static createFromModelPath(e,t){return p.VisionTaskRunner.createVisionInstance(h,e,{baseOptions:{modelAssetPath:t}})}constructor(e,t){super(new p.VisionGraphRunner(e,t),g,c,!1),this.result={},this.outputCategoryMask=false,this.outputConfidenceMasks=true,this.options=new n.ImageSegmenterGraphOptions,this.segmenterOptions=new s.SegmenterOptions,this.options.setSegmenterOptions(this.segmenterOptions),this.options.setBaseOptions(new a.BaseOptions)}get baseOptions(){return this.options.getBaseOptions()}set baseOptions(e){this.options.setBaseOptions(e)}setOptions(e){var t,r;return"outputCategoryMask"in e&&(this.outputCategoryMask=null!==(t=e.outputCategoryMask)&&void 0!==t&&t),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=null===(r=e.outputConfidenceMasks)||void 0===r||r),super.applyOptions(e)}segment(e,t,r,o){const i="function"!=typeof r?r:{};if(this.userCallback="function"==typeof r?r:o,this.reset(),this.processRenderData(t,this.getSynctheticTimestamp()),this.processImageData(e,i),!this.userCallback)return this.result}reset(){this.result={}}maybeInvokeCallback(){this.outputConfidenceMasks&&!("confidenceMasks"in this.result)||this.outputCategoryMask&&!("categoryMask"in this.result)||this.userCallback&&(this.userCallback(this.result),this.freeKeepaliveStreams())}refreshGraph(){const e=new o.CalculatorGraphConfig;e.addInputStream(g),e.addInputStream(u),e.addInputStream(c);const t=new i.CalculatorOptions;t.setExtension(n.ImageSegmenterGraphOptions.ext,this.options);const r=new o.CalculatorGraphConfig.Node;r.setCalculator("mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraph"),r.addInputStream("IMAGE:"+g),r.addInputStream("ROI:"+u),r.addInputStream("NORM_RECT:"+c),r.setOptions(t),e.addNode(r),this.addKeepaliveNode(e),this.outputConfidenceMasks&&(e.addOutputStream(m),r.addOutputStream("CONFIDENCE_MASKS:"+m),this.keepStreamAlive(m),this.graphRunner.attachImageVectorListener(m,((e,t)=>{this.result.confidenceMasks=e.map((e=>this.convertToMPMask(e,!this.userCallback))),this.setLatestOutputTimestamp(t),this.maybeInvokeCallback()})),this.graphRunner.attachEmptyPacketListener(m,(e=>{this.result.confidenceMasks=void 0,this.setLatestOutputTimestamp(e),this.maybeInvokeCallback()}))),this.outputCategoryMask&&(e.addOutputStream(f),r.addOutputStream("CATEGORY_MASK:"+f),this.keepStreamAlive(f),this.graphRunner.attachImageListener(f,((e,t)=>{this.result.categoryMask=this.convertToMPMask(e,!this.userCallback),this.setLatestOutputTimestamp(t),this.maybeInvokeCallback()})),this.graphRunner.attachEmptyPacketListener(f,(e=>{this.result.categoryMask=void 0,this.setLatestOutputTimestamp(e),this.maybeInvokeCallback()})));const a=e.serializeBinary();this.setGraph(new Uint8Array(a),!0)}processRenderData(e,t){const r=new l.RenderData,o=new l.RenderAnnotation,i=new d.Color;if(i.setR(255),o.setColor(i),e.keypoint&&e.scribble)throw new Error("Cannot provide both keypoint and scribble.");if(e.keypoint){const t=new l.RenderAnnotation.Point;t.setNormalized(!0),t.setX(e.keypoint.x),t.setY(e.keypoint.y),o.setPoint(t)}else{if(!e.scribble)throw new Error("Must provide either a keypoint or a scribble.");{const t=new l.RenderAnnotation.Scribble;for(const r of e.scribble){const e=new l.RenderAnnotation.Point;e.setNormalized(!0),e.setX(r.x),e.setY(r.y),t.addPoint(e)}o.setScribble(t)}}r.addRenderAnnotations(o),this.graphRunner.addProtoToStream(r.serializeBinary(),"drishti.RenderData",u,t)}}e.InteractiveSegmenter=h}(interactive_segmenter);var object_detector={},object_detector_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n),r.exportSymbol("proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions",null,o),proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.repeatedFields_,null)},r.inherits(proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.displayName="proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions"),proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.repeatedFields_=[5,6],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.toObject(e,this)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.toObject=function(e,r){var o,i={baseOptions:(o=r.getBaseOptions())&&n.BaseOptions.toObject(e,o),displayNamesLocale:t.Message.getFieldWithDefault(r,2,"en"),maxResults:t.Message.getFieldWithDefault(r,3,-1),scoreThreshold:null==(o=t.Message.getOptionalFloatingPointField(r,4))?void 0:o,categoryAllowlistList:null==(o=t.Message.getRepeatedField(r,5))?void 0:o,categoryDenylistList:null==(o=t.Message.getRepeatedField(r,6))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions;return proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=t.readString();e.setDisplayNamesLocale(r);break;case 3:r=t.readInt32();e.setMaxResults(r);break;case 4:r=t.readFloat();e.setScoreThreshold(r);break;case 5:r=t.readString();e.addCategoryAllowlist(r);break;case 6:r=t.readString();e.addCategoryDenylist(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getBaseOptions())&&r.writeMessage(1,o,n.BaseOptions.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeString(2,o),null!=(o=t.Message.getField(e,3))&&r.writeInt32(3,o),null!=(o=t.Message.getField(e,4))&&r.writeFloat(4,o),(o=e.getCategoryAllowlistList()).length>0&&r.writeRepeatedString(5,o),(o=e.getCategoryDenylistList()).length>0&&r.writeRepeatedString(6,o)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.ext=new t.ExtensionFieldInfo(443442058,{ext:0},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions,proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.toObject,0),a.CalculatorOptions.extensionsBinary[443442058]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[443442058]=proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.ext,proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.getDisplayNamesLocale=function(){return t.Message.getFieldWithDefault(this,2,"en")},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.setDisplayNamesLocale=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.clearDisplayNamesLocale=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.hasDisplayNamesLocale=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.getMaxResults=function(){return t.Message.getFieldWithDefault(this,3,-1)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.setMaxResults=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.clearMaxResults=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.hasMaxResults=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.getScoreThreshold=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,0)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.setScoreThreshold=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.clearScoreThreshold=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.hasScoreThreshold=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.getCategoryAllowlistList=function(){return t.Message.getRepeatedField(this,5)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.setCategoryAllowlistList=function(e){return t.Message.setField(this,5,e||[])},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.addCategoryAllowlist=function(e,r){return t.Message.addToRepeatedField(this,5,e,r)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.clearCategoryAllowlistList=function(){return this.setCategoryAllowlistList([])},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.getCategoryDenylistList=function(){return t.Message.getRepeatedField(this,6)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.setCategoryDenylistList=function(e){return t.Message.setField(this,6,e||[])},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.addCategoryDenylist=function(e,r){return t.Message.addToRepeatedField(this,6,e,r)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.clearCategoryDenylistList=function(){return this.setCategoryDenylistList([])},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.ext=new t.ExtensionFieldInfo(443442058,{ext:0},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions,proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.toObject,0),a.CalculatorOptions.extensionsBinary[443442058]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[443442058]=proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.object_detector.proto)}(object_detector_options_pb);var object_detector_options={};Object.defineProperty(object_detector_options,"__esModule",{value:!0});var object_detector_result={};Object.defineProperty(object_detector_result,"__esModule",{value:!0}),function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,i)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(e,r){for(var o in e)"default"===o||Object.prototype.hasOwnProperty.call(r,o)||t(r,e,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.ObjectDetector=void 0;const o=calculator_pb,i=calculator_options_pb,a=detection_pb,n=base_options_pb,s=object_detector_options_pb,p=detection_result,d=vision_task_runner,l="input_frame_gpu",g="norm_rect",c="detections";r(object_detector_options,e),r(object_detector_result,e);class u extends d.VisionTaskRunner{static createFromOptions(e,t){return d.VisionTaskRunner.createVisionInstance(u,e,t)}static createFromModelBuffer(e,t){return d.VisionTaskRunner.createVisionInstance(u,e,{baseOptions:{modelAssetBuffer:t}})}static async createFromModelPath(e,t){return d.VisionTaskRunner.createVisionInstance(u,e,{baseOptions:{modelAssetPath:t}})}constructor(e,t){super(new d.VisionGraphRunner(e,t),l,g,!1),this.result={detections:[]},this.options=new s.ObjectDetectorOptions,this.options.setBaseOptions(new n.BaseOptions)}get baseOptions(){return this.options.getBaseOptions()}set baseOptions(e){this.options.setBaseOptions(e)}setOptions(e){return void 0!==e.displayNamesLocale?this.options.setDisplayNamesLocale(e.displayNamesLocale):"displayNamesLocale"in e&&this.options.clearDisplayNamesLocale(),void 0!==e.maxResults?this.options.setMaxResults(e.maxResults):"maxResults"in e&&this.options.clearMaxResults(),void 0!==e.scoreThreshold?this.options.setScoreThreshold(e.scoreThreshold):"scoreThreshold"in e&&this.options.clearScoreThreshold(),void 0!==e.categoryAllowlist?this.options.setCategoryAllowlistList(e.categoryAllowlist):"categoryAllowlist"in e&&this.options.clearCategoryAllowlistList(),void 0!==e.categoryDenylist?this.options.setCategoryDenylistList(e.categoryDenylist):"categoryDenylist"in e&&this.options.clearCategoryDenylistList(),this.applyOptions(e)}detect(e,t){return this.result={detections:[]},this.processImageData(e,t),this.result}detectForVideo(e,t,r){return this.result={detections:[]},this.processVideoData(e,r,t),this.result}addJsObjectDetections(e){for(const t of e){const e=a.Detection.deserializeBinary(t);this.result.detections.push((0,p.convertFromDetectionProto)(e))}}refreshGraph(){const e=new o.CalculatorGraphConfig;e.addInputStream(l),e.addInputStream(g),e.addOutputStream(c);const t=new i.CalculatorOptions;t.setExtension(s.ObjectDetectorOptions.ext,this.options);const r=new o.CalculatorGraphConfig.Node;r.setCalculator("mediapipe.tasks.vision.ObjectDetectorGraph"),r.addInputStream("IMAGE:"+l),r.addInputStream("NORM_RECT:"+g),r.addOutputStream("DETECTIONS:"+c),r.setOptions(t),e.addNode(r),this.graphRunner.attachProtoVectorListener(c,((e,t)=>{this.addJsObjectDetections(e),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(c,(e=>{this.setLatestOutputTimestamp(e)}));const a=e.serializeBinary();this.setGraph(new Uint8Array(a),!0)}}e.ObjectDetector=u}(object_detector);var pose_landmarker={},pose_detector_graph_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n),r.exportSymbol("proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions",null,o),proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.displayName="proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.toObject=function(e,r){var o,i={baseOptions:(o=r.getBaseOptions())&&n.BaseOptions.toObject(e,o),minDetectionConfidence:t.Message.getFloatingPointFieldWithDefault(r,2,.5),minSuppressionThreshold:t.Message.getFloatingPointFieldWithDefault(r,3,.5),numPoses:null==(o=t.Message.getField(r,4))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions;return proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=t.readFloat();e.setMinDetectionConfidence(r);break;case 3:r=t.readFloat();e.setMinSuppressionThreshold(r);break;case 4:r=t.readInt32();e.setNumPoses(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getBaseOptions())&&r.writeMessage(1,o,n.BaseOptions.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeFloat(2,o),null!=(o=t.Message.getField(e,3))&&r.writeFloat(3,o),null!=(o=t.Message.getField(e,4))&&r.writeInt32(4,o)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.ext=new t.ExtensionFieldInfo(514774813,{ext:0},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions,proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[514774813]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[514774813]=proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.ext,proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.getMinDetectionConfidence=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,.5)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.setMinDetectionConfidence=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.clearMinDetectionConfidence=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.hasMinDetectionConfidence=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.getMinSuppressionThreshold=function(){return t.Message.getFloatingPointFieldWithDefault(this,3,.5)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.setMinSuppressionThreshold=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.clearMinSuppressionThreshold=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.hasMinSuppressionThreshold=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.getNumPoses=function(){return t.Message.getFieldWithDefault(this,4,0)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.setNumPoses=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.clearNumPoses=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.hasNumPoses=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.ext=new t.ExtensionFieldInfo(514774813,{ext:0},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions,proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[514774813]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[514774813]=proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.pose_detector.proto)}(pose_detector_graph_options_pb);var pose_landmarker_graph_options_pb={},pose_landmarks_detector_graph_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n),r.exportSymbol("proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions",null,o),proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.displayName="proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.toObject=function(e,r){var o,i={baseOptions:(o=r.getBaseOptions())&&n.BaseOptions.toObject(e,o),minDetectionConfidence:t.Message.getFloatingPointFieldWithDefault(r,2,.5)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions;return proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=t.readFloat();e.setMinDetectionConfidence(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getBaseOptions())&&r.writeMessage(1,o,n.BaseOptions.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeFloat(2,o)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.ext=new t.ExtensionFieldInfo(518928384,{ext:0},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[518928384]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[518928384]=proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.ext,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.prototype.getMinDetectionConfidence=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,.5)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.prototype.setMinDetectionConfidence=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.prototype.clearMinDetectionConfidence=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.prototype.hasMinDetectionConfidence=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.ext=new t.ExtensionFieldInfo(518928384,{ext:0},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[518928384]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[518928384]=proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.pose_landmarker.proto)}(pose_landmarks_detector_graph_options_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n);var s=pose_detector_graph_options_pb;r.object.extend(proto,s);var p=pose_landmarks_detector_graph_options_pb;r.object.extend(proto,p),r.exportSymbol("proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions",null,o),proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.displayName="proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.toObject=function(e,r){var o,i={baseOptions:(o=r.getBaseOptions())&&n.BaseOptions.toObject(e,o),poseDetectorGraphOptions:(o=r.getPoseDetectorGraphOptions())&&s.PoseDetectorGraphOptions.toObject(e,o),poseLandmarksDetectorGraphOptions:(o=r.getPoseLandmarksDetectorGraphOptions())&&p.PoseLandmarksDetectorGraphOptions.toObject(e,o),minTrackingConfidence:t.Message.getFloatingPointFieldWithDefault(r,4,.5)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions;return proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=new s.PoseDetectorGraphOptions;t.readMessage(r,s.PoseDetectorGraphOptions.deserializeBinaryFromReader),e.setPoseDetectorGraphOptions(r);break;case 3:r=new p.PoseLandmarksDetectorGraphOptions;t.readMessage(r,p.PoseLandmarksDetectorGraphOptions.deserializeBinaryFromReader),e.setPoseLandmarksDetectorGraphOptions(r);break;case 4:r=t.readFloat();e.setMinTrackingConfidence(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getBaseOptions())&&r.writeMessage(1,o,n.BaseOptions.serializeBinaryToWriter),null!=(o=e.getPoseDetectorGraphOptions())&&r.writeMessage(2,o,s.PoseDetectorGraphOptions.serializeBinaryToWriter),null!=(o=e.getPoseLandmarksDetectorGraphOptions())&&r.writeMessage(3,o,p.PoseLandmarksDetectorGraphOptions.serializeBinaryToWriter),null!=(o=t.Message.getField(e,4))&&r.writeFloat(4,o)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.ext=new t.ExtensionFieldInfo(516587230,{ext:0},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[516587230]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[516587230]=proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.ext,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.getPoseDetectorGraphOptions=function(){return t.Message.getWrapperField(this,s.PoseDetectorGraphOptions,2)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.setPoseDetectorGraphOptions=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.clearPoseDetectorGraphOptions=function(){return this.setPoseDetectorGraphOptions(void 0)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.hasPoseDetectorGraphOptions=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.getPoseLandmarksDetectorGraphOptions=function(){return t.Message.getWrapperField(this,p.PoseLandmarksDetectorGraphOptions,3)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.setPoseLandmarksDetectorGraphOptions=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.clearPoseLandmarksDetectorGraphOptions=function(){return this.setPoseLandmarksDetectorGraphOptions(void 0)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.hasPoseLandmarksDetectorGraphOptions=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.getMinTrackingConfidence=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,.5)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.setMinTrackingConfidence=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.clearMinTrackingConfidence=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.hasMinTrackingConfidence=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.ext=new t.ExtensionFieldInfo(516587230,{ext:0},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[516587230]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[516587230]=proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.pose_landmarker.proto)}(pose_landmarker_graph_options_pb);var pose_landmarker_options={};Object.defineProperty(pose_landmarker_options,"__esModule",{value:!0});var pose_landmarker_result={};Object.defineProperty(pose_landmarker_result,"__esModule",{value:!0}),function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,i)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(e,r){for(var o in e)"default"===o||Object.prototype.hasOwnProperty.call(r,o)||t(r,e,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.PoseLandmarker=void 0;const o=calculator_pb,i=calculator_options_pb,a=landmark_pb,n=base_options_pb,s=pose_detector_graph_options_pb,p=pose_landmarker_graph_options_pb,d=pose_landmarks_detector_graph_options_pb,l=landmark_result,g=vision_task_runner;r(pose_landmarker_options,e),r(pose_landmarker_result,e);const c="image_in",u="norm_rect",m="normalized_landmarks",f="world_landmarks",h="segmentation_masks",y=.5;class b extends g.VisionTaskRunner{static createFromOptions(e,t){return g.VisionTaskRunner.createVisionInstance(b,e,t)}static createFromModelBuffer(e,t){return g.VisionTaskRunner.createVisionInstance(b,e,{baseOptions:{modelAssetBuffer:t}})}static createFromModelPath(e,t){return g.VisionTaskRunner.createVisionInstance(b,e,{baseOptions:{modelAssetPath:t}})}constructor(e,t){super(new g.VisionGraphRunner(e,t),c,u,!1),this.result={},this.outputSegmentationMasks=!1,this.options=new p.PoseLandmarkerGraphOptions,this.options.setBaseOptions(new n.BaseOptions),this.poseLandmarksDetectorGraphOptions=new d.PoseLandmarksDetectorGraphOptions,this.options.setPoseLandmarksDetectorGraphOptions(this.poseLandmarksDetectorGraphOptions),this.poseDetectorGraphOptions=new s.PoseDetectorGraphOptions,this.options.setPoseDetectorGraphOptions(this.poseDetectorGraphOptions),this.initDefaults()}get baseOptions(){return this.options.getBaseOptions()}set baseOptions(e){this.options.setBaseOptions(e)}setOptions(e){var t,r,o,i,a;return"numPoses"in e&&this.poseDetectorGraphOptions.setNumPoses(null!==(t=e.numPoses)&&void 0!==t?t:1),"minPoseDetectionConfidence"in e&&this.poseDetectorGraphOptions.setMinDetectionConfidence(null!==(r=e.minPoseDetectionConfidence)&&void 0!==r?r:y),"minTrackingConfidence"in e&&this.options.setMinTrackingConfidence(null!==(o=e.minTrackingConfidence)&&void 0!==o?o:y),"minPosePresenceConfidence"in e&&this.poseLandmarksDetectorGraphOptions.setMinDetectionConfidence(null!==(i=e.minPosePresenceConfidence)&&void 0!==i?i:y),"outputSegmentationMasks"in e&&(this.outputSegmentationMasks=null!==(a=e.outputSegmentationMasks)&&void 0!==a&&a),this.applyOptions(e)}detect(e,t,r){const o="function"!=typeof t?t:{};if(this.userCallback="function"==typeof t?t:r,this.resetResults(),this.processImageData(e,o),!this.userCallback)return this.result}detectForVideo(e,t,r,o){const i="function"!=typeof r?r:{};if(this.userCallback="function"==typeof r?r:o,this.resetResults(),this.processVideoData(e,i,t),!this.userCallback)return this.result}resetResults(){this.result={}}maybeInvokeCallback(){"landmarks"in this.result&&"worldLandmarks"in this.result&&(this.outputSegmentationMasks&&!("segmentationMasks"in this.result)||this.userCallback&&(this.userCallback(this.result),this.freeKeepaliveStreams()))}initDefaults(){this.poseDetectorGraphOptions.setNumPoses(1),this.poseDetectorGraphOptions.setMinDetectionConfidence(y),this.poseLandmarksDetectorGraphOptions.setMinDetectionConfidence(y),this.options.setMinTrackingConfidence(y)}addJsLandmarks(e){this.result.landmarks=[];for(const t of e){const e=a.NormalizedLandmarkList.deserializeBinary(t);this.result.landmarks.push((0,l.convertToLandmarks)(e))}}adddJsWorldLandmarks(e){this.result.worldLandmarks=[];for(const t of e){const e=a.LandmarkList.deserializeBinary(t);this.result.worldLandmarks.push((0,l.convertToWorldLandmarks)(e))}}refreshGraph(){const e=new o.CalculatorGraphConfig;e.addInputStream(c),e.addInputStream(u),e.addOutputStream(m),e.addOutputStream(f),e.addOutputStream(h);const t=new i.CalculatorOptions;t.setExtension(p.PoseLandmarkerGraphOptions.ext,this.options);const r=new o.CalculatorGraphConfig.Node;r.setCalculator("mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),r.addInputStream("IMAGE:"+c),r.addInputStream("NORM_RECT:"+u),r.addOutputStream("NORM_LANDMARKS:"+m),r.addOutputStream("WORLD_LANDMARKS:"+f),r.setOptions(t),e.addNode(r),this.addKeepaliveNode(e),this.graphRunner.attachProtoVectorListener(m,((e,t)=>{this.addJsLandmarks(e),this.setLatestOutputTimestamp(t),this.maybeInvokeCallback()})),this.graphRunner.attachEmptyPacketListener(m,(e=>{this.result.landmarks=[],this.setLatestOutputTimestamp(e),this.maybeInvokeCallback()})),this.graphRunner.attachProtoVectorListener(f,((e,t)=>{this.adddJsWorldLandmarks(e),this.setLatestOutputTimestamp(t),this.maybeInvokeCallback()})),this.graphRunner.attachEmptyPacketListener(f,(e=>{this.result.worldLandmarks=[],this.setLatestOutputTimestamp(e),this.maybeInvokeCallback()})),this.outputSegmentationMasks&&(r.addOutputStream("SEGMENTATION_MASK:"+h),this.keepStreamAlive(h),this.graphRunner.attachImageVectorListener(h,((e,t)=>{this.result.segmentationMasks=e.map((e=>this.convertToMPMask(e,!this.userCallback))),this.setLatestOutputTimestamp(t),this.maybeInvokeCallback()})),this.graphRunner.attachEmptyPacketListener(h,(e=>{this.result.segmentationMasks=[],this.setLatestOutputTimestamp(e),this.maybeInvokeCallback()})));const a=e.serializeBinary();this.setGraph(new Uint8Array(a),!0)}}e.PoseLandmarker=b,b.POSE_CONNECTIONS=[{start:0,end:1},{start:1,end:2},{start:2,end:3},{start:3,end:7},{start:0,end:4},{start:4,end:5},{start:5,end:6},{start:6,end:8},{start:9,end:10},{start:11,end:12},{start:11,end:13},{start:13,end:15},{start:15,end:17},{start:15,end:19},{start:15,end:21},{start:17,end:19},{start:12,end:14},{start:14,end:16},{start:16,end:18},{start:16,end:20},{start:16,end:22},{start:18,end:20},{start:11,end:23},{start:12,end:24},{start:23,end:24},{start:23,end:25},{start:24,end:26},{start:25,end:27},{start:26,end:28},{start:27,end:29},{start:28,end:30},{start:29,end:31},{start:30,end:32},{start:27,end:31},{start:28,end:32}]}(pose_landmarker),Object.defineProperty(vision,"__esModule",{value:!0});var PoseLandmarker_1=vision.PoseLandmarker=ObjectDetector_1=vision.ObjectDetector=InteractiveSegmenter_1=vision.InteractiveSegmenter=ImageSegmenter_1=vision.ImageSegmenter=ImageEmbedder_1=vision.ImageEmbedder=ImageClassifier_1=vision.ImageClassifier=HandLandmarker_1=vision.HandLandmarker=GestureRecognizer_1=vision.GestureRecognizer=FaceStylizer_1=vision.FaceStylizer=FaceLandmarker_1=vision.FaceLandmarker=FaceDetector_1=vision.FaceDetector=MPMask_1=vision.MPMask=MPImage_1=vision.MPImage=FilesetResolver_1=vision.FilesetResolver=DrawingUtils_1=vision.DrawingUtils=void 0;const fileset_resolver_1=fileset_resolver,drawing_utils_1=drawing_utils,image_1=image,mask_1=mask,face_detector_1=face_detector,face_landmarker_1=face_landmarker,face_stylizer_1=face_stylizer,gesture_recognizer_1=gesture_recognizer,hand_landmarker_1=hand_landmarker,image_classifier_1=image_classifier,image_embedder_1=image_embedder,image_segmenter_1=image_segmenter,interactive_segmenter_1=interactive_segmenter,object_detector_1=object_detector,pose_landmarker_1=pose_landmarker,DrawingUtils=drawing_utils_1.DrawingUtils;var DrawingUtils_1=vision.DrawingUtils=DrawingUtils;const FilesetResolver=fileset_resolver_1.FilesetResolver;var FilesetResolver_1=vision.FilesetResolver=FilesetResolver;const MPImage=image_1.MPImage;var MPImage_1=vision.MPImage=MPImage;const MPMask=mask_1.MPMask;var MPMask_1=vision.MPMask=MPMask;const FaceDetector=face_detector_1.FaceDetector;var FaceDetector_1=vision.FaceDetector=FaceDetector;const FaceLandmarker=face_landmarker_1.FaceLandmarker;var FaceLandmarker_1=vision.FaceLandmarker=FaceLandmarker;const FaceStylizer=face_stylizer_1.FaceStylizer;var FaceStylizer_1=vision.FaceStylizer=FaceStylizer;const GestureRecognizer=gesture_recognizer_1.GestureRecognizer;var GestureRecognizer_1=vision.GestureRecognizer=GestureRecognizer;const HandLandmarker=hand_landmarker_1.HandLandmarker;var HandLandmarker_1=vision.HandLandmarker=HandLandmarker;const ImageClassifier=image_classifier_1.ImageClassifier;var ImageClassifier_1=vision.ImageClassifier=ImageClassifier;const ImageEmbedder=image_embedder_1.ImageEmbedder;var ImageEmbedder_1=vision.ImageEmbedder=ImageEmbedder;const ImageSegmenter=image_segmenter_1.ImageSegmenter;var ImageSegmenter_1=vision.ImageSegmenter=ImageSegmenter;const InteractiveSegmenter=interactive_segmenter_1.InteractiveSegmenter;var InteractiveSegmenter_1=vision.InteractiveSegmenter=InteractiveSegmenter;const ObjectDetector=object_detector_1.ObjectDetector;var ObjectDetector_1=vision.ObjectDetector=ObjectDetector;const PoseLandmarker=pose_landmarker_1.PoseLandmarker;PoseLandmarker_1=vision.PoseLandmarker=PoseLandmarker; \ No newline at end of file diff --git a/mounts/zoperepo/__root__/lib/js/vision_bundle_js_exports/__meta__ b/mounts/zoperepo/__root__/lib/js/vision_bundle_js_exports/__meta__ new file mode 100644 index 0000000..07f7e78 --- /dev/null +++ b/mounts/zoperepo/__root__/lib/js/vision_bundle_js_exports/__meta__ @@ -0,0 +1,8 @@ +[ + ('owner', (['acl_users'], 'dockerzope')), + ('props', [ + [('id', 'content_type'), ('type', 'string'), ('value', 'text/javascript')], + ]), + ('title', ''), + ('type', 'File'), +] diff --git a/mounts/zoperepo/__root__/lib/js/vision_bundle_js_exports/__source__.js b/mounts/zoperepo/__root__/lib/js/vision_bundle_js_exports/__source__.js new file mode 100644 index 0000000..10918d5 --- /dev/null +++ b/mounts/zoperepo/__root__/lib/js/vision_bundle_js_exports/__source__.js @@ -0,0 +1,17 @@ +var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},vision={},fileset_resolver={};let supportsSimd;Object.defineProperty(fileset_resolver,"__esModule",{value:!0}),fileset_resolver.FilesetResolver=void 0;const WASM_SIMD_CHECK=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]);async function isSimdSupported(){if(void 0===supportsSimd)try{await WebAssembly.instantiate(WASM_SIMD_CHECK),supportsSimd=!0}catch(e){supportsSimd=!1}return supportsSimd}async function createFileset(e,t=""){const r=await isSimdSupported()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}class FilesetResolver$1{static isSimdSupported(){return isSimdSupported()}static forAudioTasks(e){return createFileset("audio",e)}static forTextTasks(e){return createFileset("text",e)}static forVisionTasks(e){return createFileset("vision",e)}}fileset_resolver.FilesetResolver=FilesetResolver$1;var drawing_utils={};Object.defineProperty(drawing_utils,"__esModule",{value:!0}),drawing_utils.DrawingUtils=void 0;const DEFAULT_OPTIONS={color:"white",lineWidth:4,radius:6};function addDefaultOptions(e){return e=e||{},Object.assign(Object.assign(Object.assign({},DEFAULT_OPTIONS),{fillColor:e.color}),e)}function resolve(e,t){return e instanceof Function?e(t):e}class DrawingUtils$1{constructor(e){this.ctx=e}static clamp(e,t,r){const o=Math.min(t,r),i=Math.max(t,r);return Math.max(o,Math.min(i,e))}static lerp(e,t,r,o,i){const a=o*(1-(e-t)/(r-t))+i*(1-(r-e)/(r-t));return DrawingUtils$1.clamp(a,o,i)}drawLandmarks(e,t){if(!e)return;const r=this.ctx,o=addDefaultOptions(t);r.save();const i=r.canvas;let a=0;for(const t of e){r.fillStyle=resolve(o.fillColor,{index:a,from:t}),r.strokeStyle=resolve(o.color,{index:a,from:t}),r.lineWidth=resolve(o.lineWidth,{index:a,from:t});const e=new Path2D;e.arc(t.x*i.width,t.y*i.height,resolve(o.radius,{index:a,from:t}),0,2*Math.PI),r.fill(e),r.stroke(e),++a}r.restore()}drawConnectors(e,t,r){if(!e||!t)return;const o=this.ctx,i=addDefaultOptions(r);o.save();const a=o.canvas;let n=0;for(const r of t){o.beginPath();const t=e[r.start],s=e[r.end];t&&s&&(o.strokeStyle=resolve(i.color,{index:n,from:t,to:s}),o.lineWidth=resolve(i.lineWidth,{index:n,from:t,to:s}),o.moveTo(t.x*a.width,t.y*a.height),o.lineTo(s.x*a.width,s.y*a.height)),++n,o.stroke()}o.restore()}drawBoundingBox(e,t){const r=this.ctx,o=addDefaultOptions(t);r.save(),r.beginPath(),r.lineWidth=resolve(o.lineWidth,{}),r.strokeStyle=resolve(o.color,{}),r.fillStyle=resolve(o.fillColor,{}),r.moveTo(e.originX,e.originY),r.lineTo(e.originX+e.width,e.originY),r.lineTo(e.originX+e.width,e.originY+e.height),r.lineTo(e.originX,e.originY+e.height),r.lineTo(e.originX,e.originY),r.stroke(),r.fill(),r.restore()}}drawing_utils.DrawingUtils=DrawingUtils$1;var image={},image_shader_context={};Object.defineProperty(image_shader_context,"__esModule",{value:!0}),image_shader_context.MPImageShaderContext=image_shader_context.assertNotNull=void 0;const VERTEX_SHADER="\n attribute vec2 aVertex;\n attribute vec2 aTex;\n varying vec2 vTex;\n void main(void) {\n gl_Position = vec4(aVertex, 0.0, 1.0);\n vTex = aTex;\n }",FRAGMENT_SHADER="\n precision mediump float;\n varying vec2 vTex;\n uniform sampler2D inputTexture;\n void main() {\n gl_FragColor = texture2D(inputTexture, vTex);\n }\n ";function assertNotNull(e,t){if(null===e)throw new Error(`Unable to obtain required WebGL resource: ${t}`);return e}image_shader_context.assertNotNull=assertNotNull;class MPImageShaderBuffers{constructor(e,t,r,o){this.gl=e,this.vertexArrayObject=t,this.vertexBuffer=r,this.textureBuffer=o}bind(){this.gl.bindVertexArray(this.vertexArrayObject)}unbind(){this.gl.bindVertexArray(null)}close(){this.gl.deleteVertexArray(this.vertexArrayObject),this.gl.deleteBuffer(this.vertexBuffer),this.gl.deleteBuffer(this.textureBuffer)}}class MPImageShaderContext{compileShader(e,t){const r=this.gl,o=assertNotNull(r.createShader(t),"Failed to create WebGL shader");if(r.shaderSource(o,e),r.compileShader(o),!r.getShaderParameter(o,r.COMPILE_STATUS)){const e=r.getShaderInfoLog(o);throw new Error(`Could not compile WebGL shader: ${e}`)}return r.attachShader(this.program,o),o}setupShaders(){const e=this.gl;this.program=assertNotNull(e.createProgram(),"Failed to create WebGL program"),this.vertexShader=this.compileShader(VERTEX_SHADER,e.VERTEX_SHADER),this.fragmentShader=this.compileShader(FRAGMENT_SHADER,e.FRAGMENT_SHADER),e.linkProgram(this.program);if(!e.getProgramParameter(this.program,e.LINK_STATUS)){const t=e.getProgramInfoLog(this.program);throw new Error(`Error during program linking: ${t}`)}this.aVertex=e.getAttribLocation(this.program,"aVertex"),this.aTex=e.getAttribLocation(this.program,"aTex")}createBuffers(e){const t=this.gl,r=assertNotNull(t.createVertexArray(),"Failed to create vertex array");t.bindVertexArray(r);const o=assertNotNull(t.createBuffer(),"Failed to create buffer");t.bindBuffer(t.ARRAY_BUFFER,o),t.enableVertexAttribArray(this.aVertex),t.vertexAttribPointer(this.aVertex,2,t.FLOAT,!1,0,0),t.bufferData(t.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),t.STATIC_DRAW);const i=assertNotNull(t.createBuffer(),"Failed to create buffer");t.bindBuffer(t.ARRAY_BUFFER,i),t.enableVertexAttribArray(this.aTex),t.vertexAttribPointer(this.aTex,2,t.FLOAT,!1,0,0);const a=e?[0,1,0,0,1,0,1,1]:[0,0,0,1,1,1,1,0];return t.bufferData(t.ARRAY_BUFFER,new Float32Array(a),t.STATIC_DRAW),t.bindBuffer(t.ARRAY_BUFFER,null),t.bindVertexArray(null),new MPImageShaderBuffers(t,r,o,i)}getShaderBuffers(e){return e?(this.shaderBuffersFlipVertically||(this.shaderBuffersFlipVertically=this.createBuffers(!0)),this.shaderBuffersFlipVertically):(this.shaderBuffersPassthrough||(this.shaderBuffersPassthrough=this.createBuffers(!1)),this.shaderBuffersPassthrough)}maybeInitGL(e){if(this.gl){if(e!==this.gl)throw new Error("Cannot change GL context once initialized")}else this.gl=e}run(e,t,r){this.maybeInitGL(e),this.program||this.setupShaders();const o=this.getShaderBuffers(t);e.useProgram(this.program),o.bind();const i=r();return o.unbind(),i}bindFramebuffer(e,t){this.maybeInitGL(e),this.framebuffer||(this.framebuffer=assertNotNull(e.createFramebuffer(),"Failed to create framebuffe.")),e.bindFramebuffer(e.FRAMEBUFFER,this.framebuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)}unbindFramebuffer(){var e;null===(e=this.gl)||void 0===e||e.bindFramebuffer(this.gl.FRAMEBUFFER,null)}close(){if(this.program){const e=this.gl;e.deleteProgram(this.program),e.deleteShader(this.vertexShader),e.deleteShader(this.fragmentShader)}this.framebuffer&&this.gl.deleteFramebuffer(this.framebuffer),this.shaderBuffersPassthrough&&this.shaderBuffersPassthrough.close(),this.shaderBuffersFlipVertically&&this.shaderBuffersFlipVertically.close()}}image_shader_context.MPImageShaderContext=MPImageShaderContext,Object.defineProperty(image,"__esModule",{value:!0}),image.MPImage=void 0;const image_shader_context_1$2=image_shader_context;var MPImageType;!function(e){e[e.IMAGE_DATA=0]="IMAGE_DATA",e[e.IMAGE_BITMAP=1]="IMAGE_BITMAP",e[e.WEBGL_TEXTURE=2]="WEBGL_TEXTURE"}(MPImageType||(MPImageType={}));class MPImage$1{constructor(e,t,r,o,i,a,n){this.containers=e,this.ownsImageBitmap=t,this.ownsWebGLTexture=r,this.canvas=o,this.shaderContext=i,this.width=a,this.height=n}hasImageData(){return!!this.getContainer(MPImageType.IMAGE_DATA)}hasImageBitmap(){return!!this.getContainer(MPImageType.IMAGE_BITMAP)}hasWebGLTexture(){return!!this.getContainer(MPImageType.WEBGL_TEXTURE)}getAsImageData(){return this.convertToImageData()}getAsImageBitmap(){return this.convertToImageBitmap()}getAsWebGLTexture(){return this.convertToWebGLTexture()}getContainer(e){switch(e){case MPImageType.IMAGE_DATA:return this.containers.find((e=>e instanceof ImageData));case MPImageType.IMAGE_BITMAP:return this.containers.find((e=>"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap));case MPImageType.WEBGL_TEXTURE:return this.containers.find((e=>"undefined"!=typeof WebGLTexture&&e instanceof WebGLTexture));default:throw new Error(`Type is not supported: ${e}`)}}clone(){const e=[];for(const t of this.containers){let r;if(t instanceof ImageData)r=new ImageData(t.data,this.width,this.height);else if(t instanceof WebGLTexture){const e=this.getGL(),t=this.getShaderContext();e.activeTexture(e.TEXTURE1),r=(0,image_shader_context_1$2.assertNotNull)(e.createTexture(),"Failed to create texture"),e.bindTexture(e.TEXTURE_2D,r),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,this.width,this.height,0,e.RGBA,e.UNSIGNED_BYTE,null),t.bindFramebuffer(e,r),t.run(e,!1,(()=>{this.bindTexture(),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.drawArrays(e.TRIANGLE_FAN,0,4),this.unbindTexture()})),t.unbindFramebuffer(),this.unbindTexture()}else{if(!(t instanceof ImageBitmap))throw new Error(`Type is not supported: ${t}`);this.convertToWebGLTexture(),this.bindTexture(),r=this.copyTextureToBitmap(),this.unbindTexture()}e.push(r)}return new MPImage$1(e,this.hasImageBitmap(),this.hasWebGLTexture(),this.canvas,this.shaderContext,this.width,this.height)}getOffscreenCanvas(){if(!(this.canvas instanceof OffscreenCanvas))throw new Error("Conversion to ImageBitmap requires that the MediaPipe Tasks is initialized with an OffscreenCanvas");return this.canvas}getGL(){if(!this.canvas)throw new Error("Conversion to different image formats require that a canvas is passed when iniitializing the image.");return this.gl||(this.gl=(0,image_shader_context_1$2.assertNotNull)(this.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),this.gl}getShaderContext(){return this.shaderContext||(this.shaderContext=new image_shader_context_1$2.MPImageShaderContext),this.shaderContext}convertToImageBitmap(){let e=this.getContainer(MPImageType.IMAGE_BITMAP);return e||(this.convertToWebGLTexture(),e=this.convertWebGLTextureToImageBitmap(),this.containers.push(e),this.ownsImageBitmap=!0),e}convertToImageData(){let e=this.getContainer(MPImageType.IMAGE_DATA);if(!e){const t=this.getGL(),r=this.getShaderContext(),o=new Uint8Array(this.width*this.height*4),i=this.convertToWebGLTexture();r.bindFramebuffer(t,i),t.readPixels(0,0,this.width,this.height,t.RGBA,t.UNSIGNED_BYTE,o),r.unbindFramebuffer(),e=new ImageData(new Uint8ClampedArray(o.buffer),this.width,this.height),this.containers.push(e)}return e}convertToWebGLTexture(){let e=this.getContainer(MPImageType.WEBGL_TEXTURE);if(!e){const t=this.getGL();e=this.bindTexture();const r=this.getContainer(MPImageType.IMAGE_BITMAP)||this.convertToImageData();t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,r),this.unbindTexture()}return e}bindTexture(){const e=this.getGL();e.viewport(0,0,this.width,this.height),e.activeTexture(e.TEXTURE0);let t=this.getContainer(MPImageType.WEBGL_TEXTURE);return t||(t=(0,image_shader_context_1$2.assertNotNull)(e.createTexture(),"Failed to create texture"),this.containers.push(t),this.ownsWebGLTexture=!0),e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),t}unbindTexture(){this.gl.bindTexture(this.gl.TEXTURE_2D,null)}copyTextureToBitmap(){const e=this.getGL();return this.getShaderContext().run(e,!0,(()=>this.runWithResizedCanvas((()=>(e.bindFramebuffer(e.FRAMEBUFFER,null),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.drawArrays(e.TRIANGLE_FAN,0,4),this.getOffscreenCanvas().transferToImageBitmap())))))}convertWebGLTextureToImageBitmap(){this.bindTexture();const e=this.copyTextureToBitmap();return this.unbindTexture(),e}runWithResizedCanvas(e){const t=this.canvas;if(t.width===this.width&&t.height===this.height)return e();const r=t.width,o=t.height;t.width=this.width,t.height=this.height;const i=e();return t.width=r,t.height=o,i}close(){if(this.ownsImageBitmap&&this.getContainer(MPImageType.IMAGE_BITMAP).close(),this.ownsWebGLTexture){this.getGL().deleteTexture(this.getContainer(MPImageType.WEBGL_TEXTURE))}}}image.MPImage=MPImage$1;var mask={};Object.defineProperty(mask,"__esModule",{value:!0}),mask.MPMask=void 0;const image_shader_context_1$1=image_shader_context;var MPMaskType;!function(e){e[e.UINT8_ARRAY=0]="UINT8_ARRAY",e[e.FLOAT32_ARRAY=1]="FLOAT32_ARRAY",e[e.WEBGL_TEXTURE=2]="WEBGL_TEXTURE"}(MPMaskType||(MPMaskType={}));class MPMask$1{constructor(e,t,r,o,i,a){this.containers=e,this.ownsWebGLTexture=t,this.canvas=r,this.shaderContext=o,this.width=i,this.height=a}hasUint8Array(){return!!this.getContainer(MPMaskType.UINT8_ARRAY)}hasFloat32Array(){return!!this.getContainer(MPMaskType.FLOAT32_ARRAY)}hasWebGLTexture(){return!!this.getContainer(MPMaskType.WEBGL_TEXTURE)}getAsUint8Array(){return this.convertToUint8Array()}getAsFloat32Array(){return this.convertToFloat32Array()}getAsWebGLTexture(){return this.convertToWebGLTexture()}getContainer(e){switch(e){case MPMaskType.UINT8_ARRAY:return this.containers.find((e=>e instanceof Uint8Array));case MPMaskType.FLOAT32_ARRAY:return this.containers.find((e=>e instanceof Float32Array));case MPMaskType.WEBGL_TEXTURE:return this.containers.find((e=>"undefined"!=typeof WebGLTexture&&e instanceof WebGLTexture));default:throw new Error(`Type is not supported: ${e}`)}}clone(){const e=[];for(const t of this.containers){let r;if(t instanceof Uint8Array)r=new Uint8Array(t);else if(t instanceof Float32Array)r=new Float32Array(t);else{if(!(t instanceof WebGLTexture))throw new Error(`Type is not supported: ${t}`);{const e=this.getGL(),t=this.getShaderContext();e.activeTexture(e.TEXTURE1),r=(0,image_shader_context_1$1.assertNotNull)(e.createTexture(),"Failed to create texture"),e.bindTexture(e.TEXTURE_2D,r),e.texImage2D(e.TEXTURE_2D,0,e.R32F,this.width,this.height,0,e.RED,e.FLOAT,null),e.bindTexture(e.TEXTURE_2D,null),t.bindFramebuffer(e,r),t.run(e,!1,(()=>{this.bindTexture(),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.drawArrays(e.TRIANGLE_FAN,0,4),this.unbindTexture()})),t.unbindFramebuffer(),this.unbindTexture()}}e.push(r)}return new MPMask$1(e,this.hasWebGLTexture(),this.canvas,this.shaderContext,this.width,this.height)}getGL(){if(!this.canvas)throw new Error("Conversion to different image formats require that a canvas is passed when iniitializing the image.");this.gl||(this.gl=(0,image_shader_context_1$1.assertNotNull)(this.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context."));if(!this.gl.getExtension("EXT_color_buffer_float"))throw new Error("Missing required EXT_color_buffer_float extension");return this.gl}getShaderContext(){return this.shaderContext||(this.shaderContext=new image_shader_context_1$1.MPImageShaderContext),this.shaderContext}convertToFloat32Array(){let e=this.getContainer(MPMaskType.FLOAT32_ARRAY);if(!e){const t=this.getContainer(MPMaskType.UINT8_ARRAY);if(t)e=new Float32Array(t).map((e=>e/255));else{const t=this.getGL(),r=this.getShaderContext();e=new Float32Array(this.width*this.height);const o=this.convertToWebGLTexture();r.bindFramebuffer(t,o),t.readPixels(0,0,this.width,this.height,t.RED,t.FLOAT,e),r.unbindFramebuffer()}this.containers.push(e)}return e}convertToUint8Array(){let e=this.getContainer(MPMaskType.UINT8_ARRAY);if(!e){const t=this.convertToFloat32Array();e=new Uint8Array(t.map((e=>255*e))),this.containers.push(e)}return e}convertToWebGLTexture(){let e=this.getContainer(MPMaskType.WEBGL_TEXTURE);if(!e){const t=this.getGL();e=this.bindTexture();const r=this.convertToFloat32Array();t.texImage2D(t.TEXTURE_2D,0,t.R32F,this.width,this.height,0,t.RED,t.FLOAT,r),this.unbindTexture()}return e}bindTexture(){const e=this.getGL();e.viewport(0,0,this.width,this.height),e.activeTexture(e.TEXTURE0);let t=this.getContainer(MPMaskType.WEBGL_TEXTURE);return t||(t=(0,image_shader_context_1$1.assertNotNull)(e.createTexture(),"Failed to create texture"),this.containers.push(t),this.ownsWebGLTexture=!0),e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),t}unbindTexture(){this.gl.bindTexture(this.gl.TEXTURE_2D,null)}close(){if(this.ownsWebGLTexture){this.getGL().deleteTexture(this.getContainer(MPMaskType.WEBGL_TEXTURE))}}}mask.MPMask=MPMask$1;var face_detector={},calculator_pb={},googleProtobuf={};(function(exports){var $jscomp=$jscomp||{};$jscomp.scope={},$jscomp.findInternal=function(e,t,r){e instanceof String&&(e=String(e));for(var o=e.length,i=0;i=o}}),"es6","es3"),$jscomp.polyfill("Array.prototype.find",(function(e){return e||function(e,t){return $jscomp.findInternal(this,e,t).v}}),"es6","es3"),$jscomp.polyfill("String.prototype.startsWith",(function(e){return e||function(e,t){var r=$jscomp.checkStringArgs(this,e,"startsWith");e+="";var o=r.length,i=e.length;t=Math.max(0,Math.min(0|t,r.length));for(var a=0;a=i}}),"es6","es3"),$jscomp.polyfill("String.prototype.repeat",(function(e){return e||function(e){var t=$jscomp.checkStringArgs(this,null,"repeat");if(0>e||1342177279>>=1)&&(t+=t);return r}}),"es6","es3");var COMPILED=!0,goog=goog||{};goog.global=commonjsGlobal||self,goog.exportPath_=function(e,t,r){e=e.split("."),r=r||goog.global,e[0]in r||void 0===r.execScript||r.execScript("var "+e[0]);for(var o;e.length&&(o=e.shift());)e.length||void 0===t?r=r[o]&&r[o]!==Object.prototype[o]?r[o]:r[o]={}:r[o]=t},goog.define=function(e,t){return t},goog.FEATURESET_YEAR=2012,goog.DEBUG=!0,goog.LOCALE="en",goog.TRUSTED_SITE=!0,goog.STRICT_MODE_COMPATIBLE=!1,goog.DISALLOW_TEST_ONLY_CODE=!goog.DEBUG,goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING=!1,goog.provide=function(e){if(goog.isInModuleLoader_())throw Error("goog.provide cannot be used within a module.");goog.constructNamespace_(e)},goog.constructNamespace_=function(e,t){goog.exportPath_(e,t)},goog.getScriptNonce=function(e){return e&&e!=goog.global?goog.getScriptNonce_(e.document):(null===goog.cspNonce_&&(goog.cspNonce_=goog.getScriptNonce_(goog.global.document)),goog.cspNonce_)},goog.NONCE_PATTERN_=/^[\w+/_-]+[=]{0,2}$/,goog.cspNonce_=null,goog.getScriptNonce_=function(e){return(e=e.querySelector&&e.querySelector("script[nonce]"))&&(e=e.nonce||e.getAttribute("nonce"))&&goog.NONCE_PATTERN_.test(e)?e:""},goog.VALID_MODULE_RE_=/^[a-zA-Z_$][a-zA-Z0-9._$]*$/,goog.module=function(e){if("string"!=typeof e||!e||-1==e.search(goog.VALID_MODULE_RE_))throw Error("Invalid module identifier");if(!goog.isInGoogModuleLoader_())throw Error("Module "+e+" has been loaded incorrectly. Note, modules cannot be loaded as normal scripts. They require some kind of pre-processing step. You're likely trying to load a module via a script tag or as a part of a concatenated bundle without rewriting the module. For more info see: https://github.com/google/closure-library/wiki/goog.module:-an-ES6-module-like-alternative-to-goog.provide.");if(goog.moduleLoaderState_.moduleName)throw Error("goog.module may only be called once per module.");goog.moduleLoaderState_.moduleName=e},goog.module.get=function(e){return goog.module.getInternal_(e)},goog.module.getInternal_=function(e){return null},goog.ModuleType={ES6:"es6",GOOG:"goog"},goog.moduleLoaderState_=null,goog.isInModuleLoader_=function(){return goog.isInGoogModuleLoader_()||goog.isInEs6ModuleLoader_()},goog.isInGoogModuleLoader_=function(){return!!goog.moduleLoaderState_&&goog.moduleLoaderState_.type==goog.ModuleType.GOOG},goog.isInEs6ModuleLoader_=function(){if(goog.moduleLoaderState_&&goog.moduleLoaderState_.type==goog.ModuleType.ES6)return!0;var e=goog.global.$jscomp;return!!e&&("function"==typeof e.getCurrentModulePath&&!!e.getCurrentModulePath())},goog.module.declareLegacyNamespace=function(){goog.moduleLoaderState_.declareLegacyNamespace=!0},goog.declareModuleId=function(e){if(goog.moduleLoaderState_)goog.moduleLoaderState_.moduleName=e;else{var t=goog.global.$jscomp;if(!t||"function"!=typeof t.getCurrentModulePath)throw Error('Module with namespace "'+e+'" has been loaded incorrectly.');t=t.require(t.getCurrentModulePath()),goog.loadedModules_[e]={exports:t,type:goog.ModuleType.ES6,moduleId:e}}},goog.setTestOnly=function(e){if(goog.DISALLOW_TEST_ONLY_CODE)throw e=e||"",Error("Importing test-only code into non-debug environment"+(e?": "+e:"."))},goog.forwardDeclare=function(e){},goog.getObjectByName=function(e,t){e=e.split("."),t=t||goog.global;for(var r=0;r>>0),goog.uidCounter_=0,goog.getHashCode=goog.getUid,goog.removeHashCode=goog.removeUid,goog.cloneObject=function(e){var t=goog.typeOf(e);if("object"==t||"array"==t){if("function"==typeof e.clone)return e.clone();for(var r in t="array"==t?[]:{},e)t[r]=goog.cloneObject(e[r]);return t}return e},goog.bindNative_=function(e,t,r){return e.call.apply(e.bind,arguments)},goog.bindJs_=function(e,t,r){if(!e)throw Error();if(2r?Math.max(0,e.length+r):r,"string"==typeof e)return"string"!=typeof t||1!=t.length?-1:e.indexOf(t,r);for(;r(r=null==r?e.length-1:r)&&(r=Math.max(0,e.length+r)),"string"==typeof e)return"string"!=typeof t||1!=t.length?-1:e.lastIndexOf(t,r);for(;0<=r;r--)if(r in e&&e[r]===t)return r;return-1},goog.array.forEach=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.forEach)?function(e,t,r){goog.asserts.assert(null!=e.length),Array.prototype.forEach.call(e,t,r)}:function(e,t,r){for(var o=e.length,i="string"==typeof e?e.split(""):e,a=0;a(t=goog.array.findIndex(e,t,r))?null:"string"==typeof e?e.charAt(t):e[t]},goog.array.findIndex=function(e,t,r){for(var o=e.length,i="string"==typeof e?e.split(""):e,a=0;a(t=goog.array.findIndexRight(e,t,r))?null:"string"==typeof e?e.charAt(t):e[t]},goog.array.findIndexRight=function(e,t,r){var o=e.length,i="string"==typeof e?e.split(""):e;for(--o;0<=o;o--)if(o in i&&t.call(r,i[o],o,e))return o;return-1},goog.array.contains=function(e,t){return 0<=goog.array.indexOf(e,t)},goog.array.isEmpty=function(e){return 0==e.length},goog.array.clear=function(e){if(!Array.isArray(e))for(var t=e.length-1;0<=t;t--)delete e[t];e.length=0},goog.array.insert=function(e,t){goog.array.contains(e,t)||e.push(t)},goog.array.insertAt=function(e,t,r){goog.array.splice(e,r,0,t)},goog.array.insertArrayAt=function(e,t,r){goog.partial(goog.array.splice,e,r,0).apply(null,t)},goog.array.insertBefore=function(e,t,r){var o;2==arguments.length||0>(o=goog.array.indexOf(e,r))?e.push(t):goog.array.insertAt(e,t,o)},goog.array.remove=function(e,t){var r;return(r=0<=(t=goog.array.indexOf(e,t)))&&goog.array.removeAt(e,t),r},goog.array.removeLast=function(e,t){return 0<=(t=goog.array.lastIndexOf(e,t))&&(goog.array.removeAt(e,t),!0)},goog.array.removeAt=function(e,t){return goog.asserts.assert(null!=e.length),1==Array.prototype.splice.call(e,t,1).length},goog.array.removeIf=function(e,t,r){return 0<=(t=goog.array.findIndex(e,t,r))&&(goog.array.removeAt(e,t),!0)},goog.array.removeAllIf=function(e,t,r){var o=0;return goog.array.forEachRight(e,(function(i,a){t.call(r,i,a,e)&&goog.array.removeAt(e,a)&&o++})),o},goog.array.concat=function(e){return Array.prototype.concat.apply([],arguments)},goog.array.join=function(e){return Array.prototype.concat.apply([],arguments)},goog.array.toArray=function(e){var t=e.length;if(0=arguments.length?Array.prototype.slice.call(e,t):Array.prototype.slice.call(e,t,r)},goog.array.removeDuplicates=function(e,t,r){t=t||e;var o=function(e){return goog.isObject(e)?"o"+goog.getUid(e):(typeof e).charAt(0)+e};r=r||o,o={};for(var i=0,a=0;a>>1),d=r?t.call(i,e[p],p,e):t(o,e[p]);0t?1:e(r=goog.array.binarySearch(e,t,r))&&(goog.array.insertAt(e,t,-(r+1)),!0)},goog.array.binaryRemove=function(e,t,r){return 0<=(t=goog.array.binarySearch(e,t,r))&&goog.array.removeAt(e,t)},goog.array.bucket=function(e,t,r){for(var o={},i=0;i(r=r||1)*(a-i))return[];if(0a;e+=r)o.push(e);return o},goog.array.repeat=function(e,t){for(var r=[],o=0;ot&&Array.prototype.push.apply(e,e.splice(0,-t))),e},goog.array.moveItem=function(e,t,r){goog.asserts.assert(0<=t&&t>=8),t[r++]=i}return t},goog.crypt.byteArrayToString=function(e){if(8192>=e.length)return String.fromCharCode.apply(null,e);for(var t="",r=0;ri?t[r++]=i:(2048>i?t[r++]=i>>6|192:(55296==(64512&i)&&o+1>18|240,t[r++]=i>>12&63|128):t[r++]=i>>12|224,t[r++]=i>>6&63|128),t[r++]=63&i|128)}return t},goog.crypt.utf8ByteArrayToString=function(e){for(var t=[],r=0,o=0;ri)t[o++]=String.fromCharCode(i);else if(191i){var a=e[r++];t[o++]=String.fromCharCode((31&i)<<6|63&a)}else if(239i){a=e[r++];var n=e[r++];i=((7&i)<<18|(63&a)<<12|(63&n)<<6|63&e[r++])-65536,t[o++]=String.fromCharCode(55296+(i>>10)),t[o++]=String.fromCharCode(56320+(1023&i))}else a=e[r++],n=e[r++],t[o++]=String.fromCharCode((15&i)<<12|(63&a)<<6|63&n)}return t.join("")},goog.crypt.xorByteArray=function(e,t){goog.asserts.assert(e.length==t.length,"XOR array lengths must match");for(var r=[],o=0;o"}},goog.dom.asserts.getWindow_=function(e){try{var t=e&&e.ownerDocument,r=t&&(t.defaultView||t.parentWindow);if((r=r||goog.global).Element&&r.Location)return r}catch(e){}return null},goog.functions={},goog.functions.constant=function(e){return function(){return e}},goog.functions.FALSE=function(){return!1},goog.functions.TRUE=function(){return!0},goog.functions.NULL=function(){return null},goog.functions.identity=function(e,t){return e},goog.functions.error=function(e){return function(){throw Error(e)}},goog.functions.fail=function(e){return function(){throw e}},goog.functions.lock=function(e,t){return t=t||0,function(){return e.apply(this,Array.prototype.slice.call(arguments,0,t))}},goog.functions.nth=function(e){return function(){return arguments[e]}},goog.functions.partialRight=function(e,t){var r=Array.prototype.slice.call(arguments,1);return function(){var t=Array.prototype.slice.call(arguments);return t.push.apply(t,r),e.apply(this,t)}},goog.functions.withReturnValue=function(e,t){return goog.functions.sequence(e,goog.functions.constant(t))},goog.functions.equalTo=function(e,t){return function(r){return t?e==r:e===r}},goog.functions.compose=function(e,t){var r=arguments,o=r.length;return function(){var e;o&&(e=r[o-1].apply(this,arguments));for(var t=o-2;0<=t;t--)e=r[t].call(this,e);return e}},goog.functions.sequence=function(e){var t=arguments,r=t.length;return function(){for(var e,o=0;oe?goog.i18n.bidi.Dir.RTL:t?null:goog.i18n.bidi.Dir.NEUTRAL:null==e?null:e?goog.i18n.bidi.Dir.RTL:goog.i18n.bidi.Dir.LTR},goog.i18n.bidi.ltrChars_="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ऀ-῿‎Ⰰ-\ud801\ud804-\ud839\ud83c-\udbff豈-﬜︀-﹯﻽-￿",goog.i18n.bidi.rtlChars_="֑-ۯۺ-ࣿ‏\ud802-\ud803\ud83a-\ud83bיִ-﷿ﹰ-ﻼ",goog.i18n.bidi.htmlSkipReg_=/<[^>]*>|&[^;]+;/g,goog.i18n.bidi.stripHtmlIfNeeded_=function(e,t){return t?e.replace(goog.i18n.bidi.htmlSkipReg_,""):e},goog.i18n.bidi.rtlCharReg_=new RegExp("["+goog.i18n.bidi.rtlChars_+"]"),goog.i18n.bidi.ltrCharReg_=new RegExp("["+goog.i18n.bidi.ltrChars_+"]"),goog.i18n.bidi.hasAnyRtl=function(e,t){return goog.i18n.bidi.rtlCharReg_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,t))},goog.i18n.bidi.hasRtlChar=goog.i18n.bidi.hasAnyRtl,goog.i18n.bidi.hasAnyLtr=function(e,t){return goog.i18n.bidi.ltrCharReg_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,t))},goog.i18n.bidi.ltrRe_=new RegExp("^["+goog.i18n.bidi.ltrChars_+"]"),goog.i18n.bidi.rtlRe_=new RegExp("^["+goog.i18n.bidi.rtlChars_+"]"),goog.i18n.bidi.isRtlChar=function(e){return goog.i18n.bidi.rtlRe_.test(e)},goog.i18n.bidi.isLtrChar=function(e){return goog.i18n.bidi.ltrRe_.test(e)},goog.i18n.bidi.isNeutralChar=function(e){return!goog.i18n.bidi.isLtrChar(e)&&!goog.i18n.bidi.isRtlChar(e)},goog.i18n.bidi.ltrDirCheckRe_=new RegExp("^[^"+goog.i18n.bidi.rtlChars_+"]*["+goog.i18n.bidi.ltrChars_+"]"),goog.i18n.bidi.rtlDirCheckRe_=new RegExp("^[^"+goog.i18n.bidi.ltrChars_+"]*["+goog.i18n.bidi.rtlChars_+"]"),goog.i18n.bidi.startsWithRtl=function(e,t){return goog.i18n.bidi.rtlDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,t))},goog.i18n.bidi.isRtlText=goog.i18n.bidi.startsWithRtl,goog.i18n.bidi.startsWithLtr=function(e,t){return goog.i18n.bidi.ltrDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,t))},goog.i18n.bidi.isLtrText=goog.i18n.bidi.startsWithLtr,goog.i18n.bidi.isRequiredLtrRe_=/^http:\/\/.*/,goog.i18n.bidi.isNeutralText=function(e,t){return e=goog.i18n.bidi.stripHtmlIfNeeded_(e,t),goog.i18n.bidi.isRequiredLtrRe_.test(e)||!goog.i18n.bidi.hasAnyLtr(e)&&!goog.i18n.bidi.hasAnyRtl(e)},goog.i18n.bidi.ltrExitDirCheckRe_=new RegExp("["+goog.i18n.bidi.ltrChars_+"][^"+goog.i18n.bidi.rtlChars_+"]*$"),goog.i18n.bidi.rtlExitDirCheckRe_=new RegExp("["+goog.i18n.bidi.rtlChars_+"][^"+goog.i18n.bidi.ltrChars_+"]*$"),goog.i18n.bidi.endsWithLtr=function(e,t){return goog.i18n.bidi.ltrExitDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,t))},goog.i18n.bidi.isLtrExitText=goog.i18n.bidi.endsWithLtr,goog.i18n.bidi.endsWithRtl=function(e,t){return goog.i18n.bidi.rtlExitDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,t))},goog.i18n.bidi.isRtlExitText=goog.i18n.bidi.endsWithRtl,goog.i18n.bidi.rtlLocalesRe_=/^(ar|ckb|dv|he|iw|fa|nqo|ps|sd|ug|ur|yi|.*[-_](Adlm|Arab|Hebr|Nkoo|Rohg|Thaa))(?!.*[-_](Latn|Cyrl)($|-|_))($|-|_)/i,goog.i18n.bidi.isRtlLanguage=function(e){return goog.i18n.bidi.rtlLocalesRe_.test(e)},goog.i18n.bidi.bracketGuardTextRe_=/(\(.*?\)+)|(\[.*?\]+)|(\{.*?\}+)|(<.*?>+)/g,goog.i18n.bidi.guardBracketInText=function(e,t){return t=(void 0===t?goog.i18n.bidi.hasAnyRtl(e):t)?goog.i18n.bidi.Format.RLM:goog.i18n.bidi.Format.LRM,e.replace(goog.i18n.bidi.bracketGuardTextRe_,t+"$&"+t)},goog.i18n.bidi.enforceRtlInHtml=function(e){return"<"==e.charAt(0)?e.replace(/<\w+/,"$& dir=rtl"):"\n"+e+""},goog.i18n.bidi.enforceRtlInText=function(e){return goog.i18n.bidi.Format.RLE+e+goog.i18n.bidi.Format.PDF},goog.i18n.bidi.enforceLtrInHtml=function(e){return"<"==e.charAt(0)?e.replace(/<\w+/,"$& dir=ltr"):"\n"+e+""},goog.i18n.bidi.enforceLtrInText=function(e){return goog.i18n.bidi.Format.LRE+e+goog.i18n.bidi.Format.PDF},goog.i18n.bidi.dimensionsRe_=/:\s*([.\d][.\w]*)\s+([.\d][.\w]*)\s+([.\d][.\w]*)\s+([.\d][.\w]*)/g,goog.i18n.bidi.leftRe_=/left/gi,goog.i18n.bidi.rightRe_=/right/gi,goog.i18n.bidi.tempRe_=/%%%%/g,goog.i18n.bidi.mirrorCSS=function(e){return e.replace(goog.i18n.bidi.dimensionsRe_,":$1 $4 $3 $2").replace(goog.i18n.bidi.leftRe_,"%%%%").replace(goog.i18n.bidi.rightRe_,goog.i18n.bidi.LEFT).replace(goog.i18n.bidi.tempRe_,goog.i18n.bidi.RIGHT)},goog.i18n.bidi.doubleQuoteSubstituteRe_=/([\u0591-\u05f2])"/g,goog.i18n.bidi.singleQuoteSubstituteRe_=/([\u0591-\u05f2])'/g,goog.i18n.bidi.normalizeHebrewQuote=function(e){return e.replace(goog.i18n.bidi.doubleQuoteSubstituteRe_,"$1״").replace(goog.i18n.bidi.singleQuoteSubstituteRe_,"$1׳")},goog.i18n.bidi.wordSeparatorRe_=/\s+/,goog.i18n.bidi.hasNumeralsRe_=/[\d\u06f0-\u06f9]/,goog.i18n.bidi.rtlDetectionThreshold_=.4,goog.i18n.bidi.estimateDirection=function(e,t){var r=0,o=0,i=!1;for(e=goog.i18n.bidi.stripHtmlIfNeeded_(e,t).split(goog.i18n.bidi.wordSeparatorRe_),t=0;tgoog.i18n.bidi.rtlDetectionThreshold_?goog.i18n.bidi.Dir.RTL:goog.i18n.bidi.Dir.LTR},goog.i18n.bidi.detectRtlDirectionality=function(e,t){return goog.i18n.bidi.estimateDirection(e,t)==goog.i18n.bidi.Dir.RTL},goog.i18n.bidi.setElementDirAndAlign=function(e,t){e&&(t=goog.i18n.bidi.toDir(t))&&(e.style.textAlign=t==goog.i18n.bidi.Dir.RTL?goog.i18n.bidi.RIGHT:goog.i18n.bidi.LEFT,e.dir=t==goog.i18n.bidi.Dir.RTL?"rtl":"ltr")},goog.i18n.bidi.setElementDirByTextDirectionality=function(e,t){switch(goog.i18n.bidi.estimateDirection(t)){case goog.i18n.bidi.Dir.LTR:e.dir="ltr";break;case goog.i18n.bidi.Dir.RTL:e.dir="rtl";break;default:e.removeAttribute("dir")}},goog.i18n.bidi.DirectionalString=function(){},goog.html.TrustedResourceUrl=function(e,t){this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_=e===goog.html.TrustedResourceUrl.CONSTRUCTOR_TOKEN_PRIVATE_&&t||"",this.TRUSTED_RESOURCE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_},goog.html.TrustedResourceUrl.prototype.implementsGoogStringTypedString=!0,goog.html.TrustedResourceUrl.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_.toString()},goog.html.TrustedResourceUrl.prototype.implementsGoogI18nBidiDirectionalString=!0,goog.html.TrustedResourceUrl.prototype.getDirection=function(){return goog.i18n.bidi.Dir.LTR},goog.html.TrustedResourceUrl.prototype.cloneWithParams=function(e,t){var r=goog.html.TrustedResourceUrl.unwrap(this),o=(r=goog.html.TrustedResourceUrl.URL_PARAM_PARSER_.exec(r))[3]||"";return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(r[1]+goog.html.TrustedResourceUrl.stringifyParams_("?",r[2]||"",e)+goog.html.TrustedResourceUrl.stringifyParams_("#",o,t))},goog.DEBUG&&(goog.html.TrustedResourceUrl.prototype.toString=function(){return"TrustedResourceUrl{"+this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_+"}"}),goog.html.TrustedResourceUrl.unwrap=function(e){return goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(e).toString()},goog.html.TrustedResourceUrl.unwrapTrustedScriptURL=function(e){return e instanceof goog.html.TrustedResourceUrl&&e.constructor===goog.html.TrustedResourceUrl&&e.TRUSTED_RESOURCE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_?e.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_:(goog.asserts.fail("expected object of type TrustedResourceUrl, got '"+e+"' of type "+goog.typeOf(e)),"type_error:TrustedResourceUrl")},goog.html.TrustedResourceUrl.format=function(e,t){var r=goog.string.Const.unwrap(e);if(!goog.html.TrustedResourceUrl.BASE_URL_.test(r))throw Error("Invalid TrustedResourceUrl format: "+r);return e=r.replace(goog.html.TrustedResourceUrl.FORMAT_MARKER_,(function(e,o){if(!Object.prototype.hasOwnProperty.call(t,o))throw Error('Found marker, "'+o+'", in format string, "'+r+'", but no valid label mapping found in args: '+JSON.stringify(t));return(e=t[o])instanceof goog.string.Const?goog.string.Const.unwrap(e):encodeURIComponent(String(e))})),goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.TrustedResourceUrl.FORMAT_MARKER_=/%{(\w+)}/g,goog.html.TrustedResourceUrl.BASE_URL_=/^((https:)?\/\/[0-9a-z.:[\]-]+\/|\/[^/\\]|[^:/\\%]+\/|[^:/\\%]*[?#]|about:blank#)/i,goog.html.TrustedResourceUrl.URL_PARAM_PARSER_=/^([^?#]*)(\?[^#]*)?(#[\s\S]*)?/,goog.html.TrustedResourceUrl.formatWithParams=function(e,t,r,o){return goog.html.TrustedResourceUrl.format(e,t).cloneWithParams(r,o)},goog.html.TrustedResourceUrl.fromConstant=function(e){return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(goog.string.Const.unwrap(e))},goog.html.TrustedResourceUrl.fromConstants=function(e){for(var t="",r=0;re.length?"&":"")+encodeURIComponent(o)+"="+encodeURIComponent(String(n)))}}return t},goog.html.TrustedResourceUrl.CONSTRUCTOR_TOKEN_PRIVATE_={},goog.string.internal={},goog.string.internal.startsWith=function(e,t){return 0==e.lastIndexOf(t,0)},goog.string.internal.endsWith=function(e,t){var r=e.length-t.length;return 0<=r&&e.indexOf(t,r)==r},goog.string.internal.caseInsensitiveStartsWith=function(e,t){return 0==goog.string.internal.caseInsensitiveCompare(t,e.substr(0,t.length))},goog.string.internal.caseInsensitiveEndsWith=function(e,t){return 0==goog.string.internal.caseInsensitiveCompare(t,e.substr(e.length-t.length,t.length))},goog.string.internal.caseInsensitiveEquals=function(e,t){return e.toLowerCase()==t.toLowerCase()},goog.string.internal.isEmptyOrWhitespace=function(e){return/^[\s\xa0]*$/.test(e)},goog.string.internal.trim=goog.TRUSTED_SITE&&String.prototype.trim?function(e){return e.trim()}:function(e){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(e)[1]},goog.string.internal.caseInsensitiveCompare=function(e,t){return(e=String(e).toLowerCase())<(t=String(t).toLowerCase())?-1:e==t?0:1},goog.string.internal.newLineToBr=function(e,t){return e.replace(/(\r\n|\r|\n)/g,t?"
":"
")},goog.string.internal.htmlEscape=function(e,t){if(t)e=e.replace(goog.string.internal.AMP_RE_,"&").replace(goog.string.internal.LT_RE_,"<").replace(goog.string.internal.GT_RE_,">").replace(goog.string.internal.QUOT_RE_,""").replace(goog.string.internal.SINGLE_QUOTE_RE_,"'").replace(goog.string.internal.NULL_RE_,"�");else{if(!goog.string.internal.ALL_RE_.test(e))return e;-1!=e.indexOf("&")&&(e=e.replace(goog.string.internal.AMP_RE_,"&")),-1!=e.indexOf("<")&&(e=e.replace(goog.string.internal.LT_RE_,"<")),-1!=e.indexOf(">")&&(e=e.replace(goog.string.internal.GT_RE_,">")),-1!=e.indexOf('"')&&(e=e.replace(goog.string.internal.QUOT_RE_,""")),-1!=e.indexOf("'")&&(e=e.replace(goog.string.internal.SINGLE_QUOTE_RE_,"'")),-1!=e.indexOf("\0")&&(e=e.replace(goog.string.internal.NULL_RE_,"�"))}return e},goog.string.internal.AMP_RE_=/&/g,goog.string.internal.LT_RE_=//g,goog.string.internal.QUOT_RE_=/"/g,goog.string.internal.SINGLE_QUOTE_RE_=/'/g,goog.string.internal.NULL_RE_=/\x00/g,goog.string.internal.ALL_RE_=/[\x00&<>"']/,goog.string.internal.whitespaceEscape=function(e,t){return goog.string.internal.newLineToBr(e.replace(/ /g,"  "),t)},goog.string.internal.contains=function(e,t){return-1!=e.indexOf(t)},goog.string.internal.caseInsensitiveContains=function(e,t){return goog.string.internal.contains(e.toLowerCase(),t.toLowerCase())},goog.string.internal.compareVersions=function(e,t){var r=0;e=goog.string.internal.trim(String(e)).split("."),t=goog.string.internal.trim(String(t)).split(".");for(var o=Math.max(e.length,t.length),i=0;0==r&&it?1:0},goog.html.SafeUrl=function(e,t){this.privateDoNotAccessOrElseSafeUrlWrappedValue_=e===goog.html.SafeUrl.CONSTRUCTOR_TOKEN_PRIVATE_&&t||"",this.SAFE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_},goog.html.SafeUrl.INNOCUOUS_STRING="about:invalid#zClosurez",goog.html.SafeUrl.prototype.implementsGoogStringTypedString=!0,goog.html.SafeUrl.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseSafeUrlWrappedValue_.toString()},goog.html.SafeUrl.prototype.implementsGoogI18nBidiDirectionalString=!0,goog.html.SafeUrl.prototype.getDirection=function(){return goog.i18n.bidi.Dir.LTR},goog.DEBUG&&(goog.html.SafeUrl.prototype.toString=function(){return"SafeUrl{"+this.privateDoNotAccessOrElseSafeUrlWrappedValue_+"}"}),goog.html.SafeUrl.unwrap=function(e){return e instanceof goog.html.SafeUrl&&e.constructor===goog.html.SafeUrl&&e.SAFE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_?e.privateDoNotAccessOrElseSafeUrlWrappedValue_:(goog.asserts.fail("expected object of type SafeUrl, got '"+e+"' of type "+goog.typeOf(e)),"type_error:SafeUrl")},goog.html.SafeUrl.fromConstant=function(e){return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(goog.string.Const.unwrap(e))},goog.html.SAFE_MIME_TYPE_PATTERN_=/^(?:audio\/(?:3gpp2|3gpp|aac|L16|midi|mp3|mp4|mpeg|oga|ogg|opus|x-m4a|x-matroska|x-wav|wav|webm)|image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp|x-icon)|text\/csv|video\/(?:mpeg|mp4|ogg|webm|quicktime|x-matroska))(?:;\w+=(?:\w+|"[\w;,= ]+"))*$/i,goog.html.SafeUrl.isSafeMimeType=function(e){return goog.html.SAFE_MIME_TYPE_PATTERN_.test(e)},goog.html.SafeUrl.fromBlob=function(e){return e=goog.html.SafeUrl.isSafeMimeType(e.type)?goog.fs.url.createObjectUrl(e):goog.html.SafeUrl.INNOCUOUS_STRING,goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.SafeUrl.fromMediaSource=function(e){return goog.asserts.assert("MediaSource"in goog.global,"No support for MediaSource"),e=e instanceof MediaSource?goog.fs.url.createObjectUrl(e):goog.html.SafeUrl.INNOCUOUS_STRING,goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.DATA_URL_PATTERN_=/^data:(.*);base64,[a-z0-9+\/]+=*$/i,goog.html.SafeUrl.fromDataUrl=function(e){var t=(e=e.replace(/(%0A|%0D)/g,"")).match(goog.html.DATA_URL_PATTERN_);return t=t&&goog.html.SafeUrl.isSafeMimeType(t[1]),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(t?e:goog.html.SafeUrl.INNOCUOUS_STRING)},goog.html.SafeUrl.fromTelUrl=function(e){return goog.string.internal.caseInsensitiveStartsWith(e,"tel:")||(e=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.SIP_URL_PATTERN_=/^sip[s]?:[+a-z0-9_.!$%&'*\/=^`{|}~-]+@([a-z0-9-]+\.)+[a-z0-9]{2,63}$/i,goog.html.SafeUrl.fromSipUrl=function(e){return goog.html.SIP_URL_PATTERN_.test(decodeURIComponent(e))||(e=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.SafeUrl.fromFacebookMessengerUrl=function(e){return goog.string.internal.caseInsensitiveStartsWith(e,"fb-messenger://share")||(e=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.SafeUrl.fromWhatsAppUrl=function(e){return goog.string.internal.caseInsensitiveStartsWith(e,"whatsapp://send")||(e=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.SafeUrl.fromSmsUrl=function(e){return goog.string.internal.caseInsensitiveStartsWith(e,"sms:")&&goog.html.SafeUrl.isSmsUrlBodyValid_(e)||(e=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.SafeUrl.isSmsUrlBodyValid_=function(e){var t=e.indexOf("#");if(0+~[\]()=^$|]+$/.test(r))throw Error("Selector allows only [-_a-zA-Z0-9#.:* ,>+~[\\]()=^$|] and strings, got: "+e);if(!goog.html.SafeStyleSheet.hasBalancedBrackets_(r))throw Error("() and [] in selector must be balanced, got: "+e);return t instanceof goog.html.SafeStyle||(t=goog.html.SafeStyle.create(t)),e=e+"{"+goog.html.SafeStyle.unwrap(t).replace(/.":"");if(e.toUpperCase()in goog.html.SafeHtml.NOT_ALLOWED_TAG_NAMES_)throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES?"Tag name <"+e+"> is not allowed for SafeHtml.":"")},goog.html.SafeHtml.createIframe=function(e,t,r,o){e&&goog.html.TrustedResourceUrl.unwrap(e);var i={};return i.src=e||null,i.srcdoc=t&&goog.html.SafeHtml.unwrap(t),e=goog.html.SafeHtml.combineAttributes(i,{sandbox:""},r),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("iframe",e,o)},goog.html.SafeHtml.createSandboxIframe=function(e,t,r,o){if(!goog.html.SafeHtml.canUseSandboxIframe())throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES?"The browser does not support sandboxed iframes.":"");var i={};return i.src=e?goog.html.SafeUrl.unwrap(goog.html.SafeUrl.sanitize(e)):null,i.srcdoc=t||null,i.sandbox="",e=goog.html.SafeHtml.combineAttributes(i,{},r),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("iframe",e,o)},goog.html.SafeHtml.canUseSandboxIframe=function(){return goog.global.HTMLIFrameElement&&"sandbox"in goog.global.HTMLIFrameElement.prototype},goog.html.SafeHtml.createScriptSrc=function(e,t){return goog.html.TrustedResourceUrl.unwrap(e),e=goog.html.SafeHtml.combineAttributes({src:e},{},t),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("script",e)},goog.html.SafeHtml.createScript=function(e,t){for(var r in t){var o=r.toLowerCase();if("language"==o||"src"==o||"text"==o||"type"==o)throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES?'Cannot set "'+o+'" attribute':"")}for(r="",e=goog.array.concat(e),o=0;o does not allow content."),i+=">"):(o=goog.html.SafeHtml.concat(r),i+=">"+goog.html.SafeHtml.unwrap(o)+"",o=o.getDirection()),(e=t&&t.dir)&&(o=/^(ltr|rtl|auto)$/i.test(e)?goog.i18n.bidi.Dir.NEUTRAL:null),goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(i,o)},goog.html.SafeHtml.stringifyAttributes=function(e,t){var r="";if(t)for(var o in t){if(!goog.html.SafeHtml.VALID_NAMES_IN_TAG_.test(o))throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES?'Invalid attribute name "'+o+'".':"");var i=t[o];null!=i&&(r+=" "+goog.html.SafeHtml.getAttrNameAndValue_(e,o,i))}return r},goog.html.SafeHtml.combineAttributes=function(e,t,r){var o,i={};for(o in e)goog.asserts.assert(o.toLowerCase()==o,"Must be lower case"),i[o]=e[o];for(o in t)goog.asserts.assert(o.toLowerCase()==o,"Must be lower case"),i[o]=t[o];if(r)for(o in r){var a=o.toLowerCase();if(a in e)throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES?'Cannot override "'+a+'" attribute, got "'+o+'" with value "'+r[o]+'"':"");a in t&&delete i[a],i[o]=r[o]}return i},goog.html.SafeHtml.DOCTYPE_HTML=goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse("",goog.i18n.bidi.Dir.NEUTRAL),goog.html.SafeHtml.EMPTY=goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse("",goog.i18n.bidi.Dir.NEUTRAL),goog.html.SafeHtml.BR=goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse("
",goog.i18n.bidi.Dir.NEUTRAL),goog.html.uncheckedconversions={},goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract=function(e,t,r){return goog.asserts.assertString(goog.string.Const.unwrap(e),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(e)),"must provide non-empty justification"),goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(t,r||null)},goog.html.uncheckedconversions.safeScriptFromStringKnownToSatisfyTypeContract=function(e,t){return goog.asserts.assertString(goog.string.Const.unwrap(e),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(e)),"must provide non-empty justification"),goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(t)},goog.html.uncheckedconversions.safeStyleFromStringKnownToSatisfyTypeContract=function(e,t){return goog.asserts.assertString(goog.string.Const.unwrap(e),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(e)),"must provide non-empty justification"),goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(t)},goog.html.uncheckedconversions.safeStyleSheetFromStringKnownToSatisfyTypeContract=function(e,t){return goog.asserts.assertString(goog.string.Const.unwrap(e),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(e)),"must provide non-empty justification"),goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(t)},goog.html.uncheckedconversions.safeUrlFromStringKnownToSatisfyTypeContract=function(e,t){return goog.asserts.assertString(goog.string.Const.unwrap(e),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(e)),"must provide non-empty justification"),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(t)},goog.html.uncheckedconversions.trustedResourceUrlFromStringKnownToSatisfyTypeContract=function(e,t){return goog.asserts.assertString(goog.string.Const.unwrap(e),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(e)),"must provide non-empty justification"),goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(t)},goog.dom.safe={},goog.dom.safe.InsertAdjacentHtmlPosition={AFTERBEGIN:"afterbegin",AFTEREND:"afterend",BEFOREBEGIN:"beforebegin",BEFOREEND:"beforeend"},goog.dom.safe.insertAdjacentHtml=function(e,t,r){e.insertAdjacentHTML(t,goog.html.SafeHtml.unwrapTrustedHTML(r))},goog.dom.safe.SET_INNER_HTML_DISALLOWED_TAGS_={MATH:!0,SCRIPT:!0,STYLE:!0,SVG:!0,TEMPLATE:!0},goog.dom.safe.isInnerHtmlCleanupRecursive_=goog.functions.cacheReturnValue((function(){if(goog.DEBUG&&"undefined"==typeof document)return!1;var e=document.createElement("div"),t=document.createElement("div");return t.appendChild(document.createElement("div")),e.appendChild(t),!(goog.DEBUG&&!e.firstChild)&&(t=e.firstChild.firstChild,e.innerHTML=goog.html.SafeHtml.unwrapTrustedHTML(goog.html.SafeHtml.EMPTY),!t.parentElement)})),goog.dom.safe.unsafeSetInnerHtmlDoNotUseOrElse=function(e,t){if(goog.dom.safe.isInnerHtmlCleanupRecursive_())for(;e.lastChild;)e.removeChild(e.lastChild);e.innerHTML=goog.html.SafeHtml.unwrapTrustedHTML(t)},goog.dom.safe.setInnerHtml=function(e,t){if(goog.asserts.ENABLE_ASSERTS){var r=e.tagName.toUpperCase();if(goog.dom.safe.SET_INNER_HTML_DISALLOWED_TAGS_[r])throw Error("goog.dom.safe.setInnerHtml cannot be used to set content of "+e.tagName+".")}goog.dom.safe.unsafeSetInnerHtmlDoNotUseOrElse(e,t)},goog.dom.safe.setOuterHtml=function(e,t){e.outerHTML=goog.html.SafeHtml.unwrapTrustedHTML(t)},goog.dom.safe.setFormElementAction=function(e,t){t=t instanceof goog.html.SafeUrl?t:goog.html.SafeUrl.sanitizeAssertUnchanged(t),goog.dom.asserts.assertIsHTMLFormElement(e).action=goog.html.SafeUrl.unwrap(t)},goog.dom.safe.setButtonFormAction=function(e,t){t=t instanceof goog.html.SafeUrl?t:goog.html.SafeUrl.sanitizeAssertUnchanged(t),goog.dom.asserts.assertIsHTMLButtonElement(e).formAction=goog.html.SafeUrl.unwrap(t)},goog.dom.safe.setInputFormAction=function(e,t){t=t instanceof goog.html.SafeUrl?t:goog.html.SafeUrl.sanitizeAssertUnchanged(t),goog.dom.asserts.assertIsHTMLInputElement(e).formAction=goog.html.SafeUrl.unwrap(t)},goog.dom.safe.setStyle=function(e,t){e.style.cssText=goog.html.SafeStyle.unwrap(t)},goog.dom.safe.documentWrite=function(e,t){e.write(goog.html.SafeHtml.unwrapTrustedHTML(t))},goog.dom.safe.setAnchorHref=function(e,t){goog.dom.asserts.assertIsHTMLAnchorElement(e),t=t instanceof goog.html.SafeUrl?t:goog.html.SafeUrl.sanitizeAssertUnchanged(t),e.href=goog.html.SafeUrl.unwrap(t)},goog.dom.safe.setImageSrc=function(e,t){if(goog.dom.asserts.assertIsHTMLImageElement(e),!(t instanceof goog.html.SafeUrl)){var r=/^data:image\//i.test(t);t=goog.html.SafeUrl.sanitizeAssertUnchanged(t,r)}e.src=goog.html.SafeUrl.unwrap(t)},goog.dom.safe.setAudioSrc=function(e,t){if(goog.dom.asserts.assertIsHTMLAudioElement(e),!(t instanceof goog.html.SafeUrl)){var r=/^data:audio\//i.test(t);t=goog.html.SafeUrl.sanitizeAssertUnchanged(t,r)}e.src=goog.html.SafeUrl.unwrap(t)},goog.dom.safe.setVideoSrc=function(e,t){if(goog.dom.asserts.assertIsHTMLVideoElement(e),!(t instanceof goog.html.SafeUrl)){var r=/^data:video\//i.test(t);t=goog.html.SafeUrl.sanitizeAssertUnchanged(t,r)}e.src=goog.html.SafeUrl.unwrap(t)},goog.dom.safe.setEmbedSrc=function(e,t){goog.dom.asserts.assertIsHTMLEmbedElement(e),e.src=goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(t)},goog.dom.safe.setFrameSrc=function(e,t){goog.dom.asserts.assertIsHTMLFrameElement(e),e.src=goog.html.TrustedResourceUrl.unwrap(t)},goog.dom.safe.setIframeSrc=function(e,t){goog.dom.asserts.assertIsHTMLIFrameElement(e),e.src=goog.html.TrustedResourceUrl.unwrap(t)},goog.dom.safe.setIframeSrcdoc=function(e,t){goog.dom.asserts.assertIsHTMLIFrameElement(e),e.srcdoc=goog.html.SafeHtml.unwrapTrustedHTML(t)},goog.dom.safe.setLinkHrefAndRel=function(e,t,r){goog.dom.asserts.assertIsHTMLLinkElement(e),e.rel=r,goog.string.internal.caseInsensitiveContains(r,"stylesheet")?(goog.asserts.assert(t instanceof goog.html.TrustedResourceUrl,'URL must be TrustedResourceUrl because "rel" contains "stylesheet"'),e.href=goog.html.TrustedResourceUrl.unwrap(t)):e.href=t instanceof goog.html.TrustedResourceUrl?goog.html.TrustedResourceUrl.unwrap(t):t instanceof goog.html.SafeUrl?goog.html.SafeUrl.unwrap(t):goog.html.SafeUrl.unwrap(goog.html.SafeUrl.sanitizeAssertUnchanged(t))},goog.dom.safe.setObjectData=function(e,t){goog.dom.asserts.assertIsHTMLObjectElement(e),e.data=goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(t)},goog.dom.safe.setScriptSrc=function(e,t){goog.dom.asserts.assertIsHTMLScriptElement(e),e.src=goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(t),(t=goog.getScriptNonce())&&e.setAttribute("nonce",t)},goog.dom.safe.setScriptContent=function(e,t){goog.dom.asserts.assertIsHTMLScriptElement(e),e.text=goog.html.SafeScript.unwrapTrustedScript(t),(t=goog.getScriptNonce())&&e.setAttribute("nonce",t)},goog.dom.safe.setLocationHref=function(e,t){goog.dom.asserts.assertIsLocation(e),t=t instanceof goog.html.SafeUrl?t:goog.html.SafeUrl.sanitizeAssertUnchanged(t),e.href=goog.html.SafeUrl.unwrap(t)},goog.dom.safe.assignLocation=function(e,t){goog.dom.asserts.assertIsLocation(e),t=t instanceof goog.html.SafeUrl?t:goog.html.SafeUrl.sanitizeAssertUnchanged(t),e.assign(goog.html.SafeUrl.unwrap(t))},goog.dom.safe.replaceLocation=function(e,t){t=t instanceof goog.html.SafeUrl?t:goog.html.SafeUrl.sanitizeAssertUnchanged(t),e.replace(goog.html.SafeUrl.unwrap(t))},goog.dom.safe.openInWindow=function(e,t,r,o,i){return e=e instanceof goog.html.SafeUrl?e:goog.html.SafeUrl.sanitizeAssertUnchanged(e),t=t||goog.global,r=r instanceof goog.string.Const?goog.string.Const.unwrap(r):r||"",t.open(goog.html.SafeUrl.unwrap(e),r,o,i)},goog.dom.safe.parseFromStringHtml=function(e,t){return goog.dom.safe.parseFromString(e,t,"text/html")},goog.dom.safe.parseFromString=function(e,t,r){return e.parseFromString(goog.html.SafeHtml.unwrapTrustedHTML(t),r)},goog.dom.safe.createImageFromBlob=function(e){if(!/^image\/.*/g.test(e.type))throw Error("goog.dom.safe.createImageFromBlob only accepts MIME type image/.*.");var t=goog.global.URL.createObjectURL(e);return(e=new goog.global.Image).onload=function(){goog.global.URL.revokeObjectURL(t)},goog.dom.safe.setImageSrc(e,goog.html.uncheckedconversions.safeUrlFromStringKnownToSatisfyTypeContract(goog.string.Const.from("Image blob URL."),t)),e},goog.string.DETECT_DOUBLE_ESCAPING=!1,goog.string.FORCE_NON_DOM_HTML_UNESCAPING=!1,goog.string.Unicode={NBSP:" "},goog.string.startsWith=goog.string.internal.startsWith,goog.string.endsWith=goog.string.internal.endsWith,goog.string.caseInsensitiveStartsWith=goog.string.internal.caseInsensitiveStartsWith,goog.string.caseInsensitiveEndsWith=goog.string.internal.caseInsensitiveEndsWith,goog.string.caseInsensitiveEquals=goog.string.internal.caseInsensitiveEquals,goog.string.subs=function(e,t){for(var r=e.split("%s"),o="",i=Array.prototype.slice.call(arguments,1);i.length&&1=e||"€"<=e&&"�">=e},goog.string.stripNewlines=function(e){return e.replace(/(\r\n|\r|\n)+/g," ")},goog.string.canonicalizeNewlines=function(e){return e.replace(/(\r\n|\r|\n)/g,"\n")},goog.string.normalizeWhitespace=function(e){return e.replace(/\xa0|\s/g," ")},goog.string.normalizeSpaces=function(e){return e.replace(/\xa0|[ \t]+/g," ")},goog.string.collapseBreakingSpaces=function(e){return e.replace(/[\t\r\n ]+/g," ").replace(/^[\t\r\n ]+|[\t\r\n ]+$/g,"")},goog.string.trim=goog.string.internal.trim,goog.string.trimLeft=function(e){return e.replace(/^[\s\xa0]+/,"")},goog.string.trimRight=function(e){return e.replace(/[\s\xa0]+$/,"")},goog.string.caseInsensitiveCompare=goog.string.internal.caseInsensitiveCompare,goog.string.numberAwareCompare_=function(e,t,r){if(e==t)return 0;if(!e)return-1;if(!t)return 1;for(var o=e.toLowerCase().match(r),i=t.toLowerCase().match(r),a=Math.min(o.length,i.length),n=0;n",""":'"'},o=t?t.createElement("div"):goog.global.document.createElement("div");return e.replace(goog.string.HTML_ENTITY_PATTERN_,(function(e,t){var i=r[e];return i||("#"==t.charAt(0)&&(t=Number("0"+t.substr(1)),isNaN(t)||(i=String.fromCharCode(t))),i||(goog.dom.safe.setInnerHtml(o,goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract(goog.string.Const.from("Single HTML entity."),e+" ")),i=o.firstChild.nodeValue.slice(0,-1)),r[e]=i)}))},goog.string.unescapePureXmlEntities_=function(e){return e.replace(/&([^;]+);/g,(function(e,t){switch(t){case"amp":return"&";case"lt":return"<";case"gt":return">";case"quot":return'"';default:return"#"!=t.charAt(0)||(t=Number("0"+t.substr(1)),isNaN(t))?e:String.fromCharCode(t)}}))},goog.string.HTML_ENTITY_PATTERN_=/&([^;\s<&]+);?/g,goog.string.whitespaceEscape=function(e,t){return goog.string.newLineToBr(e.replace(/ /g,"  "),t)},goog.string.preserveSpaces=function(e){return e.replace(/(^|[\n ]) /g,"$1"+goog.string.Unicode.NBSP)},goog.string.stripQuotes=function(e,t){for(var r=t.length,o=0;ot&&(e=e.substring(0,t-3)+"..."),r&&(e=goog.string.htmlEscape(e)),e},goog.string.truncateMiddle=function(e,t,r,o){if(r&&(e=goog.string.unescapeEntities(e)),o&&e.length>t){o>t&&(o=t);var i=e.length-o;e=e.substring(0,t-o)+"..."+e.substring(i)}else e.length>t&&(o=Math.floor(t/2),i=e.length-o,e=e.substring(0,o+t%2)+"..."+e.substring(i));return r&&(e=goog.string.htmlEscape(e)),e},goog.string.specialEscapeChars_={"\0":"\\0","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\x0B",'"':'\\"',"\\":"\\\\","<":"\\u003C"},goog.string.jsEscapeCache_={"'":"\\'"},goog.string.quote=function(e){e=String(e);for(var t=['"'],r=0;ri?o:goog.string.escapeChar(o))}return t.push('"'),t.join("")},goog.string.escapeString=function(e){for(var t=[],r=0;rt)var r=e;else 256>t?(r="\\x",(16>t||256t&&(r+="0")),r+=t.toString(16).toUpperCase();return goog.string.jsEscapeCache_[e]=r},goog.string.contains=goog.string.internal.contains,goog.string.caseInsensitiveContains=goog.string.internal.caseInsensitiveContains,goog.string.countOf=function(e,t){return e&&t?e.split(t).length-1:0},goog.string.removeAt=function(e,t,r){var o=e;return 0<=t&&t>>0;return t},goog.string.uniqueStringCounter_=2147483648*Math.random()|0,goog.string.createUniqueString=function(){return"goog_"+goog.string.uniqueStringCounter_++},goog.string.toNumber=function(e){var t=Number(e);return 0==t&&goog.string.isEmptyOrWhitespace(e)?NaN:t},goog.string.isLowerCamelCase=function(e){return/^[a-z]+([A-Z][a-z]*)*$/.test(e)},goog.string.isUpperCamelCase=function(e){return/^([A-Z][a-z]*)+$/.test(e)},goog.string.toCamelCase=function(e){return String(e).replace(/\-([a-z])/g,(function(e,t){return t.toUpperCase()}))},goog.string.toSelectorCase=function(e){return String(e).replace(/([A-Z])/g,"-$1").toLowerCase()},goog.string.toTitleCase=function(e,t){return t="string"==typeof t?goog.string.regExpEscape(t):"\\s",e.replace(new RegExp("(^"+(t?"|["+t+"]+":"")+")([a-z])","g"),(function(e,t,r){return t+r.toUpperCase()}))},goog.string.capitalize=function(e){return String(e.charAt(0)).toUpperCase()+String(e.substr(1)).toLowerCase()},goog.string.parseInt=function(e){return isFinite(e)&&(e=String(e)),"string"==typeof e?/^\s*-?0x/i.test(e)?parseInt(e,16):parseInt(e,10):NaN},goog.string.splitLimit=function(e,t,r){e=e.split(t);for(var o=[];0r&&(r=i)}return-1==r?e:e.slice(r+1)},goog.string.editDistance=function(e,t){var r=[],o=[];if(e==t)return 0;if(!e.length||!t.length)return Math.max(e.length,t.length);for(var i=0;iparseFloat(e))?String(t):e},goog.userAgent.getVersionRegexResult_=function(){var e=goog.userAgent.getUserAgentString();return goog.userAgent.GECKO?/rv:([^\);]+)(\)|;)/.exec(e):goog.userAgent.EDGE?/Edge\/([\d\.]+)/.exec(e):goog.userAgent.IE?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(e):goog.userAgent.WEBKIT?/WebKit\/(\S+)/.exec(e):goog.userAgent.OPERA?/(?:Version)[ \/]?(\S+)/.exec(e):void 0},goog.userAgent.getDocumentMode_=function(){var e=goog.global.document;return e?e.documentMode:void 0},goog.userAgent.VERSION=goog.userAgent.determineVersion_(),goog.userAgent.compare=function(e,t){return goog.string.compareVersions(e,t)},goog.userAgent.isVersionOrHigherCache_={},goog.userAgent.isVersionOrHigher=function(e){return goog.userAgent.ASSUME_ANY_VERSION||goog.reflect.cache(goog.userAgent.isVersionOrHigherCache_,e,(function(){return 0<=goog.string.compareVersions(goog.userAgent.VERSION,e)}))},goog.userAgent.isVersion=goog.userAgent.isVersionOrHigher,goog.userAgent.isDocumentModeOrHigher=function(e){return Number(goog.userAgent.DOCUMENT_MODE)>=e},goog.userAgent.isDocumentMode=goog.userAgent.isDocumentModeOrHigher,goog.userAgent.DOCUMENT_MODE=function(){if(goog.global.document&&goog.userAgent.IE){var e=goog.userAgent.getDocumentMode_();return e||(parseInt(goog.userAgent.VERSION,10)||void 0)}}(),goog.userAgent.product={},goog.userAgent.product.ASSUME_FIREFOX=!1,goog.userAgent.product.ASSUME_IPHONE=!1,goog.userAgent.product.ASSUME_IPAD=!1,goog.userAgent.product.ASSUME_ANDROID=!1,goog.userAgent.product.ASSUME_CHROME=!1,goog.userAgent.product.ASSUME_SAFARI=!1,goog.userAgent.product.PRODUCT_KNOWN_=goog.userAgent.ASSUME_IE||goog.userAgent.ASSUME_EDGE||goog.userAgent.ASSUME_OPERA||goog.userAgent.product.ASSUME_FIREFOX||goog.userAgent.product.ASSUME_IPHONE||goog.userAgent.product.ASSUME_IPAD||goog.userAgent.product.ASSUME_ANDROID||goog.userAgent.product.ASSUME_CHROME||goog.userAgent.product.ASSUME_SAFARI,goog.userAgent.product.OPERA=goog.userAgent.OPERA,goog.userAgent.product.IE=goog.userAgent.IE,goog.userAgent.product.EDGE=goog.userAgent.EDGE,goog.userAgent.product.FIREFOX=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_FIREFOX:goog.labs.userAgent.browser.isFirefox(),goog.userAgent.product.isIphoneOrIpod_=function(){return goog.labs.userAgent.platform.isIphone()||goog.labs.userAgent.platform.isIpod()},goog.userAgent.product.IPHONE=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_IPHONE:goog.userAgent.product.isIphoneOrIpod_(),goog.userAgent.product.IPAD=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_IPAD:goog.labs.userAgent.platform.isIpad(),goog.userAgent.product.ANDROID=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_ANDROID:goog.labs.userAgent.browser.isAndroidBrowser(),goog.userAgent.product.CHROME=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_CHROME:goog.labs.userAgent.browser.isChrome(),goog.userAgent.product.isSafariDesktop_=function(){return goog.labs.userAgent.browser.isSafari()&&!goog.labs.userAgent.platform.isIos()},goog.userAgent.product.SAFARI=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_SAFARI:goog.userAgent.product.isSafariDesktop_(),goog.crypt.base64={},goog.crypt.base64.DEFAULT_ALPHABET_COMMON_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",goog.crypt.base64.ENCODED_VALS=goog.crypt.base64.DEFAULT_ALPHABET_COMMON_+"+/=",goog.crypt.base64.ENCODED_VALS_WEBSAFE=goog.crypt.base64.DEFAULT_ALPHABET_COMMON_+"-_.",goog.crypt.base64.Alphabet={DEFAULT:0,NO_PADDING:1,WEBSAFE:2,WEBSAFE_DOT_PADDING:3,WEBSAFE_NO_PADDING:4},goog.crypt.base64.paddingChars_="=.",goog.crypt.base64.isPadding_=function(e){return goog.string.contains(goog.crypt.base64.paddingChars_,e)},goog.crypt.base64.byteToCharMaps_={},goog.crypt.base64.charToByteMap_=null,goog.crypt.base64.ASSUME_NATIVE_SUPPORT_=goog.userAgent.GECKO||goog.userAgent.WEBKIT&&!goog.userAgent.product.SAFARI||goog.userAgent.OPERA,goog.crypt.base64.HAS_NATIVE_ENCODE_=goog.crypt.base64.ASSUME_NATIVE_SUPPORT_||"function"==typeof goog.global.btoa,goog.crypt.base64.HAS_NATIVE_DECODE_=goog.crypt.base64.ASSUME_NATIVE_SUPPORT_||!goog.userAgent.product.SAFARI&&!goog.userAgent.IE&&"function"==typeof goog.global.atob,goog.crypt.base64.encodeByteArray=function(e,t){goog.asserts.assert(goog.isArrayLike(e),"encodeByteArray takes an array as a parameter"),void 0===t&&(t=goog.crypt.base64.Alphabet.DEFAULT),goog.crypt.base64.init_(),t=goog.crypt.base64.byteToCharMaps_[t];for(var r=[],o=0;o>2;i=(3&i)<<4|n>>4,n=(15&n)<<2|p>>6,p&=63,s||(p=64,a||(n=64)),r.push(t[d],t[i],t[n]||"",t[p]||"")}return r.join("")},goog.crypt.base64.encodeString=function(e,t){return goog.crypt.base64.HAS_NATIVE_ENCODE_&&!t?goog.global.btoa(e):goog.crypt.base64.encodeByteArray(goog.crypt.stringToByteArray(e),t)},goog.crypt.base64.decodeString=function(e,t){if(goog.crypt.base64.HAS_NATIVE_DECODE_&&!t)return goog.global.atob(e);var r="";return goog.crypt.base64.decodeStringInternal_(e,(function(e){r+=String.fromCharCode(e)})),r},goog.crypt.base64.decodeStringToByteArray=function(e,t){var r=[];return goog.crypt.base64.decodeStringInternal_(e,(function(e){r.push(e)})),r},goog.crypt.base64.decodeStringToUint8Array=function(e){goog.asserts.assert(!goog.userAgent.IE||goog.userAgent.isVersionOrHigher("10"),"Browser does not support typed arrays");var t=e.length,r=3*t/4;r%3?r=Math.floor(r):goog.crypt.base64.isPadding_(e[t-1])&&(r=goog.crypt.base64.isPadding_(e[t-2])?r-2:r-1);var o=new Uint8Array(r),i=0;return goog.crypt.base64.decodeStringInternal_(e,(function(e){o[i++]=e})),o.subarray(0,i)},goog.crypt.base64.decodeStringInternal_=function(e,t){function r(t){for(;o>4),64!=n&&(t(a<<4&240|n>>2),64!=s&&t(n<<6&192|s))}},goog.crypt.base64.init_=function(){if(!goog.crypt.base64.charToByteMap_){goog.crypt.base64.charToByteMap_={};for(var e=goog.crypt.base64.DEFAULT_ALPHABET_COMMON_.split(""),t=["+/=","+/","-_=","-_.","-_"],r=0;5>r;r++){var o=e.concat(t[r].split(""));goog.crypt.base64.byteToCharMaps_[r]=o;for(var i=0;i>>0;e=Math.floor((e-t)/jspb.BinaryConstants.TWO_TO_32)>>>0,jspb.utils.split64Low=t,jspb.utils.split64High=e},jspb.utils.splitInt64=function(e){var t=0>e,r=(e=Math.abs(e))>>>0;e=Math.floor((e-r)/jspb.BinaryConstants.TWO_TO_32),e>>>=0,t&&(e=~e>>>0,4294967295<(r=1+(~r>>>0))&&(r=0,4294967295<++e&&(e=0))),jspb.utils.split64Low=r,jspb.utils.split64High=e},jspb.utils.splitZigzag64=function(e){var t=0>e;e=2*Math.abs(e),jspb.utils.splitUint64(e),e=jspb.utils.split64Low;var r=jspb.utils.split64High;t&&(0==e?0==r?r=e=4294967295:(r--,e=4294967295):e--),jspb.utils.split64Low=e,jspb.utils.split64High=r},jspb.utils.splitFloat32=function(e){var t=0>e?1:0;if(0===(e=t?-e:e))0<1/e?(jspb.utils.split64High=0,jspb.utils.split64Low=0):(jspb.utils.split64High=0,jspb.utils.split64Low=2147483648);else if(isNaN(e))jspb.utils.split64High=0,jspb.utils.split64Low=2147483647;else if(e>jspb.BinaryConstants.FLOAT32_MAX)jspb.utils.split64High=0,jspb.utils.split64Low=(t<<31|2139095040)>>>0;else if(e>>0;else{var r=Math.floor(Math.log(e)/Math.LN2);e*=Math.pow(2,-r),16777216<=(e=Math.round(e*jspb.BinaryConstants.TWO_TO_23))&&++r,jspb.utils.split64High=0,jspb.utils.split64Low=(t<<31|r+127<<23|8388607&e)>>>0}},jspb.utils.splitFloat64=function(e){var t=0>e?1:0;if(0===(e=t?-e:e))jspb.utils.split64High=0<1/e?0:2147483648,jspb.utils.split64Low=0;else if(isNaN(e))jspb.utils.split64High=2147483647,jspb.utils.split64Low=4294967295;else if(e>jspb.BinaryConstants.FLOAT64_MAX)jspb.utils.split64High=(t<<31|2146435072)>>>0,jspb.utils.split64Low=0;else if(e>>0,jspb.utils.split64Low=r>>>0}else{var o=0;if(2<=(r=e))for(;2<=r&&1023>o;)o++,r/=2;else for(;1>r&&-1022>>0,jspb.utils.split64High=(t<<31|o+1023<<20|e)>>>0,jspb.utils.split64Low=r}},jspb.utils.splitHash64=function(e){var t=e.charCodeAt(0),r=e.charCodeAt(1),o=e.charCodeAt(2),i=e.charCodeAt(3),a=e.charCodeAt(4),n=e.charCodeAt(5),s=e.charCodeAt(6);e=e.charCodeAt(7),jspb.utils.split64Low=t+(r<<8)+(o<<16)+(i<<24)>>>0,jspb.utils.split64High=a+(n<<8)+(s<<16)+(e<<24)>>>0},jspb.utils.joinUint64=function(e,t){return t*jspb.BinaryConstants.TWO_TO_32+(e>>>0)},jspb.utils.joinInt64=function(e,t){var r=2147483648&t;return r&&(t=~t>>>0,0==(e=1+~e>>>0)&&(t=t+1>>>0)),e=jspb.utils.joinUint64(e,t),r?-e:e},jspb.utils.toZigzag64=function(e,t,r){var o=t>>31;return r(e<<1^o,(t<<1|e>>>31)^o)},jspb.utils.joinZigzag64=function(e,t){return jspb.utils.fromZigzag64(e,t,jspb.utils.joinInt64)},jspb.utils.fromZigzag64=function(e,t,r){var o=-(1&e);return r((e>>>1|t<<31)^o,t>>>1^o)},jspb.utils.joinFloat32=function(e,t){t=2*(e>>31)+1;var r=e>>>23&255;return e&=8388607,255==r?e?NaN:1/0*t:0==r?t*Math.pow(2,-149)*e:t*Math.pow(2,r-150)*(e+Math.pow(2,23))},jspb.utils.joinFloat64=function(e,t){var r=2*(t>>31)+1,o=t>>>20&2047;return e=jspb.BinaryConstants.TWO_TO_32*(1048575&t)+e,2047==o?e?NaN:1/0*r:0==o?r*Math.pow(2,-1074)*e:r*Math.pow(2,o-1075)*(e+jspb.BinaryConstants.TWO_TO_52)},jspb.utils.joinHash64=function(e,t){return String.fromCharCode(e>>>0&255,e>>>8&255,e>>>16&255,e>>>24&255,t>>>0&255,t>>>8&255,t>>>16&255,t>>>24&255)},jspb.utils.DIGITS="0123456789abcdef".split(""),jspb.utils.ZERO_CHAR_CODE_=48,jspb.utils.A_CHAR_CODE_=97,jspb.utils.joinUnsignedDecimalString=function(e,t){function r(e,t){return e=e?String(e):"",t?"0000000".slice(e.length)+e:e}if(2097151>=t)return""+jspb.utils.joinUint64(e,t);var o=(e>>>24|t<<8)>>>0&16777215;return e=(16777215&e)+6777216*o+6710656*(t=t>>16&65535),o+=8147497*t,t*=2,1e7<=e&&(o+=Math.floor(e/1e7),e%=1e7),1e7<=o&&(t+=Math.floor(o/1e7),o%=1e7),r(t,0)+r(o,t)+r(e,1)},jspb.utils.joinSignedDecimalString=function(e,t){var r=2147483648&t;return r&&(t=~t+(0==(e=1+~e>>>0)?1:0)>>>0),e=jspb.utils.joinUnsignedDecimalString(e,t),r?"-"+e:e},jspb.utils.hash64ToDecimalString=function(e,t){jspb.utils.splitHash64(e),e=jspb.utils.split64Low;var r=jspb.utils.split64High;return t?jspb.utils.joinSignedDecimalString(e,r):jspb.utils.joinUnsignedDecimalString(e,r)},jspb.utils.hash64ArrayToDecimalStrings=function(e,t){for(var r=Array(e.length),o=0;or&&(1!==e||0>>=8}jspb.asserts.assert(0e;e++)o[e]=255&~o[e]}(),t(1,1)),goog.crypt.byteArrayToString(o)},jspb.utils.splitDecimalString=function(e){jspb.utils.splitHash64(jspb.utils.decimalStringToHash64(e))},jspb.utils.toHexDigit_=function(e){return String.fromCharCode(10>e?jspb.utils.ZERO_CHAR_CODE_+e:jspb.utils.A_CHAR_CODE_-10+e)},jspb.utils.fromHexCharCode_=function(e){return e>=jspb.utils.A_CHAR_CODE_?e-jspb.utils.A_CHAR_CODE_+10:e-jspb.utils.ZERO_CHAR_CODE_},jspb.utils.hash64ToHexString=function(e){var t=Array(18);t[0]="0",t[1]="x";for(var r=0;8>r;r++){var o=e.charCodeAt(7-r);t[2*r+2]=jspb.utils.toHexDigit_(o>>4),t[2*r+3]=jspb.utils.toHexDigit_(15&o)}return t.join("")},jspb.utils.hexStringToHash64=function(e){e=e.toLowerCase(),jspb.asserts.assert(18==e.length),jspb.asserts.assert("0"==e[0]),jspb.asserts.assert("x"==e[1]);for(var t="",r=0;8>r;r++){var o=jspb.utils.fromHexCharCode_(e.charCodeAt(2*r+2)),i=jspb.utils.fromHexCharCode_(e.charCodeAt(2*r+3));t=String.fromCharCode(16*o+i)+t}return t},jspb.utils.hash64ToNumber=function(e,t){jspb.utils.splitHash64(e),e=jspb.utils.split64Low;var r=jspb.utils.split64High;return t?jspb.utils.joinInt64(e,r):jspb.utils.joinUint64(e,r)},jspb.utils.numberToHash64=function(e){return jspb.utils.splitInt64(e),jspb.utils.joinHash64(jspb.utils.split64Low,jspb.utils.split64High)},jspb.utils.countVarints=function(e,t,r){for(var o=0,i=t;i>7;return r-t-o},jspb.utils.countVarintFields=function(e,t,r,o){var i=0;if(128>(o=8*o+jspb.BinaryConstants.WireType.VARINT))for(;t>=7}if(e[t++]!=a)break;for(i++;0!=(128&(a=e[t++])););}return i},jspb.utils.countFixedFields_=function(e,t,r,o,i){var a=0;if(128>o)for(;t>=7}if(e[t++]!=n)break;a++,t+=i}return a},jspb.utils.countFixed32Fields=function(e,t,r,o){return jspb.utils.countFixedFields_(e,t,r,8*o+jspb.BinaryConstants.WireType.FIXED32,4)},jspb.utils.countFixed64Fields=function(e,t,r,o){return jspb.utils.countFixedFields_(e,t,r,8*o+jspb.BinaryConstants.WireType.FIXED64,8)},jspb.utils.countDelimitedFields=function(e,t,r,o){var i=0;for(o=8*o+jspb.BinaryConstants.WireType.DELIMITED;t>=7}if(e[t++]!=a)break;i++;for(var n=0,s=1;n+=(127&(a=e[t++]))*s,s*=128,0!=(128&a););t+=n}return i},jspb.utils.debugBytesToTextFormat=function(e){var t='"';if(e){e=jspb.utils.byteSourceToUint8Array(e);for(var r=0;re[r]&&(t+="0"),t+=e[r].toString(16)}return t+'"'},jspb.utils.debugScalarToTextFormat=function(e){return"string"==typeof e?goog.string.quote(e):e.toString()},jspb.utils.stringToByteArray=function(e){for(var t=new Uint8Array(e.length),r=0;rjspb.BinaryDecoder.instanceCache_.length&&jspb.BinaryDecoder.instanceCache_.push(this)},jspb.BinaryDecoder.prototype.clone=function(){return jspb.BinaryDecoder.alloc(this.bytes_,this.start_,this.end_-this.start_)},jspb.BinaryDecoder.prototype.clear=function(){this.bytes_=null,this.cursor_=this.end_=this.start_=0,this.error_=!1},jspb.BinaryDecoder.prototype.getBuffer=function(){return this.bytes_},jspb.BinaryDecoder.prototype.setBlock=function(e,t,r){this.bytes_=jspb.utils.byteSourceToUint8Array(e),this.start_=void 0!==t?t:0,this.end_=void 0!==r?this.start_+r:this.bytes_.length,this.cursor_=this.start_},jspb.BinaryDecoder.prototype.getEnd=function(){return this.end_},jspb.BinaryDecoder.prototype.setEnd=function(e){this.end_=e},jspb.BinaryDecoder.prototype.reset=function(){this.cursor_=this.start_},jspb.BinaryDecoder.prototype.getCursor=function(){return this.cursor_},jspb.BinaryDecoder.prototype.setCursor=function(e){this.cursor_=e},jspb.BinaryDecoder.prototype.advance=function(e){this.cursor_+=e,jspb.asserts.assert(this.cursor_<=this.end_)},jspb.BinaryDecoder.prototype.atEnd=function(){return this.cursor_==this.end_},jspb.BinaryDecoder.prototype.pastEnd=function(){return this.cursor_>this.end_},jspb.BinaryDecoder.prototype.getError=function(){return this.error_||0>this.cursor_||this.cursor_>this.end_},jspb.BinaryDecoder.prototype.readSplitVarint64=function(e){for(var t=128,r=0,o=0,i=0;4>i&&128<=t;i++)r|=(127&(t=this.bytes_[this.cursor_++]))<<7*i;if(128<=t&&(r|=(127&(t=this.bytes_[this.cursor_++]))<<28,o|=(127&t)>>4),128<=t)for(i=0;5>i&&128<=t;i++)o|=(127&(t=this.bytes_[this.cursor_++]))<<7*i+3;if(128>t)return e(r>>>0,o>>>0);jspb.asserts.fail("Failed to read varint, encoding is invalid."),this.error_=!0},jspb.BinaryDecoder.prototype.readSplitZigzagVarint64=function(e){return this.readSplitVarint64((function(t,r){return jspb.utils.fromZigzag64(t,r,e)}))},jspb.BinaryDecoder.prototype.readSplitFixed64=function(e){var t=this.bytes_,r=this.cursor_;this.cursor_+=8;for(var o=0,i=0,a=r+7;a>=r;a--)o=o<<8|t[a],i=i<<8|t[a+4];return e(o,i)},jspb.BinaryDecoder.prototype.skipVarint=function(){for(;128&this.bytes_[this.cursor_];)this.cursor_++;this.cursor_++},jspb.BinaryDecoder.prototype.unskipVarint=function(e){for(;128>>=7;this.cursor_--},jspb.BinaryDecoder.prototype.readUnsignedVarint32=function(){var e=this.bytes_,t=e[this.cursor_+0],r=127&t;return 128>t?(this.cursor_+=1,jspb.asserts.assert(this.cursor_<=this.end_),r):(r|=(127&(t=e[this.cursor_+1]))<<7,128>t?(this.cursor_+=2,jspb.asserts.assert(this.cursor_<=this.end_),r):(r|=(127&(t=e[this.cursor_+2]))<<14,128>t?(this.cursor_+=3,jspb.asserts.assert(this.cursor_<=this.end_),r):(r|=(127&(t=e[this.cursor_+3]))<<21,128>t?(this.cursor_+=4,jspb.asserts.assert(this.cursor_<=this.end_),r):(r|=(15&(t=e[this.cursor_+4]))<<28,128>t?(this.cursor_+=5,jspb.asserts.assert(this.cursor_<=this.end_),r>>>0):(this.cursor_+=5,128<=e[this.cursor_++]&&128<=e[this.cursor_++]&&128<=e[this.cursor_++]&&128<=e[this.cursor_++]&&128<=e[this.cursor_++]&&jspb.asserts.assert(!1),jspb.asserts.assert(this.cursor_<=this.end_),r)))))},jspb.BinaryDecoder.prototype.readSignedVarint32=function(){return~~this.readUnsignedVarint32()},jspb.BinaryDecoder.prototype.readUnsignedVarint32String=function(){return this.readUnsignedVarint32().toString()},jspb.BinaryDecoder.prototype.readSignedVarint32String=function(){return this.readSignedVarint32().toString()},jspb.BinaryDecoder.prototype.readZigzagVarint32=function(){var e=this.readUnsignedVarint32();return e>>>1^-(1&e)},jspb.BinaryDecoder.prototype.readUnsignedVarint64=function(){return this.readSplitVarint64(jspb.utils.joinUint64)},jspb.BinaryDecoder.prototype.readUnsignedVarint64String=function(){return this.readSplitVarint64(jspb.utils.joinUnsignedDecimalString)},jspb.BinaryDecoder.prototype.readSignedVarint64=function(){return this.readSplitVarint64(jspb.utils.joinInt64)},jspb.BinaryDecoder.prototype.readSignedVarint64String=function(){return this.readSplitVarint64(jspb.utils.joinSignedDecimalString)},jspb.BinaryDecoder.prototype.readZigzagVarint64=function(){return this.readSplitVarint64(jspb.utils.joinZigzag64)},jspb.BinaryDecoder.prototype.readZigzagVarintHash64=function(){return this.readSplitZigzagVarint64(jspb.utils.joinHash64)},jspb.BinaryDecoder.prototype.readZigzagVarint64String=function(){return this.readSplitZigzagVarint64(jspb.utils.joinSignedDecimalString)},jspb.BinaryDecoder.prototype.readUint8=function(){var e=this.bytes_[this.cursor_+0];return this.cursor_+=1,jspb.asserts.assert(this.cursor_<=this.end_),e},jspb.BinaryDecoder.prototype.readUint16=function(){var e=this.bytes_[this.cursor_+0],t=this.bytes_[this.cursor_+1];return this.cursor_+=2,jspb.asserts.assert(this.cursor_<=this.end_),e<<0|t<<8},jspb.BinaryDecoder.prototype.readUint32=function(){var e=this.bytes_[this.cursor_+0],t=this.bytes_[this.cursor_+1],r=this.bytes_[this.cursor_+2],o=this.bytes_[this.cursor_+3];return this.cursor_+=4,jspb.asserts.assert(this.cursor_<=this.end_),(e<<0|t<<8|r<<16|o<<24)>>>0},jspb.BinaryDecoder.prototype.readUint64=function(){var e=this.readUint32(),t=this.readUint32();return jspb.utils.joinUint64(e,t)},jspb.BinaryDecoder.prototype.readUint64String=function(){var e=this.readUint32(),t=this.readUint32();return jspb.utils.joinUnsignedDecimalString(e,t)},jspb.BinaryDecoder.prototype.readInt8=function(){var e=this.bytes_[this.cursor_+0];return this.cursor_+=1,jspb.asserts.assert(this.cursor_<=this.end_),e<<24>>24},jspb.BinaryDecoder.prototype.readInt16=function(){var e=this.bytes_[this.cursor_+0],t=this.bytes_[this.cursor_+1];return this.cursor_+=2,jspb.asserts.assert(this.cursor_<=this.end_),(e<<0|t<<8)<<16>>16},jspb.BinaryDecoder.prototype.readInt32=function(){var e=this.bytes_[this.cursor_+0],t=this.bytes_[this.cursor_+1],r=this.bytes_[this.cursor_+2],o=this.bytes_[this.cursor_+3];return this.cursor_+=4,jspb.asserts.assert(this.cursor_<=this.end_),e<<0|t<<8|r<<16|o<<24},jspb.BinaryDecoder.prototype.readInt64=function(){var e=this.readUint32(),t=this.readUint32();return jspb.utils.joinInt64(e,t)},jspb.BinaryDecoder.prototype.readInt64String=function(){var e=this.readUint32(),t=this.readUint32();return jspb.utils.joinSignedDecimalString(e,t)},jspb.BinaryDecoder.prototype.readFloat=function(){var e=this.readUint32();return jspb.utils.joinFloat32(e,0)},jspb.BinaryDecoder.prototype.readDouble=function(){var e=this.readUint32(),t=this.readUint32();return jspb.utils.joinFloat64(e,t)},jspb.BinaryDecoder.prototype.readBool=function(){return!!this.bytes_[this.cursor_++]},jspb.BinaryDecoder.prototype.readEnum=function(){return this.readSignedVarint32()},jspb.BinaryDecoder.prototype.readString=function(e){var t=this.bytes_,r=this.cursor_;e=r+e;for(var o=[],i="";ra)o.push(a);else{if(192>a)continue;if(224>a){var n=t[r++];o.push((31&a)<<6|63&n)}else if(240>a){n=t[r++];var s=t[r++];o.push((15&a)<<12|(63&n)<<6|63&s)}else if(248>a){a=(7&a)<<18|(63&(n=t[r++]))<<12|(63&(s=t[r++]))<<6|63&t[r++],a-=65536,o.push(55296+(a>>10&1023),56320+(1023&a))}}8192<=o.length&&(i+=String.fromCharCode.apply(null,o),o.length=0)}return i+=goog.crypt.byteArrayToString(o),this.cursor_=r,i},jspb.BinaryDecoder.prototype.readStringWithLength=function(){var e=this.readUnsignedVarint32();return this.readString(e)},jspb.BinaryDecoder.prototype.readBytes=function(e){if(0>e||this.cursor_+e>this.bytes_.length)return this.error_=!0,jspb.asserts.fail("Invalid byte length!"),new Uint8Array(0);var t=this.bytes_.subarray(this.cursor_,this.cursor_+e);return this.cursor_+=e,jspb.asserts.assert(this.cursor_<=this.end_),t},jspb.BinaryDecoder.prototype.readVarintHash64=function(){return this.readSplitVarint64(jspb.utils.joinHash64)},jspb.BinaryDecoder.prototype.readFixedHash64=function(){var e=this.bytes_,t=this.cursor_,r=e[t+0],o=e[t+1],i=e[t+2],a=e[t+3],n=e[t+4],s=e[t+5],p=e[t+6];return e=e[t+7],this.cursor_+=8,String.fromCharCode(r,o,i,a,n,s,p,e)},jspb.BinaryReader=function(e,t,r){this.decoder_=jspb.BinaryDecoder.alloc(e,t,r),this.fieldCursor_=this.decoder_.getCursor(),this.nextField_=jspb.BinaryConstants.INVALID_FIELD_NUMBER,this.nextWireType_=jspb.BinaryConstants.WireType.INVALID,this.error_=!1,this.readCallbacks_=null},jspb.BinaryReader.instanceCache_=[],jspb.BinaryReader.alloc=function(e,t,r){if(jspb.BinaryReader.instanceCache_.length){var o=jspb.BinaryReader.instanceCache_.pop();return e&&o.decoder_.setBlock(e,t,r),o}return new jspb.BinaryReader(e,t,r)},jspb.BinaryReader.prototype.alloc=jspb.BinaryReader.alloc,jspb.BinaryReader.prototype.free=function(){this.decoder_.clear(),this.nextField_=jspb.BinaryConstants.INVALID_FIELD_NUMBER,this.nextWireType_=jspb.BinaryConstants.WireType.INVALID,this.error_=!1,this.readCallbacks_=null,100>jspb.BinaryReader.instanceCache_.length&&jspb.BinaryReader.instanceCache_.push(this)},jspb.BinaryReader.prototype.getFieldCursor=function(){return this.fieldCursor_},jspb.BinaryReader.prototype.getCursor=function(){return this.decoder_.getCursor()},jspb.BinaryReader.prototype.getBuffer=function(){return this.decoder_.getBuffer()},jspb.BinaryReader.prototype.getFieldNumber=function(){return this.nextField_},goog.exportProperty(jspb.BinaryReader.prototype,"getFieldNumber",jspb.BinaryReader.prototype.getFieldNumber),jspb.BinaryReader.prototype.getWireType=function(){return this.nextWireType_},jspb.BinaryReader.prototype.isDelimited=function(){return this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED},goog.exportProperty(jspb.BinaryReader.prototype,"isDelimited",jspb.BinaryReader.prototype.isDelimited),jspb.BinaryReader.prototype.isEndGroup=function(){return this.nextWireType_==jspb.BinaryConstants.WireType.END_GROUP},goog.exportProperty(jspb.BinaryReader.prototype,"isEndGroup",jspb.BinaryReader.prototype.isEndGroup),jspb.BinaryReader.prototype.getError=function(){return this.error_||this.decoder_.getError()},jspb.BinaryReader.prototype.setBlock=function(e,t,r){this.decoder_.setBlock(e,t,r),this.nextField_=jspb.BinaryConstants.INVALID_FIELD_NUMBER,this.nextWireType_=jspb.BinaryConstants.WireType.INVALID},jspb.BinaryReader.prototype.reset=function(){this.decoder_.reset(),this.nextField_=jspb.BinaryConstants.INVALID_FIELD_NUMBER,this.nextWireType_=jspb.BinaryConstants.WireType.INVALID},jspb.BinaryReader.prototype.advance=function(e){this.decoder_.advance(e)},jspb.BinaryReader.prototype.nextField=function(){if(this.decoder_.atEnd())return!1;if(this.getError())return jspb.asserts.fail("Decoder hit an error"),!1;this.fieldCursor_=this.decoder_.getCursor();var e=this.decoder_.readUnsignedVarint32(),t=e>>>3;return(e&=7)!=jspb.BinaryConstants.WireType.VARINT&&e!=jspb.BinaryConstants.WireType.FIXED32&&e!=jspb.BinaryConstants.WireType.FIXED64&&e!=jspb.BinaryConstants.WireType.DELIMITED&&e!=jspb.BinaryConstants.WireType.START_GROUP&&e!=jspb.BinaryConstants.WireType.END_GROUP?(jspb.asserts.fail("Invalid wire type: %s (at position %s)",e,this.fieldCursor_),this.error_=!0,!1):(this.nextField_=t,this.nextWireType_=e,!0)},goog.exportProperty(jspb.BinaryReader.prototype,"nextField",jspb.BinaryReader.prototype.nextField),jspb.BinaryReader.prototype.unskipHeader=function(){this.decoder_.unskipVarint(this.nextField_<<3|this.nextWireType_)},jspb.BinaryReader.prototype.skipMatchingFields=function(){var e=this.nextField_;for(this.unskipHeader();this.nextField()&&this.getFieldNumber()==e;)this.skipField();this.decoder_.atEnd()||this.unskipHeader()},jspb.BinaryReader.prototype.skipVarintField=function(){this.nextWireType_!=jspb.BinaryConstants.WireType.VARINT?(jspb.asserts.fail("Invalid wire type for skipVarintField"),this.skipField()):this.decoder_.skipVarint()},jspb.BinaryReader.prototype.skipDelimitedField=function(){if(this.nextWireType_!=jspb.BinaryConstants.WireType.DELIMITED)jspb.asserts.fail("Invalid wire type for skipDelimitedField"),this.skipField();else{var e=this.decoder_.readUnsignedVarint32();this.decoder_.advance(e)}},jspb.BinaryReader.prototype.skipFixed32Field=function(){this.nextWireType_!=jspb.BinaryConstants.WireType.FIXED32?(jspb.asserts.fail("Invalid wire type for skipFixed32Field"),this.skipField()):this.decoder_.advance(4)},jspb.BinaryReader.prototype.skipFixed64Field=function(){this.nextWireType_!=jspb.BinaryConstants.WireType.FIXED64?(jspb.asserts.fail("Invalid wire type for skipFixed64Field"),this.skipField()):this.decoder_.advance(8)},jspb.BinaryReader.prototype.skipGroup=function(){for(var e=this.nextField_;;){if(!this.nextField()){jspb.asserts.fail("Unmatched start-group tag: stream EOF"),this.error_=!0;break}if(this.nextWireType_==jspb.BinaryConstants.WireType.END_GROUP){this.nextField_!=e&&(jspb.asserts.fail("Unmatched end-group tag"),this.error_=!0);break}this.skipField()}},jspb.BinaryReader.prototype.skipField=function(){switch(this.nextWireType_){case jspb.BinaryConstants.WireType.VARINT:this.skipVarintField();break;case jspb.BinaryConstants.WireType.FIXED64:this.skipFixed64Field();break;case jspb.BinaryConstants.WireType.DELIMITED:this.skipDelimitedField();break;case jspb.BinaryConstants.WireType.FIXED32:this.skipFixed32Field();break;case jspb.BinaryConstants.WireType.START_GROUP:this.skipGroup();break;default:jspb.asserts.fail("Invalid wire encoding for field.")}},jspb.BinaryReader.prototype.registerReadCallback=function(e,t){null===this.readCallbacks_&&(this.readCallbacks_={}),jspb.asserts.assert(!this.readCallbacks_[e]),this.readCallbacks_[e]=t},jspb.BinaryReader.prototype.runReadCallback=function(e){return jspb.asserts.assert(null!==this.readCallbacks_),e=this.readCallbacks_[e],jspb.asserts.assert(e),e(this)},jspb.BinaryReader.prototype.readAny=function(e){this.nextWireType_=jspb.BinaryConstants.FieldTypeToWireType(e);var t=jspb.BinaryConstants.FieldType;switch(e){case t.DOUBLE:return this.readDouble();case t.FLOAT:return this.readFloat();case t.INT64:return this.readInt64();case t.UINT64:return this.readUint64();case t.INT32:return this.readInt32();case t.FIXED64:return this.readFixed64();case t.FIXED32:return this.readFixed32();case t.BOOL:return this.readBool();case t.STRING:return this.readString();case t.GROUP:jspb.asserts.fail("Group field type not supported in readAny()");case t.MESSAGE:jspb.asserts.fail("Message field type not supported in readAny()");case t.BYTES:return this.readBytes();case t.UINT32:return this.readUint32();case t.ENUM:return this.readEnum();case t.SFIXED32:return this.readSfixed32();case t.SFIXED64:return this.readSfixed64();case t.SINT32:return this.readSint32();case t.SINT64:return this.readSint64();case t.FHASH64:return this.readFixedHash64();case t.VHASH64:return this.readVarintHash64();default:jspb.asserts.fail("Invalid field type in readAny()")}return 0},jspb.BinaryReader.prototype.readMessage=function(e,t){jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var r=this.decoder_.getEnd(),o=this.decoder_.readUnsignedVarint32();o=this.decoder_.getCursor()+o,this.decoder_.setEnd(o),t(e,this),this.decoder_.setCursor(o),this.decoder_.setEnd(r)},goog.exportProperty(jspb.BinaryReader.prototype,"readMessage",jspb.BinaryReader.prototype.readMessage),jspb.BinaryReader.prototype.readGroup=function(e,t,r){jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.START_GROUP),jspb.asserts.assert(this.nextField_==e),r(t,this),this.error_||this.nextWireType_==jspb.BinaryConstants.WireType.END_GROUP||(jspb.asserts.fail("Group submessage did not end with an END_GROUP tag"),this.error_=!0)},goog.exportProperty(jspb.BinaryReader.prototype,"readGroup",jspb.BinaryReader.prototype.readGroup),jspb.BinaryReader.prototype.getFieldDecoder=function(){jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var e=this.decoder_.readUnsignedVarint32(),t=this.decoder_.getCursor(),r=t+e;return e=jspb.BinaryDecoder.alloc(this.decoder_.getBuffer(),t,e),this.decoder_.setCursor(r),e},jspb.BinaryReader.prototype.readInt32=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint32()},goog.exportProperty(jspb.BinaryReader.prototype,"readInt32",jspb.BinaryReader.prototype.readInt32),jspb.BinaryReader.prototype.readInt32String=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint32String()},jspb.BinaryReader.prototype.readInt64=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint64()},goog.exportProperty(jspb.BinaryReader.prototype,"readInt64",jspb.BinaryReader.prototype.readInt64),jspb.BinaryReader.prototype.readInt64String=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint64String()},jspb.BinaryReader.prototype.readUint32=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readUnsignedVarint32()},goog.exportProperty(jspb.BinaryReader.prototype,"readUint32",jspb.BinaryReader.prototype.readUint32),jspb.BinaryReader.prototype.readUint32String=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readUnsignedVarint32String()},jspb.BinaryReader.prototype.readUint64=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readUnsignedVarint64()},goog.exportProperty(jspb.BinaryReader.prototype,"readUint64",jspb.BinaryReader.prototype.readUint64),jspb.BinaryReader.prototype.readUint64String=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readUnsignedVarint64String()},jspb.BinaryReader.prototype.readSint32=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readZigzagVarint32()},goog.exportProperty(jspb.BinaryReader.prototype,"readSint32",jspb.BinaryReader.prototype.readSint32),jspb.BinaryReader.prototype.readSint64=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readZigzagVarint64()},goog.exportProperty(jspb.BinaryReader.prototype,"readSint64",jspb.BinaryReader.prototype.readSint64),jspb.BinaryReader.prototype.readSint64String=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readZigzagVarint64String()},jspb.BinaryReader.prototype.readFixed32=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED32),this.decoder_.readUint32()},goog.exportProperty(jspb.BinaryReader.prototype,"readFixed32",jspb.BinaryReader.prototype.readFixed32),jspb.BinaryReader.prototype.readFixed64=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readUint64()},goog.exportProperty(jspb.BinaryReader.prototype,"readFixed64",jspb.BinaryReader.prototype.readFixed64),jspb.BinaryReader.prototype.readFixed64String=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readUint64String()},jspb.BinaryReader.prototype.readSfixed32=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED32),this.decoder_.readInt32()},goog.exportProperty(jspb.BinaryReader.prototype,"readSfixed32",jspb.BinaryReader.prototype.readSfixed32),jspb.BinaryReader.prototype.readSfixed32String=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED32),this.decoder_.readInt32().toString()},jspb.BinaryReader.prototype.readSfixed64=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readInt64()},goog.exportProperty(jspb.BinaryReader.prototype,"readSfixed64",jspb.BinaryReader.prototype.readSfixed64),jspb.BinaryReader.prototype.readSfixed64String=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readInt64String()},jspb.BinaryReader.prototype.readFloat=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED32),this.decoder_.readFloat()},goog.exportProperty(jspb.BinaryReader.prototype,"readFloat",jspb.BinaryReader.prototype.readFloat),jspb.BinaryReader.prototype.readDouble=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readDouble()},goog.exportProperty(jspb.BinaryReader.prototype,"readDouble",jspb.BinaryReader.prototype.readDouble),jspb.BinaryReader.prototype.readBool=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),!!this.decoder_.readUnsignedVarint32()},goog.exportProperty(jspb.BinaryReader.prototype,"readBool",jspb.BinaryReader.prototype.readBool),jspb.BinaryReader.prototype.readEnum=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint64()},goog.exportProperty(jspb.BinaryReader.prototype,"readEnum",jspb.BinaryReader.prototype.readEnum),jspb.BinaryReader.prototype.readString=function(){jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var e=this.decoder_.readUnsignedVarint32();return this.decoder_.readString(e)},goog.exportProperty(jspb.BinaryReader.prototype,"readString",jspb.BinaryReader.prototype.readString),jspb.BinaryReader.prototype.readBytes=function(){jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var e=this.decoder_.readUnsignedVarint32();return this.decoder_.readBytes(e)},goog.exportProperty(jspb.BinaryReader.prototype,"readBytes",jspb.BinaryReader.prototype.readBytes),jspb.BinaryReader.prototype.readVarintHash64=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readVarintHash64()},jspb.BinaryReader.prototype.readSintHash64=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readZigzagVarintHash64()},jspb.BinaryReader.prototype.readSplitVarint64=function(e){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSplitVarint64(e)},jspb.BinaryReader.prototype.readSplitZigzagVarint64=function(e){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSplitVarint64((function(t,r){return jspb.utils.fromZigzag64(t,r,e)}))},jspb.BinaryReader.prototype.readFixedHash64=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readFixedHash64()},jspb.BinaryReader.prototype.readSplitFixed64=function(e){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readSplitFixed64(e)},jspb.BinaryReader.prototype.readPackedField_=function(e){jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var t=this.decoder_.readUnsignedVarint32();t=this.decoder_.getCursor()+t;for(var r=[];this.decoder_.getCursor()>>7|t<<25)>>>0,t>>>=7;this.buffer_.push(e)},jspb.BinaryEncoder.prototype.writeSplitFixed64=function(e,t){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(t==Math.floor(t)),jspb.asserts.assert(0<=e&&e>>=7;this.buffer_.push(e)},jspb.BinaryEncoder.prototype.writeSignedVarint32=function(e){if(jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_31&&et;t++)this.buffer_.push(127&e|128),e>>=7;this.buffer_.push(1)}},jspb.BinaryEncoder.prototype.writeUnsignedVarint64=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(0<=e&&e=-jspb.BinaryConstants.TWO_TO_63&&e=-jspb.BinaryConstants.TWO_TO_31&&e>31)>>>0)},jspb.BinaryEncoder.prototype.writeZigzagVarint64=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_63&&e>>0,r>>>0)}))},jspb.BinaryEncoder.prototype.writeUint8=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(0<=e&&256>e),this.buffer_.push(e>>>0&255)},jspb.BinaryEncoder.prototype.writeUint16=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(0<=e&&65536>e),this.buffer_.push(e>>>0&255),this.buffer_.push(e>>>8&255)},jspb.BinaryEncoder.prototype.writeUint32=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(0<=e&&e>>0&255),this.buffer_.push(e>>>8&255),this.buffer_.push(e>>>16&255),this.buffer_.push(e>>>24&255)},jspb.BinaryEncoder.prototype.writeUint64=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(0<=e&&ee),this.buffer_.push(e>>>0&255)},jspb.BinaryEncoder.prototype.writeInt16=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(-32768<=e&&32768>e),this.buffer_.push(e>>>0&255),this.buffer_.push(e>>>8&255)},jspb.BinaryEncoder.prototype.writeInt32=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_31&&e>>0&255),this.buffer_.push(e>>>8&255),this.buffer_.push(e>>>16&255),this.buffer_.push(e>>>24&255)},jspb.BinaryEncoder.prototype.writeInt64=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_63&&e=-jspb.BinaryConstants.TWO_TO_63&&+e=-jspb.BinaryConstants.FLOAT32_MAX&&e<=jspb.BinaryConstants.FLOAT32_MAX),jspb.utils.splitFloat32(e),this.writeUint32(jspb.utils.split64Low)},jspb.BinaryEncoder.prototype.writeDouble=function(e){jspb.asserts.assert(1/0===e||-1/0===e||isNaN(e)||e>=-jspb.BinaryConstants.FLOAT64_MAX&&e<=jspb.BinaryConstants.FLOAT64_MAX),jspb.utils.splitFloat64(e),this.writeUint32(jspb.utils.split64Low),this.writeUint32(jspb.utils.split64High)},jspb.BinaryEncoder.prototype.writeBool=function(e){jspb.asserts.assert("boolean"==typeof e||"number"==typeof e),this.buffer_.push(e?1:0)},jspb.BinaryEncoder.prototype.writeEnum=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_31&&eo)this.buffer_.push(o);else if(2048>o)this.buffer_.push(o>>6|192),this.buffer_.push(63&o|128);else if(65536>o)if(55296<=o&&56319>=o&&r+1=i&&(o=1024*(o-55296)+i-56320+65536,this.buffer_.push(o>>18|240),this.buffer_.push(o>>12&63|128),this.buffer_.push(o>>6&63|128),this.buffer_.push(63&o|128),r++)}else this.buffer_.push(o>>12|224),this.buffer_.push(o>>6&63|128),this.buffer_.push(63&o|128)}return this.buffer_.length-t},jspb.arith={},jspb.arith.UInt64=function(e,t){this.lo=e,this.hi=t},jspb.arith.UInt64.prototype.cmp=function(e){return this.hi>>1|(1&this.hi)<<31)>>>0,this.hi>>>1>>>0)},jspb.arith.UInt64.prototype.leftShift=function(){return new jspb.arith.UInt64(this.lo<<1>>>0,(this.hi<<1|this.lo>>>31)>>>0)},jspb.arith.UInt64.prototype.msb=function(){return!!(2147483648&this.hi)},jspb.arith.UInt64.prototype.lsb=function(){return!!(1&this.lo)},jspb.arith.UInt64.prototype.zero=function(){return 0==this.lo&&0==this.hi},jspb.arith.UInt64.prototype.add=function(e){return new jspb.arith.UInt64((this.lo+e.lo&4294967295)>>>0>>>0,((this.hi+e.hi&4294967295)>>>0)+(4294967296<=this.lo+e.lo?1:0)>>>0)},jspb.arith.UInt64.prototype.sub=function(e){return new jspb.arith.UInt64((this.lo-e.lo&4294967295)>>>0>>>0,((this.hi-e.hi&4294967295)>>>0)-(0>this.lo-e.lo?1:0)>>>0)},jspb.arith.UInt64.mul32x32=function(e,t){var r=65535&e,o=65535&t,i=t>>>16;for(t=r*o+65536*(r*i&65535)+65536*((e>>>=16)*o&65535),r=e*i+(r*i>>>16)+(e*o>>>16);4294967296<=t;)t-=4294967296,r+=1;return new jspb.arith.UInt64(t>>>0,r>>>0)},jspb.arith.UInt64.prototype.mul=function(e){var t=jspb.arith.UInt64.mul32x32(this.lo,e);return(e=jspb.arith.UInt64.mul32x32(this.hi,e)).hi=e.lo,e.lo=0,t.add(e)},jspb.arith.UInt64.prototype.div=function(e){if(0==e)return[];var t=new jspb.arith.UInt64(0,0),r=new jspb.arith.UInt64(this.lo,this.hi);e=new jspb.arith.UInt64(e,0);for(var o=new jspb.arith.UInt64(1,0);!e.msb();)e=e.leftShift(),o=o.leftShift();for(;!o.zero();)0>=e.cmp(r)&&(t=t.add(o),r=r.sub(e)),e=e.rightShift(),o=o.rightShift();return[t,r]},jspb.arith.UInt64.prototype.toString=function(){for(var e="",t=this;!t.zero();){var r=(t=t.div(10))[0];e=t[1].lo+e,t=r}return""==e&&(e="0"),e},jspb.arith.UInt64.fromString=function(e){for(var t=new jspb.arith.UInt64(0,0),r=new jspb.arith.UInt64(0,0),o=0;oe[o]||"9">>0>>>0,((this.hi+e.hi&4294967295)>>>0)+(4294967296<=this.lo+e.lo?1:0)>>>0)},jspb.arith.Int64.prototype.sub=function(e){return new jspb.arith.Int64((this.lo-e.lo&4294967295)>>>0>>>0,((this.hi-e.hi&4294967295)>>>0)-(0>this.lo-e.lo?1:0)>>>0)},jspb.arith.Int64.prototype.clone=function(){return new jspb.arith.Int64(this.lo,this.hi)},jspb.arith.Int64.prototype.toString=function(){var e=0!=(2147483648&this.hi),t=new jspb.arith.UInt64(this.lo,this.hi);return e&&(t=new jspb.arith.UInt64(0,0).sub(t)),(e?"-":"")+t.toString()},jspb.arith.Int64.fromString=function(e){var t=0>>=7,this.totalLength_++;e.push(t),this.totalLength_++},jspb.BinaryWriter.prototype.writeSerializedMessage=function(e,t,r){this.appendUint8Array_(e.subarray(t,r))},jspb.BinaryWriter.prototype.maybeWriteSerializedMessage=function(e,t,r){null!=e&&null!=t&&null!=r&&this.writeSerializedMessage(e,t,r)},jspb.BinaryWriter.prototype.reset=function(){this.blocks_=[],this.encoder_.end(),this.totalLength_=0,this.bookmarks_=[]},jspb.BinaryWriter.prototype.getResultBuffer=function(){jspb.asserts.assert(0==this.bookmarks_.length);for(var e=new Uint8Array(this.totalLength_+this.encoder_.length()),t=this.blocks_,r=t.length,o=0,i=0;i=-jspb.BinaryConstants.TWO_TO_31&&t=-jspb.BinaryConstants.TWO_TO_31&&t=-jspb.BinaryConstants.TWO_TO_63&&t=-jspb.BinaryConstants.TWO_TO_31&&t=-jspb.BinaryConstants.TWO_TO_63&&t=-jspb.BinaryConstants.TWO_TO_31&&t=-jspb.BinaryConstants.TWO_TO_63&&t=-jspb.BinaryConstants.TWO_TO_31&&t>>0,t>>>0)}))},jspb.BinaryWriter.prototype.writeRepeatedInt32=function(e,t){if(null!=t)for(var r=0;r>>0,t>>>0)}));this.endDelimited_(e)}},jspb.BinaryWriter.prototype.writePackedInt64String=function(e,t){if(null!=t&&t.length){e=this.beginDelimited_(e);for(var r=0;rt.length?r.length:t.length;for(e.getJsPbMessageId()&&(o[0]=e.getJsPbMessageId(),i=1);i0&&t.writeString(1,r),(r=e.getValue_asU8()).length>0&&t.writeBytes(2,r)},proto.google.protobuf.Any.prototype.getTypeUrl=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.google.protobuf.Any.prototype.setTypeUrl=function(e){return t.Message.setProto3StringField(this,1,e)},proto.google.protobuf.Any.prototype.getValue=function(){return t.Message.getFieldWithDefault(this,2,"")},proto.google.protobuf.Any.prototype.getValue_asB64=function(){return t.Message.bytesAsB64(this.getValue())},proto.google.protobuf.Any.prototype.getValue_asU8=function(){return t.Message.bytesAsU8(this.getValue())},proto.google.protobuf.Any.prototype.setValue=function(e){return t.Message.setProto3BytesField(this,2,e)},r.object.extend(e,proto.google.protobuf),proto.google.protobuf.Any.prototype.getTypeName=function(){return this.getTypeUrl().split("/").pop()},proto.google.protobuf.Any.prototype.pack=function(e,t,r){r||(r="type.googleapis.com/"),"/"!=r.substr(-1)?this.setTypeUrl(r+"/"+t):this.setTypeUrl(r+t),this.setValue(e)},proto.google.protobuf.Any.prototype.unpack=function(e,t){return this.getTypeName()==t?e(this.getValue_asU8()):null}}(any_pb);var mediapipe_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.MediaPipeOptions",null,o),proto.mediapipe.MediaPipeOptions=function(e){t.Message.initialize(this,e,0,1,null,null)},r.inherits(proto.mediapipe.MediaPipeOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.MediaPipeOptions.displayName="proto.mediapipe.MediaPipeOptions"),proto.mediapipe.MediaPipeOptions.extensions={},proto.mediapipe.MediaPipeOptions.extensionsBinary={},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.MediaPipeOptions.prototype.toObject=function(e){return proto.mediapipe.MediaPipeOptions.toObject(e,this)},proto.mediapipe.MediaPipeOptions.toObject=function(e,r){var o={};return t.Message.toObjectExtension(r,o,proto.mediapipe.MediaPipeOptions.extensions,proto.mediapipe.MediaPipeOptions.prototype.getExtension,e),e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.MediaPipeOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.MediaPipeOptions;return proto.mediapipe.MediaPipeOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.MediaPipeOptions.deserializeBinaryFromReader=function(e,r){for(;r.nextField()&&!r.isEndGroup();){r.getFieldNumber();t.Message.readBinaryExtension(e,r,proto.mediapipe.MediaPipeOptions.extensionsBinary,proto.mediapipe.MediaPipeOptions.prototype.getExtension,proto.mediapipe.MediaPipeOptions.prototype.setExtension)}return e},proto.mediapipe.MediaPipeOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.MediaPipeOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.MediaPipeOptions.serializeBinaryToWriter=function(e,r){t.Message.serializeBinaryExtensions(e,r,proto.mediapipe.MediaPipeOptions.extensionsBinary,proto.mediapipe.MediaPipeOptions.prototype.getExtension)},r.object.extend(e,proto.mediapipe)}(mediapipe_options_pb);var packet_factory_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.PacketFactoryConfig",null,o),r.exportSymbol("proto.mediapipe.PacketFactoryOptions",null,o),r.exportSymbol("proto.mediapipe.PacketManagerConfig",null,o),proto.mediapipe.PacketFactoryOptions=function(e){t.Message.initialize(this,e,0,1,null,null)},r.inherits(proto.mediapipe.PacketFactoryOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.PacketFactoryOptions.displayName="proto.mediapipe.PacketFactoryOptions"),proto.mediapipe.PacketFactoryOptions.extensions={},proto.mediapipe.PacketFactoryOptions.extensionsBinary={},proto.mediapipe.PacketFactoryConfig=function(e){t.Message.initialize(this,e,0,500,null,null)},r.inherits(proto.mediapipe.PacketFactoryConfig,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.PacketFactoryConfig.displayName="proto.mediapipe.PacketFactoryConfig"),proto.mediapipe.PacketManagerConfig=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.PacketManagerConfig.repeatedFields_,null)},r.inherits(proto.mediapipe.PacketManagerConfig,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.PacketManagerConfig.displayName="proto.mediapipe.PacketManagerConfig"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.PacketFactoryOptions.prototype.toObject=function(e){return proto.mediapipe.PacketFactoryOptions.toObject(e,this)},proto.mediapipe.PacketFactoryOptions.toObject=function(e,r){var o={};return t.Message.toObjectExtension(r,o,proto.mediapipe.PacketFactoryOptions.extensions,proto.mediapipe.PacketFactoryOptions.prototype.getExtension,e),e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.PacketFactoryOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.PacketFactoryOptions;return proto.mediapipe.PacketFactoryOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.PacketFactoryOptions.deserializeBinaryFromReader=function(e,r){for(;r.nextField()&&!r.isEndGroup();){r.getFieldNumber();t.Message.readBinaryExtension(e,r,proto.mediapipe.PacketFactoryOptions.extensionsBinary,proto.mediapipe.PacketFactoryOptions.prototype.getExtension,proto.mediapipe.PacketFactoryOptions.prototype.setExtension)}return e},proto.mediapipe.PacketFactoryOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.PacketFactoryOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.PacketFactoryOptions.serializeBinaryToWriter=function(e,r){t.Message.serializeBinaryExtensions(e,r,proto.mediapipe.PacketFactoryOptions.extensionsBinary,proto.mediapipe.PacketFactoryOptions.prototype.getExtension)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.PacketFactoryConfig.prototype.toObject=function(e){return proto.mediapipe.PacketFactoryConfig.toObject(e,this)},proto.mediapipe.PacketFactoryConfig.toObject=function(e,r){var o,i={packetFactory:null==(o=t.Message.getField(r,1))?void 0:o,outputSidePacket:null==(o=t.Message.getField(r,2))?void 0:o,externalOutput:null==(o=t.Message.getField(r,1002))?void 0:o,options:(o=r.getOptions())&&proto.mediapipe.PacketFactoryOptions.toObject(e,o)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.PacketFactoryConfig.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.PacketFactoryConfig;return proto.mediapipe.PacketFactoryConfig.deserializeBinaryFromReader(o,r)},proto.mediapipe.PacketFactoryConfig.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setPacketFactory(r);break;case 2:r=t.readString();e.setOutputSidePacket(r);break;case 1002:r=t.readString();e.setExternalOutput(r);break;case 3:r=new proto.mediapipe.PacketFactoryOptions;t.readMessage(r,proto.mediapipe.PacketFactoryOptions.deserializeBinaryFromReader),e.setOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.PacketFactoryConfig.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.PacketFactoryConfig.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.PacketFactoryConfig.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeString(1,o),null!=(o=t.Message.getField(e,2))&&r.writeString(2,o),null!=(o=t.Message.getField(e,1002))&&r.writeString(1002,o),null!=(o=e.getOptions())&&r.writeMessage(3,o,proto.mediapipe.PacketFactoryOptions.serializeBinaryToWriter)},proto.mediapipe.PacketFactoryConfig.prototype.getPacketFactory=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.PacketFactoryConfig.prototype.setPacketFactory=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.PacketFactoryConfig.prototype.clearPacketFactory=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.PacketFactoryConfig.prototype.hasPacketFactory=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.PacketFactoryConfig.prototype.getOutputSidePacket=function(){return t.Message.getFieldWithDefault(this,2,"")},proto.mediapipe.PacketFactoryConfig.prototype.setOutputSidePacket=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.PacketFactoryConfig.prototype.clearOutputSidePacket=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.PacketFactoryConfig.prototype.hasOutputSidePacket=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.PacketFactoryConfig.prototype.getExternalOutput=function(){return t.Message.getFieldWithDefault(this,1002,"")},proto.mediapipe.PacketFactoryConfig.prototype.setExternalOutput=function(e){return t.Message.setField(this,1002,e)},proto.mediapipe.PacketFactoryConfig.prototype.clearExternalOutput=function(){return t.Message.setField(this,1002,void 0)},proto.mediapipe.PacketFactoryConfig.prototype.hasExternalOutput=function(){return null!=t.Message.getField(this,1002)},proto.mediapipe.PacketFactoryConfig.prototype.getOptions=function(){return t.Message.getWrapperField(this,proto.mediapipe.PacketFactoryOptions,3)},proto.mediapipe.PacketFactoryConfig.prototype.setOptions=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.PacketFactoryConfig.prototype.clearOptions=function(){return this.setOptions(void 0)},proto.mediapipe.PacketFactoryConfig.prototype.hasOptions=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.PacketManagerConfig.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.PacketManagerConfig.prototype.toObject=function(e){return proto.mediapipe.PacketManagerConfig.toObject(e,this)},proto.mediapipe.PacketManagerConfig.toObject=function(e,r){var o={packetList:t.Message.toObjectList(r.getPacketList(),proto.mediapipe.PacketFactoryConfig.toObject,e)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.PacketManagerConfig.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.PacketManagerConfig;return proto.mediapipe.PacketManagerConfig.deserializeBinaryFromReader(o,r)},proto.mediapipe.PacketManagerConfig.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new proto.mediapipe.PacketFactoryConfig;t.readMessage(r,proto.mediapipe.PacketFactoryConfig.deserializeBinaryFromReader),e.addPacket(r)}else t.skipField()}return e},proto.mediapipe.PacketManagerConfig.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.PacketManagerConfig.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.PacketManagerConfig.serializeBinaryToWriter=function(e,t){var r;(r=e.getPacketList()).length>0&&t.writeRepeatedMessage(1,r,proto.mediapipe.PacketFactoryConfig.serializeBinaryToWriter)},proto.mediapipe.PacketManagerConfig.prototype.getPacketList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.PacketFactoryConfig,1)},proto.mediapipe.PacketManagerConfig.prototype.setPacketList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.PacketManagerConfig.prototype.addPacket=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.PacketFactoryConfig,r)},proto.mediapipe.PacketManagerConfig.prototype.clearPacketList=function(){return this.setPacketList([])},r.object.extend(e,proto.mediapipe)}(packet_factory_pb);var packet_generator_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.PacketGeneratorConfig",null,o),r.exportSymbol("proto.mediapipe.PacketGeneratorOptions",null,o),proto.mediapipe.PacketGeneratorOptions=function(e){t.Message.initialize(this,e,0,2,null,null)},r.inherits(proto.mediapipe.PacketGeneratorOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.PacketGeneratorOptions.displayName="proto.mediapipe.PacketGeneratorOptions"),proto.mediapipe.PacketGeneratorOptions.extensions={},proto.mediapipe.PacketGeneratorOptions.extensionsBinary={},proto.mediapipe.PacketGeneratorConfig=function(e){t.Message.initialize(this,e,0,500,proto.mediapipe.PacketGeneratorConfig.repeatedFields_,null)},r.inherits(proto.mediapipe.PacketGeneratorConfig,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.PacketGeneratorConfig.displayName="proto.mediapipe.PacketGeneratorConfig"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.PacketGeneratorOptions.prototype.toObject=function(e){return proto.mediapipe.PacketGeneratorOptions.toObject(e,this)},proto.mediapipe.PacketGeneratorOptions.toObject=function(e,r){var o={mergeFields:t.Message.getBooleanFieldWithDefault(r,1,!0)};return t.Message.toObjectExtension(r,o,proto.mediapipe.PacketGeneratorOptions.extensions,proto.mediapipe.PacketGeneratorOptions.prototype.getExtension,e),e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.PacketGeneratorOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.PacketGeneratorOptions;return proto.mediapipe.PacketGeneratorOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.PacketGeneratorOptions.deserializeBinaryFromReader=function(e,r){for(;r.nextField()&&!r.isEndGroup();){if(1===r.getFieldNumber()){var o=r.readBool();e.setMergeFields(o)}else t.Message.readBinaryExtension(e,r,proto.mediapipe.PacketGeneratorOptions.extensionsBinary,proto.mediapipe.PacketGeneratorOptions.prototype.getExtension,proto.mediapipe.PacketGeneratorOptions.prototype.setExtension)}return e},proto.mediapipe.PacketGeneratorOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.PacketGeneratorOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.PacketGeneratorOptions.serializeBinaryToWriter=function(e,r){var o;null!=(o=t.Message.getField(e,1))&&r.writeBool(1,o),t.Message.serializeBinaryExtensions(e,r,proto.mediapipe.PacketGeneratorOptions.extensionsBinary,proto.mediapipe.PacketGeneratorOptions.prototype.getExtension)},proto.mediapipe.PacketGeneratorOptions.prototype.getMergeFields=function(){return t.Message.getBooleanFieldWithDefault(this,1,!0)},proto.mediapipe.PacketGeneratorOptions.prototype.setMergeFields=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.PacketGeneratorOptions.prototype.clearMergeFields=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.PacketGeneratorOptions.prototype.hasMergeFields=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.PacketGeneratorConfig.repeatedFields_=[2,1002,3,1003],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.PacketGeneratorConfig.prototype.toObject=function(e){return proto.mediapipe.PacketGeneratorConfig.toObject(e,this)},proto.mediapipe.PacketGeneratorConfig.toObject=function(e,r){var o,i={packetGenerator:null==(o=t.Message.getField(r,1))?void 0:o,inputSidePacketList:null==(o=t.Message.getRepeatedField(r,2))?void 0:o,externalInputList:null==(o=t.Message.getRepeatedField(r,1002))?void 0:o,outputSidePacketList:null==(o=t.Message.getRepeatedField(r,3))?void 0:o,externalOutputList:null==(o=t.Message.getRepeatedField(r,1003))?void 0:o,options:(o=r.getOptions())&&proto.mediapipe.PacketGeneratorOptions.toObject(e,o)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.PacketGeneratorConfig.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.PacketGeneratorConfig;return proto.mediapipe.PacketGeneratorConfig.deserializeBinaryFromReader(o,r)},proto.mediapipe.PacketGeneratorConfig.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setPacketGenerator(r);break;case 2:r=t.readString();e.addInputSidePacket(r);break;case 1002:r=t.readString();e.addExternalInput(r);break;case 3:r=t.readString();e.addOutputSidePacket(r);break;case 1003:r=t.readString();e.addExternalOutput(r);break;case 4:r=new proto.mediapipe.PacketGeneratorOptions;t.readMessage(r,proto.mediapipe.PacketGeneratorOptions.deserializeBinaryFromReader),e.setOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.PacketGeneratorConfig.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.PacketGeneratorConfig.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.PacketGeneratorConfig.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeString(1,o),(o=e.getInputSidePacketList()).length>0&&r.writeRepeatedString(2,o),(o=e.getExternalInputList()).length>0&&r.writeRepeatedString(1002,o),(o=e.getOutputSidePacketList()).length>0&&r.writeRepeatedString(3,o),(o=e.getExternalOutputList()).length>0&&r.writeRepeatedString(1003,o),null!=(o=e.getOptions())&&r.writeMessage(4,o,proto.mediapipe.PacketGeneratorOptions.serializeBinaryToWriter)},proto.mediapipe.PacketGeneratorConfig.prototype.getPacketGenerator=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.PacketGeneratorConfig.prototype.setPacketGenerator=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.PacketGeneratorConfig.prototype.clearPacketGenerator=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.PacketGeneratorConfig.prototype.hasPacketGenerator=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.PacketGeneratorConfig.prototype.getInputSidePacketList=function(){return t.Message.getRepeatedField(this,2)},proto.mediapipe.PacketGeneratorConfig.prototype.setInputSidePacketList=function(e){return t.Message.setField(this,2,e||[])},proto.mediapipe.PacketGeneratorConfig.prototype.addInputSidePacket=function(e,r){return t.Message.addToRepeatedField(this,2,e,r)},proto.mediapipe.PacketGeneratorConfig.prototype.clearInputSidePacketList=function(){return this.setInputSidePacketList([])},proto.mediapipe.PacketGeneratorConfig.prototype.getExternalInputList=function(){return t.Message.getRepeatedField(this,1002)},proto.mediapipe.PacketGeneratorConfig.prototype.setExternalInputList=function(e){return t.Message.setField(this,1002,e||[])},proto.mediapipe.PacketGeneratorConfig.prototype.addExternalInput=function(e,r){return t.Message.addToRepeatedField(this,1002,e,r)},proto.mediapipe.PacketGeneratorConfig.prototype.clearExternalInputList=function(){return this.setExternalInputList([])},proto.mediapipe.PacketGeneratorConfig.prototype.getOutputSidePacketList=function(){return t.Message.getRepeatedField(this,3)},proto.mediapipe.PacketGeneratorConfig.prototype.setOutputSidePacketList=function(e){return t.Message.setField(this,3,e||[])},proto.mediapipe.PacketGeneratorConfig.prototype.addOutputSidePacket=function(e,r){return t.Message.addToRepeatedField(this,3,e,r)},proto.mediapipe.PacketGeneratorConfig.prototype.clearOutputSidePacketList=function(){return this.setOutputSidePacketList([])},proto.mediapipe.PacketGeneratorConfig.prototype.getExternalOutputList=function(){return t.Message.getRepeatedField(this,1003)},proto.mediapipe.PacketGeneratorConfig.prototype.setExternalOutputList=function(e){return t.Message.setField(this,1003,e||[])},proto.mediapipe.PacketGeneratorConfig.prototype.addExternalOutput=function(e,r){return t.Message.addToRepeatedField(this,1003,e,r)},proto.mediapipe.PacketGeneratorConfig.prototype.clearExternalOutputList=function(){return this.setExternalOutputList([])},proto.mediapipe.PacketGeneratorConfig.prototype.getOptions=function(){return t.Message.getWrapperField(this,proto.mediapipe.PacketGeneratorOptions,4)},proto.mediapipe.PacketGeneratorConfig.prototype.setOptions=function(e){return t.Message.setWrapperField(this,4,e)},proto.mediapipe.PacketGeneratorConfig.prototype.clearOptions=function(){return this.setOptions(void 0)},proto.mediapipe.PacketGeneratorConfig.prototype.hasOptions=function(){return null!=t.Message.getField(this,4)},r.object.extend(e,proto.mediapipe)}(packet_generator_pb);var status_handler_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=mediapipe_options_pb;r.object.extend(proto,i),r.exportSymbol("proto.mediapipe.StatusHandlerConfig",null,o),proto.mediapipe.StatusHandlerConfig=function(e){t.Message.initialize(this,e,0,500,proto.mediapipe.StatusHandlerConfig.repeatedFields_,null)},r.inherits(proto.mediapipe.StatusHandlerConfig,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.StatusHandlerConfig.displayName="proto.mediapipe.StatusHandlerConfig"),proto.mediapipe.StatusHandlerConfig.repeatedFields_=[2,1002],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.StatusHandlerConfig.prototype.toObject=function(e){return proto.mediapipe.StatusHandlerConfig.toObject(e,this)},proto.mediapipe.StatusHandlerConfig.toObject=function(e,r){var o,a={statusHandler:null==(o=t.Message.getField(r,1))?void 0:o,inputSidePacketList:null==(o=t.Message.getRepeatedField(r,2))?void 0:o,externalInputList:null==(o=t.Message.getRepeatedField(r,1002))?void 0:o,options:(o=r.getOptions())&&i.MediaPipeOptions.toObject(e,o)};return e&&(a.$jspbMessageInstance=r),a}),proto.mediapipe.StatusHandlerConfig.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.StatusHandlerConfig;return proto.mediapipe.StatusHandlerConfig.deserializeBinaryFromReader(o,r)},proto.mediapipe.StatusHandlerConfig.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setStatusHandler(r);break;case 2:r=t.readString();e.addInputSidePacket(r);break;case 1002:r=t.readString();e.addExternalInput(r);break;case 3:r=new i.MediaPipeOptions;t.readMessage(r,i.MediaPipeOptions.deserializeBinaryFromReader),e.setOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.StatusHandlerConfig.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.StatusHandlerConfig.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.StatusHandlerConfig.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeString(1,o),(o=e.getInputSidePacketList()).length>0&&r.writeRepeatedString(2,o),(o=e.getExternalInputList()).length>0&&r.writeRepeatedString(1002,o),null!=(o=e.getOptions())&&r.writeMessage(3,o,i.MediaPipeOptions.serializeBinaryToWriter)},proto.mediapipe.StatusHandlerConfig.prototype.getStatusHandler=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.StatusHandlerConfig.prototype.setStatusHandler=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.StatusHandlerConfig.prototype.clearStatusHandler=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.StatusHandlerConfig.prototype.hasStatusHandler=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.StatusHandlerConfig.prototype.getInputSidePacketList=function(){return t.Message.getRepeatedField(this,2)},proto.mediapipe.StatusHandlerConfig.prototype.setInputSidePacketList=function(e){return t.Message.setField(this,2,e||[])},proto.mediapipe.StatusHandlerConfig.prototype.addInputSidePacket=function(e,r){return t.Message.addToRepeatedField(this,2,e,r)},proto.mediapipe.StatusHandlerConfig.prototype.clearInputSidePacketList=function(){return this.setInputSidePacketList([])},proto.mediapipe.StatusHandlerConfig.prototype.getExternalInputList=function(){return t.Message.getRepeatedField(this,1002)},proto.mediapipe.StatusHandlerConfig.prototype.setExternalInputList=function(e){return t.Message.setField(this,1002,e||[])},proto.mediapipe.StatusHandlerConfig.prototype.addExternalInput=function(e,r){return t.Message.addToRepeatedField(this,1002,e,r)},proto.mediapipe.StatusHandlerConfig.prototype.clearExternalInputList=function(){return this.setExternalInputList([])},proto.mediapipe.StatusHandlerConfig.prototype.getOptions=function(){return t.Message.getWrapperField(this,i.MediaPipeOptions,3)},proto.mediapipe.StatusHandlerConfig.prototype.setOptions=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.StatusHandlerConfig.prototype.clearOptions=function(){return this.setOptions(void 0)},proto.mediapipe.StatusHandlerConfig.prototype.hasOptions=function(){return null!=t.Message.getField(this,3)},r.object.extend(e,proto.mediapipe)}(status_handler_pb);var stream_handler_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=mediapipe_options_pb;r.object.extend(proto,i),r.exportSymbol("proto.mediapipe.InputStreamHandlerConfig",null,o),r.exportSymbol("proto.mediapipe.OutputStreamHandlerConfig",null,o),proto.mediapipe.InputStreamHandlerConfig=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.InputStreamHandlerConfig,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.InputStreamHandlerConfig.displayName="proto.mediapipe.InputStreamHandlerConfig"),proto.mediapipe.OutputStreamHandlerConfig=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.OutputStreamHandlerConfig.repeatedFields_,null)},r.inherits(proto.mediapipe.OutputStreamHandlerConfig,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.OutputStreamHandlerConfig.displayName="proto.mediapipe.OutputStreamHandlerConfig"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.InputStreamHandlerConfig.prototype.toObject=function(e){return proto.mediapipe.InputStreamHandlerConfig.toObject(e,this)},proto.mediapipe.InputStreamHandlerConfig.toObject=function(e,r){var o,a={inputStreamHandler:t.Message.getFieldWithDefault(r,1,"DefaultInputStreamHandler"),options:(o=r.getOptions())&&i.MediaPipeOptions.toObject(e,o)};return e&&(a.$jspbMessageInstance=r),a}),proto.mediapipe.InputStreamHandlerConfig.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.InputStreamHandlerConfig;return proto.mediapipe.InputStreamHandlerConfig.deserializeBinaryFromReader(o,r)},proto.mediapipe.InputStreamHandlerConfig.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setInputStreamHandler(r);break;case 3:r=new i.MediaPipeOptions;t.readMessage(r,i.MediaPipeOptions.deserializeBinaryFromReader),e.setOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.InputStreamHandlerConfig.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.InputStreamHandlerConfig.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.InputStreamHandlerConfig.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeString(1,o),null!=(o=e.getOptions())&&r.writeMessage(3,o,i.MediaPipeOptions.serializeBinaryToWriter)},proto.mediapipe.InputStreamHandlerConfig.prototype.getInputStreamHandler=function(){return t.Message.getFieldWithDefault(this,1,"DefaultInputStreamHandler")},proto.mediapipe.InputStreamHandlerConfig.prototype.setInputStreamHandler=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.InputStreamHandlerConfig.prototype.clearInputStreamHandler=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.InputStreamHandlerConfig.prototype.hasInputStreamHandler=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.InputStreamHandlerConfig.prototype.getOptions=function(){return t.Message.getWrapperField(this,i.MediaPipeOptions,3)},proto.mediapipe.InputStreamHandlerConfig.prototype.setOptions=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.InputStreamHandlerConfig.prototype.clearOptions=function(){return this.setOptions(void 0)},proto.mediapipe.InputStreamHandlerConfig.prototype.hasOptions=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.OutputStreamHandlerConfig.repeatedFields_=[2],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.OutputStreamHandlerConfig.prototype.toObject=function(e){return proto.mediapipe.OutputStreamHandlerConfig.toObject(e,this)},proto.mediapipe.OutputStreamHandlerConfig.toObject=function(e,r){var o,a={outputStreamHandler:t.Message.getFieldWithDefault(r,1,"InOrderOutputStreamHandler"),inputSidePacketList:null==(o=t.Message.getRepeatedField(r,2))?void 0:o,options:(o=r.getOptions())&&i.MediaPipeOptions.toObject(e,o)};return e&&(a.$jspbMessageInstance=r),a}),proto.mediapipe.OutputStreamHandlerConfig.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.OutputStreamHandlerConfig;return proto.mediapipe.OutputStreamHandlerConfig.deserializeBinaryFromReader(o,r)},proto.mediapipe.OutputStreamHandlerConfig.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setOutputStreamHandler(r);break;case 2:r=t.readString();e.addInputSidePacket(r);break;case 3:r=new i.MediaPipeOptions;t.readMessage(r,i.MediaPipeOptions.deserializeBinaryFromReader),e.setOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.OutputStreamHandlerConfig.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.OutputStreamHandlerConfig.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.OutputStreamHandlerConfig.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeString(1,o),(o=e.getInputSidePacketList()).length>0&&r.writeRepeatedString(2,o),null!=(o=e.getOptions())&&r.writeMessage(3,o,i.MediaPipeOptions.serializeBinaryToWriter)},proto.mediapipe.OutputStreamHandlerConfig.prototype.getOutputStreamHandler=function(){return t.Message.getFieldWithDefault(this,1,"InOrderOutputStreamHandler")},proto.mediapipe.OutputStreamHandlerConfig.prototype.setOutputStreamHandler=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.OutputStreamHandlerConfig.prototype.clearOutputStreamHandler=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.OutputStreamHandlerConfig.prototype.hasOutputStreamHandler=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.OutputStreamHandlerConfig.prototype.getInputSidePacketList=function(){return t.Message.getRepeatedField(this,2)},proto.mediapipe.OutputStreamHandlerConfig.prototype.setInputSidePacketList=function(e){return t.Message.setField(this,2,e||[])},proto.mediapipe.OutputStreamHandlerConfig.prototype.addInputSidePacket=function(e,r){return t.Message.addToRepeatedField(this,2,e,r)},proto.mediapipe.OutputStreamHandlerConfig.prototype.clearInputSidePacketList=function(){return this.setInputSidePacketList([])},proto.mediapipe.OutputStreamHandlerConfig.prototype.getOptions=function(){return t.Message.getWrapperField(this,i.MediaPipeOptions,3)},proto.mediapipe.OutputStreamHandlerConfig.prototype.setOptions=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.OutputStreamHandlerConfig.prototype.clearOptions=function(){return this.setOptions(void 0)},proto.mediapipe.OutputStreamHandlerConfig.prototype.hasOptions=function(){return null!=t.Message.getField(this,3)},r.object.extend(e,proto.mediapipe)}(stream_handler_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_options_pb;r.object.extend(proto,i);var a=any_pb;r.object.extend(proto,a);var n=mediapipe_options_pb;r.object.extend(proto,n);var s=packet_factory_pb;r.object.extend(proto,s);var p=packet_generator_pb;r.object.extend(proto,p);var d=status_handler_pb;r.object.extend(proto,d);var l=stream_handler_pb;r.object.extend(proto,l),r.exportSymbol("proto.mediapipe.CalculatorGraphConfig",null,o),r.exportSymbol("proto.mediapipe.CalculatorGraphConfig.Node",null,o),r.exportSymbol("proto.mediapipe.ExecutorConfig",null,o),r.exportSymbol("proto.mediapipe.InputCollection",null,o),r.exportSymbol("proto.mediapipe.InputCollection.InputType",null,o),r.exportSymbol("proto.mediapipe.InputCollectionSet",null,o),r.exportSymbol("proto.mediapipe.InputStreamInfo",null,o),r.exportSymbol("proto.mediapipe.ProfilerConfig",null,o),proto.mediapipe.ExecutorConfig=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.ExecutorConfig,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.ExecutorConfig.displayName="proto.mediapipe.ExecutorConfig"),proto.mediapipe.InputCollection=function(e){t.Message.initialize(this,e,0,500,proto.mediapipe.InputCollection.repeatedFields_,null)},r.inherits(proto.mediapipe.InputCollection,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.InputCollection.displayName="proto.mediapipe.InputCollection"),proto.mediapipe.InputCollectionSet=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.InputCollectionSet.repeatedFields_,null)},r.inherits(proto.mediapipe.InputCollectionSet,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.InputCollectionSet.displayName="proto.mediapipe.InputCollectionSet"),proto.mediapipe.InputStreamInfo=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.InputStreamInfo,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.InputStreamInfo.displayName="proto.mediapipe.InputStreamInfo"),proto.mediapipe.ProfilerConfig=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.ProfilerConfig.repeatedFields_,null)},r.inherits(proto.mediapipe.ProfilerConfig,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.ProfilerConfig.displayName="proto.mediapipe.ProfilerConfig"),proto.mediapipe.CalculatorGraphConfig=function(e){t.Message.initialize(this,e,0,500,proto.mediapipe.CalculatorGraphConfig.repeatedFields_,null)},r.inherits(proto.mediapipe.CalculatorGraphConfig,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.CalculatorGraphConfig.displayName="proto.mediapipe.CalculatorGraphConfig"),proto.mediapipe.CalculatorGraphConfig.Node=function(e){t.Message.initialize(this,e,0,500,proto.mediapipe.CalculatorGraphConfig.Node.repeatedFields_,null)},r.inherits(proto.mediapipe.CalculatorGraphConfig.Node,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.CalculatorGraphConfig.Node.displayName="proto.mediapipe.CalculatorGraphConfig.Node"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.ExecutorConfig.prototype.toObject=function(e){return proto.mediapipe.ExecutorConfig.toObject(e,this)},proto.mediapipe.ExecutorConfig.toObject=function(e,r){var o,i={name:t.Message.getFieldWithDefault(r,1,""),type:t.Message.getFieldWithDefault(r,2,""),options:(o=r.getOptions())&&n.MediaPipeOptions.toObject(e,o)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.ExecutorConfig.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.ExecutorConfig;return proto.mediapipe.ExecutorConfig.deserializeBinaryFromReader(o,r)},proto.mediapipe.ExecutorConfig.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setName(r);break;case 2:r=t.readString();e.setType(r);break;case 3:r=new n.MediaPipeOptions;t.readMessage(r,n.MediaPipeOptions.deserializeBinaryFromReader),e.setOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.ExecutorConfig.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.ExecutorConfig.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.ExecutorConfig.serializeBinaryToWriter=function(e,t){var r=void 0;(r=e.getName()).length>0&&t.writeString(1,r),(r=e.getType()).length>0&&t.writeString(2,r),null!=(r=e.getOptions())&&t.writeMessage(3,r,n.MediaPipeOptions.serializeBinaryToWriter)},proto.mediapipe.ExecutorConfig.prototype.getName=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.ExecutorConfig.prototype.setName=function(e){return t.Message.setProto3StringField(this,1,e)},proto.mediapipe.ExecutorConfig.prototype.getType=function(){return t.Message.getFieldWithDefault(this,2,"")},proto.mediapipe.ExecutorConfig.prototype.setType=function(e){return t.Message.setProto3StringField(this,2,e)},proto.mediapipe.ExecutorConfig.prototype.getOptions=function(){return t.Message.getWrapperField(this,n.MediaPipeOptions,3)},proto.mediapipe.ExecutorConfig.prototype.setOptions=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.ExecutorConfig.prototype.clearOptions=function(){return this.setOptions(void 0)},proto.mediapipe.ExecutorConfig.prototype.hasOptions=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.InputCollection.repeatedFields_=[2,1002],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.InputCollection.prototype.toObject=function(e){return proto.mediapipe.InputCollection.toObject(e,this)},proto.mediapipe.InputCollection.toObject=function(e,r){var o,i={name:t.Message.getFieldWithDefault(r,1,""),sidePacketNameList:null==(o=t.Message.getRepeatedField(r,2))?void 0:o,externalInputNameList:null==(o=t.Message.getRepeatedField(r,1002))?void 0:o,inputType:t.Message.getFieldWithDefault(r,3,0),fileName:t.Message.getFieldWithDefault(r,4,"")};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.InputCollection.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.InputCollection;return proto.mediapipe.InputCollection.deserializeBinaryFromReader(o,r)},proto.mediapipe.InputCollection.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setName(r);break;case 2:r=t.readString();e.addSidePacketName(r);break;case 1002:r=t.readString();e.addExternalInputName(r);break;case 3:r=t.readEnum();e.setInputType(r);break;case 4:r=t.readString();e.setFileName(r);break;default:t.skipField()}}return e},proto.mediapipe.InputCollection.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.InputCollection.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.InputCollection.serializeBinaryToWriter=function(e,t){var r=void 0;(r=e.getName()).length>0&&t.writeString(1,r),(r=e.getSidePacketNameList()).length>0&&t.writeRepeatedString(2,r),(r=e.getExternalInputNameList()).length>0&&t.writeRepeatedString(1002,r),0!==(r=e.getInputType())&&t.writeEnum(3,r),(r=e.getFileName()).length>0&&t.writeString(4,r)},proto.mediapipe.InputCollection.InputType={UNKNOWN:0,RECORDIO:1,FOREIGN_RECORDIO:2,FOREIGN_CSV_TEXT:3,INVALID_UPPER_BOUND:4},proto.mediapipe.InputCollection.prototype.getName=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.InputCollection.prototype.setName=function(e){return t.Message.setProto3StringField(this,1,e)},proto.mediapipe.InputCollection.prototype.getSidePacketNameList=function(){return t.Message.getRepeatedField(this,2)},proto.mediapipe.InputCollection.prototype.setSidePacketNameList=function(e){return t.Message.setField(this,2,e||[])},proto.mediapipe.InputCollection.prototype.addSidePacketName=function(e,r){return t.Message.addToRepeatedField(this,2,e,r)},proto.mediapipe.InputCollection.prototype.clearSidePacketNameList=function(){return this.setSidePacketNameList([])},proto.mediapipe.InputCollection.prototype.getExternalInputNameList=function(){return t.Message.getRepeatedField(this,1002)},proto.mediapipe.InputCollection.prototype.setExternalInputNameList=function(e){return t.Message.setField(this,1002,e||[])},proto.mediapipe.InputCollection.prototype.addExternalInputName=function(e,r){return t.Message.addToRepeatedField(this,1002,e,r)},proto.mediapipe.InputCollection.prototype.clearExternalInputNameList=function(){return this.setExternalInputNameList([])},proto.mediapipe.InputCollection.prototype.getInputType=function(){return t.Message.getFieldWithDefault(this,3,0)},proto.mediapipe.InputCollection.prototype.setInputType=function(e){return t.Message.setProto3EnumField(this,3,e)},proto.mediapipe.InputCollection.prototype.getFileName=function(){return t.Message.getFieldWithDefault(this,4,"")},proto.mediapipe.InputCollection.prototype.setFileName=function(e){return t.Message.setProto3StringField(this,4,e)},proto.mediapipe.InputCollectionSet.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.InputCollectionSet.prototype.toObject=function(e){return proto.mediapipe.InputCollectionSet.toObject(e,this)},proto.mediapipe.InputCollectionSet.toObject=function(e,r){var o={inputCollectionList:t.Message.toObjectList(r.getInputCollectionList(),proto.mediapipe.InputCollection.toObject,e)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.InputCollectionSet.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.InputCollectionSet;return proto.mediapipe.InputCollectionSet.deserializeBinaryFromReader(o,r)},proto.mediapipe.InputCollectionSet.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new proto.mediapipe.InputCollection;t.readMessage(r,proto.mediapipe.InputCollection.deserializeBinaryFromReader),e.addInputCollection(r)}else t.skipField()}return e},proto.mediapipe.InputCollectionSet.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.InputCollectionSet.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.InputCollectionSet.serializeBinaryToWriter=function(e,t){var r;(r=e.getInputCollectionList()).length>0&&t.writeRepeatedMessage(1,r,proto.mediapipe.InputCollection.serializeBinaryToWriter)},proto.mediapipe.InputCollectionSet.prototype.getInputCollectionList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.InputCollection,1)},proto.mediapipe.InputCollectionSet.prototype.setInputCollectionList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.InputCollectionSet.prototype.addInputCollection=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.InputCollection,r)},proto.mediapipe.InputCollectionSet.prototype.clearInputCollectionList=function(){return this.setInputCollectionList([])},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.InputStreamInfo.prototype.toObject=function(e){return proto.mediapipe.InputStreamInfo.toObject(e,this)},proto.mediapipe.InputStreamInfo.toObject=function(e,r){var o={tagIndex:t.Message.getFieldWithDefault(r,1,""),backEdge:t.Message.getBooleanFieldWithDefault(r,2,!1)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.InputStreamInfo.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.InputStreamInfo;return proto.mediapipe.InputStreamInfo.deserializeBinaryFromReader(o,r)},proto.mediapipe.InputStreamInfo.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setTagIndex(r);break;case 2:r=t.readBool();e.setBackEdge(r);break;default:t.skipField()}}return e},proto.mediapipe.InputStreamInfo.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.InputStreamInfo.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.InputStreamInfo.serializeBinaryToWriter=function(e,t){var r=void 0;(r=e.getTagIndex()).length>0&&t.writeString(1,r),(r=e.getBackEdge())&&t.writeBool(2,r)},proto.mediapipe.InputStreamInfo.prototype.getTagIndex=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.InputStreamInfo.prototype.setTagIndex=function(e){return t.Message.setProto3StringField(this,1,e)},proto.mediapipe.InputStreamInfo.prototype.getBackEdge=function(){return t.Message.getBooleanFieldWithDefault(this,2,!1)},proto.mediapipe.InputStreamInfo.prototype.setBackEdge=function(e){return t.Message.setProto3BooleanField(this,2,e)},proto.mediapipe.ProfilerConfig.repeatedFields_=[8],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.ProfilerConfig.prototype.toObject=function(e){return proto.mediapipe.ProfilerConfig.toObject(e,this)},proto.mediapipe.ProfilerConfig.toObject=function(e,r){var o,i={histogramIntervalSizeUsec:t.Message.getFieldWithDefault(r,1,0),numHistogramIntervals:t.Message.getFieldWithDefault(r,2,0),enableInputOutputLatency:t.Message.getBooleanFieldWithDefault(r,3,!1),enableProfiler:t.Message.getBooleanFieldWithDefault(r,4,!1),enableStreamLatency:t.Message.getBooleanFieldWithDefault(r,5,!1),usePacketTimestampForAddedPacket:t.Message.getBooleanFieldWithDefault(r,6,!1),traceLogCapacity:t.Message.getFieldWithDefault(r,7,0),traceEventTypesDisabledList:null==(o=t.Message.getRepeatedField(r,8))?void 0:o,traceLogPath:t.Message.getFieldWithDefault(r,9,""),traceLogCount:t.Message.getFieldWithDefault(r,10,0),traceLogIntervalUsec:t.Message.getFieldWithDefault(r,11,0),traceLogMarginUsec:t.Message.getFieldWithDefault(r,12,0),traceLogDurationEvents:t.Message.getBooleanFieldWithDefault(r,13,!1),traceLogIntervalCount:t.Message.getFieldWithDefault(r,14,0),traceLogDisabled:t.Message.getBooleanFieldWithDefault(r,15,!1),traceEnabled:t.Message.getBooleanFieldWithDefault(r,16,!1),traceLogInstantEvents:t.Message.getBooleanFieldWithDefault(r,17,!1),calculatorFilter:t.Message.getFieldWithDefault(r,18,"")};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.ProfilerConfig.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.ProfilerConfig;return proto.mediapipe.ProfilerConfig.deserializeBinaryFromReader(o,r)},proto.mediapipe.ProfilerConfig.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readInt64();e.setHistogramIntervalSizeUsec(r);break;case 2:r=t.readInt64();e.setNumHistogramIntervals(r);break;case 3:r=t.readBool();e.setEnableInputOutputLatency(r);break;case 4:r=t.readBool();e.setEnableProfiler(r);break;case 5:r=t.readBool();e.setEnableStreamLatency(r);break;case 6:r=t.readBool();e.setUsePacketTimestampForAddedPacket(r);break;case 7:r=t.readInt64();e.setTraceLogCapacity(r);break;case 8:for(var o=t.isDelimited()?t.readPackedInt32():[t.readInt32()],i=0;i0&&t.writePackedInt32(8,r),(r=e.getTraceLogPath()).length>0&&t.writeString(9,r),0!==(r=e.getTraceLogCount())&&t.writeInt32(10,r),0!==(r=e.getTraceLogIntervalUsec())&&t.writeInt64(11,r),0!==(r=e.getTraceLogMarginUsec())&&t.writeInt64(12,r),(r=e.getTraceLogDurationEvents())&&t.writeBool(13,r),0!==(r=e.getTraceLogIntervalCount())&&t.writeInt32(14,r),(r=e.getTraceLogDisabled())&&t.writeBool(15,r),(r=e.getTraceEnabled())&&t.writeBool(16,r),(r=e.getTraceLogInstantEvents())&&t.writeBool(17,r),(r=e.getCalculatorFilter()).length>0&&t.writeString(18,r)},proto.mediapipe.ProfilerConfig.prototype.getHistogramIntervalSizeUsec=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.ProfilerConfig.prototype.setHistogramIntervalSizeUsec=function(e){return t.Message.setProto3IntField(this,1,e)},proto.mediapipe.ProfilerConfig.prototype.getNumHistogramIntervals=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.ProfilerConfig.prototype.setNumHistogramIntervals=function(e){return t.Message.setProto3IntField(this,2,e)},proto.mediapipe.ProfilerConfig.prototype.getEnableInputOutputLatency=function(){return t.Message.getBooleanFieldWithDefault(this,3,!1)},proto.mediapipe.ProfilerConfig.prototype.setEnableInputOutputLatency=function(e){return t.Message.setProto3BooleanField(this,3,e)},proto.mediapipe.ProfilerConfig.prototype.getEnableProfiler=function(){return t.Message.getBooleanFieldWithDefault(this,4,!1)},proto.mediapipe.ProfilerConfig.prototype.setEnableProfiler=function(e){return t.Message.setProto3BooleanField(this,4,e)},proto.mediapipe.ProfilerConfig.prototype.getEnableStreamLatency=function(){return t.Message.getBooleanFieldWithDefault(this,5,!1)},proto.mediapipe.ProfilerConfig.prototype.setEnableStreamLatency=function(e){return t.Message.setProto3BooleanField(this,5,e)},proto.mediapipe.ProfilerConfig.prototype.getUsePacketTimestampForAddedPacket=function(){return t.Message.getBooleanFieldWithDefault(this,6,!1)},proto.mediapipe.ProfilerConfig.prototype.setUsePacketTimestampForAddedPacket=function(e){return t.Message.setProto3BooleanField(this,6,e)},proto.mediapipe.ProfilerConfig.prototype.getTraceLogCapacity=function(){return t.Message.getFieldWithDefault(this,7,0)},proto.mediapipe.ProfilerConfig.prototype.setTraceLogCapacity=function(e){return t.Message.setProto3IntField(this,7,e)},proto.mediapipe.ProfilerConfig.prototype.getTraceEventTypesDisabledList=function(){return t.Message.getRepeatedField(this,8)},proto.mediapipe.ProfilerConfig.prototype.setTraceEventTypesDisabledList=function(e){return t.Message.setField(this,8,e||[])},proto.mediapipe.ProfilerConfig.prototype.addTraceEventTypesDisabled=function(e,r){return t.Message.addToRepeatedField(this,8,e,r)},proto.mediapipe.ProfilerConfig.prototype.clearTraceEventTypesDisabledList=function(){return this.setTraceEventTypesDisabledList([])},proto.mediapipe.ProfilerConfig.prototype.getTraceLogPath=function(){return t.Message.getFieldWithDefault(this,9,"")},proto.mediapipe.ProfilerConfig.prototype.setTraceLogPath=function(e){return t.Message.setProto3StringField(this,9,e)},proto.mediapipe.ProfilerConfig.prototype.getTraceLogCount=function(){return t.Message.getFieldWithDefault(this,10,0)},proto.mediapipe.ProfilerConfig.prototype.setTraceLogCount=function(e){return t.Message.setProto3IntField(this,10,e)},proto.mediapipe.ProfilerConfig.prototype.getTraceLogIntervalUsec=function(){return t.Message.getFieldWithDefault(this,11,0)},proto.mediapipe.ProfilerConfig.prototype.setTraceLogIntervalUsec=function(e){return t.Message.setProto3IntField(this,11,e)},proto.mediapipe.ProfilerConfig.prototype.getTraceLogMarginUsec=function(){return t.Message.getFieldWithDefault(this,12,0)},proto.mediapipe.ProfilerConfig.prototype.setTraceLogMarginUsec=function(e){return t.Message.setProto3IntField(this,12,e)},proto.mediapipe.ProfilerConfig.prototype.getTraceLogDurationEvents=function(){return t.Message.getBooleanFieldWithDefault(this,13,!1)},proto.mediapipe.ProfilerConfig.prototype.setTraceLogDurationEvents=function(e){return t.Message.setProto3BooleanField(this,13,e)},proto.mediapipe.ProfilerConfig.prototype.getTraceLogIntervalCount=function(){return t.Message.getFieldWithDefault(this,14,0)},proto.mediapipe.ProfilerConfig.prototype.setTraceLogIntervalCount=function(e){return t.Message.setProto3IntField(this,14,e)},proto.mediapipe.ProfilerConfig.prototype.getTraceLogDisabled=function(){return t.Message.getBooleanFieldWithDefault(this,15,!1)},proto.mediapipe.ProfilerConfig.prototype.setTraceLogDisabled=function(e){return t.Message.setProto3BooleanField(this,15,e)},proto.mediapipe.ProfilerConfig.prototype.getTraceEnabled=function(){return t.Message.getBooleanFieldWithDefault(this,16,!1)},proto.mediapipe.ProfilerConfig.prototype.setTraceEnabled=function(e){return t.Message.setProto3BooleanField(this,16,e)},proto.mediapipe.ProfilerConfig.prototype.getTraceLogInstantEvents=function(){return t.Message.getBooleanFieldWithDefault(this,17,!1)},proto.mediapipe.ProfilerConfig.prototype.setTraceLogInstantEvents=function(e){return t.Message.setProto3BooleanField(this,17,e)},proto.mediapipe.ProfilerConfig.prototype.getCalculatorFilter=function(){return t.Message.getFieldWithDefault(this,18,"")},proto.mediapipe.ProfilerConfig.prototype.setCalculatorFilter=function(e){return t.Message.setProto3StringField(this,18,e)},proto.mediapipe.CalculatorGraphConfig.repeatedFields_=[1,6,7,9,10,15,16,17,14,1002],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.CalculatorGraphConfig.prototype.toObject=function(e){return proto.mediapipe.CalculatorGraphConfig.toObject(e,this)},proto.mediapipe.CalculatorGraphConfig.toObject=function(e,r){var o,i={nodeList:t.Message.toObjectList(r.getNodeList(),proto.mediapipe.CalculatorGraphConfig.Node.toObject,e),packetFactoryList:t.Message.toObjectList(r.getPacketFactoryList(),s.PacketFactoryConfig.toObject,e),packetGeneratorList:t.Message.toObjectList(r.getPacketGeneratorList(),p.PacketGeneratorConfig.toObject,e),numThreads:t.Message.getFieldWithDefault(r,8,0),statusHandlerList:t.Message.toObjectList(r.getStatusHandlerList(),d.StatusHandlerConfig.toObject,e),inputStreamList:null==(o=t.Message.getRepeatedField(r,10))?void 0:o,outputStreamList:null==(o=t.Message.getRepeatedField(r,15))?void 0:o,inputSidePacketList:null==(o=t.Message.getRepeatedField(r,16))?void 0:o,outputSidePacketList:null==(o=t.Message.getRepeatedField(r,17))?void 0:o,maxQueueSize:t.Message.getFieldWithDefault(r,11,0),reportDeadlock:t.Message.getBooleanFieldWithDefault(r,21,!1),inputStreamHandler:(o=r.getInputStreamHandler())&&l.InputStreamHandlerConfig.toObject(e,o),outputStreamHandler:(o=r.getOutputStreamHandler())&&l.OutputStreamHandlerConfig.toObject(e,o),executorList:t.Message.toObjectList(r.getExecutorList(),proto.mediapipe.ExecutorConfig.toObject,e),profilerConfig:(o=r.getProfilerConfig())&&proto.mediapipe.ProfilerConfig.toObject(e,o),pb_package:t.Message.getFieldWithDefault(r,19,""),type:t.Message.getFieldWithDefault(r,20,""),options:(o=r.getOptions())&&n.MediaPipeOptions.toObject(e,o),graphOptionsList:t.Message.toObjectList(r.getGraphOptionsList(),a.Any.toObject,e)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.CalculatorGraphConfig.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.CalculatorGraphConfig;return proto.mediapipe.CalculatorGraphConfig.deserializeBinaryFromReader(o,r)},proto.mediapipe.CalculatorGraphConfig.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new proto.mediapipe.CalculatorGraphConfig.Node;t.readMessage(r,proto.mediapipe.CalculatorGraphConfig.Node.deserializeBinaryFromReader),e.addNode(r);break;case 6:r=new s.PacketFactoryConfig;t.readMessage(r,s.PacketFactoryConfig.deserializeBinaryFromReader),e.addPacketFactory(r);break;case 7:r=new p.PacketGeneratorConfig;t.readMessage(r,p.PacketGeneratorConfig.deserializeBinaryFromReader),e.addPacketGenerator(r);break;case 8:r=t.readInt32();e.setNumThreads(r);break;case 9:r=new d.StatusHandlerConfig;t.readMessage(r,d.StatusHandlerConfig.deserializeBinaryFromReader),e.addStatusHandler(r);break;case 10:r=t.readString();e.addInputStream(r);break;case 15:r=t.readString();e.addOutputStream(r);break;case 16:r=t.readString();e.addInputSidePacket(r);break;case 17:r=t.readString();e.addOutputSidePacket(r);break;case 11:r=t.readInt32();e.setMaxQueueSize(r);break;case 21:r=t.readBool();e.setReportDeadlock(r);break;case 12:r=new l.InputStreamHandlerConfig;t.readMessage(r,l.InputStreamHandlerConfig.deserializeBinaryFromReader),e.setInputStreamHandler(r);break;case 13:r=new l.OutputStreamHandlerConfig;t.readMessage(r,l.OutputStreamHandlerConfig.deserializeBinaryFromReader),e.setOutputStreamHandler(r);break;case 14:r=new proto.mediapipe.ExecutorConfig;t.readMessage(r,proto.mediapipe.ExecutorConfig.deserializeBinaryFromReader),e.addExecutor(r);break;case 18:r=new proto.mediapipe.ProfilerConfig;t.readMessage(r,proto.mediapipe.ProfilerConfig.deserializeBinaryFromReader),e.setProfilerConfig(r);break;case 19:r=t.readString();e.setPackage(r);break;case 20:r=t.readString();e.setType(r);break;case 1001:r=new n.MediaPipeOptions;t.readMessage(r,n.MediaPipeOptions.deserializeBinaryFromReader),e.setOptions(r);break;case 1002:r=new a.Any;t.readMessage(r,a.Any.deserializeBinaryFromReader),e.addGraphOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.CalculatorGraphConfig.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.CalculatorGraphConfig.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.CalculatorGraphConfig.serializeBinaryToWriter=function(e,t){var r=void 0;(r=e.getNodeList()).length>0&&t.writeRepeatedMessage(1,r,proto.mediapipe.CalculatorGraphConfig.Node.serializeBinaryToWriter),(r=e.getPacketFactoryList()).length>0&&t.writeRepeatedMessage(6,r,s.PacketFactoryConfig.serializeBinaryToWriter),(r=e.getPacketGeneratorList()).length>0&&t.writeRepeatedMessage(7,r,p.PacketGeneratorConfig.serializeBinaryToWriter),0!==(r=e.getNumThreads())&&t.writeInt32(8,r),(r=e.getStatusHandlerList()).length>0&&t.writeRepeatedMessage(9,r,d.StatusHandlerConfig.serializeBinaryToWriter),(r=e.getInputStreamList()).length>0&&t.writeRepeatedString(10,r),(r=e.getOutputStreamList()).length>0&&t.writeRepeatedString(15,r),(r=e.getInputSidePacketList()).length>0&&t.writeRepeatedString(16,r),(r=e.getOutputSidePacketList()).length>0&&t.writeRepeatedString(17,r),0!==(r=e.getMaxQueueSize())&&t.writeInt32(11,r),(r=e.getReportDeadlock())&&t.writeBool(21,r),null!=(r=e.getInputStreamHandler())&&t.writeMessage(12,r,l.InputStreamHandlerConfig.serializeBinaryToWriter),null!=(r=e.getOutputStreamHandler())&&t.writeMessage(13,r,l.OutputStreamHandlerConfig.serializeBinaryToWriter),(r=e.getExecutorList()).length>0&&t.writeRepeatedMessage(14,r,proto.mediapipe.ExecutorConfig.serializeBinaryToWriter),null!=(r=e.getProfilerConfig())&&t.writeMessage(18,r,proto.mediapipe.ProfilerConfig.serializeBinaryToWriter),(r=e.getPackage()).length>0&&t.writeString(19,r),(r=e.getType()).length>0&&t.writeString(20,r),null!=(r=e.getOptions())&&t.writeMessage(1001,r,n.MediaPipeOptions.serializeBinaryToWriter),(r=e.getGraphOptionsList()).length>0&&t.writeRepeatedMessage(1002,r,a.Any.serializeBinaryToWriter)},proto.mediapipe.CalculatorGraphConfig.Node.repeatedFields_=[3,4,5,6,8,13,17,1005],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.CalculatorGraphConfig.Node.prototype.toObject=function(e){return proto.mediapipe.CalculatorGraphConfig.Node.toObject(e,this)},proto.mediapipe.CalculatorGraphConfig.Node.toObject=function(e,r){var o,n={name:t.Message.getFieldWithDefault(r,1,""),calculator:t.Message.getFieldWithDefault(r,2,""),inputStreamList:null==(o=t.Message.getRepeatedField(r,3))?void 0:o,outputStreamList:null==(o=t.Message.getRepeatedField(r,4))?void 0:o,inputSidePacketList:null==(o=t.Message.getRepeatedField(r,5))?void 0:o,outputSidePacketList:null==(o=t.Message.getRepeatedField(r,6))?void 0:o,options:(o=r.getOptions())&&i.CalculatorOptions.toObject(e,o),nodeOptionsList:t.Message.toObjectList(r.getNodeOptionsList(),a.Any.toObject,e),sourceLayer:t.Message.getFieldWithDefault(r,9,0),bufferSizeHint:t.Message.getFieldWithDefault(r,10,0),inputStreamHandler:(o=r.getInputStreamHandler())&&l.InputStreamHandlerConfig.toObject(e,o),outputStreamHandler:(o=r.getOutputStreamHandler())&&l.OutputStreamHandlerConfig.toObject(e,o),inputStreamInfoList:t.Message.toObjectList(r.getInputStreamInfoList(),proto.mediapipe.InputStreamInfo.toObject,e),executor:t.Message.getFieldWithDefault(r,14,""),profilerConfig:(o=r.getProfilerConfig())&&proto.mediapipe.ProfilerConfig.toObject(e,o),maxInFlight:t.Message.getFieldWithDefault(r,16,0),optionValueList:null==(o=t.Message.getRepeatedField(r,17))?void 0:o,externalInputList:null==(o=t.Message.getRepeatedField(r,1005))?void 0:o};return e&&(n.$jspbMessageInstance=r),n}),proto.mediapipe.CalculatorGraphConfig.Node.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.CalculatorGraphConfig.Node;return proto.mediapipe.CalculatorGraphConfig.Node.deserializeBinaryFromReader(o,r)},proto.mediapipe.CalculatorGraphConfig.Node.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setName(r);break;case 2:r=t.readString();e.setCalculator(r);break;case 3:r=t.readString();e.addInputStream(r);break;case 4:r=t.readString();e.addOutputStream(r);break;case 5:r=t.readString();e.addInputSidePacket(r);break;case 6:r=t.readString();e.addOutputSidePacket(r);break;case 7:r=new i.CalculatorOptions;t.readMessage(r,i.CalculatorOptions.deserializeBinaryFromReader),e.setOptions(r);break;case 8:r=new a.Any;t.readMessage(r,a.Any.deserializeBinaryFromReader),e.addNodeOptions(r);break;case 9:r=t.readInt32();e.setSourceLayer(r);break;case 10:r=t.readInt32();e.setBufferSizeHint(r);break;case 11:r=new l.InputStreamHandlerConfig;t.readMessage(r,l.InputStreamHandlerConfig.deserializeBinaryFromReader),e.setInputStreamHandler(r);break;case 12:r=new l.OutputStreamHandlerConfig;t.readMessage(r,l.OutputStreamHandlerConfig.deserializeBinaryFromReader),e.setOutputStreamHandler(r);break;case 13:r=new proto.mediapipe.InputStreamInfo;t.readMessage(r,proto.mediapipe.InputStreamInfo.deserializeBinaryFromReader),e.addInputStreamInfo(r);break;case 14:r=t.readString();e.setExecutor(r);break;case 15:r=new proto.mediapipe.ProfilerConfig;t.readMessage(r,proto.mediapipe.ProfilerConfig.deserializeBinaryFromReader),e.setProfilerConfig(r);break;case 16:r=t.readInt32();e.setMaxInFlight(r);break;case 17:r=t.readString();e.addOptionValue(r);break;case 1005:r=t.readString();e.addExternalInput(r);break;default:t.skipField()}}return e},proto.mediapipe.CalculatorGraphConfig.Node.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.CalculatorGraphConfig.Node.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.CalculatorGraphConfig.Node.serializeBinaryToWriter=function(e,t){var r=void 0;(r=e.getName()).length>0&&t.writeString(1,r),(r=e.getCalculator()).length>0&&t.writeString(2,r),(r=e.getInputStreamList()).length>0&&t.writeRepeatedString(3,r),(r=e.getOutputStreamList()).length>0&&t.writeRepeatedString(4,r),(r=e.getInputSidePacketList()).length>0&&t.writeRepeatedString(5,r),(r=e.getOutputSidePacketList()).length>0&&t.writeRepeatedString(6,r),null!=(r=e.getOptions())&&t.writeMessage(7,r,i.CalculatorOptions.serializeBinaryToWriter),(r=e.getNodeOptionsList()).length>0&&t.writeRepeatedMessage(8,r,a.Any.serializeBinaryToWriter),0!==(r=e.getSourceLayer())&&t.writeInt32(9,r),0!==(r=e.getBufferSizeHint())&&t.writeInt32(10,r),null!=(r=e.getInputStreamHandler())&&t.writeMessage(11,r,l.InputStreamHandlerConfig.serializeBinaryToWriter),null!=(r=e.getOutputStreamHandler())&&t.writeMessage(12,r,l.OutputStreamHandlerConfig.serializeBinaryToWriter),(r=e.getInputStreamInfoList()).length>0&&t.writeRepeatedMessage(13,r,proto.mediapipe.InputStreamInfo.serializeBinaryToWriter),(r=e.getExecutor()).length>0&&t.writeString(14,r),null!=(r=e.getProfilerConfig())&&t.writeMessage(15,r,proto.mediapipe.ProfilerConfig.serializeBinaryToWriter),0!==(r=e.getMaxInFlight())&&t.writeInt32(16,r),(r=e.getOptionValueList()).length>0&&t.writeRepeatedString(17,r),(r=e.getExternalInputList()).length>0&&t.writeRepeatedString(1005,r)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getName=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setName=function(e){return t.Message.setProto3StringField(this,1,e)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getCalculator=function(){return t.Message.getFieldWithDefault(this,2,"")},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setCalculator=function(e){return t.Message.setProto3StringField(this,2,e)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getInputStreamList=function(){return t.Message.getRepeatedField(this,3)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setInputStreamList=function(e){return t.Message.setField(this,3,e||[])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.addInputStream=function(e,r){return t.Message.addToRepeatedField(this,3,e,r)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.clearInputStreamList=function(){return this.setInputStreamList([])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getOutputStreamList=function(){return t.Message.getRepeatedField(this,4)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setOutputStreamList=function(e){return t.Message.setField(this,4,e||[])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.addOutputStream=function(e,r){return t.Message.addToRepeatedField(this,4,e,r)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.clearOutputStreamList=function(){return this.setOutputStreamList([])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getInputSidePacketList=function(){return t.Message.getRepeatedField(this,5)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setInputSidePacketList=function(e){return t.Message.setField(this,5,e||[])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.addInputSidePacket=function(e,r){return t.Message.addToRepeatedField(this,5,e,r)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.clearInputSidePacketList=function(){return this.setInputSidePacketList([])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getOutputSidePacketList=function(){return t.Message.getRepeatedField(this,6)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setOutputSidePacketList=function(e){return t.Message.setField(this,6,e||[])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.addOutputSidePacket=function(e,r){return t.Message.addToRepeatedField(this,6,e,r)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.clearOutputSidePacketList=function(){return this.setOutputSidePacketList([])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getOptions=function(){return t.Message.getWrapperField(this,i.CalculatorOptions,7)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setOptions=function(e){return t.Message.setWrapperField(this,7,e)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.clearOptions=function(){return this.setOptions(void 0)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.hasOptions=function(){return null!=t.Message.getField(this,7)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getNodeOptionsList=function(){return t.Message.getRepeatedWrapperField(this,a.Any,8)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setNodeOptionsList=function(e){return t.Message.setRepeatedWrapperField(this,8,e)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.addNodeOptions=function(e,r){return t.Message.addToRepeatedWrapperField(this,8,e,proto.google.protobuf.Any,r)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.clearNodeOptionsList=function(){return this.setNodeOptionsList([])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getSourceLayer=function(){return t.Message.getFieldWithDefault(this,9,0)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setSourceLayer=function(e){return t.Message.setProto3IntField(this,9,e)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getBufferSizeHint=function(){return t.Message.getFieldWithDefault(this,10,0)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setBufferSizeHint=function(e){return t.Message.setProto3IntField(this,10,e)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getInputStreamHandler=function(){return t.Message.getWrapperField(this,l.InputStreamHandlerConfig,11)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setInputStreamHandler=function(e){return t.Message.setWrapperField(this,11,e)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.clearInputStreamHandler=function(){return this.setInputStreamHandler(void 0)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.hasInputStreamHandler=function(){return null!=t.Message.getField(this,11)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getOutputStreamHandler=function(){return t.Message.getWrapperField(this,l.OutputStreamHandlerConfig,12)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setOutputStreamHandler=function(e){return t.Message.setWrapperField(this,12,e)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.clearOutputStreamHandler=function(){return this.setOutputStreamHandler(void 0)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.hasOutputStreamHandler=function(){return null!=t.Message.getField(this,12)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getInputStreamInfoList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.InputStreamInfo,13)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setInputStreamInfoList=function(e){return t.Message.setRepeatedWrapperField(this,13,e)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.addInputStreamInfo=function(e,r){return t.Message.addToRepeatedWrapperField(this,13,e,proto.mediapipe.InputStreamInfo,r)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.clearInputStreamInfoList=function(){return this.setInputStreamInfoList([])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getExecutor=function(){return t.Message.getFieldWithDefault(this,14,"")},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setExecutor=function(e){return t.Message.setProto3StringField(this,14,e)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getProfilerConfig=function(){return t.Message.getWrapperField(this,proto.mediapipe.ProfilerConfig,15)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setProfilerConfig=function(e){return t.Message.setWrapperField(this,15,e)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.clearProfilerConfig=function(){return this.setProfilerConfig(void 0)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.hasProfilerConfig=function(){return null!=t.Message.getField(this,15)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getMaxInFlight=function(){return t.Message.getFieldWithDefault(this,16,0)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setMaxInFlight=function(e){return t.Message.setProto3IntField(this,16,e)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getOptionValueList=function(){return t.Message.getRepeatedField(this,17)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setOptionValueList=function(e){return t.Message.setField(this,17,e||[])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.addOptionValue=function(e,r){return t.Message.addToRepeatedField(this,17,e,r)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.clearOptionValueList=function(){return this.setOptionValueList([])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.getExternalInputList=function(){return t.Message.getRepeatedField(this,1005)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.setExternalInputList=function(e){return t.Message.setField(this,1005,e||[])},proto.mediapipe.CalculatorGraphConfig.Node.prototype.addExternalInput=function(e,r){return t.Message.addToRepeatedField(this,1005,e,r)},proto.mediapipe.CalculatorGraphConfig.Node.prototype.clearExternalInputList=function(){return this.setExternalInputList([])},proto.mediapipe.CalculatorGraphConfig.prototype.getNodeList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.CalculatorGraphConfig.Node,1)},proto.mediapipe.CalculatorGraphConfig.prototype.setNodeList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.CalculatorGraphConfig.prototype.addNode=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.CalculatorGraphConfig.Node,r)},proto.mediapipe.CalculatorGraphConfig.prototype.clearNodeList=function(){return this.setNodeList([])},proto.mediapipe.CalculatorGraphConfig.prototype.getPacketFactoryList=function(){return t.Message.getRepeatedWrapperField(this,s.PacketFactoryConfig,6)},proto.mediapipe.CalculatorGraphConfig.prototype.setPacketFactoryList=function(e){return t.Message.setRepeatedWrapperField(this,6,e)},proto.mediapipe.CalculatorGraphConfig.prototype.addPacketFactory=function(e,r){return t.Message.addToRepeatedWrapperField(this,6,e,proto.mediapipe.PacketFactoryConfig,r)},proto.mediapipe.CalculatorGraphConfig.prototype.clearPacketFactoryList=function(){return this.setPacketFactoryList([])},proto.mediapipe.CalculatorGraphConfig.prototype.getPacketGeneratorList=function(){return t.Message.getRepeatedWrapperField(this,p.PacketGeneratorConfig,7)},proto.mediapipe.CalculatorGraphConfig.prototype.setPacketGeneratorList=function(e){return t.Message.setRepeatedWrapperField(this,7,e)},proto.mediapipe.CalculatorGraphConfig.prototype.addPacketGenerator=function(e,r){return t.Message.addToRepeatedWrapperField(this,7,e,proto.mediapipe.PacketGeneratorConfig,r)},proto.mediapipe.CalculatorGraphConfig.prototype.clearPacketGeneratorList=function(){return this.setPacketGeneratorList([])},proto.mediapipe.CalculatorGraphConfig.prototype.getNumThreads=function(){return t.Message.getFieldWithDefault(this,8,0)},proto.mediapipe.CalculatorGraphConfig.prototype.setNumThreads=function(e){return t.Message.setProto3IntField(this,8,e)},proto.mediapipe.CalculatorGraphConfig.prototype.getStatusHandlerList=function(){return t.Message.getRepeatedWrapperField(this,d.StatusHandlerConfig,9)},proto.mediapipe.CalculatorGraphConfig.prototype.setStatusHandlerList=function(e){return t.Message.setRepeatedWrapperField(this,9,e)},proto.mediapipe.CalculatorGraphConfig.prototype.addStatusHandler=function(e,r){return t.Message.addToRepeatedWrapperField(this,9,e,proto.mediapipe.StatusHandlerConfig,r)},proto.mediapipe.CalculatorGraphConfig.prototype.clearStatusHandlerList=function(){return this.setStatusHandlerList([])},proto.mediapipe.CalculatorGraphConfig.prototype.getInputStreamList=function(){return t.Message.getRepeatedField(this,10)},proto.mediapipe.CalculatorGraphConfig.prototype.setInputStreamList=function(e){return t.Message.setField(this,10,e||[])},proto.mediapipe.CalculatorGraphConfig.prototype.addInputStream=function(e,r){return t.Message.addToRepeatedField(this,10,e,r)},proto.mediapipe.CalculatorGraphConfig.prototype.clearInputStreamList=function(){return this.setInputStreamList([])},proto.mediapipe.CalculatorGraphConfig.prototype.getOutputStreamList=function(){return t.Message.getRepeatedField(this,15)},proto.mediapipe.CalculatorGraphConfig.prototype.setOutputStreamList=function(e){return t.Message.setField(this,15,e||[])},proto.mediapipe.CalculatorGraphConfig.prototype.addOutputStream=function(e,r){return t.Message.addToRepeatedField(this,15,e,r)},proto.mediapipe.CalculatorGraphConfig.prototype.clearOutputStreamList=function(){return this.setOutputStreamList([])},proto.mediapipe.CalculatorGraphConfig.prototype.getInputSidePacketList=function(){return t.Message.getRepeatedField(this,16)},proto.mediapipe.CalculatorGraphConfig.prototype.setInputSidePacketList=function(e){return t.Message.setField(this,16,e||[])},proto.mediapipe.CalculatorGraphConfig.prototype.addInputSidePacket=function(e,r){return t.Message.addToRepeatedField(this,16,e,r)},proto.mediapipe.CalculatorGraphConfig.prototype.clearInputSidePacketList=function(){return this.setInputSidePacketList([])},proto.mediapipe.CalculatorGraphConfig.prototype.getOutputSidePacketList=function(){return t.Message.getRepeatedField(this,17)},proto.mediapipe.CalculatorGraphConfig.prototype.setOutputSidePacketList=function(e){return t.Message.setField(this,17,e||[])},proto.mediapipe.CalculatorGraphConfig.prototype.addOutputSidePacket=function(e,r){return t.Message.addToRepeatedField(this,17,e,r)},proto.mediapipe.CalculatorGraphConfig.prototype.clearOutputSidePacketList=function(){return this.setOutputSidePacketList([])},proto.mediapipe.CalculatorGraphConfig.prototype.getMaxQueueSize=function(){return t.Message.getFieldWithDefault(this,11,0)},proto.mediapipe.CalculatorGraphConfig.prototype.setMaxQueueSize=function(e){return t.Message.setProto3IntField(this,11,e)},proto.mediapipe.CalculatorGraphConfig.prototype.getReportDeadlock=function(){return t.Message.getBooleanFieldWithDefault(this,21,!1)},proto.mediapipe.CalculatorGraphConfig.prototype.setReportDeadlock=function(e){return t.Message.setProto3BooleanField(this,21,e)},proto.mediapipe.CalculatorGraphConfig.prototype.getInputStreamHandler=function(){return t.Message.getWrapperField(this,l.InputStreamHandlerConfig,12)},proto.mediapipe.CalculatorGraphConfig.prototype.setInputStreamHandler=function(e){return t.Message.setWrapperField(this,12,e)},proto.mediapipe.CalculatorGraphConfig.prototype.clearInputStreamHandler=function(){return this.setInputStreamHandler(void 0)},proto.mediapipe.CalculatorGraphConfig.prototype.hasInputStreamHandler=function(){return null!=t.Message.getField(this,12)},proto.mediapipe.CalculatorGraphConfig.prototype.getOutputStreamHandler=function(){return t.Message.getWrapperField(this,l.OutputStreamHandlerConfig,13)},proto.mediapipe.CalculatorGraphConfig.prototype.setOutputStreamHandler=function(e){return t.Message.setWrapperField(this,13,e)},proto.mediapipe.CalculatorGraphConfig.prototype.clearOutputStreamHandler=function(){return this.setOutputStreamHandler(void 0)},proto.mediapipe.CalculatorGraphConfig.prototype.hasOutputStreamHandler=function(){return null!=t.Message.getField(this,13)},proto.mediapipe.CalculatorGraphConfig.prototype.getExecutorList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.ExecutorConfig,14)},proto.mediapipe.CalculatorGraphConfig.prototype.setExecutorList=function(e){return t.Message.setRepeatedWrapperField(this,14,e)},proto.mediapipe.CalculatorGraphConfig.prototype.addExecutor=function(e,r){return t.Message.addToRepeatedWrapperField(this,14,e,proto.mediapipe.ExecutorConfig,r)},proto.mediapipe.CalculatorGraphConfig.prototype.clearExecutorList=function(){return this.setExecutorList([])},proto.mediapipe.CalculatorGraphConfig.prototype.getProfilerConfig=function(){return t.Message.getWrapperField(this,proto.mediapipe.ProfilerConfig,18)},proto.mediapipe.CalculatorGraphConfig.prototype.setProfilerConfig=function(e){return t.Message.setWrapperField(this,18,e)},proto.mediapipe.CalculatorGraphConfig.prototype.clearProfilerConfig=function(){return this.setProfilerConfig(void 0)},proto.mediapipe.CalculatorGraphConfig.prototype.hasProfilerConfig=function(){return null!=t.Message.getField(this,18)},proto.mediapipe.CalculatorGraphConfig.prototype.getPackage=function(){return t.Message.getFieldWithDefault(this,19,"")},proto.mediapipe.CalculatorGraphConfig.prototype.setPackage=function(e){return t.Message.setProto3StringField(this,19,e)},proto.mediapipe.CalculatorGraphConfig.prototype.getType=function(){return t.Message.getFieldWithDefault(this,20,"")},proto.mediapipe.CalculatorGraphConfig.prototype.setType=function(e){return t.Message.setProto3StringField(this,20,e)},proto.mediapipe.CalculatorGraphConfig.prototype.getOptions=function(){return t.Message.getWrapperField(this,n.MediaPipeOptions,1001)},proto.mediapipe.CalculatorGraphConfig.prototype.setOptions=function(e){return t.Message.setWrapperField(this,1001,e)},proto.mediapipe.CalculatorGraphConfig.prototype.clearOptions=function(){return this.setOptions(void 0)},proto.mediapipe.CalculatorGraphConfig.prototype.hasOptions=function(){return null!=t.Message.getField(this,1001)},proto.mediapipe.CalculatorGraphConfig.prototype.getGraphOptionsList=function(){return t.Message.getRepeatedWrapperField(this,a.Any,1002)},proto.mediapipe.CalculatorGraphConfig.prototype.setGraphOptionsList=function(e){return t.Message.setRepeatedWrapperField(this,1002,e)},proto.mediapipe.CalculatorGraphConfig.prototype.addGraphOptions=function(e,r){return t.Message.addToRepeatedWrapperField(this,1002,e,proto.google.protobuf.Any,r)},proto.mediapipe.CalculatorGraphConfig.prototype.clearGraphOptionsList=function(){return this.setGraphOptionsList([])},r.object.extend(e,proto.mediapipe)}(calculator_pb);var detection_pb={},location_data_pb={},rasterization_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.Rasterization",null,o),r.exportSymbol("proto.mediapipe.Rasterization.Interval",null,o),proto.mediapipe.Rasterization=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.Rasterization.repeatedFields_,null)},r.inherits(proto.mediapipe.Rasterization,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.Rasterization.displayName="proto.mediapipe.Rasterization"),proto.mediapipe.Rasterization.Interval=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.Rasterization.Interval,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.Rasterization.Interval.displayName="proto.mediapipe.Rasterization.Interval"),proto.mediapipe.Rasterization.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.Rasterization.prototype.toObject=function(e){return proto.mediapipe.Rasterization.toObject(e,this)},proto.mediapipe.Rasterization.toObject=function(e,r){var o={intervalList:t.Message.toObjectList(r.getIntervalList(),proto.mediapipe.Rasterization.Interval.toObject,e)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.Rasterization.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.Rasterization;return proto.mediapipe.Rasterization.deserializeBinaryFromReader(o,r)},proto.mediapipe.Rasterization.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new proto.mediapipe.Rasterization.Interval;t.readMessage(r,proto.mediapipe.Rasterization.Interval.deserializeBinaryFromReader),e.addInterval(r)}else t.skipField()}return e},proto.mediapipe.Rasterization.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.Rasterization.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.Rasterization.serializeBinaryToWriter=function(e,t){var r;(r=e.getIntervalList()).length>0&&t.writeRepeatedMessage(1,r,proto.mediapipe.Rasterization.Interval.serializeBinaryToWriter)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.Rasterization.Interval.prototype.toObject=function(e){return proto.mediapipe.Rasterization.Interval.toObject(e,this)},proto.mediapipe.Rasterization.Interval.toObject=function(e,r){var o,i={y:null==(o=t.Message.getField(r,1))?void 0:o,leftX:null==(o=t.Message.getField(r,2))?void 0:o,rightX:null==(o=t.Message.getField(r,3))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.Rasterization.Interval.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.Rasterization.Interval;return proto.mediapipe.Rasterization.Interval.deserializeBinaryFromReader(o,r)},proto.mediapipe.Rasterization.Interval.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readInt32();e.setY(r);break;case 2:r=t.readInt32();e.setLeftX(r);break;case 3:r=t.readInt32();e.setRightX(r);break;default:t.skipField()}}return e},proto.mediapipe.Rasterization.Interval.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.Rasterization.Interval.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.Rasterization.Interval.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeInt32(1,o),null!=(o=t.Message.getField(e,2))&&r.writeInt32(2,o),null!=(o=t.Message.getField(e,3))&&r.writeInt32(3,o)},proto.mediapipe.Rasterization.Interval.prototype.getY=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.Rasterization.Interval.prototype.setY=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.Rasterization.Interval.prototype.clearY=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.Rasterization.Interval.prototype.hasY=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.Rasterization.Interval.prototype.getLeftX=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.Rasterization.Interval.prototype.setLeftX=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.Rasterization.Interval.prototype.clearLeftX=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.Rasterization.Interval.prototype.hasLeftX=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.Rasterization.Interval.prototype.getRightX=function(){return t.Message.getFieldWithDefault(this,3,0)},proto.mediapipe.Rasterization.Interval.prototype.setRightX=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.Rasterization.Interval.prototype.clearRightX=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.Rasterization.Interval.prototype.hasRightX=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.Rasterization.prototype.getIntervalList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.Rasterization.Interval,1)},proto.mediapipe.Rasterization.prototype.setIntervalList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.Rasterization.prototype.addInterval=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.Rasterization.Interval,r)},proto.mediapipe.Rasterization.prototype.clearIntervalList=function(){return this.setIntervalList([])},r.object.extend(e,proto.mediapipe)}(rasterization_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=rasterization_pb;r.object.extend(proto,i),r.exportSymbol("proto.mediapipe.LocationData",null,o),r.exportSymbol("proto.mediapipe.LocationData.BinaryMask",null,o),r.exportSymbol("proto.mediapipe.LocationData.BoundingBox",null,o),r.exportSymbol("proto.mediapipe.LocationData.Format",null,o),r.exportSymbol("proto.mediapipe.LocationData.RelativeBoundingBox",null,o),r.exportSymbol("proto.mediapipe.LocationData.RelativeKeypoint",null,o),proto.mediapipe.LocationData=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.LocationData.repeatedFields_,null)},r.inherits(proto.mediapipe.LocationData,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.LocationData.displayName="proto.mediapipe.LocationData"),proto.mediapipe.LocationData.BoundingBox=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.LocationData.BoundingBox,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.LocationData.BoundingBox.displayName="proto.mediapipe.LocationData.BoundingBox"),proto.mediapipe.LocationData.RelativeBoundingBox=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.LocationData.RelativeBoundingBox,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.LocationData.RelativeBoundingBox.displayName="proto.mediapipe.LocationData.RelativeBoundingBox"),proto.mediapipe.LocationData.BinaryMask=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.LocationData.BinaryMask,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.LocationData.BinaryMask.displayName="proto.mediapipe.LocationData.BinaryMask"),proto.mediapipe.LocationData.RelativeKeypoint=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.LocationData.RelativeKeypoint,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.LocationData.RelativeKeypoint.displayName="proto.mediapipe.LocationData.RelativeKeypoint"),proto.mediapipe.LocationData.repeatedFields_=[5],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.LocationData.prototype.toObject=function(e){return proto.mediapipe.LocationData.toObject(e,this)},proto.mediapipe.LocationData.toObject=function(e,r){var o,i={format:null==(o=t.Message.getField(r,1))?void 0:o,boundingBox:(o=r.getBoundingBox())&&proto.mediapipe.LocationData.BoundingBox.toObject(e,o),relativeBoundingBox:(o=r.getRelativeBoundingBox())&&proto.mediapipe.LocationData.RelativeBoundingBox.toObject(e,o),mask:(o=r.getMask())&&proto.mediapipe.LocationData.BinaryMask.toObject(e,o),relativeKeypointsList:t.Message.toObjectList(r.getRelativeKeypointsList(),proto.mediapipe.LocationData.RelativeKeypoint.toObject,e)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.LocationData.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.LocationData;return proto.mediapipe.LocationData.deserializeBinaryFromReader(o,r)},proto.mediapipe.LocationData.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readEnum();e.setFormat(r);break;case 2:r=new proto.mediapipe.LocationData.BoundingBox;t.readMessage(r,proto.mediapipe.LocationData.BoundingBox.deserializeBinaryFromReader),e.setBoundingBox(r);break;case 3:r=new proto.mediapipe.LocationData.RelativeBoundingBox;t.readMessage(r,proto.mediapipe.LocationData.RelativeBoundingBox.deserializeBinaryFromReader),e.setRelativeBoundingBox(r);break;case 4:r=new proto.mediapipe.LocationData.BinaryMask;t.readMessage(r,proto.mediapipe.LocationData.BinaryMask.deserializeBinaryFromReader),e.setMask(r);break;case 5:r=new proto.mediapipe.LocationData.RelativeKeypoint;t.readMessage(r,proto.mediapipe.LocationData.RelativeKeypoint.deserializeBinaryFromReader),e.addRelativeKeypoints(r);break;default:t.skipField()}}return e},proto.mediapipe.LocationData.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.LocationData.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.LocationData.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeEnum(1,o),null!=(o=e.getBoundingBox())&&r.writeMessage(2,o,proto.mediapipe.LocationData.BoundingBox.serializeBinaryToWriter),null!=(o=e.getRelativeBoundingBox())&&r.writeMessage(3,o,proto.mediapipe.LocationData.RelativeBoundingBox.serializeBinaryToWriter),null!=(o=e.getMask())&&r.writeMessage(4,o,proto.mediapipe.LocationData.BinaryMask.serializeBinaryToWriter),(o=e.getRelativeKeypointsList()).length>0&&r.writeRepeatedMessage(5,o,proto.mediapipe.LocationData.RelativeKeypoint.serializeBinaryToWriter)},proto.mediapipe.LocationData.Format={GLOBAL:0,BOUNDING_BOX:1,RELATIVE_BOUNDING_BOX:2,MASK:3},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.LocationData.BoundingBox.prototype.toObject=function(e){return proto.mediapipe.LocationData.BoundingBox.toObject(e,this)},proto.mediapipe.LocationData.BoundingBox.toObject=function(e,r){var o,i={xmin:null==(o=t.Message.getField(r,1))?void 0:o,ymin:null==(o=t.Message.getField(r,2))?void 0:o,width:null==(o=t.Message.getField(r,3))?void 0:o,height:null==(o=t.Message.getField(r,4))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.LocationData.BoundingBox.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.LocationData.BoundingBox;return proto.mediapipe.LocationData.BoundingBox.deserializeBinaryFromReader(o,r)},proto.mediapipe.LocationData.BoundingBox.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readInt32();e.setXmin(r);break;case 2:r=t.readInt32();e.setYmin(r);break;case 3:r=t.readInt32();e.setWidth(r);break;case 4:r=t.readInt32();e.setHeight(r);break;default:t.skipField()}}return e},proto.mediapipe.LocationData.BoundingBox.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.LocationData.BoundingBox.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.LocationData.BoundingBox.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeInt32(1,o),null!=(o=t.Message.getField(e,2))&&r.writeInt32(2,o),null!=(o=t.Message.getField(e,3))&&r.writeInt32(3,o),null!=(o=t.Message.getField(e,4))&&r.writeInt32(4,o)},proto.mediapipe.LocationData.BoundingBox.prototype.getXmin=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.LocationData.BoundingBox.prototype.setXmin=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.LocationData.BoundingBox.prototype.clearXmin=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.LocationData.BoundingBox.prototype.hasXmin=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.LocationData.BoundingBox.prototype.getYmin=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.LocationData.BoundingBox.prototype.setYmin=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.LocationData.BoundingBox.prototype.clearYmin=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.LocationData.BoundingBox.prototype.hasYmin=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.LocationData.BoundingBox.prototype.getWidth=function(){return t.Message.getFieldWithDefault(this,3,0)},proto.mediapipe.LocationData.BoundingBox.prototype.setWidth=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.LocationData.BoundingBox.prototype.clearWidth=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.LocationData.BoundingBox.prototype.hasWidth=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.LocationData.BoundingBox.prototype.getHeight=function(){return t.Message.getFieldWithDefault(this,4,0)},proto.mediapipe.LocationData.BoundingBox.prototype.setHeight=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.LocationData.BoundingBox.prototype.clearHeight=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.LocationData.BoundingBox.prototype.hasHeight=function(){return null!=t.Message.getField(this,4)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.LocationData.RelativeBoundingBox.prototype.toObject=function(e){return proto.mediapipe.LocationData.RelativeBoundingBox.toObject(e,this)},proto.mediapipe.LocationData.RelativeBoundingBox.toObject=function(e,r){var o,i={xmin:null==(o=t.Message.getOptionalFloatingPointField(r,1))?void 0:o,ymin:null==(o=t.Message.getOptionalFloatingPointField(r,2))?void 0:o,width:null==(o=t.Message.getOptionalFloatingPointField(r,3))?void 0:o,height:null==(o=t.Message.getOptionalFloatingPointField(r,4))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.LocationData.RelativeBoundingBox.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.LocationData.RelativeBoundingBox;return proto.mediapipe.LocationData.RelativeBoundingBox.deserializeBinaryFromReader(o,r)},proto.mediapipe.LocationData.RelativeBoundingBox.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readFloat();e.setXmin(r);break;case 2:r=t.readFloat();e.setYmin(r);break;case 3:r=t.readFloat();e.setWidth(r);break;case 4:r=t.readFloat();e.setHeight(r);break;default:t.skipField()}}return e},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.LocationData.RelativeBoundingBox.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.LocationData.RelativeBoundingBox.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeFloat(1,o),null!=(o=t.Message.getField(e,2))&&r.writeFloat(2,o),null!=(o=t.Message.getField(e,3))&&r.writeFloat(3,o),null!=(o=t.Message.getField(e,4))&&r.writeFloat(4,o)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.getXmin=function(){return t.Message.getFloatingPointFieldWithDefault(this,1,0)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.setXmin=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.clearXmin=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.hasXmin=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.getYmin=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,0)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.setYmin=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.clearYmin=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.hasYmin=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.getWidth=function(){return t.Message.getFloatingPointFieldWithDefault(this,3,0)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.setWidth=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.clearWidth=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.hasWidth=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.getHeight=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,0)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.setHeight=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.clearHeight=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.LocationData.RelativeBoundingBox.prototype.hasHeight=function(){return null!=t.Message.getField(this,4)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.LocationData.BinaryMask.prototype.toObject=function(e){return proto.mediapipe.LocationData.BinaryMask.toObject(e,this)},proto.mediapipe.LocationData.BinaryMask.toObject=function(e,r){var o,a={width:null==(o=t.Message.getField(r,1))?void 0:o,height:null==(o=t.Message.getField(r,2))?void 0:o,rasterization:(o=r.getRasterization())&&i.Rasterization.toObject(e,o)};return e&&(a.$jspbMessageInstance=r),a}),proto.mediapipe.LocationData.BinaryMask.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.LocationData.BinaryMask;return proto.mediapipe.LocationData.BinaryMask.deserializeBinaryFromReader(o,r)},proto.mediapipe.LocationData.BinaryMask.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readInt32();e.setWidth(r);break;case 2:r=t.readInt32();e.setHeight(r);break;case 3:r=new i.Rasterization;t.readMessage(r,i.Rasterization.deserializeBinaryFromReader),e.setRasterization(r);break;default:t.skipField()}}return e},proto.mediapipe.LocationData.BinaryMask.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.LocationData.BinaryMask.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.LocationData.BinaryMask.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeInt32(1,o),null!=(o=t.Message.getField(e,2))&&r.writeInt32(2,o),null!=(o=e.getRasterization())&&r.writeMessage(3,o,i.Rasterization.serializeBinaryToWriter)},proto.mediapipe.LocationData.BinaryMask.prototype.getWidth=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.LocationData.BinaryMask.prototype.setWidth=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.LocationData.BinaryMask.prototype.clearWidth=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.LocationData.BinaryMask.prototype.hasWidth=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.LocationData.BinaryMask.prototype.getHeight=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.LocationData.BinaryMask.prototype.setHeight=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.LocationData.BinaryMask.prototype.clearHeight=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.LocationData.BinaryMask.prototype.hasHeight=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.LocationData.BinaryMask.prototype.getRasterization=function(){return t.Message.getWrapperField(this,i.Rasterization,3)},proto.mediapipe.LocationData.BinaryMask.prototype.setRasterization=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.LocationData.BinaryMask.prototype.clearRasterization=function(){return this.setRasterization(void 0)},proto.mediapipe.LocationData.BinaryMask.prototype.hasRasterization=function(){return null!=t.Message.getField(this,3)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.LocationData.RelativeKeypoint.prototype.toObject=function(e){return proto.mediapipe.LocationData.RelativeKeypoint.toObject(e,this)},proto.mediapipe.LocationData.RelativeKeypoint.toObject=function(e,r){var o,i={x:null==(o=t.Message.getOptionalFloatingPointField(r,1))?void 0:o,y:null==(o=t.Message.getOptionalFloatingPointField(r,2))?void 0:o,keypointLabel:null==(o=t.Message.getField(r,3))?void 0:o,score:null==(o=t.Message.getOptionalFloatingPointField(r,4))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.LocationData.RelativeKeypoint.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.LocationData.RelativeKeypoint;return proto.mediapipe.LocationData.RelativeKeypoint.deserializeBinaryFromReader(o,r)},proto.mediapipe.LocationData.RelativeKeypoint.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readFloat();e.setX(r);break;case 2:r=t.readFloat();e.setY(r);break;case 3:r=t.readString();e.setKeypointLabel(r);break;case 4:r=t.readFloat();e.setScore(r);break;default:t.skipField()}}return e},proto.mediapipe.LocationData.RelativeKeypoint.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.LocationData.RelativeKeypoint.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.LocationData.RelativeKeypoint.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeFloat(1,o),null!=(o=t.Message.getField(e,2))&&r.writeFloat(2,o),null!=(o=t.Message.getField(e,3))&&r.writeString(3,o),null!=(o=t.Message.getField(e,4))&&r.writeFloat(4,o)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.getX=function(){return t.Message.getFloatingPointFieldWithDefault(this,1,0)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.setX=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.clearX=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.hasX=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.getY=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,0)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.setY=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.clearY=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.hasY=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.getKeypointLabel=function(){return t.Message.getFieldWithDefault(this,3,"")},proto.mediapipe.LocationData.RelativeKeypoint.prototype.setKeypointLabel=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.clearKeypointLabel=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.hasKeypointLabel=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.getScore=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,0)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.setScore=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.clearScore=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.LocationData.RelativeKeypoint.prototype.hasScore=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.LocationData.prototype.getFormat=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.LocationData.prototype.setFormat=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.LocationData.prototype.clearFormat=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.LocationData.prototype.hasFormat=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.LocationData.prototype.getBoundingBox=function(){return t.Message.getWrapperField(this,proto.mediapipe.LocationData.BoundingBox,2)},proto.mediapipe.LocationData.prototype.setBoundingBox=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.LocationData.prototype.clearBoundingBox=function(){return this.setBoundingBox(void 0)},proto.mediapipe.LocationData.prototype.hasBoundingBox=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.LocationData.prototype.getRelativeBoundingBox=function(){return t.Message.getWrapperField(this,proto.mediapipe.LocationData.RelativeBoundingBox,3)},proto.mediapipe.LocationData.prototype.setRelativeBoundingBox=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.LocationData.prototype.clearRelativeBoundingBox=function(){return this.setRelativeBoundingBox(void 0)},proto.mediapipe.LocationData.prototype.hasRelativeBoundingBox=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.LocationData.prototype.getMask=function(){return t.Message.getWrapperField(this,proto.mediapipe.LocationData.BinaryMask,4)},proto.mediapipe.LocationData.prototype.setMask=function(e){return t.Message.setWrapperField(this,4,e)},proto.mediapipe.LocationData.prototype.clearMask=function(){return this.setMask(void 0)},proto.mediapipe.LocationData.prototype.hasMask=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.LocationData.prototype.getRelativeKeypointsList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.LocationData.RelativeKeypoint,5)},proto.mediapipe.LocationData.prototype.setRelativeKeypointsList=function(e){return t.Message.setRepeatedWrapperField(this,5,e)},proto.mediapipe.LocationData.prototype.addRelativeKeypoints=function(e,r){return t.Message.addToRepeatedWrapperField(this,5,e,proto.mediapipe.LocationData.RelativeKeypoint,r)},proto.mediapipe.LocationData.prototype.clearRelativeKeypointsList=function(){return this.setRelativeKeypointsList([])},r.object.extend(e,proto.mediapipe)}(location_data_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=location_data_pb;r.object.extend(proto,i),r.exportSymbol("proto.mediapipe.Detection",null,o),r.exportSymbol("proto.mediapipe.Detection.AssociatedDetection",null,o),r.exportSymbol("proto.mediapipe.DetectionList",null,o),proto.mediapipe.Detection=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.Detection.repeatedFields_,null)},r.inherits(proto.mediapipe.Detection,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.Detection.displayName="proto.mediapipe.Detection"),proto.mediapipe.Detection.AssociatedDetection=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.Detection.AssociatedDetection,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.Detection.AssociatedDetection.displayName="proto.mediapipe.Detection.AssociatedDetection"),proto.mediapipe.DetectionList=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.DetectionList.repeatedFields_,null)},r.inherits(proto.mediapipe.DetectionList,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.DetectionList.displayName="proto.mediapipe.DetectionList"),proto.mediapipe.Detection.repeatedFields_=[1,2,3,8,9],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.Detection.prototype.toObject=function(e){return proto.mediapipe.Detection.toObject(e,this)},proto.mediapipe.Detection.toObject=function(e,r){var o,a={labelList:null==(o=t.Message.getRepeatedField(r,1))?void 0:o,labelIdList:null==(o=t.Message.getRepeatedField(r,2))?void 0:o,scoreList:null==(o=t.Message.getRepeatedFloatingPointField(r,3))?void 0:o,locationData:(o=r.getLocationData())&&i.LocationData.toObject(e,o),featureTag:null==(o=t.Message.getField(r,5))?void 0:o,trackId:null==(o=t.Message.getField(r,6))?void 0:o,detectionId:null==(o=t.Message.getField(r,7))?void 0:o,associatedDetectionsList:t.Message.toObjectList(r.getAssociatedDetectionsList(),proto.mediapipe.Detection.AssociatedDetection.toObject,e),displayNameList:null==(o=t.Message.getRepeatedField(r,9))?void 0:o,timestampUsec:null==(o=t.Message.getField(r,10))?void 0:o};return e&&(a.$jspbMessageInstance=r),a}),proto.mediapipe.Detection.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.Detection;return proto.mediapipe.Detection.deserializeBinaryFromReader(o,r)},proto.mediapipe.Detection.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.addLabel(r);break;case 2:for(var o=t.isDelimited()?t.readPackedInt32():[t.readInt32()],a=0;a0&&r.writeRepeatedString(1,o),(o=e.getLabelIdList()).length>0&&r.writePackedInt32(2,o),(o=e.getScoreList()).length>0&&r.writePackedFloat(3,o),null!=(o=e.getLocationData())&&r.writeMessage(4,o,i.LocationData.serializeBinaryToWriter),null!=(o=t.Message.getField(e,5))&&r.writeString(5,o),null!=(o=t.Message.getField(e,6))&&r.writeString(6,o),null!=(o=t.Message.getField(e,7))&&r.writeInt64(7,o),(o=e.getAssociatedDetectionsList()).length>0&&r.writeRepeatedMessage(8,o,proto.mediapipe.Detection.AssociatedDetection.serializeBinaryToWriter),(o=e.getDisplayNameList()).length>0&&r.writeRepeatedString(9,o),null!=(o=t.Message.getField(e,10))&&r.writeInt64(10,o)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.Detection.AssociatedDetection.prototype.toObject=function(e){return proto.mediapipe.Detection.AssociatedDetection.toObject(e,this)},proto.mediapipe.Detection.AssociatedDetection.toObject=function(e,r){var o,i={id:null==(o=t.Message.getField(r,1))?void 0:o,confidence:null==(o=t.Message.getOptionalFloatingPointField(r,2))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.Detection.AssociatedDetection.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.Detection.AssociatedDetection;return proto.mediapipe.Detection.AssociatedDetection.deserializeBinaryFromReader(o,r)},proto.mediapipe.Detection.AssociatedDetection.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readInt32();e.setId(r);break;case 2:r=t.readFloat();e.setConfidence(r);break;default:t.skipField()}}return e},proto.mediapipe.Detection.AssociatedDetection.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.Detection.AssociatedDetection.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.Detection.AssociatedDetection.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeInt32(1,o),null!=(o=t.Message.getField(e,2))&&r.writeFloat(2,o)},proto.mediapipe.Detection.AssociatedDetection.prototype.getId=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.Detection.AssociatedDetection.prototype.setId=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.Detection.AssociatedDetection.prototype.clearId=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.Detection.AssociatedDetection.prototype.hasId=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.Detection.AssociatedDetection.prototype.getConfidence=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,0)},proto.mediapipe.Detection.AssociatedDetection.prototype.setConfidence=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.Detection.AssociatedDetection.prototype.clearConfidence=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.Detection.AssociatedDetection.prototype.hasConfidence=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.Detection.prototype.getLabelList=function(){return t.Message.getRepeatedField(this,1)},proto.mediapipe.Detection.prototype.setLabelList=function(e){return t.Message.setField(this,1,e||[])},proto.mediapipe.Detection.prototype.addLabel=function(e,r){return t.Message.addToRepeatedField(this,1,e,r)},proto.mediapipe.Detection.prototype.clearLabelList=function(){return this.setLabelList([])},proto.mediapipe.Detection.prototype.getLabelIdList=function(){return t.Message.getRepeatedField(this,2)},proto.mediapipe.Detection.prototype.setLabelIdList=function(e){return t.Message.setField(this,2,e||[])},proto.mediapipe.Detection.prototype.addLabelId=function(e,r){return t.Message.addToRepeatedField(this,2,e,r)},proto.mediapipe.Detection.prototype.clearLabelIdList=function(){return this.setLabelIdList([])},proto.mediapipe.Detection.prototype.getScoreList=function(){return t.Message.getRepeatedFloatingPointField(this,3)},proto.mediapipe.Detection.prototype.setScoreList=function(e){return t.Message.setField(this,3,e||[])},proto.mediapipe.Detection.prototype.addScore=function(e,r){return t.Message.addToRepeatedField(this,3,e,r)},proto.mediapipe.Detection.prototype.clearScoreList=function(){return this.setScoreList([])},proto.mediapipe.Detection.prototype.getLocationData=function(){return t.Message.getWrapperField(this,i.LocationData,4)},proto.mediapipe.Detection.prototype.setLocationData=function(e){return t.Message.setWrapperField(this,4,e)},proto.mediapipe.Detection.prototype.clearLocationData=function(){return this.setLocationData(void 0)},proto.mediapipe.Detection.prototype.hasLocationData=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.Detection.prototype.getFeatureTag=function(){return t.Message.getFieldWithDefault(this,5,"")},proto.mediapipe.Detection.prototype.setFeatureTag=function(e){return t.Message.setField(this,5,e)},proto.mediapipe.Detection.prototype.clearFeatureTag=function(){return t.Message.setField(this,5,void 0)},proto.mediapipe.Detection.prototype.hasFeatureTag=function(){return null!=t.Message.getField(this,5)},proto.mediapipe.Detection.prototype.getTrackId=function(){return t.Message.getFieldWithDefault(this,6,"")},proto.mediapipe.Detection.prototype.setTrackId=function(e){return t.Message.setField(this,6,e)},proto.mediapipe.Detection.prototype.clearTrackId=function(){return t.Message.setField(this,6,void 0)},proto.mediapipe.Detection.prototype.hasTrackId=function(){return null!=t.Message.getField(this,6)},proto.mediapipe.Detection.prototype.getDetectionId=function(){return t.Message.getFieldWithDefault(this,7,0)},proto.mediapipe.Detection.prototype.setDetectionId=function(e){return t.Message.setField(this,7,e)},proto.mediapipe.Detection.prototype.clearDetectionId=function(){return t.Message.setField(this,7,void 0)},proto.mediapipe.Detection.prototype.hasDetectionId=function(){return null!=t.Message.getField(this,7)},proto.mediapipe.Detection.prototype.getAssociatedDetectionsList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.Detection.AssociatedDetection,8)},proto.mediapipe.Detection.prototype.setAssociatedDetectionsList=function(e){return t.Message.setRepeatedWrapperField(this,8,e)},proto.mediapipe.Detection.prototype.addAssociatedDetections=function(e,r){return t.Message.addToRepeatedWrapperField(this,8,e,proto.mediapipe.Detection.AssociatedDetection,r)},proto.mediapipe.Detection.prototype.clearAssociatedDetectionsList=function(){return this.setAssociatedDetectionsList([])},proto.mediapipe.Detection.prototype.getDisplayNameList=function(){return t.Message.getRepeatedField(this,9)},proto.mediapipe.Detection.prototype.setDisplayNameList=function(e){return t.Message.setField(this,9,e||[])},proto.mediapipe.Detection.prototype.addDisplayName=function(e,r){return t.Message.addToRepeatedField(this,9,e,r)},proto.mediapipe.Detection.prototype.clearDisplayNameList=function(){return this.setDisplayNameList([])},proto.mediapipe.Detection.prototype.getTimestampUsec=function(){return t.Message.getFieldWithDefault(this,10,0)},proto.mediapipe.Detection.prototype.setTimestampUsec=function(e){return t.Message.setField(this,10,e)},proto.mediapipe.Detection.prototype.clearTimestampUsec=function(){return t.Message.setField(this,10,void 0)},proto.mediapipe.Detection.prototype.hasTimestampUsec=function(){return null!=t.Message.getField(this,10)},proto.mediapipe.DetectionList.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.DetectionList.prototype.toObject=function(e){return proto.mediapipe.DetectionList.toObject(e,this)},proto.mediapipe.DetectionList.toObject=function(e,r){var o={detectionList:t.Message.toObjectList(r.getDetectionList(),proto.mediapipe.Detection.toObject,e)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.DetectionList.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.DetectionList;return proto.mediapipe.DetectionList.deserializeBinaryFromReader(o,r)},proto.mediapipe.DetectionList.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new proto.mediapipe.Detection;t.readMessage(r,proto.mediapipe.Detection.deserializeBinaryFromReader),e.addDetection(r)}else t.skipField()}return e},proto.mediapipe.DetectionList.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.DetectionList.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.DetectionList.serializeBinaryToWriter=function(e,t){var r;(r=e.getDetectionList()).length>0&&t.writeRepeatedMessage(1,r,proto.mediapipe.Detection.serializeBinaryToWriter)},proto.mediapipe.DetectionList.prototype.getDetectionList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.Detection,1)},proto.mediapipe.DetectionList.prototype.setDetectionList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.DetectionList.prototype.addDetection=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.Detection,r)},proto.mediapipe.DetectionList.prototype.clearDetectionList=function(){return this.setDetectionList([])},r.object.extend(e,proto.mediapipe)}(detection_pb);var base_options_pb={},acceleration_pb={},inference_calculator_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a),r.exportSymbol("proto.mediapipe.InferenceCalculatorOptions",null,o),r.exportSymbol("proto.mediapipe.InferenceCalculatorOptions.Delegate",null,o),r.exportSymbol("proto.mediapipe.InferenceCalculatorOptions.Delegate.DelegateCase",null,o),r.exportSymbol("proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu",null,o),r.exportSymbol("proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.Api",null,o),r.exportSymbol("proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.InferenceUsage",null,o),r.exportSymbol("proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi",null,o),r.exportSymbol("proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite",null,o),r.exportSymbol("proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack",null,o),proto.mediapipe.InferenceCalculatorOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.InferenceCalculatorOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.InferenceCalculatorOptions.displayName="proto.mediapipe.InferenceCalculatorOptions"),proto.mediapipe.InferenceCalculatorOptions.Delegate=function(e){t.Message.initialize(this,e,0,-1,null,proto.mediapipe.InferenceCalculatorOptions.Delegate.oneofGroups_)},r.inherits(proto.mediapipe.InferenceCalculatorOptions.Delegate,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.InferenceCalculatorOptions.Delegate.displayName="proto.mediapipe.InferenceCalculatorOptions.Delegate"),proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.displayName="proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite"),proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.displayName="proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu"),proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.displayName="proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi"),proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.displayName="proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.InferenceCalculatorOptions.prototype.toObject=function(e){return proto.mediapipe.InferenceCalculatorOptions.toObject(e,this)},proto.mediapipe.InferenceCalculatorOptions.toObject=function(e,r){var o,i={modelPath:null==(o=t.Message.getField(r,1))?void 0:o,useGpu:t.Message.getBooleanFieldWithDefault(r,2,!1),useNnapi:t.Message.getBooleanFieldWithDefault(r,3,!1),cpuNumThread:t.Message.getFieldWithDefault(r,4,-1),delegate:(o=r.getDelegate())&&proto.mediapipe.InferenceCalculatorOptions.Delegate.toObject(e,o)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.InferenceCalculatorOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.InferenceCalculatorOptions;return proto.mediapipe.InferenceCalculatorOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.InferenceCalculatorOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setModelPath(r);break;case 2:r=t.readBool();e.setUseGpu(r);break;case 3:r=t.readBool();e.setUseNnapi(r);break;case 4:r=t.readInt32();e.setCpuNumThread(r);break;case 5:r=new proto.mediapipe.InferenceCalculatorOptions.Delegate;t.readMessage(r,proto.mediapipe.InferenceCalculatorOptions.Delegate.deserializeBinaryFromReader),e.setDelegate(r);break;default:t.skipField()}}return e},proto.mediapipe.InferenceCalculatorOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.InferenceCalculatorOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.InferenceCalculatorOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeString(1,o),null!=(o=t.Message.getField(e,2))&&r.writeBool(2,o),null!=(o=t.Message.getField(e,3))&&r.writeBool(3,o),null!=(o=t.Message.getField(e,4))&&r.writeInt32(4,o),null!=(o=e.getDelegate())&&r.writeMessage(5,o,proto.mediapipe.InferenceCalculatorOptions.Delegate.serializeBinaryToWriter)},proto.mediapipe.InferenceCalculatorOptions.Delegate.oneofGroups_=[[1,2,3,4]],proto.mediapipe.InferenceCalculatorOptions.Delegate.DelegateCase={DELEGATE_NOT_SET:0,TFLITE:1,GPU:2,NNAPI:3,XNNPACK:4},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.getDelegateCase=function(){return t.Message.computeOneofCase(this,proto.mediapipe.InferenceCalculatorOptions.Delegate.oneofGroups_[0])},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.toObject=function(e){return proto.mediapipe.InferenceCalculatorOptions.Delegate.toObject(e,this)},proto.mediapipe.InferenceCalculatorOptions.Delegate.toObject=function(e,t){var r,o={tflite:(r=t.getTflite())&&proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.toObject(e,r),gpu:(r=t.getGpu())&&proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.toObject(e,r),nnapi:(r=t.getNnapi())&&proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.toObject(e,r),xnnpack:(r=t.getXnnpack())&&proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.InferenceCalculatorOptions.Delegate.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.InferenceCalculatorOptions.Delegate;return proto.mediapipe.InferenceCalculatorOptions.Delegate.deserializeBinaryFromReader(o,r)},proto.mediapipe.InferenceCalculatorOptions.Delegate.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite;t.readMessage(r,proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.deserializeBinaryFromReader),e.setTflite(r);break;case 2:r=new proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu;t.readMessage(r,proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.deserializeBinaryFromReader),e.setGpu(r);break;case 3:r=new proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi;t.readMessage(r,proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.deserializeBinaryFromReader),e.setNnapi(r);break;case 4:r=new proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack;t.readMessage(r,proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.deserializeBinaryFromReader),e.setXnnpack(r);break;default:t.skipField()}}return e},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.InferenceCalculatorOptions.Delegate.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.InferenceCalculatorOptions.Delegate.serializeBinaryToWriter=function(e,t){var r=void 0;null!=(r=e.getTflite())&&t.writeMessage(1,r,proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.serializeBinaryToWriter),null!=(r=e.getGpu())&&t.writeMessage(2,r,proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.serializeBinaryToWriter),null!=(r=e.getNnapi())&&t.writeMessage(3,r,proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.serializeBinaryToWriter),null!=(r=e.getXnnpack())&&t.writeMessage(4,r,proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.serializeBinaryToWriter)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.prototype.toObject=function(e){return proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.toObject(e,this)},proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.toObject=function(e,t){var r={};return e&&(r.$jspbMessageInstance=t),r}),proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite;return proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.deserializeBinaryFromReader(o,r)},proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){t.getFieldNumber();t.skipField()}return e},proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite.serializeBinaryToWriter=function(e,t){},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.toObject=function(e){return proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.toObject(e,this)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.toObject=function(e,r){var o,i={useAdvancedGpuApi:t.Message.getBooleanFieldWithDefault(r,1,!1),api:t.Message.getFieldWithDefault(r,4,0),allowPrecisionLoss:t.Message.getBooleanFieldWithDefault(r,3,!0),cachedKernelPath:null==(o=t.Message.getField(r,2))?void 0:o,serializedModelDir:null==(o=t.Message.getField(r,7))?void 0:o,modelToken:null==(o=t.Message.getField(r,8))?void 0:o,usage:t.Message.getFieldWithDefault(r,5,2)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu;return proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.deserializeBinaryFromReader(o,r)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readBool();e.setUseAdvancedGpuApi(r);break;case 4:r=t.readEnum();e.setApi(r);break;case 3:r=t.readBool();e.setAllowPrecisionLoss(r);break;case 2:r=t.readString();e.setCachedKernelPath(r);break;case 7:r=t.readString();e.setSerializedModelDir(r);break;case 8:r=t.readString();e.setModelToken(r);break;case 5:r=t.readEnum();e.setUsage(r);break;default:t.skipField()}}return e},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeBool(1,o),null!=(o=t.Message.getField(e,4))&&r.writeEnum(4,o),null!=(o=t.Message.getField(e,3))&&r.writeBool(3,o),null!=(o=t.Message.getField(e,2))&&r.writeString(2,o),null!=(o=t.Message.getField(e,7))&&r.writeString(7,o),null!=(o=t.Message.getField(e,8))&&r.writeString(8,o),null!=(o=t.Message.getField(e,5))&&r.writeEnum(5,o)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.Api={ANY:0,OPENGL:1,OPENCL:2},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.InferenceUsage={UNSPECIFIED:0,FAST_SINGLE_ANSWER:1,SUSTAINED_SPEED:2},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.getUseAdvancedGpuApi=function(){return t.Message.getBooleanFieldWithDefault(this,1,!1)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.setUseAdvancedGpuApi=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.clearUseAdvancedGpuApi=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.hasUseAdvancedGpuApi=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.getApi=function(){return t.Message.getFieldWithDefault(this,4,0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.setApi=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.clearApi=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.hasApi=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.getAllowPrecisionLoss=function(){return t.Message.getBooleanFieldWithDefault(this,3,!0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.setAllowPrecisionLoss=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.clearAllowPrecisionLoss=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.hasAllowPrecisionLoss=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.getCachedKernelPath=function(){return t.Message.getFieldWithDefault(this,2,"")},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.setCachedKernelPath=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.clearCachedKernelPath=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.hasCachedKernelPath=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.getSerializedModelDir=function(){return t.Message.getFieldWithDefault(this,7,"")},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.setSerializedModelDir=function(e){return t.Message.setField(this,7,e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.clearSerializedModelDir=function(){return t.Message.setField(this,7,void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.hasSerializedModelDir=function(){return null!=t.Message.getField(this,7)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.getModelToken=function(){return t.Message.getFieldWithDefault(this,8,"")},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.setModelToken=function(e){return t.Message.setField(this,8,e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.clearModelToken=function(){return t.Message.setField(this,8,void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.hasModelToken=function(){return null!=t.Message.getField(this,8)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.getUsage=function(){return t.Message.getFieldWithDefault(this,5,2)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.setUsage=function(e){return t.Message.setField(this,5,e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.clearUsage=function(){return t.Message.setField(this,5,void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu.prototype.hasUsage=function(){return null!=t.Message.getField(this,5)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.toObject=function(e){return proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.toObject(e,this)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.toObject=function(e,r){var o,i={cacheDir:null==(o=t.Message.getField(r,1))?void 0:o,modelToken:null==(o=t.Message.getField(r,2))?void 0:o,acceleratorName:null==(o=t.Message.getField(r,3))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi;return proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.deserializeBinaryFromReader(o,r)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setCacheDir(r);break;case 2:r=t.readString();e.setModelToken(r);break;case 3:r=t.readString();e.setAcceleratorName(r);break;default:t.skipField()}}return e},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeString(1,o),null!=(o=t.Message.getField(e,2))&&r.writeString(2,o),null!=(o=t.Message.getField(e,3))&&r.writeString(3,o)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.getCacheDir=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.setCacheDir=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.clearCacheDir=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.hasCacheDir=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.getModelToken=function(){return t.Message.getFieldWithDefault(this,2,"")},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.setModelToken=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.clearModelToken=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.hasModelToken=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.getAcceleratorName=function(){return t.Message.getFieldWithDefault(this,3,"")},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.setAcceleratorName=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.clearAcceleratorName=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi.prototype.hasAcceleratorName=function(){return null!=t.Message.getField(this,3)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.prototype.toObject=function(e){return proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.toObject(e,this)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.toObject=function(e,r){var o={numThreads:t.Message.getFieldWithDefault(r,1,-1)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack;return proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.deserializeBinaryFromReader(o,r)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=t.readInt32();e.setNumThreads(r)}else t.skipField()}return e},proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.serializeBinaryToWriter=function(e,r){var o;null!=(o=t.Message.getField(e,1))&&r.writeInt32(1,o)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.prototype.getNumThreads=function(){return t.Message.getFieldWithDefault(this,1,-1)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.prototype.setNumThreads=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.prototype.clearNumThreads=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack.prototype.hasNumThreads=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.getTflite=function(){return t.Message.getWrapperField(this,proto.mediapipe.InferenceCalculatorOptions.Delegate.TfLite,1)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.setTflite=function(e){return t.Message.setOneofWrapperField(this,1,proto.mediapipe.InferenceCalculatorOptions.Delegate.oneofGroups_[0],e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.clearTflite=function(){return this.setTflite(void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.hasTflite=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.getGpu=function(){return t.Message.getWrapperField(this,proto.mediapipe.InferenceCalculatorOptions.Delegate.Gpu,2)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.setGpu=function(e){return t.Message.setOneofWrapperField(this,2,proto.mediapipe.InferenceCalculatorOptions.Delegate.oneofGroups_[0],e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.clearGpu=function(){return this.setGpu(void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.hasGpu=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.getNnapi=function(){return t.Message.getWrapperField(this,proto.mediapipe.InferenceCalculatorOptions.Delegate.Nnapi,3)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.setNnapi=function(e){return t.Message.setOneofWrapperField(this,3,proto.mediapipe.InferenceCalculatorOptions.Delegate.oneofGroups_[0],e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.clearNnapi=function(){return this.setNnapi(void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.hasNnapi=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.getXnnpack=function(){return t.Message.getWrapperField(this,proto.mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack,4)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.setXnnpack=function(e){return t.Message.setOneofWrapperField(this,4,proto.mediapipe.InferenceCalculatorOptions.Delegate.oneofGroups_[0],e)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.clearXnnpack=function(){return this.setXnnpack(void 0)},proto.mediapipe.InferenceCalculatorOptions.Delegate.prototype.hasXnnpack=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.InferenceCalculatorOptions.ext=new t.ExtensionFieldInfo(336783863,{ext:0},proto.mediapipe.InferenceCalculatorOptions,proto.mediapipe.InferenceCalculatorOptions.toObject,0),a.CalculatorOptions.extensionsBinary[336783863]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.InferenceCalculatorOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.InferenceCalculatorOptions.serializeBinaryToWriter,proto.mediapipe.InferenceCalculatorOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[336783863]=proto.mediapipe.InferenceCalculatorOptions.ext,proto.mediapipe.InferenceCalculatorOptions.prototype.getModelPath=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.InferenceCalculatorOptions.prototype.setModelPath=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.InferenceCalculatorOptions.prototype.clearModelPath=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.InferenceCalculatorOptions.prototype.hasModelPath=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.InferenceCalculatorOptions.prototype.getUseGpu=function(){return t.Message.getBooleanFieldWithDefault(this,2,!1)},proto.mediapipe.InferenceCalculatorOptions.prototype.setUseGpu=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.InferenceCalculatorOptions.prototype.clearUseGpu=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.InferenceCalculatorOptions.prototype.hasUseGpu=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.InferenceCalculatorOptions.prototype.getUseNnapi=function(){return t.Message.getBooleanFieldWithDefault(this,3,!1)},proto.mediapipe.InferenceCalculatorOptions.prototype.setUseNnapi=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.InferenceCalculatorOptions.prototype.clearUseNnapi=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.InferenceCalculatorOptions.prototype.hasUseNnapi=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.InferenceCalculatorOptions.prototype.getCpuNumThread=function(){return t.Message.getFieldWithDefault(this,4,-1)},proto.mediapipe.InferenceCalculatorOptions.prototype.setCpuNumThread=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.InferenceCalculatorOptions.prototype.clearCpuNumThread=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.InferenceCalculatorOptions.prototype.hasCpuNumThread=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.InferenceCalculatorOptions.prototype.getDelegate=function(){return t.Message.getWrapperField(this,proto.mediapipe.InferenceCalculatorOptions.Delegate,5)},proto.mediapipe.InferenceCalculatorOptions.prototype.setDelegate=function(e){return t.Message.setWrapperField(this,5,e)},proto.mediapipe.InferenceCalculatorOptions.prototype.clearDelegate=function(){return this.setDelegate(void 0)},proto.mediapipe.InferenceCalculatorOptions.prototype.hasDelegate=function(){return null!=t.Message.getField(this,5)},proto.mediapipe.InferenceCalculatorOptions.ext=new t.ExtensionFieldInfo(336783863,{ext:0},proto.mediapipe.InferenceCalculatorOptions,proto.mediapipe.InferenceCalculatorOptions.toObject,0),a.CalculatorOptions.extensionsBinary[336783863]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.InferenceCalculatorOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.InferenceCalculatorOptions.serializeBinaryToWriter,proto.mediapipe.InferenceCalculatorOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[336783863]=proto.mediapipe.InferenceCalculatorOptions.ext,r.object.extend(e,proto.mediapipe)}(inference_calculator_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=inference_calculator_pb;r.object.extend(proto,i),r.exportSymbol("proto.mediapipe.tasks.core.proto.Acceleration",null,o),r.exportSymbol("proto.mediapipe.tasks.core.proto.Acceleration.DelegateCase",null,o),proto.mediapipe.tasks.core.proto.Acceleration=function(e){t.Message.initialize(this,e,0,-1,null,proto.mediapipe.tasks.core.proto.Acceleration.oneofGroups_)},r.inherits(proto.mediapipe.tasks.core.proto.Acceleration,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.core.proto.Acceleration.displayName="proto.mediapipe.tasks.core.proto.Acceleration"),proto.mediapipe.tasks.core.proto.Acceleration.oneofGroups_=[[1,2,4,5]],proto.mediapipe.tasks.core.proto.Acceleration.DelegateCase={DELEGATE_NOT_SET:0,XNNPACK:1,GPU:2,TFLITE:4,NNAPI:5},proto.mediapipe.tasks.core.proto.Acceleration.prototype.getDelegateCase=function(){return t.Message.computeOneofCase(this,proto.mediapipe.tasks.core.proto.Acceleration.oneofGroups_[0])},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.core.proto.Acceleration.prototype.toObject=function(e){return proto.mediapipe.tasks.core.proto.Acceleration.toObject(e,this)},proto.mediapipe.tasks.core.proto.Acceleration.toObject=function(e,t){var r,o={xnnpack:(r=t.getXnnpack())&&i.InferenceCalculatorOptions.Delegate.Xnnpack.toObject(e,r),gpu:(r=t.getGpu())&&i.InferenceCalculatorOptions.Delegate.Gpu.toObject(e,r),tflite:(r=t.getTflite())&&i.InferenceCalculatorOptions.Delegate.TfLite.toObject(e,r),nnapi:(r=t.getNnapi())&&i.InferenceCalculatorOptions.Delegate.Nnapi.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.core.proto.Acceleration.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.core.proto.Acceleration;return proto.mediapipe.tasks.core.proto.Acceleration.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.core.proto.Acceleration.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new i.InferenceCalculatorOptions.Delegate.Xnnpack;t.readMessage(r,i.InferenceCalculatorOptions.Delegate.Xnnpack.deserializeBinaryFromReader),e.setXnnpack(r);break;case 2:r=new i.InferenceCalculatorOptions.Delegate.Gpu;t.readMessage(r,i.InferenceCalculatorOptions.Delegate.Gpu.deserializeBinaryFromReader),e.setGpu(r);break;case 4:r=new i.InferenceCalculatorOptions.Delegate.TfLite;t.readMessage(r,i.InferenceCalculatorOptions.Delegate.TfLite.deserializeBinaryFromReader),e.setTflite(r);break;case 5:r=new i.InferenceCalculatorOptions.Delegate.Nnapi;t.readMessage(r,i.InferenceCalculatorOptions.Delegate.Nnapi.deserializeBinaryFromReader),e.setNnapi(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.core.proto.Acceleration.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.core.proto.Acceleration.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.core.proto.Acceleration.serializeBinaryToWriter=function(e,t){var r=void 0;null!=(r=e.getXnnpack())&&t.writeMessage(1,r,i.InferenceCalculatorOptions.Delegate.Xnnpack.serializeBinaryToWriter),null!=(r=e.getGpu())&&t.writeMessage(2,r,i.InferenceCalculatorOptions.Delegate.Gpu.serializeBinaryToWriter),null!=(r=e.getTflite())&&t.writeMessage(4,r,i.InferenceCalculatorOptions.Delegate.TfLite.serializeBinaryToWriter),null!=(r=e.getNnapi())&&t.writeMessage(5,r,i.InferenceCalculatorOptions.Delegate.Nnapi.serializeBinaryToWriter)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.getXnnpack=function(){return t.Message.getWrapperField(this,i.InferenceCalculatorOptions.Delegate.Xnnpack,1)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.setXnnpack=function(e){return t.Message.setOneofWrapperField(this,1,proto.mediapipe.tasks.core.proto.Acceleration.oneofGroups_[0],e)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.clearXnnpack=function(){return this.setXnnpack(void 0)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.hasXnnpack=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.getGpu=function(){return t.Message.getWrapperField(this,i.InferenceCalculatorOptions.Delegate.Gpu,2)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.setGpu=function(e){return t.Message.setOneofWrapperField(this,2,proto.mediapipe.tasks.core.proto.Acceleration.oneofGroups_[0],e)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.clearGpu=function(){return this.setGpu(void 0)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.hasGpu=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.getTflite=function(){return t.Message.getWrapperField(this,i.InferenceCalculatorOptions.Delegate.TfLite,4)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.setTflite=function(e){return t.Message.setOneofWrapperField(this,4,proto.mediapipe.tasks.core.proto.Acceleration.oneofGroups_[0],e)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.clearTflite=function(){return this.setTflite(void 0)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.hasTflite=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.getNnapi=function(){return t.Message.getWrapperField(this,i.InferenceCalculatorOptions.Delegate.Nnapi,5)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.setNnapi=function(e){return t.Message.setOneofWrapperField(this,5,proto.mediapipe.tasks.core.proto.Acceleration.oneofGroups_[0],e)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.clearNnapi=function(){return this.setNnapi(void 0)},proto.mediapipe.tasks.core.proto.Acceleration.prototype.hasNnapi=function(){return null!=t.Message.getField(this,5)},r.object.extend(e,proto.mediapipe.tasks.core.proto)}(acceleration_pb);var external_file_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.tasks.core.proto.ExternalFile",null,o),r.exportSymbol("proto.mediapipe.tasks.core.proto.FileDescriptorMeta",null,o),r.exportSymbol("proto.mediapipe.tasks.core.proto.FilePointerMeta",null,o),proto.mediapipe.tasks.core.proto.ExternalFile=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.core.proto.ExternalFile,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.core.proto.ExternalFile.displayName="proto.mediapipe.tasks.core.proto.ExternalFile"),proto.mediapipe.tasks.core.proto.FileDescriptorMeta=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.core.proto.FileDescriptorMeta,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.core.proto.FileDescriptorMeta.displayName="proto.mediapipe.tasks.core.proto.FileDescriptorMeta"),proto.mediapipe.tasks.core.proto.FilePointerMeta=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.core.proto.FilePointerMeta,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.core.proto.FilePointerMeta.displayName="proto.mediapipe.tasks.core.proto.FilePointerMeta"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.core.proto.ExternalFile.prototype.toObject=function(e){return proto.mediapipe.tasks.core.proto.ExternalFile.toObject(e,this)},proto.mediapipe.tasks.core.proto.ExternalFile.toObject=function(e,r){var o,i={fileContent:r.getFileContent_asB64(),fileName:null==(o=t.Message.getField(r,2))?void 0:o,fileDescriptorMeta:(o=r.getFileDescriptorMeta())&&proto.mediapipe.tasks.core.proto.FileDescriptorMeta.toObject(e,o),filePointerMeta:(o=r.getFilePointerMeta())&&proto.mediapipe.tasks.core.proto.FilePointerMeta.toObject(e,o)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.core.proto.ExternalFile.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.core.proto.ExternalFile;return proto.mediapipe.tasks.core.proto.ExternalFile.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.core.proto.ExternalFile.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readBytes();e.setFileContent(r);break;case 2:r=t.readString();e.setFileName(r);break;case 3:r=new proto.mediapipe.tasks.core.proto.FileDescriptorMeta;t.readMessage(r,proto.mediapipe.tasks.core.proto.FileDescriptorMeta.deserializeBinaryFromReader),e.setFileDescriptorMeta(r);break;case 4:r=new proto.mediapipe.tasks.core.proto.FilePointerMeta;t.readMessage(r,proto.mediapipe.tasks.core.proto.FilePointerMeta.deserializeBinaryFromReader),e.setFilePointerMeta(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.core.proto.ExternalFile.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.core.proto.ExternalFile.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeBytes(1,o),null!=(o=t.Message.getField(e,2))&&r.writeString(2,o),null!=(o=e.getFileDescriptorMeta())&&r.writeMessage(3,o,proto.mediapipe.tasks.core.proto.FileDescriptorMeta.serializeBinaryToWriter),null!=(o=e.getFilePointerMeta())&&r.writeMessage(4,o,proto.mediapipe.tasks.core.proto.FilePointerMeta.serializeBinaryToWriter)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.getFileContent=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.getFileContent_asB64=function(){return t.Message.bytesAsB64(this.getFileContent())},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.getFileContent_asU8=function(){return t.Message.bytesAsU8(this.getFileContent())},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.setFileContent=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.clearFileContent=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.hasFileContent=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.getFileName=function(){return t.Message.getFieldWithDefault(this,2,"")},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.setFileName=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.clearFileName=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.hasFileName=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.getFileDescriptorMeta=function(){return t.Message.getWrapperField(this,proto.mediapipe.tasks.core.proto.FileDescriptorMeta,3)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.setFileDescriptorMeta=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.clearFileDescriptorMeta=function(){return this.setFileDescriptorMeta(void 0)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.hasFileDescriptorMeta=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.getFilePointerMeta=function(){return t.Message.getWrapperField(this,proto.mediapipe.tasks.core.proto.FilePointerMeta,4)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.setFilePointerMeta=function(e){return t.Message.setWrapperField(this,4,e)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.clearFilePointerMeta=function(){return this.setFilePointerMeta(void 0)},proto.mediapipe.tasks.core.proto.ExternalFile.prototype.hasFilePointerMeta=function(){return null!=t.Message.getField(this,4)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.toObject=function(e){return proto.mediapipe.tasks.core.proto.FileDescriptorMeta.toObject(e,this)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.toObject=function(e,r){var o,i={fd:null==(o=t.Message.getField(r,1))?void 0:o,length:null==(o=t.Message.getField(r,2))?void 0:o,offset:null==(o=t.Message.getField(r,3))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.core.proto.FileDescriptorMeta.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.core.proto.FileDescriptorMeta;return proto.mediapipe.tasks.core.proto.FileDescriptorMeta.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readInt32();e.setFd(r);break;case 2:r=t.readInt64();e.setLength(r);break;case 3:r=t.readInt64();e.setOffset(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.core.proto.FileDescriptorMeta.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeInt32(1,o),null!=(o=t.Message.getField(e,2))&&r.writeInt64(2,o),null!=(o=t.Message.getField(e,3))&&r.writeInt64(3,o)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.getFd=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.setFd=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.clearFd=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.hasFd=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.getLength=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.setLength=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.clearLength=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.hasLength=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.getOffset=function(){return t.Message.getFieldWithDefault(this,3,0)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.setOffset=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.clearOffset=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.tasks.core.proto.FileDescriptorMeta.prototype.hasOffset=function(){return null!=t.Message.getField(this,3)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.core.proto.FilePointerMeta.prototype.toObject=function(e){return proto.mediapipe.tasks.core.proto.FilePointerMeta.toObject(e,this)},proto.mediapipe.tasks.core.proto.FilePointerMeta.toObject=function(e,r){var o,i={pointer:null==(o=t.Message.getField(r,1))?void 0:o,length:null==(o=t.Message.getField(r,2))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.core.proto.FilePointerMeta.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.core.proto.FilePointerMeta;return proto.mediapipe.tasks.core.proto.FilePointerMeta.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.core.proto.FilePointerMeta.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readUint64();e.setPointer(r);break;case 2:r=t.readInt64();e.setLength(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.core.proto.FilePointerMeta.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.core.proto.FilePointerMeta.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.core.proto.FilePointerMeta.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeUint64(1,o),null!=(o=t.Message.getField(e,2))&&r.writeInt64(2,o)},proto.mediapipe.tasks.core.proto.FilePointerMeta.prototype.getPointer=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.tasks.core.proto.FilePointerMeta.prototype.setPointer=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.tasks.core.proto.FilePointerMeta.prototype.clearPointer=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.tasks.core.proto.FilePointerMeta.prototype.hasPointer=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.core.proto.FilePointerMeta.prototype.getLength=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.tasks.core.proto.FilePointerMeta.prototype.setLength=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.core.proto.FilePointerMeta.prototype.clearLength=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.core.proto.FilePointerMeta.prototype.hasLength=function(){return null!=t.Message.getField(this,2)},r.object.extend(e,proto.mediapipe.tasks.core.proto)}(external_file_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=acceleration_pb;r.object.extend(proto,i);var a=external_file_pb;r.object.extend(proto,a),r.exportSymbol("proto.mediapipe.tasks.core.proto.BaseOptions",null,o),proto.mediapipe.tasks.core.proto.BaseOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.core.proto.BaseOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.core.proto.BaseOptions.displayName="proto.mediapipe.tasks.core.proto.BaseOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.core.proto.BaseOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.core.proto.BaseOptions.toObject(e,this)},proto.mediapipe.tasks.core.proto.BaseOptions.toObject=function(e,r){var o,n={modelAsset:(o=r.getModelAsset())&&a.ExternalFile.toObject(e,o),useStreamMode:t.Message.getBooleanFieldWithDefault(r,2,!1),acceleration:(o=r.getAcceleration())&&i.Acceleration.toObject(e,o)};return e&&(n.$jspbMessageInstance=r),n}),proto.mediapipe.tasks.core.proto.BaseOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.core.proto.BaseOptions;return proto.mediapipe.tasks.core.proto.BaseOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.core.proto.BaseOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new a.ExternalFile;t.readMessage(r,a.ExternalFile.deserializeBinaryFromReader),e.setModelAsset(r);break;case 2:r=t.readBool();e.setUseStreamMode(r);break;case 3:r=new i.Acceleration;t.readMessage(r,i.Acceleration.deserializeBinaryFromReader),e.setAcceleration(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.core.proto.BaseOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.core.proto.BaseOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getModelAsset())&&r.writeMessage(1,o,a.ExternalFile.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeBool(2,o),null!=(o=e.getAcceleration())&&r.writeMessage(3,o,i.Acceleration.serializeBinaryToWriter)},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.getModelAsset=function(){return t.Message.getWrapperField(this,a.ExternalFile,1)},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.setModelAsset=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.clearModelAsset=function(){return this.setModelAsset(void 0)},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.hasModelAsset=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.getUseStreamMode=function(){return t.Message.getBooleanFieldWithDefault(this,2,!1)},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.setUseStreamMode=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.clearUseStreamMode=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.hasUseStreamMode=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.getAcceleration=function(){return t.Message.getWrapperField(this,i.Acceleration,3)},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.setAcceleration=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.clearAcceleration=function(){return this.setAcceleration(void 0)},proto.mediapipe.tasks.core.proto.BaseOptions.prototype.hasAcceleration=function(){return null!=t.Message.getField(this,3)},r.object.extend(e,proto.mediapipe.tasks.core.proto)}(base_options_pb);var face_detector_graph_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n),r.exportSymbol("proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions",null,o),proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.displayName="proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.toObject=function(e,r){var o,i={baseOptions:(o=r.getBaseOptions())&&n.BaseOptions.toObject(e,o),minDetectionConfidence:t.Message.getFloatingPointFieldWithDefault(r,2,.5),minSuppressionThreshold:t.Message.getFloatingPointFieldWithDefault(r,3,.5),numFaces:null==(o=t.Message.getField(r,4))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions;return proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=t.readFloat();e.setMinDetectionConfidence(r);break;case 3:r=t.readFloat();e.setMinSuppressionThreshold(r);break;case 4:r=t.readInt32();e.setNumFaces(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getBaseOptions())&&r.writeMessage(1,o,n.BaseOptions.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeFloat(2,o),null!=(o=t.Message.getField(e,3))&&r.writeFloat(3,o),null!=(o=t.Message.getField(e,4))&&r.writeInt32(4,o)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.ext=new t.ExtensionFieldInfo(502141897,{ext:0},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions,proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[502141897]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[502141897]=proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.ext,proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.getMinDetectionConfidence=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,.5)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.setMinDetectionConfidence=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.clearMinDetectionConfidence=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.hasMinDetectionConfidence=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.getMinSuppressionThreshold=function(){return t.Message.getFloatingPointFieldWithDefault(this,3,.5)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.setMinSuppressionThreshold=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.clearMinSuppressionThreshold=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.hasMinSuppressionThreshold=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.getNumFaces=function(){return t.Message.getFieldWithDefault(this,4,0)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.setNumFaces=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.clearNumFaces=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.prototype.hasNumFaces=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.ext=new t.ExtensionFieldInfo(502141897,{ext:0},proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions,proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[502141897]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[502141897]=proto.mediapipe.tasks.vision.face_detector.proto.FaceDetectorGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.face_detector.proto)}(face_detector_graph_options_pb);var detection_result={};Object.defineProperty(detection_result,"__esModule",{value:!0}),detection_result.convertFromDetectionProto=void 0;const DEFAULT_CATEGORY_INDEX=-1;function convertFromDetectionProto(e){var t,r,o,i,a,n,s,p,d,l,g,c,u;const m=e.getScoreList(),f=e.getLabelIdList(),h=e.getLabelList(),y=e.getDisplayNameList(),b={categories:[]};for(let e=0;e{i=i||"audio_header",this.wrapStringPtr(i,(i=>{this.wasmModule._configureAudio(o,i,e,t,r)}))}))}setAutoResizeCanvas(e){this.autoResizeCanvas=e}setAutoRenderToScreen(e){this.wasmModule._setAutoRenderToScreen(e)}bindTextureToStream(e,t){if(!this.wasmModule.canvas)throw new Error("No OpenGL canvas configured.");t?this.wasmModule._bindTextureToStream(t):console.assert(this.wasmModule._bindTextureToCanvas());const r=this.wasmModule.canvas.getContext("webgl2")||this.wasmModule.canvas.getContext("webgl");if(!r)throw new Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");let o,i;return r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,e),e.videoWidth?(o=e.videoWidth,i=e.videoHeight):e.naturalWidth?(o=e.naturalWidth,i=e.naturalHeight):(o=e.width,i=e.height),!this.autoResizeCanvas||o===this.wasmModule.canvas.width&&i===this.wasmModule.canvas.height||(this.wasmModule.canvas.width=o,this.wasmModule.canvas.height=i),[o,i]}processGl(e,t){const[r,o]=this.bindTextureToStream(e),i=this.wasmModule._malloc(16);this.wasmModule.HEAPU32[i/4]=r,this.wasmModule.HEAPU32[i/4+1]=o,this.wasmModule.HEAPF64[i/8+1]=t,this.wasmModule._processGl(i),this.wasmModule._free(i)}wrapStringPtr(e,t){this.hasMultiStreamSupport||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");const r=this.wasmModule.stringToNewUTF8(e);t(r),this.wasmModule._free(r)}wrapStringPtrPtr(e,t){this.hasMultiStreamSupport||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");const r=new Uint32Array(e.length);for(let t=0;t>2),t(o);for(const e of r)this.wasmModule._free(e);this.wasmModule._free(o)}getCalculatorGraphConfig(t,r){const o=e.CALCULATOR_GRAPH_CONFIG_LISTENER_NAME;this.setListener(o,(e=>{t(e)})),this.wrapStringPtr(o,(e=>{this.wasmModule._getGraphConfig(e,r)})),delete this.wasmModule.simpleListeners[o]}setListener(e,t){this.wasmModule.simpleListeners=this.wasmModule.simpleListeners||{},this.wasmModule.simpleListeners[e]=t}setVectorListener(e,t){let r=[];this.wasmModule.simpleListeners=this.wasmModule.simpleListeners||{},this.wasmModule.simpleListeners[e]=(e,o,i)=>{o?(t(r,i),r=[]):r.push(e)}}attachErrorListener(e){this.wasmModule.errorListener=e}attachEmptyPacketListener(e,t){this.wasmModule.emptyPacketListeners=this.wasmModule.emptyPacketListeners||{},this.wasmModule.emptyPacketListeners[e]=t}addAudioToStream(e,t,r){this.addAudioToStreamWithShape(e,0,0,t,r)}addAudioToStreamWithShape(e,t,r,o,i){const a=4*e.length;this.audioSize!==a&&(this.audioPtr&&this.wasmModule._free(this.audioPtr),this.audioPtr=this.wasmModule._malloc(a),this.audioSize=a),this.wasmModule.HEAPF32.set(e,this.audioPtr/4),this.wrapStringPtr(o,(e=>{this.wasmModule._addAudioToInputStream(this.audioPtr,t,r,e,i)}))}addGpuBufferToStream(e,t,r){this.wrapStringPtr(t,(t=>{const[o,i]=this.bindTextureToStream(e,t);this.wasmModule._addBoundTextureToStream(t,o,i,r)}))}addBoolToStream(e,t,r){this.wrapStringPtr(t,(t=>{this.wasmModule._addBoolToInputStream(e,t,r)}))}addDoubleToStream(e,t,r){this.wrapStringPtr(t,(t=>{this.wasmModule._addDoubleToInputStream(e,t,r)}))}addFloatToStream(e,t,r){this.wrapStringPtr(t,(t=>{this.wasmModule._addFloatToInputStream(e,t,r)}))}addIntToStream(e,t,r){this.wrapStringPtr(t,(t=>{this.wasmModule._addIntToInputStream(e,t,r)}))}addStringToStream(e,t,r){this.wrapStringPtr(t,(t=>{this.wrapStringPtr(e,(e=>{this.wasmModule._addStringToInputStream(e,t,r)}))}))}addStringRecordToStream(e,t,r){this.wrapStringPtr(t,(t=>{this.wrapStringPtrPtr(Object.keys(e),(o=>{this.wrapStringPtrPtr(Object.values(e),(i=>{this.wasmModule._addFlatHashMapToInputStream(o,i,Object.keys(e).length,t,r)}))}))}))}addProtoToStream(e,t,r,o){this.wrapStringPtr(r,(r=>{this.wrapStringPtr(t,(t=>{const i=this.wasmModule._malloc(e.length);this.wasmModule.HEAPU8.set(e,i),this.wasmModule._addProtoToInputStream(i,e.length,t,r,o),this.wasmModule._free(i)}))}))}addEmptyPacketToStream(e,t){this.wrapStringPtr(e,(e=>{this.wasmModule._addEmptyPacketToInputStream(e,t)}))}addBoolToInputSidePacket(e,t){this.wrapStringPtr(t,(t=>{this.wasmModule._addBoolToInputSidePacket(e,t)}))}addDoubleToInputSidePacket(e,t){this.wrapStringPtr(t,(t=>{this.wasmModule._addDoubleToInputSidePacket(e,t)}))}addFloatToInputSidePacket(e,t){this.wrapStringPtr(t,(t=>{this.wasmModule._addFloatToInputSidePacket(e,t)}))}addIntToInputSidePacket(e,t){this.wrapStringPtr(t,(t=>{this.wasmModule._addIntToInputSidePacket(e,t)}))}addStringToInputSidePacket(e,t){this.wrapStringPtr(t,(t=>{this.wrapStringPtr(e,(e=>{this.wasmModule._addStringToInputSidePacket(e,t)}))}))}addProtoToInputSidePacket(e,t,r){this.wrapStringPtr(r,(r=>{this.wrapStringPtr(t,(t=>{const o=this.wasmModule._malloc(e.length);this.wasmModule.HEAPU8.set(e,o),this.wasmModule._addProtoToInputSidePacket(o,e.length,t,r),this.wasmModule._free(o)}))}))}attachBoolListener(e,t){this.setListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmModule._attachBoolListener(e)}))}attachBoolVectorListener(e,t){this.setVectorListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmModule._attachBoolVectorListener(e)}))}attachIntListener(e,t){this.setListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmModule._attachIntListener(e)}))}attachIntVectorListener(e,t){this.setVectorListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmModule._attachIntVectorListener(e)}))}attachDoubleListener(e,t){this.setListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmModule._attachDoubleListener(e)}))}attachDoubleVectorListener(e,t){this.setVectorListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmModule._attachDoubleVectorListener(e)}))}attachFloatListener(e,t){this.setListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmModule._attachFloatListener(e)}))}attachFloatVectorListener(e,t){this.setVectorListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmModule._attachFloatVectorListener(e)}))}attachStringListener(e,t){this.setListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmModule._attachStringListener(e)}))}attachStringVectorListener(e,t){this.setVectorListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmModule._attachStringVectorListener(e)}))}attachProtoListener(e,t,r){this.setListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmModule._attachProtoListener(e,r||!1)}))}attachProtoVectorListener(e,t,r){this.setVectorListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmModule._attachProtoVectorListener(e,r||!1)}))}attachAudioListener(e,t,r){this.wasmModule._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),this.setListener(e,((e,r)=>{const o=new Float32Array(e.buffer,e.byteOffset,e.length/4);t(o,r)})),this.wrapStringPtr(e,(e=>{this.wasmModule._attachAudioListener(e,r||!1)}))}finishProcessing(){this.wasmModule._waitUntilIdle()}closeGraph(){this.wasmModule._closeGraph(),this.wasmModule.simpleListeners=void 0,this.wasmModule.emptyPacketListeners=void 0}}async function o(e){if("function"!=typeof importScripts){const t=document.createElement("script");return t.setAttribute("src",e),t.setAttribute("crossorigin","anonymous"),new Promise((e=>{t.addEventListener("load",(()=>{e()}),!1),t.addEventListener("error",(()=>{e()}),!1),document.body.appendChild(t)}))}importScripts(e.toString())}async function i(e,t,r,i,a){const n=[];if(t&&n.push(t),r&&n.push(r),n.length&&await Promise.all(n.map(o)),!self.ModuleFactory)throw new Error("ModuleFactory not set.");if(self.Module&&a){const e=self.Module;e.locateFile=a.locateFile,a.mainScriptUrlOrBlob&&(e.mainScriptUrlOrBlob=a.mainScriptUrlOrBlob)}const s=await self.ModuleFactory(self.Module||a);return self.ModuleFactory=self.Module=void 0,new e(s,i)}e.GraphRunner=r,e.createMediaPipeLib=i,e.createGraphRunner=async function(e,t,o,a){return i(r,e,t,o,a)}}(graph_runner);var register_model_resources_graph_service={};function SupportModelResourcesGraphService(e){return class extends e{registerModelResourcesGraphService(){this.wasmModule._registerModelResourcesGraphService()}}}Object.defineProperty(register_model_resources_graph_service,"__esModule",{value:!0}),register_model_resources_graph_service.SupportModelResourcesGraphService=void 0,register_model_resources_graph_service.SupportModelResourcesGraphService=SupportModelResourcesGraphService,Object.defineProperty(task_runner,"__esModule",{value:!0}),task_runner.TaskRunner=task_runner.createTaskRunner=task_runner.CachedGraphRunner=void 0;const inference_calculator_pb_1=inference_calculator_pb,calculator_pb_1=calculator_pb,acceleration_pb_1=acceleration_pb,external_file_pb_1=external_file_pb,graph_runner_1$1=graph_runner,register_model_resources_graph_service_1$1=register_model_resources_graph_service,NO_ASSETS=void 0,FREE_MEMORY_STREAM="free_memory",UNUSED_STREAM_SUFFIX="_unused_out",CachedGraphRunnerType=(0,register_model_resources_graph_service_1$1.SupportModelResourcesGraphService)(graph_runner_1$1.GraphRunner);class CachedGraphRunner extends CachedGraphRunnerType{}async function createTaskRunner(e,t,r,o){const i={locateFile:()=>r.wasmBinaryPath.toString()},a=await(0,graph_runner_1$1.createMediaPipeLib)(e,r.wasmLoaderPath,NO_ASSETS,t,i);return await a.setOptions(o),a}task_runner.CachedGraphRunner=CachedGraphRunner,task_runner.createTaskRunner=createTaskRunner;class TaskRunner{static async createInstance(e,t,r,o){return createTaskRunner(e,t,r,o)}constructor(e){this.graphRunner=e,this.processingErrors=[],this.latestOutputTimestamp=0,this.graphRunner.setAutoRenderToScreen(!1)}applyOptions(e){var t,r,o,i,a;const n=e.baseOptions||{};if((null===(t=e.baseOptions)||void 0===t?void 0:t.modelAssetBuffer)&&(null===(r=e.baseOptions)||void 0===r?void 0:r.modelAssetPath))throw new Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!((null===(o=this.baseOptions.getModelAsset())||void 0===o?void 0:o.hasFileContent())||(null===(i=e.baseOptions)||void 0===i?void 0:i.modelAssetBuffer)||(null===(a=e.baseOptions)||void 0===a?void 0:a.modelAssetPath)))throw new Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");return this.setAcceleration(n),n.modelAssetPath?fetch(n.modelAssetPath.toString()).then((e=>{if(e.ok)return e.arrayBuffer();throw new Error(`Failed to fetch model: ${n.modelAssetPath} (${e.status})`)})).then((e=>{this.setExternalFile(new Uint8Array(e)),this.refreshGraph(),this.onGraphRefreshed()})):(this.setExternalFile(n.modelAssetBuffer),this.refreshGraph(),this.onGraphRefreshed(),Promise.resolve())}onGraphRefreshed(){}getCalculatorGraphConfig(){let e;if(this.graphRunner.getCalculatorGraphConfig((t=>{e=calculator_pb_1.CalculatorGraphConfig.deserializeBinary(t)})),!e)throw new Error("Failed to retrieve CalculatorGraphConfig");return e}setGraph(e,t){this.graphRunner.attachErrorListener(((e,t)=>{this.processingErrors.push(new Error(t))})),this.graphRunner.registerModelResourcesGraphService(),this.graphRunner.setGraph(e,t),this.keepaliveNode=void 0,this.handleErrors()}finishProcessing(){this.graphRunner.finishProcessing(),this.handleErrors()}setLatestOutputTimestamp(e){this.latestOutputTimestamp=Math.max(this.latestOutputTimestamp,e)}getSynctheticTimestamp(){return this.latestOutputTimestamp+1}handleErrors(){try{const e=this.processingErrors.length;if(1===e)throw new Error(this.processingErrors[0].message);if(e>1)throw new Error("Encountered multiple errors: "+this.processingErrors.map((e=>e.message)).join(", "))}finally{this.processingErrors=[]}}setExternalFile(e){const t=this.baseOptions.getModelAsset()||new external_file_pb_1.ExternalFile;e&&t.setFileContent(e),this.baseOptions.setModelAsset(t)}setAcceleration(e){let t=this.baseOptions.getAcceleration();t||(t=new acceleration_pb_1.Acceleration,t.setTflite(new inference_calculator_pb_1.InferenceCalculatorOptions.Delegate.TfLite)),"delegate"in e&&("GPU"===e.delegate?t.setGpu(new inference_calculator_pb_1.InferenceCalculatorOptions.Delegate.Gpu):t.setTflite(new inference_calculator_pb_1.InferenceCalculatorOptions.Delegate.TfLite)),this.baseOptions.setAcceleration(t)}addKeepaliveNode(e){this.keepaliveNode=new calculator_pb_1.CalculatorGraphConfig.Node,this.keepaliveNode.setCalculator("PassThroughCalculator"),this.keepaliveNode.addInputStream(FREE_MEMORY_STREAM),this.keepaliveNode.addOutputStream(FREE_MEMORY_STREAM+UNUSED_STREAM_SUFFIX),e.addInputStream(FREE_MEMORY_STREAM),e.addNode(this.keepaliveNode)}keepStreamAlive(e){this.keepaliveNode.addInputStream(e),this.keepaliveNode.addOutputStream(e+UNUSED_STREAM_SUFFIX)}freeKeepaliveStreams(){this.graphRunner.addBoolToStream(!0,FREE_MEMORY_STREAM,this.latestOutputTimestamp)}close(){this.keepaliveNode=void 0,this.graphRunner.closeGraph()}}task_runner.TaskRunner=TaskRunner;var graph_runner_image_lib={};function SupportImage(e){return class extends e{get wasmImageModule(){return this.wasmModule}addGpuBufferAsImageToStream(e,t,r){this.wrapStringPtr(t,(t=>{const[o,i]=this.bindTextureToStream(e,t);this.wasmImageModule._addBoundTextureAsImageToStream(t,o,i,r)}))}attachImageListener(e,t){this.setListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmImageModule._attachImageListener(e)}))}attachImageVectorListener(e,t){this.setVectorListener(e,t),this.wrapStringPtr(e,(e=>{this.wasmImageModule._attachImageVectorListener(e)}))}}}Object.defineProperty(graph_runner_image_lib,"__esModule",{value:!0}),graph_runner_image_lib.SupportImage=void 0,graph_runner_image_lib.SupportImage=SupportImage,Object.defineProperty(vision_task_runner,"__esModule",{value:!0}),vision_task_runner.VisionTaskRunner=vision_task_runner.VisionGraphRunner=void 0;const rect_pb_1=rect_pb,task_runner_1=task_runner,image_1$1=image,image_shader_context_1=image_shader_context,mask_1$1=mask,graph_runner_1=graph_runner,graph_runner_image_lib_1=graph_runner_image_lib,platform_utils_1=platform_utils,register_model_resources_graph_service_1=register_model_resources_graph_service,GraphRunnerVisionType=(0,register_model_resources_graph_service_1.SupportModelResourcesGraphService)((0,graph_runner_image_lib_1.SupportImage)(graph_runner_1.GraphRunner));class VisionGraphRunner extends GraphRunnerVisionType{}function createCanvas(){return"undefined"!=typeof OffscreenCanvas&&!(0,platform_utils_1.isWebKit)()?void 0:document.createElement("canvas")}vision_task_runner.VisionGraphRunner=VisionGraphRunner;class VisionTaskRunner extends task_runner_1.TaskRunner{static async createVisionInstance(e,t,r){var o;const i=null!==(o=r.canvas)&&void 0!==o?o:createCanvas();return task_runner_1.TaskRunner.createInstance(e,i,t,r)}constructor(e,t,r,o){super(e),this.graphRunner=e,this.imageStreamName=t,this.normRectStreamName=r,this.roiAllowed=o,this.shaderContext=new image_shader_context_1.MPImageShaderContext}applyOptions(e){if("runningMode"in e){const t=!!e.runningMode&&"IMAGE"!==e.runningMode;this.baseOptions.setUseStreamMode(t)}if(void 0!==e.canvas&&this.graphRunner.wasmModule.canvas!==e.canvas)throw new Error("You must create a new task to reset the canvas.");return super.applyOptions(e)}processImageData(e,t){var r;if(null===(r=this.baseOptions)||void 0===r?void 0:r.getUseStreamMode())throw new Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");this.process(e,t,this.getSynctheticTimestamp())}processVideoData(e,t,r){var o;if(!(null===(o=this.baseOptions)||void 0===o?void 0:o.getUseStreamMode()))throw new Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");this.process(e,t,r)}getImageSourceSize(e){return void 0!==e.videoWidth?[e.videoWidth,e.videoHeight]:void 0!==e.naturalWidth?[e.naturalWidth,e.naturalHeight]:[e.width,e.height]}convertToNormalizedRect(e,t){const r=new rect_pb_1.NormalizedRect;if(null==t?void 0:t.regionOfInterest){if(!this.roiAllowed)throw new Error("This task doesn't support region-of-interest.");const e=t.regionOfInterest;if(e.left>=e.right||e.top>=e.bottom)throw new Error("Expected RectF with left < right and top < bottom.");if(e.left<0||e.top<0||e.right>1||e.bottom>1)throw new Error("Expected RectF values to be in [0,1].");r.setXCenter((e.left+e.right)/2),r.setYCenter((e.top+e.bottom)/2),r.setWidth(e.right-e.left),r.setHeight(e.bottom-e.top)}else r.setXCenter(.5),r.setYCenter(.5),r.setWidth(1),r.setHeight(1);if(null==t?void 0:t.rotationDegrees){if((null==t?void 0:t.rotationDegrees)%90!=0)throw new Error("Expected rotation to be a multiple of 90°.");if(r.setRotation(-Math.PI*t.rotationDegrees/180),(null==t?void 0:t.rotationDegrees)%180!=0){const[t,o]=this.getImageSourceSize(e),i=r.getHeight()*o/t,a=r.getWidth()*t/o;r.setWidth(i),r.setHeight(a)}}return r}process(e,t,r){const o=this.convertToNormalizedRect(e,t);this.graphRunner.addProtoToStream(o.serializeBinary(),"mediapipe.NormalizedRect",this.normRectStreamName,r),this.graphRunner.addGpuBufferAsImageToStream(e,this.imageStreamName,null!=r?r:performance.now()),this.finishProcessing()}convertToMPImage(e,t){const{data:r,width:o,height:i}=e,a=o*i;let n;if(r instanceof Uint8Array)if(r.length===3*a){const e=new Uint8ClampedArray(4*a);for(let t=0;t{this.addJsFaceDetections(e),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(c,(e=>{this.setLatestOutputTimestamp(e)}));const a=e.serializeBinary();this.setGraph(new Uint8Array(a),!0)}}e.FaceDetector=u}(face_detector);var face_landmarker={},classification_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.Classification",null,o),r.exportSymbol("proto.mediapipe.ClassificationList",null,o),r.exportSymbol("proto.mediapipe.ClassificationListCollection",null,o),proto.mediapipe.Classification=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.Classification,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.Classification.displayName="proto.mediapipe.Classification"),proto.mediapipe.ClassificationList=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.ClassificationList.repeatedFields_,null)},r.inherits(proto.mediapipe.ClassificationList,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.ClassificationList.displayName="proto.mediapipe.ClassificationList"),proto.mediapipe.ClassificationListCollection=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.ClassificationListCollection.repeatedFields_,null)},r.inherits(proto.mediapipe.ClassificationListCollection,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.ClassificationListCollection.displayName="proto.mediapipe.ClassificationListCollection"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.Classification.prototype.toObject=function(e){return proto.mediapipe.Classification.toObject(e,this)},proto.mediapipe.Classification.toObject=function(e,r){var o,i={index:null==(o=t.Message.getField(r,1))?void 0:o,score:null==(o=t.Message.getOptionalFloatingPointField(r,2))?void 0:o,label:null==(o=t.Message.getField(r,3))?void 0:o,displayName:null==(o=t.Message.getField(r,4))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.Classification.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.Classification;return proto.mediapipe.Classification.deserializeBinaryFromReader(o,r)},proto.mediapipe.Classification.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readInt32();e.setIndex(r);break;case 2:r=t.readFloat();e.setScore(r);break;case 3:r=t.readString();e.setLabel(r);break;case 4:r=t.readString();e.setDisplayName(r);break;default:t.skipField()}}return e},proto.mediapipe.Classification.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.Classification.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.Classification.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeInt32(1,o),null!=(o=t.Message.getField(e,2))&&r.writeFloat(2,o),null!=(o=t.Message.getField(e,3))&&r.writeString(3,o),null!=(o=t.Message.getField(e,4))&&r.writeString(4,o)},proto.mediapipe.Classification.prototype.getIndex=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.Classification.prototype.setIndex=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.Classification.prototype.clearIndex=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.Classification.prototype.hasIndex=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.Classification.prototype.getScore=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,0)},proto.mediapipe.Classification.prototype.setScore=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.Classification.prototype.clearScore=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.Classification.prototype.hasScore=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.Classification.prototype.getLabel=function(){return t.Message.getFieldWithDefault(this,3,"")},proto.mediapipe.Classification.prototype.setLabel=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.Classification.prototype.clearLabel=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.Classification.prototype.hasLabel=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.Classification.prototype.getDisplayName=function(){return t.Message.getFieldWithDefault(this,4,"")},proto.mediapipe.Classification.prototype.setDisplayName=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.Classification.prototype.clearDisplayName=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.Classification.prototype.hasDisplayName=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.ClassificationList.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.ClassificationList.prototype.toObject=function(e){return proto.mediapipe.ClassificationList.toObject(e,this)},proto.mediapipe.ClassificationList.toObject=function(e,r){var o={classificationList:t.Message.toObjectList(r.getClassificationList(),proto.mediapipe.Classification.toObject,e)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.ClassificationList.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.ClassificationList;return proto.mediapipe.ClassificationList.deserializeBinaryFromReader(o,r)},proto.mediapipe.ClassificationList.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new proto.mediapipe.Classification;t.readMessage(r,proto.mediapipe.Classification.deserializeBinaryFromReader),e.addClassification(r)}else t.skipField()}return e},proto.mediapipe.ClassificationList.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.ClassificationList.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.ClassificationList.serializeBinaryToWriter=function(e,t){var r;(r=e.getClassificationList()).length>0&&t.writeRepeatedMessage(1,r,proto.mediapipe.Classification.serializeBinaryToWriter)},proto.mediapipe.ClassificationList.prototype.getClassificationList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.Classification,1)},proto.mediapipe.ClassificationList.prototype.setClassificationList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.ClassificationList.prototype.addClassification=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.Classification,r)},proto.mediapipe.ClassificationList.prototype.clearClassificationList=function(){return this.setClassificationList([])},proto.mediapipe.ClassificationListCollection.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.ClassificationListCollection.prototype.toObject=function(e){return proto.mediapipe.ClassificationListCollection.toObject(e,this)},proto.mediapipe.ClassificationListCollection.toObject=function(e,r){var o={classificationListList:t.Message.toObjectList(r.getClassificationListList(),proto.mediapipe.ClassificationList.toObject,e)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.ClassificationListCollection.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.ClassificationListCollection;return proto.mediapipe.ClassificationListCollection.deserializeBinaryFromReader(o,r)},proto.mediapipe.ClassificationListCollection.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new proto.mediapipe.ClassificationList;t.readMessage(r,proto.mediapipe.ClassificationList.deserializeBinaryFromReader),e.addClassificationList(r)}else t.skipField()}return e},proto.mediapipe.ClassificationListCollection.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.ClassificationListCollection.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.ClassificationListCollection.serializeBinaryToWriter=function(e,t){var r;(r=e.getClassificationListList()).length>0&&t.writeRepeatedMessage(1,r,proto.mediapipe.ClassificationList.serializeBinaryToWriter)},proto.mediapipe.ClassificationListCollection.prototype.getClassificationListList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.ClassificationList,1)},proto.mediapipe.ClassificationListCollection.prototype.setClassificationListList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.ClassificationListCollection.prototype.addClassificationList=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.ClassificationList,r)},proto.mediapipe.ClassificationListCollection.prototype.clearClassificationListList=function(){return this.setClassificationListList([])},r.object.extend(e,proto.mediapipe)}(classification_pb);var landmark_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.Landmark",null,o),r.exportSymbol("proto.mediapipe.LandmarkList",null,o),r.exportSymbol("proto.mediapipe.LandmarkListCollection",null,o),r.exportSymbol("proto.mediapipe.NormalizedLandmark",null,o),r.exportSymbol("proto.mediapipe.NormalizedLandmarkList",null,o),r.exportSymbol("proto.mediapipe.NormalizedLandmarkListCollection",null,o),proto.mediapipe.Landmark=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.Landmark,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.Landmark.displayName="proto.mediapipe.Landmark"),proto.mediapipe.LandmarkList=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.LandmarkList.repeatedFields_,null)},r.inherits(proto.mediapipe.LandmarkList,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.LandmarkList.displayName="proto.mediapipe.LandmarkList"),proto.mediapipe.LandmarkListCollection=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.LandmarkListCollection.repeatedFields_,null)},r.inherits(proto.mediapipe.LandmarkListCollection,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.LandmarkListCollection.displayName="proto.mediapipe.LandmarkListCollection"),proto.mediapipe.NormalizedLandmark=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.NormalizedLandmark,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.NormalizedLandmark.displayName="proto.mediapipe.NormalizedLandmark"),proto.mediapipe.NormalizedLandmarkList=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.NormalizedLandmarkList.repeatedFields_,null)},r.inherits(proto.mediapipe.NormalizedLandmarkList,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.NormalizedLandmarkList.displayName="proto.mediapipe.NormalizedLandmarkList"),proto.mediapipe.NormalizedLandmarkListCollection=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.NormalizedLandmarkListCollection.repeatedFields_,null)},r.inherits(proto.mediapipe.NormalizedLandmarkListCollection,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.NormalizedLandmarkListCollection.displayName="proto.mediapipe.NormalizedLandmarkListCollection"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.Landmark.prototype.toObject=function(e){return proto.mediapipe.Landmark.toObject(e,this)},proto.mediapipe.Landmark.toObject=function(e,r){var o,i={x:null==(o=t.Message.getOptionalFloatingPointField(r,1))?void 0:o,y:null==(o=t.Message.getOptionalFloatingPointField(r,2))?void 0:o,z:null==(o=t.Message.getOptionalFloatingPointField(r,3))?void 0:o,visibility:null==(o=t.Message.getOptionalFloatingPointField(r,4))?void 0:o,presence:null==(o=t.Message.getOptionalFloatingPointField(r,5))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.Landmark.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.Landmark;return proto.mediapipe.Landmark.deserializeBinaryFromReader(o,r)},proto.mediapipe.Landmark.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readFloat();e.setX(r);break;case 2:r=t.readFloat();e.setY(r);break;case 3:r=t.readFloat();e.setZ(r);break;case 4:r=t.readFloat();e.setVisibility(r);break;case 5:r=t.readFloat();e.setPresence(r);break;default:t.skipField()}}return e},proto.mediapipe.Landmark.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.Landmark.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.Landmark.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeFloat(1,o),null!=(o=t.Message.getField(e,2))&&r.writeFloat(2,o),null!=(o=t.Message.getField(e,3))&&r.writeFloat(3,o),null!=(o=t.Message.getField(e,4))&&r.writeFloat(4,o),null!=(o=t.Message.getField(e,5))&&r.writeFloat(5,o)},proto.mediapipe.Landmark.prototype.getX=function(){return t.Message.getFloatingPointFieldWithDefault(this,1,0)},proto.mediapipe.Landmark.prototype.setX=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.Landmark.prototype.clearX=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.Landmark.prototype.hasX=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.Landmark.prototype.getY=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,0)},proto.mediapipe.Landmark.prototype.setY=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.Landmark.prototype.clearY=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.Landmark.prototype.hasY=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.Landmark.prototype.getZ=function(){return t.Message.getFloatingPointFieldWithDefault(this,3,0)},proto.mediapipe.Landmark.prototype.setZ=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.Landmark.prototype.clearZ=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.Landmark.prototype.hasZ=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.Landmark.prototype.getVisibility=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,0)},proto.mediapipe.Landmark.prototype.setVisibility=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.Landmark.prototype.clearVisibility=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.Landmark.prototype.hasVisibility=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.Landmark.prototype.getPresence=function(){return t.Message.getFloatingPointFieldWithDefault(this,5,0)},proto.mediapipe.Landmark.prototype.setPresence=function(e){return t.Message.setField(this,5,e)},proto.mediapipe.Landmark.prototype.clearPresence=function(){return t.Message.setField(this,5,void 0)},proto.mediapipe.Landmark.prototype.hasPresence=function(){return null!=t.Message.getField(this,5)},proto.mediapipe.LandmarkList.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.LandmarkList.prototype.toObject=function(e){return proto.mediapipe.LandmarkList.toObject(e,this)},proto.mediapipe.LandmarkList.toObject=function(e,r){var o={landmarkList:t.Message.toObjectList(r.getLandmarkList(),proto.mediapipe.Landmark.toObject,e)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.LandmarkList.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.LandmarkList;return proto.mediapipe.LandmarkList.deserializeBinaryFromReader(o,r)},proto.mediapipe.LandmarkList.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new proto.mediapipe.Landmark;t.readMessage(r,proto.mediapipe.Landmark.deserializeBinaryFromReader),e.addLandmark(r)}else t.skipField()}return e},proto.mediapipe.LandmarkList.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.LandmarkList.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.LandmarkList.serializeBinaryToWriter=function(e,t){var r;(r=e.getLandmarkList()).length>0&&t.writeRepeatedMessage(1,r,proto.mediapipe.Landmark.serializeBinaryToWriter)},proto.mediapipe.LandmarkList.prototype.getLandmarkList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.Landmark,1)},proto.mediapipe.LandmarkList.prototype.setLandmarkList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.LandmarkList.prototype.addLandmark=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.Landmark,r)},proto.mediapipe.LandmarkList.prototype.clearLandmarkList=function(){return this.setLandmarkList([])},proto.mediapipe.LandmarkListCollection.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.LandmarkListCollection.prototype.toObject=function(e){return proto.mediapipe.LandmarkListCollection.toObject(e,this)},proto.mediapipe.LandmarkListCollection.toObject=function(e,r){var o={landmarkListList:t.Message.toObjectList(r.getLandmarkListList(),proto.mediapipe.LandmarkList.toObject,e)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.LandmarkListCollection.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.LandmarkListCollection;return proto.mediapipe.LandmarkListCollection.deserializeBinaryFromReader(o,r)},proto.mediapipe.LandmarkListCollection.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new proto.mediapipe.LandmarkList;t.readMessage(r,proto.mediapipe.LandmarkList.deserializeBinaryFromReader),e.addLandmarkList(r)}else t.skipField()}return e},proto.mediapipe.LandmarkListCollection.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.LandmarkListCollection.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.LandmarkListCollection.serializeBinaryToWriter=function(e,t){var r;(r=e.getLandmarkListList()).length>0&&t.writeRepeatedMessage(1,r,proto.mediapipe.LandmarkList.serializeBinaryToWriter)},proto.mediapipe.LandmarkListCollection.prototype.getLandmarkListList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.LandmarkList,1)},proto.mediapipe.LandmarkListCollection.prototype.setLandmarkListList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.LandmarkListCollection.prototype.addLandmarkList=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.LandmarkList,r)},proto.mediapipe.LandmarkListCollection.prototype.clearLandmarkListList=function(){return this.setLandmarkListList([])},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.NormalizedLandmark.prototype.toObject=function(e){return proto.mediapipe.NormalizedLandmark.toObject(e,this)},proto.mediapipe.NormalizedLandmark.toObject=function(e,r){var o,i={x:null==(o=t.Message.getOptionalFloatingPointField(r,1))?void 0:o,y:null==(o=t.Message.getOptionalFloatingPointField(r,2))?void 0:o,z:null==(o=t.Message.getOptionalFloatingPointField(r,3))?void 0:o,visibility:null==(o=t.Message.getOptionalFloatingPointField(r,4))?void 0:o,presence:null==(o=t.Message.getOptionalFloatingPointField(r,5))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.NormalizedLandmark.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.NormalizedLandmark;return proto.mediapipe.NormalizedLandmark.deserializeBinaryFromReader(o,r)},proto.mediapipe.NormalizedLandmark.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readFloat();e.setX(r);break;case 2:r=t.readFloat();e.setY(r);break;case 3:r=t.readFloat();e.setZ(r);break;case 4:r=t.readFloat();e.setVisibility(r);break;case 5:r=t.readFloat();e.setPresence(r);break;default:t.skipField()}}return e},proto.mediapipe.NormalizedLandmark.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.NormalizedLandmark.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.NormalizedLandmark.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeFloat(1,o),null!=(o=t.Message.getField(e,2))&&r.writeFloat(2,o),null!=(o=t.Message.getField(e,3))&&r.writeFloat(3,o),null!=(o=t.Message.getField(e,4))&&r.writeFloat(4,o),null!=(o=t.Message.getField(e,5))&&r.writeFloat(5,o)},proto.mediapipe.NormalizedLandmark.prototype.getX=function(){return t.Message.getFloatingPointFieldWithDefault(this,1,0)},proto.mediapipe.NormalizedLandmark.prototype.setX=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.NormalizedLandmark.prototype.clearX=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.NormalizedLandmark.prototype.hasX=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.NormalizedLandmark.prototype.getY=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,0)},proto.mediapipe.NormalizedLandmark.prototype.setY=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.NormalizedLandmark.prototype.clearY=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.NormalizedLandmark.prototype.hasY=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.NormalizedLandmark.prototype.getZ=function(){return t.Message.getFloatingPointFieldWithDefault(this,3,0)},proto.mediapipe.NormalizedLandmark.prototype.setZ=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.NormalizedLandmark.prototype.clearZ=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.NormalizedLandmark.prototype.hasZ=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.NormalizedLandmark.prototype.getVisibility=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,0)},proto.mediapipe.NormalizedLandmark.prototype.setVisibility=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.NormalizedLandmark.prototype.clearVisibility=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.NormalizedLandmark.prototype.hasVisibility=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.NormalizedLandmark.prototype.getPresence=function(){return t.Message.getFloatingPointFieldWithDefault(this,5,0)},proto.mediapipe.NormalizedLandmark.prototype.setPresence=function(e){return t.Message.setField(this,5,e)},proto.mediapipe.NormalizedLandmark.prototype.clearPresence=function(){return t.Message.setField(this,5,void 0)},proto.mediapipe.NormalizedLandmark.prototype.hasPresence=function(){return null!=t.Message.getField(this,5)},proto.mediapipe.NormalizedLandmarkList.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.NormalizedLandmarkList.prototype.toObject=function(e){return proto.mediapipe.NormalizedLandmarkList.toObject(e,this)},proto.mediapipe.NormalizedLandmarkList.toObject=function(e,r){var o={landmarkList:t.Message.toObjectList(r.getLandmarkList(),proto.mediapipe.NormalizedLandmark.toObject,e)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.NormalizedLandmarkList.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.NormalizedLandmarkList;return proto.mediapipe.NormalizedLandmarkList.deserializeBinaryFromReader(o,r)},proto.mediapipe.NormalizedLandmarkList.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new proto.mediapipe.NormalizedLandmark;t.readMessage(r,proto.mediapipe.NormalizedLandmark.deserializeBinaryFromReader),e.addLandmark(r)}else t.skipField()}return e},proto.mediapipe.NormalizedLandmarkList.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.NormalizedLandmarkList.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.NormalizedLandmarkList.serializeBinaryToWriter=function(e,t){var r;(r=e.getLandmarkList()).length>0&&t.writeRepeatedMessage(1,r,proto.mediapipe.NormalizedLandmark.serializeBinaryToWriter)},proto.mediapipe.NormalizedLandmarkList.prototype.getLandmarkList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.NormalizedLandmark,1)},proto.mediapipe.NormalizedLandmarkList.prototype.setLandmarkList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.NormalizedLandmarkList.prototype.addLandmark=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.NormalizedLandmark,r)},proto.mediapipe.NormalizedLandmarkList.prototype.clearLandmarkList=function(){return this.setLandmarkList([])},proto.mediapipe.NormalizedLandmarkListCollection.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.NormalizedLandmarkListCollection.prototype.toObject=function(e){return proto.mediapipe.NormalizedLandmarkListCollection.toObject(e,this)},proto.mediapipe.NormalizedLandmarkListCollection.toObject=function(e,r){var o={landmarkListList:t.Message.toObjectList(r.getLandmarkListList(),proto.mediapipe.NormalizedLandmarkList.toObject,e)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.NormalizedLandmarkListCollection.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.NormalizedLandmarkListCollection;return proto.mediapipe.NormalizedLandmarkListCollection.deserializeBinaryFromReader(o,r)},proto.mediapipe.NormalizedLandmarkListCollection.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new proto.mediapipe.NormalizedLandmarkList;t.readMessage(r,proto.mediapipe.NormalizedLandmarkList.deserializeBinaryFromReader),e.addLandmarkList(r)}else t.skipField()}return e},proto.mediapipe.NormalizedLandmarkListCollection.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.NormalizedLandmarkListCollection.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.NormalizedLandmarkListCollection.serializeBinaryToWriter=function(e,t){var r;(r=e.getLandmarkListList()).length>0&&t.writeRepeatedMessage(1,r,proto.mediapipe.NormalizedLandmarkList.serializeBinaryToWriter)},proto.mediapipe.NormalizedLandmarkListCollection.prototype.getLandmarkListList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.NormalizedLandmarkList,1)},proto.mediapipe.NormalizedLandmarkListCollection.prototype.setLandmarkListList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.NormalizedLandmarkListCollection.prototype.addLandmarkList=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.NormalizedLandmarkList,r)},proto.mediapipe.NormalizedLandmarkListCollection.prototype.clearLandmarkListList=function(){return this.setLandmarkListList([])},r.object.extend(e,proto.mediapipe)}(landmark_pb);var face_geometry_pb={},matrix_data_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.MatrixData",null,o),r.exportSymbol("proto.mediapipe.MatrixData.Layout",null,o),proto.mediapipe.MatrixData=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.MatrixData.repeatedFields_,null)},r.inherits(proto.mediapipe.MatrixData,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.MatrixData.displayName="proto.mediapipe.MatrixData"),proto.mediapipe.MatrixData.repeatedFields_=[3],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.MatrixData.prototype.toObject=function(e){return proto.mediapipe.MatrixData.toObject(e,this)},proto.mediapipe.MatrixData.toObject=function(e,r){var o,i={rows:null==(o=t.Message.getField(r,1))?void 0:o,cols:null==(o=t.Message.getField(r,2))?void 0:o,packedDataList:null==(o=t.Message.getRepeatedFloatingPointField(r,3))?void 0:o,layout:t.Message.getFieldWithDefault(r,4,0)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.MatrixData.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.MatrixData;return proto.mediapipe.MatrixData.deserializeBinaryFromReader(o,r)},proto.mediapipe.MatrixData.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readInt32();e.setRows(r);break;case 2:r=t.readInt32();e.setCols(r);break;case 3:for(var o=t.isDelimited()?t.readPackedFloat():[t.readFloat()],i=0;i0&&r.writePackedFloat(3,o),null!=(o=t.Message.getField(e,4))&&r.writeEnum(4,o)},proto.mediapipe.MatrixData.Layout={COLUMN_MAJOR:0,ROW_MAJOR:1},proto.mediapipe.MatrixData.prototype.getRows=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.MatrixData.prototype.setRows=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.MatrixData.prototype.clearRows=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.MatrixData.prototype.hasRows=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.MatrixData.prototype.getCols=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.MatrixData.prototype.setCols=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.MatrixData.prototype.clearCols=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.MatrixData.prototype.hasCols=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.MatrixData.prototype.getPackedDataList=function(){return t.Message.getRepeatedFloatingPointField(this,3)},proto.mediapipe.MatrixData.prototype.setPackedDataList=function(e){return t.Message.setField(this,3,e||[])},proto.mediapipe.MatrixData.prototype.addPackedData=function(e,r){return t.Message.addToRepeatedField(this,3,e,r)},proto.mediapipe.MatrixData.prototype.clearPackedDataList=function(){return this.setPackedDataList([])},proto.mediapipe.MatrixData.prototype.getLayout=function(){return t.Message.getFieldWithDefault(this,4,0)},proto.mediapipe.MatrixData.prototype.setLayout=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.MatrixData.prototype.clearLayout=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.MatrixData.prototype.hasLayout=function(){return null!=t.Message.getField(this,4)},r.object.extend(e,proto.mediapipe)}(matrix_data_pb);var mesh_3d_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d",null,o),r.exportSymbol("proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.PrimitiveType",null,o),r.exportSymbol("proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.VertexType",null,o),proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.repeatedFields_,null)},r.inherits(proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.displayName="proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d"),proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.repeatedFields_=[3,4],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.toObject(e,this)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.toObject=function(e,r){var o,i={vertexType:null==(o=t.Message.getField(r,1))?void 0:o,primitiveType:null==(o=t.Message.getField(r,2))?void 0:o,vertexBufferList:null==(o=t.Message.getRepeatedFloatingPointField(r,3))?void 0:o,indexBufferList:null==(o=t.Message.getRepeatedField(r,4))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d;return proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readEnum();e.setVertexType(r);break;case 2:r=t.readEnum();e.setPrimitiveType(r);break;case 3:for(var o=t.isDelimited()?t.readPackedFloat():[t.readFloat()],i=0;i0&&r.writeRepeatedFloat(3,o),(o=e.getIndexBufferList()).length>0&&r.writeRepeatedUint32(4,o)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.VertexType={VERTEX_PT:0},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.PrimitiveType={TRIANGLE:0},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.getVertexType=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.setVertexType=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.clearVertexType=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.hasVertexType=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.getPrimitiveType=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.setPrimitiveType=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.clearPrimitiveType=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.hasPrimitiveType=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.getVertexBufferList=function(){return t.Message.getRepeatedFloatingPointField(this,3)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.setVertexBufferList=function(e){return t.Message.setField(this,3,e||[])},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.addVertexBuffer=function(e,r){return t.Message.addToRepeatedField(this,3,e,r)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.clearVertexBufferList=function(){return this.setVertexBufferList([])},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.getIndexBufferList=function(){return t.Message.getRepeatedField(this,4)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.setIndexBufferList=function(e){return t.Message.setField(this,4,e||[])},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.addIndexBuffer=function(e,r){return t.Message.addToRepeatedField(this,4,e,r)},proto.mediapipe.tasks.vision.face_geometry.proto.Mesh3d.prototype.clearIndexBufferList=function(){return this.setIndexBufferList([])},r.object.extend(e,proto.mediapipe.tasks.vision.face_geometry.proto)}(mesh_3d_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=matrix_data_pb;r.object.extend(proto,i);var a=mesh_3d_pb;r.object.extend(proto,a),r.exportSymbol("proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry",null,o),proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.displayName="proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.toObject(e,this)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.toObject=function(e,t){var r,o={mesh:(r=t.getMesh())&&a.Mesh3d.toObject(e,r),poseTransformMatrix:(r=t.getPoseTransformMatrix())&&i.MatrixData.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry;return proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new a.Mesh3d;t.readMessage(r,a.Mesh3d.deserializeBinaryFromReader),e.setMesh(r);break;case 2:r=new i.MatrixData;t.readMessage(r,i.MatrixData.deserializeBinaryFromReader),e.setPoseTransformMatrix(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.serializeBinaryToWriter=function(e,t){var r=void 0;null!=(r=e.getMesh())&&t.writeMessage(1,r,a.Mesh3d.serializeBinaryToWriter),null!=(r=e.getPoseTransformMatrix())&&t.writeMessage(2,r,i.MatrixData.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.prototype.getMesh=function(){return t.Message.getWrapperField(this,a.Mesh3d,1)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.prototype.setMesh=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.prototype.clearMesh=function(){return this.setMesh(void 0)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.prototype.hasMesh=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.prototype.getPoseTransformMatrix=function(){return t.Message.getWrapperField(this,i.MatrixData,2)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.prototype.setPoseTransformMatrix=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.prototype.clearPoseTransformMatrix=function(){return this.setPoseTransformMatrix(void 0)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometry.prototype.hasPoseTransformMatrix=function(){return null!=t.Message.getField(this,2)},r.object.extend(e,proto.mediapipe.tasks.vision.face_geometry.proto)}(face_geometry_pb);var face_landmarker_graph_options_pb={},face_geometry_graph_options_pb={},geometry_pipeline_calculator_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_options_pb;r.object.extend(proto,i);var a=external_file_pb;r.object.extend(proto,a),r.exportSymbol("proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions",null,o),proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.displayName="proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.toObject(e,this)},proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.toObject=function(e,t){var r,o={metadataFile:(r=t.getMetadataFile())&&a.ExternalFile.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions;return proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new a.ExternalFile;t.readMessage(r,a.ExternalFile.deserializeBinaryFromReader),e.setMetadataFile(r)}else t.skipField()}return e},proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.serializeBinaryToWriter=function(e,t){var r;null!=(r=e.getMetadataFile())&&t.writeMessage(1,r,a.ExternalFile.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.ext=new t.ExtensionFieldInfo(512499200,{ext:0},proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions,proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.toObject,0),i.CalculatorOptions.extensionsBinary[512499200]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.deserializeBinaryFromReader,!1),i.CalculatorOptions.extensions[512499200]=proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.ext,proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.prototype.getMetadataFile=function(){return t.Message.getWrapperField(this,a.ExternalFile,1)},proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.prototype.setMetadataFile=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.prototype.clearMetadataFile=function(){return this.setMetadataFile(void 0)},proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.prototype.hasMetadataFile=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.ext=new t.ExtensionFieldInfo(512499200,{ext:0},proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions,proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.toObject,0),i.CalculatorOptions.extensionsBinary[512499200]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.deserializeBinaryFromReader,!1),i.CalculatorOptions.extensions[512499200]=proto.mediapipe.tasks.vision.face_geometry.FaceGeometryPipelineCalculatorOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.face_geometry)}(geometry_pipeline_calculator_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_options_pb;r.object.extend(proto,i);var a=geometry_pipeline_calculator_pb;r.object.extend(proto,a),r.exportSymbol("proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions",null,o),proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.displayName="proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.toObject=function(e,t){var r,o={geometryPipelineOptions:(r=t.getGeometryPipelineOptions())&&a.FaceGeometryPipelineCalculatorOptions.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions;return proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new a.FaceGeometryPipelineCalculatorOptions;t.readMessage(r,a.FaceGeometryPipelineCalculatorOptions.deserializeBinaryFromReader),e.setGeometryPipelineOptions(r)}else t.skipField()}return e},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.serializeBinaryToWriter=function(e,t){var r;null!=(r=e.getGeometryPipelineOptions())&&t.writeMessage(1,r,a.FaceGeometryPipelineCalculatorOptions.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.ext=new t.ExtensionFieldInfo(515723506,{ext:0},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions,proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.toObject,0),i.CalculatorOptions.extensionsBinary[515723506]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.deserializeBinaryFromReader,!1),i.CalculatorOptions.extensions[515723506]=proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.ext,proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.prototype.getGeometryPipelineOptions=function(){return t.Message.getWrapperField(this,a.FaceGeometryPipelineCalculatorOptions,1)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.prototype.setGeometryPipelineOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.prototype.clearGeometryPipelineOptions=function(){return this.setGeometryPipelineOptions(void 0)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.prototype.hasGeometryPipelineOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.ext=new t.ExtensionFieldInfo(515723506,{ext:0},proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions,proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.toObject,0),i.CalculatorOptions.extensionsBinary[515723506]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.deserializeBinaryFromReader,!1),i.CalculatorOptions.extensions[515723506]=proto.mediapipe.tasks.vision.face_geometry.proto.FaceGeometryGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.face_geometry.proto)}(face_geometry_graph_options_pb);var face_landmarks_detector_graph_options_pb={},face_blendshapes_graph_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n),r.exportSymbol("proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions",null,o),proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.displayName="proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.toObject=function(e,t){var r,o={baseOptions:(r=t.getBaseOptions())&&n.BaseOptions.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions;return proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r)}else t.skipField()}return e},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.serializeBinaryToWriter=function(e,t){var r;null!=(r=e.getBaseOptions())&&t.writeMessage(1,r,n.BaseOptions.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.ext=new t.ExtensionFieldInfo(508981768,{ext:0},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[508981768]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[508981768]=proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.ext,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.ext=new t.ExtensionFieldInfo(508981768,{ext:0},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[508981768]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[508981768]=proto.mediapipe.tasks.vision.face_landmarker.proto.FaceBlendshapesGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.face_landmarker.proto)}(face_blendshapes_graph_options_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n);var s=face_blendshapes_graph_options_pb;r.object.extend(proto,s),r.exportSymbol("proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions",null,o),proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.displayName="proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.toObject=function(e,r){var o,i={baseOptions:(o=r.getBaseOptions())&&n.BaseOptions.toObject(e,o),minDetectionConfidence:t.Message.getFloatingPointFieldWithDefault(r,2,.5),smoothLandmarks:null==(o=t.Message.getBooleanField(r,4))?void 0:o,faceBlendshapesGraphOptions:(o=r.getFaceBlendshapesGraphOptions())&&s.FaceBlendshapesGraphOptions.toObject(e,o)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions;return proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=t.readFloat();e.setMinDetectionConfidence(r);break;case 4:r=t.readBool();e.setSmoothLandmarks(r);break;case 3:r=new s.FaceBlendshapesGraphOptions;t.readMessage(r,s.FaceBlendshapesGraphOptions.deserializeBinaryFromReader),e.setFaceBlendshapesGraphOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getBaseOptions())&&r.writeMessage(1,o,n.BaseOptions.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeFloat(2,o),null!=(o=t.Message.getField(e,4))&&r.writeBool(4,o),null!=(o=e.getFaceBlendshapesGraphOptions())&&r.writeMessage(3,o,s.FaceBlendshapesGraphOptions.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.ext=new t.ExtensionFieldInfo(508968149,{ext:0},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[508968149]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[508968149]=proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.ext,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.getMinDetectionConfidence=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,.5)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.setMinDetectionConfidence=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.clearMinDetectionConfidence=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.hasMinDetectionConfidence=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.getSmoothLandmarks=function(){return t.Message.getBooleanFieldWithDefault(this,4,!1)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.setSmoothLandmarks=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.clearSmoothLandmarks=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.hasSmoothLandmarks=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.getFaceBlendshapesGraphOptions=function(){return t.Message.getWrapperField(this,s.FaceBlendshapesGraphOptions,3)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.setFaceBlendshapesGraphOptions=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.clearFaceBlendshapesGraphOptions=function(){return this.setFaceBlendshapesGraphOptions(void 0)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.prototype.hasFaceBlendshapesGraphOptions=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.ext=new t.ExtensionFieldInfo(508968149,{ext:0},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[508968149]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[508968149]=proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarksDetectorGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.face_landmarker.proto)}(face_landmarks_detector_graph_options_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n);var s=face_detector_graph_options_pb;r.object.extend(proto,s);var p=face_geometry_graph_options_pb;r.object.extend(proto,p);var d=face_landmarks_detector_graph_options_pb;r.object.extend(proto,d),r.exportSymbol("proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions",null,o),proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.displayName="proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.toObject=function(e,r){var o,i={baseOptions:(o=r.getBaseOptions())&&n.BaseOptions.toObject(e,o),faceDetectorGraphOptions:(o=r.getFaceDetectorGraphOptions())&&s.FaceDetectorGraphOptions.toObject(e,o),faceLandmarksDetectorGraphOptions:(o=r.getFaceLandmarksDetectorGraphOptions())&&d.FaceLandmarksDetectorGraphOptions.toObject(e,o),minTrackingConfidence:t.Message.getFloatingPointFieldWithDefault(r,4,.5),faceGeometryGraphOptions:(o=r.getFaceGeometryGraphOptions())&&p.FaceGeometryGraphOptions.toObject(e,o)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions;return proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=new s.FaceDetectorGraphOptions;t.readMessage(r,s.FaceDetectorGraphOptions.deserializeBinaryFromReader),e.setFaceDetectorGraphOptions(r);break;case 3:r=new d.FaceLandmarksDetectorGraphOptions;t.readMessage(r,d.FaceLandmarksDetectorGraphOptions.deserializeBinaryFromReader),e.setFaceLandmarksDetectorGraphOptions(r);break;case 4:r=t.readFloat();e.setMinTrackingConfidence(r);break;case 5:r=new p.FaceGeometryGraphOptions;t.readMessage(r,p.FaceGeometryGraphOptions.deserializeBinaryFromReader),e.setFaceGeometryGraphOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getBaseOptions())&&r.writeMessage(1,o,n.BaseOptions.serializeBinaryToWriter),null!=(o=e.getFaceDetectorGraphOptions())&&r.writeMessage(2,o,s.FaceDetectorGraphOptions.serializeBinaryToWriter),null!=(o=e.getFaceLandmarksDetectorGraphOptions())&&r.writeMessage(3,o,d.FaceLandmarksDetectorGraphOptions.serializeBinaryToWriter),null!=(o=t.Message.getField(e,4))&&r.writeFloat(4,o),null!=(o=e.getFaceGeometryGraphOptions())&&r.writeMessage(5,o,p.FaceGeometryGraphOptions.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.ext=new t.ExtensionFieldInfo(508968150,{ext:0},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[508968150]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[508968150]=proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.ext,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.getFaceDetectorGraphOptions=function(){return t.Message.getWrapperField(this,s.FaceDetectorGraphOptions,2)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.setFaceDetectorGraphOptions=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.clearFaceDetectorGraphOptions=function(){return this.setFaceDetectorGraphOptions(void 0)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.hasFaceDetectorGraphOptions=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.getFaceLandmarksDetectorGraphOptions=function(){return t.Message.getWrapperField(this,d.FaceLandmarksDetectorGraphOptions,3)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.setFaceLandmarksDetectorGraphOptions=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.clearFaceLandmarksDetectorGraphOptions=function(){return this.setFaceLandmarksDetectorGraphOptions(void 0)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.hasFaceLandmarksDetectorGraphOptions=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.getMinTrackingConfidence=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,.5)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.setMinTrackingConfidence=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.clearMinTrackingConfidence=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.hasMinTrackingConfidence=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.getFaceGeometryGraphOptions=function(){return t.Message.getWrapperField(this,p.FaceGeometryGraphOptions,5)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.setFaceGeometryGraphOptions=function(e){return t.Message.setWrapperField(this,5,e)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.clearFaceGeometryGraphOptions=function(){return this.setFaceGeometryGraphOptions(void 0)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.prototype.hasFaceGeometryGraphOptions=function(){return null!=t.Message.getField(this,5)},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.ext=new t.ExtensionFieldInfo(508968150,{ext:0},proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[508968150]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[508968150]=proto.mediapipe.tasks.vision.face_landmarker.proto.FaceLandmarkerGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.face_landmarker.proto)}(face_landmarker_graph_options_pb);var classifier_result={};Object.defineProperty(classifier_result,"__esModule",{value:!0}),classifier_result.convertFromClassificationResultProto=classifier_result.convertFromClassifications=void 0;const DEFAULT_INDEX$1=-1,DEFAULT_SCORE=0;function convertFromClassifications(e,t=DEFAULT_INDEX$1,r=""){return{categories:e.map((e=>{var t,r,o,i;return{index:null!==(t=e.getIndex())&&void 0!==t?t:DEFAULT_INDEX$1,score:null!==(r=e.getScore())&&void 0!==r?r:DEFAULT_SCORE,categoryName:null!==(o=e.getLabel())&&void 0!==o?o:"",displayName:null!==(i=e.getDisplayName())&&void 0!==i?i:""}})),headIndex:t,headName:r}}function convertFromClassificationsProto(e){var t,r;return convertFromClassifications(null!==(r=null===(t=e.getClassificationList())||void 0===t?void 0:t.getClassificationList())&&void 0!==r?r:[],e.getHeadIndex(),e.getHeadName())}function convertFromClassificationResultProto(e){const t={classifications:e.getClassificationsList().map((e=>convertFromClassificationsProto(e)))};return e.hasTimestampMs()&&(t.timestampMs=e.getTimestampMs()),t}classifier_result.convertFromClassifications=convertFromClassifications,classifier_result.convertFromClassificationResultProto=convertFromClassificationResultProto;var landmark_result={};function convertToLandmarks(e){var t,r,o;const i=[];for(const a of e.getLandmarkList())i.push({x:null!==(t=a.getX())&&void 0!==t?t:0,y:null!==(r=a.getY())&&void 0!==r?r:0,z:null!==(o=a.getZ())&&void 0!==o?o:0});return i}function convertToWorldLandmarks(e){var t,r,o;const i=[];for(const a of e.getLandmarkList())i.push({x:null!==(t=a.getX())&&void 0!==t?t:0,y:null!==(r=a.getY())&&void 0!==r?r:0,z:null!==(o=a.getZ())&&void 0!==o?o:0});return i}Object.defineProperty(landmark_result,"__esModule",{value:!0}),landmark_result.convertToWorldLandmarks=landmark_result.convertToLandmarks=void 0,landmark_result.convertToLandmarks=convertToLandmarks,landmark_result.convertToWorldLandmarks=convertToWorldLandmarks;var face_landmarks_connections={},exports;exports=face_landmarks_connections,Object.defineProperty(exports,"__esModule",{value:!0}),exports.FACE_LANDMARKS_TESSELATION=exports.FACE_LANDMARKS_CONTOURS=exports.FACE_LANDMARKS_FACE_OVAL=exports.FACE_LANDMARKS_RIGHT_IRIS=exports.FACE_LANDMARKS_RIGHT_EYEBROW=exports.FACE_LANDMARKS_RIGHT_EYE=exports.FACE_LANDMARKS_LEFT_IRIS=exports.FACE_LANDMARKS_LEFT_EYEBROW=exports.FACE_LANDMARKS_LEFT_EYE=exports.FACE_LANDMARKS_LIPS=void 0,exports.FACE_LANDMARKS_LIPS=[{start:61,end:146},{start:146,end:91},{start:91,end:181},{start:181,end:84},{start:84,end:17},{start:17,end:314},{start:314,end:405},{start:405,end:321},{start:321,end:375},{start:375,end:291},{start:61,end:185},{start:185,end:40},{start:40,end:39},{start:39,end:37},{start:37,end:0},{start:0,end:267},{start:267,end:269},{start:269,end:270},{start:270,end:409},{start:409,end:291},{start:78,end:95},{start:95,end:88},{start:88,end:178},{start:178,end:87},{start:87,end:14},{start:14,end:317},{start:317,end:402},{start:402,end:318},{start:318,end:324},{start:324,end:308},{start:78,end:191},{start:191,end:80},{start:80,end:81},{start:81,end:82},{start:82,end:13},{start:13,end:312},{start:312,end:311},{start:311,end:310},{start:310,end:415},{start:415,end:308}],exports.FACE_LANDMARKS_LEFT_EYE=[{start:263,end:249},{start:249,end:390},{start:390,end:373},{start:373,end:374},{start:374,end:380},{start:380,end:381},{start:381,end:382},{start:382,end:362},{start:263,end:466},{start:466,end:388},{start:388,end:387},{start:387,end:386},{start:386,end:385},{start:385,end:384},{start:384,end:398},{start:398,end:362}],exports.FACE_LANDMARKS_LEFT_EYEBROW=[{start:276,end:283},{start:283,end:282},{start:282,end:295},{start:295,end:285},{start:300,end:293},{start:293,end:334},{start:334,end:296},{start:296,end:336}],exports.FACE_LANDMARKS_LEFT_IRIS=[{start:474,end:475},{start:475,end:476},{start:476,end:477},{start:477,end:474}],exports.FACE_LANDMARKS_RIGHT_EYE=[{start:33,end:7},{start:7,end:163},{start:163,end:144},{start:144,end:145},{start:145,end:153},{start:153,end:154},{start:154,end:155},{start:155,end:133},{start:33,end:246},{start:246,end:161},{start:161,end:160},{start:160,end:159},{start:159,end:158},{start:158,end:157},{start:157,end:173},{start:173,end:133}],exports.FACE_LANDMARKS_RIGHT_EYEBROW=[{start:46,end:53},{start:53,end:52},{start:52,end:65},{start:65,end:55},{start:70,end:63},{start:63,end:105},{start:105,end:66},{start:66,end:107}],exports.FACE_LANDMARKS_RIGHT_IRIS=[{start:469,end:470},{start:470,end:471},{start:471,end:472},{start:472,end:469}],exports.FACE_LANDMARKS_FACE_OVAL=[{start:10,end:338},{start:338,end:297},{start:297,end:332},{start:332,end:284},{start:284,end:251},{start:251,end:389},{start:389,end:356},{start:356,end:454},{start:454,end:323},{start:323,end:361},{start:361,end:288},{start:288,end:397},{start:397,end:365},{start:365,end:379},{start:379,end:378},{start:378,end:400},{start:400,end:377},{start:377,end:152},{start:152,end:148},{start:148,end:176},{start:176,end:149},{start:149,end:150},{start:150,end:136},{start:136,end:172},{start:172,end:58},{start:58,end:132},{start:132,end:93},{start:93,end:234},{start:234,end:127},{start:127,end:162},{start:162,end:21},{start:21,end:54},{start:54,end:103},{start:103,end:67},{start:67,end:109},{start:109,end:10}],exports.FACE_LANDMARKS_CONTOURS=[...exports.FACE_LANDMARKS_LIPS,...exports.FACE_LANDMARKS_LEFT_EYE,...exports.FACE_LANDMARKS_LEFT_EYEBROW,...exports.FACE_LANDMARKS_RIGHT_EYE,...exports.FACE_LANDMARKS_RIGHT_EYEBROW,...exports.FACE_LANDMARKS_FACE_OVAL],exports.FACE_LANDMARKS_TESSELATION=[{start:127,end:34},{start:34,end:139},{start:139,end:127},{start:11,end:0},{start:0,end:37},{start:37,end:11},{start:232,end:231},{start:231,end:120},{start:120,end:232},{start:72,end:37},{start:37,end:39},{start:39,end:72},{start:128,end:121},{start:121,end:47},{start:47,end:128},{start:232,end:121},{start:121,end:128},{start:128,end:232},{start:104,end:69},{start:69,end:67},{start:67,end:104},{start:175,end:171},{start:171,end:148},{start:148,end:175},{start:118,end:50},{start:50,end:101},{start:101,end:118},{start:73,end:39},{start:39,end:40},{start:40,end:73},{start:9,end:151},{start:151,end:108},{start:108,end:9},{start:48,end:115},{start:115,end:131},{start:131,end:48},{start:194,end:204},{start:204,end:211},{start:211,end:194},{start:74,end:40},{start:40,end:185},{start:185,end:74},{start:80,end:42},{start:42,end:183},{start:183,end:80},{start:40,end:92},{start:92,end:186},{start:186,end:40},{start:230,end:229},{start:229,end:118},{start:118,end:230},{start:202,end:212},{start:212,end:214},{start:214,end:202},{start:83,end:18},{start:18,end:17},{start:17,end:83},{start:76,end:61},{start:61,end:146},{start:146,end:76},{start:160,end:29},{start:29,end:30},{start:30,end:160},{start:56,end:157},{start:157,end:173},{start:173,end:56},{start:106,end:204},{start:204,end:194},{start:194,end:106},{start:135,end:214},{start:214,end:192},{start:192,end:135},{start:203,end:165},{start:165,end:98},{start:98,end:203},{start:21,end:71},{start:71,end:68},{start:68,end:21},{start:51,end:45},{start:45,end:4},{start:4,end:51},{start:144,end:24},{start:24,end:23},{start:23,end:144},{start:77,end:146},{start:146,end:91},{start:91,end:77},{start:205,end:50},{start:50,end:187},{start:187,end:205},{start:201,end:200},{start:200,end:18},{start:18,end:201},{start:91,end:106},{start:106,end:182},{start:182,end:91},{start:90,end:91},{start:91,end:181},{start:181,end:90},{start:85,end:84},{start:84,end:17},{start:17,end:85},{start:206,end:203},{start:203,end:36},{start:36,end:206},{start:148,end:171},{start:171,end:140},{start:140,end:148},{start:92,end:40},{start:40,end:39},{start:39,end:92},{start:193,end:189},{start:189,end:244},{start:244,end:193},{start:159,end:158},{start:158,end:28},{start:28,end:159},{start:247,end:246},{start:246,end:161},{start:161,end:247},{start:236,end:3},{start:3,end:196},{start:196,end:236},{start:54,end:68},{start:68,end:104},{start:104,end:54},{start:193,end:168},{start:168,end:8},{start:8,end:193},{start:117,end:228},{start:228,end:31},{start:31,end:117},{start:189,end:193},{start:193,end:55},{start:55,end:189},{start:98,end:97},{start:97,end:99},{start:99,end:98},{start:126,end:47},{start:47,end:100},{start:100,end:126},{start:166,end:79},{start:79,end:218},{start:218,end:166},{start:155,end:154},{start:154,end:26},{start:26,end:155},{start:209,end:49},{start:49,end:131},{start:131,end:209},{start:135,end:136},{start:136,end:150},{start:150,end:135},{start:47,end:126},{start:126,end:217},{start:217,end:47},{start:223,end:52},{start:52,end:53},{start:53,end:223},{start:45,end:51},{start:51,end:134},{start:134,end:45},{start:211,end:170},{start:170,end:140},{start:140,end:211},{start:67,end:69},{start:69,end:108},{start:108,end:67},{start:43,end:106},{start:106,end:91},{start:91,end:43},{start:230,end:119},{start:119,end:120},{start:120,end:230},{start:226,end:130},{start:130,end:247},{start:247,end:226},{start:63,end:53},{start:53,end:52},{start:52,end:63},{start:238,end:20},{start:20,end:242},{start:242,end:238},{start:46,end:70},{start:70,end:156},{start:156,end:46},{start:78,end:62},{start:62,end:96},{start:96,end:78},{start:46,end:53},{start:53,end:63},{start:63,end:46},{start:143,end:34},{start:34,end:227},{start:227,end:143},{start:123,end:117},{start:117,end:111},{start:111,end:123},{start:44,end:125},{start:125,end:19},{start:19,end:44},{start:236,end:134},{start:134,end:51},{start:51,end:236},{start:216,end:206},{start:206,end:205},{start:205,end:216},{start:154,end:153},{start:153,end:22},{start:22,end:154},{start:39,end:37},{start:37,end:167},{start:167,end:39},{start:200,end:201},{start:201,end:208},{start:208,end:200},{start:36,end:142},{start:142,end:100},{start:100,end:36},{start:57,end:212},{start:212,end:202},{start:202,end:57},{start:20,end:60},{start:60,end:99},{start:99,end:20},{start:28,end:158},{start:158,end:157},{start:157,end:28},{start:35,end:226},{start:226,end:113},{start:113,end:35},{start:160,end:159},{start:159,end:27},{start:27,end:160},{start:204,end:202},{start:202,end:210},{start:210,end:204},{start:113,end:225},{start:225,end:46},{start:46,end:113},{start:43,end:202},{start:202,end:204},{start:204,end:43},{start:62,end:76},{start:76,end:77},{start:77,end:62},{start:137,end:123},{start:123,end:116},{start:116,end:137},{start:41,end:38},{start:38,end:72},{start:72,end:41},{start:203,end:129},{start:129,end:142},{start:142,end:203},{start:64,end:98},{start:98,end:240},{start:240,end:64},{start:49,end:102},{start:102,end:64},{start:64,end:49},{start:41,end:73},{start:73,end:74},{start:74,end:41},{start:212,end:216},{start:216,end:207},{start:207,end:212},{start:42,end:74},{start:74,end:184},{start:184,end:42},{start:169,end:170},{start:170,end:211},{start:211,end:169},{start:170,end:149},{start:149,end:176},{start:176,end:170},{start:105,end:66},{start:66,end:69},{start:69,end:105},{start:122,end:6},{start:6,end:168},{start:168,end:122},{start:123,end:147},{start:147,end:187},{start:187,end:123},{start:96,end:77},{start:77,end:90},{start:90,end:96},{start:65,end:55},{start:55,end:107},{start:107,end:65},{start:89,end:90},{start:90,end:180},{start:180,end:89},{start:101,end:100},{start:100,end:120},{start:120,end:101},{start:63,end:105},{start:105,end:104},{start:104,end:63},{start:93,end:137},{start:137,end:227},{start:227,end:93},{start:15,end:86},{start:86,end:85},{start:85,end:15},{start:129,end:102},{start:102,end:49},{start:49,end:129},{start:14,end:87},{start:87,end:86},{start:86,end:14},{start:55,end:8},{start:8,end:9},{start:9,end:55},{start:100,end:47},{start:47,end:121},{start:121,end:100},{start:145,end:23},{start:23,end:22},{start:22,end:145},{start:88,end:89},{start:89,end:179},{start:179,end:88},{start:6,end:122},{start:122,end:196},{start:196,end:6},{start:88,end:95},{start:95,end:96},{start:96,end:88},{start:138,end:172},{start:172,end:136},{start:136,end:138},{start:215,end:58},{start:58,end:172},{start:172,end:215},{start:115,end:48},{start:48,end:219},{start:219,end:115},{start:42,end:80},{start:80,end:81},{start:81,end:42},{start:195,end:3},{start:3,end:51},{start:51,end:195},{start:43,end:146},{start:146,end:61},{start:61,end:43},{start:171,end:175},{start:175,end:199},{start:199,end:171},{start:81,end:82},{start:82,end:38},{start:38,end:81},{start:53,end:46},{start:46,end:225},{start:225,end:53},{start:144,end:163},{start:163,end:110},{start:110,end:144},{start:52,end:65},{start:65,end:66},{start:66,end:52},{start:229,end:228},{start:228,end:117},{start:117,end:229},{start:34,end:127},{start:127,end:234},{start:234,end:34},{start:107,end:108},{start:108,end:69},{start:69,end:107},{start:109,end:108},{start:108,end:151},{start:151,end:109},{start:48,end:64},{start:64,end:235},{start:235,end:48},{start:62,end:78},{start:78,end:191},{start:191,end:62},{start:129,end:209},{start:209,end:126},{start:126,end:129},{start:111,end:35},{start:35,end:143},{start:143,end:111},{start:117,end:123},{start:123,end:50},{start:50,end:117},{start:222,end:65},{start:65,end:52},{start:52,end:222},{start:19,end:125},{start:125,end:141},{start:141,end:19},{start:221,end:55},{start:55,end:65},{start:65,end:221},{start:3,end:195},{start:195,end:197},{start:197,end:3},{start:25,end:7},{start:7,end:33},{start:33,end:25},{start:220,end:237},{start:237,end:44},{start:44,end:220},{start:70,end:71},{start:71,end:139},{start:139,end:70},{start:122,end:193},{start:193,end:245},{start:245,end:122},{start:247,end:130},{start:130,end:33},{start:33,end:247},{start:71,end:21},{start:21,end:162},{start:162,end:71},{start:170,end:169},{start:169,end:150},{start:150,end:170},{start:188,end:174},{start:174,end:196},{start:196,end:188},{start:216,end:186},{start:186,end:92},{start:92,end:216},{start:2,end:97},{start:97,end:167},{start:167,end:2},{start:141,end:125},{start:125,end:241},{start:241,end:141},{start:164,end:167},{start:167,end:37},{start:37,end:164},{start:72,end:38},{start:38,end:12},{start:12,end:72},{start:38,end:82},{start:82,end:13},{start:13,end:38},{start:63,end:68},{start:68,end:71},{start:71,end:63},{start:226,end:35},{start:35,end:111},{start:111,end:226},{start:101,end:50},{start:50,end:205},{start:205,end:101},{start:206,end:92},{start:92,end:165},{start:165,end:206},{start:209,end:198},{start:198,end:217},{start:217,end:209},{start:165,end:167},{start:167,end:97},{start:97,end:165},{start:220,end:115},{start:115,end:218},{start:218,end:220},{start:133,end:112},{start:112,end:243},{start:243,end:133},{start:239,end:238},{start:238,end:241},{start:241,end:239},{start:214,end:135},{start:135,end:169},{start:169,end:214},{start:190,end:173},{start:173,end:133},{start:133,end:190},{start:171,end:208},{start:208,end:32},{start:32,end:171},{start:125,end:44},{start:44,end:237},{start:237,end:125},{start:86,end:87},{start:87,end:178},{start:178,end:86},{start:85,end:86},{start:86,end:179},{start:179,end:85},{start:84,end:85},{start:85,end:180},{start:180,end:84},{start:83,end:84},{start:84,end:181},{start:181,end:83},{start:201,end:83},{start:83,end:182},{start:182,end:201},{start:137,end:93},{start:93,end:132},{start:132,end:137},{start:76,end:62},{start:62,end:183},{start:183,end:76},{start:61,end:76},{start:76,end:184},{start:184,end:61},{start:57,end:61},{start:61,end:185},{start:185,end:57},{start:212,end:57},{start:57,end:186},{start:186,end:212},{start:214,end:207},{start:207,end:187},{start:187,end:214},{start:34,end:143},{start:143,end:156},{start:156,end:34},{start:79,end:239},{start:239,end:237},{start:237,end:79},{start:123,end:137},{start:137,end:177},{start:177,end:123},{start:44,end:1},{start:1,end:4},{start:4,end:44},{start:201,end:194},{start:194,end:32},{start:32,end:201},{start:64,end:102},{start:102,end:129},{start:129,end:64},{start:213,end:215},{start:215,end:138},{start:138,end:213},{start:59,end:166},{start:166,end:219},{start:219,end:59},{start:242,end:99},{start:99,end:97},{start:97,end:242},{start:2,end:94},{start:94,end:141},{start:141,end:2},{start:75,end:59},{start:59,end:235},{start:235,end:75},{start:24,end:110},{start:110,end:228},{start:228,end:24},{start:25,end:130},{start:130,end:226},{start:226,end:25},{start:23,end:24},{start:24,end:229},{start:229,end:23},{start:22,end:23},{start:23,end:230},{start:230,end:22},{start:26,end:22},{start:22,end:231},{start:231,end:26},{start:112,end:26},{start:26,end:232},{start:232,end:112},{start:189,end:190},{start:190,end:243},{start:243,end:189},{start:221,end:56},{start:56,end:190},{start:190,end:221},{start:28,end:56},{start:56,end:221},{start:221,end:28},{start:27,end:28},{start:28,end:222},{start:222,end:27},{start:29,end:27},{start:27,end:223},{start:223,end:29},{start:30,end:29},{start:29,end:224},{start:224,end:30},{start:247,end:30},{start:30,end:225},{start:225,end:247},{start:238,end:79},{start:79,end:20},{start:20,end:238},{start:166,end:59},{start:59,end:75},{start:75,end:166},{start:60,end:75},{start:75,end:240},{start:240,end:60},{start:147,end:177},{start:177,end:215},{start:215,end:147},{start:20,end:79},{start:79,end:166},{start:166,end:20},{start:187,end:147},{start:147,end:213},{start:213,end:187},{start:112,end:233},{start:233,end:244},{start:244,end:112},{start:233,end:128},{start:128,end:245},{start:245,end:233},{start:128,end:114},{start:114,end:188},{start:188,end:128},{start:114,end:217},{start:217,end:174},{start:174,end:114},{start:131,end:115},{start:115,end:220},{start:220,end:131},{start:217,end:198},{start:198,end:236},{start:236,end:217},{start:198,end:131},{start:131,end:134},{start:134,end:198},{start:177,end:132},{start:132,end:58},{start:58,end:177},{start:143,end:35},{start:35,end:124},{start:124,end:143},{start:110,end:163},{start:163,end:7},{start:7,end:110},{start:228,end:110},{start:110,end:25},{start:25,end:228},{start:356,end:389},{start:389,end:368},{start:368,end:356},{start:11,end:302},{start:302,end:267},{start:267,end:11},{start:452,end:350},{start:350,end:349},{start:349,end:452},{start:302,end:303},{start:303,end:269},{start:269,end:302},{start:357,end:343},{start:343,end:277},{start:277,end:357},{start:452,end:453},{start:453,end:357},{start:357,end:452},{start:333,end:332},{start:332,end:297},{start:297,end:333},{start:175,end:152},{start:152,end:377},{start:377,end:175},{start:347,end:348},{start:348,end:330},{start:330,end:347},{start:303,end:304},{start:304,end:270},{start:270,end:303},{start:9,end:336},{start:336,end:337},{start:337,end:9},{start:278,end:279},{start:279,end:360},{start:360,end:278},{start:418,end:262},{start:262,end:431},{start:431,end:418},{start:304,end:408},{start:408,end:409},{start:409,end:304},{start:310,end:415},{start:415,end:407},{start:407,end:310},{start:270,end:409},{start:409,end:410},{start:410,end:270},{start:450,end:348},{start:348,end:347},{start:347,end:450},{start:422,end:430},{start:430,end:434},{start:434,end:422},{start:313,end:314},{start:314,end:17},{start:17,end:313},{start:306,end:307},{start:307,end:375},{start:375,end:306},{start:387,end:388},{start:388,end:260},{start:260,end:387},{start:286,end:414},{start:414,end:398},{start:398,end:286},{start:335,end:406},{start:406,end:418},{start:418,end:335},{start:364,end:367},{start:367,end:416},{start:416,end:364},{start:423,end:358},{start:358,end:327},{start:327,end:423},{start:251,end:284},{start:284,end:298},{start:298,end:251},{start:281,end:5},{start:5,end:4},{start:4,end:281},{start:373,end:374},{start:374,end:253},{start:253,end:373},{start:307,end:320},{start:320,end:321},{start:321,end:307},{start:425,end:427},{start:427,end:411},{start:411,end:425},{start:421,end:313},{start:313,end:18},{start:18,end:421},{start:321,end:405},{start:405,end:406},{start:406,end:321},{start:320,end:404},{start:404,end:405},{start:405,end:320},{start:315,end:16},{start:16,end:17},{start:17,end:315},{start:426,end:425},{start:425,end:266},{start:266,end:426},{start:377,end:400},{start:400,end:369},{start:369,end:377},{start:322,end:391},{start:391,end:269},{start:269,end:322},{start:417,end:465},{start:465,end:464},{start:464,end:417},{start:386,end:257},{start:257,end:258},{start:258,end:386},{start:466,end:260},{start:260,end:388},{start:388,end:466},{start:456,end:399},{start:399,end:419},{start:419,end:456},{start:284,end:332},{start:332,end:333},{start:333,end:284},{start:417,end:285},{start:285,end:8},{start:8,end:417},{start:346,end:340},{start:340,end:261},{start:261,end:346},{start:413,end:441},{start:441,end:285},{start:285,end:413},{start:327,end:460},{start:460,end:328},{start:328,end:327},{start:355,end:371},{start:371,end:329},{start:329,end:355},{start:392,end:439},{start:439,end:438},{start:438,end:392},{start:382,end:341},{start:341,end:256},{start:256,end:382},{start:429,end:420},{start:420,end:360},{start:360,end:429},{start:364,end:394},{start:394,end:379},{start:379,end:364},{start:277,end:343},{start:343,end:437},{start:437,end:277},{start:443,end:444},{start:444,end:283},{start:283,end:443},{start:275,end:440},{start:440,end:363},{start:363,end:275},{start:431,end:262},{start:262,end:369},{start:369,end:431},{start:297,end:338},{start:338,end:337},{start:337,end:297},{start:273,end:375},{start:375,end:321},{start:321,end:273},{start:450,end:451},{start:451,end:349},{start:349,end:450},{start:446,end:342},{start:342,end:467},{start:467,end:446},{start:293,end:334},{start:334,end:282},{start:282,end:293},{start:458,end:461},{start:461,end:462},{start:462,end:458},{start:276,end:353},{start:353,end:383},{start:383,end:276},{start:308,end:324},{start:324,end:325},{start:325,end:308},{start:276,end:300},{start:300,end:293},{start:293,end:276},{start:372,end:345},{start:345,end:447},{start:447,end:372},{start:352,end:345},{start:345,end:340},{start:340,end:352},{start:274,end:1},{start:1,end:19},{start:19,end:274},{start:456,end:248},{start:248,end:281},{start:281,end:456},{start:436,end:427},{start:427,end:425},{start:425,end:436},{start:381,end:256},{start:256,end:252},{start:252,end:381},{start:269,end:391},{start:391,end:393},{start:393,end:269},{start:200,end:199},{start:199,end:428},{start:428,end:200},{start:266,end:330},{start:330,end:329},{start:329,end:266},{start:287,end:273},{start:273,end:422},{start:422,end:287},{start:250,end:462},{start:462,end:328},{start:328,end:250},{start:258,end:286},{start:286,end:384},{start:384,end:258},{start:265,end:353},{start:353,end:342},{start:342,end:265},{start:387,end:259},{start:259,end:257},{start:257,end:387},{start:424,end:431},{start:431,end:430},{start:430,end:424},{start:342,end:353},{start:353,end:276},{start:276,end:342},{start:273,end:335},{start:335,end:424},{start:424,end:273},{start:292,end:325},{start:325,end:307},{start:307,end:292},{start:366,end:447},{start:447,end:345},{start:345,end:366},{start:271,end:303},{start:303,end:302},{start:302,end:271},{start:423,end:266},{start:266,end:371},{start:371,end:423},{start:294,end:455},{start:455,end:460},{start:460,end:294},{start:279,end:278},{start:278,end:294},{start:294,end:279},{start:271,end:272},{start:272,end:304},{start:304,end:271},{start:432,end:434},{start:434,end:427},{start:427,end:432},{start:272,end:407},{start:407,end:408},{start:408,end:272},{start:394,end:430},{start:430,end:431},{start:431,end:394},{start:395,end:369},{start:369,end:400},{start:400,end:395},{start:334,end:333},{start:333,end:299},{start:299,end:334},{start:351,end:417},{start:417,end:168},{start:168,end:351},{start:352,end:280},{start:280,end:411},{start:411,end:352},{start:325,end:319},{start:319,end:320},{start:320,end:325},{start:295,end:296},{start:296,end:336},{start:336,end:295},{start:319,end:403},{start:403,end:404},{start:404,end:319},{start:330,end:348},{start:348,end:349},{start:349,end:330},{start:293,end:298},{start:298,end:333},{start:333,end:293},{start:323,end:454},{start:454,end:447},{start:447,end:323},{start:15,end:16},{start:16,end:315},{start:315,end:15},{start:358,end:429},{start:429,end:279},{start:279,end:358},{start:14,end:15},{start:15,end:316},{start:316,end:14},{start:285,end:336},{start:336,end:9},{start:9,end:285},{start:329,end:349},{start:349,end:350},{start:350,end:329},{start:374,end:380},{start:380,end:252},{start:252,end:374},{start:318,end:402},{start:402,end:403},{start:403,end:318},{start:6,end:197},{start:197,end:419},{start:419,end:6},{start:318,end:319},{start:319,end:325},{start:325,end:318},{start:367,end:364},{start:364,end:365},{start:365,end:367},{start:435,end:367},{start:367,end:397},{start:397,end:435},{start:344,end:438},{start:438,end:439},{start:439,end:344},{start:272,end:271},{start:271,end:311},{start:311,end:272},{start:195,end:5},{start:5,end:281},{start:281,end:195},{start:273,end:287},{start:287,end:291},{start:291,end:273},{start:396,end:428},{start:428,end:199},{start:199,end:396},{start:311,end:271},{start:271,end:268},{start:268,end:311},{start:283,end:444},{start:444,end:445},{start:445,end:283},{start:373,end:254},{start:254,end:339},{start:339,end:373},{start:282,end:334},{start:334,end:296},{start:296,end:282},{start:449,end:347},{start:347,end:346},{start:346,end:449},{start:264,end:447},{start:447,end:454},{start:454,end:264},{start:336,end:296},{start:296,end:299},{start:299,end:336},{start:338,end:10},{start:10,end:151},{start:151,end:338},{start:278,end:439},{start:439,end:455},{start:455,end:278},{start:292,end:407},{start:407,end:415},{start:415,end:292},{start:358,end:371},{start:371,end:355},{start:355,end:358},{start:340,end:345},{start:345,end:372},{start:372,end:340},{start:346,end:347},{start:347,end:280},{start:280,end:346},{start:442,end:443},{start:443,end:282},{start:282,end:442},{start:19,end:94},{start:94,end:370},{start:370,end:19},{start:441,end:442},{start:442,end:295},{start:295,end:441},{start:248,end:419},{start:419,end:197},{start:197,end:248},{start:263,end:255},{start:255,end:359},{start:359,end:263},{start:440,end:275},{start:275,end:274},{start:274,end:440},{start:300,end:383},{start:383,end:368},{start:368,end:300},{start:351,end:412},{start:412,end:465},{start:465,end:351},{start:263,end:467},{start:467,end:466},{start:466,end:263},{start:301,end:368},{start:368,end:389},{start:389,end:301},{start:395,end:378},{start:378,end:379},{start:379,end:395},{start:412,end:351},{start:351,end:419},{start:419,end:412},{start:436,end:426},{start:426,end:322},{start:322,end:436},{start:2,end:164},{start:164,end:393},{start:393,end:2},{start:370,end:462},{start:462,end:461},{start:461,end:370},{start:164,end:0},{start:0,end:267},{start:267,end:164},{start:302,end:11},{start:11,end:12},{start:12,end:302},{start:268,end:12},{start:12,end:13},{start:13,end:268},{start:293,end:300},{start:300,end:301},{start:301,end:293},{start:446,end:261},{start:261,end:340},{start:340,end:446},{start:330,end:266},{start:266,end:425},{start:425,end:330},{start:426,end:423},{start:423,end:391},{start:391,end:426},{start:429,end:355},{start:355,end:437},{start:437,end:429},{start:391,end:327},{start:327,end:326},{start:326,end:391},{start:440,end:457},{start:457,end:438},{start:438,end:440},{start:341,end:382},{start:382,end:362},{start:362,end:341},{start:459,end:457},{start:457,end:461},{start:461,end:459},{start:434,end:430},{start:430,end:394},{start:394,end:434},{start:414,end:463},{start:463,end:362},{start:362,end:414},{start:396,end:369},{start:369,end:262},{start:262,end:396},{start:354,end:461},{start:461,end:457},{start:457,end:354},{start:316,end:403},{start:403,end:402},{start:402,end:316},{start:315,end:404},{start:404,end:403},{start:403,end:315},{start:314,end:405},{start:405,end:404},{start:404,end:314},{start:313,end:406},{start:406,end:405},{start:405,end:313},{start:421,end:418},{start:418,end:406},{start:406,end:421},{start:366,end:401},{start:401,end:361},{start:361,end:366},{start:306,end:408},{start:408,end:407},{start:407,end:306},{start:291,end:409},{start:409,end:408},{start:408,end:291},{start:287,end:410},{start:410,end:409},{start:409,end:287},{start:432,end:436},{start:436,end:410},{start:410,end:432},{start:434,end:416},{start:416,end:411},{start:411,end:434},{start:264,end:368},{start:368,end:383},{start:383,end:264},{start:309,end:438},{start:438,end:457},{start:457,end:309},{start:352,end:376},{start:376,end:401},{start:401,end:352},{start:274,end:275},{start:275,end:4},{start:4,end:274},{start:421,end:428},{start:428,end:262},{start:262,end:421},{start:294,end:327},{start:327,end:358},{start:358,end:294},{start:433,end:416},{start:416,end:367},{start:367,end:433},{start:289,end:455},{start:455,end:439},{start:439,end:289},{start:462,end:370},{start:370,end:326},{start:326,end:462},{start:2,end:326},{start:326,end:370},{start:370,end:2},{start:305,end:460},{start:460,end:455},{start:455,end:305},{start:254,end:449},{start:449,end:448},{start:448,end:254},{start:255,end:261},{start:261,end:446},{start:446,end:255},{start:253,end:450},{start:450,end:449},{start:449,end:253},{start:252,end:451},{start:451,end:450},{start:450,end:252},{start:256,end:452},{start:452,end:451},{start:451,end:256},{start:341,end:453},{start:453,end:452},{start:452,end:341},{start:413,end:464},{start:464,end:463},{start:463,end:413},{start:441,end:413},{start:413,end:414},{start:414,end:441},{start:258,end:442},{start:442,end:441},{start:441,end:258},{start:257,end:443},{start:443,end:442},{start:442,end:257},{start:259,end:444},{start:444,end:443},{start:443,end:259},{start:260,end:445},{start:445,end:444},{start:444,end:260},{start:467,end:342},{start:342,end:445},{start:445,end:467},{start:459,end:458},{start:458,end:250},{start:250,end:459},{start:289,end:392},{start:392,end:290},{start:290,end:289},{start:290,end:328},{start:328,end:460},{start:460,end:290},{start:376,end:433},{start:433,end:435},{start:435,end:376},{start:250,end:290},{start:290,end:392},{start:392,end:250},{start:411,end:416},{start:416,end:433},{start:433,end:411},{start:341,end:463},{start:463,end:464},{start:464,end:341},{start:453,end:464},{start:464,end:465},{start:465,end:453},{start:357,end:465},{start:465,end:412},{start:412,end:357},{start:343,end:412},{start:412,end:399},{start:399,end:343},{start:360,end:363},{start:363,end:440},{start:440,end:360},{start:437,end:399},{start:399,end:456},{start:456,end:437},{start:420,end:456},{start:456,end:363},{start:363,end:420},{start:401,end:435},{start:435,end:288},{start:288,end:401},{start:372,end:383},{start:383,end:353},{start:353,end:372},{start:339,end:255},{start:255,end:249},{start:249,end:339},{start:448,end:261},{start:261,end:255},{start:255,end:448},{start:133,end:243},{start:243,end:190},{start:190,end:133},{start:133,end:155},{start:155,end:112},{start:112,end:133},{start:33,end:246},{start:246,end:247},{start:247,end:33},{start:33,end:130},{start:130,end:25},{start:25,end:33},{start:398,end:384},{start:384,end:286},{start:286,end:398},{start:362,end:398},{start:398,end:414},{start:414,end:362},{start:362,end:463},{start:463,end:341},{start:341,end:362},{start:263,end:359},{start:359,end:467},{start:467,end:263},{start:263,end:249},{start:249,end:255},{start:255,end:263},{start:466,end:467},{start:467,end:260},{start:260,end:466},{start:75,end:60},{start:60,end:166},{start:166,end:75},{start:238,end:239},{start:239,end:79},{start:79,end:238},{start:162,end:127},{start:127,end:139},{start:139,end:162},{start:72,end:11},{start:11,end:37},{start:37,end:72},{start:121,end:232},{start:232,end:120},{start:120,end:121},{start:73,end:72},{start:72,end:39},{start:39,end:73},{start:114,end:128},{start:128,end:47},{start:47,end:114},{start:233,end:232},{start:232,end:128},{start:128,end:233},{start:103,end:104},{start:104,end:67},{start:67,end:103},{start:152,end:175},{start:175,end:148},{start:148,end:152},{start:119,end:118},{start:118,end:101},{start:101,end:119},{start:74,end:73},{start:73,end:40},{start:40,end:74},{start:107,end:9},{start:9,end:108},{start:108,end:107},{start:49,end:48},{start:48,end:131},{start:131,end:49},{start:32,end:194},{start:194,end:211},{start:211,end:32},{start:184,end:74},{start:74,end:185},{start:185,end:184},{start:191,end:80},{start:80,end:183},{start:183,end:191},{start:185,end:40},{start:40,end:186},{start:186,end:185},{start:119,end:230},{start:230,end:118},{start:118,end:119},{start:210,end:202},{start:202,end:214},{start:214,end:210},{start:84,end:83},{start:83,end:17},{start:17,end:84},{start:77,end:76},{start:76,end:146},{start:146,end:77},{start:161,end:160},{start:160,end:30},{start:30,end:161},{start:190,end:56},{start:56,end:173},{start:173,end:190},{start:182,end:106},{start:106,end:194},{start:194,end:182},{start:138,end:135},{start:135,end:192},{start:192,end:138},{start:129,end:203},{start:203,end:98},{start:98,end:129},{start:54,end:21},{start:21,end:68},{start:68,end:54},{start:5,end:51},{start:51,end:4},{start:4,end:5},{start:145,end:144},{start:144,end:23},{start:23,end:145},{start:90,end:77},{start:77,end:91},{start:91,end:90},{start:207,end:205},{start:205,end:187},{start:187,end:207},{start:83,end:201},{start:201,end:18},{start:18,end:83},{start:181,end:91},{start:91,end:182},{start:182,end:181},{start:180,end:90},{start:90,end:181},{start:181,end:180},{start:16,end:85},{start:85,end:17},{start:17,end:16},{start:205,end:206},{start:206,end:36},{start:36,end:205},{start:176,end:148},{start:148,end:140},{start:140,end:176},{start:165,end:92},{start:92,end:39},{start:39,end:165},{start:245,end:193},{start:193,end:244},{start:244,end:245},{start:27,end:159},{start:159,end:28},{start:28,end:27},{start:30,end:247},{start:247,end:161},{start:161,end:30},{start:174,end:236},{start:236,end:196},{start:196,end:174},{start:103,end:54},{start:54,end:104},{start:104,end:103},{start:55,end:193},{start:193,end:8},{start:8,end:55},{start:111,end:117},{start:117,end:31},{start:31,end:111},{start:221,end:189},{start:189,end:55},{start:55,end:221},{start:240,end:98},{start:98,end:99},{start:99,end:240},{start:142,end:126},{start:126,end:100},{start:100,end:142},{start:219,end:166},{start:166,end:218},{start:218,end:219},{start:112,end:155},{start:155,end:26},{start:26,end:112},{start:198,end:209},{start:209,end:131},{start:131,end:198},{start:169,end:135},{start:135,end:150},{start:150,end:169},{start:114,end:47},{start:47,end:217},{start:217,end:114},{start:224,end:223},{start:223,end:53},{start:53,end:224},{start:220,end:45},{start:45,end:134},{start:134,end:220},{start:32,end:211},{start:211,end:140},{start:140,end:32},{start:109,end:67},{start:67,end:108},{start:108,end:109},{start:146,end:43},{start:43,end:91},{start:91,end:146},{start:231,end:230},{start:230,end:120},{start:120,end:231},{start:113,end:226},{start:226,end:247},{start:247,end:113},{start:105,end:63},{start:63,end:52},{start:52,end:105},{start:241,end:238},{start:238,end:242},{start:242,end:241},{start:124,end:46},{start:46,end:156},{start:156,end:124},{start:95,end:78},{start:78,end:96},{start:96,end:95},{start:70,end:46},{start:46,end:63},{start:63,end:70},{start:116,end:143},{start:143,end:227},{start:227,end:116},{start:116,end:123},{start:123,end:111},{start:111,end:116},{start:1,end:44},{start:44,end:19},{start:19,end:1},{start:3,end:236},{start:236,end:51},{start:51,end:3},{start:207,end:216},{start:216,end:205},{start:205,end:207},{start:26,end:154},{start:154,end:22},{start:22,end:26},{start:165,end:39},{start:39,end:167},{start:167,end:165},{start:199,end:200},{start:200,end:208},{start:208,end:199},{start:101,end:36},{start:36,end:100},{start:100,end:101},{start:43,end:57},{start:57,end:202},{start:202,end:43},{start:242,end:20},{start:20,end:99},{start:99,end:242},{start:56,end:28},{start:28,end:157},{start:157,end:56},{start:124,end:35},{start:35,end:113},{start:113,end:124},{start:29,end:160},{start:160,end:27},{start:27,end:29},{start:211,end:204},{start:204,end:210},{start:210,end:211},{start:124,end:113},{start:113,end:46},{start:46,end:124},{start:106,end:43},{start:43,end:204},{start:204,end:106},{start:96,end:62},{start:62,end:77},{start:77,end:96},{start:227,end:137},{start:137,end:116},{start:116,end:227},{start:73,end:41},{start:41,end:72},{start:72,end:73},{start:36,end:203},{start:203,end:142},{start:142,end:36},{start:235,end:64},{start:64,end:240},{start:240,end:235},{start:48,end:49},{start:49,end:64},{start:64,end:48},{start:42,end:41},{start:41,end:74},{start:74,end:42},{start:214,end:212},{start:212,end:207},{start:207,end:214},{start:183,end:42},{start:42,end:184},{start:184,end:183},{start:210,end:169},{start:169,end:211},{start:211,end:210},{start:140,end:170},{start:170,end:176},{start:176,end:140},{start:104,end:105},{start:105,end:69},{start:69,end:104},{start:193,end:122},{start:122,end:168},{start:168,end:193},{start:50,end:123},{start:123,end:187},{start:187,end:50},{start:89,end:96},{start:96,end:90},{start:90,end:89},{start:66,end:65},{start:65,end:107},{start:107,end:66},{start:179,end:89},{start:89,end:180},{start:180,end:179},{start:119,end:101},{start:101,end:120},{start:120,end:119},{start:68,end:63},{start:63,end:104},{start:104,end:68},{start:234,end:93},{start:93,end:227},{start:227,end:234},{start:16,end:15},{start:15,end:85},{start:85,end:16},{start:209,end:129},{start:129,end:49},{start:49,end:209},{start:15,end:14},{start:14,end:86},{start:86,end:15},{start:107,end:55},{start:55,end:9},{start:9,end:107},{start:120,end:100},{start:100,end:121},{start:121,end:120},{start:153,end:145},{start:145,end:22},{start:22,end:153},{start:178,end:88},{start:88,end:179},{start:179,end:178},{start:197,end:6},{start:6,end:196},{start:196,end:197},{start:89,end:88},{start:88,end:96},{start:96,end:89},{start:135,end:138},{start:138,end:136},{start:136,end:135},{start:138,end:215},{start:215,end:172},{start:172,end:138},{start:218,end:115},{start:115,end:219},{start:219,end:218},{start:41,end:42},{start:42,end:81},{start:81,end:41},{start:5,end:195},{start:195,end:51},{start:51,end:5},{start:57,end:43},{start:43,end:61},{start:61,end:57},{start:208,end:171},{start:171,end:199},{start:199,end:208},{start:41,end:81},{start:81,end:38},{start:38,end:41},{start:224,end:53},{start:53,end:225},{start:225,end:224},{start:24,end:144},{start:144,end:110},{start:110,end:24},{start:105,end:52},{start:52,end:66},{start:66,end:105},{start:118,end:229},{start:229,end:117},{start:117,end:118},{start:227,end:34},{start:34,end:234},{start:234,end:227},{start:66,end:107},{start:107,end:69},{start:69,end:66},{start:10,end:109},{start:109,end:151},{start:151,end:10},{start:219,end:48},{start:48,end:235},{start:235,end:219},{start:183,end:62},{start:62,end:191},{start:191,end:183},{start:142,end:129},{start:129,end:126},{start:126,end:142},{start:116,end:111},{start:111,end:143},{start:143,end:116},{start:118,end:117},{start:117,end:50},{start:50,end:118},{start:223,end:222},{start:222,end:52},{start:52,end:223},{start:94,end:19},{start:19,end:141},{start:141,end:94},{start:222,end:221},{start:221,end:65},{start:65,end:222},{start:196,end:3},{start:3,end:197},{start:197,end:196},{start:45,end:220},{start:220,end:44},{start:44,end:45},{start:156,end:70},{start:70,end:139},{start:139,end:156},{start:188,end:122},{start:122,end:245},{start:245,end:188},{start:139,end:71},{start:71,end:162},{start:162,end:139},{start:149,end:170},{start:170,end:150},{start:150,end:149},{start:122,end:188},{start:188,end:196},{start:196,end:122},{start:206,end:216},{start:216,end:92},{start:92,end:206},{start:164,end:2},{start:2,end:167},{start:167,end:164},{start:242,end:141},{start:141,end:241},{start:241,end:242},{start:0,end:164},{start:164,end:37},{start:37,end:0},{start:11,end:72},{start:72,end:12},{start:12,end:11},{start:12,end:38},{start:38,end:13},{start:13,end:12},{start:70,end:63},{start:63,end:71},{start:71,end:70},{start:31,end:226},{start:226,end:111},{start:111,end:31},{start:36,end:101},{start:101,end:205},{start:205,end:36},{start:203,end:206},{start:206,end:165},{start:165,end:203},{start:126,end:209},{start:209,end:217},{start:217,end:126},{start:98,end:165},{start:165,end:97},{start:97,end:98},{start:237,end:220},{start:220,end:218},{start:218,end:237},{start:237,end:239},{start:239,end:241},{start:241,end:237},{start:210,end:214},{start:214,end:169},{start:169,end:210},{start:140,end:171},{start:171,end:32},{start:32,end:140},{start:241,end:125},{start:125,end:237},{start:237,end:241},{start:179,end:86},{start:86,end:178},{start:178,end:179},{start:180,end:85},{start:85,end:179},{start:179,end:180},{start:181,end:84},{start:84,end:180},{start:180,end:181},{start:182,end:83},{start:83,end:181},{start:181,end:182},{start:194,end:201},{start:201,end:182},{start:182,end:194},{start:177,end:137},{start:137,end:132},{start:132,end:177},{start:184,end:76},{start:76,end:183},{start:183,end:184},{start:185,end:61},{start:61,end:184},{start:184,end:185},{start:186,end:57},{start:57,end:185},{start:185,end:186},{start:216,end:212},{start:212,end:186},{start:186,end:216},{start:192,end:214},{start:214,end:187},{start:187,end:192},{start:139,end:34},{start:34,end:156},{start:156,end:139},{start:218,end:79},{start:79,end:237},{start:237,end:218},{start:147,end:123},{start:123,end:177},{start:177,end:147},{start:45,end:44},{start:44,end:4},{start:4,end:45},{start:208,end:201},{start:201,end:32},{start:32,end:208},{start:98,end:64},{start:64,end:129},{start:129,end:98},{start:192,end:213},{start:213,end:138},{start:138,end:192},{start:235,end:59},{start:59,end:219},{start:219,end:235},{start:141,end:242},{start:242,end:97},{start:97,end:141},{start:97,end:2},{start:2,end:141},{start:141,end:97},{start:240,end:75},{start:75,end:235},{start:235,end:240},{start:229,end:24},{start:24,end:228},{start:228,end:229},{start:31,end:25},{start:25,end:226},{start:226,end:31},{start:230,end:23},{start:23,end:229},{start:229,end:230},{start:231,end:22},{start:22,end:230},{start:230,end:231},{start:232,end:26},{start:26,end:231},{start:231,end:232},{start:233,end:112},{start:112,end:232},{start:232,end:233},{start:244,end:189},{start:189,end:243},{start:243,end:244},{start:189,end:221},{start:221,end:190},{start:190,end:189},{start:222,end:28},{start:28,end:221},{start:221,end:222},{start:223,end:27},{start:27,end:222},{start:222,end:223},{start:224,end:29},{start:29,end:223},{start:223,end:224},{start:225,end:30},{start:30,end:224},{start:224,end:225},{start:113,end:247},{start:247,end:225},{start:225,end:113},{start:99,end:60},{start:60,end:240},{start:240,end:99},{start:213,end:147},{start:147,end:215},{start:215,end:213},{start:60,end:20},{start:20,end:166},{start:166,end:60},{start:192,end:187},{start:187,end:213},{start:213,end:192},{start:243,end:112},{start:112,end:244},{start:244,end:243},{start:244,end:233},{start:233,end:245},{start:245,end:244},{start:245,end:128},{start:128,end:188},{start:188,end:245},{start:188,end:114},{start:114,end:174},{start:174,end:188},{start:134,end:131},{start:131,end:220},{start:220,end:134},{start:174,end:217},{start:217,end:236},{start:236,end:174},{start:236,end:198},{start:198,end:134},{start:134,end:236},{start:215,end:177},{start:177,end:58},{start:58,end:215},{start:156,end:143},{start:143,end:124},{start:124,end:156},{start:25,end:110},{start:110,end:7},{start:7,end:25},{start:31,end:228},{start:228,end:25},{start:25,end:31},{start:264,end:356},{start:356,end:368},{start:368,end:264},{start:0,end:11},{start:11,end:267},{start:267,end:0},{start:451,end:452},{start:452,end:349},{start:349,end:451},{start:267,end:302},{start:302,end:269},{start:269,end:267},{start:350,end:357},{start:357,end:277},{start:277,end:350},{start:350,end:452},{start:452,end:357},{start:357,end:350},{start:299,end:333},{start:333,end:297},{start:297,end:299},{start:396,end:175},{start:175,end:377},{start:377,end:396},{start:280,end:347},{start:347,end:330},{start:330,end:280},{start:269,end:303},{start:303,end:270},{start:270,end:269},{start:151,end:9},{start:9,end:337},{start:337,end:151},{start:344,end:278},{start:278,end:360},{start:360,end:344},{start:424,end:418},{start:418,end:431},{start:431,end:424},{start:270,end:304},{start:304,end:409},{start:409,end:270},{start:272,end:310},{start:310,end:407},{start:407,end:272},{start:322,end:270},{start:270,end:410},{start:410,end:322},{start:449,end:450},{start:450,end:347},{start:347,end:449},{start:432,end:422},{start:422,end:434},{start:434,end:432},{start:18,end:313},{start:313,end:17},{start:17,end:18},{start:291,end:306},{start:306,end:375},{start:375,end:291},{start:259,end:387},{start:387,end:260},{start:260,end:259},{start:424,end:335},{start:335,end:418},{start:418,end:424},{start:434,end:364},{start:364,end:416},{start:416,end:434},{start:391,end:423},{start:423,end:327},{start:327,end:391},{start:301,end:251},{start:251,end:298},{start:298,end:301},{start:275,end:281},{start:281,end:4},{start:4,end:275},{start:254,end:373},{start:373,end:253},{start:253,end:254},{start:375,end:307},{start:307,end:321},{start:321,end:375},{start:280,end:425},{start:425,end:411},{start:411,end:280},{start:200,end:421},{start:421,end:18},{start:18,end:200},{start:335,end:321},{start:321,end:406},{start:406,end:335},{start:321,end:320},{start:320,end:405},{start:405,end:321},{start:314,end:315},{start:315,end:17},{start:17,end:314},{start:423,end:426},{start:426,end:266},{start:266,end:423},{start:396,end:377},{start:377,end:369},{start:369,end:396},{start:270,end:322},{start:322,end:269},{start:269,end:270},{start:413,end:417},{start:417,end:464},{start:464,end:413},{start:385,end:386},{start:386,end:258},{start:258,end:385},{start:248,end:456},{start:456,end:419},{start:419,end:248},{start:298,end:284},{start:284,end:333},{start:333,end:298},{start:168,end:417},{start:417,end:8},{start:8,end:168},{start:448,end:346},{start:346,end:261},{start:261,end:448},{start:417,end:413},{start:413,end:285},{start:285,end:417},{start:326,end:327},{start:327,end:328},{start:328,end:326},{start:277,end:355},{start:355,end:329},{start:329,end:277},{start:309,end:392},{start:392,end:438},{start:438,end:309},{start:381,end:382},{start:382,end:256},{start:256,end:381},{start:279,end:429},{start:429,end:360},{start:360,end:279},{start:365,end:364},{start:364,end:379},{start:379,end:365},{start:355,end:277},{start:277,end:437},{start:437,end:355},{start:282,end:443},{start:443,end:283},{start:283,end:282},{start:281,end:275},{start:275,end:363},{start:363,end:281},{start:395,end:431},{start:431,end:369},{start:369,end:395},{start:299,end:297},{start:297,end:337},{start:337,end:299},{start:335,end:273},{start:273,end:321},{start:321,end:335},{start:348,end:450},{start:450,end:349},{start:349,end:348},{start:359,end:446},{start:446,end:467},{start:467,end:359},{start:283,end:293},{start:293,end:282},{start:282,end:283},{start:250,end:458},{start:458,end:462},{start:462,end:250},{start:300,end:276},{start:276,end:383},{start:383,end:300},{start:292,end:308},{start:308,end:325},{start:325,end:292},{start:283,end:276},{start:276,end:293},{start:293,end:283},{start:264,end:372},{start:372,end:447},{start:447,end:264},{start:346,end:352},{start:352,end:340},{start:340,end:346},{start:354,end:274},{start:274,end:19},{start:19,end:354},{start:363,end:456},{start:456,end:281},{start:281,end:363},{start:426,end:436},{start:436,end:425},{start:425,end:426},{start:380,end:381},{start:381,end:252},{start:252,end:380},{start:267,end:269},{start:269,end:393},{start:393,end:267},{start:421,end:200},{start:200,end:428},{start:428,end:421},{start:371,end:266},{start:266,end:329},{start:329,end:371},{start:432,end:287},{start:287,end:422},{start:422,end:432},{start:290,end:250},{start:250,end:328},{start:328,end:290},{start:385,end:258},{start:258,end:384},{start:384,end:385},{start:446,end:265},{start:265,end:342},{start:342,end:446},{start:386,end:387},{start:387,end:257},{start:257,end:386},{start:422,end:424},{start:424,end:430},{start:430,end:422},{start:445,end:342},{start:342,end:276},{start:276,end:445},{start:422,end:273},{start:273,end:424},{start:424,end:422},{start:306,end:292},{start:292,end:307},{start:307,end:306},{start:352,end:366},{start:366,end:345},{start:345,end:352},{start:268,end:271},{start:271,end:302},{start:302,end:268},{start:358,end:423},{start:423,end:371},{start:371,end:358},{start:327,end:294},{start:294,end:460},{start:460,end:327},{start:331,end:279},{start:279,end:294},{start:294,end:331},{start:303,end:271},{start:271,end:304},{start:304,end:303},{start:436,end:432},{start:432,end:427},{start:427,end:436},{start:304,end:272},{start:272,end:408},{start:408,end:304},{start:395,end:394},{start:394,end:431},{start:431,end:395},{start:378,end:395},{start:395,end:400},{start:400,end:378},{start:296,end:334},{start:334,end:299},{start:299,end:296},{start:6,end:351},{start:351,end:168},{start:168,end:6},{start:376,end:352},{start:352,end:411},{start:411,end:376},{start:307,end:325},{start:325,end:320},{start:320,end:307},{start:285,end:295},{start:295,end:336},{start:336,end:285},{start:320,end:319},{start:319,end:404},{start:404,end:320},{start:329,end:330},{start:330,end:349},{start:349,end:329},{start:334,end:293},{start:293,end:333},{start:333,end:334},{start:366,end:323},{start:323,end:447},{start:447,end:366},{start:316,end:15},{start:15,end:315},{start:315,end:316},{start:331,end:358},{start:358,end:279},{start:279,end:331},{start:317,end:14},{start:14,end:316},{start:316,end:317},{start:8,end:285},{start:285,end:9},{start:9,end:8},{start:277,end:329},{start:329,end:350},{start:350,end:277},{start:253,end:374},{start:374,end:252},{start:252,end:253},{start:319,end:318},{start:318,end:403},{start:403,end:319},{start:351,end:6},{start:6,end:419},{start:419,end:351},{start:324,end:318},{start:318,end:325},{start:325,end:324},{start:397,end:367},{start:367,end:365},{start:365,end:397},{start:288,end:435},{start:435,end:397},{start:397,end:288},{start:278,end:344},{start:344,end:439},{start:439,end:278},{start:310,end:272},{start:272,end:311},{start:311,end:310},{start:248,end:195},{start:195,end:281},{start:281,end:248},{start:375,end:273},{start:273,end:291},{start:291,end:375},{start:175,end:396},{start:396,end:199},{start:199,end:175},{start:312,end:311},{start:311,end:268},{start:268,end:312},{start:276,end:283},{start:283,end:445},{start:445,end:276},{start:390,end:373},{start:373,end:339},{start:339,end:390},{start:295,end:282},{start:282,end:296},{start:296,end:295},{start:448,end:449},{start:449,end:346},{start:346,end:448},{start:356,end:264},{start:264,end:454},{start:454,end:356},{start:337,end:336},{start:336,end:299},{start:299,end:337},{start:337,end:338},{start:338,end:151},{start:151,end:337},{start:294,end:278},{start:278,end:455},{start:455,end:294},{start:308,end:292},{start:292,end:415},{start:415,end:308},{start:429,end:358},{start:358,end:355},{start:355,end:429},{start:265,end:340},{start:340,end:372},{start:372,end:265},{start:352,end:346},{start:346,end:280},{start:280,end:352},{start:295,end:442},{start:442,end:282},{start:282,end:295},{start:354,end:19},{start:19,end:370},{start:370,end:354},{start:285,end:441},{start:441,end:295},{start:295,end:285},{start:195,end:248},{start:248,end:197},{start:197,end:195},{start:457,end:440},{start:440,end:274},{start:274,end:457},{start:301,end:300},{start:300,end:368},{start:368,end:301},{start:417,end:351},{start:351,end:465},{start:465,end:417},{start:251,end:301},{start:301,end:389},{start:389,end:251},{start:394,end:395},{start:395,end:379},{start:379,end:394},{start:399,end:412},{start:412,end:419},{start:419,end:399},{start:410,end:436},{start:436,end:322},{start:322,end:410},{start:326,end:2},{start:2,end:393},{start:393,end:326},{start:354,end:370},{start:370,end:461},{start:461,end:354},{start:393,end:164},{start:164,end:267},{start:267,end:393},{start:268,end:302},{start:302,end:12},{start:12,end:268},{start:312,end:268},{start:268,end:13},{start:13,end:312},{start:298,end:293},{start:293,end:301},{start:301,end:298},{start:265,end:446},{start:446,end:340},{start:340,end:265},{start:280,end:330},{start:330,end:425},{start:425,end:280},{start:322,end:426},{start:426,end:391},{start:391,end:322},{start:420,end:429},{start:429,end:437},{start:437,end:420},{start:393,end:391},{start:391,end:326},{start:326,end:393},{start:344,end:440},{start:440,end:438},{start:438,end:344},{start:458,end:459},{start:459,end:461},{start:461,end:458},{start:364,end:434},{start:434,end:394},{start:394,end:364},{start:428,end:396},{start:396,end:262},{start:262,end:428},{start:274,end:354},{start:354,end:457},{start:457,end:274},{start:317,end:316},{start:316,end:402},{start:402,end:317},{start:316,end:315},{start:315,end:403},{start:403,end:316},{start:315,end:314},{start:314,end:404},{start:404,end:315},{start:314,end:313},{start:313,end:405},{start:405,end:314},{start:313,end:421},{start:421,end:406},{start:406,end:313},{start:323,end:366},{start:366,end:361},{start:361,end:323},{start:292,end:306},{start:306,end:407},{start:407,end:292},{start:306,end:291},{start:291,end:408},{start:408,end:306},{start:291,end:287},{start:287,end:409},{start:409,end:291},{start:287,end:432},{start:432,end:410},{start:410,end:287},{start:427,end:434},{start:434,end:411},{start:411,end:427},{start:372,end:264},{start:264,end:383},{start:383,end:372},{start:459,end:309},{start:309,end:457},{start:457,end:459},{start:366,end:352},{start:352,end:401},{start:401,end:366},{start:1,end:274},{start:274,end:4},{start:4,end:1},{start:418,end:421},{start:421,end:262},{start:262,end:418},{start:331,end:294},{start:294,end:358},{start:358,end:331},{start:435,end:433},{start:433,end:367},{start:367,end:435},{start:392,end:289},{start:289,end:439},{start:439,end:392},{start:328,end:462},{start:462,end:326},{start:326,end:328},{start:94,end:2},{start:2,end:370},{start:370,end:94},{start:289,end:305},{start:305,end:455},{start:455,end:289},{start:339,end:254},{start:254,end:448},{start:448,end:339},{start:359,end:255},{start:255,end:446},{start:446,end:359},{start:254,end:253},{start:253,end:449},{start:449,end:254},{start:253,end:252},{start:252,end:450},{start:450,end:253},{start:252,end:256},{start:256,end:451},{start:451,end:252},{start:256,end:341},{start:341,end:452},{start:452,end:256},{start:414,end:413},{start:413,end:463},{start:463,end:414},{start:286,end:441},{start:441,end:414},{start:414,end:286},{start:286,end:258},{start:258,end:441},{start:441,end:286},{start:258,end:257},{start:257,end:442},{start:442,end:258},{start:257,end:259},{start:259,end:443},{start:443,end:257},{start:259,end:260},{start:260,end:444},{start:444,end:259},{start:260,end:467},{start:467,end:445},{start:445,end:260},{start:309,end:459},{start:459,end:250},{start:250,end:309},{start:305,end:289},{start:289,end:290},{start:290,end:305},{start:305,end:290},{start:290,end:460},{start:460,end:305},{start:401,end:376},{start:376,end:435},{start:435,end:401},{start:309,end:250},{start:250,end:392},{start:392,end:309},{start:376,end:411},{start:411,end:433},{start:433,end:376},{start:453,end:341},{start:341,end:464},{start:464,end:453},{start:357,end:453},{start:453,end:465},{start:465,end:357},{start:343,end:357},{start:357,end:412},{start:412,end:343},{start:437,end:343},{start:343,end:399},{start:399,end:437},{start:344,end:360},{start:360,end:440},{start:440,end:344},{start:420,end:437},{start:437,end:456},{start:456,end:420},{start:360,end:420},{start:420,end:363},{start:363,end:360},{start:361,end:401},{start:401,end:288},{start:288,end:361},{start:265,end:372},{start:372,end:353},{start:353,end:265},{start:390,end:339},{start:339,end:249},{start:249,end:390},{start:339,end:448},{start:448,end:255},{start:255,end:339}];var face_landmarker_options={};Object.defineProperty(face_landmarker_options,"__esModule",{value:!0});var face_landmarker_result={};Object.defineProperty(face_landmarker_result,"__esModule",{value:!0}),function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,i)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(e,r){for(var o in e)"default"===o||Object.prototype.hasOwnProperty.call(r,o)||t(r,e,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.FaceLandmarker=void 0;const o=calculator_pb,i=calculator_options_pb,a=classification_pb,n=landmark_pb,s=base_options_pb,p=face_detector_graph_options_pb,d=face_geometry_pb,l=face_landmarker_graph_options_pb,g=face_landmarks_detector_graph_options_pb,c=classifier_result,u=landmark_result,m=vision_task_runner,f=face_landmarks_connections;r(face_landmarker_options,e),r(face_landmarker_result,e);const h="image_in",y="norm_rect",b="face_landmarks",_="blendshapes",O="face_geometry",F=.5;class M extends m.VisionTaskRunner{static createFromOptions(e,t){return m.VisionTaskRunner.createVisionInstance(M,e,t)}static createFromModelBuffer(e,t){return m.VisionTaskRunner.createVisionInstance(M,e,{baseOptions:{modelAssetBuffer:t}})}static createFromModelPath(e,t){return m.VisionTaskRunner.createVisionInstance(M,e,{baseOptions:{modelAssetPath:t}})}constructor(e,t){super(new m.VisionGraphRunner(e,t),h,y,!1),this.result={faceLandmarks:[]},this.outputFaceBlendshapes=!1,this.outputFacialTransformationMatrixes=!1,this.options=new l.FaceLandmarkerGraphOptions,this.options.setBaseOptions(new s.BaseOptions),this.faceLandmarksDetectorGraphOptions=new g.FaceLandmarksDetectorGraphOptions,this.options.setFaceLandmarksDetectorGraphOptions(this.faceLandmarksDetectorGraphOptions),this.faceDetectorGraphOptions=new p.FaceDetectorGraphOptions,this.options.setFaceDetectorGraphOptions(this.faceDetectorGraphOptions),this.initDefaults()}get baseOptions(){return this.options.getBaseOptions()}set baseOptions(e){this.options.setBaseOptions(e)}setOptions(e){var t,r,o,i;return"numFaces"in e&&this.faceDetectorGraphOptions.setNumFaces(null!==(t=e.numFaces)&&void 0!==t?t:1),"minFaceDetectionConfidence"in e&&this.faceDetectorGraphOptions.setMinDetectionConfidence(null!==(r=e.minFaceDetectionConfidence)&&void 0!==r?r:F),"minTrackingConfidence"in e&&this.options.setMinTrackingConfidence(null!==(o=e.minTrackingConfidence)&&void 0!==o?o:F),"minFacePresenceConfidence"in e&&this.faceLandmarksDetectorGraphOptions.setMinDetectionConfidence(null!==(i=e.minFacePresenceConfidence)&&void 0!==i?i:F),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"outputFacialTransformationMatrixes"in e&&(this.outputFacialTransformationMatrixes=!!e.outputFacialTransformationMatrixes),this.applyOptions(e)}detect(e,t){return this.resetResults(),this.processImageData(e,t),this.result}detectForVideo(e,t,r){return this.resetResults(),this.processVideoData(e,r,t),this.result}resetResults(){this.result={faceLandmarks:[]},this.outputFaceBlendshapes&&(this.result.faceBlendshapes=[]),this.outputFacialTransformationMatrixes&&(this.result.facialTransformationMatrixes=[])}initDefaults(){this.faceDetectorGraphOptions.setNumFaces(1),this.faceDetectorGraphOptions.setMinDetectionConfidence(F),this.faceLandmarksDetectorGraphOptions.setMinDetectionConfidence(F),this.options.setMinTrackingConfidence(F)}addJsLandmarks(e){for(const t of e){const e=n.NormalizedLandmarkList.deserializeBinary(t);this.result.faceLandmarks.push((0,u.convertToLandmarks)(e))}}addBlenshape(e){var t;if(this.result.faceBlendshapes)for(const r of e){const e=a.ClassificationList.deserializeBinary(r);this.result.faceBlendshapes.push((0,c.convertFromClassifications)(null!==(t=e.getClassificationList())&&void 0!==t?t:[]))}}addFacialTransformationMatrixes(e){var t,r,o;if(this.result.facialTransformationMatrixes)for(const i of e){const e=d.FaceGeometry.deserializeBinary(i).getPoseTransformMatrix();e&&this.result.facialTransformationMatrixes.push({rows:null!==(t=e.getRows())&&void 0!==t?t:0,columns:null!==(r=e.getCols())&&void 0!==r?r:0,data:null!==(o=e.getPackedDataList())&&void 0!==o?o:[]})}}refreshGraph(){const e=new o.CalculatorGraphConfig;e.addInputStream(h),e.addInputStream(y),e.addOutputStream(b);const t=new i.CalculatorOptions;t.setExtension(l.FaceLandmarkerGraphOptions.ext,this.options);const r=new o.CalculatorGraphConfig.Node;r.setCalculator("mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),r.addInputStream("IMAGE:"+h),r.addInputStream("NORM_RECT:"+y),r.addOutputStream("NORM_LANDMARKS:"+b),r.setOptions(t),e.addNode(r),this.graphRunner.attachProtoVectorListener(b,((e,t)=>{this.addJsLandmarks(e),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(b,(e=>{this.setLatestOutputTimestamp(e)})),this.outputFaceBlendshapes&&(e.addOutputStream(_),r.addOutputStream("BLENDSHAPES:"+_),this.graphRunner.attachProtoVectorListener(_,((e,t)=>{this.addBlenshape(e),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(_,(e=>{this.setLatestOutputTimestamp(e)}))),this.outputFacialTransformationMatrixes&&(e.addOutputStream(O),r.addOutputStream("FACE_GEOMETRY:"+O),this.graphRunner.attachProtoVectorListener(O,((e,t)=>{this.addFacialTransformationMatrixes(e),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(O,(e=>{this.setLatestOutputTimestamp(e)})));const a=e.serializeBinary();this.setGraph(new Uint8Array(a),!0)}}e.FaceLandmarker=M,M.FACE_LANDMARKS_LIPS=f.FACE_LANDMARKS_LIPS,M.FACE_LANDMARKS_LEFT_EYE=f.FACE_LANDMARKS_LEFT_EYE,M.FACE_LANDMARKS_LEFT_EYEBROW=f.FACE_LANDMARKS_LEFT_EYEBROW,M.FACE_LANDMARKS_LEFT_IRIS=f.FACE_LANDMARKS_LEFT_IRIS,M.FACE_LANDMARKS_RIGHT_EYE=f.FACE_LANDMARKS_RIGHT_EYE,M.FACE_LANDMARKS_RIGHT_EYEBROW=f.FACE_LANDMARKS_RIGHT_EYEBROW,M.FACE_LANDMARKS_RIGHT_IRIS=f.FACE_LANDMARKS_RIGHT_IRIS,M.FACE_LANDMARKS_FACE_OVAL=f.FACE_LANDMARKS_FACE_OVAL,M.FACE_LANDMARKS_CONTOURS=f.FACE_LANDMARKS_CONTOURS,M.FACE_LANDMARKS_TESSELATION=f.FACE_LANDMARKS_TESSELATION}(face_landmarker);var face_stylizer={},face_stylizer_graph_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n);var s=face_landmarker_graph_options_pb;r.object.extend(proto,s),r.exportSymbol("proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions",null,o),proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.displayName="proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.toObject=function(e,t){var r,o={baseOptions:(r=t.getBaseOptions())&&n.BaseOptions.toObject(e,r),faceLandmarkerGraphOptions:(r=t.getFaceLandmarkerGraphOptions())&&s.FaceLandmarkerGraphOptions.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions;return proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=new s.FaceLandmarkerGraphOptions;t.readMessage(r,s.FaceLandmarkerGraphOptions.deserializeBinaryFromReader),e.setFaceLandmarkerGraphOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.serializeBinaryToWriter=function(e,t){var r=void 0;null!=(r=e.getBaseOptions())&&t.writeMessage(1,r,n.BaseOptions.serializeBinaryToWriter),null!=(r=e.getFaceLandmarkerGraphOptions())&&t.writeMessage(2,r,s.FaceLandmarkerGraphOptions.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.ext=new t.ExtensionFieldInfo(513916220,{ext:0},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions,proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[513916220]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[513916220]=proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.ext,proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.prototype.getFaceLandmarkerGraphOptions=function(){return t.Message.getWrapperField(this,s.FaceLandmarkerGraphOptions,2)},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.prototype.setFaceLandmarkerGraphOptions=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.prototype.clearFaceLandmarkerGraphOptions=function(){return this.setFaceLandmarkerGraphOptions(void 0)},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.prototype.hasFaceLandmarkerGraphOptions=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.ext=new t.ExtensionFieldInfo(513916220,{ext:0},proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions,proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[513916220]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[513916220]=proto.mediapipe.tasks.vision.face_stylizer.proto.FaceStylizerGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.face_stylizer.proto)}(face_stylizer_graph_options_pb);var face_stylizer_options={};Object.defineProperty(face_stylizer_options,"__esModule",{value:!0}),function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,i)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(e,r){for(var o in e)"default"===o||Object.prototype.hasOwnProperty.call(r,o)||t(r,e,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.FaceStylizer=void 0;const o=calculator_pb,i=calculator_options_pb,a=base_options_pb,n=face_stylizer_graph_options_pb,s=vision_task_runner;r(face_stylizer_options,e);const p="image_in",d="norm_rect",l="stylized_image";class g extends s.VisionTaskRunner{static createFromOptions(e,t){return s.VisionTaskRunner.createVisionInstance(g,e,t)}static createFromModelBuffer(e,t){return s.VisionTaskRunner.createVisionInstance(g,e,{baseOptions:{modelAssetBuffer:t}})}static createFromModelPath(e,t){return s.VisionTaskRunner.createVisionInstance(g,e,{baseOptions:{modelAssetPath:t}})}constructor(e,t){super(new s.VisionGraphRunner(e,t),p,d,!0),this.options=new n.FaceStylizerGraphOptions,this.options.setBaseOptions(new a.BaseOptions)}get baseOptions(){return this.options.getBaseOptions()}set baseOptions(e){this.options.setBaseOptions(e)}setOptions(e){return super.applyOptions(e)}stylize(e,t,r){const o="function"!=typeof t?t:{};if(this.userCallback="function"==typeof t?t:r,this.processImageData(e,null!=o?o:{}),!this.userCallback)return this.result}stylizeForVideo(e,t,r,o){const i="function"!=typeof r?r:{};if(this.userCallback="function"==typeof r?r:o,this.processVideoData(e,i,t),this.userCallback=void 0,!this.userCallback)return this.result}refreshGraph(){const e=new o.CalculatorGraphConfig;e.addInputStream(p),e.addInputStream(d),e.addOutputStream(l);const t=new i.CalculatorOptions;t.setExtension(n.FaceStylizerGraphOptions.ext,this.options);const r=new o.CalculatorGraphConfig.Node;r.setCalculator("mediapipe.tasks.vision.face_stylizer.FaceStylizerGraph"),r.addInputStream("IMAGE:"+p),r.addInputStream("NORM_RECT:"+d),r.addOutputStream("STYLIZED_IMAGE:"+l),r.setOptions(t),e.addNode(r),this.graphRunner.attachImageListener(l,((e,t)=>{const r=this.convertToMPImage(e,!this.userCallback);this.result=r,this.userCallback&&this.userCallback(r),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(l,(e=>{this.result=null,this.userCallback&&this.userCallback(null),this.setLatestOutputTimestamp(e)}));const a=e.serializeBinary();this.setGraph(new Uint8Array(a),!0)}}e.FaceStylizer=g}(face_stylizer);var gesture_recognizer={},gesture_classifier_graph_options_pb={},classifier_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.tasks.components.processors.proto.ClassifierOptions",null,o),proto.mediapipe.tasks.components.processors.proto.ClassifierOptions=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.repeatedFields_,null)},r.inherits(proto.mediapipe.tasks.components.processors.proto.ClassifierOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.displayName="proto.mediapipe.tasks.components.processors.proto.ClassifierOptions"),proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.repeatedFields_=[4,5],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.toObject(e,this)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.toObject=function(e,r){var o,i={displayNamesLocale:t.Message.getFieldWithDefault(r,1,"en"),maxResults:t.Message.getFieldWithDefault(r,2,-1),scoreThreshold:null==(o=t.Message.getOptionalFloatingPointField(r,3))?void 0:o,categoryAllowlistList:null==(o=t.Message.getRepeatedField(r,4))?void 0:o,categoryDenylistList:null==(o=t.Message.getRepeatedField(r,5))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.components.processors.proto.ClassifierOptions;return proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setDisplayNamesLocale(r);break;case 2:r=t.readInt32();e.setMaxResults(r);break;case 3:r=t.readFloat();e.setScoreThreshold(r);break;case 4:r=t.readString();e.addCategoryAllowlist(r);break;case 5:r=t.readString();e.addCategoryDenylist(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeString(1,o),null!=(o=t.Message.getField(e,2))&&r.writeInt32(2,o),null!=(o=t.Message.getField(e,3))&&r.writeFloat(3,o),(o=e.getCategoryAllowlistList()).length>0&&r.writeRepeatedString(4,o),(o=e.getCategoryDenylistList()).length>0&&r.writeRepeatedString(5,o)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.getDisplayNamesLocale=function(){return t.Message.getFieldWithDefault(this,1,"en")},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.setDisplayNamesLocale=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.clearDisplayNamesLocale=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.hasDisplayNamesLocale=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.getMaxResults=function(){return t.Message.getFieldWithDefault(this,2,-1)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.setMaxResults=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.clearMaxResults=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.hasMaxResults=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.getScoreThreshold=function(){return t.Message.getFloatingPointFieldWithDefault(this,3,0)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.setScoreThreshold=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.clearScoreThreshold=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.hasScoreThreshold=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.getCategoryAllowlistList=function(){return t.Message.getRepeatedField(this,4)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.setCategoryAllowlistList=function(e){return t.Message.setField(this,4,e||[])},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.addCategoryAllowlist=function(e,r){return t.Message.addToRepeatedField(this,4,e,r)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.clearCategoryAllowlistList=function(){return this.setCategoryAllowlistList([])},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.getCategoryDenylistList=function(){return t.Message.getRepeatedField(this,5)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.setCategoryDenylistList=function(e){return t.Message.setField(this,5,e||[])},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.addCategoryDenylist=function(e,r){return t.Message.addToRepeatedField(this,5,e,r)},proto.mediapipe.tasks.components.processors.proto.ClassifierOptions.prototype.clearCategoryDenylistList=function(){return this.setCategoryDenylistList([])},r.object.extend(e,proto.mediapipe.tasks.components.processors.proto)}(classifier_options_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=classifier_options_pb;r.object.extend(proto,n);var s=base_options_pb;r.object.extend(proto,s),r.exportSymbol("proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions",null,o),proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.displayName="proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.toObject=function(e,t){var r,o={baseOptions:(r=t.getBaseOptions())&&s.BaseOptions.toObject(e,r),classifierOptions:(r=t.getClassifierOptions())&&n.ClassifierOptions.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions;return proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new s.BaseOptions;t.readMessage(r,s.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=new n.ClassifierOptions;t.readMessage(r,n.ClassifierOptions.deserializeBinaryFromReader),e.setClassifierOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.serializeBinaryToWriter=function(e,t){var r=void 0;null!=(r=e.getBaseOptions())&&t.writeMessage(1,r,s.BaseOptions.serializeBinaryToWriter),null!=(r=e.getClassifierOptions())&&t.writeMessage(2,r,n.ClassifierOptions.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.ext=new t.ExtensionFieldInfo(478825465,{ext:0},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[478825465]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[478825465]=proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.ext,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,s.BaseOptions,1)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.prototype.getClassifierOptions=function(){return t.Message.getWrapperField(this,n.ClassifierOptions,2)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.prototype.setClassifierOptions=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.prototype.clearClassifierOptions=function(){return this.setClassifierOptions(void 0)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.prototype.hasClassifierOptions=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.ext=new t.ExtensionFieldInfo(478825465,{ext:0},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[478825465]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[478825465]=proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureClassifierGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.gesture_recognizer.proto)}(gesture_classifier_graph_options_pb);var gesture_recognizer_graph_options_pb={},hand_gesture_recognizer_graph_options_pb={},gesture_embedder_graph_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n),r.exportSymbol("proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions",null,o),proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.displayName="proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.toObject=function(e,t){var r,o={baseOptions:(r=t.getBaseOptions())&&n.BaseOptions.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions;return proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r)}else t.skipField()}return e},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.serializeBinaryToWriter=function(e,t){var r;null!=(r=e.getBaseOptions())&&t.writeMessage(1,r,n.BaseOptions.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.ext=new t.ExtensionFieldInfo(478825422,{ext:0},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[478825422]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[478825422]=proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.ext,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.ext=new t.ExtensionFieldInfo(478825422,{ext:0},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[478825422]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[478825422]=proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureEmbedderGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.gesture_recognizer.proto)}(gesture_embedder_graph_options_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n);var s=gesture_classifier_graph_options_pb;r.object.extend(proto,s);var p=gesture_embedder_graph_options_pb;r.object.extend(proto,p),r.exportSymbol("proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions",null,o),proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.displayName="proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.toObject=function(e,t){var r,o={baseOptions:(r=t.getBaseOptions())&&n.BaseOptions.toObject(e,r),gestureEmbedderGraphOptions:(r=t.getGestureEmbedderGraphOptions())&&p.GestureEmbedderGraphOptions.toObject(e,r),cannedGestureClassifierGraphOptions:(r=t.getCannedGestureClassifierGraphOptions())&&s.GestureClassifierGraphOptions.toObject(e,r),customGestureClassifierGraphOptions:(r=t.getCustomGestureClassifierGraphOptions())&&s.GestureClassifierGraphOptions.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions;return proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=new p.GestureEmbedderGraphOptions;t.readMessage(r,p.GestureEmbedderGraphOptions.deserializeBinaryFromReader),e.setGestureEmbedderGraphOptions(r);break;case 3:r=new s.GestureClassifierGraphOptions;t.readMessage(r,s.GestureClassifierGraphOptions.deserializeBinaryFromReader),e.setCannedGestureClassifierGraphOptions(r);break;case 4:r=new s.GestureClassifierGraphOptions;t.readMessage(r,s.GestureClassifierGraphOptions.deserializeBinaryFromReader),e.setCustomGestureClassifierGraphOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.serializeBinaryToWriter=function(e,t){var r=void 0;null!=(r=e.getBaseOptions())&&t.writeMessage(1,r,n.BaseOptions.serializeBinaryToWriter),null!=(r=e.getGestureEmbedderGraphOptions())&&t.writeMessage(2,r,p.GestureEmbedderGraphOptions.serializeBinaryToWriter),null!=(r=e.getCannedGestureClassifierGraphOptions())&&t.writeMessage(3,r,s.GestureClassifierGraphOptions.serializeBinaryToWriter),null!=(r=e.getCustomGestureClassifierGraphOptions())&&t.writeMessage(4,r,s.GestureClassifierGraphOptions.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.ext=new t.ExtensionFieldInfo(463370452,{ext:0},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions,proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[463370452]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[463370452]=proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.ext,proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.getGestureEmbedderGraphOptions=function(){return t.Message.getWrapperField(this,p.GestureEmbedderGraphOptions,2)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.setGestureEmbedderGraphOptions=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.clearGestureEmbedderGraphOptions=function(){return this.setGestureEmbedderGraphOptions(void 0)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.hasGestureEmbedderGraphOptions=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.getCannedGestureClassifierGraphOptions=function(){return t.Message.getWrapperField(this,s.GestureClassifierGraphOptions,3)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.setCannedGestureClassifierGraphOptions=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.clearCannedGestureClassifierGraphOptions=function(){return this.setCannedGestureClassifierGraphOptions(void 0)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.hasCannedGestureClassifierGraphOptions=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.getCustomGestureClassifierGraphOptions=function(){return t.Message.getWrapperField(this,s.GestureClassifierGraphOptions,4)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.setCustomGestureClassifierGraphOptions=function(e){return t.Message.setWrapperField(this,4,e)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.clearCustomGestureClassifierGraphOptions=function(){return this.setCustomGestureClassifierGraphOptions(void 0)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.prototype.hasCustomGestureClassifierGraphOptions=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.ext=new t.ExtensionFieldInfo(463370452,{ext:0},proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions,proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[463370452]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[463370452]=proto.mediapipe.tasks.vision.gesture_recognizer.proto.HandGestureRecognizerGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.gesture_recognizer.proto)}(hand_gesture_recognizer_graph_options_pb);var hand_landmarker_graph_options_pb={},hand_detector_graph_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n),r.exportSymbol("proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions",null,o),proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.displayName="proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.toObject=function(e,r){var o,i={baseOptions:(o=r.getBaseOptions())&&n.BaseOptions.toObject(e,o),minDetectionConfidence:t.Message.getFloatingPointFieldWithDefault(r,2,.5),numHands:null==(o=t.Message.getField(r,3))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions;return proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=t.readFloat();e.setMinDetectionConfidence(r);break;case 3:r=t.readInt32();e.setNumHands(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getBaseOptions())&&r.writeMessage(1,o,n.BaseOptions.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeFloat(2,o),null!=(o=t.Message.getField(e,3))&&r.writeInt32(3,o)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.ext=new t.ExtensionFieldInfo(464864288,{ext:0},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions,proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[464864288]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[464864288]=proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.ext,proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.getMinDetectionConfidence=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,.5)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.setMinDetectionConfidence=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.clearMinDetectionConfidence=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.hasMinDetectionConfidence=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.getNumHands=function(){return t.Message.getFieldWithDefault(this,3,0)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.setNumHands=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.clearNumHands=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.prototype.hasNumHands=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.ext=new t.ExtensionFieldInfo(464864288,{ext:0},proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions,proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[464864288]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[464864288]=proto.mediapipe.tasks.vision.hand_detector.proto.HandDetectorGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.hand_detector.proto)}(hand_detector_graph_options_pb);var hand_landmarks_detector_graph_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n),r.exportSymbol("proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions",null,o),proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.displayName="proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.toObject=function(e,r){var o,i={baseOptions:(o=r.getBaseOptions())&&n.BaseOptions.toObject(e,o),minDetectionConfidence:t.Message.getFloatingPointFieldWithDefault(r,2,.5)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions;return proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=t.readFloat();e.setMinDetectionConfidence(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getBaseOptions())&&r.writeMessage(1,o,n.BaseOptions.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeFloat(2,o)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.ext=new t.ExtensionFieldInfo(474472470,{ext:0},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[474472470]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[474472470]=proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.ext,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.prototype.getMinDetectionConfidence=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,.5)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.prototype.setMinDetectionConfidence=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.prototype.clearMinDetectionConfidence=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.prototype.hasMinDetectionConfidence=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.ext=new t.ExtensionFieldInfo(474472470,{ext:0},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[474472470]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[474472470]=proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarksDetectorGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.hand_landmarker.proto)}(hand_landmarks_detector_graph_options_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n);var s=hand_detector_graph_options_pb;r.object.extend(proto,s);var p=hand_landmarks_detector_graph_options_pb;r.object.extend(proto,p),r.exportSymbol("proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions",null,o),proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.displayName="proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.toObject=function(e,r){var o,i={baseOptions:(o=r.getBaseOptions())&&n.BaseOptions.toObject(e,o),handDetectorGraphOptions:(o=r.getHandDetectorGraphOptions())&&s.HandDetectorGraphOptions.toObject(e,o),handLandmarksDetectorGraphOptions:(o=r.getHandLandmarksDetectorGraphOptions())&&p.HandLandmarksDetectorGraphOptions.toObject(e,o),minTrackingConfidence:t.Message.getFloatingPointFieldWithDefault(r,4,.5)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions;return proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=new s.HandDetectorGraphOptions;t.readMessage(r,s.HandDetectorGraphOptions.deserializeBinaryFromReader),e.setHandDetectorGraphOptions(r);break;case 3:r=new p.HandLandmarksDetectorGraphOptions;t.readMessage(r,p.HandLandmarksDetectorGraphOptions.deserializeBinaryFromReader),e.setHandLandmarksDetectorGraphOptions(r);break;case 4:r=t.readFloat();e.setMinTrackingConfidence(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getBaseOptions())&&r.writeMessage(1,o,n.BaseOptions.serializeBinaryToWriter),null!=(o=e.getHandDetectorGraphOptions())&&r.writeMessage(2,o,s.HandDetectorGraphOptions.serializeBinaryToWriter),null!=(o=e.getHandLandmarksDetectorGraphOptions())&&r.writeMessage(3,o,p.HandLandmarksDetectorGraphOptions.serializeBinaryToWriter),null!=(o=t.Message.getField(e,4))&&r.writeFloat(4,o)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.ext=new t.ExtensionFieldInfo(462713202,{ext:0},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[462713202]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[462713202]=proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.ext,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.getHandDetectorGraphOptions=function(){return t.Message.getWrapperField(this,s.HandDetectorGraphOptions,2)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.setHandDetectorGraphOptions=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.clearHandDetectorGraphOptions=function(){return this.setHandDetectorGraphOptions(void 0)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.hasHandDetectorGraphOptions=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.getHandLandmarksDetectorGraphOptions=function(){return t.Message.getWrapperField(this,p.HandLandmarksDetectorGraphOptions,3)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.setHandLandmarksDetectorGraphOptions=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.clearHandLandmarksDetectorGraphOptions=function(){return this.setHandLandmarksDetectorGraphOptions(void 0)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.hasHandLandmarksDetectorGraphOptions=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.getMinTrackingConfidence=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,.5)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.setMinTrackingConfidence=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.clearMinTrackingConfidence=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.prototype.hasMinTrackingConfidence=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.ext=new t.ExtensionFieldInfo(462713202,{ext:0},proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[462713202]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[462713202]=proto.mediapipe.tasks.vision.hand_landmarker.proto.HandLandmarkerGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.hand_landmarker.proto)}(hand_landmarker_graph_options_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n);var s=hand_gesture_recognizer_graph_options_pb;r.object.extend(proto,s);var p=hand_landmarker_graph_options_pb;r.object.extend(proto,p),r.exportSymbol("proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions",null,o),proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.displayName="proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.toObject=function(e,t){var r,o={baseOptions:(r=t.getBaseOptions())&&n.BaseOptions.toObject(e,r),handLandmarkerGraphOptions:(r=t.getHandLandmarkerGraphOptions())&&p.HandLandmarkerGraphOptions.toObject(e,r),handGestureRecognizerGraphOptions:(r=t.getHandGestureRecognizerGraphOptions())&&s.HandGestureRecognizerGraphOptions.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions;return proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=new p.HandLandmarkerGraphOptions;t.readMessage(r,p.HandLandmarkerGraphOptions.deserializeBinaryFromReader),e.setHandLandmarkerGraphOptions(r);break;case 3:r=new s.HandGestureRecognizerGraphOptions;t.readMessage(r,s.HandGestureRecognizerGraphOptions.deserializeBinaryFromReader),e.setHandGestureRecognizerGraphOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.serializeBinaryToWriter=function(e,t){var r=void 0;null!=(r=e.getBaseOptions())&&t.writeMessage(1,r,n.BaseOptions.serializeBinaryToWriter),null!=(r=e.getHandLandmarkerGraphOptions())&&t.writeMessage(2,r,p.HandLandmarkerGraphOptions.serializeBinaryToWriter),null!=(r=e.getHandGestureRecognizerGraphOptions())&&t.writeMessage(3,r,s.HandGestureRecognizerGraphOptions.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.ext=new t.ExtensionFieldInfo(479097054,{ext:0},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[479097054]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[479097054]=proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.ext,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.getHandLandmarkerGraphOptions=function(){return t.Message.getWrapperField(this,p.HandLandmarkerGraphOptions,2)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.setHandLandmarkerGraphOptions=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.clearHandLandmarkerGraphOptions=function(){return this.setHandLandmarkerGraphOptions(void 0)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.hasHandLandmarkerGraphOptions=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.getHandGestureRecognizerGraphOptions=function(){return t.Message.getWrapperField(this,s.HandGestureRecognizerGraphOptions,3)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.setHandGestureRecognizerGraphOptions=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.clearHandGestureRecognizerGraphOptions=function(){return this.setHandGestureRecognizerGraphOptions(void 0)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.prototype.hasHandGestureRecognizerGraphOptions=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.ext=new t.ExtensionFieldInfo(479097054,{ext:0},proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[479097054]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[479097054]=proto.mediapipe.tasks.vision.gesture_recognizer.proto.GestureRecognizerGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.gesture_recognizer.proto)}(gesture_recognizer_graph_options_pb);var classifier_options={};Object.defineProperty(classifier_options,"__esModule",{value:!0}),classifier_options.convertClassifierOptionsToProto=void 0;const classifier_options_pb_1=classifier_options_pb;function convertClassifierOptionsToProto(e,t){const r=t?t.clone():new classifier_options_pb_1.ClassifierOptions;return void 0!==e.displayNamesLocale?r.setDisplayNamesLocale(e.displayNamesLocale):void 0===e.displayNamesLocale&&r.clearDisplayNamesLocale(),void 0!==e.maxResults?r.setMaxResults(e.maxResults):"maxResults"in e&&r.clearMaxResults(),void 0!==e.scoreThreshold?r.setScoreThreshold(e.scoreThreshold):"scoreThreshold"in e&&r.clearScoreThreshold(),void 0!==e.categoryAllowlist?r.setCategoryAllowlistList(e.categoryAllowlist):"categoryAllowlist"in e&&r.clearCategoryAllowlistList(),void 0!==e.categoryDenylist?r.setCategoryDenylistList(e.categoryDenylist):"categoryDenylist"in e&&r.clearCategoryDenylistList(),r}classifier_options.convertClassifierOptionsToProto=convertClassifierOptionsToProto;var hand_landmarks_connections={};Object.defineProperty(hand_landmarks_connections,"__esModule",{value:!0}),hand_landmarks_connections.HAND_CONNECTIONS=void 0,hand_landmarks_connections.HAND_CONNECTIONS=[{start:0,end:1},{start:1,end:2},{start:2,end:3},{start:3,end:4},{start:0,end:5},{start:5,end:6},{start:6,end:7},{start:7,end:8},{start:5,end:9},{start:9,end:10},{start:10,end:11},{start:11,end:12},{start:9,end:13},{start:13,end:14},{start:14,end:15},{start:15,end:16},{start:13,end:17},{start:0,end:17},{start:17,end:18},{start:18,end:19},{start:19,end:20}];var gesture_recognizer_options={};Object.defineProperty(gesture_recognizer_options,"__esModule",{value:!0});var gesture_recognizer_result={};Object.defineProperty(gesture_recognizer_result,"__esModule",{value:!0}),function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,i)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(e,r){for(var o in e)"default"===o||Object.prototype.hasOwnProperty.call(r,o)||t(r,e,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.GestureRecognizer=void 0;const o=calculator_pb,i=calculator_options_pb,a=classification_pb,n=landmark_pb,s=base_options_pb,p=gesture_classifier_graph_options_pb,d=gesture_recognizer_graph_options_pb,l=hand_gesture_recognizer_graph_options_pb,g=hand_detector_graph_options_pb,c=hand_landmarker_graph_options_pb,u=hand_landmarks_detector_graph_options_pb,m=classifier_options,f=vision_task_runner,h=hand_landmarks_connections;r(gesture_recognizer_options,e),r(gesture_recognizer_result,e);const y="image_in",b="norm_rect",_="hand_gestures",O="hand_landmarks",F="world_hand_landmarks",M="handedness",R=.5;class k extends f.VisionTaskRunner{static createFromOptions(e,t){return f.VisionTaskRunner.createVisionInstance(k,e,t)}static createFromModelBuffer(e,t){return f.VisionTaskRunner.createVisionInstance(k,e,{baseOptions:{modelAssetBuffer:t}})}static createFromModelPath(e,t){return f.VisionTaskRunner.createVisionInstance(k,e,{baseOptions:{modelAssetPath:t}})}constructor(e,t){super(new f.VisionGraphRunner(e,t),y,b,!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handednesses=[],this.options=new d.GestureRecognizerGraphOptions,this.options.setBaseOptions(new s.BaseOptions),this.handLandmarkerGraphOptions=new c.HandLandmarkerGraphOptions,this.options.setHandLandmarkerGraphOptions(this.handLandmarkerGraphOptions),this.handLandmarksDetectorGraphOptions=new u.HandLandmarksDetectorGraphOptions,this.handLandmarkerGraphOptions.setHandLandmarksDetectorGraphOptions(this.handLandmarksDetectorGraphOptions),this.handDetectorGraphOptions=new g.HandDetectorGraphOptions,this.handLandmarkerGraphOptions.setHandDetectorGraphOptions(this.handDetectorGraphOptions),this.handGestureRecognizerGraphOptions=new l.HandGestureRecognizerGraphOptions,this.options.setHandGestureRecognizerGraphOptions(this.handGestureRecognizerGraphOptions),this.handDetectorGraphOptions.setMinDetectionConfidence(R),this.handLandmarkerGraphOptions.setMinTrackingConfidence(R),this.handLandmarksDetectorGraphOptions.setMinDetectionConfidence(R)}get baseOptions(){return this.options.getBaseOptions()}set baseOptions(e){this.options.setBaseOptions(e)}setOptions(e){var t,r,o,i,a,n,s,d;if(this.handDetectorGraphOptions.setNumHands(null!==(t=e.numHands)&&void 0!==t?t:1),"minHandDetectionConfidence"in e&&this.handDetectorGraphOptions.setMinDetectionConfidence(null!==(r=e.minHandDetectionConfidence)&&void 0!==r?r:R),"minTrackingConfidence"in e&&this.handLandmarkerGraphOptions.setMinTrackingConfidence(null!==(o=e.minTrackingConfidence)&&void 0!==o?o:R),"minHandPresenceConfidence"in e&&this.handLandmarksDetectorGraphOptions.setMinDetectionConfidence(null!==(i=e.minHandPresenceConfidence)&&void 0!==i?i:R),e.cannedGesturesClassifierOptions){const t=new p.GestureClassifierGraphOptions;t.setClassifierOptions((0,m.convertClassifierOptionsToProto)(e.cannedGesturesClassifierOptions,null===(a=this.handGestureRecognizerGraphOptions.getCannedGestureClassifierGraphOptions())||void 0===a?void 0:a.getClassifierOptions())),this.handGestureRecognizerGraphOptions.setCannedGestureClassifierGraphOptions(t)}else void 0===e.cannedGesturesClassifierOptions&&(null===(n=this.handGestureRecognizerGraphOptions.getCannedGestureClassifierGraphOptions())||void 0===n||n.clearClassifierOptions());if(e.customGesturesClassifierOptions){const t=new p.GestureClassifierGraphOptions;t.setClassifierOptions((0,m.convertClassifierOptionsToProto)(e.customGesturesClassifierOptions,null===(s=this.handGestureRecognizerGraphOptions.getCustomGestureClassifierGraphOptions())||void 0===s?void 0:s.getClassifierOptions())),this.handGestureRecognizerGraphOptions.setCustomGestureClassifierGraphOptions(t)}else void 0===e.customGesturesClassifierOptions&&(null===(d=this.handGestureRecognizerGraphOptions.getCustomGestureClassifierGraphOptions())||void 0===d||d.clearClassifierOptions());return this.applyOptions(e)}recognize(e,t){return this.resetResults(),this.processImageData(e,t),this.processResults()}recognizeForVideo(e,t,r){return this.resetResults(),this.processVideoData(e,r,t),this.processResults()}resetResults(){this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handednesses=[]}processResults(){return 0===this.gestures.length?{gestures:[],landmarks:[],worldLandmarks:[],handednesses:[]}:{gestures:this.gestures,landmarks:this.landmarks,worldLandmarks:this.worldLandmarks,handednesses:this.handednesses}}toJsCategories(e,t=!0){var r,o,i;const n=[];for(const s of e){const e=a.ClassificationList.deserializeBinary(s),p=[];for(const a of e.getClassificationList()){const e=t&&a.hasIndex()?a.getIndex():-1;p.push({score:null!==(r=a.getScore())&&void 0!==r?r:0,index:e,categoryName:null!==(o=a.getLabel())&&void 0!==o?o:"",displayName:null!==(i=a.getDisplayName())&&void 0!==i?i:""})}n.push(p)}return n}addJsLandmarks(e){var t,r,o;for(const i of e){const e=n.NormalizedLandmarkList.deserializeBinary(i),a=[];for(const i of e.getLandmarkList())a.push({x:null!==(t=i.getX())&&void 0!==t?t:0,y:null!==(r=i.getY())&&void 0!==r?r:0,z:null!==(o=i.getZ())&&void 0!==o?o:0});this.landmarks.push(a)}}adddJsWorldLandmarks(e){var t,r,o;for(const i of e){const e=n.LandmarkList.deserializeBinary(i),a=[];for(const i of e.getLandmarkList())a.push({x:null!==(t=i.getX())&&void 0!==t?t:0,y:null!==(r=i.getY())&&void 0!==r?r:0,z:null!==(o=i.getZ())&&void 0!==o?o:0});this.worldLandmarks.push(a)}}refreshGraph(){const e=new o.CalculatorGraphConfig;e.addInputStream(y),e.addInputStream(b),e.addOutputStream(_),e.addOutputStream(O),e.addOutputStream(F),e.addOutputStream(M);const t=new i.CalculatorOptions;t.setExtension(d.GestureRecognizerGraphOptions.ext,this.options);const r=new o.CalculatorGraphConfig.Node;r.setCalculator("mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),r.addInputStream("IMAGE:"+y),r.addInputStream("NORM_RECT:"+b),r.addOutputStream("HAND_GESTURES:"+_),r.addOutputStream("LANDMARKS:"+O),r.addOutputStream("WORLD_LANDMARKS:"+F),r.addOutputStream("HANDEDNESS:"+M),r.setOptions(t),e.addNode(r),this.graphRunner.attachProtoVectorListener(O,((e,t)=>{this.addJsLandmarks(e),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(O,(e=>{this.setLatestOutputTimestamp(e)})),this.graphRunner.attachProtoVectorListener(F,((e,t)=>{this.adddJsWorldLandmarks(e),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(F,(e=>{this.setLatestOutputTimestamp(e)})),this.graphRunner.attachProtoVectorListener(_,((e,t)=>{this.gestures.push(...this.toJsCategories(e,!1)),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(_,(e=>{this.setLatestOutputTimestamp(e)})),this.graphRunner.attachProtoVectorListener(M,((e,t)=>{this.handednesses.push(...this.toJsCategories(e)),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(M,(e=>{this.setLatestOutputTimestamp(e)}));const a=e.serializeBinary();this.setGraph(new Uint8Array(a),!0)}}e.GestureRecognizer=k,k.HAND_CONNECTIONS=h.HAND_CONNECTIONS}(gesture_recognizer);var hand_landmarker={},hand_landmarker_options={};Object.defineProperty(hand_landmarker_options,"__esModule",{value:!0});var hand_landmarker_result={};Object.defineProperty(hand_landmarker_result,"__esModule",{value:!0}),function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,i)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(e,r){for(var o in e)"default"===o||Object.prototype.hasOwnProperty.call(r,o)||t(r,e,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.HandLandmarker=void 0;const o=calculator_pb,i=calculator_options_pb,a=classification_pb,n=landmark_pb,s=base_options_pb,p=hand_detector_graph_options_pb,d=hand_landmarker_graph_options_pb,l=hand_landmarks_detector_graph_options_pb,g=landmark_result,c=vision_task_runner,u=hand_landmarks_connections;r(hand_landmarker_options,e),r(hand_landmarker_result,e);const m="image_in",f="norm_rect",h="hand_landmarks",y="world_hand_landmarks",b="handedness",_=.5;class O extends c.VisionTaskRunner{static createFromOptions(e,t){return c.VisionTaskRunner.createVisionInstance(O,e,t)}static createFromModelBuffer(e,t){return c.VisionTaskRunner.createVisionInstance(O,e,{baseOptions:{modelAssetBuffer:t}})}static createFromModelPath(e,t){return c.VisionTaskRunner.createVisionInstance(O,e,{baseOptions:{modelAssetPath:t}})}constructor(e,t){super(new c.VisionGraphRunner(e,t),m,f,!1),this.landmarks=[],this.worldLandmarks=[],this.handednesses=[],this.options=new d.HandLandmarkerGraphOptions,this.options.setBaseOptions(new s.BaseOptions),this.handLandmarksDetectorGraphOptions=new l.HandLandmarksDetectorGraphOptions,this.options.setHandLandmarksDetectorGraphOptions(this.handLandmarksDetectorGraphOptions),this.handDetectorGraphOptions=new p.HandDetectorGraphOptions,this.options.setHandDetectorGraphOptions(this.handDetectorGraphOptions),this.initDefaults()}get baseOptions(){return this.options.getBaseOptions()}set baseOptions(e){this.options.setBaseOptions(e)}setOptions(e){var t,r,o,i;return"numHands"in e&&this.handDetectorGraphOptions.setNumHands(null!==(t=e.numHands)&&void 0!==t?t:1),"minHandDetectionConfidence"in e&&this.handDetectorGraphOptions.setMinDetectionConfidence(null!==(r=e.minHandDetectionConfidence)&&void 0!==r?r:_),"minTrackingConfidence"in e&&this.options.setMinTrackingConfidence(null!==(o=e.minTrackingConfidence)&&void 0!==o?o:_),"minHandPresenceConfidence"in e&&this.handLandmarksDetectorGraphOptions.setMinDetectionConfidence(null!==(i=e.minHandPresenceConfidence)&&void 0!==i?i:_),this.applyOptions(e)}detect(e,t){return this.resetResults(),this.processImageData(e,t),this.processResults()}detectForVideo(e,t,r){return this.resetResults(),this.processVideoData(e,r,t),this.processResults()}resetResults(){this.landmarks=[],this.worldLandmarks=[],this.handednesses=[]}processResults(){return{landmarks:this.landmarks,worldLandmarks:this.worldLandmarks,handednesses:this.handednesses}}initDefaults(){this.handDetectorGraphOptions.setNumHands(1),this.handDetectorGraphOptions.setMinDetectionConfidence(_),this.handLandmarksDetectorGraphOptions.setMinDetectionConfidence(_),this.options.setMinTrackingConfidence(_)}toJsCategories(e){var t,r,o,i;const n=[];for(const s of e){const e=a.ClassificationList.deserializeBinary(s),p=[];for(const a of e.getClassificationList())p.push({score:null!==(t=a.getScore())&&void 0!==t?t:0,index:null!==(r=a.getIndex())&&void 0!==r?r:-1,categoryName:null!==(o=a.getLabel())&&void 0!==o?o:"",displayName:null!==(i=a.getDisplayName())&&void 0!==i?i:""});n.push(p)}return n}addJsLandmarks(e){for(const t of e){const e=n.NormalizedLandmarkList.deserializeBinary(t);this.landmarks.push((0,g.convertToLandmarks)(e))}}adddJsWorldLandmarks(e){for(const t of e){const e=n.LandmarkList.deserializeBinary(t);this.worldLandmarks.push((0,g.convertToWorldLandmarks)(e))}}refreshGraph(){const e=new o.CalculatorGraphConfig;e.addInputStream(m),e.addInputStream(f),e.addOutputStream(h),e.addOutputStream(y),e.addOutputStream(b);const t=new i.CalculatorOptions;t.setExtension(d.HandLandmarkerGraphOptions.ext,this.options);const r=new o.CalculatorGraphConfig.Node;r.setCalculator("mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),r.addInputStream("IMAGE:"+m),r.addInputStream("NORM_RECT:"+f),r.addOutputStream("LANDMARKS:"+h),r.addOutputStream("WORLD_LANDMARKS:"+y),r.addOutputStream("HANDEDNESS:"+b),r.setOptions(t),e.addNode(r),this.graphRunner.attachProtoVectorListener(h,((e,t)=>{this.addJsLandmarks(e),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(h,(e=>{this.setLatestOutputTimestamp(e)})),this.graphRunner.attachProtoVectorListener(y,((e,t)=>{this.adddJsWorldLandmarks(e),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(y,(e=>{this.setLatestOutputTimestamp(e)})),this.graphRunner.attachProtoVectorListener(b,((e,t)=>{this.handednesses.push(...this.toJsCategories(e)),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(b,(e=>{this.setLatestOutputTimestamp(e)}));const a=e.serializeBinary();this.setGraph(new Uint8Array(a),!0)}}e.HandLandmarker=O,O.HAND_CONNECTIONS=u.HAND_CONNECTIONS}(hand_landmarker);var image_classifier={},classifications_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=classification_pb;r.object.extend(proto,i),r.exportSymbol("proto.mediapipe.tasks.components.containers.proto.ClassificationResult",null,o),r.exportSymbol("proto.mediapipe.tasks.components.containers.proto.Classifications",null,o),proto.mediapipe.tasks.components.containers.proto.Classifications=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.components.containers.proto.Classifications,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.components.containers.proto.Classifications.displayName="proto.mediapipe.tasks.components.containers.proto.Classifications"),proto.mediapipe.tasks.components.containers.proto.ClassificationResult=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.tasks.components.containers.proto.ClassificationResult.repeatedFields_,null)},r.inherits(proto.mediapipe.tasks.components.containers.proto.ClassificationResult,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.components.containers.proto.ClassificationResult.displayName="proto.mediapipe.tasks.components.containers.proto.ClassificationResult"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.toObject=function(e){return proto.mediapipe.tasks.components.containers.proto.Classifications.toObject(e,this)},proto.mediapipe.tasks.components.containers.proto.Classifications.toObject=function(e,r){var o,a={classificationList:(o=r.getClassificationList())&&i.ClassificationList.toObject(e,o),headIndex:null==(o=t.Message.getField(r,2))?void 0:o,headName:null==(o=t.Message.getField(r,3))?void 0:o};return e&&(a.$jspbMessageInstance=r),a}),proto.mediapipe.tasks.components.containers.proto.Classifications.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.components.containers.proto.Classifications;return proto.mediapipe.tasks.components.containers.proto.Classifications.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.components.containers.proto.Classifications.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 4:var r=new i.ClassificationList;t.readMessage(r,i.ClassificationList.deserializeBinaryFromReader),e.setClassificationList(r);break;case 2:r=t.readInt32();e.setHeadIndex(r);break;case 3:r=t.readString();e.setHeadName(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.components.containers.proto.Classifications.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.components.containers.proto.Classifications.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getClassificationList())&&r.writeMessage(4,o,i.ClassificationList.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeInt32(2,o),null!=(o=t.Message.getField(e,3))&&r.writeString(3,o)},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.getClassificationList=function(){return t.Message.getWrapperField(this,i.ClassificationList,4)},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.setClassificationList=function(e){return t.Message.setWrapperField(this,4,e)},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.clearClassificationList=function(){return this.setClassificationList(void 0)},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.hasClassificationList=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.getHeadIndex=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.setHeadIndex=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.clearHeadIndex=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.hasHeadIndex=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.getHeadName=function(){return t.Message.getFieldWithDefault(this,3,"")},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.setHeadName=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.clearHeadName=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.tasks.components.containers.proto.Classifications.prototype.hasHeadName=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.components.containers.proto.ClassificationResult.prototype.toObject=function(e){return proto.mediapipe.tasks.components.containers.proto.ClassificationResult.toObject(e,this)},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.toObject=function(e,r){var o,i={classificationsList:t.Message.toObjectList(r.getClassificationsList(),proto.mediapipe.tasks.components.containers.proto.Classifications.toObject,e),timestampMs:null==(o=t.Message.getField(r,2))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.components.containers.proto.ClassificationResult.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.components.containers.proto.ClassificationResult;return proto.mediapipe.tasks.components.containers.proto.ClassificationResult.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new proto.mediapipe.tasks.components.containers.proto.Classifications;t.readMessage(r,proto.mediapipe.tasks.components.containers.proto.Classifications.deserializeBinaryFromReader),e.addClassifications(r);break;case 2:r=t.readInt64();e.setTimestampMs(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.components.containers.proto.ClassificationResult.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.serializeBinaryToWriter=function(e,r){var o=void 0;(o=e.getClassificationsList()).length>0&&r.writeRepeatedMessage(1,o,proto.mediapipe.tasks.components.containers.proto.Classifications.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeInt64(2,o)},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.prototype.getClassificationsList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.tasks.components.containers.proto.Classifications,1)},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.prototype.setClassificationsList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.prototype.addClassifications=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.tasks.components.containers.proto.Classifications,r)},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.prototype.clearClassificationsList=function(){return this.setClassificationsList([])},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.prototype.getTimestampMs=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.prototype.setTimestampMs=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.prototype.clearTimestampMs=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.components.containers.proto.ClassificationResult.prototype.hasTimestampMs=function(){return null!=t.Message.getField(this,2)},r.object.extend(e,proto.mediapipe.tasks.components.containers.proto)}(classifications_pb);var image_classifier_graph_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=classifier_options_pb;r.object.extend(proto,n);var s=base_options_pb;r.object.extend(proto,s),r.exportSymbol("proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions",null,o),proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.displayName="proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.toObject=function(e,t){var r,o={baseOptions:(r=t.getBaseOptions())&&s.BaseOptions.toObject(e,r),classifierOptions:(r=t.getClassifierOptions())&&n.ClassifierOptions.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions;return proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new s.BaseOptions;t.readMessage(r,s.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=new n.ClassifierOptions;t.readMessage(r,n.ClassifierOptions.deserializeBinaryFromReader),e.setClassifierOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.serializeBinaryToWriter=function(e,t){var r=void 0;null!=(r=e.getBaseOptions())&&t.writeMessage(1,r,s.BaseOptions.serializeBinaryToWriter),null!=(r=e.getClassifierOptions())&&t.writeMessage(2,r,n.ClassifierOptions.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.ext=new t.ExtensionFieldInfo(456383383,{ext:0},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions,proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[456383383]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[456383383]=proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.ext,proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,s.BaseOptions,1)},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.prototype.getClassifierOptions=function(){return t.Message.getWrapperField(this,n.ClassifierOptions,2)},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.prototype.setClassifierOptions=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.prototype.clearClassifierOptions=function(){return this.setClassifierOptions(void 0)},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.prototype.hasClassifierOptions=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.ext=new t.ExtensionFieldInfo(456383383,{ext:0},proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions,proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[456383383]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[456383383]=proto.mediapipe.tasks.vision.image_classifier.proto.ImageClassifierGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.image_classifier.proto)}(image_classifier_graph_options_pb);var image_classifier_options={};Object.defineProperty(image_classifier_options,"__esModule",{value:!0});var image_classifier_result={};Object.defineProperty(image_classifier_result,"__esModule",{value:!0}),function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,i)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(e,r){for(var o in e)"default"===o||Object.prototype.hasOwnProperty.call(r,o)||t(r,e,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.ImageClassifier=void 0;const o=calculator_pb,i=calculator_options_pb,a=classifications_pb,n=base_options_pb,s=image_classifier_graph_options_pb,p=classifier_options,d=classifier_result,l=vision_task_runner,g="input_image",c="norm_rect",u="classifications";r(image_classifier_options,e),r(image_classifier_result,e);class m extends l.VisionTaskRunner{static createFromOptions(e,t){return l.VisionTaskRunner.createVisionInstance(m,e,t)}static createFromModelBuffer(e,t){return l.VisionTaskRunner.createVisionInstance(m,e,{baseOptions:{modelAssetBuffer:t}})}static createFromModelPath(e,t){return l.VisionTaskRunner.createVisionInstance(m,e,{baseOptions:{modelAssetPath:t}})}constructor(e,t){super(new l.VisionGraphRunner(e,t),g,c,!0),this.classificationResult={classifications:[]},this.options=new s.ImageClassifierGraphOptions,this.options.setBaseOptions(new n.BaseOptions)}get baseOptions(){return this.options.getBaseOptions()}set baseOptions(e){this.options.setBaseOptions(e)}setOptions(e){return this.options.setClassifierOptions((0,p.convertClassifierOptionsToProto)(e,this.options.getClassifierOptions())),this.applyOptions(e)}classify(e,t){return this.classificationResult={classifications:[]},this.processImageData(e,t),this.classificationResult}classifyForVideo(e,t,r){return this.classificationResult={classifications:[]},this.processVideoData(e,r,t),this.classificationResult}refreshGraph(){const e=new o.CalculatorGraphConfig;e.addInputStream(g),e.addInputStream(c),e.addOutputStream(u);const t=new i.CalculatorOptions;t.setExtension(s.ImageClassifierGraphOptions.ext,this.options);const r=new o.CalculatorGraphConfig.Node;r.setCalculator("mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),r.addInputStream("IMAGE:"+g),r.addInputStream("NORM_RECT:"+c),r.addOutputStream("CLASSIFICATIONS:"+u),r.setOptions(t),e.addNode(r),this.graphRunner.attachProtoListener(u,((e,t)=>{this.classificationResult=(0,d.convertFromClassificationResultProto)(a.ClassificationResult.deserializeBinary(e)),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(u,(e=>{this.setLatestOutputTimestamp(e)}));const n=e.serializeBinary();this.setGraph(new Uint8Array(n),!0)}}e.ImageClassifier=m}(image_classifier);var image_embedder={},embeddings_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.tasks.components.containers.proto.Embedding",null,o),r.exportSymbol("proto.mediapipe.tasks.components.containers.proto.Embedding.EmbeddingCase",null,o),r.exportSymbol("proto.mediapipe.tasks.components.containers.proto.EmbeddingResult",null,o),r.exportSymbol("proto.mediapipe.tasks.components.containers.proto.FloatEmbedding",null,o),r.exportSymbol("proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding",null,o),proto.mediapipe.tasks.components.containers.proto.FloatEmbedding=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.repeatedFields_,null)},r.inherits(proto.mediapipe.tasks.components.containers.proto.FloatEmbedding,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.displayName="proto.mediapipe.tasks.components.containers.proto.FloatEmbedding"),proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.displayName="proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding"),proto.mediapipe.tasks.components.containers.proto.Embedding=function(e){t.Message.initialize(this,e,0,-1,null,proto.mediapipe.tasks.components.containers.proto.Embedding.oneofGroups_)},r.inherits(proto.mediapipe.tasks.components.containers.proto.Embedding,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.components.containers.proto.Embedding.displayName="proto.mediapipe.tasks.components.containers.proto.Embedding"),proto.mediapipe.tasks.components.containers.proto.EmbeddingResult=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.repeatedFields_,null)},r.inherits(proto.mediapipe.tasks.components.containers.proto.EmbeddingResult,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.displayName="proto.mediapipe.tasks.components.containers.proto.EmbeddingResult"),proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.prototype.toObject=function(e){return proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.toObject(e,this)},proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.toObject=function(e,r){var o,i={valuesList:null==(o=t.Message.getRepeatedFloatingPointField(r,1))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.components.containers.proto.FloatEmbedding;return proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber())for(var r=t.isDelimited()?t.readPackedFloat():[t.readFloat()],o=0;o0&&t.writePackedFloat(1,r)},proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.prototype.getValuesList=function(){return t.Message.getRepeatedFloatingPointField(this,1)},proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.prototype.setValuesList=function(e){return t.Message.setField(this,1,e||[])},proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.prototype.addValues=function(e,r){return t.Message.addToRepeatedField(this,1,e,r)},proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.prototype.clearValuesList=function(){return this.setValuesList([])},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.prototype.toObject=function(e){return proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.toObject(e,this)},proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.toObject=function(e,t){var r={values:t.getValues_asB64()};return e&&(r.$jspbMessageInstance=t),r}),proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding;return proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=t.readBytes();e.setValues(r)}else t.skipField()}return e},proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.serializeBinaryToWriter=function(e,r){var o;null!=(o=t.Message.getField(e,1))&&r.writeBytes(1,o)},proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.prototype.getValues=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.prototype.getValues_asB64=function(){return t.Message.bytesAsB64(this.getValues())},proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.prototype.getValues_asU8=function(){return t.Message.bytesAsU8(this.getValues())},proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.prototype.setValues=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.prototype.clearValues=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.prototype.hasValues=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.components.containers.proto.Embedding.oneofGroups_=[[1,2]],proto.mediapipe.tasks.components.containers.proto.Embedding.EmbeddingCase={EMBEDDING_NOT_SET:0,FLOAT_EMBEDDING:1,QUANTIZED_EMBEDDING:2},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.getEmbeddingCase=function(){return t.Message.computeOneofCase(this,proto.mediapipe.tasks.components.containers.proto.Embedding.oneofGroups_[0])},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.toObject=function(e){return proto.mediapipe.tasks.components.containers.proto.Embedding.toObject(e,this)},proto.mediapipe.tasks.components.containers.proto.Embedding.toObject=function(e,r){var o,i={floatEmbedding:(o=r.getFloatEmbedding())&&proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.toObject(e,o),quantizedEmbedding:(o=r.getQuantizedEmbedding())&&proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.toObject(e,o),headIndex:null==(o=t.Message.getField(r,3))?void 0:o,headName:null==(o=t.Message.getField(r,4))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.components.containers.proto.Embedding.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.components.containers.proto.Embedding;return proto.mediapipe.tasks.components.containers.proto.Embedding.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.components.containers.proto.Embedding.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new proto.mediapipe.tasks.components.containers.proto.FloatEmbedding;t.readMessage(r,proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.deserializeBinaryFromReader),e.setFloatEmbedding(r);break;case 2:r=new proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding;t.readMessage(r,proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.deserializeBinaryFromReader),e.setQuantizedEmbedding(r);break;case 3:r=t.readInt32();e.setHeadIndex(r);break;case 4:r=t.readString();e.setHeadName(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.components.containers.proto.Embedding.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.components.containers.proto.Embedding.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getFloatEmbedding())&&r.writeMessage(1,o,proto.mediapipe.tasks.components.containers.proto.FloatEmbedding.serializeBinaryToWriter),null!=(o=e.getQuantizedEmbedding())&&r.writeMessage(2,o,proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding.serializeBinaryToWriter),null!=(o=t.Message.getField(e,3))&&r.writeInt32(3,o),null!=(o=t.Message.getField(e,4))&&r.writeString(4,o)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.getFloatEmbedding=function(){return t.Message.getWrapperField(this,proto.mediapipe.tasks.components.containers.proto.FloatEmbedding,1)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.setFloatEmbedding=function(e){return t.Message.setOneofWrapperField(this,1,proto.mediapipe.tasks.components.containers.proto.Embedding.oneofGroups_[0],e)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.clearFloatEmbedding=function(){return this.setFloatEmbedding(void 0)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.hasFloatEmbedding=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.getQuantizedEmbedding=function(){return t.Message.getWrapperField(this,proto.mediapipe.tasks.components.containers.proto.QuantizedEmbedding,2)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.setQuantizedEmbedding=function(e){return t.Message.setOneofWrapperField(this,2,proto.mediapipe.tasks.components.containers.proto.Embedding.oneofGroups_[0],e)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.clearQuantizedEmbedding=function(){return this.setQuantizedEmbedding(void 0)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.hasQuantizedEmbedding=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.getHeadIndex=function(){return t.Message.getFieldWithDefault(this,3,0)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.setHeadIndex=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.clearHeadIndex=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.hasHeadIndex=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.getHeadName=function(){return t.Message.getFieldWithDefault(this,4,"")},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.setHeadName=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.clearHeadName=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.tasks.components.containers.proto.Embedding.prototype.hasHeadName=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.prototype.toObject=function(e){return proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.toObject(e,this)},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.toObject=function(e,r){var o,i={embeddingsList:t.Message.toObjectList(r.getEmbeddingsList(),proto.mediapipe.tasks.components.containers.proto.Embedding.toObject,e),timestampMs:null==(o=t.Message.getField(r,2))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.components.containers.proto.EmbeddingResult;return proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new proto.mediapipe.tasks.components.containers.proto.Embedding;t.readMessage(r,proto.mediapipe.tasks.components.containers.proto.Embedding.deserializeBinaryFromReader),e.addEmbeddings(r);break;case 2:r=t.readInt64();e.setTimestampMs(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.serializeBinaryToWriter=function(e,r){var o=void 0;(o=e.getEmbeddingsList()).length>0&&r.writeRepeatedMessage(1,o,proto.mediapipe.tasks.components.containers.proto.Embedding.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeInt64(2,o)},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.prototype.getEmbeddingsList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.tasks.components.containers.proto.Embedding,1)},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.prototype.setEmbeddingsList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.prototype.addEmbeddings=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.tasks.components.containers.proto.Embedding,r)},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.prototype.clearEmbeddingsList=function(){return this.setEmbeddingsList([])},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.prototype.getTimestampMs=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.prototype.setTimestampMs=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.prototype.clearTimestampMs=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.components.containers.proto.EmbeddingResult.prototype.hasTimestampMs=function(){return null!=t.Message.getField(this,2)},r.object.extend(e,proto.mediapipe.tasks.components.containers.proto)}(embeddings_pb);var image_embedder_graph_options_pb={},embedder_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.tasks.components.processors.proto.EmbedderOptions",null,o),proto.mediapipe.tasks.components.processors.proto.EmbedderOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.components.processors.proto.EmbedderOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.displayName="proto.mediapipe.tasks.components.processors.proto.EmbedderOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.toObject(e,this)},proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.toObject=function(e,r){var o,i={l2Normalize:null==(o=t.Message.getBooleanField(r,1))?void 0:o,quantize:null==(o=t.Message.getBooleanField(r,2))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.components.processors.proto.EmbedderOptions;return proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readBool();e.setL2Normalize(r);break;case 2:r=t.readBool();e.setQuantize(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeBool(1,o),null!=(o=t.Message.getField(e,2))&&r.writeBool(2,o)},proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.prototype.getL2Normalize=function(){return t.Message.getBooleanFieldWithDefault(this,1,!1)},proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.prototype.setL2Normalize=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.prototype.clearL2Normalize=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.prototype.hasL2Normalize=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.prototype.getQuantize=function(){return t.Message.getBooleanFieldWithDefault(this,2,!1)},proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.prototype.setQuantize=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.prototype.clearQuantize=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.components.processors.proto.EmbedderOptions.prototype.hasQuantize=function(){return null!=t.Message.getField(this,2)},r.object.extend(e,proto.mediapipe.tasks.components.processors.proto)}(embedder_options_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=embedder_options_pb;r.object.extend(proto,n);var s=base_options_pb;r.object.extend(proto,s),r.exportSymbol("proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions",null,o),proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.displayName="proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.toObject=function(e,t){var r,o={baseOptions:(r=t.getBaseOptions())&&s.BaseOptions.toObject(e,r),embedderOptions:(r=t.getEmbedderOptions())&&n.EmbedderOptions.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions;return proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new s.BaseOptions;t.readMessage(r,s.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=new n.EmbedderOptions;t.readMessage(r,n.EmbedderOptions.deserializeBinaryFromReader),e.setEmbedderOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.serializeBinaryToWriter=function(e,t){var r=void 0;null!=(r=e.getBaseOptions())&&t.writeMessage(1,r,s.BaseOptions.serializeBinaryToWriter),null!=(r=e.getEmbedderOptions())&&t.writeMessage(2,r,n.EmbedderOptions.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.ext=new t.ExtensionFieldInfo(476348187,{ext:0},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions,proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[476348187]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[476348187]=proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.ext,proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,s.BaseOptions,1)},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.prototype.getEmbedderOptions=function(){return t.Message.getWrapperField(this,n.EmbedderOptions,2)},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.prototype.setEmbedderOptions=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.prototype.clearEmbedderOptions=function(){return this.setEmbedderOptions(void 0)},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.prototype.hasEmbedderOptions=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.ext=new t.ExtensionFieldInfo(476348187,{ext:0},proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions,proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[476348187]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[476348187]=proto.mediapipe.tasks.vision.image_embedder.proto.ImageEmbedderGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.image_embedder.proto)}(image_embedder_graph_options_pb);var embedder_options={};Object.defineProperty(embedder_options,"__esModule",{value:!0}),embedder_options.convertEmbedderOptionsToProto=void 0;const embedder_options_pb_1=embedder_options_pb;function convertEmbedderOptionsToProto(e,t){const r=t?t.clone():new embedder_options_pb_1.EmbedderOptions;return void 0!==e.l2Normalize?r.setL2Normalize(e.l2Normalize):"l2Normalize"in e&&r.clearL2Normalize(),void 0!==e.quantize?r.setQuantize(e.quantize):"quantize"in e&&r.clearQuantize(),r}embedder_options.convertEmbedderOptionsToProto=convertEmbedderOptionsToProto;var embedder_result={};Object.defineProperty(embedder_result,"__esModule",{value:!0}),embedder_result.convertFromEmbeddingResultProto=void 0;const DEFAULT_INDEX=-1;function convertFromEmbeddingsProto(e){var t,r,o,i;const a={headIndex:null!==(t=e.getHeadIndex())&&void 0!==t?t:DEFAULT_INDEX,headName:null!==(r=e.getHeadName())&&void 0!==r?r:""};if(e.hasFloatEmbedding())a.floatEmbedding=e.getFloatEmbedding().getValuesList();else{const t=null!==(i=null===(o=e.getQuantizedEmbedding())||void 0===o?void 0:o.getValues())&&void 0!==i?i:"";a.quantizedEmbedding="string"==typeof t?Uint8Array.from(atob(t),(e=>e.charCodeAt(0))):t}return a}function convertFromEmbeddingResultProto(e){return{embeddings:e.getEmbeddingsList().map((e=>convertFromEmbeddingsProto(e))),timestampMs:e.getTimestampMs()}}embedder_result.convertFromEmbeddingResultProto=convertFromEmbeddingResultProto;var cosine_similarity={};function computeCosineSimilarity(e,t){if(e.floatEmbedding&&t.floatEmbedding)return compute(e.floatEmbedding,t.floatEmbedding);if(e.quantizedEmbedding&&t.quantizedEmbedding)return compute(convertToBytes(e.quantizedEmbedding),convertToBytes(t.quantizedEmbedding));throw new Error("Cannot compute cosine similarity between quantized and float embeddings.")}function convertToBytes(e){return Array.from(e,(e=>e>127?e-256:e))}function compute(e,t){if(e.length!==t.length)throw new Error(`Cannot compute cosine similarity between embeddings of different sizes (${e.length} vs. ${t.length}).`);let r=0,o=0,i=0;for(let a=0;a{this.addJsImageEmdedding(e),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(m,(e=>{this.setLatestOutputTimestamp(e)}));const a=e.serializeBinary();this.setGraph(new Uint8Array(a),!0)}}e.ImageEmbedder=f}(image_embedder);var image_segmenter={},tensors_to_segmentation_calculator_pb={},segmenter_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions",null,o),r.exportSymbol("proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.Activation",null,o),r.exportSymbol("proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.OutputType",null,o),proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.displayName="proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.toObject(e,this)},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.toObject=function(e,r){var o,i={outputType:null==(o=t.Message.getField(r,1))?void 0:o,activation:t.Message.getFieldWithDefault(r,2,0)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions;return proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readEnum();e.setOutputType(r);break;case 2:r=t.readEnum();e.setActivation(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeEnum(1,o),null!=(o=t.Message.getField(e,2))&&r.writeEnum(2,o)},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.OutputType={UNSPECIFIED:0,CATEGORY_MASK:1,CONFIDENCE_MASK:2},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.Activation={NONE:0,SIGMOID:1,SOFTMAX:2},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.prototype.getOutputType=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.prototype.setOutputType=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.prototype.clearOutputType=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.prototype.hasOutputType=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.prototype.getActivation=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.prototype.setActivation=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.prototype.clearActivation=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.vision.image_segmenter.proto.SegmenterOptions.prototype.hasActivation=function(){return null!=t.Message.getField(this,2)},r.object.extend(e,proto.mediapipe.tasks.vision.image_segmenter.proto)}(segmenter_options_pb);var label_map_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.LabelMapItem",null,o),proto.mediapipe.LabelMapItem=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.LabelMapItem.repeatedFields_,null)},r.inherits(proto.mediapipe.LabelMapItem,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.LabelMapItem.displayName="proto.mediapipe.LabelMapItem"),proto.mediapipe.LabelMapItem.repeatedFields_=[3],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.LabelMapItem.prototype.toObject=function(e){return proto.mediapipe.LabelMapItem.toObject(e,this)},proto.mediapipe.LabelMapItem.toObject=function(e,r){var o,i={name:null==(o=t.Message.getField(r,1))?void 0:o,displayName:null==(o=t.Message.getField(r,2))?void 0:o,childNameList:null==(o=t.Message.getRepeatedField(r,3))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.LabelMapItem.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.LabelMapItem;return proto.mediapipe.LabelMapItem.deserializeBinaryFromReader(o,r)},proto.mediapipe.LabelMapItem.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setName(r);break;case 2:r=t.readString();e.setDisplayName(r);break;case 3:r=t.readString();e.addChildName(r);break;default:t.skipField()}}return e},proto.mediapipe.LabelMapItem.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.LabelMapItem.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.LabelMapItem.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeString(1,o),null!=(o=t.Message.getField(e,2))&&r.writeString(2,o),(o=e.getChildNameList()).length>0&&r.writeRepeatedString(3,o)},proto.mediapipe.LabelMapItem.prototype.getName=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.LabelMapItem.prototype.setName=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.LabelMapItem.prototype.clearName=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.LabelMapItem.prototype.hasName=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.LabelMapItem.prototype.getDisplayName=function(){return t.Message.getFieldWithDefault(this,2,"")},proto.mediapipe.LabelMapItem.prototype.setDisplayName=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.LabelMapItem.prototype.clearDisplayName=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.LabelMapItem.prototype.hasDisplayName=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.LabelMapItem.prototype.getChildNameList=function(){return t.Message.getRepeatedField(this,3)},proto.mediapipe.LabelMapItem.prototype.setChildNameList=function(e){return t.Message.setField(this,3,e||[])},proto.mediapipe.LabelMapItem.prototype.addChildName=function(e,r){return t.Message.addToRepeatedField(this,3,e,r)},proto.mediapipe.LabelMapItem.prototype.clearChildNameList=function(){return this.setChildNameList([])},r.object.extend(e,proto.mediapipe)}(label_map_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_options_pb;r.object.extend(proto,i);var a=segmenter_options_pb;r.object.extend(proto,a);var n=label_map_pb;r.object.extend(proto,n),r.exportSymbol("proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions",null,o),proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.displayName="proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.toObject(e,this)},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.toObject=function(e,t){var r,o={segmenterOptions:(r=t.getSegmenterOptions())&&a.SegmenterOptions.toObject(e,r),labelItemsMap:(r=t.getLabelItemsMap())?r.toObject(e,proto.mediapipe.LabelMapItem.toObject):[]};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions;return proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.deserializeBinaryFromReader=function(e,r){for(;r.nextField()&&!r.isEndGroup();){switch(r.getFieldNumber()){case 1:var o=new a.SegmenterOptions;r.readMessage(o,a.SegmenterOptions.deserializeBinaryFromReader),e.setSegmenterOptions(o);break;case 2:o=e.getLabelItemsMap();r.readMessage(o,(function(e,r){t.Map.deserializeBinary(e,r,t.BinaryReader.prototype.readInt64,t.BinaryReader.prototype.readMessage,proto.mediapipe.LabelMapItem.deserializeBinaryFromReader,0,new proto.mediapipe.LabelMapItem)}));break;default:r.skipField()}}return e},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getSegmenterOptions())&&r.writeMessage(1,o,a.SegmenterOptions.serializeBinaryToWriter),(o=e.getLabelItemsMap(!0))&&o.getLength()>0&&o.serializeBinary(2,r,t.BinaryWriter.prototype.writeInt64,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.LabelMapItem.serializeBinaryToWriter)},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.ext=new t.ExtensionFieldInfo(458105876,{ext:0},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions,proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.toObject,0),i.CalculatorOptions.extensionsBinary[458105876]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.serializeBinaryToWriter,proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.deserializeBinaryFromReader,!1),i.CalculatorOptions.extensions[458105876]=proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.ext,proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.prototype.getSegmenterOptions=function(){return t.Message.getWrapperField(this,a.SegmenterOptions,1)},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.prototype.setSegmenterOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.prototype.clearSegmenterOptions=function(){return this.setSegmenterOptions(void 0)},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.prototype.hasSegmenterOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.prototype.getLabelItemsMap=function(e){return t.Message.getMapField(this,2,e,proto.mediapipe.LabelMapItem)},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.prototype.clearLabelItemsMap=function(){return this.getLabelItemsMap().clear(),this},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.ext=new t.ExtensionFieldInfo(458105876,{ext:0},proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions,proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.toObject,0),i.CalculatorOptions.extensionsBinary[458105876]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.serializeBinaryToWriter,proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.deserializeBinaryFromReader,!1),i.CalculatorOptions.extensions[458105876]=proto.mediapipe.tasks.TensorsToSegmentationCalculatorOptions.ext,r.object.extend(e,proto.mediapipe.tasks)}(tensors_to_segmentation_calculator_pb);var image_segmenter_graph_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n);var s=segmenter_options_pb;r.object.extend(proto,s),r.exportSymbol("proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions",null,o),proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.displayName="proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.toObject=function(e,r){var o,i={baseOptions:(o=r.getBaseOptions())&&n.BaseOptions.toObject(e,o),displayNamesLocale:t.Message.getFieldWithDefault(r,2,"en"),segmenterOptions:(o=r.getSegmenterOptions())&&s.SegmenterOptions.toObject(e,o)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions;return proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=t.readString();e.setDisplayNamesLocale(r);break;case 3:r=new s.SegmenterOptions;t.readMessage(r,s.SegmenterOptions.deserializeBinaryFromReader),e.setSegmenterOptions(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getBaseOptions())&&r.writeMessage(1,o,n.BaseOptions.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeString(2,o),null!=(o=e.getSegmenterOptions())&&r.writeMessage(3,o,s.SegmenterOptions.serializeBinaryToWriter)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.ext=new t.ExtensionFieldInfo(458105758,{ext:0},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions,proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[458105758]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[458105758]=proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.ext,proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.getDisplayNamesLocale=function(){return t.Message.getFieldWithDefault(this,2,"en")},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.setDisplayNamesLocale=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.clearDisplayNamesLocale=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.hasDisplayNamesLocale=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.getSegmenterOptions=function(){return t.Message.getWrapperField(this,s.SegmenterOptions,3)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.setSegmenterOptions=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.clearSegmenterOptions=function(){return this.setSegmenterOptions(void 0)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.prototype.hasSegmenterOptions=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.ext=new t.ExtensionFieldInfo(458105758,{ext:0},proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions,proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[458105758]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[458105758]=proto.mediapipe.tasks.vision.image_segmenter.proto.ImageSegmenterGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.image_segmenter.proto)}(image_segmenter_graph_options_pb);var image_segmenter_options={};Object.defineProperty(image_segmenter_options,"__esModule",{value:!0});var image_segmenter_result={};Object.defineProperty(image_segmenter_result,"__esModule",{value:!0}),function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,i)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(e,r){for(var o in e)"default"===o||Object.prototype.hasOwnProperty.call(r,o)||t(r,e,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.ImageSegmenter=void 0;const o=calculator_pb,i=calculator_options_pb,a=base_options_pb,n=tensors_to_segmentation_calculator_pb,s=image_segmenter_graph_options_pb,p=segmenter_options_pb,d=vision_task_runner;r(image_segmenter_options,e),r(image_segmenter_result,e);const l="image_in",g="norm_rect",c="confidence_masks",u="category_mask",m="mediapipe.tasks.TensorsToSegmentationCalculator";class f extends d.VisionTaskRunner{static createFromOptions(e,t){return d.VisionTaskRunner.createVisionInstance(f,e,t)}static createFromModelBuffer(e,t){return d.VisionTaskRunner.createVisionInstance(f,e,{baseOptions:{modelAssetBuffer:t}})}static createFromModelPath(e,t){return d.VisionTaskRunner.createVisionInstance(f,e,{baseOptions:{modelAssetPath:t}})}constructor(e,t){super(new d.VisionGraphRunner(e,t),l,g,!1),this.result={},this.labels=[],this.outputCategoryMask=false,this.outputConfidenceMasks=true,this.options=new s.ImageSegmenterGraphOptions,this.segmenterOptions=new p.SegmenterOptions,this.options.setSegmenterOptions(this.segmenterOptions),this.options.setBaseOptions(new a.BaseOptions)}get baseOptions(){return this.options.getBaseOptions()}set baseOptions(e){this.options.setBaseOptions(e)}setOptions(e){var t,r;return void 0!==e.displayNamesLocale?this.options.setDisplayNamesLocale(e.displayNamesLocale):"displayNamesLocale"in e&&this.options.clearDisplayNamesLocale(),"outputCategoryMask"in e&&(this.outputCategoryMask=null!==(t=e.outputCategoryMask)&&void 0!==t&&t),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=null===(r=e.outputConfidenceMasks)||void 0===r||r),super.applyOptions(e)}onGraphRefreshed(){this.populateLabels()}populateLabels(){var e,t,r;const o=this.getCalculatorGraphConfig().getNodeList().filter((e=>e.getName().includes(m)));if(this.labels=[],o.length>1)throw new Error(`The graph has more than one ${m}.`);if(1===o.length){(null!==(r=null===(t=null===(e=o[0].getOptions())||void 0===e?void 0:e.getExtension(n.TensorsToSegmentationCalculatorOptions.ext))||void 0===t?void 0:t.getLabelItemsMap())&&void 0!==r?r:new Map).forEach(((e,t)=>{this.labels[Number(t)]=e.getName()}))}}segment(e,t,r){const o="function"!=typeof t?t:{};if(this.userCallback="function"==typeof t?t:r,this.reset(),this.processImageData(e,o),!this.userCallback)return this.result}segmentForVideo(e,t,r,o){const i="function"!=typeof r?r:{};if(this.userCallback="function"==typeof r?r:o,this.reset(),this.processVideoData(e,i,t),!this.userCallback)return this.result}getLabels(){return this.labels}reset(){this.result={}}maybeInvokeCallback(){this.outputConfidenceMasks&&!("confidenceMasks"in this.result)||this.outputCategoryMask&&!("categoryMask"in this.result)||this.userCallback&&(this.userCallback(this.result),this.freeKeepaliveStreams())}refreshGraph(){const e=new o.CalculatorGraphConfig;e.addInputStream(l),e.addInputStream(g);const t=new i.CalculatorOptions;t.setExtension(s.ImageSegmenterGraphOptions.ext,this.options);const r=new o.CalculatorGraphConfig.Node;r.setCalculator("mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),r.addInputStream("IMAGE:"+l),r.addInputStream("NORM_RECT:"+g),r.setOptions(t),e.addNode(r),this.addKeepaliveNode(e),this.outputConfidenceMasks&&(e.addOutputStream(c),r.addOutputStream("CONFIDENCE_MASKS:"+c),this.keepStreamAlive(c),this.graphRunner.attachImageVectorListener(c,((e,t)=>{this.result.confidenceMasks=e.map((e=>this.convertToMPMask(e,!this.userCallback))),this.setLatestOutputTimestamp(t),this.maybeInvokeCallback()})),this.graphRunner.attachEmptyPacketListener(c,(e=>{this.result.confidenceMasks=void 0,this.setLatestOutputTimestamp(e),this.maybeInvokeCallback()}))),this.outputCategoryMask&&(e.addOutputStream(u),r.addOutputStream("CATEGORY_MASK:"+u),this.keepStreamAlive(u),this.graphRunner.attachImageListener(u,((e,t)=>{this.result.categoryMask=this.convertToMPMask(e,!this.userCallback),this.setLatestOutputTimestamp(t),this.maybeInvokeCallback()})),this.graphRunner.attachEmptyPacketListener(u,(e=>{this.result.categoryMask=void 0,this.setLatestOutputTimestamp(e),this.maybeInvokeCallback()})));const a=e.serializeBinary();this.setGraph(new Uint8Array(a),!0)}}e.ImageSegmenter=f}(image_segmenter);var interactive_segmenter={},color_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")();r.exportSymbol("proto.mediapipe.Color",null,o),r.exportSymbol("proto.mediapipe.ColorMap",null,o),proto.mediapipe.Color=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.Color,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.Color.displayName="proto.mediapipe.Color"),proto.mediapipe.ColorMap=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.ColorMap,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.ColorMap.displayName="proto.mediapipe.ColorMap"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.Color.prototype.toObject=function(e){return proto.mediapipe.Color.toObject(e,this)},proto.mediapipe.Color.toObject=function(e,r){var o,i={r:null==(o=t.Message.getField(r,1))?void 0:o,g:null==(o=t.Message.getField(r,2))?void 0:o,b:null==(o=t.Message.getField(r,3))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.Color.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.Color;return proto.mediapipe.Color.deserializeBinaryFromReader(o,r)},proto.mediapipe.Color.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readInt32();e.setR(r);break;case 2:r=t.readInt32();e.setG(r);break;case 3:r=t.readInt32();e.setB(r);break;default:t.skipField()}}return e},proto.mediapipe.Color.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.Color.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.Color.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeInt32(1,o),null!=(o=t.Message.getField(e,2))&&r.writeInt32(2,o),null!=(o=t.Message.getField(e,3))&&r.writeInt32(3,o)},proto.mediapipe.Color.prototype.getR=function(){return t.Message.getFieldWithDefault(this,1,0)},proto.mediapipe.Color.prototype.setR=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.Color.prototype.clearR=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.Color.prototype.hasR=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.Color.prototype.getG=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.Color.prototype.setG=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.Color.prototype.clearG=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.Color.prototype.hasG=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.Color.prototype.getB=function(){return t.Message.getFieldWithDefault(this,3,0)},proto.mediapipe.Color.prototype.setB=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.Color.prototype.clearB=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.Color.prototype.hasB=function(){return null!=t.Message.getField(this,3)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.ColorMap.prototype.toObject=function(e){return proto.mediapipe.ColorMap.toObject(e,this)},proto.mediapipe.ColorMap.toObject=function(e,t){var r,o={labelToColorMap:(r=t.getLabelToColorMap())?r.toObject(e,proto.mediapipe.Color.toObject):[]};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.ColorMap.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.ColorMap;return proto.mediapipe.ColorMap.deserializeBinaryFromReader(o,r)},proto.mediapipe.ColorMap.deserializeBinaryFromReader=function(e,r){for(;r.nextField()&&!r.isEndGroup();){if(1===r.getFieldNumber()){var o=e.getLabelToColorMap();r.readMessage(o,(function(e,r){t.Map.deserializeBinary(e,r,t.BinaryReader.prototype.readString,t.BinaryReader.prototype.readMessage,proto.mediapipe.Color.deserializeBinaryFromReader,"",new proto.mediapipe.Color)}))}else r.skipField()}return e},proto.mediapipe.ColorMap.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.ColorMap.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.ColorMap.serializeBinaryToWriter=function(e,r){var o=void 0;(o=e.getLabelToColorMap(!0))&&o.getLength()>0&&o.serializeBinary(1,r,t.BinaryWriter.prototype.writeString,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.Color.serializeBinaryToWriter)},proto.mediapipe.ColorMap.prototype.getLabelToColorMap=function(e){return t.Message.getMapField(this,1,e,proto.mediapipe.Color)},proto.mediapipe.ColorMap.prototype.clearLabelToColorMap=function(){return this.getLabelToColorMap().clear(),this},r.object.extend(e,proto.mediapipe)}(color_pb);var render_data_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=color_pb;r.object.extend(proto,i),r.exportSymbol("proto.mediapipe.RenderAnnotation",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.Arrow",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.DataCase",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.FilledOval",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.FilledRectangle",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.FilledRoundedRectangle",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.GradientLine",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.Line",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.Line.LineType",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.Oval",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.Point",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.Rectangle",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.RoundedRectangle",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.Scribble",null,o),r.exportSymbol("proto.mediapipe.RenderAnnotation.Text",null,o),r.exportSymbol("proto.mediapipe.RenderData",null,o),r.exportSymbol("proto.mediapipe.RenderViewport",null,o),proto.mediapipe.RenderData=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.RenderData.repeatedFields_,null)},r.inherits(proto.mediapipe.RenderData,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderData.displayName="proto.mediapipe.RenderData"),proto.mediapipe.RenderAnnotation=function(e){t.Message.initialize(this,e,0,-1,null,proto.mediapipe.RenderAnnotation.oneofGroups_)},r.inherits(proto.mediapipe.RenderAnnotation,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.displayName="proto.mediapipe.RenderAnnotation"),proto.mediapipe.RenderAnnotation.Rectangle=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.RenderAnnotation.Rectangle,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.Rectangle.displayName="proto.mediapipe.RenderAnnotation.Rectangle"),proto.mediapipe.RenderAnnotation.FilledRectangle=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.RenderAnnotation.FilledRectangle,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.FilledRectangle.displayName="proto.mediapipe.RenderAnnotation.FilledRectangle"),proto.mediapipe.RenderAnnotation.RoundedRectangle=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.RenderAnnotation.RoundedRectangle,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.RoundedRectangle.displayName="proto.mediapipe.RenderAnnotation.RoundedRectangle"),proto.mediapipe.RenderAnnotation.FilledRoundedRectangle=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.RenderAnnotation.FilledRoundedRectangle,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.displayName="proto.mediapipe.RenderAnnotation.FilledRoundedRectangle"),proto.mediapipe.RenderAnnotation.Oval=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.RenderAnnotation.Oval,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.Oval.displayName="proto.mediapipe.RenderAnnotation.Oval"),proto.mediapipe.RenderAnnotation.FilledOval=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.RenderAnnotation.FilledOval,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.FilledOval.displayName="proto.mediapipe.RenderAnnotation.FilledOval"),proto.mediapipe.RenderAnnotation.Point=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.RenderAnnotation.Point,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.Point.displayName="proto.mediapipe.RenderAnnotation.Point"),proto.mediapipe.RenderAnnotation.Line=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.RenderAnnotation.Line,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.Line.displayName="proto.mediapipe.RenderAnnotation.Line"),proto.mediapipe.RenderAnnotation.GradientLine=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.RenderAnnotation.GradientLine,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.GradientLine.displayName="proto.mediapipe.RenderAnnotation.GradientLine"),proto.mediapipe.RenderAnnotation.Scribble=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.RenderAnnotation.Scribble.repeatedFields_,null)},r.inherits(proto.mediapipe.RenderAnnotation.Scribble,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.Scribble.displayName="proto.mediapipe.RenderAnnotation.Scribble"),proto.mediapipe.RenderAnnotation.Arrow=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.RenderAnnotation.Arrow,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.Arrow.displayName="proto.mediapipe.RenderAnnotation.Arrow"),proto.mediapipe.RenderAnnotation.Text=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.RenderAnnotation.Text,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderAnnotation.Text.displayName="proto.mediapipe.RenderAnnotation.Text"),proto.mediapipe.RenderViewport=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.RenderViewport,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.RenderViewport.displayName="proto.mediapipe.RenderViewport"),proto.mediapipe.RenderData.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderData.prototype.toObject=function(e){return proto.mediapipe.RenderData.toObject(e,this)},proto.mediapipe.RenderData.toObject=function(e,r){var o,i={renderAnnotationsList:t.Message.toObjectList(r.getRenderAnnotationsList(),proto.mediapipe.RenderAnnotation.toObject,e),sceneClass:null==(o=t.Message.getField(r,2))?void 0:o,sceneViewport:(o=r.getSceneViewport())&&proto.mediapipe.RenderViewport.toObject(e,o)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.RenderData.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderData;return proto.mediapipe.RenderData.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderData.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new proto.mediapipe.RenderAnnotation;t.readMessage(r,proto.mediapipe.RenderAnnotation.deserializeBinaryFromReader),e.addRenderAnnotations(r);break;case 2:r=t.readString();e.setSceneClass(r);break;case 3:r=new proto.mediapipe.RenderViewport;t.readMessage(r,proto.mediapipe.RenderViewport.deserializeBinaryFromReader),e.setSceneViewport(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderData.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderData.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderData.serializeBinaryToWriter=function(e,r){var o=void 0;(o=e.getRenderAnnotationsList()).length>0&&r.writeRepeatedMessage(1,o,proto.mediapipe.RenderAnnotation.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeString(2,o),null!=(o=e.getSceneViewport())&&r.writeMessage(3,o,proto.mediapipe.RenderViewport.serializeBinaryToWriter)},proto.mediapipe.RenderData.prototype.getRenderAnnotationsList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.RenderAnnotation,1)},proto.mediapipe.RenderData.prototype.setRenderAnnotationsList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.RenderData.prototype.addRenderAnnotations=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.RenderAnnotation,r)},proto.mediapipe.RenderData.prototype.clearRenderAnnotationsList=function(){return this.setRenderAnnotationsList([])},proto.mediapipe.RenderData.prototype.getSceneClass=function(){return t.Message.getFieldWithDefault(this,2,"")},proto.mediapipe.RenderData.prototype.setSceneClass=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.RenderData.prototype.clearSceneClass=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.RenderData.prototype.hasSceneClass=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.RenderData.prototype.getSceneViewport=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderViewport,3)},proto.mediapipe.RenderData.prototype.setSceneViewport=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.RenderData.prototype.clearSceneViewport=function(){return this.setSceneViewport(void 0)},proto.mediapipe.RenderData.prototype.hasSceneViewport=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.RenderAnnotation.oneofGroups_=[[1,2,3,4,5,6,7,8,9,10,14,15]],proto.mediapipe.RenderAnnotation.DataCase={DATA_NOT_SET:0,RECTANGLE:1,FILLED_RECTANGLE:2,OVAL:3,FILLED_OVAL:4,POINT:5,LINE:6,ARROW:7,TEXT:8,ROUNDED_RECTANGLE:9,FILLED_ROUNDED_RECTANGLE:10,GRADIENT_LINE:14,SCRIBBLE:15},proto.mediapipe.RenderAnnotation.prototype.getDataCase=function(){return t.Message.computeOneofCase(this,proto.mediapipe.RenderAnnotation.oneofGroups_[0])},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.toObject(e,this)},proto.mediapipe.RenderAnnotation.toObject=function(e,r){var o,a={rectangle:(o=r.getRectangle())&&proto.mediapipe.RenderAnnotation.Rectangle.toObject(e,o),filledRectangle:(o=r.getFilledRectangle())&&proto.mediapipe.RenderAnnotation.FilledRectangle.toObject(e,o),oval:(o=r.getOval())&&proto.mediapipe.RenderAnnotation.Oval.toObject(e,o),filledOval:(o=r.getFilledOval())&&proto.mediapipe.RenderAnnotation.FilledOval.toObject(e,o),point:(o=r.getPoint())&&proto.mediapipe.RenderAnnotation.Point.toObject(e,o),line:(o=r.getLine())&&proto.mediapipe.RenderAnnotation.Line.toObject(e,o),arrow:(o=r.getArrow())&&proto.mediapipe.RenderAnnotation.Arrow.toObject(e,o),text:(o=r.getText())&&proto.mediapipe.RenderAnnotation.Text.toObject(e,o),roundedRectangle:(o=r.getRoundedRectangle())&&proto.mediapipe.RenderAnnotation.RoundedRectangle.toObject(e,o),filledRoundedRectangle:(o=r.getFilledRoundedRectangle())&&proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.toObject(e,o),gradientLine:(o=r.getGradientLine())&&proto.mediapipe.RenderAnnotation.GradientLine.toObject(e,o),scribble:(o=r.getScribble())&&proto.mediapipe.RenderAnnotation.Scribble.toObject(e,o),thickness:t.Message.getFloatingPointFieldWithDefault(r,11,1),color:(o=r.getColor())&&i.Color.toObject(e,o),sceneTag:null==(o=t.Message.getField(r,13))?void 0:o};return e&&(a.$jspbMessageInstance=r),a}),proto.mediapipe.RenderAnnotation.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation;return proto.mediapipe.RenderAnnotation.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new proto.mediapipe.RenderAnnotation.Rectangle;t.readMessage(r,proto.mediapipe.RenderAnnotation.Rectangle.deserializeBinaryFromReader),e.setRectangle(r);break;case 2:r=new proto.mediapipe.RenderAnnotation.FilledRectangle;t.readMessage(r,proto.mediapipe.RenderAnnotation.FilledRectangle.deserializeBinaryFromReader),e.setFilledRectangle(r);break;case 3:r=new proto.mediapipe.RenderAnnotation.Oval;t.readMessage(r,proto.mediapipe.RenderAnnotation.Oval.deserializeBinaryFromReader),e.setOval(r);break;case 4:r=new proto.mediapipe.RenderAnnotation.FilledOval;t.readMessage(r,proto.mediapipe.RenderAnnotation.FilledOval.deserializeBinaryFromReader),e.setFilledOval(r);break;case 5:r=new proto.mediapipe.RenderAnnotation.Point;t.readMessage(r,proto.mediapipe.RenderAnnotation.Point.deserializeBinaryFromReader),e.setPoint(r);break;case 6:r=new proto.mediapipe.RenderAnnotation.Line;t.readMessage(r,proto.mediapipe.RenderAnnotation.Line.deserializeBinaryFromReader),e.setLine(r);break;case 7:r=new proto.mediapipe.RenderAnnotation.Arrow;t.readMessage(r,proto.mediapipe.RenderAnnotation.Arrow.deserializeBinaryFromReader),e.setArrow(r);break;case 8:r=new proto.mediapipe.RenderAnnotation.Text;t.readMessage(r,proto.mediapipe.RenderAnnotation.Text.deserializeBinaryFromReader),e.setText(r);break;case 9:r=new proto.mediapipe.RenderAnnotation.RoundedRectangle;t.readMessage(r,proto.mediapipe.RenderAnnotation.RoundedRectangle.deserializeBinaryFromReader),e.setRoundedRectangle(r);break;case 10:r=new proto.mediapipe.RenderAnnotation.FilledRoundedRectangle;t.readMessage(r,proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.deserializeBinaryFromReader),e.setFilledRoundedRectangle(r);break;case 14:r=new proto.mediapipe.RenderAnnotation.GradientLine;t.readMessage(r,proto.mediapipe.RenderAnnotation.GradientLine.deserializeBinaryFromReader),e.setGradientLine(r);break;case 15:r=new proto.mediapipe.RenderAnnotation.Scribble;t.readMessage(r,proto.mediapipe.RenderAnnotation.Scribble.deserializeBinaryFromReader),e.setScribble(r);break;case 11:r=t.readDouble();e.setThickness(r);break;case 12:r=new i.Color;t.readMessage(r,i.Color.deserializeBinaryFromReader),e.setColor(r);break;case 13:r=t.readString();e.setSceneTag(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderAnnotation.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getRectangle())&&r.writeMessage(1,o,proto.mediapipe.RenderAnnotation.Rectangle.serializeBinaryToWriter),null!=(o=e.getFilledRectangle())&&r.writeMessage(2,o,proto.mediapipe.RenderAnnotation.FilledRectangle.serializeBinaryToWriter),null!=(o=e.getOval())&&r.writeMessage(3,o,proto.mediapipe.RenderAnnotation.Oval.serializeBinaryToWriter),null!=(o=e.getFilledOval())&&r.writeMessage(4,o,proto.mediapipe.RenderAnnotation.FilledOval.serializeBinaryToWriter),null!=(o=e.getPoint())&&r.writeMessage(5,o,proto.mediapipe.RenderAnnotation.Point.serializeBinaryToWriter),null!=(o=e.getLine())&&r.writeMessage(6,o,proto.mediapipe.RenderAnnotation.Line.serializeBinaryToWriter),null!=(o=e.getArrow())&&r.writeMessage(7,o,proto.mediapipe.RenderAnnotation.Arrow.serializeBinaryToWriter),null!=(o=e.getText())&&r.writeMessage(8,o,proto.mediapipe.RenderAnnotation.Text.serializeBinaryToWriter),null!=(o=e.getRoundedRectangle())&&r.writeMessage(9,o,proto.mediapipe.RenderAnnotation.RoundedRectangle.serializeBinaryToWriter),null!=(o=e.getFilledRoundedRectangle())&&r.writeMessage(10,o,proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.serializeBinaryToWriter),null!=(o=e.getGradientLine())&&r.writeMessage(14,o,proto.mediapipe.RenderAnnotation.GradientLine.serializeBinaryToWriter),null!=(o=e.getScribble())&&r.writeMessage(15,o,proto.mediapipe.RenderAnnotation.Scribble.serializeBinaryToWriter),null!=(o=t.Message.getField(e,11))&&r.writeDouble(11,o),null!=(o=e.getColor())&&r.writeMessage(12,o,i.Color.serializeBinaryToWriter),null!=(o=t.Message.getField(e,13))&&r.writeString(13,o)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.Rectangle.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.Rectangle.toObject(e,this)},proto.mediapipe.RenderAnnotation.Rectangle.toObject=function(e,r){var o,i={left:null==(o=t.Message.getOptionalFloatingPointField(r,1))?void 0:o,top:null==(o=t.Message.getOptionalFloatingPointField(r,2))?void 0:o,right:null==(o=t.Message.getOptionalFloatingPointField(r,3))?void 0:o,bottom:null==(o=t.Message.getOptionalFloatingPointField(r,4))?void 0:o,normalized:t.Message.getBooleanFieldWithDefault(r,5,!1),rotation:null==(o=t.Message.getOptionalFloatingPointField(r,6))?void 0:o,topLeftThickness:null==(o=t.Message.getOptionalFloatingPointField(r,7))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.RenderAnnotation.Rectangle.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation.Rectangle;return proto.mediapipe.RenderAnnotation.Rectangle.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.Rectangle.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readDouble();e.setLeft(r);break;case 2:r=t.readDouble();e.setTop(r);break;case 3:r=t.readDouble();e.setRight(r);break;case 4:r=t.readDouble();e.setBottom(r);break;case 5:r=t.readBool();e.setNormalized(r);break;case 6:r=t.readDouble();e.setRotation(r);break;case 7:r=t.readDouble();e.setTopLeftThickness(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderAnnotation.Rectangle.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.Rectangle.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.Rectangle.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeDouble(1,o),null!=(o=t.Message.getField(e,2))&&r.writeDouble(2,o),null!=(o=t.Message.getField(e,3))&&r.writeDouble(3,o),null!=(o=t.Message.getField(e,4))&&r.writeDouble(4,o),null!=(o=t.Message.getField(e,5))&&r.writeBool(5,o),null!=(o=t.Message.getField(e,6))&&r.writeDouble(6,o),null!=(o=t.Message.getField(e,7))&&r.writeDouble(7,o)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.getLeft=function(){return t.Message.getFloatingPointFieldWithDefault(this,1,0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.setLeft=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.clearLeft=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.hasLeft=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.getTop=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.setTop=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.clearTop=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.hasTop=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.getRight=function(){return t.Message.getFloatingPointFieldWithDefault(this,3,0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.setRight=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.clearRight=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.hasRight=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.getBottom=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.setBottom=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.clearBottom=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.hasBottom=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.getNormalized=function(){return t.Message.getBooleanFieldWithDefault(this,5,!1)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.setNormalized=function(e){return t.Message.setField(this,5,e)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.clearNormalized=function(){return t.Message.setField(this,5,void 0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.hasNormalized=function(){return null!=t.Message.getField(this,5)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.getRotation=function(){return t.Message.getFloatingPointFieldWithDefault(this,6,0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.setRotation=function(e){return t.Message.setField(this,6,e)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.clearRotation=function(){return t.Message.setField(this,6,void 0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.hasRotation=function(){return null!=t.Message.getField(this,6)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.getTopLeftThickness=function(){return t.Message.getFloatingPointFieldWithDefault(this,7,0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.setTopLeftThickness=function(e){return t.Message.setField(this,7,e)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.clearTopLeftThickness=function(){return t.Message.setField(this,7,void 0)},proto.mediapipe.RenderAnnotation.Rectangle.prototype.hasTopLeftThickness=function(){return null!=t.Message.getField(this,7)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.FilledRectangle.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.FilledRectangle.toObject(e,this)},proto.mediapipe.RenderAnnotation.FilledRectangle.toObject=function(e,t){var r,o={rectangle:(r=t.getRectangle())&&proto.mediapipe.RenderAnnotation.Rectangle.toObject(e,r),fillColor:(r=t.getFillColor())&&i.Color.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.RenderAnnotation.FilledRectangle.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation.FilledRectangle;return proto.mediapipe.RenderAnnotation.FilledRectangle.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.FilledRectangle.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new proto.mediapipe.RenderAnnotation.Rectangle;t.readMessage(r,proto.mediapipe.RenderAnnotation.Rectangle.deserializeBinaryFromReader),e.setRectangle(r);break;case 2:r=new i.Color;t.readMessage(r,i.Color.deserializeBinaryFromReader),e.setFillColor(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderAnnotation.FilledRectangle.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.FilledRectangle.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.FilledRectangle.serializeBinaryToWriter=function(e,t){var r=void 0;null!=(r=e.getRectangle())&&t.writeMessage(1,r,proto.mediapipe.RenderAnnotation.Rectangle.serializeBinaryToWriter),null!=(r=e.getFillColor())&&t.writeMessage(2,r,i.Color.serializeBinaryToWriter)},proto.mediapipe.RenderAnnotation.FilledRectangle.prototype.getRectangle=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.Rectangle,1)},proto.mediapipe.RenderAnnotation.FilledRectangle.prototype.setRectangle=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.RenderAnnotation.FilledRectangle.prototype.clearRectangle=function(){return this.setRectangle(void 0)},proto.mediapipe.RenderAnnotation.FilledRectangle.prototype.hasRectangle=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.RenderAnnotation.FilledRectangle.prototype.getFillColor=function(){return t.Message.getWrapperField(this,i.Color,2)},proto.mediapipe.RenderAnnotation.FilledRectangle.prototype.setFillColor=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.RenderAnnotation.FilledRectangle.prototype.clearFillColor=function(){return this.setFillColor(void 0)},proto.mediapipe.RenderAnnotation.FilledRectangle.prototype.hasFillColor=function(){return null!=t.Message.getField(this,2)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.RoundedRectangle.toObject(e,this)},proto.mediapipe.RenderAnnotation.RoundedRectangle.toObject=function(e,r){var o,i={rectangle:(o=r.getRectangle())&&proto.mediapipe.RenderAnnotation.Rectangle.toObject(e,o),cornerRadius:t.Message.getFieldWithDefault(r,2,0),lineType:t.Message.getFieldWithDefault(r,3,4)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.RenderAnnotation.RoundedRectangle.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation.RoundedRectangle;return proto.mediapipe.RenderAnnotation.RoundedRectangle.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.RoundedRectangle.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new proto.mediapipe.RenderAnnotation.Rectangle;t.readMessage(r,proto.mediapipe.RenderAnnotation.Rectangle.deserializeBinaryFromReader),e.setRectangle(r);break;case 2:r=t.readInt32();e.setCornerRadius(r);break;case 3:r=t.readInt32();e.setLineType(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.RoundedRectangle.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.RoundedRectangle.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getRectangle())&&r.writeMessage(1,o,proto.mediapipe.RenderAnnotation.Rectangle.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeInt32(2,o),null!=(o=t.Message.getField(e,3))&&r.writeInt32(3,o)},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.getRectangle=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.Rectangle,1)},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.setRectangle=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.clearRectangle=function(){return this.setRectangle(void 0)},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.hasRectangle=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.getCornerRadius=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.setCornerRadius=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.clearCornerRadius=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.hasCornerRadius=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.getLineType=function(){return t.Message.getFieldWithDefault(this,3,4)},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.setLineType=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.clearLineType=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.RenderAnnotation.RoundedRectangle.prototype.hasLineType=function(){return null!=t.Message.getField(this,3)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.toObject(e,this)},proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.toObject=function(e,t){var r,o={roundedRectangle:(r=t.getRoundedRectangle())&&proto.mediapipe.RenderAnnotation.RoundedRectangle.toObject(e,r),fillColor:(r=t.getFillColor())&&i.Color.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation.FilledRoundedRectangle;return proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new proto.mediapipe.RenderAnnotation.RoundedRectangle;t.readMessage(r,proto.mediapipe.RenderAnnotation.RoundedRectangle.deserializeBinaryFromReader),e.setRoundedRectangle(r);break;case 2:r=new i.Color;t.readMessage(r,i.Color.deserializeBinaryFromReader),e.setFillColor(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.serializeBinaryToWriter=function(e,t){var r=void 0;null!=(r=e.getRoundedRectangle())&&t.writeMessage(1,r,proto.mediapipe.RenderAnnotation.RoundedRectangle.serializeBinaryToWriter),null!=(r=e.getFillColor())&&t.writeMessage(2,r,i.Color.serializeBinaryToWriter)},proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.prototype.getRoundedRectangle=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.RoundedRectangle,1)},proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.prototype.setRoundedRectangle=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.prototype.clearRoundedRectangle=function(){return this.setRoundedRectangle(void 0)},proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.prototype.hasRoundedRectangle=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.prototype.getFillColor=function(){return t.Message.getWrapperField(this,i.Color,2)},proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.prototype.setFillColor=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.prototype.clearFillColor=function(){return this.setFillColor(void 0)},proto.mediapipe.RenderAnnotation.FilledRoundedRectangle.prototype.hasFillColor=function(){return null!=t.Message.getField(this,2)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.Oval.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.Oval.toObject(e,this)},proto.mediapipe.RenderAnnotation.Oval.toObject=function(e,t){var r,o={rectangle:(r=t.getRectangle())&&proto.mediapipe.RenderAnnotation.Rectangle.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.RenderAnnotation.Oval.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation.Oval;return proto.mediapipe.RenderAnnotation.Oval.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.Oval.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new proto.mediapipe.RenderAnnotation.Rectangle;t.readMessage(r,proto.mediapipe.RenderAnnotation.Rectangle.deserializeBinaryFromReader),e.setRectangle(r)}else t.skipField()}return e},proto.mediapipe.RenderAnnotation.Oval.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.Oval.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.Oval.serializeBinaryToWriter=function(e,t){var r;null!=(r=e.getRectangle())&&t.writeMessage(1,r,proto.mediapipe.RenderAnnotation.Rectangle.serializeBinaryToWriter)},proto.mediapipe.RenderAnnotation.Oval.prototype.getRectangle=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.Rectangle,1)},proto.mediapipe.RenderAnnotation.Oval.prototype.setRectangle=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.RenderAnnotation.Oval.prototype.clearRectangle=function(){return this.setRectangle(void 0)},proto.mediapipe.RenderAnnotation.Oval.prototype.hasRectangle=function(){return null!=t.Message.getField(this,1)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.FilledOval.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.FilledOval.toObject(e,this)},proto.mediapipe.RenderAnnotation.FilledOval.toObject=function(e,t){var r,o={oval:(r=t.getOval())&&proto.mediapipe.RenderAnnotation.Oval.toObject(e,r),fillColor:(r=t.getFillColor())&&i.Color.toObject(e,r)};return e&&(o.$jspbMessageInstance=t),o}),proto.mediapipe.RenderAnnotation.FilledOval.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation.FilledOval;return proto.mediapipe.RenderAnnotation.FilledOval.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.FilledOval.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new proto.mediapipe.RenderAnnotation.Oval;t.readMessage(r,proto.mediapipe.RenderAnnotation.Oval.deserializeBinaryFromReader),e.setOval(r);break;case 2:r=new i.Color;t.readMessage(r,i.Color.deserializeBinaryFromReader),e.setFillColor(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderAnnotation.FilledOval.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.FilledOval.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.FilledOval.serializeBinaryToWriter=function(e,t){var r=void 0;null!=(r=e.getOval())&&t.writeMessage(1,r,proto.mediapipe.RenderAnnotation.Oval.serializeBinaryToWriter),null!=(r=e.getFillColor())&&t.writeMessage(2,r,i.Color.serializeBinaryToWriter)},proto.mediapipe.RenderAnnotation.FilledOval.prototype.getOval=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.Oval,1)},proto.mediapipe.RenderAnnotation.FilledOval.prototype.setOval=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.RenderAnnotation.FilledOval.prototype.clearOval=function(){return this.setOval(void 0)},proto.mediapipe.RenderAnnotation.FilledOval.prototype.hasOval=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.RenderAnnotation.FilledOval.prototype.getFillColor=function(){return t.Message.getWrapperField(this,i.Color,2)},proto.mediapipe.RenderAnnotation.FilledOval.prototype.setFillColor=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.RenderAnnotation.FilledOval.prototype.clearFillColor=function(){return this.setFillColor(void 0)},proto.mediapipe.RenderAnnotation.FilledOval.prototype.hasFillColor=function(){return null!=t.Message.getField(this,2)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.Point.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.Point.toObject(e,this)},proto.mediapipe.RenderAnnotation.Point.toObject=function(e,r){var o,i={x:null==(o=t.Message.getOptionalFloatingPointField(r,1))?void 0:o,y:null==(o=t.Message.getOptionalFloatingPointField(r,2))?void 0:o,normalized:t.Message.getBooleanFieldWithDefault(r,3,!1)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.RenderAnnotation.Point.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation.Point;return proto.mediapipe.RenderAnnotation.Point.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.Point.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readDouble();e.setX(r);break;case 2:r=t.readDouble();e.setY(r);break;case 3:r=t.readBool();e.setNormalized(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderAnnotation.Point.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.Point.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.Point.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeDouble(1,o),null!=(o=t.Message.getField(e,2))&&r.writeDouble(2,o),null!=(o=t.Message.getField(e,3))&&r.writeBool(3,o)},proto.mediapipe.RenderAnnotation.Point.prototype.getX=function(){return t.Message.getFloatingPointFieldWithDefault(this,1,0)},proto.mediapipe.RenderAnnotation.Point.prototype.setX=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.RenderAnnotation.Point.prototype.clearX=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.RenderAnnotation.Point.prototype.hasX=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.RenderAnnotation.Point.prototype.getY=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,0)},proto.mediapipe.RenderAnnotation.Point.prototype.setY=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.RenderAnnotation.Point.prototype.clearY=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.RenderAnnotation.Point.prototype.hasY=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.RenderAnnotation.Point.prototype.getNormalized=function(){return t.Message.getBooleanFieldWithDefault(this,3,!1)},proto.mediapipe.RenderAnnotation.Point.prototype.setNormalized=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.RenderAnnotation.Point.prototype.clearNormalized=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.RenderAnnotation.Point.prototype.hasNormalized=function(){return null!=t.Message.getField(this,3)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.Line.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.Line.toObject(e,this)},proto.mediapipe.RenderAnnotation.Line.toObject=function(e,r){var o,i={xStart:null==(o=t.Message.getOptionalFloatingPointField(r,1))?void 0:o,yStart:null==(o=t.Message.getOptionalFloatingPointField(r,2))?void 0:o,xEnd:null==(o=t.Message.getOptionalFloatingPointField(r,3))?void 0:o,yEnd:null==(o=t.Message.getOptionalFloatingPointField(r,4))?void 0:o,normalized:t.Message.getBooleanFieldWithDefault(r,5,!1),lineType:t.Message.getFieldWithDefault(r,6,1)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.RenderAnnotation.Line.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation.Line;return proto.mediapipe.RenderAnnotation.Line.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.Line.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readDouble();e.setXStart(r);break;case 2:r=t.readDouble();e.setYStart(r);break;case 3:r=t.readDouble();e.setXEnd(r);break;case 4:r=t.readDouble();e.setYEnd(r);break;case 5:r=t.readBool();e.setNormalized(r);break;case 6:r=t.readEnum();e.setLineType(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderAnnotation.Line.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.Line.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.Line.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeDouble(1,o),null!=(o=t.Message.getField(e,2))&&r.writeDouble(2,o),null!=(o=t.Message.getField(e,3))&&r.writeDouble(3,o),null!=(o=t.Message.getField(e,4))&&r.writeDouble(4,o),null!=(o=t.Message.getField(e,5))&&r.writeBool(5,o),null!=(o=t.Message.getField(e,6))&&r.writeEnum(6,o)},proto.mediapipe.RenderAnnotation.Line.LineType={UNKNOWN:0,SOLID:1,DASHED:2},proto.mediapipe.RenderAnnotation.Line.prototype.getXStart=function(){return t.Message.getFloatingPointFieldWithDefault(this,1,0)},proto.mediapipe.RenderAnnotation.Line.prototype.setXStart=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.RenderAnnotation.Line.prototype.clearXStart=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.RenderAnnotation.Line.prototype.hasXStart=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.RenderAnnotation.Line.prototype.getYStart=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,0)},proto.mediapipe.RenderAnnotation.Line.prototype.setYStart=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.RenderAnnotation.Line.prototype.clearYStart=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.RenderAnnotation.Line.prototype.hasYStart=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.RenderAnnotation.Line.prototype.getXEnd=function(){return t.Message.getFloatingPointFieldWithDefault(this,3,0)},proto.mediapipe.RenderAnnotation.Line.prototype.setXEnd=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.RenderAnnotation.Line.prototype.clearXEnd=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.RenderAnnotation.Line.prototype.hasXEnd=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.RenderAnnotation.Line.prototype.getYEnd=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,0)},proto.mediapipe.RenderAnnotation.Line.prototype.setYEnd=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.RenderAnnotation.Line.prototype.clearYEnd=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.RenderAnnotation.Line.prototype.hasYEnd=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.RenderAnnotation.Line.prototype.getNormalized=function(){return t.Message.getBooleanFieldWithDefault(this,5,!1)},proto.mediapipe.RenderAnnotation.Line.prototype.setNormalized=function(e){return t.Message.setField(this,5,e)},proto.mediapipe.RenderAnnotation.Line.prototype.clearNormalized=function(){return t.Message.setField(this,5,void 0)},proto.mediapipe.RenderAnnotation.Line.prototype.hasNormalized=function(){return null!=t.Message.getField(this,5)},proto.mediapipe.RenderAnnotation.Line.prototype.getLineType=function(){return t.Message.getFieldWithDefault(this,6,1)},proto.mediapipe.RenderAnnotation.Line.prototype.setLineType=function(e){return t.Message.setField(this,6,e)},proto.mediapipe.RenderAnnotation.Line.prototype.clearLineType=function(){return t.Message.setField(this,6,void 0)},proto.mediapipe.RenderAnnotation.Line.prototype.hasLineType=function(){return null!=t.Message.getField(this,6)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.GradientLine.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.GradientLine.toObject(e,this)},proto.mediapipe.RenderAnnotation.GradientLine.toObject=function(e,r){var o,a={xStart:null==(o=t.Message.getOptionalFloatingPointField(r,1))?void 0:o,yStart:null==(o=t.Message.getOptionalFloatingPointField(r,2))?void 0:o,xEnd:null==(o=t.Message.getOptionalFloatingPointField(r,3))?void 0:o,yEnd:null==(o=t.Message.getOptionalFloatingPointField(r,4))?void 0:o,normalized:t.Message.getBooleanFieldWithDefault(r,5,!1),color1:(o=r.getColor1())&&i.Color.toObject(e,o),color2:(o=r.getColor2())&&i.Color.toObject(e,o)};return e&&(a.$jspbMessageInstance=r),a}),proto.mediapipe.RenderAnnotation.GradientLine.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation.GradientLine;return proto.mediapipe.RenderAnnotation.GradientLine.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.GradientLine.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readDouble();e.setXStart(r);break;case 2:r=t.readDouble();e.setYStart(r);break;case 3:r=t.readDouble();e.setXEnd(r);break;case 4:r=t.readDouble();e.setYEnd(r);break;case 5:r=t.readBool();e.setNormalized(r);break;case 6:r=new i.Color;t.readMessage(r,i.Color.deserializeBinaryFromReader),e.setColor1(r);break;case 7:r=new i.Color;t.readMessage(r,i.Color.deserializeBinaryFromReader),e.setColor2(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderAnnotation.GradientLine.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.GradientLine.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.GradientLine.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeDouble(1,o),null!=(o=t.Message.getField(e,2))&&r.writeDouble(2,o),null!=(o=t.Message.getField(e,3))&&r.writeDouble(3,o),null!=(o=t.Message.getField(e,4))&&r.writeDouble(4,o),null!=(o=t.Message.getField(e,5))&&r.writeBool(5,o),null!=(o=e.getColor1())&&r.writeMessage(6,o,i.Color.serializeBinaryToWriter),null!=(o=e.getColor2())&&r.writeMessage(7,o,i.Color.serializeBinaryToWriter)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.getXStart=function(){return t.Message.getFloatingPointFieldWithDefault(this,1,0)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.setXStart=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.clearXStart=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.hasXStart=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.getYStart=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,0)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.setYStart=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.clearYStart=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.hasYStart=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.getXEnd=function(){return t.Message.getFloatingPointFieldWithDefault(this,3,0)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.setXEnd=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.clearXEnd=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.hasXEnd=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.getYEnd=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,0)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.setYEnd=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.clearYEnd=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.hasYEnd=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.getNormalized=function(){return t.Message.getBooleanFieldWithDefault(this,5,!1)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.setNormalized=function(e){return t.Message.setField(this,5,e)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.clearNormalized=function(){return t.Message.setField(this,5,void 0)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.hasNormalized=function(){return null!=t.Message.getField(this,5)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.getColor1=function(){return t.Message.getWrapperField(this,i.Color,6)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.setColor1=function(e){return t.Message.setWrapperField(this,6,e)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.clearColor1=function(){return this.setColor1(void 0)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.hasColor1=function(){return null!=t.Message.getField(this,6)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.getColor2=function(){return t.Message.getWrapperField(this,i.Color,7)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.setColor2=function(e){return t.Message.setWrapperField(this,7,e)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.clearColor2=function(){return this.setColor2(void 0)},proto.mediapipe.RenderAnnotation.GradientLine.prototype.hasColor2=function(){return null!=t.Message.getField(this,7)},proto.mediapipe.RenderAnnotation.Scribble.repeatedFields_=[1],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.Scribble.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.Scribble.toObject(e,this)},proto.mediapipe.RenderAnnotation.Scribble.toObject=function(e,r){var o={pointList:t.Message.toObjectList(r.getPointList(),proto.mediapipe.RenderAnnotation.Point.toObject,e)};return e&&(o.$jspbMessageInstance=r),o}),proto.mediapipe.RenderAnnotation.Scribble.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation.Scribble;return proto.mediapipe.RenderAnnotation.Scribble.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.Scribble.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){if(1===t.getFieldNumber()){var r=new proto.mediapipe.RenderAnnotation.Point;t.readMessage(r,proto.mediapipe.RenderAnnotation.Point.deserializeBinaryFromReader),e.addPoint(r)}else t.skipField()}return e},proto.mediapipe.RenderAnnotation.Scribble.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.Scribble.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.Scribble.serializeBinaryToWriter=function(e,t){var r;(r=e.getPointList()).length>0&&t.writeRepeatedMessage(1,r,proto.mediapipe.RenderAnnotation.Point.serializeBinaryToWriter)},proto.mediapipe.RenderAnnotation.Scribble.prototype.getPointList=function(){return t.Message.getRepeatedWrapperField(this,proto.mediapipe.RenderAnnotation.Point,1)},proto.mediapipe.RenderAnnotation.Scribble.prototype.setPointList=function(e){return t.Message.setRepeatedWrapperField(this,1,e)},proto.mediapipe.RenderAnnotation.Scribble.prototype.addPoint=function(e,r){return t.Message.addToRepeatedWrapperField(this,1,e,proto.mediapipe.RenderAnnotation.Point,r)},proto.mediapipe.RenderAnnotation.Scribble.prototype.clearPointList=function(){return this.setPointList([])},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.Arrow.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.Arrow.toObject(e,this)},proto.mediapipe.RenderAnnotation.Arrow.toObject=function(e,r){var o,i={xStart:null==(o=t.Message.getOptionalFloatingPointField(r,1))?void 0:o,yStart:null==(o=t.Message.getOptionalFloatingPointField(r,2))?void 0:o,xEnd:null==(o=t.Message.getOptionalFloatingPointField(r,3))?void 0:o,yEnd:null==(o=t.Message.getOptionalFloatingPointField(r,4))?void 0:o,normalized:t.Message.getBooleanFieldWithDefault(r,5,!1)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.RenderAnnotation.Arrow.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation.Arrow;return proto.mediapipe.RenderAnnotation.Arrow.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.Arrow.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readDouble();e.setXStart(r);break;case 2:r=t.readDouble();e.setYStart(r);break;case 3:r=t.readDouble();e.setXEnd(r);break;case 4:r=t.readDouble();e.setYEnd(r);break;case 5:r=t.readBool();e.setNormalized(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderAnnotation.Arrow.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.Arrow.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.Arrow.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeDouble(1,o),null!=(o=t.Message.getField(e,2))&&r.writeDouble(2,o),null!=(o=t.Message.getField(e,3))&&r.writeDouble(3,o),null!=(o=t.Message.getField(e,4))&&r.writeDouble(4,o),null!=(o=t.Message.getField(e,5))&&r.writeBool(5,o)},proto.mediapipe.RenderAnnotation.Arrow.prototype.getXStart=function(){return t.Message.getFloatingPointFieldWithDefault(this,1,0)},proto.mediapipe.RenderAnnotation.Arrow.prototype.setXStart=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.RenderAnnotation.Arrow.prototype.clearXStart=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.RenderAnnotation.Arrow.prototype.hasXStart=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.RenderAnnotation.Arrow.prototype.getYStart=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,0)},proto.mediapipe.RenderAnnotation.Arrow.prototype.setYStart=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.RenderAnnotation.Arrow.prototype.clearYStart=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.RenderAnnotation.Arrow.prototype.hasYStart=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.RenderAnnotation.Arrow.prototype.getXEnd=function(){return t.Message.getFloatingPointFieldWithDefault(this,3,0)},proto.mediapipe.RenderAnnotation.Arrow.prototype.setXEnd=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.RenderAnnotation.Arrow.prototype.clearXEnd=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.RenderAnnotation.Arrow.prototype.hasXEnd=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.RenderAnnotation.Arrow.prototype.getYEnd=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,0)},proto.mediapipe.RenderAnnotation.Arrow.prototype.setYEnd=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.RenderAnnotation.Arrow.prototype.clearYEnd=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.RenderAnnotation.Arrow.prototype.hasYEnd=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.RenderAnnotation.Arrow.prototype.getNormalized=function(){return t.Message.getBooleanFieldWithDefault(this,5,!1)},proto.mediapipe.RenderAnnotation.Arrow.prototype.setNormalized=function(e){return t.Message.setField(this,5,e)},proto.mediapipe.RenderAnnotation.Arrow.prototype.clearNormalized=function(){return t.Message.setField(this,5,void 0)},proto.mediapipe.RenderAnnotation.Arrow.prototype.hasNormalized=function(){return null!=t.Message.getField(this,5)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderAnnotation.Text.prototype.toObject=function(e){return proto.mediapipe.RenderAnnotation.Text.toObject(e,this)},proto.mediapipe.RenderAnnotation.Text.toObject=function(e,r){var o,a={displayText:null==(o=t.Message.getField(r,1))?void 0:o,left:null==(o=t.Message.getOptionalFloatingPointField(r,2))?void 0:o,baseline:null==(o=t.Message.getOptionalFloatingPointField(r,3))?void 0:o,fontHeight:t.Message.getFloatingPointFieldWithDefault(r,4,8),normalized:t.Message.getBooleanFieldWithDefault(r,5,!1),fontFace:t.Message.getFieldWithDefault(r,6,0),centerHorizontally:t.Message.getBooleanFieldWithDefault(r,7,!1),centerVertically:t.Message.getBooleanFieldWithDefault(r,8,!1),outlineThickness:t.Message.getFloatingPointFieldWithDefault(r,11,0),outlineColor:(o=r.getOutlineColor())&&i.Color.toObject(e,o)};return e&&(a.$jspbMessageInstance=r),a}),proto.mediapipe.RenderAnnotation.Text.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderAnnotation.Text;return proto.mediapipe.RenderAnnotation.Text.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderAnnotation.Text.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setDisplayText(r);break;case 2:r=t.readDouble();e.setLeft(r);break;case 3:r=t.readDouble();e.setBaseline(r);break;case 4:r=t.readDouble();e.setFontHeight(r);break;case 5:r=t.readBool();e.setNormalized(r);break;case 6:r=t.readInt32();e.setFontFace(r);break;case 7:r=t.readBool();e.setCenterHorizontally(r);break;case 8:r=t.readBool();e.setCenterVertically(r);break;case 11:r=t.readDouble();e.setOutlineThickness(r);break;case 12:r=new i.Color;t.readMessage(r,i.Color.deserializeBinaryFromReader),e.setOutlineColor(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderAnnotation.Text.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderAnnotation.Text.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderAnnotation.Text.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeString(1,o),null!=(o=t.Message.getField(e,2))&&r.writeDouble(2,o),null!=(o=t.Message.getField(e,3))&&r.writeDouble(3,o),null!=(o=t.Message.getField(e,4))&&r.writeDouble(4,o),null!=(o=t.Message.getField(e,5))&&r.writeBool(5,o),null!=(o=t.Message.getField(e,6))&&r.writeInt32(6,o),null!=(o=t.Message.getField(e,7))&&r.writeBool(7,o),null!=(o=t.Message.getField(e,8))&&r.writeBool(8,o),null!=(o=t.Message.getField(e,11))&&r.writeDouble(11,o),null!=(o=e.getOutlineColor())&&r.writeMessage(12,o,i.Color.serializeBinaryToWriter)},proto.mediapipe.RenderAnnotation.Text.prototype.getDisplayText=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.RenderAnnotation.Text.prototype.setDisplayText=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.RenderAnnotation.Text.prototype.clearDisplayText=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.RenderAnnotation.Text.prototype.hasDisplayText=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.RenderAnnotation.Text.prototype.getLeft=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,0)},proto.mediapipe.RenderAnnotation.Text.prototype.setLeft=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.RenderAnnotation.Text.prototype.clearLeft=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.RenderAnnotation.Text.prototype.hasLeft=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.RenderAnnotation.Text.prototype.getBaseline=function(){return t.Message.getFloatingPointFieldWithDefault(this,3,0)},proto.mediapipe.RenderAnnotation.Text.prototype.setBaseline=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.RenderAnnotation.Text.prototype.clearBaseline=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.RenderAnnotation.Text.prototype.hasBaseline=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.RenderAnnotation.Text.prototype.getFontHeight=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,8)},proto.mediapipe.RenderAnnotation.Text.prototype.setFontHeight=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.RenderAnnotation.Text.prototype.clearFontHeight=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.RenderAnnotation.Text.prototype.hasFontHeight=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.RenderAnnotation.Text.prototype.getNormalized=function(){return t.Message.getBooleanFieldWithDefault(this,5,!1)},proto.mediapipe.RenderAnnotation.Text.prototype.setNormalized=function(e){return t.Message.setField(this,5,e)},proto.mediapipe.RenderAnnotation.Text.prototype.clearNormalized=function(){return t.Message.setField(this,5,void 0)},proto.mediapipe.RenderAnnotation.Text.prototype.hasNormalized=function(){return null!=t.Message.getField(this,5)},proto.mediapipe.RenderAnnotation.Text.prototype.getFontFace=function(){return t.Message.getFieldWithDefault(this,6,0)},proto.mediapipe.RenderAnnotation.Text.prototype.setFontFace=function(e){return t.Message.setField(this,6,e)},proto.mediapipe.RenderAnnotation.Text.prototype.clearFontFace=function(){return t.Message.setField(this,6,void 0)},proto.mediapipe.RenderAnnotation.Text.prototype.hasFontFace=function(){return null!=t.Message.getField(this,6)},proto.mediapipe.RenderAnnotation.Text.prototype.getCenterHorizontally=function(){return t.Message.getBooleanFieldWithDefault(this,7,!1)},proto.mediapipe.RenderAnnotation.Text.prototype.setCenterHorizontally=function(e){return t.Message.setField(this,7,e)},proto.mediapipe.RenderAnnotation.Text.prototype.clearCenterHorizontally=function(){return t.Message.setField(this,7,void 0)},proto.mediapipe.RenderAnnotation.Text.prototype.hasCenterHorizontally=function(){return null!=t.Message.getField(this,7)},proto.mediapipe.RenderAnnotation.Text.prototype.getCenterVertically=function(){return t.Message.getBooleanFieldWithDefault(this,8,!1)},proto.mediapipe.RenderAnnotation.Text.prototype.setCenterVertically=function(e){return t.Message.setField(this,8,e)},proto.mediapipe.RenderAnnotation.Text.prototype.clearCenterVertically=function(){return t.Message.setField(this,8,void 0)},proto.mediapipe.RenderAnnotation.Text.prototype.hasCenterVertically=function(){return null!=t.Message.getField(this,8)},proto.mediapipe.RenderAnnotation.Text.prototype.getOutlineThickness=function(){return t.Message.getFloatingPointFieldWithDefault(this,11,0)},proto.mediapipe.RenderAnnotation.Text.prototype.setOutlineThickness=function(e){return t.Message.setField(this,11,e)},proto.mediapipe.RenderAnnotation.Text.prototype.clearOutlineThickness=function(){return t.Message.setField(this,11,void 0)},proto.mediapipe.RenderAnnotation.Text.prototype.hasOutlineThickness=function(){return null!=t.Message.getField(this,11)},proto.mediapipe.RenderAnnotation.Text.prototype.getOutlineColor=function(){return t.Message.getWrapperField(this,i.Color,12)},proto.mediapipe.RenderAnnotation.Text.prototype.setOutlineColor=function(e){return t.Message.setWrapperField(this,12,e)},proto.mediapipe.RenderAnnotation.Text.prototype.clearOutlineColor=function(){return this.setOutlineColor(void 0)},proto.mediapipe.RenderAnnotation.Text.prototype.hasOutlineColor=function(){return null!=t.Message.getField(this,12)},proto.mediapipe.RenderAnnotation.prototype.getRectangle=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.Rectangle,1)},proto.mediapipe.RenderAnnotation.prototype.setRectangle=function(e){return t.Message.setOneofWrapperField(this,1,proto.mediapipe.RenderAnnotation.oneofGroups_[0],e)},proto.mediapipe.RenderAnnotation.prototype.clearRectangle=function(){return this.setRectangle(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasRectangle=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.RenderAnnotation.prototype.getFilledRectangle=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.FilledRectangle,2)},proto.mediapipe.RenderAnnotation.prototype.setFilledRectangle=function(e){return t.Message.setOneofWrapperField(this,2,proto.mediapipe.RenderAnnotation.oneofGroups_[0],e)},proto.mediapipe.RenderAnnotation.prototype.clearFilledRectangle=function(){return this.setFilledRectangle(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasFilledRectangle=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.RenderAnnotation.prototype.getOval=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.Oval,3)},proto.mediapipe.RenderAnnotation.prototype.setOval=function(e){return t.Message.setOneofWrapperField(this,3,proto.mediapipe.RenderAnnotation.oneofGroups_[0],e)},proto.mediapipe.RenderAnnotation.prototype.clearOval=function(){return this.setOval(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasOval=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.RenderAnnotation.prototype.getFilledOval=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.FilledOval,4)},proto.mediapipe.RenderAnnotation.prototype.setFilledOval=function(e){return t.Message.setOneofWrapperField(this,4,proto.mediapipe.RenderAnnotation.oneofGroups_[0],e)},proto.mediapipe.RenderAnnotation.prototype.clearFilledOval=function(){return this.setFilledOval(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasFilledOval=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.RenderAnnotation.prototype.getPoint=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.Point,5)},proto.mediapipe.RenderAnnotation.prototype.setPoint=function(e){return t.Message.setOneofWrapperField(this,5,proto.mediapipe.RenderAnnotation.oneofGroups_[0],e)},proto.mediapipe.RenderAnnotation.prototype.clearPoint=function(){return this.setPoint(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasPoint=function(){return null!=t.Message.getField(this,5)},proto.mediapipe.RenderAnnotation.prototype.getLine=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.Line,6)},proto.mediapipe.RenderAnnotation.prototype.setLine=function(e){return t.Message.setOneofWrapperField(this,6,proto.mediapipe.RenderAnnotation.oneofGroups_[0],e)},proto.mediapipe.RenderAnnotation.prototype.clearLine=function(){return this.setLine(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasLine=function(){return null!=t.Message.getField(this,6)},proto.mediapipe.RenderAnnotation.prototype.getArrow=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.Arrow,7)},proto.mediapipe.RenderAnnotation.prototype.setArrow=function(e){return t.Message.setOneofWrapperField(this,7,proto.mediapipe.RenderAnnotation.oneofGroups_[0],e)},proto.mediapipe.RenderAnnotation.prototype.clearArrow=function(){return this.setArrow(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasArrow=function(){return null!=t.Message.getField(this,7)},proto.mediapipe.RenderAnnotation.prototype.getText=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.Text,8)},proto.mediapipe.RenderAnnotation.prototype.setText=function(e){return t.Message.setOneofWrapperField(this,8,proto.mediapipe.RenderAnnotation.oneofGroups_[0],e)},proto.mediapipe.RenderAnnotation.prototype.clearText=function(){return this.setText(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasText=function(){return null!=t.Message.getField(this,8)},proto.mediapipe.RenderAnnotation.prototype.getRoundedRectangle=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.RoundedRectangle,9)},proto.mediapipe.RenderAnnotation.prototype.setRoundedRectangle=function(e){return t.Message.setOneofWrapperField(this,9,proto.mediapipe.RenderAnnotation.oneofGroups_[0],e)},proto.mediapipe.RenderAnnotation.prototype.clearRoundedRectangle=function(){return this.setRoundedRectangle(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasRoundedRectangle=function(){return null!=t.Message.getField(this,9)},proto.mediapipe.RenderAnnotation.prototype.getFilledRoundedRectangle=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.FilledRoundedRectangle,10)},proto.mediapipe.RenderAnnotation.prototype.setFilledRoundedRectangle=function(e){return t.Message.setOneofWrapperField(this,10,proto.mediapipe.RenderAnnotation.oneofGroups_[0],e)},proto.mediapipe.RenderAnnotation.prototype.clearFilledRoundedRectangle=function(){return this.setFilledRoundedRectangle(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasFilledRoundedRectangle=function(){return null!=t.Message.getField(this,10)},proto.mediapipe.RenderAnnotation.prototype.getGradientLine=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.GradientLine,14)},proto.mediapipe.RenderAnnotation.prototype.setGradientLine=function(e){return t.Message.setOneofWrapperField(this,14,proto.mediapipe.RenderAnnotation.oneofGroups_[0],e)},proto.mediapipe.RenderAnnotation.prototype.clearGradientLine=function(){return this.setGradientLine(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasGradientLine=function(){return null!=t.Message.getField(this,14)},proto.mediapipe.RenderAnnotation.prototype.getScribble=function(){return t.Message.getWrapperField(this,proto.mediapipe.RenderAnnotation.Scribble,15)},proto.mediapipe.RenderAnnotation.prototype.setScribble=function(e){return t.Message.setOneofWrapperField(this,15,proto.mediapipe.RenderAnnotation.oneofGroups_[0],e)},proto.mediapipe.RenderAnnotation.prototype.clearScribble=function(){return this.setScribble(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasScribble=function(){return null!=t.Message.getField(this,15)},proto.mediapipe.RenderAnnotation.prototype.getThickness=function(){return t.Message.getFloatingPointFieldWithDefault(this,11,1)},proto.mediapipe.RenderAnnotation.prototype.setThickness=function(e){return t.Message.setField(this,11,e)},proto.mediapipe.RenderAnnotation.prototype.clearThickness=function(){return t.Message.setField(this,11,void 0)},proto.mediapipe.RenderAnnotation.prototype.hasThickness=function(){return null!=t.Message.getField(this,11)},proto.mediapipe.RenderAnnotation.prototype.getColor=function(){return t.Message.getWrapperField(this,i.Color,12)},proto.mediapipe.RenderAnnotation.prototype.setColor=function(e){return t.Message.setWrapperField(this,12,e)},proto.mediapipe.RenderAnnotation.prototype.clearColor=function(){return this.setColor(void 0)},proto.mediapipe.RenderAnnotation.prototype.hasColor=function(){return null!=t.Message.getField(this,12)},proto.mediapipe.RenderAnnotation.prototype.getSceneTag=function(){return t.Message.getFieldWithDefault(this,13,"")},proto.mediapipe.RenderAnnotation.prototype.setSceneTag=function(e){return t.Message.setField(this,13,e)},proto.mediapipe.RenderAnnotation.prototype.clearSceneTag=function(){return t.Message.setField(this,13,void 0)},proto.mediapipe.RenderAnnotation.prototype.hasSceneTag=function(){return null!=t.Message.getField(this,13)},t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.RenderViewport.prototype.toObject=function(e){return proto.mediapipe.RenderViewport.toObject(e,this)},proto.mediapipe.RenderViewport.toObject=function(e,r){var o,i={id:null==(o=t.Message.getField(r,1))?void 0:o,widthPx:null==(o=t.Message.getField(r,2))?void 0:o,heightPx:null==(o=t.Message.getField(r,3))?void 0:o,composeOnVideo:null==(o=t.Message.getBooleanField(r,4))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.RenderViewport.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.RenderViewport;return proto.mediapipe.RenderViewport.deserializeBinaryFromReader(o,r)},proto.mediapipe.RenderViewport.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=t.readString();e.setId(r);break;case 2:r=t.readInt32();e.setWidthPx(r);break;case 3:r=t.readInt32();e.setHeightPx(r);break;case 4:r=t.readBool();e.setComposeOnVideo(r);break;default:t.skipField()}}return e},proto.mediapipe.RenderViewport.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.RenderViewport.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.RenderViewport.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=t.Message.getField(e,1))&&r.writeString(1,o),null!=(o=t.Message.getField(e,2))&&r.writeInt32(2,o),null!=(o=t.Message.getField(e,3))&&r.writeInt32(3,o),null!=(o=t.Message.getField(e,4))&&r.writeBool(4,o)},proto.mediapipe.RenderViewport.prototype.getId=function(){return t.Message.getFieldWithDefault(this,1,"")},proto.mediapipe.RenderViewport.prototype.setId=function(e){return t.Message.setField(this,1,e)},proto.mediapipe.RenderViewport.prototype.clearId=function(){return t.Message.setField(this,1,void 0)},proto.mediapipe.RenderViewport.prototype.hasId=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.RenderViewport.prototype.getWidthPx=function(){return t.Message.getFieldWithDefault(this,2,0)},proto.mediapipe.RenderViewport.prototype.setWidthPx=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.RenderViewport.prototype.clearWidthPx=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.RenderViewport.prototype.hasWidthPx=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.RenderViewport.prototype.getHeightPx=function(){return t.Message.getFieldWithDefault(this,3,0)},proto.mediapipe.RenderViewport.prototype.setHeightPx=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.RenderViewport.prototype.clearHeightPx=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.RenderViewport.prototype.hasHeightPx=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.RenderViewport.prototype.getComposeOnVideo=function(){return t.Message.getBooleanFieldWithDefault(this,4,!1)},proto.mediapipe.RenderViewport.prototype.setComposeOnVideo=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.RenderViewport.prototype.clearComposeOnVideo=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.RenderViewport.prototype.hasComposeOnVideo=function(){return null!=t.Message.getField(this,4)},r.object.extend(e,proto.mediapipe)}(render_data_pb);var interactive_segmenter_options={};Object.defineProperty(interactive_segmenter_options,"__esModule",{value:!0});var interactive_segmenter_result={};Object.defineProperty(interactive_segmenter_result,"__esModule",{value:!0}),function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,i)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(e,r){for(var o in e)"default"===o||Object.prototype.hasOwnProperty.call(r,o)||t(r,e,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.InteractiveSegmenter=void 0;const o=calculator_pb,i=calculator_options_pb,a=base_options_pb,n=image_segmenter_graph_options_pb,s=segmenter_options_pb,p=vision_task_runner,d=color_pb,l=render_data_pb;r(interactive_segmenter_options,e),r(interactive_segmenter_result,e);const g="image_in",c="norm_rect_in",u="roi_in",m="confidence_masks",f="category_mask";class h extends p.VisionTaskRunner{static createFromOptions(e,t){return p.VisionTaskRunner.createVisionInstance(h,e,t)}static createFromModelBuffer(e,t){return p.VisionTaskRunner.createVisionInstance(h,e,{baseOptions:{modelAssetBuffer:t}})}static createFromModelPath(e,t){return p.VisionTaskRunner.createVisionInstance(h,e,{baseOptions:{modelAssetPath:t}})}constructor(e,t){super(new p.VisionGraphRunner(e,t),g,c,!1),this.result={},this.outputCategoryMask=false,this.outputConfidenceMasks=true,this.options=new n.ImageSegmenterGraphOptions,this.segmenterOptions=new s.SegmenterOptions,this.options.setSegmenterOptions(this.segmenterOptions),this.options.setBaseOptions(new a.BaseOptions)}get baseOptions(){return this.options.getBaseOptions()}set baseOptions(e){this.options.setBaseOptions(e)}setOptions(e){var t,r;return"outputCategoryMask"in e&&(this.outputCategoryMask=null!==(t=e.outputCategoryMask)&&void 0!==t&&t),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=null===(r=e.outputConfidenceMasks)||void 0===r||r),super.applyOptions(e)}segment(e,t,r,o){const i="function"!=typeof r?r:{};if(this.userCallback="function"==typeof r?r:o,this.reset(),this.processRenderData(t,this.getSynctheticTimestamp()),this.processImageData(e,i),!this.userCallback)return this.result}reset(){this.result={}}maybeInvokeCallback(){this.outputConfidenceMasks&&!("confidenceMasks"in this.result)||this.outputCategoryMask&&!("categoryMask"in this.result)||this.userCallback&&(this.userCallback(this.result),this.freeKeepaliveStreams())}refreshGraph(){const e=new o.CalculatorGraphConfig;e.addInputStream(g),e.addInputStream(u),e.addInputStream(c);const t=new i.CalculatorOptions;t.setExtension(n.ImageSegmenterGraphOptions.ext,this.options);const r=new o.CalculatorGraphConfig.Node;r.setCalculator("mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraph"),r.addInputStream("IMAGE:"+g),r.addInputStream("ROI:"+u),r.addInputStream("NORM_RECT:"+c),r.setOptions(t),e.addNode(r),this.addKeepaliveNode(e),this.outputConfidenceMasks&&(e.addOutputStream(m),r.addOutputStream("CONFIDENCE_MASKS:"+m),this.keepStreamAlive(m),this.graphRunner.attachImageVectorListener(m,((e,t)=>{this.result.confidenceMasks=e.map((e=>this.convertToMPMask(e,!this.userCallback))),this.setLatestOutputTimestamp(t),this.maybeInvokeCallback()})),this.graphRunner.attachEmptyPacketListener(m,(e=>{this.result.confidenceMasks=void 0,this.setLatestOutputTimestamp(e),this.maybeInvokeCallback()}))),this.outputCategoryMask&&(e.addOutputStream(f),r.addOutputStream("CATEGORY_MASK:"+f),this.keepStreamAlive(f),this.graphRunner.attachImageListener(f,((e,t)=>{this.result.categoryMask=this.convertToMPMask(e,!this.userCallback),this.setLatestOutputTimestamp(t),this.maybeInvokeCallback()})),this.graphRunner.attachEmptyPacketListener(f,(e=>{this.result.categoryMask=void 0,this.setLatestOutputTimestamp(e),this.maybeInvokeCallback()})));const a=e.serializeBinary();this.setGraph(new Uint8Array(a),!0)}processRenderData(e,t){const r=new l.RenderData,o=new l.RenderAnnotation,i=new d.Color;if(i.setR(255),o.setColor(i),e.keypoint&&e.scribble)throw new Error("Cannot provide both keypoint and scribble.");if(e.keypoint){const t=new l.RenderAnnotation.Point;t.setNormalized(!0),t.setX(e.keypoint.x),t.setY(e.keypoint.y),o.setPoint(t)}else{if(!e.scribble)throw new Error("Must provide either a keypoint or a scribble.");{const t=new l.RenderAnnotation.Scribble;for(const r of e.scribble){const e=new l.RenderAnnotation.Point;e.setNormalized(!0),e.setX(r.x),e.setY(r.y),t.addPoint(e)}o.setScribble(t)}}r.addRenderAnnotations(o),this.graphRunner.addProtoToStream(r.serializeBinary(),"drishti.RenderData",u,t)}}e.InteractiveSegmenter=h}(interactive_segmenter);var object_detector={},object_detector_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n),r.exportSymbol("proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions",null,o),proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions=function(e){t.Message.initialize(this,e,0,-1,proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.repeatedFields_,null)},r.inherits(proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.displayName="proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions"),proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.repeatedFields_=[5,6],t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.toObject(e,this)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.toObject=function(e,r){var o,i={baseOptions:(o=r.getBaseOptions())&&n.BaseOptions.toObject(e,o),displayNamesLocale:t.Message.getFieldWithDefault(r,2,"en"),maxResults:t.Message.getFieldWithDefault(r,3,-1),scoreThreshold:null==(o=t.Message.getOptionalFloatingPointField(r,4))?void 0:o,categoryAllowlistList:null==(o=t.Message.getRepeatedField(r,5))?void 0:o,categoryDenylistList:null==(o=t.Message.getRepeatedField(r,6))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions;return proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=t.readString();e.setDisplayNamesLocale(r);break;case 3:r=t.readInt32();e.setMaxResults(r);break;case 4:r=t.readFloat();e.setScoreThreshold(r);break;case 5:r=t.readString();e.addCategoryAllowlist(r);break;case 6:r=t.readString();e.addCategoryDenylist(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getBaseOptions())&&r.writeMessage(1,o,n.BaseOptions.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeString(2,o),null!=(o=t.Message.getField(e,3))&&r.writeInt32(3,o),null!=(o=t.Message.getField(e,4))&&r.writeFloat(4,o),(o=e.getCategoryAllowlistList()).length>0&&r.writeRepeatedString(5,o),(o=e.getCategoryDenylistList()).length>0&&r.writeRepeatedString(6,o)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.ext=new t.ExtensionFieldInfo(443442058,{ext:0},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions,proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.toObject,0),a.CalculatorOptions.extensionsBinary[443442058]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[443442058]=proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.ext,proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.getDisplayNamesLocale=function(){return t.Message.getFieldWithDefault(this,2,"en")},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.setDisplayNamesLocale=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.clearDisplayNamesLocale=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.hasDisplayNamesLocale=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.getMaxResults=function(){return t.Message.getFieldWithDefault(this,3,-1)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.setMaxResults=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.clearMaxResults=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.hasMaxResults=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.getScoreThreshold=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,0)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.setScoreThreshold=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.clearScoreThreshold=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.hasScoreThreshold=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.getCategoryAllowlistList=function(){return t.Message.getRepeatedField(this,5)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.setCategoryAllowlistList=function(e){return t.Message.setField(this,5,e||[])},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.addCategoryAllowlist=function(e,r){return t.Message.addToRepeatedField(this,5,e,r)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.clearCategoryAllowlistList=function(){return this.setCategoryAllowlistList([])},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.getCategoryDenylistList=function(){return t.Message.getRepeatedField(this,6)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.setCategoryDenylistList=function(e){return t.Message.setField(this,6,e||[])},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.addCategoryDenylist=function(e,r){return t.Message.addToRepeatedField(this,6,e,r)},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.prototype.clearCategoryDenylistList=function(){return this.setCategoryDenylistList([])},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.ext=new t.ExtensionFieldInfo(443442058,{ext:0},proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions,proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.toObject,0),a.CalculatorOptions.extensionsBinary[443442058]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[443442058]=proto.mediapipe.tasks.vision.object_detector.proto.ObjectDetectorOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.object_detector.proto)}(object_detector_options_pb);var object_detector_options={};Object.defineProperty(object_detector_options,"__esModule",{value:!0});var object_detector_result={};Object.defineProperty(object_detector_result,"__esModule",{value:!0}),function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,i)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(e,r){for(var o in e)"default"===o||Object.prototype.hasOwnProperty.call(r,o)||t(r,e,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.ObjectDetector=void 0;const o=calculator_pb,i=calculator_options_pb,a=detection_pb,n=base_options_pb,s=object_detector_options_pb,p=detection_result,d=vision_task_runner,l="input_frame_gpu",g="norm_rect",c="detections";r(object_detector_options,e),r(object_detector_result,e);class u extends d.VisionTaskRunner{static createFromOptions(e,t){return d.VisionTaskRunner.createVisionInstance(u,e,t)}static createFromModelBuffer(e,t){return d.VisionTaskRunner.createVisionInstance(u,e,{baseOptions:{modelAssetBuffer:t}})}static async createFromModelPath(e,t){return d.VisionTaskRunner.createVisionInstance(u,e,{baseOptions:{modelAssetPath:t}})}constructor(e,t){super(new d.VisionGraphRunner(e,t),l,g,!1),this.result={detections:[]},this.options=new s.ObjectDetectorOptions,this.options.setBaseOptions(new n.BaseOptions)}get baseOptions(){return this.options.getBaseOptions()}set baseOptions(e){this.options.setBaseOptions(e)}setOptions(e){return void 0!==e.displayNamesLocale?this.options.setDisplayNamesLocale(e.displayNamesLocale):"displayNamesLocale"in e&&this.options.clearDisplayNamesLocale(),void 0!==e.maxResults?this.options.setMaxResults(e.maxResults):"maxResults"in e&&this.options.clearMaxResults(),void 0!==e.scoreThreshold?this.options.setScoreThreshold(e.scoreThreshold):"scoreThreshold"in e&&this.options.clearScoreThreshold(),void 0!==e.categoryAllowlist?this.options.setCategoryAllowlistList(e.categoryAllowlist):"categoryAllowlist"in e&&this.options.clearCategoryAllowlistList(),void 0!==e.categoryDenylist?this.options.setCategoryDenylistList(e.categoryDenylist):"categoryDenylist"in e&&this.options.clearCategoryDenylistList(),this.applyOptions(e)}detect(e,t){return this.result={detections:[]},this.processImageData(e,t),this.result}detectForVideo(e,t,r){return this.result={detections:[]},this.processVideoData(e,r,t),this.result}addJsObjectDetections(e){for(const t of e){const e=a.Detection.deserializeBinary(t);this.result.detections.push((0,p.convertFromDetectionProto)(e))}}refreshGraph(){const e=new o.CalculatorGraphConfig;e.addInputStream(l),e.addInputStream(g),e.addOutputStream(c);const t=new i.CalculatorOptions;t.setExtension(s.ObjectDetectorOptions.ext,this.options);const r=new o.CalculatorGraphConfig.Node;r.setCalculator("mediapipe.tasks.vision.ObjectDetectorGraph"),r.addInputStream("IMAGE:"+l),r.addInputStream("NORM_RECT:"+g),r.addOutputStream("DETECTIONS:"+c),r.setOptions(t),e.addNode(r),this.graphRunner.attachProtoVectorListener(c,((e,t)=>{this.addJsObjectDetections(e),this.setLatestOutputTimestamp(t)})),this.graphRunner.attachEmptyPacketListener(c,(e=>{this.setLatestOutputTimestamp(e)}));const a=e.serializeBinary();this.setGraph(new Uint8Array(a),!0)}}e.ObjectDetector=u}(object_detector);var pose_landmarker={},pose_detector_graph_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n),r.exportSymbol("proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions",null,o),proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.displayName="proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.toObject=function(e,r){var o,i={baseOptions:(o=r.getBaseOptions())&&n.BaseOptions.toObject(e,o),minDetectionConfidence:t.Message.getFloatingPointFieldWithDefault(r,2,.5),minSuppressionThreshold:t.Message.getFloatingPointFieldWithDefault(r,3,.5),numPoses:null==(o=t.Message.getField(r,4))?void 0:o};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions;return proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=t.readFloat();e.setMinDetectionConfidence(r);break;case 3:r=t.readFloat();e.setMinSuppressionThreshold(r);break;case 4:r=t.readInt32();e.setNumPoses(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getBaseOptions())&&r.writeMessage(1,o,n.BaseOptions.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeFloat(2,o),null!=(o=t.Message.getField(e,3))&&r.writeFloat(3,o),null!=(o=t.Message.getField(e,4))&&r.writeInt32(4,o)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.ext=new t.ExtensionFieldInfo(514774813,{ext:0},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions,proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[514774813]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[514774813]=proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.ext,proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.getMinDetectionConfidence=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,.5)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.setMinDetectionConfidence=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.clearMinDetectionConfidence=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.hasMinDetectionConfidence=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.getMinSuppressionThreshold=function(){return t.Message.getFloatingPointFieldWithDefault(this,3,.5)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.setMinSuppressionThreshold=function(e){return t.Message.setField(this,3,e)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.clearMinSuppressionThreshold=function(){return t.Message.setField(this,3,void 0)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.hasMinSuppressionThreshold=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.getNumPoses=function(){return t.Message.getFieldWithDefault(this,4,0)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.setNumPoses=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.clearNumPoses=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.prototype.hasNumPoses=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.ext=new t.ExtensionFieldInfo(514774813,{ext:0},proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions,proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[514774813]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[514774813]=proto.mediapipe.tasks.vision.pose_detector.proto.PoseDetectorGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.pose_detector.proto)}(pose_detector_graph_options_pb);var pose_landmarker_graph_options_pb={},pose_landmarks_detector_graph_options_pb={};!function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n),r.exportSymbol("proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions",null,o),proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.displayName="proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.toObject=function(e,r){var o,i={baseOptions:(o=r.getBaseOptions())&&n.BaseOptions.toObject(e,o),minDetectionConfidence:t.Message.getFloatingPointFieldWithDefault(r,2,.5)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions;return proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=t.readFloat();e.setMinDetectionConfidence(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getBaseOptions())&&r.writeMessage(1,o,n.BaseOptions.serializeBinaryToWriter),null!=(o=t.Message.getField(e,2))&&r.writeFloat(2,o)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.ext=new t.ExtensionFieldInfo(518928384,{ext:0},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[518928384]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[518928384]=proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.ext,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.prototype.getMinDetectionConfidence=function(){return t.Message.getFloatingPointFieldWithDefault(this,2,.5)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.prototype.setMinDetectionConfidence=function(e){return t.Message.setField(this,2,e)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.prototype.clearMinDetectionConfidence=function(){return t.Message.setField(this,2,void 0)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.prototype.hasMinDetectionConfidence=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.ext=new t.ExtensionFieldInfo(518928384,{ext:0},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[518928384]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[518928384]=proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarksDetectorGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.pose_landmarker.proto)}(pose_landmarks_detector_graph_options_pb),function(e){var t=googleProtobuf,r=t,o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof window&&window||void 0!==o&&o||"undefined"!=typeof self&&self||function(){return this}.call(null)||Function("return this")(),i=calculator_pb;r.object.extend(proto,i);var a=calculator_options_pb;r.object.extend(proto,a);var n=base_options_pb;r.object.extend(proto,n);var s=pose_detector_graph_options_pb;r.object.extend(proto,s);var p=pose_landmarks_detector_graph_options_pb;r.object.extend(proto,p),r.exportSymbol("proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions",null,o),proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions=function(e){t.Message.initialize(this,e,0,-1,null,null)},r.inherits(proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions,t.Message),r.DEBUG&&!COMPILED&&(proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.displayName="proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions"),t.Message.GENERATE_TO_OBJECT&&(proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.toObject=function(e){return proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.toObject(e,this)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.toObject=function(e,r){var o,i={baseOptions:(o=r.getBaseOptions())&&n.BaseOptions.toObject(e,o),poseDetectorGraphOptions:(o=r.getPoseDetectorGraphOptions())&&s.PoseDetectorGraphOptions.toObject(e,o),poseLandmarksDetectorGraphOptions:(o=r.getPoseLandmarksDetectorGraphOptions())&&p.PoseLandmarksDetectorGraphOptions.toObject(e,o),minTrackingConfidence:t.Message.getFloatingPointFieldWithDefault(r,4,.5)};return e&&(i.$jspbMessageInstance=r),i}),proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.deserializeBinary=function(e){var r=new t.BinaryReader(e),o=new proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions;return proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.deserializeBinaryFromReader(o,r)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();){switch(t.getFieldNumber()){case 1:var r=new n.BaseOptions;t.readMessage(r,n.BaseOptions.deserializeBinaryFromReader),e.setBaseOptions(r);break;case 2:r=new s.PoseDetectorGraphOptions;t.readMessage(r,s.PoseDetectorGraphOptions.deserializeBinaryFromReader),e.setPoseDetectorGraphOptions(r);break;case 3:r=new p.PoseLandmarksDetectorGraphOptions;t.readMessage(r,p.PoseLandmarksDetectorGraphOptions.deserializeBinaryFromReader),e.setPoseLandmarksDetectorGraphOptions(r);break;case 4:r=t.readFloat();e.setMinTrackingConfidence(r);break;default:t.skipField()}}return e},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.serializeBinary=function(){var e=new t.BinaryWriter;return proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.serializeBinaryToWriter=function(e,r){var o=void 0;null!=(o=e.getBaseOptions())&&r.writeMessage(1,o,n.BaseOptions.serializeBinaryToWriter),null!=(o=e.getPoseDetectorGraphOptions())&&r.writeMessage(2,o,s.PoseDetectorGraphOptions.serializeBinaryToWriter),null!=(o=e.getPoseLandmarksDetectorGraphOptions())&&r.writeMessage(3,o,p.PoseLandmarksDetectorGraphOptions.serializeBinaryToWriter),null!=(o=t.Message.getField(e,4))&&r.writeFloat(4,o)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.ext=new t.ExtensionFieldInfo(516587230,{ext:0},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[516587230]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[516587230]=proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.ext,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.getBaseOptions=function(){return t.Message.getWrapperField(this,n.BaseOptions,1)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.setBaseOptions=function(e){return t.Message.setWrapperField(this,1,e)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.clearBaseOptions=function(){return this.setBaseOptions(void 0)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.hasBaseOptions=function(){return null!=t.Message.getField(this,1)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.getPoseDetectorGraphOptions=function(){return t.Message.getWrapperField(this,s.PoseDetectorGraphOptions,2)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.setPoseDetectorGraphOptions=function(e){return t.Message.setWrapperField(this,2,e)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.clearPoseDetectorGraphOptions=function(){return this.setPoseDetectorGraphOptions(void 0)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.hasPoseDetectorGraphOptions=function(){return null!=t.Message.getField(this,2)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.getPoseLandmarksDetectorGraphOptions=function(){return t.Message.getWrapperField(this,p.PoseLandmarksDetectorGraphOptions,3)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.setPoseLandmarksDetectorGraphOptions=function(e){return t.Message.setWrapperField(this,3,e)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.clearPoseLandmarksDetectorGraphOptions=function(){return this.setPoseLandmarksDetectorGraphOptions(void 0)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.hasPoseLandmarksDetectorGraphOptions=function(){return null!=t.Message.getField(this,3)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.getMinTrackingConfidence=function(){return t.Message.getFloatingPointFieldWithDefault(this,4,.5)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.setMinTrackingConfidence=function(e){return t.Message.setField(this,4,e)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.clearMinTrackingConfidence=function(){return t.Message.setField(this,4,void 0)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.prototype.hasMinTrackingConfidence=function(){return null!=t.Message.getField(this,4)},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.ext=new t.ExtensionFieldInfo(516587230,{ext:0},proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.toObject,0),a.CalculatorOptions.extensionsBinary[516587230]=new t.ExtensionFieldBinaryInfo(proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.ext,t.BinaryReader.prototype.readMessage,t.BinaryWriter.prototype.writeMessage,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.serializeBinaryToWriter,proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.deserializeBinaryFromReader,!1),a.CalculatorOptions.extensions[516587230]=proto.mediapipe.tasks.vision.pose_landmarker.proto.PoseLandmarkerGraphOptions.ext,r.object.extend(e,proto.mediapipe.tasks.vision.pose_landmarker.proto)}(pose_landmarker_graph_options_pb);var pose_landmarker_options={};Object.defineProperty(pose_landmarker_options,"__esModule",{value:!0});var pose_landmarker_result={};Object.defineProperty(pose_landmarker_result,"__esModule",{value:!0}),function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,i)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(e,r){for(var o in e)"default"===o||Object.prototype.hasOwnProperty.call(r,o)||t(r,e,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.PoseLandmarker=void 0;const o=calculator_pb,i=calculator_options_pb,a=landmark_pb,n=base_options_pb,s=pose_detector_graph_options_pb,p=pose_landmarker_graph_options_pb,d=pose_landmarks_detector_graph_options_pb,l=landmark_result,g=vision_task_runner;r(pose_landmarker_options,e),r(pose_landmarker_result,e);const c="image_in",u="norm_rect",m="normalized_landmarks",f="world_landmarks",h="segmentation_masks",y=.5;class b extends g.VisionTaskRunner{static createFromOptions(e,t){return g.VisionTaskRunner.createVisionInstance(b,e,t)}static createFromModelBuffer(e,t){return g.VisionTaskRunner.createVisionInstance(b,e,{baseOptions:{modelAssetBuffer:t}})}static createFromModelPath(e,t){return g.VisionTaskRunner.createVisionInstance(b,e,{baseOptions:{modelAssetPath:t}})}constructor(e,t){super(new g.VisionGraphRunner(e,t),c,u,!1),this.result={},this.outputSegmentationMasks=!1,this.options=new p.PoseLandmarkerGraphOptions,this.options.setBaseOptions(new n.BaseOptions),this.poseLandmarksDetectorGraphOptions=new d.PoseLandmarksDetectorGraphOptions,this.options.setPoseLandmarksDetectorGraphOptions(this.poseLandmarksDetectorGraphOptions),this.poseDetectorGraphOptions=new s.PoseDetectorGraphOptions,this.options.setPoseDetectorGraphOptions(this.poseDetectorGraphOptions),this.initDefaults()}get baseOptions(){return this.options.getBaseOptions()}set baseOptions(e){this.options.setBaseOptions(e)}setOptions(e){var t,r,o,i,a;return"numPoses"in e&&this.poseDetectorGraphOptions.setNumPoses(null!==(t=e.numPoses)&&void 0!==t?t:1),"minPoseDetectionConfidence"in e&&this.poseDetectorGraphOptions.setMinDetectionConfidence(null!==(r=e.minPoseDetectionConfidence)&&void 0!==r?r:y),"minTrackingConfidence"in e&&this.options.setMinTrackingConfidence(null!==(o=e.minTrackingConfidence)&&void 0!==o?o:y),"minPosePresenceConfidence"in e&&this.poseLandmarksDetectorGraphOptions.setMinDetectionConfidence(null!==(i=e.minPosePresenceConfidence)&&void 0!==i?i:y),"outputSegmentationMasks"in e&&(this.outputSegmentationMasks=null!==(a=e.outputSegmentationMasks)&&void 0!==a&&a),this.applyOptions(e)}detect(e,t,r){const o="function"!=typeof t?t:{};if(this.userCallback="function"==typeof t?t:r,this.resetResults(),this.processImageData(e,o),!this.userCallback)return this.result}detectForVideo(e,t,r,o){const i="function"!=typeof r?r:{};if(this.userCallback="function"==typeof r?r:o,this.resetResults(),this.processVideoData(e,i,t),!this.userCallback)return this.result}resetResults(){this.result={}}maybeInvokeCallback(){"landmarks"in this.result&&"worldLandmarks"in this.result&&(this.outputSegmentationMasks&&!("segmentationMasks"in this.result)||this.userCallback&&(this.userCallback(this.result),this.freeKeepaliveStreams()))}initDefaults(){this.poseDetectorGraphOptions.setNumPoses(1),this.poseDetectorGraphOptions.setMinDetectionConfidence(y),this.poseLandmarksDetectorGraphOptions.setMinDetectionConfidence(y),this.options.setMinTrackingConfidence(y)}addJsLandmarks(e){this.result.landmarks=[];for(const t of e){const e=a.NormalizedLandmarkList.deserializeBinary(t);this.result.landmarks.push((0,l.convertToLandmarks)(e))}}adddJsWorldLandmarks(e){this.result.worldLandmarks=[];for(const t of e){const e=a.LandmarkList.deserializeBinary(t);this.result.worldLandmarks.push((0,l.convertToWorldLandmarks)(e))}}refreshGraph(){const e=new o.CalculatorGraphConfig;e.addInputStream(c),e.addInputStream(u),e.addOutputStream(m),e.addOutputStream(f),e.addOutputStream(h);const t=new i.CalculatorOptions;t.setExtension(p.PoseLandmarkerGraphOptions.ext,this.options);const r=new o.CalculatorGraphConfig.Node;r.setCalculator("mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),r.addInputStream("IMAGE:"+c),r.addInputStream("NORM_RECT:"+u),r.addOutputStream("NORM_LANDMARKS:"+m),r.addOutputStream("WORLD_LANDMARKS:"+f),r.setOptions(t),e.addNode(r),this.addKeepaliveNode(e),this.graphRunner.attachProtoVectorListener(m,((e,t)=>{this.addJsLandmarks(e),this.setLatestOutputTimestamp(t),this.maybeInvokeCallback()})),this.graphRunner.attachEmptyPacketListener(m,(e=>{this.result.landmarks=[],this.setLatestOutputTimestamp(e),this.maybeInvokeCallback()})),this.graphRunner.attachProtoVectorListener(f,((e,t)=>{this.adddJsWorldLandmarks(e),this.setLatestOutputTimestamp(t),this.maybeInvokeCallback()})),this.graphRunner.attachEmptyPacketListener(f,(e=>{this.result.worldLandmarks=[],this.setLatestOutputTimestamp(e),this.maybeInvokeCallback()})),this.outputSegmentationMasks&&(r.addOutputStream("SEGMENTATION_MASK:"+h),this.keepStreamAlive(h),this.graphRunner.attachImageVectorListener(h,((e,t)=>{this.result.segmentationMasks=e.map((e=>this.convertToMPMask(e,!this.userCallback))),this.setLatestOutputTimestamp(t),this.maybeInvokeCallback()})),this.graphRunner.attachEmptyPacketListener(h,(e=>{this.result.segmentationMasks=[],this.setLatestOutputTimestamp(e),this.maybeInvokeCallback()})));const a=e.serializeBinary();this.setGraph(new Uint8Array(a),!0)}}e.PoseLandmarker=b,b.POSE_CONNECTIONS=[{start:0,end:1},{start:1,end:2},{start:2,end:3},{start:3,end:7},{start:0,end:4},{start:4,end:5},{start:5,end:6},{start:6,end:8},{start:9,end:10},{start:11,end:12},{start:11,end:13},{start:13,end:15},{start:15,end:17},{start:15,end:19},{start:15,end:21},{start:17,end:19},{start:12,end:14},{start:14,end:16},{start:16,end:18},{start:16,end:20},{start:16,end:22},{start:18,end:20},{start:11,end:23},{start:12,end:24},{start:23,end:24},{start:23,end:25},{start:24,end:26},{start:25,end:27},{start:26,end:28},{start:27,end:29},{start:28,end:30},{start:29,end:31},{start:30,end:32},{start:27,end:31},{start:28,end:32}]}(pose_landmarker),Object.defineProperty(vision,"__esModule",{value:!0});var PoseLandmarker_1=vision.PoseLandmarker=ObjectDetector_1=vision.ObjectDetector=InteractiveSegmenter_1=vision.InteractiveSegmenter=ImageSegmenter_1=vision.ImageSegmenter=ImageEmbedder_1=vision.ImageEmbedder=ImageClassifier_1=vision.ImageClassifier=HandLandmarker_1=vision.HandLandmarker=GestureRecognizer_1=vision.GestureRecognizer=FaceStylizer_1=vision.FaceStylizer=FaceLandmarker_1=vision.FaceLandmarker=FaceDetector_1=vision.FaceDetector=MPMask_1=vision.MPMask=MPImage_1=vision.MPImage=FilesetResolver_1=vision.FilesetResolver=DrawingUtils_1=vision.DrawingUtils=void 0;const fileset_resolver_1=fileset_resolver,drawing_utils_1=drawing_utils,image_1=image,mask_1=mask,face_detector_1=face_detector,face_landmarker_1=face_landmarker,face_stylizer_1=face_stylizer,gesture_recognizer_1=gesture_recognizer,hand_landmarker_1=hand_landmarker,image_classifier_1=image_classifier,image_embedder_1=image_embedder,image_segmenter_1=image_segmenter,interactive_segmenter_1=interactive_segmenter,object_detector_1=object_detector,pose_landmarker_1=pose_landmarker,DrawingUtils=drawing_utils_1.DrawingUtils;var DrawingUtils_1=vision.DrawingUtils=DrawingUtils;const FilesetResolver=fileset_resolver_1.FilesetResolver;var FilesetResolver_1=vision.FilesetResolver=FilesetResolver;const MPImage=image_1.MPImage;var MPImage_1=vision.MPImage=MPImage;const MPMask=mask_1.MPMask;var MPMask_1=vision.MPMask=MPMask;const FaceDetector=face_detector_1.FaceDetector;var FaceDetector_1=vision.FaceDetector=FaceDetector;const FaceLandmarker=face_landmarker_1.FaceLandmarker;var FaceLandmarker_1=vision.FaceLandmarker=FaceLandmarker;const FaceStylizer=face_stylizer_1.FaceStylizer;var FaceStylizer_1=vision.FaceStylizer=FaceStylizer;const GestureRecognizer=gesture_recognizer_1.GestureRecognizer;var GestureRecognizer_1=vision.GestureRecognizer=GestureRecognizer;const HandLandmarker=hand_landmarker_1.HandLandmarker;var HandLandmarker_1=vision.HandLandmarker=HandLandmarker;const ImageClassifier=image_classifier_1.ImageClassifier;var ImageClassifier_1=vision.ImageClassifier=ImageClassifier;const ImageEmbedder=image_embedder_1.ImageEmbedder;var ImageEmbedder_1=vision.ImageEmbedder=ImageEmbedder;const ImageSegmenter=image_segmenter_1.ImageSegmenter;var ImageSegmenter_1=vision.ImageSegmenter=ImageSegmenter;const InteractiveSegmenter=interactive_segmenter_1.InteractiveSegmenter;var InteractiveSegmenter_1=vision.InteractiveSegmenter=InteractiveSegmenter;const ObjectDetector=object_detector_1.ObjectDetector;var ObjectDetector_1=vision.ObjectDetector=ObjectDetector;const PoseLandmarker=pose_landmarker_1.PoseLandmarker;PoseLandmarker_1=vision.PoseLandmarker=PoseLandmarker;export{ +DrawingUtils_1 as DrawingUtils, +FaceDetector_1 as FaceDetector, +FaceLandmarker_1 as FaceLandmarker, +FaceStylizer_1 as FaceStylizer, +FilesetResolver_1 as FilesetResolver, +GestureRecognizer_1 as GestureRecognizer, +HandLandmarker_1 as HandLandmarker, +ImageClassifier_1 as ImageClassifier, +ImageEmbedder_1 as ImageEmbedder, +ImageSegmenter_1 as ImageSegmenter, +InteractiveSegmenter_1 as InteractiveSegmenter, +MPImage_1 as MPImage,MPMask_1 as MPMask, +ObjectDetector_1 as ObjectDetector, +PoseLandmarker_1 as PoseLandmarker, +vision as default +}; \ No newline at end of file diff --git a/mounts/zoperepo/__root__/tf_live_demo/tflw-pose-detection.js.map/__meta__ b/mounts/zoperepo/__root__/lib/models/pose_landmarker_heavy.task/__meta__ similarity index 100% rename from mounts/zoperepo/__root__/tf_live_demo/tflw-pose-detection.js.map/__meta__ rename to mounts/zoperepo/__root__/lib/models/pose_landmarker_heavy.task/__meta__ diff --git a/mounts/zoperepo/__root__/lib/models/pose_landmarker_heavy.task/__source__.task b/mounts/zoperepo/__root__/lib/models/pose_landmarker_heavy.task/__source__.task new file mode 100644 index 0000000..45449d9 Binary files /dev/null and b/mounts/zoperepo/__root__/lib/models/pose_landmarker_heavy.task/__source__.task differ diff --git a/mounts/zoperepo/__root__/master_pt/__source-utf8__.html b/mounts/zoperepo/__root__/master_pt/__source-utf8__.html index 894c2c2..419ee57 100644 --- a/mounts/zoperepo/__root__/master_pt/__source-utf8__.html +++ b/mounts/zoperepo/__root__/master_pt/__source-utf8__.html @@ -21,10 +21,7 @@ - - - - +
\ No newline at end of file diff --git a/mounts/zoperepo/__root__/mediapipe_upload/index_html/__source-utf8__.html b/mounts/zoperepo/__root__/mediapipe_upload/index_html/__source-utf8__.html deleted file mode 100644 index 1916f4a..0000000 --- a/mounts/zoperepo/__root__/mediapipe_upload/index_html/__source-utf8__.html +++ /dev/null @@ -1,53 +0,0 @@ -

-

- -

Mediapipe Upload Scan

- - - - - -

Upload Settings

-
-
- - -
-
- - -
-
- - -
-
- - -
- -
- -

Scan Settings

-
- -
- - We can implement another websocket server ( container, of course! ) - to spawn and listen to the scanning process, which will allow us to - create a status bar and solve the instancing issue as well! - - - -
-

\ No newline at end of file diff --git a/mounts/zoperepo/__root__/mp_live_scan/custom_js/__source__.js b/mounts/zoperepo/__root__/mp_live_scan/custom_js/__source__.js index e913fcb..47a1b17 100644 --- a/mounts/zoperepo/__root__/mp_live_scan/custom_js/__source__.js +++ b/mounts/zoperepo/__root__/mp_live_scan/custom_js/__source__.js @@ -2,7 +2,7 @@ import { PoseLandmarker, FilesetResolver, DrawingUtils -} from "/lib/js/vision_bundle_js"; +} from "/lib/js/vision_bundle_js_exports"; let poseLandmarker; let runningMode = "VIDEO"; diff --git a/mounts/zoperepo/__root__/p5_playground/index_html/__source-utf8__.html b/mounts/zoperepo/__root__/p5_playground/index_html/__source-utf8__.html index f551178..8b206b7 100644 --- a/mounts/zoperepo/__root__/p5_playground/index_html/__source-utf8__.html +++ b/mounts/zoperepo/__root__/p5_playground/index_html/__source-utf8__.html @@ -1,5 +1,5 @@

-

+
@@ -33,7 +33,7 @@

p5js playground

- +
diff --git a/mounts/zoperepo/__root__/playground/__meta__ b/mounts/zoperepo/__root__/playground/__meta__ new file mode 100644 index 0000000..21bf351 --- /dev/null +++ b/mounts/zoperepo/__root__/playground/__meta__ @@ -0,0 +1,5 @@ +[ + ('owner', (['acl_users'], 'dockerzope')), + ('title', 'playground redesign 2024'), + ('type', 'Folder'), +] diff --git a/mounts/zoperepo/__root__/tf_upload_demo/custom_js/__meta__ b/mounts/zoperepo/__root__/playground/app_js/__meta__ similarity index 100% rename from mounts/zoperepo/__root__/tf_upload_demo/custom_js/__meta__ rename to mounts/zoperepo/__root__/playground/app_js/__meta__ diff --git a/mounts/zoperepo/__root__/playground/app_js/__source__.js b/mounts/zoperepo/__root__/playground/app_js/__source__.js new file mode 100644 index 0000000..8e0b2ff --- /dev/null +++ b/mounts/zoperepo/__root__/playground/app_js/__source__.js @@ -0,0 +1,474 @@ +let choreo_dropdown_template; +let example_dropdown_template; +let editor; +let oScript; +let oScriptText; +let DB_DATA; +let sketch; +let stage; +let cur_choreo_id; + +let video; +let canvasElement; +let canvasCtx; +let drawingUtils; + +// Check if webcam access is supported. +const hasGetUserMedia = () => !!navigator.mediaDevices?.getUserMedia; +let lastVideoTime = -1; + +let videoWidth; +let videoHeight; + +let webcamRunning = false; +let broadcast_running = false; + +let websocket; +let websocket_opened = false; + +let params = new URLSearchParams(document.location.search); + + +$(document).on("choreo-dropdown-load", function(event) { + $.getJSON("choreo/fetch", function(data) { + let dropdown_html = choreo_dropdown_template(data); + $("#choreo_dropdown").html(dropdown_html); + $("#records_dropdown").toggleClass('disabled'); + let chroeo_id = params.get("choreo_id"); + if (chroeo_id) { + load_data(chroeo_id); + } else if (data.choreos.length) { + load_data(data.choreos[0].choreo_id); + } + }) +}) + +$(document).on("example-dropdown-load", function(event) { + $.getJSON("get_examples", function(data) { + let select_html = example_dropdown_template(data) + $("#examples_dropdown").html(select_html) + }) +}) + +$(function() { + + let bp_modal_el = document.querySelector('#bp_info_modal') + let bp_modal = bootstrap.Modal.getOrCreateInstance(bp_modal_el) + let js_modal_el = document.querySelector('#js_info_modal') + let js_modal = bootstrap.Modal.getOrCreateInstance(js_modal_el) + let manual_modal_el = document.querySelector('#manual_modal') + let manual_modal = bootstrap.Modal.getOrCreateInstance(manual_modal_el) + + $("#show_bp_model").click(function(event) { + bp_modal.show() + }) + + $("#show_js_info").click(function(event) { + js_modal.show() + }) + + $("#show_manual").click(function(event) { + manual_modal.show() + }) + + hljs.highlightAll(); + + $.get( + "choreo_dropdown_select_pt", + function(data) { + choreo_dropdown_template = Handlebars.compile(data) + $(document).trigger("choreo-dropdown-load") + } + ) + + $.get( + "example_dropdown_select_pt", + function(data) { + example_dropdown_template = Handlebars.compile(data) + $(document).trigger("example-dropdown-load") + } + ) + + example_id = params.get("example_id"); + editor = CodeMirror( + $("#editor")[0], + { + value: example_id ? EXAMPLES[example_id] : EXAMPLES["stickman"], + mode: "javascript", + lineNumbers: true, + extraKeys: {"Ctrl-Space": "autocomplete"}, + indentUnit: 4, + } + ) + editor.setOption("theme", "material"); + editor.setOption("hintOptions", { + completeOnSingleClick: false, + closeOnUnfocus: false, + additionalContext: {p: p5.prototype}, + useGlobalScope: true, + }) + + $("#run_code").click(runCode); + $("#run_fullscreen").click(run_fullscreen); + $("#mode_toggle_btn").click(toggle_mode); + $("#toggle_adv_live_btn").click(toggle_adv_live); + $("#broadcast_scan").click(start_broadcast); + $("#connect_ws_btn").click(connect_ws); + $("#download_code").click(function(event) { + saveTextAsFile(editor.getValue(), 'p5_code.js') + }) + + $("#import_code").click(function(event) { + $("#import_file").click(); + }) + + $("#import_file").on("change", (event) => { + let import_file = $("#import_file")[0].files[0] + if (!import_file) { + alert("Please select a file!") + return + } + let import_code = "" + let fileReader = new FileReader() + fileReader.onload = function () { + import_code = fileReader.result + editor.setValue(import_code) + } + fileReader.readAsText(import_file) + }) + + $("#export_toggle").on("change", (event) => { + $("#download_png").toggleClass("disabled"); + $("#download_svg").toggleClass("disabled"); + $("#export_alert").toggleClass("d-none"); + if ($("#export_toggle").is(':checked')) { + p5_MODE = 'svg'; + } else { + p5_MODE = 'p2d'; + } + }) + + $("#download_png").click(downloadSVGAsPNG); + $("#download_svg").click(downloadSVGAsText); + + // If webcam supported, add event listener to button for when user + // wants to activate it. + if (hasGetUserMedia()) { + $("#start_cam_btn").click(enableCam); + } else { + console.warn("getUserMedia() is not supported by your browser"); + $("#start_cam_btn").prop("disabled", true); + } + + video = document.getElementById("webcam"); + canvasElement = document.getElementById("output_canvas"); + canvasCtx = canvasElement.getContext("2d"); + drawingUtils = new DrawingUtils_1(canvasCtx); + $("#load_model").click((event) => { + webcamRunning = false; + broadcast_running = false; + $("#start_scan_btn").toggleClass("disabled"); + $("#bc_not_running").show(); + $("#bc_running").hide(); + createPoseLandmarker(); + }) + + createPoseLandmarker(); +}) + +function runCode(event) { + + if (stage) { + stage.remove() + } + + $("#p5_stage").empty() + + let jscode = editor.getValue() + + if(oScript) { + oScript.remove() + } + + oScript = document.createElement("script") + oScriptText = document.createTextNode(jscode) + oScript.appendChild(oScriptText) + document.body.appendChild(oScript) + +} + +function select_choreo(event) { + let elem = $(event.target); + cur_choreo_id = elem.data('choreo-id'); + $("a.dropdown-item.active[data-choreo-id]").toggleClass('active'); + //elem.toggleClass('active'); + + $("#data_loading").show(); + $("#run_code").toggleClass('disabled'); + load_data(cur_choreo_id); +} + +function toggle_mode(event) { + let btn = $(event.target); + + LIVEMODE = !LIVEMODE; + + if (LIVEMODE) { + btn.text('DB Mode'); + DATA = []; + } else { + btn.text('Live Mode'); + DATA = DB_DATA; + } + $("#database_tools").toggleClass("d-none"); + $("#live_tools").toggleClass("d-none"); +} + +function toggle_adv_live(event) { + $("#ws_settings").toggleClass("d-none"); + $("#model_settings").toggleClass("d-none"); +} + +function data_loaded(data) { + DATA = data.choreo_json; + DB_DATA = data.choreo_json; + $(document).trigger('data-loaded'); + $(`a.dropdown-item[data-choreo-id="${data.choreo_id}"]`).toggleClass('active'); + $("#data_loading").hide(); + $("#run_code").toggleClass('disabled'); + $("#run_fullscreen").toggleClass('disabled'); + $("#selected_record").html(`${data.choreo_name} by ${data.choreo_author}`); + console.log("Record loaded!"); +} + +function load_data(choreo_id) { + $.getJSON( + 'choreo/fetch_playground', + { + choreo_id: choreo_id, + }, + data_loaded + ) +} + +const createPoseLandmarker = async () => { + + let num_poses = 1; + + if ($("#numposes").val()) { + num_poses = $("#numposes").val() + } + const vision = await FilesetResolver_1.forVisionTasks( + "/lib/wasm" + ); + + let model_path = "/lib/models/pose_landmarker_" + $("#model_chooser").val() + ".task" + + poseLandmarker = await PoseLandmarker_1.createFromOptions(vision, { + baseOptions: { + modelAssetPath: model_path, + delegate: "GPU" + }, + runningMode: 'VIDEO', + numPoses: num_poses, + minPoseDetectionConfidence: $("#minPoseDetectionConfidence").val(), + minPosePresenceConfidence: $("#minPosePresenceConfidence").val(), + minTrackingConfidence: $("#minTrackingConfidence").val(), + }); + + console.log("poseLandmarker initialized!"); + $("#start_scan_btn").toggleClass("disabled"); + +}; + +// Enable the live webcam view and start detection. +function enableCam(event) { + + if (!poseLandmarker) { + console.log("Wait! poseLandmaker not loaded yet."); + return; + } + + videoWidth = "640px"; + videoHeight = "360px"; + + if (webcamRunning === true) { + webcamRunning = false; + broadcast_running = false; + $("#broadcast_scan").prop("disabled", true); + $("#bc_not_running").show(); + $("#bc_running").hide(); + $(video).hide(); + $(canvasElement).hide(); + + } else { + webcamRunning = true; + if (websocket_opened) { + $("#broadcast_scan").prop("disabled", false); + } + $(video).show(); + $(canvasElement).show(); + } + + const constraints = { + video: true + }; + + // Activate the webcam stream. + navigator.mediaDevices.getUserMedia(constraints).then((stream) => { + video.srcObject = stream; + video.addEventListener("loadeddata", predictWebcam); + }); + + +} + +async function predictWebcam() { + canvasElement.style.height = videoHeight; + video.style.height = videoHeight; + canvasElement.style.width = videoWidth; + video.style.width = videoWidth; + + let startTimeMs = performance.now(); + if (lastVideoTime !== video.currentTime) { + lastVideoTime = video.currentTime; + poseLandmarker.detectForVideo(video, startTimeMs, (result) => { + canvasCtx.save(); + canvasCtx.clearRect(0, 0, canvasElement.width, canvasElement.height); + for (const landmark of result.landmarks) { + drawingUtils.drawLandmarks(landmark, { + radius: (data) => DrawingUtils.lerp(data.from.z, -0.15, 0.1, 5, 1) + }); + drawingUtils.drawConnectors(landmark, PoseLandmarker.POSE_CONNECTIONS); + } + canvasCtx.restore(); + if (LIVEMODE) { + DATA = result.landmarks; + } + if (broadcast_running) { + /// XXX: Make landmarks pickable! + let to_send = JSON.stringify(result.landmarks); + websocket.send(to_send); + } + }); + } + + // Call this function again to keep predicting when the browser is ready. + if (webcamRunning === true) { + window.requestAnimationFrame(predictWebcam); + } + +} + +function start_broadcast(event) { + if (websocket_opened && !broadcast_running) { + broadcast_running = true; + console.log("Broadcast started!"); + $("#bc_not_running").hide(); + $("#bc_running").show(); + } else { + broadcast_running = false; + console.log("Broadcast stopped!"); + $("#bc_not_running").show(); + $("#bc_running").hide(); + } +} + +function connect_ws(event) { + ws_addr = $("#ws_addr").val(); + websocket = new WebSocket(ws_addr); + + websocket.addEventListener("open", (event) => { + websocket_opened = true; + $("#ws_not_connected").hide(); + $("#ws_connected").show(); + if (webcamRunning) { + $("#broadcast_scan").prop("disabled", false); + } + }); +} + +function select_example(event) { + let selected = $(event.target); + editor.setValue(EXAMPLES[selected.data('example-id')]); +} + +function saveTextAsFile(textToWrite, fileNameToSaveAs) { + var textFileAsBlob = new Blob([textToWrite], {type:'text/plain'}); + var downloadLink = document.createElement("a"); + downloadLink.download = fileNameToSaveAs; + downloadLink.innerHTML = "Download File"; + if (window.webkitURL !== null) + { + // Chrome allows the link to be clicked + // without actually adding it to the DOM. + downloadLink.href = window.webkitURL.createObjectURL(textFileAsBlob); + } + else + { + // Firefox requires the link to be added to the DOM + // before it can be clicked. + downloadLink.href = window.URL.createObjectURL(textFileAsBlob); + downloadLink.onclick = destroyClickedElement; + downloadLink.style.display = "none"; + document.body.appendChild(downloadLink); + } + + downloadLink.click(); +} + +function downloadSVGAsText() { + const svg = document.querySelector('svg'); + if (!svg) { + alert("No image found, aborting ...") + return + } + const base64doc = btoa(unescape(encodeURIComponent(svg.outerHTML))); + const a = document.createElement('a'); + const e = new MouseEvent('click'); + a.download = 'download.svg'; + a.href = 'data:image/svg+xml;base64,' + base64doc; + a.dispatchEvent(e); +} + +function downloadSVGAsPNG(e){ + const canvas = document.createElement("canvas"); + const svg = document.querySelector('svg'); + if (!svg) { + alert("No image found, aborting ...") + return + } + const base64doc = btoa(unescape(encodeURIComponent(svg.outerHTML))); + const w = parseInt(svg.getAttribute('width')); + const h = parseInt(svg.getAttribute('height')); + const img_to_download = document.createElement('img'); + img_to_download.src = 'data:image/svg+xml;base64,' + base64doc; + console.log(w, h); + img_to_download.onload = function () { + canvas.setAttribute('width', w); + canvas.setAttribute('height', h); + const context = canvas.getContext("2d"); + context.drawImage(img_to_download,0,0,w,h); + const dataURL = canvas.toDataURL('image/png'); + if (window.navigator.msSaveBlob) { + window.navigator.msSaveBlob(canvas.msToBlob(), "download.png"); + e.preventDefault(); + } else { + const a = document.createElement('a'); + const my_evt = new MouseEvent('click'); + a.download = 'download.png'; + a.href = dataURL; + a.dispatchEvent(my_evt); + } + } +} + +function run_fullscreen(event) { + SCENE_WIDTH = $(document).width(); + SCENE_HEIGHT = $(document).height(); + $("body").hide(); + runCode(); + $("canvas").prependTo("html"); + $("#output_canvas").hide(); + $("html").css("background-color", "#212529"); +} \ No newline at end of file diff --git a/mounts/zoperepo/__root__/mediapipe_upload/index_html/__meta__ b/mounts/zoperepo/__root__/playground/choreo_dropdown_select_pt/__meta__ similarity index 100% rename from mounts/zoperepo/__root__/mediapipe_upload/index_html/__meta__ rename to mounts/zoperepo/__root__/playground/choreo_dropdown_select_pt/__meta__ diff --git a/mounts/zoperepo/__root__/playground/choreo_dropdown_select_pt/__source-utf8__.html b/mounts/zoperepo/__root__/playground/choreo_dropdown_select_pt/__source-utf8__.html new file mode 100644 index 0000000..951efa0 --- /dev/null +++ b/mounts/zoperepo/__root__/playground/choreo_dropdown_select_pt/__source-utf8__.html @@ -0,0 +1,7 @@ +{{#each choreos}} +
  • + + {{this.choreo_name}} + +
  • +{{/each}} \ No newline at end of file diff --git a/mounts/zoperepo/__root__/tf_live_demo/tflw-pose-detection.js/__meta__ b/mounts/zoperepo/__root__/playground/choreo_lib_js/__meta__ similarity index 83% rename from mounts/zoperepo/__root__/tf_live_demo/tflw-pose-detection.js/__meta__ rename to mounts/zoperepo/__root__/playground/choreo_lib_js/__meta__ index b9386a5..ea0908b 100644 --- a/mounts/zoperepo/__root__/tf_live_demo/tflw-pose-detection.js/__meta__ +++ b/mounts/zoperepo/__root__/playground/choreo_lib_js/__meta__ @@ -1,6 +1,6 @@ [ ('props', [ - [('id', 'content_type'), ('type', 'string'), ('value', 'application/javascript')], + [('id', 'content_type'), ('type', 'string'), ('value', 'text/javascript')], ]), ('title', ''), ('type', 'File'), diff --git a/mounts/zoperepo/__root__/playground/choreo_lib_js/__source__.js b/mounts/zoperepo/__root__/playground/choreo_lib_js/__source__.js new file mode 100644 index 0000000..118af81 --- /dev/null +++ b/mounts/zoperepo/__root__/playground/choreo_lib_js/__source__.js @@ -0,0 +1,175 @@ +// Base settings +const FPS = 30 +var SCENE_WIDTH = 640 +var SCENE_HEIGHT = 360 + +if (window.innerWidth < 640) { + SCENE_WIDTH = 320 + SCENE_HEIGHT = 180 +} + +// Basic stick figure lines +// check blazepose model diagram for details +const LINE_MAP = { + 0 : [1, 4], + 1 : [2], + 2 : [3], + 3 : [7], + 4 : [5], + 5 : [6], + 6 : [8], + 9 : [10], + 11: [12, 13, 23], + 12: [14, 24], + 13: [15], + 14: [16], + 15: [17, 19, 21], + 16: [18, 20, 22], + 17: [19], + 18: [20], + 23: [24, 25], + 24: [26], + 25: [27], + 26: [28], + 27: [29, 31], + 28: [30, 32], +} + +// derived from +// https://developers.google.com/mediapipe/solutions/vision/hand_landmarker#models +// same as line_map, but for hands instead of body +const HAND_MAP = { + 0 : [1, 5, 17], + 1 : [2], + 2 : [3], + 3 : [4], + 5 : [6, 9], + 6 : [7], + 7 : [8], + 9 : [10, 13], + 10: [11], + 11: [12], + 13: [14, 17], + 14: [15], + 15: [16], + 17: [18], + 18: [19], + 19: [20], +} + +// Map joint names against indexes for named access +const JOINTS_BY_NAME = { + "NOSE": 0, + "LEFT_EYE_INNER": 1, + "LEFT_EYE": 2, + "LEFT_EYE_OUTER": 3, + "RIGHT_EYE_INNER": 4, + "RIGHT_EYE": 5, + "RIGHT_EYE_OUTER": 6, + "LEFT_EAR": 7, + "RIGHT_EAR": 8, + "MOUTH_LEFT": 9, + "MOUTH_RIGHT": 10, + "LEFT_SHOULDER": 11, + "RIGHT_SHOULDER": 12, + "LEFT_ELBOW": 13, + "RIGHT_ELBOW": 14, + "LEFT_WRIST": 15, + "RIGHT_WRIST": 16, + "LEFT_PINKY": 17, + "RIGHT_PINKY": 18, + "LEFT_INDEX": 19, + "RIGHT_INDEX": 20, + "LEFT_THUMB": 21, + "RIGHT_THUMB": 22, + "LEFT_HIP": 23, + "RIGHT_HIP": 24, + "LEFT_KNEE": 25, + "RIGHT_KNEE": 26, + "LEFT_ANKLE": 27, + "RIGHT_ANKLE": 28, + "LEFT_HEEL": 29, + "RIGHT_HEEL": 30, + "LEFT_FOOT_INDEX": 31, + "RIGHT_FOOT_INDEX": 32, +} + +// basic function to find a joint by index from given frame +// use this as a template to create a function to return joints u desire to use +function find_by_bpindex(frame, bpindex, joint_type) { + if (!LIVEMODE) { + for (let joint_index in frame) { + let joint = frame[joint_index] + if ((joint.index == bpindex) && (joint.type == joint_type)) { + return joint + } + } + } else { // in livemode our data does not have type as we only scan the body + return frame[bpindex] + } +} + +function draw_stickfigure(p, data_chunk) { + // loop to create stickman body from LINE_MAP + for (let first_bpindex in LINE_MAP) { + let point_list = LINE_MAP[first_bpindex] + for (let pindex in point_list) { + let second_bpindex = point_list[pindex] + let first_point = find_by_bpindex(data_chunk, first_bpindex, "body") + let second_point = find_by_bpindex(data_chunk, second_bpindex, "body") + + // make sure we've found useful data, skip if not found + if (!first_point || !second_point) { + continue + } + + // make sure to multiply normalized coordinates to get correct coordinates + let x1 = first_point.x * SCENE_WIDTH + let x2 = second_point.x * SCENE_WIDTH + let y1 = first_point.y * SCENE_HEIGHT + let y2 = second_point.y * SCENE_HEIGHT + + p.line(x1, y1, x2, y2) + + } + } +} + +function draw_stickfigure_multipose(p, data_chunk) { + // loop to create stickman body from LINE_MAP + for (let first_bpindex in LINE_MAP) { + let point_list = LINE_MAP[first_bpindex] + for (let pindex in point_list) { + let second_bpindex = point_list[pindex] + let first_point = data_chunk[first_bpindex] + let second_point = data_chunk[second_bpindex] + + // make sure we've found useful data, skip if not found + if (!first_point || !second_point) { + continue + } + + // make sure to multiply normalized coordinates to get correct coordinates + let x1 = first_point.x * SCENE_WIDTH + let x2 = second_point.x * SCENE_WIDTH + let y1 = first_point.y * SCENE_HEIGHT + let y2 = second_point.y * SCENE_HEIGHT + + p.line(x1, y1, x2, y2) + + } + } +} + + +// default renderer mode, can also be "svg" ( export mode ) or "webgl" +let p5_MODE = "p2d"; + +// Data source. Will contain array of frames with joints if in database +// mode, an array containing poses per frame ( the current one ) when in +// live mode. +let DATA; + +// Indicator flag for live mode. LIVEMODE == true means that DATA +// contains live data as described above. +let LIVEMODE = false; \ No newline at end of file diff --git a/mounts/zoperepo/__root__/playground/choreo_select_pt/__meta__ b/mounts/zoperepo/__root__/playground/choreo_select_pt/__meta__ new file mode 100644 index 0000000..7a1f36c --- /dev/null +++ b/mounts/zoperepo/__root__/playground/choreo_select_pt/__meta__ @@ -0,0 +1,10 @@ +[ + ('owner', (['acl_users'], 'dockerzope')), + ('props', [ + [('id', 'content_type'), ('type', 'string'), ('value', 'text/html')], + [('id', 'expand'), ('type', 'boolean'), ('value', 0)], + [('id', 'output_encoding'), ('type', 'string'), ('value', 'utf-8')], + ]), + ('title', ''), + ('type', 'Page Template'), +] diff --git a/mounts/zoperepo/__root__/playground/choreo_select_pt/__source-utf8__.html b/mounts/zoperepo/__root__/playground/choreo_select_pt/__source-utf8__.html new file mode 100644 index 0000000..57c6610 --- /dev/null +++ b/mounts/zoperepo/__root__/playground/choreo_select_pt/__source-utf8__.html @@ -0,0 +1,3 @@ +{{#each choreos}} + +{{/each}} \ No newline at end of file diff --git a/mounts/zoperepo/__root__/playground/example_dropdown_select_pt/__meta__ b/mounts/zoperepo/__root__/playground/example_dropdown_select_pt/__meta__ new file mode 100644 index 0000000..7a1f36c --- /dev/null +++ b/mounts/zoperepo/__root__/playground/example_dropdown_select_pt/__meta__ @@ -0,0 +1,10 @@ +[ + ('owner', (['acl_users'], 'dockerzope')), + ('props', [ + [('id', 'content_type'), ('type', 'string'), ('value', 'text/html')], + [('id', 'expand'), ('type', 'boolean'), ('value', 0)], + [('id', 'output_encoding'), ('type', 'string'), ('value', 'utf-8')], + ]), + ('title', ''), + ('type', 'Page Template'), +] diff --git a/mounts/zoperepo/__root__/playground/example_dropdown_select_pt/__source-utf8__.html b/mounts/zoperepo/__root__/playground/example_dropdown_select_pt/__source-utf8__.html new file mode 100644 index 0000000..9f18a5e --- /dev/null +++ b/mounts/zoperepo/__root__/playground/example_dropdown_select_pt/__source-utf8__.html @@ -0,0 +1,7 @@ +{{#each examples}} +
  • + + {{this.example_title}} + +
  • +{{/each}} \ No newline at end of file diff --git a/mounts/zoperepo/__root__/playground/example_select_pt/__meta__ b/mounts/zoperepo/__root__/playground/example_select_pt/__meta__ new file mode 100644 index 0000000..7a1f36c --- /dev/null +++ b/mounts/zoperepo/__root__/playground/example_select_pt/__meta__ @@ -0,0 +1,10 @@ +[ + ('owner', (['acl_users'], 'dockerzope')), + ('props', [ + [('id', 'content_type'), ('type', 'string'), ('value', 'text/html')], + [('id', 'expand'), ('type', 'boolean'), ('value', 0)], + [('id', 'output_encoding'), ('type', 'string'), ('value', 'utf-8')], + ]), + ('title', ''), + ('type', 'Page Template'), +] diff --git a/mounts/zoperepo/__root__/playground/example_select_pt/__source-utf8__.html b/mounts/zoperepo/__root__/playground/example_select_pt/__source-utf8__.html new file mode 100644 index 0000000..e615c63 --- /dev/null +++ b/mounts/zoperepo/__root__/playground/example_select_pt/__source-utf8__.html @@ -0,0 +1,3 @@ +{{#each examples}} + +{{/each}} \ No newline at end of file diff --git a/mounts/zoperepo/__root__/tf_live_demo/__meta__ b/mounts/zoperepo/__root__/playground/examples/__meta__ similarity index 50% rename from mounts/zoperepo/__root__/tf_live_demo/__meta__ rename to mounts/zoperepo/__root__/playground/examples/__meta__ index 4797e47..a7b94b7 100644 --- a/mounts/zoperepo/__root__/tf_live_demo/__meta__ +++ b/mounts/zoperepo/__root__/playground/examples/__meta__ @@ -1,4 +1,5 @@ [ + ('owner', (['acl_users'], 'dockerzope')), ('title', ''), ('type', 'Folder'), ] diff --git a/mounts/zoperepo/__root__/playground/examples/ant_colony/__meta__ b/mounts/zoperepo/__root__/playground/examples/ant_colony/__meta__ new file mode 100644 index 0000000..eae18fc --- /dev/null +++ b/mounts/zoperepo/__root__/playground/examples/ant_colony/__meta__ @@ -0,0 +1,7 @@ +[ + ('props', [ + [('id', 'content_type'), ('type', 'string'), ('value', 'text/javascript')], + ]), + ('title', 'Ant colony'), + ('type', 'File'), +] diff --git a/mounts/zoperepo/__root__/playground/examples/ant_colony/__source__.js b/mounts/zoperepo/__root__/playground/examples/ant_colony/__source__.js new file mode 100644 index 0000000..e322001 --- /dev/null +++ b/mounts/zoperepo/__root__/playground/examples/ant_colony/__source__.js @@ -0,0 +1,136 @@ +// https://openprocessing.org/sketch/1678056 by Naoki Tsutae +// Inspired by Sage Jenson (https://cargocollective.com/sagejenson/physarum) + +var antColor = new Uint8Array([255, 255, 255]); +var antsNum = 2750; +var sensorOffset = 25; +var clockwise = 15; +var counter = -15; +var stroke_width = 20; + +sketch = function(p) { + + let index = 0; + + const ant = () => ({ + x: p.width / 2, + y: p.height / 2, + angle: p.random(360), + step: p.random(2, 3), + }); + + const ants = { + ants: [], + + init() { + this.ants.length = 0; + for (let i = antsNum; i--; ) this.ants.push(ant()); + }, + + smell(a, d) { + const aim = a.angle + d; + let x = 0 | (a.x + sensorOffset * p.cos(aim)); + let y = 0 | (a.y + sensorOffset * p.sin(aim)); + x = (x + p.width) % p.width; + y = (y + p.height) % p.height; + + const index = (x + y * p.width) * 4; + return p.pixels[index]; // Only get red channel + }, + + updateAngle() { + for (const a of this.ants) { + const right = this.smell(a, clockwise), + center = this.smell(a, 0), + left = this.smell(a, counter); + if (center > left && center > right) { + /* Carry on straight */ + } else if (left < right) a.angle += clockwise; + else if (left > right) a.angle += counter; + } + }, + + updatePosition() { + for (const a of this.ants) { + a.x += p.cos(a.angle) * a.step; + a.y += p.sin(a.angle) * a.step; + a.x = (a.x + p.width) % p.width; + a.y = (a.y + p.height) % p.height; + + const index = ((0 | a.x) + (0 | a.y) * p.width) * 4; + p.pixels.set(antColor, index); + } + }, + }; + + p.setup = function() { + p.createCanvas(SCENE_WIDTH, SCENE_HEIGHT, p5_MODE); + p.frameRate(FPS); + p.angleMode(p.DEGREES); + p.pixelDensity(1); + p.background(0); // Initialize trail + ants.init(); + } + + p.draw = function() { + p.background(0, 5); // Update trail + p.stroke(255); + p.strokeWeight(stroke_width); + + if (!DATA) { + return + } + + if (!LIVEMODE) { + let data_chunk = DATA[index]; + for (let joint of data_chunk) { + p.line( + joint.x * SCENE_WIDTH, + joint.y * SCENE_HEIGHT, + joint.x * SCENE_WIDTH + 1, + joint.y * SCENE_HEIGHT + 1 + ) + } + if (index < DATA.length - 1) { + index++ + } else { + index = 0 + } + } else { + // in LIVEMODE we fetch our poses from global DATA + for (let pose of DATA) { + // attention! now we use "in" instead of "of" + // to get the index instead of the element directly + for (let joint_index in pose) { + let joint = pose[joint_index] + // pick separate joint to do something special + // 16 is "right_wrist", check Help/Blazepose model ! + if (joint_index == 16) { + sensorOffset = 200 * joint.z + } + // also pick left_foot_index aka 31 + if (joint_index == 31) { + stroke_width = 50 * joint.x + } + p.line( + joint.x * SCENE_WIDTH, + joint.y * SCENE_HEIGHT, + joint.x * SCENE_WIDTH + 1, + joint.y * SCENE_HEIGHT + 1 + ) + } + } + } + + //p.mouseIsPressed && p.line(p.pmouseX, p.pmouseY, p.mouseX, p.mouseY); + p.loadPixels(); + for (let i = 2; i--; ) { + ants.updateAngle(); + ants.updatePosition(); + } + p.updatePixels(); + } +} + +// make sure the following line remains unchanged! +stage = new p5(sketch, 'p5_stage') \ No newline at end of file diff --git a/mounts/zoperepo/__root__/playground/examples/chroma_hairs/__meta__ b/mounts/zoperepo/__root__/playground/examples/chroma_hairs/__meta__ new file mode 100644 index 0000000..f821c45 --- /dev/null +++ b/mounts/zoperepo/__root__/playground/examples/chroma_hairs/__meta__ @@ -0,0 +1,7 @@ +[ + ('props', [ + [('id', 'content_type'), ('type', 'string'), ('value', 'text/javascript')], + ]), + ('title', 'Chrome Hairs'), + ('type', 'File'), +] diff --git a/mounts/zoperepo/__root__/playground/examples/chroma_hairs/__source__.js b/mounts/zoperepo/__root__/playground/examples/chroma_hairs/__source__.js new file mode 100644 index 0000000..7c4adbb --- /dev/null +++ b/mounts/zoperepo/__root__/playground/examples/chroma_hairs/__source__.js @@ -0,0 +1,99 @@ +// https://openprocessing.org/sketch/1198049 by Spencer Eastcott + +var margin = 50; +var stepX; +var stepY; +var cols = 10; +var rows = 10; +var hairLength = 0.03; +var maxHairLength = 40; +var scale_factor = 200; +var gradientLength; +var radiusOffset; + +sketch = function(p) { + + let index = 0; + + hair = function(x, y, joint) { + var a = p.atan2( + (joint.x * SCENE_WIDTH) - x, + (joint.y * SCENE_HEIGHT) - y + ) + p.PI; + var d = scale_factor / p.pow( + p.dist( + (joint.x * SCENE_WIDTH), + (joint.y * SCENE_HEIGHT), x, y + ) * hairLength, + 2 + ); + var D = p.dist( + (joint.x * SCENE_WIDTH), + (joint.y * SCENE_HEIGHT), + x, + y + ) + radiusOffset; + + var g = p.sin(D * (p.TWO_PI / gradientLength)) * 255 / 2 + (255 / 2); + var r = p.sin(D * (p.TWO_PI / gradientLength) + p.TWO_PI / 3) * 255 / 2 + (255 / 2); + var b = p.sin(D * (p.TWO_PI / gradientLength) + (p.TWO_PI / 3) * 2) * 255 / 2 + (255 / 2); + + if (d > maxHairLength) { + d = maxHairLength; + } + + p.strokeWeight(4); + p.stroke(r, g, b); + p.line(x, y, (p.sin(a) * d) + x, (p.cos(a) * d) + y); + } + + p.setup = function() { + p.createCanvas(SCENE_WIDTH, SCENE_HEIGHT, p5_MODE); + p.frameRate(FPS); + var distance = [cols * rows]; + var angle = [cols * rows]; + stepX = (p.width - (2 * margin)) / (rows - 1); + stepY = (p.height - (2 * margin)) / (cols - 1); + gradientLength = p.width; + radiusOffset = -p.width / 10; + } + + p.draw = function() { + p.background('#212529'); + + if (!DATA) { + return + } + + if (!LIVEMODE) { + let data_chunk = DATA[index]; + for (let joint of data_chunk) { + for (var x = margin; x < p.width - margin + 1; x += stepX) { + for (var y = margin; y < p.height - margin + 1; y += stepY) { + hair(x, y, joint); + } + } + } + if (index < DATA.length - 1) { + index++ + } else { + index = 0 + } + } else { + for (let pose of DATA) { + for (let joint of pose) { + for (var x = margin; x < p.width - margin + 1; x += stepX) { + for (var y = margin; y < p.height - margin + 1; y += stepY) { + hair(x, y, joint); + } + } + } + } + } + + } + +} + +// make sure the following line remains unchanged! +stage = new p5(sketch, 'p5_stage') \ No newline at end of file diff --git a/mounts/zoperepo/__root__/tf_live_demo/custom_tflw.js/__meta__ b/mounts/zoperepo/__root__/playground/examples/fluid/__meta__ similarity index 71% rename from mounts/zoperepo/__root__/tf_live_demo/custom_tflw.js/__meta__ rename to mounts/zoperepo/__root__/playground/examples/fluid/__meta__ index b9386a5..46d3ce7 100644 --- a/mounts/zoperepo/__root__/tf_live_demo/custom_tflw.js/__meta__ +++ b/mounts/zoperepo/__root__/playground/examples/fluid/__meta__ @@ -1,7 +1,7 @@ [ ('props', [ - [('id', 'content_type'), ('type', 'string'), ('value', 'application/javascript')], + [('id', 'content_type'), ('type', 'string'), ('value', 'text/javascript')], ]), - ('title', ''), + ('title', 'Fluid'), ('type', 'File'), ] diff --git a/mounts/zoperepo/__root__/playground/examples/fluid/__source__.js b/mounts/zoperepo/__root__/playground/examples/fluid/__source__.js new file mode 100644 index 0000000..916c879 --- /dev/null +++ b/mounts/zoperepo/__root__/playground/examples/fluid/__source__.js @@ -0,0 +1,150 @@ +/****************** +Code by Vamoss +Original code link: +https://openprocessing.org/sketch/1799766 + +Author links: +http://vamoss.com.br +http://twitter.com/vamoss +http://github.com/vamoss +******************/ + +// https://github.com/amandaghassaei/gpu-io/blob/main/examples/fluid/index.js +var fluid; + +// https://github.com/amandaghassaei/canvas-capture +var canvasCapture; +var capturedFrames = 0; + +// Touch events. +var activeTouches = {}; +var TOUCH_DIAMETER = 25; + +var active_joints = {}; + +sketch = function(p) { + + var index = 0; + + // LIVEMODE: Memorize data + var cur_data; + var last_data; + + p.draw = function() { + fluid.draw(); + if (!LIVEMODE) { + + let cur_data_chunk = DATA[index]; + let last_data_chunk = DATA[index - 1]; + + if (!cur_data_chunk || !last_data_chunk) { + index++ + return + } + + for (let joint_idx in cur_data_chunk) { + let cur_joint = cur_data_chunk[joint_idx] + let last_joint = last_data_chunk[joint_idx] + if (!cur_joint || !last_joint) { + continue + } + let cur_pos = [cur_joint.x * SCENE_WIDTH, cur_joint.y * SCENE_HEIGHT] + let last_pos = [last_joint.x * SCENE_WIDTH, last_joint.y * SCENE_HEIGHT] + fluid.pointerMove(cur_pos, last_pos, p) + } + + if (index == DATA.length - 1) { + // no more DATA left, restart + index = 0 + } else { + // increment index for next run of draw() to create next frame + index++ + } + } else { + cur_data = DATA + if (last_data) { + if (last_data.length != cur_data.length) { + return + } + for (let pose_idx in cur_data) { + let cur_pose = cur_data[pose_idx] + let last_pose = last_data[pose_idx] + for (let joint_idx in cur_pose) { + let cur_joint = cur_pose[joint_idx] + let last_joint = last_pose[joint_idx] + let cur_pos = [cur_joint.x * SCENE_WIDTH, cur_joint.y * SCENE_HEIGHT] + let last_pos = [last_joint.x * SCENE_WIDTH, last_joint.y * SCENE_HEIGHT] + fluid.pointerMove(cur_pos, last_pos, p) + } + } + } + last_data = cur_data + } + } + + p.setup = function() { + //hack to enable p5js WEBGL2 + if(GPUIO.isWebGL2Supported()){ + p5.RendererGL.prototype._initContext = function() { + try { + this.drawingContext = + this.canvas.getContext('webgl2', this._pInst._glAttributes) || + this.canvas.getContext('experimental-webgl', this._pInst._glAttributes); + if (this.drawingContext === null) { + throw new Error('Error creating webgl2 context'); + } else { + const gl = this.drawingContext; + gl.enable(gl.DEPTH_TEST); + gl.depthFunc(gl.LEQUAL); + gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); + this._viewport = this.drawingContext.getParameter( + this.drawingContext.VIEWPORT + ); + } + } catch (er) { + throw er; + } + }; + } + console.log("init"); + + var renderer = p.createCanvas(SCENE_WIDTH, SCENE_HEIGHT, p.WEBGL); + + const RECORD_FPS = 60; + + // Init a simple gui. + //const gui = new dat.GUI(); + + fluid = new Fluid(renderer.canvas); + fluid.resize(p.width, p.height); + + } + p.mouseMoved = function(e) { + const current = [e.clientX, e.clientY]; + if (activeTouches[e.pointerId] === undefined) { + activeTouches[e.pointerId] = { + current: current, + } + return; + } + var last = activeTouches[e.pointerId].last = activeTouches[e.pointerId].current; + activeTouches[e.pointerId].current = current; + + if (current[0] == last[0] && current[1] == last[1]) { + return; + } + + fluid.pointerMove(current, last, p); + } + + p.mouseReleased = function(e) { + delete activeTouches[e.pointerId]; + } + + p.windowResized = function() { + fluid.resize(windowWidth, windowHeight); + } +} + +// make sure the following line remains unchanged! +stage = new p5(sketch, 'p5_stage') \ No newline at end of file diff --git a/mounts/zoperepo/__root__/playground/examples/glowing_boids/__meta__ b/mounts/zoperepo/__root__/playground/examples/glowing_boids/__meta__ new file mode 100644 index 0000000..78c9796 --- /dev/null +++ b/mounts/zoperepo/__root__/playground/examples/glowing_boids/__meta__ @@ -0,0 +1,7 @@ +[ + ('props', [ + [('id', 'content_type'), ('type', 'string'), ('value', 'text/javascript')], + ]), + ('title', 'Glowing boids'), + ('type', 'File'), +] diff --git a/mounts/zoperepo/__root__/playground/examples/glowing_boids/__source__.js b/mounts/zoperepo/__root__/playground/examples/glowing_boids/__source__.js new file mode 100644 index 0000000..70291da --- /dev/null +++ b/mounts/zoperepo/__root__/playground/examples/glowing_boids/__source__.js @@ -0,0 +1,278 @@ +// https://openprocessing.org/sketch/2208826 by 李秋霖 +// "The Nature of Code" authored by D. Shiffman has been referred for the +// coding of the flocking part. + +// flocking settings +var Pa = 1; // alignment +var Pc = 2; // cohesion +var Ps = 2; // separation +var Pj = 3; // joints, aka body parts + + +sketch = function(p) { + + class Boid { + constructor(x, y) { + this.pos = p.createVector(x, y); + this.vel = p.createVector(p.random(-5, 5), p.random(-5, 5)); + this.acc = p.createVector(0, 0); + this.maxforce = 0.05; + this.maxspeed = 5; + this.alignRange = p.random(0, 100); + this.separateRange = p.random(0, 100); + this.cohesiveRange = p.random(0, 100); + this.jointsRange = 100; + this.img; + } + + update() { + this.vel.add(this.acc); + this.vel.limit(this.maxspeed); + this.pos.add(this.vel); + this.acc.mult(0); + } + + display() { + p.image(this.img, this.pos.x, this.pos.y); + } + + wallThrough() { + if (this.pos.x > p.width) { + this.pos.x = 0; + } + if (this.pos.x < 0) { + this.pos.x = p.width; + } + if (this.pos.y > p.height) { + this.pos.y = 0; + } + if (this.pos.y < 0) { + this.pos.y = p.height; + } + } + + createParticleImage() { + + let side = 200; + let center = side / 2; + + this.img = p.createImage(side, side); + + let num = p.pow(10, 1.8); + + let Cr = p.map(this.alignRange, 0, 100, 100, 255); + let Cg = p.map(this.cohesiveRange, 0, 100, 100, 255); + let Cb = p.map(this.separateRange, 0, 100, 100, 255); + + this.img.loadPixels(); + for (let y = 0; y < side; y++) { + for (let x = 0; x < side; x++) { + let d = (p.sq(center - x) + p.sq(center - y))/num; + let col = p.color(Cr/d, Cg/d, Cb/d); + this.img.set(x, y, col); + } + } + this.img.updatePixels(); + return this.img; + } + + applyForce(force) { + this.acc.add(force); + } + + align(boids) { + let sum = p.createVector(0, 0); + let count = 0; + for (let other of boids) { + let d = p5.Vector.dist(this.pos, other.pos); + if (d > 0 && d < this.alignRange) { + sum.add(other.vel); + count++; + } + } + if (count > 0) { + sum.div(count); + sum.normalize(); + sum.mult(this.maxspeed); + let steer = p5.Vector.sub(sum, this.vel); + steer.limit(this.maxforce); + return steer; + } else { + return p.createVector(0, 0); + } + } + + separate(boids) { + let sum = p.createVector(0, 0); + let count = 0; + for (let other of boids) { + let d = p5.Vector.dist(this.pos, other.pos); + if (d > 0 && d < this.separateRange) { + let diff = p5.Vector.sub(this.pos, other.pos); + diff.normalize(); + diff.div(d); + sum.add(diff); + count++; + } + } + if (count > 0) { + sum.div(count); + sum.normalize(); + sum.mult(this.maxspeed); + let steer = p5.Vector.sub(sum, this.vel); + steer.limit(this.maxforce); + return steer; + } else { + return p.createVector(0, 0); + } + } + + separate_joints(joints) { + let sum = p.createVector(0, 0); + let count = 0; + for (let other of joints) { + let joint_pos = p.createVector( + other.x * SCENE_WIDTH, + other.y * SCENE_HEIGHT + ) + let d = p5.Vector.dist(this.pos, joint_pos); + if (d > 0 && d < this.jointsRange) { + let diff = p5.Vector.sub(this.pos, joint_pos); + diff.normalize(); + diff.div(d); + sum.add(diff); + count++; + } + } + if (count > 0) { + sum.div(count); + sum.normalize(); + sum.mult(this.maxspeed); + let steer = p5.Vector.sub(sum, this.vel); + steer.limit(this.maxforce); + return steer; + } else { + return p.createVector(0, 0); + } + } + + cohesive(boids) { + let sum = p.createVector(0, 0); + let count = 0; + for (let other of boids) { + let d = p5.Vector.dist(this.pos, other.pos); + if (d > 0 && d < this.cohesiveRange) { + sum.add(other.pos); + count++; + } + } + if (count > 0) { + sum.div(count); + sum.sub(this.pos) + sum.normalize(); + sum.mult(this.maxspeed); + let steer = p5.Vector.sub(sum, this.vel); + steer.limit(this.maxforce); + return steer; + } else { + return p.createVector(0, 0); + } + } + + flocking(boids, poses) { + let sep = this.separate(boids); + let ali = this.align(boids); + let coh = this.cohesive(boids); + + sep.mult(Ps); + ali.mult(Pa); + coh.mult(Pc); + + this.applyForce(sep); + this.applyForce(ali); + this.applyForce(coh); + + for (let pose of poses) { + let sepj = this.separate_joints(pose); + sepj.mult(Pj); + this.applyForce(sepj) + } + + } + } + + class Boids { + constructor() { + this.boids = []; + } + + run(poses) { + if (this.boids.length > 0) { + for (let boid of this.boids) { + boid.flocking(this.boids, poses); + boid.update(); + boid.wallThrough(); + boid.display(); + } + } + } + + addBoid(x, y) { + this.boids.push(new Boid(x, y)); + this.boids[this.boids.length - 1].createParticleImage(); + } + + reset() { + this.boids = []; + } + } + + let flock = new Boids(); + let index = 0; + + p.setup = function() { + p.createCanvas(SCENE_WIDTH, SCENE_HEIGHT); + p.blendMode(p.ADD); + p.imageMode(p.CENTER); + p.frameRate(FPS); + p.background(0); + // add 100 boids on random coordinates inside of the scene + for (let i = 0; i < 100; i++) { + flock.addBoid( + p.random(0, SCENE_WIDTH), + p.random(0, SCENE_HEIGHT) + ); + } + } + + p.draw = function() { + p.clear(); + p.background('#212529'); + + let data_chunk = DATA[index]; + + // early exit data check + if (!data_chunk) { + index = 0 + return + } + + p.stroke('white') + draw_stickfigure(p, data_chunk) + + if(!LIVEMODE) { + flock.run([data_chunk]); + if (index == DATA.length - 1) { + index = 0 + } else { + index++ + } + } else { + flock.run(DATA); + } + + } + +} + +stage = new p5(sketch, 'p5_stage') \ No newline at end of file diff --git a/mounts/zoperepo/__root__/tf_live_demo/index/__meta__ b/mounts/zoperepo/__root__/playground/examples/live_stickman/__meta__ similarity index 63% rename from mounts/zoperepo/__root__/tf_live_demo/index/__meta__ rename to mounts/zoperepo/__root__/playground/examples/live_stickman/__meta__ index fe39f71..01e3932 100644 --- a/mounts/zoperepo/__root__/tf_live_demo/index/__meta__ +++ b/mounts/zoperepo/__root__/playground/examples/live_stickman/__meta__ @@ -1,7 +1,7 @@ [ ('props', [ - [('id', 'content_type'), ('type', 'string'), ('value', 'text/html')], + [('id', 'content_type'), ('type', 'string'), ('value', 'text/javascript')], ]), - ('title', 'tensorflow-js live camera demo'), + ('title', 'Dance Challenge Stickfigure'), ('type', 'File'), ] diff --git a/mounts/zoperepo/__root__/playground/examples/live_stickman/__source__.js b/mounts/zoperepo/__root__/playground/examples/live_stickman/__source__.js new file mode 100644 index 0000000..b500877 --- /dev/null +++ b/mounts/zoperepo/__root__/playground/examples/live_stickman/__source__.js @@ -0,0 +1,60 @@ +/* + + p5js stickman example + + Specialized ( a little ) for Dance Challenge #TogetherWeDance + Use simple stickman example for other records from database! + +*/ + +// make sure the following line remains unchanged! +sketch = function(p) { + + // basic loop index to loop over DATA in draw() method + var index = 0; + + p.setup = function() { + p.createCanvas(SCENE_WIDTH, SCENE_HEIGHT, p5_MODE) + p.background('#212529') + p.frameRate(30) + } + + p.draw = function() { + + // reset canvas each frame - feel free to remove these two lines + // for interesting results + p.clear() + p.background('#212529') + p.stroke('white') + + // fetch current data chunk, describing poses in one frame + let data_chunk = DATA[index] + + // early exit data check + if (!data_chunk) { + index = 0 + return + } + + // as this is a super modern scan we do not need to distinguish between + // live and db mode anymore as we can have multiple poses in db now, too! + for (let pose of data_chunk) { + draw_stickfigure_multipose(p, pose) + } + + // loop over DATA via index variable + if (index == DATA.length - 1) { + // no more DATA left, restart + index = 0 + } else { + // increment index for next run of draw() to create next frame + index++ + } + + } + +}; + +// make sure the following line remains unchanged! +stage = new p5(sketch, 'p5_stage') + diff --git a/mounts/zoperepo/__root__/playground/examples/r1b2/__meta__ b/mounts/zoperepo/__root__/playground/examples/r1b2/__meta__ new file mode 100644 index 0000000..c4bde4d --- /dev/null +++ b/mounts/zoperepo/__root__/playground/examples/r1b2/__meta__ @@ -0,0 +1,8 @@ +[ + ('owner', (['acl_users'], 'dockerzope')), + ('props', [ + [('id', 'content_type'), ('type', 'string'), ('value', 'text/javascript')], + ]), + ('title', 'r1b2'), + ('type', 'File'), +] diff --git a/mounts/zoperepo/__root__/playground/examples/r1b2/__source__.js b/mounts/zoperepo/__root__/playground/examples/r1b2/__source__.js new file mode 100644 index 0000000..915bd07 --- /dev/null +++ b/mounts/zoperepo/__root__/playground/examples/r1b2/__source__.js @@ -0,0 +1,399 @@ +// p5js advanced example by r1b2 + +// SETTINGS/ VARIABLES START + +var EPHEMERAL = false; +var EPHEMERAL_ALPHA = 10; // 0-255. lower = longer lasting persistence +var SCENE_SCALE = 1; + +var PALETTES = [ + [ + "Autumn Rhythm", + '#d3b893', + ['#e3ded640', '#100d0340', '#99846040', '#99846040', '#4a4b5440', '#85756640', '#21211d40'] + ], + [ + "Number 1", + '#e4caa8', + ['#d2aa3440', '#30393d40', '#fff1d540', '#428e9440', '#f7ccc840', '#5c1a1440', '#10624440'] + ], + [ + "Number 18", + '#a0a18f', + ['#08090440', '#a7161b40', '#b0914140', '#eadbdc40', '#27494b40', '#c88e7a40', '#0a0a0840'] + ], + [ + "Dune", + '#0c0606', + ['#ab252640', '#e4712040', '#f8b21c40', '#e5761f40', '#d8513b40', '#fcea7340', '#35131440'] + ], + [ + "Reversion", + '#cdd2d6', + ['#00149140', '#efbb0d40', '#03010240', '#5e8aaf40', '#9c53bf20', '#b1262340', '#098d5e40'] + ], + [ + "The Abyss", + '#06060c', + ['#006d7740', '#83c5be40', '#edf6f940', '#05052040', '#05052040', '#00000040', '#f0f0f040'] + ], + [ + "Luncheon On The Grass", + '#f0f0f0', + ["#150F1840", "#44301A40", "#6F451C40", "#B0211340", "#E58D2A40", "#E2A53240", "#ADABC240"] + ], + [ + "Kandinsky", + '#f0f0f0', + ["#80948640", "#194B6D40", "#D7100E40", "#11121940", "#D9771C40", "#59231940", "#EDE5DA40"] + ] +]; + +var JOINTS = [ + "LEFT_INDEX", + "RIGHT_INDEX", + "LEFT_ELBOW", + "RIGHT_ELBOW", + "LEFT_HIP", + "LEFT_WRIST", + "RIGHT_WRIST" +]; + +var PALETTE; +var SUBDATA; +var PAINTLINES; +var DRIPS = []; + +// basic loop index to loop over DATA in draw() method +var index = 0; + +// SETTINGS/ VARIABLES END + +// HELPER FUNCTIONS START + +// helper functions which may live outside of the sketch scope +// as they don't rely on p5 components ( call stuff from p namespace ) + +// https://github.com/google/mediapipe/blob/master/docs/solutions/pose.md +function findJoinByName(frameidx, name) +{ + let frame = DATA[frameidx]; + let joint = frame[JOINTS_BY_NAME[name]] + + if (joint) { + return joint + } else { + return false + } +} + +// https://www.desmos.com/calculator/1930qsv4kw +function parabolaInterpolator(y0, y1, y2) +{ + var a = (y2 - 2 * y1 + y0) / 2; + var b = (y1 - y0 - a); + return (x) => a * x * x + b * x + y0; +} + +function getJointPosition(frame, jointnr) +{ + if (LIVEMODE) { + let idx = findJoinByName(frame, JOINTS[jointnr]); + return [idx.x, idx.y]; + } else { + return [SUBDATA[frame][2 * jointnr], SUBDATA[frame][2 * jointnr + 1]]; + } +} + +// HELPER FUNCTIONS END + +// MAIN PART START + +// create our sketch environment and wrap all p5-related stuff in it +// this is done to encapsulate the p5 namespace ( behind "p." ) and +// to plug it into the p5 stage at the p5 playground + +sketch = function(p) { + + function randomizeColor(c) + { + var c0 = p.color(c); + var r = p.random(-30, 30); + return p.color(p.red(c0) + r, p.green(c0) + r, p.blue(c0) + r, p.alpha(c0)); + } + + class Drip + { + + constructor(color, x, y, dx, dy, weight) + { + this.color = color; + this.x = x; + this.y = y; + this.dx = dx; + this.dy = dy; + this.weight = weight; + this.k = 2.0; + } + + update() + { + var k = p.random(0.5, 1); + this.x += p.random(-4, 4) / SCENE_WIDTH + k * this.dx; + this.y += p.random(-4, 4) / SCENE_HEIGHT + k * this.dy; + p.fill(randomizeColor(this.color)); + p.noStroke(); + p.circle(this.x * SCENE_WIDTH, this.y * SCENE_HEIGHT, this.weight * this.k); + this.k *= 0.95; + return (this.k >= 0.5); + } + + } + + class PaintLine + { + + constructor(color, x, y) + { + this.color = color; + this.x = x; + this.y = y; + this.x2 = x; + this.y2 = y; + this.weight = SCENE_SCALE; + this.speed2 = 0; + } + + directionChangedX(x) + { + return (this.x - x) * (this.x - this.x2) > 0; + } + + directionChangedY(y) + { + return (this.y - y) * (this.y - this.y2) > 0; + } + + move(x, y) + { + + // compute parabola interpolation + var px = parabolaInterpolator(this.x2, this.x, x); + var py = parabolaInterpolator(this.y2, this.y, y); + + var dx = x - this.x; + var dy = y - this.y; + var speed2 = dx * dx + dy * dy; + if (speed2 < 0.00000001) + { + var ndrops = p.random(1, 3); + for (var i = 0; i < ndrops; ++i) + { + DRIPS.push( + new Drip( + this.color, + x + p.random(-1, 1) / SCENE_WIDTH, + y + p.random(-1, 1) / SCENE_HEIGHT, + 0.0, + p.random(1.0, 2.0) / SCENE_HEIGHT, + p.random(4, 10.0) * SCENE_SCALE + ) + ); + } + } + else if (speed2 > 400 / (SCENE_WIDTH * SCENE_WIDTH)) + { + if (this.directionChangedX(x) || this.directionChangedY(y)) + { + var ndrops = p.random(4, 18); + for (var i = 0; i < ndrops; ++i) + { + var r = p.random(1.0, 2.0); + DRIPS.push( + new Drip( + this.color, + px(1.1 + 0.25 * r), + py(1.1 + 0.25 * r), + 0.1 * dx, 0.1 * dy, + r * SCENE_SCALE + ) + ); + } + } + } + else if (speed2 < 0.0125 * this.speed2) + { + if (p.random() < 0.5) + { + for (var i = 0; i < 8; ++i) + { + DRIPS.push( + new Drip( + this.color, + x + p.random(-20, 20) / SCENE_WIDTH, + y + p.random(-20, 20) / SCENE_WIDTH, + p.random(3.0, 4.0) + ) + ); + } + } + } + + this.speed2 = speed2; + + var weight = (10 - 0.2 * 800 * (p.pow(speed2, 0.3))); + if (weight < 1.5) weight = 1.5; + weight *= p.random(0.5, 1.5); + this.weight = 0.5 * this.weight + 0.5 * weight; + p.strokeWeight(this.weight * SCENE_SCALE); + p.stroke(randomizeColor(this.color)); + p.noFill(); + + var prevx = this.x; + var prevy = this.y; + for (var i = 1; i <= 10; ++i) + { + var newx = px(1.0 + i * 0.1); + var newy = py(1.0 + i * 0.1); + p.line( + prevx * SCENE_WIDTH, + prevy * SCENE_HEIGHT, + newx * SCENE_WIDTH, + newy * SCENE_HEIGHT + ); + prevx = newx; prevy = newy; + } + + this.x2 = this.x; + this.y2 = this.y; + this.x = x; + this.y = y; + } + } + + + + p.setup = function() + { + PALETTE = PALETTES[(0.5 + p.random() * (PALETTES.length - 1)) | 0]; + p.createCanvas(SCENE_WIDTH, SCENE_HEIGHT, p5_MODE); + + p.clear(); + p.background(PALETTE[1]); + p.frameRate(FPS); + + // compute the x/y range to center the artwork + if (!LIVEMODE) + { + SUBDATA = []; + var xrange = [1.0, 0.0]; + var yrange = [1.0, 0.0]; + + var rangeCheck = (x, y) => { + if (x < xrange[0]) xrange[0] = x; + if (x > xrange[1]) xrange[1] = x; + if (y < yrange[0]) yrange[0] = y; + if (y > yrange[1]) yrange[1] = y; + }; + + //console.log("parsing"); + for (var i = 0; i < DATA.length; ++i) + { + let data_chunk = DATA[i]; + + // early exit data check + if (!data_chunk || data_chunk.keypoints) + { + break; + } + + + var nextFrame = []; + for (var j = 0; j < JOINTS.length; ++j) + { + let idx = findJoinByName(i, JOINTS[j]); + if (idx) + { + nextFrame.push(idx.x); + nextFrame.push(idx.y); + rangeCheck(idx.x, idx.y); + } + else + { + nextFrame = []; + break; + } + } + if (nextFrame.length) SUBDATA.push(nextFrame); + } + + // recenter SUBDATA + // 0.3....0.6 => 0.35...0.65, dx=0.5-0.9/2 = 0.05 + var kx = 0.8 / (xrange[1] - xrange[0]); + var ky = 0.8 / (yrange[1] - yrange[0]); + + var dx = 0.5 - kx * (xrange[1] + xrange[0]) / 2; + var dy = 0.5 - ky * (yrange[1] + yrange[0]) / 2; + for (var i = 0; i < SUBDATA.length; ++i) + { + SUBDATA[i][0] = SUBDATA[i][0] * kx + dx; + SUBDATA[i][2] = SUBDATA[i][2] * kx + dx; + SUBDATA[i][4] = SUBDATA[i][4] * kx + dx; + SUBDATA[i][1] = SUBDATA[i][1] * ky + dy; + SUBDATA[i][3] = SUBDATA[i][3] * ky + dy; + SUBDATA[i][5] = SUBDATA[i][5] * ky + dy; + } + } + PAINTLINES = []; + var colors = PALETTE[2]; + for (var i = 0; i < colors.length; ++i) + { + var [x, y] = getJointPosition(0, i); + PAINTLINES.push(new PaintLine(colors[i], x, y)); + } + index = 0; + } + + p.draw = function() { + + if (EPHEMERAL) + { + var bg = p.color(PALETTE[1]); + bg.setAlpha(EPHEMERAL_ALPHA); + p.fill(bg); + p.rect(0, 0, SCENE_WIDTH, SCENE_HEIGHT); + } + + const nframes = LIVEMODE ? DATA.length : SUBDATA.length; + + if (!LIVEMODE) { + index++; + } else { + index = 0; + } + + if (index >= nframes) + { + if (!EPHEMERAL || index >= nframes + 200) p.noLoop(); + return; + } + + for (var i = 0; i < PAINTLINES.length; ++i) + { + let [x, y] = getJointPosition(index, i); + PAINTLINES[i].move(x, y); + } + + var i = 0; + while (i < DRIPS.length) + { + if (DRIPS[i].update()) i++; + else DRIPS.splice(i, 1); + } + + } + +} + +// make sure the following line remains unchanged! +stage = new p5(sketch, 'p5_stage') diff --git a/mounts/zoperepo/__root__/playground/examples/stickman/__meta__ b/mounts/zoperepo/__root__/playground/examples/stickman/__meta__ new file mode 100644 index 0000000..ab7e144 --- /dev/null +++ b/mounts/zoperepo/__root__/playground/examples/stickman/__meta__ @@ -0,0 +1,7 @@ +[ + ('props', [ + [('id', 'content_type'), ('type', 'string'), ('value', 'text/javascript')], + ]), + ('title', 'Simple stickman'), + ('type', 'File'), +] diff --git a/mounts/zoperepo/__root__/playground/examples/stickman/__source__.js b/mounts/zoperepo/__root__/playground/examples/stickman/__source__.js new file mode 100644 index 0000000..ef32f49 --- /dev/null +++ b/mounts/zoperepo/__root__/playground/examples/stickman/__source__.js @@ -0,0 +1,112 @@ +/* + + p5js stickman example + Base example on how to work with Playground + + For global variables check javascript helpers and variables in help menu + +*/ + +// make sure the following line remains unchanged! +sketch = function(p) { + + // basic loop index to loop over DATA in draw() method + var index = 0; + + p.setup = function() { + p.createCanvas(SCENE_WIDTH, SCENE_HEIGHT, p5_MODE) + p.background('#212529') + p.frameRate(FPS) + } + + p.draw = function() { + + // reset canvas each frame - feel free to remove these two lines + // for interesting results + p.clear() + p.background('#212529') + p.stroke('white') + + // fetch current data chunk, which is either one frame from database record + // OR the current frame scanned via webcam in LIVEMODE + let data_chunk = DATA[index] + + // early exit data check + if (!data_chunk) { + index = 0 + return + } + + if (LIVEMODE) { + for (let pose of DATA) { + draw_stickfigure(p, pose) + } + return + } + + draw_stickfigure(p, data_chunk) + + // loop to create stickman left hand from HAND_MAP + for (let first_bpindex in HAND_MAP) { + let point_list = HAND_MAP[first_bpindex] + for (let pindex in point_list) { + let second_bpindex = point_list[pindex] + let first_point = find_by_bpindex(data_chunk, first_bpindex, "left_hand") + let second_point = find_by_bpindex(data_chunk, second_bpindex, "left_hand") + + // make sure we've found useful data, skip if not found + if (!first_point || !second_point) { + continue + } + + // make sure to multiply normalized coordinates to get correct coordinates + let x1 = first_point.x * SCENE_WIDTH + let x2 = second_point.x * SCENE_WIDTH + let y1 = first_point.y * SCENE_HEIGHT + let y2 = second_point.y * SCENE_HEIGHT + + p.line(x1, y1, x2, y2) + + } + } + + // loop to create stickman right hand from HAND_MAP + for (let first_bpindex in HAND_MAP) { + let point_list = HAND_MAP[first_bpindex] + for (let pindex in point_list) { + let second_bpindex = point_list[pindex] + let first_point = find_by_bpindex(data_chunk, first_bpindex, "right_hand") + let second_point = find_by_bpindex(data_chunk, second_bpindex, "right_hand") + + // make sure we've found useful data, skip if not found + if (!first_point || !second_point) { + continue + } + + // make sure to multiply normalized coordinates to get correct coordinates + let x1 = first_point.x * SCENE_WIDTH + let x2 = second_point.x * SCENE_WIDTH + let y1 = first_point.y * SCENE_HEIGHT + let y2 = second_point.y * SCENE_HEIGHT + + p.line(x1, y1, x2, y2) + + } + } + + // loop over DATA via index variable + if (index == DATA.length - 1) { + // no more DATA left, restart + index = 0 + } else { + // increment index for next run of draw() to create next frame + index++ + } + + } + +}; + +// make sure the following line remains unchanged! +stage = new p5(sketch, 'p5_stage') + diff --git a/mounts/zoperepo/__root__/playground/examples/tornado/__meta__ b/mounts/zoperepo/__root__/playground/examples/tornado/__meta__ new file mode 100644 index 0000000..e6f9696 --- /dev/null +++ b/mounts/zoperepo/__root__/playground/examples/tornado/__meta__ @@ -0,0 +1,8 @@ +[ + ('owner', (['acl_users'], 'dockerzope')), + ('props', [ + [('id', 'content_type'), ('type', 'string'), ('value', 'text/javascript')], + ]), + ('title', 'Tornado visual'), + ('type', 'File'), +] diff --git a/mounts/zoperepo/__root__/playground/examples/tornado/__source__.js b/mounts/zoperepo/__root__/playground/examples/tornado/__source__.js new file mode 100644 index 0000000..21e218a --- /dev/null +++ b/mounts/zoperepo/__root__/playground/examples/tornado/__source__.js @@ -0,0 +1,139 @@ +// p5js - "tornado taz" visuals demo + +// Intended to give an example on how to work with DATA similar +// to the stickman example, but with more interesting curves between +// somehow arbitrary joints + +// edginess, green color value and alpha are calculated via z-coordinate +// differences of lines defined below +// use these values for scaling and tinkering on the effect of z-axis +// differences +var edginess_scale = 40 // high value: bezier slowly becomes a line +var green_scale = 300 // color intensity z-axis differences "sensibility" +var alpha_scale = 400 // lower value: only draw/highlight high z-axis differences + +var start_frame = 0 + +// time-based red color scaling +var step_red_scale = 150 + +// we don't need each frame? use this to control frame step size +var step_size = 5 // higher value = use less frames for complete image + +// precalcultate number of steps to be drawn +var steps = (DATA.length - start_frame) / step_size + +// derived from +// https://github.com/google/mediapipe/blob/master/docs/solutions/pose.md +// ... but connected in "nonhuman" way ( e.g. nose and ankles aka 0: [27, 28] ) +var curve_map = { + 0 : [27, 28], + 11: [12, 25, 27], + 12: [26, 28], + 13: [14, 27], + 14: [28], + 27: [28], + 15: [16, 27], + 16: [28], + 25: [26], +} + +// make sure the following line remains unchanged! +sketch = function(p) { + + // index to access DATA in draw() method + let index = start_frame + + // draw step counter + let cur_step = 0 + + p.setup = function() { + // for development considers removing SVG flag from next line + p.createCanvas(SCENE_WIDTH, SCENE_HEIGHT, p5_MODE) + p.background('black') + p.frameRate(FPS) + } + + p.draw = function() { + + // background + p.noStroke() + p.fill(0, 1) + p.rect(0, 0, SCENE_WIDTH, SCENE_HEIGHT) + + // fetch current data_chunk aka frame + let data_chunk = DATA[index] + + // early exit data check + if (!data_chunk) { + if (LIVEMODE) { + index = 0 + cur_step = 0 + } else { + p.noLoop() + return + } + } + + // loop to create taz body from curve_map + for (let first_bpindex in curve_map) { + let point_list = curve_map[first_bpindex] + for (let pindex in point_list) { + let second_bpindex = point_list[pindex] + let first_point = find_by_bpindex(data_chunk, first_bpindex, "body") + let second_point = find_by_bpindex(data_chunk, second_bpindex, "body") + + // make sure we've found useful data, skip if not found + if (!first_point || !second_point) { + continue + } + + // make sure to multiply normalized coordinates to get correct coordinates + let x1 = first_point.x * SCENE_WIDTH + let x2 = second_point.x * SCENE_WIDTH + let y1 = first_point.y * SCENE_HEIGHT + let y2 = second_point.y * SCENE_HEIGHT + + // z-axis difference calculations + let z_dist = first_point.z - second_point.z + let z_abs = p.abs(z_dist) + let green = z_abs * green_scale + let alpha = z_abs * alpha_scale + let edginess = z_dist * edginess_scale + + // decrease red color by time passed + let red = step_red_scale - (cur_step / steps) * step_red_scale + + p.stroke(red, green, 0, alpha) + + p.bezier( + x1, y1, + x1 + (SCENE_WIDTH / edginess), y1 + (SCENE_HEIGHT / edginess), + x2 - (SCENE_WIDTH / edginess), y2 + (SCENE_HEIGHT / edginess), + x2, y2 + ) + } + } + + // loop over DATA via index variable + if (index >= DATA.length - 1) { + if (LIVEMODE) { + index = 0 + cur_step = 0 + } else { + p.noLoop() + return + } + } else { + // increment index for next run of draw() to create next frame + index = index + step_size + // ... also memorize real step count + cur_step++ + } + + } + +}; + +// make sure the following line remains unchanged! +stage = new p5(sketch, 'p5_stage') diff --git a/mounts/zoperepo/__root__/playground/examples/type_treatment/__meta__ b/mounts/zoperepo/__root__/playground/examples/type_treatment/__meta__ new file mode 100644 index 0000000..1319aed --- /dev/null +++ b/mounts/zoperepo/__root__/playground/examples/type_treatment/__meta__ @@ -0,0 +1,7 @@ +[ + ('props', [ + [('id', 'content_type'), ('type', 'string'), ('value', 'text/javascript')], + ]), + ('title', 'Type Treatment'), + ('type', 'File'), +] diff --git a/mounts/zoperepo/__root__/playground/examples/type_treatment/__source__.js b/mounts/zoperepo/__root__/playground/examples/type_treatment/__source__.js new file mode 100644 index 0000000..f0e6d80 --- /dev/null +++ b/mounts/zoperepo/__root__/playground/examples/type_treatment/__source__.js @@ -0,0 +1,175 @@ +// https://openprocessing.org/sketch/1789074 by Sam Darlow +var fontSize = 70 +var scaleRate = 5 +var message = 'Interfaces' +var inpactRange = 15; +var canvas; +var textData = []; +var dotsCordinate = []; +var particles =[]; +var myFont; + +sketch = function(p) { + + var index = 0; + + class Particle { + constructor(x, y) { + this.x = x; + this.y = y; + this.r = 2; + this.originalX = x; + this.originalY = y; + this.color = Math.floor(Math.random()*360); + this.density = Math.random() * 30 + 10; + } + + draw() { + p.fill(this.color); + p.circle(this.x, this.y, this.r * 2); + } + + update(poses) { + + let distanceToOrigin = Math.sqrt( + (this.originalX - this.x) ** 2 + (this.originalY - this.y) ** 2 + ); + + let forced = false; + for (let pose of poses) { + for (let joint of pose) { + let distanceToJoint = Math.sqrt( + (this.x - (joint.x * SCENE_WIDTH)) ** 2 + + (this.y - (joint.y * SCENE_HEIGHT)) ** 2 + ) + if (distanceToJoint < inpactRange) { + let repulsionAngle = Math.atan2( + this.y - (joint.y * SCENE_HEIGHT), + this.x - (joint.x * SCENE_WIDTH) + ); + let repulsionForce = ( + (inpactRange - distanceToJoint) / inpactRange * + this.density + ); + this.x += Math.cos(repulsionAngle) * repulsionForce; + this.y += Math.sin(repulsionAngle) * repulsionForce; + forced = true; + } + } + } + + if (!forced) { + let attractionAngle = Math.atan2( + this.originalY - this.y, + this.originalX - this.x + ); + let attractionForce = Math.abs(distanceToOrigin) / this.density; + this.x += Math.cos(attractionAngle) * attractionForce; + this.y += Math.sin(attractionAngle) * attractionForce; + } + + } + } + + getTextData = function(message) { + const data = []; + p.text(message, 0, 25); // draw once and get data + for(let y = 0; y < p.textAscent(message); y++){ + let row = []; + for(let x = 0; x < p.textWidth(message); x++){ + row.push(canvas.get(x, y)) // get data, [r, g, b, a] + } + data.push(row); + } + return data; + } + + getCordinates = function() { + const cordinate = [] + for (let y = 0; y < textData.length; y++) { + let row = [] + for (let x = 0; x < textData[0].length; x++) { + // the data equals [0, 0, 0, 255] or [255, 255,255, 255]. + // So pick up red value and judge + let red = textData[y][x][0]; + // if < 128, regard the pixel as 'black'(1); + if (red < 128) { + row.push(1); + }else{ + row.push(0); + } + } + dotsCordinate.push(row); + } + return cordinate + } + + createParticles = function(scaleRate, marginX, marginY) { + const particles = []; + for (let y = 0; y < dotsCordinate.length; y++) { + for(let x = 0; x < dotsCordinate[0].length; x++){ + if(dotsCordinate[y][x] === 1){ + let particle = new Particle( + x * scaleRate + marginX, + y * scaleRate + marginY + ); + particles.push(particle) + } + } + } + return particles + } + + p.preload = function() { + myFont = p.loadFont('/lib/assets/fonts/Disclaimer-Plain.otf'); + } + + p.setup = function() { + p.frameRate(FPS); + canvas = p.createCanvas(SCENE_WIDTH, SCENE_HEIGHT); + p.colorMode(p.RGB) + p.noStroke(); + p.background("#EAD5E1"); + p.fill("#273E55"); + p.textSize(fontSize); + p.textAlign(p.LEFT, p.CENTER); + p.textFont(myFont); + textData = getTextData(message); + dotCordinate = getCordinates(); + particles = createParticles(scaleRate, 50, 0); + } + p.draw = function() { + p.background('#212529'); + let data_chunk = DATA[index]; + + // early exit data check + if (!data_chunk) { + index = 0 + return + } + + particles.forEach(p => { + if (!LIVEMODE) { + p.update([data_chunk]); + } else { + p.update(DATA); + } + p.draw() + }) + + if (!LIVEMODE) { + // loop over DATA via index variable + if (index == DATA.length - 1) { + // no more DATA left, restart + index = 0 + } else { + // increment index for next run of draw() to create next frame + index++ + } + } + + } +} + +// make sure the following line remains unchanged! +stage = new p5(sketch, 'p5_stage') \ No newline at end of file diff --git a/mounts/zoperepo/__root__/playground/examples_js/__meta__ b/mounts/zoperepo/__root__/playground/examples_js/__meta__ new file mode 100644 index 0000000..16379b0 --- /dev/null +++ b/mounts/zoperepo/__root__/playground/examples_js/__meta__ @@ -0,0 +1,14 @@ +[ + ('args', ''), + ('bindings', [ + ('name_container', 'container'), + ('name_context', 'context'), + ('name_m_self', 'script'), + ('name_subpath', 'traverse_subpath'), + ]), + ('owner', (['acl_users'], 'dockerzope')), + ('proxy_roles', [ + ]), + ('title', 'Fetch examples from examples folder and create one js file from it'), + ('type', 'Script (Python)'), +] diff --git a/mounts/zoperepo/__root__/playground/examples_js/__source__.py b/mounts/zoperepo/__root__/playground/examples_js/__source__.py new file mode 100644 index 0000000..990176b --- /dev/null +++ b/mounts/zoperepo/__root__/playground/examples_js/__source__.py @@ -0,0 +1,17 @@ +request = container.REQUEST +response = request.response + +examples = context.examples.objectIds() + +js = ["EXAMPLES = {}"] + +for example_name in examples: + example = getattr(context.examples, example_name) + res = str(example) + text = "var {name} = `".format(name=example.id) + res + "`" + js.append(text) + more = "EXAMPLES.{name} = {name}".format(name=example.id) + js.append(more) + +response.setHeader('Content-Type', 'application/javascript') +return "\n".join(js) diff --git a/mounts/zoperepo/__root__/tf_upload_demo/index_html/__meta__ b/mounts/zoperepo/__root__/playground/get_examples/__meta__ similarity index 86% rename from mounts/zoperepo/__root__/tf_upload_demo/index_html/__meta__ rename to mounts/zoperepo/__root__/playground/get_examples/__meta__ index 8b64a46..ac23c35 100644 --- a/mounts/zoperepo/__root__/tf_upload_demo/index_html/__meta__ +++ b/mounts/zoperepo/__root__/playground/get_examples/__meta__ @@ -6,6 +6,7 @@ ('name_m_self', 'script'), ('name_subpath', 'traverse_subpath'), ]), + ('owner', (['acl_users'], 'dockerzope')), ('proxy_roles', [ ]), ('title', ''), diff --git a/mounts/zoperepo/__root__/playground/get_examples/__source__.py b/mounts/zoperepo/__root__/playground/get_examples/__source__.py new file mode 100644 index 0000000..c2f7e70 --- /dev/null +++ b/mounts/zoperepo/__root__/playground/get_examples/__source__.py @@ -0,0 +1,18 @@ +import json + +request = container.REQUEST +response = request.response + +examples = context.examples.objectIds() +result = [] + +for example_name in examples: + example = getattr(context.examples, example_name) + example_d = { + "example_id": example.id, + "example_title": example.title or 'dummy!', + } + result.append(example_d) + +response.setHeader('Content-Type', 'application/json') +return json.dumps({"examples": result}) diff --git a/mounts/zoperepo/__root__/playground/index_html/__meta__ b/mounts/zoperepo/__root__/playground/index_html/__meta__ new file mode 100644 index 0000000..dd6eb5c --- /dev/null +++ b/mounts/zoperepo/__root__/playground/index_html/__meta__ @@ -0,0 +1,10 @@ +[ + ('owner', (['acl_users'], 'dockerzope')), + ('props', [ + [('id', 'content_type'), ('type', 'string'), ('value', 'text/html')], + [('id', 'expand'), ('type', 'boolean'), ('value', 0)], + [('id', 'output_encoding'), ('type', 'string'), ('value', 'utf-8')], + ]), + ('title', 'Interfaces'), + ('type', 'Page Template'), +] diff --git a/mounts/zoperepo/__root__/playground/index_html/__source-utf8__.html b/mounts/zoperepo/__root__/playground/index_html/__source-utf8__.html new file mode 100644 index 0000000..a93d1a4 --- /dev/null +++ b/mounts/zoperepo/__root__/playground/index_html/__source-utf8__.html @@ -0,0 +1,1009 @@ +

    +

    + + + + + + + + + + + + + + + + + + + + + +
    + + + +
    + +
    +
    + + +
    +
    + +
    + +
    +
    + + +
    +
    + + + + + Not connected + + Broadcast inactive + +
    +
    + + + + + + + + + + + +
    +
    +
    + +
    + +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    + + +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    + +
    + +
    +
    + +
    +
    +
    + + + + + + + + + + +
    +

    \ No newline at end of file diff --git a/mounts/zoperepo/__root__/tf_upload_demo/index/__meta__ b/mounts/zoperepo/__root__/playground/playground_css/__meta__ similarity index 90% rename from mounts/zoperepo/__root__/tf_upload_demo/index/__meta__ rename to mounts/zoperepo/__root__/playground/playground_css/__meta__ index 48556e3..f59cee2 100644 --- a/mounts/zoperepo/__root__/tf_upload_demo/index/__meta__ +++ b/mounts/zoperepo/__root__/playground/playground_css/__meta__ @@ -1,6 +1,6 @@ [ ('props', [ - [('id', 'content_type'), ('type', 'string'), ('value', 'text/html')], + [('id', 'content_type'), ('type', 'string'), ('value', 'text/css')], ]), ('title', ''), ('type', 'File'), diff --git a/mounts/zoperepo/__root__/playground/playground_css/__source__.css b/mounts/zoperepo/__root__/playground/playground_css/__source__.css new file mode 100644 index 0000000..46bb1a9 --- /dev/null +++ b/mounts/zoperepo/__root__/playground/playground_css/__source__.css @@ -0,0 +1,6 @@ +/*#p5_stage, +*/ +#webcam_stage { + width: 640px; + height: 480px; +} \ No newline at end of file diff --git a/mounts/zoperepo/__root__/tf_live_demo/custom_tflw.js/__source__.js b/mounts/zoperepo/__root__/tf_live_demo/custom_tflw.js/__source__.js deleted file mode 100644 index 65475b1..0000000 --- a/mounts/zoperepo/__root__/tf_live_demo/custom_tflw.js/__source__.js +++ /dev/null @@ -1,139 +0,0 @@ -// Fire Effect -// The Coding Train / Daniel Shiffman -// https://thecodingtrain.com/CodingChallenges/103-fire-effect.html -// https://youtu.be/X0kjv0MozuY - -// Algorithm: https://web.archive.org/web/20160418004150/http://freespace.virgin.net/hugo.elias/models/m_fire.htm - - -$(function() { - - var myModalEl = document.querySelector('#upload_modal') - var modal = bootstrap.Modal.getOrCreateInstance(myModalEl) - - $("#upload_btn").click(function(event) { - console.log(event) - - let choreo_name = $("#choreo_name").val() - let choreo_author = $("#choreo_author").val() - let choreo_type = $("#choreo_type").val() - - if (!choreo_name || !choreo_author || !choreo_type) { - console.log("Nein brauche alle Felder") - return - } - - let formData = new FormData() - formData.append('name', choreo_name) - formData.append('author', choreo_author) - formData.append('type_id', choreo_type) - formData.append('rawdata', JSON.stringify(GLOBAL_RECORDING)) - - GLOBAL_RECORDING = [] - - $.ajax({ - url : 'choreo/add', - type : 'POST', - data : formData, - cache: false, - processData: false, // tell jQuery not to process the data - contentType: false, // tell jQuery not to set contentType - enctype: 'multipart/form-data', - success : function(data) { - modal.hide() - }, - error: function() { - alert("something went wrong!") - modal.hide() - } - }); - - }) - - $("#download_btn").click(function(event) { - - let choreo_name = $("#choreo_name").val() - - if (!choreo_name) { - console.log("Nein brauche Name") - return - } - - downloadObjectAsJson(GLOBAL_RECORDING, choreo_name) - - GLOBAL_RECORDING = [] - modal.hide() - - }) - - $("#record_start_btn").click(function(event) { - $("#recording_state").show() - recording = true - }) - $("#record_stop_btn").click(function(event) { - $("#recording_state").hide() - recording = false; - modal.show() - - }) - - // p5 stuff - START - let sketch = function(p) { - - let symmetry = 6; - - let angle = 360 / symmetry; - - p.setup = function() { - p.createCanvas(640, 480); - p.angleMode(p.DEGREES); - p.background(127); - } - - p.draw = function() { - - if (!GLOBAL_POSES) { - return; - } - p.translate(p.width / 2, p.height / 2); - - let new_n_x = GLOBAL_POSES[0].keypoints[0].x - let new_n_y = GLOBAL_POSES[0].keypoints[0].y - - let new_n_x2 = GLOBAL_POSES[0].keypoints[1].x - let new_n_y2 = GLOBAL_POSES[0].keypoints[1].y - - - if (new_n_x > 0 && new_n_x < p.width && new_n_y > 0 && new_n_y < p.height) { - let mx = new_n_x - p.width / 2; - let my = new_n_y - p.height / 2; - let pmx = new_n_x2 - p.width / 2; - let pmy = new_n_y2 - p.height / 2; - - for (let i = 0; i < symmetry; i++) { - p.rotate(angle); - p.strokeWeight(1); - p.line(mx, my, pmx, pmy); - p.push(); - p.scale(1, -1); - p.line(mx, my, pmx, pmy); - p.pop(); - } - } - } - - }; - new p5(sketch, 'p5_stage'); - - -}) - -function downloadObjectAsJson(exportObj, exportName){ - var dataStr = "data:text/json;charset=utf-8," + encodeURIComponent(JSON.stringify(exportObj)); - var downloadAnchorNode = document.createElement('a'); - downloadAnchorNode.setAttribute("href", dataStr); - downloadAnchorNode.setAttribute("download", exportName + ".json"); - document.body.appendChild(downloadAnchorNode); // required for firefox - downloadAnchorNode.click(); - downloadAnchorNode.remove(); -} \ No newline at end of file diff --git a/mounts/zoperepo/__root__/tf_live_demo/index/__source__.html b/mounts/zoperepo/__root__/tf_live_demo/index/__source__.html deleted file mode 100644 index 2b2bbeb..0000000 --- a/mounts/zoperepo/__root__/tf_live_demo/index/__source__.html +++ /dev/null @@ -1,103 +0,0 @@ -
    - - -
    - - - - -

    Tensorflow-JS Live recorder

    - -
    - - - -
    -
    -
    -
    -
    - - -
    -
    - - -
    -
    - - - - - - - - - - - - - - - - - - -
    -
    diff --git a/mounts/zoperepo/__root__/tf_live_demo/index_html/__source__.py b/mounts/zoperepo/__root__/tf_live_demo/index_html/__source__.py deleted file mode 100644 index b450ede..0000000 --- a/mounts/zoperepo/__root__/tf_live_demo/index_html/__source__.py +++ /dev/null @@ -1,3 +0,0 @@ -request = container.REQUEST -resp = request.RESPONSE -resp.redirect('index?model=movenet') diff --git a/mounts/zoperepo/__root__/tf_live_demo/tflw-pose-detection.js.map/__source__.map b/mounts/zoperepo/__root__/tf_live_demo/tflw-pose-detection.js.map/__source__.map deleted file mode 100644 index 26a14c7..0000000 --- a/mounts/zoperepo/__root__/tf_live_demo/tflw-pose-detection.js.map/__source__.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../../../../../../tfjs-core/src/backends/backend.ts","../../../../../tfjs-core/src/util_base.ts","../../../../../tfjs-core/src/environment.ts","node_modules/process/browser.js","../../../../../tfjs-core/src/global_util.ts","../../../../../tfjs-core/src/kernel_names.ts","../../../../../tfjs-core/src/log.ts","../../../../../tfjs-core/src/kernel_registry.ts","node_modules/long/src/long.js","../../../../../tfjs-core/src/hash_util.ts","../../../../../tfjs-core/src/util.ts","../../../../../tfjs-core/src/profiler.ts","../../../../../tfjs-core/src/tape.ts","../../../../../tfjs-core/src/tensor_format.ts","../../../../../tfjs-core/src/tensor.ts","../../../../../tfjs-core/src/types.ts","../../../../../tfjs-core/src/tensor_util.ts","../../../../../tfjs-core/src/engine.ts","../../../../../tfjs-core/src/device_util.ts","../../../../../tfjs-core/src/flags.ts","../../../../../tfjs-core/src/tensor_util_env.ts","../../../../../../tfjs-core/src/ops/operation.ts","../../../../../../tfjs-core/src/ops/complex.ts","../../../../../../tfjs-core/src/ops/tensor_ops_util.ts","../../../../../../tfjs-core/src/ops/tensor.ts","../../../../../../tfjs-core/src/io/types.ts","node_modules/base64-js/index.js","node_modules/ieee754/index.js","node_modules/isarray/index.js","node_modules/buffer/index.js","../../../../../../tfjs-core/src/io/io_utils.ts","../../../../../../tfjs-core/src/io/router_registry.ts","../../../../../../tfjs-core/src/io/indexed_db.ts","../../../../../../tfjs-core/src/io/local_storage.ts","../../../../../../tfjs-core/src/io/model_management.ts","../../../../../../tfjs-core/src/platforms/platform_browser.ts","../../../../../../tfjs-core/src/platforms/platform_node.ts","../../../../../../tfjs-core/src/ops/buffer.ts","../../../../../../tfjs-core/src/ops/cast.ts","../../../../../../tfjs-core/src/ops/clone.ts","../../../../../../tfjs-core/src/ops/print.ts","../../../../../tfjs-core/src/base_side_effects.ts","../../../../../../tfjs-core/src/io/browser_files.ts","../../../../../../tfjs-core/src/io/progress.ts","../../../../../../tfjs-core/src/io/weights_loader.ts","../../../../../../tfjs-core/src/io/http.ts","../../../../../../tfjs-core/src/io/passthrough.ts","../../../../../../tfjs-core/src/io/io.ts","../../../../../../tfjs-core/src/ops/mat_mul.ts","../../../../../../tfjs-core/src/ops/one_hot.ts","../../../../../tfjs-core/src/globals.ts","../../../../../../tfjs-core/src/ops/imag.ts","../../../../../../tfjs-core/src/ops/neg.ts","../../../../../../tfjs-core/src/ops/real.ts","../../../../../../tfjs-core/src/ops/transpose.ts","../../../../../../tfjs-core/src/ops/confusion_matrix.ts","../../../../../tfjs-core/src/math.ts","../../../../../../tfjs-core/src/ops/broadcast_util.ts","../../../../../../tfjs-core/src/ops/tensor3d.ts","../../../../../../tfjs-core/src/ops/browser.ts","../../../../../../tfjs-core/src/ops/gather_nd_util.ts","../../../../../../tfjs-core/src/ops/scatter_nd_util.ts","../../../../../../tfjs-core/src/ops/slice_util.ts","../../../../../tfjs-core/src/serialization.ts","../../../../../tfjs-core/src/test_util.ts","../../../../../tfjs-core/src/version.ts","../../../../../../tfjs-core/src/ops/add.ts","../../../../../../tfjs-core/src/ops/floorDiv.ts","../../../../../../tfjs-core/src/ops/div.ts","../../../../../../tfjs-core/src/ops/mul.ts","../../../../../../tfjs-core/src/ops/abs.ts","../../../../../../tfjs-core/src/ops/acos.ts","../../../../../../tfjs-core/src/ops/acosh.ts","../../../../../../tfjs-core/src/ops/add_n.ts","../../../../../../tfjs-core/src/ops/all.ts","../../../../../../tfjs-core/src/ops/any.ts","../../../../../../tfjs-core/src/ops/arg_max.ts","../../../../../../tfjs-core/src/ops/arg_min.ts","../../../../../../tfjs-core/src/ops/asin.ts","../../../../../../tfjs-core/src/ops/asinh.ts","../../../../../../tfjs-core/src/ops/atan.ts","../../../../../../tfjs-core/src/ops/atan2.ts","../../../../../../tfjs-core/src/ops/atanh.ts","../../../../../../tfjs-core/src/ops/conv_util.ts","../../../../../../tfjs-core/src/ops/reshape.ts","../../../../../../tfjs-core/src/ops/avg_pool.ts","../../../../../../tfjs-core/src/ops/avg_pool_3d.ts","../../../../../../tfjs-core/src/ops/concat.ts","../../../../../../tfjs-core/src/ops/sigmoid.ts","../../../../../../tfjs-core/src/ops/slice.ts","../../../../../../tfjs-core/src/ops/tanh.ts","../../../../../../tfjs-core/src/ops/basic_lstm_cell.ts","../../../../../../tfjs-core/src/ops/batch_to_space_nd.ts","../../../../../../tfjs-core/src/ops/batchnorm_util.ts","../../../../../../tfjs-core/src/ops/batchnorm.ts","../../../../../../tfjs-core/src/ops/batchnorm2d.ts","../../../../../../tfjs-core/src/ops/batchnorm3d.ts","../../../../../../tfjs-core/src/ops/batchnorm4d.ts","../../../../../../tfjs-core/src/ops/bincount.ts","../../../../../../tfjs-core/src/ops/broadcast_args.ts","../../../../../../tfjs-core/src/ops/broadcast_to.ts","../../../../../../tfjs-core/src/ops/ceil.ts","../../../../../../tfjs-core/src/ops/fill.ts","../../../../../../tfjs-core/src/ops/clip_by_value.ts","../../../../../../tfjs-core/src/ops/concat_1d.ts","../../../../../../tfjs-core/src/ops/concat_2d.ts","../../../../../../tfjs-core/src/ops/concat_3d.ts","../../../../../../tfjs-core/src/ops/concat_4d.ts","../../../../../../tfjs-core/src/ops/conv2d.ts","../../../../../../tfjs-core/src/ops/conv1d.ts","../../../../../../tfjs-core/src/ops/conv2d_backprop_input.ts","../../../../../../tfjs-core/src/ops/conv2d_transpose.ts","../../../../../../tfjs-core/src/ops/conv3d.ts","../../../../../../tfjs-core/src/ops/conv3d_backprop_input.ts","../../../../../../tfjs-core/src/ops/conv3d_transpose.ts","../../../../../../tfjs-core/src/ops/cos.ts","../../../../../../tfjs-core/src/ops/cosh.ts","../../../../../../tfjs-core/src/ops/cumprod.ts","../../../../../../tfjs-core/src/ops/cumsum.ts","../../../../../../tfjs-core/src/ops/dense_bincount.ts","../../../../../../tfjs-core/src/ops/depth_to_space.ts","../../../../../../tfjs-core/src/ops/depthwise_conv2d.ts","../../../../../../tfjs-core/src/ops/diag.ts","../../../../../../tfjs-core/src/ops/dilation2d.ts","../../../../../../tfjs-core/src/ops/equal.ts","../../../../../../tfjs-core/src/ops/where.ts","../../../../../../tfjs-core/src/ops/zeros_like.ts","../../../../../../tfjs-core/src/ops/div_no_nan.ts","../../../../../../tfjs-core/src/ops/dot.ts","../../../../../../tfjs-core/src/ops/einsum.ts","../../../../../../tfjs-core/src/ops/elu.ts","../../../../../../tfjs-core/src/ops/erf.ts","../../../../../../tfjs-core/src/ops/axis_util.ts","../../../../../../tfjs-core/src/ops/max.ts","../../../../../../tfjs-core/src/ops/min.ts","../../../../../../tfjs-core/src/ops/pow.ts","../../../../../../tfjs-core/src/ops/scalar.ts","../../../../../../tfjs-core/src/ops/sqrt.ts","../../../../../../tfjs-core/src/ops/square.ts","../../../../../../tfjs-core/src/ops/sum.ts","../../../../../../tfjs-core/src/ops/norm.ts","../../../../../../tfjs-core/src/ops/euclidean_norm.ts","../../../../../../tfjs-core/src/ops/exp.ts","../../../../../../tfjs-core/src/ops/expand_dims.ts","../../../../../../tfjs-core/src/ops/expm1.ts","../../../../../../tfjs-core/src/ops/tile.ts","../../../../../../tfjs-core/src/ops/eye.ts","../../../../../../tfjs-core/src/ops/floor.ts","../../../../../../tfjs-core/src/ops/gather.ts","../../../../../../tfjs-core/src/ops/greater.ts","../../../../../../tfjs-core/src/ops/greater_equal.ts","../../../../../../tfjs-core/src/ops/is_finite.ts","../../../../../../tfjs-core/src/ops/is_inf.ts","../../../../../../tfjs-core/src/ops/is_nan.ts","../../../../../../tfjs-core/src/ops/leaky_relu.ts","../../../../../../tfjs-core/src/ops/less.ts","../../../../../../tfjs-core/src/ops/less_equal.ts","../../../../../../tfjs-core/src/ops/linspace.ts","../../../../../../tfjs-core/src/ops/local_response_normalization.ts","../../../../../../tfjs-core/src/ops/log.ts","../../../../../../tfjs-core/src/ops/log1p.ts","../../../../../tfjs-core/src/gradients.ts","../../../../../../tfjs-core/src/ops/softplus.ts","../../../../../../tfjs-core/src/ops/log_sigmoid.ts","../../../../../../tfjs-core/src/ops/sub.ts","../../../../../../tfjs-core/src/ops/log_softmax.ts","../../../../../../tfjs-core/src/ops/log_sum_exp.ts","../../../../../../tfjs-core/src/ops/logical_and.ts","../../../../../../tfjs-core/src/ops/logical_not.ts","../../../../../../tfjs-core/src/ops/logical_or.ts","../../../../../../tfjs-core/src/ops/logical_xor.ts","../../../../../../tfjs-core/src/ops/search_sorted.ts","../../../../../../tfjs-core/src/ops/lower_bound.ts","../../../../../../tfjs-core/src/ops/max_pool.ts","../../../../../../tfjs-core/src/ops/max_pool_3d.ts","../../../../../../tfjs-core/src/ops/max_pool_with_argmax.ts","../../../../../../tfjs-core/src/ops/maximum.ts","../../../../../../tfjs-core/src/ops/mean.ts","../../../../../../tfjs-core/src/ops/zeros.ts","../../../../../../tfjs-core/src/ops/ones.ts","../../../../../../tfjs-core/src/ops/meshgrid.ts","../../../../../../tfjs-core/src/ops/minimum.ts","../../../../../../tfjs-core/src/ops/mirror_pad.ts","../../../../../../tfjs-core/src/ops/mod.ts","../../../../../../tfjs-core/src/ops/moments.ts","../../../../../../tfjs-core/src/ops/multi_rnn_cell.ts","../../../../../../tfjs-core/src/ops/multinomial.ts","../../../../../../tfjs-core/src/ops/not_equal.ts","../../../../../../tfjs-core/src/ops/ones_like.ts","../../../../../../tfjs-core/src/ops/outer_product.ts","../../../../../../tfjs-core/src/ops/pad.ts","../../../../../../tfjs-core/src/ops/pad1d.ts","../../../../../../tfjs-core/src/ops/pad2d.ts","../../../../../../tfjs-core/src/ops/pad3d.ts","../../../../../../tfjs-core/src/ops/pad4d.ts","../../../../../../tfjs-core/src/ops/space_to_batch_nd.ts","../../../../../../tfjs-core/src/ops/pool.ts","../../../../../../tfjs-core/src/ops/prelu.ts","../../../../../../tfjs-core/src/ops/prod.ts","../../../../../../tfjs-core/src/ops/ragged_gather.ts","../../../../../../tfjs-core/src/ops/ragged_range.ts","../../../../../../tfjs-core/src/ops/ragged_tensor_to_tensor.ts","../../../../../../tfjs-core/src/ops/rand.ts","node_modules/seedrandom/lib/alea.js","node_modules/seedrandom/lib/xor128.js","node_modules/seedrandom/lib/xorwow.js","node_modules/seedrandom/lib/xorshift7.js","node_modules/seedrandom/lib/xor4096.js","node_modules/seedrandom/lib/tychei.js","node_modules/seedrandom/seedrandom.js","node_modules/seedrandom/index.js","../../../../../../tfjs-core/src/ops/rand_util.ts","../../../../../../tfjs-core/src/ops/random_gamma.ts","../../../../../../tfjs-core/src/ops/random_normal.ts","../../../../../../tfjs-core/src/ops/random_standard_normal.ts","../../../../../../tfjs-core/src/ops/random_uniform.ts","../../../../../../tfjs-core/src/ops/range.ts","../../../../../../tfjs-core/src/ops/reciprocal.ts","../../../../../../tfjs-core/src/ops/relu.ts","../../../../../../tfjs-core/src/ops/relu6.ts","../../../../../../tfjs-core/src/ops/reverse.ts","../../../../../../tfjs-core/src/ops/reverse_1d.ts","../../../../../../tfjs-core/src/ops/reverse_2d.ts","../../../../../../tfjs-core/src/ops/reverse_3d.ts","../../../../../../tfjs-core/src/ops/reverse_4d.ts","../../../../../../tfjs-core/src/ops/round.ts","../../../../../../tfjs-core/src/ops/rsqrt.ts","../../../../../../tfjs-core/src/ops/selu.ts","../../../../../../tfjs-core/src/ops/separable_conv2d.ts","../../../../../../tfjs-core/src/ops/setdiff1d_async.ts","../../../../../../tfjs-core/src/ops/sign.ts","../../../../../../tfjs-core/src/ops/sin.ts","../../../../../../tfjs-core/src/ops/sinh.ts","../../../../../../tfjs-core/src/ops/slice1d.ts","../../../../../../tfjs-core/src/ops/slice2d.ts","../../../../../../tfjs-core/src/ops/slice3d.ts","../../../../../../tfjs-core/src/ops/slice4d.ts","../../../../../../tfjs-core/src/ops/softmax.ts","../../../../../../../tfjs-core/src/ops/spectral/fft.ts","../../../../../../../tfjs-core/src/ops/spectral/ifft.ts","../../../../../../../tfjs-core/src/ops/spectral/irfft.ts","../../../../../../tfjs-core/src/ops/split.ts","../../../../../../../tfjs-core/src/ops/spectral/rfft.ts","../../../../../../tfjs-core/src/ops/squared_difference.ts","../../../../../../tfjs-core/src/ops/squeeze.ts","../../../../../../tfjs-core/src/ops/stack.ts","../../../../../../tfjs-core/src/ops/step.ts","../../../../../../tfjs-core/src/ops/strided_slice.ts","../../../../../../tfjs-core/src/ops/tan.ts","../../../../../../tfjs-core/src/ops/tensor1d.ts","../../../../../../tfjs-core/src/ops/tensor2d.ts","../../../../../../tfjs-core/src/ops/tensor4d.ts","../../../../../../tfjs-core/src/ops/tensor5d.ts","../../../../../../tfjs-core/src/ops/tensor6d.ts","../../../../../../tfjs-core/src/ops/topk.ts","../../../../../../tfjs-core/src/ops/truncated_normal.ts","../../../../../../tfjs-core/src/ops/unique.ts","../../../../../../tfjs-core/src/ops/unsorted_segment_sum.ts","../../../../../../tfjs-core/src/ops/unstack.ts","../../../../../../tfjs-core/src/ops/upper_bound.ts","../../../../../../tfjs-core/src/ops/variable.ts","../../../../../../tfjs-core/src/backends/where_impl.ts","../../../../../../tfjs-core/src/ops/where_async.ts","../../../../../../tfjs-core/src/ops/boolean_mask.ts","../../../../../../tfjs-core/src/ops/moving_average.ts","../../../../../../tfjs-core/src/ops/scatter_nd.ts","../../../../../../tfjs-core/src/ops/sparse_to_dense_util.ts","../../../../../../tfjs-core/src/ops/sparse_to_dense.ts","../../../../../../tfjs-core/src/ops/gather_nd.ts","../../../../../../tfjs-core/src/ops/dropout_util.ts","../../../../../../tfjs-core/src/ops/dropout.ts","../../../../../../tfjs-core/src/ops/signal_ops_util.ts","../../../../../../tfjs-core/src/ops/in_top_k.ts","../../../../../../tfjs-core/src/ops/conv2d_backprop_filter.ts","../../../../../../tfjs-core/src/ops/fused_util.ts","../../../../../../../tfjs-core/src/ops/fused/conv2d.ts","../../../../../../tfjs-core/src/ops/depthwise_conv2d_native_backprop_filter.ts","../../../../../../tfjs-core/src/ops/depthwise_conv2d_native_backprop_input.ts","../../../../../../../tfjs-core/src/ops/fused/depthwise_conv2d.ts","../../../../../../../tfjs-core/src/ops/fused/mat_mul.ts","../../../../../../tfjs-core/src/ops/fused_ops.ts","../../../../../../../tfjs-core/src/ops/signal/hamming_window.ts","../../../../../../../tfjs-core/src/ops/signal/hann_window.ts","../../../../../../../tfjs-core/src/ops/signal/frame.ts","../../../../../../../tfjs-core/src/ops/signal/stft.ts","../../../../../../../tfjs-core/src/ops/image/crop_and_resize.ts","../../../../../../../tfjs-core/src/ops/image/flip_left_right.ts","../../../../../../../tfjs-core/src/ops/image/grayscale_to_rgb.ts","../../../../../../../tfjs-core/src/ops/image/rotate_with_offset.ts","../../../../../../tfjs-core/src/ops/nonmax_util.ts","../../../../../../../tfjs-core/src/ops/image/non_max_suppression.ts","../../../../../../tfjs-core/src/backends/non_max_suppression_util.ts","../../../../../../tfjs-core/src/backends/non_max_suppression_impl.ts","../../../../../../../tfjs-core/src/ops/image/non_max_suppression_async.ts","../../../../../../../tfjs-core/src/ops/image/non_max_suppression_with_score.ts","../../../../../../../tfjs-core/src/ops/image/non_max_suppression_with_score_async.ts","../../../../../../../tfjs-core/src/ops/image/non_max_suppression_padded.ts","../../../../../../../tfjs-core/src/ops/image/non_max_suppression_padded_async.ts","../../../../../../../tfjs-core/src/ops/image/resize_bilinear.ts","../../../../../../../tfjs-core/src/ops/image/resize_nearest_neighbor.ts","../../../../../../../tfjs-core/src/ops/image/threshold.ts","../../../../../../../tfjs-core/src/ops/image/transform.ts","../../../../../../../tfjs-core/src/ops/linalg/band_part.ts","../../../../../../../tfjs-core/src/ops/linalg/gram_schmidt.ts","../../../../../../../tfjs-core/src/ops/linalg/qr.ts","../../../../../../tfjs-core/src/ops/loss_ops_utils.ts","../../../../../../../tfjs-core/src/ops/losses/compute_weighted_loss.ts","../../../../../../../tfjs-core/src/ops/losses/absolute_difference.ts","../../../../../../../tfjs-core/src/ops/losses/cosine_distance.ts","../../../../../../../tfjs-core/src/ops/losses/hinge_loss.ts","../../../../../../../tfjs-core/src/ops/losses/huber_loss.ts","../../../../../../../tfjs-core/src/ops/losses/log_loss.ts","../../../../../../../tfjs-core/src/ops/losses/mean_squared_error.ts","../../../../../../../tfjs-core/src/ops/losses/sigmoid_cross_entropy.ts","../../../../../../../tfjs-core/src/ops/losses/softmax_cross_entropy.ts","../../../../../../../tfjs-core/src/ops/sparse/sparse_fill_empty_rows.ts","../../../../../../../tfjs-core/src/ops/sparse/sparse_reshape.ts","../../../../../../../tfjs-core/src/ops/sparse/sparse_segment_mean.ts","../../../../../../../tfjs-core/src/ops/sparse/sparse_segment_sum.ts","../../../../../../../tfjs-core/src/ops/string/string_n_grams.ts","../../../../../../../tfjs-core/src/ops/string/string_split.ts","../../../../../../../tfjs-core/src/ops/string/string_to_hash_bucket_fast.ts","../../../../../../tfjs-core/src/ops/ops.ts","../../../../../../tfjs-core/src/optimizers/optimizer.ts","../../../../../../tfjs-core/src/optimizers/adadelta_optimizer.ts","../../../../../../tfjs-core/src/optimizers/adagrad_optimizer.ts","../../../../../../tfjs-core/src/optimizers/adam_optimizer.ts","../../../../../../tfjs-core/src/optimizers/adamax_optimizer.ts","../../../../../../tfjs-core/src/optimizers/sgd_optimizer.ts","../../../../../../tfjs-core/src/optimizers/momentum_optimizer.ts","../../../../../../tfjs-core/src/optimizers/rmsprop_optimizer.ts","../../../../../../tfjs-core/src/optimizers/optimizer_constructors.ts","../../../../../tfjs-core/src/train.ts","../../../../../tfjs-core/src/browser_util.ts","../../../../../../tfjs-core/src/ops/concat_util.ts","../../../../../../tfjs-core/src/ops/ragged_to_dense_util.ts","../../../../../../tfjs-core/src/ops/reduce_util.ts","../../../../../../tfjs-core/src/ops/rotate_util.ts","../../../../../../tfjs-core/src/ops/array_ops_util.ts","../../../../../../tfjs-core/src/ops/selu_util.ts","../../../../../../tfjs-core/src/ops/erf_util.ts","../../../../../../tfjs-core/src/backends/complex_util.ts","../../../../../../tfjs-core/src/backends/einsum_util.ts","../../../../../../tfjs-core/src/ops/split_util.ts","../../../../../../../tfjs-core/src/ops/sparse/sparse_fill_empty_rows_util.ts","../../../../../../../tfjs-core/src/ops/sparse/sparse_reshape_util.ts","../../../../../../../tfjs-core/src/ops/sparse/sparse_segment_reduction_util.ts","../../../../../../tfjs-core/src/ops/segment_util.ts","../../../../../../tfjs-core/src/backends/backend_util.ts","../../../../../../tfjs-core/src/backends/kernel_impls.ts","../../../../../tfjs-core/src/base.ts","../../../../../tfjs-core/src/index.ts","../../../../../tfjs-backend-webgl/src/canvas_util.ts","../../../../../tfjs-backend-webgl/src/tex_util.ts","../../../../../tfjs-backend-webgl/src/webgl_util.ts","../../../../../tfjs-backend-webgl/src/flags_webgl.ts","../../../../../tfjs-backend-webgl/src/glsl_version.ts","../../../../../tfjs-backend-webgl/src/shader_compiler_util.ts","../../../../../tfjs-backend-webgl/src/shader_compiler.ts","../../../../../tfjs-backend-webgl/src/gpgpu_math.ts","../../../../../tfjs-backend-webgl/src/decode_matrix_gpu.ts","../../../../../tfjs-backend-webgl/src/decode_matrix_packed_gpu.ts","../../../../../tfjs-backend-webgl/src/encode_float_gpu.ts","../../../../../tfjs-backend-webgl/src/encode_float_packed_gpu.ts","../../../../../tfjs-backend-webgl/src/encode_matrix_gpu.ts","../../../../../tfjs-backend-webgl/src/encode_matrix_packed_gpu.ts","../../../../../tfjs-backend-webgl/src/gpgpu_util.ts","../../../../../tfjs-backend-webgl/src/gpgpu_context.ts","../../../../../tfjs-backend-cpu/src/cpu_util.ts","../../../../../../tfjs-backend-cpu/src/kernels/Abs.ts","../../../../../../tfjs-backend-cpu/src/utils/binary_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/Complex.ts","../../../../../../tfjs-backend-cpu/src/utils/zeros_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/Identity.ts","../../../../../../tfjs-backend-cpu/src/kernels/Real.ts","../../../../../../tfjs-backend-cpu/src/kernels/Cast.ts","../../../../../../tfjs-backend-cpu/src/utils/binary_utils.ts","../../../../../../tfjs-backend-cpu/src/kernels/Add.ts","../../../../../../tfjs-backend-cpu/src/kernels/Bincount_impl.ts","../../../../../../tfjs-backend-cpu/src/utils/unary_impl.ts","../../../../../../tfjs-backend-cpu/src/utils/unary_utils.ts","../../../../../../tfjs-backend-cpu/src/kernels/Ceil.ts","../../../../../../tfjs-backend-cpu/src/kernels/Concat_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/Equal.ts","../../../../../../tfjs-backend-cpu/src/kernels/Exp.ts","../../../../../../tfjs-backend-cpu/src/kernels/Expm1.ts","../../../../../../tfjs-backend-cpu/src/kernels/Floor.ts","../../../../../../tfjs-backend-cpu/src/kernels/GatherNd_Impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/GatherV2_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/Greater.ts","../../../../../../tfjs-backend-cpu/src/kernels/GreaterEqual.ts","../../../../../../tfjs-backend-cpu/src/kernels/Less.ts","../../../../../../tfjs-backend-cpu/src/kernels/LessEqual.ts","../../../../../../tfjs-backend-cpu/src/kernels/LinSpace_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/Log.ts","../../../../../../tfjs-backend-cpu/src/kernels/Max_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/Maximum.ts","../../../../../../tfjs-backend-cpu/src/kernels/Minimum.ts","../../../../../../tfjs-backend-cpu/src/kernels/Multiply.ts","../../../../../../tfjs-backend-cpu/src/kernels/Neg.ts","../../../../../../tfjs-backend-cpu/src/kernels/NotEqual.ts","../../../../../../tfjs-backend-cpu/src/kernels/Transpose_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/Transpose.ts","../../../../../../tfjs-backend-cpu/src/kernels/Prod.ts","../../../../../../tfjs-backend-cpu/src/kernels/RaggedGather_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/RaggedRange_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/RaggedTensorToTensor_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/Range_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/Rsqrt.ts","../../../../../../tfjs-backend-cpu/src/kernels/Scatter_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/Sigmoid.ts","../../../../../../tfjs-backend-cpu/src/kernels/Slice.ts","../../../../../../tfjs-backend-cpu/src/kernels/SparseFillEmptyRows_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/SparseReshape_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/SparseSegmentReduction_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/Sqrt.ts","../../../../../../tfjs-backend-cpu/src/kernels/SquaredDifference.ts","../../../../../../tfjs-backend-cpu/src/kernels/StridedSlice_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/StringNGrams_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/StringSplit_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/StringToHashBucketFast_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/Sub.ts","../../../../../../tfjs-backend-cpu/src/kernels/Tile_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/TopK_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/Unique_impl.ts","../../../../../tfjs-backend-cpu/src/shared.ts","../../../../../../tfjs-backend-webgl/src/kernel_utils/shared.ts","../../../../../tfjs-backend-webgl/src/packing_util.ts","../../../../../tfjs-backend-webgl/src/pack_gpu.ts","../../../../../tfjs-backend-webgl/src/reshape_packed_gpu.ts","../../../../../tfjs-backend-webgl/src/texture_manager.ts","../../../../../tfjs-backend-webgl/src/unaryop_gpu.ts","../../../../../tfjs-backend-webgl/src/unaryop_packed_gpu.ts","../../../../../tfjs-backend-webgl/src/unpack_gpu.ts","../../../../../tfjs-backend-webgl/src/backend_webgl.ts","../../../../../tfjs-backend-webgl/src/version.ts","../../../../../tfjs-backend-webgl/src/webgl.ts","../../../../../tfjs-backend-webgl/src/base.ts","../../../../../tfjs-backend-webgl/src/binaryop_gpu.ts","../../../../../tfjs-backend-webgl/src/binaryop_packed_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/Identity.ts","../../../../../../tfjs-backend-webgl/src/kernels/Complex.ts","../../../../../../tfjs-backend-webgl/src/kernels/LeakyRelu.ts","../../../../../../tfjs-backend-webgl/src/kernels/Prelu.ts","../../../../../../tfjs-backend-webgl/src/kernel_utils/kernel_funcs_utils.ts","../../../../../tfjs-backend-webgl/src/mulmat_packed_gpu.ts","../../../../../tfjs-backend-webgl/src/binaryop_complex_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/Multiply.ts","../../../../../../tfjs-backend-webgl/src/kernel_utils/reshape.ts","../../../../../../tfjs-backend-webgl/src/kernels/Reshape.ts","../../../../../tfjs-backend-webgl/src/mean_gpu.ts","../../../../../tfjs-backend-webgl/src/reduce_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernel_utils/reduce.ts","../../../../../tfjs-backend-webgl/src/transpose_gpu.ts","../../../../../tfjs-backend-webgl/src/transpose_packed_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/Transpose_impl.ts","../../../../../../tfjs-backend-webgl/src/kernels/Sum_impl.ts","../../../../../../tfjs-backend-webgl/src/kernels/Sum.ts","../../../../../../tfjs-backend-webgl/src/kernels/Transpose.ts","../../../../../../tfjs-backend-webgl/src/kernels/BatchMatMul_impl.ts","../../../../../../tfjs-backend-webgl/src/kernels/_FusedMatMul.ts","../../../../../../tfjs-backend-webgl/src/kernels/Abs.ts","../../../../../../tfjs-backend-webgl/src/kernels/Acos.ts","../../../../../../tfjs-backend-webgl/src/kernels/Acosh.ts","../../../../../../tfjs-backend-webgl/src/kernels/Add.ts","../../../../../tfjs-backend-webgl/src/addn_gpu.ts","../../../../../tfjs-backend-webgl/src/addn_packed_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/AddN.ts","../../../../../../tfjs-backend-webgl/src/kernels/All.ts","../../../../../../tfjs-backend-webgl/src/kernels/Any.ts","../../../../../tfjs-backend-webgl/src/argminmax_gpu.ts","../../../../../tfjs-backend-webgl/src/argminmax_packed_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernel_utils/arg_min_max.ts","../../../../../../tfjs-backend-webgl/src/kernels/ArgMax.ts","../../../../../../tfjs-backend-webgl/src/kernels/ArgMin.ts","../../../../../../tfjs-backend-webgl/src/kernels/Asin.ts","../../../../../../tfjs-backend-webgl/src/kernels/Asinh.ts","../../../../../../tfjs-backend-webgl/src/kernels/Atan.ts","../../../../../../tfjs-backend-webgl/src/kernels/Atan2.ts","../../../../../../tfjs-backend-webgl/src/kernels/Atanh.ts","../../../../../tfjs-backend-webgl/src/pool_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/AvgPool.ts","../../../../../../tfjs-backend-webgl/src/kernels/AvgPool3D.ts","../../../../../tfjs-backend-webgl/src/avg_pool_backprop_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/AvgPool3DGrad.ts","../../../../../../tfjs-backend-webgl/src/kernels/AvgPoolGrad.ts","../../../../../../tfjs-backend-webgl/src/kernels/BatchMatMul.ts","../../../../../tfjs-backend-webgl/src/batchnorm_gpu.ts","../../../../../tfjs-backend-webgl/src/batchnorm_packed_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/BatchNorm.ts","../../../../../tfjs-backend-webgl/src/slice_gpu.ts","../../../../../tfjs-backend-webgl/src/slice_packed_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/Slice.ts","../../../../../../tfjs-backend-webgl/src/kernels/BatchToSpaceND.ts","../../../../../../tfjs-backend-webgl/src/kernels/Bincount.ts","../../../../../../tfjs-backend-webgl/src/kernels/BroadcastArgs.ts","../../../../../../tfjs-backend-webgl/src/kernels/NotEqual.ts","../../../../../../tfjs-backend-webgl/src/kernels/Real.ts","../../../../../../tfjs-backend-webgl/src/kernel_utils/int.ts","../../../../../../tfjs-backend-webgl/src/kernels/Cast.ts","../../../../../../tfjs-backend-webgl/src/kernels/Ceil.ts","../../../../../tfjs-backend-webgl/src/clip_gpu.ts","../../../../../tfjs-backend-webgl/src/clip_packed_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/ClipByValue.ts","../../../../../tfjs-backend-webgl/src/complex_abs_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/ComplexAbs.ts","../../../../../tfjs-backend-webgl/src/concat_gpu.ts","../../../../../tfjs-backend-webgl/src/concat_packed_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/Imag.ts","../../../../../../tfjs-backend-webgl/src/kernels/Concat_impl.ts","../../../../../../tfjs-backend-webgl/src/kernels/Concat.ts","../../../../../tfjs-backend-webgl/src/conv_gpu.ts","../../../../../tfjs-backend-webgl/src/conv_packed_gpu.ts","../../../../../tfjs-backend-webgl/src/im2col_packed_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/Conv2D_impl.ts","../../../../../../tfjs-backend-webgl/src/kernels/Conv2D.ts","../../../../../tfjs-backend-webgl/src/conv_backprop_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/Conv2DBackpropFilter.ts","../../../../../../tfjs-backend-webgl/src/kernels/Conv2DBackpropInput.ts","../../../../../../tfjs-backend-webgl/src/kernels/Conv3D.ts","../../../../../../tfjs-backend-webgl/src/kernels/Conv3DBackpropFilterV2.ts","../../../../../../tfjs-backend-webgl/src/kernels/Conv3DBackpropInputV2.ts","../../../../../../tfjs-backend-webgl/src/kernels/Cos.ts","../../../../../../tfjs-backend-webgl/src/kernels/Cosh.ts","../../../../../tfjs-backend-webgl/src/crop_and_resize_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/CropAndResize.ts","../../../../../tfjs-backend-webgl/src/cum_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/Cum_impl.ts","../../../../../../tfjs-backend-webgl/src/kernels/Cumprod.ts","../../../../../../tfjs-backend-webgl/src/kernels/Cumsum.ts","../../../../../../tfjs-backend-webgl/src/kernels/DenseBincount.ts","../../../../../tfjs-backend-webgl/src/depth_to_space_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/DepthToSpace.ts","../../../../../tfjs-backend-webgl/src/conv_gpu_depthwise.ts","../../../../../tfjs-backend-webgl/src/conv_packed_gpu_depthwise.ts","../../../../../../tfjs-backend-webgl/src/kernels/DepthwiseConv2dNative.ts","../../../../../tfjs-backend-webgl/src/conv_backprop_gpu_depthwise.ts","../../../../../../tfjs-backend-webgl/src/kernels/DepthwiseConv2dNativeBackpropFilter.ts","../../../../../../tfjs-backend-webgl/src/kernels/DepthwiseConv2dNativeBackpropInput.ts","../../../../../tfjs-backend-webgl/src/diag_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/Diag.ts","../../../../../tfjs-backend-webgl/src/dilation_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/Dilation2D.ts","../../../../../../tfjs-backend-webgl/src/kernels/Einsum.ts","../../../../../../tfjs-backend-webgl/src/kernels/Elu.ts","../../../../../../tfjs-backend-webgl/src/kernels/EluGrad.ts","../../../../../../tfjs-backend-webgl/src/kernels/Equal.ts","../../../../../../tfjs-backend-webgl/src/kernels/Erf.ts","../../../../../../tfjs-backend-webgl/src/kernels/Exp.ts","../../../../../../tfjs-backend-webgl/src/kernels/ExpandDims.ts","../../../../../../tfjs-backend-webgl/src/kernels/Expm1.ts","../../../../../tfjs-backend-webgl/src/fft_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/FFT_impl.ts","../../../../../../tfjs-backend-webgl/src/kernels/FFT.ts","../../../../../tfjs-backend-webgl/src/fill_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/Fill.ts","../../../../../tfjs-backend-webgl/src/flip_left_right_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/FlipLeftRight.ts","../../../../../../tfjs-backend-webgl/src/kernels/Floor.ts","../../../../../../tfjs-backend-webgl/src/kernels/FloorDiv.ts","../../../../../../../tfjs-backend-webgl/src/kernels/FromPixels_utils/from_pixels_gpu.ts","../../../../../../../tfjs-backend-webgl/src/kernels/FromPixels_utils/from_pixels_packed_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/FromPixels.ts","../../../../../../tfjs-backend-webgl/src/kernels/FusedConv2D.ts","../../../../../../tfjs-backend-webgl/src/kernels/FusedDepthwiseConv2D.ts","../../../../../tfjs-backend-webgl/src/gather_nd_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/GatherNd.ts","../../../../../tfjs-backend-webgl/src/gather_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/GatherV2.ts","../../../../../../tfjs-backend-webgl/src/kernels/Greater.ts","../../../../../../tfjs-backend-webgl/src/kernels/GreaterEqual.ts","../../../../../../tfjs-backend-webgl/src/kernels/IFFT.ts","../../../../../../tfjs-backend-webgl/src/kernels/IsFinite.ts","../../../../../../tfjs-backend-webgl/src/kernels/IsInf.ts","../../../../../../tfjs-backend-webgl/src/kernels/IsNaN.ts","../../../../../../tfjs-backend-webgl/src/kernels/Less.ts","../../../../../../tfjs-backend-webgl/src/kernels/LessEqual.ts","../../../../../../tfjs-backend-webgl/src/kernels/LinSpace.ts","../../../../../../tfjs-backend-webgl/src/kernels/Log.ts","../../../../../../tfjs-backend-webgl/src/kernels/Log1p.ts","../../../../../../tfjs-backend-webgl/src/kernels/LogicalAnd.ts","../../../../../../tfjs-backend-webgl/src/kernels/LogicalNot.ts","../../../../../../tfjs-backend-webgl/src/kernels/LogicalOr.ts","../../../../../tfjs-backend-webgl/src/lrn_gpu.ts","../../../../../tfjs-backend-webgl/src/lrn_packed_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/LRN.ts","../../../../../tfjs-backend-webgl/src/lrn_grad_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/LRNGrad.ts","../../../../../../tfjs-backend-webgl/src/kernels/Max_impl.ts","../../../../../../tfjs-backend-webgl/src/kernels/Max.ts","../../../../../../tfjs-backend-webgl/src/kernels/Maximum.ts","../../../../../../tfjs-backend-webgl/src/kernels/MaxPool.ts","../../../../../../tfjs-backend-webgl/src/kernels/MaxPool3D.ts","../../../../../tfjs-backend-webgl/src/max_pool_backprop_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/MaxPool3DGrad.ts","../../../../../../tfjs-backend-webgl/src/kernels/MaxPoolGrad.ts","../../../../../../tfjs-backend-webgl/src/kernels/MaxPoolWithArgmax_impl.ts","../../../../../../tfjs-backend-webgl/src/kernels/MaxPoolWithArgmax.ts","../../../../../../tfjs-backend-webgl/src/kernels/Mean_impl.ts","../../../../../../tfjs-backend-webgl/src/kernels/Mean.ts","../../../../../../tfjs-backend-webgl/src/kernels/Min.ts","../../../../../../tfjs-backend-webgl/src/kernels/Minimum.ts","../../../../../tfjs-backend-webgl/src/mirror_pad_gpu.ts","../../../../../tfjs-backend-webgl/src/mirror_pad_packed_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/MirrorPad.ts","../../../../../../tfjs-backend-webgl/src/kernels/Mod.ts","../../../../../tfjs-backend-webgl/src/multinomial_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/RealDiv.ts","../../../../../../tfjs-backend-webgl/src/kernels/Sub.ts","../../../../../../tfjs-backend-webgl/src/kernels/Softmax.ts","../../../../../../tfjs-backend-webgl/src/kernels/Multinomial.ts","../../../../../../tfjs-backend-webgl/src/kernels/Neg.ts","../../../../../../tfjs-backend-webgl/src/kernels/NonMaxSuppressionV3.ts","../../../../../../tfjs-backend-webgl/src/kernels/NonMaxSuppressionV4.ts","../../../../../../tfjs-backend-webgl/src/kernels/NonMaxSuppressionV5.ts","../../../../../tfjs-backend-webgl/src/onehot_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/OneHot.ts","../../../../../../tfjs-backend-webgl/src/kernels/ZerosLike.ts","../../../../../../tfjs-backend-webgl/src/kernels/OnesLike.ts","../../../../../../tfjs-backend-webgl/src/kernels/Pack.ts","../../../../../tfjs-backend-webgl/src/pad_gpu.ts","../../../../../tfjs-backend-webgl/src/pad_packed_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/PadV2.ts","../../../../../../tfjs-backend-webgl/src/kernels/Pow.ts","../../../../../../tfjs-backend-webgl/src/kernels/Prod.ts","../../../../../../tfjs-backend-webgl/src/kernels/RaggedGather.ts","../../../../../../tfjs-backend-webgl/src/kernels/RaggedRange.ts","../../../../../../tfjs-backend-webgl/src/kernels/RaggedTensorToTensor.ts","../../../../../../tfjs-backend-webgl/src/kernels/Range.ts","../../../../../../tfjs-backend-webgl/src/kernels/Reciprocal.ts","../../../../../../tfjs-backend-webgl/src/kernels/Relu.ts","../../../../../../tfjs-backend-webgl/src/kernels/Relu6.ts","../../../../../tfjs-backend-webgl/src/resize_bilinear_gpu.ts","../../../../../tfjs-backend-webgl/src/resize_bilinear_packed_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/ResizeBilinear.ts","../../../../../tfjs-backend-webgl/src/resize_bilinear_backprop_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/ResizeBilinearGrad.ts","../../../../../tfjs-backend-webgl/src/resize_nearest_neighbor_gpu.ts","../../../../../tfjs-backend-webgl/src/resize_nearest_neighbor_packed_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/ResizeNearestNeighbor.ts","../../../../../tfjs-backend-webgl/src/resize_nearest_neighbor_backprop_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/ResizeNearestNeighborGrad.ts","../../../../../tfjs-backend-webgl/src/reverse_gpu.ts","../../../../../tfjs-backend-webgl/src/reverse_packed_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/Reverse.ts","../../../../../tfjs-backend-webgl/src/rotate_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/RotateWithOffset.ts","../../../../../../tfjs-backend-webgl/src/kernels/Round.ts","../../../../../../tfjs-backend-webgl/src/kernels/Rsqrt.ts","../../../../../tfjs-backend-webgl/src/scatter_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/ScatterNd.ts","../../../../../tfjs-backend-webgl/src/search_sorted_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/SearchSorted.ts","../../../../../tfjs-backend-webgl/src/select_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/Select.ts","../../../../../../tfjs-backend-webgl/src/kernels/Selu.ts","../../../../../../tfjs-backend-webgl/src/kernels/Sigmoid.ts","../../../../../../tfjs-backend-webgl/src/kernels/Sign.ts","../../../../../../tfjs-backend-webgl/src/kernels/Sin.ts","../../../../../../tfjs-backend-webgl/src/kernels/Sinh.ts","../../../../../../tfjs-backend-webgl/src/kernels/Softplus.ts","../../../../../../tfjs-backend-webgl/src/kernels/SpaceToBatchND.ts","../../../../../../tfjs-backend-webgl/src/kernels/SparseFillEmptyRows.ts","../../../../../../tfjs-backend-webgl/src/kernels/SparseReshape.ts","../../../../../../tfjs-backend-webgl/src/kernels/SparseSegmentMean.ts","../../../../../../tfjs-backend-webgl/src/kernels/SparseSegmentSum.ts","../../../../../../tfjs-backend-webgl/src/kernels/SparseToDense.ts","../../../../../../tfjs-backend-webgl/src/kernels/SplitV.ts","../../../../../../tfjs-backend-webgl/src/kernels/Sqrt.ts","../../../../../../tfjs-backend-webgl/src/kernels/Square.ts","../../../../../../tfjs-backend-webgl/src/kernels/SquaredDifference.ts","../../../../../../tfjs-backend-webgl/src/kernels/Step.ts","../../../../../tfjs-backend-webgl/src/strided_slice_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/StridedSlice.ts","../../../../../../tfjs-backend-webgl/src/kernels/StringNGrams.ts","../../../../../../tfjs-backend-webgl/src/kernels/StringSplit.ts","../../../../../../tfjs-backend-webgl/src/kernels/StringToHashBucketFast.ts","../../../../../../tfjs-backend-webgl/src/kernels/Tan.ts","../../../../../../tfjs-backend-webgl/src/kernels/Tanh.ts","../../../../../tfjs-backend-webgl/src/tile_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/Tile.ts","../../../../../tfjs-backend-webgl/src/top_k_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/TopK.ts","../../../../../tfjs-backend-webgl/src/transform_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/Transform.ts","../../../../../../tfjs-backend-webgl/src/kernels/Unique.ts","../../../../../../tfjs-backend-webgl/src/kernels/Unpack.ts","../../../../../tfjs-backend-webgl/src/segment_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/UnsortedSegmentSum.ts","../../../../../tfjs-backend-webgl/src/register_all_kernels.ts","../../../../../tfjs-backend-webgl/src/index.ts","../../../../../tfjs-backend-webgpu/src/flags_webgpu.ts","../../../../../tfjs-backend-webgpu/src/adapter_info.ts","../../../../../tfjs-backend-webgpu/src/buffer_manager.ts","../../../../../tfjs-backend-webgpu/src/texture_manager.ts","../../../../../tfjs-backend-webgpu/src/shader_util.ts","../../../../../tfjs-backend-webgpu/src/webgpu_program.ts","../../../../../tfjs-backend-webgpu/src/webgpu_util.ts","../../../../../tfjs-backend-webgpu/src/backend_webgpu.ts","../../../../../tfjs-backend-webgpu/src/webgpu.ts","../../../../../tfjs-backend-webgpu/src/base.ts","../../../../../tfjs-backend-webgpu/src/binary_op_util.ts","../../../../../tfjs-backend-webgpu/src/unary_op_util.ts","../../../../../tfjs-backend-webgpu/src/activation_util.ts","../../../../../tfjs-backend-webgpu/src/matmul_packed_webgpu.ts","../../../../../tfjs-backend-webgpu/src/matmul_reduce_webgpu.ts","../../../../../tfjs-backend-webgpu/src/matmul_small_output_size_webgpu.ts","../../../../../tfjs-backend-webgpu/src/matmul_splitK_webgpu.ts","../../../../../tfjs-backend-webgpu/src/fill_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Fill.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Reshape.ts","../../../../../../tfjs-backend-webgpu/src/kernels/BatchMatMul_impl.ts","../../../../../../tfjs-backend-webgpu/src/kernels/_FusedMatMul.ts","../../../../../tfjs-backend-webgpu/src/binary_op_complex_webgpu.ts","../../../../../tfjs-backend-webgpu/src/binary_op_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Identity.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Complex.ts","../../../../../tfjs-backend-webgpu/src/unary_op_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernel_utils/kernel_funcs_utils.ts","../../../../../../tfjs-backend-webgpu/src/kernel_utils/shared.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Abs.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Acos.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Acosh.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Add.ts","../../../../../tfjs-backend-webgpu/src/addn_packed_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/AddN.ts","../../../../../tfjs-backend-webgpu/src/transpose_shared_webgpu.ts","../../../../../tfjs-backend-webgpu/src/transpose_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Transpose.ts","../../../../../tfjs-backend-webgpu/src/reduce_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernel_utils/reduce.ts","../../../../../../tfjs-backend-webgpu/src/kernels/All.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Any.ts","../../../../../tfjs-backend-webgpu/src/argminmax_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/ArgMax.ts","../../../../../../tfjs-backend-webgpu/src/kernels/ArgMin.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Asin.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Asinh.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Atan.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Atan2.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Atanh.ts","../../../../../tfjs-backend-webgpu/src/pool2d_webgpu.ts","../../../../../tfjs-backend-webgpu/src/pool_filtersizeone_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Max.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Mean.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Pool_impl.ts","../../../../../../tfjs-backend-webgpu/src/kernels/AvgPool.ts","../../../../../tfjs-backend-webgpu/src/avg_pool2d_backprop_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/AvgPoolGrad.ts","../../../../../../tfjs-backend-webgpu/src/kernels/BatchMatMul.ts","../../../../../tfjs-backend-webgpu/src/slice_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Slice.ts","../../../../../../tfjs-backend-webgpu/src/kernels/BatchToSpaceND.ts","../../../../../tfjs-backend-webgpu/src/bincount_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Bincount.ts","../../../../../../tfjs-backend-webgpu/src/kernels/NotEqual.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Real.ts","../../../../../../tfjs-backend-webgpu/src/kernel_utils/int.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Cast.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Ceil.ts","../../../../../tfjs-backend-webgpu/src/clip_vec4_webgpu.ts","../../../../../tfjs-backend-webgpu/src/clip_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/ClipByValue.ts","../../../../../tfjs-backend-webgpu/src/concat_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Imag.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Concat_impl.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Concat.ts","../../../../../tfjs-backend-webgpu/src/conv2d_mm_webgpu.ts","../../../../../tfjs-backend-webgpu/src/conv2d_naive_webgpu.ts","../../../../../tfjs-backend-webgpu/src/im2col_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Conv2D_impl.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Conv2D.ts","../../../../../tfjs-backend-webgpu/src/conv_backprop_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Conv2DBackpropFilter.ts","../../../../../tfjs-backend-webgpu/src/conv_backprop_mm_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Conv2DBackpropInput.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Cos.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Cosh.ts","../../../../../tfjs-backend-webgpu/src/crop_and_resize_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/CropAndResize.ts","../../../../../tfjs-backend-webgpu/src/cum_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Cum_impl.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Cumprod.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Cumsum.ts","../../../../../../tfjs-backend-webgpu/src/kernels/DenseBincount.ts","../../../../../tfjs-backend-webgpu/src/depth_to_space_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/DepthToSpace.ts","../../../../../tfjs-backend-webgpu/src/depthwise_conv2d_nchw_shared_webgpu.ts","../../../../../tfjs-backend-webgpu/src/depthwise_conv2d_vec4_webgpu.ts","../../../../../tfjs-backend-webgpu/src/depthwise_conv2d_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/DepthwiseConv2dNative.ts","../../../../../tfjs-backend-webgpu/src/diag_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Diag.ts","../../../../../tfjs-backend-webgpu/src/dilation_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Dilation2D.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Multiply.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Sum.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Einsum.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Elu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Equal.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Erf.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Exp.ts","../../../../../../tfjs-backend-webgpu/src/kernels/ExpandDims.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Expm1.ts","../../../../../tfjs-backend-webgpu/src/fft_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/FFT_impl.ts","../../../../../../tfjs-backend-webgpu/src/kernels/FFT.ts","../../../../../tfjs-backend-webgpu/src/flip_left_right_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/FlipLeftRight.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Floor.ts","../../../../../../tfjs-backend-webgpu/src/kernels/FloorDiv.ts","../../../../../tfjs-backend-webgpu/src/from_pixels_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/FromPixels.ts","../../../../../tfjs-backend-webgpu/src/batchnorm_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/FusedBatchNorm.ts","../../../../../../tfjs-backend-webgpu/src/kernels/FusedConv2D.ts","../../../../../../tfjs-backend-webgpu/src/kernels/FusedDepthwiseConv2D.ts","../../../../../tfjs-backend-webgpu/src/gather_nd_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/GatherNd.ts","../../../../../tfjs-backend-webgpu/src/gather_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/GatherV2.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Greater.ts","../../../../../../tfjs-backend-webgpu/src/kernels/GreaterEqual.ts","../../../../../../tfjs-backend-webgpu/src/kernels/IFFT.ts","../../../../../../tfjs-backend-webgpu/src/kernels/IsFinite.ts","../../../../../../tfjs-backend-webgpu/src/kernels/IsInf.ts","../../../../../../tfjs-backend-webgpu/src/kernels/IsNaN.ts","../../../../../../tfjs-backend-webgpu/src/kernels/LeakyRelu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Less.ts","../../../../../../tfjs-backend-webgpu/src/kernels/LessEqual.ts","../../../../../tfjs-backend-webgpu/src/lin_space_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/LinSpace.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Log.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Log1p.ts","../../../../../../tfjs-backend-webgpu/src/kernels/LogicalAnd.ts","../../../../../../tfjs-backend-webgpu/src/kernels/LogicalNot.ts","../../../../../../tfjs-backend-webgpu/src/kernels/LogicalOr.ts","../../../../../tfjs-backend-webgpu/src/lrn_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/LRN.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Maximum.ts","../../../../../../tfjs-backend-webgpu/src/kernels/MaxPool.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Min.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Minimum.ts","../../../../../tfjs-backend-webgpu/src/mirror_pad_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/MirrorPad.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Mod.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Neg.ts","../../../../../../tfjs-backend-webgpu/src/kernels/NonMaxSuppressionV3.ts","../../../../../../tfjs-backend-webgpu/src/kernels/NonMaxSuppressionV5.ts","../../../../../tfjs-backend-webgpu/src/onehot_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/OneHot.ts","../../../../../../tfjs-backend-webgpu/src/kernels/ZerosLike.ts","../../../../../../tfjs-backend-webgpu/src/kernels/OnesLike.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Pack.ts","../../../../../tfjs-backend-webgpu/src/pad_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/PadV2.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Pow.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Prelu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Prod.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Range.ts","../../../../../../tfjs-backend-webgpu/src/kernels/RealDiv.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Reciprocal.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Relu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Relu6.ts","../../../../../tfjs-backend-webgpu/src/resize_bilinear_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/ResizeBilinear.ts","../../../../../tfjs-backend-webgpu/src/resize_nearest_neighbor_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/ResizeNearestNeighbor.ts","../../../../../tfjs-backend-webgpu/src/reverse_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Reverse.ts","../../../../../tfjs-backend-webgpu/src/rotate_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/RotateWithOffset.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Round.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Rsqrt.ts","../../../../../tfjs-backend-webgpu/src/scatter_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/ScatterNd.ts","../../../../../tfjs-backend-webgpu/src/search_sorted_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/SearchSorted.ts","../../../../../tfjs-backend-webgpu/src/select_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Select.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Selu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Sigmoid.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Sign.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Sin.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Sinh.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Sub.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Softmax.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Softplus.ts","../../../../../../tfjs-backend-webgpu/src/kernels/SpaceToBatchND.ts","../../../../../tfjs-backend-webgpu/src/tile_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Tile.ts","../../../../../../tfjs-backend-webgpu/src/kernels/SparseToDense.ts","../../../../../../tfjs-backend-webgpu/src/kernels/SplitV.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Sqrt.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Square.ts","../../../../../../tfjs-backend-webgpu/src/kernels/SquaredDifference.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Step.ts","../../../../../tfjs-backend-webgpu/src/strided_slice_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/StridedSlice.ts","../../../../../../tfjs-backend-webgpu/src/kernels/StringNGrams.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Tan.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Tanh.ts","../../../../../tfjs-backend-webgpu/src/top_k_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/TopK.ts","../../../../../tfjs-backend-webgpu/src/transform_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Transform.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Unpack.ts","../../../../../tfjs-backend-webgpu/src/register_all_kernels.ts","../../../../../tfjs-backend-webgpu/src/index.ts","node_modules/@mediapipe/pose/pose.js","../../../../../../tfjs-backend-wasm/src/kernels/types.ts","../../../../../../tfjs-backend-wasm/src/kernels/_FusedMatMul.ts","../../../../../../tfjs-backend-wasm/src/kernels/unary_kernel.ts","../../../../../../tfjs-backend-wasm/src/kernels/Abs.ts","../../../../../../tfjs-backend-wasm/src/kernels/binary_kernel.ts","../../../../../../tfjs-backend-wasm/src/kernels/Add.ts","../../../../../../tfjs-backend-wasm/src/kernels/AddN.ts","../../../../../../tfjs-backend-wasm/src/kernels/Identity.ts","../../../../../../tfjs-backend-wasm/src/kernels/Transpose.ts","../../../../../../tfjs-backend-wasm/src/kernels/kernel_utils.ts","../../../../../../tfjs-backend-wasm/src/kernels/All.ts","../../../../../../tfjs-backend-wasm/src/kernels/Any.ts","../../../../../../tfjs-backend-wasm/src/kernels/ArgMax.ts","../../../../../../tfjs-backend-wasm/src/kernels/AvgPool.ts","../../../../../../tfjs-backend-wasm/src/kernels/Reshape.ts","../../../../../../tfjs-backend-wasm/src/kernels/BatchMatMul.ts","../../../../../../tfjs-backend-wasm/src/kernel_utils/shared.ts","../../../../../../tfjs-backend-wasm/src/kernels/Slice.ts","../../../../../../tfjs-backend-wasm/src/kernels/BatchToSpaceND.ts","../../../../../../tfjs-backend-wasm/src/kernels/Cast.ts","../../../../../../tfjs-backend-wasm/src/kernels/Ceil.ts","../../../../../../tfjs-backend-wasm/src/kernels/ClipByValue.ts","../../../../../../tfjs-backend-wasm/src/kernels/Concat.ts","../../../../../../tfjs-backend-wasm/src/kernels/Conv2D.ts","../../../../../../tfjs-backend-wasm/src/kernels/Conv2DBackpropInput.ts","../../../../../../tfjs-backend-wasm/src/kernels/Cos.ts","../../../../../../tfjs-backend-wasm/src/kernels/Cosh.ts","../../../../../../tfjs-backend-wasm/src/kernels/CropAndResize.ts","../../../../../../tfjs-backend-wasm/src/kernels/Cumprod.ts","../../../../../../tfjs-backend-wasm/src/kernels/Cumsum.ts","../../../../../../tfjs-backend-wasm/src/kernels/DepthToSpace.ts","../../../../../../tfjs-backend-wasm/src/kernels/DepthwiseConv2dNative.ts","../../../../../../tfjs-backend-wasm/src/kernels/Elu.ts","../../../../../../tfjs-backend-wasm/src/kernels/Equal.ts","../../../../../../tfjs-backend-wasm/src/kernels/Exp.ts","../../../../../../tfjs-backend-wasm/src/kernels/ExpandDims.ts","../../../../../../tfjs-backend-wasm/src/kernels/Fill.ts","../../../../../../tfjs-backend-wasm/src/kernels/FlipLeftRight.ts","../../../../../../tfjs-backend-wasm/src/kernels/Floor.ts","../../../../../../tfjs-backend-wasm/src/kernels/FloorDiv.ts","../../../../../../tfjs-backend-wasm/src/kernels/FusedBatchNorm.ts","../../../../../../tfjs-backend-wasm/src/kernels/FusedConv2D.ts","../../../../../../tfjs-backend-wasm/src/kernels/FusedDepthwiseConv2D.ts","../../../../../../tfjs-backend-wasm/src/kernels/GatherNd.ts","../../../../../../tfjs-backend-wasm/src/kernels/GatherV2.ts","../../../../../../tfjs-backend-wasm/src/kernels/Greater.ts","../../../../../../tfjs-backend-wasm/src/kernels/GreaterEqual.ts","../../../../../../tfjs-backend-wasm/src/kernels/LeakyRelu.ts","../../../../../../tfjs-backend-wasm/src/kernels/Less.ts","../../../../../../tfjs-backend-wasm/src/kernels/LessEqual.ts","../../../../../../tfjs-backend-wasm/src/kernels/Log.ts","../../../../../../tfjs-backend-wasm/src/kernels/LogicalAnd.ts","../../../../../../tfjs-backend-wasm/src/kernels/LogicalNot.ts","../../../../../../tfjs-backend-wasm/src/kernels/LogicalOr.ts","../../../../../../tfjs-backend-wasm/src/kernels/LogicalXor.ts","../../../../../../tfjs-backend-wasm/src/kernels/Max.ts","../../../../../../tfjs-backend-wasm/src/kernels/Maximum.ts","../../../../../../tfjs-backend-wasm/src/kernels/MaxPool.ts","../../../../../../tfjs-backend-wasm/src/kernels/Mean.ts","../../../../../../tfjs-backend-wasm/src/kernels/Min.ts","../../../../../../tfjs-backend-wasm/src/kernels/Minimum.ts","../../../../../../tfjs-backend-wasm/src/kernels/MirrorPad.ts","../../../../../../tfjs-backend-wasm/src/kernels/Multiply.ts","../../../../../../tfjs-backend-wasm/src/kernels/Neg.ts","../../../../../../tfjs-backend-wasm/src/kernels/NonMaxSuppression_util.ts","../../../../../../tfjs-backend-wasm/src/kernels/NonMaxSuppressionV3.ts","../../../../../../tfjs-backend-wasm/src/kernels/NonMaxSuppressionV4.ts","../../../../../../tfjs-backend-wasm/src/kernels/NonMaxSuppressionV5.ts","../../../../../../tfjs-backend-wasm/src/kernels/NotEqual.ts","../../../../../../tfjs-backend-wasm/src/kernels/OneHot.ts","../../../../../../tfjs-backend-wasm/src/kernels/OnesLike.ts","../../../../../../tfjs-backend-wasm/src/kernels/Pack.ts","../../../../../../tfjs-backend-wasm/src/kernels/PadV2.ts","../../../../../../tfjs-backend-wasm/src/kernels/Pow.ts","../../../../../../tfjs-backend-wasm/src/kernels/Prelu.ts","../../../../../../tfjs-backend-wasm/src/kernels/Prod.ts","../../../../../../tfjs-backend-wasm/src/kernels/Range.ts","../../../../../../tfjs-backend-wasm/src/kernels/RealDiv.ts","../../../../../../tfjs-backend-wasm/src/kernels/Relu.ts","../../../../../../tfjs-backend-wasm/src/kernels/Relu6.ts","../../../../../../tfjs-backend-wasm/src/kernels/ResizeBilinear.ts","../../../../../../tfjs-backend-wasm/src/kernels/ResizeNearestNeighbor.ts","../../../../../../tfjs-backend-wasm/src/kernels/Reverse.ts","../../../../../../tfjs-backend-wasm/src/kernels/RotateWithOffset.ts","../../../../../../tfjs-backend-wasm/src/kernels/Round.ts","../../../../../../tfjs-backend-wasm/src/kernels/Rsqrt.ts","../../../../../../tfjs-backend-wasm/src/kernels/ScatterNd.ts","../../../../../../tfjs-backend-wasm/src/kernels/Select.ts","../../../../../../tfjs-backend-wasm/src/kernels/Sigmoid.ts","../../../../../../tfjs-backend-wasm/src/kernels/Sin.ts","../../../../../../tfjs-backend-wasm/src/kernels/Softmax.ts","../../../../../../tfjs-backend-wasm/src/kernels/SpaceToBatchND.ts","../../../../../../tfjs-backend-wasm/src/kernels/SparseFillEmptyRows.ts","../../../../../../tfjs-backend-wasm/src/kernels/SparseReshape.ts","../../../../../../tfjs-backend-wasm/src/kernels/SparseSegmentReduction.ts","../../../../../../tfjs-backend-wasm/src/kernels/SparseSegmentMean.ts","../../../../../../tfjs-backend-wasm/src/kernels/SparseSegmentSum.ts","../../../../../../tfjs-backend-wasm/src/kernels/SplitV.ts","../../../../../../tfjs-backend-wasm/src/kernels/Sqrt.ts","../../../../../../tfjs-backend-wasm/src/kernels/Square.ts","../../../../../../tfjs-backend-wasm/src/kernels/SquaredDifference.ts","../../../../../../tfjs-backend-wasm/src/kernels/Step.ts","../../../../../../tfjs-backend-wasm/src/kernels/StridedSlice.ts","../../../../../../tfjs-backend-wasm/src/kernels/StringNGrams.ts","../../../../../../tfjs-backend-wasm/src/kernels/StringSplit.ts","../../../../../../tfjs-backend-wasm/src/kernels/StringToHashBucketFast.ts","../../../../../../tfjs-backend-wasm/src/kernels/Sub.ts","../../../../../../tfjs-backend-wasm/src/kernels/Sum.ts","../../../../../../tfjs-backend-wasm/src/kernels/Tan.ts","../../../../../../tfjs-backend-wasm/src/kernels/Tanh.ts","../../../../../../tfjs-backend-wasm/src/kernels/Tile.ts","../../../../../../tfjs-backend-wasm/src/kernels/TopK.ts","../../../../../../tfjs-backend-wasm/src/kernels/Transform.ts","../../../../../../tfjs-backend-wasm/src/kernels/Unpack.ts","../../../../../../tfjs-backend-wasm/src/kernels/ZerosLike.ts","../../../../../tfjs-backend-wasm/src/register_all_kernels.ts","../../../../../tfjs-backend-wasm/src/flags_wasm.ts","node_modules/@tensorflow/tfjs-backend-wasm/wasm-out/tfjs-backend-wasm-threaded-simd.js","node_modules/@tensorflow/tfjs-backend-wasm/wasm-out/tfjs-backend-wasm-threaded-simd.worker.js","node_modules/@tensorflow/tfjs-backend-wasm/wasm-out/tfjs-backend-wasm.js","../../../../../tfjs-backend-wasm/src/backend_wasm.ts","../../../../../tfjs-backend-wasm/src/version.ts","../../../../../tfjs-backend-wasm/src/base.ts","../../../../../tfjs-backend-wasm/src/index.ts","../src/constants.ts","../../../src/shared/calculators/mask_util.ts","../../src/blazepose_mediapipe/constants.ts","../../src/blazepose_mediapipe/detector_utils.ts","../../src/blazepose_mediapipe/detector.ts","../../../../../tfjs-converter/src/flags.ts","../../../../../../tfjs-converter/src/data/compiled_api.ts","../../../../../../../tfjs-converter/src/operations/custom_op/register.ts","../../../../../../../tfjs-converter/src/operations/executors/utils.ts","../../../../../../../tfjs-converter/src/operations/op_list/arithmetic.ts","../../../../../../../tfjs-converter/src/operations/op_list/basic_math.ts","../../../../../../../tfjs-converter/src/operations/op_list/control.ts","../../../../../../../tfjs-converter/src/operations/op_list/convolution.ts","../../../../../../../tfjs-converter/src/operations/op_list/creation.ts","../../../../../../../tfjs-converter/src/operations/op_list/dynamic.ts","../../../../../../../tfjs-converter/src/operations/op_list/evaluation.ts","../../../../../../../tfjs-converter/src/operations/op_list/graph.ts","../../../../../../../tfjs-converter/src/operations/op_list/hash_table.ts","../../../../../../../tfjs-converter/src/operations/op_list/image.ts","../../../../../../../tfjs-converter/src/operations/op_list/logical.ts","../../../../../../../tfjs-converter/src/operations/op_list/matrices.ts","../../../../../../../tfjs-converter/src/operations/op_list/normalization.ts","../../../../../../../tfjs-converter/src/operations/op_list/reduction.ts","../../../../../../../tfjs-converter/src/operations/op_list/slice_join.ts","../../../../../../../tfjs-converter/src/operations/op_list/sparse.ts","../../../../../../../tfjs-converter/src/operations/op_list/spectral.ts","../../../../../../../tfjs-converter/src/operations/op_list/string.ts","../../../../../../../tfjs-converter/src/operations/op_list/transformation.ts","../../../../../../tfjs-converter/src/operations/operation_mapper.ts","../../../../../../../tfjs-converter/src/operations/custom_op/node_value_impl.ts","../../../../../../tfjs-core/src/ops/ops_for_converter.ts","../../../../../../../tfjs-converter/src/operations/executors/arithmetic_executor.ts","../../../../../../../tfjs-converter/src/operations/executors/basic_math_executor.ts","../../../../../../tfjs-converter/src/executor/tensor_utils.ts","../../../../../../tfjs-converter/src/executor/tensor_array.ts","../../../../../../tfjs-converter/src/executor/tensor_list.ts","../../../../../../../tfjs-converter/src/operations/executors/control_executor.ts","../../../../../../../tfjs-converter/src/operations/executors/convolution_executor.ts","../../../../../../../tfjs-converter/src/operations/executors/creation_executor.ts","../../../../../../../tfjs-converter/src/operations/executors/dynamic_executor.ts","../../../../../../../tfjs-converter/src/operations/executors/evaluation_executor.ts","../../../../../../../tfjs-converter/src/operations/executors/graph_executor.ts","../../../../../../tfjs-converter/src/executor/hash_table.ts","../../../../../../../tfjs-converter/src/operations/executors/hash_table_executor.ts","../../../../../../../tfjs-converter/src/operations/executors/image_executor.ts","../../../../../../../tfjs-converter/src/operations/executors/logical_executor.ts","../../../../../../../tfjs-converter/src/operations/executors/matrices_executor.ts","../../../../../../../tfjs-converter/src/operations/executors/normalization_executor.ts","../../../../../../../tfjs-converter/src/operations/executors/reduction_executor.ts","../../../../../../../tfjs-converter/src/operations/executors/slice_join_executor.ts","../../../../../../../tfjs-converter/src/operations/executors/sparse_executor.ts","../../../../../../../tfjs-converter/src/operations/executors/spectral_executor.ts","../../../../../../../tfjs-converter/src/operations/executors/string_executor.ts","../../../../../../../tfjs-converter/src/operations/executors/transformation_executor.ts","../../../../../../tfjs-converter/src/operations/operation_executor.ts","../../../../../../tfjs-converter/src/executor/execution_context.ts","../../../../../../tfjs-converter/src/executor/model_analysis.ts","../../../../../../tfjs-converter/src/executor/graph_executor.ts","../../../../../../tfjs-converter/src/executor/resource_manager.ts","../../../../../../tfjs-converter/src/executor/graph_model.ts","../../../../../tfjs-converter/src/version.ts","../../../../../tfjs-converter/src/index.ts","../../../src/shared/calculators/image_utils.ts","../../../src/shared/calculators/detection_to_rect.ts","../../../src/shared/calculators/calculate_alignment_points_rects.ts","../../../src/shared/calculators/calculate_inverse_matrix.ts","../../../src/shared/calculators/calculate_landmark_projection.ts","../../../src/shared/calculators/calculate_score_copy.ts","../../../src/shared/calculators/calculate_world_landmark_projection.ts","../../../src/shared/calculators/constants.ts","../../../src/shared/calculators/get_rotated_sub_rect_to_rect_transformation_matrix.ts","../../../src/shared/calculators/shift_image_value.ts","../../../src/shared/calculators/convert_image_to_tensor.ts","../../../src/shared/calculators/create_ssd_anchors.ts","../../../src/shared/calculators/split_detection_result.ts","../../../src/shared/calculators/detector_result.ts","../../../src/shared/calculators/is_video.ts","../../../src/shared/calculators/landmarks_to_detection.ts","../../../src/shared/calculators/non_max_suppression.ts","../../../src/shared/calculators/normalized_keypoints_to_keypoints.ts","../../../src/shared/calculators/refine_landmarks_from_heatmap.ts","../../../src/shared/calculators/remove_detection_letterbox.ts","../../../src/shared/calculators/remove_landmark_letterbox.ts","../../../src/shared/calculators/segmentation_smoothing.ts","../../../src/shared/calculators/tensors_to_detections.ts","../../../src/shared/calculators/sigmoid.ts","../../../src/shared/calculators/tensors_to_landmarks.ts","../../../src/shared/calculators/tensors_to_segmentation.ts","../../../src/shared/calculators/transform_rect.ts","../../../src/shared/calculators/get_object_scale.ts","../../../src/shared/calculators/keypoints_to_normalized_keypoints.ts","../../../src/shared/filters/low_pass_filter.ts","../../../src/shared/filters/one_euro_filter.ts","../../../src/shared/filters/keypoints_one_euro_filter.ts","../../../src/shared/filters/relative_velocity_filter.ts","../../../src/shared/filters/keypoints_velocity_filter.ts","../../../src/shared/filters/keypoints_smoothing.ts","../../../src/shared/filters/visibility_smoothing.ts","../../src/blazepose_tfjs/constants.ts","../../src/blazepose_tfjs/detector_utils.ts","../../src/blazepose_tfjs/detector.ts","../../src/calculators/tracker_utils.ts","../../src/calculators/tracker.ts","../../src/calculators/bounding_box_tracker.ts","../../src/calculators/keypoint_tracker.ts","../../src/calculators/types.ts","../src/types.ts","../src/util.ts","../../src/movenet/constants.ts","../../src/movenet/crop_utils.ts","../../src/movenet/detector_utils.ts","../../src/movenet/detector.ts","../../src/posenet/constants.ts","../../../src/posenet/calculators/max_heap.ts","../../../src/posenet/calculators/build_part_with_score_queue.ts","../../../src/posenet/calculators/decode_multiple_poses_util.ts","../../../src/posenet/calculators/decode_multiple_poses.ts","../../../src/posenet/calculators/decode_single_pose_util.ts","../../../src/posenet/calculators/decode_single_pose.ts","../../../src/posenet/calculators/flip_poses.ts","../../../src/posenet/calculators/scale_poses.ts","../../src/posenet/detector_utils.ts","../../src/posenet/load_utils.ts","../../src/posenet/detector.ts","../src/create_detector.ts","../src/index.ts","node_modules/three/build/three.module.js","node_modules/three/examples/jsm/controls/OrbitControls.js","node_modules/scatter-gl/dist/render.js","node_modules/scatter-gl/dist/util.js","node_modules/scatter-gl/dist/scatter_plot_rectangle_selector.js","node_modules/scatter-gl/dist/scatter_plot.js","node_modules/scatter-gl/dist/color.js","node_modules/scatter-gl/dist/data.js","node_modules/scatter-gl/dist/styles.js","node_modules/scatter-gl/dist/constants.js","node_modules/scatter-gl/dist/scatter_plot_visualizer_3d_labels.js","node_modules/scatter-gl/dist/scatter_plot_visualizer_sprites.js","node_modules/scatter-gl/dist/label.js","node_modules/scatter-gl/dist/scatter_plot_visualizer_canvas_labels.js","node_modules/scatter-gl/dist/scatter_plot_visualizer_polylines.js","node_modules/scatter-gl/dist/scatter_gl.js","node_modules/scatter-gl/dist/index.js","src/option_panel.js","src/util.js","src/params.js","src/camera.js","src/stats_panel.js","src/index.js"],"names":["process","module","exports","cachedSetTimeout","cachedClearTimeout","defaultSetTimout","Error","defaultClearTimeout","setTimeout","e","clearTimeout","runTimeout","fun","call","runClearTimeout","marker","queue","draining","currentQueue","queueIndex","cleanUpNextTick","length","concat","drainQueue","timeout","len","run","nextTick","args","Array","arguments","i","push","Item","array","prototype","apply","title","env","argv","version","versions","noop","on","addListener","once","off","removeListener","removeAllListeners","emit","prependListener","prependOnceListener","listeners","name","binding","cwd","chdir","dir","umask","Number","EPSILON","undefined","Math","pow","isInteger","value","isFinite","floor","sign","x","Function","Object","defineProperty","get","toString","match","assign","target","TypeError","output","index","source","nextKey","hasOwnProperty","REVISION","MOUSE","LEFT","MIDDLE","RIGHT","ROTATE","DOLLY","PAN","TOUCH","DOLLY_PAN","DOLLY_ROTATE","CullFaceNone","CullFaceBack","CullFaceFront","CullFaceFrontBack","FrontFaceDirectionCW","FrontFaceDirectionCCW","BasicShadowMap","PCFShadowMap","PCFSoftShadowMap","VSMShadowMap","FrontSide","BackSide","DoubleSide","FlatShading","SmoothShading","NoColors","FaceColors","VertexColors","NoBlending","NormalBlending","AdditiveBlending","SubtractiveBlending","MultiplyBlending","CustomBlending","AddEquation","SubtractEquation","ReverseSubtractEquation","MinEquation","MaxEquation","ZeroFactor","OneFactor","SrcColorFactor","OneMinusSrcColorFactor","SrcAlphaFactor","OneMinusSrcAlphaFactor","DstAlphaFactor","OneMinusDstAlphaFactor","DstColorFactor","OneMinusDstColorFactor","SrcAlphaSaturateFactor","NeverDepth","AlwaysDepth","LessDepth","LessEqualDepth","EqualDepth","GreaterEqualDepth","GreaterDepth","NotEqualDepth","MultiplyOperation","MixOperation","AddOperation","NoToneMapping","LinearToneMapping","ReinhardToneMapping","Uncharted2ToneMapping","CineonToneMapping","ACESFilmicToneMapping","UVMapping","CubeReflectionMapping","CubeRefractionMapping","EquirectangularReflectionMapping","EquirectangularRefractionMapping","SphericalReflectionMapping","CubeUVReflectionMapping","CubeUVRefractionMapping","RepeatWrapping","ClampToEdgeWrapping","MirroredRepeatWrapping","NearestFilter","NearestMipmapNearestFilter","NearestMipMapNearestFilter","NearestMipmapLinearFilter","NearestMipMapLinearFilter","LinearFilter","LinearMipmapNearestFilter","LinearMipMapNearestFilter","LinearMipmapLinearFilter","LinearMipMapLinearFilter","UnsignedByteType","ByteType","ShortType","UnsignedShortType","IntType","UnsignedIntType","FloatType","HalfFloatType","UnsignedShort4444Type","UnsignedShort5551Type","UnsignedShort565Type","UnsignedInt248Type","AlphaFormat","RGBFormat","RGBAFormat","LuminanceFormat","LuminanceAlphaFormat","RGBEFormat","DepthFormat","DepthStencilFormat","RedFormat","RedIntegerFormat","RGFormat","RGIntegerFormat","RGBIntegerFormat","RGBAIntegerFormat","RGB_S3TC_DXT1_Format","RGBA_S3TC_DXT1_Format","RGBA_S3TC_DXT3_Format","RGBA_S3TC_DXT5_Format","RGB_PVRTC_4BPPV1_Format","RGB_PVRTC_2BPPV1_Format","RGBA_PVRTC_4BPPV1_Format","RGBA_PVRTC_2BPPV1_Format","RGB_ETC1_Format","RGBA_ASTC_4x4_Format","RGBA_ASTC_5x4_Format","RGBA_ASTC_5x5_Format","RGBA_ASTC_6x5_Format","RGBA_ASTC_6x6_Format","RGBA_ASTC_8x5_Format","RGBA_ASTC_8x6_Format","RGBA_ASTC_8x8_Format","RGBA_ASTC_10x5_Format","RGBA_ASTC_10x6_Format","RGBA_ASTC_10x8_Format","RGBA_ASTC_10x10_Format","RGBA_ASTC_12x10_Format","RGBA_ASTC_12x12_Format","LoopOnce","LoopRepeat","LoopPingPong","InterpolateDiscrete","InterpolateLinear","InterpolateSmooth","ZeroCurvatureEnding","ZeroSlopeEnding","WrapAroundEnding","TrianglesDrawMode","TriangleStripDrawMode","TriangleFanDrawMode","LinearEncoding","sRGBEncoding","GammaEncoding","RGBEEncoding","LogLuvEncoding","RGBM7Encoding","RGBM16Encoding","RGBDEncoding","BasicDepthPacking","RGBADepthPacking","TangentSpaceNormalMap","ObjectSpaceNormalMap","ZeroStencilOp","KeepStencilOp","ReplaceStencilOp","IncrementStencilOp","DecrementStencilOp","IncrementWrapStencilOp","DecrementWrapStencilOp","InvertStencilOp","NeverStencilFunc","LessStencilFunc","EqualStencilFunc","LessEqualStencilFunc","GreaterStencilFunc","NotEqualStencilFunc","GreaterEqualStencilFunc","AlwaysStencilFunc","StaticDrawUsage","DynamicDrawUsage","StreamDrawUsage","StaticReadUsage","DynamicReadUsage","StreamReadUsage","StaticCopyUsage","DynamicCopyUsage","StreamCopyUsage","EventDispatcher","addEventListener","type","listener","_listeners","indexOf","hasEventListener","removeEventListener","listenerArray","splice","dispatchEvent","event","slice","l","_lut","MathUtils","DEG2RAD","PI","RAD2DEG","generateUUID","d0","random","d1","d2","d3","uuid","toUpperCase","clamp","min","max","euclideanModulo","n","m","mapLinear","a1","a2","b1","b2","lerp","y","t","smoothstep","smootherstep","randInt","low","high","randFloat","randFloatSpread","range","degToRad","degrees","radToDeg","radians","isPowerOfTwo","ceilPowerOfTwo","ceil","log","LN2","floorPowerOfTwo","setQuaternionFromProperEuler","q","a","b","c","order","cos","sin","c2","s2","c13","s13","c1_3","s1_3","c3_1","s3_1","set","console","warn","Vector2","defineProperties","isVector2","setScalar","scalar","setX","setY","setComponent","getComponent","clone","constructor","copy","v","add","w","addVectors","addScalar","s","addScaledVector","sub","subVectors","subScalar","multiply","multiplyScalar","divide","divideScalar","applyMatrix3","elements","clampScalar","minVal","maxVal","clampLength","round","roundToZero","negate","dot","cross","lengthSq","sqrt","manhattanLength","abs","normalize","angle","atan2","distanceTo","distanceToSquared","dx","dy","manhattanDistanceTo","setLength","alpha","lerpVectors","v1","v2","equals","fromArray","offset","toArray","fromBufferAttribute","attribute","getX","getY","rotateAround","center","Matrix3","error","isMatrix3","n11","n12","n13","n21","n22","n23","n31","n32","n33","te","identity","me","setFromMatrix4","multiplyMatrices","premultiply","ae","be","a11","a12","a13","a21","a22","a23","a31","a32","a33","b11","b12","b13","b21","b22","b23","b31","b32","b33","determinant","d","f","g","h","getInverse","matrix","throwOnDegenerate","isMatrix4","t11","t12","t13","det","msg","detInv","transpose","tmp","getNormalMatrix","matrix4","transposeIntoArray","r","setUvTransform","tx","ty","sx","sy","rotation","cx","cy","scale","rotate","theta","translate","_canvas","ImageUtils","getDataURL","image","canvas","HTMLCanvasElement","src","document","createElementNS","width","height","context","getContext","ImageData","putImageData","drawImage","toDataURL","textureId","Texture","mapping","wrapS","wrapT","magFilter","minFilter","format","anisotropy","encoding","DEFAULT_IMAGE","mipmaps","DEFAULT_MAPPING","internalFormat","repeat","matrixAutoUpdate","generateMipmaps","premultiplyAlpha","flipY","unpackAlignment","onUpdate","create","isTexture","updateMatrix","toJSON","meta","isRootObject","textures","metadata","generator","wrap","images","url","isArray","dispose","transformUv","uv","Vector4","z","isVector4","setZ","setW","applyMatrix4","setAxisAngleFromQuaternion","acos","setAxisAngleFromRotationMatrix","epsilon","epsilon2","m11","m12","m13","m21","m22","m23","m31","m32","m33","xx","yy","zz","xy","xz","yz","getZ","getW","WebGLRenderTarget","options","scissor","scissorTest","viewport","texture","depthBuffer","stencilBuffer","depthTexture","isWebGLRenderTarget","setSize","WebGLMultisampleRenderTarget","samples","isWebGLMultisampleRenderTarget","Quaternion","_x","_y","_z","_w","slerp","qa","qb","qm","slerpFlat","dst","dstOffset","src0","srcOffset0","src1","srcOffset1","x0","y0","z0","w0","x1","y1","z1","w1","sqrSin","tDir","_onChangeCallback","isQuaternion","quaternion","setFromEuler","euler","update","isEuler","c1","c3","s1","s3","setFromAxisAngle","axis","halfAngle","setFromRotationMatrix","trace","setFromUnitVectors","vFrom","vTo","EPS","angleTo","rotateTowards","step","inverse","conjugate","p","multiplyQuaternions","qax","qay","qaz","qaw","qbx","qby","qbz","qbw","cosHalfTheta","sqrSinHalfTheta","sinHalfTheta","halfTheta","ratioA","ratioB","_onChange","callback","_vector","Vector3","_quaternion","isVector3","multiplyVectors","applyEuler","applyQuaternion","applyAxisAngle","applyNormalMatrix","qx","qy","qz","qw","ix","iy","iz","iw","project","camera","matrixWorldInverse","projectionMatrix","unproject","projectionMatrixInverse","matrixWorld","transformDirection","crossVectors","ax","ay","az","bx","by","bz","projectOnVector","denominator","projectOnPlane","planeNormal","reflect","normal","dz","setFromSpherical","setFromSphericalCoords","radius","phi","sinPhiRadius","setFromCylindrical","setFromCylindricalCoords","setFromMatrixPosition","setFromMatrixScale","setFromMatrixColumn","sz","setFromMatrix3Column","_v1","_m1","Matrix4","_zero","_one","n14","n24","n34","n41","n42","n43","n44","copyPosition","extractBasis","xAxis","yAxis","zAxis","makeBasis","extractRotation","scaleX","scaleY","scaleZ","makeRotationFromEuler","af","bf","ce","cf","de","df","ac","ad","bc","bd","makeRotationFromQuaternion","compose","lookAt","eye","up","a14","a24","a34","a41","a42","a43","a44","b14","b24","b34","b41","b42","b43","b44","setPosition","t14","getMaxScaleOnAxis","scaleXSq","scaleYSq","scaleZSq","makeTranslation","makeRotationX","makeRotationY","makeRotationZ","makeRotationAxis","makeScale","makeShear","position","x2","y2","z2","wx","wy","wz","decompose","invSX","invSY","invSZ","makePerspective","left","right","top","bottom","near","far","makeOrthographic","_matrix","_quaternion$1","Euler","_order","DefaultOrder","RotationOrders","asin","setFromQuaternion","setFromVector3","reorder","newOrder","toVector3","optionalResult","Layers","mask","channel","enable","enableAll","toggle","disable","disableAll","test","layers","_object3DId","_v1$1","_q1","_m1$1","_target","_position","_scale","_quaternion$2","_xAxis","_yAxis","_zAxis","_addedEvent","_removedEvent","Object3D","parent","children","DefaultUp","onRotationChange","onQuaternionChange","configurable","enumerable","modelViewMatrix","normalMatrix","DefaultMatrixAutoUpdate","matrixWorldNeedsUpdate","visible","castShadow","receiveShadow","frustumCulled","renderOrder","userData","isObject3D","onBeforeRender","onAfterRender","setRotationFromAxisAngle","setRotationFromEuler","setRotationFromMatrix","setRotationFromQuaternion","rotateOnAxis","rotateOnWorldAxis","rotateX","rotateY","rotateZ","translateOnAxis","distance","translateX","translateY","translateZ","localToWorld","vector","worldToLocal","updateWorldMatrix","isCamera","isLight","object","remove","attach","getObjectById","id","getObjectByProperty","getObjectByName","child","getWorldPosition","updateMatrixWorld","getWorldQuaternion","getWorldScale","getWorldDirection","raycast","traverse","traverseVisible","traverseAncestors","force","updateParents","updateChildren","geometries","materials","shapes","JSON","stringify","isInstancedMesh","count","instanceMatrix","serialize","library","element","isMesh","isLine","isPoints","geometry","parameters","shape","material","uuids","extractFromCache","cache","values","key","data","recursive","parse","Scene","background","environment","fog","overrideMaterial","autoUpdate","__THREE_DEVTOOLS__","CustomEvent","detail","isScene","_points","_vector$1","_box","Box3","_v0","_v1$2","_v2","_f0","_f1","_f2","_center","_extents","_triangleNormal","_testAxis","Infinity","isBox3","setFromArray","minX","minY","minZ","maxX","maxY","maxZ","setFromBufferAttribute","setFromPoints","points","makeEmpty","il","expandByPoint","setFromCenterAndSize","size","halfSize","setFromObject","expandByObject","box","isEmpty","getCenter","getSize","point","expandByVector","expandByScalar","boundingBox","computeBoundingBox","containsPoint","containsBox","getParameter","intersectsBox","intersectsSphere","sphere","clampPoint","intersectsPlane","plane","constant","intersectsTriangle","triangle","axes","satForAxes","distanceToPoint","clampedPoint","getBoundingSphere","intersect","union","v0","extents","j","p0","p1","p2","_box$1","Sphere","optionalCenter","maxRadiusSq","empty","radiusSum","deltaLengthSq","getBoundingBox","_vector$2","_segCenter","_segDir","_diff","_edge1","_edge2","_normal","Ray","origin","direction","ray","at","recast","closestPointToPoint","directionDistance","distanceSqToPoint","distanceSqToSegment","optionalPointOnRay","optionalPointOnSegment","segExtent","a01","b0","s0","sqrDist","extDet","invDet","intersectSphere","tca","radius2","thc","t0","t1","distanceToPlane","intersectPlane","distToPoint","intersectBox","tmin","tmax","tymin","tymax","tzmin","tzmax","invdirx","invdiry","invdirz","intersectTriangle","backfaceCulling","DdN","DdQxE2","DdE1xQ","QdN","_vector1","_vector2","_normalMatrix","Plane","isPlane","setComponents","setFromNormalAndCoplanarPoint","setFromCoplanarPoints","inverseNormalLength","distanceToSphere","projectPoint","intersectLine","line","delta","start","intersectsLine","startSign","endSign","end","coplanarPoint","optionalNormalMatrix","referencePoint","_v0$1","_v1$3","_v2$1","_v3","_vab","_vac","_vbc","_vap","_vbp","_vcp","Triangle","getNormal","targetLengthSq","getBarycoord","dot00","dot01","dot02","dot11","dot12","denom","invDenom","u","getUV","p3","uv1","uv2","uv3","isFrontFacing","setFromPointsAndIndices","i0","i1","i2","getArea","getMidpoint","getPlane","d4","vc","d5","d6","vb","va","_colorKeywords","_hslA","_hslB","Color","setRGB","hue2rgb","SRGBToLinear","LinearToSRGB","isColor","setHex","setStyle","hex","setHSL","style","handleAlpha","string","parseFloat","exec","color","components","parseInt","charAt","setColorName","copyGammaToLinear","gammaFactor","copyLinearToGamma","safeInverse","convertGammaToLinear","convertLinearToGamma","copySRGBToLinear","copyLinearToSRGB","convertSRGBToLinear","convertLinearToSRGB","getHex","getHexString","getHSL","hue","saturation","lightness","getStyle","offsetHSL","addColors","color1","color2","lerpHSL","NAMES","Face3","materialIndex","vertexNormals","vertexColors","materialId","Material","blending","side","flatShading","vertexTangents","opacity","transparent","blendSrc","blendDst","blendEquation","blendSrcAlpha","blendDstAlpha","blendEquationAlpha","depthFunc","depthTest","depthWrite","stencilWriteMask","stencilFunc","stencilRef","stencilFuncMask","stencilFail","stencilZFail","stencilZPass","stencilWrite","clippingPlanes","clipIntersection","clipShadows","shadowSide","colorWrite","precision","polygonOffset","polygonOffsetFactor","polygonOffsetUnits","dithering","alphaTest","premultipliedAlpha","toneMapped","isMaterial","onBeforeCompile","setValues","newValue","currentValue","isRoot","roughness","metalness","sheen","emissive","emissiveIntensity","specular","shininess","clearcoat","clearcoatRoughness","clearcoatNormalMap","clearcoatNormalScale","map","matcap","alphaMap","lightMap","aoMap","aoMapIntensity","bumpMap","bumpScale","normalMap","normalMapType","normalScale","displacementMap","displacementScale","displacementBias","roughnessMap","metalnessMap","emissiveMap","specularMap","envMap","reflectivity","refractionRatio","combine","envMapIntensity","gradientMap","sizeAttenuation","linewidth","dashSize","gapSize","wireframe","wireframeLinewidth","wireframeLinecap","wireframeLinejoin","morphTargets","morphNormals","skinning","srcPlanes","dstPlanes","MeshBasicMaterial","lightMapIntensity","isMeshBasicMaterial","_vector$3","BufferAttribute","itemSize","normalized","usage","updateRange","isBufferAttribute","onUploadCallback","setUsage","copyAt","index1","index2","copyArray","copyColorsArray","colors","copyVector2sArray","vectors","copyVector3sArray","copyVector4sArray","setXYZ","setXY","setXYZW","onUpload","Int8BufferAttribute","Int8Array","Uint8BufferAttribute","Uint8Array","Uint8ClampedBufferAttribute","Uint8ClampedArray","Int16BufferAttribute","Int16Array","Uint16BufferAttribute","Uint16Array","Int32BufferAttribute","Int32Array","Uint32BufferAttribute","Uint32Array","Float32BufferAttribute","Float32Array","Float64BufferAttribute","Float64Array","DirectGeometry","vertices","normals","uvs","uvs2","groups","skinWeights","skinIndices","boundingSphere","verticesNeedUpdate","normalsNeedUpdate","colorsNeedUpdate","uvsNeedUpdate","groupsNeedUpdate","computeGroups","group","faces","face","fromGeometry","faceVertexUvs","hasFaceVertexUv","hasFaceVertexUv2","morphTargetsLength","morphTargetsPosition","morphNormalsLength","morphTargetsNormal","hasSkinIndices","hasSkinWeights","vertexUvs","morphTarget","morphNormal","arrayMax","_bufferGeometryId","_m1$2","_obj","_offset","_box$2","_boxMorphTargets","_vector$4","BufferGeometry","attributes","morphAttributes","morphTargetsRelative","drawRange","isBufferGeometry","getIndex","setIndex","getAttribute","setAttribute","deleteAttribute","addGroup","clearGroups","setDrawRange","needsUpdate","tangent","computeBoundingSphere","positions","lineDistances","isGeometry","updateFromObject","direct","__directGeometry","elementsNeedUpdate","lineDistancesNeedUpdate","lineDistance","fromDirectGeometry","morphAttributesPosition","morphAttribute","isNaN","jl","computeFaceNormals","computeVertexNormals","vA","vB","vC","pA","pB","pC","cb","ab","indices","normalizeNormals","merge","attribute1","attributeArray1","attribute2","attributeArray2","attributeOffset","toNonIndexed","convertBufferAttribute","array2","geometry2","newAttribute","morphArray","keys","attributeData","hasMorphAttributes","attributeArray","_inverseMatrix","_ray","_sphere","_vA","_vB","_vC","_tempA","_tempB","_tempC","_morphA","_morphB","_morphC","_uvA","_uvB","_uvC","_intersectionPoint","_intersectionPointWorld","Mesh","updateMorphTargets","morphTargetInfluences","morphTargetDictionary","ml","String","raycaster","intersects","intersection","morphPosition","groupMaterial","checkBufferGeometryIntersection","faceIndex","fvA","fvB","fvC","isMultiMaterial","fl","faceMaterial","checkIntersection","uvs_f","morphInfluences","influence","_geometryId","_m1$3","_obj$1","_offset$1","Geometry","vertex","fromBufferGeometry","scope","addFace","areaWeighted","vl","computeFlatVertexNormals","computeMorphNormals","__originalFaceNormal","__originalVertexNormals","tmpGeo","faceNormals","dstNormalsFace","dstNormalsVertex","faceNormal","materialIndexOffset","vertexOffset","vertices1","vertices2","faces1","faces2","colors1","colors2","vertexCopy","faceCopy","faceVertexNormals","faceVertexColors","faceVertexUvs2","uvsCopy","k","kl","mergeMesh","mesh","mergeVertices","verticesMap","unique","changes","precisionPoints","faceIndicesToRemove","idx","diff","sortFacesByMaterialIndex","_id","materialIndexSort","sort","uvs1","newUvs1","newUvs2","normalsHash","colorsHash","uvsHash","hasMaterial","hasFaceUv","hasFaceNormal","hasFaceVertexNormal","hasFaceColor","hasFaceVertexColor","faceType","setBit","getUvIndex","getNormalIndex","getColorIndex","enabled","hash","srcVertexNormal","destVertexNormal","BoxGeometry","depth","widthSegments","heightSegments","depthSegments","BoxBufferGeometry","numberOfVertices","groupStart","buildPlane","udir","vdir","gridX","gridY","segmentWidth","segmentHeight","widthHalf","heightHalf","depthHalf","gridX1","gridY1","vertexCounter","groupCount","cloneUniforms","property","mergeUniforms","uniforms","merged","UniformsUtils","default_vertex","default_fragment","ShaderMaterial","defines","vertexShader","fragmentShader","lights","clipping","extensions","derivatives","fragDepth","drawBuffers","shaderTextureLOD","defaultAttributeValues","index0AttributeName","uniformsNeedUpdate","isShaderMaterial","uniform","Camera","PerspectiveCamera","fov","aspect","zoom","focus","view","filmGauge","filmOffset","updateProjectionMatrix","isPerspectiveCamera","setFocalLength","focalLength","vExtentSlope","getFilmHeight","atan","getFocalLength","tan","getEffectiveFOV","getFilmWidth","setViewOffset","fullWidth","fullHeight","offsetX","offsetY","clearViewOffset","skew","CubeCamera","cubeResolution","cameraPX","cameraNX","cameraPY","cameraNY","cameraPZ","cameraNZ","renderTarget","WebGLCubeRenderTarget","renderer","scene","currentRenderTarget","getRenderTarget","setRenderTarget","render","clear","stencil","dummy","isWebGLCubeRenderTarget","fromEquirectangularTexture","shader","tEquirect","join","DataTexture","isDataTexture","_sphere$1","_vector$5","Frustum","p4","p5","planes","frustum","setFromProjectionMatrix","me0","me1","me2","me3","me4","me5","me6","me7","me8","me9","me10","me11","me12","me13","me14","me15","intersectsObject","intersectsSprite","sprite","negRadius","UniformsLib","common","diffuse","uvTransform","uv2Transform","specularmap","envmap","flipEnvMap","maxMipLevel","aomap","lightmap","emissivemap","bumpmap","normalmap","displacementmap","roughnessmap","metalnessmap","gradientmap","fogDensity","fogNear","fogFar","fogColor","ambientLightColor","lightProbe","directionalLights","properties","shadow","shadowBias","shadowRadius","shadowMapSize","directionalShadowMap","directionalShadowMatrix","spotLights","coneCos","penumbraCos","decay","spotShadowMap","spotShadowMatrix","pointLights","shadowCameraNear","shadowCameraFar","pointShadowMap","pointShadowMatrix","hemisphereLights","skyColor","groundColor","rectAreaLights","WebGLAnimation","isAnimating","animationLoop","onAnimationFrame","time","frame","requestAnimationFrame","stop","setAnimationLoop","setContext","WebGLAttributes","gl","capabilities","isWebGL2","buffers","WeakMap","createBuffer","bufferType","buffer","bindBuffer","bufferData","bytesPerElement","BYTES_PER_ELEMENT","updateBuffer","bufferSubData","subarray","isInterleavedBufferAttribute","deleteBuffer","delete","PlaneGeometry","PlaneBufferGeometry","width_half","height_half","segment_width","segment_height","alphamap_fragment","alphamap_pars_fragment","alphatest_fragment","aomap_fragment","aomap_pars_fragment","begin_vertex","beginnormal_vertex","bsdfs","bumpmap_pars_fragment","clipping_planes_fragment","clipping_planes_pars_fragment","clipping_planes_pars_vertex","clipping_planes_vertex","color_fragment","color_pars_fragment","color_pars_vertex","color_vertex","cube_uv_reflection_fragment","defaultnormal_vertex","displacementmap_pars_vertex","displacementmap_vertex","emissivemap_fragment","emissivemap_pars_fragment","encodings_fragment","encodings_pars_fragment","envmap_fragment","envmap_common_pars_fragment","envmap_pars_fragment","envmap_pars_vertex","envmap_vertex","fog_vertex","fog_pars_vertex","fog_fragment","fog_pars_fragment","gradientmap_pars_fragment","lightmap_fragment","lightmap_pars_fragment","lights_lambert_vertex","lights_pars_begin","envmap_physical_pars_fragment","lights_toon_fragment","lights_toon_pars_fragment","lights_phong_fragment","lights_phong_pars_fragment","lights_physical_fragment","lights_physical_pars_fragment","lights_fragment_begin","lights_fragment_maps","lights_fragment_end","logdepthbuf_fragment","logdepthbuf_pars_fragment","logdepthbuf_pars_vertex","logdepthbuf_vertex","map_fragment","map_pars_fragment","map_particle_fragment","map_particle_pars_fragment","metalnessmap_fragment","metalnessmap_pars_fragment","morphnormal_vertex","morphtarget_pars_vertex","morphtarget_vertex","normal_fragment_begin","normal_fragment_maps","normalmap_pars_fragment","clearcoat_normal_fragment_begin","clearcoat_normal_fragment_maps","clearcoat_normalmap_pars_fragment","packing","premultiplied_alpha_fragment","project_vertex","dithering_fragment","dithering_pars_fragment","roughnessmap_fragment","roughnessmap_pars_fragment","shadowmap_pars_fragment","shadowmap_pars_vertex","shadowmap_vertex","shadowmask_pars_fragment","skinbase_vertex","skinning_pars_vertex","skinning_vertex","skinnormal_vertex","specularmap_fragment","specularmap_pars_fragment","tonemapping_fragment","tonemapping_pars_fragment","uv_pars_fragment","uv_pars_vertex","uv_vertex","uv2_pars_fragment","uv2_pars_vertex","uv2_vertex","worldpos_vertex","background_frag","background_vert","cube_frag","cube_vert","depth_frag","depth_vert","distanceRGBA_frag","distanceRGBA_vert","equirect_frag","equirect_vert","linedashed_frag","linedashed_vert","meshbasic_frag","meshbasic_vert","meshlambert_frag","meshlambert_vert","meshmatcap_frag","meshmatcap_vert","meshtoon_frag","meshtoon_vert","meshphong_frag","meshphong_vert","meshphysical_frag","meshphysical_vert","normal_frag","normal_vert","points_frag","points_vert","shadow_frag","shadow_vert","sprite_frag","sprite_vert","ShaderChunk","ShaderLib","basic","lambert","phong","standard","toon","dashed","totalSize","t2D","cube","equirect","distanceRGBA","referencePosition","nearDistance","farDistance","physical","transparency","WebGLBackground","state","objects","clearColor","clearAlpha","planeMesh","boxMesh","currentBackground","currentBackgroundVersion","currentTonemapping","renderList","forceClear","xr","session","getSession","environmentBlendMode","setClear","autoClear","autoClearColor","autoClearDepth","autoClearStencil","isCubeTexture","toneMapping","unshift","getClearColor","setClearColor","getClearAlpha","setClearAlpha","WebGLBufferRenderer","info","mode","setMode","drawArrays","renderInstances","primcount","extension","methodName","WebGLCapabilities","maxAnisotropy","getMaxAnisotropy","MAX_TEXTURE_MAX_ANISOTROPY_EXT","getMaxPrecision","getShaderPrecisionFormat","WebGL2RenderingContext","WebGL2ComputeRenderingContext","maxPrecision","logarithmicDepthBuffer","maxTextures","maxVertexTextures","maxTextureSize","maxCubemapSize","maxAttributes","maxVertexUniforms","maxVaryings","maxFragmentUniforms","vertexTextures","floatFragmentTextures","floatVertexTextures","maxSamples","WebGLClipping","globalState","numGlobalPlanes","localClippingEnabled","renderingShadows","viewNormalMatrix","numPlanes","numIntersection","init","enableLocalClipping","projectPlanes","beginShadows","endShadows","resetGlobalState","setState","fromCache","nGlobal","lGlobal","dstArray","clippingState","skipTransform","nPlanes","flatSize","viewMatrix","i4","WebGLExtensions","getExtension","WebGLGeometries","wireframeAttributes","onGeometryDispose","buffergeometry","memory","_bufferGeometry","geometryAttributes","updateWireframeAttribute","geometryIndex","geometryPosition","previousAttribute","getWireframeAttribute","currentAttribute","WebGLIndexedBufferRenderer","drawElements","WebGLInfo","calls","triangles","lines","instanceCount","reset","programs","autoReset","absNumericalSort","WebGLMorphtargets","influencesList","program","objectInfluences","influences","morphInfluencesSum","morphBaseInfluence","getUniforms","setValue","WebGLObjects","updateList","CubeTexture","DataTexture2DArray","wrapR","isDataTexture2DArray","DataTexture3D","isDataTexture3D","emptyTexture","emptyTexture2dArray","emptyTexture3d","emptyCubeTexture","arrayCacheF32","arrayCacheI32","mat4array","mat3array","mat2array","flatten","nBlocks","blockSize","firstElem","arraysEqual","allocTexUnits","allocateTextureUnit","setValueV1f","uniform1f","addr","setValueV2f","uniform2f","uniform2fv","setValueV3f","uniform3f","uniform3fv","setValueV4f","uniform4f","uniform4fv","setValueM2","uniformMatrix2fv","setValueM3","uniformMatrix3fv","setValueM4","uniformMatrix4fv","setValueT1","unit","uniform1i","safeSetTexture2D","setValueT2DArray1","setTexture2DArray","setValueT3D1","setTexture3D","setValueT6","safeSetTextureCube","setValueV1i","setValueV2i","uniform2iv","setValueV3i","uniform3iv","setValueV4i","uniform4iv","setValueV1ui","uniform1ui","getSingularSetter","setValueV1fArray","uniform1fv","setValueV1iArray","uniform1iv","setValueV2iArray","setValueV3iArray","setValueV4iArray","setValueV2fArray","setValueV3fArray","setValueV4fArray","setValueM2Array","setValueM3Array","setValueM4Array","setValueT1Array","units","setValueT6Array","getPureArraySetter","SingleUniform","activeInfo","PureArrayUniform","updateCache","StructuredUniform","seq","RePathPart","addUniform","container","uniformObject","parseUniform","path","pathLength","lastIndex","matchEnd","idIsIndex","subscript","next","WebGLUniforms","getProgramParameter","getActiveUniform","getUniformLocation","setOptional","upload","seqWithValue","WebGLShader","createShader","shaderSource","compileShader","programIdCount","addLineNumbers","split","getEncodingComponents","getShaderErrors","status","getShaderParameter","getShaderInfoLog","trim","getShaderSource","getTexelDecodingFunction","functionName","getTexelEncodingFunction","getToneMappingFunction","toneMappingName","generateExtensions","chunks","extensionDerivatives","envMapCubeUV","tangentSpaceNormalMap","shaderID","extensionFragDepth","rendererExtensionFragDepth","extensionDrawBuffers","rendererExtensionDrawBuffers","extensionShaderTextureLOD","rendererExtensionShaderTextureLod","filter","filterEmptyLine","generateDefines","fetchAttributeLocations","getActiveAttrib","getAttribLocation","replaceLightNums","replace","numDirLights","numSpotLights","numRectAreaLights","numPointLights","numHemiLights","numDirLightShadows","numSpotLightShadows","numPointLightShadows","replaceClippingPlaneNums","numClippingPlanes","numClipIntersection","includePattern","resolveIncludes","includeReplacer","include","loopPattern","unrollLoops","loopReplacer","snippet","generatePrecision","precisionstring","generateShadowMapTypeDefine","shadowMapTypeDefine","shadowMapType","generateEnvMapTypeDefine","envMapTypeDefine","envMapMode","generateEnvMapModeDefine","envMapModeDefine","generateEnvMapBlendingDefine","envMapBlendingDefine","WebGLProgram","cacheKey","gammaFactorDefine","customExtensions","customDefines","createProgram","prefixVertex","prefixFragment","numMultiviewViews","isRawShaderMaterial","shaderName","instancing","supportsVertexTextures","maxBones","useFog","fogExp2","objectSpaceNormalMap","uvsVertexOnly","useVertexTexture","doubleSided","flipSided","shadowMapEnabled","physicallyCorrectLights","outputEncoding","mapEncoding","matcapEncoding","envMapEncoding","emissiveMapEncoding","lightMapEncoding","depthPacking","isGLSL3ShaderMaterial","versionRegex","vertexGlsl","fragmentGlsl","glVertexShader","glFragmentShader","attachShader","bindAttribLocation","linkProgram","debug","checkShaderErrors","programLog","getProgramInfoLog","vertexLog","fragmentLog","runnable","haveDiagnostics","vertexErrors","fragmentErrors","getError","diagnostics","prefix","deleteShader","cachedUniforms","cachedAttributes","getAttributes","destroy","deleteProgram","usedTimes","WebGLPrograms","shaderIDs","MeshDepthMaterial","MeshDistanceMaterial","MeshNormalMaterial","MeshLambertMaterial","MeshPhongMaterial","MeshToonMaterial","MeshStandardMaterial","MeshPhysicalMaterial","MeshMatcapMaterial","LineBasicMaterial","LineDashedMaterial","PointsMaterial","ShadowMaterial","SpriteMaterial","parameterNames","getShaderObject","shaderobject","allocateBones","skeleton","bones","nVertexUniforms","nVertexMatrices","getTextureEncodingFromMap","getParameters","shadows","nClipPlanes","nClipIntersection","isMeshStandardMaterial","isSkinnedMesh","isWebGLMultiviewRenderTarget","numViews","isFogExp2","maxMorphTargets","maxMorphNormals","directional","spot","rectArea","hemi","shadowMap","frawbuffers","extensionDrawbuffers","drawbuffers","getProgramCacheKey","acquireProgram","pl","preexistingProgram","releaseProgram","pop","WebGLProperties","painterSortStable","groupOrder","reversePainterSortStable","WebGLRenderList","renderItems","renderItemsIndex","opaque","defaultProgram","getNextRenderItem","renderItem","customOpaqueSort","customTransparentSort","WebGLRenderLists","lists","onSceneDispose","cameras","list","UniformsCache","light","halfWidth","halfHeight","nextVersion","shadowCastingLightsFirst","lightA","lightB","WebGLLights","directionalLength","pointLength","spotLength","rectAreaLength","hemiLength","numDirectionalShadows","numPointShadows","numSpotShadows","ambient","probe","vector3","matrix42","setup","intensity","isAmbientLight","isLightProbe","sh","coefficients","isDirectionalLight","bias","mapSize","isSpotLight","penumbra","isRectAreaLight","isPointLight","isHemisphereLight","WebGLRenderState","lightsArray","shadowsArray","pushLight","pushShadow","shadowLight","setupLights","WebGLRenderStates","renderStates","renderState","has","isMeshDepthMaterial","isMeshDistanceMaterial","vsm_frag","vsm_vert","WebGLShadowMap","_renderer","_objects","_frustum","_shadowMapSize","_viewportSize","_viewport","_depthMaterials","_distanceMaterials","_materialCache","shadowMaterialVertical","SAMPLE_RATE","HALF_SAMPLE_RATE","shadow_pass","resolution","shadowMaterialHorizonal","HORIZONAL_PASS","fullScreenTri","fullScreenMesh","activeCubeFace","getActiveCubeFace","activeMipmapLevel","getActiveMipmapLevel","_state","setBlending","setTest","setScissorTest","shadowFrameExtents","getFrameExtents","isPointLightShadow","pars","mapPass","viewportCount","getViewportCount","vp","getViewport","updateMatrices","getFrustum","renderObject","VSMPass","renderBufferDirect","getDepthMaterialVariant","useMorphing","useSkinning","useInstancing","getDistanceMaterialVariant","getDepthMaterial","result","getMaterialVariant","customMaterial","customDepthMaterial","customDistanceMaterial","keyA","keyB","materialsForVariant","cachedMaterial","shadowCamera","depthMaterial","WebGLState","ColorBuffer","locked","currentColorMask","currentColorClear","setMask","colorMask","setLocked","lock","DepthBuffer","currentDepthMask","currentDepthFunc","currentDepthClear","depthMask","setFunc","clearDepth","StencilBuffer","currentStencilMask","currentStencilFunc","currentStencilRef","currentStencilFuncMask","currentStencilFail","currentStencilZFail","currentStencilZPass","currentStencilClear","stencilTest","stencilMask","setOp","stencilOp","clearStencil","colorBuffer","maxVertexAttributes","newAttributes","enabledAttributes","attributeDivisors","enabledCapabilities","currentProgram","currentBlendingEnabled","currentBlending","currentBlendEquation","currentBlendSrc","currentBlendDst","currentBlendEquationAlpha","currentBlendSrcAlpha","currentBlendDstAlpha","currentPremultipledAlpha","currentFlipSided","currentCullFace","currentLineWidth","currentPolygonOffsetFactor","currentPolygonOffsetUnits","lineWidthAvailable","glVersion","currentTextureSlot","currentBoundTextures","currentScissor","currentViewport","createTexture","bindTexture","texParameteri","texImage2D","emptyTextures","setFlipSided","setCullFace","initAttributes","enableAttribute","enableAttributeAndDivisor","meshPerAttribute","enableVertexAttribArray","disableUnusedAttributes","disableVertexAttribArray","useProgram","equationToGL","MIN_EXT","MAX_EXT","factorToGL","blendFuncSeparate","blendFunc","blendEquationSeparate","setMaterial","frontFaceCW","setPolygonOffset","frontFace","cullFace","setLineWidth","lineWidth","factor","activeTexture","webglSlot","webglType","webglTexture","boundTexture","unbindTexture","compressedTexImage2D","texImage3D","WebGLTextures","_gl","utils","_videoTextures","useOffscreenCanvas","OffscreenCanvas","err","createCanvas","resizeImage","needsPowerOfTwo","needsNewCanvas","maxSize","HTMLImageElement","ImageBitmap","textureNeedsPowerOfTwo","textureNeedsGenerateMipmaps","supportsMips","generateMipmap","textureProperties","__maxMipLevel","LOG2E","getInternalFormat","internalFormatName","glFormat","glType","filterFallback","onTextureDispose","deallocateTexture","isVideoTexture","onRenderTargetDispose","deallocateRenderTarget","__webglInit","deleteTexture","__webglTexture","renderTargetProperties","deleteFramebuffer","__webglFramebuffer","__webglDepthbuffer","deleteRenderbuffer","__webglColorTexture","__webglDepthStencilTexture","__webglViewFramebuffers","textureUnits","resetTextureUnits","textureUnit","setTexture2D","slot","updateVideoTexture","__version","complete","uploadTexture","setTextureCube","initTexture","pixelStorei","isCompressed","isCompressedTexture","cubeImage","convert","glInternalFormat","setTextureParameters","mipmap","mipmapImage","setTextureCubeDynamic","wrappingToGL","filterToGL","textureType","__currentAnisotropy","texParameterf","TEXTURE_MAX_ANISOTROPY_EXT","isDepthTexture","setupFrameBufferTexture","framebuffer","attachment","textureTarget","bindFramebuffer","framebufferTexture2D","setupRenderBufferStorage","renderbuffer","isMultisample","bindRenderbuffer","getRenderTargetSamples","renderbufferStorageMultisample","renderbufferStorage","framebufferRenderbuffer","setupDepthTexture","isCube","webglDepthTexture","setupDepthRenderbuffer","createRenderbuffer","setupRenderTarget","isMultiview","createFramebuffer","__webglMultisampledFramebuffer","__webglColorRenderbuffer","__webglDepthRenderbuffer","ext","colorTexture","framebufferTextureMultiviewOVR","depthStencilTexture","viewFramebuffers","framebufferTextureLayer","updateRenderTargetMipmap","updateMultisampleRenderTarget","blitFramebuffer","warnedTexture2D","warnedTextureCube","WebGLUtils","HALF_FLOAT_OES","COMPRESSED_RGB_S3TC_DXT1_EXT","COMPRESSED_RGBA_S3TC_DXT1_EXT","COMPRESSED_RGBA_S3TC_DXT3_EXT","COMPRESSED_RGBA_S3TC_DXT5_EXT","COMPRESSED_RGB_PVRTC_4BPPV1_IMG","COMPRESSED_RGB_PVRTC_2BPPV1_IMG","COMPRESSED_RGBA_PVRTC_4BPPV1_IMG","COMPRESSED_RGBA_PVRTC_2BPPV1_IMG","COMPRESSED_RGB_ETC1_WEBGL","UNSIGNED_INT_24_8_WEBGL","WebGLMultiviewRenderTarget","setNumViews","WebGLMultiview","DEFAULT_NUMVIEWS","mat3","mat4","cameraArray","renderSize","available","maxNumViews","isAvailable","getContextAttributes","antialias","MAX_VIEWS_OVR","getCameraArray","isArrayCamera","updateCameraProjectionMatricesUniform","updateCameraViewMatricesUniform","updateObjectMatricesUniforms","isMultiviewCompatible","resizeRenderTarget","getDrawingBufferSize","attachCamera","detachCamera","flush","srcRenderTarget","srcFramebuffers","viewWidth","viewHeight","ArrayCamera","Group","isGroup","WebXRManager","referenceSpace","referenceSpaceType","pose","controllers","inputSourcesMap","Map","cameraL","cameraR","cameraVR","_currentDepthNear","_currentDepthFar","isPresenting","getController","controller","targetRay","getControllerGrip","grip","onSessionEvent","inputSource","onSessionEnd","forEach","setFramebuffer","animation","onRequestReferenceSpace","setFramebufferScaleFactor","setReferenceSpaceType","getReferenceSpace","setSession","layerInit","baseLayer","XRWebGLLayer","updateRenderState","requestReferenceSpace","then","updateInputSources","inputSources","removed","added","cameraLPos","cameraRPos","setProjectionFromUnion","ipd","projL","projR","topFov","bottomFov","leftFov","rightFov","zOffset","xOffset","near2","far2","left2","right2","top2","bottom2","updateCamera","getCamera","depthNear","depthFar","onAnimationFrameCallback","getViewerPose","views","transform","inputPose","gripPose","getPose","targetRaySpace","gripSpace","WebGLRenderer","_context","_alpha","_depth","_stencil","_antialias","_premultipliedAlpha","_preserveDrawingBuffer","preserveDrawingBuffer","_powerPreference","powerPreference","_failIfMajorPerformanceCaveat","failIfMajorPerformanceCaveat","currentRenderList","currentRenderState","domElement","sortObjects","toneMappingExposure","toneMappingWhitePoint","_this","_isContextLost","_framebuffer","_currentActiveCubeFace","_currentActiveMipmapLevel","_currentRenderTarget","_currentFramebuffer","_currentMaterialId","_currentGeometryProgram","_currentCamera","_currentArrayCamera","_currentViewport","_currentScissor","_currentScissorTest","_width","_height","_pixelRatio","_opaqueSort","_transparentSort","_scissor","_scissorTest","_clipping","_clippingEnabled","_localClippingEnabled","_projScreenMatrix","_vector3","getTargetPixelRatio","contextAttributes","xrCompatible","onContextLost","onContextRestore","message","programCache","renderLists","morphtargets","bufferRenderer","indexedBufferRenderer","initGLContext","multiview","forceContextLoss","loseContext","forceContextRestore","restoreContext","getPixelRatio","setPixelRatio","updateStyle","setViewport","setDrawingBufferSize","pixelRatio","getCurrentViewport","getScissor","setScissor","getScissorTest","boolean","setOpaqueSort","method","setTransparentSort","bits","preventDefault","onMaterialDispose","deallocateMaterial","releaseMaterialProgramReference","programInfo","renderObjectImmediate","renderBufferImmediate","hasPositions","hasNormals","hasUvs","hasColors","programAttributes","positionArray","vertexAttribPointer","normalArray","uvArray","colorArray","tempScene","setProgram","updateBuffers","rangeFactor","setupVertexAttributes","dataCount","rangeStart","rangeCount","drawStart","drawEnd","drawCount","isLineSegments","isLineLoop","isSprite","isInstancedBufferGeometry","maxInstancedCount","materialDefaultAttributeValues","programAttribute","geometryAttribute","stride","isInstancedInterleavedBuffer","isInstancedBufferAttribute","vertexAttrib2fv","vertexAttrib3fv","vertexAttrib4fv","vertexAttrib1fv","compile","compiled","initMaterial","window","projectObject","opaqueObjects","transparentObjects","renderObjects","isLOD","isImmediateRenderObject","camera2","materialProperties","lightsStateVersion","programCacheKey","programChange","numSupportedMorphTargets","numSupportedMorphNormals","needsLights","materialNeedsLights","progUniforms","uniformsList","useCache","refreshProgram","refreshMaterial","refreshLights","p_uniforms","m_uniforms","isMeshPhongMaterial","isMeshToonMaterial","uCamPos","cameraPosition","isMeshLambertMaterial","isOrthographicCamera","boneTexture","boneMatrices","boneTextureSize","markUniformsLightsNeedsUpdate","refreshUniformsFog","refreshUniformsCommon","refreshUniformsLambert","refreshUniformsToon","refreshUniformsPhong","isMeshPhysicalMaterial","refreshUniformsPhysical","refreshUniformsStandard","isMeshMatcapMaterial","refreshUniformsMatcap","refreshUniformsDepth","refreshUniformsDistance","isMeshNormalMaterial","refreshUniformsNormal","isLineBasicMaterial","refreshUniformsLine","isLineDashedMaterial","refreshUniformsDash","isPointsMaterial","refreshUniformsPoints","isSpriteMaterial","refreshUniformsSprites","isShadowMaterial","ltc_1","LTC_1","ltc_2","LTC_2","uvScaleMap","uv2ScaleMap","isFog","density","readRenderTargetPixels","activeCubeFaceIndex","restore","textureFormat","checkFramebufferStatus","readPixels","copyFramebufferToTexture","level","levelScale","copyTexImage2D","copyTextureToTexture","srcTexture","dstTexture","texSubImage2D","FogExp2","Fog","InterleavedBuffer","isInterleavedBuffer","_vector$6","InterleavedBufferAttribute","interleavedBuffer","_geometry","_intersectPoint","_worldScale","_mvPosition","_alignedPosition","_rotatedPosition","_viewWorldMatrix","_vA$1","_vB$1","_vC$1","_uvA$1","_uvB$1","_uvC$1","Sprite","float32Array","transformVertex","vertexPosition","mvPosition","_v1$4","_v2$2","LOD","levels","addLevel","getObjectForDistance","SkinnedMesh","bindMode","bindMatrix","bindMatrixInverse","bind","calculateInverses","normalizeSkinWeights","skinWeight","_offsetMatrix","_identityMatrix","Skeleton","boneInverses","bone","isBone","getBoneByName","Bone","_instanceLocalMatrix","_instanceWorldMatrix","_instanceIntersects","_mesh","InstancedMesh","getMatrixAt","raycastTimes","instanceId","setMatrixAt","linecap","linejoin","_start","_end","_inverseMatrix$1","_ray$1","_sphere$2","Line","computeLineDistances","positionAttribute","linePrecision","localPrecision","localPrecisionSq","vStart","vEnd","interSegment","interRay","distSq","nbVertices","_start$1","_end$1","LineSegments","LineLoop","_inverseMatrix$2","_ray$2","_sphere$3","_position$1","Points","threshold","params","localThreshold","localThresholdSq","testPoint","rayPointDistanceSq","intersectPoint","distanceToRay","VideoTexture","video","readyState","HAVE_CURRENT_DATA","CompressedTexture","CanvasTexture","isCanvasTexture","DepthTexture","WireframeGeometry","o","ol","edge","edges","edge1","edge2","ParametricGeometry","func","slices","stacks","ParametricBufferGeometry","pu","pv","sliceCount","PolyhedronGeometry","PolyhedronBufferGeometry","vertexBuffer","uvBuffer","subdivide","applyRadius","generateUVs","getVertexByIndex","subdivideFace","cols","aj","bj","rows","pushVertex","azimuth","inclination","correctUVs","correctSeam","centroid","uvA","uvB","uvC","azi","correctUV","TetrahedronGeometry","TetrahedronBufferGeometry","OctahedronGeometry","OctahedronBufferGeometry","IcosahedronGeometry","IcosahedronBufferGeometry","DodecahedronGeometry","DodecahedronBufferGeometry","TubeGeometry","tubularSegments","radialSegments","closed","taper","bufferGeometry","TubeBufferGeometry","tangents","binormals","frames","computeFrenetFrames","P","generateBufferData","generateSegment","generateIndices","getPointAt","N","B","TorusKnotGeometry","tube","heightScale","TorusKnotBufferGeometry","P1","P2","T","calculatePositionOnCurve","cu","su","quOverP","cs","TorusGeometry","arc","TorusBufferGeometry","Earcut","triangulate","holeIndices","dim","hasHoles","outerLen","outerNode","linkedList","prev","invSize","eliminateHoles","earcutLinked","clockwise","last","signedArea","insertNode","removeNode","filterPoints","again","steiner","area","ear","pass","indexCurve","isEarHashed","isEar","cureLocalIntersections","splitEarcut","pointInTriangle","minTX","minTY","maxTX","maxTY","zOrder","prevZ","nextZ","locallyInside","isValidDiagonal","splitPolygon","getLeftmost","compareX","eliminateHole","hole","findHoleBridge","hx","hy","mx","my","tanMin","sortLinked","tail","numMerges","pSize","qSize","inSize","leftmost","px","py","intersectsPolygon","middleInside","q1","q2","inside","Node","an","bp","sum","ShapeUtils","contour","isClockWise","pts","triangulateShape","holes","removeDupEndPts","addContour","holeIndex","ExtrudeGeometry","ExtrudeBufferGeometry","verticesArray","addShape","placeholder","curveSegments","steps","bevelEnabled","bevelThickness","bevelSize","bevelOffset","bevelSegments","extrudePath","uvgen","UVGenerator","WorldUVGenerator","amount","extrudePts","extrudeByPath","splineTube","binormal","position2","getSpacedPoints","ahole","hl","shapePoints","extractPoints","reverse","scalePt2","pt","vec","bs","vert","vlen","flen","getBevelVec","inPt","inPrev","inNext","v_trans_x","v_trans_y","shrink_by","v_prev_x","v_prev_y","v_next_x","v_next_y","v_prev_lensq","collinear0","v_prev_len","v_next_len","ptPrevShift_x","ptPrevShift_y","ptNextShift_x","ptNextShift_y","sf","v_trans_lensq","direction_eq","contourMovements","holesMovements","oneHoleMovements","verticesMovements","buildLidFaces","buildSideFaces","layer","f3","layeroffset","sidewalls","sl","slen1","slen2","f4","addVertex","nextIndex","generateTopUV","addUV","generateSideWallUV","vector2","indexA","indexB","indexC","a_x","a_y","b_x","b_y","c_x","c_y","indexD","a_z","b_z","c_z","d_x","d_y","d_z","TextGeometry","text","TextBufferGeometry","font","isFont","generateShapes","SphereGeometry","phiStart","phiLength","thetaStart","thetaLength","SphereBufferGeometry","thetaEnd","grid","verticesRow","uOffset","RingGeometry","innerRadius","outerRadius","thetaSegments","phiSegments","RingBufferGeometry","segment","radiusStep","thetaSegmentLevel","LatheGeometry","segments","LatheBufferGeometry","base","inverseSegments","n1","n2","ShapeGeometry","ShapeBufferGeometry","toJSON$1","shapeHole","indexOffset","shapeVertices","shapeHoles","EdgesGeometry","thresholdAngle","thresholdDot","sourceVertices","face1","face2","CylinderGeometry","radiusTop","radiusBottom","openEnded","CylinderBufferGeometry","indexArray","generateTorso","generateCap","slope","indexRow","sinTheta","cosTheta","centerIndexStart","centerIndexEnd","ConeGeometry","ConeBufferGeometry","CircleGeometry","CircleBufferGeometry","Geometries","freeze","__proto__","RawShaderMaterial","Materials","AnimationUtils","arraySlice","from","to","isTypedArray","convertArray","forceClone","ArrayBuffer","isView","DataView","getKeyframeOrder","times","compareTime","sortedArray","nValues","srcOffset","flattenJSON","jsonKeys","valuePropertyName","subclip","sourceClip","startFrame","endFrame","fps","clip","tracks","track","valueSize","getValueSize","minStartTime","shift","resetDuration","Interpolant","parameterPositions","sampleValues","sampleSize","resultBuffer","_cachedIndex","evaluate","pp","validate_interval","seek","linear_scan","forward_scan","giveUpAt","afterEnd_","t1global","beforeStart_","mid","intervalChanged_","interpolate_","settings","DefaultSettings_","getSettings_","copySampleValue_","CubicInterpolant","_weightPrev","_offsetPrev","_weightNext","_offsetNext","endingStart","endingEnd","iPrev","iNext","tPrev","tNext","halfDt","o1","o0","oP","oN","wP","wN","ppp","sP","sN","LinearInterpolant","offset1","offset0","weight1","weight0","DiscreteInterpolant","KeyframeTrack","interpolation","TimeBufferType","ValueBufferType","setInterpolation","DefaultInterpolation","trackType","json","getInterpolation","ValueTypeName","InterpolantFactoryMethodDiscrete","InterpolantFactoryMethodLinear","InterpolantFactoryMethodSmooth","factoryMethod","createInterpolant","timeOffset","timeScale","startTime","endTime","nKeys","validate","valid","prevTime","currTime","optimize","smoothInterpolation","writeIndex","keep","timeNext","offsetP","offsetN","readOffset","writeOffset","TypedKeyframeTrack","BooleanKeyframeTrack","ColorKeyframeTrack","NumberKeyframeTrack","QuaternionLinearInterpolant","QuaternionKeyframeTrack","StringKeyframeTrack","VectorKeyframeTrack","AnimationClip","duration","getTrackTypeForValueTypeName","typeName","toLowerCase","parseKeyframeTrack","jsonTracks","frameTime","clipTracks","CreateFromMorphTargetSequence","morphTargetSequence","noLoop","numMorphTargets","findByName","objectOrClipArray","clipArray","animations","CreateClipsFromMorphTargetSequences","animationToMorphTargets","pattern","parts","animationMorphTargets","clips","parseAnimation","addNonemptyTrack","trackName","animationKeys","propertyName","destTracks","clipName","hierarchyTracks","hierarchy","morphTargetNames","morphTargetName","animationKey","boneName","Cache","files","file","LoadingManager","onLoad","onProgress","onError","isLoading","itemsLoaded","itemsTotal","urlModifier","handlers","onStart","itemStart","itemEnd","itemError","resolveURL","setURLModifier","addHandler","regex","loader","removeHandler","getHandler","global","DefaultLoadingManager","Loader","manager","crossOrigin","resourcePath","load","setCrossOrigin","setPath","setResourcePath","loading","FileLoader","cached","dataUriRegex","dataUriRegexResult","mimeType","isBase64","decodeURIComponent","atob","response","responseType","charCodeAt","Blob","parser","DOMParser","parseFromString","request","XMLHttpRequest","open","callbacks","withCredentials","overrideMimeType","header","requestHeader","setRequestHeader","send","setResponseType","setWithCredentials","setMimeType","AnimationLoader","CompressedTextureLoader","loadTexture","texDatas","loaded","mipmapCount","isCubemap","DataTextureLoader","texData","ImageLoader","onImageLoad","onImageError","substr","CubeTextureLoader","urls","TextureLoader","isJPEG","search","Curve","arcLengthDivisions","getPoint","optionalTarget","getUtoTmapping","getPoints","divisions","getLength","lengths","getLengths","cacheArcLengths","current","updateArcLengths","arcLengths","targetArcLength","comparison","lengthBefore","lengthAfter","segmentLength","segmentFraction","getTangent","t2","pt1","pt2","getTangentAt","mat","MAX_VALUE","tz","fromJSON","EllipseCurve","aX","aY","xRadius","yRadius","aStartAngle","aEndAngle","aClockwise","aRotation","isEllipseCurve","twoPi","deltaAngle","samePoints","ArcCurve","aRadius","isArcCurve","CubicPoly","c0","initCatmullRom","x3","tension","initNonuniformCatmullRom","dt0","dt1","dt2","calc","t3","pz","CatmullRomCurve3","curveType","isCatmullRomCurve3","intPoint","weight","CatmullRom","QuadraticBezierP0","QuadraticBezierP1","QuadraticBezierP2","QuadraticBezier","CubicBezierP0","CubicBezierP1","CubicBezierP2","CubicBezierP3","CubicBezier","CubicBezierCurve","v3","isCubicBezierCurve","CubicBezierCurve3","isCubicBezierCurve3","LineCurve","isLineCurve","LineCurve3","isLineCurve3","QuadraticBezierCurve","isQuadraticBezierCurve","QuadraticBezierCurve3","isQuadraticBezierCurve3","SplineCurve","isSplineCurve","Curves","CurvePath","curves","autoClose","curve","closePath","startPoint","endPoint","curveLengths","getCurveLengths","lens","cacheLengths","sums","Path","currentPoint","moveTo","lineTo","quadraticCurveTo","aCPx","aCPy","bezierCurveTo","aCP1x","aCP1y","aCP2x","aCP2y","splineThru","npts","absarc","absellipse","ellipse","firstPoint","lastPoint","Shape","getPointsHoles","holesPts","Light","HemisphereLight","LightShadow","_frameExtents","_viewportCount","_viewports","_lightPositionWorld","_lookTarget","shadowMatrix","projScreenMatrix","lookTarget","lightPositionWorld","viewportIndex","SpotLightShadow","isSpotLightShadow","SpotLight","power","PointLightShadow","_cubeDirections","_cubeUps","PointLight","OrthographicCamera","scaleW","scaleH","DirectionalLightShadow","isDirectionalLightShadow","DirectionalLight","AmbientLight","RectAreaLight","MaterialLoader","getTexture","shading","setTextures","LoaderUtils","decodeText","TextDecoder","decode","fromCharCode","escape","extractUrlBase","lastIndexOf","InstancedBufferGeometry","InstancedBufferAttribute","BufferGeometryLoader","typedArray","TYPED_ARRAYS","bufferAttributeConstr","bufferAttribute","drawcalls","offsets","ObjectLoader","parseShape","parseGeometries","parseImages","parseTextures","parseMaterials","parseObject","parseAnimations","bufferGeometryLoader","details","geometryShapes","THREE","geometryLoader","LegacyJSONLoader","loadImage","currentUrl","parseConstant","TEXTURE_MAPPING","TEXTURE_WRAPPING","TEXTURE_FILTER","getGeometry","getMaterial","ImageBitmapLoader","createImageBitmap","fetch","setOptions","res","blob","imageBitmap","catch","ShapePath","subPaths","currentPath","toShapes","isCCW","noHoles","toShapesNoHoles","inSubpaths","tmpPath","tmpShape","isPointInsidePolygon","inPolygon","polyLen","edgeLowPt","edgeHighPt","edgeDx","edgeDy","perpEdge","solid","holesFirst","betterShapeHoles","newShapes","newShapeHoles","mainIdx","tmpPoints","ambiguous","toChange","sIdx","sLen","sho","hIdx","ho","hole_unassigned","s2Idx","froms","tos","tmpHoles","Font","paths","createPaths","chars","line_height","yMax","yMin","underlineThickness","char","ret","createPath","glyph","glyphs","familyName","cpx","cpy","cpx1","cpy1","cpx2","cpy2","outline","_cachedOutline","action","ha","FontLoader","substring","AudioContext","webkitAudioContext","AudioLoader","bufferCopy","decodeAudioData","audioBuffer","SphericalHarmonics3","isSphericalHarmonics3","zero","getAt","coeff","addScale","getIrradianceAt","getBasisAt","shBasis","LightProbe","HemisphereLightProbe","sky","ground","isHemisphereLightProbe","AmbientLightProbe","isAmbientLightProbe","_eyeRight","_eyeLeft","StereoCamera","eyeSep","_cache","eyeSepHalf","eyeSepOnProjection","ymax","xmin","xmax","Clock","autoStart","oldTime","elapsedTime","running","performance","Date","now","getElapsedTime","getDelta","newTime","_position$2","_quaternion$3","_scale$1","_orientation","AudioListener","gain","createGain","connect","destination","timeDelta","_clock","getInput","removeFilter","disconnect","getFilter","setFilter","getMasterVolume","setMasterVolume","setTargetAtTime","currentTime","positionX","linearRampToValueAtTime","positionY","positionZ","forwardX","forwardY","forwardZ","upX","upY","upZ","setOrientation","Audio","autoplay","detune","loop","loopStart","loopEnd","playbackRate","isPlaying","hasPlaybackControl","sourceType","_startedAt","_pausedAt","filters","getOutput","setNodeSource","audioNode","setMediaElementSource","mediaElement","createMediaElementSource","setMediaStreamSource","mediaStream","createMediaStreamSource","setBuffer","play","delay","createBufferSource","onended","onEnded","setDetune","setPlaybackRate","pause","getFilters","setFilters","getDetune","getPlaybackRate","getLoop","setLoop","setLoopStart","setLoopEnd","getVolume","setVolume","_position$3","_quaternion$4","_scale$2","_orientation$1","PositionalAudio","panner","createPanner","panningModel","getRefDistance","refDistance","setRefDistance","getRolloffFactor","rolloffFactor","setRolloffFactor","getDistanceModel","distanceModel","setDistanceModel","getMaxDistance","maxDistance","setMaxDistance","setDirectionalCone","coneInnerAngle","coneOuterAngle","coneOuterGain","orientationX","orientationY","orientationZ","AudioAnalyser","audio","fftSize","analyser","createAnalyser","frequencyBinCount","getFrequencyData","getByteFrequencyData","getAverageFrequency","PropertyMixer","mixFunction","_slerp","_select","_lerp","_mixBufferRegion","cumulativeWeight","useCount","referenceCount","accumulate","accuIndex","currentWeight","mix","originalValueOffset","saveOriginalState","getValue","restoreOriginalState","_RESERVED_CHARS_RE","_reservedRe","RegExp","_wordChar","_wordCharOrDot","_directoryRe","_nodeRe","_objectRe","_propertyRe","_trackRe","_supportedObjectNames","Composite","targetGroup","optionalParsedPath","parsedPath","PropertyBinding","parseTrackName","_targetGroup","_bindings","subscribe_","firstValidIndex","nCachedObjects_","bindings","unbind","rootNode","node","findNode","nodeName","root","isAnimationObjectGroup","sanitizeNodeName","matches","results","objectName","objectIndex","propertyIndex","lastDot","searchNodeSubtree","childNode","subTreeNode","_getValue_unavailable","_setValue_unavailable","BindingType","Direct","EntireArray","ArrayElement","HasFromToArray","Versioning","None","NeedsUpdate","MatrixWorldNeedsUpdate","GetterByBindingType","getValue_direct","getValue_array","resolvedProperty","getValue_arrayElement","getValue_toArray","SetterByBindingTypeAndVersioning","setValue_direct","targetObject","setValue_direct_setNeedsUpdate","setValue_direct_setMatrixWorldNeedsUpdate","setValue_array","dest","setValue_array_setNeedsUpdate","setValue_array_setMatrixWorldNeedsUpdate","setValue_arrayElement","setValue_arrayElement_setNeedsUpdate","setValue_arrayElement_setMatrixWorldNeedsUpdate","setValue_fromArray","setValue_fromArray_setNeedsUpdate","setValue_fromArray_setMatrixWorldNeedsUpdate","getValue_unbound","targetArray","sourceArray","nodeProperty","versioning","bindingType","_getValue_unbound","_setValue_unbound","AnimationObjectGroup","_indicesByUUID","_paths","_parsedPaths","_bindingsIndicesByPath","stats","total","inUse","bindingsPerObject","nObjects","nCachedObjects","indicesByUUID","parsedPaths","nBindings","knownObject","firstActiveIndex","lastCachedObject","bindingsForPath","lastCached","lastCachedIndex","firstActiveObject","firstActive","uncache","lastObject","indicesByPath","unsubscribe_","lastBindingsIndex","lastBindings","lastBindingsPath","AnimationAction","mixer","localRoot","_mixer","_clip","_localRoot","nTracks","interpolants","interpolantSettings","interpolant","_interpolantSettings","_interpolants","_propertyBindings","_cacheIndex","_byClipCacheIndex","_timeScaleInterpolant","_weightInterpolant","_loopCount","_startTime","_effectiveTimeScale","_effectiveWeight","repetitions","paused","clampWhenFinished","zeroSlopeAtStart","zeroSlopeAtEnd","_activateAction","_deactivateAction","stopFading","stopWarping","isRunning","_isActiveAction","isScheduled","startAt","setEffectiveWeight","getEffectiveWeight","fadeIn","_scheduleFading","fadeOut","crossFadeFrom","fadeOutAction","warp","fadeInDuration","fadeOutDuration","startEndRatio","endStartRatio","crossFadeTo","fadeInAction","weightInterpolant","_takeBackControlInterpolant","setEffectiveTimeScale","getEffectiveTimeScale","setDuration","syncWith","halt","startTimeScale","endTimeScale","_lendControlInterpolant","timeScaleInterpolant","getMixer","getClip","getRoot","_root","_update","deltaTime","timeDirection","_updateWeight","timeRunning","_updateTimeScale","clipTime","_updateTime","propertyMixers","interpolantValue","loopCount","pingPong","_setEndings","handle_stop","loopDelta","pending","atStart","atEnd","weightNow","weightThen","AnimationMixer","_initMemoryManager","_accuIndex","_bindAction","prototypeAction","rootUuid","bindingsByRoot","_bindingsByRootAndName","bindingsByName","_addInactiveBinding","clipUuid","actionsForClip","_actionsByClip","knownActions","_addInactiveAction","_lendBinding","_lendAction","_takeBackBinding","_takeBackAction","_actions","_nActiveActions","_nActiveBindings","_controlInterpolants","_nActiveControlInterpolants","actions","controlInterpolants","actionsByClip","actionByRoot","_removeInactiveAction","lastInactiveAction","cacheIndex","knownActionsForClip","lastKnownAction","byClipCacheIndex","_removeInactiveBindingsForAction","_removeInactiveBinding","prevIndex","lastActiveIndex","firstInactiveAction","firstInactiveIndex","lastActiveAction","bindingByName","propBinding","lastInactiveBinding","firstInactiveBinding","lastActiveBinding","_controlInterpolantsResultBuffer","__cacheIndex","lastActiveInterpolant","clipAction","optionalRoot","clipObject","existingAction","newAction","stopAllAction","nActions","setTime","timeInSeconds","uncacheClip","actionsToRemove","uncacheRoot","uncacheAction","Uniform","InstancedInterleavedBuffer","Raycaster","PointCloud","ascSort","intersectObject","setFromCamera","coords","intersectObjects","Spherical","other","makeSafe","setFromCartesianCoords","Cylindrical","_vector$7","Box2","_startP","_startEnd","Line3","distanceSq","closestPointToPointParameter","clampToLine","startEnd2","startEnd_startP","ImmediateRenderObject","_vector$8","SpotLightHelper","cone","coneLength","coneWidth","_vector$9","_boneMatrix","_matrixWorldInv","getBoneList","boneList","SkeletonHelper","PointLightHelper","sphereSize","_vector$a","_color1","_color2","HemisphereLightHelper","GridHelper","PolarGridHelper","radials","circles","_v1$5","_v2$3","_v3$1","DirectionalLightHelper","lightPlane","targetLine","_vector$b","_camera","CameraHelper","pointMap","colorFrustum","colorCone","colorUp","colorTarget","colorCross","addLine","addPoint","setPoint","_box$3","BoxHelper","Box3Helper","PlaneHelper","positions2","_axis","_lineGeometry","_coneGeometry","ArrowHelper","headLength","headWidth","setDirection","setColor","AxesHelper","LOD_MIN","LOD_MAX","SIZE_MAX","EXTRA_LOD_SIGMA","TOTAL_LODS","MAX_SAMPLES","ENCODINGS","_flatCamera","_blurMaterial","_getBlurShader","_equirectShader","_cubemapShader","_lodPlanes","_sizeLods","_sigmas","_createPlanes","_pingPongRenderTarget","_oldTarget","PHI","INV_PHI","_axisDirections","PMREMGenerator","_compileMaterial","fromScene","sigma","cubeUVRenderTarget","_allocateTargets","_sceneToCubeUV","_blur","_applyPMREM","_cleanup","fromEquirectangular","equirectangular","fromCubemap","cubemap","_textureToCubeUV","compileCubemapShader","_getCubemapShader","compileEquirectangularShader","_getEquirectShader","lod","sizeLod","texelSize","cubeFaces","positionSize","uvSize","faceIndexSize","coordinates","fill","_createRenderTarget","outputTarget","cubeCamera","upSign","forwardSign","maxComponent","fExp","log2","col","_setViewport","tmpScene","poleAxis","lodIn","lodOut","_halfBlur","targetIn","targetOut","sigmaRadians","STANDARD_DEVIATIONS","blurScene","blurUniforms","pixels","radiansPerPixel","sigmaPixels","weights","exp","outputSize","shaderMaterial","_getCommonVertexShader","_getEncodings","Face4","LineStrip","LinePieces","MeshFaceMaterial","MultiMaterial","Particle","ParticleSystem","PointCloudMaterial","ParticleBasicMaterial","ParticleSystemMaterial","Vertex","DynamicBufferAttribute","Int8Attribute","Uint8Attribute","Uint8ClampedAttribute","Int16Attribute","Uint16Attribute","Int32Attribute","Uint32Attribute","Float32Attribute","Float64Attribute","construct","createPointsGeometry","createGeometry","createSpacedPointsGeometry","fromPoints","ClosedSplineCurve3","SplineCurve3","Spline","initFromArray","getControlPointsArray","reparametrizeByArcLength","AxisHelper","BoundingBoxHelper","EdgesHelper","setColors","WireframeHelper","Handlers","XHRLoader","BinaryTextureLoader","setTexturePath","isIntersectionBox","isIntersectionSphere","setFromMatrix","random16","nearestPowerOfTwo","nextPowerOfTwo","flattenToArrayOffset","multiplyVector3","multiplyVector3Array","applyToBufferAttribute","applyToVector3Array","extractPosition","getPosition","multiplyToArray","multiplyVector4","rotateAxis","crossVector","rotateByAxis","makeFrustum","isIntersectionLine","isIntersectionPlane","barycoordFromPoint","midpoint","extractAllPoints","extrude","makeGeometry","fromAttribute","distanceToManhattan","lengthManhattan","setEulerFromRotationMatrix","setEulerFromQuaternion","getPositionFromMatrix","getScaleFromMatrix","getColumnFromMatrix","applyProjection","computeTangents","applyMatrix","getChildByName","renderDepth","getWorldRotation","eulerOrder","useQuaternion","setDrawMode","drawMode","initBones","setLens","onlyShadow","shadowCameraFov","shadowCameraLeft","shadowCameraRight","shadowCameraTop","shadowCameraBottom","shadowCameraVisible","shadowDarkness","shadowMapWidth","shadowMapHeight","dynamic","setDynamic","copyIndicesArray","setArray","addIndex","addAttribute","addDrawCall","clearDrawCalls","computeOffsets","removeAttribute","getArrays","addShapeList","wrapAround","overdraw","wrapRGB","metal","clearTarget","animate","getCurrentRenderTarget","getPrecision","resetGLState","supportsFloatTextures","supportsHalfFloatTextures","supportsStandardDerivatives","supportsCompressedTextureS3TC","supportsCompressedTexturePVRTC","supportsBlendMinMax","supportsInstancedArrays","enableScissorTest","addPrePlugin","addPostPlugin","updateShadowMap","setFaceCulling","allocTextureUnit","setTexture","getActiveMipMapLevel","shadowMapCullFace","vr","gammaInput","gammaOutput","renderReverseSided","renderSingleSided","WebGLRenderTargetCube","audioLoader","getData","updateCubeMap","GeometryUtils","geometry1","loadTextureCube","loadCompressedTexture","loadCompressedTextureCube","CanvasRenderer","JSONLoader","SceneUtils","createMultiMaterialObject","detach","LensFlare","revision","OrbitControls","minDistance","minZoom","maxZoom","minPolarAngle","maxPolarAngle","minAzimuthAngle","maxAzimuthAngle","enableDamping","dampingFactor","enableZoom","zoomSpeed","enableRotate","rotateSpeed","enablePan","panSpeed","screenSpacePanning","keyPanSpeed","autoRotate","autoRotateSpeed","enableKeys","UP","BOTTOM","mouseButtons","touches","ONE","TWO","target0","position0","zoom0","getPolarAngle","spherical","getAzimuthalAngle","saveState","changeEvent","STATE","NONE","quat","quatInverse","lastPosition","lastQuaternion","rotateLeft","getAutoRotationAngle","sphericalDelta","panOffset","zoomChanged","onContextMenu","onMouseDown","onMouseWheel","onTouchStart","onTouchEnd","onTouchMove","onMouseMove","onMouseUp","onKeyDown","startEvent","endEvent","TOUCH_ROTATE","TOUCH_PAN","TOUCH_DOLLY_PAN","TOUCH_DOLLY_ROTATE","rotateStart","rotateEnd","rotateDelta","panStart","panEnd","panDelta","dollyStart","dollyEnd","dollyDelta","getZoomScale","rotateUp","panLeft","objectMatrix","panUp","pan","deltaX","deltaY","targetDistance","clientHeight","clientWidth","dollyIn","dollyScale","dollyOut","handleMouseDownRotate","clientX","clientY","handleMouseDownDolly","handleMouseDownPan","handleMouseMoveRotate","handleMouseMoveDolly","handleMouseMovePan","handleMouseUp","handleMouseWheel","handleKeyDown","keyCode","handleTouchStartRotate","pageX","pageY","handleTouchStartPan","handleTouchStartDolly","handleTouchStartDollyPan","handleTouchStartDollyRotate","handleTouchMoveRotate","handleTouchMovePan","handleTouchMoveDolly","handleTouchMoveDollyPan","handleTouchMoveDollyRotate","handleTouchEnd","mouseAction","button","ctrlKey","metaKey","shiftKey","stopPropagation","tabIndex","MapControls","TUNABLE_FLAG_DEFAULT_VALUE_MAP","enableTrackingController","scoreThresholdController","stringValueMap","backendFolder","setupDatGui","urlParams","gui","dat","GUI","cameraFolder","addFolder","fpsController","onFinishChange","_","isTargetFPSChanged","sizeController","VIDEO_SIZE","onChange","isSizeOptionChanged","modelFolder","model","backendFromURL","posedetection","SupportedModels","PoseNet","MoveNet","BlazePose","alert","modelController","isModelChanged","showModelConfigs","showBackendConfigs","backend","folderController","fixedSelectionCount","__controllers","backends","MODEL_BACKEND_MAP","backendController","isBackendChanged","showFlagSettings","addPoseNetControllers","addMoveNetControllers","addBlazePoseControllers","modelConfigFolder","modelConfig","POSENET_CONFIG","MOVENET_CONFIG","enableTracking","scoreThreshold","typeController","customModelController","BLAZEPOSE_CONFIG","render3DController","render3D","querySelector","display","initDefaultValueMap","flags","BACKEND_FLAGS_MAP","flag","tf","getAsync","getTunableRange","defaultValue","tunableRange","TUNABLE_FLAG_VALUE_RANGE_MAP","showBackendFlagSettings","backendName","tunableFlags","flagName","TUNABLE_FLAG_NAME_MAP","flagValueRange","flagController","realValue","stringValue","isFlagChanged","isiOS","navigator","userAgent","isAndroid","isMobile","resetBackend","ENGINE","engine","registryFactory","lastTFJSBackend","registry","backendFactory","findBackendFactory","removeBackend","registerBackend","setBackend","setBackendAndEnvFlags","flagConfig","setFlags","runtime","$backend","DEFAULT_LINE_WIDTH","DEFAULT_RADIUS","targetFPS","sizeOption","maxPoses","customModel","WEBGL_VERSION","WASM_HAS_SIMD_SUPPORT","WASM_HAS_MULTITHREAD_SUPPORT","WEBGL_CPU_FORWARD","WEBGL_PACK","WEBGL_FORCE_F16_TEXTURES","WEBGL_RENDER_FLOAT32_CAPABLE","WEBGL_FLUSH_THRESHOLD","CHECK_COMPUTATION_FOR_ERRORS","PROD","ANCHOR_POINTS","COLOR_PALETTE","getElementById","ctx","scatterGLEl","scatterGL","scatter","ScatterGL","polyline","defaultOpacity","deselectedOpacity","scatterGLHasInitialized","setupCamera","cameraParam","mediaDevices","getUserMedia","$size","videoConfig","facingMode","frameRate","ideal","stream","srcObject","Promise","resolve","onloadedmetadata","videoWidth","videoHeight","canvasContainer","resize","drawCtx","clearCtx","clearRect","drawResults","poses","drawResult","keypoints","drawKeypoints","drawSkeleton","keypoints3D","drawKeypoints3D","keypointInd","util","getKeypointIndexBySide","fillStyle","strokeStyle","middle","drawKeypoint","keypoint","score","circle","Path2D","stroke","poseId","getAdjacentPairs","kp1","kp2","score1","score2","beginPath","pointsData","dataset","Dataset","setPointColorer","updateDataset","connections","sequences","pair","setSequences","setupStats","Stats","customFpsPanel","addPanel","Panel","showPanel","appendChild","statsPanes","querySelectorAll","tfjsWasm","setWasmPaths","version_wasm","detector","startInferenceTime","numInferences","inferenceTimeSum","lastPanelUpdate","rafId","createDetector","quantBytes","architecture","outputStride","inputResolution","multiplier","modelType","solutionPath","mpPose","VERSION","movenet","SINGLEPOSE_LIGHTNING","SINGLEPOSE_THUNDER","MULTIPOSE_LIGHTNING","modelUrl","checkGuiUpdate","cancelAnimationFrame","beginEstimatePosesStats","endEstimatePosesStats","endInferenceTime","panelUpdateMilliseconds","averageInferenceTime","renderResult","onloadeddata","estimatePoses","flipHorizontal","renderPrediction","app","URLSearchParams","location"],"mappings":";;;;;;;A8XiBA,AKAA,ACAA,AKAA,AEAA,ASAA,ACAA,ACAA,ACAA,AEDA,AGCA,ACAA,ACAA,AGAA,ACAA,ACAA,ACAA,AEAA,ACEA,AtBDA,AuBDA,AtDAA,ASAA,AXAA,AupBjBA,AplBAA,AmpBAA;A5sBiBA,APAA,AEAA,ACAA,AipBfA,AplBAA,AmpBAA;AxsBFA,AKAA,ACAA,AKAA,AEAA,ASAA,ACAA,ACAA,ACAA,AEAA,AGAA,ACAA,ACAA,AGAA,ACAA,ACAA,ACAA,AEAA,ACAA,AtBAA,AuBAA,AtDAA,ASAA,AXAA,AupBGA,AplBAA,AmpBAA,M/DAM,AplBAA,AmpBAA,O/DAO,AplBAA,AmpBAA,G/DAG,AplBAA,AmpBAA,O/DAhB,AplBAA,AmpBAA;A5sBHA,APAA,AEAA,ACAA;;;;;;;;;;;;;;;AQmBM,AKAA,ACAA,AKAA,AEAA,ASAN,ACAA,ACAA,ACAM,AEMA,AGNA,ACAA,ACAA,AGAA,AEAN,ACAM,AnBCA,AuBDA,AxDAA,IsCAC,EDAD,GvBAU,AKAA,ACAA,AKAA,AEAA,ASAP,AGAO,AEOhB,AGPgB,ACAA,ACAA,AGAA,AEAP,ACAO,AnBCA,AuBDA,AxDAA,KmDAhB,CdAe,AcCX,CxBDE,CACF,CUDc,AEAZ,AYAN,CrCAM,AyBCF,AiBDE,C1CCF,AwBDmB,AGMjB,AULe,AKAjB,CrCDE,ACAA,AKAA,AgBQF,CtBPA,ACAA,AKAA,AE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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrFA;AACA;AACA;AACA;AACA;AACA;;;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;AC5uDA;;AACA;;AAGA;;AAEA;;AAvBA;;;;;;;;;;;;;;;;;AAyBA;AACA,MAAM,uBAAuB,GAAG,CAAhC;AAEA;;;;;;;;;;;;;;;;;;AAiBO,eAAe,aAAf,CACH,OADG,EACoC,KADpC,EACuD;AAE5D;AACA,QAAM,KAAK,GAA2B,EAAtC;AACA,QAAM,YAAY,GAA+B,EAAjD;AAEA,QAAM,KAAK,GAAa,KAAK,CAAC,OAAN,CAAc,OAAd,IACpB,OAAO,CAAC,GAAR,CAAY,MAAM,IAAI,MAAM,CAAC,IAA7B,CADoB,GAEpB,MAAM,CAA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AK,MAAd,EAAsB;AAC3B,IAAA,MAAM,GAAG,IAAI,UAAJ,CAAe,IAAf,CAAT;AACD,GAFM,MAEA;AACL,UAAM,IAAI,KAAJ,CAAU,qBAAqB,KAAK,EAApC,CAAN;AACD;;AACD,OAAK,IAAI,CAAC,GAAG,CAAb,EAAgB,CAAC,GAAG,IAApB,EAA0B,CAAC,EAA3B,EAA+B;AAC7B,IAAA,MAAM,CAAC,CAAD,CAAN,GAAY,YAAY,EAAxB;AACD;;AACD,SAAO,eAAO,UAAP,CAAkB,MAAlB,EAA0B,KAA1B,EAAiC,KAAjC,CAAP;AACD;;AAEM,MAAM,IAAI,GAAG,mBAAG;AAAC,EAAA;AAAD,CAAH,CAAb;;;;ACvDP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AClHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACjFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACtFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACjGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AClJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACvGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7PA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACzCP;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA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,EAAE,OAFuC;AAGpD,EAAA,UAAU,EAAE;AAHwC,CAA/C;;;;;AC7FP;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAxLA;;;;;;;;;;;;;;;;AA0LA;AACA,MAAM,aAAa,GAAmB,CACpC,+BADoC,EAEpC,cAFoC,EAGpC,gBAHoC,EAIpC,kBAJoC,EAKpC,cALoC,EAMpC,gBANoC,EAOpC,cAPoC,E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A;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA1JA;;;;;;;;;;;;;;;;AA4JA;AACA,MAAM,aAAa,GAAmB,CACpC,+BADoC,EAEpC,cAFoC,EAGpC,gBAHoC,EAIpC,kBAJoC,EAKpC,cALoC,EAMpC,gBANoC,EAOpC,cAPoC,EAQpC,cARoC,EASpC,oBAToC,EAUpC,oBAVoC,EAWpC,gBAXoC,EAYpC,kBAZoC,EAapC,gBAboC,EAcpC,kBAdoC,EAepC,kBAfoC,EAgBpC,sBAhBoC,EAiBpC,8BAjBoC,EAkBpC,8BAlBoC,EAmBpC,oCAnBoC,EAoBpC,wBApBoC,EAqBpC,gBArBoC,EAsBpC,gBAtBoC,EAuBpC,8BAvBoC,EAwBpC,sBAxBoC,EAyBpC,oBAzBoC,EA0BpC,oBA1BoC,EA2BpC,gDA3BoC,EA4BpC,8CA5BoC,EA6BpC,cA7BoC,EA8BpC,gBA9BoC,EA+BpC,kCA/BoC,EAgCpC,sBAhCoC,EAiCpC,oBAjCoC,E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Z;AACA,QAAM,OAAO,GAAG,OAAO,CAAC,kBAAR,CAA2B,GAA3B,CAAhB;AACA,EAAA,OAAO,CAAC,IAAR,CAAa,CAAb;AACA,SAAO,GAAP;AACD;;AAEM,MAAM,eAAe,GAAiB;AAC3C,EAAA,UAAU,EAAE,mBAD+B;AAE3C,EAAA,WAAW,EAAE,MAF8B;AAG3C,EAAA,UAAU,EAAE;AAH+B,CAAtC;;;;;ACVP;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAhIA;;;;;;;;;;;;;;;;AAgBA;AACA;AACA;AAgHA;AACA,MAAM,aAAa,GAAmB,CACpC,+BADoC,EAEpC,cAFoC,EAGpC,cAHoC,EAIpC,gBAJoC,EAKpC,cALoC,EAMpC,cANoC,EAOpC,oBAPoC,EAQpC,sBARoC,EASpC,8BAToC,EAUpC,oCAVoC,EAWpC,gBAXoC,EAYpC,gBAZoC,EAapC,8BAboC,EAcpC,oBAdoC,EAepC,oBAfoC,EAgBpC,8CAhBo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ACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxoBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9IA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjkBA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;ACUA;;AACA;;AAEA;;;;;;AAnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA,IAAIC,8BAAJ;AAEA,IAAIC,wBAAJ;AACA,IAAIC,wBAAJ;AAEA,MAAMC,cAAc,GAAG,EAAvB;AACA,IAAIC,aAAJ;;AAEO,eAAeC,WAAf,CAA2BC,SAA3B,EAAsC;AAC3C,QAAMC,GAAG,GAAG,IAAIC,GAAG,CAACC,GAAR,CAAY;AAAC5lI,IAAAA,KAAK,EAAE;AAAR,GAAZ,CAAZ;AACA0lI,EAAAA,GAAG,CAAC96D,UAAJ,CAAexzD,EAAf,GAAoB,KAApB,CAF2C,CAI3C;;AACA,QAAMyuH,YAAY,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B,eAAOmrG,WAAP,CAAmBjN,cAAMn1H,MAAzB,CAAf;AAEA,QAAM,iCAAsBm1H,cAAM6I,KAA5B,EAAmC7I,cAAMmH,OAAzC,CAAN;AAEAmK,EAAAA,QAAQ,GAAG,MAAMM,cAAc,EAA/B;AAEA0B,EAAAA,gBAAgB;AACjB;;AAAA;AAEDC,GAAG","file":"src.a2b27638.js","sourceRoot":"..","sourcesContent":["/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Backend, DataId, DataToGPUOptions, GPUData, Tensor} from '../tensor';\nimport {BackendValues, DataType, WebGLData} from '../types';\n\nexport const EPSILON_FLOAT32 = 1e-7;\nexport const EPSILON_FLOAT16 = 1e-4;\n\n// Required information for all backends.\nexport interface BackendTimingInfo {\n kernelMs: number|{error: string};\n getExtraProfileInfo?(): string; // a field for additional timing information\n // e.g. packing / unpacking for WebGL backend\n}\n\nexport interface TensorStorage {\n read(dataId: DataId): Promise;\n readSync(dataId: DataId): BackendValues;\n disposeData(dataId: DataId, force?: boolean): boolean;\n write(values: BackendValues, shape: number[], dtype: DataType): DataId;\n move(\n dataId: DataId, values: BackendValues, shape: number[], dtype: DataType,\n refCount: number): void;\n memory(): {unreliable: boolean;}; // Backend-specific information.\n /** Returns number of data ids currently in the storage. */\n numDataIds(): number;\n refCount(dataId: DataId): number;\n}\n\n/** Convenient class for storing tensor-related data. */\nexport class DataStorage {\n private data = new WeakMap();\n private dataIdsCount = 0;\n\n constructor(private backend: KernelBackend, private dataMover: DataMover) {}\n\n get(dataId: DataId) {\n if (!this.data.has(dataId)) {\n this.dataMover.moveData(this.backend, dataId);\n }\n return this.data.get(dataId);\n }\n\n set(dataId: DataId, value: T): void {\n this.dataIdsCount++;\n this.data.set(dataId, value);\n }\n\n has(dataId: DataId): boolean {\n return this.data.has(dataId);\n }\n\n delete(dataId: DataId): boolean {\n this.dataIdsCount--;\n return this.data.delete(dataId);\n }\n\n numDataIds(): number {\n return this.dataIdsCount;\n }\n}\n\nexport interface DataMover {\n /**\n * To be called by backends whenever they see a dataId that they don't own.\n * Upon calling this method, the mover will fetch the tensor from another\n * backend and register it with the current active backend.\n */\n moveData(backend: KernelBackend, dataId: DataId): void;\n}\n\nexport interface BackendTimer {\n // check if backend timer is available\n timerAvailable(): boolean;\n time(f: () => void): Promise;\n}\n\n/**\n * The interface that defines the kernels that should be implemented when\n * adding a new backend. New backends don't need to implement every one of the\n * methods, this can be done gradually (throw an error for unimplemented\n * methods).\n */\nexport class KernelBackend implements TensorStorage, Backend, BackendTimer {\n refCount(dataId: DataId): number {\n return notYetImplemented('refCount');\n }\n incRef(dataId: DataId): void {\n return notYetImplemented('incRef');\n }\n timerAvailable(): boolean {\n return true;\n }\n time(f: () => void): Promise {\n return notYetImplemented('time');\n }\n read(dataId: object): Promise {\n return notYetImplemented('read');\n }\n readSync(dataId: object): BackendValues {\n return notYetImplemented('readSync');\n }\n readToGPU(dataId: object, options?: DataToGPUOptions): GPUData {\n return notYetImplemented('readToGPU');\n }\n numDataIds(): number {\n return notYetImplemented('numDataIds');\n }\n disposeData(dataId: object, force?: boolean): boolean {\n return notYetImplemented('disposeData');\n }\n write(values: BackendValues, shape: number[], dtype: DataType): DataId {\n return notYetImplemented('write');\n }\n move(\n dataId: DataId, values: BackendValues, shape: number[], dtype: DataType,\n refCount: number): void {\n return notYetImplemented('move');\n }\n createTensorFromTexture(values: WebGLData, shape: number[], dtype: DataType):\n Tensor {\n return notYetImplemented('createTensorFromTexture');\n }\n memory(): {unreliable: boolean; reasons?: string[]} {\n return notYetImplemented('memory');\n }\n /** Returns the highest precision for floats in bits (e.g. 16 or 32) */\n floatPrecision(): 16|32 {\n return notYetImplemented('floatPrecision');\n }\n /** Returns the smallest representable number. */\n epsilon(): number {\n return this.floatPrecision() === 32 ? EPSILON_FLOAT32 : EPSILON_FLOAT16;\n }\n dispose(): void {\n return notYetImplemented('dispose');\n }\n}\n\nfunction notYetImplemented(kernelName: string): never {\n throw new Error(\n `'${kernelName}' not yet implemented or not found in the registry. ` +\n `This kernel may not be supported by the tfjs backend you have chosen`);\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataType, DataTypeMap, FlatVector, NumericDataType, RecursiveArray, TensorLike, TypedArray, WebGLData} from './types';\n\n/**\n * Shuffles the array in-place using Fisher-Yates algorithm.\n *\n * ```js\n * const a = [1, 2, 3, 4, 5];\n * tf.util.shuffle(a);\n * console.log(a);\n * ```\n *\n * @param array The array to shuffle in-place.\n *\n * @doc {heading: 'Util', namespace: 'util'}\n */\n// tslint:disable-next-line:no-any\nexport function shuffle(array: any[]|Uint32Array|Int32Array|\n Float32Array): void {\n let counter = array.length;\n let index = 0;\n // While there are elements in the array\n while (counter > 0) {\n // Pick a random index\n index = (Math.random() * counter) | 0;\n // Decrease counter by 1\n counter--;\n // And swap the last element with it\n swap(array, counter, index);\n }\n}\n\n/**\n * Shuffles two arrays in-place the same way using Fisher-Yates algorithm.\n *\n * ```js\n * const a = [1,2,3,4,5];\n * const b = [11,22,33,44,55];\n * tf.util.shuffleCombo(a, b);\n * console.log(a, b);\n * ```\n *\n * @param array The first array to shuffle in-place.\n * @param array2 The second array to shuffle in-place with the same permutation\n * as the first array.\n *\n * @doc {heading: 'Util', namespace: 'util'}\n */\nexport function shuffleCombo(\n // tslint:disable-next-line:no-any\n array: any[]|Uint32Array|Int32Array|Float32Array,\n // tslint:disable-next-line:no-any\n array2: any[]|Uint32Array|Int32Array|Float32Array): void {\n if (array.length !== array2.length) {\n throw new Error(\n `Array sizes must match to be shuffled together ` +\n `First array length was ${array.length}` +\n `Second array length was ${array2.length}`);\n }\n let counter = array.length;\n let index = 0;\n // While there are elements in the array\n while (counter > 0) {\n // Pick a random index\n index = (Math.random() * counter) | 0;\n // Decrease counter by 1\n counter--;\n // And swap the last element of each array with it\n swap(array, counter, index);\n swap(array2, counter, index);\n }\n}\n\n/** Clamps a value to a specified range. */\nexport function clamp(min: number, x: number, max: number): number {\n return Math.max(min, Math.min(x, max));\n}\n\nexport function nearestLargerEven(val: number): number {\n return val % 2 === 0 ? val : val + 1;\n}\n\nexport function swap(\n object: {[index: number]: T}, left: number, right: number) {\n const temp = object[left];\n object[left] = object[right];\n object[right] = temp;\n}\n\nexport function sum(arr: number[]): number {\n let sum = 0;\n for (let i = 0; i < arr.length; i++) {\n sum += arr[i];\n }\n return sum;\n}\n\n/**\n * Returns a sample from a uniform [a, b) distribution.\n *\n * @param a The minimum support (inclusive).\n * @param b The maximum support (exclusive).\n * @return A pseudorandom number on the half-open interval [a,b).\n */\nexport function randUniform(a: number, b: number) {\n const r = Math.random();\n return (b * r) + (1 - r) * a;\n}\n\n/** Returns the squared Euclidean distance between two vectors. */\nexport function distSquared(a: FlatVector, b: FlatVector): number {\n let result = 0;\n for (let i = 0; i < a.length; i++) {\n const diff = Number(a[i]) - Number(b[i]);\n result += diff * diff;\n }\n return result;\n}\n\n/**\n * Asserts that the expression is true. Otherwise throws an error with the\n * provided message.\n *\n * ```js\n * const x = 2;\n * tf.util.assert(x === 2, 'x is not 2');\n * ```\n *\n * @param expr The expression to assert (as a boolean).\n * @param msg A function that returns the message to report when throwing an\n * error. We use a function for performance reasons.\n *\n * @doc {heading: 'Util', namespace: 'util'}\n */\nexport function assert(expr: boolean, msg: () => string) {\n if (!expr) {\n throw new Error(typeof msg === 'string' ? msg : msg());\n }\n}\n\nexport function assertShapesMatch(\n shapeA: number[], shapeB: number[], errorMessagePrefix = ''): void {\n assert(\n arraysEqual(shapeA, shapeB),\n () => errorMessagePrefix + ` Shapes ${shapeA} and ${shapeB} must match`);\n}\n\nexport function assertNonNull(a: TensorLike): void {\n assert(\n a != null,\n () => `The input to the tensor constructor must be a non-null value.`);\n}\n\n// NOTE: We explicitly type out what T extends instead of any so that\n// util.flatten on a nested array of number doesn't try to infer T as a\n// number[][], causing us to explicitly type util.flatten().\n/**\n * Flattens an arbitrarily nested array.\n *\n * ```js\n * const a = [[1, 2], [3, 4], [5, [6, [7]]]];\n * const flat = tf.util.flatten(a);\n * console.log(flat);\n * ```\n *\n * @param arr The nested array to flatten.\n * @param result The destination array which holds the elements.\n * @param skipTypedArray If true, avoids flattening the typed arrays. Defaults\n * to false.\n *\n * @doc {heading: 'Util', namespace: 'util'}\n */\nexport function\nflatten|TypedArray>(\n arr: T|RecursiveArray, result: T[] = [], skipTypedArray = false): T[] {\n if (result == null) {\n result = [];\n }\n if (Array.isArray(arr) || isTypedArray(arr) && !skipTypedArray) {\n for (let i = 0; i < arr.length; ++i) {\n flatten(arr[i], result, skipTypedArray);\n }\n } else {\n result.push(arr as T);\n }\n return result;\n}\n\n/**\n * Returns the size (number of elements) of the tensor given its shape.\n *\n * ```js\n * const shape = [3, 4, 2];\n * const size = tf.util.sizeFromShape(shape);\n * console.log(size);\n * ```\n *\n * @doc {heading: 'Util', namespace: 'util'}\n */\nexport function sizeFromShape(shape: number[]): number {\n if (shape.length === 0) {\n // Scalar.\n return 1;\n }\n let size = shape[0];\n for (let i = 1; i < shape.length; i++) {\n size *= shape[i];\n }\n return size;\n}\n\nexport function isScalarShape(shape: number[]): boolean {\n return shape.length === 0;\n}\n\nexport function arraysEqual(n1: FlatVector, n2: FlatVector) {\n if (n1 === n2) {\n return true;\n }\n if (n1 == null || n2 == null) {\n return false;\n }\n\n if (n1.length !== n2.length) {\n return false;\n }\n for (let i = 0; i < n1.length; i++) {\n if (n1[i] !== n2[i]) {\n return false;\n }\n }\n return true;\n}\n\nexport function isInt(a: number): boolean {\n return a % 1 === 0;\n}\n\nexport function tanh(x: number): number {\n // tslint:disable-next-line:no-any\n if ((Math as any).tanh != null) {\n // tslint:disable-next-line:no-any\n return (Math as any).tanh(x);\n }\n if (x === Infinity) {\n return 1;\n } else if (x === -Infinity) {\n return -1;\n } else {\n const e2x = Math.exp(2 * x);\n return (e2x - 1) / (e2x + 1);\n }\n}\n\nexport function sizeToSquarishShape(size: number): [number, number] {\n const width = Math.ceil(Math.sqrt(size));\n return [width, Math.ceil(size / width)];\n}\n\n/**\n * Creates a new array with randomized indices to a given quantity.\n *\n * ```js\n * const randomTen = tf.util.createShuffledIndices(10);\n * console.log(randomTen);\n * ```\n *\n * @param number Quantity of how many shuffled indices to create.\n *\n * @doc {heading: 'Util', namespace: 'util'}\n */\nexport function createShuffledIndices(n: number): Uint32Array {\n const shuffledIndices = new Uint32Array(n);\n for (let i = 0; i < n; ++i) {\n shuffledIndices[i] = i;\n }\n shuffle(shuffledIndices);\n return shuffledIndices;\n}\n\nexport function rightPad(a: string, size: number): string {\n if (size <= a.length) {\n return a;\n }\n return a + ' '.repeat(size - a.length);\n}\n\nexport function repeatedTry(\n checkFn: () => boolean, delayFn = (counter: number) => 0,\n maxCounter?: number,\n scheduleFn?: (functionRef: Function, delay: number) => void\n ): Promise {\n return new Promise((resolve, reject) => {\n let tryCount = 0;\n\n const tryFn = () => {\n if (checkFn()) {\n resolve();\n return;\n }\n\n tryCount++;\n\n const nextBackoff = delayFn(tryCount);\n\n if (maxCounter != null && tryCount >= maxCounter) {\n reject();\n return;\n }\n\n if (scheduleFn != null) {\n scheduleFn(tryFn, nextBackoff);\n } else {\n // google3 does not allow assigning another variable to setTimeout.\n // Don't refactor this so scheduleFn has a default value of setTimeout.\n setTimeout(tryFn, nextBackoff);\n }\n };\n\n tryFn();\n });\n}\n\n/**\n * Given the full size of the array and a shape that may contain -1 as the\n * implicit dimension, returns the inferred shape where -1 is replaced.\n * E.g. For shape=[2, -1, 3] and size=24, it will return [2, 4, 3].\n *\n * @param shape The shape, which may contain -1 in some dimension.\n * @param size The full size (number of elements) of the array.\n * @return The inferred shape where -1 is replaced with the inferred size.\n */\nexport function inferFromImplicitShape(\n shape: number[], size: number): number[] {\n let shapeProd = 1;\n let implicitIdx = -1;\n\n for (let i = 0; i < shape.length; ++i) {\n if (shape[i] >= 0) {\n shapeProd *= shape[i];\n } else if (shape[i] === -1) {\n if (implicitIdx !== -1) {\n throw Error(\n `Shapes can only have 1 implicit size. ` +\n `Found -1 at dim ${implicitIdx} and dim ${i}`);\n }\n implicitIdx = i;\n } else if (shape[i] < 0) {\n throw Error(`Shapes can not be < 0. Found ${shape[i]} at dim ${i}`);\n }\n }\n\n if (implicitIdx === -1) {\n if (size > 0 && size !== shapeProd) {\n throw Error(`Size(${size}) must match the product of shape ${shape}`);\n }\n return shape;\n }\n\n if (shapeProd === 0) {\n throw Error(\n `Cannot infer the missing size in [${shape}] when ` +\n `there are 0 elements`);\n }\n if (size % shapeProd !== 0) {\n throw Error(\n `The implicit shape can't be a fractional number. ` +\n `Got ${size} / ${shapeProd}`);\n }\n\n const newShape = shape.slice();\n newShape[implicitIdx] = size / shapeProd;\n return newShape;\n}\n\nexport function parseAxisParam(\n axis: number|number[], shape: number[]): number[] {\n const rank = shape.length;\n\n // Normalize input\n axis = axis == null ? shape.map((s, i) => i) : [].concat(axis);\n\n // Check for valid range\n assert(\n axis.every(ax => ax >= -rank && ax < rank),\n () =>\n `All values in axis param must be in range [-${rank}, ${rank}) but ` +\n `got axis ${axis}`);\n\n // Check for only integers\n assert(\n axis.every(ax => isInt(ax)),\n () => `All values in axis param must be integers but ` +\n `got axis ${axis}`);\n\n // Handle negative axis.\n return axis.map(a => a < 0 ? rank + a : a);\n}\n\n/** Reduces the shape by removing all dimensions of shape 1. */\nexport function squeezeShape(shape: number[], axis?: number[]):\n {newShape: number[], keptDims: number[]} {\n const newShape: number[] = [];\n const keptDims: number[] = [];\n const isEmptyArray = axis != null && Array.isArray(axis) && axis.length === 0;\n const axes = (axis == null || isEmptyArray) ?\n null :\n parseAxisParam(axis, shape).sort();\n let j = 0;\n for (let i = 0; i < shape.length; ++i) {\n if (axes != null) {\n if (axes[j] === i && shape[i] !== 1) {\n throw new Error(\n `Can't squeeze axis ${i} since its dim '${shape[i]}' is not 1`);\n }\n if ((axes[j] == null || axes[j] > i) && shape[i] === 1) {\n newShape.push(shape[i]);\n keptDims.push(i);\n }\n if (axes[j] <= i) {\n j++;\n }\n }\n if (shape[i] !== 1) {\n newShape.push(shape[i]);\n keptDims.push(i);\n }\n }\n return {newShape, keptDims};\n}\n\nexport function getTypedArrayFromDType(\n dtype: D, size: number): DataTypeMap[D] {\n let values = null;\n if (dtype == null || dtype === 'float32') {\n values = new Float32Array(size);\n } else if (dtype === 'int32') {\n values = new Int32Array(size);\n } else if (dtype === 'bool') {\n values = new Uint8Array(size);\n } else {\n throw new Error(`Unknown data type ${dtype}`);\n }\n return values as DataTypeMap[D];\n}\n\nexport function getArrayFromDType(\n dtype: D, size: number): DataTypeMap[D] {\n let values = null;\n if (dtype == null || dtype === 'float32') {\n values = new Float32Array(size);\n } else if (dtype === 'int32') {\n values = new Int32Array(size);\n } else if (dtype === 'bool') {\n values = new Uint8Array(size);\n } else if (dtype === 'string') {\n values = new Array<'string'>(size);\n } else {\n throw new Error(`Unknown data type ${dtype}`);\n }\n return values as DataTypeMap[D];\n}\n\nexport function checkConversionForErrors(\n vals: DataTypeMap[D]|number[], dtype: D): void {\n for (let i = 0; i < vals.length; i++) {\n const num = vals[i] as number;\n if (isNaN(num) || !isFinite(num)) {\n throw Error(`A tensor of type ${dtype} being uploaded contains ${num}.`);\n }\n }\n}\n\n/** Returns true if the dtype is valid. */\nexport function isValidDtype(dtype: DataType): boolean {\n return dtype === 'bool' || dtype === 'complex64' || dtype === 'float32' ||\n dtype === 'int32' || dtype === 'string';\n}\n\n/**\n * Returns true if the new type can't encode the old type without loss of\n * precision.\n */\nexport function hasEncodingLoss(oldType: DataType, newType: DataType): boolean {\n if (newType === 'complex64') {\n return false;\n }\n if (newType === 'float32' && oldType !== 'complex64') {\n return false;\n }\n if (newType === 'int32' && oldType !== 'float32' && oldType !== 'complex64') {\n return false;\n }\n if (newType === 'bool' && oldType === 'bool') {\n return false;\n }\n return true;\n}\n\nexport function isTypedArray(a: {}): a is Float32Array|Int32Array|Uint8Array|\n Uint8ClampedArray {\n return a instanceof Float32Array || a instanceof Int32Array ||\n a instanceof Uint8Array || a instanceof Uint8ClampedArray;\n}\n\nexport function bytesPerElement(dtype: DataType): number {\n if (dtype === 'float32' || dtype === 'int32') {\n return 4;\n } else if (dtype === 'complex64') {\n return 8;\n } else if (dtype === 'bool') {\n return 1;\n } else {\n throw new Error(`Unknown dtype ${dtype}`);\n }\n}\n\n/**\n * Returns the approximate number of bytes allocated in the string array - 2\n * bytes per character. Computing the exact bytes for a native string in JS\n * is not possible since it depends on the encoding of the html page that\n * serves the website.\n */\nexport function bytesFromStringArray(arr: Uint8Array[]): number {\n if (arr == null) {\n return 0;\n }\n let bytes = 0;\n arr.forEach(x => bytes += x.length);\n return bytes;\n}\n\n/** Returns true if the value is a string. */\nexport function isString(value: {}): value is string {\n return typeof value === 'string' || value instanceof String;\n}\n\nexport function isBoolean(value: {}): boolean {\n return typeof value === 'boolean';\n}\n\nexport function isNumber(value: {}): boolean {\n return typeof value === 'number';\n}\n\nexport function inferDtype(values: TensorLike|WebGLData): DataType {\n if (Array.isArray(values)) {\n return inferDtype(values[0]);\n }\n if (values instanceof Float32Array) {\n return 'float32';\n } else if (\n values instanceof Int32Array || values instanceof Uint8Array ||\n values instanceof Uint8ClampedArray) {\n return 'int32';\n } else if (isNumber(values)) {\n return 'float32';\n } else if (isString(values)) {\n return 'string';\n } else if (isBoolean(values)) {\n return 'bool';\n }\n return 'float32';\n}\n\nexport function isFunction(f: Function) {\n return !!(f && f.constructor && f.call && f.apply);\n}\n\nexport function nearestDivisor(size: number, start: number): number {\n for (let i = start; i < size; ++i) {\n if (size % i === 0) {\n return i;\n }\n }\n return size;\n}\n\nexport function computeStrides(shape: number[]): number[] {\n const rank = shape.length;\n if (rank < 2) {\n return [];\n }\n\n // Last dimension has implicit stride of 1, thus having D-1 (instead of D)\n // strides.\n const strides = new Array(rank - 1);\n strides[rank - 2] = shape[rank - 1];\n for (let i = rank - 3; i >= 0; --i) {\n strides[i] = strides[i + 1] * shape[i + 1];\n }\n return strides;\n}\n\nfunction createNestedArray(\n offset: number, shape: number[], a: TypedArray, isComplex = false) {\n const ret = new Array();\n if (shape.length === 1) {\n const d = shape[0] * (isComplex ? 2 : 1);\n for (let i = 0; i < d; i++) {\n ret[i] = a[offset + i];\n }\n } else {\n const d = shape[0];\n const rest = shape.slice(1);\n const len = rest.reduce((acc, c) => acc * c) * (isComplex ? 2 : 1);\n for (let i = 0; i < d; i++) {\n ret[i] = createNestedArray(offset + i * len, rest, a, isComplex);\n }\n }\n return ret;\n}\n\n// Provide a nested array of TypedArray in given shape.\nexport function toNestedArray(\n shape: number[], a: TypedArray, isComplex = false) {\n if (shape.length === 0) {\n // Scalar type should return a single number.\n return a[0];\n }\n const size = shape.reduce((acc, c) => acc * c) * (isComplex ? 2 : 1);\n if (size === 0) {\n // A tensor with shape zero should be turned into empty list.\n return [];\n }\n if (size !== a.length) {\n throw new Error(`[${shape}] does not match the input size ${a.length}${\n isComplex ? ' for a complex tensor' : ''}.`);\n }\n\n return createNestedArray(0, shape, a, isComplex);\n}\n\nexport function makeOnesTypedArray(\n size: number, dtype: D): DataTypeMap[D] {\n const array = makeZerosTypedArray(size, dtype);\n for (let i = 0; i < array.length; i++) {\n array[i] = 1;\n }\n return array;\n}\n\nexport function makeZerosTypedArray(\n size: number, dtype: D): DataTypeMap[D] {\n if (dtype == null || dtype === 'float32' || dtype === 'complex64') {\n return new Float32Array(size) as DataTypeMap[D];\n } else if (dtype === 'int32') {\n return new Int32Array(size) as DataTypeMap[D];\n } else if (dtype === 'bool') {\n return new Uint8Array(size) as DataTypeMap[D];\n } else {\n throw new Error(`Unknown data type ${dtype}`);\n }\n}\n\n/**\n * Make nested `TypedArray` filled with zeros.\n * @param shape The shape information for the nested array.\n * @param dtype dtype of the array element.\n */\nexport function makeZerosNestedTypedArray(\n shape: number[], dtype: D) {\n const size = shape.reduce((prev, curr) => prev * curr, 1);\n if (dtype == null || dtype === 'float32') {\n return toNestedArray(shape, new Float32Array(size));\n } else if (dtype === 'int32') {\n return toNestedArray(shape, new Int32Array(size));\n } else if (dtype === 'bool') {\n return toNestedArray(shape, new Uint8Array(size));\n } else {\n throw new Error(`Unknown data type ${dtype}`);\n }\n}\n\nexport function assertNonNegativeIntegerDimensions(shape: number[]) {\n shape.forEach(dimSize => {\n assert(\n Number.isInteger(dimSize) && dimSize >= 0,\n () =>\n `Tensor must have a shape comprised of positive integers but got ` +\n `shape [${shape}].`);\n });\n}\n\n/**\n * Computes flat index for a given location (multidimentionsal index) in a\n * Tensor/multidimensional array.\n *\n * @param locs Location in the tensor.\n * @param rank Rank of the tensor.\n * @param strides Tensor strides.\n */\nexport function locToIndex(\n locs: number[], rank: number, strides: number[]): number {\n if (rank === 0) {\n return 0;\n } else if (rank === 1) {\n return locs[0];\n }\n let index = locs[locs.length - 1];\n for (let i = 0; i < locs.length - 1; ++i) {\n index += strides[i] * locs[i];\n }\n return index;\n}\n\n/**\n * Computes the location (multidimensional index) in a\n * tensor/multidimentional array for a given flat index.\n *\n * @param index Index in flat array.\n * @param rank Rank of tensor.\n * @param strides Strides of tensor.\n */\nexport function indexToLoc(\n index: number, rank: number, strides: number[]): number[] {\n if (rank === 0) {\n return [];\n } else if (rank === 1) {\n return [index];\n }\n const locs: number[] = new Array(rank);\n for (let i = 0; i < locs.length - 1; ++i) {\n locs[i] = Math.floor(index / strides[i]);\n index -= locs[i] * strides[i];\n }\n locs[locs.length - 1] = index;\n return locs;\n}\n\n/**\n * This method asserts whether an object is a Promise instance.\n * @param object\n */\n// tslint:disable-next-line: no-any\nexport function isPromise(object: any): object is Promise {\n // We chose to not use 'obj instanceOf Promise' for two reasons:\n // 1. It only reliably works for es6 Promise, not other Promise\n // implementations.\n // 2. It doesn't work with framework that uses zone.js. zone.js monkey\n // patch the async calls, so it is possible the obj (patched) is\n // comparing to a pre-patched Promise.\n return object && object.then && typeof object.then === 'function';\n}\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Platform} from './platforms/platform';\nimport {isPromise} from './util_base';\n\n// Expects flags from URL in the format ?tfjsflags=FLAG1:1,FLAG2:true.\nconst TENSORFLOWJS_FLAGS_PREFIX = 'tfjsflags';\n\ntype FlagValue = number|boolean;\ntype FlagEvaluationFn = (() => FlagValue)|(() => Promise);\nexport type Flags = {\n [featureName: string]: FlagValue\n};\nexport type FlagRegistryEntry = {\n evaluationFn: FlagEvaluationFn;\n setHook?: (value: FlagValue) => void;\n};\n\n/**\n * The environment contains evaluated flags as well as the registered platform.\n * This is always used as a global singleton and can be retrieved with\n * `tf.env()`.\n *\n * @doc {heading: 'Environment'}\n */\nexport class Environment {\n private flags: Flags = {};\n private flagRegistry: {[flagName: string]: FlagRegistryEntry} = {};\n\n private urlFlags: Flags = {};\n\n platformName: string;\n platform: Platform;\n\n // Jasmine spies on this in 'environment_test.ts'\n getQueryParams = getQueryParams;\n\n // tslint:disable-next-line: no-any\n constructor(public global: any) {\n this.populateURLFlags();\n }\n\n setPlatform(platformName: string, platform: Platform) {\n if (this.platform != null) {\n if (!(env().getBool('IS_TEST') || env().getBool('PROD'))) {\n console.warn(\n `Platform ${this.platformName} has already been set. ` +\n `Overwriting the platform with ${platformName}.`);\n }\n }\n this.platformName = platformName;\n this.platform = platform;\n }\n\n registerFlag(\n flagName: string, evaluationFn: FlagEvaluationFn,\n setHook?: (value: FlagValue) => void) {\n this.flagRegistry[flagName] = {evaluationFn, setHook};\n\n // Override the flag value from the URL. This has to happen here because\n // the environment is initialized before flags get registered.\n if (this.urlFlags[flagName] != null) {\n const flagValue = this.urlFlags[flagName];\n if (!(env().getBool('IS_TEST') || env().getBool('PROD'))) {\n console.warn(\n `Setting feature override from URL ${flagName}: ${flagValue}.`);\n }\n this.set(flagName, flagValue);\n }\n }\n\n async getAsync(flagName: string): Promise {\n if (flagName in this.flags) {\n return this.flags[flagName];\n }\n\n this.flags[flagName] = await this.evaluateFlag(flagName);\n return this.flags[flagName];\n }\n\n get(flagName: string): FlagValue {\n if (flagName in this.flags) {\n return this.flags[flagName];\n }\n\n const flagValue = this.evaluateFlag(flagName);\n if (isPromise(flagValue)) {\n throw new Error(\n `Flag ${flagName} cannot be synchronously evaluated. ` +\n `Please use getAsync() instead.`);\n }\n\n this.flags[flagName] = flagValue;\n return this.flags[flagName];\n }\n\n getNumber(flagName: string): number {\n return this.get(flagName) as number;\n }\n\n getBool(flagName: string): boolean {\n return this.get(flagName) as boolean;\n }\n\n getFlags(): Flags {\n return this.flags;\n }\n // For backwards compatibility.\n get features(): Flags {\n return this.flags;\n }\n\n set(flagName: string, value: FlagValue): void {\n if (this.flagRegistry[flagName] == null) {\n throw new Error(\n `Cannot set flag ${flagName} as it has not been registered.`);\n }\n this.flags[flagName] = value;\n if (this.flagRegistry[flagName].setHook != null) {\n this.flagRegistry[flagName].setHook(value);\n }\n }\n\n private evaluateFlag(flagName: string): FlagValue|Promise {\n if (this.flagRegistry[flagName] == null) {\n throw new Error(\n `Cannot evaluate flag '${flagName}': no evaluation function found.`);\n }\n return this.flagRegistry[flagName].evaluationFn();\n }\n\n setFlags(flags: Flags) {\n this.flags = Object.assign({}, flags);\n }\n\n reset() {\n this.flags = {};\n this.urlFlags = {};\n this.populateURLFlags();\n }\n\n private populateURLFlags(): void {\n if (typeof this.global === 'undefined' ||\n typeof this.global.location === 'undefined' ||\n typeof this.global.location.search === 'undefined') {\n return;\n }\n\n const urlParams = this.getQueryParams(this.global.location.search);\n if (TENSORFLOWJS_FLAGS_PREFIX in urlParams) {\n const keyValues = urlParams[TENSORFLOWJS_FLAGS_PREFIX].split(',');\n keyValues.forEach(keyValue => {\n const [key, value] = keyValue.split(':') as [string, string];\n this.urlFlags[key] = parseValue(key, value);\n });\n }\n }\n}\n\nexport function getQueryParams(queryString: string): {[key: string]: string} {\n const params = {};\n queryString.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g, (s, ...t) => {\n decodeParam(params, t[0], t[1]);\n return t.join('=');\n });\n return params;\n}\n\nfunction decodeParam(\n params: {[key: string]: string}, name: string, value?: string) {\n params[decodeURIComponent(name)] = decodeURIComponent(value || '');\n}\n\nfunction parseValue(flagName: string, value: string): FlagValue {\n value = value.toLowerCase();\n if (value === 'true' || value === 'false') {\n return value === 'true';\n } else if (`${+ value}` === value) {\n return +value;\n }\n throw new Error(\n `Could not parse value flag value ${value} for flag ${flagName}.`);\n}\n\n/**\n * Returns the current environment (a global singleton).\n *\n * The environment object contains the evaluated feature values as well as the\n * active platform.\n *\n * @doc {heading: 'Environment'}\n */\nexport function env() {\n return ENV;\n}\n\nexport let ENV: Environment = null;\nexport function setEnvironmentGlobal(environment: Environment) {\n ENV = environment;\n}\n","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// Note that the identifier globalNameSpace is scoped to this module, but will\n// always resolve to the same global object regardless of how the module is\n// resolved.\n// tslint:disable-next-line:no-any\nlet globalNameSpace: {_tfGlobals: Map};\n// tslint:disable-next-line:no-any\nexport function getGlobalNamespace(): {_tfGlobals: Map} {\n if (globalNameSpace == null) {\n // tslint:disable-next-line:no-any\n let ns: any;\n if (typeof (window) !== 'undefined') {\n ns = window;\n } else if (typeof (global) !== 'undefined') {\n ns = global;\n } else if (typeof (process) !== 'undefined') {\n ns = process;\n } else if (typeof (self) !== 'undefined') {\n ns = self;\n } else {\n throw new Error('Could not find a global object');\n }\n globalNameSpace = ns;\n }\n return globalNameSpace;\n}\n\n// tslint:disable-next-line:no-any\nfunction getGlobalMap(): Map {\n const ns = getGlobalNamespace();\n if (ns._tfGlobals == null) {\n ns._tfGlobals = new Map();\n }\n return ns._tfGlobals;\n}\n\n/**\n * Returns a globally accessible 'singleton' object.\n *\n * @param key the name of the object\n * @param init a function to initialize to initialize this object\n * the first time it is fetched.\n */\nexport function getGlobal(key: string, init: () => T): T {\n const globalMap = getGlobalMap();\n if (globalMap.has(key)) {\n return globalMap.get(key);\n } else {\n const singleton = init();\n globalMap.set(key, singleton);\n return globalMap.get(key);\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n// Allow UpperCamelCase variable names\n// tslint:disable: variable-name\n// Unfortunately just enabling PascalCase per file (tslint:enable:\n// allow-pascal-case) doesn't work.\nimport {NamedTensorInfoMap, TensorInfo} from './kernel_registry';\nimport {ExplicitPadding} from './ops/conv_util';\nimport {Activation} from './ops/fused_types';\nimport {DataType, PixelData} from './types';\n\nexport const Abs = 'Abs';\nexport type AbsInputs = UnaryInputs;\n\nexport const Acos = 'Acos';\nexport type AcosInputs = UnaryInputs;\n\nexport const Acosh = 'Acosh';\nexport type AcoshInputs = UnaryInputs;\n\nexport const Add = 'Add';\nexport type AddInputs = BinaryInputs;\n\nexport const AddN = 'AddN';\nexport type AddNInputs = TensorInfo[];\n\nexport const All = 'All';\nexport type AllInputs = Pick;\nexport interface AllAttrs {\n axis: number|number[];\n keepDims: boolean;\n}\n\nexport const Any = 'Any';\nexport type AnyInputs = Pick;\nexport interface AnyAttrs {\n axis: number|number[];\n keepDims: boolean;\n}\n\nexport const ArgMax = 'ArgMax';\nexport type ArgMaxInputs = Pick;\nexport interface ArgMaxAttrs {\n axis: number;\n}\n\nexport const ArgMin = 'ArgMin';\nexport type ArgMinInputs = Pick;\nexport interface ArgMinAttrs {\n axis: number;\n}\n\nexport const Asin = 'Asin';\nexport type AsinInputs = UnaryInputs;\n\nexport const Asinh = 'Asinh';\nexport type AsinhInputs = UnaryInputs;\n\nexport const Atan = 'Atan';\nexport type AtanInputs = UnaryInputs;\n\nexport const Atanh = 'Atanh';\nexport type AtanhInputs = UnaryInputs;\n\nexport const Atan2 = 'Atan2';\nexport type Atan2Inputs = BinaryInputs;\n\nexport const AvgPool = 'AvgPool';\nexport type AvgPoolInputs = Pick;\nexport interface AvgPoolAttrs {\n filterSize: [number, number]|number;\n strides: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n}\n\nexport const AvgPoolGrad = 'AvgPoolGrad';\nexport type AvgPoolGradInputs = Pick;\nexport interface AvgPoolGradAttrs {\n filterSize: [number, number]|number;\n strides: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n}\n\nexport const AvgPool3D = 'AvgPool3D';\nexport type AvgPool3DInputs = Pick;\nexport interface AvgPool3DAttrs {\n filterSize: [number, number, number]|number;\n strides: [number, number, number]|number;\n pad: 'valid'|'same'|number;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n dataFormat: 'NDHWC'|'NCDHW';\n}\n\nexport const AvgPool3DGrad = 'AvgPool3DGrad';\nexport type AvgPool3DGradInputs = Pick;\nexport interface AvgPool3DGradAttrs {\n filterSize: [number, number, number]|number;\n strides: [number, number, number]|number;\n pad: 'valid'|'same'|number;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n}\n\nexport const BatchMatMul = 'BatchMatMul';\nexport type BatchMatMulInputs = Pick;\nexport interface BatchMatMulAttrs {\n transposeA: boolean;\n transposeB: boolean;\n}\n\nexport const BatchToSpaceND = 'BatchToSpaceND';\nexport type BatchToSpaceNDInputs = Pick;\nexport interface BatchToSpaceNDAttrs {\n blockShape: number[];\n crops: number[][];\n}\n\nexport type BinaryInputs = Pick;\n\nexport const Bincount = 'Bincount';\nexport type BincountInputs = Pick;\nexport interface BincountAttrs {\n size: number;\n}\n\nexport const BroadcastTo = 'BroadcastTo';\nexport type BroadcastToInputs = Pick;\nexport interface BroadCastToAttrs {\n shape: number[];\n inputShape: number[]; // for gradient\n}\n\nexport const BroadcastArgs = 'BroadcastArgs';\nexport type BroadcastArgsInputs = Pick;\n\nexport const Cast = 'Cast';\nexport type CastInputs = UnaryInputs;\nexport interface CastAttrs {\n dtype: DataType;\n}\n\nexport const Ceil = 'Ceil';\nexport type CeilInputs = UnaryInputs;\n\nexport const ClipByValue = 'ClipByValue';\nexport type ClipByValueInputs = UnaryInputs;\nexport interface ClipByValueAttrs {\n clipValueMin: number;\n clipValueMax: number;\n}\n\nexport const Complex = 'Complex';\nexport type ComplexInputs = Pick;\n\nexport const ComplexAbs = 'ComplexAbs';\nexport type ComplexAbsInputs = UnaryInputs;\n\nexport const Concat = 'Concat';\nexport type ConcatInputs = TensorInfo[];\nexport interface ConcatAttrs {\n axis: number;\n}\n\nexport const Conv2D = 'Conv2D';\nexport type Conv2DInputs = Pick;\nexport interface Conv2DAttrs {\n strides: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n dataFormat: 'NHWC'|'NCHW';\n dilations: [number, number]|number;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n}\n\nexport const Conv2DBackpropFilter = 'Conv2DBackpropFilter';\nexport type Conv2DBackpropFilterInputs = Pick;\nexport interface Conv2DBackpropFilterAttrs {\n strides: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n dataFormat: 'NHWC'|'NCHW';\n dimRoundingMode?: 'floor'|'round'|'ceil';\n filterShape: [number, number, number, number];\n}\n\nexport const Conv2DBackpropInput = 'Conv2DBackpropInput';\nexport type Conv2DBackpropInputInputs = Pick;\nexport interface Conv2DBackpropInputAttrs {\n strides: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n dataFormat: 'NHWC'|'NCHW';\n dimRoundingMode?: 'floor'|'round'|'ceil';\n inputShape: [number, number, number, number];\n}\n\nexport const Conv3D = 'Conv3D';\nexport type Conv3DInputs = Pick;\nexport interface Conv3DAttrs {\n strides: [number, number, number]|number;\n pad: 'valid'|'same';\n dataFormat: 'NDHWC'|'NCDHW';\n dilations: [number, number, number]|number;\n}\n\nexport const Conv3DBackpropFilterV2 = 'Conv3DBackpropFilterV2';\nexport type Conv3DBackpropFilterV2Inputs = Pick;\n\nexport interface Conv3DBackpropFilterV2Attrs {\n strides: [number, number, number]|number;\n pad: 'valid'|'same';\n filterShape: [number, number, number, number, number];\n}\n\nexport const Conv3DBackpropInputV2 = 'Conv3DBackpropInputV2';\nexport type Conv3DBackpropInputV2Inputs =\n Pick;\nexport interface Conv3DBackpropInputV2Attrs {\n strides: [number, number, number]|number;\n pad: 'valid'|'same';\n inputShape: [number, number, number, number, number];\n}\n\nexport const Cos = 'Cos';\nexport type CosInputs = UnaryInputs;\n\nexport const Cosh = 'Cosh';\nexport type CoshInputs = UnaryInputs;\n\nexport const Cumprod = 'Cumprod';\nexport type CumprodInputs = Pick;\nexport interface CumprodAttrs {\n axis: number;\n exclusive: boolean;\n reverse: boolean;\n}\n\nexport const Cumsum = 'Cumsum';\nexport type CumsumInputs = Pick;\nexport interface CumsumAttrs {\n axis: number;\n exclusive: boolean;\n reverse: boolean;\n}\n\nexport const CropAndResize = 'CropAndResize';\nexport type CropAndResizeInputs =\n Pick;\nexport interface CropAndResizeAttrs {\n cropSize: [number, number];\n method: 'bilinear'|'nearest';\n extrapolationValue: number;\n}\n\nexport const DenseBincount = 'DenseBincount';\nexport type DenseBincountInputs = Pick;\nexport interface DenseBincountAttrs {\n size: number;\n binaryOutput?: boolean;\n}\n\nexport const DepthToSpace = 'DepthToSpace';\nexport type DepthToSpaceInputs = Pick;\nexport interface DepthToSpaceAttrs {\n blockSize: number;\n dataFormat: 'NHWC'|'NCHW';\n}\n\nexport const DepthwiseConv2dNative = 'DepthwiseConv2dNative';\nexport type DepthwiseConv2dNativeInputs =\n Pick;\nexport interface DepthwiseConv2dNativeAttrs {\n strides: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n dataFormat: 'NHWC'|'NCHW';\n dilations: [number, number]|number;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n}\n\nexport const DepthwiseConv2dNativeBackpropFilter =\n 'DepthwiseConv2dNativeBackpropFilter';\nexport type DepthwiseConv2dNativeBackpropFilterInputs =\n Pick;\nexport interface DepthwiseConv2dNativeBackpropFilterAttrs {\n strides: [number, number]|number;\n dilations: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n filterShape: [number, number, number, number];\n}\n\nexport const DepthwiseConv2dNativeBackpropInput =\n 'DepthwiseConv2dNativeBackpropInput';\nexport type DepthwiseConv2dNativeBackpropInputInputs =\n Pick;\nexport interface DepthwiseConv2dNativeBackpropInputAttrs {\n strides: [number, number]|number;\n dilations: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n inputShape: [number, number, number, number];\n}\n\nexport const Diag = 'Diag';\nexport type DiagInputs = Pick;\n\nexport const Dilation2D = 'Dilation2D';\nexport type Dilation2DInputs = Pick;\nexport interface Dilation2DAttrs {\n strides: [number, number]|number;\n pad: 'valid'|'same'|number;\n dilations: [number, number]|number;\n}\n\nexport const Dilation2DBackpropInput = 'Dilation2DBackpropInput';\nexport type Dilation2DBackpropInputInputs =\n Pick;\n\nexport const Dilation2DBackpropFilter = 'Dilation2DBackpropFilter';\nexport type Dilation2DBackpropFilterInputs =\n Pick;\n\nexport const RealDiv = 'RealDiv';\nexport type RealDivInputs = BinaryInputs;\n\nexport const Einsum = 'Einsum';\nexport type EinsumInputs = TensorInfo[];\nexport interface EinsumAttrs {\n equation: string;\n}\n\nexport const Elu = 'Elu';\nexport type EluInputs = Pick;\n\nexport const EluGrad = 'EluGrad';\nexport type EluGradInputs = Pick;\n\nexport const Erf = 'Erf';\nexport type ErfInputs = UnaryInputs;\n\nexport const Equal = 'Equal';\nexport type EqualInputs = BinaryInputs;\n\nexport const Exp = 'Exp';\nexport type ExpInputs = UnaryInputs;\n\nexport const ExpandDims = 'ExpandDims';\nexport type ExpandDimsInputs = Pick;\nexport interface ExpandDimsAttrs {\n dim: number;\n}\n\nexport const Expm1 = 'Expm1';\nexport type Expm1Inputs = UnaryInputs;\n\nexport const FFT = 'FFT';\nexport type FFTInputs = Pick;\n\nexport const Fill = 'Fill';\nexport interface FillAttrs {\n shape: number[];\n value: number|string;\n dtype: DataType;\n}\n\nexport const FlipLeftRight = 'FlipLeftRight';\nexport type FlipLeftRightInputs = Pick;\n\nexport const Floor = 'Floor';\nexport type FloorInputs = UnaryInputs;\n\nexport const FloorDiv = 'FloorDiv';\nexport type FloorDivInputs = BinaryInputs;\n\nexport const FusedBatchNorm = 'FusedBatchNorm';\nexport type FusedBatchNormInputs =\n Pick;\nexport interface FusedBatchNormAttrs {\n varianceEpsilon: number;\n}\n\nexport const GatherV2 = 'GatherV2';\nexport type GatherV2Inputs = Pick;\nexport interface GatherV2Attrs {\n axis: number;\n batchDims: number;\n}\n\nexport const GatherNd = 'GatherNd';\nexport type GatherNdInputs = Pick;\n\nexport const Greater = 'Greater';\nexport type GreaterInputs = BinaryInputs;\n\nexport const GreaterEqual = 'GreaterEqual';\nexport type GreaterEqualInputs = BinaryInputs;\n\nexport const Identity = 'Identity';\nexport type IdentityInputs = Pick;\n\nexport const IFFT = 'IFFT';\nexport type IFFTInputs = Pick;\n\nexport const Imag = 'Imag';\nexport type ImagInputs = Pick;\n\nexport const IsFinite = 'IsFinite';\nexport type IsFiniteInputs = UnaryInputs;\n\nexport const IsInf = 'IsInf';\nexport type IsInfInputs = UnaryInputs;\n\nexport const IsNan = 'IsNan';\nexport type IsNanInputs = UnaryInputs;\n\nexport const LeakyRelu = 'LeakyRelu';\nexport type LeakyReluInputs = Pick;\nexport interface LeakyReluAttrs {\n alpha: number;\n}\n\nexport const Less = 'Less';\nexport type LessInputs = BinaryInputs;\n\nexport const LessEqual = 'LessEqual';\nexport type LessEqualInputs = BinaryInputs;\n\nexport const LinSpace = 'LinSpace';\nexport interface LinSpaceAttrs {\n start: number;\n stop: number;\n num: number;\n}\nexport const Log = 'Log';\nexport type LogInputs = UnaryInputs;\n\nexport const Log1p = 'Log1p';\nexport type Log1pInputs = UnaryInputs;\n\nexport const LogicalAnd = 'LogicalAnd';\nexport type LogicalAndInputs = BinaryInputs;\n\nexport const LogicalNot = 'LogicalNot';\nexport type LogicalNotInputs = Pick;\n\nexport const LogicalOr = 'LogicalOr';\nexport type LogicalOrInputs = BinaryInputs;\n\nexport const LogicalXor = 'LogicalXor';\nexport type LogicalXorInputs = BinaryInputs;\n\nexport const LogSoftmax = 'LogSoftmax';\nexport type LogSoftmaxInputs = Pick;\nexport interface LogSoftmaxAttrs {\n axis: number;\n}\n\nexport const LowerBound = 'LowerBound';\nexport type LowerBoundInputs =\n Pick;\n\nexport const LRN = 'LRN';\nexport type LRNInputs = Pick;\nexport interface LRNAttrs {\n depthRadius: number;\n bias: number;\n alpha: number;\n beta: number;\n}\n\nexport const LRNGrad = 'LRNGrad';\nexport type LRNGradInputs = Pick;\nexport interface LRNGradAttrs {\n depthRadius: number;\n bias: number;\n alpha: number;\n beta: number;\n}\n\nexport const Max = 'Max';\nexport type MaxInputs = Pick;\nexport interface MaxAttrs {\n reductionIndices: number|number[];\n keepDims: boolean;\n}\n\nexport const Maximum = 'Maximum';\nexport type MaximumInputs = BinaryInputs;\n\nexport const MaxPool = 'MaxPool';\nexport type MaxPoolInputs = Pick;\nexport interface MaxPoolAttrs {\n filterSize: [number, number]|number;\n strides: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n}\n\nexport const MaxPoolGrad = 'MaxPoolGrad';\nexport type MaxPoolGradInputs = Pick;\nexport interface MaxPoolGradAttrs {\n filterSize: [number, number]|number;\n strides: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n}\n\nexport const MaxPool3D = 'MaxPool3D';\nexport type MaxPool3DInputs = Pick;\nexport interface MaxPool3DAttrs {\n filterSize: [number, number, number]|number;\n strides: [number, number, number]|number;\n pad: 'valid'|'same'|number;\n dataFormat: 'NDHWC'|'NCDHW';\n dimRoundingMode?: 'floor'|'round'|'ceil';\n}\n\nexport const MaxPool3DGrad = 'MaxPool3DGrad';\nexport type MaxPool3DGradInputs =\n Pick;\nexport interface MaxPool3DGradAttrs {\n filterSize: [number, number, number]|number;\n strides: [number, number, number]|number;\n pad: 'valid'|'same'|number;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n}\n\nexport const MaxPoolWithArgmax = 'MaxPoolWithArgmax';\nexport type MaxPoolWithArgmaxInputs = Pick;\nexport interface MaxPoolWithArgmaxAttrs {\n filterSize: [number, number]|number;\n strides: [number, number]|number;\n pad: 'valid'|'same'|number;\n includeBatchInIndex: boolean;\n}\n\nexport const Mean = 'Mean';\nexport type MeanInputs = Pick;\nexport interface MeanAttrs {\n axis: number|number[];\n keepDims: boolean;\n}\n\nexport const Min = 'Min';\nexport type MinInputs = Pick;\nexport interface MinAttrs {\n axis: number|number[];\n keepDims: boolean;\n}\n\nexport const Minimum = 'Minimum';\nexport type MinimumInputs = BinaryInputs;\n\nexport const MirrorPad = 'MirrorPad';\nexport type MirrorPadInputs = Pick;\nexport interface MirrorPadAttrs {\n paddings: Array<[number, number]>;\n mode: 'reflect'|'symmetric';\n}\n\nexport const Mod = 'Mod';\nexport type ModInputs = BinaryInputs;\n\nexport const Multinomial = 'Multinomial';\nexport type MultinomialInputs = Pick;\nexport interface MultinomialAttrs {\n numSamples: number;\n seed: number;\n normalized: boolean;\n}\n\nexport const Multiply = 'Multiply';\nexport type MultiplyInputs = BinaryInputs;\n\nexport const Neg = 'Neg';\nexport type NegInputs = UnaryInputs;\n\nexport const NotEqual = 'NotEqual';\nexport type NotEqualInputs = BinaryInputs;\n\nexport const NonMaxSuppressionV3 = 'NonMaxSuppressionV3';\nexport type NonMaxSuppressionV3Inputs =\n Pick;\nexport interface NonMaxSuppressionV3Attrs {\n maxOutputSize: number;\n iouThreshold: number;\n scoreThreshold: number;\n}\n\nexport const NonMaxSuppressionV4 = 'NonMaxSuppressionV4';\nexport type NonMaxSuppressionV4Inputs =\n Pick;\nexport interface NonMaxSuppressionV4Attrs {\n maxOutputSize: number;\n iouThreshold: number;\n scoreThreshold: number;\n padToMaxOutputSize: boolean;\n}\n\nexport const NonMaxSuppressionV5 = 'NonMaxSuppressionV5';\nexport type NonMaxSuppressionV5Inputs =\n Pick;\nexport interface NonMaxSuppressionV5Attrs {\n maxOutputSize: number;\n iouThreshold: number;\n scoreThreshold: number;\n softNmsSigma: number;\n}\n\nexport const OnesLike = 'OnesLike';\nexport type OnesLikeInputs = UnaryInputs;\n\nexport const OneHot = 'OneHot';\nexport type OneHotInputs = Pick;\nexport interface OneHotAttrs {\n depth: number;\n onValue: number;\n offValue: number;\n dtype: DataType;\n}\n\nexport const Pack = 'Pack';\nexport type PackInputs = TensorInfo[];\nexport interface PackAttrs {\n axis: number;\n}\n\nexport const PadV2 = 'PadV2';\nexport type PadV2Inputs = Pick;\nexport interface PadV2Attrs {\n paddings: Array<[number, number]>;\n constantValue: number;\n}\n\nexport const Pool = 'Pool';\nexport type PoolInputs = Pick;\n\nexport const Pow = 'Pow';\nexport type PowInputs = BinaryInputs;\n\nexport const Prelu = 'Prelu';\nexport type PreluInputs = Pick;\n\nexport const Prod = 'Prod';\nexport type ProdInputs = Pick;\nexport interface ProdAttrs {\n axis: number|number[];\n keepDims: boolean;\n}\n\nexport const RaggedGather = 'RaggedGather';\nexport type RaggedGatherInputs = {\n paramsNestedSplits: TensorInfo[]\n}&Pick;\nexport interface RaggedGatherAttrs {\n outputRaggedRank: number;\n}\n\nexport const RaggedRange = 'RaggedRange';\nexport type RaggedRangeInputs =\n Pick;\n\nexport const RaggedTensorToTensor = 'RaggedTensorToTensor';\nexport type RaggedTensorToTensorInputs =\n Pick&\n {rowPartitionTensors: TensorInfo[]};\nexport interface RaggedTensorToTensorAttrs {\n rowPartitionTypes: string[];\n}\n\nexport const Range = 'Range';\nexport interface RangeAttrs {\n start: number;\n stop: number;\n step: number;\n dtype: 'float32'|'int32';\n}\n\nexport const Real = 'Real';\nexport type RealInputs = Pick;\n\nexport const Reciprocal = 'Reciprocal';\nexport type ReciprocalInputs = UnaryInputs;\n\nexport const Relu = 'Relu';\nexport type ReluInputs = Pick;\n\nexport const Reshape = 'Reshape';\nexport type ReshapeInputs = Pick;\nexport interface ReshapeAttrs {\n shape: number[];\n}\n\nexport const ResizeNearestNeighbor = 'ResizeNearestNeighbor';\nexport type ResizeNearestNeighborInputs = Pick;\nexport interface ResizeNearestNeighborAttrs {\n alignCorners: boolean;\n halfPixelCenters: boolean;\n size: [number, number];\n}\n\nexport const ResizeNearestNeighborGrad = 'ResizeNearestNeighborGrad';\nexport type ResizeNearestNeighborGradInputs =\n Pick;\nexport type ResizeNearestNeighborGradAttrs = ResizeNearestNeighborAttrs;\n\nexport const ResizeBilinear = 'ResizeBilinear';\nexport type ResizeBilinearInputs = Pick;\nexport interface ResizeBilinearAttrs {\n alignCorners: boolean;\n halfPixelCenters: boolean;\n size: [number, number];\n}\n\nexport const ResizeBilinearGrad = 'ResizeBilinearGrad';\nexport type ResizeBilinearGradInputs = Pick;\nexport type ResizeBilinearGradAttrs = ResizeBilinearAttrs;\n\nexport const Relu6 = 'Relu6';\nexport type Relu6Inputs = Pick;\n\nexport const Reverse = 'Reverse';\nexport type ReverseInputs = Pick;\nexport interface ReverseAttrs {\n dims: number|number[];\n}\n\nexport const Round = 'Round';\nexport type RoundInputs = UnaryInputs;\n\nexport const Rsqrt = 'Rsqrt';\nexport type RsqrtInputs = UnaryInputs;\n\nexport const ScatterNd = 'ScatterNd';\nexport type ScatterNdInputs = Pick;\nexport interface ScatterNdAttrs {\n shape: number[];\n}\n\nexport const SearchSorted = 'SearchSorted';\nexport type SearchSortedInputs =\n Pick;\nexport interface SearchSortedAttrs {\n side: 'left'|'right';\n}\n\nexport const Select = 'Select';\nexport type SelectInputs = Pick;\n\nexport const Selu = 'Selu';\nexport type SeluInputs = Pick;\n\nexport const Slice = 'Slice';\nexport type SliceInputs = Pick;\nexport interface SliceAttrs {\n begin: number|number[];\n size: number|number[];\n}\nexport const Sin = 'Sin';\nexport type SinInputs = UnaryInputs;\n\nexport const Sinh = 'Sinh';\nexport type SinhInputs = UnaryInputs;\n\nexport const Sign = 'Sign';\nexport type SignInputs = UnaryInputs;\n\nexport const Sigmoid = 'Sigmoid';\nexport type SigmoidInputs = UnaryInputs;\n\nexport const Softplus = 'Softplus';\nexport type SoftplusInputs = UnaryInputs;\n\nexport const Sqrt = 'Sqrt';\nexport type SqrtInputs = UnaryInputs;\n\nexport const Sum = 'Sum';\nexport type SumInputs = Pick;\nexport interface SumAttrs {\n axis: number|number[];\n keepDims: boolean;\n}\n\nexport const SpaceToBatchND = 'SpaceToBatchND';\nexport type SpaceToBatchNDInputs = Pick;\nexport interface SpaceToBatchNDAttrs {\n blockShape: number[];\n paddings: number[][];\n}\n\nexport const SplitV = 'SplitV';\nexport type SplitVInputs = Pick;\nexport interface SplitVAttrs {\n numOrSizeSplits: number[]|number;\n axis: number;\n}\n\nexport const Softmax = 'Softmax';\nexport type SoftmaxInputs = Pick;\nexport interface SoftmaxAttrs {\n dim: number;\n}\n\nexport const SparseFillEmptyRows = 'SparseFillEmptyRows';\nexport type SparseFillEmptyRowsInputs =\n Pick;\n\nexport const SparseReshape = 'SparseReshape';\nexport type SparseReshapeInputs =\n Pick;\n\nexport const SparseSegmentMean = 'SparseSegmentMean';\nexport type SparseSegmentMeanInputs =\n Pick;\n\nexport const SparseSegmentSum = 'SparseSegmentSum';\nexport type SparseSegmentSumInputs =\n Pick;\n\nexport const SparseToDense = 'SparseToDense';\nexport type SparseToDenseInputs =\n Pick;\nexport interface SparseToDenseAttrs {\n outputShape: number[];\n}\n\nexport const SquaredDifference = 'SquaredDifference';\nexport type SquaredDifferenceInputs = BinaryInputs;\n\nexport const Square = 'Square';\nexport type SquareInputs = Pick;\n\nexport const StridedSlice = 'StridedSlice';\nexport type StridedSliceInputs = Pick;\nexport interface StridedSliceAttrs {\n begin: number[];\n end: number[];\n strides: number[];\n beginMask: number;\n endMask: number;\n ellipsisMask: number;\n newAxisMask: number;\n shrinkAxisMask: number;\n}\n\nexport const StringNGrams = 'StringNGrams';\nexport type StringNGramsInputs = Pick;\nexport interface StringNGramsAttrs {\n separator: string;\n nGramWidths: number[];\n leftPad: string;\n rightPad: string;\n padWidth: number;\n preserveShortSequences: boolean;\n}\n\nexport const StringSplit = 'StringSplit';\nexport type StringSplitInputs = Pick;\nexport interface StringSplitAttrs {\n skipEmpty: boolean;\n}\n\nexport const StringToHashBucketFast = 'StringToHashBucketFast';\nexport type StringToHashBucketFastInputs = Pick;\nexport interface StringToHashBucketFastAttrs {\n numBuckets: number;\n}\n\nexport const Sub = 'Sub';\nexport type SubInputs = BinaryInputs;\n\nexport const Tan = 'Tan';\nexport type TanInputs = UnaryInputs;\n\nexport const Tanh = 'Tanh';\nexport type TanhInputs = UnaryInputs;\n\nexport const Tile = 'Tile';\nexport type TileInputs = Pick;\nexport interface TileAttrs {\n reps: number[];\n}\n\nexport const TopK = 'TopK';\nexport type TopKInputs = Pick;\nexport interface TopKAttrs {\n k: number;\n sorted: boolean;\n}\n\nexport const Transform = 'Transform';\nexport type TransformInputs = Pick;\nexport interface TransformAttrs {\n interpolation: 'nearest'|'bilinear';\n fillMode: 'constant'|'reflect'|'wrap'|'nearest';\n fillValue: number;\n outputShape?: [number, number];\n}\n\nexport const Transpose = 'Transpose';\nexport type TransposeInputs = Pick;\nexport interface TransposeAttrs {\n perm: number[];\n}\n\nexport const Unique = 'Unique';\nexport type UniqueInputs = Pick;\nexport interface UniqueAttrs {\n axis: number;\n}\n\nexport type UnaryInputs = Pick;\n\nexport const Unpack = 'Unpack';\nexport type UnpackInputs = Pick;\nexport interface UnpackAttrs {\n axis: number;\n}\n\nexport const UnsortedSegmentSum = 'UnsortedSegmentSum';\nexport type UnsortedSegmentSumInputs =\n Pick;\nexport interface UnsortedSegmentSumAttrs {\n numSegments: number;\n}\n\nexport const UpperBound = 'UpperBound';\nexport type UpperBoundInputs =\n Pick;\n\nexport const ZerosLike = 'ZerosLike';\nexport type ZerosLikeInputs = UnaryInputs;\n\n/**\n * TensorFlow.js-only kernels\n */\nexport const Step = 'Step';\nexport type StepInputs = UnaryInputs;\nexport interface StepAttrs {\n alpha: number;\n}\n\nexport const FromPixels = 'FromPixels';\nexport interface FromPixelsInputs {\n pixels: PixelData|ImageData|HTMLImageElement|HTMLCanvasElement|\n HTMLVideoElement|ImageBitmap;\n}\nexport interface FromPixelsAttrs {\n numChannels: number;\n}\n\nexport const RotateWithOffset = 'RotateWithOffset';\nexport type RotateWithOffsetInputs = Pick;\nexport interface RotateWithOffsetAttrs {\n radians: number;\n fillValue: number|[number, number, number];\n center: number|[number, number];\n}\n\nexport const _FusedMatMul = '_FusedMatMul';\n// tslint:disable-next-line: class-name\nexport interface _FusedMatMulInputs extends NamedTensorInfoMap {\n a: TensorInfo;\n b: TensorInfo;\n bias?: TensorInfo;\n preluActivationWeights?: TensorInfo;\n}\n// tslint:disable-next-line: class-name\nexport interface _FusedMatMulAttrs {\n transposeA: boolean;\n transposeB: boolean;\n activation: Activation;\n leakyreluAlpha?: number;\n}\n\nexport const FusedConv2D = 'FusedConv2D';\nexport interface FusedConv2DInputs extends NamedTensorInfoMap {\n x: TensorInfo;\n filter: TensorInfo;\n bias?: TensorInfo;\n preluActivationWeights?: TensorInfo;\n}\nexport interface FusedConv2DAttrs {\n strides: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n dataFormat: 'NHWC'|'NCHW';\n dilations: [number, number]|number;\n dimRoundingMode: 'floor'|'round'|'ceil';\n activation: Activation;\n leakyreluAlpha?: number;\n}\n\nexport const FusedDepthwiseConv2D = 'FusedDepthwiseConv2D';\nexport interface FusedDepthwiseConv2DInputs extends NamedTensorInfoMap {\n x: TensorInfo;\n filter: TensorInfo;\n bias?: TensorInfo;\n preluActivationWeights?: TensorInfo;\n}\nexport interface FusedDepthwiseConv2DAttrs {\n strides: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n dataFormat: 'NHWC'|'NCHW';\n dilations: [number, number]|number;\n dimRoundingMode: 'floor'|'round'|'ceil';\n activation: Activation;\n leakyreluAlpha?: number;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env} from './environment';\n\nexport function warn(...msg: Array<{}>): void {\n if (!(env().getBool('IS_TEST') || env().getBool('PROD'))) {\n console.warn(...msg);\n }\n}\n\nexport function log(...msg: Array<{}>): void {\n if (!(env().getBool('IS_TEST') || env().getBool('PROD'))) {\n console.log(...msg);\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {env} from './environment';\nimport {getGlobal} from './global_util';\nimport * as log from './log';\nimport {NamedGradientMap} from './tape';\nimport {Tensor} from './tensor';\nimport {DataType, RecursiveArray} from './types';\n\nconst kernelRegistry =\n getGlobal('kernelRegistry', () => new Map());\nconst gradRegistry =\n getGlobal('gradRegistry', () => new Map());\n\nexport type DataId = object;\n\ntype AttributeValue =\n number|number[]|boolean|boolean[]|string|string[]|NamedAttrMap;\n\n/** These are extra non-tensor/primitive params passed to kernel functions. */\nexport type Attribute = AttributeValue|RecursiveArray;\n\n/** Specifies the code to run when executing a kernel. */\nexport type KernelFunc = (params: {\n inputs: NamedTensorInfoMap,\n backend: {},\n attrs?: NamedAttrMap,\n}) => TensorInfo|TensorInfo[];\n\n/** The function to run when computing a gradient during backprop. */\nexport type GradFunc =\n (dy: Tensor|Tensor[], saved: Tensor[], attrs: NamedAttrMap) =>\n NamedGradientMap;\n\n/** Function that gets called after the backend initializes. */\nexport type KernelSetupFunc = (backend: {}) => void;\n/** Function that gets called right before the backend is disposed. */\nexport type KernelDisposeFunc = KernelSetupFunc;\n\n/** Config object for registering a kernel in the global registry. */\nexport interface KernelConfig {\n kernelName: string;\n backendName: string;\n kernelFunc: KernelFunc;\n setupFunc?: KernelSetupFunc;\n disposeFunc?: KernelDisposeFunc;\n}\n\n/** Config object for registering a gradient in the global registry. */\nexport interface GradConfig {\n kernelName: string;\n inputsToSave?: string[];\n // When saveAllInputs is true, all inputs will be saved. Only use this flag\n // if inputs is an array of Tensors.\n saveAllInputs?: boolean;\n outputsToSave?: boolean[];\n gradFunc: GradFunc;\n}\n\n/** Holds metadata for a given tensor. */\nexport interface TensorInfo {\n dataId: DataId;\n shape: number[];\n dtype: DataType;\n}\n\nexport interface NamedTensorInfoMap {\n [name: string]: TensorInfo|undefined;\n}\n\nexport interface NamedAttrMap {\n [name: string]: Attribute;\n}\n\n/**\n * Returns the kernel function (code) associated with the provided names.\n *\n * @param kernelName The official name of the kernel.\n * @param backendName The official name of the backend.\n */\nexport function getKernel(\n kernelName: string, backendName: string): KernelConfig {\n const key = makeKey(kernelName, backendName);\n return kernelRegistry.get(key);\n}\n\n/**\n * Returns the registered gradient info associated with the provided kernel.\n * @param kernelName The official TF kernel name.\n */\nexport function getGradient(kernelName: string): GradConfig {\n return gradRegistry.get(kernelName);\n}\n\nexport function getKernelsForBackend(backendName: string): KernelConfig[] {\n const it = kernelRegistry.entries();\n const result: KernelConfig[] = [];\n\n while (true) {\n const {done, value} = it.next();\n if (done) {\n break;\n }\n const [key, config] = value;\n const [backend, ] = key.split('_');\n if (backend === backendName) {\n result.push(config);\n }\n }\n return result;\n}\n\n/**\n * Registers the function (forward pass) for the kernel in a global registry.\n *\n * @param config A config object with the following properties:\n * - `kernelName` The official name of the kernel.\n * - `backendName` The official name of the backend.\n * - `kernelFunc` The function to run during the forward pass of the kernel.\n * - `setupFunc` Optional. Gets called once, after the backend initializes.\n * - `disposeFunc` Optional. Gets called once, right before the backend is\n * disposed.\n */\nexport function registerKernel(config: KernelConfig) {\n const {kernelName, backendName} = config;\n const key = makeKey(kernelName, backendName);\n if (kernelRegistry.has(key)) {\n log.warn(\n `The kernel '${kernelName}' for backend ` +\n `'${backendName}' is already registered`);\n }\n kernelRegistry.set(key, config);\n}\n\n/**\n * Registers a gradient function for a given kernel in the global registry,\n * to be used during the back-propagation of that kernel.\n *\n * @param config An object with the following properties:\n * - `kernelName` The name of the kernel that the gradient function is for.\n * - `gradFunc` The function to run during back-propagation.\n */\nexport function registerGradient(config: GradConfig) {\n const {kernelName} = config;\n\n if (gradRegistry.has(kernelName)) {\n // TODO (yassogba) after 3.0 assess whether we need to keep this gated\n // to debug mode.\n if (env().getBool('DEBUG')) {\n log.warn(`Overriding the gradient for '${kernelName}'`);\n }\n }\n gradRegistry.set(kernelName, config);\n}\n\n/**\n * Removes the kernel function from the registry.\n *\n * @param kernelName The official name of the kernel.\n * @param backendName The official name of the backend.\n *\n */\nexport function unregisterKernel(\n kernelName: string, backendName: string): void {\n const key = makeKey(kernelName, backendName);\n if (!kernelRegistry.has(key)) {\n throw new Error(\n `The kernel '${kernelName}' for backend ` +\n `'${backendName}' is not registered`);\n }\n kernelRegistry.delete(key);\n}\n\n/** Removes the registered gradient from the global registry. */\nexport function unregisterGradient(kernelName: string): void {\n if (!gradRegistry.has(kernelName)) {\n throw new Error(\n `The gradient '${kernelName}' for backend is not registered`);\n }\n gradRegistry.delete(kernelName);\n}\n\n/**\n * Finds kernels that have already been registered to a backend and re-registers\n * them for a new backend. Useful for registering custom backends.\n * @param registeredBackendName Already registered backend.\n * @param newBackendName New backend.\n */\nexport function copyRegisteredKernels(\n registeredBackendName: string, newBackendName: string): void {\n const kernels = getKernelsForBackend(registeredBackendName);\n kernels.forEach(kernelConfig => {\n const newKernelConfig =\n Object.assign({}, kernelConfig, {backendName: newBackendName});\n registerKernel(newKernelConfig);\n });\n}\n\nfunction makeKey(kernelName: string, backendName: string) {\n return `${backendName}_${kernelName}`;\n}\n","module.exports = Long;\r\n\r\n/**\r\n * wasm optimizations, to do native i64 multiplication and divide\r\n */\r\nvar wasm = null;\r\n\r\ntry {\r\n wasm = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([\r\n 0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11\r\n ])), {}).exports;\r\n} catch (e) {\r\n // no wasm support :(\r\n}\r\n\r\n/**\r\n * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.\r\n * See the from* functions below for more convenient ways of constructing Longs.\r\n * @exports Long\r\n * @class A Long class for representing a 64 bit two's-complement integer value.\r\n * @param {number} low The low (signed) 32 bits of the long\r\n * @param {number} high The high (signed) 32 bits of the long\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @constructor\r\n */\r\nfunction Long(low, high, unsigned) {\r\n\r\n /**\r\n * The low 32 bits as a signed value.\r\n * @type {number}\r\n */\r\n this.low = low | 0;\r\n\r\n /**\r\n * The high 32 bits as a signed value.\r\n * @type {number}\r\n */\r\n this.high = high | 0;\r\n\r\n /**\r\n * Whether unsigned or not.\r\n * @type {boolean}\r\n */\r\n this.unsigned = !!unsigned;\r\n}\r\n\r\n// The internal representation of a long is the two given signed, 32-bit values.\r\n// We use 32-bit pieces because these are the size of integers on which\r\n// Javascript performs bit-operations. For operations like addition and\r\n// multiplication, we split each number into 16 bit pieces, which can easily be\r\n// multiplied within Javascript's floating-point representation without overflow\r\n// or change in sign.\r\n//\r\n// In the algorithms below, we frequently reduce the negative case to the\r\n// positive case by negating the input(s) and then post-processing the result.\r\n// Note that we must ALWAYS check specially whether those values are MIN_VALUE\r\n// (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as\r\n// a positive number, it overflows back into a negative). Not handling this\r\n// case would often result in infinite recursion.\r\n//\r\n// Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*\r\n// methods on which they depend.\r\n\r\n/**\r\n * An indicator used to reliably determine if an object is a Long or not.\r\n * @type {boolean}\r\n * @const\r\n * @private\r\n */\r\nLong.prototype.__isLong__;\r\n\r\nObject.defineProperty(Long.prototype, \"__isLong__\", { value: true });\r\n\r\n/**\r\n * @function\r\n * @param {*} obj Object\r\n * @returns {boolean}\r\n * @inner\r\n */\r\nfunction isLong(obj) {\r\n return (obj && obj[\"__isLong__\"]) === true;\r\n}\r\n\r\n/**\r\n * Tests if the specified object is a Long.\r\n * @function\r\n * @param {*} obj Object\r\n * @returns {boolean}\r\n */\r\nLong.isLong = isLong;\r\n\r\n/**\r\n * A cache of the Long representations of small integer values.\r\n * @type {!Object}\r\n * @inner\r\n */\r\nvar INT_CACHE = {};\r\n\r\n/**\r\n * A cache of the Long representations of small unsigned integer values.\r\n * @type {!Object}\r\n * @inner\r\n */\r\nvar UINT_CACHE = {};\r\n\r\n/**\r\n * @param {number} value\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromInt(value, unsigned) {\r\n var obj, cachedObj, cache;\r\n if (unsigned) {\r\n value >>>= 0;\r\n if (cache = (0 <= value && value < 256)) {\r\n cachedObj = UINT_CACHE[value];\r\n if (cachedObj)\r\n return cachedObj;\r\n }\r\n obj = fromBits(value, (value | 0) < 0 ? -1 : 0, true);\r\n if (cache)\r\n UINT_CACHE[value] = obj;\r\n return obj;\r\n } else {\r\n value |= 0;\r\n if (cache = (-128 <= value && value < 128)) {\r\n cachedObj = INT_CACHE[value];\r\n if (cachedObj)\r\n return cachedObj;\r\n }\r\n obj = fromBits(value, value < 0 ? -1 : 0, false);\r\n if (cache)\r\n INT_CACHE[value] = obj;\r\n return obj;\r\n }\r\n}\r\n\r\n/**\r\n * Returns a Long representing the given 32 bit integer value.\r\n * @function\r\n * @param {number} value The 32 bit integer in question\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromInt = fromInt;\r\n\r\n/**\r\n * @param {number} value\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromNumber(value, unsigned) {\r\n if (isNaN(value))\r\n return unsigned ? UZERO : ZERO;\r\n if (unsigned) {\r\n if (value < 0)\r\n return UZERO;\r\n if (value >= TWO_PWR_64_DBL)\r\n return MAX_UNSIGNED_VALUE;\r\n } else {\r\n if (value <= -TWO_PWR_63_DBL)\r\n return MIN_VALUE;\r\n if (value + 1 >= TWO_PWR_63_DBL)\r\n return MAX_VALUE;\r\n }\r\n if (value < 0)\r\n return fromNumber(-value, unsigned).neg();\r\n return fromBits((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);\r\n}\r\n\r\n/**\r\n * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.\r\n * @function\r\n * @param {number} value The number in question\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromNumber = fromNumber;\r\n\r\n/**\r\n * @param {number} lowBits\r\n * @param {number} highBits\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromBits(lowBits, highBits, unsigned) {\r\n return new Long(lowBits, highBits, unsigned);\r\n}\r\n\r\n/**\r\n * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is\r\n * assumed to use 32 bits.\r\n * @function\r\n * @param {number} lowBits The low 32 bits\r\n * @param {number} highBits The high 32 bits\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromBits = fromBits;\r\n\r\n/**\r\n * @function\r\n * @param {number} base\r\n * @param {number} exponent\r\n * @returns {number}\r\n * @inner\r\n */\r\nvar pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4)\r\n\r\n/**\r\n * @param {string} str\r\n * @param {(boolean|number)=} unsigned\r\n * @param {number=} radix\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromString(str, unsigned, radix) {\r\n if (str.length === 0)\r\n throw Error('empty string');\r\n if (str === \"NaN\" || str === \"Infinity\" || str === \"+Infinity\" || str === \"-Infinity\")\r\n return ZERO;\r\n if (typeof unsigned === 'number') {\r\n // For goog.math.long compatibility\r\n radix = unsigned,\r\n unsigned = false;\r\n } else {\r\n unsigned = !! unsigned;\r\n }\r\n radix = radix || 10;\r\n if (radix < 2 || 36 < radix)\r\n throw RangeError('radix');\r\n\r\n var p;\r\n if ((p = str.indexOf('-')) > 0)\r\n throw Error('interior hyphen');\r\n else if (p === 0) {\r\n return fromString(str.substring(1), unsigned, radix).neg();\r\n }\r\n\r\n // Do several (8) digits each time through the loop, so as to\r\n // minimize the calls to the very expensive emulated div.\r\n var radixToPower = fromNumber(pow_dbl(radix, 8));\r\n\r\n var result = ZERO;\r\n for (var i = 0; i < str.length; i += 8) {\r\n var size = Math.min(8, str.length - i),\r\n value = parseInt(str.substring(i, i + size), radix);\r\n if (size < 8) {\r\n var power = fromNumber(pow_dbl(radix, size));\r\n result = result.mul(power).add(fromNumber(value));\r\n } else {\r\n result = result.mul(radixToPower);\r\n result = result.add(fromNumber(value));\r\n }\r\n }\r\n result.unsigned = unsigned;\r\n return result;\r\n}\r\n\r\n/**\r\n * Returns a Long representation of the given string, written using the specified radix.\r\n * @function\r\n * @param {string} str The textual representation of the Long\r\n * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to signed\r\n * @param {number=} radix The radix in which the text is written (2-36), defaults to 10\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromString = fromString;\r\n\r\n/**\r\n * @function\r\n * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromValue(val, unsigned) {\r\n if (typeof val === 'number')\r\n return fromNumber(val, unsigned);\r\n if (typeof val === 'string')\r\n return fromString(val, unsigned);\r\n // Throws for non-objects, converts non-instanceof Long:\r\n return fromBits(val.low, val.high, typeof unsigned === 'boolean' ? unsigned : val.unsigned);\r\n}\r\n\r\n/**\r\n * Converts the specified value to a Long using the appropriate from* function for its type.\r\n * @function\r\n * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long}\r\n */\r\nLong.fromValue = fromValue;\r\n\r\n// NOTE: the compiler should inline these constant values below and then remove these variables, so there should be\r\n// no runtime penalty for these.\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_16_DBL = 1 << 16;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_24_DBL = 1 << 24;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;\r\n\r\n/**\r\n * @type {!Long}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar ZERO = fromInt(0);\r\n\r\n/**\r\n * Signed zero.\r\n * @type {!Long}\r\n */\r\nLong.ZERO = ZERO;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar UZERO = fromInt(0, true);\r\n\r\n/**\r\n * Unsigned zero.\r\n * @type {!Long}\r\n */\r\nLong.UZERO = UZERO;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar ONE = fromInt(1);\r\n\r\n/**\r\n * Signed one.\r\n * @type {!Long}\r\n */\r\nLong.ONE = ONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar UONE = fromInt(1, true);\r\n\r\n/**\r\n * Unsigned one.\r\n * @type {!Long}\r\n */\r\nLong.UONE = UONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar NEG_ONE = fromInt(-1);\r\n\r\n/**\r\n * Signed negative one.\r\n * @type {!Long}\r\n */\r\nLong.NEG_ONE = NEG_ONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MAX_VALUE = fromBits(0xFFFFFFFF|0, 0x7FFFFFFF|0, false);\r\n\r\n/**\r\n * Maximum signed value.\r\n * @type {!Long}\r\n */\r\nLong.MAX_VALUE = MAX_VALUE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF|0, 0xFFFFFFFF|0, true);\r\n\r\n/**\r\n * Maximum unsigned value.\r\n * @type {!Long}\r\n */\r\nLong.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MIN_VALUE = fromBits(0, 0x80000000|0, false);\r\n\r\n/**\r\n * Minimum signed value.\r\n * @type {!Long}\r\n */\r\nLong.MIN_VALUE = MIN_VALUE;\r\n\r\n/**\r\n * @alias Long.prototype\r\n * @inner\r\n */\r\nvar LongPrototype = Long.prototype;\r\n\r\n/**\r\n * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.\r\n * @returns {number}\r\n */\r\nLongPrototype.toInt = function toInt() {\r\n return this.unsigned ? this.low >>> 0 : this.low;\r\n};\r\n\r\n/**\r\n * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).\r\n * @returns {number}\r\n */\r\nLongPrototype.toNumber = function toNumber() {\r\n if (this.unsigned)\r\n return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0);\r\n return this.high * TWO_PWR_32_DBL + (this.low >>> 0);\r\n};\r\n\r\n/**\r\n * Converts the Long to a string written in the specified radix.\r\n * @param {number=} radix Radix (2-36), defaults to 10\r\n * @returns {string}\r\n * @override\r\n * @throws {RangeError} If `radix` is out of range\r\n */\r\nLongPrototype.toString = function toString(radix) {\r\n radix = radix || 10;\r\n if (radix < 2 || 36 < radix)\r\n throw RangeError('radix');\r\n if (this.isZero())\r\n return '0';\r\n if (this.isNegative()) { // Unsigned Longs are never negative\r\n if (this.eq(MIN_VALUE)) {\r\n // We need to change the Long value before it can be negated, so we remove\r\n // the bottom-most digit in this base and then recurse to do the rest.\r\n var radixLong = fromNumber(radix),\r\n div = this.div(radixLong),\r\n rem1 = div.mul(radixLong).sub(this);\r\n return div.toString(radix) + rem1.toInt().toString(radix);\r\n } else\r\n return '-' + this.neg().toString(radix);\r\n }\r\n\r\n // Do several (6) digits each time through the loop, so as to\r\n // minimize the calls to the very expensive emulated div.\r\n var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned),\r\n rem = this;\r\n var result = '';\r\n while (true) {\r\n var remDiv = rem.div(radixToPower),\r\n intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0,\r\n digits = intval.toString(radix);\r\n rem = remDiv;\r\n if (rem.isZero())\r\n return digits + result;\r\n else {\r\n while (digits.length < 6)\r\n digits = '0' + digits;\r\n result = '' + digits + result;\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Gets the high 32 bits as a signed integer.\r\n * @returns {number} Signed high bits\r\n */\r\nLongPrototype.getHighBits = function getHighBits() {\r\n return this.high;\r\n};\r\n\r\n/**\r\n * Gets the high 32 bits as an unsigned integer.\r\n * @returns {number} Unsigned high bits\r\n */\r\nLongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {\r\n return this.high >>> 0;\r\n};\r\n\r\n/**\r\n * Gets the low 32 bits as a signed integer.\r\n * @returns {number} Signed low bits\r\n */\r\nLongPrototype.getLowBits = function getLowBits() {\r\n return this.low;\r\n};\r\n\r\n/**\r\n * Gets the low 32 bits as an unsigned integer.\r\n * @returns {number} Unsigned low bits\r\n */\r\nLongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {\r\n return this.low >>> 0;\r\n};\r\n\r\n/**\r\n * Gets the number of bits needed to represent the absolute value of this Long.\r\n * @returns {number}\r\n */\r\nLongPrototype.getNumBitsAbs = function getNumBitsAbs() {\r\n if (this.isNegative()) // Unsigned Longs are never negative\r\n return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();\r\n var val = this.high != 0 ? this.high : this.low;\r\n for (var bit = 31; bit > 0; bit--)\r\n if ((val & (1 << bit)) != 0)\r\n break;\r\n return this.high != 0 ? bit + 33 : bit + 1;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals zero.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isZero = function isZero() {\r\n return this.high === 0 && this.low === 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals zero. This is an alias of {@link Long#isZero}.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.eqz = LongPrototype.isZero;\r\n\r\n/**\r\n * Tests if this Long's value is negative.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isNegative = function isNegative() {\r\n return !this.unsigned && this.high < 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is positive.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isPositive = function isPositive() {\r\n return this.unsigned || this.high >= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is odd.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isOdd = function isOdd() {\r\n return (this.low & 1) === 1;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is even.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isEven = function isEven() {\r\n return (this.low & 1) === 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.equals = function equals(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1)\r\n return false;\r\n return this.high === other.high && this.low === other.low;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.eq = LongPrototype.equals;\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.notEquals = function notEquals(other) {\r\n return !this.eq(/* validates */ other);\r\n};\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.neq = LongPrototype.notEquals;\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.ne = LongPrototype.notEquals;\r\n\r\n/**\r\n * Tests if this Long's value is less than the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lessThan = function lessThan(other) {\r\n return this.comp(/* validates */ other) < 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lt = LongPrototype.lessThan;\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {\r\n return this.comp(/* validates */ other) <= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lte = LongPrototype.lessThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.le = LongPrototype.lessThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is greater than the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.greaterThan = function greaterThan(other) {\r\n return this.comp(/* validates */ other) > 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.gt = LongPrototype.greaterThan;\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {\r\n return this.comp(/* validates */ other) >= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.gte = LongPrototype.greaterThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.ge = LongPrototype.greaterThanOrEqual;\r\n\r\n/**\r\n * Compares this Long's value with the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {number} 0 if they are the same, 1 if the this is greater and -1\r\n * if the given one is greater\r\n */\r\nLongPrototype.compare = function compare(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n if (this.eq(other))\r\n return 0;\r\n var thisNeg = this.isNegative(),\r\n otherNeg = other.isNegative();\r\n if (thisNeg && !otherNeg)\r\n return -1;\r\n if (!thisNeg && otherNeg)\r\n return 1;\r\n // At this point the sign bits are the same\r\n if (!this.unsigned)\r\n return this.sub(other).isNegative() ? -1 : 1;\r\n // Both are positive if at least one is unsigned\r\n return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1;\r\n};\r\n\r\n/**\r\n * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {number} 0 if they are the same, 1 if the this is greater and -1\r\n * if the given one is greater\r\n */\r\nLongPrototype.comp = LongPrototype.compare;\r\n\r\n/**\r\n * Negates this Long's value.\r\n * @returns {!Long} Negated Long\r\n */\r\nLongPrototype.negate = function negate() {\r\n if (!this.unsigned && this.eq(MIN_VALUE))\r\n return MIN_VALUE;\r\n return this.not().add(ONE);\r\n};\r\n\r\n/**\r\n * Negates this Long's value. This is an alias of {@link Long#negate}.\r\n * @function\r\n * @returns {!Long} Negated Long\r\n */\r\nLongPrototype.neg = LongPrototype.negate;\r\n\r\n/**\r\n * Returns the sum of this and the specified Long.\r\n * @param {!Long|number|string} addend Addend\r\n * @returns {!Long} Sum\r\n */\r\nLongPrototype.add = function add(addend) {\r\n if (!isLong(addend))\r\n addend = fromValue(addend);\r\n\r\n // Divide each number into 4 chunks of 16 bits, and then sum the chunks.\r\n\r\n var a48 = this.high >>> 16;\r\n var a32 = this.high & 0xFFFF;\r\n var a16 = this.low >>> 16;\r\n var a00 = this.low & 0xFFFF;\r\n\r\n var b48 = addend.high >>> 16;\r\n var b32 = addend.high & 0xFFFF;\r\n var b16 = addend.low >>> 16;\r\n var b00 = addend.low & 0xFFFF;\r\n\r\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\r\n c00 += a00 + b00;\r\n c16 += c00 >>> 16;\r\n c00 &= 0xFFFF;\r\n c16 += a16 + b16;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c32 += a32 + b32;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c48 += a48 + b48;\r\n c48 &= 0xFFFF;\r\n return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the difference of this and the specified Long.\r\n * @param {!Long|number|string} subtrahend Subtrahend\r\n * @returns {!Long} Difference\r\n */\r\nLongPrototype.subtract = function subtract(subtrahend) {\r\n if (!isLong(subtrahend))\r\n subtrahend = fromValue(subtrahend);\r\n return this.add(subtrahend.neg());\r\n};\r\n\r\n/**\r\n * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.\r\n * @function\r\n * @param {!Long|number|string} subtrahend Subtrahend\r\n * @returns {!Long} Difference\r\n */\r\nLongPrototype.sub = LongPrototype.subtract;\r\n\r\n/**\r\n * Returns the product of this and the specified Long.\r\n * @param {!Long|number|string} multiplier Multiplier\r\n * @returns {!Long} Product\r\n */\r\nLongPrototype.multiply = function multiply(multiplier) {\r\n if (this.isZero())\r\n return ZERO;\r\n if (!isLong(multiplier))\r\n multiplier = fromValue(multiplier);\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n var low = wasm.mul(this.low,\r\n this.high,\r\n multiplier.low,\r\n multiplier.high);\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n if (multiplier.isZero())\r\n return ZERO;\r\n if (this.eq(MIN_VALUE))\r\n return multiplier.isOdd() ? MIN_VALUE : ZERO;\r\n if (multiplier.eq(MIN_VALUE))\r\n return this.isOdd() ? MIN_VALUE : ZERO;\r\n\r\n if (this.isNegative()) {\r\n if (multiplier.isNegative())\r\n return this.neg().mul(multiplier.neg());\r\n else\r\n return this.neg().mul(multiplier).neg();\r\n } else if (multiplier.isNegative())\r\n return this.mul(multiplier.neg()).neg();\r\n\r\n // If both longs are small, use float multiplication\r\n if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))\r\n return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);\r\n\r\n // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.\r\n // We can skip products that would overflow.\r\n\r\n var a48 = this.high >>> 16;\r\n var a32 = this.high & 0xFFFF;\r\n var a16 = this.low >>> 16;\r\n var a00 = this.low & 0xFFFF;\r\n\r\n var b48 = multiplier.high >>> 16;\r\n var b32 = multiplier.high & 0xFFFF;\r\n var b16 = multiplier.low >>> 16;\r\n var b00 = multiplier.low & 0xFFFF;\r\n\r\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\r\n c00 += a00 * b00;\r\n c16 += c00 >>> 16;\r\n c00 &= 0xFFFF;\r\n c16 += a16 * b00;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c16 += a00 * b16;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c32 += a32 * b00;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c32 += a16 * b16;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c32 += a00 * b32;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;\r\n c48 &= 0xFFFF;\r\n return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.\r\n * @function\r\n * @param {!Long|number|string} multiplier Multiplier\r\n * @returns {!Long} Product\r\n */\r\nLongPrototype.mul = LongPrototype.multiply;\r\n\r\n/**\r\n * Returns this Long divided by the specified. The result is signed if this Long is signed or\r\n * unsigned if this Long is unsigned.\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Quotient\r\n */\r\nLongPrototype.divide = function divide(divisor) {\r\n if (!isLong(divisor))\r\n divisor = fromValue(divisor);\r\n if (divisor.isZero())\r\n throw Error('division by zero');\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n // guard against signed division overflow: the largest\r\n // negative number / -1 would be 1 larger than the largest\r\n // positive number, due to two's complement.\r\n if (!this.unsigned &&\r\n this.high === -0x80000000 &&\r\n divisor.low === -1 && divisor.high === -1) {\r\n // be consistent with non-wasm code path\r\n return this;\r\n }\r\n var low = (this.unsigned ? wasm.div_u : wasm.div_s)(\r\n this.low,\r\n this.high,\r\n divisor.low,\r\n divisor.high\r\n );\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n if (this.isZero())\r\n return this.unsigned ? UZERO : ZERO;\r\n var approx, rem, res;\r\n if (!this.unsigned) {\r\n // This section is only relevant for signed longs and is derived from the\r\n // closure library as a whole.\r\n if (this.eq(MIN_VALUE)) {\r\n if (divisor.eq(ONE) || divisor.eq(NEG_ONE))\r\n return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE\r\n else if (divisor.eq(MIN_VALUE))\r\n return ONE;\r\n else {\r\n // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.\r\n var halfThis = this.shr(1);\r\n approx = halfThis.div(divisor).shl(1);\r\n if (approx.eq(ZERO)) {\r\n return divisor.isNegative() ? ONE : NEG_ONE;\r\n } else {\r\n rem = this.sub(divisor.mul(approx));\r\n res = approx.add(rem.div(divisor));\r\n return res;\r\n }\r\n }\r\n } else if (divisor.eq(MIN_VALUE))\r\n return this.unsigned ? UZERO : ZERO;\r\n if (this.isNegative()) {\r\n if (divisor.isNegative())\r\n return this.neg().div(divisor.neg());\r\n return this.neg().div(divisor).neg();\r\n } else if (divisor.isNegative())\r\n return this.div(divisor.neg()).neg();\r\n res = ZERO;\r\n } else {\r\n // The algorithm below has not been made for unsigned longs. It's therefore\r\n // required to take special care of the MSB prior to running it.\r\n if (!divisor.unsigned)\r\n divisor = divisor.toUnsigned();\r\n if (divisor.gt(this))\r\n return UZERO;\r\n if (divisor.gt(this.shru(1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true\r\n return UONE;\r\n res = UZERO;\r\n }\r\n\r\n // Repeat the following until the remainder is less than other: find a\r\n // floating-point that approximates remainder / other *from below*, add this\r\n // into the result, and subtract it from the remainder. It is critical that\r\n // the approximate value is less than or equal to the real value so that the\r\n // remainder never becomes negative.\r\n rem = this;\r\n while (rem.gte(divisor)) {\r\n // Approximate the result of division. This may be a little greater or\r\n // smaller than the actual value.\r\n approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));\r\n\r\n // We will tweak the approximate result by changing it in the 48-th digit or\r\n // the smallest non-fractional digit, whichever is larger.\r\n var log2 = Math.ceil(Math.log(approx) / Math.LN2),\r\n delta = (log2 <= 48) ? 1 : pow_dbl(2, log2 - 48),\r\n\r\n // Decrease the approximation until it is smaller than the remainder. Note\r\n // that if it is too large, the product overflows and is negative.\r\n approxRes = fromNumber(approx),\r\n approxRem = approxRes.mul(divisor);\r\n while (approxRem.isNegative() || approxRem.gt(rem)) {\r\n approx -= delta;\r\n approxRes = fromNumber(approx, this.unsigned);\r\n approxRem = approxRes.mul(divisor);\r\n }\r\n\r\n // We know the answer can't be zero... and actually, zero would cause\r\n // infinite recursion since we would make no progress.\r\n if (approxRes.isZero())\r\n approxRes = ONE;\r\n\r\n res = res.add(approxRes);\r\n rem = rem.sub(approxRem);\r\n }\r\n return res;\r\n};\r\n\r\n/**\r\n * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Quotient\r\n */\r\nLongPrototype.div = LongPrototype.divide;\r\n\r\n/**\r\n * Returns this Long modulo the specified.\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.modulo = function modulo(divisor) {\r\n if (!isLong(divisor))\r\n divisor = fromValue(divisor);\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n var low = (this.unsigned ? wasm.rem_u : wasm.rem_s)(\r\n this.low,\r\n this.high,\r\n divisor.low,\r\n divisor.high\r\n );\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n return this.sub(this.div(divisor).mul(divisor));\r\n};\r\n\r\n/**\r\n * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.mod = LongPrototype.modulo;\r\n\r\n/**\r\n * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.rem = LongPrototype.modulo;\r\n\r\n/**\r\n * Returns the bitwise NOT of this Long.\r\n * @returns {!Long}\r\n */\r\nLongPrototype.not = function not() {\r\n return fromBits(~this.low, ~this.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise AND of this Long and the specified.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.and = function and(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low & other.low, this.high & other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise OR of this Long and the specified.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.or = function or(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low | other.low, this.high | other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise XOR of this Long and the given one.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.xor = function xor(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits shifted to the left by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftLeft = function shiftLeft(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n if ((numBits &= 63) === 0)\r\n return this;\r\n else if (numBits < 32)\r\n return fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);\r\n else\r\n return fromBits(0, this.low << (numBits - 32), this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shl = LongPrototype.shiftLeft;\r\n\r\n/**\r\n * Returns this Long with bits arithmetically shifted to the right by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftRight = function shiftRight(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n if ((numBits &= 63) === 0)\r\n return this;\r\n else if (numBits < 32)\r\n return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);\r\n else\r\n return fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shr = LongPrototype.shiftRight;\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n numBits &= 63;\r\n if (numBits === 0)\r\n return this;\r\n else {\r\n var high = this.high;\r\n if (numBits < 32) {\r\n var low = this.low;\r\n return fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned);\r\n } else if (numBits === 32)\r\n return fromBits(high, 0, this.unsigned);\r\n else\r\n return fromBits(high >>> (numBits - 32), 0, this.unsigned);\r\n }\r\n};\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shru = LongPrototype.shiftRightUnsigned;\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shr_u = LongPrototype.shiftRightUnsigned;\r\n\r\n/**\r\n * Converts this Long to signed.\r\n * @returns {!Long} Signed long\r\n */\r\nLongPrototype.toSigned = function toSigned() {\r\n if (!this.unsigned)\r\n return this;\r\n return fromBits(this.low, this.high, false);\r\n};\r\n\r\n/**\r\n * Converts this Long to unsigned.\r\n * @returns {!Long} Unsigned long\r\n */\r\nLongPrototype.toUnsigned = function toUnsigned() {\r\n if (this.unsigned)\r\n return this;\r\n return fromBits(this.low, this.high, true);\r\n};\r\n\r\n/**\r\n * Converts this Long to its byte representation.\r\n * @param {boolean=} le Whether little or big endian, defaults to big endian\r\n * @returns {!Array.} Byte representation\r\n */\r\nLongPrototype.toBytes = function toBytes(le) {\r\n return le ? this.toBytesLE() : this.toBytesBE();\r\n};\r\n\r\n/**\r\n * Converts this Long to its little endian byte representation.\r\n * @returns {!Array.} Little endian byte representation\r\n */\r\nLongPrototype.toBytesLE = function toBytesLE() {\r\n var hi = this.high,\r\n lo = this.low;\r\n return [\r\n lo & 0xff,\r\n lo >>> 8 & 0xff,\r\n lo >>> 16 & 0xff,\r\n lo >>> 24 ,\r\n hi & 0xff,\r\n hi >>> 8 & 0xff,\r\n hi >>> 16 & 0xff,\r\n hi >>> 24\r\n ];\r\n};\r\n\r\n/**\r\n * Converts this Long to its big endian byte representation.\r\n * @returns {!Array.} Big endian byte representation\r\n */\r\nLongPrototype.toBytesBE = function toBytesBE() {\r\n var hi = this.high,\r\n lo = this.low;\r\n return [\r\n hi >>> 24 ,\r\n hi >>> 16 & 0xff,\r\n hi >>> 8 & 0xff,\r\n hi & 0xff,\r\n lo >>> 24 ,\r\n lo >>> 16 & 0xff,\r\n lo >>> 8 & 0xff,\r\n lo & 0xff\r\n ];\r\n};\r\n\r\n/**\r\n * Creates a Long from its byte representation.\r\n * @param {!Array.} bytes Byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @param {boolean=} le Whether little or big endian, defaults to big endian\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytes = function fromBytes(bytes, unsigned, le) {\r\n return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned);\r\n};\r\n\r\n/**\r\n * Creates a Long from its little endian byte representation.\r\n * @param {!Array.} bytes Little endian byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytesLE = function fromBytesLE(bytes, unsigned) {\r\n return new Long(\r\n bytes[0] |\r\n bytes[1] << 8 |\r\n bytes[2] << 16 |\r\n bytes[3] << 24,\r\n bytes[4] |\r\n bytes[5] << 8 |\r\n bytes[6] << 16 |\r\n bytes[7] << 24,\r\n unsigned\r\n );\r\n};\r\n\r\n/**\r\n * Creates a Long from its big endian byte representation.\r\n * @param {!Array.} bytes Big endian byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytesBE = function fromBytesBE(bytes, unsigned) {\r\n return new Long(\r\n bytes[4] << 24 |\r\n bytes[5] << 16 |\r\n bytes[6] << 8 |\r\n bytes[7],\r\n bytes[0] << 24 |\r\n bytes[1] << 16 |\r\n bytes[2] << 8 |\r\n bytes[3],\r\n unsigned\r\n );\r\n};\r\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n// Workaround for allowing cjs module to be included in bundle created by\n// rollup.\nimport * as LongExports from 'long';\n// tslint:disable-next-line\nconst Long: LongExports.LongConstructor =\n // tslint:disable-next-line\n (LongExports as any).default || LongExports;\n\nexport function hexToLong(hex: string): Long {\n return Long.fromString(hex, true, 16);\n}\n\n// Some primes between 2^63 and 2^64 for various uses.\n// Hex 0xc3a5c85c97cb3127\nconst k0: Long = hexToLong('c3a5c85c97cb3127');\n// Hex 0xb492b66fbe98f273\nconst k1: Long = hexToLong('b492b66fbe98f273');\n// Hex 0x9ae16a3b2f90404f\nconst k2: Long = hexToLong('9ae16a3b2f90404f');\n\nfunction shiftMix(val: Long): Long {\n return val.xor(val.shru(47));\n}\n\nfunction fetch(s: Uint8Array, offset: number, numBytes: number): Long {\n const bytes = s.slice(offset, offset + numBytes);\n return Long.fromBytes(Array.from(bytes), true, true);\n}\n\nfunction fetch64(s: Uint8Array, offset: number): Long {\n return fetch(s, offset, 8);\n}\n\nfunction fetch32(s: Uint8Array, offset: number): Long {\n return fetch(s, offset, 4);\n}\n\nfunction rotate64(val: Long, shift: number): Long {\n // Avoid shifting by 64: doing so yields an undefined result.\n return shift === 0 ? val : val.shru(shift).or(val.shl(64 - shift));\n}\n\nfunction hashLen16(u: Long, v: Long, mul = hexToLong('9ddfea08eb382d69')) {\n // Murmur-inspired hashing.\n let a = u.xor(v).mul(mul);\n a = a.xor(a.shru(47));\n let b = v.xor(a).mul(mul);\n b = b.xor(b.shru(47));\n b = b.mul(mul);\n return b;\n}\n\n// Return a 16-byte hash for 48 bytes. Quick and dirty.\n// Callers do best to use \"random-looking\" values for a and b.\nfunction weakHashLen32WithSeeds(\n w: Long, x: Long, y: Long, z: Long, a: Long, b: Long) {\n a = a.add(w);\n b = rotate64(b.add(a).add(z), 21);\n const c = a;\n a = a.add(x);\n a = a.add(y);\n b = b.add(rotate64(a, 44));\n return [a.add(z), b.add(c)];\n}\n\nfunction weakHashLen32WithSeedsStr(\n s: Uint8Array, offset: number, a: Long, b: Long) {\n return weakHashLen32WithSeeds(\n fetch64(s, offset), fetch64(s, offset + 8), fetch64(s, offset + 16),\n fetch64(s, offset + 24), a, b);\n}\n\nfunction hashLen0to16(s: Uint8Array, len = s.length): Long {\n if (len >= 8) {\n const mul = k2.add(len * 2);\n const a = fetch64(s, 0).add(k2);\n const b = fetch64(s, len - 8);\n const c = rotate64(b, 37).mul(mul).add(a);\n const d = rotate64(a, 25).add(b).mul(mul);\n return hashLen16(c, d, mul);\n }\n if (len >= 4) {\n const mul = k2.add(len * 2);\n const a = fetch32(s, 0);\n return hashLen16(a.shl(3).add(len), fetch32(s, len - 4), mul);\n }\n if (len > 0) {\n const a = s[0];\n const b = s[len >> 1];\n const c = s[len - 1];\n const y = a + (b << 8);\n const z = len + (c << 2);\n return shiftMix(k2.mul(y).xor(k0.mul(z))).mul(k2);\n }\n return k2;\n}\n\nfunction hashLen17to32(s: Uint8Array, len = s.length): Long {\n const mul = k2.add(len * 2);\n const a = fetch64(s, 0).mul(k1);\n const b = fetch64(s, 8);\n const c = fetch64(s, len - 8).mul(mul);\n const d = fetch64(s, len - 16).mul(k2);\n return hashLen16(\n rotate64(a.add(b), 43).add(rotate64(c, 30)).add(d),\n a.add(rotate64(b.add(k2), 18)).add(c), mul);\n}\n\nfunction hashLen33to64(s: Uint8Array, len = s.length): Long {\n const mul = k2.add(len * 2);\n const a = fetch64(s, 0).mul(k2);\n const b = fetch64(s, 8);\n const c = fetch64(s, len - 8).mul(mul);\n const d = fetch64(s, len - 16).mul(k2);\n const y = rotate64(a.add(b), 43).add(rotate64(c, 30)).add(d);\n const z = hashLen16(y, a.add(rotate64(b.add(k2), 18)).add(c), mul);\n const e = fetch64(s, 16).mul(mul);\n const f = fetch64(s, 24);\n const g = y.add(fetch64(s, len - 32)).mul(mul);\n const h = z.add(fetch64(s, len - 24)).mul(mul);\n return hashLen16(\n rotate64(e.add(f), 43).add(rotate64(g, 30)).add(h),\n e.add(rotate64(f.add(a), 18)).add(g), mul);\n}\n\nexport function fingerPrint64(s: Uint8Array, len = s.length): Long {\n const seed: Long = Long.fromNumber(81, true);\n if (len <= 32) {\n if (len <= 16) {\n return hashLen0to16(s, len);\n } else {\n return hashLen17to32(s, len);\n }\n } else if (len <= 64) {\n return hashLen33to64(s, len);\n }\n\n // For strings over 64 bytes we loop. Internal state consists of\n // 56 bytes: v, w, x, y, and z.\n let x = seed;\n let y = seed.mul(k1).add(113);\n\n let z = shiftMix(y.mul(k2).add(113)).mul(k2);\n let v = [Long.UZERO, Long.UZERO];\n let w = [Long.UZERO, Long.UZERO];\n x = x.mul(k2).add(fetch64(s, 0));\n\n let offset = 0;\n // Set end so that after the loop we have 1 to 64 bytes left to process.\n const end = ((len - 1) >> 6) * 64;\n const last64 = end + ((len - 1) & 63) - 63;\n\n do {\n x = rotate64(x.add(y).add(v[0]).add(fetch64(s, offset + 8)), 37).mul(k1);\n y = rotate64(y.add(v[1]).add(fetch64(s, offset + 48)), 42).mul(k1);\n x = x.xor(w[1]);\n y = y.add(v[0]).add(fetch64(s, offset + 40));\n z = rotate64(z.add(w[0]), 33).mul(k1);\n v = weakHashLen32WithSeedsStr(s, offset, v[1].mul(k1), x.add(w[0]));\n w = weakHashLen32WithSeedsStr(\n s, offset + 32, z.add(w[1]), y.add(fetch64(s, offset + 16)));\n\n [z, x] = [x, z];\n offset += 64;\n } while (offset !== end);\n const mul = k1.add(z.and(0xff).shl(1));\n // Point to the last 64 bytes of input.\n offset = last64;\n\n w[0] = w[0].add((len - 1) & 63);\n v[0] = v[0].add(w[0]);\n w[0] = w[0].add(v[0]);\n\n x = rotate64(x.add(y).add(v[0]).add(fetch64(s, offset + 8)), 37).mul(mul);\n y = rotate64(y.add(v[1]).add(fetch64(s, offset + 48)), 42).mul(mul);\n x = x.xor(w[1].mul(9));\n y = y.add(v[0].mul(9).add(fetch64(s, offset + 40)));\n z = rotate64(z.add(w[0]), 33).mul(mul);\n v = weakHashLen32WithSeedsStr(s, offset, v[1].mul(mul), x.add(w[0]));\n w = weakHashLen32WithSeedsStr(\n s, offset + 32, z.add(w[1]), y.add(fetch64(s, offset + 16)));\n\n [z, x] = [x, z];\n\n return hashLen16(\n hashLen16(v[0], w[0], mul).add(shiftMix(y).mul(k0)).add(z),\n hashLen16(v[1], w[1], mul).add(x), mul);\n}\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env} from './environment';\nimport {BackendValues, DataType, TensorLike, TypedArray} from './types';\nimport * as base from './util_base';\nexport * from './util_base';\nexport * from './hash_util';\n\n/**\n * Create typed array for scalar value. Used for storing in `DataStorage`.\n */\nexport function createScalarValue(\n value: DataType, dtype: DataType): BackendValues {\n if (dtype === 'string') {\n return encodeString(value);\n }\n\n return toTypedArray([value], dtype);\n}\n\nfunction noConversionNeeded(a: TensorLike, dtype: DataType): boolean {\n return (a instanceof Float32Array && dtype === 'float32') ||\n (a instanceof Int32Array && dtype === 'int32') ||\n (a instanceof Uint8Array && dtype === 'bool');\n}\n\nexport function toTypedArray(a: TensorLike, dtype: DataType): TypedArray {\n if (dtype === 'string') {\n throw new Error('Cannot convert a string[] to a TypedArray');\n }\n if (Array.isArray(a)) {\n a = base.flatten(a);\n }\n\n if (env().getBool('DEBUG')) {\n base.checkConversionForErrors(a as number[], dtype);\n }\n if (noConversionNeeded(a, dtype)) {\n return a as TypedArray;\n }\n if (dtype == null || dtype === 'float32' || dtype === 'complex64') {\n return new Float32Array(a as number[]);\n } else if (dtype === 'int32') {\n return new Int32Array(a as number[]);\n } else if (dtype === 'bool') {\n const bool = new Uint8Array((a as number[]).length);\n for (let i = 0; i < bool.length; ++i) {\n if (Math.round((a as number[])[i]) !== 0) {\n bool[i] = 1;\n }\n }\n return bool;\n } else {\n throw new Error(`Unknown data type ${dtype}`);\n }\n}\n\n/**\n * Returns the current high-resolution time in milliseconds relative to an\n * arbitrary time in the past. It works across different platforms (node.js,\n * browsers).\n *\n * ```js\n * console.log(tf.util.now());\n * ```\n *\n * @doc {heading: 'Util', namespace: 'util'}\n */\nexport function now(): number {\n return env().platform.now();\n}\n\n/**\n * Returns a platform-specific implementation of\n * [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API).\n *\n * If `fetch` is defined on the global object (`window`, `process`, etc.),\n * `tf.util.fetch` returns that function.\n *\n * If not, `tf.util.fetch` returns a platform-specific solution.\n *\n * ```js\n * const resource = await tf.util.fetch('https://unpkg.com/@tensorflow/tfjs');\n * // handle response\n * ```\n *\n * @doc {heading: 'Util'}\n */\nexport function fetch(\n path: string, requestInits?: RequestInit): Promise {\n return env().platform.fetch(path, requestInits);\n}\n\n/**\n * Encodes the provided string into bytes using the provided encoding scheme.\n *\n * @param s The string to encode.\n * @param encoding The encoding scheme. Defaults to utf-8.\n *\n * @doc {heading: 'Util'}\n */\nexport function encodeString(s: string, encoding = 'utf-8'): Uint8Array {\n encoding = encoding || 'utf-8';\n return env().platform.encode(s, encoding);\n}\n\n/**\n * Decodes the provided bytes into a string using the provided encoding scheme.\n * @param bytes The bytes to decode.\n *\n * @param encoding The encoding scheme. Defaults to utf-8.\n *\n * @doc {heading: 'Util'}\n */\nexport function decodeString(bytes: Uint8Array, encoding = 'utf-8'): string {\n encoding = encoding || 'utf-8';\n return env().platform.decode(bytes, encoding);\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {BackendTimer, BackendTimingInfo} from './backends/backend';\nimport {env} from './environment';\nimport {Tensor} from './tensor';\nimport {NamedTensorMap} from './tensor_types';\nimport {DataType, DataTypeMap, TypedArray} from './types';\nimport * as util from './util';\n\nexport type KernelProfile = {\n kernelName: string,\n outputs: Tensor[],\n inputs: NamedTensorMap,\n timeMs: Promise,\n extraInfo: Promise\n};\n\nexport class Profiler {\n constructor(private backendTimer: BackendTimer, private logger?: Logger) {\n if (logger == null) {\n this.logger = new Logger();\n }\n }\n\n profileKernel(kernelName: string, inputs: NamedTensorMap, f: () => Tensor[]):\n KernelProfile {\n let outputs: Tensor[];\n const holdResultWrapperFn = () => {\n outputs = f();\n };\n let timer: Promise;\n const start = util.now();\n if (this.backendTimer.timerAvailable()) {\n timer = this.backendTimer.time(holdResultWrapperFn);\n } else {\n holdResultWrapperFn();\n for (const output of outputs) {\n output.dataSync();\n }\n timer = Promise.resolve({kernelMs: util.now() - start});\n }\n if (env().getBool('CHECK_COMPUTATION_FOR_ERRORS')) {\n for (let i = 0; i < outputs.length; i++) {\n const output = outputs[i];\n // Dangling promise here because we don't want to propagate up\n // asynchronicity.\n output.data().then(tensorVals => {\n checkComputationForErrors(tensorVals, output.dtype, kernelName);\n });\n }\n }\n\n const kernelProfile = {\n kernelName,\n outputs,\n inputs,\n timeMs: timer.then(timing => timing.kernelMs),\n extraInfo: timer.then(\n timing => timing.getExtraProfileInfo != null ?\n timing.getExtraProfileInfo() :\n '')\n };\n return kernelProfile;\n }\n\n logKernelProfile(kernelProfile: KernelProfile): void {\n const {kernelName, outputs, timeMs, inputs, extraInfo} = kernelProfile;\n\n outputs.forEach(result => {\n Promise.all([result.data(), timeMs, extraInfo]).then(valueContainer => {\n this.logger.logKernelProfile(\n kernelName, result, valueContainer[0], valueContainer[1], inputs,\n valueContainer[2]);\n });\n });\n }\n}\n\nexport function checkComputationForErrors(\n vals: DataTypeMap[D], dtype: D, kernelName: string): boolean {\n if (dtype !== 'float32') {\n // Only floating point computations will generate NaN values\n return false;\n }\n for (let i = 0; i < vals.length; i++) {\n const num = vals[i] as number;\n if (isNaN(num) || !isFinite(num)) {\n // Throwing custom exception so behavior is testable.\n console.warn(`Found ${num} in the result of '${kernelName}'`);\n return true;\n }\n }\n return false;\n}\n\nexport class Logger {\n logKernelProfile(\n name: string, result: Tensor, vals: TypedArray,\n timeMs: number|{error: string}, inputs: NamedTensorMap,\n extraInfo?: string) {\n const time = typeof timeMs === 'number' ? util.rightPad(`${timeMs}ms`, 9) :\n timeMs['error'];\n const paddedName = util.rightPad(name, 25);\n const rank = result.rank;\n const size = result.size;\n const shape = util.rightPad(result.shape.toString(), 14);\n let inputShapesDescription = '';\n\n for (const name in inputs) {\n const input = inputs[name];\n if (input != null) {\n // The input might be a non-tensor (e.g HTMLImageElement), in which case\n // we claim the output shape as input shape.\n const inputShape = input.shape || result.shape;\n const inputRank = inputShape.length;\n inputShapesDescription +=\n `${name}: ${inputRank}D ${inputRank > 0 ? inputShape : ''} `;\n }\n }\n\n console.log(\n `%c${paddedName}\\t%c${time}\\t%c${rank}D ${shape}\\t%c${size}\\t%c${\n inputShapesDescription}\\t%c${extraInfo}`,\n 'font-weight:bold', 'color:red', 'color:blue', 'color: orange',\n 'color: green', 'color: steelblue');\n }\n}\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from './tensor';\nimport {NamedTensorMap} from './tensor_types';\nimport * as util from './util';\n\nexport interface TapeNode {\n id: number;\n kernelName: string;\n outputs: Tensor[];\n inputs: NamedTensorMap;\n // Optional params, defined only for ops with gradient impl.\n gradient?: (dys: Tensor[]) => NamedGradientMap;\n saved?: Tensor[];\n}\n\nexport type NamedGradientMap = {\n [inputName: string]: () => Tensor;\n};\n\n/**\n * Computes a list of TapeNodes that connect x to y, filtering everything else\n * out and preserving the order of the original tape elements.\n *\n * @param tape The tape elements to filter.\n * @param xs The input Tensors.\n * @param y The output Tensor.\n */\nexport function getFilteredNodesXToY(\n tape: TapeNode[], xs: Tensor[], y: Tensor): TapeNode[] {\n // Forward pass to compute all the nodes and Tensors that are transitively a\n // function of x.\n const tensorsFromX: {[tensorId: number]: boolean} = {};\n const nodesFromX: {[nodeId: number]: boolean} = {};\n for (let i = 0; i < xs.length; i++) {\n tensorsFromX[xs[i].id] = true;\n }\n\n for (let i = 0; i < tape.length; i++) {\n const node = tape[i];\n const nodeInputs = node.inputs;\n for (const inputName in nodeInputs) {\n const input = nodeInputs[inputName];\n\n let anyInputFromX = false;\n for (let j = 0; j < xs.length; j++) {\n if (tensorsFromX[input.id]) {\n node.outputs.forEach(output => tensorsFromX[output.id] = true);\n anyInputFromX = true;\n nodesFromX[node.id] = true;\n break;\n }\n }\n\n if (anyInputFromX) {\n break;\n }\n }\n }\n\n // Backward pass to find all of the nodes and Tensors that lead to y.\n const tensorsLeadToY: {[tensorId: number]: boolean} = {};\n tensorsLeadToY[y.id] = true;\n const nodesToY: {[nodeId: number]: boolean} = {};\n\n for (let i = tape.length - 1; i >= 0; i--) {\n const node = tape[i];\n const nodeInputs = node.inputs;\n\n // If any of the outputs lead to y, mark all of the inputs as leading to y.\n for (let j = 0; j < node.outputs.length; j++) {\n if (tensorsLeadToY[node.outputs[j].id]) {\n for (const inputName in nodeInputs) {\n tensorsLeadToY[nodeInputs[inputName].id] = true;\n nodesToY[node.id] = true;\n }\n break;\n }\n }\n }\n\n // Return the paths that come from x and lead to y.\n const filteredTape: TapeNode[] = [];\n for (let i = 0; i < tape.length; i++) {\n const node = tape[i];\n\n if (nodesFromX[node.id] && nodesToY[node.id]) {\n // Prune the inputs from the node that aren't a function of x.\n const prunedInputs: {[inputName: string]: Tensor} = {};\n for (const inputName in node.inputs) {\n const nodeInput = node.inputs[inputName];\n if (tensorsFromX[nodeInput.id]) {\n prunedInputs[inputName] = nodeInput;\n }\n }\n\n // Copy the node and overwrite inputsAndArgs to the pruned version.\n const prunedNode = Object.assign({}, node);\n prunedNode.inputs = prunedInputs;\n prunedNode.outputs = node.outputs;\n\n filteredTape.push(prunedNode);\n }\n }\n\n return filteredTape;\n}\n\n/**\n * Backpropagate gradients through the filtered TapeNodes.\n *\n * @param tensorAccumulatedGradientMap A map of Tensor to its gradient. This map\n * is mutated by this method.\n * @param filteredTape The filtered TapeNodes to backprop through.\n */\nexport function backpropagateGradients(\n tensorAccumulatedGradientMap: {[tensorId: number]: Tensor},\n filteredTape: TapeNode[], tidy: (f: Function) => Tensor,\n add: (a: Tensor, b: Tensor) => Tensor) {\n // Walk the tape backward and keep a map of Tensor to its gradient.\n for (let i = filteredTape.length - 1; i >= 0; i--) {\n const node = filteredTape[i];\n\n const dys: Tensor[] = [];\n node.outputs.forEach(o => {\n const gradTensor = tensorAccumulatedGradientMap[o.id];\n if (gradTensor != null) {\n dys.push(gradTensor);\n } else {\n // This particular output is not in the back-propagation subgraph, so it\n // does not affect the final output, thus we put null for its dy.\n dys.push(null);\n }\n });\n\n if (node.gradient == null) {\n throw new Error(\n `Cannot compute gradient: gradient function not found ` +\n `for ${node.kernelName}.`);\n }\n\n // Backprop dy through this node and accumulate gradients over the inputs.\n const inputGradients = node.gradient(dys);\n\n for (const inputName in node.inputs) {\n if (!(inputName in inputGradients)) {\n throw new Error(\n `Cannot backprop through input ${inputName}. ` +\n `Available gradients found: ${Object.keys(inputGradients)}.`);\n }\n\n // Call the gradient function.\n const dx = tidy(() => inputGradients[inputName]());\n if (dx.dtype !== 'float32') {\n throw new Error(\n `Error in gradient for op ${\n node.kernelName}. The gradient of input ` +\n `${inputName} must have 'float32' dtype, but has '${dx.dtype}'`);\n }\n const x = node.inputs[inputName];\n if (!util.arraysEqual(dx.shape, x.shape)) {\n throw new Error(\n `Error in gradient for op ${\n node.kernelName}. The gradient of input ` +\n `'${inputName}' has shape '${dx.shape}', which does not match ` +\n `the shape of the input '${x.shape}'`);\n }\n\n if (tensorAccumulatedGradientMap[x.id] == null) {\n tensorAccumulatedGradientMap[x.id] = dx;\n } else {\n const curGradient = tensorAccumulatedGradientMap[x.id];\n tensorAccumulatedGradientMap[x.id] = add(curGradient, dx);\n curGradient.dispose();\n }\n }\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataType, TypedArray} from './types';\nimport {computeStrides, isString, rightPad, sizeFromShape} from './util';\n\n// Maximum number of values before we decide to show ellipsis.\nconst FORMAT_LIMIT_NUM_VALS = 20;\n// Number of first and last values to show when displaying a, b,...,y, z.\nconst FORMAT_NUM_FIRST_LAST_VALS = 3;\n// Number of significant digits to show.\nconst FORMAT_NUM_SIG_DIGITS = 7;\n\nexport function tensorToString(\n vals: TypedArray|string[], shape: number[], dtype: DataType,\n verbose: boolean) {\n const strides = computeStrides(shape);\n const padPerCol = computeMaxSizePerColumn(vals, shape, dtype, strides);\n const rank = shape.length;\n const valsLines = subTensorToString(vals, shape, dtype, strides, padPerCol);\n const lines = ['Tensor'];\n if (verbose) {\n lines.push(` dtype: ${dtype}`);\n lines.push(` rank: ${rank}`);\n lines.push(` shape: [${shape}]`);\n lines.push(` values:`);\n }\n lines.push(valsLines.map(l => ' ' + l).join('\\n'));\n return lines.join('\\n');\n}\n\nfunction computeMaxSizePerColumn(\n vals: TypedArray|string[], shape: number[], dtype: DataType,\n strides: number[]): number[] {\n const n = sizeFromShape(shape);\n const numCols = strides[strides.length - 1];\n const padPerCol = new Array(numCols).fill(0);\n const rank = shape.length;\n const valuesOrTuples =\n dtype === 'complex64' ? createComplexTuples(vals) : vals;\n\n if (rank > 1) {\n for (let row = 0; row < n / numCols; row++) {\n const offset = row * numCols;\n for (let j = 0; j < numCols; j++) {\n padPerCol[j] = Math.max(\n padPerCol[j],\n valToString(valuesOrTuples[offset + j], 0, dtype).length);\n }\n }\n }\n return padPerCol;\n}\n\nfunction valToString(\n val: number|string|[number, number], pad: number, dtype: DataType) {\n let valStr: string;\n if (Array.isArray(val)) {\n valStr = `${parseFloat(val[0].toFixed(FORMAT_NUM_SIG_DIGITS))} + ` +\n `${parseFloat(val[1].toFixed(FORMAT_NUM_SIG_DIGITS))}j`;\n } else if (isString(val)) {\n valStr = `'${val}'`;\n } else if (dtype === 'bool') {\n valStr = boolNumToString(val);\n } else {\n valStr = parseFloat(val.toFixed(FORMAT_NUM_SIG_DIGITS)).toString();\n }\n\n return rightPad(valStr, pad);\n}\n\nfunction boolNumToString(v: number): string {\n return v === 0 ? 'false' : 'true';\n}\n\nfunction subTensorToString(\n vals: TypedArray|string[], shape: number[], dtype: DataType,\n strides: number[], padPerCol: number[], isLast = true): string[] {\n const storagePerElement = dtype === 'complex64' ? 2 : 1;\n\n const size = shape[0];\n const rank = shape.length;\n if (rank === 0) {\n if (dtype === 'complex64') {\n const complexTuple = createComplexTuples(vals);\n return [valToString(complexTuple[0], 0, dtype)];\n }\n if (dtype === 'bool') {\n return [boolNumToString(vals[0] as number)];\n }\n return [vals[0].toString()];\n }\n\n if (rank === 1) {\n if (size > FORMAT_LIMIT_NUM_VALS) {\n const firstValsSize = FORMAT_NUM_FIRST_LAST_VALS * storagePerElement;\n\n let firstVals = Array.from(\n vals.slice(0, firstValsSize));\n let lastVals = Array.from(vals.slice(\n (size - FORMAT_NUM_FIRST_LAST_VALS) * storagePerElement,\n size * storagePerElement));\n if (dtype === 'complex64') {\n firstVals = createComplexTuples(firstVals);\n lastVals = createComplexTuples(lastVals);\n }\n return [\n '[' +\n firstVals.map((x, i) => valToString(x, padPerCol[i], dtype))\n .join(', ') +\n ', ..., ' +\n lastVals\n .map(\n (x, i) => valToString(\n x, padPerCol[size - FORMAT_NUM_FIRST_LAST_VALS + i], dtype))\n .join(', ') +\n ']'\n ];\n }\n const displayVals: Array =\n dtype === 'complex64' ? createComplexTuples(vals) :\n Array.from(vals);\n\n return [\n '[' +\n displayVals.map((x, i) => valToString(x, padPerCol[i], dtype))\n .join(', ') +\n ']'\n ];\n }\n\n // The array is rank 2 or more.\n const subshape = shape.slice(1);\n const substrides = strides.slice(1);\n const stride = strides[0] * storagePerElement;\n const lines: string[] = [];\n if (size > FORMAT_LIMIT_NUM_VALS) {\n for (let i = 0; i < FORMAT_NUM_FIRST_LAST_VALS; i++) {\n const start = i * stride;\n const end = start + stride;\n lines.push(...subTensorToString(\n vals.slice(start, end), subshape, dtype, substrides, padPerCol,\n false /* isLast */));\n }\n lines.push('...');\n for (let i = size - FORMAT_NUM_FIRST_LAST_VALS; i < size; i++) {\n const start = i * stride;\n const end = start + stride;\n lines.push(...subTensorToString(\n vals.slice(start, end), subshape, dtype, substrides, padPerCol,\n i === size - 1 /* isLast */));\n }\n } else {\n for (let i = 0; i < size; i++) {\n const start = i * stride;\n const end = start + stride;\n lines.push(...subTensorToString(\n vals.slice(start, end), subshape, dtype, substrides, padPerCol,\n i === size - 1 /* isLast */));\n }\n }\n const sep = rank === 2 ? ',' : '';\n lines[0] = '[' + lines[0] + sep;\n for (let i = 1; i < lines.length - 1; i++) {\n lines[i] = ' ' + lines[i] + sep;\n }\n let newLineSep = ',\\n';\n for (let i = 2; i < rank; i++) {\n newLineSep += '\\n';\n }\n lines[lines.length - 1] =\n ' ' + lines[lines.length - 1] + ']' + (isLast ? '' : newLineSep);\n return lines;\n}\n\nfunction createComplexTuples(vals: Array<{}>|\n TypedArray): Array<[number, number]> {\n const complexTuples: Array<[number, number]> = [];\n for (let i = 0; i < vals.length; i += 2) {\n complexTuples.push([vals[i], vals[i + 1]] as [number, number]);\n }\n return complexTuples;\n}\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// Workaround for: https://github.com/bazelbuild/rules_nodejs/issues/1265\n/// \n\nimport {getGlobal} from './global_util';\nimport {tensorToString} from './tensor_format';\nimport {ArrayMap, BackendValues, DataType, DataTypeMap, DataValues, NumericDataType, Rank, ShapeMap, SingleValueMap, TypedArray} from './types';\nimport * as util from './util';\nimport {computeStrides, toNestedArray} from './util';\n\nexport interface TensorData {\n dataId?: DataId;\n values?: DataTypeMap[D];\n}\n\n// This interface mimics KernelBackend (in backend.ts), which would create a\n// circular dependency if imported.\nexport interface Backend {}\n\n/**\n * A mutable object, similar to `tf.Tensor`, that allows users to set values\n * at locations before converting to an immutable `tf.Tensor`.\n *\n * See `tf.buffer` for creating a tensor buffer.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\nexport class TensorBuffer {\n size: number;\n shape: ShapeMap[R];\n strides: number[];\n values: DataTypeMap[D];\n\n constructor(shape: ShapeMap[R], public dtype: D, values?: DataTypeMap[D]) {\n this.shape = shape.slice() as ShapeMap[R];\n this.size = util.sizeFromShape(shape);\n\n if (values != null) {\n const n = values.length;\n util.assert(\n n === this.size,\n () => `Length of values '${n}' does not match the size ` +\n `inferred by the shape '${this.size}'.`);\n }\n if (dtype === 'complex64') {\n throw new Error(\n `complex64 dtype TensorBuffers are not supported. Please create ` +\n `a TensorBuffer for the real and imaginary parts separately and ` +\n `call tf.complex(real, imag).`);\n }\n this.values = values || util.getArrayFromDType(dtype, this.size);\n this.strides = computeStrides(shape);\n }\n\n /**\n * Sets a value in the buffer at a given location.\n *\n * @param value The value to set.\n * @param locs The location indices.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\n set(value: SingleValueMap[D], ...locs: number[]): void {\n if (locs.length === 0) {\n locs = [0];\n }\n util.assert(\n locs.length === this.rank,\n () => `The number of provided coordinates (${locs.length}) must ` +\n `match the rank (${this.rank})`);\n\n const index = this.locToIndex(locs);\n this.values[index] = value as number;\n }\n\n /**\n * Returns the value in the buffer at the provided location.\n *\n * @param locs The location indices.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\n get(...locs: number[]): SingleValueMap[D] {\n if (locs.length === 0) {\n locs = [0];\n }\n let i = 0;\n for (const loc of locs) {\n if (loc < 0 || loc >= this.shape[i]) {\n const msg = `Requested out of range element at ${locs}. ` +\n ` Buffer shape=${this.shape}`;\n throw new Error(msg);\n }\n i++;\n }\n let index = locs[locs.length - 1];\n for (let i = 0; i < locs.length - 1; ++i) {\n index += this.strides[i] * locs[i];\n }\n return this.values[index] as SingleValueMap[D];\n }\n\n locToIndex(locs: number[]): number {\n if (this.rank === 0) {\n return 0;\n } else if (this.rank === 1) {\n return locs[0];\n }\n let index = locs[locs.length - 1];\n for (let i = 0; i < locs.length - 1; ++i) {\n index += this.strides[i] * locs[i];\n }\n return index;\n }\n\n indexToLoc(index: number): number[] {\n if (this.rank === 0) {\n return [];\n } else if (this.rank === 1) {\n return [index];\n }\n const locs: number[] = new Array(this.shape.length);\n for (let i = 0; i < locs.length - 1; ++i) {\n locs[i] = Math.floor(index / this.strides[i]);\n index -= locs[i] * this.strides[i];\n }\n locs[locs.length - 1] = index;\n return locs;\n }\n\n get rank() {\n return this.shape.length;\n }\n\n /**\n * Creates an immutable `tf.Tensor` object from the buffer.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\n toTensor(): Tensor {\n return trackerFn().makeTensor(this.values, this.shape, this.dtype) as\n Tensor;\n }\n}\n\nexport interface DataToGPUWebGLOption {\n customTexShape?: [number, number];\n}\n\nexport type DataToGPUOptions = DataToGPUWebGLOption;\n\nexport interface GPUData {\n tensorRef: Tensor;\n texture?: WebGLTexture;\n buffer?: GPUBuffer;\n texShape?: [number, number];\n bufSize?: number;\n}\n\nexport interface TensorTracker {\n makeTensor(\n values: DataValues, shape: number[], dtype: DataType,\n backend?: Backend): Tensor;\n makeVariable(\n initialValue: Tensor, trainable?: boolean, name?: string,\n dtype?: DataType): Variable;\n incRef(a: Tensor, backend: Backend): void;\n disposeTensor(t: Tensor): void;\n disposeVariable(v: Variable): void;\n read(dataId: DataId): Promise;\n readSync(dataId: DataId): BackendValues;\n readToGPU(dataId: DataId, options?: DataToGPUOptions): GPUData;\n}\n\n/**\n * The Tensor class calls into this handler to delegate chaining operations.\n */\nexport interface OpHandler {\n cast(x: T, dtype: DataType): T;\n buffer(\n shape: ShapeMap[R], dtype: D,\n values?: DataTypeMap[D]): TensorBuffer;\n print(x: T, verbose: boolean): void;\n clone(x: T): T;\n // TODO(yassogba) bring reshape back?\n}\n\n// For tracking tensor creation and disposal.\nlet trackerFn: () => TensorTracker = null;\n// Used by chaining methods to call into ops.\nlet opHandler: OpHandler = null;\n// Used to warn about deprecated methods.\nlet deprecationWarningFn: (msg: string) => void = null;\n// This here so that we can use this method on dev branches and keep the\n// functionality at master.\n// tslint:disable-next-line:no-unused-expression\n[deprecationWarningFn];\n\n/**\n * An external consumer can register itself as the tensor tracker. This way\n * the Tensor class can notify the tracker for every tensor created and\n * disposed.\n */\nexport function setTensorTracker(fn: () => TensorTracker) {\n trackerFn = fn;\n}\n\n/**\n * An external consumer can register itself as the op handler. This way the\n * Tensor class can have chaining methods that call into ops via the op\n * handler.\n */\nexport function setOpHandler(handler: OpHandler) {\n opHandler = handler;\n}\n\n/**\n * Sets the deprecation warning function to be used by this file. This way the\n * Tensor class can be a leaf but still use the environment.\n */\nexport function setDeprecationWarningFn(fn: (msg: string) => void) {\n deprecationWarningFn = fn;\n}\n\n/**\n * We wrap data id since we use weak map to avoid memory leaks.\n * Since we have our own memory management, we have a reference counter\n * mapping a tensor to its data, so there is always a pointer (even if that\n * data is otherwise garbage collectable).\n * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/\n * Global_Objects/WeakMap\n */\nexport type DataId = object; // object instead of {} to force non-primitive.\n\n// Declare this namespace to make Tensor class augmentation work in google3.\nexport declare namespace Tensor {}\n/**\n * A `tf.Tensor` object represents an immutable, multidimensional array of\n * numbers that has a shape and a data type.\n *\n * For performance reasons, functions that create tensors do not necessarily\n * perform a copy of the data passed to them (e.g. if the data is passed as a\n * `Float32Array`), and changes to the data will change the tensor. This is not\n * a feature and is not supported. To avoid this behavior, use the tensor before\n * changing the input data or create a copy with `copy = tf.add(yourTensor, 0)`.\n *\n * See `tf.tensor` for details on how to create a `tf.Tensor`.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\nexport class Tensor {\n /** Unique id of this tensor. */\n readonly id: number;\n /**\n * Id of the bucket holding the data for this tensor. Multiple arrays can\n * point to the same bucket (e.g. when calling array.reshape()).\n */\n dataId: DataId;\n /** The shape of the tensor. */\n readonly shape: ShapeMap[R];\n /** Number of elements in the tensor. */\n readonly size: number;\n /** The data type for the array. */\n readonly dtype: DataType;\n /** The rank type for the array (see `Rank` enum). */\n readonly rankType: R;\n\n /** Whether this tensor has been globally kept. */\n kept = false;\n /** The id of the scope this tensor is being tracked in. */\n scopeId: number;\n\n /**\n * Number of elements to skip in each dimension when indexing. See\n * https://docs.scipy.org/doc/numpy/reference/generated/\\\n * numpy.ndarray.strides.html\n */\n readonly strides: number[];\n\n constructor(shape: ShapeMap[R], dtype: DataType, dataId: DataId, id: number) {\n this.shape = shape.slice() as ShapeMap[R];\n this.dtype = dtype || 'float32';\n this.size = util.sizeFromShape(shape);\n this.strides = computeStrides(shape);\n this.dataId = dataId;\n this.id = id;\n this.rankType = (this.rank < 5 ? this.rank.toString() : 'higher') as R;\n }\n\n get rank(): number {\n return this.shape.length;\n }\n\n /**\n * Returns a promise of `tf.TensorBuffer` that holds the underlying data.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n async buffer(): Promise> {\n const vals = await this.data();\n return opHandler.buffer(this.shape, this.dtype as D, vals);\n }\n\n /**\n * Returns a `tf.TensorBuffer` that holds the underlying data.\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n bufferSync(): TensorBuffer {\n return opHandler.buffer(this.shape, this.dtype as D, this.dataSync());\n }\n\n /**\n * Returns the tensor data as a nested array. The transfer of data is done\n * asynchronously.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n async array(): Promise {\n const vals = await this.data();\n return toNestedArray(this.shape, vals, this.dtype === 'complex64') as\n ArrayMap[R];\n }\n\n /**\n * Returns the tensor data as a nested array. The transfer of data is done\n * synchronously.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n arraySync(): ArrayMap[R] {\n return toNestedArray(\n this.shape, this.dataSync(), this.dtype === 'complex64') as\n ArrayMap[R];\n }\n\n /**\n * Asynchronously downloads the values from the `tf.Tensor`. Returns a\n * promise of `TypedArray` that resolves when the computation has finished.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n async data(): Promise {\n this.throwIfDisposed();\n const data = trackerFn().read(this.dataId);\n if (this.dtype === 'string') {\n const bytes = await data as Uint8Array[];\n try {\n return bytes.map(b => util.decodeString(b)) as DataTypeMap[D];\n } catch {\n throw new Error(\n 'Failed to decode the string bytes into utf-8. ' +\n 'To get the original bytes, call tensor.bytes().');\n }\n }\n return data as Promise;\n }\n\n /**\n * Copy the tensor's data to a new GPU resource. Comparing to the `dataSync()`\n * and `data()`, this method prevents data from being downloaded to CPU.\n *\n * For WebGL backend, the data will be stored on a densely packed texture.\n * This means that the texture will use the RGBA channels to store value.\n *\n * For WebGPU backend, the data will be stored on a buffer. There is no\n * parameter, so can not use a user-defined size to create the buffer.\n *\n * @param options:\n * For WebGL,\n * - customTexShape: Optional. If set, will use the user defined\n * texture shape to create the texture.\n *\n * @returns For WebGL backend, a GPUData contains the new texture and\n * its information.\n * {\n * tensorRef: The tensor that is associated with this texture,\n * texture: WebGLTexture,\n * texShape: [number, number] // [height, width]\n * }\n *\n * For WebGPU backend, a GPUData contains the new buffer and\n * its information.\n * {\n * tensorRef: The tensor that is associated with this buffer,\n * buffer: GPUBuffer,\n * bufSize: number\n * }\n *\n * Remember to dispose the GPUData after it is used by\n * `res.tensorRef.dispose()`.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n dataToGPU(options?: DataToGPUOptions): GPUData {\n this.throwIfDisposed();\n return trackerFn().readToGPU(this.dataId, options);\n }\n\n /**\n * Synchronously downloads the values from the `tf.Tensor`. This blocks the\n * UI thread until the values are ready, which can cause performance issues.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n dataSync(): DataTypeMap[D] {\n this.throwIfDisposed();\n const data = trackerFn().readSync(this.dataId);\n if (this.dtype === 'string') {\n try {\n return (data as Uint8Array[]).map(b => util.decodeString(b)) as\n DataTypeMap[D];\n } catch {\n throw new Error(\n 'Failed to decode the string bytes into utf-8. ' +\n 'To get the original bytes, call tensor.bytes().');\n }\n }\n return data as DataTypeMap[D];\n }\n\n /** Returns the underlying bytes of the tensor's data. */\n async bytes(): Promise {\n this.throwIfDisposed();\n const data = await trackerFn().read(this.dataId);\n if (this.dtype === 'string') {\n return data as Uint8Array[];\n } else {\n return new Uint8Array((data as TypedArray).buffer);\n }\n }\n\n /**\n * Disposes `tf.Tensor` from memory.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n dispose(): void {\n if (this.isDisposed) {\n return;\n }\n trackerFn().disposeTensor(this);\n this.isDisposedInternal = true;\n }\n\n protected isDisposedInternal = false;\n get isDisposed(): boolean {\n return this.isDisposedInternal;\n }\n\n throwIfDisposed() {\n if (this.isDisposed) {\n throw new Error(`Tensor is disposed.`);\n }\n }\n\n /**\n * Prints the `tf.Tensor`. See `tf.print` for details.\n *\n * @param verbose Whether to print verbose information about the tensor,\n * including dtype and size.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n print(verbose = false): void {\n return opHandler.print(this, verbose);\n }\n\n /**\n * Returns a copy of the tensor. See `tf.clone` for details.\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n clone(this: T): T {\n this.throwIfDisposed();\n return opHandler.clone(this);\n }\n\n /**\n * Returns a human-readable description of the tensor. Useful for logging.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n toString(verbose = false): string {\n const vals = this.dataSync();\n return tensorToString(vals, this.shape, this.dtype, verbose);\n }\n\n cast(dtype: DataType): T {\n this.throwIfDisposed();\n return opHandler.cast(this as T, dtype);\n }\n variable(trainable = true, name?: string, dtype?: DataType): Variable {\n this.throwIfDisposed();\n return trackerFn().makeVariable(this, trainable, name, dtype) as\n Variable;\n }\n}\n\nObject.defineProperty(Tensor, Symbol.hasInstance, {\n value: (instance: Tensor) => {\n // Implementation note: we should use properties of the object that will be\n // defined before the constructor body has finished executing (methods).\n // This is because when this code is transpiled by babel, babel will call\n // classCallCheck before the constructor body is run.\n // See https://github.com/tensorflow/tfjs/issues/3384 for backstory.\n return !!instance && instance.data != null && instance.dataSync != null &&\n instance.throwIfDisposed != null;\n }\n});\n\nexport function getGlobalTensorClass() {\n // Use getGlobal so that we can augment the Tensor class across package\n // boundaries becase the node resolution alg may result in different modules\n // being returned for this file depending on the path they are loaded from.\n return getGlobal('Tensor', () => {\n return Tensor;\n });\n}\n\n// Global side effect. Cache global reference to Tensor class\ngetGlobalTensorClass();\n\nexport interface NumericTensor extends Tensor {\n dtype: NumericDataType;\n dataSync(): DataTypeMap[D];\n data(): Promise;\n dataToGPU(options?: DataToGPUOptions): GPUData;\n}\n\nexport interface StringTensor extends Tensor {\n dtype: 'string';\n dataSync(): DataTypeMap[D];\n data(): Promise;\n}\n\n/** @doclink Tensor */\nexport type Scalar = Tensor;\n/** @doclink Tensor */\nexport type Tensor1D = Tensor;\n/** @doclink Tensor */\nexport type Tensor2D = Tensor;\n/** @doclink Tensor */\nexport type Tensor3D = Tensor;\n/** @doclink Tensor */\nexport type Tensor4D = Tensor;\n/** @doclink Tensor */\nexport type Tensor5D = Tensor;\n/** @doclink Tensor */\nexport type Tensor6D = Tensor;\n\n/**\n * A mutable `tf.Tensor`, useful for persisting state, e.g. for training.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\nexport class Variable extends Tensor {\n name: string;\n\n constructor(\n initialValue: Tensor, public trainable: boolean, name: string,\n tensorId: number) {\n super(\n initialValue.shape, initialValue.dtype, initialValue.dataId, tensorId);\n this.name = name;\n }\n\n /**\n * Assign a new `tf.Tensor` to this variable. The new `tf.Tensor` must have\n * the same shape and dtype as the old `tf.Tensor`.\n *\n * @param newValue New tensor to be assigned to this variable.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n assign(newValue: Tensor): void {\n if (newValue.dtype !== this.dtype) {\n throw new Error(\n `dtype of the new value (${newValue.dtype}) and ` +\n `previous value (${this.dtype}) must match`);\n }\n if (!util.arraysEqual(newValue.shape, this.shape)) {\n throw new Error(\n `shape of the new value (${newValue.shape}) and ` +\n `previous value (${this.shape}) must match`);\n }\n trackerFn().disposeTensor(this);\n this.dataId = newValue.dataId;\n trackerFn().incRef(this, null /* backend */);\n }\n\n dispose(): void {\n trackerFn().disposeVariable(this);\n this.isDisposedInternal = true;\n }\n}\n\nObject.defineProperty(Variable, Symbol.hasInstance, {\n value: (instance: Variable) => {\n return instance instanceof Tensor && instance.assign != null &&\n instance.assign instanceof Function;\n }\n});\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/** @docalias number[] */\nexport interface ShapeMap {\n R0: number[];\n R1: [number];\n R2: [number, number];\n R3: [number, number, number];\n R4: [number, number, number, number];\n R5: [number, number, number, number, number];\n R6: [number, number, number, number, number, number];\n}\n\n/** @docalias number[] */\nexport interface ArrayMap {\n R0: number;\n R1: number[];\n R2: number[][];\n R3: number[][][];\n R4: number[][][][];\n R5: number[][][][][];\n R6: number[][][][][][];\n}\n\nexport interface DataTypeMap {\n float32: Float32Array;\n int32: Int32Array;\n bool: Uint8Array;\n complex64: Float32Array;\n string: string[];\n}\n\nexport interface SingleValueMap {\n bool: boolean;\n int32: number;\n float32: number;\n complex64: number;\n string: string;\n}\n\n/** @docalias 'float32'|'int32'|'bool'|'complex64'|'string' */\nexport type DataType = keyof DataTypeMap;\nexport type NumericDataType = 'float32'|'int32'|'bool'|'complex64';\nexport type TypedArray = Float32Array|Int32Array|Uint8Array;\n/** Tensor data used in tensor creation and user-facing API. */\nexport type DataValues = DataTypeMap[DataType];\n/** The underlying tensor data that gets stored in a backend. */\nexport type BackendValues = Float32Array|Int32Array|Uint8Array|Uint8Array[];\n\nexport enum Rank {\n R0 = 'R0',\n R1 = 'R1',\n R2 = 'R2',\n R3 = 'R3',\n R4 = 'R4',\n R5 = 'R5',\n R6 = 'R6'\n}\n\nexport type FlatVector = boolean[]|number[]|TypedArray;\nexport type RegularArray =\n T[]|T[][]|T[][][]|T[][][][]|T[][][][][]|T[][][][][][];\n\n// tslint:disable-next-line:no-any\nexport interface RecursiveArray {\n [index: number]: T|RecursiveArray;\n}\n\n// Looks for upcasting types. Used, for example, in operations with mixed dtype\n// inputs.\nenum UpcastInt32AndMap {\n 'float32' = 'float32',\n 'int32' = 'int32',\n 'bool' = 'int32',\n 'complex64' = 'complex64'\n}\n\nenum UpcastBoolAndMap {\n 'float32' = 'float32',\n 'int32' = 'int32',\n 'bool' = 'bool',\n 'complex64' = 'complex64'\n}\n\nenum UpcastFloat32AndMap {\n 'float32' = 'float32',\n 'int32' = 'float32',\n 'bool' = 'float32',\n 'complex64' = 'complex64'\n}\n\nenum UpcastComplex64AndMap {\n 'float32' = 'complex64',\n 'int32' = 'complex64',\n 'bool' = 'complex64',\n 'complex64' = 'complex64'\n}\n\nconst upcastTypeMap = {\n 'float32': UpcastFloat32AndMap,\n 'int32': UpcastInt32AndMap,\n 'bool': UpcastBoolAndMap,\n 'complex64': UpcastComplex64AndMap\n};\n\nexport function upcastType(typeA: DataType, typeB: DataType): DataType {\n if (typeA === 'string' || typeB === 'string') {\n if (typeA === 'string' && typeB === 'string') {\n return 'string';\n }\n throw new Error(`Can not upcast ${typeA} with ${typeB}`);\n }\n return upcastTypeMap[typeA][typeB];\n}\n\n/** Returns the output type after summation. */\nexport function sumOutType(type: DataType): DataType {\n return upcastType(type, 'int32');\n}\n\n/** @docalias TypedArray|Array */\nexport type TensorLike =\n TypedArray|number|boolean|string|RecursiveArray|\n RecursiveArray|RecursiveArray|Uint8Array[];\nexport type ScalarLike = number|boolean|string|Uint8Array;\n/** @docalias TypedArray|Array */\nexport type TensorLike1D = TypedArray|number[]|boolean[]|string[]|Uint8Array[];\n/** @docalias TypedArray|Array */\nexport type TensorLike2D = TypedArray|number[]|number[][]|boolean[]|boolean[][]|\n string[]|string[][]|Uint8Array[]|Uint8Array[][];\n/** @docalias TypedArray|Array */\nexport type TensorLike3D = TypedArray|number[]|number[][][]|boolean[]|\n boolean[][][]|string[]|string[][][]|Uint8Array[]|Uint8Array[][][];\n/** @docalias TypedArray|Array */\nexport type TensorLike4D = TypedArray|number[]|number[][][][]|boolean[]|\n boolean[][][][]|string[]|string[][][][]|Uint8Array[]|Uint8Array[][][][];\n/** @docalias TypedArray|Array */\nexport type TensorLike5D =\n TypedArray|number[]|number[][][][][]|boolean[]|boolean[][][][][]|string[]|\n string[][][][][]|Uint8Array[]|Uint8Array[][][][][];\n/** @docalias TypedArray|Array */\nexport type TensorLike6D =\n TypedArray|number[]|number[][][][][][]|boolean[]|boolean[][][][][][]|\n string[]|string[][][][][][]|Uint8Array[]|Uint8Array[][][][][];\n\n/** Type for representing image data in Uint8Array type. */\nexport interface PixelData {\n width: number;\n height: number;\n data: Uint8Array;\n}\n\n/**\n * Type for representing all permutations and combinations of 'RGBA' channels.\n */\nexport type WebGLChannels = 'A'|'B'|'G'|'R'|'AB'|'AG'|'AR'|'BA'|'BG'|'BR'|'GA'|\n 'GB'|'GR'|'RA'|'RB'|'RG'|'ABG'|'ABR'|'AGB'|'AGR'|'ARB'|'ARG'|'BAG'|'BAR'|\n 'BGA'|'BGR'|'BRA'|'BRG'|'GAB'|'GAR'|'GBA'|'GBR'|'GRA'|'GRB'|'RAB'|'RAG'|\n 'RBA'|'RBG'|'RGA'|'RGB'|'ABGR'|'ABRG'|'AGBR'|'AGRB'|'ARBG'|'ARGB'|'BAGR'|\n 'BARG'|'BGAR'|'BGRA'|'BRAG'|'BRGA'|'GABR'|'GARB'|'GBAR'|'GBRA'|'GRAB'|\n 'GRBA'|'RABG'|'RAGB'|'RBAG'|'RBGA'|'RGAB'|'RGBA';\n\n/** Type for representing a texture data to create a tensor. */\nexport interface WebGLData {\n texture: WebGLTexture;\n height: number;\n width: number;\n channels: WebGLChannels;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from './tensor';\nimport {TensorContainer, TensorContainerArray} from './tensor_types';\nimport {upcastType} from './types';\nimport {assert} from './util';\n\nexport function makeTypesMatch(a: T, b: T): [T, T] {\n if (a.dtype === b.dtype) {\n return [a, b];\n }\n const dtype = upcastType(a.dtype, b.dtype);\n return [a.cast(dtype), b.cast(dtype)];\n}\n\nexport function assertTypesMatch(a: Tensor, b: Tensor): void {\n assert(\n a.dtype === b.dtype,\n () => `The dtypes of the first(${a.dtype}) and` +\n ` second(${b.dtype}) input must match`);\n}\n\nexport function isTensorInList(tensor: Tensor, tensorList: Tensor[]): boolean {\n return tensorList.some(x => x.id === tensor.id);\n}\n\n/**\n * Extracts any `Tensor`s found within the provided object.\n *\n * @param container an object that may be a `Tensor` or may directly contain\n * `Tensor`s, such as a `Tensor[]` or `{key: Tensor, ...}`. In general it\n * is safe to pass any object here, except that `Promise`s are not\n * supported.\n * @returns An array of `Tensors` found within the passed object. If the\n * argument is simply a `Tensor', a list containing that `Tensor` is\n * returned. If the object is not a `Tensor` or does not\n * contain `Tensors`, an empty list is returned.\n */\nexport function getTensorsInContainer(result: TensorContainer): Tensor[] {\n const list: Tensor[] = [];\n const seen = new Set<{}|void>();\n walkTensorContainer(result, list, seen);\n return list;\n}\n\nfunction walkTensorContainer(\n container: TensorContainer, list: Tensor[], seen: Set<{}|void>): void {\n if (container == null) {\n return;\n }\n if (container instanceof Tensor) {\n list.push(container);\n return;\n }\n if (!isIterable(container)) {\n return;\n }\n // Iteration over keys works also for arrays.\n const iterable = container as TensorContainerArray;\n for (const k in iterable) {\n const val = iterable[k];\n if (!seen.has(val)) {\n seen.add(val);\n walkTensorContainer(val, list, seen);\n }\n }\n}\n\n// tslint:disable-next-line:no-any\nfunction isIterable(obj: any): boolean {\n return Array.isArray(obj) || typeof obj === 'object';\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {BackendTimingInfo, DataMover, KernelBackend} from './backends/backend';\nimport {Environment, setEnvironmentGlobal} from './environment';\nimport {getGlobalNamespace} from './global_util';\nimport {Add, Cast, Identity} from './kernel_names';\nimport {getGradient, getKernel, getKernelsForBackend, GradFunc, NamedAttrMap, TensorInfo} from './kernel_registry';\nimport * as log from './log';\nimport {KernelProfile, Profiler} from './profiler';\nimport {backpropagateGradients, getFilteredNodesXToY, TapeNode} from './tape';\nimport {DataId, DataToGPUOptions, GPUData, setTensorTracker, Tensor, TensorTracker, Variable} from './tensor';\nimport {GradSaveFunc, NamedTensorMap, NamedVariableMap, TensorContainer} from './tensor_types';\nimport {getTensorsInContainer} from './tensor_util';\nimport {BackendValues, DataType, DataValues} from './types';\nimport * as util from './util';\nimport {bytesFromStringArray, makeOnesTypedArray, now, sizeFromShape} from './util';\n\n/**\n * A function that computes an output. The save function is for saving tensors\n * computed in the forward pass, that we need in the backward pass.\n */\nexport type ForwardFunc = (backend: KernelBackend, save?: GradSaveFunc) => T;\n\n/**\n * @docalias (a: Tensor, b: Tensor,..., save?: Function) => {\n * value: Tensor,\n * gradFunc: (dy: Tensor, saved?: NamedTensorMap) => Tensor | Tensor[]\n * }\n */\nexport type CustomGradientFunc =\n (...inputs: Array) => {\n value: T;\n gradFunc: (dy: T, saved: Tensor[]) => Tensor | Tensor[];\n };\n\nexport type MemoryInfo = {\n numTensors: number; numDataBuffers: number; numBytes: number;\n unreliable?: boolean; reasons: string[];\n};\n\ntype KernelInfo = {\n name: string; bytesAdded: number; totalBytesSnapshot: number;\n tensorsAdded: number;\n totalTensorsSnapshot: number;\n inputShapes: number[][];\n outputShapes: number[][];\n kernelTimeMs: number | {error: string} | Promise;\n extraInfo: string | Promise;\n};\n\nexport type ProfileInfo = {\n newBytes: number; newTensors: number; peakBytes: number;\n kernels: KernelInfo[];\n result: TensorContainer;\n kernelNames: string[];\n};\n\nexport interface TimingInfo extends BackendTimingInfo {\n wallMs: number;\n}\n\n/** @docalias Function */\nexport type ScopeFn = () => T;\n\ninterface ScopeState {\n track: Tensor[];\n name: string;\n id: number;\n}\n\ninterface RegisteredKernelInvocation {\n kernelName: string;\n inputs: I;\n attrs?: NamedAttrMap;\n}\n\ninterface CustomGradKernelInvocation {\n forwardFunc: ForwardFunc;\n backwardsFunc: (dy: T, saved: Tensor[]) => {\n [P in keyof I]: () => I[P]\n };\n inputs: I;\n attrs?: NamedAttrMap;\n}\n\nfunction isRegisteredKernelInvocation(\n kernelInvocation: RegisteredKernelInvocation|\n CustomGradKernelInvocation):\n kernelInvocation is RegisteredKernelInvocation {\n return (kernelInvocation as RegisteredKernelInvocation).kernelName != null;\n}\n\nclass EngineState {\n // Public since optimizers will use it.\n registeredVariables: NamedVariableMap = {};\n\n nextTapeNodeId = 0;\n numBytes = 0;\n numTensors = 0;\n numStringTensors = 0;\n numDataBuffers = 0;\n\n activeTape: TapeNode[];\n // Number of nested tf.grad() statements when computing higher-order\n // gradients. E.g. `1` for first-order gradients and `2` for second-order\n // gradients. Used to track if the tape should be removed after a backprop.\n gradientDepth = 0;\n // Number of nested kernel calls. When kernel depth is greater than 1, we turn\n // off the tape.\n kernelDepth = 0;\n\n // Keep Tensors that parallel the tapes.\n activeScope: ScopeState;\n scopeStack: ScopeState[] = [];\n /**\n * Keeps track of the number of data moves during a kernel execution. We\n * maintain a stack since kernels can call other kernels, recursively.\n */\n numDataMovesStack: number[] = [];\n nextScopeId = 0;\n\n tensorInfo = new WeakMap();\n\n profiling = false;\n activeProfile: ProfileInfo = {\n newBytes: 0,\n newTensors: 0,\n peakBytes: 0,\n kernels: [],\n result: null,\n get kernelNames():\n string[] {\n return Array.from(new Set(this.kernels.map(k => k.name)));\n }\n };\n\n dispose() {\n for (const variableName in this.registeredVariables) {\n this.registeredVariables[variableName].dispose();\n }\n }\n}\n\nexport class Engine implements TensorTracker, DataMover {\n state: EngineState;\n backendName: string;\n registry: {[id: string]: KernelBackend} = {};\n registryFactory: {\n [id: string]: {\n factory: () => KernelBackend | Promise,\n priority: number\n }\n } = {};\n\n private profiler: Profiler;\n private backendInstance: KernelBackend;\n private pendingBackendInit: Promise;\n private pendingBackendInitId = 0;\n\n constructor(public ENV: Environment) {\n this.state = new EngineState();\n }\n\n async ready(): Promise {\n if (this.pendingBackendInit != null) {\n return this.pendingBackendInit.then(() => {});\n }\n if (this.backendInstance != null) {\n return;\n }\n const sortedBackends = this.getSortedBackends();\n\n for (let i = 0; i < sortedBackends.length; i++) {\n const backendName = sortedBackends[i];\n const success = await this.initializeBackend(backendName).success;\n if (success) {\n await this.setBackend(backendName);\n return;\n }\n }\n\n throw new Error(\n `Could not initialize any backends, all backend initializations ` +\n `failed.`);\n }\n\n get backend(): KernelBackend {\n if (this.pendingBackendInit != null) {\n throw new Error(\n `Backend '${this.backendName}' has not yet been initialized. Make ` +\n `sure to await tf.ready() or await tf.setBackend() before calling ` +\n `other methods`);\n }\n if (this.backendInstance == null) {\n const {name, asyncInit} = this.initializeBackendsAndReturnBest();\n if (asyncInit) {\n throw new Error(\n `The highest priority backend '${name}' has not yet been ` +\n `initialized. Make sure to await tf.ready() or ` +\n `await tf.setBackend() before calling other methods`);\n }\n this.setBackend(name);\n }\n return this.backendInstance;\n }\n\n backendNames(): string[] {\n return Object.keys(this.registryFactory);\n }\n\n findBackend(backendName: string): KernelBackend {\n if (!(backendName in this.registry)) {\n // If the backend hasn't been initialized but we have a registry entry for\n // it, initialize it and return it.\n if (backendName in this.registryFactory) {\n const {asyncInit} = this.initializeBackend(backendName);\n if (asyncInit) {\n // Backend is not ready yet.\n return null;\n }\n } else {\n return null;\n }\n }\n return this.registry[backendName];\n }\n\n findBackendFactory(backendName: string):\n () => KernelBackend | Promise {\n if (!(backendName in this.registryFactory)) {\n return null;\n }\n return this.registryFactory[backendName].factory;\n }\n\n registerBackend(\n backendName: string,\n factory: () => KernelBackend | Promise,\n priority = 1): boolean {\n if (backendName in this.registryFactory) {\n log.warn(\n `${backendName} backend was already registered. ` +\n `Reusing existing backend factory.`);\n return false;\n }\n this.registryFactory[backendName] = {factory, priority};\n return true;\n }\n\n async setBackend(backendName: string): Promise {\n if (this.registryFactory[backendName] == null) {\n throw new Error(`Backend name '${backendName}' not found in registry`);\n }\n this.backendName = backendName;\n if (this.registry[backendName] == null) {\n this.backendInstance = null;\n const {success, asyncInit} = this.initializeBackend(backendName);\n const result = asyncInit ? await success : success;\n if (!result) {\n return false;\n }\n }\n this.backendInstance = this.registry[backendName];\n this.setupRegisteredKernels();\n // Reset the profiler.\n this.profiler = new Profiler(this.backendInstance);\n\n return true;\n }\n\n private setupRegisteredKernels(): void {\n const kernels = getKernelsForBackend(this.backendName);\n kernels.forEach(kernel => {\n if (kernel.setupFunc != null) {\n kernel.setupFunc(this.backendInstance);\n }\n });\n }\n\n private disposeRegisteredKernels(backendName: string): void {\n const kernels = getKernelsForBackend(backendName);\n kernels.forEach(kernel => {\n if (kernel.disposeFunc != null) {\n kernel.disposeFunc(this.registry[backendName]);\n }\n });\n }\n\n /**\n * Initializes a backend by looking up the backend name in the factory\n * registry and calling the factory method. Returns a boolean representing\n * whether the initialization of the backend suceeded. Throws an error if\n * there is no backend in the factory registry.\n */\n private initializeBackend(backendName: string):\n {success: boolean|Promise, asyncInit: boolean} {\n const registryFactoryEntry = this.registryFactory[backendName];\n if (registryFactoryEntry == null) {\n throw new Error(\n `Cannot initialize backend ${backendName}, no registration found.`);\n }\n\n try {\n const backend = registryFactoryEntry.factory();\n /* Test if the factory returns a promise.\n Done in a more liberal way than\n previous 'Promise.resolve(backend)===backend'\n as we needed to account for custom Promise\n implementations (e.g. Angular) */\n if (backend && !(backend instanceof KernelBackend) &&\n typeof backend.then === 'function') {\n const promiseId = ++this.pendingBackendInitId;\n const success =\n backend\n .then(backendInstance => {\n // Outdated promise. Another backend was set in the meantime.\n if (promiseId < this.pendingBackendInitId) {\n return false;\n }\n this.registry[backendName] = backendInstance;\n this.pendingBackendInit = null;\n return true;\n })\n .catch(err => {\n // Outdated promise. Another backend was set in the meantime.\n if (promiseId < this.pendingBackendInitId) {\n return false;\n }\n this.pendingBackendInit = null;\n log.warn(`Initialization of backend ${backendName} failed`);\n log.warn(err.stack || err.message);\n return false;\n });\n this.pendingBackendInit = success;\n return {success, asyncInit: true};\n } else {\n this.registry[backendName] = backend as KernelBackend;\n return {success: true, asyncInit: false};\n }\n } catch (err) {\n log.warn(`Initialization of backend ${backendName} failed`);\n log.warn(err.stack || err.message);\n return {success: false, asyncInit: false};\n }\n }\n\n removeBackend(backendName: string): void {\n if (!(backendName in this.registryFactory)) {\n throw new Error(`${backendName} backend not found in registry`);\n }\n if (this.backendName === backendName && this.pendingBackendInit != null) {\n // There is a pending promise of the backend we want to remove. Make it\n // obsolete.\n this.pendingBackendInitId++;\n }\n\n if (backendName in this.registry) {\n this.disposeRegisteredKernels(backendName);\n this.registry[backendName].dispose();\n delete this.registry[backendName];\n }\n\n delete this.registryFactory[backendName];\n\n // Unset the backend if it is active.\n if (this.backendName === backendName) {\n this.pendingBackendInit = null;\n this.backendName = null;\n this.backendInstance = null;\n }\n }\n\n private getSortedBackends(): string[] {\n if (Object.keys(this.registryFactory).length === 0) {\n throw new Error('No backend found in registry.');\n }\n return Object.keys(this.registryFactory).sort((a: string, b: string) => {\n // Highest priority comes first.\n return this.registryFactory[b].priority -\n this.registryFactory[a].priority;\n });\n }\n\n private initializeBackendsAndReturnBest():\n {name: string, asyncInit: boolean} {\n const sortedBackends = this.getSortedBackends();\n\n for (let i = 0; i < sortedBackends.length; i++) {\n const backendName = sortedBackends[i];\n const {success, asyncInit} = this.initializeBackend(backendName);\n if (asyncInit || success) {\n return {name: backendName, asyncInit};\n }\n }\n throw new Error(\n `Could not initialize any backends, all backend initializations ` +\n `failed.`);\n }\n\n moveData(backend: KernelBackend, dataId: DataId) {\n const info = this.state.tensorInfo.get(dataId);\n const srcBackend = info.backend;\n const values = this.readSync(dataId);\n const refCount = srcBackend.refCount(dataId);\n // Delete the tensor from the old backend and move it to the new\n // backend.\n srcBackend.disposeData(dataId, true);\n info.backend = backend;\n backend.move(dataId, values, info.shape, info.dtype, refCount);\n if (this.shouldCheckForMemLeaks()) {\n // Track the number of moves during a kernel execution to correctly\n // detect memory leaks.\n this.state.numDataMovesStack[this.state.numDataMovesStack.length - 1]++;\n }\n }\n\n tidy(nameOrFn: string|ScopeFn, fn?: ScopeFn):\n T {\n let name: string = null;\n if (fn == null) {\n // Called with only 1 argument.\n if (typeof nameOrFn !== 'function') {\n throw new Error('Please provide a function to tidy()');\n }\n fn = nameOrFn;\n } else {\n // Called with 2 arguments.\n if (typeof nameOrFn !== 'string' && !(nameOrFn instanceof String)) {\n throw new Error(\n 'When calling with two arguments, the first argument ' +\n 'to tidy() must be a string');\n }\n if (typeof fn !== 'function') {\n throw new Error(\n 'When calling with two arguments, the 2nd argument ' +\n 'to tidy() must be a function');\n }\n name = nameOrFn as string;\n // TODO(nsthorat,smilkov): Do operation logging and performance\n // profiling.\n }\n let result: T;\n return this.scopedRun(\n () => this.startScope(name), () => this.endScope(result), () => {\n result = fn();\n if (result instanceof Promise) {\n console.error('Cannot return a Promise inside of tidy.');\n }\n return result;\n });\n }\n\n private scopedRun(start: () => void, end: () => void, f: () => T): T {\n start();\n try {\n const res = f();\n end();\n return res;\n } catch (ex) {\n end();\n throw ex;\n }\n }\n\n private static nextTensorId = 0;\n private nextTensorId(): number {\n return Engine.nextTensorId++;\n }\n\n private static nextVariableId = 0;\n private nextVariableId(): number {\n return Engine.nextVariableId++;\n }\n\n /**\n * This method is called instead of the public-facing tensor.clone() when\n * saving a tensor for backwards pass. It makes sure to add the clone\n * operation to the tape regardless of being called inside a kernel\n * execution.\n */\n private clone(x: Tensor): Tensor {\n const y: Tensor = ENGINE.runKernel(Identity, {x} as {} as NamedTensorMap);\n const inputs = {x};\n const grad = (dy: Tensor) => ({\n x: () => {\n const dtype = 'float32';\n const gradInputs = {x: dy};\n const attrs = {dtype};\n\n return ENGINE.runKernel(\n Cast, gradInputs as {} as NamedTensorMap,\n // tslint:disable-next-line: no-unnecessary-type-assertion\n attrs as {} as NamedAttrMap) as Tensor;\n }\n });\n const saved: Tensor[] = [];\n this.addTapeNode(this.state.activeScope.name, inputs, [y], grad, saved, {});\n return y;\n }\n\n /**\n * Execute a kernel with the given name and return the output tensor.\n *\n * @param kernelName The name of the kernel to execute.\n * @param inputs A map of input names to tensors.\n * @param attrs A map of attribute names to their values. An attribute is a\n * primitive (non-tensor) input to the kernel.\n * @param inputsToSave A list of tensors, inputs to save for the backprop\n * computation.\n * @param outputsToSave A list of booleans, specifying which output to save\n * for the backprop computation. These are booleans since the output\n * tensors are not visible to the user.\n */\n runKernel(\n kernelName: string, inputs: NamedTensorMap, attrs?: NamedAttrMap): T {\n if (this.backendName == null) {\n // backend has not been initialized yet (backend initialization is lazy\n // can be deferred until an op/ kernel is run).\n // The below getter has side effects that will try to initialize the\n // backend and set properties like this.backendName\n // tslint:disable-next-line: no-unused-expression\n this.backend;\n }\n const hasKernel = getKernel(kernelName, this.backendName) != null;\n if (!hasKernel) {\n throw new Error(`Kernel '${kernelName}' not registered for backend '${\n this.backendName}'`);\n }\n return this.runKernelFunc({kernelName, inputs, attrs});\n }\n\n private shouldCheckForMemLeaks(): boolean {\n return this.ENV.getBool('IS_TEST');\n }\n\n private checkKernelForMemLeak(\n kernelName: string, numDataIdsBefore: number,\n outInfos: TensorInfo[]): void {\n const numDataIdsAfter = this.backend.numDataIds();\n\n // Count the number of data ids associated with the result of the kernel.\n let numOutputDataIds = 0;\n outInfos.forEach(info => {\n // Complex numbers allocate 3 data ids, one for 'real', one for\n // 'imaginary', and one for the container that holds the former two.\n numOutputDataIds += (info.dtype === 'complex64' ? 3 : 1);\n });\n\n // Account for the number of moves during kernel execution. A \"data move\"\n // can happen in the middle of a kernel execution, placing a new (key,value)\n // pair in the data storage. Since data moves have net zero effect (we\n // always remove the data from the old backend), we have to cancel them out\n // when detecting memory leaks.\n const numMoves =\n this.state.numDataMovesStack[this.state.numDataMovesStack.length - 1];\n const dataIdsLeaked =\n numDataIdsAfter - numDataIdsBefore - numOutputDataIds - numMoves;\n if (dataIdsLeaked > 0) {\n throw new Error(\n `Backend '${this.backendName}' has an internal memory leak ` +\n `(${dataIdsLeaked} data ids) after running '${kernelName}'`);\n }\n }\n\n /**\n * Internal helper method to execute a kernel Func\n *\n * Use `runKernel` to execute kernels from outside of engine.\n */\n private runKernelFunc(\n kernelParams: RegisteredKernelInvocation|\n CustomGradKernelInvocation): T {\n let outputs: Tensor[];\n let saved: Tensor[] = [];\n const isTapeOn = this.isTapeOn();\n\n const startingBytecount = this.state.numBytes;\n const startingNumTensors = this.state.numTensors;\n\n if (this.shouldCheckForMemLeaks()) {\n this.state.numDataMovesStack.push(0);\n }\n\n let kernelFunc: () => Tensor[];\n if (this.backendName == null) {\n // backend has not been initialized yet (backend initialization is lazy\n // can be deferred until an op/ kernel is run).\n // The below getter has side effects that will try to initialize the\n // backend and set properties like this.backendName\n // tslint:disable-next-line: no-unused-expression\n this.backend;\n }\n\n let out: TensorInfo|TensorInfo[];\n\n const kernelOrScopeName = isRegisteredKernelInvocation(kernelParams) ?\n kernelParams.kernelName :\n this.state.activeScope != null ? this.state.activeScope.name : '';\n\n // Create the kernelFunc from either a registered kernel OR passed in\n // forward/backward functions (used by custom grad). In this context a\n // kernelFunc wraps a kernel implementation with some bookkeeping.\n\n if (isRegisteredKernelInvocation(kernelParams)) {\n const {kernelName, inputs, attrs} = kernelParams;\n if (this.backendName == null) {\n // backend has not been initialized yet (backend initialization is lazy\n // can be deferred until an op/ kernel is run).\n // The below getter has side effects that will try to initialize the\n // backend and set properties like this.backendName\n // tslint:disable-next-line: no-unused-expression\n this.backend;\n }\n const kernel = getKernel(kernelName, this.backendName);\n util.assert(\n kernel != null,\n () => `Cannot find registered kernel '${kernelName}' for backend '${\n this.backendName}'`);\n\n kernelFunc = () => {\n const numDataIdsBefore = this.backend.numDataIds();\n out = kernel.kernelFunc({inputs, attrs, backend: this.backend});\n const outInfos = Array.isArray(out) ? out : [out];\n if (this.shouldCheckForMemLeaks()) {\n this.checkKernelForMemLeak(kernelName, numDataIdsBefore, outInfos);\n }\n\n const outTensors = outInfos.map((outInfo: TensorInfo|Tensor) => {\n // todo (yassogba) remove this option (Tensor) when node backend\n // methods have been modularized and they all return tensorInfo.\n // TensorInfos do not have a rank attribute.\n if ((outInfo as Tensor).rank != null) {\n return outInfo as Tensor;\n }\n return this.makeTensorFromTensorInfo(outInfo);\n });\n\n // Save any required inputs and outputs.\n\n // Do not save unless we are recording to the tape. Otherwise it would\n // cause a mem leak since there would be no backprop for these tensors\n // (which would otherwise dispose them).\n if (isTapeOn) {\n const tensorsToSave =\n this.getTensorsForGradient(kernelName, inputs, outTensors);\n saved = this.saveTensorsForBackwardMode(tensorsToSave);\n }\n return outTensors;\n };\n } else {\n const {forwardFunc} = kernelParams;\n // Running a customGrad op.\n const saveFunc: GradSaveFunc = (tensors) => {\n // Do not save unless we are recording to the tape. Otherwise it would\n // cause a mem leak since we would never run backprop, which disposes\n // the kept tensors.\n if (!isTapeOn) {\n return;\n }\n saved = tensors.map(tensor => this.keep(this.clone(tensor)));\n };\n\n kernelFunc = () => {\n const numDataIdsBefore = this.backend.numDataIds();\n out = this.tidy(() => forwardFunc(this.backend, saveFunc));\n const outs = (Array.isArray(out) ? out : [out]) as Tensor[];\n if (this.shouldCheckForMemLeaks()) {\n // Scope name is used to print a more helpful error message if needed.\n this.checkKernelForMemLeak(kernelOrScopeName, numDataIdsBefore, outs);\n }\n return outs;\n };\n }\n\n //\n // Run the kernelFunc. Optionally profiling it.\n //\n const {inputs, attrs} = kernelParams;\n const backwardsFunc = isRegisteredKernelInvocation(kernelParams) ?\n null :\n kernelParams.backwardsFunc;\n\n let kernelProfile: KernelProfile;\n this.scopedRun(\n // Stop recording to a tape when running a kernel.\n () => this.state.kernelDepth++, () => this.state.kernelDepth--, () => {\n if (!this.ENV.getBool('DEBUG') && !this.state.profiling) {\n outputs = kernelFunc();\n } else {\n kernelProfile = this.profiler.profileKernel(\n kernelOrScopeName, inputs, () => kernelFunc());\n if (this.ENV.getBool('DEBUG')) {\n this.profiler.logKernelProfile(kernelProfile);\n }\n outputs = kernelProfile.outputs;\n }\n });\n\n if (isTapeOn) {\n this.addTapeNode(\n kernelOrScopeName, inputs, outputs, backwardsFunc, saved, attrs);\n }\n\n if (this.state.profiling) {\n this.state.activeProfile.kernels.push({\n name: kernelOrScopeName,\n bytesAdded: this.state.numBytes - startingBytecount,\n totalBytesSnapshot: this.state.numBytes,\n tensorsAdded: this.state.numTensors - startingNumTensors,\n totalTensorsSnapshot: this.state.numTensors,\n inputShapes: Object.keys(inputs).map(\n key => inputs[key] != null ? inputs[key].shape : null),\n outputShapes: outputs.map(item => item.shape),\n kernelTimeMs: kernelProfile.timeMs,\n extraInfo: kernelProfile.extraInfo\n });\n }\n return (Array.isArray(out) ? outputs : outputs[0]) as T;\n }\n\n /**\n * Saves tensors used in forward mode for use in backward mode.\n *\n * @param tensors the list of tensors to save.\n */\n private saveTensorsForBackwardMode(tensors: Tensor[]): Tensor[] {\n const saved = tensors.map(tensor => this.keep(this.clone(tensor)));\n return saved;\n }\n\n /**\n * Returns a list of tensors to save for a given gradient calculation.\n *\n * @param kernelName name of kernel to look up gradient for.\n * @param inputs a map of input tensors.\n * @param outputs an array of output tensors from forward mode of kernel.\n */\n private getTensorsForGradient(\n kernelName: string, inputs: NamedTensorMap,\n outputs: Tensor[]): Tensor[]|null {\n const gradConfig = getGradient(kernelName);\n if (gradConfig != null) {\n const inputsToSave: string[] = gradConfig.inputsToSave || [];\n const outputsToSave: boolean[] = gradConfig.outputsToSave || [];\n\n // If saveAllInputs is true, all inputs will be saved. Otherwise, inputs\n // specified in inputsToSave will be saved.\n let inputTensorsToSave: Tensor[];\n if (gradConfig.saveAllInputs) {\n util.assert(\n Array.isArray(inputs),\n () => 'saveAllInputs is true, expected inputs to be an array.');\n\n inputTensorsToSave = Object.keys(inputs).map((key) => inputs[key]);\n } else {\n inputTensorsToSave = inputsToSave.map((inputName) => inputs[inputName]);\n }\n\n const outputTensorsToSave: Tensor[] =\n outputs.filter((_, i) => outputsToSave[i]);\n\n return inputTensorsToSave.concat(outputTensorsToSave);\n }\n // We return an empty list rather than throw an error because the kernel we\n // are looking up may not actually be relevant to backproping through the\n // overall function\n //\n // See 'does not error if irrelevant (pruned) ops are missing grads' test\n // in gradients_test.ts for an example.\n return [];\n }\n\n /**\n * Internal method used by public APIs for tensor creation. Makes a new\n * tensor with the provided shape, dtype and values. It always\n * creates a new data id and writes the values to the underlying backend.\n */\n makeTensor(\n values: DataValues, shape: number[], dtype: DataType,\n backend?: KernelBackend): Tensor {\n if (values == null) {\n throw new Error('Values passed to engine.makeTensor() are null');\n }\n dtype = dtype || 'float32';\n backend = backend || this.backend;\n let backendVals = values as BackendValues;\n if (dtype === 'string' && util.isString(values[0])) {\n backendVals = (values as string[]).map(d => util.encodeString(d));\n }\n const dataId = backend.write(backendVals, shape, dtype);\n const t = new Tensor(shape, dtype, dataId, this.nextTensorId());\n this.trackTensor(t, backend);\n\n // Count bytes for string tensors.\n if (dtype === 'string') {\n const info = this.state.tensorInfo.get(dataId);\n const newBytes = bytesFromStringArray(backendVals as Uint8Array[]);\n this.state.numBytes += newBytes - info.bytes;\n info.bytes = newBytes;\n }\n return t;\n }\n\n /**\n * Internal method used by backends. Makes a new tensor\n * that is a wrapper around an existing data id. It doesn't create\n * a new data id, only increments the ref count used in memory tracking.\n * @deprecated\n */\n makeTensorFromDataId(\n dataId: DataId, shape: number[], dtype: DataType,\n backend?: KernelBackend): Tensor {\n dtype = dtype || 'float32';\n const tensorInfo: TensorInfo = {dataId, shape, dtype};\n return this.makeTensorFromTensorInfo(tensorInfo, backend);\n }\n\n /**\n * Internal method used by backends. Makes a new tensor that is a wrapper\n * around an existing data id in TensorInfo. It doesn't create a new data id,\n * only increments the ref count used in memory tracking.\n */\n makeTensorFromTensorInfo(tensorInfo: TensorInfo, backend?: KernelBackend):\n Tensor {\n const {dataId, shape, dtype} = tensorInfo;\n const t = new Tensor(shape, dtype, dataId, this.nextTensorId());\n this.trackTensor(t, backend);\n return t;\n }\n\n makeVariable(\n initialValue: Tensor, trainable = true, name?: string,\n dtype?: DataType): Variable {\n name = name || this.nextVariableId().toString();\n if (dtype != null && dtype !== initialValue.dtype) {\n initialValue = initialValue.cast(dtype);\n }\n const v = new Variable(initialValue, trainable, name, this.nextTensorId());\n if (this.state.registeredVariables[v.name] != null) {\n throw new Error(`Variable with name ${v.name} was already registered`);\n }\n this.state.registeredVariables[v.name] = v;\n this.incRef(v, this.backend);\n return v;\n }\n\n trackTensor(a: Tensor, backend: KernelBackend): void {\n this.state.numTensors++;\n if (a.dtype === 'string') {\n this.state.numStringTensors++;\n }\n // Bytes for complex numbers are counted by their components. Bytes for\n // string tensors are counted when writing values.\n let bytes = 0;\n if (a.dtype !== 'complex64' && a.dtype !== 'string') {\n bytes = a.size * util.bytesPerElement(a.dtype);\n }\n this.state.numBytes += bytes;\n\n if (!this.state.tensorInfo.has(a.dataId)) {\n this.state.numDataBuffers++;\n this.state.tensorInfo.set(a.dataId, {\n backend: backend || this.backend,\n dtype: a.dtype,\n shape: a.shape,\n bytes\n });\n }\n\n if (!(a instanceof Variable)) {\n this.track(a);\n }\n }\n\n // Track the tensor by dataId and increase the refCount for the dataId in the\n // backend.\n // TODO(pyu10055): This is currently used by makeVariable method, to increase\n // refCount on the backend for the dataId. It can potentially be replaced with\n // Identity op indead of calling backend directly.\n incRef(a: Tensor, backend: KernelBackend): void {\n this.trackTensor(a, backend);\n this.backend.incRef(a.dataId);\n }\n\n removeDataId(dataId: DataId, backend: KernelBackend) {\n if (this.state.tensorInfo.has(dataId) &&\n this.state.tensorInfo.get(dataId).backend === backend) {\n this.state.tensorInfo.delete(dataId);\n this.state.numDataBuffers--;\n }\n }\n disposeTensor(a: Tensor): void {\n if (!this.state.tensorInfo.has(a.dataId)) {\n return;\n }\n const info = this.state.tensorInfo.get(a.dataId);\n\n this.state.numTensors--;\n if (a.dtype === 'string') {\n this.state.numStringTensors--;\n this.state.numBytes -= info.bytes;\n }\n // Don't count bytes for complex numbers as they are counted by their\n // components.\n if (a.dtype !== 'complex64' && a.dtype !== 'string') {\n const bytes = a.size * util.bytesPerElement(a.dtype);\n this.state.numBytes -= bytes;\n }\n\n // Remove the reference to dataId if backend dispose the data successfully\n if (info.backend.disposeData(a.dataId)) {\n this.removeDataId(a.dataId, info.backend);\n }\n\n // TODO(nsthorat): Construct an error and save the stack trace for\n // debugging when in debug mode. Creating a stack trace is too expensive\n // to do unconditionally.\n }\n\n disposeVariables(): void {\n for (const varName in this.state.registeredVariables) {\n const v = this.state.registeredVariables[varName];\n this.disposeVariable(v);\n }\n }\n\n disposeVariable(v: Variable): void {\n this.disposeTensor(v);\n if (this.state.registeredVariables[v.name] != null) {\n delete this.state.registeredVariables[v.name];\n }\n }\n\n memory(): MemoryInfo {\n const info = this.backend.memory() as MemoryInfo;\n info.numTensors = this.state.numTensors;\n info.numDataBuffers = this.state.numDataBuffers;\n info.numBytes = this.state.numBytes;\n if (this.state.numStringTensors > 0) {\n info.unreliable = true;\n if (info.reasons == null) {\n info.reasons = [];\n }\n info.reasons.push(\n 'Memory usage by string tensors is approximate ' +\n '(2 bytes per character)');\n }\n return info;\n }\n\n async profile(query: () => (TensorContainer | Promise)):\n Promise {\n this.state.profiling = true;\n\n const startBytes = this.state.numBytes;\n const startNumTensors = this.state.numTensors;\n\n this.state.activeProfile.kernels = [];\n this.state.activeProfile.result = await query();\n\n this.state.profiling = false;\n\n this.state.activeProfile.peakBytes = Math.max(\n ...this.state.activeProfile.kernels.map(d => d.totalBytesSnapshot));\n this.state.activeProfile.newBytes = this.state.numBytes - startBytes;\n this.state.activeProfile.newTensors =\n this.state.numTensors - startNumTensors;\n for (const kernel of this.state.activeProfile.kernels) {\n kernel.kernelTimeMs = await kernel.kernelTimeMs;\n kernel.extraInfo = await kernel.extraInfo;\n }\n return this.state.activeProfile;\n }\n\n isTapeOn(): boolean {\n return this.state.gradientDepth > 0 && this.state.kernelDepth === 0;\n }\n\n private addTapeNode(\n kernelName: string, inputs: NamedTensorMap, outputs: Tensor[],\n gradientsFunc: GradFunc, saved: Tensor[], attrs: NamedAttrMap): void {\n const tapeNode: TapeNode =\n {id: this.state.nextTapeNodeId++, kernelName, inputs, outputs, saved};\n\n const gradConfig = getGradient(kernelName);\n if (gradConfig != null) {\n gradientsFunc = gradConfig.gradFunc;\n }\n if (gradientsFunc != null) {\n tapeNode.gradient = (dys: Tensor[]) => {\n // TODO(smilkov): To optimize back-prop, pass dys that are not used in\n // the backprop graph to the user as null instead of zeros\n dys = dys.map((dy, i) => {\n if (dy == null) {\n const output = outputs[i];\n const vals = util.makeZerosTypedArray(output.size, output.dtype);\n return this.makeTensor(vals, output.shape, output.dtype);\n }\n return dy;\n });\n // Grad functions of ops with single outputs expect a dy, while ops\n // with multiple outputs expect dys (array of dy).\n return gradientsFunc(dys.length > 1 ? dys : dys[0], saved, attrs);\n };\n }\n this.state.activeTape.push(tapeNode);\n }\n\n keep(result: T): T {\n result.kept = true;\n return result;\n }\n\n private startTape() {\n if (this.state.gradientDepth === 0) {\n this.state.activeTape = [];\n }\n this.state.gradientDepth++;\n }\n\n private endTape() {\n this.state.gradientDepth--;\n }\n\n /**\n * Start a scope. Use this with endScope() to achieve the same functionality\n * as scope() without the need for a function closure.\n */\n startScope(name?: string) {\n const scopeInfo: ScopeState = {\n track: [],\n name: 'unnamed scope',\n id: this.state.nextScopeId++\n };\n if (name) {\n scopeInfo.name = name;\n }\n this.state.scopeStack.push(scopeInfo);\n this.state.activeScope = scopeInfo;\n }\n\n /**\n * End a scope. Use this with startScope() to achieve the same functionality\n * as scope() without the need for a function closure.\n */\n endScope(result?: TensorContainer) {\n const tensorsToTrackInParent = getTensorsInContainer(result);\n const tensorsToTrackInParentSet =\n new Set(tensorsToTrackInParent.map(t => t.id));\n\n // Dispose the arrays tracked in this scope.\n for (let i = 0; i < this.state.activeScope.track.length; i++) {\n const tensor = this.state.activeScope.track[i];\n if (!tensor.kept && !tensorsToTrackInParentSet.has(tensor.id)) {\n tensor.dispose();\n }\n }\n\n const oldScope = this.state.scopeStack.pop();\n this.state.activeScope = this.state.scopeStack.length === 0 ?\n null :\n this.state.scopeStack[this.state.scopeStack.length - 1];\n\n // Track the current result in the parent scope.\n tensorsToTrackInParent.forEach(tensor => {\n // Only track the tensor if was allocated in the inner scope and is not\n // globally kept.\n if (!tensor.kept && tensor.scopeId === oldScope.id) {\n this.track(tensor);\n }\n });\n }\n\n /**\n * Returns gradients of `f` with respect to each of the `xs`. The gradients\n * returned are of the same length as `xs`, but some might be null if `f`\n * was not a function of that `x`. It also takes optional dy to multiply the\n * gradient, which defaults to `1`.\n */\n gradients(\n f: () => T, xs: Tensor[], dy?: T,\n allowNoGradients = false): {value: T, grads: Tensor[]} {\n util.assert(\n xs.length > 0, () => 'gradients() received an empty list of xs.');\n if (dy != null && dy.dtype !== 'float32') {\n throw new Error(`dy must have 'float32' dtype, but has '${dy.dtype}'`);\n }\n\n const y = this.scopedRun(\n () => this.startTape(), () => this.endTape(),\n () => this.tidy('forward', f));\n\n util.assert(\n y instanceof Tensor,\n () => 'The result y returned by f() must be a tensor.');\n // Filter out the nodes that don't connect x => y.\n const filteredTape = getFilteredNodesXToY(this.state.activeTape, xs, y);\n if (!allowNoGradients && filteredTape.length === 0 && xs.length > 0) {\n throw new Error(\n 'Cannot compute gradient of y=f(x) with respect to x. Make sure ' +\n 'that the f you passed encloses all operations that lead from x ' +\n 'to y.');\n }\n\n return this.tidy('backward', () => {\n const accumulatedGradientMap: {[tensorId: number]: Tensor} = {};\n accumulatedGradientMap[y.id] = (dy == null) ? ones(y.shape) : dy;\n\n // Backprop gradients through the filtered nodes.\n backpropagateGradients(\n accumulatedGradientMap, filteredTape,\n // Pass the tidy function to avoid circular dep with `tape.ts`.\n f => this.tidy(f as ScopeFn),\n // Pass an add function to avoide a circular dep with `tape.ts`.\n add);\n const grads = xs.map(x => accumulatedGradientMap[x.id]);\n\n if (this.state.gradientDepth === 0) {\n // This means that we are not computing higher-order gradients\n // and can clean up the tape.\n this.state.activeTape.forEach(node => {\n for (const tensor of node.saved) {\n tensor.dispose();\n }\n });\n this.state.activeTape = null;\n }\n return {value: y, grads};\n });\n }\n\n customGrad(f: CustomGradientFunc):\n (...args: Array) => T {\n util.assert(\n util.isFunction(f),\n () => 'The f passed in customGrad(f) must be a function.');\n return (...inputs: Tensor[]): T => {\n util.assert(\n inputs.every(t => t instanceof Tensor),\n () => 'The args passed in customGrad(f)(x1, x2,...) must all be ' +\n 'tensors');\n\n let res: {\n value: T,\n gradFunc: (dy: T, saved: Tensor[]) => Tensor | Tensor[],\n };\n const inputMap: NamedTensorMap = {};\n inputs.forEach((input, i) => {\n inputMap[i] = input;\n });\n\n const forwardFunc: ForwardFunc = (_, save) => {\n res = f(...[...inputs, save]);\n util.assert(\n res.value instanceof Tensor,\n () => 'The function f passed in customGrad(f) must return an ' +\n 'object where `obj.value` is a tensor');\n util.assert(\n util.isFunction(res.gradFunc),\n () => 'The function f passed in customGrad(f) must return an ' +\n 'object where `obj.gradFunc` is a function.');\n return res.value;\n };\n\n const backwardsFunc = (dy: T, saved: Tensor[]) => {\n const gradRes = res.gradFunc(dy, saved);\n const grads: Tensor[] = Array.isArray(gradRes) ? gradRes : [gradRes];\n util.assert(\n grads.length === inputs.length,\n () => 'The function f passed in customGrad(f) must return an ' +\n 'object where `obj.gradFunc` is a function that returns ' +\n 'the same number of tensors as inputs passed to f(...).');\n util.assert(\n grads.every(t => t instanceof Tensor),\n () => 'The function f passed in customGrad(f) must return an ' +\n 'object where `obj.gradFunc` is a function that returns ' +\n 'a list of only tensors.');\n const gradMap: {[key: string]: () => Tensor} = {};\n grads.forEach((grad, i) => {\n gradMap[i] = () => grad;\n });\n return gradMap;\n };\n\n return this.runKernelFunc({\n forwardFunc,\n backwardsFunc,\n inputs: inputMap,\n });\n };\n }\n\n readSync(dataId: DataId): BackendValues {\n // Route the read to the correct backend.\n const info = this.state.tensorInfo.get(dataId);\n return info.backend.readSync(dataId);\n }\n read(dataId: DataId): Promise {\n // Route the read to the correct backend.\n const info = this.state.tensorInfo.get(dataId);\n return info.backend.read(dataId);\n }\n\n readToGPU(dataId: DataId, options?: DataToGPUOptions): GPUData {\n // Route the read to the correct backend.\n const info = this.state.tensorInfo.get(dataId);\n return info.backend.readToGPU(dataId, options);\n }\n\n async time(query: () => void): Promise {\n const start = now();\n const timingInfo = await this.backend.time(query) as TimingInfo;\n timingInfo.wallMs = now() - start;\n return timingInfo;\n }\n\n /**\n * Tracks a Tensor in the current scope to be automatically cleaned up\n * when the current scope ends, and returns the value.\n *\n * @param result The Tensor to track in the current scope.\n */\n private track(result: T): T {\n if (this.state.activeScope != null) {\n result.scopeId = this.state.activeScope.id;\n this.state.activeScope.track.push(result);\n }\n\n return result;\n }\n\n get registeredVariables(): NamedVariableMap {\n return this.state.registeredVariables;\n }\n\n /**\n * Resets the engine state. Removes all backends but does not remove\n * registered backend factories.\n */\n reset(): void {\n // Make any pending promise obsolete.\n this.pendingBackendInitId++;\n\n this.state.dispose();\n this.ENV.reset();\n this.state = new EngineState();\n\n for (const backendName in this.registry) {\n this.disposeRegisteredKernels(backendName);\n this.registry[backendName].dispose();\n delete this.registry[backendName];\n }\n this.backendName = null;\n this.backendInstance = null;\n this.pendingBackendInit = null;\n }\n}\n\nfunction ones(shape: number[]): Tensor {\n const values = makeOnesTypedArray(sizeFromShape(shape), 'float32');\n return ENGINE.makeTensor(values, shape, 'float32');\n}\n\nexport function getOrMakeEngine(): Engine {\n const ns = getGlobalNamespace() as {} as {_tfengine: Engine};\n if (ns._tfengine == null) {\n const environment = new Environment(ns);\n ns._tfengine = new Engine(environment);\n }\n setEnvironmentGlobal(ns._tfengine.ENV);\n\n // Tell the current tensor interface that the global engine is responsible\n // for tracking.\n setTensorTracker(() => ns._tfengine);\n return ns._tfengine;\n}\n\nexport const ENGINE = getOrMakeEngine();\n\n/**\n * A implementation of the add op for use within engine and tape.\n *\n * This allows us to avoid a circular dependency between add.ts and engine.\n * It is exported to be available in tape tests.\n */\nexport function add(a: Tensor, b: Tensor): Tensor {\n // We duplicate Add here to avoid a circular dependency with add.ts.\n const inputs = {a, b};\n return ENGINE.runKernel(Add, inputs as {} as NamedTensorMap);\n}\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// tslint:disable-next-line:no-any\nfunction _isNavigatorDefined(): boolean {\n return typeof navigator !== 'undefined' && navigator != null;\n}\n\nlet isMobileMockValue: boolean|undefined;\n\nexport function mockIsMobile(value: boolean|undefined) {\n isMobileMockValue = value;\n}\n\nexport function isMobile(nav?: Navigator): boolean {\n if (isMobileMockValue !== undefined) {\n return isMobileMockValue;\n }\n if (nav || _isNavigatorDefined()) {\n if (!nav) {\n nav = navigator;\n }\n if (nav.product === 'ReactNative') {\n return true;\n }\n\n const a = nav.userAgent || nav.vendor ||\n // tslint:disable-next-line:no-any\n (typeof window !== 'undefined' ? (window as any).opera : '');\n // Use `navigator.userAgentData.mobile` as fallback.\n if (!a) {\n // tslint:disable-next-line:no-any\n const navAny = nav as any;\n return navAny.userAgentData && navAny.userAgentData.mobile;\n }\n // tslint:disable-next-line:max-line-length\n return /(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i\n .test(a) ||\n // tslint:disable-next-line:max-line-length\n /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|i230|iac( |\\-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc\\-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|\\-[a-w])|libw|lynx|m1\\-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m\\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\\-2|po(ck|rt|se)|prox|psio|pt\\-g|qa\\-a|qc(07|12|21|32|60|\\-[2-7]|i\\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\\-|oo|p\\-)|sdk\\/|se(c(\\-|0|1)|47|mc|nd|ri)|sgh\\-|shar|sie(\\-|m)|sk\\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\\-|v\\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\\-|tdg\\-|tel(i|m)|tim\\-|t\\-mo|to(pl|sh)|ts(70|m\\-|m3|m5)|tx\\-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\\-|your|zeto|zte\\-/i\n .test(a.substr(0, 4));\n }\n return false;\n}\n\nexport function isBrowser(): boolean {\n return (typeof window !== 'undefined' && window.document != null) ||\n //@ts-ignore\n (typeof WorkerGlobalScope !== 'undefined');\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport './engine';\n\nimport * as device_util from './device_util';\nimport {env} from './environment';\n\nconst ENV = env();\n\n/**\n * This file contains environment-related flag registrations.\n */\n\n/** Whether to enable debug mode. */\nENV.registerFlag('DEBUG', () => false, debugValue => {\n if (debugValue) {\n console.warn(\n 'Debugging mode is ON. The output of every math call will ' +\n 'be downloaded to CPU and checked for NaNs. ' +\n 'This significantly impacts performance.');\n }\n});\n\n/** Whether we are in a browser (as versus, say, node.js) environment. */\nENV.registerFlag('IS_BROWSER', () => device_util.isBrowser());\n\n/** Whether we are in a browser (as versus, say, node.js) environment. */\nENV.registerFlag(\n 'IS_NODE',\n () => (typeof process !== 'undefined') &&\n (typeof process.versions !== 'undefined') &&\n (typeof process.versions.node !== 'undefined'));\n\n/** Whether this browser is Chrome. */\nENV.registerFlag(\n 'IS_CHROME',\n () => typeof navigator !== 'undefined' && navigator != null &&\n navigator.userAgent != null && /Chrome/.test(navigator.userAgent) &&\n /Google Inc/.test(navigator.vendor));\n\n/**\n * True when the environment is \"production\" where we disable safety checks\n * to gain performance.\n */\nENV.registerFlag('PROD', () => false);\n\n/**\n * Whether to do sanity checks when inferring a shape from user-provided\n * values, used when creating a new tensor.\n */\nENV.registerFlag(\n 'TENSORLIKE_CHECK_SHAPE_CONSISTENCY', () => ENV.getBool('DEBUG'));\n\n/** Whether deprecation warnings are enabled. */\nENV.registerFlag('DEPRECATION_WARNINGS_ENABLED', () => true);\n\n/** True if running unit tests. */\nENV.registerFlag('IS_TEST', () => false);\n\n/** Whether to check computation result for errors. */\nENV.registerFlag('CHECK_COMPUTATION_FOR_ERRORS', () => true);\n\n/** Whether the backend needs to wrap input to imageBitmap. */\nENV.registerFlag('WRAP_TO_IMAGEBITMAP', () => false);\n\n/** Experimental flag, whether enter compile only phase. */\nENV.registerFlag('ENGINE_COMPILE_ONLY', () => false);\n\n/** Whether to enable canvas2d willReadFrequently for GPU backends */\nENV.registerFlag('CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU', () => false);\n\n/** Whether to use setTimeoutCustom */\nENV.registerFlag('USE_SETTIMEOUTCUSTOM', () => false);\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from './engine';\nimport {env} from './environment';\nimport {Tensor} from './tensor';\nimport {DataType, TensorLike, WebGLData} from './types';\nimport {assert, flatten, inferDtype, isTypedArray, toTypedArray} from './util';\n\nexport function inferShape(\n val: TensorLike|WebGLData, dtype?: DataType): number[] {\n let firstElem: typeof val = val;\n\n if (isTypedArray(val)) {\n return dtype === 'string' ? [] : [val.length];\n }\n if (typeof val === 'object' && 'texture' in val) {\n const usedChannels = val.channels || 'RGBA';\n return [val.height, val.width * usedChannels.length];\n }\n if (!Array.isArray(val)) {\n return []; // Scalar.\n }\n const shape: number[] = [];\n\n while (Array.isArray(firstElem) ||\n isTypedArray(firstElem) && dtype !== 'string') {\n shape.push(firstElem.length);\n firstElem = firstElem[0];\n }\n if (Array.isArray(val) &&\n env().getBool('TENSORLIKE_CHECK_SHAPE_CONSISTENCY')) {\n deepAssertShapeConsistency(val, shape, []);\n }\n\n return shape;\n}\n\nfunction deepAssertShapeConsistency(\n val: TensorLike, shape: number[], indices: number[]) {\n indices = indices || [];\n if (!(Array.isArray(val)) && !isTypedArray(val)) {\n assert(\n shape.length === 0,\n () => `Element arr[${indices.join('][')}] is a primitive, ` +\n `but should be an array/TypedArray of ${shape[0]} elements`);\n return;\n }\n assert(\n shape.length > 0,\n () => `Element arr[${indices.join('][')}] should be a primitive, ` +\n `but is an array of ${val.length} elements`);\n assert(\n val.length === shape[0],\n () => `Element arr[${indices.join('][')}] should have ${shape[0]} ` +\n `elements, but has ${val.length} elements`);\n const subShape = shape.slice(1);\n for (let i = 0; i < val.length; ++i) {\n deepAssertShapeConsistency(val[i], subShape, indices.concat(i));\n }\n}\n\nfunction assertDtype(\n expectedDtype: DataType|'numeric'|'string_or_numeric',\n actualDType: DataType, argName: string, functionName: string) {\n if (expectedDtype === 'string_or_numeric') {\n return;\n }\n if (expectedDtype == null) {\n throw new Error(`Expected dtype cannot be null.`);\n }\n if (expectedDtype !== 'numeric' && expectedDtype !== actualDType ||\n expectedDtype === 'numeric' && actualDType === 'string') {\n throw new Error(\n `Argument '${argName}' passed to '${functionName}' must ` +\n `be ${expectedDtype} tensor, but got ${actualDType} tensor`);\n }\n}\n\nexport function convertToTensor(\n x: T|TensorLike, argName: string, functionName: string,\n parseAsDtype: DataType|'numeric'|'string_or_numeric' = 'numeric'): T {\n if (x instanceof Tensor) {\n assertDtype(parseAsDtype, x.dtype, argName, functionName);\n return x;\n }\n let inferredDtype = inferDtype(x);\n // If the user expects a bool/int/float, use that info to update the\n // inferredDtype when it is not a string.\n if (inferredDtype !== 'string' &&\n ['bool', 'int32', 'float32'].indexOf(parseAsDtype) >= 0) {\n inferredDtype = parseAsDtype as DataType;\n }\n assertDtype(parseAsDtype, inferredDtype, argName, functionName);\n\n if ((x == null) ||\n (!isTypedArray(x) && !Array.isArray(x) && typeof x !== 'number' &&\n typeof x !== 'boolean' && typeof x !== 'string')) {\n const type = x == null ? 'null' : (x as {}).constructor.name;\n throw new Error(\n `Argument '${argName}' passed to '${functionName}' must be a ` +\n `Tensor or TensorLike, but got '${type}'`);\n }\n const inferredShape = inferShape(x, inferredDtype);\n if (!isTypedArray(x) && !Array.isArray(x)) {\n x = [x] as number[];\n }\n const skipTypedArray = true;\n const values = inferredDtype !== 'string' ?\n toTypedArray(x, inferredDtype as DataType) :\n flatten(x as string[], [], skipTypedArray) as string[];\n return ENGINE.makeTensor(values, inferredShape, inferredDtype) as T;\n}\n\nexport function convertToTensorArray(\n arg: Array, argName: string, functionName: string,\n parseAsDtype: DataType|'numeric'|'string_or_numeric' = 'numeric'): T[] {\n if (!Array.isArray(arg)) {\n throw new Error(\n `Argument ${argName} passed to ${functionName} must be a ` +\n '`Tensor[]` or `TensorLike[]`');\n }\n const tensors = arg as T[];\n return tensors.map(\n (t, i) =>\n convertToTensor(t, `${argName}[${i}]`, functionName, parseAsDtype));\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {isPromise} from '../util';\n\nexport const OP_SCOPE_SUFFIX = '__op';\n\n/**\n * Used for wrapping functions that perform math operations on\n * Tensors. The function will be wrapped in a named scope that cleans all\n * memory usage after the function is done.\n */\nexport function op(f: {[name: string]: T}): T {\n const keys = Object.keys(f);\n if (keys.length !== 1) {\n throw new Error(\n `Please provide an object with a single key ` +\n `(operation name) mapping to a function. Got an object with ` +\n `${keys.length} keys.`);\n }\n\n let opName = keys[0];\n const fn = f[opName];\n\n // Strip the underscore from the end of the function name.\n if (opName.endsWith('_')) {\n opName = opName.substring(0, opName.length - 1);\n }\n\n // add an __op suffix to distinguish ops from kernels in tf.profile\n opName = opName + OP_SCOPE_SUFFIX;\n\n // tslint:disable-next-line:no-any\n const f2 = (...args: any[]) => {\n ENGINE.startScope(opName);\n try {\n const result = fn(...args);\n if (isPromise(result)) {\n console.error('Cannot return a Promise inside of tidy.');\n }\n ENGINE.endScope(result);\n return result;\n } catch (ex) {\n ENGINE.endScope(null);\n throw ex;\n }\n };\n Object.defineProperty(f2, 'name', {value: opName, configurable: true});\n\n // tslint:disable-next-line:no-any\n return f2 as any as T;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Complex, ComplexInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\n\n/**\n * Converts two real numbers to a complex number.\n *\n * Given a tensor `real` representing the real part of a complex number, and a\n * tensor `imag` representing the imaginary part of a complex number, this\n * operation returns complex numbers elementwise of the form [r0, i0, r1, i1],\n * where r represents the real part and i represents the imag part.\n *\n * The input tensors real and imag must have the same shape.\n *\n * ```js\n * const real = tf.tensor1d([2.25, 3.25]);\n * const imag = tf.tensor1d([4.75, 5.75]);\n * const complex = tf.complex(real, imag);\n *\n * complex.print();\n * ```\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nfunction complex_(real: T|TensorLike, imag: T|TensorLike): T {\n const $real = convertToTensor(real, 'real', 'complex');\n const $imag = convertToTensor(imag, 'imag', 'complex');\n util.assertShapesMatch(\n $real.shape, $imag.shape,\n `real and imag shapes, ${$real.shape} and ${$imag.shape}, ` +\n `must match in call to tf.complex().`);\n\n const inputs: ComplexInputs = {real: $real, imag: $imag};\n return ENGINE.runKernel(Complex, inputs as {} as NamedTensorMap);\n}\n\nexport const complex = op({complex_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Tensor} from '../tensor';\nimport {TensorLike, TypedArray, WebGLData} from '../types';\nimport {DataType} from '../types';\nimport {assert, assertNonNegativeIntegerDimensions, flatten, inferDtype, isTypedArray, sizeFromShape, toTypedArray} from '../util';\n\n/** This is shared code across all tensor creation methods. */\nexport function makeTensor(\n values: TensorLike|WebGLData, shape: number[], inferredShape: number[],\n dtype?: DataType): Tensor {\n if (dtype == null) {\n dtype = inferDtype(values);\n }\n if (dtype === 'complex64') {\n throw new Error(\n `Cannot construct a complex64 tensor directly. ` +\n `Please use tf.complex(real, imag).`);\n }\n if (typeof values === 'object' && 'texture' in values) {\n if (dtype !== 'float32' && dtype !== 'int32') {\n throw new Error(\n `Creating tensor from texture only supports ` +\n `'float32'|'int32' dtype, while the dtype is ${dtype}.`);\n }\n values.channels = values.channels || 'RGBA';\n return ENGINE.backend.createTensorFromTexture(\n values, shape || inferredShape, dtype);\n }\n if (!isTypedArray(values) && !Array.isArray(values) &&\n typeof values !== 'number' && typeof values !== 'boolean' &&\n typeof values !== 'string') {\n throw new Error(\n 'values passed to tensor(values) must be a number/boolean/string or ' +\n 'an array of numbers/booleans/strings, or a TypedArray');\n }\n // Verify that the shape matches the inferred shape.\n if (shape != null) {\n assertNonNegativeIntegerDimensions(shape);\n\n const providedSize = sizeFromShape(shape);\n const inferredSize = sizeFromShape(inferredShape);\n assert(\n providedSize === inferredSize,\n () =>\n `Based on the provided shape, [${shape}], the tensor should have ` +\n `${providedSize} values but has ${inferredSize}`);\n\n for (let i = 0; i < inferredShape.length; ++i) {\n const inferred = inferredShape[i];\n const flatDimsDontMatch = i === inferredShape.length - 1 ?\n inferred !== sizeFromShape(shape.slice(i)) :\n true;\n assert(\n inferredShape[i] === shape[i] || !flatDimsDontMatch,\n () => `Error creating a new Tensor. Inferred shape ` +\n `(${inferredShape}) does not match the provided ` +\n `shape (${shape}). `);\n }\n }\n\n if (!isTypedArray(values) && !Array.isArray(values)) {\n values = [values] as number[];\n }\n\n shape = shape || inferredShape;\n values = dtype !== 'string' ?\n toTypedArray(values, dtype) :\n flatten(values as string[], [], true) as string[];\n return ENGINE.makeTensor(values as TypedArray, shape, dtype);\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport {inferShape} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {DataType, Rank, ShapeMap, WebGLData} from '../types';\n\nimport {makeTensor} from './tensor_ops_util';\n\n/**\n * Creates a `tf.Tensor` with the provided values, shape and dtype.\n *\n * ```js\n * // Pass an array of values to create a vector.\n * tf.tensor([1, 2, 3, 4]).print();\n * ```\n *\n * ```js\n * // Pass a nested array of values to make a matrix or a higher\n * // dimensional tensor.\n * tf.tensor([[1, 2], [3, 4]]).print();\n * ```\n *\n * ```js\n * // Pass a flat array and specify a shape yourself.\n * tf.tensor([1, 2, 3, 4], [2, 2]).print();\n * ```\n *\n * ```js\n * // Pass a `WebGLData` object and specify a shape yourself.\n *\n * // This makes it possible for TF.js applications to avoid GPU / CPU sync.\n * // For example, if your application includes a preprocessing step on the GPU,\n * // you could upload the GPU output directly to TF.js, rather than first\n * // downloading the values.\n *\n * // Example for WebGL2:\n * const customCanvas = document.createElement('canvas');\n * const customBackend = new tf.MathBackendWebGL(customCanvas);\n * tf.registerBackend('custom-webgl', () => customBackend);\n * await tf.setBackend('custom-webgl');\n * const gl = customBackend.gpgpu.gl;\n * const texture = gl.createTexture();\n * const tex2d = gl.TEXTURE_2D;\n * const width = 2;\n * const height = 2;\n *\n * gl.bindTexture(tex2d, texture);\n * gl.texParameteri(tex2d, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n * gl.texParameteri(tex2d, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n * gl.texParameteri(tex2d, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n * gl.texParameteri(tex2d, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n * gl.texImage2D(\n * tex2d, 0, gl.RGBA32F, // internalFormat\n * width, height, 0,\n * gl.RGBA, // textureFormat\n * gl.FLOAT, // textureType\n * new Float32Array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])\n * );\n *\n * // Currently, the `texture` has 4 pixels:\n * // Pixel0 is {R:0, G:1, B:2, A:3}\n * // Pixel1 is {R:4, G:5, B:6, A:7}\n * // Pixel2 is {R:8, G:9, B:10, A:11}\n * // Pixel3 is {R:12, G:13, B:14, A:15}\n *\n * const logicalShape = [height * width * 2];\n * const a = tf.tensor({texture, height, width, channels: 'BR'}, logicalShape);\n * // Tensor value will be [2, 0, 6, 4, 10, 8, 14, 12], since [2, 0] is the\n * // values of 'B' and 'R' channels of Pixel0, [6, 4] is the values of 'B' and\n * 'R'\n * // channels of Pixel1...\n *\n * // For postprocessing on the GPU, it's possible to retrieve the texture\n * // backing any tensor by calling the tensor's `dataToGPU` method like\n * // so:\n *\n * const tex = a.dataToGPU();\n * ```\n * @param values The values of the tensor. Can be nested array of numbers,\n * or a flat array, or a `TypedArray`, or a `WebGLData` object. If the\n * values are strings, they will be encoded as utf-8 and kept as `Uint8Array[]`.\n * If the values is a `WebGLData` object, the dtype could only be 'float32' or\n * 'int32' and the object has to have: 1. texture, a `WebGLTexture`, the texture\n * must share the same `WebGLRenderingContext` with TFJS's WebGL backend (you\n * could create a custom WebGL backend from your texture's canvas) and the\n * internal texture format for the input texture must be floating point or\n * normalized integer; 2. height, the height of the texture; 3. width, the width\n * of the texture; 4. channels, a non-empty subset of 'RGBA', indicating the\n * values of which channels will be passed to the tensor, such as 'R' or 'BR'\n * (The order of the channels affect the order of tensor values. ). (If the\n * values passed from texture is less than the tensor size, zeros will be padded\n * at the rear.)\n * @param shape The shape of the tensor. Optional. If not provided,\n * it is inferred from `values`.\n * @param dtype The data type.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nexport function tensor(\n values: TensorLike|WebGLData, shape?: ShapeMap[R],\n dtype?: DataType): Tensor {\n const inferredShape = inferShape(values, dtype);\n return makeTensor(values, shape, inferredShape, dtype) as Tensor;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/* Type definitions for exporting and importing of models. */\n\n/**\n * A map from Tensor dtype to number of bytes per element of the Tensor.\n */\nexport const DTYPE_VALUE_SIZE_MAP: {[dtype: string]: number} = {\n 'float32': 4,\n 'float16': 2,\n 'int32': 4,\n 'uint16': 2,\n 'uint8': 1,\n 'bool': 1,\n 'complex64': 8\n};\n\n/**\n * A weight manifest.\n *\n * The weight manifest consists of an ordered list of weight-manifest groups.\n * Each weight-manifest group (\"group\" for short hereafter) consists of a\n * number of weight values stored in a number of paths.\n * See the documentation of `WeightManifestGroupConfig` below for more details.\n */\nexport declare type WeightsManifestConfig = WeightsManifestGroupConfig[];\n\n/**\n * A weight-manifest group.\n *\n * Consists of an ordered list of weight values encoded in binary format,\n * stored in an ordered list of paths.\n */\nexport declare interface WeightsManifestGroupConfig {\n /**\n * An ordered list of paths.\n *\n * Paths are intentionally abstract in order to be general. For example, they\n * can be relative URL paths or relative paths on the file system.\n */\n paths: string[];\n\n /**\n * Specifications of the weights stored in the paths.\n */\n weights: WeightsManifestEntry[];\n}\n\n/**\n * Group to which the weight belongs.\n *\n * - 'optimizer': Weight from a stateful optimizer.\n */\nexport type WeightGroup = 'model'|'optimizer';\n\n/**\n * An entry in the weight manifest.\n *\n * The entry contains specification of a weight.\n */\nexport declare interface WeightsManifestEntry {\n /**\n * Name of the weight, e.g., 'Dense_1/bias'\n */\n name: string;\n\n /**\n * Shape of the weight.\n */\n shape: number[];\n\n /**\n * Data type of the weight.\n */\n dtype: 'float32'|'int32'|'bool'|'string'|'complex64';\n\n /**\n * Type of the weight.\n *\n * Optional.\n *\n * The value 'optimizer' indicates the weight belongs to an optimizer\n * (i.e., used only during model training and not during inference).\n */\n group?: WeightGroup;\n\n /**\n * Information for dequantization of the weight.\n */\n quantization?: {\n scale?: number, // The scaling constant to multiply by.\n min?: number, // The (possibly nudged) minimum weight to add.\n dtype: 'uint16'|'uint8'|'float16' // The dtype of the quantized weights.\n };\n}\n\n/**\n * Options for saving a model.\n * @innamespace io\n */\nexport interface SaveConfig {\n /**\n * Whether to save only the trainable weights of the model, ignoring the\n * non-trainable ones.\n */\n trainableOnly?: boolean;\n\n /**\n * Whether the optimizer will be saved (if exists).\n *\n * Default: `false`.\n */\n includeOptimizer?: boolean;\n}\n\n/**\n * Result of a saving operation.\n */\nexport interface SaveResult {\n /**\n * Information about the model artifacts saved.\n */\n modelArtifactsInfo: ModelArtifactsInfo;\n\n /**\n * HTTP responses from the server that handled the model-saving request (if\n * any). This is applicable only to server-based saving routes.\n */\n responses?: Response[];\n\n /**\n * Error messages and related data (if any).\n */\n errors?: Array<{}|string>;\n}\n\nexport declare interface ModelArtifactsInfo {\n /**\n * Timestamp for when the model is saved.\n */\n dateSaved: Date;\n\n /**\n * TODO (cais,yassogba) consider removing GraphDef as GraphDefs now\n * come in a JSON format and none of our IOHandlers support a non json\n * format. We could conder replacing this with 'Binary' if we want to\n * allow future handlers to save to non json formats (though they will\n * probably want more information than 'Binary').\n * Type of the model topology\n *\n * Type of the model topology\n *\n * Possible values:\n * - JSON: JSON config (human-readable, e.g., Keras JSON).\n * - GraphDef: TensorFlow\n * [GraphDef](https://www.tensorflow.org/extend/tool_developers/#graphdef)\n * protocol buffer (binary).\n */\n modelTopologyType: 'JSON'|'GraphDef';\n\n /**\n * Size of model topology (Keras JSON or GraphDef), in bytes.\n */\n modelTopologyBytes?: number;\n\n /**\n * Size of weight specification or manifest, in bytes.\n */\n weightSpecsBytes?: number;\n\n /**\n * Size of weight value data, in bytes.\n */\n weightDataBytes?: number;\n}\n\n/** Model training configuration. */\nexport declare interface TrainingConfig {\n // TODO(cais): Tighten the typing once keras spec is available to tfjs-core.\n // See\n // tslint:disable-next-line:max-line-length\n // https://github.com/tensorflow/tfjs-layers/blob/master/src/keras_format/training_config.ts\n /** Optimizer used for the model training. */\n optimizer_config: {};\n\n // TODO(cais): Tighten the typing once keras spec is available to tfjs-core.\n /** Loss function(s) for the model's output(s). */\n loss: string|string[]|{[key: string]: string};\n\n // TODO(cais): Tighten the typing once keras spec is available to tfjs-core.\n /** Metric function(s) for the model's output(s). */\n metrics?: string[]|{[key: string]: string};\n\n // TODO(cais): Tighten the typing once keras spec is available to tfjs-core.\n weighted_metrics?: string[];\n\n // TODO(cais): Tighten the typing once keras spec is available to tfjs-core.\n sample_weight_mode?: string;\n\n loss_weights?: number[]|{[key: string]: number};\n}\n\n/**\n * The serialized artifacts of a model, including topology and weights.\n *\n * The `modelTopology`, `trainingConfig`, `weightSpecs` and `weightData` fields\n * of this interface are optional, in order to support topology- or weights-only\n * saving and loading.\n *\n * Note this interface is used internally in IOHandlers. For the file format\n * written to disk as `model.json`, see `ModelJSON`.\n */\nexport declare interface ModelArtifacts {\n /**\n * Model topology.\n *\n * For Keras-style `tf.Model`s, this is a JSON object.\n * For TensorFlow-style models (e.g., `SavedModel`), this is the JSON\n * encoding of the `GraphDef` protocol buffer.\n */\n modelTopology?: {}|ArrayBuffer;\n\n /**\n * Serialized configuration for the model's training.\n */\n trainingConfig?: TrainingConfig;\n\n /**\n * Weight specifications.\n *\n * This corresponds to the weightsData below.\n */\n weightSpecs?: WeightsManifestEntry[];\n\n /**\n * Binary buffer for all weight values concatenated in the order specified\n * by `weightSpecs`.\n */\n weightData?: ArrayBuffer;\n\n /**\n * Hard-coded format name for models saved from TensorFlow.js or converted\n * by TensorFlow.js Converter.\n */\n format?: string;\n\n /**\n * What library is responsible for originally generating this artifact.\n *\n * Used for debugging purposes. E.g., 'TensorFlow.js v1.0.0'.\n */\n generatedBy?: string;\n\n /**\n * What library or tool is responsible for converting the original model\n * to this format, applicable only if the model is output by a converter.\n *\n * Used for debugging purposes. E.g., 'TensorFlow.js Converter v1.0.0'.\n *\n * A value of `null` means the model artifacts are generated without any\n * conversion process (e.g., saved directly from a TensorFlow.js\n * `tf.LayersModel` instance.)\n */\n convertedBy?: string|null;\n\n /**\n * Inputs and outputs signature for saved model.\n */\n signature?: {};\n\n /**\n * User-defined metadata about the model.\n */\n userDefinedMetadata?: {[key: string]: {}};\n\n /**\n * Initializer for the model.\n */\n modelInitializer?: {};\n\n /**\n * Inputs and outputs signature for model initializer.\n */\n initializerSignature?: {};\n}\n\n/**\n * The on-disk format of the `model.json` file.\n *\n * TF.js 1.0 always populates the optional fields when writing model.json.\n * Prior versions did not provide those fields.\n */\nexport declare interface ModelJSON {\n /**\n * Model topology.\n *\n * For Keras-style `tf.Model`s, this is a JSON object.\n * For TensorFlow-style models (e.g., `SavedModel`), this is the JSON\n * encoding of the `GraphDef` protocol buffer.\n */\n modelTopology: {};\n\n /** Model training configuration. */\n trainingConfig?: TrainingConfig;\n\n /**\n * Weights manifest.\n *\n * The weights manifest consists of an ordered list of weight-manifest\n * groups. Each weight-manifest group consists of a number of weight values\n * stored in a number of paths. See the documentation of\n * `WeightsManifestConfig` for more details.\n */\n weightsManifest: WeightsManifestConfig;\n\n /**\n * Hard-coded format name for models saved from TensorFlow.js or converted\n * by TensorFlow.js Converter.\n */\n format?: string;\n\n /**\n * What library is responsible for originally generating this artifact.\n *\n * Used for debugging purposes. E.g., 'TensorFlow.js v1.0.0'.\n */\n generatedBy?: string;\n\n /**\n * What library or tool is responsible for converting the original model\n * to this format, applicable only if the model is output by a converter.\n *\n * Used for debugging purposes. E.g., 'TensorFlow.js Converter v1.0.0'.\n *\n * A value of `null` means the model artifacts are generated without any\n * conversion process (e.g., saved directly from a TensorFlow.js\n * `tf.LayersModel` instance.)\n */\n convertedBy?: string|null;\n\n /**\n * Inputs and outputs signature for saved model.\n */\n signature?: {};\n\n /**\n * User-defined metadata about the model.\n */\n userDefinedMetadata?: {[key: string]: {}};\n\n /**\n * Initializer for the model.\n */\n modelInitializer?: {};\n\n /**\n * Inputs and outputs signature for model initializer.\n */\n initializerSignature?: {};\n}\n\n/**\n * Type definition for handlers of loading operations.\n */\nexport type LoadHandler = () => Promise;\n\n/**\n * Type definition for handlers of saving operations.\n */\nexport type SaveHandler = (modelArtifact: ModelArtifacts) =>\n Promise;\n\n/**\n * Interface for a model import/export handler.\n *\n * The `save` and `load` handlers are both optional, in order to allow handlers\n * that support only saving or loading.\n */\n// tslint:disable-next-line:interface-name\nexport interface IOHandler {\n save?: SaveHandler;\n load?: LoadHandler;\n}\n\n/**\n * Type definition for handlers of synchronous loading operations.\n */\nexport type LoadHandlerSync = () => ModelArtifacts;\n\n/**\n * Type definition for handlers of synchronous saving operations.\n */\nexport type SaveHandlerSync = (modelArtifact: ModelArtifacts) => SaveResult;\n\n/**\n * Interface for a synchronous model import/export handler.\n *\n * The `save` and `load` handlers are both optional, in order to allow handlers\n * that support only saving or loading.\n */\n// tslint:disable-next-line:interface-name\nexport type IOHandlerSync = {\n save?: SaveHandlerSync;\n load?: LoadHandlerSync;\n};\n\n/**\n * An interface for the manager of a model store.\n *\n * A model store is defined as a storage medium on which multiple models can\n * be stored. Each stored model has a unique `path` as its identifier.\n * A `ModelStoreManager` for the store allows actions including\n *\n * - Listing the models stored in the store.\n * - Deleting a model from the store.\n */\nexport interface ModelStoreManager {\n /**\n * List all models in the model store.\n *\n * @returns A dictionary mapping paths of existing models to their\n * model artifacts info. Model artifacts info include type of the model's\n * topology, byte sizes of the topology, weights, etc.\n */\n listModels(): Promise<{[path: string]: ModelArtifactsInfo}>;\n\n /**\n * Remove a model specified by `path`.\n *\n * @param path\n * @returns ModelArtifactsInfo of the deleted model (if and only if deletion\n * is successful).\n * @throws Error if deletion fails, e.g., if no model exists at `path`.\n */\n removeModel(path: string): Promise;\n}\n\n/**\n * Callback for the progress of a long-running action such as an HTTP\n * request for a large binary object.\n *\n * `fraction` should be a number in the [0, 1] interval, indicating how\n * much of the action has completed.\n */\nexport type OnProgressCallback = (fraction: number) => void;\n\n/** @innamespace io */\nexport interface LoadOptions {\n /**\n * RequestInit (options) for HTTP requests.\n *\n * For detailed information on the supported fields, see\n * [https://developer.mozilla.org/en-US/docs/Web/API/Request/Request](\n * https://developer.mozilla.org/en-US/docs/Web/API/Request/Request)\n */\n requestInit?: RequestInit;\n\n /**\n * Progress callback.\n */\n onProgress?: OnProgressCallback;\n\n /**\n * A function used to override the `window.fetch` function.\n */\n fetchFunc?: Function;\n\n /**\n * Strict loading model: whether extraneous weights or missing\n * weights should trigger an `Error`.\n *\n * If `true`, require that the provided weights exactly match those\n * required by the layers. `false` means that both extra weights\n * and missing weights will be silently ignored.\n *\n * Default: `true`.\n */\n strict?: boolean;\n\n /**\n * Path prefix for weight files, by default this is calculated from the\n * path of the model JSON file.\n *\n * For instance, if the path to the model JSON file is\n * `http://localhost/foo/model.json`, then the default path prefix will be\n * `http://localhost/foo/`. If a weight file has the path value\n * `group1-shard1of2` in the weight manifest, then the weight file will be\n * loaded from `http://localhost/foo/group1-shard1of2` by default. However,\n * if you provide a `weightPathPrefix` value of\n * `http://localhost/foo/alt-weights`, then the weight file will be loaded\n * from the path `http://localhost/foo/alt-weights/group1-shard1of2` instead.\n */\n weightPathPrefix?: string;\n\n /**\n * Whether the module or model is to be loaded from TF Hub.\n *\n * Setting this to `true` allows passing a TF-Hub module URL, omitting the\n * standard model file name and the query parameters.\n *\n * Default: `false`.\n */\n fromTFHub?: boolean;\n\n /**\n * An async function to convert weight file name to URL. The weight file\n * names are stored in model.json's weightsManifest.paths field. By default we\n * consider weight files are colocated with the model.json file. For example:\n * model.json URL: https://www.google.com/models/1/model.json\n * group1-shard1of1.bin url:\n * https://www.google.com/models/1/group1-shard1of1.bin\n *\n * With this func you can convert the weight file name to any URL.\n */\n weightUrlConverter?: (weightFileName: string) => Promise;\n}\n\n/**\n * Additional options for Platform.fetch\n */\nexport interface RequestDetails {\n /**\n * Is this request for a binary file (as opposed to a json file)\n */\n isBinary?: boolean;\n}\n","'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n","/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nvar base64 = require('base64-js')\nvar ieee754 = require('ieee754')\nvar isArray = require('isarray')\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\n/*\n * Export kMaxLength after typed array support is determined.\n */\nexports.kMaxLength = kMaxLength()\n\nfunction typedArraySupport () {\n try {\n var arr = new Uint8Array(1)\n arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n if (kMaxLength() < length) {\n throw new RangeError('Invalid typed array length')\n }\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length)\n }\n that.length = length\n }\n\n return that\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype\n return arr\n}\n\nfunction from (that, value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(that, value, encodingOrOffset)\n }\n\n return fromObject(that, value)\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length)\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n if (typeof Symbol !== 'undefined' && Symbol.species &&\n Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n })\n }\n}\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be a number')\n } else if (size < 0) {\n throw new RangeError('\"size\" argument must not be negative')\n }\n}\n\nfunction alloc (that, size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(that, size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(that, size).fill(fill, encoding)\n : createBuffer(that, size).fill(fill)\n }\n return createBuffer(that, size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(null, size, fill, encoding)\n}\n\nfunction allocUnsafe (that, size) {\n assertSize(size)\n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < size; ++i) {\n that[i] = 0\n }\n }\n return that\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(null, size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(null, size)\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding')\n }\n\n var length = byteLength(string, encoding) | 0\n that = createBuffer(that, length)\n\n var actual = that.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n that = that.slice(0, actual)\n }\n\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0\n that = createBuffer(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array, byteOffset, length) {\n array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\\'offset\\' is out of bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\\'length\\' is out of bounds')\n }\n\n if (byteOffset === undefined && length === undefined) {\n array = new Uint8Array(array)\n } else if (length === undefined) {\n array = new Uint8Array(array, byteOffset)\n } else {\n array = new Uint8Array(array, byteOffset, length)\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = array\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromArrayLike(that, array)\n }\n return that\n}\n\nfunction fromObject (that, obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0\n that = createBuffer(that, len)\n\n if (that.length === 0) {\n return that\n }\n\n obj.copy(that, 0, 0, len)\n return that\n }\n\n if (obj) {\n if ((typeof ArrayBuffer !== 'undefined' &&\n obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n if (typeof obj.length !== 'number' || isnan(obj.length)) {\n return createBuffer(that, 0)\n }\n return fromArrayLike(that, obj)\n }\n\n if (obj.type === 'Buffer' && isArray(obj.data)) {\n return fromArrayLike(that, obj.data)\n }\n }\n\n throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength()` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n var buffer = Buffer.allocUnsafe(length)\n var pos = 0\n for (i = 0; i < list.length; ++i) {\n var buf = list[i]\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n buf.copy(buffer, pos)\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n string = '' + string\n }\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n case undefined:\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n var i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n var len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n var len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n var len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return ''\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (!Buffer.isBuffer(target)) {\n throw new TypeError('Argument must be a Buffer')\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart\n var y = end - start\n var len = Math.min(x, y)\n\n var thisCopy = this.slice(thisStart, thisEnd)\n var targetCopy = target.slice(start, end)\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (isNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (Buffer.TYPED_ARRAY_SUPPORT &&\n typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1\n var arrLength = arr.length\n var valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i\n if (dir) {\n var foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n var found = true\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end)\n newBuf.__proto__ = Buffer.prototype\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; ++i) {\n newBuf[i] = this[i + start]\n }\n }\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; ++i) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, start + len),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0)\n if (code < 256) {\n val = code\n }\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n } else if (typeof val === 'number') {\n val = val & 255\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n var i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n var bytes = Buffer.isBuffer(val)\n ? val\n : utf8ToBytes(new Buffer(val, encoding).toString())\n var len = bytes.length\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\nfunction isnan (val) {\n return val !== val // eslint-disable-line no-self-compare\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {complex} from '../ops/complex';\nimport {tensor} from '../ops/tensor';\nimport {NamedTensor, NamedTensorMap} from '../tensor_types';\nimport {TypedArray} from '../types';\nimport {sizeFromShape} from '../util';\n\nimport {DTYPE_VALUE_SIZE_MAP, ModelArtifacts, ModelArtifactsInfo, ModelJSON, WeightGroup, WeightsManifestConfig, WeightsManifestEntry} from './types';\n\n/** Number of bytes reserved for the length of the string. (32bit integer). */\nconst NUM_BYTES_STRING_LENGTH = 4;\n\n/**\n * Encode a map from names to weight values as an ArrayBuffer, along with an\n * `Array` of `WeightsManifestEntry` as specification of the encoded weights.\n *\n * This function does not perform sharding.\n *\n * This function is the reverse of `decodeWeights`.\n *\n * @param tensors A map (\"dict\") from names to tensors.\n * @param group Group to which the weights belong (optional).\n * @returns A `Promise` of\n * - A flat `ArrayBuffer` with all the binary values of the `Tensor`s\n * concatenated.\n * - An `Array` of `WeightManifestEntry`s, carrying information including\n * tensor names, `dtype`s and shapes.\n * @throws Error: on unsupported tensor `dtype`.\n */\nexport async function encodeWeights(\n tensors: NamedTensorMap|NamedTensor[], group?: WeightGroup):\n Promise<{data: ArrayBuffer, specs: WeightsManifestEntry[]}> {\n // TODO(adarob, cais): Support quantization.\n const specs: WeightsManifestEntry[] = [];\n const dataPromises: Array> = [];\n\n const names: string[] = Array.isArray(tensors) ?\n tensors.map(tensor => tensor.name) :\n Object.keys(tensors);\n\n for (let i = 0; i < names.length; ++i) {\n const name = names[i];\n const t = Array.isArray(tensors) ? tensors[i].tensor : tensors[name];\n if (t.dtype !== 'float32' && t.dtype !== 'int32' && t.dtype !== 'bool' &&\n t.dtype !== 'string' && t.dtype !== 'complex64') {\n throw new Error(`Unsupported dtype in weight '${name}': ${t.dtype}`);\n }\n const spec: WeightsManifestEntry = {name, shape: t.shape, dtype: t.dtype};\n if (t.dtype === 'string') {\n const utf8bytes = new Promise(async resolve => {\n const vals = await t.bytes() as Uint8Array[];\n const totalNumBytes = vals.reduce((p, c) => p + c.length, 0) +\n NUM_BYTES_STRING_LENGTH * vals.length;\n const bytes = new Uint8Array(totalNumBytes);\n let offset = 0;\n for (let i = 0; i < vals.length; i++) {\n const val = vals[i];\n const bytesOfLength =\n new Uint8Array(new Uint32Array([val.length]).buffer);\n bytes.set(bytesOfLength, offset);\n offset += NUM_BYTES_STRING_LENGTH;\n bytes.set(val, offset);\n offset += val.length;\n }\n resolve(bytes);\n });\n dataPromises.push(utf8bytes);\n } else {\n dataPromises.push(t.data());\n }\n if (group != null) {\n spec.group = group;\n }\n specs.push(spec);\n }\n\n const tensorValues = await Promise.all(dataPromises);\n return {data: concatenateTypedArrays(tensorValues), specs};\n}\n\n/**\n * Decode flat ArrayBuffer as weights.\n *\n * This function does not handle sharding.\n *\n * This function is the reverse of `encodeWeights`.\n *\n * @param buffer A flat ArrayBuffer carrying the binary values of the tensors\n * concatenated in the order specified in `specs`.\n * @param specs Specifications of the names, dtypes and shapes of the tensors\n * whose value are encoded by `buffer`.\n * @return A map from tensor name to tensor value, with the names corresponding\n * to names in `specs`.\n * @throws Error, if any of the tensors has unsupported dtype.\n */\nexport function decodeWeights(\n buffer: ArrayBuffer, specs: WeightsManifestEntry[]): NamedTensorMap {\n // TODO(adarob, cais): Support quantization.\n const out: NamedTensorMap = {};\n let float16Decode: (buffer: Uint16Array) => Float32Array | undefined;\n let offset = 0;\n for (const spec of specs) {\n const name = spec.name;\n const dtype = spec.dtype;\n const shape = spec.shape;\n const size = sizeFromShape(shape);\n let values: TypedArray|string[]|Uint8Array[];\n\n if ('quantization' in spec) {\n const quantization = spec.quantization;\n if (quantization.dtype === 'uint8' || quantization.dtype === 'uint16') {\n if (!('min' in quantization && 'scale' in quantization)) {\n throw new Error(\n `Weight ${spec.name} with quantization ${quantization.dtype} ` +\n `doesn't have corresponding metadata min and scale.`);\n }\n } else if (quantization.dtype === 'float16') {\n if (dtype !== 'float32') {\n throw new Error(\n `Weight ${spec.name} is quantized with ${quantization.dtype} ` +\n `which only supports weights of type float32 not ${dtype}.`);\n }\n } else {\n throw new Error(\n `Weight ${spec.name} has unknown ` +\n `quantization dtype ${quantization.dtype}. ` +\n `Supported quantization dtypes are: ` +\n `'uint8', 'uint16', and 'float16'.`);\n }\n const quantizationSizeFactor = DTYPE_VALUE_SIZE_MAP[quantization.dtype];\n const byteBuffer =\n buffer.slice(offset, offset + size * quantizationSizeFactor);\n const quantizedArray = (quantization.dtype === 'uint8') ?\n new Uint8Array(byteBuffer) :\n new Uint16Array(byteBuffer);\n if (dtype === 'float32') {\n if (quantization.dtype === 'uint8' || quantization.dtype === 'uint16') {\n values = new Float32Array(quantizedArray.length);\n for (let i = 0; i < quantizedArray.length; i++) {\n const v = quantizedArray[i];\n values[i] = v * quantization.scale + quantization.min;\n }\n } else if (quantization.dtype === 'float16') {\n if (float16Decode === undefined) {\n float16Decode = getFloat16Decoder();\n }\n values = float16Decode(quantizedArray as Uint16Array);\n } else {\n throw new Error(\n `Unsupported quantization type ${quantization.dtype} ` +\n `for weight type float32.`);\n }\n } else if (dtype === 'int32') {\n if (quantization.dtype !== 'uint8' && quantization.dtype !== 'uint16') {\n throw new Error(\n `Unsupported quantization type ${quantization.dtype} ` +\n `for weight type int32.`);\n }\n values = new Int32Array(quantizedArray.length);\n for (let i = 0; i < quantizedArray.length; i++) {\n const v = quantizedArray[i];\n values[i] = Math.round(v * quantization.scale + quantization.min);\n }\n } else {\n throw new Error(`Unsupported dtype in weight '${name}': ${dtype}`);\n }\n offset += size * quantizationSizeFactor;\n } else if (dtype === 'string') {\n const size = sizeFromShape(spec.shape);\n values = [];\n for (let i = 0; i < size; i++) {\n const byteLength = new Uint32Array(\n buffer.slice(offset, offset + NUM_BYTES_STRING_LENGTH))[0];\n offset += NUM_BYTES_STRING_LENGTH;\n const bytes = new Uint8Array(buffer.slice(offset, offset + byteLength));\n (values as Uint8Array[]).push(bytes);\n offset += byteLength;\n }\n } else {\n const dtypeFactor = DTYPE_VALUE_SIZE_MAP[dtype];\n const byteBuffer = buffer.slice(offset, offset + size * dtypeFactor);\n\n if (dtype === 'float32') {\n values = new Float32Array(byteBuffer);\n } else if (dtype === 'int32') {\n values = new Int32Array(byteBuffer);\n } else if (dtype === 'bool') {\n values = new Uint8Array(byteBuffer);\n } else if (dtype === 'complex64') {\n values = new Float32Array(byteBuffer);\n const real = new Float32Array(values.length / 2);\n const image = new Float32Array(values.length / 2);\n for (let i = 0; i < real.length; i++) {\n real[i] = values[i * 2];\n image[i] = values[i * 2 + 1];\n }\n const realTensor = tensor(real, shape, 'float32');\n const imageTensor = tensor(image, shape, 'float32');\n out[name] = complex(realTensor, imageTensor);\n realTensor.dispose();\n imageTensor.dispose();\n } else {\n throw new Error(`Unsupported dtype in weight '${name}': ${dtype}`);\n }\n offset += size * dtypeFactor;\n }\n if (dtype !== 'complex64') {\n out[name] = tensor(values, shape, dtype);\n }\n }\n return out;\n}\n\n/**\n * Concatenate TypedArrays into an ArrayBuffer.\n */\nexport function concatenateTypedArrays(xs: TypedArray[]): ArrayBuffer {\n // TODO(adarob, cais): Support quantization.\n if (xs === null) {\n throw new Error(`Invalid input value: ${JSON.stringify(xs)}`);\n }\n\n let totalByteLength = 0;\n\n // `normalizedXs` is here for this reason: a `TypedArray`'s `buffer'\n // can have a different byte length from that of the `TypedArray` itself,\n // for example, when the `TypedArray` is created from an offset in an\n // `ArrayBuffer`. `normliazedXs` holds `TypedArray`s whose `buffer`s match\n // the `TypedArray` in byte length. If an element of `xs` does not show\n // this property, a new `TypedArray` that satisfy this property will be\n // constructed and pushed into `normalizedXs`.\n const normalizedXs: TypedArray[] = [];\n xs.forEach((x: TypedArray) => {\n totalByteLength += x.byteLength;\n // tslint:disable:no-any\n normalizedXs.push(\n x.byteLength === x.buffer.byteLength ? x :\n new (x.constructor as any)(x));\n if (!(x as any instanceof Float32Array || x as any instanceof Int32Array ||\n x as any instanceof Uint8Array)) {\n throw new Error(`Unsupported TypedArray subtype: ${x.constructor.name}`);\n }\n // tslint:enable:no-any\n });\n\n const y = new Uint8Array(totalByteLength);\n let offset = 0;\n normalizedXs.forEach((x: TypedArray) => {\n y.set(new Uint8Array(x.buffer), offset);\n offset += x.byteLength;\n });\n\n return y.buffer;\n}\n\n// Use Buffer on Node.js instead of Blob/atob/btoa\nconst useNodeBuffer = typeof Buffer !== 'undefined' &&\n (typeof Blob === 'undefined' || typeof atob === 'undefined' ||\n typeof btoa === 'undefined');\n\n/**\n * Calculate the byte length of a JavaScript string.\n *\n * Note that a JavaScript string can contain wide characters, therefore the\n * length of the string is not necessarily equal to the byte length.\n *\n * @param str Input string.\n * @returns Byte length.\n */\nexport function stringByteLength(str: string): number {\n if (useNodeBuffer) {\n return Buffer.byteLength(str);\n }\n return new Blob([str]).size;\n}\n\n/**\n * Encode an ArrayBuffer as a base64 encoded string.\n *\n * @param buffer `ArrayBuffer` to be converted.\n * @returns A string that base64-encodes `buffer`.\n */\nexport function arrayBufferToBase64String(buffer: ArrayBuffer): string {\n if (useNodeBuffer) {\n return Buffer.from(buffer).toString('base64');\n }\n const buf = new Uint8Array(buffer);\n let s = '';\n for (let i = 0, l = buf.length; i < l; i++) {\n s += String.fromCharCode(buf[i]);\n }\n return btoa(s);\n}\n\n/**\n * Decode a base64 string as an ArrayBuffer.\n *\n * @param str Base64 string.\n * @returns Decoded `ArrayBuffer`.\n */\nexport function base64StringToArrayBuffer(str: string): ArrayBuffer {\n if (useNodeBuffer) {\n const buf = Buffer.from(str, 'base64');\n return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);\n }\n const s = atob(str);\n const buffer = new Uint8Array(s.length);\n for (let i = 0; i < s.length; ++i) {\n buffer.set([s.charCodeAt(i)], i);\n }\n return buffer.buffer;\n}\n\n/**\n * Concatenate a number of ArrayBuffers into one.\n *\n * @param buffers A number of array buffers to concatenate.\n * @returns Result of concatenating `buffers` in order.\n */\nexport function concatenateArrayBuffers(buffers: ArrayBuffer[]): ArrayBuffer {\n if (buffers.length === 1) {\n return buffers[0];\n }\n\n let totalByteLength = 0;\n buffers.forEach((buffer: ArrayBuffer) => {\n totalByteLength += buffer.byteLength;\n });\n\n const temp = new Uint8Array(totalByteLength);\n let offset = 0;\n buffers.forEach((buffer: ArrayBuffer) => {\n temp.set(new Uint8Array(buffer), offset);\n offset += buffer.byteLength;\n });\n return temp.buffer;\n}\n\n/**\n * Get the basename of a path.\n *\n * Behaves in a way analogous to Linux's basename command.\n *\n * @param path\n */\nexport function basename(path: string): string {\n const SEPARATOR = '/';\n path = path.trim();\n while (path.endsWith(SEPARATOR)) {\n path = path.slice(0, path.length - 1);\n }\n const items = path.split(SEPARATOR);\n return items[items.length - 1];\n}\n\n/**\n * Create `ModelJSON` from `ModelArtifacts`.\n *\n * @param artifacts Model artifacts, describing the model and its weights.\n * @param manifest Weight manifest, describing where the weights of the\n * `ModelArtifacts` are stored, and some metadata about them.\n * @returns Object representing the `model.json` file describing the model\n * artifacts and weights\n */\nexport function getModelJSONForModelArtifacts(\n artifacts: ModelArtifacts, manifest: WeightsManifestConfig): ModelJSON {\n const result: ModelJSON = {\n modelTopology: artifacts.modelTopology,\n format: artifacts.format,\n generatedBy: artifacts.generatedBy,\n convertedBy: artifacts.convertedBy,\n weightsManifest: manifest\n };\n if (artifacts.signature != null) {\n result.signature = artifacts.signature;\n }\n if (artifacts.userDefinedMetadata != null) {\n result.userDefinedMetadata = artifacts.userDefinedMetadata;\n }\n if (artifacts.modelInitializer != null) {\n result.modelInitializer = artifacts.modelInitializer;\n }\n if (artifacts.initializerSignature != null) {\n result.initializerSignature = artifacts.initializerSignature;\n }\n if (artifacts.trainingConfig != null) {\n result.trainingConfig = artifacts.trainingConfig;\n }\n return result;\n}\n\n/**\n * Create `ModelArtifacts` from a JSON file and weights.\n *\n * @param modelJSON Object containing the parsed JSON of `model.json`\n * @param weightSpecs The list of WeightsManifestEntry for the model. Must be\n * passed if the modelJSON has a weightsManifest.\n * @param weightData An ArrayBuffer of weight data for the model corresponding\n * to the weights in weightSpecs. Must be passed if the modelJSON has a\n * weightsManifest.\n * @returns A Promise of the `ModelArtifacts`, as described by the JSON file.\n */\nexport function getModelArtifactsForJSONSync(\n modelJSON: ModelJSON, weightSpecs?: WeightsManifestEntry[],\n weightData?: ArrayBuffer): ModelArtifacts {\n\n const modelArtifacts: ModelArtifacts = {\n modelTopology: modelJSON.modelTopology,\n format: modelJSON.format,\n generatedBy: modelJSON.generatedBy,\n convertedBy: modelJSON.convertedBy\n };\n\n if (modelJSON.trainingConfig != null) {\n modelArtifacts.trainingConfig = modelJSON.trainingConfig;\n }\n if (modelJSON.weightsManifest != null) {\n if (!weightSpecs) {\n throw new Error('modelJSON has weightsManifest but weightSpecs is null');\n }\n if (!weightData) {\n throw new Error('modelJSON has weightsManifest but weightData is null');\n }\n modelArtifacts.weightSpecs = weightSpecs;\n modelArtifacts.weightData = weightData;\n }\n if (modelJSON.signature != null) {\n modelArtifacts.signature = modelJSON.signature;\n }\n if (modelJSON.userDefinedMetadata != null) {\n modelArtifacts.userDefinedMetadata = modelJSON.userDefinedMetadata;\n }\n if (modelJSON.modelInitializer != null) {\n modelArtifacts.modelInitializer = modelJSON.modelInitializer;\n }\n if (modelJSON.initializerSignature != null) {\n modelArtifacts.initializerSignature = modelJSON.initializerSignature;\n }\n\n return modelArtifacts;\n}\n\n/**\n * Create `ModelArtifacts` from a JSON file.\n *\n * @param modelJSON Object containing the parsed JSON of `model.json`\n * @param loadWeights Function that takes the JSON file's weights manifest,\n * reads weights from the listed path(s), and returns a Promise of the\n * weight manifest entries along with the weights data.\n * @returns A Promise of the `ModelArtifacts`, as described by the JSON file.\n */\nexport async function getModelArtifactsForJSON(\n modelJSON: ModelJSON,\n loadWeights: (weightsManifest: WeightsManifestConfig) => Promise<[\n /* weightSpecs */ WeightsManifestEntry[], /* weightData */ ArrayBuffer\n ]>): Promise {\n let weightSpecs: WeightsManifestEntry[] | undefined;\n let weightData: ArrayBuffer | undefined;\n\n if (modelJSON.weightsManifest != null) {\n [weightSpecs, weightData] = await loadWeights(modelJSON.weightsManifest);\n }\n\n return getModelArtifactsForJSONSync(modelJSON, weightSpecs, weightData);\n}\n\n/**\n * Populate ModelArtifactsInfo fields for a model with JSON topology.\n * @param modelArtifacts\n * @returns A ModelArtifactsInfo object.\n */\nexport function getModelArtifactsInfoForJSON(modelArtifacts: ModelArtifacts):\n ModelArtifactsInfo {\n if (modelArtifacts.modelTopology instanceof ArrayBuffer) {\n throw new Error('Expected JSON model topology, received ArrayBuffer.');\n }\n\n return {\n dateSaved: new Date(),\n modelTopologyType: 'JSON',\n modelTopologyBytes: modelArtifacts.modelTopology == null ?\n 0 :\n stringByteLength(JSON.stringify(modelArtifacts.modelTopology)),\n weightSpecsBytes: modelArtifacts.weightSpecs == null ?\n 0 :\n stringByteLength(JSON.stringify(modelArtifacts.weightSpecs)),\n weightDataBytes: modelArtifacts.weightData == null ?\n 0 :\n modelArtifacts.weightData.byteLength,\n };\n}\n\n/**\n * Concatenate the weights stored in a WeightsManifestConfig into a list of\n * WeightsManifestEntry\n *\n * @param weightsManifest The WeightsManifestConfig to extract weights from.\n * @returns A list of WeightsManifestEntry of the weights in the weightsManifest\n */\nexport function getWeightSpecs(weightsManifest: WeightsManifestConfig):\n WeightsManifestEntry[] {\n const weightSpecs: WeightsManifestEntry[] = [];\n for (const entry of weightsManifest) {\n weightSpecs.push(...entry.weights);\n }\n return weightSpecs;\n}\n\n/**\n * Computes mantisa table for casting Float16 to Float32\n * See http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf\n *\n * @returns Uint32Array, 2048 mantissa lookup values.\n */\nfunction computeFloat16MantisaTable(): Uint32Array {\n const convertMantissa = (i: number): number => {\n let m = i << 13;\n let e = 0;\n\n while ((m & 0x00800000) === 0) {\n e -= 0x00800000;\n m <<= 1;\n }\n m &= ~0x00800000;\n e += 0x38800000;\n\n return m | e;\n };\n\n const mantisaTable = new Uint32Array(2048);\n\n mantisaTable[0] = 0;\n for (let i = 1; i < 1024; i++) {\n mantisaTable[i] = convertMantissa(i);\n }\n for (let i = 1024; i < 2048; i++) {\n mantisaTable[i] = 0x38000000 + ((i - 1024) << 13);\n }\n\n return mantisaTable;\n}\n\n/**\n * Computes exponent table for casting Float16 to Float32\n * See http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf\n *\n * @returns Uint32Array, 64 exponent lookup values.\n */\nfunction computeFloat16ExponentTable(): Uint32Array {\n const exponentTable = new Uint32Array(64);\n\n exponentTable[0] = 0;\n exponentTable[31] = 0x47800000;\n exponentTable[32] = 0x80000000;\n exponentTable[63] = 0xc7800000;\n for (let i = 1; i < 31; i++) {\n exponentTable[i] = i << 23;\n }\n for (let i = 33; i < 63; i++) {\n exponentTable[i] = 0x80000000 + ((i - 32) << 23);\n }\n\n return exponentTable;\n}\n\n/**\n * Computes offset table for casting Float16 to Float32\n * See http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf\n *\n * @returns Uint32Array, 6d offset values.\n */\nfunction computeFloat16OffsetTable(): Uint32Array {\n const offsetTable = new Uint32Array(64);\n\n for (let i = 0; i < 64; i++) {\n offsetTable[i] = 1024;\n }\n offsetTable[0] = offsetTable[32] = 0;\n\n return offsetTable;\n}\n\n/**\n * Retrieve a Float16 decoder which will decode a ByteArray of Float16 values\n * to a Float32Array.\n *\n * @returns Function (buffer: Uint16Array) => Float32Array which decodes\n * the Uint16Array of Float16 bytes to a Float32Array.\n */\nexport function getFloat16Decoder(): (buffer: Uint16Array) => Float32Array {\n // Algorithm is based off of\n // http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf\n\n // Cache lookup tables\n const mantisaTable = computeFloat16MantisaTable();\n const exponentTable = computeFloat16ExponentTable();\n const offsetTable = computeFloat16OffsetTable();\n\n return (quantizedArray: Uint16Array) => {\n const buffer = new ArrayBuffer(4 * quantizedArray.length);\n const bufferUint32View = new Uint32Array(buffer);\n for (let index = 0; index < quantizedArray.length; index++) {\n const float16Bits = quantizedArray[index];\n const float32Bits =\n mantisaTable[offsetTable[float16Bits >> 10] + (float16Bits & 0x3ff)] +\n exponentTable[float16Bits >> 10];\n bufferUint32View[index] = float32Bits;\n }\n return new Float32Array(buffer);\n };\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {IOHandler, LoadOptions} from './types';\n\nexport type IORouter = (url: string|string[], loadOptions?: LoadOptions) =>\n IOHandler;\n\nexport class IORouterRegistry {\n // Singleton instance.\n private static instance: IORouterRegistry;\n\n private saveRouters: IORouter[];\n private loadRouters: IORouter[];\n\n private constructor() {\n this.saveRouters = [];\n this.loadRouters = [];\n }\n\n private static getInstance(): IORouterRegistry {\n if (IORouterRegistry.instance == null) {\n IORouterRegistry.instance = new IORouterRegistry();\n }\n return IORouterRegistry.instance;\n }\n\n /**\n * Register a save-handler router.\n *\n * @param saveRouter A function that maps a URL-like string onto an instance\n * of `IOHandler` with the `save` method defined or `null`.\n */\n static registerSaveRouter(saveRouter: IORouter) {\n IORouterRegistry.getInstance().saveRouters.push(saveRouter);\n }\n\n /**\n * Register a load-handler router.\n *\n * @param loadRouter A function that maps a URL-like string onto an instance\n * of `IOHandler` with the `load` method defined or `null`.\n */\n static registerLoadRouter(loadRouter: IORouter) {\n IORouterRegistry.getInstance().loadRouters.push(loadRouter);\n }\n\n /**\n * Look up IOHandler for saving, given a URL-like string.\n *\n * @param url\n * @returns If only one match is found, an instance of IOHandler with the\n * `save` method defined. If no match is found, `null`.\n * @throws Error, if more than one match is found.\n */\n static getSaveHandlers(url: string|string[]): IOHandler[] {\n return IORouterRegistry.getHandlers(url, 'save');\n }\n\n /**\n * Look up IOHandler for loading, given a URL-like string.\n *\n * @param url\n * @param loadOptions Optional, custom load options.\n * @returns All valid handlers for `url`, given the currently registered\n * handler routers.\n */\n static getLoadHandlers(url: string|string[], loadOptions?: LoadOptions):\n IOHandler[] {\n return IORouterRegistry.getHandlers(url, 'load', loadOptions);\n }\n\n private static getHandlers(\n url: string|string[], handlerType: 'save'|'load',\n loadOptions?: LoadOptions): IOHandler[] {\n const validHandlers: IOHandler[] = [];\n const routers = handlerType === 'load' ?\n IORouterRegistry.getInstance().loadRouters :\n IORouterRegistry.getInstance().saveRouters;\n routers.forEach(router => {\n const handler = router(url, loadOptions);\n if (handler !== null) {\n validHandlers.push(handler);\n }\n });\n return validHandlers;\n }\n}\n\nexport const registerSaveRouter = (loudRouter: IORouter) =>\n IORouterRegistry.registerSaveRouter(loudRouter);\nexport const registerLoadRouter = (loudRouter: IORouter) =>\n IORouterRegistry.registerLoadRouter(loudRouter);\nexport const getSaveHandlers = (url: string|string[]) =>\n IORouterRegistry.getSaveHandlers(url);\nexport const getLoadHandlers =\n (url: string|string[], loadOptions?: LoadOptions) =>\n IORouterRegistry.getLoadHandlers(url, loadOptions);\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport '../flags';\n\nimport {env} from '../environment';\n\nimport {getModelArtifactsInfoForJSON} from './io_utils';\nimport {IORouter, IORouterRegistry} from './router_registry';\nimport {IOHandler, ModelArtifacts, ModelArtifactsInfo, ModelStoreManager, SaveResult} from './types';\n\nconst DATABASE_NAME = 'tensorflowjs';\nconst DATABASE_VERSION = 1;\n\n// Model data and ModelArtifactsInfo (metadata) are stored in two separate\n// stores for efficient access of the list of stored models and their metadata.\n// 1. The object store for model data: topology, weights and weight manifests.\nconst MODEL_STORE_NAME = 'models_store';\n// 2. The object store for ModelArtifactsInfo, including meta-information such\n// as the type of topology (JSON vs binary), byte size of the topology, byte\n// size of the weights, etc.\nconst INFO_STORE_NAME = 'model_info_store';\n\n/**\n * Delete the entire database for tensorflow.js, including the models store.\n */\nexport async function deleteDatabase(): Promise {\n const idbFactory = getIndexedDBFactory();\n\n return new Promise((resolve, reject) => {\n const deleteRequest = idbFactory.deleteDatabase(DATABASE_NAME);\n deleteRequest.onsuccess = () => resolve();\n deleteRequest.onerror = error => reject(error);\n });\n}\n\nfunction getIndexedDBFactory(): IDBFactory {\n if (!env().getBool('IS_BROWSER')) {\n // TODO(cais): Add more info about what IOHandler subtypes are available.\n // Maybe point to a doc page on the web and/or automatically determine\n // the available IOHandlers and print them in the error message.\n throw new Error(\n 'Failed to obtain IndexedDB factory because the current environment' +\n 'is not a web browser.');\n }\n // tslint:disable-next-line:no-any\n const theWindow: any = typeof window === 'undefined' ? self : window;\n const factory = theWindow.indexedDB || theWindow.mozIndexedDB ||\n theWindow.webkitIndexedDB || theWindow.msIndexedDB ||\n theWindow.shimIndexedDB;\n if (factory == null) {\n throw new Error(\n 'The current browser does not appear to support IndexedDB.');\n }\n return factory;\n}\n\nfunction setUpDatabase(openRequest: IDBRequest) {\n const db = openRequest.result as IDBDatabase;\n db.createObjectStore(MODEL_STORE_NAME, {keyPath: 'modelPath'});\n db.createObjectStore(INFO_STORE_NAME, {keyPath: 'modelPath'});\n}\n\n/**\n * IOHandler subclass: Browser IndexedDB.\n *\n * See the doc string of `browserIndexedDB` for more details.\n */\nexport class BrowserIndexedDB implements IOHandler {\n protected readonly indexedDB: IDBFactory;\n protected readonly modelPath: string;\n\n static readonly URL_SCHEME = 'indexeddb://';\n\n constructor(modelPath: string) {\n this.indexedDB = getIndexedDBFactory();\n\n if (modelPath == null || !modelPath) {\n throw new Error(\n 'For IndexedDB, modelPath must not be null, undefined or empty.');\n }\n this.modelPath = modelPath;\n }\n\n async save(modelArtifacts: ModelArtifacts): Promise {\n // TODO(cais): Support saving GraphDef models.\n if (modelArtifacts.modelTopology instanceof ArrayBuffer) {\n throw new Error(\n 'BrowserLocalStorage.save() does not support saving model topology ' +\n 'in binary formats yet.');\n }\n\n return this.databaseAction(this.modelPath, modelArtifacts) as\n Promise;\n }\n\n async load(): Promise {\n return this.databaseAction(this.modelPath) as Promise;\n }\n\n /**\n * Perform database action to put model artifacts into or read model artifacts\n * from IndexedDB object store.\n *\n * Whether the action is put or get depends on whether `modelArtifacts` is\n * specified. If it is specified, the action will be put; otherwise the action\n * will be get.\n *\n * @param modelPath A unique string path for the model.\n * @param modelArtifacts If specified, it will be the model artifacts to be\n * stored in IndexedDB.\n * @returns A `Promise` of `SaveResult`, if the action is put, or a `Promise`\n * of `ModelArtifacts`, if the action is get.\n */\n private databaseAction(modelPath: string, modelArtifacts?: ModelArtifacts):\n Promise {\n return new Promise((resolve, reject) => {\n const openRequest = this.indexedDB.open(DATABASE_NAME, DATABASE_VERSION);\n openRequest.onupgradeneeded = () => setUpDatabase(openRequest);\n\n openRequest.onsuccess = () => {\n const db = openRequest.result;\n\n if (modelArtifacts == null) {\n // Read model out from object store.\n const modelTx = db.transaction(MODEL_STORE_NAME, 'readonly');\n const modelStore = modelTx.objectStore(MODEL_STORE_NAME);\n const getRequest = modelStore.get(this.modelPath);\n getRequest.onsuccess = () => {\n if (getRequest.result == null) {\n db.close();\n return reject(new Error(\n `Cannot find model with path '${this.modelPath}' ` +\n `in IndexedDB.`));\n } else {\n resolve(getRequest.result.modelArtifacts);\n }\n };\n getRequest.onerror = error => {\n db.close();\n return reject(getRequest.error);\n };\n modelTx.oncomplete = () => db.close();\n } else {\n // Put model into object store.\n const modelArtifactsInfo: ModelArtifactsInfo =\n getModelArtifactsInfoForJSON(modelArtifacts);\n // First, put ModelArtifactsInfo into info store.\n const infoTx = db.transaction(INFO_STORE_NAME, 'readwrite');\n let infoStore = infoTx.objectStore(INFO_STORE_NAME);\n const putInfoRequest =\n infoStore.put({modelPath: this.modelPath, modelArtifactsInfo});\n let modelTx: IDBTransaction;\n putInfoRequest.onsuccess = () => {\n // Second, put model data into model store.\n modelTx = db.transaction(MODEL_STORE_NAME, 'readwrite');\n const modelStore = modelTx.objectStore(MODEL_STORE_NAME);\n const putModelRequest = modelStore.put({\n modelPath: this.modelPath,\n modelArtifacts,\n modelArtifactsInfo\n });\n putModelRequest.onsuccess = () => resolve({modelArtifactsInfo});\n putModelRequest.onerror = error => {\n // If the put-model request fails, roll back the info entry as\n // well.\n infoStore = infoTx.objectStore(INFO_STORE_NAME);\n const deleteInfoRequest = infoStore.delete(this.modelPath);\n deleteInfoRequest.onsuccess = () => {\n db.close();\n return reject(putModelRequest.error);\n };\n deleteInfoRequest.onerror = error => {\n db.close();\n return reject(putModelRequest.error);\n };\n };\n };\n putInfoRequest.onerror = error => {\n db.close();\n return reject(putInfoRequest.error);\n };\n infoTx.oncomplete = () => {\n if (modelTx == null) {\n db.close();\n } else {\n modelTx.oncomplete = () => db.close();\n }\n };\n }\n };\n openRequest.onerror = error => reject(openRequest.error);\n });\n }\n}\n\nexport const indexedDBRouter: IORouter = (url: string|string[]) => {\n if (!env().getBool('IS_BROWSER')) {\n return null;\n } else {\n if (!Array.isArray(url) && url.startsWith(BrowserIndexedDB.URL_SCHEME)) {\n return browserIndexedDB(url.slice(BrowserIndexedDB.URL_SCHEME.length));\n } else {\n return null;\n }\n }\n};\nIORouterRegistry.registerSaveRouter(indexedDBRouter);\nIORouterRegistry.registerLoadRouter(indexedDBRouter);\n\n/**\n * Creates a browser IndexedDB IOHandler for saving and loading models.\n *\n * ```js\n * const model = tf.sequential();\n * model.add(\n * tf.layers.dense({units: 1, inputShape: [100], activation: 'sigmoid'}));\n *\n * const saveResult = await model.save('indexeddb://MyModel'));\n * console.log(saveResult);\n * ```\n *\n * @param modelPath A unique identifier for the model to be saved. Must be a\n * non-empty string.\n * @returns An instance of `BrowserIndexedDB` (sublcass of `IOHandler`),\n * which can be used with, e.g., `tf.Model.save`.\n */\nexport function browserIndexedDB(modelPath: string): IOHandler {\n return new BrowserIndexedDB(modelPath);\n}\n\nfunction maybeStripScheme(key: string) {\n return key.startsWith(BrowserIndexedDB.URL_SCHEME) ?\n key.slice(BrowserIndexedDB.URL_SCHEME.length) :\n key;\n}\n\nexport class BrowserIndexedDBManager implements ModelStoreManager {\n private indexedDB: IDBFactory;\n\n constructor() {\n this.indexedDB = getIndexedDBFactory();\n }\n\n async listModels(): Promise<{[path: string]: ModelArtifactsInfo}> {\n return new Promise<{[path: string]: ModelArtifactsInfo}>(\n (resolve, reject) => {\n const openRequest =\n this.indexedDB.open(DATABASE_NAME, DATABASE_VERSION);\n openRequest.onupgradeneeded = () => setUpDatabase(openRequest);\n\n openRequest.onsuccess = () => {\n const db = openRequest.result;\n const tx = db.transaction(INFO_STORE_NAME, 'readonly');\n const store = tx.objectStore(INFO_STORE_NAME);\n // tslint:disable:max-line-length\n // Need to cast `store` as `any` here because TypeScript's DOM\n // library does not have the `getAll()` method even though the\n // method is supported in the latest version of most mainstream\n // browsers:\n // https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/getAll\n // tslint:enable:max-line-length\n // tslint:disable-next-line:no-any\n const getAllInfoRequest = (store as any).getAll() as IDBRequest;\n getAllInfoRequest.onsuccess = () => {\n const out: {[path: string]: ModelArtifactsInfo} = {};\n for (const item of getAllInfoRequest.result) {\n out[item.modelPath] = item.modelArtifactsInfo;\n }\n resolve(out);\n };\n getAllInfoRequest.onerror = error => {\n db.close();\n return reject(getAllInfoRequest.error);\n };\n tx.oncomplete = () => db.close();\n };\n openRequest.onerror = error => reject(openRequest.error);\n });\n }\n\n async removeModel(path: string): Promise {\n path = maybeStripScheme(path);\n return new Promise((resolve, reject) => {\n const openRequest = this.indexedDB.open(DATABASE_NAME, DATABASE_VERSION);\n openRequest.onupgradeneeded = () => setUpDatabase(openRequest);\n\n openRequest.onsuccess = () => {\n const db = openRequest.result;\n const infoTx = db.transaction(INFO_STORE_NAME, 'readwrite');\n const infoStore = infoTx.objectStore(INFO_STORE_NAME);\n\n const getInfoRequest = infoStore.get(path);\n let modelTx: IDBTransaction;\n getInfoRequest.onsuccess = () => {\n if (getInfoRequest.result == null) {\n db.close();\n return reject(new Error(\n `Cannot find model with path '${path}' ` +\n `in IndexedDB.`));\n } else {\n // First, delete the entry in the info store.\n const deleteInfoRequest = infoStore.delete(path);\n const deleteModelData = () => {\n // Second, delete the entry in the model store.\n modelTx = db.transaction(MODEL_STORE_NAME, 'readwrite');\n const modelStore = modelTx.objectStore(MODEL_STORE_NAME);\n const deleteModelRequest = modelStore.delete(path);\n deleteModelRequest.onsuccess = () =>\n resolve(getInfoRequest.result.modelArtifactsInfo);\n deleteModelRequest.onerror = error =>\n reject(getInfoRequest.error);\n };\n // Proceed with deleting model data regardless of whether deletion\n // of info data succeeds or not.\n deleteInfoRequest.onsuccess = deleteModelData;\n deleteInfoRequest.onerror = error => {\n deleteModelData();\n db.close();\n return reject(getInfoRequest.error);\n };\n }\n };\n getInfoRequest.onerror = error => {\n db.close();\n return reject(getInfoRequest.error);\n };\n\n infoTx.oncomplete = () => {\n if (modelTx == null) {\n db.close();\n } else {\n modelTx.oncomplete = () => db.close();\n }\n };\n };\n openRequest.onerror = error => reject(openRequest.error);\n });\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport '../flags';\nimport {env} from '../environment';\n\nimport {assert} from '../util';\nimport {arrayBufferToBase64String, base64StringToArrayBuffer, getModelArtifactsInfoForJSON} from './io_utils';\nimport {IORouter, IORouterRegistry} from './router_registry';\nimport {IOHandler, ModelArtifacts, ModelArtifactsInfo, ModelJSON, ModelStoreManager, SaveResult} from './types';\n\nconst PATH_SEPARATOR = '/';\nconst PATH_PREFIX = 'tensorflowjs_models';\nconst INFO_SUFFIX = 'info';\nconst MODEL_TOPOLOGY_SUFFIX = 'model_topology';\nconst WEIGHT_SPECS_SUFFIX = 'weight_specs';\nconst WEIGHT_DATA_SUFFIX = 'weight_data';\nconst MODEL_METADATA_SUFFIX = 'model_metadata';\n\n/**\n * Purge all tensorflow.js-saved model artifacts from local storage.\n *\n * @returns Paths of the models purged.\n */\nexport function purgeLocalStorageArtifacts(): string[] {\n if (!env().getBool('IS_BROWSER') || typeof window === 'undefined' ||\n typeof window.localStorage === 'undefined') {\n throw new Error(\n 'purgeLocalStorageModels() cannot proceed because local storage is ' +\n 'unavailable in the current environment.');\n }\n const LS = window.localStorage;\n const purgedModelPaths: string[] = [];\n for (let i = 0; i < LS.length; ++i) {\n const key = LS.key(i);\n const prefix = PATH_PREFIX + PATH_SEPARATOR;\n if (key.startsWith(prefix) && key.length > prefix.length) {\n LS.removeItem(key);\n const modelName = getModelPathFromKey(key);\n if (purgedModelPaths.indexOf(modelName) === -1) {\n purgedModelPaths.push(modelName);\n }\n }\n }\n return purgedModelPaths;\n}\n\ntype LocalStorageKeys = {\n /** Key of the localStorage entry storing `ModelArtifactsInfo`. */\n info: string,\n /**\n * Key of the localStorage entry storing the 'modelTopology' key of\n * `model.json`\n */\n topology: string,\n /**\n * Key of the localStorage entry storing the `weightsManifest.weights` entries\n * of `model.json`\n */\n weightSpecs: string,\n /** Key of the localStorage entry storing the weight data in Base64 */\n weightData: string,\n /**\n * Key of the localStorage entry storing the remaining fields of `model.json`\n * @see {@link ModelMetadata}\n */\n modelMetadata: string,\n};\n\ntype ModelMetadata = Omit;\n\nfunction getModelKeys(path: string): LocalStorageKeys {\n return {\n info: [PATH_PREFIX, path, INFO_SUFFIX].join(PATH_SEPARATOR),\n topology: [PATH_PREFIX, path, MODEL_TOPOLOGY_SUFFIX].join(PATH_SEPARATOR),\n weightSpecs: [PATH_PREFIX, path, WEIGHT_SPECS_SUFFIX].join(PATH_SEPARATOR),\n weightData: [PATH_PREFIX, path, WEIGHT_DATA_SUFFIX].join(PATH_SEPARATOR),\n modelMetadata:\n [PATH_PREFIX, path, MODEL_METADATA_SUFFIX].join(PATH_SEPARATOR)\n };\n}\n\nfunction removeItems(keys: LocalStorageKeys): void {\n for (const key of Object.values(keys)) {\n window.localStorage.removeItem(key);\n }\n}\n\n/**\n * Get model path from a local-storage key.\n *\n * E.g., 'tensorflowjs_models/my/model/1/info' --> 'my/model/1'\n *\n * @param key\n */\nfunction getModelPathFromKey(key: string) {\n const items = key.split(PATH_SEPARATOR);\n if (items.length < 3) {\n throw new Error(`Invalid key format: ${key}`);\n }\n return items.slice(1, items.length - 1).join(PATH_SEPARATOR);\n}\n\nfunction maybeStripScheme(key: string) {\n return key.startsWith(BrowserLocalStorage.URL_SCHEME) ?\n key.slice(BrowserLocalStorage.URL_SCHEME.length) :\n key;\n}\n\n/**\n * IOHandler subclass: Browser Local Storage.\n *\n * See the doc string to `browserLocalStorage` for more details.\n */\nexport class BrowserLocalStorage implements IOHandler {\n protected readonly LS: Storage;\n protected readonly modelPath: string;\n protected readonly keys: LocalStorageKeys;\n\n static readonly URL_SCHEME = 'localstorage://';\n\n constructor(modelPath: string) {\n if (!env().getBool('IS_BROWSER') || typeof window === 'undefined' ||\n typeof window.localStorage === 'undefined') {\n // TODO(cais): Add more info about what IOHandler subtypes are\n // available.\n // Maybe point to a doc page on the web and/or automatically determine\n // the available IOHandlers and print them in the error message.\n throw new Error(\n 'The current environment does not support local storage.');\n }\n this.LS = window.localStorage;\n\n if (modelPath == null || !modelPath) {\n throw new Error(\n 'For local storage, modelPath must not be null, undefined or empty.');\n }\n this.modelPath = modelPath;\n this.keys = getModelKeys(this.modelPath);\n }\n\n /**\n * Save model artifacts to browser local storage.\n *\n * See the documentation to `browserLocalStorage` for details on the saved\n * artifacts.\n *\n * @param modelArtifacts The model artifacts to be stored.\n * @returns An instance of SaveResult.\n */\n async save(modelArtifacts: ModelArtifacts): Promise {\n if (modelArtifacts.modelTopology instanceof ArrayBuffer) {\n throw new Error(\n 'BrowserLocalStorage.save() does not support saving model topology ' +\n 'in binary formats yet.');\n } else {\n const topology = JSON.stringify(modelArtifacts.modelTopology);\n const weightSpecs = JSON.stringify(modelArtifacts.weightSpecs);\n\n const modelArtifactsInfo: ModelArtifactsInfo =\n getModelArtifactsInfoForJSON(modelArtifacts);\n\n try {\n this.LS.setItem(this.keys.info, JSON.stringify(modelArtifactsInfo));\n this.LS.setItem(this.keys.topology, topology);\n this.LS.setItem(this.keys.weightSpecs, weightSpecs);\n this.LS.setItem(\n this.keys.weightData,\n arrayBufferToBase64String(modelArtifacts.weightData));\n\n // Note that JSON.stringify doesn't write out keys that have undefined\n // values, so for some keys, we set undefined instead of a null-ish\n // value.\n const metadata: Required = {\n format: modelArtifacts.format,\n generatedBy: modelArtifacts.generatedBy,\n convertedBy: modelArtifacts.convertedBy,\n signature: modelArtifacts.signature != null ?\n modelArtifacts.signature :\n undefined,\n userDefinedMetadata: modelArtifacts.userDefinedMetadata != null ?\n modelArtifacts.userDefinedMetadata :\n undefined,\n modelInitializer: modelArtifacts.modelInitializer != null ?\n modelArtifacts.modelInitializer :\n undefined,\n initializerSignature: modelArtifacts.initializerSignature != null ?\n modelArtifacts.initializerSignature :\n undefined,\n trainingConfig: modelArtifacts.trainingConfig != null ?\n modelArtifacts.trainingConfig :\n undefined\n };\n this.LS.setItem(this.keys.modelMetadata, JSON.stringify(metadata));\n\n return {modelArtifactsInfo};\n } catch (err) {\n // If saving failed, clean up all items saved so far.\n removeItems(this.keys);\n\n throw new Error(\n `Failed to save model '${this.modelPath}' to local storage: ` +\n `size quota being exceeded is a possible cause of this failure: ` +\n `modelTopologyBytes=${modelArtifactsInfo.modelTopologyBytes}, ` +\n `weightSpecsBytes=${modelArtifactsInfo.weightSpecsBytes}, ` +\n `weightDataBytes=${modelArtifactsInfo.weightDataBytes}.`);\n }\n }\n }\n\n /**\n * Load a model from local storage.\n *\n * See the documentation to `browserLocalStorage` for details on the saved\n * artifacts.\n *\n * @returns The loaded model (if loading succeeds).\n */\n async load(): Promise {\n const info =\n JSON.parse(this.LS.getItem(this.keys.info)) as ModelArtifactsInfo;\n if (info == null) {\n throw new Error(\n `In local storage, there is no model with name '${this.modelPath}'`);\n }\n\n if (info.modelTopologyType !== 'JSON') {\n throw new Error(\n 'BrowserLocalStorage does not support loading non-JSON model ' +\n 'topology yet.');\n }\n\n const out: ModelArtifacts = {};\n\n // Load topology.\n const topology = JSON.parse(this.LS.getItem(this.keys.topology));\n if (topology == null) {\n throw new Error(\n `In local storage, the topology of model '${this.modelPath}' ` +\n `is missing.`);\n }\n out.modelTopology = topology;\n\n // Load weight specs.\n const weightSpecs = JSON.parse(this.LS.getItem(this.keys.weightSpecs));\n if (weightSpecs == null) {\n throw new Error(\n `In local storage, the weight specs of model '${this.modelPath}' ` +\n `are missing.`);\n }\n out.weightSpecs = weightSpecs;\n\n // Load meta-data fields.\n const metadataString = this.LS.getItem(this.keys.modelMetadata);\n if (metadataString != null) {\n const metadata = JSON.parse(metadataString) as ModelMetadata;\n out.format = metadata.format;\n out.generatedBy = metadata.generatedBy;\n out.convertedBy = metadata.convertedBy;\n if (metadata.signature != null) {\n out.signature = metadata.signature;\n }\n if (metadata.userDefinedMetadata != null) {\n out.userDefinedMetadata = metadata.userDefinedMetadata;\n }\n if (metadata.modelInitializer != null) {\n out.modelInitializer = metadata.modelInitializer;\n }\n if (metadata.initializerSignature != null) {\n out.initializerSignature = metadata.initializerSignature;\n }\n if (metadata.trainingConfig != null) {\n out.trainingConfig = metadata.trainingConfig;\n }\n }\n\n // Load weight data.\n const weightDataBase64 = this.LS.getItem(this.keys.weightData);\n if (weightDataBase64 == null) {\n throw new Error(\n `In local storage, the binary weight values of model ` +\n `'${this.modelPath}' are missing.`);\n }\n out.weightData = base64StringToArrayBuffer(weightDataBase64);\n\n return out;\n }\n}\n\nexport const localStorageRouter: IORouter = (url: string|string[]) => {\n if (!env().getBool('IS_BROWSER')) {\n return null;\n } else {\n if (!Array.isArray(url) && url.startsWith(BrowserLocalStorage.URL_SCHEME)) {\n return browserLocalStorage(\n url.slice(BrowserLocalStorage.URL_SCHEME.length));\n } else {\n return null;\n }\n }\n};\nIORouterRegistry.registerSaveRouter(localStorageRouter);\nIORouterRegistry.registerLoadRouter(localStorageRouter);\n\n/**\n * Factory function for local storage IOHandler.\n *\n * This `IOHandler` supports both `save` and `load`.\n *\n * For each model's saved artifacts, four items are saved to local storage.\n * - `${PATH_SEPARATOR}/${modelPath}/info`: Contains meta-info about the\n * model, such as date saved, type of the topology, size in bytes, etc.\n * - `${PATH_SEPARATOR}/${modelPath}/topology`: Model topology. For Keras-\n * style models, this is a stringized JSON.\n * - `${PATH_SEPARATOR}/${modelPath}/weight_specs`: Weight specs of the\n * model, can be used to decode the saved binary weight values (see\n * item below).\n * - `${PATH_SEPARATOR}/${modelPath}/weight_data`: Concatenated binary\n * weight values, stored as a base64-encoded string.\n *\n * Saving may throw an `Error` if the total size of the artifacts exceed the\n * browser-specific quota.\n *\n * @param modelPath A unique identifier for the model to be saved. Must be a\n * non-empty string.\n * @returns An instance of `IOHandler`, which can be used with, e.g.,\n * `tf.Model.save`.\n */\nexport function browserLocalStorage(modelPath: string): IOHandler {\n return new BrowserLocalStorage(modelPath);\n}\n\nexport class BrowserLocalStorageManager implements ModelStoreManager {\n private readonly LS: Storage;\n\n constructor() {\n assert(\n env().getBool('IS_BROWSER'),\n () => 'Current environment is not a web browser');\n assert(\n typeof window === 'undefined' ||\n typeof window.localStorage !== 'undefined',\n () => 'Current browser does not appear to support localStorage');\n this.LS = window.localStorage;\n }\n\n async listModels(): Promise<{[path: string]: ModelArtifactsInfo}> {\n const out: {[path: string]: ModelArtifactsInfo} = {};\n const prefix = PATH_PREFIX + PATH_SEPARATOR;\n const suffix = PATH_SEPARATOR + INFO_SUFFIX;\n for (let i = 0; i < this.LS.length; ++i) {\n const key = this.LS.key(i);\n if (key.startsWith(prefix) && key.endsWith(suffix)) {\n const modelPath = getModelPathFromKey(key);\n out[modelPath] = JSON.parse(this.LS.getItem(key)) as ModelArtifactsInfo;\n }\n }\n return out;\n }\n\n async removeModel(path: string): Promise {\n path = maybeStripScheme(path);\n const keys = getModelKeys(path);\n if (this.LS.getItem(keys.info) == null) {\n throw new Error(`Cannot find model at path '${path}'`);\n }\n const info = JSON.parse(this.LS.getItem(keys.info)) as ModelArtifactsInfo;\n removeItems(keys);\n return info;\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/**\n * Classes and functions for model management across multiple storage mediums.\n *\n * Supported client actions:\n * - Listing models on all registered storage mediums.\n * - Remove model by URL from any registered storage mediums, by using URL\n * string.\n * - Moving or copying model from one path to another in the same medium or from\n * one medium to another, by using URL strings.\n */\n\nimport {assert} from '../util';\n\nimport {IORouterRegistry} from './router_registry';\nimport {ModelArtifactsInfo, ModelStoreManager} from './types';\n\nconst URL_SCHEME_SUFFIX = '://';\n\nexport class ModelStoreManagerRegistry {\n // Singleton instance.\n private static instance: ModelStoreManagerRegistry;\n\n private managers: {[scheme: string]: ModelStoreManager};\n\n private constructor() {\n this.managers = {};\n }\n\n private static getInstance(): ModelStoreManagerRegistry {\n if (ModelStoreManagerRegistry.instance == null) {\n ModelStoreManagerRegistry.instance = new ModelStoreManagerRegistry();\n }\n return ModelStoreManagerRegistry.instance;\n }\n\n /**\n * Register a save-handler router.\n *\n * @param saveRouter A function that maps a URL-like string onto an instance\n * of `IOHandler` with the `save` method defined or `null`.\n */\n static registerManager(scheme: string, manager: ModelStoreManager) {\n assert(scheme != null, () => 'scheme must not be undefined or null.');\n if (scheme.endsWith(URL_SCHEME_SUFFIX)) {\n scheme = scheme.slice(0, scheme.indexOf(URL_SCHEME_SUFFIX));\n }\n assert(scheme.length > 0, () => 'scheme must not be an empty string.');\n const registry = ModelStoreManagerRegistry.getInstance();\n assert(\n registry.managers[scheme] == null,\n () => `A model store manager is already registered for scheme '${\n scheme}'.`);\n registry.managers[scheme] = manager;\n }\n\n static getManager(scheme: string): ModelStoreManager {\n const manager = ModelStoreManagerRegistry.getInstance().managers[scheme];\n if (manager == null) {\n throw new Error(`Cannot find model manager for scheme '${scheme}'`);\n }\n return manager;\n }\n\n static getSchemes(): string[] {\n return Object.keys(ModelStoreManagerRegistry.getInstance().managers);\n }\n}\n\n/**\n * Helper method for parsing a URL string into a scheme and a path.\n *\n * @param url E.g., 'localstorage://my-model'\n * @returns A dictionary with two fields: scheme and path.\n * Scheme: e.g., 'localstorage' in the example above.\n * Path: e.g., 'my-model' in the example above.\n */\nfunction parseURL(url: string): {scheme: string, path: string} {\n if (url.indexOf(URL_SCHEME_SUFFIX) === -1) {\n throw new Error(\n `The url string provided does not contain a scheme. ` +\n `Supported schemes are: ` +\n `${ModelStoreManagerRegistry.getSchemes().join(',')}`);\n }\n return {\n scheme: url.split(URL_SCHEME_SUFFIX)[0],\n path: url.split(URL_SCHEME_SUFFIX)[1],\n };\n}\n\nasync function cloneModelInternal(\n sourceURL: string, destURL: string,\n deleteSource = false): Promise {\n assert(\n sourceURL !== destURL,\n () => `Old path and new path are the same: '${sourceURL}'`);\n\n const loadHandlers = IORouterRegistry.getLoadHandlers(sourceURL);\n assert(\n loadHandlers.length > 0,\n () => `Copying failed because no load handler is found for source URL ${\n sourceURL}.`);\n assert(\n loadHandlers.length < 2,\n () => `Copying failed because more than one (${loadHandlers.length}) ` +\n `load handlers for source URL ${sourceURL}.`);\n const loadHandler = loadHandlers[0];\n\n const saveHandlers = IORouterRegistry.getSaveHandlers(destURL);\n assert(\n saveHandlers.length > 0,\n () => `Copying failed because no save handler is found for destination ` +\n `URL ${destURL}.`);\n assert(\n saveHandlers.length < 2,\n () => `Copying failed because more than one (${loadHandlers.length}) ` +\n `save handlers for destination URL ${destURL}.`);\n const saveHandler = saveHandlers[0];\n\n const sourceScheme = parseURL(sourceURL).scheme;\n const sourcePath = parseURL(sourceURL).path;\n const sameMedium = sourceScheme === parseURL(sourceURL).scheme;\n\n const modelArtifacts = await loadHandler.load();\n\n // If moving within the same storage medium, remove the old model as soon as\n // the loading is done. Without doing this, it is possible that the combined\n // size of the two models will cause the cloning to fail.\n if (deleteSource && sameMedium) {\n await ModelStoreManagerRegistry.getManager(sourceScheme)\n .removeModel(sourcePath);\n }\n\n const saveResult = await saveHandler.save(modelArtifacts);\n\n // If moving between mediums, the deletion is done after the save succeeds.\n // This guards against the case in which saving to the destination medium\n // fails.\n if (deleteSource && !sameMedium) {\n await ModelStoreManagerRegistry.getManager(sourceScheme)\n .removeModel(sourcePath);\n }\n\n return saveResult.modelArtifactsInfo;\n}\n\n/**\n * List all models stored in registered storage mediums.\n *\n * For a web browser environment, the registered mediums are Local Storage and\n * IndexedDB.\n *\n * ```js\n * // First create and save a model.\n * const model = tf.sequential();\n * model.add(tf.layers.dense(\n * {units: 1, inputShape: [10], activation: 'sigmoid'}));\n * await model.save('localstorage://demo/management/model1');\n *\n * // Then list existing models.\n * console.log(JSON.stringify(await tf.io.listModels()));\n *\n * // Delete the model.\n * await tf.io.removeModel('localstorage://demo/management/model1');\n *\n * // List models again.\n * console.log(JSON.stringify(await tf.io.listModels()));\n * ```\n *\n * @returns A `Promise` of a dictionary mapping URLs of existing models to\n * their model artifacts info. URLs include medium-specific schemes, e.g.,\n * 'indexeddb://my/model/1'. Model artifacts info include type of the\n * model's topology, byte sizes of the topology, weights, etc.\n *\n * @doc {\n * heading: 'Models',\n * subheading: 'Management',\n * namespace: 'io',\n * ignoreCI: true\n * }\n */\nasync function listModels(): Promise<{[url: string]: ModelArtifactsInfo}> {\n const schemes = ModelStoreManagerRegistry.getSchemes();\n const out: {[url: string]: ModelArtifactsInfo} = {};\n for (const scheme of schemes) {\n const schemeOut =\n await ModelStoreManagerRegistry.getManager(scheme).listModels();\n for (const path in schemeOut) {\n const url = scheme + URL_SCHEME_SUFFIX + path;\n out[url] = schemeOut[path];\n }\n }\n return out;\n}\n\n/**\n * Remove a model specified by URL from a registered storage medium.\n *\n * ```js\n * // First create and save a model.\n * const model = tf.sequential();\n * model.add(tf.layers.dense(\n * {units: 1, inputShape: [10], activation: 'sigmoid'}));\n * await model.save('localstorage://demo/management/model1');\n *\n * // Then list existing models.\n * console.log(JSON.stringify(await tf.io.listModels()));\n *\n * // Delete the model.\n * await tf.io.removeModel('localstorage://demo/management/model1');\n *\n * // List models again.\n * console.log(JSON.stringify(await tf.io.listModels()));\n * ```\n *\n * @param url A URL to a stored model, with a scheme prefix, e.g.,\n * 'localstorage://my-model-1', 'indexeddb://my/model/2'.\n * @returns ModelArtifactsInfo of the deleted model (if and only if deletion\n * is successful).\n * @throws Error if deletion fails, e.g., if no model exists at `path`.\n *\n * @doc {\n * heading: 'Models',\n * subheading: 'Management',\n * namespace: 'io',\n * ignoreCI: true\n * }\n */\nasync function removeModel(url: string): Promise {\n const schemeAndPath = parseURL(url);\n const manager = ModelStoreManagerRegistry.getManager(schemeAndPath.scheme);\n return manager.removeModel(schemeAndPath.path);\n}\n\n/**\n * Copy a model from one URL to another.\n *\n * This function supports:\n *\n * 1. Copying within a storage medium, e.g.,\n * `tf.io.copyModel('localstorage://model-1', 'localstorage://model-2')`\n * 2. Copying between two storage mediums, e.g.,\n * `tf.io.copyModel('localstorage://model-1', 'indexeddb://model-1')`\n *\n * ```js\n * // First create and save a model.\n * const model = tf.sequential();\n * model.add(tf.layers.dense(\n * {units: 1, inputShape: [10], activation: 'sigmoid'}));\n * await model.save('localstorage://demo/management/model1');\n *\n * // Then list existing models.\n * console.log(JSON.stringify(await tf.io.listModels()));\n *\n * // Copy the model, from Local Storage to IndexedDB.\n * await tf.io.copyModel(\n * 'localstorage://demo/management/model1',\n * 'indexeddb://demo/management/model1');\n *\n * // List models again.\n * console.log(JSON.stringify(await tf.io.listModels()));\n *\n * // Remove both models.\n * await tf.io.removeModel('localstorage://demo/management/model1');\n * await tf.io.removeModel('indexeddb://demo/management/model1');\n * ```\n *\n * @param sourceURL Source URL of copying.\n * @param destURL Destination URL of copying.\n * @returns ModelArtifactsInfo of the copied model (if and only if copying\n * is successful).\n * @throws Error if copying fails, e.g., if no model exists at `sourceURL`, or\n * if `oldPath` and `newPath` are identical.\n *\n * @doc {\n * heading: 'Models',\n * subheading: 'Management',\n * namespace: 'io',\n * ignoreCI: true\n * }\n */\nasync function copyModel(\n sourceURL: string, destURL: string): Promise {\n const deleteSource = false;\n return cloneModelInternal(sourceURL, destURL, deleteSource);\n}\n\n/**\n * Move a model from one URL to another.\n *\n * This function supports:\n *\n * 1. Moving within a storage medium, e.g.,\n * `tf.io.moveModel('localstorage://model-1', 'localstorage://model-2')`\n * 2. Moving between two storage mediums, e.g.,\n * `tf.io.moveModel('localstorage://model-1', 'indexeddb://model-1')`\n *\n * ```js\n * // First create and save a model.\n * const model = tf.sequential();\n * model.add(tf.layers.dense(\n * {units: 1, inputShape: [10], activation: 'sigmoid'}));\n * await model.save('localstorage://demo/management/model1');\n *\n * // Then list existing models.\n * console.log(JSON.stringify(await tf.io.listModels()));\n *\n * // Move the model, from Local Storage to IndexedDB.\n * await tf.io.moveModel(\n * 'localstorage://demo/management/model1',\n * 'indexeddb://demo/management/model1');\n *\n * // List models again.\n * console.log(JSON.stringify(await tf.io.listModels()));\n *\n * // Remove the moved model.\n * await tf.io.removeModel('indexeddb://demo/management/model1');\n * ```\n *\n * @param sourceURL Source URL of moving.\n * @param destURL Destination URL of moving.\n * @returns ModelArtifactsInfo of the copied model (if and only if copying\n * is successful).\n * @throws Error if moving fails, e.g., if no model exists at `sourceURL`, or\n * if `oldPath` and `newPath` are identical.\n *\n * @doc {\n * heading: 'Models',\n * subheading: 'Management',\n * namespace: 'io',\n * ignoreCI: true\n * }\n */\nasync function moveModel(\n sourceURL: string, destURL: string): Promise {\n const deleteSource = true;\n return cloneModelInternal(sourceURL, destURL, deleteSource);\n}\n\nexport {moveModel, copyModel, removeModel, listModels};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport '../flags';\n\nimport {env} from '../environment';\nimport {BrowserIndexedDB, BrowserIndexedDBManager} from '../io/indexed_db';\nimport {BrowserLocalStorage, BrowserLocalStorageManager} from '../io/local_storage';\nimport {ModelStoreManagerRegistry} from '../io/model_management';\n\nimport {Platform} from './platform';\n\nexport class PlatformBrowser implements Platform {\n // According to the spec, the built-in encoder can do only UTF-8 encoding.\n // https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder/TextEncoder\n private textEncoder: TextEncoder;\n\n // For setTimeoutCustom\n private readonly messageName = 'setTimeoutCustom';\n private functionRefs: Function[] = [];\n private handledMessageCount = 0;\n private hasEventListener = false;\n\n fetch(path: string, init?: RequestInit): Promise {\n return fetch(path, init);\n }\n\n now(): number {\n return performance.now();\n }\n\n encode(text: string, encoding: string): Uint8Array {\n if (encoding !== 'utf-8' && encoding !== 'utf8') {\n throw new Error(\n `Browser's encoder only supports utf-8, but got ${encoding}`);\n }\n if (this.textEncoder == null) {\n this.textEncoder = new TextEncoder();\n }\n return this.textEncoder.encode(text);\n }\n decode(bytes: Uint8Array, encoding: string): string {\n return new TextDecoder(encoding).decode(bytes);\n }\n\n // If the setTimeout nesting level is greater than 5 and timeout is less\n // than 4ms, timeout will be clamped to 4ms, which hurts the perf.\n // Interleaving window.postMessage and setTimeout will trick the browser and\n // avoid the clamp.\n setTimeoutCustom(functionRef: Function, delay: number): void {\n if (typeof window === 'undefined' ||\n !env().getBool('USE_SETTIMEOUTCUSTOM')) {\n setTimeout(functionRef, delay);\n return;\n }\n\n this.functionRefs.push(functionRef);\n setTimeout(() => {\n window.postMessage(\n {name: this.messageName, index: this.functionRefs.length - 1}, '*');\n }, delay);\n\n if (!this.hasEventListener) {\n this.hasEventListener = true;\n window.addEventListener('message', (event: MessageEvent) => {\n if (event.source === window && event.data.name === this.messageName) {\n event.stopPropagation();\n const functionRef = this.functionRefs[event.data.index];\n functionRef();\n this.handledMessageCount++;\n if (this.handledMessageCount === this.functionRefs.length) {\n this.functionRefs = [];\n this.handledMessageCount = 0;\n }\n }\n }, true);\n }\n }\n}\n\nif (env().get('IS_BROWSER')) {\n env().setPlatform('browser', new PlatformBrowser());\n\n // Register LocalStorage IOHandler\n try {\n ModelStoreManagerRegistry.registerManager(\n BrowserLocalStorage.URL_SCHEME, new BrowserLocalStorageManager());\n } catch (err) {\n }\n\n // Register IndexedDB IOHandler\n try {\n ModelStoreManagerRegistry.registerManager(\n BrowserIndexedDB.URL_SCHEME, new BrowserIndexedDBManager());\n } catch (err) {\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {env} from '../environment';\nimport {Platform} from './platform';\n\n// We are wrapping this within an object so it can be stubbed by Jasmine.\nexport const getNodeFetch = {\n // tslint:disable-next-line:no-require-imports\n importFetch: () => require('node-fetch')\n};\n\ntype FetchFn = (url: string, init?: RequestInit) => Promise;\nlet systemFetch: FetchFn;\n// These getters and setters are for testing so we don't export a mutable\n// variable.\nexport function resetSystemFetch() {\n systemFetch = null;\n}\nexport function setSystemFetch(fetchFn: FetchFn) {\n systemFetch = fetchFn;\n}\nexport function getSystemFetch(): FetchFn {\n return systemFetch;\n}\n\nexport class PlatformNode implements Platform {\n private textEncoder: TextEncoder;\n // tslint:disable-next-line:no-any\n util: any;\n\n constructor() {\n // tslint:disable-next-line:no-require-imports\n this.util = require('util');\n // According to the spec, the built-in encoder can do only UTF-8 encoding.\n // https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder/TextEncoder\n this.textEncoder = new this.util.TextEncoder();\n }\n\n fetch(path: string, requestInits?: RequestInit): Promise {\n if (env().global.fetch != null) {\n return env().global.fetch(path, requestInits);\n }\n\n if (systemFetch == null) {\n systemFetch = getNodeFetch.importFetch();\n }\n return systemFetch(path, requestInits);\n }\n\n now(): number {\n const time = process.hrtime();\n return time[0] * 1000 + time[1] / 1000000;\n }\n\n encode(text: string, encoding: string): Uint8Array {\n if (encoding !== 'utf-8' && encoding !== 'utf8') {\n throw new Error(\n `Node built-in encoder only supports utf-8, but got ${encoding}`);\n }\n return this.textEncoder.encode(text);\n }\n decode(bytes: Uint8Array, encoding: string): string {\n if (bytes.length === 0) {\n return '';\n }\n return new this.util.TextDecoder(encoding).decode(bytes);\n }\n}\n\nif (env().get('IS_NODE') && !env().get('IS_BROWSER')) {\n env().setPlatform('node', new PlatformNode());\n}\n","/**\n * @license\n * Copyright 2020 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {TensorBuffer} from '../tensor';\nimport {DataType, DataTypeMap, Rank, ShapeMap} from '../types';\nimport * as util from '../util';\n\n/**\n * Creates an empty `tf.TensorBuffer` with the specified `shape` and `dtype`.\n *\n * The values are stored in CPU as `TypedArray`. Fill the buffer using\n * `buffer.set()`, or by modifying directly `buffer.values`.\n *\n * When done, call `buffer.toTensor()` to get an immutable `tf.Tensor` with\n * those values.\n *\n * ```js\n * // Create a buffer and set values at particular indices.\n * const buffer = tf.buffer([2, 2]);\n * buffer.set(3, 0, 0);\n * buffer.set(5, 1, 0);\n *\n * // Convert the buffer back to a tensor.\n * buffer.toTensor().print();\n * ```\n *\n * @param shape An array of integers defining the output tensor shape.\n * @param dtype The dtype of the buffer. Defaults to 'float32'.\n * @param values The values of the buffer as `TypedArray`. Defaults to\n * zeros.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nexport function buffer(\n shape: ShapeMap[R], dtype: D = 'float32' as D,\n values?: DataTypeMap[D]): TensorBuffer {\n dtype = dtype || 'float32' as D;\n util.assertNonNegativeIntegerDimensions(shape);\n return new TensorBuffer(shape, dtype, values);\n}\n","/**\n * @license\n * Copyright 2020 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Cast, CastAttrs, CastInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {DataType, TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\n\n/**\n * Casts a `tf.Tensor` to a new dtype.\n *\n * ```js\n * const x = tf.tensor1d([1.5, 2.5, 3]);\n * tf.cast(x, 'int32').print();\n * ```\n * @param x The input tensor to be casted.\n * @param dtype The dtype to cast the input tensor to.\n *\n * @doc {heading: 'Tensors', subheading: 'Transformations'}\n */\nfunction cast_(x: T|TensorLike, dtype: DataType): T {\n const $x = convertToTensor(x, 'x', 'cast');\n\n // Sanity checks.\n if (!util.isValidDtype(dtype)) {\n throw new Error(`Failed to cast to unknown dtype ${dtype}`);\n }\n if (dtype === 'string' && $x.dtype !== 'string' ||\n dtype !== 'string' && $x.dtype === 'string') {\n throw new Error('Only strings can be casted to strings');\n }\n\n const inputs: CastInputs = {x: $x};\n const attrs: CastAttrs = {dtype};\n\n return ENGINE.runKernel(\n Cast, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const cast = op({cast_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Identity, IdentityInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Creates a new tensor with the same values and shape as the specified\n * tensor.\n *\n * ```js\n * const x = tf.tensor([1, 2]);\n *\n * x.clone().print();\n * ```\n *\n * @param x The tensor to clone.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nfunction clone_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'clone', 'string_or_numeric');\n const inputs: IdentityInputs = {x: $x};\n\n // Note this op is called tf.identity in python. Hence the kernel name used\n // here.\n return ENGINE.runKernel(Identity, inputs as {} as NamedTensorMap);\n}\n\nexport const clone = op({clone_});\n","/**\n * @license\n * Copyright 2020 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\n\n/**\n * Prints information about the `tf.Tensor` including its data.\n *\n * ```js\n * const verbose = true;\n * tf.tensor2d([1, 2, 3, 4], [2, 2]).print(verbose);\n * ```\n * @param x The tensor to be printed.\n * @param verbose Whether to print verbose information about the ` Tensor`,\n * including dtype and size.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nexport function print(x: T, verbose = false): void {\n console.log(x.toString(verbose));\n}\n","/**\n * @license\n * Copyright 2020 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// Required side effectful code for tfjs-core\n\n// Set up Engine and ENV\nimport {getOrMakeEngine} from './engine';\ngetOrMakeEngine();\n\n// Register backend-agnostic flags.\nimport './flags';\n// Register platforms\nimport './platforms/platform_browser';\nimport './platforms/platform_node';\n\n// Set up OpHandler\nimport {buffer} from './ops/buffer';\nimport {cast} from './ops/cast';\nimport {clone} from './ops/clone';\nimport {print} from './ops/print';\nimport {OpHandler, setOpHandler} from './tensor';\nconst opHandler: OpHandler = {\n buffer,\n cast,\n clone,\n print\n};\nsetOpHandler(opHandler);\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/**\n * IOHandlers related to files, such as browser-triggered file downloads,\n * user-selected files in browser.\n */\n\nimport '../flags';\nimport {env} from '../environment';\n\nimport {basename, concatenateArrayBuffers, getModelArtifactsForJSON, getModelArtifactsInfoForJSON, getModelJSONForModelArtifacts} from './io_utils';\nimport {IORouter, IORouterRegistry} from './router_registry';\nimport {IOHandler, ModelArtifacts, ModelJSON, SaveResult, WeightsManifestConfig, WeightsManifestEntry} from './types';\n\nconst DEFAULT_FILE_NAME_PREFIX = 'model';\nconst DEFAULT_JSON_EXTENSION_NAME = '.json';\nconst DEFAULT_WEIGHT_DATA_EXTENSION_NAME = '.weights.bin';\n\nfunction defer(f: () => T): Promise {\n return new Promise(resolve => setTimeout(resolve)).then(f);\n}\n\nexport class BrowserDownloads implements IOHandler {\n private readonly modelJsonFileName: string;\n private readonly weightDataFileName: string;\n private readonly modelJsonAnchor: HTMLAnchorElement;\n private readonly weightDataAnchor: HTMLAnchorElement;\n\n static readonly URL_SCHEME = 'downloads://';\n\n constructor(fileNamePrefix?: string) {\n if (!env().getBool('IS_BROWSER')) {\n // TODO(cais): Provide info on what IOHandlers are available under the\n // current environment.\n throw new Error(\n 'browserDownloads() cannot proceed because the current environment ' +\n 'is not a browser.');\n }\n\n if (fileNamePrefix.startsWith(BrowserDownloads.URL_SCHEME)) {\n fileNamePrefix = fileNamePrefix.slice(BrowserDownloads.URL_SCHEME.length);\n }\n if (fileNamePrefix == null || fileNamePrefix.length === 0) {\n fileNamePrefix = DEFAULT_FILE_NAME_PREFIX;\n }\n\n this.modelJsonFileName = fileNamePrefix + DEFAULT_JSON_EXTENSION_NAME;\n this.weightDataFileName =\n fileNamePrefix + DEFAULT_WEIGHT_DATA_EXTENSION_NAME;\n }\n\n async save(modelArtifacts: ModelArtifacts): Promise {\n if (typeof (document) === 'undefined') {\n throw new Error(\n 'Browser downloads are not supported in ' +\n 'this environment since `document` is not present');\n }\n const weightsURL = window.URL.createObjectURL(new Blob(\n [modelArtifacts.weightData], {type: 'application/octet-stream'}));\n\n if (modelArtifacts.modelTopology instanceof ArrayBuffer) {\n throw new Error(\n 'BrowserDownloads.save() does not support saving model topology ' +\n 'in binary formats yet.');\n } else {\n const weightsManifest: WeightsManifestConfig = [{\n paths: ['./' + this.weightDataFileName],\n weights: modelArtifacts.weightSpecs\n }];\n const modelJSON: ModelJSON =\n getModelJSONForModelArtifacts(modelArtifacts, weightsManifest);\n\n const modelJsonURL = window.URL.createObjectURL(\n new Blob([JSON.stringify(modelJSON)], {type: 'application/json'}));\n\n // If anchor elements are not provided, create them without attaching them\n // to parents, so that the downloaded file names can be controlled.\n const jsonAnchor = this.modelJsonAnchor == null ?\n document.createElement('a') :\n this.modelJsonAnchor;\n jsonAnchor.download = this.modelJsonFileName;\n jsonAnchor.href = modelJsonURL;\n // Trigger downloads by evoking a click event on the download anchors.\n // When multiple downloads are started synchronously, Firefox will only\n // save the last one.\n await defer(() => jsonAnchor.dispatchEvent(new MouseEvent('click')));\n\n if (modelArtifacts.weightData != null) {\n const weightDataAnchor = this.weightDataAnchor == null ?\n document.createElement('a') :\n this.weightDataAnchor;\n weightDataAnchor.download = this.weightDataFileName;\n weightDataAnchor.href = weightsURL;\n await defer(\n () => weightDataAnchor.dispatchEvent(new MouseEvent('click')));\n }\n\n return {modelArtifactsInfo: getModelArtifactsInfoForJSON(modelArtifacts)};\n }\n }\n}\n\nclass BrowserFiles implements IOHandler {\n private readonly jsonFile: File;\n private readonly weightsFiles: File[];\n\n constructor(files: File[]) {\n if (files == null || files.length < 1) {\n throw new Error(\n `When calling browserFiles, at least 1 file is required, ` +\n `but received ${files}`);\n }\n this.jsonFile = files[0];\n this.weightsFiles = files.slice(1);\n }\n\n async load(): Promise {\n return new Promise((resolve, reject) => {\n const jsonReader = new FileReader();\n jsonReader.onload = (event: Event) => {\n // tslint:disable-next-line:no-any\n const modelJSON = JSON.parse((event.target as any).result) as ModelJSON;\n\n const modelTopology = modelJSON.modelTopology;\n if (modelTopology == null) {\n reject(new Error(`modelTopology field is missing from file ${\n this.jsonFile.name}`));\n return;\n }\n\n const weightsManifest = modelJSON.weightsManifest;\n if (weightsManifest == null) {\n reject(new Error(`weightManifest field is missing from file ${\n this.jsonFile.name}`));\n return;\n }\n\n if (this.weightsFiles.length === 0) {\n resolve({modelTopology});\n return;\n }\n\n const modelArtifactsPromise = getModelArtifactsForJSON(\n modelJSON, (weightsManifest) => this.loadWeights(weightsManifest));\n resolve(modelArtifactsPromise);\n };\n\n jsonReader.onerror = error => reject(\n `Failed to read model topology and weights manifest JSON ` +\n `from file '${this.jsonFile.name}'. BrowserFiles supports loading ` +\n `Keras-style tf.Model artifacts only.`);\n jsonReader.readAsText(this.jsonFile);\n });\n }\n\n private loadWeights(weightsManifest: WeightsManifestConfig): Promise<[\n /* weightSpecs */ WeightsManifestEntry[], /* weightData */ ArrayBuffer\n ]> {\n const weightSpecs: WeightsManifestEntry[] = [];\n const paths: string[] = [];\n for (const entry of weightsManifest) {\n weightSpecs.push(...entry.weights);\n paths.push(...entry.paths);\n }\n\n const pathToFile: {[path: string]: File} =\n this.checkManifestAndWeightFiles(weightsManifest);\n\n const promises: Array> =\n paths.map(path => this.loadWeightsFile(path, pathToFile[path]));\n\n return Promise.all(promises).then(\n buffers => [weightSpecs, concatenateArrayBuffers(buffers)]);\n }\n\n private loadWeightsFile(path: string, file: File): Promise {\n return new Promise((resolve, reject) => {\n const weightFileReader = new FileReader();\n weightFileReader.onload = (event: Event) => {\n // tslint:disable-next-line:no-any\n const weightData = (event.target as any).result as ArrayBuffer;\n resolve(weightData);\n };\n weightFileReader.onerror = error =>\n reject(`Failed to weights data from file of path '${path}'.`);\n weightFileReader.readAsArrayBuffer(file);\n });\n }\n\n /**\n * Check the compatibility between weights manifest and weight files.\n */\n private checkManifestAndWeightFiles(manifest: WeightsManifestConfig):\n {[path: string]: File} {\n const basenames: string[] = [];\n const fileNames = this.weightsFiles.map(file => basename(file.name));\n const pathToFile: {[path: string]: File} = {};\n for (const group of manifest) {\n group.paths.forEach(path => {\n const pathBasename = basename(path);\n if (basenames.indexOf(pathBasename) !== -1) {\n throw new Error(\n `Duplicate file basename found in weights manifest: ` +\n `'${pathBasename}'`);\n }\n basenames.push(pathBasename);\n if (fileNames.indexOf(pathBasename) === -1) {\n throw new Error(\n `Weight file with basename '${pathBasename}' is not provided.`);\n } else {\n pathToFile[path] = this.weightsFiles[fileNames.indexOf(pathBasename)];\n }\n });\n }\n\n if (basenames.length !== this.weightsFiles.length) {\n throw new Error(\n `Mismatch in the number of files in weights manifest ` +\n `(${basenames.length}) and the number of weight files provided ` +\n `(${this.weightsFiles.length}).`);\n }\n return pathToFile;\n }\n}\n\nexport const browserDownloadsRouter: IORouter = (url: string|string[]) => {\n if (!env().getBool('IS_BROWSER')) {\n return null;\n } else {\n if (!Array.isArray(url) && url.startsWith(BrowserDownloads.URL_SCHEME)) {\n return browserDownloads(url.slice(BrowserDownloads.URL_SCHEME.length));\n } else {\n return null;\n }\n }\n};\nIORouterRegistry.registerSaveRouter(browserDownloadsRouter);\n\n/**\n * Creates an IOHandler that triggers file downloads from the browser.\n *\n * The returned `IOHandler` instance can be used as model exporting methods such\n * as `tf.Model.save` and supports only saving.\n *\n * ```js\n * const model = tf.sequential();\n * model.add(tf.layers.dense(\n * {units: 1, inputShape: [10], activation: 'sigmoid'}));\n * const saveResult = await model.save('downloads://mymodel');\n * // This will trigger downloading of two files:\n * // 'mymodel.json' and 'mymodel.weights.bin'.\n * console.log(saveResult);\n * ```\n *\n * @param fileNamePrefix Prefix name of the files to be downloaded. For use with\n * `tf.Model`, `fileNamePrefix` should follow either of the following two\n * formats:\n * 1. `null` or `undefined`, in which case the default file\n * names will be used:\n * - 'model.json' for the JSON file containing the model topology and\n * weights manifest.\n * - 'model.weights.bin' for the binary file containing the binary weight\n * values.\n * 2. A single string or an Array of a single string, as the file name prefix.\n * For example, if `'foo'` is provided, the downloaded JSON\n * file and binary weights file will be named 'foo.json' and\n * 'foo.weights.bin', respectively.\n * @param config Additional configuration for triggering downloads.\n * @returns An instance of `BrowserDownloads` `IOHandler`.\n *\n * @doc {\n * heading: 'Models',\n * subheading: 'Loading',\n * namespace: 'io',\n * ignoreCI: true\n * }\n */\nexport function browserDownloads(fileNamePrefix = 'model'): IOHandler {\n return new BrowserDownloads(fileNamePrefix);\n}\n\n/**\n * Creates an IOHandler that loads model artifacts from user-selected files.\n *\n * This method can be used for loading from files such as user-selected files\n * in the browser.\n * When used in conjunction with `tf.loadLayersModel`, an instance of\n * `tf.LayersModel` (Keras-style) can be constructed from the loaded artifacts.\n *\n * ```js\n * // Note: This code snippet won't run properly without the actual file input\n * // elements in the HTML DOM.\n *\n * // Suppose there are two HTML file input (``)\n * // elements.\n * const uploadJSONInput = document.getElementById('upload-json');\n * const uploadWeightsInput = document.getElementById('upload-weights');\n * const model = await tf.loadLayersModel(tf.io.browserFiles(\n * [uploadJSONInput.files[0], uploadWeightsInput.files[0]]));\n * ```\n *\n * @param files `File`s to load from. Currently, this function supports only\n * loading from files that contain Keras-style models (i.e., `tf.Model`s), for\n * which an `Array` of `File`s is expected (in that order):\n * - A JSON file containing the model topology and weight manifest.\n * - Optionally, one or more binary files containing the binary weights.\n * These files must have names that match the paths in the `weightsManifest`\n * contained by the aforementioned JSON file, or errors will be thrown\n * during loading. These weights files have the same format as the ones\n * generated by `tensorflowjs_converter` that comes with the `tensorflowjs`\n * Python PIP package. If no weights files are provided, only the model\n * topology will be loaded from the JSON file above.\n * @returns An instance of `Files` `IOHandler`.\n *\n * @doc {\n * heading: 'Models',\n * subheading: 'Loading',\n * namespace: 'io',\n * ignoreCI: true\n * }\n */\nexport function browserFiles(files: File[]): IOHandler {\n return new BrowserFiles(files);\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {assert} from '../util';\n\nimport {OnProgressCallback} from './types';\n\n/**\n * Monitor Promise.all progress, fire onProgress callback function.\n *\n * @param promises Promise list going to be monitored\n * @param onProgress Callback function. Fired when a promise resolved.\n * @param startFraction Optional fraction start. Default to 0.\n * @param endFraction Optional fraction end. Default to 1.\n */\nexport function monitorPromisesProgress(\n promises: Array>, onProgress: OnProgressCallback,\n startFraction?: number, endFraction?: number) {\n checkPromises(promises);\n startFraction = startFraction == null ? 0 : startFraction;\n endFraction = endFraction == null ? 1 : endFraction;\n checkFraction(startFraction, endFraction);\n let resolvedPromise = 0;\n\n const registerMonitor = (promise: Promise<{}>) => {\n promise.then(value => {\n const fraction = startFraction +\n ++resolvedPromise / promises.length * (endFraction - startFraction);\n // pass fraction as parameter to callback function.\n onProgress(fraction);\n return value;\n });\n return promise;\n };\n\n function checkPromises(promises: Array>): void {\n assert(\n promises != null && Array.isArray(promises) && promises.length > 0,\n () => 'promises must be a none empty array');\n }\n\n function checkFraction(startFraction: number, endFraction: number): void {\n assert(\n startFraction >= 0 && startFraction <= 1,\n () => `Progress fraction must be in range [0, 1], but ` +\n `got startFraction ${startFraction}`);\n assert(\n endFraction >= 0 && endFraction <= 1,\n () => `Progress fraction must be in range [0, 1], but ` +\n `got endFraction ${endFraction}`);\n assert(\n endFraction >= startFraction,\n () => `startFraction must be no more than endFraction, but ` +\n `got startFraction ${startFraction} and endFraction ` +\n `${endFraction}`);\n }\n\n return Promise.all(promises.map(registerMonitor));\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env} from '../environment';\n\nimport {NamedTensorMap} from '../tensor_types';\nimport * as util from '../util';\nimport {decodeWeights} from './io_utils';\nimport {monitorPromisesProgress} from './progress';\nimport {DTYPE_VALUE_SIZE_MAP, LoadOptions, WeightsManifestConfig, WeightsManifestEntry} from './types';\n\n/**\n * Reads binary weights data from a number of URLs.\n *\n * @param fetchURLs URLs to send the HTTP requests at, using `fetch` calls.\n * @param requestOptions RequestInit (options) for the HTTP requests.\n * @param fetchFunc Optional overriding value for the `window.fetch` function.\n * @param onProgress Optional, progress callback function, fired periodically\n * before the load is completed.\n * @returns A `Promise` of an Array of `ArrayBuffer`. The Array has the same\n * length as `fetchURLs`.\n */\nexport async function loadWeightsAsArrayBuffer(\n fetchURLs: string[], loadOptions?: LoadOptions): Promise {\n if (loadOptions == null) {\n loadOptions = {};\n }\n\n const fetchFunc = loadOptions.fetchFunc == null ? env().platform.fetch :\n loadOptions.fetchFunc;\n\n // Create the requests for all of the weights in parallel.\n const requests = fetchURLs.map(\n fetchURL =>\n fetchFunc(fetchURL, loadOptions.requestInit, {isBinary: true}));\n\n const fetchStartFraction = 0;\n const fetchEndFraction = 0.5;\n\n const responses = loadOptions.onProgress == null ?\n await Promise.all(requests) :\n await monitorPromisesProgress(\n requests, loadOptions.onProgress, fetchStartFraction,\n fetchEndFraction);\n\n const bufferPromises = responses.map(response => response.arrayBuffer());\n\n const bufferStartFraction = 0.5;\n const bufferEndFraction = 1;\n\n const buffers = loadOptions.onProgress == null ?\n await Promise.all(bufferPromises) :\n await monitorPromisesProgress(\n bufferPromises, loadOptions.onProgress, bufferStartFraction,\n bufferEndFraction);\n return buffers;\n}\n\n/**\n * Reads a weights manifest JSON configuration, fetches the weights and\n * returns them as `Tensor`s.\n *\n * @param manifest The weights manifest JSON.\n * @param filePathPrefix The path prefix for filenames given in the manifest.\n * Defaults to the empty string.\n * @param weightNames The names of the weights to be fetched.\n */\nexport async function loadWeights(\n manifest: WeightsManifestConfig, filePathPrefix = '',\n weightNames?: string[],\n requestInit?: RequestInit): Promise {\n // TODO(nsthorat): Groups are currently fetched atomically. If you need a\n // single weight from a group, the whole group will be fetched. At a future\n // date, we should support fetching only the individual shards within a\n // group that are needed to reconstruct the requested weight.\n // TODO(cais): Use `decodeWeights` for implementation.\n\n const fetchWeights = (fetchUrls: string[]) =>\n loadWeightsAsArrayBuffer(fetchUrls, {requestInit});\n const loadWeights = weightsLoaderFactory(fetchWeights);\n\n return loadWeights(manifest, filePathPrefix, weightNames);\n}\n\n/**\n * Creates a function, which reads a weights manifest JSON configuration,\n * fetches the weight files using the specified function and returns them as\n * `Tensor`s.\n *\n * ```js\n * // example for creating a nodejs weight loader, which reads the weight files\n * // from disk using fs.readFileSync\n *\n * import * as fs from 'fs'\n *\n * const fetchWeightsFromDisk = (filePaths: string[]) =>\n * filePaths.map(filePath => fs.readFileSync(filePath).buffer)\n *\n * const loadWeights = tf.io.weightsLoaderFactory(fetchWeightsFromDisk)\n *\n * const manifest = JSON.parse(\n * fs.readFileSync('./my_model-weights_manifest').toString()\n * )\n * const weightMap = await loadWeights(manifest, './')\n * ```\n * @param fetchWeightsFunction The function used for fetching the weight files.\n * @returns Weight loading function.\n */\nexport function weightsLoaderFactory(\n fetchWeightsFunction: (fetchUrls: string[]) => Promise):\n (manifest: WeightsManifestConfig, filePathPrefix?: string,\n weightNames?: string[]) => Promise {\n return async(\n manifest: WeightsManifestConfig, filePathPrefix = '',\n weightNames?: string[]): Promise => {\n // Collect all the groups, weights, and their relative offsets to be\n // fetched.\n const groupIndicesToFetchMap = manifest.map(() => false);\n const groupWeightsToFetch: {\n [group: number]: Array<{\n manifestEntry: WeightsManifestEntry; groupOffset: number;\n sizeBytes: number;\n }>\n } = {};\n const weightsFound =\n weightNames != null ? weightNames.map(() => false) : [];\n const allManifestWeightNames: string[] = [];\n manifest.forEach((manifestGroupConfig, groupIndex) => {\n let groupOffset = 0;\n manifestGroupConfig.weights.forEach(weightsEntry => {\n const rawDtype = ('quantization' in weightsEntry) ?\n weightsEntry.quantization.dtype :\n weightsEntry.dtype;\n\n const weightsBytes = DTYPE_VALUE_SIZE_MAP[rawDtype] *\n util.sizeFromShape(weightsEntry.shape);\n\n const enqueueWeightsForFetchingFn = () => {\n groupIndicesToFetchMap[groupIndex] = true;\n if (groupWeightsToFetch[groupIndex] == null) {\n groupWeightsToFetch[groupIndex] = [];\n }\n\n groupWeightsToFetch[groupIndex].push({\n manifestEntry: weightsEntry,\n groupOffset,\n sizeBytes: weightsBytes\n });\n };\n\n if (weightNames != null) {\n weightNames.forEach((weightName, weightIndex) => {\n if (weightName === weightsEntry.name) {\n enqueueWeightsForFetchingFn();\n weightsFound[weightIndex] = true;\n }\n });\n } else {\n enqueueWeightsForFetchingFn();\n }\n\n allManifestWeightNames.push(weightsEntry.name);\n groupOffset += weightsBytes;\n });\n });\n\n if (!weightsFound.every(found => found)) {\n const weightsNotFound = weightNames.filter((_, i) => !weightsFound[i]);\n throw new Error(\n `Could not find weights in manifest with names: ` +\n `${weightsNotFound.join(', ')}. \\n` +\n `Manifest JSON has weights with names: ` +\n `${allManifestWeightNames.join(', ')}.`);\n }\n\n // Convert the one-hot boolean groupId => shouldFetch map to a list of group\n // IDs.\n const groupIndicesToFetch =\n groupIndicesToFetchMap.reduce((accumulator, shouldFetch, i) => {\n if (shouldFetch) {\n accumulator.push(i);\n }\n return accumulator;\n }, []);\n\n const fetchUrls: string[] = [];\n groupIndicesToFetch.forEach(i => {\n manifest[i].paths.forEach(filepath => {\n const fetchUrl = filePathPrefix +\n (!filePathPrefix.endsWith('/') ? '/' : '') + filepath;\n fetchUrls.push(fetchUrl);\n });\n });\n const buffers = await fetchWeightsFunction(fetchUrls);\n\n const weightsTensorMap: NamedTensorMap = {};\n let bufferIndexOffset = 0;\n groupIndicesToFetch.forEach(i => {\n const numBuffers = manifest[i].paths.length;\n\n let groupBytes = 0;\n for (let i = 0; i < numBuffers; i++) {\n groupBytes += buffers[bufferIndexOffset + i].byteLength;\n }\n\n // Create a buffer for the whole group.\n const groupBuffer = new ArrayBuffer(groupBytes);\n const groupByteBuffer = new Uint8Array(groupBuffer);\n let groupBufferOffset = 0;\n for (let i = 0; i < numBuffers; i++) {\n const buffer = new Uint8Array(buffers[bufferIndexOffset + i]);\n groupByteBuffer.set(buffer, groupBufferOffset);\n groupBufferOffset += buffer.byteLength;\n }\n\n const weightsEntries = groupWeightsToFetch[i];\n weightsEntries.forEach(weightsEntry => {\n const byteBuffer = groupBuffer.slice(\n weightsEntry.groupOffset,\n weightsEntry.groupOffset + weightsEntry.sizeBytes);\n const nameToTensorMap =\n decodeWeights(byteBuffer, [weightsEntry.manifestEntry]);\n for (const name in nameToTensorMap) {\n weightsTensorMap[name] = nameToTensorMap[name];\n }\n });\n\n bufferIndexOffset += numBuffers;\n });\n\n return weightsTensorMap;\n };\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/**\n * IOHandler implementations based on HTTP requests in the web browser.\n *\n * Uses [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API).\n */\n\nimport {env} from '../environment';\n\nimport {assert} from '../util';\nimport {concatenateArrayBuffers, getModelArtifactsForJSON, getModelArtifactsInfoForJSON, getModelJSONForModelArtifacts, getWeightSpecs} from './io_utils';\nimport {IORouter, IORouterRegistry} from './router_registry';\nimport {IOHandler, LoadOptions, ModelArtifacts, ModelJSON, OnProgressCallback, SaveResult, WeightsManifestConfig, WeightsManifestEntry} from './types';\nimport {loadWeightsAsArrayBuffer} from './weights_loader';\n\nconst OCTET_STREAM_MIME_TYPE = 'application/octet-stream';\nconst JSON_TYPE = 'application/json';\nexport class HTTPRequest implements IOHandler {\n protected readonly path: string;\n protected readonly requestInit: RequestInit;\n\n private readonly fetch: Function;\n private readonly weightUrlConverter: (weightName: string) => Promise;\n\n readonly DEFAULT_METHOD = 'POST';\n\n static readonly URL_SCHEME_REGEX = /^https?:\\/\\//;\n\n private readonly weightPathPrefix: string;\n private readonly onProgress: OnProgressCallback;\n\n constructor(path: string, loadOptions?: LoadOptions) {\n if (loadOptions == null) {\n loadOptions = {};\n }\n this.weightPathPrefix = loadOptions.weightPathPrefix;\n this.onProgress = loadOptions.onProgress;\n this.weightUrlConverter = loadOptions.weightUrlConverter;\n\n if (loadOptions.fetchFunc != null) {\n assert(\n typeof loadOptions.fetchFunc === 'function',\n () => 'Must pass a function that matches the signature of ' +\n '`fetch` (see ' +\n 'https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)');\n this.fetch = loadOptions.fetchFunc;\n } else {\n this.fetch = env().platform.fetch;\n }\n\n assert(\n path != null && path.length > 0,\n () => 'URL path for http must not be null, undefined or ' +\n 'empty.');\n\n if (Array.isArray(path)) {\n assert(\n path.length === 2,\n () => 'URL paths for http must have a length of 2, ' +\n `(actual length is ${path.length}).`);\n }\n this.path = path;\n\n if (loadOptions.requestInit != null &&\n loadOptions.requestInit.body != null) {\n throw new Error(\n 'requestInit is expected to have no pre-existing body, but has one.');\n }\n this.requestInit = loadOptions.requestInit || {};\n }\n\n async save(modelArtifacts: ModelArtifacts): Promise {\n if (modelArtifacts.modelTopology instanceof ArrayBuffer) {\n throw new Error(\n 'BrowserHTTPRequest.save() does not support saving model topology ' +\n 'in binary formats yet.');\n }\n\n const init = Object.assign({method: this.DEFAULT_METHOD}, this.requestInit);\n init.body = new FormData();\n\n const weightsManifest: WeightsManifestConfig = [{\n paths: ['./model.weights.bin'],\n weights: modelArtifacts.weightSpecs,\n }];\n const modelTopologyAndWeightManifest: ModelJSON =\n getModelJSONForModelArtifacts(modelArtifacts, weightsManifest);\n\n init.body.append(\n 'model.json',\n new Blob(\n [JSON.stringify(modelTopologyAndWeightManifest)],\n {type: JSON_TYPE}),\n 'model.json');\n\n if (modelArtifacts.weightData != null) {\n init.body.append(\n 'model.weights.bin',\n new Blob([modelArtifacts.weightData], {type: OCTET_STREAM_MIME_TYPE}),\n 'model.weights.bin');\n }\n\n const response = await this.fetch(this.path, init);\n\n if (response.ok) {\n return {\n modelArtifactsInfo: getModelArtifactsInfoForJSON(modelArtifacts),\n responses: [response],\n };\n } else {\n throw new Error(\n `BrowserHTTPRequest.save() failed due to HTTP response status ` +\n `${response.status}.`);\n }\n }\n\n /**\n * Load model artifacts via HTTP request(s).\n *\n * See the documentation to `tf.io.http` for details on the saved\n * artifacts.\n *\n * @returns The loaded model artifacts (if loading succeeds).\n */\n async load(): Promise {\n const modelConfigRequest = await this.fetch(this.path, this.requestInit);\n\n if (!modelConfigRequest.ok) {\n throw new Error(\n `Request to ${this.path} failed with status code ` +\n `${modelConfigRequest.status}. Please verify this URL points to ` +\n `the model JSON of the model to load.`);\n }\n let modelJSON: ModelJSON;\n try {\n modelJSON = await modelConfigRequest.json();\n } catch (e) {\n let message = `Failed to parse model JSON of response from ${this.path}.`;\n // TODO(nsthorat): Remove this after some time when we're comfortable that\n // .pb files are mostly gone.\n if (this.path.endsWith('.pb')) {\n message += ' Your path contains a .pb file extension. ' +\n 'Support for .pb models have been removed in TensorFlow.js 1.0 ' +\n 'in favor of .json models. You can re-convert your Python ' +\n 'TensorFlow model using the TensorFlow.js 1.0 conversion scripts ' +\n 'or you can convert your.pb models with the \\'pb2json\\'' +\n 'NPM script in the tensorflow/tfjs-converter repository.';\n } else {\n message += ' Please make sure the server is serving valid ' +\n 'JSON for this request.';\n }\n throw new Error(message);\n }\n\n // We do not allow both modelTopology and weightsManifest to be missing.\n const modelTopology = modelJSON.modelTopology;\n const weightsManifest = modelJSON.weightsManifest;\n if (modelTopology == null && weightsManifest == null) {\n throw new Error(\n `The JSON from HTTP path ${this.path} contains neither model ` +\n `topology or manifest for weights.`);\n }\n\n return getModelArtifactsForJSON(\n modelJSON, (weightsManifest) => this.loadWeights(weightsManifest));\n }\n\n private async loadWeights(weightsManifest: WeightsManifestConfig):\n Promise<[WeightsManifestEntry[], ArrayBuffer]> {\n const weightPath = Array.isArray(this.path) ? this.path[1] : this.path;\n const [prefix, suffix] = parseUrl(weightPath);\n const pathPrefix = this.weightPathPrefix || prefix;\n\n const weightSpecs = getWeightSpecs(weightsManifest);\n\n const fetchURLs: string[] = [];\n const urlPromises: Array> = [];\n for (const weightsGroup of weightsManifest) {\n for (const path of weightsGroup.paths) {\n if (this.weightUrlConverter != null) {\n urlPromises.push(this.weightUrlConverter(path));\n } else {\n fetchURLs.push(pathPrefix + path + suffix);\n }\n }\n }\n\n if (this.weightUrlConverter) {\n fetchURLs.push(...await Promise.all(urlPromises));\n }\n\n const buffers = await loadWeightsAsArrayBuffer(fetchURLs, {\n requestInit: this.requestInit,\n fetchFunc: this.fetch,\n onProgress: this.onProgress\n });\n return [weightSpecs, concatenateArrayBuffers(buffers)];\n }\n}\n\n/**\n * Extract the prefix and suffix of the url, where the prefix is the path before\n * the last file, and suffix is the search params after the last file.\n * ```\n * const url = 'http://tfhub.dev/model/1/tensorflowjs_model.pb?tfjs-format=file'\n * [prefix, suffix] = parseUrl(url)\n * // prefix = 'http://tfhub.dev/model/1/'\n * // suffix = '?tfjs-format=file'\n * ```\n * @param url the model url to be parsed.\n */\nexport function parseUrl(url: string): [string, string] {\n const lastSlash = url.lastIndexOf('/');\n const lastSearchParam = url.lastIndexOf('?');\n const prefix = url.substring(0, lastSlash);\n const suffix =\n lastSearchParam > lastSlash ? url.substring(lastSearchParam) : '';\n return [prefix + '/', suffix];\n}\n\nexport function isHTTPScheme(url: string): boolean {\n return url.match(HTTPRequest.URL_SCHEME_REGEX) != null;\n}\n\nexport const httpRouter: IORouter =\n (url: string, loadOptions?: LoadOptions) => {\n if (typeof fetch === 'undefined' &&\n (loadOptions == null || loadOptions.fetchFunc == null)) {\n // `http` uses `fetch` or `node-fetch`, if one wants to use it in\n // an environment that is not the browser or node they have to setup a\n // global fetch polyfill.\n return null;\n } else {\n let isHTTP = true;\n if (Array.isArray(url)) {\n isHTTP = url.every(urlItem => isHTTPScheme(urlItem));\n } else {\n isHTTP = isHTTPScheme(url);\n }\n if (isHTTP) {\n return http(url, loadOptions);\n }\n }\n return null;\n };\nIORouterRegistry.registerSaveRouter(httpRouter);\nIORouterRegistry.registerLoadRouter(httpRouter);\n\n/**\n * Creates an IOHandler subtype that sends model artifacts to HTTP server.\n *\n * An HTTP request of the `multipart/form-data` mime type will be sent to the\n * `path` URL. The form data includes artifacts that represent the topology\n * and/or weights of the model. In the case of Keras-style `tf.Model`, two\n * blobs (files) exist in form-data:\n * - A JSON file consisting of `modelTopology` and `weightsManifest`.\n * - A binary weights file consisting of the concatenated weight values.\n * These files are in the same format as the one generated by\n * [tfjs_converter](https://js.tensorflow.org/tutorials/import-keras.html).\n *\n * The following code snippet exemplifies the client-side code that uses this\n * function:\n *\n * ```js\n * const model = tf.sequential();\n * model.add(\n * tf.layers.dense({units: 1, inputShape: [100], activation: 'sigmoid'}));\n *\n * const saveResult = await model.save(tf.io.http(\n * 'http://model-server:5000/upload', {requestInit: {method: 'PUT'}}));\n * console.log(saveResult);\n * ```\n *\n * If the default `POST` method is to be used, without any custom parameters\n * such as headers, you can simply pass an HTTP or HTTPS URL to `model.save`:\n *\n * ```js\n * const saveResult = await model.save('http://model-server:5000/upload');\n * ```\n *\n * The following GitHub Gist\n * https://gist.github.com/dsmilkov/1b6046fd6132d7408d5257b0976f7864\n * implements a server based on [flask](https://github.com/pallets/flask) that\n * can receive the request. Upon receiving the model artifacts via the requst,\n * this particular server reconstitutes instances of [Keras\n * Models](https://keras.io/models/model/) in memory.\n *\n *\n * @param path A URL path to the model.\n * Can be an absolute HTTP path (e.g.,\n * 'http://localhost:8000/model-upload)') or a relative path (e.g.,\n * './model-upload').\n * @param requestInit Request configurations to be used when sending\n * HTTP request to server using `fetch`. It can contain fields such as\n * `method`, `credentials`, `headers`, `mode`, etc. See\n * https://developer.mozilla.org/en-US/docs/Web/API/Request/Request\n * for more information. `requestInit` must not have a body, because the\n * body will be set by TensorFlow.js. File blobs representing the model\n * topology (filename: 'model.json') and the weights of the model (filename:\n * 'model.weights.bin') will be appended to the body. If `requestInit` has a\n * `body`, an Error will be thrown.\n * @param loadOptions Optional configuration for the loading. It includes the\n * following fields:\n * - weightPathPrefix Optional, this specifies the path prefix for weight\n * files, by default this is calculated from the path param.\n * - fetchFunc Optional, custom `fetch` function. E.g., in Node.js,\n * the `fetch` from node-fetch can be used here.\n * - onProgress Optional, progress callback function, fired periodically\n * before the load is completed.\n * @returns An instance of `IOHandler`.\n *\n * @doc {\n * heading: 'Models',\n * subheading: 'Loading',\n * namespace: 'io',\n * ignoreCI: true\n * }\n */\nexport function http(path: string, loadOptions?: LoadOptions): IOHandler {\n return new HTTPRequest(path, loadOptions);\n}\n\n/**\n * Deprecated. Use `tf.io.http`.\n * @param path\n * @param loadOptions\n */\nexport function browserHTTPRequest(\n path: string, loadOptions?: LoadOptions): IOHandler {\n return http(path, loadOptions);\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/**\n * IOHandlers that pass through the in-memory ModelArtifacts format.\n */\n\nimport {IOHandler, IOHandlerSync, LoadHandler, ModelArtifacts, SaveHandler, SaveResult, TrainingConfig, WeightsManifestEntry} from './types';\n\nclass PassthroughLoader implements IOHandlerSync {\n constructor(private readonly modelArtifacts?: ModelArtifacts) {}\n\n load(): ModelArtifacts {\n return this.modelArtifacts;\n }\n}\n\nclass PassthroughSaver> {\n constructor(\n private readonly saveHandler: (artifacts: ModelArtifacts) => R) {}\n\n save(modelArtifacts: ModelArtifacts): R {\n return this.saveHandler(modelArtifacts);\n }\n}\n\nclass PassthroughAsync implements IOHandler {\n load?: LoadHandler;\n save?: SaveHandler;\n\n constructor(handler: IOHandlerSync) {\n if (handler.load) {\n this.load = () => Promise.resolve(handler.load());\n }\n if (handler.save) {\n this.save = (modelArtifacts: ModelArtifacts) =>\n Promise.resolve(handler.save(modelArtifacts));\n }\n }\n}\n\n/**\n * Creates an IOHandler that loads model artifacts from memory.\n *\n * When used in conjunction with `tf.loadLayersModel`, an instance of\n * `tf.LayersModel` (Keras-style) can be constructed from the loaded artifacts.\n *\n * ```js\n * const model = await tf.loadLayersModel(tf.io.fromMemory(\n * modelTopology, weightSpecs, weightData));\n * ```\n *\n * @param modelArtifacts a object containing model topology (i.e., parsed from\n * the JSON format).\n * @param weightSpecs An array of `WeightsManifestEntry` objects describing the\n * names, shapes, types, and quantization of the weight data. Optional.\n * @param weightData A single `ArrayBuffer` containing the weight data,\n * concatenated in the order described by the weightSpecs. Optional.\n * @param trainingConfig Model training configuration. Optional.\n *\n * @returns A passthrough `IOHandler` that simply loads the provided data.\n */\nexport function fromMemory(\n modelArtifacts: {}|ModelArtifacts, weightSpecs?: WeightsManifestEntry[],\n weightData?: ArrayBuffer, trainingConfig?: TrainingConfig): IOHandler {\n\n const args = arguments as unknown as Parameters;\n return new PassthroughAsync(fromMemorySync(...args));\n}\n\n/**\n * Creates an IOHandler that loads model artifacts from memory.\n *\n * When used in conjunction with `tf.loadLayersModel`, an instance of\n * `tf.LayersModel` (Keras-style) can be constructed from the loaded artifacts.\n *\n * ```js\n * const model = await tf.loadLayersModel(tf.io.fromMemory(\n * modelTopology, weightSpecs, weightData));\n * ```\n *\n * @param modelArtifacts a object containing model topology (i.e., parsed from\n * the JSON format).\n * @param weightSpecs An array of `WeightsManifestEntry` objects describing the\n * names, shapes, types, and quantization of the weight data. Optional.\n * @param weightData A single `ArrayBuffer` containing the weight data,\n * concatenated in the order described by the weightSpecs. Optional.\n * @param trainingConfig Model training configuration. Optional.\n *\n * @returns A passthrough `IOHandlerSync` that simply loads the provided data.\n */\nexport function fromMemorySync(\n modelArtifacts: {}|ModelArtifacts, weightSpecs?: WeightsManifestEntry[],\n weightData?: ArrayBuffer, trainingConfig?: TrainingConfig): IOHandlerSync {\n if (arguments.length === 1) {\n const isModelArtifacts =\n (modelArtifacts as ModelArtifacts).modelTopology != null ||\n (modelArtifacts as ModelArtifacts).weightSpecs != null;\n if (isModelArtifacts) {\n return new PassthroughLoader(modelArtifacts as ModelArtifacts);\n } else {\n // Legacy support: with only modelTopology.\n // TODO(cais): Remove this deprecated API.\n console.warn(\n 'Please call tf.io.fromMemory() with only one argument. ' +\n 'The argument should be of type ModelArtifacts. ' +\n 'The multi-argument signature of tf.io.fromMemory() has been ' +\n 'deprecated and will be removed in a future release.');\n return new PassthroughLoader({modelTopology: modelArtifacts as {}});\n }\n } else {\n // Legacy support.\n // TODO(cais): Remove this deprecated API.\n console.warn(\n 'Please call tf.io.fromMemory() with only one argument. ' +\n 'The argument should be of type ModelArtifacts. ' +\n 'The multi-argument signature of tf.io.fromMemory() has been ' +\n 'deprecated and will be removed in a future release.');\n return new PassthroughLoader({\n modelTopology: modelArtifacts as {},\n weightSpecs,\n weightData,\n trainingConfig\n });\n }\n}\n\n/**\n * Creates an IOHandler that passes saved model artifacts to a callback.\n *\n * ```js\n * function handleSave(artifacts) {\n * // ... do something with the artifacts ...\n * return {modelArtifactsInfo: {...}, ...};\n * }\n *\n * const saveResult = model.save(tf.io.withSaveHandler(handleSave));\n * ```\n *\n * @param saveHandler A function that accepts a `ModelArtifacts` and returns a\n * promise that resolves to a `SaveResult`.\n */\nexport function withSaveHandler(\n saveHandler: (artifacts: ModelArtifacts) =>\n Promise): IOHandler {\n return new PassthroughSaver(saveHandler);\n}\n\n/**\n * Creates an IOHandlerSync that passes saved model artifacts to a callback.\n *\n * ```js\n * function handleSave(artifacts) {\n * // ... do something with the artifacts ...\n * return {modelArtifactsInfo: {...}, ...};\n * }\n *\n * const saveResult = model.save(tf.io.withSaveHandler(handleSave));\n * ```\n *\n * @param saveHandler A function that accepts a `ModelArtifacts` and returns a\n * `SaveResult`.\n */\nexport function withSaveHandlerSync(\n saveHandler: (artifacts: ModelArtifacts) => SaveResult): IOHandlerSync {\n return new PassthroughSaver(saveHandler);\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// Importing local_storage and indexed_db is necessary for the routers to be\n// registered.\nimport './indexed_db';\nimport './local_storage';\n\nimport {browserFiles} from './browser_files';\nimport {browserHTTPRequest, http, isHTTPScheme} from './http';\nimport {concatenateArrayBuffers, decodeWeights, encodeWeights, getModelArtifactsForJSON, getModelArtifactsForJSONSync, getModelArtifactsInfoForJSON, getWeightSpecs} from './io_utils';\nimport {fromMemory, fromMemorySync, withSaveHandler, withSaveHandlerSync} from './passthrough';\nimport {getLoadHandlers, getSaveHandlers, registerLoadRouter, registerSaveRouter} from './router_registry';\nimport {IOHandler, IOHandlerSync, LoadHandler, LoadOptions, ModelArtifacts, ModelArtifactsInfo, ModelJSON, ModelStoreManager, OnProgressCallback, RequestDetails, SaveConfig, SaveHandler, SaveResult, TrainingConfig, WeightGroup, WeightsManifestConfig, WeightsManifestEntry} from './types';\nimport {loadWeights, weightsLoaderFactory} from './weights_loader';\n\nexport {copyModel, listModels, moveModel, removeModel} from './model_management';\nexport {\n browserFiles,\n browserHTTPRequest,\n concatenateArrayBuffers,\n decodeWeights,\n encodeWeights,\n fromMemory,\n fromMemorySync,\n getLoadHandlers,\n getModelArtifactsForJSON,\n getModelArtifactsForJSONSync,\n getModelArtifactsInfoForJSON,\n getSaveHandlers,\n getWeightSpecs,\n http,\n IOHandler,\n IOHandlerSync,\n isHTTPScheme,\n LoadHandler,\n LoadOptions,\n loadWeights,\n ModelArtifacts,\n ModelArtifactsInfo,\n ModelJSON,\n ModelStoreManager,\n OnProgressCallback,\n registerLoadRouter,\n registerSaveRouter,\n RequestDetails,\n SaveConfig,\n SaveHandler,\n SaveResult,\n TrainingConfig,\n WeightGroup,\n weightsLoaderFactory,\n WeightsManifestConfig,\n WeightsManifestEntry,\n withSaveHandler,\n withSaveHandlerSync,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {BatchMatMul, BatchMatMulAttrs, BatchMatMulInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes the dot product of two matrices, A * B. These must be matrices.\n *\n * ```js\n * const a = tf.tensor2d([1, 2], [1, 2]);\n * const b = tf.tensor2d([1, 2, 3, 4], [2, 2]);\n *\n * a.matMul(b).print(); // or tf.matMul(a, b)\n * ```\n * @param a First matrix in dot product operation.\n * @param b Second matrix in dot product operation.\n * @param transposeA If true, `a` is transposed before multiplication.\n * @param transposeB If true, `b` is transposed before multiplication.\n *\n * @doc {heading: 'Operations', subheading: 'Matrices'}\n */\nfunction matMul_(\n a: Tensor|TensorLike, b: Tensor|TensorLike, transposeA = false,\n transposeB = false): T {\n let $a = convertToTensor(a, 'a', 'matMul');\n let $b = convertToTensor(b, 'b', 'matMul');\n [$a, $b] = makeTypesMatch($a, $b);\n\n const inputs: BatchMatMulInputs = {a: $a, b: $b};\n const attrs: BatchMatMulAttrs = {transposeA, transposeB};\n\n return ENGINE.runKernel(\n BatchMatMul, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const matMul = op({matMul_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {OneHot, OneHotAttrs, OneHotInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {DataType, TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Creates a one-hot `tf.Tensor`. The locations represented by `indices` take\n * value `onValue` (defaults to 1), while all other locations take value\n * `offValue` (defaults to 0). If `indices` is rank `R`, the output has rank\n * `R+1` with the last axis of size `depth`.\n * `indices` used to encode prediction class must start from 0. For example,\n * if you have 3 classes of data, class 1 should be encoded as 0, class 2\n * should be 1, and class 3 should be 2.\n *\n * ```js\n * tf.oneHot(tf.tensor1d([0, 1], 'int32'), 3).print();\n * ```\n *\n * @param indices `tf.Tensor` of indices with dtype `int32`. Indices must\n * start from 0.\n * @param depth The depth of the one hot dimension.\n * @param onValue A number used to fill in the output when the index matches\n * the location.\n * @param offValue A number used to fill in the output when the index does\n * not match the location.\n * @param dtype The dtype of the output tensor, default to 'int32'.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nfunction oneHot_(\n indices: Tensor|TensorLike, depth: number, onValue = 1, offValue = 0,\n dtype: DataType = 'int32'): Tensor {\n if (depth < 2) {\n throw new Error(`Error in oneHot: depth must be >=2, but it is ${depth}`);\n }\n const $indices = convertToTensor(indices, 'indices', 'oneHot', 'int32');\n\n const inputs: OneHotInputs = {indices: $indices};\n const attrs: OneHotAttrs = {dtype, depth, onValue, offValue};\n\n return ENGINE.runKernel(\n OneHot, inputs as unknown as NamedTensorMap,\n attrs as unknown as NamedAttrMap);\n}\n\nexport const oneHot = op({oneHot_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelBackend} from './backends/backend';\nimport {ENGINE, Engine, MemoryInfo, ProfileInfo, ScopeFn, TimingInfo} from './engine';\nimport {env} from './environment';\n\nimport {Platform} from './platforms/platform';\nimport {setDeprecationWarningFn, Tensor} from './tensor';\nimport {TensorContainer} from './tensor_types';\nimport {getTensorsInContainer} from './tensor_util';\n\n/**\n * Enables production mode which disables correctness checks in favor of\n * performance.\n *\n * @doc {heading: 'Environment'}\n */\nexport function enableProdMode(): void {\n env().set('PROD', true);\n}\n\n/**\n * Enables debug mode which will log information about all executed kernels:\n * the elapsed time of the kernel execution, as well as the rank, shape, and\n * size of the output tensor.\n *\n * Debug mode will significantly slow down your application as it will\n * download the result of every operation to the CPU. This should not be used in\n * production. Debug mode does not affect the timing information of the kernel\n * execution as we do not measure download time in the kernel execution time.\n *\n * See also: `tf.profile`, `tf.memory`.\n *\n * @doc {heading: 'Environment'}\n */\nexport function enableDebugMode(): void {\n env().set('DEBUG', true);\n}\n\n/** Globally disables deprecation warnings */\nexport function disableDeprecationWarnings(): void {\n env().set('DEPRECATION_WARNINGS_ENABLED', false);\n console.warn(`TensorFlow.js deprecation warnings have been disabled.`);\n}\n\n/** Warn users about deprecated functionality. */\nexport function deprecationWarn(msg: string) {\n if (env().getBool('DEPRECATION_WARNINGS_ENABLED')) {\n console.warn(\n msg + ' You can disable deprecation warnings with ' +\n 'tf.disableDeprecationWarnings().');\n }\n}\nsetDeprecationWarningFn(deprecationWarn);\n\n/**\n * Dispose all variables kept in backend engine.\n *\n * @doc {heading: 'Environment'}\n */\nexport function disposeVariables(): void {\n ENGINE.disposeVariables();\n}\n\n/**\n * It returns the global engine that keeps track of all tensors and backends.\n *\n * @doc {heading: 'Environment'}\n */\nexport function engine(): Engine {\n return ENGINE;\n}\n\n/**\n * Returns memory info at the current time in the program. The result is an\n * object with the following properties:\n *\n * - `numBytes`: Number of bytes allocated (undisposed) at this time.\n * - `numTensors`: Number of unique tensors allocated.\n * - `numDataBuffers`: Number of unique data buffers allocated\n * (undisposed) at this time, which is ≤ the number of tensors\n * (e.g. `a.reshape(newShape)` makes a new Tensor that shares the same\n * data buffer with `a`).\n * - `unreliable`: True if the memory usage is unreliable. See `reasons` when\n * `unreliable` is true.\n * - `reasons`: `string[]`, reasons why the memory is unreliable, present if\n * `unreliable` is true.\n *\n * WebGL Properties:\n * - `numBytesInGPU`: Number of bytes allocated (undisposed) in the GPU only at\n * this time.\n *\n * @doc {heading: 'Performance', subheading: 'Memory'}\n */\nexport function memory(): MemoryInfo {\n return ENGINE.memory();\n}\n\n/**\n * Executes the provided function `f()` and returns a promise that resolves\n * with information about the function's memory use:\n * - `newBytes`: the number of new bytes allocated\n * - `newTensors`: the number of new tensors created\n * - `peakBytes`: the peak number of bytes allocated\n * - `kernels`: an array of objects for each kernel involved that reports\n * their input and output shapes, number of bytes used, and number of new\n * tensors created.\n * - `kernelNames`: an array of unique strings with just the names of the\n * kernels in the `kernels` array.\n *\n * ```js\n * const profile = await tf.profile(() => {\n * const x = tf.tensor1d([1, 2, 3]);\n * let x2 = x.square();\n * x2.dispose();\n * x2 = x.square();\n * x2.dispose();\n * return x;\n * });\n *\n * console.log(`newBytes: ${profile.newBytes}`);\n * console.log(`newTensors: ${profile.newTensors}`);\n * console.log(`byte usage over all kernels: ${profile.kernels.map(k =>\n * k.totalBytesSnapshot)}`);\n * ```\n *\n *\n * @doc {heading: 'Performance', subheading: 'Profile'}\n */\nexport function profile(f: () => (TensorContainer | Promise)):\n Promise {\n return ENGINE.profile(f);\n}\n\n/**\n * Executes the provided function `fn` and after it is executed, cleans up all\n * intermediate tensors allocated by `fn` except those returned by `fn`.\n * `fn` must not return a Promise (async functions not allowed). The returned\n * result can be a complex object.\n *\n * Using this method helps avoid memory leaks. In general, wrap calls to\n * operations in `tf.tidy` for automatic memory cleanup.\n *\n * NOTE: Variables do *not* get cleaned up when inside a tidy(). If you want to\n * dispose variables, please use `tf.disposeVariables` or call dispose()\n * directly on variables.\n *\n * ```js\n * // y = 2 ^ 2 + 1\n * const y = tf.tidy(() => {\n * // a, b, and one will be cleaned up when the tidy ends.\n * const one = tf.scalar(1);\n * const a = tf.scalar(2);\n * const b = a.square();\n *\n * console.log('numTensors (in tidy): ' + tf.memory().numTensors);\n *\n * // The value returned inside the tidy function will return\n * // through the tidy, in this case to the variable y.\n * return b.add(one);\n * });\n *\n * console.log('numTensors (outside tidy): ' + tf.memory().numTensors);\n * y.print();\n * ```\n *\n * @param nameOrFn The name of the closure, or the function to execute.\n * If a name is provided, the 2nd argument should be the function.\n * If debug mode is on, the timing and the memory usage of the function\n * will be tracked and displayed on the console using the provided name.\n * @param fn The function to execute.\n *\n * @doc {heading: 'Performance', subheading: 'Memory'}\n */\nexport function tidy(\n nameOrFn: string|ScopeFn, fn?: ScopeFn): T {\n return ENGINE.tidy(nameOrFn, fn);\n}\n\n/**\n * Disposes any `tf.Tensor`s found within the provided object.\n *\n * @param container an object that may be a `tf.Tensor` or may directly\n * contain `tf.Tensor`s, such as a `Tensor[]` or `{key: Tensor, ...}`. If\n * the object is not a `tf.Tensor` or does not contain `Tensors`, nothing\n * happens. In general it is safe to pass any object here, except that\n * `Promise`s are not supported.\n *\n * @doc {heading: 'Performance', subheading: 'Memory'}\n */\nexport function dispose(container: TensorContainer) {\n const tensors = getTensorsInContainer(container);\n tensors.forEach(tensor => tensor.dispose());\n}\n\n/**\n * Keeps a `tf.Tensor` generated inside a `tf.tidy` from being disposed\n * automatically.\n *\n * ```js\n * let b;\n * const y = tf.tidy(() => {\n * const one = tf.scalar(1);\n * const a = tf.scalar(2);\n *\n * // b will not be cleaned up by the tidy. a and one will be cleaned up\n * // when the tidy ends.\n * b = tf.keep(a.square());\n *\n * console.log('numTensors (in tidy): ' + tf.memory().numTensors);\n *\n * // The value returned inside the tidy function will return\n * // through the tidy, in this case to the variable y.\n * return b.add(one);\n * });\n *\n * console.log('numTensors (outside tidy): ' + tf.memory().numTensors);\n * console.log('y:');\n * y.print();\n * console.log('b:');\n * b.print();\n * ```\n *\n * @param result The tensor to keep from being disposed.\n *\n * @doc {heading: 'Performance', subheading: 'Memory'}\n */\nexport function keep(result: T): T {\n return ENGINE.keep(result);\n}\n\n/**\n * Executes `f()` and returns a promise that resolves with timing\n * information.\n *\n * The result is an object with the following properties:\n *\n * - `wallMs`: Wall execution time.\n * - `kernelMs`: Kernel execution time, ignoring data transfer. If using the\n * WebGL backend and the query timer extension is not available, this will\n * return an error object.\n * - On `WebGL` The following additional properties exist:\n * - `uploadWaitMs`: CPU blocking time on texture uploads.\n * - `downloadWaitMs`: CPU blocking time on texture downloads (readPixels).\n *\n * ```js\n * const x = tf.randomNormal([20, 20]);\n * const time = await tf.time(() => x.matMul(x));\n *\n * console.log(`kernelMs: ${time.kernelMs}, wallTimeMs: ${time.wallMs}`);\n * ```\n *\n * @param f The function to execute and time.\n *\n * @doc {heading: 'Performance', subheading: 'Timing'}\n */\nexport function time(f: () => void): Promise {\n return ENGINE.time(f);\n}\n\n/**\n * Sets the backend (cpu, webgl, wasm, etc) responsible for creating tensors and\n * executing operations on those tensors. Returns a promise that resolves\n * to a boolean if the backend initialization was successful.\n *\n * Note this disposes the current backend, if any, as well as any tensors\n * associated with it. A new backend is initialized, even if it is of the\n * same type as the previous one.\n *\n * @param backendName The name of the backend. Currently supports\n * `'webgl'|'cpu'` in the browser, `'tensorflow'` under node.js\n * (requires tfjs-node), and `'wasm'` (requires tfjs-backend-wasm).\n *\n * @doc {heading: 'Backends'}\n */\nexport function setBackend(backendName: string): Promise {\n return ENGINE.setBackend(backendName);\n}\n\n/**\n * Returns a promise that resolves when the currently selected backend (or the\n * highest priority one) has initialized. Await this promise when you are using\n * a backend that has async initialization.\n *\n * @doc {heading: 'Backends'}\n */\nexport function ready(): Promise {\n return ENGINE.ready();\n}\n\n/**\n * Returns the current backend name (cpu, webgl, etc). The backend is\n * responsible for creating tensors and executing operations on those tensors.\n *\n * @doc {heading: 'Backends'}\n */\nexport function getBackend(): string {\n return ENGINE.backendName;\n}\n\n/**\n * Removes a backend and the registered factory.\n *\n * @doc {heading: 'Backends'}\n */\nexport function removeBackend(name: string): void {\n ENGINE.removeBackend(name);\n}\n\n/**\n * Finds the backend registered under the provided name. Returns null if the\n * name is not in the registry, or the registration hasn't finished yet.\n */\nexport function findBackend(name: string): KernelBackend {\n return ENGINE.findBackend(name);\n}\n\n/**\n * Finds the backend factory registered under the provided name. Returns a\n * function that produces a new backend when called. Returns null if the name\n * is not in the registry.\n */\nexport function findBackendFactory(name: string): () =>\n KernelBackend | Promise {\n return ENGINE.findBackendFactory(name);\n}\n\n/**\n * Registers a global backend. The registration should happen when importing\n * a module file (e.g. when importing `backend_webgl.ts`), and is used for\n * modular builds (e.g. custom tfjs bundle with only webgl support).\n *\n * @param factory The backend factory function. When called, it should\n * return a backend instance, or a promise of an instance.\n * @param priority The priority of the backend (higher = more important).\n * In case multiple backends are registered, the priority is used to find\n * the best backend. Defaults to 1.\n * @return False if there is already a registered backend under this name, true\n * if not.\n *\n * @doc {heading: 'Backends'}\n */\nexport function registerBackend(\n name: string, factory: () => KernelBackend | Promise,\n priority = 1): boolean {\n return ENGINE.registerBackend(name, factory, priority);\n}\n\n/**\n * Gets the current backend. If no backends have been initialized, this will\n * attempt to initialize the best backend. Will throw an error if the highest\n * priority backend has async initialization, in which case you should call\n * 'await tf.ready()' before running other code.\n *\n * @doc {heading: 'Backends'}\n */\nexport function backend(): KernelBackend {\n return ENGINE.backend;\n}\n\n/**\n * Sets the global platform.\n *\n * @param platformName The name of this platform.\n * @param platform A platform implementation.\n */\nexport function setPlatform(platformName: string, platform: Platform) {\n env().setPlatform(platformName, platform);\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Imag, ImagInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {op} from './operation';\n/**\n * Returns the imaginary part of a complex (or real) tensor.\n *\n * Given a tensor input, this operation returns a tensor of type float that is\n * the imaginary part of each element in input considered as a complex number.\n * If input is real, a tensor of all zeros is returned.\n *\n * ```js\n * const x = tf.complex([-2.25, 3.25], [4.75, 5.75]);\n * tf.imag(x).print();\n * ```\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nfunction imag_(input: T|TensorLike): T {\n const $input = convertToTensor(input, 'input', 'imag');\n\n const inputs: ImagInputs = {input: $input};\n return ENGINE.runKernel(Imag, inputs as {} as NamedTensorMap);\n}\n\nexport const imag = op({imag_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Neg, NegInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes `-1 * x` element-wise.\n *\n * ```js\n * const x = tf.tensor2d([1, 2, -2, 0], [2, 2]);\n *\n * x.neg().print(); // or tf.neg(x)\n * ```\n *\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction neg_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'neg');\n\n const inputs: NegInputs = {x: $x};\n return ENGINE.runKernel(Neg, inputs as {} as NamedTensorMap);\n}\nexport const neg = op({neg_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Real, RealInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {op} from './operation';\n\n/**\n * Returns the real part of a complex (or real) tensor.\n *\n * Given a tensor input, this operation returns a tensor of type float that is\n * the real part of each element in input considered as a complex number.\n *\n * If the input is real, it simply makes a clone.\n *\n * ```js\n * const x = tf.complex([-2.25, 3.25], [4.75, 5.75]);\n * tf.real(x).print();\n * ```\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nfunction real_(input: T|TensorLike): T {\n const $input = convertToTensor(input, 'input', 'real');\n\n const inputs: RealInputs = {input: $input};\n return ENGINE.runKernel(Real, inputs as {} as NamedTensorMap);\n}\n\nexport const real = op({real_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {tidy} from '../globals';\nimport {Transpose, TransposeAttrs, TransposeInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\nimport {complex} from './complex';\nimport {imag} from './imag';\nimport {neg} from './neg';\nimport {op} from './operation';\nimport {real} from './real';\n\n/**\n * Transposes the `tf.Tensor`. Permutes the dimensions according to `perm`.\n *\n * The returned `tf.Tensor`'s dimension `i` will correspond to the input\n * dimension `perm[i]`. If `perm` is not given, it is set to `[n-1...0]`,\n * where `n` is the rank of the input `tf.Tensor`. Hence by default, this\n * operation performs a regular matrix transpose on 2-D input `tf.Tensor`s.\n *\n * ```js\n * const a = tf.tensor2d([1, 2, 3, 4, 5, 6], [2, 3]);\n *\n * a.transpose().print(); // or tf.transpose(a)\n * ```\n *\n * @param x The tensor to transpose.\n * @param perm The permutation of the dimensions of a.\n * @param conjugate Will conjugate complex input if true.\n *\n * @doc {heading: 'Operations', subheading: 'Matrices'}\n */\nfunction transpose_(\n x: T|TensorLike, perm?: number[], conjugate?: boolean): T {\n const $x = convertToTensor(x, 'x', 'transpose');\n\n if (perm == null) {\n perm = $x.shape.map((s, i) => i).reverse();\n }\n util.assert(\n $x.rank === perm.length,\n () => `Error in transpose: rank of input ${$x.rank} ` +\n `must match length of perm ${perm}.`);\n perm.forEach(axis => {\n util.assert(\n axis >= 0 && axis < $x.rank,\n () => `All entries in 'perm' must be between 0 and ${$x.rank - 1}` +\n ` but got ${perm}`);\n });\n\n if ($x.rank <= 1) {\n return $x.clone();\n }\n\n const inputs: TransposeInputs = {x: $x};\n const attrs: TransposeAttrs = {perm};\n\n if ($x.dtype === 'complex64') {\n return tidy(() => {\n let $real = real($x);\n let $imag = imag($x);\n $real = ENGINE.runKernel(\n Transpose, {x: $real} as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap);\n $imag = ENGINE.runKernel(\n Transpose, {x: $imag} as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap);\n if (conjugate) {\n $imag = neg($imag);\n }\n return complex($real, $imag);\n });\n }\n\n return ENGINE.runKernel(\n Transpose, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const transpose = op({transpose_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor1D, Tensor2D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {cast} from './cast';\nimport {matMul} from './mat_mul';\nimport {oneHot} from './one_hot';\nimport {op} from './operation';\nimport {transpose} from './transpose';\n\n/**\n * Computes the confusion matrix from true labels and predicted labels.\n *\n * ```js\n * const labels = tf.tensor1d([0, 1, 2, 1, 0], 'int32');\n * const predictions = tf.tensor1d([0, 2, 2, 1, 0], 'int32');\n * const numClasses = 3;\n * const out = tf.math.confusionMatrix(labels, predictions, numClasses);\n * out.print();\n * // Expected output matrix:\n * // [[2, 0, 0],\n * // [0, 1, 1],\n * // [0, 0, 1]]\n * ```\n *\n * @param labels The target labels, assumed to be 0-based integers\n * for the classes. The shape is `[numExamples]`, where\n * `numExamples` is the number of examples included.\n * @param predictions The predicted classes, assumed to be\n * 0-based integers for the classes. Must have the same shape as `labels`.\n * @param numClasses Number of all classes, as an integer.\n * Its value must be larger than the largest element in `labels` and\n * `predictions`.\n * @returns The confusion matrix as a int32-type 2D tensor. The value at\n * row `r` and column `c` is the number of times examples of actual class\n * `r` were predicted as class `c`.\n *\n * @doc {heading: 'Operations', subheading: 'Evaluation'}\n */\nexport function confusionMatrix_(\n labels: Tensor1D|TensorLike, predictions: Tensor1D|TensorLike,\n numClasses: number): Tensor2D {\n const $labels = convertToTensor(labels, 'labels', 'confusionMatrix');\n const $predictions =\n convertToTensor(predictions, 'predictions', 'confusionMatrix');\n\n util.assert(\n numClasses == null || numClasses > 0 && Number.isInteger(numClasses),\n () => `If provided, numClasses must be a positive integer, ` +\n `but got ${numClasses}`);\n util.assert(\n $labels.rank === 1,\n () => `Expected the rank of labels to be 1, but got ${$labels.rank}`);\n util.assert(\n $predictions.rank === 1,\n () => `Expected the rank of predictions to be 1, ` +\n `but got ${$predictions.rank}`);\n util.assert(\n $labels.shape[0] === $predictions.shape[0],\n () => `Mismatch in the number of examples: ` +\n `${$labels.shape[0]} vs. ${$predictions.shape[0]}. ` +\n `Labels and predictions should have the same number of elements.`);\n util.assert(\n numClasses > 0 && Number.isInteger(numClasses),\n () => `numClasses is required to be a positive integer, but got ` +\n `${numClasses}`);\n // TODO(cais): In the future, if oneHot supports tensors inputs for\n // `numClasses`, `confusionMatrix` can make `numClasses` optional.\n\n const oneHotLabels = oneHot(cast($labels, 'int32'), numClasses) as Tensor2D;\n const oneHotPredictions =\n oneHot(cast($predictions, 'int32'), numClasses) as Tensor2D;\n const oneHotLabelsT: Tensor2D = transpose(oneHotLabels);\n const product: Tensor2D = matMul(oneHotLabelsT, oneHotPredictions);\n return cast(product, 'int32');\n}\n\nexport const confusionMatrix = op({confusionMatrix_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/**\n * Exports under the tf.math.* namespace.\n */\n\nimport {confusionMatrix} from './ops/confusion_matrix';\n\nexport {confusionMatrix};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/**\n * Returns the dimensions in the input shape that are broadcasted to\n * produce the provided output shape.\n *\n * The returned dimensions are 0-indexed and sorted. An example:\n * inShape = [4, 1, 3]\n * outShape = [5, 4, 3, 3]\n * result = [1]. Dimension 1 (2nd dimension of input) gets broadcasted 1 => 3.\n */\nexport function getBroadcastDims(\n inShape: number[], outShape: number[]): number[] {\n const inRank = inShape.length;\n const dims: number[] = [];\n for (let i = 0; i < inRank; i++) {\n const dim = inRank - 1 - i;\n const a = inShape[dim] || 1;\n const b = outShape[outShape.length - 1 - i] || 1;\n if (b > 1 && a === 1) {\n dims.unshift(dim);\n }\n }\n return dims;\n}\n\n/**\n * Returns the axes in the output space that should be reduced to produce\n * the input space.\n */\nexport function getReductionAxes(\n inShape: number[], outShape: number[]): number[] {\n const result: number[] = [];\n for (let i = 0; i < outShape.length; i++) {\n const inDim = inShape[inShape.length - i - 1];\n const outAxis = outShape.length - i - 1;\n const outDim = outShape[outAxis];\n if (inDim == null || (inDim === 1 && outDim > 1)) {\n result.unshift(outAxis);\n }\n }\n return result;\n}\n\nexport function assertAndGetBroadcastShape(\n shapeA: number[], shapeB: number[]): number[] {\n const result: number[] = [];\n const l = Math.max(shapeA.length, shapeB.length);\n\n for (let i = 0; i < l; i++) {\n let a = shapeA[shapeA.length - i - 1];\n if (a == null) {\n a = 1;\n }\n let b = shapeB[shapeB.length - i - 1];\n if (b == null) {\n b = 1;\n }\n if (a === 1) {\n result.unshift(b);\n } else if (b === 1) {\n result.unshift(a);\n } else if (a !== b) {\n const errMsg = `Operands could not be broadcast together with shapes ` +\n `${shapeA} and ${shapeB}.`;\n throw Error(errMsg);\n } else {\n result.unshift(a);\n }\n }\n return result;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor3D} from '../tensor';\nimport {inferShape} from '../tensor_util_env';\nimport {TensorLike3D} from '../types';\nimport {DataType} from '../types';\nimport {assertNonNull} from '../util';\nimport {makeTensor} from './tensor_ops_util';\n\n/**\n * Creates rank-3 `tf.Tensor` with the provided values, shape and dtype.\n *\n * The same functionality can be achieved with `tf.tensor`, but in general\n * we recommend using `tf.tensor3d` as it makes the code more readable.\n *\n * ```js\n * // Pass a nested array.\n * tf.tensor3d([[[1], [2]], [[3], [4]]]).print();\n * ```\n * ```js\n * // Pass a flat array and specify a shape.\n * tf.tensor3d([1, 2, 3, 4], [2, 2, 1]).print();\n * ```\n *\n * @param values The values of the tensor. Can be nested array of numbers,\n * or a flat array, or a `TypedArray`.\n * @param shape The shape of the tensor. If not provided, it is inferred from\n * `values`.\n * @param dtype The data type.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nexport function tensor3d(\n values: TensorLike3D, shape?: [number, number, number],\n dtype?: DataType): Tensor3D {\n assertNonNull(values);\n if (shape != null && shape.length !== 3) {\n throw new Error('tensor3d() requires shape to have three numbers');\n }\n const inferredShape = inferShape(values, dtype);\n if (inferredShape.length !== 3 && inferredShape.length !== 1) {\n throw new Error(\n 'tensor3d() requires values to be number[][][] or flat/TypedArray');\n }\n if (inferredShape.length === 1 && shape == null) {\n throw new Error(\n 'tensor3d() requires shape to be provided when `values` ' +\n 'are a flat array');\n }\n return makeTensor(values, shape, inferredShape, dtype) as Tensor3D;\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {env} from '../environment';\nimport {FromPixels, FromPixelsAttrs, FromPixelsInputs} from '../kernel_names';\nimport {getKernel, NamedAttrMap} from '../kernel_registry';\nimport {Tensor, Tensor2D, Tensor3D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {PixelData, TensorLike} from '../types';\n\nimport {cast} from './cast';\nimport {op} from './operation';\nimport {tensor3d} from './tensor3d';\n\nlet fromPixels2DContext: CanvasRenderingContext2D;\n\n/**\n * Creates a `tf.Tensor` from an image.\n *\n * ```js\n * const image = new ImageData(1, 1);\n * image.data[0] = 100;\n * image.data[1] = 150;\n * image.data[2] = 200;\n * image.data[3] = 255;\n *\n * tf.browser.fromPixels(image).print();\n * ```\n *\n * @param pixels The input image to construct the tensor from. The\n * supported image types are all 4-channel. You can also pass in an image\n * object with following attributes:\n * `{data: Uint8Array; width: number; height: number}`\n * @param numChannels The number of channels of the output tensor. A\n * numChannels value less than 4 allows you to ignore channels. Defaults to\n * 3 (ignores alpha channel of input image).\n *\n * @returns A Tensor3D with the shape `[height, width, numChannels]`.\n *\n * Note: fromPixels can be lossy in some cases, same image may result in\n * slightly different tensor values, if rendered by different rendering\n * engines. This means that results from different browsers, or even same\n * browser with CPU and GPU rendering engines can be different. See discussion\n * in details:\n * https://github.com/tensorflow/tfjs/issues/5482\n *\n * @doc {heading: 'Browser', namespace: 'browser', ignoreCI: true}\n */\nfunction fromPixels_(\n pixels: PixelData|ImageData|HTMLImageElement|HTMLCanvasElement|\n HTMLVideoElement|ImageBitmap,\n numChannels = 3): Tensor3D {\n // Sanity checks.\n if (numChannels > 4) {\n throw new Error(\n 'Cannot construct Tensor with more than 4 channels from pixels.');\n }\n if (pixels == null) {\n throw new Error('pixels passed to tf.browser.fromPixels() can not be null');\n }\n let isPixelData = false;\n let isImageData = false;\n let isVideo = false;\n let isImage = false;\n let isCanvasLike = false;\n let isImageBitmap = false;\n if ((pixels as PixelData).data instanceof Uint8Array) {\n isPixelData = true;\n } else if (\n typeof (ImageData) !== 'undefined' && pixels instanceof ImageData) {\n isImageData = true;\n } else if (\n typeof (HTMLVideoElement) !== 'undefined' &&\n pixels instanceof HTMLVideoElement) {\n isVideo = true;\n } else if (\n typeof (HTMLImageElement) !== 'undefined' &&\n pixels instanceof HTMLImageElement) {\n isImage = true;\n // tslint:disable-next-line: no-any\n } else if ((pixels as any).getContext != null) {\n isCanvasLike = true;\n } else if (\n typeof (ImageBitmap) !== 'undefined' && pixels instanceof ImageBitmap) {\n isImageBitmap = true;\n } else {\n throw new Error(\n 'pixels passed to tf.browser.fromPixels() must be either an ' +\n `HTMLVideoElement, HTMLImageElement, HTMLCanvasElement, ImageData ` +\n `in browser, or OffscreenCanvas, ImageData in webworker` +\n ` or {data: Uint32Array, width: number, height: number}, ` +\n `but was ${(pixels as {}).constructor.name}`);\n }\n // If the current backend has 'FromPixels' registered, it has a more\n // efficient way of handling pixel uploads, so we call that.\n const kernel = getKernel(FromPixels, ENGINE.backendName);\n if (kernel != null) {\n const inputs: FromPixelsInputs = {pixels};\n const attrs: FromPixelsAttrs = {numChannels};\n return ENGINE.runKernel(\n FromPixels, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap);\n }\n\n const [width, height] = isVideo ?\n [\n (pixels as HTMLVideoElement).videoWidth,\n (pixels as HTMLVideoElement).videoHeight\n ] :\n [pixels.width, pixels.height];\n let vals: Uint8ClampedArray|Uint8Array;\n\n if (isCanvasLike) {\n vals =\n // tslint:disable-next-line:no-any\n (pixels as any).getContext('2d').getImageData(0, 0, width, height).data;\n } else if (isImageData || isPixelData) {\n vals = (pixels as PixelData | ImageData).data;\n } else if (isImage || isVideo || isImageBitmap) {\n if (fromPixels2DContext == null) {\n if (typeof document === 'undefined') {\n if (typeof OffscreenCanvas !== 'undefined' &&\n typeof OffscreenCanvasRenderingContext2D !== 'undefined') {\n // @ts-ignore\n fromPixels2DContext = new OffscreenCanvas(1, 1).getContext('2d');\n } else {\n throw new Error(\n 'Cannot parse input in current context. ' +\n 'Reason: OffscreenCanvas Context2D rendering is not supported.');\n }\n } else {\n fromPixels2DContext =\n document.createElement('canvas').getContext(\n '2d', {willReadFrequently: true});\n }\n }\n fromPixels2DContext.canvas.width = width;\n fromPixels2DContext.canvas.height = height;\n fromPixels2DContext.drawImage(\n pixels as HTMLVideoElement, 0, 0, width, height);\n vals = fromPixels2DContext.getImageData(0, 0, width, height).data;\n }\n let values: Int32Array;\n if (numChannels === 4) {\n values = new Int32Array(vals);\n } else {\n const numPixels = width * height;\n values = new Int32Array(numPixels * numChannels);\n for (let i = 0; i < numPixels; i++) {\n for (let channel = 0; channel < numChannels; ++channel) {\n values[i * numChannels + channel] = vals[i * 4 + channel];\n }\n }\n }\n const outShape: [number, number, number] = [height, width, numChannels];\n return tensor3d(values, outShape, 'int32');\n}\n\n// Helper functions for |fromPixelsAsync| to check whether the input can\n// be wrapped into imageBitmap.\nfunction isPixelData(pixels: PixelData|ImageData|HTMLImageElement|\n HTMLCanvasElement|HTMLVideoElement|\n ImageBitmap): pixels is PixelData {\n return (pixels != null) && ((pixels as PixelData).data instanceof Uint8Array);\n}\n\nfunction isImageBitmapFullySupported() {\n return typeof window !== 'undefined' &&\n typeof (ImageBitmap) !== 'undefined' &&\n window.hasOwnProperty('createImageBitmap');\n}\n\nfunction isNonEmptyPixels(pixels: PixelData|ImageData|HTMLImageElement|\n HTMLCanvasElement|HTMLVideoElement|ImageBitmap) {\n return pixels != null && pixels.width !== 0 && pixels.height !== 0;\n}\n\nfunction canWrapPixelsToImageBitmap(pixels: PixelData|ImageData|\n HTMLImageElement|HTMLCanvasElement|\n HTMLVideoElement|ImageBitmap) {\n return isImageBitmapFullySupported() && !(pixels instanceof ImageBitmap) &&\n isNonEmptyPixels(pixels) && !isPixelData(pixels);\n}\n\n/**\n * Creates a `tf.Tensor` from an image in async way.\n *\n * ```js\n * const image = new ImageData(1, 1);\n * image.data[0] = 100;\n * image.data[1] = 150;\n * image.data[2] = 200;\n * image.data[3] = 255;\n *\n * (await tf.browser.fromPixelsAsync(image)).print();\n * ```\n * This API is the async version of fromPixels. The API will first\n * check |WRAP_TO_IMAGEBITMAP| flag, and try to wrap the input to\n * imageBitmap if the flag is set to true.\n *\n * @param pixels The input image to construct the tensor from. The\n * supported image types are all 4-channel. You can also pass in an image\n * object with following attributes:\n * `{data: Uint8Array; width: number; height: number}`\n * @param numChannels The number of channels of the output tensor. A\n * numChannels value less than 4 allows you to ignore channels. Defaults to\n * 3 (ignores alpha channel of input image).\n *\n * @doc {heading: 'Browser', namespace: 'browser', ignoreCI: true}\n */\nexport async function fromPixelsAsync(\n pixels: PixelData|ImageData|HTMLImageElement|HTMLCanvasElement|\n HTMLVideoElement|ImageBitmap,\n numChannels = 3) {\n let inputs: PixelData|ImageData|HTMLImageElement|HTMLCanvasElement|\n HTMLVideoElement|ImageBitmap = null;\n\n // Check whether the backend needs to wrap |pixels| to imageBitmap and\n // whether |pixels| can be wrapped to imageBitmap.\n if (env().getBool('WRAP_TO_IMAGEBITMAP') &&\n canWrapPixelsToImageBitmap(pixels)) {\n // Force the imageBitmap creation to not do any premultiply alpha\n // ops.\n let imageBitmap;\n\n try {\n // wrap in try-catch block, because createImageBitmap may not work\n // properly in some browsers, e.g.\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1335594\n // tslint:disable-next-line: no-any\n imageBitmap = await (createImageBitmap as any)(\n pixels as ImageBitmapSource, {premultiplyAlpha: 'none'});\n } catch (e) {\n imageBitmap = null;\n }\n\n // createImageBitmap will clip the source size.\n // In some cases, the input will have larger size than its content.\n // E.g. new Image(10, 10) but with 1 x 1 content. Using\n // createImageBitmap will clip the size from 10 x 10 to 1 x 1, which\n // is not correct. We should avoid wrapping such resouce to\n // imageBitmap.\n if (imageBitmap != null && imageBitmap.width === pixels.width &&\n imageBitmap.height === pixels.height) {\n inputs = imageBitmap;\n } else {\n inputs = pixels;\n }\n } else {\n inputs = pixels;\n }\n\n return fromPixels_(inputs, numChannels);\n}\n\n/**\n * Draws a `tf.Tensor` of pixel values to a byte array or optionally a\n * canvas.\n *\n * When the dtype of the input is 'float32', we assume values in the range\n * [0-1]. Otherwise, when input is 'int32', we assume values in the range\n * [0-255].\n *\n * Returns a promise that resolves when the canvas has been drawn to.\n *\n * @param img A rank-2 tensor with shape `[height, width]`, or a rank-3 tensor\n * of shape `[height, width, numChannels]`. If rank-2, draws grayscale. If\n * rank-3, must have depth of 1, 3 or 4. When depth of 1, draws\n * grayscale. When depth of 3, we draw with the first three components of\n * the depth dimension corresponding to r, g, b and alpha = 1. When depth of\n * 4, all four components of the depth dimension correspond to r, g, b, a.\n * @param canvas The canvas to draw to.\n *\n * @doc {heading: 'Browser', namespace: 'browser'}\n */\nexport async function toPixels(\n img: Tensor2D|Tensor3D|TensorLike,\n canvas?: HTMLCanvasElement): Promise {\n let $img = convertToTensor(img, 'img', 'toPixels');\n if (!(img instanceof Tensor)) {\n // Assume int32 if user passed a native array.\n const originalImgTensor = $img;\n $img = cast(originalImgTensor, 'int32');\n originalImgTensor.dispose();\n }\n if ($img.rank !== 2 && $img.rank !== 3) {\n throw new Error(\n `toPixels only supports rank 2 or 3 tensors, got rank ${$img.rank}.`);\n }\n const [height, width] = $img.shape.slice(0, 2);\n const depth = $img.rank === 2 ? 1 : $img.shape[2];\n\n if (depth > 4 || depth === 2) {\n throw new Error(\n `toPixels only supports depth of size ` +\n `1, 3 or 4 but got ${depth}`);\n }\n\n if ($img.dtype !== 'float32' && $img.dtype !== 'int32') {\n throw new Error(\n `Unsupported type for toPixels: ${$img.dtype}.` +\n ` Please use float32 or int32 tensors.`);\n }\n\n const data = await $img.data();\n const multiplier = $img.dtype === 'float32' ? 255 : 1;\n const bytes = new Uint8ClampedArray(width * height * 4);\n\n for (let i = 0; i < height * width; ++i) {\n const rgba = [0, 0, 0, 255];\n\n for (let d = 0; d < depth; d++) {\n const value = data[i * depth + d];\n\n if ($img.dtype === 'float32') {\n if (value < 0 || value > 1) {\n throw new Error(\n `Tensor values for a float32 Tensor must be in the ` +\n `range [0 - 1] but encountered ${value}.`);\n }\n } else if ($img.dtype === 'int32') {\n if (value < 0 || value > 255) {\n throw new Error(\n `Tensor values for a int32 Tensor must be in the ` +\n `range [0 - 255] but encountered ${value}.`);\n }\n }\n\n if (depth === 1) {\n rgba[0] = value * multiplier;\n rgba[1] = value * multiplier;\n rgba[2] = value * multiplier;\n } else {\n rgba[d] = value * multiplier;\n }\n }\n\n const j = i * 4;\n bytes[j + 0] = Math.round(rgba[0]);\n bytes[j + 1] = Math.round(rgba[1]);\n bytes[j + 2] = Math.round(rgba[2]);\n bytes[j + 3] = Math.round(rgba[3]);\n }\n\n if (canvas != null) {\n canvas.width = width;\n canvas.height = height;\n const ctx = canvas.getContext('2d');\n const imageData = new ImageData(bytes, width, height);\n ctx.putImageData(imageData, 0, 0);\n }\n if ($img !== img) {\n $img.dispose();\n }\n return bytes;\n}\n\nexport const fromPixels = op({fromPixels_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {TensorInfo} from '../kernel_registry';\nimport {computeStrides, sizeFromShape} from '../util';\n\n/**\n * Validate gather nd inputs.\n *\n * @param tensor The tensor contains the source values.\n * @param indices The tensor contains the indices to slice the source.\n *\n * @returns [resultShape, numUpdates, sliceSize, strides]\n */\nexport function prepareAndValidate(tensor: TensorInfo, indices: TensorInfo):\n [number[], number, number, number[]] {\n const tensorRank = tensor.shape.length;\n const indicesRank = indices.shape.length;\n if (tensorRank < 1) {\n throw new Error(\n 'tf.gatherND() expects the input to be rank 1 or higher,' +\n ` but the rank was ${tensorRank}.`);\n }\n if (indicesRank < 1) {\n throw new Error(\n 'tf.gatherND() expects the indices to be rank 1 or higher,' +\n ` but the rank was ${indicesRank}.`);\n }\n if (indices.dtype !== 'int32') {\n throw new Error(\n 'tf.gatherND() expects the indices to be int32 type,' +\n ` but the dtype was ${indices.dtype}.`);\n }\n if (indices.shape[indicesRank - 1] > tensorRank) {\n throw new Error(\n 'index innermost dimension length must be <= tensor rank; saw: ' +\n `${indices.shape[indicesRank - 1]} vs. ${tensorRank}`);\n }\n\n if (sizeFromShape(tensor.shape) === 0) {\n throw new Error(\n 'Requested more than 0 entries, but input is empty.' +\n ` Input shape: ${tensor.shape}.`);\n }\n\n const indicesShape = indices.shape;\n const sliceRank = indicesShape[indicesShape.length - 1];\n\n // The result shape is\n // indices.shape[:-1] + params.shape[indices.shape[-1]:]\n let nResult = 1;\n for (let i = 0; i < indicesShape.length - 1; ++i) {\n nResult *= indicesShape[i];\n }\n\n const inputShape = tensor.shape;\n\n const resultShape = indicesShape.slice();\n resultShape.pop();\n\n let sliceSize = 1;\n for (let i = sliceRank; i < tensorRank; ++i) {\n sliceSize *= inputShape[i];\n resultShape.push(inputShape[i]);\n }\n\n const strides =\n [...computeStrides(tensor.shape).map(stride => stride / sliceSize),\n 1].slice(0, sliceRank);\n\n return [resultShape, nResult, sliceSize, strides];\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {TensorInfo} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {computeStrides, sizeFromShape} from '../util';\n\n/**\n * Check whether updates.shape = indices.shape[:batchDim] +\n * shape[sliceDim:]\n *\n * @param x The input tensor.\n */\nexport function validateUpdateShape(\n shape: number[], indices: Tensor, updates: Tensor) {\n const sliceDim = (indices.rank > 1) ? indices.shape[indices.rank - 1] : 1;\n const batchDim = (indices.rank > 1) ? indices.rank - 1 : 1;\n\n const shapeError = 'Must have updates.shape = indices.shape[:batchDim] + ' +\n `shape[sliceDim:], got updates.shape: ${updates.shape}` +\n `, indices.shape: ${indices.shape}, shape: ${shape}` +\n `, sliceDim: ${sliceDim}, and batchDim: ${batchDim}.`;\n\n if (updates.rank < batchDim) {\n throw new Error(shapeError + ` update.rank < ${batchDim}. `);\n }\n if (shape.length < sliceDim + (updates.rank - batchDim)) {\n throw new Error(\n shapeError +\n ` Output shape length < ${sliceDim + (updates.rank - batchDim)}`);\n }\n if (updates.rank !== batchDim + shape.length - sliceDim) {\n throw new Error(\n shapeError + ` update.rank != ${batchDim + shape.length - sliceDim}`);\n }\n for (let d = 0; d < batchDim; ++d) {\n if (updates.shape[d] !== indices.shape[d]) {\n throw new Error(\n shapeError +\n ` updates.shape[${d}] (${updates.shape[d]}) != indices.shape[${d}] (${\n indices.shape[d]}).`);\n }\n }\n for (let d = 0; d < updates.rank - batchDim; ++d) {\n if (updates.shape[d + batchDim] !== shape[d + sliceDim]) {\n throw new Error(\n shapeError +\n ` updates.shape[${d + batchDim}] (${\n updates.shape[d + batchDim]}) != shape[${d + batchDim}] (${\n shape[d + batchDim]})`);\n }\n }\n}\n\nexport interface ScatterShapeInfo {\n sliceRank: number;\n numUpdates: number;\n sliceSize: number;\n strides: number[];\n outputSize: number;\n}\n/**\n * Validate scatter nd inputs.\n *\n * @param update The tensor contains the update values.\n * @param indices The tensor contains the indices for the update values.\n * @param shape The shape of the output tensor.\n */\nexport function validateInput(\n updates: Tensor, indices: Tensor, shape: number[]) {\n if (indices.rank < 1) {\n throw new Error(\n 'tf.scatterND() expects the indices to be rank 1 or higher,' +\n ` but the rank was ${indices.rank}.`);\n }\n if (updates.rank < 1) {\n throw new Error(\n 'tf.scatterND() expects the updates to be rank 1 or higher,' +\n ` but the rank was ${updates.rank}.`);\n }\n if (indices.dtype !== 'int32') {\n throw new Error(`The dtype of 'indices' should be int32, but got dtype: ${\n indices.dtype}`);\n }\n if (shape.length < 1) {\n throw new Error(\n `Output rank must be greater or equal to 1, but got shape: ${shape}`);\n }\n\n if (shape.length === 0) {\n if (indices.size === 0) {\n throw new Error(`Indices specified for empty output. indices shape: ${\n indices.shape}`);\n }\n if (updates.size === 0) {\n throw new Error(`Updates specified for empty output. updates shape: ${\n updates.shape}`);\n }\n }\n\n validateUpdateShape(shape, indices, updates);\n}\n\n/**\n * Calculate the shape information for the output.\n *\n * @param update The tensor contains the update values.\n * @param indices The tensor contains the indices for the update values.\n * @param shape The shape of the output tensor.\n *\n * @returns ScatterShapeInfo\n */\nexport function calculateShapes(\n updates: TensorInfo, indices: TensorInfo,\n shape: number[]): ScatterShapeInfo {\n // Calculate the number of dimensions in indices\n const indicesRank = indices.shape.length;\n const sliceRank = (indicesRank > 1) ? indices.shape[indicesRank - 1] : 1;\n\n // Calculate the number of elements that make up each slice of our updated\n // tensor. This allows us to work with flattened tensors and copy over whole\n // slices at a time.\n const totalNd = shape.length;\n\n let sliceSize = 1;\n for (let i = sliceRank; i < totalNd; ++i) {\n sliceSize *= shape[i];\n }\n\n const safeSliceDim = (sliceRank < 1) ? 1 : sliceRank;\n const numUpdates = sizeFromShape(indices.shape) / safeSliceDim;\n\n const strides = [...computeStrides(shape.slice(0, sliceRank)), 1];\n const outputSize = sizeFromShape(shape);\n return {sliceRank, numUpdates, sliceSize, strides, outputSize};\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {TensorInfo} from '../kernel_registry';\nimport * as util from '../util';\n\nconst NEW_AXIS = -2;\nconst SHRINK_AXIS = -1;\n\n// Sparse slicing specification\n// if one does foo[3:5, ..., -3], the begin, end and strides will have length\n// of 3.\ninterface StridedSliceSparseSpec {\n dims: number;\n numAddAxisAfterEllipsis: number;\n begin: number[];\n end: number[];\n strides: number[];\n beginMask: number;\n endMask: number;\n ellipsisMask: number;\n newAxisMask: number;\n shrinkAxisMask: number;\n}\n\n// Dense slicing specification\n// all ellipses and newaxis are expanded out. So if foo[3:5, ..., -3] where foo\n// is 10 dimensional, each array of begin, end, strides will have 10 entries\n// where as the sparse can have length less than the rank of foo.\ninterface StridedSliceDenseSpec {\n dims: number;\n beginMask?: number;\n endMask?: number;\n beginValid: boolean;\n endValid: boolean;\n begin?: number[];\n end?: number[];\n strides?: number[];\n // This array helps construct the final shape of the slice.\n // The final tensor is reduced in rank whenever a single index e.g. foo[3]\n // is called for. The final tensor increases in rank with newAxis entries.\n // If an index in this array is positive, the size of the dimension is\n // obtained from canonical end-begin. Otherwise, if it is a NEW_AXIS, it will\n // be 1. A shrunk dimension is skipped.\n finalShapeGatherIndices?: number[];\n // This array has the same size as finalShapeGatherIndices, but it remembers\n // the sparse index that a dimension comes from, instead of dense index.\n // A -1 in this vector means the index is not from the sparse input.\n finalShapeGatherIndicesSparse?: number[];\n inputShapeGatherIndicesSparse?: number[];\n // The dense indexed shrink mask is which processing dimensions should be\n // shrunk. For example, if foo.shape = [10, 10, 10, 10], foo[3, ..., 5] has\n // sparseShrinkAxisMask of 5 (0101) and denseShrinkAxisMask of 9 (1001),\n // yielding a final shape [10, 10].\n shrinkAxisMask?: number;\n}\n\nexport type SliceInfo = {\n finalShapeSparse: number[],\n finalShape: number[],\n isIdentity: boolean,\n sliceDim0: boolean,\n isSimpleSlice: boolean,\n begin: number[],\n end: number[],\n strides: number[]\n};\n\nexport function assertParamsValid(\n input: TensorInfo, begin: number[], size: number[]): void {\n const inputRank = input.shape.length;\n util.assert(\n inputRank === begin.length,\n () => `Error in slice${inputRank}D: Length of begin ${begin} must ` +\n `match the rank of the array (${inputRank}).`);\n util.assert(\n inputRank === size.length,\n () => `Error in slice${inputRank}D: Length of size ${size} must ` +\n `match the rank of the array (${inputRank}).`);\n\n for (let i = 0; i < inputRank; ++i) {\n util.assert(\n begin[i] + size[i] <= input.shape[i],\n () => `Error in slice${inputRank}D: begin[${i}] + size[${i}] ` +\n `(${begin[i] + size[i]}) would overflow input.shape[${i}] (${\n input.shape[i]})`);\n }\n}\n\n/** Converts a binary mask to an array of axes. Used in stridedSlice(). */\nexport function maskToAxes(mask: number): number[] {\n const axes = [];\n let axis = 0;\n while (mask > 0) {\n if (mask & 1) {\n axes.push(axis);\n }\n mask /= 2;\n axis++;\n }\n return axes;\n}\n\n/** Computes the output shape given the strided slice params. */\nexport function computeOutShape(\n begin: number[], end: number[], strides: number[]): number[] {\n const size = [];\n for (let axis = 0; axis < begin.length; axis++) {\n size[axis] = Math.ceil((end[axis] - begin[axis]) / strides[axis]);\n }\n return size;\n}\n\n// Creates full selection at the elided dimensions. If the dimension matches\n// the ellipsis mask, override the current stride value. Otherwise, insert.\nexport function stridesWithElidedDims(\n strides: number[], ellipsisInsertionIndex: number, numElidedAxes: number,\n inputShape: number[]): number[] {\n const newStrides = [...strides];\n for (let i = newStrides.length; i < inputShape.length; i++) {\n newStrides.push(1);\n }\n for (let i = 0; i < numElidedAxes; i++) {\n if (i === 0) {\n newStrides[ellipsisInsertionIndex] = 1;\n } else {\n newStrides.splice(\n ellipsisInsertionIndex, 0 /* num elements to delete */,\n 1 /* element to add */);\n newStrides.pop();\n }\n }\n return newStrides;\n}\n\nfunction unnormalizeAxis(\n ellipsisInsertionIndex: number, numElidedAxes: number,\n normalizedAxis: number): number {\n if (normalizedAxis <= ellipsisInsertionIndex) {\n return normalizedAxis;\n }\n\n return normalizedAxis - (numElidedAxes - 1);\n}\n\nfunction getElidedAxes(numElidedAxes: number, ellipsisInsertionIndex: number) {\n const elidedAxes = [];\n for (let i = 0; i < numElidedAxes; i++) {\n elidedAxes.push(ellipsisInsertionIndex + i);\n }\n return elidedAxes;\n}\n\n// Normalize the start, end and strides.\nexport function getNormalizedAxes(\n inputShape: number[], ellipsisAxes: number[], numInterpolatedAxes: number,\n begin: number[], end: number[], strides: number[], beginMask: number,\n endMask: number,\n ellipsisMask: number): {begin: number[], end: number[], strides: number[]} {\n const inputRank = inputShape.length;\n let normalizedBegin = new Array(inputRank),\n normalizedEnd = new Array(inputRank),\n normalizedStrides = new Array(inputRank);\n if (ellipsisAxes.length && numInterpolatedAxes > 0) {\n const fullIndex = ellipsisAxes[0];\n\n // The ellipsis applies to the masked index as well as any dimensions\n // that are interpolated.\n const numElidedAxes = numInterpolatedAxes + 1;\n normalizedBegin = startIndicesWithElidedDims(\n beginMask, fullIndex, numElidedAxes, begin, inputShape);\n normalizedEnd = stopIndicesWithElidedDims(\n endMask, fullIndex, numElidedAxes, end, inputShape);\n normalizedStrides =\n stridesWithElidedDims(strides, fullIndex, numElidedAxes, inputShape);\n } else {\n for (let axis = 0; axis < inputRank; axis++) {\n normalizedBegin[axis] = startForAxis(\n beginMask, begin, strides, inputShape, axis, ellipsisMask);\n normalizedEnd[axis] =\n stopForAxis(endMask, end, strides, inputShape, axis, ellipsisMask);\n normalizedStrides[axis] = stridesForAxis(strides, axis, ellipsisMask);\n }\n }\n\n return {\n begin: normalizedBegin,\n end: normalizedEnd,\n strides: normalizedStrides\n };\n}\n\n// Creates full selection at the elided dimensions. If the dimension matches\n// the ellipsis mask, override the current start value. Otherwise, insert.\nexport function startIndicesWithElidedDims(\n beginMask: number, ellipsisInsertionIndex: number, numElidedAxes: number,\n originalBegin: number[], inputShape: number[]): number[] {\n const newIndices = [...inputShape];\n const elidedAxes = getElidedAxes(numElidedAxes, ellipsisInsertionIndex);\n\n for (let axis = 0; axis < newIndices.length; axis++) {\n if (elidedAxes.indexOf(axis) > -1) {\n newIndices[axis] = 0;\n } else {\n const originalAxis =\n unnormalizeAxis(ellipsisInsertionIndex, numElidedAxes, axis);\n let originalValue = originalBegin[originalAxis];\n if (beginMask & 1 << originalAxis) {\n originalValue = 0;\n }\n\n newIndices[axis] = originalValue;\n }\n }\n return newIndices;\n}\n\n// Creates full selection at the elided dimensions. If the dimension matches\n// the ellipsis mask, override the current stop value. Otherwise, insert.\nexport function stopIndicesWithElidedDims(\n endMask: number, ellipsisInsertionIndex: number, numElidedAxes: number,\n originalEnd: number[], inputShape: number[]): number[] {\n const newIndices = [...inputShape];\n const elidedAxes = getElidedAxes(numElidedAxes, ellipsisInsertionIndex);\n\n for (let axis = 0; axis < newIndices.length; axis++) {\n if (elidedAxes.indexOf(axis) > -1) {\n newIndices[axis] = Number.MAX_SAFE_INTEGER;\n } else {\n const originalAxis =\n unnormalizeAxis(ellipsisInsertionIndex, numElidedAxes, axis);\n let originalValue = originalEnd[originalAxis];\n if (endMask & 1 << originalAxis) {\n originalValue = Number.MAX_SAFE_INTEGER;\n }\n newIndices[axis] = originalValue;\n }\n }\n\n for (let i = 0; i < newIndices.length; i++) {\n // Handle negative indices\n const axisSize = inputShape[i];\n if (newIndices[i] < 0) {\n newIndices[i] += axisSize;\n }\n newIndices[i] = util.clamp(0, newIndices[i], inputShape[i]);\n }\n return newIndices;\n}\n\nexport function stridesForAxis(\n strides: number[], axis: number, ellipsisMask: number): number {\n let stride = strides[axis];\n if (ellipsisMask & (1 << axis) || stride == null) {\n stride = 1;\n }\n\n return stride;\n}\n\nexport function startForAxis(\n beginMask: number, startIndices: number[], strides: number[],\n inputShape: number[], axis: number, ellipsisMask: number): number {\n // Begin with the specified index\n let start = startIndices[axis];\n const stride = strides[axis] || 1;\n\n // Check the axis bit from right of masked axes, or the begin index is not set\n // for the axis.\n if (beginMask & 1 << axis || ellipsisMask & 1 << axis || start == null) {\n if (stride > 0) {\n // Forward iteration - use the first element. These values will get\n // clamped below (Note: We could have set them to 0 and axis_size-1, but\n // use lowest() and max() to maintain symmetry with StopForAxis())\n start = Number.MIN_SAFE_INTEGER;\n } else {\n // Backward iteration - use the last element.\n start = Number.MAX_SAFE_INTEGER;\n }\n }\n\n // Handle negative indices\n const axisSize = inputShape[axis];\n if (start < 0) {\n start += axisSize;\n }\n\n // Clamping\n start = util.clamp(0, start, axisSize - 1);\n\n return start;\n}\n\nexport function stopForAxis(\n endMask: number, stopIndices: number[], strides: number[],\n inputShape: number[], axis: number, ellipsisMask: number): number {\n // Begin with the specified index\n let stop = stopIndices[axis];\n const stride = strides[axis] || 1;\n\n // Check the axis bit from right of masked axes, or if the stop index is not\n // set for this axis.\n if (endMask & (1 << axis) || ellipsisMask & (1 << axis) || stop == null) {\n if (stride > 0) {\n // Forward iteration - use the last element. These values will get\n // clamped below\n stop = Number.MAX_SAFE_INTEGER;\n } else {\n // Backward iteration - use the first element.\n stop = Number.MIN_SAFE_INTEGER;\n }\n }\n\n // Handle negative indices\n const axisSize = inputShape[axis];\n if (stop < 0) {\n stop += axisSize;\n }\n\n // Clamping\n // Because the end index points one past the last element, we need slightly\n // different clamping ranges depending on the direction.\n if (stride > 0) {\n // Forward iteration\n stop = util.clamp(0, stop, axisSize);\n } else {\n // Backward iteration\n stop = util.clamp(-1, stop, axisSize - 1);\n }\n\n return stop;\n}\n\n/**\n * Returns true if the slice occupies a continous set of elements in the\n * 'flat' space.\n */\nexport function isSliceContinous(\n shape: number[], begin: number[], size: number[]) {\n // Index of the first axis that has size > 1.\n let firstNonOneAxis = size.length;\n for (let i = 0; i < size.length; i++) {\n if (size[i] > 1) {\n firstNonOneAxis = i;\n break;\n }\n }\n\n for (let i = firstNonOneAxis + 1; i < size.length; i++) {\n if (begin[i] > 0 || size[i] !== shape[i]) {\n return false;\n }\n }\n return true;\n}\n\nexport function computeFlatOffset(begin: number[], strides: number[]): number {\n let flatOffset = begin.length > 0 ? begin[begin.length - 1] : 1;\n for (let i = 0; i < begin.length - 1; i++) {\n flatOffset += begin[i] * strides[i];\n }\n return flatOffset;\n}\n\nexport function parseSliceParams(\n x: TensorInfo, begin: number|number[], size?: number|number[]) {\n // The following logic allows for more ergonomic calls.\n let begin_: number[];\n const xRank = x.shape.length;\n if (typeof begin === 'number') {\n begin_ = [begin, ...new Array(xRank - 1).fill(0)];\n } else if (begin.length < xRank) {\n begin_ = begin.concat(new Array(xRank - begin.length).fill(0));\n } else {\n begin_ = begin.slice();\n }\n begin_.forEach(d => {\n util.assert(\n d !== -1, () => 'slice() does not support negative begin indexing.');\n });\n let size_: number[];\n if (size == null) {\n size_ = new Array(xRank).fill(-1);\n } else if (typeof size === 'number') {\n size_ = [size, ...new Array(xRank - 1).fill(-1)];\n } else if (size.length < xRank) {\n size_ = size.concat(new Array(xRank - size.length).fill(-1));\n } else {\n size_ = size;\n }\n size_ = size_.map((d, i) => {\n if (d >= 0) {\n return d;\n } else {\n util.assert(\n d === -1,\n () => `Negative size values should be exactly -1 but got ` +\n `${d} for the slice() size at index ${i}.`);\n return x.shape[i] - begin_[i];\n }\n });\n return [begin_, size_];\n}\n\n// Convert the slicing specification from a sparse representation to a dense\n// representation. This means that all ellipses and newaxis are expanded out.\nexport function sliceInfo(\n xShape: number[], begin: number[], end: number[], strides: number[],\n beginMask: number, endMask: number, ellipsisMask: number,\n newAxisMask: number, shrinkAxisMask: number): SliceInfo {\n let stridesNonNull;\n if (strides == null) {\n stridesNonNull = new Array(begin.length);\n stridesNonNull.fill(1);\n } else {\n stridesNonNull = strides;\n }\n\n // Only one non-zero bit is allowed in ellipsisMask, which means ellipsisMask\n // is a power of 2. Use bit compares to ensure ellipsisMask is 0 or a power\n // of 2. When i is a power of 2, i & (i - 1) is always 0.\n // Also ref:\n // https://stackoverflow.com/questions/600293/how-to-check-if-a-number-is-a-power-of-2\n if (ellipsisMask != null && (ellipsisMask & (ellipsisMask - 1)) !== 0) {\n throw new Error('Multiple ellipses in slice is not allowed.');\n }\n\n // Step 1: Account for ellipsis and new axis.\n // Check for ellipsis and count how many non-newaxis there are after.\n let ellipsisSeen = false;\n\n const sparseSpec: StridedSliceSparseSpec = {\n dims: stridesNonNull.length,\n numAddAxisAfterEllipsis: 0,\n begin: begin.slice(),\n end: end.slice(),\n strides: stridesNonNull.slice(),\n beginMask,\n endMask,\n ellipsisMask,\n newAxisMask,\n shrinkAxisMask\n };\n\n for (let i = 0; i < sparseSpec.dims; i++) {\n if (ellipsisSeen && ((1 << i) & newAxisMask) !== 0) {\n sparseSpec.numAddAxisAfterEllipsis++;\n }\n if ((1 << i) & ellipsisMask) {\n ellipsisSeen = true;\n }\n }\n // If no ellipsis insert one at the end.\n if (!ellipsisSeen) {\n sparseSpec.ellipsisMask |= (1 << sparseSpec.dims);\n sparseSpec.dims++; // this effects loop iteration below\n }\n\n // Step 2: Make a sparse spec into a full index spec.\n //\n // The sparse spec deos not correspond to the number of dimensions.\n // Make a dense spec that cooresponds to the number of dimensions.\n //\n // For example suppose foo[...,3:] on foo.shape = [2, 2, 3] then we need to\n // produce the missing beginMask for the first two dimensions i.e. from\n // beginMaskSpec = 0, endMaskSpec = 2, we achieve beginMask = 6 (110),\n // endMask = 7 (111).\n const denseSpec: StridedSliceDenseSpec = {\n dims: xShape.length,\n beginMask: 0,\n endMask: 0,\n beginValid: false,\n endValid: false\n };\n\n buildDenseSpec(sparseSpec, denseSpec);\n\n // Step 3: Make implicit ranges (non-zero beginMasks and endMasks) explicit\n // and bounds check.\n let isIdentity = true;\n let sliceDim0 = true;\n let isSimpleSlice = true;\n const processingShape = [];\n const finalShape = [];\n\n for (let i = 0; i < xShape.length; ++i) {\n if (denseSpec.strides[i] === 0) {\n throw Error(`strides[${i}] must be non-zero`);\n }\n const shrinkI = !!(denseSpec.shrinkAxisMask & (1 << i));\n const dimI = xShape[i];\n if (dimI === -1) {\n processingShape.push(shrinkI ? 1 : -1);\n continue;\n }\n\n const masks =\n [denseSpec.beginMask & (1 << i), denseSpec.endMask & (1 << i)];\n const validRange = [\n denseSpec.strides[i] > 0 ? 0 : -1,\n denseSpec.strides[i] > 0 ? dimI : dimI - 1\n ];\n\n if (shrinkI && denseSpec.strides[i] <= 0) {\n throw Error('only stride 1 allowed on non-range indexing.');\n }\n\n isSimpleSlice = isSimpleSlice && (denseSpec.strides[i] === 1);\n\n const beginAndEndMasked =\n !!((denseSpec.beginMask & (1 << i)) && (denseSpec.endMask & (1 << i)));\n\n if (denseSpec.beginValid && denseSpec.endValid) {\n if (shrinkI) {\n // If we are shrinking, the end index is now possibly incorrect. In\n // particular foo[-1] produces sparseBegin = -1, sparseEnd = 0.\n // and canonical puts these to n-1 and 0, which implies a degenerate\n // interval. Fortunately, it is now safe to re-create end as begin + 1.\n const xFwd = denseSpec.begin[i] < 0 ? dimI + denseSpec.begin[i] :\n denseSpec.begin[i];\n denseSpec.begin[i] = xFwd;\n denseSpec.end[i] = denseSpec.begin[i] + 1;\n if (xFwd < 0 || xFwd >= dimI) {\n throw Error(`slice index ${denseSpec.begin[i]} of dimension ${\n i} out of bounds.`);\n }\n } else {\n denseSpec.begin[i] = canonical(\n denseSpec.begin[i], 0, denseSpec.strides[i], dimI, masks,\n validRange);\n denseSpec.end[i] = canonical(\n denseSpec.end[i], 1, denseSpec.strides[i], dimI, masks, validRange);\n }\n // Update optimization values\n const takeAllInDimension = denseSpec.strides[i] === 1 &&\n denseSpec.begin[i] === 0 && denseSpec.end[i] === dimI;\n isIdentity = isIdentity && takeAllInDimension;\n sliceDim0 = sliceDim0 &&\n ((i === 0 && denseSpec.strides[i] === 1) || takeAllInDimension);\n } else {\n isIdentity =\n isIdentity && ((denseSpec.strides[i] === 1) && beginAndEndMasked);\n sliceDim0 = sliceDim0 &&\n ((i === 0 && denseSpec.strides[i] === 1) || beginAndEndMasked);\n }\n // Compute the processing shape (the intermediate Eigen will produce)\n let intervalLength;\n let knownInterval = false;\n if (denseSpec.beginValid && denseSpec.endValid) {\n intervalLength = denseSpec.end[i] - denseSpec.begin[i];\n knownInterval = true;\n } else if (shrinkI) {\n // The dimension is still known as 1 for the processingShape, but will be\n // discarded for the final shape.\n intervalLength = 1;\n knownInterval = true;\n } else if (beginAndEndMasked) {\n // Even if we don't have values for begin or end, we do know that this\n // dimension covers the whole interval. If we have shape information for\n // this dimension, that tells us the interval length.\n if (dimI >= 0) {\n if (denseSpec.strides[i] < 0) {\n intervalLength = -dimI;\n } else {\n intervalLength = dimI;\n }\n knownInterval = true;\n }\n }\n if (knownInterval) {\n let sizeI;\n // Hold zero if the interval is degenerate, otherwise account for\n // remainder\n if (intervalLength === 0 ||\n ((intervalLength < 0) !== (denseSpec.strides[i] < 0))) {\n sizeI = 0;\n } else {\n sizeI = Math.trunc(intervalLength / denseSpec.strides[i]) +\n (intervalLength % denseSpec.strides[i] !== 0 ? 1 : 0);\n }\n processingShape.push(sizeI);\n } else {\n processingShape.push(-1);\n }\n }\n\n // Step 4: Compute the final shape\n //\n // newAxis will increase dimension by 1 (with a one-size dimension)\n // slices like foo[3, ...] will reduce dimension by 1.\n // This cannot be done earlier, because it depends on Step 3.\n for (let denseDim = 0; denseDim < denseSpec.finalShapeGatherIndices.length;\n ++denseDim) {\n const gatherIndex = denseSpec.finalShapeGatherIndices[denseDim];\n if (gatherIndex >= 0) {\n finalShape.push(processingShape[gatherIndex]);\n } else if (gatherIndex === NEW_AXIS) {\n finalShape.push(1);\n }\n }\n\n const finalShapeSparse = finalShape.filter(\n (dim, i) => denseSpec.finalShapeGatherIndices[i] !== NEW_AXIS);\n\n return {\n finalShapeSparse,\n finalShape,\n isIdentity,\n sliceDim0,\n isSimpleSlice,\n begin: denseSpec.begin,\n end: denseSpec.end,\n strides: denseSpec.strides\n };\n}\n\nfunction buildDenseSpec(\n sparse: StridedSliceSparseSpec, dense: StridedSliceDenseSpec) {\n dense.beginMask = 0;\n dense.endMask = 0;\n dense.shrinkAxisMask = 0;\n\n let fullIndex = 0;\n dense.beginValid = sparse.begin != null;\n dense.endValid = sparse.end != null;\n\n dense.begin = new Array(dense.dims);\n dense.end = new Array(dense.dims);\n dense.strides = new Array(dense.dims);\n dense.finalShapeGatherIndices = [];\n dense.finalShapeGatherIndicesSparse = [];\n dense.inputShapeGatherIndicesSparse = new Array(dense.dims);\n\n for (let i = 0; i < sparse.dims; i++) {\n if ((1 << i) & sparse.ellipsisMask) {\n // Only the bit that has ellipsis will fall in this condition.\n // Expand the ellipsis into the appropriate indices\n // Note: this only works because we guaranteed one ellipsis.\n const nextIndex = Math.min(\n dense.dims - (sparse.dims - i) + 1 + sparse.numAddAxisAfterEllipsis,\n dense.dims);\n for (; fullIndex < nextIndex; fullIndex++) {\n // newAxis aren't real axis so you have to skip.\n dense.begin[fullIndex] = 0;\n dense.end[fullIndex] = 0;\n dense.strides[fullIndex] = 1;\n dense.beginMask |= (1 << fullIndex);\n dense.endMask |= (1 << fullIndex);\n dense.finalShapeGatherIndices.push(fullIndex);\n dense.finalShapeGatherIndicesSparse.push(-1);\n dense.inputShapeGatherIndicesSparse[fullIndex] = i;\n }\n } else if ((1 << i) & sparse.newAxisMask) {\n // Only the bit that has newAxis will fall in this condition.\n dense.finalShapeGatherIndices.push(NEW_AXIS);\n dense.finalShapeGatherIndicesSparse.push(-1);\n } else {\n if (fullIndex === dense.begin.length) {\n throw Error(\n `Index out of range using input dim ${fullIndex}; input ` +\n `has only ${dense.dims} dims, ${dense.begin.length}.`);\n }\n\n // Gather slicing spec into appropriate index.\n if (sparse.begin != null) {\n dense.begin[fullIndex] = sparse.begin[i];\n }\n if (sparse.end != null) {\n dense.end[fullIndex] = sparse.end[i];\n }\n dense.strides[fullIndex] = sparse.strides[i];\n if (sparse.beginMask & (1 << i)) {\n dense.beginMask |= (1 << fullIndex);\n }\n if (sparse.endMask & (1 << i)) {\n dense.endMask |= (1 << fullIndex);\n }\n // If shrink, record where to get the dimensionality from (i.e. newAxis)\n // creates a fake 1 size dimension. Also remember shrink axis (now in\n // dense form) so we can ignore dense.end below.\n if (sparse.shrinkAxisMask & (1 << i)) {\n dense.finalShapeGatherIndices.push(SHRINK_AXIS);\n dense.finalShapeGatherIndicesSparse.push(-1);\n dense.shrinkAxisMask |= (1 << fullIndex);\n } else {\n dense.finalShapeGatherIndices.push(fullIndex);\n // Remember that where in the sparse shape the dense dim comes from.\n dense.finalShapeGatherIndicesSparse.push(i);\n }\n dense.inputShapeGatherIndicesSparse[fullIndex] = i;\n fullIndex++;\n }\n }\n}\n\nfunction canonical(\n x: number, c: number, strideI: number, dimI: number, masks: number[],\n validRange: number[]) {\n if (masks[c]) {\n return strideI > 0 ? validRange[c] : validRange[(c + 1) & 1];\n } else {\n const xFwd = x < 0 ? dimI + x : x; // make negative indices positive\n return xFwd < validRange[0] ? validRange[0] :\n xFwd > validRange[1] ? validRange[1] : xFwd;\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {assert} from './util';\n\n/**\n * Types to support JSON-esque data structures internally.\n *\n * Internally ConfigDict's use camelCase keys and values where the\n * values are class names to be instantiated. On the python side, these\n * will be snake_case. Internally we allow Enums into the values for better\n * type safety, but these need to be converted to raw primitives (usually\n * strings) for round-tripping with python.\n *\n * toConfig returns the TS-friendly representation. model.toJSON() returns\n * the pythonic version as that's the portable format. If you need to\n * python-ify a non-model level toConfig output, you'll need to use a\n * convertTsToPythonic from serialization_utils in -Layers.\n *\n */\nexport declare type ConfigDictValue =\n boolean | number | string | null | ConfigDictArray | ConfigDict;\nexport declare interface ConfigDict {\n [key: string]: ConfigDictValue;\n}\nexport declare interface ConfigDictArray extends Array {}\n\n/**\n * Type to represent the class-type of Serializable objects.\n *\n * Ie the class prototype with access to the constructor and any\n * static members/methods. Instance methods are not listed here.\n *\n * Source for this idea: https://stackoverflow.com/a/43607255\n */\nexport declare type SerializableConstructor = {\n // tslint:disable-next-line:no-any\n new (...args: any[]): T; className: string; fromConfig: FromConfigMethod;\n};\nexport declare type FromConfigMethod =\n (cls: SerializableConstructor, config: ConfigDict) => T;\n\n/**\n * Serializable defines the serialization contract.\n *\n * TFJS requires serializable classes to return their className when asked\n * to avoid issues with minification.\n */\nexport abstract class Serializable {\n /**\n * Return the class name for this class to use in serialization contexts.\n *\n * Generally speaking this will be the same thing that constructor.name\n * would have returned. However, the class name needs to be robust\n * against minification for serialization/deserialization to work properly.\n *\n * There's also places such as initializers.VarianceScaling, where\n * implementation details between different languages led to different\n * class hierarchies and a non-leaf node is used for serialization purposes.\n */\n getClassName(): string {\n return (this.constructor as SerializableConstructor)\n .className;\n }\n\n /**\n * Return all the non-weight state needed to serialize this object.\n */\n abstract getConfig(): ConfigDict;\n\n /**\n * Creates an instance of T from a ConfigDict.\n *\n * This works for most descendants of serializable. A few need to\n * provide special handling.\n * @param cls A Constructor for the class to instantiate.\n * @param config The Configuration for the object.\n */\n /** @nocollapse */\n static fromConfig(\n cls: SerializableConstructor, config: ConfigDict): T {\n return new cls(config);\n }\n}\n\n/**\n * Maps string keys to class constructors.\n *\n * Used during (de)serialization from the cross-language JSON format, which\n * requires the class name in the serialization format matches the class\n * names as used in Python, should it exist.\n */\nexport class SerializationMap {\n private static instance: SerializationMap;\n classNameMap: {\n [className: string]:\n [SerializableConstructor, FromConfigMethod]\n };\n\n private constructor() {\n this.classNameMap = {};\n }\n\n /**\n * Returns the singleton instance of the map.\n */\n static getMap(): SerializationMap {\n if (SerializationMap.instance == null) {\n SerializationMap.instance = new SerializationMap();\n }\n return SerializationMap.instance;\n }\n\n /**\n * Registers the class as serializable.\n */\n static register(cls: SerializableConstructor) {\n SerializationMap.getMap().classNameMap[cls.className] =\n [cls, cls.fromConfig];\n }\n}\n\n/**\n * Register a class with the serialization map of TensorFlow.js.\n *\n * This is often used for registering custom Layers, so they can be\n * serialized and deserialized.\n *\n * Example:\n *\n * ```js\n * class MyCustomLayer extends tf.layers.Layer {\n * static className = 'MyCustomLayer';\n *\n * constructor(config) {\n * super(config);\n * }\n * }\n * tf.serialization.registerClass(MyCustomLayer);\n * ```\n *\n * @param cls The class to be registered. It must have a public static member\n * called `className` defined and the value must be a non-empty string.\n *\n * @doc {heading: 'Models', subheading: 'Serialization', ignoreCI: true}\n */\nexport function registerClass(\n cls: SerializableConstructor) {\n assert(\n cls.className != null,\n () => `Class being registered does not have the static className ` +\n `property defined.`);\n assert(\n typeof cls.className === 'string',\n () => `className is required to be a string, but got type ` +\n typeof cls.className);\n assert(\n cls.className.length > 0,\n () => `Class being registered has an empty-string as its className, ` +\n `which is disallowed.`);\n\n SerializationMap.register(cls);\n}\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from './engine';\nimport {inferShape} from './tensor_util_env';\nimport {RecursiveArray, TensorLike, TypedArray} from './types';\nimport {arraysEqual, encodeString, flatten, isString, isTypedArray} from './util';\n\nconst TEST_EPSILON_FLOAT32 = 1e-3;\nexport const TEST_EPSILON_FLOAT16 = 1e-1;\n\nexport function expectArraysClose(\n actual: TypedArray|number|RecursiveArray,\n expected: TypedArray|number|RecursiveArray, epsilon?: number) {\n if (epsilon == null) {\n epsilon = testEpsilon();\n }\n return expectArraysPredicate(\n actual, expected, (a, b) => areClose(a as number, b as number, epsilon));\n}\n\nexport function testEpsilon() {\n return ENGINE.backend.floatPrecision() === 32 ? TEST_EPSILON_FLOAT32 :\n TEST_EPSILON_FLOAT16;\n}\n\nfunction expectArraysPredicate(\n actual: TensorLike, expected: TensorLike,\n predicate: (a: {}, b: {}) => boolean) {\n let checkClassType = true;\n if (isTypedArray(actual) || isTypedArray(expected)) {\n checkClassType = false;\n }\n if (isTypedArray(actual) && isTypedArray(expected)) {\n checkClassType = true;\n }\n if (checkClassType) {\n const aType = actual.constructor.name;\n const bType = expected.constructor.name;\n\n if (aType !== bType) {\n throw new Error(\n `Arrays are of different type. Actual: ${aType}. ` +\n `Expected: ${bType}`);\n }\n }\n\n if (Array.isArray(actual) && Array.isArray(expected)) {\n const actualShape = inferShape(actual);\n const expectedShape = inferShape(expected);\n if (!arraysEqual(actualShape, expectedShape)) {\n throw new Error(\n `Arrays have different shapes. ` +\n `Actual: [${actualShape}]. Expected: [${expectedShape}]`);\n }\n }\n\n const actualFlat =\n isTypedArray(actual) ? actual : flatten(actual as RecursiveArray);\n const expectedFlat = isTypedArray(expected) ?\n expected :\n flatten(expected as RecursiveArray);\n\n if (actualFlat.length !== expectedFlat.length) {\n throw new Error(\n `Arrays have different lengths actual: ${actualFlat.length} vs ` +\n `expected: ${expectedFlat.length}.\\n` +\n `Actual: ${actualFlat}.\\n` +\n `Expected: ${expectedFlat}.`);\n }\n for (let i = 0; i < expectedFlat.length; ++i) {\n const a = actualFlat[i];\n const e = expectedFlat[i];\n\n if (!predicate(a, e)) {\n throw new Error(\n `Arrays differ: actual[${i}] = ${a}, expected[${i}] = ${e}.\\n` +\n `Actual: ${actualFlat}.\\n` +\n `Expected: ${expectedFlat}.`);\n }\n }\n if (typeof expect !== 'undefined') {\n expect().nothing();\n }\n}\n\nexport interface DoneFn {\n (): void;\n fail: (message?: Error|string) => void;\n}\n\nexport function expectPromiseToFail(fn: () => Promise<{}>, done: DoneFn): void {\n fn().then(() => done.fail(), () => done());\n if (typeof expect !== 'undefined') {\n expect().nothing();\n }\n}\n\nexport function expectArraysEqual(actual: TensorLike, expected: TensorLike) {\n const exp = typeof expected === 'string' || typeof expected === 'number' ||\n typeof expected === 'boolean' ?\n [expected] as number[] :\n expected as number[];\n if (isString(actual) || isString((actual as string[])[0]) ||\n isString(expected) || isString((expected as string[])[0])) {\n // tslint:disable-next-line: triple-equals\n return expectArraysPredicate(actual, exp, (a, b) => a == b);\n }\n return expectArraysPredicate(\n actual, expected, (a, b) => areClose(a as number, b as number, 0));\n}\n\nexport function expectNumbersClose(a: number, e: number, epsilon?: number) {\n if (epsilon == null) {\n epsilon = testEpsilon();\n }\n if (!areClose(a, e, epsilon)) {\n throw new Error(`Numbers differ: actual === ${a}, expected === ${e}`);\n }\n if (typeof expect !== 'undefined') {\n expect().nothing();\n }\n}\n\nfunction areClose(a: number, e: number, epsilon: number): boolean {\n if (!isFinite(a) && !isFinite(e)) {\n return true;\n }\n if (isNaN(a) || isNaN(e) || Math.abs(a - e) > epsilon) {\n return false;\n }\n return true;\n}\n\nexport function expectValuesInRange(\n actual: TypedArray|number[], low: number, high: number) {\n for (let i = 0; i < actual.length; i++) {\n if (actual[i] < low || actual[i] > high) {\n throw new Error(\n `Value out of range:${actual[i]} low: ${low}, high: ${high}`);\n }\n }\n}\n\nexport function expectArrayBuffersEqual(\n actual: ArrayBuffer, expected: ArrayBuffer) {\n // Safari does not like comparing ArrayBuffers directly. Wrapping in\n // a Float32Array solves this issue.\n const actualArray = new Float32Array(actual);\n const expectedArray = new Float32Array(expected);\n if (actualArray.length !== expectedArray.length) {\n throw new Error(\n 'Expected ArrayBuffer to be of length ' +\n `${expectedArray.length}, but it was ${actualArray.length}`);\n }\n\n for (let i = 0; i < expectedArray.length; i++) {\n if (actualArray[i] !== expectedArray[i]) {\n throw new Error(\n `Expected ArrayBuffer value at ${i} to be ` +\n `${expectedArray[i]} but got ${actualArray[i]} instead`);\n }\n }\n}\n\n/** Encodes strings into utf-8 bytes. */\nexport function encodeStrings(a: RecursiveArray<{}>):\n RecursiveArray {\n for (let i = 0; i < (a as Array<{}>).length; i++) {\n const val = a[i];\n if (Array.isArray(val)) {\n encodeStrings(val);\n } else {\n a[i] = encodeString(val as string);\n }\n }\n return a as RecursiveArray;\n}\n\n/** Creates an HTMLVideoElement with autoplay-friendly default settings. */\nexport function createVideoElement(source: HTMLSourceElement):\n Promise {\n const video = document.createElement('video');\n if ('playsInline' in video) {\n // tslint:disable-next-line:no-any\n (video as any).playsInline = true;\n }\n video.muted = true;\n video.loop = true;\n video.style.position = 'fixed';\n video.style.left = '0px';\n video.style.top = '0px';\n\n video.preload = 'auto';\n video.appendChild(source);\n return new Promise(resolve => {\n video.addEventListener('loadeddata', _ => resolve(video));\n video.load();\n });\n}\n\nexport async function play(video: HTMLVideoElement) {\n await video.play();\n if ('requestVideoFrameCallback' in video) {\n await new Promise(resolve => {\n // tslint:disable-next-line:no-any\n (video as any).requestVideoFrameCallback(resolve);\n });\n }\n}\n","/** @license See the LICENSE file. */\n\n// This code is auto-generated, do not modify this file!\nconst version = '4.0.0';\nexport {version};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Add, AddInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Adds two `tf.Tensor`s element-wise, A + B. Supports broadcasting.\n *\n *\n * ```js\n * const a = tf.tensor1d([1, 2, 3, 4]);\n * const b = tf.tensor1d([10, 20, 30, 40]);\n *\n * a.add(b).print(); // or tf.add(a, b)\n * ```\n *\n * ```js\n * // Broadcast add a with b.\n * const a = tf.scalar(5);\n * const b = tf.tensor1d([10, 20, 30, 40]);\n *\n * a.add(b).print(); // or tf.add(a, b)\n * ```\n * @param a The first `tf.Tensor` to add.\n * @param b The second `tf.Tensor` to add. Must have the same type as `a`.\n *\n * @doc {heading: 'Operations', subheading: 'Arithmetic'}\n */\nfunction add_(a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n let $a = convertToTensor(a, 'a', 'add');\n let $b = convertToTensor(b, 'b', 'add');\n [$a, $b] = makeTypesMatch($a, $b);\n\n const inputs: AddInputs = {a: $a, b: $b};\n\n return ENGINE.runKernel(Add, inputs as {} as NamedTensorMap);\n}\n\nexport const add = op({add_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {FloorDiv, FloorDivInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Divides two `tf.Tensor`s element-wise, A / B. Supports broadcasting.\n * The result is rounded with floor function.\n *\n *\n * ```js\n * const a = tf.tensor1d([1, 4, 9, 16]);\n * const b = tf.tensor1d([1, 2, 3, 4]);\n *\n * a.floorDiv(b).print(); // or tf.div(a, b)\n * ```\n *\n * ```js\n * // Broadcast div a with b.\n * const a = tf.tensor1d([2, 4, 6, 8]);\n * const b = tf.scalar(2);\n *\n * a.floorDiv(b).print(); // or tf.floorDiv(a, b)\n * ```\n *\n * @param a The first tensor as the numerator.\n * @param b The second tensor as the denominator. Must have the same dtype as\n * `a`.\n *\n * @doc {heading: 'Operations', subheading: 'Arithmetic'}\n */\nfunction floorDiv_(\n a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n let $a = convertToTensor(a, 'a', 'floorDiv');\n let $b = convertToTensor(b, 'b', 'floorDiv');\n [$a, $b] = makeTypesMatch($a, $b);\n\n const inputs: FloorDivInputs = {a: $a, b: $b};\n\n return ENGINE.runKernel(FloorDiv, inputs as {} as NamedTensorMap);\n}\n\nexport const floorDiv = op({floorDiv_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {RealDiv, RealDivInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {floorDiv} from './floorDiv';\nimport {op} from './operation';\n\n/**\n * Divides two `tf.Tensor`s element-wise, A / B. Supports broadcasting.\n *\n * ```js\n * const a = tf.tensor1d([1, 4, 9, 16]);\n * const b = tf.tensor1d([1, 2, 3, 4]);\n *\n * a.div(b).print(); // or tf.div(a, b)\n * ```\n *\n * ```js\n * // Broadcast div a with b.\n * const a = tf.tensor1d([2, 4, 6, 8]);\n * const b = tf.scalar(2);\n *\n * a.div(b).print(); // or tf.div(a, b)\n * ```\n *\n * @param a The first tensor as the numerator.\n * @param b The second tensor as the denominator. Must have the same dtype as\n * `a`.\n *\n * @doc {heading: 'Operations', subheading: 'Arithmetic'}\n */\nfunction div_(a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n let $a = convertToTensor(a, 'a', 'div');\n let $b = convertToTensor(b, 'b', 'div');\n [$a, $b] = makeTypesMatch($a, $b);\n\n if ($a.dtype === 'int32' && $b.dtype === 'int32') {\n return floorDiv($a, $b);\n }\n\n const inputs: RealDivInputs = {a: $a, b: $b};\n const attrs = {};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n return ENGINE.runKernel(RealDiv, inputs as {} as NamedTensorMap, attrs) as T;\n}\n\nexport const div = op({div_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Multiply, MultiplyInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Multiplies two `tf.Tensor`s element-wise, A * B. Supports broadcasting.\n *\n * We also expose `tf.mulStrict` which has the same signature as this op and\n * asserts that `a` and `b` are the same shape (does not broadcast).\n *\n * ```js\n * const a = tf.tensor1d([1, 2, 3, 4]);\n * const b = tf.tensor1d([2, 3, 4, 5]);\n *\n * a.mul(b).print(); // or tf.mul(a, b)\n * ```\n *\n * ```js\n * // Broadcast mul a with b.\n * const a = tf.tensor1d([1, 2, 3, 4]);\n * const b = tf.scalar(5);\n *\n * a.mul(b).print(); // or tf.mul(a, b)\n * ```\n * @param a The first tensor to multiply.\n * @param b The second tensor to multiply. Must have the same dtype as `a`.\n *\n * @doc {heading: 'Operations', subheading: 'Arithmetic'}\n */\nfunction mul_(a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n let $a = convertToTensor(a, 'a', 'mul');\n let $b = convertToTensor(b, 'b', 'mul');\n [$a, $b] = makeTypesMatch($a, $b);\n\n const inputs: MultiplyInputs = {a: $a, b: $b};\n\n return ENGINE.runKernel(Multiply, inputs as {} as NamedTensorMap);\n}\nexport const mul = op({mul_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Abs, AbsInputs, ComplexAbs, ComplexAbsInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes absolute value element-wise: `abs(x)`\n *\n * ```js\n * const x = tf.tensor1d([-1, 2, -3, 4]);\n *\n * x.abs().print(); // or tf.abs(x)\n * ```\n * @param x The input `tf.Tensor`.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction abs_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'abs');\n\n if ($x.dtype === 'complex64') {\n const inputs: ComplexAbsInputs = {x: $x};\n return ENGINE.runKernel(ComplexAbs, inputs as {} as NamedTensorMap);\n } else {\n const inputs: AbsInputs = {x: $x};\n return ENGINE.runKernel(Abs, inputs as {} as NamedTensorMap);\n }\n}\n\nexport const abs = op({abs_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Acos, AcosInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes acos of the input `tf.Tensor` element-wise: `acos(x)`\n *\n * ```js\n * const x = tf.tensor1d([0, 1, -1, .7]);\n *\n * x.acos().print(); // or tf.acos(x)\n * ```\n * @param x The input tensor.\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction acos_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'acos');\n const inputs: AcosInputs = {x: $x};\n\n return ENGINE.runKernel(Acos, inputs as {} as NamedTensorMap);\n}\nexport const acos = op({acos_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Acosh, AcoshInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes the inverse hyperbolic cos of the input `tf.Tensor` element-wise:\n * `acosh(x)`\n *\n * ```js\n * const x = tf.tensor1d([10, 1, 3, 5.7]);\n *\n * x.acosh().print(); // or tf.acosh(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction acosh_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'acosh');\n const inputs: AcoshInputs = {x: $x};\n\n return ENGINE.runKernel(Acosh, inputs as {} as NamedTensorMap);\n}\nexport const acosh = op({acosh_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {AddN, AddNInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\n\n/**\n * Adds a list of `tf.Tensor`s element-wise, each with the same shape and dtype.\n *\n * ```js\n * const a = tf.tensor1d([1, 2]);\n * const b = tf.tensor1d([3, 4]);\n * const c = tf.tensor1d([5, 6]);\n *\n * tf.addN([a, b, c]).print();\n * ```\n * @param tensors A list of tensors with the same shape and dtype.\n * @doc {heading: 'Operations', subheading: 'Arithmetic'}\n */\nfunction addN_(tensors: Array): T {\n util.assert(\n Array.isArray(tensors),\n () => 'The argument passed to tf.addN() must be a list of tensors');\n util.assert(\n tensors.length >= 1,\n () => `Must pass at least one tensor to tf.addN(), but got ` +\n `${tensors.length}`);\n\n const $tensors =\n tensors.map((t, i) => convertToTensor(t, `tensors${i}`, 'addN'));\n\n const firstTensor = $tensors[0];\n $tensors.forEach(t => {\n if (t.dtype !== firstTensor.dtype) {\n throw new Error(\n 'All tensors passed to tf.addN() must have the same dtype');\n }\n });\n\n $tensors.forEach(t => {\n if (!util.arraysEqual(t.shape, firstTensor.shape)) {\n throw new Error(\n 'All tensors passed to tf.addN() must have the same shape');\n }\n });\n\n const inputs: AddNInputs = $tensors;\n\n return ENGINE.runKernel(AddN, inputs as {} as NamedTensorMap);\n}\n\nexport const addN = op({addN_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {All, AllAttrs, AllInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes the logical and of elements across dimensions of a `tf.Tensor`.\n *\n * Reduces the input along the dimensions given in `axes`. Unless `keepDims`\n * is true, the rank of the `tf.Tensor` is reduced by 1 for each entry in\n * `axes`. If `keepDims` is true, the reduced dimensions are retained with\n * length 1. If `axes` has no entries, all dimensions are reduced, and a\n * `tf.Tensor` with a single element is returned.\n *\n * ```js\n * const x = tf.tensor1d([1, 1, 1], 'bool');\n *\n * x.all().print(); // or tf.all(x)\n * ```\n *\n * ```js\n * const x = tf.tensor2d([1, 1, 0, 0], [2, 2], 'bool');\n *\n * const axis = 1;\n * x.all(axis).print(); // or tf.all(x, axis)\n * ```\n *\n * @param x The input tensor. Must be of dtype bool.\n * @param axis The dimension(s) to reduce. By default it reduces\n * all dimensions.\n * @param keepDims If true, retains reduced dimensions with size 1.\n *\n * @doc {heading: 'Operations', subheading: 'Reduction'}\n */\nfunction all_(\n x: Tensor|TensorLike, axis: number|number[] = null, keepDims = false): T {\n const $x = convertToTensor(x, 'x', 'all', 'bool');\n\n const inputs: AllInputs = {x: $x};\n const attrs: AllAttrs = {axis, keepDims};\n\n return ENGINE.runKernel(\n All, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const all = op({all_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Any, AnyAttrs, AnyInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes the logical or of elements across dimensions of a `tf.Tensor`.\n *\n * Reduces the input along the dimensions given in `axes`. Unless `keepDims`\n * is true, the rank of the `tf.Tensor` is reduced by 1 for each entry in\n * `axes`. If `keepDims` is true, the reduced dimensions are retained with\n * length 1. If `axes` has no entries, all dimensions are reduced, and a\n * `tf.Tensor` with a single element is returned.\n *\n * ```js\n * const x = tf.tensor1d([1, 1, 1], 'bool');\n *\n * x.any().print(); // or tf.any(x)\n * ```\n *\n * ```js\n * const x = tf.tensor2d([1, 1, 0, 0], [2, 2], 'bool');\n *\n * const axis = 1;\n * x.any(axis).print(); // or tf.any(x, axis)\n * ```\n *\n * @param x The input tensor. Must be of dtype bool.\n * @param axis The dimension(s) to reduce. By default it reduces\n * all dimensions.\n * @param keepDims If true, retains reduced dimensions with size 1.\n *\n * @doc {heading: 'Operations', subheading: 'Reduction'}\n */\nfunction any_(\n x: Tensor|TensorLike, axis: number|number[] = null, keepDims = false): T {\n const $x = convertToTensor(x, 'x', 'any', 'bool');\n\n const inputs: AnyInputs = {x: $x};\n const attrs: AnyAttrs = {axis, keepDims};\n\n return ENGINE.runKernel(\n Any, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\n// tslint:disable-next-line:variable-name\nexport const any = op({any_});\n","/**\n * @license\n * Copyright 2020 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {ArgMax, ArgMaxAttrs, ArgMaxInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Returns the indices of the maximum values along an `axis`.\n *\n * The result has the same shape as `input` with the dimension along `axis`\n * removed.\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 3]);\n *\n * x.argMax().print(); // or tf.argMax(x)\n * ```\n *\n * ```js\n * const x = tf.tensor2d([1, 2, 4, 3], [2, 2]);\n *\n * const axis = 1;\n * x.argMax(axis).print(); // or tf.argMax(x, axis)\n * ```\n *\n * @param x The input tensor.\n * @param axis The dimension to reduce. Defaults to 0 (outer-most dimension).\n *\n * @doc {heading: 'Operations', subheading: 'Reduction'}\n */\nfunction argMax_(x: Tensor|TensorLike, axis = 0): T {\n const $x = convertToTensor(x, 'x', 'argMax');\n\n const inputs: ArgMaxInputs = {x: $x};\n const attrs: ArgMaxAttrs = {axis};\n\n return ENGINE.runKernel(\n ArgMax, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const argMax = op({argMax_});\n","/**\n * @license\n * Copyright 2020 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {ArgMin, ArgMinAttrs, ArgMinInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Returns the indices of the minimum values along an `axis`.\n *\n * The result has the same shape as `input` with the dimension along `axis`\n * removed.\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 3]);\n *\n * x.argMin().print(); // or tf.argMin(x)\n * ```\n *\n * ```js\n * const x = tf.tensor2d([1, 2, 4, 3], [2, 2]);\n *\n * const axis = 1;\n * x.argMin(axis).print(); // or tf.argMin(x, axis)\n * ```\n *\n * @param x The input tensor.\n * @param axis The dimension to reduce. Defaults to 0 (outer-most dimension).\n *\n * @doc {heading: 'Operations', subheading: 'Reduction'}\n */\nfunction argMin_(x: Tensor|TensorLike, axis = 0): T {\n const $x = convertToTensor(x, 'x', 'argMin');\n\n const inputs: ArgMinInputs = {x: $x};\n const attrs: ArgMinAttrs = {axis};\n\n return ENGINE.runKernel(\n ArgMin, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const argMin = op({argMin_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Asin, AsinInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes asin of the input `tf.Tensor` element-wise: `asin(x)`\n *\n * ```js\n * const x = tf.tensor1d([0, 1, -1, .7]);\n *\n * x.asin().print(); // or tf.asin(x)\n * ```\n * @param x The input tensor.\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction asin_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'asin');\n const inputs: AsinInputs = {x: $x};\n\n return ENGINE.runKernel(Asin, inputs as {} as NamedTensorMap);\n}\nexport const asin = op({asin_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Asinh, AsinhInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes inverse hyperbolic sin of the input `tf.Tensor` element-wise:\n * `asinh(x)`\n *\n * ```js\n * const x = tf.tensor1d([0, 1, -1, .7]);\n *\n * x.asinh().print(); // or tf.asinh(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction asinh_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'asinh');\n\n const inputs: AsinhInputs = {x: $x};\n\n return ENGINE.runKernel(Asinh, inputs as {} as NamedTensorMap);\n}\nexport const asinh = op({asinh_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Atan, AtanInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes atan of the input `tf.Tensor` element-wise: `atan(x)`\n *\n * ```js\n * const x = tf.tensor1d([0, 1, -1, .7]);\n *\n * x.atan().print(); // or tf.atan(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction atan_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'atan');\n\n const inputs: AtanInputs = {x: $x};\n\n return ENGINE.runKernel(Atan, inputs as {} as NamedTensorMap);\n}\nexport const atan = op({atan_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Atan2, Atan2Inputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes arctangent of `tf.Tensor`s a / b element-wise: `atan2(a, b)`.\n * Supports broadcasting.\n *\n * ```js\n * const a = tf.tensor1d([1.0, 1.0, -1.0, .7]);\n * const b = tf.tensor1d([2.0, 13.0, 3.5, .21]);\n *\n * tf.atan2(a, b).print()\n * ```\n *\n * @param a The first tensor.\n * @param b The second tensor. Must have the same dtype as `a`.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction atan2_(\n a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n let $a = convertToTensor(a, 'a', 'atan2');\n let $b = convertToTensor(b, 'b', 'atan2');\n [$a, $b] = makeTypesMatch($a, $b);\n\n const inputs: Atan2Inputs = {a: $a, b: $b};\n\n return ENGINE.runKernel(Atan2, inputs as {} as NamedTensorMap);\n}\n\nexport const atan2 = op({atan2_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Atanh, AtanhInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes inverse hyperbolic tan of the input `tf.Tensor` element-wise:\n * `atanh(x)`\n *\n * ```js\n * const x = tf.tensor1d([0, .1, -.1, .7]);\n *\n * x.atanh().print(); // or tf.atanh(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction atanh_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'atanh');\n\n const inputs: AtanhInputs = {x: $x};\n\n return ENGINE.runKernel(Atanh, inputs as {} as NamedTensorMap);\n}\nexport const atanh = op({atanh_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport * as util from '../util';\n\ntype PadType = 'SAME'|'VALID'|'NUMBER'|'EXPLICIT';\n\n// For NHWC should be in the following form:\n// [[0, 0], [pad_top,pad_bottom], [pad_left, pad_right], [0, 0]]\n// For NCHW should be in the following form:\n// [[0, 0], [0, 0], [pad_top,pad_bottom], [pad_left, pad_right]]\n// Reference: https://www.tensorflow.org/api_docs/python/tf/nn/conv2d\nexport type ExplicitPadding =\n [[number, number], [number, number], [number, number], [number, number]];\n\nexport type PadInfo = {\n top: number,\n left: number,\n right: number,\n bottom: number,\n type: PadType\n};\n\nexport type PadInfo3D = {\n top: number,\n left: number,\n right: number,\n bottom: number,\n front: number,\n back: number,\n type: PadType\n};\n\n/**\n * Information about the forward pass of a convolution/pooling operation.\n * It includes input and output shape, strides, filter size and padding\n * information.\n */\nexport type Conv2DInfo = {\n batchSize: number,\n inHeight: number,\n inWidth: number,\n inChannels: number,\n outHeight: number,\n outWidth: number,\n outChannels: number,\n dataFormat: 'channelsFirst'|'channelsLast',\n strideHeight: number,\n strideWidth: number,\n dilationHeight: number,\n dilationWidth: number,\n filterHeight: number,\n filterWidth: number,\n effectiveFilterHeight: number,\n effectiveFilterWidth: number,\n padInfo: PadInfo,\n inShape: [number, number, number, number],\n outShape: [number, number, number, number],\n filterShape: [number, number, number, number]\n};\n\n/**\n *\n * @param inputShape Input tensor shape is of the following dimensions:\n * `[batch, height, width, inChannels]`.\n * @param filterShape The filter shape is of the following dimensions:\n * `[filterHeight, filterWidth, depth]`.\n * @param strides The strides of the sliding window for each dimension of the\n * input tensor: `[strideHeight, strideWidth]`.\n * If `strides` is a single number,\n * then `strideHeight == strideWidth`.\n * @param pad The type of padding algorithm.\n * - `same` and stride 1: output will be of same size as input,\n * regardless of filter size.\n * - `valid`: output will be smaller than input if filter is larger\n * than 1*1x1.\n * - For more info, see this guide:\n * [https://www.tensorflow.org/api_docs/python/tf/nn/convolution](\n * https://www.tensorflow.org/api_docs/python/tf/nn/convolution)\n * @param dataFormat The data format of the input and output data.\n * Defaults to 'NHWC'.\n * @param dilations The dilation rates: `[dilationHeight, dilationWidth]`.\n * Defaults to `[1, 1]`. If `dilations` is a single number, then\n * `dilationHeight == dilationWidth`.\n */\nexport function computeDilation2DInfo(\n inputShape: [number, number, number, number],\n filterShape: [number, number, number], strides: number|[number, number],\n pad: 'same'|'valid'|number, dataFormat: 'NHWC' = 'NHWC',\n dilations: number|[number, number]) {\n // `computerConv2DInfo` require filterShape to be in the dimension of:\n // `[filterHeight, filterWidth, depth, outDepth]`, dilation2d doesn't have\n // outDepth, it should have the same depth as the input.\n // Input shape: [batch, height, width, inChannels]\n const inputChannels = inputShape[3];\n const $filterShape =\n [...filterShape, inputChannels] as [number, number, number, number];\n const $dataFormat = convertConv2DDataFormat(dataFormat);\n\n return computeConv2DInfo(\n inputShape, $filterShape, strides, dilations, pad,\n null /* roundingMode */, null /* depthWise */, $dataFormat);\n}\n\nexport function computePool2DInfo(\n inShape: [number, number, number, number],\n filterSize: [number, number]|number, strides: number|[number, number],\n dilations: number|[number, number],\n pad: 'same'|'valid'|number|ExplicitPadding,\n roundingMode?: 'floor'|'round'|'ceil',\n dataFormat: 'channelsFirst'|'channelsLast' = 'channelsLast'): Conv2DInfo {\n const [filterHeight, filterWidth] = parseTupleParam(filterSize);\n\n let filterShape: [number, number, number, number];\n if (dataFormat === 'channelsLast') {\n filterShape = [filterHeight, filterWidth, inShape[3], inShape[3]];\n } else if (dataFormat === 'channelsFirst') {\n filterShape = [filterHeight, filterWidth, inShape[1], inShape[1]];\n } else {\n throw new Error(`Unknown dataFormat ${dataFormat}`);\n }\n\n return computeConv2DInfo(\n inShape, filterShape, strides, dilations, pad, roundingMode, false,\n dataFormat);\n}\n\n/**\n * Computes the information for a forward pass of a pooling3D operation.\n */\nexport function computePool3DInfo(\n inShape: [number, number, number, number, number],\n filterSize: number|[number, number, number],\n strides: number|[number, number, number],\n dilations: number|[number, number, number], pad: 'same'|'valid'|number,\n roundingMode?: 'floor'|'round'|'ceil',\n dataFormat: 'NDHWC'|'NCDHW' = 'NDHWC'): Conv3DInfo {\n const [filterDepth, filterHeight, filterWidth] = parse3TupleParam(filterSize);\n\n let filterShape: [number, number, number, number, number];\n let $dataFormat: 'channelsFirst'|'channelsLast';\n if (dataFormat === 'NDHWC') {\n $dataFormat = 'channelsLast';\n filterShape =\n [filterDepth, filterHeight, filterWidth, inShape[4], inShape[4]];\n } else if (dataFormat === 'NCDHW') {\n $dataFormat = 'channelsFirst';\n filterShape =\n [filterDepth, filterHeight, filterWidth, inShape[1], inShape[1]];\n } else {\n throw new Error(`Unknown dataFormat ${dataFormat}`);\n }\n\n return computeConv3DInfo(\n inShape, filterShape, strides, dilations, pad, false, $dataFormat,\n roundingMode);\n}\n\n/**\n * Computes the information for a forward pass of a convolution/pooling\n * operation.\n */\nexport function computeConv2DInfo(\n inShape: [number, number, number, number],\n filterShape: [number, number, number, number],\n strides: number|[number, number], dilations: number|[number, number],\n pad: 'same'|'valid'|number|ExplicitPadding,\n roundingMode?: 'floor'|'round'|'ceil', depthwise = false,\n dataFormat: 'channelsFirst'|'channelsLast' = 'channelsLast'): Conv2DInfo {\n let [batchSize, inHeight, inWidth, inChannels] = [-1, -1, -1, -1];\n if (dataFormat === 'channelsLast') {\n [batchSize, inHeight, inWidth, inChannels] = inShape;\n } else if (dataFormat === 'channelsFirst') {\n [batchSize, inChannels, inHeight, inWidth] = inShape;\n } else {\n throw new Error(`Unknown dataFormat ${dataFormat}`);\n }\n\n const [filterHeight, filterWidth, , filterChannels] = filterShape;\n const [strideHeight, strideWidth] = parseTupleParam(strides);\n const [dilationHeight, dilationWidth] = parseTupleParam(dilations);\n\n const effectiveFilterHeight =\n getEffectiveFilterSize(filterHeight, dilationHeight);\n const effectiveFilterWidth =\n getEffectiveFilterSize(filterWidth, dilationWidth);\n const {padInfo, outHeight, outWidth} = getPadAndOutInfo(\n pad, inHeight, inWidth, strideHeight, strideWidth, effectiveFilterHeight,\n effectiveFilterWidth, roundingMode, dataFormat);\n\n const outChannels = depthwise ? filterChannels * inChannels : filterChannels;\n\n let outShape: [number, number, number, number];\n if (dataFormat === 'channelsFirst') {\n outShape = [batchSize, outChannels, outHeight, outWidth];\n } else if (dataFormat === 'channelsLast') {\n outShape = [batchSize, outHeight, outWidth, outChannels];\n }\n\n return {\n batchSize,\n dataFormat,\n inHeight,\n inWidth,\n inChannels,\n outHeight,\n outWidth,\n outChannels,\n padInfo,\n strideHeight,\n strideWidth,\n filterHeight,\n filterWidth,\n effectiveFilterHeight,\n effectiveFilterWidth,\n dilationHeight,\n dilationWidth,\n inShape,\n outShape,\n filterShape\n };\n}\n\n/**\n * Information about the forward pass of a 3D convolution/pooling operation.\n * It includes input and output shape, strides, filter size and padding\n * information.\n */\nexport type Conv3DInfo = {\n batchSize: number,\n inDepth: number,\n inHeight: number,\n inWidth: number,\n inChannels: number,\n outDepth: number,\n outHeight: number,\n outWidth: number,\n outChannels: number,\n dataFormat: 'channelsFirst'|'channelsLast',\n strideDepth: number,\n strideHeight: number,\n strideWidth: number,\n dilationDepth: number,\n dilationHeight: number,\n dilationWidth: number,\n filterDepth: number,\n filterHeight: number,\n filterWidth: number,\n effectiveFilterDepth: number,\n effectiveFilterHeight: number,\n effectiveFilterWidth: number,\n padInfo: PadInfo3D,\n inShape: [number, number, number, number, number],\n outShape: [number, number, number, number, number],\n filterShape: [number, number, number, number, number]\n};\n\n/**\n * Computes the information for a forward pass of a 3D convolution/pooling\n * operation.\n */\nexport function computeConv3DInfo(\n inShape: [number, number, number, number, number],\n filterShape: [number, number, number, number, number],\n strides: number|[number, number, number],\n dilations: number|[number, number, number], pad: 'same'|'valid'|number,\n depthwise = false,\n dataFormat: 'channelsFirst'|'channelsLast' = 'channelsLast',\n roundingMode?: 'floor'|'round'|'ceil'): Conv3DInfo {\n let [batchSize, inDepth, inHeight, inWidth, inChannels] =\n [-1, -1, -1, -1, -1];\n if (dataFormat === 'channelsLast') {\n [batchSize, inDepth, inHeight, inWidth, inChannels] = inShape;\n } else if (dataFormat === 'channelsFirst') {\n [batchSize, inChannels, inDepth, inHeight, inWidth] = inShape;\n } else {\n throw new Error(`Unknown dataFormat ${dataFormat}`);\n }\n\n const [filterDepth, filterHeight, filterWidth, , filterChannels] =\n filterShape;\n const [strideDepth, strideHeight, strideWidth] = parse3TupleParam(strides);\n const [dilationDepth, dilationHeight, dilationWidth] =\n parse3TupleParam(dilations);\n\n const effectiveFilterDepth =\n getEffectiveFilterSize(filterDepth, dilationDepth);\n const effectiveFilterHeight =\n getEffectiveFilterSize(filterHeight, dilationHeight);\n const effectiveFilterWidth =\n getEffectiveFilterSize(filterWidth, dilationWidth);\n const {padInfo, outDepth, outHeight, outWidth} = get3DPadAndOutInfo(\n pad, inDepth, inHeight, inWidth, strideDepth, strideHeight, strideWidth,\n effectiveFilterDepth, effectiveFilterHeight, effectiveFilterWidth,\n roundingMode);\n\n const outChannels = depthwise ? filterChannels * inChannels : filterChannels;\n\n let outShape: [number, number, number, number, number];\n if (dataFormat === 'channelsFirst') {\n outShape = [batchSize, outChannels, outDepth, outHeight, outWidth];\n } else if (dataFormat === 'channelsLast') {\n outShape = [batchSize, outDepth, outHeight, outWidth, outChannels];\n }\n\n return {\n batchSize,\n dataFormat,\n inDepth,\n inHeight,\n inWidth,\n inChannels,\n outDepth,\n outHeight,\n outWidth,\n outChannels,\n padInfo,\n strideDepth,\n strideHeight,\n strideWidth,\n filterDepth,\n filterHeight,\n filterWidth,\n effectiveFilterDepth,\n effectiveFilterHeight,\n effectiveFilterWidth,\n dilationDepth,\n dilationHeight,\n dilationWidth,\n inShape,\n outShape,\n filterShape\n };\n}\n\nfunction computeOutputShape2D(\n inShape: [number, number], fieldSize: number, stride: number,\n zeroPad?: number, roundingMode?: 'floor'|'round'|'ceil'): [number, number] {\n if (zeroPad == null) {\n zeroPad = computeDefaultPad(inShape, fieldSize, stride);\n }\n const inputRows = inShape[0];\n const inputCols = inShape[1];\n\n const outputRows =\n round((inputRows - fieldSize + 2 * zeroPad) / stride + 1, roundingMode);\n const outputCols =\n round((inputCols - fieldSize + 2 * zeroPad) / stride + 1, roundingMode);\n\n return [outputRows, outputCols];\n}\n\nfunction computeOutputShape4D(\n inShape: [number, number, number, number], fieldSize: number,\n outChannels: number, stride: number, zeroPad?: number,\n roundingMode?: 'floor'|'round'|'ceil'): [number, number, number, number] {\n if (zeroPad == null) {\n zeroPad = computeDefaultPad(inShape, fieldSize, stride);\n }\n const inputDepth = inShape[0];\n const inputRows = inShape[1];\n const inputCols = inShape[2];\n\n const outputDepths =\n round((inputDepth - fieldSize + 2 * zeroPad) / stride + 1, roundingMode);\n const outputRows =\n round((inputRows - fieldSize + 2 * zeroPad) / stride + 1, roundingMode);\n const outputCols =\n round((inputCols - fieldSize + 2 * zeroPad) / stride + 1, roundingMode);\n\n return [outputDepths, outputRows, outputCols, outChannels];\n}\n\nexport function computeDefaultPad(\n inputShape: [number, number]|[number, number, number, number],\n fieldSize: number, stride: number, dilation = 1): number {\n const effectiveFieldSize = getEffectiveFilterSize(fieldSize, dilation);\n return Math.floor(\n (inputShape[0] * (stride - 1) - stride + effectiveFieldSize) / 2);\n}\n\nfunction parseTupleParam(param: number|number[]): [number, number, number] {\n if (typeof param === 'number') {\n return [param, param, param];\n }\n if (param.length === 2) {\n return [param[0], param[1], 1];\n }\n return param as [number, number, number];\n}\n\nfunction parse3TupleParam(param: number|[number, number, number]):\n [number, number, number] {\n return typeof param === 'number' ? [param, param, param] : param;\n}\n\n/* See https://www.tensorflow.org/api_docs/python/tf/nn/atrous_conv2d\n * Atrous convolution is equivalent to standard convolution with upsampled\n * filters with effective_filter_height =\n * filter_height + (filter_height - 1) * (dilation - 1)\n * and effective_filter_width =\n * filter_width + (filter_width - 1) * (dilation - 1),\n * produced by inserting dilation - 1 zeros along consecutive elements across\n * the filters' spatial dimensions.\n * When there is a dilation, this converts a filter dimension to the\n * effective filter dimension, so it can be used in a standard convolution.\n */\nfunction getEffectiveFilterSize(filterSize: number, dilation: number) {\n if (dilation <= 1) {\n return filterSize;\n }\n\n return filterSize + (filterSize - 1) * (dilation - 1);\n}\n\nfunction getPadAndOutInfo(\n pad: 'same'|'valid'|number|ExplicitPadding, inHeight: number,\n inWidth: number, strideHeight: number, strideWidth: number,\n filterHeight: number, filterWidth: number,\n roundingMode: 'floor'|'round'|'ceil',\n dataFormat: 'channelsFirst'|\n 'channelsLast'): {padInfo: PadInfo, outHeight: number, outWidth: number} {\n let padInfo: PadInfo;\n let outHeight: number;\n let outWidth: number;\n\n if (typeof pad === 'number') {\n const padType = (pad === 0) ? 'VALID' : 'NUMBER';\n padInfo = {top: pad, bottom: pad, left: pad, right: pad, type: padType};\n const outShape = computeOutputShape2D(\n [inHeight, inWidth], filterHeight, strideHeight, pad, roundingMode);\n outHeight = outShape[0];\n outWidth = outShape[1];\n } else if (pad === 'same') {\n outHeight = Math.ceil(inHeight / strideHeight);\n outWidth = Math.ceil(inWidth / strideWidth);\n const padAlongHeight =\n Math.max(0, (outHeight - 1) * strideHeight + filterHeight - inHeight);\n const padAlongWidth =\n Math.max(0, (outWidth - 1) * strideWidth + filterWidth - inWidth);\n const top = Math.floor(padAlongHeight / 2);\n const bottom = padAlongHeight - top;\n const left = Math.floor(padAlongWidth / 2);\n const right = padAlongWidth - left;\n padInfo = {top, bottom, left, right, type: 'SAME'};\n } else if (pad === 'valid') {\n padInfo = {top: 0, bottom: 0, left: 0, right: 0, type: 'VALID'};\n outHeight = Math.ceil((inHeight - filterHeight + 1) / strideHeight);\n outWidth = Math.ceil((inWidth - filterWidth + 1) / strideWidth);\n } else if (typeof pad === 'object') {\n const top = dataFormat === 'channelsLast' ? pad[1][0] : pad[2][0];\n const bottom = dataFormat === 'channelsLast' ? pad[1][1] : pad[2][1];\n const left = dataFormat === 'channelsLast' ? pad[2][0] : pad[3][0];\n const right = dataFormat === 'channelsLast' ? pad[2][1] : pad[3][1];\n const padType = (top === 0 && bottom === 0 && left === 0 && right === 0) ?\n 'VALID' :\n 'EXPLICIT';\n padInfo = {top, bottom, left, right, type: padType};\n outHeight = round(\n (inHeight - filterHeight + top + bottom) / strideHeight + 1,\n roundingMode);\n outWidth = round(\n (inWidth - filterWidth + left + right) / strideWidth + 1, roundingMode);\n } else {\n throw Error(`Unknown padding parameter: ${pad}`);\n }\n return {padInfo, outHeight, outWidth};\n}\n\nfunction get3DPadAndOutInfo(\n pad: 'same'|'valid'|number, inDepth: number, inHeight: number,\n inWidth: number, strideDepth: number, strideHeight: number,\n strideWidth: number, filterDepth: number, filterHeight: number,\n filterWidth: number, roundingMode?: 'floor'|'round'|'ceil'): {\n padInfo: PadInfo3D,\n outDepth: number,\n outHeight: number,\n outWidth: number\n} {\n let padInfo: PadInfo3D;\n let outDepth: number;\n let outHeight: number;\n let outWidth: number;\n\n if (typeof pad === 'number') {\n const padType = (pad === 0) ? 'VALID' : 'NUMBER';\n padInfo = {\n top: pad,\n bottom: pad,\n left: pad,\n right: pad,\n front: pad,\n back: pad,\n type: padType\n };\n const outShape = computeOutputShape4D(\n [inDepth, inHeight, inWidth, 1], filterDepth, 1, strideDepth, pad,\n roundingMode);\n outDepth = outShape[0];\n outHeight = outShape[1];\n outWidth = outShape[2];\n } else if (pad === 'same') {\n outDepth = Math.ceil(inDepth / strideDepth);\n outHeight = Math.ceil(inHeight / strideHeight);\n outWidth = Math.ceil(inWidth / strideWidth);\n const padAlongDepth = (outDepth - 1) * strideDepth + filterDepth - inDepth;\n const padAlongHeight =\n (outHeight - 1) * strideHeight + filterHeight - inHeight;\n const padAlongWidth = (outWidth - 1) * strideWidth + filterWidth - inWidth;\n const front = Math.floor(padAlongDepth / 2);\n const back = padAlongDepth - front;\n const top = Math.floor(padAlongHeight / 2);\n const bottom = padAlongHeight - top;\n const left = Math.floor(padAlongWidth / 2);\n const right = padAlongWidth - left;\n\n padInfo = {top, bottom, left, right, front, back, type: 'SAME'};\n } else if (pad === 'valid') {\n padInfo = {\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n front: 0,\n back: 0,\n type: 'VALID'\n };\n outDepth = Math.ceil((inDepth - filterDepth + 1) / strideDepth);\n outHeight = Math.ceil((inHeight - filterHeight + 1) / strideHeight);\n outWidth = Math.ceil((inWidth - filterWidth + 1) / strideWidth);\n } else {\n throw Error(`Unknown padding parameter: ${pad}`);\n }\n return {padInfo, outDepth, outHeight, outWidth};\n}\n\n/**\n * Rounds a value depending on the rounding mode\n * @param value\n * @param roundingMode A string from: 'ceil', 'round', 'floor'. If none is\n * provided, it will default to truncate.\n */\nfunction round(value: number, roundingMode?: 'floor'|'round'|'ceil') {\n if (!roundingMode) {\n return Math.trunc(value);\n }\n switch (roundingMode) {\n case 'round':\n // used for Caffe Conv\n return Math.round(value);\n case 'ceil':\n // used for Caffe Pool\n return Math.ceil(value);\n case 'floor':\n return Math.floor(value);\n default:\n throw new Error(`Unknown roundingMode ${roundingMode}`);\n }\n}\n\nexport function tupleValuesAreOne(param: number|number[]): boolean {\n const [dimA, dimB, dimC] = parseTupleParam(param);\n return dimA === 1 && dimB === 1 && dimC === 1;\n}\n\nexport function eitherStridesOrDilationsAreOne(\n strides: number|number[], dilations: number|number[]): boolean {\n return tupleValuesAreOne(strides) || tupleValuesAreOne(dilations);\n}\n\n/**\n * Convert Conv2D dataFormat from 'NHWC'|'NCHW' to\n * 'channelsLast'|'channelsFirst'\n * @param dataFormat in 'NHWC'|'NCHW' mode\n * @return dataFormat in 'channelsLast'|'channelsFirst' mode\n * @throws unknown dataFormat\n */\nexport function convertConv2DDataFormat(dataFormat: 'NHWC'|'NCHW'):\n 'channelsLast'|'channelsFirst' {\n if (dataFormat === 'NHWC') {\n return 'channelsLast';\n } else if (dataFormat === 'NCHW') {\n return 'channelsFirst';\n } else {\n throw new Error(`Unknown dataFormat ${dataFormat}`);\n }\n}\n\n/**\n * Check validity of pad when using dimRoundingMode.\n * @param opDesc A string of op description\n * @param pad The type of padding algorithm.\n * - `same` and stride 1: output will be of same size as input,\n * regardless of filter size.\n * - `valid` output will be smaller than input if filter is larger\n * than 1x1.\n * - For more info, see this guide:\n * [https://www.tensorflow.org/api_docs/python/tf/nn/convolution](\n * https://www.tensorflow.org/api_docs/python/tf/nn/convolution)\n * @param dimRoundingMode A string from: 'ceil', 'round', 'floor'. If none is\n * provided, it will default to truncate.\n * @throws unknown padding parameter\n */\nexport function checkPadOnDimRoundingMode(\n opDesc: string, pad: 'valid'|'same'|number|ExplicitPadding,\n dimRoundingMode?: 'floor'|'round'|'ceil') {\n if (dimRoundingMode != null) {\n if (typeof pad === 'string') {\n throw Error(\n `Error in ${opDesc}: pad must be an integer when using ` +\n `dimRoundingMode ${dimRoundingMode} but got pad ${pad}.`);\n } else if (typeof pad === 'number') {\n util.assert(\n util.isInt(pad),\n () => `Error in ${opDesc}: pad must be an integer when using ` +\n `dimRoundingMode ${dimRoundingMode} but got pad ${pad}.`);\n } else if (typeof pad === 'object') {\n (pad as ExplicitPadding).forEach(p => {p.forEach(v =>{\n util.assert(\n util.isInt(v),\n () => `Error in ${opDesc}: pad must be an integer when using ` +\n `dimRoundingMode ${dimRoundingMode} but got pad ${v}.`);\n });\n });\n } else {\n throw Error(`Error in ${opDesc}: Unknown padding parameter: ${pad}`);\n }\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Reshape, ReshapeAttrs, ReshapeInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {Rank, ShapeMap, TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Reshapes a `tf.Tensor` to a given shape.\n *\n * Given an input tensor, returns a new tensor with the same values as the\n * input tensor with shape `shape`.\n *\n * If one component of shape is the special value -1, the size of that\n * dimension is computed so that the total size remains constant. In\n * particular, a shape of [-1] flattens into 1-D. At most one component of\n * shape can be -1.\n *\n * If shape is 1-D or higher, then the operation returns a tensor with shape\n * shape filled with the values of tensor. In this case, the number of\n * elements implied by shape must be the same as the number of elements in\n * tensor.\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 3, 4]);\n * x.reshape([2, 2]).print();\n * ```\n *\n * @param x The input tensor to be reshaped.\n * @param shape An array of integers defining the output tensor shape.\n *\n * @doc {heading: 'Tensors', subheading: 'Transformations'}\n */\nfunction reshape_(\n x: Tensor|TensorLike, shape: ShapeMap[R]): Tensor {\n const $x = convertToTensor(x, 'x', 'reshape', 'string_or_numeric');\n\n const inputs: ReshapeInputs = {x: $x};\n const attrs: ReshapeAttrs = {shape};\n return ENGINE.runKernel(\n Reshape, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\nexport const reshape = op({reshape_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {AvgPool, AvgPoolAttrs, AvgPoolInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor3D, Tensor4D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {cast} from './cast';\nimport * as conv_util from './conv_util';\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * Computes the 2D average pooling of an image.\n *\n * @param x The input tensor, of rank 4 or rank 3 of shape\n * `[batch, height, width, inChannels]`. If rank 3, batch of 1 is assumed.\n * @param filterSize The filter size: `[filterHeight, filterWidth]`. If\n * `filterSize` is a single number, then `filterHeight == filterWidth`.\n * @param strides The strides of the pooling: `[strideHeight, strideWidth]`. If\n * `strides` is a single number, then `strideHeight == strideWidth`.\n * @param pad The type of padding algorithm:\n * - `same` and stride 1: output will be of same size as input,\n * regardless of filter size.\n * - `valid`: output will be smaller than input if filter is larger\n * than 1x1.\n * - For more info, see this guide:\n * [https://www.tensorflow.org/api_docs/python/tf/nn/convolution](\n * https://www.tensorflow.org/api_docs/python/tf/nn/convolution)\n * @param dimRoundingMode A string from: 'ceil', 'round', 'floor'. If none is\n * provided, it will default to truncate.\n */\nfunction avgPool_(\n x: T|TensorLike, filterSize: [number, number]|number,\n strides: [number, number]|number,\n pad: 'valid'|'same'|number|conv_util.ExplicitPadding,\n dimRoundingMode?: 'floor'|'round'|'ceil'): T {\n const $x = convertToTensor(x, 'x', 'avgPool', 'float32');\n const dilations = 1;\n\n util.assert(\n conv_util.eitherStridesOrDilationsAreOne(strides, dilations),\n () => 'Error in avgPool: Either strides or dilations must be 1. ' +\n `Got strides ${strides} and dilations '${dilations}'`);\n\n let x4D = $x as Tensor4D;\n let reshapedTo4D = false;\n if ($x.rank === 3) {\n reshapedTo4D = true;\n x4D = reshape($x, [1, $x.shape[0], $x.shape[1], $x.shape[2]]);\n }\n\n util.assert(\n x4D.rank === 4,\n () => `Error in avgPool: x must be rank 4 but got rank ${x4D.rank}.`);\n conv_util.checkPadOnDimRoundingMode('avgPool', pad, dimRoundingMode);\n const inputs: AvgPoolInputs = {x: x4D};\n const attrs: AvgPoolAttrs = {filterSize, strides, pad, dimRoundingMode};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n let res = ENGINE.runKernel(\n AvgPool, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as T;\n\n res = cast(res, $x.dtype);\n\n if (reshapedTo4D) {\n return reshape(res, [res.shape[1], res.shape[2], res.shape[3]]) as T;\n }\n\n return res;\n}\n\nexport const avgPool = op({avgPool_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {AvgPool3D, AvgPool3DAttrs, AvgPool3DInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor4D, Tensor5D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {checkPadOnDimRoundingMode} from './conv_util';\nimport {cast} from './cast';\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * Computes the 3D average pooling.\n *\n * ```js\n * const x = tf.tensor5d([1, 2, 3, 4, 5, 6, 7, 8], [1, 2, 2, 2, 1]);\n * const result = tf.avgPool3d(x, 2, 1, 'valid');\n * result.print();\n * ```\n *\n * @param x The input tensor, of rank 5 or rank 4 of shape\n * `[batch, depth, height, width, inChannels]`.\n * @param filterSize The filter size:\n * `[filterDepth, filterHeight, filterWidth]`.\n * If `filterSize` is a single number,\n * then `filterDepth == filterHeight == filterWidth`.\n * @param strides The strides of the pooling:\n * `[strideDepth, strideHeight, strideWidth]`.\n * If `strides` is a single number,\n * then `strideDepth == strideHeight == strideWidth`.\n * @param pad The type of padding algorithm.\n * - `same` and stride 1: output will be of same size as input,\n * regardless of filter size.\n * - `valid`: output will be smaller than input if filter is larger\n * than 1*1x1.\n * - For more info, see this guide:\n * [https://www.tensorflow.org/api_docs/python/tf/nn/convolution](\n * https://www.tensorflow.org/api_docs/python/tf/nn/convolution)\n * @param dimRoundingMode A string from: 'ceil', 'round', 'floor'. If none is\n * provided, it will default to truncate.\n * @param dataFormat An optional string from: \"NDHWC\", \"NCDHW\". Defaults to\n * \"NDHWC\". Specify the data format of the input and output data. With the\n * default format \"NDHWC\", the data is stored in the order of: [batch,\n * depth, height, width, channels]. Only \"NDHWC\" is currently supported.\n *\n * @doc {heading: 'Operations', subheading: 'Convolution'}\n */\nfunction avgPool3d_(\n x: T|TensorLike, filterSize: [number, number, number]|number,\n strides: [number, number, number]|number, pad: 'valid'|'same'|number,\n dimRoundingMode?: 'floor'|'round'|'ceil',\n dataFormat: 'NDHWC'|'NCDHW' = 'NDHWC'): T {\n const $x = convertToTensor(x, 'x', 'avgPool3d', 'float32');\n\n let x5D = $x as Tensor5D;\n let reshapedTo5D = false;\n if ($x.rank === 4) {\n reshapedTo5D = true;\n x5D = reshape($x, [1, $x.shape[0], $x.shape[1], $x.shape[2], $x.shape[3]]);\n }\n\n util.assert(\n x5D.rank === 5,\n () => `Error in avgPool3d: x must be rank 5 but got rank ${x5D.rank}.`);\n util.assert(\n dataFormat === 'NDHWC',\n () => `Error in avgPool3d: Only NDHWC is currently supported, ` +\n `but got dataFormat of ${dataFormat}`);\n checkPadOnDimRoundingMode('avgPool3d', pad, dimRoundingMode);\n const inputs: AvgPool3DInputs = {x: x5D};\n const attrs:\n AvgPool3DAttrs = {filterSize, strides, pad, dimRoundingMode, dataFormat};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n let res = ENGINE.runKernel(\n AvgPool3D, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as T;\n\n res = cast(res, x5D.dtype);\n\n if (reshapedTo5D) {\n return reshape(\n res, [res.shape[1], res.shape[2], res.shape[3], res.shape[4]]) as\n T;\n }\n\n return res;\n}\n\nexport const avgPool3d = op({avgPool3d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Concat, ConcatAttrs, ConcatInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensorArray} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {assert} from '../util';\n\nimport {clone} from './clone';\nimport {op} from './operation';\n\n/**\n * Concatenates a list of `tf.Tensor`s along a given axis.\n *\n * The tensors ranks and types must match, and their sizes must match in all\n * dimensions except `axis`.\n *\n * Also available are stricter rank-specific methods that assert that\n * `tensors` are of the given rank:\n * - `tf.concat1d`\n * - `tf.concat2d`\n * - `tf.concat3d`\n * - `tf.concat4d`\n *\n * Except `tf.concat1d` (which does not have axis param), all methods have\n * same signature as this method.\n *\n * ```js\n * const a = tf.tensor1d([1, 2]);\n * const b = tf.tensor1d([3, 4]);\n * a.concat(b).print(); // or a.concat(b)\n * ```\n *\n * ```js\n * const a = tf.tensor1d([1, 2]);\n * const b = tf.tensor1d([3, 4]);\n * const c = tf.tensor1d([5, 6]);\n * tf.concat([a, b, c]).print();\n * ```\n *\n * ```js\n * const a = tf.tensor2d([[1, 2], [10, 20]]);\n * const b = tf.tensor2d([[3, 4], [30, 40]]);\n * const axis = 1;\n * tf.concat([a, b], axis).print();\n * ```\n * @param tensors A list of tensors to concatenate.\n * @param axis The axis to concatenate along. Defaults to 0 (the first dim).\n *\n * @doc {heading: 'Tensors', subheading: 'Slicing and Joining'}\n */\nfunction concat_(tensors: Array, axis = 0): T {\n assert(tensors.length >= 1, () => 'Pass at least one tensor to concat');\n\n const $tensors =\n convertToTensorArray(tensors, 'tensors', 'concat', 'string_or_numeric');\n\n if ($tensors[0].dtype === 'complex64') {\n $tensors.forEach(tensor => {\n if (tensor.dtype !== 'complex64') {\n throw new Error(`Cannot concatenate complex64 tensors with a tensor\n with dtype ${tensor.dtype}. `);\n }\n });\n }\n\n if ($tensors.length === 1) {\n return clone($tensors[0]);\n }\n\n const inputs: ConcatInputs = $tensors;\n const attr: ConcatAttrs = {axis};\n\n return ENGINE.runKernel(\n Concat, inputs as {} as NamedTensorMap, attr as {} as NamedAttrMap);\n}\n\nexport const concat = op({concat_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Sigmoid, SigmoidInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes sigmoid element-wise, `1 / (1 + exp(-x))`\n *\n * ```js\n * const x = tf.tensor1d([0, -1, 2, -3]);\n *\n * x.sigmoid().print(); // or tf.sigmoid(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction sigmoid_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'sigmoid', 'float32');\n\n const inputs: SigmoidInputs = {x: $x};\n\n return ENGINE.runKernel(Sigmoid, inputs as {} as NamedTensorMap);\n}\nexport const sigmoid = op({sigmoid_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Slice, SliceAttrs, SliceInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {Rank, TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Extracts a slice from a `tf.Tensor` starting at coordinates `begin`\n * and is of size `size`.\n *\n * Also available are stricter rank-specific methods with the same signature\n * as this method that assert that `x` is of the given rank:\n * - `tf.slice1d`\n * - `tf.slice2d`\n * - `tf.slice3d`\n * - `tf.slice4d`\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 3, 4]);\n *\n * x.slice([1], [2]).print();\n * ```\n *\n * ```js\n * const x = tf.tensor2d([1, 2, 3, 4], [2, 2]);\n *\n * x.slice([1, 0], [1, 2]).print();\n * ```\n * @param x The input `tf.Tensor` to slice from.\n * @param begin The coordinates to start the slice from. The length can be\n * less than the rank of x - the rest of the axes will have implicit 0 as\n * start. Can also be a single number, in which case it specifies the\n * first axis.\n * @param size The size of the slice. The length can be less than the rank of\n * x - the rest of the axes will have implicit -1. A value of -1 requests\n * the rest of the dimensions in the axis. Can also be a single number,\n * in which case it specifies the size of the first axis.\n *\n * @doc {heading: 'Tensors', subheading: 'Slicing and Joining'}\n */\nfunction slice_>(\n x: T|TensorLike, begin: number|number[], size?: number|number[]): T {\n const $x = convertToTensor(x, 'x', 'slice', 'string_or_numeric');\n\n if ($x.rank === 0) {\n throw new Error('Slicing scalar is not possible');\n }\n\n const inputs: SliceInputs = {x: $x};\n const attrs: SliceAttrs = {begin, size};\n\n return ENGINE.runKernel(\n Slice, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const slice = op({slice_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Tanh, TanhInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes hyperbolic tangent of the input `tf.Tensor` element-wise: `tanh(x)`\n *\n * ```js\n * const x = tf.tensor1d([0, 1, -1, 70]);\n *\n * x.tanh().print(); // or tf.tanh(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction tanh_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'tanh', 'float32');\n\n const inputs: TanhInputs = {x: $x};\n\n return ENGINE.runKernel(Tanh, inputs as {} as NamedTensorMap);\n}\nexport const tanh = op({tanh_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Scalar, Tensor1D, Tensor2D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {add} from './add';\nimport {concat} from './concat';\nimport {matMul} from './mat_mul';\nimport {mul} from './mul';\nimport {op} from './operation';\nimport {sigmoid} from './sigmoid';\nimport {slice} from './slice';\nimport {tanh} from './tanh';\n\n/**\n * Computes the next state and output of a BasicLSTMCell.\n *\n * Returns `[newC, newH]`.\n *\n * Derived from tf.contrib.rnn.BasicLSTMCell.\n *\n * @param forgetBias Forget bias for the cell.\n * @param lstmKernel The weights for the cell.\n * @param lstmBias The bias for the cell.\n * @param data The input to the cell.\n * @param c Previous cell state.\n * @param h Previous cell output.\n *\n * @doc {heading: 'Operations', subheading: 'RNN'}\n */\nfunction basicLSTMCell_(\n forgetBias: Scalar|TensorLike, lstmKernel: Tensor2D|TensorLike,\n lstmBias: Tensor1D|TensorLike, data: Tensor2D|TensorLike,\n c: Tensor2D|TensorLike, h: Tensor2D|TensorLike): [Tensor2D, Tensor2D] {\n const $forgetBias =\n convertToTensor(forgetBias, 'forgetBias', 'basicLSTMCell');\n const $lstmKernel =\n convertToTensor(lstmKernel, 'lstmKernel', 'basicLSTMCell');\n const $lstmBias = convertToTensor(lstmBias, 'lstmBias', 'basicLSTMCell');\n const $data = convertToTensor(data, 'data', 'basicLSTMCell');\n const $c = convertToTensor(c, 'c', 'basicLSTMCell');\n const $h = convertToTensor(h, 'h', 'basicLSTMCell');\n\n const combined = concat([$data, $h], 1);\n const weighted = matMul(combined, $lstmKernel);\n const res: Tensor2D = add(weighted, $lstmBias);\n\n // i = input_gate, j = new_input, f = forget_gate, o = output_gate\n const batchSize = res.shape[0];\n const sliceCols = res.shape[1] / 4;\n const sliceSize: [number, number] = [batchSize, sliceCols];\n const i = slice(res, [0, 0], sliceSize);\n const j = slice(res, [0, sliceCols], sliceSize);\n const f = slice(res, [0, sliceCols * 2], sliceSize);\n const o = slice(res, [0, sliceCols * 3], sliceSize);\n\n const newC: Tensor2D =\n add(mul(sigmoid(i), tanh(j)),\n mul($c, sigmoid(add($forgetBias, f)) as Tensor2D));\n const newH: Tensor2D = mul(tanh(newC), sigmoid(o));\n return [newC, newH];\n}\n\nexport const basicLSTMCell = op({basicLSTMCell_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {BatchToSpaceND, BatchToSpaceNDAttrs, BatchToSpaceNDInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\n\n/**\n * This operation reshapes the \"batch\" dimension 0 into `M + 1` dimensions of\n * shape `blockShape + [batch]`, interleaves these blocks back into the grid\n * defined by the spatial dimensions `[1, ..., M]`, to obtain a result with\n * the same rank as the input. The spatial dimensions of this intermediate\n * result are then optionally cropped according to `crops` to produce the\n * output. This is the reverse of `tf.spaceToBatchND`. See below for a precise\n * description.\n *\n * ```js\n * const x = tf.tensor4d([1, 2, 3, 4], [4, 1, 1, 1]);\n * const blockShape = [2, 2];\n * const crops = [[0, 0], [0, 0]];\n *\n * x.batchToSpaceND(blockShape, crops).print();\n * ```\n *\n * @param x A `tf.Tensor`. N-D with `x.shape` = `[batch] + spatialShape +\n * remainingShape`, where spatialShape has `M` dimensions.\n * @param blockShape A 1-D array. Must have shape `[M]`, all values must\n * be >= 1.\n * @param crops A 2-D array. Must have shape `[M, 2]`, all values must be >= 0.\n * `crops[i] = [cropStart, cropEnd]` specifies the amount to crop from input\n * dimension `i + 1`, which corresponds to spatial dimension `i`. It is required\n * that `cropStart[i] + cropEnd[i] <= blockShape[i] * inputShape[i + 1]`\n *\n * This operation is equivalent to the following steps:\n *\n * 1. Reshape `x` to `reshaped` of shape: `[blockShape[0], ...,\n * blockShape[M-1], batch / prod(blockShape), x.shape[1], ...,\n * x.shape[N-1]]`\n *\n * 2. Permute dimensions of `reshaped` to produce `permuted` of shape `[batch /\n * prod(blockShape),x.shape[1], blockShape[0], ..., x.shape[M],\n * blockShape[M-1],x.shape[M+1], ..., x.shape[N-1]]`\n *\n * 3. Reshape `permuted` to produce `reshapedPermuted` of shape `[batch /\n * prod(blockShape),x.shape[1] * blockShape[0], ..., x.shape[M] *\n * blockShape[M-1],x.shape[M+1], ..., x.shape[N-1]]`\n *\n * 4. Crop the start and end of dimensions `[1, ..., M]` of `reshapedPermuted`\n * according to `crops` to produce the output of shape: `[batch /\n * prod(blockShape),x.shape[1] * blockShape[0] - crops[0,0] - crops[0,1],\n * ..., x.shape[M] * blockShape[M-1] - crops[M-1,0] -\n * crops[M-1,1],x.shape[M+1], ..., x.shape[N-1]]`\n *\n * @doc {heading: 'Tensors', subheading: 'Transformations'}\n */\nfunction batchToSpaceND_(\n x: T|TensorLike, blockShape: number[], crops: number[][]): T {\n const $x = convertToTensor(x, 'x', 'batchToSpaceND');\n const prod = blockShape.reduce((a, b) => a * b);\n\n util.assert(\n $x.rank >= 1 + blockShape.length,\n () => `input rank is ${$x.rank} but should be > than blockShape.length ${\n blockShape.length}`);\n\n util.assert(\n crops.length === blockShape.length,\n () => `crops.length is ${\n crops.length} but should be equal to blockShape.length ${\n blockShape.length}`);\n\n util.assert(\n $x.shape[0] % prod === 0,\n () => `input tensor batch is ${\n $x.shape[0]} but is not divisible by the product of ` +\n `the elements of blockShape ${blockShape.join(' * ')} === ${prod}`);\n\n const inputs: BatchToSpaceNDInputs = {x: $x};\n const attrs: BatchToSpaceNDAttrs = {blockShape, crops};\n\n return ENGINE.runKernel(\n BatchToSpaceND, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap);\n}\n\nexport const batchToSpaceND = op({batchToSpaceND_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor, Tensor4D} from '../tensor';\nimport {Rank} from '../types';\nimport {reshape} from './reshape';\n\nexport function xAs4D(x: Tensor) {\n let x4D: Tensor4D;\n if (x.rank === 0 || x.rank === 1) {\n x4D = reshape(x, [1, 1, 1, x.size]);\n } else if (x.rank === 2) {\n x4D = reshape(x, [1, 1, x.shape[0], x.shape[1]]);\n } else if (x.rank === 3) {\n x4D = reshape(x, [1, x.shape[0], x.shape[1], x.shape[2]]);\n } else {\n x4D = x as Tensor4D;\n }\n\n return x4D;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {FusedBatchNorm, FusedBatchNormAttrs, FusedBatchNormInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor, Tensor1D, Tensor4D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {Rank, TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {xAs4D} from './batchnorm_util';\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * Batch normalization.\n *\n * As described in\n * [http://arxiv.org/abs/1502.03167](http://arxiv.org/abs/1502.03167).\n *\n * Mean, variance, scale, and offset can be of two shapes:\n * - The same shape as the input.\n * - In the common case, the depth dimension is the last dimension of x, so\n * the values would be a `tf.Tensor1D` of shape [depth].\n *\n * Also available are stricter rank-specific methods with the same signature\n * as this method that assert that parameters passed are of given rank\n * - `tf.batchNorm2d`\n * - `tf.batchNorm3d`\n * - `tf.batchNorm4d`\n *\n * @param x The input Tensor.\n * @param mean A mean Tensor.\n * @param variance A variance Tensor.\n * @param offset An offset Tensor.\n * @param scale A scale Tensor.\n * @param varianceEpsilon A small float number to avoid dividing by 0.\n *\n * @doc {heading: 'Operations', subheading: 'Normalization'}\n */\nfunction batchNorm_(\n x: Tensor|TensorLike, mean: Tensor|Tensor1D|TensorLike,\n variance: Tensor|Tensor1D|TensorLike,\n offset?: Tensor|Tensor1D|TensorLike,\n scale?: Tensor|Tensor1D|TensorLike,\n varianceEpsilon?: number): Tensor {\n if (varianceEpsilon == null) {\n varianceEpsilon = 0.001;\n }\n const $x = convertToTensor(x, 'x', 'batchNorm');\n const $mean = convertToTensor(mean, 'mean', 'batchNorm');\n const $variance = convertToTensor(variance, 'variance', 'batchNorm');\n let $scale: Tensor|Tensor1D;\n if (scale != null) {\n $scale = convertToTensor(scale, 'scale', 'batchNorm');\n }\n let $offset: Tensor|Tensor1D;\n if (offset != null) {\n $offset = convertToTensor(offset, 'offset', 'batchNorm');\n }\n\n util.assert(\n $mean.rank === $variance.rank,\n () => 'Batch normalization gradient requires mean and variance to have ' +\n 'equal ranks.');\n util.assert(\n $offset == null || $mean.rank === $offset.rank,\n () => 'Batch normalization gradient requires mean and offset to have ' +\n 'equal ranks.');\n util.assert(\n $scale == null || $mean.rank === $scale.rank,\n () => 'Batch normalization gradient requires mean and scale to have ' +\n 'equal ranks.');\n\n const x4D: Tensor4D = xAs4D($x);\n\n const inputs: FusedBatchNormInputs = {\n x: x4D,\n scale: $scale,\n offset: $offset,\n mean: $mean,\n variance: $variance\n };\n\n const attrs: FusedBatchNormAttrs = {varianceEpsilon};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n const res = ENGINE.runKernel(\n FusedBatchNorm, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as Tensor;\n\n return reshape(res, $x.shape);\n}\n\nexport const batchNorm = op({batchNorm_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor1D, Tensor2D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {batchNorm} from './batchnorm';\nimport {op} from './operation';\n\n/**\n * Batch normalization, strictly for 2D. For the more relaxed version, see\n * `tf.batchNorm`.\n *\n * @param x The input Tensor.\n * @param mean A mean Tensor.\n * @param variance A variance Tensor.\n * @param offset An offset Tensor.\n * @param scale A scale Tensor.\n * @param varianceEpsilon A small float number to avoid dividing by 0.\n */\nfunction batchNorm2d_(\n x: Tensor2D|TensorLike, mean: Tensor2D|Tensor1D|TensorLike,\n variance: Tensor2D|Tensor1D|TensorLike,\n offset?: Tensor2D|Tensor1D|TensorLike, scale?: Tensor2D|Tensor1D|TensorLike,\n varianceEpsilon?: number): Tensor2D {\n const $x = convertToTensor(x, 'x', 'batchNorm');\n const $mean = convertToTensor(mean, 'mean', 'batchNorm');\n const $variance = convertToTensor(variance, 'variance', 'batchNorm');\n let $scale: Tensor2D|Tensor1D;\n if (scale != null) {\n $scale = convertToTensor(scale, 'scale', 'batchNorm');\n }\n let $offset: Tensor2D|Tensor1D;\n if (offset != null) {\n $offset = convertToTensor(offset, 'offset', 'batchNorm');\n }\n util.assert(\n $x.rank === 2,\n () => `Error in batchNorm2D: x must be rank 2 but got rank ` +\n `${$x.rank}.`);\n util.assert(\n $mean.rank === 2 || $mean.rank === 1,\n () => `Error in batchNorm2D: mean must be rank 2 or rank 1 but ` +\n `got rank ${$mean.rank}.`);\n util.assert(\n $variance.rank === 2 || $variance.rank === 1,\n () => `Error in batchNorm2D: variance must be rank 2 or rank 1 ` +\n `but got rank ${$variance.rank}.`);\n if ($scale != null) {\n util.assert(\n $scale.rank === 2 || $scale.rank === 1,\n () => `Error in batchNorm2D: scale must be rank 2 or rank 1 ` +\n `but got rank ${$scale.rank}.`);\n }\n if ($offset != null) {\n util.assert(\n $offset.rank === 2 || $offset.rank === 1,\n () => `Error in batchNorm2D: offset must be rank 2 or rank 1 ` +\n `but got rank ${$offset.rank}.`);\n }\n\n return batchNorm($x, $mean, $variance, $offset, $scale, varianceEpsilon);\n}\n\nexport const batchNorm2d = op({batchNorm2d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor1D, Tensor3D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {batchNorm} from './batchnorm';\nimport {op} from './operation';\n\n/**\n * Batch normalization, strictly for 3D. For the more relaxed version, see\n * `tf.batchNorm`.\n *\n * @param x The input Tensor.\n * @param mean A mean Tensor.\n * @param variance A variance Tensor.\n * @param offset An offset Tensor.\n * @param scale A scale Tensor.\n * @param varianceEpsilon A small float number to avoid dividing by 0.\n */\nfunction batchNorm3d_(\n x: Tensor3D|TensorLike, mean: Tensor3D|Tensor1D|TensorLike,\n variance: Tensor3D|Tensor1D|TensorLike,\n offset?: Tensor3D|Tensor1D|TensorLike, scale?: Tensor3D|Tensor1D|TensorLike,\n varianceEpsilon?: number): Tensor3D {\n const $x = convertToTensor(x, 'x', 'batchNorm');\n const $mean = convertToTensor(mean, 'mean', 'batchNorm');\n const $variance = convertToTensor(variance, 'variance', 'batchNorm');\n let $scale: Tensor3D|Tensor1D;\n if (scale != null) {\n $scale = convertToTensor(scale, 'scale', 'batchNorm');\n }\n let $offset: Tensor3D|Tensor1D;\n if (offset != null) {\n $offset = convertToTensor(offset, 'offset', 'batchNorm');\n }\n util.assert(\n $x.rank === 3,\n () => `Error in batchNorm3D: x must be rank 3 but got rank ` +\n `${$x.rank}.`);\n util.assert(\n $mean.rank === 3 || $mean.rank === 1,\n () => `Error in batchNorm3D: mean must be rank 3 or rank 1 but ` +\n `got rank ${$mean.rank}.`);\n util.assert(\n $variance.rank === 3 || $variance.rank === 1,\n () => `Error in batchNorm3D: variance must be rank 3 or rank 1 ` +\n `but got rank ${$variance.rank}.`);\n if ($scale != null) {\n util.assert(\n $scale.rank === 3 || $scale.rank === 1,\n () => `Error in batchNorm3D: scale must be rank 3 or rank 1 ` +\n `but got rank ${$scale.rank}.`);\n }\n if ($offset != null) {\n util.assert(\n $offset.rank === 3 || $offset.rank === 1,\n () => `Error in batchNorm3D: offset must be rank 3 or rank 1 ` +\n `but got rank ${$offset.rank}.`);\n }\n\n return batchNorm($x, $mean, $variance, $offset, $scale, varianceEpsilon);\n}\n\nexport const batchNorm3d = op({batchNorm3d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor1D, Tensor4D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {batchNorm} from './batchnorm';\nimport {op} from './operation';\n\n/**\n * Batch normalization, strictly for 4D. For the more relaxed version, see\n * `tf.batchNorm`.\n *\n * @param x The input Tensor.\n * @param mean A mean Tensor.\n * @param variance A variance Tensor.\n * @param offset An offset Tensor.\n * @param scale A scale Tensor.\n * @param varianceEpsilon A small float number to avoid dividing by 0.\n */\nfunction batchNorm4d_(\n x: Tensor4D|TensorLike, mean: Tensor4D|Tensor1D|TensorLike,\n variance: Tensor4D|Tensor1D|TensorLike,\n offset?: Tensor4D|Tensor1D|TensorLike, scale?: Tensor4D|Tensor1D|TensorLike,\n varianceEpsilon?: number): Tensor4D {\n const $x = convertToTensor(x, 'x', 'batchNorm');\n const $mean = convertToTensor(mean, 'mean', 'batchNorm');\n const $variance = convertToTensor(variance, 'variance', 'batchNorm');\n let $scale: Tensor4D|Tensor1D;\n if (scale != null) {\n $scale = convertToTensor(scale, 'scale', 'batchNorm');\n }\n let $offset: Tensor4D|Tensor1D;\n if (offset != null) {\n $offset = convertToTensor(offset, 'offset', 'batchNorm');\n }\n util.assert(\n $x.rank === 4,\n () => `Error in batchNorm4D: x must be rank 4 but got rank ` +\n `${$x.rank}.`);\n util.assert(\n $mean.rank === 4 || $mean.rank === 1,\n () => `Error in batchNorm4D: mean must be rank 4 or rank 1 but ` +\n `got rank ${$mean.rank}.`);\n util.assert(\n $variance.rank === 4 || $variance.rank === 1,\n () => `Error in batchNorm4D: variance must be rank 4 or rank 1 ` +\n `but got rank ${$variance.rank}.`);\n if ($scale != null) {\n util.assert(\n $scale.rank === 4 || $scale.rank === 1,\n () => `Error in batchNorm4D: scale must be rank 4 or rank 1 ` +\n `but got rank ${$scale.rank}.`);\n }\n if ($offset != null) {\n util.assert(\n $offset.rank === 4 || $offset.rank === 1,\n () => `Error in batchNorm4D: offset must be rank 4 or rank 1 ` +\n `but got rank ${$offset.rank}.`);\n }\n return batchNorm($x, $mean, $variance, $offset, $scale, varianceEpsilon);\n}\n\nexport const batchNorm4d = op({batchNorm4d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Bincount, BincountAttrs, BincountInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor1D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\n\n/**\n * Outputs a vector with length `size` and the same dtype as `weights`.\n *\n * If `weights` are empty, then index `i` stores the number of times the value\n * `i` is counted in `x`. If `weights` are non-empty, then index `i` stores the\n * sum of the value in `weights` at each index where the corresponding value in\n * `x` is `i`.\n *\n * Values in `x` outside of the range [0, size) are ignored.\n *\n * @param x The input int tensor, rank 1.\n * @param weights The weights tensor, must have the same shape as x, or a\n * length-0 Tensor, in which case it acts as all weights equal to 1.\n * @param size Non-negative integer.\n *\n * @doc {heading: 'Operations', subheading: 'Reduction'}\n */\nfunction bincount_(\n x: T|TensorLike, weights: T|TensorLike, size: number): T {\n const $x = convertToTensor(x, 'x', 'bincount');\n const $weights = convertToTensor(weights, 'weights', 'bincount');\n\n util.assert(\n $x.dtype === 'int32',\n () => `Error in bincount: input ` +\n `dtype must be int32, but got ${$x.dtype}`);\n util.assert(size >= 0, () => `size must be non-negative, but got ${size}.`);\n util.assert(\n $weights.size === $x.size || $weights.size === 0,\n () => `Error in bincount: weights must have the same size as input or` +\n `0-length, but got input shape: ${$x.shape}, weights shape: ` +\n `${$weights.shape}.`);\n\n const inputs: BincountInputs = {x: $x, weights: $weights};\n const attrs: BincountAttrs = {size};\n\n return ENGINE.runKernel(\n Bincount, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const bincount = op({bincount_});\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport { NamedTensorMap } from '../tensor_types';\nimport { ENGINE } from '../engine';\nimport { BroadcastArgs, BroadcastArgsInputs } from '../kernel_names';\nimport { Tensor } from '../tensor';\nimport { convertToTensor } from '../tensor_util_env';\nimport { Rank, TensorLike } from '../types';\n\nimport { op } from './operation';\n\n/**\n * Return the shape of s0 op s1 with broadcast.\n *\n * compute r0, the broadcasted shape as a tensor.\n * s0, s1 and r0 are all integer vectors.\n *\n * This function returns the shape of the result of an operation between\n * two tensors of size s0 and s1 performed with broadcast.\n *\n * @param s0 A tensor representing a shape\n * @param s1 A tensor representing a shape\n *\n * @doc {heading: 'Tensors', subheading: 'Transformations'}\n */\nfunction broadcastArgs_(\n s0: Tensor | TensorLike, s1: Tensor | TensorLike): Tensor {\n const shape1Input = convertToTensor(s0, 's0', 'broadcastArgs', 'int32');\n const shape2Input = convertToTensor(s1, 's1', 'broadcastArgs', 'int32');\n\n if (shape1Input.rank !== 1) {\n throw new Error(\n 'broadcastArgs(): first input must be a vector (rank=1). ' +\n `Has rank ${shape1Input.rank}`);\n }\n\n if (shape2Input.rank !== 1) {\n throw new Error(\n 'broadcastArgs(): second input must be a vector (rank=1). ' +\n `Has rank ${shape2Input.rank}`);\n }\n\n const inputs: BroadcastArgsInputs = { s0: shape1Input, s1: shape2Input };\n return ENGINE.runKernel(BroadcastArgs, inputs as {} as NamedTensorMap);\n}\n\nexport const broadcastArgs = op({ broadcastArgs_ });\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Tile, TileAttrs, TileInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {Rank, ShapeMap, TensorLike} from '../types';\n\nimport {clone} from './clone';\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * Broadcast an array to a compatible shape NumPy-style.\n *\n * The tensor's shape is compared to the broadcast shape from end to beginning.\n * Ones are prepended to the tensor's shape until it has the same length as\n * the broadcast shape. If input.shape[i]==shape[i], the (i+1)-th axis is\n * already broadcast-compatible. If input.shape[i]==1 and shape[i]==N, then\n * the input tensor is tiled N times along that axis (using tf.tile).\n *\n * @param input The tensor that is to be broadcasted.\n * @param shape The input is to be broadcast to this shape.\n *\n * @doc {heading: 'Tensors', subheading: 'Transformations'}\n */\nfunction broadcastTo_(\n x: Tensor|TensorLike, shape: ShapeMap[R]): Tensor {\n let input = convertToTensor(x, 'broadcastTo', 'x');\n const xShape = input.shape;\n\n if (shape.some(d => !(d > 0) || d % 1 !== 0)) {\n throw new Error(`broadcastTo(): Invalid broadcast shape [${shape}].`);\n }\n\n if (shape.length < input.rank) {\n throw new Error(`broadcastTo(): shape.length=${shape.length} < input.rank=${\n input.rank}.`);\n }\n\n if (shape.length > input.rank) {\n const newShape = input.shape.slice();\n while (newShape.length < shape.length) {\n newShape.unshift(1);\n }\n input = reshape(input, newShape);\n }\n\n const inputShape = input.shape;\n const reps: number[] = Array.from(shape);\n for (let i = shape.length - 1; i >= 0; i--) {\n if (inputShape[i] === shape[i]) {\n reps[i] = 1;\n } else if (input.shape[i] !== 1) {\n throw new Error(\n `broadcastTo(): [${xShape}] cannot be broadcast to [${shape}].`);\n }\n }\n const axes = reps.map((n, i) => n > 1 ? i : -1).filter(i => i >= 0);\n\n if (axes.length === 0) {\n return clone(input) as Tensor;\n }\n\n // TODO call broadcastTo kernel directly once backends implement broadcstTo\n const inputs: TileInputs = {x: input};\n const attrs: TileAttrs = {reps};\n return ENGINE.runKernel(\n Tile, inputs as {} as NamedTensorMap, attrs as unknown as NamedAttrMap);\n}\n\nexport const broadcastTo = op({broadcastTo_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Ceil, CeilInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes ceiling of input `tf.Tensor` element-wise: `ceil(x)`\n *\n * ```js\n * const x = tf.tensor1d([.6, 1.1, -3.3]);\n *\n * x.ceil().print(); // or tf.ceil(x)\n * ```\n * @param x The input Tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction ceil_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'ceil', 'float32');\n\n const inputs: CeilInputs = {x: $x};\n return ENGINE.runKernel(Ceil, inputs as {} as NamedTensorMap);\n}\nexport const ceil = op({ceil_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Fill, FillAttrs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {DataType, Rank, ShapeMap} from '../types';\n\n/**\n * Creates a `tf.Tensor` filled with a scalar value.\n *\n * ```js\n * tf.fill([2, 2], 4).print();\n * ```\n *\n * @param shape An array of integers defining the output tensor shape.\n * @param value The scalar value to fill the tensor with.\n * @param dtype The type of an element in the resulting tensor. Defaults to\n * 'float'.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nfunction fill(\n shape: ShapeMap[R], value: number|string, dtype?: DataType): Tensor {\n const attrs: FillAttrs = {shape, value, dtype};\n\n return ENGINE.runKernel(Fill, {}, attrs as {} as NamedAttrMap);\n}\n\nexport {fill};\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {ClipByValue, ClipByValueAttrs, ClipByValueInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\nimport {fill} from './fill';\n\nimport {op} from './operation';\n\n/**\n * Clips values element-wise. `max(min(x, clipValueMax), clipValueMin)`\n *\n * ```js\n * const x = tf.tensor1d([-1, 2, -3, 4]);\n *\n * x.clipByValue(-2, 3).print(); // or tf.clipByValue(x, -2, 3)\n * ```\n * @param x The input tensor.\n * @param clipValueMin Lower bound of range to be clipped to.\n * @param clipValueMax Upper bound of range to be clipped to.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction clipByValue_(\n x: T|TensorLike, clipValueMin: number, clipValueMax: number): T {\n const $x = convertToTensor(x, 'x', 'clipByValue');\n util.assert(\n (clipValueMin <= clipValueMax),\n () => `Error in clip: min (${clipValueMin}) must be ` +\n `less than or equal to max (${clipValueMax}).`);\n\n if (clipValueMin === clipValueMax) {\n return fill($x.shape, clipValueMin, $x.dtype) as T;\n }\n\n const inputs: ClipByValueInputs = {x: $x};\n const attrs: ClipByValueAttrs = {clipValueMin, clipValueMax};\n\n return ENGINE.runKernel(\n ClipByValue, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const clipByValue = op({clipByValue_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor1D} from '../tensor';\nimport {TensorLike} from '../types';\n\nimport {concat} from './concat';\nimport {op} from './operation';\n\n/**\n * Concatenates a list of`tf.Tensor1D`s along an axis. See `concat` for details.\n *\n * For example, if:\n * A: shape(3) = |r1, g1, b1|\n * B: shape(2) = |r2, g2|\n * C = tf.concat1d([A, B]) == |r1, g1, b1, r2, g2|\n *\n * @param tensors A list of`tf.Tensor`s to concatenate.\n * @return The concatenated array.\n */\nfunction concat1d_(tensors: Array): Tensor1D {\n return concat(tensors, 0 /* axis */);\n}\n\nexport const concat1d = op({concat1d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor2D} from '../tensor';\nimport {TensorLike} from '../types';\n\nimport {concat} from './concat';\nimport {op} from './operation';\n\n/**\n * Concatenates a list of`tf.Tensor2D`s along an axis. See `concat` for details.\n *\n * For example, if:\n * A: shape(2, 3) = | r1, g1, b1 |\n * | r2, g2, b2 |\n *\n * B: shape(2, 3) = | r3, g3, b3 |\n * | r4, g4, b4 |\n *\n * C = tf.concat2d([A, B], axis)\n *\n * if axis = 0:\n * C: shape(4, 3) = | r1, g1, b1 |\n * | r2, g2, b2 |\n * | r3, g3, b3 |\n * | r4, g4, b4 |\n *\n * if axis = 1:\n * C = shape(2, 6) = | r1, g1, b1, r3, g3, b3 |\n * | r2, g2, b2, r4, g4, b4 |\n *\n *\n * @param tensors A list of `tf.Tensor`s to concatenate.\n * @param axis The axis to concatenate along.\n * @return The concatenated array.\n */\nfunction concat2d_(\n tensors: Array, axis: number): Tensor2D {\n return concat(tensors, axis);\n}\n\nexport const concat2d = op({concat2d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor3D} from '../tensor';\nimport {TensorLike} from '../types';\n\nimport {concat} from './concat';\nimport {op} from './operation';\n\n/**\n * Concatenates a list of `tf.Tensor3D`s along an axis.\n * See `concat` for details.\n *\n * For example, if:\n * A: shape(2, 1, 3) = | r1, g1, b1 |\n * | r2, g2, b2 |\n *\n * B: shape(2, 1, 3) = | r3, g3, b3 |\n * | r4, g4, b4 |\n *\n * C = tf.concat3d([A, B], axis)\n *\n * if axis = 0:\n * C: shape(4, 1, 3) = | r1, g1, b1 |\n * | r2, g2, b2 |\n * | r3, g3, b3 |\n * | r4, g4, b4 |\n *\n * if axis = 1:\n * C: shape(2, 2, 3) = | r1, g1, b1, r3, g3, b3 |\n * | r2, g2, b2, r4, g4, b4 |\n *\n * if axis = 2:\n * C = shape(2, 1, 6) = | r1, g1, b1, r3, g3, b3 |\n * | r2, g2, b2, r4, g4, b4 |\n *\n * @param tensors A list of`tf.Tensor`s to concatenate.\n * @param axis The axis to concate along.\n * @return The concatenated array.\n */\nfunction concat3d_(\n tensors: Array, axis: number): Tensor3D {\n return concat(tensors, axis);\n}\n\nexport const concat3d = op({concat3d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor4D} from '../tensor';\nimport {TensorLike} from '../types';\n\nimport {concat} from './concat';\nimport {op} from './operation';\n\n/**\n * Concatenates a list of `tf.Tensor4D`s along an axis.\n * See `concat` for details.\n *\n * @param tensors A list of `tf.Tensor`s to concatenate.\n * @param axis The axis to concate along.\n * @return The concatenated array.\n */\nfunction concat4d_(\n tensors: Array, axis: number): Tensor4D {\n return concat(tensors, axis);\n}\n\nexport const concat4d = op({concat4d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Conv2D, Conv2DAttrs, Conv2DInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor3D, Tensor4D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport * as conv_util from './conv_util';\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * Computes a 2D convolution over the input x.\n *\n * @param x The input tensor, of rank 4 or rank 3, of shape\n * `[batch, height, width, inChannels]`. If rank 3, batch of 1 is\n * assumed.\n * @param filter The filter, rank 4, of shape\n * `[filterHeight, filterWidth, inDepth, outDepth]`.\n * @param strides The strides of the convolution: `[strideHeight,\n * strideWidth]`.\n * @param pad The type of padding algorithm.\n * - `same` and stride 1: output will be of same size as input,\n * regardless of filter size.\n * - `valid`: output will be smaller than input if filter is larger\n * than 1x1.\n * - For more info, see this guide:\n * [https://www.tensorflow.org/api_docs/python/tf/nn/convolution](\n * https://www.tensorflow.org/api_docs/python/tf/nn/convolution)\n * @param dataFormat: An optional string from: \"NHWC\", \"NCHW\". Defaults to\n * \"NHWC\". Specify the data format of the input and output data. With the\n * default format \"NHWC\", the data is stored in the order of: [batch,\n * height, width, channels].\n * @param dilations The dilation rates: `[dilationHeight, dilationWidth]`\n * in which we sample input values across the height and width dimensions\n * in atrous convolution. Defaults to `[1, 1]`. If `dilations` is a single\n * number, then `dilationHeight == dilationWidth`. If it is greater than\n * 1, then all values of `strides` must be 1.\n * @param dimRoundingMode A string from: 'ceil', 'round', 'floor'. If none is\n * provided, it will default to truncate.\n *\n * @doc {heading: 'Operations', subheading: 'Convolution'}\n */\nfunction conv2d_(\n x: T|TensorLike, filter: Tensor4D|TensorLike,\n strides: [number, number]|number,\n pad: 'valid'|'same'|number|conv_util.ExplicitPadding,\n dataFormat: 'NHWC'|'NCHW' = 'NHWC',\n dilations: [number, number]|number = [1, 1],\n dimRoundingMode?: 'floor'|'round'|'ceil'): T {\n const $x = convertToTensor(x, 'x', 'conv2d', 'float32');\n const $filter = convertToTensor(filter, 'filter', 'conv2d', 'float32');\n\n let x4D = $x as Tensor4D;\n let reshapedTo4D = false;\n\n if ($x.rank === 3) {\n reshapedTo4D = true;\n x4D = reshape($x, [1, $x.shape[0], $x.shape[1], $x.shape[2]]);\n }\n\n util.assert(\n x4D.rank === 4,\n () => `Error in conv2d: input must be rank 4, but got rank ${x4D.rank}.`);\n util.assert(\n $filter.rank === 4,\n () => `Error in conv2d: filter must be rank 4, but got rank ` +\n `${$filter.rank}.`);\n conv_util.checkPadOnDimRoundingMode('conv2d', pad, dimRoundingMode);\n const inDepth = dataFormat === 'NHWC' ? x4D.shape[3] : x4D.shape[1];\n util.assert(\n inDepth === $filter.shape[2],\n () => `Error in conv2d: depth of input (${inDepth}) must match ` +\n `input depth for filter ${$filter.shape[2]}.`);\n util.assert(\n conv_util.eitherStridesOrDilationsAreOne(strides, dilations),\n () => 'Error in conv2D: Either strides or dilations must be 1. ' +\n `Got strides ${strides} and dilations '${dilations}'`);\n\n const inputs: Conv2DInputs = {x: x4D, filter: $filter};\n const attrs:\n Conv2DAttrs = {strides, pad, dataFormat, dilations, dimRoundingMode};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n const res = ENGINE.runKernel(\n Conv2D, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as T;\n\n if (reshapedTo4D) {\n return reshape(res, [res.shape[1], res.shape[2], res.shape[3]]) as T;\n }\n return res;\n}\n\nexport const conv2d = op({conv2d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor2D, Tensor3D, Tensor4D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {conv2d} from './conv2d';\nimport * as conv_util from './conv_util';\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * Computes a 1D convolution over the input x.\n *\n * @param x The input tensor, of rank 3 or rank 2, of shape\n * `[batch, width, inChannels]`. If rank 2, batch of 1 is assumed.\n * @param filter The filter, rank 3, of shape\n * `[filterWidth, inDepth, outDepth]`.\n * @param stride The number of entries by which the filter is moved right at\n * each step.\n * @param pad The type of padding algorithm.\n * - `same` and stride 1: output will be of same size as input,\n * regardless of filter size.\n * - `valid`: output will be smaller than input if filter is larger\n * than 1x1.\n * - For more info, see this guide:\n * [https://www.tensorflow.org/api_docs/python/tf/nn/convolution](\n * https://www.tensorflow.org/api_docs/python/tf/nn/convolution)\n * @param dataFormat An optional string from \"NWC\", \"NCW\". Defaults to \"NWC\",\n * the data is stored in the order of [batch, in_width, in_channels]. Only\n * \"NWC\" is currently supported.\n * @param dilation The dilation rate in which we sample input values in\n * atrous convolution. Defaults to `1`. If it is greater than 1, then\n * stride must be `1`.\n * @param dimRoundingMode A string from: 'ceil', 'round', 'floor'. If none is\n * provided, it will default to truncate.\n *\n * @doc {heading: 'Operations', subheading: 'Convolution'}\n */\nfunction conv1d_(\n x: T|TensorLike, filter: Tensor3D|TensorLike, stride: number,\n pad: 'valid'|'same'|number|conv_util.ExplicitPadding,\n dataFormat: 'NWC'|'NCW' = 'NWC', dilation = 1,\n dimRoundingMode?: 'floor'|'round'|'ceil'): T {\n const $x = convertToTensor(x, 'x', 'conv1d');\n const $filter = convertToTensor(filter, 'filter', 'conv1d');\n\n let x3D = $x as Tensor3D;\n let reshapedTo3D = false;\n if ($x.rank === 2) {\n reshapedTo3D = true;\n x3D = reshape($x, [1, $x.shape[0], $x.shape[1]]);\n }\n\n util.assert(\n x3D.rank === 3,\n () => `Error in conv1d: input must be rank 3, but got rank ${x3D.rank}.`);\n util.assert(\n $filter.rank === 3,\n () => `Error in conv1d: filter must be rank 3, but got rank ` +\n `${$filter.rank}.`);\n conv_util.checkPadOnDimRoundingMode('conv1d', pad, dimRoundingMode);\n util.assert(\n x3D.shape[2] === $filter.shape[1],\n () => `Error in conv1d: depth of input (${x3D.shape[2]}) must match ` +\n `input depth for filter ${$filter.shape[1]}.`);\n util.assert(\n conv_util.eitherStridesOrDilationsAreOne(stride, dilation),\n () => 'Error in conv1D: Either stride or dilation must be 1. ' +\n `Got stride ${stride} and dilation '${dilation}'`);\n util.assert(\n dataFormat === 'NWC',\n () => `Error in conv1d: got dataFormat of ${\n dataFormat} but only NWC is currently supported.`);\n\n const filter4D = reshape(\n $filter, [1, $filter.shape[0], $filter.shape[1], $filter.shape[2]]);\n const input4D = reshape(x3D, [x3D.shape[0], 1, x3D.shape[1], x3D.shape[2]]);\n const strides: [number, number] = [1, stride];\n const dilations: [number, number] = [1, dilation];\n\n const conv2dDataFormat = 'NHWC';\n\n const res = conv2d(\n (input4D as Tensor4D), (filter4D as Tensor4D), strides, pad,\n conv2dDataFormat, dilations, dimRoundingMode);\n\n if (reshapedTo3D) {\n return reshape(res, [res.shape[2], res.shape[3]]) as T;\n }\n\n return reshape(res, [res.shape[0], res.shape[2], res.shape[3]]) as T;\n}\n\nexport const conv1d = op({conv1d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Conv2DBackpropInput, Conv2DBackpropInputAttrs, Conv2DBackpropInputInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor3D, Tensor4D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport * as util from '../util';\n\nimport * as conv_util from './conv_util';\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * Computes the derivative of the input of a 2D convolution.\n *\n * @param xShape The shape of the input: [batch, height, width, inDepth].\n * If length of 3, batch of 1 is assumed.\n * @param dy The derivative of the output, of rank 4 or rank 3 of shape\n * `[batch, outHeight, outWidth, outDepth]`. If rank 3, batch of 1 is\n * assumed.\n * @param filter The filter, rank 4, of shape\n * `[filterHeight, filterWidth, inDepth, outDepth]`.\n * @param strides The strides of the convolution: `[strideHeight,\n * strideWidth]`.\n * @param pad The type of padding algorithm used:\n * - `same` and stride 1: output will be of same size as input,\n * regardless of filter size.\n * - `valid`: output will be smaller than input if filter is larger\n * than 1x1.\n * @param dataFormat: An optional string from: \"NHWC\", \"NCHW\". Defaults to\n * \"NHWC\". Specify the data format of the input and output data. With the\n * default format \"NHWC\", the data is stored in the order of: [batch,\n * height, width, channels].\n * @param dimRoundingMode A string from: 'ceil', 'round', 'floor'. If none is\n * provided, it will default to truncate.\n */\nfunction conv2DBackpropInput_(\n xShape: [number, number, number, number]|[number, number, number], dy: T,\n filter: Tensor4D, strides: [number, number]|number,\n pad: 'valid'|'same'|number|conv_util.ExplicitPadding,\n dataFormat: 'NHWC'|'NCHW' = 'NHWC',\n dimRoundingMode?: 'floor'|'round'|'ceil'): T {\n util.assert(\n xShape.length === dy.rank,\n () => `Length of inShape ` +\n `(${xShape.length}) and rank of dy (${dy.rank}) must match`);\n\n let xShape4D = xShape as [number, number, number, number];\n let dy4D = dy as Tensor4D;\n let reshapedTo4D = false;\n if (dy.rank === 3) {\n reshapedTo4D = true;\n dy4D = reshape(dy, [1, dy.shape[0], dy.shape[1], dy.shape[2]]);\n xShape4D = [1, xShape[0], xShape[1], xShape[2]];\n }\n\n util.assert(\n xShape4D.length === 4,\n () =>\n `Error in conv2dDerInput: inShape must be length 4, but got length ` +\n `${xShape4D.length}.`);\n util.assert(\n dy4D.rank === 4,\n () => `Error in conv2dDerInput: dy must be rank 4, but got ` +\n `rank ${dy4D.rank}`);\n util.assert(\n filter.rank === 4,\n () => `Error in conv2dDerInput: filter must be rank 4, but got ` +\n `rank ${filter.rank}`);\n const inDepth = dataFormat === 'NHWC' ? xShape4D[3] : xShape4D[1];\n const outDepth = dataFormat === 'NHWC' ? dy4D.shape[3] : dy4D.shape[1];\n util.assert(\n inDepth === filter.shape[2],\n () => `Error in conv2dDerInput: depth of input (${inDepth}) must ` +\n `match input depth for filter ${filter.shape[2]}.`);\n util.assert(\n outDepth === filter.shape[3],\n () => `Error in conv2dDerInput: depth of output (${outDepth}) must ` +\n `match output depth for filter ${filter.shape[3]}.`);\n conv_util.checkPadOnDimRoundingMode('conv2dDerInput', pad, dimRoundingMode);\n const inputs: Conv2DBackpropInputInputs = {dy: dy4D, filter};\n const attrs: Conv2DBackpropInputAttrs =\n {strides, pad, dataFormat, dimRoundingMode, inputShape: xShape4D};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n const res = ENGINE.runKernel(\n Conv2DBackpropInput, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as T;\n\n if (reshapedTo4D) {\n return reshape(res, [res.shape[1], res.shape[2], res.shape[3]]) as T;\n }\n return res;\n}\n\nexport const conv2DBackpropInput = op({conv2DBackpropInput_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor3D, Tensor4D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {conv2DBackpropInput} from './conv2d_backprop_input';\nimport {ExplicitPadding} from './conv_util';\nimport {op} from './operation';\n\n/**\n * Computes the transposed 2D convolution of an image, also known as a\n * deconvolution.\n *\n * @param x The input image, of rank 4 or rank 3, of shape\n * `[batch, height, width, inDepth]`. If rank 3, batch of 1 is assumed.\n * @param filter The filter, rank 4, of shape\n * `[filterHeight, filterWidth, outDepth, inDepth]`.\n * `inDepth` must match `inDepth` in `x`.\n * @param outputShape Output shape, of rank 4 or rank 3:\n * `[batch, height, width, outDepth]`. If rank 3, batch of 1 is assumed.\n * @param strides The strides of the original convolution:\n * `[strideHeight, strideWidth]`.\n * @param pad The type of padding algorithm used in the non-transpose version\n * of the op.\n * @param dimRoundingMode A string from: 'ceil', 'round', 'floor'. If none is\n * provided, it will default to truncate.\n *\n * @doc {heading: 'Operations', subheading: 'Convolution'}\n */\nfunction conv2dTranspose_(\n x: T|TensorLike, filter: Tensor4D|TensorLike,\n outputShape: [number, number, number, number]|[number, number, number],\n strides: [number, number]|number,\n pad: 'valid'|'same'|number|ExplicitPadding,\n dimRoundingMode?: 'floor'|'round'|'ceil'): T {\n const $x = convertToTensor(x, 'x', 'conv2dTranspose');\n const $filter = convertToTensor(filter, 'filter', 'conv2dTranspose');\n\n return conv2DBackpropInput(\n outputShape, $x, $filter, strides, pad, 'NHWC', dimRoundingMode);\n}\n\nexport const conv2dTranspose = op({conv2dTranspose_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Conv3D, Conv3DAttrs, Conv3DInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor4D, Tensor5D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {eitherStridesOrDilationsAreOne} from './conv_util';\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * Computes a 3D convolution over the input x.\n *\n * @param x The input tensor, of rank 5 or rank 4, of shape\n * `[batch, depth, height, width, channels]`. If rank 4,\n * batch of 1 is assumed.\n * @param filter The filter, rank 5, of shape\n * `[filterDepth, filterHeight, filterWidth, inChannels, outChannels]`.\n * inChannels must match between input and filter.\n * @param strides The strides of the convolution: `[strideDepth, strideHeight,\n * strideWidth]`.\n * @param pad The type of padding algorithm.\n * - `same` and stride 1: output will be of same size as input,\n * regardless of filter size.\n * - `valid`: output will be smaller than input if filter is larger\n * than 1x1.\n * - For more info, see this guide:\n * [https://www.tensorflow.org/api_docs/python/tf/nn/convolution](\n * https://www.tensorflow.org/api_docs/python/tf/nn/convolution)\n * @param dataFormat: An optional string from: \"NDHWC\", \"NCDHW\". Defaults to\n * \"NDHWC\". Specify the data format of the input and output data. With the\n * default format \"NDHWC\", the data is stored in the order of: [batch,\n * depth, height, width, channels]. Only \"NDHWC\" is currently supported.\n * @param dilations The dilation rates: `[dilationDepth, dilationHeight,\n * dilationWidth]` in which we sample input values across the height\n * and width dimensions in atrous convolution. Defaults to `[1, 1, 1]`.\n * If `dilations` is a single number, then\n * `dilationDepth == dilationHeight == dilationWidth`. If it is greater\n * than 1, then all values of `strides` must be 1.\n *\n * @doc {heading: 'Operations', subheading: 'Convolution'}\n */\nfunction conv3d_(\n x: T|TensorLike, filter: Tensor5D|TensorLike,\n strides: [number, number, number]|number, pad: 'valid'|'same',\n dataFormat: 'NDHWC'|'NCDHW' = 'NDHWC',\n dilations: [number, number, number]|number = [1, 1, 1]): T {\n const $x = convertToTensor(x, 'x', 'conv3d');\n const $filter = convertToTensor(filter, 'filter', 'conv3d');\n\n let x5D = $x as Tensor5D;\n let reshapedTo5D = false;\n\n if ($x.rank === 4) {\n reshapedTo5D = true;\n x5D = reshape($x, [1, $x.shape[0], $x.shape[1], $x.shape[2], $x.shape[3]]);\n }\n util.assert(\n x5D.rank === 5,\n () => `Error in conv3d: input must be rank 5, but got rank ${x5D.rank}.`);\n util.assert(\n $filter.rank === 5,\n () => `Error in conv3d: filter must be rank 5, but got rank ` +\n `${$filter.rank}.`);\n util.assert(\n x5D.shape[4] === $filter.shape[3],\n () => `Error in conv3d: depth of input (${x5D.shape[4]}) must match ` +\n `input depth for filter ${$filter.shape[3]}.`);\n util.assert(\n eitherStridesOrDilationsAreOne(strides, dilations),\n () => 'Error in conv3D: Either strides or dilations must be 1. ' +\n `Got strides ${strides} and dilations '${dilations}'`);\n util.assert(\n dataFormat === 'NDHWC',\n () => `Error in conv3d: got dataFormat of ${\n dataFormat} but only NDHWC is currently supported.`);\n\n const inputs: Conv3DInputs = {x: x5D, filter: $filter};\n\n const attrs: Conv3DAttrs = {strides, pad, dataFormat, dilations};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n const res = ENGINE.runKernel(\n Conv3D, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as T;\n\n if (reshapedTo5D) {\n return reshape(\n res, [res.shape[1], res.shape[2], res.shape[3], res.shape[4]]) as\n T;\n }\n return res;\n}\n\nexport const conv3d = op({conv3d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Conv3DBackpropInputV2, Conv3DBackpropInputV2Attrs, Conv3DBackpropInputV2Inputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor4D, Tensor5D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport * as util from '../util';\n\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * Computes the derivative of the input of a 3D convolution.\n *\n * @param xShape The shape of the input: [batch, depth, height, width,\n * in_channels]. If length of 4, batch of 1 is assumed.\n * @param dy The derivative of the output, of rank 5 or rank 4 of shape\n * `[batch, outDepth, outHeight, outWidth, in_channels]`.\n * If rank 4, batch of 1 is assumed.\n * @param filter The filter, rank 5, of shape\n * `[filterDepth, filterHeight, filterWidth, inDepth, outDepth]`.\n * @param strides The strides of the convolution: `[strideDepth, strideHeight,\n * strideWidth]`.\n * @param pad The type of padding algorithm used:\n * - `same` and stride 1: output will be of same size as input,\n * regardless of filter size.\n * - `valid`: output will be smaller than input if filter is larger\n * than 1x1.\n */\nfunction conv3DBackpropInput_(\n xShape:\n [number, number, number, number,\n number]|[number, number, number, number],\n dy: T, filter: Tensor5D, strides: [number, number, number]|number,\n pad: 'valid'|'same'): T {\n util.assert(\n xShape.length === dy.rank,\n () => `Length of inShape ` +\n `(${xShape.length}) and rank of dy (${dy.rank}) must match`);\n\n let xShape5D = xShape as [number, number, number, number, number];\n let dy5D = dy as Tensor5D;\n let reshapedTo5D = false;\n if (dy.rank === 4) {\n reshapedTo5D = true;\n dy5D = reshape(dy, [1, dy.shape[0], dy.shape[1], dy.shape[2], dy.shape[3]]);\n xShape5D = [1, xShape[0], xShape[1], xShape[2], xShape[3]];\n }\n\n const inDepth = xShape5D[4];\n const outDepth = dy5D.shape[4];\n util.assert(\n xShape5D.length === 5,\n () =>\n `Error in conv3dDerInput: inShape must be length 5, but got length ` +\n `${xShape5D.length}.`);\n util.assert(\n dy5D.rank === 5,\n () => `Error in conv3dDerInput: dy must be rank 5, but got ` +\n `rank ${dy5D.rank}`);\n util.assert(\n filter.rank === 5,\n () => `Error in conv3dDerInput: filter must be rank 5, but got ` +\n `rank ${filter.rank}`);\n util.assert(\n inDepth === filter.shape[3],\n () => `Error in conv3dDerInput: depth of input (${inDepth}) must ` +\n `match input depth for filter ${filter.shape[3]}.`);\n util.assert(\n outDepth === filter.shape[4],\n () => `Error in conv3dDerInput: depth of output (${outDepth}) must ` +\n `match output depth for filter ${filter.shape[4]}.`);\n\n const inputs: Conv3DBackpropInputV2Inputs = {dy: dy5D, filter};\n\n const attrs:\n Conv3DBackpropInputV2Attrs = {pad, strides, inputShape: xShape5D};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n const res = ENGINE.runKernel(\n Conv3DBackpropInputV2, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as T;\n\n if (reshapedTo5D) {\n return reshape(\n res, [res.shape[1], res.shape[2], res.shape[3], res.shape[4]]) as\n T;\n }\n return res;\n}\n\nexport const conv3DBackpropInput = op({conv3DBackpropInput_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor4D, Tensor5D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {conv3DBackpropInput} from './conv3d_backprop_input';\nimport {op} from './operation';\n\n/**\n * Computes the transposed 3D convolution of a volume, also known as a\n * deconvolution.\n *\n * @param x The input image, of rank 5 or rank 4, of shape\n * `[batch, depth, height, width, inDepth]`. If rank 4, batch of 1 is assumed.\n * @param filter The filter, rank 4, of shape\n * `[depth, filterHeight, filterWidth, outDepth, inDepth]`.\n * `inDepth` must match `inDepth` in `x`.\n * @param outputShape Output shape, of rank 5 or rank 4:\n * `[batch, depth, height, width, outDepth]`. If rank 3, batch of 1 is\n * assumed.\n * @param strides The strides of the original convolution:\n * `[strideDepth, strideHeight, strideWidth]`.\n * @param pad The type of padding algorithm used in the non-transpose version\n * of the op.\n *\n * @doc {heading: 'Operations', subheading: 'Convolution'}\n */\nfunction conv3dTranspose_(\n x: T|TensorLike, filter: Tensor5D|TensorLike,\n outputShape:\n [number, number, number, number,\n number]|[number, number, number, number],\n strides: [number, number, number]|number, pad: 'valid'|'same'): T {\n const $x = convertToTensor(x, 'x', 'conv3dTranspose');\n const $filter = convertToTensor(filter, 'filter', 'conv3dTranspose');\n\n return conv3DBackpropInput(outputShape, $x, $filter, strides, pad);\n}\n\nexport const conv3dTranspose = op({conv3dTranspose_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Cos, CosInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes cos of the input `tf.Tensor` element-wise: `cos(x)`\n *\n * ```js\n * const x = tf.tensor1d([0, Math.PI / 2, Math.PI * 3 / 4]);\n *\n * x.cos().print(); // or tf.cos(x)\n * ```\n * @param x The input tensor. Must be float32 type.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction cos_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'cos', 'float32');\n\n const inputs: CosInputs = {x: $x};\n\n return ENGINE.runKernel(Cos, inputs as {} as NamedTensorMap);\n}\nexport const cos = op({cos_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Cosh, CoshInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes hyperbolic cos of the input `tf.Tensor` element-wise: `cosh(x)`\n *\n * ```js\n * const x = tf.tensor1d([0, 1, -1, .7]);\n *\n * x.cosh().print(); // or tf.cosh(x)\n * ```\n * @param x The input tensor. Must be float32 type.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction cosh_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'cosh', 'float32');\n const inputs: CoshInputs = {x: $x};\n\n return ENGINE.runKernel(Cosh, inputs as {} as NamedTensorMap);\n}\nexport const cosh = op({cosh_});\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the 'License');\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an 'AS IS' BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport { ENGINE } from '../engine';\nimport { Cumprod, CumprodAttrs, CumprodInputs } from '../kernel_names';\nimport { NamedAttrMap } from '../kernel_registry';\nimport { Tensor } from '../tensor';\nimport { NamedTensorMap } from '../tensor_types';\nimport { convertToTensor } from '../tensor_util_env';\nimport { TensorLike } from '../types';\n\nimport { op } from './operation';\n\n/**\n * Computes the cumulative product of a `tf.Tensor` along `axis`.\n *\n * ```js\n * const x = tf.tensor([1, 2, 3, 4]);\n * x.cumprod().print();\n * ```\n * ```js\n * const x = tf.tensor([[1, 2], [3, 4]]);\n * x.cumprod().print();\n * ```\n *\n * @param x The input tensor to cumulatively multiply.\n * @param axis The axis along which to multiply. Optional. Defaults to 0.\n * @param exclusive Whether to perform exclusive cumulative product. Optional.\n * Defaults to false. If set to true then the product of each tensor entry\n * does not include its own value, but only the values previous to it\n * along the specified axis.\n * @param reverse Whether to multiply in the opposite direction. Optional.\n * Defaults to false.\n *\n * @doc {heading: 'Operations', subheading: 'Scan'}\n */\nfunction cumprod_(\n x: Tensor | TensorLike,\n axis = 0,\n exclusive = false,\n reverse = false\n): T {\n const $x = convertToTensor(x, 'x', 'cumprod');\n\n const inputs: CumprodInputs = { x: $x };\n const attrs: CumprodAttrs = { axis, exclusive, reverse };\n\n return ENGINE.runKernel(\n Cumprod,\n inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap\n );\n}\n\nexport const cumprod = op({ cumprod_ });\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Cumsum, CumsumAttrs, CumsumInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes the cumulative sum of a `tf.Tensor` along `axis`.\n *\n * ```js\n * const x = tf.tensor([1, 2, 3, 4]);\n * x.cumsum().print();\n * ```\n * ```js\n * const x = tf.tensor([[1, 2], [3, 4]]);\n * x.cumsum().print();\n * ```\n *\n * @param x The input tensor to be summed.\n * @param axis The axis along which to sum. Optional. Defaults to 0.\n * @param exclusive Whether to perform exclusive cumulative sum. Optional.\n * Defaults to false. If set to true then the sum of each tensor entry\n * does not include its own value, but only the values previous to it\n * along the specified axis.\n * @param reverse Whether to sum in the opposite direction. Optional.\n * Defaults to false.\n *\n * @doc {heading: 'Operations', subheading: 'Scan'}\n */\nfunction cumsum_(\n x: Tensor|TensorLike, axis = 0, exclusive = false, reverse = false): T {\n const $x = convertToTensor(x, 'x', 'cumsum');\n\n const inputs: CumsumInputs = {x: $x};\n const attrs: CumsumAttrs = {axis, exclusive, reverse};\n\n return ENGINE.runKernel(\n Cumsum, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const cumsum = op({cumsum_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {DenseBincount, DenseBincountAttrs, DenseBincountInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor1D, Tensor2D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\n\n/**\n * Outputs a vector with length `size` and the same dtype as `weights`.\n *\n * If `weights` are empty, then index `i` stores the number of times the value\n * `i` is counted in `x`. If `weights` are non-empty, then index `i` stores the\n * sum of the value in `weights` at each index where the corresponding value in\n * `x` is `i`.\n *\n * Values in `x` outside of the range [0, size) are ignored.\n *\n * @param x The input int tensor, rank 1 or rank 2.\n * @param weights The weights tensor, must have the same shape as x, or a\n * length-0 Tensor, in which case it acts as all weights equal to 1.\n * @param size Non-negative integer.\n * @param binaryOutput Optional. Whether the kernel should count the appearance\n * or number of occurrences. Defaults to False.\n *\n * @doc {heading: 'Operations', subheading: 'Reduction'}\n */\nfunction denseBincount_(\n x: T|TensorLike, weights: T|TensorLike, size: number,\n binaryOutput = false): T {\n const $x = convertToTensor(x, 'x', 'denseBincount');\n const $weights = convertToTensor(weights, 'weights', 'denseBincount');\n\n util.assert(\n $x.dtype === 'int32',\n () => `Error in denseBincount: input ` +\n `dtype must be int32, but got ${$x.dtype}`);\n util.assert(\n $x.rank <= 2,\n () => `Error in denseBincount: input must be at most rank 2, but got ` +\n `rank ${$x.rank}.`);\n util.assert(size >= 0, () => `size must be non-negative, but got ${size}.`);\n util.assert(\n $weights.size === $x.size || $weights.size === 0,\n () =>\n `Error in denseBincount: weights must have the same shape as x or ` +\n `0-length, but got x shape: ${$x.shape}, weights shape: ` +\n `${$weights.shape}.`);\n\n const inputs: DenseBincountInputs = {x: $x, weights: $weights};\n const attrs: DenseBincountAttrs = {size, binaryOutput};\n\n return ENGINE.runKernel(\n DenseBincount, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap);\n}\n\nexport const denseBincount = op({denseBincount_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {DepthToSpace, DepthToSpaceAttrs, DepthToSpaceInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor4D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike4D} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\n\n/**\n * Rearranges data from depth into blocks of spatial data. More specifically,\n * this op outputs a copy of the input tensor where values from the `depth`\n * dimension are moved in spatial blocks to the `height` and `width` dimensions.\n * The attr `blockSize` indicates the input block size and how the data is\n * moved.\n *\n * - Chunks of data of size `blockSize * blockSize` from depth are rearranged\n * into non-overlapping blocks of size `blockSize x blockSize`\n *\n * - The width the output tensor is `inputWidth * blockSize`, whereas the\n * height is `inputHeight * blockSize`\n *\n * - The Y, X coordinates within each block of the output image are determined\n * by the high order component of the input channel index\n *\n * - The depth of the input tensor must be divisible by `blockSize *\n * blockSize`\n *\n * The `dataFormat` attr specifies the layout of the input and output tensors\n * with the following options: \"NHWC\": [ `batch, height, width, channels` ]\n * \"NCHW\": [ `batch, channels, height, width` ]\n *\n * ```js\n * const x = tf.tensor4d([1, 2, 3, 4], [1, 1, 1, 4]);\n * const blockSize = 2;\n * const dataFormat = \"NHWC\";\n *\n * tf.depthToSpace(x, blockSize, dataFormat).print();\n * ```\n *\n * @param x The input tensor of rank 4\n * @param blockSIze An `int` that is `>= 2`. The size of the spatial block\n * @param dataFormat An optional string from: \"NHWC\", \"NCHW\". Defaults to \"NHWC\"\n *\n * @doc {heading: 'Tensors', subheading: 'Transformations'}\n */\nfunction depthToSpace_(\n x: Tensor4D|TensorLike4D, blockSize: number,\n dataFormat: 'NHWC'|'NCHW' = 'NHWC'): Tensor4D {\n const $x = convertToTensor(x, 'x', 'depthToSpace', 'float32') as Tensor4D;\n\n const inputHeight = (dataFormat === 'NHWC') ? $x.shape[1] : $x.shape[2];\n const inputWidth = (dataFormat === 'NHWC') ? $x.shape[2] : $x.shape[3];\n const inputDepth = (dataFormat === 'NHWC') ? $x.shape[3] : $x.shape[1];\n\n util.assert(\n blockSize > 1,\n () => `blockSize should be > 1 for depthToSpace, but was: ${blockSize}`);\n\n util.assert(\n inputHeight * blockSize >= 0,\n () => `Negative dimension size caused by overflow when multiplying\n ${inputHeight} and ${blockSize} for depthToSpace with input shape\n ${$x.shape}`);\n\n util.assert(\n inputWidth * blockSize >= 0,\n () => `Negative dimension size caused by overflow when multiplying\n ${inputWidth} and ${blockSize} for depthToSpace with input shape\n ${$x.shape}`);\n\n util.assert(\n (inputDepth % (blockSize * blockSize) === 0),\n () => `Dimension size must be evenly divisible by ${\n blockSize * blockSize} but is ${\n inputDepth} for depthToSpace with input shape ${$x.shape}`);\n\n const inputs: DepthToSpaceInputs = {x: $x};\n const attrs: DepthToSpaceAttrs = {blockSize, dataFormat};\n\n return ENGINE.runKernel(\n DepthToSpace, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap);\n}\n\nexport const depthToSpace = op({depthToSpace_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {DepthwiseConv2dNative, DepthwiseConv2dNativeAttrs, DepthwiseConv2dNativeInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor3D, Tensor4D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport * as conv_util from './conv_util';\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * Depthwise 2D convolution.\n *\n * Given a 4D `input` array and a `filter` array of shape\n * `[filterHeight, filterWidth, inChannels, channelMultiplier]` containing\n * `inChannels` convolutional filters of depth 1, this op applies a\n * different filter to each input channel (expanding from 1 channel to\n * `channelMultiplier` channels for each), then concatenates the results\n * together. The output has `inChannels * channelMultiplier` channels.\n *\n * See\n * [https://www.tensorflow.org/api_docs/python/tf/nn/depthwise_conv2d](\n * https://www.tensorflow.org/api_docs/python/tf/nn/depthwise_conv2d)\n * for more details.\n *\n * @param x The input tensor, of rank 4 or rank 3, of shape\n * `[batch, height, width, inChannels]`. If rank 3, batch of 1 is\n * assumed.\n * @param filter The filter tensor, rank 4, of shape\n * `[filterHeight, filterWidth, inChannels, channelMultiplier]`.\n * @param strides The strides of the convolution: `[strideHeight,\n * strideWidth]`. If strides is a single number, then `strideHeight ==\n * strideWidth`.\n * @param pad The type of padding algorithm.\n * - `same` and stride 1: output will be of same size as input,\n * regardless of filter size.\n * - `valid`: output will be smaller than input if filter is larger\n * than 1x1.\n * - For more info, see this guide:\n * [https://www.tensorflow.org/api_docs/python/tf/nn/convolution](\n * https://www.tensorflow.org/api_docs/python/tf/nn/convolution)\n * @param dilations The dilation rates: `[dilationHeight, dilationWidth]`\n * in which we sample input values across the height and width dimensions\n * in atrous convolution. Defaults to `[1, 1]`. If `rate` is a single\n * number, then `dilationHeight == dilationWidth`. If it is greater than\n * 1, then all values of `strides` must be 1.\n * @param dataFormat: An optional string from: \"NHWC\", \"NCHW\". Defaults to\n * \"NHWC\". Specify the data format of the input and output data. With the\n * default format \"NHWC\", the data is stored in the order of: [batch,\n * height, width, channels]. Only \"NHWC\" is currently supported.\n * @param dimRoundingMode A string from: 'ceil', 'round', 'floor'. If none is\n * provided, it will default to truncate.\n *\n * @doc {heading: 'Operations', subheading: 'Convolution'}\n */\nfunction depthwiseConv2d_(\n x: T|TensorLike, filter: Tensor4D|TensorLike,\n strides: [number, number]|number,\n pad: 'valid'|'same'|number|conv_util.ExplicitPadding,\n dataFormat: 'NHWC'|'NCHW' = 'NHWC',\n dilations: [number, number]|number = [1, 1],\n dimRoundingMode?: 'floor'|'round'|'ceil'): T {\n const $x = convertToTensor(x, 'x', 'depthwiseConv2d', 'float32');\n const $filter =\n convertToTensor(filter, 'filter', 'depthwiseConv2d', 'float32');\n\n let x4D = $x as Tensor4D;\n let reshapedTo4D = false;\n if ($x.rank === 3) {\n reshapedTo4D = true;\n x4D = reshape($x, [1, $x.shape[0], $x.shape[1], $x.shape[2]]);\n }\n util.assert(\n x4D.rank === 4,\n () => `Error in depthwiseConv2d: input must be rank 4, but got ` +\n `rank ${x4D.rank}.`);\n util.assert(\n $filter.rank === 4,\n () => `Error in depthwiseConv2d: filter must be rank 4, but got rank ` +\n `${$filter.rank}.`);\n const inChannels = dataFormat === 'NHWC' ? x4D.shape[3] : x4D.shape[1];\n util.assert(\n inChannels === $filter.shape[2],\n () => `Error in depthwiseConv2d: number of input channels ` +\n `(${inChannels}) must match the inChannels dimension in ` +\n `filter ${$filter.shape[2]}.`);\n conv_util.checkPadOnDimRoundingMode('depthwiseConv2d', pad, dimRoundingMode);\n const inputs: DepthwiseConv2dNativeInputs = {x: x4D, filter: $filter};\n const attrs: DepthwiseConv2dNativeAttrs =\n {strides, pad, dataFormat, dilations, dimRoundingMode};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n const res = ENGINE.runKernel(\n DepthwiseConv2dNative, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as T;\n\n if (reshapedTo4D) {\n return reshape(res, [res.shape[1], res.shape[2], res.shape[3]]) as T;\n }\n return res;\n}\n\nexport const depthwiseConv2d = op({depthwiseConv2d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Diag, DiagInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\n\nimport {op} from './operation';\n\n/**\n * Returns a diagonal tensor with given diagonal values.\n *\n * Given a diagonal, this operation returns a tensor with the diagonal and\n * everything else padded with zeros.\n *\n * Assume the input has dimensions `[D1,..., Dk]`, then the output is a tensor\n * of rank 2k with dimensions `[D1,..., Dk, D1,..., Dk]`\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 3, 4]);\n *\n * tf.diag(x).print()\n * ```\n * ```js\n * const x = tf.tensor2d([1, 2, 3, 4, 5, 6, 6, 8], [4, 2])\n *\n * tf.diag(x).print()\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nfunction diag_(x: Tensor): Tensor {\n const $x = convertToTensor(x, 'x', 'diag');\n\n const inputs: DiagInputs = {x: $x};\n\n return ENGINE.runKernel(Diag, inputs as {} as NamedTensorMap);\n}\n\nexport const diag = op({diag_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Dilation2D, Dilation2DAttrs, Dilation2DInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor3D, Tensor4D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * Computes the grayscale dilation over the input `x`.\n *\n * @param x The input tensor, rank 3 or rank 4 of shape\n * `[batch, height, width, inChannels]`. If rank 3, batch of 1 is assumed.\n * @param filter The filter tensor, rank 3, of shape\n * `[filterHeight, filterWidth, depth]`.\n * @param strides The strides of the sliding window for each dimension of the\n * input tensor: `[strideHeight, strideWidth]`.\n * If `strides` is a single number,\n * then `strideHeight == strideWidth`.\n * @param pad The type of padding algorithm.\n * - `same` and stride 1: output will be of same size as input,\n * regardless of filter size.\n * - `valid`: output will be smaller than input if filter is larger\n * than 1*1x1.\n * - For more info, see this guide:\n * [https://www.tensorflow.org/api_docs/python/tf/nn/convolution](\n * https://www.tensorflow.org/api_docs/python/tf/nn/convolution)\n * @param dataFormat Specify the data format of the input and output data.\n * Defaults to 'NHWC'. Only 'NHWC' is currently supported. With the\n * default format \"NHWC\", the data is stored in the order of: [batch,\n * height, width, channels].\n * @param dilations The dilation rates: `[dilationHeight, dilationWidth]`\n * in which we sample input values across the height and width dimensions\n * for atrous morphological dilation. Defaults to `[1, 1]`. If `dilations`\n * is a single number, then `dilationHeight == dilationWidth`. If it is\n * greater than 1, then all values of `strides` must be 1.\n *\n * @doc {heading: 'Operations', subheading: 'Convolution'}\n */\nfunction dilation2d_(\n x: T|TensorLike, filter: Tensor3D|TensorLike,\n strides: [number, number]|number, pad: 'valid'|'same',\n dilations: [number, number]|number = [1, 1],\n dataFormat: 'NHWC' = 'NHWC'): T {\n const $x = convertToTensor(x, 'x', 'dilation2d');\n const $filter = convertToTensor(filter, 'filter', 'dilation2d');\n\n util.assert(\n $x.rank === 3 || $x.rank === 4,\n () => `Error in dilation2d: input must be rank 3 or 4, but got rank ` +\n `${$x.rank}.`);\n util.assert(\n $filter.rank === 3,\n () => `Error in dilation2d: filter must be rank 3, but got rank ` +\n `${$filter.rank}.`);\n util.assert(\n dataFormat === 'NHWC',\n () => `Error in dilation2d: Only NHWC is currently supported, ` +\n `but got dataFormat of ${dataFormat}`);\n\n let x4D = $x as Tensor4D;\n let reshapedTo4D = false;\n\n if ($x.rank === 3) {\n x4D = reshape($x, [1, $x.shape[0], $x.shape[1], $x.shape[2]]);\n reshapedTo4D = true;\n }\n\n const inputs: Dilation2DInputs = {x: x4D, filter: $filter};\n const attrs: Dilation2DAttrs = {strides, pad, dilations};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n const res = ENGINE.runKernel(\n Dilation2D, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as T;\n\n if (reshapedTo4D) {\n return reshape(res, [res.shape[1], res.shape[2], res.shape[3]]) as T;\n }\n\n return res;\n}\n\nexport const dilation2d = op({dilation2d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Equal, EqualInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {assertAndGetBroadcastShape} from './broadcast_util';\nimport {op} from './operation';\n\n/**\n * Returns the truth value of (a == b) element-wise. Supports broadcasting.\n *\n * ```js\n * const a = tf.tensor1d([1, 2, 3]);\n * const b = tf.tensor1d([2, 2, 2]);\n *\n * a.equal(b).print();\n * ```\n *\n * @param a The first input tensor.\n * @param b The second input tensor. Must have the same dtype as `a`.\n *\n * @doc {heading: 'Operations', subheading: 'Logical'}\n */\nfunction equal_(\n a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n let $a = convertToTensor(a, 'a', 'equal', 'string_or_numeric');\n let $b = convertToTensor(b, 'b', 'equal', 'string_or_numeric');\n [$a, $b] = makeTypesMatch($a, $b);\n\n assertAndGetBroadcastShape($a.shape, $b.shape);\n\n const inputs: EqualInputs = {a: $a, b: $b};\n\n return ENGINE.runKernel(Equal, inputs as {} as NamedTensorMap);\n}\n\nexport const equal = op({equal_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Select, SelectInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {broadcastTo} from './broadcast_to';\nimport {assertAndGetBroadcastShape} from './broadcast_util';\nimport {op} from './operation';\n\n/**\n * Returns the elements, either `a` or `b` depending on the `condition`.\n *\n * If the condition is true, select from `a`, otherwise select from `b`.\n *\n * ```js\n * const cond = tf.tensor1d([false, false, true], 'bool');\n * const a = tf.tensor1d([1 , 2, 3]);\n * const b = tf.tensor1d([-1, -2, -3]);\n *\n * a.where(cond, b).print();\n * ```\n *\n * @param condition The input condition. Must be of dtype bool.\n * @param a If `condition` is rank 1, `a` may have a higher rank but\n * its first dimension must match the size of `condition`.\n * @param b A tensor with the same dtype as `a` and with shape that is\n * compatible with `a`.\n * @return A tensor with same dtype as `a` and `b`, and shape that is\n * broadcastable from `a` and `b`.\n *\n * @doc {heading: 'Operations', subheading: 'Logical'}\n */\nfunction where_(\n condition: Tensor|TensorLike, a: T|TensorLike, b: T|TensorLike): T {\n const $a = convertToTensor(a, 'a', 'where');\n const $b = convertToTensor(b, 'b', 'where');\n const $condition = convertToTensor(condition, 'condition', 'where', 'bool');\n // TODO: move this logic to forward function when the broadcastTo op is\n // implemented in WASM.\n // Find the broadcastable shape for $condition, $a, and $b.\n const broadcastShape = assertAndGetBroadcastShape(\n assertAndGetBroadcastShape($condition.shape, $a.shape), $b.shape);\n const $broadcastedCondition = broadcastTo($condition, broadcastShape);\n const $broadcastedA = broadcastTo($a, broadcastShape);\n const $broadcastedB = broadcastTo($b, broadcastShape);\n\n const inputs: SelectInputs = {\n condition: $broadcastedCondition,\n t: $broadcastedA,\n e: $broadcastedB\n };\n return ENGINE.runKernel(Select, inputs as {} as NamedTensorMap);\n}\n\nexport const where = op({where_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {ZerosLike, ZerosLikeInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Creates a `tf.Tensor` with all elements set to 0 with the same shape as the\n * given tensor.\n *\n * ```js\n * const x = tf.tensor([1, 2]);\n * tf.zerosLike(x).print();\n * ```\n *\n * @param x The tensor of required shape.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nfunction zerosLike_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'zerosLike');\n const inputs: ZerosLikeInputs = {x: $x};\n return ENGINE.runKernel(ZerosLike, inputs as {} as NamedTensorMap);\n}\nexport const zerosLike = op({zerosLike_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {div} from './div';\nimport {equal} from './equal';\nimport {op} from './operation';\nimport {where} from './where';\nimport {zerosLike} from './zeros_like';\n\n/**\n * Divides two `tf.Tensor`s element-wise, A / B. Supports broadcasting. Return 0\n * if denominator is 0.\n *\n *\n * ```js\n * const a = tf.tensor1d([1, 4, 9, 16]);\n * const b = tf.tensor1d([1, 2, 3, 4]);\n * const c = tf.tensor1d([0, 0, 0, 0]);\n *\n * a.divNoNan(b).print(); // or tf.divNoNan(a, b)\n * a.divNoNan(c).print(); // or tf.divNoNan(a, c)\n * ```\n *\n * ```js\n * // Broadcast div a with b.\n * const a = tf.tensor1d([2, 4, 6, 8]);\n * const b = tf.scalar(2);\n * const c = tf.scalar(0);\n *\n * a.divNoNan(b).print(); // or tf.divNoNan(a, b)\n * a.divNoNan(c).print(); // or tf.divNoNan(a, c)\n * ```\n *\n * @param a The first tensor as the numerator.\n * @param b The second tensor as the denominator. Must have the same dtype as\n * `a`.\n *\n * @doc {heading: 'Operations', subheading: 'Arithmetic'}\n */\nfunction divNoNan_(\n a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n // TODO: Make this into its own kernel.\n let $a = convertToTensor(a, 'a', 'div');\n let $b = convertToTensor(b, 'b', 'div');\n [$a, $b] = makeTypesMatch($a, $b);\n\n const divResult = div($a, $b);\n const zeros = zerosLike(divResult);\n const bEqualsZero = equal($b, zeros);\n return where(bEqualsZero, zeros, divResult) as T;\n}\n\nexport const divNoNan = op({divNoNan_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor,} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {matMul} from './mat_mul';\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * Computes the dot product of two matrices and/or vectors, `t1` and `t2`.\n *\n * ```js\n * const a = tf.tensor1d([1, 2]);\n * const b = tf.tensor2d([[1, 2], [3, 4]]);\n * const c = tf.tensor2d([[1, 2, 3], [4, 5, 6]]);\n *\n * a.dot(b).print(); // or tf.dot(a, b)\n * b.dot(a).print();\n * b.dot(c).print();\n * ```\n * @param t1 The first tensor in the dot operation.\n * @param t2 The second tensor in the dot operation.\n *\n * @doc {heading: 'Operations', subheading: 'Matrices'}\n */\nfunction dot_(t1: Tensor|TensorLike, t2: Tensor|TensorLike): Tensor {\n const $t1 = convertToTensor(t1, 't1', 'dot');\n const $t2 = convertToTensor(t2, 't2', 'dot');\n\n util.assert(\n ($t1.rank === 1 || $t1.rank === 2) && ($t2.rank === 1 || $t2.rank === 2),\n () => `Error in dot: inputs must all be rank 1 or 2, but got ranks ` +\n `${$t1.rank} and ${$t2.rank}.`);\n\n const t1Inner = ($t1.rank === 1 ? $t1.size : $t1.shape[1]);\n const t2Inner = ($t2.rank === 1 ? $t2.size : $t2.shape[0]);\n\n util.assert(\n t1Inner === t2Inner,\n () => `Error in dot: inner dimensions of inputs must match, but got ` +\n `${t1Inner} and ${t2Inner}.`);\n\n if ($t1.rank === 1 && $t2.rank === 1) {\n const t12D = reshape($t1, [1, -1]);\n const t22D = reshape($t2, [-1, 1]);\n const t1t2 = matMul(t12D, t22D);\n return reshape(t1t2, []);\n } else if ($t1.rank === 1 && $t2.rank === 2) {\n const t12D = reshape($t1, [1, -1]);\n const t22D = reshape($t2, [$t2.shape[0], $t2.shape[1]]);\n const t1t2 = matMul(t12D, t22D);\n return reshape(t1t2, [t1t2.size]);\n } else if ($t1.rank === 2 && $t2.rank === 1) {\n const t22D = reshape($t2, [-1, 1]);\n const t1t2 = matMul($t1, t22D);\n return reshape(t1t2, [t1t2.size]);\n } else {\n const t22D = reshape($t2, [$t2.shape[0], $t2.shape[1]]);\n const t1t2 = matMul($t1, t22D);\n return t1t2;\n }\n}\n\nexport const dot = op({dot_});\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Einsum, EinsumAttrs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\n\nimport {op} from './operation';\n\n/**\n * Tensor contraction over specified indices and outer product.\n *\n * `einsum` allows defining Tensors by defining their element-wise computation.\n * This computation is based on\n * [Einstein summation](https://en.wikipedia.org/wiki/Einstein_notation).\n *\n * Some special cases include:\n *\n * Matrix multiplication:\n * ```js\n * const x = tf.tensor2d([[1, 2, 3], [4, 5, 6]]);\n * const y = tf.tensor2d([[0, 1], [2, 3], [4, 5]]);\n * x.print();\n * y.print();\n * tf.einsum('ij,jk->ik', x, y).print();\n * ```\n *\n * Dot product:\n * ```js\n * const x = tf.tensor1d([1, 2, 3]);\n * const y = tf.tensor1d([0, 1, 2]);\n * x.print();\n * y.print();\n * tf.einsum('i,i->', x, y).print();\n * ```\n *\n * Batch dot product:\n * ```js\n * const x = tf.tensor2d([[1, 2, 3], [4, 5, 6]]);\n * const y = tf.tensor2d([[0, 1, 2], [3, 4, 5]]);\n * x.print();\n * y.print();\n * tf.einsum('bi,bi->b', x, y).print();\n * ```\n *\n * Outer prouduct:\n * ```js\n * const x = tf.tensor1d([1, 3, 5]);\n * const y = tf.tensor1d([2, 4, 6]);\n * x.print();\n * y.print();\n * tf.einsum('i,j->ij', x, y).print();\n * ```\n *\n * Matrix transpose:\n * ```js\n * const x = tf.tensor2d([[1, 2], [3, 4]]);\n * x.print();\n * tf.einsum('ij->ji', x).print();\n * ```\n *\n * Batch matrix transpose:\n * ```js\n * const x = tf.tensor3d([[[1, 2], [3, 4]], [[-1, -2], [-3, -4]]]);\n * x.print();\n * tf.einsum('bij->bji', x).print();\n * ```\n *\n * Limitations:\n *\n * This implementation of einsum has the following limitations:\n *\n * - Does not support >2 input tensors.\n * - Does not support duplicate axes for any given input tensor. E.g., equation\n * 'ii->' is not supported.\n * - The `...` notation is not supported.\n *\n * @param equation a string describing the contraction, in the same format as\n * [numpy.einsum](https://numpy.org/doc/stable/reference/generated/numpy.einsum.html).\n * @param tensors the input(s) to contract (each one a Tensor), whose shapes\n * should be consistent with equation.\n * @returns The output tensor.\n *\n * @doc {heading: 'Tensors', subheading: 'Matrices'}\n */\nexport function einsum_(equation: string, ...tensors: Tensor[]): Tensor {\n const $tensors =\n tensors.map((t, i) => convertToTensor(t, `tensors${i}`, 'einsum'));\n const attrs: EinsumAttrs = {equation};\n return ENGINE.runKernel(\n Einsum, $tensors as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const einsum = op({einsum_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Elu, EluInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes exponential linear element-wise: `x > 0 ? x : (e ^ x) - 1`.\n *\n * ```js\n * const x = tf.tensor1d([-1, 1, -3, 2]);\n *\n * x.elu().print(); // or tf.elu(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction elu_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'elu', 'float32');\n\n const inputs: EluInputs = {x: $x};\n\n return ENGINE.runKernel(Elu, inputs as {} as NamedTensorMap);\n}\n\nexport const elu = op({elu_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Erf, ErfInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {cast} from './cast';\nimport {op} from './operation';\n\n/**\n * Computes Gauss error function of the input `tf.Tensor` element-wise:\n * `erf(x)`\n *\n * ```js\n * const x = tf.tensor1d([0, .1, -.1, .7]);\n *\n * x.erf().print(); // or tf.erf(x);\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction erf_(x: T|TensorLike): T {\n let $x = convertToTensor(x, 'x', 'erf');\n util.assert(\n $x.dtype === 'int32' || $x.dtype === 'float32',\n () => 'Input dtype must be `int32` or `float32`.');\n\n if ($x.dtype === 'int32') {\n $x = cast($x, 'float32');\n }\n\n const inputs: ErfInputs = {x: $x};\n return ENGINE.runKernel(Erf, inputs as {} as NamedTensorMap);\n}\nexport const erf = op({erf_});\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport * as util from '../util';\n\n/**\n * Returns true if the axis specifies the inner most dimensions of the\n * array.\n */\nexport function axesAreInnerMostDims(axes: number[], rank: number): boolean {\n for (let i = 0; i < axes.length; ++i) {\n if (axes[axes.length - i - 1] !== rank - 1 - i) {\n return false;\n }\n }\n return true;\n}\n\nexport function combineLocations(\n outputLoc: number[], reduceLoc: number[], axes: number[]): number[] {\n const rank = outputLoc.length + reduceLoc.length;\n const loc = [];\n let outIdx = 0;\n let reduceIdx = 0;\n   for (let dim = 0; dim < rank; dim++) {\n if (axes.indexOf(dim) === -1) {\n loc.push(outputLoc[outIdx++]);\n } else {\n loc.push(reduceLoc[reduceIdx++]);\n }\n }\n return loc;\n}\n\nexport function computeOutAndReduceShapes(\n aShape: number[], axes: number[]): [number[], number[]] {\n const outShape = [];\n const rank = aShape.length;\n for (let dim = 0; dim < rank; dim++) {\n if (axes.indexOf(dim) === -1) {\n outShape.push(aShape[dim]);\n }\n }\n const reduceShape = axes.map(dim => aShape[dim]);\n return [outShape, reduceShape];\n}\n\nexport function expandShapeToKeepDim(\n shape: number[], axes: number[]): number[] {\n const reduceSubShape = axes.map(x => 1);\n return combineLocations(shape, reduceSubShape, axes);\n}\n\nexport function assertAxesAreInnerMostDims(\n msg: string, axes: number[], rank: number): void {\n util.assert(\n axesAreInnerMostDims(axes, rank),\n () => `${msg} supports only inner-most axes for now. ` +\n `Got axes ${axes} and rank-${rank} input.`);\n}\n\n/**\n * Returns the axes permutation to be used with `tf.transpose`, if such\n * permutation is necessary. Otherwise it returns null. This method is used by\n * operations that operate only on inner-most axes.\n */\nexport function getAxesPermutation(axes: number[], rank: number): number[]|\n null {\n if (axesAreInnerMostDims(axes, rank)) {\n return null;\n }\n const result: number[] = [];\n for (let i = 0; i < rank; ++i) {\n if (axes.indexOf(i) === -1) {\n result.push(i);\n }\n }\n axes.forEach(axis => result.push(axis));\n return result;\n}\n\n/** Returns the axes permutation that undoes the original permutation. */\nexport function getUndoAxesPermutation(axes: number[]): number[] {\n return axes.map((axis, i) => [i, axis])\n .sort((a, b) => a[1] - b[1])\n .map(x => x[0]);\n}\n\nexport function getInnerMostAxes(numAxes: number, rank: number): number[] {\n const res: number[] = [];\n for (let i = rank - numAxes; i < rank; ++i) {\n res.push(i);\n }\n return res;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Max, MaxAttrs, MaxInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes the maximum of elements across dimensions of a `tf.Tensor`.\n *\n * Reduces the input along the dimensions given in `axes`. Unless `keepDims`\n * is true, the rank of the `tf.Tensor` is reduced by 1 for each entry in\n * `axes`. If `keepDims` is true, the reduced dimensions are retained with\n * length 1. If `axes` has no entries, all dimensions are reduced, and a\n * `tf.Tensor` with a single element is returned.\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 3]);\n *\n * x.max().print(); // or tf.max(x)\n * ```\n *\n * ```js\n * const x = tf.tensor2d([1, 2, 3, 4], [2, 2]);\n *\n * const axis = 1;\n * x.max(axis).print(); // or tf.max(x, axis)\n * ```\n *\n * @param x The input tensor.\n * @param axis The dimension(s) to reduce. By default it reduces\n * all dimensions.\n * @param keepDims If true, retains reduced dimensions with size 1.\n *\n * @doc {heading: 'Operations', subheading: 'Reduction'}\n */\nfunction max_(\n x: Tensor|TensorLike, axis: number|number[] = null, keepDims = false): T {\n const $x = convertToTensor(x, 'x', 'max');\n\n const inputs: MaxInputs = {x: $x};\n const attrs: MaxAttrs = {reductionIndices: axis, keepDims};\n\n return ENGINE.runKernel(\n Max, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const max = op({max_});\n","/**\n * @license\n * Copyright 2020 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Min, MinAttrs, MinInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes the minimum value from the input.\n *\n * Reduces the input along the dimensions given in `axes`. Unless `keepDims`\n * is true, the rank of the array is reduced by 1 for each entry in `axes`.\n * If `keepDims` is true, the reduced dimensions are retained with length 1.\n * If `axes` has no entries, all dimensions are reduced, and an array with a\n * single element is returned.\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 3]);\n *\n * x.min().print(); // or tf.min(x)\n * ```\n *\n * ```js\n * const x = tf.tensor2d([1, 2, 3, 4], [2, 2]);\n *\n * const axis = 1;\n * x.min(axis).print(); // or tf.min(x, axis)\n * ```\n *\n * @param x The input Tensor.\n * @param axis The dimension(s) to reduce. By default it reduces\n * all dimensions.\n * @param keepDims If true, retains reduced dimensions with size 1.\n *\n * @doc {heading: 'Operations', subheading: 'Reduction'}\n */\nfunction min_(\n x: Tensor|TensorLike, axis: number|number[] = null, keepDims = false): T {\n const $x = convertToTensor(x, 'x', 'min');\n\n const inputs: MinInputs = {x: $x};\n const attrs: MinAttrs = {axis, keepDims};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n return ENGINE.runKernel(\n Min, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as T;\n}\n\nexport const min = op({min_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Pow, PowInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes the power of one `tf.Tensor` to another. Supports broadcasting.\n *\n * Given a `tf.Tensor` x and a `tf.Tensor` y, this operation computes x^y for\n * corresponding elements in x and y. The result's dtype will be the upcasted\n * type of the `base` and `exp` dtypes.\n *\n * ```js\n * const a = tf.tensor([[2, 3], [4, 5]])\n * const b = tf.tensor([[1, 2], [3, 0]]).toInt();\n *\n * a.pow(b).print(); // or tf.pow(a, b)\n * ```\n *\n * ```js\n * const a = tf.tensor([[1, 2], [3, 4]])\n * const b = tf.tensor(2).toInt();\n *\n * a.pow(b).print(); // or tf.pow(a, b)\n * ```\n * We also expose `powStrict` which has the same signature as this op and\n * asserts that `base` and `exp` are the same shape (does not broadcast).\n *\n * @param base The base `tf.Tensor` to pow element-wise.\n * @param exp The exponent `tf.Tensor` to pow element-wise.\n *\n * @doc {heading: 'Operations', subheading: 'Arithmetic'}\n */\nfunction pow_(\n base: Tensor|TensorLike, exp: Tensor|TensorLike): T {\n let $base = convertToTensor(base, 'base', 'pow');\n let $exp = convertToTensor(exp, 'exp', 'pow');\n [$base, $exp] = makeTypesMatch($base, $exp);\n\n const inputs: PowInputs = {a: $base, b: $exp};\n\n return ENGINE.runKernel(Pow, inputs as {} as NamedTensorMap);\n}\n\nexport const pow = op({pow_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Scalar} from '../tensor';\nimport {DataType} from '../types';\nimport {isTypedArray} from '../util';\nimport {makeTensor} from './tensor_ops_util';\n\n/**\n * Creates rank-0 `tf.Tensor` (scalar) with the provided value and dtype.\n *\n * The same functionality can be achieved with `tf.tensor`, but in general\n * we recommend using `tf.scalar` as it makes the code more readable.\n *\n * ```js\n * tf.scalar(3.14).print();\n * ```\n *\n * @param value The value of the scalar.\n * @param dtype The data type.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nexport function scalar(\n value: number|boolean|string|Uint8Array, dtype?: DataType): Scalar {\n if (((isTypedArray(value) && dtype !== 'string') || Array.isArray(value)) &&\n dtype !== 'complex64') {\n throw new Error(\n 'Error creating a new Scalar: value must be a primitive ' +\n '(number|boolean|string)');\n }\n if (dtype === 'string' && isTypedArray(value) &&\n !(value instanceof Uint8Array)) {\n throw new Error(\n 'When making a scalar from encoded string, ' +\n 'the value must be `Uint8Array`.');\n }\n const shape: number[] = [];\n const inferredShape: number[] = [];\n return makeTensor(value, shape, inferredShape, dtype) as Scalar;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Sqrt, SqrtInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes square root of the input `tf.Tensor` element-wise: `y = sqrt(x)`\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 4, -1]);\n *\n * x.sqrt().print(); // or tf.sqrt(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction sqrt_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'sqrt', 'float32');\n\n const inputs: SqrtInputs = {x: $x};\n\n return ENGINE.runKernel(Sqrt, inputs as {} as NamedTensorMap);\n}\nexport const sqrt = op({sqrt_});\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Tensor} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {op} from './operation';\n\n/**\n * Computes square of `x` element-wise: `x ^ 2`\n *\n * ```js\n * const x = tf.tensor1d([1, 2, Math.sqrt(2), -1]);\n *\n * x.square().print(); // or tf.square(x)\n * ```\n * @param x The input Tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction square_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'square');\n const attrs = {};\n return ENGINE.runKernel('Square', {x: $x}, attrs);\n}\n\nexport const square = op({square_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Sum, SumAttrs, SumInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {cast} from './cast';\nimport {op} from './operation';\n\n/**\n * Computes the sum of elements across dimensions of a `tf.Tensor`.\n *\n * Reduces the input along the dimensions given in `axes`. Unless `keepDims`\n * is true, the rank of the `tf.Tensor` is reduced by 1 for each entry in\n * `axes`. If `keepDims` is true, the reduced dimensions are retained with\n * length 1. If axes has no entries, all dimensions are reduced, and a\n * `tf.Tensor` with a single element is returned.\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 3]);\n *\n * x.sum().print(); // or tf.sum(x)\n * ```\n *\n * ```js\n * const x = tf.tensor2d([1, 2, 3, 4], [2, 2]);\n *\n * const axis = 1;\n * x.sum(axis).print(); // or tf.sum(x, axis)\n * ```\n *\n * @param x The input tensor to compute the sum over. If the dtype is `bool`\n * it will be converted to `int32` and the output dtype will be `int32`.\n * @param axis The dimension(s) to reduce. By default it reduces\n * all dimensions.\n * @param keepDims If true, retains reduced dimensions with size 1.\n *\n * @doc {heading: 'Operations', subheading: 'Reduction'}\n */\nfunction sum_(\n x: Tensor|TensorLike, axis: number|number[] = null, keepDims = false): T {\n let $x = convertToTensor(x, 'x', 'sum');\n if ($x.dtype === 'bool') {\n $x = cast($x, 'int32');\n }\n\n const inputs: SumInputs = {x: $x};\n const attrs: SumAttrs = {axis, keepDims};\n\n return ENGINE.runKernel(\n Sum, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const sum = op({sum_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {parseAxisParam} from '../util';\n\nimport {abs} from './abs';\nimport * as axis_util from './axis_util';\nimport {max} from './max';\nimport {min} from './min';\nimport {op} from './operation';\nimport {pow} from './pow';\nimport {reshape} from './reshape';\nimport {scalar} from './scalar';\nimport {sqrt} from './sqrt';\nimport {square} from './square';\nimport {sum} from './sum';\n\n/**\n * Computes the norm of scalar, vectors, and matrices.\n * This function can compute several different vector norms (the 1-norm, the\n * Euclidean or 2-norm, the inf-norm, and in general the p-norm for p > 0)\n * and matrix norms (Frobenius, 1-norm, and inf-norm).\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 3, 4]);\n *\n * x.norm().print(); // or tf.norm(x)\n * ```\n *\n * @param x The input array.\n * @param ord Optional. Order of the norm. Supported norm types are\n * following:\n *\n * | ord | norm for matrices | norm for vectors\n * |------------|---------------------------|---------------------\n * |'euclidean' |Frobenius norm |2-norm\n * |'fro' |Frobenius norm\t |\n * |Infinity |max(sum(abs(x), axis=1)) |max(abs(x))\n * |-Infinity |min(sum(abs(x), axis=1)) |min(abs(x))\n * |1 |max(sum(abs(x), axis=0)) |sum(abs(x))\n * |2 | |sum(abs(x)^2)^(1/2)\n *\n * @param axis Optional. If axis is null (the default), the input is\n * considered a vector and a single vector norm is computed over the entire\n * set of values in the Tensor, i.e. norm(x, ord) is equivalent\n * to norm(x.reshape([-1]), ord). If axis is an integer, the input\n * is considered a batch of vectors, and axis determines the axis in x\n * over which to compute vector norms. If axis is a 2-tuple of integer it is\n * considered a batch of matrices and axis determines the axes in NDArray\n * over which to compute a matrix norm.\n * @param keepDims Optional. If true, the norm has the same dimensionality\n * as the input.\n *\n * @doc {heading: 'Operations', subheading: 'Matrices'}\n */\nfunction norm_(\n x: Tensor|TensorLike, ord: number|'euclidean'|'fro' = 'euclidean',\n axis: number|number[] = null, keepDims = false): Tensor {\n x = convertToTensor(x, 'x', 'norm');\n\n const norm = normImpl(x, ord, axis);\n let keepDimsShape = norm.shape;\n if (keepDims) {\n const axes = parseAxisParam(axis, x.shape);\n keepDimsShape = axis_util.expandShapeToKeepDim(norm.shape, axes);\n }\n return reshape(norm, keepDimsShape);\n}\n\nfunction normImpl(\n x: Tensor, p: number|string, axis: number|number[] = null): Tensor {\n if (x.rank === 0) {\n return abs(x);\n }\n\n // consider vector when no axis is specified\n if (x.rank !== 1 && axis === null) {\n return normImpl(reshape(x, [-1]), p, axis);\n }\n\n // vector\n if (x.rank === 1 || typeof axis === 'number' ||\n Array.isArray(axis) && axis.length === 1) {\n if (p === 1) {\n return sum(abs(x), axis);\n }\n if (p === Infinity) {\n return max(abs(x), axis);\n }\n if (p === -Infinity) {\n return min(abs(x), axis);\n }\n if (p === 'euclidean' || p === 2) {\n // norm(x, 2) = sum(abs(xi) ^ 2) ^ 1/2\n return sqrt(sum(pow(abs(x), scalar(2, 'int32')), axis));\n }\n\n throw new Error(`Error in norm: invalid ord value: ${p}`);\n }\n\n // matrix (assumption axis[0] < axis[1])\n if (Array.isArray(axis) && axis.length === 2) {\n if (p === 1) {\n return max(sum(abs(x), axis[0]), axis[1] - 1);\n }\n if (p === Infinity) {\n return max(sum(abs(x), axis[1]), axis[0]);\n }\n if (p === -Infinity) {\n return min(sum(abs(x), axis[1]), axis[0]);\n }\n if (p === 'fro' || p === 'euclidean') {\n // norm(x) = sqrt(sum(pow(x, 2)))\n return sqrt(sum(square(x), axis));\n }\n\n throw new Error(`Error in norm: invalid ord value: ${p}`);\n }\n\n throw new Error(`Error in norm: invalid axis: ${axis}`);\n}\n\nexport const norm = op({norm_});\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport {TensorLike} from '../types';\n\nimport {norm} from './norm';\nimport {op} from './operation';\n\n/**\n * Computes the Euclidean norm of scalar, vectors, and matrices.\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 3, 4]);\n *\n * x.euclideanNorm().print(); // or tf.euclideanNorm(x)\n * ```\n *\n * @param x The input array.\n * @param axis Optional. If axis is null (the default), the input is\n * considered a vector and a single vector norm is computed over the entire\n * set of values in the Tensor, i.e. euclideanNorm(x) is equivalent\n * to euclideanNorm(x.reshape([-1])). If axis is an integer, the input\n * is considered a batch of vectors, and axis determines the axis in x\n * over which to compute vector norms. If axis is a 2-tuple of integer it is\n * considered a batch of matrices and axis determines the axes in NDArray\n * over which to compute a matrix norm.\n * @param keepDims Optional. If true, the norm has the same dimensionality\n * as the input.\n *\n * @doc {heading: 'Operations', subheading: 'Matrices'}\n */\nfunction euclideanNorm_(\n x: Tensor|TensorLike, axis: number|number[] = null,\n keepDims = false): Tensor {\n return norm(x, 'euclidean', axis, keepDims);\n}\n\nexport const euclideanNorm = op({euclideanNorm_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Exp, ExpInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes exponential of the input `tf.Tensor` element-wise. `e ^ x`\n *\n * ```js\n * const x = tf.tensor1d([1, 2, -3]);\n *\n * x.exp().print(); // or tf.exp(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction exp_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'exp');\n\n const inputs: ExpInputs = {x: $x};\n return ENGINE.runKernel(Exp, inputs as {} as NamedTensorMap);\n}\nexport const exp = op({exp_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {ExpandDims, ExpandDimsAttrs, ExpandDimsInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\n\n/**\n * Returns a `tf.Tensor` that has expanded rank, by inserting a dimension\n * into the tensor's shape.\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 3, 4]);\n * const axis = 1;\n * x.expandDims(axis).print();\n * ```\n *\n * @param x The input tensor whose dimensions are to be expanded.\n * @param axis The dimension index at which to insert shape of `1`. Defaults\n * to 0 (the first dimension).\n *\n * @doc {heading: 'Tensors', subheading: 'Transformations'}\n */\nfunction expandDims_(x: Tensor|TensorLike, axis = 0): T {\n const $x = convertToTensor(x, 'x', 'expandDims', 'string_or_numeric');\n\n util.assert(axis <= $x.rank, () => 'Axis must be <= rank of the tensor');\n\n const inputs: ExpandDimsInputs = {input: $x};\n const attrs: ExpandDimsAttrs = {dim: axis};\n\n return ENGINE.runKernel(\n ExpandDims, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const expandDims = op({expandDims_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Expm1, Expm1Inputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes exponential of the input `tf.Tensor` minus one element-wise.\n * `e ^ x - 1`\n *\n * ```js\n * const x = tf.tensor1d([1, 2, -3]);\n *\n * x.expm1().print(); // or tf.expm1(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction expm1_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'expm1');\n\n const inputs: Expm1Inputs = {x: $x};\n return ENGINE.runKernel(Expm1, inputs as {} as NamedTensorMap);\n}\nexport const expm1 = op({expm1_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Tile, TileAttrs, TileInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\n\n/**\n * Construct a tensor by repeating it the number of times given by reps.\n *\n * This operation creates a new tensor by replicating `input` `reps`\n * times. The output tensor's `i`th dimension has `input.shape[i] *\n * reps[i]` elements, and the values of `input` are replicated\n * `reps[i]` times along the `i`th dimension. For example, tiling\n * `[a, b, c, d]` by `[2]` produces `[a, b, c, d, a, b, c, d]`.\n *\n * ```js\n * const a = tf.tensor1d([1, 2]);\n *\n * a.tile([2]).print(); // or a.tile([2])\n * ```\n *\n * ```js\n * const a = tf.tensor2d([1, 2, 3, 4], [2, 2]);\n *\n * a.tile([1, 2]).print(); // or a.tile([1, 2])\n * ```\n * @param x The tensor to tile.\n * @param reps Determines the number of replications per dimension.\n *\n * @doc {heading: 'Tensors', subheading: 'Slicing and Joining'}\n */\nfunction tile_(x: T|TensorLike, reps: number[]): T {\n const $x = convertToTensor(x, 'x', 'tile', 'string_or_numeric');\n util.assert(\n $x.rank === reps.length,\n () => `Error in transpose: rank of input ${$x.rank} ` +\n `must match length of reps ${reps}.`);\n\n const inputs: TileInputs = {x: $x};\n const attrs: TileAttrs = {reps};\n\n return ENGINE.runKernel(\n Tile, inputs as unknown as NamedTensorMap,\n attrs as unknown as NamedAttrMap);\n}\n\nexport const tile = op({tile_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor2D} from '../tensor';\nimport {DataType} from '../types';\n\nimport {buffer} from './buffer';\nimport {expandDims} from './expand_dims';\nimport {op} from './operation';\nimport {reshape} from './reshape';\nimport {tile} from './tile';\n\n/**\n * Create an identity matrix.\n *\n * @param numRows Number of rows.\n * @param numColumns Number of columns. Defaults to `numRows`.\n * @param batchShape If provided, will add the batch shape to the beginning\n * of the shape of the returned `tf.Tensor` by repeating the identity\n * matrix.\n * @param dtype Data type.\n * @returns Identity matrix of the specified size and data type, possibly\n * with batch repetition if `batchShape` is specified.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nfunction eye_(\n numRows: number, numColumns?: number,\n batchShape?:\n [\n number\n ]|[number,\n number]|[number, number, number]|[number, number, number, number],\n dtype: DataType = 'float32'): Tensor2D {\n if (numColumns == null) {\n numColumns = numRows;\n }\n const buff = buffer([numRows, numColumns], dtype);\n const n = numRows <= numColumns ? numRows : numColumns;\n for (let i = 0; i < n; ++i) {\n buff.set(1, i, i);\n }\n const out: Tensor2D = reshape(buff.toTensor(), [numRows, numColumns]);\n if (batchShape == null) {\n return out;\n } else {\n if (batchShape.length === 1) {\n return tile(expandDims(out, 0), [batchShape[0], 1, 1]) as Tensor2D;\n } else if (batchShape.length === 2) {\n // tslint:disable-next-line:no-unnecessary-type-assertion\n return tile(\n expandDims(expandDims(out, 0), 0),\n [batchShape[0], batchShape[1], 1, 1]) as Tensor2D;\n } else if (batchShape.length === 3) {\n // tslint:disable-next-line:no-unnecessary-type-assertion\n return tile(expandDims(expandDims(expandDims(out, 0), 0), 0), [\n batchShape[0], batchShape[1], batchShape[2], 1, 1\n ]) as Tensor2D;\n } else {\n throw new Error(\n `eye() currently supports only 1D and 2D ` +\n // tslint:disable-next-line:no-any\n `batchShapes, but received ${(batchShape as any).length}D.`);\n }\n }\n}\n\nexport const eye = op({eye_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Floor, FloorInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes floor of input `tf.Tensor` element-wise: `floor(x)`.\n *\n * ```js\n * const x = tf.tensor1d([.6, 1.1, -3.3]);\n *\n * x.floor().print(); // or tf.floor(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction floor_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'floor', 'float32');\n\n const inputs: FloorInputs = {x: $x};\n return ENGINE.runKernel(Floor, inputs as {} as NamedTensorMap);\n}\nexport const floor = op({floor_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {GatherV2, GatherV2Attrs, GatherV2Inputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Gather slices from tensor `x`'s axis `axis` according to `indices`.\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 3, 4]);\n * const indices = tf.tensor1d([1, 3, 3], 'int32');\n *\n * x.gather(indices).print();\n * ```\n *\n * ```js\n * const x = tf.tensor2d([1, 2, 3, 4], [2, 2]);\n * const indices = tf.tensor1d([1, 1, 0], 'int32');\n *\n * x.gather(indices).print();\n * ```\n * @param x The input tensor whose slices are to be gathered.\n * @param indices The indices of the values to extract.\n * @param axis The axis over which to select values. Defaults to 0.\n * @param batchDims Optional. The number of batch dimensions. It must be less\n * than or equal to rank(indices). Defaults to 0.\n * The output tensor will have shape of\n * `x.shape[:axis] + indices.shape[batchDims:] + x.shape[axis + 1:]`\n *\n * @doc {heading: 'Tensors', subheading: 'Slicing and Joining'}\n */\nfunction gather_(\n x: T|TensorLike, indices: Tensor|TensorLike, axis = 0, batchDims = 0): T {\n const $x = convertToTensor(x, 'x', 'gather');\n const $indices = convertToTensor(indices, 'indices', 'gather', 'int32');\n\n const inputs: GatherV2Inputs = {x: $x, indices: $indices};\n const attrs: GatherV2Attrs = {axis, batchDims};\n\n return ENGINE.runKernel(\n GatherV2, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const gather = op({gather_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Greater, GreaterInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {assertAndGetBroadcastShape} from './broadcast_util';\nimport {op} from './operation';\n\n/**\n * Returns the truth value of (a > b) element-wise. Supports broadcasting.\n *\n * ```js\n * const a = tf.tensor1d([1, 2, 3]);\n * const b = tf.tensor1d([2, 2, 2]);\n *\n * a.greater(b).print();\n * ```\n *\n * @param a The first input tensor.\n * @param b The second input tensor. Must have the same dtype as `a`.\n *\n * @doc {heading: 'Operations', subheading: 'Logical'}\n */\nfunction greater_(\n a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n let $a = convertToTensor(a, 'a', 'greater', 'string_or_numeric');\n let $b = convertToTensor(b, 'b', 'greater', 'string_or_numeric');\n [$a, $b] = makeTypesMatch($a, $b);\n\n assertAndGetBroadcastShape($a.shape, $b.shape);\n\n const inputs: GreaterInputs = {a: $a, b: $b};\n\n return ENGINE.runKernel(Greater, inputs as {} as NamedTensorMap);\n}\n\nexport const greater = op({greater_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {GreaterEqual, GreaterEqualInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {assertAndGetBroadcastShape} from './broadcast_util';\nimport {op} from './operation';\n\n/**\n * Returns the truth value of (a >= b) element-wise. Supports broadcasting.\n *\n * ```js\n * const a = tf.tensor1d([1, 2, 3]);\n * const b = tf.tensor1d([2, 2, 2]);\n *\n * a.greaterEqual(b).print();\n * ```\n *\n * @param a The first input tensor.\n * @param b The second input tensor. Must have the same dtype as `a`.\n *\n * @doc {heading: 'Operations', subheading: 'Logical'}\n */\nfunction greaterEqual_(\n a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n let $a = convertToTensor(a, 'a', 'greaterEqual', 'string_or_numeric');\n let $b = convertToTensor(b, 'b', 'greaterEqual', 'string_or_numeric');\n [$a, $b] = makeTypesMatch($a, $b);\n\n assertAndGetBroadcastShape($a.shape, $b.shape);\n\n const inputs: GreaterEqualInputs = {a: $a, b: $b};\n\n return ENGINE.runKernel(GreaterEqual, inputs as {} as NamedTensorMap);\n}\n\nexport const greaterEqual = op({greaterEqual_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {IsFinite, IsFiniteInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Returns which elements of x are finite.\n *\n * ```js\n * const x = tf.tensor1d([NaN, Infinity, -Infinity, 0, 1]);\n *\n * x.isFinite().print(); // or tf.isNaN(x)\n * ```\n * @param x The input Tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction isFinite_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'isFinite');\n\n const inputs: IsFiniteInputs = {x: $x};\n\n return ENGINE.runKernel(IsFinite, inputs as {} as NamedTensorMap);\n}\nexport const isFinite = op({isFinite_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {IsInf, IsInfInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Returns which elements of x are Infinity or -Infinity.\n *\n * ```js\n * const x = tf.tensor1d([NaN, Infinity, -Infinity, 0, 1]);\n *\n * x.isInf().print(); // or tf.isNaN(x)\n * ```\n * @param x The input Tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction isInf_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'isInf');\n\n const inputs: IsInfInputs = {x: $x};\n\n return ENGINE.runKernel(IsInf, inputs as {} as NamedTensorMap);\n}\nexport const isInf = op({isInf_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {IsNan, IsNanInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Returns which elements of x are NaN.\n *\n * ```js\n * const x = tf.tensor1d([NaN, Infinity, -Infinity, 0, 1]);\n *\n * x.isNaN().print(); // or tf.isNaN(x)\n * ```\n * @param x The input Tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction isNaN_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'isNaN');\n const inputs: IsNanInputs = {x: $x};\n\n return ENGINE.runKernel(IsNan, inputs as {} as NamedTensorMap);\n}\nexport const isNaN = op({isNaN_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {LeakyRelu, LeakyReluAttrs, LeakyReluInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes leaky rectified linear element-wise.\n *\n * See\n * [http://web.stanford.edu/~awni/papers/relu_hybrid_icml2013_final.pdf](\n * http://web.stanford.edu/~awni/papers/relu_hybrid_icml2013_final.pdf)\n *\n * ```js\n * const x = tf.tensor1d([-1, 2, -3, 4]);\n *\n * x.leakyRelu(0.1).print(); // or tf.leakyRelu(x, 0.1)\n * ```\n * @param x The input tensor.\n * @param alpha The scaling factor for negative values, defaults to 0.2.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction leakyRelu_(x: T|TensorLike, alpha = 0.2): T {\n const $x = convertToTensor(x, 'x', 'leakyRelu');\n\n const inputs: LeakyReluInputs = {x: $x};\n const attrs: LeakyReluAttrs = {alpha};\n\n return ENGINE.runKernel(\n LeakyRelu, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const leakyRelu = op({leakyRelu_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Less, LessInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {assertAndGetBroadcastShape} from './broadcast_util';\nimport {op} from './operation';\n\n/**\n * Returns the truth value of (a < b) element-wise. Supports broadcasting.\n *\n * ```js\n * const a = tf.tensor1d([1, 2, 3]);\n * const b = tf.tensor1d([2, 2, 2]);\n *\n * a.less(b).print();\n * ```\n * @param a The first input tensor.\n * @param b The second input tensor. Must have the same dtype as `a`.\n *\n * @doc {heading: 'Operations', subheading: 'Logical'}\n */\nfunction less_(\n a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n let $a = convertToTensor(a, 'a', 'less', 'string_or_numeric');\n let $b = convertToTensor(b, 'b', 'less', 'string_or_numeric');\n [$a, $b] = makeTypesMatch($a, $b);\n\n assertAndGetBroadcastShape($a.shape, $b.shape);\n\n const inputs: LessInputs = {a: $a, b: $b};\n\n return ENGINE.runKernel(Less, inputs as {} as NamedTensorMap);\n}\n\nexport const less = op({less_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {LessEqual, LessEqualInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {assertAndGetBroadcastShape} from './broadcast_util';\nimport {op} from './operation';\n\n/**\n * Returns the truth value of (a <= b) element-wise. Supports broadcasting.\n *\n * ```js\n * const a = tf.tensor1d([1, 2, 3]);\n * const b = tf.tensor1d([2, 2, 2]);\n *\n * a.lessEqual(b).print();\n * ```\n *\n * @param a The first input tensor.\n * @param b The second input tensor. Must have the same dtype as `a`.\n *\n * @doc {heading: 'Operations', subheading: 'Logical'}\n */\nfunction lessEqual_(\n a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n let $a = convertToTensor(a, 'a', 'lessEqual', 'string_or_numeric');\n let $b = convertToTensor(b, 'b', 'lessEqual', 'string_or_numeric');\n [$a, $b] = makeTypesMatch($a, $b);\n\n assertAndGetBroadcastShape($a.shape, $b.shape);\n\n const inputs: LessEqualInputs = {a: $a, b: $b};\n\n return ENGINE.runKernel(LessEqual, inputs as {} as NamedTensorMap);\n}\n\nexport const lessEqual = op({lessEqual_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {LinSpace, LinSpaceAttrs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor1D} from '../tensor';\n\n/**\n * Return an evenly spaced sequence of numbers over the given interval.\n *\n * ```js\n * tf.linspace(0, 9, 10).print();\n * ```\n * @param start The start value of the sequence.\n * @param stop The end value of the sequence.\n * @param num The number of values to generate.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nexport function linspace(start: number, stop: number, num: number): Tensor1D {\n if (num <= 0) {\n throw new Error('The number of values should be positive.');\n }\n\n const attrs: LinSpaceAttrs = {start, stop, num};\n return ENGINE.runKernel(LinSpace, {}, attrs as {} as NamedAttrMap);\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {LRN, LRNAttrs, LRNInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor3D, Tensor4D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * Normalizes the activation of a local neighborhood across or within\n * channels.\n *\n * @param x The input tensor. The 4-D input tensor is treated as a 3-D array\n * of 1D vectors (along the last dimension), and each vector is\n * normalized independently.\n * @param depthRadius The number of adjacent channels in the 1D normalization\n * window.\n * @param bias A constant bias term for the basis.\n * @param alpha A scale factor, usually positive.\n * @param beta An exponent.\n *\n * @doc {heading: 'Operations', subheading: 'Normalization'}\n */\nfunction localResponseNormalization_(\n x: T|TensorLike, depthRadius = 5, bias = 1, alpha = 1, beta = 0.5): T {\n const $x = convertToTensor(x, 'x', 'localResponseNormalization');\n util.assert(\n $x.rank === 4 || $x.rank === 3,\n () => `Error in localResponseNormalization: x must be rank 3 or 4 but got\n rank ${$x.rank}.`);\n util.assert(\n util.isInt(depthRadius),\n () => `Error in localResponseNormalization: depthRadius must be an ` +\n `integer but got depthRadius ${depthRadius}.`);\n\n let x4D = $x as Tensor4D;\n let reshapedTo4D = false;\n if ($x.rank === 3) {\n reshapedTo4D = true;\n x4D = reshape($x, [1, $x.shape[0], $x.shape[1], $x.shape[2]]);\n }\n\n const inputs: LRNInputs = {x: x4D};\n\n const attrs: LRNAttrs = {depthRadius, bias, alpha, beta};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n const res = ENGINE.runKernel(\n LRN, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as T;\n\n if (reshapedTo4D) {\n return reshape(res, [res.shape[1], res.shape[2], res.shape[3]]) as T;\n } else {\n return res;\n }\n}\n\nexport const localResponseNormalization = op({localResponseNormalization_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Log, LogInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes natural logarithm of the input `tf.Tensor` element-wise: `ln(x)`\n *\n * ```js\n * const x = tf.tensor1d([1, 2, Math.E]);\n *\n * x.log().print(); // or tf.log(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction log_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'log', 'float32');\n\n const inputs: LogInputs = {x: $x};\n return ENGINE.runKernel(Log, inputs as {} as NamedTensorMap);\n}\nexport const log = op({log_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Log1p, Log1pInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes natural logarithm of the input `tf.Tensor` plus one\n * element-wise: `ln(1 + x)`\n *\n * ```js\n * const x = tf.tensor1d([1, 2, Math.E - 1]);\n *\n * x.log1p().print(); // or tf.log1p(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction log1p_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'log1p');\n\n const inputs: Log1pInputs = {x: $x};\n return ENGINE.runKernel(Log1p, inputs as {} as NamedTensorMap);\n}\nexport const log1p = op({log1p_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {CustomGradientFunc, ENGINE} from './engine';\nimport {Scalar, Tensor, Variable} from './tensor';\nimport {NamedTensorMap} from './tensor_types';\nimport {convertToTensor, convertToTensorArray} from './tensor_util_env';\nimport {TensorLike} from './types';\nimport * as util from './util';\n\n/**\n * Provided `f(x)`, returns another function `g(x, dy?)`, which gives the\n * gradient of `f(x)` with respect to `x`.\n *\n * If `dy` is provided, the gradient of `f(x).mul(dy).sum()` with respect to\n * `x` is computed instead. `f(x)` must take a single tensor `x` and return a\n * single tensor `y`. If `f()` takes multiple inputs, use `tf.grads` instead.\n *\n * ```js\n * // f(x) = x ^ 2\n * const f = x => x.square();\n * // f'(x) = 2x\n * const g = tf.grad(f);\n *\n * const x = tf.tensor1d([2, 3]);\n * g(x).print();\n * ```\n *\n * ```js\n * // f(x) = x ^ 3\n * const f = x => x.pow(tf.scalar(3, 'int32'));\n * // f'(x) = 3x ^ 2\n * const g = tf.grad(f);\n * // f''(x) = 6x\n * const gg = tf.grad(g);\n *\n * const x = tf.tensor1d([2, 3]);\n * gg(x).print();\n * ```\n *\n * @param f The function f(x), to compute gradient for.\n *\n * @doc {heading: 'Training', subheading: 'Gradients'}\n */\nfunction grad(f: (x: Tensor) => Tensor): (\n x: TensorLike|Tensor, dy?: TensorLike|Tensor) => Tensor {\n util.assert(\n util.isFunction(f), () => 'The f passed in grad(f) must be a function');\n return (x: TensorLike|Tensor, dy?: TensorLike|Tensor): Tensor => {\n // x can be of any dtype, thus null as the last argument.\n const $x = convertToTensor(x, 'x', 'tf.grad', 'string_or_numeric');\n const $dy: Tensor =\n (dy != null) ? convertToTensor(dy, 'dy', 'tf.grad') : null;\n return ENGINE.tidy(() => {\n const {value, grads} = ENGINE.gradients(() => f($x), [$x], $dy);\n if ($dy != null) {\n util.assertShapesMatch(\n value.shape, $dy.shape,\n 'The shape of dy passed in grad(f)(x, dy) must match the shape ' +\n 'returned by f(x)');\n }\n checkGrads(grads);\n return grads[0];\n });\n };\n}\n\n/**\n * Provided `f(x1, x2,...)`, returns another function `g([x1, x2,...], dy?)`,\n * which gives an array of gradients of `f()` with respect to each input\n * [`x1`,`x2`,...].\n *\n * If `dy` is passed when calling `g()`, the gradient of\n * `f(x1,...).mul(dy).sum()` with respect to each input is computed instead.\n * The provided `f` must take one or more tensors and return a single tensor\n * `y`. If `f()` takes a single input, we recommend using `tf.grad` instead.\n *\n * ```js\n * // f(a, b) = a * b\n * const f = (a, b) => a.mul(b);\n * // df / da = b, df / db = a\n * const g = tf.grads(f);\n *\n * const a = tf.tensor1d([2, 3]);\n * const b = tf.tensor1d([-2, -3]);\n * const [da, db] = g([a, b]);\n * console.log('da');\n * da.print();\n * console.log('db');\n * db.print();\n * ```\n *\n * @param f The function `f(x1, x2,...)` to compute gradients for.\n *\n * @doc {heading: 'Training', subheading: 'Gradients'}\n */\nfunction grads(f: (...args: Tensor[]) => Tensor): (\n args: Array, dy?: Tensor|TensorLike) => Tensor[] {\n util.assert(\n util.isFunction(f), () => 'The f passed in grads(f) must be a function');\n return (args: Array, dy?: Tensor|TensorLike): Tensor[] => {\n util.assert(\n Array.isArray(args),\n () => 'The args passed in grads(f)(args) must be an array ' +\n 'of `Tensor`s or `TensorLike`s');\n // args can be of any dtype, thus null as the last argument.\n const $args =\n convertToTensorArray(args, 'args', 'tf.grads', 'string_or_numeric');\n const $dy: Tensor =\n (dy != null) ? convertToTensor(dy, 'dy', 'tf.grads') : null;\n return ENGINE.tidy(() => {\n const {value, grads} = ENGINE.gradients(() => f(...$args), $args, $dy);\n if ($dy != null) {\n util.assertShapesMatch(\n value.shape, $dy.shape,\n 'The shape of dy passed in grads(f)([x1,...], dy) must ' +\n 'match the shape returned by f([x1,...])');\n }\n checkGrads(grads);\n return grads;\n });\n };\n}\n\n/**\n * Like `tf.grad`, but also returns the value of `f()`. Useful when `f()`\n * returns a metric you want to show.\n *\n * The result is a rich object with the following properties:\n * - grad: The gradient of `f(x)` w.r.t. `x` (result of `tf.grad`).\n * - value: The value returned by `f(x)`.\n *\n * ```js\n * // f(x) = x ^ 2\n * const f = x => x.square();\n * // f'(x) = 2x\n * const g = tf.valueAndGrad(f);\n *\n * const x = tf.tensor1d([2, 3]);\n * const {value, grad} = g(x);\n *\n * console.log('value');\n * value.print();\n * console.log('grad');\n * grad.print();\n * ```\n *\n * @doc {heading: 'Training', subheading: 'Gradients'}\n */\nfunction valueAndGrad(f: (x: I) => O): (\n x: I, dy?: O) => {\n value: O;\n grad: I;\n} {\n util.assert(\n util.isFunction(f),\n () => 'The f passed in valueAndGrad(f) must be a function');\n return (x: I, dy?: O) => {\n util.assert(\n x instanceof Tensor,\n () => 'The x passed in valueAndGrad(f)(x) must be a tensor');\n util.assert(\n dy == null || dy instanceof Tensor,\n () => 'The dy passed in valueAndGrad(f)(x, dy) must be a tensor');\n const {grads, value} = ENGINE.gradients(() => f(x), [x], dy);\n checkGrads(grads);\n return {grad: grads[0] as I, value};\n };\n}\n\n/**\n * Like `tf.grads`, but returns also the value of `f()`. Useful when `f()`\n * returns a metric you want to show.\n *\n * The result is a rich object with the following properties:\n * - grads: The gradients of `f()` w.r.t. each input (result of `tf.grads`).\n * - value: The value returned by `f(x)`.\n *\n * ```js\n * // f(a, b) = a * b\n * const f = (a, b) => a.mul(b);\n * // df/da = b, df/db = a\n * const g = tf.valueAndGrads(f);\n *\n * const a = tf.tensor1d([2, 3]);\n * const b = tf.tensor1d([-2, -3]);\n * const {value, grads} = g([a, b]);\n *\n * const [da, db] = grads;\n *\n * console.log('value');\n * value.print();\n *\n * console.log('da');\n * da.print();\n * console.log('db');\n * db.print();\n * ```\n *\n * @doc {heading: 'Training', subheading: 'Gradients'}\n */\nfunction valueAndGrads(f: (...args: Tensor[]) => O): (\n args: Tensor[], dy?: O) => {\n grads: Tensor[];\n value: O;\n} {\n util.assert(\n util.isFunction(f),\n () => 'The f passed in valueAndGrads(f) must be a function');\n return (args: Tensor[], dy?: O) => {\n util.assert(\n Array.isArray(args) && args.every(arg => arg instanceof Tensor),\n () => 'The args passed in valueAndGrads(f)(args) must be array of ' +\n 'tensors');\n util.assert(\n dy == null || dy instanceof Tensor,\n () => 'The dy passed in valueAndGrads(f)(args, dy) must be a tensor');\n const res = ENGINE.gradients(() => f(...args), args, dy);\n if (dy != null) {\n util.assertShapesMatch(\n res.value.shape, dy.shape,\n 'The shape of dy passed in valueAndGrads(f)([x1,...], dy) must ' +\n 'match the shape returned by f([x1,...])');\n }\n checkGrads(res.grads);\n return res;\n };\n}\n\n/**\n * Computes and returns the gradient of f(x) with respect to the list of\n * trainable variables provided by `varList`. If no list is provided, it\n * defaults to all trainable variables.\n *\n * ```js\n * const a = tf.variable(tf.tensor1d([3, 4]));\n * const b = tf.variable(tf.tensor1d([5, 6]));\n * const x = tf.tensor1d([1, 2]);\n *\n * // f(a, b) = a * x ^ 2 + b * x\n * const f = () => a.mul(x.square()).add(b.mul(x)).sum();\n * // df/da = x ^ 2, df/db = x\n * const {value, grads} = tf.variableGrads(f);\n *\n * Object.keys(grads).forEach(varName => grads[varName].print());\n * ```\n *\n * @param f The function to execute. f() should return a scalar.\n * @param varList The list of variables to compute the gradients with respect\n * to. Defaults to all trainable variables.\n * @returns An object with the following keys and values:\n * - `value`: The value of the function `f`.\n * - `grads`: A map from the names of the variables to the gradients.\n * If the `varList` argument is provided explicitly and contains a subset of\n * non-trainable variables, this map in the return value will contain keys\n * that map the names of the non-trainable variables to `null`.\n *\n * @doc {heading: 'Training', subheading: 'Gradients'}\n */\nfunction variableGrads(f: () => Scalar, varList?: Variable[]):\n {value: Scalar, grads: NamedTensorMap} {\n util.assert(\n util.isFunction(f),\n () => 'The f passed in variableGrads(f) must be a function');\n util.assert(\n varList == null ||\n Array.isArray(varList) && varList.every(v => v instanceof Variable),\n () =>\n 'The varList passed in variableGrads(f, varList) must be an array ' +\n 'of variables');\n\n const specifiedVarList = varList != null;\n if (!specifiedVarList) {\n // Get all of the trainable variables.\n varList = [];\n for (const varName in ENGINE.registeredVariables) {\n varList.push(ENGINE.registeredVariables[varName]);\n }\n }\n\n const specifiedNonTrainable: Variable[] =\n specifiedVarList ? varList.filter(variable => !variable.trainable) : null;\n\n // Prune non-trainable variables.\n const originalVarCount = varList.length;\n varList = varList.filter(variable => variable.trainable);\n util.assert(\n varList.length > 0,\n () => `variableGrads() expects at least one of the input variables to ` +\n `be trainable, but none of the ${originalVarCount} variables is ` +\n `trainable.`);\n\n const allowNoGradients = true;\n const {value, grads} = ENGINE.gradients(f, varList, null, allowNoGradients);\n\n util.assert(\n grads.some(g => g != null),\n () => 'Cannot find a connection between any variable and the result of ' +\n 'the loss function y=f(x). Please make sure the operations that ' +\n 'use variables are inside the function f passed to minimize().');\n util.assert(\n value.rank === 0,\n () => `The f passed in variableGrads(f) must return a scalar, but it ` +\n `returned a rank-${value.rank} tensor`);\n\n const namedGrads: NamedTensorMap = {};\n varList.forEach((v, i) => {\n if (grads[i] != null) {\n namedGrads[v.name] = grads[i];\n }\n });\n if (specifiedNonTrainable != null) {\n // If varList is explicitly provided and contains non-trainable values,\n // add them to the returned gradients with `null` values.\n specifiedNonTrainable.forEach(v => namedGrads[v.name] = null);\n }\n return {value, grads: namedGrads};\n}\n\n/**\n * Overrides the gradient computation of a function `f`.\n *\n * Takes a function\n * `f(...inputs, save) => {value: Tensor, gradFunc: (dy, saved) => Tensor[]}`\n * and returns another function `g(...inputs)` which takes the same inputs as\n * `f`. When called, `g` returns `f().value`. In backward mode, custom gradients\n * with respect to each input of `f` are computed using `f().gradFunc`.\n *\n * The `save` function passed to `f` should be used for saving tensors needed\n * in the gradient. And the `saved` passed to the `gradFunc` is a\n * `NamedTensorMap`, which contains those saved tensors.\n *\n * ```js\n * const customOp = tf.customGrad((x, save) => {\n * // Save x to make sure it's available later for the gradient.\n * save([x]);\n * // Override gradient of our custom x ^ 2 op to be dy * abs(x);\n * return {\n * value: x.square(),\n * // Note `saved.x` which points to the `x` we saved earlier.\n * gradFunc: (dy, saved) => [dy.mul(saved[0].abs())]\n * };\n * });\n *\n * const x = tf.tensor1d([-1, -2, 3]);\n * const dx = tf.grad(x => customOp(x));\n *\n * console.log(`f(x):`);\n * customOp(x).print();\n * console.log(`f'(x):`);\n * dx(x).print();\n * ```\n *\n * @param f The function to evaluate in forward mode, which should return\n * `{value: Tensor, gradFunc: (dy, saved) => Tensor[]}`, where `gradFunc`\n * returns the custom gradients of `f` with respect to its inputs.\n *\n * @doc {heading: 'Training', subheading: 'Gradients'}\n */\nfunction customGrad(f: CustomGradientFunc):\n (...args: Tensor[]) => T {\n return ENGINE.customGrad(f);\n}\n\nfunction checkGrads(grads: Tensor[]) {\n const numNullGradients = grads.filter(g => g == null).length;\n if (numNullGradients > 0) {\n throw new Error(\n `Cannot compute gradient of y=f(x) with respect to x. Make sure that\n the f you passed encloses all operations that lead from x to y.`);\n }\n}\n\nexport {\n customGrad,\n variableGrads,\n valueAndGrad,\n valueAndGrads,\n grad,\n grads,\n};\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Softplus, SoftplusInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes softplus of the input `tf.Tensor` element-wise: `log(exp(x) + 1)`\n *\n * ```js\n * const x = tf.tensor1d([0, 1, -1, .7]);\n *\n * x.softplus().print(); // or tf.softplus(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction softplus_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'softplus');\n\n const inputs: SoftplusInputs = {x: $x};\n return ENGINE.runKernel(Softplus, inputs as {} as NamedTensorMap);\n}\nexport const softplus = op({softplus_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {customGrad} from '../gradients';\nimport {Tensor} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {mul} from './mul';\nimport {neg} from './neg';\nimport {op} from './operation';\nimport {sigmoid} from './sigmoid';\nimport {softplus} from './softplus';\n\n/**\n * Computes log sigmoid of the input `tf.Tensor` element-wise:\n * `logSigmoid(x)`. For numerical stability, we use `-tf.softplus(-x)`.\n *\n * ```js\n * const x = tf.tensor1d([0, 1, -1, .7]);\n *\n * x.logSigmoid().print(); // or tf.logSigmoid(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction logSigmoid_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'logSigmoid');\n\n // Use a custom gradient to maintain previous implementation.\n // There is no LogSigmoid kernel in TF so we can't use engine.runKernel\n // directly\n const customOp = customGrad((x: Tensor) => {\n // TODO(yassogba) we can remove the chained softplus call here only\n // after backends have modualrized softplus at which point we can call\n // engine runKernel(..., Sotfplus, ...) directly.\n const value = neg(softplus(neg(x)));\n\n const gradFunc = (dy: T) => {\n const derX = mul(dy, sigmoid(neg(x)));\n return derX;\n };\n return {value, gradFunc};\n });\n\n return customOp($x) as T;\n}\nexport const logSigmoid = op({logSigmoid_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Sub, SubInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Subtracts two `tf.Tensor`s element-wise, A - B. Supports broadcasting.\n *\n * ```js\n * const a = tf.tensor1d([10, 20, 30, 40]);\n * const b = tf.tensor1d([1, 2, 3, 4]);\n *\n * a.sub(b).print(); // or tf.sub(a, b)\n * ```\n *\n * ```js\n * // Broadcast subtract a with b.\n * const a = tf.tensor1d([10, 20, 30, 40]);\n * const b = tf.scalar(5);\n *\n * a.sub(b).print(); // or tf.sub(a, b)\n * ```\n * @param a The first `tf.Tensor` to subtract from.\n * @param b The second `tf.Tensor` to be subtracted. Must have the same dtype as\n * `a`.\n *\n * @doc {heading: 'Operations', subheading: 'Arithmetic'}\n */\nfunction sub_(a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n let $a = convertToTensor(a, 'a', 'sub');\n let $b = convertToTensor(b, 'b', 'sub');\n [$a, $b] = makeTypesMatch($a, $b);\n\n const inputs: SubInputs = {a: $a, b: $b};\n\n return ENGINE.runKernel(Sub, inputs as {} as NamedTensorMap);\n}\n\nexport const sub = op({sub_});\n","/**\n * @license\n * Copyright 2020 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {customGrad} from '../gradients';\n\nimport {Tensor} from '../tensor';\nimport {GradSaveFunc} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {cast} from './cast';\nimport {exp} from './exp';\nimport {log} from './log';\nimport {max} from './max';\nimport {mul} from './mul';\nimport {op} from './operation';\nimport {sub} from './sub';\nimport {sum} from './sum';\n\n/**\n * Computes the log softmax.\n *\n * ```js\n * const a = tf.tensor1d([1, 2, 3]);\n *\n * a.logSoftmax().print(); // or tf.logSoftmax(a)\n * ```\n *\n * ```js\n * const a = tf.tensor2d([2, 4, 6, 1, 2, 3], [2, 3]);\n *\n * a.logSoftmax().print(); // or tf.logSoftmax(a)\n * ```\n *\n * @param logits The logits array.\n * @param axis The dimension softmax would be performed on. Defaults to `-1`\n * which indicates the last dimension.\n *\n * @doc {heading: 'Operations', subheading: 'Normalization'}\n */\nfunction logSoftmax_(logits: T|TensorLike, axis = -1): T {\n const $logits = convertToTensor(logits, 'logits', 'logSoftmax');\n\n if (axis === -1) {\n axis = $logits.rank - 1;\n }\n if (axis !== $logits.rank - 1) {\n throw Error(\n 'Log Softmax along a non-last dimension is not yet supported. ' +\n `Logits was rank ${$logits.rank} and axis was ${axis}`);\n }\n\n // const forward: ForwardFunc = (backend, save) => {\n // const keepDims = true;\n // const xMax = max(logits, axis, true);\n // const shifted = sub(logits, xMax);\n // const value =\n // sub(cast(shifted, 'float32'), log(sum(exp(shifted), axis,\n // keepDims)));\n // save([value]);\n // return value;\n // };\n\n // Use a custom gradient for numerical stability.\n const customOp = customGrad((logits: Tensor, save: GradSaveFunc) => {\n const keepDims = true;\n const xMax = max(logits, axis, true);\n const shifted = sub(logits, xMax);\n const value =\n sub(cast(shifted, 'float32'), log(sum(exp(shifted), axis, keepDims)));\n save([value]);\n\n const gradFunc = (dy: Tensor, saved: Tensor[]) => {\n const [value] = saved;\n const keepDims = true;\n const softmax = exp(value);\n return sub(dy, mul(sum(dy, axis, keepDims), softmax));\n };\n return {value, gradFunc};\n });\n\n return customOp($logits) as T;\n\n // TODO Use Engine.runKernel when CPU/WebGL/WASM backends implement this.\n // const inputs: LogSoftmaxInputs = {logits: $logits};\n // const attrs: LogSoftmaxAttrs = {axis};\n // return ENGINE.runKernel(\n // LogSoftmax, inputs as {} as NamedTensorMap,\n // attrs as {} as NamedAttrMap);\n}\n\nexport const logSoftmax = op({logSoftmax_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {parseAxisParam} from '../util';\n\nimport {add} from './add';\nimport {expandShapeToKeepDim} from './axis_util';\nimport {exp} from './exp';\nimport {log} from './log';\nimport {max} from './max';\nimport {op} from './operation';\nimport {reshape} from './reshape';\nimport {sub} from './sub';\nimport {sum} from './sum';\n\n/**\n * Computes the log(sum(exp(elements across the reduction dimensions))).\n *\n * Reduces the input along the dimensions given in `axis`. Unless `keepDims`\n * is true, the rank of the array is reduced by 1 for each entry in `axis`.\n * If `keepDims` is true, the reduced dimensions are retained with length 1.\n * If `axis` has no entries, all dimensions are reduced, and an array with a\n * single element is returned.\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 3]);\n *\n * x.logSumExp().print(); // or tf.logSumExp(x)\n * ```\n *\n * ```js\n * const x = tf.tensor2d([1, 2, 3, 4], [2, 2]);\n *\n * const axis = 1;\n * x.logSumExp(axis).print(); // or tf.logSumExp(a, axis)\n * ```\n * @param x The input tensor.\n * @param axis The dimension(s) to reduce. If null (the default),\n * reduces all dimensions.\n * @param keepDims If true, retains reduced dimensions with length\n * of 1. Defaults to false.\n *\n * @doc {heading: 'Operations', subheading: 'Reduction'}\n */\nfunction logSumExp_(\n x: Tensor|TensorLike, axis: number|number[] = null, keepDims = false): T {\n const $x = convertToTensor(x, 'x', 'logSumExp');\n\n const axes = parseAxisParam(axis, $x.shape);\n const xMax = max($x, axes, true /* keepDims */);\n const a = sub($x, xMax);\n const b = exp(a);\n const c = sum(b, axes);\n const d = log(c);\n const res = add(reshape(xMax, d.shape), d);\n\n if (keepDims) {\n const newShape = expandShapeToKeepDim(res.shape, axes);\n return reshape(res, newShape) as T;\n }\n return res as T;\n}\n\nexport const logSumExp = op({logSumExp_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {LogicalAnd, LogicalAndInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {assertAndGetBroadcastShape} from './broadcast_util';\nimport {op} from './operation';\n\n/**\n * Returns the truth value of `a AND b` element-wise. Supports broadcasting.\n *\n * ```js\n * const a = tf.tensor1d([false, false, true, true], 'bool');\n * const b = tf.tensor1d([false, true, false, true], 'bool');\n *\n * a.logicalAnd(b).print();\n * ```\n *\n * @param a The first input tensor. Must be of dtype bool.\n * @param b The second input tensor. Must be of dtype bool.\n *\n * @doc {heading: 'Operations', subheading: 'Logical'}\n */\nfunction logicalAnd_(\n a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n const $a = convertToTensor(a, 'a', 'logicalAnd', 'bool');\n const $b = convertToTensor(b, 'b', 'logicalAnd', 'bool');\n assertAndGetBroadcastShape($a.shape, $b.shape);\n\n const inputs: LogicalAndInputs = {a: $a, b: $b};\n\n return ENGINE.runKernel(LogicalAnd, inputs as {} as NamedTensorMap);\n}\n\nexport const logicalAnd = op({logicalAnd_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {LogicalNot, LogicalNotInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {op} from './operation';\n\n/**\n * Returns the truth value of `NOT x` element-wise.\n *\n * ```js\n * const a = tf.tensor1d([false, true], 'bool');\n *\n * a.logicalNot().print();\n * ```\n *\n * @param x The input tensor. Must be of dtype 'bool'.\n *\n * @doc {heading: 'Operations', subheading: 'Logical'}\n */\nfunction logicalNot_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'logicalNot', 'bool');\n const inputs: LogicalNotInputs = {x: $x};\n return ENGINE.runKernel(LogicalNot, inputs as {} as NamedTensorMap);\n}\n\nexport const logicalNot = op({logicalNot_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {LogicalOr, LogicalOrInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {assertAndGetBroadcastShape} from './broadcast_util';\nimport {op} from './operation';\n\n/**\n * Returns the truth value of `a OR b` element-wise. Supports broadcasting.\n *\n * ```js\n * const a = tf.tensor1d([false, false, true, true], 'bool');\n * const b = tf.tensor1d([false, true, false, true], 'bool');\n *\n * a.logicalOr(b).print();\n * ```\n * @param a The first input tensor. Must be of dtype bool.\n * @param b The second input tensor. Must be of dtype bool.\n *\n * @doc {heading: 'Operations', subheading: 'Logical'}\n */\nfunction logicalOr_(\n a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n const $a = convertToTensor(a, 'a', 'logicalOr', 'bool');\n const $b = convertToTensor(b, 'b', 'logicalOr', 'bool');\n assertAndGetBroadcastShape($a.shape, $b.shape);\n\n const inputs: LogicalOrInputs = {a: $a, b: $b};\n return ENGINE.runKernel(LogicalOr, inputs as {} as NamedTensorMap);\n}\nexport const logicalOr = op({logicalOr_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {assertAndGetBroadcastShape} from './broadcast_util';\nimport {logicalAnd} from './logical_and';\nimport {logicalNot} from './logical_not';\nimport {logicalOr} from './logical_or';\nimport {op} from './operation';\n\n/**\n * Returns the truth value of `a XOR b` element-wise. Supports broadcasting.\n *\n * ```js\n * const a = tf.tensor1d([false, false, true, true], 'bool');\n * const b = tf.tensor1d([false, true, false, true], 'bool');\n *\n * a.logicalXor(b).print();\n * ```\n *\n * @param a The first input tensor. Must be of dtype bool.\n * @param b The second input tensor. Must be of dtype bool.\n *\n * @doc {heading: 'Operations', subheading: 'Logical'}\n */\nfunction logicalXor_(\n a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n const $a = convertToTensor(a, 'a', 'logicalXor', 'bool');\n const $b = convertToTensor(b, 'b', 'logicalXor', 'bool');\n assertAndGetBroadcastShape($a.shape, $b.shape);\n\n // x ^ y = (x | y) & ~(x & y)\n return logicalAnd(logicalOr(a, b), logicalNot(logicalAnd(a, b)));\n}\n\nexport const logicalXor = op({logicalXor_});\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {SearchSorted, SearchSortedAttrs, SearchSortedInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {sizeFromShape} from '../util_base';\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\nconst INT32_MAX = 2147483648;\n/**\n * Searches for where a value would go in a sorted sequence.\n *\n * This is not a method for checking containment (like javascript in).\n *\n * The typical use case for this operation is \"binning\", \"bucketing\", or\n * \"discretizing\". The values are assigned to bucket-indices based on the edges\n * listed in 'sortedSequence'. This operation returns the bucket-index for each\n * value.\n *\n * The side argument controls which index is returned if a value lands exactly\n * on an edge.\n *\n * The axis is not settable for this operation. It always operates on the\n * innermost dimension (axis=-1). The operation will accept any number of outer\n * dimensions.\n *\n * Note: This operation assumes that 'sortedSequence' is sorted along the\n * innermost axis, maybe using 'sort(..., axis=-1)'. If the sequence is not\n * sorted no error is raised and the content of the returned tensor is not well\n * defined.\n *\n * ```js\n * const edges = tf.tensor1d([-1, 3.3, 9.1, 10.0]);\n * let values = tf.tensor1d([0.0, 4.1, 12.0]);\n * const result1 = tf.searchSorted(edges, values, 'left');\n * result1.print(); // [1, 2, 4]\n *\n * const seq = tf.tensor1d([0, 3, 9, 10, 10]);\n * values = tf.tensor1d([0, 4, 10]);\n * const result2 = tf.searchSorted(seq, values, 'left');\n * result2.print(); // [0, 2, 3]\n * const result3 = tf.searchSorted(seq, values, 'right');\n * result3.print(); // [1, 2, 5]\n *\n * const sortedSequence = tf.tensor2d([[0., 3., 8., 9., 10.],\n * [1., 2., 3., 4., 5.]]);\n * values = tf.tensor2d([[9.8, 2.1, 4.3],\n * [0.1, 6.6, 4.5, ]]);\n * const result4 = tf.searchSorted(sortedSequence, values, 'left');\n * result4.print(); // [[4, 1, 2], [0, 5, 4]]\n * ```\n * @param sortedSequence: N-D. Sorted sequence.\n * @param values: N-D. Search values.\n * @param side: 'left'|'right'. Defaults to 'left'. 'left' corresponds to lower\n * bound and 'right' to upper bound.\n * @return An N-D int32 tensor the size of values containing the result of\n * applying either lower bound or upper bound (depending on side) to each\n * value. The result is not a global index to the entire Tensor, but the\n * index in the last dimension.\n * @doc {heading: 'Operations', subheading: 'Evaluation'}\n */\nfunction searchSorted_(\n sortedSequence: Tensor|TensorLike, values: Tensor|TensorLike,\n side: 'left'|'right' = 'left'): Tensor {\n const $sortedSequence =\n convertToTensor(sortedSequence, 'sortedSequence', 'searchSorted');\n const $values = convertToTensor(values, 'values', 'searchSorted');\n\n const sequenceSize = $sortedSequence.shape[$sortedSequence.shape.length - 1];\n const valuesSize = $values.shape[$values.shape.length - 1];\n const $sortedSequence2D = reshape($sortedSequence, [-1, sequenceSize]);\n const $values2D = reshape($values, [-1, valuesSize]);\n\n if ($sortedSequence2D.rank < 2) {\n throw new Error(`Sorted input argument must be at least 2-dimensional`);\n }\n if ($sortedSequence2D.shape[0] !== $values2D.shape[0]) {\n throw new Error(\n `Leading dimension of 'sortedSequence' and 'values' must match.`);\n }\n if (sizeFromShape($values2D.shape) >= INT32_MAX) {\n throw new Error(`values tensor size must less than ${INT32_MAX}`);\n }\n if ($sortedSequence2D.shape[1] >= INT32_MAX) {\n throw new Error(`trailing dim_size must less than ${\n INT32_MAX} for int32 output type, was ${$sortedSequence2D.shape[1]}`);\n }\n\n const inputs: SearchSortedInputs = {\n sortedSequence: $sortedSequence2D,\n values: $values2D,\n };\n const attrs: SearchSortedAttrs = {side};\n\n return ENGINE.runKernel(SearchSorted, inputs as {}, attrs as {});\n}\n\nexport const searchSorted = op({searchSorted_});\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport {TensorLike} from '../types';\nimport {searchSorted} from './search_sorted';\n\n/**\n * Searches for where a value would go in a sorted sequence.\n *\n * This is not a method for checking containment (like javascript in).\n *\n * The typical use case for this operation is \"binning\", \"bucketing\", or\n * \"discretizing\". The values are assigned to bucket-indices based on the edges\n * listed in 'sortedSequence'. This operation returns the bucket-index for each\n * value.\n *\n * The index returned corresponds to the first edge greater than or equal to the\n * value.\n *\n * The axis is not settable for this operation. It always operates on the\n * innermost dimension (axis=-1). The operation will accept any number of outer\n * dimensions.\n *\n * Note: This operation assumes that 'lowerBound' is sorted along the\n * innermost axis, maybe using 'sort(..., axis=-1)'. If the sequence is not\n * sorted no error is raised and the content of the returned tensor is not well\n * defined.\n *\n * ```js\n * const edges = tf.tensor1d([-1, 3.3, 9.1, 10.0]);\n * let values = tf.tensor1d([0.0, 4.1, 12.0]);\n * const result1 = tf.lowerBound(edges, values);\n * result1.print(); // [1, 2, 4]\n *\n * const seq = tf.tensor1d([0, 3, 9, 10, 10]);\n * values = tf.tensor1d([0, 4, 10]);\n * const result2 = tf.lowerBound(seq, values);\n * result2.print(); // [0, 2, 3]\n *\n * const sortedSequence = tf.tensor2d([[0., 3., 8., 9., 10.],\n * [1., 2., 3., 4., 5.]]);\n * values = tf.tensor2d([[9.8, 2.1, 4.3],\n * [0.1, 6.6, 4.5, ]]);\n * const result3 = tf.lowerBound(sortedSequence, values);\n * result3.print(); // [[4, 1, 2], [0, 5, 4]]\n * ```\n * @param sortedSequence: N-D. Sorted sequence.\n * @param values: N-D. Search values.\n * @return An N-D int32 tensor the size of values containing the result of\n * applying lower bound to each value. The result is not a global index to\n * the entire Tensor, but the index in the last dimension.\n * @doc {heading: 'Operations', subheading: 'Evaluation'}\n */\nexport function lowerBound(\n sortedSequence: Tensor|TensorLike, values: Tensor|TensorLike): Tensor {\n return searchSorted(sortedSequence, values, 'left');\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {MaxPool, MaxPoolAttrs, MaxPoolInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor3D, Tensor4D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport * as conv_util from './conv_util';\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * Computes the 2D max pooling of an image.\n *\n * @param x The input tensor, of rank 4 or rank 3 of shape\n * `[batch, height, width, inChannels]`. If rank 3, batch of 1 is assumed.\n * @param filterSize The filter size: `[filterHeight, filterWidth]`. If\n * `filterSize` is a single number, then `filterHeight == filterWidth`.\n * @param strides The strides of the pooling: `[strideHeight, strideWidth]`. If\n * `strides` is a single number, then `strideHeight == strideWidth`.\n * @param dilations The dilation rates: `[dilationHeight, dilationWidth]`\n * in which we sample input values across the height and width dimensions\n * in dilated pooling. Defaults to `[1, 1]`. If `dilations` is a single\n * number, then `dilationHeight == dilationWidth`. If it is greater than\n * 1, then all values of `strides` must be 1.\n * @param pad The type of padding algorithm.\n * - `same` and stride 1: output will be of same size as input,\n * regardless of filter size.\n * - `valid`: output will be smaller than input if filter is larger\n * than 1x1.\n * - For more info, see this guide:\n * [https://www.tensorflow.org/api_docs/python/tf/nn/convolution](\n * https://www.tensorflow.org/api_docs/python/tf/nn/convolution)\n * @param dimRoundingMode A string from: 'ceil', 'round', 'floor'. If none is\n * provided, it will default to truncate.\n */\nfunction maxPool_(\n x: T|TensorLike, filterSize: [number, number]|number,\n strides: [number, number]|number,\n pad: 'valid'|'same'|number|conv_util.ExplicitPadding,\n dimRoundingMode?: 'floor'|'round'|'ceil'): T {\n const $x = convertToTensor(x, 'x', 'maxPool');\n const dilations = 1;\n\n let x4D = $x as Tensor4D;\n let reshapedTo4D = false;\n if ($x.rank === 3) {\n reshapedTo4D = true;\n x4D = reshape($x, [1, $x.shape[0], $x.shape[1], $x.shape[2]]);\n }\n\n util.assert(\n x4D.rank === 4,\n () => `Error in maxPool: input must be rank 4 but got rank ${x4D.rank}.`);\n util.assert(\n conv_util.eitherStridesOrDilationsAreOne(strides, dilations),\n () => 'Error in maxPool: Either strides or dilations must be 1. ' +\n `Got strides ${strides} and dilations '${dilations}'`);\n conv_util.checkPadOnDimRoundingMode('maxPool', pad, dimRoundingMode);\n const inputs: MaxPoolInputs = {x: x4D};\n const attrs: MaxPoolAttrs = {filterSize, strides, pad, dimRoundingMode};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n const res = ENGINE.runKernel(\n MaxPool, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as T;\n\n if (reshapedTo4D) {\n return reshape(res, [res.shape[1], res.shape[2], res.shape[3]]) as T;\n }\n return res;\n}\n\nexport const maxPool = op({maxPool_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {MaxPool3D, MaxPool3DAttrs, MaxPool3DInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor4D, Tensor5D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {checkPadOnDimRoundingMode} from './conv_util';\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * Computes the 3D max pooling.\n *\n * ```js\n * const x = tf.tensor5d([1, 2, 3, 4, 5, 6, 7, 8], [1, 2, 2, 2, 1]);\n * const result = tf.maxPool3d(x, 2, 1, 'valid');\n * result.print();\n * ```\n *\n * @param x The input tensor, of rank 5 or rank 4 of shape\n * `[batch, depth, height, width, inChannels]`.\n * @param filterSize The filter size:\n * `[filterDepth, filterHeight, filterWidth]`.\n * If `filterSize` is a single number,\n * then `filterDepth == filterHeight == filterWidth`.\n * @param strides The strides of the pooling:\n * `[strideDepth, strideHeight, strideWidth]`.\n * If `strides` is a single number,\n * then `strideDepth == strideHeight == strideWidth`.\n * @param pad The type of padding algorithm.\n * - `same` and stride 1: output will be of same size as input,\n * regardless of filter size.\n * - `valid`: output will be smaller than input if filter is larger\n * than 1*1x1.\n * - For more info, see this guide:\n * [https://www.tensorflow.org/api_docs/python/tf/nn/convolution](\n * https://www.tensorflow.org/api_docs/python/tf/nn/convolution)\n * @param dimRoundingMode A string from: 'ceil', 'round', 'floor'. If none is\n * provided, it will default to truncate.\n * @param dataFormat An optional string from: \"NDHWC\", \"NCDHW\". Defaults to\n * \"NDHWC\". Specify the data format of the input and output data. With the\n * default format \"NDHWC\", the data is stored in the order of: [batch,\n * depth, height, width, channels]. Only \"NDHWC\" is currently supported.\n * @doc {heading: 'Operations', subheading: 'Convolution'}\n */\nfunction maxPool3d_(\n x: T|TensorLike, filterSize: [number, number, number]|number = [1, 1, 1],\n strides: [number, number, number]|number, pad: 'valid'|'same'|number,\n dimRoundingMode?: 'floor'|'round'|'ceil',\n dataFormat: 'NDHWC'|'NCDHW' = 'NDHWC'): T {\n const $x = convertToTensor(x, 'x', 'maxPool3d');\n\n let x5D = $x as Tensor5D;\n let reshapedTo5D = false;\n if ($x.rank === 4) {\n reshapedTo5D = true;\n x5D = reshape($x, [1, $x.shape[0], $x.shape[1], $x.shape[2], $x.shape[3]]);\n }\n\n util.assert(\n x5D.rank === 5,\n () => `Error in maxPool3d: x must be rank 5 but got rank ${x5D.rank}.`);\n util.assert(\n dataFormat === 'NDHWC',\n () => `Error in maxPool3d: Only NDHWC is currently supported, ` +\n `but got dataFormat of ${dataFormat}`);\n checkPadOnDimRoundingMode('maxPool3d', pad, dimRoundingMode);\n const inputs: MaxPool3DInputs = {x: x5D};\n const attrs:\n MaxPool3DAttrs = {filterSize, strides, pad, dimRoundingMode, dataFormat};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n const res = ENGINE.runKernel(\n MaxPool3D, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as T;\n\n if (reshapedTo5D) {\n return reshape(\n res, [res.shape[1], res.shape[2], res.shape[3], res.shape[4]]) as\n T;\n }\n\n return res;\n}\n\nexport const maxPool3d = op({maxPool3d_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {MaxPoolWithArgmax, MaxPoolWithArgmaxAttrs, MaxPoolWithArgmaxInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor, Tensor4D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes the 2D max pooling of an image with Argmax index.\n * The indices in argmax are flattened, so that a maximum value at position `[b,\n * y, x, c]` becomes flattened index: `(y * width + x) * channels + c` if\n * include_batch_in_index is False; `((b * height + y) * width + x) * channels\n * +c` if include_batch_in_index is True.\n *\n * The indices returned are always in `[0, height) x [0, width)` before\n * flattening.\n *\n * @param x The input tensor, of rank 4 or rank 3 of shape\n * `[batch, height, width, inChannels]`. If rank 3, batch of 1 is assumed.\n * @param filterSize The filter size: `[filterHeight, filterWidth]`. If\n * `filterSize` is a single number, then `filterHeight == filterWidth`.\n * @param strides The strides of the pooling: `[strideHeight, strideWidth]`. If\n * `strides` is a single number, then `strideHeight == strideWidth`.\n * @param dataFormat An optional string from: \"NDHWC\", \"NCDHW\". Defaults to\n * \"NDHWC\". Specify the data format of the input and output data. With the\n * default format \"NDHWC\", the data is stored in the order of: [batch,\n * depth, height, width, channels]. Only \"NDHWC\" is currently supported.\n * @param pad The type of padding algorithm.\n * - `same` and stride 1: output will be of same size as input,\n * regardless of filter size.\n * - `valid`: output will be smaller than input if filter is larger\n * than 1x1.\n * - For more info, see this guide:\n * [https://www.tensorflow.org/api_docs/python/tf/nn/convolution](\n * https://www.tensorflow.org/api_docs/python/tf/nn/convolution)\n * @param includeBatchIndex Defaults to False. Whether to include batch\n * dimension in flattened index of argmax.\n *\n * @doc {heading: 'Operations', subheading: 'Convolution'}\n */\nfunction maxPoolWithArgmax_(\n x: T|TensorLike, filterSize: [number, number]|number,\n strides: [number, number]|number, pad: 'valid'|'same'|number,\n includeBatchInIndex = false): NamedTensorMap {\n const $x = convertToTensor(x, 'x', 'maxPoolWithArgmax');\n\n const inputs: MaxPoolWithArgmaxInputs = {x: $x};\n const attrs:\n MaxPoolWithArgmaxAttrs = {filterSize, strides, pad, includeBatchInIndex};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n const result = ENGINE.runKernel(\n MaxPoolWithArgmax, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as Tensor[];\n\n return {result: result[0], indexes: result[1]};\n}\n\nexport const maxPoolWithArgmax = op({maxPoolWithArgmax_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Maximum, MaximumInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {assertAndGetBroadcastShape} from './broadcast_util';\nimport {cast} from './cast';\nimport {op} from './operation';\n\n/**\n * Returns the max of a and b (`a > b ? a : b`) element-wise.\n * Supports broadcasting.\n *\n * We also expose `tf.maximumStrict` which has the same signature as this op and\n * asserts that `a` and `b` are the same shape (does not broadcast).\n *\n * ```js\n * const a = tf.tensor1d([1, 4, 3, 16]);\n * const b = tf.tensor1d([1, 2, 9, 4]);\n *\n * a.maximum(b).print(); // or tf.maximum(a, b)\n * ```\n *\n * ```js\n * // Broadcast maximum a with b.\n * const a = tf.tensor1d([2, 4, 6, 8]);\n * const b = tf.scalar(5);\n *\n * a.maximum(b).print(); // or tf.maximum(a, b)\n * ```\n *\n * @param a The first tensor.\n * @param b The second tensor. Must have the same type as `a`.\n *\n * @doc {heading: 'Operations', subheading: 'Arithmetic'}\n */\nfunction maximum_(\n a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n let $a = convertToTensor(a, 'a', 'maximum');\n let $b = convertToTensor(b, 'b', 'maximum');\n [$a, $b] = makeTypesMatch($a, $b);\n\n if ($a.dtype === 'bool') {\n $a = cast($a, 'int32');\n $b = cast($b, 'int32');\n }\n assertAndGetBroadcastShape($a.shape, $b.shape);\n\n const inputs: MaximumInputs = {a: $a, b: $b};\n\n return ENGINE.runKernel(Maximum, inputs as {} as NamedTensorMap);\n}\n\nexport const maximum = op({maximum_});\n","/**\n * @license\n * Copyright 2020 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Mean, MeanAttrs, MeanInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes the mean of elements across dimensions of a `tf.Tensor`.\n *\n * Reduces `x` along the dimensions given in `axis`. Unless `keepDims` is\n * true, the rank of the `tf.Tensor` is reduced by 1 for each entry in `axis`.\n * If `keepDims` is true, the reduced dimensions are retained with length 1.\n * If `axis` has no entries, all dimensions are reduced, and a `tf.Tensor` with\n * a single element is returned.\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 3]);\n *\n * x.mean().print(); // or tf.mean(a)\n * ```\n *\n * ```js\n * const x = tf.tensor2d([1, 2, 3, 4], [2, 2]);\n *\n * const axis = 1;\n * x.mean(axis).print(); // or tf.mean(x, axis)\n * ```\n *\n * @param x The input tensor.\n * @param axis The dimension(s) to reduce. By default it reduces\n * all dimensions.\n * @param keepDims If true, retains reduced dimensions with size 1.\n *\n * @doc {heading: 'Operations', subheading: 'Reduction'}\n */\nfunction mean_(\n x: Tensor|TensorLike, axis: number|number[] = null, keepDims = false): T {\n const $x = convertToTensor(x, 'x', 'mean');\n\n const inputs: MeanInputs = {x: $x};\n const attrs: MeanAttrs = {axis, keepDims};\n\n return ENGINE.runKernel(\n Mean, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const mean = op({mean_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Tensor} from '../tensor';\nimport {DataType, Rank, ShapeMap} from '../types';\nimport {makeZerosTypedArray, sizeFromShape} from '../util';\n\nimport {complex} from './complex';\n\n/**\n * Creates a `tf.Tensor` with all elements set to 0.\n *\n * ```js\n * tf.zeros([2, 2]).print();\n * ```\n *\n * @param shape An array of integers defining the output tensor shape.\n * @param dtype The type of an element in the resulting tensor. Can\n * be 'float32', 'int32' or 'bool'. Defaults to 'float'.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nexport function zeros(\n shape: ShapeMap[R], dtype: DataType = 'float32'): Tensor {\n if (dtype === 'complex64') {\n const real = zeros(shape, 'float32');\n const imag = zeros(shape, 'float32');\n return complex(real, imag);\n }\n const values = makeZerosTypedArray(sizeFromShape(shape), dtype);\n return ENGINE.makeTensor(values, shape, dtype) as Tensor;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Tensor} from '../tensor';\nimport {DataType, Rank, ShapeMap} from '../types';\nimport {makeOnesTypedArray, sizeFromShape} from '../util';\n\nimport {complex} from './complex';\nimport {zeros} from './zeros';\n\n/**\n * Creates a `tf.Tensor` with all elements set to 1.\n *\n * ```js\n * tf.ones([2, 2]).print();\n * ```\n *\n * @param shape An array of integers defining the output tensor shape.\n * @param dtype The type of an element in the resulting tensor. Defaults to\n * 'float'.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nexport function ones(\n shape: ShapeMap[R], dtype: DataType = 'float32'): Tensor {\n if (dtype === 'complex64') {\n const real = ones(shape, 'float32');\n const imag = zeros(shape, 'float32');\n return complex(real, imag);\n }\n const values = makeOnesTypedArray(sizeFromShape(shape), dtype);\n return ENGINE.makeTensor(values, shape, dtype) as Tensor;\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {matMul} from './mat_mul';\nimport {ones} from './ones';\nimport {reshape} from './reshape';\nimport {Tensor} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {sizeFromShape} from '../util_base';\n\n/**\n * Broadcasts parameters for evaluation on an N-D grid.\n *\n * Given N one-dimensional coordinate arrays `*args`, returns a list `outputs`\n * of N-D coordinate arrays for evaluating expressions on an N-D grid.\n *\n * Notes:\n * `meshgrid` supports cartesian ('xy') and matrix ('ij') indexing conventions.\n * When the `indexing` argument is set to 'xy' (the default), the broadcasting\n * instructions for the first two dimensions are swapped.\n * Examples:\n * Calling `const [X, Y] = meshgrid(x, y)` with the tensors\n *\n * ```javascript\n * const x = [1, 2, 3];\n * const y = [4, 5, 6];\n * const [X, Y] = tf.meshgrid(x, y);\n * // X = [[1, 2, 3],\n * // [1, 2, 3],\n * // [1, 2, 3]]\n * // Y = [[4, 4, 4],\n * // [5, 5, 5],\n * // [6, 6, 6]]\n * ```\n *\n * @param x Tensor with rank geq 1.\n * @param y Tensor with rank geq 1.\n * @param indexing\n *\n * @doc {heading: 'Operations', subheading: 'Slicing and Joining'}\n */\nexport function meshgrid(\n x?: T|TensorLike, y?: T|TensorLike, {indexing = 'xy'} = {}): T[] {\n if (indexing !== 'xy' && indexing !== 'ij') {\n throw new TypeError(\n `${indexing} is not a valid third argument to meshgrid`);\n }\n if (x === undefined) {\n return [];\n }\n let $x = convertToTensor(\n x, 'x', 'meshgrid', x instanceof Tensor ? x.dtype : 'float32');\n\n if (y === undefined) {\n return [$x];\n }\n let $y = convertToTensor(\n y, 'y', 'meshgrid', y instanceof Tensor ? y.dtype : 'float32');\n\n const w = sizeFromShape($x.shape);\n const h = sizeFromShape($y.shape);\n\n if (indexing === 'xy') {\n $x = reshape($x, [1, -1]) as T;\n $y = reshape($y, [-1, 1]) as T;\n return [\n matMul(ones([h, 1], $x.dtype), $x),\n matMul($y, ones([1, w], $y.dtype)),\n ];\n }\n\n $x = reshape($x, [-1, 1]) as T;\n $y = reshape($y, [1, -1]) as T;\n return [\n matMul($x, ones([1, h], $x.dtype)),\n matMul(ones([w, 1], $y.dtype), $y),\n ];\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Minimum, MinimumInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {assertAndGetBroadcastShape} from './broadcast_util';\nimport {cast} from './cast';\nimport {op} from './operation';\n\n/**\n * Returns the min of a and b (`a < b ? a : b`) element-wise.\n * Supports broadcasting.\n *\n * We also expose `minimumStrict` which has the same signature as this op and\n * asserts that `a` and `b` are the same shape (does not broadcast).\n *\n * ```js\n * const a = tf.tensor1d([1, 4, 3, 16]);\n * const b = tf.tensor1d([1, 2, 9, 4]);\n *\n * a.minimum(b).print(); // or tf.minimum(a, b)\n * ```\n *\n * ```js\n * // Broadcast minimum a with b.\n * const a = tf.tensor1d([2, 4, 6, 8]);\n * const b = tf.scalar(5);\n *\n * a.minimum(b).print(); // or tf.minimum(a, b)\n * ```\n *\n * @param a The first tensor.\n * @param b The second tensor. Must have the same type as `a`.\n *\n * @doc {heading: 'Operations', subheading: 'Arithmetic'}\n */\nfunction minimum_(\n a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n let $a = convertToTensor(a, 'a', 'minimum');\n let $b = convertToTensor(b, 'b', 'minimum');\n [$a, $b] = makeTypesMatch($a, $b);\n\n if ($a.dtype === 'bool') {\n $a = cast($a, 'int32');\n $b = cast($b, 'int32');\n }\n\n assertAndGetBroadcastShape($a.shape, $b.shape);\n\n const inputs: MinimumInputs = {a: $a, b: $b};\n\n return ENGINE.runKernel(Minimum, inputs as {} as NamedTensorMap);\n}\n\nexport const minimum = op({minimum_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {MirrorPad, MirrorPadAttrs, MirrorPadInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\n\n/**\n * Pads a `tf.Tensor` using mirror padding.\n *\n * This operation implements the `REFLECT` and `SYMMETRIC` modes of pad.\n *\n * ```js\n * const x = tf.range(0, 9).reshape([1, 1, 3, 3]);\n * x.mirrorPad([[0, 0], [0, 0], [2, 2], [2, 2]], 'reflect').print();\n * ```\n * @param x The tensor to pad.\n * @param paddings An array of length `R` (the rank of the tensor), where\n * each element is a length-2 tuple of ints `[padBefore, padAfter]`,\n * specifying how much to pad along each dimension of the tensor.\n * In \"reflect\" mode, the padded regions do not include the borders,\n * while in \"symmetric\" mode the padded regions do include the borders.\n * For example, if the input is `[1, 2, 3]` and paddings is `[0, 2]`,\n * then the output is `[1, 2, 3, 2, 1]` in \"reflect\" mode, and\n * `[1, 2, 3, 3, 2]` in \"symmetric\" mode.\n * If `mode` is \"reflect\" then both `paddings[D, 0]` and `paddings[D, 1]`\n * must be no greater than `x.shape[D] - 1`. If mode is \"symmetric\"\n * then both `paddings[D, 0]` and `paddings[D, 1]` must be no greater than\n * `x.shape[D]`\n * @param mode String to specify padding mode. Can be `'reflect' | 'symmetric'`\n */\n/** @doc {heading: 'Tensors', subheading: 'Transformations'} */\nfunction mirrorPad_(\n x: T|TensorLike, paddings: Array<[number, number]>,\n mode: 'reflect'|'symmetric'): T {\n util.assert(\n mode === 'reflect' || mode === 'symmetric',\n () => `Invalid mode. Mode must be either reflect or symmetric. ` +\n `Got ${mode}.`);\n\n const $x = convertToTensor(x, 'x', 'mirrorPad');\n if ($x.rank === 0) {\n throw new Error(\n 'mirrorPad(scalar) is not defined. ' +\n 'Pass non-scalar to mirrorPad');\n }\n util.assert(\n paddings.length === $x.rank,\n () => `Padding doesn't match input. Must be ${$x.rank}. ` +\n `Got ${paddings.length}.`);\n const shapeOffset = mode === 'reflect' ? 1 : 0;\n for (let i = 0; i < $x.rank; i++) {\n util.assert(\n paddings[i].length === 2,\n () => `Invalid number of paddings. Must be length of 2 each.`);\n util.assert(\n paddings[i][0] >= 0 && paddings[i][0] <= $x.shape[i] - shapeOffset &&\n paddings[i][1] >= 0 && paddings[i][1] <= $x.shape[i] - shapeOffset,\n () => `Padding in dimension ${i} cannot be greater than or equal ` +\n `to ${$x.shape[i] - shapeOffset} or less than 0 for input of ` +\n `shape ${$x.shape}`);\n }\n\n const attrs: MirrorPadAttrs = {paddings, mode};\n const inputs: MirrorPadInputs = {x: $x};\n return ENGINE.runKernel(\n MirrorPad, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const mirrorPad = op({mirrorPad_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Mod, ModInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Returns the mod of a and b element-wise.\n * `floor(x / y) * y + mod(x, y) = x`\n * Supports broadcasting.\n *\n * We also expose `tf.modStrict` which has the same signature as this op and\n * asserts that `a` and `b` are the same shape (does not broadcast).\n *\n * ```js\n * const a = tf.tensor1d([1, 4, 3, 16]);\n * const b = tf.tensor1d([1, 2, 9, 4]);\n *\n * a.mod(b).print(); // or tf.mod(a, b)\n * ```\n *\n * ```js\n * // Broadcast a mod b.\n * const a = tf.tensor1d([2, 4, 6, 8]);\n * const b = tf.scalar(5);\n *\n * a.mod(b).print(); // or tf.mod(a, b)\n * ```\n *\n * @param a The first tensor.\n * @param b The second tensor. Must have the same type as `a`.\n *\n * @doc {heading: 'Operations', subheading: 'Arithmetic'}\n */\nfunction mod_(a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n let $a = convertToTensor(a, 'a', 'mod');\n let $b = convertToTensor(b, 'b', 'mod');\n [$a, $b] = makeTypesMatch($a, $b);\n\n const inputs: ModInputs = {a: $a, b: $b};\n\n return ENGINE.runKernel(Mod, inputs as {} as NamedTensorMap);\n}\n\nexport const mod = op({mod_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {parseAxisParam} from '../util';\n\nimport {expandShapeToKeepDim} from './axis_util';\nimport {cast} from './cast';\nimport {mean} from './mean';\nimport {op} from './operation';\nimport {reshape} from './reshape';\nimport {square} from './square';\nimport {sub} from './sub';\n\n/**\n * Calculates the mean and variance of `x`. The mean and variance are\n * calculated by aggregating the contents of `x` across `axes`. If `x` is\n * 1-D and `axes = [0]` this is just the mean and variance of a vector.\n *\n * @param x The input tensor.\n * @param axis The dimension(s) along with to compute mean and\n * variance. By default it reduces all dimensions.\n * @param keepDims If true, the moments have the same dimensionality as the\n * input.\n * @return An object with two keys: `mean` and `variance`.\n *\n * @doc {heading: 'Operations', subheading: 'Normalization'}\n */\nfunction moments_(\n x: Tensor|TensorLike, axis: number|number[] = null,\n keepDims = false): {mean: Tensor, variance: Tensor} {\n x = convertToTensor(x, 'x', 'moments');\n const axes = parseAxisParam(axis, x.shape);\n const xMean = mean(x, axes, keepDims);\n let keepDimsShape = xMean.shape;\n if (!keepDims) {\n keepDimsShape = expandShapeToKeepDim(xMean.shape, axes);\n }\n const devSquared =\n square(sub(cast(x, 'float32'), reshape(xMean, keepDimsShape)));\n const variance = mean(devSquared, axes, keepDims);\n return {mean: xMean, variance};\n}\n\nexport const moments = op({moments_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor2D} from '../tensor';\nimport {convertToTensor, convertToTensorArray} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {op} from './operation';\n\n/**\n * @docalias (data: Tensor2D, c: Tensor2D, h: Tensor2D): [Tensor2D, Tensor2D]\n */\nexport type LSTMCellFunc = {\n (data: Tensor2D, c: Tensor2D, h: Tensor2D): [Tensor2D, Tensor2D];\n};\n\n/**\n * Computes the next states and outputs of a stack of LSTMCells.\n *\n * Each cell output is used as input to the next cell.\n *\n * Returns `[cellState, cellOutput]`.\n *\n * Derived from tf.contrib.rn.MultiRNNCell.\n *\n * @param lstmCells Array of LSTMCell functions.\n * @param data The input to the cell.\n * @param c Array of previous cell states.\n * @param h Array of previous cell outputs.\n *\n * @doc {heading: 'Operations', subheading: 'RNN'}\n */\nfunction multiRNNCell_(\n lstmCells: LSTMCellFunc[], data: Tensor2D|TensorLike,\n c: Array,\n h: Array): [Tensor2D[], Tensor2D[]] {\n const $data = convertToTensor(data, 'data', 'multiRNNCell');\n const $c = convertToTensorArray(c, 'c', 'multiRNNCell');\n const $h = convertToTensorArray(h, 'h', 'multiRNNCell');\n\n let input = $data;\n const newStates = [];\n for (let i = 0; i < lstmCells.length; i++) {\n const output = lstmCells[i](input, $c[i], $h[i]);\n newStates.push(output[0]);\n newStates.push(output[1]);\n input = output[1];\n }\n const newC: Tensor2D[] = [];\n const newH: Tensor2D[] = [];\n for (let i = 0; i < newStates.length; i += 2) {\n newC.push(newStates[i]);\n newH.push(newStates[i + 1]);\n }\n return [newC, newH];\n}\nexport const multiRNNCell = op({multiRNNCell_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Multinomial, MultinomialAttrs, MultinomialInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor1D, Tensor2D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * Creates a `tf.Tensor` with values drawn from a multinomial distribution.\n *\n * ```js\n * const probs = tf.tensor([.75, .25]);\n * tf.multinomial(probs, 3).print();\n * ```\n *\n * @param logits 1D array with unnormalized log-probabilities, or\n * 2D array of shape `[batchSize, numOutcomes]`. See the `normalized`\n * parameter.\n * @param numSamples Number of samples to draw for each row slice.\n * @param seed The seed number.\n * @param normalized Whether the provided `logits` are normalized true\n * probabilities (sum to 1). Defaults to false.\n * @return 1D array of shape `[numSamples]`, or 2D array of shape\n * `[batchSize, numSamples]`, depending on the rank of the input.\n *\n * @doc {heading: 'Tensors', subheading: 'Random'}\n */\nfunction multinomial_(\n logits: Tensor1D|Tensor2D|TensorLike, numSamples: number, seed?: number,\n normalized = false): Tensor1D|Tensor2D {\n const $logits = convertToTensor(logits, 'logits', 'multinomial');\n const numOutcomes = $logits.size;\n const origRank = $logits.rank;\n if (numOutcomes < 2) {\n throw new Error(\n `Error in multinomial: you need at least 2 outcomes, but got ` +\n `${numOutcomes}.`);\n }\n if (origRank > 2) {\n throw new Error(`Rank of probabilities must be 1 or 2, but is ${origRank}`);\n }\n // TODO(lina128): Investigate correct seed behavior. The code seems not allow\n // setting see to 0.\n seed = seed || Math.random();\n\n // The kernel only accepts (and returns) rank 2 tensors.\n const logits2D: Tensor2D =\n origRank === 1 ? reshape($logits, [1, -1]) : $logits as Tensor2D;\n\n const inputs: MultinomialInputs = {logits: logits2D};\n const attrs: MultinomialAttrs = {numSamples, seed, normalized};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n const res = ENGINE.runKernel(\n Multinomial, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as Tensor2D;\n\n // tslint:disable-next-line:no-unnecessary-type-assertion\n return origRank === 1 ? reshape(res, [res.size]) as Tensor1D : res;\n}\n\nexport const multinomial = op({multinomial_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {NotEqual, NotEqualInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {assertAndGetBroadcastShape} from './broadcast_util';\nimport {op} from './operation';\n\n/**\n * Returns the truth value of (a != b) element-wise. Supports broadcasting.\n *\n * ```js\n * const a = tf.tensor1d([1, 2, 3]);\n * const b = tf.tensor1d([0, 2, 3]);\n *\n * a.notEqual(b).print();\n * ```\n * @param a The first input tensor.\n * @param b The second input tensor. Must have the same dtype as `a`.\n *\n * @doc {heading: 'Operations', subheading: 'Logical'}\n */\nfunction notEqual_(\n a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n let $a = convertToTensor(a, 'a', 'notEqual', 'string_or_numeric');\n let $b = convertToTensor(b, 'b', 'notEqual', 'string_or_numeric');\n [$a, $b] = makeTypesMatch($a, $b);\n\n assertAndGetBroadcastShape($a.shape, $b.shape);\n\n const inputs: NotEqualInputs = {a: $a, b: $b};\n\n return ENGINE.runKernel(NotEqual, inputs as {} as NamedTensorMap);\n}\n\nexport const notEqual = op({notEqual_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {OnesLike, OnesLikeInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Creates a `tf.Tensor` with all elements set to 1 with the same shape as the\n * given tensor.\n *\n * ```js\n * const x = tf.tensor([1, 2]);\n * tf.onesLike(x).print();\n * ```\n * @param x A tensor.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nfunction onesLike_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'onesLike');\n\n const inputs: OnesLikeInputs = {x: $x};\n return ENGINE.runKernel(OnesLike, inputs as {} as NamedTensorMap);\n}\n\nexport const onesLike = op({onesLike_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor1D, Tensor2D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {matMul} from './mat_mul';\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * Computes the outer product of two vectors, `v1` and `v2`.\n *\n * ```js\n * const a = tf.tensor1d([1, 2, 3]);\n * const b = tf.tensor1d([3, 4, 5]);\n *\n * tf.outerProduct(a, b).print();\n * ```\n * @param v1 The first vector in the outer product operation.\n * @param v2 The second vector in the outer product operation.\n *\n * @doc {heading: 'Operations', subheading: 'Matrices'}\n */\nfunction outerProduct_(\n v1: Tensor1D|TensorLike, v2: Tensor1D|TensorLike): Tensor2D {\n const $v1 = convertToTensor(v1, 'v1', 'outerProduct');\n const $v2 = convertToTensor(v2, 'v2', 'outerProduct');\n\n util.assert(\n $v1.rank === 1 && $v2.rank === 1,\n () => `Error in outerProduct: inputs must be rank 1, but got ranks ` +\n `${$v1.rank} and ${$v2.rank}.`);\n\n const v12D = reshape($v1, [-1, 1]);\n const v22D = reshape($v2, [1, -1]);\n return matMul(v12D, v22D);\n}\n\nexport const outerProduct = op({outerProduct_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {PadV2, PadV2Attrs, PadV2Inputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Pads a `tf.Tensor` with a given value and paddings.\n *\n * This operation implements `CONSTANT` mode. For `REFLECT` and `SYMMETRIC`,\n * refer to `tf.mirrorPad`.\n *\n * Also available are stricter rank-specific methods with the same signature\n * as this method that assert that `paddings` is of given length.\n * - `tf.pad1d`\n * - `tf.pad2d`\n * - `tf.pad3d`\n * - `tf.pad4d`\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 3, 4]);\n * x.pad([[1, 2]]).print();\n * ```\n * @param x The tensor to pad.\n * @param paddings An array of length `R` (the rank of the tensor), where\n * each element is a length-2 tuple of ints `[padBefore, padAfter]`,\n * specifying how much to pad along each dimension of the tensor.\n * @param constantValue The pad value to use. Defaults to 0.\n *\n * @doc {heading: 'Tensors', subheading: 'Transformations'}\n */\nfunction pad_(\n x: T|TensorLike, paddings: Array<[number, number]>, constantValue = 0): T {\n const $x = convertToTensor(x, 'x', 'pad');\n if ($x.rank === 0) {\n throw new Error('pad(scalar) is not defined. Pass non-scalar to pad');\n }\n\n const attrs: PadV2Attrs = {paddings, constantValue};\n const inputs: PadV2Inputs = {x: $x};\n return ENGINE.runKernel(\n PadV2, inputs as unknown as NamedTensorMap,\n attrs as unknown as NamedAttrMap);\n}\n\nexport const pad = op({pad_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor1D} from '../tensor';\nimport {TensorLike} from '../types';\nimport {assert} from '../util';\nimport {op} from './operation';\nimport {pad} from './pad';\n\n/**\n * Pads a `tf.Tensor1D` with a given value and paddings. See `pad` for details.\n */\nfunction pad1d_(\n x: Tensor1D|TensorLike, paddings: [number, number],\n constantValue = 0): Tensor1D {\n assert(\n paddings.length === 2,\n () => 'Invalid number of paddings. Must be length of 2.');\n return pad(x, [paddings], constantValue);\n}\n\nexport const pad1d = op({pad1d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor2D} from '../tensor';\nimport {TensorLike} from '../types';\nimport {assert} from '../util';\nimport {op} from './operation';\nimport {pad} from './pad';\n\n/**\n * Pads a `tf.Tensor2D` with a given value and paddings. See `pad` for details.\n */\nfunction pad2d_(\n x: Tensor2D|TensorLike, paddings: [[number, number], [number, number]],\n constantValue = 0): Tensor2D {\n assert(\n paddings.length === 2 && paddings[0].length === 2 &&\n paddings[1].length === 2,\n () => 'Invalid number of paddings. Must be length of 2 each.');\n return pad(x, paddings, constantValue);\n}\n\nexport const pad2d = op({pad2d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor3D} from '../tensor';\nimport {TensorLike} from '../types';\nimport {assert} from '../util';\nimport {op} from './operation';\nimport {pad} from './pad';\n\n/**\n * Pads a `tf.Tensor3D` with a given value and paddings. See `pad` for details.\n */\nfunction pad3d_(\n x: Tensor3D|TensorLike,\n paddings: [[number, number], [number, number], [number, number]],\n constantValue = 0): Tensor3D {\n assert(\n paddings.length === 3 && paddings[0].length === 2 &&\n paddings[1].length === 2 && paddings[2].length === 2,\n () => 'Invalid number of paddings. Must be length of 2 each.');\n return pad(x, paddings, constantValue);\n}\n\nexport const pad3d = op({pad3d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor4D} from '../tensor';\nimport {TensorLike} from '../types';\nimport {assert} from '../util';\nimport {op} from './operation';\nimport {pad} from './pad';\n\n/**\n * Pads a `tf.Tensor4D` with a given value and paddings. See `pad` for details.\n */\nfunction pad4d_(\n x: Tensor4D|TensorLike,\n paddings:\n [\n [number, number], [number, number], [number, number], [number, number]\n ],\n constantValue = 0): Tensor4D {\n assert(\n paddings.length === 4 && paddings[0].length === 2 &&\n paddings[1].length === 2 && paddings[2].length === 2 &&\n paddings[3].length === 2,\n () => 'Invalid number of paddings. Must be length of 2 each.');\n return pad(x, paddings, constantValue);\n}\n\nexport const pad4d = op({pad4d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {SpaceToBatchND, SpaceToBatchNDAttrs, SpaceToBatchNDInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\n\n/**\n * This operation divides \"spatial\" dimensions `[1, ..., M]` of the input into\n * a grid of blocks of shape `blockShape`, and interleaves these blocks with\n * the \"batch\" dimension (0) such that in the output, the spatial\n * dimensions `[1, ..., M]` correspond to the position within the grid,\n * and the batch dimension combines both the position within a spatial block\n * and the original batch position. Prior to division into blocks,\n * the spatial dimensions of the input are optionally zero padded\n * according to `paddings`. See below for a precise description.\n *\n * ```js\n * const x = tf.tensor4d([1, 2, 3, 4], [1, 2, 2, 1]);\n * const blockShape = [2, 2];\n * const paddings = [[0, 0], [0, 0]];\n *\n * x.spaceToBatchND(blockShape, paddings).print();\n * ```\n *\n * @param x A `tf.Tensor`. N-D with `x.shape` = `[batch] + spatialShape +\n * remainingShape`, where spatialShape has `M` dimensions.\n * @param blockShape A 1-D array. Must have shape `[M]`, all values must\n * be >= 1.\n * @param paddings A 2-D array. Must have shape `[M, 2]`, all values must be >=\n * 0. `paddings[i] = [padStart, padEnd]` specifies the amount to zero-pad\n * from input dimension `i + 1`, which corresponds to spatial dimension `i`. It\n * is required that\n * `(inputShape[i + 1] + padStart + padEnd) % blockShape[i] === 0`\n *\n * This operation is equivalent to the following steps:\n *\n * 1. Zero-pad the start and end of dimensions `[1, ..., M]` of the input\n * according to `paddings` to produce `padded` of shape paddedShape.\n *\n * 2. Reshape `padded` to `reshapedPadded` of shape:\n * `[batch] + [paddedShape[1] / blockShape[0], blockShape[0], ...,\n * paddedShape[M] / blockShape[M-1], blockShape[M-1]] + remainingShape`\n *\n * 3. Permute dimensions of `reshapedPadded` to produce `permutedReshapedPadded`\n * of shape: `blockShape + [batch] + [paddedShape[1] / blockShape[0], ...,\n * paddedShape[M] / blockShape[M-1]] + remainingShape`\n *\n * 4. Reshape `permutedReshapedPadded` to flatten `blockShape` into the\n * batch dimension, producing an output tensor of shape:\n * `[batch * prod(blockShape)] + [paddedShape[1] / blockShape[0], ...,\n * paddedShape[M] / blockShape[M-1]] + remainingShape`\n *\n * @doc {heading: 'Tensors', subheading: 'Transformations'}\n */\nfunction spaceToBatchND_(\n x: T|TensorLike, blockShape: number[], paddings: number[][]): T {\n const $x = convertToTensor(x, 'x', 'spaceToBatchND');\n\n util.assert(\n $x.rank >= 1 + blockShape.length,\n () => `input rank ${$x.rank} should be > than [blockShape] ${\n blockShape.length}`);\n\n util.assert(\n paddings.length === blockShape.length,\n () => `paddings.shape[0] ${\n paddings.length} must be equal to [blockShape] ${blockShape.length}`);\n\n util.assert(\n $x.shape.reduce(\n (a, b, i) => {\n if (i > 0 && i <= blockShape.length) {\n return a &&\n ((b + paddings[i - 1][0] + paddings[i - 1][1]) %\n blockShape[i - 1] ===\n 0);\n }\n return a;\n },\n true),\n () => `input spatial dimensions ${$x.shape.slice(1)} with paddings ${\n paddings.toString()} must be divisible by blockShapes ${\n blockShape.toString()}`);\n\n const inputs: SpaceToBatchNDInputs = {x: $x};\n const attrs: SpaceToBatchNDAttrs = {blockShape, paddings};\n\n return ENGINE.runKernel(\n SpaceToBatchND, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap);\n}\n\nexport const spaceToBatchND = op({spaceToBatchND_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor3D, Tensor4D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {avgPool} from './avg_pool';\nimport {batchToSpaceND} from './batch_to_space_nd';\nimport * as conv_util from './conv_util';\nimport {maxPool} from './max_pool';\nimport {op} from './operation';\nimport {reshape} from './reshape';\nimport {spaceToBatchND} from './space_to_batch_nd';\n\n/**\n * Performs an N-D pooling operation\n *\n * @param input The input tensor, of rank 4 or rank 3 of shape\n * `[batch, height, width, inChannels]`. If rank 3, batch of 1 is assumed.\n * @param windowShape The filter size: `[filterHeight, filterWidth]`. If\n * `filterSize` is a single number, then `filterHeight == filterWidth`.\n * @param poolingType The type of pooling, either 'max' or 'avg'.\n * @param pad The type of padding algorithm:\n * - `same` and stride 1: output will be of same size as input,\n * regardless of filter size.\n * - `valid`: output will be smaller than input if filter is larger\n * than 1x1.\n * - For more info, see this guide:\n * [https://www.tensorflow.org/api_guides/python/nn#Convolution](\n * https://www.tensorflow.org/api_guides/python/nn#Convolution)\n * @param dilations The dilation rates: `[dilationHeight, dilationWidth]`\n * in which we sample input values across the height and width dimensions\n * in dilated pooling. Defaults to `[1, 1]`. If `dilationRate` is a single\n * number, then `dilationHeight == dilationWidth`. If it is greater than\n * 1, then all values of `strides` must be 1.\n * @param strides The strides of the pooling: `[strideHeight, strideWidth]`. If\n * `strides` is a single number, then `strideHeight == strideWidth`.\n * @param dimRoundingMode A string from: 'ceil', 'round', 'floor'. If none is\n * provided, it will default to truncate.\n *\n * @doc {heading: 'Operations', subheading: 'Convolution'}\n */\nfunction pool_(\n input: T|TensorLike, windowShape: [number, number]|number,\n poolingType: 'avg'|'max',\n pad: 'valid'|'same'|number|conv_util.ExplicitPadding,\n dilations?: [number, number]|number, strides?: [number, number]|number,\n dimRoundingMode?: 'floor'|'round'|'ceil') {\n if (dilations == null) {\n dilations = [1, 1];\n }\n if (strides == null) {\n strides = 1;\n }\n if (pad === 0) {\n pad = 'valid';\n }\n\n const $x = convertToTensor(input, 'x', 'maxPool');\n let x4D = $x as Tensor4D;\n let reshapedTo4D = false;\n\n if ($x.rank === 3) {\n reshapedTo4D = true;\n x4D = reshape($x, [1, $x.shape[0], $x.shape[1], $x.shape[2]]);\n }\n\n util.assert(\n conv_util.eitherStridesOrDilationsAreOne(strides, dilations),\n () => 'Error in pool: Either strides or dilations must be 1. ' +\n `Got strides ${strides} and dilations '${dilations}'`);\n\n const convInfo = conv_util.computePool2DInfo(\n x4D.shape, windowShape, strides, dilations, pad);\n const dilation: [number, number] =\n [convInfo.dilationHeight, convInfo.dilationWidth];\n\n // The following implementation does batchToSpace(pool(spaceToBatch(x)))\n // whenever dilation > 1 since the TF kernels do not support dilation > 1.\n // tslint:disable-next-line:max-line-length\n // https://github.com/tensorflow/tensorflow/blob/50f6bb67dc98c9b74630b6047aae7a4f8a40fd02/tensorflow/python/ops/nn_ops.py#L1037\n\n let basePadding: number[][];\n if (pad === 'same') {\n basePadding = withSpaceToBatchBasePaddings(\n [convInfo.filterHeight, convInfo.filterWidth], dilation);\n } else {\n basePadding = [[0, 0], [0, 0]];\n }\n\n const isDilationOne = dilation[0] === 1 && dilation[1] === 1;\n const [adjustedPadding, adjustedCrops] = requiredSpaceToBatchPaddings(\n [convInfo.inHeight, convInfo.inWidth], dilation, basePadding);\n const convertedPad = isDilationOne ? pad : 'valid';\n const convertedX =\n isDilationOne ? x4D : spaceToBatchND(x4D, dilation, adjustedPadding);\n\n const forwardOp = poolingType === 'avg' ?\n () => avgPool(convertedX, windowShape, strides, convertedPad,\n dimRoundingMode) :\n () => maxPool(convertedX, windowShape, strides, convertedPad,\n dimRoundingMode);\n const y = forwardOp();\n\n const res = isDilationOne ? y : batchToSpaceND(y, dilation, adjustedCrops);\n\n if (reshapedTo4D) {\n return reshape(res, [res.shape[1], res.shape[2], res.shape[3]]) as T;\n }\n\n return res as T;\n}\n\n// Helper function to compute crops and paddings for pool with dilation > 1.\n// tslint:disable-next-line:max-line-length\n// https://github.com/tensorflow/tensorflow/blob/50f6bb67dc98c9b74630b6047aae7a4f8a40fd02/tensorflow/python/ops/array_ops.py#L2184\nfunction requiredSpaceToBatchPaddings(\n inputShape: [number, number], blockShape: [number, number],\n basePadding: number[][]) {\n const padStart = basePadding.map(b => b[0]);\n const origPadEnd = basePadding.map(b => b[1]);\n const fullInputShape = inputShape.concat(padStart, origPadEnd);\n const padEndExtra = blockShape.map((b, i) => (b - fullInputShape[i] % b) % b);\n const padEnd = origPadEnd.map((s, i) => s + padEndExtra[i]);\n const paddings = blockShape.map((_, i) => [padStart[i], padEnd[i]]);\n const crops = blockShape.map((_, i) => [0, padEndExtra[i]]);\n return [paddings, crops];\n}\n\n// Helper function to compute base paddings for pool with dilation > 1.\n// tslint:disable-next-line:max-line-length\n// https://github.com/tensorflow/tensorflow/blob/50f6bb67dc98c9b74630b6047aae7a4f8a40fd02/tensorflow/python/ops/nn_ops.py#L524\nfunction withSpaceToBatchBasePaddings(\n filterShape: [number, number], dilation: [number, number]) {\n // Spatial dimensions of the filters and the upsampled filters in which we\n // introduce (rate - 1) zeros between consecutive filter values.\n const dilatedFilterShape = filterShape.map((s, i) => {\n return s + (s - 1) * (dilation[i] - 1);\n });\n const padExtraShape = dilatedFilterShape.map(s => s - 1);\n\n // When padding is odd, we pad more at end, following the same\n // convention as conv2d.\n const padExtraStart = padExtraShape.map(s => Math.floor(s / 2));\n const padExtraEnd = padExtraShape.map((s, i) => s - padExtraStart[i]);\n return padExtraShape.map((_, i) => {\n return [padExtraStart[i], padExtraEnd[i]];\n });\n}\n\nexport const pool = op({pool_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Prelu, PreluInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes leaky rectified linear element-wise with parametric alphas.\n *\n * `x < 0 ? alpha * x : f(x) = x`\n *\n * ```js\n * const x = tf.tensor1d([-1, 2, -3, 4]);\n * const alpha = tf.scalar(0.1);\n *\n * x.prelu(alpha).print(); // or tf.prelu(x, alpha)\n * ```\n * @param x The input tensor.\n * @param alpha Scaling factor for negative values.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction prelu_(x: T|TensorLike, alpha: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'prelu');\n const $alpha = convertToTensor(alpha, 'alpha', 'prelu');\n\n const inputs: PreluInputs = {x: $x, alpha: $alpha};\n return ENGINE.runKernel(Prelu, inputs as {} as NamedTensorMap);\n}\n\nexport const prelu = op({prelu_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Prod, ProdAttrs, ProdInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {cast} from './cast';\nimport {op} from './operation';\n\n/**\n * Computes the product of elements across dimensions of a `tf.Tensor`.\n *\n * Reduces the input along the dimensions given in `axes`. Unless `keepDims`\n * is true, the rank of the `tf.Tensor` is reduced by 1 for each entry in\n * `axes`. If `keepDims` is true, the reduced dimensions are retained with\n * length 1. If `axes` has no entries, all dimensions are reduced, and a\n * `tf.Tensor` with a single element is returned.\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 3]);\n *\n * x.prod().print(); // or tf.prod(x)\n * ```\n *\n * ```js\n * const x = tf.tensor2d([1, 2, 3, 4], [2, 2]);\n *\n * const axis = 1;\n * x.prod(axis).print(); // or tf.prod(x, axis)\n * ```\n *\n * @param x The input tensor to compute the product over. If the dtype is `bool`\n * it will be converted to `int32` and the output dtype will be `int32`.\n * @param axis The dimension(s) to reduce. By default it reduces\n * all dimensions.\n * @param keepDims If true, retains reduced dimensions with size 1.\n *\n * @doc {heading: 'Operations', subheading: 'Reduction'}\n */\nfunction prod_(\n x: Tensor|TensorLike, axis: number|number[] = null, keepDims = false): T {\n let $x = convertToTensor(x, 'x', 'prod');\n\n if ($x.dtype === 'bool') {\n // bool is not an allowed type for the underlying kernel.\n $x = cast($x, 'int32');\n }\n\n const inputs: ProdInputs = {x: $x};\n const attrs: ProdAttrs = {axis, keepDims};\n\n return ENGINE.runKernel(\n Prod, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const prod = op({prod_});\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {RaggedGather, RaggedGatherAttrs, RaggedGatherInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {op} from './operation';\n\n/**\n * Gather ragged slices from params axis 0 according to indices.\n *\n * @param paramsNestedSplits: A list of at least 1 Tensor with type 'int32' The\n * nestedRowSplits tensors that define the row-partitioning for the params\n * RaggedTensor input.\n * @param paramsDenseValues: A Tensor. The flatValues for the params\n * RaggedTensor.\n * @param indices: A Tensor. Must be one of type: int32. Indices in the\n * outermost dimension of params of the values that should be gathered.\n * @param outputRaggedRank: An int that is >= 0. The ragged rank of the output\n * RaggedTensor. outputNestedSplits will contain this number of rowSplits\n * tensors. This value should equal indices.shape.ndims + params.raggedRank\n * - 1.\n * @return A map with the following properties:\n * - outputNestedSplits: A list of outputRaggedRank Tensor objects with the\n * same type as paramsNestedSplits.\n * - outputDenseValues: A Tensor. Has the same type as paramsDenseValues.\n * @doc {heading: 'Operations', subheading: 'Ragged'}\n */\n\ninterface RaggedGatherMap {\n outputNestedSplits: Tensor[];\n outputDenseValues: Tensor;\n}\n\nfunction raggedGather_(\n paramsNestedSplits: Tensor[], paramsDenseValues: Tensor|TensorLike,\n indices: Tensor|TensorLike, outputRaggedRank: number): RaggedGatherMap {\n const $paramsNestedSplits = paramsNestedSplits.map(\n (t, i) => convertToTensor(t, `tensors${i}`, 'raggedGather', 'int32'));\n const $paramsDenseValues =\n convertToTensor(paramsDenseValues, 'paramsDenseValues', 'raggedGather');\n const $indices = convertToTensor(indices, 'indices', 'raggedGather', 'int32');\n\n const inputs: RaggedGatherInputs = {\n paramsNestedSplits: $paramsNestedSplits,\n paramsDenseValues: $paramsDenseValues,\n indices: $indices,\n };\n const attrs: RaggedGatherAttrs = {outputRaggedRank};\n\n const result: Tensor[] =\n ENGINE.runKernel(RaggedGather, inputs as {}, attrs as {});\n return {\n outputNestedSplits: result.slice(0, result.length - 1),\n outputDenseValues: result[result.length - 1],\n };\n}\n\nexport const raggedGather = op({raggedGather_});\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {RaggedRange, RaggedRangeInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {op} from './operation';\n\n/**\n * Returns a RaggedTensor result composed from rtDenseValues and rtNestedSplits,\n * such that result[i] = [starts[i], starts[i] + deltas[i], ..., limits[i]]).\n *\n * @param starts: A Tensor. Must be one of the following types:\n * 'float32', 'int32'. The starts of each range.\n * @param limits: A Tensor. Must have the same type as starts. The limits of\n * each range.\n * @param deltas: A Tensor. Must have the same type as starts. The deltas of\n * each range.\n * @return A map with the following properties:\n * - rtNestedSplits: A Tensor of type 'int32'.\n * - rtDenseValues: A Tensor. Has the same type as starts.\n */\n\nfunction raggedRange_(\n starts: Tensor|TensorLike, limits: Tensor|TensorLike,\n deltas: Tensor|TensorLike): NamedTensorMap {\n const $starts = convertToTensor(starts, 'starts', 'raggedRange');\n const $limits =\n convertToTensor(limits, 'limits', 'raggedRange', $starts.dtype);\n const $deltas =\n convertToTensor(deltas, 'deltas', 'raggedRange', $starts.dtype);\n\n const inputs: RaggedRangeInputs = {\n starts: $starts,\n limits: $limits,\n deltas: $deltas,\n };\n\n const result: Tensor[] = ENGINE.runKernel(RaggedRange, inputs as {});\n return {\n rtNestedSplits: result[0],\n rtDenseValues: result[1],\n };\n}\n\nexport const raggedRange = op({raggedRange_});\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {RaggedTensorToTensor, RaggedTensorToTensorAttrs, RaggedTensorToTensorInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {op} from './operation';\n\n/**\n * Create a dense tensor from a ragged tensor, possibly altering its shape.\n *\n * The raggedTensorToTensor op creates a dense tensor from am array of row\n * partition tensors, a value vector, and default values. If the shape is\n * unspecified, the minimal shape required to contain all the elements in the\n * ragged tensor (the natural shape) will be used. If some dimensions are left\n * unspecified, then the size of the natural shape is used in that dimension.\n *\n * The defaultValue will be broadcast to the output shape. After that, the\n * values from the ragged tensor overwrite the default values. Note that the\n * defaultValue must have less dimensions than the value.\n *\n * The row partition tensors are in the order of the dimensions. At present, the\n * types can be: \"ROW_SPLITS\": the row_splits tensor from the ragged tensor.\n * \"VALUE_ROWIDS\": the value_rowids tensor from the ragged tensor.\n * \"FIRST_DIM_SIZE\": if value_rowids is used for the first dimension, then it\n * is preceded by \"FIRST_DIM_SIZE\".\n * ```\n * @param shape: A Tensor. Must be one of the following types: 'int32'. The\n * desired shape of the output tensor. If left unspecified (empty), the\n * minimal shape required to contain all the elements in the ragged tensor\n * (the natural shape) will be used. If some dimensions are left\n * unspecified, then the size of the natural shape is used in that\n * dimension.\n *\n * Note that dense dimensions cannot be modified by the shape argument.\n * Trying to change the size of a dense dimension will cause the op to fail.\n * Examples: natural shape: [4, 5, 6] shape: -1 output shape: [4, 5, 6]\n *\n * natural shape: [4, 5, 6] shape: [3, -1, 2] output shape: [3, 5, 2]\n *\n * natural shape: [4, 5, 6] shape: [3, 7, 2] output shape: [3, 7, 2]\n * @param values: A Tensor. A 1D tensor representing the values of the ragged\n * tensor.\n * @param defaultValue: A Tensor. Must have the same type as values. The\n * defaultValue when the shape is larger than the ragged tensor. The\n * defaultValue is broadcast until it is the shape of the output tensor,\n * and then overwritten by values in the ragged tensor. The default value\n * must be compatible with this broadcast operation, and must have fewer\n * dimensions than the value tensor.\n * @param rowPartitionTensors: A list of at least 1 Tensor objects with the same\n * type in: 'int32'.\n * @param rowPartitionTypes: A list of strings. The types of the row partition\n * tensors. At present, these can be:\n * \"ROW_SPLITS\": the row_splits tensor from the ragged tensor.\n * \"VALUE_ROWIDS\": the value_rowids tensor from the ragged tensor.\n * \"FIRST_DIM_SIZE\": if value_rowids is used for the first dimension, then\n * it is preceeded by \"FIRST_DIM_SIZE\". The tensors are in the order of\n * the dimensions.\n * @return A Tensor. Has the same type as values.\n * @doc {heading: 'Operations', subheading: 'Ragged'}\n */\nfunction raggedTensorToTensor_(\n shape: Tensor|TensorLike, values: Tensor|TensorLike,\n defaultValue: Tensor|TensorLike, rowPartitionTensors: Tensor[],\n rowPartitionTypes: string[]): Tensor {\n const $shape =\n convertToTensor(shape, 'shape', 'raggedTensorToTensor', 'int32');\n const $values = convertToTensor(values, 'values', 'raggedTensorToTensor');\n const $defaultValue = convertToTensor(\n defaultValue, 'defaultValue', 'raggedTensorToTensor', $values.dtype);\n const $rowPartitionTensors = rowPartitionTensors.map(\n (t, i) =>\n convertToTensor(t, `tensors${i}`, 'raggedTensorToTensor', 'int32'));\n\n const inputs: RaggedTensorToTensorInputs = {\n shape: $shape,\n values: $values,\n defaultValue: $defaultValue,\n rowPartitionTensors: $rowPartitionTensors\n };\n const attrs: RaggedTensorToTensorAttrs = {rowPartitionTypes};\n\n return ENGINE.runKernel(RaggedTensorToTensor, inputs as {}, attrs as {});\n}\n\nexport const raggedTensorToTensor = op({raggedTensorToTensor_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Tensor} from '../tensor';\nimport {DataType, Rank, ShapeMap} from '../types';\nimport {sizeFromShape} from '../util';\n\nimport {op} from './operation';\n\n/**\n * Creates a `tf.Tensor` with values sampled from a random number generator\n * function defined by the user.\n *\n * @param shape An array of integers defining the output tensor shape.\n * @param randFunction A random number generator function which is called\n * for each element in the output tensor.\n * @param dtype The data type of the output tensor. Defaults to 'float32'.\n *\n * @doc {heading: 'Tensors', subheading: 'Random'}\n */\nfunction rand_(\n shape: ShapeMap[R], randFunction: () => number,\n dtype?: DataType): Tensor {\n const size = sizeFromShape(shape);\n let values = null;\n if (dtype == null || dtype === 'float32') {\n values = new Float32Array(size);\n } else if (dtype === 'int32') {\n values = new Int32Array(size);\n } else if (dtype === 'bool') {\n values = new Uint8Array(size);\n } else {\n throw new Error(`Unknown data type ${dtype}`);\n }\n for (let i = 0; i < size; i++) {\n values[i] = randFunction();\n }\n return ENGINE.makeTensor(values, shape, dtype) as Tensor;\n}\n\nexport const rand = op({rand_});\n","// A port of an algorithm by Johannes Baagøe , 2010\n// http://baagoe.com/en/RandomMusings/javascript/\n// https://github.com/nquinlan/better-random-numbers-for-javascript-mirror\n// Original work is under MIT license -\n\n// Copyright (C) 2010 by Johannes Baagøe \n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n\n\n(function(global, module, define) {\n\nfunction Alea(seed) {\n var me = this, mash = Mash();\n\n me.next = function() {\n var t = 2091639 * me.s0 + me.c * 2.3283064365386963e-10; // 2^-32\n me.s0 = me.s1;\n me.s1 = me.s2;\n return me.s2 = t - (me.c = t | 0);\n };\n\n // Apply the seeding algorithm from Baagoe.\n me.c = 1;\n me.s0 = mash(' ');\n me.s1 = mash(' ');\n me.s2 = mash(' ');\n me.s0 -= mash(seed);\n if (me.s0 < 0) { me.s0 += 1; }\n me.s1 -= mash(seed);\n if (me.s1 < 0) { me.s1 += 1; }\n me.s2 -= mash(seed);\n if (me.s2 < 0) { me.s2 += 1; }\n mash = null;\n}\n\nfunction copy(f, t) {\n t.c = f.c;\n t.s0 = f.s0;\n t.s1 = f.s1;\n t.s2 = f.s2;\n return t;\n}\n\nfunction impl(seed, opts) {\n var xg = new Alea(seed),\n state = opts && opts.state,\n prng = xg.next;\n prng.int32 = function() { return (xg.next() * 0x100000000) | 0; }\n prng.double = function() {\n return prng() + (prng() * 0x200000 | 0) * 1.1102230246251565e-16; // 2^-53\n };\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nfunction Mash() {\n var n = 0xefc8249d;\n\n var mash = function(data) {\n data = String(data);\n for (var i = 0; i < data.length; i++) {\n n += data.charCodeAt(i);\n var h = 0.02519603282416938 * n;\n n = h >>> 0;\n h -= n;\n h *= n;\n n = h >>> 0;\n h -= n;\n n += h * 0x100000000; // 2^32\n }\n return (n >>> 0) * 2.3283064365386963e-10; // 2^-32\n };\n\n return mash;\n}\n\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.alea = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n","// A Javascript implementaion of the \"xor128\" prng algorithm by\n// George Marsaglia. See http://www.jstatsoft.org/v08/i14/paper\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this, strseed = '';\n\n me.x = 0;\n me.y = 0;\n me.z = 0;\n me.w = 0;\n\n // Set up generator function.\n me.next = function() {\n var t = me.x ^ (me.x << 11);\n me.x = me.y;\n me.y = me.z;\n me.z = me.w;\n return me.w ^= (me.w >>> 19) ^ t ^ (t >>> 8);\n };\n\n if (seed === (seed | 0)) {\n // Integer seed.\n me.x = seed;\n } else {\n // String seed.\n strseed += seed;\n }\n\n // Mix in string seed, then discard an initial batch of 64 values.\n for (var k = 0; k < strseed.length + 64; k++) {\n me.x ^= strseed.charCodeAt(k) | 0;\n me.next();\n }\n}\n\nfunction copy(f, t) {\n t.x = f.x;\n t.y = f.y;\n t.z = f.z;\n t.w = f.w;\n return t;\n}\n\nfunction impl(seed, opts) {\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xor128 = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n","// A Javascript implementaion of the \"xorwow\" prng algorithm by\n// George Marsaglia. See http://www.jstatsoft.org/v08/i14/paper\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this, strseed = '';\n\n // Set up generator function.\n me.next = function() {\n var t = (me.x ^ (me.x >>> 2));\n me.x = me.y; me.y = me.z; me.z = me.w; me.w = me.v;\n return (me.d = (me.d + 362437 | 0)) +\n (me.v = (me.v ^ (me.v << 4)) ^ (t ^ (t << 1))) | 0;\n };\n\n me.x = 0;\n me.y = 0;\n me.z = 0;\n me.w = 0;\n me.v = 0;\n\n if (seed === (seed | 0)) {\n // Integer seed.\n me.x = seed;\n } else {\n // String seed.\n strseed += seed;\n }\n\n // Mix in string seed, then discard an initial batch of 64 values.\n for (var k = 0; k < strseed.length + 64; k++) {\n me.x ^= strseed.charCodeAt(k) | 0;\n if (k == strseed.length) {\n me.d = me.x << 10 ^ me.x >>> 4;\n }\n me.next();\n }\n}\n\nfunction copy(f, t) {\n t.x = f.x;\n t.y = f.y;\n t.z = f.z;\n t.w = f.w;\n t.v = f.v;\n t.d = f.d;\n return t;\n}\n\nfunction impl(seed, opts) {\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xorwow = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n","// A Javascript implementaion of the \"xorshift7\" algorithm by\n// François Panneton and Pierre L'ecuyer:\n// \"On the Xorgshift Random Number Generators\"\n// http://saluc.engr.uconn.edu/refs/crypto/rng/panneton05onthexorshift.pdf\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this;\n\n // Set up generator function.\n me.next = function() {\n // Update xor generator.\n var X = me.x, i = me.i, t, v, w;\n t = X[i]; t ^= (t >>> 7); v = t ^ (t << 24);\n t = X[(i + 1) & 7]; v ^= t ^ (t >>> 10);\n t = X[(i + 3) & 7]; v ^= t ^ (t >>> 3);\n t = X[(i + 4) & 7]; v ^= t ^ (t << 7);\n t = X[(i + 7) & 7]; t = t ^ (t << 13); v ^= t ^ (t << 9);\n X[i] = v;\n me.i = (i + 1) & 7;\n return v;\n };\n\n function init(me, seed) {\n var j, w, X = [];\n\n if (seed === (seed | 0)) {\n // Seed state array using a 32-bit integer.\n w = X[0] = seed;\n } else {\n // Seed state using a string.\n seed = '' + seed;\n for (j = 0; j < seed.length; ++j) {\n X[j & 7] = (X[j & 7] << 15) ^\n (seed.charCodeAt(j) + X[(j + 1) & 7] << 13);\n }\n }\n // Enforce an array length of 8, not all zeroes.\n while (X.length < 8) X.push(0);\n for (j = 0; j < 8 && X[j] === 0; ++j);\n if (j == 8) w = X[7] = -1; else w = X[j];\n\n me.x = X;\n me.i = 0;\n\n // Discard an initial 256 values.\n for (j = 256; j > 0; --j) {\n me.next();\n }\n }\n\n init(me, seed);\n}\n\nfunction copy(f, t) {\n t.x = f.x.slice();\n t.i = f.i;\n return t;\n}\n\nfunction impl(seed, opts) {\n if (seed == null) seed = +(new Date);\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (state.x) copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xorshift7 = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n","// A Javascript implementaion of Richard Brent's Xorgens xor4096 algorithm.\n//\n// This fast non-cryptographic random number generator is designed for\n// use in Monte-Carlo algorithms. It combines a long-period xorshift\n// generator with a Weyl generator, and it passes all common batteries\n// of stasticial tests for randomness while consuming only a few nanoseconds\n// for each prng generated. For background on the generator, see Brent's\n// paper: \"Some long-period random number generators using shifts and xors.\"\n// http://arxiv.org/pdf/1004.3115v1.pdf\n//\n// Usage:\n//\n// var xor4096 = require('xor4096');\n// random = xor4096(1); // Seed with int32 or string.\n// assert.equal(random(), 0.1520436450538547); // (0, 1) range, 53 bits.\n// assert.equal(random.int32(), 1806534897); // signed int32, 32 bits.\n//\n// For nonzero numeric keys, this impelementation provides a sequence\n// identical to that by Brent's xorgens 3 implementaion in C. This\n// implementation also provides for initalizing the generator with\n// string seeds, or for saving and restoring the state of the generator.\n//\n// On Chrome, this prng benchmarks about 2.1 times slower than\n// Javascript's built-in Math.random().\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this;\n\n // Set up generator function.\n me.next = function() {\n var w = me.w,\n X = me.X, i = me.i, t, v;\n // Update Weyl generator.\n me.w = w = (w + 0x61c88647) | 0;\n // Update xor generator.\n v = X[(i + 34) & 127];\n t = X[i = ((i + 1) & 127)];\n v ^= v << 13;\n t ^= t << 17;\n v ^= v >>> 15;\n t ^= t >>> 12;\n // Update Xor generator array state.\n v = X[i] = v ^ t;\n me.i = i;\n // Result is the combination.\n return (v + (w ^ (w >>> 16))) | 0;\n };\n\n function init(me, seed) {\n var t, v, i, j, w, X = [], limit = 128;\n if (seed === (seed | 0)) {\n // Numeric seeds initialize v, which is used to generates X.\n v = seed;\n seed = null;\n } else {\n // String seeds are mixed into v and X one character at a time.\n seed = seed + '\\0';\n v = 0;\n limit = Math.max(limit, seed.length);\n }\n // Initialize circular array and weyl value.\n for (i = 0, j = -32; j < limit; ++j) {\n // Put the unicode characters into the array, and shuffle them.\n if (seed) v ^= seed.charCodeAt((j + 32) % seed.length);\n // After 32 shuffles, take v as the starting w value.\n if (j === 0) w = v;\n v ^= v << 10;\n v ^= v >>> 15;\n v ^= v << 4;\n v ^= v >>> 13;\n if (j >= 0) {\n w = (w + 0x61c88647) | 0; // Weyl.\n t = (X[j & 127] ^= (v + w)); // Combine xor and weyl to init array.\n i = (0 == t) ? i + 1 : 0; // Count zeroes.\n }\n }\n // We have detected all zeroes; make the key nonzero.\n if (i >= 128) {\n X[(seed && seed.length || 0) & 127] = -1;\n }\n // Run the generator 512 times to further mix the state before using it.\n // Factoring this as a function slows the main generator, so it is just\n // unrolled here. The weyl generator is not advanced while warming up.\n i = 127;\n for (j = 4 * 128; j > 0; --j) {\n v = X[(i + 34) & 127];\n t = X[i = ((i + 1) & 127)];\n v ^= v << 13;\n t ^= t << 17;\n v ^= v >>> 15;\n t ^= t >>> 12;\n X[i] = v ^ t;\n }\n // Storing state as object members is faster than using closure variables.\n me.w = w;\n me.X = X;\n me.i = i;\n }\n\n init(me, seed);\n}\n\nfunction copy(f, t) {\n t.i = f.i;\n t.w = f.w;\n t.X = f.X.slice();\n return t;\n};\n\nfunction impl(seed, opts) {\n if (seed == null) seed = +(new Date);\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (state.X) copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xor4096 = impl;\n}\n\n})(\n this, // window object or global\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n","// A Javascript implementaion of the \"Tyche-i\" prng algorithm by\n// Samuel Neves and Filipe Araujo.\n// See https://eden.dei.uc.pt/~sneves/pubs/2011-snfa2.pdf\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this, strseed = '';\n\n // Set up generator function.\n me.next = function() {\n var b = me.b, c = me.c, d = me.d, a = me.a;\n b = (b << 25) ^ (b >>> 7) ^ c;\n c = (c - d) | 0;\n d = (d << 24) ^ (d >>> 8) ^ a;\n a = (a - b) | 0;\n me.b = b = (b << 20) ^ (b >>> 12) ^ c;\n me.c = c = (c - d) | 0;\n me.d = (d << 16) ^ (c >>> 16) ^ a;\n return me.a = (a - b) | 0;\n };\n\n /* The following is non-inverted tyche, which has better internal\n * bit diffusion, but which is about 25% slower than tyche-i in JS.\n me.next = function() {\n var a = me.a, b = me.b, c = me.c, d = me.d;\n a = (me.a + me.b | 0) >>> 0;\n d = me.d ^ a; d = d << 16 ^ d >>> 16;\n c = me.c + d | 0;\n b = me.b ^ c; b = b << 12 ^ d >>> 20;\n me.a = a = a + b | 0;\n d = d ^ a; me.d = d = d << 8 ^ d >>> 24;\n me.c = c = c + d | 0;\n b = b ^ c;\n return me.b = (b << 7 ^ b >>> 25);\n }\n */\n\n me.a = 0;\n me.b = 0;\n me.c = 2654435769 | 0;\n me.d = 1367130551;\n\n if (seed === Math.floor(seed)) {\n // Integer seed.\n me.a = (seed / 0x100000000) | 0;\n me.b = seed | 0;\n } else {\n // String seed.\n strseed += seed;\n }\n\n // Mix in string seed, then discard an initial batch of 64 values.\n for (var k = 0; k < strseed.length + 20; k++) {\n me.b ^= strseed.charCodeAt(k) | 0;\n me.next();\n }\n}\n\nfunction copy(f, t) {\n t.a = f.a;\n t.b = f.b;\n t.c = f.c;\n t.d = f.d;\n return t;\n};\n\nfunction impl(seed, opts) {\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.tychei = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n","/*\nCopyright 2019 David Bau.\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n*/\n\n(function (global, pool, math) {\n//\n// The following constants are related to IEEE 754 limits.\n//\n\nvar width = 256, // each RC4 output is 0 <= x < 256\n chunks = 6, // at least six RC4 outputs for each double\n digits = 52, // there are 52 significant digits in a double\n rngname = 'random', // rngname: name for Math.random and Math.seedrandom\n startdenom = math.pow(width, chunks),\n significance = math.pow(2, digits),\n overflow = significance * 2,\n mask = width - 1,\n nodecrypto; // node.js crypto module, initialized at the bottom.\n\n//\n// seedrandom()\n// This is the seedrandom function described above.\n//\nfunction seedrandom(seed, options, callback) {\n var key = [];\n options = (options == true) ? { entropy: true } : (options || {});\n\n // Flatten the seed string or build one from local entropy if needed.\n var shortseed = mixkey(flatten(\n options.entropy ? [seed, tostring(pool)] :\n (seed == null) ? autoseed() : seed, 3), key);\n\n // Use the seed to initialize an ARC4 generator.\n var arc4 = new ARC4(key);\n\n // This function returns a random double in [0, 1) that contains\n // randomness in every bit of the mantissa of the IEEE 754 value.\n var prng = function() {\n var n = arc4.g(chunks), // Start with a numerator n < 2 ^ 48\n d = startdenom, // and denominator d = 2 ^ 48.\n x = 0; // and no 'extra last byte'.\n while (n < significance) { // Fill up all significant digits by\n n = (n + x) * width; // shifting numerator and\n d *= width; // denominator and generating a\n x = arc4.g(1); // new least-significant-byte.\n }\n while (n >= overflow) { // To avoid rounding up, before adding\n n /= 2; // last byte, shift everything\n d /= 2; // right using integer math until\n x >>>= 1; // we have exactly the desired bits.\n }\n return (n + x) / d; // Form the number within [0, 1).\n };\n\n prng.int32 = function() { return arc4.g(4) | 0; }\n prng.quick = function() { return arc4.g(4) / 0x100000000; }\n prng.double = prng;\n\n // Mix the randomness into accumulated entropy.\n mixkey(tostring(arc4.S), pool);\n\n // Calling convention: what to return as a function of prng, seed, is_math.\n return (options.pass || callback ||\n function(prng, seed, is_math_call, state) {\n if (state) {\n // Load the arc4 state from the given state if it has an S array.\n if (state.S) { copy(state, arc4); }\n // Only provide the .state method if requested via options.state.\n prng.state = function() { return copy(arc4, {}); }\n }\n\n // If called as a method of Math (Math.seedrandom()), mutate\n // Math.random because that is how seedrandom.js has worked since v1.0.\n if (is_math_call) { math[rngname] = prng; return seed; }\n\n // Otherwise, it is a newer calling convention, so return the\n // prng directly.\n else return prng;\n })(\n prng,\n shortseed,\n 'global' in options ? options.global : (this == math),\n options.state);\n}\n\n//\n// ARC4\n//\n// An ARC4 implementation. The constructor takes a key in the form of\n// an array of at most (width) integers that should be 0 <= x < (width).\n//\n// The g(count) method returns a pseudorandom integer that concatenates\n// the next (count) outputs from ARC4. Its return value is a number x\n// that is in the range 0 <= x < (width ^ count).\n//\nfunction ARC4(key) {\n var t, keylen = key.length,\n me = this, i = 0, j = me.i = me.j = 0, s = me.S = [];\n\n // The empty key [] is treated as [0].\n if (!keylen) { key = [keylen++]; }\n\n // Set up S using the standard key scheduling algorithm.\n while (i < width) {\n s[i] = i++;\n }\n for (i = 0; i < width; i++) {\n s[i] = s[j = mask & (j + key[i % keylen] + (t = s[i]))];\n s[j] = t;\n }\n\n // The \"g\" method returns the next (count) outputs as one number.\n (me.g = function(count) {\n // Using instance members instead of closure state nearly doubles speed.\n var t, r = 0,\n i = me.i, j = me.j, s = me.S;\n while (count--) {\n t = s[i = mask & (i + 1)];\n r = r * width + s[mask & ((s[i] = s[j = mask & (j + t)]) + (s[j] = t))];\n }\n me.i = i; me.j = j;\n return r;\n // For robust unpredictability, the function call below automatically\n // discards an initial batch of values. This is called RC4-drop[256].\n // See http://google.com/search?q=rsa+fluhrer+response&btnI\n })(width);\n}\n\n//\n// copy()\n// Copies internal state of ARC4 to or from a plain object.\n//\nfunction copy(f, t) {\n t.i = f.i;\n t.j = f.j;\n t.S = f.S.slice();\n return t;\n};\n\n//\n// flatten()\n// Converts an object tree to nested arrays of strings.\n//\nfunction flatten(obj, depth) {\n var result = [], typ = (typeof obj), prop;\n if (depth && typ == 'object') {\n for (prop in obj) {\n try { result.push(flatten(obj[prop], depth - 1)); } catch (e) {}\n }\n }\n return (result.length ? result : typ == 'string' ? obj : obj + '\\0');\n}\n\n//\n// mixkey()\n// Mixes a string seed into a key that is an array of integers, and\n// returns a shortened string seed that is equivalent to the result key.\n//\nfunction mixkey(seed, key) {\n var stringseed = seed + '', smear, j = 0;\n while (j < stringseed.length) {\n key[mask & j] =\n mask & ((smear ^= key[mask & j] * 19) + stringseed.charCodeAt(j++));\n }\n return tostring(key);\n}\n\n//\n// autoseed()\n// Returns an object for autoseeding, using window.crypto and Node crypto\n// module if available.\n//\nfunction autoseed() {\n try {\n var out;\n if (nodecrypto && (out = nodecrypto.randomBytes)) {\n // The use of 'out' to remember randomBytes makes tight minified code.\n out = out(width);\n } else {\n out = new Uint8Array(width);\n (global.crypto || global.msCrypto).getRandomValues(out);\n }\n return tostring(out);\n } catch (e) {\n var browser = global.navigator,\n plugins = browser && browser.plugins;\n return [+new Date, global, plugins, global.screen, tostring(pool)];\n }\n}\n\n//\n// tostring()\n// Converts an array of charcodes to a string\n//\nfunction tostring(a) {\n return String.fromCharCode.apply(0, a);\n}\n\n//\n// When seedrandom.js is loaded, we immediately mix a few bits\n// from the built-in RNG into the entropy pool. Because we do\n// not want to interfere with deterministic PRNG state later,\n// seedrandom will not call math.random on its own again after\n// initialization.\n//\nmixkey(math.random(), pool);\n\n//\n// Nodejs and AMD support: export the implementation as a module using\n// either convention.\n//\nif ((typeof module) == 'object' && module.exports) {\n module.exports = seedrandom;\n // When in node.js, try using crypto package for autoseeding.\n try {\n nodecrypto = require('crypto');\n } catch (ex) {}\n} else if ((typeof define) == 'function' && define.amd) {\n define(function() { return seedrandom; });\n} else {\n // When included as a plain script, set up Math.seedrandom global.\n math['seed' + rngname] = seedrandom;\n}\n\n\n// End anonymous scope, and pass initial values.\n})(\n // global: `self` in browsers (including strict mode and web workers),\n // otherwise `this` in Node and other environments\n (typeof self !== 'undefined') ? self : this,\n [], // pool: entropy pool starts empty\n Math // math: package containing random, pow, and seedrandom\n);\n","// A library of seedable RNGs implemented in Javascript.\n//\n// Usage:\n//\n// var seedrandom = require('seedrandom');\n// var random = seedrandom(1); // or any seed.\n// var x = random(); // 0 <= x < 1. Every bit is random.\n// var x = random.quick(); // 0 <= x < 1. 32 bits of randomness.\n\n// alea, a 53-bit multiply-with-carry generator by Johannes Baagøe.\n// Period: ~2^116\n// Reported to pass all BigCrush tests.\nvar alea = require('./lib/alea');\n\n// xor128, a pure xor-shift generator by George Marsaglia.\n// Period: 2^128-1.\n// Reported to fail: MatrixRank and LinearComp.\nvar xor128 = require('./lib/xor128');\n\n// xorwow, George Marsaglia's 160-bit xor-shift combined plus weyl.\n// Period: 2^192-2^32\n// Reported to fail: CollisionOver, SimpPoker, and LinearComp.\nvar xorwow = require('./lib/xorwow');\n\n// xorshift7, by François Panneton and Pierre L'ecuyer, takes\n// a different approach: it adds robustness by allowing more shifts\n// than Marsaglia's original three. It is a 7-shift generator\n// with 256 bits, that passes BigCrush with no systmatic failures.\n// Period 2^256-1.\n// No systematic BigCrush failures reported.\nvar xorshift7 = require('./lib/xorshift7');\n\n// xor4096, by Richard Brent, is a 4096-bit xor-shift with a\n// very long period that also adds a Weyl generator. It also passes\n// BigCrush with no systematic failures. Its long period may\n// be useful if you have many generators and need to avoid\n// collisions.\n// Period: 2^4128-2^32.\n// No systematic BigCrush failures reported.\nvar xor4096 = require('./lib/xor4096');\n\n// Tyche-i, by Samuel Neves and Filipe Araujo, is a bit-shifting random\n// number generator derived from ChaCha, a modern stream cipher.\n// https://eden.dei.uc.pt/~sneves/pubs/2011-snfa2.pdf\n// Period: ~2^127\n// No systematic BigCrush failures reported.\nvar tychei = require('./lib/tychei');\n\n// The original ARC4-based prng included in this library.\n// Period: ~2^1600\nvar sr = require('./seedrandom');\n\nsr.alea = alea;\nsr.xor128 = xor128;\nsr.xorwow = xorwow;\nsr.xorshift7 = xorshift7;\nsr.xor4096 = xor4096;\nsr.tychei = tychei;\n\nmodule.exports = sr;\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport * as seedrandom from 'seedrandom';\n\nimport {expectNumbersClose, testEpsilon} from '../test_util';\nimport {TypedArray} from '../types';\n\nexport interface RandomBase {\n nextValue(): number;\n}\n\nexport interface RandomGamma {\n nextValue(): number;\n}\n\nexport interface RandNormalDataTypes {\n float32: Float32Array;\n int32: Int32Array;\n}\n\nexport interface RandGammaDataTypes {\n float32: Float32Array;\n int32: Int32Array;\n}\n\n// https://en.wikipedia.org/wiki/Marsaglia_polar_method\nexport class MPRandGauss implements RandomBase {\n private mean: number;\n private stdDev: number;\n private nextVal: number;\n private dtype?: keyof RandNormalDataTypes;\n private truncated?: boolean;\n private upper?: number;\n private lower?: number;\n private random: seedrandom.prng;\n\n constructor(\n mean: number, stdDeviation: number, dtype?: keyof RandNormalDataTypes,\n truncated?: boolean, seed?: number) {\n this.mean = mean;\n this.stdDev = stdDeviation;\n this.dtype = dtype;\n this.nextVal = NaN;\n this.truncated = truncated;\n if (this.truncated) {\n this.upper = this.mean + this.stdDev * 2;\n this.lower = this.mean - this.stdDev * 2;\n }\n const seedValue = seed ? seed : Math.random();\n this.random = seedrandom.alea(seedValue.toString());\n }\n\n /** Returns next sample from a Gaussian distribution. */\n public nextValue(): number {\n if (!isNaN(this.nextVal)) {\n const value = this.nextVal;\n this.nextVal = NaN;\n return value;\n }\n\n let resultX: number, resultY: number;\n let isValid = false;\n while (!isValid) {\n let v1: number, v2: number, s: number;\n do {\n v1 = 2 * this.random() - 1;\n v2 = 2 * this.random() - 1;\n s = v1 * v1 + v2 * v2;\n } while (s >= 1 || s === 0);\n\n const mul = Math.sqrt(-2.0 * Math.log(s) / s);\n resultX = this.mean + this.stdDev * v1 * mul;\n resultY = this.mean + this.stdDev * v2 * mul;\n\n if (!this.truncated || this.isValidTruncated(resultX)) {\n isValid = true;\n }\n }\n\n if (!this.truncated || this.isValidTruncated(resultY)) {\n this.nextVal = this.convertValue(resultY);\n }\n return this.convertValue(resultX);\n }\n\n /** Handles proper rounding for non-floating-point numbers. */\n private convertValue(value: number): number {\n if (this.dtype == null || this.dtype === 'float32') {\n return value;\n }\n return Math.round(value);\n }\n\n /** Returns true if less than 2-standard-deviations from the mean. */\n private isValidTruncated(value: number): boolean {\n return value <= this.upper && value >= this.lower;\n }\n}\n\n// Marsaglia, George, and Wai Wan Tsang. 2000. \"A Simple Method for Generating\n// Gamma Variables.\"\nexport class RandGamma implements RandomGamma {\n private alpha: number;\n private beta: number;\n private d: number;\n private c: number;\n private dtype?: keyof RandGammaDataTypes;\n private randu: seedrandom.prng;\n private randn: MPRandGauss;\n\n constructor(\n alpha: number, beta: number, dtype: keyof RandGammaDataTypes,\n seed?: number) {\n this.alpha = alpha;\n this.beta = 1 / beta; // convert rate to scale parameter\n this.dtype = dtype;\n\n const seedValue = seed ? seed : Math.random();\n this.randu = seedrandom.alea(seedValue.toString());\n this.randn = new MPRandGauss(0, 1, dtype, false, this.randu());\n\n if (alpha < 1) {\n this.d = alpha + (2 / 3);\n } else {\n this.d = alpha - (1 / 3);\n }\n this.c = 1 / Math.sqrt(9 * this.d);\n }\n\n /** Returns next sample from a gamma distribution. */\n public nextValue(): number {\n let x2: number, v0: number, v1: number, x: number, u: number, v: number;\n while (true) {\n do {\n x = this.randn.nextValue();\n v = 1 + (this.c * x);\n } while (v <= 0);\n v *= v * v;\n x2 = x * x;\n v0 = 1 - (0.331 * x2 * x2);\n v1 = (0.5 * x2) + (this.d * (1 - v + Math.log(v)));\n u = this.randu();\n if (u < v0 || Math.log(u) < v1) {\n break;\n }\n }\n v = (1 / this.beta) * this.d * v;\n if (this.alpha < 1) {\n v *= Math.pow(this.randu(), 1 / this.alpha);\n }\n return this.convertValue(v);\n }\n /** Handles proper rounding for non-floating-point numbers. */\n private convertValue(value: number): number {\n if (this.dtype === 'float32') {\n return value;\n }\n return Math.round(value);\n }\n}\n\nexport class UniformRandom implements RandomBase {\n private min: number;\n private range: number;\n private random: seedrandom.prng;\n private dtype?: keyof RandNormalDataTypes;\n\n constructor(\n min = 0, max = 1, dtype?: keyof RandNormalDataTypes,\n seed?: string|number) {\n this.min = min;\n this.range = max - min;\n this.dtype = dtype;\n if (seed == null) {\n seed = Math.random();\n }\n if (typeof seed === 'number') {\n seed = seed.toString();\n }\n\n if (!this.canReturnFloat() && this.range <= 1) {\n throw new Error(\n `The difference between ${min} - ${max} <= 1 and dtype is not float`);\n }\n this.random = seedrandom.alea(seed);\n }\n\n /** Handles proper rounding for non floating point numbers. */\n private canReturnFloat = () =>\n (this.dtype == null || this.dtype === 'float32');\n\n private convertValue(value: number): number {\n if (this.canReturnFloat()) {\n return value;\n }\n return Math.round(value);\n }\n\n nextValue() {\n return this.convertValue(this.min + this.range * this.random());\n }\n}\n\nexport function jarqueBeraNormalityTest(values: TypedArray|number[]) {\n // https://en.wikipedia.org/wiki/Jarque%E2%80%93Bera_test\n const n = values.length;\n const s = skewness(values);\n const k = kurtosis(values);\n const jb = n / 6 * (Math.pow(s, 2) + 0.25 * Math.pow(k - 3, 2));\n // JB test requires 2-degress of freedom from Chi-Square @ 0.95:\n // http://www.itl.nist.gov/div898/handbook/eda/section3/eda3674.htm\n const CHI_SQUARE_2DEG = 5.991;\n if (jb > CHI_SQUARE_2DEG) {\n throw new Error(`Invalid p-value for JB: ${jb}`);\n }\n}\n\nexport function expectArrayInMeanStdRange(\n actual: TypedArray|number[], expectedMean: number, expectedStdDev: number,\n epsilon?: number) {\n if (epsilon == null) {\n epsilon = testEpsilon();\n }\n const actualMean = mean(actual);\n expectNumbersClose(actualMean, expectedMean, epsilon);\n expectNumbersClose(\n standardDeviation(actual, actualMean), expectedStdDev, epsilon);\n}\n\nfunction mean(values: TypedArray|number[]) {\n let sum = 0;\n for (let i = 0; i < values.length; i++) {\n sum += values[i];\n }\n return sum / values.length;\n}\n\nfunction standardDeviation(values: TypedArray|number[], mean: number) {\n let squareDiffSum = 0;\n for (let i = 0; i < values.length; i++) {\n const diff = values[i] - mean;\n squareDiffSum += diff * diff;\n }\n return Math.sqrt(squareDiffSum / values.length);\n}\n\nfunction kurtosis(values: TypedArray|number[]) {\n // https://en.wikipedia.org/wiki/Kurtosis\n const valuesMean = mean(values);\n const n = values.length;\n let sum2 = 0;\n let sum4 = 0;\n for (let i = 0; i < n; i++) {\n const v = values[i] - valuesMean;\n sum2 += Math.pow(v, 2);\n sum4 += Math.pow(v, 4);\n }\n return (1 / n) * sum4 / Math.pow((1 / n) * sum2, 2);\n}\n\nfunction skewness(values: TypedArray|number[]) {\n // https://en.wikipedia.org/wiki/Skewness\n const valuesMean = mean(values);\n const n = values.length;\n let sum2 = 0;\n let sum3 = 0;\n for (let i = 0; i < n; i++) {\n const v = values[i] - valuesMean;\n sum2 += Math.pow(v, 2);\n sum3 += Math.pow(v, 3);\n }\n return (1 / n) * sum3 / Math.pow((1 / (n - 1)) * sum2, 3 / 2);\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport {Rank, ShapeMap} from '../types';\n\nimport {buffer} from './buffer';\nimport {op} from './operation';\nimport {RandGamma} from './rand_util';\n\n/**\n * Creates a `tf.Tensor` with values sampled from a gamma distribution.\n *\n * ```js\n * tf.randomGamma([2, 2], 1).print();\n * ```\n *\n * @param shape An array of integers defining the output tensor shape.\n * @param alpha The shape parameter of the gamma distribution.\n * @param beta The inverse scale parameter of the gamma distribution. Defaults\n * to 1.\n * @param dtype The data type of the output. Defaults to float32.\n * @param seed The seed for the random number generator.\n *\n * @doc {heading: 'Tensors', subheading: 'Random'}\n */\nfunction randomGamma_(\n shape: ShapeMap[R], alpha: number, beta = 1,\n dtype: 'float32'|'int32' = 'float32', seed?: number): Tensor {\n if (beta == null) {\n beta = 1;\n }\n if (dtype == null) {\n dtype = 'float32';\n }\n if (dtype !== 'float32' && dtype !== 'int32') {\n throw new Error(`Unsupported data type ${dtype}`);\n }\n const rgamma = new RandGamma(alpha, beta, dtype, seed);\n const res = buffer(shape, dtype);\n for (let i = 0; i < res.values.length; i++) {\n res.values[i] = rgamma.nextValue();\n }\n return res.toTensor();\n}\n\nexport const randomGamma = op({randomGamma_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport {DataType, Rank, ShapeMap} from '../types';\n\nimport {buffer} from './buffer';\nimport {op} from './operation';\nimport {MPRandGauss} from './rand_util';\n\n/**\n * Creates a `tf.Tensor` with values sampled from a normal distribution.\n *\n * ```js\n * tf.randomNormal([2, 2]).print();\n * ```\n *\n * @param shape An array of integers defining the output tensor shape.\n * @param mean The mean of the normal distribution.\n * @param stdDev The standard deviation of the normal distribution.\n * @param dtype The data type of the output.\n * @param seed The seed for the random number generator.\n *\n * @doc {heading: 'Tensors', subheading: 'Random'}\n */\nfunction randomNormal_(\n shape: ShapeMap[R], mean = 0, stdDev = 1, dtype?: 'float32'|'int32',\n seed?: number): Tensor {\n if (dtype != null && (dtype as DataType) === 'bool') {\n throw new Error(`Unsupported data type ${dtype}`);\n }\n const randGauss =\n new MPRandGauss(mean, stdDev, dtype, false /* truncated */, seed);\n const res = buffer(shape, dtype);\n for (let i = 0; i < res.values.length; i++) {\n res.values[i] = randGauss.nextValue();\n }\n return res.toTensor();\n}\n\nexport const randomNormal = op({randomNormal_});\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport {DataType, Rank, ShapeMap} from '../types';\n\nimport {op} from './operation';\nimport {randomNormal} from './random_normal';\n\n/**\n * Creates a `tf.Tensor` with values sampled from a normal distribution.\n *\n * The generated values will have mean 0 and standard deviation 1.\n *\n * ```js\n * tf.randomStandardNormal([2, 2]).print();\n * ```\n *\n * @param shape An array of integers defining the output tensor shape.\n * @param dtype The data type of the output.\n * @param seed The seed for the random number generator.\n *\n * @doc {heading: 'Tensors', subheading: 'Random'}\n */\nfunction randomStandardNormal_(\n shape: ShapeMap[R], dtype?: 'float32'|'int32', seed?: number): Tensor {\n if (dtype != null && (dtype as DataType) === 'bool') {\n throw new Error(`Unsupported data type ${dtype}`);\n }\n return randomNormal(shape, 0, 1, dtype, seed);\n}\n\nexport const randomStandardNormal = op({randomStandardNormal_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport {DataType, Rank, ShapeMap} from '../types';\n\nimport {buffer} from './buffer';\nimport {op} from './operation';\nimport {UniformRandom} from './rand_util';\n\n/**\n * Creates a `tf.Tensor` with values sampled from a uniform distribution.\n *\n * The generated values follow a uniform distribution in the range [minval,\n * maxval). The lower bound minval is included in the range, while the upper\n * bound maxval is excluded.\n *\n * ```js\n * tf.randomUniform([2, 2]).print();\n * ```\n *\n * @param shape An array of integers defining the output tensor shape.\n * @param minval The lower bound on the range of random values to generate.\n * Defaults to 0.\n * @param maxval The upper bound on the range of random values to generate.\n * Defaults to 1.\n * @param dtype The data type of the output tensor. Defaults to 'float32'.\n *\n * @doc {heading: 'Tensors', subheading: 'Random'}\n */\nfunction randomUniform_(\n shape: ShapeMap[R], minval = 0, maxval = 1, dtype: DataType = 'float32',\n seed?: number|string): Tensor {\n const res = buffer(shape, dtype);\n const random = new UniformRandom(minval, maxval, null, seed);\n for (let i = 0; i < res.values.length; i++) {\n res.values[i] = random.nextValue();\n }\n return res.toTensor();\n}\n\nexport const randomUniform = op({randomUniform_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Range, RangeAttrs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor1D} from '../tensor';\n\n/**\n * Creates a new `tf.Tensor1D` filled with the numbers in the range provided.\n *\n * The tensor is a half-open interval meaning it includes start, but\n * excludes stop. Decrementing ranges and negative step values are also\n * supported.\n *\n *\n * ```js\n * tf.range(0, 9, 2).print();\n * ```\n *\n * @param start An integer start value\n * @param stop An integer stop value\n * @param step An integer increment (will default to 1 or -1)\n * @param dtype The data type of the output tensor. Defaults to 'float32'.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nexport function range(\n start: number, stop: number, step = 1,\n dtype: 'float32'|'int32' = 'float32'): Tensor1D {\n if (step === 0) {\n throw new Error('Cannot have a step of zero');\n }\n\n const attrs: RangeAttrs = {start, stop, step, dtype};\n\n return ENGINE.runKernel(Range, {} /* inputs */, attrs as {} as NamedAttrMap);\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Reciprocal, ReciprocalInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes reciprocal of x element-wise: `1 / x`\n *\n * ```js\n * const x = tf.tensor1d([0, 1, 2]);\n *\n * x.reciprocal().print(); // or tf.reciprocal(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction reciprocal_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'reciprocal');\n\n const inputs: ReciprocalInputs = {x: $x};\n return ENGINE.runKernel(Reciprocal, inputs as {} as NamedTensorMap);\n}\nexport const reciprocal = op({reciprocal_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Relu, ReluInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes rectified linear element-wise: `max(x, 0)`.\n *\n * ```js\n * const x = tf.tensor1d([-1, 2, -3, 4]);\n *\n * x.relu().print(); // or tf.relu(x)\n * ```\n * @param x The input tensor. If the dtype is `bool`, the output dtype will be\n * `int32`.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction relu_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'relu');\n\n const inputs: ReluInputs = {x: $x};\n\n return ENGINE.runKernel(Relu, inputs as {} as NamedTensorMap);\n}\n\nexport const relu = op({relu_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Relu6, Relu6Inputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes rectified linear 6 element-wise: `min(max(x, 0), 6)`.\n *\n * ```js\n * const x = tf.tensor1d([-1, 2, -3, 8]);\n *\n * x.relu6().print(); // or tf.relu6(x)\n * ```\n * @param x The input tensor. If the dtype is `bool`, the output dtype will be\n * `int32`.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction relu6_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'relu6');\n\n const inputs: Relu6Inputs = {x: $x};\n\n return ENGINE.runKernel(Relu6, inputs as {} as NamedTensorMap);\n}\n\nexport const relu6 = op({relu6_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Reverse, ReverseAttrs, ReverseInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Reverses a `tf.Tensor` along a specified axis.\n *\n * Also available are stricter rank-specific methods that assert that `x` is\n * of the given rank:\n * - `tf.reverse1d`\n * - `tf.reverse2d`\n * - `tf.reverse3d`\n * - `tf.reverse4d`\n *\n * Except `tf.reverse1d` (which does not have axis param), all methods have\n * same signature as this method.\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 3, 4]);\n *\n * x.reverse().print();\n * ```\n *\n * ```js\n * const x = tf.tensor2d([1, 2, 3, 4], [2, 2]);\n *\n * const axis = 1;\n * x.reverse(axis).print();\n * ```\n * @param x The input tensor to be reversed.\n * @param axis The set of dimensions to reverse. Must be in the\n * range [-rank(x), rank(x)). Defaults to all axes.\n *\n * @doc {heading: 'Tensors', subheading: 'Slicing and Joining'}\n */\nfunction reverse_(\n x: T|TensorLike, axis?: number|number[]): T {\n const $x = convertToTensor(x, 'x', 'reverse');\n\n const inputs: ReverseInputs = {x: $x};\n const attrs: ReverseAttrs = {dims: axis};\n\n return ENGINE.runKernel(\n Reverse, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const reverse = op({reverse_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor1D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\nimport {op} from './operation';\nimport {reverse} from './reverse';\n\n/**\n * Reverses a `tf.Tensor1D`.\n *\n * @param x The input tensor.\n */\nfunction reverse1d_(x: Tensor1D|TensorLike): Tensor1D {\n const $x = convertToTensor(x, 'x', 'reverse');\n util.assert(\n $x.rank === 1,\n () => `Error in reverse1D: x must be rank 1 but got rank ${$x.rank}.`);\n return reverse($x, 0);\n}\n\nexport const reverse1d = op({reverse1d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor2D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\nimport {op} from './operation';\nimport {reverse} from './reverse';\n\n/**\n * Reverses a `tf.Tensor2D` along a specified axis.\n *\n * @param x The input tensor.\n * @param axis The set of dimensions to reverse. Must be in the\n * range [-rank(x), rank(x)). Defaults to all axes.\n */\nfunction reverse2d_(x: Tensor2D|TensorLike, axis?: number|number[]): Tensor2D {\n const $x = convertToTensor(x, 'x', 'reverse');\n util.assert(\n $x.rank === 2,\n () => `Error in reverse2D: x must be rank 2 but got rank ${$x.rank}.`);\n return reverse($x, axis);\n}\n\nexport const reverse2d = op({reverse2d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor3D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\nimport {op} from './operation';\nimport {reverse} from './reverse';\n\n/**\n * Reverses a `tf.Tensor3D` along a specified axis.\n *\n * @param x The input tensor.\n * @param axis The set of dimensions to reverse. Must be in the\n * range [-rank(x), rank(x)). Defaults to all axes.\n */\nfunction reverse3d_(x: Tensor3D|TensorLike, axis?: number|number[]): Tensor3D {\n const $x = convertToTensor(x, 'x', 'reverse');\n util.assert(\n $x.rank === 3,\n () => `Error in reverse3D: x must be rank 3 but got rank ${$x.rank}.`);\n return reverse($x, axis);\n}\n\nexport const reverse3d = op({reverse3d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor4D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\nimport {op} from './operation';\nimport {reverse} from './reverse';\n\n/**\n * Reverses a `tf.Tensor4D` along a specified axis.\n *\n * @param x The input tensor.\n * @param axis The set of dimensions to reverse. Must be in the\n * range [-rank(x), rank(x)). Defaults to all axes.\n */\nfunction reverse4d_(x: Tensor4D|TensorLike, axis?: number|number[]): Tensor4D {\n const $x = convertToTensor(x, 'x', 'reverse');\n util.assert(\n $x.rank === 4,\n () => `Error in reverse4D: x must be rank 4 but got rank ${$x.rank}.`);\n return reverse($x, axis);\n}\n\nexport const reverse4d = op({reverse4d_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Round, RoundInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes round of input `tf.Tensor` element-wise: `round(x)`.\n * It implements banker's rounding.\n *\n * ```js\n * const x = tf.tensor1d([.6, 1.1, -3.3]);\n *\n * x.round().print(); // or tf.round(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction round_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'round');\n const inputs: RoundInputs = {x: $x};\n\n return ENGINE.runKernel(Round, inputs as {} as NamedTensorMap);\n}\n\nexport const round = op({round_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Rsqrt, RsqrtInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes reciprocal of square root of the input `tf.Tensor` element-wise:\n * `y = 1 / sqrt(x)`\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 4, -1]);\n *\n * x.rsqrt().print(); // or tf.rsqrt(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction rsqrt_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'rsqrt', 'float32');\n\n const inputs: RsqrtInputs = {x: $x};\n\n return ENGINE.runKernel(Rsqrt, inputs as {} as NamedTensorMap);\n}\nexport const rsqrt = op({rsqrt_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Selu, SeluInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes scaled exponential linear element-wise.\n *\n * `x < 0 ? scale * alpha * (exp(x) - 1) : scale * x`\n *\n * ```js\n * const x = tf.tensor1d([-1, 2, -3, 4]);\n *\n * x.selu().print(); // or tf.selu(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction selu_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'selu');\n\n const inputs: SeluInputs = {x: $x};\n\n return ENGINE.runKernel(Selu, inputs as {} as NamedTensorMap);\n}\n\nexport const selu = op({selu_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor3D, Tensor4D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {conv2d} from './conv2d';\nimport {depthwiseConv2d} from './depthwise_conv2d';\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * 2-D convolution with separable filters.\n *\n * Performs a depthwise convolution that acts separately on channels followed\n * by a pointwise convolution that mixes channels. Note that this is\n * separability between dimensions [1, 2] and 3, not spatial separability\n * between dimensions 1 and 2.\n *\n * See\n * [https://www.tensorflow.org/api_docs/python/tf/nn/separable_conv2d](\n * https://www.tensorflow.org/api_docs/python/tf/nn/separable_conv2d)\n * for more details.\n *\n * @param x The input tensor, of rank 4 or rank 3, of shape\n * `[batch, height, width, inChannels]`. If rank 3, batch of 1 is\n * assumed.\n * @param depthwiseFilter The depthwise filter tensor, rank 4, of shape\n * `[filterHeight, filterWidth, inChannels, channelMultiplier]`. This is\n * the filter used in the first step.\n * @param pointwiseFilter The pointwise filter tensor, rank 4, of shape\n * `[1, 1, inChannels * channelMultiplier, outChannels]`. This is\n * the filter used in the second step.\n * @param strides The strides of the convolution: `[strideHeight,\n * strideWidth]`. If strides is a single number, then `strideHeight ==\n * strideWidth`.\n * @param pad The type of padding algorithm.\n * - `same` and stride 1: output will be of same size as input,\n * regardless of filter size.\n * - `valid`: output will be smaller than input if filter is larger\n * than 1x1.\n * - For more info, see this guide:\n * [https://www.tensorflow.org/api_docs/python/tf/nn/convolution](\n * https://www.tensorflow.org/api_docs/python/tf/nn/convolution)\n * @param dilations The dilation rates: `[dilationHeight, dilationWidth]`\n * in which we sample input values across the height and width dimensions\n * in atrous convolution. Defaults to `[1, 1]`. If `rate` is a single\n * number, then `dilationHeight == dilationWidth`. If it is greater than\n * 1, then all values of `strides` must be 1.\n * @param dataFormat: An optional string from: \"NHWC\", \"NCHW\". Defaults to\n * \"NHWC\". Specify the data format of the input and output data. With the\n * default format \"NHWC\", the data is stored in the order of: [batch,\n * height, width, channels]. Only \"NHWC\" is currently supported.\n *\n * @doc {heading: 'Operations', subheading: 'Convolution'}\n */\nfunction separableConv2d_(\n x: T|TensorLike, depthwiseFilter: Tensor4D|TensorLike,\n pointwiseFilter: Tensor4D|TensorLike, strides: [number, number]|number,\n pad: 'valid'|'same', dilation: [number, number]|number = [1, 1],\n dataFormat: 'NHWC'|'NCHW' = 'NHWC'): T {\n const $x = convertToTensor(x, 'x', 'separableConv2d');\n const $depthwiseFilter =\n convertToTensor(depthwiseFilter, 'depthwiseFilter', 'separableConv2d');\n const $pointwiseFilter =\n convertToTensor(pointwiseFilter, 'pointwiseFilter', 'separableConv2d');\n\n let x4D = $x as Tensor4D;\n let reshapedTo4D = false;\n if ($x.rank === 3) {\n reshapedTo4D = true;\n x4D = reshape($x, [1, $x.shape[0], $x.shape[1], $x.shape[2]]);\n }\n\n if (dataFormat === 'NCHW') {\n throw new Error(\n 'separableConv2d currently does not support dataFormat NCHW; only ' +\n 'NHWC is supported');\n }\n\n util.assert(\n x4D.rank === 4,\n () => `Error in separableConv2d: input must be rank 4, but got ` +\n `rank ${x4D.rank}.`);\n util.assert(\n $depthwiseFilter.rank === 4,\n () => `Error in separableConv2d: depthwise filter must be rank 4, but ` +\n `got rank ${$depthwiseFilter.rank}.`);\n util.assert(\n $pointwiseFilter.rank === 4,\n () => `Error in separableConv2d: pointwise filter must be rank 4, but ` +\n `got rank ${$depthwiseFilter.rank}.`);\n util.assert(\n $pointwiseFilter.shape[0] === 1,\n () =>\n `Error in separableConv2d: the first dimension of pointwise filter ` +\n ` must be 1, but got ${$pointwiseFilter.shape[0]}.`);\n util.assert(\n $pointwiseFilter.shape[1] === 1,\n () => `Error in separableConv2d: the second dimension of pointwise ` +\n `filter must be 1, but got ${$pointwiseFilter.shape[1]}.`);\n\n const inChannels = $depthwiseFilter.shape[2];\n const channelMultiplier = $depthwiseFilter.shape[3];\n util.assert(\n $pointwiseFilter.shape[2] === inChannels * channelMultiplier,\n () =>\n `Error in separableConv2d: the third dimension of pointwise filter ` +\n `must be ${inChannels * channelMultiplier}, ` +\n `but got ${$pointwiseFilter.shape[2]}.`);\n\n const depthwise = depthwiseConv2d(\n x4D, $depthwiseFilter, strides, pad, dataFormat, dilation);\n const pointwiseStride = 1;\n const res =\n conv2d(depthwise, $pointwiseFilter, pointwiseStride, 'valid', dataFormat);\n\n if (reshapedTo4D) {\n return reshape(res, [res.shape[1], res.shape[2], res.shape[3]]) as T;\n }\n return res as T;\n}\n\nexport const separableConv2d = op({separableConv2d_});\n","/**\n * @license\n * Copyright 2020 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor, TensorBuffer} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\n/**\n * Computes the difference between two lists of numbers.\n *\n * Given a Tensor `x` and a Tensor `y`, this operation returns a Tensor `out`\n * that represents all values that are in `x` but not in `y`. The returned\n * Tensor `out` is sorted in the same order that the numbers appear in `x`\n * (duplicates are preserved). This operation also returns a Tensor indices that\n * represents the position of each out element in `x`. In other words:\n *\n * `out[i] = x[idx[i]] for i in [0, 1, ..., out.length - 1]`\n *\n * ```js\n * const x = [1, 2, 3, 4, 5, 6];\n * const y = [1, 3, 5];\n *\n * const [out, indices] = await tf.setdiff1dAsync(x, y);\n * out.print(); // [2, 4, 6]\n * indices.print(); // [1, 3, 5]\n * ```\n *\n * @param x 1-D Tensor. Values to keep.\n * @param y 1-D Tensor. Must have the same type as x. Values to exclude in the\n * output.\n * @returns Promise of Tensor tuple [out, indices].\n * out: Tensor with the same type as x.\n * indices: A Tensor of type int32.\n *\n * @doc {heading: 'Tensors', subheading: 'Transformations'}\n */\nasync function setdiff1dAsync_(\n x: Tensor|TensorLike, y: Tensor|TensorLike): Promise<[Tensor, Tensor]> {\n const $x = convertToTensor(x, 'x', 'setdiff1d');\n const $y = convertToTensor(y, 'y', 'setdiff1d');\n\n util.assert(\n $x.dtype === $y.dtype,\n () => `x and y should have the same dtype, but got x (${\n $x.dtype}) and y (${$y.dtype}).`);\n\n util.assert(\n $x.rank === 1, () => `x should be 1D tensor, but got x (${$x.shape}).`);\n\n util.assert(\n $y.rank === 1, () => `y should be 1D tensor, but got y (${$y.shape}).`);\n\n const xVals = await $x.data();\n const yVals = await $y.data();\n const ySet = new Set(yVals);\n\n let outputSize = 0;\n for (let i = 0; i < xVals.length; i++) {\n if (!ySet.has(xVals[i])) {\n outputSize++;\n }\n }\n\n const buffer = new TensorBuffer([outputSize], $x.dtype);\n const indices = new TensorBuffer([outputSize], 'int32');\n for (let i = 0, p = 0; i < xVals.length; i++) {\n if (!ySet.has(xVals[i])) {\n buffer.values[p] = xVals[i];\n indices.values[p] = i;\n p++;\n }\n }\n return [buffer.toTensor(), indices.toTensor()];\n}\nexport const setdiff1dAsync = setdiff1dAsync_;\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Sign, SignInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Returns an element-wise indication of the sign of a number.\n *\n * ```js\n * const x = tf.tensor1d([.6, 1.1, -3.3, NaN, 0]);\n *\n * x.sign().print(); // or tf.sign(x)\n * ```\n * @param x The input Tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction sign_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'sign');\n const inputs: SignInputs = {x: $x};\n return ENGINE.runKernel(Sign, inputs as {} as NamedTensorMap);\n}\nexport const sign = op({sign_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Sin, SinInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes sin of the input Tensor element-wise: `sin(x)`\n *\n * ```js\n * const x = tf.tensor1d([0, Math.PI / 2, Math.PI * 3 / 4]);\n *\n * x.sin().print(); // or tf.sin(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction sin_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'sin', 'float32');\n\n const inputs: SinInputs = {x: $x};\n\n return ENGINE.runKernel(Sin, inputs as {} as NamedTensorMap);\n}\nexport const sin = op({sin_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Sinh, SinhInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes hyperbolic sin of the input `tf.Tensor` element-wise: `sinh(x)`\n *\n * ```js\n * const x = tf.tensor1d([0, 1, -1, .7]);\n *\n * x.sinh().print(); // or tf.sinh(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction sinh_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'sinh');\n const inputs: SinhInputs = {x: $x};\n\n return ENGINE.runKernel(Sinh, inputs as {} as NamedTensorMap);\n}\nexport const sinh = op({sinh_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor1D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\nimport {slice} from './slice';\n\n/**\n * Extracts a 1D slice from 1D array starting at coordinates `begin` and is\n * of length `size`. See `slice` for details.\n */\nfunction slice1d_(\n x: Tensor1D|TensorLike, begin: number, size: number): Tensor1D {\n const $x = convertToTensor(x, 'x', 'slice1d');\n util.assert(\n $x.rank === 1,\n () =>\n `slice1d expects a rank-1 tensor, but got a rank-${$x.rank} tensor`);\n return slice($x, [begin], [size]);\n}\nexport const slice1d = op({slice1d_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor2D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\nimport {slice} from './slice';\n\n/**\n * Extracts a 2D slice from a 2D array starting at coordinates `begin` and\n * is of size `size`. See `slice` for details.\n */\nfunction slice2d_(\n x: Tensor2D|TensorLike, begin: [number, number],\n size: [number, number]): Tensor2D {\n const $x = convertToTensor(x, 'x', 'slice2d');\n util.assert(\n $x.rank === 2,\n () =>\n `slice2d expects a rank-2 tensor, but got a rank-${$x.rank} tensor`);\n return slice($x, begin, size);\n}\nexport const slice2d = op({slice2d_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor3D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\nimport {slice} from './slice';\n\n/**\n * Extracts a 3D slice from a 3D array starting at coordinates `begin` and\n * is of size `size`. See `slice` for details.\n */\nfunction slice3d_(\n x: Tensor3D|TensorLike, begin: [number, number, number],\n size: [number, number, number]): Tensor3D {\n const $x = convertToTensor(x, 'x', 'slice3d');\n util.assert(\n $x.rank === 3,\n () =>\n `slice3d expects a rank-3 tensor, but got a rank-${$x.rank} tensor`);\n return slice($x, begin, size);\n}\nexport const slice3d = op({slice3d_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor4D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\nimport {slice} from './slice';\n\n/**\n * Extracts a 4D slice from a 4D array starting at coordinates `begin` and\n * is of size `size`. See `slice` for details.\n */\nfunction slice4d_(\n x: Tensor4D|TensorLike, begin: [number, number, number, number],\n size: [number, number, number, number]): Tensor4D {\n const $x = convertToTensor(x, 'x', 'slice4d');\n util.assert(\n $x.rank === 4,\n () =>\n `slice4d expects a rank-4 tensor, but got a rank-${$x.rank} tensor`);\n return slice($x, begin, size);\n}\nexport const slice4d = op({slice4d_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Softmax, SoftmaxAttrs, SoftmaxInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes the softmax normalized vector given the logits.\n *\n * ```js\n * const a = tf.tensor1d([1, 2, 3]);\n *\n * a.softmax().print(); // or tf.softmax(a)\n * ```\n *\n * ```js\n * const a = tf.tensor2d([2, 4, 6, 1, 2, 3], [2, 3]);\n *\n * a.softmax().print(); // or tf.softmax(a)\n * ```\n *\n * @param logits The logits array.\n * @param dim The dimension softmax would be performed on. Defaults to `-1`\n * which indicates the last dimension.\n *\n * @doc {heading: 'Operations', subheading: 'Normalization'}\n */\nfunction softmax_(logits: T|TensorLike, dim = -1): T {\n const $logits = convertToTensor(logits, 'logits', 'softmax', 'float32');\n\n if (dim === -1) {\n dim = $logits.rank - 1;\n }\n if (dim !== $logits.rank - 1) {\n throw Error(\n 'Softmax along a non-last dimension is not yet supported. ' +\n `Logits was rank ${$logits.rank} and dim was ${dim}`);\n }\n\n const inputs: SoftmaxInputs = {logits: $logits};\n const attrs: SoftmaxAttrs = {dim};\n\n return ENGINE.runKernel(\n Softmax, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const softmax = op({softmax_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {FFT, FFTInputs} from '../../kernel_names';\nimport {Tensor} from '../../tensor';\nimport {NamedTensorMap} from '../../tensor_types';\nimport {assert} from '../../util';\nimport {op} from '../operation';\n\n/**\n * Fast Fourier transform.\n *\n * Computes the 1-dimensional discrete Fourier transform over the inner-most\n * dimension of input.\n *\n * ```js\n * const real = tf.tensor1d([1, 2, 3]);\n * const imag = tf.tensor1d([1, 2, 3]);\n * const x = tf.complex(real, imag);\n *\n * x.fft().print(); // tf.spectral.fft(x).print();\n * ```\n * @param input The complex input to compute an fft over.\n *\n * @doc {heading: 'Operations', subheading: 'Spectral', namespace: 'spectral'}\n */\nfunction fft_(input: Tensor): Tensor {\n assert(\n input.dtype === 'complex64',\n () => `The dtype for tf.spectral.fft() must be complex64 ` +\n `but got ${input.dtype}.`);\n\n const inputs: FFTInputs = {input};\n\n return ENGINE.runKernel(FFT, inputs as {} as NamedTensorMap);\n}\n\nexport const fft = op({fft_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {IFFT, IFFTInputs} from '../../kernel_names';\nimport {Tensor} from '../../tensor';\nimport {NamedTensorMap} from '../../tensor_types';\nimport {assert} from '../../util';\nimport {op} from '../operation';\n\n/**\n * Inverse fast Fourier transform.\n *\n * Computes the inverse 1-dimensional discrete Fourier transform over the\n * inner-most dimension of input.\n *\n * ```js\n * const real = tf.tensor1d([1, 2, 3]);\n * const imag = tf.tensor1d([1, 2, 3]);\n * const x = tf.complex(real, imag);\n *\n * x.ifft().print(); // tf.spectral.ifft(x).print();\n * ```\n * @param input The complex input to compute an ifft over.\n *\n * @doc {heading: 'Operations', subheading: 'Spectral', namespace: 'spectral'}\n */\nfunction ifft_(input: Tensor): Tensor {\n assert(\n input.dtype === 'complex64',\n () => `The dtype for tf.spectral.ifft() must be complex64 ` +\n `but got ${input.dtype}.`);\n\n const inputs: IFFTInputs = {input};\n\n return ENGINE.runKernel(IFFT, inputs as {} as NamedTensorMap);\n}\n\nexport const ifft = op({ifft_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor, Tensor2D} from '../../tensor';\nimport {complex} from '../complex';\nimport {concat} from '../concat';\nimport {imag} from '../imag';\nimport {mul} from '../mul';\nimport {op} from '../operation';\nimport {real} from '../real';\nimport {reshape} from '../reshape';\nimport {reverse} from '../reverse';\nimport {scalar} from '../scalar';\nimport {slice} from '../slice';\n\nimport {ifft} from './ifft';\n\n/**\n * Inversed real value input fast Fourier transform.\n *\n * Computes the 1-dimensional inversed discrete Fourier transform over the\n * inner-most dimension of the real input.\n *\n * ```js\n * const real = tf.tensor1d([1, 2, 3]);\n * const imag = tf.tensor1d([0, 0, 0]);\n * const x = tf.complex(real, imag);\n *\n * x.irfft().print();\n * ```\n * @param input The real value input to compute an irfft over.\n *\n * @doc {heading: 'Operations', subheading: 'Spectral', namespace: 'spectral'}\n */\nfunction irfft_(input: Tensor): Tensor {\n const innerDimensionSize = input.shape[input.shape.length - 1];\n const batch = input.size / innerDimensionSize;\n let ret: Tensor;\n if (innerDimensionSize <= 2) {\n const complexInput = reshape(input, [batch, innerDimensionSize]);\n ret = ifft(complexInput);\n } else {\n // The length of unique components of the DFT of a real-valued signal\n // is 2 * (input_len - 1)\n const outputShape = [batch, 2 * (innerDimensionSize - 1)];\n const realInput = reshape(real(input), [batch, innerDimensionSize]);\n const imagInput = reshape(imag(input), [batch, innerDimensionSize]);\n\n const realConjugate =\n reverse(slice(realInput, [0, 1], [batch, innerDimensionSize - 2]), 1);\n const imagConjugate: Tensor2D = mul(\n reverse(slice(imagInput, [0, 1], [batch, innerDimensionSize - 2]), 1),\n scalar(-1));\n\n const r = concat([realInput, realConjugate], 1);\n const i = concat([imagInput, imagConjugate], 1);\n const complexInput =\n reshape(complex(r, i), [outputShape[0], outputShape[1]]);\n ret = ifft(complexInput);\n }\n ret = real(ret);\n // reshape the result if the input is 3D tensor.\n if (input.rank === 3 && input.shape[0] !== 0) {\n const temp = ret;\n const batch = input.shape[0];\n ret = reshape(ret, [batch, ret.shape[0] / batch, ret.shape[1]]);\n temp.dispose();\n }\n return ret;\n}\n\nexport const irfft = op({irfft_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {SplitV, SplitVAttrs, SplitVInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Splits a `tf.Tensor` into sub tensors.\n *\n * If `numOrSizeSplits` is a number, splits `x` along dimension `axis`\n * into `numOrSizeSplits` smaller tensors.\n * Requires that `numOrSizeSplits` evenly divides `x.shape[axis]`.\n *\n * If `numOrSizeSplits` is a number array, splits `x` into\n * `numOrSizeSplits.length` pieces. The shape of the `i`-th piece has the\n * same size as `x` except along dimension `axis` where the size is\n * `numOrSizeSplits[i]`.\n *\n * ```js\n * const x = tf.tensor2d([1, 2, 3, 4, 5, 6, 7, 8], [2, 4]);\n * const [a, b] = tf.split(x, 2, 1);\n * a.print();\n * b.print();\n *\n * const [c, d, e] = tf.split(x, [1, 2, 1], 1);\n * c.print();\n * d.print();\n * e.print();\n * ```\n *\n * @param x The input tensor to split.\n * @param numOrSizeSplits Either an integer indicating the number of\n * splits along the axis or an array of integers containing the sizes of\n * each output tensor along the axis. If a number then it must evenly divide\n * `x.shape[axis]`; otherwise the sum of sizes must match `x.shape[axis]`.\n * Can contain one -1 indicating that dimension is to be inferred.\n * @param axis The dimension along which to split. Defaults to 0 (the first\n * dim).\n *\n * @doc {heading: 'Tensors', subheading: 'Slicing and Joining'}\n */\nfunction split_(\n x: Tensor|TensorLike, numOrSizeSplits: number[]|number, axis = 0): T[] {\n const $x = convertToTensor(x, 'x', 'split');\n\n const inputs: SplitVInputs = {x: $x};\n const attr: SplitVAttrs = {numOrSizeSplits, axis};\n\n return ENGINE.runKernel(\n SplitV, inputs as {} as NamedTensorMap,\n attr as {} as NamedAttrMap) as {} as T[];\n}\n\nexport const split = op({split_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../../tensor';\nimport {assert} from '../../util';\nimport {complex} from '../complex';\nimport {concat} from '../concat';\nimport {imag} from '../imag';\nimport {op} from '../operation';\nimport {real} from '../real';\nimport {reshape} from '../reshape';\nimport {slice} from '../slice';\nimport {split} from '../split';\nimport {zeros} from '../zeros';\nimport {zerosLike} from '../zeros_like';\n\nimport {fft} from './fft';\n\n/**\n * Real value input fast Fourier transform.\n *\n * Computes the 1-dimensional discrete Fourier transform over the\n * inner-most dimension of the real input.\n *\n * ```js\n * const real = tf.tensor1d([1, 2, 3]);\n *\n * real.rfft().print();\n * ```\n * @param input The real value input to compute an rfft over.\n *\n * @doc {heading: 'Operations', subheading: 'Spectral', namespace: 'spectral'}\n */\nfunction rfft_(input: Tensor, fftLength?: number): Tensor {\n assert(\n input.dtype === 'float32',\n () => `The dtype for rfft() must be real value but got ${input.dtype}`);\n\n let innerDimensionSize = input.shape[input.shape.length - 1];\n const batch = input.size / innerDimensionSize;\n\n let adjustedInput: Tensor;\n if (fftLength != null && fftLength < innerDimensionSize) {\n // Need to crop\n const begin = input.shape.map(v => 0);\n const size = input.shape.map(v => v);\n size[input.shape.length - 1] = fftLength;\n adjustedInput = slice(input, begin, size);\n innerDimensionSize = fftLength;\n } else if (fftLength != null && fftLength > innerDimensionSize) {\n // Need to pad with zeros\n const zerosShape = input.shape.map(v => v);\n zerosShape[input.shape.length - 1] = fftLength - innerDimensionSize;\n adjustedInput = concat([input, zeros(zerosShape)], input.shape.length - 1);\n innerDimensionSize = fftLength;\n } else {\n adjustedInput = input;\n }\n\n // Complement the input with zero imaginary numbers.\n const zerosInput = zerosLike(adjustedInput);\n const complexInput =\n reshape(complex(adjustedInput, zerosInput), [batch, innerDimensionSize]);\n\n const ret = fft(complexInput);\n\n // Exclude complex conjugations. These conjugations are put symmetrically.\n const half = Math.floor(innerDimensionSize / 2) + 1;\n const realValues = real(ret);\n const imagValues = imag(ret);\n const realComplexConjugate = split(\n realValues, [half, innerDimensionSize - half],\n realValues.shape.length - 1);\n const imagComplexConjugate = split(\n imagValues, [half, innerDimensionSize - half],\n imagValues.shape.length - 1);\n\n const outputShape = adjustedInput.shape.slice();\n outputShape[adjustedInput.shape.length - 1] = half;\n\n return reshape(\n complex(realComplexConjugate[0], imagComplexConjugate[0]), outputShape);\n}\n\nexport const rfft = op({rfft_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {SquaredDifference, SquaredDifferenceInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {assertAndGetBroadcastShape} from './broadcast_util';\nimport {op} from './operation';\n\n/**\n * Returns (a - b) * (a - b) element-wise.\n * Supports broadcasting.\n *\n * ```js\n * const a = tf.tensor1d([1, 4, 3, 16]);\n * const b = tf.tensor1d([1, 2, 9, 4]);\n *\n * a.squaredDifference(b).print(); // or tf.squaredDifference(a, b)\n * ```\n *\n * ```js\n * // Broadcast squared difference a with b.\n * const a = tf.tensor1d([2, 4, 6, 8]);\n * const b = tf.scalar(5);\n *\n * a.squaredDifference(b).print(); // or tf.squaredDifference(a, b)\n * ```\n *\n * @param a The first tensor.\n * @param b The second tensor. Must have the same type as `a`.\n *\n * @doc {heading: 'Operations', subheading: 'Arithmetic'}\n */\nfunction squaredDifference_(\n a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n let $a = convertToTensor(a, 'a', 'squaredDifference');\n let $b = convertToTensor(b, 'b', 'squaredDifference');\n [$a, $b] = makeTypesMatch($a, $b);\n\n assertAndGetBroadcastShape($a.shape, $b.shape);\n\n const inputs: SquaredDifferenceInputs = {a: $a, b: $b};\n const attrs = {};\n\n return ENGINE.runKernel(\n SquaredDifference, inputs as unknown as NamedTensorMap, attrs);\n}\n\nexport const squaredDifference = op({squaredDifference_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {squeezeShape} from '../util';\n\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * Removes dimensions of size 1 from the shape of a `tf.Tensor`.\n *\n * ```js\n * const x = tf.tensor([1, 2, 3, 4], [1, 1, 4]);\n * x.squeeze().print();\n * ```\n *\n * @param x The input tensor to be squeezed.\n * @param axis An optional list of numbers. If specified, only\n * squeezes the dimensions listed. The dimension index starts at 0. It\n * is an error to squeeze a dimension that is not 1.\n *\n * @doc {heading: 'Tensors', subheading: 'Transformations'}\n */\nfunction squeeze_(x: Tensor|TensorLike, axis?: number[]): T {\n const $x = convertToTensor(x, 'x', 'squeeze', 'string_or_numeric');\n return reshape($x, squeezeShape($x.shape, axis).newShape) as T;\n}\n\nexport const squeeze = op({squeeze_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Pack, PackAttrs, PackInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensorArray} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\n\n/**\n * Stacks a list of rank-`R` `tf.Tensor`s into one rank-`(R+1)` `tf.Tensor`.\n *\n * ```js\n * const a = tf.tensor1d([1, 2]);\n * const b = tf.tensor1d([3, 4]);\n * const c = tf.tensor1d([5, 6]);\n * tf.stack([a, b, c]).print();\n * ```\n *\n * @param tensors A list of tensor objects with the same shape and dtype.\n * @param axis The axis to stack along. Defaults to 0 (the first dim).\n *\n * @doc {heading: 'Tensors', subheading: 'Slicing and Joining'}\n */\nfunction stack_(\n tensors: Array, axis = 0): Tensor {\n const $tensors =\n convertToTensorArray(tensors, 'tensors', 'stack', 'string_or_numeric');\n\n util.assert(\n $tensors.length >= 1, () => 'Pass at least one tensor to tf.stack');\n\n if ($tensors.length > 0) {\n util.assert(\n axis <= $tensors[0].rank, () => 'Axis must be <= rank of the tensor');\n }\n\n const inputs: PackInputs = $tensors;\n const attrs: PackAttrs = {axis};\n\n return ENGINE.runKernel(\n Pack, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const stack = op({stack_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Step, StepAttrs, StepInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes step of the input `tf.Tensor` element-wise: `x > 0 ? 1 : alpha * x`\n *\n * ```js\n * const x = tf.tensor1d([0, 2, -1, -3]);\n *\n * x.step(.5).print(); // or tf.step(x, .5)\n * ```\n * @param x The input tensor.\n * @param alpha The gradient when input is negative.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction step_(x: T|TensorLike, alpha = 0.0): T {\n const $x = convertToTensor(x, 'x', 'step');\n\n const inputs: StepInputs = {x: $x};\n const attrs: StepAttrs = {alpha};\n\n return ENGINE.runKernel(\n Step, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\nexport const step = op({step_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {StridedSlice, StridedSliceAttrs, StridedSliceInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Extracts a strided slice of a tensor.\n *\n * Roughly speaking, this op extracts a slice of size (end-begin)/stride from\n * the given input tensor (x). Starting at the location specified by begin the\n * slice continues by adding stride to the index until all dimensions are not\n * less than end. Note that a stride can be negative, which causes a reverse\n * slice.\n *\n * ```js\n * const t = tf.tensor3d([1, 1, 1 ,2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6],\n * [3, 2, 3]);\n * t.stridedSlice([1, 0, 0], [2, 1, 3], [1, 1, 1]).print() // [[[3, 3, 3]]]\n * t.stridedSlice([1, 0, 0], [2, 2, 3], [1, 1, 1]).print() // [[[3, 3, 3],\n * // [4, 4, 4]]]\n * t.stridedSlice([1, -1, 0], [2, -3, 3], [1, -1, 1]).print() // [[[4, 4, 4],\n * // [3, 3, 3]]]\n * ```\n *\n * @param x The tensor to stride slice.\n * @param begin The coordinates to start the slice from.\n * @param end: The coordinates to end the slice at.\n * @param strides: The size of the slice.\n * @param beginMask: If the ith bit of beginMask is set, begin[i] is ignored\n * and the fullest possible range in that dimension is used instead.\n * @param endMask: If the ith bit of endMask is set, end[i] is ignored\n * and the fullest possible range in that dimension is used instead.\n * @param shrinkAxisMask: a bitmask where bit i implies that\n * the ith specification should shrink the dimensionality. begin and end must\n * imply a slice of size 1 in the dimension.\n *\n * @doc {heading: 'Operations', subheading: 'Slicing and Joining'}\n */\nfunction stridedSlice_(\n x: Tensor|TensorLike, begin: number[], end: number[], strides?: number[],\n beginMask = 0, endMask = 0, ellipsisMask = 0, newAxisMask = 0,\n shrinkAxisMask = 0): Tensor {\n const $x = convertToTensor(x, 'x', 'stridedSlice', 'string_or_numeric');\n\n const inputs: StridedSliceInputs = {x: $x};\n const attrs: StridedSliceAttrs = {\n begin,\n end,\n strides,\n beginMask,\n endMask,\n ellipsisMask,\n newAxisMask,\n shrinkAxisMask\n };\n\n return ENGINE.runKernel(\n StridedSlice, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap);\n}\n\nexport const stridedSlice = op({stridedSlice_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Tan, TanInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes tan of the input `tf.Tensor` element-wise, `tan(x)`\n *\n * ```js\n * const x = tf.tensor1d([0, Math.PI / 2, Math.PI * 3 / 4]);\n *\n * x.tan().print(); // or tf.tan(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction tan_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'tan', 'float32');\n\n const inputs: TanInputs = {x: $x};\n\n return ENGINE.runKernel(Tan, inputs as {} as NamedTensorMap);\n}\nexport const tan = op({tan_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor1D} from '../tensor';\nimport {inferShape} from '../tensor_util_env';\nimport {TensorLike1D} from '../types';\nimport {DataType} from '../types';\nimport {assertNonNull} from '../util';\nimport {makeTensor} from './tensor_ops_util';\n\n/**\n * Creates rank-1 `tf.Tensor` with the provided values, shape and dtype.\n *\n * The same functionality can be achieved with `tf.tensor`, but in general\n * we recommend using `tf.tensor1d` as it makes the code more readable.\n *\n * ```js\n * tf.tensor1d([1, 2, 3]).print();\n * ```\n *\n * @param values The values of the tensor. Can be array of numbers,\n * or a `TypedArray`.\n * @param dtype The data type.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nexport function tensor1d(values: TensorLike1D, dtype?: DataType): Tensor1D {\n assertNonNull(values);\n const inferredShape = inferShape(values, dtype);\n if (inferredShape.length !== 1) {\n throw new Error('tensor1d() requires values to be a flat/TypedArray');\n }\n const shape: number[] = null;\n return makeTensor(values, shape, inferredShape, dtype) as Tensor1D;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor2D} from '../tensor';\nimport {inferShape} from '../tensor_util_env';\nimport {TensorLike2D} from '../types';\nimport {DataType} from '../types';\nimport {assertNonNull} from '../util';\nimport {makeTensor} from './tensor_ops_util';\n\n/**\n * Creates rank-2 `tf.Tensor` with the provided values, shape and dtype.\n *\n * The same functionality can be achieved with `tf.tensor`, but in general\n * we recommend using `tf.tensor2d` as it makes the code more readable.\n *\n * ```js\n * // Pass a nested array.\n * tf.tensor2d([[1, 2], [3, 4]]).print();\n * ```\n * ```js\n * // Pass a flat array and specify a shape.\n * tf.tensor2d([1, 2, 3, 4], [2, 2]).print();\n * ```\n *\n * @param values The values of the tensor. Can be nested array of numbers,\n * or a flat array, or a `TypedArray`.\n * @param shape The shape of the tensor. If not provided, it is inferred from\n * `values`.\n * @param dtype The data type.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nexport function tensor2d(\n values: TensorLike2D, shape?: [number, number],\n dtype?: DataType): Tensor2D {\n assertNonNull(values);\n if (shape != null && shape.length !== 2) {\n throw new Error('tensor2d() requires shape to have two numbers');\n }\n const inferredShape = inferShape(values, dtype);\n if (inferredShape.length !== 2 && inferredShape.length !== 1) {\n throw new Error(\n 'tensor2d() requires values to be number[][] or flat/TypedArray');\n }\n if (inferredShape.length === 1 && shape == null) {\n throw new Error(\n 'tensor2d() requires shape to be provided when `values` ' +\n 'are a flat/TypedArray');\n }\n return makeTensor(values, shape, inferredShape, dtype) as Tensor2D;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor4D} from '../tensor';\nimport {inferShape} from '../tensor_util_env';\nimport {TensorLike4D} from '../types';\nimport {DataType} from '../types';\nimport {assertNonNull} from '../util';\nimport {makeTensor} from './tensor_ops_util';\n\n/**\n * Creates rank-4 `tf.Tensor` with the provided values, shape and dtype.\n *\n * The same functionality can be achieved with `tf.tensor`, but in general\n * we recommend using `tf.tensor4d` as it makes the code more readable.\n *\n * ```js\n * // Pass a nested array.\n * tf.tensor4d([[[[1], [2]], [[3], [4]]]]).print();\n * ```\n * ```js\n * // Pass a flat array and specify a shape.\n * tf.tensor4d([1, 2, 3, 4], [1, 2, 2, 1]).print();\n * ```\n *\n * @param values The values of the tensor. Can be nested array of numbers,\n * or a flat array, or a `TypedArray`.\n * @param shape The shape of the tensor. Optional. If not provided,\n * it is inferred from `values`.\n * @param dtype The data type.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nexport function tensor4d(\n values: TensorLike4D, shape?: [number, number, number, number],\n dtype?: DataType): Tensor4D {\n assertNonNull(values);\n if (shape != null && shape.length !== 4) {\n throw new Error('tensor4d() requires shape to have four numbers');\n }\n const inferredShape = inferShape(values, dtype);\n if (inferredShape.length !== 4 && inferredShape.length !== 1) {\n throw new Error(\n 'tensor4d() requires values to be number[][][][] or flat/TypedArray');\n }\n if (inferredShape.length === 1 && shape == null) {\n throw new Error(\n 'tensor4d() requires shape to be provided when `values` ' +\n 'are a flat array');\n }\n return makeTensor(values, shape, inferredShape, dtype) as Tensor4D;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor5D} from '../tensor';\nimport {inferShape} from '../tensor_util_env';\nimport {TensorLike5D} from '../types';\nimport {DataType} from '../types';\nimport {assertNonNull} from '../util';\nimport {makeTensor} from './tensor_ops_util';\n\n/**\n * Creates rank-5 `tf.Tensor` with the provided values, shape and dtype.\n *\n * The same functionality can be achieved with `tf.tensor`, but in general\n * we recommend using `tf.tensor5d` as it makes the code more readable.\n *\n * ```js\n * // Pass a nested array.\n * tf.tensor5d([[[[[1],[2]],[[3],[4]]],[[[5],[6]],[[7],[8]]]]]).print();\n * ```\n * ```js\n * // Pass a flat array and specify a shape.\n * tf.tensor5d([1, 2, 3, 4, 5, 6, 7, 8], [1, 2, 2, 2, 1]).print();\n * ```\n *\n * @param values The values of the tensor. Can be nested array of numbers,\n * or a flat array, or a `TypedArray`.\n * @param shape The shape of the tensor. Optional. If not provided,\n * it is inferred from `values`.\n * @param dtype The data type.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nexport function tensor5d(\n values: TensorLike5D, shape?: [number, number, number, number, number],\n dtype?: DataType): Tensor5D {\n assertNonNull(values);\n if (shape != null && shape.length !== 5) {\n throw new Error('tensor5d() requires shape to have five numbers');\n }\n const inferredShape = inferShape(values, dtype);\n if (inferredShape.length !== 5 && inferredShape.length !== 1) {\n throw new Error(\n 'tensor5d() requires values to be ' +\n 'number[][][][][] or flat/TypedArray');\n }\n if (inferredShape.length === 1 && shape == null) {\n throw new Error(\n 'tensor5d() requires shape to be provided when `values` ' +\n 'are a flat array');\n }\n return makeTensor(values, shape, inferredShape, dtype) as Tensor5D;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor6D} from '../tensor';\nimport {inferShape} from '../tensor_util_env';\nimport {TensorLike6D} from '../types';\nimport {DataType} from '../types';\nimport {assertNonNull} from '../util';\nimport {makeTensor} from './tensor_ops_util';\n\n/**\n * Creates rank-6 `tf.Tensor` with the provided values, shape and dtype.\n *\n * The same functionality can be achieved with `tf.tensor`, but in general\n * we recommend using `tf.tensor6d` as it makes the code more readable.\n *\n * ```js\n * // Pass a nested array.\n * tf.tensor6d([[[[[[1],[2]],[[3],[4]]],[[[5],[6]],[[7],[8]]]]]]).print();\n * ```\n * ```js\n * // Pass a flat array and specify a shape.\n * tf.tensor6d([1, 2, 3, 4, 5, 6, 7, 8], [1, 1, 2, 2, 2, 1]).print();\n * ```\n *\n * @param values The values of the tensor. Can be nested array of numbers,\n * or a flat array, or a `TypedArray`.\n * @param shape The shape of the tensor. Optional. If not provided,\n * it is inferred from `values`.\n * @param dtype The data type.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nexport function tensor6d(\n values: TensorLike6D,\n shape?: [number, number, number, number, number, number],\n dtype?: DataType): Tensor6D {\n assertNonNull(values);\n if (shape != null && shape.length !== 6) {\n throw new Error('tensor6d() requires shape to have six numbers');\n }\n const inferredShape = inferShape(values, dtype);\n if (inferredShape.length !== 6 && inferredShape.length !== 1) {\n throw new Error(\n 'tensor6d() requires values to be number[][][][][][] or ' +\n 'flat/TypedArray');\n }\n if (inferredShape.length === 1 && shape == null) {\n throw new Error(\n 'tensor6d() requires shape to be provided when `values` ' +\n 'are a flat array');\n }\n shape = shape ||\n inferredShape as [number, number, number, number, number, number];\n return makeTensor(values, shape, inferredShape, dtype) as Tensor6D;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {TopK, TopKAttrs, TopKInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Finds the values and indices of the `k` largest entries along the last\n * dimension.\n *\n * If the input is a vector (rank=1), finds the k largest entries in the vector\n * and outputs their values and indices as vectors. Thus values[j] is the j-th\n * largest entry in input, and its index is indices[j].\n * For higher rank inputs, computes the top k entries along the last dimension.\n *\n * If two elements are equal, the lower-index element appears first.\n *\n * ```js\n * const a = tf.tensor2d([[1, 5], [4, 3]]);\n * const {values, indices} = tf.topk(a);\n * values.print();\n * indices.print();\n * ```\n * @param x 1-D or higher `tf.Tensor` with last dimension being at least `k`.\n * @param k Number of top elements to look for along the last dimension.\n * @param sorted If true, the resulting `k` elements will be sorted by the\n * values in descending order.\n *\n * @doc {heading: 'Operations', subheading: 'Evaluation'}\n */\nfunction topk_(\n x: T|TensorLike, k = 1, sorted = true): {values: T, indices: T} {\n const $x = convertToTensor(x, 'x', 'topk');\n if ($x.rank === 0) {\n throw new Error('topk() expects the input to be of rank 1 or higher');\n }\n const lastDim = $x.shape[$x.shape.length - 1];\n\n if (k < 0) {\n throw new Error(`'k' passed to topk() must be >= 0 but got ${k}`);\n }\n\n if (k > lastDim) {\n throw new Error(\n `'k' passed to topk() must be <= the last dimension (${lastDim}) ` +\n `but got ${k}`);\n }\n\n const inputs: TopKInputs = {x: $x};\n const attrs: TopKAttrs = {k, sorted};\n\n const [values, indices] = ENGINE.runKernel(\n TopK, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap) as\n [T, T];\n\n return {values, indices};\n}\n\nexport const topk = op({topk_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport {DataType, Rank, ShapeMap} from '../types';\n\nimport {buffer} from './buffer';\nimport {op} from './operation';\nimport {MPRandGauss} from './rand_util';\n\n/**\n * Creates a `tf.Tensor` with values sampled from a truncated normal\n * distribution.\n *\n * ```js\n * tf.truncatedNormal([2, 2]).print();\n * ```\n *\n * The generated values follow a normal distribution with specified mean and\n * standard deviation, except that values whose magnitude is more than 2\n * standard deviations from the mean are dropped and re-picked.\n *\n * @param shape An array of integers defining the output tensor shape.\n * @param mean The mean of the normal distribution.\n * @param stdDev The standard deviation of the normal distribution.\n * @param dtype The data type of the output tensor.\n * @param seed The seed for the random number generator.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nfunction truncatedNormal_(\n shape: ShapeMap[R], mean = 0, stdDev = 1, dtype?: 'float32'|'int32',\n seed?: number): Tensor {\n if (dtype != null && (dtype as DataType) === 'bool') {\n throw new Error(`Unsupported data type $ { dtype }`);\n }\n const randGauss =\n new MPRandGauss(mean, stdDev, dtype, true /* truncated */, seed);\n const res = buffer(shape, dtype);\n for (let i = 0; i < res.values.length; i++) {\n res.values[i] = randGauss.nextValue();\n }\n return res.toTensor();\n}\n\nexport const truncatedNormal = op({truncatedNormal_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Unique, UniqueAttrs, UniqueInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor, Tensor1D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {assert} from '../util';\n\nimport {op} from './operation';\n\n/**\n * Finds unique elements along an axis of a tensor.\n *\n * It returns a tensor `values` containing all of the unique elements along the\n * `axis` of the given tensor `x` in the same order that they occur along the\n * `axis` in `x`; `x` does not need to be sorted. It also returns a tensor\n * `indices` the same size as the number of the elements in `x` along the `axis`\n * dimension. It contains the index in the unique output `values`.\n *\n * ```js\n * // A 1-D tensor\n * const a = tf.tensor1d([1, 1, 2, 4, 4, 4, 7, 8, 8]);\n * const {values, indices} = tf.unique(a);\n * values.print(); // [1, 2, 4, 7, 8,]\n * indices.print(); // [0, 0, 1, 2, 2, 2, 3, 4, 4]\n * ```\n *\n * ```js\n * // A 2-D tensor with axis=0\n * //\n * // 'a' is: [[1, 0, 0],\n * // [1, 0, 0],\n * // [2, 0, 0]]\n * const a = tf.tensor2d([[1, 0, 0], [1, 0, 0], [2, 0, 0]]);\n * const {values, indices} = tf.unique(a, 0)\n * values.print(); // [[1, 0, 0],\n * // [2, 0, 0]]\n * indices.print(); // [0, 0, 1]\n * ```\n *\n * ```js\n * // A 2-D tensor with axis=1\n * //\n * // 'a' is: [[1, 0, 0],\n * // [1, 0, 0],\n * // [2, 0, 0]]\n * const a = tf.tensor2d([[1, 0, 0], [1, 0, 0], [2, 0, 0]]);\n * const {values, indices} = tf.unique(a, 1)\n * values.print(); // [[1, 0],\n * // [1, 0],\n * // [2, 0]]\n * indices.print(); // [0, 1, 1]\n * ```\n * @param x A tensor (int32, string, bool).\n * @param axis The axis of the tensor to find the unique elements.\n * @returns [uniqueElements, indices] (see above for details)\n *\n * @doc {heading: 'Operations', subheading: 'Evaluation'}\n */\nfunction unique_(\n x: T|TensorLike, axis = 0): {values: T, indices: Tensor1D} {\n const $x = convertToTensor(x, 'x', 'unique', 'string_or_numeric');\n assert($x.rank > 0, () => 'The input tensor must be at least 1D');\n\n const inputs: UniqueInputs = {x: $x};\n const attrs: UniqueAttrs = {axis};\n const [values, indices] = ENGINE.runKernel(\n Unique, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as [T, Tensor1D];\n return {values, indices};\n}\n\nexport const unique = op({unique_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {UnsortedSegmentSum, UnsortedSegmentSumAttrs, UnsortedSegmentSumInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor, Tensor1D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {assert, isInt} from '../util';\n\nimport {op} from './operation';\n\n/**\n * Computes the sum along segments of a `tf.Tensor`.\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 3, 4]);\n * const segmentIds = tf.tensor1d([1, 2, 0, 1], 'int32');\n * const numSegments = 3;\n *\n * x.unsortedSegmentSum(segmentIds, numSegments).print()\n * //or tf.unsortedSegmentSum(x, segmentIds, numSegments)\n * ```\n * @param x The `tf.Tensor` that will be summed along its segments.\n * @param segmentIds A `tf.Tensor1D` whose rank is equal to the rank of `x`'s\n * dimension along the `axis`. Maps each element of `x` to a segment.\n * @param numSegments The number of distinct `segmentIds`.\n *\n * @doc {heading: 'Operations', subheading: 'Segment'}\n */\nfunction unsortedSegmentSum_(\n x: T|TensorLike, segmentIds: Tensor1D|TensorLike, numSegments: number): T {\n const $x = convertToTensor(x, 'x', 'unsortedSegmentSum');\n const $segmentIds =\n convertToTensor(segmentIds, 'segmentIds', 'unsortedSegmentSum', 'int32');\n assert(isInt(numSegments), () => 'numSegments must be of dtype int');\n\n const inputs: UnsortedSegmentSumInputs = {x: $x, segmentIds: $segmentIds};\n const attrs: UnsortedSegmentSumAttrs = {numSegments};\n\n return ENGINE.runKernel(\n UnsortedSegmentSum, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap);\n}\n\nexport const unsortedSegmentSum = op({unsortedSegmentSum_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Unpack, UnpackAttrs, UnpackInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\n\n/**\n * Unstacks a `tf.Tensor` of rank-`R` into a list of rank-`(R-1)` `tf.Tensor`s.\n *\n * ```js\n * const a = tf.tensor2d([1, 2, 3, 4], [2, 2]);\n *\n * tf.unstack(a).forEach(tensor => tensor.print());\n * ```\n *\n * @param x A tensor object.\n * @param axis The axis to unstack along. Defaults to 0 (the first dim).\n *\n * @doc {heading: 'Tensors', subheading: 'Slicing and Joining'}\n */\nfunction unstack_(x: Tensor|TensorLike, axis = 0): Tensor[] {\n const $x = convertToTensor(x, 'x', 'unstack', 'string_or_numeric');\n util.assert(\n axis >= -$x.shape.length && axis < $x.shape.length,\n () =>\n `Axis = ${axis} is not in [-${$x.shape.length}, ${$x.shape.length})`);\n\n const inputs: UnpackInputs = {value: $x};\n const attrs: UnpackAttrs = {axis};\n\n return ENGINE.runKernel(\n Unpack, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const unstack = op({unstack_});\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport {TensorLike} from '../types';\nimport {searchSorted} from './search_sorted';\n\n/**\n * Searches for where a value would go in a sorted sequence.\n *\n * This is not a method for checking containment (like javascript in).\n *\n * The typical use case for this operation is \"binning\", \"bucketing\", or\n * \"discretizing\". The values are assigned to bucket-indices based on the edges\n * listed in 'sortedSequence'. This operation returns the bucket-index for each\n * value.\n *\n * The index returned corresponds to the first edge greater than the value.\n *\n * The axis is not settable for this operation. It always operates on the\n * innermost dimension (axis=-1). The operation will accept any number of outer\n * dimensions.\n *\n * Note: This operation assumes that 'upperBound' is sorted along the\n * innermost axis, maybe using 'sort(..., axis=-1)'. If the sequence is not\n * sorted no error is raised and the content of the returned tensor is not well\n * defined.\n *\n * ```js\n * const seq = tf.tensor1d([0, 3, 9, 10, 10]);\n * const values = tf.tensor1d([0, 4, 10]);\n * const result = tf.upperBound(seq, values);\n * result.print(); // [1, 2, 5]\n * ```\n * @param sortedSequence: N-D. Sorted sequence.\n * @param values: N-D. Search values.\n * @return An N-D int32 tensor the size of values containing the result of\n * applying upper bound to each value. The result is not a global index to\n * the entire Tensor, but the index in the last dimension.\n * @doc {heading: 'Operations', subheading: 'Evaluation'}\n */\nexport function upperBound(\n sortedSequence: Tensor|TensorLike, values: Tensor|TensorLike): Tensor {\n return searchSorted(sortedSequence, values, 'right');\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Tensor, Variable} from '../tensor';\nimport {DataType, Rank} from '../types';\n\n/**\n * Creates a new variable with the provided initial value.\n * ```js\n * const x = tf.variable(tf.tensor([1, 2, 3]));\n * x.assign(tf.tensor([4, 5, 6]));\n *\n * x.print();\n * ```\n *\n * @param initialValue Initial value for the tensor.\n * @param trainable If true, optimizers are allowed to update it.\n * @param name Name of the variable. Defaults to a unique id.\n * @param dtype If set, initialValue will be converted to the given type.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nexport function variable(\n initialValue: Tensor, trainable = true, name?: string,\n dtype?: DataType): Variable {\n return ENGINE.makeVariable(initialValue, trainable, name, dtype) as\n Variable;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/** An implementation of the Where kernel shared between cpu and webgl */\n\nimport {buffer} from '../ops/buffer';\nimport {Tensor2D} from '../tensor';\nimport {TypedArray} from '../types';\n\nexport function whereImpl(condShape: number[], condVals: TypedArray): Tensor2D {\n const indices = [];\n for (let i = 0; i < condVals.length; i++) {\n if (condVals[i]) {\n indices.push(i);\n }\n }\n\n const inBuffer = buffer(condShape, 'int32');\n\n const out = buffer([indices.length, condShape.length], 'int32');\n for (let i = 0; i < indices.length; i++) {\n const loc = inBuffer.indexToLoc(indices[i]);\n const offset = i * condShape.length;\n out.values.set(loc, offset);\n }\n return out.toTensor() as Tensor2D;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {whereImpl} from '../backends/where_impl';\nimport {Tensor, Tensor2D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\n/**\n * Returns the coordinates of true elements of condition.\n *\n * The coordinates are returned in a 2-D tensor where the first dimension (rows)\n * represents the number of true elements, and the second dimension (columns)\n * represents the coordinates of the true elements. Keep in mind, the shape of\n * the output tensor can vary depending on how many true values there are in\n * input. Indices are output in row-major order. The resulting tensor has the\n * shape `[numTrueElems, condition.rank]`.\n *\n * This is analogous to calling the python `tf.where(cond)` without an x or y.\n *\n * ```js\n * const cond = tf.tensor1d([false, false, true], 'bool');\n * const result = await tf.whereAsync(cond);\n * result.print();\n * ```\n *\n * @doc {heading: 'Operations', subheading: 'Logical'}\n */\nasync function whereAsync_(condition: Tensor|TensorLike): Promise {\n const $condition =\n convertToTensor(condition, 'condition', 'whereAsync', 'bool');\n const vals = await $condition.data();\n const res = whereImpl($condition.shape, vals);\n if (condition !== $condition) {\n $condition.dispose();\n }\n return res;\n}\n\nexport const whereAsync = whereAsync_;\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {gather} from './gather';\nimport {reshape} from './reshape';\nimport {squeeze} from './squeeze';\nimport {whereAsync} from './where_async';\n\n/**\n * Apply boolean mask to tensor.\n *\n * ```js\n * const tensor = tf.tensor2d([1, 2, 3, 4, 5, 6], [3, 2]);\n * const mask = tf.tensor1d([1, 0, 1], 'bool');\n * const result = await tf.booleanMaskAsync(tensor, mask);\n * result.print();\n * ```\n *\n * @param tensor N-D tensor.\n * @param mask K-D boolean tensor, K <= N and K must be known statically.\n * @param axis A 0-D int Tensor representing the axis in tensor to mask from.\n * By default, axis is 0 which will mask from the first dimension.\n * Otherwise K + axis <= N.\n *\n * @doc {heading: 'Tensors', subheading: 'Slicing and Joining'}\n */\nasync function booleanMaskAsync_(\n tensor: Tensor|TensorLike, mask: Tensor|TensorLike,\n axis?: number): Promise {\n const $tensor = convertToTensor(tensor, 'tensor', 'boolMask');\n const $mask = convertToTensor(mask, 'mask', 'boolMask', 'bool');\n\n const axisFrom = axis == null ? 0 : axis;\n const maskDim = $mask.rank;\n const tensorShape = $tensor.shape;\n\n util.assert(maskDim > 0, () => 'mask cannot be scalar');\n util.assertShapesMatch(\n tensorShape.slice(axisFrom, axisFrom + maskDim), $mask.shape,\n `mask's shape must match the first K dimensions of tensor's shape,`);\n\n let leadingSize = 1;\n for (let i = axisFrom; i < axisFrom + maskDim; i++) {\n leadingSize *= tensorShape[i];\n }\n const targetTensorShape =\n tensorShape.slice(0, axisFrom)\n .concat([leadingSize], tensorShape.slice(axisFrom + maskDim));\n const reshapedTensor = reshape($tensor, targetTensorShape);\n const reshapedMask = reshape($mask, [-1]);\n const positivePositions = await whereAsync(reshapedMask);\n const indices = squeeze(positivePositions, [1]);\n\n const res = gather(reshapedTensor, indices, axisFrom);\n\n // Ensure no memory leak.\n if (tensor !== $tensor) {\n $tensor.dispose();\n }\n if (mask !== $mask) {\n $mask.dispose();\n }\n indices.dispose();\n reshapedTensor.dispose();\n reshapedMask.dispose();\n positivePositions.dispose();\n\n return res;\n}\n\nexport const booleanMaskAsync = booleanMaskAsync_;\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Scalar, Tensor} from '../tensor';\nimport {assertTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {add} from './add';\nimport {div} from './div';\nimport {mul} from './mul';\nimport {op} from './operation';\nimport {pow} from './pow';\nimport {scalar} from './scalar';\nimport {sub} from './sub';\n\n/**\n * Compute the moving average of a variable.\n *\n * Without zeroDebias, the moving average operation is defined by:\n * `v += delta`\n * where\n * `delta = (1 - decay) * (x - v)`\n *\n * With zeroDebias (default), the `delta` term is scaled to debias the\n * effect of the (assumed) zero-initialization of `v`.\n * `delta /= (1 - decay ^ step)`\n *\n * For more details on the zero-debiasing algorithm, see:\n * https://arxiv.org/abs/1412.6980\n *\n * Note that this function is completely stateless and does not keep track of\n * step count. The step count needs to be maintained by the caller and passed\n * in as `step`.\n *\n * @param v The current moving average value.\n * @param x New input value, must have the same shape and dtype as `v`.\n * @param decay The decay factor. Typical values are 0.95 and 0.99.\n * @param step Step count.\n * @param zeroDebias: Whether zeroDebias is to be performed (default: `true`).\n * @returns The new moving average value.\n *\n * @doc {heading: 'Operations', subheading: 'Moving Average'}\n */\nfunction movingAverage_(\n v: T|TensorLike, x: T|TensorLike, decay: number|Scalar,\n step?: number|Scalar, zeroDebias = true): T {\n const $v = convertToTensor(v, 'v', 'movingAverage');\n const $x = convertToTensor(x, 'x', 'movingAverage');\n const $decay = convertToTensor(decay, 'decay', 'movingAverage');\n\n assertTypesMatch($v, $x);\n util.assert(\n util.arraysEqual($v.shape, $x.shape), () => 'Shape mismatch in v and x');\n\n const one = scalar(1);\n const oneMinusDecay = sub(one, $decay);\n\n let update = mul(sub($x, $v), oneMinusDecay);\n if (zeroDebias) {\n util.assert(\n step != null, () => 'When using zeroDebias: true, step is required.');\n const $step = convertToTensor(step, 'step', 'movingAverage');\n update = div(update, sub(one, pow($decay, $step)));\n }\n return add($v, update);\n}\n\nexport const movingAverage = op({movingAverage_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {ScatterNd, ScatterNdAttrs, ScatterNdInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {Rank, ShapeMap, TensorLike} from '../types';\n\nimport {op} from './operation';\nimport * as scatter_nd_util from './scatter_nd_util';\n\n/**\n * Creates a new tensor by applying sparse updates to individual\n * values or slices within a zero tensor of the given shape tensor according to\n * indices. This operator is the inverse of the `tf.gatherND` operator which\n * extracts values or slices from a given tensor.\n *\n * ```js\n * const indices = tf.tensor2d([4, 3, 1, 7], [4, 1], 'int32');\n * const updates = tf.tensor1d([9, 10, 11, 12]);\n * const shape = [8];\n * tf.scatterND(indices, updates, shape).print() //[0, 11, 0, 10, 9, 0, 0, 12]\n * ```\n *\n * @param indices The tensor contains the indices into the output tensor.\n * @param updates The tensor contains the value for the indices.\n * @param shape: The shape of the output tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Slicing and Joining'}\n */\nfunction scatterND_(\n indices: Tensor|TensorLike, updates: Tensor|TensorLike,\n shape: ShapeMap[R]): Tensor {\n const $indices = convertToTensor(indices, 'indices', 'scatterND', 'int32');\n const $updates = convertToTensor(updates, 'updates', 'scatterND');\n scatter_nd_util.validateInput($updates, $indices, shape);\n\n const inputs: ScatterNdInputs = {indices: $indices, updates: $updates};\n const attrs: ScatterNdAttrs = {shape};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n return ENGINE.runKernel(\n ScatterNd, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as Tensor;\n}\n\nexport const scatterND = op({scatterND_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor} from '../tensor';\n\n/**\n * Validate sparseToDense inputs.\n *\n * @param sparseIndices A 0-D, 1-D, or 2-D Tensor of type int32.\n * sparseIndices[i] contains the complete index where sparseValues[i] will be\n * placed.\n * @param sparseValues A 0-D or 1-D Tensor. Values\n * corresponding to each row of sparseIndices, or a scalar value to be used for\n * all sparse indices.\n * @param outputShape number[]. Shape of the dense output tensor.\n * @param validateIndices boolean. indice validation is not supported, error\n * will be thrown if it is set.\n */\nexport function validateInput(\n sparseIndices: Tensor, sparseValues: Tensor, outputShape: number[],\n defaultValues: Tensor) {\n if (sparseIndices.dtype !== 'int32') {\n throw new Error(\n 'tf.sparseToDense() expects the indices to be int32 type,' +\n ` but the dtype was ${sparseIndices.dtype}.`);\n }\n if (sparseIndices.rank > 2) {\n throw new Error(\n 'sparseIndices should be a scalar, vector, or matrix,' +\n ` but got shape ${sparseIndices.shape}.`);\n }\n\n const numElems = sparseIndices.rank > 0 ? sparseIndices.shape[0] : 1;\n const numDims = sparseIndices.rank > 1 ? sparseIndices.shape[1] : 1;\n\n if (outputShape.length !== numDims) {\n throw new Error(\n 'outputShape has incorrect number of elements:,' +\n ` ${outputShape.length}, should be: ${numDims}.`);\n }\n\n const numValues = sparseValues.size;\n if (!(sparseValues.rank === 0 ||\n sparseValues.rank === 1 && numValues === numElems)) {\n throw new Error(\n 'sparseValues has incorrect shape ' +\n `${sparseValues.shape}, should be [] or [${numElems}]`);\n }\n\n if (sparseValues.dtype !== defaultValues.dtype) {\n throw new Error('sparseValues.dtype must match defaultValues.dtype');\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {SparseToDense, SparseToDenseAttrs, SparseToDenseInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport * as sparse_to_dense from '../ops/sparse_to_dense_util';\nimport {Scalar, Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {Rank, ScalarLike, ShapeMap, TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Converts a sparse representation into a dense tensor.\n *\n * Builds an array dense with shape outputShape such that:\n *\n * // If sparseIndices is scalar\n * dense[i] = (i == sparseIndices ? sparseValues : defaultValue)\n *\n * // If sparseIndices is a vector, then for each i\n * dense[sparseIndices[i]] = sparseValues[i]\n *\n * // If sparseIndices is an n by d matrix, then for each i in [0, n)\n * dense[sparseIndices[i][0], ..., sparseIndices[i][d-1]] = sparseValues[i]\n * All other values in dense are set to defaultValue. If sparseValues is a\n * scalar, all sparse indices are set to this single value.\n *\n * If indices are repeated the final value is summed over all values for those\n * indices.\n *\n * ```js\n * const indices = tf.tensor1d([4, 5, 6, 1, 2, 3], 'int32');\n * const values = tf.tensor1d([10, 11, 12, 13, 14, 15], 'float32');\n * const shape = [8];\n * tf.sparseToDense(indices, values, shape).print();\n * ```\n *\n * @param sparseIndices A 0-D, 1-D, or 2-D Tensor of type int32.\n * sparseIndices[i] contains the complete index where sparseValues[i] will be\n * placed.\n * @param sparseValues A 0-D or 1-D Tensor. Values\n * corresponding to each row of sparseIndices, or a scalar value to be used for\n * all sparse indices.\n * @param outputShape Shape of the dense output tensor. The type is inferred.\n * @param defaultValue Scalar. Value to set for indices not specified in\n * sparseIndices. Defaults to zero.\n *\n * @doc {heading: 'Operations', subheading: 'Normalization'}\n */\nfunction sparseToDense_(\n sparseIndices: Tensor|TensorLike, sparseValues: Tensor|TensorLike,\n outputShape: ShapeMap[R], defaultValue: Scalar|ScalarLike = 0): Tensor {\n const $sparseIndices =\n convertToTensor(sparseIndices, 'sparseIndices', 'sparseToDense', 'int32');\n const $sparseValues = convertToTensor(\n sparseValues, 'sparseValues', 'sparseToDense', 'string_or_numeric');\n const $defaultValue = convertToTensor(\n defaultValue, 'defaultValue', 'sparseToDense', $sparseValues.dtype);\n\n sparse_to_dense.validateInput(\n $sparseIndices, $sparseValues, outputShape, $defaultValue);\n\n const inputs: SparseToDenseInputs = {\n sparseIndices: $sparseIndices,\n sparseValues: $sparseValues,\n defaultValue: $defaultValue\n };\n\n const attrs: SparseToDenseAttrs = {outputShape};\n\n return ENGINE.runKernel(\n SparseToDense, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap);\n}\n\nexport const sparseToDense = op({sparseToDense_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {GatherNd, GatherNdInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {op} from './operation';\n\n/**\n * Gather slices from input tensor into a Tensor with shape specified by\n * `indices`.\n *\n * `indices` is a K-dimensional integer tensor, best thought of as a\n * (K-1)-dimensional tensor of indices into input, where each element defines a\n * slice of input:\n * output[\\\\(i_0, ..., i_{K-2}\\\\)] = input[indices[\\\\(i_0, ..., i_{K-2}\\\\)]]\n *\n * Whereas in `tf.gather`, `indices` defines slices into the first dimension of\n * input, in `tf.gatherND`, `indices` defines slices into the first N dimensions\n * of input, where N = indices.shape[-1].\n *\n * The last dimension of indices can be at most the rank of input:\n * indices.shape[-1] <= input.rank\n *\n * The last dimension of `indices` corresponds to elements\n * (if indices.shape[-1] == input.rank) or slices\n * (if indices.shape[-1] < input.rank) along dimension indices.shape[-1] of\n * input.\n * The output tensor has shape\n * indices.shape[:-1] + input.shape[indices.shape[-1]:]\n *\n * Note that on CPU, if an out of bound index is found, an error is returned. On\n * GPU, if an out of bound index is found, a 0 is stored in the corresponding\n * output value.\n *\n * ```js\n * const indices = tf.tensor2d([0, 1, 1, 0], [2,2], 'int32');\n * const input = tf.tensor2d([9, 10, 11, 12], [2, 2]);\n * tf.gatherND(input, indices).print() // [10, 11]\n * ```\n *\n * @param x The tensor from which to gather values.\n * @param indices Index tensor, must be of type int32.\n *\n * @doc {heading: 'Operations', subheading: 'Slicing and Joining'}\n */\nfunction gatherND_(x: Tensor|TensorLike, indices: Tensor|TensorLike): Tensor {\n const $indices = convertToTensor(indices, 'indices', 'gatherND', 'int32');\n const $x = convertToTensor(x, 'x', 'gatherND', 'string_or_numeric');\n\n const inputs: GatherNdInputs = {params: $x, indices: $indices};\n\n return ENGINE.runKernel(GatherNd, inputs as {} as NamedTensorMap);\n}\n\nexport const gatherND = op({gatherND_});\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport * as util from '../util';\n\n/**\n * Normalize noise shape based on provided tensor and noise shape.\n *\n * @param x Tensor.\n * @param noiseShape The shape for the randomly generated keep/drop flags, as\n * an array of numbers. Optional.\n * @returns Normalized noise shape.\n */\nexport function getNoiseShape(x: Tensor, noiseShape?: number[]): number[] {\n if (noiseShape == null) {\n return x.shape.slice();\n }\n if (util.arraysEqual(x.shape, noiseShape)) {\n return noiseShape;\n }\n if (x.shape.length === noiseShape.length) {\n const newDimension: number[] = [];\n for (let i = 0; i < x.shape.length; i++) {\n if (noiseShape[i] == null && x.shape[i] != null) {\n newDimension.push(x.shape[i]);\n } else {\n newDimension.push(noiseShape[i]);\n }\n }\n return newDimension;\n }\n\n return noiseShape;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {add} from './add';\nimport {div} from './div';\nimport {getNoiseShape} from './dropout_util';\nimport {floor} from './floor';\nimport {mul} from './mul';\nimport {op} from './operation';\nimport {randomUniform} from './random_uniform';\n\n/**\n * Computes dropout.\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 2, 1]);\n * const rate = 0.75;\n * const output = tf.dropout(x, rate);\n * output.print();\n * ```\n *\n * @param x A floating point Tensor or TensorLike.\n * @param rate A float in the range [0, 1). The probability that each element\n * of x is discarded.\n * @param noiseShape An array of numbers of type int32, representing the\n * shape for randomly generated keep/drop flags. If the noiseShape has null\n * value, it will be automatically replaced with the x's relative dimension\n * size. Optional.\n * @param seed Used to create random seeds. Optional.\n * @returns A Tensor of the same shape of x.\n *\n * @doc {heading: 'Operations', subheading: 'Dropout'}\n */\nfunction dropout_(\n x: Tensor|TensorLike, rate: number, noiseShape?: number[],\n seed?: number|string): Tensor {\n const $x = convertToTensor(x, 'x', 'dropout');\n\n util.assert(\n $x.dtype === 'float32',\n () => `x has to be a floating point tensor since it's going to be ` +\n `scaled, but got a ${$x.dtype} tensor instead.`);\n util.assert(\n rate >= 0 && rate < 1,\n () => `rate must be a float in the range [0, 1), but got ${rate}.`);\n\n if (rate === 0) {\n return x instanceof Tensor ? $x.clone() : $x;\n }\n\n const $noiseShape = getNoiseShape($x, noiseShape);\n const keepProb = 1 - rate;\n const multiplier = div(\n floor(add(randomUniform($noiseShape, 0, 1, 'float32', seed), keepProb)),\n keepProb);\n\n return mul($x, multiplier);\n}\n\nexport const dropout = op({dropout_});\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor1D} from '../tensor';\nimport {tensor1d} from './tensor1d';\n\nexport function enclosingPowerOfTwo(value: number) {\n // Return 2**N for integer N such that 2**N >= value.\n return Math.floor(Math.pow(2, Math.ceil(Math.log(value) / Math.log(2.0))));\n}\n\nexport function cosineWindow(\n windowLength: number, a: number, b: number): Tensor1D {\n const even = 1 - windowLength % 2;\n const newValues = new Float32Array(windowLength);\n for (let i = 0; i < windowLength; ++i) {\n const cosArg = (2.0 * Math.PI * i) / (windowLength + even - 1);\n newValues[i] = a - b * Math.cos(cosArg);\n }\n return tensor1d(newValues, 'float32');\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {assert, assertShapesMatch, getTypedArrayFromDType} from '../util';\nimport {tensor} from './tensor';\n\n/**\n * Returns whether the targets are in the top K predictions.\n *\n * ```js\n * const predictions = tf.tensor2d([[20, 10, 40, 30], [30, 50, -20, 10]]);\n * const targets = tf.tensor1d([2, 0]);\n * const precision = await tf.inTopKAsync(predictions, targets);\n * precision.print();\n * ```\n * @param predictions 2-D or higher `tf.Tensor` with last dimension being\n * at least `k`.\n * @param targets 1-D or higher `tf.Tensor`.\n * @param k Optional Number of top elements to look at for computing precision,\n * default to 1.\n *\n * @doc {heading: 'Operations', subheading: 'Evaluation'}\n */\nasync function inTopKAsync_(\n predictions: T|TensorLike, targets: U|TensorLike, k = 1): Promise {\n const $predictions = convertToTensor(predictions, 'predictions', 'inTopK');\n const $targets = convertToTensor(targets, 'targets', 'inTopK');\n\n assert(\n $predictions.rank > 1,\n () => 'inTopK() expects the predictions to be of rank 2 or higher, ' +\n `but got ${$predictions.rank}`);\n assert(\n $predictions.rank - 1 === $targets.rank,\n () => `predictions rank should be 1 larger than ` +\n `targets rank, but got predictions rank ` +\n `${$predictions.rank} and targets rank ${$targets.rank}`);\n assertShapesMatch(\n $predictions.shape.slice(0, $predictions.shape.length - 1),\n $targets.shape,\n `predictions's shape should be align with the targets' shape, ` +\n 'except the last dimension.');\n const lastDim = $predictions.shape[$predictions.shape.length - 1];\n assert(\n k > 0 && k <= lastDim,\n () => `'k' passed to inTopK() must be > 0 && <= the predictions last ` +\n `dimension (${lastDim}), but got ${k}`);\n\n const predictionsVals = await $predictions.data();\n const targetsVals = await $targets.data();\n\n // Reshape predictionsVals into a 2d tensor [batch, lastDim]\n // and look up topK along lastDim.\n const [batch, size] = [predictionsVals.length / lastDim, lastDim];\n const precision = getTypedArrayFromDType('bool', batch);\n\n for (let b = 0; b < batch; b++) {\n const offset = b * size;\n const vals = predictionsVals.subarray(offset, offset + size);\n const valAndInd: Array<{value: number, index: number}> = [];\n for (let i = 0; i < vals.length; i++) {\n valAndInd.push({value: vals[i], index: i});\n }\n valAndInd.sort((a, b) => b.value - a.value);\n\n precision[b] = 0;\n for (let i = 0; i < k; i++) {\n if (valAndInd[i].index === targetsVals[b]) {\n precision[b] = 1;\n break;\n }\n }\n }\n\n if (predictions !== $predictions) {\n $predictions.dispose();\n }\n if (targets !== $targets) {\n $targets.dispose();\n }\n\n // Output precision has the same shape as targets.\n return tensor(precision, $targets.shape, 'bool') as U;\n}\n\nexport const inTopKAsync = inTopKAsync_;\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Conv2DBackpropFilter, Conv2DBackpropFilterAttrs, Conv2DBackpropFilterInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor3D, Tensor4D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport * as util from '../util';\n\nimport * as conv_util from './conv_util';\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * Computes the derivative of the filter of a 2D convolution.\n *\n * @param x The input tensor, of rank 4 or rank 3 of shape\n * [batch, height, width, inChannels]. If rank 3, batch of 1 is assumed.\n * @param dy The dy image, of rank 4 or rank 3, of shape\n * [batch, height, width, outDepth]. If rank 3, batch of 1 is assumed.\n * @param filterShape The shape of the filter, length 4,\n * [filterHeight, filterWidth, inDepth, outDepth].\n * @param strides The strides of the convolution: [strideHeight,\n * strideWidth].\n * @param pad A string from: 'same', 'valid'. The type of padding algorithm\n * used in the forward prop of the op.\n * @param dataFormat: An optional string from: \"NHWC\", \"NCHW\". Defaults to\n * \"NHWC\". Specify the data format of the input and output data. With the\n * default format \"NHWC\", the data is stored in the order of: [batch,\n * height, width, channels].\n * @param dimRoundingMode A string from: 'ceil', 'round', 'floor'. If none is\n * provided, it will default to truncate.\n */\nfunction conv2DBackpropFilter_(\n x: T, dy: T, filterShape: [number, number, number, number],\n strides: [number, number]|number,\n pad: 'valid'|'same'|number|conv_util.ExplicitPadding,\n dataFormat: 'NHWC'|'NCHW' = 'NHWC',\n dimRoundingMode?: 'floor'|'round'|'ceil'): Tensor4D {\n let x4D = x as Tensor4D;\n if (x.rank === 3) {\n x4D = reshape(x, [1, x.shape[0], x.shape[1], x.shape[2]]);\n }\n let dy4D = dy as Tensor4D;\n if (dy4D.rank === 3) {\n dy4D = reshape(dy, [1, dy.shape[0], dy.shape[1], dy.shape[2]]);\n }\n util.assert(\n x4D.rank === 4,\n () => `Error in conv2dDerFilter: input must be rank 4, but got shape ` +\n `${x4D.shape}.`);\n util.assert(\n dy4D.rank === 4,\n () => `Error in conv2dDerFilter: dy must be rank 4, but got shape ` +\n `${dy4D.shape}.`);\n util.assert(\n filterShape.length === 4,\n () => `Error in conv2dDerFilter: filterShape must be length 4, but got ` +\n `${filterShape}.`);\n const inDepth = dataFormat === 'NHWC' ? x4D.shape[3] : x4D.shape[1];\n const outDepth = dataFormat === 'NHWC' ? dy4D.shape[3] : dy4D.shape[1];\n util.assert(\n inDepth === filterShape[2],\n () => `Error in conv2dDerFilter: depth of input ${inDepth}) must ` +\n `match input depth in filter (${filterShape[2]}.`);\n util.assert(\n outDepth === filterShape[3],\n () => `Error in conv2dDerFilter: depth of dy (${outDepth}) must ` +\n `match output depth for filter (${filterShape[3]}).`);\n conv_util.checkPadOnDimRoundingMode('conv2dDerFilter', pad, dimRoundingMode);\n const inputs: Conv2DBackpropFilterInputs = {x: x4D, dy: dy4D};\n const attrs: Conv2DBackpropFilterAttrs =\n {strides, pad, dataFormat, dimRoundingMode, filterShape};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n return ENGINE.runKernel(\n Conv2DBackpropFilter, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as Tensor4D;\n}\n\nexport const conv2DBackpropFilter = op({conv2DBackpropFilter_});\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\n\nimport * as broadcast_util from './broadcast_util';\nimport {elu} from './elu';\nimport {Activation} from './fused_types';\nimport {leakyRelu} from './leaky_relu';\nimport {mul} from './mul';\nimport {prelu} from './prelu';\nimport {relu} from './relu';\nimport {relu6} from './relu6';\nimport {reshape} from './reshape';\nimport {sigmoid} from './sigmoid';\nimport {step} from './step';\nimport {sum} from './sum';\n\n// Returns gradient for fused activation.\nexport function getFusedDyActivation(\n dy: Tensor, y: Tensor, activation: Activation): Tensor {\n if (activation == null || activation === 'linear') {\n return dy;\n }\n if (activation === 'relu') {\n return mul(dy, step(y));\n }\n throw new Error(\n `Cannot compute gradient for fused activation ${activation}.`);\n}\n\n// Returns gradient for fused bias.\nexport function getFusedBiasGradient(\n bias: Tensor, dyActivation: Tensor): Tensor {\n let res = dyActivation;\n const reduceAxes =\n broadcast_util.getReductionAxes(bias.shape, dyActivation.shape);\n if (reduceAxes.length > 0) {\n res = sum(res, reduceAxes);\n }\n return reshape(res, bias.shape);\n}\n\nexport function applyActivation(\n x: Tensor, activation: Activation, preluActivationWeights?: Tensor,\n leakyreluAlpha?: number): Tensor {\n if (activation === 'linear') {\n return x;\n } else if (activation === 'relu') {\n return relu(x);\n } else if (activation === 'elu') {\n return elu(x);\n } else if (activation === 'relu6') {\n return relu6(x);\n } else if (activation === 'prelu') {\n return prelu(x, preluActivationWeights);\n } else if (activation === 'leakyrelu') {\n return leakyRelu(x, leakyreluAlpha);\n } else if (activation === 'sigmoid') {\n return sigmoid(x);\n }\n throw new Error(`Unknown fused activation ${activation}.`);\n}\n\n// Whether we should call fused ops.\nexport const shouldFuse = (gradientDepth: number, activation: Activation) => {\n const gradientMode = gradientDepth > 0;\n return !gradientMode || activation === 'linear';\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {customGrad} from '../../gradients';\nimport {FusedConv2D, FusedConv2DAttrs, FusedConv2DInputs} from '../../kernel_names';\nimport {NamedAttrMap} from '../../kernel_registry';\nimport {Tensor, Tensor3D, Tensor4D} from '../../tensor';\nimport {GradSaveFunc, NamedTensorMap} from '../../tensor_types';\nimport {makeTypesMatch} from '../../tensor_util';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport * as util from '../../util';\nimport {add} from '../add';\nimport * as broadcast_util from '../broadcast_util';\nimport {conv2d as unfusedConv2d} from '../conv2d';\nimport {conv2DBackpropFilter} from '../conv2d_backprop_filter';\nimport {conv2DBackpropInput} from '../conv2d_backprop_input';\nimport * as conv_util from '../conv_util';\nimport {Activation} from '../fused_types';\nimport {applyActivation, getFusedBiasGradient, getFusedDyActivation, shouldFuse} from '../fused_util';\nimport {op} from '../operation';\nimport {reshape} from '../reshape';\n\n/**\n * Computes a 2D convolution over the input x, optionally fused with adding a\n * bias and applying an activation.\n *\n * ```js\n * const inputDepth = 2;\n * const inShape = [2, 2, 2, inputDepth];\n * const outputDepth = 2;\n * const fSize = 1;\n * const pad = 0;\n * const strides = 1;\n *\n * const x = tf.tensor4d( [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,\n * 16], inShape);\n * const w = tf.tensor4d([-1, 1, -2, 0.5], [fSize, fSize, inputDepth,\n * outputDepth]);\n *\n * tf.fused.conv2d({ x, filter: w, strides, pad, dataFormat: 'NHWC',\n * dilations: [1, 1], bias: tf.scalar(5), activation: 'relu' }).print();\n * ```\n *\n * @param obj An object with the following properties:\n * @param x The input tensor, of rank 4 or rank 3, of shape\n * `[batch, height, width, inChannels]`. If rank 3, batch of 1 is\n * assumed.\n * @param filter The filter, rank 4, of shape\n * `[filterHeight, filterWidth, inDepth, outDepth]`.\n * @param strides The strides of the convolution: `[strideHeight,\n * strideWidth]`.\n * @param pad The type of padding algorithm.\n * - `same` and stride 1: output will be of same size as input,\n * regardless of filter size.\n * - `valid` output will be smaller than input if filter is larger\n * than 1x1.\n * - For more info, see this guide:\n * [https://www.tensorflow.org/api_docs/python/tf/nn/convolution](\n * https://www.tensorflow.org/api_docs/python/tf/nn/convolution)\n * @param dataFormat An optional string from: \"NHWC\", \"NCHW\". Defaults to\n * \"NHWC\". Specify the data format of the input and output data. With the\n * default format \"NHWC\", the data is stored in the order of: [batch,\n * height, width, channels]. Only \"NHWC\" is currently supported.\n * @param dilations The dilation rates: `[dilationHeight, dilationWidth]`\n * in which we sample input values across the height and width dimensions\n * in atrous convolution. Defaults to `[1, 1]`. If `dilations` is a single\n * number, then `dilationHeight == dilationWidth`. If it is greater than\n * 1, then all values of `strides` must be 1.\n * @param dimRoundingMode A string from: 'ceil', 'round', 'floor'. If none is\n * provided, it will default to truncate.\n * @param bias Tensor to be added to the result.\n * @param activation Name of activation kernel (defaults to `linear`) to be\n * applied\n * after biasAdd.\n * @param preluActivationWeights Tensor of prelu weights to be applied as part\n * of a `prelu` activation, typically the same shape as `x`.\n * @param leakyreluAlpha Optional. Alpha to be applied as part of a `leakyrelu`\n * activation.\n */\nfunction fusedConv2d_({\n x,\n filter,\n strides,\n pad,\n dataFormat = 'NHWC',\n dilations = [1, 1],\n dimRoundingMode,\n bias,\n activation = 'linear',\n preluActivationWeights,\n leakyreluAlpha\n}: {\n x: T|TensorLike,\n filter: Tensor4D|TensorLike,\n strides: [number, number]|number,\n pad: 'valid'|'same'|number|conv_util.ExplicitPadding,\n dataFormat?: 'NHWC'|'NCHW',\n dilations?: [number, number]|number,\n dimRoundingMode?: 'floor'|'round'|'ceil',\n bias?: Tensor|TensorLike,\n activation?: Activation,\n preluActivationWeights?: Tensor,\n leakyreluAlpha?: number\n}): T {\n activation = activation || 'linear';\n\n if (shouldFuse(ENGINE.state.gradientDepth, activation) === false) {\n // TODO: Transpose bias and preluActivationWeights properly for NCHW\n // format before computation.\n util.assert(\n dataFormat === 'NHWC',\n () => `Error in fused conv2d: got dataFormat of ${dataFormat} but ` +\n `only NHWC is currently supported for the case of gradient depth ` +\n `is 0 and the activation is not linear.`);\n\n let result = unfusedConv2d(\n x, filter, strides, pad, dataFormat, dilations, dimRoundingMode);\n if (bias != null) {\n result = add(result, bias);\n }\n\n return applyActivation(\n result, activation, preluActivationWeights, leakyreluAlpha) as T;\n }\n\n const $x = convertToTensor(x, 'x', 'conv2d', 'float32');\n const $filter = convertToTensor(filter, 'filter', 'conv2d', 'float32');\n\n let x4D = $x as Tensor4D;\n let reshapedTo4D = false;\n\n if ($x.rank === 3) {\n reshapedTo4D = true;\n x4D = reshape($x, [1, $x.shape[0], $x.shape[1], $x.shape[2]]);\n }\n util.assert(\n x4D.rank === 4,\n () => `Error in fused conv2d: input must be rank 4, but got rank ` +\n `${x4D.rank}.`);\n util.assert(\n $filter.rank === 4,\n () => `Error in fused conv2d: filter must be rank 4, but got rank ` +\n `${$filter.rank}.`);\n conv_util.checkPadOnDimRoundingMode('fused conv2d', pad, dimRoundingMode);\n const inputChannels = dataFormat === 'NHWC' ? x4D.shape[3] : x4D.shape[1];\n util.assert(\n $filter.shape[2] === inputChannels,\n () => `Error in conv2d: depth of input (${inputChannels}) must match ` +\n `input depth for filter ${$filter.shape[2]}.`);\n util.assert(\n conv_util.eitherStridesOrDilationsAreOne(strides, dilations),\n () => 'Error in conv2D: Either strides or dilations must be 1. ' +\n `Got strides ${strides} and dilations '${dilations}'`);\n\n const convInfo = conv_util.computeConv2DInfo(\n x4D.shape, $filter.shape, strides, dilations, pad, dimRoundingMode);\n\n let $bias: Tensor;\n if (bias != null) {\n $bias = convertToTensor(bias, 'bias', 'fused conv2d');\n [$bias] = makeTypesMatch($bias, $x);\n\n // According to TensorFlow, the bias is supposed be a 1-D tensor or a\n // scalar.\n //\n // 3-D or 4-D bias is not disabled for NHWC format, because they are\n // currently being used in some cases. For examplem in our code base,\n // https://github.com/tensorflow/tfjs/blob/b53bd47e880367ae57493f0ea628abaf08db2d5d/tfjs-core/src/ops/fused/fused_conv2d_test.ts#L1972.\n if (dataFormat === 'NHWC') {\n broadcast_util.assertAndGetBroadcastShape(convInfo.outShape, $bias.shape);\n } else {\n util.assert(\n $bias.shape.length <= 1,\n () => `Error in fused conv2d: only supports scalar or 1-D Tensor ` +\n `bias for NCHW format but got the bias of ` +\n `rank-${$bias.shape.length}.`);\n\n util.assert(\n $bias.shape.length === 0 || $bias.shape[0] === convInfo.outChannels ||\n $bias.shape[0] === 1,\n () => `Error in fused conv2d: bias shape (${$bias.shape}) is not ` +\n `compatible with the number of output channels ` +\n `(${convInfo.outChannels})`);\n }\n }\n\n let $preluActivationWeights: Tensor;\n if (preluActivationWeights != null) {\n // PReLU's activation weights could be a scalar, a 1-D tensor or a 3-D\n // tensor.\n const alphaShape = preluActivationWeights.shape;\n util.assert(\n alphaShape.length <= 1 || alphaShape.length === 3,\n () => `Error in fused conv2d: only supports scalar, 1-D Tensor or ` +\n `3-D Tensor PReLU activation weights but got a tensor of ` +\n `rank-${alphaShape.length}.`);\n\n if (alphaShape.length === 1) {\n // Whether the data format is NCHW or NHWC, the 1-D PReLU activation\n // weights tensor should be aligned with the output channels of conv2d\n // result.\n util.assert(\n alphaShape[0] === 1 || alphaShape[0] === convInfo.outChannels,\n () => `Error in fused conv2d: PReLU activation weights ` +\n `(${alphaShape}) is not compatible with the number of output ` +\n `channels (${convInfo.outChannels}).`);\n } else if (alphaShape.length === 3) {\n // Whether the data format is NCHW or NHWC, the PReLU activation weights\n // tensor should has the compatible shape with the result of conv2d.\n try {\n broadcast_util.assertAndGetBroadcastShape(\n alphaShape, convInfo.outShape);\n } catch (e) {\n const errMsg =\n `Error in fused conv2d: PReLU activation weights (${alphaShape}) ` +\n `is not compatible with the output shape of the conv2d ` +\n `(${convInfo.outShape}).`;\n throw Error(errMsg);\n }\n }\n\n $preluActivationWeights = convertToTensor(\n preluActivationWeights, 'prelu weights', 'fused conv2d');\n }\n\n const grad = (dy: Tensor4D, saved: Tensor[]) => {\n util.assert(\n dataFormat === 'NHWC',\n () => `Error in gradient of fused conv2D: got dataFormat of ${\n dataFormat} but only NHWC is currently supported.`);\n\n const [$filter, x4D, y, $bias] =\n saved as [Tensor4D, Tensor4D, Tensor4D, Tensor];\n\n const dyActivation = getFusedDyActivation(dy, y, activation) as Tensor4D;\n\n util.assert(\n conv_util.tupleValuesAreOne(dilations),\n () => 'Error in gradient of fused conv2D: ' +\n `dilation rates greater than 1 ` +\n `are not yet supported in gradients. Got dilations '${dilations}'`);\n\n const xDer =\n conv2DBackpropInput(x4D.shape, dyActivation, $filter, strides, pad);\n const filterDer =\n conv2DBackpropFilter(x4D, dyActivation, $filter.shape, strides, pad);\n const der: Tensor[] = [xDer, filterDer];\n\n if ($bias != null) {\n const biasDer = getFusedBiasGradient($bias, dyActivation);\n der.push(biasDer);\n }\n return der;\n };\n\n const inputs: FusedConv2DInputs = {\n x: x4D,\n filter: $filter,\n bias: $bias,\n preluActivationWeights: $preluActivationWeights\n };\n\n const attrs: FusedConv2DAttrs = {\n strides,\n pad,\n dataFormat,\n dilations,\n dimRoundingMode,\n activation,\n leakyreluAlpha\n };\n\n // Depending on the the params passed in we will have different number of\n // inputs and thus a a different number of elements in the gradient.\n if (bias == null) {\n const customOp =\n customGrad((x4D: Tensor4D, filter: Tensor4D, save: GradSaveFunc) => {\n let res: Tensor4D|Tensor3D =\n // tslint:disable-next-line: no-unnecessary-type-assertion\n ENGINE.runKernel(\n FusedConv2D, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap);\n\n save([filter, x4D, res]);\n\n if (reshapedTo4D) {\n // tslint:disable-next-line: no-unnecessary-type-assertion\n res = reshape(res, [res.shape[1], res.shape[2], res.shape[3]]) as\n Tensor3D;\n }\n\n return {value: res, gradFunc: grad};\n });\n return customOp(x4D, $filter) as T;\n } else {\n const customOpWithBias = customGrad(\n (x4D: Tensor4D, filter: Tensor4D, bias: Tensor, save: GradSaveFunc) => {\n let res: Tensor4D|Tensor3D = ENGINE.runKernel(\n FusedConv2D, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap);\n\n save([filter, x4D, res, bias]);\n\n if (reshapedTo4D) {\n // tslint:disable-next-line: no-unnecessary-type-assertion\n res = reshape(res, [res.shape[1], res.shape[2], res.shape[3]]) as\n Tensor3D;\n }\n\n return {value: res, gradFunc: grad};\n });\n\n return customOpWithBias(x4D, $filter, $bias) as T;\n }\n}\nexport const conv2d = op({fusedConv2d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {DepthwiseConv2dNativeBackpropFilter, DepthwiseConv2dNativeBackpropFilterAttrs, DepthwiseConv2dNativeBackpropFilterInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor3D, Tensor4D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\n\nimport {ExplicitPadding} from './conv_util';\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\nfunction depthwiseConv2dNativeBackpropFilter_(\n x: T, dy: T, filterShape: [number, number, number, number],\n strides: [number, number]|number,\n pad: 'valid'|'same'|number|ExplicitPadding,\n dilations: [number, number]|number = [1, 1],\n dimRoundingMode?: 'floor'|'round'|'ceil'): Tensor4D {\n let x4D = x as Tensor4D;\n if (x.rank === 3) {\n x4D = reshape(x, [1, x.shape[0], x.shape[1], x.shape[2]]);\n }\n let dy4D = dy as Tensor4D;\n if (dy4D.rank === 3) {\n dy4D = reshape(dy, [1, dy.shape[0], dy.shape[1], dy.shape[2]]);\n }\n\n const inputs: DepthwiseConv2dNativeBackpropFilterInputs = {x: x4D, dy: dy4D};\n const attrs: DepthwiseConv2dNativeBackpropFilterAttrs =\n {strides, pad, dimRoundingMode, dilations, filterShape};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n return ENGINE.runKernel(\n DepthwiseConv2dNativeBackpropFilter,\n inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap) as\n Tensor4D;\n}\n\nexport const depthwiseConv2dNativeBackpropFilter =\n op({depthwiseConv2dNativeBackpropFilter_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {DepthwiseConv2dNativeBackpropInput, DepthwiseConv2dNativeBackpropInputAttrs, DepthwiseConv2dNativeBackpropInputInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor3D, Tensor4D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\n\nimport {ExplicitPadding} from './conv_util';\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\nfunction depthwiseConv2dNativeBackpropInput_(\n xShape: [number, number, number, number], dy: T, filter: Tensor4D,\n strides: [number, number]|number,\n pad: 'valid'|'same'|number|ExplicitPadding,\n dilations: [number, number]|number = [1, 1],\n dimRoundingMode?: 'floor'|'round'|'ceil'): T {\n let dy4D = dy as Tensor4D;\n let reshapedTo4D = false;\n if (dy.rank === 3) {\n reshapedTo4D = true;\n dy4D = reshape(dy, [1, dy.shape[0], dy.shape[1], dy.shape[2]]);\n }\n\n const inputs: DepthwiseConv2dNativeBackpropInputInputs = {dy: dy4D, filter};\n const attrs: DepthwiseConv2dNativeBackpropInputAttrs =\n {strides, pad, dimRoundingMode, dilations, inputShape: xShape};\n\n const res =\n // tslint:disable-next-line: no-unnecessary-type-assertion\n ENGINE.runKernel(\n DepthwiseConv2dNativeBackpropInput, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as T;\n\n if (reshapedTo4D) {\n return reshape(res, [res.shape[1], res.shape[2], res.shape[3]]) as T;\n }\n return res;\n}\n\nexport const depthwiseConv2dNativeBackpropInput =\n op({depthwiseConv2dNativeBackpropInput_});\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {customGrad} from '../../gradients';\nimport {FusedDepthwiseConv2D, FusedDepthwiseConv2DAttrs, FusedDepthwiseConv2DInputs} from '../../kernel_names';\nimport {NamedAttrMap} from '../../kernel_registry';\nimport {Tensor, Tensor3D, Tensor4D} from '../../tensor';\nimport {GradSaveFunc, NamedTensorMap} from '../../tensor_types';\nimport {makeTypesMatch} from '../../tensor_util';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport * as util from '../../util';\nimport {add} from '../add';\nimport * as broadcast_util from '../broadcast_util';\nimport * as conv_util from '../conv_util';\nimport {depthwiseConv2d as unfusedDepthwiseConv2d} from '../depthwise_conv2d';\nimport {depthwiseConv2dNativeBackpropFilter} from '../depthwise_conv2d_native_backprop_filter';\nimport {depthwiseConv2dNativeBackpropInput} from '../depthwise_conv2d_native_backprop_input';\nimport {Activation} from '../fused_types';\nimport {applyActivation, getFusedBiasGradient, getFusedDyActivation, shouldFuse} from '../fused_util';\nimport {op} from '../operation';\nimport {reshape} from '../reshape';\n\n/**\n * Computes depthwise 2D convolution, optionally fused with adding a\n * bias and applying an activation.\n *\n * Given a 4D `input` array and a `filter` array of shape\n * `[filterHeight, filterWidth, inChannels, channelMultiplier]` containing\n * `inChannels` convolutional filters of depth 1, this op applies a\n * different filter to each input channel (expanding from 1 channel to\n * `channelMultiplier` channels for each), then concatenates the results\n * together. The output has `inChannels * channelMultiplier` channels.\n *\n * See\n * [https://www.tensorflow.org/api_docs/python/tf/nn/depthwise_conv2d](\n * https://www.tensorflow.org/api_docs/python/tf/nn/depthwise_conv2d)\n * for more details.\n *\n * @param obj An object with the following properties:\n * @param x The input tensor, of rank 4 or rank 3, of shape\n * `[batch, height, width, inChannels]`. If rank 3, batch of 1 is\n * assumed.\n * @param filter The filter tensor, rank 4, of shape\n * `[filterHeight, filterWidth, inChannels, channelMultiplier]`.\n * @param strides The strides of the convolution: `[strideHeight,\n * strideWidth]`. If strides is a single number, then `strideHeight ==\n * strideWidth`.\n * @param pad The type of padding algorithm.\n * - `same` and stride 1: output will be of same size as input,\n * regardless of filter size.\n * - `valid`: output will be smaller than input if filter is larger\n * than 1x1.\n * - For more info, see this guide:\n * [https://www.tensorflow.org/api_docs/python/tf/nn/convolution](\n * https://www.tensorflow.org/api_docs/python/tf/nn/convolution)\n * @param dilations The dilation rates: `[dilationHeight, dilationWidth]`\n * in which we sample input values across the height and width dimensions\n * in atrous convolution. Defaults to `[1, 1]`. If `rate` is a single\n * number, then `dilationHeight == dilationWidth`. If it is greater than\n * 1, then all values of `strides` must be 1.\n * @param dataFormat: An optional string from: \"NHWC\", \"NCHW\". Defaults to\n * \"NHWC\". Specify the data format of the input and output data. With the\n * default format \"NHWC\", the data is stored in the order of: [batch,\n * height, width, channels]. Only \"NHWC\" is currently supported.\n * @param dimRoundingMode A string from: 'ceil', 'round', 'floor'. If none is\n * provided, it will default to truncate.\n * @param bias Tensor to be added to the result.\n * @param activation Name of activation kernel (defaults to `linear`).\n * @param preluActivationWeights Tensor of prelu weights to be applied as part\n * of a `prelu` activation, typically the same shape as `x`.\n * @param leakyreluAlpha Optional. Alpha to be applied as part of a `leakyrelu`\n * activation.\n */\nfunction fusedDepthwiseConv2d_({\n x,\n filter,\n strides,\n pad,\n dataFormat = 'NHWC',\n dilations = [1, 1],\n dimRoundingMode,\n bias,\n activation = 'linear',\n preluActivationWeights,\n leakyreluAlpha\n}: {\n x: T|TensorLike,\n filter: Tensor4D|TensorLike,\n strides: [number, number]|number,\n pad: 'valid'|'same'|number,\n dataFormat?: 'NHWC'|'NCHW',\n dilations?: [number, number]|number,\n dimRoundingMode?: 'floor'|'round'|'ceil',\n bias?: Tensor|TensorLike,\n activation?: Activation,\n preluActivationWeights?: Tensor,\n leakyreluAlpha?: number\n}): T {\n if (shouldFuse(ENGINE.state.gradientDepth, activation) === false) {\n let result = unfusedDepthwiseConv2d(\n x, filter, strides, pad, dataFormat, dilations, dimRoundingMode);\n if (bias != null) {\n result = add(result, bias);\n }\n\n return applyActivation(\n result, activation, preluActivationWeights, leakyreluAlpha) as T;\n }\n\n const $x = convertToTensor(x, 'x', 'depthwiseConv2d', 'float32');\n const $filter =\n convertToTensor(filter, 'filter', 'depthwiseConv2d', 'float32');\n\n let x4D = $x as Tensor4D;\n let reshapedTo4D = false;\n if ($x.rank === 3) {\n reshapedTo4D = true;\n x4D = reshape($x, [1, $x.shape[0], $x.shape[1], $x.shape[2]]);\n }\n util.assert(\n x4D.rank === 4,\n () => `Error in fused depthwiseConv2d: input must be rank 4, but got ` +\n `rank ${x4D.rank}.`);\n util.assert(\n $filter.rank === 4,\n () => `Error in fused depthwiseConv2d: filter must be rank 4, ` +\n `but got rank ${$filter.rank}.`);\n util.assert(\n x4D.shape[3] === $filter.shape[2],\n () => `Error in fused depthwiseConv2d: number of input channels ` +\n `(${x4D.shape[3]}) must match the inChannels dimension in ` +\n `filter ${$filter.shape[2]}.`);\n if (dilations == null) {\n dilations = [1, 1];\n }\n util.assert(\n conv_util.eitherStridesOrDilationsAreOne(strides, dilations),\n () =>\n 'Error in fused depthwiseConv2d: Either strides or dilations must ' +\n `be 1. Got strides ${strides} and dilations '${dilations}'`);\n conv_util.checkPadOnDimRoundingMode(\n 'fused depthwiseConv2d', pad, dimRoundingMode);\n const convInfo = conv_util.computeConv2DInfo(\n x4D.shape, $filter.shape, strides, dilations, pad, dimRoundingMode,\n true /* depthwise */);\n\n let $bias: Tensor;\n if (bias != null) {\n $bias = convertToTensor(bias, 'bias', 'fused conv2d');\n [$bias] = makeTypesMatch($bias, $x);\n\n broadcast_util.assertAndGetBroadcastShape(convInfo.outShape, $bias.shape);\n }\n\n let $preluActivationWeights: Tensor;\n if (preluActivationWeights != null) {\n $preluActivationWeights = convertToTensor(\n preluActivationWeights, 'prelu weights', 'fused depthwiseConv2d');\n }\n\n const grad = (dy: Tensor4D, saved: Tensor[]) => {\n util.assert(\n conv_util.tupleValuesAreOne(dilations),\n () => 'Error in gradient of fused depthwiseConv2d: dilation rates ' +\n `greater than 1 are not yet supported. Got dilations ` +\n `'${dilations}'`);\n const [$filter, x4D, y, bias] = saved;\n\n const dyActivation = getFusedDyActivation(dy, y, activation) as Tensor4D;\n\n const xDer = depthwiseConv2dNativeBackpropInput(\n (x4D as Tensor4D).shape, dyActivation, $filter as Tensor4D, strides,\n pad, dilations, dimRoundingMode);\n const filterDer = depthwiseConv2dNativeBackpropFilter(\n x4D as Tensor4D, dyActivation, ($filter as Tensor4D).shape, strides,\n pad, dilations, dimRoundingMode);\n\n if (bias != null) {\n const biasDer = getFusedBiasGradient($bias, dyActivation);\n return [xDer, filterDer, biasDer];\n }\n return [xDer, filterDer];\n };\n\n const inputs: FusedDepthwiseConv2DInputs = {\n x: x4D,\n filter: $filter,\n bias: $bias,\n preluActivationWeights: $preluActivationWeights\n };\n const attrs: FusedDepthwiseConv2DAttrs = {\n strides,\n pad,\n dataFormat,\n dilations,\n dimRoundingMode,\n activation,\n leakyreluAlpha\n };\n\n // Depending on the the params passed in we will have different number of\n // inputs and thus a a different number of elements in the gradient.\n if (bias == null) {\n const customOp =\n customGrad((x4D: Tensor4D, filter: Tensor4D, save: GradSaveFunc) => {\n // tslint:disable-next-line: no-unnecessary-type-assertion\n let res: Tensor4D|Tensor3D = ENGINE.runKernel(\n FusedDepthwiseConv2D, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap);\n\n save([filter, x4D, res]);\n\n if (reshapedTo4D) {\n // tslint:disable-next-line: no-unnecessary-type-assertion\n res = reshape(res, [res.shape[1], res.shape[2], res.shape[3]]) as\n Tensor3D;\n }\n\n return {value: res, gradFunc: grad};\n });\n return customOp(x4D, $filter) as T;\n } else {\n const customOpWithBias = customGrad(\n (x4D: Tensor4D, filter: Tensor4D, bias: Tensor, save: GradSaveFunc) => {\n // tslint:disable-next-line: no-unnecessary-type-assertion\n let res: Tensor4D|Tensor3D = ENGINE.runKernel(\n FusedDepthwiseConv2D, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap);\n\n save([filter, x4D, res, bias]);\n\n if (reshapedTo4D) {\n // tslint:disable-next-line: no-unnecessary-type-assertion\n res = reshape(res, [res.shape[1], res.shape[2], res.shape[3]]) as\n Tensor3D;\n }\n\n return {value: res, gradFunc: grad};\n });\n\n return customOpWithBias(x4D, $filter, $bias) as T;\n }\n}\nexport const depthwiseConv2d = op({fusedDepthwiseConv2d_});\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {customGrad} from '../../gradients';\nimport {_FusedMatMul, _FusedMatMulAttrs, _FusedMatMulInputs} from '../../kernel_names';\nimport {NamedAttrMap} from '../../kernel_registry';\nimport {Tensor, Tensor3D} from '../../tensor';\nimport {GradSaveFunc, NamedTensorMap} from '../../tensor_types';\nimport {makeTypesMatch} from '../../tensor_util';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport * as util from '../../util';\n\nimport {add} from '../add';\nimport * as broadcast_util from '../broadcast_util';\nimport {Activation} from '../fused_types';\nimport {applyActivation, getFusedBiasGradient, getFusedDyActivation, shouldFuse} from '../fused_util';\nimport {matMul as unfusedMatMul} from '../mat_mul';\nimport {op} from '../operation';\nimport {reshape} from '../reshape';\n\n/**\n * Computes the dot product of two matrices with optional activation and bias.\n *\n * ```js\n * const a = tf.tensor2d([-1, -2], [1, 2]);\n * const b = tf.tensor2d([1, 2, 3, 4], [2, 2]);\n * const bias = tf.tensor2d([1, 2], [1, 2]);\n *\n * tf.fused.matMul({a, b, bias, activation: 'relu'}).print();\n * ```\n *\n * @param obj An object with the following properties:\n * - `a` First matrix in dot product operation.\n * - `b` Second matrix in dot product operation.\n * - `transposeA` If true, `a` is transposed before multiplication.\n * - `transposeB` If true, `b` is transposed before multiplication.\n * - `bias` Matrix to be added to the result.\n * - `activation` Name of activation kernel (defaults to `linear`).\n * - `preluActivationWeights` Tensor of prelu weights.\n * - `leakyreluAlpha` Alpha of leakyrelu.\n */\nfunction fusedMatMul_({\n a,\n b,\n transposeA = false,\n transposeB = false,\n bias,\n activation = 'linear',\n preluActivationWeights,\n leakyreluAlpha = 0.2,\n}: {\n a: Tensor|TensorLike,\n b: Tensor|TensorLike,\n transposeA?: boolean,\n transposeB?: boolean,\n bias?: Tensor|TensorLike,\n activation?: Activation,\n preluActivationWeights?: Tensor\n leakyreluAlpha?: number\n}): Tensor {\n if (shouldFuse(ENGINE.state.gradientDepth, activation) === false) {\n let result = unfusedMatMul(a, b, transposeA, transposeB);\n if (bias != null) {\n result = add(result, bias);\n }\n\n return applyActivation(\n result, activation, preluActivationWeights, leakyreluAlpha);\n }\n\n let $a = convertToTensor(a, 'a', 'fused matMul');\n let $b = convertToTensor(b, 'b', 'fused matMul');\n [$a, $b] = makeTypesMatch($a, $b);\n\n const innerShapeA =\n transposeA ? $a.shape[$a.rank - 2] : $a.shape[$a.rank - 1];\n const innerShapeB =\n transposeB ? $b.shape[$b.rank - 1] : $b.shape[$b.rank - 2];\n\n const outerShapeA =\n transposeA ? $a.shape[$a.rank - 1] : $a.shape[$a.rank - 2];\n const outerShapeB =\n transposeB ? $b.shape[$b.rank - 2] : $b.shape[$b.rank - 1];\n\n const outerDimsA = $a.shape.slice(0, -2);\n const outerDimsB = $b.shape.slice(0, -2);\n const batchDimA = util.sizeFromShape(outerDimsA);\n const batchDimB = util.sizeFromShape(outerDimsB);\n\n util.assert(\n innerShapeA === innerShapeB,\n () => `Error in fused matMul: inner shapes (${innerShapeA}) and (` +\n `${innerShapeB}) of Tensors with shapes ${$a.shape} and ` +\n `${$b.shape} and transposeA=${transposeA}` +\n ` and transposeB=${transposeB} must match.`);\n\n const outShapeOuterDims = broadcast_util.assertAndGetBroadcastShape(\n $a.shape.slice(0, -2), $b.shape.slice(0, -2));\n const outShape = outShapeOuterDims.concat([outerShapeA, outerShapeB]);\n\n const a3D: Tensor3D = transposeA ?\n reshape($a, [batchDimA, innerShapeA, outerShapeA]) :\n reshape($a, [batchDimA, outerShapeA, innerShapeA]);\n const b3D: Tensor3D = transposeB ?\n reshape($b, [batchDimB, outerShapeB, innerShapeB]) :\n reshape($b, [batchDimB, innerShapeB, outerShapeB]);\n\n let $bias: Tensor;\n if (bias != null) {\n $bias = convertToTensor(bias, 'bias', 'fused matMul');\n [$bias] = makeTypesMatch($bias, $a);\n\n broadcast_util.assertAndGetBroadcastShape(outShape, $bias.shape);\n }\n\n let $preluActivationWeights: Tensor;\n if (preluActivationWeights != null) {\n $preluActivationWeights = convertToTensor(\n preluActivationWeights, 'prelu weights', 'fused matMul');\n }\n\n const grad = (dy: Tensor3D, saved: Tensor[]) => {\n const [a3D, b3D, y, $bias] = saved;\n // we reshape dy because the result of the forward is not\n // necessarily going to be a 3d tensor due to a reshape done at the end of\n // the customOp.\n const dyActivation =\n getFusedDyActivation(reshape(dy, y.shape), y, activation);\n let aDer: Tensor;\n let bDer: Tensor;\n\n if (!transposeA && !transposeB) {\n aDer = unfusedMatMul(dyActivation, b3D, false, true);\n bDer = unfusedMatMul(a3D, dyActivation, true, false);\n } else if (!transposeA && transposeB) {\n aDer = unfusedMatMul(dyActivation, b3D, false, false);\n bDer = unfusedMatMul(dyActivation, a3D, true, false);\n } else if (transposeA && !transposeB) {\n aDer = unfusedMatMul(b3D, dyActivation, false, true);\n bDer = unfusedMatMul(a3D, dyActivation, false, false);\n } else {\n aDer = unfusedMatMul(b3D, dyActivation, true, true);\n bDer = unfusedMatMul(dyActivation, a3D, true, true);\n }\n\n if (bias != null) {\n const biasDer = getFusedBiasGradient($bias, dyActivation);\n return [aDer, bDer, biasDer];\n } else {\n return [aDer, bDer];\n }\n };\n\n const inputs: _FusedMatMulInputs = {\n a: a3D,\n b: b3D,\n bias: $bias,\n preluActivationWeights: $preluActivationWeights\n };\n const attrs: _FusedMatMulAttrs =\n {transposeA, transposeB, activation, leakyreluAlpha};\n\n // Depending on the the params passed in we will have different number of\n // inputs and thus a a different number of elements in the gradient.\n if (bias == null) {\n const customOp =\n customGrad((a3D: Tensor3D, b3D: Tensor3D, save: GradSaveFunc) => {\n const res =\n // tslint:disable-next-line: no-unnecessary-type-assertion\n ENGINE.runKernel(\n _FusedMatMul, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as Tensor;\n\n save([a3D, b3D, res]);\n\n return {value: reshape(res, outShape), gradFunc: grad};\n });\n return customOp(a3D, b3D);\n } else {\n const customOpWithBias = customGrad(\n (a3D: Tensor3D, b3D: Tensor3D, $bias: Tensor, save: GradSaveFunc) => {\n const res =\n // tslint:disable-next-line: no-unnecessary-type-assertion\n ENGINE.runKernel(\n _FusedMatMul, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as Tensor;\n\n save([a3D, b3D, res, $bias]);\n\n return {value: reshape(res, outShape), gradFunc: grad};\n });\n\n return customOpWithBias(a3D, b3D, $bias);\n }\n }\n\n export const matMul = op({fusedMatMul_});\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {conv2d} from './fused/conv2d';\nimport {depthwiseConv2d} from './fused/depthwise_conv2d';\nimport {matMul} from './fused/mat_mul';\nimport {Activation} from './fused_types';\n\nexport {Activation, conv2d, depthwiseConv2d, matMul};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor1D} from '../../tensor';\nimport {op} from '../operation';\nimport {cosineWindow} from '../signal_ops_util';\n\n/**\n * Generate a hamming window.\n *\n * See: https://en.wikipedia.org/wiki/Window_function#Hann_and_Hamming_windows\n *\n * ```js\n * tf.signal.hammingWindow(10).print();\n * ```\n * @param The length of window\n *\n * @doc {heading: 'Operations', subheading: 'Signal', namespace: 'signal'}\n */\nfunction hammingWindow_(windowLength: number): Tensor1D {\n return cosineWindow(windowLength, 0.54, 0.46);\n}\nexport const hammingWindow = op({hammingWindow_});\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor1D} from '../../tensor';\nimport {op} from '../operation';\nimport {cosineWindow} from '../signal_ops_util';\n\n/**\n * Generate a Hann window.\n *\n * See: https://en.wikipedia.org/wiki/Window_function#Hann_and_Hamming_windows\n *\n * ```js\n * tf.signal.hannWindow(10).print();\n * ```\n * @param The length of window\n *\n * @doc {heading: 'Operations', subheading: 'Signal', namespace: 'signal'}\n */\nfunction hannWindow_(windowLength: number): Tensor1D {\n return cosineWindow(windowLength, 0.5, 0.5);\n}\n\nexport const hannWindow = op({hannWindow_});\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor, Tensor1D} from '../../tensor';\nimport {concat} from '../concat';\nimport {fill} from '../fill';\nimport {op} from '../operation';\nimport {reshape} from '../reshape';\nimport {slice} from '../slice';\nimport {tensor2d} from '../tensor2d';\n\n/**\n * Expands input into frames of frameLength.\n * Slides a window size with frameStep.\n *\n * ```js\n * tf.signal.frame([1, 2, 3], 2, 1).print();\n * ```\n * @param signal The input tensor to be expanded\n * @param frameLength Length of each frame\n * @param frameStep The frame hop size in samples.\n * @param padEnd Whether to pad the end of signal with padValue.\n * @param padValue A number to use where the input signal does\n * not exist when padEnd is True.\n *\n * @doc {heading: 'Operations', subheading: 'Signal', namespace: 'signal'}\n */\nfunction frame_(\n signal: Tensor1D, frameLength: number, frameStep: number, padEnd = false,\n padValue = 0): Tensor {\n let start = 0;\n const output: Tensor[] = [];\n while (start + frameLength <= signal.size) {\n output.push(slice(signal, start, frameLength));\n start += frameStep;\n }\n\n if (padEnd) {\n while (start < signal.size) {\n const padLen = (start + frameLength) - signal.size;\n const pad = concat([\n slice(signal, start, frameLength - padLen), fill([padLen], padValue)\n ]);\n output.push(pad);\n start += frameStep;\n }\n }\n\n if (output.length === 0) {\n return tensor2d([], [0, frameLength]);\n }\n\n return reshape(concat(output), [output.length, frameLength]);\n}\nexport const frame = op({frame_});\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor, Tensor1D} from '../../tensor';\nimport {mul} from '../mul';\nimport {op} from '../operation';\nimport {enclosingPowerOfTwo} from '../signal_ops_util';\nimport {rfft} from '../spectral/rfft';\n\nimport {frame} from './frame';\nimport {hannWindow} from './hann_window';\n\n/**\n * Computes the Short-time Fourier Transform of signals\n * See: https://en.wikipedia.org/wiki/Short-time_Fourier_transform\n *\n * ```js\n * const input = tf.tensor1d([1, 1, 1, 1, 1])\n * tf.signal.stft(input, 3, 1).print();\n * ```\n * @param signal 1-dimensional real value tensor.\n * @param frameLength The window length of samples.\n * @param frameStep The number of samples to step.\n * @param fftLength The size of the FFT to apply.\n * @param windowFn A callable that takes a window length and returns 1-d tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Signal', namespace: 'signal'}\n */\nfunction stft_(\n signal: Tensor1D, frameLength: number, frameStep: number,\n fftLength?: number,\n windowFn: (length: number) => Tensor1D = hannWindow): Tensor {\n if (fftLength == null) {\n fftLength = enclosingPowerOfTwo(frameLength);\n }\n const framedSignal = frame(signal, frameLength, frameStep);\n const windowedSignal = mul(framedSignal, windowFn(frameLength));\n return rfft(windowedSignal, fftLength);\n}\nexport const stft = op({stft_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {CropAndResize, CropAndResizeAttrs, CropAndResizeInputs} from '../../kernel_names';\nimport {NamedAttrMap} from '../../kernel_registry';\nimport {Tensor1D, Tensor2D, Tensor4D} from '../../tensor';\nimport {NamedTensorMap} from '../../tensor_types';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport * as util from '../../util';\n\nimport {op} from '../operation';\n\n/**\n * Extracts crops from the input image tensor and resizes them using bilinear\n * sampling or nearest neighbor sampling (possibly with aspect ratio change)\n * to a common output size specified by cropSize.\n *\n * @param image 4d tensor of shape `[batch,imageHeight,imageWidth, depth]`,\n * where imageHeight and imageWidth must be positive, specifying the\n * batch of images from which to take crops\n * @param boxes 2d float32 tensor of shape `[numBoxes, 4]`. Each entry is\n * `[y1, x1, y2, x2]`, where `(y1, x1)` and `(y2, x2)` are the normalized\n * coordinates of the box in the `boxInd[i]`th image in the batch\n * @param boxInd 1d int32 tensor of shape `[numBoxes]` with values in range\n * `[0, batch)` that specifies the image that the `i`-th box refers to.\n * @param cropSize 1d int32 tensor of 2 elements `[cropHeigh, cropWidth]`\n * specifying the size to which all crops are resized to.\n * @param method Optional string from `'bilinear' | 'nearest'`,\n * defaults to bilinear, which specifies the sampling method for resizing\n * @param extrapolationValue A threshold for deciding when to remove boxes based\n * on score. Defaults to 0.\n * @return A 4D tensor of the shape `[numBoxes,cropHeight,cropWidth,depth]`\n *\n * @doc {heading: 'Operations', subheading: 'Images', namespace: 'image'}\n */\nfunction cropAndResize_(\n image: Tensor4D|TensorLike,\n boxes: Tensor2D|TensorLike,\n boxInd: Tensor1D|TensorLike,\n cropSize: [number, number],\n method: 'bilinear'|'nearest' = 'bilinear',\n extrapolationValue = 0,\n ): Tensor4D {\n const $image = convertToTensor(image, 'image', 'cropAndResize');\n const $boxes = convertToTensor(boxes, 'boxes', 'cropAndResize', 'float32');\n const $boxInd = convertToTensor(boxInd, 'boxInd', 'cropAndResize', 'int32');\n\n const numBoxes = $boxes.shape[0];\n\n util.assert(\n $image.rank === 4,\n () => 'Error in cropAndResize: image must be rank 4,' +\n `but got rank ${$image.rank}.`);\n util.assert(\n $boxes.rank === 2 && $boxes.shape[1] === 4,\n () => `Error in cropAndResize: boxes must be have size [${numBoxes},4] ` +\n `but had shape ${$boxes.shape}.`);\n util.assert(\n $boxInd.rank === 1 && $boxInd.shape[0] === numBoxes,\n () => `Error in cropAndResize: boxInd must be have size [${numBoxes}] ` +\n `but had shape ${$boxes.shape}.`);\n util.assert(\n cropSize.length === 2,\n () => `Error in cropAndResize: cropSize must be of length 2, but got ` +\n `length ${cropSize.length}.`);\n util.assert(\n cropSize[0] >= 1 && cropSize[1] >= 1,\n () => `cropSize must be atleast [1,1], but was ${cropSize}`);\n util.assert(\n method === 'bilinear' || method === 'nearest',\n () => `method must be bilinear or nearest, but was ${method}`);\n\n const inputs:\n CropAndResizeInputs = {image: $image, boxes: $boxes, boxInd: $boxInd};\n const attrs: CropAndResizeAttrs = {method, extrapolationValue, cropSize};\n const res = ENGINE.runKernel(\n CropAndResize, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap);\n return res as Tensor4D;\n}\n\nexport const cropAndResize = op({cropAndResize_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {FlipLeftRight, FlipLeftRightInputs} from '../../kernel_names';\nimport {Tensor4D} from '../../tensor';\nimport {NamedTensorMap} from '../../tensor_types';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport * as util from '../../util';\nimport {op} from '../operation';\n\n/**\n * Flips the image left to right. Currently available in the CPU, WebGL, and\n * WASM backends.\n *\n * @param image 4d tensor of shape `[batch, imageHeight, imageWidth, depth]`.\n */\n/** @doc {heading: 'Operations', subheading: 'Images', namespace: 'image'} */\nfunction flipLeftRight_(image: Tensor4D|TensorLike): Tensor4D {\n const $image = convertToTensor(image, 'image', 'flipLeftRight', 'float32');\n\n util.assert(\n $image.rank === 4,\n () => 'Error in flipLeftRight: image must be rank 4,' +\n `but got rank ${$image.rank}.`);\n\n const inputs: FlipLeftRightInputs = {image: $image};\n const res =\n ENGINE.runKernel(FlipLeftRight, inputs as {} as NamedTensorMap, {});\n return res as Tensor4D;\n}\n\nexport const flipLeftRight = op({flipLeftRight_});\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor2D, Tensor3D, Tensor4D, Tensor5D, Tensor6D} from '../../tensor';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport * as util from '../../util';\n\nimport {op} from '../operation';\nimport {tile} from '../tile';\n\n/**\n * Converts images from grayscale to RGB format.\n *\n * @param image A grayscale tensor to convert. The `image`'s last dimension must\n * be size 1 with at least a two-dimensional shape.\n *\n * @doc {heading: 'Operations', subheading: 'Images', namespace: 'image'}\n */\nfunction grayscaleToRGB_(image: T|TensorLike): T {\n const $image = convertToTensor(image, 'image', 'grayscaleToRGB');\n\n const lastDimsIdx = $image.rank - 1;\n const lastDims = $image.shape[lastDimsIdx];\n\n util.assert(\n $image.rank >= 2,\n () => 'Error in grayscaleToRGB: images must be at least rank 2, ' +\n `but got rank ${$image.rank}.`);\n\n util.assert(\n lastDims === 1,\n () => 'Error in grayscaleToRGB: last dimension of a grayscale image ' +\n `should be size 1, but got size ${lastDims}.`);\n\n const reps = new Array($image.rank);\n\n reps.fill(1, 0, lastDimsIdx);\n reps[lastDimsIdx] = 3;\n\n return tile($image, reps);\n}\n\nexport const grayscaleToRGB = op({grayscaleToRGB_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {RotateWithOffset, RotateWithOffsetAttrs, RotateWithOffsetInputs} from '../../kernel_names';\nimport {NamedAttrMap} from '../../kernel_registry';\nimport {Tensor4D} from '../../tensor';\nimport {NamedTensorMap} from '../../tensor_types';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport * as util from '../../util';\n\nimport {op} from '../operation';\n\n/**\n * Rotates the input image tensor counter-clockwise with an optional offset\n * center of rotation. Currently available in the CPU, WebGL, and WASM backends.\n *\n * @param image 4d tensor of shape `[batch, imageHeight, imageWidth, depth]`.\n * @param radians The amount of rotation.\n * @param fillValue The value to fill in the empty space leftover\n * after rotation. Can be either a single grayscale value (0-255), or an\n * array of three numbers `[red, green, blue]` specifying the red, green,\n * and blue channels. Defaults to `0` (black).\n * @param center The center of rotation. Can be either a single value (0-1), or\n * an array of two numbers `[centerX, centerY]`. Defaults to `0.5` (rotates\n * the image around its center).\n *\n * @doc {heading: 'Operations', subheading: 'Images', namespace: 'image'}\n */\nfunction rotateWithOffset_(\n image: Tensor4D|TensorLike, radians: number,\n fillValue: number|[number, number, number] = 0,\n center: number|[number, number] = 0.5): Tensor4D {\n const $image = convertToTensor(image, 'image', 'rotateWithOffset', 'float32');\n\n util.assert(\n $image.rank === 4,\n () => 'Error in rotateWithOffset: image must be rank 4,' +\n `but got rank ${$image.rank}.`);\n\n const inputs: RotateWithOffsetInputs = {image: $image};\n const attrs: RotateWithOffsetAttrs = {radians, fillValue, center};\n const res = ENGINE.runKernel(\n RotateWithOffset, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap);\n return res as Tensor4D;\n}\n\nexport const rotateWithOffset = op({rotateWithOffset_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor1D, Tensor2D} from '../tensor';\nimport * as util from '../util';\n\nfunction nonMaxSuppSanityCheck(\n boxes: Tensor2D, scores: Tensor1D, maxOutputSize: number,\n iouThreshold: number, scoreThreshold: number, softNmsSigma?: number): {\n maxOutputSize: number,\n iouThreshold: number,\n scoreThreshold: number,\n softNmsSigma: number\n} {\n if (iouThreshold == null) {\n iouThreshold = 0.5;\n }\n if (scoreThreshold == null) {\n scoreThreshold = Number.NEGATIVE_INFINITY;\n }\n if (softNmsSigma == null) {\n softNmsSigma = 0.0;\n }\n\n const numBoxes = boxes.shape[0];\n maxOutputSize = Math.min(maxOutputSize, numBoxes);\n\n util.assert(\n 0 <= iouThreshold && iouThreshold <= 1,\n () => `iouThreshold must be in [0, 1], but was '${iouThreshold}'`);\n util.assert(\n boxes.rank === 2,\n () => `boxes must be a 2D tensor, but was of rank '${boxes.rank}'`);\n util.assert(\n boxes.shape[1] === 4,\n () =>\n `boxes must have 4 columns, but 2nd dimension was ${boxes.shape[1]}`);\n util.assert(scores.rank === 1, () => 'scores must be a 1D tensor');\n util.assert(\n scores.shape[0] === numBoxes,\n () => `scores has incompatible shape with boxes. Expected ${numBoxes}, ` +\n `but was ${scores.shape[0]}`);\n util.assert(\n 0 <= softNmsSigma && softNmsSigma <= 1,\n () => `softNmsSigma must be in [0, 1], but was '${softNmsSigma}'`);\n return {maxOutputSize, iouThreshold, scoreThreshold, softNmsSigma};\n}\n\nexport {nonMaxSuppSanityCheck};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {NonMaxSuppressionV3} from '../../kernel_names';\nimport {Tensor1D, Tensor2D} from '../../tensor';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport {nonMaxSuppSanityCheck} from '../nonmax_util';\nimport {op} from '../operation';\n\n/**\n * Performs non maximum suppression of bounding boxes based on\n * iou (intersection over union).\n *\n * @param boxes a 2d tensor of shape `[numBoxes, 4]`. Each entry is\n * `[y1, x1, y2, x2]`, where `(y1, x1)` and `(y2, x2)` are the corners of\n * the bounding box.\n * @param scores a 1d tensor providing the box scores of shape `[numBoxes]`.\n * @param maxOutputSize The maximum number of boxes to be selected.\n * @param iouThreshold A float representing the threshold for deciding whether\n * boxes overlap too much with respect to IOU. Must be between [0, 1].\n * Defaults to 0.5 (50% box overlap).\n * @param scoreThreshold A threshold for deciding when to remove boxes based\n * on score. Defaults to -inf, which means any score is accepted.\n * @return A 1D tensor with the selected box indices.\n *\n * @doc {heading: 'Operations', subheading: 'Images', namespace: 'image'}\n */\nfunction nonMaxSuppression_(\n boxes: Tensor2D|TensorLike, scores: Tensor1D|TensorLike,\n maxOutputSize: number, iouThreshold = 0.5,\n scoreThreshold = Number.NEGATIVE_INFINITY): Tensor1D {\n const $boxes =\n convertToTensor(boxes, 'boxes', 'nonMaxSuppression', 'float32');\n const $scores =\n convertToTensor(scores, 'scores', 'nonMaxSuppression', 'float32');\n\n const inputs = nonMaxSuppSanityCheck(\n $boxes, $scores, maxOutputSize, iouThreshold, scoreThreshold);\n maxOutputSize = inputs.maxOutputSize;\n iouThreshold = inputs.iouThreshold;\n scoreThreshold = inputs.scoreThreshold;\n\n const attrs = {maxOutputSize, iouThreshold, scoreThreshold};\n return ENGINE.runKernel(\n NonMaxSuppressionV3, {boxes: $boxes, scores: $scores}, attrs);\n}\n\nexport const nonMaxSuppression = op({nonMaxSuppression_});\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/**\n * Inserts a value into a sorted array. This method allows duplicate, meaning it\n * allows inserting duplicate value, in which case, the element will be inserted\n * at the lowest index of the value.\n * @param arr The array to modify.\n * @param element The element to insert.\n * @param comparator Optional. If no comparator is specified, elements are\n * compared using array_util.defaultComparator, which is suitable for Strings\n * and Numbers in ascending arrays. If the array contains multiple instances of\n * the target value, the left-most instance will be returned. To provide a\n * comparator, it should take 2 arguments to compare and return a negative,\n * zero, or a positive number.\n */\nexport function binaryInsert(\n arr: T[], element: T, comparator?: (a: T, b: T) => number) {\n const index = binarySearch(arr, element, comparator);\n const insertionPoint = index < 0 ? -(index + 1) : index;\n arr.splice(insertionPoint, 0, element);\n}\n\n/**\n * Searches the array for the target using binary search, returns the index\n * of the found element, or position to insert if element not found. If no\n * comparator is specified, elements are compared using array_\n * util.defaultComparator, which is suitable for Strings and Numbers in\n * ascending arrays. If the array contains multiple instances of the target\n * value, the left-most instance will be returned.\n * @param arr The array to be searched in.\n * @param target The target to be searched for.\n * @param comparator Should take 2 arguments to compare and return a negative,\n * zero, or a positive number.\n * @return Lowest index of the target value if found, otherwise the insertion\n * point where the target should be inserted, in the form of\n * (-insertionPoint - 1).\n */\nexport function binarySearch(\n arr: T[], target: T, comparator?: (a: T, b: T) => number) {\n return binarySearch_(arr, target, comparator || defaultComparator);\n}\n\n/**\n * Compares its two arguments for order.\n * @param a The first element to be compared.\n * @param b The second element to be compared.\n * @return A negative number, zero, or a positive number as the first\n * argument is less than, equal to, or greater than the second.\n */\nfunction defaultComparator(a: T, b: T): number {\n return a > b ? 1 : a < b ? -1 : 0;\n}\n\nfunction binarySearch_(\n arr: T[], target: T, comparator: (a: T, b: T) => number) {\n let left = 0;\n let right = arr.length;\n let middle = 0;\n let found = false;\n while (left < right) {\n middle = left + ((right - left) >>> 1);\n const compareResult = comparator(target, arr[middle]);\n if (compareResult > 0) {\n left = middle + 1;\n } else {\n right = middle;\n // If compareResult is 0, the value is found. We record it is found,\n // and then keep looking because there may be duplicate.\n found = !compareResult;\n }\n }\n\n return found ? left : -left - 1;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {TypedArray} from '../types';\nimport {binaryInsert} from './non_max_suppression_util';\n\n/**\n * Implementation of the NonMaxSuppression kernel shared between webgl and cpu.\n */\ninterface Candidate {\n score: number;\n boxIndex: number;\n suppressBeginIndex: number;\n}\n\ninterface NonMaxSuppressionResult {\n selectedIndices: number[];\n selectedScores?: number[];\n validOutputs?: number;\n}\n\nexport function nonMaxSuppressionV3Impl(\n boxes: TypedArray, scores: TypedArray, maxOutputSize: number,\n iouThreshold: number, scoreThreshold: number): NonMaxSuppressionResult {\n return nonMaxSuppressionImpl_(\n boxes, scores, maxOutputSize, iouThreshold, scoreThreshold,\n 0 /* softNmsSigma */);\n}\n\nexport function nonMaxSuppressionV4Impl(\n boxes: TypedArray, scores: TypedArray, maxOutputSize: number,\n iouThreshold: number, scoreThreshold: number,\n padToMaxOutputSize: boolean): NonMaxSuppressionResult {\n return nonMaxSuppressionImpl_(\n boxes, scores, maxOutputSize, iouThreshold, scoreThreshold,\n 0 /* softNmsSigma */, false /* returnScoresTensor */,\n padToMaxOutputSize /* padToMaxOutputSize */, true\n /* returnValidOutputs */);\n}\n\nexport function nonMaxSuppressionV5Impl(\n boxes: TypedArray, scores: TypedArray, maxOutputSize: number,\n iouThreshold: number, scoreThreshold: number,\n softNmsSigma: number): NonMaxSuppressionResult {\n return nonMaxSuppressionImpl_(\n boxes, scores, maxOutputSize, iouThreshold, scoreThreshold, softNmsSigma,\n true /* returnScoresTensor */);\n}\n\nfunction nonMaxSuppressionImpl_(\n boxes: TypedArray, scores: TypedArray, maxOutputSize: number,\n iouThreshold: number, scoreThreshold: number, softNmsSigma: number,\n returnScoresTensor = false, padToMaxOutputSize = false,\n returnValidOutputs = false): NonMaxSuppressionResult {\n // The list is sorted in ascending order, so that we can always pop the\n // candidate with the largest score in O(1) time.\n const candidates = [];\n\n for (let i = 0; i < scores.length; i++) {\n if (scores[i] > scoreThreshold) {\n candidates.push({score: scores[i], boxIndex: i, suppressBeginIndex: 0});\n }\n }\n\n candidates.sort(ascendingComparator);\n\n // If softNmsSigma is 0, the outcome of this algorithm is exactly same as\n // before.\n const scale = softNmsSigma > 0 ? (-0.5 / softNmsSigma) : 0.0;\n\n const selectedIndices: number[] = [];\n const selectedScores: number[] = [];\n\n while (selectedIndices.length < maxOutputSize && candidates.length > 0) {\n const candidate = candidates.pop();\n const {score: originalScore, boxIndex, suppressBeginIndex} = candidate;\n\n if (originalScore < scoreThreshold) {\n break;\n }\n\n // Overlapping boxes are likely to have similar scores, therefore we\n // iterate through the previously selected boxes backwards in order to\n // see if candidate's score should be suppressed. We use\n // suppressBeginIndex to track and ensure a candidate can be suppressed\n // by a selected box no more than once. Also, if the overlap exceeds\n // iouThreshold, we simply ignore the candidate.\n let ignoreCandidate = false;\n for (let j = selectedIndices.length - 1; j >= suppressBeginIndex; --j) {\n const iou = intersectionOverUnion(boxes, boxIndex, selectedIndices[j]);\n\n if (iou >= iouThreshold) {\n ignoreCandidate = true;\n break;\n }\n\n candidate.score =\n candidate.score * suppressWeight(iouThreshold, scale, iou);\n\n if (candidate.score <= scoreThreshold) {\n break;\n }\n }\n\n // At this point, if `candidate.score` has not dropped below\n // `scoreThreshold`, then we know that we went through all of the\n // previous selections and can safely update `suppressBeginIndex` to the\n // end of the selected array. Then we can re-insert the candidate with\n // the updated score and suppressBeginIndex back in the candidate list.\n // If on the other hand, `candidate.score` has dropped below the score\n // threshold, we will not add it back to the candidates list.\n candidate.suppressBeginIndex = selectedIndices.length;\n\n if (!ignoreCandidate) {\n // Candidate has passed all the tests, and is not suppressed, so\n // select the candidate.\n if (candidate.score === originalScore) {\n selectedIndices.push(boxIndex);\n selectedScores.push(candidate.score);\n } else if (candidate.score > scoreThreshold) {\n // Candidate's score is suppressed but is still high enough to be\n // considered, so add back to the candidates list.\n binaryInsert(candidates, candidate, ascendingComparator);\n }\n }\n }\n\n // NonMaxSuppressionV4 feature: padding output to maxOutputSize.\n const validOutputs = selectedIndices.length;\n const elemsToPad = maxOutputSize - validOutputs;\n\n if (padToMaxOutputSize && elemsToPad > 0) {\n selectedIndices.push(...new Array(elemsToPad).fill(0));\n selectedScores.push(...new Array(elemsToPad).fill(0.0));\n }\n\n const result: NonMaxSuppressionResult = {selectedIndices};\n\n if (returnScoresTensor) {\n result['selectedScores'] = selectedScores;\n }\n\n if (returnValidOutputs) {\n result['validOutputs'] = validOutputs;\n }\n\n return result;\n}\n\nfunction intersectionOverUnion(boxes: TypedArray, i: number, j: number) {\n const iCoord = boxes.subarray(i * 4, i * 4 + 4);\n const jCoord = boxes.subarray(j * 4, j * 4 + 4);\n const yminI = Math.min(iCoord[0], iCoord[2]);\n const xminI = Math.min(iCoord[1], iCoord[3]);\n const ymaxI = Math.max(iCoord[0], iCoord[2]);\n const xmaxI = Math.max(iCoord[1], iCoord[3]);\n const yminJ = Math.min(jCoord[0], jCoord[2]);\n const xminJ = Math.min(jCoord[1], jCoord[3]);\n const ymaxJ = Math.max(jCoord[0], jCoord[2]);\n const xmaxJ = Math.max(jCoord[1], jCoord[3]);\n const areaI = (ymaxI - yminI) * (xmaxI - xminI);\n const areaJ = (ymaxJ - yminJ) * (xmaxJ - xminJ);\n if (areaI <= 0 || areaJ <= 0) {\n return 0.0;\n }\n const intersectionYmin = Math.max(yminI, yminJ);\n const intersectionXmin = Math.max(xminI, xminJ);\n const intersectionYmax = Math.min(ymaxI, ymaxJ);\n const intersectionXmax = Math.min(xmaxI, xmaxJ);\n const intersectionArea = Math.max(intersectionYmax - intersectionYmin, 0.0) *\n Math.max(intersectionXmax - intersectionXmin, 0.0);\n return intersectionArea / (areaI + areaJ - intersectionArea);\n}\n\n// A Gaussian penalty function, this method always returns values in [0, 1].\n// The weight is a function of similarity, the more overlap two boxes are, the\n// smaller the weight is, meaning highly overlapping boxe will be significantly\n// penalized. On the other hand, a non-overlapping box will not be penalized.\nfunction suppressWeight(iouThreshold: number, scale: number, iou: number) {\n const weight = Math.exp(scale * iou * iou);\n return iou <= iouThreshold ? weight : 0.0;\n}\n\nfunction ascendingComparator(c1: Candidate, c2: Candidate) {\n // For objects with same scores, we make the object with the larger index go\n // first. In an array that pops from the end, this means that the object with\n // the smaller index will be popped first. This ensures the same output as\n // the TensorFlow python version.\n return (c1.score - c2.score) ||\n ((c1.score === c2.score) && (c2.boxIndex - c1.boxIndex));\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {nonMaxSuppressionV3Impl} from '../../backends/non_max_suppression_impl';\nimport {Tensor1D, Tensor2D} from '../../tensor';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport {nonMaxSuppSanityCheck} from '../nonmax_util';\nimport {tensor1d} from '../tensor1d';\n\n/**\n * Performs non maximum suppression of bounding boxes based on\n * iou (intersection over union).\n *\n * This is the async version of `nonMaxSuppression`\n *\n * @param boxes a 2d tensor of shape `[numBoxes, 4]`. Each entry is\n * `[y1, x1, y2, x2]`, where `(y1, x1)` and `(y2, x2)` are the corners of\n * the bounding box.\n * @param scores a 1d tensor providing the box scores of shape `[numBoxes]`.\n * @param maxOutputSize The maximum number of boxes to be selected.\n * @param iouThreshold A float representing the threshold for deciding whether\n * boxes overlap too much with respect to IOU. Must be between [0, 1].\n * Defaults to 0.5 (50% box overlap).\n * @param scoreThreshold A threshold for deciding when to remove boxes based\n * on score. Defaults to -inf, which means any score is accepted.\n * @return A 1D tensor with the selected box indices.\n *\n * @doc {heading: 'Operations', subheading: 'Images', namespace: 'image'}\n */\nasync function nonMaxSuppressionAsync_(\n boxes: Tensor2D|TensorLike, scores: Tensor1D|TensorLike,\n maxOutputSize: number, iouThreshold = 0.5,\n scoreThreshold = Number.NEGATIVE_INFINITY): Promise {\n const $boxes = convertToTensor(boxes, 'boxes', 'nonMaxSuppressionAsync');\n const $scores = convertToTensor(scores, 'scores', 'nonMaxSuppressionAsync');\n\n const inputs = nonMaxSuppSanityCheck(\n $boxes, $scores, maxOutputSize, iouThreshold, scoreThreshold);\n maxOutputSize = inputs.maxOutputSize;\n iouThreshold = inputs.iouThreshold;\n scoreThreshold = inputs.scoreThreshold;\n\n const boxesAndScores = await Promise.all([$boxes.data(), $scores.data()]);\n const boxesVals = boxesAndScores[0];\n const scoresVals = boxesAndScores[1];\n\n // We call a cpu based impl directly with the typedarray data here rather\n // than a kernel because all kernels are synchronous (and thus cannot await\n // .data()).\n const {selectedIndices} = nonMaxSuppressionV3Impl(\n boxesVals, scoresVals, maxOutputSize, iouThreshold, scoreThreshold);\n if ($boxes !== boxes) {\n $boxes.dispose();\n }\n if ($scores !== scores) {\n $scores.dispose();\n }\n\n return tensor1d(selectedIndices, 'int32');\n}\n\nexport const nonMaxSuppressionAsync = nonMaxSuppressionAsync_;\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {NonMaxSuppressionV5, NonMaxSuppressionV5Attrs, NonMaxSuppressionV5Inputs} from '../../kernel_names';\nimport {NamedAttrMap} from '../../kernel_registry';\nimport {Tensor, Tensor1D, Tensor2D} from '../../tensor';\nimport {NamedTensorMap} from '../../tensor_types';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\n\nimport {nonMaxSuppSanityCheck} from '../nonmax_util';\nimport {op} from '../operation';\n\n/**\n * Performs non maximum suppression of bounding boxes based on\n * iou (intersection over union).\n *\n * This op also supports a Soft-NMS mode (cf.\n * Bodla et al, https://arxiv.org/abs/1704.04503) where boxes reduce the score\n * of other overlapping boxes, therefore favoring different regions of the image\n * with high scores. To enable this Soft-NMS mode, set the `softNmsSigma`\n * parameter to be larger than 0.\n *\n * @param boxes a 2d tensor of shape `[numBoxes, 4]`. Each entry is\n * `[y1, x1, y2, x2]`, where `(y1, x1)` and `(y2, x2)` are the corners of\n * the bounding box.\n * @param scores a 1d tensor providing the box scores of shape `[numBoxes]`.\n * @param maxOutputSize The maximum number of boxes to be selected.\n * @param iouThreshold A float representing the threshold for deciding whether\n * boxes overlap too much with respect to IOU. Must be between [0, 1].\n * Defaults to 0.5 (50% box overlap).\n * @param scoreThreshold A threshold for deciding when to remove boxes based\n * on score. Defaults to -inf, which means any score is accepted.\n * @param softNmsSigma A float representing the sigma parameter for Soft NMS.\n * When sigma is 0, it falls back to nonMaxSuppression.\n * @return A map with the following properties:\n * - selectedIndices: A 1D tensor with the selected box indices.\n * - selectedScores: A 1D tensor with the corresponding scores for each\n * selected box.\n *\n * @doc {heading: 'Operations', subheading: 'Images', namespace: 'image'}\n */\nfunction nonMaxSuppressionWithScore_(\n boxes: Tensor2D|TensorLike, scores: Tensor1D|TensorLike,\n maxOutputSize: number, iouThreshold = 0.5,\n scoreThreshold = Number.NEGATIVE_INFINITY,\n softNmsSigma = 0.0): NamedTensorMap {\n const $boxes = convertToTensor(boxes, 'boxes', 'nonMaxSuppression');\n const $scores = convertToTensor(scores, 'scores', 'nonMaxSuppression');\n\n const params = nonMaxSuppSanityCheck(\n $boxes, $scores, maxOutputSize, iouThreshold, scoreThreshold,\n softNmsSigma);\n maxOutputSize = params.maxOutputSize;\n iouThreshold = params.iouThreshold;\n scoreThreshold = params.scoreThreshold;\n softNmsSigma = params.softNmsSigma;\n\n const inputs: NonMaxSuppressionV5Inputs = {boxes: $boxes, scores: $scores};\n const attrs: NonMaxSuppressionV5Attrs =\n {maxOutputSize, iouThreshold, scoreThreshold, softNmsSigma};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n const result = ENGINE.runKernel(\n NonMaxSuppressionV5, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as Tensor[];\n\n return {selectedIndices: result[0], selectedScores: result[1]};\n}\n\nexport const nonMaxSuppressionWithScore = op({nonMaxSuppressionWithScore_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {nonMaxSuppressionV5Impl} from '../../backends/non_max_suppression_impl';\nimport {Tensor1D, Tensor2D} from '../../tensor';\nimport {NamedTensorMap} from '../../tensor_types';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport {nonMaxSuppSanityCheck} from '../nonmax_util';\nimport {tensor1d} from '../tensor1d';\n\n/**\n * Asynchronously performs non maximum suppression of bounding boxes based on\n * iou (intersection over union).\n *\n * This op also supports a Soft-NMS mode (cf.\n * Bodla et al, https://arxiv.org/abs/1704.04503) where boxes reduce the score\n * of other overlapping boxes, therefore favoring different regions of the image\n * with high scores. To enable this Soft-NMS mode, set the `softNmsSigma`\n * parameter to be larger than 0.\n *\n * @param boxes a 2d tensor of shape `[numBoxes, 4]`. Each entry is\n * `[y1, x1, y2, x2]`, where `(y1, x1)` and `(y2, x2)` are the corners of\n * the bounding box.\n * @param scores a 1d tensor providing the box scores of shape `[numBoxes]`.\n * @param maxOutputSize The maximum number of boxes to be selected.\n * @param iouThreshold A float representing the threshold for deciding whether\n * boxes overlap too much with respect to IOU. Must be between [0, 1].\n * Defaults to 0.5 (50% box overlap).\n * @param scoreThreshold A threshold for deciding when to remove boxes based\n * on score. Defaults to -inf, which means any score is accepted.\n * @param softNmsSigma A float representing the sigma parameter for Soft NMS.\n * When sigma is 0, it falls back to nonMaxSuppression.\n * @return A map with the following properties:\n * - selectedIndices: A 1D tensor with the selected box indices.\n * - selectedScores: A 1D tensor with the corresponding scores for each\n * selected box.\n *\n * @doc {heading: 'Operations', subheading: 'Images', namespace: 'image'}\n */\nasync function nonMaxSuppressionWithScoreAsync_(\n boxes: Tensor2D|TensorLike, scores: Tensor1D|TensorLike,\n maxOutputSize: number, iouThreshold = 0.5,\n scoreThreshold = Number.NEGATIVE_INFINITY,\n softNmsSigma = 0.0): Promise {\n const $boxes = convertToTensor(boxes, 'boxes', 'nonMaxSuppressionAsync');\n const $scores = convertToTensor(scores, 'scores', 'nonMaxSuppressionAsync');\n\n const params = nonMaxSuppSanityCheck(\n $boxes, $scores, maxOutputSize, iouThreshold, scoreThreshold,\n softNmsSigma);\n maxOutputSize = params.maxOutputSize;\n iouThreshold = params.iouThreshold;\n scoreThreshold = params.scoreThreshold;\n softNmsSigma = params.softNmsSigma;\n\n const boxesAndScores = await Promise.all([$boxes.data(), $scores.data()]);\n const boxesVals = boxesAndScores[0];\n const scoresVals = boxesAndScores[1];\n\n // We call a cpu based impl directly with the typedarray data here rather\n // than a kernel because all kernels are synchronous (and thus cannot await\n // .data()).\n const {selectedIndices, selectedScores} = nonMaxSuppressionV5Impl(\n boxesVals, scoresVals, maxOutputSize, iouThreshold, scoreThreshold,\n softNmsSigma);\n\n if ($boxes !== boxes) {\n $boxes.dispose();\n }\n if ($scores !== scores) {\n $scores.dispose();\n }\n\n return {\n selectedIndices: tensor1d(selectedIndices, 'int32'),\n selectedScores: tensor1d(selectedScores)\n };\n}\n\nexport const nonMaxSuppressionWithScoreAsync = nonMaxSuppressionWithScoreAsync_;\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {NonMaxSuppressionV4, NonMaxSuppressionV4Attrs, NonMaxSuppressionV4Inputs} from '../../kernel_names';\nimport {NamedAttrMap} from '../../kernel_registry';\nimport {Tensor, Tensor1D, Tensor2D} from '../../tensor';\nimport {NamedTensorMap} from '../../tensor_types';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\n\nimport {nonMaxSuppSanityCheck} from '../nonmax_util';\nimport {op} from '../operation';\n\n/**\n * Asynchronously performs non maximum suppression of bounding boxes based on\n * iou (intersection over union), with an option to pad results.\n *\n * @param boxes a 2d tensor of shape `[numBoxes, 4]`. Each entry is\n * `[y1, x1, y2, x2]`, where `(y1, x1)` and `(y2, x2)` are the corners of\n * the bounding box.\n * @param scores a 1d tensor providing the box scores of shape `[numBoxes]`.\n * @param maxOutputSize The maximum number of boxes to be selected.\n * @param iouThreshold A float representing the threshold for deciding whether\n * boxes overlap too much with respect to IOU. Must be between [0, 1].\n * Defaults to 0.5 (50% box overlap).\n * @param scoreThreshold A threshold for deciding when to remove boxes based\n * on score. Defaults to -inf, which means any score is accepted.\n * @param padToMaxOutputSize Defaults to false. If true, size of output\n * `selectedIndices` is padded to maxOutputSize.\n * @return A map with the following properties:\n * - selectedIndices: A 1D tensor with the selected box indices.\n * - validOutputs: A scalar denoting how many elements in `selectedIndices`\n * are valid. Valid elements occur first, then padding.\n *\n * @doc {heading: 'Operations', subheading: 'Images', namespace: 'image'}\n */\nfunction nonMaxSuppressionPadded_(\n boxes: Tensor2D|TensorLike, scores: Tensor1D|TensorLike,\n maxOutputSize: number, iouThreshold = 0.5,\n scoreThreshold = Number.NEGATIVE_INFINITY,\n padToMaxOutputSize = false): NamedTensorMap {\n const $boxes = convertToTensor(boxes, 'boxes', 'nonMaxSuppression');\n const $scores = convertToTensor(scores, 'scores', 'nonMaxSuppression');\n\n const params = nonMaxSuppSanityCheck(\n $boxes, $scores, maxOutputSize, iouThreshold, scoreThreshold,\n null /* softNmsSigma */);\n const $maxOutputSize = params.maxOutputSize;\n const $iouThreshold = params.iouThreshold;\n const $scoreThreshold = params.scoreThreshold;\n\n const inputs: NonMaxSuppressionV4Inputs = {boxes: $boxes, scores: $scores};\n const attrs: NonMaxSuppressionV4Attrs = {\n maxOutputSize: $maxOutputSize,\n iouThreshold: $iouThreshold,\n scoreThreshold: $scoreThreshold,\n padToMaxOutputSize\n };\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n const result = ENGINE.runKernel(\n NonMaxSuppressionV4, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as Tensor[];\n\n return {selectedIndices: result[0], validOutputs: result[1]};\n}\n\nexport const nonMaxSuppressionPadded = op({nonMaxSuppressionPadded_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {nonMaxSuppressionV4Impl} from '../../backends/non_max_suppression_impl';\nimport {Tensor1D, Tensor2D} from '../../tensor';\nimport {NamedTensorMap} from '../../tensor_types';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport {nonMaxSuppSanityCheck} from '../nonmax_util';\nimport {scalar} from '../scalar';\nimport {tensor1d} from '../tensor1d';\n\n/**\n * Asynchronously performs non maximum suppression of bounding boxes based on\n * iou (intersection over union), with an option to pad results.\n *\n * @param boxes a 2d tensor of shape `[numBoxes, 4]`. Each entry is\n * `[y1, x1, y2, x2]`, where `(y1, x1)` and `(y2, x2)` are the corners of\n * the bounding box.\n * @param scores a 1d tensor providing the box scores of shape `[numBoxes]`.\n * @param maxOutputSize The maximum number of boxes to be selected.\n * @param iouThreshold A float representing the threshold for deciding whether\n * boxes overlap too much with respect to IOU. Must be between [0, 1].\n * Defaults to 0.5 (50% box overlap).\n * @param scoreThreshold A threshold for deciding when to remove boxes based\n * on score. Defaults to -inf, which means any score is accepted.\n * @param padToMaxOutputSize Defaults to false. If true, size of output\n * `selectedIndices` is padded to maxOutputSize.\n * @return A map with the following properties:\n * - selectedIndices: A 1D tensor with the selected box indices.\n * - validOutputs: A scalar denoting how many elements in `selectedIndices`\n * are valid. Valid elements occur first, then padding.\n *\n * @doc {heading: 'Operations', subheading: 'Images', namespace: 'image'}\n */\nasync function nonMaxSuppressionPaddedAsync_(\n boxes: Tensor2D|TensorLike, scores: Tensor1D|TensorLike,\n maxOutputSize: number, iouThreshold = 0.5,\n scoreThreshold = Number.NEGATIVE_INFINITY,\n padToMaxOutputSize = false): Promise {\n const $boxes = convertToTensor(boxes, 'boxes', 'nonMaxSuppressionAsync');\n const $scores = convertToTensor(scores, 'scores', 'nonMaxSuppressionAsync');\n\n const params = nonMaxSuppSanityCheck(\n $boxes, $scores, maxOutputSize, iouThreshold, scoreThreshold,\n null /* softNmsSigma */);\n const $maxOutputSize = params.maxOutputSize;\n const $iouThreshold = params.iouThreshold;\n const $scoreThreshold = params.scoreThreshold;\n\n const [boxesVals, scoresVals] =\n await Promise.all([$boxes.data(), $scores.data()]);\n\n // We call a cpu based impl directly with the typedarray data here rather\n // than a kernel because all kernels are synchronous (and thus cannot await\n // .data()).\n const {selectedIndices, validOutputs} = nonMaxSuppressionV4Impl(\n boxesVals, scoresVals, $maxOutputSize, $iouThreshold, $scoreThreshold,\n padToMaxOutputSize);\n\n if ($boxes !== boxes) {\n $boxes.dispose();\n }\n if ($scores !== scores) {\n $scores.dispose();\n }\n\n return {\n selectedIndices: tensor1d(selectedIndices, 'int32'),\n validOutputs: scalar(validOutputs, 'int32')\n };\n}\n\nexport const nonMaxSuppressionPaddedAsync = nonMaxSuppressionPaddedAsync_;\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {ResizeBilinear, ResizeBilinearAttrs, ResizeBilinearInputs} from '../../kernel_names';\nimport {NamedAttrMap} from '../../kernel_registry';\nimport {Tensor3D, Tensor4D} from '../../tensor';\nimport {NamedTensorMap} from '../../tensor_types';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport * as util from '../../util';\n\nimport {op} from '../operation';\nimport {reshape} from '../reshape';\n\n/**\n * Bilinear resize a single 3D image or a batch of 3D images to a new shape.\n *\n * @param images The images, of rank 4 or rank 3, of shape\n * `[batch, height, width, inChannels]`. If rank 3, batch of 1 is assumed.\n * @param size The new shape `[newHeight, newWidth]` to resize the\n * images to. Each channel is resized individually.\n * @param alignCorners Defaults to `false`. If true, rescale\n * input by `(new_height - 1) / (height - 1)`, which exactly aligns the 4\n * corners of images and resized images. If false, rescale by\n * `new_height / height`. Treat similarly the width dimension.\n * @param halfPixelCenters Defaults to `false`. Whether to assume pixel centers\n * are at 0.5, which would make the floating point coordinates of the top\n * left pixel 0.5, 0.5.\n *\n * @doc {heading: 'Operations', subheading: 'Images', namespace: 'image'}\n */\nfunction resizeBilinear_(\n images: T|TensorLike, size: [number, number], alignCorners = false,\n halfPixelCenters = false): T {\n const $images = convertToTensor(images, 'images', 'resizeBilinear');\n\n util.assert(\n $images.rank === 3 || $images.rank === 4,\n () => `Error in resizeBilinear: x must be rank 3 or 4, but got ` +\n `rank ${$images.rank}.`);\n util.assert(\n size.length === 2,\n () => `Error in resizeBilinear: new shape must 2D, but got shape ` +\n `${size}.`);\n util.assert(\n halfPixelCenters === false || alignCorners === false,\n () => `Error in resizeBilinear: If halfPixelCenters is true, ` +\n `alignCorners must be false.`);\n\n let batchImages = $images as Tensor4D;\n let reshapedTo4D = false;\n if ($images.rank === 3) {\n reshapedTo4D = true;\n batchImages = reshape(\n $images, [1, $images.shape[0], $images.shape[1], $images.shape[2]]);\n }\n\n const [] = size;\n\n const inputs: ResizeBilinearInputs = {images: batchImages};\n const attrs: ResizeBilinearAttrs = {alignCorners, halfPixelCenters, size};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n const res = ENGINE.runKernel(\n ResizeBilinear, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as T;\n\n if (reshapedTo4D) {\n return reshape(res, [res.shape[1], res.shape[2], res.shape[3]]) as T;\n }\n return res;\n}\n\nexport const resizeBilinear = op({resizeBilinear_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {ResizeNearestNeighbor, ResizeNearestNeighborAttrs, ResizeNearestNeighborInputs} from '../../kernel_names';\nimport {NamedAttrMap} from '../../kernel_registry';\nimport {Tensor3D, Tensor4D} from '../../tensor';\nimport {NamedTensorMap} from '../../tensor_types';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport * as util from '../../util';\n\nimport {op} from '../operation';\nimport {reshape} from '../reshape';\n\n/**\n * NearestNeighbor resize a batch of 3D images to a new shape.\n *\n * @param images The images, of rank 4 or rank 3, of shape\n * `[batch, height, width, inChannels]`. If rank 3, batch of 1 is assumed.\n * @param size The new shape `[newHeight, newWidth]` to resize the\n * images to. Each channel is resized individually.\n * @param alignCorners Defaults to False. If true, rescale\n * input by `(new_height - 1) / (height - 1)`, which exactly aligns the 4\n * corners of images and resized images. If false, rescale by\n * `new_height / height`. Treat similarly the width dimension.\n * @param halfPixelCenters Defaults to `false`. Whether to assume pixels are of\n * half the actual dimensions, and yield more accurate resizes. This flag\n * would also make the floating point coordinates of the top left pixel\n * 0.5, 0.5.\n *\n * @doc {heading: 'Operations', subheading: 'Images', namespace: 'image'}\n */\nfunction resizeNearestNeighbor_(\n images: T|TensorLike, size: [number, number], alignCorners = false,\n halfPixelCenters = false): T {\n const $images = convertToTensor(images, 'images', 'resizeNearestNeighbor');\n\n util.assert(\n $images.rank === 3 || $images.rank === 4,\n () => `Error in resizeNearestNeighbor: x must be rank 3 or 4, but got ` +\n `rank ${$images.rank}.`);\n util.assert(\n size.length === 2,\n () =>\n `Error in resizeNearestNeighbor: new shape must 2D, but got shape ` +\n `${size}.`);\n util.assert(\n $images.dtype === 'float32' || $images.dtype === 'int32',\n () => '`images` must have `int32` or `float32` as dtype');\n util.assert(\n halfPixelCenters === false || alignCorners === false,\n () => `Error in resizeNearestNeighbor: If halfPixelCenters is true, ` +\n `alignCorners must be false.`);\n let batchImages = $images as Tensor4D;\n let reshapedTo4D = false;\n if ($images.rank === 3) {\n reshapedTo4D = true;\n batchImages = reshape(\n $images, [1, $images.shape[0], $images.shape[1], $images.shape[2]]);\n }\n const [] = size;\n\n const inputs: ResizeNearestNeighborInputs = {images: batchImages};\n const attrs:\n ResizeNearestNeighborAttrs = {alignCorners, halfPixelCenters, size};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n const res = ENGINE.runKernel(\n ResizeNearestNeighbor, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as T;\n\n if (reshapedTo4D) {\n return reshape(res, [res.shape[1], res.shape[2], res.shape[3]]) as T;\n }\n return res;\n}\n\nexport const resizeNearestNeighbor = op({resizeNearestNeighbor_});\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport { Tensor1D, Tensor3D } from '../../tensor';\nimport { tensor1d } from '../tensor1d';\nimport { TensorLike } from '../../types';\nimport { op } from '../operation';\nimport { cast } from '../cast';\nimport { split } from '../split';\nimport { bincount } from '../bincount';\nimport { lessEqual } from '../less_equal';\nimport { greater } from '../greater';\nimport { sum } from '../sum';\nimport { add } from '../add';\nimport { mul } from '../mul';\nimport { div } from '../div';\nimport { sub } from '../sub';\nimport { round } from '../round';\nimport { where } from '../where';\nimport { fill } from '../fill';\nimport {slice} from '../slice';\nimport { range } from '../range';\nimport { tensor } from '../tensor';\nimport * as util from '../../util';\nimport { convertToTensor } from '../../tensor_util_env';\n\n/**\n * Performs image binarization with corresponding threshold\n * (depends on the method)value, which creates a binary image from a grayscale.\n * @param image 3d tensor of shape [imageHeight,imageWidth, depth],\n * where imageHeight and imageWidth must be positive.The image color\n * range should be [0, 255].\n * @param method Optional string from `'binary' | 'otsu'`\n * which specifies the method for thresholding. Defaults to 'binary'.\n * @param inverted Optional boolean whichspecifies\n * if colours should be inverted. Defaults to false.\n * @param threshValue Optional number which defines threshold value from 0 to 1.\n * Defaults to 0.5.\n * @return A 3d tensor of shape [imageHeight,imageWidth, depth], which\n * contains binarized image.\n */\n\nfunction threshold_(\n image: Tensor3D | TensorLike,\n method = 'binary',\n inverted = false,\n threshValue = 0.5\n): Tensor3D {\n const $image = convertToTensor(image, 'image', 'threshold');\n\n /* 0.2989, 0.5870, 0.1140 are represent luma coefficients in CCIR601.\n\tReference for converting between RGB and grayscale: https://en.wikipedia.org/wiki/Luma_%28video%29 */\n\n const RED_INTENCITY_COEF = 0.2989;\n const GREEN_INTENCITY_COEF = 0.5870;\n const BLUE_INTENCITY_COEF = 0.1140;\n const totalPixelsInImage = $image.shape[0] * $image.shape[1];\n\n let $threshold = mul(tensor1d([threshValue]), 255);\n let r, g, b, grayscale;\n\n util.assert(\n $image.rank === 3,\n () => 'Error in threshold: image must be rank 3,' +\n `but got rank ${$image.rank}.`);\n\n util.assert(\n $image.shape[2] === 3 || $image.shape[2]=== 1,\n () => 'Error in threshold: ' +\n 'image color channel must be equal to 3 or 1' +\n `but got ${$image.shape[2]}.`);\n\n util.assert(\n $image.dtype === 'int32' || $image.dtype === 'float32',\n () => 'Error in dtype: image dtype must be int32 or float32,' +\n `but got dtype ${$image.dtype}.`);\n\n util.assert(\n method === 'otsu' || method === 'binary',\n () => `Method must be binary or otsu, but was ${method}`);\n\n if ($image.shape[2] === 3) {\n [r, g, b] = split($image, [1, 1, 1], -1);\n const $r = mul(r,RED_INTENCITY_COEF);\n const $g = mul(g,GREEN_INTENCITY_COEF);\n const $b = mul(b,BLUE_INTENCITY_COEF);\n grayscale = add(add($r, $g), $b);\n } else {\n grayscale = image;\n }\n\n if (method === 'otsu') {\n const $histogram = bincount(cast(round(grayscale), 'int32') as Tensor1D,\n tensor([]),\n 256);\n $threshold = otsu($histogram, totalPixelsInImage);\n }\n\n const invCondition = inverted ?\n lessEqual(grayscale, $threshold) : greater(grayscale, $threshold);\n\n const result = cast(mul(invCondition,255), 'int32');\n\n return result as Tensor3D;\n}\n\nfunction otsu(histogram: Tensor1D, total: number):Tensor1D {\n\n let bestThresh = tensor1d([-1]);\n let bestInBetVar = tensor1d([0]);\n let cInBetVar = tensor1d([0]);\n let classFirst, classSecond, meanFirst,\n meanSec, weightForeground, weightBack;\n\n for (let index = 0; index < histogram.size-1; index++) {\n\n classFirst = slice(histogram, 0, index + 1);\n\n classSecond = slice(histogram,index + 1);\n\n weightForeground = div(sum(classFirst),total);\n\n weightBack = div(sum(classSecond),total);\n\n const meanFirstDivA = sum(mul(classFirst, range(0, classFirst.size)));\n\n meanFirst = div(meanFirstDivA, sum(classFirst) );\n\n const meanSecFill = fill(classSecond.shape, classFirst.size);\n const meanSecAdd = add(range(0,classSecond.size),meanSecFill);\n const meanSecMul = mul(classSecond, (meanSecAdd));\n meanSec = div(sum(meanSecMul), sum(classSecond));\n\n const cInBetVarSubA = sub(meanFirst, meanSec);\n const cInBetVarSubB = sub(meanFirst, meanSec);\n const cInBetVarMul = mul(weightForeground, weightBack);\n cInBetVar = mul(mul(cInBetVarMul,cInBetVarSubA), cInBetVarSubB);\n\n const condition = greater(cInBetVar, bestInBetVar);\n\n bestInBetVar = where(condition, cInBetVar, bestInBetVar);\n\n bestThresh = where(condition, tensor1d([index]), bestThresh);\n\n }\n return bestThresh;\n}\n\nexport const threshold = op({ threshold_ });\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../../engine';\nimport {Transform, TransformAttrs, TransformInputs} from '../../kernel_names';\nimport {NamedAttrMap} from '../../kernel_registry';\nimport {Tensor2D, Tensor4D} from '../../tensor';\nimport {NamedTensorMap} from '../../tensor_types';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport * as util from '../../util';\n\nimport {op} from '../operation';\n\n/**\n * Applies the given transform(s) to the image(s).\n *\n * @param image 4d tensor of shape `[batch, imageHeight, imageWidth, depth]`.\n * @param transforms Projective transform matrix/matrices. A tensor1d of length\n * 8 or tensor of size N x 8. If one row of transforms is [a0, a1, a2, b0,\n * b1, b2, c0, c1], then it maps the output point (x, y) to a transformed\n * input point (x', y') = ((a0 x + a1 y + a2) / k, (b0 x + b1 y + b2) / k),\n * where k = c0 x + c1 y + 1. The transforms are inverted compared to the\n * transform mapping input points to output points.\n * @param interpolation Interpolation mode.\n * Supported values: 'nearest', 'bilinear'. Default to 'nearest'.\n * @param fillMode Points outside the boundaries of the input are filled\n * according to the given mode, one of 'constant', 'reflect', 'wrap',\n * 'nearest'. Default to 'constant'.\n * 'reflect': (d c b a | a b c d | d c b a ) The input is extended by\n * reflecting about the edge of the last pixel.\n * 'constant': (k k k k | a b c d | k k k k) The input is extended by\n * filling all values beyond the edge with the same constant value k.\n * 'wrap': (a b c d | a b c d | a b c d) The input is extended by\n * wrapping around to the opposite edge.\n * 'nearest': (a a a a | a b c d | d d d d) The input is extended by\n * the nearest pixel.\n * @param fillValue A float represents the value to be filled outside the\n * boundaries when fillMode is 'constant'.\n * @param Output dimension after the transform, [height, width]. If undefined,\n * output is the same size as input image.\n *\n * @doc {heading: 'Operations', subheading: 'Images', namespace: 'image'}\n */\nfunction transform_(\n image: Tensor4D|TensorLike, transforms: Tensor2D|TensorLike,\n interpolation: 'nearest'|'bilinear' = 'nearest',\n fillMode: 'constant'|'reflect'|'wrap'|'nearest' = 'constant', fillValue = 0,\n outputShape?: [number, number]): Tensor4D {\n const $image = convertToTensor(image, 'image', 'transform', 'float32');\n const $transforms =\n convertToTensor(transforms, 'transforms', 'transform', 'float32');\n\n util.assert(\n $image.rank === 4,\n () => 'Error in transform: image must be rank 4,' +\n `but got rank ${$image.rank}.`);\n\n util.assert(\n $transforms.rank === 2 &&\n ($transforms.shape[0] === $image.shape[0] ||\n $transforms.shape[0] === 1) &&\n $transforms.shape[1] === 8,\n () => `Error in transform: Input transform should be batch x 8 or 1 x 8`);\n\n util.assert(\n outputShape == null || outputShape.length === 2,\n () =>\n 'Error in transform: outputShape must be [height, width] or null, ' +\n `but got ${outputShape}.`);\n\n const inputs: TransformInputs = {image: $image, transforms: $transforms};\n const attrs:\n TransformAttrs = {interpolation, fillMode, fillValue, outputShape};\n\n return ENGINE.runKernel(\n Transform, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const transform = op({transform_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../../tensor';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport {assert} from '../../util';\n\nimport {greaterEqual} from '../greater_equal';\nimport {lessEqual} from '../less_equal';\nimport {logicalAnd} from '../logical_and';\nimport {op} from '../operation';\nimport {range} from '../range';\nimport {reshape} from '../reshape';\nimport {scalar} from '../scalar';\nimport {stack} from '../stack';\nimport {sub} from '../sub';\nimport {unstack} from '../unstack';\nimport {where} from '../where';\nimport {zeros} from '../zeros';\n\n/**\n * Copy a tensor setting everything outside a central band in each innermost\n * matrix to zero.\n *\n * The band part is computed as follows: Assume input has `k` dimensions\n * `[I, J, K, ..., M, N]`, then the output is a tensor with the same shape where\n * `band[i, j, k, ..., m, n] = in_band(m, n) * input[i, j, k, ..., m, n]`.\n * The indicator function\n * `in_band(m, n) = (num_lower < 0 || (m-n) <= num_lower)`\n * `&& (num_upper < 0 || (n-m) <= num_upper)`\n *\n * ```js\n * const x = tf.tensor2d([[ 0, 1, 2, 3],\n * [-1, 0, 1, 2],\n * [-2, -1, 0, 1],\n * [-3, -2, -1, 0]]);\n * let y = tf.linalg.bandPart(x, 1, -1);\n * y.print(); // [[ 0, 1, 2, 3],\n * // [-1, 0, 1, 2],\n * // [ 0, -1, 0, 1],\n * // [ 0, 0 , -1, 0]]\n * let z = tf.linalg.bandPart(x, 2, 1);\n * z.print(); // [[ 0, 1, 0, 0],\n * // [-1, 0, 1, 0],\n * // [-2, -1, 0, 1],\n * // [ 0, -2, -1, 0]]\n * ```\n *\n * @param x Rank `k` tensor\n * @param numLower Number of subdiagonals to keep.\n * If negative, keep entire lower triangle.\n * @param numUpper Number of subdiagonals to keep.\n * If negative, keep entire upper triangle.\n * @returns Rank `k` tensor of the same shape as input.\n * The extracted banded tensor.\n *\n * @doc {heading:'Operations', subheading:'Linear Algebra', namespace:'linalg'}\n */\nfunction bandPart_(\n a: T|TensorLike, numLower: number, numUpper: number): T {\n assert(\n numLower % 1 === 0,\n () => `bandPart(): numLower must be an integer, got ${numLower}.`);\n assert(\n numUpper % 1 === 0,\n () => `bandPart(): numUpper must be an integer, got ${numUpper}.`);\n\n const $a = convertToTensor(a, 'a', 'bandPart');\n\n assert(\n $a.rank >= 2,\n () => `bandPart(): Rank must be at least 2, got ${$a.rank}.`);\n\n const shape = $a.shape;\n const [M, N] = $a.shape.slice(-2);\n\n if (!(numLower <= M)) {\n throw new Error(\n `bandPart(): numLower (${numLower})` +\n ` must not be greater than the number of rows (${M}).`);\n }\n if (!(numUpper <= N)) {\n throw new Error(\n `bandPart(): numUpper (${numUpper})` +\n ` must not be greater than the number of columns (${N}).`);\n }\n\n if (numLower < 0) {\n numLower = M;\n }\n if (numUpper < 0) {\n numUpper = N;\n }\n\n const i = reshape(range(0, M, 1, 'int32'), [-1, 1]);\n const j = range(0, N, 1, 'int32');\n const ij = sub(i, j);\n\n const inBand = logicalAnd(\n lessEqual(ij, scalar(+numLower, 'int32')),\n greaterEqual(ij, scalar(-numUpper, 'int32')));\n\n const zero = zeros([M, N], $a.dtype);\n\n return reshape(\n stack(unstack(reshape($a, [-1, M, N]))\n .map(mat => where(inBand, mat, zero))),\n shape) as T;\n}\n\nexport const bandPart = op({bandPart_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {Tensor1D, Tensor2D} from '../../tensor';\nimport {assert} from '../../util';\n\nimport {div} from '../div';\nimport {mul} from '../mul';\nimport {norm} from '../norm';\nimport {op} from '../operation';\nimport {split} from '../split';\nimport {squeeze} from '../squeeze';\nimport {stack} from '../stack';\nimport {sub} from '../sub';\nimport {sum} from '../sum';\n\n/**\n * Gram-Schmidt orthogonalization.\n *\n * ```js\n * const x = tf.tensor2d([[1, 2], [3, 4]]);\n * let y = tf.linalg.gramSchmidt(x);\n * y.print();\n * console.log('Orthogonalized:');\n * y.dot(y.transpose()).print(); // should be nearly the identity matrix.\n * console.log('First row direction maintained:');\n * const data = await y.array();\n * console.log(data[0][1] / data[0][0]); // should be nearly 2.\n * ```\n *\n * @param xs The vectors to be orthogonalized, in one of the two following\n * formats:\n * - An Array of `tf.Tensor1D`.\n * - A `tf.Tensor2D`, i.e., a matrix, in which case the vectors are the rows\n * of `xs`.\n * In each case, all the vectors must have the same length and the length\n * must be greater than or equal to the number of vectors.\n * @returns The orthogonalized and normalized vectors or matrix.\n * Orthogonalization means that the vectors or the rows of the matrix\n * are orthogonal (zero inner products). Normalization means that each\n * vector or each row of the matrix has an L2 norm that equals `1`.\n *\n * @doc {heading:'Operations', subheading:'Linear Algebra', namespace:'linalg'}\n */\nfunction gramSchmidt_(xs: Tensor1D[]|Tensor2D): Tensor1D[]|Tensor2D {\n let inputIsTensor2D: boolean;\n if (Array.isArray(xs)) {\n inputIsTensor2D = false;\n assert(\n xs != null && xs.length > 0,\n () => 'Gram-Schmidt process: input must not be null, undefined, or ' +\n 'empty');\n const dim = xs[0].shape[0];\n for (let i = 1; i < xs.length; ++i) {\n assert(\n xs[i].shape[0] === dim,\n () =>\n 'Gram-Schmidt: Non-unique lengths found in the input vectors: ' +\n `(${(xs as Tensor1D[])[i].shape[0]} vs. ${dim})`);\n }\n } else {\n inputIsTensor2D = true;\n xs = split(xs, xs.shape[0], 0).map(x => squeeze(x, [0]));\n }\n\n assert(\n xs.length <= xs[0].shape[0],\n () => `Gram-Schmidt: Number of vectors (${\n (xs as Tensor1D[]).length}) exceeds ` +\n `number of dimensions (${(xs as Tensor1D[])[0].shape[0]}).`);\n\n const ys: Tensor1D[] = [];\n const xs1d = xs;\n for (let i = 0; i < xs.length; ++i) {\n ys.push(ENGINE.tidy(() => {\n let x = xs1d[i];\n if (i > 0) {\n for (let j = 0; j < i; ++j) {\n const proj = mul(sum(mul(ys[j], x)), ys[j]);\n x = sub(x, proj);\n }\n }\n return div(x, norm(x, 'euclidean'));\n }));\n }\n\n if (inputIsTensor2D) {\n return stack(ys, 0) as Tensor2D;\n } else {\n return ys;\n }\n}\n\nexport const gramSchmidt = op({gramSchmidt_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../../engine';\nimport {dispose} from '../../globals';\nimport {Tensor, Tensor2D} from '../../tensor';\nimport {assert} from '../../util';\n\nimport {clone} from '../clone';\nimport {concat} from '../concat';\nimport {div} from '../div';\nimport {eye} from '../eye';\nimport {greater} from '../greater';\nimport {matMul} from '../mat_mul';\nimport {mul} from '../mul';\nimport {neg} from '../neg';\nimport {norm} from '../norm';\nimport {op} from '../operation';\nimport {reshape} from '../reshape';\nimport {slice} from '../slice';\nimport {stack} from '../stack';\nimport {sub} from '../sub';\nimport {tensor2d} from '../tensor2d';\nimport {transpose} from '../transpose';\nimport {unstack} from '../unstack';\nimport {where} from '../where';\n\n/**\n * Compute QR decomposition of m-by-n matrix using Householder transformation.\n *\n * Implementation based on\n * [http://www.cs.cornell.edu/~bindel/class/cs6210-f09/lec18.pdf]\n * (http://www.cs.cornell.edu/~bindel/class/cs6210-f09/lec18.pdf)\n *\n * ```js\n * const a = tf.tensor2d([[1, 2], [3, 4]]);\n * let [q, r] = tf.linalg.qr(a);\n * console.log('Q');\n * q.print();\n * console.log('R');\n * r.print();\n * console.log('Orthogonalized');\n * q.dot(q.transpose()).print() // should be nearly the identity matrix.\n * console.log('Reconstructed');\n * q.dot(r).print(); // should be nearly [[1, 2], [3, 4]];\n * ```\n *\n * @param x The `tf.Tensor` to be QR-decomposed. Must have rank >= 2. Suppose\n * it has the shape `[..., M, N]`.\n * @param fullMatrices An optional boolean parameter. Defaults to `false`.\n * If `true`, compute full-sized `Q`. If `false` (the default),\n * compute only the leading N columns of `Q` and `R`.\n * @returns An `Array` of two `tf.Tensor`s: `[Q, R]`. `Q` is a unitary matrix,\n * i.e., its columns all have unit norm and are mutually orthogonal.\n * If `M >= N`,\n * If `fullMatrices` is `false` (default),\n * - `Q` has a shape of `[..., M, N]`,\n * - `R` has a shape of `[..., N, N]`.\n * If `fullMatrices` is `true` (default),\n * - `Q` has a shape of `[..., M, M]`,\n * - `R` has a shape of `[..., M, N]`.\n * If `M < N`,\n * - `Q` has a shape of `[..., M, M]`,\n * - `R` has a shape of `[..., M, N]`.\n * @throws If the rank of `x` is less than 2.\n *\n * @doc {heading:'Operations',\n * subheading:'Linear Algebra',\n * namespace:'linalg'}\n */\nfunction qr_(x: Tensor, fullMatrices = false): [Tensor, Tensor] {\n assert(\n x.rank >= 2,\n () => `qr() requires input tensor to have a rank >= 2, but got rank ${\n x.rank}`);\n\n if (x.rank === 2) {\n return qr2d(x as Tensor2D, fullMatrices);\n } else {\n // Rank > 2.\n // TODO(cais): Below we split the input into individual 2D tensors,\n // perform QR decomposition on them and then stack the results back\n // together. We should explore whether this can be parallelized.\n const outerDimsProd = x.shape.slice(0, x.shape.length - 2)\n .reduce((value, prev) => value * prev);\n const x2ds = unstack(\n reshape(\n x,\n [\n outerDimsProd, x.shape[x.shape.length - 2],\n x.shape[x.shape.length - 1]\n ]),\n 0);\n const q2ds: Tensor2D[] = [];\n const r2ds: Tensor2D[] = [];\n x2ds.forEach(x2d => {\n const [q2d, r2d] = qr2d(x2d as Tensor2D, fullMatrices);\n q2ds.push(q2d);\n r2ds.push(r2d);\n });\n const q = reshape(stack(q2ds, 0), x.shape);\n const r = reshape(stack(r2ds, 0), x.shape);\n return [q, r];\n }\n}\n\nfunction qr2d(x: Tensor2D, fullMatrices = false): [Tensor2D, Tensor2D] {\n return ENGINE.tidy(() => {\n assert(\n x.shape.length === 2,\n () => `qr2d() requires a 2D Tensor, but got a ${\n x.shape.length}D Tensor.`);\n\n const m = x.shape[0];\n const n = x.shape[1];\n\n let q = eye(m); // Orthogonal transform so far.\n let r = clone(x); // Transformed matrix so far.\n\n const one2D = tensor2d([[1]], [1, 1]);\n let w: Tensor2D = clone(one2D);\n\n const iters = m >= n ? n : m;\n for (let j = 0; j < iters; ++j) {\n // This tidy within the for-loop ensures we clean up temporary\n // tensors as soon as they are no longer needed.\n const rTemp = r;\n const wTemp = w;\n const qTemp = q;\n [w, r, q] = ENGINE.tidy((): [Tensor2D, Tensor2D, Tensor2D] => {\n // Find H = I - tau * w * w', to put zeros below R(j, j).\n const rjEnd1 = slice(r, [j, j], [m - j, 1]);\n const normX = norm(rjEnd1);\n const rjj = slice(r, [j, j], [1, 1]);\n\n // The sign() function returns 0 on 0, which causes division by zero.\n const s = where(greater(rjj, 0), tensor2d([[-1]]), tensor2d([[1]]));\n\n const u1 = sub(rjj, mul(s, normX));\n const wPre = div(rjEnd1, u1);\n if (wPre.shape[0] === 1) {\n w = clone(one2D);\n } else {\n w = concat(\n [\n one2D,\n slice(wPre, [1, 0], [wPre.shape[0] - 1, wPre.shape[1]]) as\n Tensor2D\n ],\n 0);\n }\n const tau = neg(div(matMul(s, u1), normX)) as Tensor2D;\n\n // -- R := HR, Q := QH.\n const rjEndAll = slice(r, [j, 0], [m - j, n]);\n const tauTimesW: Tensor2D = mul(tau, w);\n const wT: Tensor2D = transpose(w);\n if (j === 0) {\n r = sub(rjEndAll, matMul(tauTimesW, matMul(wT, rjEndAll)));\n } else {\n const rTimesTau: Tensor2D =\n sub(rjEndAll, matMul(tauTimesW, matMul(wT, rjEndAll)));\n r = concat([slice(r, [0, 0], [j, n]), rTimesTau], 0);\n }\n const tawTimesWT: Tensor2D = transpose(tauTimesW);\n const qAllJEnd = slice(q, [0, j], [m, q.shape[1] - j]);\n if (j === 0) {\n q = sub(qAllJEnd, matMul(matMul(qAllJEnd, w), tawTimesWT));\n } else {\n const qTimesTau: Tensor2D =\n sub(qAllJEnd, matMul(matMul(qAllJEnd, w), tawTimesWT));\n q = concat([slice(q, [0, 0], [m, j]), qTimesTau], 1);\n }\n return [w, r, q];\n });\n dispose([rTemp, wTemp, qTemp]);\n }\n\n if (!fullMatrices && m > n) {\n q = slice(q, [0, 0], [m, n]);\n r = slice(r, [0, 0], [n, n]);\n }\n\n return [q, r];\n }) as [Tensor2D, Tensor2D];\n}\n\nexport const qr = op({qr_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nexport enum Reduction {\n NONE,\n MEAN,\n SUM,\n SUM_BY_NONZERO_WEIGHTS\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor} from '../../tensor';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\n\nimport {cast} from '../cast';\nimport {div} from '../div';\nimport {Reduction} from '../loss_ops_utils';\nimport {mean} from '../mean';\nimport {mul} from '../mul';\nimport {notEqual} from '../not_equal';\nimport {ones} from '../ones';\nimport {op} from '../operation';\nimport {scalar} from '../scalar';\nimport {sum} from '../sum';\n\n/**\n * Computes the weighted loss between two tensors.\n *\n * @param losses Tensor of shape `[batch_size, d1, ..., dN]`.\n * @param weights Tensor whose rank is either 0, or the same rank as\n * `losses`, and must be broadcastable to `losses` (i.e., all\n * dimensions must be either `1`, or the same as the corresponding\n * `losses` dimension).\n *\n * @doc {heading: 'Training', subheading: 'Losses', namespace: 'losses'}\n */\nfunction computeWeightedLoss_(\n losses: T|TensorLike, weights?: Tensor|TensorLike,\n reduction = Reduction.SUM_BY_NONZERO_WEIGHTS): O {\n const $losses = convertToTensor(losses, 'losses', 'computeWeightedLoss');\n let $weights: Tensor = null;\n if (weights != null) {\n $weights = convertToTensor(weights, 'weights', 'computeWeightedLoss');\n }\n\n const weightedLoss = ($weights == null) ? $losses : mul($losses, $weights);\n\n if (reduction === Reduction.NONE) {\n return weightedLoss as O;\n }\n if (reduction === Reduction.SUM) {\n return sum(weightedLoss);\n }\n if (reduction === Reduction.MEAN) {\n if ($weights == null) {\n return mean(weightedLoss);\n } else {\n const broadcastFactor = $losses.size / $weights.size;\n const result = div(sum(weightedLoss), sum($weights));\n return broadcastFactor > 1 ? div(result, scalar(broadcastFactor)) :\n result as O;\n }\n }\n if (reduction === Reduction.SUM_BY_NONZERO_WEIGHTS) {\n if ($weights == null) {\n return div(sum(weightedLoss), scalar($losses.size));\n } else {\n const broadcastedWeights = mul($weights, ones($losses.shape));\n\n const numNonZeros =\n cast(sum(notEqual(broadcastedWeights, scalar(0))), 'float32');\n return div(sum(weightedLoss), numNonZeros);\n }\n }\n\n throw Error(`Unknown reduction: ${reduction}`);\n}\nexport const computeWeightedLoss = op({computeWeightedLoss_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../../tensor';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport {assertShapesMatch} from '../../util';\nimport {abs} from '../abs';\nimport {Reduction} from '../loss_ops_utils';\nimport {op} from '../operation';\nimport {sub} from '../sub';\n\nimport {computeWeightedLoss} from './compute_weighted_loss';\n\n/**\n * Computes the absolute difference loss between two tensors.\n *\n * @param labels The ground truth output tensor, same dimensions as\n * 'predictions'.\n * @param predictions The predicted outputs.\n * @param weights Tensor whose rank is either 0, or the same rank as\n * `labels`, and must be broadcastable to `labels` (i.e., all dimensions\n * must be either `1`, or the same as the corresponding `losses`\n * dimension).\n * @param reduction Type of reduction to apply to loss. Should be of type\n * `Reduction`\n *\n * @doc {heading: 'Training', subheading: 'Losses', namespace: 'losses'}\n */\nfunction absoluteDifference_(\n labels: T|TensorLike, predictions: T|TensorLike,\n weights?: Tensor|TensorLike,\n reduction = Reduction.SUM_BY_NONZERO_WEIGHTS): O {\n const $labels = convertToTensor(labels, 'labels', 'absoluteDifference');\n const $predictions =\n convertToTensor(predictions, 'predictions', 'absoluteDifference');\n let $weights: Tensor = null;\n if (weights != null) {\n $weights = convertToTensor(weights, 'weights', 'absoluteDifference');\n }\n assertShapesMatch(\n $labels.shape, $predictions.shape, 'Error in absoluteDifference: ');\n\n const losses = abs(sub($labels, $predictions));\n return computeWeightedLoss(losses, $weights, reduction);\n}\n\nexport const absoluteDifference = op({absoluteDifference_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor} from '../../tensor';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport {assertShapesMatch} from '../../util';\nimport {Reduction} from '../loss_ops_utils';\nimport {mul} from '../mul';\nimport {op} from '../operation';\nimport {scalar} from '../scalar';\nimport {sub} from '../sub';\nimport {sum} from '../sum';\n\nimport {computeWeightedLoss} from './compute_weighted_loss';\n\n/**\n * Computes the cosine distance loss between two tensors.\n *\n * @param labels The ground truth output tensor, same dimensions as\n * 'predictions'.\n * @param predictions The predicted outputs.\n * @param axis The dimension along which the cosine distance is computed.\n * @param weights Tensor whose rank is either 0, or the same rank as\n * `labels`, and must be broadcastable to `labels` (i.e., all dimensions\n * must be either `1`, or the same as the corresponding `losses`\n * dimension).\n * @param reduction Type of reduction to apply to loss. Should be of type\n * `Reduction`\n *\n * @doc {heading: 'Training', subheading: 'Losses', namespace: 'losses'}\n */\nfunction cosineDistance_(\n labels: T|TensorLike, predictions: T|TensorLike, axis: number,\n weights?: Tensor|TensorLike,\n reduction = Reduction.SUM_BY_NONZERO_WEIGHTS): O {\n const $labels = convertToTensor(labels, 'labels', 'cosineDistance');\n const $predictions =\n convertToTensor(predictions, 'predictions', 'cosineDistance');\n let $weights: Tensor = null;\n if (weights != null) {\n $weights = convertToTensor(weights, 'weights', 'cosineDistance');\n }\n assertShapesMatch(\n $labels.shape, $predictions.shape, 'Error in cosineDistance: ');\n\n const one = scalar(1);\n const losses = sub(one, sum(mul($labels, $predictions), axis, true));\n return computeWeightedLoss(losses, $weights, reduction);\n}\nexport const cosineDistance = op({cosineDistance_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor} from '../../tensor';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport {assertShapesMatch} from '../../util';\nimport {Reduction} from '../loss_ops_utils';\nimport {mul} from '../mul';\nimport {op} from '../operation';\nimport {relu} from '../relu';\nimport {scalar} from '../scalar';\nimport {sub} from '../sub';\n\nimport {computeWeightedLoss} from './compute_weighted_loss';\n\n/**\n * Computes the Hinge loss between two tensors.\n *\n * @param labels The ground truth output tensor, same dimensions as\n * 'predictions'.\n * @param predictions The predicted outputs.\n * @param weights Tensor whose rank is either 0, or the same rank as\n * `labels`, and must be broadcastable to `labels` (i.e., all dimensions\n * must be either `1`, or the same as the corresponding `losses`\n * dimension).\n * @param reduction Type of reduction to apply to loss. Should be of type\n * `Reduction`\n *\n * @doc {heading: 'Training', subheading: 'Losses', namespace: 'losses'}\n */\nfunction hingeLoss_(\n labels: T|TensorLike, predictions: T|TensorLike,\n weights?: Tensor|TensorLike,\n reduction = Reduction.SUM_BY_NONZERO_WEIGHTS): O {\n let $labels = convertToTensor(labels, 'labels', 'hingeLoss');\n const $predictions = convertToTensor(predictions, 'predictions', 'hingeLoss');\n let $weights: Tensor = null;\n if (weights != null) {\n $weights = convertToTensor(weights, 'weights', 'hingeLoss');\n }\n assertShapesMatch($labels.shape, $predictions.shape, 'Error in hingeLoss: ');\n\n const one = scalar(1);\n // Convert binary labels to (-1, 1)\n $labels = sub(mul(scalar(2), $labels), one);\n const losses = relu(sub(one, mul($labels, $predictions)));\n return computeWeightedLoss(losses, $weights, reduction);\n}\nexport const hingeLoss = op({hingeLoss_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../../tensor';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport {assertShapesMatch} from '../../util';\nimport {abs} from '../abs';\nimport {add} from '../add';\nimport {Reduction} from '../loss_ops_utils';\nimport {minimum} from '../minimum';\nimport {mul} from '../mul';\nimport {op} from '../operation';\nimport {scalar} from '../scalar';\nimport {square} from '../square';\nimport {sub} from '../sub';\n\nimport {computeWeightedLoss} from './compute_weighted_loss';\n\n/**\n * Computes the Huber loss between two tensors.\n *\n * @param labels The ground truth output tensor, same dimensions as\n * 'predictions'.\n * @param predictions The predicted outputs.\n * @param weights Tensor whose rank is either 0, or the same rank as\n * `labels`, and must be broadcastable to `labels` (i.e., all dimensions\n * must be either `1`, or the same as the corresponding `losses`\n * dimension).\n * @param delta Point where Huber loss changes from quadratic to linear.\n * @param reduction Type of reduction to apply to loss. Should be of type\n * `Reduction`.\n *\n * @doc {heading: 'Training', subheading: 'Losses', namespace: 'losses'}\n */\nfunction huberLoss_(\n labels: T|TensorLike, predictions: T|TensorLike,\n weights?: Tensor|TensorLike, delta = 1.0,\n reduction = Reduction.SUM_BY_NONZERO_WEIGHTS): O {\n const $labels = convertToTensor(labels, 'labels', 'huberLoss');\n const $predictions = convertToTensor(predictions, 'predictions', 'huberLoss');\n let $weights: Tensor = null;\n if (weights != null) {\n $weights = convertToTensor(weights, 'weights', 'huberLoss');\n }\n assertShapesMatch($labels.shape, $predictions.shape, 'Error in huberLoss: ');\n\n const deltaScalar = scalar(delta);\n const error = abs(sub($predictions, $labels));\n const quadratic = minimum(error, deltaScalar);\n const linear = sub(error, quadratic);\n\n const losses =\n add(mul(scalar(0.5), square(quadratic)), mul(deltaScalar, linear));\n return computeWeightedLoss(losses, $weights, reduction);\n}\nexport const huberLoss = op({huberLoss_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../../tensor';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport {assertShapesMatch} from '../../util';\nimport {add} from '../add';\nimport {log} from '../log';\nimport {Reduction} from '../loss_ops_utils';\nimport {mul} from '../mul';\nimport {neg} from '../neg';\nimport {op} from '../operation';\nimport {scalar} from '../scalar';\nimport {sub} from '../sub';\n\nimport {computeWeightedLoss} from './compute_weighted_loss';\n\n/**\n * Computes the log loss between two tensors.\n *\n * @param labels The ground truth output tensor, same dimensions as\n * 'predictions'.\n * @param predictions The predicted outputs.\n * @param weights Tensor whose rank is either 0, or the same rank as\n * `labels`, and must be broadcastable to `labels` (i.e., all dimensions\n * must be either `1`, or the same as the corresponding `losses`\n * dimension).\n * @param epsilon A small increment to avoid taking log of zero\n * @param reduction Type of reduction to apply to loss. Should be of type\n * `Reduction`\n *\n * @doc {heading: 'Training', subheading: 'Losses', namespace: 'losses'}\n */\nfunction logLoss_(\n labels: T|TensorLike, predictions: T|TensorLike,\n weights?: Tensor|TensorLike, epsilon = 1e-7,\n reduction = Reduction.SUM_BY_NONZERO_WEIGHTS): O {\n const $labels = convertToTensor(labels, 'labels', 'logLoss');\n const $predictions = convertToTensor(predictions, 'predictions', 'logLoss');\n let $weights: Tensor = null;\n if (weights != null) {\n $weights = convertToTensor(weights, 'weights', 'logLoss');\n }\n assertShapesMatch($labels.shape, $predictions.shape, 'Error in logLoss: ');\n\n const one = scalar(1);\n const epsilonScalar = scalar(epsilon);\n\n const l1 = neg(mul($labels, log(add($predictions, epsilonScalar))));\n const l2 =\n mul(sub(one, $labels), log(add(sub(one, $predictions), epsilonScalar)));\n const losses = sub(l1, l2);\n return computeWeightedLoss(losses, $weights, reduction);\n}\nexport const logLoss = op({logLoss_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../../tensor';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport {assertShapesMatch} from '../../util';\nimport {Reduction} from '../loss_ops_utils';\nimport {op} from '../operation';\nimport {squaredDifference} from '../squared_difference';\n\nimport {computeWeightedLoss} from './compute_weighted_loss';\n\n/**\n * Computes the mean squared error between two tensors.\n *\n * @param labels The ground truth output tensor, same dimensions as\n * 'predictions'.\n * @param predictions The predicted outputs.\n * @param weights Tensor whose rank is either 0, or the same rank as\n * `labels`, and must be broadcastable to `labels` (i.e., all dimensions\n * must be either `1`, or the same as the corresponding `losses`\n * dimension).\n * @param reduction Type of reduction to apply to loss. Should be of type\n * `Reduction`\n *\n * @doc {heading: 'Training', subheading: 'Losses', namespace: 'losses'}\n */\nfunction meanSquaredError_(\n labels: T|TensorLike, predictions: T|TensorLike,\n weights?: Tensor|TensorLike,\n reduction = Reduction.SUM_BY_NONZERO_WEIGHTS): O {\n const $labels = convertToTensor(labels, 'labels', 'meanSquaredError');\n const $predictions =\n convertToTensor(predictions, 'predictions', 'meanSquaredError');\n let $weights: Tensor = null;\n if (weights != null) {\n $weights = convertToTensor(weights, 'weights', 'meanSquaredError');\n }\n assertShapesMatch(\n $labels.shape, $predictions.shape, 'Error in meanSquaredError: ');\n\n const losses = squaredDifference($labels, $predictions);\n return computeWeightedLoss(losses, $weights, reduction);\n}\nexport const meanSquaredError = op({meanSquaredError_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../../tensor';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport {assertShapesMatch} from '../../util';\nimport {abs} from '../abs';\nimport {add} from '../add';\nimport {exp} from '../exp';\nimport {log1p} from '../log1p';\nimport {Reduction} from '../loss_ops_utils';\nimport {mul} from '../mul';\nimport {neg} from '../neg';\nimport {op} from '../operation';\nimport {relu} from '../relu';\nimport {scalar} from '../scalar';\nimport {sub} from '../sub';\n\nimport {computeWeightedLoss} from './compute_weighted_loss';\n\nfunction sigmoidCrossEntropyWithLogits_(\n labels: T|TensorLike, logits: T|TensorLike): O {\n const $labels =\n convertToTensor(labels, 'labels', 'sigmoidCrossEntropyWithLogits');\n const $logits =\n convertToTensor(logits, 'logits', 'sigmoidCrossEntropyWithLogits');\n assertShapesMatch(\n $labels.shape, $logits.shape, 'Error in sigmoidCrossEntropyWithLogits: ');\n\n /**\n * Implementation Details:\n *\n * For brevity, let `x = logits`, `z = labels`. The logistic loss is\n * z * -log(sigmoid(x)) + (1 - z) * -log(1 - sigmoid(x))\n * = z * -log(1 / (1 + exp(-x))) + (1 - z) * -log(exp(-x) / (1 + exp(-x)))\n * = z * log(1 + exp(-x)) + (1 - z) * (-log(exp(-x)) + log(1 + exp(-x)))\n * = z * log(1 + exp(-x)) + (1 - z) * (x + log(1 + exp(-x))\n * = (1 - z) * x + log(1 + exp(-x))\n * = x - x * z + log(1 + exp(-x))\n *\n * For x < 0, to avoid overflow in exp(-x), we reformulate the above\n * x - x * z + log(1 + exp(-x))\n * = log(exp(x)) - x * z + log(1 + exp(-x))\n * = - x * z + log(1 + exp(x))\n *\n * Hence, to ensure stability and avoid overflow, the implementation uses\n * this equivalent formulation:\n * max(x, 0) - x * z + log(1 + exp(-abs(x)))\n */\n const maxOutput = relu($logits);\n const outputXTarget = mul($logits, $labels);\n const sigmoidOutput = log1p(exp(neg(abs($logits))));\n\n return add(sub(maxOutput, outputXTarget), sigmoidOutput);\n}\n\n/**\n * Computes the sigmoid cross entropy loss between two tensors.\n *\n * If labelSmoothing is nonzero, smooth the labels towards 1/2:\n *\n * newMulticlassLabels = multiclassLabels * (1 - labelSmoothing)\n * + 0.5 * labelSmoothing\n *\n * @param multiClassLabels The ground truth output tensor of shape\n * [batch_size, num_classes], same dimensions as 'predictions'.\n * @param logits The predicted outputs.\n * @param weights Tensor whose rank is either 0, or the same rank as\n * `labels`, and must be broadcastable to `labels` (i.e., all dimensions\n * must be either `1`, or the same as the corresponding `losses`\n * dimension).\n * @param labelSmoothing If greater than 0, then smooth the labels.\n * @param reduction Type of reduction to apply to loss. Should be of type\n * `Reduction`\n *\n * @doc { heading: 'Training', subheading: 'Losses', namespace: 'losses' }\n */\nfunction sigmoidCrossEntropy_(\n multiClassLabels: T|TensorLike, logits: T|TensorLike,\n weights?: Tensor|TensorLike, labelSmoothing = 0,\n reduction = Reduction.SUM_BY_NONZERO_WEIGHTS): O {\n let $multiClassLabels = convertToTensor(\n multiClassLabels, 'multiClassLabels', 'sigmoidCrossEntropy');\n const $logits = convertToTensor(logits, 'logits', 'sigmoidCrossEntropy');\n let $weights: Tensor = null;\n if (weights != null) {\n $weights = convertToTensor(weights, 'weights', 'sigmoidCrossEntropy');\n }\n assertShapesMatch(\n $multiClassLabels.shape, $logits.shape, 'Error in sigmoidCrossEntropy: ');\n\n if (labelSmoothing > 0) {\n const labelSmoothingScalar = scalar(labelSmoothing);\n const one = scalar(1);\n const half = scalar(0.5);\n\n $multiClassLabels =\n add(mul($multiClassLabels, sub(one, labelSmoothingScalar)),\n mul(half, labelSmoothingScalar));\n }\n const losses = sigmoidCrossEntropyWithLogits_($multiClassLabels, $logits);\n\n return computeWeightedLoss(losses, $weights, reduction);\n}\n\nexport const sigmoidCrossEntropy = op({sigmoidCrossEntropy_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {customGrad} from '../../gradients';\nimport {Tensor} from '../../tensor';\nimport {GradSaveFunc} from '../../tensor_types';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport {assertShapesMatch} from '../../util';\nimport {add} from '../add';\nimport {expandShapeToKeepDim} from '../axis_util';\nimport {cast} from '../cast';\nimport {div} from '../div';\nimport {exp} from '../exp';\nimport {logSumExp} from '../log_sum_exp';\nimport {Reduction} from '../loss_ops_utils';\nimport {mul} from '../mul';\nimport {neg} from '../neg';\nimport {op} from '../operation';\nimport {reshape} from '../reshape';\nimport {scalar} from '../scalar';\nimport {sub} from '../sub';\nimport {sum} from '../sum';\n\nimport {computeWeightedLoss} from './compute_weighted_loss';\n\n/**\n * Computes softmax cross entropy between logits and labels.\n *\n * Measures the probability error in discrete classification tasks in which\n * the classes are mutually exclusive (each entry is in exactly one class).\n * For example, each CIFAR-10 image is labeled with one and only one label: an\n * image can be a dog or a truck, but not both.\n *\n * `NOTE`: While the classes are mutually exclusive, their probabilities need\n * not be. All that is required is that each row of labels is a valid\n * probability distribution. If they are not, the computation of the gradient\n * will be incorrect.\n *\n * `WARNING`: This op expects unscaled logits, since it performs a softmax on\n * logits internally for efficiency. Do not call this op with the output of\n * softmax, as it will produce incorrect results.\n *\n * logits and labels must have the same shape, e.g. [batch_size, num_classes]\n * and the same dtype.\n * @param labels The labels array.\n * @param logits The logits array.\n * @param dim The dimension softmax would be performed on. Defaults to `-1`\n * which indicates the last dimension.\n */\nfunction softmaxCrossEntropyWithLogits_(\n labels: T, logits: T, dim = -1): O {\n if (dim === -1) {\n dim = logits.rank - 1;\n }\n\n if (dim !== logits.rank - 1) {\n throw Error(\n `Softmax cross entropy along a non-last dimension is not yet ` +\n `supported. Labels / logits was rank ${logits.rank} ` +\n `and dim was ${dim}`);\n }\n // Use a custom gradient for numerical stability.\n const customOp =\n customGrad((labels: Tensor, logits: Tensor, save: GradSaveFunc) => {\n // Reference:\n // 1. http://cs231n.github.io/linear-classify/#softmax\n // 2. https://blog.feedly.com/tricks-of-the-trade-logsumexp/\n const keepDims = true;\n const lse = logSumExp(logits, [dim], keepDims);\n const logResult = sub(cast(logits, 'float32'), lse);\n save([labels, logResult]);\n\n const costVector = neg(mul(logResult, labels));\n const value: O = sum(costVector, [dim]);\n\n const gradFunc = (dy: O, saved: Tensor[]) => {\n const [labels, logResult] = saved;\n const dyShape = expandShapeToKeepDim(dy.shape, [dim]);\n return [\n mul(reshape(dy, dyShape),\n sub(cast(labels, 'float32'), exp(logResult))),\n mul(reshape(dy, dyShape),\n sub(exp(logResult), cast(labels, 'float32'))),\n ];\n };\n return {value, gradFunc};\n });\n\n return customOp(labels, logits);\n}\n\n/**\n * Computes the softmax cross entropy loss between two tensors.\n *\n * If labelSmoothing is nonzero, smooth the labels towards 1/2:\n *\n * newOnehotLabels = onehotLabels * (1 - labelSmoothing)\n * + labelSmoothing / numClasses\n *\n * @param onehotLabels One hot encoded labels\n * [batch_size, num_classes], same dimensions as 'predictions'.\n * @param logits The predicted outputs.\n * @param weights Tensor whose rank is either 0, or 1, and must be\n * broadcastable to `loss` of shape [batch_size]\n * @param labelSmoothing If greater than 0, then smooth the labels.\n * @param reduction Type of reduction to apply to loss. Should be of type\n * `Reduction`\n *\n * @doc { heading: 'Training', subheading: 'Losses', namespace: 'losses' }\n */\nfunction softmaxCrossEntropy_(\n onehotLabels: T|TensorLike, logits: T|TensorLike,\n weights?: Tensor|TensorLike, labelSmoothing = 0,\n reduction = Reduction.SUM_BY_NONZERO_WEIGHTS): O {\n let $onehotLabels =\n convertToTensor(onehotLabels, 'onehotLabels', 'softmaxCrossEntropy');\n const $logits = convertToTensor(logits, 'logits', 'softmaxCrossEntropy');\n let $weights: Tensor = null;\n\n if (weights != null) {\n $weights = convertToTensor(weights, 'weights', 'softmaxCrossEntropy');\n }\n\n assertShapesMatch(\n $onehotLabels.shape, $logits.shape, 'Error in softmaxCrossEntropy: ');\n\n if (labelSmoothing > 0) {\n const labelSmoothingScalar = scalar(labelSmoothing);\n const one = scalar(1);\n const numClasses = scalar($onehotLabels.shape[1]);\n\n $onehotLabels =\n add(mul($onehotLabels, sub(one, labelSmoothingScalar)),\n div(labelSmoothingScalar, numClasses));\n }\n\n const losses = softmaxCrossEntropyWithLogits_($onehotLabels, $logits);\n\n return computeWeightedLoss(losses, $weights, reduction);\n}\n\nexport const softmaxCrossEntropy = op({softmaxCrossEntropy_});\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {SparseFillEmptyRows, SparseFillEmptyRowsInputs} from '../../kernel_names';\nimport {Scalar, Tensor, Tensor1D, Tensor2D} from '../../tensor';\nimport {NamedTensorMap} from '../../tensor_types';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {ScalarLike, TensorLike} from '../../types';\nimport {op} from '../operation';\n\n/**\n * The input SparseTensor is represented via the map of inputs {`indices`,\n * `values`, `denseShape`}. The output SparseTensor has the same `denseShape`\n * but with indices `outputIndices` and values `outputValues`. This op inserts a\n * single entry for every row that doesn't have any values. The index is created\n * as `[row, 0, ..., 0]` and the inserted value is `defaultValue`.\n *\n * For example, suppose `spInput` has shape [5, 6] and non-empty values:\n * [0, 1]: a\n * [0, 3]: b\n * [2, 0]: c\n * [3, 1]: d\n *\n * Rows 1 and 4 are empty, so the output will be of shape [5, 6] with values:\n * [0, 1]: a\n * [0, 3]: b\n * [1, 0]: `defaultValue`\n * [2, 0]: c\n * [3, 1]: d\n * [4, 0]: `defaultValue`\n *\n * The output SparseTensor will be in row-major order and will have the same\n * shape as the input.\n *\n * This op also returns an indicator vector shaped [dense_shape[0]] such that\n * emptyRowIndicator[i] = True iff row i was an empty row.\n *\n * And a reverse index map vector shaped [indices.shape[0]] that is used during\n * backpropagation, reverseIndexMap[i] = outi s.t. indices[i, j] ==\n * outputIndices[outi, j] for all j\n *\n * ```js\n * const result = tf.sparse.sparseFillEmptyRows(\n * [[0, 0], [1, 0], [1, 3], [1, 4], [3, 2], [3, 3]],\n * [0, 10, 13, 14, 32, 33], [5, 6], -1);\n * console.log(result);\n * result['outputIndices'].print(); // [[0, 0], [1, 0], [1, 3], [1, 4],\n * // [2, 0], [3, 2], [3, 3], [4, 0]]\n * result['outputValues'].print(); // [0, 10, 13, 14,-1, 32, 33, -1]\n * result['emptyRowIndicator'].print(); // [false, false, true, false, true]\n * result['reverseIndexMap'].print(); // [0, 1, 2, 3, 5, 6]\n * ```\n * @param indices: 2-D. The indices of the sparse tensor.\n * @param values: 1-D. The values of the sparse tensor.\n * @param denseShape: 1-D. The shape of the sparse tensor.\n * @param defaultValue: 0-D. Default value to insert into location [row, 0, ...,\n * 0] for rows missing from the input sparse tensor.\n * @return A map with the following properties:\n * - outputIndices\n * - outputValues: 1-D. The values of the filled sparse tensor.\n * - emptyRowIndicator: 1-D. Whether the dense row was missing in the input\n * sparse tensor.\n * - reverseIndexMap: 1-D. A map from the input indices to the output\n * indices.\n * @doc {heading: 'Operations', subheading: 'Sparse'}\n */\nfunction sparseFillEmptyRows_(\n indices: Tensor2D|TensorLike, values: Tensor1D|TensorLike,\n denseShape: Tensor1D|TensorLike,\n defaultValue: Scalar|ScalarLike): NamedTensorMap {\n const $indices =\n convertToTensor(indices, 'indices', 'sparseFillEmptyRows', 'int32');\n const $values = convertToTensor(values, 'values', 'sparseFillEmptyRows');\n const $denseShape =\n convertToTensor(denseShape, 'denseShape', 'sparseFillEmptyRows', 'int32');\n const $defaultValue = convertToTensor(\n defaultValue, 'defaultValue', 'sparseFillEmptyRows', $values.dtype);\n\n if ($indices.rank !== 2) {\n throw new Error(`Indices should be Tensor2D but received shape\n ${$indices.shape}`);\n }\n if ($values.rank !== 1) {\n throw new Error(\n `Values should be Tensor1D but received shape ${$values.shape}`);\n }\n if ($denseShape.rank !== 1) {\n throw new Error(`Dense shape should be Tensor1D but received shape ${\n $denseShape.shape}`);\n }\n if ($defaultValue.rank !== 0) {\n throw new Error(`Default value should be a scalar but received shape ${\n $defaultValue.shape}`);\n }\n\n const inputs: SparseFillEmptyRowsInputs = {\n indices: $indices,\n values: $values,\n denseShape: $denseShape,\n defaultValue: $defaultValue\n };\n\n const result: Tensor[] = ENGINE.runKernel(SparseFillEmptyRows, inputs as {});\n return {\n outputIndices: result[0],\n outputValues: result[1],\n emptyRowIndicator: result[2],\n reverseIndexMap: result[3]\n };\n}\n\nexport const sparseFillEmptyRows = op({sparseFillEmptyRows_});\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {SparseReshape, SparseReshapeInputs} from '../../kernel_names';\nimport {Tensor, Tensor1D, Tensor2D} from '../../tensor';\nimport {NamedTensorMap} from '../../tensor_types';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport {op} from '../operation';\n\n/**\n * This operation has the same semantics as reshape on the represented dense\n * tensor. The `inputIndices` are recomputed based on the requested `newShape`.\n * If one component of `newShape` is the special value -1, the size of that\n * dimension is computed so that the total dense size remains constant. At most\n * one component of `newShape` can be -1. The number of dense elements implied\n * by `newShape` must be the same as the number of dense elements originally\n * implied by `inputShape`. Reshaping does not affect the order of values in the\n * SparseTensor. If the input tensor has rank R_in and N non-empty values, and\n * `newShape` has length R_out, then `inputIndices` has shape [N, R_in],\n * `inputShape` has length R_in, `outputIndices` has shape [N, R_out], and\n * `outputShape` has length R_out.\n *\n * ```js\n * const result = tf.sparse.sparseReshape(\n * [[0, 0, 0], [0, 0, 1], [0, 1, 0], [1, 0, 0], [1, 2, 3]],\n * [2, 3, 6], [9, -1]);\n * console.log(result);\n * result['outputIndices'].print(); //[[0, 0], [0, 1], [1, 2], [4, 2], [8, 1]]\n * result['outputShape'].print(); // [9, 4]\n * ```\n * @param inputIndices: 2-D. N x R_in matrix with the indices of non-empty\n * values in a SparseTensor.\n * @param inputShape: 1-D. R_in Tensor1D with the input SparseTensor's dense\n * shape.\n * @param newShape: 1-D. R_out Tensor1D with the requested new dense shape.\n * @return A map with the following properties:\n * - outputIndices: 2-D. N x R_out matrix with the updated indices of\n * non-empty values in the output SparseTensor.\n * - outputShape: 1-D. R_out vector with the full dense shape of the output\n * SparseTensor. This is the same as newShape but with any -1 dimensions\n * filled in.\n * @doc {heading: 'Operations', subheading: 'Sparse'}\n */\nfunction sparseReshape_(\n inputIndices: Tensor2D|TensorLike, inputShape: Tensor1D|TensorLike,\n newShape: Tensor1D|TensorLike): NamedTensorMap {\n const $inputIndices =\n convertToTensor(inputIndices, 'inputIndices', 'sparseReshape', 'int32');\n const $inputShape =\n convertToTensor(inputShape, 'inputShape', 'sparseReshape', 'int32');\n const $newShape =\n convertToTensor(newShape, 'newShape', 'sparseReshape', 'int32');\n\n if ($inputIndices.rank !== 2) {\n throw new Error(`Input indices should be Tensor2D but received shape\n ${$inputIndices.shape}`);\n }\n if ($inputShape.rank !== 1) {\n throw new Error(`Input shape should be Tensor1D but received shape ${\n $inputShape.shape}`);\n }\n if ($newShape.rank !== 1) {\n throw new Error(\n `New shape should be Tensor1D but received shape ${$newShape.shape}`);\n }\n\n const inputs: SparseReshapeInputs = {\n inputIndices: $inputIndices,\n inputShape: $inputShape,\n newShape: $newShape\n };\n const result: Tensor[] = ENGINE.runKernel(SparseReshape, inputs as {});\n return {outputIndices: result[0], outputShape: result[1]};\n}\n\nexport const sparseReshape = op({sparseReshape_});\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {SparseSegmentMean, SparseSegmentMeanInputs} from '../../kernel_names';\nimport {Tensor, Tensor1D} from '../../tensor';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport {op} from '../operation';\n\n/**\n * Computes the mean along sparse segments of a tensor.\n *\n * ```js\n * const c = tf.tensor2d([[1,2,3,4], [-1,-2,-3,-4], [6,7,8,9]]);\n * // Select two rows, one segment.\n * const result1 = tf.sparse.sparseSegmentMean(c,\n * tf.tensor1d([0, 1], 'int32'),\n * tf.tensor1d([0, 0], 'int32'));\n * result1.print(); // [[0, 0, 0, 0]]\n *\n * // Select two rows, two segments.\n * const result2 = tf.sparse.sparseSegmentMean(c,\n * tf.tensor1d([0, 1], 'int32'),\n * tf.tensor1d([0, 1], 'int32'));\n * result2.print(); // [[1, 2, 3, 4], [-1, -2, -3, -4]]\n *\n * // Select all rows, two segments.\n * const result3 = tf.sparse.sparseSegmentMean(c,\n * tf.tensor1d([0, 1, 2], 'int32'),\n * tf.tensor1d([0, 1, 1], 'int32'));\n * result3.print(); // [[1.0, 2.0, 3.0, 4.0], [2.5, 2.5, 2.5, 2.5]]\n * ```\n * @param data: A Tensor of at least one dimension with data that will be\n * assembled in the output.\n * @param indices: A 1-D Tensor with indices into data. Has same rank as\n * segmentIds.\n * @param segmentIds: A 1-D Tensor with indices into the output Tensor. Values\n * should be sorted and can be repeated.\n * @return Has same shape as data, except for dimension 0 which has equal to\n * the number of segments.\n *\n * @doc {heading: 'Operations', subheading: 'Sparse'}\n */\nfunction sparseSegmentMean_(\n data: Tensor|TensorLike, indices: Tensor1D|TensorLike,\n segmentIds: Tensor1D|TensorLike): Tensor {\n const $data = convertToTensor(data, 'data', 'sparseSegmentMean');\n const $indices =\n convertToTensor(indices, 'indices', 'sparseSegmentMean', 'int32');\n const $segmentIds =\n convertToTensor(segmentIds, 'segmentIds', 'sparseSegmentMean', 'int32');\n\n if ($data.rank < 1) {\n throw new Error(\n `Data should be at least 1 dimensional but received scalar`);\n }\n if ($indices.rank !== 1) {\n throw new Error(`Indices should be Tensor1D but received shape\n ${$indices.shape}`);\n }\n if ($segmentIds.rank !== 1) {\n throw new Error(`Segment ids should be Tensor1D but received shape\n ${$segmentIds.shape}`);\n }\n\n const inputs: SparseSegmentMeanInputs = {\n data: $data,\n indices: $indices,\n segmentIds: $segmentIds\n };\n\n return ENGINE.runKernel(SparseSegmentMean, inputs as {});\n}\n\nexport const sparseSegmentMean = op({sparseSegmentMean_});\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {SparseSegmentSum, SparseSegmentSumInputs} from '../../kernel_names';\nimport {Tensor, Tensor1D} from '../../tensor';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport {op} from '../operation';\n\n/**\n * Computes the sum along sparse segments of a tensor.\n *\n * ```js\n * const c = tf.tensor2d([[1,2,3,4], [-1,-2,-3,-4], [5,6,7,8]]);\n * // Select two rows, one segment.\n * const result1 = tf.sparse.sparseSegmentSum(c,\n * tf.tensor1d([0, 1], 'int32'),\n * tf.tensor1d([0, 0], 'int32'));\n * result1.print(); // [[0, 0, 0, 0]]\n *\n * // Select two rows, two segments.\n * const result2 = tf.sparse.sparseSegmentSum(c,\n * tf.tensor1d([0, 1], 'int32'),\n * tf.tensor1d([0, 1], 'int32'));\n * result2.print(); // [[1, 2, 3, 4], [-1, -2, -3, -4]]\n *\n * // Select all rows, two segments.\n * const result3 = tf.sparse.sparseSegmentSum(c,\n * tf.tensor1d([0, 1, 2], 'int32'),\n * tf.tensor1d([0, 0, 1], 'int32'));\n * result3.print(); // [[0, 0, 0, 0], [5, 6, 7, 8]]\n * ```\n * @param data: A Tensor of at least one dimension with data that will be\n * assembled in the output.\n * @param indices: A 1-D Tensor with indices into data. Has same rank as\n * segmentIds.\n * @param segmentIds: A 1-D Tensor with indices into the output Tensor. Values\n * should be sorted and can be repeated.\n * @return Has same shape as data, except for dimension 0 which has equal to\n * the number of segments.\n *\n * @doc {heading: 'Operations', subheading: 'Sparse'}\n */\nfunction sparseSegmentSum_(\n data: Tensor|TensorLike, indices: Tensor1D|TensorLike,\n segmentIds: Tensor1D|TensorLike): Tensor {\n const $data = convertToTensor(data, 'data', 'sparseSegmentSum');\n const $indices =\n convertToTensor(indices, 'indices', 'sparseSegmentSum', 'int32');\n const $segmentIds =\n convertToTensor(segmentIds, 'segmentIds', 'sparseSegmentSum', 'int32');\n\n if ($data.rank < 1) {\n throw new Error(\n `Data should be at least 1 dimensional but received scalar`);\n }\n if ($indices.rank !== 1) {\n throw new Error(`Indices should be Tensor1D but received shape\n ${$indices.shape}`);\n }\n if ($segmentIds.rank !== 1) {\n throw new Error(`Segment ids should be Tensor1D but received shape\n ${$segmentIds.shape}`);\n }\n\n const inputs: SparseSegmentSumInputs = {\n data: $data,\n indices: $indices,\n segmentIds: $segmentIds\n };\n\n return ENGINE.runKernel(SparseSegmentSum, inputs as {});\n}\n\nexport const sparseSegmentSum = op({sparseSegmentSum_});\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {StringNGrams, StringNGramsAttrs, StringNGramsInputs} from '../../kernel_names';\nimport {Tensor, Tensor1D} from '../../tensor';\nimport {NamedTensorMap} from '../../tensor_types';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport {op} from '../operation';\n\n/**\n * Creates ngrams from ragged string data.\n *\n * This op accepts a ragged tensor with 1 ragged dimension containing only\n * strings and outputs a ragged tensor with 1 ragged dimension containing ngrams\n * of that string, joined along the innermost axis.\n *\n * ```js\n * const result = tf.string.stringNGrams(\n * ['a', 'b', 'c', 'd'], tf.tensor1d([0, 2, 4], 'int32'),\n * '|', [1, 2], 'LP', 'RP', -1, false);\n * result['nGrams'].print(); // ['a', 'b', 'LP|a', 'a|b', 'b|RP',\n * // 'c', 'd', 'LP|c', 'c|d', 'd|RP']\n * result['nGramsSplits'].print(); // [0, 5, 10]\n * ```\n * @param data: The values tensor of the ragged string tensor to make ngrams out\n * of. Must be a 1D string tensor.\n * @param dataSplits: The splits tensor of the ragged string tensor to make\n * ngrams out of.\n * @param separator: The string to append between elements of the token. Use \"\"\n * for no separator.\n * @param nGramWidths: The sizes of the ngrams to create.\n * @param leftPad: The string to use to pad the left side of the ngram sequence.\n * Only used if pad_width !== 0.\n * @param rightPad: The string to use to pad the right side of the ngram\n * sequence. Only used if pad_width !== 0.\n * @param padWidth: The number of padding elements to add to each side of each\n * sequence. Note that padding will never be greater than `nGramWidths`-1\n * regardless of this value. If `padWidth`=-1, then add max(`nGramWidths`)-1\n * elements.\n * @param preserveShortSequences: If true, then ensure that at least one ngram\n * is generated for each input sequence. In particular, if an input sequence\n * is shorter than min(ngramWidth) + 2*padWidth, then generate a single\n * ngram containing the entire sequence. If false, then no ngrams are\n * generated for these short input sequences.\n * @return A map with the following properties:\n * - nGrams: The values tensor of the output ngrams ragged tensor.\n * - nGramsSplits: The splits tensor of the output ngrams ragged tensor.\n *\n * @doc {heading: 'Operations', subheading: 'String'}\n */\nfunction stringNGrams_(\n data: Tensor1D|TensorLike, dataSplits: Tensor|TensorLike, separator: string,\n nGramWidths: number[], leftPad: string, rightPad: string, padWidth: number,\n preserveShortSequences: boolean): NamedTensorMap {\n const $data = convertToTensor(data, 'data', 'stringNGrams', 'string');\n if ($data.dtype !== 'string') {\n throw new Error('Data must be of datatype string');\n }\n if ($data.shape.length !== 1) {\n throw new Error(`Data must be a vector, saw: ${$data.shape}`);\n }\n\n const $dataSplits = convertToTensor(dataSplits, 'dataSplits', 'stringNGrams');\n if ($dataSplits.dtype !== 'int32') {\n throw new Error('Data splits must be of datatype int32');\n }\n\n const attrs: StringNGramsAttrs = {\n separator,\n nGramWidths,\n leftPad,\n rightPad,\n padWidth,\n preserveShortSequences\n };\n\n const inputs: StringNGramsInputs = {data: $data, dataSplits: $dataSplits};\n const result: Tensor[] =\n ENGINE.runKernel(StringNGrams, inputs as {}, attrs as {});\n return {nGrams: result[0], nGramsSplits: result[1]};\n}\n\nexport const stringNGrams = op({stringNGrams_});\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {StringSplit, StringSplitAttrs, StringSplitInputs} from '../../kernel_names';\nimport {Scalar, Tensor, Tensor1D} from '../../tensor';\nimport {NamedTensorMap} from '../../tensor_types';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {ScalarLike, TensorLike} from '../../types';\nimport {op} from '../operation';\n\n/**\n * Split elements of `input` based on `delimiter` into a SparseTensor .\n *\n * Let N be the size of source (typically N will be the batch size). Split each\n * element of `input` based on `delimiter` and return a SparseTensor containing\n * the splitted tokens. Empty tokens are ignored if `skipEmpty` is set to True.\n *\n * `delimiter` can be empty, or a string of split characters. If `delimiter` is\n * an empty string, each element of `input` is split into individual\n * character strings. Otherwise every character of `delimiter` is a potential\n * split point.\n *\n * ```js\n * const result = tf.string.stringSplit(['hello world', 'a b c'], ' ');\n * result['indices'].print(); // [[0, 0], [0, 1], [1, 0], [1, 1], [1, 2]]\n * result['values'].print(); // ['hello', 'world', 'a', 'b', 'c']\n * result['shape'].print(); // [2, 3]\n * ```\n * @param input: 1-D. Strings to split.\n * @param delimiter: 0-D. Delimiter characters, or empty string.\n * @param skipEmpty: Optional. If true, skip the empty strings from the result.\n * Defaults to true.\n * @return A map with the following properties:\n * - indices: A dense matrix of int32 representing the indices of the sparse\n * tensor.\n * - values: A vector of strings corresponding to the splited values.\n * - shape: a length-2 vector of int32 representing the shape of the sparse\n * tensor, where the first value is N and the second value is the maximum number\n * of tokens in a single input entry.\n *\n * @doc {heading: 'Operations', subheading: 'String'}\n */\nfunction stringSplit_(\n input: Tensor1D|TensorLike, delimiter: Scalar|ScalarLike,\n skipEmpty = true): NamedTensorMap {\n const $input = convertToTensor(input, 'input', 'stringSplit', 'string');\n const $delimiter =\n convertToTensor(delimiter, 'delimiter', 'stringSplit', 'string');\n\n if ($input.rank !== 1) {\n throw new Error(\n `Input should be Tensor1D but received shape ${$input.shape}`);\n }\n if ($delimiter.rank !== 0) {\n throw new Error(\n `Delimiter should be a scalar but received shape ${$delimiter.shape}`);\n }\n\n const attrs: StringSplitAttrs = {skipEmpty};\n const inputs: StringSplitInputs = {input: $input, delimiter: $delimiter};\n const result: Tensor[] =\n ENGINE.runKernel(StringSplit, inputs as {}, attrs as {});\n return {indices: result[0], values: result[1], shape: result[2]};\n}\n\nexport const stringSplit = op({stringSplit_});\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {StringToHashBucketFast, StringToHashBucketFastAttrs, StringToHashBucketFastInputs} from '../../kernel_names';\nimport {Tensor} from '../../tensor';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport {op} from '../operation';\n\n/**\n * Converts each string in the input Tensor to its hash mod by a number of\n * buckets.\n *\n * The hash function is deterministic on the content of the string within the\n * process and will never change. However, it is not suitable for cryptography.\n * This function may be used when CPU time is scarce and inputs are trusted or\n * unimportant. There is a risk of adversaries constructing inputs that all hash\n * to the same bucket.\n *\n * ```js\n * const result = tf.string.stringToHashBucketFast(\n * ['Hello', 'TensorFlow', '2.x'], 3);\n * result.print(); // [0, 2, 2]\n * ```\n * @param input: The strings to assign a hash bucket.\n * @param numBuckets: The number of buckets.\n * @return A Tensor of the same shape as the input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'String'}\n */\nfunction stringToHashBucketFast_(\n input: Tensor|TensorLike, numBuckets: number): Tensor {\n const $input =\n convertToTensor(input, 'input', 'stringToHashBucketFast', 'string');\n const attrs: StringToHashBucketFastAttrs = {numBuckets};\n\n if (numBuckets <= 0) {\n throw new Error(`Number of buckets must be at least 1`);\n }\n\n const inputs: StringToHashBucketFastInputs = {input: $input};\n return ENGINE.runKernel(StringToHashBucketFast, inputs as {}, attrs as {});\n}\n\nexport const stringToHashBucketFast = op({stringToHashBucketFast_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// Modularized ops.\nexport {abs} from './abs';\nexport {acos} from './acos';\nexport {acosh} from './acosh';\nexport {add} from './add';\nexport {addN} from './add_n';\nexport {all} from './all';\nexport {any} from './any';\nexport {argMax} from './arg_max';\nexport {argMin} from './arg_min';\nexport {asin} from './asin';\nexport {asinh} from './asinh';\nexport {atan} from './atan';\nexport {atan2} from './atan2';\nexport {atanh} from './atanh';\nexport {avgPool} from './avg_pool';\nexport {avgPool3d} from './avg_pool_3d';\nexport {basicLSTMCell} from './basic_lstm_cell';\nexport {batchToSpaceND} from './batch_to_space_nd';\nexport {batchNorm} from './batchnorm';\nexport {batchNorm2d} from './batchnorm2d';\nexport {batchNorm3d} from './batchnorm3d';\nexport {batchNorm4d} from './batchnorm4d';\nexport {bincount} from './bincount';\nexport {broadcastArgs} from './broadcast_args';\nexport {broadcastTo} from './broadcast_to';\nexport {buffer} from './buffer';\nexport {cast} from './cast';\nexport {ceil} from './ceil';\nexport {clipByValue} from './clip_by_value';\nexport {clone} from './clone';\nexport {complex} from './complex';\nexport {concat} from './concat';\nexport {concat1d} from './concat_1d';\nexport {concat2d} from './concat_2d';\nexport {concat3d} from './concat_3d';\nexport {concat4d} from './concat_4d';\nexport {conv1d} from './conv1d';\nexport {conv2d} from './conv2d';\nexport {conv2dTranspose} from './conv2d_transpose';\nexport {conv3d} from './conv3d';\nexport {conv3dTranspose} from './conv3d_transpose';\nexport {cos} from './cos';\nexport {cosh} from './cosh';\nexport {cumprod} from './cumprod';\nexport {cumsum} from './cumsum';\nexport {denseBincount} from './dense_bincount';\nexport {depthToSpace} from './depth_to_space';\nexport {depthwiseConv2d} from './depthwise_conv2d';\nexport {diag} from './diag';\nexport {dilation2d} from './dilation2d';\nexport {div} from './div';\nexport {divNoNan} from './div_no_nan';\nexport {dot} from './dot';\nexport {einsum} from './einsum';\nexport {elu} from './elu';\nexport {equal} from './equal';\nexport {erf} from './erf';\nexport {euclideanNorm} from './euclidean_norm';\nexport {exp} from './exp';\nexport {expandDims} from './expand_dims';\nexport {expm1} from './expm1';\nexport {eye} from './eye';\nexport {fill} from './fill';\nexport {floor} from './floor';\nexport {floorDiv} from './floorDiv';\nexport {gather} from './gather';\nexport {greater} from './greater';\nexport {greaterEqual} from './greater_equal';\nexport {imag} from './imag';\nexport {isFinite} from './is_finite';\nexport {isInf} from './is_inf';\nexport {isNaN} from './is_nan';\nexport {leakyRelu} from './leaky_relu';\nexport {less} from './less';\nexport {lessEqual} from './less_equal';\nexport {linspace} from './linspace';\nexport {localResponseNormalization} from './local_response_normalization';\nexport {log} from './log';\nexport {log1p} from './log1p';\nexport {logSigmoid} from './log_sigmoid';\nexport {logSoftmax} from './log_softmax';\nexport {logSumExp} from './log_sum_exp';\nexport {logicalAnd} from './logical_and';\nexport {logicalNot} from './logical_not';\nexport {logicalOr} from './logical_or';\nexport {logicalXor} from './logical_xor';\nexport {lowerBound} from './lower_bound';\nexport {matMul} from './mat_mul';\nexport {max} from './max';\nexport {maxPool} from './max_pool';\nexport {maxPool3d} from './max_pool_3d';\nexport {maxPoolWithArgmax} from './max_pool_with_argmax';\nexport {maximum} from './maximum';\nexport {mean} from './mean';\nexport {meshgrid} from './meshgrid';\nexport {min} from './min';\nexport {minimum} from './minimum';\nexport {mirrorPad} from './mirror_pad';\nexport {mod} from './mod';\nexport {moments} from './moments';\nexport {mul} from './mul';\nexport {LSTMCellFunc, multiRNNCell} from './multi_rnn_cell';\nexport {multinomial} from './multinomial';\nexport {neg} from './neg';\nexport {notEqual} from './not_equal';\nexport {oneHot} from './one_hot';\nexport {ones} from './ones';\nexport {onesLike} from './ones_like';\nexport {outerProduct} from './outer_product';\nexport {pad} from './pad';\nexport {pad1d} from './pad1d';\nexport {pad2d} from './pad2d';\nexport {pad3d} from './pad3d';\nexport {pad4d} from './pad4d';\nexport {pool} from './pool';\nexport {pow} from './pow';\nexport {prelu} from './prelu';\nexport {print} from './print';\nexport {prod} from './prod';\nexport {raggedGather} from './ragged_gather';\nexport {raggedRange} from './ragged_range';\nexport {raggedTensorToTensor} from './ragged_tensor_to_tensor';\nexport {rand} from './rand';\nexport {randomGamma} from './random_gamma';\nexport {randomNormal} from './random_normal';\nexport {randomStandardNormal} from './random_standard_normal';\nexport {randomUniform} from './random_uniform';\nexport {range} from './range';\nexport {real} from './real';\nexport {reciprocal} from './reciprocal';\nexport {relu} from './relu';\nexport {relu6} from './relu6';\nexport {reshape} from './reshape';\nexport {reverse} from './reverse';\nexport {reverse1d} from './reverse_1d';\nexport {reverse2d} from './reverse_2d';\nexport {reverse3d} from './reverse_3d';\nexport {reverse4d} from './reverse_4d';\nexport {round} from './round';\nexport {rsqrt} from './rsqrt';\nexport {scalar} from './scalar';\nexport {selu} from './selu';\nexport {separableConv2d} from './separable_conv2d';\nexport {setdiff1dAsync} from './setdiff1d_async';\nexport {sigmoid} from './sigmoid';\nexport {sign} from './sign';\nexport {sin} from './sin';\nexport {sinh} from './sinh';\nexport {slice} from './slice';\nexport {slice1d} from './slice1d';\nexport {slice2d} from './slice2d';\nexport {slice3d} from './slice3d';\nexport {slice4d} from './slice4d';\nexport {softmax} from './softmax';\nexport {softplus} from './softplus';\nexport {spaceToBatchND} from './space_to_batch_nd';\nexport {fft} from './spectral/fft';\nexport {ifft} from './spectral/ifft';\nexport {irfft} from './spectral/irfft';\nexport {rfft} from './spectral/rfft';\nexport {split} from './split';\nexport {sqrt} from './sqrt';\nexport {square} from './square';\nexport {squaredDifference} from './squared_difference';\nexport {squeeze} from './squeeze';\nexport {stack} from './stack';\nexport {step} from './step';\nexport {stridedSlice} from './strided_slice';\nexport {sub} from './sub';\nexport {sum} from './sum';\nexport {tan} from './tan';\nexport {tanh} from './tanh';\nexport {tensor} from './tensor';\nexport {tensor1d} from './tensor1d';\nexport {tensor2d} from './tensor2d';\nexport {tensor3d} from './tensor3d';\nexport {tensor4d} from './tensor4d';\nexport {tensor5d} from './tensor5d';\nexport {tensor6d} from './tensor6d';\nexport {tile} from './tile';\nexport {topk} from './topk';\nexport {truncatedNormal} from './truncated_normal';\nexport {unique} from './unique';\nexport {unsortedSegmentSum} from './unsorted_segment_sum';\nexport {unstack} from './unstack';\nexport {upperBound} from './upper_bound';\nexport {variable} from './variable';\nexport {where} from './where';\nexport {whereAsync} from './where_async';\nexport {zeros} from './zeros';\nexport {zerosLike} from './zeros_like';\n\nexport * from './boolean_mask';\nexport * from './transpose';\nexport * from './norm';\nexport * from './moving_average';\nexport * from './scatter_nd';\nexport * from './search_sorted';\nexport * from './sparse_to_dense';\nexport * from './gather_nd';\nexport * from './dropout';\nexport * from './signal_ops_util';\nexport * from './in_top_k';\n\nexport {op, OP_SCOPE_SUFFIX} from './operation';\n\nimport {rfft} from './spectral/rfft';\nimport {fft} from './spectral/fft';\nimport {ifft} from './spectral/ifft';\nimport {irfft} from './spectral/irfft';\nconst spectral = {\n fft,\n ifft,\n rfft,\n irfft\n};\n\nimport * as fused from './fused_ops';\n\nimport {hammingWindow} from './signal/hamming_window';\nimport {hannWindow} from './signal/hann_window';\nimport {frame} from './signal/frame';\nimport {stft} from './signal/stft';\nconst signal = {\n hammingWindow,\n hannWindow,\n frame,\n stft,\n};\n\n// Image Ops namespace\nimport {cropAndResize} from './image/crop_and_resize';\nimport {flipLeftRight} from './image/flip_left_right';\nimport {grayscaleToRGB} from './image/grayscale_to_rgb';\nimport {rotateWithOffset} from './image/rotate_with_offset';\nimport {nonMaxSuppression} from './image/non_max_suppression';\nimport {nonMaxSuppressionAsync} from './image/non_max_suppression_async';\nimport {nonMaxSuppressionWithScore} from './image/non_max_suppression_with_score';\nimport {nonMaxSuppressionWithScoreAsync} from './image/non_max_suppression_with_score_async';\nimport {nonMaxSuppressionPadded} from './image/non_max_suppression_padded';\nimport {nonMaxSuppressionPaddedAsync} from './image/non_max_suppression_padded_async';\nimport {resizeBilinear} from './image/resize_bilinear';\nimport {resizeNearestNeighbor} from './image/resize_nearest_neighbor';\nimport {threshold} from './image/threshold';\nimport {transform} from './image/transform';\nconst image = {\n flipLeftRight,\n grayscaleToRGB,\n resizeNearestNeighbor,\n resizeBilinear,\n rotateWithOffset,\n cropAndResize,\n nonMaxSuppression,\n nonMaxSuppressionAsync,\n nonMaxSuppressionWithScore,\n nonMaxSuppressionWithScoreAsync,\n nonMaxSuppressionPadded,\n nonMaxSuppressionPaddedAsync,\n threshold,\n transform\n};\n\n// linalg namespace\nimport {bandPart} from './linalg/band_part';\nimport {gramSchmidt} from './linalg/gram_schmidt';\nimport {qr} from './linalg/qr';\nconst linalg = {\n bandPart,\n gramSchmidt,\n qr\n};\n\n// losses namespace;\nimport {absoluteDifference} from './losses/absolute_difference';\nimport {computeWeightedLoss} from './losses/compute_weighted_loss';\nimport {cosineDistance} from './losses/cosine_distance';\nimport {hingeLoss} from './losses/hinge_loss';\nimport {huberLoss} from './losses/huber_loss';\nimport {logLoss} from './losses/log_loss';\nimport {meanSquaredError} from './losses/mean_squared_error';\nimport {sigmoidCrossEntropy} from './losses/sigmoid_cross_entropy';\nimport {softmaxCrossEntropy} from './losses/softmax_cross_entropy';\nconst losses = {\n absoluteDifference,\n computeWeightedLoss,\n cosineDistance,\n hingeLoss,\n huberLoss,\n logLoss,\n meanSquaredError,\n sigmoidCrossEntropy,\n softmaxCrossEntropy\n};\n\nimport {sparseFillEmptyRows} from './sparse/sparse_fill_empty_rows';\nimport {sparseReshape} from './sparse/sparse_reshape';\nimport {sparseSegmentMean} from './sparse/sparse_segment_mean';\nimport {sparseSegmentSum} from './sparse/sparse_segment_sum';\nconst sparse = {\n sparseFillEmptyRows,\n sparseReshape,\n sparseSegmentMean,\n sparseSegmentSum\n};\n\nimport {stringNGrams} from './string/string_n_grams';\nimport {stringSplit} from './string/string_split';\nimport {stringToHashBucketFast} from './string/string_to_hash_bucket_fast';\n// tslint:disable-next-line:variable-name\nconst string = {\n stringNGrams,\n stringSplit,\n stringToHashBucketFast\n};\n\n// Second level exports.\nexport {image, linalg, losses, spectral, fused, signal, sparse, string};\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {dispose} from '../globals';\nimport {variableGrads} from '../gradients';\nimport {scalar} from '../ops/ops';\nimport {Serializable} from '../serialization';\nimport {Scalar, Variable} from '../tensor';\nimport {NamedTensor, NamedTensorMap} from '../tensor_types';\n\n/**\n * A variable that belongs to an optimizer.\n *\n * The `originalName` field is required for keeping track of the canonical\n * name of the variable, which is usually the name of the model weight that\n * the variable is related to plus a suffix, e.g., 'dense1/kernel/momentum'.\n * The name of the `Variable` object itself cannot be used directly due to\n * possible deduplication: Every `Variable` must have a unique name but more\n * than one optimizer objects of the same type may be created for the same model\n * or the same `Variable`.\n */\nexport interface OptimizerVariable {\n originalName: string;\n variable: Variable;\n}\n\n/** @doc {heading: 'Training', subheading: 'Classes', namespace: 'train'} */\nexport abstract class Optimizer extends Serializable {\n protected iterations_: number;\n\n /**\n * Executes `f()` and minimizes the scalar output of `f()` by computing\n * gradients of y with respect to the list of trainable variables provided by\n * `varList`. If no list is provided, it defaults to all trainable variables.\n *\n * @param f The function to execute and whose output to minimize.\n * @param returnCost Whether to return the scalar cost value produced by\n * executing `f()`.\n * @param varList An optional list of variables to update. If specified, only\n * the trainable variables in varList will be updated by minimize. Defaults to\n * all trainable variables.\n *\n * @doc {heading: 'Training', subheading: 'Optimizers'}\n */\n minimize(f: () => Scalar, returnCost = false, varList?: Variable[]): Scalar\n |null {\n const {value, grads} = this.computeGradients(f, varList);\n\n if (varList != null) {\n const gradArray: NamedTensor[] =\n varList.map(v => ({name: v.name, tensor: grads[v.name]}));\n this.applyGradients(gradArray);\n } else {\n this.applyGradients(grads);\n }\n\n // Dispose gradients.\n dispose(grads);\n\n if (returnCost) {\n return value;\n } else {\n value.dispose();\n return null;\n }\n }\n\n /**\n * The number of iterations that this optimizer instance has been invoked for.\n */\n get iterations(): number {\n if (this.iterations_ == null) {\n this.iterations_ = 0;\n }\n return this.iterations_;\n }\n\n protected incrementIterations() {\n this.iterations_ = this.iterations + 1;\n }\n\n /**\n * Executes f() and computes the gradient of the scalar output of f() with\n * respect to the list of trainable variables provided by `varList`. If no\n * list is provided, it defaults to all trainable variables.\n *\n * @param f The function to execute and whose output to use for computing\n * gradients with respect to variables.\n * @param varList An optional list of variables to compute gradients with\n * respect to. If specified, only the trainable variables in varList will have\n * gradients computed with respect to. Defaults to all trainable variables.\n *\n * @doc {heading: 'Training', subheading: 'Optimizers'}\n */\n computeGradients(f: () => Scalar, varList?: Variable[]):\n {value: Scalar, grads: NamedTensorMap} {\n return variableGrads(f, varList);\n }\n\n /**\n * Updates variables by using the computed gradients.\n *\n * @param variableGradients A mapping of variable name to its gradient value.\n *\n * @doc {heading: 'Training', subheading: 'Optimizers'}\n */\n abstract applyGradients(variableGradients: NamedTensorMap|\n NamedTensor[]): void;\n\n /**\n * Dispose the variables (if any) owned by this optimizer instance.\n */\n dispose(): void {\n if (this.iterations_ != null) {\n dispose(this.iterations_);\n }\n }\n\n async saveIterations(): Promise {\n if (this.iterations_ == null) {\n this.iterations_ = 0;\n }\n return {\n name: 'iter', // Named for Python compatibility.\n // TODO(cais): Use 'int64' type when available.\n tensor: scalar(this.iterations_, 'int32')\n };\n }\n\n async getWeights(): Promise {\n throw new Error('getWeights() is not implemented for this optimizer yet.');\n }\n\n async setWeights(weightValues: NamedTensor[]): Promise {\n throw new Error(\n `setWeights() is not implemented for this optimizer class ` +\n `${this.getClassName()}`);\n }\n\n /**\n * Extract the first element of the weight values and set it\n * as the iterations counter variable of this instance of optimizer.\n *\n * @param weightValues\n * @returns Weight values with the first element consumed and excluded.\n */\n protected async extractIterations(weightValues: NamedTensor[]):\n Promise {\n this.iterations_ = (await weightValues[0].tensor.data())[0];\n return weightValues.slice(1);\n }\n}\n\nObject.defineProperty(Optimizer, Symbol.hasInstance, {\n value: (instance: Optimizer) => {\n return instance.minimize != null && instance.computeGradients != null &&\n instance.applyGradients != null;\n }\n});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {dispose, tidy} from '../globals';\nimport {add} from '../ops/add';\nimport {div} from '../ops/div';\nimport {mul} from '../ops/mul';\nimport {sqrt} from '../ops/ops';\nimport {square} from '../ops/square';\nimport {zerosLike} from '../ops/zeros_like';\nimport {ConfigDict, registerClass, Serializable, SerializableConstructor} from '../serialization';\nimport {NamedTensor, NamedVariableMap} from '../tensor_types';\n\nimport {Optimizer, OptimizerVariable} from './optimizer';\n\n/** @doclink Optimizer */\nexport class AdadeltaOptimizer extends Optimizer {\n /** @nocollapse */\n static className = 'Adadelta'; // Name matters for Python compatibility.\n private accumulatedGrads: OptimizerVariable[] = [];\n private accumulatedUpdates: OptimizerVariable[] = [];\n\n constructor(\n protected learningRate: number, protected rho: number,\n protected epsilon: number = null) {\n super();\n\n if (epsilon == null) {\n this.epsilon = ENGINE.backend.epsilon();\n }\n }\n\n applyGradients(variableGradients: NamedVariableMap|NamedTensor[]) {\n const variableNames = Array.isArray(variableGradients) ?\n variableGradients.map(item => item.name) :\n Object.keys(variableGradients);\n\n variableNames.forEach((name, i) => {\n const value = ENGINE.registeredVariables[name];\n const trainable = false;\n if (this.accumulatedGrads[i] == null) {\n this.accumulatedGrads[i] = {\n originalName: `${name}/accum_grad`,\n variable: tidy(() => zerosLike(value).variable(trainable))\n };\n }\n if (this.accumulatedUpdates[i] == null) {\n this.accumulatedUpdates[i] = {\n originalName: `${name}/accum_var`,\n variable: tidy(() => zerosLike(value).variable(trainable))\n };\n }\n\n const gradient = Array.isArray(variableGradients) ?\n variableGradients[i].tensor :\n variableGradients[name];\n if (gradient == null) {\n return;\n }\n\n const accumulatedGrad = this.accumulatedGrads[i].variable;\n const accumulatedUpdate = this.accumulatedUpdates[i].variable;\n\n tidy(() => {\n const newAccumulatedGrad =\n add(mul(accumulatedGrad, this.rho),\n mul(square(gradient), 1 - this.rho));\n\n const updates =\n mul(div(sqrt(add(accumulatedUpdate, this.epsilon)),\n sqrt(add(accumulatedGrad, this.epsilon))),\n gradient);\n\n const newAccumulatedUpdate =\n add(mul(accumulatedUpdate, this.rho),\n mul(square(updates), 1 - this.rho));\n\n accumulatedGrad.assign(newAccumulatedGrad);\n accumulatedUpdate.assign(newAccumulatedUpdate);\n\n const newValue = add(mul(updates, -this.learningRate), value);\n value.assign(newValue);\n });\n });\n this.incrementIterations();\n }\n\n dispose(): void {\n if (this.accumulatedUpdates != null) {\n dispose(this.accumulatedGrads.map(v => v.variable));\n dispose(this.accumulatedUpdates.map(v => v.variable));\n }\n }\n\n async getWeights(): Promise {\n // Order matters for Python compatibility.\n const variables: OptimizerVariable[] =\n [...this.accumulatedGrads, ...this.accumulatedUpdates];\n return [await this.saveIterations()].concat(\n variables.map(v => ({name: v.originalName, tensor: v.variable})));\n }\n\n async setWeights(weightValues: NamedTensor[]): Promise {\n weightValues = await this.extractIterations(weightValues);\n const variableCount = weightValues.length / 2;\n const trainable = false;\n this.accumulatedGrads =\n weightValues.slice(0, variableCount).map(v => ({\n originalName: v.name,\n variable: v.tensor.variable(\n trainable)\n }));\n this.accumulatedUpdates =\n weightValues.slice(variableCount, variableCount * 2)\n .map(v => ({\n originalName: v.name,\n variable: v.tensor.variable(trainable)\n }));\n }\n\n getConfig(): ConfigDict {\n return {\n 'learningRate': this.learningRate,\n 'rho': this.rho,\n 'epsilon': this.epsilon\n };\n }\n\n /** @nocollapse */\n static fromConfig(\n cls: SerializableConstructor, config: ConfigDict): T {\n return new cls(config['learningRate'], config['rho'], config['epsilon']);\n }\n}\nregisterClass(AdadeltaOptimizer);\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {dispose, tidy} from '../globals';\nimport {add} from '../ops/add';\nimport {div} from '../ops/div';\nimport {fill} from '../ops/fill';\nimport {mul} from '../ops/mul';\nimport {sqrt} from '../ops/sqrt';\nimport {square} from '../ops/square';\nimport {ConfigDict, registerClass, Serializable, SerializableConstructor} from '../serialization';\nimport {NamedTensor, NamedVariableMap} from '../tensor_types';\n\nimport {Optimizer, OptimizerVariable} from './optimizer';\n\n/** @doclink Optimizer */\nexport class AdagradOptimizer extends Optimizer {\n /** @nocollapse */\n static className = 'Adagrad'; // Note: Name matters for Python compatibility.\n\n private accumulatedGrads: OptimizerVariable[] = [];\n\n constructor(\n protected learningRate: number, private initialAccumulatorValue = 0.1) {\n super();\n }\n\n applyGradients(variableGradients: NamedVariableMap|NamedTensor[]) {\n const variableNames = Array.isArray(variableGradients) ?\n variableGradients.map(item => item.name) :\n Object.keys(variableGradients);\n\n variableNames.forEach((name, i) => {\n const value = ENGINE.registeredVariables[name];\n if (this.accumulatedGrads[i] == null) {\n const trainable = false;\n this.accumulatedGrads[i] = {\n originalName: `${name}/accumulator`,\n variable: tidy(\n () => fill(value.shape, this.initialAccumulatorValue)\n .variable(trainable))\n };\n }\n\n const gradient = Array.isArray(variableGradients) ?\n variableGradients[i].tensor :\n variableGradients[name];\n if (gradient == null) {\n return;\n }\n\n const accumulatedGrad = this.accumulatedGrads[i].variable;\n\n tidy(() => {\n const newAccumulatedGrad = add(accumulatedGrad, square(gradient));\n accumulatedGrad.assign(newAccumulatedGrad);\n\n const newValue = add(\n mul(div(gradient,\n sqrt(add(newAccumulatedGrad, ENGINE.backend.epsilon()))),\n -this.learningRate),\n value);\n value.assign(newValue);\n });\n });\n this.incrementIterations();\n }\n\n dispose(): void {\n if (this.accumulatedGrads != null) {\n dispose(this.accumulatedGrads.map(v => v.variable));\n }\n }\n\n async getWeights(): Promise {\n // Order matters for Python compatibility.\n return [await this.saveIterations()].concat(this.accumulatedGrads.map(\n v => ({name: v.originalName, tensor: v.variable})));\n }\n\n async setWeights(weightValues: NamedTensor[]): Promise {\n weightValues = await this.extractIterations(weightValues);\n const trainable = false;\n this.accumulatedGrads = weightValues.map(\n v => ({originalName: v.name, variable: v.tensor.variable(trainable)}));\n }\n\n getConfig(): ConfigDict {\n return {\n 'learningRate': this.learningRate,\n 'initialAccumulatorValue': this.initialAccumulatorValue,\n };\n }\n\n /** @nocollapse */\n static fromConfig(\n cls: SerializableConstructor, config: ConfigDict): T {\n return new cls(config['learningRate'], config['initialAccumulatorValue']);\n }\n}\nregisterClass(AdagradOptimizer);\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {dispose, tidy} from '../globals';\nimport {add} from '../ops/add';\nimport {div} from '../ops/div';\nimport {mul} from '../ops/mul';\nimport {pow} from '../ops/pow';\nimport {scalar} from '../ops/scalar';\nimport {sqrt} from '../ops/sqrt';\nimport {square} from '../ops/square';\nimport {sub} from '../ops/sub';\nimport {zerosLike} from '../ops/zeros_like';\nimport {ConfigDict, registerClass, Serializable, SerializableConstructor} from '../serialization';\nimport {Variable} from '../tensor';\nimport {NamedTensor, NamedVariableMap} from '../tensor_types';\n\nimport {Optimizer, OptimizerVariable} from './optimizer';\n\nexport class AdamOptimizer extends Optimizer {\n /** @nocollapse */\n static className = 'Adam'; // Note: Name matters for Python compatibility.\n private accBeta1: Variable;\n private accBeta2: Variable;\n\n private accumulatedFirstMoment: OptimizerVariable[] = [];\n private accumulatedSecondMoment: OptimizerVariable[] = [];\n\n constructor(\n protected learningRate: number, protected beta1: number,\n protected beta2: number, protected epsilon: number = null) {\n super();\n tidy(() => {\n // accB* will be updated by batch.\n this.accBeta1 = scalar(beta1).variable();\n this.accBeta2 = scalar(beta2).variable();\n });\n\n if (epsilon == null) {\n this.epsilon = ENGINE.backend.epsilon();\n }\n }\n\n applyGradients(variableGradients: NamedVariableMap|NamedTensor[]) {\n const varNames = Array.isArray(variableGradients) ?\n variableGradients.map(v => v.name) :\n Object.keys(variableGradients);\n tidy(() => {\n const oneMinusAccBeta1 = sub(1, this.accBeta1);\n const oneMinusAccBeta2 = sub(1, this.accBeta2);\n\n varNames.forEach((name, i) => {\n const value = ENGINE.registeredVariables[name];\n const trainable = false;\n if (this.accumulatedFirstMoment[i] == null) {\n this.accumulatedFirstMoment[i] = {\n originalName: `${name}/m`,\n variable: tidy(() => zerosLike(value).variable(trainable))\n };\n }\n if (this.accumulatedSecondMoment[i] == null) {\n this.accumulatedSecondMoment[i] = {\n originalName: `${name}/v`,\n variable: tidy(() => zerosLike(value).variable(trainable))\n };\n }\n\n const gradient = Array.isArray(variableGradients) ?\n variableGradients[i].tensor :\n variableGradients[name];\n if (gradient == null) {\n return;\n }\n\n const firstMoment = this.accumulatedFirstMoment[i].variable;\n const secondMoment = this.accumulatedSecondMoment[i].variable;\n\n const newFirstMoment =\n add(mul(firstMoment, this.beta1), mul(gradient, 1 - this.beta1));\n const newSecondMoment =\n add(mul(secondMoment, this.beta2),\n mul(square(gradient), 1 - this.beta2));\n\n const biasCorrectedFirstMoment = div(newFirstMoment, oneMinusAccBeta1);\n const biasCorrectedSecondMoment =\n div(newSecondMoment, oneMinusAccBeta2);\n\n firstMoment.assign(newFirstMoment);\n secondMoment.assign(newSecondMoment);\n\n const newValue =\n add(mul(div(biasCorrectedFirstMoment,\n add(sqrt(biasCorrectedSecondMoment), this.epsilon)),\n -this.learningRate),\n value);\n value.assign(newValue);\n });\n\n this.accBeta1.assign(mul(this.accBeta1, this.beta1));\n this.accBeta2.assign(mul(this.accBeta2, this.beta2));\n });\n this.incrementIterations();\n }\n\n dispose(): void {\n this.accBeta1.dispose();\n this.accBeta2.dispose();\n\n if (this.accumulatedFirstMoment != null) {\n dispose(this.accumulatedFirstMoment.map(v => v.variable));\n }\n if (this.accumulatedSecondMoment != null) {\n dispose(this.accumulatedSecondMoment.map(v => v.variable));\n }\n }\n\n async getWeights(): Promise {\n // Order matters for Python compatibility.\n const variables: OptimizerVariable[] =\n [...this.accumulatedFirstMoment, ...this.accumulatedSecondMoment];\n return [await this.saveIterations()].concat(\n variables.map(v => ({name: v.originalName, tensor: v.variable})));\n }\n\n async setWeights(weightValues: NamedTensor[]): Promise {\n weightValues = await this.extractIterations(weightValues);\n tidy(() => {\n this.accBeta1.assign(pow(this.beta1, this.iterations_ + 1));\n this.accBeta2.assign(pow(this.beta2, this.iterations_ + 1));\n });\n\n const variableCount = weightValues.length / 2;\n const trainable = false;\n this.accumulatedFirstMoment =\n weightValues.slice(0, variableCount).map(v => ({\n originalName: v.name,\n variable: v.tensor.variable(\n trainable)\n }));\n this.accumulatedSecondMoment =\n weightValues.slice(variableCount, variableCount * 2)\n .map(v => ({\n originalName: v.name,\n variable: v.tensor.variable(trainable)\n }));\n }\n\n getConfig(): ConfigDict {\n return {\n 'learningRate': this.learningRate,\n 'beta1': this.beta1,\n 'beta2': this.beta2,\n 'epsilon': this.epsilon,\n };\n }\n\n /** @nocollapse */\n static fromConfig(\n cls: SerializableConstructor, config: ConfigDict): T {\n return new cls(\n config['learningRate'], config['beta1'], config['beta2'],\n config['epsilon']);\n }\n}\nregisterClass(AdamOptimizer);\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {dispose, tidy} from '../globals';\nimport {abs} from '../ops/abs';\nimport {add} from '../ops/add';\nimport {div} from '../ops/div';\nimport {maximum} from '../ops/maximum';\nimport {mul} from '../ops/mul';\nimport {scalar} from '../ops/scalar';\nimport {sub} from '../ops/sub';\nimport {zerosLike} from '../ops/zeros_like';\nimport {ConfigDict, registerClass, Serializable, SerializableConstructor} from '../serialization';\nimport {Variable} from '../tensor';\nimport {NamedTensor, NamedVariableMap} from '../tensor_types';\n\nimport {Optimizer, OptimizerVariable} from './optimizer';\n\nexport class AdamaxOptimizer extends Optimizer {\n /** @nocollapse */\n static className = 'Adamax'; // Note: Name matters for Python compatbility.\n private accBeta1: Variable;\n private iteration: Variable;\n\n private accumulatedFirstMoment: OptimizerVariable[] = [];\n private accumulatedWeightedInfNorm: OptimizerVariable[] = [];\n\n constructor(\n protected learningRate: number, protected beta1: number,\n protected beta2: number, protected epsilon: number = null,\n protected decay = 0.0) {\n super();\n\n tidy(() => {\n this.iteration = scalar(0).variable();\n this.accBeta1 = scalar(beta1).variable();\n });\n\n if (epsilon == null) {\n this.epsilon = ENGINE.backend.epsilon();\n }\n }\n\n applyGradients(variableGradients: NamedVariableMap|NamedTensor[]) {\n const variableNames = Array.isArray(variableGradients) ?\n variableGradients.map(item => item.name) :\n Object.keys(variableGradients);\n\n tidy(() => {\n const oneMinusAccBeta1 = sub(1, this.accBeta1);\n const lr =\n div(-this.learningRate, add(mul(this.iteration, this.decay), 1));\n\n variableNames.forEach((name, i) => {\n const value = ENGINE.registeredVariables[name];\n const trainable = false;\n if (this.accumulatedFirstMoment[i] == null) {\n this.accumulatedFirstMoment[i] = {\n originalName: `${name}/m`,\n variable: zerosLike(value).variable(trainable)\n };\n }\n if (this.accumulatedWeightedInfNorm[i] == null) {\n this.accumulatedWeightedInfNorm[i] = {\n originalName: `${name}/v`,\n variable: zerosLike(value).variable(trainable)\n };\n }\n\n const gradient = Array.isArray(variableGradients) ?\n variableGradients[i].tensor :\n variableGradients[name];\n if (gradient == null) {\n return;\n }\n\n const firstMoment = this.accumulatedFirstMoment[i].variable;\n const weightedInfNorm = this.accumulatedWeightedInfNorm[i].variable;\n\n const newFirstMoment =\n add(mul(firstMoment, this.beta1), mul(gradient, 1 - this.beta1));\n\n const ut0 = mul(weightedInfNorm, this.beta2);\n const ut1 = abs(gradient);\n\n const newWeightedInfNorm = maximum(ut0, ut1);\n\n firstMoment.assign(newFirstMoment);\n weightedInfNorm.assign(newWeightedInfNorm);\n\n const newValue =\n add(mul(div(lr, oneMinusAccBeta1),\n div(newFirstMoment, add(newWeightedInfNorm, this.epsilon))),\n value);\n\n value.assign(newValue);\n });\n\n this.iteration.assign(add(this.iteration, 1));\n this.accBeta1.assign(mul(this.accBeta1, this.beta1));\n });\n this.incrementIterations();\n }\n\n dispose(): void {\n this.accBeta1.dispose();\n this.iteration.dispose();\n\n if (this.accumulatedFirstMoment != null) {\n dispose(this.accumulatedFirstMoment.map(v => v.variable));\n }\n if (this.accumulatedWeightedInfNorm != null) {\n dispose(this.accumulatedWeightedInfNorm.map(v => v.variable));\n }\n }\n\n async getWeights(): Promise {\n throw new Error('getWeights() is not implemented for Adamax yet.');\n }\n\n async setWeights(weightValues: NamedTensor[]): Promise {\n throw new Error('setWeights() is not implemented for Adamax yet.');\n }\n\n getConfig(): ConfigDict {\n return {\n 'learningRate': this.learningRate,\n 'beta1': this.beta1,\n 'beta2': this.beta2,\n 'epsilon': this.epsilon,\n 'decay': this.decay\n };\n }\n\n /** @nocollapse */\n static fromConfig(\n cls: SerializableConstructor, config: ConfigDict): T {\n return new cls(\n config['learningRate'], config['beta1'], config['beta2'],\n config['epsilon'], config['decay']);\n }\n}\nregisterClass(AdamaxOptimizer);\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {keep, tidy} from '../globals';\nimport {add} from '../ops/add';\nimport {mul} from '../ops/mul';\nimport {scalar} from '../ops/scalar';\nimport {ConfigDict, registerClass, Serializable, SerializableConstructor} from '../serialization';\nimport {Scalar} from '../tensor';\nimport {NamedTensor, NamedTensorMap} from '../tensor_types';\n\nimport {Optimizer} from './optimizer';\n\n/** @doclink Optimizer */\nexport class SGDOptimizer extends Optimizer {\n /** @nocollapse */\n static className = 'SGD'; // Note: Name matters for Python compatibility.\n protected c: Scalar;\n\n constructor(protected learningRate: number) {\n super();\n this.setLearningRate(learningRate);\n }\n\n applyGradients(variableGradients: NamedTensorMap|NamedTensor[]) {\n const varNames = Array.isArray(variableGradients) ?\n variableGradients.map(v => v.name) :\n Object.keys(variableGradients);\n varNames.forEach((name, i) => {\n const gradient = Array.isArray(variableGradients) ?\n variableGradients[i].tensor :\n variableGradients[name];\n if (gradient == null) {\n return;\n }\n const value = ENGINE.registeredVariables[name];\n tidy(() => {\n const newValue = add(mul(this.c, gradient), value);\n value.assign(newValue);\n });\n });\n this.incrementIterations();\n }\n\n /**\n * Sets the learning rate of the optimizer.\n */\n setLearningRate(learningRate: number) {\n this.learningRate = learningRate;\n if (this.c != null) {\n this.c.dispose();\n }\n this.c = keep(scalar(-learningRate));\n }\n\n dispose() {\n this.c.dispose();\n }\n\n async getWeights(): Promise {\n return [await this.saveIterations()];\n }\n\n async setWeights(weightValues: NamedTensor[]): Promise {\n weightValues = await this.extractIterations(weightValues);\n if (weightValues.length !== 0) {\n throw new Error('SGD optimizer does not have settable weights.');\n }\n }\n\n getConfig(): ConfigDict {\n return {'learningRate': this.learningRate};\n }\n\n /** @nocollapse */\n static fromConfig(\n cls: SerializableConstructor, config: ConfigDict): T {\n return new cls(config['learningRate']);\n }\n}\nregisterClass(SGDOptimizer);\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {dispose, tidy} from '../globals';\nimport {add} from '../ops/add';\nimport {mul} from '../ops/mul';\nimport {scalar} from '../ops/scalar';\nimport {zerosLike} from '../ops/zeros_like';\nimport {ConfigDict, registerClass, Serializable, SerializableConstructor} from '../serialization';\nimport {Scalar, Tensor} from '../tensor';\nimport {NamedTensor, NamedVariableMap} from '../tensor_types';\n\nimport {OptimizerVariable} from './optimizer';\nimport {SGDOptimizer} from './sgd_optimizer';\n\n/** @doclink Optimizer */\nexport class MomentumOptimizer extends SGDOptimizer {\n /** @nocollapse */\n static className = 'Momentum'; // Name matters for Python compatibility.\n private m: Scalar;\n private accumulations: OptimizerVariable[] = [];\n\n constructor(\n protected learningRate: number, private momentum: number,\n private useNesterov = false) {\n super(learningRate);\n this.m = scalar(this.momentum);\n }\n\n applyGradients(variableGradients: NamedVariableMap|NamedTensor[]) {\n const variableNames = Array.isArray(variableGradients) ?\n variableGradients.map(item => item.name) :\n Object.keys(variableGradients);\n\n variableNames.forEach((name, i) => {\n const value = ENGINE.registeredVariables[name];\n if (this.accumulations[i] == null) {\n const trainable = false;\n this.accumulations[i] = {\n originalName: `${name}/momentum`,\n variable: tidy(() => zerosLike(value).variable(trainable))\n };\n }\n\n const accumulation = this.accumulations[i].variable;\n const gradient = Array.isArray(variableGradients) ?\n variableGradients[i].tensor :\n variableGradients[name];\n if (gradient == null) {\n return;\n }\n\n tidy(() => {\n let newValue: Tensor;\n const newAccumulation = add(mul(this.m, accumulation), gradient);\n if (this.useNesterov) {\n newValue = add(\n mul(this.c, add(gradient, mul(newAccumulation, this.m))), value);\n } else {\n newValue = add(mul(this.c, newAccumulation), value);\n }\n accumulation.assign(newAccumulation);\n value.assign(newValue);\n });\n });\n this.incrementIterations();\n }\n\n dispose(): void {\n this.m.dispose();\n if (this.accumulations != null) {\n dispose(this.accumulations.map(v => v.variable));\n }\n }\n\n /**\n * Sets the momentum of the optimizer.\n *\n * @param momentum\n */\n setMomentum(momentum: number) {\n this.momentum = momentum;\n }\n\n async getWeights(): Promise {\n // Order matters for Python compatibility.\n return [await this.saveIterations()].concat(this.accumulations.map(\n v => ({name: v.originalName, tensor: v.variable})));\n }\n\n async setWeights(weightValues: NamedTensor[]): Promise {\n weightValues = await this.extractIterations(weightValues);\n const trainable = false;\n this.accumulations = weightValues.map(\n v => ({originalName: v.name, variable: v.tensor.variable(trainable)}));\n }\n\n getConfig(): ConfigDict {\n return {\n 'learningRate': this.learningRate,\n 'momentum': this.momentum,\n 'useNesterov': this.useNesterov\n };\n }\n\n /** @nocollapse */\n static fromConfig(\n cls: SerializableConstructor, config: ConfigDict): T {\n return new cls(\n config['learningRate'], config['momentum'], config['useNesterov']);\n }\n}\nregisterClass(MomentumOptimizer);\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {dispose, tidy} from '../globals';\nimport {add} from '../ops/add';\nimport {div} from '../ops/div';\nimport {mul} from '../ops/mul';\nimport {sqrt} from '../ops/sqrt';\nimport {square} from '../ops/square';\nimport {sub} from '../ops/sub';\nimport {zerosLike} from '../ops/zeros_like';\nimport {ConfigDict, registerClass, Serializable, SerializableConstructor} from '../serialization';\nimport {NamedTensor, NamedTensorMap} from '../tensor_types';\n\nimport {Optimizer, OptimizerVariable} from './optimizer';\n\n/** @doclink Optimizer */\nexport class RMSPropOptimizer extends Optimizer {\n /** @nocollapse */\n static className = 'RMSProp'; // Note: Name matters for Python compatibility.\n private centered: boolean;\n\n private accumulatedMeanSquares: OptimizerVariable[] = [];\n private accumulatedMoments: OptimizerVariable[] = [];\n private accumulatedMeanGrads: OptimizerVariable[] = [];\n\n constructor(\n protected learningRate: number, protected decay = 0.9,\n protected momentum = 0.0, protected epsilon: number = null,\n centered = false) {\n super();\n\n this.centered = centered;\n\n if (epsilon == null) {\n this.epsilon = ENGINE.backend.epsilon();\n }\n if (learningRate == null) {\n throw new Error(`learningRate for RMSPropOptimizer must be defined.`);\n }\n }\n\n applyGradients(variableGradients: NamedTensorMap|NamedTensor[]) {\n const variableNames = Array.isArray(variableGradients) ?\n variableGradients.map(item => item.name) :\n Object.keys(variableGradients);\n\n variableNames.forEach((name, i) => {\n const value = ENGINE.registeredVariables[name];\n const trainable = false;\n if (this.accumulatedMeanSquares[i] == null) {\n this.accumulatedMeanSquares[i] = {\n originalName: `${name}/rms`,\n variable: tidy(() => zerosLike(value).variable(trainable))\n };\n }\n if (this.accumulatedMoments[i] == null) {\n this.accumulatedMoments[i] = {\n originalName: `${name}/momentum`,\n variable: tidy(() => zerosLike(value).variable(trainable))\n };\n }\n if (this.accumulatedMeanGrads[i] == null && this.centered) {\n this.accumulatedMeanGrads[i] = {\n originalName: `${name}/mg`,\n variable: tidy(() => zerosLike(value).variable(trainable))\n };\n }\n\n const gradient = Array.isArray(variableGradients) ?\n variableGradients[i].tensor :\n variableGradients[name];\n if (gradient == null) {\n return;\n }\n\n const accumulatedMeanSquare = this.accumulatedMeanSquares[i].variable;\n const accumulatedMoments = this.accumulatedMoments[i].variable;\n tidy(() => {\n const newAccumulatedMeanSquare =\n add(mul(accumulatedMeanSquare, this.decay),\n mul(square(gradient), 1 - this.decay));\n\n if (this.centered) {\n const accumulatedMeanGrad = this.accumulatedMeanGrads[i].variable;\n // Centered gradient\n const newAccumulatedMeanGrad =\n add(mul(accumulatedMeanGrad, this.decay),\n mul(gradient, 1 - this.decay));\n\n const gradContribution =\n div(mul(gradient, this.learningRate),\n sqrt(\n sub(newAccumulatedMeanSquare,\n add(square(newAccumulatedMeanGrad), this.epsilon))));\n const newAccumulatedMoments =\n add(mul(accumulatedMoments, this.momentum), gradContribution);\n\n accumulatedMeanSquare.assign(newAccumulatedMeanSquare);\n accumulatedMeanGrad.assign(newAccumulatedMeanGrad);\n accumulatedMoments.assign(newAccumulatedMoments);\n\n const newValue = sub(value, newAccumulatedMoments);\n value.assign(newValue);\n } else {\n // Plain gradient\n const newAccumulatedMeanSquare =\n add(mul(accumulatedMeanSquare, this.decay),\n mul(square(gradient), 1 - this.decay));\n\n const newAccumulatedMoments =\n add(mul(accumulatedMoments, this.momentum),\n div(mul(gradient, this.learningRate),\n sqrt(add(newAccumulatedMeanSquare, this.epsilon))));\n\n accumulatedMeanSquare.assign(newAccumulatedMeanSquare);\n accumulatedMoments.assign(newAccumulatedMoments);\n\n const newValue = sub(value, newAccumulatedMoments);\n value.assign(newValue);\n }\n });\n });\n this.incrementIterations();\n }\n\n dispose(): void {\n if (this.accumulatedMeanSquares != null) {\n dispose(this.accumulatedMeanSquares.map(v => v.variable));\n }\n if (this.accumulatedMeanGrads != null && this.centered) {\n dispose(this.accumulatedMeanGrads.map(v => v.variable));\n }\n if (this.accumulatedMoments != null) {\n dispose(this.accumulatedMoments.map(v => v.variable));\n }\n }\n\n async getWeights(): Promise {\n // Order matters for Python compatibility.\n const variables: OptimizerVariable[] =\n [...this.accumulatedMeanSquares, ...this.accumulatedMoments];\n if (this.centered) {\n variables.push(...this.accumulatedMeanGrads);\n }\n return [await this.saveIterations()].concat(\n variables.map(v => ({name: v.originalName, tensor: v.variable})));\n }\n\n async setWeights(weightValues: NamedTensor[]): Promise {\n weightValues = await this.extractIterations(weightValues);\n const variableCount =\n this.centered ? weightValues.length / 3 : weightValues.length / 2;\n const trainable = false;\n this.accumulatedMeanSquares =\n weightValues.slice(0, variableCount).map(v => ({\n originalName: v.name,\n variable: v.tensor.variable(\n trainable)\n }));\n this.accumulatedMoments =\n weightValues.slice(variableCount, variableCount * 2)\n .map(v => ({\n originalName: v.name,\n variable: v.tensor.variable(trainable)\n }));\n if (this.centered) {\n this.accumulatedMeanGrads =\n weightValues.slice(variableCount * 2, variableCount * 3)\n .map(v => ({\n originalName: v.name,\n variable: v.tensor.variable(trainable)\n }));\n }\n }\n\n getConfig(): ConfigDict {\n return {\n 'learningRate': this.learningRate,\n 'decay': this.decay,\n 'momentum': this.momentum,\n 'epsilon': this.epsilon,\n 'centered': this.centered\n };\n }\n\n /** @nocollapse */\n static fromConfig(\n cls: SerializableConstructor, config: ConfigDict): T {\n return new cls(\n config['learningRate'], config['decay'], config['momentum'],\n config['epsilon'], config['centered']);\n }\n}\nregisterClass(RMSPropOptimizer);\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {AdadeltaOptimizer} from './adadelta_optimizer';\nimport {AdagradOptimizer} from './adagrad_optimizer';\nimport {AdamOptimizer} from './adam_optimizer';\nimport {AdamaxOptimizer} from './adamax_optimizer';\nimport {MomentumOptimizer} from './momentum_optimizer';\nimport {RMSPropOptimizer} from './rmsprop_optimizer';\nimport {SGDOptimizer} from './sgd_optimizer';\n\nexport class OptimizerConstructors {\n /**\n * Constructs a `tf.SGDOptimizer` that uses stochastic gradient descent.\n *\n * ```js\n * // Fit a quadratic function by learning the coefficients a, b, c.\n * const xs = tf.tensor1d([0, 1, 2, 3]);\n * const ys = tf.tensor1d([1.1, 5.9, 16.8, 33.9]);\n *\n * const a = tf.scalar(Math.random()).variable();\n * const b = tf.scalar(Math.random()).variable();\n * const c = tf.scalar(Math.random()).variable();\n *\n * // y = a * x^2 + b * x + c.\n * const f = x => a.mul(x.square()).add(b.mul(x)).add(c);\n * const loss = (pred, label) => pred.sub(label).square().mean();\n *\n * const learningRate = 0.01;\n * const optimizer = tf.train.sgd(learningRate);\n *\n * // Train the model.\n * for (let i = 0; i < 10; i++) {\n * optimizer.minimize(() => loss(f(xs), ys));\n * }\n *\n * // Make predictions.\n * console.log(\n * `a: ${a.dataSync()}, b: ${b.dataSync()}, c: ${c.dataSync()}`);\n * const preds = f(xs).dataSync();\n * preds.forEach((pred, i) => {\n * console.log(`x: ${i}, pred: ${pred}`);\n * });\n * ```\n *\n * @param learningRate The learning rate to use for the SGD algorithm.\n *\n * @doc {heading: 'Training', subheading: 'Optimizers', namespace: 'train'}\n */\n static sgd(learningRate: number): SGDOptimizer {\n return new SGDOptimizer(learningRate);\n }\n\n /**\n * Constructs a `tf.MomentumOptimizer` that uses momentum gradient\n * descent.\n *\n * See\n * [http://proceedings.mlr.press/v28/sutskever13.pdf](\n * http://proceedings.mlr.press/v28/sutskever13.pdf)\n *\n * @param learningRate The learning rate to use for the Momentum gradient\n * descent algorithm.\n * @param momentum The momentum to use for the momentum gradient descent\n * algorithm.\n *\n * @doc {heading: 'Training', subheading: 'Optimizers', namespace: 'train'}\n */\n static momentum(learningRate: number, momentum: number, useNesterov = false):\n MomentumOptimizer {\n return new MomentumOptimizer(learningRate, momentum, useNesterov);\n }\n\n /**\n * Constructs a `tf.RMSPropOptimizer` that uses RMSProp gradient\n * descent. This implementation uses plain momentum and is not centered\n * version of RMSProp.\n *\n * See\n * [http://www.cs.toronto.edu/~tijmen/csc321/slides/lecture_slides_lec6.pdf](\n * http://www.cs.toronto.edu/~tijmen/csc321/slides/lecture_slides_lec6.pdf)\n *\n * @param learningRate The learning rate to use for the RMSProp gradient\n * descent algorithm.\n * @param decay The discounting factor for the history/coming gradient.\n * @param momentum The momentum to use for the RMSProp gradient descent\n * algorithm.\n * @param epsilon Small value to avoid zero denominator.\n * @param centered If true, gradients are normalized by the estimated\n * variance of the gradient.\n *\n * @doc {heading: 'Training', subheading: 'Optimizers', namespace: 'train'}\n */\n static rmsprop(\n learningRate: number, decay = .9, momentum = 0.0, epsilon: number = null,\n centered = false): RMSPropOptimizer {\n return new RMSPropOptimizer(\n learningRate, decay, momentum, epsilon, centered);\n }\n\n /**\n * Constructs a `tf.AdamOptimizer` that uses the Adam algorithm.\n * See [https://arxiv.org/abs/1412.6980](https://arxiv.org/abs/1412.6980)\n *\n * @param learningRate The learning rate to use for the Adam gradient\n * descent algorithm.\n * @param beta1 The exponential decay rate for the 1st moment estimates.\n * @param beta2 The exponential decay rate for the 2nd moment estimates.\n * @param epsilon A small constant for numerical stability.\n *\n * @doc {heading: 'Training', subheading: 'Optimizers', namespace: 'train'}\n */\n static adam(\n learningRate = 0.001, beta1 = 0.9, beta2 = 0.999,\n epsilon: number = null): AdamOptimizer {\n return new AdamOptimizer(learningRate, beta1, beta2, epsilon);\n }\n\n /**\n * Constructs a `tf.AdadeltaOptimizer` that uses the Adadelta algorithm.\n * See [https://arxiv.org/abs/1212.5701](https://arxiv.org/abs/1212.5701)\n *\n * @param learningRate The learning rate to use for the Adadelta gradient\n * descent algorithm.\n * @param rho The learning rate decay over each update.\n * @param epsilon A constant epsilon used to better condition the grad\n * update.\n *\n * @doc {heading: 'Training', subheading: 'Optimizers', namespace: 'train'}\n */\n static adadelta(learningRate = .001, rho = .95, epsilon: number = null):\n AdadeltaOptimizer {\n return new AdadeltaOptimizer(learningRate, rho, epsilon);\n }\n\n /**\n * Constructs a `tf.AdamaxOptimizer` that uses the Adamax algorithm.\n * See [https://arxiv.org/abs/1412.6980](https://arxiv.org/abs/1412.6980)\n *\n * @param learningRate The learning rate to use for the Adamax gradient\n * descent algorithm.\n * @param beta1 The exponential decay rate for the 1st moment estimates.\n * @param beta2 The exponential decay rate for the 2nd moment estimates.\n * @param epsilon A small constant for numerical stability.\n * @param decay The learning rate decay over each update.\n *\n * @doc {heading: 'Training', subheading: 'Optimizers', namespace: 'train'}\n */\n static adamax(\n learningRate = 0.002, beta1 = 0.9, beta2 = 0.999, epsilon: number = null,\n decay = 0.0): AdamaxOptimizer {\n return new AdamaxOptimizer(learningRate, beta1, beta2, epsilon, decay);\n }\n\n /**\n * Constructs a `tf.AdagradOptimizer` that uses the Adagrad algorithm.\n * See\n * [http://www.jmlr.org/papers/volume12/duchi11a/duchi11a.pdf](\n * http://www.jmlr.org/papers/volume12/duchi11a/duchi11a.pdf)\n * or\n * [http://ruder.io/optimizing-gradient-descent/index.html#adagrad](\n * http://ruder.io/optimizing-gradient-descent/index.html#adagrad)\n *\n * @param learningRate The learning rate to use for the Adagrad gradient\n * descent algorithm.\n * @param initialAccumulatorValue Starting value for the accumulators, must be\n * positive.\n *\n * @doc {heading: 'Training', subheading: 'Optimizers', namespace: 'train'}\n */\n static adagrad(learningRate: number, initialAccumulatorValue = 0.1):\n AdagradOptimizer {\n return new AdagradOptimizer(learningRate, initialAccumulatorValue);\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// So typings can propagate.\nimport {AdadeltaOptimizer} from './optimizers/adadelta_optimizer';\nimport {AdagradOptimizer} from './optimizers/adagrad_optimizer';\nimport {AdamOptimizer} from './optimizers/adam_optimizer';\nimport {AdamaxOptimizer} from './optimizers/adamax_optimizer';\nimport {MomentumOptimizer} from './optimizers/momentum_optimizer';\nimport {OptimizerConstructors} from './optimizers/optimizer_constructors';\nimport {RMSPropOptimizer} from './optimizers/rmsprop_optimizer';\nimport {SGDOptimizer} from './optimizers/sgd_optimizer';\n\n// tslint:disable-next-line:no-unused-expression\n[MomentumOptimizer, SGDOptimizer, AdadeltaOptimizer, AdagradOptimizer,\n RMSPropOptimizer, AdamaxOptimizer, AdamOptimizer];\n\nexport const train = {\n sgd: OptimizerConstructors.sgd,\n momentum: OptimizerConstructors.momentum,\n adadelta: OptimizerConstructors.adadelta,\n adagrad: OptimizerConstructors.adagrad,\n rmsprop: OptimizerConstructors.rmsprop,\n adamax: OptimizerConstructors.adamax,\n adam: OptimizerConstructors.adam\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nconst delayCallback: Function = (() => {\n if (typeof requestAnimationFrame !== 'undefined') {\n return requestAnimationFrame;\n } else if (typeof setImmediate !== 'undefined') {\n return setImmediate;\n }\n return (f: Function) => f(); // no delays\n})();\n\n/**\n * Returns a promise that resolves when a requestAnimationFrame has completed.\n *\n * On Node.js this uses setImmediate instead of requestAnimationFrame.\n *\n * This is simply a sugar method so that users can do the following:\n * `await tf.nextFrame();`\n *\n * @doc {heading: 'Performance', subheading: 'Timing'}\n */\nfunction nextFrame(): Promise {\n return new Promise(resolve => delayCallback(() => resolve()));\n}\n\nexport {nextFrame};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport * as util from '../util';\n\nexport function assertParamsConsistent(shapes: number[][], axis: number) {\n const rank = shapes[0].length;\n shapes.forEach((shape, i) => {\n util.assert(\n shape.length === rank,\n () =>\n `Error in concat${rank}D: rank of tensors[${i}] must be the same ` +\n `as the rank of the rest (${rank})`);\n });\n\n util.assert(\n axis >= 0 && axis < rank,\n () => `Error in concat${rank}D: axis must be between 0 and ${rank - 1}.`);\n\n const firstShape = shapes[0];\n shapes.forEach((shape, i) => {\n for (let r = 0; r < rank; r++) {\n util.assert(\n (r === axis) || (shape[r] === firstShape[r]),\n () => `Error in concat${rank}D: Shape of tensors[${i}] (${shape}) ` +\n `does not match the shape of the rest (${firstShape}) ` +\n `along the non-concatenated axis ${i}.`);\n }\n });\n}\n\nexport function computeOutShape(shapes: number[][], axis: number): number[] {\n const outputShape = shapes[0].slice();\n for (let i = 1; i < shapes.length; i++) {\n outputShape[axis] += shapes[i][axis];\n }\n return outputShape;\n}\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nexport enum RowPartitionType {\n FIRST_DIM_SIZE,\n VALUE_ROWIDS,\n ROW_LENGTHS,\n ROW_SPLITS,\n ROW_LIMITS,\n ROW_STARTS\n}\n\nexport function combineRaggedTensorToTensorShapes(\n raggedRank: number, shape: number[], valueShape: number[]) {\n // Test for consistency of valueShape and shape specified.\n // If shape is unspecified and valueShape is specified, then copy\n // over the size from the valueShape dimension.\n\n let outputShape: number[] = new Array();\n if (valueShape == null && shape == null) {\n return outputShape;\n }\n\n if (shape == null) {\n // Here, value_shape must be of known size.\n while (outputShape.length < raggedRank + valueShape.length) {\n outputShape.push(-1);\n }\n } else {\n outputShape = shape.slice();\n }\n if (valueShape == null) {\n return outputShape;\n }\n // At this point, valueShape and output_shape have known ranks.\n if (raggedRank + valueShape.length !== outputShape.length) {\n throw new Error(\n `rt input.shape and shape=${shape} are incompatible: rt input.rank = ${\n raggedRank +\n valueShape.length}, but shape.rank = ${outputShape.length}`);\n }\n\n for (let i = 1; i < valueShape.length; ++i) {\n const valueDim = valueShape[i];\n const outputShapeDimIndex =\n outputShape[outputShape.length - valueShape.length + i];\n const outputShapeDim = outputShape[outputShapeDimIndex];\n\n if (valueDim >= 0) {\n if (outputShapeDim >= 0) {\n if (outputShapeDim !== valueDim) {\n throw new Error(`rt input.shape and shape=${\n shape} are incompatible: rt input.shape[${i + raggedRank}] = ${\n valueDim} but shape[${i + raggedRank}] = ${outputShapeDim}`);\n }\n } else {\n outputShape[outputShapeDimIndex] = valueDim;\n }\n }\n }\n return outputShape;\n}\n\nexport function getRowPartitionTypesHelper(rowPartitionTypeStrings: string[]) {\n const stringToType = {\n 'FIRST_DIM_SIZE': RowPartitionType.FIRST_DIM_SIZE,\n 'VALUE_ROWIDS': RowPartitionType.VALUE_ROWIDS,\n 'ROW_LENGTHS': RowPartitionType.ROW_LENGTHS,\n 'ROW_SPLITS': RowPartitionType.ROW_SPLITS,\n 'ROW_LIMITS': RowPartitionType.ROW_LIMITS,\n 'ROW_STARTS': RowPartitionType.ROW_STARTS\n };\n\n const result: RowPartitionType[] = [];\n for (const typeStr of rowPartitionTypeStrings) {\n if (typeStr in stringToType) {\n result.push(stringToType[typeStr as keyof typeof stringToType]);\n } else {\n break;\n }\n }\n\n return result;\n}\n\nexport function getRaggedRank(rowPartitionTypes: RowPartitionType[]) {\n if (rowPartitionTypes.length === 0) {\n return 0;\n }\n if (rowPartitionTypes[0] === RowPartitionType.FIRST_DIM_SIZE) {\n return rowPartitionTypes.length - 1;\n }\n return rowPartitionTypes.length;\n}\n\nexport function validateDefaultValueShape(\n defaultValueShape: number[], valueShape: number[]) {\n if (defaultValueShape == null || valueShape == null) {\n return;\n }\n\n const defaultNDims = defaultValueShape.length;\n const valuesNDims = valueShape.length;\n if (defaultNDims >= valuesNDims) {\n throw new Error(`defaultValue.shape=${\n defaultValueShape} and ragged tensor flatValues.shape=${\n valueShape}, are incompatible: defaultValue.rank = ${\n defaultNDims} must be less than ragged tensor input flatValues.rank = ${\n valuesNDims})`);\n }\n for (let i = 0; i < Math.min(defaultNDims, valuesNDims - 1); ++i) {\n const defaultDim = defaultValueShape[i];\n const valueDim = valueShape[i + 1];\n if (defaultDim >= 0 && valueDim >= 0 && defaultDim !== 1 &&\n defaultDim !== valueDim) {\n throw new Error(`defaultValue.shape=${\n defaultValueShape}, and ragged tensor input flatValues.shape=${\n valueShape} are incompatible: defaultValue.shape[${\n i - defaultValueShape.length}] = ${\n defaultDim} but ragged tensor input.flatValues.shape[${\n i - defaultValueShape.length}] = ${valueDim}`);\n }\n }\n}\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/**\n * Inputs of size above this threshold will be parallelized by calling multiple\n * shader programs.\n */\nimport {nearestDivisor} from '../util';\n\nexport const PARALLELIZE_THRESHOLD = 30;\n\nexport interface ReduceInfo {\n windowSize: number;\n batchSize: number;\n inSize: number;\n outSize: number;\n}\n\nexport function computeOptimalWindowSize(inSize: number): number {\n if (inSize <= PARALLELIZE_THRESHOLD) {\n return inSize;\n }\n return nearestDivisor(inSize, Math.floor(Math.sqrt(inSize)));\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// Returns the image center in pixels.\nexport function getImageCenter(\n center: number|[number, number], imageHeight: number,\n imageWidth: number): [number, number] {\n const centerX =\n imageWidth * (typeof center === 'number' ? center : center[0]);\n const centerY =\n imageHeight * (typeof center === 'number' ? center : center[1]);\n return [centerX, centerY];\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/**\n * Gets the new shape of the input Tensor after it's been reshaped\n * to:\n * [blockShape[0], ..., blockShape[M-1], batch / prod(blockShape),\n * inputShape[1], ..., inputShape[N-1]]\n *\n * See step 1: https://www.tensorflow.org/api_docs/python/tf/batch_to_space_nd\n */\nexport function getReshaped(\n inputShape: number[], blockShape: number[], prod: number,\n batchToSpace = true): number[] {\n let reshaped: number[] = [];\n if (batchToSpace) {\n reshaped = reshaped.concat(blockShape.slice(0));\n reshaped.push(inputShape[0] / prod);\n reshaped = reshaped.concat(inputShape.slice(1));\n } else {\n reshaped = reshaped.concat(inputShape[0]);\n const spatialLength = blockShape.length;\n for (let i = 0; i < spatialLength; ++i) {\n reshaped =\n reshaped.concat([inputShape[i + 1] / blockShape[i], blockShape[i]]);\n }\n reshaped = reshaped.concat(inputShape.slice(spatialLength + 1));\n }\n return reshaped;\n}\n\n/**\n * Gets the permutation that will transpose the dimensions of the\n * reshaped tensor to shape:\n *\n * [batch / prod(block_shape),inputShape[1], blockShape[0], ...,\n * inputShape[M], blockShape[M-1],inputShape[M+1], ..., inputShape[N-1]]\n *\n * see step 2: https://www.tensorflow.org/api_docs/python/tf/batch_to_space_nd\n */\nexport function getPermuted(\n reshapedRank: number, blockShapeRank: number,\n batchToSpace = true): number[] {\n const permuted = [];\n if (batchToSpace) {\n permuted.push(blockShapeRank);\n for (let i = blockShapeRank + 1; i < reshapedRank; ++i) {\n if (i <= 2 * blockShapeRank) {\n permuted.push(i);\n permuted.push(i - (blockShapeRank + 1));\n } else {\n permuted.push(i);\n }\n }\n } else {\n const permutedBeforeBatch = [];\n const permutedAfterBatch = [];\n for (let i = 1; i < reshapedRank; ++i) {\n if (i >= blockShapeRank * 2 + 1 || i % 2 === 1) {\n permutedAfterBatch.push(i);\n } else {\n permutedBeforeBatch.push(i);\n }\n }\n permuted.push(...permutedBeforeBatch);\n permuted.push(0);\n permuted.push(...permutedAfterBatch);\n }\n return permuted;\n}\n\n/**\n * Gets the shape of the reshaped and permuted input Tensor before any cropping\n * is applied. The new shape will be:\n *\n * [batch / prod(blockShape),inputShape[1] * blockShape[0], ...,\n * inputShape[M] * blockShape[M-1],inputShape[M+1], ..., inputShape[N-1]]\n *\n * See step 3: https://www.tensorflow.org/api_docs/python/tf/batch_to_space_nd\n */\nexport function getReshapedPermuted(\n inputShape: number[], blockShape: number[], prod: number,\n batchToSpace = true): number[] {\n const reshapedPermuted = [];\n\n if (batchToSpace) {\n reshapedPermuted.push(inputShape[0] / prod);\n } else {\n reshapedPermuted.push(inputShape[0] * prod);\n }\n\n for (let i = 1; i < inputShape.length; ++i) {\n if (i <= blockShape.length) {\n if (batchToSpace) {\n reshapedPermuted.push(blockShape[i - 1] * inputShape[i]);\n } else {\n reshapedPermuted.push(inputShape[i] / blockShape[i - 1]);\n }\n } else {\n reshapedPermuted.push(inputShape[i]);\n }\n }\n\n return reshapedPermuted;\n}\n\n/**\n * Converts the crops argument into the beginning coordinates of a slice\n * operation.\n */\nexport function getSliceBeginCoords(\n crops: number[][], blockShape: number): number[] {\n const sliceBeginCoords = [0];\n for (let i = 0; i < blockShape; ++i) {\n sliceBeginCoords.push(crops[i][0]);\n }\n return sliceBeginCoords;\n}\n\n/**\n * Converts the crops argument into the size of a slice operation. When\n * combined with getSliceBeginCoords this function allows the reshaped and\n * permuted Tensor to be cropped to its final output shape of:\n *\n * inputShape[1] * blockShape[0] - crops[0,0] - crops[0,1], ...,\n * inputShape[M] * blockShape[M-1] -crops[M-1,0] -\n * crops[M-1,1],inputShape[M+1], ..., inputShape[N-1]]\n *\n * See step 4: https://www.tensorflow.org/api_docs/python/tf/batch_to_space_nd\n */\nexport function getSliceSize(\n uncroppedShape: number[], crops: number[][], blockShape: number): number[] {\n const sliceSize = uncroppedShape.slice(0, 1);\n for (let i = 0; i < blockShape; ++i) {\n sliceSize.push(uncroppedShape[i + 1] - crops[i][0] - crops[i][1]);\n }\n\n return sliceSize;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nexport const SELU_SCALEALPHA = 1.7580993408473768599402175208123;\nexport const SELU_SCALE = 1.0507009873554804934193349852946;\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nexport const ERF_P = 0.3275911;\nexport const ERF_A1 = 0.254829592;\nexport const ERF_A2 = -0.284496736;\nexport const ERF_A3 = 1.421413741;\nexport const ERF_A4 = -1.453152027;\nexport const ERF_A5 = 1.061405429;\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {TypedArray} from '../types';\n/**\n * Merges real and imaginary Float32Arrays into a single complex Float32Array.\n *\n * The memory layout is interleaved as follows:\n * real: [r0, r1, r2]\n * imag: [i0, i1, i2]\n * complex: [r0, i0, r1, i1, r2, i2]\n *\n * This is the inverse of splitRealAndImagArrays.\n *\n * @param real The real values of the complex tensor values.\n * @param imag The imag values of the complex tensor values.\n * @returns A complex tensor as a Float32Array with merged values.\n */\nexport function mergeRealAndImagArrays(\n real: Float32Array, imag: Float32Array): Float32Array {\n if (real.length !== imag.length) {\n throw new Error(\n `Cannot merge real and imag arrays of different lengths. real:` +\n `${real.length}, imag: ${imag.length}.`);\n }\n const result = new Float32Array(real.length * 2);\n for (let i = 0; i < result.length; i += 2) {\n result[i] = real[i / 2];\n result[i + 1] = imag[i / 2];\n }\n return result;\n}\n\n/**\n * Splits a complex Float32Array into real and imag parts.\n *\n * The memory layout is interleaved as follows:\n * complex: [r0, i0, r1, i1, r2, i2]\n * real: [r0, r1, r2]\n * imag: [i0, i1, i2]\n *\n * This is the inverse of mergeRealAndImagArrays.\n *\n * @param complex The complex tensor values.\n * @returns An object with real and imag Float32Array components of the complex\n * tensor.\n */\nexport function splitRealAndImagArrays(complex: Float32Array):\n {real: Float32Array, imag: Float32Array} {\n const real = new Float32Array(complex.length / 2);\n const imag = new Float32Array(complex.length / 2);\n for (let i = 0; i < complex.length; i += 2) {\n real[i / 2] = complex[i];\n imag[i / 2] = complex[i + 1];\n }\n return {real, imag};\n}\n\n/**\n * Extracts even indexed complex values in the given array.\n * @param complex The complex tensor values\n */\nexport function complexWithEvenIndex(complex: Float32Array):\n {real: Float32Array, imag: Float32Array} {\n const len = Math.ceil(complex.length / 4);\n const real = new Float32Array(len);\n const imag = new Float32Array(len);\n for (let i = 0; i < complex.length; i += 4) {\n real[Math.floor(i / 4)] = complex[i];\n imag[Math.floor(i / 4)] = complex[i + 1];\n }\n return {real, imag};\n}\n\n/**\n * Extracts odd indexed comple values in the given array.\n * @param complex The complex tensor values\n */\nexport function complexWithOddIndex(complex: Float32Array):\n {real: Float32Array, imag: Float32Array} {\n const len = Math.floor(complex.length / 4);\n const real = new Float32Array(len);\n const imag = new Float32Array(len);\n for (let i = 2; i < complex.length; i += 4) {\n real[Math.floor(i / 4)] = complex[i];\n imag[Math.floor(i / 4)] = complex[i + 1];\n }\n return {real, imag};\n}\n\n/**\n * Get the map representing a complex value in the given array.\n * @param complex The complex tensor values.\n * @param index An index of the target complex value.\n */\nexport function getComplexWithIndex(\n complex: Float32Array, index: number): {real: number, imag: number} {\n const real = complex[index * 2];\n const imag = complex[index * 2 + 1];\n return {real, imag};\n}\n\n/**\n * Insert a given complex value into the TypedArray.\n * @param data The array in which the complex value is inserted.\n * @param c The complex value to be inserted.\n * @param index An index of the target complex value.\n */\nexport function assignToTypedArray(\n data: TypedArray, real: number, imag: number, index: number) {\n data[index * 2] = real;\n data[index * 2 + 1] = imag;\n}\n\n/**\n * Make the list of exponent terms used by FFT.\n */\nexport function exponents(\n n: number, inverse: boolean): {real: Float32Array, imag: Float32Array} {\n const real = new Float32Array(n / 2);\n const imag = new Float32Array(n / 2);\n for (let i = 0; i < Math.ceil(n / 2); i++) {\n const x = (inverse ? 2 : -2) * Math.PI * (i / n);\n real[i] = Math.cos(x);\n imag[i] = Math.sin(x);\n }\n return {real, imag};\n}\n\n/**\n * Make the exponent term used by FFT.\n */\nexport function exponent(\n k: number, n: number, inverse: boolean): {real: number, imag: number} {\n const x = (inverse ? 2 : -2) * Math.PI * (k / n);\n const real = Math.cos(x);\n const imag = Math.sin(x);\n return {real, imag};\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/**\n * Utility functions for computing einsum (tensor contraction and summation\n * based on Einstein summation.)\n */\n\nimport {Tensor} from '../tensor';\nimport {assert} from '../util_base';\n\nconst ARROW = '->';\nconst ARROW_REGEX = /->/g;\nconst COMMA = ',';\nconst ELLIPSIS = '...';\n\n/**\n * Parse an equation for einsum.\n *\n * @param equation The einsum equation (e.g., \"ij,jk->ik\").\n * @param numTensors Number of tensors provided along with `equation`. Used to\n * check matching number of input tensors.\n * @returns An object consisting of the following fields:\n * - allDims: all dimension names as strings.\n * - summedDims: a list of all dimensions being summed over, as indices to\n * the elements of `allDims`.\n * - idDims: indices of the dimensions in each input tensor, as indices to\n * the elements of `allDims.\n */\nexport function decodeEinsumEquation(equation: string, numTensors: number): {\n allDims: string[],\n summedDims: number[],\n idDims: number[][],\n} {\n equation = equation.replace(/\\s/g, ''); // Remove witespace in equation.\n const numArrows =\n (equation.length - equation.replace(ARROW_REGEX, '').length) /\n ARROW.length;\n if (numArrows < 1) {\n throw new Error('Equations without an arrow are not supported.');\n } else if (numArrows > 1) {\n throw new Error(`Equation must contain exactly one arrow (\"${ARROW}\").`);\n }\n const [inputString, outputString] = equation.split(ARROW);\n assert(\n inputString.indexOf(ELLIPSIS) === -1,\n () => `The ellipsis notation (\"${ELLIPSIS}\") is not supported yet.`);\n const inputTerms = inputString.split(COMMA);\n const numInputs = inputTerms.length;\n if (numTensors !== numInputs) {\n throw new Error(\n `Expected ${numInputs} input tensors, received ${numTensors}`);\n }\n if (numInputs > 2) {\n throw new Error(\n 'Support for more than 2 input tensors is not implemented yet.');\n }\n\n const allDims: string[] = [];\n for (let i = 0; i < outputString.length; ++i) {\n const dimName = outputString[i];\n if (!inputTerms.some(inputTerm => inputTerm.indexOf(dimName) !== -1)) {\n throw new Error(\n `Output subscripts contain the label ${dimName} ` +\n `not present in the input subscripts.`);\n }\n if (allDims.indexOf(dimName) === -1) {\n allDims.push(dimName);\n }\n }\n for (let i = 0; i < inputString.length; ++i) {\n const dimName = inputString[i];\n if (allDims.indexOf(dimName) === -1 && dimName !== COMMA) {\n allDims.push(dimName);\n }\n }\n\n const idDims: number[][] = new Array(inputTerms.length);\n for (let i = 0; i < numInputs; ++i) {\n if (new Set(inputTerms[i].split('')).size !== inputTerms[i].length) {\n throw new Error(\n `Found duplicate axes in input component ${inputTerms[i]}. ` +\n `Support for duplicate axes in input is not implemented yet.`);\n }\n idDims[i] = [];\n for (let j = 0; j < inputTerms[i].length; ++j) {\n idDims[i].push(allDims.indexOf(inputTerms[i][j]));\n }\n }\n\n const numDims = allDims.length; // Number of unique dimensions.\n const numOutDims = outputString.length; // Number of output dimensions.\n const summedDims: number[] = []; // Dimensions being summed over.\n for (let i = numOutDims; i < numDims; ++i) {\n summedDims.push(i);\n }\n return {allDims, summedDims, idDims};\n}\n\n/**\n * Get the permutation for a given input tensor.\n *\n * @param nDims Total number of dimension of all tensors involved in the einsum\n * operation.\n * @param idDims Dimension indices involve in the tensor in question.\n * @returns An object consisting of the following fields:\n * - permutationIndices: Indices to permute the axes of the tensor with.\n * - expandDims: Indices to the dimension that need to be expanded from the\n * tensor after permutation.\n */\nexport function getEinsumPermutation(nDims: number, idDims: number[]):\n {permutationIndices: number[], expandDims: number[]} {\n let permutationIndices: number[] = new Array(nDims);\n permutationIndices.fill(-1);\n for (let i = 0; i < idDims.length; ++i) {\n permutationIndices[idDims[i]] = i;\n }\n const expandDims: number[] = [];\n for (let i = 0; i < nDims; ++i) {\n if (permutationIndices[i] === -1) {\n expandDims.push(i);\n }\n }\n permutationIndices = permutationIndices.filter(d => d !== -1);\n return {permutationIndices, expandDims};\n}\n\n/**\n * Checks that the dimension sizes from different input tensors match the\n * equation.\n */\nexport function checkEinsumDimSizes(\n nDims: number, idDims: number[][], tensors: Tensor[]) {\n const dimSizes: number[] = new Array(nDims);\n for (let i = 0; i < tensors.length; ++i) {\n const shape: number[] = tensors[i].shape;\n for (let j = 0; j < idDims[i].length; ++j) {\n if (dimSizes[idDims[i][j]] === undefined) {\n dimSizes[idDims[i][j]] = shape[j];\n } else {\n assert(\n dimSizes[idDims[i][j]] === shape[j],\n () => `Expected dimension ${dimSizes[idDims[i][j]]} at axis ${j} ` +\n `of input shaped ${JSON.stringify(shape)}, ` +\n `but got dimension ${shape[j]}`);\n }\n }\n }\n}\n\n/**\n * Gets path of computation for einsum.\n *\n * @param summedDims indices to the dimensions being summed over.\n * @param idDims A look up table for the dimensions present in each input\n * tensor. Each consituent array contains indices for the dimensions in the\n * corresponding input tensor.\n *\n * @return A map with two fields:\n * - path: The path of computation, with each element indicating the dimension\n * being summed over after the element-wise multiplication in that step.\n * - steps: With the same length as `path`. Each element contains the indices\n * to the input tensors being used for element-wise multiplication in the\n * corresponding step.\n */\nexport function getEinsumComputePath(summedDims: number[], idDims: number[][]):\n {path: number[], steps: number[][]} {\n const path: number[] = summedDims;\n const steps: number[][] = [];\n let nSteps = 0;\n if (summedDims.length === 0) {\n // Einsum that involes no summing: e.g., transpose and outer product.\n path.push(-1);\n }\n nSteps = summedDims.length + 1;\n for (let i = 0; i < nSteps; ++i) {\n steps.push([]);\n }\n const computedTermIndices: number[] = [];\n for (let i = 0; i < path.length; ++i) {\n const summedDim = path[i];\n const termIndices = findTermsWithDim(idDims, summedDim);\n for (const termIndex of termIndices) {\n if (computedTermIndices.indexOf(termIndex) === -1) {\n steps[i].push(termIndex);\n computedTermIndices.push(termIndex);\n }\n }\n }\n return {path, steps};\n}\n\n/** Determines if an axes permutation is the identity permutation. */\nexport function isIdentityPermutation(perm: number[]): boolean {\n return perm.every((dim: number, index: number) => dim === index);\n}\n\nfunction findTermsWithDim(idDims: number[][], dim: number): number[] {\n const termIndices: number[] = [];\n for (let i = 0; i < idDims.length; ++i) {\n if (idDims[i].length === 0 || idDims[i].indexOf(dim) !== -1 || dim === -1) {\n termIndices.push(i);\n }\n }\n return termIndices;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {TensorInfo} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {assert} from '../util';\n\n/**\n * Prepare the split size array. When the input is a number, the axis is evenly\n * divided among the split size. When the input contains the negative value, the\n * rest of the axis is allocated toward that.\n */\nexport function prepareSplitSize(\n x: Tensor|TensorInfo, numOrSizeSplits: number[]|number,\n axis = 0): number[] {\n let splitSizes = [];\n if (typeof (numOrSizeSplits) === 'number') {\n assert(\n x.shape[axis] % numOrSizeSplits === 0,\n () => 'Number of splits must evenly divide the axis.');\n splitSizes =\n new Array(numOrSizeSplits).fill(x.shape[axis] / numOrSizeSplits);\n } else {\n const numOfNegs = numOrSizeSplits.reduce((count, value) => {\n if (value === -1) {\n count += 1;\n }\n return count;\n }, 0);\n assert(\n numOfNegs <= 1,\n () => 'There should be only one negative value in split array.');\n const negIndex = numOrSizeSplits.indexOf(-1);\n // Allow the number of split array to be -1, which indicates the rest\n // of dimension is allocated to that split.\n if (negIndex !== -1) {\n const total = numOrSizeSplits.reduce((a, b) => b > 0 ? a + b : a);\n numOrSizeSplits[negIndex] = x.shape[axis] - total;\n }\n assert(\n x.shape[axis] === numOrSizeSplits.reduce((a, b) => a + b),\n () => 'The sum of sizes must match the size of the axis dimension.');\n splitSizes = numOrSizeSplits;\n }\n\n return splitSizes;\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/**\n * Generates sparse fill empty rows indices, dense shape mismatch error message.\n *\n * @param indicesLength The first dimension of indices.\n */\nexport function getSparseFillEmptyRowsIndicesDenseShapeMismatch(\n indicesLength: number) {\n return `Received SparseTensor with denseShape[0] = 0 but\n indices.shape[0] = ${indicesLength}`;\n}\n\n/**\n * Generates sparse fill empty rows negative index error message.\n *\n * @param index The index with a negative value.\n * @param value The negative value.\n */\nexport function getSparseFillEmptyRowsNegativeIndexErrorMessage(\n index: number, value: number) {\n return `indices(${index}, 0) is invalid: ${value} < 0`;\n}\n\n/**\n * Generates sparse fill empty rows out of range index error message.\n *\n * @param index The index with an out of range value.\n * @param value The out of range value.\n * @param limit The upper limit for indices.\n */\nexport function getSparseFillEmptyRowsOutOfRangeIndexErrorMessage(\n index: number, value: number, limit: number) {\n return `indices(${index}, 0) is invalid: ${value} >= ${limit}`;\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {sizeFromShape} from '../../util';\n\n/**\n * Generates sparse reshape multiple negative 1 output dimension error message.\n *\n * @param dim1 The first dimension with a negative 1 value.\n * @param dim2 The second dimension with a negative 1 value.\n */\nexport function getSparseReshapeMultipleNegativeOneOutputDimErrorMessage(\n dim1: number, dim2: number) {\n return `only one output dimension may be -1, not both ${dim1} and ${dim2}`;\n}\n\n/**\n * Generates sparse reshape negative output dimension error message.\n *\n * @param dim The dimension with a negative value.\n * @param value The negative value.\n */\nexport function getSparseReshapeNegativeOutputDimErrorMessage(\n dim: number, value: number) {\n return `size ${dim} must be non-negative, not ${value}`;\n}\n\n/**\n * Generates sparse reshape empty tensor zero output dimension error message.\n *\n */\nexport function getSparseReshapeEmptyTensorZeroOutputDimErrorMessage() {\n return 'reshape cannot infer the missing input size for an empty tensor ' +\n 'unless all specified input sizes are non-zero';\n}\n\n/**\n * Generates sparse reshape input output multiple mismatch error message.\n *\n * @param inputShape the input shape.\n * @param outputShape the requested output shape.\n */\nexport function getSparseReshapeInputOutputMultipleErrorMessage(\n inputShape: number[], outputShape: number[]) {\n const inputSize = sizeFromShape(inputShape);\n const outputSize = sizeFromShape(outputShape);\n return `Input to reshape is a SparseTensor with ${inputSize}\n dense values, but the requested shape requires a multiple of ${\n outputSize}. inputShape=${inputShape} outputShape= ${outputShape}`;\n}\n\n/**\n * Generates sparse reshape input output inequality error message.\n *\n * @param inputShape the input shape.\n * @param outputShape the requested output shape.\n */\nexport function getSparseReshapeInputOutputMismatchErrorMessage(\n inputShape: number[], outputShape: number[]) {\n const inputSize = sizeFromShape(inputShape);\n const outputSize = sizeFromShape(outputShape);\n return `Input to reshape is a tensor with ${\n inputSize} dense values, but the requested shape has ${\n outputSize}. inputShape=${inputShape} outputShape=${outputShape}`;\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/**\n * Generates sparse segment reduction negative segment ids error message.\n *\n */\nexport function getSparseSegmentReductionNegativeSegmentIdsErrorMessage() {\n return `segment ids must be >= 0`;\n}\n\n/**\n * Generates sparse segment reduction non increasing segment ids error message.\n *\n */\nexport function getSparseSegmentReductionNonIncreasingSegmentIdsErrorMessage() {\n return `segment ids are not increasing`;\n}\n\n/**\n * Generates sparse segment reduction segment id out of range error message.\n *\n * @param segmentId The segment id index that is out of range.\n * @param outputRows Upper bound of valid segment id values.\n */\nexport function getSparseSegmentReductionSegmentIdOutOfRangeErrorMessage(\n segmentId: number, outputRows: number) {\n return `Segment id ${segmentId} out of range [0, ${\n outputRows}), possibly because segmentIds input is not sorted.`;\n}\n\n/**\n * Generates sparse segment reduction input indice out of range error message.\n *\n * @param index The index that holds the out of range value.\n * @param indexValue The value that is out of range.\n * @param inputRows Upper bound of valid index values.\n */\nexport function getSparseSegmentReductionIndicesOutOfRangeErrorMessage(\n index: number, indexValue: number, inputRows: number) {\n return `Bad: indices[${index}] == ${indexValue} out of range [0, ${\n inputRows})`;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {TensorInfo} from '../kernel_registry';\nimport {nearestDivisor} from '../util';\n\nimport {PARALLELIZE_THRESHOLD} from './reduce_util';\n\nexport interface SegOpInfo {\n windowSize: number;\n batchSize: number;\n inSize: number;\n numSegments: number;\n}\n\nexport function segOpComputeOptimalWindowSize(\n inSize: number, numSegments: number): number {\n let done = false;\n let res;\n\n if (inSize <= PARALLELIZE_THRESHOLD) {\n res = inSize;\n done = true;\n } else {\n res = nearestDivisor(inSize, Math.floor(Math.sqrt(inSize)));\n }\n\n while (!done) {\n if (res > numSegments || res === inSize) {\n done = true;\n } else {\n res = nearestDivisor(inSize, res + 1);\n }\n }\n return res;\n}\n\nexport function computeOutShape(\n aShape: number[], axis: number, numSegments: number): number[] {\n const outShape = [];\n const rank = aShape.length;\n for (let dim = 0; dim < rank; dim++) {\n if (dim !== axis) {\n outShape.push(aShape[dim]);\n } else {\n outShape.push(numSegments);\n }\n }\n return outShape;\n}\n\nexport interface GatherOpShapeInfo {\n batchSize: number;\n sliceSize: number;\n outerSize: number;\n dimSize: number;\n outputShape: number[];\n}\n\nexport function collectGatherOpShapeInfo(\n x: TensorInfo, indices: TensorInfo, axis: number,\n batchDims: number): GatherOpShapeInfo {\n const indicesRank = indices.shape.length;\n const xRank = x.shape.length;\n\n if (batchDims !== 0) {\n if (batchDims < -indicesRank || batchDims > indicesRank) {\n throw new Error(`Expect batchDims in the range of [-${indicesRank}, ${\n indicesRank}], but got ${batchDims}`);\n }\n }\n\n if (batchDims < 0) {\n batchDims += indicesRank;\n }\n\n if (batchDims > xRank) {\n throw new Error(`batchDims (${batchDims}) must be less than rank(x) (\n ${xRank}).`);\n }\n\n if (axis < batchDims) {\n throw new Error(`batchDims (${\n batchDims}) must be less than or equal to axis (${axis}).`);\n }\n\n for (let i = 0; i < batchDims; ++i) {\n if (x.shape[i] !== indices.shape[i]) {\n throw new Error(\n `x.shape[${i}]: ${x.shape[i]} should be equal to indices.shape[${\n i}]: ${indices.shape[i]}.`);\n }\n }\n const dimSize = x.shape[axis];\n\n const outputShape: number[] = [];\n let batchSize = 1;\n let outerSize = 1;\n let sliceSize = 1;\n\n for (let i = 0; i < batchDims; ++i) {\n outputShape.push(x.shape[i]);\n batchSize *= x.shape[i];\n }\n\n for (let i = batchDims; i < axis; i++) {\n outputShape.push(x.shape[i]);\n outerSize *= x.shape[i];\n }\n\n for (let i = batchDims; i < indicesRank; i++) {\n outputShape.push(indices.shape[i]);\n }\n\n for (let i = axis + 1; i < xRank; i++) {\n outputShape.push(x.shape[i]);\n sliceSize *= x.shape[i];\n }\n\n return {batchSize, sliceSize, outerSize, dimSize, outputShape};\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {decodeString, encodeString} from '../util';\n\n// Utilities needed by backend consumers of tf-core.\nexport * from '../ops/axis_util';\nexport * from '../ops/broadcast_util';\nexport * from '../ops/concat_util';\nexport * from '../ops/conv_util';\nexport * from '../ops/fused_util';\nexport * from '../ops/fused_types';\nexport * from '../ops/ragged_to_dense_util';\nexport * from '../ops/reduce_util';\n\nimport * as slice_util from '../ops/slice_util';\nexport {slice_util};\n\nexport {BackendValues, TypedArray, upcastType, PixelData} from '../types';\nexport {MemoryInfo, TimingInfo} from '../engine';\nexport * from '../ops/rotate_util';\nexport * from '../ops/array_ops_util';\nexport * from '../ops/gather_nd_util';\nexport * from '../ops/scatter_nd_util';\nexport * from '../ops/selu_util';\nexport * from '../ops/fused_util';\nexport * from '../ops/erf_util';\nexport * from '../log';\nexport * from '../backends/complex_util';\nexport * from '../backends/einsum_util';\nexport * from '../ops/split_util';\nexport * from '../ops/sparse/sparse_fill_empty_rows_util';\nexport * from '../ops/sparse/sparse_reshape_util';\nexport * from '../ops/sparse/sparse_segment_reduction_util';\n\nimport * as segment_util from '../ops/segment_util';\nexport {segment_util};\n\nexport function fromUint8ToStringArray(vals: Uint8Array[]) {\n try {\n // Decode the bytes into string.\n return vals.map(val => decodeString(val));\n } catch (err) {\n throw new Error(\n `Failed to decode encoded string bytes into utf-8, error: ${err}`);\n }\n}\n\nexport function fromStringArrayToUint8(strings: string[]) {\n return strings.map(s => encodeString(s));\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nexport {nonMaxSuppressionV3Impl, nonMaxSuppressionV4Impl, nonMaxSuppressionV5Impl} from './non_max_suppression_impl';\nexport {whereImpl} from './where_impl';\n","/**\n * @license\n * Copyright 2020 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// base.ts is tfjs-core without auto registration of things like flags,\n// gradients, chained ops or the opHandler. See base_side_effects.ts for parts\n// tfjs core that are required side effects.\n\n/**\n * @fileoverview\n * @suppress {partialAlias} Optimization disabled due to passing the module\n * object into a function below:\n *\n * import * as ops from './ops/ops';\n * setOpHandler(ops);\n */\n\n// Serialization.\nimport * as io from './io/io';\nimport * as math from './math';\nimport * as broadcast_util from './ops/broadcast_util';\nimport * as browser from './ops/browser';\nimport * as gather_util from './ops/gather_nd_util';\nimport * as scatter_util from './ops/scatter_nd_util';\nimport * as slice_util from './ops/slice_util';\nimport * as serialization from './serialization';\nimport * as tensor_util from './tensor_util';\nimport * as test_util from './test_util';\nimport * as util from './util';\nimport {version} from './version';\n\nexport {InferenceModel, MetaGraph, MetaGraphInfo, ModelPredictConfig, ModelTensorInfo, SavedModelTensorInfo, SignatureDef, SignatureDefEntry, SignatureDefInfo} from './model_types';\nexport {AdadeltaOptimizer} from './optimizers/adadelta_optimizer';\nexport {AdagradOptimizer} from './optimizers/adagrad_optimizer';\nexport {AdamOptimizer} from './optimizers/adam_optimizer';\nexport {AdamaxOptimizer} from './optimizers/adamax_optimizer';\nexport {MomentumOptimizer} from './optimizers/momentum_optimizer';\nexport {Optimizer} from './optimizers/optimizer';\n// Optimizers.\nexport {OptimizerConstructors} from './optimizers/optimizer_constructors';\nexport {RMSPropOptimizer} from './optimizers/rmsprop_optimizer';\nexport {SGDOptimizer} from './optimizers/sgd_optimizer';\nexport {DataToGPUOptions, DataToGPUWebGLOption, GPUData, Scalar, Tensor, Tensor1D, Tensor2D, Tensor3D, Tensor4D, Tensor5D, TensorBuffer, Variable} from './tensor';\nexport {GradSaveFunc, NamedTensorMap, TensorContainer, TensorContainerArray, TensorContainerObject} from './tensor_types';\nexport {BackendValues, DataType, DataTypeMap, DataValues, NumericDataType, PixelData, Rank, RecursiveArray, ScalarLike, ShapeMap, sumOutType, TensorLike, TypedArray, upcastType, WebGLData} from './types';\n\nexport * from './ops/ops';\nexport {Reduction} from './ops/loss_ops_utils';\n\nexport * from './train';\nexport * from './globals';\nexport * from './kernel_registry';\nexport {customGrad, grad, grads, valueAndGrad, valueAndGrads, variableGrads} from './gradients';\n\nexport {TimingInfo, MemoryInfo, ForwardFunc} from './engine';\nexport {Environment, env, ENV} from './environment';\nexport {Platform} from './platforms/platform';\n\nexport {version as version_core};\n\n// Top-level method exports.\nexport {nextFrame} from './browser_util';\n\n// Second level exports.\nimport * as backend_util from './backends/backend_util';\nimport * as device_util from './device_util';\nexport {\n browser,\n io,\n math,\n serialization,\n test_util,\n util,\n backend_util,\n broadcast_util,\n tensor_util,\n slice_util,\n gather_util,\n scatter_util,\n device_util\n};\n\nimport * as kernel_impls from './backends/kernel_impls';\nexport {kernel_impls};\n// Backend specific.\nexport {KernelBackend, BackendTimingInfo, DataMover, DataStorage} from './backends/backend';\n\n// Export all kernel names / info.\nexport * from './kernel_names';\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// Required side effectful code.\nimport './base_side_effects';\n// All exports from this package should be in base.\nexport * from './base';\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env} from '@tensorflow/tfjs-core';\n\nconst contexts: {[key: string]: WebGLRenderingContext} = {};\n\nconst WEBGL_ATTRIBUTES: WebGLContextAttributes = {\n alpha: false,\n antialias: false,\n premultipliedAlpha: false,\n preserveDrawingBuffer: false,\n depth: false,\n stencil: false,\n failIfMajorPerformanceCaveat: true\n};\n\nexport function clearWebGLContext(webGLVersion: number) {\n delete contexts[webGLVersion];\n}\n\nexport function setWebGLContext(\n webGLVersion: number, gl: WebGLRenderingContext) {\n contexts[webGLVersion] = gl;\n}\n\nexport function getWebGLContext(\n webGLVersion: number,\n customCanvas?: HTMLCanvasElement|OffscreenCanvas): WebGLRenderingContext {\n if (!(webGLVersion in contexts) || customCanvas != null) {\n const newCtx = getWebGLRenderingContext(webGLVersion, customCanvas);\n if (newCtx !== null) {\n contexts[webGLVersion] = newCtx;\n } else {\n console.log('Could not get context for WebGL version', webGLVersion);\n return null;\n }\n }\n const gl = contexts[webGLVersion];\n if (gl == null || gl.isContextLost()) {\n delete contexts[webGLVersion];\n return getWebGLContext(webGLVersion);\n }\n\n gl.disable(gl.DEPTH_TEST);\n gl.disable(gl.STENCIL_TEST);\n gl.disable(gl.BLEND);\n gl.disable(gl.DITHER);\n gl.disable(gl.POLYGON_OFFSET_FILL);\n gl.disable(gl.SAMPLE_COVERAGE);\n gl.enable(gl.SCISSOR_TEST);\n gl.enable(gl.CULL_FACE);\n gl.cullFace(gl.BACK);\n\n return contexts[webGLVersion];\n}\n\nfunction createCanvas(webGLVersion: number) {\n if (typeof OffscreenCanvas !== 'undefined' && webGLVersion === 2) {\n return new OffscreenCanvas(300, 150);\n } else if (typeof document !== 'undefined') {\n return document.createElement('canvas');\n } else {\n throw new Error('Cannot create a canvas in this context');\n }\n}\n\nfunction getWebGLRenderingContext(\n webGLVersion: number,\n customCanvas?: HTMLCanvasElement|OffscreenCanvas): WebGLRenderingContext {\n if (webGLVersion !== 1 && webGLVersion !== 2) {\n throw new Error('Cannot get WebGL rendering context, WebGL is disabled.');\n }\n const canvas =\n customCanvas == null ? createCanvas(webGLVersion) : customCanvas;\n\n canvas.addEventListener('webglcontextlost', (ev: Event) => {\n ev.preventDefault();\n delete contexts[webGLVersion];\n }, false);\n\n if (env().getBool('SOFTWARE_WEBGL_ENABLED')) {\n WEBGL_ATTRIBUTES.failIfMajorPerformanceCaveat = false;\n }\n\n if (webGLVersion === 1) {\n return (canvas.getContext('webgl', WEBGL_ATTRIBUTES) ||\n (canvas as HTMLCanvasElement)\n .getContext('experimental-webgl', WEBGL_ATTRIBUTES));\n }\n return canvas.getContext('webgl2', WEBGL_ATTRIBUTES) as WebGLRenderingContext;\n}\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, DataId, DataType, env, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nexport enum PackingScheme {\n /**\n * All values in a single texel are densely packed without any constraints.\n *\n * This is how the shader encodes a tensor with shape = [2, 3, 4]\n * (indices are [batch, row, col]).\n *\n * 000|001 010|011 020|021\n * ------- ------- -------\n * 002|003 012|013 022|023\n *\n * 100|101 110|111 120|121\n * ------- ------- -------\n * 102|103 112|113 122|123\n *\n */\n DENSE,\n\n /**\n * Single texels contain only values from the same batch, and from adjacent\n * rows and columns.\n *\n * This is how the shader encodes a tensor with shape = [2, 3, 5]\n * (indices are [batch, row, col]).\n *\n * 000|001 002|003 004|xxx 020|021 022|023 024|xxx\n * ------- ------- ------- ------- ------- -------\n * 010|011 012|013 014|xxx xxx|xxx xxx|xxx xxx|xxx\n *\n * 100|101 102|103 104|xxx 120|121 122|123 124|xxx\n * ------- ------- ------- ------- ------- -------\n * 110|111 112|113 114|xxx xxx|xxx xxx|xxx xxx|xxx\n *\n */\n SHARED_BATCH\n}\n\nexport enum TextureUsage {\n RENDER,\n UPLOAD,\n PIXELS,\n DOWNLOAD\n}\n\nexport enum PhysicalTextureType {\n UNPACKED_FLOAT16,\n UNPACKED_FLOAT32,\n PACKED_4X1_UNSIGNED_BYTE,\n PACKED_2X2_FLOAT32,\n PACKED_2X2_FLOAT16\n}\n\nexport interface Texture {\n texture: WebGLTexture;\n texShape: [number, number];\n}\nexport interface TextureData {\n // Required.\n shape: number[];\n dtype: DataType;\n\n // Optional.\n values?: backend_util.BackendValues;\n texture?: Texture;\n // For complex numbers, the real and imaginary parts are stored as their own\n // individual tensorInfos, with a parent joining the two with the\n // complexTensors field. When this is defined, texture will be null.\n complexTensorInfos?: {real: TensorInfo, imag: TensorInfo};\n /** [rows, columns] shape of the texture. */\n texShape?: [number, number];\n usage?: TextureUsage;\n isPacked?: boolean;\n\n refCount: number;\n\n // Available when the tensor has been sliced.\n slice?: {\n // Offset in the 'flat index' space.\n flatOffset: number;\n // Used for counting how many sliced tensors point to the same texture.\n origDataId: DataId;\n };\n}\n\nexport function getUnpackedMatrixTextureShapeWidthHeight(\n rows: number, columns: number): [number, number] {\n return [columns, rows];\n}\n\nexport function getUnpackedArraySizeFromMatrixSize(\n matrixSize: number, channelsPerTexture: number): number {\n return matrixSize * channelsPerTexture;\n}\n\nexport function getColorMatrixTextureShapeWidthHeight(\n rows: number, columns: number): [number, number] {\n return [columns * 4, rows];\n}\n\n/**\n * Get shape for densely packed RGBA texture.\n */\nexport function getDenseTexShape(shape: number[]): [number, number] {\n const size = util.sizeFromShape(shape);\n const texelsNeeded = Math.ceil(size / 4);\n return util.sizeToSquarishShape(texelsNeeded);\n}\n\nexport function getMatrixSizeFromUnpackedArraySize(\n unpackedSize: number, channelsPerTexture: number): number {\n if (unpackedSize % channelsPerTexture !== 0) {\n throw new Error(\n `unpackedSize (${unpackedSize}) must be a multiple of ` +\n `${channelsPerTexture}`);\n }\n return unpackedSize / channelsPerTexture;\n}\n\nexport function decodeMatrixFromUnpackedColorRGBAArray(\n unpackedArray: Float32Array, matrix: Float32Array, channels: number) {\n const requiredSize = unpackedArray.length * channels / 4;\n if (matrix.length < requiredSize) {\n throw new Error(\n `matrix length (${matrix.length}) must be >= ${requiredSize}`);\n }\n let dst = 0;\n for (let src = 0; src < unpackedArray.length; src += 4) {\n for (let c = 0; c < channels; c++) {\n matrix[dst++] = unpackedArray[src + c];\n }\n }\n}\n\nexport function getPackedMatrixTextureShapeWidthHeight(\n rows: number, columns: number): [number, number] {\n return [\n Math.max(1, Math.ceil(columns / 2)), Math.max(1, Math.ceil(rows / 2))\n ];\n}\n\nexport function getPackedRGBAArraySizeFromMatrixShape(\n rows: number, columns: number): number {\n const [w, h] = getPackedMatrixTextureShapeWidthHeight(rows, columns);\n return w * h * 4;\n}\n\nexport interface TextureConfig {\n internalFormatFloat: number;\n textureFormatFloat: number;\n internalFormatPackedHalfFloat: number;\n internalFormatHalfFloat: number;\n internalFormatPackedFloat: number;\n\n // The format to use during a gl.readPixels call.\n downloadTextureFormat: number;\n // How many channels need to be unpacked after a gl.readPixels call.\n downloadUnpackNumChannels: number;\n\n defaultNumChannels: number;\n textureTypeHalfFloat: number;\n textureTypeFloat: number;\n}\n\nexport function getTextureConfig(\n // tslint:disable-next-line:no-any\n gl: WebGLRenderingContext, textureHalfFloatExtension?: any): TextureConfig {\n // tslint:disable-next-line:no-any\n const glany = gl as any;\n\n let internalFormatFloat: number;\n let internalFormatHalfFloat: number;\n let internalFormatPackedHalfFloat: number;\n let internalFormatPackedFloat: number;\n let textureFormatFloat: number;\n\n let downloadTextureFormat: number;\n let downloadUnpackNumChannels: number;\n\n let defaultNumChannels: number;\n let textureTypeHalfFloat: number;\n let textureTypeFloat: number;\n\n if (env().getNumber('WEBGL_VERSION') === 2) {\n internalFormatFloat = glany.R32F;\n internalFormatHalfFloat = glany.R16F;\n internalFormatPackedHalfFloat = glany.RGBA16F;\n internalFormatPackedFloat = glany.RGBA32F;\n textureFormatFloat = glany.RED;\n downloadUnpackNumChannels = 4;\n defaultNumChannels = 1;\n textureTypeHalfFloat = glany.HALF_FLOAT;\n textureTypeFloat = glany.FLOAT;\n downloadTextureFormat = glany.RGBA8;\n } else {\n internalFormatFloat = gl.RGBA;\n internalFormatHalfFloat = gl.RGBA;\n internalFormatPackedHalfFloat = gl.RGBA;\n internalFormatPackedFloat = glany.RGBA;\n textureFormatFloat = gl.RGBA;\n downloadUnpackNumChannels = 4;\n defaultNumChannels = 4;\n textureTypeHalfFloat = textureHalfFloatExtension != null ?\n textureHalfFloatExtension.HALF_FLOAT_OES :\n null;\n textureTypeFloat = gl.FLOAT;\n downloadTextureFormat = gl.RGBA;\n }\n\n return {\n internalFormatFloat,\n internalFormatHalfFloat,\n internalFormatPackedHalfFloat,\n internalFormatPackedFloat,\n textureFormatFloat,\n downloadTextureFormat,\n downloadUnpackNumChannels,\n defaultNumChannels,\n textureTypeHalfFloat,\n textureTypeFloat\n };\n}\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {getWebGLContext} from './canvas_util';\nimport {getTextureConfig} from './tex_util';\n\nexport function callAndCheck(gl: WebGLRenderingContext, func: () => T): T {\n const returnValue = func();\n if (env().getBool('DEBUG')) {\n checkWebGLError(gl);\n }\n return returnValue;\n}\n\nfunction checkWebGLError(gl: WebGLRenderingContext) {\n const error = gl.getError();\n if (error !== gl.NO_ERROR) {\n throw new Error('WebGL Error: ' + getWebGLErrorMessage(gl, error));\n }\n}\n\n// https://en.wikipedia.org/wiki/Half-precision_floating-point_format\nconst MIN_FLOAT16 = 5.96e-8;\nconst MAX_FLOAT16 = 65504;\n\nexport function canBeRepresented(num: number): boolean {\n if (env().getBool('WEBGL_RENDER_FLOAT32_ENABLED') || num === 0 ||\n (MIN_FLOAT16 < Math.abs(num) && Math.abs(num) < MAX_FLOAT16)) {\n return true;\n }\n return false;\n}\n\nexport function getWebGLErrorMessage(\n gl: WebGLRenderingContext, status: number): string {\n switch (status) {\n case gl.NO_ERROR:\n return 'NO_ERROR';\n case gl.INVALID_ENUM:\n return 'INVALID_ENUM';\n case gl.INVALID_VALUE:\n return 'INVALID_VALUE';\n case gl.INVALID_OPERATION:\n return 'INVALID_OPERATION';\n case gl.INVALID_FRAMEBUFFER_OPERATION:\n return 'INVALID_FRAMEBUFFER_OPERATION';\n case gl.OUT_OF_MEMORY:\n return 'OUT_OF_MEMORY';\n case gl.CONTEXT_LOST_WEBGL:\n return 'CONTEXT_LOST_WEBGL';\n default:\n return `Unknown error code ${status}`;\n }\n}\n\nexport function getExtensionOrThrow(\n gl: WebGLRenderingContext, extensionName: string): {} {\n return throwIfNull<{}>(\n gl, () => gl.getExtension(extensionName),\n 'Extension \"' + extensionName + '\" not supported on this browser.');\n}\n\nexport function createVertexShader(\n gl: WebGLRenderingContext, vertexShaderSource: string): WebGLShader {\n const vertexShader: WebGLShader = throwIfNull(\n gl, () => gl.createShader(gl.VERTEX_SHADER),\n 'Unable to create vertex WebGLShader.');\n callAndCheck(gl, () => gl.shaderSource(vertexShader, vertexShaderSource));\n callAndCheck(gl, () => gl.compileShader(vertexShader));\n if (gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS) === false) {\n console.log(gl.getShaderInfoLog(vertexShader));\n throw new Error('Failed to compile vertex shader.');\n }\n return vertexShader;\n}\n\nexport function createFragmentShader(\n gl: WebGLRenderingContext, fragmentShaderSource: string): WebGLShader {\n const fragmentShader: WebGLShader = throwIfNull(\n gl, () => gl.createShader(gl.FRAGMENT_SHADER),\n 'Unable to create fragment WebGLShader.');\n callAndCheck(gl, () => gl.shaderSource(fragmentShader, fragmentShaderSource));\n callAndCheck(gl, () => gl.compileShader(fragmentShader));\n if (env().get('ENGINE_COMPILE_ONLY')) {\n return fragmentShader;\n }\n if (gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS) === false) {\n logShaderSourceAndInfoLog(\n fragmentShaderSource, gl.getShaderInfoLog(fragmentShader));\n throw new Error('Failed to compile fragment shader.');\n }\n return fragmentShader;\n}\n\nconst lineNumberRegex = /ERROR: [0-9]+:([0-9]+):/g;\nexport function logShaderSourceAndInfoLog(\n shaderSource: string, shaderInfoLog: string) {\n const lineNumberRegexResult = lineNumberRegex.exec(shaderInfoLog);\n if (lineNumberRegexResult == null) {\n console.log(`Couldn't parse line number in error: ${shaderInfoLog}`);\n console.log(shaderSource);\n return;\n }\n\n const lineNumber = +lineNumberRegexResult[1];\n\n const shaderLines = shaderSource.split('\\n');\n const pad = shaderLines.length.toString().length + 2;\n const linesWithLineNumbers = shaderLines.map(\n (line, lineNumber) =>\n util.rightPad((lineNumber + 1).toString(), pad) + line);\n let maxLineLength = 0;\n for (let i = 0; i < linesWithLineNumbers.length; i++) {\n maxLineLength = Math.max(linesWithLineNumbers[i].length, maxLineLength);\n }\n\n const beforeErrorLines = linesWithLineNumbers.slice(0, lineNumber - 1);\n const errorLine = linesWithLineNumbers.slice(lineNumber - 1, lineNumber);\n const afterErrorLines = linesWithLineNumbers.slice(lineNumber);\n\n console.log(beforeErrorLines.join('\\n'));\n console.log(shaderInfoLog.split('\\n')[0]);\n console.log(\n `%c ${util.rightPad(errorLine[0], maxLineLength)}`,\n 'border:1px solid red; background-color:#e3d2d2; color:#a61717');\n console.log(afterErrorLines.join('\\n'));\n}\n\nexport function createProgram(gl: WebGLRenderingContext): WebGLProgram {\n return throwIfNull(\n gl, () => gl.createProgram(), 'Unable to create WebGLProgram.');\n}\n\nexport function linkProgram(gl: WebGLRenderingContext, program: WebGLProgram) {\n callAndCheck(gl, () => gl.linkProgram(program));\n if (env().get('ENGINE_COMPILE_ONLY')) {\n return;\n }\n if (gl.getProgramParameter(program, gl.LINK_STATUS) === false) {\n console.log(gl.getProgramInfoLog(program));\n throw new Error('Failed to link vertex and fragment shaders.');\n }\n}\n\nexport function validateProgram(\n gl: WebGLRenderingContext, program: WebGLProgram) {\n callAndCheck(gl, () => gl.validateProgram(program));\n if (gl.getProgramParameter(program, gl.VALIDATE_STATUS) === false) {\n console.log(gl.getProgramInfoLog(program));\n throw new Error('Shader program validation failed.');\n }\n}\n\nexport function createStaticVertexBuffer(\n gl: WebGLRenderingContext, data: Float32Array): WebGLBuffer {\n const buffer: WebGLBuffer = throwIfNull(\n gl, () => gl.createBuffer(), 'Unable to create WebGLBuffer');\n callAndCheck(gl, () => gl.bindBuffer(gl.ARRAY_BUFFER, buffer));\n callAndCheck(gl, () => gl.bufferData(gl.ARRAY_BUFFER, data, gl.STATIC_DRAW));\n return buffer;\n}\n\nexport function createStaticIndexBuffer(\n gl: WebGLRenderingContext, data: Uint16Array): WebGLBuffer {\n const buffer: WebGLBuffer = throwIfNull(\n gl, () => gl.createBuffer(), 'Unable to create WebGLBuffer');\n callAndCheck(gl, () => gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, buffer));\n callAndCheck(\n gl, () => gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, data, gl.STATIC_DRAW));\n return buffer;\n}\n\nexport function getNumChannels(): number {\n if (env().getNumber('WEBGL_VERSION') === 2) {\n return 1;\n }\n return 4;\n}\n\nexport function createTexture(gl: WebGLRenderingContext): WebGLTexture {\n return throwIfNull(\n gl, () => gl.createTexture(), 'Unable to create WebGLTexture.');\n}\n\nexport function validateTextureSize(width: number, height: number) {\n const maxTextureSize = env().getNumber('WEBGL_MAX_TEXTURE_SIZE');\n if ((width <= 0) || (height <= 0)) {\n const requested = `[${width}x${height}]`;\n throw new Error('Requested texture size ' + requested + ' is invalid.');\n }\n if ((width > maxTextureSize) || (height > maxTextureSize)) {\n const requested = `[${width}x${height}]`;\n const max = `[${maxTextureSize}x${maxTextureSize}]`;\n throw new Error(\n 'Requested texture size ' + requested +\n ' greater than WebGL maximum on this browser / GPU ' + max + '.');\n }\n}\n\nexport function createFramebuffer(gl: WebGLRenderingContext): WebGLFramebuffer {\n return throwIfNull(\n gl, () => gl.createFramebuffer(), 'Unable to create WebGLFramebuffer.');\n}\n\nexport function bindVertexBufferToProgramAttribute(\n gl: WebGLRenderingContext, program: WebGLProgram, attribute: string,\n buffer: WebGLBuffer, arrayEntriesPerItem: number, itemStrideInBytes: number,\n itemOffsetInBytes: number): boolean {\n const loc = gl.getAttribLocation(program, attribute);\n if (loc === -1) {\n // The GPU compiler decided to strip out this attribute because it's unused,\n // thus no need to bind.\n return false;\n }\n callAndCheck(gl, () => gl.bindBuffer(gl.ARRAY_BUFFER, buffer));\n callAndCheck(\n gl,\n () => gl.vertexAttribPointer(\n loc, arrayEntriesPerItem, gl.FLOAT, false, itemStrideInBytes,\n itemOffsetInBytes));\n callAndCheck(gl, () => gl.enableVertexAttribArray(loc));\n return true;\n}\n\nexport function bindTextureUnit(\n gl: WebGLRenderingContext, texture: WebGLTexture, textureUnit: number) {\n validateTextureUnit(gl, textureUnit);\n callAndCheck(gl, () => gl.activeTexture(gl.TEXTURE0 + textureUnit));\n callAndCheck(gl, () => gl.bindTexture(gl.TEXTURE_2D, texture));\n}\n\nexport function unbindTextureUnit(\n gl: WebGLRenderingContext, textureUnit: number) {\n validateTextureUnit(gl, textureUnit);\n callAndCheck(gl, () => gl.activeTexture(gl.TEXTURE0 + textureUnit));\n callAndCheck(gl, () => gl.bindTexture(gl.TEXTURE_2D, null));\n}\n\nexport function getProgramUniformLocationOrThrow(\n gl: WebGLRenderingContext, program: WebGLProgram,\n uniformName: string): WebGLUniformLocation {\n return throwIfNull(\n gl, () => gl.getUniformLocation(program, uniformName),\n 'uniform \"' + uniformName + '\" not present in program.');\n}\n\nexport function getProgramUniformLocation(\n gl: WebGLRenderingContext, program: WebGLProgram,\n uniformName: string): WebGLUniformLocation {\n return gl.getUniformLocation(program, uniformName);\n}\n\nexport function bindTextureToProgramUniformSampler(\n gl: WebGLRenderingContext, texture: WebGLTexture,\n uniformSamplerLocation: WebGLUniformLocation, textureUnit: number) {\n callAndCheck(gl, () => bindTextureUnit(gl, texture, textureUnit));\n callAndCheck(gl, () => gl.uniform1i(uniformSamplerLocation, textureUnit));\n}\n\nexport function bindCanvasToFramebuffer(gl: WebGLRenderingContext) {\n callAndCheck(gl, () => gl.bindFramebuffer(gl.FRAMEBUFFER, null));\n callAndCheck(gl, () => gl.viewport(0, 0, gl.canvas.width, gl.canvas.height));\n callAndCheck(gl, () => gl.scissor(0, 0, gl.canvas.width, gl.canvas.height));\n}\n\nexport function bindColorTextureToFramebuffer(\n gl: WebGLRenderingContext, texture: WebGLTexture,\n framebuffer: WebGLFramebuffer) {\n callAndCheck(gl, () => gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer));\n callAndCheck(\n gl,\n () => gl.framebufferTexture2D(\n gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0));\n}\n\nexport function unbindColorTextureFromFramebuffer(\n gl: WebGLRenderingContext, framebuffer: WebGLFramebuffer) {\n callAndCheck(gl, () => gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer));\n callAndCheck(\n gl,\n () => gl.framebufferTexture2D(\n gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, null, 0));\n}\n\nexport function validateFramebuffer(gl: WebGLRenderingContext) {\n const status = gl.checkFramebufferStatus(gl.FRAMEBUFFER);\n if (status !== gl.FRAMEBUFFER_COMPLETE) {\n throw new Error(\n 'Error binding framebuffer: ' + getFramebufferErrorMessage(gl, status));\n }\n}\n\nexport function getFramebufferErrorMessage(\n gl: WebGLRenderingContext, status: number): string {\n switch (status) {\n case gl.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:\n return 'FRAMEBUFFER_INCOMPLETE_ATTACHMENT';\n case gl.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:\n return 'FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT';\n case gl.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:\n return 'FRAMEBUFFER_INCOMPLETE_DIMENSIONS';\n case gl.FRAMEBUFFER_UNSUPPORTED:\n return 'FRAMEBUFFER_UNSUPPORTED';\n default:\n return `unknown error ${status}`;\n }\n}\n\nfunction throwIfNull(\n gl: WebGLRenderingContext, returnTOrNull: () => T | null,\n failureMessage: string): T {\n const tOrNull: T|null = callAndCheck(gl, () => returnTOrNull());\n if (tOrNull == null) {\n throw new Error(failureMessage);\n }\n return tOrNull;\n}\n\nfunction validateTextureUnit(gl: WebGLRenderingContext, textureUnit: number) {\n const maxTextureUnit = gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS - 1;\n const glTextureUnit = textureUnit + gl.TEXTURE0;\n if (glTextureUnit < gl.TEXTURE0 || glTextureUnit > maxTextureUnit) {\n const textureUnitRange = `[gl.TEXTURE0, gl.TEXTURE${maxTextureUnit}]`;\n throw new Error(`textureUnit must be in ${textureUnitRange}.`);\n }\n}\n\nexport function getBatchDim(shape: number[], dimsToSkip = 2): number {\n return util.sizeFromShape(shape.slice(0, shape.length - dimsToSkip));\n}\n\nexport function getRowsCols(shape: number[]): [number, number] {\n if (shape.length === 0) {\n throw Error('Cannot get rows and columns of an empty shape array.');\n }\n\n return [\n shape.length > 1 ? shape[shape.length - 2] : 1, shape[shape.length - 1]\n ];\n}\n\nexport function getShapeAs3D(shape: number[]): [number, number, number] {\n let shapeAs3D: [number, number, number] = [1, 1, 1];\n const isScalar = shape.length === 0 || (shape.length === 1 && shape[0] === 1);\n if (!isScalar) {\n shapeAs3D =\n [getBatchDim(shape), ...getRowsCols(shape)] as [number, number, number];\n }\n return shapeAs3D;\n}\n\nexport function getTextureShapeFromLogicalShape(\n logShape: number[], isPacked = false): [number, number] {\n let maxTexSize = env().getNumber('WEBGL_MAX_TEXTURE_SIZE');\n let maxSizeForNarrowTex =\n env().getNumber('WEBGL_MAX_SIZE_FOR_NARROW_TEXTURE');\n if (maxSizeForNarrowTex === Infinity &&\n env().getBool('WEBGL_AUTO_SQUARIFY_NARROW_TEXTURE_SHAPE')) {\n maxSizeForNarrowTex = maxTexSize / 2;\n }\n\n if (isPacked) {\n maxTexSize = maxTexSize * 2;\n maxSizeForNarrowTex = maxSizeForNarrowTex * 2;\n\n // This logic ensures we accurately count the number of packed texels needed\n // to accommodate the tensor. We can only pack values in the same texel if\n // they are from adjacent pairs of rows/cols within the same batch. So if a\n // tensor has 3 rows, we pretend it has 4 rows in order to account for the\n // fact that the texels containing the third row are half empty.\n logShape = logShape.map(\n (d, i) => i >= logShape.length - 2 ?\n util.nearestLargerEven(logShape[i]) :\n logShape[i]);\n\n // Packed texture height is at least 2 (the channel height of a single\n // texel).\n if (logShape.length === 1) {\n logShape = [2, logShape[0]];\n }\n }\n\n // If logical shape is 2, we don't squeeze, since we want to match physical.\n if (logShape.length !== 2) {\n const squeezeResult = util.squeezeShape(logShape);\n logShape = squeezeResult.newShape;\n }\n\n let size = util.sizeFromShape(logShape);\n let textureShape: [number, number] = null;\n if (logShape.length <= 1 && size <= maxTexSize) {\n textureShape = [1, size];\n } else if (\n logShape.length === 2 && logShape[0] <= maxTexSize &&\n logShape[1] <= maxTexSize) {\n textureShape = logShape as [number, number];\n } else if (\n logShape.length === 3 && logShape[0] * logShape[1] <= maxTexSize &&\n logShape[2] <= maxTexSize) {\n textureShape = [logShape[0] * logShape[1], logShape[2]];\n } else if (\n logShape.length === 3 && logShape[0] <= maxTexSize &&\n logShape[1] * logShape[2] <= maxTexSize) {\n textureShape = [logShape[0], logShape[1] * logShape[2]];\n } else if (\n logShape.length === 4 &&\n logShape[0] * logShape[1] * logShape[2] <= maxTexSize &&\n logShape[3] <= maxTexSize) {\n textureShape = [logShape[0] * logShape[1] * logShape[2], logShape[3]];\n } else if (\n logShape.length === 4 && logShape[0] <= maxTexSize &&\n logShape[1] * logShape[2] * logShape[3] <= maxTexSize) {\n textureShape = [logShape[0], logShape[1] * logShape[2] * logShape[3]];\n }\n\n // true if one edge length is 1 (1 or 2, if packed), while another edge\n // length exceeds maxSizeForNarrowTex.\n const isLongNarrowTex = textureShape != null &&\n Math.max(...textureShape) > maxSizeForNarrowTex &&\n Math.min(...textureShape) <= (isPacked ? 2 : 1) &&\n Math.min(...textureShape) > 0;\n\n if (textureShape == null || isLongNarrowTex) {\n if (isPacked) {\n // For packed textures size equals the number of channels required to\n // accommodate the texture data. However in order to squarify such that\n // inner dimensions stay even, we rewrite size to equal the number of\n // texels. Then in the return statement we rehydrate the squarified\n // dimensions to channel units.\n\n const batchDim = getBatchDim(logShape);\n let rows = 2, cols = 2;\n if (logShape.length) {\n [rows, cols] = getRowsCols(logShape);\n }\n size = batchDim * (rows / 2) * (cols / 2);\n textureShape =\n util.sizeToSquarishShape(size).map(d => d * 2) as [number, number];\n } else {\n textureShape = util.sizeToSquarishShape(size);\n }\n }\n\n return textureShape;\n}\n\nfunction isEven(n: number): boolean {\n return n % 2 === 0;\n}\n\n/**\n * This determines whether reshaping a packed texture requires rearranging\n * the data within the texture, assuming 2x2 packing.\n */\nexport function isReshapeFree(shape1: number[], shape2: number[]): boolean {\n shape1 = shape1.slice(-2);\n shape2 = shape2.slice(-2);\n\n if (util.arraysEqual(shape1, shape2)) {\n return true;\n }\n\n if (!shape1.length || !shape2.length) { // One of the shapes is a scalar.\n return true;\n }\n\n if (shape1[0] === 0 || shape1[1] === 0 || shape2[0] === 0 ||\n shape2[1] === 0) {\n return true;\n }\n\n if (shape1.length !== shape2.length) { // One of the shapes is a vector.\n const shape1Cols = shape1.slice(-1)[0];\n const shape2Cols = shape2.slice(-1)[0];\n if (shape1Cols === shape2Cols) {\n return true;\n }\n\n if (isEven(shape1Cols) && isEven(shape2Cols) &&\n (shape1[0] === 1 || shape2[0] === 1)) {\n return true;\n }\n }\n return shape1[1] === shape2[1] && isEven(shape1[0]) && isEven(shape2[0]);\n}\n\n// We cache webgl params because the environment gets reset between\n// unit tests and we don't want to constantly query the WebGLContext for\n// MAX_TEXTURE_SIZE.\nlet MAX_TEXTURE_SIZE: number;\nlet MAX_TEXTURES_IN_SHADER: number;\n\nexport function getWebGLMaxTextureSize(webGLVersion: number): number {\n if (MAX_TEXTURE_SIZE == null) {\n const gl = getWebGLContext(webGLVersion);\n MAX_TEXTURE_SIZE = gl.getParameter(gl.MAX_TEXTURE_SIZE);\n }\n return MAX_TEXTURE_SIZE;\n}\n\nexport function resetMaxTextureSize() {\n MAX_TEXTURE_SIZE = null;\n}\nexport function resetMaxTexturesInShader() {\n MAX_TEXTURES_IN_SHADER = null;\n}\n\nexport function getMaxTexturesInShader(webGLVersion: number): number {\n if (MAX_TEXTURES_IN_SHADER == null) {\n const gl = getWebGLContext(webGLVersion);\n MAX_TEXTURES_IN_SHADER = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);\n }\n // We cap at 16 to avoid spurious runtime \"memory exhausted\" error.\n return Math.min(16, MAX_TEXTURES_IN_SHADER);\n}\n\nexport function getWebGLDisjointQueryTimerVersion(webGLVersion: number):\n number {\n if (webGLVersion === 0) {\n return 0;\n }\n\n let queryTimerVersion: number;\n const gl = getWebGLContext(webGLVersion);\n\n if (hasExtension(gl, 'EXT_disjoint_timer_query_webgl2') &&\n webGLVersion === 2) {\n queryTimerVersion = 2;\n } else if (hasExtension(gl, 'EXT_disjoint_timer_query')) {\n queryTimerVersion = 1;\n } else {\n queryTimerVersion = 0;\n }\n return queryTimerVersion;\n}\n\nexport function hasExtension(gl: WebGLRenderingContext, extensionName: string) {\n const ext = gl.getExtension(extensionName);\n return ext != null;\n}\n\nexport function isWebGLVersionEnabled(webGLVersion: 1|2) {\n try {\n const gl = getWebGLContext(webGLVersion);\n if (gl != null) {\n return true;\n }\n } catch (e) {\n console.log('Error when getting WebGL context: ', e);\n return false;\n }\n return false;\n}\n\nexport function isCapableOfRenderingToFloatTexture(webGLVersion: number):\n boolean {\n if (webGLVersion === 0) {\n return false;\n }\n\n const gl = getWebGLContext(webGLVersion);\n\n if (webGLVersion === 1) {\n if (!hasExtension(gl, 'OES_texture_float')) {\n return false;\n }\n } else {\n if (!hasExtension(gl, 'EXT_color_buffer_float')) {\n return false;\n }\n }\n\n const isFrameBufferComplete = createFloatTextureAndBindToFramebuffer(gl);\n return isFrameBufferComplete;\n}\n\n/**\n * Check if we can download values from a float/half-float texture.\n *\n * Note that for performance reasons we use binding a texture to a framebuffer\n * as a proxy for ability to download float values later using readPixels. The\n * texture params of this texture will not match those in readPixels exactly\n * but if we are unable to bind some kind of float texture to the frameBuffer\n * then we definitely will not be able to read float values from it.\n */\nexport function isDownloadFloatTextureEnabled(webGLVersion: number): boolean {\n if (webGLVersion === 0) {\n return false;\n }\n\n const gl = getWebGLContext(webGLVersion);\n\n if (webGLVersion === 1) {\n if (!hasExtension(gl, 'OES_texture_float')) {\n return false;\n }\n if (!hasExtension(gl, 'WEBGL_color_buffer_float')) {\n return false;\n }\n } else {\n if (hasExtension(gl, 'EXT_color_buffer_float')) {\n return createFloatTextureAndBindToFramebuffer(gl);\n }\n\n const COLOR_BUFFER_HALF_FLOAT = 'EXT_color_buffer_half_float';\n if (hasExtension(gl, COLOR_BUFFER_HALF_FLOAT)) {\n const textureHalfFloatExtension =\n gl.getExtension(COLOR_BUFFER_HALF_FLOAT);\n return createHalfFloatTextureAndBindToFramebuffer(\n gl, textureHalfFloatExtension);\n }\n\n return false;\n }\n\n const isFrameBufferComplete = createFloatTextureAndBindToFramebuffer(gl);\n return isFrameBufferComplete;\n}\n\nfunction createFloatTextureAndBindToFramebuffer(gl: WebGLRenderingContext):\n boolean {\n const texConfig = getTextureConfig(gl);\n\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n\n const width = 1;\n const height = 1;\n gl.texImage2D(\n gl.TEXTURE_2D, 0, texConfig.internalFormatFloat, width, height, 0,\n texConfig.textureFormatFloat, texConfig.textureTypeFloat, null);\n\n const frameBuffer = gl.createFramebuffer();\n gl.bindFramebuffer(gl.FRAMEBUFFER, frameBuffer);\n gl.framebufferTexture2D(\n gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);\n\n const isFrameBufferComplete =\n gl.checkFramebufferStatus(gl.FRAMEBUFFER) === gl.FRAMEBUFFER_COMPLETE;\n\n gl.bindTexture(gl.TEXTURE_2D, null);\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n gl.deleteTexture(texture);\n gl.deleteFramebuffer(frameBuffer);\n\n return isFrameBufferComplete;\n}\n\nfunction createHalfFloatTextureAndBindToFramebuffer(\n // tslint:disable-next-line:no-any\n gl: WebGLRenderingContext, textureHalfFloatExtension: any): boolean {\n const texConfig = getTextureConfig(gl, textureHalfFloatExtension);\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n\n const width = 1;\n const height = 1;\n gl.texImage2D(\n gl.TEXTURE_2D, 0, texConfig.internalFormatHalfFloat, width, height, 0,\n texConfig.textureFormatFloat, texConfig.textureTypeHalfFloat, null);\n\n const frameBuffer = gl.createFramebuffer();\n gl.bindFramebuffer(gl.FRAMEBUFFER, frameBuffer);\n gl.framebufferTexture2D(\n gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);\n\n const isFrameBufferComplete =\n gl.checkFramebufferStatus(gl.FRAMEBUFFER) === gl.FRAMEBUFFER_COMPLETE;\n\n gl.bindTexture(gl.TEXTURE_2D, null);\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n gl.deleteTexture(texture);\n gl.deleteFramebuffer(frameBuffer);\n\n return isFrameBufferComplete;\n}\n\nexport function isWebGLFenceEnabled(webGLVersion: number) {\n if (webGLVersion !== 2) {\n return false;\n }\n const gl = getWebGLContext(webGLVersion);\n\n // tslint:disable-next-line:no-any\n const isEnabled = (gl as any).fenceSync != null;\n return isEnabled;\n}\n\nexport function assertNotComplex(\n tensor: TensorInfo|TensorInfo[], opName: string): void {\n if (!Array.isArray(tensor)) {\n tensor = [tensor];\n }\n tensor.forEach(t => {\n if (t != null) {\n util.assert(\n t.dtype !== 'complex64',\n () => `${opName} does not support complex64 tensors ` +\n 'in the WebGL backend.');\n }\n });\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {device_util, env} from '@tensorflow/tfjs-core';\n\nimport {getMaxTexturesInShader, getWebGLDisjointQueryTimerVersion, getWebGLMaxTextureSize, isCapableOfRenderingToFloatTexture, isDownloadFloatTextureEnabled, isWebGLFenceEnabled, isWebGLVersionEnabled} from './webgl_util';\n\nconst ENV = env();\n\n/**\n * This file contains WebGL-specific flag registrations.\n */\n\n/**\n * True if WebGL is supported.\n */\nENV.registerFlag('HAS_WEBGL', () => ENV.getNumber('WEBGL_VERSION') > 0);\n\n/** 0: No WebGL, 1: WebGL 1.0, 2: WebGL 2.0. */\nENV.registerFlag('WEBGL_VERSION', () => {\n if (isWebGLVersionEnabled(2)) {\n return 2;\n } else if (isWebGLVersionEnabled(1)) {\n return 1;\n }\n return 0;\n});\n\n/** Whether to check for numerical representation problems. */\nENV.registerFlag('WEBGL_CHECK_NUMERICAL_PROBLEMS', () => false);\n\nENV.registerFlag(\n 'WEBGL_BUFFER_SUPPORTED', () => ENV.get('WEBGL_VERSION') === 2);\n\n/** Whether the WebGL backend will sometimes forward ops to the CPU. */\nENV.registerFlag('WEBGL_CPU_FORWARD', () => true);\n\n/** Whether the WebGL backend will always use f16 textures for rendering. */\nENV.registerFlag('WEBGL_FORCE_F16_TEXTURES', () => false);\n\n/** Whether to turn all packing related flags on. */\nENV.registerFlag('WEBGL_PACK', () => ENV.getBool('HAS_WEBGL'));\n\n/** Whether we will pack the batchnormalization op. */\nENV.registerFlag('WEBGL_PACK_NORMALIZATION', () => ENV.getBool('WEBGL_PACK'));\n\n/** Whether we will pack the clip op. */\nENV.registerFlag('WEBGL_PACK_CLIP', () => ENV.getBool('WEBGL_PACK'));\n\n/** Whether we will pack the depthwise conv op. */\nENV.registerFlag('WEBGL_PACK_DEPTHWISECONV', () => ENV.getBool('WEBGL_PACK'));\n\n/** Whether we will pack binary ops. */\nENV.registerFlag(\n 'WEBGL_PACK_BINARY_OPERATIONS', () => ENV.getBool('WEBGL_PACK'));\n\n/** Whether we will pack unary ops. */\nENV.registerFlag(\n 'WEBGL_PACK_UNARY_OPERATIONS', () => ENV.getBool('WEBGL_PACK'));\n\n/** Whether we will pack array ops. */\nENV.registerFlag(\n 'WEBGL_PACK_ARRAY_OPERATIONS', () => ENV.getBool('WEBGL_PACK'));\n\n/** Whether we will pack image ops. */\nENV.registerFlag(\n 'WEBGL_PACK_IMAGE_OPERATIONS', () => ENV.getBool('WEBGL_PACK'));\n\n/** Whether we will pack reduce ops. */\nENV.registerFlag('WEBGL_PACK_REDUCE', () => ENV.getBool('WEBGL_PACK'));\n\n/** Whether packed WebGL kernels lazily unpack their outputs. */\nENV.registerFlag('WEBGL_LAZILY_UNPACK', () => ENV.getBool('WEBGL_PACK'));\n\n/** Whether we will use the im2col algorithm to speed up convolutions. */\nENV.registerFlag('WEBGL_CONV_IM2COL', () => ENV.getBool('WEBGL_PACK'));\n\n/** The maximum texture dimension. */\nENV.registerFlag(\n 'WEBGL_MAX_TEXTURE_SIZE',\n () => getWebGLMaxTextureSize(ENV.getNumber('WEBGL_VERSION')));\n\n/** The maximum texture dimension. */\nENV.registerFlag(\n 'WEBGL_MAX_TEXTURES_IN_SHADER',\n () => getMaxTexturesInShader(ENV.getNumber('WEBGL_VERSION')));\n\n/**\n * The disjoint_query_timer extension version.\n * 0: disabled, 1: EXT_disjoint_timer_query, 2:\n * EXT_disjoint_timer_query_webgl2.\n * In Firefox with WebGL 2.0,\n * EXT_disjoint_timer_query_webgl2 is not available, so we must use the\n * WebGL 1.0 extension.\n */\nENV.registerFlag('WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION', () => {\n const webGLVersion = ENV.getNumber('WEBGL_VERSION');\n\n if (webGLVersion === 0) {\n return 0;\n }\n return getWebGLDisjointQueryTimerVersion(webGLVersion);\n});\n\n/**\n * Whether the timer object from the disjoint_query_timer extension gives\n * timing information that is reliable.\n */\nENV.registerFlag(\n 'WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE',\n () => ENV.getNumber('WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION') > 0 &&\n !device_util.isMobile());\n\n/**\n * Whether the device is physically capable of rendering to float32 textures.\n */\nENV.registerFlag(\n 'WEBGL_RENDER_FLOAT32_CAPABLE',\n () => isCapableOfRenderingToFloatTexture(ENV.getNumber('WEBGL_VERSION')));\n\n/**\n * Whether rendering to float32 textures is enabled. If disabled, renders to\n * float16 textures.\n */\nENV.registerFlag('WEBGL_RENDER_FLOAT32_ENABLED', () => {\n return ENV.getBool('WEBGL_FORCE_F16_TEXTURES') ?\n false :\n ENV.getBool('WEBGL_RENDER_FLOAT32_CAPABLE');\n});\n\n/**\n * Whether downloading float textures is enabled (16 or 32 bit). If disabled,\n * uses IEEE 754 encoding of the float32 values to 4 uint8 when downloading.\n */\nENV.registerFlag(\n 'WEBGL_DOWNLOAD_FLOAT_ENABLED',\n () => isDownloadFloatTextureEnabled(ENV.getNumber('WEBGL_VERSION')));\n\n/** Whether the fence API is available. */\nENV.registerFlag(\n 'WEBGL_FENCE_API_ENABLED',\n () => isWebGLFenceEnabled(ENV.getNumber('WEBGL_VERSION')));\n\n/**\n * Tensors with size <= than this will be uploaded as uniforms, not textures.\n */\nENV.registerFlag('WEBGL_SIZE_UPLOAD_UNIFORM', () => {\n // Use uniform uploads only when 32bit floats are supported. In\n // 16bit\n // environments there are problems with comparing a 16bit texture value\n // with a 32bit uniform value.\n const useUniforms = ENV.getBool('WEBGL_RENDER_FLOAT32_ENABLED');\n return useUniforms ? 4 : 0;\n});\n\n/**\n * If the total number of bytes allocated on the GPU is greater than this\n * number, we will aggressively delete textures upon disposal with\n * gl.deleteMatrixTexture, rather than making them available for reuse.\n *\n * Default value -1 indicates that we will never aggressively delete textures.\n */\nENV.registerFlag(\n 'WEBGL_DELETE_TEXTURE_THRESHOLD',\n () => {\n return -1;\n },\n threshold => {\n if (threshold < 0 && threshold !== -1) {\n throw new Error(\n `WEBGL_DELETE_TEXTURE_THRESHOLD must be -1 (indicating never ` +\n `delete) or at least 0, but got ${threshold}.`);\n }\n });\n\n/**\n * Trigger a manual GL command flush if the threshold of time has passed since\n * previous Kernel execution. This can be useful for Andorid device where GL\n * command flush are delayed un til the end of javascript task. This value is\n * measured in millisecond. Typically you want to set this value to close to 1.\n *\n * Default value 1 for mobile chrome, and -1 for rest cases. -1 indicates that\n * we will not enforce manual flush and depend on system default flush schedule.\n */\nENV.registerFlag(\n 'WEBGL_FLUSH_THRESHOLD',\n () => {\n return device_util.isMobile() ? 1 : -1;\n },\n threshold => {\n if (threshold < 0 && threshold !== -1) {\n throw new Error(\n `WEBGL_FLUSH_THRESHOLD must be -1 (indicating never ` +\n `manual flush) or at least 0, but got ${threshold}.`);\n }\n });\n\n/**\n * Threshold for input tensor size that determines whether WebGL backend will\n * delegate computation to CPU.\n *\n * Default value is 128.\n */\nENV.registerFlag('CPU_HANDOFF_SIZE_THRESHOLD', () => 128);\n\n/** Whether we will use shapes uniforms. */\nENV.registerFlag('WEBGL_USE_SHAPES_UNIFORMS', () => false);\n\n/**\n * Threshold for last dimension of input tensor that determines whether\n * WebGL backend for the Top K op will delegate computation to CPU. If input\n * is smaller than threshold then CPU will be used\n *\n * Default value is 100000.\n */\nENV.registerFlag('TOPK_LAST_DIM_CPU_HANDOFF_SIZE_THRESHOLD', () => 100000);\n\n/**\n * Threshold for K that determines whether\n * WebGL backend for the Top K op will delegate computation to CPU. If k\n * is larger than threshold then CPU will be used\n *\n * Default value is 128.\n */\nENV.registerFlag('TOPK_K_CPU_HANDOFF_THRESHOLD', () => 128);\n\n/** Whether we will use the experimental conv op. */\nENV.registerFlag('WEBGL_EXP_CONV', () => false);\n\n/**\n * If the device performance is low or if no hardware GPU is available, whether\n * software WebGL will be used.\n */\nENV.registerFlag('SOFTWARE_WEBGL_ENABLED', () => ENV.getBool('IS_TEST'));\n\n/**\n * For narrow texture (physical height or physical width is 1), if the length of\n * any texture edges exceed the threshold, the texture will be reshaped to be\n * more squarish.\n *\n * This flag is used to help some GPUs that could not provide correct\n * interpolations for long skinny triangles. We found Mali GPU probably has this\n * problem: https://github.com/tensorflow/tfjs/issues/6775.\n */\nENV.registerFlag('WEBGL_MAX_SIZE_FOR_NARROW_TEXTURE', () => Infinity);\n\n/**\n * If the flag is set to true, the max size of the narrow texture will be auto\n * computed and it will be considerred as a threshold to reshape the narrow\n * texture to be more squarish.\n *\n * This flag is used to help some GPUs that could not provide correct\n * interpolations for long skinny triangles. We found Mali GPU probably has this\n * problem: https://github.com/tensorflow/tfjs/issues/6775.\n */\nENV.registerFlag('WEBGL_AUTO_SQUARIFY_NARROW_TEXTURE_SHAPE', () => false);\n\n/**\n * Whether to use the customized isnan. It's only useful for webgl2 since webgl1\n * doesn't have the builtin isnan.\n */\nENV.registerFlag('WEBGL2_ISNAN_CUSTOM', () => false);\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {env} from '@tensorflow/tfjs-core';\n\nexport type GLSL = {\n version: string,\n attribute: string,\n varyingVs: string,\n varyingFs: string,\n texture2D: string,\n output: string,\n defineOutput: string,\n defineSpecialNaN: string,\n defineSpecialInf: string,\n defineRound: string\n};\n\nexport function getGlslDifferences(): GLSL {\n let version: string;\n let attribute: string;\n let varyingVs: string;\n let varyingFs: string;\n let texture2D: string;\n let output: string;\n let defineOutput: string;\n let defineSpecialNaN: string;\n let defineSpecialInf: string;\n let defineRound: string;\n\n if (env().getNumber('WEBGL_VERSION') === 2) {\n version = '#version 300 es';\n attribute = 'in';\n varyingVs = 'out';\n varyingFs = 'in';\n texture2D = 'texture';\n output = 'outputColor';\n defineOutput = 'out vec4 outputColor;';\n\n // Use custom isnan definition to work across differences between\n // implementations on various platforms. While this should happen in ANGLE\n // we still see differences between android and windows (on chrome) when\n // using isnan directly. Since WebGL2 supports uint type and\n // floatBitsToUinT built-in function, we could implment isnan following\n // IEEE 754 rules.\n // NaN defination in IEEE 754-1985 is :\n // - sign = either 0 or 1.\n // - biased exponent = all 1 bits.\n // - fraction = anything except all 0 bits (since all 0 bits represents\n // infinity).\n // https://en.wikipedia.org/wiki/IEEE_754-1985#Representation_of_non-numbers\n defineSpecialNaN = env().getBool('WEBGL2_ISNAN_CUSTOM') ? `\n bool isnan_custom(float val) {\n uint floatToUint = floatBitsToUint(val);\n return (floatToUint & 0x7fffffffu) > 0x7f800000u;\n }\n\n bvec4 isnan_custom(vec4 val) {\n return bvec4(isnan_custom(val.x),\n isnan_custom(val.y), isnan_custom(val.z), isnan_custom(val.w));\n }\n\n #define isnan(value) isnan_custom(value)\n ` :\n '';\n // In webgl 2 we do not need to specify a custom isinf so there is no\n // need for a special INFINITY constant.\n defineSpecialInf = ``;\n defineRound = `\n #define round(value) newRound(value)\n int newRound(float value) {\n return int(floor(value + 0.5));\n }\n\n ivec4 newRound(vec4 value) {\n return ivec4(floor(value + vec4(0.5)));\n }\n `;\n } else {\n version = '';\n attribute = 'attribute';\n varyingVs = 'varying';\n varyingFs = 'varying';\n texture2D = 'texture2D';\n output = 'gl_FragColor';\n defineOutput = '';\n // WebGL1 has no built in isnan so we define one here.\n defineSpecialNaN = `\n #define isnan(value) isnan_custom(value)\n bool isnan_custom(float val) {\n return (val > 0. || val < 1. || val == 0.) ? false : true;\n }\n bvec4 isnan_custom(vec4 val) {\n return bvec4(isnan(val.x), isnan(val.y), isnan(val.z), isnan(val.w));\n }\n `;\n defineSpecialInf = `\n uniform float INFINITY;\n\n bool isinf(float val) {\n return abs(val) == INFINITY;\n }\n bvec4 isinf(vec4 val) {\n return equal(abs(val), vec4(INFINITY));\n }\n `;\n defineRound = `\n int round(float value) {\n return int(floor(value + 0.5));\n }\n\n ivec4 round(vec4 value) {\n return ivec4(floor(value + vec4(0.5)));\n }\n `;\n }\n\n return {\n version,\n attribute,\n varyingVs,\n varyingFs,\n texture2D,\n output,\n defineOutput,\n defineSpecialNaN,\n defineSpecialInf,\n defineRound\n };\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {util} from '@tensorflow/tfjs-core';\n\n/**\n * Produces GLSL code that derives logical coordinates from a flat\n * index. The code performs integer division with each stride and decrements\n * the index until the index equals the final dimension coordinate.\n */\nexport function getLogicalCoordinatesFromFlatIndex(\n coords: string[], shape: number[], index = 'index'): string {\n const strides = util.computeStrides(shape);\n return strides\n .map((stride, i) => {\n const line1 = `int ${coords[i]} = ${index} / ${stride}`;\n const line2 = i === strides.length - 1 ?\n `int ${coords[i + 1]} = ${index} - ${coords[i]} * ${stride}` :\n `index -= ${coords[i]} * ${stride}`;\n return `${line1}; ${line2};`;\n })\n .join('');\n}\n\nexport function getOutputLogicalCoordinatesFromFlatIndexByUniform(\n coords: string[], shape: number[], index = 'index'): string {\n const strides = util.computeStrides(shape);\n return strides\n .map((_, i) => {\n const line1 = `int ${coords[i]} = ${index} / outShapeStrides[${i}]`;\n const line2 = i === strides.length - 1 ?\n `int ${coords[i + 1]} = ${index} - ${coords[i]} * outShapeStrides[${\n i}]` :\n `index -= ${coords[i]} * outShapeStrides[${i}]`;\n return `${line1}; ${line2};`;\n })\n .join('');\n}\n\n// Produces GLSL code that computes strides.\nfunction symbolicallyComputeStrides(\n indicesArr: number[], variableName: string): string[] {\n const numCoords = indicesArr.length;\n const shape = indicesArr.map(d => `${variableName}[${d}]`);\n const strides = new Array(numCoords - 1);\n strides[numCoords - 2] = shape[numCoords - 1];\n for (let i = numCoords - 3; i >= 0; --i) {\n strides[i] = `(${strides[i + 1]} * ${shape[i + 1]})`;\n }\n\n return strides;\n}\n\nexport function getLogicalCoordinatesFromFlatIndexByUniform(\n coords: string[], variableName: string, index = 'index'): string {\n const indicesArray = coords.map((_, i) => i);\n const strides = symbolicallyComputeStrides(indicesArray, variableName);\n return strides\n .map((_, i) => {\n const line1 = `int ${coords[i]} = ${index} / ${strides[i]}`;\n const line2 = i === strides.length - 1 ?\n `int ${coords[i + 1]} = ${index} - ${coords[i]} * ${strides[i]}` :\n `index -= ${coords[i]} * ${strides[i]}`;\n return `${line1}; ${line2};`;\n })\n .join('');\n}\n\nfunction buildVec(x: string[]): string {\n if (x.length === 1) {\n return `${x[0]}`;\n }\n return `vec${x.length}(${x.join(',')})`;\n}\n\n/**\n * Produces GLSL code that computes the dot product of the input x and y\n * vectors. Handles splitting inputs into increments of vec4s when necessary.\n */\nexport function dotify(x: string[], y: string[]): string {\n if (x.length !== y.length) {\n throw new Error(\n `Vectors to be dotted must be of the same length -` +\n `got ${x.length} and ${y.length}`);\n }\n\n const slices: string[] = [];\n const nearestVec4 = Math.floor(x.length / 4);\n const nearestVec4Remainder = x.length % 4;\n\n for (let i = 0; i < nearestVec4; i++) {\n const xSlice = x.slice(i * 4, i * 4 + 4);\n const ySlice = y.slice(i * 4, i * 4 + 4);\n slices.push(`${buildVec(xSlice)}, ${buildVec(ySlice)}`);\n }\n\n if (nearestVec4Remainder !== 0) {\n let xSlice = x.slice(nearestVec4 * 4);\n let ySlice = y.slice(nearestVec4 * 4);\n if (xSlice.length === 1) {\n xSlice = xSlice.map(d => `float(${d})`);\n ySlice = ySlice.map(d => `float(${d})`);\n }\n slices.push(`${buildVec(xSlice)}, ${buildVec(ySlice)}`);\n }\n\n return slices.map((d, i) => `dot(${d})`).join('+');\n}\n\n/**\n * Produces GLSL that computes the flat index from 3D coordinates.\n */\nexport function getFlatIndexFrom3D(shape: [number, number, number]): string {\n const strides = util.computeStrides(shape).map(d => d.toString());\n\n return `\n int getFlatIndex(ivec3 coords) {\n return coords.x * ${strides[0]} + coords.y * ${strides[1]} + coords.z;\n }\n`;\n}\n\nexport function getFlatIndexFrom3DOutput(): string {\n return `\n int getFlatIndex(ivec3 coords) {\n return coords.x * outShapeStrides[0] + coords.y * outShapeStrides[1] + coords.z;\n }\n`;\n}\n\nexport const ENCODE_FLOAT_SNIPPET = `\n const float FLOAT_MAX = 1.70141184e38;\n const float FLOAT_MIN = 1.17549435e-38;\n\n lowp vec4 encode_float(highp float v) {\n if (isnan(v)) {\n return vec4(255, 255, 255, 255);\n }\n\n highp float av = abs(v);\n\n if(av < FLOAT_MIN) {\n return vec4(0.0, 0.0, 0.0, 0.0);\n } else if(v > FLOAT_MAX) {\n return vec4(0.0, 0.0, 128.0, 127.0) / 255.0;\n } else if(v < -FLOAT_MAX) {\n return vec4(0.0, 0.0, 128.0, 255.0) / 255.0;\n }\n\n highp vec4 c = vec4(0,0,0,0);\n\n highp float e = floor(log2(av));\n highp float m = exp2(fract(log2(av))) - 1.0;\n\n c[2] = floor(128.0 * m);\n m -= c[2] / 128.0;\n c[1] = floor(32768.0 * m);\n m -= c[1] / 32768.0;\n c[0] = floor(8388608.0 * m);\n\n highp float ebias = e + 127.0;\n c[3] = floor(ebias / 2.0);\n ebias -= c[3] * 2.0;\n c[2] += floor(ebias) * 128.0;\n\n c[3] += 128.0 * step(0.0, -v);\n\n return c / 255.0;\n }\n`;\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// Please make sure the shaker key in makeShaderKey in gpgpu_math.ts is well\n// mapped if any shader source code is changed in this file.\n\nimport {backend_util, util} from '@tensorflow/tfjs-core';\nconst {getBroadcastDims} = backend_util;\nimport {getGlslDifferences, GLSL} from './glsl_version';\nimport * as shader_util from './shader_compiler_util';\n\nexport type ShapeInfo = {\n logicalShape: number[],\n texShape: [number, number],\n isUniform: boolean,\n isPacked: boolean,\n flatOffset: number\n};\n\nexport type InputInfo = {\n name: string,\n shapeInfo: ShapeInfo\n};\n\nexport type UniformType =\n 'float'|'vec2'|'vec3'|'vec4'|'int'|'ivec2'|'ivec3'|'ivec4';\n\ninterface ProgramParams {\n userCode: string;\n enableShapeUniforms?: boolean;\n packedInputs?: boolean;\n customUniforms?:\n Array<{name: string; arrayIndex?: number; type: UniformType;}>;\n}\n\nexport function makeShader(\n inputsInfo: InputInfo[], outputShape: ShapeInfo,\n program: ProgramParams): string {\n const prefixSnippets: string[] = [];\n inputsInfo.forEach(x => {\n const size = util.sizeFromShape(x.shapeInfo.logicalShape);\n\n // Snippet when we decided to upload the values as uniform.\n if (x.shapeInfo.isUniform) {\n prefixSnippets.push(\n `uniform float ${x.name}${size > 1 ? `[${size}]` : ''};`);\n } else {\n prefixSnippets.push(`uniform sampler2D ${x.name};`);\n prefixSnippets.push(`uniform int offset${x.name};`);\n }\n\n if (program.enableShapeUniforms) {\n const {uniformShape} = getUniformInfoFromShape(\n program.packedInputs, x.shapeInfo.logicalShape, x.shapeInfo.texShape);\n switch (uniformShape.length) {\n case 1:\n prefixSnippets.push(`uniform int ${x.name}Shape;`);\n break;\n case 2:\n prefixSnippets.push(`uniform ivec2 ${x.name}Shape;`);\n break;\n case 3:\n prefixSnippets.push(`uniform ivec3 ${x.name}Shape;`);\n break;\n case 4:\n prefixSnippets.push(`uniform ivec4 ${x.name}Shape;`);\n break;\n default:\n break;\n }\n prefixSnippets.push(`uniform ivec2 ${x.name}TexShape;`);\n }\n });\n\n if (program.enableShapeUniforms) {\n switch (outputShape.logicalShape.length) {\n case 1:\n prefixSnippets.push(`uniform int outShape;`);\n break;\n case 2:\n prefixSnippets.push(`uniform ivec2 outShape;`);\n prefixSnippets.push(`uniform int outShapeStrides;`);\n break;\n case 3:\n prefixSnippets.push(`uniform ivec3 outShape;`);\n prefixSnippets.push(`uniform ivec2 outShapeStrides;`);\n break;\n case 4:\n prefixSnippets.push(`uniform ivec4 outShape;`);\n prefixSnippets.push(`uniform ivec3 outShapeStrides;`);\n break;\n default:\n break;\n }\n prefixSnippets.push(`uniform ivec2 outTexShape;`);\n }\n if (program.customUniforms) {\n program.customUniforms.forEach((d) => {\n prefixSnippets.push(`uniform ${d.type} ${d.name}${\n d.arrayIndex ? `[${d.arrayIndex}]` : ''};`);\n });\n }\n const inputPrefixSnippet = prefixSnippets.join('\\n');\n\n const inputSamplingSnippet = inputsInfo\n .map(\n x => getInputSamplingSnippet(\n x, outputShape, program.packedInputs,\n program.enableShapeUniforms))\n .join('\\n');\n const outTexShape = outputShape.texShape;\n const glsl = getGlslDifferences();\n const floatTextureSampleSnippet = getFloatTextureSampleSnippet(glsl);\n let outputSamplingSnippet: string;\n let floatTextureSetOutputSnippet: string;\n let shaderPrefix = getShaderPrefix(glsl);\n\n if (outputShape.isPacked) {\n outputSamplingSnippet = getPackedOutputSamplingSnippet(\n outputShape.logicalShape, outTexShape, program.enableShapeUniforms);\n floatTextureSetOutputSnippet = getFloatTextureSetRGBASnippet(glsl);\n } else {\n outputSamplingSnippet = getOutputSamplingSnippet(\n outputShape.logicalShape, outTexShape, program.enableShapeUniforms);\n floatTextureSetOutputSnippet = getFloatTextureSetRSnippet(glsl);\n }\n\n if (program.packedInputs) {\n shaderPrefix += SHADER_PACKED_PREFIX;\n }\n\n const source = [\n shaderPrefix, floatTextureSampleSnippet, floatTextureSetOutputSnippet,\n inputPrefixSnippet, outputSamplingSnippet, inputSamplingSnippet,\n program.userCode\n ].join('\\n');\n return source;\n}\n\nfunction getSamplerFromInInfo(\n inInfo: InputInfo, enableShapeUniforms = false): string {\n const shape = inInfo.shapeInfo.logicalShape;\n switch (shape.length) {\n case 0:\n return getSamplerScalar(inInfo, enableShapeUniforms);\n case 1:\n return getSampler1D(inInfo, enableShapeUniforms);\n case 2:\n return getSampler2D(inInfo, enableShapeUniforms);\n case 3:\n return getSampler3D(inInfo, enableShapeUniforms);\n case 4:\n return getSampler4D(inInfo, enableShapeUniforms);\n case 5:\n return getSampler5D(inInfo);\n case 6:\n return getSampler6D(inInfo);\n default:\n throw new Error(\n `${shape.length}-D input sampling` +\n ` is not yet supported`);\n }\n}\n\nfunction getPackedSamplerFromInInfo(\n inInfo: InputInfo, enableShapeUniforms: boolean): string {\n const shape = inInfo.shapeInfo.logicalShape;\n switch (shape.length) {\n case 0:\n return getPackedSamplerScalar(inInfo);\n case 1:\n return getPackedSampler1D(inInfo, enableShapeUniforms);\n case 2:\n return getPackedSampler2D(inInfo, enableShapeUniforms);\n case 3:\n return getPackedSampler3D(inInfo, enableShapeUniforms);\n default:\n return getPackedSamplerND(inInfo, enableShapeUniforms);\n }\n}\n\nfunction getInputSamplingSnippet(\n inInfo: InputInfo, outShapeInfo: ShapeInfo, usesPackedTextures = false,\n enableShapeUniforms: boolean): string {\n let res = '';\n if (usesPackedTextures) {\n res += getPackedSamplerFromInInfo(inInfo, enableShapeUniforms);\n } else {\n res += getSamplerFromInInfo(inInfo, enableShapeUniforms);\n }\n\n const inShape = inInfo.shapeInfo.logicalShape;\n const outShape = outShapeInfo.logicalShape;\n if (inShape.length <= outShape.length) {\n if (usesPackedTextures) {\n res += getPackedSamplerAtOutputCoords(inInfo, outShapeInfo);\n } else {\n res += getSamplerAtOutputCoords(inInfo, outShapeInfo);\n }\n }\n return res;\n}\n\nfunction getPackedOutputSamplingSnippet(\n outShape: number[], outTexShape: [number, number],\n enableShapeUniforms: boolean): string {\n switch (outShape.length) {\n case 0:\n return getOutputScalarCoords();\n case 1:\n return getOutputPacked1DCoords(\n outShape as [number], outTexShape, enableShapeUniforms);\n case 2:\n return getOutputPacked2DCoords(\n outShape as [number, number], outTexShape, enableShapeUniforms);\n case 3:\n return getOutputPacked3DCoords(\n outShape as [number, number, number], outTexShape,\n enableShapeUniforms);\n default:\n return getOutputPackedNDCoords(\n outShape, outTexShape, enableShapeUniforms);\n }\n}\n\nfunction getOutputSamplingSnippet(\n outShape: number[], outTexShape: [number, number],\n enableShapeUniforms: boolean): string {\n switch (outShape.length) {\n case 0:\n return getOutputScalarCoords();\n case 1:\n return getOutput1DCoords(\n outShape as [number], outTexShape, enableShapeUniforms);\n case 2:\n return getOutput2DCoords(\n outShape as [number, number], outTexShape, enableShapeUniforms);\n case 3:\n return getOutput3DCoords(\n outShape as [number, number, number], outTexShape,\n enableShapeUniforms);\n case 4:\n return getOutput4DCoords(\n outShape as [number, number, number, number], outTexShape,\n enableShapeUniforms);\n case 5:\n return getOutput5DCoords(\n outShape as [number, number, number, number, number], outTexShape);\n case 6:\n return getOutput6DCoords(\n outShape as [number, number, number, number, number, number],\n outTexShape);\n default:\n throw new Error(\n `${outShape.length}-D output sampling is not yet supported`);\n }\n}\n\nfunction getFloatTextureSampleSnippet(glsl: GLSL): string {\n return `\n float sampleTexture(sampler2D textureSampler, vec2 uv) {\n return ${glsl.texture2D}(textureSampler, uv).r;\n }\n `;\n}\n\nfunction getFloatTextureSetRSnippet(glsl: GLSL): string {\n return `\n void setOutput(float val) {\n ${glsl.output} = vec4(val, 0, 0, 0);\n }\n `;\n}\n\nfunction getFloatTextureSetRGBASnippet(glsl: GLSL): string {\n return `\n void setOutput(vec4 val) {\n ${glsl.output} = val;\n }\n `;\n}\n\nfunction getShaderPrefix(glsl: GLSL): string {\n const SHADER_PREFIX = `${glsl.version}\n precision highp float;\n precision highp int;\n precision highp sampler2D;\n ${glsl.varyingFs} vec2 resultUV;\n ${glsl.defineOutput}\n const vec2 halfCR = vec2(0.5, 0.5);\n\n struct ivec5\n {\n int x;\n int y;\n int z;\n int w;\n int u;\n };\n\n struct ivec6\n {\n int x;\n int y;\n int z;\n int w;\n int u;\n int v;\n };\n\n uniform float NAN;\n ${glsl.defineSpecialNaN}\n ${glsl.defineSpecialInf}\n ${glsl.defineRound}\n\n int imod(int x, int y) {\n return x - y * (x / y);\n }\n\n int idiv(int a, int b, float sign) {\n int res = a / b;\n int mod = imod(a, b);\n if (sign < 0. && mod != 0) {\n res -= 1;\n }\n return res;\n }\n\n //Based on the work of Dave Hoskins\n //https://www.shadertoy.com/view/4djSRW\n #define HASHSCALE1 443.8975\n float random(float seed){\n vec2 p = resultUV * seed;\n vec3 p3 = fract(vec3(p.xyx) * HASHSCALE1);\n p3 += dot(p3, p3.yzx + 19.19);\n return fract((p3.x + p3.y) * p3.z);\n }\n\n ${SAMPLE_1D_SNIPPET}\n ${SAMPLE_2D_SNIPPET}\n ${SAMPLE_3D_SNIPPET}\n `;\n\n return SHADER_PREFIX;\n}\n\nconst SAMPLE_1D_SNIPPET = `\nvec2 uvFromFlat(int texNumR, int texNumC, int index) {\n int texR = index / texNumC;\n int texC = index - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\nvec2 packedUVfrom1D(int texNumR, int texNumC, int index) {\n int texelIndex = index / 2;\n int texR = texelIndex / texNumC;\n int texC = texelIndex - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n`;\n\nconst SAMPLE_2D_SNIPPET = `\nvec2 packedUVfrom2D(int texelsInLogicalRow, int texNumR,\n int texNumC, int row, int col) {\n int texelIndex = (row / 2) * texelsInLogicalRow + (col / 2);\n int texR = texelIndex / texNumC;\n int texC = texelIndex - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n`;\n\nconst SAMPLE_3D_SNIPPET = `\nvec2 packedUVfrom3D(int texNumR, int texNumC,\n int texelsInBatch, int texelsInLogicalRow, int b,\n int row, int col) {\n int index = b * texelsInBatch + (row / 2) * texelsInLogicalRow + (col / 2);\n int texR = index / texNumC;\n int texC = index - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n`;\n\nconst SHADER_PACKED_PREFIX = `\n float getChannel(vec4 frag, vec2 innerDims) {\n vec2 modCoord = mod(innerDims, 2.);\n return modCoord.x == 0. ?\n (modCoord.y == 0. ? frag.r : frag.g) :\n (modCoord.y == 0. ? frag.b : frag.a);\n }\n float getChannel(vec4 frag, int dim) {\n float modCoord = mod(float(dim), 2.);\n return modCoord == 0. ? frag.r : frag.g;\n }\n`;\n\nfunction getOutputScalarCoords() {\n return `\n int getOutputCoords() {\n return 0;\n }\n `;\n}\n\nfunction getOutputPacked1DCoords(\n shape: [number], texShape: [number, number],\n enableShapeUniforms: boolean): string {\n const packedTexShape =\n [Math.ceil(texShape[0] / 2), Math.ceil(texShape[1] / 2)];\n if (packedTexShape[0] === 1) {\n if (enableShapeUniforms) {\n return `\n int getOutputCoords() {\n return 2 * int(resultUV.x * ceil(float(outTexShape[1]) / 2.0));\n }\n `;\n }\n\n return `\n int getOutputCoords() {\n return 2 * int(resultUV.x * ${packedTexShape[1]}.0);\n }\n `;\n }\n\n if (packedTexShape[1] === 1) {\n if (enableShapeUniforms) {\n return `\n int getOutputCoords() {\n return 2 * int(resultUV.y * ceil(float(outTexShape[0]) / 2.0));\n }\n `;\n }\n\n return `\n int getOutputCoords() {\n return 2 * int(resultUV.y * ${packedTexShape[0]}.0);\n }\n `;\n }\n\n if (enableShapeUniforms) {\n return `\n int getOutputCoords() {\n ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(packedTexShape[0], packedTexShape[1]));\n return 2 * (resTexRC.x * packedTexShape[1] + resTexRC.y);\n }\n `;\n }\n\n return `\n int getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${packedTexShape[0]}, ${packedTexShape[1]}));\n return 2 * (resTexRC.x * ${packedTexShape[1]} + resTexRC.y);\n }\n `;\n}\n\nfunction getOutput1DCoords(\n shape: [number], texShape: [number, number],\n enableShapeUniforms: boolean): string {\n if (texShape[0] === 1) {\n if (enableShapeUniforms) {\n return `\n int getOutputCoords() {\n return int(resultUV.x * float(outTexShape[1]));\n }\n `;\n }\n return `\n int getOutputCoords() {\n return int(resultUV.x * ${texShape[1]}.0);\n }\n `;\n }\n if (texShape[1] === 1) {\n if (enableShapeUniforms) {\n return `\n int getOutputCoords() {\n return int(resultUV.y * float(outTexShape[0]));\n }\n `;\n }\n return `\n int getOutputCoords() {\n return int(resultUV.y * ${texShape[0]}.0);\n }\n `;\n }\n if (enableShapeUniforms) {\n return `\n int getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(outTexShape[0], outTexShape[1]));\n return resTexRC.x * outTexShape[1] + resTexRC.y;\n }\n `;\n }\n return `\n int getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${texShape[0]}, ${texShape[1]}));\n return resTexRC.x * ${texShape[1]} + resTexRC.y;\n }\n `;\n}\n\nfunction getOutputPacked3DCoords(\n shape: [number, number, number], texShape: [number, number],\n enableShapeUniforms: boolean): string {\n if (enableShapeUniforms) {\n return `\n ivec3 getOutputCoords() {\n ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));\n int texelsInLogicalRow = int(ceil(float(outShape[2]) / 2.0));\n int texelsInBatch = texelsInLogicalRow * int(ceil(float(outShape[1]) / 2.0));\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(packedTexShape[0], packedTexShape[1]));\n int index = resTexRC.x * packedTexShape[1] + resTexRC.y;\n\n int b = index / texelsInBatch;\n index -= b * texelsInBatch;\n\n int r = 2 * (index / texelsInLogicalRow);\n int c = imod(index, texelsInLogicalRow) * 2;\n\n return ivec3(b, r, c);\n }\n `;\n }\n\n const packedTexShape =\n [Math.ceil(texShape[0] / 2), Math.ceil(texShape[1] / 2)];\n const texelsInLogicalRow = Math.ceil(shape[2] / 2);\n const texelsInBatch = texelsInLogicalRow * Math.ceil(shape[1] / 2);\n\n return `\n ivec3 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${packedTexShape[0]}, ${packedTexShape[1]}));\n int index = resTexRC.x * ${packedTexShape[1]} + resTexRC.y;\n\n int b = index / ${texelsInBatch};\n index -= b * ${texelsInBatch};\n\n int r = 2 * (index / ${texelsInLogicalRow});\n int c = imod(index, ${texelsInLogicalRow}) * 2;\n\n return ivec3(b, r, c);\n }\n `;\n}\n\nfunction getOutput3DCoords(\n shape: [number, number, number], texShape: [number, number],\n enableShapeUniforms: boolean): string {\n if (enableShapeUniforms) {\n const coordsFromIndexSnippet =\n shader_util.getOutputLogicalCoordinatesFromFlatIndexByUniform(\n ['r', 'c', 'd'], shape);\n\n return `\n ivec3 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(outTexShape[0], outTexShape[1]));\n int index = resTexRC.x * outTexShape[1] + resTexRC.y;\n ${coordsFromIndexSnippet}\n return ivec3(r, c, d);\n }\n`;\n }\n const coordsFromIndexSnippet =\n shader_util.getLogicalCoordinatesFromFlatIndex(['r', 'c', 'd'], shape);\n\n return `\n ivec3 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${texShape[0]}, ${texShape[1]}));\n int index = resTexRC.x * ${texShape[1]} + resTexRC.y;\n ${coordsFromIndexSnippet}\n return ivec3(r, c, d);\n }\n `;\n}\n\nfunction getOutputPackedNDCoords(\n shape: number[], texShape: [number, number],\n enableShapeUniforms: boolean): string {\n if (enableShapeUniforms) {\n // TODO: support 5d and 6d\n return `\n ivec4 getOutputCoords() {\n ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(packedTexShape[0], packedTexShape[1]));\n int index = resTexRC.x * packedTexShape[1] + resTexRC.y;\n\n int texelsInLogicalRow = int(ceil(float(outShape[3]) / 2.0));\n int texelsInBatch = texelsInLogicalRow * int(ceil(float(outShape[2]) / 2.0));\n int texelsInBatchN = texelsInBatch * outShape[1];\n\n int b2 = index / texelsInBatchN;\n index -= b2 * texelsInBatchN;\n\n int b = index / texelsInBatch;\n index -= b * texelsInBatch;\n\n int r = 2 * (index / texelsInLogicalRow);\n int c = imod(index, texelsInLogicalRow) * 2;\n\n return ivec4(b2, b, r, c);\n }\n `;\n }\n const packedTexShape =\n [Math.ceil(texShape[0] / 2), Math.ceil(texShape[1] / 2)];\n\n const texelsInLogicalRow = Math.ceil(shape[shape.length - 1] / 2);\n const texelsInBatch =\n texelsInLogicalRow * Math.ceil(shape[shape.length - 2] / 2);\n let texelsInBatchN = texelsInBatch;\n let batches = ``;\n let coords = 'b, r, c';\n\n for (let b = 2; b < shape.length - 1; b++) {\n texelsInBatchN *= shape[shape.length - b - 1];\n batches = `\n int b${b} = index / ${texelsInBatchN};\n index -= b${b} * ${texelsInBatchN};\n ` + batches;\n coords = `b${b}, ` + coords;\n }\n\n return `\n ivec${shape.length} getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${packedTexShape[0]}, ${packedTexShape[1]}));\n int index = resTexRC.x * ${packedTexShape[1]} + resTexRC.y;\n\n ${batches}\n\n int b = index / ${texelsInBatch};\n index -= b * ${texelsInBatch};\n\n int r = 2 * (index / ${texelsInLogicalRow});\n int c = imod(index, ${texelsInLogicalRow}) * 2;\n\n return ivec${shape.length}(${coords});\n }\n `;\n}\n\nfunction getOutput4DCoords(\n shape: [number, number, number, number], texShape: [number, number],\n enableShapeUniforms: boolean): string {\n if (enableShapeUniforms) {\n const coordsFromIndexSnippet =\n shader_util.getOutputLogicalCoordinatesFromFlatIndexByUniform(\n ['r', 'c', 'd', 'd2'], shape);\n\n return `\n ivec4 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(outTexShape[0], outTexShape[1]));\n int index = resTexRC.x * outTexShape[1] + resTexRC.y;\n ${coordsFromIndexSnippet}\n return ivec4(r, c, d, d2);\n }\n `;\n }\n const coordsFromIndexSnippet = shader_util.getLogicalCoordinatesFromFlatIndex(\n ['r', 'c', 'd', 'd2'], shape);\n\n return `\n ivec4 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${texShape[0]}, ${texShape[1]}));\n int index = resTexRC.x * ${texShape[1]} + resTexRC.y;\n ${coordsFromIndexSnippet}\n return ivec4(r, c, d, d2);\n }\n `;\n}\n\nfunction getOutput5DCoords(\n shape: [number, number, number, number, number],\n texShape: [number, number]): string {\n const coordsFromIndexSnippet = shader_util.getLogicalCoordinatesFromFlatIndex(\n ['r', 'c', 'd', 'd2', 'd3'], shape);\n\n return `\n ivec5 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx * vec2(${texShape[0]},\n ${texShape[1]}));\n\n int index = resTexRC.x * ${texShape[1]} + resTexRC.y;\n\n ${coordsFromIndexSnippet}\n\n ivec5 outShape = ivec5(r, c, d, d2, d3);\n return outShape;\n }\n `;\n}\n\nfunction getOutput6DCoords(\n shape: [number, number, number, number, number, number],\n texShape: [number, number]): string {\n const coordsFromIndexSnippet = shader_util.getLogicalCoordinatesFromFlatIndex(\n ['r', 'c', 'd', 'd2', 'd3', 'd4'], shape);\n\n return `\n ivec6 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${texShape[0]}, ${texShape[1]}));\n int index = resTexRC.x * ${texShape[1]} + resTexRC.y;\n\n ${coordsFromIndexSnippet}\n\n ivec6 result = ivec6(r, c, d, d2, d3, d4);\n return result;\n }\n `;\n}\n\nfunction getOutputPacked2DCoords(\n shape: [number, number], texShape: [number, number],\n enableShapeUniforms: boolean): string {\n const packedTexShape =\n [Math.ceil(texShape[0] / 2), Math.ceil(texShape[1] / 2)];\n if (util.arraysEqual(shape, texShape)) {\n if (enableShapeUniforms) {\n return `\n ivec2 getOutputCoords() {\n ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));\n return 2 * ivec2(resultUV.yx * vec2(packedTexShape[0], packedTexShape[1]));\n }\n `;\n }\n\n return `\n ivec2 getOutputCoords() {\n return 2 * ivec2(resultUV.yx * vec2(${packedTexShape[0]}, ${\n packedTexShape[1]}));\n }\n `;\n }\n\n // texels needed to accommodate a logical row\n const texelsInLogicalRow = Math.ceil(shape[1] / 2);\n\n /**\n * getOutputCoords\n *\n * resTexRC: The rows and columns of the texels. If you move over one\n * texel to the right in the packed texture, you are moving over one column\n * (not two).\n *\n * index: The texel index\n */\n if (enableShapeUniforms) {\n return `\n ivec2 getOutputCoords() {\n ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));\n int texelsInLogicalRow = int(ceil(float(outShape[1]) / 2.0));\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(packedTexShape[0], packedTexShape[1]));\n\n int index = resTexRC.x * packedTexShape[1] + resTexRC.y;\n int r = 2 * (index / texelsInLogicalRow);\n int c = imod(index, texelsInLogicalRow) * 2;\n\n return ivec2(r, c);\n }\n `;\n }\n\n return `\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${packedTexShape[0]}, ${packedTexShape[1]}));\n\n int index = resTexRC.x * ${packedTexShape[1]} + resTexRC.y;\n int r = 2 * (index / ${texelsInLogicalRow});\n int c = imod(index, ${texelsInLogicalRow}) * 2;\n\n return ivec2(r, c);\n }\n `;\n}\n\nfunction getOutput2DCoords(\n shape: [number, number], texShape: [number, number],\n enableShapeUniforms: boolean): string {\n if (util.arraysEqual(shape, texShape)) {\n if (enableShapeUniforms) {\n return `\n ivec2 getOutputCoords() {\n return ivec2(resultUV.yx * vec2(outTexShape[0], outTexShape[1]));\n }\n `;\n }\n return `\n ivec2 getOutputCoords() {\n return ivec2(resultUV.yx * vec2(${texShape[0]}, ${texShape[1]}));\n }\n `;\n }\n if (shape[1] === 1) {\n if (enableShapeUniforms) {\n return `\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(outTexShape[0], outTexShape[1]));\n int index = resTexRC.x * outTexShape[1] + resTexRC.y;\n return ivec2(index, 0);\n }\n `;\n }\n return `\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${texShape[0]}, ${texShape[1]}));\n int index = resTexRC.x * ${texShape[1]} + resTexRC.y;\n return ivec2(index, 0);\n }\n `;\n }\n if (shape[0] === 1) {\n if (enableShapeUniforms) {\n return `\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(outTexShape[0], outTexShape[1]));\n int index = resTexRC.x * outTexShape[1] + resTexRC.y;\n return ivec2(0, index);\n }\n `;\n }\n return `\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${texShape[0]}, ${texShape[1]}));\n int index = resTexRC.x * ${texShape[1]} + resTexRC.y;\n return ivec2(0, index);\n }\n `;\n }\n if (enableShapeUniforms) {\n return `\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(outTexShape[0], outTexShape[1]));\n int index = resTexRC.x * outTexShape[1] + resTexRC.y;\n int r = index / outShape[1];\n int c = index - r * outShape[1];\n return ivec2(r, c);\n }\n `;\n }\n return `\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${texShape[0]}, ${texShape[1]}));\n int index = resTexRC.x * ${texShape[1]} + resTexRC.y;\n int r = index / ${shape[1]};\n int c = index - r * ${shape[1]};\n return ivec2(r, c);\n }\n `;\n}\n\nfunction getFlatOffsetUniformName(texName: string): string {\n return `offset${texName}`;\n}\n\nfunction getPackedSamplerScalar(inputInfo: InputInfo): string {\n const texName = inputInfo.name;\n const funcName = 'get' + texName.charAt(0).toUpperCase() + texName.slice(1);\n const glsl = getGlslDifferences();\n return `\n vec4 ${funcName}() {\n return ${glsl.texture2D}(${texName}, halfCR);\n }\n `;\n}\n\nfunction getSamplerScalar(\n inputInfo: InputInfo, enableShapeUniforms: boolean): string {\n const texName = inputInfo.name;\n const funcName = 'get' + texName.charAt(0).toUpperCase() + texName.slice(1);\n if (inputInfo.shapeInfo.isUniform) {\n return `float ${funcName}() {return ${texName};}`;\n }\n const [texNumR, texNumC] = inputInfo.shapeInfo.texShape;\n if (texNumR === 1 && texNumC === 1) {\n return `\n float ${funcName}() {\n return sampleTexture(${texName}, halfCR);\n }\n `;\n }\n\n const offset = getFlatOffsetUniformName(texName);\n if (enableShapeUniforms) {\n return `\n float ${funcName}() {\n vec2 uv = uvFromFlat(${texName}TexShape[0], ${texName}TexShape[1], ${\n offset});\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n\n const [tNumR, tNumC] = inputInfo.shapeInfo.texShape;\n return `\n float ${funcName}() {\n vec2 uv = uvFromFlat(${tNumR}, ${tNumC}, ${offset});\n return sampleTexture(${texName}, uv);\n }\n `;\n}\n\nfunction getPackedSampler1D(\n inputInfo: InputInfo, enableShapeUniforms: boolean): string {\n const texName = inputInfo.name;\n const funcName = 'get' + texName.charAt(0).toUpperCase() + texName.slice(1);\n const texShape = inputInfo.shapeInfo.texShape;\n const glsl = getGlslDifferences();\n if (enableShapeUniforms) {\n return `\n vec4 ${funcName}(int index) {\n ivec2 packedTexShape = ivec2(ceil(float(${\n texName}TexShape[0]) / 2.0), ceil(float(${texName}TexShape[1]) / 2.0));\n vec2 uv = packedUVfrom1D(\n packedTexShape[0], packedTexShape[1], index);\n return ${glsl.texture2D}(${texName}, uv);\n }\n `;\n }\n const packedTexShape =\n [Math.ceil(texShape[0] / 2), Math.ceil(texShape[1] / 2)];\n return `\n vec4 ${funcName}(int index) {\n vec2 uv = packedUVfrom1D(\n ${packedTexShape[0]}, ${packedTexShape[1]}, index);\n return ${glsl.texture2D}(${texName}, uv);\n }\n `;\n}\n\nfunction getSampler1D(\n inputInfo: InputInfo, enableShapeUniforms: boolean): string {\n const texName = inputInfo.name;\n const funcName = 'get' + texName.charAt(0).toUpperCase() + texName.slice(1);\n\n if (inputInfo.shapeInfo.isUniform) {\n // Uniform arrays will be less than 65505 (no risk of float16 overflow).\n return `\n float ${funcName}(int index) {\n ${getUniformSampler(inputInfo)}\n }\n `;\n }\n\n const texShape = inputInfo.shapeInfo.texShape;\n const tNumR = texShape[0];\n const tNumC = texShape[1];\n\n if (tNumC === 1 && tNumR === 1) {\n return `\n float ${funcName}(int index) {\n return sampleTexture(${texName}, halfCR);\n }\n `;\n }\n const offset = getFlatOffsetUniformName(texName);\n if (tNumC === 1) {\n if (enableShapeUniforms) {\n return `\n float ${funcName}(int index) {\n vec2 uv = vec2(0.5, (float(index + ${offset}) + 0.5) / float(${\n texName}TexShape[0]));\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n\n return `\n float ${funcName}(int index) {\n vec2 uv = vec2(0.5, (float(index + ${offset}) + 0.5) / ${tNumR}.0);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n if (tNumR === 1) {\n if (enableShapeUniforms) {\n return `\n float ${funcName}(int index) {\n vec2 uv = vec2((float(index + ${offset}) + 0.5) / float(${\n texName}TexShape[1]), 0.5);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n\n return `\n float ${funcName}(int index) {\n vec2 uv = vec2((float(index + ${offset}) + 0.5) / ${tNumC}.0, 0.5);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n\n if (enableShapeUniforms) {\n return `\n float ${funcName}(int index) {\n vec2 uv = uvFromFlat(${texName}TexShape[0], ${\n texName}TexShape[1], index + ${offset});\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n\n return `\n float ${funcName}(int index) {\n vec2 uv = uvFromFlat(${tNumR}, ${tNumC}, index + ${offset});\n return sampleTexture(${texName}, uv);\n }\n `;\n}\n\nfunction getPackedSampler2D(\n inputInfo: InputInfo, enableShapeUniforms: boolean): string {\n const shape = inputInfo.shapeInfo.logicalShape;\n const texName = inputInfo.name;\n const funcName = 'get' + texName.charAt(0).toUpperCase() + texName.slice(1);\n const texShape = inputInfo.shapeInfo.texShape;\n\n const texNumR = texShape[0];\n const texNumC = texShape[1];\n const glsl = getGlslDifferences();\n if (texShape != null && util.arraysEqual(shape, texShape)) {\n if (enableShapeUniforms) {\n return `\n vec4 ${funcName}(int row, int col) {\n vec2 uv = (vec2(col, row) + halfCR) / vec2(${texName}TexShape[1], ${\n texName}TexShape[0]);\n\n return ${glsl.texture2D}(${texName}, uv);\n }\n `;\n }\n return `\n vec4 ${funcName}(int row, int col) {\n vec2 uv = (vec2(col, row) + halfCR) / vec2(${texNumC}.0, ${texNumR}.0);\n\n return ${glsl.texture2D}(${texName}, uv);\n }\n `;\n }\n\n if (enableShapeUniforms) {\n return `\n vec4 ${funcName}(int row, int col) {\n ivec2 packedTexShape = ivec2(ceil(float(${\n texName}TexShape[0]) / 2.0), ceil(float(${texName}TexShape[1]) / 2.0));\n int valuesPerRow = int(ceil(float(${texName}Shape[1]) / 2.0));\n vec2 uv = packedUVfrom2D(valuesPerRow, packedTexShape[0], packedTexShape[1], row, col);\n return ${glsl.texture2D}(${texName}, uv);\n }\n `;\n }\n const packedTexShape =\n [Math.ceil(texShape[0] / 2), Math.ceil(texShape[1] / 2)];\n const valuesPerRow = Math.ceil(shape[1] / 2);\n\n return `\n vec4 ${funcName}(int row, int col) {\n vec2 uv = packedUVfrom2D(${valuesPerRow}, ${packedTexShape[0]}, ${\n packedTexShape[1]}, row, col);\n return ${glsl.texture2D}(${texName}, uv);\n }\n `;\n}\n\nfunction getSampler2D(\n inputInfo: InputInfo, enableShapeUniforms: boolean): string {\n const shape = inputInfo.shapeInfo.logicalShape;\n const texName = inputInfo.name;\n const funcName = 'get' + texName.charAt(0).toUpperCase() + texName.slice(1);\n const texShape = inputInfo.shapeInfo.texShape;\n\n if (texShape != null && util.arraysEqual(shape, texShape)) {\n if (enableShapeUniforms) {\n return `\n float ${funcName}(int row, int col) {\n vec2 uv = (vec2(col, row) + halfCR) / vec2(${texName}TexShape[1], ${\n texName}TexShape[0]);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n\n const texNumR = texShape[0];\n const texNumC = texShape[1];\n return `\n float ${funcName}(int row, int col) {\n vec2 uv = (vec2(col, row) + halfCR) / vec2(${texNumC}.0, ${texNumR}.0);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n\n const {newShape, keptDims} = util.squeezeShape(shape);\n const squeezedShape = newShape;\n if (squeezedShape.length < shape.length) {\n const newInputInfo = squeezeInputInfo(inputInfo, squeezedShape);\n const params = ['row', 'col'];\n return `\n ${getSamplerFromInInfo(newInputInfo, enableShapeUniforms)}\n float ${funcName}(int row, int col) {\n return ${funcName}(${getSqueezedParams(params, keptDims)});\n }\n `;\n }\n\n if (inputInfo.shapeInfo.isUniform) {\n // Uniform arrays will be less than 65505 (no risk of float16 overflow).\n return `\n float ${funcName}(int row, int col) {\n int index = round(dot(vec2(row, col), vec2(${shape[1]}, 1)));\n ${getUniformSampler(inputInfo)}\n }\n `;\n }\n\n const texNumR = texShape[0];\n const texNumC = texShape[1];\n const offset = getFlatOffsetUniformName(texName);\n if (texNumC === 1) {\n // index is used directly as physical (no risk of float16 overflow).\n if (enableShapeUniforms) {\n return `\n float ${funcName}(int row, int col) {\n float index = dot(vec3(row, col, ${offset}), vec3(${\n texName}Shape[1], 1, 1));\n vec2 uv = vec2(0.5, (index + 0.5) / float(${texName}TexShape[0]));\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n return `\n float ${funcName}(int row, int col) {\n float index = dot(vec3(row, col, ${offset}), vec3(${shape[1]}, 1, 1));\n vec2 uv = vec2(0.5, (index + 0.5) / ${texNumR}.0);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n if (texNumR === 1) {\n // index is used directly as physical (no risk of float16 overflow).\n if (enableShapeUniforms) {\n return `\n float ${funcName}(int row, int col) {\n float index = dot(vec3(row, col, ${offset}), vec3(${\n texName}Shape[1], 1, 1));\n vec2 uv = vec2((index + 0.5) / float(${texName}TexShape[1]), 0.5);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n return `\n float ${funcName}(int row, int col) {\n float index = dot(vec3(row, col, ${offset}), vec3(${shape[1]}, 1, 1));\n vec2 uv = vec2((index + 0.5) / ${texNumC}.0, 0.5);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n\n if (enableShapeUniforms) {\n return `\n float ${funcName}(int row, int col) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * ${texName}Shape[1] + col + ${offset};\n vec2 uv = uvFromFlat(${texName}TexShape[0], ${\n texName}TexShape[1], index);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n return `\n float ${funcName}(int row, int col) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * ${shape[1]} + col + ${offset};\n vec2 uv = uvFromFlat(${texNumR}, ${texNumC}, index);\n return sampleTexture(${texName}, uv);\n }\n`;\n}\n\nfunction getPackedSampler3D(\n inputInfo: InputInfo, enableShapeUniforms: boolean): string {\n const shape = inputInfo.shapeInfo.logicalShape;\n const texName = inputInfo.name;\n const funcName = 'get' + texName.charAt(0).toUpperCase() + texName.slice(1);\n const texShape = inputInfo.shapeInfo.texShape;\n const packedTexShape =\n [Math.ceil(texShape[0] / 2), Math.ceil(texShape[1] / 2)];\n\n if (shape[0] === 1) {\n const squeezedShape = shape.slice(1);\n const keptDims = [1, 2];\n const newInputInfo = squeezeInputInfo(inputInfo, squeezedShape);\n const params = ['b', 'row', 'col'];\n return `\n ${getPackedSamplerFromInInfo(newInputInfo, enableShapeUniforms)}\n vec4 ${funcName}(int b, int row, int col) {\n return ${funcName}(${getSqueezedParams(params, keptDims)});\n }\n `;\n }\n\n const glsl = getGlslDifferences();\n if (enableShapeUniforms) {\n return `\n vec4 ${funcName}(int b, int row, int col) {\n ivec2 packedTexShape = ivec2(ceil(float(${\n texName}TexShape[0]) / 2.0), ceil(float(${texName}TexShape[1]) / 2.0));\n int valuesPerRow = int(ceil(float(${texName}Shape[2]) / 2.0));\n int texelsInBatch = valuesPerRow * int(ceil(float(${\n texName}Shape[1]) / 2.0));\n vec2 uv = packedUVfrom3D(\n packedTexShape[0], packedTexShape[1], texelsInBatch, valuesPerRow, b, row, col);\n return ${glsl.texture2D}(${texName}, uv);\n }\n `;\n }\n\n const texNumR = packedTexShape[0];\n const texNumC = packedTexShape[1];\n\n const valuesPerRow = Math.ceil(shape[2] / 2);\n const texelsInBatch = valuesPerRow * Math.ceil(shape[1] / 2);\n\n return `\n vec4 ${funcName}(int b, int row, int col) {\n vec2 uv = packedUVfrom3D(\n ${texNumR}, ${texNumC}, ${texelsInBatch}, ${valuesPerRow}, b, row, col);\n return ${glsl.texture2D}(${texName}, uv);\n }\n `;\n}\n\nfunction getSampler3D(\n inputInfo: InputInfo, enableShapeUniforms: boolean): string {\n const shape = inputInfo.shapeInfo.logicalShape;\n const texName = inputInfo.name;\n const funcName = 'get' + texName.charAt(0).toUpperCase() + texName.slice(1);\n const stride0 = shape[1] * shape[2];\n const stride1 = shape[2];\n\n const {newShape, keptDims} = util.squeezeShape(shape);\n const squeezedShape = newShape;\n if (squeezedShape.length < shape.length) {\n const newInputInfo = squeezeInputInfo(inputInfo, squeezedShape);\n const params = ['row', 'col', 'depth'];\n return `\n ${getSamplerFromInInfo(newInputInfo, enableShapeUniforms)}\n float ${funcName}(int row, int col, int depth) {\n return ${funcName}(${getSqueezedParams(params, keptDims)});\n }\n `;\n }\n\n if (inputInfo.shapeInfo.isUniform) {\n // Uniform arrays will be less than 65505 (no risk of float16 overflow).\n return `\n float ${funcName}(int row, int col, int depth) {\n int index = round(dot(vec3(row, col, depth),\n vec3(${stride0}, ${stride1}, 1)));\n ${getUniformSampler(inputInfo)}\n }\n `;\n }\n\n const texShape = inputInfo.shapeInfo.texShape;\n const texNumR = texShape[0];\n const texNumC = texShape[1];\n const flatOffset = inputInfo.shapeInfo.flatOffset;\n if (texNumC === stride0 && flatOffset == null) {\n // texC is used directly as physical (no risk of float16 overflow).\n if (enableShapeUniforms) {\n return `\n float ${funcName}(int row, int col, int depth) {\n int stride1 = ${texName}Shape[2];\n float texR = float(row);\n float texC = dot(vec2(col, depth), vec2(stride1, 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${texName}TexShape[1], ${texName}TexShape[0]);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n return `\n float ${funcName}(int row, int col, int depth) {\n float texR = float(row);\n float texC = dot(vec2(col, depth), vec2(${stride1}, 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${texNumC}.0, ${texNumR}.0);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n\n if (texNumC === stride1 && flatOffset == null) {\n // texR is used directly as physical (no risk of float16 overflow).\n if (enableShapeUniforms) {\n return `\n float ${funcName}(int row, int col, int depth) {\n float texR = dot(vec2(row, col), vec2(${texName}Shape[1], 1));\n float texC = float(depth);\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2(${texName}TexShape[1], ${\n texName}TexShape[0]);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n return `\n float ${funcName}(int row, int col, int depth) {\n float texR = dot(vec2(row, col), vec2(${shape[1]}, 1));\n float texC = float(depth);\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2(${texNumC}.0, ${texNumR}.0);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n\n const offset = getFlatOffsetUniformName(texName);\n if (enableShapeUniforms) {\n return `\n float ${funcName}(int row, int col, int depth) {\n // Explicitly use integer operations as dot() only works on floats.\n int stride0 = ${texName}Shape[1] * ${texName}Shape[2];\n int stride1 = ${texName}Shape[2];\n int index = row * stride0 + col * stride1 + depth + ${offset};\n vec2 uv = uvFromFlat(${texName}TexShape[0], ${texName}TexShape[1], index);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n return `\n float ${funcName}(int row, int col, int depth) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * ${stride0} + col * ${stride1} + depth + ${offset};\n vec2 uv = uvFromFlat(${texNumR}, ${texNumC}, index);\n return sampleTexture(${texName}, uv);\n }\n `;\n}\n\nfunction getPackedSamplerND(\n inputInfo: InputInfo, enableShapeUniforms: boolean): string {\n const texName = inputInfo.name;\n const funcName = 'get' + texName.charAt(0).toUpperCase() + texName.slice(1);\n const glsl = getGlslDifferences();\n if (enableShapeUniforms) {\n // TODO: support 5d and 6d\n return `\n vec4 ${funcName}(int b2, int b, int row, int col) {\n int valuesPerRow = int(ceil(float(${texName}Shape[3]) / 2.0));\n int texelsInBatch = valuesPerRow * int(ceil(float(${\n texName}Shape[2]) / 2.0));\n int index = b * texelsInBatch + (row / 2) * valuesPerRow + (col / 2);\n texelsInBatch *= ${texName}Shape[1];\n index = b2 * texelsInBatch + index;\n ivec2 packedTexShape = ivec2(ceil(float(${\n texName}TexShape[0]) / 2.0), ceil(float(${texName}TexShape[1]) / 2.0));\n int texR = index / packedTexShape[1];\n int texC = index - texR * packedTexShape[1];\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2(packedTexShape[1], packedTexShape[0]); return ${\n glsl.texture2D}(${texName}, uv);\n }\n `;\n }\n const shape = inputInfo.shapeInfo.logicalShape;\n const rank = shape.length;\n const texShape = inputInfo.shapeInfo.texShape;\n const packedTexShape =\n [Math.ceil(texShape[0] / 2), Math.ceil(texShape[1] / 2)];\n const texNumR = packedTexShape[0];\n const texNumC = packedTexShape[1];\n\n const valuesPerRow = Math.ceil(shape[rank - 1] / 2);\n let texelsInBatch = valuesPerRow * Math.ceil(shape[rank - 2] / 2);\n let params = `int b, int row, int col`;\n let index = `b * ${texelsInBatch} + (row / 2) * ${valuesPerRow} + (col / 2)`;\n for (let b = 2; b < rank - 1; b++) {\n params = `int b${b}, ` + params;\n texelsInBatch *= shape[rank - b - 1];\n index = `b${b} * ${texelsInBatch} + ` + index;\n }\n return `\n vec4 ${funcName}(${params}) {\n int index = ${index};\n int texR = index / ${texNumC};\n int texC = index - texR * ${texNumC};\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2(${texNumC}, ${texNumR});\n return ${glsl.texture2D}(${texName}, uv);\n }\n `;\n}\n\nfunction getSampler4D(\n inputInfo: InputInfo, enableShapeUniforms: boolean): string {\n const shape = inputInfo.shapeInfo.logicalShape;\n const texName = inputInfo.name;\n const funcName = 'get' + texName.charAt(0).toUpperCase() + texName.slice(1);\n const stride2 = shape[3];\n const stride1 = shape[2] * stride2;\n const stride0 = shape[1] * stride1;\n\n const {newShape, keptDims} = util.squeezeShape(shape);\n if (newShape.length < shape.length) {\n const newInputInfo = squeezeInputInfo(inputInfo, newShape);\n const params = ['row', 'col', 'depth', 'depth2'];\n return `\n ${getSamplerFromInInfo(newInputInfo, enableShapeUniforms)}\n float ${funcName}(int row, int col, int depth, int depth2) {\n return ${funcName}(${getSqueezedParams(params, keptDims)});\n }\n `;\n }\n\n if (inputInfo.shapeInfo.isUniform) {\n // Uniform arrays will be less than 65505 (no risk of float16 overflow).\n return `\n float ${funcName}(int row, int col, int depth, int depth2) {\n int index = round(dot(vec4(row, col, depth, depth2),\n vec4(${stride0}, ${stride1}, ${stride2}, 1)));\n ${getUniformSampler(inputInfo)}\n }\n `;\n }\n\n const flatOffset = inputInfo.shapeInfo.flatOffset;\n const texShape = inputInfo.shapeInfo.texShape;\n const texNumR = texShape[0];\n const texNumC = texShape[1];\n\n const stride2Str = `int stride2 = ${texName}Shape[3];`;\n const stride1Str = `int stride1 = ${texName}Shape[2] * stride2;`;\n const stride0Str = `int stride0 = ${texName}Shape[1] * stride1;`;\n if (texNumC === stride0 && flatOffset == null) {\n // texC is used directly as physical (no risk of float16 overflow).\n if (enableShapeUniforms) {\n return `\n float ${funcName}(int row, int col, int depth, int depth2) {\n ${stride2Str}\n ${stride1Str}\n float texR = float(row);\n float texC =\n dot(vec3(col, depth, depth2),\n vec3(stride1, stride2, 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${texName}TexShape[1], ${texName}TexShape[0]);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n return `\n float ${funcName}(int row, int col, int depth, int depth2) {\n float texR = float(row);\n float texC =\n dot(vec3(col, depth, depth2),\n vec3(${stride1}, ${stride2}, 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${texNumC}.0, ${texNumR}.0);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n if (texNumC === stride2 && flatOffset == null) {\n // texR is used directly as physical (no risk of float16 overflow).\n if (enableShapeUniforms) {\n return `\n float ${funcName}(int row, int col, int depth, int depth2) {\n float texR = dot(vec3(row, col, depth),\n vec3(${texName}Shape[1] * ${texName}Shape[2], ${\n texName}Shape[2], 1));\n float texC = float(depth2);\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${texName}TexShape[1], ${texName}TexShape[0]);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n return `\n float ${funcName}(int row, int col, int depth, int depth2) {\n float texR = dot(vec3(row, col, depth),\n vec3(${shape[1] * shape[2]}, ${shape[2]}, 1));\n float texC = float(depth2);\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${texNumC}.0, ${texNumR}.0);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n\n const offset = getFlatOffsetUniformName(texName);\n if (enableShapeUniforms) {\n return `\n float ${funcName}(int row, int col, int depth, int depth2) {\n // Explicitly use integer operations as dot() only works on floats.\n ${stride2Str}\n ${stride1Str}\n ${stride0Str}\n int index = row * stride0 + col * stride1 +\n depth * stride2 + depth2;\n vec2 uv = uvFromFlat(${texName}TexShape[0], ${\n texName}TexShape[1], index + ${offset});\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n return `\n float ${funcName}(int row, int col, int depth, int depth2) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * ${stride0} + col * ${stride1} +\n depth * ${stride2} + depth2;\n vec2 uv = uvFromFlat(${texNumR}, ${texNumC}, index + ${offset});\n return sampleTexture(${texName}, uv);\n }\n `;\n}\n\nfunction getSampler5D(inputInfo: InputInfo): string {\n const shape = inputInfo.shapeInfo.logicalShape;\n const texName = inputInfo.name;\n const funcName = 'get' + texName.charAt(0).toUpperCase() + texName.slice(1);\n const stride3 = shape[4];\n const stride2 = shape[3] * stride3;\n const stride1 = shape[2] * stride2;\n const stride0 = shape[1] * stride1;\n\n const {newShape, keptDims} = util.squeezeShape(shape);\n if (newShape.length < shape.length) {\n const newInputInfo = squeezeInputInfo(inputInfo, newShape);\n const params = ['row', 'col', 'depth', 'depth2', 'depth3'];\n return `\n ${getSamplerFromInInfo(newInputInfo)}\n float ${funcName}(int row, int col, int depth, int depth2, int depth3) {\n return ${funcName}(${getSqueezedParams(params, keptDims)});\n }\n `;\n }\n\n if (inputInfo.shapeInfo.isUniform) {\n // Uniform arrays will be less than 65505 (no risk of float16 overflow).\n return `\n float ${funcName}(int row, int col, int depth, int depth2, int depth3) {\n float index = dot(\n vec4(row, col, depth, depth2),\n vec4(${stride0}, ${stride1}, ${stride2}, ${stride3})) +\n depth3;\n ${getUniformSampler(inputInfo)}\n }\n `;\n }\n\n const flatOffset = inputInfo.shapeInfo.flatOffset;\n const texShape = inputInfo.shapeInfo.texShape;\n const texNumR = texShape[0];\n const texNumC = texShape[1];\n\n if (texNumC === stride0 && flatOffset == null) {\n // texC is used directly as physical (no risk of float16 overflow).\n return `\n float ${funcName}(int row, int col, int depth, int depth2, int depth3) {\n int texR = row;\n float texC = dot(vec4(col, depth, depth2, depth3),\n vec4(${stride1}, ${stride2}, ${stride3}, 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${texNumC}.0, ${texNumR}.0);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n\n if (texNumC === stride3 && flatOffset == null) {\n // texR is used directly as physical (no risk of float16 overflow).\n return `\n float ${funcName}(int row, int col, int depth, int depth2, int depth3) {\n float texR = dot(\n vec4(row, col, depth, depth2),\n vec4(${shape[1] * shape[2] * shape[3]},\n ${shape[2] * shape[3]}, ${shape[3]}, 1));\n int texC = depth3;\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${texNumC}.0, ${texNumR}.0);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n\n const offset = getFlatOffsetUniformName(texName);\n return `\n float ${funcName}(int row, int col, int depth, int depth2, int depth3) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * ${stride0} + col * ${stride1} + depth * ${stride2} +\n depth2 * ${stride3} + depth3 + ${offset};\n vec2 uv = uvFromFlat(${texNumR}, ${texNumC}, index);\n return sampleTexture(${texName}, uv);\n }\n `;\n}\n\nfunction getSampler6D(inputInfo: InputInfo): string {\n const shape = inputInfo.shapeInfo.logicalShape;\n const texName = inputInfo.name;\n const funcName = 'get' + texName.charAt(0).toUpperCase() + texName.slice(1);\n\n const {newShape, keptDims} = util.squeezeShape(shape);\n if (newShape.length < shape.length) {\n const newInputInfo = squeezeInputInfo(inputInfo, newShape);\n const params = ['row', 'col', 'depth', 'depth2', 'depth3', 'depth4'];\n return `\n ${getSamplerFromInInfo(newInputInfo)}\n float ${funcName}(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n return ${funcName}(${getSqueezedParams(params, keptDims)});\n }\n `;\n }\n\n const stride4 = shape[5];\n const stride3 = shape[4] * stride4;\n const stride2 = shape[3] * stride3;\n const stride1 = shape[2] * stride2;\n const stride0 = shape[1] * stride1;\n\n if (inputInfo.shapeInfo.isUniform) {\n // Uniform arrays will be less than 65505 (no risk of float16 overflow).\n return `\n float ${funcName}(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n int index = round(dot(\n vec4(row, col, depth, depth2),\n vec4(${stride0}, ${stride1}, ${stride2}, ${stride3})) +\n dot(\n vec2(depth3, depth4),\n vec2(${stride4}, 1)));\n ${getUniformSampler(inputInfo)}\n }\n `;\n }\n\n const flatOffset = inputInfo.shapeInfo.flatOffset;\n const texShape = inputInfo.shapeInfo.texShape;\n const texNumR = texShape[0];\n const texNumC = texShape[1];\n if (texNumC === stride0 && flatOffset == null) {\n // texC is used directly as physical (no risk of float16 overflow).\n return `\n float ${funcName}(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n int texR = row;\n float texC = dot(vec4(col, depth, depth2, depth3),\n vec4(${stride1}, ${stride2}, ${stride3}, ${stride4})) +\n float(depth4);\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${texNumC}.0, ${texNumR}.0);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n if (texNumC === stride4 && flatOffset == null) {\n // texR is used directly as physical (no risk of float16 overflow).\n return `\n float ${funcName}(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n float texR = dot(vec4(row, col, depth, depth2),\n vec4(${shape[1] * shape[2] * shape[3] * shape[4]},\n ${shape[2] * shape[3] * shape[4]},\n ${shape[3] * shape[4]},\n ${shape[4]})) + float(depth3);\n int texC = depth4;\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${texNumC}.0, ${texNumR}.0);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n const offset = getFlatOffsetUniformName(texName);\n return `\n float ${funcName}(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * ${stride0} + col * ${stride1} + depth * ${stride2} +\n depth2 * ${stride3} + depth3 * ${stride4} + depth4 + ${offset};\n vec2 uv = uvFromFlat(${texNumR}, ${texNumC}, index);\n return sampleTexture(${texName}, uv);\n }\n `;\n}\n\nfunction getUniformSampler(inputInfo: InputInfo): string {\n const texName = inputInfo.name;\n const inSize = util.sizeFromShape(inputInfo.shapeInfo.logicalShape);\n\n if (inSize < 2) {\n return `return ${texName};`;\n }\n\n return `\n for (int i = 0; i < ${inSize}; i++) {\n if (i == index) {\n return ${texName}[i];\n }\n }\n `;\n}\n\nfunction getPackedSamplerAtOutputCoords(\n inputInfo: InputInfo, outShapeInfo: ShapeInfo) {\n const texName = inputInfo.name;\n const texFuncSnippet = texName.charAt(0).toUpperCase() + texName.slice(1);\n const funcName = 'get' + texFuncSnippet + 'AtOutCoords';\n const inRank = inputInfo.shapeInfo.logicalShape.length;\n const outRank = outShapeInfo.logicalShape.length;\n\n const broadcastDims = getBroadcastDims(\n inputInfo.shapeInfo.logicalShape, outShapeInfo.logicalShape);\n\n const type = getCoordsDataType(outRank);\n const rankDiff = outRank - inRank;\n let coordsSnippet: string;\n const fields = ['x', 'y', 'z', 'w', 'u', 'v'];\n\n if (inRank === 0) {\n coordsSnippet = '';\n } else if (outRank < 2 && broadcastDims.length >= 1) {\n coordsSnippet = 'coords = 0;';\n } else {\n coordsSnippet =\n broadcastDims.map(d => `coords.${fields[d + rankDiff]} = 0;`)\n .join('\\n');\n }\n let unpackedCoordsSnippet = '';\n if (outRank < 2 && inRank > 0) {\n unpackedCoordsSnippet = 'coords';\n } else {\n unpackedCoordsSnippet = inputInfo.shapeInfo.logicalShape\n .map((s, i) => `coords.${fields[i + rankDiff]}`)\n .join(', ');\n }\n\n let output = `return outputValue;`;\n const inSize = util.sizeFromShape(inputInfo.shapeInfo.logicalShape);\n const isInputScalar = inSize === 1;\n const outSize = util.sizeFromShape(outShapeInfo.logicalShape);\n const isOutputScalar = outSize === 1;\n\n if (inRank === 1 && !isInputScalar && !isOutputScalar) {\n output = `\n return vec4(outputValue.xy, outputValue.xy);\n `;\n } else if (isInputScalar && !isOutputScalar) {\n if (outRank === 1) {\n output = `\n return vec4(outputValue.x, outputValue.x, 0., 0.);\n `;\n } else {\n output = `\n return vec4(outputValue.x);\n `;\n }\n } else if (broadcastDims.length) {\n const rows = inRank - 2;\n const cols = inRank - 1;\n\n if (broadcastDims.indexOf(rows) > -1 && broadcastDims.indexOf(cols) > -1) {\n output = `return vec4(outputValue.x);`;\n } else if (broadcastDims.indexOf(rows) > -1) {\n output = `return vec4(outputValue.x, outputValue.y, ` +\n `outputValue.x, outputValue.y);`;\n } else if (broadcastDims.indexOf(cols) > -1) {\n output = `return vec4(outputValue.xx, outputValue.zz);`;\n }\n }\n\n return `\n vec4 ${funcName}() {\n ${type} coords = getOutputCoords();\n ${coordsSnippet}\n vec4 outputValue = get${texFuncSnippet}(${unpackedCoordsSnippet});\n ${output}\n }\n `;\n}\n\nfunction getSamplerAtOutputCoords(\n inputInfo: InputInfo, outShapeInfo: ShapeInfo) {\n const texName = inputInfo.name;\n const texFuncSnippet = texName.charAt(0).toUpperCase() + texName.slice(1);\n const funcName = 'get' + texFuncSnippet + 'AtOutCoords';\n const outTexShape = outShapeInfo.texShape;\n const inTexShape = inputInfo.shapeInfo.texShape;\n const inRank = inputInfo.shapeInfo.logicalShape.length;\n const outRank = outShapeInfo.logicalShape.length;\n\n if (!inputInfo.shapeInfo.isUniform && inRank === outRank &&\n inputInfo.shapeInfo.flatOffset == null &&\n util.arraysEqual(inTexShape, outTexShape)) {\n return `\n float ${funcName}() {\n return sampleTexture(${texName}, resultUV);\n }\n `;\n }\n\n const type = getCoordsDataType(outRank);\n const broadcastDims = getBroadcastDims(\n inputInfo.shapeInfo.logicalShape, outShapeInfo.logicalShape);\n const rankDiff = outRank - inRank;\n let coordsSnippet: string;\n const fields = ['x', 'y', 'z', 'w', 'u', 'v'];\n\n if (inRank === 0) {\n coordsSnippet = '';\n } else if (outRank < 2 && broadcastDims.length >= 1) {\n coordsSnippet = 'coords = 0;';\n } else {\n coordsSnippet =\n broadcastDims.map(d => `coords.${fields[d + rankDiff]} = 0;`)\n .join('\\n');\n }\n let unpackedCoordsSnippet = '';\n if (outRank < 2 && inRank > 0) {\n unpackedCoordsSnippet = 'coords';\n } else {\n unpackedCoordsSnippet = inputInfo.shapeInfo.logicalShape\n .map((s, i) => `coords.${fields[i + rankDiff]}`)\n .join(', ');\n }\n\n return `\n float ${funcName}() {\n ${type} coords = getOutputCoords();\n ${coordsSnippet}\n return get${texFuncSnippet}(${unpackedCoordsSnippet});\n }\n `;\n}\n\nexport function getCoordsDataType(rank: number): string {\n if (rank <= 1) {\n return 'int';\n } else if (rank === 2) {\n return 'ivec2';\n } else if (rank === 3) {\n return 'ivec3';\n } else if (rank === 4) {\n return 'ivec4';\n } else if (rank === 5) {\n return 'ivec5';\n } else if (rank === 6) {\n return 'ivec6';\n } else {\n throw Error(`GPU for rank ${rank} is not yet supported`);\n }\n}\n\nexport function getUniformInfoFromShape(\n isPacked: boolean, shape: number[], texShape: number[]) {\n const {newShape, keptDims} = util.squeezeShape(shape);\n const rank = shape.length;\n const useSqueezePackedShape = isPacked && rank === 3 && shape[0] === 1;\n const squeezeShape = useSqueezePackedShape ? shape.slice(1) : newShape;\n const useSqueezeShape =\n (!isPacked && rank > 1 && !util.arraysEqual(shape, texShape) &&\n newShape.length < rank) ||\n useSqueezePackedShape;\n const uniformShape = useSqueezeShape ? squeezeShape : shape;\n return {useSqueezeShape, uniformShape, keptDims};\n}\n\n/** Returns a new input info (a copy) that has a squeezed logical shape. */\nexport function squeezeInputInfo(\n inInfo: InputInfo, squeezedShape: number[]): InputInfo {\n // Deep copy.\n const newInputInfo: InputInfo = JSON.parse(JSON.stringify(inInfo));\n newInputInfo.shapeInfo.logicalShape = squeezedShape;\n return newInputInfo;\n}\n\nfunction getSqueezedParams(params: string[], keptDims: number[]): string {\n return keptDims.map(d => params[d]).join(', ');\n}\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, env, Tensor, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {GPGPUContext} from './gpgpu_context';\nimport * as shader_compiler from './shader_compiler';\nimport {InputInfo, ShapeInfo, UniformType} from './shader_compiler';\nimport {PackingScheme, TextureData, TextureUsage} from './tex_util';\nimport {createFragmentShader} from './webgl_util';\n\nexport interface GPGPUProgram {\n variableNames: string[];\n outputShape: number[];\n userCode: string;\n enableShapeUniforms?: boolean;\n /** If true, this program expects packed input textures. Defaults to false. */\n packedInputs?: boolean;\n /** If true, this program produces a packed texture. Defaults to false. */\n packedOutput?: boolean;\n /**\n * Affects what type of texture we allocate for the output. Defaults to\n * `TextureUsage.RENDER`.\n */\n outTexUsage?: TextureUsage;\n /**\n * The type of scheme to use when packing texels for the output values.\n * See `PackingScheme` for details. Defaults to `PackingScheme.SHARED_BATCH`.\n */\n outPackingScheme?: PackingScheme;\n customUniforms?:\n Array<{name: string; arrayIndex?: number; type: UniformType;}>;\n}\n\nexport interface GPGPUBinary {\n webGLProgram: WebGLProgram;\n program: GPGPUProgram;\n uniformLocations: {[name: string]: WebGLUniformLocation};\n customUniformLocations?: WebGLUniformLocation[];\n source: string;\n fragmentShader: WebGLShader;\n inShapeInfos: ShapeInfo[];\n outShapeInfo: ShapeInfo;\n infLoc: WebGLUniformLocation;\n nanLoc: WebGLUniformLocation;\n inShapesLocations?: {[name: string]: WebGLUniformLocation};\n inTexShapesLocations?: {[name: string]: WebGLUniformLocation};\n outShapeLocation?: WebGLUniformLocation;\n outShapeStridesLocation?: WebGLUniformLocation;\n outTexShapeLocation?: WebGLUniformLocation;\n}\n\nexport interface GPGPUBinaryLocations {\n uniformLocations: {[name: string]: WebGLUniformLocation};\n customUniformLocations?: WebGLUniformLocation[];\n infLoc: WebGLUniformLocation;\n nanLoc: WebGLUniformLocation;\n inShapesLocations?: {[name: string]: WebGLUniformLocation};\n inTexShapesLocations?: {[name: string]: WebGLUniformLocation};\n outShapeLocation?: WebGLUniformLocation;\n outShapeStridesLocation?: WebGLUniformLocation;\n outTexShapeLocation?: WebGLUniformLocation;\n}\n\nexport interface TensorData {\n shape: number[];\n texData: TextureData;\n isUniform: boolean;\n // Available when we decide to upload as uniform instead of texture.\n uniformValues?: TypedArray;\n}\n\nexport function compileProgram(\n gpgpu: GPGPUContext, program: GPGPUProgram, inputs: TensorData[],\n output: TensorData): GPGPUBinary {\n const inputInfos: InputInfo[] = inputs.map((input, i) => {\n const shapeInfo: ShapeInfo = {\n logicalShape: input.shape,\n texShape: input.isUniform ? null : input.texData.texShape,\n isUniform: input.isUniform,\n isPacked: input.isUniform ? false : input.texData.isPacked,\n flatOffset: null\n };\n if (input.texData != null && input.texData.slice != null &&\n input.texData.slice.flatOffset > 0) {\n shapeInfo.flatOffset = input.texData.slice.flatOffset;\n }\n return {name: program.variableNames[i], shapeInfo};\n });\n const inShapeInfos = inputInfos.map(x => x.shapeInfo);\n const outShapeInfo: ShapeInfo = {\n logicalShape: output.shape,\n texShape: output.texData.texShape,\n isUniform: false,\n isPacked: output.texData.isPacked,\n flatOffset: null\n };\n const source = shader_compiler.makeShader(inputInfos, outShapeInfo, program);\n const fragmentShader = createFragmentShader(gpgpu.gl, source);\n const webGLProgram = gpgpu.createProgram(fragmentShader);\n\n if (!env().get('ENGINE_COMPILE_ONLY')) {\n return {\n program,\n fragmentShader,\n source,\n webGLProgram,\n inShapeInfos,\n outShapeInfo,\n ...getUniformLocations(gpgpu, program, webGLProgram)\n };\n } else {\n return {\n program,\n fragmentShader,\n source,\n webGLProgram,\n inShapeInfos,\n outShapeInfo,\n uniformLocations: null,\n customUniformLocations: null,\n infLoc: null,\n nanLoc: null,\n inShapesLocations: null,\n inTexShapesLocations: null,\n outShapeLocation: null,\n outShapeStridesLocation: null,\n outTexShapeLocation: null\n };\n }\n}\n\nexport function getUniformLocations(\n gpgpu: GPGPUContext, program: GPGPUProgram,\n webGLProgram: WebGLProgram): GPGPUBinaryLocations {\n const uniformLocations: {[name: string]: WebGLUniformLocation} = {};\n const inShapesLocations: {[name: string]: WebGLUniformLocation} = {};\n const inTexShapesLocations: {[name: string]: WebGLUniformLocation} = {};\n const customUniformLocations: WebGLUniformLocation[] = [];\n let outShapeLocation: WebGLUniformLocation;\n let outTexShapeLocation: WebGLUniformLocation;\n let outShapeStridesLocation: WebGLUniformLocation;\n let infLoc: WebGLUniformLocation = null;\n let nanLoc: WebGLUniformLocation = null;\n\n // Add special uniforms (NAN, INFINITY)\n nanLoc = gpgpu.getUniformLocation(webGLProgram, 'NAN', false);\n if (env().getNumber('WEBGL_VERSION') === 1) {\n infLoc = gpgpu.getUniformLocation(webGLProgram, 'INFINITY', false);\n }\n\n // Add user-defined uniforms\n const shouldThrow = false;\n for (let i = 0; i < program.variableNames.length; i++) {\n const varName = program.variableNames[i];\n uniformLocations[varName] =\n gpgpu.getUniformLocation(webGLProgram, varName, shouldThrow);\n uniformLocations[`offset${varName}`] =\n gpgpu.getUniformLocation(webGLProgram, `offset${varName}`, shouldThrow);\n if (program.enableShapeUniforms) {\n inShapesLocations[`${varName}Shape`] = gpgpu.getUniformLocation(\n webGLProgram, `${varName}Shape`, shouldThrow);\n inTexShapesLocations[`${varName}TexShape`] = gpgpu.getUniformLocation(\n webGLProgram, `${varName}TexShape`, shouldThrow);\n }\n }\n\n if (program.enableShapeUniforms) {\n outShapeLocation =\n gpgpu.getUniformLocation(webGLProgram, 'outShape', shouldThrow);\n outShapeStridesLocation =\n gpgpu.getUniformLocation(webGLProgram, 'outShapeStrides', shouldThrow);\n outTexShapeLocation =\n gpgpu.getUniformLocation(webGLProgram, 'outTexShape', shouldThrow);\n }\n\n if (program.customUniforms) {\n program.customUniforms.forEach((d, i) => {\n customUniformLocations[i] =\n gpgpu.getUniformLocation(webGLProgram, d.name, shouldThrow);\n });\n }\n\n return {\n uniformLocations,\n customUniformLocations,\n infLoc,\n nanLoc,\n inShapesLocations,\n inTexShapesLocations,\n outShapeLocation,\n outShapeStridesLocation,\n outTexShapeLocation\n };\n}\n\nfunction validateBinaryAndProgram(\n shapeInfos: ShapeInfo[], inputs: TensorData[]) {\n if (shapeInfos.length !== inputs.length) {\n throw Error(\n `Binary was compiled with ${shapeInfos.length} inputs, but ` +\n `was executed with ${inputs.length} inputs`);\n }\n\n shapeInfos.forEach((s, i) => {\n const shapeA = s.logicalShape;\n const input = inputs[i];\n const shapeB = input.shape;\n\n if (!util.arraysEqual(shapeA, shapeB)) {\n throw Error(\n `Binary was compiled with different shapes than ` +\n `the current args. Shapes ${shapeA} and ${shapeB} must match`);\n }\n // The input is uploaded as uniform.\n if (s.isUniform && input.isUniform) {\n return;\n }\n\n const texShapeA = s.texShape;\n const texShapeB = input.isUniform ? null : input.texData.texShape;\n if (!util.arraysEqual(texShapeA, texShapeB)) {\n throw Error(\n `Binary was compiled with different texture shapes than the` +\n ` current args. Shape ${texShapeA} and ${texShapeB} must match`);\n }\n });\n}\n\nexport function runProgram(\n gpgpu: GPGPUContext, binary: GPGPUBinary, inputs: TensorData[],\n output: TensorData, customUniformValues?: number[][]): void {\n if (!binary.program.enableShapeUniforms) {\n validateBinaryAndProgram(binary.inShapeInfos, inputs);\n validateBinaryAndProgram([binary.outShapeInfo], [output]);\n }\n\n const outTex = output.texData.texture;\n const outTexShape = output.texData.texShape;\n if (output.texData.isPacked) {\n gpgpu.setOutputPackedMatrixTexture(\n outTex.texture, outTexShape[0], outTexShape[1]);\n } else {\n gpgpu.setOutputMatrixTexture(\n outTex.texture, outTexShape[0], outTexShape[1]);\n }\n gpgpu.setProgram(binary.webGLProgram);\n\n // Set special uniforms (NAN, INFINITY)\n if (env().getNumber('WEBGL_VERSION') === 1) {\n if (binary.infLoc !== null) {\n gpgpu.gl.uniform1f(binary.infLoc, Infinity);\n }\n }\n if (binary.nanLoc !== null) {\n gpgpu.gl.uniform1f(binary.nanLoc, NaN);\n }\n\n // Set user-defined inputs\n inputs.forEach((input, i) => {\n const varName = binary.program.variableNames[i];\n const varLoc = binary.uniformLocations[varName];\n const varOffsetLoc = binary.uniformLocations[`offset${varName}`];\n const varShapeLoc = binary.inShapesLocations[`${varName}Shape`];\n const varTexShapeLoc = binary.inTexShapesLocations[`${varName}TexShape`];\n\n if (varShapeLoc) {\n const {uniformShape} = shader_compiler.getUniformInfoFromShape(\n binary.program.packedInputs, input.shape, input.texData.texShape);\n switch (uniformShape.length) {\n case 1:\n gpgpu.gl.uniform1iv(varShapeLoc, new Int32Array(uniformShape));\n break;\n case 2:\n gpgpu.gl.uniform2iv(varShapeLoc, new Int32Array(uniformShape));\n break;\n case 3:\n gpgpu.gl.uniform3iv(varShapeLoc, new Int32Array(uniformShape));\n break;\n case 4:\n gpgpu.gl.uniform4iv(varShapeLoc, new Int32Array(uniformShape));\n break;\n default:\n break;\n }\n }\n if (varTexShapeLoc) {\n gpgpu.gl.uniform2i(\n varTexShapeLoc, input.texData.texShape[0], input.texData.texShape[1]);\n }\n\n if (varLoc == null) {\n // The compiler inferred that this variable is not used in this shader.\n return;\n }\n\n if (input.isUniform) {\n // Upload the values of the tensor as uniform.\n if (util.sizeFromShape(input.shape) < 2) {\n gpgpu.gl.uniform1f(varLoc, input.uniformValues[0]);\n } else {\n let vals = input.uniformValues;\n if (!(vals instanceof Float32Array)) {\n vals = new Float32Array(vals);\n }\n gpgpu.gl.uniform1fv(varLoc, vals);\n }\n return;\n }\n\n // If the input was sliced, upload the flat offset index.\n if (input.texData.slice != null && varOffsetLoc != null) {\n gpgpu.gl.uniform1i(varOffsetLoc, input.texData.slice.flatOffset);\n }\n\n gpgpu.setInputMatrixTexture(input.texData.texture.texture, varLoc, i);\n });\n\n const outShapeLoc = binary.outShapeLocation;\n if (outShapeLoc) {\n switch (output.shape.length) {\n case 1:\n gpgpu.gl.uniform1iv(outShapeLoc, new Int32Array(output.shape));\n break;\n case 2:\n gpgpu.gl.uniform2iv(outShapeLoc, new Int32Array(output.shape));\n break;\n case 3:\n gpgpu.gl.uniform3iv(outShapeLoc, new Int32Array(output.shape));\n break;\n case 4:\n gpgpu.gl.uniform4iv(outShapeLoc, new Int32Array(output.shape));\n break;\n default:\n break;\n }\n }\n if (binary.outShapeStridesLocation) {\n const strides = util.computeStrides(output.shape);\n switch (output.shape.length) {\n case 2:\n gpgpu.gl.uniform1iv(\n binary.outShapeStridesLocation, new Int32Array(strides));\n break;\n case 3:\n gpgpu.gl.uniform2iv(\n binary.outShapeStridesLocation, new Int32Array(strides));\n break;\n case 4:\n gpgpu.gl.uniform3iv(\n binary.outShapeStridesLocation, new Int32Array(strides));\n break;\n default:\n break;\n }\n }\n if (binary.outTexShapeLocation) {\n gpgpu.gl.uniform2i(\n binary.outTexShapeLocation, output.texData.texShape[0],\n output.texData.texShape[1]);\n }\n\n if (binary.program.customUniforms && customUniformValues) {\n binary.program.customUniforms.forEach((d, i) => {\n const customLoc = binary.customUniformLocations[i];\n const customValue = customUniformValues[i];\n if (d.type === 'float') {\n gpgpu.gl.uniform1fv(customLoc, customValue);\n } else if (d.type === 'vec2') {\n gpgpu.gl.uniform2fv(customLoc, customValue);\n } else if (d.type === 'vec3') {\n gpgpu.gl.uniform3fv(customLoc, customValue);\n } else if (d.type === 'vec4') {\n gpgpu.gl.uniform4fv(customLoc, customValue);\n } else if (d.type === 'int') {\n gpgpu.gl.uniform1iv(customLoc, customValue);\n } else if (d.type === 'ivec2') {\n gpgpu.gl.uniform2iv(customLoc, customValue);\n } else if (d.type === 'ivec3') {\n gpgpu.gl.uniform3iv(customLoc, customValue);\n } else if (d.type === 'ivec4') {\n gpgpu.gl.uniform4iv(customLoc, customValue);\n } else {\n throw Error(`uniform type ${d.type} is not supported yet.`);\n }\n });\n }\n gpgpu.executeProgram();\n}\n\nexport function makeShaderKey(\n program: GPGPUProgram, inputs: TensorData[], output: TensorData): string {\n let keyInputs = '';\n inputs.concat(output).forEach(x => {\n const hasOffset = x.texData != null && x.texData.slice != null &&\n x.texData.slice.flatOffset > 0;\n // TODO: Remove the condition of !x.isUniform.\n if (program.enableShapeUniforms && !x.isUniform) {\n const xTexShape = x.texData.texShape;\n const {useSqueezeShape, uniformShape, keptDims} =\n shader_compiler.getUniformInfoFromShape(\n program.packedInputs, x.shape, xTexShape);\n let rank1 = '', rank2 = '', rank34 = '';\n if (uniformShape.length === 1 && program.packedInputs) {\n const packedTexShape =\n [Math.ceil(xTexShape[0] / 2), Math.ceil(xTexShape[1] / 2)];\n rank1 = `${packedTexShape[0] > 1}_${packedTexShape[1] > 1}`;\n } else if (uniformShape.length === 2 && !program.packedInputs) {\n rank2 = `${uniformShape[0] > 1}_${uniformShape[1] > 1}`;\n } else if (uniformShape.length > 2 && !program.packedInputs) {\n const strides = util.computeStrides(uniformShape);\n rank34 = `${strides[0] === xTexShape[1]}_${\n strides[strides.length - 1] === xTexShape[1]}`;\n }\n const xRank = x.shape.length;\n const isLogicalShapTexShapeEqual =\n uniformShape.length === 2 && util.arraysEqual(x.shape, xTexShape);\n const isScalar = util.sizeFromShape(x.shape) === 1;\n const broadcastDims =\n backend_util.getBroadcastDims(x.shape, output.shape);\n const isInOutTexShapeEqual = !program.packedInputs &&\n xRank === output.shape.length &&\n util.arraysEqual(xTexShape, output.texData.texShape);\n const isTexShapeGreaterThanOne =\n program.packedInputs || uniformShape.length > 2 ?\n '' :\n `${xTexShape[0] > 1}_${xTexShape[1] > 1}`;\n // These key components are needed due to shader_compiler is embedding\n // them in the shader.\n // |xRank| is used to determine the coords length. See\n // get[Packed]SamplerAtOutputCoords.\n // |isInOutTexShapeEqual| is used to determine whether going to an\n // optimization path in getSamplerAtOutputCoords.\n // |useSqueezeShape| is extracted from squeezeInputInfo of\n // getSampler[2|3|4]D/getPackedSampler3D.\n // |isScalar| is extracted from isInputScalar/isOutputScalar in\n // getPackedSamplerAtOutputCoords.\n // |broadcastDims| is extracted from get[Packed]SamplerAtOutputCoords.\n // |isLogicalShapTexShapeEqual| is used in\n // getOutput[Packed]2DCoords/get[Packed]Sampler2D.\n // |rank1| is used in getOutputPacked1DCoords.\n // |rank2| is used in getOutput2DCoords.\n // |rank34| is used in getSampler3D/getSampler4D.\n // |isTexShapeGreaterThanOne| are used in\n // getSampler[Scalar|1D|2D]/getOutput1DCoords.\n keyInputs += `${xRank}_${isInOutTexShapeEqual}_${\n useSqueezeShape ? keptDims : ''}_${uniformShape.length}_${isScalar}_${\n broadcastDims}_${isLogicalShapTexShapeEqual}_${rank1}_${rank2}_${\n rank34}_${isTexShapeGreaterThanOne}_${hasOffset}`;\n } else {\n const texShape = x.isUniform ? 'uniform' : x.texData.texShape;\n keyInputs += `${x.shape}_${texShape}_${hasOffset}`;\n }\n });\n const keyUserCode = program.userCode;\n let key = program.constructor.name;\n // Fast string concat. See https://jsperf.com/string-concatenation/14.\n key += '_' + keyInputs + '_' + keyUserCode +\n `${env().getNumber('WEBGL_VERSION')}`;\n return key;\n}\n\nexport function useShapeUniforms(rank: number) {\n // TODO: Remove the limitaion of rank <= 4.\n return env().getBool('WEBGL_USE_SHAPES_UNIFORMS') && rank <= 4;\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getGlslDifferences} from './glsl_version';\nimport {GPGPUProgram, useShapeUniforms} from './gpgpu_math';\nimport * as shader_util from './shader_compiler_util';\nimport {PackingScheme} from './tex_util';\n\nexport class DecodeMatrixProgram implements GPGPUProgram {\n variableNames = ['A'];\n userCode: string;\n outputShape: [number, number, number];\n packedInputs = false;\n packedOutput = true;\n outPackingScheme = PackingScheme.DENSE;\n enableShapeUniforms: boolean;\n customUniforms = [{name: 'texShape', type: 'ivec2' as const }];\n\n constructor(outputShape: [number, number, number]) {\n const glsl = getGlslDifferences();\n this.outputShape = outputShape;\n this.enableShapeUniforms = useShapeUniforms(this.outputShape.length);\n\n this.userCode = `\n ivec3 outCoordsFromFlatIndex(int index) {\n ${\n this.enableShapeUniforms ?\n shader_util.getOutputLogicalCoordinatesFromFlatIndexByUniform(\n ['r', 'c', 'd'], outputShape) :\n shader_util.getLogicalCoordinatesFromFlatIndex(\n ['r', 'c', 'd'], outputShape)}\n return ivec3(r, c, d);\n }\n\n void main() {\n ivec2 resTexRC = ivec2(resultUV.yx * vec2(texShape[0], texShape[1]));\n int index = 4 * (resTexRC.x * texShape[1] + resTexRC.y);\n\n vec4 result = vec4(0.);\n\n for (int i=0; i<4; i++) {\n int flatIndex = index + i;\n ivec3 rc = outCoordsFromFlatIndex(flatIndex);\n result[i] = getA(rc.x, rc.y, rc.z);\n }\n\n ${glsl.output} = result;\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getGlslDifferences} from './glsl_version';\nimport {GPGPUProgram, useShapeUniforms} from './gpgpu_math';\nimport * as shader_util from './shader_compiler_util';\nimport {PackingScheme} from './tex_util';\n\nexport class DecodeMatrixPackedProgram implements GPGPUProgram {\n variableNames = ['A'];\n userCode: string;\n packedInputs = true;\n packedOutput = true;\n outputShape: [number, number, number];\n outPackingScheme = PackingScheme.DENSE;\n enableShapeUniforms: boolean;\n customUniforms = [{name: 'texShape', type: 'ivec2' as const }];\n\n constructor(outputShape: [number, number, number]) {\n const glsl = getGlslDifferences();\n this.outputShape = outputShape;\n this.enableShapeUniforms = useShapeUniforms(this.outputShape.length);\n\n this.userCode = `\n ivec3 outCoordsFromFlatIndex(int index) {\n ${\n this.enableShapeUniforms ?\n shader_util.getOutputLogicalCoordinatesFromFlatIndexByUniform(\n ['r', 'c', 'd'], outputShape) :\n shader_util.getLogicalCoordinatesFromFlatIndex(\n ['r', 'c', 'd'], outputShape)}\n return ivec3(r, c, d);\n }\n\n void main() {\n ivec2 resTexRC = ivec2(resultUV.yx * vec2(texShape[0], texShape[1]));\n int index = 4 * (resTexRC.x * texShape[1] + resTexRC.y);\n\n vec4 result = vec4(0.);\n\n for (int i=0; i<4; i++) {\n int flatIndex = index + i;\n ivec3 rc = outCoordsFromFlatIndex(flatIndex);\n result[i] = getChannel(getA(rc.x, rc.y, rc.z), vec2(rc.y, rc.z));\n }\n\n ${glsl.output} = result;\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getGlslDifferences} from './glsl_version';\nimport {GPGPUProgram} from './gpgpu_math';\nimport {ENCODE_FLOAT_SNIPPET} from './shader_compiler_util';\nimport {TextureUsage} from './tex_util';\n\nexport class EncodeFloatProgram implements GPGPUProgram {\n variableNames = ['A'];\n userCode: string;\n outputShape: number[];\n outTexUsage = TextureUsage.DOWNLOAD;\n\n constructor(outputShape: number[]) {\n const glsl = getGlslDifferences();\n this.outputShape = outputShape;\n this.userCode = `\n ${ENCODE_FLOAT_SNIPPET}\n\n void main() {\n float x = getAAtOutCoords();\n ${glsl.output} = encode_float(x);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getGlslDifferences} from './glsl_version';\nimport {GPGPUProgram} from './gpgpu_math';\nimport {ENCODE_FLOAT_SNIPPET} from './shader_compiler_util';\nimport {TextureUsage} from './tex_util';\n\nexport class EncodeFloatPackedProgram implements GPGPUProgram {\n variableNames = ['A'];\n userCode: string;\n outputShape: number[];\n packedInputs = true;\n packedOutput = false;\n outTexUsage = TextureUsage.DOWNLOAD;\n\n constructor(outputShape: [number, number, number]) {\n const glsl = getGlslDifferences();\n this.outputShape = outputShape;\n this.userCode = `\n ${ENCODE_FLOAT_SNIPPET}\n\n void main() {\n ivec3 coords = getOutputCoords();\n float x = getChannel(getAAtOutCoords(), vec2(coords.y, coords.z));\n ${glsl.output} = encode_float(x);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getGlslDifferences} from './glsl_version';\nimport {GPGPUProgram, useShapeUniforms} from './gpgpu_math';\nimport * as shader_util from './shader_compiler_util';\n\nconst CHANNEL_CHAR_TO_INDEX_MAP: Record = {\n 'R': 0,\n 'G': 1,\n 'B': 2,\n 'A': 3\n};\n\nexport class EncodeMatrixProgram implements GPGPUProgram {\n variableNames = ['A'];\n userCode: string;\n outputShape: number[];\n enableShapeUniforms: boolean;\n customUniforms = [{name: 'texShape', type: 'ivec2' as const }];\n\n constructor(\n outputShape: [number, number, number], inputIsUnsignedByte = false,\n usedChannels = 'RGBA') {\n const glsl = getGlslDifferences();\n this.outputShape = outputShape;\n this.enableShapeUniforms = useShapeUniforms(this.outputShape.length);\n\n let output = `result`;\n if (inputIsUnsignedByte) {\n output = `floor(result * 255. + 0.5)`;\n }\n\n let mainLoop = '';\n for (let usedChannelIndex = 0; usedChannelIndex < usedChannels.length;\n usedChannelIndex++) {\n const curChannel = usedChannels[usedChannelIndex];\n mainLoop += `\n if(offset == ${usedChannelIndex}) {\n result = values[${CHANNEL_CHAR_TO_INDEX_MAP[curChannel]}];\n }`;\n }\n\n this.userCode = `\n ${\n this.enableShapeUniforms ? shader_util.getFlatIndexFrom3DOutput() :\n shader_util.getFlatIndexFrom3D(outputShape)}\n\n void main() {\n ivec3 coords = getOutputCoords();\n int flatIndex = getFlatIndex(coords);\n float result = 0.;\n int offset = imod(flatIndex, ${usedChannels.length});\n\n flatIndex = idiv(flatIndex, ${usedChannels.length}, 1.);\n\n int r = flatIndex / texShape[1];\n if (r < texShape[0]) {\n int c = imod(flatIndex, texShape[1]);\n vec2 uv = (vec2(c, r) + halfCR) / vec2(texShape[1], texShape[0]);\n vec4 values = ${glsl.texture2D}(A, uv);\n ${mainLoop}\n }\n ${glsl.output} = vec4(${output}, 0., 0., 0.);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getGlslDifferences} from './glsl_version';\nimport {GPGPUProgram, useShapeUniforms} from './gpgpu_math';\nimport * as shader_util from './shader_compiler_util';\n\n/*\nThis is how the shader encodes a tensor with shape = [2, 3, 5]\n(indices are [batch, row, col]).\n\n000|001 002|003 004|xxx 020|021 022|023 024|xxx\n------- ------- ------- ------- ------- -------\n010|011 012|013 014|xxx xxx|xxx xxx|xxx xxx|xxx\n\n100|101 102|103 104|xxx 120|121 122|123 124|xxx\n------- ------- ------- ------- ------- -------\n110|111 112|113 114|xxx xxx|xxx xxx|xxx xxx|xxx\n\nSingle texels contain only values from the same batch, and from adjacent rows\nand columns.\n */\n\nexport class EncodeMatrixPackedProgram implements GPGPUProgram {\n variableNames = ['A'];\n userCode: string;\n outputShape: number[];\n packedInputs = false;\n packedOutput = true;\n enableShapeUniforms: boolean;\n customUniforms = [{name: 'texShape', type: 'ivec2' as const }];\n\n constructor(\n outputShape: [number, number, number], inputIsUnsignedByte = false) {\n const glsl = getGlslDifferences();\n this.outputShape = outputShape;\n this.enableShapeUniforms = useShapeUniforms(this.outputShape.length);\n\n let mainLoop = '';\n let output = 'result';\n if (inputIsUnsignedByte) {\n output = 'floor(result * 255. + 0.5)';\n }\n\n for (let row = 0; row <= 1; row++) {\n for (let col = 0; col <= 1; col++) {\n const channel = row * 2 + col;\n\n mainLoop += `\n localCoords = coords;\n if(localCoords[2] + ${col} < ${\n this.enableShapeUniforms ? 'outShape[2]' : `${outputShape[2]}`}) {\n localCoords[2] += ${col};\n if (localCoords[1] + ${row} < ${\n this.enableShapeUniforms ? 'outShape[1]' : `${outputShape[1]}`}) {\n localCoords[1] += ${row};\n\n flatIndex = getFlatIndex(localCoords);\n offset = imod(flatIndex, 4);\n\n flatIndex = idiv(flatIndex, 4, 1.);\n\n int r = flatIndex / texShape[1];\n int c = imod(flatIndex, texShape[1]);\n vec2 uv = (vec2(c, r) + halfCR) / vec2(texShape[1], texShape[0]);\n values = ${glsl.texture2D}(A, uv);\n\n if (offset == 0) {\n result[${channel}] = values[0];\n } else if (offset == 1) {\n result[${channel}] = values[1];\n } else if (offset == 2) {\n result[${channel}] = values[2];\n } else {\n result[${channel}] = values[3];\n }\n }\n }\n `;\n }\n }\n\n this.userCode = `\n ${\n this.enableShapeUniforms ? shader_util.getFlatIndexFrom3DOutput() :\n shader_util.getFlatIndexFrom3D(outputShape)}\n\n void main() {\n ivec3 coords = getOutputCoords();\n\n vec4 result = vec4(0.);\n int flatIndex, r, c, offset;\n ivec3 localCoords;\n vec2 uv;\n vec4 values;\n\n ${mainLoop}\n\n ${glsl.output} = ${output};\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env, PixelData, TypedArray} from '@tensorflow/tfjs-core';\n\nimport {getGlslDifferences} from './glsl_version';\nimport * as tex_util from './tex_util';\nimport {Texture, TextureConfig} from './tex_util';\nimport * as webgl_util from './webgl_util';\n\nexport function createVertexShader(gl: WebGLRenderingContext): WebGLShader {\n const glsl = getGlslDifferences();\n const vertexShaderSource = `${glsl.version}\n precision highp float;\n ${glsl.attribute} vec3 clipSpacePos;\n ${glsl.attribute} vec2 uv;\n ${glsl.varyingVs} vec2 resultUV;\n\n void main() {\n gl_Position = vec4(clipSpacePos, 1);\n resultUV = uv;\n }`;\n return webgl_util.createVertexShader(gl, vertexShaderSource);\n}\n\nexport function createVertexBuffer(gl: WebGLRenderingContext): WebGLBuffer {\n // [x y z u v] * [upper-left, lower-left, upper-right, lower-right]\n const vertexArray = new Float32Array(\n [-1, 1, 0, 0, 1, -1, -1, 0, 0, 0, 1, 1, 0, 1, 1, 1, -1, 0, 1, 0]);\n return webgl_util.createStaticVertexBuffer(gl, vertexArray);\n}\n\nexport function createIndexBuffer(gl: WebGLRenderingContext): WebGLBuffer {\n // OpenGL (and WebGL) have \"CCW == front\" winding\n const triangleVertexIndices = new Uint16Array([0, 1, 2, 2, 1, 3]);\n return webgl_util.createStaticIndexBuffer(gl, triangleVertexIndices);\n}\n\nfunction createAndConfigureTexture(\n gl: WebGLRenderingContext, width: number, height: number,\n internalFormat: number, textureFormat: number,\n textureType: number): Texture {\n webgl_util.validateTextureSize(width, height);\n const texture = webgl_util.createTexture(gl);\n\n const tex2d = gl.TEXTURE_2D;\n webgl_util.callAndCheck(gl, () => gl.bindTexture(tex2d, texture));\n webgl_util.callAndCheck(\n gl, () => gl.texParameteri(tex2d, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE));\n webgl_util.callAndCheck(\n gl, () => gl.texParameteri(tex2d, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE));\n webgl_util.callAndCheck(\n gl, () => gl.texParameteri(tex2d, gl.TEXTURE_MIN_FILTER, gl.NEAREST));\n webgl_util.callAndCheck(\n gl, () => gl.texParameteri(tex2d, gl.TEXTURE_MAG_FILTER, gl.NEAREST));\n if (env().getNumber('WEBGL_VERSION') === 1) {\n webgl_util.callAndCheck(\n gl,\n () => gl.texImage2D(\n tex2d, 0, internalFormat, width, height, 0, textureFormat,\n textureType, null));\n } else {\n webgl_util.callAndCheck(\n gl,\n () => (gl as WebGL2RenderingContext)\n .texStorage2D(tex2d, 1, internalFormat, width, height));\n }\n webgl_util.callAndCheck(gl, () => gl.bindTexture(gl.TEXTURE_2D, null));\n\n return {texture, texShape: [height, width]};\n}\n\nexport function getInternalFormatForFloat32MatrixTexture(\n textureConfig: TextureConfig) {\n return textureConfig.internalFormatFloat;\n}\n\nexport function createFloat32MatrixTexture(\n gl: WebGLRenderingContext, rows: number, columns: number,\n textureConfig: TextureConfig): Texture {\n const [width, height] =\n tex_util.getUnpackedMatrixTextureShapeWidthHeight(rows, columns);\n return createAndConfigureTexture(\n gl, width, height,\n getInternalFormatForFloat32MatrixTexture(textureConfig),\n textureConfig.textureFormatFloat, gl.FLOAT);\n}\n\nexport function getInternalFormatForFloat16MatrixTexture(\n textureConfig: TextureConfig) {\n return textureConfig.internalFormatHalfFloat;\n}\n\nexport function createFloat16MatrixTexture(\n gl: WebGLRenderingContext, rows: number, columns: number,\n textureConfig: TextureConfig): Texture {\n const [width, height] =\n tex_util.getUnpackedMatrixTextureShapeWidthHeight(rows, columns);\n return createAndConfigureTexture(\n gl, width, height,\n getInternalFormatForFloat16MatrixTexture(textureConfig),\n textureConfig.textureFormatFloat, textureConfig.textureTypeHalfFloat);\n}\n\nexport function getInternalFormatForUnsignedBytesMatrixTexture(\n textureConfig: TextureConfig) {\n return textureConfig.downloadTextureFormat;\n}\n\nexport function createUnsignedBytesMatrixTexture(\n gl: WebGLRenderingContext, rows: number, columns: number,\n textureConfig: TextureConfig): Texture {\n const [width, height] =\n tex_util.getUnpackedMatrixTextureShapeWidthHeight(rows, columns);\n return createAndConfigureTexture(\n gl, width, height,\n getInternalFormatForUnsignedBytesMatrixTexture(textureConfig), gl.RGBA,\n gl.UNSIGNED_BYTE);\n}\n\nexport function getInternalFormatForPackedMatrixTexture(\n textureConfig: TextureConfig) {\n return textureConfig.internalFormatPackedFloat;\n}\n\nexport function createPackedMatrixTexture(\n gl: WebGLRenderingContext, rows: number, columns: number,\n textureConfig: TextureConfig): Texture {\n const [width, height] =\n tex_util.getPackedMatrixTextureShapeWidthHeight(rows, columns);\n return createAndConfigureTexture(\n gl, width, height, getInternalFormatForPackedMatrixTexture(textureConfig),\n gl.RGBA, gl.FLOAT);\n}\n\nexport function getInternalFormatForFloat16PackedMatrixTexture(\n textureConfig: TextureConfig) {\n return textureConfig.internalFormatPackedHalfFloat;\n}\n\nexport function createFloat16PackedMatrixTexture(\n gl: WebGLRenderingContext, rows: number, columns: number,\n textureConfig: TextureConfig): Texture {\n const [width, height] =\n tex_util.getPackedMatrixTextureShapeWidthHeight(rows, columns);\n return createAndConfigureTexture(\n gl, width, height,\n getInternalFormatForFloat16PackedMatrixTexture(textureConfig), gl.RGBA,\n textureConfig.textureTypeHalfFloat);\n}\n\nexport function bindVertexProgramAttributeStreams(\n gl: WebGLRenderingContext, program: WebGLProgram,\n vertexBuffer: WebGLBuffer): boolean {\n const posOffset = 0; // x is the first buffer element\n const uvOffset = 3 * 4; // uv comes after [x y z]\n const stride = (3 * 4) + (2 * 4); // xyz + uv, each entry is 4-byte float.\n webgl_util.callAndCheck(\n gl, () => gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer));\n const success = webgl_util.bindVertexBufferToProgramAttribute(\n gl, program, 'clipSpacePos', vertexBuffer, 3, stride, posOffset);\n return success &&\n webgl_util.bindVertexBufferToProgramAttribute(\n gl, program, 'uv', vertexBuffer, 2, stride, uvOffset);\n}\n\nexport function uploadDenseMatrixToTexture(\n gl: WebGLRenderingContext, texture: WebGLTexture, width: number,\n height: number, data: TypedArray, textureConfig: TextureConfig) {\n webgl_util.callAndCheck(gl, () => gl.bindTexture(gl.TEXTURE_2D, texture));\n\n let dataForUpload: TypedArray, texelDataType: number, internalFormat: number;\n if (data instanceof Uint8Array) {\n dataForUpload = new Uint8Array(width * height * 4);\n texelDataType = gl.UNSIGNED_BYTE;\n internalFormat = gl.RGBA;\n } else {\n dataForUpload = new Float32Array(width * height * 4);\n texelDataType = gl.FLOAT;\n internalFormat = textureConfig.internalFormatPackedFloat;\n }\n\n dataForUpload.set(data);\n if (env().getNumber('WEBGL_VERSION') === 2) {\n webgl_util.callAndCheck(\n gl,\n () => gl.texSubImage2D(\n gl.TEXTURE_2D, 0, 0, 0, width, height, gl.RGBA, texelDataType,\n dataForUpload));\n } else {\n webgl_util.callAndCheck(\n gl,\n () => gl.texImage2D(\n gl.TEXTURE_2D, 0, internalFormat, width, height, 0, gl.RGBA,\n texelDataType, dataForUpload));\n }\n\n webgl_util.callAndCheck(gl, () => gl.bindTexture(gl.TEXTURE_2D, null));\n}\n\nexport function uploadPixelDataToTexture(\n gl: WebGLRenderingContext, texture: WebGLTexture,\n pixels: PixelData|ImageData|HTMLImageElement|HTMLCanvasElement|\n HTMLVideoElement|ImageBitmap) {\n webgl_util.callAndCheck(gl, () => gl.bindTexture(gl.TEXTURE_2D, texture));\n if ((pixels as PixelData).data instanceof Uint8Array) {\n if (env().getNumber('WEBGL_VERSION') === 2) {\n webgl_util.callAndCheck(\n gl,\n () => gl.texSubImage2D(\n gl.TEXTURE_2D, 0, 0, 0, pixels.width, pixels.height, gl.RGBA,\n gl.UNSIGNED_BYTE, (pixels as PixelData).data));\n } else {\n webgl_util.callAndCheck(\n gl,\n () => gl.texImage2D(\n gl.TEXTURE_2D, 0, gl.RGBA, pixels.width, pixels.height, 0,\n gl.RGBA, gl.UNSIGNED_BYTE, (pixels as PixelData).data));\n }\n } else {\n if (env().getNumber('WEBGL_VERSION') === 2) {\n webgl_util.callAndCheck(\n gl,\n () => gl.texSubImage2D(\n gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE,\n (pixels as ImageData | HTMLImageElement | HTMLCanvasElement |\n HTMLVideoElement | ImageBitmap)));\n } else {\n webgl_util.callAndCheck(\n gl,\n () => gl.texImage2D(\n gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE,\n pixels as ImageData | HTMLImageElement | HTMLCanvasElement |\n HTMLVideoElement | ImageBitmap));\n }\n }\n\n webgl_util.callAndCheck(gl, () => gl.bindTexture(gl.TEXTURE_2D, null));\n}\n\nexport function createBufferFromOutputTexture(\n gl2: WebGL2RenderingContext, rows: number, columns: number,\n textureConfig: TextureConfig): WebGLBuffer {\n // Create and bind the buffer.\n const buffer = gl2.createBuffer();\n webgl_util.callAndCheck(\n gl2, () => gl2.bindBuffer(gl2.PIXEL_PACK_BUFFER, buffer));\n\n // Initialize the buffer to the size of the texture in bytes.\n const bytesPerFloat = 4;\n const valuesPerTexel = 4;\n const bufferSizeBytes = bytesPerFloat * valuesPerTexel * rows * columns;\n\n webgl_util.callAndCheck(\n gl2,\n () => gl2.bufferData(\n gl2.PIXEL_PACK_BUFFER, bufferSizeBytes, gl2.STREAM_READ));\n\n // Enqueue a command on the GPU command queue to copy of texture into the\n // buffer.\n webgl_util.callAndCheck(\n gl2, () => gl2.readPixels(0, 0, columns, rows, gl2.RGBA, gl2.FLOAT, 0));\n\n webgl_util.callAndCheck(\n gl2, () => gl2.bindBuffer(gl2.PIXEL_PACK_BUFFER, null));\n\n return buffer;\n}\n\nexport function downloadFloat32MatrixFromBuffer(\n gl: WebGLRenderingContext, buffer: WebGLBuffer,\n size: number): Float32Array {\n const gl2 = gl as WebGL2RenderingContext;\n\n const downloadTarget = new Float32Array(size);\n\n gl2.bindBuffer(gl2.PIXEL_PACK_BUFFER, buffer);\n gl2.getBufferSubData(gl2.PIXEL_PACK_BUFFER, 0, downloadTarget);\n gl2.bindBuffer(gl2.PIXEL_PACK_BUFFER, null);\n\n return downloadTarget;\n}\n\nexport function downloadByteEncodedFloatMatrixFromOutputTexture(\n gl: WebGLRenderingContext, rows: number, columns: number,\n textureConfig: TextureConfig) {\n const [w, h] =\n tex_util.getUnpackedMatrixTextureShapeWidthHeight(rows, columns);\n\n const numChannels = 4;\n const downloadTarget = new Uint8Array(\n tex_util.getUnpackedArraySizeFromMatrixSize(rows * columns, numChannels));\n\n webgl_util.callAndCheck(\n gl,\n () => gl.readPixels(\n 0, 0, w, h, textureConfig.downloadTextureFormat, gl.UNSIGNED_BYTE,\n downloadTarget));\n\n // By wrapping the buffer in a Float32Array, we use native browser IEEE 754\n // decoding of the 4 bytes that back each 32 bit float.\n return new Float32Array(downloadTarget.buffer);\n}\n\nexport function downloadPackedMatrixFromBuffer(\n gl: WebGLRenderingContext, buffer: WebGLBuffer, batch: number, rows: number,\n cols: number, physicalRows: number, physicalCols: number,\n textureConfig: TextureConfig): Float32Array {\n const gl2 = gl as WebGL2RenderingContext;\n\n const downloadTarget =\n new Float32Array(tex_util.getPackedRGBAArraySizeFromMatrixShape(\n physicalRows, physicalCols));\n\n gl2.bindBuffer(gl2.PIXEL_PACK_BUFFER, buffer);\n gl2.getBufferSubData(gl2.PIXEL_PACK_BUFFER, 0, downloadTarget);\n gl2.bindBuffer(gl2.PIXEL_PACK_BUFFER, null);\n\n return downloadTarget;\n}\n\nexport function downloadMatrixFromPackedOutputTexture(\n gl: WebGLRenderingContext, physicalRows: number,\n physicalCols: number): Float32Array {\n const packedRGBA = new Float32Array(physicalRows * physicalCols * 4);\n webgl_util.callAndCheck(\n gl,\n () => gl.readPixels(\n 0, 0, physicalCols, physicalRows, gl.RGBA, gl.FLOAT, packedRGBA));\n\n return packedRGBA;\n}\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env, PixelData, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {getWebGLContext, setWebGLContext} from './canvas_util';\nimport * as gpgpu_util from './gpgpu_util';\nimport * as tex_util from './tex_util';\nimport {Texture, TextureConfig} from './tex_util';\nimport {WebGL1DisjointQueryTimerExtension, WebGL2DisjointQueryTimerExtension, WebGLParallelCompilationExtension} from './webgl_types';\nimport * as webgl_util from './webgl_util';\n\nexport interface FenceContext {\n query: WebGLQuery|WebGLSync;\n isFencePassed(): boolean;\n}\n\nexport class GPGPUContext {\n gl: WebGLRenderingContext;\n textureFloatExtension: {};\n textureHalfFloatExtension: {};\n colorBufferFloatExtension: {};\n colorBufferHalfFloatExtension: {};\n disjointQueryTimerExtension: WebGL2DisjointQueryTimerExtension|\n WebGL1DisjointQueryTimerExtension;\n parallelCompilationExtension: WebGLParallelCompilationExtension;\n vertexBuffer: WebGLBuffer;\n indexBuffer: WebGLBuffer;\n framebuffer: WebGLFramebuffer;\n outputTexture: WebGLTexture|null = null;\n program: WebGLProgram|null = null;\n private disposed = false;\n private disjoint: boolean;\n private vertexShader: WebGLShader;\n textureConfig: TextureConfig;\n\n constructor(gl?: WebGLRenderingContext) {\n const glVersion = env().getNumber('WEBGL_VERSION');\n if (gl != null) {\n this.gl = gl;\n setWebGLContext(glVersion, gl);\n } else {\n this.gl = getWebGLContext(glVersion);\n }\n // WebGL 2.0 enables texture floats without an extension.\n let COLOR_BUFFER_FLOAT = 'WEBGL_color_buffer_float';\n const COLOR_BUFFER_HALF_FLOAT = 'EXT_color_buffer_half_float';\n this.parallelCompilationExtension =\n this.gl.getExtension('KHR_parallel_shader_compile');\n if (env().getNumber('WEBGL_VERSION') === 1) {\n const TEXTURE_FLOAT = 'OES_texture_float';\n const TEXTURE_HALF_FLOAT = 'OES_texture_half_float';\n\n this.textureFloatExtension =\n webgl_util.getExtensionOrThrow(this.gl, TEXTURE_FLOAT);\n if (webgl_util.hasExtension(this.gl, TEXTURE_HALF_FLOAT)) {\n this.textureHalfFloatExtension =\n webgl_util.getExtensionOrThrow(this.gl, TEXTURE_HALF_FLOAT);\n } else if (env().get('WEBGL_FORCE_F16_TEXTURES')) {\n throw new Error(\n 'GL context does not support half float textures, yet the ' +\n 'environment flag WEBGL_FORCE_F16_TEXTURES is set to true.');\n }\n\n this.colorBufferFloatExtension = this.gl.getExtension(COLOR_BUFFER_FLOAT);\n if (webgl_util.hasExtension(this.gl, COLOR_BUFFER_HALF_FLOAT)) {\n this.colorBufferHalfFloatExtension =\n webgl_util.getExtensionOrThrow(this.gl, COLOR_BUFFER_HALF_FLOAT);\n } else if (env().get('WEBGL_FORCE_F16_TEXTURES')) {\n throw new Error(\n 'GL context does not support color renderable half floats, yet ' +\n 'the environment flag WEBGL_FORCE_F16_TEXTURES is set to true.');\n }\n } else {\n COLOR_BUFFER_FLOAT = 'EXT_color_buffer_float';\n if (webgl_util.hasExtension(this.gl, COLOR_BUFFER_FLOAT)) {\n this.colorBufferFloatExtension =\n this.gl.getExtension(COLOR_BUFFER_FLOAT);\n } else if (webgl_util.hasExtension(this.gl, COLOR_BUFFER_HALF_FLOAT)) {\n this.colorBufferHalfFloatExtension =\n this.gl.getExtension(COLOR_BUFFER_HALF_FLOAT);\n } else {\n throw new Error('GL context does not support color renderable floats');\n }\n }\n\n this.vertexBuffer = gpgpu_util.createVertexBuffer(this.gl);\n this.indexBuffer = gpgpu_util.createIndexBuffer(this.gl);\n this.framebuffer = webgl_util.createFramebuffer(this.gl);\n\n this.textureConfig =\n tex_util.getTextureConfig(this.gl, this.textureHalfFloatExtension);\n }\n\n private get debug(): boolean {\n return env().getBool('DEBUG');\n }\n\n public dispose() {\n if (this.disposed) {\n return;\n }\n if (this.program != null) {\n console.warn(\n 'Disposing a GPGPUContext that still has a bound WebGLProgram.' +\n ' This is probably a resource leak, delete the program with ' +\n 'GPGPUContext.deleteProgram before disposing.');\n }\n if (this.outputTexture != null) {\n console.warn(\n 'Disposing a GPGPUContext that still has a bound output matrix ' +\n 'texture. This is probably a resource leak, delete the output ' +\n 'matrix texture with GPGPUContext.deleteMatrixTexture before ' +\n 'disposing.');\n }\n const gl = this.gl;\n webgl_util.callAndCheck(gl, () => gl.finish());\n webgl_util.callAndCheck(gl, () => gl.bindFramebuffer(gl.FRAMEBUFFER, null));\n webgl_util.callAndCheck(gl, () => gl.deleteFramebuffer(this.framebuffer));\n webgl_util.callAndCheck(gl, () => gl.bindBuffer(gl.ARRAY_BUFFER, null));\n webgl_util.callAndCheck(\n gl, () => gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null));\n webgl_util.callAndCheck(gl, () => gl.deleteBuffer(this.indexBuffer));\n this.disposed = true;\n }\n\n public createFloat32MatrixTexture(rows: number, columns: number): Texture {\n this.throwIfDisposed();\n return gpgpu_util.createFloat32MatrixTexture(\n this.gl, rows, columns, this.textureConfig);\n }\n\n public createFloat16MatrixTexture(rows: number, columns: number): Texture {\n this.throwIfDisposed();\n return gpgpu_util.createFloat16MatrixTexture(\n this.gl, rows, columns, this.textureConfig);\n }\n\n public createUnsignedBytesMatrixTexture(rows: number, columns: number):\n Texture {\n this.throwIfDisposed();\n return gpgpu_util.createUnsignedBytesMatrixTexture(\n this.gl, rows, columns, this.textureConfig);\n }\n\n public uploadPixelDataToTexture(\n texture: WebGLTexture,\n pixels: PixelData|ImageData|HTMLImageElement|HTMLCanvasElement|\n ImageBitmap) {\n this.throwIfDisposed();\n gpgpu_util.uploadPixelDataToTexture(this.gl, texture, pixels);\n }\n\n public uploadDenseMatrixToTexture(\n texture: WebGLTexture, width: number, height: number, data: TypedArray) {\n this.throwIfDisposed();\n gpgpu_util.uploadDenseMatrixToTexture(\n this.gl, texture, width, height, data, this.textureConfig);\n }\n\n public createFloat16PackedMatrixTexture(rows: number, columns: number):\n Texture {\n this.throwIfDisposed();\n return gpgpu_util.createFloat16PackedMatrixTexture(\n this.gl, rows, columns, this.textureConfig);\n }\n\n public createPackedMatrixTexture(rows: number, columns: number): Texture {\n this.throwIfDisposed();\n return gpgpu_util.createPackedMatrixTexture(\n this.gl, rows, columns, this.textureConfig);\n }\n\n public deleteMatrixTexture(texture: WebGLTexture) {\n this.throwIfDisposed();\n if (this.outputTexture === texture) {\n webgl_util.unbindColorTextureFromFramebuffer(this.gl, this.framebuffer);\n this.outputTexture = null;\n }\n webgl_util.callAndCheck(this.gl, () => this.gl.deleteTexture(texture));\n }\n\n public downloadByteEncodedFloatMatrixFromOutputTexture(\n texture: WebGLTexture, rows: number, columns: number): Float32Array {\n return this.downloadMatrixDriver(\n texture,\n () => gpgpu_util.downloadByteEncodedFloatMatrixFromOutputTexture(\n this.gl, rows, columns, this.textureConfig));\n }\n\n public downloadPackedMatrixFromBuffer(\n buffer: WebGLBuffer, batch: number, rows: number, columns: number,\n physicalRows: number, physicalCols: number): Float32Array {\n return gpgpu_util.downloadPackedMatrixFromBuffer(\n this.gl, buffer, batch, rows, columns, physicalRows, physicalCols,\n this.textureConfig);\n }\n\n public downloadFloat32MatrixFromBuffer(buffer: WebGLBuffer, size: number):\n Float32Array {\n return gpgpu_util.downloadFloat32MatrixFromBuffer(this.gl, buffer, size);\n }\n\n public createBufferFromTexture(\n texture: WebGLTexture, rows: number, columns: number): WebGLBuffer {\n this.bindTextureToFrameBuffer(texture);\n const result = gpgpu_util.createBufferFromOutputTexture(\n this.gl as WebGL2RenderingContext, rows, columns, this.textureConfig);\n this.unbindTextureToFrameBuffer();\n return result;\n }\n\n public createAndWaitForFence(): Promise {\n const fenceContext = this.createFence(this.gl);\n return this.pollFence(fenceContext);\n }\n\n private createFence(gl: WebGLRenderingContext): FenceContext {\n let query: WebGLQuery|WebGLSync;\n let isFencePassed: () => boolean;\n\n if (env().getBool('WEBGL_FENCE_API_ENABLED')) {\n const gl2 = gl as WebGL2RenderingContext;\n\n const sync = gl2.fenceSync(gl2.SYNC_GPU_COMMANDS_COMPLETE, 0);\n gl.flush();\n\n isFencePassed = () => {\n const status = gl2.clientWaitSync(sync, 0, 0);\n return status === gl2.ALREADY_SIGNALED ||\n status === gl2.CONDITION_SATISFIED;\n };\n\n query = sync;\n } else if (\n env().getNumber('WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION') > 0) {\n query = this.beginQuery();\n this.endQuery();\n isFencePassed = () => this.isQueryAvailable(\n query,\n env().getNumber('WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION'));\n } else {\n // If we have no way to fence, return true immediately. This will fire in\n // WebGL 1.0 when there is no disjoint query timer. In this case, because\n // the fence passes immediately, we'll immediately ask for a download of\n // the texture, which will cause the UI thread to hang.\n isFencePassed = () => true;\n }\n\n return {query, isFencePassed};\n }\n\n public downloadMatrixFromPackedTexture(\n texture: WebGLTexture, physicalRows: number,\n physicalCols: number): Float32Array {\n return this.downloadMatrixDriver(\n texture,\n () => gpgpu_util.downloadMatrixFromPackedOutputTexture(\n this.gl, physicalRows, physicalCols));\n }\n\n private vertexAttrsAreBound = false;\n\n public createProgram(fragmentShader: WebGLShader): WebGLProgram {\n this.throwIfDisposed();\n const gl = this.gl;\n if (this.vertexShader == null) {\n this.vertexShader = gpgpu_util.createVertexShader(gl);\n }\n const program: WebGLProgram = webgl_util.createProgram(gl);\n webgl_util.callAndCheck(\n gl, () => gl.attachShader(program, this.vertexShader));\n webgl_util.callAndCheck(gl, () => gl.attachShader(program, fragmentShader));\n webgl_util.linkProgram(gl, program);\n if (this.debug) {\n webgl_util.validateProgram(gl, program);\n }\n if (!this.vertexAttrsAreBound) {\n this.setProgram(program);\n this.vertexAttrsAreBound = gpgpu_util.bindVertexProgramAttributeStreams(\n gl, this.program, this.vertexBuffer);\n }\n return program;\n }\n\n public deleteProgram(program: WebGLProgram) {\n this.throwIfDisposed();\n if (program === this.program) {\n this.program = null;\n }\n if (program != null) {\n webgl_util.callAndCheck(this.gl, () => this.gl.deleteProgram(program));\n }\n }\n\n public setProgram(program: WebGLProgram|null) {\n this.throwIfDisposed();\n this.program = program;\n if ((this.program != null) && this.debug) {\n webgl_util.validateProgram(this.gl, this.program);\n }\n webgl_util.callAndCheck(this.gl, () => this.gl.useProgram(program));\n }\n\n public getUniformLocation(\n program: WebGLProgram, uniformName: string,\n shouldThrow = true): WebGLUniformLocation {\n this.throwIfDisposed();\n if (shouldThrow) {\n return webgl_util.getProgramUniformLocationOrThrow(\n this.gl, program, uniformName);\n } else {\n return webgl_util.getProgramUniformLocation(\n this.gl, program, uniformName);\n }\n }\n\n public getAttributeLocation(program: WebGLProgram, attribute: string):\n number {\n this.throwIfDisposed();\n return webgl_util.callAndCheck(\n this.gl, () => this.gl.getAttribLocation(program, attribute));\n }\n\n public getUniformLocationNoThrow(program: WebGLProgram, uniformName: string):\n WebGLUniformLocation {\n this.throwIfDisposed();\n return this.gl.getUniformLocation(program, uniformName);\n }\n\n public setInputMatrixTexture(\n inputMatrixTexture: WebGLTexture, uniformLocation: WebGLUniformLocation,\n textureUnit: number) {\n this.throwIfDisposed();\n this.throwIfNoProgram();\n webgl_util.bindTextureToProgramUniformSampler(\n this.gl, inputMatrixTexture, uniformLocation, textureUnit);\n }\n\n public setOutputMatrixTexture(\n outputMatrixTexture: WebGLTexture, rows: number, columns: number) {\n this.setOutputMatrixTextureDriver(outputMatrixTexture, columns, rows);\n }\n\n public setOutputPackedMatrixTexture(\n outputPackedMatrixTexture: WebGLTexture, rows: number, columns: number) {\n this.throwIfDisposed();\n const [width, height] =\n tex_util.getPackedMatrixTextureShapeWidthHeight(rows, columns);\n this.setOutputMatrixTextureDriver(outputPackedMatrixTexture, width, height);\n }\n\n public setOutputMatrixWriteRegion(\n startRow: number, numRows: number, startColumn: number,\n numColumns: number) {\n this.setOutputMatrixWriteRegionDriver(\n startColumn, startRow, numColumns, numRows);\n }\n\n public setOutputPackedMatrixWriteRegion(\n startRow: number, numRows: number, startColumn: number,\n numColumns: number) {\n throw new Error('setOutputPackedMatrixWriteRegion not implemented.');\n }\n\n public debugValidate() {\n if (this.program != null) {\n webgl_util.validateProgram(this.gl, this.program);\n }\n webgl_util.validateFramebuffer(this.gl);\n }\n\n public executeProgram() {\n this.throwIfDisposed();\n this.throwIfNoProgram();\n const gl = this.gl;\n if (this.debug) {\n this.debugValidate();\n }\n webgl_util.callAndCheck(\n gl, () => gl.drawElements(gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0));\n }\n\n public blockUntilAllProgramsCompleted() {\n this.throwIfDisposed();\n webgl_util.callAndCheck(this.gl, () => this.gl.finish());\n }\n\n private getQueryTimerExtension(): WebGL1DisjointQueryTimerExtension\n |WebGL2DisjointQueryTimerExtension {\n if (this.disjointQueryTimerExtension == null) {\n this.disjointQueryTimerExtension =\n webgl_util.getExtensionOrThrow(\n this.gl,\n env().getNumber(\n 'WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION') === 2 ?\n 'EXT_disjoint_timer_query_webgl2' :\n 'EXT_disjoint_timer_query') as\n WebGL1DisjointQueryTimerExtension |\n WebGL2DisjointQueryTimerExtension;\n }\n return this.disjointQueryTimerExtension;\n }\n\n private getQueryTimerExtensionWebGL2(): WebGL2DisjointQueryTimerExtension {\n return this.getQueryTimerExtension();\n }\n\n private getQueryTimerExtensionWebGL1(): WebGL1DisjointQueryTimerExtension {\n return this.getQueryTimerExtension() as WebGL1DisjointQueryTimerExtension;\n }\n\n beginQuery(): WebGLQuery {\n if (env().getNumber('WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION') === 2) {\n const gl2 = this.gl as WebGL2RenderingContext;\n const ext = this.getQueryTimerExtensionWebGL2();\n\n const query = gl2.createQuery();\n gl2.beginQuery(ext.TIME_ELAPSED_EXT, query);\n return query;\n }\n const ext = this.getQueryTimerExtensionWebGL1();\n const query = ext.createQueryEXT() as WebGLQuery;\n ext.beginQueryEXT(ext.TIME_ELAPSED_EXT, query);\n return query;\n }\n\n endQuery() {\n if (env().getNumber('WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION') === 2) {\n const gl2 = this.gl as WebGL2RenderingContext;\n const ext = this.getQueryTimerExtensionWebGL2();\n gl2.endQuery(ext.TIME_ELAPSED_EXT);\n return;\n }\n const ext = this.getQueryTimerExtensionWebGL1();\n ext.endQueryEXT(ext.TIME_ELAPSED_EXT);\n }\n\n public async waitForQueryAndGetTime(query: WebGLQuery): Promise {\n await util.repeatedTry(\n () => this.disposed || // while testing contexts are created / disposed\n // in rapid succession, so without this check we\n // may poll for the query timer indefinitely\n this.isQueryAvailable(\n query,\n env().getNumber(\n 'WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION')));\n return this.getQueryTime(\n query, env().getNumber('WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION'));\n }\n\n private getQueryTime(query: WebGLQuery, queryTimerVersion: number): number {\n if (queryTimerVersion === 0) {\n return null;\n }\n\n if (queryTimerVersion === 2) {\n const gl2 = this.gl as WebGL2RenderingContext;\n\n const timeElapsedNanos = gl2.getQueryParameter(query, gl2.QUERY_RESULT);\n // Return milliseconds.\n return timeElapsedNanos / 1000000;\n } else {\n const ext = this.getQueryTimerExtensionWebGL1();\n\n const timeElapsedNanos =\n ext.getQueryObjectEXT(query, ext.QUERY_RESULT_EXT);\n // Return milliseconds.\n return timeElapsedNanos / 1000000;\n }\n }\n\n private isQueryAvailable(query: WebGLQuery, queryTimerVersion: number):\n boolean {\n if (queryTimerVersion === 0) {\n return true;\n }\n\n if (queryTimerVersion === 2) {\n const gl2 = this.gl as WebGL2RenderingContext;\n const ext = this.getQueryTimerExtensionWebGL2();\n\n const available =\n gl2.getQueryParameter(query, gl2.QUERY_RESULT_AVAILABLE);\n if (this.disjoint == null) {\n this.disjoint = this.gl.getParameter(ext.GPU_DISJOINT_EXT);\n }\n\n return available && !this.disjoint;\n } else {\n const ext = this.getQueryTimerExtensionWebGL1();\n\n const available =\n ext.getQueryObjectEXT(query, ext.QUERY_RESULT_AVAILABLE_EXT);\n if (this.disjoint == null) {\n this.disjoint = this.gl.getParameter(ext.GPU_DISJOINT_EXT);\n }\n\n return available && !this.disjoint;\n }\n }\n\n pollFence(fenceContext: FenceContext) {\n return new Promise(resolve => {\n this.addItemToPoll(() => fenceContext.isFencePassed(), () => resolve());\n });\n }\n\n private itemsToPoll: PollItem[] = [];\n\n pollItems(): void {\n // Find the last query that has finished.\n const index = linearSearchLastTrue(this.itemsToPoll.map(x => x.isDoneFn));\n for (let i = 0; i <= index; ++i) {\n const {resolveFn} = this.itemsToPoll[i];\n resolveFn();\n }\n this.itemsToPoll = this.itemsToPoll.slice(index + 1);\n }\n\n private addItemToPoll(isDoneFn: () => boolean, resolveFn: () => void) {\n this.itemsToPoll.push({isDoneFn, resolveFn});\n if (this.itemsToPoll.length > 1) {\n // We already have a running loop that polls.\n return;\n }\n // Start a new loop that polls.\n let scheduleFn = undefined;\n if ('setTimeoutCustom' in env().platform) {\n scheduleFn = env().platform.setTimeoutCustom.bind(env().platform);\n }\n util.repeatedTry(() => {\n this.pollItems();\n // End the loop if no more items to poll.\n return this.itemsToPoll.length === 0;\n }, () => 0, null, scheduleFn);\n }\n\n private bindTextureToFrameBuffer(texture: WebGLTexture) {\n this.throwIfDisposed();\n webgl_util.bindColorTextureToFramebuffer(\n this.gl, texture, this.framebuffer);\n if (this.debug) {\n webgl_util.validateFramebuffer(this.gl);\n }\n }\n\n private unbindTextureToFrameBuffer() {\n if (this.outputTexture != null) {\n webgl_util.bindColorTextureToFramebuffer(\n this.gl, this.outputTexture, this.framebuffer);\n if (this.debug) {\n webgl_util.validateFramebuffer(this.gl);\n }\n } else {\n webgl_util.unbindColorTextureFromFramebuffer(this.gl, this.framebuffer);\n }\n }\n\n private downloadMatrixDriver(\n texture: WebGLTexture,\n downloadAndDecode: () => Float32Array): Float32Array {\n this.bindTextureToFrameBuffer(texture);\n const result = downloadAndDecode();\n this.unbindTextureToFrameBuffer();\n\n return result;\n }\n\n private setOutputMatrixTextureDriver(\n outputMatrixTextureMaybePacked: WebGLTexture, width: number,\n height: number) {\n this.throwIfDisposed();\n const gl = this.gl;\n webgl_util.bindColorTextureToFramebuffer(\n gl, outputMatrixTextureMaybePacked, this.framebuffer);\n if (this.debug) {\n webgl_util.validateFramebuffer(gl);\n }\n this.outputTexture = outputMatrixTextureMaybePacked;\n webgl_util.callAndCheck(gl, () => gl.viewport(0, 0, width, height));\n webgl_util.callAndCheck(gl, () => gl.scissor(0, 0, width, height));\n }\n\n private setOutputMatrixWriteRegionDriver(\n x: number, y: number, width: number, height: number) {\n this.throwIfDisposed();\n webgl_util.callAndCheck(\n this.gl, () => this.gl.scissor(x, y, width, height));\n }\n\n private throwIfDisposed() {\n if (this.disposed) {\n throw new Error('Attempted to use disposed GPGPUContext.');\n }\n }\n\n private throwIfNoProgram() {\n if (this.program == null) {\n throw new Error('No GPU program is currently set.');\n }\n }\n}\n\ntype PollItem = {\n isDoneFn: () => boolean,\n resolveFn: () => void\n};\n\n/**\n * Finds the index of the last true element using linear search.\n * Note: We can't do binary search because Chrome expects us to explicitly\n * test all fences before download:\n * https://github.com/tensorflow/tfjs/issues/1145\n */\nexport function linearSearchLastTrue(arr: Array<() => boolean>): number {\n let i = 0;\n for (; i < arr.length; ++i) {\n const isDone = arr[i]();\n if (!isDone) {\n break;\n }\n }\n return i - 1;\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {TensorInfo, util} from '@tensorflow/tfjs-core';\n\nexport function assertNotComplex(\n tensor: TensorInfo|TensorInfo[], opName: string): void {\n if (!Array.isArray(tensor)) {\n tensor = [tensor];\n }\n tensor.forEach(t => {\n if (t != null) {\n util.assert(\n t.dtype !== 'complex64',\n () => `${\n opName} does not support complex64 tensors in the CPU backend.`);\n }\n });\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the License);\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an AS IS BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Abs, AbsInputs, KernelConfig, KernelFunc, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendCPU} from '../backend_cpu';\nimport {assertNotComplex} from '../cpu_util';\n\nexport function simpleAbsImpl(vals: TypedArray): Float32Array {\n const resultValues = new Float32Array(vals.length);\n for (let i = 0; i < vals.length; ++i) {\n resultValues[i] = Math.abs(vals[i]);\n }\n return resultValues;\n}\n\nexport const abs = (args: {inputs: AbsInputs, backend: MathBackendCPU}) => {\n const {x} = args.inputs;\n const cpuBackend = args.backend;\n\n assertNotComplex(x, 'abs');\n\n let resultValues = new Float32Array(util.sizeFromShape(x.shape));\n const values = cpuBackend.data.get(x.dataId).values as TypedArray;\n resultValues = simpleAbsImpl(values);\n\n return cpuBackend.makeOutput(resultValues, x.shape, x.dtype);\n};\n\nexport const absConfig: KernelConfig = {\n kernelName: Abs,\n backendName: 'cpu',\n kernelFunc: abs as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, DataType, DataValues, NumericDataType, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {SimpleBinaryKernelImpl, SimpleBinaryOperation} from './binary_types';\n\n/**\n * Template that creates implementation for binary ops. Supports broadcast.\n */\nexport function createSimpleBinaryKernelImpl(op: SimpleBinaryOperation):\n SimpleBinaryKernelImpl {\n return (aShape: number[], bShape: number[], aVals: DataValues,\n bVals: DataValues, dtype: DataType): [TypedArray, number[]] => {\n const newShape = backend_util.assertAndGetBroadcastShape(aShape, bShape);\n\n const resultRank = newShape.length;\n const resultStrides = util.computeStrides(newShape);\n const resultSize = util.sizeFromShape(newShape);\n\n const result =\n util.getTypedArrayFromDType(dtype as NumericDataType, resultSize);\n\n const aRank = aShape.length;\n const bRank = bShape.length;\n\n const aStrides = util.computeStrides(aShape);\n const bStrides = util.computeStrides(bShape);\n\n const aBroadcastDims = backend_util.getBroadcastDims(aShape, newShape);\n const bBroadcastDims = backend_util.getBroadcastDims(bShape, newShape);\n\n if (aBroadcastDims.length + bBroadcastDims.length === 0) {\n for (let i = 0; i < result.length; ++i) {\n result[i] = op(aVals[i % aVals.length], bVals[i % bVals.length]);\n }\n } else {\n for (let i = 0; i < result.length; ++i) {\n const loc = util.indexToLoc(i, resultRank, resultStrides);\n\n const aLoc = loc.slice(-aRank);\n aBroadcastDims.forEach(d => aLoc[d] = 0);\n const aIndex = util.locToIndex(aLoc, aRank, aStrides);\n\n const bLoc = loc.slice(-bRank);\n bBroadcastDims.forEach(d => bLoc[d] = 0);\n const bIndex = util.locToIndex(bLoc, bRank, bStrides);\n\n result[i] = op(aVals[aIndex], bVals[bIndex]);\n }\n }\n\n return [result, newShape];\n };\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Complex, ComplexInputs, KernelConfig, KernelFunc, TensorInfo, TypedArray} from '@tensorflow/tfjs-core';\n\nimport {MathBackendCPU} from '../backend_cpu';\n\nexport function complex(args: {inputs: ComplexInputs, backend: MathBackendCPU}):\n TensorInfo {\n const {inputs, backend} = args;\n const {real, imag} = inputs;\n\n const realVals = backend.data.get(real.dataId).values as TypedArray;\n const imagVals = backend.data.get(imag.dataId).values as TypedArray;\n\n const complexInfo = backend.makeTensorInfo(real.shape, 'complex64');\n\n const complex = backend.data.get(complexInfo.dataId);\n\n // The complex tensor owns the underlying real and imag tensorInfos, only the\n // complex tensor tracks refCount, when complexData is disposed the\n // underlying tensorData will be disposed.\n complex.complexTensorInfos = {\n real: backend.makeTensorInfo(real.shape, 'float32', realVals),\n imag: backend.makeTensorInfo(imag.shape, 'float32', imagVals)\n };\n\n return complexInfo;\n}\n\nexport const complexConfig: KernelConfig = {\n kernelName: Complex,\n backendName: 'cpu',\n kernelFunc: complex as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataType, TensorInfo, util} from '@tensorflow/tfjs-core';\nimport {MathBackendCPU} from '../backend_cpu';\nimport {complex} from '../kernels/Complex';\n\n/**\n * Generates a tensorInfo with all zeros value.\n * @param backend cpu backend.\n * @param shape Shape for the zeros tensor.\n * @param dtype Optional. If set, the result has this dtype.\n */\nexport function zeros(\n backend: MathBackendCPU, shape: number[],\n dtype: DataType = 'float32'): TensorInfo {\n if (dtype === 'complex64') {\n const real = zeros(backend, shape, 'float32');\n const imag = zeros(backend, shape, 'float32');\n\n return complex({inputs: {real, imag}, backend});\n }\n\n const values = util.makeZerosTypedArray(util.sizeFromShape(shape), dtype);\n\n return backend.makeTensorInfo(shape, dtype, values);\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Identity, IdentityInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendCPU} from '../backend_cpu';\n\nexport function identity(\n args: {inputs: IdentityInputs, backend: MathBackendCPU}): TensorInfo {\n const {inputs, backend} = args;\n const {x} = inputs;\n\n backend.incRef(x.dataId);\n\n return {dataId: x.dataId, shape: x.shape, dtype: x.dtype};\n}\n\nexport const identityConfig: KernelConfig = {\n kernelName: Identity,\n backendName: 'cpu',\n kernelFunc: identity as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Real, RealInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendCPU} from '../backend_cpu';\n\nexport function real(args: {inputs: RealInputs, backend: MathBackendCPU}):\n TensorInfo {\n const {inputs, backend} = args;\n const {input} = inputs;\n\n const real = backend.data.get(input.dataId).complexTensorInfos.real;\n const realVal = backend.data.get(real.dataId).values;\n\n // When complex tensor is disposed, its underlying parts will be disposed too.\n // Make new tensor out of the real value of the complex. This makes sure the\n // value is still accessible even if complex tensor is disposed.\n return backend.makeTensorInfo(real.shape, real.dtype, realVal);\n}\n\nexport const realConfig: KernelConfig = {\n kernelName: Real,\n backendName: 'cpu',\n kernelFunc: real as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Cast, CastAttrs, CastInputs, DataType, KernelConfig, KernelFunc, TensorInfo, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendCPU} from '../backend_cpu';\nimport {createSimpleBinaryKernelImpl} from '../utils/binary_impl';\nimport {zeros} from '../utils/zeros_impl';\n\nimport {complex} from './Complex';\nimport {identity} from './Identity';\nimport {real} from './Real';\n\nexport function castImpl(\n values: TypedArray, shape: number[], inputType: DataType,\n dtype: DataType): [number[], DataType, TypedArray] {\n if (dtype === 'int32') {\n const resultValues = Int32Array.from(values);\n return [shape, 'int32', resultValues];\n }\n\n if (dtype === 'bool') {\n // This is essentially the result of notEqual(x, 0). We avoid using\n // kernel notEqual to avoid circular dependency, i.e. binary_utils ->\n // cast -> notEqual -> binary_utils.\n const zero = util.toTypedArray([0], inputType);\n\n const [resultData, resultShape] = createSimpleBinaryKernelImpl(\n (a, b) => (a !== b) ? 1 : 0)(shape, [], values, zero, 'bool');\n\n return [resultShape, 'bool', resultData];\n }\n throw new Error(`Error in Cast: failed to cast ${inputType} to ${dtype}`);\n}\n\nexport function cast(\n args: {inputs: CastInputs, backend: MathBackendCPU, attrs: CastAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {dtype} = attrs;\n\n // Casting to complex64.\n if (dtype === 'complex64') {\n if (x.dtype === 'complex64') {\n return identity({inputs: {x}, backend});\n }\n\n const zerosTensorInfo = zeros(backend, x.shape, x.dtype);\n const floatX = cast({inputs: {x}, backend, attrs: {dtype: 'float32'}});\n\n const result =\n complex({inputs: {real: floatX, imag: zerosTensorInfo}, backend});\n\n backend.disposeIntermediateTensorInfo(zerosTensorInfo);\n backend.disposeIntermediateTensorInfo(floatX);\n\n return result;\n }\n\n // Casting from complex64\n if (x.dtype === 'complex64') {\n const realPart = real({inputs: {input: x}, backend});\n const result = cast({inputs: {x: realPart}, backend, attrs: {dtype}});\n\n backend.disposeIntermediateTensorInfo(realPart);\n\n return result;\n }\n\n if (!util.hasEncodingLoss(x.dtype, dtype)) {\n // We don't change the underlying data, since we cast to higher\n // precision.\n const result = identity({inputs: {x}, backend});\n return {dataId: result.dataId, shape: result.shape, dtype};\n }\n\n const values = backend.data.get(x.dataId).values as TypedArray;\n const [resultShape, resultType, resultData] =\n castImpl(values, x.shape, x.dtype, dtype);\n return backend.makeTensorInfo(resultShape, resultType, resultData);\n}\n\nexport const castConfig: KernelConfig = {\n kernelName: Cast,\n backendName: 'cpu',\n kernelFunc: cast as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, BinaryInputs, DataType, KernelFunc, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendCPU} from '../backend_cpu';\nimport {assertNotComplex} from '../cpu_util';\nimport {cast} from '../kernels/Cast';\nimport {complex} from '../kernels/Complex';\n\nimport {ComplexBinaryKernelImpl, ComplexBinaryOperation, SimpleBinaryKernelImpl} from './binary_types';\n\n/**\n * Template that creates a `KernelFunc` for binary ops.\n * @param name Kernel name.\n * @param binaryKernelImpl A `SimpleBinaryKernelImpl` for the kernel.\n * @param binaryKernelComplexImpl Optional. If exists, represents a\n * `ComplexBinaryKernelImpl` for the kernel, will be used when input dtype\n * is `complex64`.\n * @param dtype Optional. If set, the result has this dtype. Otherwise, the\n * result has the same dtype as the first input. This is mainly used in\n * comparison kernels, such as Equal, Less, Greater, etc.\n */\nexport function binaryKernelFunc(\n name: string, simpleImpl: SimpleBinaryKernelImpl,\n complexImpl?: ComplexBinaryKernelImpl, dtype?: DataType): KernelFunc {\n if (complexImpl == null) {\n return ({inputs, backend}) => {\n const {a, b} = inputs as BinaryInputs;\n const cpuBackend = backend as MathBackendCPU;\n\n assertNotComplex([a, b], name);\n\n const aVals = cpuBackend.data.get(a.dataId).values as TypedArray;\n const bVals = cpuBackend.data.get(b.dataId).values as TypedArray;\n\n const decodedAVals = a.dtype === 'string' ?\n // tslint:disable-next-line: no-any\n backend_util.fromUint8ToStringArray(aVals as any as Uint8Array[]) :\n aVals;\n const decodedBVals = a.dtype === 'string' ?\n // tslint:disable-next-line: no-any\n backend_util.fromUint8ToStringArray(bVals as any as Uint8Array[]) :\n bVals;\n const $dtype = dtype || a.dtype;\n\n const [resultData, resultShape] =\n simpleImpl(a.shape, b.shape, decodedAVals, decodedBVals, $dtype);\n\n return cpuBackend.makeTensorInfo(resultShape, $dtype, resultData);\n };\n }\n\n return ({inputs, backend}) => {\n const {a, b} = inputs as BinaryInputs;\n const cpuBackend = backend as MathBackendCPU;\n\n if (a.dtype === 'complex64' || b.dtype === 'complex64') {\n const $aComplex = cast(\n {inputs: {x: a}, backend: cpuBackend, attrs: {dtype: 'complex64'}});\n\n const $aComplexVals = cpuBackend.data.get($aComplex.dataId);\n\n const aReal = $aComplexVals.complexTensorInfos.real;\n const aImag = $aComplexVals.complexTensorInfos.imag;\n\n const aRealVals =\n cpuBackend.data.get(aReal.dataId).values as Float32Array;\n const aImagVals =\n cpuBackend.data.get(aImag.dataId).values as Float32Array;\n\n const $bComplex = cast(\n {inputs: {x: b}, backend: cpuBackend, attrs: {dtype: 'complex64'}});\n\n const $bComplexVals = cpuBackend.data.get($bComplex.dataId);\n\n const bReal = $bComplexVals.complexTensorInfos.real;\n const bImag = $bComplexVals.complexTensorInfos.imag;\n\n const bRealVals =\n cpuBackend.data.get(bReal.dataId).values as Float32Array;\n const bImagVals =\n cpuBackend.data.get(bImag.dataId).values as Float32Array;\n\n const [resultRealData, resultImagData, resultShape] = complexImpl(\n a.shape, b.shape, aRealVals, aImagVals, bRealVals, bImagVals);\n\n const resultReal =\n cpuBackend.makeTensorInfo(resultShape, 'float32', resultRealData);\n\n const resultImag =\n cpuBackend.makeTensorInfo(resultShape, 'float32', resultImagData);\n\n const result = complex(\n {inputs: {real: resultReal, imag: resultImag}, backend: cpuBackend});\n\n cpuBackend.disposeIntermediateTensorInfo($aComplex);\n cpuBackend.disposeIntermediateTensorInfo($bComplex);\n cpuBackend.disposeIntermediateTensorInfo(resultReal);\n cpuBackend.disposeIntermediateTensorInfo(resultImag);\n\n return result;\n } else {\n const aVals = cpuBackend.data.get(a.dataId).values as TypedArray;\n const bVals = cpuBackend.data.get(b.dataId).values as TypedArray;\n\n const $dtype = dtype || a.dtype;\n\n const [resultData, resultShape] =\n simpleImpl(a.shape, b.shape, aVals, bVals, $dtype);\n\n return cpuBackend.makeTensorInfo(resultShape, $dtype, resultData);\n }\n };\n}\n\n/**\n * Template that creates the complex type implementation for binary ops.\n * Supports broadcast.\n */\nexport function createComplexBinaryKernelImpl(op: ComplexBinaryOperation):\n ComplexBinaryKernelImpl {\n return (aShape: number[], bShape: number[], aRealVals: Float32Array,\n aImagVals: Float32Array, bRealVals: Float32Array,\n bImagVals: Float32Array): [TypedArray, TypedArray, number[]] => {\n const resultShape = backend_util.assertAndGetBroadcastShape(aShape, bShape);\n const resultSize = util.sizeFromShape(resultShape);\n const resultRank = resultShape.length;\n const resultStrides = util.computeStrides(resultShape);\n\n const resultRealVals = util.getTypedArrayFromDType('float32', resultSize);\n const resultImagVals = util.getTypedArrayFromDType('float32', resultSize);\n\n const aBroadcastDims = backend_util.getBroadcastDims(aShape, resultShape);\n const bBroadcastDims = backend_util.getBroadcastDims(bShape, resultShape);\n\n const aVals = backend_util.mergeRealAndImagArrays(aRealVals, aImagVals);\n const bVals = backend_util.mergeRealAndImagArrays(bRealVals, bImagVals);\n\n const aRank = aShape.length;\n const aStrides = util.computeStrides(aShape);\n\n const bRank = bShape.length;\n const bStrides = util.computeStrides(bShape);\n\n if (aBroadcastDims.length + bBroadcastDims.length === 0) {\n for (let i = 0; i < resultRealVals.length; i++) {\n const aIdx = i % aVals.length;\n const bIdx = i % bVals.length;\n\n const result =\n op(aVals[aIdx * 2], aVals[aIdx * 2 + 1], bVals[bIdx * 2],\n bVals[bIdx * 2 + 1]);\n\n resultRealVals[i] = result.real;\n resultImagVals[i] = result.imag;\n }\n } else {\n for (let i = 0; i < resultRealVals.length; i++) {\n const loc = util.indexToLoc(i, resultRank, resultStrides);\n\n const aLoc = loc.slice(-aRank);\n aBroadcastDims.forEach(d => aLoc[d] = 0);\n const aIndex = util.locToIndex(aLoc, aRank, aStrides);\n\n const bLoc = loc.slice(-bRank);\n bBroadcastDims.forEach(d => bLoc[d] = 0);\n const bIndex = util.locToIndex(bLoc, bRank, bStrides);\n\n const opResult =\n op(aVals[aIndex * 2], aVals[aIndex * 2 + 1], bVals[bIndex * 2],\n bVals[bIndex * 2 + 1]);\n\n resultRealVals[i] = opResult.real;\n resultImagVals[i] = opResult.imag;\n }\n }\n return [resultRealVals, resultImagVals, resultShape];\n };\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Add, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {createSimpleBinaryKernelImpl} from '../utils/binary_impl';\nimport {binaryKernelFunc, createComplexBinaryKernelImpl} from '../utils/binary_utils';\n\nexport const addImpl =\n createSimpleBinaryKernelImpl(((a: number, b: number) => a + b));\nexport const addComplexImpl =\n createComplexBinaryKernelImpl(((aReal, aImag, bReal, bImag) => {\n return {real: aReal + bReal, imag: aImag + bImag};\n }));\n\nexport const add = binaryKernelFunc(Add, addImpl, addComplexImpl);\n\nexport const addConfig: KernelConfig = {\n kernelName: Add,\n backendName: 'cpu',\n kernelFunc: add\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {buffer, DataType, Rank, TensorBuffer, TypedArray, util} from '@tensorflow/tfjs-core';\n\nexport function bincountImpl(\n xVals: TypedArray, weightsVals: TypedArray, weightsDtype: DataType,\n weightsShape: number[], size: number): TypedArray {\n const weightsSize = util.sizeFromShape(weightsShape);\n const outVals = util.makeZerosTypedArray(size, weightsDtype) as TypedArray;\n\n for (let i = 0; i < xVals.length; i++) {\n const value = xVals[i];\n if (value < 0) {\n throw new Error('Input x must be non-negative!');\n }\n\n if (value >= size) {\n continue;\n }\n\n if (weightsSize > 0) {\n outVals[value] += weightsVals[i];\n } else {\n outVals[value] += 1;\n }\n }\n\n return outVals;\n}\n\nexport function bincountReduceImpl(\n xBuf: TensorBuffer, weightsBuf: TensorBuffer, size: number,\n binaryOutput = false): TensorBuffer {\n const numRows = xBuf.shape[0];\n const numCols = xBuf.shape[1];\n\n const outBuf = buffer([numRows, size], weightsBuf.dtype);\n\n for (let i = 0; i < numRows; i++) {\n for (let j = 0; j < numCols; j++) {\n const value = xBuf.get(i, j);\n if (value < 0) {\n throw new Error('Input x must be non-negative!');\n }\n\n if (value >= size) {\n continue;\n }\n\n if (binaryOutput) {\n outBuf.set(1, i, value);\n } else {\n if (weightsBuf.size > 0) {\n outBuf.set(outBuf.get(i, value) + weightsBuf.get(i, j), i, value);\n } else {\n outBuf.set(outBuf.get(i, value) + 1, i, value);\n }\n }\n }\n }\n\n return outBuf as TensorBuffer;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {NumericDataType, util} from '@tensorflow/tfjs-core';\n\nimport {SimpleUnaryImpl, SimpleUnaryOperation} from './unary_types';\n\n/**\n * Template that creates implementation for unary op.\n */\nexport function createSimpleUnaryImpl(op: SimpleUnaryOperation):\n SimpleUnaryImpl {\n return (values, dtype, attrs) => {\n const newValues =\n util.getTypedArrayFromDType(dtype as NumericDataType, values.length);\n for (let i = 0; i < values.length; ++i) {\n newValues[i] = op(values[i], attrs);\n }\n return newValues;\n };\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataType, KernelFunc, TypedArray, UnaryInputs, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendCPU} from '../backend_cpu';\nimport {assertNotComplex} from '../cpu_util';\n\nimport {SimpleUnaryImpl, SimpleUnaryOperation} from './unary_types';\n\n/**\n * Template that creates a `KernelFunc` for unary ops.\n * @param name Kernel name.\n * @param op A `SimpleUnaryOperation` for the kernel.\n * @param dtype Optional. If set, the result has this dtype. Otherwise, the\n * result has the same dtype as the input. This is mainly used in certain\n * kernels that return bool type, such as isFinite, isInf, etc.\n */\nexport function unaryKernelFunc(\n name: string, op: SimpleUnaryOperation, dtype?: DataType): KernelFunc {\n return ({inputs, attrs, backend}) => {\n const {x} = inputs as UnaryInputs;\n assertNotComplex(x, name);\n if (x.dtype === 'string' || dtype === 'string') {\n throw new Error('unaryKernelFunc does not support string input/output');\n }\n\n const cpuBackend = backend as MathBackendCPU;\n const values = cpuBackend.data.get(x.dataId).values as TypedArray;\n const xSize = util.sizeFromShape(x.shape);\n const $dtype = dtype || x.dtype;\n const newValues = util.getArrayFromDType($dtype, xSize);\n for (let i = 0; i < xSize; ++i) {\n newValues[i] = op(values[i], attrs);\n }\n return cpuBackend.makeTensorInfo(x.shape, $dtype, newValues);\n };\n}\n\n/**\n * Template that creates a `KernelFunc` for unary ops from the given\n * `SimpleUnaryImpl`..\n * @param name Kernel name.\n * @param unaryImpl A `SimpleUnaryImpl` that implements the op.\n * @param dtype Optional. If set, the result has this dtype. Otherwise, the\n * result has the same dtype as the input. This is mainly used in certain\n * kernels that return bool type, such as isFinite, isInf, etc.\n */\nexport function unaryKernelFuncFromImpl(\n name: string, unaryImpl: SimpleUnaryImpl, dtype?: DataType): KernelFunc {\n return ({inputs, attrs, backend}) => {\n const {x} = inputs as UnaryInputs;\n assertNotComplex(x, name);\n if (x.dtype === 'string' || dtype === 'string') {\n throw new Error('unaryKernelFunc does not support string input/output');\n }\n\n const cpuBackend = backend as MathBackendCPU;\n const values = cpuBackend.data.get(x.dataId).values as TypedArray;\n const $dtype = dtype || x.dtype;\n const newValues = unaryImpl(values, $dtype, attrs);\n return cpuBackend.makeTensorInfo(x.shape, $dtype, newValues);\n };\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the License);\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an AS IS BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Ceil, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {createSimpleUnaryImpl} from '../utils/unary_impl';\nimport {unaryKernelFuncFromImpl} from '../utils/unary_utils';\n\nexport const ceilImpl = createSimpleUnaryImpl((xi) => Math.ceil(xi));\nexport const ceil = unaryKernelFuncFromImpl(Ceil, ceilImpl);\n\nexport const ceilConfig: KernelConfig = {\n kernelName: Ceil,\n backendName: 'cpu',\n kernelFunc: ceil,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, BackendValues, DataType, TypedArray, util} from '@tensorflow/tfjs-core';\n\nexport function concatImpl(\n inputs: Array<{vals: BackendValues, shape: number[]}>, outShape: number[],\n dtype: DataType, simplyConcat: boolean): TypedArray|string[] {\n const outVals = util.getArrayFromDType(dtype, util.sizeFromShape(outShape));\n\n if (simplyConcat && dtype !== 'string') {\n // Use built-in TypedArray.set() method for speed.\n let offset = 0;\n inputs.forEach(input => {\n const size = util.sizeFromShape(input.shape);\n\n (outVals as TypedArray).set(input.vals as TypedArray, offset);\n offset += size;\n });\n } else {\n let colOffset = 0;\n\n inputs.forEach(input => {\n const decodedData = dtype === 'string' ?\n backend_util.fromUint8ToStringArray(input.vals as Uint8Array[]) :\n input.vals as TypedArray;\n\n let tIdx = 0;\n\n for (let row = 0; row < input.shape[0]; ++row) {\n const resIdx = row * outShape[1] + colOffset;\n for (let col = 0; col < input.shape[1]; ++col) {\n outVals[resIdx + col] = decodedData[tIdx++];\n }\n }\n\n colOffset += input.shape[1];\n });\n }\n\n return outVals;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Equal, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {createSimpleBinaryKernelImpl} from '../utils/binary_impl';\nimport {binaryKernelFunc} from '../utils/binary_utils';\n\nexport const equalImpl =\n createSimpleBinaryKernelImpl((a: number, b: number) => (a === b) ? 1 : 0);\nexport const equal =\n binaryKernelFunc(Equal, equalImpl, null /* complexImpl */, 'bool');\n\nexport const equalConfig: KernelConfig = {\n kernelName: Equal,\n backendName: 'cpu',\n kernelFunc: equal\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the License);\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an AS IS BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Exp, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {createSimpleUnaryImpl} from '../utils/unary_impl';\nimport {unaryKernelFuncFromImpl} from '../utils/unary_utils';\n\nexport const expImpl = createSimpleUnaryImpl((xi) => Math.exp(xi));\nexport const exp = unaryKernelFuncFromImpl(Exp, expImpl, 'float32');\n\nexport const expConfig: KernelConfig = {\n kernelName: Exp,\n backendName: 'cpu',\n kernelFunc: exp,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the License);\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an AS IS BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Expm1, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {createSimpleUnaryImpl} from '../utils/unary_impl';\nimport {unaryKernelFuncFromImpl} from '../utils/unary_utils';\n\nexport const expm1Impl = createSimpleUnaryImpl((xi) => Math.expm1(xi));\nexport const expm1 = unaryKernelFuncFromImpl(Expm1, expm1Impl);\n\nexport const expm1Config: KernelConfig = {\n kernelName: Expm1,\n backendName: 'cpu',\n kernelFunc: expm1,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the License);\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an AS IS BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Floor, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {createSimpleUnaryImpl} from '../utils/unary_impl';\nimport {unaryKernelFuncFromImpl} from '../utils/unary_utils';\n\nexport const floorImpl = createSimpleUnaryImpl((xi) => Math.floor(xi));\nexport const floor = unaryKernelFuncFromImpl(Floor, floorImpl);\n\nexport const floorConfig: KernelConfig = {\n kernelName: Floor,\n backendName: 'cpu',\n kernelFunc: floor,\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {buffer, DataType, Rank, TensorBuffer, TypedArray} from '@tensorflow/tfjs-core';\n\nexport function gatherNdImpl(\n indicesData: TypedArray, paramsBuf: TensorBuffer, dtype: DataType,\n numSlices: number, sliceRank: number, sliceSize: number, strides: number[],\n paramsShape: number[], paramsSize: number): TensorBuffer {\n const outBuf = buffer([numSlices, sliceSize], dtype);\n\n for (let i = 0; i < numSlices; i++) {\n const index = [];\n let flattenIndex = 0;\n for (let j = 0; j < sliceRank; j++) {\n const dim = indicesData[i * sliceRank + j];\n flattenIndex += dim * strides[j];\n index.push(dim);\n }\n if (flattenIndex < 0 || flattenIndex >= paramsSize / sliceSize) {\n throw new Error(\n `Invalid indices: ${index} does not index into ${paramsShape}`);\n }\n\n for (let k = 0; k < sliceSize; k++) {\n outBuf.values[i * sliceSize + k] =\n paramsBuf.get(...paramsBuf.indexToLoc(flattenIndex * sliceSize + k));\n }\n }\n\n return outBuf as TensorBuffer;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {buffer, DataType, Rank, TensorBuffer} from '@tensorflow/tfjs-core';\n\nexport function gatherV2Impl(\n xBuf: TensorBuffer, indicesBuf: TensorBuffer,\n flattenOutputShape: number[]): TensorBuffer {\n const outBuf = buffer(flattenOutputShape, xBuf.dtype);\n for (let i = 0; i < outBuf.size; ++i) {\n const newLoc = outBuf.indexToLoc(i);\n\n const originalLoc: number[] = newLoc.slice();\n const batchIdx = originalLoc[0];\n const indicesIdx = originalLoc[2];\n const indicesIndex = indicesBuf.locToIndex([batchIdx, indicesIdx]);\n originalLoc[2] = indicesBuf.values[indicesIndex] as number;\n\n const originalIndex = xBuf.locToIndex(originalLoc);\n\n if (0 <= originalIndex && originalIndex < xBuf.values.length) {\n outBuf.values[i] = xBuf.values[originalIndex];\n } // Else, index is out of bounds, so leave the default zero val in outBuf.\n }\n\n return outBuf as TensorBuffer;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Greater, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {createSimpleBinaryKernelImpl} from '../utils/binary_impl';\nimport {binaryKernelFunc} from '../utils/binary_utils';\n\nexport const greaterImpl =\n createSimpleBinaryKernelImpl((a: number, b: number) => (a > b) ? 1 : 0);\nexport const greater =\n binaryKernelFunc(Greater, greaterImpl, null /* complexImpl */, 'bool');\n\nexport const greaterConfig: KernelConfig = {\n kernelName: Greater,\n backendName: 'cpu',\n kernelFunc: greater\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GreaterEqual, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {createSimpleBinaryKernelImpl} from '../utils/binary_impl';\nimport {binaryKernelFunc} from '../utils/binary_utils';\n\nexport const greaterEqualImpl =\n createSimpleBinaryKernelImpl((a: number, b: number) => (a >= b) ? 1 : 0);\nexport const greaterEqual = binaryKernelFunc(\n GreaterEqual, greaterEqualImpl, null /* complexImpl */, 'bool');\n\nexport const greaterEqualConfig: KernelConfig = {\n kernelName: GreaterEqual,\n backendName: 'cpu',\n kernelFunc: greaterEqual\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Less} from '@tensorflow/tfjs-core';\n\nimport {createSimpleBinaryKernelImpl} from '../utils/binary_impl';\nimport {binaryKernelFunc} from '../utils/binary_utils';\n\nexport const lessImpl =\n createSimpleBinaryKernelImpl((a: number, b: number) => (a < b) ? 1 : 0);\nexport const less =\n binaryKernelFunc(Less, lessImpl, null /* complexImpl */, 'bool');\n\nexport const lessConfig: KernelConfig = {\n kernelName: Less,\n backendName: 'cpu',\n kernelFunc: less\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, LessEqual} from '@tensorflow/tfjs-core';\n\nimport {createSimpleBinaryKernelImpl} from '../utils/binary_impl';\nimport {binaryKernelFunc} from '../utils/binary_utils';\n\nexport const lessEqualImpl =\n createSimpleBinaryKernelImpl((a: number, b: number) => (a <= b) ? 1 : 0);\nexport const lessEqual =\n binaryKernelFunc(LessEqual, lessEqualImpl, null /* complexImpl */, 'bool');\n\nexport const lessEqualConfig: KernelConfig = {\n kernelName: LessEqual,\n backendName: 'cpu',\n kernelFunc: lessEqual\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {TypedArray, util} from '@tensorflow/tfjs-core';\n\nexport function linSpaceImpl(\n start: number, stop: number, num: number): TypedArray {\n const step = (stop - start) / (num - 1);\n\n const values = util.makeZerosTypedArray(num, 'float32');\n values[0] = start;\n for (let i = 1; i < values.length; i++) {\n values[i] = values[i - 1] + step;\n }\n\n return values;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the License);\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an AS IS BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Log} from '@tensorflow/tfjs-core';\n\nimport {createSimpleUnaryImpl} from '../utils/unary_impl';\nimport {unaryKernelFuncFromImpl} from '../utils/unary_utils';\n\nexport const logImpl = createSimpleUnaryImpl((xi) => Math.log(xi));\nexport const log = unaryKernelFuncFromImpl(Log, logImpl);\n\nexport const logConfig: KernelConfig = {\n kernelName: Log,\n backendName: 'cpu',\n kernelFunc: log,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataType, NumericDataType, TypedArray, util} from '@tensorflow/tfjs-core';\n\nexport function maxImpl(\n aVals: TypedArray, reduceSize: number, outShape: number[],\n dtype: DataType): TypedArray {\n const vals = util.getTypedArrayFromDType(\n dtype as NumericDataType, util.sizeFromShape(outShape));\n\n for (let i = 0; i < vals.length; ++i) {\n const offset = i * reduceSize;\n let max = aVals[offset];\n for (let j = 0; j < reduceSize; ++j) {\n const value = aVals[offset + j];\n if (Number.isNaN(value) ||\n value > max) { // comparison with NaN always return false\n max = value;\n }\n }\n vals[i] = max;\n }\n return vals;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Maximum} from '@tensorflow/tfjs-core';\n\nimport {createSimpleBinaryKernelImpl} from '../utils/binary_impl';\nimport {binaryKernelFunc} from '../utils/binary_utils';\n\nexport const maximumImpl = createSimpleBinaryKernelImpl(\n ((aValue, bValue) => Math.max(aValue as number, bValue as number)));\nexport const maximum = binaryKernelFunc(Maximum, maximumImpl);\n\nexport const maximumConfig: KernelConfig = {\n kernelName: Maximum,\n backendName: 'cpu',\n kernelFunc: maximum\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Minimum} from '@tensorflow/tfjs-core';\n\nimport {createSimpleBinaryKernelImpl} from '../utils/binary_impl';\nimport {binaryKernelFunc} from '../utils/binary_utils';\n\nexport const minimumImpl = createSimpleBinaryKernelImpl(\n ((aValue, bValue) => Math.min(aValue as number, bValue as number)));\nexport const minimum = binaryKernelFunc(Minimum, minimumImpl);\n\nexport const minimumConfig: KernelConfig = {\n kernelName: Minimum,\n backendName: 'cpu',\n kernelFunc: minimum\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Multiply} from '@tensorflow/tfjs-core';\nimport {createSimpleBinaryKernelImpl} from '../utils/binary_impl';\nimport {binaryKernelFunc, createComplexBinaryKernelImpl} from '../utils/binary_utils';\n\nexport const multiplyImpl = createSimpleBinaryKernelImpl(\n ((aValue: number, bValue: number) => aValue * bValue));\nexport const multiplyComplexImpl =\n createComplexBinaryKernelImpl(((aReal, aImag, bReal, bImag) => {\n return {\n real: aReal * bReal - aImag * bImag,\n imag: aReal * bImag + aImag * bReal\n };\n }));\n\nexport const multiply =\n binaryKernelFunc(Multiply, multiplyImpl, multiplyComplexImpl);\n\nexport const multiplyConfig: KernelConfig = {\n kernelName: Multiply,\n backendName: 'cpu',\n kernelFunc: multiply\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataType, KernelConfig, KernelFunc, Neg, TensorInfo, TypedArray, UnaryInputs, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendCPU} from '../backend_cpu';\nimport {assertNotComplex} from '../cpu_util';\nimport {multiplyImpl} from './Multiply';\n\nexport function negImpl(xVals: TypedArray, xShape: number[], xDtype: DataType):\n [TypedArray, number[]] {\n const minusOne =\n util.createScalarValue(-1 as {} as 'float32', xDtype) as TypedArray;\n return multiplyImpl([], xShape, minusOne, xVals, xDtype);\n}\n\nexport function neg(args: {inputs: UnaryInputs, backend: MathBackendCPU}):\n TensorInfo {\n const {inputs, backend} = args;\n const {x} = inputs;\n\n assertNotComplex(x, 'neg');\n\n const xVals = backend.data.get(x.dataId).values as TypedArray;\n const [res, newShape] = negImpl(xVals, x.shape, x.dtype);\n\n return backend.makeTensorInfo(newShape, x.dtype, res);\n}\n\nexport const negConfig: KernelConfig = {\n kernelName: Neg,\n backendName: 'cpu',\n kernelFunc: neg as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, NotEqual} from '@tensorflow/tfjs-core';\n\nimport {createSimpleBinaryKernelImpl} from '../utils/binary_impl';\nimport {binaryKernelFunc} from '../utils/binary_utils';\n\nexport const notEqualImpl =\n createSimpleBinaryKernelImpl(((a, b) => (a !== b) ? 1 : 0));\nexport const notEqual =\n binaryKernelFunc(NotEqual, notEqualImpl, null /* complexOp */, 'bool');\n\nexport const notEqualConfig: KernelConfig = {\n kernelName: NotEqual,\n backendName: 'cpu',\n kernelFunc: notEqual\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataType, NumericDataType, TypedArray} from '@tensorflow/tfjs-core';\nimport {util} from '@tensorflow/tfjs-core';\n\nexport function transposeImpl(\n xVals: TypedArray, xShape: number[], dtype: DataType, perm: number[],\n newShape: number[]): TypedArray {\n const xRank = xShape.length;\n const xSize = util.sizeFromShape(xShape);\n const xStrides = util.computeStrides(xShape);\n const newStrides = util.computeStrides(newShape);\n\n const result = util.getTypedArrayFromDType(\n dtype as NumericDataType, util.sizeFromShape(newShape));\n\n for (let i = 0; i < xSize; ++i) {\n const loc = util.indexToLoc(i, xRank, xStrides);\n\n // Permute location.\n const newLoc: number[] = new Array(loc.length);\n for (let i = 0; i < newLoc.length; i++) {\n newLoc[i] = loc[perm[i]];\n }\n\n const newIndex = util.locToIndex(newLoc, xRank, newStrides);\n result[newIndex] = xVals[i];\n }\n return result;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, TensorInfo, Transpose, TransposeAttrs, TransposeInputs, TypedArray} from '@tensorflow/tfjs-core';\n\nimport {MathBackendCPU} from '../backend_cpu';\nimport {assertNotComplex} from '../cpu_util';\n\nimport {transposeImpl} from './Transpose_impl';\n\nexport function transpose(args: {\n inputs: TransposeInputs,\n attrs: TransposeAttrs,\n backend: MathBackendCPU\n}): TensorInfo {\n const {inputs, attrs, backend} = args;\n const {x} = inputs;\n const {perm} = attrs;\n\n assertNotComplex(x, 'transpose');\n\n const xRank = x.shape.length;\n\n const newShape: number[] = new Array(xRank);\n for (let i = 0; i < newShape.length; i++) {\n newShape[i] = x.shape[perm[i]];\n }\n\n const values = backend.data.get(x.dataId).values as TypedArray;\n const result = transposeImpl(values, x.shape, x.dtype, perm, newShape);\n\n const dataId = backend.write(result, newShape, x.dtype);\n return {dataId, shape: newShape, dtype: x.dtype};\n}\n\nexport const transposeConfig: KernelConfig = {\n kernelName: Transpose,\n backendName: 'cpu',\n kernelFunc: transpose as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, DataType, KernelConfig, KernelFunc, Prod, ProdAttrs, ProdInputs, TensorInfo, TypedArray, upcastType, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendCPU} from '../backend_cpu';\nimport {assertNotComplex} from '../cpu_util';\nimport {transpose} from './Transpose';\n\nexport function prodImpl(\n xShape: number[], xDtype: DataType, xVals: TypedArray,\n reductionAxes: number[]):\n {outVals: TypedArray, outShape: number[], outDtype: DataType} {\n const [outShape, reduceShape] =\n backend_util.computeOutAndReduceShapes(xShape, reductionAxes);\n const outDtype = upcastType(xDtype, 'int32');\n const outVals = util.makeZerosTypedArray(\n util.sizeFromShape(outShape), outDtype) as TypedArray;\n const reduceSize = util.sizeFromShape(reduceShape);\n\n for (let i = 0; i < outVals.length; ++i) {\n const offset = i * reduceSize;\n let prod = 1;\n for (let j = 0; j < reduceSize; ++j) {\n prod *= xVals[offset + j];\n }\n outVals[i] = prod;\n }\n\n return {outVals, outShape, outDtype};\n}\n\nexport function prod(\n args: {inputs: ProdInputs, backend: MathBackendCPU, attrs: ProdAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {axis, keepDims} = attrs;\n\n assertNotComplex(x, 'prod');\n\n const xRank = x.shape.length;\n const axes = util.parseAxisParam(axis, x.shape);\n\n const permutation = backend_util.getAxesPermutation(axes, xRank);\n let reductionAxes = axes;\n let permutedX = x;\n const intermediateTensorInfos = [];\n if (permutation != null) {\n permutedX = transpose({inputs: {x}, backend, attrs: {perm: permutation}});\n intermediateTensorInfos.push(permutedX);\n reductionAxes = backend_util.getInnerMostAxes(reductionAxes.length, xRank);\n }\n\n const xVals = backend.data.get(permutedX.dataId).values as TypedArray;\n const {outVals, outShape, outDtype} =\n prodImpl(permutedX.shape, permutedX.dtype, xVals, reductionAxes);\n\n let resultShape = outShape;\n if (keepDims) {\n resultShape = backend_util.expandShapeToKeepDim(outShape, axes);\n }\n\n intermediateTensorInfos.forEach(\n t => backend.disposeIntermediateTensorInfo(t));\n\n return backend.makeTensorInfo(resultShape, outDtype, outVals);\n}\n\nexport const prodConfig: KernelConfig = {\n kernelName: Prod,\n backendName: 'cpu',\n kernelFunc: prod as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataType, TypedArray, util} from '@tensorflow/tfjs-core';\n\nfunction validateIndices(\n indices: TypedArray, indicesShape: number[], numParams: number) {\n indices.forEach((index: number, i: number) => {\n if (index < 0 || index >= numParams) {\n const locString =\n util.indexToLoc(\n i, indicesShape.length, util.computeStrides(indicesShape))\n .join(',');\n throw new Error(\n `indices[${locString}] = ${index} is not in [0, ${numParams})`);\n }\n });\n}\n\nfunction validateSplits(\n paramsNestedSplits: TypedArray[], numParamsDenseValues: number) {\n // Validate\n for (let dim = 0; dim < paramsNestedSplits.length; ++dim) {\n const splits = paramsNestedSplits[dim];\n const lastSplit = (dim === paramsNestedSplits.length - 1) ?\n numParamsDenseValues :\n paramsNestedSplits[dim + 1].length;\n if (splits.length === 0) {\n throw new Error('Ragged splits may not be empty');\n }\n if (splits[0] < 0) {\n throw new Error('Ragged splits must be non-negative');\n }\n if (splits[splits.length - 1] > lastSplit) {\n throw new Error('Ragged splits must not point past values');\n }\n for (let i = 1; i < splits.length; ++i) {\n if (splits[i - 1] > splits[i]) {\n throw new Error('Ragged splits must be sorted in ascending order');\n }\n }\n }\n}\n\n// Construct the `splits` output tensors, encoded using a nested vector.\n// Also find the slices of values that need to be copied, and store them\n// in `valueSlices`. The total number of values that will be copied (which\n// we need for allocating the output values tensor) is stored in `numValues`.\nfunction makeSplits(\n indices: TypedArray, indicesShape: number[],\n paramsNestedSplits: TypedArray[], numParamsDenseValues: number) {\n const valueSlices: Array<[number, number]> = [];\n let numValues = 0;\n\n const numSplits = indicesShape.length - 1 + paramsNestedSplits.length;\n const outSplits = new Array(numSplits).fill(null).map(() => [0]);\n\n validateSplits(paramsNestedSplits, numParamsDenseValues);\n\n // Add `splits` that come from all but the last dimension of the dense\n // Tensor `indices`. In particular, for each dimension D, we add a\n // splits tensor whose values are:\n // range(reduceProd(splits.shape[:D]) + 1) * splits.shape[D+1]\n // E.g., if indices.shape=[2, 3, 4] then we will add splits tensors:\n // [0, 3, 6] # length=2+1, stride=3\n // [0, 4, 8, 12, 16, 20, 24] # length=2*3+1, stride=4\n let nrows = 1;\n for (let dim = 0; dim < indicesShape.length - 1; ++dim) {\n nrows *= indicesShape[dim];\n const rowLength = indicesShape[dim + 1];\n for (let i = 1; i < nrows + 1; ++i) {\n outSplits[dim].push(i * rowLength);\n }\n }\n\n // Add `splits` that come from `paramsNestedSplits`. Starting with the\n // outermost ragged dimension (i.e., the first `splits` tensor), we work\n // our way in, finding the range of values that should be copied. As we\n // go, we update the output `splits` for each dimension with the appropriate\n // values. In particular, the *lengths* of the slices from `param_splits`\n // should be copied to generate corresponding slice lengths in the output\n // splits. E.g., if we are copying a ragged row with length 4, then we\n // should add a new split point to outSplits that is 4 greater than the\n // previous split point in outSplits.\n for (let i = 0; i < indices.length; ++i) {\n let start = indices[i];\n let limit = indices[i] + 1;\n\n // Copy splits.\n for (let dim = 0; dim < paramsNestedSplits.length; ++dim) {\n const splits = paramsNestedSplits[dim];\n const outDim = dim + indicesShape.length - 1;\n if (outDim >= 0) {\n const outSplitsOutDim = outSplits[outDim];\n const delta =\n outSplitsOutDim[outSplitsOutDim.length - 1] - splits[start];\n for (let j = start; j < limit; ++j) {\n outSplits[outDim].push(splits[j + 1] + delta);\n }\n }\n start = splits[start];\n limit = splits[limit];\n }\n if (limit !== start) {\n valueSlices.push([start, limit]);\n numValues += limit - start;\n }\n }\n\n return {outSplits, valueSlices, numValues};\n}\n\nfunction getSplits(outSplits: number[][]) {\n const splitsOut: TypedArray[] = [];\n for (let i = 0; i < outSplits.length; ++i) {\n const numSplits = outSplits[i].length;\n const splits = util.getArrayFromDType('int32', numSplits) as TypedArray;\n splitsOut.push(splits);\n\n outSplits[i].forEach((value, j: number) => splits[j] = value);\n }\n\n return splitsOut;\n}\n\nfunction computeFlatOuterDims(orig: number[], numOutDims: number) {\n const outDims = orig.slice(0, numOutDims);\n while (outDims.length < numOutDims) {\n outDims.push(1);\n }\n\n for (let inDim = numOutDims; inDim < orig.length; inDim++) {\n outDims[numOutDims - 1] *= orig[inDim];\n }\n\n return outDims;\n}\n// For each slice in `(start, limit)` in `valueSlices`, append\n// `paramsDenseValues[start,...,limit] to `values`. `valueSize` indicates\n// the number of scalars contained in each value paramsDenseValues[i].\nfunction writeValueSlices(\n paramsDenseValues: TypedArray, paramsDenseValuesShape: number[],\n valueSlices: Array<[number, number]>, valueSize: number, values: TypedArray,\n valuesShape: number[]) {\n const denseM = computeFlatOuterDims(paramsDenseValuesShape, 2)[1];\n const valuesM = computeFlatOuterDims(valuesShape, 2)[1];\n\n let outPos = 0;\n for (const slice of valueSlices) {\n for (let i = slice[0]; i < slice[1]; ++i) {\n for (let j = 0; j < valueSize; ++j) {\n values[outPos * valuesM + j] = paramsDenseValues[i * denseM + j];\n }\n ++outPos;\n }\n }\n}\n\nfunction getValues(\n paramsDenseValues: TypedArray, paramsDenseValuesShape: number[],\n paramsDenseValuesDType: DataType, valueSlices: Array<[number, number]>,\n numValues: number): [TypedArray, number[]] {\n const valuesShape = paramsDenseValuesShape.slice();\n valuesShape[0] = numValues;\n\n const valuesOut = util.getArrayFromDType(\n paramsDenseValuesDType,\n util.sizeFromShape(valuesShape)) as TypedArray;\n\n const numElements = paramsDenseValues.length;\n const valueSize =\n numElements === 0 ? 0 : (numElements / paramsDenseValuesShape[0]);\n writeValueSlices(\n paramsDenseValues, paramsDenseValuesShape, valueSlices, valueSize,\n valuesOut, valuesShape);\n\n return [valuesOut, valuesShape];\n}\nexport function raggedGatherImpl(\n paramsNestedSplits: TypedArray[], paramsNestedSplitsShapes: number[][],\n paramsDenseValues: TypedArray, paramsDenseValuesShape: number[],\n paramsDenseValuesDType: DataType, indices: TypedArray,\n indicesShape: number[],\n outputRaggedRank: number): [TypedArray[], TypedArray, number[]] {\n if (paramsNestedSplits.length === 0) {\n throw new Error('paramsNestedSplits must be non empty');\n }\n\n if (paramsNestedSplitsShapes[0].length === 0) {\n throw new Error('Split tensors must not be scalars');\n }\n const numParams = paramsNestedSplitsShapes[0][0] - 1;\n validateIndices(indices, indicesShape, numParams);\n\n if (paramsDenseValuesShape.length === 0) {\n throw new Error('params.rank must be nonzero');\n }\n const numParamsDenseValues = paramsDenseValuesShape[0];\n\n // Calculate the `splits`, and store the value slices that we need to\n // copy in `valueSlices`.\n const {outSplits, valueSlices, numValues} = makeSplits(\n indices, indicesShape, paramsNestedSplits, numParamsDenseValues);\n\n // Write the output tensors.\n const outputNestedSplits = getSplits(outSplits);\n const outputDenseValues = getValues(\n paramsDenseValues, paramsDenseValuesShape, paramsDenseValuesDType,\n valueSlices, numValues);\n\n return [outputNestedSplits, outputDenseValues[0], outputDenseValues[1]];\n}\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataType, TypedArray, util} from '@tensorflow/tfjs-core';\n\nconst INT32_MAX = 2147483647;\n\nexport function raggedRangeImpl(\n starts: TypedArray, startsShape: number[], startsDType: DataType,\n limits: TypedArray, limitsShape: number[], deltas: TypedArray,\n deltasShape: number[]): [TypedArray, TypedArray] {\n // Check input tensor shapes.\n if (startsShape.length > 1) {\n throw new Error('starts must be a scalar or vector');\n }\n if (limitsShape.length > 1) {\n throw new Error('limits must be a scalar or vector');\n }\n if (deltasShape.length > 1) {\n throw new Error('deltas must be a scalar or vector');\n }\n\n // Determine which tensors we need to broadcast.\n const broadcastStarts = startsShape.length === 0;\n const broadcastLimits = limitsShape.length === 0;\n const broadcastDeltas = deltasShape.length === 0;\n\n // nRows (number of output rows) is the size of the non-broadcast inputs,\n // or 1 if all inputs are scalars.\n const inSizes: number[] = [];\n if (!broadcastStarts) {\n inSizes.push(startsShape[0]);\n }\n if (!broadcastLimits) {\n inSizes.push(limitsShape[0]);\n }\n if (!broadcastDeltas) {\n inSizes.push(deltasShape[0]);\n }\n\n for (let i = 1; i < inSizes.length; ++i) {\n if (inSizes[i] !== inSizes[i - 1]) {\n throw new Error('starts, limits, and deltas must have the same shape');\n }\n }\n const nRows = inSizes.length === 0 ? 1 : inSizes[0];\n\n // Construct the rtNestedSplits tensor.\n const rtNestedSplits =\n util.getArrayFromDType('int32', nRows + 1) as TypedArray;\n rtNestedSplits[0] = 0;\n for (let row = 0; row < nRows; ++row) {\n const start = broadcastStarts ? starts[0] : starts[row];\n const limit = broadcastLimits ? limits[0] : limits[row];\n const delta = broadcastDeltas ? deltas[0] : deltas[row];\n if (delta === 0) {\n throw new Error('Requires delta != 0');\n }\n let size: number; // The number of elements in the specified range.\n if (((delta > 0) && (limit < start)) || ((delta < 0) && (limit > start))) {\n size = 0;\n } else {\n size = Math.ceil(Math.abs((limit - start) / delta));\n\n if (size > INT32_MAX) {\n throw new Error(`Requires ((limit - start) / delta) <= ${INT32_MAX}`);\n }\n }\n rtNestedSplits[row + 1] = rtNestedSplits[row] + size;\n }\n\n const nVals = rtNestedSplits[nRows];\n\n // Construct the rtDenseValues tensor.\n const rtDenseValues =\n util.getArrayFromDType(startsDType, nVals) as TypedArray;\n\n let valueIndex = 0;\n for (let row = 0; row < nRows; ++row) {\n const rowSize = rtNestedSplits[row + 1] - rtNestedSplits[row];\n let value = broadcastStarts ? starts[0] : starts[row];\n const delta = broadcastDeltas ? deltas[0] : deltas[row];\n for (let i = 0; i < rowSize; ++i) {\n rtDenseValues[valueIndex++] = value;\n value += delta;\n }\n }\n\n return [rtNestedSplits, rtDenseValues];\n}\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, broadcastTo, DataType, reshape, tidy, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport RowPartitionType = backend_util.RowPartitionType;\n// Based on\n// https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/kernels/ragged_tensor_to_tensor_op.cc\nclass RaggedTensorToTensorOp {\n private readonly rowPartitionTypes: RowPartitionType[];\n private readonly raggedRank: number;\n constructor(\n private shape: TypedArray, private shapeShape: number[],\n private values: TypedArray, private valuesShape: number[],\n private valuesDType: DataType, private defaultValue: TypedArray,\n private defaultValueShape: number[],\n private readonly rowPartitionValues: TypedArray[],\n private readonly rowPartitionValuesShapes: number[][],\n rowPartitionTypeStrings: string[]) {\n this.rowPartitionTypes =\n backend_util.getRowPartitionTypesHelper(rowPartitionTypeStrings);\n this.raggedRank = backend_util.getRaggedRank(this.rowPartitionTypes);\n }\n\n private getRowPartitionTypeByDimension(dimension: number) {\n if (this.rowPartitionTypes[0] === RowPartitionType.FIRST_DIM_SIZE) {\n return this.rowPartitionTypes[dimension + 1];\n } else {\n return this.rowPartitionTypes[dimension];\n }\n }\n\n // Returns the relationship between dimension and dimension + 1.\n private getRowPartitionTensor(dimension: number) {\n if (this.rowPartitionTypes[0] === RowPartitionType.FIRST_DIM_SIZE) {\n return this.rowPartitionValues[dimension + 1];\n } else {\n return this.rowPartitionValues[dimension];\n }\n }\n\n private getMaxWidth(dimension: number) {\n const rowPartitionTensor = this.getRowPartitionTensor(dimension - 1);\n switch (this.getRowPartitionTypeByDimension(dimension - 1)) {\n case RowPartitionType.VALUE_ROWIDS:\n return RaggedTensorToTensorOp.getMaxWidthValueRowID(rowPartitionTensor);\n case RowPartitionType.ROW_SPLITS:\n return RaggedTensorToTensorOp.getMaxWidthRowSplit(rowPartitionTensor);\n default:\n throw new Error(`Cannot handle partition type ${\n RowPartitionType[this.getRowPartitionTypeByDimension(\n dimension - 1)]}`);\n }\n }\n\n static getMaxWidthRowSplit(rowSplit: TypedArray) {\n const tensorLength = rowSplit.length;\n if (tensorLength === 0 || tensorLength === 1) {\n return 0;\n }\n let maxWidth = 0;\n for (let i = 0; i < tensorLength - 1; ++i) {\n const currentWidth = rowSplit[i + 1] - rowSplit[i];\n if (currentWidth > maxWidth) {\n maxWidth = currentWidth;\n }\n }\n return maxWidth;\n }\n\n static getMaxWidthValueRowID(valueRowIds: TypedArray) {\n const indexLength = valueRowIds.length;\n if (indexLength === 0) {\n return 0;\n }\n let firstEqualIndex = 0;\n let firstEqualIndexValue = valueRowIds[0];\n let maxWidth = 0;\n for (let i = 1; i < indexLength; ++i) {\n const value = valueRowIds[i];\n if (value !== firstEqualIndexValue) {\n firstEqualIndexValue = value;\n maxWidth = Math.max(i - firstEqualIndex, maxWidth);\n firstEqualIndex = i;\n }\n }\n return Math.max(indexLength - firstEqualIndex, maxWidth);\n }\n\n private tensorShapeFromTensor(\n t: TypedArray, tShape: number[], isPartial = true) {\n if (tShape.length === 0) {\n if (t[0] === -1) {\n return [];\n }\n throw new Error(\n `The only valid scalar shape tensor is the fully unknown shape specified as -1.`);\n }\n // MakePartialShape/MakeShapeHelper.\n return makeShape(t, isPartial);\n }\n\n private calculateOutputSize(firstDim: number) {\n const valueShape = this.valuesShape;\n const defaultValueShape = this.defaultValueShape;\n\n backend_util.validateDefaultValueShape(defaultValueShape, valueShape);\n\n const shape = this.tensorShapeFromTensor(this.shape, this.shapeShape);\n const outputShape = backend_util.combineRaggedTensorToTensorShapes(\n this.raggedRank, shape, valueShape);\n\n const result = outputShape;\n\n if (result[0] < 0) {\n result[0] = firstDim;\n }\n for (let i = 1; i <= this.raggedRank; ++i) {\n if (result[i] < 0) {\n result[i] = this.getMaxWidth(i);\n }\n }\n\n return result;\n }\n\n /**\n * The outputIndex represents the index in the output tensor\n * where the first element of a particular dimension would be written.\n * If it is -1, it indicates that the index is out of scope.\n * Example, given firstDimension = 10, firstDimensionOutput = 6,\n * and outputIndexMultiplier = 100:\n * result = [0 100 200 300 400 500 -1 -1 -1 -1]\n * If firstDimensionOutput = 11 instead, then:\n * result = [0 100 200 300 400 500 600 700 800 900]\n */\n private calculateFirstParentOutputIndex(\n firstDimension: number, outputIndexMultiplier: number,\n firstDimensionOutput: number) {\n const minDimension = Math.min(firstDimension, firstDimensionOutput);\n const result: number[] = [];\n let currentOutputIndex = 0;\n for (let i = 0; i < minDimension;\n ++i, currentOutputIndex += outputIndexMultiplier) {\n result.push(currentOutputIndex);\n }\n for (let i = minDimension; i < firstDimension; ++i) {\n result.push(-1);\n }\n util.assert(\n result.length === firstDimension,\n () => 'Final length of result must be equal to firstDimension.');\n\n return result;\n }\n\n private calculateOutputIndexRowSplit(\n rowSplit: TypedArray, parentOutputIndex: number[],\n outputIndexMultiplier: number, outputSize: number) {\n const rowSplitSize = rowSplit.length;\n const result: number[] = [];\n for (let i = 0; i < rowSplitSize - 1; ++i) {\n const rowLength = rowSplit[i + 1] - rowSplit[i];\n let realLength = Math.min(outputSize, rowLength);\n let parentOutputIndexCurrent = parentOutputIndex[i];\n\n if (parentOutputIndexCurrent === -1) {\n realLength = 0;\n }\n for (let j = 0; j < realLength; ++j) {\n result.push(parentOutputIndexCurrent);\n parentOutputIndexCurrent += outputIndexMultiplier;\n }\n for (let j = 0; j < rowLength - realLength; ++j) {\n result.push(-1);\n }\n }\n if (rowSplitSize > 0 && result.length !== rowSplit[rowSplitSize - 1]) {\n throw new Error('Invalid row split size.');\n }\n\n return result;\n }\n\n // Calculate the output index of the first element of a list.\n // The parentOutputIndex is the same computation for the previous list.\n // -1 indicates an element or list that is out of range.\n // The outputIndexMultiplier is the number of output indices one moves\n // forward for each column.\n // E.g., given:\n // valueRowIds:[0 1 2 2 2 3 5 5 6]\n // parentOutputIndex:[1000 1100 2000 2100 -1 3000 4000]\n // outputIndexMultiplier: 10\n // outputSize: 2\n // You get:\n // result = [1000 1100 2000 2010 -1 2100 -1 -1 3000]\n // result[0] = parentOutputIndex[valueRowIds[0]]\n // result[1] = parentOutputIndex[valueRowIds[1]]\n // result[2] = parentOutputIndex[valueRowIds[2]]\n // result[3] = parentOutputIndex[valueRowIds[2] + 10]\n // result[4] = -1 because it is the third element the size is 2.\n // result[5] = parentOutputIndex[valueRowIds[3]]\n // result[6] = -1 because parentOutputIndex[valueRowIds[6]] == -1\n // result[7] = -1 because parentOutputIndex[valueRowIds[6]] == -1\n // result[8] = parentOutputIndex[valueRowIds[7]]\n private calculateOutputIndexValueRowID(\n valueRowIds: TypedArray, parentOutputIndex: number[],\n outputIndexMultiplier: number, outputSize: number) {\n const indexSize = valueRowIds.length;\n const result: number[] = [];\n if (indexSize === 0) {\n return [];\n }\n\n let currentOutputColumn = 0;\n let currentValueRowId = valueRowIds[0];\n\n if (currentValueRowId >= parentOutputIndex.length) {\n throw new Error(\n `Got currentValueRowId=${currentValueRowId}, which is not less than ${\n parentOutputIndex.length}`);\n }\n\n let currentOutputIndex = parentOutputIndex[currentValueRowId];\n result.push(currentOutputIndex);\n for (let i = 1; i < indexSize; ++i) {\n const nextValueRowId = valueRowIds[i];\n if (nextValueRowId === currentValueRowId) {\n if (currentOutputIndex >= 0) {\n ++currentOutputColumn;\n if (currentOutputColumn < outputSize) {\n currentOutputIndex += outputIndexMultiplier;\n } else {\n currentOutputIndex = -1;\n }\n }\n } else {\n currentOutputColumn = 0;\n currentValueRowId = nextValueRowId;\n\n if (nextValueRowId >= parentOutputIndex.length) {\n throw new Error(\n `Got nextValueRowId=${nextValueRowId} which is not less than ${\n parentOutputIndex.length}`);\n }\n\n currentOutputIndex = parentOutputIndex[nextValueRowId];\n }\n result.push(currentOutputIndex);\n }\n\n if (result.length !== valueRowIds.length) {\n throw new Error('Invalid row ids.');\n }\n\n return result;\n }\n\n private calculateOutputIndex(\n dimension: number, parentOutputIndex: number[],\n outputIndexMultiplier: number, outputSize: number) {\n const rowPartitionTensor = this.getRowPartitionTensor(dimension);\n const partitionType = this.getRowPartitionTypeByDimension(dimension);\n switch (partitionType) {\n case RowPartitionType.VALUE_ROWIDS:\n return this.calculateOutputIndexValueRowID(\n rowPartitionTensor, parentOutputIndex, outputIndexMultiplier,\n outputSize);\n case RowPartitionType.ROW_SPLITS:\n if (rowPartitionTensor.length - 1 > parentOutputIndex.length) {\n throw new Error(`Row partition size is greater than output size: ${\n rowPartitionTensor.length - 1} > ${parentOutputIndex.length}`);\n }\n return this.calculateOutputIndexRowSplit(\n rowPartitionTensor, parentOutputIndex, outputIndexMultiplier,\n outputSize);\n default:\n throw new Error(\n `Unsupported partition type: ${RowPartitionType[partitionType]}`);\n }\n }\n\n private getFirstDimensionSize() {\n const firstPartitionTensor = this.rowPartitionValues[0];\n if (this.rowPartitionTypes.length === 0) {\n throw new Error('No row_partition_types given.');\n }\n const firstPartitionType = this.rowPartitionTypes[0];\n switch (firstPartitionType) {\n case RowPartitionType.FIRST_DIM_SIZE:\n return firstPartitionTensor[0];\n case RowPartitionType.VALUE_ROWIDS:\n throw new Error('Cannot handle VALUE_ROWIDS in first dimension.');\n case RowPartitionType.ROW_SPLITS:\n return this.rowPartitionValuesShapes[0][0] - 1;\n default:\n throw new Error(\n `Cannot handle type ${RowPartitionType[firstPartitionType]}`);\n }\n }\n\n compute(): [number[], TypedArray] {\n const firstPartitionTensor = this.rowPartitionValues[0];\n if (firstPartitionTensor.length <= 0) {\n throw new Error(\n 'Invalid first partition input. ' +\n 'Tensor requires at least one element.');\n }\n const firstDimension = this.getFirstDimensionSize();\n const outputSize = this.calculateOutputSize(firstDimension);\n const multiplier: number[] = new Array(this.raggedRank + 1);\n\n multiplier[multiplier.length - 1] = 1;\n for (let i = multiplier.length - 2; i >= 0; --i) {\n multiplier[i] = multiplier[i + 1] * outputSize[i + 1];\n }\n // Full size of the tensor.\n const outputShape: number[] = makeShape(outputSize, false);\n const outputTensor =\n util.getArrayFromDType(\n this.valuesDType, util.sizeFromShape(outputShape)) as TypedArray;\n\n const fullSize = multiplier[0] * outputSize[0];\n if (fullSize > 0) {\n let outputIndex = this.calculateFirstParentOutputIndex(\n firstDimension, multiplier[0], outputSize[0]);\n for (let i = 1; i <= this.raggedRank; ++i) {\n const newOutputIndex = this.calculateOutputIndex(\n i - 1, outputIndex, multiplier[i], outputSize[i]);\n outputIndex = newOutputIndex;\n }\n\n this.setOutput(this.raggedRank, outputIndex, outputTensor, outputShape);\n }\n\n return [outputShape, outputTensor];\n }\n setOutput(\n raggedRank: number, outputIndex: number[], outputTensor: TypedArray,\n outputShape: number[]) {\n if (outputTensor.length === 0) {\n return;\n }\n\n const valuesBase = this.values;\n const outputBase = outputTensor;\n\n let elementShape = outputShape.slice();\n elementShape = elementShape.slice(raggedRank + 1);\n const valueElementSize = util.sizeFromShape(elementShape);\n const outputIndexSize = outputIndex.length;\n\n // Broadcast the default value to value_element_size. (We can skip this\n // if defaultValueTensor.size == 1, since we use fill when that's true.)\n let defaultValue = this.defaultValue;\n if (defaultValue.length !== valueElementSize && defaultValue.length !== 1) {\n const srcShape = this.defaultValueShape;\n tidy(() => {\n const defaultValueTensor = reshape(defaultValue, srcShape);\n const bCastDefault = broadcastTo(defaultValueTensor, elementShape);\n defaultValue = bCastDefault.dataSync();\n });\n }\n\n // Loop through the outputIndex array, finding contiguous regions that\n // should be copied. Once we find the end of a contiguous region, copy it\n // and add any necessary padding (with defaultValue).\n let srcStart = 0; // Start of contiguous region (in values)\n let dstStart = 0; // Destination for contiguous region (in output)\n let dstEnd = 0; // Destination for contiguous region (in output)\n for (let srcI = 0; srcI <= outputIndexSize; ++srcI) {\n // dstI is the destination where the value at srcI should be copied.\n let dstI = srcI < outputIndexSize ? outputIndex[srcI] : -1;\n\n // If we're still in a contiguous region, then update dstEnd go to the\n // next srcI.\n if (dstI === dstEnd) {\n ++dstEnd;\n continue;\n }\n\n // We found the end of contiguous region. This can be because we found\n // a gap (dstI > dstEnd), or a source value that shouldn't be copied\n // because it's out-of-bounds (dstI == -1), or the end of the tensor\n // (dstI === -1).\n if (dstStart < dstEnd) {\n // Copy the contiguous region.\n const src = valuesBase.subarray(srcStart * valueElementSize);\n const dst = outputBase.subarray(dstStart * valueElementSize);\n const nVals = (dstEnd - dstStart) * valueElementSize;\n copyArray(dst, src, nVals);\n }\n\n // Add any necessary padding (w/ defaultValue).\n if (srcI >= outputIndexSize) {\n // We reached the end of values: pad to the end of output.\n const outputSize = outputTensor.length;\n dstI = Math.floor(outputSize / valueElementSize);\n }\n if (dstI > dstEnd) {\n if (this.defaultValue.length === 1) {\n outputBase\n .subarray(dstEnd * valueElementSize, dstI * valueElementSize)\n .fill(this.defaultValue[0]);\n dstEnd = dstI;\n } else {\n while (dstI > dstEnd) {\n const dst = outputBase.slice(dstEnd * valueElementSize);\n copyArray(dst, defaultValue, valueElementSize);\n ++dstEnd;\n }\n }\n }\n\n // Update indices.\n if (dstI < 0) {\n // srcI should be skipped -- leave it out of the contiguous region.\n srcStart = srcI + 1;\n dstStart = dstEnd;\n } else {\n // srcI should be copied -- include it in the contiguous region.\n srcStart = srcI;\n dstStart = dstEnd;\n dstEnd = dstStart + 1;\n }\n }\n }\n}\n\nfunction copyArray(dst: TypedArray, src: TypedArray, size: number) {\n for (let i = 0; i < size; i++) {\n dst[i] = src[i];\n }\n}\n\nfunction makeShape(shape: number[]|TypedArray, isPartial: boolean) {\n const out: number[] = [];\n for (let dim of shape) {\n if (dim < 0) {\n if (!isPartial) {\n throw new Error(`Dimension ${dim} must be >= 0`);\n }\n if (dim < -1) {\n throw new Error(`Dimension ${dim} must be >= -1`);\n }\n dim = -1;\n }\n out.push(dim);\n }\n\n return out;\n}\n\nexport function raggedTensorToTensorImpl(\n shape: TypedArray, shapesShape: number[], values: TypedArray,\n valuesShape: number[], valuesDType: DataType, defaultValue: TypedArray,\n defaultValueShape: number[], rowPartitionValues: TypedArray[],\n rowPartitionValuesShapes: number[][],\n rowPartitionTypes: string[]): [number[], TypedArray] {\n return new RaggedTensorToTensorOp(\n shape, shapesShape, values, valuesShape, valuesDType, defaultValue,\n defaultValueShape, rowPartitionValues, rowPartitionValuesShapes,\n rowPartitionTypes)\n .compute();\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataTypeMap, util} from '@tensorflow/tfjs-core';\n\nexport function rangeImpl(\n start: number, stop: number, step: number,\n dtype: 'float32'|'int32'): DataTypeMap['float32' | 'int32'] {\n const sameStartStop = start === stop;\n const increasingRangeNegativeStep = start < stop && step < 0;\n const decreasingRangePositiveStep = stop < start && step > 1;\n\n if (sameStartStop || increasingRangeNegativeStep ||\n decreasingRangePositiveStep) {\n return util.makeZerosTypedArray(0, dtype);\n }\n\n const numElements = Math.abs(Math.ceil((stop - start) / step));\n const values = util.makeZerosTypedArray(numElements, dtype);\n\n if (stop < start && step === 1) {\n // Auto adjust the step's sign if it hasn't been set\n // (or was set to 1)\n step = -1;\n }\n\n values[0] = start;\n for (let i = 1; i < values.length; i++) {\n values[i] = values[i - 1] + step;\n }\n return values;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the License);\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an AS IS BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Rsqrt} from '@tensorflow/tfjs-core';\n\nimport {createSimpleUnaryImpl} from '../utils/unary_impl';\nimport {unaryKernelFuncFromImpl} from '../utils/unary_utils';\n\nexport const rsqrtImpl = createSimpleUnaryImpl((xi) => 1 / Math.sqrt(xi));\nexport const rsqrt = unaryKernelFuncFromImpl(Rsqrt, rsqrtImpl);\n\nexport const rsqrtConfig: KernelConfig = {\n kernelName: Rsqrt,\n backendName: 'cpu',\n kernelFunc: rsqrt,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {buffer, Rank, ShapeMap, TensorBuffer, TypedArray} from '@tensorflow/tfjs-core';\n\ninterface DefaultValueTypeMap {\n bool: boolean;\n int32: number;\n float32: number;\n string: string;\n}\n\nexport function\nscatterImpl(\n indices: TensorBuffer, updates: TensorBuffer,\n shape: number[], outputSize: number, sliceSize: number, numUpdates: number,\n sliceRank: number, strides: number[], defaultValue: DefaultValueTypeMap[D],\n sumDupeIndices: boolean): TensorBuffer {\n const flattenShape = [outputSize / sliceSize, sliceSize];\n\n const indicesData = indices.values as TypedArray;\n const updatesData = updates.values;\n\n if (outputSize === 0) {\n return buffer(shape as ShapeMap[R], updates.dtype);\n }\n\n const outBuf = buffer(flattenShape, updates.dtype);\n if (typeof defaultValue === 'string') {\n (outBuf.values as string[]).fill(defaultValue);\n } else if (typeof defaultValue === 'number') {\n (outBuf.values as TypedArray).fill(defaultValue);\n } else if (typeof defaultValue === 'boolean') {\n (outBuf.values as TypedArray).fill(+defaultValue);\n }\n\n for (let i = 0; i < numUpdates; i++) {\n const index = [];\n let flattenIndex = 0;\n for (let j = 0; j < sliceRank; j++) {\n const dim = indicesData[i * sliceRank + j];\n index.push(dim);\n flattenIndex += dim * strides[j];\n }\n\n if (flattenIndex < 0 || flattenIndex >= outputSize / sliceSize) {\n throw new Error(`Invalid indices: ${index} does not index into ${shape}`);\n }\n\n for (let k = 0; k < sliceSize; k++) {\n if (sumDupeIndices) {\n (outBuf.values as TypedArray)[flattenIndex * sliceSize + k] +=\n (updatesData as TypedArray)[i * sliceSize + k];\n } else {\n outBuf.values[flattenIndex * sliceSize + k] = updates.rank === 0 ?\n updatesData[0] :\n updatesData[i * sliceSize + k];\n }\n }\n }\n\n return outBuf as TensorBuffer;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the License);\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an AS IS BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Sigmoid} from '@tensorflow/tfjs-core';\n\nimport {createSimpleUnaryImpl} from '../utils/unary_impl';\nimport {unaryKernelFunc} from '../utils/unary_utils';\n\nexport const sigmoidImpl =\n createSimpleUnaryImpl((xi) => 1 / (1 + Math.exp(-xi)));\nexport const sigmoid =\n unaryKernelFunc(Sigmoid, (xi) => 1 / (1 + Math.exp(-xi)));\n\nexport const sigmoidConfig: KernelConfig = {\n kernelName: Sigmoid,\n backendName: 'cpu',\n kernelFunc: sigmoid,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, BackendValues, buffer, DataType, KernelConfig, KernelFunc, Slice, slice_util, SliceAttrs, SliceInputs, TensorInfo, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendCPU} from '../backend_cpu';\nimport {assertNotComplex} from '../cpu_util';\n\nexport function sliceImpl(\n vals: BackendValues, begin: number[], size: number[], shape: number[],\n dtype: DataType): BackendValues {\n const isContinous = slice_util.isSliceContinous(shape, begin, size);\n const length = util.sizeFromShape(size);\n const xStrides = util.computeStrides(shape);\n\n if (isContinous) {\n const flatOffset = slice_util.computeFlatOffset(begin, xStrides);\n\n if (dtype === 'string') {\n return (vals as Uint8Array[]).slice(flatOffset, flatOffset + length);\n }\n\n return (vals as TypedArray).subarray(flatOffset, flatOffset + length);\n }\n\n const decodedData = dtype === 'string' ?\n backend_util.fromUint8ToStringArray(vals as Uint8Array[]) :\n vals as TypedArray;\n\n const inBuf = buffer(shape, dtype, decodedData);\n const outBuf = buffer(size, dtype);\n for (let i = 0; i < outBuf.size; ++i) {\n const outLoc = outBuf.indexToLoc(i);\n const inLoc = outLoc.map((idx: number, j) => idx + begin[j]);\n outBuf.set(inBuf.get(...inLoc), ...outLoc);\n }\n\n if (dtype === 'string') {\n return backend_util.fromStringArrayToUint8(outBuf.values as string[]);\n }\n return outBuf.values as TypedArray;\n}\n\nexport function slice(\n args: {inputs: SliceInputs, backend: MathBackendCPU, attrs: SliceAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {begin, size} = attrs;\n\n assertNotComplex(x, 'slice');\n\n const [$begin, $size] = slice_util.parseSliceParams(x, begin, size);\n slice_util.assertParamsValid(x, $begin, $size);\n\n const vals = backend.data.get(x.dataId).values;\n const outVals = sliceImpl(vals, $begin, $size, x.shape, x.dtype);\n return backend.makeTensorInfo($size, x.dtype, outVals);\n}\n\nexport const sliceConfig: KernelConfig = {\n kernelName: Slice,\n backendName: 'cpu',\n kernelFunc: slice as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, DataType, TypedArray, util} from '@tensorflow/tfjs-core';\n\nexport function sparseFillEmptyRowsImpl(\n indices: TypedArray, indicesShape: number[], indicesDType: DataType,\n values: TypedArray, valuesDType: DataType, denseShape: TypedArray,\n defaultValue: number):\n [TypedArray, number[], TypedArray, boolean[], number[]] {\n const indicesCount = indicesShape[0];\n const denseRows = denseShape[0];\n\n const emptyRowIndicator: boolean[] = new Array(denseRows);\n const reverseIndexMap: number[] = new Array(indicesCount);\n\n const rank = indicesShape[1];\n\n if (denseRows === 0) {\n if (indicesCount !== 0) {\n throw new Error(\n backend_util.getSparseFillEmptyRowsIndicesDenseShapeMismatch(\n indicesCount));\n }\n const outputIndices = util.getArrayFromDType(indicesDType, 0) as TypedArray;\n const outputValues = util.getArrayFromDType(valuesDType, 0) as TypedArray;\n return [\n outputIndices, [0, rank], outputValues, emptyRowIndicator, reverseIndexMap\n ];\n }\n\n let rowsAreOrdered = true;\n let lastIndicesRow = 0;\n const csrOffset: number[] = new Array(denseRows).fill(0);\n\n for (let i = 0; i < indicesCount; ++i) {\n // indices is a 2d tensor with shape of [N, rank]\n const row = indices[i * rank];\n if (row < 0) {\n throw new Error(\n backend_util.getSparseFillEmptyRowsNegativeIndexErrorMessage(i, row));\n }\n if (row >= denseRows) {\n throw new Error(\n backend_util.getSparseFillEmptyRowsOutOfRangeIndexErrorMessage(\n i, row, denseRows));\n }\n ++csrOffset[row];\n rowsAreOrdered = rowsAreOrdered && (row >= lastIndicesRow);\n lastIndicesRow = row;\n }\n\n let allRowsFull = true;\n for (let row = 0; row < denseRows; ++row) {\n // csrOffset here describes the number of elements in this dense row\n const rowEmpty = (csrOffset[row] === 0);\n emptyRowIndicator[row] = rowEmpty;\n allRowsFull = allRowsFull && !rowEmpty;\n // In filled version, each row has at least one element.\n csrOffset[row] = Math.max(csrOffset[row], 1);\n // Update csrOffset to represent the number of elements up to and\n // including denseRows + 1:\n // csrOffset[0] == #{elements of row 0}\n // csrOffset[1] == #{elements of row 1} + #{elements of row 0}\n // ..\n // csrOffset[i] == starting index for elements in row i + 1.\n if (row > 0) {\n csrOffset[row] += csrOffset[row - 1];\n }\n }\n\n if (allRowsFull && rowsAreOrdered) {\n const outputIndices: TypedArray = indices;\n const outputValues: TypedArray = values;\n for (let i = 0; i < indicesCount; ++i) {\n reverseIndexMap[i] = i;\n }\n return [\n outputIndices, [indicesCount, rank], outputValues, emptyRowIndicator,\n reverseIndexMap\n ];\n } else {\n const fullIndicesCount = csrOffset[denseRows - 1];\n const outputIndices =\n util.getArrayFromDType(indicesDType, fullIndicesCount * rank) as\n TypedArray;\n const outputValues =\n util.getArrayFromDType(valuesDType, fullIndicesCount) as TypedArray;\n const filledCount: number[] = new Array(denseRows).fill(0);\n\n // Fill in values for rows that are not missing\n for (let i = 0; i < indicesCount; ++i) {\n // indices is a 2d tensor with shape of [N, rank]\n const row = indices[i * rank];\n const offset = filledCount[row];\n const outputI = ((row === 0) ? 0 : csrOffset[row - 1]) + offset;\n filledCount[row]++; // Increment the filled count for this row.\n for (let j = 0; j < rank; ++j) {\n // indices and outputIndices are 2d tensors with shape of [N, rank]\n outputIndices[outputI * rank + j] = indices[i * rank + j];\n }\n outputValues[outputI] = values[i];\n // We'll need this reverse index map to backprop correctly.\n reverseIndexMap[i] = outputI;\n }\n\n // Fill in values for rows that are missing\n for (let row = 0; row < denseRows; ++row) {\n const rowCount = filledCount[row];\n if (rowCount === 0) { // We haven't filled this row\n const startingIndex = (row === 0) ? 0 : csrOffset[row - 1];\n // Remaining index values were set to zero already.\n // Just need to set the row index in the right location.\n // outputIndices is a 2d tensor with shape of [N, rank]\n outputIndices[startingIndex * rank + 0] = row;\n for (let col = 1; col < rank; ++col) {\n outputIndices[startingIndex * rank + col] = 0;\n }\n outputValues[startingIndex] = defaultValue;\n }\n }\n return [\n outputIndices, [fullIndicesCount, rank], outputValues, emptyRowIndicator,\n reverseIndexMap\n ];\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, DataType, TypedArray, util} from '@tensorflow/tfjs-core';\n\nexport function sparseReshapeImpl(\n inputIndices: TypedArray, inputIndicesShape: number[], inputDType: DataType,\n inputShape: number[],\n targetShape: number[]): [TypedArray, number[], number[]] {\n const denseSize = util.sizeFromShape(inputShape);\n const nnz = inputIndicesShape[0];\n const outputRank = targetShape.length;\n\n // Compute the output shape. Determine product of specified dimensions, and\n // find the index of the unspecified one.\n const outputShape: number[] = [];\n let product = 1;\n let unknownIndex = -1;\n for (let d = 0; d < outputRank; ++d) {\n const size = targetShape[d];\n if (size === -1) {\n if (unknownIndex !== -1) {\n throw new Error(\n backend_util\n .getSparseReshapeMultipleNegativeOneOutputDimErrorMessage(\n unknownIndex, d));\n }\n unknownIndex = d;\n outputShape.push(1);\n } else {\n if (size < 0) {\n throw new Error(\n backend_util.getSparseReshapeNegativeOutputDimErrorMessage(\n d, size));\n }\n product *= size;\n outputShape.push(size);\n }\n }\n if (unknownIndex !== -1) {\n if (product <= 0) {\n throw new Error(\n backend_util.getSparseReshapeEmptyTensorZeroOutputDimErrorMessage());\n }\n const missing = Math.trunc(denseSize / product);\n if (product * missing !== denseSize) {\n throw new Error(\n backend_util.getSparseReshapeInputOutputMultipleErrorMessage(\n inputShape, outputShape));\n }\n\n outputShape[unknownIndex] = missing;\n }\n const outputSize = util.sizeFromShape(outputShape);\n if (outputSize !== denseSize) {\n throw new Error(\n backend_util.getSparseReshapeInputOutputMismatchErrorMessage(\n inputShape, outputShape));\n }\n\n const inputRank = inputShape.length;\n const inputStrides: number[] = [];\n if (inputRank > 0) {\n inputStrides[inputRank - 1] = 1;\n for (let d = inputRank - 2; d >= 0; --d) {\n inputStrides[d] = inputStrides[d + 1] * inputShape[d + 1];\n }\n }\n\n const outputStrides: number[] = [];\n if (outputRank > 0) {\n outputStrides[outputRank - 1] = 1;\n for (let d = outputRank - 2; d >= 0; --d) {\n outputStrides[d] = outputStrides[d + 1] * outputShape[d + 1];\n }\n }\n\n const newIndices =\n util.getArrayFromDType(inputDType, nnz * outputRank) as TypedArray;\n for (let i = 0; i < nnz; ++i) {\n let id = 0;\n for (let j = 0; j < inputRank; ++j) {\n // inputIndices is a 2d tensor with shape of [nnz, inputRank]\n id += inputIndices[i * inputRank + j] * inputStrides[j];\n }\n for (let j = 0; j < outputRank; ++j) {\n // newIndices is a 2d tensor with shape of [nnz, outputRank]\n newIndices[i * outputRank + j] = Math.trunc(id / outputStrides[j]);\n id %= outputStrides[j];\n }\n }\n return [newIndices, [nnz, outputRank], outputShape];\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, DataType, TypedArray, util} from '@tensorflow/tfjs-core';\n\nexport function sparseSegmentReductionImpl(\n input: TypedArray, inputShape: number[], inputDType: DataType,\n indices: TypedArray, segmentIds: TypedArray, isMean = false,\n defaultValue = 0): [TypedArray, number[]] {\n const numIndices = indices.length;\n\n // Flatten the array to two dimensions\n const inputFlat: number[] = [inputShape[0], input.length / inputShape[0]];\n const numCol = inputFlat[1];\n // Note that the current implementation assumes that segmentIds values are\n // sorted.\n const lastSegmentIdPlusOne =\n numIndices > 0 ? segmentIds[numIndices - 1] + 1 : 0;\n const outputRows = lastSegmentIdPlusOne;\n\n if (outputRows < 0) {\n throw new Error(\n backend_util.getSparseSegmentReductionNegativeSegmentIdsErrorMessage());\n }\n\n const outputShape = inputShape.slice();\n outputShape[0] = outputRows;\n\n const outputLength =\n outputShape.reduce((product, value) => product * value, 1);\n // Output array is initialized with the value 0 by default.\n const output = util.getArrayFromDType(inputDType, outputLength) as TypedArray;\n\n // Note that we do not initialize the output buffer with a default value, so\n // we need to explicitly set missing indices to the default value.\n if (numIndices === 0) {\n if (outputRows > 0) {\n output.fill(defaultValue);\n }\n return [output, outputShape];\n }\n\n if (outputRows <= 0) {\n throw new Error(\n backend_util.getSparseSegmentReductionNegativeSegmentIdsErrorMessage());\n }\n\n let start = 0, end = 1;\n // Index from which the output is not initialized.\n let uninitializedIndex = 0;\n let outIndex = segmentIds[start];\n\n while (true) {\n // We initialize nextIndex to 0 to avoid may be uninitialized warning\n let nextIndex = 0;\n if (end < numIndices) {\n nextIndex = segmentIds[end];\n if (outIndex === nextIndex) {\n ++end;\n continue;\n }\n // We have a new segment here. Verify that the segment ids are growing.\n if (outIndex >= nextIndex) {\n throw new Error(backend_util\n .getSparseSegmentReductionNonIncreasingSegmentIdsErrorMessage());\n }\n }\n\n if (outIndex < 0 || outIndex >= outputRows) {\n throw new Error(\n backend_util.getSparseSegmentReductionSegmentIdOutOfRangeErrorMessage(\n outIndex, outputRows));\n }\n\n // If there is a gap between two indices, we need to set that gap to the\n // default value.\n if (outIndex > uninitializedIndex) {\n output.fill(defaultValue, uninitializedIndex * numCol, outIndex * numCol);\n }\n\n for (let i = start; i < end; ++i) {\n const index = indices[i];\n if (index < 0 || index >= inputFlat[0]) {\n throw new Error(\n backend_util.getSparseSegmentReductionIndicesOutOfRangeErrorMessage(\n i, indices[i], inputFlat[0]));\n }\n for (let j = 0; j < numCol; j++) {\n output[outIndex * numCol + j] += input[index * numCol + j];\n }\n }\n\n if (isMean) {\n for (let j = 0; j < numCol; j++) {\n output[outIndex * numCol + j] /= end - start;\n }\n }\n\n start = end;\n ++end;\n uninitializedIndex = outIndex + 1;\n outIndex = nextIndex;\n if (end > numIndices) {\n break;\n }\n }\n\n // Fill the gap at the end with the default value.\n if (uninitializedIndex < outputRows) {\n output.fill(defaultValue, uninitializedIndex * numCol, outputRows * numCol);\n }\n\n return [output, outputShape];\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the License);\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an AS IS BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Sqrt} from '@tensorflow/tfjs-core';\n\nimport {createSimpleUnaryImpl} from '../utils/unary_impl';\nimport {unaryKernelFunc} from '../utils/unary_utils';\n\nexport const sqrtImpl = createSimpleUnaryImpl((xi) => Math.sqrt(xi));\nexport const sqrt = unaryKernelFunc(Sqrt, (xi) => Math.sqrt(xi));\n\nexport const sqrtConfig: KernelConfig = {\n kernelName: Sqrt,\n backendName: 'cpu',\n kernelFunc: sqrt,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, SquaredDifference} from '@tensorflow/tfjs-core';\n\nimport {createSimpleBinaryKernelImpl} from '../utils/binary_impl';\nimport {binaryKernelFunc} from '../utils/binary_utils';\n\nexport const squaredDifferenceImpl =\n createSimpleBinaryKernelImpl(((a: number, b: number) => {\n const diff = a - b;\n return diff * diff;\n }));\nexport const squaredDifference =\n binaryKernelFunc(SquaredDifference, squaredDifferenceImpl);\n\nexport const squaredDifferenceConfig: KernelConfig = {\n kernelName: SquaredDifference,\n backendName: 'cpu',\n kernelFunc: squaredDifference\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {buffer, Rank, TensorBuffer} from '@tensorflow/tfjs-core';\n\nexport function stridedSliceImpl(\n outShape: number[], xBuf: TensorBuffer, strides: number[],\n begin: number[]): TensorBuffer {\n const outBuf = buffer(outShape, xBuf.dtype);\n\n for (let i = 0; i < outBuf.size; i++) {\n const loc = outBuf.indexToLoc(i);\n\n const newLoc: number[] = new Array(loc.length);\n for (let j = 0; j < newLoc.length; j++) {\n newLoc[j] = loc[j] * strides[j] + begin[j];\n }\n outBuf.set(xBuf.get(...newLoc), ...loc);\n }\n\n return outBuf as TensorBuffer;\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {util} from '@tensorflow/tfjs-core';\n\n/**\n * The StringNGramsOp class creates ngrams from ragged string data.\n * The constructor contains all attributes related to the operation such as\n * padding widths and strings, and the compute function can be used to\n * compute the ngrams for different ragged tensor inputs.\n */\nclass StringNGramsOp {\n private separator: Uint8Array;\n private nGramWidths: number[];\n private padWidth: number;\n private leftPad: Uint8Array;\n private rightPad: Uint8Array;\n private preserveShort: boolean;\n\n constructor(\n separator: string, nGramWidths: number[], leftPad: string,\n rightPad: string, padWidth: number, preserveShortSequences: boolean) {\n this.separator = util.encodeString(separator);\n this.nGramWidths = nGramWidths;\n this.leftPad = util.encodeString(leftPad);\n this.rightPad = util.encodeString(rightPad);\n this.padWidth = padWidth;\n this.preserveShort = preserveShortSequences;\n }\n\n private getPadWidth(nGramWidth: number) {\n // Ngrams can be padded with either a fixed pad width or a dynamic pad\n // width depending on the 'padWidth' arg, but in no case should the padding\n // ever be wider than 'nGramWidth' - 1.\n return Math.min(\n this.padWidth < 0 ? nGramWidth - 1 : this.padWidth, nGramWidth - 1);\n }\n\n private getNumNGrams(length: number, nGramWidth: number) {\n const padWidth = this.getPadWidth(nGramWidth);\n return Math.max(0, ((length + 2 * padWidth) - nGramWidth) + 1);\n }\n\n private createNGrams(\n data: Uint8Array[], splitIndex: number, output: Uint8Array[],\n outputStartIndex: number, numNGrams: number, nGramWidth: number) {\n for (let nGramIndex = 0; nGramIndex < numNGrams; ++nGramIndex) {\n const padWidth = this.getPadWidth(nGramWidth);\n const leftPadding = Math.max(0, padWidth - nGramIndex);\n const rightPadding =\n Math.max(0, padWidth - (numNGrams - (nGramIndex + 1)));\n const numTokens = nGramWidth - (leftPadding + rightPadding);\n const dataStartIndex =\n splitIndex + (leftPadding > 0 ? 0 : nGramIndex - padWidth);\n\n // Calculate the total expected size of the nGram so we can reserve the\n // correct amount of space in the string.\n let nGramSize = 0;\n // Size of the left padding.\n nGramSize += leftPadding * this.leftPad.length;\n // Size of the tokens.\n for (let n = 0; n < numTokens; ++n) {\n nGramSize += data[dataStartIndex + n].length;\n }\n // Size of the right padding.\n nGramSize += rightPadding * this.rightPad.length;\n // Size of the separators.\n const numSeparators = leftPadding + rightPadding + numTokens - 1;\n nGramSize += numSeparators * this.separator.length;\n\n // Build the nGram.\n output[outputStartIndex + nGramIndex] = new Uint8Array(nGramSize);\n const nGram = output[outputStartIndex + nGramIndex];\n\n let nextNGramIndex = 0;\n const appendToNGram = (str: Uint8Array) =>\n str.forEach((value) => nGram[nextNGramIndex++] = value);\n\n for (let n = 0; n < leftPadding; ++n) {\n appendToNGram(this.leftPad);\n appendToNGram(this.separator);\n }\n // Only output first numTokens - 1 pairs of data and separator\n for (let n = 0; n < numTokens - 1; ++n) {\n appendToNGram(data[dataStartIndex + n]);\n appendToNGram(this.separator);\n }\n // Handle case when there are no tokens or no right padding as these\n // can result in consecutive separators.\n if (numTokens > 0) {\n // If we have tokens, then output last and then pair each separator\n // with the right padding that follows, to ensure nGram ends either with\n // the token or with the right pad.\n appendToNGram(data[dataStartIndex + numTokens - 1]);\n for (let n = 0; n < rightPadding; ++n) {\n appendToNGram(this.separator);\n appendToNGram(this.rightPad);\n }\n } else {\n // If we don't have tokens, then the last item inserted into the nGram\n // has been the separator from the left padding loop above. Hence,\n // output right pad and separator and make sure to finish with a\n // padding, not a separator.\n for (let n = 0; n < rightPadding - 1; ++n) {\n appendToNGram(this.rightPad);\n appendToNGram(this.separator);\n }\n appendToNGram(this.rightPad);\n }\n }\n }\n\n // Data and splits together form the definition of the ragged tensor,\n // where data is 1 dimensional and contains the values of the tensor\n // and splits denotes the indices at which each row starts.\n public compute(data: Uint8Array[], splits: Int32Array):\n [Uint8Array[], Int32Array] {\n // Validate that the splits are valid indices into data, only if there are\n // splits specified.\n const inputDataSize = data.length;\n const splitsSize = splits.length;\n if (splitsSize > 0) {\n let prevSplit = splits[0];\n if (prevSplit !== 0) {\n throw new Error(`First split value must be 0, got ${prevSplit}`);\n }\n for (let i = 1; i < splitsSize; ++i) {\n let validSplits = splits[i] >= prevSplit;\n validSplits = validSplits && (splits[i] <= inputDataSize);\n if (!validSplits) {\n throw new Error(`Invalid split value ${splits[i]}, must be in [${\n prevSplit}, ${inputDataSize}]`);\n }\n prevSplit = splits[i];\n }\n if (prevSplit !== inputDataSize) {\n throw new Error(`Last split value must be data size. Expected ${\n inputDataSize}, got ${prevSplit}`);\n }\n }\n\n const numBatchItems = splitsSize - 1;\n const nGramsSplits = util.getArrayFromDType('int32', splitsSize);\n // If there is no data or size, return an empty ragged tensor.\n if (inputDataSize === 0 || splitsSize === 0) {\n const empty: Uint8Array[] = new Array(inputDataSize);\n for (let i = 0; i <= numBatchItems; ++i) {\n nGramsSplits[i] = 0;\n }\n return [empty, nGramsSplits];\n }\n\n nGramsSplits[0] = 0;\n for (let i = 1; i <= numBatchItems; ++i) {\n const length = splits[i] - splits[i - 1];\n let numNGrams = 0;\n this.nGramWidths.forEach((nGramWidth) => {\n numNGrams += this.getNumNGrams(length, nGramWidth);\n });\n if (this.preserveShort && length > 0 && numNGrams === 0) {\n numNGrams = 1;\n }\n nGramsSplits[i] = nGramsSplits[i - 1] + numNGrams;\n }\n\n const nGrams: Uint8Array[] = new Array(nGramsSplits[numBatchItems]);\n\n for (let i = 0; i < numBatchItems; ++i) {\n const splitIndex = splits[i];\n let outputStartIdx = nGramsSplits[i];\n this.nGramWidths.forEach((nGramWidth) => {\n const length = splits[i + 1] - splits[i];\n const numNGrams = this.getNumNGrams(length, nGramWidth);\n this.createNGrams(\n data, splitIndex, nGrams, outputStartIdx, numNGrams, nGramWidth);\n outputStartIdx += numNGrams;\n });\n // If we're preserving short sequences, check to see if no sequence was\n // generated by comparing the current output start idx to the original\n // one (nGramSplitsdata). If no ngrams were generated, then they will\n // be equal (since we increment outputStartIdx by numNGrams every\n // time we create a set of ngrams.)\n if (this.preserveShort && outputStartIdx === nGramsSplits[i]) {\n const dataLength = splits[i + 1] - splits[i];\n // One legitimate reason to not have any ngrams when this.preserveShort\n // is true is if the sequence itself is empty. In that case, move on.\n if (dataLength === 0) {\n continue;\n }\n // We don't have to worry about dynamic padding sizes here: if padding\n // was dynamic, every sequence would have had sufficient padding to\n // generate at least one nGram.\n const nGramWidth = dataLength + 2 * this.padWidth;\n const numNGrams = 1;\n this.createNGrams(\n data, splitIndex, nGrams, outputStartIdx, numNGrams, nGramWidth);\n }\n }\n return [nGrams, nGramsSplits];\n }\n}\n\nexport function stringNGramsImpl(\n data: Uint8Array[], dataSplits: Int32Array, separator: string,\n nGramWidths: number[], leftPad: string, rightPad: string, padWidth: number,\n preserveShortSequences: boolean): [Uint8Array[], Int32Array] {\n return new StringNGramsOp(\n separator, nGramWidths, leftPad, rightPad, padWidth,\n preserveShortSequences)\n .compute(data, dataSplits);\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {TypedArray, util} from '@tensorflow/tfjs-core';\n\nfunction split(\n str: Uint8Array, delimiters: Uint8Array, skipEmpty: boolean,\n result: Uint8Array[]): void {\n if (!str.length) {\n return;\n }\n // When the delimiter is empty, the input is split into individual characters.\n if (delimiters.length === 0) {\n for (let i = 0; i < str.length; ++i) {\n result.push(str.subarray(i, i + 1));\n }\n return;\n }\n // When there is one delimiter, the input is split only at that delimiter.\n if (delimiters.length === 1) {\n const delimiter = delimiters[0];\n let f = str.indexOf(delimiter);\n while (f !== -1) {\n const token = str.subarray(0, f);\n if (!skipEmpty || token.length !== 0) {\n result.push(token);\n }\n str = str.subarray(f + 1);\n f = str.indexOf(delimiter);\n }\n if (!skipEmpty || str.length !== 0) {\n result.push(str);\n }\n return;\n }\n // When there are multiple delimiters, the input is split at every instance\n // one of the delimiters appears.\n let tokenStart = 0;\n for (let i = 0; i < str.length + 1; i++) {\n if ((i === str.length) || (delimiters.indexOf(str[i]) !== -1)) {\n const token = str.subarray(tokenStart, i);\n if (!skipEmpty || token.length !== 0) {\n result.push(token);\n }\n tokenStart = i + 1;\n }\n }\n}\n\nexport function stringSplitImpl(\n input: Uint8Array[], delimiter: Uint8Array,\n skipEmpty: boolean): [TypedArray, Uint8Array[], [number, number]] {\n const batchSize = input.length;\n\n // Empty delimiter means split the input character by character.\n const tokens: Uint8Array[] = [];\n\n let outputSize = 0;\n let maxNumEntries = 0;\n const numIndices: number[] = new Array(batchSize);\n for (let i = 0; i < batchSize; ++i) {\n const prevTokensLength = tokens.length;\n split(input[i], delimiter, skipEmpty, tokens);\n const nEntries = tokens.length - prevTokensLength;\n numIndices[i] = nEntries;\n outputSize += nEntries;\n maxNumEntries = Math.max(maxNumEntries, nEntries);\n }\n\n const indices = util.getArrayFromDType('int32', outputSize * 2) as TypedArray;\n const values: Uint8Array[] = new Array(outputSize);\n const shape: [number, number] = [batchSize, maxNumEntries];\n\n let c = 0;\n for (let i = 0; i < batchSize; ++i) {\n for (let j = 0; j < numIndices[i]; ++j) {\n // indices is a 2d tensor with shape of [outputSize, 2]\n indices[c * 2] = i;\n indices[c * 2 + 1] = j;\n values[c] = tokens[c];\n ++c;\n }\n }\n\n return [indices, values, shape];\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {TypedArray, util} from '@tensorflow/tfjs-core';\n\nexport function stringToHashBucketFastImpl(\n input: Uint8Array[], numBuckets: number): TypedArray {\n const output = util.getArrayFromDType('int32', input.length) as TypedArray;\n\n for (let i = 0; i < input.length; ++i) {\n output[i] =\n util.fingerPrint64(input[i]).modulo(numBuckets).getLowBitsUnsigned();\n }\n\n return output;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Sub} from '@tensorflow/tfjs-core';\n\nimport {createSimpleBinaryKernelImpl} from '../utils/binary_impl';\nimport {binaryKernelFunc, createComplexBinaryKernelImpl} from '../utils/binary_utils';\n\nexport const subImpl = createSimpleBinaryKernelImpl(\n ((aValue: number, bValue: number) => aValue - bValue));\nexport const subComplexImpl =\n createComplexBinaryKernelImpl(((aReal, aImag, bReal, bImag) => {\n return {real: aReal - bReal, imag: aImag - bImag};\n }));\nexport const sub = binaryKernelFunc(Sub, subImpl, subComplexImpl);\n\nexport const subConfig: KernelConfig = {\n kernelName: Sub,\n backendName: 'cpu',\n kernelFunc: sub\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {buffer, DataType, Rank, TensorBuffer} from '@tensorflow/tfjs-core';\n\n/**\n * An implementation of the tile kernel shared between webgl and cpu for string\n * tensors only.\n */\n\nexport function tileImpl(\n xBuf: TensorBuffer,\n reps: number[]): TensorBuffer {\n const newShape: number[] = new Array(xBuf.rank);\n for (let i = 0; i < newShape.length; i++) {\n newShape[i] = xBuf.shape[i] * reps[i];\n }\n const result = buffer(newShape, xBuf.dtype);\n for (let i = 0; i < result.values.length; ++i) {\n const newLoc = result.indexToLoc(i);\n\n const originalLoc: number[] = new Array(xBuf.rank);\n for (let j = 0; j < originalLoc.length; j++) {\n originalLoc[j] = newLoc[j] % xBuf.shape[j];\n }\n\n const originalIndex = xBuf.locToIndex(originalLoc);\n\n result.values[i] = xBuf.values[originalIndex];\n }\n return result as TensorBuffer;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/** An implementation of the TopK kernel shared between webgl and cpu. */\n\nimport {buffer, NumericDataType, Rank, ShapeMap, Tensor, TensorBuffer, TypedArray, util} from '@tensorflow/tfjs-core';\n\ntype Pair = {\n value: number,\n index: number\n};\n\nconst comparePair = (a: Pair, b: Pair) => {\n const valueDiff = b.value - a.value;\n return valueDiff === 0 ? a.index - b.index : valueDiff;\n};\n\n/**\n * Partitions array where all elements smaller than the (k+1) smallest element\n * are found to the left of it, and all larger to the right of it.\n * Based on the Floyd-Rivest Algorithm, ref:\n * https://en.wikipedia.org/wiki/Floyd%E2%80%93Rivest_algorithm\n * @param array: Array to partition\n * @param left: Left index for the interval\n * @param right: Right index for the interval\n * @param k: Desired index value, where array[k] is the (k+1)th smallest element\n * when left = 0\n */\nfunction select(array: Pair[], k: number, left = 0, right = array.length - 1) {\n while (right > left) {\n // Use select recursively to sample a smaller set of size s\n // the arbitrary constants 600 and 0.5 are used in the original\n // version to minimize execution time.\n if (right - left > 600) {\n const n = right - left + 1;\n const i = k - left + 1;\n const z = Math.log(n);\n const s = 0.5 * Math.exp(2 * z / 3);\n const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * Math.sign(i - n / 2);\n const newLeft = Math.max(left, Math.floor(k - i * s / n + sd));\n const newRight = Math.min(right, Math.floor(k + (n - i) * s / n + sd));\n select(array, k, newLeft, newRight);\n }\n // partition the elements between left and right around t\n const t = array[k];\n let i = left;\n let j = right;\n\n util.swap(array, left, k);\n\n if (comparePair(array[right], t) > 0) {\n util.swap(array, left, right);\n }\n while (i < j) {\n util.swap(array, i, j);\n i++;\n j--;\n while (comparePair(array[i], t) < 0) {\n i = i + 1;\n }\n while (comparePair(array[j], t) > 0) {\n j = j - 1;\n }\n }\n if (comparePair(array[left], t) === 0) {\n util.swap(array, left, j);\n } else {\n j = j + 1;\n util.swap(array, j, right);\n }\n // Adjust left and right towards the boundaries of the subset\n // containing the (k - left + 1)th smallest element.\n if (j <= k) {\n left = j + 1;\n }\n if (k <= j) {\n right = j - 1;\n }\n }\n}\n\nexport function topKImpl(\n x: TypedArray, xShape: number[], xDtype: NumericDataType, k: number,\n sorted: boolean):\n [TensorBuffer, TensorBuffer] {\n // Reshape into a 2d tensor [batch, lastDim] and compute topk along lastDim.\n const lastDim = xShape[xShape.length - 1];\n const [batch, size] = [x.length / lastDim, lastDim];\n const allTopKVals = util.getTypedArrayFromDType(xDtype, batch * k);\n const allTopKIndices = util.getTypedArrayFromDType('int32', batch * k);\n\n for (let b = 0; b < batch; b++) {\n const offset = b * size;\n const vals = x.subarray(offset, offset + size);\n\n let valAndInd: Pair[] = new Array(vals.length);\n vals.forEach(\n (value: number, index: number) => valAndInd[index] = {value, index});\n\n if (k < valAndInd.length) {\n select(valAndInd, k);\n valAndInd = valAndInd.slice(0, k);\n }\n\n if (sorted) {\n valAndInd.sort(comparePair);\n }\n \n const outOffset = b * k;\n const topKVals = allTopKVals.subarray(outOffset, outOffset + k);\n const topKIndices = allTopKIndices.subarray(outOffset, outOffset + k);\n for (let i = 0; i < k; i++) {\n topKVals[i] = valAndInd[i].value;\n topKIndices[i] = valAndInd[i].index;\n }\n }\n // Reshape back to the original input shape, except that the last\n // dimension is k.\n const outputShape = xShape.slice();\n outputShape[outputShape.length - 1] = k;\n\n return [\n buffer(outputShape as ShapeMap[R], xDtype, allTopKVals),\n buffer(outputShape as ShapeMap[R], 'int32', allTopKIndices)\n ];\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {BackendValues, DataType, TensorBuffer, TypedArray, util} from '@tensorflow/tfjs-core';\n\nexport function uniqueImpl(\n values: BackendValues, axis: number, shape: number[], dtype: DataType): {\n outputValues: BackendValues,\n outputShape: number[],\n indices: BackendValues\n} {\n // Normalize and validate axis.\n const $axis = util.parseAxisParam(axis, shape)[0];\n\n // Calculate the new shape that is suitable for extracting data along the\n // given axis.\n //\n // The rank is 3.\n // The size of the 1st dimension is the size of all the axes < the given axis.\n // The size of the 2nd dimension is the same as the size of the given axis.\n // The size of the 3rd dimension is the size of all the axes > the given axis.\n //\n // For example, for a 4D tensor with shape=[2, 3, 5, 4] and axis=2, the\n // newShape would be: [2*3, 5, 4].\n //\n // Note that this is not the final output shape. This will be the shape for an\n // intermediate TensorBuffer (see inputBuffer below) to allow us to extract\n // values along the given axis. To demonstrate how it works, consider the\n // following example:\n //\n // Input: a 3D tensor, with shape [1, 2, 3]\n // [\n // [\n // [1,2,3],\n // [4,5,6]\n // ]\n // ]\n // Axis: 2 (the last axis).\n // Along axis 2, we expect to extract 3 tensors: [1,4], [2,5], [3,6].\n //\n // For this example, newShape would be: [2, 3, 1], where 2 is calculated from\n // 1*2. The re-shaped data would look like:\n //\n // [\n // [\n // [1], [2], [3]\n // ],\n // [\n // [4], [5], [6]\n // ]\n // ]\n //\n // Then, we can construct a 3-level nested loop by the following dimension\n // order to extract the values along the axis (dimension1):\n // i: dimension1 // 0,1,2 (newShape[1])\n // m: dimension0 // 0,1 (newShape[0])\n // n: dimension2 // 0 (newShape[2])\n //\n // m, i, n\n // ---------\n // Iteration 0: data at [0, 0, 0] => \"1\"\n // Iteration 1: data at [1, 0, 0] => \"4\"\n // We got [1,4].\n // Iteration 2: data at [0, 1, 0] => \"2\"\n // Iteration 3: data at [1, 1, 0] => \"5\"\n // We got [2,5].\n // Iteration 4: data at [0, 2, 0] => \"3\"\n // Iteration 5: data at [1, 2, 0] => \"6\"\n // We got [3,6].\n const newShape = [1, shape[0], 1];\n for (let i = 0; i < $axis; i++) {\n newShape[0] *= shape[i];\n }\n newShape[1] = shape[$axis];\n for (let i = $axis + 1; i < shape.length; i++) {\n newShape[2] *= shape[i];\n }\n\n // A map from unique elements (their string representations) to their values\n // in \"indices\" (below).\n const uniqueElements: {[key: string]: number} = {};\n // The indices of each unique element in the original tensor along the given\n // axis. It is 1D and has the same size as the given axis.\n const indices = new Int32Array(shape[$axis]);\n // Create a buffer so we can easily extract value at a given location.\n const inputBuffer = new TensorBuffer(newShape, dtype, values as TypedArray);\n // The indices along the given axis that have unique elements. This is a\n // de-duped version of \"indices\" above.\n const uniqueIndices: number[] = [];\n const is1DTensor = newShape[0] === 1 && newShape[2] === 1;\n for (let i = 0; i < shape[$axis]; i++) {\n // Extract values along the axis.\n let element: string;\n if (is1DTensor) {\n // Fast path for 1D tensor input.\n element = values[i].toString();\n } else {\n const axisValues = [];\n for (let m = 0; m < newShape[0]; m++) {\n for (let n = 0; n < newShape[2]; n++) {\n axisValues.push(inputBuffer.get(m, i, n));\n }\n }\n element = axisValues.join(',');\n }\n\n // Dedup and update various indices.\n if (uniqueElements[element] !== undefined) {\n indices[i] = uniqueElements[element];\n } else {\n const uniqueIndex = Object.keys(uniqueElements).length;\n uniqueElements[element] = uniqueIndex;\n indices[i] = uniqueIndex;\n uniqueIndices.push(i);\n }\n }\n\n // Now we know where each of the unique elements are located along the axis\n // (uniqueIndices). Extract them from input buffer and store them in the\n // output buffer.\n const outputTmpShape = newShape.slice();\n outputTmpShape[1] = Object.keys(uniqueElements).length;\n const outputBuffer = new TensorBuffer(outputTmpShape, dtype);\n uniqueIndices.forEach((uniqueElementIndex, i) => {\n for (let m = 0; m < newShape[0]; m++) {\n for (let n = 0; n < newShape[2]; n++) {\n outputBuffer.set(inputBuffer.get(m, uniqueElementIndex, n), m, i, n);\n }\n }\n });\n\n // The output shape can be calculated from the input shape with the size of\n // the given axis replaced by the number of unique elements along that axis.\n const outputShape = shape.slice();\n outputShape[$axis] = outputTmpShape[1];\n\n return {\n outputValues: outputBuffer.values as BackendValues,\n outputShape,\n indices,\n };\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// Shared functionality among backends.\nexport {simpleAbsImpl} from './kernels/Abs';\nexport {addImpl} from './kernels/Add';\nexport {bincountImpl, bincountReduceImpl} from './kernels/Bincount_impl';\nexport {castImpl} from './kernels/Cast';\nexport {ceilImpl} from './kernels/Ceil';\nexport {concatImpl} from './kernels/Concat_impl';\nexport {equalImpl} from './kernels/Equal';\nexport {expImpl} from './kernels/Exp';\nexport {expm1Impl} from './kernels/Expm1';\nexport {floorImpl} from './kernels/Floor';\nexport {gatherNdImpl} from './kernels/GatherNd_Impl';\nexport {gatherV2Impl} from './kernels/GatherV2_impl';\nexport {greaterImpl} from './kernels/Greater';\nexport {greaterEqualImpl} from './kernels/GreaterEqual';\nexport {lessImpl} from './kernels/Less';\nexport {lessEqualImpl} from './kernels/LessEqual';\nexport {linSpaceImpl} from './kernels/LinSpace_impl';\nexport {logImpl} from './kernels/Log';\nexport {maxImpl} from './kernels/Max_impl';\nexport {maximumImpl} from './kernels/Maximum';\nexport {minimumImpl} from './kernels/Minimum';\nexport {multiplyImpl} from './kernels/Multiply';\nexport {negImpl} from './kernels/Neg';\nexport {notEqualImpl} from './kernels/NotEqual';\nexport {prodImpl} from './kernels/Prod';\nexport {raggedGatherImpl} from './kernels/RaggedGather_impl';\nexport {raggedRangeImpl} from './kernels/RaggedRange_impl';\nexport {raggedTensorToTensorImpl} from './kernels/RaggedTensorToTensor_impl';\nexport {rangeImpl} from './kernels/Range_impl';\nexport {rsqrtImpl} from './kernels/Rsqrt';\nexport {scatterImpl} from './kernels/Scatter_impl';\nexport {sigmoidImpl} from './kernels/Sigmoid';\nexport {sliceImpl} from './kernels/Slice';\nexport {sparseFillEmptyRowsImpl} from './kernels/SparseFillEmptyRows_impl';\nexport {sparseReshapeImpl} from './kernels/SparseReshape_impl';\nexport {sparseSegmentReductionImpl} from './kernels/SparseSegmentReduction_impl';\nexport {sqrtImpl} from './kernels/Sqrt';\nexport {squaredDifferenceImpl} from './kernels/SquaredDifference';\nexport {stridedSliceImpl} from './kernels/StridedSlice_impl';\nexport {stringNGramsImpl} from './kernels/StringNGrams_impl';\nexport {stringSplitImpl} from './kernels/StringSplit_impl';\nexport {stringToHashBucketFastImpl} from './kernels/StringToHashBucketFast_impl';\nexport {subImpl} from './kernels/Sub';\nexport {tileImpl} from './kernels/Tile_impl';\nexport {topKImpl} from './kernels/TopK_impl';\nexport {transposeImpl} from './kernels/Transpose_impl';\nexport {uniqueImpl} from './kernels/Unique_impl';\nexport {ComplexBinaryKernelImpl, SimpleBinaryKernelImpl} from './utils/binary_types';\n","\n/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// Import shared functionality from tfjs-backend-cpu without triggering\n// side effects.\n// tslint:disable-next-line: no-imports-from-dist\nimport * as shared from '@tensorflow/tfjs-backend-cpu/dist/shared';\n// tslint:disable-next-line: no-imports-from-dist\nimport {SimpleBinaryKernelImpl} from '@tensorflow/tfjs-backend-cpu/dist/shared';\n// tslint:disable-next-line: no-imports-from-dist\nimport {SimpleUnaryImpl} from '@tensorflow/tfjs-backend-cpu/dist/utils/unary_types';\n\nexport type SimpleBinaryKernelImplCPU = SimpleBinaryKernelImpl;\nexport type SimpleUnaryKernelImplCPU = SimpleUnaryImpl;\nconst {\n addImpl: addImplCPU,\n bincountImpl: bincountImplCPU,\n bincountReduceImpl: bincountReduceImplCPU,\n castImpl: castImplCPU,\n ceilImpl: ceilImplCPU,\n concatImpl: concatImplCPU,\n equalImpl: equalImplCPU,\n expImpl: expImplCPU,\n expm1Impl: expm1ImplCPU,\n floorImpl: floorImplCPU,\n gatherNdImpl: gatherNdImplCPU,\n gatherV2Impl: gatherV2ImplCPU,\n greaterImpl: greaterImplCPU,\n greaterEqualImpl: greaterEqualImplCPU,\n lessImpl: lessImplCPU,\n lessEqualImpl: lessEqualImplCPU,\n linSpaceImpl: linSpaceImplCPU,\n logImpl: logImplCPU,\n maxImpl: maxImplCPU,\n maximumImpl: maximumImplCPU,\n minimumImpl: minimumImplCPU,\n multiplyImpl: multiplyImplCPU,\n negImpl: negImplCPU,\n notEqualImpl: notEqualImplCPU,\n prodImpl: prodImplCPU,\n raggedGatherImpl: raggedGatherImplCPU,\n raggedRangeImpl: raggedRangeImplCPU,\n raggedTensorToTensorImpl: raggedTensorToTensorImplCPU,\n rangeImpl: rangeImplCPU,\n rsqrtImpl: rsqrtImplCPU,\n scatterImpl: scatterImplCPU,\n sigmoidImpl: sigmoidImplCPU,\n simpleAbsImpl: simpleAbsImplCPU,\n sliceImpl: sliceImplCPU,\n sparseFillEmptyRowsImpl: sparseFillEmptyRowsImplCPU,\n sparseReshapeImpl: sparseReshapeImplCPU,\n sparseSegmentReductionImpl: sparseSegmentReductionImplCPU,\n sqrtImpl: sqrtImplCPU,\n stridedSliceImpl: stridedSliceImplCPU,\n stringNGramsImpl: stringNGramsImplCPU,\n stringSplitImpl: stringSplitImplCPU,\n stringToHashBucketFastImpl: stringToHashBucketFastImplCPU,\n subImpl: subImplCPU,\n tileImpl: tileImplCPU,\n topKImpl: topKImplCPU,\n transposeImpl: transposeImplCPU,\n uniqueImpl: uniqueImplCPU,\n} = shared;\n\nexport {\n addImplCPU,\n bincountImplCPU,\n bincountReduceImplCPU,\n castImplCPU,\n ceilImplCPU,\n concatImplCPU,\n equalImplCPU,\n expImplCPU,\n expm1ImplCPU,\n floorImplCPU,\n gatherNdImplCPU,\n gatherV2ImplCPU,\n greaterEqualImplCPU,\n greaterImplCPU,\n lessEqualImplCPU,\n lessImplCPU,\n linSpaceImplCPU,\n logImplCPU,\n maxImplCPU,\n maximumImplCPU,\n minimumImplCPU,\n multiplyImplCPU,\n negImplCPU,\n notEqualImplCPU,\n prodImplCPU,\n raggedGatherImplCPU,\n raggedRangeImplCPU,\n raggedTensorToTensorImplCPU,\n scatterImplCPU,\n sigmoidImplCPU,\n simpleAbsImplCPU,\n sliceImplCPU,\n sparseFillEmptyRowsImplCPU,\n sparseReshapeImplCPU,\n sparseSegmentReductionImplCPU,\n sqrtImplCPU,\n stridedSliceImplCPU,\n stringNGramsImplCPU,\n stringSplitImplCPU,\n stringToHashBucketFastImplCPU,\n subImplCPU,\n rangeImplCPU,\n rsqrtImplCPU,\n tileImplCPU,\n topKImplCPU,\n transposeImplCPU,\n uniqueImplCPU,\n};\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nexport function getVecChannels(name: string, rank: number): string[] {\n return ['x', 'y', 'z', 'w', 'u', 'v'].slice(0, rank).map(d => `${name}.${d}`);\n}\n\nexport function getChannels(name: string, rank: number): string[] {\n if (rank === 1) {\n return [name];\n }\n return getVecChannels(name, rank);\n}\n\nexport function getSourceCoords(rank: number, dims: string[]): string {\n if (rank === 1) {\n return 'rc';\n }\n\n let coords = '';\n for (let i = 0; i < rank; i++) {\n coords += dims[i];\n if (i < rank - 1) {\n coords += ',';\n }\n }\n return coords;\n}","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram, useShapeUniforms} from './gpgpu_math';\nimport {getChannels} from './packing_util';\nimport {getCoordsDataType} from './shader_compiler';\n\nexport class PackProgram implements GPGPUProgram {\n variableNames = ['A'];\n outputShape: number[];\n userCode: string;\n packedInputs = false;\n packedOutput = true;\n enableShapeUniforms: boolean;\n rank: number;\n\n constructor(\n outputShape:\n number[]) { // TODO(https://github.com/tensorflow/tfjs/issues/893):\n // Only input / output 3D tensors.\n this.outputShape = outputShape;\n this.rank = outputShape.length;\n this.enableShapeUniforms = useShapeUniforms(this.outputShape.length);\n\n if (this.rank === 0) {\n this.userCode = `\n void main() {\n setOutput(vec4(getA(), 0., 0., 0.));\n }\n `;\n } else {\n const channels = getChannels('rc', this.rank);\n const dtype = getCoordsDataType(this.rank);\n const outOfBoundsCondition = this.getOutOfBoundsCondition(channels);\n const setup = this.getSetup(channels);\n const output = this.getOutput(channels);\n\n this.userCode = `\n void main() {\n ${dtype} rc = getOutputCoords();\n\n if(${outOfBoundsCondition}) {\n setOutput(vec4(0));\n } else {\n ${setup}\n\n setOutput(vec4(${output}));\n }\n }\n `;\n }\n }\n\n private getSourceCoordsArr(dims: string[]): string[] {\n const coords = [];\n\n for (let row = 0; row <= 1; row++) {\n for (let col = 0; col <= 1; col++) {\n let coord = `${row === 0 ? 'r' : 'rp1'}, ${col === 0 ? 'c' : 'cp1'}`;\n\n for (let d = 2; d < this.rank; d++) {\n coord = `${dims[dims.length - 1 - d]},` + coord;\n }\n\n coords.push(coord);\n }\n }\n return coords;\n }\n\n private getOutOfBoundsCondition(dims: string[]): string {\n if (this.rank === 1) {\n return `rc > ${\n this.enableShapeUniforms ? 'outShape' : this.outputShape[0]}`;\n }\n\n let cond = '';\n for (let i = this.rank - 2; i < this.rank; i++) {\n cond += `${dims[i]} >= ${\n this.enableShapeUniforms ? `outShape[${i}]` : this.outputShape[i]}`;\n if (i < this.rank - 1) {\n cond += '||';\n }\n }\n\n return cond;\n }\n\n private getSetup(dims: string[]): string {\n if (this.rank === 1) {\n return '';\n }\n\n const innerDims = dims.slice(-2);\n const col = this.enableShapeUniforms ? `outShape[${this.rank} - 1]` :\n this.outputShape[this.rank - 1];\n const row = this.enableShapeUniforms ? `outShape[${this.rank} - 2]` :\n this.outputShape[this.rank - 2];\n\n return `\n int r = ${innerDims[0]};\n int c = ${innerDims[1]};\n int rp1 = r + 1;\n int cp1 = c + 1;\n\n bool cEdge = cp1 >= ${col};\n bool rEdge = rp1 >= ${row};\n `;\n }\n\n private getOutput(dims: string[]): string {\n const sourceCoords = this.getSourceCoordsArr(dims);\n if (this.rank === 1) {\n const outShape =\n this.enableShapeUniforms ? 'outShape' : this.outputShape[0];\n return `getA(rc), (rc + 1 >= ${outShape} ? 0. : getA(rc + 1)), 0, 0`;\n }\n\n return `getA(${sourceCoords[0]}),\n cEdge ? 0. : getA(${sourceCoords[1]}),\n rEdge ? 0. : getA(${sourceCoords[2]}),\n rEdge || cEdge ? 0. : getA(${sourceCoords[3]})`;\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram, useShapeUniforms} from './gpgpu_math';\nimport * as shader_util from './shader_compiler_util';\n\nexport class ReshapePackedProgram implements GPGPUProgram {\n variableNames = ['A'];\n packedInputs = true;\n packedOutput = true;\n outputShape: number[];\n userCode: string;\n enableShapeUniforms: boolean;\n customUniforms = [{name: 'inputShape', type: 'ivec3' as const }];\n\n constructor(outputShape: [number, number, number], inputShape: [\n number, number, number\n ]) {\n this.outputShape = outputShape;\n this.enableShapeUniforms = useShapeUniforms(this.outputShape.length);\n\n let mainLoop = ``;\n for (let i = 0; i < 4; i++) {\n let thisRC = `thisRC = rc;`;\n if (i % 2 === 1) {\n thisRC += `thisRC.z += 1;`;\n }\n if (i > 1) {\n thisRC += `thisRC.y += 1;`;\n }\n\n mainLoop += `\n ${thisRC}\n ${i > 0 ? `if(thisRC.y < rows && thisRC.z < cols){` : ''}\n int flatIndex = getFlatIndex(thisRC);\n\n ivec3 inputRC = inputCoordsFromReshapedOutCoords(flatIndex);\n vec2 inputRCInnerDims = vec2(float(inputRC.y),float(inputRC.z));\n\n result[${i}] =\n getChannel(getA(inputRC.x, inputRC.y, inputRC.z), inputRCInnerDims);\n ${i > 0 ? '}' : ''}\n `;\n }\n\n this.userCode = `\n ${getReshapedInputCoords(inputShape, this.enableShapeUniforms)}\n ${\n this.enableShapeUniforms ? shader_util.getFlatIndexFrom3DOutput() :\n shader_util.getFlatIndexFrom3D(outputShape)}\n\n void main() {\n ivec3 rc = getOutputCoords();\n\n vec4 result = vec4(0.);\n\n ivec3 thisRC;\n int rows = ${this.enableShapeUniforms ? 'outShape[1]' : outputShape[1]};\n int cols = ${this.enableShapeUniforms ? 'outShape[2]' : outputShape[2]};\n\n ${mainLoop}\n\n setOutput(result);\n }\n `;\n }\n}\n\nfunction getReshapedInputCoords(\n shape: [number, number, number], enableShapeUniforms: boolean): string {\n const coordsFromIndexSnippet = enableShapeUniforms ?\n shader_util.getLogicalCoordinatesFromFlatIndexByUniform(\n ['r', 'c', 'd'], 'inputShape') :\n shader_util.getLogicalCoordinatesFromFlatIndex(['r', 'c', 'd'], shape);\n\n return `\n ivec3 inputCoordsFromReshapedOutCoords(int index) {\n ${coordsFromIndexSnippet}\n return ivec3(r, c, d);\n }\n `;\n}\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env} from '@tensorflow/tfjs-core';\n\nimport {GPGPUContext} from './gpgpu_context';\nimport {getInternalFormatForFloat16MatrixTexture, getInternalFormatForFloat16PackedMatrixTexture, getInternalFormatForFloat32MatrixTexture, getInternalFormatForPackedMatrixTexture, getInternalFormatForUnsignedBytesMatrixTexture} from './gpgpu_util';\nimport {getPackedMatrixTextureShapeWidthHeight, getUnpackedMatrixTextureShapeWidthHeight, PhysicalTextureType, Texture, TextureConfig, TextureUsage} from './tex_util';\n\nexport class TextureManager {\n private numUsedTextures = 0;\n private numFreeTextures = 0;\n private _numBytesAllocated = 0;\n private _numBytesFree = 0; // How many bytes that have been allocated\n // are available for reuse.\n private freeTextures: {[shape: string]: Texture[]} = {};\n private logEnabled = false;\n private usedTextures: {[shape: string]: Texture[]} = {};\n\n constructor(private gpgpu: GPGPUContext) {}\n\n acquireTexture(\n shapeRC: [number, number], usage: TextureUsage,\n isPacked: boolean): Texture {\n const physicalTexType = getPhysicalFromLogicalTextureType(usage, isPacked);\n\n const shapeKey = getKeyFromTextureShape(shapeRC, physicalTexType, isPacked);\n if (!(shapeKey in this.freeTextures)) {\n this.freeTextures[shapeKey] = [];\n }\n if (!(shapeKey in this.usedTextures)) {\n this.usedTextures[shapeKey] = [];\n }\n\n const texBytes = computeBytes(\n shapeRC, physicalTexType, this.gpgpu.gl, this.gpgpu.textureConfig,\n isPacked);\n\n if (this.freeTextures[shapeKey].length > 0) {\n this.numFreeTextures--;\n this.numUsedTextures++;\n this._numBytesFree -= texBytes;\n this.log();\n const newTexture = this.freeTextures[shapeKey].shift();\n this.usedTextures[shapeKey].push(newTexture);\n return newTexture;\n }\n\n let newTexture: Texture;\n if (physicalTexType === PhysicalTextureType.PACKED_2X2_FLOAT32) {\n newTexture = this.gpgpu.createPackedMatrixTexture(shapeRC[0], shapeRC[1]);\n } else if (physicalTexType === PhysicalTextureType.PACKED_2X2_FLOAT16) {\n newTexture =\n this.gpgpu.createFloat16PackedMatrixTexture(shapeRC[0], shapeRC[1]);\n } else if (physicalTexType === PhysicalTextureType.UNPACKED_FLOAT32) {\n newTexture =\n this.gpgpu.createFloat32MatrixTexture(shapeRC[0], shapeRC[1]);\n } else if (physicalTexType === PhysicalTextureType.UNPACKED_FLOAT16) {\n newTexture =\n this.gpgpu.createFloat16MatrixTexture(shapeRC[0], shapeRC[1]);\n } else if (\n physicalTexType === PhysicalTextureType.PACKED_4X1_UNSIGNED_BYTE) {\n newTexture =\n this.gpgpu.createUnsignedBytesMatrixTexture(shapeRC[0], shapeRC[1]);\n }\n this.usedTextures[shapeKey].push(newTexture);\n\n this.numUsedTextures++;\n this._numBytesAllocated += texBytes;\n this.log();\n\n return newTexture;\n }\n\n releaseTexture(\n texture: Texture, shape: [number, number], logicalTexType: TextureUsage,\n isPacked: boolean): void {\n if (this.freeTextures == null) {\n // Already disposed.\n return;\n }\n const physicalTexType =\n getPhysicalFromLogicalTextureType(logicalTexType, isPacked);\n const shapeKey = getKeyFromTextureShape(shape, physicalTexType, isPacked);\n if (!(shapeKey in this.freeTextures)) {\n this.freeTextures[shapeKey] = [];\n }\n\n const texBytes = computeBytes(\n shape, physicalTexType, this.gpgpu.gl, this.gpgpu.textureConfig,\n isPacked);\n const deleteTexThreshold = env().get('WEBGL_DELETE_TEXTURE_THRESHOLD');\n if (deleteTexThreshold !== -1 &&\n this._numBytesAllocated > deleteTexThreshold) {\n this.gpgpu.deleteMatrixTexture(texture.texture);\n this._numBytesAllocated -= texBytes;\n } else {\n this.freeTextures[shapeKey].push(texture);\n this.numFreeTextures++;\n this._numBytesFree += texBytes;\n }\n\n this.numUsedTextures--;\n\n const texList = this.usedTextures[shapeKey];\n const texIndex = texList.indexOf(texture);\n if (texIndex < 0) {\n throw new Error(\n 'Cannot release a texture that was never provided by this ' +\n 'texture manager');\n }\n texList.splice(texIndex, 1);\n this.log();\n }\n\n private log() {\n if (!this.logEnabled) {\n return;\n }\n const total = this.numFreeTextures + this.numUsedTextures;\n console.log(\n 'Free/Used', `${this.numFreeTextures} / ${this.numUsedTextures}`,\n `(${total})`);\n const freeRatio = this._numBytesFree / this._numBytesAllocated;\n console.log(`Bytes allocated: ${this._numBytesAllocated}`);\n console.log(`Bytes unused: ${this._numBytesFree} (${\n Math.round(100 * freeRatio)}%)`);\n }\n\n get numBytesAllocated(): number {\n return this._numBytesAllocated;\n }\n\n get numBytesFree(): number {\n return this._numBytesFree;\n }\n\n getNumUsedTextures(): number {\n return this.numUsedTextures;\n }\n\n getNumFreeTextures(): number {\n return this.numFreeTextures;\n }\n\n dispose() {\n if (this.freeTextures == null) {\n // Already disposed.\n return;\n }\n for (const texShape in this.freeTextures) {\n this.freeTextures[texShape].forEach(tex => {\n this.gpgpu.deleteMatrixTexture(tex.texture);\n });\n }\n for (const texShape in this.usedTextures) {\n this.usedTextures[texShape].forEach(tex => {\n this.gpgpu.deleteMatrixTexture(tex.texture);\n });\n }\n this.freeTextures = null;\n this.usedTextures = null;\n this.numUsedTextures = 0;\n this.numFreeTextures = 0;\n this._numBytesAllocated = 0;\n this._numBytesFree = 0;\n }\n}\n\nfunction numBytesForInternalFormat(\n gl: WebGLRenderingContext, internalFormat: number): number {\n // tslint:disable-next-line:no-any\n const glany = gl as any;\n if (internalFormat === glany.R32F) {\n return 4;\n } else if (internalFormat === glany.R16F) {\n return 2;\n } else if (internalFormat === glany.RGBA32F) {\n return 16;\n } else if (internalFormat === gl.RGBA) {\n return 16;\n } else if (internalFormat === glany.RGBA16F) {\n return 8;\n } else if (internalFormat === glany.RGBA8) {\n return 4;\n }\n throw new Error(`Unknown internal format ${internalFormat}`);\n}\n\nexport function computeBytes(\n shape: [number, number], physicalTexType: PhysicalTextureType,\n gl: WebGLRenderingContext, textureConfig: TextureConfig,\n isPacked: boolean): number {\n // It is not possible to infer packed status from the texture type because\n // depending on the textureConfig, different texture types may resolve to the\n // same internal format (e.g. in WebGL1, the internal format for\n // UNPACKED_FLOAT16 textures is gl.RGBA). Therefore we pass in `isPacked`\n // explicitly.\n const internalFormat =\n internalFormatForPhysicalTexType(physicalTexType, textureConfig);\n\n let numElements: number;\n if (isPacked) {\n const [packedWidth, packedHeight] =\n getPackedMatrixTextureShapeWidthHeight(shape[0], shape[1]);\n numElements = packedWidth * packedHeight;\n\n } else {\n const [width, height] =\n getUnpackedMatrixTextureShapeWidthHeight(shape[0], shape[1]);\n numElements = width * height;\n }\n\n const bytesPerElement = numBytesForInternalFormat(gl, internalFormat);\n return numElements * bytesPerElement;\n}\n\nfunction internalFormatForPhysicalTexType(\n physicalTexType: PhysicalTextureType,\n textureConfig: TextureConfig): number {\n switch (physicalTexType) {\n case PhysicalTextureType.PACKED_2X2_FLOAT32:\n return getInternalFormatForPackedMatrixTexture(textureConfig);\n case PhysicalTextureType.PACKED_2X2_FLOAT16:\n return getInternalFormatForFloat16PackedMatrixTexture(textureConfig);\n case PhysicalTextureType.UNPACKED_FLOAT32:\n return getInternalFormatForFloat32MatrixTexture(textureConfig);\n case PhysicalTextureType.UNPACKED_FLOAT16:\n return getInternalFormatForFloat16MatrixTexture(textureConfig);\n case PhysicalTextureType.PACKED_4X1_UNSIGNED_BYTE:\n return getInternalFormatForUnsignedBytesMatrixTexture(textureConfig);\n default:\n throw new Error(`Unknown physical texture type ${physicalTexType}`);\n }\n}\n\nfunction getPhysicalTextureForRendering(isPacked: boolean):\n PhysicalTextureType {\n if (env().getBool('WEBGL_RENDER_FLOAT32_ENABLED')) {\n if (isPacked) {\n return PhysicalTextureType.PACKED_2X2_FLOAT32;\n }\n return PhysicalTextureType.UNPACKED_FLOAT32;\n }\n\n if (isPacked) {\n return PhysicalTextureType.PACKED_2X2_FLOAT16;\n }\n return PhysicalTextureType.UNPACKED_FLOAT16;\n}\n\nfunction getPhysicalFromLogicalTextureType(\n logicalTexType: TextureUsage, isPacked: boolean): PhysicalTextureType {\n if (logicalTexType === TextureUsage.UPLOAD) {\n return PhysicalTextureType.PACKED_2X2_FLOAT32;\n } else if (logicalTexType === TextureUsage.RENDER || logicalTexType == null) {\n return getPhysicalTextureForRendering(isPacked);\n } else if (\n logicalTexType === TextureUsage.DOWNLOAD ||\n logicalTexType === TextureUsage.PIXELS) {\n return PhysicalTextureType.PACKED_4X1_UNSIGNED_BYTE;\n }\n throw new Error(`Unknown logical texture type ${logicalTexType}`);\n}\n\nfunction getKeyFromTextureShape(\n shapeRowsCol: [number, number], physicalTexType: PhysicalTextureType,\n isPacked: boolean): string {\n return `${shapeRowsCol[0]}_${shapeRowsCol[1]}_${physicalTexType}_${isPacked}`;\n}\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram, useShapeUniforms} from './gpgpu_math';\n\nexport class UnaryOpProgram implements GPGPUProgram {\n variableNames = ['A'];\n userCode: string;\n outputShape: number[];\n enableShapeUniforms: boolean;\n\n constructor(aShape: number[], opSnippet: string) {\n this.outputShape = aShape;\n this.enableShapeUniforms = useShapeUniforms(this.outputShape.length);\n this.userCode = `\n float unaryOperation(float x) {\n ${opSnippet}\n }\n\n void main() {\n float x = getAAtOutCoords();\n float y = unaryOperation(x);\n\n setOutput(y);\n }\n `;\n }\n}\n\nexport const CHECK_NAN_SNIPPET = `if (isnan(x)) return x;`;\n\nexport const LINEAR = `return x;`;\n\nexport const ABS = `return abs(x);`;\n\nexport function STEP(alpha = 0.0) {\n return CHECK_NAN_SNIPPET + `\n return x > 0.0 ? 1.0 : float(${alpha});\n `;\n}\n\nexport const ELU = `return (x >= 0.0) ? x : (exp(x) - 1.0);`;\nexport const RELU = CHECK_NAN_SNIPPET + `\n return (x < 0.0) ? 0.0 : x;\n`;\n\nexport const RELU6 = CHECK_NAN_SNIPPET + `\n return (x < 0.0) ? 0.0 : min(6.0, x);\n`;\n\nexport const CLONE = 'return x;';\n\nexport const SIGMOID = `return 1.0 / (1.0 + exp(-1.0 * x));`;\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram, useShapeUniforms} from './gpgpu_math';\n\nexport const LINEAR = `return x;`;\n\nexport const ELU = `\n vec4 result;\n\n result.r = (x.r >= 0.0) ? x.r : (exp(x.r) - 1.0);\n result.g = (x.g >= 0.0) ? x.g : (exp(x.g) - 1.0);\n result.b = (x.b >= 0.0) ? x.b : (exp(x.b) - 1.0);\n result.a = (x.a >= 0.0) ? x.a : (exp(x.a) - 1.0);\n\n return result;\n`;\n\nexport const RELU = `\n vec4 result = x * vec4(greaterThanEqual(x, vec4(0.0)));\n bvec4 isNaN = isnan(x);\n\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n`;\n\nexport const RELU6 = `\n vec4 result = min(x, vec4(6.)) * vec4(greaterThanEqual(x, vec4(0.0)));\n bvec4 isNaN = isnan(x);\n\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n`;\n\nexport const SIGMOID = `return 1.0 / (1.0 + exp(-1.0 * x));`;\n\nexport class UnaryOpPackedProgram implements GPGPUProgram {\n variableNames = ['A'];\n userCode: string;\n enableShapeUniforms: boolean;\n outputShape: number[];\n packedInputs = true;\n packedOutput = true;\n\n constructor(aShape: number[], opSnippet: string) {\n this.outputShape = aShape;\n this.enableShapeUniforms = useShapeUniforms(this.outputShape.length);\n this.userCode = `\n vec4 unaryOperation(vec4 x) {\n ${opSnippet}\n }\n\n void main() {\n vec4 x = getAAtOutCoords();\n vec4 y = unaryOperation(x);\n\n setOutput(y);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram, useShapeUniforms} from './gpgpu_math';\nimport {getChannels, getSourceCoords} from './packing_util';\nimport {getCoordsDataType} from './shader_compiler';\n\nexport class UnpackProgram implements GPGPUProgram {\n variableNames = ['A'];\n packedInputs = true;\n packedOutput = false;\n outputShape: number[];\n userCode: string;\n enableShapeUniforms: boolean;\n\n constructor(outputShape: number[]) {\n this.outputShape = outputShape;\n this.enableShapeUniforms = useShapeUniforms(this.outputShape.length);\n const rank = outputShape.length;\n\n const channels = getChannels('rc', rank);\n const dtype = getCoordsDataType(rank);\n const sourceCoords = getSourceCoords(rank, channels);\n const innerDims = channels.slice(-2);\n const coords = rank <= 1 ? 'rc' : `vec2(${innerDims.join(',')})`;\n\n this.userCode = `\n void main() {\n ${dtype} rc = getOutputCoords();\n vec4 packedInput = getA(${sourceCoords});\n\n setOutput(getChannel(packedInput, ${coords}));\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// Import webgl flags.\nimport './flags_webgl';\n\nimport * as tf from '@tensorflow/tfjs-core';\nimport {backend_util, BackendValues, buffer, DataId, DataStorage, DataToGPUWebGLOption, DataType, engine, env, GPUData, kernel_impls, KernelBackend, MemoryInfo, nextFrame, NumericDataType, Rank, RecursiveArray, scalar, ShapeMap, Tensor, Tensor2D, TensorBuffer, TensorInfo, tidy, TimingInfo, TypedArray, util, WebGLData} from '@tensorflow/tfjs-core';\nimport {getWebGLContext} from './canvas_util';\nimport {DecodeMatrixProgram} from './decode_matrix_gpu';\nimport {DecodeMatrixPackedProgram} from './decode_matrix_packed_gpu';\nimport {EncodeFloatProgram} from './encode_float_gpu';\nimport {EncodeFloatPackedProgram} from './encode_float_packed_gpu';\nimport {EncodeMatrixProgram} from './encode_matrix_gpu';\nimport {EncodeMatrixPackedProgram} from './encode_matrix_packed_gpu';\nimport {GPGPUContext} from './gpgpu_context';\nimport * as gpgpu_math from './gpgpu_math';\nimport {getUniformLocations, GPGPUBinary, GPGPUProgram, TensorData} from './gpgpu_math';\nimport {simpleAbsImplCPU} from './kernel_utils/shared';\nimport {PackProgram} from './pack_gpu';\nimport {ReshapePackedProgram} from './reshape_packed_gpu';\nimport * as tex_util from './tex_util';\nimport {Texture, TextureData, TextureUsage} from './tex_util';\nimport {TextureManager} from './texture_manager';\nimport * as unary_op from './unaryop_gpu';\nimport {UnaryOpProgram} from './unaryop_gpu';\nimport {UnaryOpPackedProgram} from './unaryop_packed_gpu';\nimport {UnpackProgram} from './unpack_gpu';\nimport * as webgl_util from './webgl_util';\n\nconst whereImpl = kernel_impls.whereImpl;\n\nexport const EPSILON_FLOAT32 = 1e-7;\nexport const EPSILON_FLOAT16 = 1e-4;\n\ntype KernelInfo = {\n name: string; query: Promise;\n};\n\nexport type TimerNode = RecursiveArray|KernelInfo;\nexport interface CPUTimerQuery {\n startMs: number;\n endMs?: number;\n}\n\nexport interface WebGLMemoryInfo extends MemoryInfo {\n numBytesInGPU: number;\n // Tracks the total number of bytes allocated on the GPU, accounting for the\n // physical texture type.\n numBytesInGPUAllocated: number;\n // Tracks byte size of textures that were created and then made available for\n // reuse (disposed).\n numBytesInGPUFree: number;\n unreliable: boolean;\n}\n\nexport interface WebGLTimingInfo extends TimingInfo {\n uploadWaitMs: number;\n downloadWaitMs: number;\n}\n\nconst binaryCaches: {[webGLVersion: string]: {[key: string]: GPGPUBinary}} = {};\n\nexport function getBinaryCache(webGLVersion: number) {\n if (webGLVersion in binaryCaches) {\n return binaryCaches[webGLVersion];\n }\n binaryCaches[webGLVersion] = {};\n return binaryCaches[webGLVersion];\n}\n\n// Empirically determined constant used to determine size threshold for handing\n// off execution to the CPU.\nconst CPU_HANDOFF_SIZE_THRESHOLD =\n env().getNumber('CPU_HANDOFF_SIZE_THRESHOLD');\n\n// Empirically determined constant used to decide the number of MB on GPU\n// before we warn about high memory use. The MB are this constant * screen area\n// * dpi / 1024 / 1024.\nconst BEFORE_PAGING_CONSTANT = 600;\nfunction numMBBeforeWarning(): number {\n if (env().global.screen == null) {\n return 1024; // 1 GB.\n }\n return (env().global.screen.height * env().global.screen.width *\n window.devicePixelRatio) *\n BEFORE_PAGING_CONSTANT / 1024 / 1024;\n}\n\nexport class MathBackendWebGL extends KernelBackend {\n texData: DataStorage;\n gpgpu: GPGPUContext;\n\n private static nextDataId = 0;\n private nextDataId(): number {\n return MathBackendWebGL.nextDataId++;\n }\n // Maps data ids that have a pending read operation, to list of subscribers.\n private pendingRead = new WeakMap void>>();\n // List of data ids that are scheduled for disposal, but are waiting on a\n // pending read operation.\n private pendingDisposal = new WeakSet();\n\n // Used to count the number of 'shallow' sliced tensors that point to the\n // same data id.\n dataRefCount = new WeakMap();\n private numBytesInGPU = 0;\n\n private canvas: HTMLCanvasElement|OffscreenCanvas;\n\n private programTimersStack: TimerNode[];\n private activeTimers: TimerNode[];\n // Accumulated time spent (including blocking) in uploading data to webgl.\n private uploadWaitMs = 0;\n // Accumulated time spent (including blocking in downloading data from webgl.\n private downloadWaitMs = 0;\n\n // record the last manual GL Flush time.\n private lastGlFlushTime = 0;\n\n // Number of bits of precision of this backend.\n private floatPrecisionValue: 32|16;\n\n private textureManager: TextureManager;\n private binaryCache: {[key: string]: GPGPUBinary};\n private gpgpuCreatedLocally: boolean;\n private numMBBeforeWarning: number;\n private warnedAboutMemory = false;\n\n constructor(gpuResource?: GPGPUContext|HTMLCanvasElement|OffscreenCanvas) {\n super();\n if (!env().getBool('HAS_WEBGL')) {\n throw new Error('WebGL is not supported on this device');\n }\n\n let newGPGPU;\n if (gpuResource != null) {\n if (gpuResource instanceof GPGPUContext) {\n newGPGPU = gpuResource;\n } else {\n const gl =\n getWebGLContext(env().getNumber('WEBGL_VERSION'), gpuResource);\n newGPGPU = new GPGPUContext(gl);\n }\n this.binaryCache = {};\n this.gpgpuCreatedLocally = false;\n } else {\n const gl = getWebGLContext(env().getNumber('WEBGL_VERSION'));\n newGPGPU = new GPGPUContext(gl);\n this.binaryCache = getBinaryCache(env().getNumber('WEBGL_VERSION'));\n this.gpgpuCreatedLocally = true;\n }\n\n this.gpgpu = newGPGPU;\n this.canvas = this.gpgpu.gl.canvas;\n this.textureManager = new TextureManager(this.gpgpu);\n this.numMBBeforeWarning = numMBBeforeWarning();\n this.texData = new DataStorage(this, engine());\n }\n\n numDataIds() {\n return this.texData.numDataIds() - this.pendingDeletes;\n }\n\n // Writes a new entry to the data store with a WebGL texture, and registers it\n // to the texture manager.\n writeTexture(\n texture: WebGLTexture, shape: number[], dtype: DataType,\n texHeight: number, texWidth: number, channels: string): DataId {\n // Temporarily create an tensor info to make the texture compatible with\n // the runWebGLProgram's input.\n const input = this.makeTensorInfo(shape, dtype);\n const inData = this.texData.get(input.dataId);\n // Even though the input texture could be unpacked or dense packed, it is\n // always considered as unpacked for EncodeMatrixProgram.\n inData.isPacked = false;\n\n // Bind texture to the input tensor.\n inData.texture = {texture, texShape: [texHeight, texWidth]};\n inData.texShape = [texHeight, texWidth];\n\n const shapeAs3D = webgl_util.getShapeAs3D(shape);\n const program =\n new EncodeMatrixProgram(shapeAs3D, false /* isByteArray */, channels);\n const output =\n this.runWebGLProgram(program, [input], dtype, [[texHeight, texWidth]]);\n output.shape = shape;\n\n // Unbind the texture from the input tensor to avoid the texture being\n // released.\n inData.texture = null;\n this.disposeIntermediateTensorInfo(input);\n\n return output.dataId;\n }\n\n write(values: BackendValues, shape: number[], dtype: DataType): DataId {\n if (env().getBool('WEBGL_CHECK_NUMERICAL_PROBLEMS') ||\n env().getBool('DEBUG')) {\n this.checkNumericalProblems(values);\n }\n if (dtype === 'complex64' && values != null) {\n throw new Error(\n `Cannot write to a complex64 dtype. ` +\n `Please use tf.complex(real, imag).`);\n }\n const dataId = {id: this.nextDataId()};\n this.texData.set(\n dataId,\n {shape, dtype, values, usage: TextureUsage.UPLOAD, refCount: 1});\n return dataId;\n }\n\n /** Return refCount of a `TensorData`. */\n refCount(dataId: DataId): number {\n if (this.texData.has(dataId)) {\n const tensorData = this.texData.get(dataId);\n return tensorData.refCount;\n }\n return 0;\n }\n\n /** Increase refCount of a `TextureData`. */\n incRef(dataId: DataId): void {\n const texData = this.texData.get(dataId);\n texData.refCount++;\n }\n\n /** Decrease refCount of a `TextureData`. */\n decRef(dataId: DataId): void {\n if (this.texData.has(dataId)) {\n const texData = this.texData.get(dataId);\n texData.refCount--;\n }\n }\n\n move(\n dataId: DataId, values: BackendValues, shape: number[], dtype: DataType,\n refCount: number): void {\n if (env().getBool('DEBUG')) {\n this.checkNumericalProblems(values);\n }\n if (dtype === 'complex64') {\n throw new Error(\n `Cannot write to a complex64 dtype. ` +\n `Please use tf.complex(real, imag).`);\n }\n this.texData.set(\n dataId, {shape, dtype, values, usage: TextureUsage.UPLOAD, refCount});\n }\n\n disposeIntermediateTensorInfo(tensorInfo: TensorInfo): void {\n this.disposeData(tensorInfo.dataId);\n }\n\n readSync(dataId: DataId): BackendValues {\n const texData = this.texData.get(dataId);\n const {values, dtype, complexTensorInfos, slice, shape, isPacked} = texData;\n\n // The presence of `slice` indicates this tensor is a shallow slice of a\n // different tensor, and is using that original tensor's texture. Run\n // `clone` in order to copy that texture and read from it.\n if (slice != null) {\n let program;\n if (isPacked) {\n program = new UnaryOpPackedProgram(shape, unary_op.CLONE);\n } else {\n program = new UnaryOpProgram(shape, unary_op.CLONE);\n }\n const res =\n this.runWebGLProgram(program, [{dataId, shape, dtype}], dtype);\n const data = this.readSync(res.dataId);\n this.disposeIntermediateTensorInfo(res);\n return data;\n }\n if (values != null) {\n return this.convertAndCacheOnCPU(dataId);\n }\n if (dtype === 'string') {\n return values;\n }\n const shouldTimeProgram = this.activeTimers != null;\n let start: number;\n if (shouldTimeProgram) {\n start = util.now();\n }\n\n let result: Float32Array;\n if (dtype === 'complex64') {\n const realValues =\n this.readSync(complexTensorInfos.real.dataId) as Float32Array;\n const imagValues =\n this.readSync(complexTensorInfos.imag.dataId) as Float32Array;\n result = backend_util.mergeRealAndImagArrays(realValues, imagValues);\n } else {\n result = this.getValuesFromTexture(dataId);\n }\n\n if (shouldTimeProgram) {\n this.downloadWaitMs += util.now() - start;\n }\n return this.convertAndCacheOnCPU(dataId, result);\n }\n\n async read(dataId: DataId): Promise {\n if (this.pendingRead.has(dataId)) {\n const subscribers = this.pendingRead.get(dataId);\n return new Promise(resolve => subscribers.push(resolve));\n }\n const texData = this.texData.get(dataId);\n const {values, shape, slice, dtype, complexTensorInfos, isPacked} = texData;\n\n // The presence of `slice` indicates this tensor is a shallow slice of a\n // different tensor, and is using that original tensor's texture. Run\n // `clone` in order to copy that texture and read from it.\n if (slice != null) {\n let program;\n if (isPacked) {\n program = new UnaryOpPackedProgram(shape, unary_op.CLONE);\n } else {\n program = new UnaryOpProgram(shape, unary_op.CLONE);\n }\n const res =\n this.runWebGLProgram(program, [{dataId, shape, dtype}], dtype);\n const data = this.read(res.dataId);\n this.disposeIntermediateTensorInfo(res);\n return data;\n }\n\n if (values != null) {\n return this.convertAndCacheOnCPU(dataId);\n }\n\n if (env().getBool('DEBUG')) {\n // getBool('WEBGL_DOWNLOAD_FLOAT_ENABLED') caused a blocking GPU call.\n // For performance reason, only check it for debugging. In production,\n // it doesn't handle this use case anyway, so behavior is not changed.\n if (!env().getBool('WEBGL_DOWNLOAD_FLOAT_ENABLED') &&\n env().getNumber('WEBGL_VERSION') === 2) {\n throw new Error(\n `tensor.data() with WEBGL_DOWNLOAD_FLOAT_ENABLED=false and ` +\n `WEBGL_VERSION=2 not yet supported.`);\n }\n }\n\n let buffer: WebGLBuffer = null;\n let tmpDownloadTarget: TensorInfo;\n\n if (dtype !== 'complex64' && env().get('WEBGL_BUFFER_SUPPORTED')) {\n // Possibly copy the texture into a buffer before inserting a fence.\n tmpDownloadTarget = this.decode(dataId);\n const tmpData = this.texData.get(tmpDownloadTarget.dataId);\n\n buffer = this.gpgpu.createBufferFromTexture(\n tmpData.texture.texture, ...tex_util.getDenseTexShape(shape));\n }\n\n this.pendingRead.set(dataId, []);\n\n if (dtype !== 'complex64') {\n // Create a fence and wait for it to resolve.\n await this.gpgpu.createAndWaitForFence();\n }\n\n // Download the values from the GPU.\n let vals: Float32Array;\n if (dtype === 'complex64') {\n const ps = await Promise.all([\n this.read(complexTensorInfos.real.dataId),\n this.read(complexTensorInfos.imag.dataId)\n ]);\n\n const realValues = ps[0];\n const imagValues = ps[1];\n vals = backend_util.mergeRealAndImagArrays(\n realValues as Float32Array, imagValues as Float32Array);\n } else if (buffer == null) {\n vals = this.getValuesFromTexture(dataId);\n } else {\n const size = util.sizeFromShape(shape);\n vals = this.gpgpu.downloadFloat32MatrixFromBuffer(buffer, size);\n }\n if (tmpDownloadTarget != null) {\n this.disposeIntermediateTensorInfo(tmpDownloadTarget);\n }\n if (buffer != null) {\n const gl = this.gpgpu.gl;\n webgl_util.callAndCheck(gl, () => gl.deleteBuffer(buffer));\n }\n const dTypeVals = this.convertAndCacheOnCPU(dataId, vals);\n\n const subscribers = this.pendingRead.get(dataId);\n this.pendingRead.delete(dataId);\n\n // Notify all pending reads.\n subscribers.forEach(resolve => resolve(dTypeVals));\n if (this.pendingDisposal.has(dataId)) {\n this.pendingDisposal.delete(dataId);\n if (this.disposeData(dataId)) {\n engine().removeDataId(dataId, this);\n }\n this.pendingDeletes--;\n }\n return dTypeVals;\n }\n\n /**\n * Read tensor to a new texture that is densely packed for ease of use.\n * @param dataId The source tensor.\n * @param options\n * customTexShape: Optional. If set, will use the user defined texture\n * shape to create the texture.\n */\n readToGPU(dataId: DataId, options: DataToGPUWebGLOption = {}): GPUData {\n const texData = this.texData.get(dataId);\n const {values, shape, slice, dtype, isPacked, texture} = texData;\n\n if (dtype === 'complex64') {\n throw new Error('Does not support reading texture for complex64 dtype.');\n }\n\n // The presence of `slice` indicates this tensor is a shallow slice of a\n // different tensor, and is using that original tensor's texture. Run\n // `clone` in order to copy that texture and read from it.\n if (slice != null) {\n let program;\n if (isPacked) {\n program = new UnaryOpPackedProgram(shape, unary_op.CLONE);\n } else {\n program = new UnaryOpProgram(shape, unary_op.CLONE);\n }\n const res =\n this.runWebGLProgram(program, [{dataId, shape, dtype}], dtype);\n const gpuResouorce = this.readToGPU(res, options);\n this.disposeIntermediateTensorInfo(res);\n return gpuResouorce;\n }\n\n if (texture == null) {\n if (values != null) {\n throw new Error('Data is not on GPU but on CPU.');\n } else {\n throw new Error('There is no data on GPU or CPU.');\n }\n }\n\n // Decode the texture so that it is stored densely (using four channels).\n const tmpTarget = this.decode(dataId, options.customTexShape);\n\n // Make engine track this tensor, so that we can dispose it later.\n const tensorRef = engine().makeTensorFromTensorInfo(tmpTarget);\n\n const tmpData = this.texData.get(tmpTarget.dataId);\n return {tensorRef, ...tmpData.texture};\n }\n\n bufferSync(t: TensorInfo):\n TensorBuffer {\n const data = this.readSync(t.dataId);\n if (t.dtype === 'string') {\n try {\n // Decode the bytes into string.\n const strings = (data as Uint8Array[]).map(d => util.decodeString(d));\n return buffer(t.shape as ShapeMap[R], t.dtype, strings) as\n TensorBuffer;\n } catch {\n throw new Error('Failed to decode encoded string bytes into utf-8');\n }\n }\n return buffer(t.shape as ShapeMap[R], t.dtype, data as TypedArray) as\n TensorBuffer;\n }\n\n private checkNumericalProblems(values: BackendValues): void {\n if (values == null) {\n return;\n }\n for (let i = 0; i < values.length; i++) {\n const num = values[i] as number;\n if (!webgl_util.canBeRepresented(num)) {\n if (env().getBool('WEBGL_RENDER_FLOAT32_CAPABLE')) {\n throw Error(\n `The value ${num} cannot be represented with your ` +\n `current settings. Consider enabling float32 rendering: ` +\n `'tf.env().set('WEBGL_RENDER_FLOAT32_ENABLED', true);'`);\n }\n throw Error(`The value ${num} cannot be represented on this device.`);\n }\n }\n }\n\n private getValuesFromTexture(dataId: DataId): Float32Array {\n const {shape, dtype, isPacked} = this.texData.get(dataId);\n const size = util.sizeFromShape(shape);\n if (env().getBool('WEBGL_DOWNLOAD_FLOAT_ENABLED')) {\n const tmpTarget = this.decode(dataId);\n const tmpData = this.texData.get(tmpTarget.dataId);\n const vals =\n this.gpgpu\n .downloadMatrixFromPackedTexture(\n tmpData.texture.texture, ...tex_util.getDenseTexShape(shape))\n .subarray(0, size);\n\n this.disposeIntermediateTensorInfo(tmpTarget);\n\n return vals;\n }\n\n const shouldUsePackedProgram =\n env().getBool('WEBGL_PACK') && isPacked === true;\n const outputShape =\n shouldUsePackedProgram ? webgl_util.getShapeAs3D(shape) : shape;\n const program = shouldUsePackedProgram ?\n new EncodeFloatPackedProgram(outputShape as [number, number, number]) :\n new EncodeFloatProgram(outputShape);\n const output = this.runWebGLProgram(\n program, [{shape: outputShape, dtype, dataId}], 'float32');\n const tmpData = this.texData.get(output.dataId);\n const vals = this.gpgpu\n .downloadByteEncodedFloatMatrixFromOutputTexture(\n tmpData.texture.texture, tmpData.texShape[0],\n tmpData.texShape[1])\n .subarray(0, size);\n this.disposeIntermediateTensorInfo(output);\n\n return vals;\n }\n\n timerAvailable(): boolean {\n return env().getNumber('WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE') > 0;\n }\n\n time(f: () => void): Promise {\n const oldActiveTimers = this.activeTimers;\n const newActiveTimers: TimerNode[] = [];\n\n let outerMostTime = false;\n if (this.programTimersStack == null) {\n this.programTimersStack = newActiveTimers;\n outerMostTime = true;\n } else {\n this.activeTimers.push(newActiveTimers);\n }\n this.activeTimers = newActiveTimers;\n\n f();\n\n // needing to split these up because util.flatten only accepts certain types\n const flattenedActiveTimerQueries =\n util.flatten(this.activeTimers.map((d: KernelInfo) => d.query))\n .filter(d => d != null);\n const flattenedActiveTimerNames =\n util.flatten(this.activeTimers.map((d: KernelInfo) => d.name))\n .filter(d => d != null);\n\n this.activeTimers = oldActiveTimers;\n\n if (outerMostTime) {\n this.programTimersStack = null;\n }\n\n const res: WebGLTimingInfo = {\n uploadWaitMs: this.uploadWaitMs,\n downloadWaitMs: this.downloadWaitMs,\n kernelMs: null,\n wallMs: null // will be filled by the engine\n };\n\n return (async () => {\n if (env().getNumber('WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE') >\n 0) {\n const kernelMs = await Promise.all(flattenedActiveTimerQueries);\n\n res['kernelMs'] = util.sum(kernelMs);\n res['getExtraProfileInfo'] = () =>\n kernelMs\n .map((d, i) => ({name: flattenedActiveTimerNames[i], ms: d}))\n .map(d => `${d.name}: ${d.ms}`)\n .join(', ');\n } else {\n res['kernelMs'] = {\n error: 'WebGL query timers are not supported in this environment.'\n };\n }\n\n this.uploadWaitMs = 0;\n this.downloadWaitMs = 0;\n return res;\n })();\n }\n memory(): WebGLMemoryInfo {\n return {\n unreliable: false,\n numBytesInGPU: this.numBytesInGPU,\n numBytesInGPUAllocated: this.textureManager.numBytesAllocated,\n numBytesInGPUFree: this.textureManager.numBytesFree\n } as WebGLMemoryInfo;\n }\n\n private startTimer(): WebGLQuery|CPUTimerQuery {\n if (env().getNumber('WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE') > 0) {\n return this.gpgpu.beginQuery();\n }\n return {startMs: util.now(), endMs: null};\n }\n\n private endTimer(query: WebGLQuery|CPUTimerQuery): WebGLQuery|CPUTimerQuery {\n if (env().getNumber('WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE') > 0) {\n this.gpgpu.endQuery();\n return query;\n }\n (query as CPUTimerQuery).endMs = util.now();\n return query;\n }\n\n private async getQueryTime(query: WebGLQuery|CPUTimerQuery): Promise {\n if (env().getNumber('WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE') > 0) {\n return this.gpgpu.waitForQueryAndGetTime(query as WebGLQuery);\n }\n const timerQuery = query as CPUTimerQuery;\n return timerQuery.endMs - timerQuery.startMs;\n }\n\n private pendingDeletes = 0;\n\n /**\n * Decrease the RefCount on the dataId and dispose the memory if the dataId\n * has 0 refCount. If there are pending read on the data, the disposal would\n * added to the pending delete queue. Return true if the dataId is removed\n * from backend or the backend does not contain the dataId, false if the\n * dataId is not removed. Memory may or may not be released even when dataId\n * is removed, which also depends on dataRefCount, see `releaseGPU`.\n * @param dataId\n * @oaram force Optional, remove the data regardless of refCount\n */\n disposeData(dataId: DataId, force = false): boolean {\n if (this.pendingDisposal.has(dataId)) {\n return false;\n }\n\n // No-op if already disposed.\n if (!this.texData.has(dataId)) {\n return true;\n }\n\n // if force flag is set, change refCount to 0, this would ensure disposal\n // when added to the pendingDisposal queue. Memory may or may not be\n // released, which also depends on dataRefCount, see `releaseGPU`.\n if (force) {\n this.texData.get(dataId).refCount = 0;\n } else {\n this.texData.get(dataId).refCount--;\n }\n\n if (!force && this.texData.get(dataId).refCount > 0) {\n return false;\n }\n\n if (this.pendingRead.has(dataId)) {\n this.pendingDisposal.add(dataId);\n this.pendingDeletes++;\n return false;\n }\n\n this.releaseGPUData(dataId);\n const {complexTensorInfos} = this.texData.get(dataId);\n if (complexTensorInfos != null) {\n this.disposeData(complexTensorInfos.real.dataId, force);\n this.disposeData(complexTensorInfos.imag.dataId, force);\n }\n\n this.texData.delete(dataId);\n\n return true;\n }\n\n private releaseGPUData(dataId: DataId): void {\n const {texture, dtype, texShape, usage, isPacked, slice} =\n this.texData.get(dataId);\n const key = slice && slice.origDataId || dataId;\n const refCount = this.dataRefCount.get(key);\n\n if (refCount > 1) {\n this.dataRefCount.set(key, refCount - 1);\n } else {\n this.dataRefCount.delete(key);\n if (texture != null) {\n this.numBytesInGPU -= this.computeBytes(texShape, dtype);\n this.textureManager.releaseTexture(texture, texShape, usage, isPacked);\n }\n }\n\n const texData = this.texData.get(dataId);\n texData.texture = null;\n texData.texShape = null;\n texData.isPacked = false;\n texData.slice = null;\n }\n\n getTexture(dataId: DataId): WebGLTexture {\n this.uploadToGPU(dataId);\n return this.texData.get(dataId).texture.texture;\n }\n\n /**\n * Returns internal information for the specific data bucket. Used in unit\n * tests.\n */\n getDataInfo(dataId: DataId): TextureData {\n return this.texData.get(dataId);\n }\n\n /*\n Tests whether all the inputs to an op are small and on the CPU. This heuristic\n determines when it would be faster to execute a kernel on the CPU. WebGL\n kernels opt into running this check and forwarding when appropriate.\n TODO(https://github.com/tensorflow/tfjs/issues/872): Develop a more\n sustainable strategy for optimizing backend execution of ops.\n */\n shouldExecuteOnCPU(\n inputs: TensorInfo[],\n sizeThreshold = CPU_HANDOFF_SIZE_THRESHOLD): boolean {\n return env().getBool('WEBGL_CPU_FORWARD') &&\n inputs.every(\n input => this.texData.get(input.dataId).texture == null &&\n util.sizeFromShape(input.shape) < sizeThreshold);\n }\n\n getGPGPUContext(): GPGPUContext {\n return this.gpgpu;\n }\n\n where(condition: Tensor): Tensor2D {\n backend_util.warn(\n 'tf.where() in webgl locks the UI thread. ' +\n 'Call tf.whereAsync() instead');\n const condVals = condition.dataSync();\n return whereImpl(condition.shape, condVals);\n }\n\n private packedUnaryOp(x: TensorInfo, op: string, dtype: DataType) {\n const program = new UnaryOpPackedProgram(x.shape, op);\n const outInfo = this.compileAndRun(program, [x], dtype);\n return engine().makeTensorFromTensorInfo(outInfo);\n }\n\n // TODO(msoulanille) remove this once the backend has been modularized\n // a copy is needed here to break a circular dependency.\n // Also remove the op from unary_op.\n abs(x: T): T {\n // TODO: handle cases when x is complex.\n if (this.shouldExecuteOnCPU([x]) && x.dtype !== 'complex64') {\n const outValues =\n simpleAbsImplCPU(this.texData.get(x.dataId).values as TypedArray);\n return this.makeOutput(x.shape, x.dtype, outValues);\n }\n\n if (env().getBool('WEBGL_PACK_UNARY_OPERATIONS')) {\n return this.packedUnaryOp(x, unary_op.ABS, x.dtype) as T;\n }\n\n const program = new UnaryOpProgram(x.shape, unary_op.ABS);\n const outInfo = this.compileAndRun(program, [x]);\n return engine().makeTensorFromTensorInfo(outInfo) as T;\n }\n\n makeTensorInfo(\n shape: number[], dtype: DataType,\n values?: BackendValues|string[]): TensorInfo {\n let dataId;\n if (dtype === 'string' && values != null && values.length > 0 &&\n util.isString(values[0])) {\n const encodedValues =\n (values as {} as string[]).map(d => util.encodeString(d));\n\n dataId = this.write(encodedValues, shape, dtype);\n } else {\n dataId = this.write(values as TypedArray, shape, dtype);\n }\n\n this.texData.get(dataId).usage = null;\n return {dataId, shape, dtype};\n }\n\n private makeOutput(\n shape: number[], dtype: DataType, values?: BackendValues): T {\n return engine().makeTensorFromTensorInfo(\n this.makeTensorInfo(shape, dtype, values), this) as T;\n }\n\n unpackTensor(input: TensorInfo): TensorInfo {\n const program = new UnpackProgram(input.shape);\n return this.runWebGLProgram(program, [input], input.dtype);\n }\n\n packTensor(input: TensorInfo): TensorInfo {\n const program = new PackProgram(input.shape);\n const preventEagerUnpackingOutput = true;\n return this.runWebGLProgram(\n program, [input], input.dtype, null /* customUniformValues */,\n preventEagerUnpackingOutput);\n }\n\n private packedReshape(input: TensorInfo, afterShape: number[]): TensorInfo {\n const input3DShape = [\n webgl_util.getBatchDim(input.shape),\n ...webgl_util.getRowsCols(input.shape)\n ] as [number, number, number];\n const input3D: TensorInfo = {\n dtype: input.dtype,\n shape: input3DShape,\n dataId: input.dataId\n };\n const afterShapeAs3D = [\n webgl_util.getBatchDim(afterShape), ...webgl_util.getRowsCols(afterShape)\n ] as [number, number, number];\n\n const program = new ReshapePackedProgram(afterShapeAs3D, input3DShape);\n const preventEagerUnpackingOfOutput = true;\n const customValues = [input3DShape];\n const output = this.runWebGLProgram(\n program, [input3D], input.dtype, customValues,\n preventEagerUnpackingOfOutput);\n return {dataId: output.dataId, shape: afterShape, dtype: output.dtype};\n }\n\n private decode(dataId: DataId, customTexShape?: [number, number]):\n TensorInfo {\n const texData = this.texData.get(dataId);\n const {isPacked, shape, dtype} = texData;\n if (customTexShape != null) {\n const size = util.sizeFromShape(shape);\n const texSize = customTexShape[0] * customTexShape[1] * 4;\n util.assert(\n size <= texSize,\n () => 'customTexShape is too small. ' +\n 'Row * Column * 4 should be equal or larger than the ' +\n 'size of the tensor data.');\n }\n const shapeAs3D =\n webgl_util.getShapeAs3D(shape) as [number, number, number];\n let program;\n if (isPacked) {\n program = new DecodeMatrixPackedProgram(shapeAs3D);\n } else {\n program = new DecodeMatrixProgram(shapeAs3D);\n }\n const preventEagerUnpackingOfOutput = true;\n const customValues =\n [customTexShape != null ? customTexShape :\n tex_util.getDenseTexShape(shapeAs3D)];\n const out = this.runWebGLProgram(\n program, [{shape: shapeAs3D, dtype, dataId}], dtype, customValues,\n preventEagerUnpackingOfOutput, customTexShape);\n return {dtype, shape, dataId: out.dataId};\n }\n\n runWebGLProgram(\n program: GPGPUProgram, inputs: TensorInfo[], outputDtype: DataType,\n customUniformValues?: number[][], preventEagerUnpackingOfOutput = false,\n customTexShape?: [number, number]): TensorInfo {\n const output = this.makeTensorInfo(program.outputShape, outputDtype);\n const outData = this.texData.get(output.dataId);\n if (program.packedOutput) {\n outData.isPacked = true;\n }\n if (program.outPackingScheme === tex_util.PackingScheme.DENSE) {\n const texelShape = customTexShape != null ?\n customTexShape :\n tex_util.getDenseTexShape(program.outputShape);\n // For a densely packed output, we explicitly set texShape\n // so it doesn't get assigned later according to our typical packing\n // scheme wherein a single texel can only contain values from adjacent\n // rows/cols.\n outData.texShape = texelShape.map(d => d * 2) as [number, number];\n }\n if (program.outTexUsage != null) {\n outData.usage = program.outTexUsage;\n }\n\n if (util.sizeFromShape(output.shape) === 0) {\n // Short-circuit the computation since the result is empty (has 0 in its\n // shape).\n outData.values =\n util.getTypedArrayFromDType(output.dtype as 'float32', 0);\n return output;\n }\n\n const dataToDispose: TensorInfo[] = [];\n const inputsData: TensorData[] = inputs.map(input => {\n if (input.dtype === 'complex64') {\n throw new Error(\n `GPGPUProgram does not support complex64 input. For complex64 ` +\n `dtypes, please separate the program into real and imaginary ` +\n `parts.`);\n }\n\n let texData = this.texData.get(input.dataId);\n\n if (texData.texture == null) {\n if (!program.packedInputs &&\n util.sizeFromShape(input.shape) <=\n env().getNumber('WEBGL_SIZE_UPLOAD_UNIFORM')) {\n // Upload small tensors that live on the CPU as uniforms, not as\n // textures. Do this only when the environment supports 32bit floats\n // due to problems when comparing 16bit floats with 32bit floats.\n // TODO(https://github.com/tensorflow/tfjs/issues/821): Make it\n // possible for packed shaders to sample from uniforms.\n return {\n shape: input.shape,\n texData: null,\n isUniform: true,\n uniformValues: texData.values as TypedArray\n };\n }\n\n // This ensures that if a packed program's inputs have not yet been\n // uploaded to the GPU, they get uploaded as packed right off the bat.\n if (program.packedInputs) {\n texData.isPacked = true;\n texData.shape = input.shape;\n }\n }\n\n this.uploadToGPU(input.dataId);\n if (!!texData.isPacked !== !!program.packedInputs) {\n input = texData.isPacked ? this.unpackTensor(input) :\n this.packTensor(input);\n dataToDispose.push(input);\n texData = this.texData.get(input.dataId);\n } else if (\n texData.isPacked &&\n !webgl_util.isReshapeFree(texData.shape, input.shape)) {\n // This is a special case where a texture exists for a tensor\n // but the shapes are incompatible (due to packing constraints) because\n // the tensor did not have a chance to go through the packed reshape\n // shader. This only happens when we reshape the *same* tensor to form\n // *distinct* inputs to an op, e.g. dotting a vector with itself. This\n // case will disappear once packed uploading is the default.\n\n const savedInput = input;\n const targetShape = input.shape;\n\n input.shape = texData.shape;\n input = this.packedReshape(input as Tensor, targetShape);\n dataToDispose.push(input);\n texData = this.texData.get(input.dataId);\n\n savedInput.shape = targetShape;\n }\n\n return {shape: input.shape, texData, isUniform: false};\n });\n\n this.uploadToGPU(output.dataId);\n const outputData:\n TensorData = {shape: output.shape, texData: outData, isUniform: false};\n const key = gpgpu_math.makeShaderKey(program, inputsData, outputData);\n const binary = this.getAndSaveBinary(key, () => {\n return gpgpu_math.compileProgram(\n this.gpgpu, program, inputsData, outputData);\n });\n const shouldTimeProgram = this.activeTimers != null;\n let query: WebGLQuery|CPUTimerQuery;\n if (shouldTimeProgram) {\n query = this.startTimer();\n }\n\n if (!env().get('ENGINE_COMPILE_ONLY')) {\n gpgpu_math.runProgram(\n this.gpgpu, binary, inputsData, outputData, customUniformValues);\n }\n\n dataToDispose.forEach(info => this.disposeIntermediateTensorInfo(info));\n\n if (shouldTimeProgram) {\n query = this.endTimer(query);\n this.activeTimers.push(\n {name: program.constructor.name, query: this.getQueryTime(query)});\n }\n\n const glFlushThreshold = env().get('WEBGL_FLUSH_THRESHOLD');\n // Manually GL flush requested\n if (glFlushThreshold > 0) {\n const time = util.now();\n if ((time - this.lastGlFlushTime) > glFlushThreshold) {\n this.gpgpu.gl.flush();\n this.lastGlFlushTime = time;\n }\n }\n\n if (!env().getBool('WEBGL_LAZILY_UNPACK') && outData.isPacked &&\n preventEagerUnpackingOfOutput === false) {\n const unpacked = this.unpackTensor(output);\n this.disposeIntermediateTensorInfo(output);\n return unpacked;\n }\n return output;\n }\n\n compileAndRun(\n program: GPGPUProgram, inputs: TensorInfo[], outputDtype?: DataType,\n customUniformValues?: number[][],\n preventEagerUnpackingOfOutput = false): TensorInfo {\n outputDtype = outputDtype || inputs[0].dtype;\n const outInfo = this.runWebGLProgram(\n program, inputs, outputDtype, customUniformValues,\n preventEagerUnpackingOfOutput);\n return outInfo;\n }\n\n private getAndSaveBinary(key: string, getBinary: () => GPGPUBinary):\n GPGPUBinary {\n if (!(key in this.binaryCache)) {\n this.binaryCache[key] = getBinary();\n }\n return this.binaryCache[key];\n }\n\n getTextureManager(): TextureManager {\n return this.textureManager;\n }\n\n private disposed = false;\n\n dispose() {\n if (this.disposed) {\n return;\n }\n // Avoid disposing the compiled webgl programs during unit testing because\n // it slows down test execution.\n if (!env().getBool('IS_TEST')) {\n const allKeys = Object.keys(this.binaryCache);\n allKeys.forEach(key => {\n this.gpgpu.deleteProgram(this.binaryCache[key].webGLProgram);\n delete this.binaryCache[key];\n });\n }\n this.textureManager.dispose();\n if (this.canvas != null &&\n (typeof (HTMLCanvasElement) !== 'undefined' &&\n this.canvas instanceof HTMLCanvasElement)) {\n this.canvas.remove();\n } else {\n this.canvas = null;\n }\n if (this.gpgpuCreatedLocally) {\n this.gpgpu.program = null;\n this.gpgpu.dispose();\n }\n this.disposed = true;\n }\n\n floatPrecision(): 16|32 {\n if (this.floatPrecisionValue == null) {\n this.floatPrecisionValue = tidy(() => {\n if (!env().get('WEBGL_RENDER_FLOAT32_ENABLED')) {\n // Momentarily switching DEBUG flag to false so we don't throw an\n // error trying to upload a small value.\n const debugFlag = env().getBool('DEBUG');\n env().set('DEBUG', false);\n const underflowCheckValue = this.abs(scalar(1e-8)).dataSync()[0];\n env().set('DEBUG', debugFlag);\n\n if (underflowCheckValue > 0) {\n return 32;\n }\n }\n return 16;\n });\n }\n return this.floatPrecisionValue;\n }\n\n /** Returns the smallest representable number. */\n epsilon(): number {\n return this.floatPrecision() === 32 ? EPSILON_FLOAT32 : EPSILON_FLOAT16;\n }\n\n uploadToGPU(dataId: DataId): void {\n const texData = this.texData.get(dataId);\n const {shape, dtype, values, texture, usage, isPacked} = texData;\n\n if (texture != null) {\n // Array is already on GPU. No-op.\n return;\n }\n const shouldTimeProgram = this.activeTimers != null;\n let start: number;\n if (shouldTimeProgram) {\n start = util.now();\n }\n\n let texShape = texData.texShape;\n if (texShape == null) {\n // This texShape may not be the final texture shape. For packed or dense\n // textures, the texShape will be changed when textures are created.\n texShape = webgl_util.getTextureShapeFromLogicalShape(shape, isPacked);\n texData.texShape = texShape;\n }\n\n if (values != null) {\n const shapeAs3D = webgl_util.getShapeAs3D(shape);\n\n let program;\n let width = texShape[1], height = texShape[0];\n const isByteArray =\n values instanceof Uint8Array || values instanceof Uint8ClampedArray;\n\n // texture for float array is PhysicalTextureType.PACKED_2X2_FLOAT32, we\n // need to make sure the upload uses the same packed size\n if (isPacked || !isByteArray) {\n [width, height] = tex_util.getPackedMatrixTextureShapeWidthHeight(\n texShape[0], texShape[1]);\n }\n\n if (isPacked) {\n program = new EncodeMatrixPackedProgram(shapeAs3D, isByteArray);\n } else {\n program = new EncodeMatrixProgram(shapeAs3D, isByteArray);\n }\n\n // TexShape for float array needs to be the original shape, which byte\n // array needs to be packed size. This allow the data upload shape to be\n // matched with texture creation logic.\n const tempDenseInputTexShape: [number, number] =\n isByteArray ? [height, width] : texShape;\n const tempDenseInputHandle =\n this.makeTensorInfo(tempDenseInputTexShape, dtype);\n const tempDenseInputTexData =\n this.texData.get(tempDenseInputHandle.dataId);\n if (isByteArray) {\n tempDenseInputTexData.usage = TextureUsage.PIXELS;\n } else {\n tempDenseInputTexData.usage = TextureUsage.UPLOAD;\n }\n tempDenseInputTexData.texShape = tempDenseInputTexShape;\n this.gpgpu.uploadDenseMatrixToTexture(\n this.getTexture(tempDenseInputHandle.dataId), width, height,\n values as TypedArray);\n\n const customValues = [[height, width]];\n // We want the output to remain packed regardless of the value of\n // WEBGL_PACK.\n const preventEagerUnpacking = true;\n const encodedOutputTarget = this.runWebGLProgram(\n program, [tempDenseInputHandle], dtype, customValues,\n preventEagerUnpacking);\n\n // Have the original texture assume the identity of the encoded output.\n const outputTexData = this.texData.get(encodedOutputTarget.dataId);\n texData.texShape = outputTexData.texShape;\n texData.isPacked = outputTexData.isPacked;\n texData.usage = outputTexData.usage;\n\n if (!env().get('ENGINE_COMPILE_ONLY')) {\n texData.texture = outputTexData.texture;\n // Once uploaded, don't store the values on cpu.\n texData.values = null;\n this.texData.delete(encodedOutputTarget.dataId);\n } else {\n this.disposeData(encodedOutputTarget.dataId);\n }\n\n this.disposeIntermediateTensorInfo(tempDenseInputHandle);\n\n if (shouldTimeProgram) {\n this.uploadWaitMs += util.now() - start;\n }\n } else {\n const newTexture = this.acquireTexture(texShape, usage, dtype, isPacked);\n texData.texture = newTexture;\n }\n }\n\n private convertAndCacheOnCPU(dataId: DataId, float32Values?: Float32Array):\n TypedArray {\n const texData = this.texData.get(dataId);\n const {dtype} = texData;\n\n this.releaseGPUData(dataId);\n\n if (float32Values != null) {\n texData.values = float32ToTypedArray(float32Values, dtype as 'float32');\n }\n return texData.values as TypedArray;\n }\n\n private acquireTexture(\n texShape: [number, number], texType: TextureUsage, dtype: DataType,\n isPacked: boolean): Texture {\n this.numBytesInGPU += this.computeBytes(texShape, dtype);\n if (!this.warnedAboutMemory &&\n this.numBytesInGPU > this.numMBBeforeWarning * 1024 * 1024) {\n const mb = (this.numBytesInGPU / 1024 / 1024).toFixed(2);\n this.warnedAboutMemory = true;\n console.warn(\n `High memory usage in GPU: ${mb} MB, ` +\n `most likely due to a memory leak`);\n }\n return this.textureManager.acquireTexture(texShape, texType, isPacked);\n }\n\n private computeBytes(shape: [number, number], dtype: DataType) {\n return shape[0] * shape[1] * util.bytesPerElement(dtype);\n }\n\n checkCompileCompletion() {\n for (const [, binary] of Object.entries(this.binaryCache)) {\n this.checkCompletion_(binary);\n }\n }\n\n async checkCompileCompletionAsync(): Promise {\n const ps = [];\n if (this.gpgpu.parallelCompilationExtension) {\n for (const [, binary] of Object.entries(this.binaryCache)) {\n ps.push(this.checkCompletionAsync_(binary));\n }\n return Promise.all(ps);\n } else {\n for (const [, binary] of Object.entries(this.binaryCache)) {\n const p: Promise = new Promise((resolve) => {\n try {\n this.checkCompletion_(binary);\n resolve(true);\n } catch (error) {\n throw error;\n }\n });\n ps.push(p);\n }\n return Promise.all(ps);\n }\n }\n\n private async checkCompletionAsync_(binary: GPGPUBinary): Promise {\n if (this.gpgpu.gl.getProgramParameter(\n binary.webGLProgram,\n this.gpgpu.parallelCompilationExtension.COMPLETION_STATUS_KHR)) {\n return this.checkCompletion_(binary);\n } else {\n await nextFrame();\n return this.checkCompletionAsync_(binary);\n }\n }\n\n private checkCompletion_(binary: GPGPUBinary): boolean {\n if (this.gpgpu.gl.getProgramParameter(\n binary.webGLProgram, this.gpgpu.gl.LINK_STATUS) === false) {\n console.log(this.gpgpu.gl.getProgramInfoLog(binary.webGLProgram));\n if (this.gpgpu.gl.getShaderParameter(\n binary.fragmentShader, this.gpgpu.gl.COMPILE_STATUS) === false) {\n webgl_util.logShaderSourceAndInfoLog(\n binary.source,\n this.gpgpu.gl.getShaderInfoLog(binary.fragmentShader));\n throw new Error('Failed to compile fragment shader.');\n }\n throw new Error('Failed to link vertex and fragment shaders.');\n }\n return true;\n }\n\n getUniformLocations() {\n for (const [, binary] of Object.entries(this.binaryCache)) {\n const {\n uniformLocations,\n customUniformLocations,\n infLoc,\n nanLoc,\n inShapesLocations,\n inTexShapesLocations,\n outShapeLocation,\n outShapeStridesLocation,\n outTexShapeLocation\n } = getUniformLocations(this.gpgpu, binary.program, binary.webGLProgram);\n binary.uniformLocations = uniformLocations;\n binary.customUniformLocations = customUniformLocations;\n binary.infLoc = infLoc;\n binary.nanLoc = nanLoc;\n binary.inShapesLocations = inShapesLocations;\n binary.inTexShapesLocations = inTexShapesLocations;\n binary.outShapeLocation = outShapeLocation;\n binary.outShapeStridesLocation = outShapeStridesLocation;\n binary.outTexShapeLocation = outTexShapeLocation;\n }\n }\n\n /**\n * Create a TF.js tensor out of an existing WebGL texture. A new texture will\n * be created.\n */\n createTensorFromTexture(values: WebGLData, shape: number[], dtype: DataType):\n Tensor {\n const {texture, height, width, channels} = values;\n const backend = engine().backend as MathBackendWebGL;\n\n // Have to throw an error, otherwise WebGL just warns and returns wrong\n // values.\n if (!backend.gpgpu.gl.isTexture(texture)) {\n throw new Error(\n `The texture is invalid. Also, please make sure the texture and ` +\n `the TFJS WebGL backend are using the same canvas. If you want to ` +\n `use your own custom canvas, you have to create and use the custom ` +\n `TFJS WebGL backend created from the canvas through ` +\n `'new tf.MathBackendWebGL(customCanvas)'.`);\n }\n\n const dataId =\n backend.writeTexture(texture, shape, dtype, height, width, channels);\n return engine().makeTensorFromDataId(dataId, shape, dtype, backend);\n }\n}\n\nfunction float32ToTypedArray(\n a: Float32Array, dtype: D): tf.DataTypeMap[D] {\n if (dtype === 'float32' || dtype === 'complex64') {\n return a as tf.DataTypeMap[D];\n } else if (dtype === 'int32' || dtype === 'bool') {\n const result = (dtype === 'int32') ? new Int32Array(a.length) :\n new Uint8Array(a.length);\n for (let i = 0; i < result.length; ++i) {\n result[i] = Math.round(a[i]);\n }\n return result as tf.DataTypeMap[D];\n } else {\n throw new Error(`Unknown dtype ${dtype}`);\n }\n}\n","/** @license See the LICENSE file. */\n\n// This code is auto-generated, do not modify this file!\nconst version = '4.0.0';\nexport {version};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env} from '@tensorflow/tfjs-core';\n\nimport * as gpgpu_util from './gpgpu_util';\nimport * as webgl_util from './webgl_util';\n\nexport {MathBackendWebGL, WebGLMemoryInfo, WebGLTimingInfo} from './backend_webgl';\nexport {setWebGLContext} from './canvas_util';\nexport {GPGPUContext} from './gpgpu_context';\nexport {GPGPUProgram} from './gpgpu_math';\n// WebGL specific utils.\nexport {gpgpu_util, webgl_util};\n\n/**\n * Enforce use of half precision textures if available on the platform.\n *\n * @doc {heading: 'Environment', namespace: 'webgl'}\n */\nexport function forceHalfFloat(): void {\n env().set('WEBGL_FORCE_F16_TEXTURES', true);\n}\n","/**\n * @license\n * Copyright 2020 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// base.ts is the webgl backend without auto kernel registration.\n\nimport {device_util, registerBackend} from '@tensorflow/tfjs-core';\nimport {MathBackendWebGL} from './backend_webgl';\nexport {version as version_webgl} from './version';\n\nif (device_util.isBrowser()) {\n registerBackend('webgl', () => new MathBackendWebGL(), 2 /* priority */);\n}\n\n// Export webgl utilities\nexport * from './webgl';\n\n// Export forceHalfFlost under webgl namespace for the union bundle.\nimport {forceHalfFloat} from './webgl';\nexport const webgl = {forceHalfFloat};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\n\nimport {GPGPUProgram, useShapeUniforms} from './gpgpu_math';\n\nexport const CHECK_NAN_SNIPPET = `\n if (isnan(a)) return a;\n if (isnan(b)) return b;\n`;\n\nexport const SQUARED_DIFFERENCE = 'return (a - b) * (a - b);';\nexport class BinaryOpProgram implements GPGPUProgram {\n variableNames = ['A', 'B'];\n outputShape: number[];\n userCode: string;\n enableShapeUniforms: boolean;\n\n constructor(op: string, aShape: number[], bShape: number[]) {\n this.outputShape = backend_util.assertAndGetBroadcastShape(aShape, bShape);\n this.enableShapeUniforms = useShapeUniforms(this.outputShape.length);\n this.userCode = `\n float binaryOperation(float a, float b) {\n ${op}\n }\n\n void main() {\n float a = getAAtOutCoords();\n float b = getBAtOutCoords();\n setOutput(binaryOperation(a, b));\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, util} from '@tensorflow/tfjs-core';\n\nimport {GPGPUProgram, useShapeUniforms} from './gpgpu_math';\nimport {getChannels} from './packing_util';\nimport {getCoordsDataType} from './shader_compiler';\n\nexport const CHECK_NAN_SNIPPET_PACKED = `\n result.r = isNaN.r ? NAN : result.r;\n result.g = isNaN.g ? NAN : result.g;\n result.b = isNaN.b ? NAN : result.b;\n result.a = isNaN.a ? NAN : result.a;\n`;\n\nexport const ELU_DER = `\n vec4 bGTEZero = vec4(greaterThanEqual(b, vec4(0.)));\n return (bGTEZero * a) + ((vec4(1.0) - bGTEZero) * (a * (b + vec4(1.0))));\n`;\n\nexport const NOT_EQUAL = `\n return vec4(notEqual(a, b));\n`;\n\nexport class BinaryOpPackedProgram implements GPGPUProgram {\n variableNames = ['A', 'B'];\n outputShape: number[];\n userCode: string;\n supportsBroadcasting = true;\n packedInputs = true;\n packedOutput = true;\n enableShapeUniforms: boolean;\n\n constructor(\n op: string, aShape: number[], bShape: number[],\n checkOutOfBounds = false) {\n this.outputShape = backend_util.assertAndGetBroadcastShape(aShape, bShape);\n const rank = this.outputShape.length;\n this.enableShapeUniforms = useShapeUniforms(rank);\n let checkOutOfBoundsString = '';\n if (checkOutOfBounds) {\n if (rank === 0 || util.sizeFromShape(this.outputShape) === 1) {\n checkOutOfBoundsString = `\n result.y = 0.;\n result.z = 0.;\n result.w = 0.;\n `;\n } else {\n const dtype = getCoordsDataType(rank);\n checkOutOfBoundsString = `\n ${dtype} coords = getOutputCoords();\n `;\n if (rank === 1) {\n if (this.enableShapeUniforms) {\n checkOutOfBoundsString += `\n result.y = (coords + 1) >= outShape ? 0. : result.y;\n result.z = 0.;\n result.w = 0.;\n `;\n } else {\n checkOutOfBoundsString += `\n result.y = (coords + 1) >= ${this.outputShape[0]} ? 0. : result.y;\n result.z = 0.;\n result.w = 0.;\n `;\n }\n } else {\n const channels = getChannels('coords', rank);\n if (this.enableShapeUniforms) {\n checkOutOfBoundsString += `\n bool nextRowOutOfBounds =\n (${channels[rank - 2]} + 1) >= outShape[${rank} - 2];\n bool nextColOutOfBounds =\n (${channels[rank - 1]} + 1) >= outShape[${rank} - 1];\n result.y = nextColOutOfBounds ? 0. : result.y;\n result.z = nextRowOutOfBounds ? 0. : result.z;\n result.w = nextColOutOfBounds || nextRowOutOfBounds ? 0. : result.w;\n `;\n } else {\n checkOutOfBoundsString += `\n bool nextRowOutOfBounds =\n (${channels[rank - 2]} + 1) >= ${this.outputShape[rank - 2]};\n bool nextColOutOfBounds =\n (${channels[rank - 1]} + 1) >= ${this.outputShape[rank - 1]};\n result.y = nextColOutOfBounds ? 0. : result.y;\n result.z = nextRowOutOfBounds ? 0. : result.z;\n result.w = nextColOutOfBounds || nextRowOutOfBounds ? 0. : result.w;\n `;\n }\n }\n }\n }\n\n this.userCode = `\n vec4 binaryOperation(vec4 a, vec4 b) {\n ${op}\n }\n\n void main() {\n vec4 a = getAAtOutCoords();\n vec4 b = getBAtOutCoords();\n\n vec4 result = binaryOperation(a, b);\n ${checkOutOfBoundsString}\n\n setOutput(result);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Identity, IdentityInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\n\nexport function identity(\n args: {inputs: IdentityInputs, backend: MathBackendWebGL}): TensorInfo {\n const {inputs, backend} = args;\n const {x} = inputs;\n\n backend.incRef(x.dataId);\n\n return {dataId: x.dataId, shape: x.shape, dtype: x.dtype};\n}\n\nexport const identityConfig: KernelConfig = {\n kernelName: Identity,\n backendName: 'webgl',\n kernelFunc: identity as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Complex, ComplexInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {identity} from './Identity';\n\n/**\n * In WebGL data is stored in GPU textures which can't be efficiently copied, so\n * complex tensors share data with their real and imaginary components. Complex\n * tensors' reference to the components is tracked by refCount on the individual\n * component. The refCounts are increased by the identity call.\n *\n * When a complex tensor is disposed, it will reduce the refCount on the\n * components by calling disposeData on each.\n */\nexport function complex(\n args: {inputs: ComplexInputs, backend: MathBackendWebGL}): TensorInfo {\n const {inputs, backend} = args;\n const {real, imag} = inputs;\n\n const complexInfo = backend.makeTensorInfo(real.shape, 'complex64');\n const complex = backend.texData.get(complexInfo.dataId);\n\n const realTensorInfo = identity({inputs: {x: real}, backend});\n\n const imagTensorInfo = identity({inputs: {x: imag}, backend});\n\n complex.complexTensorInfos = {real: realTensorInfo, imag: imagTensorInfo};\n\n return complexInfo;\n}\n\nexport const complexConfig: KernelConfig = {\n kernelName: Complex,\n backendName: 'webgl',\n kernelFunc: complex as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env, KernelConfig, KernelFunc, LeakyRelu, LeakyReluAttrs, LeakyReluInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {BinaryOpProgram} from '../binaryop_gpu';\nimport {BinaryOpPackedProgram} from '../binaryop_packed_gpu';\n\nexport const LEAKYRELU = `return (a < 0.) ? b * a : a;`;\nexport const LEAKYRELU_PACKED = `\n vec4 aLessThanZero = vec4(lessThan(a, vec4(0.)));\n return (aLessThanZero * (b * a)) + ((vec4(1.0) - aLessThanZero) * a);\n`;\n\nexport function leakyRelu(args: {\n inputs: LeakyReluInputs,\n backend: MathBackendWebGL,\n attrs: LeakyReluAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {alpha} = attrs;\n\n const $alpha = backend.makeTensorInfo(\n [], 'float32',\n util.createScalarValue(alpha as {} as 'float32', 'float32'));\n\n const program = env().getBool('WEBGL_PACK_BINARY_OPERATIONS') ?\n new BinaryOpPackedProgram(LEAKYRELU_PACKED, x.shape, $alpha.shape) :\n new BinaryOpProgram(LEAKYRELU, x.shape, $alpha.shape);\n const result = backend.runWebGLProgram(program, [x, $alpha], 'float32');\n\n backend.disposeIntermediateTensorInfo($alpha);\n\n return result;\n}\n\nexport const leakyReluConfig: KernelConfig = {\n kernelName: LeakyRelu,\n backendName: 'webgl',\n kernelFunc: leakyRelu as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env, KernelConfig, KernelFunc, Prelu, PreluInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {BinaryOpProgram} from '../binaryop_gpu';\nimport {BinaryOpPackedProgram} from '../binaryop_packed_gpu';\n\nexport const PRELU = `return (a < 0.) ? b * a : a;`;\nexport const PRELU_PACKED = `\n vec4 aLessThanZero = vec4(lessThan(a, vec4(0.)));\n return (aLessThanZero * (b * a)) + ((vec4(1.0) - aLessThanZero) * a);\n`;\n\nexport function prelu(args: {inputs: PreluInputs, backend: MathBackendWebGL}):\n TensorInfo {\n const {inputs, backend} = args;\n const {x, alpha} = inputs;\n\n const program = env().getBool('WEBGL_PACK_BINARY_OPERATIONS') ?\n new BinaryOpPackedProgram(PRELU_PACKED, x.shape, alpha.shape) :\n new BinaryOpProgram(PRELU, x.shape, alpha.shape);\n return backend.runWebGLProgram(program, [x, alpha], 'float32');\n}\n\nexport const preluConfig: KernelConfig = {\n kernelName: Prelu,\n backendName: 'webgl',\n kernelFunc: prelu as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, BinaryInputs, DataType, env, KernelFunc, TypedArray, UnaryInputs, upcastType} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {BinaryOpProgram} from '../binaryop_gpu';\nimport {BinaryOpPackedProgram} from '../binaryop_packed_gpu';\nimport {complex} from '../kernels/Complex';\nimport {LEAKYRELU, LEAKYRELU_PACKED} from '../kernels/LeakyRelu';\nimport {PRELU, PRELU_PACKED} from '../kernels/Prelu';\nimport * as unary_op from '../unaryop_gpu';\nimport {UnaryOpProgram} from '../unaryop_gpu';\nimport * as unary_packed_op from '../unaryop_packed_gpu';\nimport {UnaryOpPackedProgram} from '../unaryop_packed_gpu';\n\nimport {SimpleBinaryKernelImplCPU, SimpleUnaryKernelImplCPU} from './shared';\n\nexport const CHECK_NAN_SNIPPET_UNARY = `if (isnan(x)) return x;`;\n\ntype UnaryKernelFuncConfig = {\n opSnippet: string,\n packedOpSnippet?: string,\n cpuKernelImpl?: SimpleUnaryKernelImplCPU,\n dtype?: DataType\n};\n\n/**\n * Template that creates a `KernelFunc` for unary ops.\n * @param opSnippet Op snippet to create `UnaryOpProgram`.\n * @param packedOpSnippet Op snippet to create `UnaryOpPackedProgram`.\n * @param dtype Optional. If set, the result has this dtype. Otherwise, the\n * result has the same dtype as the first input. This is mainly used in\n * comparison kernels, such as Equal, Less, Greater, etc.\n */\nexport function unaryKernelFunc(\n {opSnippet, packedOpSnippet, cpuKernelImpl, dtype}: UnaryKernelFuncConfig):\n KernelFunc {\n return ({inputs, backend}) => {\n const {x} = inputs as UnaryInputs;\n const webglBackend = backend as MathBackendWebGL;\n\n const $dtype = dtype || x.dtype;\n if (webglBackend.shouldExecuteOnCPU([x]) && cpuKernelImpl != null) {\n const xData = webglBackend.texData.get(x.dataId);\n const outValues = cpuKernelImpl(xData.values as TypedArray, $dtype);\n return webglBackend.makeTensorInfo(x.shape, $dtype, outValues);\n }\n\n const shouldUsePackedProgram =\n env().getBool('WEBGL_PACK_UNARY_OPERATIONS') && packedOpSnippet != null;\n let program: UnaryOpProgram|UnaryOpPackedProgram;\n if (shouldUsePackedProgram) {\n program = new UnaryOpPackedProgram(x.shape, packedOpSnippet);\n } else {\n program = new UnaryOpProgram(x.shape, opSnippet);\n }\n\n return webglBackend.runWebGLProgram(program, [x], $dtype);\n };\n}\n\ntype BinaryKernelFuncConfig = {\n opSnippet: string,\n packedOpSnippet?: string,\n checkOutOfBounds?: boolean,\n supportsComplex?: boolean,\n cpuKernelImpl?: SimpleBinaryKernelImplCPU,\n dtype?: DataType\n};\n\n/**\n * Template that creates a `KernelFunc` for binary ops.\n * @param opSnippet Op snippet to create `BinaryOpProgram`.\n * @param packedOpSnippet Op snippet to create `BinaryOpPackedProgram`.\n * @param checkOutOfBoundsForPackedProgram Whether to set checkOutOfBounds=true\n * when creating BinaryOpPackedProgram.\n * @param dtype Optional. If set, the result has this dtype. Otherwise, the\n * result has the same dtype as the first input. This is mainly used in\n * comparison kernels, such as Equal, Less, Greater, etc.\n */\nexport function binaryKernelFunc({\n opSnippet,\n packedOpSnippet,\n checkOutOfBounds = false,\n supportsComplex = false,\n cpuKernelImpl,\n dtype\n}: BinaryKernelFuncConfig): KernelFunc {\n return ({inputs, backend}) => {\n const {a, b} = inputs as BinaryInputs;\n const webglBackend = backend as MathBackendWebGL;\n\n if (supportsComplex && a.dtype === 'complex64') {\n const aData = webglBackend.texData.get(a.dataId);\n const bData = webglBackend.texData.get(b.dataId);\n\n const [real, imag] = [\n [aData.complexTensorInfos.real, bData.complexTensorInfos.real],\n [aData.complexTensorInfos.imag, bData.complexTensorInfos.imag]\n ].map(complexParts => {\n const [aPart, bPart] = complexParts;\n\n const aHandle = {\n dataId: aPart.dataId,\n dtype: aPart.dtype,\n shape: a.shape\n };\n const bHandle = {\n dataId: bPart.dataId,\n dtype: bPart.dtype,\n shape: b.shape\n };\n\n const program = new BinaryOpProgram(opSnippet, a.shape, b.shape);\n return webglBackend.runWebGLProgram(\n program, [aHandle, bHandle], upcastType(aPart.dtype, bPart.dtype));\n });\n\n const complexOutput =\n complex({inputs: {real, imag}, backend: webglBackend});\n\n webglBackend.disposeIntermediateTensorInfo(real);\n webglBackend.disposeIntermediateTensorInfo(imag);\n\n // TODO(annxingyuan): Implement CPU forwarding for complex inputs.\n\n return complexOutput;\n }\n\n const $dtype = dtype || upcastType(a.dtype, b.dtype);\n if ((a.dtype === 'string' || b.dtype === 'string' ||\n webglBackend.shouldExecuteOnCPU([a, b])) &&\n cpuKernelImpl != null) {\n const aVals = webglBackend.texData.get(a.dataId).values as TypedArray;\n const bVals = webglBackend.texData.get(b.dataId).values as TypedArray;\n\n const decodedAVals = a.dtype === 'string' ?\n // tslint:disable-next-line: no-any\n backend_util.fromUint8ToStringArray(aVals as any as Uint8Array[]) :\n aVals;\n const decodedBVals = a.dtype === 'string' ?\n // tslint:disable-next-line: no-any\n backend_util.fromUint8ToStringArray(bVals as any as Uint8Array[]) :\n bVals;\n const [outValues, outShape] =\n cpuKernelImpl(a.shape, b.shape, decodedAVals, decodedBVals, $dtype);\n\n const out = webglBackend.makeTensorInfo(outShape, $dtype);\n const outData = webglBackend.texData.get(out.dataId);\n outData.values = outValues;\n return out;\n }\n\n const shouldUsePackedProgram =\n env().getBool('WEBGL_PACK_BINARY_OPERATIONS') &&\n packedOpSnippet != null;\n let program: BinaryOpProgram|BinaryOpPackedProgram;\n if (shouldUsePackedProgram) {\n program = new BinaryOpPackedProgram(\n packedOpSnippet, a.shape, b.shape, checkOutOfBounds);\n } else {\n program = new BinaryOpProgram(opSnippet, a.shape, b.shape);\n }\n\n return webglBackend.runWebGLProgram(program, [a, b], $dtype);\n };\n}\n\nexport function mapActivationToShaderProgram(\n activation: backend_util.Activation, packed = false): string {\n if (activation === 'linear') {\n if (packed) {\n return unary_packed_op.LINEAR;\n }\n return unary_op.LINEAR;\n } else if (activation === 'relu') {\n if (packed) {\n return unary_packed_op.RELU;\n }\n return unary_op.RELU;\n } else if (activation === 'elu') {\n if (packed) {\n return unary_packed_op.ELU;\n }\n return unary_op.ELU;\n } else if (activation === 'relu6') {\n if (packed) {\n return unary_packed_op.RELU6;\n }\n return unary_op.RELU6;\n } else if (activation === 'prelu') {\n if (packed) {\n return PRELU_PACKED;\n }\n return PRELU;\n } else if (activation === 'leakyrelu') {\n if (packed) {\n return LEAKYRELU_PACKED;\n }\n return LEAKYRELU;\n } else if (activation === 'sigmoid') {\n if (packed) {\n return unary_packed_op.SIGMOID;\n }\n return unary_op.SIGMOID;\n }\n throw new Error(`Activation ${\n activation} has not been implemented for the WebGL backend.`);\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram, useShapeUniforms} from './gpgpu_math';\n\nexport class MatMulPackedProgram implements GPGPUProgram {\n variableNames = ['matrixA', 'matrixB'];\n packedInputs = true;\n packedOutput = true;\n outputShape: number[];\n userCode: string;\n enableShapeUniforms: boolean;\n\n constructor(\n aShape: [number, number, number], bShape: [number, number, number],\n outputShape: [number, number, number], transposeA = false,\n transposeB = false, addBias = false, activation: string = null,\n hasPreluActivation = false, hasLeakyreluActivation = false) {\n this.outputShape = outputShape;\n this.enableShapeUniforms = useShapeUniforms(this.outputShape.length);\n\n const sharedDim = transposeA ? aShape[1] : aShape[2];\n const sharedDimensionPacked = Math.ceil(sharedDim / 2);\n\n const aSample = transposeA ? 'i * 2, rc.y' : 'rc.y, i * 2';\n const bSample = transposeB ? 'rc.z, i * 2' : 'i * 2, rc.z';\n const aSwizzle = transposeA ? ['a.xxyy', 'a.zzww'] : ['a.xxzz', 'a.yyww'];\n const bSwizzle = transposeB ? ['b.xzxz', 'b.ywyw'] : ['b.xyxy', 'b.zwzw'];\n\n let activationSnippet = '', applyActivationSnippet = '';\n if (activation) {\n if (hasPreluActivation) {\n activationSnippet = `vec4 activation(vec4 a) {\n vec4 b = getPreluActivationWeightsAtOutCoords();\n ${activation}\n }`;\n } else if (hasLeakyreluActivation) {\n activationSnippet = `vec4 activation(vec4 a) {\n vec4 b = getLeakyreluAlphaAtOutCoords();\n ${activation}\n }`;\n } else {\n activationSnippet = `vec4 activation(vec4 x) {\n ${activation}\n }`;\n }\n\n applyActivationSnippet = `result = activation(result);`;\n }\n\n const addBiasSnippet = addBias ? 'result += getBiasAtOutCoords();' : '';\n if (addBias) {\n this.variableNames.push('bias');\n }\n\n if (hasPreluActivation) {\n this.variableNames.push('preluActivationWeights');\n }\n\n if (hasLeakyreluActivation) {\n this.variableNames.push('leakyreluAlpha');\n }\n\n let batchASnippet = 'rc.x';\n let batchBSnippet = 'rc.x';\n if (aShape[0] < bShape[0]) {\n batchASnippet = `int(min(float(rc.x), ${aShape[0] - 1}.))`;\n } else if (bShape[0] < aShape[0]) {\n batchBSnippet = `int(min(float(rc.x), ${bShape[0] - 1}.))`;\n }\n\n this.userCode = `\n ${activationSnippet}\n // Don't use uniform for sharedDimensionPacked for performance.\n const float sharedDimension = ${sharedDimensionPacked}.0;\n\n vec4 dot2x2ARowBCol(ivec3 rc) {\n vec4 result = vec4(0);\n for (int i = 0; i < ${sharedDimensionPacked}; i++) {\n int batchA = ${batchASnippet};\n int batchB = ${batchBSnippet};\n vec4 a = getMatrixA(batchA, ${aSample});\n vec4 b = getMatrixB(batchB, ${bSample});\n\n // These swizzled products need to be separately added.\n // See: https://github.com/tensorflow/tfjs/issues/1735\n result += (${aSwizzle[0]} * ${bSwizzle[0]});\n result += (${aSwizzle[1]} * ${bSwizzle[1]});\n }\n return result;\n }\n\n void main() {\n ivec3 rc = getOutputCoords();\n vec4 result = dot2x2ARowBCol(rc);\n\n ${addBiasSnippet}\n\n ${applyActivationSnippet}\n\n setOutput(result);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {GPGPUProgram} from './gpgpu_math';\n\n// (Ar + Ai)(Br + Bi) =\n// ArBr + ArBi + AiBr + AiBi = ArBr - AB + ArBi + AiBr\n// Yr = ArBr - AB\n// Yi = ArBi + AiBr\nexport const COMPLEX_MULTIPLY = {\n REAL: 'return areal * breal - aimag * bimag;',\n IMAG: 'return areal * bimag + aimag * breal;'\n};\n\nexport class BinaryOpComplexProgram implements GPGPUProgram {\n variableNames = ['AReal', 'AImag', 'BReal', 'BImag'];\n userCode: string;\n outputShape: number[];\n\n constructor(op: string, aShape: number[], bShape: number[]) {\n this.outputShape = backend_util.assertAndGetBroadcastShape(aShape, bShape);\n\n this.userCode = `\n float binaryOpComplex(\n float areal, float aimag, float breal, float bimag) {\n ${op}\n }\n\n void main() {\n float areal = getARealAtOutCoords();\n float aimag = getAImagAtOutCoords();\n float breal = getBRealAtOutCoords();\n float bimag = getBImagAtOutCoords();\n setOutput(binaryOpComplex(areal, aimag, breal, bimag));\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, BinaryInputs, env, KernelConfig, Multiply, TensorInfo, TypedArray} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport * as binaryop_complex_gpu from '../binaryop_complex_gpu';\nimport {BinaryOpComplexProgram} from '../binaryop_complex_gpu';\nimport {BinaryOpProgram} from '../binaryop_gpu';\nimport {BinaryOpPackedProgram} from '../binaryop_packed_gpu';\nimport {multiplyImplCPU as cpuMultiply} from '../kernel_utils/shared';\n\nimport {complex} from './Complex';\n\nconst MUL = 'return a * b;';\n\nexport function multiply(\n args: {inputs: BinaryInputs, backend: MathBackendWebGL}): TensorInfo {\n const {inputs, backend} = args;\n const {a, b} = inputs;\n const dtype = backend_util.upcastType(a.dtype, b.dtype);\n\n if (a.dtype === 'complex64') {\n const aData = backend.texData.get(a.dataId);\n const bData = backend.texData.get(b.dataId);\n\n const realProgram = new BinaryOpComplexProgram(\n binaryop_complex_gpu.COMPLEX_MULTIPLY.REAL, a.shape, b.shape);\n const imagProgram = new BinaryOpComplexProgram(\n binaryop_complex_gpu.COMPLEX_MULTIPLY.IMAG, a.shape, b.shape);\n\n const inputs = [\n {\n dataId: aData.complexTensorInfos.real.dataId,\n dtype: aData.complexTensorInfos.real.dtype,\n shape: a.shape\n },\n {\n dataId: aData.complexTensorInfos.imag.dataId,\n dtype: aData.complexTensorInfos.imag.dtype,\n shape: a.shape\n },\n {\n dataId: bData.complexTensorInfos.real.dataId,\n dtype: bData.complexTensorInfos.real.dtype,\n shape: b.shape\n },\n {\n dataId: bData.complexTensorInfos.imag.dataId,\n dtype: bData.complexTensorInfos.imag.dtype,\n shape: b.shape\n }\n ];\n\n const realPart = backend.runWebGLProgram(realProgram, inputs, 'float32');\n const imagPart = backend.runWebGLProgram(imagProgram, inputs, 'float32');\n\n const complexOutput =\n complex({inputs: {real: realPart, imag: imagPart}, backend});\n\n backend.disposeIntermediateTensorInfo(realPart);\n backend.disposeIntermediateTensorInfo(imagPart);\n\n // TODO(annxingyuan): CPU forwarding for complex inputs.\n return complexOutput;\n }\n\n if (backend.shouldExecuteOnCPU([a, b])) {\n const aData = backend.texData.get(a.dataId);\n const bData = backend.texData.get(b.dataId);\n const [outValues, outShape] = cpuMultiply(\n a.shape, b.shape, aData.values as TypedArray,\n bData.values as TypedArray, dtype);\n\n const out = backend.makeTensorInfo(outShape, dtype);\n const outData = backend.texData.get(out.dataId);\n outData.values = outValues;\n return out;\n }\n\n let program: BinaryOpProgram|BinaryOpPackedProgram;\n if (env().getBool('WEBGL_PACK_BINARY_OPERATIONS')) {\n program = new BinaryOpPackedProgram(MUL, a.shape, b.shape);\n } else {\n program = new BinaryOpProgram(MUL, a.shape, b.shape);\n }\n\n return backend.runWebGLProgram(program, [a, b], dtype);\n}\n\nexport const multiplyConfig: KernelConfig = {\n kernelName: Multiply,\n backendName: 'webgl',\n kernelFunc: multiply\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {ReshapePackedProgram} from '../reshape_packed_gpu';\nimport {getBatchDim, getRowsCols} from '../webgl_util';\n\nexport function packedReshape(\n input: TensorInfo, afterShape: number[],\n backend: MathBackendWebGL): TensorInfo {\n const input3DShape =\n [getBatchDim(input.shape),\n ...getRowsCols(input.shape)] as [number, number, number];\n const input3D: TensorInfo = {\n dtype: input.dtype,\n shape: input3DShape,\n dataId: input.dataId\n };\n const afterShapeAs3D =\n [getBatchDim(afterShape),\n ...getRowsCols(afterShape)] as [number, number, number];\n\n const program = new ReshapePackedProgram(afterShapeAs3D, input3DShape);\n const preventEagerUnpackingOfOutput = true;\n const customValues = [input3DShape];\n const output = backend.runWebGLProgram(\n program, [input3D], input.dtype, customValues,\n preventEagerUnpackingOfOutput);\n return {dataId: output.dataId, shape: afterShape, dtype: output.dtype};\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Reshape, ReshapeAttrs, ReshapeInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {packedReshape} from '../kernel_utils/reshape';\nimport {isReshapeFree} from '../webgl_util';\n\nexport function reshape(args: {\n inputs: ReshapeInputs,\n backend: MathBackendWebGL,\n attrs: ReshapeAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {shape} = attrs;\n const webglBackend = backend;\n\n const xSize = util.sizeFromShape(x.shape);\n const $shape = util.inferFromImplicitShape(shape, xSize);\n const $xSize = util.sizeFromShape($shape);\n\n util.assert(\n xSize === $xSize,\n () => `The new shape (${$shape}) has ${$xSize} elements and the old ` +\n `shape (${x.shape}) has ${xSize} elements. The new shape and old ` +\n `shape must have the same number of elements.`);\n\n const xTexData = webglBackend.texData.get(x.dataId);\n if (xTexData.isPacked && !isReshapeFree(x.shape, $shape) &&\n !(xTexData.texture !== null && isReshapeFree(xTexData.shape, $shape))) {\n return packedReshape(x, $shape, webglBackend);\n }\n\n webglBackend.incRef(x.dataId);\n\n return {dataId: x.dataId, shape: $shape, dtype: x.dtype};\n}\n\nexport const reshapeConfig: KernelConfig = {\n kernelName: Reshape,\n backendName: 'webgl',\n kernelFunc: reshape as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, util} from '@tensorflow/tfjs-core';\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class MeanProgram implements GPGPUProgram {\n variableNames = ['x'];\n outputShape: number[];\n userCode: string;\n\n constructor(reduceInfo: backend_util.ReduceInfo, divisor?: number) {\n const {windowSize, batchSize, inSize, outSize} = reduceInfo;\n this.outputShape = [batchSize, outSize];\n\n const windowSizeNearestVec4 = Math.floor(windowSize / 4) * 4;\n const windowSizeVec4Remainder = windowSize % 4;\n\n let updateSnippet = `sumValue += dot(values, ones);`;\n if (divisor != null) {\n const denominator = 1 / divisor;\n updateSnippet = `sumValue += dot(values * ${\n util.isInt(denominator) ? denominator.toPrecision(2) :\n denominator}, ones);`;\n }\n\n let checkOutOfBounds = '';\n if (inSize % windowSize > 0) {\n checkOutOfBounds = `\n if (inIdx < 0 || inIdx >= ${inSize}) {\n return 0.0;\n }\n `;\n }\n\n this.userCode = `\n const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n float getValue(int batch, int inIdx) {\n ${checkOutOfBounds}\n return getX(batch, inIdx);\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int outIdx = coords[1];\n int inOffset = outIdx * ${windowSize};\n\n float sumValue = 0.0;\n\n for (int i = 0; i < ${windowSizeNearestVec4}; i += 4) {\n int inIdx = inOffset + i;\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n getValue(batch, inIdx + 3)\n );\n\n ${updateSnippet}\n }\n\n int inIdx = inOffset + ${windowSizeNearestVec4};\n if (${windowSizeVec4Remainder === 1}) {\n vec4 values = vec4(getValue(batch, inIdx), 0.0, 0.0, 0.0);\n\n ${updateSnippet}\n } else if (${windowSizeVec4Remainder === 2}) {\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1), 0.0, 0.0);\n\n ${updateSnippet}\n } else if (${windowSizeVec4Remainder === 3}) {\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2), 0.0);\n\n ${updateSnippet}\n }\n setOutput(sumValue);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class ReduceProgram implements GPGPUProgram {\n variableNames = ['x'];\n outputShape: number[];\n userCode: string;\n\n constructor(\n reduceInfo: backend_util.ReduceInfo,\n reduceType: 'all'|'any'|'max'|'min'|'sum'|'prod') {\n const {windowSize, batchSize, inSize, outSize} = reduceInfo;\n this.outputShape = [batchSize, outSize];\n\n let initializationValue = '0.0';\n let compareOp = ``;\n\n if (reduceType === 'prod') {\n initializationValue = '1.0';\n } else if (reduceType === 'min') {\n // WebGL on Firefox Linux can't compile 1/0 so we do 1/eps.\n initializationValue = '1.0 / 1e-20';\n compareOp = `min`;\n } else if (reduceType === 'max') {\n // WebGL on Firefox Linux can't compile 1/0 so we do 1/eps.\n initializationValue = '-1.0 / 1e-20';\n compareOp = `max`;\n }\n\n let returnValue = `${reduceType}(${reduceType}(${reduceType}(` +\n 'minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])';\n\n if (reduceType === 'sum') {\n returnValue = `sumValue`;\n } else if (reduceType === 'prod') {\n returnValue = `prodValue`;\n } else if (reduceType === 'all') {\n returnValue = `allValue`;\n } else if (reduceType === 'any') {\n returnValue = `anyValue`;\n }\n\n const windowSizeNearestVec4 = Math.floor(windowSize / 4) * 4;\n const windowSizeVec4Remainder = windowSize % 4;\n\n let updateSnippet = `\n if (${reduceType === 'sum'}) {\n sumValue += dot(values, ones);\n } else if (${reduceType === 'prod'}) {\n vec2 tmp = vec2(values[0], values[1]) * vec2(values[2], values[3]);\n prodValue *= tmp[0] * tmp[1];\n } else {\n minMaxValue = ${compareOp}(values, minMaxValue);\n if (${reduceType === 'min'} || ${reduceType === 'max'}) {\n minMaxValue = ${compareOp}(values, minMaxValue);\n bvec4 isNaN = isnan(values);\n if (isNaN.r || isNaN.g || isNaN.b || isNaN.a) {\n minMaxValue = vec4(NAN);\n }\n }\n }\n `;\n\n let vecType = `vec4`;\n\n if (reduceType === 'all') {\n initializationValue = '1.0';\n updateSnippet = `\n bool reducedAllValue = all(values);\n float floatedReducedAllValue = float(reducedAllValue);\n allValue = float(allValue >= 1.0 && floatedReducedAllValue >= 1.0);\n `;\n vecType = `bvec4`;\n } else if (reduceType === 'any') {\n initializationValue = '0.0';\n updateSnippet = `\n bool reducedAnyValue = any(values);\n float floatedReducedAnyValue = float(reducedAnyValue);\n anyValue = float(anyValue >= 1.0 || floatedReducedAnyValue >= 1.0);\n `;\n vecType = `bvec4`;\n }\n\n let checkOutOfBounds = '';\n if (inSize % windowSize > 0) {\n checkOutOfBounds = `\n if (inIdx < 0 || inIdx >= ${inSize}) {\n return initializationValue;\n }\n `;\n }\n this.userCode = `\n const float initializationValue = ${initializationValue};\n const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n float getValue(int batch, int inIdx) {\n ${checkOutOfBounds}\n return getX(batch, inIdx);\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int outIdx = coords[1];\n int inOffset = outIdx * ${windowSize};\n\n vec4 minMaxValue = vec4(${initializationValue});\n float prodValue = 1.0;\n float sumValue = 0.0;\n float allValue = 1.0;\n float anyValue = 0.0;\n\n for (int i = 0; i < ${windowSizeNearestVec4}; i += 4) {\n int inIdx = inOffset + i;\n ${vecType} values = ${vecType}(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n getValue(batch, inIdx + 3)\n );\n\n ${updateSnippet}\n }\n\n int inIdx = inOffset + ${windowSizeNearestVec4};\n if (${windowSizeVec4Remainder === 1}) {\n ${vecType} values = ${vecType}(\n getValue(batch, inIdx),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n ${updateSnippet}\n } else if (${windowSizeVec4Remainder === 2}) {\n ${vecType} values = ${vecType}(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n initializationValue,\n initializationValue\n );\n\n ${updateSnippet}\n } else if (${windowSizeVec4Remainder === 3}) {\n ${vecType} values = ${vecType}(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n initializationValue\n );\n\n ${updateSnippet}\n }\n setOutput(${returnValue});\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, DataType, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {MeanProgram} from '../mean_gpu';\nimport {ReduceProgram} from '../reduce_gpu';\n\ntype ReduceTypes = 'all'|'any'|'max'|'min'|'sum'|'prod'|'mean';\n\n// Returns an array of configuration objects that describe each stage of the\n// reduction.\nfunction getReductionStages(inShape: number[]):\n Array<{inSize: number, windowSize: number, outSize: number}> {\n const stages = [];\n\n while (stages.length === 0 || stages[stages.length - 1].outSize !== 1) {\n const outSize: number =\n stages.length ? stages[stages.length - 1].outSize : inShape[1];\n const windowSize = backend_util.computeOptimalWindowSize(outSize);\n stages.push({\n inSize: outSize,\n windowSize,\n outSize: Math.ceil(outSize / windowSize)\n });\n }\n\n return stages;\n}\n\nexport function reduce(\n x: TensorInfo, dtype: DataType, reductionType: ReduceTypes,\n backend: MathBackendWebGL): TensorInfo {\n const reductionStages = getReductionStages(x.shape);\n\n let result = x;\n for (let i = 0; i < reductionStages.length; i++) {\n const {inSize, windowSize, outSize} = reductionStages[i];\n\n let program: ReduceProgram|MeanProgram;\n let previousResult: TensorInfo;\n if (reductionType === 'mean') {\n program = i === 0 ?\n new MeanProgram(\n {windowSize, inSize, batchSize: x.shape[0], outSize}, inSize) :\n new MeanProgram({windowSize, inSize, batchSize: x.shape[0], outSize});\n } else {\n program = new ReduceProgram(\n {windowSize, inSize, batchSize: x.shape[0], outSize}, reductionType);\n }\n\n previousResult = result;\n result = backend.runWebGLProgram(program, [result], dtype);\n\n if (previousResult.dataId !== x.dataId) {\n backend.disposeIntermediateTensorInfo(previousResult);\n }\n }\n\n return result;\n}\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {getCoordsDataType} from './shader_compiler';\n\nexport class TransposeProgram implements GPGPUProgram {\n variableNames = ['A'];\n outputShape: number[];\n userCode: string;\n rank: number;\n\n constructor(aShape: number[], newDim: number[]) {\n const outputShape: number[] = new Array(aShape.length);\n for (let i = 0; i < outputShape.length; i++) {\n outputShape[i] = aShape[newDim[i]];\n }\n this.outputShape = outputShape;\n this.rank = outputShape.length;\n const dtype = getCoordsDataType(this.rank);\n const switched = getSwitchedCoords(newDim);\n\n this.userCode = `\n void main() {\n ${dtype} resRC = getOutputCoords();\n setOutput(getA(${switched}));\n }\n `;\n }\n}\n\nfunction getSwitchedCoords(newDim: number[]): string {\n const rank = newDim.length;\n if (rank > 6) {\n throw Error(`Transpose for rank ${rank} is not yet supported`);\n }\n const originalOrder =\n ['resRC.x', 'resRC.y', 'resRC.z', 'resRC.w', 'resRC.u', 'resRC.v'];\n const switchedCoords = new Array(rank);\n for (let i = 0; i < newDim.length; i++) {\n switchedCoords[newDim[i]] = originalOrder[i];\n }\n return switchedCoords.join();\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {getVecChannels} from './packing_util';\nimport {getCoordsDataType} from './shader_compiler';\n\nexport class TransposePackedProgram implements GPGPUProgram {\n variableNames = ['A'];\n outputShape: number[];\n userCode: string;\n rank: number;\n packedInputs = true;\n packedOutput = true;\n\n constructor(aShape: number[], newDim: number[]) {\n const outputShape: number[] = new Array(aShape.length);\n for (let i = 0; i < outputShape.length; i++) {\n outputShape[i] = aShape[newDim[i]];\n }\n this.outputShape = outputShape;\n this.rank = outputShape.length;\n if (this.rank > 6) {\n throw Error(\n `Packed transpose for rank ${this.rank} is not yet supported.`);\n }\n const dtype = getCoordsDataType(this.rank);\n\n const outputOrder = getVecChannels('rc', this.rank);\n const switchedOrder = new Array(this.rank);\n for (let i = 0; i < newDim.length; i++) {\n switchedOrder[newDim[i]] = outputOrder[i];\n }\n const innerDims = `vec2(${switchedOrder.slice(-2).join()})`;\n const nextColumn =\n `++${outputOrder[this.rank - 1]} < ${outputShape[this.rank - 1]}`;\n const getc = `getChannel(getA(${switchedOrder.join()}), ${innerDims})`;\n\n this.userCode = `\n void main() {\n ${dtype} rc = getOutputCoords();\n vec4 result = vec4(0.);\n result[0] = ${getc};\n if(${nextColumn}) {\n result[1] = ${getc};\n }\n --${outputOrder[this.rank - 1]};\n if(++${outputOrder[this.rank - 2]} < ${outputShape[this.rank - 2]}) {\n result[2] = ${getc};\n if(${nextColumn}) {\n result[3] = ${getc};\n }\n }\n setOutput(result);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {transposeImplCPU} from '../kernel_utils/shared';\nimport {TransposeProgram} from '../transpose_gpu';\nimport {TransposePackedProgram} from '../transpose_packed_gpu';\n\nexport function transposeImpl(\n x: TensorInfo, perm: number[], backend: MathBackendWebGL): TensorInfo {\n const program = env().getBool('WEBGL_PACK_ARRAY_OPERATIONS') ?\n new TransposePackedProgram(x.shape, perm) :\n new TransposeProgram(x.shape, perm);\n return backend.runWebGLProgram(program, [x], x.dtype);\n}\n\nexport {transposeImplCPU};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, sumOutType, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {reduce} from '../kernel_utils/reduce';\nimport {reshape} from './Reshape';\n\nimport {transposeImpl} from './Transpose_impl';\n\nexport function sumImpl(\n x: TensorInfo, axis: number|number[], keepDims: boolean,\n backend: MathBackendWebGL): TensorInfo {\n const reductionIndices = axis;\n\n const xRank = x.shape.length;\n\n const origAxes = util.parseAxisParam(reductionIndices, x.shape);\n let axes = origAxes;\n const permutedAxes = backend_util.getAxesPermutation(axes, xRank);\n const sumInputIsTransposed = permutedAxes != null;\n\n let sumInput = x;\n if (sumInputIsTransposed) {\n sumInput = transposeImpl(x, permutedAxes, backend);\n\n axes = backend_util.getInnerMostAxes(axes.length, xRank);\n }\n\n backend_util.assertAxesAreInnerMostDims('sum', axes, xRank);\n const [sumOutShape, reduceShape] =\n backend_util.computeOutAndReduceShapes(sumInput.shape, axes);\n\n let outShape = sumOutShape;\n if (keepDims) {\n // rather than reshape at the end, set the target shape here.\n outShape = backend_util.expandShapeToKeepDim(sumOutShape, origAxes);\n }\n\n const inSize = util.sizeFromShape(reduceShape);\n const xSize = util.sizeFromShape(x.shape);\n const batchSize = xSize / inSize;\n const reshapedInput = reshape(\n {inputs: {x: sumInput}, attrs: {shape: [batchSize, inSize]}, backend});\n\n const outType = sumOutType(x.dtype);\n\n const reduced = reduce(reshapedInput, outType, 'sum', backend);\n const out =\n reshape({inputs: {x: reduced}, attrs: {shape: outShape}, backend});\n\n backend.disposeIntermediateTensorInfo(reshapedInput);\n backend.disposeIntermediateTensorInfo(reduced);\n if (sumInputIsTransposed) {\n backend.disposeIntermediateTensorInfo(sumInput);\n }\n\n return out;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Sum, SumAttrs, SumInputs} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\n\nimport {sumImpl} from './Sum_impl';\n\nexport function sum(\n args: {inputs: SumInputs, attrs: SumAttrs, backend: MathBackendWebGL}) {\n const {inputs, backend, attrs} = args;\n\n const {x} = inputs;\n const {axis, keepDims} = attrs;\n\n return sumImpl(x, axis, keepDims, backend);\n}\n\nexport const sumConfig: KernelConfig = {\n kernelName: Sum,\n backendName: 'webgl',\n kernelFunc: sum as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, TensorInfo, Transpose, TransposeAttrs, TransposeInputs, TypedArray} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\n\nimport {transposeImpl} from './Transpose_impl';\nimport {transposeImplCPU as cpuTranspose} from './Transpose_impl';\n\nexport function transpose(args: {\n inputs: TransposeInputs,\n attrs: TransposeAttrs,\n backend: MathBackendWebGL\n}) {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {perm} = attrs;\n const webglBackend = backend;\n\n const xRank = x.shape.length;\n\n const newShape: number[] = new Array(xRank);\n for (let i = 0; i < newShape.length; i++) {\n newShape[i] = x.shape[perm[i]];\n }\n\n let out: TensorInfo;\n if (webglBackend.shouldExecuteOnCPU([x])) {\n const xTexData = webglBackend.texData.get(x.dataId);\n const values = xTexData.values as TypedArray;\n const outValues = cpuTranspose(values, x.shape, x.dtype, perm, newShape);\n\n out = webglBackend.makeTensorInfo(newShape, x.dtype);\n const outData = webglBackend.texData.get(out.dataId);\n outData.values = outValues;\n } else {\n out = transposeImpl(x, perm, webglBackend);\n }\n return out;\n}\n\nexport const transposeConfig: KernelConfig = {\n kernelName: Transpose,\n backendName: 'webgl',\n kernelFunc: transpose as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, broadcast_util, TensorInfo, upcastType, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {mapActivationToShaderProgram} from '../kernel_utils/kernel_funcs_utils';\nimport {MatMulPackedProgram} from '../mulmat_packed_gpu';\n\nimport {multiply} from './Multiply';\nimport {reshape} from './Reshape';\nimport {sum} from './Sum';\nimport {transpose} from './Transpose';\n\n// Empirically determined minimal shared dimension in matmul before we forward\n// to a.mul(b).sum() in order to take advantage of GPU parallelism. See\n// https://github.com/tensorflow/tfjs-core/pull/1379 for benchmarks.\nexport const MATMUL_SHARED_DIM_THRESHOLD = 1000;\n\ntype BatchMatMulConfig = {\n a: TensorInfo,\n b: TensorInfo,\n transposeA: boolean,\n transposeB: boolean,\n backend: MathBackendWebGL,\n bias?: TensorInfo,\n preluActivationWeights?: TensorInfo,\n leakyreluAlpha?: number,\n activation?: backend_util.Activation\n};\n\nexport function batchMatMulImpl({\n a,\n b,\n transposeA,\n transposeB,\n backend,\n bias = null,\n preluActivationWeights = null,\n leakyreluAlpha = 0,\n activation = null\n}: BatchMatMulConfig): TensorInfo {\n const aRank = a.shape.length;\n const bRank = b.shape.length;\n\n const innerShapeA = transposeA ? a.shape[aRank - 2] : a.shape[aRank - 1];\n const innerShapeB = transposeB ? b.shape[bRank - 1] : b.shape[bRank - 2];\n\n const outerShapeA = transposeA ? a.shape[aRank - 1] : a.shape[aRank - 2];\n const outerShapeB = transposeB ? b.shape[bRank - 2] : b.shape[bRank - 1];\n\n const outerDimsA = a.shape.slice(0, -2);\n const outerDimsB = b.shape.slice(0, -2);\n\n const batchDimA = util.sizeFromShape(outerDimsA);\n const batchDimB = util.sizeFromShape(outerDimsB);\n\n const outShapeOuterDims = broadcast_util.assertAndGetBroadcastShape(\n a.shape.slice(0, -2), b.shape.slice(0, -2));\n const outShape = outShapeOuterDims.concat([outerShapeA, outerShapeB]);\n\n util.assert(\n innerShapeA === innerShapeB,\n () => `Error in matMul: inner shapes (${innerShapeA}) and (` +\n `${innerShapeB}) of Tensors with shapes ${a.shape} and ` +\n `${b.shape} and transposeA=${transposeA}` +\n ` and transposeB=${transposeB} must match.`);\n\n const a3dShape: [number, number, number] = transposeA ?\n [batchDimA, innerShapeA, outerShapeA] :\n [batchDimA, outerShapeA, innerShapeA];\n const b3dShape: [number, number, number] = transposeB ?\n [batchDimB, outerShapeB, innerShapeB] :\n [batchDimB, innerShapeB, outerShapeB];\n\n // The rest of the implementation is designed to operate on rank-3 tensors\n const a3d = reshape({inputs: {x: a}, backend, attrs: {shape: a3dShape}});\n const b3d = reshape({inputs: {x: b}, backend, attrs: {shape: b3dShape}});\n\n const intermediates: TensorInfo[] = [a3d, b3d];\n\n const batchDim = Math.max(batchDimA, batchDimB);\n const sharedDim = transposeA ? a3d.shape[1] : a3d.shape[2];\n\n const hasBias = bias != null;\n const hasPreluActivationWeights = preluActivationWeights != null;\n const hasLeakyreluAlpha = activation === 'leakyrelu';\n const fusedActivation = activation != null ?\n mapActivationToShaderProgram(activation, true) :\n null;\n const containsFusedOps = hasBias || hasPreluActivationWeights ||\n hasLeakyreluAlpha || fusedActivation != null;\n let out: TensorInfo;\n\n // Since the matrices are vectors, it is faster to call mul().sum()\n // because sum() is O(sqrt(N)) due to divide-and-conquer.\n if ((outerShapeA === 1 || outerShapeB === 1) &&\n sharedDim > MATMUL_SHARED_DIM_THRESHOLD && containsFusedOps === false) {\n let aVec = a3d;\n let bVec = b3d;\n if (transposeA) {\n aVec = transpose({inputs: {x: a3d}, backend, attrs: {perm: [0, 2, 1]}});\n intermediates.push(aVec);\n }\n if (transposeB) {\n bVec = transpose({inputs: {x: b3d}, backend, attrs: {perm: [0, 2, 1]}});\n intermediates.push(bVec);\n }\n\n const shouldReshapeA = outerShapeB !== 1;\n const shouldReshapeB = outerShapeB === 1;\n\n let aVec3d = aVec;\n if (shouldReshapeA) {\n aVec3d = reshape({\n inputs: {x: aVec},\n backend,\n attrs: {shape: [batchDim, sharedDim, 1]}\n });\n\n intermediates.push(aVec3d);\n }\n\n const axis = outerShapeB === 1 ? 2 : 1;\n\n let bVec3d = bVec;\n if (shouldReshapeB) {\n bVec3d = reshape({\n inputs: {x: bVec},\n backend,\n attrs: {shape: [batchDim, 1, sharedDim]}\n });\n\n intermediates.push(bVec3d);\n }\n\n const product = multiply({inputs: {a: aVec3d, b: bVec3d}, backend});\n out = sum({inputs: {x: product}, backend, attrs: {axis, keepDims: true}});\n intermediates.push(product);\n } else {\n const dtype = upcastType(a.dtype, b.dtype);\n\n const program = new MatMulPackedProgram(\n a3dShape, b3dShape, [batchDim, outerShapeA, outerShapeB], transposeA,\n transposeB, hasBias, fusedActivation, hasPreluActivationWeights,\n hasLeakyreluAlpha);\n\n const inputs: TensorInfo[] = [a3d, b3d];\n if (bias != null) {\n inputs.push(bias);\n }\n if (hasPreluActivationWeights) {\n inputs.push(preluActivationWeights);\n }\n if (hasLeakyreluAlpha) {\n const $leakyreluAlpha = backend.makeTensorInfo(\n [], 'float32',\n util.createScalarValue(leakyreluAlpha as {} as 'float32', 'float32'));\n inputs.push($leakyreluAlpha);\n intermediates.push($leakyreluAlpha);\n }\n\n out = backend.runWebGLProgram(program, inputs, dtype);\n }\n\n const outReshaped =\n reshape({inputs: {x: out}, backend, attrs: {shape: outShape}});\n intermediates.push(out);\n for (const i of intermediates) {\n backend.disposeIntermediateTensorInfo(i);\n }\n return outReshaped;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the License);\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an AS IS BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {_FusedMatMul, _FusedMatMulAttrs, _FusedMatMulInputs, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {batchMatMulImpl} from './BatchMatMul_impl';\n\nexport function _fusedMatMul(args: {\n inputs: _FusedMatMulInputs,\n attrs: _FusedMatMulAttrs,\n backend: MathBackendWebGL\n}) {\n const {inputs, backend, attrs} = args;\n const {a, b, bias, preluActivationWeights} = inputs;\n const {transposeA, transposeB, activation, leakyreluAlpha} = attrs;\n\n return batchMatMulImpl({\n a,\n b,\n transposeA,\n transposeB,\n backend,\n bias,\n preluActivationWeights,\n leakyreluAlpha,\n activation\n });\n}\n\nexport const _fusedMatMulConfig: KernelConfig = {\n kernelName: _FusedMatMul,\n backendName: 'webgl',\n kernelFunc: _fusedMatMul as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Abs, AbsInputs, env, KernelConfig, KernelFunc, TensorInfo, TypedArray} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {simpleAbsImplCPU} from '../kernel_utils/shared';\nimport {UnaryOpProgram} from '../unaryop_gpu';\nimport {UnaryOpPackedProgram} from '../unaryop_packed_gpu';\n\nconst ABS = `return abs(x);`;\n\nexport function abs(args: {inputs: AbsInputs, backend: MathBackendWebGL}):\n TensorInfo {\n const {inputs, backend} = args;\n const {x} = inputs;\n\n // TODO: handle cases when x is complex. Once the cpu implementation\n // can handle complex values, refactor to use unaryKernelFunc.\n if (backend.shouldExecuteOnCPU([x]) && x.dtype !== 'complex64') {\n const xData = backend.texData.get(x.dataId);\n const outValues = simpleAbsImplCPU(xData.values as TypedArray);\n return backend.makeTensorInfo(x.shape, x.dtype, outValues);\n }\n\n let program: UnaryOpProgram|UnaryOpPackedProgram;\n if (env().getBool('WEBGL_PACK_UNARY_OPERATIONS')) {\n program = new UnaryOpPackedProgram(x.shape, ABS);\n } else {\n program = new UnaryOpProgram(x.shape, ABS);\n }\n return backend.runWebGLProgram(program, [x], x.dtype);\n}\n\nexport const absConfig: KernelConfig = {\n kernelName: Abs,\n backendName: 'webgl',\n kernelFunc: abs as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Acos, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {CHECK_NAN_SNIPPET} from '../unaryop_gpu';\n\nconst ACOS = CHECK_NAN_SNIPPET + `\n if (abs(x) > 1.) {\n return NAN;\n }\n return acos(x);\n`;\n\nexport const acos = unaryKernelFunc({opSnippet: ACOS});\n\nexport const acosConfig: KernelConfig = {\n kernelName: Acos,\n backendName: 'webgl',\n kernelFunc: acos,\n};\n","\n/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Acosh, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {CHECK_NAN_SNIPPET} from '../unaryop_gpu';\n\nconst ACOSH = CHECK_NAN_SNIPPET + `\n if (x < 1.0) return NAN;\nreturn log(x + sqrt(x * x - 1.0));`;\n\nexport const acosh = unaryKernelFunc({opSnippet: ACOSH});\n\nexport const acoshConfig: KernelConfig = {\n kernelName: Acosh,\n backendName: 'webgl',\n kernelFunc: acosh,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Add, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {addImplCPU as cpuAdd} from '../kernel_utils/shared';\n\nconst ADD = 'return a + b;';\n\nexport const addKernelFunc = binaryKernelFunc({\n opSnippet: ADD,\n packedOpSnippet: ADD,\n supportsComplex: true,\n cpuKernelImpl: cpuAdd\n});\n\nexport const addConfig: KernelConfig = {\n kernelName: Add,\n backendName: 'webgl',\n kernelFunc: addKernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class AddNProgram implements GPGPUProgram {\n variableNames: string[];\n outputShape: number[] = [];\n userCode: string;\n\n constructor(outputShape: number[], shapes: number[][]) {\n this.outputShape = outputShape;\n this.variableNames = shapes.map((_, i) => `T${i}`);\n\n const snippets: string[] = [];\n // Get target elements from every input tensor.\n this.variableNames.forEach(variable => {\n snippets.push(`float v${variable} = get${variable}AtOutCoords();`);\n });\n\n // Calculate the sum of all elements.\n const operation = this.variableNames\n .map(variable => {\n return `v${variable}`;\n })\n .join(' + ');\n\n this.userCode = `\n void main() {\n ${snippets.join('\\n ')}\n\n float result = ${operation};\n setOutput(result);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class AddNPackedProgram implements GPGPUProgram {\n variableNames: string[];\n outputShape: number[] = [];\n userCode: string;\n packedInputs = true;\n packedOutput = true;\n\n constructor(outputShape: number[], shapes: number[][]) {\n this.outputShape = outputShape;\n this.variableNames = shapes.map((_, i) => `T${i}`);\n\n const snippets: string[] = [];\n // Get target elements from every input tensor.\n this.variableNames.forEach(variable => {\n snippets.push(`vec4 v${variable} = get${variable}AtOutCoords();`);\n });\n\n // Calculate the sum of all elements.\n const operation = this.variableNames\n .map(variable => {\n return `v${variable}`;\n })\n .join(' + ');\n\n this.userCode = `\n void main() {\n ${snippets.join('\\n ')}\n\n vec4 result = ${operation};\n setOutput(result);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {AddN, AddNInputs, env, KernelConfig, KernelFunc, TensorInfo, upcastType} from '@tensorflow/tfjs-core';\n\nimport {AddNProgram} from '../addn_gpu';\nimport {AddNPackedProgram} from '../addn_packed_gpu';\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {identity} from './Identity';\n\nexport function addN(args: {inputs: AddNInputs, backend: MathBackendWebGL}):\n TensorInfo {\n const {inputs, backend} = args;\n\n const tensors = inputs;\n if (tensors.length === 1) {\n return identity({inputs: {x: tensors[0]}, backend});\n }\n\n // Limit the number of uploaded textures for optimization.\n if (tensors.length > env().get('WEBGL_MAX_TEXTURES_IN_SHADER')) {\n const midIndex = Math.floor(tensors.length / 2);\n const leftSide = addN({inputs: tensors.slice(0, midIndex), backend});\n const rightSide = addN({inputs: tensors.slice(midIndex), backend});\n return addN({inputs: [leftSide, rightSide], backend});\n }\n\n const dtype =\n tensors.map(t => t.dtype).reduce((d1, d2) => upcastType(d1, d2));\n const shapes = tensors.map(t => t.shape);\n // We can make sure shapes are identical in op level.\n const usePackedOp = env().getBool('WEBGL_PACK');\n const program = usePackedOp ?\n new AddNPackedProgram(tensors[0].shape, shapes) :\n new AddNProgram(tensors[0].shape, shapes);\n return backend.runWebGLProgram(program, tensors, dtype);\n}\n\nexport const addNConfig: KernelConfig = {\n kernelName: AddN,\n backendName: 'webgl',\n kernelFunc: addN as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {All, AllAttrs, AllInputs, backend_util, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {reduce} from '../kernel_utils/reduce';\n\nimport {reshape} from './Reshape';\nimport {transpose} from './Transpose';\n\nexport function all(\n args: {inputs: AllInputs, backend: MathBackendWebGL, attrs: AllAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {axis, keepDims} = attrs;\n\n const xRank = x.shape.length;\n\n const origAxes = util.parseAxisParam(axis, x.shape);\n let axes = origAxes;\n const permutedAxes = backend_util.getAxesPermutation(axes, xRank);\n let permutedX = x;\n if (permutedAxes != null) {\n permutedX = transpose({inputs: {x}, backend, attrs: {perm: permutedAxes}});\n axes = backend_util.getInnerMostAxes(axes.length, xRank);\n }\n\n backend_util.assertAxesAreInnerMostDims('all', axes, xRank);\n const [outShape, reduceShape] =\n backend_util.computeOutAndReduceShapes(permutedX.shape, axes);\n const inSize = util.sizeFromShape(reduceShape);\n\n const a2D =\n reshape({inputs: {x: permutedX}, backend, attrs: {shape: [-1, inSize]}});\n const reduced = reduce(a2D, a2D.dtype, 'all', backend);\n\n let res;\n if (keepDims) {\n const newShape = backend_util.expandShapeToKeepDim(outShape, origAxes);\n res = reshape({inputs: {x: reduced}, backend, attrs: {shape: newShape}});\n } else {\n res = reshape({inputs: {x: reduced}, backend, attrs: {shape: outShape}});\n }\n\n backend.disposeIntermediateTensorInfo(a2D);\n backend.disposeIntermediateTensorInfo(reduced);\n\n if (permutedAxes != null) {\n backend.disposeIntermediateTensorInfo(permutedX);\n }\n\n return res;\n}\n\nexport const allConfig: KernelConfig = {\n kernelName: All,\n backendName: 'webgl',\n kernelFunc: all as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Any, AnyAttrs, AnyInputs, backend_util, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {reduce} from '../kernel_utils/reduce';\nimport {reshape} from './Reshape';\nimport {transpose} from './Transpose';\n\nexport function any(\n args: {inputs: AnyInputs, backend: MathBackendWebGL, attrs: AnyAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {axis, keepDims} = attrs;\n\n const xRank = x.shape.length;\n\n const origAxes = util.parseAxisParam(axis, x.shape);\n let axes = origAxes;\n const permutedAxes = backend_util.getAxesPermutation(axes, xRank);\n let permutedX = x;\n if (permutedAxes != null) {\n permutedX = transpose({inputs: {x}, backend, attrs: {perm: permutedAxes}});\n axes = backend_util.getInnerMostAxes(axes.length, xRank);\n }\n\n backend_util.assertAxesAreInnerMostDims('any', axes, xRank);\n const [outShape, reduceShape] =\n backend_util.computeOutAndReduceShapes(permutedX.shape, axes);\n const inSize = util.sizeFromShape(reduceShape);\n\n const a2D =\n reshape({inputs: {x: permutedX}, backend, attrs: {shape: [-1, inSize]}});\n const reduced = reduce(a2D, a2D.dtype, 'any', backend);\n\n let res;\n if (keepDims) {\n const newShape = backend_util.expandShapeToKeepDim(outShape, origAxes);\n res = reshape({inputs: {x: reduced}, backend, attrs: {shape: newShape}});\n } else {\n res = reshape({inputs: {x: reduced}, backend, attrs: {shape: outShape}});\n }\n\n backend.disposeIntermediateTensorInfo(a2D);\n backend.disposeIntermediateTensorInfo(reduced);\n\n if (permutedAxes != null) {\n backend.disposeIntermediateTensorInfo(permutedX);\n }\n\n return res;\n}\n\nexport const anyConfig: KernelConfig = {\n kernelName: Any,\n backendName: 'webgl',\n kernelFunc: any as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class ArgMinMaxProgram implements GPGPUProgram {\n variableNames = ['A'];\n outputShape: number[];\n userCode: string;\n\n constructor(\n reduceInfo: backend_util.ReduceInfo, op: 'max'|'min',\n firstPass: boolean) {\n const {windowSize, batchSize, outSize} = reduceInfo;\n if (!firstPass) {\n this.variableNames.push('bestIndicesA');\n }\n this.outputShape = [batchSize, outSize];\n const compOp = (op === 'max') ? '>' : '<';\n const indexSnippet = firstPass ?\n 'inOffset + i;' :\n 'round(getBestIndicesA(batch, inOffset + i));';\n\n this.userCode = `\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int outIdx = coords[1];\n int inOffset = outIdx * ${windowSize};\n\n int bestIndex = inOffset;\n float bestValue = getA(batch, bestIndex);\n\n for (int i = 0; i < ${windowSize}; i++) {\n int inIdx = ${indexSnippet};\n float candidate = getA(batch, inIdx);\n if (candidate ${compOp} bestValue) {\n bestValue = candidate;\n bestIndex = inIdx;\n }\n }\n setOutput(float(bestIndex));\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {util} from '@tensorflow/tfjs-core';\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {getChannels} from './packing_util';\nimport {getCoordsDataType} from './shader_compiler';\n\nexport class ArgMinMaxPackedProgram implements GPGPUProgram {\n variableNames = ['A'];\n outputShape: number[];\n userCode: string;\n packedInputs = true;\n packedOutput = true;\n\n constructor(\n shape: number[], windowSize: number, op: 'max'|'min',\n firstPass: boolean) {\n util.assert(\n shape.length > 2,\n () => `Packed arg${\n op.charAt(0).toUpperCase() +\n op.slice(1)} supports only inputs with rank above 2.`);\n const inSize = shape[shape.length - 1];\n const outSize = Math.ceil(inSize / windowSize);\n this.outputShape = shape.slice(0, -1);\n if (outSize > 1) {\n this.outputShape.push(outSize);\n }\n if (!firstPass) {\n this.variableNames.push('bestIndicesA');\n }\n const outShape = this.outputShape;\n const rank = outShape.length;\n const dtype = getCoordsDataType(rank);\n const coords = getChannels('coords', rank);\n\n let sourceLocSetup;\n let sourceRank;\n if (outSize === 1) {\n sourceRank = rank + 1;\n const sourceLocDType = getCoordsDataType(sourceRank);\n sourceLocSetup = `\n ${sourceLocDType} sourceLocR = ${sourceLocDType}(${coords.join()}, 0);\n ++${coords[rank - 1]};\n ${sourceLocDType} sourceLocG = ${sourceLocDType}(${coords.join()}, 0);\n ++${coords[rank - 2]};\n ${sourceLocDType} sourceLocA = ${sourceLocDType}(${coords.join()}, 0);\n --${coords[rank - 1]};\n ${sourceLocDType} sourceLocB = ${sourceLocDType}(${coords.join()}, 0);\n --${coords[rank - 2]};`;\n } else {\n sourceRank = rank;\n sourceLocSetup = `\n ${dtype} sourceLocR = coords;\n ++${coords[rank - 1]};\n ${dtype} sourceLocG = coords;\n ++${coords[rank - 2]};\n ${dtype} sourceLocA = coords;\n --${coords[rank - 1]};\n ${dtype} sourceLocB = coords;\n --${coords[rank - 2]};`;\n }\n const channels = ['x', 'y', 'z', 'w', 'u', 'v'].slice(0, sourceRank);\n const inChannel = '.' + channels[sourceRank - 1]; // e.g. \".b\" for rank 3.\n const intChannels = channels.map(x => 'int ' + x);\n const srcRCoords =\n getChannels('sourceLocR', sourceRank - 1).concat('inIdx.r');\n const srcGCoords =\n getChannels('sourceLocG', sourceRank - 1).concat('inIdx.g');\n const srcBCoords =\n getChannels('sourceLocB', sourceRank - 1).concat('inIdx.b');\n const srcACoords =\n getChannels('sourceLocA', sourceRank - 1).concat('inIdx.a');\n\n const compOp = (op === 'max') ? 'greaterThan' : 'lessThan';\n const fetchCandidateIdx = firstPass ? '' : `\n inIdx = round(vec4(getBestIndicesAChannel(${srcRCoords.join()}),\n getBestIndicesAChannel(${srcGCoords.join()}),\n getBestIndicesAChannel(${srcBCoords.join()}),\n getBestIndicesAChannel(${srcACoords.join()})));`;\n\n const fetchValue = `vec4(\n getAChannel(${srcRCoords.join()}),\n hasNextCol ? getAChannel(${srcGCoords.join()}) : 0.,\n hasNextRow ? getAChannel(${srcBCoords.join()}) : 0.,\n hasNextRow && hasNextCol ? getAChannel(${srcACoords.join()}) : 0.)`;\n\n const getBestIndicesAChannelSnippet = firstPass ? '' : `\n float getBestIndicesAChannel(${intChannels.join()}) {\n return getChannel(getBestIndicesA(${channels.join()}),\n vec2(${channels.slice(-2).join()}));\n }`;\n\n this.userCode = `\n float getAChannel(${intChannels.join()}) {\n return getChannel(getA(${channels.join()}),\n vec2(${channels.slice(-2).join()}));\n }\n ${getBestIndicesAChannelSnippet}\n void main() {\n ${dtype} coords = getOutputCoords();\n bool hasNextCol = ${coords[rank - 1]} < ${outShape[rank - 1] - 1};\n bool hasNextRow = ${coords[rank - 2]} < ${outShape[rank - 2] - 1};\n ${sourceLocSetup}\n ivec4 srcIdx = ivec4(sourceLocR${inChannel}, sourceLocG${inChannel},\n sourceLocB${inChannel}, sourceLocA${inChannel}) * ${windowSize};\n ivec4 inIdx = srcIdx;\n vec4 bestIndex = vec4(inIdx);\n vec4 bestValue = ${fetchValue};\n\n for (int i = 0; i < ${windowSize}; i++) {\n inIdx = srcIdx;\n ${fetchCandidateIdx}\n vec4 candidate = ${fetchValue};\n bvec4 nan = isnan(candidate);\n bvec4 replace = bvec4(\n vec4(${compOp}(candidate, bestValue)) * (vec4(1.0) - vec4(nan)));\n\n bestValue = vec4(replace.x ? candidate.x : bestValue.x,\n replace.y ? candidate.y : bestValue.y,\n replace.z ? candidate.z : bestValue.z,\n replace.w ? candidate.w : bestValue.w);\n bestIndex = mix(bestIndex, vec4(inIdx), vec4(replace));\n srcIdx++;\n }\n setOutput(bestIndex);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, env, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {ArgMinMaxProgram} from '../argminmax_gpu';\nimport {ArgMinMaxPackedProgram} from '../argminmax_packed_gpu';\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {reshape} from '../kernels/Reshape';\n\nfunction argReduce(\n backend: MathBackendWebGL, x: TensorInfo, reduceType: 'max'|'min',\n bestIndicesA: TensorInfo = null): TensorInfo {\n let batchSize = x.shape[0];\n let inSize = x.shape[1];\n if (bestIndicesA != null) {\n batchSize = bestIndicesA.shape[0];\n inSize = bestIndicesA.shape[1];\n }\n const windowSize = backend_util.computeOptimalWindowSize(inSize);\n const reduceInfo =\n {windowSize, inSize, batchSize, outSize: Math.ceil(inSize / windowSize)};\n const program =\n new ArgMinMaxProgram(reduceInfo, reduceType, bestIndicesA == null);\n const inputs = [x];\n if (bestIndicesA != null) {\n inputs.push(bestIndicesA);\n }\n const output = backend.runWebGLProgram(program, inputs, 'int32');\n // No need to run another GPGPU program.\n if (output.shape[1] === 1) {\n return output;\n }\n const result = argReduce(backend, x, reduceType, output);\n backend.disposeIntermediateTensorInfo(output);\n return result;\n}\n\nfunction argReducePacked(\n backend: MathBackendWebGL, x: TensorInfo, reduceType: 'max'|'min',\n bestIndicesA: TensorInfo = null): TensorInfo {\n const inShape = bestIndicesA != null ? bestIndicesA.shape : x.shape;\n const inSize = inShape[inShape.length - 1];\n const windowSize = backend_util.computeOptimalWindowSize(inSize);\n const program = new ArgMinMaxPackedProgram(\n inShape, windowSize, reduceType, bestIndicesA == null);\n const inputs = bestIndicesA == null ? [x] : [x, bestIndicesA];\n const output = backend.runWebGLProgram(program, inputs, 'int32');\n if (output.shape.length === x.shape.length) {\n const result = argReducePacked(backend, x, reduceType, output);\n backend.disposeIntermediateTensorInfo(output);\n return result;\n }\n return output;\n}\n\nexport function argMinMaxReduce(\n backend: MathBackendWebGL, x: TensorInfo, axis: number,\n reduceType: 'min'|'max'): TensorInfo {\n const axes = [axis];\n backend_util.assertAxesAreInnerMostDims(\n 'arg' + reduceType.charAt(0).toUpperCase() + reduceType.slice(1), axes,\n x.shape.length);\n if (!env().getBool('WEBGL_PACK_REDUCE') || x.shape.length <= 2) {\n const intermediateTensorInfos = [];\n // Eagerly unpack x input since it is passed in to all the shaders which\n // require unpacked inputs.\n const xtexData = backend.texData.get(x.dataId);\n const xIsPacked = xtexData !== null && xtexData.isPacked;\n let xUnPacked = x;\n if (xIsPacked) {\n xUnPacked = backend.unpackTensor(x);\n intermediateTensorInfos.push(xUnPacked);\n }\n\n const [outShape, reduceShape] =\n backend_util.computeOutAndReduceShapes(xUnPacked.shape, axes);\n const inSize = util.sizeFromShape(reduceShape);\n const a2D = reshape(\n {inputs: {x: xUnPacked}, backend, attrs: {shape: [-1, inSize]}});\n intermediateTensorInfos.push(a2D);\n\n const reduced = argReduce(backend, a2D, reduceType);\n intermediateTensorInfos.push(reduced);\n const reshaped =\n reshape({inputs: {x: reduced}, backend, attrs: {shape: outShape}});\n\n intermediateTensorInfos.forEach(\n t => backend.disposeIntermediateTensorInfo(t));\n return reshaped;\n }\n return argReducePacked(backend, x, reduceType);\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ArgMax, ArgMaxAttrs, ArgMaxInputs, backend_util, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {argMinMaxReduce} from '../kernel_utils/arg_min_max';\n\nimport {transpose} from './Transpose';\n\nexport function argMax(\n args:\n {inputs: ArgMaxInputs, backend: MathBackendWebGL, attrs: ArgMaxAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {axis} = attrs;\n\n let axes = util.parseAxisParam(axis, x.shape);\n const permutedAxes = backend_util.getAxesPermutation(axes, x.shape.length);\n let $x = x;\n const intermediateTensorInfos = [];\n if (permutedAxes != null) {\n $x = transpose({inputs: {x}, backend, attrs: {perm: permutedAxes}});\n intermediateTensorInfos.push($x);\n axes = backend_util.getInnerMostAxes(axes.length, $x.shape.length);\n }\n\n backend_util.assertAxesAreInnerMostDims('argMax', [axes[0]], $x.shape.length);\n const out = argMinMaxReduce(backend, $x, axes[0], 'max');\n\n intermediateTensorInfos.forEach(\n t => backend.disposeIntermediateTensorInfo(t));\n return out;\n}\n\nexport const argMaxConfig: KernelConfig = {\n kernelName: ArgMax,\n backendName: 'webgl',\n kernelFunc: argMax as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ArgMin, ArgMinAttrs, ArgMinInputs, backend_util, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {argMinMaxReduce} from '../kernel_utils/arg_min_max';\nimport {transpose} from './Transpose';\n\nexport function argMin(\n args:\n {inputs: ArgMinInputs, backend: MathBackendWebGL, attrs: ArgMinAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {axis} = attrs;\n\n let axes = util.parseAxisParam(axis, x.shape);\n const permutedAxes = backend_util.getAxesPermutation(axes, x.shape.length);\n let $x = x;\n const intermediateTensorInfos = [];\n if (permutedAxes != null) {\n $x = transpose({inputs: {x}, backend, attrs: {perm: permutedAxes}});\n intermediateTensorInfos.push($x);\n axes = backend_util.getInnerMostAxes(axes.length, $x.shape.length);\n }\n\n backend_util.assertAxesAreInnerMostDims('argMin', [axes[0]], $x.shape.length);\n\n const out = argMinMaxReduce(backend, $x, axes[0], 'min');\n\n intermediateTensorInfos.forEach(\n t => backend.disposeIntermediateTensorInfo(t));\n return out;\n}\n\nexport const argMinConfig: KernelConfig = {\n kernelName: ArgMin,\n backendName: 'webgl',\n kernelFunc: argMin as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Asin, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {CHECK_NAN_SNIPPET} from '../unaryop_gpu';\n\nconst ASIN = CHECK_NAN_SNIPPET + `\n if (abs(x) > 1.) {\n return NAN;\n }\n return asin(x);\n`;\n\nexport const asin = unaryKernelFunc({opSnippet: ASIN});\n\nexport const asinConfig: KernelConfig = {\n kernelName: Asin,\n backendName: 'webgl',\n kernelFunc: asin,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Asinh, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {CHECK_NAN_SNIPPET} from '../unaryop_gpu';\n\nconst ASINH = CHECK_NAN_SNIPPET + `return log(x + sqrt(x * x + 1.0));`;\n\nexport const asinh = unaryKernelFunc({opSnippet: ASINH});\n\nexport const asinhConfig: KernelConfig = {\n kernelName: Asinh,\n backendName: 'webgl',\n kernelFunc: asinh,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Atan, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {CHECK_NAN_SNIPPET} from '../unaryop_gpu';\n\nconst ATAN = CHECK_NAN_SNIPPET + `\n return atan(x);\n`;\n\nexport const atan = unaryKernelFunc({opSnippet: ATAN});\n\nexport const atanConfig: KernelConfig = {\n kernelName: Atan,\n backendName: 'webgl',\n kernelFunc: atan,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Atan2} from '@tensorflow/tfjs-core';\nimport {KernelConfig} from '@tensorflow/tfjs-core';\nimport {CHECK_NAN_SNIPPET} from '../binaryop_gpu';\nimport {CHECK_NAN_SNIPPET_PACKED} from '../binaryop_packed_gpu';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst ATAN2 = CHECK_NAN_SNIPPET + `\n return atan(a, b);\n`;\n\nconst ATAN2_PACKED = `\n vec4 result = atan(a, b);\n bvec4 isNaNA = isnan(a);\n bvec4 isNaNB = isnan(b);\n bvec4 isNaN = bvec4(isNaNA.x || isNaNB.x, isNaNA.y || isNaNB.y, isNaNA.z || isNaNB.z, isNaNA.w || isNaNB.w);\n ` +\n CHECK_NAN_SNIPPET_PACKED + `\n return result;\n`;\n\nexport const atan2 =\n binaryKernelFunc({opSnippet: ATAN2, packedOpSnippet: ATAN2_PACKED});\n\nexport const atan2Config: KernelConfig = {\n kernelName: Atan2,\n backendName: 'webgl',\n kernelFunc: atan2,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Atanh, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {CHECK_NAN_SNIPPET} from '../unaryop_gpu';\n\nconst ATANH = CHECK_NAN_SNIPPET + `\n if ((x < -1.0) || (x > 1.0)) return NAN;\nreturn (log(1.0 + x) - log(1.0 - x)) / 2.0;`;\n\nexport const atanh = unaryKernelFunc({opSnippet: ATANH});\n\nexport const atanhConfig: KernelConfig = {\n kernelName: Atanh,\n backendName: 'webgl',\n kernelFunc: atanh,\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class Pool2DProgram implements GPGPUProgram {\n variableNames = ['x'];\n outputShape: number[];\n userCode: string;\n\n constructor(\n convInfo: backend_util.Conv2DInfo, poolType: 'max'|'avg',\n computePositions: boolean, flattenPositions = false,\n includeBatchInIndex = false) {\n if (poolType === 'avg' && computePositions) {\n throw new Error('Cannot compute positions for average pool.');\n }\n\n const filterWidth = convInfo.filterWidth;\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n const dilationHeight = convInfo.dilationHeight;\n const dilationWidth = convInfo.dilationWidth;\n const effectiveFilterHeight = convInfo.effectiveFilterHeight;\n const effectiveFilterWidth = convInfo.effectiveFilterWidth;\n\n const padTop = convInfo.padInfo.top;\n const padLeft = convInfo.padInfo.left;\n this.outputShape = convInfo.outShape;\n\n const isAvgPool = poolType === 'avg';\n const batchFlattenPositionStr = `((batch * ${convInfo.inHeight} + xR) * ${\n convInfo.inWidth} + xC) * ${convInfo.inChannels} + d`;\n const flattenPositionStr =\n `(xR * ${convInfo.inWidth} + xC) * ${convInfo.inChannels} + d`;\n\n let initializationValue = '0.0';\n if (!isAvgPool) {\n // WebGL on Firefox Linux can't compile 1/0 so we do 1/eps.\n initializationValue = '-1.0 / 1e-20';\n }\n\n if (computePositions) {\n const compareOp = '>=';\n\n this.userCode = `\n const ivec2 strides = ivec2(${strideHeight}, ${strideWidth});\n const ivec2 pads = ivec2(${padTop}, ${padLeft});\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d = coords[3];\n\n ivec2 xRCCorner = coords.yz * strides - pads;\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n // max/min x(?, ?, d) to get y(yR, yC, d).\n // ? = to be determined\n float minMaxValue = 0.0;\n float minMaxValueFound = 0.0;\n int minMaxPosition = 0;\n float avgValue = 0.0;\n\n for (int wR = 0; wR < ${effectiveFilterHeight};\n wR += ${dilationHeight}) {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= ${convInfo.inHeight}) {\n continue;\n }\n\n for (int wC = 0; wC < ${effectiveFilterWidth};\n wC += ${dilationWidth}) {\n int xC = xCCorner + wC;\n\n if (xC < 0 || xC >= ${convInfo.inWidth}) {\n continue;\n }\n\n float value = getX(batch, xR, xC, d);\n\n // If a min / max value has already been found, use it. If not,\n // use the current value.\n float currMinMaxValue = mix(\n value, minMaxValue, minMaxValueFound);\n if (value ${compareOp} currMinMaxValue) {\n minMaxValue = value;\n minMaxValueFound = 1.0;\n minMaxPosition = ${\n flattenPositions ? (includeBatchInIndex ? batchFlattenPositionStr :\n flattenPositionStr) :\n `wR * ${effectiveFilterWidth} + wC`};\n }\n }\n }\n setOutput(float(minMaxPosition));\n }\n `;\n return;\n }\n\n const compareOp = 'max';\n\n let returnValue = `${poolType}(${poolType}(${poolType}(` +\n 'minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])';\n if (poolType === 'avg') {\n returnValue = `avgValue / count`;\n }\n\n const filterWidthNearestVec4 = Math.floor(filterWidth / 4) * 4;\n const filterWidthVec4Remainder = filterWidth % 4;\n\n const updateSnippet = `\n if (${isAvgPool}) {\n avgValue += dot(values, ones);\n } else {\n minMaxValue = ${compareOp}(values, minMaxValue);\n }\n `;\n\n this.userCode = `\n const ivec2 strides = ivec2(${strideHeight}, ${strideWidth});\n const ivec2 pads = ivec2(${padTop}, ${padLeft});\n const float initializationValue = ${initializationValue};\n const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n float count = 0.0;\n\n float getValue(int batch, int xR, int xC, int d) {\n if (xC < 0 || xC >= ${convInfo.inWidth}) {\n return initializationValue;\n }\n count += 1.0;\n return getX(batch, xR, xC, d);\n }\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d = coords[3];\n\n ivec2 xRCCorner = coords.yz * strides - pads;\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n // max/min x(?, ?, d) to get y(yR, yC, d).\n // ? = to be determined\n vec4 minMaxValue = vec4(${initializationValue});\n float avgValue = 0.0;\n count = 0.0;\n\n for (int wR = 0; wR < ${effectiveFilterHeight};\n wR += ${dilationHeight}) {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= ${convInfo.inHeight}) {\n continue;\n }\n\n for (int wC = 0; wC < ${filterWidthNearestVec4}; wC += 4) {\n int xC = xCCorner + wC * ${dilationWidth};\n\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + ${dilationWidth}, d),\n getValue(batch, xR, xC + 2 * ${dilationWidth}, d),\n getValue(batch, xR, xC + 3 * ${dilationWidth}, d)\n );\n\n ${updateSnippet}\n }\n\n int xC = xCCorner + ${filterWidthNearestVec4};\n if (${filterWidthVec4Remainder === 1}) {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n ${updateSnippet}\n } else if (${filterWidthVec4Remainder === 2}) {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + ${dilationWidth}, d),\n initializationValue,\n initializationValue\n );\n\n ${updateSnippet}\n } else if (${filterWidthVec4Remainder === 3}) {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + ${dilationWidth}, d),\n getValue(batch, xR, xC + 2 * ${dilationWidth}, d),\n initializationValue\n );\n\n ${updateSnippet}\n }\n }\n setOutput(${returnValue});\n }\n `;\n }\n}\n\nexport class Pool3DProgram implements GPGPUProgram {\n variableNames = ['x'];\n outputShape: number[];\n userCode: string;\n\n constructor(\n convInfo: backend_util.Conv3DInfo, poolType: 'max'|'avg',\n computePositions: boolean, flattenPositions = false,\n includeBatchInIndex = false) {\n if (poolType === 'avg' && computePositions) {\n throw new Error('Cannot compute positions for average pool.');\n }\n\n const filterWidth = convInfo.filterWidth;\n const strideDepth = convInfo.strideDepth;\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n const dilationDepth = convInfo.dilationDepth;\n const dilationHeight = convInfo.dilationHeight;\n const dilationWidth = convInfo.dilationWidth;\n const effectiveFilterDepth = convInfo.effectiveFilterDepth;\n const effectiveFilterHeight = convInfo.effectiveFilterHeight;\n const effectiveFilterWidth = convInfo.effectiveFilterWidth;\n\n const padFront = convInfo.padInfo.front;\n const padTop = convInfo.padInfo.top;\n const padLeft = convInfo.padInfo.left;\n this.outputShape = convInfo.outShape;\n\n const isAvgPool = poolType === 'avg';\n\n let initializationValue = '0.0';\n if (!isAvgPool) {\n // WebGL on Firefox Linux can't compile 1/0 so we do 1/eps.\n initializationValue = '-1.0 / 1e-20';\n }\n\n if (computePositions) {\n const compareOp = '>=';\n\n this.userCode = `\n const ivec3 strides =\n ivec3(${strideDepth}, ${strideHeight}, ${strideWidth});\n const ivec3 pads = ivec3(${padFront}, ${padTop}, ${padLeft});\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int ch = coords.u;\n\n ivec3 xCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;\n int xDCorner = xCorner.x;\n int xRCorner = xCorner.y;\n int xCCorner = xCorner.z;\n\n // max/min x(?, ?, ?, ch) to get y(yD, yR, yC, ch).\n // ? = to be determined\n float minMaxValue = 0.0;\n float minMaxValueFound = 0.0;\n int minMaxPosition = 0;\n\n for (int wD = 0; wD < ${effectiveFilterDepth};\n wD += ${dilationDepth}) {\n int xD = xDCorner + wD;\n\n if (xD < 0 || xD >= ${convInfo.inDepth}) {\n continue;\n }\n\n for (int wR = 0; wR < ${effectiveFilterHeight};\n wR += ${dilationHeight}) {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= ${convInfo.inHeight}) {\n continue;\n }\n\n for (int wC = 0; wC < ${effectiveFilterWidth};\n wC += ${dilationWidth}) {\n int xC = xCCorner + wC;\n\n if (xC < 0 || xC >= ${convInfo.inWidth}) {\n continue;\n }\n\n float value = getX(batch, xD, xR, xC, ch);\n\n // If a min / max value has already been found, use it. If not,\n // use the current value.\n float currMinMaxValue = mix(\n value, minMaxValue, minMaxValueFound);\n if (value ${compareOp} currMinMaxValue) {\n minMaxValue = value;\n minMaxValueFound = 1.0;\n minMaxPosition = ${\n flattenPositions ?\n (includeBatchInIndex ?\n `(((batch * ${convInfo.inDepth} + xD) * ${\n convInfo.inHeight} + xR) * ${convInfo.inWidth} + xC) * ${\n convInfo.inChannels} + ch` :\n `((xD * ${convInfo.inHeight} + xR) * ${\n convInfo.inWidth} + xC) * ${convInfo.inChannels} + ch`) :\n `wD * ${effectiveFilterHeight} * ${effectiveFilterWidth} +\n wR * ${effectiveFilterWidth} + wC`};\n }\n }\n }\n }\n setOutput(float(minMaxPosition));\n }\n `;\n return;\n }\n\n const compareOp = 'max';\n\n let returnValue = `${poolType}(${poolType}(${poolType}(` +\n 'minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])';\n if (poolType === 'avg') {\n returnValue = `avgValue / count`;\n }\n\n const filterWidthNearestVec4 = Math.floor(filterWidth / 4) * 4;\n const filterWidthVec4Remainder = filterWidth % 4;\n\n const updateSnippet = `\n if (${isAvgPool}) {\n avgValue += dot(values, ones);\n } else {\n minMaxValue = ${compareOp}(values, minMaxValue);\n }\n `;\n\n this.userCode = `\n const ivec3 strides =\n ivec3(${strideDepth}, ${strideHeight}, ${strideWidth});\n const ivec3 pads = ivec3(${padFront}, ${padTop}, ${padLeft});\n const float initializationValue = ${initializationValue};\n const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n float count = 0.0;\n\n float getValue(int batch, int xD, int xR, int xC, int ch) {\n if (xC < 0 || xC >= ${convInfo.inWidth}) {\n return initializationValue;\n }\n count += 1.0;\n return getX(batch, xD, xR, xC, ch);\n }\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int ch = coords.u;\n\n ivec3 xCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;\n int xDCorner = xCorner.x;\n int xRCorner = xCorner.y;\n int xCCorner = xCorner.z;\n\n // max/min x(?, ?, ?, d) to get y(yD, yR, yC, ch).\n // ? = to be determined\n vec4 minMaxValue = vec4(${initializationValue});\n float avgValue = 0.0;\n count = 0.0;\n\n for (int wD = 0; wD < ${effectiveFilterDepth};\n wD += ${dilationDepth}) {\n int xD = xDCorner + wD;\n\n if (xD < 0 || xD >= ${convInfo.inDepth}) {\n continue;\n }\n\n for (int wR = 0; wR < ${effectiveFilterHeight};\n wR += ${dilationHeight}) {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= ${convInfo.inHeight}) {\n continue;\n }\n\n for (int wC = 0; wC < ${filterWidthNearestVec4}; wC += 4) {\n int xC = xCCorner + wC * ${dilationWidth};\n\n vec4 values = vec4(\n getValue(batch, xD, xR, xC, ch),\n getValue(batch, xD, xR, xC + ${dilationWidth}, ch),\n getValue(batch, xD, xR, xC + 2 * ${dilationWidth}, ch),\n getValue(batch, xD, xR, xC + 3 * ${dilationWidth}, ch)\n );\n\n ${updateSnippet}\n }\n\n int xC = xCCorner + ${filterWidthNearestVec4};\n if (${filterWidthVec4Remainder === 1}) {\n vec4 values = vec4(\n getValue(batch, xD, xR, xC, ch),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n ${updateSnippet}\n } else if (${filterWidthVec4Remainder === 2}) {\n vec4 values = vec4(\n getValue(batch, xD, xR, xC, ch),\n getValue(batch, xD, xR, xC + ${dilationWidth}, ch),\n initializationValue,\n initializationValue\n );\n\n ${updateSnippet}\n } else if (${filterWidthVec4Remainder === 3}) {\n vec4 values = vec4(\n getValue(batch, xD, xR, xC, ch),\n getValue(batch, xD, xR, xC + ${dilationWidth}, ch),\n getValue(batch, xD, xR, xC + 2 * ${dilationWidth}, ch),\n initializationValue\n );\n\n ${updateSnippet}\n }\n }\n setOutput(${returnValue});\n }\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {AvgPool, AvgPoolAttrs, AvgPoolInputs, backend_util, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {Pool2DProgram} from '../pool_gpu';\nimport {assertNotComplex} from '../webgl_util';\nimport {identity} from './Identity';\n\nexport function avgPool(args: {\n inputs: AvgPoolInputs,\n backend: MathBackendWebGL,\n attrs: AvgPoolAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n assertNotComplex(x, 'avgPool');\n const {filterSize, strides, pad, dimRoundingMode} = attrs;\n const dilations = 1;\n\n util.assert(\n backend_util.eitherStridesOrDilationsAreOne(strides, dilations),\n () => 'Error in avgPool: Either strides or dilations must be 1. ' +\n `Got strides ${strides} and dilations '${dilations}'`);\n\n const convInfo = backend_util.computePool2DInfo(\n x.shape as [number, number, number, number], filterSize, strides,\n dilations, pad, dimRoundingMode);\n if (convInfo.filterWidth === 1 && convInfo.filterHeight === 1 &&\n util.arraysEqual(convInfo.inShape, convInfo.outShape)) {\n return identity({inputs: {x}, backend});\n }\n const avgPoolProgram = new Pool2DProgram(convInfo, 'avg', false);\n return backend.runWebGLProgram(avgPoolProgram, [x], 'float32');\n}\n\nexport const avgPoolConfig: KernelConfig = {\n kernelName: AvgPool,\n backendName: 'webgl',\n kernelFunc: avgPool as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {AvgPool3D, AvgPool3DAttrs, AvgPool3DInputs, backend_util, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {Pool3DProgram} from '../pool_gpu';\n\nexport function avgPool3D(args: {\n inputs: AvgPool3DInputs,\n backend: MathBackendWebGL,\n attrs: AvgPool3DAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {filterSize, strides, pad, dimRoundingMode, dataFormat} = attrs;\n const dilations: [number, number, number] = [1, 1, 1];\n\n const convInfo = backend_util.computePool3DInfo(\n x.shape as [number, number, number, number, number], filterSize, strides,\n dilations, pad, dimRoundingMode, dataFormat);\n const avgPoolProgram = new Pool3DProgram(convInfo, 'avg', false);\n return backend.runWebGLProgram(avgPoolProgram, [x], 'float32');\n}\n\nexport const avgPool3DConfig: KernelConfig = {\n kernelName: AvgPool3D,\n backendName: 'webgl',\n kernelFunc: avgPool3D as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class AvgPool2DBackpropProgram implements GPGPUProgram {\n variableNames = ['dy'];\n outputShape: number[];\n userCode: string;\n\n constructor(convInfo: backend_util.Conv2DInfo) {\n this.outputShape = convInfo.inShape;\n const filterHeight = convInfo.filterHeight;\n const filterWidth = convInfo.filterWidth;\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n const dilationHeight = convInfo.dilationHeight;\n const dilationWidth = convInfo.dilationWidth;\n const effectiveFilterHeight = convInfo.effectiveFilterHeight;\n const effectiveFilterWidth = convInfo.effectiveFilterWidth;\n\n const padTop = effectiveFilterHeight - 1 - convInfo.padInfo.top;\n const padLeft = effectiveFilterWidth - 1 - convInfo.padInfo.left;\n\n const avgMultiplier = 1 / (filterHeight * filterWidth);\n\n this.userCode = `\n const ivec2 pads = ivec2(${padTop}, ${padLeft});\n const float avgMultiplier = float(${avgMultiplier});\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n\n ivec2 dyRCCorner = coords.yz - pads;\n int dyRCorner = dyRCCorner.x;\n int dyCCorner = dyRCCorner.y;\n\n // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < ${effectiveFilterHeight};\n wR += ${dilationHeight}) {\n float dyR = float(dyRCorner + wR) / ${strideHeight}.0;\n\n if (dyR < 0.0 || dyR >= ${convInfo.outHeight}.0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < ${effectiveFilterWidth};\n wC+= ${dilationWidth}) {\n float dyC = float(dyCCorner + wC) / ${strideWidth}.0;\n\n if (dyC < 0.0 || dyC >= ${convInfo.outWidth}.0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(b, idyR, idyC, d);\n\n dotProd += dyValue * avgMultiplier;\n }\n }\n setOutput(dotProd);\n }\n `;\n }\n}\n\nexport class AvgPool3DBackpropProgram implements GPGPUProgram {\n variableNames = ['dy'];\n outputShape: number[];\n userCode: string;\n\n constructor(convInfo: backend_util.Conv3DInfo) {\n this.outputShape = convInfo.inShape;\n const filterDepth = convInfo.filterDepth;\n const filterHeight = convInfo.filterHeight;\n const filterWidth = convInfo.filterWidth;\n const strideDepth = convInfo.strideDepth;\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n const dilationDepth = convInfo.dilationDepth;\n const dilationHeight = convInfo.dilationHeight;\n const dilationWidth = convInfo.dilationWidth;\n const effectiveFilterDepth = convInfo.effectiveFilterDepth;\n const effectiveFilterHeight = convInfo.effectiveFilterHeight;\n const effectiveFilterWidth = convInfo.effectiveFilterWidth;\n\n const padFront = effectiveFilterDepth - 1 - convInfo.padInfo.front;\n const padTop = effectiveFilterHeight - 1 - convInfo.padInfo.top;\n const padLeft = effectiveFilterWidth - 1 - convInfo.padInfo.left;\n\n const avgMultiplier = 1 / (filterDepth * filterHeight * filterWidth);\n\n this.userCode = `\n const ivec3 pads = ivec3(${padFront}, ${padTop}, ${padLeft});\n const float avgMultiplier = float(${avgMultiplier});\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int ch = coords.u;\n\n ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;\n int dyDCorner = dyCorner.x;\n int dyRCorner = dyCorner.y;\n int dyCCorner = dyCorner.z;\n\n // Convolve dy(?, ?, ?, d) with pos mask(:, :, :, ch) to get\n // dx(xD, xR, xC, ch).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n\n for (int wD = 0; wD < ${effectiveFilterDepth};\n wD += ${dilationDepth}) {\n float dyD = float(dyDCorner + wD) / ${strideDepth}.0;\n\n if (dyD < 0.0 || dyD >= ${convInfo.outDepth}.0 || fract(dyD) > 0.0) {\n continue;\n }\n int idyD = int(dyD);\n\n for (int wR = 0; wR < ${effectiveFilterHeight};\n wR += ${dilationHeight}) {\n float dyR = float(dyRCorner + wR) / ${strideHeight}.0;\n\n if (dyR < 0.0 || dyR >= ${convInfo.outHeight}.0 ||\n fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < ${effectiveFilterWidth};\n wC += ${dilationWidth}) {\n float dyC = float(dyCCorner + wC) / ${strideWidth}.0;\n\n if (dyC < 0.0 || dyC >= ${convInfo.outWidth}.0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(batch, idyD, idyR, idyC, ch);\n\n dotProd += dyValue * avgMultiplier;\n }\n }\n }\n setOutput(dotProd);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {AvgPool3DGrad, AvgPool3DGradAttrs, AvgPool3DGradInputs, backend_util, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {AvgPool3DBackpropProgram} from '../avg_pool_backprop_gpu';\nimport {MathBackendWebGL} from '../backend_webgl';\n\nexport function avgPool3DGrad(args: {\n inputs: AvgPool3DGradInputs,\n backend: MathBackendWebGL,\n attrs: AvgPool3DGradAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {dy, input} = inputs;\n const x = input;\n const {filterSize, strides, pad, dimRoundingMode} = attrs;\n const dilations: [number, number, number] = [1, 1, 1];\n\n const convInfo = backend_util.computePool3DInfo(\n x.shape as [number, number, number, number, number], filterSize, strides,\n dilations, pad, dimRoundingMode);\n const avgPoolBackpropProgram = new AvgPool3DBackpropProgram(convInfo);\n return backend.runWebGLProgram(avgPoolBackpropProgram, [dy], x.dtype);\n}\n\nexport const avgPool3DGradConfig: KernelConfig = {\n kernelName: AvgPool3DGrad,\n backendName: 'webgl',\n kernelFunc: avgPool3DGrad as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {AvgPoolGrad, AvgPoolGradAttrs, AvgPoolGradInputs, backend_util, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {AvgPool2DBackpropProgram} from '../avg_pool_backprop_gpu';\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {assertNotComplex} from '../webgl_util';\n\nexport function avgPoolGrad(args: {\n inputs: AvgPoolGradInputs,\n backend: MathBackendWebGL,\n attrs: AvgPoolGradAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {dy, input} = inputs;\n const x = input;\n assertNotComplex([dy, input], 'avgPoolGrad');\n const {filterSize, strides, pad} = attrs;\n\n const convInfo = backend_util.computePool2DInfo(\n x.shape as [number, number, number, number], filterSize, strides,\n 1 /* dilations */, pad);\n const avgPoolBackpropProgram = new AvgPool2DBackpropProgram(convInfo);\n return backend.runWebGLProgram(avgPoolBackpropProgram, [dy], x.dtype);\n}\n\nexport const avgPoolGradConfig: KernelConfig = {\n kernelName: AvgPoolGrad,\n backendName: 'webgl',\n kernelFunc: avgPoolGrad as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {BatchMatMul, BatchMatMulAttrs, BatchMatMulInputs, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {batchMatMulImpl} from './BatchMatMul_impl';\n\nexport function batchMatMul(args: {\n inputs: BatchMatMulInputs,\n attrs: BatchMatMulAttrs,\n backend: MathBackendWebGL\n}) {\n const {inputs, backend, attrs} = args;\n const {a, b} = inputs;\n const {transposeA, transposeB} = attrs;\n\n return batchMatMulImpl({a, b, transposeA, transposeB, backend});\n}\n\nexport const batchMatMulConfig: KernelConfig = {\n kernelName: BatchMatMul,\n backendName: 'webgl',\n kernelFunc: batchMatMul as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class BatchNormProgram implements GPGPUProgram {\n variableNames: string[];\n outputShape: number[] = [];\n userCode: string;\n\n constructor(\n xShape: number[], meanShape: number[], varianceShape: number[],\n offsetShape: number[]|null, scaleShape: number[]|null,\n varianceEpsilon: number) {\n this.variableNames = ['x', 'mean', 'variance'];\n backend_util.assertAndGetBroadcastShape(xShape, meanShape);\n backend_util.assertAndGetBroadcastShape(xShape, varianceShape);\n\n let offsetSnippet = '0.0';\n if (offsetShape != null) {\n backend_util.assertAndGetBroadcastShape(xShape, offsetShape);\n this.variableNames.push('offset');\n offsetSnippet = 'getOffsetAtOutCoords()';\n }\n\n let scaleSnippet = '1.0';\n if (scaleShape != null) {\n backend_util.assertAndGetBroadcastShape(xShape, scaleShape);\n this.variableNames.push('scale');\n scaleSnippet = 'getScaleAtOutCoords()';\n }\n\n this.outputShape = xShape;\n this.userCode = `\n void main() {\n float x = getXAtOutCoords();\n float mean = getMeanAtOutCoords();\n float variance = getVarianceAtOutCoords();\n float offset = ${offsetSnippet};\n float scale = ${scaleSnippet};\n float inv = scale * inversesqrt(variance + float(${varianceEpsilon}));\n setOutput(dot(vec3(x, -mean, offset), vec3(inv, inv, 1)));\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class BatchNormPackedProgram implements GPGPUProgram {\n variableNames: string[];\n outputShape: number[];\n userCode: string;\n packedInputs = true;\n packedOutput = true;\n\n constructor(\n xShape: number[], meanShape: number[], varianceShape: number[],\n offsetShape: number[]|null, scaleShape: number[]|null,\n varianceEpsilon: number) {\n this.variableNames = ['x', 'mean', 'variance'];\n backend_util.assertAndGetBroadcastShape(xShape, meanShape);\n backend_util.assertAndGetBroadcastShape(xShape, varianceShape);\n\n let offsetSnippet = 'vec4(0.0)';\n if (offsetShape != null) {\n backend_util.assertAndGetBroadcastShape(xShape, offsetShape);\n this.variableNames.push('offset');\n offsetSnippet = 'getOffsetAtOutCoords()';\n }\n\n let scaleSnippet = 'vec4(1.0)';\n if (scaleShape != null) {\n backend_util.assertAndGetBroadcastShape(xShape, scaleShape);\n this.variableNames.push('scale');\n scaleSnippet = 'getScaleAtOutCoords()';\n }\n\n this.outputShape = xShape;\n this.userCode = `\n void main() {\n vec4 offset = ${offsetSnippet};\n vec4 scale = ${scaleSnippet};\n\n vec4 x = getXAtOutCoords();\n vec4 mean = getMeanAtOutCoords();\n vec4 variance = getVarianceAtOutCoords();\n\n vec4 inv = scale * inversesqrt(variance + vec4(${varianceEpsilon}));\n\n setOutput((x - mean) * inv + offset);\n }\n `;\n }\n}\n","\n/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env, FusedBatchNorm, FusedBatchNormAttrs, FusedBatchNormInputs, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {BatchNormProgram} from '../batchnorm_gpu';\nimport {BatchNormPackedProgram} from '../batchnorm_packed_gpu';\n\nexport const batchNorm: (params: {\n inputs: FusedBatchNormInputs,\n backend: MathBackendWebGL,\n attrs: FusedBatchNormAttrs\n}) => TensorInfo = ({inputs, backend, attrs}) => {\n const {x, mean, variance, offset, scale} = inputs;\n\n util.assert(\n mean.shape.length === variance.shape.length,\n () => 'Batch normalization gradient requires mean and variance to have ' +\n 'equal ranks.');\n util.assert(\n offset == null || mean.shape.length === offset.shape.length,\n () => 'Batch normalization gradient requires mean and offset to have ' +\n 'equal ranks.');\n util.assert(\n scale == null || mean.shape.length === scale.shape.length,\n () => 'Batch normalization gradient requires mean and scale to have ' +\n 'equal ranks.');\n\n let {varianceEpsilon} = attrs;\n if (varianceEpsilon == null) {\n varianceEpsilon = 0.001;\n }\n\n const finalInputs = [x, mean, variance];\n\n let offsetShape = null;\n if (offset != null) {\n offsetShape = offset.shape;\n finalInputs.push(offset);\n }\n\n let scaleShape = null;\n if (scale != null) {\n scaleShape = scale.shape;\n finalInputs.push(scale);\n }\n\n const program = env().getBool('WEBGL_PACK_NORMALIZATION') ?\n new BatchNormPackedProgram(\n x.shape, mean.shape, variance.shape, offsetShape, scaleShape,\n varianceEpsilon) :\n new BatchNormProgram(\n x.shape, mean.shape, variance.shape, offsetShape, scaleShape,\n varianceEpsilon);\n const output =\n backend.runWebGLProgram(program, finalInputs, finalInputs[0].dtype);\n\n return output;\n};\n\nexport const batchNormConfig: KernelConfig = {\n kernelName: FusedBatchNorm,\n backendName: 'webgl',\n kernelFunc: batchNorm as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {getCoordsDataType, UniformType} from './shader_compiler';\n\nexport class SliceProgram implements GPGPUProgram {\n variableNames = ['source'];\n outputShape: number[];\n userCode: string;\n rank: number;\n customUniforms: Array<{name: string; arrayIndex: number; type: UniformType;}>;\n\n constructor(destSize: number[]) {\n this.outputShape = destSize;\n this.rank = destSize.length;\n\n const dtype = getCoordsDataType(this.rank);\n this.customUniforms = [{name: 'start', arrayIndex: this.rank, type: 'int'}];\n const sourceCoords = getCoords(this.rank);\n\n let body: string;\n const coordSum = destSize.map((_, i) => {\n return `sourceLoc.${coords[i]} = start[${i}] + coords.${coords[i]};`;\n });\n body = `\n ${dtype} sourceLoc;\n ${dtype} coords = getOutputCoords();\n ${coordSum.join('\\n')}\n `;\n this.userCode = `\n void main() {\n ${body}\n setOutput(getSource(${sourceCoords}));\n }\n `;\n }\n}\n\nconst coords = ['x', 'y', 'z', 'w', 'u', 'v'];\n\nfunction getCoords(rank: number): string {\n if (rank === 1) {\n return 'sourceLoc';\n } else if (rank <= 6) {\n return coords.slice(0, rank).map(x => 'sourceLoc.' + x).join(',');\n } else {\n throw Error(`Slicing for rank ${rank} is not yet supported`);\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {getChannels} from './packing_util';\nimport {getCoordsDataType, UniformType} from './shader_compiler';\n\nexport class SlicePackedProgram implements GPGPUProgram {\n variableNames = ['source'];\n packedInputs = true;\n packedOutput = true;\n outputShape: number[];\n userCode: string;\n rank: number;\n customUniforms: Array<{name: string; arrayIndex: number; type: UniformType;}>;\n\n constructor(destSize: number[]) {\n this.outputShape = destSize;\n this.rank = destSize.length;\n this.customUniforms = [{name: 'start', arrayIndex: this.rank, type: 'int'}];\n const dtype = getCoordsDataType(this.rank);\n const coords = getChannels('coords', this.rank);\n const sourceLoc = getChannels('sourceLoc', this.rank);\n\n const innerDims =\n this.rank === 1 ? 'sourceLoc' : `vec2(${sourceLoc.slice(-2).join()})`;\n const getChannel =\n `getChannel(getSource(${sourceLoc.join()}), ${innerDims})`;\n const upperRow = `\n result.x = ${getChannel};\n if (++${coords[this.rank - 1]} < ${destSize[this.rank - 1]}) {\n ++${sourceLoc[this.rank - 1]};\n result.y = ${getChannel};\n --${sourceLoc[this.rank - 1]};\n }\n `;\n const lowerRow = this.rank === 1 ? '' : `\n --${coords[this.rank - 1]};\n if (++${coords[this.rank - 2]} < ${destSize[this.rank - 2]}) {\n ++${sourceLoc[this.rank - 2]};\n result.z = ${getChannel};\n if (++${coords[this.rank - 1]} < ${destSize[this.rank - 1]}) {\n ++${sourceLoc[this.rank - 1]};\n result.w = ${getChannel};\n }\n }\n `;\n\n const sourceLocSetup = this.rank <= 4 ?\n `sourceLoc = coords +\n ${dtype}(${destSize.map((_, i) => `start[${i}]`).join()});` :\n destSize.map((_, i) => `${sourceLoc[i]} = ${coords[i]} + start[${i}];`)\n .join('\\n');\n this.userCode = `\n void main() {\n ${dtype} coords = getOutputCoords();\n ${dtype} sourceLoc;\n ${sourceLocSetup}\n vec4 result = vec4(0.);\n ${upperRow}\n ${lowerRow}\n setOutput(result);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env, KernelConfig, KernelFunc, Slice, slice_util, SliceAttrs, SliceInputs, TensorInfo, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {sliceImplCPU} from '../kernel_utils/shared';\nimport {SliceProgram} from '../slice_gpu';\nimport {SlicePackedProgram} from '../slice_packed_gpu';\n\nfunction shallowSlice(\n x: TensorInfo, begin: number[], size: number[], backend: MathBackendWebGL) {\n const xTexData = backend.texData.get(x.dataId);\n const t = backend.makeTensorInfo(size, x.dtype);\n const newTexData = backend.texData.get(t.dataId);\n // Copy texture data from the original tensor.\n Object.assign(newTexData, xTexData);\n newTexData.refCount = 1;\n newTexData.shape = size;\n newTexData.dtype = x.dtype;\n let flatOffset =\n slice_util.computeFlatOffset(begin, util.computeStrides(x.shape));\n if (xTexData.slice) {\n // We are slicing an already sliced tensor, so we have to accumulate\n // the offset.\n flatOffset += xTexData.slice.flatOffset;\n }\n newTexData.slice = {\n flatOffset,\n // Point to the original dataId, which is used to do ref counting.\n origDataId: xTexData.slice && xTexData.slice.origDataId || x.dataId\n };\n\n // Increase the ref count for that data bucket.\n const refCount = backend.dataRefCount.get(newTexData.slice.origDataId) || 1;\n backend.dataRefCount.set(newTexData.slice.origDataId, refCount + 1);\n return t;\n}\n\nexport function slice(\n args: {inputs: SliceInputs, backend: MathBackendWebGL, attrs: SliceAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {begin, size} = attrs;\n\n const [$begin, $size] = slice_util.parseSliceParams(x, begin, size);\n slice_util.assertParamsValid(x, $begin, $size);\n\n if (util.sizeFromShape($size) === 0) {\n return backend.makeTensorInfo($size, x.dtype, []);\n }\n\n // Run on cpu if dtype is string. For string, the backend represents it\n // as Uint8Array[], where each Uint8Array is a character. Given that the\n // computation is only on the outer array, uploading the whole data onto\n // gpu is wasteful. Also, currently webgl doesn't have a design to\n // upload and retrieve Uint8Array[] between cpu and gpu. Therefore, we\n // just run the kernel on cpu if dtype is string.\n if (backend.shouldExecuteOnCPU([x]) || x.dtype === 'string') {\n const xTexData = backend.texData.get(x.dataId);\n const outValues = sliceImplCPU(\n xTexData.values as TypedArray, $begin, $size, x.shape, x.dtype);\n return backend.makeTensorInfo($size, x.dtype, outValues);\n }\n\n const {isPacked} = backend.texData.get(x.dataId);\n const isContinous = slice_util.isSliceContinous(x.shape, $begin, $size);\n if (isPacked || !isContinous) {\n const program = env().getBool('WEBGL_PACK_ARRAY_OPERATIONS') ?\n new SlicePackedProgram($size) :\n new SliceProgram($size);\n const customValues = [$begin];\n return backend.runWebGLProgram(program, [x], x.dtype, customValues);\n }\n backend.uploadToGPU(x.dataId);\n return shallowSlice(x, $begin, $size, backend);\n}\n\nexport const sliceConfig: KernelConfig = {\n kernelName: Slice,\n backendName: 'webgl',\n kernelFunc: slice as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, BatchToSpaceND, BatchToSpaceNDAttrs, BatchToSpaceNDInputs, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\n\nimport {reshape} from './Reshape';\nimport {slice} from './Slice';\nimport {transpose} from './Transpose';\n\nexport const batchToSpaceND = (args: {\n inputs: BatchToSpaceNDInputs,\n backend: MathBackendWebGL,\n attrs: BatchToSpaceNDAttrs\n}): TensorInfo => {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {blockShape, crops} = attrs;\n\n util.assert(\n x.shape.length <= 4,\n () => 'batchToSpaceND for rank > 4 with a WebGL backend not ' +\n 'implemented yet');\n const prod = blockShape.reduce((a, b) => a * b);\n\n const reshaped = backend_util.getReshaped(x.shape, blockShape, prod);\n const permuted = backend_util.getPermuted(reshaped.length, blockShape.length);\n const reshapedPermuted =\n backend_util.getReshapedPermuted(x.shape, blockShape, prod);\n const sliceBeginCoords =\n backend_util.getSliceBeginCoords(crops, blockShape.length);\n const sliceSize =\n backend_util.getSliceSize(reshapedPermuted, crops, blockShape.length);\n\n const toDispose = [];\n\n const reshapedIntermediate =\n reshape({inputs: {x}, backend, attrs: {shape: reshaped}});\n const transposedIntermediate = transpose(\n {inputs: {x: reshapedIntermediate}, backend, attrs: {perm: permuted}});\n const reshapedIntermediate2 = reshape({\n inputs: {x: transposedIntermediate},\n backend,\n attrs: {shape: reshapedPermuted}\n });\n const sliced = slice({\n inputs: {x: reshapedIntermediate2},\n backend,\n attrs: {begin: sliceBeginCoords, size: sliceSize}\n });\n\n toDispose.push(reshapedIntermediate);\n toDispose.push(transposedIntermediate);\n toDispose.push(reshapedIntermediate2);\n\n toDispose.forEach(t => backend.disposeIntermediateTensorInfo(t));\n\n return sliced;\n};\n\nexport const batchToSpaceNDConfig: KernelConfig = {\n kernelName: BatchToSpaceND,\n backendName: 'webgl',\n kernelFunc: batchToSpaceND as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Bincount, BincountAttrs, BincountInputs, KernelConfig, KernelFunc, TensorInfo, TypedArray} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {bincountImplCPU} from '../kernel_utils/shared';\n\nexport function bincount(args: {\n inputs: BincountInputs,\n backend: MathBackendWebGL,\n attrs: BincountAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x, weights} = inputs;\n const {size} = attrs;\n\n const xVals = backend.readSync(x.dataId) as TypedArray;\n const weightsVals = backend.readSync(weights.dataId) as TypedArray;\n\n const outVals =\n bincountImplCPU(xVals, weightsVals, weights.dtype, weights.shape, size);\n\n return backend.makeTensorInfo([size], weights.dtype, outVals);\n}\n\nexport const bincountConfig: KernelConfig = {\n kernelName: Bincount,\n backendName: 'webgl',\n kernelFunc: bincount as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, BroadcastArgs, BroadcastArgsInputs, KernelConfig, TensorInfo, TypedArray} from '@tensorflow/tfjs-core';\nimport {MathBackendWebGL} from '../backend_webgl';\n\nexport function broadcastArgs(args: {\n inputs: BroadcastArgsInputs,\n backend: MathBackendWebGL,\n}): TensorInfo {\n const {inputs, backend} = args;\n const {s0, s1} = inputs;\n\n const s0Vals = backend.readSync(s0.dataId) as TypedArray;\n const s1Vals = backend.readSync(s1.dataId) as TypedArray;\n\n const broadcastShape = backend_util.assertAndGetBroadcastShape(\n Array.from(s0Vals), Array.from(s1Vals));\n\n return backend.makeTensorInfo(\n [broadcastShape.length], 'int32', Int32Array.from(broadcastShape));\n}\n\nexport const broadcastArgsConfig: KernelConfig = {\n kernelName: BroadcastArgs,\n backendName: 'webgl',\n kernelFunc: broadcastArgs\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {NotEqual} from '@tensorflow/tfjs-core';\nimport {KernelConfig} from '@tensorflow/tfjs-core';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {notEqualImplCPU} from '../kernel_utils/shared';\n\nconst NOT_EQUAL = `return float(a != b);`;\n\nexport const notEqual = binaryKernelFunc(\n {opSnippet: NOT_EQUAL, cpuKernelImpl: notEqualImplCPU, dtype: 'bool'});\n\nexport const notEqualConfig: KernelConfig = {\n kernelName: NotEqual,\n backendName: 'webgl',\n kernelFunc: notEqual,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Real, RealInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {identity} from './Identity';\n\nexport function real(args: {inputs: RealInputs, backend: MathBackendWebGL}):\n TensorInfo {\n const {inputs, backend} = args;\n const {input} = inputs;\n const inputData = backend.texData.get(input.dataId);\n\n return identity({inputs: {x: inputData.complexTensorInfos.real}, backend});\n}\n\nexport const realConfig: KernelConfig = {\n kernelName: Real,\n backendName: 'webgl',\n kernelFunc: real as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {UnaryOpProgram} from '../unaryop_gpu';\n\nconst TO_INT = `return float(int(x));`;\n\nexport function int(input: TensorInfo, backend: MathBackendWebGL): TensorInfo {\n const program = new UnaryOpProgram(input.shape, TO_INT);\n const output = backend.runWebGLProgram(program, [input], 'int32');\n return {dataId: output.dataId, shape: output.shape, dtype: output.dtype};\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport * as tf from '@tensorflow/tfjs-core';\nimport {BinaryInputs, Cast, CastAttrs, CastInputs, KernelConfig, KernelFunc, TensorInfo, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {castImplCPU} from '../kernel_utils/shared';\nimport {complex} from './Complex';\nimport {identity} from './Identity';\nimport {notEqual} from './NotEqual';\nimport {real} from './Real';\n\nimport {int} from '../kernel_utils/int';\n\nexport function cast(\n args: {inputs: CastInputs, backend: MathBackendWebGL, attrs: CastAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {dtype} = attrs;\n\n // Casting to complex64.\n if (dtype === 'complex64') {\n if (x.dtype === 'complex64') {\n return identity({inputs: {x}, backend});\n }\n\n // TODO(annxingyuan): Import kernel function once zeros is modularized.\n const zerosTensor = tf.zeros(x.shape);\n const floatX = cast({inputs: {x}, backend, attrs: {dtype: 'float32'}});\n\n const result =\n complex({inputs: {real: floatX, imag: zerosTensor}, backend});\n\n zerosTensor.dispose();\n backend.disposeIntermediateTensorInfo(floatX);\n\n return result;\n }\n\n // Casting from complex64\n if (x.dtype === 'complex64') {\n const realPart = real({inputs: {input: x}, backend});\n const result = cast({inputs: {x: realPart}, backend, attrs: {dtype}});\n backend.disposeIntermediateTensorInfo(realPart);\n return result;\n }\n\n if (!util.hasEncodingLoss(x.dtype, dtype)) {\n // We don't change the underlying data, since we cast to higher\n // precision.\n const result = identity({inputs: {x}, backend});\n return {dataId: result.dataId, shape: result.shape, dtype};\n }\n\n if (backend.shouldExecuteOnCPU([x])) {\n const values = backend.texData.get(x.dataId).values as TypedArray;\n const [resultShape, resultType, resultData] =\n castImplCPU(values, x.shape, x.dtype, dtype);\n return backend.makeTensorInfo(resultShape, resultType, resultData);\n }\n\n if (dtype === 'int32') {\n return int(x, backend);\n }\n\n if (dtype === 'bool') {\n const zerosTensorInfo = backend.makeTensorInfo(\n [], 'bool', util.getTypedArrayFromDType('bool', 1));\n\n const binaryInputs: BinaryInputs = {a: x, b: zerosTensorInfo};\n\n const result = notEqual({inputs: binaryInputs, backend}) as TensorInfo;\n backend.disposeIntermediateTensorInfo(zerosTensorInfo);\n return result;\n }\n\n throw new Error(`Error in Cast: failed to cast ${x.dtype} to ${dtype}`);\n}\n\nexport const castConfig: KernelConfig = {\n kernelName: Cast,\n backendName: 'webgl',\n kernelFunc: cast as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Ceil, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {ceilImplCPU} from '../kernel_utils/shared';\n\nconst CEIL = `return ceil(x);`;\n\nexport const ceil = unaryKernelFunc(\n {opSnippet: CEIL, packedOpSnippet: CEIL, cpuKernelImpl: ceilImplCPU});\n\nexport const ceilConfig: KernelConfig = {\n kernelName: Ceil,\n backendName: 'webgl',\n kernelFunc: ceil as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {UniformType} from './shader_compiler';\n\nexport class ClipProgram implements GPGPUProgram {\n variableNames = ['A'];\n userCode: string;\n outputShape: number[];\n customUniforms = [\n {name: 'minVal', type: 'float' as UniformType},\n {name: 'maxVal', type: 'float' as UniformType}\n ];\n\n constructor(aShape: number[]) {\n this.outputShape = aShape;\n this.userCode = `\n\n void main() {\n float value = getAAtOutCoords();\n if (isnan(value)) {\n setOutput(value);\n return;\n }\n\n setOutput(clamp(value, minVal, maxVal));\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {UniformType} from './shader_compiler';\n\nexport class ClipPackedProgram implements GPGPUProgram {\n variableNames = ['A'];\n packedInputs = true;\n packedOutput = true;\n userCode: string;\n outputShape: number[];\n customUniforms = [\n {name: 'minVal', type: 'float' as UniformType},\n {name: 'maxVal', type: 'float' as UniformType}\n ];\n\n constructor(aShape: number[]) {\n this.outputShape = aShape;\n this.userCode = `\n void main() {\n vec4 value = getAAtOutCoords();\n\n if (any(isnan(value))) {\n setOutput(value);\n return;\n }\n\n setOutput(clamp(value, vec4(minVal), vec4(maxVal)));\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ClipByValue, ClipByValueAttrs, ClipByValueInputs, env, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {ClipProgram} from '../clip_gpu';\nimport {ClipPackedProgram} from '../clip_packed_gpu';\n\nexport function clipByValue(args: {\n inputs: ClipByValueInputs,\n backend: MathBackendWebGL,\n attrs: ClipByValueAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {clipValueMin, clipValueMax} = attrs;\n\n let program;\n if (env().getBool('WEBGL_PACK_CLIP')) {\n program = new ClipPackedProgram(x.shape);\n } else {\n program = new ClipProgram(x.shape);\n }\n const customValues = [[clipValueMin], [clipValueMax]];\n return backend.runWebGLProgram(program, [x], x.dtype, customValues);\n}\n\nexport const clipByValueConfig: KernelConfig = {\n kernelName: ClipByValue,\n backendName: 'webgl',\n kernelFunc: clipByValue as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class ComplexAbsProgram implements GPGPUProgram {\n variableNames = ['real', 'imag'];\n userCode: string;\n outputShape: number[];\n\n constructor(shape: number[]) {\n this.outputShape = shape;\n this.userCode = `\n void main() {\n float re = abs(getRealAtOutCoords());\n float im = abs(getImagAtOutCoords());\n float mx = max(re, im);\n\n // sadly the length function in glsl is not underflow-safe\n // (at least not on Intel GPUs). So the safe solution is\n // to ensure underflow-safety in all cases.\n setOutput(\n mx == 0.0 ? 0.0 : mx * length(vec2(1, min(re, im)/mx))\n );\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ComplexAbs, ComplexAbsInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {ComplexAbsProgram} from '../complex_abs_gpu';\n\n// Returns a TensorInfo with the complex shape and the dataId of the\n// underlying part. We need to do this because a reshaped complex tensor is\n// not reflected in its parts.\nfunction makeComplexComponentTensorInfo(\n complexTensor: TensorInfo, complexPart: TensorInfo): TensorInfo {\n return {\n dataId: complexPart.dataId,\n dtype: complexPart.dtype,\n shape: complexTensor.shape\n };\n}\n\nexport function complexAbs(\n args: {inputs: ComplexAbsInputs, backend: MathBackendWebGL}): TensorInfo {\n const {inputs, backend} = args;\n const {x} = inputs;\n\n const xData = backend.texData.get(x.dataId);\n\n const program = new ComplexAbsProgram(x.shape);\n const programInputs = [\n makeComplexComponentTensorInfo(x, xData.complexTensorInfos.real),\n makeComplexComponentTensorInfo(x, xData.complexTensorInfos.imag),\n ];\n\n return backend.runWebGLProgram(\n program, programInputs, programInputs[0].dtype);\n}\n\nexport const complexAbsConfig: KernelConfig = {\n kernelName: ComplexAbs,\n backendName: 'webgl',\n kernelFunc: complexAbs as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class ConcatProgram implements GPGPUProgram {\n variableNames: string[];\n outputShape: number[] = [];\n userCode: string;\n\n // Concats 2d tensors along axis=1. See comments in MathBackendWebGL.concat().\n constructor(shapes: Array<[number, number]>) {\n this.outputShape = backend_util.computeOutShape(shapes, 1 /* axis */);\n this.variableNames = shapes.map((_, i) => `T${i}`);\n\n const offsets: number[] = new Array(shapes.length - 1);\n offsets[0] = shapes[0][1];\n for (let i = 1; i < offsets.length; i++) {\n offsets[i] = offsets[i - 1] + shapes[i][1];\n }\n\n const snippets = [`if (yC < ${offsets[0]}) setOutput(getT0(yR, yC));`];\n for (let i = 1; i < offsets.length; i++) {\n const shift = offsets[i - 1];\n snippets.push(\n `else if (yC < ${offsets[i]}) ` +\n `setOutput(getT${i}(yR, yC-${shift}));`);\n }\n const lastIndex = offsets.length;\n const lastShift = offsets[offsets.length - 1];\n snippets.push(`else setOutput(getT${lastIndex}(yR, yC-${lastShift}));`);\n\n this.userCode = `\n void main() {\n ivec2 coords = getOutputCoords();\n int yR = coords.x;\n int yC = coords.y;\n\n ${snippets.join('\\n ')}\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {getChannels} from './packing_util';\nimport {getCoordsDataType} from './shader_compiler';\n\nexport class ConcatPackedProgram implements GPGPUProgram {\n variableNames: string[];\n packedInputs = true;\n packedOutput = true;\n outputShape: number[] = [];\n userCode: string;\n\n constructor(shapes: number[][], axis: number) {\n this.outputShape = backend_util.computeOutShape(shapes, axis);\n const shape = this.outputShape;\n const rank = shape.length;\n const dtype = getCoordsDataType(rank);\n const coords = getChannels('coords', rank);\n const channels = ['x', 'y', 'z', 'w', 'u', 'v'].slice(0, rank);\n this.variableNames = shapes.map((_, i) => `T${i}`);\n\n const offsets: number[] = new Array(shapes.length - 1);\n offsets[0] = shapes[0][axis];\n for (let i = 1; i < offsets.length; i++) {\n offsets[i] = offsets[i - 1] + shapes[i][axis];\n }\n\n const channel = channels[axis];\n const lastChannels = channels.slice(-2);\n const allChannels = channels.join();\n\n let getValueSnippet = `if (${channel} < ${offsets[0]}) {\n return getChannel(\n getT0(${allChannels}), vec2(${lastChannels.join()}));\n }`;\n for (let i = 1; i < offsets.length; i++) {\n const shift = offsets[i - 1];\n // Note: the >= comparison below may seem unnecessary given the check\n // above but is needed to workaround branch execution issues on some\n // devices. It makes all the conditions exclusive without relying on\n // execution order.\n getValueSnippet += `\n if (${channel} < ${offsets[i]} && ${channel} >= ${offsets[i - 1]}) {\n return getChannel(\n getT${i}(${shiftedChannels(channels, channel, shift)}),\n vec2(${shiftedChannels(lastChannels, channel, shift)}));\n }`;\n }\n const lastIndex = offsets.length;\n const shift = offsets[offsets.length - 1];\n getValueSnippet += `\n return getChannel(\n getT${lastIndex}(${shiftedChannels(channels, channel, shift)}),\n vec2(${shiftedChannels(lastChannels, channel, shift)}));`;\n\n this.userCode = `\n float getValue(${channels.map(x => 'int ' + x)}) {\n ${getValueSnippet}\n }\n\n void main() {\n ${dtype} coords = getOutputCoords();\n vec4 result = vec4(getValue(${coords}), 0., 0., 0.);\n\n ${coords[rank - 1]} = ${coords[rank - 1]} + 1;\n if (${coords[rank - 1]} < ${shape[rank - 1]}) {\n result.g = getValue(${coords});\n }\n\n ${coords[rank - 2]} = ${coords[rank - 2]} + 1;\n if (${coords[rank - 2]} < ${shape[rank - 2]}) {\n result.a = getValue(${coords});\n }\n\n ${coords[rank - 1]} = ${coords[rank - 1]} - 1;\n if (${coords[rank - 2]} < ${shape[rank - 2]} &&\n ${coords[rank - 1]} < ${shape[rank - 1]}) {\n result.b = getValue(${coords});\n }\n setOutput(result);\n }\n `;\n }\n}\n\n/**\n * Return an expression for coordinates into a vector where a given channel\n * will be offset by [shift].\n *\n * @param channels the channels to consider\n * @param channel the channel we want shifted\n * @param shift the amount to subtract from the channel.\n *\n * @returns a string of the form 'x, y-[shift], z' where any one channel can\n * have the shift applied.\n */\nfunction shiftedChannels(channels: string[], channel: string, shift: number) {\n const channelIdx = channels.indexOf(channel);\n const res = channels.map((c, idx) => {\n if (idx === channelIdx) {\n return `${c} - ${shift}`;\n } else {\n return c;\n }\n });\n return res.join();\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Imag, ImagInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {identity} from './Identity';\n\nexport function imag(args: {inputs: ImagInputs, backend: MathBackendWebGL}):\n TensorInfo {\n const {inputs, backend} = args;\n const {input} = inputs;\n const inputData = backend.texData.get(input.dataId);\n\n return identity({inputs: {x: inputData.complexTensorInfos.imag}, backend});\n}\n\nexport const imagConfig: KernelConfig = {\n kernelName: Imag,\n backendName: 'webgl',\n kernelFunc: imag as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, ConcatInputs, env, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {ConcatProgram} from '../concat_gpu';\nimport {ConcatPackedProgram} from '../concat_packed_gpu';\nimport {concatImplCPU} from '../kernel_utils/shared';\n\nimport {complex} from './Complex';\nimport {imag} from './Imag';\nimport {real} from './Real';\nimport {reshape} from './Reshape';\n\nexport function concatImpl(\n inputs: ConcatInputs, axis: number, backend: MathBackendWebGL): TensorInfo {\n const dtype = inputs[0].dtype;\n if (dtype === 'complex64') {\n const reals = inputs.map((t) => real({inputs: {input: t}, backend}));\n const imags = inputs.map((t) => imag({inputs: {input: t}, backend}));\n\n const realConcated = concatImpl(reals, axis, backend);\n const imagConcated = concatImpl(imags, axis, backend);\n\n const result =\n complex({inputs: {real: realConcated, imag: imagConcated}, backend});\n\n reals.forEach(r => backend.disposeIntermediateTensorInfo(r));\n imags.forEach(i => backend.disposeIntermediateTensorInfo(i));\n backend.disposeIntermediateTensorInfo(realConcated);\n backend.disposeIntermediateTensorInfo(imagConcated);\n\n return result;\n }\n\n let runOnCpu = backend.shouldExecuteOnCPU(inputs);\n\n // Run on cpu if dtype is string. For string, the backend represents it\n // as Uint8Array[], where each Uint8Array is a character. Given that the\n // computation is only on the outer array, uploading the whole data onto\n // gpu is wasteful. Also, currently webgl doesn't have a design to\n // upload and retrieve Uint8Array[] between cpu and gpu. Therefore, we\n // just run the kernel on cpu if dtype is string.\n if (dtype === 'string') {\n runOnCpu = true;\n }\n\n if (runOnCpu) {\n // Any concat of n-dimensional tensors across any axis can be reduced to\n // a concatenation of two-dimensional tensors across the axis 1 by first\n // partitioning the axes of the original tensors into those less than the\n // axis to be concatenated and the rest. Then reshape the tensors\n // into a two-dimensional tensor by collapsing these two sets of axes and\n // concatenate the resulting matrices across the axis 1, finally reshaping\n // the result to have the proper shape.\n const tensors2D = inputs.map(t => {\n const innerSize = util.sizeFromShape(t.shape.slice(axis));\n const shape = [-1, innerSize];\n return reshape({inputs: {x: t}, backend, attrs: {shape}});\n });\n\n const inputsValShapes = tensors2D.map(t => {\n return {vals: backend.readSync(t.dataId), shape: t.shape};\n });\n\n // Concats 2d tensors along axis=1.\n const outShape =\n backend_util.computeOutShape(tensors2D.map(t => t.shape), 1 /* axis */);\n const simplyConcat = tensors2D[0].shape[0] === 1;\n const outVals =\n concatImplCPU(inputsValShapes, outShape, dtype, simplyConcat);\n\n const finalOutShape =\n backend_util.computeOutShape(inputs.map(t => t.shape), axis);\n\n const outInfo = backend.makeTensorInfo(finalOutShape, dtype, outVals);\n\n tensors2D.forEach(t => backend.disposeIntermediateTensorInfo(t));\n\n return outInfo;\n }\n\n const maxTexturesInShader = env().getNumber('WEBGL_MAX_TEXTURES_IN_SHADER');\n if (inputs.length > maxTexturesInShader) {\n const reducedInputs = [];\n for (let i = 0; i < inputs.length; i += maxTexturesInShader) {\n const subArray = inputs.slice(i, i + maxTexturesInShader);\n reducedInputs.push(concatImpl(subArray, axis, backend));\n }\n const result = concatImpl(reducedInputs, axis, backend);\n\n for (const i of reducedInputs) {\n backend.disposeIntermediateTensorInfo(i);\n }\n\n return result;\n }\n\n if (env().getBool('WEBGL_PACK_ARRAY_OPERATIONS') &&\n inputs[0].shape.length > 1) {\n const program = new ConcatPackedProgram(inputs.map(t => t.shape), axis);\n return backend.runWebGLProgram(program, inputs, dtype);\n }\n\n const {tensors2D, outShape} = computeTensors2D(inputs, axis, backend);\n const program =\n new ConcatProgram(tensors2D.map(t => t.shape as [number, number]));\n const result = backend.runWebGLProgram(program, tensors2D, dtype);\n\n tensors2D.forEach(r => backend.disposeIntermediateTensorInfo(r));\n const reshapedResult =\n reshape({inputs: {x: result}, attrs: {shape: outShape}, backend});\n backend.disposeIntermediateTensorInfo(result);\n\n return reshapedResult;\n}\n\nfunction computeTensors2D(\n inputs: ConcatInputs, axis: number, backend: MathBackendWebGL) {\n // Any concat of n-dimensional tensors across any axis can be reduced to\n // a concatenation of two-dimensional tensors across the axis 1 by first\n // partitioning the axes of the original tensors into those less than the\n // axis to be concatenated and the rest. Then reshape the tensors\n // into a two-dimensional tensor by collapsing these two sets of axes and\n // concatenate the resulting matrices across the axis 1, finally reshaping\n // the result to have the proper shape.\n const outShape = backend_util.computeOutShape(inputs.map(t => t.shape), axis);\n const tensors2D = inputs.map(\n x => reshape({\n inputs: {x},\n attrs: {shape: [-1, util.sizeFromShape(x.shape.slice(axis))]},\n backend\n }));\n\n return {tensors2D, outShape};\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, Concat, ConcatAttrs, ConcatInputs, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {concatImpl} from './Concat_impl';\nimport {identity} from './Identity';\n\nexport function concat(\n args:\n {inputs: ConcatInputs, attrs: ConcatAttrs, backend: MathBackendWebGL}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {axis} = attrs;\n\n const $axis = util.parseAxisParam(axis, inputs[0].shape)[0];\n\n const shapes = inputs.map(t => t.shape);\n backend_util.assertParamsConsistent(shapes, $axis);\n\n const outShape =\n backend_util.computeOutShape(inputs.map(t => t.shape), $axis);\n\n if (util.sizeFromShape(outShape) === 0) {\n return backend.makeTensorInfo(outShape, inputs[0].dtype, []);\n }\n\n // Keep only non-empty tensors (ignore tensors with 0 in their shape).\n const $inputs = inputs.filter(t => util.sizeFromShape(t.shape) > 0);\n if ($inputs.length === 1) {\n return identity({inputs: {x: $inputs[0]}, backend});\n }\n\n return concatImpl($inputs, $axis, backend);\n}\n\nexport const concatConfig: KernelConfig = {\n kernelName: Concat,\n backendName: 'webgl',\n kernelFunc: concat as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class Conv2DProgram implements GPGPUProgram {\n variableNames = ['x', 'W'];\n outputShape: number[];\n userCode: string;\n\n constructor(\n convInfo: backend_util.Conv2DInfo, addBias = false,\n activation: string = null, hasPreluActivationWeights = false,\n hasLeakyreluAlpha = false) {\n this.outputShape = convInfo.outShape;\n const padTop = convInfo.padInfo.top;\n const padLeft = convInfo.padInfo.left;\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n const dilationHeight = convInfo.dilationHeight;\n const dilationWidth = convInfo.dilationWidth;\n const filterHeight = convInfo.filterHeight;\n const filterWidth = convInfo.filterWidth;\n\n const inputDepthNearestVec4 = Math.floor(convInfo.inChannels / 4) * 4;\n const inputDepthVec4Remainder = convInfo.inChannels % 4;\n const isChannelsLast = convInfo.dataFormat === 'channelsLast';\n\n const rowDim = isChannelsLast ? 1 : 2;\n const colDim = isChannelsLast ? 2 : 3;\n const channelDim = isChannelsLast ? 3 : 1;\n\n let activationSnippet = '', applyActivationSnippet = '';\n if (activation) {\n if (hasPreluActivationWeights) {\n activationSnippet = `float activation(float a) {\n float b = getPreluActivationWeightsAtOutCoords();\n ${activation}\n }`;\n } else if (hasLeakyreluAlpha) {\n activationSnippet = `float activation(float a) {\n float b = getLeakyreluAlphaAtOutCoords();\n ${activation}\n }`;\n } else {\n activationSnippet = `\n float activation(float x) {\n ${activation}\n }\n `;\n }\n\n applyActivationSnippet = `result = activation(result);`;\n }\n\n const addBiasSnippet = addBias ? 'result += getBiasAtOutCoords();' : '';\n if (addBias) {\n this.variableNames.push('bias');\n }\n\n if (hasPreluActivationWeights) {\n this.variableNames.push('preluActivationWeights');\n }\n\n if (hasLeakyreluAlpha) {\n this.variableNames.push('leakyreluAlpha');\n }\n\n this.userCode = `\n ${activationSnippet}\n\n const ivec2 strides = ivec2(${strideHeight}, ${strideWidth});\n const ivec2 pads = ivec2(${padTop}, ${padLeft});\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d2 = coords[${channelDim}];\n\n ivec2 xRCCorner =\n ivec2(coords[${rowDim}], coords[${colDim}]) * strides - pads;\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n // Convolve x(?, ?, d1) with w(:, :, d1, d2) to get y(yR, yC, d2).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < ${filterHeight}; wR++) {\n int xR = xRCorner + wR * ${dilationHeight};\n\n if (xR < 0 || xR >= ${convInfo.inHeight}) {\n continue;\n }\n\n for (int wC = 0; wC < ${filterWidth}; wC++) {\n int xC = xCCorner + wC * ${dilationWidth};\n\n if (xC < 0 || xC >= ${convInfo.inWidth}) {\n continue;\n }\n\n for (int d1 = 0; d1 < ${inputDepthNearestVec4}; d1 += 4) {\n vec4 wValues = vec4(\n getW(wR, wC, d1, d2),\n getW(wR, wC, d1 + 1, d2),\n getW(wR, wC, d1 + 2, d2),\n getW(wR, wC, d1 + 3, d2)\n );\n\n if (${isChannelsLast}) {\n vec4 xValues = vec4(\n getX(batch, xR, xC, d1),\n getX(batch, xR, xC, d1 + 1),\n getX(batch, xR, xC, d1 + 2),\n getX(batch, xR, xC, d1 + 3)\n );\n dotProd += dot(xValues, wValues);\n } else {\n vec4 xValues = vec4(\n getX(batch, d1, xR, xC),\n getX(batch, d1 + 1, xR, xC),\n getX(batch, d1 + 2, xR, xC),\n getX(batch, d1 + 3, xR, xC)\n );\n dotProd += dot(xValues, wValues);\n }\n }\n\n if (${inputDepthVec4Remainder === 1}) {\n\n if (${isChannelsLast}) {\n dotProd +=\n getX(batch, xR, xC, ${inputDepthNearestVec4}) *\n getW(wR, wC, ${inputDepthNearestVec4}, d2);\n } else {\n dotProd +=\n getX(batch, ${inputDepthNearestVec4}, xR, xC) *\n getW(wR, wC, ${inputDepthNearestVec4}, d2);\n }\n\n } else if (${inputDepthVec4Remainder === 2}) {\n vec2 wValues = vec2(\n getW(wR, wC, ${inputDepthNearestVec4}, d2),\n getW(wR, wC, ${inputDepthNearestVec4} + 1, d2)\n );\n\n if (${isChannelsLast}) {\n vec2 xValues = vec2(\n getX(batch, xR, xC, ${inputDepthNearestVec4}),\n getX(batch, xR, xC, ${inputDepthNearestVec4} + 1)\n );\n dotProd += dot(xValues, wValues);\n } else {\n vec2 xValues = vec2(\n getX(batch, ${inputDepthNearestVec4}, xR, xC),\n getX(batch, ${inputDepthNearestVec4} + 1, xR, xC)\n );\n dotProd += dot(xValues, wValues);\n }\n\n } else if (${inputDepthVec4Remainder === 3}) {\n vec3 wValues = vec3(\n getW(wR, wC, ${inputDepthNearestVec4}, d2),\n getW(wR, wC, ${inputDepthNearestVec4} + 1, d2),\n getW(wR, wC, ${inputDepthNearestVec4} + 2, d2)\n );\n\n if (${isChannelsLast}) {\n vec3 xValues = vec3(\n getX(batch, xR, xC, ${inputDepthNearestVec4}),\n getX(batch, xR, xC, ${inputDepthNearestVec4} + 1),\n getX(batch, xR, xC, ${inputDepthNearestVec4} + 2)\n );\n dotProd += dot(xValues, wValues);\n } else {\n vec3 xValues = vec3(\n getX(batch, ${inputDepthNearestVec4}, xR, xC),\n getX(batch, ${inputDepthNearestVec4} + 1, xR, xC),\n getX(batch, ${inputDepthNearestVec4} + 2, xR, xC)\n );\n dotProd += dot(xValues, wValues);\n }\n\n }\n }\n }\n\n float result = dotProd;\n ${addBiasSnippet}\n ${applyActivationSnippet}\n setOutput(result);\n }\n `;\n }\n}\n\nexport class Conv3DProgram implements GPGPUProgram {\n variableNames = ['x', 'W'];\n outputShape: number[];\n userCode: string;\n\n constructor(convInfo: backend_util.Conv3DInfo) {\n this.outputShape = convInfo.outShape;\n const padFront = convInfo.padInfo.front;\n const padTop = convInfo.padInfo.top;\n const padLeft = convInfo.padInfo.left;\n const strideDepth = convInfo.strideDepth;\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n const dilationDepth = convInfo.dilationDepth;\n const dilationHeight = convInfo.dilationHeight;\n const dilationWidth = convInfo.dilationWidth;\n const filterDepth = convInfo.filterDepth;\n const filterHeight = convInfo.filterHeight;\n const filterWidth = convInfo.filterWidth;\n\n const inputDepthNearestVec4 = Math.floor(convInfo.inChannels / 4) * 4;\n const inputDepthVec4Remainder = convInfo.inChannels % 4;\n\n this.userCode = `\n const ivec3 strides = ivec3(${strideDepth}, ${strideHeight}, ${\n strideWidth});\n const ivec3 pads = ivec3(${padFront}, ${padTop}, ${padLeft});\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int d2 = coords.u;\n\n ivec3 xFRCCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;\n int xFCorner = xFRCCorner.x;\n int xRCorner = xFRCCorner.y;\n int xCCorner = xFRCCorner.z;\n\n // Convolve x(?, ?, ?, d1) with w(:, :, :, d1, d2) to get\n // y(yF, yR, yC, d2). ? = to be determined. : = across all\n // values in that axis.\n float dotProd = 0.0;\n for (int wF = 0; wF < ${filterDepth}; wF++) {\n int xF = xFCorner + wF * ${dilationDepth};\n\n if (xF < 0 || xF >= ${convInfo.inDepth}) {\n continue;\n }\n\n for (int wR = 0; wR < ${filterHeight}; wR++) {\n int xR = xRCorner + wR * ${dilationHeight};\n\n if (xR < 0 || xR >= ${convInfo.inHeight}) {\n continue;\n }\n\n for (int wC = 0; wC < ${filterWidth}; wC++) {\n int xC = xCCorner + wC * ${dilationWidth};\n\n if (xC < 0 || xC >= ${convInfo.inWidth}) {\n continue;\n }\n\n for (int d1 = 0; d1 < ${inputDepthNearestVec4}; d1 += 4) {\n vec4 xValues = vec4(\n getX(batch, xF, xR, xC, d1),\n getX(batch, xF, xR, xC, d1 + 1),\n getX(batch, xF, xR, xC, d1 + 2),\n getX(batch, xF, xR, xC, d1 + 3)\n );\n vec4 wValues = vec4(\n getW(wF, wR, wC, d1, d2),\n getW(wF, wR, wC, d1 + 1, d2),\n getW(wF, wR, wC, d1 + 2, d2),\n getW(wF, wR, wC, d1 + 3, d2)\n );\n\n dotProd += dot(xValues, wValues);\n }\n\n if (${inputDepthVec4Remainder === 1}) {\n dotProd +=\n getX(batch, xF, xR, xC, ${inputDepthNearestVec4}) *\n getW(wF, wR, wC, ${inputDepthNearestVec4}, d2);\n } else if (${inputDepthVec4Remainder === 2}) {\n vec2 xValues = vec2(\n getX(batch, xF, xR, xC, ${inputDepthNearestVec4}),\n getX(batch, xF, xR, xC, ${inputDepthNearestVec4} + 1)\n );\n vec2 wValues = vec2(\n getW(wF, wR, wC, ${inputDepthNearestVec4}, d2),\n getW(wF, wR, wC, ${inputDepthNearestVec4} + 1, d2)\n );\n dotProd += dot(xValues, wValues);\n } else if (${inputDepthVec4Remainder === 3}) {\n vec3 xValues = vec3(\n getX(batch, xF, xR, xC, ${inputDepthNearestVec4}),\n getX(batch, xF, xR, xC, ${inputDepthNearestVec4} + 1),\n getX(batch, xF, xR, xC, ${inputDepthNearestVec4} + 2)\n );\n vec3 wValues = vec3(\n getW(wF, wR, wC, ${inputDepthNearestVec4}, d2),\n getW(wF, wR, wC, ${inputDepthNearestVec4} + 1, d2),\n getW(wF, wR, wC, ${inputDepthNearestVec4} + 2, d2)\n );\n dotProd += dot(xValues, wValues);\n }\n }\n }\n }\n setOutput(dotProd);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n import {backend_util, util} from '@tensorflow/tfjs-core';\n\n import {GPGPUProgram, useShapeUniforms} from './gpgpu_math';\n\n export class Conv2DPackedProgram implements GPGPUProgram {\n variableNames = ['x', 'W'];\n packedInputs = true;\n packedOutput = true;\n outputShape: number[];\n userCode: string;\n enableShapeUniforms: boolean;\n customUniforms = [\n {name: 'pads', type: 'ivec2' as const },\n {name: 'strides', type: 'ivec2' as const },\n {name: 'dilations', type: 'ivec2' as const },\n {name: 'inDims', type: 'ivec2' as const },\n ];\n\n constructor(\n convInfo: backend_util.Conv2DInfo, addBias = false,\n activation: string = null, hasPreluActivation = false,\n hasLeakyReluAlpha = false) {\n this.outputShape = convInfo.outShape;\n this.enableShapeUniforms = useShapeUniforms(this.outputShape.length);\n const padLeft = convInfo.padInfo.left;\n const strideWidth = convInfo.strideWidth;\n const dilationWidth = convInfo.dilationWidth;\n const filterHeight = convInfo.filterHeight;\n const filterWidth = convInfo.filterWidth;\n const texelsAcross = filterWidth;\n\n let mainLoop = `\n int xR; int xC; int xCOffset;\n vec4 wTexel; vec4 previous; vec4 final;`;\n\n for (let c = 0; c < filterWidth; c++) {\n mainLoop += `\n vec4 xTexelC${c * 2};\n int xTexelC${c * 2}Ready;\n vec4 xTexelC${c * 2 + 1};\n int xTexelC${c * 2 + 1}Ready;\n vec4 xC${c};`;\n }\n\n /**\n * This vectorized implementation works by gathering the values needed for\n * each output channel's dot product into vec4's and then multiplying them\n * all together (this happens in the final double for-loop below). Most of\n * the main loop consists of constructing these vec4's with the minimum\n * number of texture2D calls, which means making use of all four returned\n * values from a texture2D call at once.\n */\n mainLoop += `\n for (int r = 0; r < ${filterHeight}; r++) {\n for (int d1 = 0; d1 < ${convInfo.inChannels}; d1 += 2) {\n `;\n for (let c = 0; c < filterWidth; c++) {\n mainLoop += `\n xTexelC${c * 2} = vec4(0.0);\n xTexelC${c * 2}Ready = 0;\n xTexelC${c * 2 + 1} = vec4(0.0);\n xTexelC${c * 2 + 1}Ready = 0;\n xC${c} = vec4(0.0);`;\n }\n mainLoop += `\n xR = xRCorner + r * dilations[0];\n if (xR >=0 && xR < inDims[0]) {\n `;\n\n for (let texelC = 0; texelC < (texelsAcross + 1) / 2; texelC++) {\n const colIndex = texelC * 2;\n\n mainLoop += `\n xC = xCCorner + ${colIndex * dilationWidth};\n `;\n\n if (strideWidth === 1) {\n if (colIndex < filterWidth) {\n // If padding is odd, the outer texels have to be composed.\n if (padLeft % 2 === 1) {\n // TODO: Ensure vec4 previous does not result in redundant sample,\n // and avoid setting xTexelRC's that exceed the boundary in the\n // first place rather than resetting them to vec4(0)).\n\n // To compute xCOffset:\n // - If padding is odd, we must add 1 to ensure we ask for an\n // even-numbered row.\n // - We subtract 2 to access the previous texel.\n\n mainLoop += `\n xCOffset = xC + 1;\n if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${\n colIndex}Ready == 0) {\n xTexelC${colIndex} = getX(batch, xR, xCOffset, d1);\n\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${colIndex}.zw = vec2(0.0);\n }\n xTexelC${colIndex}Ready = 1;\n }\n `;\n // This texel has been read in previous iteration if the dilation\n // is 1.\n if (dilationWidth === 1 && colIndex > 0) {\n mainLoop += `\n xC${colIndex} = vec4(xTexelC${colIndex - 2}.zw, xTexelC${\n colIndex}.xy);\n `;\n } else {\n mainLoop += `\n xCOffset = xC + 1 - 2;\n\n if (xCOffset >= 0 && xCOffset < inDims[1]) {\n previous = getX(batch, xR, xCOffset, d1);\n\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n previous.zw = vec2(0.0);\n }\n\n xC${colIndex} = vec4(previous.zw, xTexelC${colIndex}.xy);\n } else {\n xC${colIndex} = vec4(0.0, 0.0, xTexelC${colIndex}.xy);\n }\n `;\n }\n } else {\n // Padding is even, so xRC corresponds to a single texel.\n mainLoop += `\n if (xC >= 0 && xC < inDims[1] && xTexelC${colIndex}Ready == 0) {\n xTexelC${colIndex} = getX(batch, xR, xC, d1);\n if (xC + 1 >= inDims[1]) {\n xTexelC${colIndex}.zw = vec2(0.0);\n }\n xTexelC${colIndex}Ready = 1;\n }\n\n xC${colIndex} = xTexelC${colIndex};\n `;\n }\n\n if (colIndex + 1 < filterWidth) {\n // If dilation is even, the second entry should match the first\n // (either both are composed or both are single samples). But if\n // dilation is odd, then the second entry should be the opposite\n // of the first (if the first is composed, the second is a single\n // sample, and vice versa.)\n\n const nextTexelOffset = padLeft % 2 === 0 ?\n util.nearestLargerEven(dilationWidth) :\n dilationWidth;\n\n if ((dilationWidth % 2 === 0 && padLeft % 2 === 1) ||\n (dilationWidth % 2 !== 0 && padLeft % 2 !== 1)) {\n mainLoop += `\n xCOffset = xC + imod(pads[1], 2) + ${nextTexelOffset};\n\n if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${\n colIndex + 1}Ready == 0) {\n xTexelC${colIndex + 1} = getX(batch, xR, xCOffset, d1);\n\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${colIndex + 1}.zw = vec2(0.0);\n }\n xTexelC${colIndex + 1}Ready = 1;\n }\n `;\n\n // If dilation > 1 then the xRC's will not be able to share any\n // values, so each xRC will require two unique calls to getX.\n if (dilationWidth > 1) {\n mainLoop += `\n xCOffset -= 2;\n if (xCOffset >= 0 && xCOffset < inDims[1]) {\n previous = getX(batch, xR, xCOffset, d1);\n xC${colIndex + 1} = vec4(previous.zw, xTexelC${\n colIndex + 1}.xy);\n } else {\n xC${colIndex + 1} = vec4(0.0, 0.0, xTexelC${\n colIndex + 1}.xy);\n }\n `;\n } else {\n mainLoop += `\n xC${colIndex + 1} = vec4(xTexelC${colIndex}.zw, xTexelC${\n colIndex + 1}.xy);\n `;\n }\n\n } else {\n // If dilation is 1 and padding is odd, we have already read the\n // texel when constructing the previous x value. Here we can\n // simply skip the texture read.\n if (nextTexelOffset === 1) {\n mainLoop += `\n xC${colIndex + 1} = xTexelC${colIndex};\n `;\n } else {\n mainLoop += `\n xCOffset = xC + ${nextTexelOffset};\n\n if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${\n colIndex + 1}Ready == 0) {\n xTexelC${colIndex + 1} = getX(batch, xR, xCOffset, d1);\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${colIndex + 1}.zw = vec2(0.0);\n }\n xTexelC${colIndex + 1}Ready = 1;\n }\n\n xC${colIndex + 1} = xTexelC${colIndex + 1};\n `;\n }\n }\n }\n }\n } else { // stride === 2\n if (colIndex < filterWidth) {\n // Depending on whether padLeft is even or odd, we want either the\n // xy or zw channels from X texels for xC${colIndex}. If padLeft is\n // even, xC${colIndex +1} is simply the zw channels of texels we've\n // already sampled. But if padLeft is odd, xC{$c + 1}.zw will\n // need to come from the xy channels of a new texel, hence the `\n // vec4\n // final` initialized below.\n if (padLeft % 2 === 1) {\n mainLoop += `\n xCOffset = xC + 1 - strides[1];\n if(xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${\n colIndex}Ready == 0) {\n xTexelC${colIndex} = getX(batch, xR, xCOffset, d1);\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${colIndex}.zw = vec2(0.0);\n }\n xTexelC${colIndex}Ready = 1;\n }\n\n if(xC + 1 >= 0 && xC + 1 < inDims[1] && xTexelC${\n colIndex + 1}Ready == 0) {\n xTexelC${colIndex + 1} = getX(batch, xR, xC + 1, d1);\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xC + 2 >= inDims[1]) {\n xTexelC${colIndex + 1}.zw = vec2(0.0);\n }\n xTexelC${colIndex + 1}Ready = 1;\n }\n\n xC${colIndex} = vec4(xTexelC${colIndex}.zw, xTexelC${\n colIndex + 1}.zw);\n `;\n\n if (colIndex + 1 < filterWidth) {\n mainLoop += `\n final = vec4(0.0);\n xCOffset = xC + 1 + strides[1];\n if(xCOffset >= 0 && xCOffset < inDims[1]) {\n final = getX(batch, xR, xCOffset, d1);\n }\n xC${colIndex + 1} = vec4(xTexelC${colIndex + 1}.xy, final.xy);\n `;\n }\n } else {\n mainLoop += `\n if(xC >= 0 && xC < inDims[1] && xTexelC${colIndex}Ready == 0) {\n xTexelC${colIndex} = getX(batch, xR, xC, d1);\n if (xC + 1 >= inDims[1]) {\n xTexelC${colIndex}.zw = vec2(0.0);\n }\n xTexelC${colIndex}Ready = 1;\n }\n\n xCOffset = xC + strides[1];\n if(xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${\n colIndex + 1}Ready == 0) {\n xTexelC${colIndex + 1} = getX(batch, xR, xCOffset, d1);\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${colIndex + 1}.zw = vec2(0.);\n }\n xTexelC${colIndex + 1}Ready = 1;\n }\n\n xC${colIndex} = vec4(\n xTexelC${colIndex}.xy, xTexelC${colIndex + 1}.xy);\n `;\n\n if (colIndex + 1 < filterWidth) {\n mainLoop += `\n xC${colIndex + 1} = vec4(xTexelC${colIndex}.zw, xTexelC${\n colIndex + 1}.zw);\n `;\n }\n }\n }\n }\n\n // localize the dotProd accumulation within the loop, the theory is for\n // GPU with limited cache, accumulate sum across large amount of\n // veriables will cause lots of cache misses. (i.e. 5x5 filter will have\n // 50 variables)\n if (colIndex < filterWidth) {\n mainLoop += `\n wTexel = getW(r, ${colIndex}, d1, d2);\n dotProd += xC${colIndex}.xxzz * vec4(wTexel.xy, wTexel.xy);\n if(d1 + 1 < ${convInfo.inChannels}) {\n dotProd += xC${colIndex}.yyww * vec4(wTexel.zw, wTexel.zw);\n }\n `;\n\n if (colIndex + 1 < filterWidth) {\n mainLoop += `\n wTexel = getW(r, ${colIndex + 1}, d1, d2);\n dotProd += xC${colIndex + 1}.xxzz * vec4(wTexel.xy, wTexel.xy);\n if(d1 + 1 < ${convInfo.inChannels}) {\n dotProd += xC${colIndex + 1}.yyww * vec4(wTexel.zw, wTexel.zw);\n }\n `;\n }\n }\n }\n mainLoop += `\n }\n `;\n mainLoop += `\n }\n `;\n mainLoop += `\n }\n `;\n\n let activationSnippet = '', applyActivationSnippet = '';\n if (activation) {\n if (hasPreluActivation) {\n activationSnippet = `vec4 activation(vec4 a) {\n vec4 b = getPreluActivationWeightsAtOutCoords();\n ${activation}\n }`;\n } else if (hasLeakyReluAlpha) {\n activationSnippet = `vec4 activation(vec4 a) {\n vec4 b = getLeakyreluAlphaAtOutCoords();\n ${activation}\n }`;\n } else {\n activationSnippet = `vec4 activation(vec4 x) {\n ${activation}\n }`;\n }\n\n applyActivationSnippet = `result = activation(result);`;\n }\n\n const addBiasSnippet = addBias ? 'result += getBiasAtOutCoords();' : '';\n if (addBias) {\n this.variableNames.push('bias');\n }\n\n if (hasPreluActivation) {\n this.variableNames.push('preluActivationWeights');\n }\n if (hasLeakyReluAlpha) {\n this.variableNames.push('leakyreluAlpha');\n }\n\n this.userCode = `\n ${activationSnippet}\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords.x;\n ivec2 xRCCorner = coords.yz * strides - pads;\n int d2 = coords.w;\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n //intialize dotProd with a small epsilon seems to reduce GPU accuracy loss.\n vec4 dotProd = vec4(0.000000000000001);\n\n ${mainLoop}\n\n vec4 result = dotProd - vec4(0.000000000000001);\n ${addBiasSnippet}\n ${applyActivationSnippet}\n setOutput(result);\n }\n `;\n }\n }\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {getGlslDifferences} from './glsl_version';\nimport {GPGPUProgram, useShapeUniforms} from './gpgpu_math';\n\nexport class Im2ColPackedProgram implements GPGPUProgram {\n variableNames = ['A'];\n packedInputs = true;\n packedOutput = true;\n outputShape: number[];\n userCode: string;\n enableShapeUniforms: boolean;\n customUniforms = [\n {name: 'inputShape', type: 'ivec4' as const },\n {name: 'pad', type: 'ivec2' as const },\n {name: 'stride', type: 'ivec2' as const },\n {name: 'dilation', type: 'ivec2' as const },\n {name: 'inChannels', type: 'int' as const },\n {name: 'itemsPerBlockRow', type: 'int' as const },\n {name: 'outWidth', type: 'int' as const },\n ];\n\n constructor(outputShape: number[], convInfo: backend_util.Conv2DInfo) {\n this.outputShape = outputShape;\n this.enableShapeUniforms = useShapeUniforms(this.outputShape.length);\n const {dataFormat} = convInfo;\n const glsl = getGlslDifferences();\n const isChannelsLast = dataFormat === 'channelsLast';\n const rowDim = isChannelsLast ? 1 : 2;\n const colDim = isChannelsLast ? 2 : 3;\n\n const boundsCheckingSnippet = this.enableShapeUniforms ?\n 'if(blockIndex < outShape[2] && pos < outShape[1]) {' :\n `if(blockIndex < ${outputShape[2]} && pos < ${outputShape[1]}) {`;\n let unrolled = ``;\n\n for (let row = 0; row <= 1; row++) {\n for (let col = 0; col <= 1; col++) {\n unrolled += `\n blockIndex = rc.z + ${col};\n pos = rc.y + ${row};\n\n ${boundsCheckingSnippet}\n offsetY = int(blockIndex / outWidth) * stride[0] - pad[0];\n d0 = offsetY + dilation[0] * (pos / itemsPerBlockRow);\n\n if(d0 < inputShape[${rowDim}] && d0 >= 0) {\n // Use custom imod instead mod. On Intel GPU, mod may generate\n // unexpected value.\n // https://github.com/tensorflow/tfjs/issues/5447\n offsetX = imod(blockIndex, outWidth) * stride[1] - pad[1];\n d1 = offsetX + dilation[1] * (imod(pos, itemsPerBlockRow) /\n inChannels);\n\n if(d1 < inputShape[${colDim}] && d1 >= 0) {\n\n ch = imod(pos, inChannels);\n\n if (${isChannelsLast}) {\n innerDims = vec2(d1, ch);\n result[${row * 2 + col}] = getChannel(\n getA(rc.x, d0, int(innerDims.x),\n int(innerDims.y)), innerDims);\n } else {\n innerDims = vec2(d0, d1);\n result[${row * 2 + col}] = getChannel(\n getA(rc.x, ch, int(innerDims.x),\n int(innerDims.y)), innerDims);\n }\n }\n }\n }\n `;\n }\n }\n\n this.userCode = `\n void main() {\n ivec3 rc = getOutputCoords();\n\n vec4 result = vec4(0);\n\n int blockIndex, pos, offsetY, d0, offsetX, d1, ch;\n vec2 innerDims;\n\n ${unrolled}\n\n ${glsl.output} = result;\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, TensorInfo, util} from '@tensorflow/tfjs-core';\n\n// import {assertAndGetBroadcastShape} from\n// '../../../tfjs-core/src/ops/broadcast_util';\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {Im2ColPackedProgram} from '../im2col_packed_gpu';\nimport {mapActivationToShaderProgram} from '../kernel_utils/kernel_funcs_utils';\nimport {MatMulPackedProgram} from '../mulmat_packed_gpu';\nimport * as webgl_util from '../webgl_util';\n\nimport {batchMatMulImpl, MATMUL_SHARED_DIM_THRESHOLD} from './BatchMatMul_impl';\nimport {identity} from './Identity';\nimport {reshape} from './Reshape';\n\ntype Conv2DConfig = {\n x: TensorInfo,\n filter: TensorInfo,\n convInfo: backend_util.Conv2DInfo,\n backend: MathBackendWebGL,\n bias?: TensorInfo,\n preluActivationWeights?: TensorInfo,\n leakyreluAlpha?: number,\n activation?: backend_util.Activation\n};\n\n// Both conv2dByMatMul and conv2dWithIm2Row fuse height and width into one\n// dimension to compute batchMatMul, so bias and activation weights are also\n// supposed to fuse the two dimensions into one.\n//\n// This function computes the target shape for fusing height and width\n// dimensions. Returning null means the shape is already compatible.\n//\n// Even though the bias is not supposed to be a 3-D or a 4-D (including\n// batch) tensor and PReLU activiation weights is not supposed to be a 4-D\n// tensor, we still need to support them, because we haven't disabled\n// them for NHWC format.\n// https://github.com/tensorflow/tfjs/blob/b53bd47e880367ae57493f0ea628abaf08db2d5d/tfjs-core/src/ops/fused/conv2d.ts#L181-L196\nfunction getShapeForBatchMatMul(\n shape: number[], isChannelsLast: boolean): number[] {\n const length = shape.length;\n if (length >= 3) {\n return isChannelsLast ?\n [\n ...shape.slice(0, -3) /* batch */,\n shape[length - 3] * shape[length - 2] /* height * width */,\n shape[length - 1] /* channel */\n ] :\n [\n ...shape.slice(0, -3) /* batch */, shape[length - 3] /* channel */,\n shape[length - 2] * shape[length - 1] /* height * width */\n ];\n } else if (!isChannelsLast && length === 1 && shape[0] > 1) {\n return [shape[0], 1];\n } else {\n return null;\n }\n}\n\n// For 1x1 kernels that iterate through every point in the input, convolution\n// can be expressed as matrix multiplication (without need for memory\n// remapping).\nexport function conv2dByMatMul({\n x,\n filter,\n convInfo,\n backend,\n bias = null,\n preluActivationWeights = null,\n leakyreluAlpha = 0,\n activation = null\n}: Conv2DConfig) {\n // Reshapes conv2D input to 2D tensors, uses matMul and then reshape the\n // result from 2D to 4D.\n const xShape = x.shape;\n const xTexData = backend.texData.get(x.dataId);\n const sharedMatMulDim = convInfo.inChannels;\n const outerShapeX = xShape[0] * xShape[1] * xShape[2];\n const outerShapeFilter = convInfo.outChannels;\n const isChannelsLast = convInfo.dataFormat === 'channelsLast';\n const transposeA = false;\n const transposeB = false;\n\n let out: TensorInfo;\n const intermediates: TensorInfo[] = [];\n\n if (preluActivationWeights != null) {\n const targetShape =\n getShapeForBatchMatMul(preluActivationWeights.shape, isChannelsLast);\n if (targetShape != null) {\n preluActivationWeights = reshape({\n inputs: {x: preluActivationWeights},\n backend,\n attrs: {shape: targetShape}\n });\n intermediates.push(preluActivationWeights);\n }\n }\n\n if (bias != null) {\n const targetShape = getShapeForBatchMatMul(bias.shape, isChannelsLast);\n if (targetShape != null) {\n bias = reshape({inputs: {x: bias}, backend, attrs: {shape: targetShape}});\n intermediates.push(bias);\n }\n }\n\n // TODO: Once reduction ops are packed, batchMatMul will always be packed\n // and we can remove this condition.\n const batchMatMulWillBeUnpacked =\n (outerShapeX === 1 || outerShapeFilter === 1) &&\n sharedMatMulDim > MATMUL_SHARED_DIM_THRESHOLD;\n\n // The algorithm in the if condition assumes (1) the output will be packed,\n // (2) x is packed, (3) x isChannelsLast, (4) x's packed texture is already\n // on GPU, (5) col is odd, (6) the width, height and inChannels are the same\n // for xTexData.shape and xShape.\n const canOptimize = !batchMatMulWillBeUnpacked && xTexData.isPacked &&\n isChannelsLast && xTexData.texture != null && xShape[2] % 2 !== 0 &&\n util.arraysEqual(xTexData.shape.slice(-3), xShape.slice(-3));\n\n if (canOptimize) {\n // We avoid expensive packed 2x2 reshape by padding col count to next,\n // even number. When col is odd, the result of packed batchMatMul is\n // the same (has the same texture layout and and values in the texture) as\n // it is for next even col. We make the odd-cols tensor to look like\n // even-cols tensor before the operation and, after the batchMatMul,\n // fix the even-cols result to have odd number of cols.\n const targetShape = xShape[0] * xShape[1] * (xShape[2] + 1);\n const xReshaped: TensorInfo = {\n dataId: x.dataId,\n shape: [1, targetShape, convInfo.inChannels],\n dtype: x.dtype\n };\n // xTexData.shape gets referenced from GPGPUBinary.inShapeInfos.\n // Decrementing col count, after batchMatMul->...->compileProgram leads to\n // invalid col count within the reference in GPGPUBinary.inShapeInfos.\n // Alternative fix would be to provide a copy to GPGPUBinary.inShapeInfos\n // in compileProgram method, but that would affect compilation of all\n // programs - instead, provide a copy here, with even col count, before\n // calling batchMatMul->...->compileProgram and after that, the original\n // xTexData.shape is restored.\n const originalXTexDataShape = xTexData.shape;\n xTexData.shape = xTexData.shape.slice();\n xTexData.shape[xTexData.shape.length - 2]++;\n util.assert(\n webgl_util.isReshapeFree(xTexData.shape, xReshaped.shape),\n () => `packed reshape ${xTexData.shape} to ${\n xReshaped.shape} isn't free`);\n const filterReshaped = reshape({\n inputs: {x: filter},\n backend,\n attrs: {shape: [1, convInfo.inChannels, convInfo.outChannels]}\n });\n intermediates.push(filterReshaped);\n const pointwiseConv = batchMatMulImpl({\n a: xReshaped,\n b: filterReshaped,\n backend,\n transposeA,\n transposeB,\n bias,\n activation,\n preluActivationWeights,\n leakyreluAlpha\n });\n\n const pointwiseConvTexData = backend.texData.get(pointwiseConv.dataId);\n util.assert(\n pointwiseConvTexData.isPacked,\n () => 'batchMatMul result is expected to be packed');\n // Restore the input shape to original.\n xTexData.shape = originalXTexDataShape;\n // Set the output shape - there is no need for expensive reshape as data\n // layout is already correct.\n pointwiseConvTexData.shape = convInfo.outShape;\n\n out = identity({inputs: {x: pointwiseConv}, backend});\n out.shape = convInfo.outShape;\n\n intermediates.push(pointwiseConv);\n } else {\n const numCols = convInfo.outHeight * convInfo.outWidth;\n const xReshaped = reshape({\n inputs: {x},\n backend,\n attrs: {\n shape: isChannelsLast ?\n [convInfo.batchSize, numCols, convInfo.inChannels] :\n [convInfo.batchSize, convInfo.inChannels, numCols]\n }\n });\n const filterReshaped = reshape({\n inputs: {x: filter},\n backend,\n attrs: {shape: [1, convInfo.inChannels, convInfo.outChannels]}\n });\n const result = batchMatMulImpl({\n a: isChannelsLast ? xReshaped : filterReshaped,\n b: isChannelsLast ? filterReshaped : xReshaped,\n transposeA: !isChannelsLast,\n transposeB,\n backend,\n bias,\n activation,\n preluActivationWeights,\n leakyreluAlpha\n });\n\n out = reshape(\n {inputs: {x: result}, backend, attrs: {shape: convInfo.outShape}});\n\n intermediates.push(xReshaped);\n intermediates.push(filterReshaped);\n intermediates.push(result);\n }\n\n for (const i of intermediates) {\n backend.disposeIntermediateTensorInfo(i);\n }\n\n return out;\n}\n\n// Implements the im2row algorithm as outlined in \"High Performance\n// Convolutional Neural Networks for Document Processing\" (Suvisoft, 2006)\nexport function conv2dWithIm2Row({\n x,\n filter,\n convInfo,\n backend,\n bias = null,\n preluActivationWeights = null,\n leakyreluAlpha = 0,\n activation = null\n}: Conv2DConfig) {\n // Rearranges conv2d input so each block to be convolved over forms the\n // column of a new matrix with shape [filterWidth * filterHeight *\n // inChannels, outHeight * outWidth]. The filter is also rearranged so each\n // output channel forms a row of a new matrix with shape [outChannels,\n // filterWidth * filterHeight * inChannels]. The convolution is then\n // computed by multiplying these matrices and reshaping the result.\n const {\n filterWidth,\n filterHeight,\n inChannels,\n outWidth,\n outHeight,\n dataFormat\n } = convInfo;\n\n const isChannelsLast = dataFormat === 'channelsLast';\n\n const sharedDim = filterWidth * filterHeight * inChannels;\n const numCols = outHeight * outWidth;\n const x2ColShape = [convInfo.batchSize, sharedDim, numCols];\n const transposeA = true;\n const transposeB = false;\n\n const intermediates: TensorInfo[] = [];\n\n if (preluActivationWeights != null) {\n const targetShape =\n getShapeForBatchMatMul(preluActivationWeights.shape, isChannelsLast);\n if (targetShape != null) {\n preluActivationWeights = reshape({\n inputs: {x: preluActivationWeights},\n backend,\n attrs: {shape: targetShape}\n });\n intermediates.push(preluActivationWeights);\n }\n }\n\n if (bias != null) {\n const targetShape = getShapeForBatchMatMul(bias.shape, isChannelsLast);\n if (targetShape != null) {\n bias = reshape({inputs: {x: bias}, backend, attrs: {shape: targetShape}});\n intermediates.push(bias);\n }\n }\n\n const w2Row = reshape({\n inputs: {x: filter},\n backend,\n attrs: {shape: [1, sharedDim, util.sizeFromShape(filter.shape) / sharedDim]}\n });\n intermediates.push(w2Row);\n\n const im2ColProgram = new Im2ColPackedProgram(x2ColShape, convInfo);\n const customValues = [\n x.shape, [convInfo.padInfo.top, convInfo.padInfo.left],\n [convInfo.strideHeight, convInfo.strideWidth],\n [convInfo.dilationHeight, convInfo.dilationWidth], [convInfo.inChannels],\n [convInfo.filterWidth * convInfo.inChannels], [convInfo.outWidth]\n ];\n const im2Col =\n backend.runWebGLProgram(im2ColProgram, [x], 'float32', customValues);\n const im2ColReshaped =\n reshape({inputs: {x: im2Col}, backend, attrs: {shape: x2ColShape}});\n\n intermediates.push(im2Col);\n intermediates.push(im2ColReshaped);\n\n const hasBias = bias != null;\n const hasPreluActivationWeights = preluActivationWeights != null;\n const hasLeakyreluAlpha = activation === 'leakyrelu';\n const fusedActivation =\n activation ? mapActivationToShaderProgram(activation, true) : null;\n const matmulProgram = new MatMulPackedProgram(\n isChannelsLast ? im2ColReshaped.shape as [number, number, number] :\n w2Row.shape as [number, number, number],\n isChannelsLast ? w2Row.shape as [number, number, number] :\n im2ColReshaped.shape as [number, number, number],\n isChannelsLast ? [convInfo.batchSize, numCols, convInfo.outChannels] :\n [convInfo.batchSize, convInfo.outChannels, numCols],\n transposeA, transposeB, hasBias, fusedActivation,\n hasPreluActivationWeights, hasLeakyreluAlpha);\n const inputs: TensorInfo[] =\n isChannelsLast ? [im2ColReshaped, w2Row] : [w2Row, im2ColReshaped];\n if (bias) {\n inputs.push(bias);\n }\n if (hasPreluActivationWeights) {\n inputs.push(preluActivationWeights);\n }\n if (hasLeakyreluAlpha) {\n const $leakyreluAlpha = backend.makeTensorInfo(\n [], 'float32',\n util.createScalarValue(leakyreluAlpha as {} as 'float32', 'float32'));\n inputs.push($leakyreluAlpha);\n intermediates.push($leakyreluAlpha);\n }\n const product = backend.runWebGLProgram(matmulProgram, inputs, 'float32');\n const out = reshape(\n {inputs: {x: product}, backend, attrs: {shape: convInfo.outShape}});\n\n intermediates.push(product);\n for (const i of intermediates) {\n backend.disposeIntermediateTensorInfo(i);\n }\n\n return out;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, Conv2D, Conv2DAttrs, Conv2DInputs, env, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {Conv2DProgram} from '../conv_gpu';\nimport {Conv2DPackedProgram} from '../conv_packed_gpu';\nimport {conv2dByMatMul, conv2dWithIm2Row} from './Conv2D_impl';\nimport {reshape} from './Reshape';\n\nexport function conv2d(\n args:\n {inputs: Conv2DInputs, attrs: Conv2DAttrs, backend: MathBackendWebGL}) {\n const {inputs, backend, attrs} = args;\n const {x, filter} = inputs;\n const {strides, pad, dataFormat, dilations, dimRoundingMode} = attrs;\n\n const $dataFormat = backend_util.convertConv2DDataFormat(dataFormat);\n const convInfo = backend_util.computeConv2DInfo(\n x.shape as [number, number, number, number],\n filter.shape as [number, number, number, number], strides, dilations, pad,\n dimRoundingMode, false /* depthwise */, $dataFormat);\n let out: TensorInfo;\n\n if (convInfo.filterHeight === 1 && convInfo.filterWidth === 1 &&\n convInfo.dilationHeight === 1 && convInfo.dilationWidth === 1 &&\n convInfo.strideHeight === 1 && convInfo.strideWidth === 1 &&\n (convInfo.padInfo.type === 'SAME' || convInfo.padInfo.type === 'VALID')) {\n out = conv2dByMatMul({x, filter, convInfo, backend});\n } else if (convInfo.strideWidth <= 2 && $dataFormat === 'channelsLast'\n && env().getBool('WEBGL_EXP_CONV')\n ) {\n const program = new Conv2DPackedProgram(convInfo);\n const customValues = [\n [convInfo.padInfo.top, convInfo.padInfo.left],\n [convInfo.strideHeight, convInfo.strideWidth],\n [convInfo.dilationHeight, convInfo.dilationWidth],\n [convInfo.inHeight, convInfo.inWidth]\n ];\n out =\n backend.runWebGLProgram(program, [x, filter], 'float32', customValues);\n } else if (env().getBool('WEBGL_CONV_IM2COL')) {\n out = conv2dWithIm2Row({x, filter, convInfo, backend});\n } else {\n const program = new Conv2DProgram(convInfo);\n out = backend.runWebGLProgram(program, [x, filter], 'float32');\n }\n\n const outReshaped =\n reshape({inputs: {x: out}, backend, attrs: {shape: convInfo.outShape}});\n backend.disposeIntermediateTensorInfo(out);\n\n return outReshaped;\n}\n\nexport const conv2DConfig: KernelConfig = {\n kernelName: Conv2D,\n backendName: 'webgl',\n kernelFunc: conv2d as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class Conv2DDerFilterProgram implements GPGPUProgram {\n variableNames = ['x', 'dy'];\n outputShape: number[];\n userCode: string;\n\n constructor(convInfo: backend_util.Conv2DInfo) {\n this.outputShape = convInfo.filterShape;\n\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n const padTop = convInfo.padInfo.top;\n const padLeft = convInfo.padInfo.left;\n const isChannelsLast = convInfo.dataFormat === 'channelsLast';\n\n this.userCode = `\n void main() {\n ivec4 coords = getOutputCoords();\n int wR = coords.x;\n int wC = coords.y;\n int d1 = coords.z;\n int d2 = coords.w;\n\n // Convolve x(?, ?, d1) with dy(:, :, d2) to get dw(wR, wC, d1, d2).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n\n for (int b = 0; b < ${convInfo.batchSize}; b++) {\n for (int yR = 0; yR < ${convInfo.outHeight}; yR++) {\n int xR = wR + yR * ${strideHeight} - ${padTop};\n\n if (xR < 0 || xR >= ${convInfo.inHeight}) {\n continue;\n }\n\n for (int yC = 0; yC < ${convInfo.outWidth}; yC++) {\n int xC = wC + yC * ${strideWidth} - ${padLeft};\n\n if (xC < 0 || xC >= ${convInfo.inWidth}) {\n continue;\n }\n\n if (${isChannelsLast}) {\n float dyValue = getDy(b, yR, yC, d2);\n float xValue = getX(b, xR, xC, d1);\n dotProd += (xValue * dyValue);\n } else {\n float dyValue = getDy(b, d2, yR, yC);\n float xValue = getX(b, d1, xR, xC);\n dotProd += (xValue * dyValue);\n }\n\n }\n }\n }\n setOutput(dotProd);\n }\n `;\n }\n}\n\nexport class Conv2DDerInputProgram implements GPGPUProgram {\n variableNames = ['dy', 'W'];\n outputShape: number[];\n userCode: string;\n\n constructor(convInfo: backend_util.Conv2DInfo) {\n this.outputShape = convInfo.inShape;\n\n const filterHeight = convInfo.filterHeight;\n const filterWidth = convInfo.filterWidth;\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n const isChannelsLast = convInfo.dataFormat === 'channelsLast';\n\n const padTop = filterHeight - 1 - convInfo.padInfo.top;\n const padLeft = filterWidth - 1 - convInfo.padInfo.left;\n\n const rowDim = isChannelsLast ? 1 : 2;\n const colDim = isChannelsLast ? 2 : 3;\n const channelDim = isChannelsLast ? 3 : 1;\n\n this.userCode = `\n const ivec2 pads = ivec2(${padTop}, ${padLeft});\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d1 = coords[${channelDim}];\n\n ivec2 dyCorner = ivec2(coords[${rowDim}], coords[${colDim}]) - pads;\n int dyRCorner = dyCorner.x;\n int dyCCorner = dyCorner.y;\n\n // Convolve dy(?, ?, d2) with w(:, :, d1, d2) to compute dx(xR, xC, d1).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < ${filterHeight}; wR++) {\n float dyR = float(dyRCorner + wR) / ${strideHeight}.0;\n\n if (dyR < 0.0 || dyR >= ${convInfo.outHeight}.0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = ${filterHeight} - 1 - wR;\n\n for (int wC = 0; wC < ${filterWidth}; wC++) {\n float dyC = float(dyCCorner + wC) / ${strideWidth}.0;\n\n if (dyC < 0.0 || dyC >= ${convInfo.outWidth}.0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n int wCPerm = ${filterWidth} - 1 - wC;\n\n for (int d2 = 0; d2 < ${convInfo.outChannels}; d2++) {\n\n if (${isChannelsLast}) {\n float xValue = getDy(batch, idyR, idyC, d2);\n float wValue = getW(wRPerm, wCPerm, d1, d2);\n dotProd += xValue * wValue;\n } else {\n float xValue = getDy(batch, d2, idyR, idyC);\n float wValue = getW(wRPerm, wCPerm, d1, d2);\n dotProd += xValue * wValue;\n }\n\n }\n }\n }\n setOutput(dotProd);\n }\n `;\n }\n}\n\nexport class Conv3DDerFilterProgram implements GPGPUProgram {\n variableNames = ['x', 'dy'];\n outputShape: number[];\n userCode: string;\n\n constructor(convInfo: backend_util.Conv3DInfo) {\n this.outputShape = convInfo.filterShape;\n\n const strideDepth = convInfo.strideDepth;\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n const padFront = convInfo.padInfo.front;\n const padTop = convInfo.padInfo.top;\n const padLeft = convInfo.padInfo.left;\n\n this.userCode = `\n void main() {\n ivec5 coords = getOutputCoords();\n int wF = coords.x;\n int wR = coords.y;\n int wC = coords.z;\n int d1 = coords.w;\n int d2 = coords.u;\n\n float dotProd = 0.0;\n\n for (int b = 0; b < ${convInfo.batchSize}; b++) {\n for (int yF = 0; yF < ${convInfo.outDepth}; yF++) {\n int xF = wF + yF * ${strideDepth} - ${padFront};\n\n if (xF < 0 || xF >= ${convInfo.inDepth}) {\n continue;\n }\n\n for (int yR = 0; yR < ${convInfo.outHeight}; yR++) {\n int xR = wR + yR * ${strideHeight} - ${padTop};\n\n if (xR < 0 || xR >= ${convInfo.inHeight}) {\n continue;\n }\n\n for (int yC = 0; yC < ${convInfo.outWidth}; yC++) {\n int xC = wC + yC * ${strideWidth} - ${padLeft};\n\n if (xC < 0 || xC >= ${convInfo.inWidth}) {\n continue;\n }\n\n float dyValue = getDy(b, yF, yR, yC, d2);\n float xValue = getX(b, xF, xR, xC, d1);\n dotProd += (xValue * dyValue);\n }\n }\n }\n }\n setOutput(dotProd);\n }\n `;\n }\n}\n\nexport class Conv3DDerInputProgram implements GPGPUProgram {\n variableNames = ['dy', 'W'];\n outputShape: number[];\n userCode: string;\n\n constructor(convInfo: backend_util.Conv3DInfo) {\n this.outputShape = convInfo.inShape;\n\n const filterDepth = convInfo.filterDepth;\n const filterHeight = convInfo.filterHeight;\n const filterWidth = convInfo.filterWidth;\n const strideDepth = convInfo.strideDepth;\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n\n const padFront = filterDepth - 1 - convInfo.padInfo.front;\n const padTop = filterHeight - 1 - convInfo.padInfo.top;\n const padLeft = filterWidth - 1 - convInfo.padInfo.left;\n\n this.userCode = `\n const ivec3 pads = ivec3(${padFront}, ${padTop}, ${padLeft});\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int d1 = coords.u;\n\n\n ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;\n int dyFCorner = dyCorner.x;\n int dyRCorner = dyCorner.y;\n int dyCCorner = dyCorner.z;\n\n float dotProd = 0.0;\n for (int wF = 0; wF < ${filterDepth}; wF++) {\n float dyF = float(dyFCorner + wF) / ${strideDepth}.0;\n\n if (dyF < 0.0 || dyF >= ${convInfo.outDepth}.0 || fract(dyF) > 0.0) {\n continue;\n }\n int idyF = int(dyF);\n\n int wFPerm = ${filterDepth} - 1 - wF;\n\n for (int wR = 0; wR < ${filterHeight}; wR++) {\n float dyR = float(dyRCorner + wR) / ${strideHeight}.0;\n\n if (dyR < 0.0 || dyR >= ${convInfo.outHeight}.0 ||\n fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = ${filterHeight} - 1 - wR;\n\n for (int wC = 0; wC < ${filterWidth}; wC++) {\n float dyC = float(dyCCorner + wC) / ${strideWidth}.0;\n\n if (dyC < 0.0 || dyC >= ${convInfo.outWidth}.0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n int wCPerm = ${filterWidth} - 1 - wC;\n\n for (int d2 = 0; d2 < ${convInfo.outChannels}; d2++) {\n float xValue = getDy(batch, idyF, idyR, idyC, d2);\n float wValue = getW(wFPerm, wRPerm, wCPerm, d1, d2);\n dotProd += xValue * wValue;\n }\n }\n }\n }\n setOutput(dotProd);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, Conv2DBackpropFilter, Conv2DBackpropFilterAttrs, Conv2DBackpropFilterInputs, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {Conv2DDerFilterProgram} from '../conv_backprop_gpu';\n\nexport function conv2DBackpropFilter(args: {\n inputs: Conv2DBackpropFilterInputs,\n attrs: Conv2DBackpropFilterAttrs,\n backend: MathBackendWebGL\n}) {\n const {inputs, backend, attrs} = args;\n const {x, dy} = inputs;\n const {strides, pad, dataFormat, dimRoundingMode, filterShape} = attrs;\n\n const $dataFormat = backend_util.convertConv2DDataFormat(dataFormat);\n const convInfo = backend_util.computeConv2DInfo(\n x.shape as [number, number, number, number], filterShape, strides,\n 1 /* dilations */, pad, dimRoundingMode, false /* depthwise */,\n $dataFormat);\n\n const program = new Conv2DDerFilterProgram(convInfo);\n return backend.runWebGLProgram(program, [x, dy], 'float32');\n}\n\nexport const conv2DBackpropFilterConfig: KernelConfig = {\n kernelName: Conv2DBackpropFilter,\n backendName: 'webgl',\n kernelFunc: conv2DBackpropFilter as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, Conv2DBackpropInput, Conv2DBackpropInputAttrs, Conv2DBackpropInputInputs, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {Conv2DDerInputProgram} from '../conv_backprop_gpu';\n\nexport function conv2DBackpropInput(args: {\n inputs: Conv2DBackpropInputInputs,\n attrs: Conv2DBackpropInputAttrs,\n backend: MathBackendWebGL\n}) {\n const {inputs, backend, attrs} = args;\n const {dy, filter} = inputs;\n const {inputShape, strides, pad, dataFormat, dimRoundingMode} = attrs;\n\n const $dataFormat = backend_util.convertConv2DDataFormat(dataFormat);\n const convInfo = backend_util.computeConv2DInfo(\n inputShape, filter.shape as [number, number, number, number], strides,\n 1 /* dilations */, pad, dimRoundingMode, false, $dataFormat);\n\n const program = new Conv2DDerInputProgram(convInfo);\n return backend.runWebGLProgram(program, [dy, filter], 'float32');\n}\n\nexport const conv2DBackpropInputConfig: KernelConfig = {\n kernelName: Conv2DBackpropInput,\n backendName: 'webgl',\n kernelFunc: conv2DBackpropInput as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, Conv3D, Conv3DAttrs, Conv3DInputs, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {Conv3DProgram} from '../conv_gpu';\n\nexport function conv3D(\n args:\n {inputs: Conv3DInputs, attrs: Conv3DAttrs, backend: MathBackendWebGL}) {\n const {inputs, backend, attrs} = args;\n const {x, filter} = inputs;\n const {strides, pad, dilations} = attrs;\n\n const convInfo = backend_util.computeConv3DInfo(\n x.shape as [number, number, number, number, number],\n filter.shape as [number, number, number, number, number], strides,\n dilations, pad);\n\n const program = new Conv3DProgram(convInfo);\n return backend.runWebGLProgram(program, [x, filter], 'float32');\n}\n\nexport const conv3DConfig: KernelConfig = {\n kernelName: Conv3D,\n backendName: 'webgl',\n kernelFunc: conv3D as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, Conv3DBackpropFilterV2, Conv3DBackpropFilterV2Attrs, Conv3DBackpropFilterV2Inputs, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {Conv3DDerFilterProgram} from '../conv_backprop_gpu';\n\nexport function conv3DBackpropFilterV2(args: {\n inputs: Conv3DBackpropFilterV2Inputs,\n attrs: Conv3DBackpropFilterV2Attrs,\n backend: MathBackendWebGL\n}) {\n const {inputs, backend, attrs} = args;\n const {x, dy} = inputs;\n const {strides, pad, filterShape} = attrs;\n\n const convInfo = backend_util.computeConv3DInfo(\n x.shape as [number, number, number, number, number], filterShape, strides,\n 1 /* dilations */, pad);\n\n const program = new Conv3DDerFilterProgram(convInfo);\n return backend.runWebGLProgram(program, [x, dy], 'float32');\n}\n\nexport const conv3DBackpropFilterV2Config: KernelConfig = {\n kernelName: Conv3DBackpropFilterV2,\n backendName: 'webgl',\n kernelFunc: conv3DBackpropFilterV2 as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, Conv3DBackpropInputV2, Conv3DBackpropInputV2Attrs, Conv3DBackpropInputV2Inputs, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {Conv3DDerInputProgram} from '../conv_backprop_gpu';\n\nexport function conv3DBackpropInput(args: {\n inputs: Conv3DBackpropInputV2Inputs,\n attrs: Conv3DBackpropInputV2Attrs,\n backend: MathBackendWebGL\n}) {\n const {inputs, backend, attrs} = args;\n const {dy, filter} = inputs;\n const {pad, strides, inputShape} = attrs;\n\n const convInfo = backend_util.computeConv3DInfo(\n inputShape, filter.shape as [number, number, number, number, number],\n strides, 1 /* dilations */, pad);\n\n const program = new Conv3DDerInputProgram(convInfo);\n return backend.runWebGLProgram(program, [dy, filter], 'float32');\n}\n\nexport const conv3DBackpropInputConfig: KernelConfig = {\n kernelName: Conv3DBackpropInputV2,\n backendName: 'webgl',\n kernelFunc: conv3DBackpropInput as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Cos, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {CHECK_NAN_SNIPPET_UNARY, unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst COS = CHECK_NAN_SNIPPET_UNARY + `\n return cos(x);\n`;\n\nexport const cos = unaryKernelFunc({opSnippet: COS});\n\nexport const cosConfig: KernelConfig = {\n kernelName: Cos,\n backendName: 'webgl',\n kernelFunc: cos,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Cosh, KernelConfig} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst COSH = `\n float e2x = exp(-x);\n return (e2x + 1.0 / e2x) / 2.0;\n`;\n\nexport const cosh = unaryKernelFunc({opSnippet: COSH});\n\nexport const coshConfig: KernelConfig = {\n kernelName: Cosh,\n backendName: 'webgl',\n kernelFunc: cosh,\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class CropAndResizeProgram implements GPGPUProgram {\n variableNames = ['Image', 'Boxes', 'BoxInd'];\n outputShape: number[] = [];\n userCode: string;\n\n constructor(\n imageShape: [number, number, number, number], boxShape: [number, number],\n cropSize: [number, number], method: 'bilinear'|'nearest',\n extrapolationValue: number) {\n const [batch, imageHeight, imageWidth, depth] = imageShape;\n const [numBoxes, ] = boxShape;\n const [cropHeight, cropWidth] = cropSize;\n this.outputShape = [numBoxes, cropHeight, cropWidth, depth];\n const methodId = method === 'bilinear' ? 1 : 0;\n\n const [inputHeightFloat, inputWidthFloat] =\n [`${imageHeight - 1}.0`, `${imageWidth - 1}.0`];\n\n const [heightRatio, heightScale, inY] = cropHeight > 1 ?\n [\n `${(imageHeight - 1) / (cropHeight - 1)}`,\n '(y2-y1) * height_ratio',\n `y1*${inputHeightFloat} + float(y)*(height_scale)`,\n ] :\n [\n '0.0',\n '0.0',\n `0.5 * (y1+y2) * ${inputHeightFloat}`,\n ];\n const [widthRatio, widthScale, inX] = cropWidth > 1 ?\n [\n `${(imageWidth - 1) / (cropWidth - 1)}`,\n '(x2-x1) * width_ratio',\n `x1*${inputWidthFloat} + float(x)*(width_scale)`,\n ] :\n [\n '0.0',\n '0.0',\n `0.5 * (x1+x2) * ${inputWidthFloat}`,\n ];\n\n // Reference implementation\n // tslint:disable-next-line:max-line-length\n // https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/kernels/crop_and_resize_op_gpu.cu.cc\n this.userCode = `\n const float height_ratio = float(${heightRatio});\n const float width_ratio = float(${widthRatio});\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int y = coords[1];\n int x = coords[2];\n int d = coords[3];\n\n // get box vals\n float y1 = getBoxes(b,0);\n float x1 = getBoxes(b,1);\n float y2 = getBoxes(b,2);\n float x2 = getBoxes(b,3);\n\n // get image in batch index\n int bInd = round(getBoxInd(b));\n if(bInd < 0 || bInd >= ${batch}) {\n return;\n }\n\n float height_scale = ${heightScale};\n float width_scale = ${widthScale};\n\n float in_y = ${inY};\n if( in_y < 0.0 || in_y > ${inputHeightFloat} ) {\n setOutput(float(${extrapolationValue}));\n return;\n }\n float in_x = ${inX};\n if( in_x < 0.0 || in_x > ${inputWidthFloat} ) {\n setOutput(float(${extrapolationValue}));\n return;\n }\n\n vec2 sourceFracIndexCR = vec2(in_x,in_y);\n if(${methodId} == 1) {\n // Compute the four integer indices.\n ivec2 sourceFloorCR = ivec2(sourceFracIndexCR);\n ivec2 sourceCeilCR = ivec2(ceil(sourceFracIndexCR));\n\n float topLeft = getImage(b, sourceFloorCR.y, sourceFloorCR.x, d);\n float bottomLeft = getImage(b, sourceCeilCR.y, sourceFloorCR.x, d);\n float topRight = getImage(b, sourceFloorCR.y, sourceCeilCR.x, d);\n float bottomRight = getImage(b, sourceCeilCR.y, sourceCeilCR.x, d);\n\n vec2 fracCR = sourceFracIndexCR - vec2(sourceFloorCR);\n\n float top = topLeft + (topRight - topLeft) * fracCR.x;\n float bottom = bottomLeft + (bottomRight - bottomLeft) * fracCR.x;\n float newValue = top + (bottom - top) * fracCR.y;\n setOutput(newValue);\n } else {\n // Compute the coordinators of nearest neighbor point.\n ivec2 sourceNearestCR = ivec2(floor(\n sourceFracIndexCR + vec2(0.5,0.5)));\n float newValue = getImage(b, sourceNearestCR.y, sourceNearestCR.x, d);\n setOutput(newValue);\n }\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {CropAndResize, CropAndResizeAttrs, CropAndResizeInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {CropAndResizeProgram} from '../crop_and_resize_gpu';\n\nexport const cropAndResize = (args: {\n inputs: CropAndResizeInputs,\n backend: MathBackendWebGL,\n attrs: CropAndResizeAttrs\n}): TensorInfo => {\n const {inputs, backend, attrs} = args;\n const {image, boxes, boxInd} = inputs;\n const {cropSize, method, extrapolationValue} = attrs;\n\n const program = new CropAndResizeProgram(\n image.shape as [number, number, number, number],\n boxes.shape as [number, number], cropSize, method, extrapolationValue);\n return backend.runWebGLProgram(program, [image, boxes, boxInd], 'float32');\n};\n\nexport const cropAndResizeConfig: KernelConfig = {\n kernelName: CropAndResize,\n backendName: 'webgl',\n kernelFunc: cropAndResize as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {GPGPUProgram} from './gpgpu_math';\nimport {getCoordsDataType, UniformType} from './shader_compiler';\n\nexport enum CumOpType {\n Prod = '*',\n Sum = '+',\n}\n\nexport class CumProgram implements GPGPUProgram {\n variableNames = ['x'];\n userCode: string;\n customUniforms = [{name: 'index', type: 'float' as UniformType}];\n\n constructor(\n public op: CumOpType, public outputShape: number[], exclusive: boolean,\n reverse: boolean) {\n const rank = this.outputShape.length;\n const initVal = this.op === CumOpType.Prod ? '1.0' : '0.0';\n const val =\n exclusive ? initVal : `getX(${getCoords(rank, 'coords', this.op)})`;\n const length = this.outputShape[this.outputShape.length - 1];\n let condition = '';\n let idxString = '';\n // When exclusive is set, the cum op becomes roll op that copies the\n // value from the previous index based on the direction specified by the\n // reverse flag.\n if (exclusive) {\n condition = reverse ? `end != ${length - 1}` : 'end != 0';\n idxString = reverse ? 'end + 1' : 'end - 1';\n } else {\n condition = reverse ? `end + pow2 < ${length}` : 'end >= pow2';\n idxString = (reverse ? 'end + pow2' : 'end - pow2');\n }\n\n this.userCode = `\n void main() {\n ${getCoordsDataType(rank)} coords = getOutputCoords();\n int end = ${getFinalCoord(rank, 'coords', this.op)};\n float val = ${val};\n int pow2 = int(pow(2.0, index));\n if (${condition}) {\n int idx = ${idxString};\n ${getFinalCoord(rank, 'coords', this.op)} = idx;\n val ${this.op}= getX(${getCoords(rank, 'coords', this.op)});\n }\n setOutput(val);\n }\n `;\n }\n}\n\nfunction getCoords(rank: number, name: string, op: CumOpType): string {\n if (rank === 1) {\n return `${name}`;\n } else if (rank === 2) {\n return `${name}.x, ${name}.y`;\n } else if (rank === 3) {\n return `${name}.x, ${name}.y, ${name}.z`;\n } else if (rank === 4) {\n return `${name}.x, ${name}.y, ${name}.z, ${name}.w`;\n } else {\n throw new Error(`Cumulative ${op} for rank ${rank} is not yet supported`);\n }\n}\n\nfunction getFinalCoord(rank: number, name: string, op: CumOpType): string {\n if (rank === 1) {\n return `${name}`;\n } else if (rank === 2) {\n return `${name}.y`;\n } else if (rank === 3) {\n return `${name}.z`;\n } else if (rank === 4) {\n return `${name}.w`;\n } else {\n throw new Error(`Cumulative ${op} for rank ${rank} is not yet supported`);\n }\n}\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {CumOpType, CumProgram} from '../cum_gpu';\n\nimport {identity} from './Identity';\nimport {transpose} from './Transpose';\n\nexport function cumImpl(\n op: CumOpType, x: TensorInfo, backend: MathBackendWebGL, axis: number,\n exclusive: boolean, reverse: boolean): TensorInfo {\n const xRank = x.shape.length;\n const permutation = backend_util.getAxesPermutation([axis], xRank);\n let permutedX = x;\n if (permutation != null) {\n permutedX = transpose({inputs: {x}, backend, attrs: {perm: permutation}});\n }\n const permutedAxis = backend_util.getInnerMostAxes(1, xRank)[0];\n\n if (permutedAxis !== xRank - 1) {\n throw new Error(\n `WebGL cumprod shader expects an inner-most axis=${\n x.shape.length - 1} ` +\n `but got axis=${axis}`);\n }\n const size = permutedX.shape[permutedAxis];\n let result = identity({inputs: {x: permutedX}, backend});\n // Use cum parallel algorithm, inspired by:\n // https://developer.nvidia.com/gpugems/gpugems3/part-vi-gpu-computing/chapter-39-parallel-prefix-sum-scan-cuda\n // Note: although the algorithm is called sum, it works for any associtative\n // operator with an identity.\n\n for (let i = 0; i <= Math.ceil(Math.log2(size)) - 1; i++) {\n const program = new CumProgram(op, permutedX.shape, false, reverse);\n const customValues = [[i]];\n const prevResult = result;\n result =\n backend.runWebGLProgram(program, [result], result.dtype, customValues);\n backend.disposeIntermediateTensorInfo(prevResult);\n }\n // For exclusive cum, shift the end result in the direction of product or sum\n // and add 1 for product or 0 for sum to the front index.\n if (exclusive) {\n const program = new CumProgram(op, permutedX.shape, exclusive, reverse);\n const prevResult = result;\n result = backend.runWebGLProgram(program, [result], result.dtype);\n backend.disposeIntermediateTensorInfo(prevResult);\n }\n\n if (permutation != null) {\n const reversePermutation = backend_util.getUndoAxesPermutation(permutation);\n const reverseTransposedResult = transpose(\n {inputs: {x: result}, backend, attrs: {perm: reversePermutation}});\n\n backend.disposeIntermediateTensorInfo(result);\n backend.disposeIntermediateTensorInfo(permutedX);\n\n return reverseTransposedResult;\n }\n\n return result;\n}\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Cumprod, CumprodAttrs, CumprodInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {CumOpType} from '../cum_gpu';\nimport {cumImpl} from './Cum_impl';\n\nexport function cumprod(args: {\n inputs: CumprodInputs,\n backend: MathBackendWebGL,\n attrs: CumprodAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {axis, exclusive, reverse} = attrs;\n\n return cumImpl(CumOpType.Prod, x, backend, axis, exclusive, reverse);\n}\n\nexport const cumprodConfig: KernelConfig = {\n kernelName: Cumprod,\n backendName: 'webgl',\n kernelFunc: cumprod as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Cumsum, CumsumAttrs, CumsumInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {CumOpType} from '../cum_gpu';\nimport {cumImpl} from './Cum_impl';\n\nexport function cumsum(\n args:\n {inputs: CumsumInputs, backend: MathBackendWebGL, attrs: CumsumAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {axis, exclusive, reverse} = attrs;\n return cumImpl(CumOpType.Sum, x, backend, axis, exclusive, reverse);\n}\n\nexport const cumsumConfig: KernelConfig = {\n kernelName: Cumsum,\n backendName: 'webgl',\n kernelFunc: cumsum as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DenseBincount, DenseBincountAttrs, DenseBincountInputs, KernelConfig, KernelFunc, Rank, TensorInfo, TypedArray} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {bincountImplCPU, bincountReduceImplCPU} from '../kernel_utils/shared';\n\nexport function denseBincount(args: {\n inputs: DenseBincountInputs,\n backend: MathBackendWebGL,\n attrs: DenseBincountAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x, weights} = inputs;\n const {size, binaryOutput} = attrs;\n\n if (x.shape.length === 1) {\n const xVals = backend.readSync(x.dataId) as TypedArray;\n const weightsVals = backend.readSync(weights.dataId) as TypedArray;\n\n const outVals =\n bincountImplCPU(xVals, weightsVals, weights.dtype, weights.shape, size);\n\n return backend.makeTensorInfo([size], weights.dtype, outVals);\n } else if (x.shape.length === 2) {\n const xBuf = backend.bufferSync(x);\n const weightsBuf = backend.bufferSync(weights);\n\n const outBuf = bincountReduceImplCPU(xBuf, weightsBuf, size, binaryOutput);\n\n return backend.makeTensorInfo(outBuf.shape, weights.dtype, outBuf.values);\n }\n\n throw new Error(\n `Error in denseBincount: input must be at most rank 2, but got rank` +\n `${x.shape.length}.`);\n}\n\nexport const denseBincountConfig: KernelConfig = {\n kernelName: DenseBincount,\n backendName: 'webgl',\n kernelFunc: denseBincount as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class DepthToSpaceProgram implements GPGPUProgram {\n variableNames = ['x'];\n outputShape: number[] = [];\n userCode: string;\n blockSize: number;\n dataFormat: string;\n\n constructor(\n outputShape: number[], blockSize: number, dataFormat: 'NHWC'|'NCHW') {\n this.outputShape = outputShape;\n this.blockSize = blockSize;\n this.dataFormat = dataFormat;\n this.userCode = `\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int h = ${this.getHeightCoordString()};\n int w = ${this.getWidthCoordString()};\n int d = ${this.getDepthCoordString()};\n\n int in_h = h / ${blockSize};\n int offset_h = imod(h, ${blockSize});\n int in_w = w / ${blockSize};\n int offset_w = imod(w, ${blockSize});\n int offset_d = (offset_h * ${blockSize} + offset_w) *\n ${this.getOutputDepthSize()};\n int in_d = d + offset_d;\n\n float result = ${this.getInputSamplingString()};\n setOutput(result);\n }\n `;\n }\n\n private getHeightCoordString(): string {\n if (this.dataFormat === 'NHWC') {\n return `coords[1]`;\n } else {\n return `coords[2]`;\n }\n }\n\n private getWidthCoordString(): string {\n if (this.dataFormat === 'NHWC') {\n return `coords[2]`;\n } else {\n return `coords[3]`;\n }\n }\n\n private getDepthCoordString(): string {\n if (this.dataFormat === 'NHWC') {\n return `coords[3]`;\n } else {\n return `coords[1]`;\n }\n }\n\n private getOutputDepthSize(): number {\n if (this.dataFormat === 'NHWC') {\n return this.outputShape[3];\n } else {\n return this.outputShape[1];\n }\n }\n\n private getInputSamplingString(): string {\n if (this.dataFormat === 'NHWC') {\n return `getX(b, in_h, in_w, in_d)`;\n } else {\n return `getX(b, in_d, in_h, in_w)`;\n }\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DepthToSpace, DepthToSpaceAttrs, DepthToSpaceInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {DepthToSpaceProgram} from '../depth_to_space_gpu';\n\nexport function depthToSpace(args: {\n inputs: DepthToSpaceInputs,\n backend: MathBackendWebGL,\n attrs: DepthToSpaceAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {blockSize, dataFormat} = attrs;\n\n const batchSize = x.shape[0];\n const inputHeight = (dataFormat === 'NHWC') ? x.shape[1] : x.shape[2];\n const inputWidth = (dataFormat === 'NHWC') ? x.shape[2] : x.shape[3];\n const inputDepth = (dataFormat === 'NHWC') ? x.shape[3] : x.shape[1];\n\n const outputHeight = inputHeight * blockSize;\n const outputWidth = inputWidth * blockSize;\n const outputDepth = inputDepth / (blockSize * blockSize);\n\n const outputShape = (dataFormat === 'NHWC') ?\n [batchSize, outputHeight, outputWidth, outputDepth] :\n [batchSize, outputDepth, outputHeight, outputWidth];\n\n const program = new DepthToSpaceProgram(outputShape, blockSize, dataFormat);\n return backend.runWebGLProgram(program, [x], x.dtype);\n}\n\nexport const depthToSpaceConfig: KernelConfig = {\n kernelName: DepthToSpace,\n backendName: 'webgl',\n kernelFunc: depthToSpace as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {GPGPUProgram, useShapeUniforms} from './gpgpu_math';\n\nexport class DepthwiseConv2DProgram implements GPGPUProgram {\n variableNames = ['x', 'W'];\n outputShape: number[];\n userCode: string;\n enableShapeUniforms: boolean;\n customUniforms = [\n {name: 'pads', type: 'ivec2' as const },\n {name: 'strides', type: 'ivec2' as const },\n {name: 'dilations', type: 'ivec2' as const },\n {name: 'inDims', type: 'ivec2' as const },\n ];\n\n constructor(\n convInfo: backend_util.Conv2DInfo, addBias = false,\n activation: string = null, hasPreluActivation = false,\n hasLeakyReluAlpha = false) {\n this.outputShape = convInfo.outShape;\n this.enableShapeUniforms = useShapeUniforms(this.outputShape.length);\n\n const filterHeight = convInfo.filterHeight;\n const filterWidth = convInfo.filterWidth;\n const channelMul = convInfo.outChannels / convInfo.inChannels;\n\n let activationSnippet = '', applyActivationSnippet = '';\n if (activation) {\n if (hasPreluActivation) {\n activationSnippet = `float activation(float a) {\n float b = getPreluActivationWeightsAtOutCoords();\n ${activation}\n }`;\n } else if (hasLeakyReluAlpha) {\n activationSnippet = `float activation(float a) {\n float b = getLeakyreluAlphaAtOutCoords();\n ${activation}\n }`;\n } else {\n activationSnippet = `\n float activation(float x) {\n ${activation}\n }\n `;\n }\n\n applyActivationSnippet = `result = activation(result);`;\n }\n\n const addBiasSnippet = addBias ? 'result += getBiasAtOutCoords();' : '';\n if (addBias) {\n this.variableNames.push('bias');\n }\n\n if (hasPreluActivation) {\n this.variableNames.push('preluActivationWeights');\n }\n if (hasLeakyReluAlpha) {\n this.variableNames.push('leakyreluAlpha');\n }\n\n this.userCode = `\n ${activationSnippet}\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords.x;\n ivec2 xRCCorner = coords.yz * strides - pads;\n int d2 = coords.w;\n int d1 = d2 / ${channelMul};\n int q = d2 - d1 * ${channelMul};\n\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n // Convolve x(?, ?, d1) with w(:, :, d1, q) to get y(yR, yC, d2).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n // TO DO(dsmilkov): Flatten the two for loops and vec4 the operations.\n for (int wR = 0; wR < ${filterHeight}; wR++) {\n int xR = xRCorner + wR * dilations[0];\n\n if (xR < 0 || xR >= inDims[0]) {\n continue;\n }\n\n for (int wC = 0; wC < ${filterWidth}; wC++) {\n int xC = xCCorner + wC * dilations[1];\n\n if (xC < 0 || xC >= inDims[1]) {\n continue;\n }\n\n float xVal = getX(batch, xR, xC, d1);\n float wVal = getW(wR, wC, d1, q);\n dotProd += xVal * wVal;\n }\n }\n\n float result = dotProd;\n ${addBiasSnippet}\n ${applyActivationSnippet}\n setOutput(result);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, util} from '@tensorflow/tfjs-core';\n\nimport {GPGPUProgram, useShapeUniforms} from './gpgpu_math';\n\nexport class DepthwiseConvPacked2DProgram implements GPGPUProgram {\n variableNames = ['x', 'W'];\n packedInputs = true;\n packedOutput = true;\n outputShape: number[];\n userCode: string;\n enableShapeUniforms: boolean;\n customUniforms = [\n {name: 'pads', type: 'ivec2' as const },\n {name: 'strides', type: 'ivec2' as const },\n {name: 'dilations', type: 'ivec2' as const },\n {name: 'inDims', type: 'ivec2' as const },\n ];\n\n constructor(\n convInfo: backend_util.Conv2DInfo, addBias = false,\n activation: string = null, hasPreluActivation = false,\n hasLeakyReluAlpha = false) {\n this.outputShape = convInfo.outShape;\n this.enableShapeUniforms = useShapeUniforms(this.outputShape.length);\n const channelMul = convInfo.outChannels / convInfo.inChannels;\n const padLeft = convInfo.padInfo.left;\n const strideWidth = convInfo.strideWidth;\n const dilationWidth = convInfo.dilationWidth;\n const filterHeight = convInfo.filterHeight;\n const filterWidth = convInfo.filterWidth;\n const texelsAcross = filterWidth;\n\n let mainLoop = `\n int xR; int xC; int xCOffset;\n vec4 wTexel; vec4 previous; vec4 final;`;\n\n for (let c = 0; c < filterWidth; c++) {\n mainLoop += `\n vec4 xTexelC${c * 2};\n int xTexelC${c * 2}Ready;\n vec4 xTexelC${c * 2 + 1};\n int xTexelC${c * 2 + 1}Ready;\n vec4 xC${c};`;\n }\n\n /**\n * This vectorized implementation works by gathering the values needed for\n * each output channel's dot product into vec4's and then multiplying them\n * all together (this happens in the final double for-loop below). Most of\n * the main loop consists of constructing these vec4's with the minimum\n * number of texture2D calls, which means making use of all four returned\n * values from a texture2D call at once.\n */\n mainLoop += `\n for (int r = 0; r < ${filterHeight}; r++) {\n `;\n for (let c = 0; c < filterWidth; c++) {\n mainLoop += `\n xTexelC${c * 2} = vec4(0.0);\n xTexelC${c * 2}Ready = 0;\n xTexelC${c * 2 + 1} = vec4(0.0);\n xTexelC${c * 2 + 1}Ready = 0;\n xC${c} = vec4(0.0);`;\n }\n mainLoop += `\n xR = xRCorner + r * dilations[0];\n if (xR >=0 && xR < inDims[0]) {\n `;\n\n for (let texelC = 0; texelC < (texelsAcross + 1) / 2; texelC++) {\n const colIndex = texelC * 2;\n\n mainLoop += `\n xC = xCCorner + ${colIndex * dilationWidth};\n `;\n\n if (strideWidth === 1) {\n if (colIndex < filterWidth) {\n // If padding is odd, the outer texels have to be composed.\n if (padLeft % 2 === 1) {\n // TODO: Ensure vec4 previous does not result in redundant sample,\n // and avoid setting xTexelRC's that exceed the boundary in the\n // first place rather than resetting them to vec4(0)).\n\n // To compute xCOffset:\n // - If padding is odd, we must add 1 to ensure we ask for an\n // even-numbered row.\n // - We subtract 2 to access the previous texel.\n\n mainLoop += `\n xCOffset = xC + 1;\n if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${\n colIndex}Ready == 0) {\n xTexelC${colIndex} = getX(batch, xR, xCOffset, d1);\n\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${colIndex}.zw = vec2(0.0);\n }\n xTexelC${colIndex}Ready = 1;\n }\n `;\n // This texel has been read in previous iteration if the dilation\n // is 1.\n if (dilationWidth === 1 && colIndex > 0) {\n mainLoop += `\n xC${colIndex} = vec4(xTexelC${colIndex - 2}.zw, xTexelC${\n colIndex}.xy);\n `;\n } else {\n mainLoop += `\n xCOffset = xC + 1 - 2;\n\n if (xCOffset >= 0 && xCOffset < inDims[1]) {\n previous = getX(batch, xR, xCOffset, d1);\n\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n previous.zw = vec2(0.0);\n }\n\n xC${colIndex} = vec4(previous.zw, xTexelC${colIndex}.xy);\n } else {\n xC${colIndex} = vec4(0.0, 0.0, xTexelC${colIndex}.xy);\n }\n `;\n }\n } else {\n // Padding is even, so xRC corresponds to a single texel.\n mainLoop += `\n if (xC >= 0 && xC < inDims[1] && xTexelC${colIndex}Ready == 0) {\n xTexelC${colIndex} = getX(batch, xR, xC, d1);\n if (xC + 1 >= inDims[1]) {\n xTexelC${colIndex}.zw = vec2(0.0);\n }\n xTexelC${colIndex}Ready = 1;\n }\n\n xC${colIndex} = xTexelC${colIndex};\n `;\n }\n\n if (colIndex + 1 < filterWidth) {\n // If dilation is even, the second entry should match the first\n // (either both are composed or both are single samples). But if\n // dilation is odd, then the second entry should be the opposite\n // of the first (if the first is composed, the second is a single\n // sample, and vice versa.)\n\n const nextTexelOffset = padLeft % 2 === 0 ?\n util.nearestLargerEven(dilationWidth) :\n dilationWidth;\n\n if ((dilationWidth % 2 === 0 && padLeft % 2 === 1) ||\n (dilationWidth % 2 !== 0 && padLeft % 2 !== 1)) {\n mainLoop += `\n xCOffset = xC + imod(pads[1], 2) + ${nextTexelOffset};\n\n if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${\n colIndex + 1}Ready == 0) {\n xTexelC${colIndex + 1} = getX(batch, xR, xCOffset, d1);\n\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${colIndex + 1}.zw = vec2(0.0);\n }\n xTexelC${colIndex + 1}Ready = 1;\n }\n `;\n\n // If dilation > 1 then the xRC's will not be able to share any\n // values, so each xRC will require two unique calls to getX.\n if (dilationWidth > 1) {\n mainLoop += `\n xCOffset -= 2;\n if (xCOffset >= 0 && xCOffset < inDims[1]) {\n previous = getX(batch, xR, xCOffset, d1);\n xC${colIndex + 1} = vec4(previous.zw, xTexelC${\n colIndex + 1}.xy);\n } else {\n xC${colIndex + 1} = vec4(0.0, 0.0, xTexelC${\n colIndex + 1}.xy);\n }\n `;\n } else {\n mainLoop += `\n xC${colIndex + 1} = vec4(xTexelC${colIndex}.zw, xTexelC${\n colIndex + 1}.xy);\n `;\n }\n } else {\n // If dilation is 1 and padding is odd, we have already read the\n // texel when constructing the previous x value. Here we can\n // simply skip the texture read.\n if (nextTexelOffset === 1) {\n mainLoop += `\n xC${colIndex + 1} = xTexelC${colIndex};\n `;\n } else {\n mainLoop += `\n xCOffset = xC + ${nextTexelOffset};\n\n if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${\n colIndex + 1}Ready == 0) {\n xTexelC${colIndex + 1} = getX(batch, xR, xCOffset, d1);\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${colIndex + 1}.zw = vec2(0.0);\n }\n xTexelC${colIndex + 1}Ready = 1;\n }\n\n xC${colIndex + 1} = xTexelC${colIndex + 1};\n `;\n }\n }\n }\n }\n } else { // stride === 2\n if (colIndex < filterWidth) {\n // Depending on whether padLeft is even or odd, we want either the\n // xy or zw channels from X texels for xC${colIndex}. If padLeft is\n // even, xC${colIndex +1} is simply the zw channels of texels we've\n // already sampled. But if padLeft is odd, xC{$c + 1}.zw will\n // need to come from the xy channels of a new texel, hence the `\n // vec4\n // final` initialized below.\n if (padLeft % 2 === 1) {\n mainLoop += `\n xCOffset = xC + 1 - strides[1];\n if(xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${\n colIndex}Ready == 0) {\n xTexelC${colIndex} = getX(batch, xR, xCOffset, d1);\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${colIndex}.zw = vec2(0.0);\n }\n xTexelC${colIndex}Ready = 1;\n }\n\n if(xC + 1 >= 0 && xC + 1 < inDims[1] && xTexelC${\n colIndex + 1}Ready == 0) {\n xTexelC${colIndex + 1} = getX(batch, xR, xC + 1, d1);\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xC + 2 >= inDims[1]) {\n xTexelC${colIndex + 1}.zw = vec2(0.0);\n }\n xTexelC${colIndex + 1}Ready = 1;\n }\n\n xC${colIndex} = vec4(xTexelC${colIndex}.zw, xTexelC${\n colIndex + 1}.zw);\n `;\n\n if (colIndex + 1 < filterWidth) {\n mainLoop += `\n final = vec4(0.0);\n xCOffset = xC + 1 + strides[1];\n if(xCOffset >= 0 && xCOffset < inDims[1]) {\n final = getX(batch, xR, xCOffset, d1);\n }\n xC${colIndex + 1} = vec4(xTexelC${colIndex + 1}.xy, final.xy);\n `;\n }\n } else {\n mainLoop += `\n if(xC >= 0 && xC < inDims[1] && xTexelC${colIndex}Ready == 0) {\n xTexelC${colIndex} = getX(batch, xR, xC, d1);\n if (xC + 1 >= inDims[1]) {\n xTexelC${colIndex}.zw = vec2(0.0);\n }\n xTexelC${colIndex}Ready = 1;\n }\n\n xCOffset = xC + strides[1];\n if(xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${\n colIndex + 1}Ready == 0) {\n xTexelC${colIndex + 1} = getX(batch, xR, xCOffset, d1);\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${colIndex + 1}.zw = vec2(0.);\n }\n xTexelC${colIndex + 1}Ready = 1;\n }\n\n xC${colIndex} = vec4(\n xTexelC${colIndex}.xy, xTexelC${colIndex + 1}.xy);\n `;\n\n if (colIndex + 1 < filterWidth) {\n mainLoop += `\n xC${colIndex + 1} = vec4(xTexelC${colIndex}.zw, xTexelC${\n colIndex + 1}.zw);\n `;\n }\n }\n }\n }\n\n // localize the dotProd accumulation within the loop, the theory is for\n // GPU with limited cache, accumulate sum across large amount of\n // veriables will cause lots of cache misses. (i.e. 5x5 filter will have\n // 50 variables)\n if (colIndex < filterWidth) {\n mainLoop += `\n wTexel = getW(r, ${colIndex}, d1, q);\n dotProd += xC${colIndex} * vec4(wTexel.xz, wTexel.xz);\n `;\n\n if (colIndex + 1 < filterWidth) {\n mainLoop += `\n wTexel = getW(r, ${colIndex + 1}, d1, q);\n dotProd += xC${colIndex + 1} * vec4(wTexel.xz, wTexel.xz);\n `;\n }\n }\n }\n mainLoop += `\n }\n `;\n mainLoop += `\n }\n `;\n\n let activationSnippet = '', applyActivationSnippet = '';\n if (activation) {\n if (hasPreluActivation) {\n activationSnippet = `vec4 activation(vec4 a) {\n vec4 b = getPreluActivationWeightsAtOutCoords();\n ${activation}\n }`;\n } else if (hasLeakyReluAlpha) {\n activationSnippet = `vec4 activation(vec4 a) {\n vec4 b = getLeakyreluAlphaAtOutCoords();\n ${activation}\n }`;\n } else {\n activationSnippet = `vec4 activation(vec4 x) {\n ${activation}\n }`;\n }\n\n applyActivationSnippet = `result = activation(result);`;\n }\n\n const addBiasSnippet = addBias ? 'result += getBiasAtOutCoords();' : '';\n if (addBias) {\n this.variableNames.push('bias');\n }\n\n if (hasPreluActivation) {\n this.variableNames.push('preluActivationWeights');\n }\n if (hasLeakyReluAlpha) {\n this.variableNames.push('leakyreluAlpha');\n }\n\n this.userCode = `\n ${activationSnippet}\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords.x;\n ivec2 xRCCorner = coords.yz * strides - pads;\n int d2 = coords.w;\n int d1 = d2 / ${channelMul};\n int q = d2 - d1 * ${channelMul};\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n //intialize dotProd with a small epsilon seems to reduce GPU accuracy loss.\n vec4 dotProd = vec4(0.000000000000001);\n\n ${mainLoop}\n\n vec4 result = dotProd - vec4(0.000000000000001);\n ${addBiasSnippet}\n ${applyActivationSnippet}\n setOutput(result);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, DepthwiseConv2dNative, DepthwiseConv2dNativeAttrs, DepthwiseConv2dNativeInputs, env, KernelConfig, KernelFunc, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {DepthwiseConv2DProgram} from '../conv_gpu_depthwise';\nimport {DepthwiseConvPacked2DProgram} from '../conv_packed_gpu_depthwise';\n\nexport function depthwiseConv2dNative(args: {\n inputs: DepthwiseConv2dNativeInputs,\n attrs: DepthwiseConv2dNativeAttrs,\n backend: MathBackendWebGL\n}) {\n const {inputs, backend, attrs} = args;\n const {x, filter} = inputs;\n const {strides, pad, dilations, dimRoundingMode} = attrs;\n\n let $dilations = dilations;\n if ($dilations == null) {\n $dilations = [1, 1];\n }\n\n util.assert(\n backend_util.eitherStridesOrDilationsAreOne(strides, $dilations),\n () => 'Error in depthwiseConv2d: Either strides or dilations must be ' +\n `1. Got strides ${strides} and dilations '${$dilations}'`);\n\n const convInfo = backend_util.computeConv2DInfo(\n x.shape as [number, number, number, number],\n filter.shape as [number, number, number, number], strides, $dilations,\n pad, dimRoundingMode, true /* depthwise */);\n\n let program: DepthwiseConv2DProgram|DepthwiseConvPacked2DProgram;\n if (env().getBool('WEBGL_PACK_DEPTHWISECONV') && convInfo.strideWidth <= 2 &&\n convInfo.outChannels / convInfo.inChannels === 1) {\n program = new DepthwiseConvPacked2DProgram(convInfo);\n } else {\n program = new DepthwiseConv2DProgram(convInfo);\n }\n const customValues = [\n [convInfo.padInfo.top, convInfo.padInfo.left],\n [convInfo.strideHeight, convInfo.strideWidth],\n [convInfo.dilationHeight, convInfo.dilationWidth],\n [convInfo.inHeight, convInfo.inWidth]\n ];\n return backend.runWebGLProgram(program, [x, filter], 'float32', customValues);\n}\n\nexport const depthwiseConv2dNativeConfig: KernelConfig = {\n kernelName: DepthwiseConv2dNative,\n backendName: 'webgl',\n kernelFunc: depthwiseConv2dNative as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class DepthwiseConv2DDerFilterProgram implements GPGPUProgram {\n variableNames = ['x', 'dy'];\n outputShape: number[];\n userCode: string;\n\n constructor(convInfo: backend_util.Conv2DInfo) {\n this.outputShape = convInfo.filterShape;\n\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n const padTop = convInfo.padInfo.top;\n const padLeft = convInfo.padInfo.left;\n const channelMul = convInfo.outChannels / convInfo.inChannels;\n\n this.userCode = `\n void main() {\n ivec4 coords = getOutputCoords();\n int wR = coords.x;\n int wC = coords.y;\n int d1 = coords.z;\n int dm = coords.w;\n int d2 = d1 * ${channelMul} + dm;\n\n float dotProd = 0.0;\n\n // TO DO: Vec4 over the batch size\n for (int b = 0; b < ${convInfo.batchSize}; b++) {\n for (int yR = 0; yR < ${convInfo.outHeight}; yR++) {\n int xR = wR + yR * ${strideHeight} - ${padTop};\n\n if (xR < 0 || xR >= ${convInfo.inHeight}) {\n continue;\n }\n\n for (int yC = 0; yC < ${convInfo.outWidth}; yC++) {\n int xC = wC + yC * ${strideWidth} - ${padLeft};\n\n if (xC < 0 || xC >= ${convInfo.inWidth}) {\n continue;\n }\n\n float dyValue = getDy(b, yR, yC, d2);\n float xValue = getX(b, xR, xC, d1);\n dotProd += (xValue * dyValue);\n }\n }\n }\n setOutput(dotProd);\n }\n `;\n }\n}\n\nexport class DepthwiseConv2DDerInputProgram implements GPGPUProgram {\n variableNames = ['dy', 'W'];\n outputShape: number[];\n userCode: string;\n\n constructor(convInfo: backend_util.Conv2DInfo) {\n this.outputShape = convInfo.inShape;\n\n const filterHeight = convInfo.filterHeight;\n const filterWidth = convInfo.filterWidth;\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n\n const padTop = filterHeight - 1 - convInfo.padInfo.top;\n const padLeft = filterWidth - 1 - convInfo.padInfo.left;\n const channelMul = convInfo.outChannels / convInfo.inChannels;\n\n this.userCode = `\n const ivec2 pads = ivec2(${padTop}, ${padLeft});\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d1 = coords[3];\n ivec2 dyCorner = coords.yz - pads;\n int dyRCorner = dyCorner.x;\n int dyCCorner = dyCorner.y;\n\n float dotProd = 0.0;\n\n for (int wR = 0; wR < ${filterHeight}; wR++) {\n float dyR = float(dyRCorner + wR) / ${strideHeight}.0;\n\n if (dyR < 0.0 || dyR >= ${convInfo.outHeight}.0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = ${filterHeight} - 1 - wR;\n\n for (int wC = 0; wC < ${filterWidth}; wC++) {\n float dyC = float(dyCCorner + wC) / ${strideWidth}.0;\n\n if (dyC < 0.0 || dyC >= ${convInfo.outWidth}.0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n int wCPerm = ${filterWidth} - 1 - wC;\n\n // TO DO: Vec4 over the channelMul\n for (int dm = 0; dm < ${channelMul}; dm++) {\n int d2 = d1 * ${channelMul} + dm;\n float xValue = getDy(batch, idyR, idyC, d2);\n float wValue = getW(wRPerm, wCPerm, d1, dm);\n dotProd += xValue * wValue;\n }\n }\n }\n setOutput(dotProd);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, DepthwiseConv2dNativeBackpropFilter, DepthwiseConv2dNativeBackpropFilterAttrs, DepthwiseConv2dNativeBackpropFilterInputs, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {DepthwiseConv2DDerFilterProgram} from '../conv_backprop_gpu_depthwise';\n\nexport function depthwiseConv2dNativeBackpropFilter(args: {\n inputs: DepthwiseConv2dNativeBackpropFilterInputs,\n attrs: DepthwiseConv2dNativeBackpropFilterAttrs,\n backend: MathBackendWebGL\n}) {\n const {inputs, backend, attrs} = args;\n const {x, dy} = inputs;\n const {strides, dilations, pad, dimRoundingMode, filterShape} = attrs;\n\n const convInfo = backend_util.computeConv2DInfo(\n x.shape as [number, number, number, number], filterShape, strides,\n dilations, pad, dimRoundingMode, true /* depthwise */);\n\n const program = new DepthwiseConv2DDerFilterProgram(convInfo);\n return backend.runWebGLProgram(program, [x, dy], 'float32');\n}\n\nexport const depthwiseConv2dNativeBackpropFilterConfig: KernelConfig = {\n kernelName: DepthwiseConv2dNativeBackpropFilter,\n backendName: 'webgl',\n kernelFunc: depthwiseConv2dNativeBackpropFilter as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, DepthwiseConv2dNativeBackpropInput, DepthwiseConv2dNativeBackpropInputAttrs, DepthwiseConv2dNativeBackpropInputInputs, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {DepthwiseConv2DDerInputProgram} from '../conv_backprop_gpu_depthwise';\n\nexport function depthwiseConv2dNativeBackpropInput(args: {\n inputs: DepthwiseConv2dNativeBackpropInputInputs,\n attrs: DepthwiseConv2dNativeBackpropInputAttrs,\n backend: MathBackendWebGL\n}) {\n const {inputs, backend, attrs} = args;\n const {dy, filter} = inputs;\n const {strides, dilations, pad, dimRoundingMode, inputShape} = attrs;\n\n const convInfo = backend_util.computeConv2DInfo(\n inputShape, filter.shape as [number, number, number, number], strides,\n dilations, pad, dimRoundingMode, true /* depthwise */);\n\n const program = new DepthwiseConv2DDerInputProgram(convInfo);\n return backend.runWebGLProgram(program, [dy, filter], 'float32');\n}\n\nexport const depthwiseConv2dNativeBackpropInputConfig: KernelConfig = {\n kernelName: DepthwiseConv2dNativeBackpropInput,\n backendName: 'webgl',\n kernelFunc: depthwiseConv2dNativeBackpropInput as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class DiagProgram implements GPGPUProgram {\n variableNames = ['X'];\n outputShape: number[];\n userCode: string;\n\n constructor(size: number) {\n this.outputShape = [size, size];\n this.userCode = `\n void main() {\n ivec2 coords = getOutputCoords();\n float val = coords[0] == coords[1] ? getX(coords[0]) : 0.0;\n setOutput(val);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Diag, DiagInputs, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {DiagProgram} from '../diag_gpu';\nimport {reshape} from './Reshape';\n\nexport function diag(args: {inputs: DiagInputs, backend: MathBackendWebGL}):\n TensorInfo {\n const {inputs, backend} = args;\n const {x} = inputs;\n\n const outShape = [...x.shape, ...x.shape];\n const xSize = util.sizeFromShape(x.shape);\n\n const flat = reshape({inputs: {x}, backend, attrs: {shape: [xSize]}});\n\n const program = new DiagProgram(xSize);\n const res = backend.runWebGLProgram(program, [flat], flat.dtype);\n\n const out = reshape({inputs: {x: res}, backend, attrs: {shape: outShape}});\n\n backend.disposeIntermediateTensorInfo(flat);\n backend.disposeIntermediateTensorInfo(res);\n\n return out;\n}\n\nexport const diagConfig: KernelConfig = {\n kernelName: Diag,\n backendName: 'webgl',\n kernelFunc: diag as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class Dilation2DProgram implements GPGPUProgram {\n variableNames = ['x', 'W'];\n outputShape: number[];\n userCode: string;\n\n constructor(convInfo: backend_util.Conv2DInfo) {\n this.outputShape = convInfo.outShape;\n\n const {\n inHeight,\n inWidth,\n padInfo,\n strideHeight,\n strideWidth,\n filterHeight,\n filterWidth,\n dilationHeight,\n dilationWidth\n } = convInfo;\n\n const {top: padTop, left: padLeft} = padInfo;\n\n this.userCode = `\n const ivec2 strides = ivec2(${strideHeight}, ${strideWidth});\n const ivec2 pads = ivec2(${padTop}, ${padLeft});\n const float neg_infinity = -3.4e38;\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords.x;\n int d1 = coords.w;\n ivec2 outTopLeftCorner =\n coords.yz * strides - pads;\n int hBeg = outTopLeftCorner.x;\n int wBeg = outTopLeftCorner.y;\n\n float curVal = neg_infinity;\n for (int h = 0; h < ${filterHeight}; h++) {\n int hIn = hBeg + h * ${dilationHeight};\n\n if (hIn >= 0 && hIn < ${inHeight}) {\n for (int w = 0; w < ${filterWidth}; w++) {\n int wIn = wBeg + w * ${dilationWidth};\n\n if (wIn >= 0 && wIn < ${inWidth}) {\n float xVal = getX(batch, hIn, wIn, d1);\n float wVal = getW(h, w, d1);\n\n float val = xVal + wVal;\n if (val > curVal) {\n curVal = val;\n }\n }\n }\n }\n }\n\n float result = curVal;\n setOutput(result);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, Dilation2D, Dilation2DAttrs, Dilation2DInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {Dilation2DProgram} from '../dilation_gpu';\nimport {reshape} from './Reshape';\n\nexport function dilation2D(args: {\n inputs: Dilation2DInputs,\n attrs: Dilation2DAttrs,\n backend: MathBackendWebGL\n}) {\n const {inputs, backend, attrs} = args;\n const {x, filter} = inputs;\n const {strides, pad, dilations} = attrs;\n\n const convInfo = backend_util.computeDilation2DInfo(\n x.shape as [number, number, number, number],\n filter.shape as [number, number, number], strides, pad,\n 'NHWC' /* dataFormat */, dilations);\n let out: TensorInfo;\n\n const program = new Dilation2DProgram(convInfo);\n out = backend.runWebGLProgram(program, [x, filter], 'float32');\n\n const outReshaped =\n reshape({inputs: {x: out}, backend, attrs: {shape: convInfo.outShape}});\n backend.disposeIntermediateTensorInfo(out);\n\n return outReshaped;\n}\n\nexport const dilation2DConfig: KernelConfig = {\n kernelName: Dilation2D,\n backendName: 'webgl',\n kernelFunc: dilation2D as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, Einsum, EinsumAttrs, EinsumInputs, KernelConfig, KernelFunc, Tensor, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\n\nimport {multiply} from './Multiply';\nimport {reshape} from './Reshape';\nimport {sum} from './Sum';\nimport {transpose} from './Transpose';\n\nexport function einsum(\n args:\n {inputs: EinsumInputs, backend: MathBackendWebGL, attrs: EinsumAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {equation} = attrs;\n const tensors = inputs as Tensor[];\n\n const {allDims, summedDims, idDims} =\n backend_util.decodeEinsumEquation(equation, tensors.length);\n backend_util.checkEinsumDimSizes(allDims.length, idDims, tensors);\n const {path, steps} = backend_util.getEinsumComputePath(summedDims, idDims);\n\n const nSteps = steps.length;\n let out: TensorInfo|null = null;\n let numDimsRemaining = allDims.length;\n const tensorsToDispose: TensorInfo[] = [];\n for (let i = 0; i < nSteps; ++i) {\n for (const idTerm of steps[i]) {\n const {permutationIndices: perm, expandDims: dimsToExpand} =\n backend_util.getEinsumPermutation(numDimsRemaining, idDims[idTerm]);\n let x: TensorInfo;\n if (backend_util.isIdentityPermutation(perm)) {\n x = tensors[idTerm];\n } else {\n x = transpose({inputs: {x: tensors[idTerm]}, backend, attrs: {perm}});\n tensorsToDispose.push(x);\n }\n const targetShape: number[] = x.shape.slice();\n for (let k = 0; k < dimsToExpand.length; ++k) {\n targetShape.splice(dimsToExpand[k], 0, 1);\n }\n\n if (!util.arraysEqual(x.shape, targetShape)) {\n x = reshape({inputs: {x}, backend, attrs: {shape: targetShape}});\n tensorsToDispose.push(x);\n }\n if (out === null) {\n out = x;\n } else {\n // tslint:disable-next-line: no-unnecessary-type-assertion\n out = multiply({inputs: {a: x, b: out}, backend}) as TensorInfo;\n tensorsToDispose.push(out);\n }\n }\n if (i < nSteps - 1) {\n if (path[i] >= 0) {\n out = sum({\n inputs: {x: out},\n backend,\n attrs: {\n axis: path[i] - (allDims.length - numDimsRemaining),\n keepDims: false\n }\n });\n tensorsToDispose.push(out);\n }\n numDimsRemaining--;\n }\n }\n\n // Clean up intermediate tensors.\n for (const tensorInfo of tensorsToDispose) {\n if (tensorInfo === out) {\n continue;\n }\n backend.disposeIntermediateTensorInfo(tensorInfo);\n }\n\n return out;\n}\n\nexport const einsumConfig: KernelConfig = {\n kernelName: Einsum,\n backendName: 'webgl',\n kernelFunc: einsum as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Elu, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst ELU = `return (x >= 0.0) ? x : (exp(x) - 1.0);`;\n\nconst ELU_PACKED = `\n vec4 result;\n\n result.r = (x.r >= 0.0) ? x.r : (exp(x.r) - 1.0);\n result.g = (x.g >= 0.0) ? x.g : (exp(x.g) - 1.0);\n result.b = (x.b >= 0.0) ? x.b : (exp(x.b) - 1.0);\n result.a = (x.a >= 0.0) ? x.a : (exp(x.a) - 1.0);\n\n return result;\n`;\n\nconst elu = unaryKernelFunc({opSnippet: ELU, packedOpSnippet: ELU_PACKED});\n\nexport const eluConfig: KernelConfig = {\n kernelName: Elu,\n backendName: 'webgl',\n kernelFunc: elu as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {EluGrad, EluGradInputs, env, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {BinaryOpProgram} from '../binaryop_gpu';\nimport {BinaryOpPackedProgram} from '../binaryop_packed_gpu';\n\nconst ELU_DER = `return (b >= 1.0) ? a : a * (b + 1.0);`;\nconst ELU_DER_PACKED = `\n vec4 bGTEZero = vec4(greaterThanEqual(b, vec4(0.)));\n return (bGTEZero * a) + ((vec4(1.0) - bGTEZero) * (a * (b + vec4(1.0))));\n`;\n\nexport const eluGrad =\n (args: {inputs: EluGradInputs, backend: MathBackendWebGL}): TensorInfo => {\n const {inputs, backend} = args;\n const {dy, y} = inputs;\n\n const program = env().getBool('WEBGL_PACK_BINARY_OPERATIONS') ?\n new BinaryOpPackedProgram(ELU_DER_PACKED, dy.shape, y.shape) :\n new BinaryOpProgram(ELU_DER, dy.shape, y.shape);\n return backend.runWebGLProgram(program, [dy, y], dy.dtype);\n };\n\nexport const eluGradConfig: KernelConfig = {\n kernelName: EluGrad,\n backendName: 'webgl',\n kernelFunc: eluGrad as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Equal, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {equalImplCPU} from '../kernel_utils/shared';\nconst PACKED_EQUAL = `\n return vec4(equal(a, b));\n`;\n\nconst EQUAL = `return float(a == b);`;\n\nexport const equal = binaryKernelFunc({\n opSnippet: EQUAL,\n packedOpSnippet: PACKED_EQUAL,\n dtype: 'bool',\n cpuKernelImpl: equalImplCPU,\n});\n\nexport const equalConfig: KernelConfig = {\n kernelName: Equal,\n backendName: 'webgl',\n kernelFunc: equal as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, Erf, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst ERF = `\n // Error function is calculated approximately with elementary function.\n // See \"Handbook of Mathematical Functions with Formulas,\n // Graphs, and Mathematical Tables\", Abramowitz and Stegun.\n float p = ${backend_util.ERF_P};\n float a1 = ${backend_util.ERF_A1};\n float a2 = ${backend_util.ERF_A2};\n float a3 = ${backend_util.ERF_A3};\n float a4 = ${backend_util.ERF_A4};\n float a5 = ${backend_util.ERF_A5};\n\n float sign = sign(x);\n x = abs(x);\n float t = 1.0 / (1.0 + p * x);\n return sign * (1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*exp(-x*x));\n`;\n\nexport const erf = unaryKernelFunc({opSnippet: ERF});\n\nexport const erfConfig: KernelConfig = {\n kernelName: Erf,\n backendName: 'webgl',\n kernelFunc: erf,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Exp, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {CHECK_NAN_SNIPPET_UNARY, unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {expImplCPU} from '../kernel_utils/shared';\n\nexport const EXP = CHECK_NAN_SNIPPET_UNARY + `\n return exp(x);\n`;\n\nconst EXP_PACKED = `\n vec4 result = exp(x);\n bvec4 isNaN = isnan(x);\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n`;\n\nexport const exp = unaryKernelFunc({\n opSnippet: EXP,\n packedOpSnippet: EXP_PACKED,\n cpuKernelImpl: expImplCPU,\n dtype: 'float32',\n});\n\nexport const expConfig: KernelConfig = {\n kernelName: Exp,\n backendName: 'webgl',\n kernelFunc: exp as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the License);\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an AS IS BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ExpandDims, ExpandDimsAttrs, ExpandDimsInputs, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {reshape} from './Reshape';\n\nexport function expandDims(args: {\n inputs: ExpandDimsInputs,\n attrs: ExpandDimsAttrs,\n backend: MathBackendWebGL\n}): TensorInfo {\n const {inputs, attrs, backend} = args;\n const {dim} = attrs;\n const {input} = inputs;\n\n const inputRank = input.shape.length;\n const newShape = input.shape.slice();\n let $dim = dim;\n if (dim < 0) {\n // Negative value is counted from the tail of rank.\n util.assert(\n -(inputRank + 1) <= dim,\n () => `Axis must be in the interval [${- (inputRank + 1)}, ${\n inputRank}]`);\n $dim = inputRank + dim + 1;\n }\n newShape.splice($dim, 0, 1);\n\n return reshape({inputs: {x: input}, backend, attrs: {shape: newShape}});\n}\n\nexport const expandDimsConfig: KernelConfig = {\n kernelName: ExpandDims,\n backendName: 'webgl',\n kernelFunc: expandDims as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Expm1, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {expm1ImplCPU} from '../kernel_utils/shared';\n\nconst EXPM1 = `return exp(x) - 1.0;`;\n\nexport const expm1 = unaryKernelFunc(\n {opSnippet: EXPM1, packedOpSnippet: EXPM1, cpuKernelImpl: expm1ImplCPU});\n\nexport const expm1Config: KernelConfig = {\n kernelName: Expm1,\n backendName: 'webgl',\n kernelFunc: expm1 as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class FFTProgram implements GPGPUProgram {\n variableNames = ['real', 'imag'];\n outputShape: number[];\n userCode: string;\n\n constructor(\n component: 'real'|'imag', inputShape: [number, number],\n inverse: boolean) {\n const innerDim = inputShape[1];\n this.outputShape = inputShape;\n\n const exponentMultiplierSnippet =\n inverse ? `2.0 * ${Math.PI}` : `-2.0 * ${Math.PI}`;\n const resultDenominator = inverse ? `${innerDim}.0` : '1.0';\n\n let opString: string;\n if (component === 'real') {\n opString = 'return real * expR - imag * expI;';\n } else if (component === 'imag') {\n opString = 'return real * expI + imag * expR;';\n } else {\n throw new Error(\n `FFT component must be either \"real\" or \"imag\", got ${component}.`);\n }\n\n this.userCode = `\n const float exponentMultiplier = ${exponentMultiplierSnippet};\n\n float unaryOpComplex(float real, float expR, float imag, float expI) {\n ${opString}\n }\n\n float mulMatDFT(int batch, int index) {\n float indexRatio = float(index) / float(${innerDim});\n float exponentMultiplierTimesIndexRatio =\n exponentMultiplier * indexRatio;\n\n float result = 0.0;\n\n for (int i = 0; i < ${innerDim}; i++) {\n // x = (-2|2 * PI / N) * index * i;\n float x = exponentMultiplierTimesIndexRatio * float(i);\n float expR = cos(x);\n float expI = sin(x);\n float real = getReal(batch, i);\n float imag = getImag(batch, i);\n\n result +=\n unaryOpComplex(real, expR, imag, expI) / ${resultDenominator};\n }\n\n return result;\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n setOutput(mulMatDFT(coords[0], coords[1]));\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {FFTProgram} from '../fft_gpu';\n\nimport {complex} from './Complex';\nimport {reshape} from './Reshape';\n\nexport function fftImpl(\n x: TensorInfo, inverse: boolean, backend: MathBackendWebGL): TensorInfo {\n const xData = backend.texData.get(x.dataId);\n\n const inputSize = util.sizeFromShape(x.shape);\n // Collapse all outer dimensions to a single batch dimension.\n const innerDimensionSize = x.shape[x.shape.length - 1];\n const batch = inputSize / innerDimensionSize;\n\n const input2D = reshape(\n {inputs: {x}, backend, attrs: {shape: [batch, innerDimensionSize]}});\n\n const xShape = input2D.shape as [number, number];\n const realProgram = new FFTProgram('real', xShape, inverse);\n const imagProgram = new FFTProgram('imag', xShape, inverse);\n\n const inputs = [\n {\n dataId: xData.complexTensorInfos.real.dataId,\n dtype: xData.complexTensorInfos.real.dtype,\n shape: xShape\n },\n {\n dataId: xData.complexTensorInfos.imag.dataId,\n dtype: xData.complexTensorInfos.imag.dtype,\n shape: xShape\n }\n ];\n\n const realPart = backend.runWebGLProgram(realProgram, inputs, 'float32');\n const imagPart = backend.runWebGLProgram(imagProgram, inputs, 'float32');\n\n const complexOutput =\n complex({inputs: {real: realPart, imag: imagPart}, backend});\n\n backend.disposeIntermediateTensorInfo(realPart);\n backend.disposeIntermediateTensorInfo(imagPart);\n\n const complexOutputReshaped =\n reshape({inputs: {x: complexOutput}, backend, attrs: {shape: x.shape}});\n\n backend.disposeIntermediateTensorInfo(input2D);\n backend.disposeIntermediateTensorInfo(complexOutput);\n return complexOutputReshaped;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {FFT, FFTInputs, KernelConfig, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\n\nimport {fftImpl} from './FFT_impl';\n\nexport function fft(args: {inputs: FFTInputs, backend: MathBackendWebGL}):\n TensorInfo {\n const {inputs, backend} = args;\n const {input} = inputs;\n\n return fftImpl(input, false /* inverse */, backend);\n}\n\nexport const fftConfig: KernelConfig = {\n kernelName: FFT,\n backendName: 'webgl',\n kernelFunc: fft\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {UniformType} from './shader_compiler';\n\nexport class FillProgram implements GPGPUProgram {\n variableNames: string[];\n outputShape: number[] = [];\n userCode: string;\n customUniforms = [{name: 'value', type: 'float' as UniformType}];\n\n constructor(shape: number[], value: number) {\n this.variableNames = ['x'];\n this.outputShape = shape;\n\n this.userCode = `\n void main() {\n // Input can be obtained from uniform value.\n setOutput(value);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Fill, FillAttrs, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {FillProgram} from '../fill_gpu';\n\nexport function fill(args: {backend: MathBackendWebGL, attrs: FillAttrs}):\n TensorInfo {\n const {backend, attrs} = args;\n const {shape, value} = attrs;\n let {dtype} = attrs;\n\n dtype = dtype || util.inferDtype(value);\n\n if (dtype === 'string') {\n // String type should be handled in CPU memory.\n const values = util.getArrayFromDType(dtype, util.sizeFromShape(shape));\n values.fill(value as string);\n return backend.makeTensorInfo(shape, dtype, values);\n } else {\n const program = new FillProgram(shape, value as number);\n const customValues = [[value as number]];\n return backend.runWebGLProgram(program, [], dtype, customValues);\n }\n}\n\nexport const fillConfig: KernelConfig = {\n kernelName: Fill,\n backendName: 'webgl',\n kernelFunc: fill as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class FlipLeftRightProgram implements GPGPUProgram {\n variableNames = ['Image'];\n outputShape: number[] = [];\n userCode: string;\n\n constructor(imageShape: [number, number, number, number]) {\n const imageWidth = imageShape[2];\n this.outputShape = imageShape;\n\n this.userCode = `\n void main() {\n ivec4 coords = getOutputCoords();\n int x = coords[2];\n\n int coordX = ${imageWidth} - x - 1;\n float outputValue;\n if(coordX >= 0 && coordX < ${imageWidth}) {\n outputValue = getImage(coords[0], coords[1], coordX, coords[3]);\n } else {\n outputValue = getImage(coords[0], coords[1], coords[2], coords[3]);\n }\n setOutput(outputValue);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Tensor4D} from '@tensorflow/tfjs-core';\nimport {FlipLeftRight, FlipLeftRightInputs} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {FlipLeftRightProgram} from '../flip_left_right_gpu';\n\nexport const flipLeftRightConfig: KernelConfig = {\n kernelName: FlipLeftRight,\n backendName: 'webgl',\n kernelFunc: ({inputs, backend}) => {\n const {image} = inputs as FlipLeftRightInputs;\n const webglBackend = backend as MathBackendWebGL;\n\n const program = new FlipLeftRightProgram((image as Tensor4D).shape);\n const output = webglBackend.runWebGLProgram(program, [image], image.dtype);\n return output;\n }\n};\n","\n/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Floor, KernelConfig} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {floorImplCPU} from '../kernel_utils/shared';\n\nconst FLOOR = `return floor(x);`;\n\nexport const floor = unaryKernelFunc(\n {opSnippet: FLOOR, packedOpSnippet: FLOOR, cpuKernelImpl: floorImplCPU});\n\nexport const floorConfig: KernelConfig = {\n kernelName: Floor,\n backendName: 'webgl',\n kernelFunc: floor,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {FloorDiv, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\n// We use native integer division to deal with floating point imprecision. Since\n// we implement floor division and glsl implements truncated division, we\n// correct for this by subtracting 1 from result when the result is negative and\n// there is a remainder.\nconst INT_DIV = `\n float s = sign(a) * sign(b);\n int ia = round(a);\n int ib = round(b);\n if (ib != 0) {\n // Windows (D3D) wants guaranteed non-zero int division at compile-time.\n return float(idiv(ia, ib, s));\n } else {\n return NAN;\n }\n`;\n\nconst INT_DIV_PACKED = `\n ivec4 ia = round(a);\n ivec4 ib = round(b);\n bvec4 cond = notEqual(ib, ivec4(0));\n ivec4 result = ivec4(0);\n vec4 s = sign(a) * sign(b);\n\n // Windows (D3D) wants guaranteed non-zero int division at compile-time.\n if (cond[0]) {\n result[0] = idiv(ia[0], ib[0], s[0]);\n }\n if (cond[1]) {\n result[1] = idiv(ia[1], ib[1], s[1]);\n }\n if (cond[2]) {\n result[2] = idiv(ia[2], ib[2], s[2]);\n }\n if (cond[3]) {\n result[3] = idiv(ia[3], ib[3], s[3]);\n }\n return vec4(result);\n`;\n\nexport const floorDiv = binaryKernelFunc(\n {opSnippet: INT_DIV, packedOpSnippet: INT_DIV_PACKED, dtype: 'int32'});\n\nexport const floorDivConfig: KernelConfig = {\n kernelName: FloorDiv,\n backendName: 'webgl',\n kernelFunc: floorDiv as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getGlslDifferences} from '../../glsl_version';\nimport {GPGPUProgram} from '../../gpgpu_math';\n\nexport class FromPixelsProgram implements GPGPUProgram {\n variableNames = ['A'];\n userCode: string;\n outputShape: number[];\n\n constructor(outputShape: number[]) {\n const glsl = getGlslDifferences();\n const [height, width, ] = outputShape;\n this.outputShape = outputShape;\n this.userCode = `\n void main() {\n ivec3 coords = getOutputCoords();\n int texR = coords[0];\n int texC = coords[1];\n int depth = coords[2];\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2(${width}.0, ${height}.0);\n\n vec4 values = ${glsl.texture2D}(A, uv);\n float value;\n if (depth == 0) {\n value = values.r;\n } else if (depth == 1) {\n value = values.g;\n } else if (depth == 2) {\n value = values.b;\n } else if (depth == 3) {\n value = values.a;\n }\n\n setOutput(floor(value * 255.0 + 0.5));\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getGlslDifferences} from '../../glsl_version';\nimport {GPGPUProgram} from '../../gpgpu_math';\n\nexport class FromPixelsPackedProgram implements GPGPUProgram {\n variableNames = ['A'];\n userCode: string;\n outputShape: number[];\n packedInputs = false;\n packedOutput = true;\n\n constructor(outputShape: number[]) {\n const glsl = getGlslDifferences();\n const [height, width, ] = outputShape;\n this.outputShape = outputShape;\n this.userCode = `\n void main() {\n ivec3 coords = getOutputCoords();\n int texR = coords[0];\n int texC = coords[1];\n int depth = coords[2];\n\n vec4 result = vec4(0.);\n\n for(int row=0; row<=1; row++) {\n for(int col=0; col<=1; col++) {\n texC = coords[1] + row;\n depth = coords[2] + col;\n\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${width}.0, ${height}.0);\n vec4 values = ${glsl.texture2D}(A, uv);\n float value;\n if (depth == 0) {\n value = values.r;\n } else if (depth == 1) {\n value = values.g;\n } else if (depth == 2) {\n value = values.b;\n } else if (depth == 3) {\n value = values.a;\n }\n\n result[row * 2 + col] = floor(value * 255.0 + 0.5);\n }\n }\n\n ${glsl.output} = result;\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\nimport {FromPixels, FromPixelsAttrs, FromPixelsInputs} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {TextureUsage} from '../tex_util';\n\nimport {FromPixelsProgram} from './FromPixels_utils/from_pixels_gpu';\nimport {FromPixelsPackedProgram} from './FromPixels_utils/from_pixels_packed_gpu';\n\nexport const fromPixelsConfig: KernelConfig = {\n kernelName: FromPixels,\n backendName: 'webgl',\n kernelFunc: fromPixels as {} as KernelFunc,\n};\n\nlet fromPixels2DContext: CanvasRenderingContext2D;\nlet willReadFrequently = env().getBool('CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU');\n\nfunction fromPixels(args: {\n inputs: FromPixelsInputs,\n backend: MathBackendWebGL,\n attrs: FromPixelsAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n let {pixels} = inputs;\n const {numChannels} = attrs;\n\n const isVideo = typeof (HTMLVideoElement) !== 'undefined' &&\n pixels instanceof HTMLVideoElement;\n const isImage = typeof (HTMLImageElement) !== 'undefined' &&\n pixels instanceof HTMLImageElement;\n const [width, height] = isVideo ?\n [\n (pixels as HTMLVideoElement).videoWidth,\n (pixels as HTMLVideoElement).videoHeight\n ] :\n [pixels.width, pixels.height];\n\n const texShape: [number, number] = [height, width];\n const outShape = [height, width, numChannels];\n\n if (isImage || isVideo) {\n const newWillReadFrequently =\n env().getBool('CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU');\n if (fromPixels2DContext == null ||\n newWillReadFrequently !== willReadFrequently) {\n willReadFrequently = newWillReadFrequently;\n fromPixels2DContext =\n document.createElement('canvas').getContext(\n '2d', {willReadFrequently});\n }\n\n fromPixels2DContext.canvas.width = width;\n fromPixels2DContext.canvas.height = height;\n fromPixels2DContext.drawImage(\n pixels as HTMLVideoElement | HTMLImageElement | ImageBitmap, 0, 0,\n width, height);\n pixels = fromPixels2DContext.canvas;\n }\n\n const tempPixelHandle = backend.makeTensorInfo(texShape, 'int32');\n // This is a byte texture with pixels.\n backend.texData.get(tempPixelHandle.dataId).usage = TextureUsage.PIXELS;\n backend.gpgpu.uploadPixelDataToTexture(\n backend.getTexture(tempPixelHandle.dataId), pixels as ImageData);\n const program = env().getBool('WEBGL_PACK') ?\n new FromPixelsPackedProgram(outShape) :\n new FromPixelsProgram(outShape);\n const res = backend.runWebGLProgram(program, [tempPixelHandle], 'int32');\n backend.disposeData(tempPixelHandle.dataId);\n return res;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, env, FusedConv2D, FusedConv2DAttrs, FusedConv2DInputs, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {Conv2DProgram} from '../conv_gpu';\nimport {Conv2DPackedProgram} from '../conv_packed_gpu';\nimport {mapActivationToShaderProgram} from '../kernel_utils/kernel_funcs_utils';\n\nimport {conv2dByMatMul, conv2dWithIm2Row} from './Conv2D_impl';\nimport {reshape} from './Reshape';\n\nexport function fusedConv2d(args: {\n inputs: FusedConv2DInputs,\n attrs: FusedConv2DAttrs,\n backend: MathBackendWebGL\n}) {\n const {inputs, backend, attrs} = args;\n const {x, filter, bias, preluActivationWeights} = inputs;\n const {\n strides,\n pad,\n dataFormat,\n dilations,\n dimRoundingMode,\n activation,\n leakyreluAlpha\n } = attrs;\n\n const $dataFormat = backend_util.convertConv2DDataFormat(dataFormat);\n const convInfo = backend_util.computeConv2DInfo(\n x.shape as [number, number, number, number],\n filter.shape as [number, number, number, number], strides, dilations, pad,\n dimRoundingMode, false /* depthwise */, $dataFormat);\n let out: TensorInfo;\n const intermediates: TensorInfo[] = [];\n\n const hasBias = bias != null;\n const hasPreluActivationWeights = preluActivationWeights != null;\n const hasLeakyreluAlpha = activation === 'leakyrelu';\n\n const prepareInputs = (): TensorInfo[] => {\n const inputs: TensorInfo[] = [x, filter];\n\n // If the input is a 1-D tensor, align it with the channels.\n //\n // For fusedConv2d, the inputs (x, W, bias, preluActivationWeights) are\n // supposed to be aligned with the dataFormat. The 4-D tensor inputs or\n // scalar inputs are originally aligned, but the 1-D tensor inputs are\n // supposed to be aligned with the channels (only bias and PReLU activation\n // weights could be a 1-D tensor).\n const alignInputWithDataFormat =\n (input: TensorInfo, dataFormat: 'NHWC'|'NCHW'): TensorInfo => {\n if (dataFormat === 'NCHW' && input.shape.length === 1 &&\n input.shape[0] !== 1) {\n const alignedInput = reshape({\n inputs: {x: input},\n backend,\n attrs: {shape: [input.shape[0], 1, 1]}\n });\n intermediates.push(alignedInput);\n return alignedInput;\n }\n return input;\n };\n\n if (hasBias) {\n inputs.push(alignInputWithDataFormat(bias, dataFormat));\n }\n\n if (hasPreluActivationWeights) {\n inputs.push(alignInputWithDataFormat(preluActivationWeights, dataFormat));\n }\n\n if (hasLeakyreluAlpha) {\n const $leakyreluAlpha = backend.makeTensorInfo(\n [], 'float32',\n util.createScalarValue(leakyreluAlpha as {} as 'float32', 'float32'));\n inputs.push($leakyreluAlpha);\n intermediates.push($leakyreluAlpha);\n }\n return inputs;\n };\n\n if (convInfo.filterHeight === 1 && convInfo.filterWidth === 1 &&\n convInfo.dilationHeight === 1 && convInfo.dilationWidth === 1 &&\n convInfo.strideHeight === 1 && convInfo.strideWidth === 1 &&\n (convInfo.padInfo.type === 'SAME' || convInfo.padInfo.type === 'VALID')) {\n out = conv2dByMatMul({\n x,\n filter,\n convInfo,\n backend,\n bias,\n activation,\n preluActivationWeights,\n leakyreluAlpha\n });\n } else if (convInfo.strideWidth <= 2 && $dataFormat === 'channelsLast'\n && env().getBool('WEBGL_EXP_CONV')\n ) {\n const fusedActivation =\n activation ? mapActivationToShaderProgram(activation, true) : null;\n const program = new Conv2DPackedProgram(\n convInfo, hasBias, fusedActivation, hasPreluActivationWeights,\n hasLeakyreluAlpha);\n const customValues = [\n [convInfo.padInfo.top, convInfo.padInfo.left],\n [convInfo.strideHeight, convInfo.strideWidth],\n [convInfo.dilationHeight, convInfo.dilationWidth],\n [convInfo.inHeight, convInfo.inWidth]\n ];\n const inputs = prepareInputs();\n out = backend.runWebGLProgram(program, inputs, 'float32', customValues);\n } else if (env().getBool('WEBGL_CONV_IM2COL')) {\n out = conv2dWithIm2Row({\n x,\n filter,\n convInfo,\n backend,\n bias,\n activation,\n preluActivationWeights,\n leakyreluAlpha\n });\n } else {\n const fusedActivation =\n activation ? mapActivationToShaderProgram(activation, false) : null;\n const program = new Conv2DProgram(\n convInfo, hasBias, fusedActivation, hasPreluActivationWeights,\n hasLeakyreluAlpha);\n\n const inputs = prepareInputs();\n out = backend.runWebGLProgram(program, inputs, 'float32');\n }\n\n const outReshaped =\n reshape({inputs: {x: out}, backend, attrs: {shape: convInfo.outShape}});\n\n intermediates.push(out);\n intermediates.forEach(t => backend.disposeIntermediateTensorInfo(t));\n\n return outReshaped;\n}\n\nexport const fusedConv2DConfig: KernelConfig = {\n kernelName: FusedConv2D,\n backendName: 'webgl',\n kernelFunc: fusedConv2d as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, env, FusedDepthwiseConv2D, FusedDepthwiseConv2DAttrs, FusedDepthwiseConv2DInputs, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {DepthwiseConv2DProgram} from '../conv_gpu_depthwise';\nimport {DepthwiseConvPacked2DProgram} from '../conv_packed_gpu_depthwise';\nimport {mapActivationToShaderProgram} from '../kernel_utils/kernel_funcs_utils';\n\nexport function fusedDepthwiseConv2D(args: {\n inputs: FusedDepthwiseConv2DInputs,\n attrs: FusedDepthwiseConv2DAttrs,\n backend: MathBackendWebGL\n}) {\n const {inputs, backend, attrs} = args;\n const {x, filter, bias, preluActivationWeights} = inputs;\n const {strides, pad, dilations, dimRoundingMode, activation, leakyreluAlpha} =\n attrs;\n\n const intermediates: TensorInfo[] = [];\n\n let $dilations = dilations;\n if ($dilations == null) {\n $dilations = [1, 1];\n }\n\n util.assert(\n backend_util.eitherStridesOrDilationsAreOne(strides, $dilations),\n () => 'Error in depthwiseConv2d: Either strides or dilations must be ' +\n `1. Got strides ${strides} and dilations '${$dilations}'`);\n\n const convInfo = backend_util.computeConv2DInfo(\n x.shape as [number, number, number, number],\n filter.shape as [number, number, number, number], strides, $dilations,\n pad, dimRoundingMode, true /* depthwise */);\n\n const shouldPackDepthwiseConv = env().getBool('WEBGL_PACK_DEPTHWISECONV') &&\n convInfo.strideWidth <= 2 &&\n convInfo.outChannels / convInfo.inChannels === 1;\n const fusedActivation = activation ?\n mapActivationToShaderProgram(activation, shouldPackDepthwiseConv) :\n null;\n const programInputs: TensorInfo[] = [x, filter];\n\n const hasBias = bias != null;\n const hasPreluActivationWeights = preluActivationWeights != null;\n const hasLeakyreluAlpha = activation === 'leakyrelu';\n\n if (hasBias) {\n programInputs.push(bias);\n }\n if (hasPreluActivationWeights) {\n programInputs.push(preluActivationWeights);\n }\n if (hasLeakyreluAlpha) {\n const $leakyreluAlpha = backend.makeTensorInfo(\n [], 'float32',\n util.createScalarValue(leakyreluAlpha as {} as 'float32', 'float32'));\n programInputs.push($leakyreluAlpha);\n intermediates.push($leakyreluAlpha);\n }\n\n let program: DepthwiseConv2DProgram|DepthwiseConvPacked2DProgram;\n if (shouldPackDepthwiseConv) {\n program = new DepthwiseConvPacked2DProgram(\n convInfo, hasBias, fusedActivation, hasPreluActivationWeights,\n hasLeakyreluAlpha);\n } else {\n program = new DepthwiseConv2DProgram(\n convInfo, hasBias, fusedActivation, hasPreluActivationWeights,\n hasLeakyreluAlpha);\n }\n const customValues = [\n [convInfo.padInfo.top, convInfo.padInfo.left],\n [convInfo.strideHeight, convInfo.strideWidth],\n [convInfo.dilationHeight, convInfo.dilationWidth],\n [convInfo.inHeight, convInfo.inWidth]\n ];\n const result =\n backend.runWebGLProgram(program, programInputs, 'float32', customValues);\n\n intermediates.forEach(t => backend.disposeIntermediateTensorInfo(t));\n\n return result;\n}\n\nexport const fusedDepthwiseConv2DConfig: KernelConfig = {\n kernelName: FusedDepthwiseConv2D,\n backendName: 'webgl',\n kernelFunc: fusedDepthwiseConv2D as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {GPGPUProgram} from './gpgpu_math';\nimport {getCoordsDataType} from './shader_compiler';\n\nexport class GatherNDProgram implements GPGPUProgram {\n variableNames = ['x', 'indices'];\n outputShape: number[];\n userCode: string;\n constructor(\n private sliceDim: number, private strides: number[], shape: number[],\n private paramsShape: number[]) {\n this.outputShape = shape;\n const dtype = getCoordsDataType(shape.length);\n\n let mainLoop = `\n int index;`;\n for (let j = 0; j < this.sliceDim; j++) {\n mainLoop += `\n index = round(getIndices(coords[0], ${j}));\n out_of_bounds = out_of_bounds || index < 0;\n out_of_bounds = out_of_bounds || index >= ${this.paramsShape[j]};\n flattenIndex += index * ${this.strides[j]};`;\n }\n\n this.userCode = `\n void main() {\n ${dtype} coords = getOutputCoords();\n int flattenIndex = 0;\n bool out_of_bounds = false;\n\n ${mainLoop}\n\n setOutput(out_of_bounds ? 0.0 : getX(flattenIndex, coords[1]));\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, GatherNd, GatherNdInputs, KernelConfig, KernelFunc, Rank, TensorInfo, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {GatherNDProgram} from '../gather_nd_gpu';\nimport {gatherNdImplCPU} from '../kernel_utils/shared';\n\nimport {reshape} from './Reshape';\n\nexport function gatherNd(\n args: {inputs: GatherNdInputs, backend: MathBackendWebGL}): TensorInfo {\n const {inputs, backend} = args;\n const {params, indices} = inputs;\n\n const indicesShape = indices.shape;\n const sliceRank = indicesShape[indicesShape.length - 1];\n const paramsSize = util.sizeFromShape(params.shape);\n\n const [resultShape, numSlices, sliceSize, strides] =\n backend_util.prepareAndValidate(params, indices);\n\n const flattenIndices = reshape(\n {inputs: {x: indices}, backend, attrs: {shape: [numSlices, sliceRank]}});\n const flattenX = reshape({\n inputs: {x: params},\n backend,\n attrs: {shape: [(util.sizeFromShape(params.shape) / sliceSize), sliceSize]}\n });\n\n if (backend.shouldExecuteOnCPU([params, indices]) ||\n params.dtype === 'string') {\n const indicesData = backend.readSync(indices.dataId) as TypedArray;\n const paramsBuf = backend.bufferSync(params);\n const outValue = gatherNdImplCPU(\n indicesData, paramsBuf, params.dtype, numSlices, sliceRank, sliceSize,\n strides, params.shape, paramsSize);\n\n return backend.makeTensorInfo(resultShape, params.dtype, outValue.values);\n }\n const program =\n new GatherNDProgram(sliceRank, strides, [numSlices, sliceSize], \n params.shape);\n const res = backend.runWebGLProgram(\n program, [flattenX, flattenIndices], flattenX.dtype);\n\n const reshaped =\n reshape({inputs: {x: res}, backend, attrs: {shape: resultShape}});\n\n backend.disposeIntermediateTensorInfo(flattenIndices);\n backend.disposeIntermediateTensorInfo(flattenX);\n backend.disposeIntermediateTensorInfo(res);\n\n return reshaped;\n}\n\nexport const gatherNdConfig: KernelConfig = {\n kernelName: GatherNd,\n backendName: 'webgl',\n kernelFunc: gatherNd as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {getCoordsDataType} from './shader_compiler';\n\nexport type GatherShape = [number, number, number, number];\n\nexport class GatherProgram implements GPGPUProgram {\n variableNames = ['A', 'indices'];\n outputShape: number[];\n userCode: string;\n rank: number;\n\n constructor(aShape: GatherShape, outputShape: GatherShape) {\n this.outputShape = outputShape;\n this.rank = outputShape.length;\n const dtype = getCoordsDataType(this.rank);\n const sourceCoords = getSourceCoords(aShape, 2);\n\n this.userCode = `\n void main() {\n ${dtype} resRC = getOutputCoords();\n int index = int(getIndices(resRC.x, resRC.z));\n float inBounds = (index >= 0) && (index < ${aShape[2]}) ? 1.0 : 0.0;\n setOutput(inBounds * getA(${sourceCoords}));\n }\n `;\n }\n}\n\n// The input and output are always flattened into rank 4 tensors.\nfunction getSourceCoords(aShape: GatherShape, axis: number): string {\n const currentCoords = ['resRC.x', 'resRC.y', 'resRC.z', 'resRC.w'];\n\n const sourceCoords = [];\n for (let i = 0; i < aShape.length; i++) {\n if (i === 2) {\n sourceCoords.push('index');\n } else {\n sourceCoords.push(`${currentCoords[i]}`);\n }\n }\n return sourceCoords.join();\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, GatherV2, GatherV2Attrs, GatherV2Inputs, KernelConfig, KernelFunc, TensorInfo, TypedArray, util, env} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {GatherProgram, GatherShape} from '../gather_gpu';\nimport {gatherV2ImplCPU} from '../kernel_utils/shared';\n\nimport {reshape} from './Reshape';\n\nexport function gatherV2(args: {\n inputs: GatherV2Inputs,\n backend: MathBackendWebGL,\n attrs: GatherV2Attrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x, indices} = inputs;\n const {axis, batchDims} = attrs;\n\n const parsedAxis = util.parseAxisParam(axis, x.shape)[0];\n if (env().get('DEBUG')) {\n // In debug mode, throw error when any index is out of bound.\n // Otherwise, just fill out of bounds with zeroes.\n const indicesVals = backend.readSync(indices.dataId) as TypedArray;\n const axisDim = x.shape[parsedAxis];\n for (let i = 0; i < indicesVals.length; ++i) {\n const index = indicesVals[i];\n util.assert(\n index <= axisDim - 1 && index >= 0,\n () =>\n `GatherV2: the index value ${index} is not in [0, ${axisDim - 1}]`);\n }\n }\n\n const shapeInfo = backend_util.segment_util.collectGatherOpShapeInfo(\n x, indices, parsedAxis, batchDims);\n\n const indicesSize = util.sizeFromShape(indices.shape);\n\n const toDispose = [];\n\n const flattenX = reshape({\n inputs: {x},\n backend,\n attrs: {\n shape: [\n shapeInfo.batchSize, shapeInfo.outerSize, shapeInfo.dimSize,\n shapeInfo.sliceSize\n ]\n }\n });\n\n const flattenIndex = reshape({\n inputs: {x: indices},\n backend,\n attrs: {shape: [shapeInfo.batchSize, indicesSize / shapeInfo.batchSize]}\n });\n\n toDispose.push(flattenX);\n toDispose.push(flattenIndex);\n\n const flattenOutputShape = [\n shapeInfo.batchSize, shapeInfo.outerSize, indicesSize / shapeInfo.batchSize,\n shapeInfo.sliceSize\n ];\n\n if (backend.shouldExecuteOnCPU([x, indices]) || x.dtype === 'string') {\n const indicesBuf = backend.bufferSync(flattenIndex);\n const xBuf = backend.bufferSync(flattenX);\n const outBuf = gatherV2ImplCPU(xBuf, indicesBuf, flattenOutputShape);\n\n toDispose.forEach(t => backend.disposeIntermediateTensorInfo(t));\n\n return backend.makeTensorInfo(\n shapeInfo.outputShape, outBuf.dtype, outBuf.values as TypedArray);\n }\n\n const program = new GatherProgram(flattenX.shape as GatherShape,\n flattenOutputShape as GatherShape);\n const res = backend.runWebGLProgram(\n program, [flattenX, flattenIndex], flattenX.dtype);\n toDispose.push(res);\n\n const reshaped = reshape(\n {inputs: {x: res}, backend, attrs: {shape: shapeInfo.outputShape}});\n toDispose.forEach(t => backend.disposeIntermediateTensorInfo(t));\n return reshaped;\n}\n\nexport const gatherV2Config: KernelConfig = {\n kernelName: GatherV2,\n backendName: 'webgl',\n kernelFunc: gatherV2 as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Greater, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {greaterImplCPU} from '../kernel_utils/shared';\n\nconst GREATER = `return float(a > b);`;\nconst GREATER_PACKED = `\n return vec4(greaterThan(a, b));\n`;\n\nexport const greater = binaryKernelFunc({\n opSnippet: GREATER,\n packedOpSnippet: GREATER_PACKED,\n cpuKernelImpl: greaterImplCPU,\n dtype: 'bool'\n});\n\nexport const greaterConfig: KernelConfig = {\n kernelName: Greater,\n backendName: 'webgl',\n kernelFunc: greater as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GreaterEqual, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {greaterEqualImplCPU} from '../kernel_utils/shared';\n\nconst GREATER_EQUAL = `return float(a >= b);`;\nconst GREATER_EQUAL_PACKED = `\n return vec4(greaterThanEqual(a, b));\n`;\n\nexport const greaterEqual = binaryKernelFunc({\n opSnippet: GREATER_EQUAL,\n packedOpSnippet: GREATER_EQUAL_PACKED,\n dtype: 'bool',\n cpuKernelImpl: greaterEqualImplCPU\n});\n\nexport const greaterEqualConfig: KernelConfig = {\n kernelName: GreaterEqual,\n backendName: 'webgl',\n kernelFunc: greaterEqual as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {IFFT, IFFTInputs, KernelConfig, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\n\nimport {fftImpl} from './FFT_impl';\n\nexport function ifft(args: {inputs: IFFTInputs, backend: MathBackendWebGL}):\n TensorInfo {\n const {inputs, backend} = args;\n const {input} = inputs;\n\n return fftImpl(input, true /* inverse */, backend);\n}\n\nexport const ifftConfig: KernelConfig = {\n kernelName: IFFT,\n backendName: 'webgl',\n kernelFunc: ifft\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {IsFinite, KernelConfig} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst IS_FINITE = `return float(!isnan(x) && !isinf(x));`;\n\nexport const isFinite = unaryKernelFunc({opSnippet: IS_FINITE, dtype: 'bool'});\n\nexport const isFiniteConfig: KernelConfig = {\n kernelName: IsFinite,\n backendName: 'webgl',\n kernelFunc: isFinite,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {IsInf, KernelConfig} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst IS_INF = `return float(isinf(x));`;\n\nexport const isInf = unaryKernelFunc({opSnippet: IS_INF, dtype: 'bool'});\n\nexport const isInfConfig: KernelConfig = {\n kernelName: IsInf,\n backendName: 'webgl',\n kernelFunc: isInf,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {IsNan, KernelConfig} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst IS_NAN = `return float(isnan(x));`;\n\nexport const isNaN = unaryKernelFunc({opSnippet: IS_NAN, dtype: 'bool'});\n\nexport const isNaNConfig: KernelConfig = {\n kernelName: IsNan,\n backendName: 'webgl',\n kernelFunc: isNaN,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Less} from '@tensorflow/tfjs-core';\n\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {lessImplCPU} from '../kernel_utils/shared';\n\nconst LESS = `return float(a < b);`;\nconst LESS_PACKED = `\n return vec4(lessThan(a, b));\n`;\n\nexport const less = binaryKernelFunc({\n opSnippet: LESS,\n packedOpSnippet: LESS_PACKED,\n cpuKernelImpl: lessImplCPU,\n dtype: 'bool'\n});\n\nexport const lessConfig: KernelConfig = {\n kernelName: Less,\n backendName: 'webgl',\n kernelFunc: less as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, LessEqual} from '@tensorflow/tfjs-core';\n\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {lessEqualImplCPU} from '../kernel_utils/shared';\n\nexport const LESS_EQUAL = `return float(a <= b);`;\nexport const LESS_EQUAL_PACKED = `\n return vec4(lessThanEqual(a, b));\n`;\n\nexport const lessEqual = binaryKernelFunc({\n opSnippet: LESS_EQUAL,\n packedOpSnippet: LESS_EQUAL_PACKED,\n cpuKernelImpl: lessEqualImplCPU,\n dtype: 'bool'\n});\n\nexport const lessEqualConfig: KernelConfig = {\n kernelName: LessEqual,\n backendName: 'webgl',\n kernelFunc: lessEqual as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, LinSpace, LinSpaceAttrs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {linSpaceImplCPU} from '../kernel_utils/shared';\n\nexport function linSpace(\n args: {backend: MathBackendWebGL, attrs: LinSpaceAttrs}): TensorInfo {\n const {backend, attrs} = args;\n const {start, stop, num} = attrs;\n\n // TODO: Use CPU implementation due to the precision problem in Safari.\n const outVals = linSpaceImplCPU(start, stop, num);\n return backend.makeTensorInfo([outVals.length], 'float32', outVals);\n}\n\nexport const linSpaceConfig: KernelConfig = {\n kernelName: LinSpace,\n backendName: 'webgl',\n kernelFunc: linSpace as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Log} from '@tensorflow/tfjs-core';\n\nimport {CHECK_NAN_SNIPPET_UNARY, unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {logImplCPU} from '../kernel_utils/shared';\n\n// Windows chrome return 0 if the input is negative value. We will specifically\n// return NaN if the input is 0 to solve compatiblity issue.\nconst LOG = CHECK_NAN_SNIPPET_UNARY + `\n return x < 0.0 ? 0./0. : log(x);\n`;\n\nconst LOG_PACKED = `\n vec4 result = log(x);\n bvec4 isNaN = isnan(x);\n result.r = isNaN.r ? x.r : (x.r < 0.0 ? 0./0. : result.r);\n result.g = isNaN.g ? x.g : (x.g < 0.0 ? 0./0. : result.g);\n result.b = isNaN.b ? x.b : (x.b < 0.0 ? 0./0. : result.b);\n result.a = isNaN.a ? x.a : (x.a < 0.0 ? 0./0. : result.a);\n return result;\n`;\n\nexport const log = unaryKernelFunc(\n {opSnippet: LOG, packedOpSnippet: LOG_PACKED, cpuKernelImpl: logImplCPU});\n\nexport const logConfig: KernelConfig = {\n kernelName: Log,\n backendName: 'webgl',\n kernelFunc: log as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Log1p} from '@tensorflow/tfjs-core';\n\nimport {CHECK_NAN_SNIPPET_UNARY, unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst LOG1P = CHECK_NAN_SNIPPET_UNARY + `\n return log(1.0 + x);\n`;\n\nexport const log1p = unaryKernelFunc({opSnippet: LOG1P});\n\nexport const log1pConfig: KernelConfig = {\n kernelName: Log1p,\n backendName: 'webgl',\n kernelFunc: log1p,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, LogicalAnd} from '@tensorflow/tfjs-core';\n\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst LOGICAL_AND = `return float(a >= 1.0 && b >= 1.0);`;\nconst LOGICAL_AND_PACKED = `\n return vec4(\n vec4(greaterThanEqual(a, vec4(1.0))) *\n vec4(greaterThanEqual(b, vec4(1.0))));\n`;\n\nexport const logicalAnd = binaryKernelFunc({\n opSnippet: LOGICAL_AND,\n packedOpSnippet: LOGICAL_AND_PACKED,\n dtype: 'bool'\n});\n\nexport const logicalAndConfig: KernelConfig = {\n kernelName: LogicalAnd,\n backendName: 'webgl',\n kernelFunc: logicalAnd as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, LogicalNot} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst LOGICAL_NOT = `return float(!(x >= 1.0));`;\n\nexport const logicalNot = unaryKernelFunc({opSnippet: LOGICAL_NOT});\n\nexport const logicalNotConfig: KernelConfig = {\n kernelName: LogicalNot,\n backendName: 'webgl',\n kernelFunc: logicalNot,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, LogicalOr} from '@tensorflow/tfjs-core';\n\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst LOGICAL_OR = `return float(a >= 1.0 || b >= 1.0);`;\nconst LOGICAL_OR_PACKED = `\n return min(\n vec4(greaterThanEqual(a, vec4(1.0))) +\n vec4(greaterThanEqual(b, vec4(1.0))),\n vec4(1.0));\n`;\n\nexport const logicalOr = binaryKernelFunc(\n {opSnippet: LOGICAL_OR, packedOpSnippet: LOGICAL_OR_PACKED, dtype: 'bool'});\n\nexport const logicalOrConfig: KernelConfig = {\n kernelName: LogicalOr,\n backendName: 'webgl',\n kernelFunc: logicalOr as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class LRNProgram implements GPGPUProgram {\n variableNames = ['x'];\n outputShape: number[] = [];\n userCode: string;\n\n constructor(\n xShape: number[], radius: number, bias: number, alpha: number,\n beta: number) {\n const rad = radius;\n const maxD = xShape[3] - 1;\n this.outputShape = xShape;\n\n // optimize pow(bias + alpha * sum, -beta)\n // src: https://github.com/tensorflow/tensorflow/..\n // blob/26033a1644a9c4a5fbe3170ab2e864b6a4ccd4ca/..\n // tensorflow/core/kernels/mkl_lrn_op.cc#L320\n let powOperator;\n const basis = `float(${bias}) + float(${alpha}) * sum`;\n if (beta === 0.5) {\n powOperator = `inversesqrt(${basis})`;\n } else if (beta === 1.0) {\n powOperator = `1.0/(${basis})`;\n } else {\n powOperator = `exp(log(${basis}) * float(-${beta}));`;\n }\n\n this.userCode = `\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int r = coords[1];\n int c = coords[2];\n int d = coords[3];\n float x = getX(b, r, c, d);\n float sum = 0.0;\n for (int j = -${rad}; j <= ${rad}; j++) {\n int idx = d + j;\n if (idx >= 0 && idx <= ${maxD}) {\n float z = getX(b, r, c, idx);\n sum += z * z;\n }\n }\n float val = x * ${powOperator};\n setOutput(val);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class LRNPackedProgram implements GPGPUProgram {\n variableNames = ['x'];\n outputShape: number[] = [];\n userCode: string;\n packedInputs = true;\n packedOutput = true;\n\n constructor(\n xShape: number[], radius: number, bias: number, alpha: number,\n beta: number) {\n const rad = radius;\n const maxD = xShape[3] - 1;\n this.outputShape = xShape;\n\n // optimize pow(bias + alpha * sum, -beta)\n // src: https://github.com/tensorflow/tensorflow/..\n // blob/26033a1644a9c4a5fbe3170ab2e864b6a4ccd4ca/..\n // tensorflow/core/kernels/mkl_lrn_op.cc#L320\n let powOperator;\n const basis = `float(${bias}) + float(${alpha}) * sum`;\n if (beta === 0.5) {\n powOperator = `inversesqrt(${basis})`;\n } else if (beta === 1.0) {\n powOperator = `1.0/(${basis})`;\n } else {\n powOperator = `exp(log(${basis}) * float(-${beta}));`;\n }\n\n this.userCode = `\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords.x;\n int r = coords.y;\n int c = coords.z;\n int d = coords.w;\n\n bool hasNextCol = d < ${this.outputShape[3]};\n bool hasNextRow = c < ${this.outputShape[2]};\n\n vec4 sum = vec4(0.);\n vec4 xFragAtOutputCoords = getX(b, r, c, d);\n\n vec4 xAtOutputCoords = vec4(\n getChannel(xFragAtOutputCoords, vec2(c, d)),\n hasNextCol ?\n getChannel(xFragAtOutputCoords, vec2(c, d + 1)) : 0.0,\n hasNextRow ?\n getChannel(xFragAtOutputCoords , vec2(c + 1, d)) : 0.0,\n (hasNextRow && hasNextCol) ?\n getChannel(xFragAtOutputCoords, vec2(c + 1, d + 1)) : 0.0\n );\n\n int firstChannel = d - ${rad};\n vec2 cache = vec2(0.);\n if(firstChannel >= 0){\n vec4 firstChannelFrag = getX(b, r, c, firstChannel);\n cache.x = getChannel(firstChannelFrag, vec2(c, firstChannel));\n if(hasNextRow){\n cache.y = getChannel(firstChannelFrag, vec2(c + 1, firstChannel));\n }\n }\n\n ivec2 depth = ivec2(d, d + 1);\n for (int j = - ${rad}; j <= ${rad}; j++) {\n ivec2 idx = depth + j;\n bvec2 aboveLowerBound = greaterThanEqual(idx, ivec2(0));\n bvec2 belowUpperBound = lessThanEqual(idx, ivec2(${maxD}));\n\n bool depthInRange = aboveLowerBound.x && belowUpperBound.x;\n bool depthPlusOneInRange = aboveLowerBound.y && belowUpperBound.y;\n\n if(depthInRange || depthPlusOneInRange){\n vec4 z = vec4(0.);\n vec4 xFragAtCurrentDepth;\n z.xz = cache.xy;\n if(depthPlusOneInRange && hasNextCol){\n xFragAtCurrentDepth = idx.y != d ?\n getX(b, r, c, idx.y) : xFragAtOutputCoords;\n z.y = getChannel(xFragAtCurrentDepth, vec2(c, idx.y));\n if(hasNextRow){\n z.w = getChannel(xFragAtCurrentDepth, vec2(c + 1, idx.y));\n }\n }\n cache.xy = z.yw;\n sum += z * z;\n }\n }\n vec4 result = xAtOutputCoords * ${powOperator};\n setOutput(result);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env, KernelConfig, KernelFunc, LRN, LRNAttrs, LRNInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {LRNProgram} from '../lrn_gpu';\nimport {LRNPackedProgram} from '../lrn_packed_gpu';\n\nexport const lrn =\n (args: {inputs: LRNInputs, backend: MathBackendWebGL, attrs: LRNAttrs}):\n TensorInfo => {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {depthRadius, bias, alpha, beta} = attrs;\n\n const program = env().getBool('WEBGL_PACK_NORMALIZATION') ?\n new LRNPackedProgram(x.shape, depthRadius, bias, alpha, beta) :\n new LRNProgram(x.shape, depthRadius, bias, alpha, beta);\n return backend.runWebGLProgram(program, [x], x.dtype);\n };\n\n// tslint:disable-next-line: variable-name\nexport const LRNConfig: KernelConfig = {\n kernelName: LRN,\n backendName: 'webgl',\n kernelFunc: lrn as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class LRNGradProgram implements GPGPUProgram {\n variableNames = ['inputImage', 'outputImage', 'dy'];\n outputShape: number[] = [];\n userCode: string;\n depthRadius: number;\n bias: number;\n alpha: number;\n beta: number;\n depth: number;\n\n constructor(\n inputShape: number[], depthRadius: number, bias: number, alpha: number,\n beta: number) {\n this.outputShape = inputShape;\n this.depth = inputShape[3];\n this.depthRadius = depthRadius;\n this.bias = bias;\n this.alpha = alpha;\n this.beta = beta;\n this.userCode = `\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int r = coords[1];\n int c = coords[2];\n\n float result = 0.0;\n for (int d = 0; d < ${this.depth}; ++d) {\n int depthBegin = int(max(0.0, float(d - ${depthRadius})));\n int depthEnd = int(min(float(${this.depth}),\n float(d + ${depthRadius} + 1)));\n\n const int MIN_DEPTH_BEGIN = 0;\n const int MAX_DEPTH_END = ${this.depth};\n\n float norm = 0.0;\n for (int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k) {\n if (k < depthBegin){\n continue;\n }\n else if (k >= depthBegin && k < depthEnd) {\n norm += getInputImage(b, r, c, k) * getInputImage(b, r, c, k);\n }\n else {\n break;\n }\n }\n\n norm = float(${alpha}) * norm + float(${bias});\n\n for(int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k){\n if (k < depthBegin){\n continue;\n }\n else if (k >= depthBegin && k < depthEnd){\n float dyi = -2.0 * float(${alpha})\n * float(${beta})\n * getInputImage(b ,r ,c, k) * getOutputImage(b, r, c, d)\n / norm;\n if (k == d) {\n dyi += pow(norm, -1.0 * ${beta});\n }\n if (k == coords[3]) {\n dyi *= getDy(b, r, c, d);\n result += dyi;\n }\n }\n else {\n break;\n }\n }\n }\n setOutput(result);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, LRNGrad, LRNGradAttrs, LRNGradInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {LRNGradProgram} from '../lrn_grad_gpu';\n\nexport const lrnGrad = (args: {\n inputs: LRNGradInputs,\n backend: MathBackendWebGL,\n attrs: LRNGradAttrs\n}): TensorInfo => {\n const {inputs, backend, attrs} = args;\n const {x, y, dy} = inputs;\n const {depthRadius, bias, alpha, beta} = attrs;\n\n const program = new LRNGradProgram(x.shape, depthRadius, bias, alpha, beta);\n return backend.runWebGLProgram(program, [x, y, dy], x.dtype);\n};\n\n// tslint:disable-next-line: variable-name\nexport const LRNGradConfig: KernelConfig = {\n kernelName: LRNGrad,\n backendName: 'webgl',\n kernelFunc: lrnGrad as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {reduce} from '../kernel_utils/reduce';\nimport {reshape} from '../kernels/Reshape';\n\nexport function maxImpl(\n x: TensorInfo, reduceShape: number[], outShape: number[],\n backend: MathBackendWebGL): TensorInfo {\n const inSize = util.sizeFromShape(reduceShape);\n const xSize = util.sizeFromShape(x.shape);\n const batchSize = xSize / inSize;\n const reshapedInput =\n reshape({inputs: {x}, attrs: {shape: [batchSize, inSize]}, backend});\n\n const reduced = reduce(reshapedInput, x.dtype, 'max', backend);\n const reshapedOutput =\n reshape({inputs: {x: reduced}, attrs: {shape: outShape}, backend});\n\n backend.disposeIntermediateTensorInfo(reshapedInput);\n backend.disposeIntermediateTensorInfo(reduced);\n\n return reshapedOutput;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelFunc, Max, MaxAttrs, MaxInputs, TensorInfo} from '@tensorflow/tfjs-core';\nimport {backend_util, KernelConfig, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {maxImplCPU} from '../kernel_utils/shared';\n\nimport {maxImpl} from './Max_impl';\nimport {transposeImpl, transposeImplCPU} from './Transpose_impl';\n\nexport function max(\n args: {inputs: MaxInputs, backend: MathBackendWebGL, attrs: MaxAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {reductionIndices, keepDims} = attrs;\n\n const xRank = x.shape.length;\n\n const origAxes = util.parseAxisParam(reductionIndices, x.shape);\n let axes = origAxes;\n const permutedAxes = backend_util.getAxesPermutation(axes, xRank);\n const maxInputIsTransposed = permutedAxes != null;\n const shouldExecuteOnCPU = backend.shouldExecuteOnCPU([x]);\n\n let maxInput = x;\n if (maxInputIsTransposed) {\n if (shouldExecuteOnCPU) {\n const xTexData = backend.texData.get(maxInput.dataId);\n const values = xTexData.values as TypedArray;\n\n const newShape: number[] = new Array(xRank);\n for (let i = 0; i < newShape.length; i++) {\n newShape[i] = x.shape[permutedAxes[i]];\n }\n const maxInputValues =\n transposeImplCPU(values, x.shape, x.dtype, permutedAxes, newShape);\n\n maxInput = backend.makeTensorInfo(newShape, x.dtype);\n const maxInputData = backend.texData.get(maxInput.dataId);\n maxInputData.values = maxInputValues;\n } else {\n maxInput = transposeImpl(x, permutedAxes, backend);\n }\n\n axes = backend_util.getInnerMostAxes(axes.length, xRank);\n }\n\n backend_util.assertAxesAreInnerMostDims('max', axes, xRank);\n const [maxOutShape, reduceShape] =\n backend_util.computeOutAndReduceShapes(maxInput.shape, axes);\n\n let outShape = maxOutShape;\n if (keepDims) {\n // rather than reshape at the end, set the target shape here.\n outShape = backend_util.expandShapeToKeepDim(maxOutShape, origAxes);\n }\n\n let out;\n if (shouldExecuteOnCPU) {\n const xTexData = backend.texData.get(maxInput.dataId);\n const values = xTexData.values as TypedArray;\n\n const outValues =\n maxImplCPU(values, util.sizeFromShape(reduceShape), outShape, x.dtype);\n\n out = backend.makeTensorInfo(outShape, x.dtype);\n const outData = backend.texData.get(out.dataId);\n outData.values = outValues;\n } else {\n out = maxImpl(maxInput, reduceShape, outShape, backend);\n }\n\n if (maxInputIsTransposed) {\n backend.disposeIntermediateTensorInfo(maxInput);\n }\n\n return out;\n}\n\nexport const maxConfig: KernelConfig = {\n kernelName: Max,\n backendName: 'webgl',\n kernelFunc: max as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Maximum} from '@tensorflow/tfjs-core';\n\nimport {CHECK_NAN_SNIPPET} from '../binaryop_gpu';\nimport {CHECK_NAN_SNIPPET_PACKED} from '../binaryop_packed_gpu';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {maximumImplCPU} from '../kernel_utils/shared';\n\nconst MAXIMUM = CHECK_NAN_SNIPPET + `\n return max(a, b);\n`;\n\nconst MAXIMUM_PACKED = `\n vec4 result = vec4(max(a, b));\n bvec4 isNaNA = isnan(a);\n bvec4 isNaNB = isnan(b);\n bvec4 isNaN = bvec4(isNaNA.x || isNaNB.x, isNaNA.y || isNaNB.y, isNaNA.z || isNaNB.z, isNaNA.w || isNaNB.w);\n ` +\n CHECK_NAN_SNIPPET_PACKED + `\n return result;\n`;\n\nexport const maximum = binaryKernelFunc({\n opSnippet: MAXIMUM,\n packedOpSnippet: MAXIMUM_PACKED,\n cpuKernelImpl: maximumImplCPU\n});\n\nexport const maximumConfig: KernelConfig = {\n kernelName: Maximum,\n backendName: 'webgl',\n kernelFunc: maximum as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {backend_util, KernelConfig, KernelFunc, MaxPool, MaxPoolAttrs, MaxPoolInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {Pool2DProgram} from '../pool_gpu';\nimport {assertNotComplex} from '../webgl_util';\nimport {identity} from './Identity';\n\nexport function maxPool(args: {\n inputs: MaxPoolInputs,\n backend: MathBackendWebGL,\n attrs: MaxPoolAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n assertNotComplex(x, 'maxPool');\n const {filterSize, strides, pad, dimRoundingMode} = attrs;\n const dilations = 1;\n\n util.assert(\n backend_util.eitherStridesOrDilationsAreOne(strides, dilations),\n () => 'Error in maxPool: Either strides or dilations must be 1. ' +\n `Got strides ${strides} and dilations '${dilations}'`);\n\n const convInfo = backend_util.computePool2DInfo(\n x.shape as [number, number, number, number], filterSize, strides,\n dilations, pad, dimRoundingMode);\n if (convInfo.filterWidth === 1 && convInfo.filterHeight === 1 &&\n util.arraysEqual(convInfo.inShape, convInfo.outShape)) {\n return identity({inputs: {x}, backend});\n }\n const maxPoolProgram = new Pool2DProgram(convInfo, 'max', false);\n return backend.runWebGLProgram(maxPoolProgram, [x], x.dtype);\n}\n\nexport const maxPoolConfig: KernelConfig = {\n kernelName: MaxPool,\n backendName: 'webgl',\n kernelFunc: maxPool as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {backend_util, KernelConfig, KernelFunc, MaxPool3D, MaxPool3DAttrs, MaxPool3DInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {Pool3DProgram} from '../pool_gpu';\n\nexport function maxPool3d(args: {\n inputs: MaxPool3DInputs,\n backend: MathBackendWebGL,\n attrs: MaxPool3DAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {filterSize, strides, pad, dataFormat, dimRoundingMode} = attrs;\n const dilations: [number, number, number] = [1, 1, 1];\n\n const convInfo = backend_util.computePool3DInfo(\n x.shape as [number, number, number, number, number], filterSize, strides,\n dilations, pad, dimRoundingMode, dataFormat);\n const maxPoolProgram = new Pool3DProgram(convInfo, 'max', false);\n return backend.runWebGLProgram(maxPoolProgram, [x], x.dtype);\n}\n\nexport const maxPool3DConfig: KernelConfig = {\n kernelName: MaxPool3D,\n backendName: 'webgl',\n kernelFunc: maxPool3d as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class MaxPool2DBackpropProgram implements GPGPUProgram {\n variableNames = ['dy', 'maxPos'];\n outputShape: number[];\n userCode: string;\n\n constructor(convInfo: backend_util.Conv2DInfo) {\n this.outputShape = convInfo.inShape;\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n const dilationHeight = convInfo.dilationHeight;\n const effectiveFilterHeight = convInfo.effectiveFilterHeight;\n const effectiveFilterWidth = convInfo.effectiveFilterWidth;\n\n const padTop = effectiveFilterHeight - 1 - convInfo.padInfo.top;\n const padLeft = effectiveFilterWidth - 1 - convInfo.padInfo.left;\n\n const lastIndex = effectiveFilterHeight * effectiveFilterWidth - 1;\n this.userCode = `\n const ivec2 pads = ivec2(${padTop}, ${padLeft});\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n\n ivec2 dyRCCorner = coords.yz - pads;\n int dyRCorner = dyRCCorner.x;\n int dyCCorner = dyRCCorner.y;\n\n // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < ${effectiveFilterHeight};\n wR += ${dilationHeight}) {\n float dyR = float(dyRCorner + wR) / ${strideHeight}.0;\n\n if (dyR < 0.0 || dyR >= ${convInfo.outHeight}.0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < ${effectiveFilterWidth}; wC++) {\n float dyC = float(dyCCorner + wC) / ${strideWidth}.0;\n\n if (dyC < 0.0 || dyC >= ${convInfo.outWidth}.0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(b, idyR, idyC, d);\n int maxPosValue = ${lastIndex} - int(getMaxPos(b, idyR, idyC, d));\n\n // Get the current value, check it against the value from the\n // position matrix.\n int curPosValue = wR * ${effectiveFilterWidth} + wC;\n float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0);\n\n dotProd += dyValue * mask;\n }\n }\n setOutput(dotProd);\n }\n `;\n }\n}\n\nexport class MaxPool3DBackpropProgram implements GPGPUProgram {\n variableNames = ['dy', 'maxPos'];\n outputShape: number[];\n userCode: string;\n\n constructor(convInfo: backend_util.Conv3DInfo) {\n this.outputShape = convInfo.inShape;\n const strideDepth = convInfo.strideDepth;\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n const dilationDepth = convInfo.dilationDepth;\n const dilationHeight = convInfo.dilationHeight;\n const dilationWidth = convInfo.dilationWidth;\n const effectiveFilterDepth = convInfo.effectiveFilterDepth;\n const effectiveFilterHeight = convInfo.effectiveFilterHeight;\n const effectiveFilterWidth = convInfo.effectiveFilterWidth;\n\n const padFront = effectiveFilterDepth - 1 - convInfo.padInfo.front;\n const padTop = effectiveFilterHeight - 1 - convInfo.padInfo.top;\n const padLeft = effectiveFilterWidth - 1 - convInfo.padInfo.left;\n\n const lastIndex =\n effectiveFilterDepth * effectiveFilterHeight * effectiveFilterWidth - 1;\n this.userCode = `\n const ivec3 pads = ivec3(${padFront}, ${padTop}, ${padLeft});\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int ch = coords.u;\n\n ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;\n int dyDCorner = dyCorner.x;\n int dyRCorner = dyCorner.y;\n int dyCCorner = dyCorner.z;\n\n // Convolve dy(?, ?, ?, ch) with pos mask(:, :, :, d) to get\n // dx(xD, xR, xC, ch).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n\n for (int wD = 0; wD < ${effectiveFilterDepth};\n wD += ${dilationDepth}) {\n float dyD = float(dyDCorner + wD) / ${strideDepth}.0;\n\n if (dyD < 0.0 || dyD >= ${convInfo.outDepth}.0 || fract(dyD) > 0.0) {\n continue;\n }\n int idyD = int(dyD);\n\n for (int wR = 0; wR < ${effectiveFilterHeight};\n wR += ${dilationHeight}) {\n float dyR = float(dyRCorner + wR) / ${strideHeight}.0;\n\n if (dyR < 0.0 || dyR >= ${convInfo.outHeight}.0 ||\n fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < ${effectiveFilterWidth};\n wC += ${dilationWidth}) {\n float dyC = float(dyCCorner + wC) / ${strideWidth}.0;\n\n if (dyC < 0.0 || dyC >= ${convInfo.outWidth}.0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(batch, idyD, idyR, idyC, ch);\n int maxPosValue = ${lastIndex} -\n int(getMaxPos(batch, idyD, idyR, idyC, ch));\n\n // Get the current value, check it against the value from the\n // position matrix.\n int curPosValue =\n wD * ${effectiveFilterHeight} * ${effectiveFilterWidth} +\n wR * ${effectiveFilterWidth} + wC;\n float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0);\n\n dotProd += dyValue * mask;\n }\n }\n }\n setOutput(dotProd);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {backend_util, KernelConfig, KernelFunc, MaxPool3DGrad, MaxPool3DGradAttrs, MaxPool3DGradInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {MaxPool3DBackpropProgram} from '../max_pool_backprop_gpu';\nimport {Pool3DProgram} from '../pool_gpu';\n\nexport function maxPool3DGrad(args: {\n inputs: MaxPool3DGradInputs,\n backend: MathBackendWebGL,\n attrs: MaxPool3DGradAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {dy, input} = inputs;\n const x = input;\n const {filterSize, strides, pad, dimRoundingMode} = attrs;\n const dilations: [number, number, number] = [1, 1, 1];\n\n const convInfo = backend_util.computePool3DInfo(\n x.shape as [number, number, number, number, number], filterSize, strides,\n dilations, pad, dimRoundingMode);\n\n const maxPool3dPositionsProgram =\n new Pool3DProgram(convInfo, 'max', true /* get positions */);\n const maxPool3dPositions =\n backend.runWebGLProgram(maxPool3dPositionsProgram, [x], x.dtype);\n const maxPoolBackpropProgram = new MaxPool3DBackpropProgram(convInfo);\n const result = backend.runWebGLProgram(\n maxPoolBackpropProgram, [dy, maxPool3dPositions], x.dtype);\n backend.disposeIntermediateTensorInfo(maxPool3dPositions);\n return result;\n}\n\nexport const maxPool3DGradConfig: KernelConfig = {\n kernelName: MaxPool3DGrad,\n backendName: 'webgl',\n kernelFunc: maxPool3DGrad as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {backend_util, KernelConfig, KernelFunc, MaxPoolGrad, MaxPoolGradAttrs, MaxPoolGradInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {MaxPool2DBackpropProgram} from '../max_pool_backprop_gpu';\nimport {Pool2DProgram} from '../pool_gpu';\nimport {assertNotComplex} from '../webgl_util';\n\nexport function maxPoolGrad(args: {\n inputs: MaxPoolGradInputs,\n backend: MathBackendWebGL,\n attrs: MaxPoolGradAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {dy, input, output} = inputs;\n const x = input;\n assertNotComplex([input, output], 'maxPoolGrad');\n const {filterSize, strides, pad, dimRoundingMode} = attrs;\n\n const convInfo = backend_util.computePool2DInfo(\n x.shape as [number, number, number, number], filterSize, strides,\n 1 /* dilations */, pad, dimRoundingMode);\n const getPositions = true;\n const maxPoolPositionsProgram =\n new Pool2DProgram(convInfo, 'max', getPositions);\n const maxPoolPositions: TensorInfo =\n backend.runWebGLProgram(maxPoolPositionsProgram, [x], x.dtype);\n\n const maxPoolBackPropProgram = new MaxPool2DBackpropProgram(convInfo);\n const result = backend.runWebGLProgram(\n maxPoolBackPropProgram, [dy, maxPoolPositions], x.dtype);\n backend.disposeIntermediateTensorInfo(maxPoolPositions);\n return result;\n}\n\nexport const maxPoolGradConfig: KernelConfig = {\n kernelName: MaxPoolGrad,\n backendName: 'webgl',\n kernelFunc: maxPoolGrad as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {Pool2DProgram} from '../pool_gpu';\n\nexport function maxPoolWithArgmaxImpl(\n x: TensorInfo, includeBatchInIndex: boolean,\n convInfo: backend_util.Conv2DInfo,\n backend: MathBackendWebGL): TensorInfo[] {\n let program = new Pool2DProgram(convInfo, 'max', false);\n const poolOutput = backend.runWebGLProgram(program, [x], 'float32');\n\n program = new Pool2DProgram(convInfo, 'max', true, true, includeBatchInIndex);\n const indexOutput = backend.runWebGLProgram(program, [x], 'float32');\n return [poolOutput, indexOutput];\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {MaxPoolWithArgmax, MaxPoolWithArgmaxAttrs, MaxPoolWithArgmaxInputs} from '@tensorflow/tfjs-core';\nimport {backend_util, KernelConfig, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\n\nimport {maxPoolWithArgmaxImpl} from './MaxPoolWithArgmax_impl';\n\nexport const maxPoolWithArgmaxConfig: KernelConfig = {\n kernelName: MaxPoolWithArgmax,\n backendName: 'webgl',\n kernelFunc: ({inputs, attrs, backend}) => {\n const {x} = inputs as MaxPoolWithArgmaxInputs;\n const {filterSize, strides, pad, includeBatchInIndex} =\n attrs as {} as MaxPoolWithArgmaxAttrs;\n const webglBackend = backend as MathBackendWebGL;\n\n util.assert(\n x.shape.length === 4,\n () => `Error in maxPool: input must be rank 4 but got rank ${\n x.shape.length}.`);\n const dilations: [number, number] = [1, 1];\n util.assert(\n backend_util.eitherStridesOrDilationsAreOne(strides, dilations),\n () => 'Error in maxPool: Either strides or dilations must be 1. ' +\n `Got strides ${strides} and dilations '${dilations}'`);\n\n const convInfo = backend_util.computePool2DInfo(\n x.shape as [number, number, number, number], filterSize, strides,\n dilations, pad);\n\n const [result, indexes] =\n maxPoolWithArgmaxImpl(x, includeBatchInIndex, convInfo, webglBackend);\n return [result, indexes];\n }\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {reduce} from '../kernel_utils/reduce';\nimport {reshape} from '../kernels/Reshape';\n\nexport function meanImpl(\n x: TensorInfo, reduceShape: number[], outShape: number[],\n backend: MathBackendWebGL): TensorInfo {\n const inSize = util.sizeFromShape(reduceShape);\n const xSize = util.sizeFromShape(x.shape);\n const batchSize = xSize / inSize;\n const reshapedInput =\n reshape({inputs: {x}, attrs: {shape: [batchSize, inSize]}, backend});\n\n const reduced = reduce(reshapedInput, 'float32', 'mean', backend);\n const reshapedOutput =\n reshape({inputs: {x: reduced}, attrs: {shape: outShape}, backend});\n\n backend.disposeIntermediateTensorInfo(reshapedInput);\n backend.disposeIntermediateTensorInfo(reduced);\n\n return reshapedOutput;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, Mean, MeanAttrs, MeanInputs, TensorInfo, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\n\nimport {meanImpl} from './Mean_impl';\nimport {transposeImpl, transposeImplCPU} from './Transpose_impl';\n\nexport const meanConfig: KernelConfig = {\n kernelName: Mean,\n backendName: 'webgl',\n kernelFunc: ({inputs, attrs, backend}) => {\n const {x} = inputs as MeanInputs;\n const {keepDims, axis} = attrs as {} as MeanAttrs;\n const webglBackend = backend as MathBackendWebGL;\n\n const xRank = x.shape.length;\n const origAxes = util.parseAxisParam(axis, x.shape);\n\n let axes = origAxes;\n const permutedAxes = backend_util.getAxesPermutation(axes, xRank);\n const meanInputIsTransposed = permutedAxes != null;\n const shouldExecuteOnCPU = webglBackend.shouldExecuteOnCPU([x]);\n\n const intermediates: TensorInfo[] = [];\n\n let meanInput = x;\n if (meanInputIsTransposed) {\n if (shouldExecuteOnCPU) {\n const xTexData = webglBackend.texData.get(meanInput.dataId);\n const values = xTexData.values as TypedArray;\n\n const newShape: number[] = new Array(xRank);\n for (let i = 0; i < newShape.length; i++) {\n newShape[i] = x.shape[permutedAxes[i]];\n }\n const meanInputValues =\n transposeImplCPU(values, x.shape, x.dtype, permutedAxes, newShape);\n\n meanInput = webglBackend.makeTensorInfo(newShape, x.dtype);\n const meanInputData = webglBackend.texData.get(meanInput.dataId);\n meanInputData.values = meanInputValues;\n } else {\n meanInput = transposeImpl(x, permutedAxes, webglBackend);\n }\n\n intermediates.push(meanInput);\n axes = backend_util.getInnerMostAxes(axes.length, xRank);\n }\n\n backend_util.assertAxesAreInnerMostDims('sum', axes, xRank);\n const [meanOutShape, reduceShape] =\n backend_util.computeOutAndReduceShapes(meanInput.shape, axes);\n\n let outShape = meanOutShape;\n if (keepDims) {\n // rather than reshape at the end, set the target shape here.\n outShape = backend_util.expandShapeToKeepDim(meanOutShape, origAxes);\n }\n\n const out = meanImpl(meanInput, reduceShape, outShape, webglBackend);\n for (const i of intermediates) {\n webglBackend.disposeIntermediateTensorInfo(i);\n }\n\n return out;\n }\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, Min, MinAttrs, MinInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {reduce} from '../kernel_utils/reduce';\n\nimport {reshape} from './Reshape';\nimport {transpose} from './Transpose';\n\nexport function min(\n args: {inputs: MinInputs, backend: MathBackendWebGL, attrs: MinAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {axis, keepDims} = attrs;\n\n const xRank = x.shape.length;\n\n const origAxes = util.parseAxisParam(axis, x.shape);\n let axes = origAxes;\n const permutedAxes = backend_util.getAxesPermutation(axes, xRank);\n let permutedX = x;\n if (permutedAxes != null) {\n permutedX = transpose({inputs: {x}, backend, attrs: {perm: permutedAxes}});\n axes = backend_util.getInnerMostAxes(axes.length, x.shape.length);\n }\n\n backend_util.assertAxesAreInnerMostDims('min', axes, xRank);\n const [outShape, reduceShape] =\n backend_util.computeOutAndReduceShapes(permutedX.shape, axes);\n const inSize = util.sizeFromShape(reduceShape);\n const a2D =\n reshape({inputs: {x: permutedX}, backend, attrs: {shape: [-1, inSize]}});\n const reduced = reduce(a2D, a2D.dtype, 'min', backend);\n\n let res;\n if (keepDims) {\n const newShape = backend_util.expandShapeToKeepDim(outShape, origAxes);\n res = reshape({inputs: {x: reduced}, backend, attrs: {shape: newShape}});\n } else {\n res = reshape({inputs: {x: reduced}, backend, attrs: {shape: outShape}});\n }\n\n backend.disposeIntermediateTensorInfo(a2D);\n backend.disposeIntermediateTensorInfo(reduced);\n\n if (permutedAxes != null) {\n backend.disposeIntermediateTensorInfo(permutedX);\n }\n\n return res;\n}\n\nexport const minConfig: KernelConfig = {\n kernelName: Min,\n backendName: 'webgl',\n kernelFunc: min as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Minimum} from '@tensorflow/tfjs-core';\n\nimport {CHECK_NAN_SNIPPET} from '../binaryop_gpu';\nimport {CHECK_NAN_SNIPPET_PACKED} from '../binaryop_packed_gpu';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {minimumImplCPU} from '../kernel_utils/shared';\n\nconst MINIMUM = CHECK_NAN_SNIPPET + `\n return min(a, b);\n`;\n\nconst MINIMUM_PACKED = `\n vec4 result = vec4(min(a, b));\n bvec4 isNaNA = isnan(a);\n bvec4 isNaNB = isnan(b);\n bvec4 isNaN = bvec4(isNaNA.x || isNaNB.x, isNaNA.y || isNaNB.y, isNaNA.z || isNaNB.z, isNaNA.w || isNaNB.w);\n ` +\n CHECK_NAN_SNIPPET_PACKED + `\n return result;\n`;\n\nexport const minimum = binaryKernelFunc({\n opSnippet: MINIMUM,\n packedOpSnippet: MINIMUM_PACKED,\n cpuKernelImpl: minimumImplCPU\n});\n\nexport const minimumConfig: KernelConfig = {\n kernelName: Minimum,\n backendName: 'webgl',\n kernelFunc: minimum as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {getCoordsDataType} from './shader_compiler';\n\nexport class MirrorPadProgram implements GPGPUProgram {\n variableNames = ['x'];\n outputShape: number[];\n userCode: string;\n\n constructor(\n xShape: number[], paddings: Array<[number, number]>,\n mode: 'reflect'|'symmetric') {\n this.outputShape = paddings.map(\n (p, i) => p[0] /* beforePad */ + xShape[i] + p[1] /* afterPad */);\n const rank = xShape.length;\n const dtype = getCoordsDataType(rank);\n\n const start = paddings.map(p => p[0]).join(',');\n const end = paddings.map((p, i) => p[0] + xShape[i]).join(',');\n const unpackedCoords =\n ['coords[0]', 'coords[1]', 'coords[2]', 'coords[3]'].slice(0, rank);\n const offset = mode === 'reflect' ? 0 : 1;\n\n if (rank === 1) {\n this.userCode = `\n int start = ${start};\n int end = ${end};\n\n void main() {\n int outC = getOutputCoords();\n if (outC < start) {\n outC = start * 2 - outC - ${offset};\n } else if(outC >= end) {\n outC = (end - 1) * 2 - outC + ${offset};\n }\n setOutput(getX(outC - start));\n }\n `;\n return;\n }\n this.userCode = `\n ${dtype} start = ${dtype}(${start});\n ${dtype} end = ${dtype}(${end});\n\n void main() {\n ${dtype} outC = getOutputCoords();\n for (int i = 0; i < ${rank}; i++) {\n if (outC[i] < start[i]) {\n outC[i] = start[i] * 2 - outC[i] - ${offset};\n } else if(outC[i] >= end[i]) {\n outC[i] = (end[i] - 1) * 2 - outC[i] + ${offset};\n }\n }\n ${dtype} coords = outC - start;\n setOutput(getX(${unpackedCoords}));\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {getChannels} from './packing_util';\nimport {getCoordsDataType} from './shader_compiler';\n\n/**\n * Example shader code for\n * `mirrorPad(tf.tensor1d([1, 2, 3], 'int32'), [[2, 2]], 'reflect')`\n * ```\n * const int start = int(2);\n * const int end = int(5);\n *\n * void main() {\n * int outputLoc = getOutputCoords();\n * vec4 result = vec4(0.);\n *\n * int rc = outputLoc;\n *\n * int source = rc;\n * if (source < start) {\n * source = start * 2 - source - 0;\n * } else if (source >= end) {\n * source = (end - 1) * 2 - source + 0;\n * }\n * source -= start;\n *\n * result[0] = getChannel(getX(source), source);\n * rc += 1;\n * if(rc < 6) {\n * int source = rc;\n * if (source < start) {\n * source = start * 2 - source - 0;\n * } else if (source >= end) {\n * source = (end - 1) * 2 - source + 0;\n * }\n * source -= start;\n *\n * result[1] = getChannel(getX(source), source);\n * }\n *\n * setOutput(result);\n * }\n * ```\n */\nexport class MirrorPadPackedProgram implements GPGPUProgram {\n variableNames = ['x'];\n packedInputs = true;\n packedOutput = true;\n outputShape: number[];\n userCode: string;\n\n constructor(\n xShape: number[], paddings: Array<[number, number]>,\n mode: 'reflect'|'symmetric') {\n this.outputShape = paddings.map(\n (p, i) => p[0] /* beforePad */ + xShape[i] + p[1] /* afterPad */);\n const rank = xShape.length;\n const dtype = getCoordsDataType(rank);\n\n const start = paddings.map(p => p[0]).join(',');\n const end = paddings.map((p, i) => p[0] + xShape[i]).join(',');\n const coords = getChannels('rc', rank);\n const source = getChannels('source', rank);\n const cLimit = `${coords[rank - 1]} < ${this.outputShape[rank - 1]}`;\n const innerDims =\n rank === 1 ? 'source' : `vec2(${source.slice(-2).join()})`;\n const offset = mode === 'reflect' ? 0 : 1;\n\n let mainLoop = '';\n if (rank === 1) {\n const padSetup = `\n ${dtype} source = rc;\n if (source < start) {\n source = start * 2 - source - ${offset};\n } else if (source >= end) {\n source = (end - 1) * 2 - source + ${offset};\n }\n source -= start;\n `;\n mainLoop = `\n ${dtype} rc = outputLoc;\n ${padSetup}\n result[0] = getChannel(getX(${source.join()}), ${innerDims});\n ${coords[rank - 1]} += 1;\n if(${cLimit}) {\n ${padSetup}\n result[1] = getChannel(getX(${source.join()}), ${innerDims});\n }\n `;\n } else {\n const padSetup = `\n ${dtype} source = rc;\n ${dtype} lt = ${dtype}(lessThan(source, start));\n ${dtype} gte = ${dtype}(greaterThanEqual(source, end));\n ${dtype} orig = 1 - (lt + gte);\n source = orig * source +\n lt * (start * 2 - source - ${offset}) +\n gte * ((end - 1) * 2 - source + ${offset});\n source -= start;\n `;\n\n mainLoop = `\n ${dtype} rc = outputLoc;\n ${padSetup}\n result[0] = getChannel(getX(${source.join()}), ${innerDims});\n ${coords[rank - 1]} += 1;\n if(${cLimit}) {\n ${padSetup}\n result[1] = getChannel(getX(${source.join()}), ${innerDims});\n }\n rc = outputLoc;\n ${coords[rank - 2]} += 1;\n if(${coords[rank - 2]} < ${this.outputShape[rank - 2]}) {\n ${padSetup}\n result[2] = getChannel(getX(${source.join()}), ${innerDims});\n ${coords[rank - 1]} += 1;\n if(${cLimit}) {\n ${padSetup}\n result[3] = getChannel(getX(${source.join()}), ${innerDims});\n }\n }\n `;\n }\n\n this.userCode = `\n const ${dtype} start = ${dtype}(${start});\n const ${dtype} end = ${dtype}(${end});\n\n void main() {\n ${dtype} outputLoc = getOutputCoords();\n vec4 result = vec4(0.);\n ${mainLoop}\n setOutput(result);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env, KernelConfig, KernelFunc, MirrorPad, MirrorPadAttrs, MirrorPadInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {MirrorPadProgram} from '../mirror_pad_gpu';\nimport {MirrorPadPackedProgram} from '../mirror_pad_packed_gpu';\n\nexport const mirrorPadKernelFunc: (params: {\n inputs: MirrorPadInputs,\n backend: MathBackendWebGL,\n attrs: MirrorPadAttrs\n}) => TensorInfo = ({inputs, backend, attrs}) => {\n const {x} = inputs;\n const {paddings, mode} = attrs;\n\n const program = env().getBool('WEBGL_PACK_ARRAY_OPERATIONS') ?\n new MirrorPadPackedProgram(x.shape, paddings, mode) :\n new MirrorPadProgram(x.shape, paddings, mode);\n\n const output = backend.runWebGLProgram(program, [x], x.dtype);\n\n return output;\n};\n\nexport const mirrorPadConfig: KernelConfig = {\n kernelName: MirrorPad,\n backendName: 'webgl',\n kernelFunc: mirrorPadKernelFunc as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Mod} from '@tensorflow/tfjs-core';\n\nimport {CHECK_NAN_SNIPPET_PACKED} from '../binaryop_packed_gpu';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst MOD = `if (b == 0.0) return NAN;\n return mod(a, b);`;\n\nconst MOD_PACKED = `\n vec4 result = mod(a, b);\n bvec4 isNaN = equal(b, vec4(0.0));\n ` +\n CHECK_NAN_SNIPPET_PACKED + `\n return result;\n`;\n\nexport const mod = binaryKernelFunc({\n opSnippet: MOD,\n packedOpSnippet: MOD_PACKED,\n});\n\nexport const modConfig: KernelConfig = {\n kernelName: Mod,\n backendName: 'webgl',\n kernelFunc: mod as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {UniformType} from './shader_compiler';\n\nexport class MultinomialProgram implements GPGPUProgram {\n variableNames = ['probs'];\n outputShape: number[];\n userCode: string;\n customUniforms = [{name: 'seed', type: 'float' as UniformType}];\n\n constructor(batchSize: number, numOutcomes: number, numSamples: number) {\n this.outputShape = [batchSize, numSamples];\n\n this.userCode = `\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n\n float r = random(seed);\n float cdf = 0.0;\n\n for (int i = 0; i < ${numOutcomes - 1}; i++) {\n cdf += getProbs(batch, i);\n\n if (r < cdf) {\n setOutput(float(i));\n return;\n }\n }\n\n // If no other event happened, last event happened.\n setOutput(float(${numOutcomes - 1}));\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {RealDiv} from '@tensorflow/tfjs-core';\nimport {KernelConfig} from '@tensorflow/tfjs-core';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\n// Without the equality check div produces 0.9999 for a = b, which when\n// floored can cause errors.\nconst DIV = `\nif (a == b) {\n return 1.0;\n};\nreturn a / b;`;\n\n// We do the same as in ./binaryop_gpu, with vec4 and ivec4.\n// On Linux, the vectorized implementation produces NaNs when a and b are 0.\nconst DIV_PACKED = `\n // vec4 one = vec4(equal(a, b));\n // return one + (vec4(1.0) - one) * a / b;\n vec4 result = a / b;\n if(a.x == b.x) {\n result.x = 1.;\n }\n if(a.y == b.y) {\n result.y = 1.;\n }\n if(a.z == b.z) {\n result.z = 1.;\n }\n if(a.w == b.w) {\n result.w = 1.;\n }\n\n return result;\n`;\n\nexport const realDiv = binaryKernelFunc(\n {opSnippet: DIV, packedOpSnippet: DIV_PACKED, checkOutOfBounds: true});\n\nexport const realDivConfig: KernelConfig = {\n kernelName: RealDiv,\n backendName: 'webgl',\n kernelFunc: realDiv,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Sub} from '@tensorflow/tfjs-core';\n\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {subImplCPU as cpuSub} from '../kernel_utils/shared';\n\nconst SUB = 'return a - b;';\n\nexport const sub = binaryKernelFunc({\n opSnippet: SUB,\n packedOpSnippet: SUB,\n supportsComplex: true,\n cpuKernelImpl: cpuSub\n});\n\nexport const subConfig: KernelConfig = {\n kernelName: Sub,\n backendName: 'webgl',\n kernelFunc: sub\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, Softmax, SoftmaxAttrs, SoftmaxInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\n\nimport {exp} from './Exp';\nimport {max} from './Max';\nimport {realDiv} from './RealDiv';\nimport {reshape} from './Reshape';\nimport {sub} from './Sub';\nimport {sum} from './Sum';\n\nexport function softmax(args: {\n inputs: SoftmaxInputs,\n backend: MathBackendWebGL,\n attrs: SoftmaxAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {logits} = inputs;\n const {dim} = attrs;\n\n const axes = util.parseAxisParam([dim], logits.shape);\n\n const maxLogit = max({\n inputs: {x: logits},\n backend,\n attrs: {reductionIndices: axes, keepDims: false}\n });\n\n const expandedShape = backend_util.expandShapeToKeepDim(maxLogit.shape, axes);\n\n const maxLogitsReshaped =\n reshape({inputs: {x: maxLogit}, backend, attrs: {shape: expandedShape}});\n const a =\n sub({inputs: {a: logits, b: maxLogitsReshaped}, backend}) as TensorInfo;\n const b = exp({inputs: {x: a}, backend}) as TensorInfo;\n const sumExp =\n sum({inputs: {x: b}, backend, attrs: {axis: axes, keepDims: false}});\n const sumExpReshaped =\n reshape({inputs: {x: sumExp}, backend, attrs: {shape: expandedShape}});\n\n const res =\n realDiv({inputs: {a: b, b: sumExpReshaped}, backend}) as TensorInfo;\n\n backend.disposeIntermediateTensorInfo(maxLogit);\n backend.disposeIntermediateTensorInfo(maxLogitsReshaped);\n backend.disposeIntermediateTensorInfo(a);\n backend.disposeIntermediateTensorInfo(b);\n backend.disposeIntermediateTensorInfo(sumExp);\n backend.disposeIntermediateTensorInfo(sumExpReshaped);\n\n return res;\n}\n\nexport const softmaxConfig: KernelConfig = {\n kernelName: Softmax,\n backendName: 'webgl',\n kernelFunc: softmax as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Multinomial, MultinomialAttrs, MultinomialInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {MultinomialProgram} from '../multinomial_gpu';\n\nimport {softmax} from './Softmax';\n\nexport function multinomial(args: {\n inputs: MultinomialInputs,\n backend: MathBackendWebGL,\n attrs: MultinomialAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {logits} = inputs;\n const {numSamples, seed, normalized} = attrs;\n\n const probs = normalized ?\n logits :\n softmax(\n {inputs: {logits}, backend, attrs: {dim: logits.shape.length - 1}});\n const batchSize = probs.shape[0];\n const numOutcomes = probs.shape[1];\n const program = new MultinomialProgram(batchSize, numOutcomes, numSamples);\n const customValues = [[seed]];\n const res = backend.runWebGLProgram(program, [probs], 'int32', customValues);\n if (!normalized) {\n backend.disposeIntermediateTensorInfo(probs);\n }\n return res;\n}\n\nexport const multinomialConfig: KernelConfig = {\n kernelName: Multinomial,\n backendName: 'webgl',\n kernelFunc: multinomial as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env, KernelConfig, KernelFunc, Neg, NegInputs, TensorInfo, TypedArray} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {negImplCPU} from '../kernel_utils/shared';\nimport {CHECK_NAN_SNIPPET, UnaryOpProgram} from '../unaryop_gpu';\nimport {UnaryOpPackedProgram} from '../unaryop_packed_gpu';\n\nconst NEG = CHECK_NAN_SNIPPET + `\n return -x;\n`;\n\nconst NEG_PACKED = `\n vec4 result = -x;\n bvec4 isNaN = isnan(x);\n\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n`;\n\n// This doesn't use unaryKernelFunc because negImplCPU is not of type\n// SimpleUnaryKernelImplCPU.\nexport function neg(args: {inputs: NegInputs, backend: MathBackendWebGL}):\n TensorInfo {\n const {inputs, backend} = args;\n const {x} = inputs;\n\n if (backend.shouldExecuteOnCPU([x])) {\n const xData = backend.texData.get(x.dataId);\n const [outValues, newShape] =\n negImplCPU(xData.values as TypedArray, x.shape, x.dtype);\n return backend.makeTensorInfo(newShape, x.dtype, outValues);\n }\n\n let program: UnaryOpProgram|UnaryOpPackedProgram;\n if (env().getBool('WEBGL_PACK_UNARY_OPERATIONS')) {\n program = new UnaryOpPackedProgram(x.shape, NEG_PACKED);\n } else {\n program = new UnaryOpProgram(x.shape, NEG);\n }\n\n return backend.runWebGLProgram(program, [x], x.dtype);\n}\n\nexport const negConfig: KernelConfig = {\n kernelName: Neg,\n backendName: 'webgl',\n kernelFunc: neg as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, kernel_impls, KernelConfig, KernelFunc, NonMaxSuppressionV3, NonMaxSuppressionV3Attrs, NonMaxSuppressionV3Inputs, TypedArray} from '@tensorflow/tfjs-core';\n\nconst nonMaxSuppressionV3Impl = kernel_impls.nonMaxSuppressionV3Impl;\nimport {MathBackendWebGL} from '../backend_webgl';\n\nexport function nonMaxSuppressionV3(args: {\n inputs: NonMaxSuppressionV3Inputs,\n backend: MathBackendWebGL,\n attrs: NonMaxSuppressionV3Attrs\n}) {\n backend_util.warn(\n 'tf.nonMaxSuppression() in webgl locks the UI thread. ' +\n 'Call tf.nonMaxSuppressionAsync() instead');\n\n const {inputs, backend, attrs} = args;\n const {boxes, scores} = inputs;\n const {maxOutputSize, iouThreshold, scoreThreshold} = attrs;\n\n const boxesVals = backend.readSync(boxes.dataId) as TypedArray;\n const scoresVals = backend.readSync(scores.dataId) as TypedArray;\n\n const {selectedIndices} = nonMaxSuppressionV3Impl(\n boxesVals, scoresVals, maxOutputSize, iouThreshold, scoreThreshold);\n\n return backend.makeTensorInfo(\n [selectedIndices.length], 'int32', new Int32Array(selectedIndices));\n}\n\nexport const nonMaxSuppressionV3Config: KernelConfig = {\n kernelName: NonMaxSuppressionV3,\n backendName: 'webgl',\n kernelFunc: nonMaxSuppressionV3 as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, kernel_impls, KernelConfig, KernelFunc, NonMaxSuppressionV4, NonMaxSuppressionV4Attrs, NonMaxSuppressionV4Inputs, TensorInfo, TypedArray} from '@tensorflow/tfjs-core';\nconst nonMaxSuppressionV4Impl = kernel_impls.nonMaxSuppressionV4Impl;\n\nimport {MathBackendWebGL} from '../backend_webgl';\n\nexport function nonMaxSuppressionV4(args: {\n inputs: NonMaxSuppressionV4Inputs,\n backend: MathBackendWebGL,\n attrs: NonMaxSuppressionV4Attrs\n}): [TensorInfo, TensorInfo] {\n backend_util.warn(\n 'tf.nonMaxSuppression() in webgl locks the UI thread. ' +\n 'Call tf.nonMaxSuppressionAsync() instead');\n\n const {inputs, backend, attrs} = args;\n const {boxes, scores} = inputs;\n const {maxOutputSize, iouThreshold, scoreThreshold, padToMaxOutputSize} =\n attrs;\n\n const boxesVals = backend.readSync(boxes.dataId) as TypedArray;\n const scoresVals = backend.readSync(scores.dataId) as TypedArray;\n\n const {selectedIndices, validOutputs} = nonMaxSuppressionV4Impl(\n boxesVals, scoresVals, maxOutputSize, iouThreshold, scoreThreshold,\n padToMaxOutputSize);\n\n return [\n backend.makeTensorInfo(\n [selectedIndices.length], 'int32', new Int32Array(selectedIndices)),\n backend.makeTensorInfo([], 'int32', new Int32Array([validOutputs]))\n ];\n}\n\nexport const nonMaxSuppressionV4Config: KernelConfig = {\n kernelName: NonMaxSuppressionV4,\n backendName: 'webgl',\n kernelFunc: nonMaxSuppressionV4 as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, kernel_impls, KernelConfig, KernelFunc, NonMaxSuppressionV5, NonMaxSuppressionV5Attrs, NonMaxSuppressionV5Inputs, TensorInfo, TypedArray} from '@tensorflow/tfjs-core';\n\nconst nonMaxSuppressionV5Impl = kernel_impls.nonMaxSuppressionV5Impl;\nimport {MathBackendWebGL} from '../backend_webgl';\n\nexport function nonMaxSuppressionV5(args: {\n inputs: NonMaxSuppressionV5Inputs,\n backend: MathBackendWebGL,\n attrs: NonMaxSuppressionV5Attrs\n}): [TensorInfo, TensorInfo] {\n backend_util.warn(\n 'tf.nonMaxSuppression() in webgl locks the UI thread. ' +\n 'Call tf.nonMaxSuppressionAsync() instead');\n\n const {inputs, backend, attrs} = args;\n const {boxes, scores} = inputs;\n const {maxOutputSize, iouThreshold, scoreThreshold, softNmsSigma} = attrs;\n\n const boxesVals = backend.readSync(boxes.dataId) as TypedArray;\n const scoresVals = backend.readSync(scores.dataId) as TypedArray;\n\n const maxOutputSizeVal = maxOutputSize;\n const iouThresholdVal = iouThreshold;\n const scoreThresholdVal = scoreThreshold;\n const softNmsSigmaVal = softNmsSigma;\n\n const {selectedIndices, selectedScores} = nonMaxSuppressionV5Impl(\n boxesVals, scoresVals, maxOutputSizeVal, iouThresholdVal,\n scoreThresholdVal, softNmsSigmaVal);\n\n return [\n backend.makeTensorInfo(\n [selectedIndices.length], 'int32', new Int32Array(selectedIndices)),\n backend.makeTensorInfo(\n [selectedScores.length], 'float32', new Float32Array(selectedScores))\n ];\n}\n\nexport const nonMaxSuppressionV5Config: KernelConfig = {\n kernelName: NonMaxSuppressionV5,\n backendName: 'webgl',\n kernelFunc: nonMaxSuppressionV5 as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class OneHotProgram implements GPGPUProgram {\n variableNames = ['indices'];\n outputShape: number[];\n userCode: string;\n\n // Caching uniform location for speed.\n seedLoc: WebGLUniformLocation;\n\n constructor(\n numIndices: number, depth: number, onValue: number, offValue: number) {\n this.outputShape = [numIndices, depth];\n\n this.userCode = `\n void main() {\n ivec2 coords = getOutputCoords();\n int index = round(getIndices(coords.x));\n setOutput(mix(float(${offValue}), float(${onValue}),\n float(index == coords.y)));\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, OneHot, OneHotAttrs, OneHotInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {OneHotProgram} from '../onehot_gpu';\nimport {reshape} from './Reshape';\n\nexport const oneHot = (args: {\n inputs: OneHotInputs,\n backend: MathBackendWebGL,\n attrs: OneHotAttrs\n}): TensorInfo => {\n const {inputs, backend, attrs} = args;\n const {indices} = inputs;\n const {dtype, depth, onValue, offValue} = attrs;\n\n const indicesSize = util.sizeFromShape(indices.shape);\n const program = new OneHotProgram(indicesSize, depth, onValue, offValue);\n const reshaped =\n reshape({inputs: {x: indices}, backend, attrs: {shape: [indicesSize]}});\n const result = backend.runWebGLProgram(program, [reshaped], dtype);\n backend.disposeIntermediateTensorInfo(reshaped);\n\n const outShape = [...indices.shape, depth];\n const out = reshape({inputs: {x: result}, backend, attrs: {shape: outShape}});\n backend.disposeIntermediateTensorInfo(result);\n return out;\n};\n\nexport const oneHotConfig: KernelConfig = {\n kernelName: OneHot,\n backendName: 'webgl',\n kernelFunc: oneHot as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, TensorInfo, ZerosLike, ZerosLikeInputs} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\n\nimport {complex} from './Complex';\nimport {fill} from './Fill';\nimport {imag} from './Imag';\nimport {real} from './Real';\n\nexport function zerosLike(\n args: {inputs: ZerosLikeInputs, backend: MathBackendWebGL}): TensorInfo {\n const {inputs, backend} = args;\n const {x} = inputs;\n\n if (x.dtype === 'complex64') {\n const realPart = real({inputs: {input: x}, backend});\n const r = zerosLike({inputs: {x: realPart}, backend});\n const imagPart = imag({inputs: {input: x}, backend});\n const i = zerosLike({inputs: {x: imagPart}, backend});\n\n const result = complex({inputs: {real: r, imag: i}, backend});\n\n backend.disposeIntermediateTensorInfo(realPart);\n backend.disposeIntermediateTensorInfo(r);\n backend.disposeIntermediateTensorInfo(imagPart);\n backend.disposeIntermediateTensorInfo(i);\n\n return result;\n } else {\n return fill({\n attrs: {\n shape: x.shape,\n dtype: x.dtype,\n value: x.dtype === 'string' ? '' : 0\n },\n backend\n });\n }\n}\n\nexport const zerosLikeConfig: KernelConfig = {\n kernelName: ZerosLike,\n backendName: 'webgl',\n kernelFunc: zerosLike as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, OnesLike, OnesLikeInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\n\nimport {complex} from './Complex';\nimport {fill} from './Fill';\nimport {imag} from './Imag';\nimport {real} from './Real';\nimport {zerosLike} from './ZerosLike';\n\nexport function onesLike(\n args: {inputs: OnesLikeInputs, backend: MathBackendWebGL}): TensorInfo {\n const {inputs, backend} = args;\n const {x} = inputs;\n\n if (x.dtype === 'string') {\n throw new Error('onesLike is not supported under string dtype');\n } else if (x.dtype === 'complex64') {\n const realPart = real({inputs: {input: x}, backend});\n const r = onesLike({inputs: {x: realPart}, backend});\n const imagPart = imag({inputs: {input: x}, backend});\n const i = zerosLike({inputs: {x: imagPart}, backend});\n\n const result = complex({inputs: {real: r, imag: i}, backend});\n\n backend.disposeIntermediateTensorInfo(realPart);\n backend.disposeIntermediateTensorInfo(r);\n backend.disposeIntermediateTensorInfo(imagPart);\n backend.disposeIntermediateTensorInfo(i);\n\n return result;\n } else {\n // TODO(cais, smilkov): Add WebGL shader for onesLike:\n // https://github.com/tensorflow/tfjs/issues/1293\n return fill({attrs: {shape: x.shape, dtype: x.dtype, value: 1}, backend});\n }\n}\n\nexport const onesLikeConfig: KernelConfig = {\n kernelName: OnesLike,\n backendName: 'webgl',\n kernelFunc: onesLike as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Pack, PackAttrs, PackInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {concat} from './Concat';\nimport {expandDims} from './ExpandDims';\n\nexport function pack(\n args: {inputs: PackInputs, backend: MathBackendWebGL, attrs: PackAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {axis} = attrs;\n\n if (inputs.length === 1) {\n return expandDims(\n {inputs: {input: inputs[0]}, backend, attrs: {dim: axis}});\n }\n\n const shape = inputs[0].shape;\n const dtype = inputs[0].dtype;\n\n inputs.forEach(t => {\n util.assertShapesMatch(\n shape, t.shape,\n 'All tensors passed to stack must have matching shapes');\n util.assert(\n dtype === t.dtype,\n () => 'All tensors passed to stack must have matching dtypes');\n });\n\n const intermediateTensorInfos: TensorInfo[] = [];\n const expandedTensors = inputs.map(t => {\n const expandedT =\n expandDims({inputs: {input: t}, backend, attrs: {dim: axis}});\n intermediateTensorInfos.push(expandedT);\n return expandedT;\n });\n\n const result = concat({inputs: expandedTensors, backend, attrs: {axis}});\n\n intermediateTensorInfos.forEach(\n t => backend.disposeIntermediateTensorInfo(t));\n\n return result;\n}\n\nexport const packConfig: KernelConfig = {\n kernelName: Pack,\n backendName: 'webgl',\n kernelFunc: pack as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {getCoordsDataType, UniformType} from './shader_compiler';\n\nexport class PadProgram implements GPGPUProgram {\n variableNames = ['x'];\n outputShape: number[];\n userCode: string;\n customUniforms = [{name: 'value', type: 'float' as UniformType}];\n\n constructor(\n xShape: number[], paddings: Array<[number, number]>,\n constantValue: number) {\n this.outputShape = paddings.map(\n (p, i) => p[0] /* beforePad */ + xShape[i] + p[1] /* afterPad */);\n const rank = xShape.length;\n const type = getCoordsDataType(rank);\n\n const start = paddings.map(p => p[0]).join(',');\n const end = paddings.map((p, i) => p[0] + xShape[i]).join(',');\n const unpackedCoords =\n ['coords[0]', 'coords[1]', 'coords[2]', 'coords[3]'].slice(0, rank);\n\n if (rank === 1) {\n this.userCode = `\n int start = ${start};\n int end = ${end};\n\n void main() {\n int outC = getOutputCoords();\n if (outC < start || outC >= end) {\n setOutput(value);\n } else {\n setOutput(getX(outC - start));\n }\n }\n `;\n return;\n }\n this.userCode = `\n ${type} start = ${type}(${start});\n ${type} end = ${type}(${end});\n\n void main() {\n ${type} outC = getOutputCoords();\n if (any(lessThan(outC, start)) || any(greaterThanEqual(outC, end))) {\n setOutput(value);\n } else {\n ${type} coords = outC - start;\n setOutput(getX(${unpackedCoords}));\n }\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {getChannels} from './packing_util';\nimport {getCoordsDataType, UniformType} from './shader_compiler';\n\nexport class PadPackedProgram implements GPGPUProgram {\n variableNames = ['x'];\n packedInputs = true;\n packedOutput = true;\n outputShape: number[];\n userCode: string;\n customUniforms = [{name: 'value', type: 'float' as UniformType}];\n\n constructor(\n xShape: number[], paddings: Array<[number, number]>,\n constantValue: number) {\n this.outputShape = paddings.map(\n (p, i) => p[0] /* beforePad */ + xShape[i] + p[1] /* afterPad */);\n const rank = xShape.length;\n const dtype = getCoordsDataType(rank);\n\n const start = paddings.map(p => p[0]).join(',');\n const end = paddings.map((p, i) => p[0] + xShape[i]).join(',');\n const coords = getChannels('rc', rank);\n const source = getChannels('source', rank);\n const cLimit = `${coords[rank - 1]} < ${this.outputShape[rank - 1]}`;\n const innerDims =\n rank === 1 ? 'source' : `vec2(${source.slice(-2).join()})`;\n\n const componentSetup = [\n `${dtype} rc = outputLoc;`, `${coords[rank - 1]} += 1;\n if(${cLimit}) {\n `,\n rank === 1 ? '' : `}\n rc = outputLoc;\n ${coords[rank - 2]} += 1;\n if(${coords[rank - 2]} < ${this.outputShape[rank - 2]}) {`,\n rank === 1 ? '' : ` ${coords[rank - 1]} += 1;\n if(${cLimit}) {`\n ];\n\n const paddingArea = rank === 1 ?\n 'rc < start || rc >= end' :\n 'any(lessThan(rc, start)) || any(greaterThanEqual(rc, end))';\n let mainLoop = '';\n for (let i = 0, j = rank === 1 ? 2 : 4; i < j; i++) {\n mainLoop += `\n ${componentSetup[i]}\n if (${paddingArea}) {\n result[${i}] = float(value);\n } else {\n ${dtype} source = rc - start;\n result[${i}] = getChannel(getX(${source.join()}), ${innerDims});\n }\n `;\n }\n mainLoop += (rank === 1 ? `} ` : `}}`);\n\n this.userCode = `\n const ${dtype} start = ${dtype}(${start});\n const ${dtype} end = ${dtype}(${end});\n\n void main() {\n ${dtype} outputLoc = getOutputCoords();\n vec4 result = vec4(0.);\n ${mainLoop}\n setOutput(result);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env, KernelConfig, KernelFunc, PadV2, PadV2Attrs, PadV2Inputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {PadProgram} from '../pad_gpu';\nimport {PadPackedProgram} from '../pad_packed_gpu';\nimport {fill} from './Fill';\n\nexport const padV2 =\n (args: {inputs: PadV2Inputs, backend: MathBackendWebGL, attrs: PadV2Attrs}):\n TensorInfo => {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {paddings, constantValue} = attrs;\n\n if (util.sizeFromShape(x.shape) === 0) {\n // Short-circuit the computation, since x doesn't have value, only\n // the shape is used to compute output shape to pad.\n const outputShape = paddings.map(\n (p, i) =>\n p[0] /* beforePad */ + x.shape[i] + p[1] /* afterPad */);\n return fill({\n backend,\n attrs: {shape: outputShape, value: constantValue, dtype: x.dtype}\n });\n }\n\n const program = env().getBool('WEBGL_PACK_ARRAY_OPERATIONS') ?\n new PadPackedProgram(x.shape, paddings, constantValue) :\n new PadProgram(x.shape, paddings, constantValue);\n const customValues = [[constantValue]];\n return backend.runWebGLProgram(program, [x], x.dtype, customValues);\n };\n\nexport const padV2Config: KernelConfig = {\n kernelName: PadV2,\n backendName: 'webgl',\n kernelFunc: padV2 as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Pow} from '@tensorflow/tfjs-core';\n\nimport {CHECK_NAN_SNIPPET_PACKED} from '../binaryop_packed_gpu';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst POW = `\n if(a < 0.0 && floor(b) < b){\n return NAN;\n }\n if (b == 0.0) {\n return 1.0;\n }\n return (round(mod(b, 2.0)) != 1) ?\n pow(abs(a), b) : sign(a) * pow(abs(a), b);\n`;\n\nconst POW_PACKED = `\n // isModRound1 has 1 for components with round(mod(b, 2.0)) == 1, 0 otherwise.\n vec4 isModRound1 = vec4(equal(round(mod(b, 2.0)), ivec4(1)));\n vec4 multiplier = sign(a) * isModRound1 + (vec4(1.0) - isModRound1);\n vec4 result = multiplier * pow(abs(a), b);\n\n // Ensure that a^0 = 1, including 0^0 = 1 as this correspond to TF and JS\n bvec4 isExpZero = equal(b, vec4(0.0));\n result.r = isExpZero.r ? 1.0 : result.r;\n result.g = isExpZero.g ? 1.0 : result.g;\n result.b = isExpZero.b ? 1.0 : result.b;\n result.a = isExpZero.a ? 1.0 : result.a;\n\n bvec4 isNaN1 = lessThan(a, vec4(0.0));\n bvec4 isNaN2 = lessThan(floor(b), b);\n bvec4 isNaN = bvec4(isNaN1.x && isNaN2.x, isNaN1.y && isNaN2.y, isNaN1.z && isNaN2.z, isNaN1.w && isNaN2.w);\n ` +\n CHECK_NAN_SNIPPET_PACKED + `\n return result;\n`;\n\nexport const pow =\n binaryKernelFunc({opSnippet: POW, packedOpSnippet: POW_PACKED});\n\nexport const powConfig: KernelConfig = {\n kernelName: Pow,\n backendName: 'webgl',\n kernelFunc: pow as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, Prod, ProdAttrs, ProdInputs, sumOutType, TensorInfo, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {reduce} from '../kernel_utils/reduce';\nimport {prodImplCPU} from '../kernel_utils/shared';\n\nimport {reshape} from './Reshape';\nimport {transpose} from './Transpose';\n\nexport function prod(\n args: {inputs: ProdInputs, backend: MathBackendWebGL, attrs: ProdAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {axis, keepDims} = attrs;\n\n const xRank = x.shape.length;\n const toDispose = [];\n\n const origAxes = util.parseAxisParam(axis, x.shape);\n let axes = origAxes;\n const permutedAxes = backend_util.getAxesPermutation(axes, xRank);\n let permutedX = x;\n if (permutedAxes != null) {\n permutedX = transpose({inputs: {x}, backend, attrs: {perm: permutedAxes}});\n axes = backend_util.getInnerMostAxes(axes.length, xRank);\n toDispose.push(permutedX);\n }\n\n backend_util.assertAxesAreInnerMostDims('prod', axes, xRank);\n\n let res;\n if (backend.shouldExecuteOnCPU([permutedX])) {\n const xVals = backend.texData.get(permutedX.dataId).values as TypedArray;\n const {outVals, outShape, outDtype} =\n prodImplCPU(permutedX.shape, permutedX.dtype, xVals, axes);\n res = backend.makeTensorInfo(outShape, outDtype, outVals);\n } else {\n const [outShape, reduceShape] =\n backend_util.computeOutAndReduceShapes(permutedX.shape, axes);\n const inSize = util.sizeFromShape(reduceShape);\n const a2D = reshape(\n {inputs: {x: permutedX}, backend, attrs: {shape: [-1, inSize]}});\n const outputDType = sumOutType(x.dtype);\n const reduced = reduce(a2D, outputDType, 'prod', backend);\n res = reshape({inputs: {x: reduced}, backend, attrs: {shape: outShape}});\n\n toDispose.push(a2D);\n toDispose.push(reduced);\n }\n\n if (keepDims) {\n toDispose.push(res);\n const newShape = backend_util.expandShapeToKeepDim(res.shape, origAxes);\n res = reshape({inputs: {x: res}, backend, attrs: {shape: newShape}});\n }\n\n toDispose.forEach(t => backend.disposeIntermediateTensorInfo(t));\n\n return res;\n}\n\nexport const prodConfig: KernelConfig = {\n kernelName: Prod,\n backendName: 'webgl',\n kernelFunc: prod as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, RaggedGather, RaggedGatherAttrs, RaggedGatherInputs, TensorInfo, TypedArray} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {raggedGatherImplCPU} from '../kernel_utils/shared';\n\nexport function raggedGather(args: {\n inputs: RaggedGatherInputs,\n backend: MathBackendWebGL,\n attrs: RaggedGatherAttrs\n}): TensorInfo[] {\n const {inputs, backend, attrs} = args;\n const {paramsNestedSplits, paramsDenseValues, indices} = inputs;\n const {outputRaggedRank} = attrs;\n\n const $paramsNestedSplits =\n paramsNestedSplits.map(t => backend.readSync(t.dataId) as TypedArray);\n const $paramsNestedSplitsShapes = paramsNestedSplits.map(t => t.shape);\n const $paramsDenseValues =\n backend.readSync(paramsDenseValues.dataId) as TypedArray;\n const $indices = backend.readSync(indices.dataId) as TypedArray;\n\n const [outputNestedSplits, outputDenseValues, outputDenseValuesShape] =\n raggedGatherImplCPU(\n $paramsNestedSplits, $paramsNestedSplitsShapes, $paramsDenseValues,\n paramsDenseValues.shape, paramsDenseValues.dtype, $indices,\n indices.shape, outputRaggedRank);\n\n const outputNestedSplitsTensors = outputNestedSplits.map(\n (splits) => backend.makeTensorInfo([splits.length], 'int32', splits));\n\n const outputDenseValuesTensor = backend.makeTensorInfo(\n outputDenseValuesShape, paramsDenseValues.dtype, outputDenseValues);\n\n return outputNestedSplitsTensors.concat([outputDenseValuesTensor]);\n}\n\nexport const raggedGatherConfig: KernelConfig = {\n kernelName: RaggedGather,\n backendName: 'webgl',\n kernelFunc: raggedGather as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, RaggedRange, RaggedRangeInputs, TensorInfo, TypedArray} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {raggedRangeImplCPU} from '../kernel_utils/shared';\n\nexport function raggedRange(\n args: {inputs: RaggedRangeInputs, backend: MathBackendWebGL}):\n [TensorInfo, TensorInfo] {\n const {inputs, backend} = args;\n const {starts, limits, deltas} = inputs;\n\n const $starts = backend.readSync(starts.dataId) as TypedArray;\n const $limits = backend.readSync(limits.dataId) as TypedArray;\n const $deltas = backend.readSync(deltas.dataId) as TypedArray;\n\n const [rtNestedSplitsData, rtDenseValuesData] = raggedRangeImplCPU(\n $starts, starts.shape, starts.dtype, $limits, limits.shape, $deltas,\n deltas.shape);\n\n const rtNestedSplits = backend.makeTensorInfo(\n [rtNestedSplitsData.length], 'int32', rtNestedSplitsData);\n const rtDenseValues = backend.makeTensorInfo(\n [rtDenseValuesData.length], starts.dtype, rtDenseValuesData);\n\n return [rtNestedSplits, rtDenseValues];\n}\n\nexport const raggedRangeConfig: KernelConfig = {\n kernelName: RaggedRange,\n backendName: 'webgl',\n kernelFunc: raggedRange as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, RaggedTensorToTensor, RaggedTensorToTensorAttrs, RaggedTensorToTensorInputs, TensorInfo, TypedArray} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {raggedTensorToTensorImplCPU} from '../kernel_utils/shared';\n\nexport function raggedTensorToTensor(args: {\n inputs: RaggedTensorToTensorInputs,\n backend: MathBackendWebGL,\n attrs: RaggedTensorToTensorAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {shape, values, defaultValue, rowPartitionTensors} = inputs;\n const {rowPartitionTypes} = attrs;\n\n const $shape = backend.readSync(shape.dataId) as TypedArray;\n const $values = backend.readSync(values.dataId) as TypedArray;\n const $defaultValue = backend.readSync(defaultValue.dataId) as TypedArray;\n const $rowPartitionValues =\n rowPartitionTensors.map(t => backend.readSync(t.dataId) as TypedArray);\n const rowPartitionValuesShapes = rowPartitionTensors.map(t => t.shape);\n\n const [outputShape, output] = raggedTensorToTensorImplCPU(\n $shape, shape.shape, $values, values.shape, values.dtype, $defaultValue,\n defaultValue.shape, $rowPartitionValues, rowPartitionValuesShapes,\n rowPartitionTypes);\n return backend.makeTensorInfo(outputShape, values.dtype, output);\n}\n\nexport const raggedTensorToTensorConfig: KernelConfig = {\n kernelName: RaggedTensorToTensor,\n backendName: 'webgl',\n kernelFunc: raggedTensorToTensor as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Range, RangeAttrs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {rangeImplCPU} from '../kernel_utils/shared';\n\nexport const range =\n (args: {backend: MathBackendWebGL, attrs: RangeAttrs}): TensorInfo => {\n const {backend, attrs} = args;\n const {start, stop, step, dtype} = attrs;\n const values = rangeImplCPU(start, stop, step, dtype);\n return backend.makeTensorInfo([values.length], dtype, values);\n };\n\nexport const rangeConfig: KernelConfig = {\n kernelName: Range,\n backendName: 'webgl',\n kernelFunc: range as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Reciprocal} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst RECIPROCAL = `return 1.0 / x;`;\n\nexport const reciprocal = unaryKernelFunc({opSnippet: RECIPROCAL});\n\nexport const reciprocalConfig: KernelConfig = {\n kernelName: Reciprocal,\n backendName: 'webgl',\n kernelFunc: reciprocal,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Relu} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {CHECK_NAN_SNIPPET} from '../unaryop_gpu';\n\nconst RELU = CHECK_NAN_SNIPPET + `\n return (x < 0.0) ? 0.0 : x;\n`;\n\nconst RELU_PACKED = `\n vec4 result = x * vec4(greaterThanEqual(x, vec4(0.0)));\n bvec4 isNaN = isnan(x);\n\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n`;\n\nexport const relu =\n unaryKernelFunc({opSnippet: RELU, packedOpSnippet: RELU_PACKED});\n\nexport const reluConfig: KernelConfig = {\n kernelName: Relu,\n backendName: 'webgl',\n kernelFunc: relu as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Relu6} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {CHECK_NAN_SNIPPET} from '../unaryop_gpu';\n\nconst RELU6 = CHECK_NAN_SNIPPET + `\n return (x < 0.0) ? 0.0 : min(6.0, x);\n`;\n\nconst RELU6_PACKED = `\n vec4 result = min(x, vec4(6.)) * vec4(greaterThanEqual(x, vec4(0.0)));\n bvec4 isNaN = isnan(x);\n\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n`;\n\nexport const relu6 =\n unaryKernelFunc({opSnippet: RELU6, packedOpSnippet: RELU6_PACKED});\n\nexport const relu6Config: KernelConfig = {\n kernelName: Relu6,\n backendName: 'webgl',\n kernelFunc: relu6 as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class ResizeBilinearProgram implements GPGPUProgram {\n variableNames = ['A'];\n outputShape: number[] = [];\n userCode: string;\n\n constructor(\n inputShape: [number, number, number, number], newHeight: number,\n newWidth: number, alignCorners: boolean, halfPixelCenters: boolean) {\n const [batch, oldHeight, oldWidth, depth] = inputShape;\n this.outputShape = [batch, newHeight, newWidth, depth];\n\n const effectiveInSize: [number, number] = [\n (alignCorners && newHeight > 1) ? oldHeight - 1 : oldHeight,\n (alignCorners && newWidth > 1) ? oldWidth - 1 : oldWidth\n ];\n\n const effectiveOutSize: [number, number] = [\n (alignCorners && newHeight > 1) ? newHeight - 1 : newHeight,\n (alignCorners && newWidth > 1) ? newWidth - 1 : newWidth\n ];\n\n let sourceFracIndexRC: string;\n if (halfPixelCenters) {\n sourceFracIndexRC =\n `(vec2(yRC) + vec2(0.5)) * effectiveInputOverOutputRatioRC` +\n ` - vec2(0.5)`;\n } else {\n sourceFracIndexRC = `vec2(yRC) * effectiveInputOverOutputRatioRC`;\n }\n\n this.userCode = `\n const vec2 effectiveInputOverOutputRatioRC = vec2(\n ${effectiveInSize[0] / effectiveOutSize[0]},\n ${effectiveInSize[1] / effectiveOutSize[1]});\n const vec2 inputShapeRC = vec2(${oldHeight}.0, ${oldWidth}.0);\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n ivec2 yRC = coords.yz;\n\n // Fractional source index.\n vec2 sourceFracIndexRC = ${sourceFracIndexRC};\n\n // Compute the four integer indices.\n ivec2 sourceFloorRC = ivec2(max(sourceFracIndexRC, vec2(0.0)));\n ivec2 sourceCeilRC = ivec2(\n min(inputShapeRC - 1.0, ceil(sourceFracIndexRC)));\n\n float topLeft = getA(b, sourceFloorRC.x, sourceFloorRC.y, d);\n float bottomLeft = getA(b, sourceCeilRC.x, sourceFloorRC.y, d);\n float topRight = getA(b, sourceFloorRC.x, sourceCeilRC.y, d);\n float bottomRight = getA(b, sourceCeilRC.x, sourceCeilRC.y, d);\n\n vec2 fracRC = sourceFracIndexRC - vec2(sourceFloorRC);\n\n float top = topLeft + (topRight - topLeft) * fracRC.y;\n float bottom = bottomLeft + (bottomRight - bottomLeft) * fracRC.y;\n float newValue = top + (bottom - top) * fracRC.x;\n\n setOutput(newValue);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class ResizeBilinearPackedProgram implements GPGPUProgram {\n variableNames = ['A'];\n packedInputs = true;\n packedOutput = true;\n outputShape: number[] = [];\n userCode: string;\n\n constructor(\n inputShape: [number, number, number, number], newHeight: number,\n newWidth: number, alignCorners: boolean, halfPixelCenters: boolean) {\n const [batch, oldHeight, oldWidth, depth] = inputShape;\n this.outputShape = [batch, newHeight, newWidth, depth];\n\n const effectiveInSize: [number, number] = [\n (alignCorners && newHeight > 1) ? oldHeight - 1 : oldHeight,\n (alignCorners && newWidth > 1) ? oldWidth - 1 : oldWidth\n ];\n\n const effectiveOutSize: [number, number] = [\n (alignCorners && newHeight > 1) ? newHeight - 1 : newHeight,\n (alignCorners && newWidth > 1) ? newWidth - 1 : newWidth\n ];\n\n let sourceFracIndexRC: string;\n if (halfPixelCenters) {\n sourceFracIndexRC = `(vec3(yRC) + vec3(0.5)) * ` +\n `effectiveInputOverOutputRatioRC - vec3(0.5)`;\n } else {\n sourceFracIndexRC = `vec3(yRC) * effectiveInputOverOutputRatioRC`;\n }\n\n this.userCode = `\n const vec3 effectiveInputOverOutputRatioRC = vec3(\n ${effectiveInSize[0] / effectiveOutSize[0]},\n ${effectiveInSize[1] / effectiveOutSize[1]},\n ${effectiveInSize[1] / effectiveOutSize[1]});\n const vec3 inputShapeRC = vec3(${oldHeight}.0, ${oldWidth}.0,\n ${oldWidth}.0);\n\n float getAValue(int b, int r, int c, int d) {\n return getChannel(getA(b, r, c, d), vec2(c, d));\n }\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n // Calculate values for next column in yRC.z.\n ivec3 yRC = coords.yzz + ivec3(0, 0, 1);\n\n // Fractional source index.\n vec3 sourceFracIndexRC = ${sourceFracIndexRC};\n\n // Compute the four integer indices.\n ivec3 sourceFloorRC = ivec3(max(sourceFracIndexRC, vec3(0.0)));\n ivec3 sourceCeilRC = ivec3(\n min(inputShapeRC - 1.0, ceil(sourceFracIndexRC)));\n\n // Should we calculate next column and row elements in 2x2 packed cell.\n bool hasNextCol = d < ${depth - 1};\n bool hasNextRow = coords.z < ${newWidth - 1};\n\n // In parallel, construct four corners for all four components in\n // packed 2x2 cell.\n vec4 topLeft = vec4(\n getAValue(b, sourceFloorRC.x, sourceFloorRC.y, d),\n hasNextCol ? getAValue(b, sourceFloorRC.x, sourceFloorRC.y, d + 1)\n : 0.0,\n hasNextRow ? getAValue(b, sourceFloorRC.x, sourceFloorRC.z, d)\n : 0.0,\n (hasNextRow && hasNextCol) ?\n getAValue(b, sourceFloorRC.x, sourceFloorRC.z, d + 1) : 0.0);\n\n vec4 bottomLeft = vec4(\n getAValue(b, sourceCeilRC.x, sourceFloorRC.y, d),\n hasNextCol ? getAValue(b, sourceCeilRC.x, sourceFloorRC.y, d + 1)\n : 0.0,\n hasNextRow ? getAValue(b, sourceCeilRC.x, sourceFloorRC.z, d)\n : 0.0,\n (hasNextRow && hasNextCol) ?\n getAValue(b, sourceCeilRC.x, sourceFloorRC.z, d + 1) : 0.0);\n\n vec4 topRight = vec4(\n getAValue(b, sourceFloorRC.x, sourceCeilRC.y, d),\n hasNextCol ? getAValue(b, sourceFloorRC.x, sourceCeilRC.y, d + 1)\n : 0.0,\n hasNextRow ? getAValue(b, sourceFloorRC.x, sourceCeilRC.z, d)\n : 0.0,\n (hasNextRow && hasNextCol) ?\n getAValue(b, sourceFloorRC.x, sourceCeilRC.z, d + 1) : 0.0);\n\n vec4 bottomRight = vec4(\n getAValue(b, sourceCeilRC.x, sourceCeilRC.y, d),\n hasNextCol ? getAValue(b, sourceCeilRC.x, sourceCeilRC.y, d + 1)\n : 0.0,\n hasNextRow ? getAValue(b, sourceCeilRC.x, sourceCeilRC.z, d)\n : 0.0,\n (hasNextRow && hasNextCol) ?\n getAValue(b, sourceCeilRC.x, sourceCeilRC.z, d + 1) : 0.0);\n\n vec3 fracRC = sourceFracIndexRC - vec3(sourceFloorRC);\n\n vec4 top = mix(topLeft, topRight, fracRC.yyzz);\n vec4 bottom = mix(bottomLeft, bottomRight, fracRC.yyzz);\n vec4 newValue = mix(top, bottom, fracRC.x);\n\n setOutput(newValue);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env, KernelConfig, KernelFunc, ResizeBilinear, ResizeBilinearAttrs, ResizeBilinearInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {ResizeBilinearProgram} from '../resize_bilinear_gpu';\nimport {ResizeBilinearPackedProgram} from '../resize_bilinear_packed_gpu';\n\nexport function resizeBilinear(args: {\n inputs: ResizeBilinearInputs,\n backend: MathBackendWebGL,\n attrs: ResizeBilinearAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {images} = inputs;\n const {alignCorners, halfPixelCenters, size} = attrs;\n\n const [newHeight, newWidth] = size;\n\n const program = env().getBool('WEBGL_PACK_IMAGE_OPERATIONS') ?\n new ResizeBilinearPackedProgram(\n images.shape as [number, number, number, number], newHeight, newWidth,\n alignCorners, halfPixelCenters) :\n new ResizeBilinearProgram(\n images.shape as [number, number, number, number], newHeight, newWidth,\n alignCorners, halfPixelCenters);\n return backend.runWebGLProgram(program, [images], 'float32');\n}\n\nexport const resizeBilinearConfig: KernelConfig = {\n kernelName: ResizeBilinear,\n backendName: 'webgl',\n kernelFunc: resizeBilinear as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class ResizeBilinearBackpropProgram implements GPGPUProgram {\n variableNames = ['dy'];\n outputShape: number[] = [];\n userCode: string;\n\n constructor(\n dyShape: [number, number, number, number],\n inputShape: [number, number, number, number], alignCorners: boolean) {\n this.outputShape = inputShape;\n const [, xHeight, xWidth, ] = inputShape;\n const [, yHeight, yWidth] = dyShape;\n\n // In the backwards pass, we want to find the pixels that were generated for\n // each pixel in the input image the forward pass and add the corresponding\n // coefficient from dy to the gradient (with some interpolation).\n\n const effectiveXSize: [number, number] = [\n (alignCorners && yHeight > 1) ? xHeight - 1 : xHeight,\n (alignCorners && yWidth > 1) ? xWidth - 1 : xWidth\n ];\n\n const effectiveYSize: [number, number] = [\n (alignCorners && yHeight > 1) ? yHeight - 1 : yHeight,\n (alignCorners && yWidth > 1) ? yWidth - 1 : yWidth\n ];\n\n const heightScale = effectiveXSize[0] / effectiveYSize[0];\n const widthScale = effectiveXSize[1] / effectiveYSize[1];\n\n const invHeightScale = 1 / heightScale;\n const invWidthScale = 1 / widthScale;\n\n // This defines the size of the window of values around a particular\n // index in dy that we want to search for contributions to dx.\n const winHeight = (Math.ceil(invHeightScale) * 2) + 2;\n const winWidth = (Math.ceil(invWidthScale) * 2) + 2;\n\n this.userCode = `\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n int r = coords[1];\n int c = coords[2];\n\n float accumulator = 0.0;\n\n const float heightScale = float(${heightScale});\n const float widthScale = float(${widthScale});\n\n const float invHeightScale = float(${invHeightScale});\n const float invWidthScale = float(${invWidthScale});\n\n const int winHeight = int(${winHeight});\n const int winWidth = int(${winWidth});\n\n // Compute bounds for where in dy we will look\n float startRLerp = floor(float(r) * invHeightScale);\n int startDyR = int(startRLerp - float(winHeight / 2));\n\n float startCLerp = floor(float(c) * invWidthScale);\n int startDyC = int(startCLerp - float(winWidth / 2));\n\n // Loop over dy\n for (int dyROffset = 0; dyROffset < winHeight; dyROffset++) {\n int dyR = dyROffset + startDyR;\n\n // Guard against the window exceeding the bounds of dy\n if (dyR < 0 || dyR >= ${yHeight}) {\n continue;\n }\n\n for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) {\n int dyC = dyCOffset + startDyC;\n\n // Guard against the window exceeding the bounds of dy\n if (dyC < 0 || dyC >= ${yWidth}) {\n continue;\n }\n\n float dxR = float(dyR) * heightScale;\n int topDxRIndex = int(floor(dxR));\n int bottomDxRIndex = int(min(ceil(dxR), ${xHeight - 1}.0));\n float dxRLerp = dxR - float(topDxRIndex);\n float inverseDxRLerp = 1.0 - dxRLerp;\n\n float dxC = float(dyC) * widthScale;\n int leftDxCIndex = int(floor(dxC));\n int rightDxCIndex = int(min(ceil(dxC), ${xWidth - 1}.0));\n float dxCLerp = dxC - float(leftDxCIndex);\n float inverseDxCLerp = 1.0 - dxCLerp;\n\n if (r == topDxRIndex && c == leftDxCIndex) {\n // topLeft\n accumulator +=\n getDy(b, dyR, dyC, d) * inverseDxRLerp * inverseDxCLerp;\n }\n\n if (r == topDxRIndex && c == rightDxCIndex) {\n // topRight\n accumulator += getDy(b, dyR, dyC, d) * inverseDxRLerp * dxCLerp;\n }\n\n if (r == bottomDxRIndex && c == leftDxCIndex) {\n // bottomLeft\n accumulator += getDy(b, dyR, dyC, d) * dxRLerp * inverseDxCLerp;\n }\n\n if (r == bottomDxRIndex && c == rightDxCIndex) {\n // bottomRight\n accumulator += getDy(b, dyR, dyC, d) * dxRLerp * dxCLerp;\n }\n }\n }\n // End loop over dy\n\n setOutput(accumulator);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, ResizeBilinearGrad, ResizeBilinearGradAttrs, ResizeBilinearGradInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {ResizeBilinearBackpropProgram} from '../resize_bilinear_backprop_gpu';\n\nexport function resizeBilinearGrad(args: {\n inputs: ResizeBilinearGradInputs,\n backend: MathBackendWebGL,\n attrs: ResizeBilinearGradAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {images, dy} = inputs;\n const {alignCorners} = attrs;\n\n const program = new ResizeBilinearBackpropProgram(\n dy.shape as [number, number, number, number],\n images.shape as [number, number, number, number], alignCorners);\n\n return backend.runWebGLProgram(program, [dy], dy.dtype);\n}\n\nexport const resizeBilinearGradConfig: KernelConfig = {\n kernelName: ResizeBilinearGrad,\n backendName: 'webgl',\n kernelFunc: resizeBilinearGrad as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class ResizeNearestNeighborProgram implements GPGPUProgram {\n variableNames = ['A'];\n outputShape: number[] = [];\n userCode: string;\n\n constructor(\n inputShape: [number, number, number, number], newHeight: number,\n newWidth: number, alignCorners: boolean, halfPixelCenters: boolean) {\n const [batch, oldHeight, oldWidth, depth] = inputShape;\n this.outputShape = [batch, newHeight, newWidth, depth];\n\n const effectiveInSize: [number, number] = [\n (alignCorners && newHeight > 1) ? oldHeight - 1 : oldHeight,\n (alignCorners && newWidth > 1) ? oldWidth - 1 : oldWidth\n ];\n\n const effectiveOutSize: [number, number] = [\n (alignCorners && newHeight > 1) ? newHeight - 1 : newHeight,\n (alignCorners && newWidth > 1) ? newWidth - 1 : newWidth\n ];\n\n // When align corners is false, we rounds the value with floor.\n const roundBase = alignCorners ? '0.5' : '0.0';\n\n let sourceFracIndexRC: string;\n if (halfPixelCenters) {\n sourceFracIndexRC =\n `max((vec2(yRC) + vec2(0.5)) * effectiveInputOverOutputRatioRC` +\n `, vec2(0.0))`;\n } else {\n sourceFracIndexRC = `vec2(yRC) * effectiveInputOverOutputRatioRC`;\n }\n this.userCode = `\n const vec2 effectiveInputOverOutputRatioRC = vec2(\n ${effectiveInSize[0] / effectiveOutSize[0]},\n ${effectiveInSize[1] / effectiveOutSize[1]});\n const vec2 inputShapeRC = vec2(${oldHeight}.0, ${oldWidth}.0);\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n ivec2 yRC = coords.yz;\n\n // Fractional source index.\n vec2 sourceFracIndexRC = ${sourceFracIndexRC};\n\n // Compute the coordinators of nearest neighbor point.\n ivec2 sourceNearestRC = ivec2(\n min(inputShapeRC - 1.0, floor(sourceFracIndexRC + ${roundBase})));\n float newValue = getA(b, sourceNearestRC.x, sourceNearestRC.y, d);\n\n setOutput(newValue);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class ResizeNearestNeighborPackedProgram implements GPGPUProgram {\n variableNames = ['A'];\n packedInputs = true;\n packedOutput = true;\n outputShape: number[] = [];\n userCode: string;\n\n constructor(\n inputShape: [number, number, number, number], newHeight: number,\n newWidth: number, alignCorners: boolean, halfPixelCenters: boolean) {\n const [batch, oldHeight, oldWidth, depth] = inputShape;\n this.outputShape = [batch, newHeight, newWidth, depth];\n\n const effectiveInSize: [number, number] = [\n (alignCorners && newHeight > 1) ? oldHeight - 1 : oldHeight,\n (alignCorners && newWidth > 1) ? oldWidth - 1 : oldWidth\n ];\n\n const effectiveOutSize: [number, number] = [\n (alignCorners && newHeight > 1) ? newHeight - 1 : newHeight,\n (alignCorners && newWidth > 1) ? newWidth - 1 : newWidth\n ];\n\n // When align corners is false, we rounds the value with floor.\n const roundBase = alignCorners ? '0.5' : '0.0';\n let sourceFracIndexRC: string;\n if (halfPixelCenters) {\n sourceFracIndexRC = `max((vec3(yRC) + vec3(0.5)) * ` +\n `effectiveInputOverOutputRatioRC, vec3(0.0))`;\n } else {\n sourceFracIndexRC = `vec3(yRC) * effectiveInputOverOutputRatioRC`;\n }\n\n this.userCode = `\n const vec3 effectiveInputOverOutputRatioRC = vec3(\n ${effectiveInSize[0] / effectiveOutSize[0]},\n ${effectiveInSize[1] / effectiveOutSize[1]},\n ${effectiveInSize[1] / effectiveOutSize[1]});\n const vec3 inputShapeRC = vec3(${oldHeight}.0, ${oldWidth}.0,\n ${oldWidth}.0);\n\n float getAValue(int b, int r, int c, int d) {\n return getChannel(getA(b, r, c, d), vec2(c, d));\n }\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n // Calculate values for next column in yRC.z.\n ivec3 yRC = coords.yzz + ivec3(0, 0, 1);\n\n // Fractional source index.\n vec3 sourceFracIndexRC = ${sourceFracIndexRC};\n\n // Compute the coordinators of nearest neighbor point.\n ivec3 sourceNearestRC = ivec3(\n min(inputShapeRC - 1.0, floor(sourceFracIndexRC + ${roundBase})));\n\n // Should we calculate next column and row elements in 2x2 packed cell.\n bool hasNextCol = d < ${depth - 1};\n bool hasNextRow = coords.z < ${newWidth - 1};\n\n vec4 newValue = vec4(\n getAValue(b, sourceNearestRC.x, sourceNearestRC.y, d),\n hasNextCol ? getAValue(b, sourceNearestRC.x, sourceNearestRC.y, d + 1)\n : 0.0,\n hasNextRow ? getAValue(b, sourceNearestRC.x, sourceNearestRC.z, d)\n : 0.0,\n (hasNextRow && hasNextCol) ?\n getAValue(b, sourceNearestRC.x, sourceNearestRC.z, d + 1) : 0.0);\n\n setOutput(newValue);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env, KernelConfig, KernelFunc, ResizeNearestNeighbor, ResizeNearestNeighborAttrs, ResizeNearestNeighborInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {ResizeNearestNeighborProgram} from '../resize_nearest_neighbor_gpu';\nimport {ResizeNearestNeighborPackedProgram} from '../resize_nearest_neighbor_packed_gpu';\n\nexport function resizeNearestNeighbor(args: {\n inputs: ResizeNearestNeighborInputs,\n backend: MathBackendWebGL,\n attrs: ResizeNearestNeighborAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {images} = inputs;\n const {alignCorners, halfPixelCenters, size} = attrs;\n\n const [newHeight, newWidth] = size;\n\n const program = env().getBool('WEBGL_PACK_IMAGE_OPERATIONS') ?\n new ResizeNearestNeighborPackedProgram(\n images.shape as [number, number, number, number], newHeight, newWidth,\n alignCorners, halfPixelCenters) :\n new ResizeNearestNeighborProgram(\n images.shape as [number, number, number, number], newHeight, newWidth,\n alignCorners, halfPixelCenters);\n return backend.runWebGLProgram(program, [images], images.dtype);\n}\n\nexport const resizeNearestNeighborConfig: KernelConfig = {\n kernelName: ResizeNearestNeighbor,\n backendName: 'webgl',\n kernelFunc: resizeNearestNeighbor as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class ResizeNearestNeigborBackpropProgram implements GPGPUProgram {\n variableNames = ['dy'];\n outputShape: number[] = [];\n userCode: string;\n\n constructor(\n dyShape: [number, number, number, number],\n inputShape: [number, number, number, number], alignCorners: boolean) {\n this.outputShape = inputShape;\n const [, xHeight, xWidth, ] = inputShape;\n const [, yHeight, yWidth] = dyShape;\n\n // In the backwards pass, we want to find the pixels that were generated for\n // each pixel in the input image the forward pass and add the corresponding\n // coefficient from dy to the gradient (with some interpolation).\n\n const effectiveXSize: [number, number] = [\n (alignCorners && yHeight > 1) ? xHeight - 1 : xHeight,\n (alignCorners && yWidth > 1) ? xWidth - 1 : xWidth\n ];\n\n const effectiveYSize: [number, number] = [\n (alignCorners && yHeight > 1) ? yHeight - 1 : yHeight,\n (alignCorners && yWidth > 1) ? yWidth - 1 : yWidth\n ];\n\n const heightScale = effectiveXSize[0] / effectiveYSize[0];\n const widthScale = effectiveXSize[1] / effectiveYSize[1];\n\n const invHeightScale = 1 / heightScale;\n const invWidthScale = 1 / widthScale;\n\n // This defines the size of the window of values around a particular\n // index in dy that we want to search for contributions to dx.\n const winHeight = (Math.ceil(invHeightScale) * 2) + 2;\n const winWidth = (Math.ceil(invWidthScale) * 2) + 2;\n\n this.userCode = `\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n int r = coords[1];\n int c = coords[2];\n\n float accumulator = 0.0;\n\n const float heightScale = float(${heightScale});\n const float widthScale = float(${widthScale});\n\n const float invHeightScale = float(${invHeightScale});\n const float invWidthScale = float(${invWidthScale});\n\n const int winHeight = int(${winHeight});\n const int winWidth = int(${winWidth});\n\n // Compute bounds for where in dy we will look\n float startRLerp = floor(float(r) * invHeightScale);\n int startDyR = int(floor(startRLerp - float(winHeight / 2)));\n\n float startCLerp = floor(float(c) * invWidthScale);\n int startDyC = int(floor(startCLerp - float(winWidth / 2)));\n\n // Loop over dy\n for (int dyROffset = 0; dyROffset < winHeight; dyROffset++) {\n int dyR = dyROffset + startDyR;\n\n // Guard against the window exceeding the bounds of dy\n if (dyR < 0 || dyR >= ${yHeight}) {\n continue;\n }\n\n for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) {\n int dyC = dyCOffset + startDyC;\n\n // Guard against the window exceeding the bounds of dy\n if (dyC < 0 || dyC >= ${yWidth}) {\n continue;\n }\n\n float sourceFracRow =\n float(${effectiveXSize[0]}) *\n (float(dyR) / float(${effectiveYSize[0]}));\n\n float sourceFracCol =\n float(${effectiveXSize[1]}) *\n (float(dyC) / float(${effectiveYSize[1]}));\n\n int sourceNearestRow = int(min(\n float(int(${xHeight}) - 1),\n ${alignCorners} ? float(round(sourceFracRow)) :\n float(floor(sourceFracRow))));\n\n int sourceNearestCol = int(min(\n float(int(${xWidth}) - 1),\n ${alignCorners} ? float(round(sourceFracCol)) :\n float(floor(sourceFracCol))));\n\n if (r == sourceNearestRow && c == sourceNearestCol) {\n accumulator += getDy(b, dyR, dyC, d);\n }\n }\n }\n // End loop over dy\n\n setOutput(accumulator);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, ResizeNearestNeighborGrad, ResizeNearestNeighborGradAttrs, ResizeNearestNeighborGradInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {ResizeNearestNeigborBackpropProgram} from '../resize_nearest_neighbor_backprop_gpu';\n\nexport function resizeNearestNeighborGrad(args: {\n inputs: ResizeNearestNeighborGradInputs,\n backend: MathBackendWebGL,\n attrs: ResizeNearestNeighborGradAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {images, dy} = inputs;\n const {alignCorners} = attrs;\n\n const program = new ResizeNearestNeigborBackpropProgram(\n dy.shape as [number, number, number, number],\n images.shape as [number, number, number, number], alignCorners);\n return backend.runWebGLProgram(program, [dy], dy.dtype);\n}\n\nexport const resizeNearestNeighborGradConfig: KernelConfig = {\n kernelName: ResizeNearestNeighborGrad,\n backendName: 'webgl',\n kernelFunc: resizeNearestNeighborGrad as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {getCoordsDataType} from './shader_compiler';\n\nexport class ReverseProgram implements GPGPUProgram {\n variableNames = ['x'];\n outputShape: number[];\n userCode: string;\n\n constructor(xShape: number[], axis: number[]) {\n const rank = xShape.length;\n if (rank > 4) {\n throw new Error(\n `WebGL backend: Reverse of rank-${rank} tensor is not yet supported`);\n }\n this.outputShape = xShape;\n\n if (rank === 1) {\n this.userCode = `\n void main() {\n int coord = getOutputCoords();\n setOutput(getX(${xShape[0]} - coord - 1));\n }\n `;\n return;\n }\n const getInCoord = (i: number) => {\n if (axis.indexOf(i) !== -1 && xShape[i] !== 1) {\n return `${xShape[i]} - coords[${i}] - 1`;\n }\n return `coords[${i}]`;\n };\n const inCoords = xShape.map((_, i) => getInCoord(i)).join(',');\n const type = getCoordsDataType(rank);\n\n this.userCode = `\n void main() {\n ${type} coords = getOutputCoords();\n setOutput(getX(${inCoords}));\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {getChannels} from './packing_util';\nimport {getCoordsDataType} from './shader_compiler';\n\nexport class ReversePackedProgram implements GPGPUProgram {\n variableNames = ['x'];\n outputShape: number[];\n userCode: string;\n packedInputs = true;\n packedOutput = true;\n\n constructor(xShape: number[], axis: number[]) {\n const rank = xShape.length;\n if (rank > 4) {\n throw new Error(\n `WebGL backend: Reverse of rank-${rank} tensor is not yet supported`);\n }\n this.outputShape = xShape;\n const channels = getChannels('rc', rank);\n const nextColumn =\n `${channels[rank - 1]} + 1 < ${this.outputShape[rank - 1]}`;\n const nextRow = `${channels[rank - 2]} + 1 < ${this.outputShape[rank - 2]}`;\n const type = getCoordsDataType(rank);\n if (rank === 1) {\n this.userCode = `\n void main(){\n int rc = getOutputCoords();\n vec4 result = vec4(0.);\n result.r = getChannel(getX(${xShape[0]} - rc - 1),\n ${xShape[0]} - rc - 1);\n if(${nextColumn}){\n result.g = getChannel(getX(${xShape[0]} - (rc + 1) - 1),\n ${xShape[0]} - (rc + 1) - 1);\n }\n setOutput(result);\n }\n `;\n } else {\n this.userCode = `\n void main() {\n ${type} rc = getOutputCoords();\n vec4 result = vec4(0.);\n result.r = ${getR(channels.slice())};\n if(${nextColumn}){\n result.g = ${getG(channels.slice())};\n }\n if(${nextRow}) {\n result.b = ${getB(channels.slice())};\n if(${nextColumn}) {\n result.a = ${getA(channels.slice())};\n }\n }\n setOutput(result);\n }\n `;\n }\n\n function getR(channels: string[]): string {\n return getChannel(channels);\n }\n\n function getG(channels: string[]): string {\n channels[rank - 1] = '(' + channels[rank - 1] + ` + 1)`;\n return getChannel(channels);\n }\n\n function getB(channels: string[]): string {\n channels[rank - 2] = '(' + channels[rank - 2] + ` + 1)`;\n return getChannel(channels);\n }\n\n function getA(channels: string[]): string {\n channels[rank - 1] = '(' + channels[rank - 1] + ` + 1)`;\n channels[rank - 2] = '(' + channels[rank - 2] + ` + 1)`;\n return getChannel(channels);\n }\n\n function getChannel(channels: string[]): string {\n const inCoordsArray = xShape.map((_, i) => getInCoord(i, channels));\n const inCoords = inCoordsArray.join(',');\n const innerDims = inCoordsArray.slice(-2).join(',');\n return `getChannel(getX(${inCoords}), vec2(${innerDims}))`;\n }\n\n function getInCoord(i: number, channels1: string[]): string {\n if (axis.indexOf(i) !== -1 && xShape[i] !== 1) {\n return `${xShape[i]} - ${channels1[i]} - 1`;\n } else {\n return `${channels1[i]}`;\n }\n }\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env, KernelConfig, KernelFunc, Reverse, ReverseAttrs, ReverseInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {ReverseProgram} from '../reverse_gpu';\nimport {ReversePackedProgram} from '../reverse_packed_gpu';\n\nimport {identity} from './Identity';\n\nexport function reverse(args: {\n inputs: ReverseInputs,\n backend: MathBackendWebGL,\n attrs: ReverseAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {dims} = attrs;\n\n const xRank = x.shape.length;\n\n const $dims = util.parseAxisParam(dims, x.shape);\n if (xRank === 0) {\n return identity({inputs: {x}, backend});\n }\n\n const program = env().getBool('WEBGL_PACK_ARRAY_OPERATIONS') ?\n new ReversePackedProgram(x.shape, $dims) :\n new ReverseProgram(x.shape, $dims);\n\n return backend.runWebGLProgram(program, [x], x.dtype);\n}\n\nexport const reverseConfig: KernelConfig = {\n kernelName: Reverse,\n backendName: 'webgl',\n kernelFunc: reverse as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {UniformType} from './shader_compiler';\n\nexport class RotateProgram implements GPGPUProgram {\n variableNames = ['Image'];\n outputShape: number[] = [];\n userCode: string;\n customUniforms = [{name: 'params', type: 'vec4' as UniformType}];\n constructor(\n imageShape: [number, number, number, number],\n fillValue: number|[number, number, number]) {\n const imageHeight = imageShape[1];\n const imageWidth = imageShape[2];\n this.outputShape = imageShape;\n\n let fillSnippet = '';\n if (typeof fillValue === 'number') {\n fillSnippet = `float outputValue = ${fillValue.toFixed(2)};`;\n } else {\n fillSnippet = `\n vec3 fill = vec3(${fillValue.join(',')});\n float outputValue = fill[coords[3]];`;\n }\n\n this.userCode = `\n void main() {\n ivec4 coords = getOutputCoords();\n int x = coords[2];\n int y = coords[1];\n float coordXFloat = (float(x) - params[0]) * params[3] -\n (float(y) - params[1]) * params[2];\n float coordYFloat = (float(x) - params[0]) * params[2] +\n (float(y) - params[1]) * params[3];\n int coordX = int(round(coordXFloat + params[0]));\n int coordY = int(round(coordYFloat + params[1]));\n ${fillSnippet}\n if(coordX >= 0 && coordX < ${imageWidth} && coordY >= 0 && coordY < ${\n imageHeight}) {\n outputValue = getImage(coords[0], coordY, coordX, coords[3]);\n }\n setOutput(outputValue);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, Tensor4D} from '@tensorflow/tfjs-core';\nimport {RotateWithOffset, RotateWithOffsetAttrs, RotateWithOffsetInputs} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {RotateProgram} from '../rotate_gpu';\n\nexport const rotateWithOffsetConfig: KernelConfig = {\n kernelName: RotateWithOffset,\n backendName: 'webgl',\n kernelFunc: ({inputs, attrs, backend}) => {\n const {image} = inputs as RotateWithOffsetInputs;\n const {radians, fillValue, center} = attrs as {} as RotateWithOffsetAttrs;\n const webglBackend = backend as MathBackendWebGL;\n\n const program = new RotateProgram((image as Tensor4D).shape, fillValue);\n const [centerX, centerY] =\n backend_util.getImageCenter(center, image.shape[1], image.shape[2]);\n const customValues =\n [[centerX, centerY, Math.sin(radians), Math.cos(radians)]];\n const output = webglBackend.runWebGLProgram(\n program, [image], image.dtype, customValues);\n return output;\n }\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Round} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst ROUND = `\n // OpenGL ES does not support round function.\n // The algorithm is based on banker's rounding.\n float base = floor(x);\n if ((x - base) < 0.5) {\n return floor(x);\n } else if ((x - base) > 0.5) {\n return ceil(x);\n } else {\n if (mod(base, 2.0) == 0.0) {\n return base;\n } else {\n return base + 1.0;\n }\n }\n`;\n\nexport const round = unaryKernelFunc({opSnippet: ROUND});\n\nexport const roundConfig: KernelConfig = {\n kernelName: Round,\n backendName: 'webgl',\n kernelFunc: round,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Rsqrt} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {rsqrtImplCPU} from '../kernel_utils/shared';\n\nconst RSQRT = `return inversesqrt(x);`;\n\nexport const rsqrt =\n unaryKernelFunc({opSnippet: RSQRT, cpuKernelImpl: rsqrtImplCPU});\n\nexport const rsqrtConfig: KernelConfig = {\n kernelName: Rsqrt,\n backendName: 'webgl',\n kernelFunc: rsqrt as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {getCoordsDataType} from './shader_compiler';\n\nexport class ScatterProgram implements GPGPUProgram {\n variableNames = ['updates', 'indices', 'defaultValue'];\n outputShape: number[];\n userCode: string;\n\n constructor(\n updateSize: number, sliceDim: number, indicesRank: number,\n updatesRank: number, strides: number[], shape: number[],\n summingDupeIndex = true) {\n this.outputShape = shape;\n const stridesType = getCoordsDataType(strides.length);\n const dtype = getCoordsDataType(shape.length);\n let indicesString = '';\n if (indicesRank === 1) {\n indicesString = 'i';\n } else if (indicesRank === 2) {\n indicesString = 'i, j';\n }\n const indicesSnippet = `getIndices(${indicesString})`;\n\n let updatesString = '';\n if (updatesRank === 1) {\n updatesString = 'i';\n } else if (updatesRank === 2) {\n updatesString = 'i, coords[1]';\n }\n const updatesSnippet = `getUpdates(${updatesString})`;\n\n const strideString = sliceDim > 1 ? 'strides[j]' : 'strides';\n this.userCode = `\n ${stridesType} strides = ${stridesType}(${strides});\n\n void main() {\n ${dtype} coords = getOutputCoords();\n float sum = 0.0;\n bool found = false;\n for (int i = 0; i < ${updateSize}; i++) {\n int flattenedIndex = 0;\n for (int j = 0; j < ${sliceDim}; j++) {\n int index = round(${indicesSnippet});\n flattenedIndex += index * ${strideString};\n }\n if (flattenedIndex == coords[0]) {\n sum += ${updatesSnippet};\n found = true;\n }\n }\n setOutput(mix(getDefaultValue(), sum, float(found)));\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, ScatterNd, ScatterNdAttrs, ScatterNdInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {ScatterProgram} from '../scatter_gpu';\nimport {reshape} from './Reshape';\n\nexport function scatterNd(args: {\n inputs: ScatterNdInputs,\n backend: MathBackendWebGL,\n attrs: ScatterNdAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {indices, updates} = inputs;\n const {shape} = attrs;\n\n const {sliceRank, numUpdates, sliceSize, strides, outputSize} =\n backend_util.calculateShapes(updates, indices, shape);\n\n const flattenShape = [outputSize / sliceSize, sliceSize];\n\n if (outputSize === 0) {\n return backend.makeTensorInfo(shape, indices.dtype);\n }\n\n const flattenIndices = reshape(\n {inputs: {x: indices}, backend, attrs: {shape: [numUpdates, sliceRank]}});\n const flattenX = reshape(\n {inputs: {x: updates}, backend, attrs: {shape: [numUpdates, sliceSize]}});\n\n const defaultValue = backend.makeTensorInfo(\n [], 'float32', new Float32Array([0])); // scalar(0)\n const program = new ScatterProgram(\n numUpdates, sliceRank, flattenIndices.shape.length, flattenX.shape.length,\n strides, flattenShape);\n const res = backend.runWebGLProgram(\n program, [flattenX, flattenIndices, defaultValue], flattenX.dtype);\n\n const reshaped = reshape({inputs: {x: res}, backend, attrs: {shape}});\n\n backend.disposeIntermediateTensorInfo(flattenIndices);\n backend.disposeIntermediateTensorInfo(flattenX);\n backend.disposeIntermediateTensorInfo(res);\n backend.disposeIntermediateTensorInfo(defaultValue);\n\n return reshaped;\n}\n\nexport const scatterNdConfig: KernelConfig = {\n kernelName: ScatterNd,\n backendName: 'webgl',\n kernelFunc: scatterNd as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env} from '@tensorflow/tfjs-core';\nimport {GPGPUProgram} from './gpgpu_math';\nimport {UniformType} from './shader_compiler';\n\nexport class SearchSortedProgram implements GPGPUProgram {\n variableNames = ['sortedSequence', 'values'];\n outputShape: number[];\n userCode: string;\n customUniforms = [{name: 'numInputs', type: 'int' as UniformType}];\n\n constructor(\n batchSize: number, numInputs: number, numValues: number,\n side: 'left'|'right') {\n this.outputShape = [batchSize, numValues];\n\n const webGL2LoopHead = 'while (left < right) {';\n // WebGL1 doesn't accept non constant loop conditions, so upper bound loop\n // iterations.\n const webGL1LoopHead = `for (int i = 0; i < ${\n Math.ceil(Math.log2(numInputs + 1))}; ++i) { if (left >= right) break;`;\n const loopHead = env().getNumber('WEBGL_VERSION') === 2 ? webGL2LoopHead :\n webGL1LoopHead;\n\n // left corresponds to lower bound and right to upper bound.\n const boundComparator = side === 'left' ? '<' : '<=';\n this.userCode = `\n int findBound(int batch, float value) {\n int left = 0;\n int right = numInputs;\n int mid;\n ${loopHead}\n mid = (left + right) / 2;\n if (getSortedSequence(batch, mid) ${boundComparator} value) {\n left = mid + 1;\n } else {\n right = mid;\n }\n }\n return right;\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int valueIndex = coords[1];\n\n float value = getValues(batch, valueIndex);\n\n setOutput(float(findBound(batch, value)));\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, SearchSorted, SearchSortedAttrs, SearchSortedInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {SearchSortedProgram} from '../search_sorted_gpu';\n\nexport function searchSorted(args: {\n inputs: SearchSortedInputs,\n backend: MathBackendWebGL,\n attrs: SearchSortedAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {sortedSequence, values} = inputs;\n const {side} = attrs;\n\n const program = new SearchSortedProgram(\n sortedSequence.shape[0], sortedSequence.shape[1], values.shape[1], side);\n const customValues = [[sortedSequence.shape[1]]];\n return backend.runWebGLProgram(\n program, [sortedSequence, values], 'int32', customValues);\n}\n\nexport const searchSortedConfig: KernelConfig = {\n kernelName: SearchSorted,\n backendName: 'webgl',\n kernelFunc: searchSorted as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {getCoordsDataType} from './shader_compiler';\n\nexport class SelectProgram implements GPGPUProgram {\n variableNames = ['c', 'a', 'b'];\n outputShape: number[];\n userCode: string;\n\n constructor(cRank: number, shape: number[], rank: number) {\n this.outputShape = shape;\n\n let cCoords;\n let abCoords;\n if (rank > 4) {\n throw Error(`Where for rank ${rank} is not yet supported`);\n }\n\n if (rank === 1) {\n abCoords = `resRC`;\n cCoords = `resRC`;\n } else {\n const currentCoords = ['resRC.x', 'resRC.y', 'resRC.z', 'resRC.w'];\n const cCoordVars = [];\n const abCoordVars = [];\n for (let i = 0; i < shape.length; i++) {\n abCoordVars.push(`${currentCoords[i]}`);\n if (i < cRank) {\n cCoordVars.push(`${currentCoords[i]}`);\n }\n }\n cCoords = cCoordVars.join();\n abCoords = abCoordVars.join();\n }\n\n const dtype = getCoordsDataType(rank);\n\n this.userCode = `\n void main() {\n ${dtype} resRC = getOutputCoords();\n float cVal = getC(${cCoords});\n if (cVal >= 1.0) {\n setOutput(getA(${abCoords}));\n } else {\n setOutput(getB(${abCoords}));\n }\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Select, SelectInputs, TensorInfo, upcastType} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {SelectProgram} from '../select_gpu';\n\nexport function select(args: {inputs: SelectInputs, backend: MathBackendWebGL}):\n TensorInfo {\n const {inputs, backend} = args;\n const {condition, t, e} = inputs;\n\n const program =\n new SelectProgram(condition.shape.length, t.shape, t.shape.length);\n return backend.runWebGLProgram(\n program, [condition, t, e], upcastType(t.dtype, e.dtype));\n}\n\nexport const selectConfig: KernelConfig = {\n kernelName: Select,\n backendName: 'webgl',\n kernelFunc: select as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, Selu} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst SELU = `\n // Stable and Attracting Fixed Point (0, 1) for Normalized Weights.\n // see: https://arxiv.org/abs/1706.02515\n float scaleAlpha = ${backend_util.SELU_SCALEALPHA};\n float scale = ${backend_util.SELU_SCALE};\n return (x >= 0.0) ? scale * x : scaleAlpha * (exp(x) - 1.0);\n`;\n\nexport const selu = unaryKernelFunc({opSnippet: SELU});\n\nexport const seluConfig: KernelConfig = {\n kernelName: Selu,\n backendName: 'webgl',\n kernelFunc: selu,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Sigmoid} from '@tensorflow/tfjs-core';\n\nimport {CHECK_NAN_SNIPPET_UNARY, unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {sigmoidImplCPU} from '../kernel_utils/shared';\n\nconst SIGMOID = CHECK_NAN_SNIPPET_UNARY + `\n return 1.0 / (1.0 + exp(-1.0 * x));\n`;\n\nconst SIGMOID_PACKED = `\n vec4 result = 1.0 / (1.0 + exp(-1.0 * x));\n bvec4 isNaN = isnan(x);\n\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n`;\nexport const sigmoid = unaryKernelFunc({\n opSnippet: SIGMOID,\n packedOpSnippet: SIGMOID_PACKED,\n cpuKernelImpl: sigmoidImplCPU\n});\n\nexport const sigmoidConfig: KernelConfig = {\n kernelName: Sigmoid,\n backendName: 'webgl',\n kernelFunc: sigmoid,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Sign} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\n// Sign does not propagate NANs.\nconst SIGN = `\n if (isnan(x)) { return 0.0; }\n return sign(x);\n`;\n\nexport const sign = unaryKernelFunc({opSnippet: SIGN});\n\nexport const signConfig: KernelConfig = {\n kernelName: Sign,\n backendName: 'webgl',\n kernelFunc: sign,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Sin} from '@tensorflow/tfjs-core';\n\nimport {CHECK_NAN_SNIPPET_UNARY, unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst SIN = CHECK_NAN_SNIPPET_UNARY + `\n return sin(x);\n`;\n\nexport const sin = unaryKernelFunc({opSnippet: SIN});\n\nexport const sinConfig: KernelConfig = {\n kernelName: Sin,\n backendName: 'webgl',\n kernelFunc: sin,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Sinh} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst SINH = `\n float e2x = exp(x);\n return (e2x - 1.0 / e2x) / 2.0;\n`;\n\nexport const sinh = unaryKernelFunc({opSnippet: SINH});\n\nexport const sinhConfig: KernelConfig = {\n kernelName: Sinh,\n backendName: 'webgl',\n kernelFunc: sinh,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Softplus} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst SOFTPLUS = `\n float epsilon = 1.1920928955078125e-7;\n float threshold = log(epsilon) + 2.0;\n\n bool too_large = x > -threshold;\n bool too_small = x < threshold;\n\n float result;\n float exp_x = exp(x);\n\n if (too_large){\n result = x;\n }\n else if (too_small){\n result = exp_x;\n }\n else{\n result = log(exp_x + 1.0);\n }\n return result;\n`;\n\nexport const softplus = unaryKernelFunc({opSnippet: SOFTPLUS});\n\nexport const softplusConfig: KernelConfig = {\n kernelName: Softplus,\n backendName: 'webgl',\n kernelFunc: softplus,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, SpaceToBatchND, SpaceToBatchNDAttrs, SpaceToBatchNDInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\n\nimport {padV2} from './PadV2';\nimport {reshape} from './Reshape';\nimport {transpose} from './Transpose';\n\nexport const spaceToBatchND = (args: {\n inputs: SpaceToBatchNDInputs,\n backend: MathBackendWebGL,\n attrs: SpaceToBatchNDAttrs\n}): TensorInfo => {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {blockShape, paddings} = attrs;\n\n util.assert(\n x.shape.length <= 4,\n () => 'spaceToBatchND for rank > 4 with a WebGL backend not ' +\n 'implemented yet');\n\n const prod = blockShape.reduce((a, b) => a * b);\n\n const completePaddings: Array<[number, number]> = [[0, 0]];\n completePaddings.push(...paddings as Array<[number, number]>);\n for (let i = 1 + blockShape.length; i < x.shape.length; ++i) {\n completePaddings.push([0, 0]);\n }\n\n const toDispose = [];\n\n const paddedX = padV2({\n inputs: {x},\n backend,\n attrs: {paddings: completePaddings, constantValue: 0}\n });\n\n const reshapedPaddedShape =\n backend_util.getReshaped(paddedX.shape, blockShape, prod, false);\n\n const permutedReshapedPaddedPermutation = backend_util.getPermuted(\n reshapedPaddedShape.length, blockShape.length, false);\n\n const flattenShape =\n backend_util.getReshapedPermuted(paddedX.shape, blockShape, prod, false);\n\n const reshapedPaddedX = reshape(\n {inputs: {x: paddedX}, backend, attrs: {shape: reshapedPaddedShape}});\n\n const paddedXT = transpose({\n inputs: {x: reshapedPaddedX},\n backend,\n attrs: {perm: permutedReshapedPaddedPermutation}\n });\n\n const result =\n reshape({inputs: {x: paddedXT}, backend, attrs: {shape: flattenShape}});\n\n toDispose.push(paddedX);\n toDispose.push(reshapedPaddedX);\n toDispose.push(paddedXT);\n\n toDispose.forEach(t => backend.disposeIntermediateTensorInfo(t));\n\n return result;\n};\n\nexport const spaceToBatchNDConfig: KernelConfig = {\n kernelName: SpaceToBatchND,\n backendName: 'webgl',\n kernelFunc: spaceToBatchND as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, SparseFillEmptyRows, SparseFillEmptyRowsInputs, TensorInfo, TypedArray} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {sparseFillEmptyRowsImplCPU} from '../kernel_utils/shared';\n\nexport function sparseFillEmptyRows(args: {\n inputs: SparseFillEmptyRowsInputs,\n backend: MathBackendWebGL\n}): [TensorInfo, TensorInfo, TensorInfo, TensorInfo] {\n const {inputs, backend} = args;\n const {indices, values, denseShape, defaultValue} = inputs;\n if (denseShape.shape.length !== 1) {\n throw new Error(`Dense shape must be a vector, saw:\n ${denseShape.shape}`);\n }\n if (indices.shape.length !== 2) {\n throw new Error(`Indices must be a matrix, saw:\n ${indices.shape}`);\n }\n if (values.shape.length !== 1) {\n throw new Error(`Values must be a vector, saw:\n ${values.shape}`);\n }\n if (defaultValue.shape.length !== 0) {\n throw new Error(`Default value must be a scalar, saw:\n ${defaultValue.shape}`);\n }\n\n const $indices = backend.readSync(indices.dataId) as TypedArray;\n const $values = backend.readSync(values.dataId) as TypedArray;\n const $denseShape = backend.readSync(denseShape.dataId) as TypedArray;\n const $defaultValue =\n backend.readSync(defaultValue.dataId)[0] as number;\n\n const [outputIndices, outputIndicesShape, outputValues,\n emptyRowIndicator, reverseIndexMap] =\n sparseFillEmptyRowsImplCPU(\n $indices, indices.shape, indices.dtype, $values, values.dtype,\n $denseShape, $defaultValue);\n return [\n backend.makeTensorInfo(outputIndicesShape, indices.dtype, outputIndices),\n backend.makeTensorInfo(\n [outputIndicesShape[0]], values.dtype, outputValues),\n backend.makeTensorInfo(\n [emptyRowIndicator.length], 'bool',\n new Uint8Array(\n emptyRowIndicator.map((value: boolean) => Number(value)))),\n backend.makeTensorInfo(\n [reverseIndexMap.length], indices.dtype,\n new Int32Array(reverseIndexMap)),\n ];\n}\n\nexport const sparseFillEmptyRowsConfig: KernelConfig = {\n kernelName: SparseFillEmptyRows,\n backendName: 'webgl',\n kernelFunc: sparseFillEmptyRows as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, SparseReshape, SparseReshapeInputs, TensorInfo, TypedArray} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {sparseReshapeImplCPU} from '../kernel_utils/shared';\n\nexport function sparseReshape(\n args: {inputs: SparseReshapeInputs, backend: MathBackendWebGL}):\n [TensorInfo, TensorInfo] {\n const {inputs, backend} = args;\n const {inputIndices, inputShape, newShape} = inputs;\n if (inputIndices.shape.length !== 2) {\n throw new Error(`Input indices should be a matrix but received shape ${\n inputIndices.shape}`);\n }\n if (inputShape.shape.length !== 1) {\n throw new Error(`Input shape should be a vector but received shape ${\n inputShape.shape}`);\n }\n\n if (newShape.shape.length !== 1) {\n throw new Error(\n `Target shape should be a vector but received shape ${newShape.shape}`);\n }\n\n const $inputShape =\n Array.from(backend.readSync(inputShape.dataId) as TypedArray);\n const $inputIndices = backend.readSync(inputIndices.dataId) as TypedArray;\n const targetShape =\n Array.from(backend.readSync(newShape.dataId) as TypedArray);\n\n const [newIndices, indicesShape, outputShape] = sparseReshapeImplCPU(\n $inputIndices, inputIndices.shape, inputIndices.dtype, $inputShape,\n targetShape);\n return [\n backend.makeTensorInfo(indicesShape, inputIndices.dtype, newIndices),\n backend.makeTensorInfo(\n [outputShape.length], newShape.dtype, new Int32Array(outputShape)),\n ];\n}\n\nexport const sparseReshapeConfig: KernelConfig = {\n kernelName: SparseReshape,\n backendName: 'webgl',\n kernelFunc: sparseReshape,\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, SparseSegmentMean, SparseSegmentMeanInputs, TensorInfo, TypedArray} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {sparseSegmentReductionImplCPU} from '../kernel_utils/shared';\n\nexport function sparseSegmentMean(\n args: {inputs: SparseSegmentMeanInputs, backend: MathBackendWebGL}):\n TensorInfo {\n const {inputs, backend} = args;\n const {data, indices, segmentIds} = inputs;\n if (data.shape.length < 1) {\n throw new Error(\n `Data should be at least 1 dimensional but received scalar`);\n }\n if (indices.shape.length !== 1) {\n throw new Error(`Indices should be a vector but received shape\n ${indices.shape}`);\n }\n if (segmentIds.shape.length !== 1) {\n throw new Error(`Segment ids should be a vector but received shape\n ${segmentIds.shape}`);\n }\n\n const $data = backend.readSync(data.dataId) as TypedArray;\n const $indices = backend.readSync(indices.dataId) as TypedArray;\n const $segmentIds = backend.readSync(segmentIds.dataId) as TypedArray;\n\n const [outputData, outputDataShape] = sparseSegmentReductionImplCPU(\n $data, data.shape, data.dtype, $indices, $segmentIds, true);\n return backend.makeTensorInfo(outputDataShape, data.dtype, outputData);\n}\n\nexport const sparseSegmentMeanConfig: KernelConfig = {\n kernelName: SparseSegmentMean,\n backendName: 'webgl',\n kernelFunc: sparseSegmentMean as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, SparseSegmentSum, SparseSegmentSumInputs, TensorInfo, TypedArray} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {sparseSegmentReductionImplCPU} from '../kernel_utils/shared';\n\nexport function sparseSegmentSum(\n args: {inputs: SparseSegmentSumInputs, backend: MathBackendWebGL}):\n TensorInfo {\n const {inputs, backend} = args;\n const {data, indices, segmentIds} = inputs;\n if (data.shape.length < 1) {\n throw new Error(\n `Data should be at least 1 dimensional but received scalar`);\n }\n if (indices.shape.length !== 1) {\n throw new Error(`Indices should be a vector but received shape\n ${indices.shape}`);\n }\n if (segmentIds.shape.length !== 1) {\n throw new Error(`Segment ids should be a vector but received shape\n ${segmentIds.shape}`);\n }\n\n const $data = backend.readSync(data.dataId) as TypedArray;\n const $indices = backend.readSync(indices.dataId) as TypedArray;\n const $segmentIds = backend.readSync(segmentIds.dataId) as TypedArray;\n\n const [outputData, outputDataShape] = sparseSegmentReductionImplCPU(\n $data, data.shape, data.dtype, $indices, $segmentIds);\n return backend.makeTensorInfo(outputDataShape, data.dtype, outputData);\n}\n\nexport const sparseSegmentSumConfig: KernelConfig = {\n kernelName: SparseSegmentSum,\n backendName: 'webgl',\n kernelFunc: sparseSegmentSum as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, Rank, SparseToDense, SparseToDenseAttrs, SparseToDenseInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {scatterImplCPU} from '../kernel_utils/shared';\nimport {ScatterProgram} from '../scatter_gpu';\n\nimport {reshape} from './Reshape';\n\nexport function sparseToDense(args: {\n inputs: SparseToDenseInputs,\n backend: MathBackendWebGL,\n attrs: SparseToDenseAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {sparseIndices, sparseValues, defaultValue} = inputs;\n const {outputShape} = attrs;\n\n const {sliceRank, numUpdates, sliceSize, strides, outputSize} =\n backend_util.calculateShapes(sparseValues, sparseIndices, outputShape);\n const sumDupeIndices = false;\n\n if (sparseValues.dtype === 'string') {\n const indicesBuf = backend.bufferSync(sparseIndices);\n const updatesBuf = backend.bufferSync(sparseValues);\n const $defaultValue = util.decodeString(\n backend.readSync(defaultValue.dataId)[0] as Uint8Array);\n const outBuf = scatterImplCPU(\n indicesBuf, updatesBuf, outputShape, outputSize, sliceSize, numUpdates,\n sliceRank, strides, $defaultValue, sumDupeIndices);\n return backend.makeTensorInfo(outputShape, outBuf.dtype, outBuf.values);\n }\n const program = new ScatterProgram(\n numUpdates, sliceRank, sparseIndices.shape.length,\n sparseValues.shape.length, strides, [outputSize, 1], sumDupeIndices);\n\n const res = backend.runWebGLProgram(\n program, [sparseValues, sparseIndices, defaultValue], sparseValues.dtype);\n\n const reshaped =\n reshape({inputs: {x: res}, backend, attrs: {shape: outputShape}});\n\n backend.disposeIntermediateTensorInfo(res);\n return reshaped;\n}\n\nexport const sparseToDenseConfig: KernelConfig = {\n kernelName: SparseToDense,\n backendName: 'webgl',\n kernelFunc: sparseToDense as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, SplitV, SplitVAttrs, SplitVInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {slice} from './Slice';\n\nexport function splitV(\n args:\n {inputs: SplitVInputs, backend: MathBackendWebGL, attrs: SplitVAttrs}):\n TensorInfo[] {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {numOrSizeSplits, axis} = attrs;\n\n const $axis = util.parseAxisParam(axis, x.shape)[0];\n const splitSizes = backend_util.prepareSplitSize(x, numOrSizeSplits, $axis);\n\n const xRank = x.shape.length;\n const begin = new Array(xRank).fill(0);\n const size = x.shape.slice();\n\n return splitSizes.map(s => {\n const sliceSize = [...size];\n sliceSize[$axis] = s;\n const sliceT =\n slice({inputs: {x}, backend, attrs: {begin, size: sliceSize}});\n begin[$axis] += s;\n return sliceT;\n });\n}\n\nexport const splitVConfig: KernelConfig = {\n kernelName: SplitV,\n backendName: 'webgl',\n kernelFunc: splitV as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Sqrt} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {sqrtImplCPU} from '../kernel_utils/shared';\n\nconst SQRT = `return sqrt(x);`;\n\nexport const sqrt = unaryKernelFunc(\n {opSnippet: SQRT, packedOpSnippet: SQRT, cpuKernelImpl: sqrtImplCPU});\n\nexport const sqrtConfig: KernelConfig = {\n kernelName: Sqrt,\n backendName: 'webgl',\n kernelFunc: sqrt as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Square} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst SQUARE = `return x * x;`;\n\nexport const square = unaryKernelFunc({opSnippet: SQUARE});\n\nexport const squareConfig: KernelConfig = {\n kernelName: Square,\n backendName: 'webgl',\n kernelFunc: square,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, SquaredDifference} from '@tensorflow/tfjs-core';\n\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst SQUARED_DIFFERENCE = 'return (a - b) * (a - b);';\n\nexport const squaredDifference = binaryKernelFunc(\n {opSnippet: SQUARED_DIFFERENCE, packedOpSnippet: SQUARED_DIFFERENCE});\n\nexport const squaredDifferenceConfig: KernelConfig = {\n kernelName: SquaredDifference,\n backendName: 'webgl',\n kernelFunc: squaredDifference,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Step, StepAttrs, TensorInfo, UnaryInputs} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {CHECK_NAN_SNIPPET, UnaryOpProgram} from '../unaryop_gpu';\n\nexport function step(\n {inputs, attrs, backend}:\n {inputs: UnaryInputs, attrs: StepAttrs, backend: MathBackendWebGL}):\n TensorInfo {\n const {x} = inputs;\n const opSnippet = CHECK_NAN_SNIPPET + `\n return x > 0.0 ? 1.0 : float(${attrs.alpha});\n `;\n\n const program = new UnaryOpProgram(x.shape, opSnippet);\n\n return backend.runWebGLProgram(program, [x], x.dtype);\n}\n\nexport const stepConfig: KernelConfig = {\n kernelName: Step,\n backendName: 'webgl',\n kernelFunc: step as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {getCoordsDataType} from './shader_compiler';\n\nexport class StridedSliceProgram implements GPGPUProgram {\n variableNames = ['x'];\n outputShape: number[];\n userCode: string;\n\n constructor(begin: number[], strides: number[], size: number[]) {\n this.outputShape = size;\n const rank = size.length;\n const inputDtype = getCoordsDataType(size.length);\n const dtype = getCoordsDataType(size.length);\n\n let newCoords = '';\n if (rank === 1) {\n newCoords = 'coords * strides + begin';\n } else {\n let outputAxis = 0;\n newCoords =\n size.map((_, i) => {\n outputAxis++;\n return size.length === 1 ?\n `coords * strides[${i}] + begin[${i}]` :\n `coords[${outputAxis - 1}] * strides[${i}] + begin[${i}]`;\n })\n .join(',');\n }\n\n this.userCode = `\n ${inputDtype} begin = ${inputDtype}(${begin});\n ${inputDtype} strides = ${inputDtype}(${strides});\n\n void main() {\n ${dtype} coords = getOutputCoords();\n setOutput(getX(${newCoords}));\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {buffer, KernelConfig, KernelFunc, Rank, slice_util, StridedSlice, StridedSliceAttrs, StridedSliceInputs, TensorBuffer, TensorInfo, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {stridedSliceImplCPU} from '../kernel_utils/shared';\nimport {StridedSliceProgram} from '../strided_slice_gpu';\n\nimport {reshape} from './Reshape';\nimport {slice} from './Slice';\n\nexport function stridedSlice(args: {\n inputs: StridedSliceInputs,\n backend: MathBackendWebGL,\n attrs: StridedSliceAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {\n begin,\n end,\n strides,\n beginMask,\n endMask,\n ellipsisMask,\n newAxisMask,\n shrinkAxisMask\n } = attrs;\n\n const {\n finalShapeSparse,\n finalShape,\n isIdentity,\n sliceDim0,\n isSimpleSlice,\n begin: $begin,\n end: $end,\n strides: $strides\n } =\n slice_util.sliceInfo(\n x.shape, begin, end, strides, beginMask, endMask, ellipsisMask,\n newAxisMask, shrinkAxisMask);\n\n let result;\n\n if (isIdentity) {\n // Optimization #1, slice is a no-op plus reshape\n result = reshape({inputs: {x}, backend, attrs: {shape: finalShape}});\n } else if (sliceDim0 || isSimpleSlice) {\n // Optimization #2, slice is memory contiguous (only occurs in dim 0)\n util.assert(\n x.shape.length >= 1,\n () => `Input must have rank at least 1, got: ${x.shape.length}`);\n\n const size = slice_util.computeOutShape($begin, $end, $strides);\n // To tolerate begin[0] > end[0] (a 0-output slice), we min(begin, end).\n const sliced = slice({inputs: {x}, backend, attrs: {begin: $begin, size}});\n result =\n reshape({inputs: {x: sliced}, backend, attrs: {shape: finalShape}});\n backend.disposeIntermediateTensorInfo(sliced);\n } else {\n const shouldExecuteOnCPU = backend.shouldExecuteOnCPU([x]);\n if (shouldExecuteOnCPU) {\n // tslint:disable-next-line: no-unnecessary-type-assertion\n const values = backend.readSync(x.dataId) as TypedArray;\n // tslint:disable-next-line: no-unnecessary-type-assertion\n const xBuf = buffer(x.shape, x.dtype, values) as TensorBuffer;\n const resultValues =\n stridedSliceImplCPU(finalShapeSparse, xBuf, $strides, $begin);\n result = backend.makeTensorInfo(finalShape, x.dtype, resultValues.values);\n } else {\n const program =\n new StridedSliceProgram($begin, $strides, finalShapeSparse);\n result = backend.runWebGLProgram(program, [x], x.dtype);\n }\n }\n\n const resultReshaped =\n reshape({inputs: {x: result}, backend, attrs: {shape: finalShape}});\n\n backend.disposeIntermediateTensorInfo(result);\n\n return resultReshaped;\n}\n\nexport const stridedSliceConfig: KernelConfig = {\n kernelName: StridedSlice,\n backendName: 'webgl',\n kernelFunc: stridedSlice as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, StringNGrams, StringNGramsAttrs, StringNGramsInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {stringNGramsImplCPU} from '../kernel_utils/shared';\n\nexport function stringNGrams(args: {\n inputs: StringNGramsInputs,\n backend: MathBackendWebGL,\n attrs: StringNGramsAttrs\n}): [TensorInfo, TensorInfo] {\n const {inputs, backend, attrs} = args;\n const {\n separator,\n nGramWidths,\n leftPad,\n rightPad,\n padWidth,\n preserveShortSequences\n } = attrs;\n const {data, dataSplits} = inputs;\n const $data = backend.readSync(data.dataId) as Uint8Array[];\n const $dataSplits = backend.readSync(dataSplits.dataId) as Int32Array;\n\n const [nGrams, nGramsSplits] = stringNGramsImplCPU(\n $data, $dataSplits, separator, nGramWidths, leftPad, rightPad, padWidth,\n preserveShortSequences);\n return [\n backend.makeTensorInfo([nGrams.length], 'string', nGrams),\n backend.makeTensorInfo(dataSplits.shape, 'int32', nGramsSplits),\n ];\n}\n\nexport const stringNGramsConfig: KernelConfig = {\n kernelName: StringNGrams,\n backendName: 'webgl',\n kernelFunc: stringNGrams as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, StringSplit, StringSplitAttrs, StringSplitInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {stringSplitImplCPU} from '../kernel_utils/shared';\n\nexport function stringSplit(args: {\n inputs: StringSplitInputs,\n backend: MathBackendWebGL,\n attrs: StringSplitAttrs\n}): [TensorInfo, TensorInfo, TensorInfo] {\n const {inputs, backend, attrs} = args;\n const {skipEmpty} = attrs;\n const {input, delimiter} = inputs;\n\n if (input.dtype !== 'string') {\n throw new Error('Input must be of datatype string');\n }\n if (input.shape.length !== 1) {\n throw new Error(`Input must be a vector, got shape: ${input.shape}`);\n }\n if (delimiter.shape.length !== 0) {\n throw new Error(\n `Delimiter must be a scalar, got shape: ${delimiter.shape}`);\n }\n\n const $input = backend.readSync(input.dataId) as Uint8Array[];\n const $delimiter = backend.readSync(delimiter.dataId)[0] as Uint8Array;\n\n const [indices, values, shape] =\n stringSplitImplCPU($input, $delimiter, skipEmpty);\n const outputSize = values.length;\n return [\n backend.makeTensorInfo([outputSize, 2], 'int32', indices),\n backend.makeTensorInfo([outputSize], 'string', values),\n backend.makeTensorInfo([2], 'int32', new Int32Array(shape))\n ];\n}\n\nexport const stringSplitConfig: KernelConfig = {\n kernelName: StringSplit,\n backendName: 'webgl',\n kernelFunc: stringSplit as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, StringToHashBucketFast, StringToHashBucketFastAttrs, StringToHashBucketFastInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {stringToHashBucketFastImplCPU} from '../kernel_utils/shared';\n\nexport function stringToHashBucketFast(args: {\n inputs: StringToHashBucketFastInputs,\n backend: MathBackendWebGL,\n attrs: StringToHashBucketFastAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {numBuckets} = attrs;\n const {input} = inputs;\n\n if (input.dtype !== 'string') {\n throw new Error('Input must be of datatype string');\n }\n if (numBuckets <= 0) {\n throw new Error(`Number of buckets must be at least 1`);\n }\n\n const $input = backend.readSync(input.dataId) as Uint8Array[];\n\n const output = stringToHashBucketFastImplCPU($input, numBuckets);\n return backend.makeTensorInfo(input.shape, 'int32', output);\n}\n\nexport const stringToHashBucketFastConfig: KernelConfig = {\n kernelName: StringToHashBucketFast,\n backendName: 'webgl',\n kernelFunc: stringToHashBucketFast as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Tan} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst TAN = `return tan(x);`;\n\nexport const tan = unaryKernelFunc({opSnippet: TAN});\n\nexport const tanConfig: KernelConfig = {\n kernelName: Tan,\n backendName: 'webgl',\n kernelFunc: tan,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Tanh} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst TANH = `\n float e2x = exp(-2.0 * abs(x));\n return sign(x) * (1.0 - e2x) / (1.0 + e2x);\n`;\n\nexport const tanh = unaryKernelFunc({opSnippet: TANH});\n\nexport const tanhConfig: KernelConfig = {\n kernelName: Tanh,\n backendName: 'webgl',\n kernelFunc: tanh,\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {getCoordsDataType} from './shader_compiler';\n\nexport class TileProgram implements GPGPUProgram {\n variableNames = ['A'];\n outputShape: number[];\n userCode: string;\n rank: number;\n\n constructor(aShape: number[], reps: number[]) {\n const outputShape: number[] = new Array(aShape.length);\n for (let i = 0; i < outputShape.length; i++) {\n outputShape[i] = aShape[i] * reps[i];\n }\n this.outputShape = outputShape;\n this.rank = outputShape.length;\n const dtype = getCoordsDataType(this.rank);\n const sourceCoords = getSourceCoords(aShape);\n\n this.userCode = `\n void main() {\n ${dtype} resRC = getOutputCoords();\n setOutput(getA(${sourceCoords}));\n }\n `;\n }\n}\n\nfunction getSourceCoords(aShape: number[]): string {\n const rank = aShape.length;\n if (rank > 5) {\n throw Error(`Tile for rank ${rank} is not yet supported`);\n }\n if (rank === 1) {\n return `imod(resRC, ${aShape[0]})`;\n }\n\n const currentCoords = ['resRC.x', 'resRC.y', 'resRC.z', 'resRC.w', 'resRC.u'];\n\n const sourceCoords = [];\n for (let i = 0; i < aShape.length; i++) {\n sourceCoords.push(`imod(${currentCoords[i]}, ${aShape[i]})`);\n }\n return sourceCoords.join();\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {buffer, KernelConfig, KernelFunc, TensorInfo, Tile, TileAttrs, TileInputs, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {tileImplCPU} from '../kernel_utils/shared';\nimport {TileProgram} from '../tile_gpu';\n\nexport function tile(\n params: {inputs: TileInputs, backend: MathBackendWebGL, attrs: TileAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = params;\n const {x} = inputs;\n const {reps} = attrs;\n\n // tile gpu program cannot handle rank > 5 case.\n if (x.dtype === 'string' || x.shape.length > 5) {\n // Even thought string tensor is always on CPU, just to be consistent on how\n // to access tensor data.\n const data = backend.readSync(x.dataId);\n const value = x.dtype === 'string' ?\n (data as Uint8Array[]).map(d => util.decodeString(d)) :\n data as TypedArray;\n const buf = buffer(x.shape, x.dtype, value);\n const outBuf = tileImplCPU(buf, reps);\n return backend.makeTensorInfo(outBuf.shape, outBuf.dtype, outBuf.values);\n }\n\n const program = new TileProgram(x.shape, reps);\n const output = backend.runWebGLProgram(program, [x], x.dtype);\n\n return output;\n}\n\nexport const tileConfig: KernelConfig = {\n kernelName: Tile,\n backendName: 'webgl',\n kernelFunc: tile as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {GPGPUProgram} from './gpgpu_math';\nimport {UniformType} from './shader_compiler';\n\n// Based on Algorithm 2 of Bitonic Top K, ref:\n// https://anilshanbhag.in/static/papers/gputopk_sigmod18.pdf\n// The original algorithm is based on computing the top K only, however\n// since for TFJS we require the indices of the top K values as well then the\n// algorithm found here is a bit modified. Rather than producing the values\n// at each step, the indices containing the top K are generated instead.\n// The output values are not generated to reduce the number of outputs in the\n// GPU, the values can easily be retrieved from the indices using a gather\n// op.\nexport class SwapProgram implements GPGPUProgram {\n variableNames = ['x', 'indices'];\n outputShape: number[];\n userCode: string;\n // |n| Size of the original input of TopK.\n // |firstPass|indicates if this is the first time swap is being used which\n // means no indices input containing the top K is present yet.\n // |inc| Swaps pairs of indices (0, inc), (1, inc + 1), (2, inc + 2) ...\n customUniforms = [\n {name: 'n', type: 'int' as UniformType},\n {name: 'firstPass', type: 'int' as UniformType},\n {name: 'negativeInf', type: 'float' as UniformType},\n {name: 'dir', type: 'int' as UniformType},\n {name: 'inc', type: 'int' as UniformType}\n ];\n\n /**\n * @param shape desired output shape (can be larger than input shape, output\n * will be padded with -Infinity)\n */\n constructor(shape: number[]) {\n this.outputShape = shape;\n\n this.userCode = `\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int elemIdx = coords[1];\n\n // We compare elements pair-wise within a group of size 2 * inc.\n // The comparing rule for each group alternates between ascending\n // and descending. Within each group, we compare each pair at\n // positions i and i+inc. To decide whether an element at position i\n // is x0 or x1, we mod it by 2 * inc, if the result is smaller than\n // inc, it is in the first half of the group, we denote it as x0,\n // otherwise we denote it as x1.\n // For example, as shown in the Bitonic top K paper referenced above,\n // Figure5(a) shows that element[1] is in the\n // second half of the group when group size is 2, but it is in the\n // first half of the group when group size is 4.\n\n bool isFirstInPair = imod(elemIdx, 2 * inc) < inc;\n int i = isFirstInPair ? elemIdx : elemIdx - inc;\n\n int i0 = firstPass == 1 ? i : int(getIndices(batch, i));\n int i1 = firstPass == 1 ? i + inc : int(getIndices(batch, i + inc));\n float x0 = i0 < n ? getX(batch, i0) : negativeInf;\n float x1 = i1 < n ? getX(batch, i1) : negativeInf;\n\n // Denotes which direction indices are in (ascending or descending).\n bool reverse = imod(elemIdx, 2 * dir) >= dir;\n bool isGreater = x0 > x1 || (x0 == x1 && i1 > i0);\n if (reverse == isGreater) { // Elements in opposite order of direction\n int iTemp = i0;\n i0 = i1;\n i1 = iTemp;\n }\n if (isFirstInPair) {\n setOutput(float(i0));\n } else {\n setOutput(float(i1));\n }\n }\n `;\n }\n}\n\nexport class MergeProgram implements GPGPUProgram {\n variableNames = ['x', 'indices'];\n outputShape: number[];\n userCode: string;\n // |n| Size of the original input of TopK\n // |firstPass| indicates if this is the first time swap is being used which\n // means no indices input containing the top K is present yet.\n // |k| Top k elements desired\n customUniforms = [\n {name: 'n', type: 'int' as UniformType},\n {name: 'firstPass', type: 'int' as UniformType},\n {name: 'k', type: 'int' as UniformType}\n ];\n\n /**\n * @param shape desired output shape (must be half of the input size)\n */\n constructor(shape: number[]) {\n this.outputShape = shape;\n\n this.userCode = `\n void main() {\n // Takes max of indices (0, k), (1, k + 1), (2, k + 2) ...\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int elemIdx = coords[1];\n\n // The output size is half of the previous size.\n // If the previous sequence is | | | | _ _ _ _ | | | | _ _ _ _ (k=4),\n // we only need to output the indices at positions |, the indices at\n // positions _ can be thrown away, see Figure5(b) After Phase 2\n // (Merge phase) in the Bitonic Top K paper referenced above.\n // For example, the paper shows we only need to output the orange bars.\n // The output sequence should look like this | | | | | | | |.\n // Because the sequence is halved, to map the output index back\n // to the previous sequence to find the corresponding value,\n // we need to double the index. When we double the index,\n // we basically interpolate a position, so 2i looks like\n // | _ | _ | _ | _ | _ | _ | _. We move the | to the first k position\n // of each 2k positions by - elemIdx % k. E.g. for output at\n // index 4,5,6,7, we want to get the corresponding element at\n // original index 8,9,10,11, for output at index 8,9,10,11,\n // we want to get the corresponding element at original index\n // 16,17,18,19, so on and so forth.\n\n int i = elemIdx < k ? elemIdx : (elemIdx * 2 - imod(elemIdx, k));\n int i0 = firstPass == 1 ? i : int(getIndices(batch, i));\n int i1 = firstPass == 1 ? i + k : int(getIndices(batch, i + k));\n\n float x0 = getX(batch, i0);\n float x1 = i1 < n ? getX(batch, i1) : x0;\n\n setOutput(x0 >= x1 ? float(i0) : float(i1));\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env, KernelConfig, KernelFunc, NumericDataType, TensorInfo, TopK, TopKAttrs, TopKInputs, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {topKImplCPU} from '../kernel_utils/shared';\nimport {MergeProgram, SwapProgram} from '../top_k_gpu';\nimport {fill} from './Fill';\nimport {gatherV2} from './GatherV2';\nimport {reshape} from './Reshape';\nimport {slice} from './Slice';\n\nfunction disposeIntermediateTensorInfoOrNull(\n backend: MathBackendWebGL, tensorInfo: TensorInfo) {\n if (tensorInfo !== null) {\n backend.disposeIntermediateTensorInfo(tensorInfo);\n }\n}\n\nfunction roundUpToPow2(num: number) {\n let pow2 = 1;\n while (pow2 < num) {\n pow2 *= 2;\n }\n return pow2;\n}\n\n// Based on Algorithm 2 of Bitonic Top K, ref:\n// https://anilshanbhag.in/static/papers/gputopk_sigmod18.pdf\nexport function topK(\n args: {inputs: TopKInputs, backend: MathBackendWebGL, attrs: TopKAttrs}):\n TensorInfo[] {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {k, sorted} = attrs;\n\n // Empirically determined constant used to determine last dim threshold for\n // handing off execution to the CPU.\n const TOPK_LAST_DIM_CPU_HANDOFF_SIZE_THRESHOLD =\n env().getNumber('TOPK_LAST_DIM_CPU_HANDOFF_SIZE_THRESHOLD');\n\n // Empirically determined constant used to determine k threshold for handing\n // off execution to the CPU.\n const TOPK_K_CPU_HANDOFF_THRESHOLD =\n env().getNumber('TOPK_K_CPU_HANDOFF_THRESHOLD');\n\n const xShape = x.shape;\n const lastDim = xShape[xShape.length - 1];\n\n if (backend.shouldExecuteOnCPU([x]) ||\n lastDim < TOPK_LAST_DIM_CPU_HANDOFF_SIZE_THRESHOLD ||\n k > TOPK_K_CPU_HANDOFF_THRESHOLD) {\n const xVals = backend.readSync(x.dataId) as TypedArray;\n const [allTopKVals, allTopKIndices] =\n topKImplCPU(xVals, xShape, x.dtype as NumericDataType, k, sorted);\n\n return [\n backend.makeTensorInfo(\n allTopKVals.shape, allTopKVals.dtype, allTopKVals.values),\n backend.makeTensorInfo(\n allTopKIndices.shape, allTopKIndices.dtype, allTopKIndices.values)\n ];\n }\n\n if (k === 0) {\n xShape[xShape.length - 1] = 0;\n return [\n backend.makeTensorInfo(xShape, x.dtype, []),\n backend.makeTensorInfo(xShape, 'int32', [])\n ];\n }\n\n if (lastDim === 1 /* firstPass */) {\n return [\n x, fill({attrs: {shape: xShape, dtype: 'int32', value: 0}, backend})\n ];\n }\n\n // Eagerly unpack x input since it is passed in to all the shaders which\n // require unpacked inputs.\n const xtexData = backend.texData.get(x.dataId);\n const xIsPacked = xtexData !== null && xtexData.isPacked;\n const xUnPacked = xIsPacked ? backend.unpackTensor(x) : x;\n\n // Reshape into a 2d tensor [batch, lastDim] and compute topk along lastDim.\n const xSize = util.sizeFromShape(xShape);\n const batch = xSize / lastDim;\n const x2D = reshape(\n {inputs: {x: xUnPacked}, attrs: {shape: [batch, lastDim]}, backend});\n\n if (xIsPacked) {\n disposeIntermediateTensorInfoOrNull(backend, xUnPacked);\n }\n\n const kPow2 = roundUpToPow2(k);\n const lastDimPow2 = roundUpToPow2(lastDim);\n\n // Only the indices containing the top K are kept at every step to reduce\n // number of outputs in the GPU algorithms, so once the final set of indices\n // is computed then gather is used to grab the corresponding values\n // from the original input.\n let indices: TensorInfo = null;\n\n // GPU algorithm always takes in an indices input but this input is not used\n // on the first run of a GPU algorithm, therefore if indices is null we simply\n // pass in x2D instead of it but the value will not actually be used\n const getInputs = () => indices === null ? [x2D, x2D] : [x2D, indices];\n\n const runSwap = (dir: number, inc: number, shape: number[]) => {\n const inputs = getInputs();\n const program = new SwapProgram(shape);\n const fistPass = indices === null ? 1 : 0;\n const customValues =\n [[lastDim], [fistPass], [Number.NEGATIVE_INFINITY], [dir], [inc]];\n const prevIndices = indices;\n indices = backend.runWebGLProgram(program, inputs, 'int32', customValues);\n disposeIntermediateTensorInfoOrNull(backend, prevIndices);\n };\n\n // Step 1: local sort\n for (let len = 1; len < kPow2; len *= 2) {\n const dir = len * 2;\n for (let inc = len; inc >= 1; inc /= 2) {\n runSwap(dir, inc, [batch, lastDimPow2]);\n }\n }\n\n // Step 2: merge\n for (let indicesSize = lastDimPow2; indicesSize > kPow2; indicesSize /= 2) {\n const inputs = getInputs();\n const mergeProgram = new MergeProgram([batch, indicesSize / 2]);\n const firstPass = indices === null ? 1 : 0;\n const customValues = [[lastDim], [firstPass], [kPow2]];\n const prevIndices = indices;\n indices =\n backend.runWebGLProgram(mergeProgram, inputs, 'int32', customValues);\n disposeIntermediateTensorInfoOrNull(backend, prevIndices);\n\n // Step 3: rebuild\n const len = kPow2 / 2;\n const dir = len * 2;\n for (let inc = len; inc >= 1; inc /= 2) {\n runSwap(dir, inc, indices.shape);\n }\n }\n\n // Keep only the requested top K results instead of kPow2\n let prevIndices = indices;\n indices = slice(\n {inputs: {x: indices}, backend, attrs: {begin: 0, size: [batch, k]}});\n disposeIntermediateTensorInfoOrNull(backend, prevIndices);\n\n // Gather values on last dimension\n let values = gatherV2(\n {inputs: {x: x2D, indices}, backend, attrs: {axis: 1, batchDims: 1}});\n disposeIntermediateTensorInfoOrNull(backend, x2D);\n\n // Reshape back to the original input shape, except that the last\n // dimension is k.\n const newShape = xShape.slice(0, -1);\n newShape.push(k);\n\n prevIndices = indices;\n indices = reshape({inputs: {x: indices}, attrs: {shape: newShape}, backend});\n disposeIntermediateTensorInfoOrNull(backend, prevIndices);\n\n const prevValues = values;\n values = reshape({inputs: {x: values}, attrs: {shape: newShape}, backend});\n disposeIntermediateTensorInfoOrNull(backend, prevValues);\n\n return [values, indices];\n}\n\nexport const topKConfig: KernelConfig = {\n kernelName: TopK,\n backendName: 'webgl',\n kernelFunc: topK as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class TransformProgram implements GPGPUProgram {\n variableNames = ['Image', 'Transforms'];\n outputShape: number[];\n userCode: string;\n\n constructor(\n imageHeight: number, imageWidth: number,\n interpolation: 'nearest'|'bilinear',\n fillMode: 'constant'|'reflect'|'wrap'|'nearest', fillValue: number,\n outShape: [number, number, number, number]) {\n this.outputShape = outShape;\n const interpolationModeId = interpolation === 'nearest' ? 1 : 2;\n let fillModeId;\n switch (fillMode) {\n case 'constant':\n fillModeId = 1;\n break;\n case 'reflect':\n fillModeId = 2;\n break;\n case 'wrap':\n fillModeId = 3;\n break;\n case 'nearest':\n fillModeId = 4;\n break;\n default:\n fillModeId = 1;\n break;\n }\n this.userCode = `\n float mapCoord(float outCoord, float len) {\n float inCoord = outCoord;\n if(${fillModeId} == 2) {\n if (inCoord < 0.0) {\n if (len <= 1.0) {\n inCoord = 0.0;\n } else {\n float sz2 = 2.0 * len;\n if (inCoord < sz2) {\n inCoord = sz2 * float(int(float(-inCoord / sz2))) +\n inCoord;\n }\n inCoord = inCoord < -len ? inCoord + sz2 : -inCoord - 1.0;\n }\n } else if (inCoord > len - 1.0) {\n if (len <= 1.0) {\n inCoord = 0.0;\n } else {\n float sz2 = 2.0 * len;\n inCoord -= sz2 * float(int(float(inCoord / sz2)));\n if (inCoord >= len) {\n inCoord = sz2 - inCoord - 1.0;\n }\n }\n }\n return clamp(inCoord, 0.0, len - 1.0);\n } else if (${fillModeId} == 3) {\n if (inCoord < 0.0) {\n if (len <= 1.0) {\n inCoord = 0.0;\n } else {\n float sz = len - 1.0;\n inCoord += len * (float(int(float(-inCoord / sz))) + 1.0);\n }\n } else if (inCoord > len - 1.0) {\n if (len <= 1.0) {\n inCoord = 0.0;\n } else {\n float sz = len - 1.0;\n inCoord -= len * float(int(float(inCoord / sz)));\n }\n }\n return clamp(inCoord, 0.0, len - 1.0);\n } else if (${fillModeId} == 4) {\n return clamp(outCoord, 0.0, len - 1.0);\n } else {\n return outCoord;\n }\n }\n\n float readWithFillValue(int batch, int coordY, int coordX,\n int channel) {\n float outputValue;\n if (0 <= coordY && coordY < ${\n imageHeight} && 0 <= coordX && coordX < ${imageWidth}) {\n outputValue = getImage(batch, coordY, coordX, channel);\n } else {\n outputValue = float(${fillValue});\n }\n return outputValue;\n }\n\n void main() {\n ivec4 coords = getOutputCoords();\n float outputValue;\n int batch = coords[0];\n int x = coords[2];\n int y = coords[1];\n int channel = coords[3];\n float xf = float(x);\n float yf = float(y);\n float a1 = getTransforms(batch, 0);\n float a2 = getTransforms(batch, 1);\n float a3 = getTransforms(batch, 2);\n float b1 = getTransforms(batch, 3);\n float b2 = getTransforms(batch, 4);\n float b3 = getTransforms(batch, 5);\n float c1 = getTransforms(batch, 6);\n float c2 = getTransforms(batch, 7);\n float projection = c1 * xf + c2 * yf + 1.0;\n if (projection == 0.0) {\n outputValue = float(${fillValue});\n } else {\n float inX = (a1 * xf + a2 * yf + a3) / projection;\n float inY = (b1 * xf + b2 * yf + b3) / projection;\n float mapX = mapCoord(inX, float(${imageWidth}));\n float mapY = mapCoord(inY, float(${imageHeight}));\n\n if (${interpolationModeId} == 1) {\n int coordY = int(round(mapY));\n int coordX = int(round(mapX));\n outputValue = readWithFillValue(batch, coordY, coordX,\n channel);\n } else {\n float yFloor = floor(mapY);\n float xFloor = floor(mapX);\n float yCeil = yFloor + 1.0;\n float xCeil = xFloor + 1.0;\n float valueYFloor = (xCeil - mapX) *\n readWithFillValue(batch, int(yFloor), int(xFloor), channel) +\n (mapX - xFloor) *\n readWithFillValue(batch, int(yFloor), int(xCeil), channel);\n float valueYCeil = (xCeil - mapX) *\n readWithFillValue(batch, int(yCeil), int(xFloor), channel) +\n (mapX - xFloor) *\n readWithFillValue(batch, int(yCeil), int(xCeil), channel);\n outputValue = (yCeil - mapY) * valueYFloor +\n (mapY - yFloor) * valueYCeil;\n }\n }\n setOutput(outputValue);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, TensorInfo, Transform, TransformAttrs, TransformInputs} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {TransformProgram} from '../transform_gpu';\n\nexport function transform(args: {\n inputs: TransformInputs,\n backend: MathBackendWebGL,\n attrs: TransformAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {image, transforms} = inputs;\n const {interpolation, fillMode, fillValue, outputShape} = attrs;\n\n const [batch, imageHeight, imageWidth, numChannels] = image.shape;\n const [outHeight, outWidth] =\n outputShape != null ? outputShape : [imageHeight, imageWidth];\n const outShape =\n [batch, outHeight, outWidth,\n numChannels] as [number, number, number, number];\n\n const program = new TransformProgram(\n imageHeight, imageWidth, interpolation, fillMode, fillValue, outShape);\n return backend.runWebGLProgram(program, [image, transforms], 'float32');\n}\n\nexport const transformConfig: KernelConfig = {\n kernelName: Transform,\n backendName: 'webgl',\n kernelFunc: transform as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the License);\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an AS IS BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, TensorInfo, Unique, UniqueAttrs, UniqueInputs} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {uniqueImplCPU} from '../kernel_utils/shared';\nimport {assertNotComplex} from '../webgl_util';\n\nexport function unique(\n args:\n {inputs: UniqueInputs, attrs: UniqueAttrs, backend: MathBackendWebGL}):\n TensorInfo[] {\n const {inputs, attrs, backend} = args;\n const {axis} = attrs;\n const {x} = inputs;\n assertNotComplex(x, 'unique');\n\n // For now, always forward calculation to the CPU backend.\n console.warn(\n 'WARNING: ',\n 'UI might be locked temporarily as data is being downloaded');\n const values = backend.readSync(x.dataId);\n const {outputValues, outputShape, indices} =\n uniqueImplCPU(values, axis, x.shape, x.dtype);\n return [\n backend.makeTensorInfo(outputShape, x.dtype, outputValues),\n backend.makeTensorInfo([indices.length], 'int32', indices),\n ];\n}\n\nexport const uniqueConfig: KernelConfig = {\n kernelName: Unique,\n backendName: 'webgl',\n kernelFunc: unique as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, TensorInfo, Unpack, UnpackAttrs, UnpackInputs} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\n\nimport {reshape} from './Reshape';\nimport {slice} from './Slice';\n\nexport function unpack(\n args:\n {inputs: UnpackInputs, backend: MathBackendWebGL, attrs: UnpackAttrs}):\n TensorInfo[] {\n const {inputs, backend, attrs} = args;\n const {value} = inputs;\n let {axis} = attrs;\n\n if (axis < 0) {\n axis += value.shape.length;\n }\n\n const x = value;\n const xRank = x.shape.length;\n\n const num = value.shape[axis];\n const outShape: number[] = new Array(xRank - 1);\n let outIndex = 0;\n for (let i = 0; i < xRank; i++) {\n if (i !== axis) {\n outShape[outIndex++] = x.shape[i];\n }\n }\n\n const toDispose = [];\n\n const begin = new Array(xRank).fill(0);\n const size = x.shape.slice();\n size[axis] = 1;\n const res: TensorInfo[] = new Array(num);\n for (let i = 0; i < res.length; i++) {\n begin[axis] = i;\n const sliced = slice({inputs: {x}, backend, attrs: {begin, size}});\n const reshaped =\n reshape({inputs: {x: sliced}, backend, attrs: {shape: outShape}});\n res[i] = reshaped;\n\n toDispose.push(sliced);\n }\n\n toDispose.forEach(t => backend.disposeIntermediateTensorInfo(t));\n return res;\n}\n\nexport const unpackConfig: KernelConfig = {\n kernelName: Unpack,\n backendName: 'webgl',\n kernelFunc: unpack as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class SegmentOpProgram implements GPGPUProgram {\n variableNames = ['x', 'segmentIds'];\n outputShape: number[];\n userCode: string;\n\n constructor(\n segOpInfo: backend_util.segment_util.SegOpInfo,\n segOpType: 'unsortedSegmentSum') {\n const windowSize = segOpInfo.windowSize;\n const batchSize = segOpInfo.batchSize;\n const inSize = segOpInfo.inSize;\n const numSegments = segOpInfo.numSegments;\n const outSize = numSegments * Math.ceil(inSize / windowSize);\n this.outputShape = [batchSize, outSize];\n\n const initializationValue = '0.0';\n const returnValue = `sumValue`;\n\n const windowSizeNearestVec4 = Math.floor(windowSize / 4) * 4;\n const windowSizeVec4Remainder = windowSize % 4;\n\n const updateSnippet = `\n sumValue += dot(values, segFilter);\n `;\n\n let checkValueOutOfBounds = '';\n if (inSize % windowSize > 0) {\n checkValueOutOfBounds = `\n if (inIdx < 0 || inIdx >= ${inSize}) {\n return initializationValue;\n }\n `;\n }\n\n let checkSegmentIdOutOfBounds = '';\n if (inSize % windowSize > 0) {\n checkSegmentIdOutOfBounds = `\n if (inIdx < 0 || inIdx >= ${inSize}) {\n return -1.0;\n }\n `;\n }\n\n this.userCode = `\n const float initializationValue = ${initializationValue};\n\n float getValue(int batch, int inIdx) {\n ${checkValueOutOfBounds}\n return getX(batch, inIdx);\n }\n\n float getSegmentIdAtIndex(int inIdx) {\n ${checkSegmentIdOutOfBounds}\n return getSegmentIds(inIdx);\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int outIdx = coords[1];\n int inOffset = int(floor(float(outIdx) / float(\n ${numSegments})) * float(${windowSize}));\n int currentSeg = int(mod(float(outIdx), float(${numSegments})));\n\n float sumValue = 0.0;\n\n for (int i = 0; i < ${windowSizeNearestVec4}; i += 4) {\n int inIdx = inOffset + i;\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n getValue(batch, inIdx + 3)\n );\n\n vec4 segFilter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 3)) == currentSeg ? 1 : 0\n );\n\n ${updateSnippet}\n }\n\n int inIdx = inOffset + ${windowSizeNearestVec4};\n if (${windowSizeVec4Remainder === 1}) {\n vec4 values = vec4(\n getValue(batch, inIdx),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n int inIdxSeg = int(getSegmentIdAtIndex(inIdx));\n\n vec4 segFilter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n 0,\n 0,\n 0\n );\n\n ${updateSnippet}\n } else if (${windowSizeVec4Remainder === 2}) {\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n initializationValue,\n initializationValue\n );\n\n vec4 segFilter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n 0,\n 0\n );\n\n ${updateSnippet}\n } else if (${windowSizeVec4Remainder === 3}) {\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n initializationValue\n );\n\n vec4 segFilter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0,\n 0\n );\n\n ${updateSnippet}\n }\n setOutput(${returnValue});\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, DataType, KernelConfig, KernelFunc, sumOutType, TensorInfo, UnsortedSegmentSum, UnsortedSegmentSumAttrs, UnsortedSegmentSumInputs, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {SegmentOpProgram} from '../segment_gpu';\n\nimport {range} from './Range';\nimport {reshape} from './Reshape';\nimport {tile} from './Tile';\nimport {transpose} from './Transpose';\n\nexport function unsortedSegmentSum(args: {\n inputs: UnsortedSegmentSumInputs,\n backend: MathBackendWebGL,\n attrs: UnsortedSegmentSumAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x, segmentIds} = inputs;\n const {numSegments} = attrs;\n\n const xRank = x.shape.length;\n\n const toDispose = [];\n\n let axis = 0;\n const permutation = backend_util.getAxesPermutation([axis], xRank);\n let permutedX = x;\n if (permutation != null) {\n permutedX = transpose({inputs: {x}, backend, attrs: {perm: permutation}});\n toDispose.push(permutedX);\n axis = backend_util.getInnerMostAxes(1, xRank)[0];\n }\n\n const outShape = backend_util.segment_util.computeOutShape(\n permutedX.shape, axis, numSegments);\n const inSize = util.sizeFromShape([permutedX.shape[axis]]);\n const a2D =\n reshape({inputs: {x: permutedX}, backend, attrs: {shape: [-1, inSize]}});\n toDispose.push(a2D);\n\n const outputDType = sumOutType(x.dtype);\n\n const segOpCompute =\n (x: TensorInfo, segOpType: 'unsortedSegmentSum', segmentIds: TensorInfo,\n dtype: DataType, numSegments: number): TensorInfo => {\n const batchSize = x.shape[0];\n const inSize = x.shape[1];\n const windowSize =\n backend_util.segment_util.segOpComputeOptimalWindowSize(\n inSize, numSegments);\n const segOpInfo = {windowSize, inSize, batchSize, numSegments};\n const program = new SegmentOpProgram(segOpInfo, segOpType);\n const output = backend.compileAndRun(program, [x, segmentIds], dtype);\n toDispose.push(output);\n // No need to run another GPGPU program.\n if (output.shape[1] === numSegments) {\n return output;\n }\n const rangeInfo = range({\n backend,\n attrs: {start: 0, stop: numSegments, step: 1, dtype: 'float32'}\n });\n const tileInfo = tile({\n inputs: {x: rangeInfo},\n backend,\n attrs: {reps: [inSize / windowSize]}\n });\n\n toDispose.push(rangeInfo);\n toDispose.push(tileInfo);\n\n const result =\n segOpCompute(output, segOpType, tileInfo, dtype, numSegments);\n return result;\n };\n\n const segOpResult = segOpCompute(\n a2D, 'unsortedSegmentSum', segmentIds, outputDType, numSegments);\n\n const reshaped =\n reshape({inputs: {x: segOpResult}, backend, attrs: {shape: outShape}});\n\n let result = reshaped;\n if (permutation != null) {\n toDispose.push(reshaped);\n const perm = backend_util.getUndoAxesPermutation(permutation);\n result = transpose({inputs: {x: result}, backend, attrs: {perm}});\n }\n\n toDispose.forEach(t => backend.disposeIntermediateTensorInfo(t));\n return result;\n}\n\nexport const unsortedSegmentSumConfig: KernelConfig = {\n kernelName: UnsortedSegmentSum,\n backendName: 'webgl',\n kernelFunc: unsortedSegmentSum as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, registerKernel} from '@tensorflow/tfjs-core';\n\nimport {_fusedMatMulConfig} from './kernels/_FusedMatMul';\nimport {absConfig} from './kernels/Abs';\nimport {acosConfig} from './kernels/Acos';\nimport {acoshConfig} from './kernels/Acosh';\nimport {addConfig} from './kernels/Add';\nimport {addNConfig} from './kernels/AddN';\nimport {allConfig} from './kernels/All';\nimport {anyConfig} from './kernels/Any';\nimport {argMaxConfig} from './kernels/ArgMax';\nimport {argMinConfig} from './kernels/ArgMin';\nimport {asinConfig} from './kernels/Asin';\nimport {asinhConfig} from './kernels/Asinh';\nimport {atanConfig} from './kernels/Atan';\nimport {atan2Config} from './kernels/Atan2';\nimport {atanhConfig} from './kernels/Atanh';\nimport {avgPoolConfig} from './kernels/AvgPool';\nimport {avgPool3DConfig} from './kernels/AvgPool3D';\nimport {avgPool3DGradConfig} from './kernels/AvgPool3DGrad';\nimport {avgPoolGradConfig} from './kernels/AvgPoolGrad';\nimport {batchMatMulConfig} from './kernels/BatchMatMul';\nimport {batchNormConfig} from './kernels/BatchNorm';\nimport {batchToSpaceNDConfig} from './kernels/BatchToSpaceND';\nimport {bincountConfig} from './kernels/Bincount';\nimport {broadcastArgsConfig} from './kernels/BroadcastArgs';\nimport {castConfig} from './kernels/Cast';\nimport {ceilConfig} from './kernels/Ceil';\nimport {clipByValueConfig} from './kernels/ClipByValue';\nimport {complexConfig} from './kernels/Complex';\nimport {complexAbsConfig} from './kernels/ComplexAbs';\nimport {concatConfig} from './kernels/Concat';\nimport {conv2DConfig} from './kernels/Conv2D';\nimport {conv2DBackpropFilterConfig} from './kernels/Conv2DBackpropFilter';\nimport {conv2DBackpropInputConfig} from './kernels/Conv2DBackpropInput';\nimport {conv3DConfig} from './kernels/Conv3D';\nimport {conv3DBackpropFilterV2Config} from './kernels/Conv3DBackpropFilterV2';\nimport {conv3DBackpropInputConfig} from './kernels/Conv3DBackpropInputV2';\nimport {cosConfig} from './kernels/Cos';\nimport {coshConfig} from './kernels/Cosh';\nimport {cropAndResizeConfig} from './kernels/CropAndResize';\nimport {cumprodConfig} from './kernels/Cumprod';\nimport {cumsumConfig} from './kernels/Cumsum';\nimport {denseBincountConfig} from './kernels/DenseBincount';\nimport {depthToSpaceConfig} from './kernels/DepthToSpace';\nimport {depthwiseConv2dNativeConfig} from './kernels/DepthwiseConv2dNative';\nimport {depthwiseConv2dNativeBackpropFilterConfig} from './kernels/DepthwiseConv2dNativeBackpropFilter';\nimport {depthwiseConv2dNativeBackpropInputConfig} from './kernels/DepthwiseConv2dNativeBackpropInput';\nimport {diagConfig} from './kernels/Diag';\nimport {dilation2DConfig} from './kernels/Dilation2D';\nimport {einsumConfig} from './kernels/Einsum';\nimport {eluConfig} from './kernels/Elu';\nimport {eluGradConfig} from './kernels/EluGrad';\nimport {equalConfig} from './kernels/Equal';\nimport {erfConfig} from './kernels/Erf';\nimport {expConfig} from './kernels/Exp';\nimport {expandDimsConfig} from './kernels/ExpandDims';\nimport {expm1Config} from './kernels/Expm1';\nimport {fftConfig} from './kernels/FFT';\nimport {fillConfig} from './kernels/Fill';\nimport {flipLeftRightConfig} from './kernels/FlipLeftRight';\nimport {floorConfig} from './kernels/Floor';\nimport {floorDivConfig} from './kernels/FloorDiv';\nimport {fromPixelsConfig} from './kernels/FromPixels';\nimport {fusedConv2DConfig} from './kernels/FusedConv2D';\nimport {fusedDepthwiseConv2DConfig} from './kernels/FusedDepthwiseConv2D';\nimport {gatherNdConfig} from './kernels/GatherNd';\nimport {gatherV2Config} from './kernels/GatherV2';\nimport {greaterConfig} from './kernels/Greater';\nimport {greaterEqualConfig} from './kernels/GreaterEqual';\nimport {identityConfig} from './kernels/Identity';\nimport {ifftConfig} from './kernels/IFFT';\nimport {imagConfig} from './kernels/Imag';\nimport {isFiniteConfig} from './kernels/IsFinite';\nimport {isInfConfig} from './kernels/IsInf';\nimport {isNaNConfig} from './kernels/IsNaN';\nimport {leakyReluConfig} from './kernels/LeakyRelu';\nimport {lessConfig} from './kernels/Less';\nimport {lessEqualConfig} from './kernels/LessEqual';\nimport {linSpaceConfig} from './kernels/LinSpace';\nimport {logConfig} from './kernels/Log';\nimport {log1pConfig} from './kernels/Log1p';\nimport {logicalAndConfig} from './kernels/LogicalAnd';\nimport {logicalNotConfig} from './kernels/LogicalNot';\nimport {logicalOrConfig} from './kernels/LogicalOr';\nimport {LRNConfig} from './kernels/LRN';\nimport {LRNGradConfig} from './kernels/LRNGrad';\nimport {maxConfig} from './kernels/Max';\nimport {maximumConfig} from './kernels/Maximum';\nimport {maxPoolConfig} from './kernels/MaxPool';\nimport {maxPool3DConfig} from './kernels/MaxPool3D';\nimport {maxPool3DGradConfig} from './kernels/MaxPool3DGrad';\nimport {maxPoolGradConfig} from './kernels/MaxPoolGrad';\nimport {maxPoolWithArgmaxConfig} from './kernels/MaxPoolWithArgmax';\nimport {meanConfig} from './kernels/Mean';\nimport {minConfig} from './kernels/Min';\nimport {minimumConfig} from './kernels/Minimum';\nimport {mirrorPadConfig} from './kernels/MirrorPad';\nimport {modConfig} from './kernels/Mod';\nimport {multinomialConfig} from './kernels/Multinomial';\nimport {multiplyConfig} from './kernels/Multiply';\nimport {negConfig} from './kernels/Neg';\nimport {nonMaxSuppressionV3Config} from './kernels/NonMaxSuppressionV3';\nimport {nonMaxSuppressionV4Config} from './kernels/NonMaxSuppressionV4';\nimport {nonMaxSuppressionV5Config} from './kernels/NonMaxSuppressionV5';\nimport {notEqualConfig} from './kernels/NotEqual';\nimport {oneHotConfig} from './kernels/OneHot';\nimport {onesLikeConfig} from './kernels/OnesLike';\nimport {packConfig} from './kernels/Pack';\nimport {padV2Config} from './kernels/PadV2';\nimport {powConfig} from './kernels/Pow';\nimport {preluConfig} from './kernels/Prelu';\nimport {prodConfig} from './kernels/Prod';\nimport {raggedGatherConfig} from './kernels/RaggedGather';\nimport {raggedRangeConfig} from './kernels/RaggedRange';\nimport {raggedTensorToTensorConfig} from './kernels/RaggedTensorToTensor';\nimport {rangeConfig} from './kernels/Range';\nimport {realConfig} from './kernels/Real';\nimport {realDivConfig} from './kernels/RealDiv';\nimport {reciprocalConfig} from './kernels/Reciprocal';\nimport {reluConfig} from './kernels/Relu';\nimport {relu6Config} from './kernels/Relu6';\nimport {reshapeConfig} from './kernels/Reshape';\nimport {resizeBilinearConfig} from './kernels/ResizeBilinear';\nimport {resizeBilinearGradConfig} from './kernels/ResizeBilinearGrad';\nimport {resizeNearestNeighborConfig} from './kernels/ResizeNearestNeighbor';\nimport {resizeNearestNeighborGradConfig} from './kernels/ResizeNearestNeighborGrad';\nimport {reverseConfig} from './kernels/Reverse';\nimport {rotateWithOffsetConfig} from './kernels/RotateWithOffset';\nimport {roundConfig} from './kernels/Round';\nimport {rsqrtConfig} from './kernels/Rsqrt';\nimport {scatterNdConfig} from './kernels/ScatterNd';\nimport {searchSortedConfig} from './kernels/SearchSorted';\nimport {selectConfig} from './kernels/Select';\nimport {seluConfig} from './kernels/Selu';\nimport {sigmoidConfig} from './kernels/Sigmoid';\nimport {signConfig} from './kernels/Sign';\nimport {sinConfig} from './kernels/Sin';\nimport {sinhConfig} from './kernels/Sinh';\nimport {sliceConfig} from './kernels/Slice';\nimport {softmaxConfig} from './kernels/Softmax';\nimport {softplusConfig} from './kernels/Softplus';\nimport {spaceToBatchNDConfig} from './kernels/SpaceToBatchND';\nimport {sparseFillEmptyRowsConfig} from './kernels/SparseFillEmptyRows';\nimport {sparseReshapeConfig} from './kernels/SparseReshape';\nimport {sparseSegmentMeanConfig} from './kernels/SparseSegmentMean';\nimport {sparseSegmentSumConfig} from './kernels/SparseSegmentSum';\nimport {sparseToDenseConfig} from './kernels/SparseToDense';\nimport {splitVConfig} from './kernels/SplitV';\nimport {sqrtConfig} from './kernels/Sqrt';\nimport {squareConfig} from './kernels/Square';\nimport {squaredDifferenceConfig} from './kernels/SquaredDifference';\nimport {stepConfig} from './kernels/Step';\nimport {stridedSliceConfig} from './kernels/StridedSlice';\nimport {stringNGramsConfig} from './kernels/StringNGrams';\nimport {stringSplitConfig} from './kernels/StringSplit';\nimport {stringToHashBucketFastConfig} from './kernels/StringToHashBucketFast';\nimport {subConfig} from './kernels/Sub';\nimport {sumConfig} from './kernels/Sum';\nimport {tanConfig} from './kernels/Tan';\nimport {tanhConfig} from './kernels/Tanh';\nimport {tileConfig} from './kernels/Tile';\nimport {topKConfig} from './kernels/TopK';\nimport {transformConfig} from './kernels/Transform';\nimport {transposeConfig} from './kernels/Transpose';\nimport {uniqueConfig} from './kernels/Unique';\nimport {unpackConfig} from './kernels/Unpack';\nimport {unsortedSegmentSumConfig} from './kernels/UnsortedSegmentSum';\nimport {zerosLikeConfig} from './kernels/ZerosLike';\n\n// List all kernel configs here\nconst kernelConfigs: KernelConfig[] = [\n _fusedMatMulConfig,\n absConfig,\n acosConfig,\n acoshConfig,\n addConfig,\n addNConfig,\n allConfig,\n anyConfig,\n argMaxConfig,\n argMinConfig,\n asinConfig,\n asinhConfig,\n atanConfig,\n atan2Config,\n atanhConfig,\n avgPoolConfig,\n avgPool3DConfig,\n avgPool3DGradConfig,\n avgPoolGradConfig,\n batchMatMulConfig,\n batchNormConfig,\n batchToSpaceNDConfig,\n bincountConfig,\n broadcastArgsConfig,\n castConfig,\n ceilConfig,\n clipByValueConfig,\n complexConfig,\n complexAbsConfig,\n concatConfig,\n conv2DConfig,\n conv2DBackpropFilterConfig,\n conv2DBackpropInputConfig,\n conv3DConfig,\n conv3DBackpropFilterV2Config,\n conv3DBackpropInputConfig,\n cosConfig,\n coshConfig,\n cropAndResizeConfig,\n cumprodConfig,\n cumsumConfig,\n denseBincountConfig,\n depthToSpaceConfig,\n depthwiseConv2dNativeConfig,\n depthwiseConv2dNativeBackpropFilterConfig,\n depthwiseConv2dNativeBackpropInputConfig,\n diagConfig,\n dilation2DConfig,\n einsumConfig,\n eluConfig,\n eluGradConfig,\n equalConfig,\n erfConfig,\n expConfig,\n expandDimsConfig,\n expm1Config,\n fftConfig,\n fillConfig,\n flipLeftRightConfig,\n floorConfig,\n floorDivConfig,\n fromPixelsConfig,\n fusedConv2DConfig,\n fusedDepthwiseConv2DConfig,\n gatherNdConfig,\n gatherV2Config,\n greaterConfig,\n greaterEqualConfig,\n identityConfig,\n ifftConfig,\n imagConfig,\n isFiniteConfig,\n isInfConfig,\n isNaNConfig,\n leakyReluConfig,\n lessConfig,\n lessEqualConfig,\n linSpaceConfig,\n logConfig,\n log1pConfig,\n logicalAndConfig,\n logicalNotConfig,\n logicalOrConfig,\n LRNConfig,\n LRNGradConfig,\n maxConfig,\n maximumConfig,\n maxPoolConfig,\n maxPool3DConfig,\n maxPool3DGradConfig,\n maxPoolGradConfig,\n maxPoolWithArgmaxConfig,\n meanConfig,\n minConfig,\n minimumConfig,\n mirrorPadConfig,\n modConfig,\n multinomialConfig,\n multiplyConfig,\n negConfig,\n nonMaxSuppressionV3Config,\n nonMaxSuppressionV4Config,\n nonMaxSuppressionV5Config,\n notEqualConfig,\n oneHotConfig,\n onesLikeConfig,\n packConfig,\n padV2Config,\n powConfig,\n preluConfig,\n prodConfig,\n raggedGatherConfig,\n raggedRangeConfig,\n raggedTensorToTensorConfig,\n rangeConfig,\n realConfig,\n realDivConfig,\n reciprocalConfig,\n reluConfig,\n relu6Config,\n reshapeConfig,\n resizeBilinearConfig,\n resizeBilinearGradConfig,\n resizeNearestNeighborConfig,\n resizeNearestNeighborGradConfig,\n reverseConfig,\n rotateWithOffsetConfig,\n roundConfig,\n rsqrtConfig,\n scatterNdConfig,\n searchSortedConfig,\n selectConfig,\n seluConfig,\n sigmoidConfig,\n signConfig,\n sinConfig,\n sinhConfig,\n sliceConfig,\n softmaxConfig,\n softplusConfig,\n spaceToBatchNDConfig,\n sparseFillEmptyRowsConfig,\n sparseReshapeConfig,\n sparseSegmentMeanConfig,\n sparseSegmentSumConfig,\n sparseToDenseConfig,\n splitVConfig,\n sqrtConfig,\n squareConfig,\n squaredDifferenceConfig,\n stepConfig,\n stridedSliceConfig,\n stringNGramsConfig,\n stringSplitConfig,\n stringToHashBucketFastConfig,\n subConfig,\n sumConfig,\n tanConfig,\n tanhConfig,\n tileConfig,\n topKConfig,\n transformConfig,\n transposeConfig,\n uniqueConfig,\n unpackConfig,\n unsortedSegmentSumConfig,\n zerosLikeConfig\n];\n\nfor (const kernelConfig of kernelConfigs) {\n registerKernel(kernelConfig);\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// All exports from this package should be in base.\nexport * from './base';\nimport './register_all_kernels';\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env} from '@tensorflow/tfjs-core';\n\nconst ENV = env();\n\n/** The batched dispatching calls size in the device queue. */\nENV.registerFlag('WEBGPU_DEFERRED_SUBMIT_BATCH_SIZE', () => 15);\n\n/**\n * Whether we forward execution to the CPU backend if tensors are small and\n * reside on the CPU.\n */\nENV.registerFlag('WEBGPU_CPU_FORWARD', () => true);\n\n/**\n * This flag is used to test different types of matmul programs.\n *\n * See MatMulProgramType in webgpu_util.ts for a list of available values.\n */\nENV.registerFlag('WEBGPU_MATMUL_PROGRAM_TYPE', () => -1);\n\n/**\n * Whether to use conv2dTranspose_naive which directly implement the\n * conv2dTranspose logic rather than using a matmul to simulate.\n */\nENV.registerFlag('WEBGPU_USE_NAIVE_CONV2D_TRANSPOSE', () => false);\n\n/**\n * Whether we use low power GPU. Otherwise, a high performance GPU will be\n * requested.\n */\nENV.registerFlag('WEBGPU_USE_LOW_POWER_GPU', () => false);\n\n/**\n * Threshold for input tensor size that determines whether WebGPU backend will\n * delegate computation to CPU.\n *\n * Default value is 1000.\n */\nENV.registerFlag('WEBGPU_CPU_HANDOFF_SIZE_THRESHOLD', () => 1000);\n\n/**\n * Whether to use a dummy canvas to make profiling tools like PIX work with\n * TFJS webgpu backend.\n */\nENV.registerFlag('WEBGPU_USE_PROFILE_TOOL', () => false);\n\n/**\n * Whether to use import API.\n */\nENV.registerFlag('WEBGPU_IMPORT_EXTERNAL_TEXTURE', () => true);\n\n/**\n * Whether to use conv2dNaive for debugging.\n */\nENV.registerFlag('WEBGPU_USE_NAIVE_CONV2D_DEBUG', () => false);\n\n/**\n * Threshold to increase dispatched workgroups for matmul. If too few workgroups\n * are dispatched, it means the hardware may be in low occupancy.\n * 0 means it's not set by the user. A default strategy will be applied.\n */\nENV.registerFlag('WEBGPU_THRESHOLD_TO_INCREASE_WORKGROUPS_FOR_MATMUL', () => 0);\n\n/**\n * Whether we will run im2col as a separate shader for convolution.\n */\nENV.registerFlag('WEBGPU_CONV_SEPARATE_IM2COL_SHADER', () => false);\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nexport class AdapterInfo {\n private vendor: string;\n private architecture: string;\n public intelGPUGeneration: number;\n\n constructor(adapterInfo: GPUAdapterInfo) {\n if (adapterInfo) {\n this.vendor = adapterInfo.vendor;\n this.architecture = adapterInfo.architecture;\n this.intelGPUGeneration = this.getIntelGPUGeneration();\n }\n }\n\n private getIntelGPUGeneration() {\n if (this.isIntel()) {\n if (this.architecture.startsWith('gen')) {\n return Number(this.architecture.match(/\\d+/));\n } else if (this.architecture.startsWith('xe')) {\n return 12;\n }\n }\n return 0;\n }\n\n isIntel(): boolean {\n return this.vendor === 'intel';\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nexport class BufferManager {\n private numUsedBuffers = 0;\n private numFreeBuffers = 0;\n private freeBuffers: Map = new Map();\n private usedBuffers: Map = new Map();\n\n public numBytesUsed = 0;\n public numBytesAllocated = 0;\n\n constructor(private device: GPUDevice) {}\n\n acquireUploadBuffer(size: number, usage: GPUBufferUsageFlags) {\n return this.acquireBuffer(size, usage, true);\n }\n\n acquireBuffer(\n size: number, usage: GPUBufferUsageFlags, mappedAtCreation = false) {\n const key = getBufferKey(size, usage);\n if (!this.freeBuffers.has(key)) {\n this.freeBuffers.set(key, []);\n }\n\n if (!this.usedBuffers.has(key)) {\n this.usedBuffers.set(key, []);\n }\n\n this.numBytesUsed += size;\n this.numUsedBuffers++;\n\n if (this.freeBuffers.get(key).length > 0) {\n this.numFreeBuffers--;\n\n const newBuffer = this.freeBuffers.get(key).shift();\n this.usedBuffers.get(key).push(newBuffer);\n return newBuffer;\n }\n\n this.numBytesAllocated += size;\n const newBuffer = this.device.createBuffer({size, usage, mappedAtCreation});\n this.usedBuffers.get(key).push(newBuffer);\n\n return newBuffer;\n }\n\n releaseBuffer(buffer: GPUBuffer, size: number, usage: GPUBufferUsageFlags) {\n if (this.freeBuffers.size === 0) {\n return;\n }\n\n const key = getBufferKey(size, usage);\n if (!this.freeBuffers.has(key)) {\n this.freeBuffers.set(key, []);\n }\n\n this.freeBuffers.get(key).push(buffer);\n this.numFreeBuffers++;\n this.numUsedBuffers--;\n\n const bufferList = this.usedBuffers.get(key);\n const bufferIndex = bufferList.indexOf(buffer);\n if (bufferIndex < 0) {\n throw new Error(\n 'Cannot release a buffer that was never provided by this ' +\n 'buffer manager');\n }\n bufferList.splice(bufferIndex, 1);\n this.numBytesUsed -= size;\n }\n\n releaseUploadBuffer(\n buffer: GPUBuffer, size: number, usage: GPUBufferUsageFlags) {\n buffer.mapAsync(GPUMapMode.WRITE)\n .then(\n () => {\n this.releaseBuffer(buffer, size, usage);\n },\n (err) => {\n // Do nothing;\n });\n }\n\n getNumUsedBuffers(): number {\n return this.numUsedBuffers;\n }\n\n getNumFreeBuffers(): number {\n return this.numFreeBuffers;\n }\n\n dispose() {\n this.freeBuffers.forEach((buffers, key) => {\n buffers.forEach(buffer => {\n buffer.destroy();\n });\n });\n\n this.usedBuffers.forEach((buffers, key) => {\n buffers.forEach(buffer => {\n buffer.destroy();\n });\n });\n\n this.freeBuffers = new Map();\n this.usedBuffers = new Map();\n this.numUsedBuffers = 0;\n this.numFreeBuffers = 0;\n this.numBytesUsed = 0;\n this.numBytesAllocated = 0;\n }\n}\n\nfunction getBufferKey(size: number, usage: GPUBufferUsageFlags) {\n return `${size}_${usage}`;\n}\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nexport class TextureManager {\n private numUsedTextures = 0;\n private numFreeTextures = 0;\n private freeTextures: Map = new Map();\n private usedTextures: Map = new Map();\n\n public numBytesUsed = 0;\n public numBytesAllocated = 0;\n\n constructor(private device: GPUDevice) {}\n\n acquireTexture(\n width: number, height: number, format: GPUTextureFormat,\n usage: GPUTextureUsageFlags) {\n const bytesPerElement = getBytesPerElement(format);\n const byteSize = width * height * bytesPerElement;\n const key = getTextureKey(width, height, format, usage);\n if (!this.freeTextures.has(key)) {\n this.freeTextures.set(key, []);\n }\n\n if (!this.usedTextures.has(key)) {\n this.usedTextures.set(key, []);\n }\n\n this.numBytesUsed += byteSize;\n this.numUsedTextures++;\n\n if (this.freeTextures.get(key).length > 0) {\n this.numFreeTextures--;\n\n const newTexture = this.freeTextures.get(key).shift();\n this.usedTextures.get(key).push(newTexture);\n return newTexture;\n }\n\n this.numBytesAllocated += byteSize;\n\n const newTexture = this.device.createTexture({\n size: [width, height],\n format,\n usage,\n });\n this.usedTextures.get(key).push(newTexture);\n\n return newTexture;\n }\n\n releaseTexture(\n texture: GPUTexture, width: number, height: number,\n format: GPUTextureFormat, usage: GPUTextureUsageFlags) {\n if (this.freeTextures.size === 0) {\n return;\n }\n\n const key = getTextureKey(width, height, format, usage);\n if (!this.freeTextures.has(key)) {\n this.freeTextures.set(key, []);\n }\n\n this.freeTextures.get(key).push(texture);\n this.numFreeTextures++;\n this.numUsedTextures--;\n\n const textureList = this.usedTextures.get(key);\n const textureIndex = textureList.indexOf(texture);\n if (textureIndex < 0) {\n throw new Error(\n 'Cannot release a texture that was never provided by this ' +\n 'texture manager');\n }\n textureList.splice(textureIndex, 1);\n const bytesPerElement = getBytesPerElement(format);\n const byteSize = width * height * bytesPerElement;\n this.numBytesUsed -= byteSize;\n }\n\n getNumUsedTextures(): number {\n return this.numUsedTextures;\n }\n\n getNumFreeTextures(): number {\n return this.numFreeTextures;\n }\n\n dispose() {\n this.freeTextures.forEach((textures, key) => {\n textures.forEach(texture => {\n texture.destroy();\n });\n });\n\n this.usedTextures.forEach((textures, key) => {\n textures.forEach(texture => {\n texture.destroy();\n });\n });\n\n this.freeTextures = new Map();\n this.usedTextures = new Map();\n this.numUsedTextures = 0;\n this.numFreeTextures = 0;\n this.numBytesUsed = 0;\n this.numBytesAllocated = 0;\n }\n}\n\nfunction getTextureKey(\n width: number, height: number, format: GPUTextureFormat,\n usage: GPUTextureUsageFlags) {\n return `${width}_${height}_${format}_${usage}`;\n}\n\nfunction getBytesPerElement(format: GPUTextureFormat) {\n if (format === 'rgba8unorm') {\n return 16;\n } else {\n throw new Error(`${format} is not supported!`);\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// Generates WGSL that computes strides.\nexport function symbolicallyComputeStrides(\n indicesArr: number[], variableName: string): string[] {\n if (Math.max(...indicesArr) > 3) {\n throw new Error('Cannot symbolically compute strides for rank > 4 tensor.');\n }\n\n const numCoords = indicesArr.length;\n const shape = indicesArr.map(d => `${variableName}[${d}]`);\n const strides = new Array(numCoords - 1);\n strides[numCoords - 2] = shape[numCoords - 1];\n for (let i = numCoords - 3; i >= 0; --i) {\n strides[i] = `(${strides[i + 1]} * ${shape[i + 1]})`;\n }\n\n return strides;\n}\n\nexport const atomicAddSnippet =\n (ptr: string, v: string, type: 'int32'|'float32') => {\n if (type === 'int32') {\n return `atomicAdd(${ptr}, bitcast(${v}));`;\n } else {\n // atomicAdd only supports uint/int type. For float, we use\n // atomicCompareExchangeWeak to simulate.\n return `\n {\n var oldValue = 0;\n loop {\n let newValueF32 = bitcast(oldValue) + (${v});\n let newValue = bitcast(newValueF32);\n let res = atomicCompareExchangeWeak(${ptr}, oldValue, newValue);\n if res.exchanged {\n break;\n }\n oldValue = res.old_value;\n }\n }`;\n }\n };\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, DataType, Rank, ShapeMap, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {symbolicallyComputeStrides} from './shader_util';\n\nexport interface WebGPUProgram {\n // Whether to use atomic built-in functions.\n atomic?: boolean;\n // dispatch specifies geometry of thread groups - derived from dispatchLayout.\n dispatch: [number, number, number];\n // dispatchLayout enumerates how tensor dimensions are distributed among\n // dispatch x,y,z dimensions.\n dispatchLayout: {x: number[], y?: number[], z?: number[]};\n isFromPixels?: boolean;\n isVec4?: boolean;\n outputShape: number[];\n // The unique key to distinguish different shader source code.\n shaderKey: string;\n // Whether to use output size for bounds checking.\n size?: boolean;\n uniforms?: string;\n variableNames: string[];\n // Describe each variable's type and must have one-one mapping with\n // variableNames. If not set, all variables type will be either f32 or\n // vec4 based on isVec4 member.\n variableTypes?: string[];\n // workgroupSize.x * workgroupSize.y * workgroupSize.z = the number of threads\n // in a thread group. Individual dimensions determines thread layout within\n // the group.\n workgroupSize: [number, number, number];\n // Size of register cache in one dimension (assumes square cache).\n // Each thread writes to workPerThread * workPerThread locations in the output\n // buffer.\n workPerThread?: number;\n getUserCode: () => string;\n}\n\nexport const compileProgram =\n (device: GPUDevice, program: WebGPUProgram, inputsData: InputInfo[],\n output: TensorInfo): GPUComputePipeline => {\n const outputData = {dtype: output.dtype, shape: output.shape};\n const source = makeShader(inputsData, outputData, program);\n const module = device.createShaderModule(\n {code: source, label: program.constructor.name});\n const pipeline = device.createComputePipeline({\n compute: {module, entryPoint: '_start'},\n label: program.constructor.name,\n layout: 'auto'\n });\n\n return pipeline;\n };\n\nexport function getCoordsDataType(rank: number): string {\n if (rank <= 1) {\n return 'i32';\n } else if (rank === 2) {\n return `vec2`;\n } else if (rank === 3) {\n return `vec3`;\n } else if (rank === 4) {\n return `vec4`;\n } else if (rank === 5) {\n return `vec5`;\n } else if (rank === 6) {\n return `vec6`;\n } else {\n throw Error(`GPU for rank ${rank} is not yet supported`);\n }\n}\n\nexport function getCoordsXYZ(index: number): string {\n if (index === 0) {\n return 'x';\n } else if (index === 1) {\n return 'y';\n } else if (index === 2) {\n return 'z';\n } else if (index === 3) {\n return 'w';\n } else if (index === 4) {\n return 'u';\n } else if (index === 5) {\n return 'v';\n } else {\n throw Error(`Index ${index} is not yet supported`);\n }\n}\n\nexport function getMainHeaderString(): string;\nexport function getMainHeaderString(index: string): string;\nexport function getMainHeaderString(...params: string[]): string {\n let snippet: string;\n switch (params.length) {\n case 0:\n snippet = `\n fn main()\n `;\n break;\n case 1:\n snippet = `\n fn main(${params[0]} : i32)\n `;\n break;\n default:\n throw Error('Unreachable');\n }\n return snippet;\n}\n\nexport function getStartHeaderString(\n useGlobalIndex: boolean, program: WebGPUProgram): string {\n let snippet: string;\n snippet = `\n ${getWorkgroupSizeString(program)}\n fn _start(@builtin(local_invocation_id) LocalId : vec3,\n @builtin(global_invocation_id) GlobalId : vec3,\n @builtin(local_invocation_index) LocalIndex: u32,\n @builtin(workgroup_id) WorkgroupId : vec3,\n @builtin(num_workgroups) NumWorkgroups : vec3) {\n localId = LocalId;\n localIndex = LocalIndex;\n globalId = GlobalId;\n numWorkgroups = NumWorkgroups;\n workgroupId = WorkgroupId;\n ${useGlobalIndex ? `main(getGlobalIndex());` : `main();`};\n }\n `;\n return snippet;\n}\n\nexport function getWorkgroupSizeString(program: WebGPUProgram): string {\n return `\n @compute @workgroup_size(${program.workgroupSize[0]}, ${\n program.workgroupSize[1]}, ${program.workgroupSize[2]})\n`;\n}\n\nfunction makeShader(\n inputInfo: InputInfo[], outputData: {dtype: DataType, shape: number[]},\n program: WebGPUProgram): string {\n const prefixSnippets: string[] = [];\n const flatWorkgroupSize = program.workgroupSize[0] *\n program.workgroupSize[1] * program.workgroupSize[2];\n prefixSnippets.push(`\n\n var localId: vec3;\n var localIndex: u32;\n var globalId: vec3;\n var numWorkgroups: vec3;\n var workgroupId: vec3;\n\n // Only used when the y/z dimension of workgroup size is 1.\n fn getGlobalIndex() -> i32 {\n ${\n isFlatDispatch(program) ?\n ` return i32(globalId.x);` :\n ` return i32((workgroupId.z * numWorkgroups.x * numWorkgroups.y +\n workgroupId.y * numWorkgroups.x + workgroupId.x) * ${\n flatWorkgroupSize}u +\n localIndex);\n `}\n }\n `);\n\n if (program.isFromPixels) {\n prefixSnippets.push(`\n struct Uniform {\n size : i32,\n numChannels : i32,\n outShapeStrides : vec2,\n };\n\n @group(0) @binding(0) var result: array<${\n mapToWgslTypes(outputData.dtype, program.isVec4)}>;\n @group(0) @binding(2) var uniforms: Uniform;\n `);\n const useGlobalIndex = isFlatDispatchLayout(program);\n return [\n commonSnippet,\n prefixSnippets.join('\\n'),\n getCoordsFromIndexSnippet(outputData.shape),\n program.getUserCode(),\n getStartHeaderString(useGlobalIndex, program),\n ].join('\\n');\n }\n\n let uniformDeclaration = 'struct Uniforms { NAN : f32, INFINITY : f32, ';\n program.variableNames.forEach((x, i) => {\n const perDataType = getCoordsDataType(inputInfo[i].shape.length);\n uniformDeclaration +=\n `${x.charAt(0).toLowerCase() + x.slice(1)}Shape : ${perDataType}, `;\n });\n const outputDataType = getCoordsDataType(outputData.shape.length);\n uniformDeclaration += `outShape : ${outputDataType}, `;\n const stridesLength = outputData.shape.length - 1;\n const stridesDataType = getCoordsDataType(stridesLength);\n uniformDeclaration += `\n outShapeStrides: ${stridesDataType}, `;\n\n if (program.size) {\n uniformDeclaration += 'size : i32, ';\n }\n\n if (program.uniforms) {\n uniformDeclaration += program.uniforms;\n }\n uniformDeclaration += '};';\n uniformDeclaration = insertAlignment(uniformDeclaration);\n\n prefixSnippets.push(uniformDeclaration);\n\n // Output buffer.\n if (program.atomic) {\n prefixSnippets.push(`\n @group(0) @binding(0) var result: array>;\n `);\n } else {\n prefixSnippets.push(`\n @group(0) @binding(0) var result: array<${\n mapToWgslTypes(outputData.dtype, program.isVec4)}>;\n `);\n }\n program.variableNames.forEach((x, i) => {\n prefixSnippets.push(`\n @group(0) @binding(${1 + i}) var ${x}: array<${\n program.variableTypes ?\n program.variableTypes[i] :\n mapToWgslTypes(inputInfo[i].dtype, program.isVec4)}>;\n `);\n });\n\n if (uniformDeclaration !== '') {\n prefixSnippets.push(`\n @group(0) @binding(${\n 1 + program.variableNames.length}) var uniforms: Uniforms;\n `);\n }\n\n const coordsSnippet =\n getOutputCoordsSnippet(outputData.shape, program.dispatchLayout);\n\n const sources = [\n commonSnippet, prefixSnippets.join('\\n') + isInfSnippet,\n getCoordsFromIndexSnippet(outputData.shape), coordsSnippet,\n getOutputIndexFromCoordsSnippet(outputData.shape.length)\n ];\n if (!program.atomic) {\n sources.push(\n setOutputSnippet(outputData.shape, outputData.dtype, program.isVec4));\n }\n\n const inputSnippet =\n inputInfo\n .map(\n (x, i) => getInputSnippet(\n x, outputData.shape,\n program.variableTypes ?\n (program.variableTypes[i] === 'vec4') :\n program.isVec4,\n program.dispatchLayout.x.length === outputData.shape.length))\n .join('\\n');\n sources.push(inputSnippet);\n sources.push(program.getUserCode());\n const useGlobalIndex = isFlatDispatchLayout(program);\n sources.push(getStartHeaderString(useGlobalIndex, program));\n const source = sources.join('\\n');\n return source;\n}\n\nexport function makeShaderKey(\n program: WebGPUProgram, shapes: Array, inputsData: InputInfo[],\n output: TensorInfo): string {\n let key = program.shaderKey;\n if (program.isFromPixels) {\n return key;\n }\n\n const types = inputsData.map(d => d.dtype).concat(output.dtype);\n const broadcastDims =\n inputsData.map(d => backend_util.getBroadcastDims(d.shape, output.shape));\n const inputShapesEqualsOutShape =\n inputsData.map(d => util.arraysEqual(d.shape, output.shape)).join('_');\n const broadcastDimsKey = broadcastDims.map(d => d.join('_')).join(';');\n\n const flatDispatchString = isFlatDispatch(program) ? 'flatDispatch' : '';\n\n key += '_' + (program.workgroupSize ? program.workgroupSize.join(',') : '') +\n shapes.map(shape => shape.length).join(',') + types.join(',') +\n program.variableNames.join(',') + broadcastDimsKey +\n inputShapesEqualsOutShape + flatDispatchString;\n\n return key;\n}\n\nconst commonSnippet = `\n struct vec5 {x: i32, y: i32, z: i32, w: i32, u: i32};\n struct vec6 {x: i32, y: i32, z: i32, w: i32, u: i32, v: i32};\n\n // Checks whether coordinates lie within the bounds of the shape.\n fn coordsInBounds2D(coord : vec2, shape : vec2) -> bool {\n return all(coord >= vec2(0)) && all(coord < shape);\n }\n fn coordsInBounds3D(coord : vec3, shape : vec3) -> bool {\n return all(coord >= vec3(0)) && all(coord < shape);\n }\n fn coordsInBounds4D(coord : vec4, shape : vec4) -> bool {\n return all(coord >= vec4(0)) && all(coord < shape);\n }\n\n fn getIndexFromCoords1D(coord : i32, shape : i32) -> i32 {\n return coord;\n }\n fn getIndexFromCoords2D(coords : vec2, shape : vec2) -> i32 {\n return dot(coords, vec2(shape.y, 1));\n }\n fn getIndexFromCoords3D(coords : vec3, shape : vec3) -> i32 {\n return dot(coords, vec3(shape.y * shape.z, shape.z, 1));\n }\n fn getIndexFromCoords4D(coords : vec4, shape : vec4) -> i32 {\n return dot(coords, vec4(\n shape.y * shape.z * shape.w, shape.z * shape.w, shape.w, 1));\n }\n fn getIndexFromCoords5D(coords : vec5, shape : vec5) -> i32 {\n let shapeStrides: vec5 = vec5(shape.y * shape.z * shape.w * shape.u, shape.z * shape.w * shape.u, shape.w * shape.u, shape.u, 1);\n return coords.x*shapeStrides.x + coords.y*shapeStrides.y + coords.z*shapeStrides.z + coords.w*shapeStrides.w + coords.u*shapeStrides.u;\n }\n fn getIndexFromCoords6D(coords : vec6, shape : vec6) -> i32 {\n let shapeStrides: vec6 = vec6(shape.y * shape.z * shape.w * shape.u * shape.v, shape.z * shape.w * shape.u * shape.v, shape.w * shape.u * shape.v, shape.u * shape.v, shape.v, 1);\n return coords.x*shapeStrides.x + coords.y*shapeStrides.y + coords.z*shapeStrides.z + coords.w*shapeStrides.w + coords.u*shapeStrides.u + coords.v*shapeStrides.v;\n }\n\n fn idiv(a: i32, b: i32, sign: f32) -> i32 {\n var res: i32 = a / b;\n let modulo: i32 = a % b;\n if (sign < 0. && modulo != 0) {\n res = res - 1;\n }\n return res;\n }\n\n // NaN defination in IEEE 754-1985 is :\n // - sign = either 0 or 1.\n // - biased exponent = all 1 bits.\n // - fraction = anything except all 0 bits (since all 0 bits represents infinity).\n // https://en.wikipedia.org/wiki/IEEE_754-1985#Representation_of_non-numbers\n fn isnan(val: f32) -> bool {\n let floatToUint: u32 = bitcast(val);\n return (floatToUint & 0x7fffffffu) > 0x7f800000u;\n }\n fn isnanVec4(val : vec4) -> vec4 {\n let floatToUint: vec4 = bitcast>(val);\n return (floatToUint & vec4(0x7fffffffu)) > vec4(0x7f800000u);\n }\n`;\n\nconst isInfSnippet = `\n fn isinf(val: f32) -> bool {\n return abs(val) == uniforms.INFINITY;\n }\n`;\n\ntype InputInfo = {\n dtype: DataType; shape: number[]; name: string;\n};\nexport type WGSLDataType = 'f32'|'i32'|'vec4'|'vec4'|'vec4';\n\n/**\n * Derives logical coordinates from a flat index. Performs integer division\n * with each stride and decrements the index until the index equals the final\n * dimension coordinate.\n */\nfunction getCoordsFromIndexSnippet(shape: number[]): string {\n const rank = shape.length;\n\n if (rank <= 1) {\n return `fn getCoordsFromIndex(index : i32) -> i32 { return index; }`;\n }\n\n const strides = util.computeStrides(shape);\n const dtype = getCoordsDataType(rank);\n\n const coords: string[] = [];\n for (let i = 0; i < rank; i++) {\n coords.push(`d${i}`);\n }\n\n if (strides.length === 1) {\n return ` fn getCoordsFromIndex(index : i32) -> vec2 {\n let d0 = index / uniforms.outShapeStrides; let d1 = index - d0 * uniforms.outShapeStrides;\n return vec2(d0, d1);\n }`;\n }\n let snippet;\n snippet = 'var index2 = index;' +\n strides\n .map((_, i) => {\n const line1 =\n `let ${coords[i]} = index2 / uniforms.outShapeStrides.${\n getCoordsXYZ(i)}`;\n const line2 = i === strides.length - 1 ?\n `let ${coords[i + 1]} = index2 - ${\n coords[i]} * uniforms.outShapeStrides.${getCoordsXYZ(i)}` :\n `index2 = index2 - ${coords[i]} * uniforms.outShapeStrides.${\n getCoordsXYZ(i)}`;\n return `${line1}; ${line2};`;\n })\n .join('');\n\n return `\n fn getCoordsFromIndex(index : i32) -> ${dtype} {\n ${snippet}\n return ${dtype}(${coords.join(',')});\n }\n `;\n}\n\nfunction getInputAtCoordsSnippet(\n inputInfo: InputInfo, isVec4: boolean): string {\n const texName = inputInfo.name;\n const rank = inputInfo.shape.length;\n const type = getCoordsDataType(rank);\n const funcName = 'get' + texName.charAt(0).toUpperCase() + texName.slice(1);\n const dims = ['d0', 'd1', 'd2', 'd3', 'd4', 'd5'].slice(0, rank);\n const inputs = dims.map(d => `${d} : i32`).join(', ');\n\n if (rank < 1) {\n if (isVec4) {\n return `\n fn ${funcName}() -> vec4 {\n return vec4(${texName}[0]);\n }\n `;\n }\n\n return `\n fn ${funcName}() ->f32 {\n return f32(${texName}[0]);\n }\n `;\n }\n\n const shapeStr =\n `uniforms.${texName.charAt(0).toLowerCase() + texName.slice(1)}Shape`;\n let rankStr = `${rank}D`;\n if (rank === 0) {\n rankStr = '1D';\n }\n\n if (isVec4) {\n return `\n fn ${funcName}(${inputs}) -> vec4 {\n return vec4(${texName}[getIndexFromCoords${rankStr}(${type}(${\n dims.join(',')}),\n ${shapeStr}) / 4]);\n }\n `;\n }\n\n return `\n fn ${funcName}(${inputs}) -> f32 {\n return f32(${texName}[getIndexFromCoords${rankStr}(${type}(${\n dims.join(',')}),\n ${shapeStr})]);\n }\n `;\n}\n\nfunction getInputByOutputSnippet(\n inputInfo: InputInfo, outShape: number[], isVec4: boolean,\n isFlatDispatchLayout: boolean): string {\n const texName = inputInfo.name;\n const texFuncSnippet = texName.charAt(0).toUpperCase() + texName.slice(1);\n\n const funcName = 'get' + texFuncSnippet + 'ByOutput';\n\n const inRank = inputInfo.shape.length;\n const outRank = outShape.length;\n const type = getCoordsDataType(outRank);\n\n // If the inShape equals the outShape and the dispatch layout is flat, we can\n // directly use |gl_GlobalInvocationID.x| as the index and don't need coords\n // conversion between these two shapes.\n if (util.arraysEqual(inputInfo.shape, outShape) && isFlatDispatchLayout) {\n if (isVec4) {\n return `\n fn ${funcName}Index(globalIndex : i32) -> vec4 {\n return vec4(${texName}[globalIndex]);\n }\n\n fn ${funcName}Coords(coords : ${type}) -> vec4 {\n return vec4(${texName}[${\n outRank > 1 ? 'getOutputIndexFromCoords(coords)' : 'coords'} / 4]);\n }\n `;\n } else {\n return `\n fn ${funcName}Index(globalIndex : i32) -> f32 {\n return f32(${texName}[globalIndex]);\n }\n\n fn ${funcName}Coords(coords : ${type}) -> f32 {\n return f32(${texName}[${\n outRank > 1 ? 'getOutputIndexFromCoords(coords)' : 'coords'}]);\n }\n `;\n }\n }\n\n const broadcastDims =\n backend_util.getBroadcastDims(inputInfo.shape, outShape);\n const rankDiff = outRank - inRank;\n\n let coordsSnippet = '';\n\n if (inRank === 0) {\n if (isVec4) {\n return `\n fn ${funcName}Index(globalIndex : i32) -> vec4 {\n return get${texFuncSnippet}();\n }\n\n fn ${funcName}Coords(coords : ${type}) -> vec4 {\n return get${texFuncSnippet}();\n }\n `;\n }\n return `\n fn ${funcName}Index(globalIndex : i32) -> f32{\n return get${texFuncSnippet}();\n }\n\n fn ${funcName}Coords(coords : ${type}) -> f32{\n return get${texFuncSnippet}();\n }\n `;\n } else {\n if (outRank < 2 && broadcastDims.length >= 1) {\n coordsSnippet = 'coords = 0;';\n } else {\n coordsSnippet =\n broadcastDims.map(d => `coords.${getCoordsXYZ(d + rankDiff)} = 0;`)\n .join('\\n');\n }\n }\n\n let unpackedCoordsSnippet = '';\n if (outRank < 2 && inRank > 0) {\n unpackedCoordsSnippet = 'coords';\n } else {\n if (outRank > 1) {\n const coordsType = getCoordsDataType(inRank);\n const coordsValues =\n inputInfo.shape.map((s, i) => `coords.${getCoordsXYZ(i + rankDiff)}`)\n .join(', ');\n unpackedCoordsSnippet = `${coordsType}(${coordsValues})`;\n } else {\n unpackedCoordsSnippet = 'coords';\n }\n }\n\n const shapeStr =\n `uniforms.${texName.charAt(0).toLowerCase() + texName.slice(1)}Shape`;\n const rankStr = `${inRank}D`;\n if (isVec4) {\n return `\n fn ${funcName}Index(globalIndex : i32) -> vec4 {\n var coords = getCoordsFromIndex(globalIndex);\n ${coordsSnippet}\n return ${texName}[getIndexFromCoords${rankStr}(${\n unpackedCoordsSnippet}, ${shapeStr}) / 4];\n }\n\n fn ${funcName}Coords(coordsIn : ${type}) -> vec4 {\n var coords = coordsIn;\n ${coordsSnippet}\n return ${texName}[getIndexFromCoords${rankStr}(${\n unpackedCoordsSnippet}, ${shapeStr}) / 4];\n }\n `;\n }\n\n return `\n fn ${funcName}Index(globalIndex : i32) -> f32 {\n var coords = getCoordsFromIndex(globalIndex);\n ${coordsSnippet}\n return f32(${texName}[getIndexFromCoords${rankStr}(${\n unpackedCoordsSnippet}, ${shapeStr})]);\n }\n\n fn ${funcName}Coords(coordsIn : ${type}) -> f32 {\n var coords = coordsIn;\n ${coordsSnippet}\n return f32(${texName}[getIndexFromCoords${rankStr}(${\n unpackedCoordsSnippet}, ${shapeStr})]);\n }\n`;\n}\n\nfunction getInputSnippet(\n inputInfo: InputInfo, outShape: number[], isVec4: boolean,\n isFlatDispatchLayout: boolean): string {\n let res = getInputAtCoordsSnippet(inputInfo, isVec4);\n\n const inShape = inputInfo.shape;\n if (inShape.length <= outShape.length) {\n res += getInputByOutputSnippet(\n inputInfo, outShape, isVec4, isFlatDispatchLayout);\n }\n\n return res;\n}\n\n/**\n * Generates getOutputCoords() function that computes output coordinates from\n * dispatch geometry to reduce arithmetic.\n */\nfunction getOutputCoordsSnippet(\n outShape: number[],\n dispatchLayout: {x: number[], y?: number[], z?: number[]}): string {\n const {x, y = [], z = []} = dispatchLayout;\n\n const outRank = outShape.length;\n const rank = x.length + y.length + z.length;\n // getOutputCoords is only meaningful when the output rank is same with\n // dispatch layout rank.\n if (rank !== outRank) {\n return '';\n }\n\n if (x.length === outRank) {\n const dtype = getCoordsDataType(outRank);\n const snippet = `fn getOutputCoords() -> ${dtype}{\n let globalIndex = getGlobalIndex();\n return getCoordsFromIndex(globalIndex);\n }\n `;\n return snippet;\n }\n\n let gatherDimensionsStr = '';\n const dims = [x, y, z];\n\n for (let i = 0; i < dims.length; i++) {\n const arr = dims[i];\n\n if (arr.length === 0) {\n continue;\n }\n\n if (arr.length === 1) {\n gatherDimensionsStr += `let d${arr[0]} = i32(globalId[${i}]);`;\n } else {\n const strides = symbolicallyComputeStrides(arr, 'uniforms.outShape');\n gatherDimensionsStr += `var index${i} = i32(globalId[${i}]);`;\n for (let j = 0; j < strides.length; j++) {\n gatherDimensionsStr += `let d${arr[j]} = index${i} / ${strides[j]};`;\n\n if (j === strides.length - 1) {\n gatherDimensionsStr += `let d${arr[j + 1]} = ` +\n `index${i} - d${arr[j]} * ${strides[j]};`;\n } else {\n gatherDimensionsStr +=\n `index${i} = index${i} - d${arr[j]} * ${strides[j]};`;\n }\n }\n }\n }\n\n const dimensions = [];\n for (let i = 0; i < rank; i++) {\n dimensions.push(`d${i}`);\n }\n\n const dtype = getCoordsDataType(rank);\n let snippet = `fn getOutputCoords() -> ${dtype} {\n ${gatherDimensionsStr}\n`;\n if (dimensions.length === 0) {\n snippet += `return ${dtype}(0); }`;\n } else {\n snippet += `return ${dtype}(${dimensions.join(',')}); }`;\n }\n\n return snippet;\n}\n\nfunction getOutputIndexFromCoordsSnippet(outRank: number) {\n let snippet = '';\n switch (outRank) {\n case 0:\n case 1:\n snippet += `\n fn getOutputIndexFromCoords(coords : i32) -> i32 {\n return coords;\n }\n `;\n break;\n case 2:\n snippet += `\n fn getOutputIndexFromCoords(coords : vec2) -> i32 {\n return dot(coords, vec2(uniforms.outShapeStrides, 1));\n }\n `;\n break;\n case 3:\n snippet += `\n fn getOutputIndexFromCoords(coords : vec3) -> i32 {\n return dot(coords, vec3(uniforms.outShapeStrides.x, uniforms.outShapeStrides.y, 1));\n }\n `;\n break;\n case 4:\n snippet += `\n fn getOutputIndexFromCoords(coords : vec4) -> i32 {\n return dot(coords, vec4(\n uniforms.outShapeStrides.x, uniforms.outShapeStrides.y, uniforms.outShapeStrides.z, 1));\n }\n `;\n break;\n case 5:\n snippet += `\n fn getOutputIndexFromCoords(coords : vec5) -> i32 {\n return coords.x * uniforms.outShapeStrides.x +\n coords.y * uniforms.outShapeStrides.y +\n coords.z * uniforms.outShapeStrides.z +\n coords.w * uniforms.outShapeStrides.w +\n coords.u;\n }\n `;\n break;\n case 6:\n snippet += `\n fn getOutputIndexFromCoords(coords : vec6) -> i32 {\n return coords.x * uniforms.outShapeStrides.x +\n coords.y * uniforms.outShapeStrides.y +\n coords.z * uniforms.outShapeStrides.z +\n coords.w * uniforms.outShapeStrides.w +\n coords.u * uniforms.outShapeStrides.u +\n coords.v;\n }\n `;\n break;\n default:\n util.assert(false, () => `Unsupported ${outRank}D shape`);\n break;\n }\n return snippet;\n}\n\nfunction isFlatDispatch(program: WebGPUProgram): boolean {\n return program.dispatch[1] === 1 && program.dispatch[2] === 1;\n}\n\nexport function mapToWgslTypes(type: DataType, isVec4: boolean): WGSLDataType|\n DataType {\n if (type === 'float32') {\n return isVec4 ? 'vec4' : 'f32';\n } else if (type === 'int32') {\n return isVec4 ? 'vec4' : 'i32';\n } else if (type === 'bool') {\n // Type 'bool' cannot be used in storage class,\n // https://www.w3.org/TR/WGSL/#host-shareable-types.\n return isVec4 ? 'vec4' : 'i32';\n }\n\n return type;\n}\n\nfunction setOutputSnippet(\n outShape: number[], outBufferType: DataType, isVec4: boolean): string {\n const outRank = outShape.length;\n const wgslType = mapToWgslTypes(outBufferType, isVec4);\n let snippet;\n if (isVec4) {\n snippet = `fn setOutputAtIndex(flatIndex : i32, value : vec4) {\n result[flatIndex] = ${wgslType}(value);\n }\n fn setOutputAtIndexI32(flatIndex : i32, value : vec4) {\n result[flatIndex] = ${wgslType}(value);\n }`;\n } else {\n snippet = `fn setOutputAtIndex(flatIndex : i32, value : f32) {\n result[flatIndex] = ${wgslType}(value);\n }\n fn setOutputAtIndexI32(flatIndex : i32, value : i32) {\n result[flatIndex] = ${wgslType}(value);\n }`;\n }\n if (outRank >= 2) {\n const dims = ['d0', 'd1', 'd2', 'd3', 'd4', 'd5'].slice(0, outRank);\n const type = getCoordsDataType(outRank);\n\n if (isVec4) {\n snippet += `\n fn setOutputAtCoords(${\n dims.map(d => `${d} : i32`).join(', ')}, value : vec4) {\n let flatIndex = getOutputIndexFromCoords(${type}(${dims.join(', ')}));\n setOutputAtIndex(flatIndex / 4, value);\n }\n fn setOutputAtCoordsI32(${\n dims.map(d => `${d} : i32`).join(', ')}, value : vec4) {\n let flatIndex = getOutputIndexFromCoords(${type}(${dims.join(', ')}));\n setOutputAtIndexI32(flatIndex / 4, value);\n }\n `;\n } else {\n snippet += `\n fn setOutputAtCoords(${\n dims.map(d => `${d} : i32`).join(', ')}, value : f32) {\n let flatIndex = getOutputIndexFromCoords(${type}(${dims.join(', ')}));\n setOutputAtIndex(flatIndex, value);\n }\n fn setOutputAtCoordsI32(${\n dims.map(d => `${d} : i32`).join(', ')}, value : i32) {\n let flatIndex = getOutputIndexFromCoords(${type}(${dims.join(', ')}));\n setOutputAtIndexI32(flatIndex, value);\n }\n `;\n }\n }\n\n return snippet;\n}\n\nfunction insertAlignment(uniformShader: string) {\n // insert alignment when current pattern is vec5 or vec6\n const curInsertRe = /(\\w+)\\s*:\\s*vec(5|6)/g;\n uniformShader = uniformShader.replace(curInsertRe, (match) => {\n return '@align(16) ' + match;\n });\n\n // insert alignment when previous pattern is vec5 or vec6\n const preInsertRe = /vec(5|6)\\s*,\\s*(\\w+)/g;\n uniformShader = uniformShader.replace(preInsertRe, (_, p1, p2) => {\n return `vec${p1}, @align(16) ${p2}`;\n });\n return uniformShader;\n}\nfunction isFlatDispatchLayout(program: WebGPUProgram): boolean {\n if (program.dispatchLayout.hasOwnProperty('y') &&\n program.dispatchLayout.y.length !== 0) {\n return false;\n }\n if (program.dispatchLayout.hasOwnProperty('z') &&\n program.dispatchLayout.z.length !== 0) {\n return false;\n }\n return true;\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {DataType, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nconst arrayProduct = (arr: number[]) => {\n let product = 1;\n for (let i = 0; i < arr.length; i++) {\n product *= arr[i];\n }\n return product;\n};\n\nexport function tilesFitEvenlyIntoShape(\n tileSize: number[], shape: number[]): boolean {\n if (tileSize.length !== shape.length) {\n throw new Error(\n `Cannot compute whether rank ${tileSize.length}` +\n ` tiles fit evenly into rank ${shape.length} shape` +\n ` - ranks must match.`);\n }\n return shape.every(\n (dim: number, dimIdx: number) => dim % tileSize[dimIdx] === 0);\n}\n\n// Computes dispatch geometry based on layout of output dimensions and\n// workgroupSize.\nexport function computeDispatch(\n layout: {x: number[], y?: number[], z?: number[]}, outputShape: number[],\n workgroupSize: [number, number, number] = [1, 1, 1],\n elementsPerThread: [number, number, number] =\n [1, 1, 1]): [number, number, number] {\n const [dispatchX, dispatchY, dispatchZ] = [\n Math.ceil(\n arrayProduct(layout.x.map(d => outputShape[d])) /\n (workgroupSize[0] * elementsPerThread[0])),\n layout.y ? Math.ceil(\n arrayProduct(layout.y.map(d => outputShape[d])) /\n (workgroupSize[1] * elementsPerThread[1])) :\n 1,\n layout.z ? Math.ceil(\n arrayProduct(layout.z.map(d => outputShape[d])) /\n (workgroupSize[2] * elementsPerThread[2])) :\n 1\n ];\n return [dispatchX, dispatchY, dispatchZ];\n}\n\nexport type WorkgroupInfo = {\n workgroupSize: [number, number, number],\n elementsPerThread: [number, number, number],\n};\n\nexport function computeWorkgroupInfoForMatMul(\n dimAOuter: number, dimInner: number, dimBOuter: number,\n transposeA = false): WorkgroupInfo {\n // These are experimental values. Usually, we need to adjust the work group\n // size based on the input shapes to improve the EU occupancy.\n // TODO: WebGPU limits the maximum allowed shared memory size as 16K. To make\n // sure it doesn't exceed this limitations. Temporarily reduce the work group\n // size to [8, 8, 1] and the work per thread size is [4, 4, 1]. But we should\n // revisit it and find the balance between work group size and work per thread\n // size.\n const workgroupSize: [number, number, number] = [8, 8, 1];\n const elementsPerThread: [number, number, number] = [4, 4, 1];\n\n if (!transposeA) {\n if (dimAOuter <= 8) {\n elementsPerThread[1] = 1;\n }\n\n if (dimInner <= 16 && dimBOuter <= 16) {\n workgroupSize[0] = 4;\n }\n }\n\n return {workgroupSize, elementsPerThread};\n}\n\nexport function computeWorkgroupSizeForConv2d(\n layout: {x: number[], y?: number[], z?: number[]}, outputShape: number[],\n isVec4 = false): [number, number, number] {\n if (isVec4) {\n return [8, 8, 1];\n }\n\n const dim0 = arrayProduct(layout.x.map(d => outputShape[d]));\n const dim1 = arrayProduct(layout.y.map(d => outputShape[d]));\n // TODO(jiajia.qin@intel.com): More fine tune based on outputShape.\n // These are experimental values. Usually, we need to adjust the work group\n // size based on the output shape. For example, when one dimension is smaller\n // than 4, it will be wasteful if we assign a larger size for this dimension,\n // which results lots of threads doing useless work and reduces parallelism\n // of hardware threads. But it is always a balance between work group size\n // and shared memory. If one dimension is too small, such as 1, shared memory\n // will won't be fully utilized.\n if (dim0 <= 4) {\n return [4, 16, 1];\n }\n if (dim1 <= 4) {\n return [16, 4, 1];\n }\n\n return [16, 16, 1];\n}\n\nexport function computeWorkPerThreadForConv2d(\n layout: {x: number[], y?: number[], z?: number[]}, outputShape: number[],\n isVec4 = false): [number, number, number] {\n if (isVec4) {\n return [4, 4, 1];\n }\n\n const dim0 = arrayProduct(layout.x.map(d => outputShape[d]));\n const dim1 = arrayProduct(layout.y.map(d => outputShape[d]));\n // TODO(jiajia.qin@intel.com): More fine tune based on outputShape.\n // The following conditions correspond to the values set in\n // computeWorkgroupSizeForConv2d.\n if (dim0 <= 4) {\n return [1, 2, 1];\n }\n if (dim1 <= 4) {\n return [2, 1, 1];\n }\n\n return [2, 2, 1];\n}\n\nexport function flatDispatchLayout(shape: number[]) {\n return {x: shape.map((d, i) => i)};\n}\n\nexport function GPUBytesPerElement(dtype: DataType): number {\n if (dtype === 'float32' || dtype === 'int32' || dtype === 'bool' ||\n dtype === 'string') {\n return 4;\n } else if (dtype === 'complex64') {\n return 8;\n } else {\n throw new Error(`Unknown dtype ${dtype}`);\n }\n}\n\nexport function isWebGPUSupported(): boolean {\n return ((typeof window !== 'undefined') ||\n //@ts-ignore\n (typeof WorkerGlobalScope !== 'undefined')) &&\n !!navigator.gpu;\n}\n\nexport function assertNotComplex(\n tensor: TensorInfo|TensorInfo[], opName: string): void {\n if (!Array.isArray(tensor)) {\n tensor = [tensor];\n }\n tensor.forEach(t => {\n if (t != null) {\n util.assert(\n t.dtype !== 'complex64',\n () => `${opName} does not support complex64 tensors ` +\n 'in the WebGPU backend.');\n }\n });\n}\n\nexport enum MatMulProgramType {\n MatMulReduceProgram,\n MatMulSplitKProgram,\n MatMulSmallOutputSizeProgram,\n MatMulPackedProgram,\n MatMulMax\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport './flags_webgpu';\n\nimport {backend_util, BackendValues, buffer, DataStorage, DataType, engine, env, GPUData, KernelBackend, Rank, RecursiveArray, ShapeMap, Tensor, TensorBuffer, TensorInfo, TimingInfo, TypedArray, util, WebGPUData} from '@tensorflow/tfjs-core';\n\nimport {AdapterInfo} from './adapter_info';\nimport {BufferManager} from './buffer_manager';\nimport {TextureManager} from './texture_manager';\nimport * as webgpu_program from './webgpu_program';\nimport * as webgpu_util from './webgpu_util';\n\nexport interface WebGPUMemoryInfo extends backend_util.MemoryInfo {\n numBytesInGPU: number;\n numBytesAllocatedInGPU: number;\n unreliable: boolean;\n}\n\nexport type BufferInfo = {\n size: number,\n usage: GPUBufferUsageFlags,\n buffer: GPUBuffer\n};\n\nexport type TextureInfo = {\n width: number,\n height: number,\n format: GPUTextureFormat,\n usage: GPUTextureUsageFlags,\n texture: GPUTexture|GPUExternalTexture\n};\n\ntype TensorData = {\n values: BackendValues,\n dtype: DataType,\n shape: number[],\n refCount: number,\n resourceInfo?: BufferInfo|TextureInfo,\n // external is true means we use the resource provided by users directly\n // (without a copy), so users should be responsible for its release.\n external?: boolean,\n // For complex numbers, the real and imaginary parts are stored as their own\n // individual tensors, with a parent joining the two with the\n // complexTensorInfos field.\n complexTensorInfos?: {real: TensorInfo, imag: TensorInfo}\n};\n\ninterface DataId {}\n\nexport type WebGPUKernelInfo = {\n name: string; query: Promise;\n};\n\nexport type TimerNode = RecursiveArray|WebGPUKernelInfo;\n\nexport interface WebGPUTimingInfo extends TimingInfo {\n uploadWaitMs: number;\n downloadWaitMs: number;\n}\n\ntype ProgramUniform = Array<{type: string; data: number[]}>;\n\n// Empirically determined constant used to determine size threshold for handing\n// off execution to the CPU.\nconst CPU_HANDOFF_SIZE_THRESHOLD =\n env().getNumber('WEBGPU_CPU_HANDOFF_SIZE_THRESHOLD');\n\n// Reshape dispatch, not to exceed device limits.\nconst reshapeDispatch =\n (device: GPUDevice,\n program: webgpu_program.WebGPUProgram): [number, number, number] => {\n const MAX_COMPUTE_PER_DIMENSION_DISPATCH_SIZE =\n device.limits.maxComputeWorkgroupsPerDimension;\n const layout = program['dispatchLayout'];\n const dispatch = program['dispatch'];\n if (dispatch.every((d) => d <= MAX_COMPUTE_PER_DIMENSION_DISPATCH_SIZE)) {\n return dispatch;\n }\n\n util.assert(\n dispatch[0] > MAX_COMPUTE_PER_DIMENSION_DISPATCH_SIZE &&\n layout.y === undefined && layout.z === undefined,\n () => 'Dispatch size exceeds WebGPU limits in Y or Z dimension.');\n\n let dispatchAverage = Math.ceil(Math.sqrt(dispatch[0]));\n if (dispatchAverage > MAX_COMPUTE_PER_DIMENSION_DISPATCH_SIZE) {\n dispatchAverage = Math.ceil(Math.cbrt(dispatch[0]));\n util.assert(\n dispatchAverage <= MAX_COMPUTE_PER_DIMENSION_DISPATCH_SIZE,\n () => 'Total dispatch size exceeds WebGPU maximum.');\n return [dispatchAverage, dispatchAverage, dispatchAverage];\n } else {\n return [dispatchAverage, dispatchAverage, 1];\n }\n };\n\nexport class WebGPUBackend extends KernelBackend {\n bufferManager: BufferManager;\n adapterInfo: AdapterInfo;\n device: GPUDevice;\n queue: GPUQueue;\n tensorMap: DataStorage;\n textureManager: TextureManager;\n thresholdToIncreaseWorkgroups: number;\n\n private activeTimers: TimerNode[];\n private currentCommandEncoder: GPUCommandEncoder;\n private currentComputePass: GPUComputePassEncoder;\n private commandQueueOwnedIds = new WeakSet();\n private dispatchNumberInEncoder = 0;\n private disposed = false;\n private downloadWaitMs = 0;\n private dummyCanvas: HTMLCanvasElement;\n private dummyContext: GPUCanvasContext;\n private tensorDataPendingDisposal: DataId[] = [];\n private static nextDataId = 0;\n private pipelineCache: {[key: string]: GPUComputePipeline};\n private programTimersStack: TimerNode[];\n private querySet: GPUQuerySet;\n private stagingPendingDisposal: BufferInfo[] = [];\n private supportTimeQuery: boolean;\n private uniformPendingDisposal: BufferInfo[] = [];\n private uploadWaitMs = 0;\n\n private nextDataId(): number {\n return WebGPUBackend.nextDataId++;\n }\n\n constructor(device: GPUDevice, adapterInfo?: GPUAdapterInfo) {\n super();\n if (!webgpu_util.isWebGPUSupported()) {\n throw new Error('WebGPU is not supported on this device');\n }\n this.pipelineCache = {};\n this.device = device;\n this.queue = device.queue;\n this.currentCommandEncoder = null;\n this.currentComputePass = null;\n this.supportTimeQuery =\n device.features.has('timestamp-query-inside-passes');\n this.adapterInfo = new AdapterInfo(adapterInfo);\n this.thresholdToIncreaseWorkgroups =\n this.adapterInfo.intelGPUGeneration >= 12 ? 16 : 8;\n\n this.bufferManager = new BufferManager(this.device);\n this.textureManager = new TextureManager(this.device);\n this.tensorMap = new DataStorage(this, engine());\n if (this.supportTimeQuery) {\n this.querySet = this.device.createQuerySet({\n type: 'timestamp',\n count: 2,\n });\n }\n\n // Profiling tools like PIX needs this dummy canvas to\n // trigger capturing a frame.\n if (env().getBool('WEBGPU_USE_PROFILE_TOOL')) {\n this.dummyCanvas = document.createElement('canvas');\n this.dummyCanvas.width = 1;\n this.dummyCanvas.height = 1;\n\n this.dummyContext = this.dummyCanvas.getContext('webgpu');\n this.dummyContext.configure({\n device,\n format: 'bgra8unorm',\n });\n\n document.body.appendChild(this.dummyCanvas);\n }\n }\n\n override floatPrecision(): 32 {\n return 32;\n }\n\n defaultGpuBufferUsage(): number {\n return GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC |\n GPUBufferUsage.COPY_DST;\n }\n\n /**\n * Dispose the memory if the dataId has 0 refCount. Return true if the memory\n * is released or memory is not managed in this backend, false if memory is\n * not cleared.\n * @param dataId\n * @oaram force Optional, remove the data regardless of refCount\n */\n override disposeData(dataId: DataId, force = false): boolean {\n if (this.tensorDataPendingDisposal.indexOf(dataId) >= 0) {\n return false;\n }\n if (!this.tensorMap.has(dataId)) {\n return true;\n }\n\n const tensorData = this.tensorMap.get(dataId);\n this.decRef(dataId);\n if (!force && tensorData.refCount > 0) {\n return false;\n }\n\n // complex is never in commandQueueOwnedIds\n if (this.commandQueueOwnedIds.has(dataId)) {\n this.tensorDataPendingDisposal.push(dataId);\n return false;\n }\n\n const {complexTensorInfos} = this.tensorMap.get(dataId);\n if (complexTensorInfos != null) {\n this.disposeData(complexTensorInfos.real.dataId, force);\n this.disposeData(complexTensorInfos.imag.dataId, force);\n }\n\n this.releaseResource(dataId);\n this.tensorMap.delete(dataId);\n\n return true;\n }\n\n override memory(): WebGPUMemoryInfo {\n return {\n numBytesInGPU: this.bufferManager.numBytesUsed,\n numBytesAllocatedInGPU: this.bufferManager.numBytesAllocated,\n unreliable: false\n } as WebGPUMemoryInfo;\n }\n\n releaseResource(dataId: DataId) {\n const tensorData = this.tensorMap.get(dataId);\n if (!tensorData || !tensorData.resourceInfo) {\n return;\n }\n // If tensor's resource is from external, do not release.\n if (tensorData.external) {\n tensorData.resourceInfo = null;\n return;\n }\n if ('texture' in tensorData.resourceInfo) {\n const textureInfo = tensorData.resourceInfo;\n if (textureInfo.texture instanceof GPUTexture) {\n this.textureManager.releaseTexture(\n textureInfo.texture, textureInfo.width, textureInfo.height,\n textureInfo.format, textureInfo.usage);\n }\n textureInfo.texture = null;\n } else {\n const bufferInfo = tensorData.resourceInfo;\n this.bufferManager.releaseBuffer(\n bufferInfo.buffer, bufferInfo.size, bufferInfo.usage);\n bufferInfo.buffer = null;\n }\n tensorData.resourceInfo = null;\n }\n\n /** Return refCount of a `TensorData`. */\n override refCount(dataId: DataId): number {\n if (this.tensorMap.has(dataId)) {\n const tensorData = this.tensorMap.get(dataId);\n return tensorData.refCount;\n }\n return 0;\n }\n\n /** Increase refCount of a `TensorData`. */\n override incRef(dataId: DataId): void {\n const tensorData = this.tensorMap.get(dataId);\n tensorData.refCount++;\n }\n\n /** Decrease refCount of a `TensorData`. */\n decRef(dataId: DataId): void {\n if (this.tensorMap.has(dataId)) {\n const tensorData = this.tensorMap.get(dataId);\n tensorData.refCount--;\n }\n }\n\n override write(values: BackendValues, shape: number[], dtype: DataType):\n DataId {\n if (dtype === 'complex64' && values != null) {\n throw new Error(\n `Cannot write to a complex64 dtype. ` +\n `Please use tf.complex(real, imag).`);\n }\n const dataId = {id: this.nextDataId()};\n this.tensorMap.set(dataId, {dtype, shape, values, refCount: 1});\n return dataId;\n }\n\n override move(\n dataId: DataId, values: BackendValues, shape: number[], dtype: DataType,\n refCount: number): void {\n if (dtype === 'complex64') {\n throw new Error(\n `Cannot write to a complex64 dtype. ` +\n `Please use tf.complex(real, imag).`);\n }\n this.tensorMap.set(dataId, {dtype, shape, values, refCount});\n }\n\n submitQueue() {\n this.ensureComputePassEnded();\n this.queue.submit([this.currentCommandEncoder.finish()]);\n this.currentCommandEncoder = null;\n this.dispatchNumberInEncoder = 0;\n\n this.commandQueueOwnedIds = new WeakSet();\n\n this.tensorDataPendingDisposal.forEach(d => {\n this.releaseResource(d);\n this.tensorMap.delete(d);\n });\n this.uniformPendingDisposal.forEach(\n d => this.bufferManager.releaseBuffer(d.buffer, d.size, d.usage));\n this.stagingPendingDisposal.forEach(\n d => this.bufferManager.releaseUploadBuffer(d.buffer, d.size, d.usage));\n\n this.tensorDataPendingDisposal = [];\n this.uniformPendingDisposal = [];\n this.stagingPendingDisposal = [];\n }\n\n ensureCommandEncoderReady() {\n if (!this.currentCommandEncoder) {\n this.currentCommandEncoder = this.device.createCommandEncoder();\n }\n }\n\n ensureComputePassEnded() {\n if (this.currentComputePass) {\n this.currentComputePass.end();\n this.currentComputePass = null;\n }\n }\n\n getComputePass() {\n if (!this.currentComputePass) {\n this.currentComputePass = this.currentCommandEncoder.beginComputePass();\n }\n return this.currentComputePass;\n }\n\n public async getBufferData(buffer: GPUBuffer, size: number):\n Promise {\n const staging = this.bufferManager.acquireBuffer(\n size, GPUBufferUsage.COPY_DST | GPUBufferUsage.MAP_READ);\n this.ensureCommandEncoderReady();\n this.ensureComputePassEnded();\n this.currentCommandEncoder.copyBufferToBuffer(buffer, 0, staging, 0, size);\n this.submitQueue();\n\n await staging.mapAsync(GPUMapMode.READ);\n const values = staging.getMappedRange().slice(0);\n\n staging.unmap();\n if (staging != null) {\n this.bufferManager.releaseBuffer(\n staging, size, GPUBufferUsage.COPY_DST | GPUBufferUsage.MAP_READ);\n }\n\n // Need to get texture from swapChain to enable profiling tool\n // to capture a frame\n if (env().getBool('WEBGPU_USE_PROFILE_TOOL')) {\n util.assert(\n this.dummyContext !== undefined,\n () => `Fail to get context for profiling tool`);\n this.dummyContext.getCurrentTexture();\n }\n\n return values;\n }\n\n private convertAndCacheOnCPU(dataId: DataId, data: BackendValues):\n BackendValues {\n const tensorData = this.tensorMap.get(dataId);\n this.releaseResource(dataId);\n tensorData.values = data;\n return tensorData.values;\n }\n\n // TODO: Remove once this is fixed:\n // https://github.com/tensorflow/tfjs/issues/1595\n override readSync(dataId: object): BackendValues {\n const tensorData = this.tensorMap.get(dataId);\n const {values} = tensorData;\n\n if (values == null) {\n throw new Error(\n 'WebGPU readSync is only available for CPU-resident tensors.');\n }\n\n return values;\n }\n\n override async read(dataId: object): Promise {\n if (!this.tensorMap.has(dataId)) {\n throw new Error(`Tensor ${dataId} was not registered!`);\n }\n const tensorData = this.tensorMap.get(dataId);\n\n const {values} = tensorData;\n\n if (values != null) {\n return this.convertAndCacheOnCPU(dataId, values);\n }\n\n // Download the values from the GPU.\n let vals: BackendValues;\n if (tensorData.dtype === 'complex64') {\n const ps = await Promise.all([\n this.read(tensorData.complexTensorInfos.real.dataId),\n this.read(tensorData.complexTensorInfos.imag.dataId)\n ]);\n\n const realValues = ps[0];\n const imagValues = ps[1];\n vals = backend_util.mergeRealAndImagArrays(\n realValues as Float32Array, imagValues as Float32Array);\n } else {\n const bufferInfo = tensorData.resourceInfo as BufferInfo;\n const data = await this.getBufferData(bufferInfo.buffer, bufferInfo.size);\n vals = util.convertBackendValuesAndArrayBuffer(data, tensorData.dtype);\n }\n this.convertAndCacheOnCPU(dataId, vals);\n return vals;\n }\n\n // The source GPUBuffer and destination GPUBuffer have the same size and\n // usage.\n private copyBuffer(srcBuffer: GPUBuffer, size: number, usage: number) {\n const dstBuffer = this.bufferManager.acquireBuffer(size, usage);\n this.ensureCommandEncoderReady();\n this.ensureComputePassEnded();\n this.currentCommandEncoder.copyBufferToBuffer(\n srcBuffer, 0, dstBuffer, 0, size);\n this.submitQueue();\n return dstBuffer;\n }\n\n /**\n * Create a TF.js tensor out of an existing WebGPU buffer.\n */\n override createTensorFromGPUData(\n values: WebGPUData, shape: number[], dtype: DataType): Tensor {\n let buffer = values.buffer;\n if (dtype === 'complex64') {\n throw new Error(`Cannot write to a complex64 dtype. `);\n }\n const dataId = {id: this.nextDataId()};\n this.tensorMap.set(\n dataId,\n {dtype, shape, values: null, refCount: 1, external: values.zeroCopy});\n const tensorData = this.tensorMap.get(dataId);\n const size = webgpu_util.GPUBytesPerElement(tensorData.dtype) *\n util.sizeFromShape(tensorData.shape);\n if (values.buffer.size < size) {\n throw new Error(`GPUBuffer size(${\n values.buffer.size}) is smaller than tensor size(${size})!`);\n } else if (\n (values.buffer.usage &\n (GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC)) !==\n (GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC)) {\n throw new Error(\n 'GPUBuffer.usage should include GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC!');\n }\n\n // Do buffer copy by default.\n if (values.zeroCopy !== true) {\n buffer = this.copyBuffer(buffer, size, buffer.usage);\n }\n tensorData.resourceInfo = {size: buffer.size, usage: buffer.usage, buffer};\n return engine().makeTensorFromDataId(dataId, shape, dtype, this);\n }\n\n /**\n * Read tensor to a new GPUBuffer.\n * @param dataId The source tensor.\n */\n override readToGPU(dataId: DataId): GPUData {\n const srcTensorData = this.tensorMap.get(dataId);\n const {values, dtype, shape, resourceInfo} = srcTensorData;\n\n if (dtype === 'complex64') {\n throw new Error('Does not support reading buffer for complex64 dtype.');\n }\n\n if (resourceInfo == null) {\n if (values != null) {\n throw new Error('Data is not on GPU but on CPU.');\n } else {\n throw new Error('There is no data on GPU or CPU.');\n }\n }\n\n const size = (resourceInfo as BufferInfo).size;\n const buffer = this.bufferManager.acquireBuffer(size, resourceInfo.usage);\n this.ensureCommandEncoderReady();\n this.ensureComputePassEnded();\n this.currentCommandEncoder.copyBufferToBuffer(\n (resourceInfo as BufferInfo).buffer, 0, buffer, 0, size);\n this.submitQueue();\n\n const tensorInfo = this.makeTensorInfo(shape, dtype);\n // Make engine track this tensor, so that we can dispose it later.\n const tensorRef = engine().makeTensorFromTensorInfo(tensorInfo);\n\n const tensorData = this.tensorMap.get(tensorInfo.dataId);\n tensorData\n .resourceInfo = {size, usage: this.defaultGpuBufferUsage(), buffer};\n\n return {tensorRef, buffer, bufSize: size};\n }\n\n bufferSync(t: TensorInfo):\n TensorBuffer {\n const data = this.readSync(t.dataId);\n if (t.dtype === 'string') {\n try {\n // Decode the bytes into string.\n const strings = (data as Uint8Array[]).map(d => util.decodeString(d));\n return buffer(t.shape as ShapeMap[R], t.dtype, strings) as\n TensorBuffer;\n } catch {\n throw new Error('Failed to decode encoded string bytes into utf-8');\n }\n }\n return buffer(t.shape as ShapeMap[R], t.dtype, data as TypedArray) as\n TensorBuffer;\n }\n\n override async time(f: () => void): Promise {\n if (!this.supportTimeQuery) {\n console.warn(\n `This device doesn't support timestamp-query-inside-passes extension. ` +\n `Start Chrome browser with flag ` +\n `--disable-dawn-features=disallow_unsafe_apis then try again. ` +\n `Otherwise, zero will be shown for the kernel time when profiling ` +\n `mode is enabled. Using performance.now is not workable for webgpu ` +\n `since it doesn't support synchronous data read from GPU.`);\n }\n const oldActiveTimers = this.activeTimers;\n const newActiveTimers: TimerNode[] = [];\n\n let outerMostTime = false;\n if (this.programTimersStack == null) {\n this.programTimersStack = newActiveTimers;\n outerMostTime = true;\n } else {\n this.activeTimers.push(newActiveTimers);\n }\n this.activeTimers = newActiveTimers;\n\n f();\n\n const flattenedActiveTimerQueries =\n util.flatten(this.activeTimers.map((d: WebGPUKernelInfo) => d.query))\n .filter(d => d != null);\n const flattenedActiveTimerNames =\n util.flatten(this.activeTimers.map((d: WebGPUKernelInfo) => d.name))\n .filter(d => d != null);\n\n this.activeTimers = oldActiveTimers;\n\n if (outerMostTime) {\n this.programTimersStack = null;\n }\n const res: WebGPUTimingInfo = {\n uploadWaitMs: this.uploadWaitMs,\n downloadWaitMs: this.downloadWaitMs,\n kernelMs: null,\n wallMs: null\n };\n\n const kernelMs = await Promise.all(flattenedActiveTimerQueries);\n res['kernelMs'] = util.sum(kernelMs);\n res['getExtraProfileInfo'] = () =>\n kernelMs.map((d, i) => ({name: flattenedActiveTimerNames[i], ms: d}))\n .map(d => `${d.name}: ${d.ms}`)\n .join(', ');\n this.uploadWaitMs = 0;\n this.downloadWaitMs = 0;\n return res;\n }\n\n makeTensorInfo(\n shape: number[], dtype: DataType,\n values?: BackendValues|string[]): TensorInfo {\n if (dtype === 'string' && values != null && values.length > 0 &&\n util.isString(values[0])) {\n values = (values as unknown as string[]).map(d => util.encodeString(d));\n }\n const dataId = this.write(values as BackendValues, shape, dtype);\n return {dataId, shape, dtype};\n }\n\n private tensorToBinding(tensor?: TensorInfo): GPUBindingResource {\n if (!tensor) {\n return null;\n }\n\n const tensorData = this.tensorMap.get(tensor.dataId);\n if ('texture' in tensorData.resourceInfo) {\n const info = tensorData.resourceInfo;\n if (info.texture instanceof GPUExternalTexture) {\n return info.texture;\n } else {\n return info.texture.createView();\n }\n }\n const bufferInfo = tensorData.resourceInfo;\n return {offset: 0, size: bufferInfo.size, buffer: bufferInfo.buffer};\n }\n\n async getQueryTime(query: GPUQuerySet): Promise {\n if (this.supportTimeQuery) {\n return this.getTimeFromQuerySet(query);\n } else {\n return 0;\n }\n }\n\n uploadToGPU(dataId: DataId): void {\n const tensorData = this.tensorMap.get(dataId);\n // Already on the GPU.\n if (tensorData.resourceInfo) {\n return;\n }\n\n const size = webgpu_util.GPUBytesPerElement(tensorData.dtype) *\n util.sizeFromShape(tensorData.shape);\n const buffer =\n this.bufferManager.acquireBuffer(size, this.defaultGpuBufferUsage());\n\n tensorData\n .resourceInfo = {size, usage: this.defaultGpuBufferUsage(), buffer};\n if (tensorData.values) {\n const stagingBuffer = this.bufferManager.acquireUploadBuffer(\n size, GPUBufferUsage.MAP_WRITE | GPUBufferUsage.COPY_SRC);\n const arrayBuffer = stagingBuffer.getMappedRange();\n if (tensorData.dtype === 'int32' || tensorData.dtype === 'bool') {\n new Int32Array(arrayBuffer).set(tensorData.values as TypedArray);\n } else {\n new Float32Array(arrayBuffer).set(tensorData.values as Float32Array);\n }\n stagingBuffer.unmap();\n this.ensureCommandEncoderReady();\n this.ensureComputePassEnded();\n this.currentCommandEncoder.copyBufferToBuffer(\n stagingBuffer, 0, buffer, 0, size);\n\n const stagingInfo = {\n size,\n usage: GPUBufferUsage.MAP_WRITE | GPUBufferUsage.COPY_SRC,\n buffer: stagingBuffer\n };\n this.stagingPendingDisposal.push(stagingInfo);\n // TODO: WebGPU doesn't support read data synchronously from GPU to CPU.\n // So it will report error when switching backend from WebGPU to others.\n // There are two situations: 1) swithcing the backend after running a\n // model; 2) swithcing the backend within the model. Temporarilly keep\n // the values on CPU to solve the first issue. tensorData.values = null;\n }\n }\n\n private makeUniforms(programUniform: ProgramUniform): GPUBindingResource {\n let currentOffset = 0;\n let preLength = 0;\n const offsets: number[] = [];\n let maxAlignmentOfField = 1;\n programUniform.forEach((d) => {\n if (d.data.length === 0) {\n d.data = [1];\n }\n // https://www.w3.org/TR/WGSL/#alignof\n let baseAlignment: number;\n switch (d.data.length) {\n case 1:\n baseAlignment = 4;\n break;\n case 2:\n baseAlignment = 8;\n break;\n case 3:\n baseAlignment = 16;\n break;\n case 4:\n baseAlignment = 16;\n break;\n case 5:\n baseAlignment = 16;\n break;\n case 6:\n baseAlignment = 16;\n break;\n default:\n util.assert(false, () => `Unsupported ${d.data.length}D shape`);\n }\n\n if (preLength === 5 || preLength === 6) {\n baseAlignment = 16;\n }\n if (baseAlignment > maxAlignmentOfField) {\n maxAlignmentOfField = baseAlignment;\n }\n currentOffset = Math.ceil(currentOffset / baseAlignment) * baseAlignment;\n preLength = d.data.length;\n offsets.push(currentOffset);\n currentOffset += d.data.length * 4;\n });\n\n currentOffset =\n Math.ceil(currentOffset / maxAlignmentOfField) * maxAlignmentOfField;\n const arrayBuffer = new ArrayBuffer(currentOffset);\n programUniform.forEach((d, i) => {\n const offset = offsets[i];\n if (d.type === 'int32') {\n new Int32Array(arrayBuffer, offset, d.data.length).set(d.data);\n } else if (d.type === 'uint32') {\n new Uint32Array(arrayBuffer, offset, d.data.length).set(d.data);\n } else {\n new Float32Array(arrayBuffer, offset, d.data.length).set(d.data);\n }\n });\n\n const uniformBuffer = this.bufferManager.acquireBuffer(\n currentOffset, GPUBufferUsage.COPY_DST | GPUBufferUsage.UNIFORM);\n this.queue.writeBuffer(uniformBuffer, 0, arrayBuffer, 0, currentOffset);\n\n const uniformInfo = {\n size: currentOffset,\n usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.UNIFORM,\n buffer: uniformBuffer\n };\n this.uniformPendingDisposal.push(uniformInfo);\n\n return {offset: 0, size: currentOffset, buffer: uniformBuffer};\n }\n\n public runWebGPUProgram(\n program: webgpu_program.WebGPUProgram, inputs: TensorInfo[],\n outputDtype: DataType, programDefinedUniform?: ProgramUniform,\n output?: TensorInfo): TensorInfo {\n if (!output) {\n output = this.makeTensorInfo(program.outputShape, outputDtype);\n }\n if (util.sizeFromShape(output.shape) === 0) {\n // Short-circuit the computation since the result is empty (has 0 in its\n // shape).\n this.tensorMap.get(output.dataId).values =\n util.getTypedArrayFromDType(output.dtype as 'float32', 0);\n return output;\n }\n this.uploadToGPU(output.dataId);\n program.dispatch = reshapeDispatch(this.device, program);\n\n // There are six kinds of uniforms: NAN, INFINITY, shapes, shape strides,\n // program size, program defined uniforms.\n let programUniform: ProgramUniform = [];\n let bufferShapes: number[][] = [];\n if (!program.isFromPixels) {\n programUniform.push(\n {type: 'float32', data: [NaN]}, {type: 'float32', data: [Infinity]});\n bufferShapes = inputs.concat(output).map(d => d.shape);\n const uniformsType = 'int32';\n bufferShapes.map(d => {\n programUniform.push({type: uniformsType, data: d});\n });\n const strides = util.computeStrides(output.shape);\n programUniform.push({type: uniformsType, data: strides});\n if (program.size) {\n const size = util.sizeFromShape(program.outputShape);\n programUniform.push(\n {type: uniformsType, data: [program.isVec4 ? size / 4 : size]});\n }\n }\n\n const inputsData = inputs.map((input: TensorInfo, i: number) => {\n if (input.dtype === 'complex64') {\n throw new Error(\n `GPGPUProgram does not support complex64 input. For complex64 ` +\n `dtypes, please separate the program into real and imaginary ` +\n `parts.`);\n }\n this.uploadToGPU(input.dataId);\n\n return {\n // Returning dtype from tensorMap because it reflects dtype\n // of underlying buffer, rather than abstract dtype.\n dtype: this.tensorMap.get(input.dataId).dtype,\n shape: input.shape,\n name: program.variableNames[i]\n };\n });\n\n const key =\n webgpu_program.makeShaderKey(program, bufferShapes, inputsData, output);\n\n let pipeline;\n if (key in this.pipelineCache) {\n pipeline = this.pipelineCache[key];\n } else {\n pipeline = webgpu_program.compileProgram(\n this.device, program, inputsData, output);\n this.pipelineCache[key] = pipeline;\n }\n\n if (programDefinedUniform) {\n programUniform = [...programUniform, ...programDefinedUniform];\n }\n const bindings = [\n this.tensorToBinding(output), ...inputs.map(t => this.tensorToBinding(t)),\n this.makeUniforms(programUniform)\n ];\n\n const bindGroup = this.device.createBindGroup({\n layout: pipeline.getBindGroupLayout(0),\n entries: bindings.map((b, i) => ({binding: i, resource: b})),\n });\n\n this.ensureCommandEncoderReady();\n const pass = this.getComputePass();\n const shouldTimeProgram = this.activeTimers != null;\n if (shouldTimeProgram) {\n if (this.supportTimeQuery) {\n // tslint:disable-next-line:no-any\n (pass as any).writeTimestamp(this.querySet, 0);\n }\n }\n pass.setPipeline(pipeline);\n pass.setBindGroup(0, bindGroup);\n pass.dispatchWorkgroups(\n program.dispatch[0], program.dispatch[1], program.dispatch[2]);\n if (shouldTimeProgram) {\n if (this.supportTimeQuery) {\n // tslint:disable-next-line:no-any\n (pass as any).writeTimestamp(this.querySet, 1);\n }\n }\n this.dispatchNumberInEncoder++;\n\n inputs.forEach(input => {\n this.commandQueueOwnedIds.add(input.dataId);\n });\n this.commandQueueOwnedIds.add(output.dataId);\n\n if (env().get('WEBGPU_DEFERRED_SUBMIT_BATCH_SIZE') as\n number <= this.dispatchNumberInEncoder) {\n this.submitQueue();\n }\n\n if (shouldTimeProgram) {\n this.activeTimers.push({\n name: program.constructor.name,\n query: this.getQueryTime(this.querySet)\n });\n }\n return output;\n }\n\n async getTimeFromQuerySet(querySet: GPUQuerySet) {\n const queryBuffer = this.bufferManager.acquireBuffer(\n 16, GPUBufferUsage.COPY_SRC | GPUBufferUsage.QUERY_RESOLVE);\n const dst = this.bufferManager.acquireBuffer(\n 16, GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST);\n\n this.ensureCommandEncoderReady();\n this.ensureComputePassEnded();\n this.currentCommandEncoder.resolveQuerySet(querySet, 0, 2, queryBuffer, 0);\n this.currentCommandEncoder.copyBufferToBuffer(queryBuffer, 0, dst, 0, 16);\n this.submitQueue();\n await dst.mapAsync(GPUMapMode.READ);\n const arrayBuf = new BigUint64Array(dst.getMappedRange());\n const timeElapsedNanos = Number((arrayBuf[1] - arrayBuf[0]));\n dst.unmap();\n this.bufferManager.releaseBuffer(\n dst, 16, GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST);\n this.bufferManager.releaseBuffer(\n queryBuffer, 16,\n GPUBufferUsage.COPY_SRC | GPUBufferUsage.QUERY_RESOLVE);\n // Return milliseconds.\n return timeElapsedNanos / 1000000;\n }\n\n shouldExecuteOnCPU(\n inputs: TensorInfo[],\n sizeThreshold = CPU_HANDOFF_SIZE_THRESHOLD): boolean {\n return env().getBool('WEBGPU_CPU_FORWARD') &&\n inputs.every(\n input => this.tensorMap.get(input.dataId).resourceInfo == null &&\n util.sizeFromShape(input.shape) < sizeThreshold);\n }\n\n override numDataIds() {\n return this.tensorMap.numDataIds() - this.tensorDataPendingDisposal.length;\n }\n\n override dispose() {\n if (this.disposed) {\n return;\n }\n this.bufferManager.dispose();\n this.textureManager.dispose();\n this.disposed = true;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport * as webgpu_util from './webgpu_util';\nexport {WebGPUBackend} from './backend_webgpu';\nexport {WebGPUProgram} from './webgpu_program';\nexport {webgpu_util};\n","/**\n * @license\n * Copyright 2022 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport './flags_webgpu';\n\nimport {env, registerBackend} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from './backend_webgpu';\nimport {isWebGPUSupported} from './webgpu_util';\n\nif (isWebGPUSupported()) {\n registerBackend('webgpu', async () => {\n // Remove it once we figure out how to correctly read the tensor data\n // before the tensor is disposed in profiling mode.\n env().set('CHECK_COMPUTATION_FOR_ERRORS', false);\n\n const gpuDescriptor: GPURequestAdapterOptions = {\n powerPreference: env().get('WEBGPU_USE_LOW_POWER_GPU') ?\n 'low-power' :\n 'high-performance'\n };\n\n const adapter = await navigator.gpu.requestAdapter(gpuDescriptor);\n const deviceDescriptor: GPUDeviceDescriptor = {};\n\n // Note that timestamp-query-inside-passes is not formally in spec as\n // timestamp within a pass is not generally supported on all the platforms.\n // More details can be found at\n // https://github.com/gpuweb/gpuweb/blob/main/proposals/timestamp-query-inside-passes.md\n if (adapter.features.has('timestamp-query-inside-passes')) {\n deviceDescriptor.requiredFeatures =\n // tslint:disable-next-line:no-any\n ['timestamp-query-inside-passes' as any];\n }\n\n const adapterLimits = adapter.limits;\n deviceDescriptor.requiredLimits = {\n 'maxComputeWorkgroupStorageSize':\n adapterLimits.maxComputeWorkgroupStorageSize,\n 'maxComputeWorkgroupsPerDimension':\n adapterLimits.maxComputeWorkgroupsPerDimension,\n 'maxStorageBufferBindingSize': adapterLimits.maxStorageBufferBindingSize,\n };\n\n const device: GPUDevice = await adapter.requestDevice(deviceDescriptor);\n const adapterInfo = await adapter.requestAdapterInfo();\n return new WebGPUBackend(device, adapterInfo);\n }, 3 /*priority*/);\n}\n\n// Export webgpu utilities\nexport * from './webgpu';\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nexport enum BinaryOpType {\n ADD,\n ATAN2,\n COMPLEX_MULTIPLY_IMAG,\n COMPLEX_MULTIPLY_REAL,\n DIV,\n EQUAL,\n GREATER,\n GREATER_EQUAL,\n INT_DIV,\n LESS,\n LESS_EQUAL,\n LOGICAL_AND,\n LOGICAL_OR,\n MAX,\n MIN,\n MOD,\n MUL,\n NOT_EQUAL,\n POW,\n PRELU,\n SQUARED_DIFFERENCE,\n SUB\n}\n\nconst CHECK_NAN_SNIPPET = `\n if (isnan(a)) { return a; }\n if (isnan(b)) { return b; }\n `;\n\nconst CHECK_NAN_SNIPPET_VEC4 = `\n resultTemp = select(\n resultTemp, vec4(valueForNaN),\n vec4(isNaN) | isnanVec4(a) | isnanVec4(b));\n `;\n\nconst ADD = 'return a + b;';\n// (Ar + Ai)(Br + Bi) =\n// ArBr + ArBi + AiBr + AiBi = ArBr - AB + ArBi + AiBr\n// Yr = ArBr - AB\n// Yi = ArBi + AiBr\nconst COMPLEX_MULTIPLY_REAL = 'return areal * breal - aimag * bimag;';\nconst COMPLEX_MULTIPLY_IMAG = 'return areal * bimag + aimag * breal;';\nconst DIV = 'return a / b;';\nconst EQUAL = 'return f32(a == b);';\nconst EQUAL_VEC4 = 'return vec4(a == b);';\nconst GREATER = 'return f32(a > b);';\nconst GREATER_VEC4 = 'return vec4(a > b);';\nconst GREATER_EQUAL = 'return f32(a >= b);';\nconst GREATER_EQUAL_VEC4 = 'return vec4(a >= b);';\n\nconst INT_DIV = `\n let s = sign(a) * sign(b);\n let ia = i32(round(a));\n let ib = i32(round(b));\n return f32(idiv(ia, ib, s));\n`;\nconst INT_DIV_VEC4 = `\n let ia = vec4(round(a));\n let ib = vec4(round(b));\n let cond = ib != vec4(0);\n var resultTemp = vec4(0);\n let s = sign(a) * sign(b);\n\n // Windows (D3D) wants guaranteed non-zero int division at compile-time.\n if (cond[0]) {\n resultTemp[0] = idiv(ia[0], ib[0], s[0]);\n }\n if (cond[1]) {\n resultTemp[1] = idiv(ia[1], ib[1], s[1]);\n }\n if (cond[2]) {\n resultTemp[2] = idiv(ia[2], ib[2], s[2]);\n }\n if (cond[3]) {\n resultTemp[3] = idiv(ia[3], ib[3], s[3]);\n }\n return vec4(resultTemp);\n`;\n\nconst LESS = 'return f32(a < b);';\nconst LESS_VEC4 = 'return vec4(a < b);';\nconst LESS_EQUAL = 'return f32(a <= b);';\nconst LESS_EQUAL_VEC4 = 'return vec4(a <= b);';\nconst LOGICAL_AND = 'return f32(a >= 1.0 && b >= 1.0);';\nconst LOGICAL_AND_VEC4 = `return (vec4(a >= vec4(1.0)) *\n vec4(b >= vec4(1.0)));`;\nconst LOGICAL_OR = 'return f32(a >= 1.0 || b >= 1.0);';\nconst LOGICAL_OR_VEC4 = `return min(vec4(a >= vec4(1.0)) +\n vec4(b >= vec4(1.0)), vec4(1.0));`;\nconst MOD = `\n ${CHECK_NAN_SNIPPET}\n if (b == 0.) {\n return uniforms.NAN;\n }\n var resultTemp = a % b;\n if ((a < 0. && b < 0.) || (a >= 0. && b > 0.)) {\n return resultTemp;\n } else {\n return (resultTemp + b) % b;\n }\n`;\nconst MOD_VEC4 = `\n let isNaN = !vec4(b);\n let valueForNaN = uniforms.NAN;\n var resultTemp = vec4(a % b);\n ${CHECK_NAN_SNIPPET_VEC4}\n\n if (!((a[0] < 0. && b[0] < 0.) || (a[0] >= 0. && b[0] > 0.))) {\n resultTemp[0] = (resultTemp[0] + b[0]) % b[0];\n }\n if (!((a[1] < 0. && b[1] < 0.) || (a[1] >= 0. && b[1] > 0.))) {\n resultTemp[1] = (resultTemp[1] + b[1]) % b[1];\n }\n if (!((a[2] < 0. && b[2] < 0.) || (a[2] >= 0. && b[2] > 0.))) {\n resultTemp[2] = (resultTemp[2] + b[2]) % b[2];\n }\n if (!((a[3] < 0. && b[3] < 0.) || (a[3] >= 0. && b[3] > 0.))) {\n resultTemp[3] = (resultTemp[3] + b[3]) % b[3];\n }\n\n return resultTemp;\n`;\nconst MUL = 'return a * b;';\nconst NOT_EQUAL = `\n if (isnan(a) || isnan(b)) {\n return 1.0;\n }\n return f32(a != b);\n`;\nconst NOT_EQUAL_VEC4 = `\n var resultTemp = vec4(a != b);\n let valueForNaN = 1.0;\n ${CHECK_NAN_SNIPPET_VEC4}\n\n return resultTemp;\n`;\n\nconst POW = `\n if(a < 0.0 && floor(b) < b) {\n return uniforms.NAN;\n }\n if (b == 0.0) {\n return 1.0;\n }\n if (round(abs(b) % 2.0) != 1.0) {\n return pow(abs(a), b);\n }\n return sign(a) * pow(abs(a), b);\n`;\nconst POW_VEC4 = `\n let isModRound1Bool = vec4(round(abs(b) % vec4(2.0))) == vec4(1);\n let isModRound1 = vec4(isModRound1Bool);\n let multiplier = sign(a) * isModRound1 + (vec4(1.0) - isModRound1);\n var resultTemp = multiplier * pow(abs(a), b);\n\n // Ensure that a^0 = 1, including 0^0 = 1 as this correspond to TF and JS\n let isExpZero = b == vec4(0.0);\n if (isExpZero.r) {\n resultTemp.r = 1.0;\n }\n if (isExpZero.g) {\n resultTemp.g = 1.0;\n }\n if (isExpZero.b) {\n resultTemp.b = 1.0;\n }\n if (isExpZero.a) {\n resultTemp.a = 1.0;\n }\n let isNaN = (a < vec4(0.0)) & (floor(b) < b);\n let valueForNaN = uniforms.NAN;\n ${CHECK_NAN_SNIPPET_VEC4}\n return resultTemp;\n`;\n\nconst PRELU = `if (a < 0.0) { return b * a; } return a;`;\nconst PRELU_VEC4 = `\n let aLessThanZero = vec4(a < vec4(0.0));\n return (aLessThanZero * (b * a)) + ((vec4(1.0) - aLessThanZero) * a);\n`;\nconst SQUARED_DIFFERENCE = 'return (a - b) * (a - b);';\nconst SUB = 'return a - b;';\n\nfunction getBinaryWithNanString(\n op: string, useVec4: boolean, valueForNaN = 'uniforms.NAN') {\n const checkNanSnippet = useVec4 ? CHECK_NAN_SNIPPET_VEC4 : CHECK_NAN_SNIPPET;\n return useVec4 ? `\n let valueForNaN = ${valueForNaN};\n var resultTemp = vec4(${op}(a, b));\n ` + checkNanSnippet +\n `\n return resultTemp;\n ` :\n checkNanSnippet + `\n return ${op}(a, b);\n `;\n}\n\nexport function getBinaryOpString(\n type: BinaryOpType, useVec4?: boolean): string {\n switch (type) {\n case BinaryOpType.ADD:\n return ADD;\n case BinaryOpType.ATAN2:\n return getBinaryWithNanString('atan2', useVec4);\n case BinaryOpType.COMPLEX_MULTIPLY_IMAG:\n return COMPLEX_MULTIPLY_IMAG;\n case BinaryOpType.COMPLEX_MULTIPLY_REAL:\n return COMPLEX_MULTIPLY_REAL;\n case BinaryOpType.DIV:\n return DIV;\n case BinaryOpType.EQUAL:\n return useVec4 ? EQUAL_VEC4 : EQUAL;\n case BinaryOpType.GREATER:\n return useVec4 ? GREATER_VEC4 : GREATER;\n case BinaryOpType.GREATER_EQUAL:\n return useVec4 ? GREATER_EQUAL_VEC4 : GREATER_EQUAL;\n case BinaryOpType.INT_DIV:\n return useVec4 ? INT_DIV_VEC4 : INT_DIV;\n case BinaryOpType.LESS:\n return useVec4 ? LESS_VEC4 : LESS;\n case BinaryOpType.LESS_EQUAL:\n return useVec4 ? LESS_EQUAL_VEC4 : LESS_EQUAL;\n case BinaryOpType.LOGICAL_AND:\n return useVec4 ? LOGICAL_AND_VEC4 : LOGICAL_AND;\n case BinaryOpType.LOGICAL_OR:\n return useVec4 ? LOGICAL_OR_VEC4 : LOGICAL_OR;\n case BinaryOpType.MAX:\n return getBinaryWithNanString('max', useVec4);\n case BinaryOpType.MIN:\n return getBinaryWithNanString('min', useVec4);\n case BinaryOpType.MOD:\n return useVec4 ? MOD_VEC4 : MOD;\n case BinaryOpType.MUL:\n return MUL;\n case BinaryOpType.NOT_EQUAL:\n return useVec4 ? NOT_EQUAL_VEC4 : NOT_EQUAL;\n case BinaryOpType.POW:\n return useVec4 ? POW_VEC4 : POW;\n case BinaryOpType.PRELU:\n return useVec4 ? PRELU_VEC4 : PRELU;\n case BinaryOpType.SQUARED_DIFFERENCE:\n return SQUARED_DIFFERENCE;\n case BinaryOpType.SUB:\n return SUB;\n default:\n throw new Error(`BinaryType ${type} is not implemented!`);\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\n\nexport enum UnaryOpType {\n ABS,\n ACOS,\n ACOSH,\n ASIN,\n ASINH,\n ATAN,\n ATANH,\n CEIL,\n COS,\n COSH,\n ELU,\n ERF,\n EXP,\n EXPM1,\n FLOOR,\n IS_FINITE,\n IS_INF,\n IS_NAN,\n LINEAR,\n LOG,\n LOG1P,\n LOGICAL_NOT,\n NEG,\n RELU,\n RELU6,\n LEAKYRELU,\n RECIPROCAL,\n ROUND,\n RSQRT,\n SELU,\n SIGMOID,\n SIGN,\n SIN,\n SINH,\n SOFTPLUS,\n SQRT,\n SQUARE,\n STEP,\n TAN,\n TANH,\n TO_INT\n}\n\nconst ABS = `return abs(a);`;\nconst ACOS = `\n if (abs(a) > 1.) {\n return uniforms.NAN;\n }\n return acos(a);\n`;\nconst ACOSH = `\n if (a < 1.) {\n return uniforms.NAN;\n }\n return acosh(a);\n`;\nconst ASIN = `\n if (abs(a) > 1.) {\n return uniforms.NAN;\n }\n return asin(a);\n`;\nconst ASINH = `return asinh(a);`;\nconst ATAN = `\n if (isnan(a)) {\n return uniforms.NAN;\n }\n return atan(a);\n`;\nconst ATANH = `\n if (abs(a) > 1.) {\n return uniforms.NAN;\n }\n if (a == 1.) {\n return uniforms.INFINITY;\n }\n if (a == -1.) {\n return -uniforms.INFINITY;\n }\n return atanh(a);\n`;\nconst CEIL = `return ceil(a);`;\nconst COS = `return cos(a);`;\nconst COSH = `\n let e2x = exp(-a);\n return (e2x + 1.0 / e2x) / 2.0;\n`;\nconst EXPM1 = `return exp(a) - 1.0;`;\nconst ELU = `if (a >= 0.0) { return a; } return (exp(a) - 1.0);`;\nconst ELU_VEC4 = `\n var resFloat = exp(a) - vec4(1.0);\n if (a.r >= 0.0) {\n resFloat.r = a.r;\n }\n if (a.g >= 0.0) {\n resFloat.g = a.g;\n }\n if (a.b >= 0.0) {\n resFloat.b = a.b;\n }\n if (a.a >= 0.0) {\n resFloat.a = a.a;\n }\n return resFloat;\n`;\nconst ERF = `\n // Error function is calculated approximately with elementary function.\n // See \"Handbook of Mathematical Functions with Formulas,\n // Graphs, and Mathematical Tables\", Abramowitz and Stegun.\n let p = ${backend_util.ERF_P};\n let a1 = ${backend_util.ERF_A1};\n let a2 = ${backend_util.ERF_A2};\n let a3 = ${backend_util.ERF_A3};\n let a4 = ${backend_util.ERF_A4};\n let a5 = ${backend_util.ERF_A5};\n\n let sign = sign(a);\n let absA = abs(a);\n let t = 1.0 / (1.0 + p * absA);\n return sign * (1.0 - (((((a5 * t + a4) * t) + a3) * t + a2) * t + a1) * t * exp(-absA * absA));\n`;\nconst EXP = `return exp(a);`;\nconst FLOOR = `return floor(a);`;\nconst IS_FINITE = `return f32(!isnan(a) && !isinf(a));`;\nconst IS_INF = `return f32(isinf(a));`;\nconst IS_NAN = `return f32(isnan(a));`;\nconst LINEAR = `return a;`;\nconst LOG = `if (a < 0.0) { return uniforms.NAN; }\n return log(a);`;\nconst LOG1P = `\n if (isnan(a)) { return a; }\n return log(1.0 + a);\n`;\nconst LOGICAL_NOT = `return f32(!(a >= 1.0));`;\nconst NEG = `return -a;`;\nconst LEAKYRELU = `if (a < 0.0) { return uniforms.alpha * a; } return a;`;\nconst LEAKYRELU_VEC4 = `\n let aLessThanZero = vec4(a < vec4(0.0));\n return (aLessThanZero * (uniforms.alpha * a)) + ((vec4(1.0) - aLessThanZero) * a);\n`;\nconst RECIPROCAL = `return 1.0 / a;`;\nconst RELU = `return select(a, 0.0, a < 0.0);`;\nconst RELU6 = 'return clamp(a, 0.0, 6.0);';\nconst RELU6_VEC4 =\n 'return clamp(a, vec4(0.0, 0.0, 0.0, 0.0), vec4(6.0, 6.0, 6.0, 6.0));';\nconst RELU_VEC4 = `\n return select(a, vec4(0.0), a < vec4(0.0));\n`;\nconst ROUND = `return round(a);`;\nconst RSQRT = `return inverseSqrt(a);`;\n// Stable and Attracting Fixed Point (0, 1) for Normalized Weights.\n// See: https://arxiv.org/abs/1706.02515\nconst SELU = `\n if (a >= 0.0) {\n return ${backend_util.SELU_SCALE} * a;\n } else {\n return ${backend_util.SELU_SCALEALPHA} * (exp(a) - 1.0);\n }\n`;\nconst SIGMOID = `return 1.0 / (1.0 + exp(-1.0 * a));`;\nconst SIGN = `return sign(a);`;\nconst SIN = `return sin(a);`;\nconst SINH = `\n let e2x = exp(a);\n return (e2x - 1.0 / e2x) / 2.0;\n`;\nconst SOFTPLUS = `\n let epsilon = 1.1920928955078125e-7;\n let threshold = log(epsilon) + 2.0;\n\n let too_large = a > -threshold;\n let too_small = a < threshold;\n let exp_a = exp(a);\n\n if (too_large) {\n return a;\n } else if (too_small) {\n return exp_a;\n } else {\n return log(exp_a + 1.0);\n }\n`;\nconst SQRT = `return sqrt(a);`;\nconst SQUARE = `return a * a;`;\nconst STEP = `\n if (isnan(a)) {\n return a;\n }\n\n return select(uniforms.stepAlpha, 1.0, a > 0.0);\n`;\nconst TAN = `return tan(a);`;\nconst TANH = `\n let e2x = exp(-2.0 * abs(a));\n return sign(a) * (1.0 - e2x) / (1.0 + e2x);\n`;\nconst TO_INT = `return f32(i32((a)));`;\n\nexport function getUnaryOpString(type: UnaryOpType, useVec4?: boolean): string {\n switch (type) {\n case UnaryOpType.ABS:\n return ABS;\n case UnaryOpType.ACOS:\n return ACOS;\n case UnaryOpType.ACOSH:\n return ACOSH;\n case UnaryOpType.ASIN:\n return ASIN;\n case UnaryOpType.ASINH:\n return ASINH;\n case UnaryOpType.ATAN:\n return ATAN;\n case UnaryOpType.ATANH:\n return ATANH;\n case UnaryOpType.COS:\n return COS;\n case UnaryOpType.COSH:\n return COSH;\n case UnaryOpType.CEIL:\n return CEIL;\n case UnaryOpType.ELU:\n return useVec4 ? ELU_VEC4 : ELU;\n case UnaryOpType.ERF:\n return ERF;\n case UnaryOpType.EXP:\n return EXP;\n case UnaryOpType.EXPM1:\n return EXPM1;\n case UnaryOpType.FLOOR:\n return FLOOR;\n case UnaryOpType.IS_FINITE:\n return IS_FINITE;\n case UnaryOpType.IS_INF:\n return IS_INF;\n case UnaryOpType.IS_NAN:\n return IS_NAN;\n case UnaryOpType.LINEAR:\n return LINEAR;\n case UnaryOpType.LOG:\n return LOG;\n case UnaryOpType.LOG1P:\n return LOG1P;\n case UnaryOpType.LOGICAL_NOT:\n return LOGICAL_NOT;\n case UnaryOpType.NEG:\n return NEG;\n case UnaryOpType.LEAKYRELU:\n return useVec4 ? LEAKYRELU_VEC4 : LEAKYRELU;\n case UnaryOpType.RECIPROCAL:\n return RECIPROCAL;\n case UnaryOpType.RELU:\n return useVec4 ? RELU_VEC4 : RELU;\n case UnaryOpType.RELU6:\n return useVec4 ? RELU6_VEC4 : RELU6;\n case UnaryOpType.ROUND:\n return ROUND;\n case UnaryOpType.RSQRT:\n return RSQRT;\n case UnaryOpType.SELU:\n return SELU;\n case UnaryOpType.SIGMOID:\n return SIGMOID;\n case UnaryOpType.SIGN:\n return SIGN;\n case UnaryOpType.SIN:\n return SIN;\n case UnaryOpType.SINH:\n return SINH;\n case UnaryOpType.SOFTPLUS:\n return SOFTPLUS;\n case UnaryOpType.SQRT:\n return SQRT;\n case UnaryOpType.SQUARE:\n return SQUARE;\n case UnaryOpType.STEP:\n return STEP;\n case UnaryOpType.TAN:\n return TAN;\n case UnaryOpType.TANH:\n return TANH;\n case UnaryOpType.TO_INT:\n return TO_INT;\n\n default:\n throw new Error(`BinaryType ${type} is not implemented!`);\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\n\nimport {BinaryOpType, getBinaryOpString} from './binary_op_util';\nimport {getUnaryOpString, UnaryOpType} from './unary_op_util';\n\nexport const typeSnippet = (component: number) => {\n switch (component) {\n case 1:\n return 'f32';\n case 2:\n return 'vec2';\n case 3:\n return 'vec3';\n case 4:\n return 'vec4';\n default:\n throw new Error(`${component}-component is not supported.`);\n }\n};\n\nexport function activationFnSnippet(\n activation: backend_util.Activation, hasPreluActivationWeights = false,\n packed = false, coordsLength = 3): string {\n if (activation === null) {\n return '';\n }\n\n let activationOpSnippet = '';\n if (activation === 'linear') {\n activationOpSnippet = getUnaryOpString(UnaryOpType.LINEAR);\n } else if (activation === 'relu') {\n activationOpSnippet = getUnaryOpString(UnaryOpType.RELU, packed);\n } else if (activation === 'elu') {\n activationOpSnippet = getUnaryOpString(UnaryOpType.ELU, packed);\n } else if (activation === 'relu6') {\n activationOpSnippet = getUnaryOpString(UnaryOpType.RELU6, packed);\n } else if (activation === 'prelu') {\n activationOpSnippet = getBinaryOpString(BinaryOpType.PRELU, packed);\n } else if (activation === 'sigmoid') {\n activationOpSnippet = getUnaryOpString(UnaryOpType.SIGMOID, packed);\n } else if (activation === 'leakyrelu') {\n activationOpSnippet = getUnaryOpString(UnaryOpType.LEAKYRELU, packed);\n } else {\n throw new Error(`Activation ${\n activation} has not been implemented for the WebGPU backend.`);\n }\n const elementSize = packed ? 4 : 1;\n const dataType = typeSnippet(elementSize);\n let activationFnSnippet = '';\n if (hasPreluActivationWeights) {\n activationFnSnippet = `\n fn activation(a : ${dataType}, coords : vec${coordsLength}) -> ${\n dataType} {\n let b = getPreluActivationWeightsByOutputCoords(coords);\n ${activationOpSnippet}\n }`;\n } else {\n activationFnSnippet = `\n fn activation(a : ${dataType}, coords : vec${coordsLength}) -> ${\n dataType} {\n ${activationOpSnippet}\n }`;\n }\n return activationFnSnippet;\n}\n\nexport function biasActivationSnippet(\n hasBias: boolean, activation: backend_util.Activation): string {\n return `\n ${hasBias ? 'value = value + getBiasByOutputCoords(coords);' : ''}\n ${activation ? 'value = activation(value, coords);' : ''}\n `;\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, TensorInfo, util} from '@tensorflow/tfjs-core';\nimport {activationFnSnippet, biasActivationSnippet, typeSnippet} from './activation_util';\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, computeWorkgroupInfoForMatMul} from './webgpu_util';\n\nexport function matMulReadFnSource(\n transposeA: boolean, transposeB: boolean, fitAOuter = false,\n fitBOuter = false, fitInner = false, component = 1) {\n util.assert(\n transposeA && component === 1 || !transposeA,\n () => `transposeA ${transposeA} is not compatible with component size ${\n component}`);\n const sampleA = `\n ${\n transposeA ? `value = getA(batch, col, row);` :\n `value = getA(batch, row, col);`}\n\n `;\n const sampleB = transposeB ? `value = getB(batch, col, row);` :\n `value = getB(batch, row, col);`;\n\n return `\n fn mm_readA(batch: i32, row: i32, colIn: i32) -> ${typeSnippet(component)} {\n var value = ${typeSnippet(component)}(0.0);\n let col = colIn * ${component};\n ${\n fitAOuter && fitInner ?\n sampleA :\n `\n ${\n transposeA ?\n `if(row < uniforms.dimAOuter && col < uniforms.dimInner)` :\n `if(row < uniforms.aShape[1] && col < uniforms.aShape[2])`}\n {\n ${sampleA}\n }\n `}\n return value;\n }\n\n fn mm_readB(batch: i32, row: i32, colIn: i32) -> ${typeSnippet(component)} {\n let col = colIn * ${component};\n var value = ${typeSnippet(component)}(0.0);\n ${sampleB}\n return value;\n }\n `;\n}\n\nexport function matMulReadWriteFnSource(\n hasBias: boolean, activation: backend_util.Activation, transposeA: boolean,\n transposeB: boolean, fitAOuter = false, fitBOuter = false, fitInner = false,\n component = 1) {\n return `\n ${\n matMulReadFnSource(\n transposeA, transposeB, fitAOuter, fitBOuter, fitInner, component)}\n fn mm_write(batch: i32, row: i32, colIn: i32, valueIn: ${\n typeSnippet(component)}) {\n let col = colIn * ${component};\n ${\n fitAOuter && fitBOuter ?\n '' :\n 'if (row < uniforms.dimAOuter && col < uniforms.dimBOuter)'}\n {\n var value = valueIn;\n let coords = vec3(batch, row, col);\n ${biasActivationSnippet(hasBias, activation)}\n setOutputAtCoords(coords[0], coords[1], coords[2], value);\n }\n }\n `;\n}\n\nconst writeDataToSubAVec4Snippet =\n (transpose: boolean, innerElementSize: number) => {\n if (transpose) {\n return `\n mm_Asub[inputRow][inputCol] = mm_readA(batchA,\n kStart + inputRow,\n globalRowStart / ${innerElementSize} + inputCol);\n `;\n\n } else {\n return `\n mm_Asub[inputRow][inputCol] = mm_readA(batchA,\n globalRow + innerRow,\n kStart / ${innerElementSize} + inputCol);\n `;\n }\n };\n\nconst calculateResultSnippet =\n (transposeA: boolean, innerElementSize: number, rowPerThread: number) => {\n if (transposeA) {\n return `\n let ACached0 = mm_Asub[k * ${innerElementSize}][localRow];\n let ACached1 = mm_Asub[k * ${innerElementSize} + 1][localRow];\n let ACached2 = mm_Asub[k * ${innerElementSize} + 2][localRow];\n ${\n innerElementSize === 3 ? '' :\n `let ACached3 = mm_Asub[k * ${\n innerElementSize} + 3][localRow];`}\n for (var i = 0; i < ${rowPerThread}; i++) {\n acc[i] = BCached0 * ACached0[i] + acc[i];\n acc[i] = BCached1 * ACached1[i] + acc[i];\n acc[i] = BCached2 * ACached2[i] + acc[i];\n ${\n innerElementSize === 3 ?\n '' :\n 'acc[i] = BCached3 * ACached3[i] + acc[i];'}\n }`;\n } else {\n return `\n for (var i = 0; i < ${rowPerThread}; i++) {\n let ACached = mm_Asub[tileRow + i][k];\n acc[i] = BCached0 * ACached.x + acc[i];\n acc[i] = BCached1 * ACached.y + acc[i];\n acc[i] = BCached2 * ACached.z + acc[i];\n ${\n innerElementSize === 3 ? '' :\n 'acc[i] = BCached3 * ACached.w + acc[i];'}\n }`;\n }\n };\n\nexport function makeMatMulPackedVec4Source(\n workPerThread: number[], workgroupSize: [number, number, number],\n transposeA = false, tileInner = 32, splitK = false, splitedDimInner = 32,\n isVectorA = false, broadcastBatch = false): string {\n const tileAOuter = workgroupSize[1] * workPerThread[1];\n const tileBOuter = workgroupSize[0] * workPerThread[0];\n const tileAWidth = transposeA ? tileAOuter : tileInner;\n const tileAHight = transposeA ? tileInner : tileAOuter;\n const innerElementSize = tileAWidth / workgroupSize[0];\n const rowPerThreadB = tileInner / workgroupSize[1];\n const rowPerThread = workPerThread[1];\n util.assert(\n ((transposeA && innerElementSize === 4 && workPerThread[1] === 4) ||\n (!transposeA && (innerElementSize === 3 || innerElementSize === 4))) &&\n tileAWidth % workgroupSize[0] === 0 &&\n tileInner % workgroupSize[1] === 0 && workPerThread[0] === 4,\n () => `If transposeA ${transposeA} is true, innerElementSize ${\n innerElementSize} and workPerThread[1] ${workPerThread[1]} must be 4.\n Otherwise, innerElementSize ${innerElementSize} must be 3 or 4.\n tileAWidth ${tileAWidth} must be divisible by workgroupSize[0]${\n workgroupSize[0]}. tileInner ${\n tileInner} must be divisible by workgroupSize[1] ${\n workgroupSize[1]}. colPerThread ${workPerThread[0]} must be 4.`);\n return `\n var mm_Asub : array, ${\n tileAWidth / innerElementSize}>, ${tileAHight}>;\n var mm_Bsub : array, ${\n tileBOuter / workPerThread[0]}>, ${tileInner}>;\n\n ${main()} {\n let localRow = i32(localId.y);\n let tileRow = ${isVectorA ? '0' : `localRow * ${rowPerThread}`};\n let tileCol = i32(localId.x);\n\n let globalRow = ${isVectorA ? '0' : `i32(globalId.y) * ${rowPerThread}`};\n let globalCol = i32(globalId.x);\n let batch = ${splitK ? '0' : 'i32(globalId.z)'};\n let batchA = ${\n splitK || !broadcastBatch ? 'batch' : 'batch % uniforms.aShape[0]'};\n let batchB = ${\n splitK || !broadcastBatch ? 'batch' : 'batch % uniforms.bShape[0]'};\n let globalRowStart = i32(workgroupId.y) * ${tileAOuter};\n\n let numTiles = ${\n splitK ? `${Math.ceil(splitedDimInner / tileInner)}` :\n `(uniforms.dimInner - 1) / ${tileInner} + 1`};\n var kStart = ${splitK ? `i32(globalId.z) * ${splitedDimInner}` : '0'};\n\n var acc: array, ${rowPerThread}>;\n\n // Loop over shared dimension.\n let tileRowB = localRow * ${rowPerThreadB};\n for (var t = 0; t < numTiles; t++) {\n // Load one tile of A into local memory.\n for (var innerRow = 0; innerRow < ${rowPerThread}; innerRow++) {\n let inputRow = tileRow + innerRow;\n let inputCol = tileCol;\n ${writeDataToSubAVec4Snippet(transposeA, innerElementSize)}\n }\n\n // Load one tile of B into local memory.\n for (var innerRow = 0; innerRow < ${rowPerThreadB}; innerRow++) {\n let inputRow = tileRowB + innerRow;\n let inputCol = tileCol;\n mm_Bsub[inputRow][inputCol] = mm_readB(batchB, kStart + inputRow, globalCol);\n }\n kStart = kStart + ${tileInner};\n workgroupBarrier();\n\n // Compute acc values for a single thread.\n for (var k = 0; k < ${tileInner / innerElementSize}; k++) {\n let BCached0 = mm_Bsub[k * ${innerElementSize}][tileCol];\n let BCached1 = mm_Bsub[k * ${innerElementSize} + 1][tileCol];\n let BCached2 = mm_Bsub[k * ${innerElementSize} + 2][tileCol];\n ${\n innerElementSize === 3 ?\n '' :\n `let BCached3 = mm_Bsub[k * ${innerElementSize} + 3][tileCol];`}\n\n ${\n calculateResultSnippet(transposeA, innerElementSize, rowPerThread)}\n }\n\n workgroupBarrier();\n }\n\n for (var innerRow = 0; innerRow < ${rowPerThread}; innerRow++) {\n mm_write(batch, globalRow + innerRow, globalCol, acc[innerRow]);\n }\n }`;\n}\n\nconst writeDataToSubASnippet = (transpose: boolean) => {\n if (transpose) {\n return `\n mm_Asub[inputRow][inputCol] = mm_readA(batchA,\n kStart + inputRow,\n globalRowStart + inputCol);\n `;\n\n } else {\n return `\n mm_Asub[inputRow][inputCol] = mm_readA(batchA,\n globalRowStart + inputRow,\n kStart + inputCol);\n `;\n }\n};\n\nconst readDataFromSubASnippet = (transposeA: boolean) => {\n return transposeA ? 'let ACached = mm_Asub[k][tileRow + innerRow];' :\n\n 'let ACached = mm_Asub[tileRow + innerRow][k];';\n};\n\n// sequentialAccessByThreads means sequential data in memory is accessed by\n// threads, instead of a single thread (default behavior).\nexport function makeMatMulPackedSource(\n workPerThread: number[], workgroupSize: [number, number, number],\n transposeA = false, tileInner = 32, splitK = false, splitedDimInner = 32,\n sequentialAccessByThreads = false, broadcastBatch = false): string {\n const tileAOuter = workPerThread[1] * workgroupSize[1];\n const tileBOuter = workPerThread[0] * workgroupSize[0];\n const tileAWidth = transposeA ? tileAOuter : tileInner;\n const tileAHight = transposeA ? tileInner : tileAOuter;\n util.assert(\n tileAHight % workgroupSize[1] === 0 &&\n tileAWidth % workgroupSize[0] === 0 &&\n tileInner % workgroupSize[1] === 0,\n () => `tileAHight ${tileAHight} must be divisible by workgroupSize[1]${\n workgroupSize[1]}, tileAWidth ${\n tileAWidth} must be divisible by workgroupSize[0]${\n workgroupSize[0]}, tileInner ${\n tileInner} must be divisible by workgroupSize[1]${workgroupSize[1]}`);\n const rowPerThreadA = tileAHight / workgroupSize[1];\n const colPerThreadA = tileAWidth / workgroupSize[0];\n const rowPerThreadB = tileInner / workgroupSize[1];\n const rowPerThread = workPerThread[1];\n const colPerThread = workPerThread[0];\n const matmulSnippet = sequentialAccessByThreads ?\n `\n let localRow = i32(localId.y);\n let localCol = i32(localId.x);\n let globalRowStart = i32(workgroupId.y) * ${tileAOuter};\n let globalColStart = i32(workgroupId.x) * ${tileBOuter};\n\n // Loop over shared dimension.\n for (var t = 0; t < numTiles; t++) {\n // Load one tile of A into local memory.\n for (var inputRow = localRow; inputRow < ${\n tileAHight}; inputRow = inputRow + ${workgroupSize[1]}) {\n for (var inputCol = localCol; inputCol < ${\n tileAWidth}; inputCol = inputCol + ${workgroupSize[0]}) {\n ${writeDataToSubASnippet(transposeA)}\n }\n }\n // Load one tile of B into local memory.\n for (var inputRow = localRow; inputRow < ${\n tileInner}; inputRow = inputRow + ${workgroupSize[1]}) {\n for (var inputCol = localCol; inputCol < ${\n tileBOuter}; inputCol = inputCol + ${workgroupSize[0]}) {\n mm_Bsub[inputRow][inputCol] = mm_readB(batchB,\n kStart + inputRow,\n globalColStart + inputCol);\n }\n }\n kStart = kStart + ${tileInner};\n workgroupBarrier();\n\n // Compute acc values for a single thread.\n var BCached : array;\n for (var k = 0; k < ${tileInner}; k++) {\n for (var inner = 0; inner < ${colPerThread}; inner++) {\n BCached[inner] = mm_Bsub[k][localCol + inner * ${\n workgroupSize[0]}];\n }\n for (var innerRow = 0; innerRow < ${rowPerThread}; innerRow++) {\n let ACached = ${\n transposeA ?\n `mm_Asub[k][localRow + innerRow * ${workgroupSize[1]}];` :\n `mm_Asub[localRow + innerRow * ${workgroupSize[1]}][k];`}\n for (var innerCol = 0; innerCol < ${colPerThread}; innerCol++) {\n acc[innerRow][innerCol] = acc[innerRow][innerCol] +\n ACached * BCached[innerCol];\n }\n }\n }\n workgroupBarrier();\n }\n for (var innerRow = 0; innerRow < ${rowPerThread}; innerRow++) {\n let gRow = globalRowStart + localRow + innerRow * ${workgroupSize[1]};\n for (var innerCol = 0; innerCol < ${colPerThread}; innerCol++) {\n let gCol = globalColStart + localCol + innerCol * ${\n workgroupSize[0]};\n mm_write(batch, gRow, gCol, acc[innerRow][innerCol]);\n }\n }\n ` :\n `\n let tileRow = i32(localId.y) * ${rowPerThread};\n let tileCol = i32(localId.x) * ${colPerThread};\n\n let globalRow = i32(globalId.y) * ${rowPerThread};\n let globalCol = i32(globalId.x) * ${colPerThread};\n let globalRowStart = i32(workgroupId.y) * ${tileAOuter};\n\n let tileRowA = i32(localId.y) * ${rowPerThreadA};\n let tileColA = i32(localId.x) * ${colPerThreadA};\n let tileRowB = i32(localId.y) * ${rowPerThreadB};\n // Loop over shared dimension.\n for (var t = 0; t < numTiles; t++) {\n // Load one tile of A into local memory.\n for (var innerRow = 0; innerRow < ${rowPerThreadA}; innerRow++) {\n for (var innerCol = 0; innerCol < ${colPerThreadA}; innerCol++) {\n let inputRow = tileRowA + innerRow;\n let inputCol = tileColA + innerCol;\n ${writeDataToSubASnippet(transposeA)}\n }\n }\n\n // Load one tile of B into local memory.\n for (var innerRow = 0; innerRow < ${rowPerThreadB}; innerRow++) {\n for (var innerCol = 0; innerCol < ${colPerThread}; innerCol++) {\n let inputRow = tileRowB + innerRow;\n let inputCol = tileCol + innerCol;\n mm_Bsub[inputRow][inputCol] = mm_readB(batchB,\n kStart + inputRow,\n globalCol + innerCol);\n }\n }\n kStart = kStart + ${tileInner};\n workgroupBarrier();\n\n // Compute acc values for a single thread.\n var BCached : array;\n for (var k = 0; k < ${tileInner}; k++) {\n for (var inner = 0; inner < ${colPerThread}; inner++) {\n BCached[inner] = mm_Bsub[k][tileCol + inner];\n }\n\n for (var innerRow = 0; innerRow < ${rowPerThread}; innerRow++) {\n ${readDataFromSubASnippet(transposeA)}\n for (var innerCol = 0; innerCol < ${colPerThread}; innerCol++) {\n acc[innerRow][innerCol] = acc[innerRow][innerCol] + ACached * BCached[innerCol];\n }\n }\n }\n\n workgroupBarrier();\n }\n\n for (var innerRow = 0; innerRow < ${rowPerThread}; innerRow++) {\n for (var innerCol = 0; innerCol < ${colPerThread}; innerCol++) {\n mm_write(batch, globalRow + innerRow, globalCol + innerCol,\n acc[innerRow][innerCol]);\n }\n }\n `;\n\n return `\n var mm_Asub : array, ${tileAHight}>;\n var mm_Bsub : array, ${tileInner}>;\n\n ${main()} {\n let batch = ${splitK ? '0' : 'i32(globalId.z)'};\n let batchA = ${\n splitK || !broadcastBatch ? 'batch' : 'batch % uniforms.aShape[0]'};\n let batchB = ${\n splitK || !broadcastBatch ? 'batch' : 'batch % uniforms.bShape[0]'};\n let numTiles = ${\n splitK ? `${Math.ceil(splitedDimInner / tileInner)}` :\n `(uniforms.dimInner - 1) / ${tileInner} + 1`};\n var kStart = ${splitK ? `i32(globalId.z) * ${splitedDimInner}` : '0'};\n\n var acc : array, ${rowPerThread}>;\n\n // Without this initialization strange values show up in acc.\n for (var innerRow = 0; innerRow < ${rowPerThread}; innerRow++) {\n for (var innerCol = 0; innerCol < ${colPerThread}; innerCol++) {\n acc[innerRow][innerCol] = 0.0;\n }\n }\n ${matmulSnippet}\n }\n `;\n}\n\nconst readVectorASnippet = (transpose: boolean) => {\n return transpose ? `\n mm_readA(batchA, colA, globalRow),\n mm_readA(batchA, colA + 1, globalRow),\n mm_readA(batchA, colA + 2, globalRow),\n mm_readA(batchA, colA + 3, globalRow)\n ` :\n `\n mm_readA(batchA, globalRow, colA),\n mm_readA(batchA, globalRow, colA + 1),\n mm_readA(batchA, globalRow, colA + 2),\n mm_readA(batchA, globalRow, colA + 3)\n `;\n};\n\nexport function makeVectorMatrixProductSource(\n workgroupSize: [number, number, number], transposeA = false): string {\n util.assert(\n workgroupSize[1] === 1 && workgroupSize[2] === 1,\n () => `A linear work group size is required. But got ${workgroupSize}.`);\n const tileSize = workgroupSize[0] * 4;\n return `\n var mm_Asub : array, ${workgroupSize[0]}>;\n\n ${main()} {\n let tileCol = i32(localId.x);\n let globalCol = i32(globalId.x);\n let globalRow = i32(globalId.y);\n\n let numTiles = (uniforms.dimInner - 1) / ${tileSize} + 1;\n let batch = i32(globalId.z);\n let batchA = batch % uniforms.aShape[0];\n let batchB = batch % uniforms.bShape[0];\n // Without this initialization strange values show up in acc.\n var acc = 0.0;\n\n // Loop over shared dimension.\n for (var t = 0; t < numTiles; t++) {\n // Load one tile of A into local memory.\n let colA = t * ${tileSize} + tileCol * 4;\n mm_Asub[tileCol] = vec4(${readVectorASnippet(transposeA)});\n workgroupBarrier();\n\n // Compute acc values for a single thread.\n for (var k = 0; k < ${tileSize / 4}; k++) {\n let rowB = t * ${tileSize} + k * 4;\n let BCached = vec4(mm_readB(batchB, rowB, globalCol),\n mm_readB(batchB, rowB + 1, globalCol),\n mm_readB(batchB, rowB + 2, globalCol),\n mm_readB(batchB, rowB + 3, globalCol));\n\n let ACached = mm_Asub[k];\n acc = acc + dot(ACached, BCached);\n }\n\n workgroupBarrier();\n }\n\n mm_write(batch, globalRow, globalCol, acc);\n }\n `;\n}\n\nexport class MatMulPackedProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[], y: number[], z: number[]};\n dispatch: [number, number, number];\n variableNames = ['A', 'B'];\n uniforms = `dimAOuter : i32, dimBOuter : i32, dimInner : i32,`;\n workgroupSize: [number, number, number];\n elementsPerThread: [number, number, number];\n transposeA: boolean;\n transposeB: boolean;\n addBias: boolean;\n activation: backend_util.Activation;\n hasPreluActivationWeights: boolean;\n fitAOuter: boolean;\n fitBOuter: boolean;\n fitInner: boolean;\n tileInner: number;\n isVectorA: boolean;\n isVec4: boolean;\n private sequentialAccessByThreads: boolean;\n\n constructor(\n aShape: [number, number, number], outputShape: [number, number, number],\n transposeA = false, transposeB = false, bias: TensorInfo = null,\n activation: backend_util.Activation = null,\n preluActivationWeights: TensorInfo = null,\n sequentialAccessByThreads = false) {\n this.outputShape = outputShape;\n this.dispatchLayout = {x: [2], y: [1], z: [0]};\n const dimInner = transposeA ? aShape[1] : aShape[2];\n this.isVec4 = ((dimInner % 4 === 0 && !transposeA) ||\n (outputShape[1] % 4 === 0 && transposeA)) &&\n outputShape[2] % 4 === 0 && !transposeB;\n this.isVectorA = outputShape[1] === 1 && !transposeA;\n\n if (!this.isVec4 && this.isVectorA) {\n // For makeVectorMatrixProductSource\n this.elementsPerThread = [1, 1, 1];\n this.workgroupSize = [32, 1, 1];\n } else {\n const workgroupInfo = computeWorkgroupInfoForMatMul(\n outputShape[1], dimInner, outputShape[2], transposeA);\n this.workgroupSize = workgroupInfo.workgroupSize;\n this.elementsPerThread = workgroupInfo.elementsPerThread;\n }\n\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize,\n this.elementsPerThread);\n\n const addBias = bias != null;\n const hasPreluActivationWeights = preluActivationWeights != null;\n if (addBias) {\n this.variableNames.push('bias');\n }\n\n if (hasPreluActivationWeights) {\n this.variableNames.push('preluActivationWeights');\n }\n\n this.sequentialAccessByThreads = sequentialAccessByThreads;\n this.transposeA = transposeA;\n this.transposeB = transposeB;\n this.addBias = addBias;\n this.activation = activation;\n this.hasPreluActivationWeights = hasPreluActivationWeights;\n [this.fitAOuter, this.fitBOuter, this.fitInner] =\n this.getShapeFit(outputShape[1], outputShape[2], dimInner);\n this.shaderKey = `matMulPacked_${this.elementsPerThread}_${transposeA}_${\n transposeB}_${this.activation}_${this.fitAOuter}_${this.fitBOuter}_${\n this.fitInner}_${this.isVec4}_${this.isVectorA}_${\n this.sequentialAccessByThreads}`;\n }\n\n getShapeFit(dimAOuter: number, dimBOuter: number, dimInner: number):\n boolean[] {\n const tileAOuter = this.workgroupSize[1] * this.elementsPerThread[1];\n const tileBOuter = this.workgroupSize[0] * this.elementsPerThread[0];\n\n if (!this.isVec4 && this.isVectorA) {\n // For makeVectorMatrixProductSource\n this.tileInner = this.workgroupSize[0] * 4;\n } else {\n this.tileInner = tileBOuter;\n }\n\n const fitAOuter = dimAOuter % tileAOuter === 0;\n const fitBOuter = dimBOuter % tileBOuter === 0;\n const fitInner = dimInner % this.tileInner === 0;\n return [fitAOuter, fitBOuter, fitInner];\n }\n\n getUserCode(): string {\n const userCode = `\n ${\n activationFnSnippet(\n this.activation, this.hasPreluActivationWeights, this.isVec4)}\n ${\n matMulReadWriteFnSource(\n this.addBias, this.activation,\n false /* transposeA is implemented in makeMatMulPackedSource */,\n this.transposeB, this.fitAOuter, this.fitBOuter, this.fitInner,\n this.isVec4 ? 4 : 1)}\n ${\n this.isVec4 ?\n makeMatMulPackedVec4Source(\n this.elementsPerThread, this.workgroupSize, this.transposeA,\n this.tileInner, false, null, this.isVectorA, true) :\n (this.isVectorA ? makeVectorMatrixProductSource(\n this.workgroupSize, this.transposeA) :\n makeMatMulPackedSource(\n this.elementsPerThread, this.workgroupSize,\n this.transposeA, this.tileInner, false, null,\n this.sequentialAccessByThreads, true))}\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {activationFnSnippet} from './activation_util';\nimport {matMulReadWriteFnSource} from './matmul_packed_webgpu';\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch} from './webgpu_util';\n\nexport function makeMatMulReduceSource(workgroupSizeX: number): string {\n return `\n var sumValues : array;\n ${main()} {\n let coords = getOutputCoords();\n let batch = coords[0];\n let batchA = batch % uniforms.aShape[0];\n let batchB = batch % uniforms.bShape[0];\n let row = coords[1];\n let col = coords[2];\n var sum = 0.0;\n let Length = uniforms.dimInner;\n for (var k = i32(localId.x); k < Length; k = k + ${workgroupSizeX}) {\n let dataA = mm_readA(batchA, row, k);\n let dataB = mm_readB(batchB, k, col);\n sum = sum + dataA * dataB;\n }\n sumValues[localId.x] = sum;\n workgroupBarrier();\n\n for(var currentSize = ${workgroupSizeX / 2}u; currentSize > 1u;\n currentSize = currentSize / 2u) {\n if (localId.x < currentSize)\n {\n sumValues[localId.x] = sumValues[localId.x] + sumValues[localId.x + currentSize];\n }\n workgroupBarrier();\n }\n\n if (localId.x == 0u) {\n sum = sumValues[0] + sumValues[1];\n mm_write(batch, row, col, sum);\n }\n }\n `;\n}\n\nexport class MatMulReduceProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[], y: number[], z: number[]};\n dispatch: [number, number, number];\n variableNames = ['A', 'B'];\n uniforms = `dimAOuter : i32, dimBOuter : i32, dimInner : i32,`;\n workgroupSize: [number, number, number] = [256, 1, 1];\n transposeA: boolean;\n transposeB: boolean;\n addBias: boolean;\n activation: backend_util.Activation;\n hasPreluActivationWeights: boolean;\n\n constructor(\n outputShape: [number, number, number], transposeA = false,\n transposeB = false, bias: TensorInfo = null,\n activation: backend_util.Activation = null,\n preluActivationWeights: TensorInfo = null) {\n this.outputShape = outputShape;\n this.dispatchLayout = {x: [], y: [1, 2], z: [0]};\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n\n const addBias = bias != null;\n const hasPreluActivationWeights = preluActivationWeights != null;\n if (addBias) {\n this.variableNames.push('bias');\n }\n\n if (hasPreluActivationWeights) {\n this.variableNames.push('preluActivationWeights');\n }\n\n this.transposeA = transposeA;\n this.transposeB = transposeB;\n this.addBias = addBias;\n this.activation = activation;\n this.hasPreluActivationWeights = hasPreluActivationWeights;\n this.shaderKey =\n `matMulReduce_${this.activation}_${transposeA}_${transposeB}`;\n }\n\n getUserCode(): string {\n const userCode = `\n ${activationFnSnippet(this.activation, this.hasPreluActivationWeights)}\n ${\n matMulReadWriteFnSource(\n this.addBias, this.activation, this.transposeA, this.transposeB)}\n ${makeMatMulReduceSource(this.workgroupSize[0])}\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, TensorInfo} from '@tensorflow/tfjs-core';\nimport {activationFnSnippet} from './activation_util';\nimport {matMulReadWriteFnSource} from './matmul_packed_webgpu';\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\n\nexport function makeMatMulSmallOutputSizeSource(\n workgroupSize: [number, number, number]): string {\n const tileAOuter = workgroupSize[1];\n const tileBOuter = workgroupSize[0];\n const tileInner = tileAOuter > tileBOuter ? tileAOuter : tileBOuter;\n return `\n var mm_Asub : array, ${tileAOuter}>;\n var mm_Bsub : array, ${tileInner}>;\n\n // If the output size is small for matrix multiplication, avoid to use vec4\n // and handle some elements per thread to optimally utilize the ALU.\n // Read data from global memory to registers firstly, then store them into\n // shared memory, so it is instruction-Level parallelism for arithmetic\n // operations and others handle IO operations between barrier api, makes ALU\n // and load/store units work simultaneously, could improves the performance.\n ${main()} {\n let tileRow = i32(localId.y);\n let tileCol = i32(localId.x);\n let globalRow = i32(globalId.y);\n let globalCol = i32(globalId.x);\n let batch = i32(globalId.z);\n let batchA = batch % uniforms.aShape[0];\n let batchB = batch % uniforms.bShape[0];\n\n // uniforms.dimInner should be greater than 0.\n let numTiles = (uniforms.dimInner - 1) / ${tileInner} + 1;\n var acc = 0.0;\n\n var globalColA = tileCol;\n var globalRowB = 0;\n var regA = mm_readA(batchA, globalRow, globalColA);\n var regB0 = mm_readB(batchB, globalRowB + 2 * tileRow, globalCol);\n var regB1 = mm_readB(batchB, globalRowB + 2 * tileRow + 1, globalCol);\n globalColA = globalColA + ${tileInner};\n globalRowB = globalRowB + ${tileInner};\n\n for (var t = 0; t < numTiles; t = t + 1) {\n mm_Asub[tileRow][tileCol] = regA;\n mm_Bsub[2 * tileRow][tileCol] = regB0;\n mm_Bsub[2 * tileRow + 1][tileCol] = regB1;\n\n workgroupBarrier();\n\n regA = mm_readA(batchA, globalRow, globalColA);\n regB0 = mm_readB(batchB, globalRowB + 2 * tileRow, globalCol);\n regB1 = mm_readB(batchB, globalRowB + 2 * tileRow + 1, globalCol);\n globalColA = globalColA + ${tileInner};\n globalRowB = globalRowB + ${tileInner};\n\n for (var k = 0; k < ${tileInner}; k = k + 1) {\n acc = acc + mm_Asub[tileRow][k] * mm_Bsub[k][tileCol];\n }\n workgroupBarrier();\n }\n\n mm_write(batch, globalRow, globalCol, acc);\n }\n `;\n}\n\nexport class MatMulSmallOutputSizeProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[], y: number[], z: number[]};\n dispatch: [number, number, number];\n variableNames = ['A', 'B'];\n uniforms = `dimAOuter : i32, dimBOuter : i32, dimInner : i32,`;\n workgroupSize: [number, number, number] = [16, 8, 1];\n transposeA: boolean;\n transposeB: boolean;\n addBias: boolean;\n activation: backend_util.Activation;\n hasPreluActivationWeights: boolean;\n\n constructor(\n aShape: [number, number, number], bShape: [number, number, number],\n outputShape: [number, number, number], transposeA = false,\n transposeB = false, bias: TensorInfo = null,\n activation: backend_util.Activation = null,\n preluActivationWeights: TensorInfo = null) {\n this.outputShape = outputShape;\n\n this.dispatchLayout = {x: [2], y: [1], z: [0]};\n this.dispatch = [\n Math.ceil(outputShape[2] / this.workgroupSize[0]),\n Math.ceil(outputShape[1] / this.workgroupSize[1]), outputShape[0]\n ];\n\n const addBias = bias != null;\n if (addBias) {\n this.variableNames.push('bias');\n }\n\n const hasPreluActivationWeights = preluActivationWeights != null;\n if (hasPreluActivationWeights) {\n this.variableNames.push('preluActivationWeights');\n }\n\n this.transposeA = transposeA;\n this.transposeB = transposeB;\n this.addBias = addBias;\n this.activation = activation;\n this.hasPreluActivationWeights = hasPreluActivationWeights;\n this.shaderKey =\n `matMulSmallOutputSize_${this.activation}_${transposeA}_${transposeB}`;\n }\n\n getUserCode(): string {\n const userCode = `\n ${activationFnSnippet(this.activation, this.hasPreluActivationWeights)}\n ${\n matMulReadWriteFnSource(\n this.addBias, this.activation, this.transposeA, this.transposeB)}\n ${makeMatMulSmallOutputSizeSource(this.workgroupSize)}\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {activationFnSnippet, biasActivationSnippet, typeSnippet} from './activation_util';\nimport {makeMatMulPackedSource, makeMatMulPackedVec4Source, matMulReadFnSource} from './matmul_packed_webgpu';\nimport {atomicAddSnippet} from './shader_util';\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class MatMulSplitKProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[], y: number[], z: number[]};\n dispatch: [number, number, number];\n variableNames = ['A', 'B'];\n uniforms = `dimAOuter : i32, dimBOuter : i32, dimInner : i32,`;\n workgroupSize: [number, number, number] = [8, 8, 1];\n elementsPerThread: [number, number, number];\n transposeA: boolean;\n transposeB: boolean;\n atomic = true;\n isVec4 = false;\n splitedDimInner = 128;\n\n constructor(\n outputShape: [number, number, number], dimInner: number,\n transposeA = false, transposeB = false) {\n util.assert(\n outputShape[0] === 1,\n () => 'MatMulSplitKProgram only supports batch = 1.');\n this.outputShape = outputShape;\n this.dispatchLayout = {x: [2], y: [1], z: [0, 3]};\n this.isVec4 = (transposeA && this.outputShape[1] % 4 === 0 ||\n !transposeA && dimInner % 4 === 0) &&\n this.outputShape[2] % 4 === 0;\n this.elementsPerThread = [4, 4, this.splitedDimInner];\n\n if (!this.isVec4) {\n if (this.outputShape[1] < 16) {\n this.elementsPerThread[1] = 1;\n }\n if (this.outputShape[2] < 16) {\n this.elementsPerThread[0] = 1;\n }\n }\n\n this.dispatch = computeDispatch(\n this.dispatchLayout,\n [\n this.outputShape[0], this.outputShape[1], this.outputShape[2],\n dimInner\n ],\n this.workgroupSize, this.elementsPerThread);\n\n this.transposeA = transposeA;\n this.transposeB = transposeB;\n this.shaderKey = `matMulSplitK_${transposeA}_${transposeB}_${\n this.elementsPerThread}_${this.isVec4}`;\n }\n\n getUserCode(): string {\n const component = this.isVec4 ? 4 : 1;\n const userCode = `\n ${\n matMulReadFnSource(\n false, this.transposeB, false, false, false, component)}\n fn mm_write(batch: i32, row : i32, colIn : i32, value : ${\n typeSnippet(component)}) {\n let col = colIn * ${component};\n if (row < uniforms.dimAOuter && col < uniforms.dimBOuter) {\n let coords = vec3(batch, row, col);\n let flatIndex = getOutputIndexFromCoords(coords);\n // The problem is that we should initialize output to zero before using.\n // Otherwise, the original value will be added to the result.\n for (var i = 0; i < ${component}; i = i + 1) {\n ${\n atomicAddSnippet(\n '&result[flatIndex + i]', `${component > 1 ? 'value[i]' : 'value'}`,\n 'float32')}\n }\n }\n }\n ${\n this.isVec4 ? makeMatMulPackedVec4Source(\n this.elementsPerThread, this.workgroupSize,\n this.transposeA, 32, true, this.splitedDimInner) :\n makeMatMulPackedSource(\n this.elementsPerThread, this.workgroupSize,\n this.transposeA, 32, true, this.splitedDimInner)}\n `;\n return userCode;\n }\n}\n\nexport class BiasActivationProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n uniforms = '';\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames = ['x'];\n workgroupSize: [number, number, number] = [64, 1, 1];\n size = true;\n private addBias: boolean;\n private activation: backend_util.Activation;\n private hasPreluActivationWeights: boolean;\n\n constructor(\n outputShape: number[], bias: TensorInfo = null,\n activation: backend_util.Activation = null,\n preluActivationWeights: TensorInfo = null) {\n this.outputShape = outputShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n this.addBias = bias != null;\n this.hasPreluActivationWeights = preluActivationWeights != null;\n this.activation = activation;\n if (this.addBias) {\n this.variableNames.push('bias');\n }\n\n if (this.hasPreluActivationWeights) {\n this.variableNames.push('preluActivationWeights');\n }\n\n this.shaderKey = `biasActivation_${activation}`;\n }\n\n getUserCode(): string {\n return `\n ${activationFnSnippet(this.activation, this.hasPreluActivationWeights)}\n ${main('index')} {\n if (index < uniforms.size) {\n let coords = getCoordsFromIndex(index);\n var value = getXByOutputIndex(index);\n ${biasActivationSnippet(this.addBias, this.activation)}\n setOutputAtIndex(index, value);\n }\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class FillProgram implements WebGPUProgram {\n variableNames: string[] = [];\n outputShape: number[] = [];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n uniforms = 'value : f32,';\n workgroupSize: [number, number, number] = [64, 1, 1];\n size = true;\n\n constructor(shape: number[]) {\n this.outputShape = shape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n\n this.shaderKey = 'fill';\n }\n\n getUserCode(): string {\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n setOutputAtIndex(index, uniforms.value);\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Fill, FillAttrs, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {FillProgram} from '../fill_webgpu';\n\nexport function fill(args: {backend: WebGPUBackend, attrs: FillAttrs}):\n TensorInfo {\n const {backend, attrs} = args;\n const {shape, value} = attrs;\n let {dtype} = attrs;\n\n dtype = dtype || util.inferDtype(value);\n\n if (dtype === 'string') {\n // String type should be handled in CPU memory.\n const values = util.getArrayFromDType(dtype, util.sizeFromShape(shape));\n values.fill(value as string);\n return backend.makeTensorInfo(shape, dtype, values);\n } else {\n const program = new FillProgram(shape);\n const uniformData = [{type: 'float32', data: [value as number]}];\n return backend.runWebGPUProgram(program, [], dtype, uniformData);\n }\n}\n\nexport const fillConfig: KernelConfig = {\n kernelName: Fill,\n backendName: 'webgpu',\n kernelFunc: fill as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Reshape, ReshapeAttrs, ReshapeInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\n\nexport function reshape(\n args: {inputs: ReshapeInputs, backend: WebGPUBackend, attrs: ReshapeAttrs}):\n TensorInfo {\n const {inputs, attrs} = args;\n const {x} = inputs;\n const {shape} = attrs;\n\n const xSize = util.sizeFromShape(x.shape);\n const $shape = util.inferFromImplicitShape(shape, xSize);\n const $xSize = util.sizeFromShape($shape);\n\n util.assert(\n xSize === $xSize,\n () => `The new shape (${$shape}) has ${$xSize} elements and the old ` +\n `shape (${x.shape}) has ${xSize} elements. The new shape and old ` +\n `shape must have the same number of elements.`);\n\n // Backend needs to track refCount for the dataId for reshape op\n args.backend.incRef(x.dataId);\n return {dataId: x.dataId, shape: $shape, dtype: x.dtype};\n}\n\nexport const reshapeConfig: KernelConfig = {\n kernelName: Reshape,\n backendName: 'webgpu',\n kernelFunc: reshape as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, broadcast_util, env, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {MatMulPackedProgram} from '../matmul_packed_webgpu';\nimport {MatMulReduceProgram} from '../matmul_reduce_webgpu';\nimport {MatMulSmallOutputSizeProgram} from '../matmul_small_output_size_webgpu';\nimport {BiasActivationProgram, MatMulSplitKProgram} from '../matmul_splitK_webgpu';\nimport {WebGPUProgram} from '../webgpu_program';\nimport {MatMulProgramType} from '../webgpu_util';\n\nimport {fill} from './Fill';\nimport {reshape} from './Reshape';\n\ntype BatchMatMulConfig = {\n a: TensorInfo,\n b: TensorInfo,\n transposeA: boolean,\n transposeB: boolean,\n backend: WebGPUBackend,\n bias?: TensorInfo,\n preluActivationWeights?: TensorInfo,\n leakyreluAlpha?: number,\n activation?: backend_util.Activation\n};\n\nexport function batchMatMulImpl({\n a,\n b,\n transposeA,\n transposeB,\n backend,\n bias = null,\n preluActivationWeights = null,\n leakyreluAlpha = 0,\n activation = null\n}: BatchMatMulConfig): TensorInfo {\n const aRank = a.shape.length;\n const bRank = b.shape.length;\n\n const innerShapeA = transposeA ? a.shape[aRank - 2] : a.shape[aRank - 1];\n const innerShapeB = transposeB ? b.shape[bRank - 1] : b.shape[bRank - 2];\n\n const outerShapeA = transposeA ? a.shape[aRank - 1] : a.shape[aRank - 2];\n const outerShapeB = transposeB ? b.shape[bRank - 2] : b.shape[bRank - 1];\n\n const outerDimsA = a.shape.slice(0, -2);\n const outerDimsB = b.shape.slice(0, -2);\n\n const batchDimA = util.sizeFromShape(outerDimsA);\n const batchDimB = util.sizeFromShape(outerDimsB);\n\n const outShapeOuterDims = broadcast_util.assertAndGetBroadcastShape(\n a.shape.slice(0, -2), b.shape.slice(0, -2));\n const outShape = outShapeOuterDims.concat([outerShapeA, outerShapeB]);\n\n util.assert(\n innerShapeA === innerShapeB,\n () => `Error in matMul: inner shapes (${innerShapeA}) and (` +\n `${innerShapeB}) of Tensors with shapes ${a.shape} and ` +\n `${b.shape} and transposeA=${transposeA}` +\n ` and transposeB=${transposeB} must match.`);\n\n const a3dShape: [number, number, number] = transposeA ?\n [batchDimA, innerShapeA, outerShapeA] :\n [batchDimA, outerShapeA, innerShapeA];\n const b3dShape: [number, number, number] = transposeB ?\n [batchDimB, outerShapeB, innerShapeB] :\n [batchDimB, innerShapeB, outerShapeB];\n\n // The rest of the implementation is designed to operate on rank-3 tensors\n const a3d = reshape({inputs: {x: a}, backend, attrs: {shape: a3dShape}});\n const b3d = reshape({inputs: {x: b}, backend, attrs: {shape: b3dShape}});\n const intermediates: TensorInfo[] = [a3d, b3d];\n\n const batchDim = Math.max(batchDimA, batchDimB);\n\n const inputs: TensorInfo[] = [a3d, b3d];\n const dimensions = [\n {type: 'int32', data: [outerShapeA]}, {type: 'int32', data: [outerShapeB]},\n {type: 'int32', data: [innerShapeA]}\n ];\n\n let program: WebGPUProgram;\n let out: TensorInfo;\n const outputShape: [number, number, number] =\n [batchDim, outerShapeA, outerShapeB];\n let matmulProgramType = env().get('WEBGPU_MATMUL_PROGRAM_TYPE') as number;\n if (matmulProgramType < 0) {\n // Usually increasing workgroups is a good way to gain more performance for\n // few workgroups by tiling 32x32 (default matmul algorithm). Currently,\n // there are three ways to increase workgroups. 1) MatMulReduceProgram,\n // which is used only when the output size is very small (128 for now). 2)\n // MatMulSplitKProgram, increasing workgroups by spliting K. 3)\n // MatMulSmallOutputSizeProgram, increasing workgroups by small tile size.\n // For different devices, the minimum optimal workgroups may be different.\n // So here we set a |thresholdToIncreaseWorkgroups| to indicate whether we\n // need to increase workgroups. And the literal number is an empirical\n // value.\n const thresholdFlagValue =\n env().getNumber('WEBGPU_THRESHOLD_TO_INCREASE_WORKGROUPS_FOR_MATMUL');\n const thresholdToIncreaseWorkgroups = thresholdFlagValue > 0 ?\n thresholdFlagValue :\n backend.thresholdToIncreaseWorkgroups;\n const workgroupsBy32x32 =\n batchDim * Math.ceil(outerShapeA / 32) * Math.ceil(outerShapeB / 32);\n const hasFewWorkgroups =\n workgroupsBy32x32 <= thresholdToIncreaseWorkgroups ||\n (outerShapeA <= 8 &&\n workgroupsBy32x32 <= thresholdToIncreaseWorkgroups * 2);\n if (hasFewWorkgroups) {\n if (batchDim * outerShapeA * outerShapeB <= 128) {\n matmulProgramType = MatMulProgramType.MatMulReduceProgram;\n } else if (batchDim === 1 && innerShapeB >= 2000) {\n matmulProgramType = MatMulProgramType.MatMulSplitKProgram;\n } else {\n matmulProgramType = MatMulProgramType.MatMulSmallOutputSizeProgram;\n }\n } else {\n matmulProgramType = MatMulProgramType.MatMulPackedProgram;\n }\n }\n\n switch (matmulProgramType) {\n case MatMulProgramType.MatMulReduceProgram:\n program = new MatMulReduceProgram(\n outputShape, transposeA, transposeB, bias, activation,\n preluActivationWeights);\n break;\n case MatMulProgramType.MatMulSplitKProgram: {\n // The output buffer must be initailzed to zero before using since we\n // use atomicAdd in MatMulSplitKProgram.\n out = fill(\n {backend, attrs: {shape: outputShape, value: 0, dtype: a.dtype}});\n program = new MatMulSplitKProgram(\n outputShape, innerShapeB, transposeA, transposeB);\n if (bias || activation) {\n out =\n backend.runWebGPUProgram(program, inputs, a.dtype, dimensions, out);\n const biasActivationProgram = new BiasActivationProgram(\n out.shape, bias, activation, preluActivationWeights);\n let uniformData = null;\n const activationInputs: TensorInfo[] = [out];\n if (bias) {\n activationInputs.push(bias);\n }\n if (preluActivationWeights) {\n activationInputs.push(preluActivationWeights);\n }\n if (activation === 'leakyrelu') {\n uniformData = [{type: 'float32', data: [leakyreluAlpha]}];\n biasActivationProgram.uniforms += ' alpha : f32,';\n }\n const outActivated = backend.runWebGPUProgram(\n biasActivationProgram, activationInputs, out.dtype, uniformData);\n intermediates.push(out);\n const outReshaped = reshape(\n {inputs: {x: outActivated}, backend, attrs: {shape: outShape}});\n intermediates.push(outActivated);\n for (const i of intermediates) {\n backend.disposeData(i.dataId);\n }\n return outReshaped;\n }\n break;\n }\n case MatMulProgramType.MatMulSmallOutputSizeProgram:\n program = new MatMulSmallOutputSizeProgram(\n a3dShape, b3dShape, outputShape, transposeA, transposeB, bias,\n activation, preluActivationWeights);\n break;\n case MatMulProgramType.MatMulPackedProgram:\n // Experiments show that sequential access is more friendly for Intel\n // GPUs.\n const sequentialAccessByThreads = backend.adapterInfo.isIntel();\n program = new MatMulPackedProgram(\n a3dShape, outputShape, transposeA, transposeB, bias, activation,\n preluActivationWeights, sequentialAccessByThreads);\n break;\n default:\n throw new Error(`Unsupported MatMulProgramType ${matmulProgramType}.`);\n }\n\n if (bias) {\n inputs.push(bias);\n }\n if (preluActivationWeights) {\n inputs.push(preluActivationWeights);\n }\n if (activation === 'leakyrelu') {\n dimensions.push({type: 'float32', data: [leakyreluAlpha]});\n program.uniforms += ' alpha : f32,';\n }\n out = backend.runWebGPUProgram(program, inputs, a.dtype, dimensions, out);\n const outReshaped =\n reshape({inputs: {x: out}, backend, attrs: {shape: outShape}});\n intermediates.push(out);\n for (const i of intermediates) {\n backend.disposeData(i.dataId);\n }\n return outReshaped;\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {_FusedMatMul, _FusedMatMulAttrs, _FusedMatMulInputs, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {batchMatMulImpl} from './BatchMatMul_impl';\n\nexport function _fusedMatMul(args: {\n inputs: _FusedMatMulInputs,\n attrs: _FusedMatMulAttrs,\n backend: WebGPUBackend\n}) {\n const {inputs, backend, attrs} = args;\n const {a, b, bias, preluActivationWeights} = inputs;\n const {transposeA, transposeB, activation, leakyreluAlpha} = attrs;\n\n return batchMatMulImpl({\n a,\n b,\n transposeA,\n transposeB,\n backend,\n bias,\n preluActivationWeights,\n leakyreluAlpha,\n activation\n });\n}\n\nexport const _fusedMatMulConfig: KernelConfig = {\n kernelName: _FusedMatMul,\n backendName: 'webgpu',\n kernelFunc: _fusedMatMul as unknown as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {BinaryOpType, getBinaryOpString} from './binary_op_util';\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class BinaryOpComplexProgram implements WebGPUProgram {\n variableNames = ['AReal', 'AImag', 'BReal', 'BImag'];\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n workgroupSize: [number, number, number] = [128, 1, 1];\n op: BinaryOpType;\n size = true;\n\n constructor(op: BinaryOpType, aShape: number[], bShape: number[]) {\n this.outputShape = backend_util.assertAndGetBroadcastShape(aShape, bShape);\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n\n this.shaderKey = `binaryOpComplex_${op}`;\n this.op = op;\n }\n\n getUserCode(): string {\n const opStr = getBinaryOpString(this.op, false);\n const userCode = `\n fn binaryOpComplex(\n areal : f32, aimag : f32, breal : f32, bimag : f32) -> f32 {\n ${opStr}\n }\n\n ${main('index')} {\n if(index < uniforms.size) {\n let areal = getARealByOutputIndex(index);\n let aimag = getAImagByOutputIndex(index);\n let breal = getBRealByOutputIndex(index);\n let bimag = getBImagByOutputIndex(index);\n setOutputAtIndex(index, binaryOpComplex(areal, aimag, breal, bimag));\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, util} from '@tensorflow/tfjs-core';\n\nimport {BinaryOpType, getBinaryOpString} from './binary_op_util';\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class BinaryOpProgram implements WebGPUProgram {\n dispatch: [number, number, number];\n dispatchLayout: {x: number[]};\n isVec4: boolean;\n op: BinaryOpType;\n outputShape: number[];\n shaderKey: string;\n size = true;\n variableNames = ['A', 'B'];\n workgroupSize: [number, number, number];\n workPerThread: number;\n\n private lastDimensionSize: number;\n private useSharedMemoryWithA: boolean;\n private useSharedMemoryWithB: boolean;\n private type: string;\n\n constructor(op: BinaryOpType, aShape: number[], bShape: number[]) {\n this.outputShape = backend_util.assertAndGetBroadcastShape(aShape, bShape);\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.op = op;\n\n this.useSharedMemoryWithA =\n aShape.length <= 1 && bShape.length > 1 && aShape[0] < 128;\n this.useSharedMemoryWithB =\n bShape.length <= 1 && aShape.length > 1 && bShape[0] < 128;\n\n if (this.useSharedMemoryWithA || this.useSharedMemoryWithB) {\n this.isVec4 = false;\n // lastDimensionSize is used as sharedBuf array size, so can not be\n // used as uniform.\n this.lastDimensionSize =\n this.useSharedMemoryWithB ? bShape[0] : aShape[0];\n this.shaderKey = `binary_${this.type}_${op}_${this.lastDimensionSize}_${\n this.useSharedMemoryWithB}`;\n this.type = 'shared';\n // This is an experimental value when using shared memory.\n // Note that the maximum of workgroup X dimension is 256.\n this.workgroupSize = [256, 1, 1];\n this.workPerThread = 1;\n } else {\n if (util.arraysEqual(aShape, bShape) &&\n util.sizeFromShape(aShape) % 4 === 0) {\n this.isVec4 = true;\n this.type = 'vec4';\n this.workPerThread = 4;\n } else {\n this.isVec4 = false;\n this.type = 'plain';\n this.workPerThread = 1;\n }\n this.shaderKey = `binary_${this.type}_${op}`;\n // TODO(jiajia.qin@intel.com): Heuristically select a good work group\n // size.\n this.workgroupSize = [128, 1, 1];\n }\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize,\n [this.workPerThread, 1, 1]);\n }\n\n getUserCode(): string {\n let userCode;\n const dType = this.isVec4 ? 'vec4' : 'f32';\n const opFnStr = `\n fn binaryOperation(a : ${dType}, b : ${dType}) -> ${dType} {\n let isNaN = false;\n {\n ${getBinaryOpString(this.op, this.isVec4)}\n }\n };\n `;\n\n if (this.type === 'shared') {\n const sharedIndexSnippet = this.lastDimensionSize > 1 ?\n `coords[${this.outputShape.length - 1}]` :\n '0';\n const accessDataSnippet = this.useSharedMemoryWithB ?\n `let a = getAByOutputIndex(index);\n let b = sharedBuf[${sharedIndexSnippet}];` :\n `let a = sharedBuf[${sharedIndexSnippet}];\n let b = getBByOutputIndex(index);`;\n userCode = `\n ${opFnStr}\n var sharedBuf : array;\n ${main('index')} {\n // Fill in the shared memory buffer.\n let localIndex = i32(localId.x);\n if(localIndex < ${this.lastDimensionSize}) {\n sharedBuf[localIndex] = f32(${\n this.useSharedMemoryWithB ? 'B' : 'A'}[localIndex]);\n }\n workgroupBarrier();\n\n if(index < uniforms.size) {\n let coords = getCoordsFromIndex(index);\n ${accessDataSnippet}\n setOutputAtIndex(index, binaryOperation(a, b));\n }\n }\n `;\n } else {\n userCode = `\n ${opFnStr}\n ${main('index')} {\n if (index < uniforms.size) {\n let a = getAByOutputIndex(index);\n let b = getBByOutputIndex(index);\n setOutputAtIndex(index, binaryOperation(a, b));\n }\n }\n `;\n }\n\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Identity, IdentityInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\nimport {WebGPUBackend} from '../backend_webgpu';\n\nexport function identity(\n args: {inputs: IdentityInputs, backend: WebGPUBackend}): TensorInfo {\n const {inputs} = args;\n const {x} = inputs;\n\n args.backend.incRef(x.dataId);\n return {dataId: x.dataId, shape: x.shape, dtype: x.dtype};\n}\n\nexport const identityConfig: KernelConfig = {\n kernelName: Identity,\n backendName: 'webgpu',\n kernelFunc: identity as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Complex, ComplexInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {identity} from './Identity';\n\n/**\n * Complex tensors share data with their real and imaginary components. Complex\n * tensors' reference to the components is tracked by refCount on the individual\n * component. The refCounts are increased by the identity call.\n *\n * When a complex tensor is disposed, it will reduce the refCount on the\n * components by calling disposeData on each.\n */\nexport function complex(args: {inputs: ComplexInputs, backend: WebGPUBackend}):\n TensorInfo {\n const {inputs, backend} = args;\n const {real, imag} = inputs;\n\n const complexInfo = backend.makeTensorInfo(real.shape, 'complex64');\n const complex = backend.tensorMap.get(complexInfo.dataId);\n\n const realTensorInfo = identity({inputs: {x: real}, backend});\n\n const imagTensorInfo = identity({inputs: {x: imag}, backend});\n\n complex.complexTensorInfos = {real: realTensorInfo, imag: imagTensorInfo};\n\n return complexInfo;\n}\n\nexport const complexConfig: KernelConfig = {\n kernelName: Complex,\n backendName: 'webgpu',\n kernelFunc: complex as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getUnaryOpString, UnaryOpType} from './unary_op_util';\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class UnaryOpProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames = ['A'];\n workgroupSize: [number, number, number];\n op: UnaryOpType;\n uniforms?: string;\n size = true;\n\n constructor(outputShape: number[], op: UnaryOpType, uniforms = '') {\n // TODO(jiajia.qin@intel.com): Heuristically select a good work group size.\n const workgroupSizeX = 128;\n this.workgroupSize = [workgroupSizeX, 1, 1];\n this.outputShape = outputShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n this.op = op;\n if (uniforms !== '') {\n this.uniforms = uniforms;\n }\n this.shaderKey = `unary_${op}`;\n }\n\n getUserCode(): string {\n return `\n fn unaryOperation(a : f32) -> f32 {\n ${getUnaryOpString(this.op, false)}\n }\n ${main('index')} {\n if (index < uniforms.size) {\n let a = getAByOutputIndex(index);\n setOutputAtIndex(index, unaryOperation(a));\n }\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, BinaryInputs, DataType, KernelFunc, TensorInfo, TypedArray, UnaryInputs, upcastType} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {BinaryOpComplexProgram} from '../binary_op_complex_webgpu';\nimport {BinaryOpType} from '../binary_op_util';\nimport {BinaryOpProgram} from '../binary_op_webgpu';\nimport {complex} from '../kernels/Complex';\nimport {UnaryOpType} from '../unary_op_util';\nimport {UnaryOpProgram} from '../unary_op_webgpu';\n\nimport {SimpleBinaryKernelImplCPU, SimpleUnaryKernelImplCPU} from './shared';\n\ntype UnaryKernelFuncConfig = {\n opType: UnaryOpType,\n cpuKernelImpl?: SimpleUnaryKernelImplCPU,\n dtype?: DataType\n};\n\n/**\n * Template that creates a `KernelFunc` for unary ops.\n * @param opType Op type to create `UnaryOpProgram`.\n * @param cpuKernelImpl Optional. Shared functionality from tfjs-backend-cpu, it\n * will be involved when necessary.\n * @param dtype Optional. If set, the result has this dtype. Otherwise, the\n * result has the same dtype as the first input. This is mainly used in\n * comparison kernels, such as Equal, Less, Greater, etc.\n */\nexport function unaryKernelFunc(\n {opType, cpuKernelImpl, dtype}: UnaryKernelFuncConfig): KernelFunc {\n return ({inputs, backend}) => {\n const {x} = inputs as UnaryInputs;\n const webgpuBackend = backend as WebGPUBackend;\n\n const $dtype = dtype || x.dtype;\n if (webgpuBackend.shouldExecuteOnCPU([x]) && cpuKernelImpl != null) {\n const xData = webgpuBackend.tensorMap.get(x.dataId);\n const outValues = cpuKernelImpl(xData.values as TypedArray, $dtype);\n return webgpuBackend.makeTensorInfo(x.shape, $dtype, outValues);\n }\n\n const program: UnaryOpProgram = new UnaryOpProgram(x.shape, opType);\n return webgpuBackend.runWebGPUProgram(program, [x], $dtype);\n };\n}\n\ntype BinaryKernelFuncConfig = {\n opType: BinaryOpType,\n cpuKernelImpl?: SimpleBinaryKernelImplCPU,\n supportsComplex?: boolean,\n dtype?: DataType\n};\n\n/**\n * Template that creates a `KernelFunc` for binary ops.\n * @param opType Op type to create `BinaryOpProgram`.\n * @param cpuKernelImpl Optional. Shared functionality from tfjs-backend-cpu, it\n * will be involved when necessary.\n * @param dtype Optional. If set, the result has this dtype. Otherwise, the\n * result has the same dtype as the first input. This is mainly used in\n * comparison kernels, such as Equal, Less, Greater, etc.\n */\nexport function binaryKernelFunc(\n {opType, cpuKernelImpl, supportsComplex = false, dtype}:\n BinaryKernelFuncConfig): KernelFunc {\n return ({inputs, backend}) => {\n const {a, b} = inputs as BinaryInputs;\n const webgpuBackend = backend as WebGPUBackend;\n\n if (supportsComplex && a.dtype === 'complex64') {\n const aData = webgpuBackend.tensorMap.get(a.dataId);\n const bData = webgpuBackend.tensorMap.get(b.dataId);\n let real: TensorInfo, imag: TensorInfo;\n if (opType !== BinaryOpType.MUL) {\n [real, imag] = [\n [aData.complexTensorInfos.real, bData.complexTensorInfos.real],\n [aData.complexTensorInfos.imag, bData.complexTensorInfos.imag]\n ].map(complexParts => {\n const [aPart, bPart] = complexParts;\n\n const aHandle = {\n dataId: aPart.dataId,\n dtype: aPart.dtype,\n shape: a.shape\n };\n const bHandle = {\n dataId: bPart.dataId,\n dtype: bPart.dtype,\n shape: b.shape\n };\n\n const program = new BinaryOpProgram(opType, a.shape, b.shape);\n return webgpuBackend.runWebGPUProgram(\n program, [aHandle, bHandle],\n upcastType(aPart.dtype, bPart.dtype));\n });\n } else {\n const realProgram = new BinaryOpComplexProgram(\n BinaryOpType.COMPLEX_MULTIPLY_REAL, a.shape, b.shape);\n const imagProgram = new BinaryOpComplexProgram(\n BinaryOpType.COMPLEX_MULTIPLY_IMAG, a.shape, b.shape);\n\n const inputs = [\n {\n dataId: aData.complexTensorInfos.real.dataId,\n dtype: aData.complexTensorInfos.real.dtype,\n shape: a.shape\n },\n {\n dataId: aData.complexTensorInfos.imag.dataId,\n dtype: aData.complexTensorInfos.imag.dtype,\n shape: a.shape\n },\n {\n dataId: bData.complexTensorInfos.real.dataId,\n dtype: bData.complexTensorInfos.real.dtype,\n shape: b.shape\n },\n {\n dataId: bData.complexTensorInfos.imag.dataId,\n dtype: bData.complexTensorInfos.imag.dtype,\n shape: b.shape\n }\n ];\n\n real = webgpuBackend.runWebGPUProgram(realProgram, inputs, 'float32');\n imag = webgpuBackend.runWebGPUProgram(imagProgram, inputs, 'float32');\n }\n\n const complexOutput =\n complex({inputs: {real, imag}, backend: webgpuBackend});\n\n webgpuBackend.disposeData(real.dataId);\n webgpuBackend.disposeData(imag.dataId);\n\n // TODO: Implement CPU forwarding for complex inputs.\n\n return complexOutput;\n }\n\n const $dtype = dtype || upcastType(a.dtype, b.dtype);\n if ((a.dtype === 'string' || b.dtype === 'string' ||\n webgpuBackend.shouldExecuteOnCPU([a, b])) &&\n cpuKernelImpl != null) {\n const aData = webgpuBackend.tensorMap.get(a.dataId).values as TypedArray;\n const bData = webgpuBackend.tensorMap.get(b.dataId).values as TypedArray;\n const decodedAVals = a.dtype === 'string' ?\n // tslint:disable-next-line: no-any\n backend_util.fromUint8ToStringArray(aData as any as Uint8Array[]) :\n aData;\n const decodedBVals = a.dtype === 'string' ?\n // tslint:disable-next-line: no-any\n backend_util.fromUint8ToStringArray(bData as any as Uint8Array[]) :\n bData;\n const [outValues, outShape] =\n cpuKernelImpl(a.shape, b.shape, decodedAVals, decodedBVals, $dtype);\n\n return webgpuBackend.makeTensorInfo(outShape, $dtype, outValues);\n }\n const program = new BinaryOpProgram(opType, a.shape, b.shape);\n return webgpuBackend.runWebGPUProgram(program, [a, b], $dtype);\n };\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// Import shared functionality from tfjs-backend-cpu without triggering\n// side effects.\n// tslint:disable-next-line: no-imports-from-dist\nimport * as shared from '@tensorflow/tfjs-backend-cpu/dist/shared';\n// tslint:disable-next-line: no-imports-from-dist\nimport {SimpleBinaryKernelImpl} from '@tensorflow/tfjs-backend-cpu/dist/shared';\n// tslint:disable-next-line: no-imports-from-dist\nimport {SimpleUnaryImpl} from '@tensorflow/tfjs-backend-cpu/dist/utils/unary_types';\n\nexport type SimpleBinaryKernelImplCPU = SimpleBinaryKernelImpl;\nexport type SimpleUnaryKernelImplCPU = SimpleUnaryImpl;\nconst {\n addImpl: addImplCPU,\n castImpl: castImplCPU,\n ceilImpl: ceilImplCPU,\n concatImpl: concatImplCPU,\n equalImpl: equalImplCPU,\n expImpl: expImplCPU,\n expm1Impl: expm1ImplCPU,\n floorImpl: floorImplCPU,\n gatherNdImpl: gatherNdImplCPU,\n gatherV2Impl: gatherV2ImplCPU,\n greaterEqualImpl: greaterEqualImplCPU,\n greaterImpl: greaterImplCPU,\n lessEqualImpl: lessEqualImplCPU,\n lessImpl: lessImplCPU,\n logImpl: logImplCPU,\n maxImpl: maxImplCPU,\n maximumImpl: maximumImplCPU,\n minimumImpl: minimumImplCPU,\n multiplyImpl: multiplyImplCPU,\n negImpl: negImplCPU,\n notEqualImpl: notEqualImplCPU,\n prodImpl: prodImplCPU,\n rangeImpl: rangeImplCPU,\n rsqrtImpl: rsqrtImplCPU,\n scatterImpl: scatterImplCPU,\n simpleAbsImpl: simpleAbsImplCPU,\n sliceImpl: sliceImplCPU,\n stridedSliceImpl: stridedSliceImplCPU,\n stringNGramsImpl: stringNGramsImplCPU,\n subImpl: subImplCPU,\n tileImpl: tileImplCPU,\n topKImpl: topKImplCPU,\n transposeImpl: transposeImplCPU,\n uniqueImpl: uniqueImplCPU,\n} = shared;\n\nexport {\n addImplCPU,\n castImplCPU,\n ceilImplCPU,\n concatImplCPU,\n equalImplCPU,\n expImplCPU,\n expm1ImplCPU,\n floorImplCPU,\n gatherNdImplCPU,\n gatherV2ImplCPU,\n greaterEqualImplCPU,\n greaterImplCPU,\n lessEqualImplCPU,\n lessImplCPU,\n logImplCPU,\n maxImplCPU,\n maximumImplCPU,\n minimumImplCPU,\n multiplyImplCPU,\n prodImplCPU,\n negImplCPU,\n notEqualImplCPU,\n scatterImplCPU,\n simpleAbsImplCPU,\n sliceImplCPU,\n stridedSliceImplCPU,\n stringNGramsImplCPU,\n subImplCPU,\n rangeImplCPU,\n rsqrtImplCPU,\n tileImplCPU,\n topKImplCPU,\n transposeImplCPU,\n uniqueImplCPU,\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Abs, KernelConfig} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {simpleAbsImplCPU} from '../kernel_utils/shared';\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const abs =\n unaryKernelFunc({opType: UnaryOpType.ABS, cpuKernelImpl: simpleAbsImplCPU});\n\nexport const absConfig: KernelConfig = {\n kernelName: Abs,\n backendName: 'webgpu',\n kernelFunc: abs\n};\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Acos, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const acos = unaryKernelFunc({opType: UnaryOpType.ACOS});\n\nexport const acosConfig: KernelConfig = {\n kernelName: Acos,\n backendName: 'webgpu',\n kernelFunc: acos\n};\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Acosh, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const acosh = unaryKernelFunc({opType: UnaryOpType.ACOSH});\n\nexport const acoshConfig: KernelConfig = {\n kernelName: Acosh,\n backendName: 'webgpu',\n kernelFunc: acosh\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Add, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {BinaryOpType} from '../binary_op_util';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {addImplCPU as cpuAdd} from '../kernel_utils/shared';\n\nexport const addKernelFunc = binaryKernelFunc(\n {opType: BinaryOpType.ADD, cpuKernelImpl: cpuAdd, supportsComplex: true});\n\nexport const addConfig: KernelConfig = {\n kernelName: Add,\n backendName: 'webgpu',\n kernelFunc: addKernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class AddNPackedProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames: string[];\n workPerThread = 1;\n workgroupSize: [number, number, number] = [64, 1, 1];\n size = true;\n\n constructor(shapes: number[][]) {\n this.outputShape = shapes[0];\n this.variableNames = shapes.map((_, i) => `T${i}`);\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize,\n [this.workPerThread, 1, 1]);\n this.shaderKey = 'addN';\n }\n\n getUserCode(): string {\n const snippets: string[] = [];\n // Get target elements from every input tensor.\n this.variableNames.forEach(variable => {\n snippets.push(`let v${variable} = get${variable}ByOutputCoords(coords);`);\n });\n // Calculate the sum of all elements.\n const operation = this.variableNames\n .map(variable => {\n return `v${variable}`;\n })\n .join(' + ');\n\n const userCode = `\n ${main('index')} {\n for (var i = 0; i < ${this.workPerThread}; i = i + 1) {\n let flatIndex = index * ${this.workPerThread} + i;\n if (flatIndex < uniforms.size) {\n let coords = getCoordsFromIndex(flatIndex);\n ${snippets.join('\\n ')}\n setOutputAtIndex(flatIndex, ${operation});\n }\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {AddN, AddNInputs, KernelConfig, KernelFunc, TensorInfo, upcastType} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\n\nimport {AddNPackedProgram} from '../addn_packed_webgpu';\nimport {identity} from './Identity';\n\nexport function addN(args: {inputs: AddNInputs, backend: WebGPUBackend}):\n TensorInfo {\n const {inputs, backend} = args;\n\n const tensors = inputs;\n if (tensors.length === 1) {\n return identity({inputs: {x: tensors[0]}, backend});\n }\n\n const dtype =\n tensors.map(t => t.dtype).reduce((d1, d2) => upcastType(d1, d2));\n const shapes = tensors.map(t => t.shape);\n const program = new AddNPackedProgram(shapes);\n return backend.runWebGPUProgram(program, tensors, dtype);\n}\n\nexport const addNConfig: KernelConfig = {\n kernelName: AddN,\n backendName: 'webgpu',\n kernelFunc: addN as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {util} from '@tensorflow/tfjs-core';\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch} from './webgpu_util';\n\nexport class TransposeSharedProgram implements WebGPUProgram {\n variableNames = ['A'];\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[], y: number[]};\n dispatch: [number, number, number];\n // Note that the maximum number of workgroup invocations by webgpu is 256.\n workgroupSize: [number, number, number] = [16, 16, 1];\n\n constructor(aShape: number[], newDim: number[]) {\n const outputShape: number[] = new Array(aShape.length);\n for (let i = 0; i < outputShape.length; i++) {\n outputShape[i] = aShape[newDim[i]];\n }\n this.outputShape = outputShape;\n this.dispatchLayout = {x: [0], y: [1]};\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize, [1, 1, 1]);\n\n this.shaderKey = 'transposeShared';\n }\n\n getUserCode(): string {\n util.assert(\n this.workgroupSize[0] === this.workgroupSize[1],\n () => `Must be a square tile, current tile shape is ${\n this.workgroupSize[0]} x ${this.workgroupSize[1]}`);\n const tileSize = this.workgroupSize[0];\n const userCode = `\n var tile : array, ${\n this.workgroupSize[0]}>;\n ${main()} {\n var x = i32(workgroupId.x) * ${tileSize} + i32(localId.x);\n var y = i32(workgroupId.y) * ${tileSize} + i32(localId.y);\n let width = uniforms.outShape[0];\n let height = uniforms.outShape[1];\n if (x < width && y < height) {\n tile[localId.y][localId.x] = f32(A[y * width + x]);\n }\n workgroupBarrier();\n\n x = i32(workgroupId.y) * ${tileSize} + i32(localId.x);\n y = i32(workgroupId.x) * ${tileSize} + i32(localId.y);\n if (x < height && y < width) {\n setOutputAtIndex((y * height + x), tile[localId.x]\n [localId.y]);\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getCoordsDataType, getCoordsXYZ, getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class TransposeProgram implements WebGPUProgram {\n variableNames = ['A'];\n shaderKey: string;\n outputShape: number[];\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n workPerThread = 1;\n workgroupSize: [number, number, number] = [64, 1, 1];\n newDim: number[];\n size = true;\n\n constructor(aShape: number[], newDim: number[]) {\n const outputShape: number[] = new Array(aShape.length);\n for (let i = 0; i < outputShape.length; i++) {\n outputShape[i] = aShape[newDim[i]];\n }\n this.outputShape = outputShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize,\n [this.workPerThread, 1, 1]);\n\n this.newDim = newDim;\n this.shaderKey = `transpose_${newDim}`;\n }\n\n getUserCode(): string {\n const dtype = getCoordsDataType(this.outputShape.length);\n const switched = getSwitchedCoords(this.newDim);\n\n const userCode = `\n ${main('index')} {\n for(var i = 0; i < ${this.workPerThread}; i = i + 1) {\n let flatIndex = index * ${this.workPerThread} + i;\n if(flatIndex < uniforms.size) {\n let resRC = getCoordsFromIndex(flatIndex);\n setOutputAtIndex(flatIndex, A[getIndexFromCoords${\n this.outputShape.length}D(\n ${dtype}(${switched}), uniforms.aShape)]);\n }\n }\n }\n `;\n return userCode;\n }\n}\n\nfunction getSwitchedCoords(newDim: number[]): string {\n const rank = newDim.length;\n if (rank > 6) {\n throw Error(`Transpose for rank ${rank} is not yet supported`);\n }\n const switchedCoords = new Array(rank);\n for (let i = 0; i < newDim.length; i++) {\n switchedCoords[newDim[i]] = `resRC.${getCoordsXYZ(i)}`;\n }\n\n return switchedCoords.join();\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Transpose, TransposeAttrs, TransposeInputs, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {transposeImplCPU as cpuTranspose} from '../kernel_utils/shared';\n\nimport {TransposeSharedProgram} from '../transpose_shared_webgpu';\nimport {TransposeProgram} from '../transpose_webgpu';\n\nexport function transpose(args: {\n inputs: TransposeInputs,\n attrs: TransposeAttrs,\n backend: WebGPUBackend\n}) {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {perm} = attrs;\n const webgpuBackend = backend;\n\n const xRank = x.shape.length;\n const newShape: number[] = new Array(xRank);\n for (let i = 0; i < newShape.length; i++) {\n newShape[i] = x.shape[perm[i]];\n }\n if (backend.shouldExecuteOnCPU([x])) {\n const xData = webgpuBackend.tensorMap.get(x.dataId);\n const values = xData.values as TypedArray;\n const outValues = cpuTranspose(values, x.shape, x.dtype, perm, newShape);\n return backend.makeTensorInfo(newShape, x.dtype, outValues);\n }\n if (x.shape.length === 2 && util.arraysEqual(perm, [1, 0])) {\n const program = new TransposeSharedProgram(x.shape, perm);\n return webgpuBackend.runWebGPUProgram(program, [x], x.dtype);\n }\n const program = new TransposeProgram(x.shape, perm);\n return webgpuBackend.runWebGPUProgram(program, [x], x.dtype);\n}\n\nexport const transposeConfig: KernelConfig = {\n kernelName: Transpose,\n backendName: 'webgpu',\n kernelFunc: transpose as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class ReduceProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n workgroupSize: [number, number, number] = [64, 1, 1];\n variableNames = ['x'];\n uniforms = 'reduceSize : i32,';\n reduceType: 'all'|'any'|'max'|'mean'|'min'|'prod'|'sum';\n inputShape: number[];\n size = true;\n\n constructor(\n reduceInfo: backend_util.ReduceInfo,\n reduceType: 'all'|'any'|'max'|'mean'|'min'|'prod'|'sum') {\n this.inputShape = [reduceInfo.batchSize, reduceInfo.inSize];\n const [outputShape, ] =\n backend_util.computeOutAndReduceShapes(this.inputShape, [1]);\n this.outputShape = outputShape.length === 0 ? [1] : outputShape;\n\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n // A work group only outputs a data, so we transfer [1, 1, 1] to compute\n // dispatch size.\n this.dispatch =\n computeDispatch(this.dispatchLayout, this.outputShape, [1, 1, 1]);\n\n this.reduceType = reduceType;\n this.shaderKey = `reduce_${reduceType}`;\n }\n\n getUserCode(): string {\n let reduceOp = ``;\n let initValue = '0.0';\n const workgroupSizeX = this.workgroupSize[0];\n if (this.reduceType === 'min' || this.reduceType === 'max') {\n reduceOp = `\n if (isnan(candidate)) {\n bestValue = uniforms.NAN;\n } else if (!isnan(bestValue) && candidate ${\n this.reduceType === 'min' ? '<' : '>'} bestValue)\n { bestValue = candidate; }`;\n initValue = 'f32(x[offset])';\n } else if (this.reduceType === 'sum' || this.reduceType === 'mean') {\n reduceOp = ' bestValue = bestValue + candidate; ';\n } else if (this.reduceType === 'prod') {\n reduceOp = ' bestValue = bestValue * candidate; ';\n initValue = '1.0';\n } else if (this.reduceType === 'all') {\n reduceOp = ' bestValue = f32(bestValue >= 1.0 && candidate >= 1.0); ';\n initValue = '1.0';\n } else if (this.reduceType === 'any') {\n reduceOp = ' bestValue = f32(bestValue >= 1.0 || candidate >= 1.0); ';\n initValue = '0.0';\n }\n\n const outputSnippet = this.reduceType === 'mean' ?\n // tslint:disable-next-line:max-line-length\n `setOutputAtIndex(outputIndex, bestValue / f32(uniforms.reduceSize));` :\n `setOutputAtIndex(outputIndex, bestValue);`;\n\n const sharedMemorySnippet = `\n var xBestValues : array;\n `;\n\n const userCode = `\n fn DIV_CEIL(a : u32, b : u32) -> u32 {\n return ((a - 1u) / b + 1u);\n }\n\n ${sharedMemorySnippet}\n fn getOffset(outputIndex : i32) -> i32 {\n let outputCoords = getCoordsFromIndex(outputIndex);\n let offset = ${\n this.outputShape.length === 1 ?\n 'outputCoords' :\n 'outputCoords[0]'} * uniforms.reduceSize;\n return offset;\n }\n ${main('index')} {\n let outputIndex = index / ${workgroupSizeX};\n let offset = getOffset(outputIndex);\n var bestValue = ${initValue};\n let Length = uniforms.reduceSize;\n let WorkPerThread = DIV_CEIL(u32(Length), ${workgroupSizeX}u);\n for (var k = i32(localId.x); k < Length && outputIndex < uniforms.size;\n k = k + ${workgroupSizeX}) {\n let candidate = f32(x[offset + k]);\n ${reduceOp}\n }\n xBestValues[localId.x] = bestValue;\n workgroupBarrier();\n\n var reduceSize = min(u32(Length), ${workgroupSizeX}u);\n for (var currentSize = reduceSize / 2u; reduceSize > 1u;\n currentSize = reduceSize / 2u) {\n let interval = DIV_CEIL(reduceSize, 2u);\n if (localId.x < currentSize) {\n let candidate = xBestValues[localId.x + interval];\n ${reduceOp}\n xBestValues[localId.x] = bestValue;\n }\n reduceSize = interval;\n workgroupBarrier();\n }\n\n if (localId.x == 0u && outputIndex < uniforms.size) {\n ${outputSnippet}\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, sumOutType, TensorInfo, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {reshape} from '../kernels/Reshape';\nimport {transpose} from '../kernels/Transpose';\nimport {ReduceProgram} from '../reduce_webgpu';\n\nimport {maxImplCPU} from './shared';\nimport {prodImplCPU} from './shared';\n\ntype ReduceTypes = 'all'|'any'|'max'|'mean'|'min'|'prod'|'sum';\n\nexport function reduce(\n x: TensorInfo, axis: number|number[], keepDims: boolean,\n reduceType: ReduceTypes, backend: WebGPUBackend): TensorInfo {\n const xRank = x.shape.length;\n const toDispose = [];\n\n const origAxes = util.parseAxisParam(axis, x.shape);\n let axes = origAxes;\n const permutedAxes = backend_util.getAxesPermutation(axes, xRank);\n\n let input = x;\n if (permutedAxes != null) {\n input = transpose({inputs: {x}, attrs: {perm: permutedAxes}, backend});\n axes = backend_util.getInnerMostAxes(axes.length, xRank);\n toDispose.push(input);\n }\n\n backend_util.assertAxesAreInnerMostDims(reduceType, axes, xRank);\n\n const [reduceOutShape, reduceShape] =\n backend_util.computeOutAndReduceShapes(input.shape, axes);\n let resOutShape = reduceOutShape;\n if (keepDims) {\n // rather than reshape at the end, set the target shape here.\n resOutShape = backend_util.expandShapeToKeepDim(reduceOutShape, origAxes);\n }\n\n let res;\n if ((reduceType === 'max' || reduceType === 'prod') &&\n backend.shouldExecuteOnCPU([input])) {\n const xVals = backend.tensorMap.get(input.dataId).values as TypedArray;\n switch (reduceType) {\n case 'max':\n const outValues = maxImplCPU(\n xVals, util.sizeFromShape(reduceShape), resOutShape, x.dtype);\n res = backend.makeTensorInfo(resOutShape, x.dtype, outValues);\n break;\n case 'prod':\n const {outVals, outShape, outDtype} =\n prodImplCPU(input.shape, input.dtype, xVals, axes);\n res = backend.makeTensorInfo(outShape, outDtype, outVals);\n break;\n default:\n throw new Error(\n `${reduceType} CPU implementation is not yet supported.`);\n }\n } else {\n const inSize = util.sizeFromShape(reduceShape);\n const xSize = util.sizeFromShape(input.shape);\n const batchSize = xSize / inSize;\n\n const reduceInfo = {windowSize: inSize, inSize, batchSize, outSize: 1};\n const dtype = reduceType === 'mean' ? 'float32' : sumOutType(x.dtype);\n const uniformData = [\n {type: 'int32', data: [inSize]},\n ];\n const program = new ReduceProgram(reduceInfo, reduceType);\n const reduced =\n backend.runWebGPUProgram(program, [input], dtype, uniformData);\n toDispose.push(reduced);\n\n res = reshape({inputs: {x: reduced}, attrs: {shape: resOutShape}, backend});\n }\n\n toDispose.forEach(t => backend.disposeData(t.dataId));\n\n return res;\n}\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {All, AllAttrs, AllInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {reduce} from '../kernel_utils/reduce';\n\nexport function all(\n args: {inputs: AllInputs, attrs: AllAttrs, backend: WebGPUBackend}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {keepDims, axis} = attrs;\n\n return reduce(x, axis, keepDims, 'all', backend);\n}\n\nexport const allConfig: KernelConfig = {\n kernelName: All,\n backendName: 'webgpu',\n kernelFunc: all as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Any, AnyAttrs, AnyInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {reduce} from '../kernel_utils/reduce';\n\nexport function any(\n args: {inputs: AnyInputs, attrs: AnyAttrs, backend: WebGPUBackend}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {keepDims, axis} = attrs;\n\n return reduce(x, axis, keepDims, 'any', backend);\n}\n\nexport const anyConfig: KernelConfig = {\n kernelName: Any,\n backendName: 'webgpu',\n kernelFunc: any as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, util} from '@tensorflow/tfjs-core';\nimport {getCoordsXYZ, getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class ArgMinMaxProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n workgroupSize: [number, number, number] = [64, 1, 1];\n variableNames = ['x'];\n uniforms = 'infinityValue : f32,';\n inputShape: number[];\n reductionFactor: number;\n op: string;\n size = true;\n private type: string;\n\n constructor(inputShape: number[], axis: number, reduceType: 'min'|'max') {\n const axes = [axis];\n\n this.op = reduceType === 'min' ? '<' : '>';\n\n // |outShape| is the shape with the removed axis\n const [outputShape, reduceShape] =\n backend_util.computeOutAndReduceShapes(inputShape, axes);\n\n this.outputShape = outputShape.length === 0 ? [1] : outputShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n // The shared algorithm is mainly used for large reduce size. It fully\n // utilizes the threads in one workgroup to do the reduction. However,\n // when the reduce size is very small or the output shape is too large. It's\n // better to use the plain algorithm to reduce the number of workgroups to\n // speedup. The threthold can be further tuned.\n if (util.sizeFromShape(reduceShape) < 32 ||\n util.sizeFromShape(outputShape) > 1000) {\n this.type = 'plain';\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n } else {\n this.type = 'shared';\n // A work group only outputs a data, so we transfer [1, 1, 1] to compute\n // dispatch size.\n this.dispatch =\n computeDispatch(this.dispatchLayout, this.outputShape, [1, 1, 1]);\n }\n\n this.inputShape = inputShape;\n this.shaderKey = `argMinMax_${this.op}_${this.type}`;\n }\n\n getUserCode(): string {\n const workgroupSizeX = this.workgroupSize[0];\n const getInputShapeLastDim = () => {\n if (this.inputShape.length === 1) {\n return 'uniforms.xShape';\n } else {\n return `uniforms.xShape.${getCoordsXYZ(this.inputShape.length - 1)}`;\n }\n };\n\n const splitOutputCoords = () => {\n let snippet = '';\n if (this.outputShape.length === 1) {\n if (this.inputShape.length !== 1) {\n snippet += 'outputCoords,';\n }\n } else {\n for (let i = 0; i < this.outputShape.length; i++) {\n snippet += `outputCoords.${getCoordsXYZ(i)},`;\n }\n }\n return snippet;\n };\n\n if (this.type === 'shared') {\n const sharedMemorySnippet = `\n var xBestIndices : array;\n var xBestValues : array;\n `;\n const userCode = `\n fn DIV_CEIL(a : u32, b : u32) -> u32 {\n return ((a - 1u) / b + 1u);\n }\n\n ${sharedMemorySnippet}\n\n ${main('index')} {\n let outputIndex = index / ${workgroupSizeX};\n let reduceLength = ${getInputShapeLastDim()};\n\n var bestIndex = i32(localId.x);\n var bestValue = uniforms.infinityValue;\n let outputCoords = getCoordsFromIndex(outputIndex);\n for (var k = i32(localId.x); k < reduceLength && outputIndex < uniforms.size;\n k = k + ${workgroupSizeX}) {\n let candidate = getX(${splitOutputCoords()} k);\n if (!isnan(candidate) && candidate ${this.op} bestValue) {\n bestValue = candidate;\n bestIndex = k;\n }\n }\n xBestValues[localId.x] = bestValue;\n xBestIndices[localId.x] = bestIndex;\n workgroupBarrier();\n\n var reduceSize = min(u32(reduceLength), ${workgroupSizeX}u);\n for (var currentSize = reduceSize / 2u; reduceSize > 1u;\n currentSize = reduceSize / 2u) {\n let interval = DIV_CEIL(reduceSize, 2u);\n if (localId.x < currentSize) {\n let candidate = xBestValues[localId.x + interval];\n if (candidate ${this.op} bestValue) {\n bestValue = candidate;\n xBestValues[localId.x] = bestValue;\n xBestIndices[localId.x] = xBestIndices[localId.x + interval];\n }\n }\n reduceSize = interval;\n workgroupBarrier();\n }\n\n if (localId.x == 0u && outputIndex < uniforms.size) {\n setOutputAtIndexI32(outputIndex, xBestIndices[localId.x]);\n }\n }\n `;\n return userCode;\n } else {\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n let outputCoords = getCoordsFromIndex(index);\n var bestIndex = 0;\n var bestValue = getX(${splitOutputCoords()} 0);\n let reduceLength = ${getInputShapeLastDim()};\n for (var i = 1; i < reduceLength; i++) {\n let candidate = getX(${splitOutputCoords()} i);\n if (candidate ${this.op} bestValue) {\n bestValue = candidate;\n bestIndex = i;\n }\n }\n setOutputAtIndexI32(index, bestIndex);\n }\n }\n `;\n return userCode;\n }\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ArgMax, ArgMaxAttrs, ArgMaxInputs, backend_util, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {ArgMinMaxProgram} from '../argminmax_webgpu';\nimport {WebGPUBackend} from '../backend_webgpu';\n\nimport {transpose} from './Transpose';\n\nexport function argMax(\n args: {inputs: ArgMaxInputs, backend: WebGPUBackend, attrs: ArgMaxAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {axis} = attrs;\n\n let axes = util.parseAxisParam(axis, x.shape);\n const permutedAxes = backend_util.getAxesPermutation(axes, x.shape.length);\n let $x = x;\n const intermediateTensorInfos = [];\n if (permutedAxes != null) {\n $x = transpose({inputs: {x}, backend, attrs: {perm: permutedAxes}});\n intermediateTensorInfos.push($x);\n axes = backend_util.getInnerMostAxes(axes.length, $x.shape.length);\n }\n\n backend_util.assertAxesAreInnerMostDims('argMax', [axes[0]], $x.shape.length);\n const program = new ArgMinMaxProgram($x.shape, axes[0], 'max');\n const uniformData = [{type: 'float32', data: [Number.NEGATIVE_INFINITY]}];\n const out = backend.runWebGPUProgram(program, [$x], 'int32', uniformData);\n intermediateTensorInfos.forEach(t => backend.disposeData(t.dataId));\n return out;\n}\n\nexport const argMaxConfig: KernelConfig = {\n kernelName: ArgMax,\n backendName: 'webgpu',\n kernelFunc: argMax as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ArgMin, ArgMinAttrs, ArgMinInputs, backend_util, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {ArgMinMaxProgram} from '../argminmax_webgpu';\nimport {WebGPUBackend} from '../backend_webgpu';\n\nimport {transpose} from './Transpose';\n\nexport function argMin(\n args: {inputs: ArgMinInputs, backend: WebGPUBackend, attrs: ArgMinAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {axis} = attrs;\n\n let axes = util.parseAxisParam(axis, x.shape);\n const permutedAxes = backend_util.getAxesPermutation(axes, x.shape.length);\n let $x = x;\n const intermediateTensorInfos = [];\n if (permutedAxes != null) {\n $x = transpose({inputs: {x}, backend, attrs: {perm: permutedAxes}});\n intermediateTensorInfos.push($x);\n axes = backend_util.getInnerMostAxes(axes.length, $x.shape.length);\n }\n\n backend_util.assertAxesAreInnerMostDims('argMin', [axes[0]], $x.shape.length);\n const program = new ArgMinMaxProgram($x.shape, axes[0], 'min');\n const uniformData = [{type: 'float32', data: [Number.POSITIVE_INFINITY]}];\n const out = backend.runWebGPUProgram(program, [$x], 'int32', uniformData);\n intermediateTensorInfos.forEach(t => backend.disposeData(t.dataId));\n return out;\n}\n\nexport const argMinConfig: KernelConfig = {\n kernelName: ArgMin,\n backendName: 'webgpu',\n kernelFunc: argMin as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Asin, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const asin = unaryKernelFunc({opType: UnaryOpType.ASIN});\n\nexport const asinConfig: KernelConfig = {\n kernelName: Asin,\n backendName: 'webgpu',\n kernelFunc: asin\n};\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Asinh, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const asinh = unaryKernelFunc({opType: UnaryOpType.ASINH});\n\nexport const asinhConfig: KernelConfig = {\n kernelName: Asinh,\n backendName: 'webgpu',\n kernelFunc: asinh\n};\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Atan, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const atan = unaryKernelFunc({opType: UnaryOpType.ATAN});\n\nexport const atanConfig: KernelConfig = {\n kernelName: Atan,\n backendName: 'webgpu',\n kernelFunc: atan\n};\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Atan2, KernelConfig} from '@tensorflow/tfjs-core';\nimport {BinaryOpType} from '../binary_op_util';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nexport const atan2 = binaryKernelFunc({opType: BinaryOpType.ATAN2});\n\nexport const atan2Config: KernelConfig = {\n kernelName: Atan2,\n backendName: 'webgpu',\n kernelFunc: atan2\n};\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Atanh, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const atanh = unaryKernelFunc({opType: UnaryOpType.ATANH});\n\nexport const atanhConfig: KernelConfig = {\n kernelName: Atanh,\n backendName: 'webgpu',\n kernelFunc: atanh\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class Pool2DProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames = ['x'];\n uniforms =\n `stride : vec2, pad : vec2, dilation : vec2, convDims : vec2, filterDims : vec2,`;\n // TODO(jiajia.qin@intel.com): Dynamically choose different workgroupSize for\n // different output shapes.\n workgroupSize: [number, number, number] = [128, 1, 1];\n poolType: 'max'|'avg';\n size = true;\n\n constructor(convInfo: backend_util.Conv2DInfo, poolType: 'max'|'avg') {\n this.outputShape = convInfo.outShape;\n\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n\n this.shaderKey = `pool2D_${poolType}`;\n this.poolType = poolType;\n }\n\n getUserCode(): string {\n let updateSnippet = `resultValue = max(value, resultValue);`;\n if (this.poolType === 'avg') {\n updateSnippet = `resultValue = resultValue + value; count = count + 1.0;`;\n }\n\n let returnValue = `resultValue`;\n if (this.poolType === 'avg') {\n returnValue = `resultValue / max(count, 1.0)`;\n }\n\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n let coords = getCoordsFromIndex(index);\n let batch = coords[0];\n let xRCCorner = vec2(coords.yz) * uniforms.stride - uniforms.pad;\n let xRCorner = xRCCorner.x;\n let xCCorner = xRCCorner.y;\n\n var resultValue = ${\n this.poolType === 'avg' ? '0.0' : '-1.0 / pow(10.0, -20.0)'};\n var count = 0.0;\n\n for (var wR = 0; wR < uniforms.filterDims.x; wR = wR + uniforms.dilation.x) {\n let xR = xRCorner + wR;\n\n if (xR < 0 || xR >= uniforms.convDims.x) {\n continue;\n }\n\n for (var wC = 0; wC < uniforms.filterDims.y; wC = wC + uniforms.dilation.y) {\n let xC = xCCorner + wC;\n if (xC < 0 || xC >= uniforms.convDims.y) {\n continue;\n }\n\n let value = getX(batch, xR, xC, coords[3]);\n ${updateSnippet}\n }\n }\n\n setOutputAtIndex(index, ${returnValue});\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class PoolWithFilterSizeEqualsOneProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames = ['x'];\n uniforms = `stride : vec2,`;\n workgroupSize: [number, number, number] = [256, 1, 1];\n size = true;\n\n constructor(convInfo: backend_util.Conv2DInfo) {\n this.outputShape = convInfo.outShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n\n this.shaderKey = 'poolWithFilterSizeEqualsOne';\n }\n\n getUserCode(): string {\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n let coords = getCoordsFromIndex(index);\n let batch = coords[0];\n let d = coords[3];\n\n let xRCCorner = coords.yz * uniforms.stride;\n let xRCorner = xRCCorner.x;\n let xCCorner = xRCCorner.y;\n\n let value = getX(batch, xRCorner, xCCorner, d);\n setOutputAtIndex(index, value);\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Max, MaxAttrs, MaxInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {reduce} from '../kernel_utils/reduce';\n\nexport function max(\n args: {inputs: MaxInputs, backend: WebGPUBackend, attrs: MaxAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {reductionIndices, keepDims} = attrs;\n\n return reduce(x, reductionIndices, keepDims, 'max', backend);\n}\n\nexport const maxConfig: KernelConfig = {\n kernelName: Max,\n backendName: 'webgpu',\n kernelFunc: max as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Mean, MeanAttrs, MeanInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {reduce} from '../kernel_utils/reduce';\n\nexport function mean(\n args: {inputs: MeanInputs, attrs: MeanAttrs, backend: WebGPUBackend}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {keepDims, axis} = attrs;\n\n return reduce(x, axis, keepDims, 'mean', backend);\n}\n\nexport const meanConfig: KernelConfig = {\n kernelName: Mean,\n backendName: 'webgpu',\n kernelFunc: mean as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {backend_util, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {Pool2DProgram} from '../pool2d_webgpu';\nimport {PoolWithFilterSizeEqualsOneProgram} from '../pool_filtersizeone_webgpu';\n\nimport {identity} from './Identity';\nimport {max} from './Max';\nimport {mean} from './Mean';\nimport {reshape} from './Reshape';\n\ntype PoolType = 'max'|'avg';\nexport function poolImpl(\n x: TensorInfo, convInfo: backend_util.Conv2DInfo, poolType: PoolType,\n backend: WebGPUBackend): TensorInfo {\n if (convInfo.filterWidth === 1 && convInfo.filterHeight === 1 &&\n util.arraysEqual(convInfo.inShape, convInfo.outShape)) {\n return identity({inputs: {x}, backend});\n }\n\n if (convInfo.filterWidth === convInfo.inWidth &&\n convInfo.filterHeight === convInfo.inHeight && convInfo.batchSize === 1 &&\n convInfo.padInfo.type === 'VALID') {\n const length = x.shape.length;\n const reshapeX = reshape({\n inputs: {x},\n backend,\n attrs: {\n shape: [\n x.shape[length - 3] * x.shape[length - 2] /* height * width */,\n x.shape[length - 1] /* channel */\n ]\n }\n });\n let reduceX;\n if (poolType === 'avg') {\n reduceX = mean(\n {inputs: {x: reshapeX}, backend, attrs: {axis: 0, keepDims: false}});\n } else {\n util.assert(poolType === 'max', () => `Invalid pool type ${poolType}`);\n reduceX = max({\n inputs: {x: reshapeX},\n backend,\n attrs: {reductionIndices: 0, keepDims: false}\n });\n }\n\n const result = reshape(\n {inputs: {x: reduceX}, backend, attrs: {shape: convInfo.outShape}});\n backend.disposeData(reshapeX.dataId);\n backend.disposeData(reduceX.dataId);\n return result;\n }\n\n let program: Pool2DProgram|PoolWithFilterSizeEqualsOneProgram;\n const dimensions =\n [{type: 'int32', data: [convInfo.strideHeight, convInfo.strideWidth]}];\n if (convInfo.filterHeight === 1 && convInfo.filterWidth === 1) {\n program = new PoolWithFilterSizeEqualsOneProgram(convInfo);\n } else {\n if (poolType === 'avg') {\n program = new Pool2DProgram(convInfo, 'avg');\n } else {\n util.assert(poolType === 'max', () => `Invalid pool type ${poolType}`);\n program = new Pool2DProgram(convInfo, 'max');\n }\n\n dimensions.push(\n {type: 'int32', data: [convInfo.padInfo.top, convInfo.padInfo.left]}, {\n type: 'int32',\n data: [convInfo.dilationHeight, convInfo.dilationWidth]\n },\n {type: 'int32', data: [convInfo.inHeight, convInfo.inWidth]}, {\n type: 'int32',\n data: [convInfo.effectiveFilterHeight, convInfo.effectiveFilterWidth]\n });\n }\n\n return backend.runWebGPUProgram(program, [x], x.dtype, dimensions);\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {AvgPool, AvgPoolAttrs, AvgPoolInputs, backend_util, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {poolImpl} from './Pool_impl';\n\nexport function avgPool(\n args: {inputs: AvgPoolInputs, backend: WebGPUBackend, attrs: AvgPoolAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {filterSize, strides, pad, dimRoundingMode} = attrs;\n const dilations = 1;\n const convInfo = backend_util.computePool2DInfo(\n x.shape as [number, number, number, number], filterSize, strides,\n dilations, pad, dimRoundingMode);\n\n return poolImpl(x, convInfo, 'avg', backend);\n}\n\nexport const avgPoolConfig: KernelConfig = {\n kernelName: AvgPool,\n backendName: 'webgpu',\n kernelFunc: avgPool as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class AvgPool2DBackpropProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames = ['dy'];\n uniforms =\n `stride : vec2, pads : vec2, dilation : vec2, filterDims : vec2,\n outHeight : i32, outWidth : i32, avgMultiplier : f32,`;\n workgroupSize: [number, number, number] = [64, 1, 1];\n size = true;\n\n constructor(convInfo: backend_util.Conv2DInfo) {\n this.outputShape = convInfo.inShape;\n\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n\n this.shaderKey = `avg_pool2d_backprop`;\n }\n\n getUserCode(): string {\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n let coords = getCoordsFromIndex(index);\n let batch = coords[0];\n let d = coords[3];\n\n let dyRCCorner = vec2(coords.yz) - uniforms.pads;\n let dyRCorner = dyRCCorner.x;\n let dyCCorner = dyRCCorner.y;\n\n // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).\n // ? = to be determined. : = across all values in that axis.\n var dotProd = 0.0;\n for (var wR = 0; wR < uniforms.filterDims[0]; wR = wR + uniforms.dilation[0]) {\n let dyR = f32(dyRCorner + wR) / f32(uniforms.stride[0]);\n\n if (dyR < 0.0 || dyR >= f32(uniforms.outHeight) || fract(dyR) > 0.0) {\n continue;\n }\n let idyR = i32(dyR);\n\n for (var wC = 0; wC < uniforms.filterDims[1]; wC = wC + uniforms.dilation[1]) {\n let dyC = f32(dyCCorner + wC) / f32(uniforms.stride[1]);\n\n if (dyC < 0.0 || dyC >= f32(uniforms.outWidth) || fract(dyC) > 0.0) {\n continue;\n }\n let idyC = i32(dyC);\n\n let dyValue = getDy(batch, idyR, idyC, d);\n\n dotProd = dotProd + dyValue * uniforms.avgMultiplier;\n }\n }\n setOutputAtIndex(index, dotProd);\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {AvgPoolGrad, AvgPoolGradAttrs, AvgPoolGradInputs, backend_util, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {AvgPool2DBackpropProgram} from '../avg_pool2d_backprop_webgpu';\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {assertNotComplex} from '../webgpu_util';\n\nexport function avgPoolGrad(args: {\n inputs: AvgPoolGradInputs,\n backend: WebGPUBackend,\n attrs: AvgPoolGradAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {dy, input} = inputs;\n const x = input;\n assertNotComplex([dy, input], 'avgPoolGrad');\n const {filterSize, strides, pad} = attrs;\n\n const convInfo = backend_util.computePool2DInfo(\n x.shape as [number, number, number, number], filterSize, strides,\n 1 /* dilations */, pad);\n const program = new AvgPool2DBackpropProgram(convInfo);\n const avgMultiplier = 1 / (convInfo.filterHeight * convInfo.filterWidth);\n const uniformData = [\n {type: 'int32', data: [convInfo.strideHeight, convInfo.strideWidth]}, {\n type: 'int32',\n data: [\n convInfo.effectiveFilterHeight - 1 - convInfo.padInfo.top,\n convInfo.effectiveFilterWidth - 1 - convInfo.padInfo.left\n ]\n },\n {type: 'int32', data: [convInfo.dilationHeight, convInfo.dilationWidth]}, {\n type: 'int32',\n data: [convInfo.effectiveFilterHeight, convInfo.effectiveFilterWidth]\n },\n {type: 'int32', data: [convInfo.outHeight]},\n {type: 'int32', data: [convInfo.outWidth]},\n {type: 'float32', data: [avgMultiplier]}\n ];\n return backend.runWebGPUProgram(program, [dy], x.dtype, uniformData);\n}\n\nexport const avgPoolGradConfig: KernelConfig = {\n kernelName: AvgPoolGrad,\n backendName: 'webgpu',\n kernelFunc: avgPoolGrad as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {BatchMatMul, BatchMatMulAttrs, BatchMatMulInputs, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {batchMatMulImpl} from './BatchMatMul_impl';\n\nexport function batchMatMul(args: {\n inputs: BatchMatMulInputs,\n attrs: BatchMatMulAttrs,\n backend: WebGPUBackend\n}) {\n const {inputs, backend, attrs} = args;\n const {a, b} = inputs;\n const {transposeA, transposeB} = attrs;\n\n return batchMatMulImpl({a, b, transposeA, transposeB, backend});\n}\n\nexport const batchMatMulConfig: KernelConfig = {\n kernelName: BatchMatMul,\n backendName: 'webgpu',\n kernelFunc: batchMatMul as unknown as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getCoordsDataType, getCoordsXYZ, getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class SliceProgram implements WebGPUProgram {\n variableNames = ['source'];\n uniforms: string;\n outputShape: number[];\n shaderKey: string;\n rank: number;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n workPerThread = 1;\n workgroupSize: [number, number, number] = [64, 1, 1];\n start: number[];\n size = true;\n\n constructor(start: number[], destSize: number[]) {\n this.outputShape = destSize;\n this.rank = destSize.length;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize,\n [this.workPerThread, 1, 1]);\n\n this.start = start;\n this.uniforms = `start : ${getCoordsDataType(start.length)}, `;\n this.shaderKey = 'slice';\n }\n\n getUserCode(): string {\n const dtype = getCoordsDataType(this.rank);\n const sourceCoords = getCoords(this.rank);\n let coordSum;\n if (this.start.length === 1) {\n coordSum = this.outputShape.map((_, i) => {\n return `sourceLoc = uniforms.start + coords;`;\n });\n } else {\n coordSum = this.outputShape.map((_, i) => {\n return `sourceLoc.${coords[i]} = uniforms.start.${\n getCoordsXYZ(i)} + coords.${coords[i]};`;\n });\n }\n\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n var sourceLoc : ${dtype};\n let coords = getCoordsFromIndex(index);\n ${coordSum.join('\\n')}\n setOutputAtIndex(index, getSource(${sourceCoords}));\n }\n }\n `;\n return userCode;\n }\n}\n\nconst coords = ['x', 'y', 'z', 'w', 'u', 'v'];\n\nfunction getCoords(rank: number): string {\n if (rank === 1) {\n return 'sourceLoc';\n } else if (rank <= 6) {\n return coords.slice(0, rank).map(coord => `sourceLoc.${coord}`).join(',');\n } else {\n throw Error(`Slicing for rank ${rank} is not yet supported`);\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Slice, slice_util, SliceAttrs, SliceInputs, TensorInfo, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {sliceImplCPU} from '../kernel_utils/shared';\nimport {SliceProgram} from '../slice_webgpu';\n\nexport function slice(\n args: {inputs: SliceInputs, backend: WebGPUBackend, attrs: SliceAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {begin, size} = attrs;\n\n const [$begin, $size] = slice_util.parseSliceParams(x, begin, size);\n slice_util.assertParamsValid(x, $begin, $size);\n\n if (backend.shouldExecuteOnCPU([x]) || x.dtype === 'string') {\n const xBufferInfo = backend.tensorMap.get(x.dataId);\n const outValues = sliceImplCPU(\n xBufferInfo.values as TypedArray, $begin, $size, x.shape, x.dtype);\n return backend.makeTensorInfo($size, x.dtype, outValues);\n }\n\n if (util.sizeFromShape($size) === 0) {\n return backend.makeTensorInfo($size, x.dtype, []);\n }\n\n // TODO(xing.xu): Add shadow slice support.\n const program = new SliceProgram($begin, $size);\n const uniformData = [{type: 'int32', data: $begin}];\n return backend.runWebGPUProgram(program, [x], x.dtype, uniformData);\n}\n\nexport const sliceConfig: KernelConfig = {\n kernelName: Slice,\n backendName: 'webgpu',\n kernelFunc: slice as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, BatchToSpaceND, BatchToSpaceNDAttrs, BatchToSpaceNDInputs, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\n\nimport {reshape} from './Reshape';\nimport {slice} from './Slice';\nimport {transpose} from './Transpose';\n\nexport const batchToSpaceND = (args: {\n inputs: BatchToSpaceNDInputs,\n backend: WebGPUBackend,\n attrs: BatchToSpaceNDAttrs\n}): TensorInfo => {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {blockShape, crops} = attrs;\n\n util.assert(\n x.shape.length <= 4,\n () => 'batchToSpaceND for rank > 4 with a WebGPU backend not ' +\n 'implemented yet');\n const prod = blockShape.reduce((a, b) => a * b);\n\n const reshaped = backend_util.getReshaped(x.shape, blockShape, prod);\n const permuted = backend_util.getPermuted(reshaped.length, blockShape.length);\n const reshapedPermuted =\n backend_util.getReshapedPermuted(x.shape, blockShape, prod);\n const sliceBeginCoords =\n backend_util.getSliceBeginCoords(crops, blockShape.length);\n const sliceSize =\n backend_util.getSliceSize(reshapedPermuted, crops, blockShape.length);\n\n const toDispose = [];\n\n const reshapedIntermediate =\n reshape({inputs: {x}, backend, attrs: {shape: reshaped}});\n const transposedIntermediate = transpose(\n {inputs: {x: reshapedIntermediate}, backend, attrs: {perm: permuted}});\n const reshapedIntermediate2 = reshape({\n inputs: {x: transposedIntermediate},\n backend,\n attrs: {shape: reshapedPermuted}\n });\n const sliced = slice({\n inputs: {x: reshapedIntermediate2},\n backend,\n attrs: {begin: sliceBeginCoords, size: sliceSize}\n });\n\n toDispose.push(reshapedIntermediate);\n toDispose.push(transposedIntermediate);\n toDispose.push(reshapedIntermediate2);\n\n toDispose.forEach(t => backend.disposeData(t.dataId));\n\n return sliced;\n};\n\nexport const batchToSpaceNDConfig: KernelConfig = {\n kernelName: BatchToSpaceND,\n backendName: 'webgpu',\n kernelFunc: batchToSpaceND as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {atomicAddSnippet} from './shader_util';\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nconst writeSnippet = `\n fn bincount_write(index: i32, value: f32) {\n ${atomicAddSnippet('&result[index]', 'value', 'float32')}\n }\n`;\n\nconst binaryWriteSnippet = `\n fn bincount_write(index: i32, value: f32) {\n atomicStore(&result[index], bitcast(value));\n }\n`;\n\nexport class BincountProgram implements WebGPUProgram {\n outputShape: number[] = [];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames = ['x'];\n uniforms = 'binCountSize : i32,';\n workgroupSize: [number, number, number] = [64, 1, 1];\n atomic = true;\n hasWeights = true;\n binaryOutput = false;\n rank: number;\n\n constructor(\n shape: [number]|[number, number], hasWeights: boolean,\n binaryOutput = false) {\n this.outputShape = shape;\n this.rank = shape.length;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n\n this.binaryOutput = binaryOutput;\n if (binaryOutput) {\n this.atomic = false;\n }\n this.hasWeights = hasWeights;\n if (this.hasWeights) {\n this.variableNames.push('w');\n }\n this.shaderKey =\n `bincount_${this.hasWeights}_${this.binaryOutput}_${this.rank}`;\n }\n\n getUserCode(): string {\n const userCode = `\n ${this.binaryOutput ? binaryWriteSnippet : writeSnippet}\n ${main('index')} {\n ${\n this.rank === 1 ?\n `if (index < uniforms.xShape) {\n let indexVal = i32(getX(index));\n if (indexVal < uniforms.binCountSize) {\n let value = ${\n this.binaryOutput ? 1. :\n (this.hasWeights ? 'getW(index)' : '1.')};\n bincount_write(indexVal, value);\n }\n }` :\n `let coord = getCoordsFromIndex(index);\n if (coordsInBounds2D(coord, uniforms.xShape)) {\n let indexVal = i32(getX(coord[0], coord[1]));\n if (indexVal < uniforms.binCountSize) {\n let value = ${\n this.binaryOutput ?\n 1. :\n (this.hasWeights ? 'getW(coord[0], coord[1])' : '1.')};\n bincount_write(coord.x * uniforms.binCountSize + indexVal, value);\n }\n }`}\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Bincount, BincountAttrs, BincountInputs, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {BincountProgram} from '../bincount_webgpu';\n\nimport {fill} from './Fill';\n\nexport function bincount(\n args:\n {inputs: BincountInputs, backend: WebGPUBackend, attrs: BincountAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x, weights} = inputs;\n const {size} = attrs;\n\n const xSize = util.sizeFromShape(x.shape);\n const weightsSize = util.sizeFromShape(weights.shape);\n const hasWeights = weightsSize > 0;\n const outputSize: [number] = [size];\n const dtype = weights.dtype;\n\n const output = fill({backend, attrs: {shape: outputSize, value: 0, dtype}});\n const program = new BincountProgram([xSize], hasWeights);\n const uniformData = [{type: 'int32', data: [size]}];\n const bincountInputs: TensorInfo[] = hasWeights ? [x, weights] : [x];\n const res = backend.runWebGPUProgram(\n program, bincountInputs, dtype, uniformData, output);\n\n return res;\n}\n\nexport const bincountConfig: KernelConfig = {\n kernelName: Bincount,\n backendName: 'webgpu',\n kernelFunc: bincount as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, NotEqual} from '@tensorflow/tfjs-core';\n\nimport {BinaryOpType} from '../binary_op_util';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {notEqualImplCPU as cpuNotEqual} from '../kernel_utils/shared';\n\nexport const notEqual = binaryKernelFunc({\n opType: BinaryOpType.NOT_EQUAL,\n dtype: 'bool',\n cpuKernelImpl: cpuNotEqual\n});\n\nexport const notEqualConfig: KernelConfig = {\n kernelName: NotEqual,\n backendName: 'webgpu',\n kernelFunc: notEqual\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Real, RealInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {identity} from './Identity';\n\nexport function real(args: {inputs: RealInputs, backend: WebGPUBackend}):\n TensorInfo {\n const {inputs, backend} = args;\n const {input} = inputs;\n const inputData = backend.tensorMap.get(input.dataId);\n\n return identity({inputs: {x: inputData.complexTensorInfos.real}, backend});\n}\n\nexport const realConfig: KernelConfig = {\n kernelName: Real,\n backendName: 'webgpu',\n kernelFunc: real as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {TensorInfo} from '@tensorflow/tfjs-core';\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {UnaryOpType} from '../unary_op_util';\nimport {UnaryOpProgram} from '../unary_op_webgpu';\n\nexport function int(input: TensorInfo, backend: WebGPUBackend): TensorInfo {\n const program = new UnaryOpProgram(input.shape, UnaryOpType.TO_INT);\n const output = backend.runWebGPUProgram(program, [input], 'int32');\n return {dataId: output.dataId, shape: output.shape, dtype: output.dtype};\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport * as tf from '@tensorflow/tfjs-core';\nimport {BinaryInputs, Cast, CastAttrs, CastInputs, KernelConfig, KernelFunc, TensorInfo, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {castImplCPU} from '../kernel_utils/shared';\n\nimport {complex} from './Complex';\nimport {identity} from './Identity';\nimport {notEqual} from './NotEqual';\nimport {real} from './Real';\n\nimport {int} from '../kernel_utils/int';\n\nexport function cast(\n args: {inputs: CastInputs, backend: WebGPUBackend, attrs: CastAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {dtype} = attrs;\n\n // Casting to complex64.\n if (dtype === 'complex64') {\n if (x.dtype === 'complex64') {\n return identity({inputs: {x}, backend});\n }\n\n // TODO: Import kernel function once zeros is modularized.\n const zerosTensor = tf.zeros(x.shape);\n const floatX = cast({inputs: {x}, backend, attrs: {dtype: 'float32'}});\n\n const result =\n complex({inputs: {real: floatX, imag: zerosTensor}, backend});\n\n zerosTensor.dispose();\n backend.disposeData(floatX.dataId);\n\n return result;\n }\n\n // Casting from complex64\n if (x.dtype === 'complex64') {\n const realPart = real({inputs: {input: x}, backend});\n const result = cast({inputs: {x: realPart}, backend, attrs: {dtype}});\n backend.disposeData(realPart.dataId);\n return result;\n }\n\n if (!util.hasEncodingLoss(x.dtype, dtype)) {\n // We don't change the underlying data, since we cast to higher\n // precision.\n const result = identity({inputs: {x}, backend});\n return {dataId: result.dataId, shape: result.shape, dtype};\n }\n\n if (backend.shouldExecuteOnCPU([x])) {\n const values = backend.tensorMap.get(x.dataId).values as TypedArray;\n const [resultShape, resultType, resultData] =\n castImplCPU(values, x.shape, x.dtype, dtype);\n return backend.makeTensorInfo(resultShape, resultType, resultData);\n }\n\n if (dtype === 'int32') {\n return int(x, backend);\n }\n\n if (dtype === 'bool') {\n const zerosTensorInfo = backend.makeTensorInfo(\n [], 'bool', util.getTypedArrayFromDType('bool', 1));\n\n const binaryInputs: BinaryInputs = {a: x, b: zerosTensorInfo};\n\n const result = notEqual({inputs: binaryInputs, backend}) as TensorInfo;\n backend.disposeData(zerosTensorInfo.dataId);\n return result;\n }\n\n throw new Error(`Error in Cast: failed to cast ${x.dtype} to ${dtype}`);\n}\n\nexport const castConfig: KernelConfig = {\n kernelName: Cast,\n backendName: 'webgpu',\n kernelFunc: cast as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Ceil, KernelConfig} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {ceilImplCPU} from '../kernel_utils/shared';\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const ceil =\n unaryKernelFunc({opType: UnaryOpType.CEIL, cpuKernelImpl: ceilImplCPU});\n\nexport const ceilConfig: KernelConfig = {\n kernelName: Ceil,\n backendName: 'webgpu',\n kernelFunc: ceil\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class ClipVec4Program implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n variableNames = ['A'];\n uniforms = 'minVal : f32, maxVal : f32,';\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n workPerThread = 4;\n workgroupSize: [number, number, number] = [64, 1, 1];\n isVec4 = true;\n size = true;\n\n constructor(outputShape: number[]) {\n this.outputShape = outputShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize,\n [this.workPerThread, 1, 1]);\n this.shaderKey = 'clipVec4';\n }\n\n getUserCode(): string {\n const userCode = `\n ${main('index')} {\n if(index < uniforms.size) {\n let value = getAByOutputIndex(index);\n var clampedValue = clamp(\n value, vec4(uniforms.minVal), vec4(uniforms.maxVal));\n clampedValue = select(clampedValue, value, isnanVec4(value));\n setOutputAtIndex(index, clampedValue);\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class ClipProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n variableNames = ['A'];\n uniforms = 'minVal : f32, maxVal : f32,';\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n workgroupSize: [number, number, number] = [64, 1, 1];\n minVal: number;\n maxVal: number;\n size = true;\n\n constructor(outputShape: number[]) {\n this.outputShape = outputShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n\n this.shaderKey = 'clip';\n }\n\n getUserCode(): string {\n const userCode = `\n ${main('index')} {\n if(index < uniforms.size) {\n let value = getAByOutputIndex(index);\n if (isnan(value)) {\n setOutputAtIndex(index, value);\n return;\n }\n setOutputAtIndex(index, clamp(value, uniforms.minVal, uniforms.maxVal));\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ClipByValue, ClipByValueAttrs, ClipByValueInputs, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\n\nimport {ClipVec4Program} from '../clip_vec4_webgpu';\nimport {ClipProgram} from '../clip_webgpu';\n\nexport function clipByValue(args: {\n inputs: ClipByValueInputs,\n backend: WebGPUBackend,\n attrs: ClipByValueAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {clipValueMin, clipValueMax} = attrs;\n\n let program: ClipProgram|ClipVec4Program;\n const uniformData = [\n {type: 'float32', data: [clipValueMin]},\n {type: 'float32', data: [clipValueMax]}\n ];\n if (util.sizeFromShape(x.shape) % 4 === 0) {\n program = new ClipVec4Program(x.shape);\n } else {\n program = new ClipProgram(x.shape);\n }\n return backend.runWebGPUProgram(program, [x], x.dtype, uniformData);\n}\n\nexport const clipByValueConfig: KernelConfig = {\n kernelName: ClipByValue,\n backendName: 'webgpu',\n kernelFunc: clipByValue as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class ConcatProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames: string[];\n uniforms = '';\n workPerThread = 1;\n workgroupSize: [number, number, number] = [64, 1, 1];\n size = true;\n offsetLength: number;\n\n constructor(shapes: Array<[number, number]>) {\n this.outputShape =\n backend_util.computeOutShape(shapes, 1 /* axis */) as [number, number];\n this.variableNames = shapes.map((_, i) => `T${i}`);\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize,\n [this.workPerThread, 1, 1]);\n\n this.offsetLength = shapes.length - 1;\n for (let i = 0; i < this.offsetLength; i++) {\n this.uniforms += `offset${i} : i32,`;\n }\n this.shaderKey = 'concat';\n }\n\n getUserCode(): string {\n const snippets: string[] = [];\n if (this.offsetLength > 0) {\n snippets.push(\n `if (yC < uniforms.offset0){ setOutputAtCoords(coords.x, coords.y, getT0(yR, yC)); }`);\n for (let i = 1; i < this.offsetLength; i++) {\n snippets.push(\n `else if (yC < uniforms.offset${[i]}){ ` +\n `setOutputAtCoords(coords.x, coords.y, getT${\n i}(yR, yC - uniforms.offset${i - 1})); }`);\n }\n const lastIndex = this.offsetLength;\n const lastShiftIndex = this.offsetLength - 1;\n snippets.push(`else { setOutputAtCoords(coords.x, coords.y, getT${\n lastIndex}(yR, yC - uniforms.offset${lastShiftIndex})); }`);\n } else {\n snippets.push(`setOutputAtCoords(coords.x, coords.y, getT0(yR, yC));`);\n }\n\n const userCode = `\n ${main('index')} {\n for(var i = 0; i < ${this.workPerThread}; i = i + 1) {\n let flatIndex = index * ${this.workPerThread} + i;\n if(flatIndex < uniforms.size) {\n let coords = getCoordsFromIndex(flatIndex);\n let yR = coords.x;\n let yC = coords.y;\n\n ${snippets.join('\\n ')}\n }\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Imag, ImagInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {identity} from './Identity';\n\nexport function imag(args: {inputs: ImagInputs, backend: WebGPUBackend}):\n TensorInfo {\n const {inputs, backend} = args;\n const {input} = inputs;\n const inputData = backend.tensorMap.get(input.dataId);\n\n return identity({inputs: {x: inputData.complexTensorInfos.imag}, backend});\n}\n\nexport const imagConfig: KernelConfig = {\n kernelName: Imag,\n backendName: 'webgpu',\n kernelFunc: imag as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, ConcatInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {ConcatProgram} from '../concat_webgpu';\nimport {concatImplCPU} from '../kernel_utils/shared';\n\nimport {complex} from './Complex';\nimport {imag} from './Imag';\nimport {real} from './Real';\nimport {reshape} from './Reshape';\n\nexport function concatImpl(\n inputs: ConcatInputs, axis: number, backend: WebGPUBackend): TensorInfo {\n const dtype = inputs[0].dtype;\n if (dtype === 'complex64') {\n const reals = inputs.map((t) => real({inputs: {input: t}, backend}));\n const imags = inputs.map((t) => imag({inputs: {input: t}, backend}));\n\n const realConcated = concatImpl(reals, axis, backend);\n const imagConcated = concatImpl(imags, axis, backend);\n\n const result =\n complex({inputs: {real: realConcated, imag: imagConcated}, backend});\n\n reals.forEach(r => backend.disposeData(r.dataId));\n imags.forEach(i => backend.disposeData(i.dataId));\n backend.disposeData(realConcated.dataId);\n backend.disposeData(imagConcated.dataId);\n\n return result;\n }\n\n let runOnCpu = backend.shouldExecuteOnCPU(inputs);\n\n // Run on cpu if dtype is string. For string, the backend represents it\n // as Uint8Array[], where each Uint8Array is a character. Given that the\n // computation is only on the outer array, uploading the whole data onto\n // gpu is wasteful. Also, currently webgpu doesn't have a design to\n // upload and retrieve Uint8Array[] between cpu and gpu. Therefore, we\n // just run the kernel on cpu if dtype is string.\n if (dtype === 'string') {\n runOnCpu = true;\n }\n\n if (runOnCpu) {\n // Any concat of n-dimensional tensors across any axis can be reduced to\n // a concatenation of two-dimensional tensors across the axis 1 by first\n // partitioning the axes of the original tensors into those less than the\n // axis to be concatenated and the rest. Then reshape the tensors\n // into a two-dimensional tensor by collapsing these two sets of axes and\n // concatenate the resulting matrices across the axis 1, finally reshaping\n // the result to have the proper shape.\n const tensors2D = inputs.map(t => {\n const innerSize = util.sizeFromShape(t.shape.slice(axis));\n const shape = [-1, innerSize];\n return reshape({inputs: {x: t}, backend, attrs: {shape}});\n });\n\n const inputsValShapes = tensors2D.map(t => {\n return {vals: backend.readSync(t.dataId), shape: t.shape};\n });\n\n // Concats 2d tensors along axis=1.\n const outShape =\n backend_util.computeOutShape(tensors2D.map(t => t.shape), 1 /* axis */);\n const simplyConcat = tensors2D[0].shape[0] === 1;\n const outVals =\n concatImplCPU(inputsValShapes, outShape, dtype, simplyConcat);\n\n const finalOutShape =\n backend_util.computeOutShape(inputs.map(t => t.shape), axis);\n\n const outInfo = backend.makeTensorInfo(finalOutShape, dtype, outVals);\n\n tensors2D.forEach(t => backend.disposeData(t.dataId));\n\n return outInfo;\n }\n\n // There is a storage buffer limitation in compute stage, one for output so\n // the maximum for input is limits.maxStorageBuffersPerShaderStage - 1\n const maxInputNum = backend.device.limits.maxStorageBuffersPerShaderStage - 1;\n if (inputs.length > maxInputNum) {\n const reducedInputs = [];\n for (let i = 0; i < inputs.length; i += maxInputNum) {\n const subArray = inputs.slice(i, i + maxInputNum);\n reducedInputs.push(concatImpl(subArray, axis, backend));\n }\n const result = concatImpl(reducedInputs, axis, backend);\n\n for (const i of reducedInputs) {\n backend.disposeData(i.dataId);\n }\n\n return result;\n }\n\n const {tensors2D, outShape} = computeTensors2D(inputs, axis, backend);\n const shapes = (tensors2D).map(t => t.shape as [number, number]);\n const program = new ConcatProgram(shapes);\n\n const uniformData: Array<{type: string; data: number[]}> = [];\n const offsets: number[] = new Array(shapes.length - 1);\n if (offsets.length > 0) {\n offsets[0] = shapes[0][1];\n uniformData.push({type: 'int32', data: [offsets[0]]});\n for (let i = 1; i < offsets.length; i++) {\n offsets[i] = offsets[i - 1] + shapes[i][1];\n uniformData.push({type: 'int32', data: [offsets[i]]});\n }\n }\n\n const res = backend.runWebGPUProgram(\n program, tensors2D, tensors2D[0].dtype, uniformData);\n tensors2D.forEach(r => backend.disposeData(r.dataId));\n\n const reshapedResult =\n reshape({inputs: {x: res}, backend, attrs: {shape: outShape}});\n backend.disposeData(res.dataId);\n return reshapedResult;\n}\n\nfunction computeTensors2D(\n inputs: ConcatInputs, axis: number, backend: WebGPUBackend) {\n const outShape = backend_util.computeOutShape(inputs.map(t => t.shape), axis);\n const tensors2D = inputs.map(t => reshape({\n inputs: {x: t},\n backend,\n attrs: {\n shape: [\n util.sizeFromShape(t.shape.slice(0, axis)),\n util.sizeFromShape(t.shape.slice(axis))\n ]\n }\n }));\n\n return {tensors2D, outShape};\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, Concat, ConcatAttrs, ConcatInputs, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\n\nimport {concatImpl} from './Concat_impl';\nimport {identity} from './Identity';\n\nexport function concat(\n args: {inputs: ConcatInputs, attrs: ConcatAttrs, backend: WebGPUBackend}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {axis} = attrs;\n\n const $axis = util.parseAxisParam(axis, inputs[0].shape)[0];\n\n const shapes = inputs.map(t => t.shape);\n backend_util.assertParamsConsistent(shapes, $axis);\n\n const outShape =\n backend_util.computeOutShape(inputs.map(t => t.shape), $axis);\n if (util.sizeFromShape(outShape) === 0) {\n return backend.makeTensorInfo(outShape, inputs[0].dtype, []);\n }\n\n // Keep only non-empty tensors (ignore tensors with 0 in their shape).\n const $inputs = inputs.filter(t => util.sizeFromShape(t.shape) > 0);\n if ($inputs.length === 1) {\n return identity({inputs: {x: $inputs[0]}, backend});\n }\n\n return concatImpl($inputs, $axis, backend);\n}\n\nexport const concatConfig: KernelConfig = {\n kernelName: Concat,\n backendName: 'webgpu',\n kernelFunc: concat as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\n\nimport {activationFnSnippet, biasActivationSnippet, typeSnippet} from './activation_util';\nimport {makeMatMulPackedSource, makeMatMulPackedVec4Source} from './matmul_packed_webgpu';\nimport {WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, computeWorkgroupSizeForConv2d, computeWorkPerThreadForConv2d} from './webgpu_util';\n\nfunction conv2dCommonSnippet(\n isChannelsLast: boolean, fitAOuter: boolean, fitBOuter: boolean,\n fitInner: boolean, addBias = false,\n activation: backend_util.Activation = null,\n hasPreluActivationWeights = false, innerElementSizeX = 4,\n innerElementSizeW = 4, innerElementSize = 4) {\n const getXSnippet = (innerElementSize: number) => {\n switch (innerElementSize) {\n case 1:\n return 'resData = x[xIndex];';\n case 3:\n return 'resData = vec3(x[xIndex], x[xIndex + 1], x[xIndex + 2]);';\n case 4:\n return 'resData = x[xIndex / 4];';\n default:\n throw new Error(\n `innerElementSize ${innerElementSize} is not supported.`);\n }\n };\n const getWSnippet = (innerElementSize: number) => {\n switch (innerElementSize) {\n case 1:\n return 'return W[row * uniforms.wShape[3] + colIn];';\n case 4:\n return 'return W[row * uniforms.wShape[3] / 4 + colIn];';\n default:\n throw new Error(\n `innerElementSize ${innerElementSize} is not supported.`);\n }\n };\n const coordASnippet = isChannelsLast ? `\n let coord = vec4(batch, xRow, xCol, xCh);\n ` :\n `\n let coord = vec4(batch, xCh, xRow, xCol);\n `;\n\n const coordResSnippet = isChannelsLast ? `\n let coords = vec4(\n batch,\n row / outWidth,\n row % outWidth,\n col);\n ` :\n `\n let coords = vec4(\n batch,\n row,\n col / outWidth,\n col % outWidth);\n `;\n\n const xHight = isChannelsLast ? 'uniforms.xShape[1]' : 'uniforms.xShape[2]';\n const xWidth = isChannelsLast ? 'uniforms.xShape[2]' : 'uniforms.xShape[3]';\n const row = isChannelsLast ? 'row' : 'col';\n const col = isChannelsLast ? 'col' : 'row';\n const readXSnippet = `\n let inChannels = uniforms.wShape[2];\n let outWidth = ${\n isChannelsLast ? 'uniforms.outShape[2]' : 'uniforms.outShape[3]'};\n let outRow = ${row} / outWidth;\n let outCol = ${row} % outWidth;\n\n let WRow = ${col} / (uniforms.filterDims[1] * inChannels);\n let WCol = ${col} / inChannels % uniforms.filterDims[1];\n let xRow = outRow * uniforms.stride[0] + uniforms.dilation[0] * WRow - uniforms.pad[0];\n let xCol = outCol * uniforms.stride[1] + uniforms.dilation[1] * WCol - uniforms.pad[1];\n let xCh = ${col} % inChannels;\n var resData = ${typeSnippet(innerElementSizeX)}(0.0);\n // The bounds checking is always needed since we use it to pad zero for\n // the 'same' padding type.\n if (xRow >= 0 && xRow < ${xHight} && xCol >= 0 && xCol < ${xWidth}) {\n ${coordASnippet}\n let xIndex = getIndexFromCoords4D(coord, uniforms.xShape);\n ${getXSnippet(innerElementSizeX)}\n }\n return resData;`;\n\n const sampleX = isChannelsLast ? (fitAOuter && fitInner ? `\n let col = colIn * ${innerElementSizeX};\n ${readXSnippet}` :\n `\n let col = colIn * ${innerElementSizeX};\n if (row < uniforms.dimAOuter && col < uniforms.dimInner) {\n ${readXSnippet}\n }\n return ${typeSnippet(innerElementSizeX)}(0.0);`) :\n (fitInner && fitBOuter ? `\n let col = colIn * ${innerElementSizeX};\n ${readXSnippet}` :\n `\n let col = colIn * ${innerElementSizeX};\n if (row < uniforms.dimInner && col < uniforms.dimBOuter) {\n ${readXSnippet}\n }\n return ${typeSnippet(innerElementSizeX)}(0.0);`);\n\n const sampleW = `${getWSnippet(innerElementSizeW)}`;\n\n const resType = typeSnippet(innerElementSize);\n const aType = isChannelsLast ? typeSnippet(innerElementSizeX) :\n typeSnippet(innerElementSizeW);\n const bType = isChannelsLast ? typeSnippet(innerElementSizeW) :\n typeSnippet(innerElementSizeX);\n const userCode = `\n ${\n activationFnSnippet(\n activation, hasPreluActivationWeights, innerElementSize === 4, 4)}\n fn mm_readA(batch: i32, row : i32, colIn : i32) -> ${aType} {\n ${isChannelsLast ? sampleX : sampleW}\n }\n\n fn mm_readB(batch: i32, row : i32, colIn : i32) -> ${bType} {\n ${isChannelsLast ? sampleW : sampleX}\n }\n\n fn mm_write(batch: i32, row : i32, colIn : i32, valueIn : ${resType}) {\n let col = colIn * ${innerElementSize};\n if (row < uniforms.dimAOuter && col < uniforms.dimBOuter)\n {\n var value = valueIn;\n let outWidth = ${\n isChannelsLast ? 'uniforms.outShape[2]' : 'uniforms.outShape[3]'};\n ${coordResSnippet}\n ${biasActivationSnippet(addBias, activation)}\n setOutputAtCoords(coords[0], coords[1], coords[2], coords[3], value);\n }\n }`;\n return userCode;\n}\n\nexport class Conv2DMMProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[], y: number[], z: number[]};\n dispatch: [number, number, number];\n variableNames = ['x', 'W'];\n variableTypes: string[];\n uniforms =\n `filterDims : vec2, pad : vec2, stride : vec2, dilation : vec2, dimAOuter : i32, dimBOuter : i32, dimInner : i32,`;\n workgroupSize: [number, number, number];\n elementsPerThread: [number, number, number];\n addBias: boolean;\n activation: backend_util.Activation;\n hasPreluActivationWeights: boolean;\n isChannelsLast: boolean;\n fitAOuter: boolean;\n fitBOuter: boolean;\n fitInner: boolean;\n tileAOuter: number;\n tileBOuter: number;\n tileInner: number;\n innerElementSize: number;\n isVec4?: boolean;\n private sequentialAccessByThreads: boolean;\n\n constructor(\n convInfo: backend_util.Conv2DInfo, dimAOuter: number, dimBOuter: number,\n dimInner: number, addBias = false,\n activation: backend_util.Activation = null,\n hasPreluActivationWeights = false, sequentialAccessByThreads = false) {\n this.outputShape = convInfo.outShape;\n this.isChannelsLast = convInfo.dataFormat === 'channelsLast';\n this.isVec4 =\n (((convInfo.inChannels % 4 === 0 || convInfo.inChannels % 3 === 0) &&\n this.isChannelsLast) ||\n (convInfo.outWidth % 4 === 0 && !this.isChannelsLast)) &&\n convInfo.outChannels % 4 === 0;\n this.dispatchLayout = this.isChannelsLast ? {x: [3], y: [1, 2], z: [0]} :\n {x: [2, 3], y: [1], z: [0]};\n this.workgroupSize = computeWorkgroupSizeForConv2d(\n this.dispatchLayout, this.outputShape, this.isVec4);\n this.elementsPerThread = computeWorkPerThreadForConv2d(\n this.dispatchLayout, this.outputShape, this.isVec4);\n\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize,\n this.elementsPerThread);\n\n if (this.isVec4) {\n if (this.isChannelsLast && convInfo.inChannels % 4 !== 0) {\n this.innerElementSize = 3;\n this.variableTypes = ['f32', 'vec4'];\n } else {\n this.innerElementSize = 4;\n this.variableTypes = ['vec4', 'vec4'];\n }\n\n if (addBias) {\n this.variableNames.push('bias');\n this.variableTypes.push('vec4');\n }\n\n if (hasPreluActivationWeights) {\n this.variableNames.push('preluActivationWeights');\n this.variableTypes.push('vec4');\n }\n } else {\n this.innerElementSize = this.elementsPerThread[0];\n if (addBias) {\n this.variableNames.push('bias');\n }\n\n if (hasPreluActivationWeights) {\n this.variableNames.push('preluActivationWeights');\n }\n }\n\n this.sequentialAccessByThreads = sequentialAccessByThreads;\n this.addBias = addBias;\n this.activation = activation;\n this.hasPreluActivationWeights = hasPreluActivationWeights;\n\n this.tileAOuter = this.workgroupSize[1] * this.elementsPerThread[1];\n this.tileBOuter = this.workgroupSize[0] * this.elementsPerThread[0];\n this.tileInner = Math.max(\n this.workgroupSize[0] * this.innerElementSize, this.workgroupSize[1]);\n\n this.fitAOuter = dimAOuter % this.tileAOuter === 0;\n this.fitBOuter = dimBOuter % this.tileBOuter === 0;\n this.fitInner = dimInner % this.tileInner === 0;\n\n this.shaderKey = `conv2DMM_${this.elementsPerThread}_${this.activation}}_${\n this.fitAOuter}_${this.fitBOuter}_${this.fitInner}_${this.isVec4}_${\n this.innerElementSize}_${this.isChannelsLast}_${\n this.sequentialAccessByThreads}`;\n }\n\n getUserCode(): string {\n const matMulSource = this.isVec4 ?\n makeMatMulPackedVec4Source(\n this.elementsPerThread, this.workgroupSize, !this.isChannelsLast,\n this.tileInner) :\n makeMatMulPackedSource(\n this.elementsPerThread, this.workgroupSize, !this.isChannelsLast,\n this.tileInner, false, null, this.sequentialAccessByThreads);\n const elementsSize =\n this.isVec4 ? [this.innerElementSize, 4, 4] : [1, 1, 1];\n const userCode = `\n ${\n conv2dCommonSnippet(\n this.isChannelsLast, this.fitAOuter, this.fitBOuter, this.fitInner,\n this.addBias, this.activation, this.hasPreluActivationWeights,\n elementsSize[0], elementsSize[1], elementsSize[2])}\n ${matMulSource}\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\n\nimport {activationFnSnippet, biasActivationSnippet} from './activation_util';\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch} from './webgpu_util';\n\nexport class Conv2DNaiveProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[], y: number[], z: number[]};\n dispatch: [number, number, number];\n variableNames = ['x', 'W'];\n uniforms =\n 'filterDims: vec2, pad: vec2, stride: vec2, dilation: vec2,';\n workgroupSize: [number, number, number] = [4, 4, 8];\n addBias: boolean;\n activation: backend_util.Activation;\n hasPreluActivationWeights: boolean;\n isChannelsLast: boolean;\n\n constructor(\n convInfo: backend_util.Conv2DInfo, addBias = false,\n activation: backend_util.Activation = null,\n hasPreluActivationWeights = false) {\n this.outputShape = convInfo.outShape;\n this.isChannelsLast = convInfo.dataFormat === 'channelsLast';\n this.dispatchLayout = this.isChannelsLast ? {x: [2], y: [1], z: [0, 3]} :\n {x: [3], y: [2], z: [0, 1]};\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n this.addBias = addBias;\n this.activation = activation;\n this.hasPreluActivationWeights = hasPreluActivationWeights;\n\n if (addBias) {\n this.variableNames.push('bias');\n }\n\n if (hasPreluActivationWeights) {\n this.variableNames.push('preluActivationWeights');\n }\n\n this.shaderKey = `conv2dnaive_${this.activation}_${this.isChannelsLast}`;\n }\n\n getUserCode(): string {\n const userCode = `\n ${\n activationFnSnippet(\n this.activation, this.hasPreluActivationWeights, false, 4)}\n fn readInp(batch : i32, row : i32, col : i32, chan : i32) -> f32{\n let coords = vec4(batch, row, col, chan);\n if (coordsInBounds4D(coords, uniforms.xShape)) {\n return getX(batch, row, col, chan);\n } else {\n return 0.0;\n }\n }\n fn readFilt(row : i32, col : i32, xChannel : i32, outChannel : i32) -> f32{\n let coords = vec4(row, col, xChannel, outChannel);\n if(coordsInBounds4D(coords, uniforms.wShape)) {\n return getW(row, col, xChannel, outChannel);\n } else {\n return 0.0;\n }\n }\n fn writeResult(batch : i32, row : i32, col : i32, chan : i32, valueIn : f32) {\n let coords = ${\n this.isChannelsLast ? `vec4(batch, row, col, chan);` :\n `vec4(batch, chan, row, col);`}\n if (coordsInBounds4D(coords, uniforms.outShape)) {\n var value = valueIn;\n ${biasActivationSnippet(this.addBias, this.activation)}\n setOutputAtCoords(coords.x, coords.y, coords.z, coords.w, value);\n }\n }\n ${main('index')} {\n let coords = getOutputCoords();\n let batch = coords[0];\n let outChannel = ${this.isChannelsLast ? `coords[3];` : `coords[1];`}\n let outRow = ${this.isChannelsLast ? `coords[1];` : `coords[2];`}\n let outCol = ${this.isChannelsLast ? `coords[2];` : `coords[3];`}\n var acc : f32 = 0.0;\n for (var row = 0; row < uniforms.filterDims[0]; row = row + 1) {\n for (var col = 0; col < uniforms.filterDims[1]; col = col + 1) {\n let xRow = outRow * uniforms.stride[0] + uniforms.dilation[0] * row - uniforms.pad[0];\n let xCol = outCol * uniforms.stride[1] + uniforms.dilation[1] * col - uniforms.pad[1];\n for (var xChannel = 0; xChannel < ${\n this.isChannelsLast ? `uniforms.xShape[3];` :\n `uniforms.xShape[1];`} xChannel = xChannel + 1) {\n ${\n this.isChannelsLast ? `let v = readInp(batch, xRow, xCol, xChannel);` :\n `let v = readInp(batch, xChannel, xRow, xCol);`}\n let f = readFilt(row, col, xChannel, outChannel);\n acc = acc + v * f;\n }\n }\n }\n writeResult(batch, outRow, outCol, outChannel, acc);\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class Im2ColProgram implements WebGPUProgram {\n variableNames = ['x'];\n uniforms =\n `pad : vec2, stride : vec2, dilation : vec2, outWidth : i32, itemsPerBlockRow : i32,\n inChannels : i32,`;\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n workgroupSize: [number, number, number] = [64, 1, 1];\n isChannelsLast: boolean;\n size = true;\n\n constructor(outputShape: number[], isChannelsLast: boolean) {\n this.outputShape = outputShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n this.isChannelsLast = isChannelsLast;\n this.shaderKey = `im2col_${this.isChannelsLast}`;\n }\n\n getUserCode(): string {\n const rowDim = this.isChannelsLast ? 1 : 2;\n const colDim = this.isChannelsLast ? 2 : 3;\n\n const row = this.isChannelsLast ? 'coords[1]' : 'coords[2]';\n const col = this.isChannelsLast ? 'coords[2]' : 'coords[1]';\n const getXSnippet = this.isChannelsLast ? 'getX(batch, xRow, xCol, ch)' :\n 'getX(batch, ch, xRow, xCol)';\n\n const userCode = `\n ${main('index')} {\n let coords = getCoordsFromIndex(index);\n if(index < uniforms.size) {\n let batch = coords[0];\n let row = ${row};\n let col = ${col};\n let offsetY = (row / uniforms.outWidth) * uniforms.stride[0] - uniforms.pad[0];\n let xRow = offsetY + uniforms.dilation[0] * (col / uniforms.itemsPerBlockRow);\n var value = 0.0;\n if(xRow < uniforms.xShape[${rowDim}] && xRow >= 0) {\n let offsetX = (row % uniforms.outWidth) * uniforms.stride[1] -\n uniforms.pad[1];\n let xCol = offsetX + uniforms.dilation[1] * ((col %\n uniforms.itemsPerBlockRow) / uniforms.inChannels);\n let ch = col % uniforms.inChannels;\n if(xCol < uniforms.xShape[${colDim}] && xCol >= 0) {\n value = ${getXSnippet};\n }\n }\n setOutputAtIndex(index, value);\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, env, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {Conv2DMMProgram} from '../conv2d_mm_webgpu';\nimport {Conv2DNaiveProgram} from '../conv2d_naive_webgpu';\nimport {Im2ColProgram} from '../im2col_webgpu';\nimport {WebGPUProgram} from '../webgpu_program';\n\nimport {batchMatMulImpl} from './BatchMatMul_impl';\nimport {reshape} from './Reshape';\n\ntype Conv2DConfig = {\n x: TensorInfo,\n filter: TensorInfo,\n convInfo: backend_util.Conv2DInfo,\n backend: WebGPUBackend,\n bias?: TensorInfo,\n preluActivationWeights?: TensorInfo,\n leakyreluAlpha?: number,\n activation?: backend_util.Activation\n};\n\n// conv2dByMatMul fuses height and width into one dimension to compute\n// batchMatMul, so bias and activation weights are also supposed to fuse the two\n// dimensions into one.\n//\n// This function computes the target shape for fusing height and width\n// dimensions. Returning null means the shape is already compatible.\nfunction getShapeForBatchMatMul(\n shape: number[], isChannelsLast: boolean): number[] {\n const length = shape.length;\n if (length >= 3) {\n return isChannelsLast ?\n [\n ...shape.slice(0, -3) /* batch */,\n shape[length - 3] * shape[length - 2] /* height * width */,\n shape[length - 1] /* channel */\n ] :\n [\n ...shape.slice(0, -3) /* batch */, shape[length - 3] /* channel */,\n shape[length - 2] * shape[length - 1] /* height * width */\n ];\n } else if (!isChannelsLast && length === 1 && shape[0] > 1) {\n return [shape[0], 1];\n } else {\n return null;\n }\n}\n\n// For 1x1 kernels that iterate through every point in the input, convolution\n// can be expressed as matrix multiplication (without need for memory\n// remapping).\nfunction conv2dByMatMul({\n x,\n filter,\n convInfo,\n backend,\n bias = null,\n preluActivationWeights = null,\n leakyreluAlpha = 0,\n activation = null\n}: Conv2DConfig) {\n const isChannelsLast = convInfo.dataFormat === 'channelsLast';\n const transposeA = isChannelsLast ? false : true;\n const transposeB = false;\n\n const sameSize = isChannelsLast &&\n convInfo.filterHeight === convInfo.inHeight &&\n convInfo.filterWidth === convInfo.inWidth &&\n convInfo.padInfo.type === 'VALID';\n const intermediates: TensorInfo[] = [];\n let xReshaped;\n let filterReshaped;\n\n if (sameSize) {\n const sharedDim =\n convInfo.inHeight * convInfo.inWidth * convInfo.inChannels;\n xReshaped = reshape({\n inputs: {x},\n backend,\n attrs: {shape: [1, convInfo.batchSize, sharedDim]}\n });\n filterReshaped = reshape({\n inputs: {x: filter},\n backend,\n attrs: {shape: [1, sharedDim, convInfo.outChannels]}\n });\n } else {\n xReshaped = reshape({\n inputs: {x},\n backend,\n attrs: {\n shape: isChannelsLast ?\n [\n convInfo.batchSize, convInfo.inHeight * convInfo.inWidth,\n convInfo.inChannels\n ] :\n [\n convInfo.batchSize, convInfo.inChannels,\n convInfo.inHeight * convInfo.inWidth\n ]\n }\n });\n filterReshaped = reshape({\n inputs: {x: filter},\n backend,\n attrs: {shape: [1, convInfo.inChannels, convInfo.outChannels]}\n });\n }\n intermediates.push(xReshaped);\n intermediates.push(filterReshaped);\n\n if (preluActivationWeights != null) {\n const targetShape =\n getShapeForBatchMatMul(preluActivationWeights.shape, isChannelsLast);\n if (targetShape != null) {\n preluActivationWeights = reshape({\n inputs: {x: preluActivationWeights},\n backend,\n attrs: {shape: targetShape}\n });\n intermediates.push(preluActivationWeights);\n }\n }\n\n if (bias != null) {\n const targetShape = getShapeForBatchMatMul(bias.shape, isChannelsLast);\n if (targetShape != null) {\n bias = reshape({inputs: {x: bias}, backend, attrs: {shape: targetShape}});\n intermediates.push(bias);\n }\n }\n\n const result = batchMatMulImpl({\n a: isChannelsLast ? xReshaped : filterReshaped,\n b: isChannelsLast ? filterReshaped : xReshaped,\n transposeA,\n transposeB,\n backend,\n bias,\n activation,\n preluActivationWeights,\n leakyreluAlpha\n });\n const out = reshape(\n {inputs: {x: result}, backend, attrs: {shape: convInfo.outShape}});\n intermediates.push(result);\n\n for (const i of intermediates) {\n backend.disposeData(i.dataId);\n }\n\n return out;\n}\n\n// Implements the im2col algorithm as outlined in \"High Performance\n// Convolutional Neural Networks for Document Processing\" (Suvisoft, 2006)\nfunction conv2dWithIm2Col({\n x,\n filter,\n convInfo,\n backend,\n bias = null,\n preluActivationWeights = null,\n leakyreluAlpha = 0,\n activation = null\n}: Conv2DConfig) {\n // Rearranges conv2d input so each block to be convolved over forms the\n // row of a new matrix with shape [outHeight * outWidth,\n // filterWidth * filterHeight * inChannels]. The filter is also rearranged so\n // each output channel forms a col of a new matrix with shape [\n // filterWidth * filterHeight * inChannels, outChannels]. The convolution is\n // then computed by multiplying these matrices and reshaping the result.\n const {\n filterWidth,\n filterHeight,\n inChannels,\n strideWidth,\n strideHeight,\n padInfo,\n outWidth,\n outHeight,\n dilationWidth,\n dilationHeight,\n dataFormat\n } = convInfo;\n\n const isChannelsLast = dataFormat === 'channelsLast';\n\n const sharedDim = filterWidth * filterHeight * inChannels;\n const numCols = outHeight * outWidth;\n const x2ColShape = isChannelsLast ? [convInfo.batchSize, numCols, sharedDim] :\n [convInfo.batchSize, sharedDim, numCols];\n\n const im2ColProgram = new Im2ColProgram(x2ColShape, isChannelsLast);\n const dimensions = [\n {type: 'int32', data: [padInfo.top, padInfo.left]}, // Padding.\n {type: 'int32', data: [strideHeight, strideWidth]}, // Stride.\n {type: 'int32', data: [dilationHeight, dilationWidth]}, // Dilation.\n {type: 'int32', data: [outWidth]},\n {type: 'int32', data: [inChannels * filterWidth]}, // itemsPerBlockRow.\n {type: 'int32', data: [inChannels]}\n ];\n const x2Col =\n backend.runWebGPUProgram(im2ColProgram, [x], x.dtype, dimensions);\n\n const intermediates: TensorInfo[] = [];\n intermediates.push(x2Col);\n\n const filterReshaped = reshape(\n {inputs: {x: filter}, backend, attrs: {shape: [1, sharedDim, -1]}});\n intermediates.push(filterReshaped);\n\n if (preluActivationWeights != null) {\n const targetShape =\n getShapeForBatchMatMul(preluActivationWeights.shape, isChannelsLast);\n if (targetShape != null) {\n preluActivationWeights = reshape({\n inputs: {x: preluActivationWeights},\n backend,\n attrs: {shape: targetShape}\n });\n intermediates.push(preluActivationWeights);\n }\n }\n\n if (bias != null) {\n const targetShape = getShapeForBatchMatMul(bias.shape, isChannelsLast);\n if (targetShape != null) {\n bias = reshape({inputs: {x: bias}, backend, attrs: {shape: targetShape}});\n intermediates.push(bias);\n }\n }\n\n const transposeA = isChannelsLast ? false : true;\n const transposeB = false;\n const result = batchMatMulImpl({\n a: isChannelsLast ? x2Col : filterReshaped,\n b: isChannelsLast ? filterReshaped : x2Col,\n transposeA,\n transposeB,\n backend,\n bias,\n activation,\n preluActivationWeights,\n leakyreluAlpha\n });\n const out = reshape(\n {inputs: {x: result}, backend, attrs: {shape: convInfo.outShape}});\n intermediates.push(result);\n for (const i of intermediates) {\n backend.disposeData(i.dataId);\n }\n\n return out;\n}\n\nexport function conv2DImpl({\n x,\n filter,\n convInfo,\n backend,\n bias = null,\n preluActivationWeights = null,\n leakyreluAlpha = 0,\n activation = null\n}: Conv2DConfig) {\n const hasBias = bias != null;\n const hasPreluActivationWeights = preluActivationWeights != null;\n const isChannelsLast = convInfo.dataFormat === 'channelsLast';\n const sameSize = isChannelsLast &&\n convInfo.filterHeight === convInfo.inHeight &&\n convInfo.filterWidth === convInfo.inWidth &&\n convInfo.padInfo.type === 'VALID';\n const useNaiveConv2d = env().getBool('WEBGPU_USE_NAIVE_CONV2D_DEBUG');\n\n if (!useNaiveConv2d &&\n (sameSize ||\n (convInfo.filterHeight === 1 && convInfo.filterWidth === 1 &&\n convInfo.dilationHeight === 1 && convInfo.dilationWidth === 1 &&\n convInfo.strideHeight === 1 && convInfo.strideWidth === 1 &&\n (convInfo.padInfo.type === 'SAME' ||\n convInfo.padInfo.type === 'VALID')))) {\n return conv2dByMatMul({\n x,\n filter,\n convInfo,\n backend,\n bias,\n activation,\n preluActivationWeights,\n leakyreluAlpha\n });\n }\n\n const thresholdFlagValue = env().getNumber(\n 'WEBGPU_THRESHOLD_TO_INCREASE_WORKGROUPS_FOR_MATMUL');\n const thresholdToIncreaseWorkgroups = thresholdFlagValue > 0 ?\n thresholdFlagValue : backend.thresholdToIncreaseWorkgroups;\n const workgroupsBy32x32 = convInfo.batchSize *\n Math.ceil((convInfo.outHeight * convInfo.outWidth) / 32) *\n Math.ceil(convInfo.outChannels / 32);\n if (env().getBool('WEBGPU_CONV_SEPARATE_IM2COL_SHADER') ||\n workgroupsBy32x32 <= thresholdToIncreaseWorkgroups) {\n return conv2dWithIm2Col({\n x,\n filter,\n convInfo,\n backend,\n bias,\n preluActivationWeights,\n leakyreluAlpha,\n activation\n });\n }\n\n let program: WebGPUProgram;\n const padInfo = [convInfo.padInfo.top, convInfo.padInfo.left];\n const dimensions = [\n {type: 'int32', data: [convInfo.filterHeight, convInfo.filterWidth]},\n {type: 'int32', data: [...padInfo]},\n {type: 'int32', data: [convInfo.strideHeight, convInfo.strideWidth]},\n {type: 'int32', data: [convInfo.dilationHeight, convInfo.dilationWidth]}\n ];\n if (useNaiveConv2d) {\n program = new Conv2DNaiveProgram(\n convInfo, hasBias, activation, hasPreluActivationWeights);\n } else {\n const dimAOuter = isChannelsLast ? convInfo.outHeight * convInfo.outWidth :\n convInfo.outChannels;\n const dimBOuter = isChannelsLast ? convInfo.outChannels :\n convInfo.outHeight * convInfo.outWidth;\n const dimInner =\n convInfo.filterHeight * convInfo.filterWidth * convInfo.inChannels;\n dimensions.push(\n {type: 'int32', data: [dimAOuter]}, {type: 'int32', data: [dimBOuter]},\n {type: 'int32', data: [dimInner]});\n\n // Experiments show that sequential access is more friendly for Intel GPUs.\n const sequentialAccessByThreads = backend.adapterInfo.isIntel();\n program = new Conv2DMMProgram(\n convInfo, dimAOuter, dimBOuter, dimInner, hasBias, activation,\n hasPreluActivationWeights, sequentialAccessByThreads);\n }\n\n const intermediates: TensorInfo[] = [];\n const inputVar: TensorInfo[] = [x, filter];\n if (hasBias) {\n if (!isChannelsLast && bias.shape.length === 1) {\n bias = reshape(\n {inputs: {x: bias}, backend, attrs: {shape: [bias.shape[0], 1, 1]}});\n intermediates.push(bias);\n }\n inputVar.push(bias);\n }\n if (hasPreluActivationWeights) {\n if (!isChannelsLast && preluActivationWeights.shape.length === 1) {\n preluActivationWeights = reshape({\n inputs: {x: preluActivationWeights},\n backend,\n attrs: {shape: [preluActivationWeights.shape[0], 1, 1]}\n });\n intermediates.push(preluActivationWeights);\n }\n inputVar.push(preluActivationWeights);\n }\n if (activation === 'leakyrelu') {\n dimensions.push({type: 'float32', data: [leakyreluAlpha]});\n program.uniforms += ' alpha : f32,';\n }\n const out = backend.runWebGPUProgram(program, inputVar, x.dtype, dimensions);\n for (const i of intermediates) {\n backend.disposeData(i.dataId);\n }\n return out;\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, Conv2D, Conv2DAttrs, Conv2DInputs, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\n\nimport {conv2DImpl} from './Conv2D_impl';\n\nexport function conv2d(\n args: {inputs: Conv2DInputs, attrs: Conv2DAttrs, backend: WebGPUBackend}) {\n const {inputs, attrs, backend} = args;\n const {x, filter} = inputs;\n const {strides, pad, dataFormat, dilations, dimRoundingMode} = attrs;\n const $dataFormat = backend_util.convertConv2DDataFormat(dataFormat);\n const convInfo = backend_util.computeConv2DInfo(\n x.shape as [number, number, number, number],\n filter.shape as [number, number, number, number], strides, dilations, pad,\n dimRoundingMode, false /* depthwise */, $dataFormat);\n return conv2DImpl({x, filter, convInfo, backend});\n}\n\nexport const conv2DConfig: KernelConfig = {\n kernelName: Conv2D,\n backendName: 'webgpu',\n kernelFunc: conv2d as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class Conv2DDerInputProgram implements WebGPUProgram {\n variableNames = ['dy', 'W'];\n uniforms =\n 'filterDims : vec2, pads : vec2, stride : vec2, outBackprop : vec4,';\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n workgroupSize: [number, number, number] = [64, 1, 1];\n isChannelsLast: boolean;\n size = true;\n\n constructor(convInfo: backend_util.Conv2DInfo) {\n this.outputShape = convInfo.inShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n this.isChannelsLast = convInfo.dataFormat === 'channelsLast';\n this.shaderKey = `conv2DDerInput_${this.isChannelsLast}`;\n }\n\n getUserCode(): string {\n const rowDim = this.isChannelsLast ? 1 : 2;\n const colDim = this.isChannelsLast ? 2 : 3;\n const channelDim = this.isChannelsLast ? 3 : 1;\n return `\n ${main('index')} {\n if(index < uniforms.size) {\n let coords = getCoordsFromIndex(index);\n let batch = coords[0];\n let d1 = coords[${channelDim}];\n\n let dyCorner = vec2(coords[${rowDim}], coords[${\n colDim}]) - uniforms.pads;\n let dyRCorner = dyCorner.x;\n let dyCCorner = dyCorner.y;\n\n // Convolve dy(?, ?, d2) with w(:, :, d1, d2) to compute dx(xR, xC, d1).\n // ? = to be determined. : = across all values in that axis.\n var dotProd = 0.0;\n for (var wR = 0; wR < uniforms.filterDims.x; wR = wR + 1) {\n let dyR = (f32(dyRCorner) + f32(wR)) / f32(uniforms.stride.x);\n let wRPerm = uniforms.filterDims.x - 1 - wR;\n if (dyR < 0.0 || dyR >= f32(uniforms.outBackprop[1]) || fract(dyR) > 0.0 ||\n wRPerm < 0) {\n continue;\n }\n let idyR = i32(dyR);\n\n for (var wC = 0; wC < uniforms.filterDims.y; wC = wC + 1) {\n let dyC = (f32(dyCCorner) + f32(wC)) / f32(uniforms.stride.y);\n let wCPerm = uniforms.filterDims.y - 1 - wC;\n if (dyC < 0.0 || dyC >= f32(uniforms.outBackprop[2]) ||\n fract(dyC) > 0.0 || wCPerm < 0) {\n continue;\n }\n let idyC = i32(dyC);\n\n for (var d2 = 0; d2 < uniforms.outBackprop[3]; d2 = d2 + 1) {\n if (${this.isChannelsLast}) {\n let xValue = getDy(batch, idyR, idyC, d2);\n let wValue = getW(wRPerm, wCPerm, d1, d2);\n dotProd = dotProd + xValue * wValue;\n } else {\n let xValue = getDy(batch, d2, idyR, idyC);\n let wValue = getW(wRPerm, wCPerm, d1, d2);\n dotProd = dotProd + xValue * wValue;\n }\n\n }\n }\n }\n setOutputAtIndex(index, dotProd);\n }\n }\n `;\n }\n}\n\nexport class Conv2DDerFilterProgram implements WebGPUProgram {\n variableNames = ['x', 'dy'];\n uniforms =\n 'pad : vec2, stride : vec2, batchSize : i32, outHeight : i32, outWidth : i32, inHeight : i32, inWidth : i32,';\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n workgroupSize: [number, number, number] = [64, 1, 1];\n isChannelsLast: boolean;\n size = true;\n\n constructor(convInfo: backend_util.Conv2DInfo) {\n this.outputShape = convInfo.filterShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n this.isChannelsLast = convInfo.dataFormat === 'channelsLast';\n this.shaderKey = `conv2DDerFilter_${this.isChannelsLast}`;\n }\n\n getUserCode(): string {\n return `\n ${main('index')} {\n if(index < uniforms.size) {\n let coords = getCoordsFromIndex(index);\n let wR = coords[0];\n let wC = coords[1];\n let d1 = coords[2];\n let d2 = coords[3];\n\n // Convolve x(?, ?, d1) with dy(:, :, d2) to get dw(wR, wC, d1, d2).\n // ? = to be determined. : = across all values in that axis.\n var dotProd = 0.0;\n for (var b = 0; b < uniforms.batchSize; b = b + 1) {\n for (var yR = 0; yR < uniforms.outHeight; yR = yR + 1) {\n let xR = wR + yR * uniforms.stride[0] - uniforms.pad[0];\n if (xR < 0 || xR >= uniforms.inHeight) {\n continue;\n }\n\n for (var yC = 0; yC < uniforms.outWidth; yC = yC + 1) {\n let xC = wC + yC * uniforms.stride[1] - uniforms.pad[1];\n\n if (xC < 0 || xC >= uniforms.inWidth) {\n continue;\n }\n\n if (${this.isChannelsLast}) {\n let dyValue = getDy(b, yR, yC, d2);\n let xValue = getX(b, xR, xC, d1);\n dotProd = dotProd + xValue * dyValue;\n } else {\n let dyValue = getDy(b, d2, yR, yC);\n let xValue = getX(b, d1, xR, xC);\n dotProd = dotProd + xValue * dyValue;\n }\n }\n }\n }\n setOutputAtIndex(index, dotProd);\n }\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, Conv2DBackpropFilter, Conv2DBackpropFilterAttrs, Conv2DBackpropFilterInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {Conv2DDerFilterProgram} from '../conv_backprop_webgpu';\n\nexport function conv2DBackpropFilter(args: {\n inputs: Conv2DBackpropFilterInputs,\n backend: WebGPUBackend,\n attrs: Conv2DBackpropFilterAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x, dy} = inputs;\n const {strides, pad, dataFormat, dimRoundingMode, filterShape} = attrs;\n\n const $dataFormat = backend_util.convertConv2DDataFormat(dataFormat);\n const convInfo = backend_util.computeConv2DInfo(\n x.shape as [number, number, number, number], filterShape, strides,\n 1 /* dilations */, pad, dimRoundingMode, false /* depthwise */,\n $dataFormat);\n\n const program = new Conv2DDerFilterProgram(convInfo);\n const uniformData = [\n {type: 'int32', data: [convInfo.padInfo.top, convInfo.padInfo.left]},\n {type: 'int32', data: [convInfo.strideHeight, convInfo.strideWidth]},\n {type: 'int32', data: [convInfo.batchSize]},\n {type: 'int32', data: [convInfo.outHeight]},\n {type: 'int32', data: [convInfo.outWidth]},\n {type: 'int32', data: [convInfo.inHeight]},\n {type: 'int32', data: [convInfo.inWidth]}\n ];\n return backend.runWebGPUProgram(program, [x, dy], x.dtype, uniformData);\n}\n\nexport const conv2DBackpropFilterConfig: KernelConfig = {\n kernelName: Conv2DBackpropFilter,\n backendName: 'webgpu',\n kernelFunc: conv2DBackpropFilter as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, util} from '@tensorflow/tfjs-core';\nimport {typeSnippet} from './activation_util';\nimport {makeMatMulPackedSource, makeMatMulPackedVec4Source} from './matmul_packed_webgpu';\nimport {WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, computeWorkgroupSizeForConv2d, computeWorkPerThreadForConv2d} from './webgpu_util';\n\nfunction conv2dTransposeCommonSnippet(innerElementSize = 4) {\n const getWSnippet = (innerElementSize: number) => {\n switch (innerElementSize) {\n case 1:\n return 'return W[getIndexFromCoords4D(coord, uniforms.wShape)];';\n case 4:\n return `\n let coord1 = vec4(coordX, coordY, col + 1, rowInner);\n let coord2 = vec4(coordX, coordY, col + 2, rowInner);\n let coord3 = vec4(coordX, coordY, col + 3, rowInner);\n let v0 = W[getIndexFromCoords4D(coord, uniforms.wShape)];\n let v1 = W[getIndexFromCoords4D(coord1, uniforms.wShape)];\n let v2 = W[getIndexFromCoords4D(coord2, uniforms.wShape)];\n let v3 = W[getIndexFromCoords4D(coord3, uniforms.wShape)];\n return vec4(v0, v1, v2, v3);\n `;\n default:\n throw new Error(\n `innerElementSize ${innerElementSize} is not supported.`);\n }\n };\n\n const readASnippet = `\n let outRow = row / uniforms.outShape[2];\n let outCol = row % uniforms.outShape[2];\n\n let WRow = col / (uniforms.filterDims[1] * uniforms.outBackprop[3]);\n let WCol = col / uniforms.outBackprop[3] % uniforms.filterDims[1];\n let xR = f32(outRow - uniforms.pads[0] + WRow) / f32(uniforms.stride[0]);\n let xC = f32(outCol - uniforms.pads[1] + WCol) / f32(uniforms.stride[1]);\n if (xR < 0.0 || xR >= f32(uniforms.outBackprop[1]) || fract(xR) > 0.0) {\n return ${typeSnippet(innerElementSize)}(0.0);\n }\n if (xC < 0.0 || xC >= f32(uniforms.outBackprop[2]) || fract(xC) > 0.0) {\n return ${typeSnippet(innerElementSize)}(0.0);\n }\n let coord = vec4(\n batch,\n i32(xR),\n i32(xC),\n col % uniforms.outBackprop[3]);\n return x[getIndexFromCoords4D(coord, uniforms.xShape)/${\n innerElementSize}];`;\n\n const sampleA = `if (row < uniforms.dimAOuter && col < uniforms.dimInner) {\n ${readASnippet}\n }\n return ${typeSnippet(innerElementSize)}(0.0);`;\n\n const userCode = `\n fn mm_readA(batch: i32, row : i32, colIn : i32) -> ${\n typeSnippet(innerElementSize)} {\n let col = colIn * ${innerElementSize};\n ${sampleA}\n }\n\n fn mm_readB(batch: i32, row : i32, colIn : i32) -> ${\n typeSnippet(innerElementSize)} {\n let col = colIn * ${innerElementSize};\n let coordX = uniforms.filterDims.x - 1 -\n row / (uniforms.filterDims[1] * uniforms.outBackprop[3]);\n let coordY = uniforms.filterDims.y - 1 -\n (row / uniforms.outBackprop[3]) % uniforms.filterDims[1];\n if (row < uniforms.dimInner && col < uniforms.dimBOuter &&\n coordX >= 0 && coordY >= 0) {\n let rowInner = row % uniforms.outBackprop[3];\n let coord = vec4(coordX, coordY, col, rowInner);\n ${getWSnippet(innerElementSize)}\n }\n return ${typeSnippet(innerElementSize)}(0.0);\n }\n\n fn mm_write(batch: i32, row : i32, colIn : i32, valueInput : ${\n typeSnippet(innerElementSize)}) {\n let col = colIn * ${innerElementSize};\n if (row < uniforms.dimAOuter && (col + ${\n innerElementSize - 1}) < uniforms.dimBOuter) {\n var value = valueInput;\n let outCoord = vec4(\n batch,\n row / uniforms.outShape[2],\n row % uniforms.outShape[2],\n col);\n result[getIndexFromCoords4D(outCoord, uniforms.outShape)/${\n innerElementSize}] = value;\n }\n }`;\n return userCode;\n}\n\nexport class Conv2DDerInputMMProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[], y: number[], z: number[]};\n dispatch: [number, number, number];\n variableNames = ['x', 'W'];\n variableTypes: string[];\n uniforms =\n 'filterDims : vec2, pads : vec2, stride : vec2, outBackprop : vec4, dimAOuter : i32, dimBOuter : i32, dimInner : i32,';\n workgroupSize: [number, number, number];\n elementsPerThread: [number, number, number];\n isVec4?: boolean;\n\n constructor(convInfo: backend_util.Conv2DInfo) {\n this.outputShape = convInfo.inShape;\n\n util.assert(\n convInfo.dataFormat === 'channelsLast',\n () => 'TODO: NCHW is unimplemented');\n this.isVec4 =\n convInfo.inChannels % 4 === 0 && convInfo.outChannels % 4 === 0;\n this.dispatchLayout = {x: [3], y: [1, 2], z: [0]};\n this.workgroupSize = computeWorkgroupSizeForConv2d(\n this.dispatchLayout, this.outputShape, this.isVec4);\n this.elementsPerThread = computeWorkPerThreadForConv2d(\n this.dispatchLayout, this.outputShape, this.isVec4);\n\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize,\n this.elementsPerThread);\n\n if (this.isVec4) {\n this.variableTypes = ['vec4', 'f32'];\n }\n\n this.shaderKey =\n `conv2DDerInputMM_${this.isVec4}_${this.elementsPerThread}`;\n }\n\n getUserCode(): string {\n const matMulSource = this.isVec4 ?\n makeMatMulPackedVec4Source(this.elementsPerThread, this.workgroupSize) :\n makeMatMulPackedSource(this.elementsPerThread, this.workgroupSize);\n const userCode = `\n ${conv2dTransposeCommonSnippet(this.isVec4 ? 4 : 1)}\n ${matMulSource}\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, Conv2DBackpropInput, Conv2DBackpropInputAttrs, Conv2DBackpropInputInputs, env, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {Conv2DDerInputMMProgram} from '../conv_backprop_mm_webgpu';\nimport {Conv2DDerInputProgram} from '../conv_backprop_webgpu';\n\nexport function conv2DBackpropInput(args: {\n inputs: Conv2DBackpropInputInputs,\n attrs: Conv2DBackpropInputAttrs,\n backend: WebGPUBackend\n}) {\n const {inputs, backend, attrs} = args;\n const {dy, filter} = inputs;\n const {inputShape, strides, pad, dataFormat, dimRoundingMode} = attrs;\n\n const $dataFormat = backend_util.convertConv2DDataFormat(dataFormat);\n const convInfo = backend_util.computeConv2DInfo(\n inputShape, filter.shape as [number, number, number, number], strides,\n 1 /* dilations */, pad, dimRoundingMode, false, $dataFormat);\n\n const dimensions = [\n {type: 'int32', data: [convInfo.filterHeight, convInfo.filterWidth]},\n {\n type: 'int32',\n data: [\n convInfo.filterHeight - 1 - convInfo.padInfo.top,\n convInfo.filterWidth - 1 - convInfo.padInfo.left\n ]\n },\n {type: 'int32', data: [convInfo.strideHeight, convInfo.strideWidth]},\n {\n type: 'int32',\n data: [\n convInfo.batchSize, convInfo.outHeight, convInfo.outWidth,\n convInfo.outChannels\n ]\n },\n ];\n let program: Conv2DDerInputProgram|Conv2DDerInputMMProgram;\n // When filter size is small, Conv2DDerInputProgram is much faster than\n // Conv2DDerInputMMProgram.\n if (env().getBool('WEBGPU_USE_NAIVE_CONV2D_TRANSPOSE') ||\n convInfo.filterHeight <= 2 && convInfo.filterWidth <= 2 &&\n convInfo.outChannels <= 16 && convInfo.inChannels === 1) {\n program = new Conv2DDerInputProgram(convInfo);\n } else {\n program = new Conv2DDerInputMMProgram(convInfo);\n const dimAOuter = convInfo.inHeight * convInfo.inWidth;\n const dimBOuter = convInfo.inChannels;\n const dimInner =\n convInfo.filterHeight * convInfo.filterWidth * convInfo.outChannels;\n dimensions.push(\n {type: 'uint32', data: [dimAOuter]},\n {type: 'uint32', data: [dimBOuter]},\n {type: 'uint32', data: [dimInner]});\n }\n return backend.runWebGPUProgram(program, [dy, filter], 'float32', dimensions);\n}\n\nexport const conv2DBackpropInputConfig: KernelConfig = {\n kernelName: Conv2DBackpropInput,\n backendName: 'webgpu',\n kernelFunc: conv2DBackpropInput as unknown as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Cos, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const cos = unaryKernelFunc({opType: UnaryOpType.COS});\n\nexport const cosConfig: KernelConfig = {\n kernelName: Cos,\n backendName: 'webgpu',\n kernelFunc: cos\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Cosh, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const cosh = unaryKernelFunc({opType: UnaryOpType.COSH});\n\nexport const coshConfig: KernelConfig = {\n kernelName: Cosh,\n backendName: 'webgpu',\n kernelFunc: cosh\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class CropAndResizeProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames = ['Image', 'Boxes', 'BoxInd'];\n uniforms = 'extrapolationValue : f32,';\n workgroupSize: [number, number, number] = [64, 1, 1];\n methodId: number;\n cropHeightBiggerThan1: boolean;\n cropWidthBiggerThan1: boolean;\n size = true;\n\n constructor(\n channnel: number, boxShape: [number, number], cropSize: [number, number],\n method: 'bilinear'|'nearest') {\n const [numBoxes, ] = boxShape;\n this.outputShape = [numBoxes, cropSize[0], cropSize[1], channnel];\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n\n this.methodId = method === 'bilinear' ? 1 : 0;\n this.cropHeightBiggerThan1 = this.outputShape[1] > 1;\n this.cropWidthBiggerThan1 = this.outputShape[2] > 1;\n this.shaderKey = `cropAndResize_${this.methodId}_${\n this.cropHeightBiggerThan1}_${this.cropWidthBiggerThan1}`;\n }\n\n getUserCode(): string {\n const [inputHeightFloat, inputWidthFloat] =\n [`f32(uniforms.imageShape[1] - 1)`, `f32(uniforms.imageShape[2] - 1)`];\n\n const [heightRatio, heightScale, inY] = this.cropHeightBiggerThan1 ?\n [\n `(${inputHeightFloat} / f32(uniforms.outShape[1] - 1))`,\n '(y2-y1) * height_ratio',\n `y1*${inputHeightFloat} + f32(y)*(height_scale)`,\n ] :\n [\n '0.0',\n '0.0',\n `0.5 * (y1+y2) * ${inputHeightFloat}`,\n ];\n const [widthRatio, widthScale, inX] = this.cropWidthBiggerThan1 ?\n [\n `(${inputWidthFloat} / f32(uniforms.outShape[2] - 1))`,\n '(x2-x1) * width_ratio',\n `x1*${inputWidthFloat} + f32(x)*(width_scale)`,\n ] :\n [\n '0.0',\n '0.0',\n `0.5 * (x1+x2) * ${inputWidthFloat}`,\n ];\n\n // Reference implementation\n // tslint:disable-next-line:max-line-length\n // https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/kernels/crop_and_resize_op_gpu.cu.cc\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n let coords = getCoordsFromIndex(index);\n let height_ratio = f32(${heightRatio});\n let width_ratio = f32(${widthRatio});\n let b = coords[0];\n let y = coords[1];\n let x = coords[2];\n let d = coords[3];\n // get box vals\n let y1 = getBoxes(b, 0);\n let x1 = getBoxes(b, 1);\n let y2 = getBoxes(b, 2);\n let x2 = getBoxes(b, 3);\n // get image in batch index\n let bInd = i32(round(getBoxInd(b)));\n if(bInd < 0 || bInd >= uniforms.outShape[0]) {\n return;\n }\n let height_scale = ${heightScale};\n let width_scale = ${widthScale};\n let in_y = ${inY};\n if( in_y < 0.0 || in_y > ${inputHeightFloat} ) {\n setOutputAtIndex(index, uniforms.extrapolationValue);\n return;\n }\n let in_x = ${inX};\n if( in_x < 0.0 || in_x > ${inputWidthFloat} ) {\n setOutputAtIndex(index, uniforms.extrapolationValue);\n return;\n }\n let sourceFracIndexCR = vec2(in_x,in_y);\n if(${this.methodId} == 1) {\n // Compute the four integer indices.\n let sourceFloorCR = vec2(sourceFracIndexCR);\n let sourceCeilCR = vec2(ceil(sourceFracIndexCR));\n let topLeft = getImage(bInd, sourceFloorCR.y, sourceFloorCR.x, d);\n let bottomLeft = getImage(bInd, sourceCeilCR.y, sourceFloorCR.x, d);\n let topRight = getImage(bInd, sourceFloorCR.y, sourceCeilCR.x, d);\n let bottomRight = getImage(bInd, sourceCeilCR.y, sourceCeilCR.x, d);\n let fracCR = sourceFracIndexCR - vec2(sourceFloorCR);\n let top = topLeft + (topRight - topLeft) * fracCR.x;\n let bottom = bottomLeft + (bottomRight - bottomLeft) * fracCR.x;\n let newValue = top + (bottom - top) * fracCR.y;\n setOutputAtIndex(index, newValue);\n } else {\n // Compute the coordinators of nearest neighbor point.\n let sourceNearestCR = vec2(floor(\n sourceFracIndexCR + vec2(0.5,0.5)));\n let newValue = getImage(\n bInd, sourceNearestCR.y, sourceNearestCR.x, d);\n setOutputAtIndex(index, newValue);\n }\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {CropAndResize, CropAndResizeAttrs, CropAndResizeInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {CropAndResizeProgram} from '../crop_and_resize_webgpu';\n\nexport const cropAndResize = (args: {\n inputs: CropAndResizeInputs,\n backend: WebGPUBackend,\n attrs: CropAndResizeAttrs\n}): TensorInfo => {\n const {inputs, backend, attrs} = args;\n const {image, boxes, boxInd} = inputs;\n const {cropSize, method, extrapolationValue} = attrs;\n\n const program = new CropAndResizeProgram(\n image.shape[3], boxes.shape as [number, number], cropSize, method);\n const uniformData = [{type: 'float32', data: [extrapolationValue]}];\n return backend.runWebGPUProgram(\n program, [image, boxes, boxInd], 'float32', uniformData);\n};\n\nexport const cropAndResizeConfig: KernelConfig = {\n kernelName: CropAndResize,\n backendName: 'webgpu',\n kernelFunc: cropAndResize as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport enum CumOpType {\n Prod = '*',\n Sum = '+',\n}\n\nexport class CumProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames = ['x'];\n workgroupSize: [number, number, number];\n // pow(i32, i32) is not supported, use pow(f32, f32) instead.\n uniforms = 'index : f32,';\n size = true;\n exclusive: boolean;\n reverse: boolean;\n op: CumOpType;\n\n constructor(\n op: CumOpType, shape: number[], exclusive: boolean, reverse: boolean) {\n this.workgroupSize = [128, 1, 1];\n this.outputShape = shape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n this.exclusive = exclusive;\n this.reverse = reverse;\n this.op = op;\n this.shaderKey = `cum_${this.op}_${this.exclusive}_${this.reverse}`;\n }\n\n getUserCode(): string {\n const rank = this.outputShape.length;\n const initVal = this.op === CumOpType.Prod ? '1.0' : '0.0';\n const val = this.exclusive ? initVal :\n `getX(${getCoords(rank, 'coords', this.op)})`;\n const length = this.outputShape[this.outputShape.length - 1];\n let condition = '';\n let idxString = '';\n // When exclusive is set, the cum op becomes roll op that copies the\n // value from the previous index based on the direction specified by the\n // reverse flag.\n if (this.exclusive) {\n condition = this.reverse ? `end != ${length - 1}` : 'end != 0';\n idxString = this.reverse ? 'end + 1' : 'end - 1';\n } else {\n condition = this.reverse ? `end + pow2 < ${length}` : 'end >= pow2';\n idxString = (this.reverse ? 'end + pow2' : 'end - pow2');\n }\n return `\n ${main('index')} {\n if (index < uniforms.size) {\n var coords = getCoordsFromIndex(index);\n\n let end = ${getFinalCoord(rank, 'coords', this.op)};\n var val = ${val};\n let pow2 = i32(pow(2.0, uniforms.index));\n if (${condition}) {\n let idx = ${idxString};\n ${getFinalCoord(rank, 'coords', this.op)} = idx;\n val ${this.op}= getX(${getCoords(rank, 'coords', this.op)});\n }\n setOutputAtIndex(index, val);\n }\n }\n `;\n }\n}\n\nfunction getCoords(rank: number, name: string, op: CumOpType): string {\n if (rank === 1) {\n return `${name}`;\n } else if (rank === 2) {\n return `${name}.x, ${name}.y`;\n } else if (rank === 3) {\n return `${name}.x, ${name}.y, ${name}.z`;\n } else if (rank === 4) {\n return `${name}.x, ${name}.y, ${name}.z, ${name}.w`;\n } else {\n throw Error(`Cumulative ${op} for rank ${rank} is not yet supported`);\n }\n}\n\nfunction getFinalCoord(rank: number, name: string, op: CumOpType): string {\n if (rank === 1) {\n return `${name}`;\n } else if (rank === 2) {\n return `${name}.y`;\n } else if (rank === 3) {\n return `${name}.z`;\n } else if (rank === 4) {\n return `${name}.w`;\n } else {\n throw Error(`Cumulative ${op} for rank ${rank} is not yet supported`);\n }\n}\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {CumOpType, CumProgram} from '../cum_webgpu';\n\nimport {identity} from './Identity';\nimport {transpose} from './Transpose';\n\nexport function cumImpl(\n op: CumOpType, x: TensorInfo, backend: WebGPUBackend, axis: number,\n exclusive: boolean, reverse: boolean): TensorInfo {\n const xRank = x.shape.length;\n const permutation = backend_util.getAxesPermutation([axis], xRank);\n let permutedX = x;\n if (permutation != null) {\n permutedX = transpose({inputs: {x}, backend, attrs: {perm: permutation}});\n }\n const permutedAxis = backend_util.getInnerMostAxes(1, xRank)[0];\n\n if (permutedAxis !== xRank - 1) {\n throw new Error(\n `WebGPU cumprod shader expects an inner-most axis=${\n x.shape.length - 1} ` +\n `but got axis=${axis}`);\n }\n const size = permutedX.shape[permutedAxis];\n let result = identity({inputs: {x: permutedX}, backend});\n // Use cum parallel algorithm, inspired by:\n // https://developer.nvidia.com/gpugems/gpugems3/part-vi-gpu-computing/chapter-39-parallel-prefix-sum-scan-cuda\n // Note: although the algorithm is called sum, it works for any associtative\n // operator with an identity.\n\n for (let i = 0; i <= Math.ceil(Math.log2(size)) - 1; i++) {\n const program = new CumProgram(op, permutedX.shape, false, reverse);\n const prevResult = result;\n const uniformData = [{type: 'float32', data: [i]}];\n result =\n backend.runWebGPUProgram(program, [result], result.dtype, uniformData);\n backend.disposeData(prevResult.dataId);\n }\n // For exclusive cum, shift the end result in the direction of product or sum\n // and add 1 for product or 0 for sum to the front index.\n if (exclusive) {\n const program = new CumProgram(op, permutedX.shape, exclusive, reverse);\n const prevResult = result;\n const uniformData = [{type: 'float32', data: [0]}];\n result =\n backend.runWebGPUProgram(program, [result], result.dtype, uniformData);\n backend.disposeData(prevResult.dataId);\n }\n\n if (permutation != null) {\n const reversePermutation = backend_util.getUndoAxesPermutation(permutation);\n const reverseTransposedResult = transpose(\n {inputs: {x: result}, backend, attrs: {perm: reversePermutation}});\n\n backend.disposeData(result.dataId);\n backend.disposeData(permutedX.dataId);\n\n return reverseTransposedResult;\n }\n\n return result;\n}\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Cumprod, CumprodAttrs, CumprodInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {CumOpType} from '../cum_webgpu';\nimport {cumImpl} from './Cum_impl';\n\nexport function cumprod(\n args: {inputs: CumprodInputs, backend: WebGPUBackend, attrs: CumprodAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {axis, exclusive, reverse} = attrs;\n return cumImpl(CumOpType.Prod, x, backend, axis, exclusive, reverse);\n}\n\nexport const cumprodConfig: KernelConfig = {\n kernelName: Cumprod,\n backendName: 'webgpu',\n kernelFunc: cumprod as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Cumsum, CumsumAttrs, CumsumInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {CumOpType} from '../cum_webgpu';\nimport {cumImpl} from './Cum_impl';\n\nexport function cumsum(\n args: {inputs: CumsumInputs, backend: WebGPUBackend, attrs: CumsumAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {axis, exclusive, reverse} = attrs;\n return cumImpl(CumOpType.Sum, x, backend, axis, exclusive, reverse);\n}\n\nexport const cumsumConfig: KernelConfig = {\n kernelName: Cumsum,\n backendName: 'webgpu',\n kernelFunc: cumsum as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DenseBincount, DenseBincountAttrs, DenseBincountInputs, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {BincountProgram} from '../bincount_webgpu';\n\nimport {fill} from './Fill';\n\nexport function denseBincount(args: {\n inputs: DenseBincountInputs,\n backend: WebGPUBackend,\n attrs: DenseBincountAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x, weights} = inputs;\n const {size, binaryOutput} = attrs;\n\n const xRankOne = x.shape.length === 1;\n const weightsSize = util.sizeFromShape(weights.shape);\n const hasWeights = weightsSize > 0;\n const dtype = weights.dtype;\n const xSize: [number]|[number, number] =\n xRankOne ? [x.shape[0]] : [x.shape[0], x.shape[1]];\n const outputSize: [number]|[number, number] =\n xRankOne ? [size] : [x.shape[0], size];\n\n const output = fill({backend, attrs: {shape: outputSize, value: 0, dtype}});\n const program = new BincountProgram(xSize, hasWeights, binaryOutput);\n const uniformData = [{type: 'int32', data: [size]}];\n const bincountInputs: TensorInfo[] = hasWeights ? [x, weights] : [x];\n const res = backend.runWebGPUProgram(\n program, bincountInputs, dtype, uniformData, output);\n\n return res;\n}\n\nexport const denseBincountConfig: KernelConfig = {\n kernelName: DenseBincount,\n backendName: 'webgpu',\n kernelFunc: denseBincount as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class DepthToSpaceProgram implements WebGPUProgram {\n variableNames = ['x'];\n outputShape: number[];\n dataFormat: string;\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n workgroupSize: [number, number, number] = [64, 1, 1];\n size = true;\n uniforms = 'blockSize : i32,';\n\n constructor(outputShape: number[], dataFormat: 'NHWC'|'NCHW') {\n this.outputShape = outputShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n this.shaderKey = `depthToSpace_${dataFormat}`;\n this.dataFormat = dataFormat;\n }\n\n getUserCode(): string {\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n let coords = getCoordsFromIndex(index);\n let b = coords[0];\n let h = ${this.getHeightCoordString()};\n let w = ${this.getWidthCoordString()};\n let d = ${this.getDepthCoordString()};\n\n let in_h = h / uniforms.blockSize;\n let offset_h = h % uniforms.blockSize;\n let in_w = w / uniforms.blockSize;\n let offset_w = w % uniforms.blockSize;\n let offset_d = (offset_h * uniforms.blockSize + offset_w) *\n ${this.getOutputDepthSize()};\n let in_d = d + offset_d;\n\n let rlt = ${this.getInputSamplingString()};\n setOutputAtIndex(index, rlt);\n }\n }`;\n return userCode;\n }\n\n private getHeightCoordString(): string {\n if (this.dataFormat === 'NHWC') {\n return `coords[1]`;\n } else {\n return `coords[2]`;\n }\n }\n\n private getWidthCoordString(): string {\n if (this.dataFormat === 'NHWC') {\n return `coords[2]`;\n } else {\n return `coords[3]`;\n }\n }\n\n private getDepthCoordString(): string {\n if (this.dataFormat === 'NHWC') {\n return `coords[3]`;\n } else {\n return `coords[1]`;\n }\n }\n\n private getOutputDepthSize(): string {\n if (this.dataFormat === 'NHWC') {\n return `uniforms.outShape[3]`;\n } else {\n return `uniforms.outShape[1]`;\n }\n }\n\n private getInputSamplingString(): string {\n if (this.dataFormat === 'NHWC') {\n return `getX(b, in_h, in_w, in_d)`;\n } else {\n return `getX(b, in_d, in_h, in_w)`;\n }\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DepthToSpace, DepthToSpaceAttrs, DepthToSpaceInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {DepthToSpaceProgram} from '../depth_to_space_webgpu';\n\nexport function depthToSpace(args: {\n inputs: DepthToSpaceInputs,\n backend: WebGPUBackend,\n attrs: DepthToSpaceAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {blockSize, dataFormat} = attrs;\n\n const batchSize = x.shape[0];\n const inputHeight = (dataFormat === 'NHWC') ? x.shape[1] : x.shape[2];\n const inputWidth = (dataFormat === 'NHWC') ? x.shape[2] : x.shape[3];\n const inputDepth = (dataFormat === 'NHWC') ? x.shape[3] : x.shape[1];\n\n const outputHeight = inputHeight * blockSize;\n const outputWidth = inputWidth * blockSize;\n const outputDepth = inputDepth / (blockSize * blockSize);\n\n const outputShape = (dataFormat === 'NHWC') ?\n [batchSize, outputHeight, outputWidth, outputDepth] :\n [batchSize, outputDepth, outputHeight, outputWidth];\n\n const uniformData = [\n {type: 'int32', data: [blockSize]},\n ];\n\n const program = new DepthToSpaceProgram(outputShape, dataFormat);\n return backend.runWebGPUProgram(program, [x], x.dtype, uniformData);\n}\n\nexport const depthToSpaceConfig: KernelConfig = {\n kernelName: DepthToSpace,\n backendName: 'webgpu',\n kernelFunc: depthToSpace as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\n\nimport {activationFnSnippet, biasActivationSnippet} from './activation_util';\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch} from './webgpu_util';\n\nexport class DepthwiseConv2DNCHWSharedProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[], y: number[], z: number[]};\n dispatch: [number, number, number];\n variableNames = ['x', 'W'];\n uniforms = `pad : vec2, inDims : vec2,`;\n workgroupSize: [number, number, number] = [16, 16, 1];\n addBias: boolean;\n activation: backend_util.Activation;\n hasPreluActivation: boolean;\n filterHeight: number;\n filterWidth: number;\n\n constructor(\n outputShape: number[], filterHeight: number, filterWidth: number,\n addBias = false, activation: backend_util.Activation = null,\n hasPreluActivation = false) {\n this.outputShape = outputShape;\n this.dispatchLayout = {x: [3], y: [2], z: [0, 1]};\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n\n if (addBias) {\n this.variableNames.push('bias');\n }\n if (hasPreluActivation) {\n this.variableNames.push('preluActivationWeights');\n }\n\n this.addBias = addBias;\n this.activation = activation;\n this.hasPreluActivation = hasPreluActivation;\n this.filterHeight = filterHeight;\n this.filterWidth = filterWidth;\n this.shaderKey = `depthwiseNCHW_${this.activation}_${this.filterHeight}_${\n this.filterWidth}`;\n }\n\n getUserCode(): string {\n const filterSize = this.filterWidth * this.filterHeight;\n const flatWorkgroupSize =\n this.workgroupSize[0] * this.workgroupSize[1] * this.workgroupSize[2];\n const tileAHeight = this.workgroupSize[1] + this.filterHeight - 1;\n const tileAWidth = this.workgroupSize[0] + this.filterWidth - 1;\n\n const userCode = `\n ${\n activationFnSnippet(\n this.activation, this.hasPreluActivation, false, 4)}\n\n var mm_Asub : array, ${\n tileAHeight}>;\n var mm_Bsub : array, ${\n this.filterHeight}>;\n fn readX(batch : i32, channel : i32, row : i32, col : i32) -> f32 {\n var value = 0.0;\n if (row >=0 && row < uniforms.inDims[0] && col >=0 && col < uniforms.inDims[1])\n {\n value = getX(batch, channel, row, col);\n }\n return value;\n }\n\n ${main()} {\n let coords = getOutputCoords();\n let batch = coords[0];\n let xRCCorner = vec2(coords.zw) - uniforms.pad;\n let channelMul = uniforms.wShape[3];\n let d1 = coords[1] / channelMul;\n let q = coords[1] % channelMul;\n\n let inputRowStart = xRCCorner.x;\n let inputColStart = xRCCorner.y;\n\n let localRow = i32(localId.y);\n let localCol = i32(localId.x);\n\n // Load one tile of X into local memory.\n for (var inputRow = localRow; inputRow < ${\n tileAHeight}; inputRow = inputRow + ${this.workgroupSize[1]}) {\n for (var inputCol = localCol; inputCol < ${\n tileAWidth}; inputCol = inputCol + ${this.workgroupSize[0]}) {\n let rowOffset = inputRow - localRow;\n let colOffset = inputCol - localCol;\n mm_Asub[inputRow][inputCol] = readX(batch, d1, inputRowStart + rowOffset, inputColStart + colOffset);\n }\n }\n\n // Load one tile of W into local memory.\n var wIndex = i32(localIndex);\n ${\n filterSize < flatWorkgroupSize ?\n `if (wIndex < ${filterSize})` :\n `for(; wIndex < ${filterSize}; wIndex = wIndex + ${\n flatWorkgroupSize})`}\n\n {\n let wRow = wIndex / ${this.filterWidth};\n let wCol = wIndex % ${this.filterWidth};\n mm_Bsub[wRow][wCol] = getW(wRow, wCol, d1, q);\n }\n\n workgroupBarrier();\n\n var value = 0.0;\n for (var wR = 0; wR < ${this.filterHeight}; wR = wR + 1) {\n for (var wC = 0; wC < ${this.filterWidth}; wC = wC + 1) {\n let xVal = mm_Asub[localRow + wR][localCol + wC];\n let wVal = mm_Bsub[wR][wC];\n value = fma(xVal, wVal, value);\n }\n }\n ${biasActivationSnippet(this.addBias, this.activation)}\n if (coordsInBounds4D(coords, uniforms.outShape)) {\n setOutputAtCoords(coords[0], coords[1], coords[2], coords[3], value);\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, util} from '@tensorflow/tfjs-core';\nimport {activationFnSnippet, biasActivationSnippet} from './activation_util';\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch} from './webgpu_util';\n\nexport class DepthwiseConv2DVec4Program implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[], y: number[], z: number[]};\n dispatch: [number, number, number];\n variableNames = ['x', 'W'];\n uniforms = 'pad : vec2, inDims : vec2,';\n workgroupSize: [number, number, number] = [4, 4, 4];\n workPerThread = 4;\n convInfo: backend_util.Conv2DInfo;\n addBias: boolean;\n activation: backend_util.Activation;\n hasPreluActivation: boolean;\n isVec4 = true;\n\n constructor(\n convInfo: backend_util.Conv2DInfo, addBias = false,\n activation: backend_util.Activation = null, hasPreluActivation = false) {\n this.outputShape = convInfo.outShape;\n this.dispatchLayout = {x: [3], y: [2], z: [0, 1]};\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize,\n [4, this.workPerThread, 1]);\n\n util.assert(\n convInfo.dataFormat === 'channelsLast',\n () => 'TODO: NCHW is unimplemented');\n\n if (addBias) {\n this.variableNames.push('bias');\n }\n if (hasPreluActivation) {\n this.variableNames.push('preluActivationWeights');\n }\n\n this.convInfo = convInfo;\n this.addBias = addBias;\n this.activation = activation;\n this.hasPreluActivation = hasPreluActivation;\n\n this.shaderKey =\n `depthwiseVec4_${activation}_${this.convInfo.filterHeight}_${\n this.convInfo.filterWidth}_${this.convInfo.strideHeight}_${\n this.convInfo.strideWidth}_${this.workPerThread}`;\n }\n\n getUserCode(): string {\n const xNumber = (this.workPerThread - 1) * this.convInfo.strideWidth +\n this.convInfo.filterWidth;\n const strideHeight = this.convInfo.strideHeight;\n const strideWidth = this.convInfo.strideWidth;\n\n const userCode = `\n ${activationFnSnippet(this.activation, this.hasPreluActivation, true, 4)}\n fn readX(batch : i32, row : i32, col : i32, channel : i32) -> vec4 {\n var value = vec4(0.0);\n if (col >=0 && col < uniforms.inDims[1]) {\n value = getX(batch, row, col, channel);\n }\n return value;\n }\n\n ${main()} {\n let batch = i32(globalId.z) / uniforms.outShape[1];\n let r = i32(globalId.z) % uniforms.outShape[1];\n let c = i32(globalId.y) * ${this.workPerThread};\n let d1 = i32(globalId.x) * 4;\n let xRCCorner = vec2(r, c) * vec2(${strideHeight}, ${strideWidth}) - uniforms.pad;\n\n let xRCorner = xRCCorner.x;\n let xCCorner = xRCCorner.y;\n var xVals : array, ${xNumber}>;\n var dotProd : array, ${this.workPerThread}>;\n for (var i = 0; i < ${this.workPerThread}; i++) {\n dotProd[i] = vec4(0.0);\n }\n\n // Use constant instead of uniform can give better performance.\n for (var wR = 0; wR < ${this.convInfo.filterHeight}; wR = wR + 1) {\n let xR = xRCorner + wR;\n if (xR >=0 && xR < uniforms.inDims[0]) {\n for (var i = 0; i < ${xNumber}; i++) {\n xVals[i] = readX(batch, xR, xCCorner + i, d1);\n }\n for (var wC = 0; wC < ${this.convInfo.filterWidth}; wC = wC + 1) {\n let wValue = getW(wR, wC, d1, 0);\n for (var i = 0; i < ${this.workPerThread}; i++) {\n dotProd[i] = fma(xVals[i * ${strideWidth} + wC], wValue, dotProd[i]);\n }\n }\n }\n }\n\n for (var i = 0; i < ${this.workPerThread}; i = i + 1) {\n let coords = vec4(batch, r, c + i, d1);\n if (coordsInBounds4D(coords, uniforms.outShape)) {\n var value = dotProd[i];\n ${biasActivationSnippet(this.addBias, this.activation)}\n setOutputAtCoords(coords[0], coords[1], coords[2], coords[3], value);\n }\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\n\nimport {activationFnSnippet, biasActivationSnippet} from './activation_util';\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class DepthwiseConv2DProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[], y?: number[], z?: number[]};\n dispatch: [number, number, number];\n variableNames = ['x', 'W'];\n uniforms = `pad : vec2, inDims : vec2, filterHeight : i32,\n filterWidth : i32, stride : vec2, dilation : vec2,`;\n // This is an experimental value.\n workgroupSize: [number, number, number] = [256, 1, 1];\n convInfo: backend_util.Conv2DInfo;\n addBias: boolean;\n activation: backend_util.Activation;\n hasPreluActivation: boolean;\n isChannelsLast: boolean;\n size = true;\n\n constructor(\n convInfo: backend_util.Conv2DInfo, addBias = false,\n activation: backend_util.Activation = null, hasPreluActivation = false) {\n this.outputShape = convInfo.outShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n this.isChannelsLast = convInfo.dataFormat === 'channelsLast';\n\n if (addBias) {\n this.variableNames.push('bias');\n }\n if (hasPreluActivation) {\n this.variableNames.push('preluActivationWeights');\n }\n\n this.convInfo = convInfo;\n this.addBias = addBias;\n this.activation = activation;\n this.hasPreluActivation = hasPreluActivation;\n this.shaderKey = `depthwise_${this.activation}_${this.isChannelsLast}`;\n }\n\n getUserCode(): string {\n const getXSnippet = this.isChannelsLast ? 'getX(batch, xR, xC, d1);' :\n 'getX(batch, d1, xR, xC);';\n\n const userCode = `\n ${\n activationFnSnippet(\n this.activation, this.hasPreluActivation, false, 4)}\n\n ${main('index')} {\n if (index < uniforms.size) {\n let coords = getOutputCoords();\n let batch = coords[0];\n let xRCCorner = vec2(coords.${\n this.isChannelsLast ? 'yz' : 'zw'}) * uniforms.stride - uniforms.pad;\n let d2 = coords[${this.isChannelsLast ? 3 : 1}];\n let channelMul = uniforms.wShape[3];\n let d1 = d2 / channelMul;\n let q = d2 % channelMul;\n\n let inputRowStart = xRCCorner.x;\n let inputColStart = xRCCorner.y;\n let inputRowEnd = inputRowStart + uniforms.filterHeight *\n uniforms.dilation[0];\n let inputColEnd = inputColStart + uniforms.filterWidth *\n uniforms.dilation[1];\n\n // Convolve x(?, ?, d1)|x(d1, ?, ?) with w(:, :, d1, q) to get\n // y(yR, yC, d2)|y(d2, yR, yC). ? = to be determined. : = across all\n // values in that axis. x(?, ?, d1) and y(yR, yC, d2) is for NHWC.\n // x(d1, ?, ?) and y(d2, yR, yC) is for NCHW.\n var value = 0.0;\n\n // Extract if checking out of for loop for performance.\n if (inputRowStart >= 0 && inputColStart >= 0 &&\n inputRowEnd < uniforms.inDims[0] &&\n inputColEnd < uniforms.inDims[1]) {\n for (var wR = 0; wR < uniforms.filterHeight; wR = wR + 1) {\n let xR = inputRowStart + wR * uniforms.dilation[0];\n\n for (var wC = 0; wC < uniforms.filterWidth; wC = wC + 1) {\n let xC = inputColStart + wC * uniforms.dilation[1];\n\n let xVal = ${getXSnippet};\n let wVal = getW(wR, wC, d1, q);\n value = value + xVal * wVal;\n }\n }\n } else {\n for (var wR = 0; wR < uniforms.filterHeight; wR = wR + 1) {\n let xR = inputRowStart + wR * uniforms.dilation[0];\n\n if (xR < 0 || xR >= uniforms.inDims[0]) {\n continue;\n }\n\n for (var wC = 0; wC < uniforms.filterWidth; wC = wC + 1) {\n let xC = inputColStart + wC * uniforms.dilation[1];\n\n if (xC < 0 || xC >= uniforms.inDims[1]) {\n continue;\n }\n\n let xVal = ${getXSnippet};\n let wVal = getW(wR, wC, d1, q);\n value = value + xVal * wVal;\n }\n }\n }\n ${biasActivationSnippet(this.addBias, this.activation)}\n setOutputAtCoords(coords[0], coords[1], coords[2], coords[3], value);\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, DepthwiseConv2dNative, DepthwiseConv2dNativeAttrs, DepthwiseConv2dNativeInputs, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {DepthwiseConv2DNCHWSharedProgram} from '../depthwise_conv2d_nchw_shared_webgpu';\nimport {DepthwiseConv2DVec4Program} from '../depthwise_conv2d_vec4_webgpu';\nimport {DepthwiseConv2DProgram} from '../depthwise_conv2d_webgpu';\n\nexport function depthwiseConv2dNative(args: {\n inputs: DepthwiseConv2dNativeInputs,\n attrs: DepthwiseConv2dNativeAttrs,\n backend: WebGPUBackend\n}) {\n const {inputs, backend, attrs} = args;\n const {x, filter} = inputs;\n const {strides, pad, dataFormat, dilations, dimRoundingMode} = attrs;\n const $dataFormat = backend_util.convertConv2DDataFormat(dataFormat);\n let $dilations = dilations;\n if ($dilations == null) {\n $dilations = [1, 1];\n }\n\n const convInfo = backend_util.computeConv2DInfo(\n x.shape as [number, number, number, number],\n filter.shape as [number, number, number, number], strides, $dilations,\n pad, dimRoundingMode, true /* depthwise */, $dataFormat);\n const dimensions = [\n {type: 'int32', data: [convInfo.padInfo.top, convInfo.padInfo.left]},\n {type: 'int32', data: [convInfo.inHeight, convInfo.inWidth]},\n ];\n\n const isChannelsLast = convInfo.dataFormat === 'channelsLast';\n let program: DepthwiseConv2DProgram|DepthwiseConv2DVec4Program|\n DepthwiseConv2DNCHWSharedProgram;\n if (!isChannelsLast && convInfo.inHeight > 16 && convInfo.inWidth > 16 &&\n convInfo.strideHeight === 1 && convInfo.strideWidth === 1 &&\n convInfo.dilationWidth === 1 && convInfo.dilationHeight === 1 &&\n convInfo.inChannels === convInfo.outChannels) {\n program = new DepthwiseConv2DNCHWSharedProgram(\n convInfo.outShape, convInfo.filterHeight, convInfo.filterWidth);\n } else if (\n isChannelsLast && convInfo.outHeight > 4 && convInfo.outWidth > 4 &&\n convInfo.strideWidth <= 2 &&\n convInfo.inChannels === convInfo.outChannels &&\n convInfo.dilationHeight === 1 && convInfo.dilationWidth === 1 &&\n convInfo.inChannels % 4 === 0) {\n program = new DepthwiseConv2DVec4Program(convInfo);\n } else {\n program = new DepthwiseConv2DProgram(convInfo);\n dimensions.push(\n {type: 'int32', data: [convInfo.filterHeight]},\n {type: 'int32', data: [convInfo.filterWidth]},\n {type: 'int32', data: [convInfo.strideHeight, convInfo.strideWidth]}, {\n type: 'int32',\n data: [convInfo.dilationHeight, convInfo.dilationWidth]\n });\n }\n\n return backend.runWebGPUProgram(program, [x, filter], x.dtype, dimensions);\n}\n\nexport const depthwiseConv2dNativeConfig: KernelConfig = {\n kernelName: DepthwiseConv2dNative,\n backendName: 'webgpu',\n kernelFunc: depthwiseConv2dNative as unknown as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class DiagProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames = ['x'];\n workgroupSize: [number, number, number] = [64, 1, 1];\n size = true;\n\n constructor(size: number) {\n this.outputShape = [size, size];\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n\n this.shaderKey = 'diag';\n }\n\n getUserCode(): string {\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n let coords = getOutputCoords();\n let value = select(0.0, getX(coords[0]), coords[0] == coords[1]);\n setOutputAtIndex(index, value);\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Diag, DiagInputs, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {DiagProgram} from '../diag_webgpu';\nimport {reshape} from './Reshape';\n\nexport function diag(args: {inputs: DiagInputs, backend: WebGPUBackend}):\n TensorInfo {\n const {inputs, backend} = args;\n const {x} = inputs;\n\n const outShape = [...x.shape, ...x.shape];\n const xSize = util.sizeFromShape(x.shape);\n\n const flat = reshape({inputs: {x}, backend, attrs: {shape: [xSize]}});\n\n const program = new DiagProgram(xSize);\n const res = backend.runWebGPUProgram(program, [flat], flat.dtype);\n\n const out = reshape({inputs: {x: res}, backend, attrs: {shape: outShape}});\n\n backend.disposeData(flat.dataId);\n backend.disposeData(res.dataId);\n\n return out;\n}\n\nexport const diagConfig: KernelConfig = {\n kernelName: Diag,\n backendName: 'webgpu',\n kernelFunc: diag as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class Dilation2DProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames = ['x', 'w'];\n uniforms =\n 'filterDims: vec2, pad: vec2, stride: vec2, dilation: vec2';\n workgroupSize: [number, number, number] = [64, 1, 1];\n size = true;\n\n constructor(convInfo: backend_util.Conv2DInfo) {\n this.outputShape = convInfo.outShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n\n this.shaderKey = 'dilation2d';\n }\n\n getUserCode(): string {\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n let neg_infinity = -3.4e38;\n let coords = getOutputCoords();\n let batch = coords.x;\n let d1 = coords.w;\n let outTopLeftCorner = coords.yz * uniforms.stride - uniforms.pad;\n let hBeg = outTopLeftCorner.x;\n let wBeg = outTopLeftCorner.y;\n\n var curVal = neg_infinity;\n for (var h = 0; h < uniforms.filterDims[0]; h = h + 1) {\n let hIn = hBeg + h * uniforms.dilation[0];\n\n if (hIn >= 0 && hIn < uniforms.xShape[1]) {\n for (var w = 0; w < uniforms.filterDims[1]; w = w + 1) {\n let wIn = wBeg + w * uniforms.dilation[1];\n\n if (wIn >= 0 && wIn < uniforms.xShape[2]) {\n let val = getX(batch, hIn, wIn, d1) + getW(h, w, d1);\n if (val > curVal) {\n curVal = val;\n }\n }\n }\n }\n }\n\n setOutputAtIndex(index, curVal);\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, Dilation2D, Dilation2DAttrs, Dilation2DInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {Dilation2DProgram} from '../dilation_webgpu';\n\nexport function dilation2D(args: {\n inputs: Dilation2DInputs,\n attrs: Dilation2DAttrs,\n backend: WebGPUBackend\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x, filter} = inputs;\n const {strides, pad, dilations} = attrs;\n\n const convInfo = backend_util.computeDilation2DInfo(\n x.shape as [number, number, number, number],\n filter.shape as [number, number, number], strides, pad,\n 'NHWC' /* dataFormat */, dilations);\n const padInfo = [convInfo.padInfo.top, convInfo.padInfo.left];\n const uniformData = [\n {type: 'int32', data: [convInfo.filterHeight, convInfo.filterWidth]},\n {type: 'int32', data: [...padInfo]},\n {type: 'int32', data: [convInfo.strideHeight, convInfo.strideWidth]},\n {type: 'int32', data: [convInfo.dilationHeight, convInfo.dilationWidth]}\n ];\n\n const program = new Dilation2DProgram(convInfo);\n const out =\n backend.runWebGPUProgram(program, [x, filter], x.dtype, uniformData);\n\n return out;\n}\n\nexport const dilation2DConfig: KernelConfig = {\n kernelName: Dilation2D,\n backendName: 'webgpu',\n kernelFunc: dilation2D as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Multiply} from '@tensorflow/tfjs-core';\n\nimport {BinaryOpType} from '../binary_op_util';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {multiplyImplCPU as cpuMultiply} from '../kernel_utils/shared';\n\nexport const multiplyKernelFunc = binaryKernelFunc({\n opType: BinaryOpType.MUL,\n cpuKernelImpl: cpuMultiply,\n supportsComplex: true\n});\n\nexport const multiplyConfig: KernelConfig = {\n kernelName: Multiply,\n backendName: 'webgpu',\n kernelFunc: multiplyKernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Sum, SumAttrs, SumInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {reduce} from '../kernel_utils/reduce';\n\nexport function sum(\n args: {inputs: SumInputs, backend: WebGPUBackend, attrs: SumAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {axis, keepDims} = attrs;\n\n return reduce(x, axis, keepDims, 'sum', backend);\n}\n\nexport const sumConfig: KernelConfig = {\n kernelName: Sum,\n backendName: 'webgpu',\n kernelFunc: sum as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, Einsum, EinsumAttrs, EinsumInputs, KernelConfig, KernelFunc, Tensor, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\n\nimport {multiplyKernelFunc} from './Multiply';\nimport {reshape} from './Reshape';\nimport {sum} from './Sum';\nimport {transpose} from './Transpose';\n\nexport function einsum(\n args: {inputs: EinsumInputs, backend: WebGPUBackend, attrs: EinsumAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {equation} = attrs;\n const tensors = inputs as Tensor[];\n\n const {allDims, summedDims, idDims} =\n backend_util.decodeEinsumEquation(equation, tensors.length);\n backend_util.checkEinsumDimSizes(allDims.length, idDims, tensors);\n const {path, steps} = backend_util.getEinsumComputePath(summedDims, idDims);\n\n const nSteps = steps.length;\n let out: TensorInfo|null = null;\n let numDimsRemaining = allDims.length;\n const tensorsToDispose: TensorInfo[] = [];\n for (let i = 0; i < nSteps; ++i) {\n for (const idTerm of steps[i]) {\n const {permutationIndices: perm, expandDims: dimsToExpand} =\n backend_util.getEinsumPermutation(numDimsRemaining, idDims[idTerm]);\n let x: TensorInfo;\n if (backend_util.isIdentityPermutation(perm)) {\n x = tensors[idTerm];\n } else {\n x = transpose({inputs: {x: tensors[idTerm]}, backend, attrs: {perm}});\n tensorsToDispose.push(x);\n }\n const targetShape: number[] = x.shape.slice();\n for (let k = 0; k < dimsToExpand.length; ++k) {\n targetShape.splice(dimsToExpand[k], 0, 1);\n }\n\n if (!util.arraysEqual(x.shape, targetShape)) {\n x = reshape({inputs: {x}, backend, attrs: {shape: targetShape}});\n tensorsToDispose.push(x);\n }\n if (out === null) {\n out = x;\n } else {\n // tslint:disable-next-line: no-unnecessary-type-assertion\n out =\n multiplyKernelFunc({inputs: {a: x, b: out}, backend}) as TensorInfo;\n tensorsToDispose.push(out);\n }\n }\n if (i < nSteps - 1) {\n if (path[i] >= 0) {\n out = sum({\n inputs: {x: out},\n backend,\n attrs: {\n axis: path[i] - (allDims.length - numDimsRemaining),\n keepDims: false\n }\n });\n tensorsToDispose.push(out);\n }\n numDimsRemaining--;\n }\n }\n\n // Clean up intermediate tensors.\n for (const tensorInfo of tensorsToDispose) {\n if (tensorInfo === out) {\n continue;\n }\n backend.disposeData(tensorInfo.dataId);\n }\n\n return out;\n}\n\nexport const einsumConfig: KernelConfig = {\n kernelName: Einsum,\n backendName: 'webgpu',\n kernelFunc: einsum as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Elu, KernelConfig} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const elu = unaryKernelFunc({opType: UnaryOpType.ELU});\n\nexport const eluConfig: KernelConfig = {\n kernelName: Elu,\n backendName: 'webgpu',\n kernelFunc: elu\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Equal, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {BinaryOpType} from '../binary_op_util';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {equalImplCPU as cpuEqual} from '../kernel_utils/shared';\n\nexport const equal = binaryKernelFunc(\n {opType: BinaryOpType.EQUAL, dtype: 'bool', cpuKernelImpl: cpuEqual});\n\nexport const equalConfig: KernelConfig = {\n kernelName: Equal,\n backendName: 'webgpu',\n kernelFunc: equal\n};\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Erf, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const erf = unaryKernelFunc({opType: UnaryOpType.ERF});\n\nexport const erfConfig: KernelConfig = {\n kernelName: Erf,\n backendName: 'webgpu',\n kernelFunc: erf\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Exp, KernelConfig} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {expImplCPU} from '../kernel_utils/shared';\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const exp = unaryKernelFunc({\n opType: UnaryOpType.EXP,\n cpuKernelImpl: expImplCPU,\n dtype: 'float32',\n});\n\nexport const expConfig: KernelConfig = {\n kernelName: Exp,\n backendName: 'webgpu',\n kernelFunc: exp\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the License);\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an AS IS BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ExpandDims, ExpandDimsAttrs, ExpandDimsInputs, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {reshape} from './Reshape';\n\nexport function expandDims(args: {\n inputs: ExpandDimsInputs,\n attrs: ExpandDimsAttrs,\n backend: WebGPUBackend\n}): TensorInfo {\n const {inputs, attrs, backend} = args;\n const {dim} = attrs;\n const {input} = inputs;\n\n const inputRank = input.shape.length;\n const newShape = input.shape.slice();\n let $dim = dim;\n if (dim < 0) {\n // Negative value is counted from the tail of rank.\n util.assert(\n -(inputRank + 1) <= dim,\n () => `Axis must be in the interval [${- (inputRank + 1)}, ${\n inputRank}]`);\n $dim = inputRank + dim + 1;\n }\n newShape.splice($dim, 0, 1);\n\n return reshape({inputs: {x: input}, backend, attrs: {shape: newShape}});\n}\n\nexport const expandDimsConfig: KernelConfig = {\n kernelName: ExpandDims,\n backendName: 'webgpu',\n kernelFunc: expandDims as unknown as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Expm1, KernelConfig} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {expm1ImplCPU} from '../kernel_utils/shared';\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const expm1 =\n unaryKernelFunc({opType: UnaryOpType.EXPM1, cpuKernelImpl: expm1ImplCPU});\n\nexport const expm1Config: KernelConfig = {\n kernelName: Expm1,\n backendName: 'webgpu',\n kernelFunc: expm1\n};\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class FFTProgram implements WebGPUProgram {\n variableNames: string[] = ['real', 'imag'];\n outputShape: number[] = [];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n uniforms = 'exponentMultiplier : f32, denominator: f32,';\n workgroupSize: [number, number, number] = [64, 1, 1];\n size = true;\n component: string;\n\n constructor(component: 'real'|'imag', shape: [number, number]) {\n this.outputShape = shape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n\n this.component = component;\n this.shaderKey = `fft_${component}`;\n }\n\n getUserCode(): string {\n const opString = this.component === 'real' ?\n 'return real * expR - imag * expI;' :\n 'return real * expI + imag * expR;';\n const userCode = `\n fn unaryOpComplex(real: f32, expR: f32, imag: f32, expI: f32) -> f32 {\n ${opString}\n }\n\n fn mulMatDFT(batch: i32, index: i32) -> f32 {\n let indexRatio = f32(index) / f32(uniforms.realShape[1]);\n let exponentMultiplierTimesIndexRatio =\n uniforms.exponentMultiplier * indexRatio;\n\n var result = 0.0;\n\n for (var i = 0; i < uniforms.realShape[1]; i = i + 1) {\n // x = (-2|2 * PI / N) * index * i;\n let x = exponentMultiplierTimesIndexRatio * f32(i);\n let expR = cos(x);\n let expI = sin(x);\n let real = getReal(batch, i);\n let imag = getImag(batch, i);\n\n result = result +\n unaryOpComplex(real, expR, imag, expI) / uniforms.denominator;\n }\n\n return result;\n }\n\n ${main('index')} {\n if (index < uniforms.size) {\n let coords = getOutputCoords();\n setOutputAtIndex(index, mulMatDFT(coords[0], coords[1]));\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {FFTProgram} from '../fft_webgpu';\n\nimport {complex} from './Complex';\nimport {reshape} from './Reshape';\n\nexport function fftImpl(\n x: TensorInfo, inverse: boolean, backend: WebGPUBackend): TensorInfo {\n const xData = backend.tensorMap.get(x.dataId);\n\n const inputSize = util.sizeFromShape(x.shape);\n // Collapse all outer dimensions to a single batch dimension.\n const innerDimensionSize = x.shape[x.shape.length - 1];\n const batch = inputSize / innerDimensionSize;\n\n const toDispose = [];\n const input2D = reshape(\n {inputs: {x}, backend, attrs: {shape: [batch, innerDimensionSize]}});\n toDispose.push(input2D);\n\n const xShape = input2D.shape as [number, number];\n const realProgram = new FFTProgram('real', xShape);\n const imagProgram = new FFTProgram('imag', xShape);\n\n const inputs = [\n {\n dataId: xData.complexTensorInfos.real.dataId,\n dtype: xData.complexTensorInfos.real.dtype,\n shape: xShape\n },\n {\n dataId: xData.complexTensorInfos.imag.dataId,\n dtype: xData.complexTensorInfos.imag.dtype,\n shape: xShape\n }\n ];\n\n const exponentMultiplier = inverse ? 2.0 * Math.PI : -2.0 * Math.PI;\n const denominator = inverse ? xShape[1] : 1.0;\n const uniformData = [\n {type: 'float32', data: [exponentMultiplier]},\n {type: 'float32', data: [denominator]}\n ];\n\n const realPart =\n backend.runWebGPUProgram(realProgram, inputs, 'float32', uniformData);\n toDispose.push(realPart);\n const imagPart =\n backend.runWebGPUProgram(imagProgram, inputs, 'float32', uniformData);\n toDispose.push(imagPart);\n\n const complexOutput =\n complex({inputs: {real: realPart, imag: imagPart}, backend});\n toDispose.push(complexOutput);\n\n const complexOutputReshaped =\n reshape({inputs: {x: complexOutput}, backend, attrs: {shape: x.shape}});\n\n toDispose.forEach(t => backend.disposeData(t.dataId));\n\n return complexOutputReshaped;\n}\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {FFT, FFTInputs, KernelConfig, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\n\nimport {fftImpl} from './FFT_impl';\n\nexport function fft(args: {inputs: FFTInputs, backend: WebGPUBackend}):\n TensorInfo {\n const {inputs, backend} = args;\n const {input} = inputs;\n\n return fftImpl(input, false /* inverse */, backend);\n}\n\nexport const fftConfig: KernelConfig = {\n kernelName: FFT,\n backendName: 'webgpu',\n kernelFunc: fft\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class FlipLeftRightProgram implements WebGPUProgram {\n outputShape: number[] = [];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames = ['x'];\n workgroupSize: [number, number, number] = [64, 1, 1];\n size = true;\n\n constructor(imageShape: [number, number, number, number]) {\n this.outputShape = imageShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n this.shaderKey = 'flipLeftRight';\n }\n\n getUserCode(): string {\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n let coords = getCoordsFromIndex(index);\n let coordX = uniforms.xShape[2] - coords[2] - 1;\n let outputValue = getX(coords[0], coords[1], coordX, coords[3]);\n setOutputAtIndex(index, outputValue);\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Tensor4D} from '@tensorflow/tfjs-core';\nimport {FlipLeftRight, FlipLeftRightInputs} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {FlipLeftRightProgram} from '../flip_left_right_webgpu';\n\nexport const flipLeftRightConfig: KernelConfig = {\n kernelName: FlipLeftRight,\n backendName: 'webgpu',\n kernelFunc: ({inputs, backend}) => {\n const {image} = inputs as FlipLeftRightInputs;\n const webgpuBackend = backend as WebGPUBackend;\n\n const program = new FlipLeftRightProgram((image as Tensor4D).shape);\n const output =\n webgpuBackend.runWebGPUProgram(program, [image], image.dtype);\n return output;\n }\n};\n","\n/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Floor, KernelConfig} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {floorImplCPU} from '../kernel_utils/shared';\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const floor =\n unaryKernelFunc({opType: UnaryOpType.FLOOR, cpuKernelImpl: floorImplCPU});\n\nexport const floorConfig: KernelConfig = {\n kernelName: Floor,\n backendName: 'webgpu',\n kernelFunc: floor\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {FloorDiv, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {BinaryOpType} from '../binary_op_util';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nexport const floorDiv =\n binaryKernelFunc({opType: BinaryOpType.INT_DIV, dtype: 'int32'});\n\nexport const floorDivConfig: KernelConfig = {\n kernelName: FloorDiv,\n backendName: 'webgpu',\n kernelFunc: floorDiv\n};\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class FromPixelsProgram implements WebGPUProgram {\n dispatch: [number, number, number];\n dispatchLayout: {x: number[]};\n isFromPixels = true;\n outputShape: number[] = [0];\n shaderKey: string;\n importVideo: boolean;\n variableNames: string[] = [];\n workgroupSize: [number, number, number] =\n [256, 1, 1]; // The empirical value.\n\n constructor(outputShape: number[], numChannels: number, importVideo = false) {\n this.outputShape = outputShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize,\n [numChannels, 1, 1]);\n\n this.importVideo = importVideo;\n this.shaderKey = `fromPixels_${this.importVideo}`;\n }\n\n getUserCode(): string {\n const textureLoad = this.importVideo ?\n 'textureLoad(src, vec2(coords.yx));' :\n 'textureLoad(src, vec2(coords.yx), 0)';\n const textureType =\n this.importVideo ? 'texture_external' : 'texture_2d';\n return `\n @binding(1) @group(0) var src: ${textureType};\n ${main('index')} {\n let flatIndex = index * uniforms.numChannels;\n if (flatIndex < uniforms.size) {\n let coords = getCoordsFromIndex(flatIndex);\n let values = ${textureLoad};\n for (var i = 0; i < uniforms.numChannels; i = i + 1) {\n result[flatIndex + i] = i32(floor(255.0 * values[i]));\n }\n }\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use backend file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\nimport {FromPixels, FromPixelsAttrs, FromPixelsInputs, util} from '@tensorflow/tfjs-core';\nimport {backend_util, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {TextureInfo, WebGPUBackend} from '../backend_webgpu';\nimport {FromPixelsProgram} from '../from_pixels_webgpu';\n\nexport const fromPixelsConfig: KernelConfig = {\n kernelName: FromPixels,\n backendName: 'webgpu',\n kernelFunc: fromPixels as unknown as KernelFunc,\n};\n\nlet fromPixels2DContext: CanvasRenderingContext2D;\nlet willReadFrequently = env().getBool('CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU');\nconst videoToTextureMap = new Map();\n\nexport function fromPixels(args: {\n inputs: FromPixelsInputs,\n backend: WebGPUBackend,\n attrs: FromPixelsAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n let {pixels} = inputs;\n const {numChannels} = attrs;\n\n if (pixels == null) {\n throw new Error('pixels passed to tf.browser.fromPixels() can not be null');\n }\n\n const isVideo = typeof (HTMLVideoElement) !== 'undefined' &&\n pixels instanceof HTMLVideoElement;\n const isImage = typeof (HTMLImageElement) !== 'undefined' &&\n pixels instanceof HTMLImageElement;\n const isCanvas = (typeof (HTMLCanvasElement) !== 'undefined' &&\n pixels instanceof HTMLCanvasElement) ||\n (typeof (OffscreenCanvas) !== 'undefined' &&\n pixels instanceof OffscreenCanvas);\n const isImageBitmap =\n typeof (ImageBitmap) !== 'undefined' && pixels instanceof ImageBitmap;\n\n const [width, height] = isVideo ?\n [\n (pixels as HTMLVideoElement).videoWidth,\n (pixels as HTMLVideoElement).videoHeight\n ] :\n [pixels.width, pixels.height];\n const outputShape = [height, width, numChannels];\n\n // Disable importExternalTexture temporarily as it has problem in spec and\n // browser impl\n const importVideo =\n false && env().getBool('WEBGPU_IMPORT_EXTERNAL_TEXTURE') && isVideo;\n const isVideoOrImage = isVideo || isImage;\n if (isImageBitmap || isCanvas || isVideoOrImage) {\n let textureInfo: TextureInfo;\n if (importVideo) {\n const videoElement = pixels as HTMLVideoElement;\n if (!(videoToTextureMap.has(videoElement)) ||\n (videoToTextureMap.get(videoElement) as GPUExternalTexture).expired) {\n const externalTextureDescriptor = {source: videoElement};\n videoToTextureMap.set(\n videoElement,\n backend.device.importExternalTexture(externalTextureDescriptor));\n }\n\n textureInfo = {\n width,\n height,\n format: null,\n usage: null,\n texture: videoToTextureMap.get(videoElement) as GPUExternalTexture\n };\n } else {\n if (isVideoOrImage) {\n const newWillReadFrequently =\n env().getBool('CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU');\n if (fromPixels2DContext == null ||\n newWillReadFrequently !== willReadFrequently) {\n willReadFrequently = newWillReadFrequently;\n fromPixels2DContext =\n document.createElement('canvas').getContext(\n '2d', {willReadFrequently});\n }\n fromPixels2DContext.canvas.width = width;\n fromPixels2DContext.canvas.height = height;\n fromPixels2DContext.drawImage(\n pixels as HTMLVideoElement | HTMLImageElement, 0, 0, width, height);\n pixels = fromPixels2DContext.canvas;\n }\n\n const usage = GPUTextureUsage.COPY_DST |\n GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING;\n const format = 'rgba8unorm' as GPUTextureFormat;\n const texture = backend.textureManager.acquireTexture(\n outputShape[1], outputShape[0], format, usage);\n backend.queue.copyExternalImageToTexture(\n {source: pixels as HTMLCanvasElement | ImageBitmap}, {texture},\n [outputShape[1], outputShape[0]]);\n textureInfo = {width, height, format, usage, texture};\n }\n\n const size = util.sizeFromShape(outputShape);\n const strides = util.computeStrides(outputShape);\n const program =\n new FromPixelsProgram(outputShape, numChannels, importVideo);\n\n const uniformData = [\n {type: 'uint32', data: [size]}, {type: 'uint32', data: [numChannels]},\n {type: 'uint32', data: [...strides]}\n ];\n const input = backend.makeTensorInfo([height, width], 'int32');\n const info = backend.tensorMap.get(input.dataId);\n info.resourceInfo = textureInfo;\n\n const result =\n backend.runWebGPUProgram(program, [input], 'int32', uniformData);\n backend.disposeData(input.dataId);\n return result;\n }\n\n // TODO: Encoding should happen on GPU once we no longer have to download\n // image data to the CPU.\n const imageData = (pixels as ImageData | backend_util.PixelData).data;\n let pixelArray = imageData;\n if (numChannels != null && numChannels !== 4) {\n pixelArray = new Uint8Array(pixels.width * pixels.height * numChannels);\n\n const dataLength = imageData.length;\n let j = 0;\n for (let i = 0; i < dataLength; i++) {\n if (i % 4 < numChannels) {\n pixelArray[j++] = imageData[i];\n }\n }\n }\n\n const output =\n backend.makeTensorInfo(outputShape, 'int32', new Int32Array(pixelArray));\n backend.uploadToGPU(output.dataId);\n return output;\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class BatchNormProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[], y?: number[], z?: number[]};\n dispatch: [number, number, number];\n variableNames: string[];\n uniforms = 'varianceEpsilon : f32,';\n // This is an experimental value.\n workgroupSize: [number, number, number] = [128, 1, 1];\n offsetShape: number[]|null;\n scaleShape: number[]|null;\n varianceEpsilon: number;\n size = true;\n\n constructor(\n xShape: number[], meanShape: number[], varianceShape: number[],\n offsetShape: number[]|null, scaleShape: number[]|null) {\n this.variableNames = ['x', 'mean', 'variance'];\n backend_util.assertAndGetBroadcastShape(xShape, meanShape);\n backend_util.assertAndGetBroadcastShape(xShape, varianceShape);\n this.outputShape = xShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n\n if (offsetShape != null) {\n backend_util.assertAndGetBroadcastShape(xShape, offsetShape);\n this.variableNames.push('offset');\n }\n if (scaleShape != null) {\n backend_util.assertAndGetBroadcastShape(xShape, scaleShape);\n this.variableNames.push('scale');\n }\n this.offsetShape = offsetShape;\n this.scaleShape = scaleShape;\n this.shaderKey = 'batchNorm';\n }\n\n getUserCode(): string {\n let offsetSnippet = '0.0';\n if (this.offsetShape != null) {\n offsetSnippet = 'getOffsetByOutputIndex(index)';\n }\n\n let scaleSnippet = '1.0';\n if (this.scaleShape != null) {\n scaleSnippet = 'getScaleByOutputIndex(index)';\n }\n\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size)\n {\n let xValue = getXByOutputIndex(index);\n let meanValue = getMeanByOutputIndex(index);\n let varianValue = getVarianceByOutputIndex(index);\n let offsetValue = ${offsetSnippet};\n let scaleValue = ${scaleSnippet};\n let inv = scaleValue * inverseSqrt(varianValue + f32(uniforms.varianceEpsilon));\n setOutputAtIndex(index,dot(vec3(xValue, -meanValue, offsetValue), vec3(inv, inv, 1.0)));\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {FusedBatchNorm, FusedBatchNormAttrs, FusedBatchNormInputs, KernelConfig, Tensor} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\n\nimport {BatchNormProgram} from '../batchnorm_webgpu';\n\nexport const fusedBatchNormConfig: KernelConfig = {\n kernelName: FusedBatchNorm,\n backendName: 'webgpu',\n kernelFunc: ({inputs, attrs, backend}) => {\n const {x, scale, offset, mean, variance} = inputs as FusedBatchNormInputs;\n const {varianceEpsilon} = attrs as unknown as FusedBatchNormAttrs;\n const webGPUBackend = backend as WebGPUBackend;\n const batchNormInputs = [x as Tensor, mean as Tensor, variance as Tensor];\n let offsetShape = null;\n if (offset != null) {\n offsetShape = offset.shape;\n batchNormInputs.push(offset as Tensor);\n }\n let scaleShape = null;\n if (scale != null) {\n scaleShape = scale.shape;\n batchNormInputs.push(scale as Tensor);\n }\n const program = new BatchNormProgram(\n x.shape, mean.shape, variance.shape, offsetShape, scaleShape);\n const uniformData = [{type: 'float32', data: [varianceEpsilon]}];\n return webGPUBackend.runWebGPUProgram(\n program, batchNormInputs, x.dtype, uniformData);\n }\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, FusedConv2D, FusedConv2DAttrs, FusedConv2DInputs, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\n\nimport {conv2DImpl} from './Conv2D_impl';\n\nexport function fusedConv2d(args: {\n inputs: FusedConv2DInputs,\n attrs: FusedConv2DAttrs,\n backend: WebGPUBackend\n}) {\n const {inputs, backend, attrs} = args;\n const {x, filter, bias, preluActivationWeights} = inputs;\n const {\n strides,\n pad,\n dataFormat,\n dilations,\n dimRoundingMode,\n activation,\n leakyreluAlpha\n } = attrs;\n\n const $dataFormat = backend_util.convertConv2DDataFormat(dataFormat);\n const convInfo = backend_util.computeConv2DInfo(\n x.shape as [number, number, number, number],\n filter.shape as [number, number, number, number], strides, dilations, pad,\n dimRoundingMode, false /* depthwise */, $dataFormat);\n\n return conv2DImpl({\n x,\n filter,\n convInfo,\n backend,\n bias,\n preluActivationWeights,\n leakyreluAlpha,\n activation\n });\n}\n\nexport const fusedConv2DConfig: KernelConfig = {\n kernelName: FusedConv2D,\n backendName: 'webgpu',\n kernelFunc: fusedConv2d as unknown as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, FusedDepthwiseConv2D, FusedDepthwiseConv2DAttrs, FusedDepthwiseConv2DInputs, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {DepthwiseConv2DVec4Program} from '../depthwise_conv2d_vec4_webgpu';\nimport {DepthwiseConv2DProgram} from '../depthwise_conv2d_webgpu';\n\nexport function fusedDepthwiseConv2D(args: {\n inputs: FusedDepthwiseConv2DInputs,\n attrs: FusedDepthwiseConv2DAttrs,\n backend: WebGPUBackend\n}) {\n const {inputs, backend, attrs} = args;\n const {x, filter, bias, preluActivationWeights} = inputs;\n const {strides, pad, dilations, dimRoundingMode, activation, leakyreluAlpha} =\n attrs;\n\n let $dilations = dilations;\n if ($dilations == null) {\n $dilations = [1, 1];\n }\n\n util.assert(\n backend_util.eitherStridesOrDilationsAreOne(strides, $dilations),\n () => 'Error in depthwiseConv2d: Either strides or dilations must be ' +\n `1. Got strides ${strides} and dilations '${$dilations}'`);\n\n const convInfo = backend_util.computeConv2DInfo(\n x.shape as [number, number, number, number],\n filter.shape as [number, number, number, number], strides, $dilations,\n pad, dimRoundingMode, true /* depthwise */);\n\n const programInputs: TensorInfo[] = [x, filter];\n\n const hasBias = bias != null;\n const hasPreluActivationWeights = preluActivationWeights != null;\n\n if (hasBias) {\n programInputs.push(bias);\n }\n if (hasPreluActivationWeights) {\n programInputs.push(preluActivationWeights);\n }\n\n const dimensions = [\n {type: 'int32', data: [convInfo.padInfo.top, convInfo.padInfo.left]},\n {type: 'int32', data: [convInfo.inHeight, convInfo.inWidth]},\n ];\n\n let program: DepthwiseConv2DProgram|DepthwiseConv2DVec4Program;\n if (convInfo.outHeight > 4 && convInfo.outWidth > 4 &&\n convInfo.strideWidth <= 2 &&\n convInfo.inChannels === convInfo.outChannels &&\n convInfo.dilationHeight === 1 && convInfo.dilationWidth === 1 &&\n convInfo.inChannels % 4 === 0) {\n program = new DepthwiseConv2DVec4Program(\n convInfo, hasBias, activation, hasPreluActivationWeights);\n } else {\n program = new DepthwiseConv2DProgram(\n convInfo, hasBias, activation, hasPreluActivationWeights);\n dimensions.push(\n {type: 'int32', data: [convInfo.filterHeight]},\n {type: 'int32', data: [convInfo.filterWidth]},\n {type: 'int32', data: [convInfo.strideHeight, convInfo.strideWidth]}, {\n type: 'int32',\n data: [convInfo.dilationHeight, convInfo.dilationWidth]\n });\n }\n if (activation === 'leakyrelu') {\n dimensions.push({type: 'float32', data: [leakyreluAlpha]});\n program.uniforms += ' alpha : f32,';\n }\n const result =\n backend.runWebGPUProgram(program, programInputs, 'float32', dimensions);\n\n return result;\n}\n\nexport const fusedDepthwiseConv2DConfig: KernelConfig = {\n kernelName: FusedDepthwiseConv2D,\n backendName: 'webgpu',\n kernelFunc: fusedDepthwiseConv2D as unknown as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getCoordsDataType, getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class GatherNDProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames: string[] = ['A', 'indices'];\n uniforms: string;\n workgroupSize: [number, number, number] = [64, 1, 1];\n size = true;\n sliceDim: number;\n constructor(sliceDim: number, shape: number[]) {\n this.outputShape = shape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n this.shaderKey = `gathernd_${sliceDim}`;\n this.sliceDim = sliceDim;\n this.uniforms = `sliceDim : i32, strides : ${getCoordsDataType(sliceDim)},`;\n }\n\n getUserCode(): string {\n let strideString;\n if (this.sliceDim > 1) {\n strideString = 'uniforms.strides[j]';\n } else {\n strideString = 'uniforms.strides';\n }\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n let coords = getCoordsFromIndex(index);\n var flattenIndex = 0;\n for (var j = 0; j < uniforms.sliceDim; j = j + 1) {\n let indexTemp = i32(round(getIndices(coords[0], j)));\n let strideNum = ${strideString};\n flattenIndex = flattenIndex + indexTemp * strideNum;\n }\n\n setOutputAtIndex(index, getA(flattenIndex, coords[1]));\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, GatherNd, GatherNdInputs, KernelConfig, KernelFunc, Rank, TensorInfo, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {GatherNDProgram} from '../gather_nd_webgpu';\nimport {gatherNdImplCPU} from '../kernel_utils/shared';\n\nimport {reshape} from './Reshape';\n\nexport function gatherNd(\n args: {inputs: GatherNdInputs, backend: WebGPUBackend}): TensorInfo {\n const {inputs, backend} = args;\n const {params, indices} = inputs;\n\n const indicesShape = indices.shape;\n const sliceRank = indicesShape[indicesShape.length - 1];\n const paramsSize = util.sizeFromShape(params.shape);\n\n const [resultShape, numSlices, sliceSize, strides] =\n backend_util.prepareAndValidate(params, indices);\n\n const flattenIndices = reshape(\n {inputs: {x: indices}, backend, attrs: {shape: [numSlices, sliceRank]}});\n const flattenX = reshape({\n inputs: {x: params},\n backend,\n attrs: {shape: [(util.sizeFromShape(params.shape) / sliceSize), sliceSize]}\n });\n if (backend.shouldExecuteOnCPU([params, indices]) ||\n params.dtype === 'string') {\n const indicesData = backend.readSync(indices.dataId) as TypedArray;\n const paramsBuf = backend.bufferSync(params);\n const outValue = gatherNdImplCPU(\n indicesData, paramsBuf, params.dtype, numSlices, sliceRank, sliceSize,\n strides, params.shape, paramsSize);\n\n return backend.makeTensorInfo(resultShape, params.dtype, outValue.values);\n }\n const program = new GatherNDProgram(sliceRank, [numSlices, sliceSize]);\n const uniformData =\n [{type: 'int32', data: [sliceRank]}, {type: 'int32', data: strides}];\n const res = backend.runWebGPUProgram(\n program, [flattenX, flattenIndices], flattenX.dtype, uniformData);\n\n const reshaped =\n reshape({inputs: {x: res}, backend, attrs: {shape: resultShape}});\n\n backend.disposeData(flattenIndices.dataId);\n backend.disposeData(flattenX.dataId);\n backend.disposeData(res.dataId);\n\n return reshaped;\n}\n\nexport const gatherNdConfig: KernelConfig = {\n kernelName: GatherNd,\n backendName: 'webgpu',\n kernelFunc: gatherNd as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class GatherProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames: string[] = ['A', 'indices'];\n workgroupSize: [number, number, number] = [64, 1, 1];\n aShape: number[];\n size = true;\n\n constructor(aShape: number[], outputShape: number[]) {\n this.outputShape = aShape.slice();\n this.aShape = aShape;\n this.outputShape = outputShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n this.shaderKey = `gather`;\n }\n\n getUserCode(): string {\n const sourceCoords = getSourceCoords(this.aShape);\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n let resRC = getCoordsFromIndex(index);\n let indexZ = i32(getIndices(resRC.x, resRC.z));\n let inBounds = select(0.0, 1.0, indexZ >= 0 && indexZ < uniforms.aShape[2]);\n setOutputAtIndex(index, inBounds * getA(${sourceCoords}));\n }\n }\n `;\n return userCode;\n }\n}\n\n// The input and output are always flattened into rank 4 tensors.\nfunction getSourceCoords(aShape: number[]): string {\n const currentCoords = ['resRC.x', 'resRC.y', 'resRC.z', 'resRC.w'];\n const sourceCoords = [];\n for (let i = 0; i < aShape.length; i++) {\n if (i === 2) {\n sourceCoords.push('indexZ');\n } else {\n sourceCoords.push(`${currentCoords[i]}`);\n }\n }\n return sourceCoords.join();\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, buffer, GatherV2, GatherV2Attrs, GatherV2Inputs, KernelConfig, KernelFunc, Rank, TensorBuffer, TensorInfo, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {gatherV2ImplCPU} from '../kernel_utils/shared';\n\nimport {GatherProgram} from '../gather_webgpu';\nimport {reshape} from './Reshape';\n\nexport function gatherV2(\n args:\n {inputs: GatherV2Inputs, backend: WebGPUBackend, attrs: GatherV2Attrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x, indices} = inputs;\n const {axis, batchDims} = attrs;\n\n // Unlike WebGL, WebGPU won't check if index is out of bound by calling\n // backend.readSync() function in debug mode.\n const parsedAxis = util.parseAxisParam(axis, x.shape)[0];\n\n const shapeInfo = backend_util.segment_util.collectGatherOpShapeInfo(\n x, indices, parsedAxis, batchDims);\n\n const indicesSize = util.sizeFromShape(indices.shape);\n\n const toDispose = [];\n\n const flattenX = reshape({\n inputs: {x},\n backend,\n attrs: {\n shape: [\n shapeInfo.batchSize, shapeInfo.outerSize, shapeInfo.dimSize,\n shapeInfo.sliceSize\n ]\n }\n });\n\n const flattenIndex = reshape({\n inputs: {x: indices},\n backend,\n attrs: {shape: [shapeInfo.batchSize, indicesSize / shapeInfo.batchSize]}\n });\n\n toDispose.push(flattenX);\n toDispose.push(flattenIndex);\n\n const flattenOutputShape = [\n shapeInfo.batchSize, shapeInfo.outerSize, indicesSize / shapeInfo.batchSize,\n shapeInfo.sliceSize\n ];\n\n if (backend.shouldExecuteOnCPU([x, indices])) {\n const indicesBufferInfo = backend.tensorMap.get(flattenIndex.dataId);\n const indicesValues = indicesBufferInfo.values as TypedArray;\n const indicesBuf =\n buffer(flattenIndex.shape, flattenIndex.dtype, indicesValues) as\n TensorBuffer;\n const xBufferInfo = backend.tensorMap.get(flattenX.dataId);\n const xValues = xBufferInfo.values as TypedArray;\n const xBuf =\n buffer(flattenX.shape, flattenX.dtype, xValues) as TensorBuffer;\n const outBuf = gatherV2ImplCPU(xBuf, indicesBuf, flattenOutputShape);\n\n toDispose.forEach(t => backend.disposeData(t.dataId));\n\n return backend.makeTensorInfo(\n shapeInfo.outputShape, outBuf.dtype, outBuf.values as TypedArray);\n }\n\n const program = new GatherProgram(flattenX.shape, flattenOutputShape);\n const res = backend.runWebGPUProgram(\n program, [flattenX, flattenIndex], flattenX.dtype);\n toDispose.push(res);\n\n const reshaped = reshape(\n {inputs: {x: res}, backend, attrs: {shape: shapeInfo.outputShape}});\n toDispose.forEach(t => backend.disposeData(t.dataId));\n return reshaped;\n}\n\nexport const gatherV2Config: KernelConfig = {\n kernelName: GatherV2,\n backendName: 'webgpu',\n kernelFunc: gatherV2 as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Greater, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {BinaryOpType} from '../binary_op_util';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {greaterImplCPU as cpuGreater} from '../kernel_utils/shared';\n\nexport const greater = binaryKernelFunc({\n opType: BinaryOpType.GREATER,\n cpuKernelImpl: cpuGreater,\n dtype: 'bool',\n});\n\nexport const greaterConfig: KernelConfig = {\n kernelName: Greater,\n backendName: 'webgpu',\n kernelFunc: greater\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GreaterEqual, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {BinaryOpType} from '../binary_op_util';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {greaterEqualImplCPU as cpuGreaterEqual} from '../kernel_utils/shared';\n\nexport const greaterEqual = binaryKernelFunc({\n opType: BinaryOpType.GREATER_EQUAL,\n dtype: 'bool',\n cpuKernelImpl: cpuGreaterEqual\n});\n\nexport const greaterEqualConfig: KernelConfig = {\n kernelName: GreaterEqual,\n backendName: 'webgpu',\n kernelFunc: greaterEqual\n};\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {IFFT, IFFTInputs, KernelConfig, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\n\nimport {fftImpl} from './FFT_impl';\n\nexport function ifft(args: {inputs: IFFTInputs, backend: WebGPUBackend}):\n TensorInfo {\n const {inputs, backend} = args;\n const {input} = inputs;\n\n return fftImpl(input, true /* inverse */, backend);\n}\n\nexport const ifftConfig: KernelConfig = {\n kernelName: IFFT,\n backendName: 'webgpu',\n kernelFunc: ifft\n};\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {IsFinite, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const isFinite =\n unaryKernelFunc({opType: UnaryOpType.IS_FINITE, dtype: 'bool'});\n\nexport const isFiniteConfig: KernelConfig = {\n kernelName: IsFinite,\n backendName: 'webgpu',\n kernelFunc: isFinite\n};\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {IsInf, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const isInf =\n unaryKernelFunc({opType: UnaryOpType.IS_INF, dtype: 'bool'});\n\nexport const isInfConfig: KernelConfig = {\n kernelName: IsInf,\n backendName: 'webgpu',\n kernelFunc: isInf\n};\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {IsNan, KernelConfig} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const isNaN =\n unaryKernelFunc({opType: UnaryOpType.IS_NAN, dtype: 'bool'});\n\nexport const isNaNConfig: KernelConfig = {\n kernelName: IsNan,\n backendName: 'webgpu',\n kernelFunc: isNaN\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, LeakyRelu, LeakyReluAttrs, LeakyReluInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {UnaryOpType} from '../unary_op_util';\nimport {UnaryOpProgram} from '../unary_op_webgpu';\n\nexport function leakyRelu(args: {\n inputs: LeakyReluInputs,\n backend: WebGPUBackend,\n attrs: LeakyReluAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {alpha} = attrs;\n const uniformData = [{type: 'float32', data: [alpha]}];\n const program =\n new UnaryOpProgram(x.shape, UnaryOpType.LEAKYRELU, 'alpha : f32,');\n return backend.runWebGPUProgram(program, [x], 'float32', uniformData);\n}\n\nexport const leakyReluConfig: KernelConfig = {\n kernelName: LeakyRelu,\n backendName: 'webgpu',\n kernelFunc: leakyRelu as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Less} from '@tensorflow/tfjs-core';\n\nimport {BinaryOpType} from '../binary_op_util';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {lessImplCPU as cpuLess} from '../kernel_utils/shared';\n\nexport const less = binaryKernelFunc(\n {opType: BinaryOpType.LESS, dtype: 'bool', cpuKernelImpl: cpuLess});\n\nexport const lessConfig: KernelConfig = {\n kernelName: Less,\n backendName: 'webgpu',\n kernelFunc: less\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, LessEqual} from '@tensorflow/tfjs-core';\n\nimport {BinaryOpType} from '../binary_op_util';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {lessEqualImplCPU as cpuLessEqual} from '../kernel_utils/shared';\n\nexport const lessEqual = binaryKernelFunc({\n opType: BinaryOpType.LESS_EQUAL,\n dtype: 'bool',\n cpuKernelImpl: cpuLessEqual\n});\n\nexport const lessEqualConfig: KernelConfig = {\n kernelName: LessEqual,\n backendName: 'webgpu',\n kernelFunc: lessEqual\n};\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class LinSpaceProgram implements WebGPUProgram {\n variableNames: string[] = [];\n outputShape: number[] = [];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n uniforms = 'start : f32, step : f32,';\n workgroupSize: [number, number, number] = [64, 1, 1];\n size = true;\n\n constructor(shape: number) {\n this.outputShape = [shape];\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n\n this.shaderKey = 'linSpace';\n }\n\n getUserCode(): string {\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n setOutputAtIndex(index, uniforms.start + f32(index) * uniforms.step);\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, LinSpace, LinSpaceAttrs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {LinSpaceProgram} from '../lin_space_webgpu';\n\nexport function linSpace(args: {backend: WebGPUBackend, attrs: LinSpaceAttrs}):\n TensorInfo {\n const {backend, attrs} = args;\n const {start, stop, num} = attrs;\n const step = (stop - start) / (num - 1);\n\n const program = new LinSpaceProgram(num);\n const uniformData =\n [{type: 'float32', data: [start]}, {type: 'float32', data: [step]}];\n return backend.runWebGPUProgram(program, [], 'float32', uniformData);\n}\n\nexport const linSpaceConfig: KernelConfig = {\n kernelName: LinSpace,\n backendName: 'webgpu',\n kernelFunc: linSpace as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Log} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {logImplCPU} from '../kernel_utils/shared';\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const log =\n unaryKernelFunc({opType: UnaryOpType.LOG, cpuKernelImpl: logImplCPU});\n\nexport const logConfig: KernelConfig = {\n kernelName: Log,\n backendName: 'webgpu',\n kernelFunc: log\n};\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Log1p} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const log1p = unaryKernelFunc({opType: UnaryOpType.LOG1P});\n\nexport const log1pConfig: KernelConfig = {\n kernelName: Log1p,\n backendName: 'webgpu',\n kernelFunc: log1p\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, LogicalAnd} from '@tensorflow/tfjs-core';\n\nimport {BinaryOpType} from '../binary_op_util';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nexport const logicalAnd =\n binaryKernelFunc({opType: BinaryOpType.LOGICAL_AND, dtype: 'bool'});\n\nexport const logicalAndConfig: KernelConfig = {\n kernelName: LogicalAnd,\n backendName: 'webgpu',\n kernelFunc: logicalAnd\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, LogicalNot} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const logicalNot = unaryKernelFunc({opType: UnaryOpType.LOGICAL_NOT});\n\nexport const logicalNotConfig: KernelConfig = {\n kernelName: LogicalNot,\n backendName: 'webgpu',\n kernelFunc: logicalNot\n};\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, LogicalOr} from '@tensorflow/tfjs-core';\n\nimport {BinaryOpType} from '../binary_op_util';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nexport const logicalOr = binaryKernelFunc({opType: BinaryOpType.LOGICAL_OR});\n\nexport const logicalOrConfig: KernelConfig = {\n kernelName: LogicalOr,\n backendName: 'webgpu',\n kernelFunc: logicalOr\n};\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {util} from '@tensorflow/tfjs-core';\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nconst powOperatorSnippet = `\n var powValue = 0.0;\n let basis = uniforms.bias + uniforms.alpha * sum;\n if (uniforms.beta == 0.5) {\n powValue = inverseSqrt(basis);\n } else if (uniforms.beta == 1.0) {\n powValue = 1.0 / basis;\n } else {\n powValue = exp(log(basis) * (-uniforms.beta));\n }\n`;\n\nexport class LRNProgram implements WebGPUProgram {\n outputShape: number[] = [];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames = ['x'];\n uniforms = 'radius : i32, bias : f32, alpha : f32, beta : f32,';\n workgroupSize: [number, number, number] = [64, 1, 1];\n size = true;\n\n constructor(xShape: number[]) {\n this.outputShape = xShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n this.shaderKey = 'lrn';\n }\n\n getUserCode(): string {\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n let coords = getOutputCoords();\n let b = coords[0];\n let r = coords[1];\n let c = coords[2];\n let d = coords[3];\n\n let x = getX(b, r, c, d);\n var sum = 0.0;\n for (var i = -uniforms.radius; i <= uniforms.radius; i = i + 1) {\n let idx = d + i;\n if (idx >= 0 && idx < uniforms.xShape[3]) {\n let z = getX(b, r, c, idx);\n sum = sum + z * z;\n }\n }\n ${powOperatorSnippet}\n\n setOutputAtIndex(index, x * powValue);\n }\n }\n `;\n return userCode;\n }\n}\n\nexport class LRNSharedProgram implements WebGPUProgram {\n outputShape: number[] = [];\n shaderKey: string;\n dispatchLayout: {x: number[], y: number[], z: number[]};\n dispatch: [number, number, number];\n variableNames = ['x'];\n uniforms = 'radius : i32, bias : f32, alpha : f32, beta : f32,';\n workgroupSize: [number, number, number] = [256, 1, 1];\n maxAllowRadius = 16;\n elementsPerWorkgroup: number;\n\n constructor(xShape: number[], radius: number) {\n util.assert(\n radius <= this.maxAllowRadius,\n () => `Radius must be less than or equal to ${\n this.maxAllowRadius}, current radius is ${radius}`);\n\n this.outputShape = xShape;\n // The reason why not using this.workgroupSize[0] + 2 * maxAllowRadius here\n // is to make sure that there is only one time global memory load access for\n // each thread.\n this.elementsPerWorkgroup = this.workgroupSize[0] - 2 * this.maxAllowRadius;\n this.dispatchLayout = {x: [3], y: [2], z: [0, 1]};\n this.dispatch = computeDispatch(this.dispatchLayout, this.outputShape, [\n this.elementsPerWorkgroup, this.workgroupSize[1], this.workgroupSize[2]\n ]);\n this.shaderKey = 'lrn_shared';\n }\n\n getUserCode(): string {\n const userCode = `\n var lrnSub: array;\n const elementsPerWorkgroup = ${this.elementsPerWorkgroup};\n const maxAllowRadius = ${this.maxAllowRadius};\n\n ${main()} {\n let localDepth = i32(localId.x);\n let workgroupDepth = i32(workgroupId.x) * elementsPerWorkgroup;\n let xDepth = workgroupDepth + localDepth - maxAllowRadius;\n let b = i32(globalId.z) / uniforms.xShape[1];\n let r = i32(globalId.z) - b * uniforms.xShape[1];\n let c = i32(globalId.y);\n let d = workgroupDepth + localDepth;\n\n var x = 0.0;\n if (xDepth >= 0 && xDepth < uniforms.xShape[3]) {\n x = getX(b, r, c, xDepth);\n }\n lrnSub[localDepth] = x;\n workgroupBarrier();\n\n if (localDepth < elementsPerWorkgroup && d < uniforms.outShape[3]) {\n var sum = 0.0;\n let index = localDepth + maxAllowRadius;\n for (var i = -uniforms.radius; i <= uniforms.radius; i = i + 1) {\n let z = lrnSub[index + i];\n sum = sum + z * z;\n }\n ${powOperatorSnippet}\n\n setOutputAtCoords(b, r, c, d, lrnSub[index] * powValue);\n }\n } `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, LRN, LRNAttrs, LRNInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {LRNProgram, LRNSharedProgram} from '../lrn_webgpu';\n\nexport function lrn(\n args: {inputs: LRNInputs, backend: WebGPUBackend, attrs: LRNAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {depthRadius, bias, alpha, beta} = attrs;\n\n // When the adjacent channels is less than or equal to 16, which could cover\n // most cases, we use shared memory version to get better performance.\n // The theoretical adjacent channels may be very large, but the shared memory\n // size of hardware is limited, so we use the naive version when the adjacent\n // channels is large.\n let program: LRNProgram|LRNSharedProgram;\n if (depthRadius > 16) {\n program = new LRNProgram(x.shape);\n } else {\n program = new LRNSharedProgram(x.shape, depthRadius);\n }\n const uniformData = [\n {type: 'int32', data: [depthRadius]}, {type: 'float32', data: [bias]},\n {type: 'float32', data: [alpha]}, {type: 'float32', data: [beta]}\n ];\n const res = backend.runWebGPUProgram(program, [x], x.dtype, uniformData);\n\n return res;\n}\n\nexport const lrnConfig: KernelConfig = {\n kernelName: LRN,\n backendName: 'webgpu',\n kernelFunc: lrn as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Maximum} from '@tensorflow/tfjs-core';\n\nimport {BinaryOpType} from '../binary_op_util';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {maximumImplCPU as cpuMaximum} from '../kernel_utils/shared';\n\nexport const maximum = binaryKernelFunc({\n opType: BinaryOpType.MAX,\n cpuKernelImpl: cpuMaximum,\n});\n\nexport const maximumConfig: KernelConfig = {\n kernelName: Maximum,\n backendName: 'webgpu',\n kernelFunc: maximum\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {backend_util, KernelConfig, KernelFunc, MaxPool, MaxPoolAttrs, MaxPoolInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {poolImpl} from './Pool_impl';\n\nexport function maxPool(\n args: {inputs: MaxPoolInputs, backend: WebGPUBackend, attrs: MaxPoolAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {filterSize, strides, pad, dimRoundingMode} = attrs;\n const dilations = 1;\n const convInfo = backend_util.computePool2DInfo(\n x.shape as [number, number, number, number], filterSize, strides,\n dilations, pad, dimRoundingMode);\n\n return poolImpl(x, convInfo, 'max', backend);\n}\n\nexport const maxPoolConfig: KernelConfig = {\n kernelName: MaxPool,\n backendName: 'webgpu',\n kernelFunc: maxPool as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Min, MinAttrs, MinInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {reduce} from '../kernel_utils/reduce';\n\nexport function min(\n args: {inputs: MinInputs, backend: WebGPUBackend, attrs: MinAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {axis, keepDims} = attrs;\n\n return reduce(x, axis, keepDims, 'min', backend);\n}\n\nexport const minConfig: KernelConfig = {\n kernelName: Min,\n backendName: 'webgpu',\n kernelFunc: min as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Minimum} from '@tensorflow/tfjs-core';\n\nimport {BinaryOpType} from '../binary_op_util';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {minimumImplCPU as cpuMinimum} from '../kernel_utils/shared';\n\nexport const minimum = binaryKernelFunc({\n opType: BinaryOpType.MIN,\n cpuKernelImpl: cpuMinimum,\n});\n\nexport const minimumConfig: KernelConfig = {\n kernelName: Minimum,\n backendName: 'webgpu',\n kernelFunc: minimum\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getCoordsDataType, getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class MirrorPadProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n uniforms = '';\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames = ['x'];\n workgroupSize: [number, number, number] = [64, 1, 1];\n xShape: number[];\n offset: number;\n size = true;\n\n constructor(\n xShape: number[], paddings: Array<[number, number]>,\n mode: 'reflect'|'symmetric') {\n this.outputShape = paddings.map(\n (p, i) => p[0] /* beforePad */ + xShape[i] + p[1] /* afterPad */);\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n\n this.xShape = xShape;\n paddings.map((_, i) => {\n this.uniforms += ` pad${i} : vec2,`;\n });\n this.offset = mode === 'reflect' ? 0 : 1;\n this.shaderKey = `mirrorPad_${mode}`;\n }\n\n getUserCode(): string {\n const rank = this.xShape.length;\n // The length of paddings are same with the rank of the input tensor.\n const start = this.xShape.map((_, i) => `uniforms.pad${i}[0]`).join(',');\n const end = this.xShape\n .map(\n (_, i) => `uniforms.pad${i}[0] + uniforms.xShape${\n rank > 1 ? `[${i}]` : ''}`)\n .join(',');\n\n const shaderStart = rank === 1 ? 'start' : 'start[i]';\n const shaderEnd = rank === 1 ? 'end' : 'end[i]';\n const shaderOutC = rank === 1 ? 'outC' : 'outC[i]';\n const dtype = getCoordsDataType(rank);\n const unpackedCoords = rank > 1 ?\n ['coords[0]', 'coords[1]', 'coords[2]', 'coords[3]'].slice(0, rank) :\n 'coords';\n\n return `\n ${main('index')} {\n if (index < uniforms.size) {\n let start = ${dtype}(${start});\n let end = ${dtype}(${end});\n var outC = getCoordsFromIndex(index);\n for (var i = 0; i < ${rank}; i = i + 1) {\n if (${shaderOutC} < ${shaderStart}) {\n ${shaderOutC} = ${shaderStart} * 2 - ${shaderOutC} - ${\n this.offset};\n } else if(${shaderOutC} >= ${shaderEnd}) {\n ${shaderOutC} = (${shaderEnd} - 1) * 2 - ${shaderOutC} + ${\n this.offset};\n }\n }\n let coords = outC - start;\n setOutputAtIndex(index, getX(${unpackedCoords}));\n }\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, MirrorPad, MirrorPadAttrs, MirrorPadInputs} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\n\nimport {MirrorPadProgram} from '../mirror_pad_webgpu';\n\nexport const mirrorPadConfig: KernelConfig = {\n kernelName: MirrorPad,\n backendName: 'webgpu',\n kernelFunc: ({inputs, attrs, backend}) => {\n const {x} = inputs as MirrorPadInputs;\n const {paddings, mode} = attrs as unknown as MirrorPadAttrs;\n const webGPUBackend = backend as WebGPUBackend;\n\n const uniformData = paddings.map(p => {\n return {type: 'int32', data: [p[0], p[1]]};\n });\n const program = new MirrorPadProgram(x.shape, paddings, mode);\n const output =\n webGPUBackend.runWebGPUProgram(program, [x], x.dtype, uniformData);\n\n return output;\n }\n};\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Mod} from '@tensorflow/tfjs-core';\n\nimport {BinaryOpType} from '../binary_op_util';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nexport const mod = binaryKernelFunc({opType: BinaryOpType.MOD});\n\nexport const modConfig: KernelConfig = {\n kernelName: Mod,\n backendName: 'webgpu',\n kernelFunc: mod\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Neg, NegInputs, TensorInfo, TypedArray} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {negImplCPU} from '../kernel_utils/shared';\n\nimport {UnaryOpType} from '../unary_op_util';\nimport {UnaryOpProgram} from '../unary_op_webgpu';\n\n// This doesn't use unaryKernelFunc because negImplCPU is not of type\n// SimpleUnaryKernelImplCPU.\nexport function neg(args: {inputs: NegInputs, backend: WebGPUBackend}):\n TensorInfo {\n const {inputs, backend} = args;\n const {x} = inputs;\n\n if (backend.shouldExecuteOnCPU([x])) {\n const xData = backend.tensorMap.get(x.dataId);\n const [outValues, newShape] =\n negImplCPU(xData.values as TypedArray, x.shape, x.dtype);\n return backend.makeTensorInfo(newShape, x.dtype, outValues);\n }\n\n const program = new UnaryOpProgram(x.shape, UnaryOpType.NEG);\n\n return backend.runWebGPUProgram(program, [x], x.dtype);\n}\n\nexport const negConfig: KernelConfig = {\n kernelName: Neg,\n backendName: 'webgpu',\n kernelFunc: neg as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {kernel_impls, KernelConfig, KernelFunc, NonMaxSuppressionV3, NonMaxSuppressionV3Attrs, NonMaxSuppressionV3Inputs, TypedArray} from '@tensorflow/tfjs-core';\nimport {WebGPUBackend} from '../backend_webgpu';\n\nexport function nonMaxSuppressionV3(args: {\n inputs: NonMaxSuppressionV3Inputs,\n backend: WebGPUBackend,\n attrs: NonMaxSuppressionV3Attrs\n}) {\n console.warn(\n 'tf.nonMaxSuppression() in webgpu locks the UI thread. ' +\n 'Call tf.nonMaxSuppressionAsync() instead');\n\n const {inputs, backend, attrs} = args;\n const {boxes, scores} = inputs;\n const {maxOutputSize, iouThreshold, scoreThreshold} = attrs;\n\n const boxesVals = backend.readSync(boxes.dataId) as TypedArray;\n const scoresVals = backend.readSync(scores.dataId) as TypedArray;\n\n const {selectedIndices} = kernel_impls.nonMaxSuppressionV3Impl(\n boxesVals, scoresVals, maxOutputSize, iouThreshold, scoreThreshold);\n\n return backend.makeTensorInfo(\n [selectedIndices.length], 'int32', new Int32Array(selectedIndices));\n}\n\nexport const nonMaxSuppressionV3Config: KernelConfig = {\n kernelName: NonMaxSuppressionV3,\n backendName: 'webgpu',\n kernelFunc: nonMaxSuppressionV3 as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {kernel_impls, KernelConfig, KernelFunc, NonMaxSuppressionV5, NonMaxSuppressionV5Attrs, NonMaxSuppressionV5Inputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nexport type TypedArray = Float32Array|Int32Array|Uint8Array;\n\nexport function nonMaxSuppressionV5(args: {\n inputs: NonMaxSuppressionV5Inputs,\n backend: WebGPUBackend,\n attrs: NonMaxSuppressionV5Attrs\n}): [TensorInfo, TensorInfo] {\n console.warn(\n 'tf.nonMaxSuppression() in webgpu locks the UI thread. ' +\n 'Call tf.nonMaxSuppressionAsync() instead');\n\n const {inputs, backend, attrs} = args;\n const {boxes, scores} = inputs;\n const {maxOutputSize, iouThreshold, scoreThreshold, softNmsSigma} = attrs;\n\n const boxesVals = backend.readSync(boxes.dataId) as TypedArray;\n const scoresVals = backend.readSync(scores.dataId) as TypedArray;\n\n const maxOutputSizeVal = maxOutputSize;\n const iouThresholdVal = iouThreshold;\n const scoreThresholdVal = scoreThreshold;\n const softNmsSigmaVal = softNmsSigma;\n\n const {selectedIndices, selectedScores} =\n kernel_impls.nonMaxSuppressionV5Impl(\n boxesVals, scoresVals, maxOutputSizeVal, iouThresholdVal,\n scoreThresholdVal, softNmsSigmaVal);\n\n return [\n backend.makeTensorInfo(\n [selectedIndices.length], 'int32', new Int32Array(selectedIndices)),\n backend.makeTensorInfo(\n [selectedScores.length], 'float32', new Float32Array(selectedScores))\n ];\n}\n\nexport const nonMaxSuppressionV5Config: KernelConfig = {\n kernelName: NonMaxSuppressionV5,\n backendName: 'webgpu',\n kernelFunc: nonMaxSuppressionV5 as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class OneHotProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames = ['x'];\n uniforms = 'onValue : f32, offValue : f32,';\n workgroupSize: [number, number, number] = [64, 1, 1];\n size = true;\n\n constructor(numIndices: number, depth: number) {\n this.outputShape = [numIndices, depth];\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n this.shaderKey = 'onehot';\n }\n\n getUserCode(): string {\n const userCode = `\n ${main('index')} {\n if(index < uniforms.size) {\n let coords = getCoordsFromIndex(index);\n setOutputAtIndex(index, mix(uniforms.offValue, uniforms.onValue,\n f32(i32(round(getX(coords.x))) == coords.y)));\n }\n }\n `;\n\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, OneHot, OneHotAttrs, OneHotInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {OneHotProgram} from '../onehot_webgpu';\nimport {reshape} from './Reshape';\n\nexport function oneHot(\n args: {inputs: OneHotInputs, backend: WebGPUBackend, attrs: OneHotAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {indices} = inputs;\n const {dtype, depth, onValue, offValue} = attrs;\n\n const indicesSize = util.sizeFromShape(indices.shape);\n const program = new OneHotProgram(indicesSize, depth);\n const reshaped =\n reshape({inputs: {x: indices}, backend, attrs: {shape: [indicesSize]}});\n\n const uniformData =\n [{type: 'float32', data: [onValue]}, {type: 'float32', data: [offValue]}];\n const result =\n backend.runWebGPUProgram(program, [reshaped], dtype, uniformData);\n backend.disposeData(reshaped.dataId);\n\n const outShape = [...indices.shape, depth];\n const out = reshape({inputs: {x: result}, backend, attrs: {shape: outShape}});\n backend.disposeData(result.dataId);\n\n return out;\n}\n\nexport const oneHotConfig: KernelConfig = {\n kernelName: OneHot,\n backendName: 'webgpu',\n kernelFunc: oneHot as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, TensorInfo, ZerosLike, ZerosLikeInputs} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\n\nimport {complex} from './Complex';\nimport {fill} from './Fill';\nimport {imag} from './Imag';\nimport {real} from './Real';\n\nexport function zerosLike(\n args: {inputs: ZerosLikeInputs, backend: WebGPUBackend}): TensorInfo {\n const {inputs, backend} = args;\n const {x} = inputs;\n if (x.dtype === 'complex64') {\n const realPart = real({inputs: {input: x}, backend});\n const r = zerosLike({inputs: {x: realPart}, backend});\n const imagPart = imag({inputs: {input: x}, backend});\n const i = zerosLike({inputs: {x: imagPart}, backend});\n\n const result = complex({inputs: {real: r, imag: i}, backend});\n\n backend.disposeData(realPart.dataId);\n backend.disposeData(r.dataId);\n backend.disposeData(imagPart.dataId);\n backend.disposeData(i.dataId);\n\n return result;\n } else {\n return fill({\n attrs: {\n shape: x.shape,\n dtype: x.dtype,\n value: x.dtype === 'string' ? '' : 0\n },\n backend\n });\n }\n}\n\nexport const zerosLikeConfig: KernelConfig = {\n kernelName: ZerosLike,\n backendName: 'webgpu',\n kernelFunc: zerosLike as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, OnesLike, OnesLikeInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\n\nimport {complex} from './Complex';\nimport {fill} from './Fill';\nimport {imag} from './Imag';\nimport {real} from './Real';\nimport {zerosLike} from './ZerosLike';\n\nexport function onesLike(\n args: {inputs: OnesLikeInputs, backend: WebGPUBackend}): TensorInfo {\n const {inputs, backend} = args;\n const {x} = inputs;\n\n if (x.dtype === 'string') {\n throw new Error('onesLike is not supported under string dtype');\n } else if (x.dtype === 'complex64') {\n const realPart = real({inputs: {input: x}, backend});\n const r = onesLike({inputs: {x: realPart}, backend});\n const imagPart = imag({inputs: {input: x}, backend});\n const i = zerosLike({inputs: {x: imagPart}, backend});\n\n const result = complex({inputs: {real: r, imag: i}, backend});\n\n backend.disposeData(realPart.dataId);\n backend.disposeData(r.dataId);\n backend.disposeData(imagPart.dataId);\n backend.disposeData(i.dataId);\n\n return result;\n } else {\n return fill({attrs: {shape: x.shape, dtype: x.dtype, value: 1}, backend});\n }\n}\n\nexport const onesLikeConfig: KernelConfig = {\n kernelName: OnesLike,\n backendName: 'webgpu',\n kernelFunc: onesLike as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Pack, PackAttrs, PackInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {concat} from './Concat';\nimport {expandDims} from './ExpandDims';\n\nexport function pack(\n args: {inputs: PackInputs, backend: WebGPUBackend, attrs: PackAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {axis} = attrs;\n\n if (inputs.length === 1) {\n return expandDims(\n {inputs: {input: inputs[0]}, backend, attrs: {dim: axis}});\n }\n\n const shape = inputs[0].shape;\n const dtype = inputs[0].dtype;\n\n inputs.forEach(t => {\n util.assertShapesMatch(\n shape, t.shape,\n 'All tensors passed to stack must have matching shapes');\n util.assert(\n dtype === t.dtype,\n () => 'All tensors passed to stack must have matching dtypes');\n });\n\n const intermediateTensorInfos: TensorInfo[] = [];\n const expandedTensors = inputs.map(t => {\n const expandedT =\n expandDims({inputs: {input: t}, backend, attrs: {dim: axis}});\n intermediateTensorInfos.push(expandedT);\n return expandedT;\n });\n\n const result = concat({inputs: expandedTensors, backend, attrs: {axis}});\n\n intermediateTensorInfos.forEach(t => backend.disposeData(t.dataId));\n\n return result;\n}\n\nexport const packConfig: KernelConfig = {\n kernelName: Pack,\n backendName: 'webgpu',\n kernelFunc: pack as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getCoordsDataType, getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class PadProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames = ['x'];\n uniforms = 'constantValue : f32,';\n workgroupSize: [number, number, number] = [64, 1, 1];\n xShape: number[];\n size = true;\n\n constructor(xShape: number[], paddings: Array<[number, number]>) {\n this.outputShape = paddings.map(\n (p, i) => p[0] /* beforePad */ + xShape[i] + p[1] /* afterPad */);\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n paddings.map((_, i) => {\n this.uniforms += ` pad${i} : vec2,`;\n });\n this.xShape = xShape;\n this.shaderKey = 'pad';\n }\n\n getUserCode(): string {\n const rank = this.xShape.length;\n const type = getCoordsDataType(rank);\n // The length of paddings are same with the rank of the input tensor.\n const start = this.xShape.map((_, i) => `uniforms.pad${i}[0]`).join(',');\n const end = this.xShape\n .map(\n (_, i) => `uniforms.pad${i}[0] + uniforms.xShape${\n rank > 1 ? `[${i}]` : ''}`)\n .join(',');\n const startValue = rank > 1 ? `${type}(${start})` : `${start}`;\n const endValue = rank > 1 ? `${type}(${end})` : `${end}`;\n\n const leftPadCondition = rank > 1 ? `any(outC < start)` : `outC < start`;\n const rightPadCondition = rank > 1 ? `any(outC >= end)` : `outC >= end`;\n\n const unpackedCoords = rank > 1 ?\n ['coords[0]', 'coords[1]', 'coords[2]', 'coords[3]'].slice(0, rank) :\n 'coords';\n\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n let start = ${startValue};\n let end = ${endValue};\n let outC = getCoordsFromIndex(index);\n\n if (${leftPadCondition} || ${rightPadCondition}) {\n setOutputAtIndex(index, uniforms.constantValue);\n } else {\n let coords = outC - start;\n setOutputAtIndex(index, getX(${unpackedCoords}));\n }\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, PadV2, PadV2Attrs, PadV2Inputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {identity} from './Identity';\nimport {PadProgram} from '../pad_webgpu';\nimport {fill} from './Fill';\n\nexport const padV2 =\n (args: {inputs: PadV2Inputs,\n backend: WebGPUBackend,\n attrs: PadV2Attrs}): TensorInfo => {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {paddings, constantValue} = attrs;\n if (paddings.every(p => util.arraysEqual(p, [0, 0]))) {\n return identity({inputs: {x}, backend});\n }\n if (util.sizeFromShape(x.shape) === 0) {\n // Short-circuit the computation, since x doesn't have value, only\n // the shape is used to compute output shape to pad.\n const outputShape = paddings.map(\n (p, i) =>\n p[0] /* beforePad */ + x.shape[i] + p[1] /* afterPad */);\n return fill({\n backend,\n attrs: {shape: outputShape, value: constantValue, dtype: x.dtype}\n });\n }\n const uniformData = [{type: 'float32', data: [constantValue]}];\n paddings.map(p => uniformData.push({type: 'int32', data: [p[0], p[1]]}));\n const program = new PadProgram(x.shape, paddings);\n return backend.runWebGPUProgram(program, [x], x.dtype, uniformData);\n };\n\nexport const padV2Config: KernelConfig = {\n kernelName: PadV2,\n backendName: 'webgpu',\n kernelFunc: padV2 as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Pow} from '@tensorflow/tfjs-core';\n\nimport {BinaryOpType} from '../binary_op_util';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nexport const pow = binaryKernelFunc({\n opType: BinaryOpType.POW,\n});\n\nexport const powConfig: KernelConfig = {\n kernelName: Pow,\n backendName: 'webgpu',\n kernelFunc: pow\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Prelu, PreluInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\n\nimport {BinaryOpType} from '../binary_op_util';\nimport {BinaryOpProgram} from '../binary_op_webgpu';\n\nexport function prelu(args: {inputs: PreluInputs, backend: WebGPUBackend}):\n TensorInfo {\n const {inputs, backend} = args;\n const {x, alpha} = inputs;\n\n const program = new BinaryOpProgram(BinaryOpType.PRELU, x.shape, alpha.shape);\n return backend.runWebGPUProgram(program, [x, alpha], 'float32');\n}\n\nexport const preluConfig: KernelConfig = {\n kernelName: Prelu,\n backendName: 'webgpu',\n kernelFunc: prelu as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Prod, ProdAttrs, ProdInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {reduce} from '../kernel_utils/reduce';\n\nexport function prod(\n args: {inputs: ProdInputs, backend: WebGPUBackend, attrs: ProdAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {axis, keepDims} = attrs;\n\n return reduce(x, axis, keepDims, 'prod', backend);\n}\n\nexport const prodConfig: KernelConfig = {\n kernelName: Prod,\n backendName: 'webgpu',\n kernelFunc: prod as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Range, RangeAttrs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {rangeImplCPU} from '../kernel_utils/shared';\n\nexport const range =\n (args: {backend: WebGPUBackend, attrs: RangeAttrs}): TensorInfo => {\n const {backend, attrs} = args;\n const {start, stop, step, dtype} = attrs;\n const values = rangeImplCPU(start, stop, step, dtype);\n return backend.makeTensorInfo([values.length], dtype, values);\n };\n\nexport const rangeConfig: KernelConfig = {\n kernelName: Range,\n backendName: 'webgpu',\n kernelFunc: range as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, RealDiv} from '@tensorflow/tfjs-core';\n\nimport {BinaryOpType} from '../binary_op_util';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nexport const realDiv = binaryKernelFunc({opType: BinaryOpType.DIV});\n\nexport const realDivConfig: KernelConfig = {\n kernelName: RealDiv,\n backendName: 'webgpu',\n kernelFunc: realDiv as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Reciprocal} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const reciprocal = unaryKernelFunc({opType: UnaryOpType.RECIPROCAL});\n\nexport const reciprocalConfig: KernelConfig = {\n kernelName: Reciprocal,\n backendName: 'webgpu',\n kernelFunc: reciprocal\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Relu} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const relu = unaryKernelFunc({opType: UnaryOpType.RELU});\n\nexport const reluConfig: KernelConfig = {\n kernelName: Relu,\n backendName: 'webgpu',\n kernelFunc: relu\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Relu6} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const relu6 = unaryKernelFunc({opType: UnaryOpType.RELU6});\n\nexport const relu6Config: KernelConfig = {\n kernelName: Relu6,\n backendName: 'webgpu',\n kernelFunc: relu6\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class ResizeBilinearProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames = ['x'];\n uniforms = 'adjustHeightWidth : vec2, halfPixelCenters : f32,';\n workgroupSize: [number, number, number] = [64, 1, 1];\n size = true;\n\n constructor(\n inputShape: [number, number, number, number], newHeight: number,\n newWidth: number) {\n this.outputShape = [inputShape[0], newHeight, newWidth, inputShape[3]];\n\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n\n this.shaderKey = `resizeBilinear`;\n }\n\n getUserCode(): string {\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n let coords = getCoordsFromIndex(index);\n let b = coords[0];\n let d = coords[3];\n let rc = coords.yz;\n\n let effectiveInSize = vec2(\n f32(uniforms.xShape.y) - uniforms.adjustHeightWidth[0],\n f32(uniforms.xShape.z) - uniforms.adjustHeightWidth[1]);\n\n let effectiveOutSize = vec2(\n f32(uniforms.outShape.y) - uniforms.adjustHeightWidth[0],\n f32(uniforms.outShape.z) - uniforms.adjustHeightWidth[1]);\n\n let effectiveInputOverOutputRatioRC =\n effectiveInSize / effectiveOutSize;\n\n // Fractional source index\n let sourceFracIndexRC =\n (vec2(rc) + vec2(uniforms.halfPixelCenters)) *\n effectiveInputOverOutputRatioRC - vec2(uniforms.halfPixelCenters);\n\n // Compute the four integer indices.\n let sourceFloorRC = vec2(sourceFracIndexRC);\n let sourceCeilRC = vec2(\n min(vec2(uniforms.xShape.yz) - vec2(1.0), ceil(sourceFracIndexRC)));\n\n let topLeft = getX(b, sourceFloorRC.x, sourceFloorRC.y, d);\n let bottomLeft = getX(b, sourceCeilRC.x, sourceFloorRC.y, d);\n let topRight = getX(b, sourceFloorRC.x, sourceCeilRC.y, d);\n let bottomRight = getX(b, sourceCeilRC.x, sourceCeilRC.y, d);\n\n let fracRC = sourceFracIndexRC - vec2(sourceFloorRC);\n\n let top = topLeft + (topRight - topLeft) * fracRC.y;\n let bottom = bottomLeft + (bottomRight - bottomLeft) * fracRC.y;\n let newValue = top + (bottom - top) * fracRC.x;\n\n setOutputAtIndex(index, newValue);\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, ResizeBilinear, ResizeBilinearAttrs, ResizeBilinearInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {ResizeBilinearProgram} from '../resize_bilinear_webgpu';\n\nexport function resizeBilinear(args: {\n inputs: ResizeBilinearInputs,\n backend: WebGPUBackend,\n attrs: ResizeBilinearAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {images} = inputs;\n const {alignCorners, size, halfPixelCenters} = attrs;\n\n const [newHeight, newWidth] = size;\n const adjustHeight = alignCorners && newHeight > 1 ? 1.0 : 0.0;\n const adjustWidth = alignCorners && newWidth > 1 ? 1.0 : 0.0;\n const halfPixelCentersValue = halfPixelCenters ? 0.5 : 0.0;\n const uniformData = [\n {type: 'float32', data: [adjustHeight, adjustWidth]},\n {type: 'float32', data: [halfPixelCentersValue]}\n ];\n\n const program = new ResizeBilinearProgram(\n images.shape as [number, number, number, number], newHeight, newWidth);\n\n return backend.runWebGPUProgram(program, [images], 'float32', uniformData);\n}\n\nexport const resizeBilinearConfig: KernelConfig = {\n kernelName: ResizeBilinear,\n backendName: 'webgpu',\n kernelFunc: resizeBilinear as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class ResizeNearestNeighborProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames = ['x'];\n uniforms = 'adjustHeightWidth : vec2, roundBase : f32,';\n workgroupSize: [number, number, number] = [64, 1, 1];\n halfPixelCenters: boolean;\n size = true;\n\n constructor(\n inputShape: [number, number, number, number], newHeight: number,\n newWidth: number, halfPixelCenters: boolean) {\n this.outputShape = [inputShape[0], newHeight, newWidth, inputShape[3]];\n\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n\n this.halfPixelCenters = halfPixelCenters;\n this.shaderKey = `resizeNearest_${halfPixelCenters}`;\n }\n\n getUserCode(): string {\n let sourceFracIndexRC: string;\n if (this.halfPixelCenters) {\n sourceFracIndexRC =\n `max((vec2(rc) + vec2(0.5)) * effectiveInputOverOutputRatioRC` +\n `, vec2(0.0))`;\n } else {\n sourceFracIndexRC = `vec2(rc) * effectiveInputOverOutputRatioRC`;\n }\n\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n let coords = getCoordsFromIndex(index);\n let b = coords[0];\n let d = coords[3];\n let rc = coords.yz;\n\n let effectiveInSize = vec2(\n f32(uniforms.xShape.y) - uniforms.adjustHeightWidth[0],\n f32(uniforms.xShape.z) - uniforms.adjustHeightWidth[1]);\n\n let effectiveOutSize = vec2(\n f32(uniforms.outShape.y) - uniforms.adjustHeightWidth[0],\n f32(uniforms.outShape.z) - uniforms.adjustHeightWidth[1]);\n\n let effectiveInputOverOutputRatioRC =\n effectiveInSize / effectiveOutSize;\n\n // Fractional source index\n let sourceFracIndexRC = ${sourceFracIndexRC};\n\n // Compute the coordinators of nearest neighbor point.\n let inputShapeRC = vec2(f32(uniforms.xShape.y), f32(uniforms.xShape.z));\n let sourceNearestRC = vec2(\n min(inputShapeRC - 1.0, floor(sourceFracIndexRC + uniforms.roundBase)));\n let newValue = getX(b, sourceNearestRC.x, sourceNearestRC.y, d);\n\n setOutputAtIndex(index, newValue);\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, ResizeNearestNeighbor, ResizeNearestNeighborAttrs, ResizeNearestNeighborInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {ResizeNearestNeighborProgram} from '../resize_nearest_neighbor_webgpu';\n\nexport function resizeNearestNeighbor(args: {\n inputs: ResizeNearestNeighborInputs,\n backend: WebGPUBackend,\n attrs: ResizeNearestNeighborAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {images} = inputs;\n const {alignCorners, halfPixelCenters, size} = attrs;\n\n const [newHeight, newWidth] = size;\n const adjustHeight = alignCorners && newHeight > 1 ? 1.0 : 0.0;\n const adjustWidth = alignCorners && newWidth > 1 ? 1.0 : 0.0;\n // When align corners is false, we rounds the value with floor.\n const roundBase = alignCorners ? 0.5 : 0.0;\n const uniformData = [\n {type: 'float32', data: [adjustHeight, adjustWidth]},\n {type: 'float32', data: [roundBase]}\n ];\n\n const program = new ResizeNearestNeighborProgram(\n images.shape as [number, number, number, number], newHeight, newWidth,\n halfPixelCenters);\n return backend.runWebGPUProgram(program, [images], images.dtype, uniformData);\n}\n\nexport const resizeNearestNeighborConfig: KernelConfig = {\n kernelName: ResizeNearestNeighbor,\n backendName: 'webgpu',\n kernelFunc: resizeNearestNeighbor as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class ReverseProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames = ['x'];\n uniforms: string;\n workgroupSize: [number, number, number] = [64, 1, 1];\n size = true;\n\n constructor(xShape: [number, number, number, number]) {\n this.outputShape = xShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n this.uniforms = ` axis : vec4,`;\n this.shaderKey = 'reverse';\n }\n\n getUserCode(): string {\n const reverseCoordsSnippet = `\n // Using uniform variables as judging conditions, so the function has\n // coherent execution within all threads.\n fn getReverseCoords(coords : vec4) -> vec4 {\n var reverseCoords = coords;\n if (uniforms.axis[0] == 1) {\n reverseCoords[0] = uniforms.xShape[0] - coords[0] - 1;\n }\n if (uniforms.axis[1] == 1) {\n reverseCoords[1] = uniforms.xShape[1] - coords[1] - 1;\n }\n if (uniforms.axis[2] == 1) {\n reverseCoords[2] = uniforms.xShape[2] - coords[2] - 1;\n }\n if (uniforms.axis[3] == 1) {\n reverseCoords[3] = uniforms.xShape[3] - coords[3] - 1;\n }\n\n return reverseCoords;\n }\n `;\n const userCode = `\n ${reverseCoordsSnippet}\n ${main('index')} {\n if (index < uniforms.size) {\n let coords = getCoordsFromIndex(index);\n let reverseCoords = getReverseCoords(coords);\n setOutputAtIndex(index, getX(reverseCoords[0],\n reverseCoords[1], reverseCoords[2], reverseCoords[3]));\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Reverse, ReverseAttrs, ReverseInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {ReverseProgram} from '../reverse_webgpu';\n\nimport {identity} from './Identity';\nimport {reshape} from './Reshape';\n\nexport function reverse(\n args: {inputs: ReverseInputs, backend: WebGPUBackend, attrs: ReverseAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {dims} = attrs;\n\n const xRank = x.shape.length;\n if (xRank === 0) {\n return identity({inputs: {x}, backend});\n }\n\n const xShape = x.shape;\n const xShape4D: [number, number, number, number] = [1, 1, 1, 1];\n xShape.forEach((d, i) => {\n const index = i + 4 - xRank;\n xShape4D[index] = d;\n });\n\n const axes = util.parseAxisParam(dims, x.shape);\n const dims4D: [number, number, number, number] = [0, 0, 0, 0];\n axes.forEach(ax => {\n const index = ax + 4 - xRank;\n dims4D[index] = 1;\n });\n const uniformData = [{type: 'int32', data: dims4D}];\n\n const xReshaped = reshape({inputs: {x}, backend, attrs: {shape: xShape4D}});\n\n const program = new ReverseProgram(xShape4D);\n const values = backend.runWebGPUProgram(\n program, [xReshaped], xReshaped.dtype, uniformData);\n backend.disposeData(xReshaped.dataId);\n\n const result =\n reshape({inputs: {x: values}, backend, attrs: {shape: xShape}});\n backend.disposeData(values.dataId);\n\n return result;\n}\n\nexport const reverseConfig: KernelConfig = {\n kernelName: Reverse,\n backendName: 'webgpu',\n kernelFunc: reverse as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class RotateProgram implements WebGPUProgram {\n outputShape: number[] = [];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames = ['x'];\n uniforms: string;\n workgroupSize: [number, number, number] = [64, 1, 1];\n fillSnippet: string;\n size = true;\n\n constructor(\n imageShape: [number, number, number, number],\n fillValue: number|[number, number, number]) {\n this.outputShape = imageShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n this.uniforms = `centerX : f32, centerY : f32, sinRadians : f32,\n cosRadians : f32,`;\n this.shaderKey = 'rotate';\n this.outputShape = imageShape;\n\n if (typeof fillValue === 'number') {\n this.uniforms += ` fillValue : f32,`;\n this.fillSnippet = `var outputValue = uniforms.fillValue;`;\n this.shaderKey += '_float';\n } else {\n this.uniforms += ` fillValue : vec3,`;\n this.fillSnippet = `var outputValue = uniforms.fillValue[coords[3]];`;\n this.shaderKey += '_vec3';\n }\n }\n\n getUserCode(): string {\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n let coords = getCoordsFromIndex(index);\n let coordXFloat = (f32(coords[2]) - uniforms.centerX) *\n uniforms.cosRadians - (f32(coords[1]) - uniforms.centerY) *\n uniforms.sinRadians;\n let coordYFloat = (f32(coords[2]) - uniforms.centerX) *\n uniforms.sinRadians + (f32(coords[1]) - uniforms.centerY) *\n uniforms.cosRadians;\n let coordX = i32(round(coordXFloat + uniforms.centerX));\n let coordY = i32(round(coordYFloat + uniforms.centerY));\n ${this.fillSnippet}\n if(coordX >= 0 && coordX < uniforms.xShape[2] && coordY >= 0 &&\n coordY < uniforms.xShape[1]) {\n outputValue = getX(coords[0], coordY, coordX, coords[3]);\n }\n setOutputAtIndex(index, outputValue);\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, Tensor4D} from '@tensorflow/tfjs-core';\nimport {RotateWithOffset, RotateWithOffsetAttrs, RotateWithOffsetInputs} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {RotateProgram} from '../rotate_webgpu';\n\nexport const rotateWithOffsetConfig: KernelConfig = {\n kernelName: RotateWithOffset,\n backendName: 'webgpu',\n kernelFunc: ({inputs, attrs, backend}) => {\n const {image} = inputs as RotateWithOffsetInputs;\n const {radians, fillValue, center} =\n attrs as unknown as RotateWithOffsetAttrs;\n const webgpuBackend = backend as WebGPUBackend;\n\n const program = new RotateProgram((image as Tensor4D).shape, fillValue);\n const [centerX, centerY] =\n backend_util.getImageCenter(center, image.shape[1], image.shape[2]);\n const uniformData = [\n {type: 'float32', data: [centerX]},\n {type: 'float32', data: [centerY]},\n {type: 'float32', data: [Math.sin(radians)]},\n {type: 'float32', data: [Math.cos(radians)]}\n ];\n\n if (typeof fillValue === 'number') {\n uniformData.push(\n {type: 'float32', data: [Number.parseFloat(fillValue.toFixed(2))]});\n } else {\n uniformData.push({type: 'float32', data: fillValue});\n }\n\n const output = webgpuBackend.runWebGPUProgram(\n program, [image], image.dtype, uniformData);\n return output;\n }\n };\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Round} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const round = unaryKernelFunc({opType: UnaryOpType.ROUND});\n\nexport const roundConfig: KernelConfig = {\n kernelName: Round,\n backendName: 'webgpu',\n kernelFunc: round\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Rsqrt} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {rsqrtImplCPU} from '../kernel_utils/shared';\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const rsqrt =\n unaryKernelFunc({opType: UnaryOpType.RSQRT, cpuKernelImpl: rsqrtImplCPU});\n\nexport const rsqrtConfig: KernelConfig = {\n kernelName: Rsqrt,\n backendName: 'webgpu',\n kernelFunc: rsqrt\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataType} from '@tensorflow/tfjs-core';\nimport {atomicAddSnippet} from './shader_util';\nimport {getCoordsDataType, getMainHeaderString as main, mapToWgslTypes, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class ScatterProgram implements WebGPUProgram {\n variableNames = ['updates', 'indices'];\n uniforms: string;\n outputShape: number[];\n sumDupeIndices: boolean;\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n workgroupSize: [number, number, number] = [64, 1, 1];\n updatesRank: number;\n indicesRank: number;\n sliceDimGreaterThanOne: boolean;\n atomic = true;\n type: DataType;\n\n constructor(\n flattenXShape: number[], sliceDim: number, indicesRank: number,\n updatesRank: number, strides: number[], shape: number[],\n outputDtype: DataType, sumDupeIndices = true) {\n this.outputShape = shape;\n this.type = outputDtype;\n this.sumDupeIndices = sumDupeIndices;\n this.dispatchLayout = flatDispatchLayout(flattenXShape);\n // Dispatching based on |updates| shape instead of output shape.\n this.dispatch =\n computeDispatch(this.dispatchLayout, flattenXShape, this.workgroupSize);\n this.sliceDimGreaterThanOne = sliceDim > 1;\n this.shaderKey = `scatter_${indicesRank}_${updatesRank}_${\n this.sliceDimGreaterThanOne}_${outputDtype}_${sumDupeIndices}`;\n const stridesType = getCoordsDataType(strides.length);\n this.uniforms =\n `sliceDim : i32, strides: ${stridesType}, updatesSize: i32,`;\n this.updatesRank = updatesRank;\n this.indicesRank = indicesRank;\n }\n\n getUserCode(): string {\n let indicesString = '';\n if (this.indicesRank === 1) {\n indicesString = 'coords[0]';\n } else if (this.indicesRank === 2) {\n indicesString = 'coords[0], j';\n }\n const indicesSnippet = `getIndices(${indicesString})`;\n\n const strideString = this.sliceDimGreaterThanOne ? 'uniforms.strides[j]' :\n 'uniforms.strides';\n\n let outCoordsString = '';\n let getUpdatesCoordsFromFlatIndex = '';\n if (this.dispatchLayout.x.length === 1) {\n outCoordsString = 'flattenedIndex';\n getUpdatesCoordsFromFlatIndex = `\n fn getUpdatesCoordsFromFlatIndex(index : i32) -> i32 {\n return index;\n }\n `;\n } else if (this.dispatchLayout.x.length === 2) {\n outCoordsString = 'vec2(flattenedIndex, coords[1])';\n getUpdatesCoordsFromFlatIndex = `\n fn getUpdatesCoordsFromFlatIndex(index : i32) -> vec2 {\n // N.B. |updates| could be a scalar tensor, conceptually representing a\n // 2D tensor with all values equal to that. By design, its size must be\n // the same as |outShape[1]| in one dimension, and |indicesShape[0]|\n // gives the other.\n let sliceSize = uniforms.outShape[1];\n let d0 = index / sliceSize;\n let d1 = index - d0 * sliceSize;\n return vec2(d0, d1);\n }\n `;\n }\n const updatesString =\n Array.from({length: this.updatesRank}, (_, idx) => `coords[${idx}]`);\n const updatesSnippet = `getUpdates(${updatesString.join(', ')})`;\n\n const userCode = `\n ${getUpdatesCoordsFromFlatIndex}\n ${main('index')} {\n if (index < uniforms.updatesSize) {\n let coords = getUpdatesCoordsFromFlatIndex(index);\n var flattenedIndex = 0;\n for (var j = 0; j < uniforms.sliceDim; j = j + 1) {\n let indexInside = i32(round(${indicesSnippet}));\n flattenedIndex = flattenedIndex + indexInside * ${strideString};\n }\n let updateValue =\n ${mapToWgslTypes(this.type, false)}(${updatesSnippet});\n let flatIndex = getOutputIndexFromCoords(${outCoordsString});\n\n ${\n this.sumDupeIndices ?\n atomicAddSnippet(\n '&result[flatIndex]', 'updateValue',\n this.type as 'float32' | 'int32') :\n `atomicStore(&result[flatIndex], bitcast(updateValue));`}\n }\n }`;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, ScatterNd, ScatterNdAttrs, ScatterNdInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {ScatterProgram} from '../scatter_webgpu';\n\nimport {fill} from './Fill';\nimport {reshape} from './Reshape';\n\nexport function scatterNd(args: {\n inputs: ScatterNdInputs,\n backend: WebGPUBackend,\n attrs: ScatterNdAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {indices, updates} = inputs;\n const {shape} = attrs;\n\n const {sliceRank, numUpdates, sliceSize, strides, outputSize} =\n backend_util.calculateShapes(updates, indices, shape);\n\n const flattenShape = [outputSize / sliceSize, sliceSize];\n\n if (outputSize === 0) {\n return backend.makeTensorInfo(shape, indices.dtype);\n }\n\n const flattenIndices = reshape(\n {inputs: {x: indices}, backend, attrs: {shape: [numUpdates, sliceRank]}});\n const flattenX = reshape(\n {inputs: {x: updates}, backend, attrs: {shape: [numUpdates, sliceSize]}});\n\n const type = flattenX.dtype;\n const output =\n fill({backend, attrs: {shape: flattenShape, value: 0, dtype: type}});\n const size = util.sizeFromShape(flattenX.shape);\n const uniformData = [\n {type: 'int32', data: [sliceRank]}, {type: 'int32', data: strides},\n {type: 'int32', data: [size]}\n ];\n const program = new ScatterProgram(\n flattenX.shape, sliceRank, flattenIndices.shape.length,\n flattenX.shape.length, strides, flattenShape, type);\n const res = backend.runWebGPUProgram(\n program, [flattenX, flattenIndices], type, uniformData, output);\n\n const reshaped = reshape({inputs: {x: res}, backend, attrs: {shape}});\n\n backend.disposeData(flattenIndices.dataId);\n backend.disposeData(flattenX.dataId);\n backend.disposeData(res.dataId);\n\n return reshaped;\n}\n\nexport const scatterNdConfig: KernelConfig = {\n kernelName: ScatterNd,\n backendName: 'webgpu',\n kernelFunc: scatterNd as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class SearchSortedProgram implements WebGPUProgram {\n outputShape: number[] = [];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames = ['sortedSequence', 'values'];\n uniforms = 'numInputs : i32,';\n workgroupSize: [number, number, number] = [64, 1, 1];\n size = true;\n side: string;\n\n constructor(outputShape: [number, number], side: 'left'|'right') {\n this.outputShape = outputShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n\n this.side = side;\n this.shaderKey = `search_sorted_${side}`;\n }\n\n getUserCode(): string {\n const boundComparator = this.side === 'left' ? '<' : '<=';\n const userCode = `\n fn findBound(batch: i32, value: f32) -> i32 {\n var left = i32(0);\n var right = uniforms.numInputs;\n while (left < right) {\n var mid = (left + right) / 2;\n if (getSortedSequence(batch, mid) ${boundComparator} value) {\n left = mid + 1;\n } else {\n right = mid;\n }\n }\n return right;\n }\n\n ${main('index')} {\n if (index < uniforms.size) {\n let coords = getCoordsFromIndex(index);\n let value = getValuesByOutputIndex(index);\n setOutputAtIndexI32(index, findBound(coords[0], value));\n }\n }\n `;\n\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, SearchSorted, SearchSortedAttrs, SearchSortedInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {SearchSortedProgram} from '../search_sorted_webgpu';\n\nexport function searchSorted(args: {\n inputs: SearchSortedInputs,\n backend: WebGPUBackend,\n attrs: SearchSortedAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {sortedSequence, values} = inputs;\n const {side} = attrs;\n\n const program =\n new SearchSortedProgram([values.shape[0], values.shape[1]], side);\n const uniformData = [{type: 'int32', data: [sortedSequence.shape[1]]}];\n return backend.runWebGPUProgram(\n program, [sortedSequence, values], 'int32', uniformData);\n}\n\nexport const searchSortedConfig: KernelConfig = {\n kernelName: SearchSorted,\n backendName: 'webgpu',\n kernelFunc: searchSorted as unknown as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class SelectProgram implements WebGPUProgram {\n variableNames = ['c', 'a', 'b'];\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n workgroupSize: [number, number, number] = [64, 1, 1];\n cRank: number;\n rank: number;\n size = true;\n\n constructor(cRank: number, shape: number[], rank: number) {\n this.outputShape = shape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n\n this.cRank = cRank;\n this.rank = rank;\n this.shaderKey = 'select';\n }\n\n getUserCode(): string {\n // TODO(WGSL): below code can be merged with getUserCode.\n let cCoords;\n let abCoords;\n if (this.rank > 4) {\n throw Error(`Where for rank ${this.rank} is not yet supported`);\n }\n\n if (this.rank === 1) {\n abCoords = `resRC`;\n cCoords = `resRC`;\n } else {\n const currentCoords = ['resRC.x', 'resRC.y', 'resRC.z', 'resRC.w'];\n const cCoordVars = [];\n const abCoordVars = [];\n for (let i = 0; i < this.outputShape.length; i++) {\n abCoordVars.push(`${currentCoords[i]}`);\n if (i < this.cRank) {\n cCoordVars.push(`${currentCoords[i]}`);\n }\n }\n cCoords = cCoordVars.join();\n abCoords = abCoordVars.join();\n }\n\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n let resRC = getCoordsFromIndex(index);\n let cVal = getC(${cCoords});\n if (cVal >= 1.0) {\n setOutputAtIndex(index, getA(${abCoords}));\n } else {\n setOutputAtIndex(index, getB(${abCoords}));\n }\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Select, SelectInputs, TensorInfo, upcastType} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {SelectProgram} from '../select_webgpu';\n\nexport function select(args: {inputs: SelectInputs, backend: WebGPUBackend}):\n TensorInfo {\n const {inputs, backend} = args;\n const {condition, t, e} = inputs;\n\n const program =\n new SelectProgram(condition.shape.length, t.shape, t.shape.length);\n return backend.runWebGPUProgram(\n program, [condition, t, e], upcastType(t.dtype, e.dtype));\n}\n\nexport const selectConfig: KernelConfig = {\n kernelName: Select,\n backendName: 'webgpu',\n kernelFunc: select as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Selu} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const selu = unaryKernelFunc({opType: UnaryOpType.SELU});\n\nexport const seluConfig: KernelConfig = {\n kernelName: Selu,\n backendName: 'webgpu',\n kernelFunc: selu\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Sigmoid} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const sigmoid = unaryKernelFunc({opType: UnaryOpType.SIGMOID});\n\nexport const sigmoidConfig: KernelConfig = {\n kernelName: Sigmoid,\n backendName: 'webgpu',\n kernelFunc: sigmoid,\n};\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Sign} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const sign = unaryKernelFunc({opType: UnaryOpType.SIGN});\n\nexport const signConfig: KernelConfig = {\n kernelName: Sign,\n backendName: 'webgpu',\n kernelFunc: sign\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Sin} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const sin = unaryKernelFunc({opType: UnaryOpType.SIN});\n\nexport const sinConfig: KernelConfig = {\n kernelName: Sin,\n backendName: 'webgpu',\n kernelFunc: sin\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Sinh} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const sinh = unaryKernelFunc({opType: UnaryOpType.SINH});\n\nexport const sinhConfig: KernelConfig = {\n kernelName: Sinh,\n backendName: 'webgpu',\n kernelFunc: sinh\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Sub} from '@tensorflow/tfjs-core';\n\nimport {BinaryOpType} from '../binary_op_util';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {subImplCPU as cpuSub} from '../kernel_utils/shared';\n\nexport const sub = binaryKernelFunc(\n {opType: BinaryOpType.SUB, cpuKernelImpl: cpuSub, supportsComplex: true});\n\nexport const subConfig: KernelConfig = {\n kernelName: Sub,\n backendName: 'webgpu',\n kernelFunc: sub\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, Softmax, SoftmaxAttrs, SoftmaxInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\n\nimport {exp} from './Exp';\nimport {max} from './Max';\nimport {realDiv} from './RealDiv';\nimport {reshape} from './Reshape';\nimport {sub} from './Sub';\nimport {sum} from './Sum';\n\nexport function softmax(\n args: {inputs: SoftmaxInputs, backend: WebGPUBackend, attrs: SoftmaxAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {logits} = inputs;\n const {dim} = attrs;\n\n const axes = util.parseAxisParam([dim], logits.shape);\n\n const maxLogit = max({\n inputs: {x: logits},\n backend,\n attrs: {reductionIndices: axes, keepDims: false}\n });\n\n const expandedShape = backend_util.expandShapeToKeepDim(maxLogit.shape, axes);\n\n const maxLogitsReshaped =\n reshape({inputs: {x: maxLogit}, backend, attrs: {shape: expandedShape}});\n const a =\n sub({inputs: {a: logits, b: maxLogitsReshaped}, backend}) as TensorInfo;\n const b = exp({inputs: {x: a}, backend}) as TensorInfo;\n const sumExp =\n sum({inputs: {x: b}, backend, attrs: {axis: axes, keepDims: false}});\n const sumExpReshaped =\n reshape({inputs: {x: sumExp}, backend, attrs: {shape: expandedShape}});\n const res =\n realDiv({inputs: {a: b, b: sumExpReshaped}, backend}) as TensorInfo;\n\n backend.disposeData(maxLogit.dataId);\n backend.disposeData(maxLogitsReshaped.dataId);\n backend.disposeData(a.dataId);\n backend.disposeData(b.dataId);\n backend.disposeData(sumExp.dataId);\n backend.disposeData(sumExpReshaped.dataId);\n\n return res;\n}\n\nexport const softmaxConfig: KernelConfig = {\n kernelName: Softmax,\n backendName: 'webgpu',\n kernelFunc: softmax as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Softplus} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const softplus = unaryKernelFunc({opType: UnaryOpType.SOFTPLUS});\n\nexport const softplusConfig: KernelConfig = {\n kernelName: Softplus,\n backendName: 'webgpu',\n kernelFunc: softplus\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, SpaceToBatchND, SpaceToBatchNDAttrs, SpaceToBatchNDInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\n\nimport {padV2} from './PadV2';\nimport {reshape} from './Reshape';\nimport {transpose} from './Transpose';\n\nexport const spaceToBatchND = (args: {\n inputs: SpaceToBatchNDInputs,\n backend: WebGPUBackend,\n attrs: SpaceToBatchNDAttrs\n}): TensorInfo => {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {blockShape, paddings} = attrs;\n\n util.assert(\n x.shape.length <= 4,\n () => 'spaceToBatchND for rank > 4 with a WebGPU backend not ' +\n 'implemented yet');\n\n const prod = blockShape.reduce((a, b) => a * b);\n\n const completePaddings: Array<[number, number]> = [[0, 0]];\n completePaddings.push(...paddings as Array<[number, number]>);\n for (let i = 1 + blockShape.length; i < x.shape.length; ++i) {\n completePaddings.push([0, 0]);\n }\n\n const toDispose = [];\n\n const paddedX = padV2({\n inputs: {x},\n backend,\n attrs: {paddings: completePaddings, constantValue: 0}\n });\n\n const reshapedPaddedShape =\n backend_util.getReshaped(paddedX.shape, blockShape, prod, false);\n\n const permutedReshapedPaddedPermutation = backend_util.getPermuted(\n reshapedPaddedShape.length, blockShape.length, false);\n\n const flattenShape =\n backend_util.getReshapedPermuted(paddedX.shape, blockShape, prod, false);\n\n const reshapedPaddedX = reshape(\n {inputs: {x: paddedX}, backend, attrs: {shape: reshapedPaddedShape}});\n\n const paddedXT = transpose({\n inputs: {x: reshapedPaddedX},\n backend,\n attrs: {perm: permutedReshapedPaddedPermutation}\n });\n\n const result =\n reshape({inputs: {x: paddedXT}, backend, attrs: {shape: flattenShape}});\n\n toDispose.push(paddedX);\n toDispose.push(reshapedPaddedX);\n toDispose.push(paddedXT);\n\n toDispose.forEach(t => backend.disposeData(t.dataId));\n\n return result;\n};\n\nexport const spaceToBatchNDConfig: KernelConfig = {\n kernelName: SpaceToBatchND,\n backendName: 'webgpu',\n kernelFunc: spaceToBatchND as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class TileProgram implements WebGPUProgram {\n variableNames = ['A'];\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n workgroupSize: [number, number, number] = [64, 1, 1];\n size = true;\n rank: number;\n\n constructor(aShape: number[], reps: number[]) {\n const outputShape: number[] = new Array(aShape.length);\n for (let i = 0; i < outputShape.length; i++) {\n outputShape[i] = aShape[i] * reps[i];\n }\n this.outputShape = outputShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n this.rank = this.outputShape.length;\n this.shaderKey = 'tile';\n }\n\n getUserCode(): string {\n const sourceCoords = getSourceCoords(this.rank, 'uniforms.');\n\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n let resRC = getCoordsFromIndex(index);\n setOutputAtIndex(index, getA(${sourceCoords}));\n }\n }\n `;\n return userCode;\n }\n}\n\nfunction getSourceCoords(rank: number, uniformPrefix = ''): string {\n if (rank >= 5) {\n throw Error(`Tile for rank ${rank} is not yet supported`);\n }\n if (rank === 1) {\n return `(resRC % ${uniformPrefix}aShape)`;\n }\n\n const currentCoords = ['resRC.x', 'resRC.y', 'resRC.z', 'resRC.w'];\n const sourceCoords = [];\n for (let i = 0; i < rank; i++) {\n sourceCoords.push(`(${currentCoords[i]} % ${uniformPrefix}aShape[${i}])`);\n }\n return sourceCoords.join();\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {buffer, KernelConfig, KernelFunc, TensorInfo, Tile, TileAttrs, TileInputs, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {tileImplCPU} from '../kernel_utils/shared';\nimport {TileProgram} from '../tile_webgpu';\n\nexport function tile(\n params: {inputs: TileInputs, backend: WebGPUBackend, attrs: TileAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = params;\n const {x} = inputs;\n const {reps} = attrs;\n\n // tile gpu program cannot handle rank >= 5 case.\n if (backend.shouldExecuteOnCPU([x]) || x.dtype === 'string' ||\n x.shape.length >= 5) {\n // Even thought string tensor is always on CPU, just to be consistent on how\n // to access tensor data.\n const data = backend.readSync(x.dataId);\n const value = x.dtype === 'string' ?\n (data as Uint8Array[]).map(d => util.decodeString(d)) :\n data as TypedArray;\n const buf = buffer(x.shape, x.dtype, value);\n const outBuf = tileImplCPU(buf, reps);\n return backend.makeTensorInfo(outBuf.shape, outBuf.dtype, outBuf.values);\n }\n\n const program = new TileProgram(x.shape, reps);\n const output = backend.runWebGPUProgram(program, [x], x.dtype);\n\n return output;\n}\n\nexport const tileConfig: KernelConfig = {\n kernelName: Tile,\n backendName: 'webgpu',\n kernelFunc: tile as unknown as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, Rank, SparseToDense, SparseToDenseAttrs, SparseToDenseInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {scatterImplCPU} from '../kernel_utils/shared';\nimport {ScatterProgram} from '../scatter_webgpu';\n\nimport {identity} from './Identity';\nimport {reshape} from './Reshape';\nimport {tile} from './Tile';\n\nexport function sparseToDense(args: {\n inputs: SparseToDenseInputs,\n backend: WebGPUBackend,\n attrs: SparseToDenseAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {sparseIndices, sparseValues, defaultValue} = inputs;\n const {outputShape} = attrs;\n\n const {sliceRank, numUpdates, sliceSize, strides, outputSize} =\n backend_util.calculateShapes(sparseValues, sparseIndices, outputShape);\n\n const sumDupeIndices = false;\n if (sparseValues.dtype === 'string') {\n const indicesBuf = backend.bufferSync(sparseIndices);\n const updatesBuf = backend.bufferSync(sparseValues);\n const $defaultValue = util.decodeString(\n backend.readSync(defaultValue.dataId)[0] as Uint8Array);\n const outBuf = scatterImplCPU(\n indicesBuf, updatesBuf, outputShape, outputSize, sliceSize, numUpdates,\n sliceRank, strides, $defaultValue, sumDupeIndices);\n return backend.makeTensorInfo(outputShape, outBuf.dtype, outBuf.values);\n }\n\n const flattenShape = [outputSize / sliceSize, sliceSize];\n\n const $sparseIndices = reshape({\n inputs: {x: sparseIndices},\n backend,\n attrs: {shape: [numUpdates, sliceRank]}\n });\n const $sparseValues = sparseValues.shape.length ?\n reshape({\n inputs: {x: sparseValues},\n backend,\n attrs: {shape: [numUpdates, sliceSize]}\n }) :\n identity({inputs: {x: sparseValues}, backend});\n\n const type = $sparseValues.dtype;\n const zero =\n backend.makeTensorInfo([], type, util.makeZerosTypedArray(1, type));\n\n // Fill output tensor with the default value.\n const $defaultValue = reshape({\n inputs: {x: defaultValue},\n backend,\n attrs: {shape: Array(flattenShape.length).fill(1)}\n });\n const $denseValues =\n tile({inputs: {x: $defaultValue}, backend, attrs: {reps: flattenShape}});\n\n const size = util.sizeFromShape([numUpdates, sliceSize]);\n const uniformData = [\n {type: 'int32', data: [sliceRank]},\n {type: 'int32', data: strides},\n {type: 'int32', data: [size]},\n ];\n\n switch (numUpdates) {\n case 0:\n break;\n case 1:\n if (true) {\n const program = new ScatterProgram(\n [numUpdates, sliceSize], sliceRank, $sparseIndices.shape.length,\n $sparseValues.shape.length, strides, flattenShape, type,\n sumDupeIndices);\n backend.runWebGPUProgram(\n program, [$sparseValues, $sparseIndices], type, uniformData,\n $denseValues);\n }\n break;\n default:\n if (true) {\n // First replace the default value with 0 at indices.\n const program = new ScatterProgram(\n [numUpdates, sliceSize], sliceRank, $sparseIndices.shape.length,\n zero.shape.length, strides, flattenShape, type, sumDupeIndices);\n backend.runWebGPUProgram(\n program, [zero, $sparseIndices], type, uniformData, $denseValues);\n }\n {\n // Then replace 0 with the (sum of) sparse value(s) at indices.\n const program = new ScatterProgram(\n [numUpdates, sliceSize], sliceRank, $sparseIndices.shape.length,\n $sparseValues.shape.length, strides, flattenShape, type);\n backend.runWebGPUProgram(\n program, [$sparseValues, $sparseIndices], type, uniformData,\n $denseValues);\n }\n }\n\n const denseValues = reshape(\n {inputs: {x: $denseValues}, backend, attrs: {shape: outputShape}});\n\n backend.disposeData($sparseIndices.dataId);\n backend.disposeData($sparseValues.dataId);\n backend.disposeData($defaultValue.dataId);\n backend.disposeData(zero.dataId);\n backend.disposeData($denseValues.dataId);\n return denseValues;\n}\n\nexport const sparseToDenseConfig: KernelConfig = {\n kernelName: SparseToDense,\n backendName: 'webgpu',\n kernelFunc: sparseToDense as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, SplitV, SplitVAttrs, SplitVInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {slice} from './Slice';\n\nexport function splitV(\n args: {inputs: SplitVInputs, backend: WebGPUBackend, attrs: SplitVAttrs}):\n TensorInfo[] {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {numOrSizeSplits, axis} = attrs;\n\n const $axis = util.parseAxisParam(axis, x.shape)[0];\n const splitSizes = backend_util.prepareSplitSize(x, numOrSizeSplits, $axis);\n\n const xRank = x.shape.length;\n const begin = new Array(xRank).fill(0);\n const size = x.shape.slice();\n\n return splitSizes.map(s => {\n const sliceSize = [...size];\n sliceSize[$axis] = s;\n const sliceT =\n slice({inputs: {x}, backend, attrs: {begin, size: sliceSize}});\n begin[$axis] += s;\n return sliceT;\n });\n}\n\nexport const splitVConfig: KernelConfig = {\n kernelName: SplitV,\n backendName: 'webgpu',\n kernelFunc: splitV as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Sqrt} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const sqrt = unaryKernelFunc({opType: UnaryOpType.SQRT});\n\nexport const sqrtConfig: KernelConfig = {\n kernelName: Sqrt,\n backendName: 'webgpu',\n kernelFunc: sqrt\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Square, SquareInputs} from '@tensorflow/tfjs-core';\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {UnaryOpProgram} from '../unary_op_webgpu';\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const squareConfig: KernelConfig = {\n kernelName: Square,\n backendName: 'webgpu',\n kernelFunc: ({inputs, backend}) => {\n const {x} = inputs as SquareInputs;\n const webGPUBackend = backend as WebGPUBackend;\n const program = new UnaryOpProgram(x.shape, UnaryOpType.SQUARE);\n return webGPUBackend.runWebGPUProgram(program, [x], x.dtype);\n }\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, SquaredDifference} from '@tensorflow/tfjs-core';\n\nimport {BinaryOpType} from '../binary_op_util';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nexport const squaredDifference = binaryKernelFunc({\n opType: BinaryOpType.SQUARED_DIFFERENCE,\n});\n\nexport const squaredDifferenceConfig: KernelConfig = {\n kernelName: SquaredDifference,\n backendName: 'webgpu',\n kernelFunc: squaredDifference\n};\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Step, StepAttrs, TensorInfo, UnaryInputs} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {UnaryOpType} from '../unary_op_util';\nimport {UnaryOpProgram} from '../unary_op_webgpu';\n\nexport function step(\n {inputs, attrs, backend}:\n {inputs: UnaryInputs, attrs: StepAttrs, backend: WebGPUBackend}):\n TensorInfo {\n const {x} = inputs;\n const program =\n new UnaryOpProgram(x.shape, UnaryOpType.STEP, 'stepAlpha : f32,');\n const uniformData = [{type: 'float32', data: [attrs.alpha]}];\n return backend.runWebGPUProgram(program, [x], x.dtype, uniformData);\n}\n\nexport const stepConfig: KernelConfig = {\n kernelName: Step,\n backendName: 'webgpu',\n kernelFunc: step as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getCoordsDataType, getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class StridedSliceProgram implements WebGPUProgram {\n variableNames = ['x'];\n uniforms: string;\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n // TODO(xing.xu): Increase the workPerThread.\n workPerThread = 1;\n workgroupSize: [number, number, number] = [64, 1, 1];\n size = true;\n\n constructor(destSize: number[]) {\n this.outputShape = destSize;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize,\n [this.workPerThread, 1, 1]);\n\n const dtype = getCoordsDataType(this.outputShape.length);\n this.uniforms = `begin : ${dtype}, strides : ${dtype}, `;\n this.shaderKey = 'stridedSlice';\n }\n\n getUserCode(): string {\n const rank = this.outputShape.length;\n let newCoords = '';\n if (rank === 1) {\n newCoords = 'coords * uniforms.strides + uniforms.begin';\n } else {\n let outputAxis = 0;\n newCoords =\n this.outputShape\n .map((_, i) => {\n outputAxis++;\n return this.outputShape.length === 1 ?\n `coords * uniforms.strides[${i}] + uniforms.begin[${i}]` :\n `coords[${outputAxis - 1}] * uniforms.strides[${\n i}] + uniforms.begin[${i}]`;\n })\n .join(',');\n }\n\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n let coords = getCoordsFromIndex(index);\n setOutputAtIndex(index, getX(${newCoords}));\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {buffer, KernelConfig, KernelFunc, Rank, slice_util, StridedSlice, StridedSliceAttrs, StridedSliceInputs, TensorBuffer, TensorInfo, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {stridedSliceImplCPU} from '../kernel_utils/shared';\n\nimport {reshape} from './Reshape';\nimport {slice} from './Slice';\nimport {StridedSliceProgram} from '../strided_slice_webgpu';\n\nexport function stridedSlice(args: {\n inputs: StridedSliceInputs,\n backend: WebGPUBackend,\n attrs: StridedSliceAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {\n begin,\n end,\n strides,\n beginMask,\n endMask,\n ellipsisMask,\n newAxisMask,\n shrinkAxisMask\n } = attrs;\n\n const {\n finalShapeSparse,\n finalShape,\n isIdentity,\n sliceDim0,\n isSimpleSlice,\n begin: $begin,\n end: $end,\n strides: $strides\n } =\n slice_util.sliceInfo(\n x.shape, begin, end, strides, beginMask, endMask, ellipsisMask,\n newAxisMask, shrinkAxisMask);\n\n let result;\n\n if (isIdentity) {\n // Optimization #1, slice is a no-op plus reshape\n result = reshape({inputs: {x}, backend, attrs: {shape: finalShape}});\n } else if (sliceDim0 || isSimpleSlice) {\n // Optimization #2, slice is memory contiguous (only occurs in dim 0)\n util.assert(\n x.shape.length >= 1,\n () => `Input must have rank at least 1, got: ${x.shape.length}`);\n\n const size = slice_util.computeOutShape($begin, $end, $strides);\n // To tolerate begin[0] > end[0] (a 0-output slice), we min(begin, end).\n const sliced = slice({inputs: {x}, backend, attrs: {begin: $begin, size}});\n result =\n reshape({inputs: {x: sliced}, backend, attrs: {shape: finalShape}});\n backend.disposeData(sliced.dataId);\n } else {\n const shouldExecuteOnCPU = backend.shouldExecuteOnCPU([x]);\n if (shouldExecuteOnCPU) {\n const values = backend.readSync(x.dataId) as TypedArray;\n const xBuf = buffer(x.shape, x.dtype, values) as TensorBuffer;\n const resultValues =\n stridedSliceImplCPU(finalShapeSparse, xBuf, $strides, $begin);\n result = backend.makeTensorInfo(finalShape, x.dtype, resultValues.values);\n } else {\n const program = new StridedSliceProgram(finalShapeSparse);\n const uniformData =\n [{type: 'int32', data: $begin}, {type: 'int32', data: $strides}];\n const resultValues =\n backend.runWebGPUProgram(program, [x], x.dtype, uniformData);\n result = reshape(\n {inputs: {x: resultValues}, backend, attrs: {shape: finalShape}});\n backend.disposeData(resultValues.dataId);\n }\n }\n\n return result;\n}\n\nexport const stridedSliceConfig: KernelConfig = {\n kernelName: StridedSlice,\n backendName: 'webgpu',\n kernelFunc: stridedSlice as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, StringNGrams, StringNGramsAttrs, StringNGramsInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {stringNGramsImplCPU} from '../kernel_utils/shared';\n\nexport function stringNGrams(args: {\n inputs: StringNGramsInputs,\n backend: WebGPUBackend,\n attrs: StringNGramsAttrs\n}): [TensorInfo, TensorInfo] {\n const {inputs, backend, attrs} = args;\n const {\n separator,\n nGramWidths,\n leftPad,\n rightPad,\n padWidth,\n preserveShortSequences\n } = attrs;\n const {data, dataSplits} = inputs;\n const $data = backend.readSync(data.dataId) as Uint8Array[];\n const $dataSplits = backend.readSync(dataSplits.dataId) as Int32Array;\n\n const [nGrams, nGramsSplits] = stringNGramsImplCPU(\n $data, $dataSplits, separator, nGramWidths, leftPad, rightPad, padWidth,\n preserveShortSequences);\n return [\n backend.makeTensorInfo([nGrams.length], 'string', nGrams),\n backend.makeTensorInfo(dataSplits.shape, 'int32', nGramsSplits),\n ];\n}\n\nexport const stringNGramsConfig: KernelConfig = {\n kernelName: StringNGrams,\n backendName: 'webgpu',\n kernelFunc: stringNGrams as unknown as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Tan} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const tan = unaryKernelFunc({opType: UnaryOpType.TAN});\n\nexport const tanConfig: KernelConfig = {\n kernelName: Tan,\n backendName: 'webgpu',\n kernelFunc: tan\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Tanh} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const tanh = unaryKernelFunc({opType: UnaryOpType.TANH});\n\nexport const tanhConfig: KernelConfig = {\n kernelName: Tanh,\n backendName: 'webgpu',\n kernelFunc: tanh\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\n// Based on Algorithm 2 of Bitonic Top K, ref:\n// https://anilshanbhag.in/static/papers/gputopk_sigmod18.pdf\n// The original algorithm is based on computing the top K only, however\n// since for TFJS we require the indices of the top K values as well then the\n// algorithm found here is a bit modified. Rather than producing the values\n// at each step, the indices containing the top K are generated instead.\n// The output values are not generated to reduce the number of outputs in the\n// GPU, the values can easily be retrieved from the indices using a gather\n// op.\n\nexport class SwapProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames = ['x', 'indices'];\n uniforms: string;\n workgroupSize: [number, number, number] = [256, 1, 1];\n size = true;\n\n constructor(shape: number[]) {\n this.outputShape = shape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n this.uniforms = `inputSize : i32, firstPass : i32, negativeInf : f32,\n dir : i32, inc : i32,`;\n this.shaderKey = 'swap';\n }\n\n getUserCode(): string {\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n let outC = getCoordsFromIndex(index);\n let batch = outC[0];\n let elemIdx = outC[1];\n // We compare elements pair-wise within a group of size 2 * inc.\n // The comparing rule for each group alternates between ascending\n // and descending. Within each group, we compare each pair at\n // positions i and i+inc. To decide whether an element at position i\n // is x0 or x1, we mod it by 2 * inc, if the result is smaller than\n // inc, it is in the first half of the group, we denote it as x0,\n // otherwise we denote it as x1.\n // For example, as shown in the Bitonic top K paper referenced\n // above, Figure5(a) shows that element[1] is in the second half of\n // the group when group size is 2, but it is in the first half of\n // the group when group size is 4.\n let isFirstInPair = elemIdx % (2 * uniforms.inc) < uniforms.inc;\n var i = 0;\n if (isFirstInPair) {\n i = elemIdx;\n } else {\n i = elemIdx - uniforms.inc;\n }\n\n var i0 = 0;\n if (uniforms.firstPass == 1) {\n i0 = i;\n } else {\n i0 = i32(getIndices(batch, i));\n }\n\n var i1 = 0;\n if (uniforms.firstPass == 1) {\n i1 = i + uniforms.inc;\n } else {\n i1 = i32(getIndices(batch, i + uniforms.inc));\n }\n\n var x0 = f32(0.0);\n var x1 = f32(0.0);\n if (i0 < uniforms.inputSize) {\n x0 = getX(batch, i0);\n } else {\n x0 = uniforms.negativeInf;\n }\n if (i1 < uniforms.inputSize) {\n x1 = getX(batch, i1);\n } else {\n x1 = uniforms.negativeInf;\n }\n\n let reverse = elemIdx % (2 * uniforms.dir) >= uniforms.dir;\n let isGreater = x0 > x1 || (x0 == x1 && i1 > i0);\n if (reverse == isGreater) {\n // Elements in opposite order of direction\n let iTemp = i0;\n i0 = i1;\n i1 = iTemp;\n }\n if (isFirstInPair) {\n setOutputAtIndex(index, f32(i0));\n } else {\n setOutputAtIndex(index, f32(i1));\n }\n }\n }\n `;\n return userCode;\n }\n}\n\nexport class MergeProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames = ['x', 'indices'];\n uniforms: string;\n workgroupSize: [number, number, number] = [256, 1, 1];\n size = true;\n\n constructor(shape: number[]) {\n this.outputShape = shape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n // |n| Size of the original input of TopK\n // |firstPass| indicates if this is the first time swap is being used which\n // means no indices input containing the top K is present yet.\n // |k| Top k elements desired\n this.uniforms = `inputSize : i32, firstPass : i32, k : i32,`;\n this.shaderKey = 'merge';\n }\n\n getUserCode(): string {\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n let outC = getCoordsFromIndex(index);\n let batch = outC[0];\n let elemIdx = outC[1];\n // The output size is half of the previous size.\n // If the previous sequence is | | | | _ _ _ _ | | | | _ _ _ _\n // (k=4), we only need to output the indices at positions |, the\n // indices at positions _ can be thrown away, see Figure5(b) After\n // Phase 2 (Merge phase) in the Bitonic Top K paper referenced\n // above.\n // For example, the paper shows we only need to output the orange\n // bars. The output sequence should look like this | | | | | | | |.\n // Because the sequence is halved, to map the output index back to\n // the previous sequence to find the corresponding value, we need\n // to double the index. When we double the index, we basically\n // interpolate a position, so 2i looks like\n // | _ | _ | _ | _ | _ | _ | _. We move the | to the first k\n // position of each 2k positions by - elemIdx % k. E.g. for output\n // at index 4,5,6,7, we want to get the corresponding element at\n // original index 8,9,10,11, for output at index 8,9,10,11,\n // we want to get the corresponding element at original index\n // 16,17,18,19, so on and so forth.\n\n var i = 0;\n if (elemIdx < uniforms.k) {\n i = elemIdx;\n } else {\n i = elemIdx * 2 - elemIdx % uniforms.k;\n }\n var i0 = 0;\n if (uniforms.firstPass == 1) {\n i0 = i;\n } else {\n i0 = i32(getIndices(batch, i));\n }\n var i1 = 0;\n if (uniforms.firstPass == 1) {\n i1 = i + uniforms.k;\n } else {\n i1 = i32(getIndices(batch, i + uniforms.k));\n }\n\n let x0 = getX(batch, i0);\n var x1 = f32(0.0);\n if (i1 < uniforms.inputSize) {\n x1 = getX(batch, i1);\n } else {\n x1 = x0;\n }\n\n if (x0 >= x1) {\n setOutputAtIndex(index, f32(i0));\n } else {\n setOutputAtIndex(index, f32(i1));\n }\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, NumericDataType, TensorInfo, TopK, TopKAttrs, TopKInputs, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {topKImplCPU} from '../kernel_utils/shared';\nimport {MergeProgram, SwapProgram} from '../top_k_webgpu';\nimport {fill} from './Fill';\nimport {gatherV2} from './GatherV2';\nimport {reshape} from './Reshape';\nimport {slice} from './Slice';\n\nfunction disposeIntermediateTensorInfoOrNull(\n backend: WebGPUBackend, tensorInfo: TensorInfo) {\n if (tensorInfo !== null) {\n backend.disposeData(tensorInfo.dataId);\n }\n}\n\nfunction roundUpToPow2(num: number) {\n let pow2 = 1;\n while (pow2 < num) {\n pow2 *= 2;\n }\n return pow2;\n}\n\n// Based on Algorithm 2 of Bitonic Top K, ref:\n// https://anilshanbhag.in/static/papers/gputopk_sigmod18.pdf\nexport function topK(\n args: {inputs: TopKInputs, backend: WebGPUBackend, attrs: TopKAttrs}):\n TensorInfo[] {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {k, sorted}= attrs;\n\n const xShape = x.shape;\n const lastDim = xShape[xShape.length - 1];\n\n if (backend.shouldExecuteOnCPU([x])) {\n const xVals = backend.readSync(x.dataId) as TypedArray;\n const [allTopKVals, allTopKIndices] =\n topKImplCPU(xVals, xShape, x.dtype as NumericDataType, k, sorted);\n\n return [\n backend.makeTensorInfo(\n allTopKVals.shape, allTopKVals.dtype, allTopKVals.values),\n backend.makeTensorInfo(\n allTopKIndices.shape, allTopKIndices.dtype, allTopKIndices.values)\n ];\n }\n\n if (k === 0) {\n xShape[xShape.length - 1] = 0;\n return [\n backend.makeTensorInfo(xShape, x.dtype, []),\n backend.makeTensorInfo(xShape, 'int32', [])\n ];\n }\n\n if (lastDim === 1 /* firstPass */) {\n return [\n x, fill({attrs: {shape: xShape, dtype: 'int32', value: 0}, backend})\n ];\n }\n\n // Reshape into a 2d tensor [batch, lastDim] and compute topk along lastDim.\n const xSize = util.sizeFromShape(xShape);\n const batch = xSize / lastDim;\n const x2D = reshape({inputs: {x}, attrs: {shape: [batch, lastDim]}, backend});\n\n const kPow2 = roundUpToPow2(k);\n const lastDimPow2 = roundUpToPow2(lastDim);\n\n // Only the indices containing the top K are kept at every step to reduce\n // number of outputs in the GPU algorithms, so once the final set of indices\n // is computed then gather is used to grab the corresponding values\n // from the original input.\n let indices: TensorInfo = null;\n\n // GPU algorithm always takes in an indices input but this input is not used\n // on the first run of a GPU algorithm, therefore if indices is null we simply\n // pass in x2D instead of it but the value will not actually be used\n const getInputs = () => indices === null ? [x2D, x2D] : [x2D, indices];\n\n const runSwap = (dir: number, inc: number, shape: number[]) => {\n const inputs = getInputs();\n const program = new SwapProgram(shape);\n const firstPass = indices === null ? 1 : 0;\n const uniformDataSwap = [\n {type: 'int32', data: [lastDim]},\n {type: 'int32', data: [firstPass]},\n {type: 'float32', data: [Number.NEGATIVE_INFINITY]},\n {type: 'int32', data: [dir]},\n {type: 'int32', data: [inc]}\n ];\n const prevIndices = indices;\n indices = backend.runWebGPUProgram(\n program, inputs, 'int32', uniformDataSwap);\n disposeIntermediateTensorInfoOrNull(backend, prevIndices);\n };\n\n // Step 1: local sort\n for (let len = 1; len < kPow2; len *= 2) {\n const dir = len * 2;\n for (let inc = len; inc >= 1; inc /= 2) {\n runSwap(dir, inc, [batch, lastDimPow2]);\n }\n }\n\n // Step 2: merge\n for (let indicesSize = lastDimPow2; indicesSize > kPow2; indicesSize /= 2) {\n const inputs = getInputs();\n const mergeProgram = new MergeProgram([batch, indicesSize / 2]);\n const firstPass = indices === null ? 1 : 0;\n const uniformDataMerge = [\n {type: 'int32', data: [lastDim]},\n {type: 'int32', data: [firstPass]},\n {type: 'int32', data: [kPow2]}\n ];\n const prevIndices = indices;\n indices = backend.runWebGPUProgram(\n mergeProgram, inputs, 'int32', uniformDataMerge);\n disposeIntermediateTensorInfoOrNull(backend, prevIndices);\n\n // Step 3: rebuild\n const len = kPow2 / 2;\n const dir = len * 2;\n for (let inc = len; inc >= 1; inc /= 2) {\n runSwap(dir, inc, indices.shape);\n }\n }\n\n // Keep only the requested top K results instead of kPow2\n let prevIndices = indices;\n indices = slice(\n {inputs: {x: indices}, backend, attrs: {begin: 0, size: [batch, k]}});\n disposeIntermediateTensorInfoOrNull(backend, prevIndices);\n\n // Gather values on last dimension\n let values = gatherV2(\n {inputs: {x: x2D, indices}, backend, attrs: {axis: 1, batchDims: 1}});\n disposeIntermediateTensorInfoOrNull(backend, x2D);\n\n // Reshape back to the original input shape, except that the last\n // dimension is k.\n const newShape = xShape.slice(0, -1);\n newShape.push(k);\n\n prevIndices = indices;\n indices = reshape({inputs: {x: indices}, attrs: {shape: newShape}, backend});\n disposeIntermediateTensorInfoOrNull(backend, prevIndices);\n\n const prevValues = values;\n values = reshape({inputs: {x: values}, attrs: {shape: newShape}, backend});\n disposeIntermediateTensorInfoOrNull(backend, prevValues);\n\n return [values, indices];\n}\n\nexport const topKConfig: KernelConfig = {\n kernelName: TopK,\n backendName: 'webgpu',\n kernelFunc: topK as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class TransformProgram implements WebGPUProgram {\n variableNames = ['Image', 'Transforms'];\n outputShape: number[];\n uniforms = 'interpolationModeId : i32, fillModeId : i32, fillValue : f32,';\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n workgroupSize: [number, number, number] = [64, 1, 1];\n size = true;\n\n constructor(outShape: [number, number, number, number]) {\n this.outputShape = outShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workgroupSize);\n this.shaderKey = 'transform';\n }\n\n getUserCode(): string {\n const userCode = `\n fn mapCoord(outCoord : f32, len : f32) -> f32{\n var inCoord = outCoord;\n if(uniforms.fillModeId == 2) {\n if (inCoord < 0.0) {\n if (len <= 1.0) {\n inCoord = 0.0;\n } else {\n let sz2 = 2.0 * len;\n if (inCoord < sz2) {\n inCoord = sz2 * f32(i32(f32(-inCoord / sz2))) +\n inCoord;\n }\n if (inCoord < -len) {\n inCoord = inCoord + sz2;\n } else {\n inCoord = -inCoord - 1.0;\n }\n }\n } else if (inCoord > len - 1.0) {\n if (len <= 1.0) {\n inCoord = 0.0;\n } else {\n let sz2 = 2.0 * len;\n inCoord = inCoord - sz2 * f32(i32(f32(inCoord / sz2)));\n if (inCoord >= len) {\n inCoord = sz2 - inCoord - 1.0;\n }\n }\n }\n return clamp(inCoord, 0.0, len - 1.0);\n } else if (uniforms.fillModeId == 3) {\n if (inCoord < 0.0) {\n if (len <= 1.0) {\n inCoord = 0.0;\n } else {\n let sz = len - 1.0;\n inCoord = inCoord + len * (f32(i32(f32(-inCoord / sz))) + 1.0);\n }\n } else if (inCoord > len - 1.0) {\n if (len <= 1.0) {\n inCoord = 0.0;\n } else {\n let sz = len - 1.0;\n inCoord = inCoord - len * f32(i32(f32(inCoord / sz)));\n }\n }\n return clamp(inCoord, 0.0, len - 1.0);\n } else if (uniforms.fillModeId == 4) {\n return clamp(outCoord, 0.0, len - 1.0);\n }\n return outCoord;\n }\n fn readWithFillValue(batch : i32, coordY : i32, coordX : i32,\n channel : i32) -> f32 {\n var outputValue : f32;\n if (0 <= coordY && coordY < uniforms.imageShape[1] && 0 <= coordX && coordX < uniforms.imageShape[2]) {\n outputValue = getImage(batch, coordY, coordX, channel);\n } else {\n outputValue = uniforms.fillValue;\n }\n return outputValue;\n }\n\n ${main('index')} {\n if (index < uniforms.size) {\n let coords = getCoordsFromIndex(index);\n var outputValue : f32;\n let batch = coords[0];\n let x = coords[2];\n let y = coords[1];\n let channel = coords[3];\n let xf = f32(x);\n let yf = f32(y);\n let a1 = getTransforms(batch, 0);\n let a2 = getTransforms(batch, 1);\n let a3 = getTransforms(batch, 2);\n let b1 = getTransforms(batch, 3);\n let b2 = getTransforms(batch, 4);\n let b3 = getTransforms(batch, 5);\n let c1 = getTransforms(batch, 6);\n let c2 = getTransforms(batch, 7);\n let projection = c1 * xf + c2 * yf + 1.0;\n if (projection == 0.0) {\n outputValue = uniforms.fillValue;\n } else {\n let inX = (a1 * xf + a2 * yf + a3) / projection;\n let inY = (b1 * xf + b2 * yf + b3) / projection;\n let mapX = mapCoord(inX, f32(uniforms.imageShape[2]));\n let mapY = mapCoord(inY, f32(uniforms.imageShape[1]));\n\n if (uniforms.interpolationModeId == 1) {\n let coordY = i32(round(mapY));\n let coordX = i32(round(mapX));\n outputValue = readWithFillValue(batch, coordY, coordX,\n channel);\n } else {\n let yFloor = floor(mapY);\n let xFloor = floor(mapX);\n let yCeil = yFloor + 1.0;\n let xCeil = xFloor + 1.0;\n let valueYFloor = (xCeil - mapX) *\n readWithFillValue(batch, i32(yFloor), i32(xFloor), channel) +\n (mapX - xFloor) *\n readWithFillValue(batch, i32(yFloor), i32(xCeil), channel);\n let valueYCeil = (xCeil - mapX) *\n readWithFillValue(batch, i32(yCeil), i32(xFloor), channel) +\n (mapX - xFloor) *\n readWithFillValue(batch, i32(yCeil), i32(xCeil), channel);\n outputValue = (yCeil - mapY) * valueYFloor +\n (mapY - yFloor) * valueYCeil;\n }\n }\n setOutputAtIndex(index, outputValue);\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, TensorInfo, Transform, TransformAttrs, TransformInputs} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {TransformProgram} from '../transform_webgpu';\n\nexport function transform(args: {\n inputs: TransformInputs,\n backend: WebGPUBackend,\n attrs: TransformAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {image, transforms} = inputs;\n const {interpolation, fillMode, fillValue, outputShape} = attrs;\n\n const [batch, imageHeight, imageWidth, numChannels] = image.shape;\n const [outHeight, outWidth] =\n outputShape != null ? outputShape : [imageHeight, imageWidth];\n const outShape =\n [batch, outHeight, outWidth,\n numChannels] as [number, number, number, number];\n\n const program = new TransformProgram(outShape);\n const interpolationModeId = interpolation === 'nearest' ? 1 : 2;\n let fillModeId: number;\n switch (fillMode) {\n case 'constant':\n fillModeId = 1;\n break;\n case 'reflect':\n fillModeId = 2;\n break;\n case 'wrap':\n fillModeId = 3;\n break;\n case 'nearest':\n fillModeId = 4;\n break;\n default:\n fillModeId = 1;\n break;\n }\n const uniformData = [\n {type: 'int32', data: [interpolationModeId]},\n {type: 'int32', data: [fillModeId]}, {type: 'float32', data: [fillValue]}\n ];\n return backend.runWebGPUProgram(\n program, [image, transforms], 'float32', uniformData);\n}\n\nexport const transformConfig: KernelConfig = {\n kernelName: Transform,\n backendName: 'webgpu',\n kernelFunc: transform as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, TensorInfo, Unpack, UnpackAttrs, UnpackInputs} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\n\nimport {reshape} from './Reshape';\nimport {slice} from './Slice';\n\nexport function unpack(\n args:\n {inputs: UnpackInputs, backend: WebGPUBackend, attrs: UnpackAttrs}):\n TensorInfo[] {\n const {inputs, backend, attrs} = args;\n const {value} = inputs;\n let {axis} = attrs;\n\n if (axis < 0) {\n axis += value.shape.length;\n }\n\n const x = value;\n const xRank = x.shape.length;\n\n const num = value.shape[axis];\n const outShape: number[] = new Array(xRank - 1);\n let outIndex = 0;\n for (let i = 0; i < xRank; i++) {\n if (i !== axis) {\n outShape[outIndex++] = x.shape[i];\n }\n }\n\n const toDispose = [];\n\n const begin = new Array(xRank).fill(0);\n const size = x.shape.slice();\n size[axis] = 1;\n const res: TensorInfo[] = new Array(num);\n for (let i = 0; i < res.length; i++) {\n begin[axis] = i;\n const sliced = slice({inputs: {x}, backend, attrs: {begin, size}});\n const reshaped =\n reshape({inputs: {x: sliced}, backend, attrs: {shape: outShape}});\n res[i] = reshaped;\n\n toDispose.push(sliced);\n }\n\n toDispose.forEach(t => backend.disposeData(t.dataId));\n return res;\n}\n\nexport const unpackConfig: KernelConfig = {\n kernelName: Unpack,\n backendName: 'webgpu',\n kernelFunc: unpack as unknown as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, registerKernel} from '@tensorflow/tfjs-core';\n\nimport {_fusedMatMulConfig} from './kernels/_FusedMatMul';\nimport {absConfig} from './kernels/Abs';\nimport {acosConfig} from './kernels/Acos';\nimport {acoshConfig} from './kernels/Acosh';\nimport {addConfig} from './kernels/Add';\nimport {addNConfig} from './kernels/AddN';\nimport {allConfig} from './kernels/All';\nimport {anyConfig} from './kernels/Any';\nimport {argMaxConfig} from './kernels/ArgMax';\nimport {argMinConfig} from './kernels/ArgMin';\nimport {asinConfig} from './kernels/Asin';\nimport {asinhConfig} from './kernels/Asinh';\nimport {atanConfig} from './kernels/Atan';\nimport {atan2Config} from './kernels/Atan2';\nimport {atanhConfig} from './kernels/Atanh';\nimport {avgPoolConfig} from './kernels/AvgPool';\nimport {avgPoolGradConfig} from './kernels/AvgPoolGrad';\nimport {batchMatMulConfig} from './kernels/BatchMatMul';\nimport {batchToSpaceNDConfig} from './kernels/BatchToSpaceND';\nimport {bincountConfig} from './kernels/Bincount';\nimport {castConfig} from './kernels/Cast';\nimport {ceilConfig} from './kernels/Ceil';\nimport {clipByValueConfig} from './kernels/ClipByValue';\nimport {complexConfig} from './kernels/Complex';\nimport {concatConfig} from './kernels/Concat';\nimport {conv2DConfig} from './kernels/Conv2D';\nimport {conv2DBackpropFilterConfig} from './kernels/Conv2DBackpropFilter';\nimport {conv2DBackpropInputConfig} from './kernels/Conv2DBackpropInput';\nimport {cosConfig} from './kernels/Cos';\nimport {coshConfig} from './kernels/Cosh';\nimport {cropAndResizeConfig} from './kernels/CropAndResize';\nimport {cumprodConfig} from './kernels/Cumprod';\nimport {cumsumConfig} from './kernels/Cumsum';\nimport {denseBincountConfig} from './kernels/DenseBincount';\nimport {depthToSpaceConfig} from './kernels/DepthToSpace';\nimport {depthwiseConv2dNativeConfig} from './kernels/DepthwiseConv2dNative';\nimport {diagConfig} from './kernels/Diag';\nimport {dilation2DConfig} from './kernels/Dilation2D';\nimport {einsumConfig} from './kernels/Einsum';\nimport {eluConfig} from './kernels/Elu';\nimport {equalConfig} from './kernels/Equal';\nimport {erfConfig} from './kernels/Erf';\nimport {expConfig} from './kernels/Exp';\nimport {expandDimsConfig} from './kernels/ExpandDims';\nimport {expm1Config} from './kernels/Expm1';\nimport {fftConfig} from './kernels/FFT';\nimport {fillConfig} from './kernels/Fill';\nimport {flipLeftRightConfig} from './kernels/FlipLeftRight';\nimport {floorConfig} from './kernels/Floor';\nimport {floorDivConfig} from './kernels/FloorDiv';\nimport {fromPixelsConfig} from './kernels/FromPixels';\nimport {fusedBatchNormConfig} from './kernels/FusedBatchNorm';\nimport {fusedConv2DConfig} from './kernels/FusedConv2D';\nimport {fusedDepthwiseConv2DConfig} from './kernels/FusedDepthwiseConv2D';\nimport {gatherNdConfig} from './kernels/GatherNd';\nimport {gatherV2Config} from './kernels/GatherV2';\nimport {greaterConfig} from './kernels/Greater';\nimport {greaterEqualConfig} from './kernels/GreaterEqual';\nimport {identityConfig} from './kernels/Identity';\nimport {ifftConfig} from './kernels/IFFT';\nimport {imagConfig} from './kernels/Imag';\nimport {isFiniteConfig} from './kernels/IsFinite';\nimport {isInfConfig} from './kernels/IsInf';\nimport {isNaNConfig} from './kernels/IsNaN';\nimport {leakyReluConfig} from './kernels/LeakyRelu';\nimport {lessConfig} from './kernels/Less';\nimport {lessEqualConfig} from './kernels/LessEqual';\nimport {linSpaceConfig} from './kernels/LinSpace';\nimport {logConfig} from './kernels/Log';\nimport {log1pConfig} from './kernels/Log1p';\nimport {logicalAndConfig} from './kernels/LogicalAnd';\nimport {logicalNotConfig} from './kernels/LogicalNot';\nimport {logicalOrConfig} from './kernels/LogicalOr';\nimport {lrnConfig} from './kernels/LRN';\nimport {maxConfig} from './kernels/Max';\nimport {maximumConfig} from './kernels/Maximum';\nimport {maxPoolConfig} from './kernels/MaxPool';\nimport {meanConfig} from './kernels/Mean';\nimport {minConfig} from './kernels/Min';\nimport {minimumConfig} from './kernels/Minimum';\nimport {mirrorPadConfig} from './kernels/MirrorPad';\nimport {modConfig} from './kernels/Mod';\nimport {multiplyConfig} from './kernels/Multiply';\nimport {negConfig} from './kernels/Neg';\nimport {nonMaxSuppressionV3Config} from './kernels/NonMaxSuppressionV3';\nimport {nonMaxSuppressionV5Config} from './kernels/NonMaxSuppressionV5';\nimport {notEqualConfig} from './kernels/NotEqual';\nimport {oneHotConfig} from './kernels/OneHot';\nimport {onesLikeConfig} from './kernels/OnesLike';\nimport {packConfig} from './kernels/Pack';\nimport {padV2Config} from './kernels/PadV2';\nimport {powConfig} from './kernels/Pow';\nimport {preluConfig} from './kernels/Prelu';\nimport {prodConfig} from './kernels/Prod';\nimport {rangeConfig} from './kernels/Range';\nimport {realConfig} from './kernels/Real';\nimport {realDivConfig} from './kernels/RealDiv';\nimport {reciprocalConfig} from './kernels/Reciprocal';\nimport {reluConfig} from './kernels/Relu';\nimport {relu6Config} from './kernels/Relu6';\nimport {reshapeConfig} from './kernels/Reshape';\nimport {resizeBilinearConfig} from './kernels/ResizeBilinear';\nimport {resizeNearestNeighborConfig} from './kernels/ResizeNearestNeighbor';\nimport {reverseConfig} from './kernels/Reverse';\nimport {rotateWithOffsetConfig} from './kernels/RotateWithOffset';\nimport {roundConfig} from './kernels/Round';\nimport {rsqrtConfig} from './kernels/Rsqrt';\nimport {scatterNdConfig} from './kernels/ScatterNd';\nimport {searchSortedConfig} from './kernels/SearchSorted';\nimport {selectConfig} from './kernels/Select';\nimport {seluConfig} from './kernels/Selu';\nimport {sigmoidConfig} from './kernels/Sigmoid';\nimport {signConfig} from './kernels/Sign';\nimport {sinConfig} from './kernels/Sin';\nimport {sinhConfig} from './kernels/Sinh';\nimport {sliceConfig} from './kernels/Slice';\nimport {softmaxConfig} from './kernels/Softmax';\nimport {softplusConfig} from './kernels/Softplus';\nimport {spaceToBatchNDConfig} from './kernels/SpaceToBatchND';\nimport {sparseToDenseConfig} from './kernels/SparseToDense';\nimport {splitVConfig} from './kernels/SplitV';\nimport {sqrtConfig} from './kernels/Sqrt';\nimport {squareConfig} from './kernels/Square';\nimport {squaredDifferenceConfig} from './kernels/SquaredDifference';\nimport {stepConfig} from './kernels/Step';\nimport {stridedSliceConfig} from './kernels/StridedSlice';\nimport {stringNGramsConfig} from './kernels/StringNGrams';\nimport {subConfig} from './kernels/Sub';\nimport {sumConfig} from './kernels/Sum';\nimport {tanConfig} from './kernels/Tan';\nimport {tanhConfig} from './kernels/Tanh';\nimport {tileConfig} from './kernels/Tile';\nimport {topKConfig} from './kernels/TopK';\nimport {transformConfig} from './kernels/Transform';\nimport {transposeConfig} from './kernels/Transpose';\nimport {unpackConfig} from './kernels/Unpack';\nimport {zerosLikeConfig} from './kernels/ZerosLike';\n\n// List all kernel configs here\nconst kernelConfigs: KernelConfig[] = [\n _fusedMatMulConfig,\n absConfig,\n acosConfig,\n acoshConfig,\n addConfig,\n addNConfig,\n allConfig,\n anyConfig,\n argMaxConfig,\n argMinConfig,\n asinConfig,\n asinhConfig,\n atanConfig,\n atan2Config,\n atanhConfig,\n avgPoolConfig,\n avgPoolGradConfig,\n batchMatMulConfig,\n batchToSpaceNDConfig,\n bincountConfig,\n castConfig,\n ceilConfig,\n clipByValueConfig,\n complexConfig,\n concatConfig,\n conv2DConfig,\n conv2DBackpropFilterConfig,\n conv2DBackpropInputConfig,\n cosConfig,\n coshConfig,\n cropAndResizeConfig,\n cumprodConfig,\n cumsumConfig,\n denseBincountConfig,\n depthToSpaceConfig,\n depthwiseConv2dNativeConfig,\n diagConfig,\n dilation2DConfig,\n einsumConfig,\n eluConfig,\n equalConfig,\n erfConfig,\n expConfig,\n expandDimsConfig,\n expm1Config,\n fftConfig,\n fillConfig,\n flipLeftRightConfig,\n fromPixelsConfig,\n floorConfig,\n floorDivConfig,\n fusedBatchNormConfig,\n fusedConv2DConfig,\n fusedDepthwiseConv2DConfig,\n gatherNdConfig,\n gatherV2Config,\n greaterConfig,\n greaterEqualConfig,\n identityConfig,\n ifftConfig,\n imagConfig,\n isFiniteConfig,\n isInfConfig,\n isNaNConfig,\n leakyReluConfig,\n lessConfig,\n lessEqualConfig,\n linSpaceConfig,\n log1pConfig,\n logConfig,\n logicalAndConfig,\n logicalNotConfig,\n logicalOrConfig,\n lrnConfig,\n maxConfig,\n maximumConfig,\n maxPoolConfig,\n meanConfig,\n minConfig,\n minimumConfig,\n mirrorPadConfig,\n modConfig,\n multiplyConfig,\n negConfig,\n nonMaxSuppressionV3Config,\n nonMaxSuppressionV5Config,\n notEqualConfig,\n oneHotConfig,\n onesLikeConfig,\n packConfig,\n padV2Config,\n powConfig,\n preluConfig,\n prodConfig,\n rangeConfig,\n realConfig,\n realDivConfig,\n reciprocalConfig,\n reluConfig,\n relu6Config,\n reshapeConfig,\n resizeBilinearConfig,\n resizeNearestNeighborConfig,\n reverseConfig,\n rotateWithOffsetConfig,\n roundConfig,\n rsqrtConfig,\n scatterNdConfig,\n searchSortedConfig,\n selectConfig,\n seluConfig,\n sigmoidConfig,\n signConfig,\n sinConfig,\n sinhConfig,\n sliceConfig,\n stepConfig,\n stridedSliceConfig,\n stringNGramsConfig,\n softmaxConfig,\n softplusConfig,\n spaceToBatchNDConfig,\n sparseToDenseConfig,\n splitVConfig,\n sqrtConfig,\n squareConfig,\n squaredDifferenceConfig,\n subConfig,\n sumConfig,\n tanConfig,\n tanhConfig,\n tileConfig,\n topKConfig,\n transformConfig,\n transposeConfig,\n unpackConfig,\n zerosLikeConfig\n];\n\nfor (const kernelConfig of kernelConfigs) {\n registerKernel(kernelConfig);\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nexport * from './base';\nimport './register_all_kernels';\n","(function(){/*\n\n Copyright The Closure Library Authors.\n SPDX-License-Identifier: Apache-2.0\n*/\n'use strict';var A;function aa(a){var b=0;return function(){return b>>0)+\"_\",f=0;return b});\nJ(\"Symbol.iterator\",function(a){if(a)return a;a=Symbol(\"Symbol.iterator\");for(var b=\"Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array\".split(\" \"),c=0;cc&&(c=Math.max(c+f,0));cg)d[c++]=g;else{if(2048>g)d[c++]=g>>6|192;else{if(55296<=g&&57343>=g){if(56319>=g&&f=e){g=1024*(g-55296)+e-56320+65536;d[c++]=g>>18|240;d[c++]=g>>12&63|128;d[c++]=g>>6&63|128;d[c++]=g&63|128;continue}else f--}if(b)throw Error(\"Found an unpaired surrogate\");g=65533}d[c++]=\ng>>12|224;d[c++]=g>>6&63|128}d[c++]=g&63|128}}a=d.subarray(0,c)}return a};var Ea=\"function\"===typeof Uint8Array.prototype.slice,Q=0,R=0;function Fa(a){this.h=null;this.g=this.i=this.j=0;this.l=!1;a&&Ga(this,a)}function Ga(a,b){b=b.constructor===Uint8Array?b:b.constructor===ArrayBuffer?new Uint8Array(b):b.constructor===Array?new Uint8Array(b):b.constructor===String?Ia(b):b instanceof Uint8Array?new Uint8Array(b.buffer,b.byteOffset,b.byteLength):new Uint8Array(0);a.h=b;a.j=0;a.i=a.h.length;a.g=a.j}Fa.prototype.reset=function(){this.g=this.j};\nfunction Ja(a){var b=a.h,c=b[a.g],d=c&127;if(128>c)return a.g+=1,d;c=b[a.g+1];d|=(c&127)<<7;if(128>c)return a.g+=2,d;c=b[a.g+2];d|=(c&127)<<14;if(128>c)return a.g+=3,d;c=b[a.g+3];d|=(c&127)<<21;if(128>c)return a.g+=4,d;c=b[a.g+4];d|=(c&15)<<28;if(128>c)return a.g+=5,d>>>0;a.g+=5;128<=b[a.g++]&&128<=b[a.g++]&&128<=b[a.g++]&&128<=b[a.g++]&&a.g++;return d}\nfunction S(a){var b=a.h[a.g];var c=a.h[a.g+1];var d=a.h[a.g+2],f=a.h[a.g+3];a.g+=4;c=(b<<0|c<<8|d<<16|f<<24)>>>0;a=2*(c>>31)+1;b=c>>>23&255;c&=8388607;return 255==b?c?NaN:Infinity*a:0==b?a*Math.pow(2,-149)*c:a*Math.pow(2,b-150)*(c+Math.pow(2,23))}var Ka=[];function La(){this.g=new Uint8Array(64);this.h=0}La.prototype.push=function(a){if(!(this.h+1>>=7;a.push(b)};function Na(a){if(Ka.length){var b=Ka.pop();a&&Ga(b,a);a=b}else a=new Fa(a);this.g=a;this.h=this.i=this.l=-1;this.j=!1}Na.prototype.reset=function(){this.g.reset();this.h=this.l=-1};function Oa(a){var b=a.g;(b=b.g==b.i)||(b=a.j)||(b=a.g,b=b.l||0>b.g||b.g>b.i);if(b)return!1;b=Ja(a.g);var c=b&7;if(0!=c&&5!=c&&1!=c&&2!=c&&3!=c&&4!=c)return a.j=!0,!1;a.i=b;a.l=b>>>3;a.h=c;return!0}\nfunction Pa(a){switch(a.h){case 0:if(0!=a.h)Pa(a);else{for(a=a.g;a.h[a.g]&128;)a.g++;a.g++}break;case 1:1!=a.h?Pa(a):(a=a.g,a.g+=8);break;case 2:if(2!=a.h)Pa(a);else{var b=Ja(a.g);a=a.g;a.g+=b}break;case 5:5!=a.h?Pa(a):(a=a.g,a.g+=4);break;case 3:b=a.l;do{if(!Oa(a)){a.j=!0;break}if(4==a.h){a.l!=b&&(a.j=!0);break}Pa(a)}while(1);break;default:a.j=!0}}function Qa(a,b,c){var d=a.g.i,f=Ja(a.g);f=a.g.g+f;a.g.i=f;c(b,a);a.g.g=f;a.g.i=d;return b}\nfunction Ra(a){var b=Ja(a.g);a=a.g;var c=a.g;a.g+=b;a=a.h;var d;if(Aa)(d=za)||(d=za=new TextDecoder(\"utf-8\",{fatal:!1})),d=d.decode(a.subarray(c,c+b));else{b=c+b;for(var f=[],g=null,e,h,k;ce?f.push(e):224>e?c>=b?f.push(65533):(h=a[c++],194>e||128!==(h&192)?(c--,f.push(65533)):f.push((e&31)<<6|h&63)):240>e?c>=b-1?f.push(65533):(h=a[c++],128!==(h&192)||224===e&&160>h||237===e&&160<=h||128!==((d=a[c++])&192)?(c--,f.push(65533)):f.push((e&15)<<12|(h&63)<<6|d&63)):244>=e?c>=b-2?f.push(65533):\n(h=a[c++],128!==(h&192)||0!==(e<<28)+(h-144)>>30||128!==((d=a[c++])&192)||128!==((k=a[c++])&192)?(c--,f.push(65533)):(e=(e&7)<<18|(h&63)<<12|(d&63)<<6|k&63,e-=65536,f.push((e>>10&1023)+55296,(e&1023)+56320))):f.push(65533),8192<=f.length&&(g=ya(g,f),f.length=0);d=ya(g,f)}return d};var Sa={},Ta=null;function Ia(a){var b=a.length,c=3*b/4;c%3?c=Math.floor(c):-1!=\"=.\".indexOf(a[b-1])&&(c=-1!=\"=.\".indexOf(a[b-2])?c-2:c-1);var d=new Uint8Array(c),f=0;Ua(a,function(g){d[f++]=g});return d.subarray(0,f)}\nfunction Ua(a,b){function c(k){for(;d>4);64!=e&&(b(g<<4&240|e>>2),64!=h&&b(e<<6&192|h))}}\nfunction Va(){if(!Ta){Ta={};for(var a=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\".split(\"\"),b=[\"+/=\",\"+/\",\"-_=\",\"-_.\",\"-_\"],c=0;5>c;c++){var d=a.concat(b[c].split(\"\"));Sa[c]=d;for(var f=0;fd?1:0)?-d:d;0===d?0<1/d?Q=R=0:(R=0,Q=2147483648):isNaN(d)?(R=0,Q=2147483647):3.4028234663852886E38>>0):1.1754943508222875E-38>d?(d=Math.round(d/Math.pow(2,-149)),R=0,Q=(c<<31|d)>>>0):(b=Math.floor(Math.log(d)/Math.LN2),d*=Math.pow(2,-b),d=Math.round(8388608*d)&8388607,R=0,Q=(c<<31|b+127<<23|d)>>>0);c=Q;a.push(c>>>0&255);a.push(c>>>8&255);a.push(c>>>16&255);a.push(c>>>24&255)}}\nfunction Ya(a,b,c){Ma(a.g,8*b+2);Ma(a.g,c.length);b=a.g.end();a.h.push(b);a.h.push(c);a.i+=b.length+c.length};var Za=\"function\"===typeof Uint8Array;function $a(a,b,c){return\"object\"===typeof a?Za&&!Array.isArray(a)&&a instanceof Uint8Array?c(a):ab(a,b,c):b(a)}function ab(a,b,c){if(Array.isArray(a)){for(var d=Array(a.length),f=0;f>2];h=c[(h&3)<<4|k>>4];k=c[(k&15)<<2|l>>6];l=c[l&63];d[e++]=n+h+k+l}n=0;l=f;switch(b.length-g){case 2:n=b[g+1],l=c[(n&15)<<2]||f;case 1:b=b[g],d[e]=c[b>>2]+c[(b&3)<<4|n>>4]+l+f}return d.join(\"\")})}var db={U:{value:!0,configurable:!0}};\nfunction bb(a){Array.isArray(a)&&!Object.isFrozen(a)&&Object.defineProperties(a,db);return a};var eb;function U(a,b,c){var d=eb;eb=null;a||(a=d);d=this.constructor.aa;a||(a=d?[d]:[]);this.j=d?0:-1;this.i=null;this.g=a;a:{d=this.g.length;a=d-1;if(d&&(d=this.g[a],!(null===d||\"object\"!=typeof d||Array.isArray(d)||Za&&d instanceof Uint8Array))){this.l=a-this.j;this.h=d;break a}void 0!==b&&-1B;B=Math.abs(B);var r=B>>>0;B=Math.floor((B-r)/4294967296);B>>>=0;q&&(B=~B>>>\n0,r=(~r>>>0)+1,4294967295>>7|r<<25)>>>0,r>>>=7;p.push(q)}H=Xa(H);D.call(C,K,H);if(y.M)for(C=0;CE;E++)B.push(G&127|128),G>>=7;B.push(1)}T(q,2,V(r,2));B=V(r,3);null!=B&&Ya(q,3,Da(B));r=V(r,4);null!=r&&Ya(q,4,Da(r));p=Xa(p);K.call(D,H,p)}}m=m.data;break a;default:m={}}}v=m;w=n.stream;switch(n.type){case \"video\":e.pushTexture2d(Object.assign(Object.assign({},\nv),{stream:w,timestamp:g}));break;case \"detections\":u=v;u.stream=w;u.timestamp=g;e.pushDetectionList(u);break;default:throw Error(\"Unknown input config type: '\"+n.type+\"'\");}}f.i.send(e);return N(z,f.B,4);case 4:e.delete(),z.g=0}})})};\nfunction Qb(a,b,c){return Y(a,function f(){var g,e,h,k,l,n,v=this,w,u,z,m,t,x,y,C;return O(f,function(D){switch(D.g){case 1:if(!c)return D.return(b);g={};e=0;h=M(Object.keys(c));for(k=h.next();!k.done;k=h.next())l=k.value,n=c[l],\"string\"!==typeof n&&\"texture\"===n.type&&void 0!==b[n.stream]&&++e;1Z&&128<=L;Z++)L=I.h[I.g++],Ha|=(L&127)<<7*Z;128<=L&&(L=I.h[I.g++],Ha|=(L&127)<<28,E|=(L&127)>>4);if(128<=L)for(Z=0;5>Z&&128<=L;Z++)L=\nI.h[I.g++],E|=(L&127)<<7*Z+3;if(128>L){I=Ha>>>0;L=E>>>0;if(E=L&2147483648)I=~I+1>>>0,L=~L>>>0,0==I&&(L=L+1>>>0);I=4294967296*L+(I>>>0);E=E?-I:I}else I.l=!0,E=void 0;X(G,6,E);break;default:if(!mb(r))break a}}G={X:W(G,1),Y:W(G,2),height:W(G,3),width:W(G,4),rotation:W(G,5,0),V:kb(G,6)};r=zb(H.get(B));I=p.get(B);a:for(E=new pb,I=new Na(I);Oa(I);)switch(I.i){case 10:E.addClassification(Qa(I,new nb,ob));break;default:if(!mb(I))break a}G={R:G,M:r,L:xb(E)};q.push(G)}K=q}else K=[];g[u]=K;D.g=7;break}if(\"proto_list\"===\nz.type){if(m){K=Array(m.size());for(H=0;H\n void;\n\nfunction setup(backend: BackendWasm) {\n wasmFusedMatMul = backend.wasm.cwrap(_FusedMatMul, null /* void */, [\n 'number', // a_id\n 'array', // a_shape\n 'number', // a_shape.length\n 'number', // b_id\n 'array', // b_shape\n 'number', // b_shape.length\n 'number', // transpose_a\n 'number', // transpose_b\n 'number', // activation\n 'number', // biasId\n 'number', // preluActivationWeightsId\n 'number', // leakyreluAlpha\n 'number' // out_id\n ]);\n}\n\nfunction fusedBatchMatMul(args: {\n inputs: _FusedMatMulInputs,\n backend: BackendWasm,\n attrs: _FusedMatMulAttrs\n}) {\n const {inputs, backend, attrs} = args;\n const {a, b, bias, preluActivationWeights} = inputs;\n\n if (a.dtype !== 'float32' || b.dtype !== 'float32') {\n throw new Error(\n `_FusedMatMul for non non-float32 tensors not yet supported.`);\n }\n\n const {transposeA, transposeB, activation, leakyreluAlpha} = attrs;\n const aId = backend.dataIdMap.get(a.dataId).id;\n const bId = backend.dataIdMap.get(b.dataId).id;\n\n let biasId = 0;\n if (bias != null) {\n const biasData = backend.dataIdMap.get(bias.dataId);\n if (biasData.shape.length !== 1) {\n throw new Error(\n `_FusedMatMul only supports rank-1 bias but got ` +\n `rank ${biasData.shape.length}.`);\n }\n biasId = biasData.id;\n }\n const preluActivationWeightsId = preluActivationWeights == null ?\n 0 :\n backend.dataIdMap.get(preluActivationWeights.dataId).id;\n const fusedActivation =\n FusableActivation[activation as {} as keyof typeof FusableActivation];\n if (fusedActivation == null) {\n throw new Error(\n `${activation} activation not yet supported for FusedConv2D ` +\n `in the wasm backend.`);\n }\n\n const leftDim = transposeA ? a.shape[2] : a.shape[1];\n const rightDim = transposeB ? b.shape[1] : b.shape[2];\n const batchDims = broadcast_util.assertAndGetBroadcastShape(\n a.shape.slice(0, -2), b.shape.slice(0, -2));\n\n const out = backend.makeOutput([...batchDims, leftDim, rightDim], a.dtype);\n const outId = backend.dataIdMap.get(out.dataId).id;\n\n const aShapeBytes = new Uint8Array(new Int32Array(a.shape).buffer);\n const bShapeBytes = new Uint8Array(new Int32Array(b.shape).buffer);\n\n wasmFusedMatMul(\n aId, aShapeBytes, a.shape.length, bId, bShapeBytes, b.shape.length,\n transposeA, transposeB, fusedActivation, biasId, preluActivationWeightsId,\n leakyreluAlpha || 0, outId);\n\n return out;\n}\n\nexport const _fusedMatMulConfig: KernelConfig = {\n kernelName: _FusedMatMul,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: fusedBatchMatMul as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataType, KernelConfig, TensorInfo, UnaryInputs, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {CppDType} from './types';\n\nexport function createUnaryKernelConfig(\n kernelName: string, outType?: DataType): KernelConfig {\n let wasmFunc: (xId: number, dtype: number, outId: number) => void;\n\n function setupFunc(backend: BackendWasm): void {\n wasmFunc = backend.wasm.cwrap(kernelName, null /* void */, [\n 'number', // x_id\n 'number', // dtype\n 'number', // out_id\n ]);\n }\n\n function kernelFunc(args: {backend: BackendWasm, inputs: UnaryInputs}):\n TensorInfo {\n const {backend, inputs: {x}} = args;\n const xId = backend.dataIdMap.get(x.dataId).id;\n const out = backend.makeOutput(x.shape, outType || x.dtype);\n const outId = backend.dataIdMap.get(out.dataId).id;\n\n // Short-circuit zero-sized tensors.\n if (util.sizeFromShape(out.shape) === 0) {\n return out;\n }\n\n wasmFunc(xId, CppDType[x.dtype], outId);\n return out;\n }\n\n return {kernelName, backendName: 'wasm', setupFunc, kernelFunc};\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Abs, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {createUnaryKernelConfig} from './unary_kernel';\n\nexport const absConfig: KernelConfig = createUnaryKernelConfig(Abs);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, BinaryInputs, DataType, KernelConfig, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {CppDType} from './types';\n\nexport function createBinaryKernelConfig(\n kernelName: string, supportsFullBroadcast: boolean,\n dtype?: DataType): KernelConfig {\n let wasmFunc:\n (aId: number, aShape: Uint8Array, aShapeLen: number, bId: number,\n bShape: Uint8Array, bShapeLen: number, dtype: number, outId: number) =>\n void;\n\n function setupFunc(backend: BackendWasm): void {\n wasmFunc = backend.wasm.cwrap(kernelName, null /* void */, [\n 'number', // a_id,\n 'array', // a_shape\n 'number', // a_shape.length\n 'number', // b_id\n 'array', // b_shape\n 'number', // b_shape.length\n 'number', // dtype\n 'number' // out_id\n ]);\n }\n\n function kernelFunc(args: {backend: BackendWasm, inputs: BinaryInputs}):\n TensorInfo {\n const {backend, inputs} = args;\n const {a, b} = inputs;\n const aId = backend.dataIdMap.get(a.dataId).id;\n const bId = backend.dataIdMap.get(b.dataId).id;\n\n const outputType = dtype != null ? dtype : a.dtype;\n const newShape = backend_util.assertAndGetBroadcastShape(a.shape, b.shape);\n const out = backend.makeOutput(newShape, outputType);\n\n // Short-circuit zero-sized tensors.\n if (util.sizeFromShape(newShape) === 0) {\n return out;\n }\n\n const aShapeBytes = new Uint8Array(new Int32Array(a.shape).buffer);\n const bShapeBytes = new Uint8Array(new Int32Array(b.shape).buffer);\n const outId = backend.dataIdMap.get(out.dataId).id;\n const kernelFunc = () => wasmFunc(\n aId, aShapeBytes, a.shape.length, bId, bShapeBytes, b.shape.length,\n CppDType[a.dtype], outId);\n\n kernelFunc();\n return out;\n }\n\n return {kernelName, backendName: 'wasm', setupFunc, kernelFunc};\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Add, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {createBinaryKernelConfig} from './binary_kernel';\n\nconst supportsFullBroadcast = true;\n\nexport const addConfig: KernelConfig =\n createBinaryKernelConfig(Add, supportsFullBroadcast);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {AddN, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {CppDType} from './types';\n\nlet wasmFunc:\n (inputIds: Uint8Array, inputIdsLen: number, dtype: number, outId: number) =>\n void;\n\nfunction setupFunc(backend: BackendWasm): void {\n wasmFunc = backend.wasm.cwrap(AddN, null /* void */, [\n 'array', // input_ids\n 'number', // input_ids.length\n 'number', // dtype\n 'number', // out_id\n ]);\n}\n\nfunction addn(args: {inputs: TensorInfo[], backend: BackendWasm}) {\n const {inputs, backend} = args;\n const out = backend.makeOutput(inputs[0].shape, inputs[0].dtype);\n\n // Short-circuit zero-sized tensors.\n if (util.sizeFromShape(out.shape) === 0) {\n return out;\n }\n\n const inputIds = inputs.map(x => backend.dataIdMap.get(x.dataId).id);\n const inputIdsBytes = new Uint8Array(new Int32Array(inputIds).buffer);\n const outId = backend.dataIdMap.get(out.dataId).id;\n wasmFunc(inputIdsBytes, inputIds.length, CppDType[out.dtype], outId);\n\n return out;\n}\n\nexport const addNConfig: KernelConfig = {\n kernelName: AddN,\n backendName: 'wasm',\n setupFunc,\n kernelFunc: addn as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Identity, IdentityInputs, KernelConfig, KernelFunc, tensor} from '@tensorflow/tfjs-core';\nimport {TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nexport function identity(args: {inputs: IdentityInputs, backend: BackendWasm}):\n TensorInfo {\n const {inputs: {x}, backend} = args;\n\n if (x.dtype === 'string') {\n return tensor(backend.readSync(x.dataId), x.shape, x.dtype);\n }\n\n const out = backend.makeOutput(x.shape, x.dtype);\n const inVals = backend.typedArrayFromHeap(x);\n const outVals = backend.typedArrayFromHeap(out);\n outVals.set(inVals);\n return out;\n}\n\nexport const identityConfig: KernelConfig = {\n kernelName: Identity,\n backendName: 'wasm',\n kernelFunc: identity as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, TensorInfo, Transpose, TransposeAttrs, TransposeInputs} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {identity} from './Identity';\nimport {CppDType} from './types';\n\nlet wasmTranspose: (\n xId: number, xShape: Uint8Array, xShapeLength: number, dtype: CppDType,\n outId: number, perm: Uint8Array, permLength: number) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmTranspose = backend.wasm.cwrap(Transpose, null /* void */, [\n 'number', // xId\n 'array', // x.shape\n 'number', // x.shape.length\n 'number', // dtype\n 'number', // outId\n 'array', // perm\n 'number', // perm.length\n ]);\n}\n\nexport function transpose(\n args:\n {inputs: TransposeInputs, backend: BackendWasm, attrs: TransposeAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n // Reduce any dimensions with size one. Lower-rank transpose kernel performs\n // better due to simpler memory access pattern.\n const [reducedShape, perm] = removeOneSizeDims(inputs.x.shape, attrs.perm);\n\n let permIsNoOp = true;\n for (let i = 0; i < perm.length; i++) {\n if (perm[i] !== i) {\n permIsNoOp = false;\n }\n }\n const outShape = computeOutShape(inputs.x.shape, attrs.perm);\n const x = {\n dataId: inputs.x.dataId,\n shape: reducedShape,\n dtype: inputs.x.dtype\n };\n\n if (permIsNoOp) {\n const cloned = identity({inputs, backend});\n cloned.shape = outShape;\n return cloned;\n }\n\n const out = backend.makeOutput(outShape, x.dtype);\n const xId = backend.dataIdMap.get(x.dataId).id;\n const outId = backend.dataIdMap.get(out.dataId).id;\n const permBytes = new Uint8Array(new Int32Array(perm).buffer);\n const xShapeBytes = new Uint8Array(new Int32Array(x.shape).buffer);\n\n wasmTranspose(\n xId, xShapeBytes, x.shape.length, CppDType[x.dtype], outId, permBytes,\n perm.length);\n return out;\n}\n\nfunction computeOutShape(inShape: number[], perm: number[]): number[] {\n const outShape = new Array(inShape.length);\n for (let i = 0; i < outShape.length; i++) {\n outShape[i] = inShape[perm[i]];\n }\n return outShape;\n}\n\nfunction removeOneSizeDims(\n shape: number[], perm: number[]): [number[], number[]] {\n const newShape: number[] = [];\n const newPerm: number[] = [];\n for (let i = 0; i < shape.length; ++i) {\n if (shape[i] !== 1) {\n newShape.push(shape[i]);\n }\n if (shape[perm[i]] !== 1) {\n newPerm.push(perm[i]);\n }\n }\n for (let i = 0; i < newPerm.length; ++i) {\n let minValIdx = -1;\n for (let j = 0; j < newPerm.length; ++j) {\n if (newPerm[j] >= i &&\n (minValIdx === -1 || newPerm[minValIdx] > newPerm[j])) {\n minValIdx = j;\n }\n }\n newPerm[minValIdx] = i;\n }\n return [newShape, newPerm];\n}\n\nexport const transposeConfig: KernelConfig = {\n kernelName: Transpose,\n backendName: 'wasm',\n kernelFunc: transpose as {} as KernelFunc,\n setupFunc: setup,\n};\n","/**\n * @license\n * Copyright 2020 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, TensorInfo, util} from '@tensorflow/tfjs-core';\nimport {BackendWasm} from '../backend_wasm';\nimport {transpose} from './Transpose';\n\n/**\n * Compute permutation axes and do a transpose if necessary.\n *\n * Used by reduction ops.\n * @param x input TensorInfo\n * @param axis reduction axes\n * @param backend wasm backend instance\n */\nexport function permuteAxesAndTranspose(\n x: TensorInfo, axis: number|number[], backend: BackendWasm): {\n transposed: TensorInfo|null,\n axes: number[],\n originalAxes: number[],\n inputWasTransposed: boolean\n} {\n const xShape = x.shape;\n const xRank = x.shape.length;\n\n const originalAxes = util.parseAxisParam(axis, xShape);\n let axes = originalAxes;\n const permutedAxes = backend_util.getAxesPermutation(axes, xRank);\n let xTransposed = null;\n let inputWasTransposed = false;\n if (permutedAxes != null) {\n const newShape: number[] = new Array(xRank);\n for (let i = 0; i < newShape.length; i++) {\n newShape[i] = xShape[permutedAxes[i]];\n }\n\n axes = backend_util.getInnerMostAxes(axes.length, xRank);\n xTransposed =\n transpose({inputs: {x}, attrs: {perm: permutedAxes}, backend});\n\n const xId = backend.dataIdMap.get(x.dataId).id;\n const transposedId = backend.dataIdMap.get(xTransposed.dataId).id;\n if (transposedId !== xId) {\n inputWasTransposed = true;\n }\n }\n\n return {transposed: xTransposed, originalAxes, axes, inputWasTransposed};\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {All, AllAttrs, AllInputs, backend_util, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {permuteAxesAndTranspose} from './kernel_utils';\n\nlet wasmAll: (xId: number, reduceSize: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm): void {\n wasmAll = backend.wasm.cwrap(All, null /*void*/, ['number, number, number']);\n}\n\nfunction all(args: {backend: BackendWasm, inputs: AllInputs, attrs: AllAttrs}):\n TensorInfo {\n const {backend, inputs, attrs} = args;\n const {axis, keepDims} = attrs;\n const {x} = inputs;\n const xId = backend.dataIdMap.get(x.dataId).id;\n let inputId = xId;\n let input = x;\n\n const {transposed, axes, originalAxes, inputWasTransposed} =\n permuteAxesAndTranspose(x, axis, backend);\n\n if (inputWasTransposed) {\n const transposedId = backend.dataIdMap.get(transposed.dataId).id;\n input = transposed;\n inputId = transposedId;\n }\n\n const inputRank = input.shape.length;\n backend_util.assertAxesAreInnerMostDims('all', axes, inputRank);\n const [outShape, reduceShape] =\n backend_util.computeOutAndReduceShapes(input.shape, axes);\n const reduceSize = util.sizeFromShape(reduceShape);\n\n const out = backend.makeOutput(outShape, x.dtype);\n if (util.sizeFromShape(input.shape) !== 0) {\n const outId = backend.dataIdMap.get(out.dataId).id;\n wasmAll(inputId, reduceSize, outId);\n }\n\n if (inputWasTransposed) {\n // dispose of the transposed tensor.\n backend.disposeData(transposed.dataId);\n }\n\n if (keepDims) {\n // reshape\n const newShape = backend_util.expandShapeToKeepDim(out.shape, originalAxes);\n out.shape = newShape;\n }\n\n return out;\n}\n\nexport const allConfig: KernelConfig = {\n kernelName: All,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: all as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Any, AnyAttrs, AnyInputs, backend_util, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {permuteAxesAndTranspose} from './kernel_utils';\n\nlet wasmAny: (xId: number, reduceSize: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm): void {\n wasmAny = backend.wasm.cwrap(Any, null /*void*/, ['number, number, number']);\n}\n\nfunction any(args: {backend: BackendWasm, inputs: AnyInputs, attrs: AnyAttrs}):\n TensorInfo {\n const {backend, inputs, attrs} = args;\n const {axis, keepDims} = attrs;\n const {x} = inputs;\n const xId = backend.dataIdMap.get(x.dataId).id;\n let inputId = xId;\n let input = x;\n\n const {transposed, axes, originalAxes, inputWasTransposed} =\n permuteAxesAndTranspose(x, axis, backend);\n\n if (inputWasTransposed) {\n const transposedId = backend.dataIdMap.get(transposed.dataId).id;\n input = transposed;\n inputId = transposedId;\n }\n\n const inputRank = input.shape.length;\n backend_util.assertAxesAreInnerMostDims('any', axes, inputRank);\n const [outShape, reduceShape] =\n backend_util.computeOutAndReduceShapes(input.shape, axes);\n const reduceSize = util.sizeFromShape(reduceShape);\n\n const out = backend.makeOutput(outShape, x.dtype);\n if (util.sizeFromShape(input.shape) !== 0) {\n const outId = backend.dataIdMap.get(out.dataId).id;\n wasmAny(inputId, reduceSize, outId);\n }\n\n if (inputWasTransposed) {\n // dispose of the transposed tensor.\n backend.disposeData(transposed.dataId);\n }\n\n if (keepDims) {\n // reshape\n const newShape = backend_util.expandShapeToKeepDim(out.shape, originalAxes);\n out.shape = newShape;\n }\n\n return out;\n}\n\nexport const anyConfig: KernelConfig = {\n kernelName: Any,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: any as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ArgMax, ArgMaxAttrs, ArgMaxInputs, KernelConfig, KernelFunc, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {permuteAxesAndTranspose} from './kernel_utils';\nimport {CppDType} from './types';\n\nlet wasmFunc: (\n xId: number, dtype: number, outerSize: number, innerSize: number,\n outId: number) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmFunc = backend.wasm.cwrap(ArgMax, null /* void */, [\n 'number', // x_id\n 'number', // dtype\n 'number', // outer_size\n 'number', // inner_size\n 'number' // out_id\n ]);\n}\n\nfunction argmax(\n args: {inputs: ArgMaxInputs, backend: BackendWasm, attrs: ArgMaxAttrs}) {\n const {backend, inputs, attrs} = args;\n const {axis} = attrs as {} as ArgMaxAttrs;\n const {x} = inputs as {} as ArgMaxInputs;\n const xId = backend.dataIdMap.get(x.dataId).id;\n let inputId = xId;\n let input = x;\n\n const {transposed, axes, inputWasTransposed} =\n permuteAxesAndTranspose(x, axis, backend);\n\n if (inputWasTransposed) {\n const transposedId = backend.dataIdMap.get(transposed.dataId).id;\n if (transposedId !== xId) {\n // transpose was not a no-op. We will need to dispose of this\n // once we are done.\n input = transposed;\n inputId = transposedId;\n }\n }\n\n const outShape = input.shape.slice(0, -1);\n const out = backend.makeOutput(outShape, 'int32');\n const outId = backend.dataIdMap.get(out.dataId).id;\n const outerSize = util.sizeFromShape(out.shape);\n const innerSize = input.shape[axes[0]];\n wasmFunc(inputId, CppDType[input.dtype], outerSize, innerSize, outId);\n\n if (inputWasTransposed) {\n // dispose of the transposed tensor.\n backend.disposeData(transposed.dataId);\n }\n\n return out;\n}\n\nexport const argMaxConfig: KernelConfig = {\n kernelName: ArgMax,\n backendName: 'wasm',\n kernelFunc: argmax as {} as KernelFunc,\n setupFunc: setup\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {AvgPool, AvgPoolAttrs, AvgPoolInputs, backend_util, KernelConfig, KernelFunc, Tensor4D} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nlet wasmAvgPool: (\n xId: number, batchSize: number, inputHeight: number, inputWidth: number,\n filterHeight: number, filterWidth: number, padTop: number, padRight: number,\n padBottom: number, padLeft: number, strideHeight: number,\n strideWidth: number, channels: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmAvgPool = backend.wasm.cwrap(AvgPool, null /* void */, [\n 'number', // xId\n 'number', // batchSize\n 'number', // inputHeight\n 'number', // inputWidth\n 'number', // filterHeight\n 'number', // filterWidth\n 'number', // padTop\n 'number', // padRight\n 'number', // padBottom\n 'number', // padLeft\n 'number', // strideHeight\n 'number', // strideWidth\n 'number', // channels\n 'number', // outId\n ]);\n}\n\nfunction avgPool(\n args: {inputs: AvgPoolInputs, backend: BackendWasm, attrs: AvgPoolAttrs}) {\n const {inputs, attrs, backend} = args;\n\n const x = inputs.x as Tensor4D;\n const xId = backend.dataIdMap.get(x.dataId).id;\n\n const {filterSize, strides, pad, dimRoundingMode} = attrs;\n const convInfo = backend_util.computePool2DInfo(\n x.shape, filterSize, strides, 1 /* dilations */, pad, dimRoundingMode);\n\n const filterHeight = convInfo.filterHeight;\n const filterWidth = convInfo.filterWidth;\n const padTop = convInfo.padInfo.top;\n const padRight = convInfo.padInfo.right;\n const padBottom = convInfo.padInfo.bottom;\n const padLeft = convInfo.padInfo.left;\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n const channels = convInfo.inChannels;\n\n if (convInfo.dataFormat !== 'channelsLast') {\n throw new Error(\n `wasm backend does not support dataFormat:'` +\n `${convInfo.dataFormat}'. Please use 'channelsLast'.`);\n }\n\n if (convInfo.dilationWidth !== 1 || convInfo.dilationHeight !== 1) {\n throw new Error(\n `was backend only supports average pooling with dilation = [1, 1], ` +\n `got [${convInfo.dilationHeight}, ${convInfo.dilationWidth}].`);\n }\n\n const out = backend.makeOutput(convInfo.outShape, 'float32');\n const outId = backend.dataIdMap.get(out.dataId).id;\n\n wasmAvgPool(\n xId, x.shape[0], x.shape[1], x.shape[2], filterHeight, filterWidth,\n padTop, padRight, padBottom, padLeft, strideHeight, strideWidth, channels,\n outId);\n return out;\n}\n\nexport const avgPoolConfig: KernelConfig = {\n kernelName: AvgPool,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: avgPool as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Reshape, ReshapeAttrs, ReshapeInputs, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nexport function reshape(\n args: {inputs: ReshapeInputs, attrs: ReshapeAttrs, backend: BackendWasm}) {\n const {inputs, attrs} = args;\n const {x} = inputs;\n const {shape} = attrs;\n\n const xSize = util.sizeFromShape(x.shape);\n const $shape = util.inferFromImplicitShape(shape, xSize);\n\n util.assert(\n xSize === util.sizeFromShape($shape),\n () => `new shape: ${$shape}, old shape: ${x.shape}. New shape and old ` +\n `shape must have the same number of elements.`);\n\n // Backend needs to track refCount for the dataId for reshape op\n args.backend.incRef(x.dataId);\n return {dataId: x.dataId, shape: $shape, dtype: x.dtype};\n}\n\nexport const reshapeConfig: KernelConfig = {\n kernelName: Reshape,\n backendName: 'wasm',\n kernelFunc: reshape as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {BatchMatMul, BatchMatMulAttrs, BatchMatMulInputs, broadcast_util, KernelConfig, KernelFunc, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {reshape} from './Reshape';\n\nlet wasmBatchMatMul: (\n aId: number, aShape: Uint8Array, aShapeSize: number, bId: number,\n bShape: Uint8Array, bShapeSize: number, transposeA: boolean,\n transposeB: boolean, outId: number) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmBatchMatMul = backend.wasm.cwrap(BatchMatMul, null /* void */, [\n 'number', // a_id\n 'array', // a_shape\n 'number', // a_shape.length\n 'number', // b_id\n 'array', // b_shape\n 'number', // b_shape.length\n 'number', // transpose_a\n 'number', // transpose_b\n 'number' // out_id\n ]);\n}\n\nfunction batchMatMul(args: {\n inputs: BatchMatMulInputs,\n backend: BackendWasm,\n attrs: BatchMatMulAttrs\n}) {\n const {inputs, backend, attrs} = args;\n const {a, b} = inputs;\n const {transposeA, transposeB} = attrs;\n\n if (a.dtype !== 'float32' || b.dtype !== 'float32') {\n throw new Error(\n `BatchMatMul for non non-float32 tensors not yet supported.`);\n }\n\n const aRank = a.shape.length;\n const bRank = b.shape.length;\n\n const innerShapeA = transposeA ? a.shape[aRank - 2] : a.shape[aRank - 1];\n const innerShapeB = transposeB ? b.shape[bRank - 1] : b.shape[bRank - 2];\n\n const outerShapeA = transposeA ? a.shape[aRank - 1] : a.shape[aRank - 2];\n const outerShapeB = transposeB ? b.shape[bRank - 2] : b.shape[bRank - 1];\n\n const outerDimsA = a.shape.slice(0, -2);\n const outerDimsB = b.shape.slice(0, -2);\n\n const batchDimA = util.sizeFromShape(outerDimsA);\n const batchDimB = util.sizeFromShape(outerDimsB);\n\n const outShapeOuterDims = broadcast_util.assertAndGetBroadcastShape(\n a.shape.slice(0, -2), b.shape.slice(0, -2));\n const outShape = outShapeOuterDims.concat([outerShapeA, outerShapeB]);\n\n util.assert(\n innerShapeA === innerShapeB,\n () => `Error in matMul: inner shapes (${innerShapeA}) and (` +\n `${innerShapeB}) of Tensors with shapes ${a.shape} and ` +\n `${b.shape} and transposeA=${transposeA}` +\n ` and transposeB=${transposeB} must match.`);\n\n const a3dShape = transposeA ? [batchDimA, innerShapeA, outerShapeA] :\n [batchDimA, outerShapeA, innerShapeA];\n const b3dShape = transposeB ? [batchDimB, outerShapeB, innerShapeB] :\n [batchDimB, innerShapeB, outerShapeB];\n\n // The rest of the implementation is designed to operate on rank-3 tensors\n const a3d = reshape({inputs: {x: a}, backend, attrs: {shape: a3dShape}});\n const b3d = reshape({inputs: {x: b}, backend, attrs: {shape: b3dShape}});\n\n const a3dId = backend.dataIdMap.get(a3d.dataId).id;\n const b3dId = backend.dataIdMap.get(b3d.dataId).id;\n\n const leftDim = transposeA ? a3d.shape[2] : a3d.shape[1];\n const rightDim = transposeB ? b3d.shape[1] : b3d.shape[2];\n const batchDim = Math.max(batchDimA, batchDimB);\n\n const out = backend.makeOutput([batchDim, leftDim, rightDim], a3d.dtype);\n const outId = backend.dataIdMap.get(out.dataId).id;\n\n const aShapeBytes = new Uint8Array(new Int32Array(a3d.shape).buffer);\n const bShapeBytes = new Uint8Array(new Int32Array(b3d.shape).buffer);\n\n wasmBatchMatMul(\n a3dId, aShapeBytes, a3d.shape.length, b3dId, bShapeBytes,\n b3d.shape.length, transposeA, transposeB, outId);\n\n backend.disposeData(a3d.dataId);\n backend.disposeData(b3d.dataId);\n\n out.shape = outShape;\n return out;\n}\n\nexport const batchMatMulConfig: KernelConfig = {\n kernelName: BatchMatMul,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: batchMatMul as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// Import shared functionality from tfjs-backend-cpu without triggering\n// side effects.\n// tslint:disable-next-line: no-imports-from-dist\nimport {concatImpl as concatImplCPU} from '@tensorflow/tfjs-backend-cpu/dist/shared';\n// tslint:disable-next-line: no-imports-from-dist\nimport {sliceImpl as sliceImplCPU} from '@tensorflow/tfjs-backend-cpu/dist/shared';\n// tslint:disable-next-line: no-imports-from-dist\nimport {rangeImpl as rangeImplCPU} from '@tensorflow/tfjs-backend-cpu/dist/shared';\n// tslint:disable-next-line: no-imports-from-dist\nimport {stringNGramsImpl as stringNGramsImplCPU} from '@tensorflow/tfjs-backend-cpu/dist/shared';\n// tslint:disable-next-line: no-imports-from-dist\nimport {stringSplitImpl as stringSplitImplCPU} from '@tensorflow/tfjs-backend-cpu/dist/shared';\n// tslint:disable-next-line: no-imports-from-dist\nimport {stringToHashBucketFastImpl as stringToHashBucketFastImplCPU} from '@tensorflow/tfjs-backend-cpu/dist/shared';\n\nexport {\n concatImplCPU,\n rangeImplCPU,\n sliceImplCPU,\n stringNGramsImplCPU,\n stringSplitImplCPU,\n stringToHashBucketFastImplCPU\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, Slice, slice_util, SliceAttrs, SliceInputs, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\nimport {sliceImplCPU} from '../kernel_utils/shared';\n\nexport function slice(\n args: {inputs: SliceInputs, attrs: SliceAttrs, backend: BackendWasm}) {\n const {inputs: {x}, attrs: {begin, size}, backend} = args;\n\n const [begin_, size_] = slice_util.parseSliceParams(x, begin, size);\n\n const isContinous = slice_util.isSliceContinous(x.shape, begin_, size_);\n const xVals = backend.readSync(x.dataId);\n const out = backend.makeOutput(size_, x.dtype);\n const xStrides = util.computeStrides(x.shape);\n const outData = backend.dataIdMap.get(out.dataId);\n\n if (isContinous) {\n const flatOffset = slice_util.computeFlatOffset(begin_, xStrides);\n\n if (x.dtype === 'string') {\n outData.stringBytes =\n (xVals as Uint8Array[])\n .slice(flatOffset, flatOffset + util.sizeFromShape(size_));\n } else {\n const outVals = backend.typedArrayFromHeap(out);\n outVals.set(\n (xVals as TypedArray)\n .subarray(flatOffset, flatOffset + util.sizeFromShape(size_)));\n }\n\n return out;\n }\n\n if (x.dtype === 'string') {\n const res = sliceImplCPU(xVals, begin_, size_, x.shape, x.dtype);\n outData.stringBytes = res as Uint8Array[];\n return out;\n }\n\n const outVals = backend.typedArrayFromHeap(out);\n const rank = x.shape.length;\n if (rank === 2) {\n slice2d(\n xVals as TypedArray, xStrides[0], outVals, begin_ as [number, number],\n size_ as [number, number]);\n } else if (rank === 3) {\n slice3d(\n xVals as TypedArray, xStrides[0], xStrides[1], outVals,\n begin_ as [number, number, number], size_ as [number, number, number]);\n } else if (rank === 4) {\n slice4d(\n xVals as TypedArray, xStrides[0], xStrides[1], xStrides[2], outVals,\n begin_ as [number, number, number, number],\n size_ as [number, number, number, number]);\n } else {\n const res =\n sliceImplCPU(xVals, begin_, size_, x.shape, x.dtype) as TypedArray;\n outVals.set(res);\n }\n\n return out;\n}\n\nfunction slice2d(\n xVals: backend_util.TypedArray, xStride: number,\n outVals: backend_util.TypedArray, begin: [number, number],\n size: [number, number]): void {\n let outOffset = 0;\n const beginI = begin[0];\n const beginJ = begin[1];\n const endI = beginI + size[0];\n for (let i = beginI; i < endI; i++) {\n const xOffset = i * xStride + beginJ;\n outVals.set(xVals.subarray(xOffset, xOffset + size[1]), outOffset);\n outOffset += size[1];\n }\n}\n\nfunction slice3d(\n xVals: backend_util.TypedArray, xStride1: number, xStride2: number,\n outVals: backend_util.TypedArray, begin: [number, number, number],\n size: [number, number, number]): void {\n let outOffset = 0;\n const beginI = begin[0];\n const beginJ = begin[1];\n const beginK = begin[2];\n const endI = beginI + size[0];\n const endJ = beginJ + size[1];\n for (let i = beginI; i < endI; i++) {\n for (let j = beginJ; j < endJ; j++) {\n const xOffset = i * xStride1 + j * xStride2 + beginK;\n outVals.set(xVals.subarray(xOffset, xOffset + size[2]), outOffset);\n outOffset += size[2];\n }\n }\n}\n\nfunction slice4d(\n xVals: backend_util.TypedArray, xStride1: number, xStride2: number,\n xStride3: number, outVals: backend_util.TypedArray,\n begin: [number, number, number, number],\n size: [number, number, number, number]): void {\n let outOffset = 0;\n const beginI = begin[0];\n const beginJ = begin[1];\n const beginK = begin[2];\n const endI = beginI + size[0];\n const endJ = beginJ + size[1];\n const endK = beginK + size[2];\n const beginL = begin[3];\n\n for (let i = beginI; i < endI; i++) {\n for (let j = beginJ; j < endJ; j++) {\n for (let k = beginK; k < endK; k++) {\n const xOffset = i * xStride1 + j * xStride2 + k * xStride3 + beginL;\n outVals.set(xVals.subarray(xOffset, xOffset + size[3]), outOffset);\n outOffset += size[3];\n }\n }\n }\n}\n\nexport const sliceConfig: KernelConfig = {\n kernelName: Slice,\n backendName: 'wasm',\n kernelFunc: slice as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, BatchToSpaceND, BatchToSpaceNDAttrs, BatchToSpaceNDInputs, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {reshape} from './Reshape';\nimport {slice} from './Slice';\nimport {transpose} from './Transpose';\n\nfunction batchToSpaceND(args: {\n inputs: BatchToSpaceNDInputs,\n backend: BackendWasm,\n attrs: BatchToSpaceNDAttrs\n}) {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {blockShape, crops} = attrs;\n\n const prod = blockShape.reduce((a, b) => a * b);\n\n const reshaped = backend_util.getReshaped(x.shape, blockShape, prod);\n const permuted = backend_util.getPermuted(reshaped.length, blockShape.length);\n const reshapedPermuted =\n backend_util.getReshapedPermuted(x.shape, blockShape, prod);\n const sliceBeginCoords =\n backend_util.getSliceBeginCoords(crops, blockShape.length);\n const sliceSize =\n backend_util.getSliceSize(reshapedPermuted, crops, blockShape.length);\n\n const xReshaped = reshape({inputs: {x}, backend, attrs: {shape: reshaped}});\n const xTransposed =\n transpose({inputs: {x: xReshaped}, backend, attrs: {perm: permuted}});\n const xTransposedReshaped = reshape(\n {inputs: {x: xTransposed}, backend, attrs: {shape: reshapedPermuted}});\n const result = slice({\n inputs: {x: xTransposedReshaped},\n backend,\n attrs: {begin: sliceBeginCoords, size: sliceSize}\n });\n\n backend.disposeData(xReshaped.dataId);\n backend.disposeData(xTransposed.dataId);\n backend.disposeData(xReshaped.dataId);\n\n return result;\n}\n\nexport const batchToSpaceNDConfig: KernelConfig = {\n kernelName: BatchToSpaceND,\n backendName: 'wasm',\n kernelFunc: batchToSpaceND as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Cast, CastAttrs, CastInputs, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\nimport {TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nexport function cast(\n args: {inputs: CastInputs, attrs: CastAttrs, backend: BackendWasm}):\n TensorInfo {\n const {inputs: {x}, attrs: {dtype}, backend} = args;\n const out = backend.makeOutput(x.shape, dtype);\n const inVals = backend.typedArrayFromHeap(x);\n const outVals = backend.typedArrayFromHeap(out);\n outVals.set(inVals);\n return out;\n}\n\nexport const castConfig: KernelConfig = {\n kernelName: Cast,\n backendName: 'wasm',\n kernelFunc: cast as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, Ceil} from '@tensorflow/tfjs-core';\n\nimport {createUnaryKernelConfig} from './unary_kernel';\n\nexport const ceilConfig: KernelConfig = createUnaryKernelConfig(Ceil);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ClipByValue, ClipByValueAttrs, ClipByValueInputs, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nlet wasmClip: (xId: number, min: number, max: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmClip = backend.wasm.cwrap(ClipByValue, null /* void */, [\n 'number', // x_id\n 'number', // min\n 'number', // max\n 'number' // out_id\n ]);\n}\n\nfunction clip(args: {\n inputs: ClipByValueInputs,\n backend: BackendWasm,\n attrs: ClipByValueAttrs\n}) {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {clipValueMin, clipValueMax} = attrs;\n const xId = backend.dataIdMap.get(x.dataId).id;\n const out = backend.makeOutput(x.shape, x.dtype);\n const outId = backend.dataIdMap.get(out.dataId).id;\n wasmClip(xId, clipValueMin, clipValueMax, outId);\n return out;\n}\n\nexport const clipByValueConfig: KernelConfig = {\n kernelName: ClipByValue,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: clip as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, Concat, ConcatAttrs, ConcatInputs, KernelConfig, KernelFunc, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\nimport {concatImplCPU} from '../kernel_utils/shared';\nimport {identity} from './Identity';\nimport {reshape} from './Reshape';\n\nexport function concat(\n args: {inputs: ConcatInputs, backend: BackendWasm, attrs: ConcatAttrs}) {\n const {inputs, backend} = args;\n\n const axis = util.parseAxisParam(args.attrs.axis, inputs[0].shape)[0];\n\n const shapes = inputs.map(t => t.shape);\n backend_util.assertParamsConsistent(shapes, axis);\n\n let outShape = backend_util.computeOutShape(inputs.map(t => t.shape), axis);\n\n // Keep only non-empty tensors (ignore tensors with 0 in their shape).\n const $inputs = inputs.filter(t => util.sizeFromShape(t.shape) > 0);\n if ($inputs.length === 1) {\n return identity({inputs: {x: $inputs[0]}, backend});\n }\n\n const out = backend.makeOutput(outShape, inputs[0].dtype);\n\n if (util.sizeFromShape(outShape) === 0) {\n return out;\n }\n\n if ($inputs[0].dtype === 'string') {\n // Any concat of n-dimensional tensors across any axis can be reduced to\n // a concatenation of two-dimensional tensors across the axis 1 by first\n // partitioning the axes of the original tensors into those less than the\n // axis to be concatenated and the rest. Then reshape the tensors\n // into a two-dimensional tensor by collapsing these two sets of axes and\n // concatenate the resulting matrices across the axis 1, finally reshaping\n // the result to have the proper shape.\n const inputs2D = $inputs.map(t => {\n const innerSize = util.sizeFromShape(t.shape.slice(axis));\n const shape = [-1, innerSize];\n return reshape({inputs: {x: t}, backend, attrs: {shape}});\n });\n\n const inputsValShapes = inputs2D.map(t => {\n return {vals: backend.readSync(t.dataId), shape: t.shape};\n });\n\n // Concats 2d tensors along axis=1.\n outShape =\n backend_util.computeOutShape(inputs2D.map(t => t.shape), 1 /* axis */);\n const simplyConcat = inputs2D[0].shape[0] === 1;\n const outVals = concatImplCPU(\n inputsValShapes, outShape, inputs[0].dtype,\n simplyConcat) as string[];\n\n const finalOutShape =\n backend_util.computeOutShape($inputs.map(t => t.shape), axis);\n\n out.shape = finalOutShape;\n const outData = backend.dataIdMap.get(out.dataId);\n outData.stringBytes = backend_util.fromStringArrayToUint8(outVals);\n\n inputs2D.forEach(t => backend.disposeData(t.dataId));\n\n return out;\n }\n\n const batchDim = util.sizeFromShape($inputs[0].shape.slice(0, axis));\n let sumInnerDims = 0;\n const innerDims = $inputs.map(input => {\n const innerDim = util.sizeFromShape(input.shape.slice(axis));\n sumInnerDims += innerDim;\n return innerDim;\n });\n const inVals = $inputs.map(input => backend.typedArrayFromHeap(input));\n const outVals = backend.typedArrayFromHeap(out);\n for (let b = 0; b < batchDim; b++) {\n let outOffset = b * sumInnerDims;\n for (let i = 0; i < inVals.length; i++) {\n const innerDim = innerDims[i];\n const inOffset = b * innerDim;\n const vals = inVals[i].subarray(inOffset, inOffset + innerDim);\n outVals.set(vals, outOffset);\n outOffset += innerDim;\n }\n }\n return out;\n}\n\nexport const concatConfig: KernelConfig = {\n kernelName: Concat,\n backendName: 'wasm',\n kernelFunc: concat as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, Conv2D, Conv2DAttrs, Conv2DInputs, KernelConfig, KernelFunc, Tensor4D} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nlet wasmConv2d: (\n xId: number, batchSize: number, inputHeight: number, inputWidth: number,\n filterId: number, filterHeight: number, filterWidth: number, padTop: number,\n padRight: number, padBottom: number, padLeft: number, isSamePad: number,\n dilationHeight: number, dilationWidth: number, strideHeight: number,\n strideWidth: number, inputChannels: number, outputChannels: number,\n outId: number) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmConv2d = backend.wasm.cwrap(Conv2D, null /* void */, [\n 'number', // xId\n 'number', // batchSize\n 'number', // inputHeight\n 'number', // inputWidth\n 'number', // filterId\n 'number', // filterHeight\n 'number', // filterWidth\n 'number', // padTop\n 'number', // padRight\n 'number', // padBottom\n 'number', // padLeft\n 'number', // isSamePad\n 'number', // dilationHeight\n 'number', // dilationWidth\n 'number', // strideHeight\n 'number', // strideWidth\n 'number', // inputChannels\n 'number', // outputChannels\n 'number', // outId\n ]);\n}\n\nfunction conv2d(\n args: {inputs: Conv2DInputs, backend: BackendWasm, attrs: Conv2DAttrs}) {\n const {inputs, attrs, backend} = args;\n\n const {x, filter} = inputs;\n const xId = backend.dataIdMap.get(x.dataId).id;\n const filterId = backend.dataIdMap.get(filter.dataId).id;\n\n const {strides, dilations, pad, dimRoundingMode, dataFormat} = attrs;\n const $dataFormat = backend_util.convertConv2DDataFormat(dataFormat);\n const convInfo = backend_util.computeConv2DInfo(\n (x as Tensor4D).shape, (filter as Tensor4D).shape, strides, dilations,\n pad, dimRoundingMode, false, $dataFormat);\n\n const filterHeight = convInfo.filterHeight;\n const filterWidth = convInfo.filterWidth;\n const padTop = convInfo.padInfo.top;\n const padRight = convInfo.padInfo.right;\n const padBottom = convInfo.padInfo.bottom;\n const padLeft = convInfo.padInfo.left;\n const dilationHeight = convInfo.dilationHeight;\n const dilationWidth = convInfo.dilationWidth;\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n const inputChannels = convInfo.inChannels;\n const outputChannels = convInfo.outChannels;\n const isSamePad = convInfo.padInfo.type === 'SAME' ? 1 : 0;\n\n if (convInfo.dataFormat !== 'channelsLast') {\n throw new Error(\n `wasm backend Conv2D does not support dataFormat:'` +\n `${convInfo.dataFormat}'. Please use 'channelsLast'.`);\n }\n\n const out = backend.makeOutput(convInfo.outShape, 'float32');\n const outId = backend.dataIdMap.get(out.dataId).id;\n wasmConv2d(\n xId, x.shape[0], x.shape[1], x.shape[2], filterId, filterHeight,\n filterWidth, padTop, padRight, padBottom, padLeft, isSamePad,\n dilationHeight, dilationWidth, strideHeight, strideWidth, inputChannels,\n outputChannels, outId);\n return out;\n}\n\nexport const conv2DConfig: KernelConfig = {\n kernelName: Conv2D,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: conv2d as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, Conv2DBackpropInput, Conv2DBackpropInputAttrs, Conv2DBackpropInputInputs, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nlet wasmConv2DBackpropInput: (\n dyId: number, filterId: number, batchSize: number, filterHeight: number,\n filterWidth: number, inHeight: number, inWidth: number, inChannels: number,\n outHeight: number, outWidth: number, outChannels: number,\n strideHeight: number, strideWidth: number, topPad: number, leftPad: number,\n fltS0: number, fltS1: number, fltS2: number, xBatchStride: number,\n xRowStride: number, xColStride: number, xChannelStride: number,\n yBatchStride: number, yRowStride: number, yColStride: number,\n yChannelStride: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm): void {\n wasmConv2DBackpropInput = backend.wasm.cwrap(Conv2DBackpropInput, null, [\n 'number', // dyId\n 'number', // filterId\n 'number', // batchSize\n 'number', // filterHeight\n 'number', // filterWidth\n 'number', // inHeight\n 'number', // inWidth\n 'number', // inChannels\n 'number', // outHeight\n 'number', // outWidth\n 'number', // outChannels\n 'number', // strideHeight\n 'number', // strideWidth\n 'number', // topPad\n 'number', // leftPad\n 'number', // fltS0\n 'number', // fltS1\n 'number', // fltS2\n 'number', // xBatchStride\n 'number', // xRowStride\n 'number', // xColStride\n 'number', // xChannelStride\n 'number', // yBatchStride\n 'number', // yRowStride\n 'number', // yColStride\n 'number', // yChannelStride\n 'number', // outId\n ]);\n}\n\nfunction conv2DBackpropInput(args: {\n backend: BackendWasm,\n inputs: Conv2DBackpropInputInputs,\n attrs: Conv2DBackpropInputAttrs\n}): TensorInfo {\n const {backend, inputs, attrs} = args;\n const {dy, filter} = inputs;\n const {strides, pad, dataFormat, dimRoundingMode, inputShape} = attrs;\n\n const dilations = 1;\n\n const $dataFormat = backend_util.convertConv2DDataFormat(dataFormat);\n const convInfo = backend_util.computeConv2DInfo(\n inputShape, filter.shape as [number, number, number, number], strides,\n dilations, pad, dimRoundingMode, false /* depthwise */, $dataFormat);\n const {\n batchSize,\n filterHeight,\n filterWidth,\n inChannels,\n inHeight,\n inWidth,\n outChannels,\n outHeight,\n outWidth,\n strideHeight,\n strideWidth\n } = convInfo;\n\n const topPad = filterHeight - 1 - convInfo.padInfo.top;\n const leftPad = filterWidth - 1 - convInfo.padInfo.left;\n\n const isChannelsLast = convInfo.dataFormat === 'channelsLast';\n const dxStrides = util.computeStrides(convInfo.inShape);\n const dyStrides = util.computeStrides(dy.shape);\n const [fltS0, fltS1, fltS2] = util.computeStrides(filter.shape);\n const xBatchStride = dxStrides[0];\n const xRowStride = isChannelsLast ? dxStrides[1] : dxStrides[2];\n const xColStride = isChannelsLast ? dxStrides[2] : 1;\n const xChannelStride = isChannelsLast ? 1 : dxStrides[1];\n const yBatchStride = dyStrides[0];\n const yRowStride = isChannelsLast ? dyStrides[1] : dyStrides[2];\n const yColStride = isChannelsLast ? dyStrides[2] : 1;\n const yChannelStride = isChannelsLast ? 1 : dyStrides[1];\n\n const out = backend.makeOutput(convInfo.inShape, 'float32');\n const outId = backend.dataIdMap.get(out.dataId).id;\n const dyId = backend.dataIdMap.get(dy.dataId).id;\n const filterId = backend.dataIdMap.get(filter.dataId).id;\n\n wasmConv2DBackpropInput(\n dyId, filterId, batchSize, filterHeight, filterWidth, inHeight, inWidth,\n inChannels, outHeight, outWidth, outChannels, strideHeight, strideWidth,\n topPad, leftPad, fltS0, fltS1, fltS2, xBatchStride, xRowStride,\n xColStride, xChannelStride, yBatchStride, yRowStride, yColStride,\n yChannelStride, outId);\n return out;\n}\n\nexport const conv2DBackpropInputConfig: KernelConfig = {\n kernelName: Conv2DBackpropInput,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: conv2DBackpropInput as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Cos, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {createUnaryKernelConfig} from './unary_kernel';\n\nexport const cosConfig: KernelConfig = createUnaryKernelConfig(Cos);\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Cosh, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {createUnaryKernelConfig} from './unary_kernel';\n\nexport const coshConfig: KernelConfig = createUnaryKernelConfig(Cosh);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {CropAndResize, CropAndResizeAttrs, CropAndResizeInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {cast} from './Cast';\n\n// Must match enum in CropAndResize.cc\nenum InterpolationMethod {\n bilinear = 0,\n nearest = 1\n}\n\nlet wasmCropAndResize: (\n imagesId: number, boxesId: number, boxIndId: number, numBoxes: number,\n imagesShape: Uint8Array, cropHeight: number, cropWidth: number,\n method: number, extrapolationValue: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm): void {\n wasmCropAndResize = backend.wasm.cwrap(CropAndResize, null /*void*/, [\n 'number', // imagesId\n 'number', // boxesId\n 'number', // boxIndId\n 'number', // numBoxes\n 'array', // images shape\n 'number', // cropHeight\n 'number', // cropWidth\n 'number', // method\n 'number', // extrapolation value\n 'number' // out id\n ]);\n}\n\nfunction cropAndResize(args: {\n backend: BackendWasm,\n inputs: CropAndResizeInputs,\n attrs: CropAndResizeAttrs\n}): TensorInfo {\n const {backend, inputs, attrs} = args;\n const {method, extrapolationValue, cropSize} = attrs;\n const {image, boxes, boxInd} = inputs;\n\n const numBoxes = boxes.shape[0];\n\n const [cropHeight, cropWidth] = cropSize as [number, number];\n const outShape = [numBoxes, cropHeight, cropWidth, image.shape[3]];\n\n let imagesData = backend.dataIdMap.get(image.dataId);\n let castedData;\n if (image.dtype !== 'float32') {\n castedData = cast({backend, inputs: {x: image}, attrs: {dtype: 'float32'}});\n imagesData = backend.dataIdMap.get(castedData.dataId);\n }\n\n const imagesId = imagesData.id;\n const boxesId = backend.dataIdMap.get(boxes.dataId).id;\n const boxIndId = backend.dataIdMap.get(boxInd.dataId).id;\n\n const out = backend.makeOutput(outShape, 'float32');\n const outId = backend.dataIdMap.get(out.dataId).id;\n\n const imagesShapeBytes = new Uint8Array(new Int32Array(image.shape).buffer);\n\n wasmCropAndResize(\n imagesId, boxesId, boxIndId, numBoxes, imagesShapeBytes, cropHeight,\n cropWidth,\n InterpolationMethod[method as {} as keyof typeof InterpolationMethod],\n extrapolationValue, outId);\n\n if (castedData != null) {\n backend.disposeData(castedData.dataId);\n }\n\n return out;\n}\n\nexport const cropAndResizeConfig: KernelConfig = {\n kernelName: CropAndResize,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: cropAndResize as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, Cumprod, CumprodAttrs, CumprodInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {CppDType} from './types';\n\nimport {transpose} from './Transpose';\n\nlet wasmCumprod: (xId: number, exclusive: number, reverse: number,\n finalDim: number, outId: number, dtype: CppDType) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmCumprod = backend.wasm.cwrap(Cumprod, null /* void */, [\n 'number', // x_id\n 'number', // exclusive\n 'number', // reverse\n 'number', // final_dim\n 'number', // out_id\n 'number' // dtype\n ]);\n}\n\nexport function cumprod(\n args: {inputs: CumprodInputs, backend: BackendWasm, attrs: CumprodAttrs}):\nTensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {axis, exclusive, reverse} = attrs;\n const xRank = x.shape.length;\n\n util.assert(x.dtype === 'float32' || x.dtype === 'int32',\n () => `cumprod does not support ${x.dtype} tensors in the WASM backend`);\n // permute required axis to inner most axis\n const permutation = backend_util.getAxesPermutation([axis], xRank);\n let permutedX = x;\n if (permutation !== null) {\n permutedX = transpose({inputs: {x}, attrs: {perm: permutation}, backend});\n }\n const permutedAxis = backend_util.getInnerMostAxes(1, xRank)[0];\n backend_util.assertAxesAreInnerMostDims('cumprod', [permutedAxis], xRank);\n\n const permutedOut = backend.makeOutput(permutedX.shape, permutedX.dtype);\n const finalDim = permutedX.shape[permutedAxis];\n const permutedXId = backend.dataIdMap.get(permutedX.dataId).id;\n const permutedOutId = backend.dataIdMap.get(permutedOut.dataId).id;\n wasmCumprod(permutedXId, exclusive ? 1 : 0, reverse ? 1 : 0, finalDim,\n permutedOutId, CppDType[x.dtype]);\n\n // transpose data back if permuted\n let out = permutedOut;\n if (permutation !== null) {\n const undoPermutation = backend_util.getUndoAxesPermutation(permutation);\n out = transpose(\n {inputs: {x: permutedOut}, attrs: {perm: undoPermutation}, backend});\n backend.disposeData(permutedX.dataId);\n backend.disposeData(permutedOut.dataId);\n }\n return out;\n}\n\nexport const cumprodConfig: KernelConfig = {\n kernelName: Cumprod,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: cumprod as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, Cumsum, CumsumAttrs, CumsumInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {CppDType} from './types';\n\nimport {transpose} from './Transpose';\n\nlet wasmCumsum: (xId: number, exclusive: number, reverse: number,\n finalDim: number, outId: number, dtype: CppDType) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmCumsum = backend.wasm.cwrap(Cumsum, null /* void */, [\n 'number', // x_id\n 'number', // exclusive\n 'number', // reverse\n 'number', // final_dim\n 'number', // out_id\n 'number' // dtype\n ]);\n}\n\nexport function cumsum(\n args: {inputs: CumsumInputs, backend: BackendWasm, attrs: CumsumAttrs}):\nTensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {axis, exclusive, reverse} = attrs;\n const xRank = x.shape.length;\n\n util.assert(x.dtype === 'float32' || x.dtype === 'int32',\n () => `cumsum does not support ${x.dtype} tensors in the WASM backend`);\n // permute required axis to inner most axis\n const permutation = backend_util.getAxesPermutation([axis], xRank);\n let permutedX = x;\n if (permutation !== null) {\n permutedX = transpose({inputs: {x}, attrs: {perm: permutation}, backend});\n }\n const permutedAxis = backend_util.getInnerMostAxes(1, xRank)[0];\n backend_util.assertAxesAreInnerMostDims('cumsum', [permutedAxis], xRank);\n\n const permutedOut = backend.makeOutput(permutedX.shape, permutedX.dtype);\n const finalDim = permutedX.shape[permutedAxis];\n const permutedXId = backend.dataIdMap.get(permutedX.dataId).id;\n const permutedOutId = backend.dataIdMap.get(permutedOut.dataId).id;\n wasmCumsum(permutedXId, exclusive ? 1 : 0, reverse ? 1 : 0, finalDim,\n permutedOutId, CppDType[x.dtype]);\n\n // transpose data back if permuted\n let out = permutedOut;\n if (permutation !== null) {\n const undoPermutation = backend_util.getUndoAxesPermutation(permutation);\n out = transpose(\n {inputs: {x: permutedOut}, attrs: {perm: undoPermutation}, backend});\n backend.disposeData(permutedX.dataId);\n backend.disposeData(permutedOut.dataId);\n }\n return out;\n}\n\nexport const cumsumConfig: KernelConfig = {\n kernelName: Cumsum,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: cumsum as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DepthToSpace, DepthToSpaceAttrs, DepthToSpaceInputs, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nlet wasmDepthToSpace: (\n xId: number, blockSize: number, channelsLast: number, xStrides: Uint8Array,\n xStridesLength: number, outputShape: Uint8Array, outputStrides: Uint8Array,\n outSize: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm): void {\n wasmDepthToSpace = backend.wasm.cwrap(DepthToSpace, null /*void*/, [\n 'number', // xId\n 'number', // blockSize\n 'number', // channelsLast\n 'array', // xStrides\n 'number', // xStridesLength\n 'array', // outputShape\n 'array', // outputStrides\n 'number', // outSize\n 'number', // outId\n ]);\n}\n\nexport function depthToSpace(args: {\n backend: BackendWasm,\n inputs: DepthToSpaceInputs,\n attrs: DepthToSpaceAttrs\n}): TensorInfo {\n const {backend, inputs, attrs} = args;\n const {x} = inputs;\n const {blockSize, dataFormat} = attrs;\n\n const batchSize = x.shape[0];\n const inputHeight = (dataFormat === 'NHWC') ? x.shape[1] : x.shape[2];\n const inputWidth = (dataFormat === 'NHWC') ? x.shape[2] : x.shape[3];\n const inputDepth = (dataFormat === 'NHWC') ? x.shape[3] : x.shape[1];\n\n const outputHeight = inputHeight * blockSize;\n const outputWidth = inputWidth * blockSize;\n const outputDepth = inputDepth / (blockSize * blockSize);\n\n const outputShape = (dataFormat === 'NHWC') ?\n [batchSize, outputHeight, outputWidth, outputDepth] :\n [batchSize, outputDepth, outputHeight, outputWidth];\n\n const out = backend.makeOutput(outputShape, 'float32');\n\n const xData = backend.dataIdMap.get(x.dataId);\n const xId = xData.id;\n const xStridesBytes =\n new Uint8Array(new Int32Array(util.computeStrides(x.shape)).buffer);\n\n const outputShapeBytes = new Uint8Array(new Int32Array(outputShape).buffer);\n const outStridesBytes =\n new Uint8Array(new Int32Array(util.computeStrides(outputShape)).buffer);\n\n const outId = backend.dataIdMap.get(out.dataId).id;\n const channelsLast = dataFormat === 'NHWC' ? 1 : 0;\n wasmDepthToSpace(\n xId, blockSize, channelsLast, xStridesBytes, x.shape.length - 1,\n outputShapeBytes, outStridesBytes, outputShape.length, outId);\n\n return out;\n}\n\nexport const depthToSpaceConfig: KernelConfig = {\n kernelName: DepthToSpace,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: depthToSpace as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, DepthwiseConv2dNative, DepthwiseConv2dNativeAttrs, DepthwiseConv2dNativeInputs, KernelConfig, KernelFunc, Tensor4D} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nlet wasmDepthwiseConv2d: (\n xId: number, batchSize: number, inputHeight: number, inputWidth: number,\n filterId: number, filterHeight: number, filterWidth: number, padTop: number,\n padRight: number, padBottom: number, padLeft: number, isSamePad: number,\n dilationHeight: number, dilationWidth: number, strideHeight: number,\n strideWidth: number, inputChannels: number, outputChannels: number,\n outId: number) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmDepthwiseConv2d =\n backend.wasm.cwrap(DepthwiseConv2dNative, null /* void */, [\n 'number', // xId\n 'number', // batchSize\n 'number', // inputHeight\n 'number', // inputWidth\n 'number', // filterId\n 'number', // filterHeight\n 'number', // filterWidth\n 'number', // padTop\n 'number', // padRight\n 'number', // padBottom\n 'number', // padLeft\n 'number', // isSamePad\n 'number', // dilationHeight\n 'number', // dilationWidth\n 'number', // strideHeight\n 'number', // strideWidth\n 'number', // inputChannels\n 'number', // outputChannels\n 'number', // outId\n ]);\n}\n\nfunction depthwiseConv2d(args: {\n inputs: DepthwiseConv2dNativeInputs,\n backend: BackendWasm,\n attrs: DepthwiseConv2dNativeAttrs\n}) {\n const {inputs, attrs, backend} = args;\n\n const {x, filter} = inputs;\n const xId = backend.dataIdMap.get(x.dataId).id;\n const filterId = backend.dataIdMap.get(filter.dataId).id;\n\n const {strides, dilations, pad, dimRoundingMode} = attrs;\n\n const $dilations = dilations == null ? [1, 1] : dilations;\n\n const convInfo = backend_util.computeConv2DInfo(\n (x as Tensor4D).shape, (filter as Tensor4D).shape, strides,\n ($dilations as number | [number, number]), pad, dimRoundingMode,\n true /* depthwise */);\n\n const filterHeight = convInfo.filterHeight;\n const filterWidth = convInfo.filterWidth;\n const padTop = convInfo.padInfo.top;\n const padRight = convInfo.padInfo.right;\n const padBottom = convInfo.padInfo.bottom;\n const padLeft = convInfo.padInfo.left;\n const dilationHeight = convInfo.dilationHeight;\n const dilationWidth = convInfo.dilationWidth;\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n const inputChannels = convInfo.inChannels;\n const outputChannels = convInfo.outChannels;\n const isSamePad = convInfo.padInfo.type === 'SAME' ? 1 : 0;\n\n if (convInfo.dataFormat !== 'channelsLast') {\n throw new Error(\n `wasm backend DepthwiseConv2dNative does not support dataFormat:'` +\n `${convInfo.dataFormat}'. Please use 'channelsLast'.`);\n }\n\n const out = backend.makeOutput(convInfo.outShape, 'float32');\n const outId = backend.dataIdMap.get(out.dataId).id;\n wasmDepthwiseConv2d(\n xId, x.shape[0], x.shape[1], x.shape[2], filterId, filterHeight,\n filterWidth, padTop, padRight, padBottom, padLeft, isSamePad,\n dilationHeight, dilationWidth, strideHeight, strideWidth, inputChannels,\n outputChannels, outId);\n return out;\n}\n\nexport const depthwiseConv2dNativeConfig: KernelConfig = {\n kernelName: DepthwiseConv2dNative,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: depthwiseConv2d as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Elu, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {createUnaryKernelConfig} from './unary_kernel';\n\nexport const eluConfig: KernelConfig = createUnaryKernelConfig(Elu);\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Equal, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {createBinaryKernelConfig} from './binary_kernel';\n\nconst supportsFullBroadcast = false;\nexport const equalConfig: KernelConfig =\n createBinaryKernelConfig(Equal, supportsFullBroadcast, 'bool');\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Exp, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {createUnaryKernelConfig} from './unary_kernel';\n\nexport const expConfig: KernelConfig = createUnaryKernelConfig(Exp, 'float32');\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ExpandDims, ExpandDimsAttrs, ExpandDimsInputs, KernelConfig, KernelFunc, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\nimport {reshape} from './Reshape';\n\nexport function expandDims(args: {\n inputs: ExpandDimsInputs,\n attrs: ExpandDimsAttrs,\n backend: BackendWasm\n}) {\n const {inputs, attrs, backend} = args;\n const {input} = inputs;\n const {dim} = attrs;\n\n const inputRank = input.shape.length;\n const newShape = input.shape.slice();\n let $dim = dim;\n if (dim < 0) {\n // Negative value is counted from the tail of rank.\n util.assert(\n -(inputRank + 1) <= dim,\n () => `Axis must be in the interval [${- (inputRank + 1)}, ${\n inputRank}]`);\n $dim = inputRank + dim + 1;\n }\n newShape.splice($dim, 0, 1);\n\n return reshape({inputs: {x: input}, backend, attrs: {shape: newShape}});\n}\n\nexport const expandDimsConfig: KernelConfig = {\n kernelName: ExpandDims,\n backendName: 'wasm',\n kernelFunc: expandDims as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\nimport {Fill, FillAttrs} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nexport function fill(args: {attrs: FillAttrs, backend: BackendWasm}) {\n const {attrs: {shape, value, dtype}, backend} = args;\n const out = backend.makeOutput(shape, dtype);\n const outVals = backend.typedArrayFromHeap(out);\n outVals.fill(value as number);\n return out;\n}\n\nexport const fillConfig: KernelConfig = {\n kernelName: Fill,\n backendName: 'wasm',\n kernelFunc: fill as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {FlipLeftRight, FlipLeftRightInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nlet wasmFlipLeftRight: (\n xId: number, batch: number, imageHeight: number, imageWidth: number,\n numChannels: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmFlipLeftRight = backend.wasm.cwrap(FlipLeftRight, null /* void */, [\n 'number', // xId\n 'number', // batch\n 'number', // imageHeight\n 'number', // imageWidth\n 'number', // numChannels\n 'number', // outId\n ]);\n}\n\nexport function flipLeftRight(\n args: {inputs: FlipLeftRightInputs, backend: BackendWasm}): TensorInfo {\n const {inputs, backend} = args;\n const {image} = inputs;\n\n const out = backend.makeOutput(image.shape, image.dtype);\n const imageId = backend.dataIdMap.get(image.dataId).id;\n const outId = backend.dataIdMap.get(out.dataId).id;\n\n const [batch, imageHeight, imageWidth, numChannels] = image.shape;\n\n wasmFlipLeftRight(\n imageId, batch, imageHeight, imageWidth, numChannels, outId);\n return out;\n}\n\nexport const flipLeftRightConfig: KernelConfig = {\n kernelName: FlipLeftRight,\n backendName: 'wasm',\n kernelFunc: flipLeftRight as {} as KernelFunc,\n setupFunc: setup\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Floor, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {createUnaryKernelConfig} from './unary_kernel';\nexport const floorConfig: KernelConfig = createUnaryKernelConfig(Floor);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {FloorDiv, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {createBinaryKernelConfig} from './binary_kernel';\n\nconst supportsFullBroadcast = false;\nexport const floorDivConfig: KernelConfig =\n createBinaryKernelConfig(FloorDiv, supportsFullBroadcast);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {FusedBatchNorm, FusedBatchNormAttrs, FusedBatchNormInputs, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nlet wasmBatchNorm: (\n xId: number, meanId: number, varianceId: number, offsetId: number,\n scaleId: number, varianceEpsilon: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm): void {\n wasmBatchNorm = backend.wasm.cwrap(\n FusedBatchNorm, null /* void */,\n ['number', 'number', 'number', 'number', 'number', 'number', 'number']);\n}\n\nfunction fusedBatchNorm(args: {\n backend: BackendWasm,\n inputs: FusedBatchNormInputs,\n attrs: FusedBatchNormAttrs\n}): TensorInfo {\n const {backend, inputs, attrs} = args;\n const {varianceEpsilon} = attrs;\n const {x, mean, variance, offset, scale} = inputs;\n const xId = backend.dataIdMap.get(x.dataId).id;\n const meanId = backend.dataIdMap.get(mean.dataId).id;\n const varianceId = backend.dataIdMap.get(variance.dataId).id;\n const offsetId = offset != null ? backend.dataIdMap.get(offset.dataId).id : 0;\n const scaleId = scale != null ? backend.dataIdMap.get(scale.dataId).id : 0;\n\n const out = backend.makeOutput(x.shape, x.dtype);\n // Short-circuit zero-sized tensors.\n if (util.sizeFromShape(x.shape) === 0) {\n return out;\n }\n\n const outId = backend.dataIdMap.get(out.dataId).id;\n\n wasmBatchNorm(\n xId, meanId, varianceId, offsetId, scaleId, varianceEpsilon, outId);\n return out;\n}\n\nexport const fusedBatchNormConfig: KernelConfig = {\n kernelName: FusedBatchNorm,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: fusedBatchNorm as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, FusedConv2D, FusedConv2DAttrs, FusedConv2DInputs, KernelConfig, KernelFunc, Tensor4D} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {FusableActivation} from './types';\n\nlet wasmFusedConv2d:\n (xId: number, batchSize: number, inputHeight: number, inputWidth: number,\n filterId: number, filterHeight: number, filterWidth: number,\n biasId: number, padTop: number, padRight: number, padBottom: number,\n padLeft: number, isSamePad: number, dilationHeight: number,\n dilationWidth: number, strideHeight: number, strideWidth: number,\n inputChannels: number, outputChannels: number, activation: number,\n preluActivationWeightsId: number, leakyreluAlpha: number, outId: number) =>\n void;\n\nfunction setup(backend: BackendWasm) {\n wasmFusedConv2d = backend.wasm.cwrap(FusedConv2D, null /* void */, [\n 'number', // xId\n 'number', // batchSize\n 'number', // inputHeight\n 'number', // inputWidth\n 'number', // filterId\n 'number', // filterHeight\n 'number', // filterWidth\n 'number', // biasId\n 'number', // padTop\n 'number', // padRight\n 'number', // padBottom\n 'number', // padLeft\n 'number', // isSamePad\n 'number', // dilationHeight\n 'number', // dilationWidth\n 'number', // strideHeight\n 'number', // strideWidth\n 'number', // inputChannels\n 'number', // outputChannels\n 'number', // activation\n 'number', // preluActivationWeightsId\n 'number', // leakyreluAlpha\n 'number', // outId\n ]);\n}\n\nfunction fusedConv2d(args: {\n inputs: FusedConv2DInputs,\n backend: BackendWasm,\n attrs: FusedConv2DAttrs\n}) {\n const {inputs, attrs, backend} = args;\n const {x, filter, bias, preluActivationWeights} = inputs;\n const {\n strides,\n pad,\n dilations,\n dataFormat,\n dimRoundingMode,\n activation,\n leakyreluAlpha\n } = attrs;\n\n const convInfo = backend_util.computeConv2DInfo(\n (x as Tensor4D).shape, (filter as Tensor4D).shape, strides, dilations,\n pad, dimRoundingMode);\n\n const fusedActivation =\n FusableActivation[activation as {} as keyof typeof FusableActivation];\n if (fusedActivation == null) {\n throw new Error(\n `${activation} activation not yet supported for FusedConv2D ` +\n `in the wasm backend.`);\n }\n\n const xId = backend.dataIdMap.get(x.dataId).id;\n const filterId = backend.dataIdMap.get(filter.dataId).id;\n\n const outputChannels = convInfo.outChannels;\n\n let biasId = 0;\n if (bias != null) {\n const biasData = backend.dataIdMap.get(bias.dataId);\n if (biasData.shape.length !== 1) {\n throw new Error(\n `FusedConv2D only supports rank-1 bias but got ` +\n `rank ${biasData.shape.length}.`);\n }\n if (biasData.shape[0] !== outputChannels) {\n throw new Error(\n `FusedConv2D bias shape (${biasData.shape}) does not ` +\n `match the number of output channels (${outputChannels})`);\n }\n biasId = biasData.id;\n }\n\n const filterHeight = convInfo.filterHeight;\n const filterWidth = convInfo.filterWidth;\n const padTop = convInfo.padInfo.top;\n const padRight = convInfo.padInfo.right;\n const padBottom = convInfo.padInfo.bottom;\n const padLeft = convInfo.padInfo.left;\n const dilationHeight = convInfo.dilationHeight;\n const dilationWidth = convInfo.dilationWidth;\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n const inputChannels = convInfo.inChannels;\n const isSamePad = convInfo.padInfo.type === 'SAME' ? 1 : 0;\n const batchSize = convInfo.batchSize;\n const inHeight = convInfo.inHeight;\n const inWidth = convInfo.inWidth;\n\n if (dataFormat !== 'NHWC') {\n throw new Error(\n `wasm backend FusedConv2D does not support dataFormat:'` +\n `${dataFormat}'. Please use 'NHWC'.`);\n }\n\n const out = backend.makeOutput(convInfo.outShape, 'float32');\n const outId = backend.dataIdMap.get(out.dataId).id;\n const preluActivationWeightsId = preluActivationWeights == null ?\n 0 :\n backend.dataIdMap.get(preluActivationWeights.dataId).id;\n\n wasmFusedConv2d(\n xId, batchSize, inHeight, inWidth, filterId, filterHeight, filterWidth,\n biasId, padTop, padRight, padBottom, padLeft, isSamePad, dilationHeight,\n dilationWidth, strideHeight, strideWidth, inputChannels, outputChannels,\n fusedActivation, preluActivationWeightsId, leakyreluAlpha || 0, outId);\n\n return out;\n}\n\nexport const fusedConv2DConfig: KernelConfig = {\n kernelName: FusedConv2D,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: fusedConv2d as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, FusedDepthwiseConv2D, FusedDepthwiseConv2DAttrs, FusedDepthwiseConv2DInputs, KernelConfig, KernelFunc, Tensor4D} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {FusableActivation} from './types';\n\nlet wasmFusedDepthwiseConv2d:\n (xId: number, batchSize: number, inputHeight: number, inputWidth: number,\n filterId: number, filterHeight: number, filterWidth: number,\n biasId: number, padTop: number, padRight: number, padBottom: number,\n padLeft: number, isSamePad: number, dilationHeight: number,\n dilationWidth: number, strideHeight: number, strideWidth: number,\n inputChannels: number, outputChannels: number, activation: number,\n preluActivationWeightsId: number, leakyreluAlpha: number, outId: number) =>\n void;\n\nfunction setup(backend: BackendWasm) {\n wasmFusedDepthwiseConv2d =\n backend.wasm.cwrap(FusedDepthwiseConv2D, null /* void */, [\n 'number', // xId\n 'number', // batchSize\n 'number', // inputHeight\n 'number', // inputWidth\n 'number', // filterId\n 'number', // filterHeight\n 'number', // filterWidth\n 'number', // biasId\n 'number', // padTop\n 'number', // padRight\n 'number', // padBottom\n 'number', // padLeft\n 'number', // isSamePad\n 'number', // dilationHeight\n 'number', // dilationWidth\n 'number', // strideHeight\n 'number', // strideWidth\n 'number', // inputChannels\n 'number', // outputChannels\n 'number', // activation\n 'number', // preluActivationWeightsId\n 'number', // leakyreluAlpha\n 'number', // outId\n ]);\n}\n\nfunction fusedDepthwiseConv2d(args: {\n inputs: FusedDepthwiseConv2DInputs,\n backend: BackendWasm,\n attrs: FusedDepthwiseConv2DAttrs\n}) {\n const {inputs, attrs, backend} = args;\n const {x, filter, bias, preluActivationWeights} = inputs;\n const {\n strides,\n pad,\n dilations,\n dataFormat,\n dimRoundingMode,\n activation,\n leakyreluAlpha\n } = attrs;\n\n const convInfo = backend_util.computeConv2DInfo(\n (x as Tensor4D).shape, (filter as Tensor4D).shape, strides, dilations,\n pad, dimRoundingMode, true /* depthwise */);\n\n const fusedActivation =\n FusableActivation[activation as {} as keyof typeof FusableActivation];\n if (fusedActivation == null) {\n throw new Error(\n `${activation} activation not yet supported for FusedDepthwiseConv2D ` +\n `in the wasm backend.`);\n }\n\n const xId = backend.dataIdMap.get(x.dataId).id;\n const filterId = backend.dataIdMap.get(filter.dataId).id;\n\n const outputChannels = convInfo.outChannels;\n\n let biasId = 0;\n if (bias != null) {\n const biasData = backend.dataIdMap.get(bias.dataId);\n if (biasData.shape.length !== 1) {\n throw new Error(\n `FusedDepthwiseConv2D only supports rank-1 bias but got ` +\n `rank ${biasData.shape.length}.`);\n }\n if (biasData.shape[0] !== outputChannels) {\n throw new Error(\n `FusedDepthwiseConv2D bias shape (${biasData.shape}) does not ` +\n `match the number of output channels (${outputChannels})`);\n }\n biasId = biasData.id;\n }\n\n const filterHeight = convInfo.filterHeight;\n const filterWidth = convInfo.filterWidth;\n const padTop = convInfo.padInfo.top;\n const padRight = convInfo.padInfo.right;\n const padBottom = convInfo.padInfo.bottom;\n const padLeft = convInfo.padInfo.left;\n const dilationHeight = convInfo.dilationHeight;\n const dilationWidth = convInfo.dilationWidth;\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n const inputChannels = convInfo.inChannels;\n const isSamePad = convInfo.padInfo.type === 'SAME' ? 1 : 0;\n const batchSize = convInfo.batchSize;\n const inHeight = convInfo.inHeight;\n const inWidth = convInfo.inWidth;\n\n if (dataFormat !== 'NHWC') {\n throw new Error(\n `wasm backend FusedDepthwiseConv2D does not support dataFormat:'` +\n `${dataFormat}'. Please use 'NHWC'.`);\n }\n\n const out = backend.makeOutput(convInfo.outShape, 'float32');\n const outId = backend.dataIdMap.get(out.dataId).id;\n const preluActivationWeightsId = preluActivationWeights == null ?\n 0 :\n backend.dataIdMap.get(preluActivationWeights.dataId).id;\n\n wasmFusedDepthwiseConv2d(\n xId, batchSize, inHeight, inWidth, filterId, filterHeight, filterWidth,\n biasId, padTop, padRight, padBottom, padLeft, isSamePad, dilationHeight,\n dilationWidth, strideHeight, strideWidth, inputChannels, outputChannels,\n fusedActivation, preluActivationWeightsId, leakyreluAlpha || 0, outId);\n\n return out;\n}\n\nexport const fusedDepthwiseConv2DConfig: KernelConfig = {\n kernelName: FusedDepthwiseConv2D,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: fusedDepthwiseConv2d as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {gather_util, GatherNd, GatherNdInputs, KernelConfig, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {CppDType} from './types';\n\nlet wasmGatherNd: (\n xId: number, dtype: CppDType, indicesId: number, numSlices: number,\n sliceRank: number, sliceSize: number, strides: Uint8Array, outId: number) =>\n void;\n\nfunction setup(backend: BackendWasm): void {\n wasmGatherNd = backend.wasm.cwrap(GatherNd, null /*void*/, [\n 'number', // xId\n 'number', // dtype\n 'number', // indicesId\n 'number', // numSlices\n 'number', // sliceRank\n 'number', // sliceSize\n 'array', // strides\n 'number' // outId\n ]);\n}\n\nfunction gatherNd(args: {backend: BackendWasm, inputs: GatherNdInputs}):\n TensorInfo {\n const {backend, inputs} = args;\n const {params, indices} = inputs;\n\n const [resultShape, numSlices, sliceSize, strides] =\n gather_util.prepareAndValidate(params, indices);\n\n const out = backend.makeOutput(resultShape, params.dtype);\n if (numSlices === 0) {\n return out;\n }\n\n const indicesShape = indices.shape;\n const sliceRank = indicesShape[indicesShape.length - 1];\n\n const xData = backend.dataIdMap.get(params.dataId);\n const xId = xData.id;\n const indicesData = backend.dataIdMap.get(indices.dataId);\n const indicesId = indicesData.id;\n\n const stridesBytes = new Uint8Array(new Int32Array(strides).buffer);\n\n const outId = backend.dataIdMap.get(out.dataId).id;\n wasmGatherNd(\n xId, CppDType[params.dtype], indicesId, numSlices, sliceRank, sliceSize,\n stridesBytes, outId);\n\n return out;\n}\n\nexport const gatherNdConfig: KernelConfig = {\n kernelName: GatherNd,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: gatherNd\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, GatherV2, GatherV2Attrs, GatherV2Inputs, KernelConfig, KernelFunc, Tensor, TensorInfo, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {reshape} from './Reshape';\nimport {CppDType} from './types';\n\nlet wasmGather: (\n xId: number, dtype: CppDType, xStrides: Uint8Array, stridesSize: number,\n indicesId: number, batchSize: number, outStrides: Uint8Array,\n outId: number) => void;\n\nfunction setup(backend: BackendWasm): void {\n wasmGather = backend.wasm.cwrap('Gather', null /*void*/, [\n 'number', // xId\n 'number', // dtype\n 'array', // xStrides\n 'number', // stridesSize\n 'number', // indicesId\n 'number', // batchSize\n 'array', // outStrides\n 'number' // outId\n ]);\n}\n\nfunction gatherV2(\n args: {backend: BackendWasm, inputs: GatherV2Inputs, attrs: GatherV2Attrs}):\n TensorInfo {\n const {backend, inputs, attrs} = args;\n const {x, indices} = inputs;\n const {axis, batchDims} = attrs;\n\n // Throw error when any index is out of bound.\n const parsedAxis = util.parseAxisParam(axis, x.shape)[0];\n const indicesVals = backend.readSync(indices.dataId) as TypedArray;\n const axisDim = x.shape[parsedAxis];\n for (let i = 0; i < indicesVals.length; ++i) {\n const index = indicesVals[i];\n util.assert(\n index <= axisDim - 1 && index >= 0,\n () =>\n `GatherV2: the index value ${index} is not in [0, ${axisDim - 1}]`);\n }\n\n const shapeInfo = backend_util.segment_util.collectGatherOpShapeInfo(\n x as Tensor, indices as Tensor, parsedAxis, batchDims);\n\n const flattenX = reshape({\n inputs: {x},\n attrs: {\n shape: [\n shapeInfo.batchSize, shapeInfo.outerSize, shapeInfo.dimSize,\n shapeInfo.sliceSize\n ]\n },\n backend\n });\n const indicesSize = util.sizeFromShape(indices.shape);\n const flattenIndex = reshape({\n inputs: {x: indices},\n attrs: {shape: [shapeInfo.batchSize, indicesSize / shapeInfo.batchSize]},\n backend\n });\n const flattenOutputShape = [\n shapeInfo.batchSize, shapeInfo.outerSize, indicesSize / shapeInfo.batchSize,\n shapeInfo.sliceSize\n ];\n\n const out = backend.makeOutput(flattenOutputShape, x.dtype);\n if (util.sizeFromShape(x.shape) === 0) {\n return out;\n }\n const stridesSize = flattenX.shape.length - 1;\n\n const xData = backend.dataIdMap.get(flattenX.dataId);\n const xId = xData.id;\n\n const indicesData = backend.dataIdMap.get(flattenIndex.dataId);\n const indicesId = indicesData.id;\n\n const outId = backend.dataIdMap.get(out.dataId).id;\n\n const xStridesBytes = new Uint8Array(\n new Int32Array(util.computeStrides(flattenX.shape)).buffer);\n const outStridesBytes = new Uint8Array(\n new Int32Array(util.computeStrides(flattenOutputShape)).buffer);\n\n wasmGather(\n xId, CppDType[x.dtype], xStridesBytes, stridesSize, indicesId,\n shapeInfo.batchSize, outStridesBytes, outId);\n\n backend.disposeData(flattenX.dataId);\n backend.disposeData(flattenIndex.dataId);\n\n // reshape\n out.shape = shapeInfo.outputShape;\n return out;\n}\n\nexport const gatherV2Config: KernelConfig = {\n kernelName: GatherV2,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: gatherV2 as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Greater, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {createBinaryKernelConfig} from './binary_kernel';\n\nconst supportsFullBroadcast = false;\nexport const greaterConfig: KernelConfig =\n createBinaryKernelConfig(Greater, supportsFullBroadcast, 'bool');\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {GreaterEqual, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {createBinaryKernelConfig} from './binary_kernel';\n\nconst supportsFullBroadcast = false;\nexport const greaterEqualConfig: KernelConfig =\n createBinaryKernelConfig(GreaterEqual, supportsFullBroadcast, 'bool');\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, LeakyRelu, LeakyReluAttrs, LeakyReluInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {CppDType} from './types';\n\nlet wasmFunc: (\n xId: number, dtype: number, leakyreluAlpha: number, outId: number) => void;\n\nfunction setupFunc(backend: BackendWasm): void {\n wasmFunc = backend.wasm.cwrap(LeakyRelu, null /* void */, [\n 'number', // x_id\n 'number', // dtype\n 'number', // leakyrelu_alpha\n 'number', // out_id\n ]);\n}\n\nexport function leakyRelu(\n args:\n {inputs: LeakyReluInputs, attrs: LeakyReluAttrs, backend: BackendWasm}):\n TensorInfo {\n const {inputs: {x}, attrs: {alpha}, backend} = args;\n\n const xId = backend.dataIdMap.get(x.dataId).id;\n // According to TF API, LeakyRelu returns float32 when input is either float32\n // or int32.\n const out = backend.makeOutput(x.shape, 'float32');\n\n if (util.sizeFromShape(x.shape) !== 0) {\n const outId = backend.dataIdMap.get(out.dataId).id;\n wasmFunc(xId, CppDType[x.dtype], alpha, outId);\n }\n\n return out;\n}\n\nexport const leakyReluConfig: KernelConfig = {\n kernelName: LeakyRelu,\n backendName: 'wasm',\n setupFunc,\n kernelFunc: leakyRelu as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, Less} from '@tensorflow/tfjs-core';\n\nimport {createBinaryKernelConfig} from './binary_kernel';\nconst supportsFullBroadcast = false;\nexport const lessConfig: KernelConfig =\n createBinaryKernelConfig(Less, supportsFullBroadcast, 'bool');\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, LessEqual} from '@tensorflow/tfjs-core';\n\nimport {createBinaryKernelConfig} from './binary_kernel';\nconst supportsFullBroadcast = false;\nexport const lessEqualConfig: KernelConfig =\n createBinaryKernelConfig(LessEqual, supportsFullBroadcast, 'bool');\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, Log} from '@tensorflow/tfjs-core';\n\nimport {createUnaryKernelConfig} from './unary_kernel';\nexport const logConfig: KernelConfig = createUnaryKernelConfig(Log);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, LogicalAnd} from '@tensorflow/tfjs-core';\n\nimport {createBinaryKernelConfig} from './binary_kernel';\nconst supportsFullBroadcast = false;\nexport const logicalAndConfig: KernelConfig =\n createBinaryKernelConfig(LogicalAnd, supportsFullBroadcast, 'bool');\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, LogicalNot} from '@tensorflow/tfjs-core';\n\nimport {createUnaryKernelConfig} from './unary_kernel';\n\nexport const logicalNotConfig: KernelConfig =\n createUnaryKernelConfig(LogicalNot);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, LogicalOr} from '@tensorflow/tfjs-core';\n\nimport {createBinaryKernelConfig} from './binary_kernel';\nconst supportsFullBroadcast = false;\nexport const logicalOrConfig: KernelConfig =\n createBinaryKernelConfig(LogicalOr, supportsFullBroadcast, 'bool');\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, LogicalXor} from '@tensorflow/tfjs-core';\n\nimport {createBinaryKernelConfig} from './binary_kernel';\nconst supportsFullBroadcast = false;\nexport const logicalXorConfig: KernelConfig =\n createBinaryKernelConfig(LogicalXor, supportsFullBroadcast, 'bool');\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, Max, MaxAttrs, MaxInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {permuteAxesAndTranspose} from './kernel_utils';\nimport {CppDType} from './types';\n\nlet wasmMax: (xId: number, dtype: number, reduceSize: number, outId: number) =>\n void;\n\nfunction setup(backend: BackendWasm): void {\n wasmMax = backend.wasm.cwrap(Max, null /*void*/, [\n 'number', // x_id\n 'number', // dtype\n 'number', // reduce_size\n 'number', // out_id\n ]);\n}\n\nfunction max(args: {backend: BackendWasm, inputs: MaxInputs, attrs: MaxAttrs}):\n TensorInfo {\n const {backend, inputs, attrs} = args;\n const {reductionIndices: axis, keepDims} = attrs;\n const {x} = inputs;\n const xId = backend.dataIdMap.get(x.dataId).id;\n let inputId = xId;\n let input = x;\n\n const {transposed, axes, originalAxes, inputWasTransposed} =\n permuteAxesAndTranspose(x, axis, backend);\n\n if (inputWasTransposed) {\n const transposedId = backend.dataIdMap.get(transposed.dataId).id;\n input = transposed;\n inputId = transposedId;\n }\n\n const inputRank = input.shape.length;\n backend_util.assertAxesAreInnerMostDims('max', axes, inputRank);\n const [outShape, reduceShape] =\n backend_util.computeOutAndReduceShapes(input.shape, axes);\n const reduceSize = util.sizeFromShape(reduceShape);\n\n const out = backend.makeOutput(outShape, x.dtype);\n if (util.sizeFromShape(input.shape) !== 0) {\n const outId = backend.dataIdMap.get(out.dataId).id;\n wasmMax(inputId, CppDType[x.dtype], reduceSize, outId);\n }\n\n if (inputWasTransposed) {\n // dispose of the transposed tensor.\n backend.disposeData(transposed.dataId);\n }\n\n if (keepDims) {\n // reshape\n const newShape = backend_util.expandShapeToKeepDim(out.shape, originalAxes);\n out.shape = newShape;\n }\n\n return out;\n}\n\nexport const maxConfig: KernelConfig = {\n kernelName: Max,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: max as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, Maximum} from '@tensorflow/tfjs-core';\n\nimport {createBinaryKernelConfig} from './binary_kernel';\nconst supportsFullBroadcast = false;\nexport const maximumConfig: KernelConfig =\n createBinaryKernelConfig(Maximum, supportsFullBroadcast);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, MaxPool, MaxPoolAttrs, MaxPoolInputs, Tensor4D, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nlet wasmMaxPool: (\n xId: number, batchSize: number, inputHeight: number, inputWidth: number,\n filterHeight: number, filterWidth: number, padTop: number, padRight: number,\n padBottom: number, padLeft: number, dilationHeight: number,\n dilationWidth: number, strideHeight: number, strideWidth: number,\n inputChannels: number, outputChannels: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmMaxPool = backend.wasm.cwrap(MaxPool, null /* void */, [\n 'number', // xId\n 'number', // batchSize\n 'number', // inputHeight\n 'number', // inputWidth\n 'number', // filterHeight\n 'number', // filterWidth\n 'number', // padTop\n 'number', // padRight\n 'number', // padBottom\n 'number', // padLeft\n 'number', // dilationHeight\n 'number', // dilationWidth\n 'number', // strideHeight\n 'number', // strideWidth\n 'number', // inputChannels\n 'number', // outputChannels\n 'number', // outId\n ]);\n}\n\nfunction maxPool(\n args: {inputs: MaxPoolInputs, backend: BackendWasm, attrs: MaxPoolAttrs}) {\n const {inputs, attrs, backend} = args;\n\n const x = inputs.x as Tensor4D;\n const xId = backend.dataIdMap.get(x.dataId).id;\n\n // TF API supports int32 input. CPU and WebGL backend also support int32\n // input. WASM backend doesn't support it because it uses xnnpack which only\n // supports float32.\n //\n // Add the following assert only for the WASM backend instead of at core op\n // level.\n //\n // TODO: add support for int32 input.\n util.assert(\n x.dtype === 'float32',\n () =>\n `Error in MaxPool: only float32 input is supported. Got ${x.dtype}.`);\n\n const {filterSize, strides, pad, dimRoundingMode} = attrs;\n const convInfo = backend_util.computePool2DInfo(\n x.shape, filterSize, strides, 1 /* dilations */, pad, dimRoundingMode);\n\n const filterHeight = convInfo.filterHeight;\n const filterWidth = convInfo.filterWidth;\n const padTop = convInfo.padInfo.top;\n const padRight = convInfo.padInfo.right;\n const padBottom = convInfo.padInfo.bottom;\n const padLeft = convInfo.padInfo.left;\n const dilationHeight = convInfo.dilationHeight;\n const dilationWidth = convInfo.dilationWidth;\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n const inputChannels = convInfo.inChannels;\n const outputChannels = convInfo.outChannels;\n\n if (convInfo.dataFormat !== 'channelsLast') {\n throw new Error(\n `wasm backend does not support dataFormat:'` +\n `${convInfo.dataFormat}'. Please use 'channelsLast'.`);\n }\n\n const out = backend.makeOutput(convInfo.outShape, 'float32');\n const outId = backend.dataIdMap.get(out.dataId).id;\n\n wasmMaxPool(\n xId, x.shape[0], x.shape[1], x.shape[2], filterHeight, filterWidth,\n padTop, padRight, padBottom, padLeft, dilationHeight, dilationWidth,\n strideHeight, strideWidth, inputChannels, outputChannels, outId);\n return out;\n}\n\nexport const maxPoolConfig: KernelConfig = {\n kernelName: MaxPool,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: maxPool as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, Mean, MeanAttrs, MeanInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\nimport {cast} from './Cast';\n\nimport {permuteAxesAndTranspose} from './kernel_utils';\n\nlet wasmMean: (xId: number, reduceSize: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm): void {\n wasmMean =\n backend.wasm.cwrap(Mean, null /*void*/, ['number, number, number']);\n}\n\nexport function mean(\n args: {backend: BackendWasm, inputs: MeanInputs, attrs: MeanAttrs}):\n TensorInfo {\n const {backend, inputs, attrs} = args;\n const {axis, keepDims} = attrs;\n const {x} = inputs;\n const xId = backend.dataIdMap.get(x.dataId).id;\n let inputId = xId;\n let input = x;\n\n const {transposed, axes, originalAxes, inputWasTransposed} =\n permuteAxesAndTranspose(x, axis, backend);\n\n let reductionAxes = axes;\n if (inputWasTransposed) {\n const transposedId = backend.dataIdMap.get(transposed.dataId).id;\n if (transposedId !== xId) {\n // transpose was not a no-op. We will need to dispose of this\n // once we are done.\n input = transposed;\n inputId = transposedId;\n reductionAxes = backend_util.getInnerMostAxes(\n reductionAxes.length, input.shape.length);\n }\n }\n\n backend_util.assertAxesAreInnerMostDims(\n 'mean', reductionAxes, input.shape.length);\n const [outShape, reduceShape] =\n backend_util.computeOutAndReduceShapes(input.shape, reductionAxes);\n const reduceSize = util.sizeFromShape(reduceShape);\n let castedInput = input;\n if (input.dtype !== 'float32') {\n castedInput =\n cast({backend, inputs: {x: input}, attrs: {dtype: 'float32'}});\n inputId = backend.dataIdMap.get(castedInput.dataId).id;\n }\n\n const out = backend.makeOutput(outShape, 'float32');\n if (util.sizeFromShape(input.shape) !== 0) {\n const outId = backend.dataIdMap.get(out.dataId).id;\n wasmMean(inputId, reduceSize, outId);\n }\n\n if (inputWasTransposed) {\n // dispose of the transposed tensor.\n backend.disposeData(transposed.dataId);\n }\n\n if (keepDims) {\n // reshape\n const newShape = backend_util.expandShapeToKeepDim(out.shape, originalAxes);\n out.shape = newShape;\n }\n\n if (input.dtype !== 'float32') {\n backend.disposeData(castedInput.dataId);\n }\n\n return out;\n}\n\nexport const meanConfig: KernelConfig = {\n kernelName: Mean,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: mean as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, Min, MinAttrs, MinInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {permuteAxesAndTranspose} from './kernel_utils';\nimport {CppDType} from './types';\n\nlet wasmMin: (xId: number, dtype: number, reduceSize: number, outId: number) =>\n void;\n\nfunction setup(backend: BackendWasm): void {\n wasmMin = backend.wasm.cwrap(Min, null /*void*/, [\n 'number', // x_id\n 'number', // dtype\n 'number', // reduce_size\n 'number', // out_id\n ]);\n}\n\nfunction min(args: {backend: BackendWasm, inputs: MinInputs, attrs: MinAttrs}):\n TensorInfo {\n const {backend, inputs, attrs} = args;\n const {axis, keepDims} = attrs;\n const {x} = inputs;\n const xId = backend.dataIdMap.get(x.dataId).id;\n let inputId = xId;\n let input = x;\n\n const {transposed, axes, originalAxes, inputWasTransposed} =\n permuteAxesAndTranspose(x, axis, backend);\n\n if (inputWasTransposed) {\n const transposedId = backend.dataIdMap.get(transposed.dataId).id;\n if (transposedId !== xId) {\n // transpose was not a no-op. We will need to dispose of this\n // once we are done.\n input = transposed;\n inputId = transposedId;\n }\n }\n\n const inputRank = input.shape.length;\n\n backend_util.assertAxesAreInnerMostDims('min', axes, inputRank);\n const [outShape, reduceShape] =\n backend_util.computeOutAndReduceShapes(input.shape, axes);\n const reduceSize = util.sizeFromShape(reduceShape);\n\n const out = backend.makeOutput(outShape, input.dtype);\n if (util.sizeFromShape(input.shape) !== 0) {\n const outId = backend.dataIdMap.get(out.dataId).id;\n wasmMin(inputId, CppDType[x.dtype], reduceSize, outId);\n }\n\n if (inputWasTransposed) {\n // dispose of the transposed tensor.\n backend.disposeData(transposed.dataId);\n }\n\n if (keepDims) {\n // reshape\n const newShape = backend_util.expandShapeToKeepDim(out.shape, originalAxes);\n out.shape = newShape;\n }\n\n return out;\n}\n\nexport const minConfig: KernelConfig = {\n kernelName: Min,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: min as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, Minimum} from '@tensorflow/tfjs-core';\n\nimport {createBinaryKernelConfig} from './binary_kernel';\nconst supportsFullBroadcast = false;\nexport const minimumConfig: KernelConfig =\n createBinaryKernelConfig(Minimum, supportsFullBroadcast);\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, MirrorPad, MirrorPadAttrs, MirrorPadInputs} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {CppDType} from './types';\n\n// Must match enum in MirrorPad.cc\nenum MirrorPaddingMode {\n reflect = 0,\n symmetric = 1\n}\n\nlet wasmMirrorPad: (\n xId: number, xShapeBytes: Uint8Array, xShapeLength: number, xDtype: number,\n prePaddingsBytes: Uint8Array, postPaddingsBytes: Uint8Array, mode: number,\n outId: number) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmMirrorPad = backend.wasm.cwrap(MirrorPad, null /* void */, [\n 'number', // xId\n 'array', // x.shape\n 'number', // x.shape.length\n 'number', // x.dtype\n 'array', // pre-paddings\n 'array', // post-paddings\n 'number', // mode\n 'number', // outId\n ]);\n}\n\nfunction mirrorPad(args: {\n inputs: MirrorPadInputs,\n backend: BackendWasm,\n attrs: MirrorPadAttrs\n}) {\n const {inputs: {x}, backend, attrs: {paddings, mode}} = args;\n\n const outShape = paddings.map(\n (p, i) => p[0] /* beforePad */ + x.shape[i] + p[1] /* afterPad */);\n const xId = backend.dataIdMap.get(x.dataId).id;\n const out = backend.makeOutput(outShape, x.dtype);\n const outId = backend.dataIdMap.get(out.dataId).id;\n const xShapeBytes = new Uint8Array(new Int32Array(x.shape).buffer);\n\n const prePaddingsFlat = paddings.map(padTuple => padTuple[0]);\n const postPaddingsFlat = paddings.map(padTuple => padTuple[1]);\n const prePaddingsBytes =\n new Uint8Array(new Int32Array(prePaddingsFlat).buffer);\n const postPaddingsBytes =\n new Uint8Array(new Int32Array(postPaddingsFlat).buffer);\n\n wasmMirrorPad(\n xId, xShapeBytes, x.shape.length, CppDType[x.dtype], prePaddingsBytes,\n postPaddingsBytes, MirrorPaddingMode[mode], outId);\n return out;\n}\n\nexport const mirrorPadConfig: KernelConfig = {\n kernelName: MirrorPad,\n backendName: 'wasm',\n kernelFunc: mirrorPad as {} as KernelFunc,\n setupFunc: setup\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Multiply} from '@tensorflow/tfjs-core';\n\nimport {createBinaryKernelConfig} from './binary_kernel';\n\nconst supportsFullBroadcast = true;\nexport const multiplyConfig: KernelConfig =\n createBinaryKernelConfig(Multiply, supportsFullBroadcast);\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, Neg} from '@tensorflow/tfjs-core';\n\nimport {createUnaryKernelConfig} from './unary_kernel';\nexport const negConfig: KernelConfig = createUnaryKernelConfig(Neg);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {BackendWasm} from '../backend_wasm';\n\n// Analogous to `struct Result` in `non_max_suppression_impl.h`.\ninterface Result {\n pSelectedIndices: number;\n selectedSize: number;\n pSelectedScores: number;\n pValidOutputs: number;\n}\n/**\n * Parse the result of the c++ method, which has the shape equivalent to\n * `Result`.\n */\nexport function parseResultStruct(\n backend: BackendWasm, resOffset: number): Result {\n const result = new Int32Array(backend.wasm.HEAPU8.buffer, resOffset, 4);\n const pSelectedIndices = result[0];\n const selectedSize = result[1];\n const pSelectedScores = result[2];\n const pValidOutputs = result[3];\n // Since the result was allocated on the heap, we have to delete it.\n backend.wasm._free(resOffset);\n return {pSelectedIndices, selectedSize, pSelectedScores, pValidOutputs};\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, NonMaxSuppressionV3, NonMaxSuppressionV3Attrs, NonMaxSuppressionV3Inputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {parseResultStruct} from './NonMaxSuppression_util';\n\nlet wasmFunc: (\n boxesId: number, scoresId: number, maxOutputSize: number,\n iouThreshold: number, scoreThreshold: number) => number;\n\nfunction setup(backend: BackendWasm): void {\n wasmFunc = backend.wasm.cwrap(\n NonMaxSuppressionV3,\n 'number', // Result*\n [\n 'number', // boxesId\n 'number', // scoresId\n 'number', // maxOutputSize\n 'number', // iouThreshold\n 'number', // scoreThreshold\n ]);\n}\n\nfunction kernelFunc(args: {\n backend: BackendWasm,\n inputs: NonMaxSuppressionV3Inputs,\n attrs: NonMaxSuppressionV3Attrs\n}): TensorInfo {\n const {backend, inputs, attrs} = args;\n const {iouThreshold, maxOutputSize, scoreThreshold} = attrs;\n const {boxes, scores} = inputs;\n\n const boxesId = backend.dataIdMap.get(boxes.dataId).id;\n const scoresId = backend.dataIdMap.get(scores.dataId).id;\n\n const resOffset =\n wasmFunc(boxesId, scoresId, maxOutputSize, iouThreshold, scoreThreshold);\n\n const {pSelectedIndices, selectedSize, pSelectedScores, pValidOutputs} =\n parseResultStruct(backend, resOffset);\n\n // Since we are not using scores for V3, we have to delete it from the heap.\n backend.wasm._free(pSelectedScores);\n backend.wasm._free(pValidOutputs);\n\n const selectedIndicesTensor =\n backend.makeOutput([selectedSize], 'int32', pSelectedIndices);\n\n return selectedIndicesTensor;\n}\n\nexport const nonMaxSuppressionV3Config: KernelConfig = {\n kernelName: NonMaxSuppressionV3,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: kernelFunc as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, NonMaxSuppressionV4, NonMaxSuppressionV4Attrs, NonMaxSuppressionV4Inputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {parseResultStruct} from './NonMaxSuppression_util';\n\nlet wasmFunc: (\n boxesId: number, scoresId: number, maxOutputSize: number,\n iouThreshold: number, scoreThreshold: number,\n padToMaxOutputSize: boolean) => number;\n\nfunction setup(backend: BackendWasm): void {\n wasmFunc = backend.wasm.cwrap(\n NonMaxSuppressionV4,\n 'number', // Result*\n [\n 'number', // boxesId\n 'number', // scoresId\n 'number', // maxOutputSize\n 'number', // iouThreshold\n 'number', // scoreThreshold\n 'bool', // padToMaxOutputSize\n ]);\n}\n\nfunction nonMaxSuppressionV4(args: {\n backend: BackendWasm,\n inputs: NonMaxSuppressionV4Inputs,\n attrs: NonMaxSuppressionV4Attrs\n}): TensorInfo[] {\n const {backend, inputs, attrs} = args;\n const {iouThreshold, maxOutputSize, scoreThreshold, padToMaxOutputSize} =\n attrs;\n const {boxes, scores} = inputs;\n\n const boxesId = backend.dataIdMap.get(boxes.dataId).id;\n const scoresId = backend.dataIdMap.get(scores.dataId).id;\n\n const resOffset = wasmFunc(\n boxesId, scoresId, maxOutputSize, iouThreshold, scoreThreshold,\n padToMaxOutputSize);\n\n const {pSelectedIndices, selectedSize, pSelectedScores, pValidOutputs} =\n parseResultStruct(backend, resOffset);\n\n // Since we are not using scores for V4, we have to delete it from the heap.\n backend.wasm._free(pSelectedScores);\n\n const selectedIndicesTensor =\n backend.makeOutput([selectedSize], 'int32', pSelectedIndices);\n\n const validOutputsTensor = backend.makeOutput([], 'int32', pValidOutputs);\n\n return [selectedIndicesTensor, validOutputsTensor];\n}\n\nexport const nonMaxSuppressionV4Config: KernelConfig = {\n kernelName: NonMaxSuppressionV4,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: nonMaxSuppressionV4 as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, NonMaxSuppressionV5, NonMaxSuppressionV5Attrs, NonMaxSuppressionV5Inputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {parseResultStruct} from './NonMaxSuppression_util';\n\nlet wasmFunc:\n (boxesId: number, scoresId: number, maxOutputSize: number,\n iouThreshold: number, scoreThreshold: number, softNmsSigma: number) =>\n number;\n\nfunction setup(backend: BackendWasm): void {\n wasmFunc = backend.wasm.cwrap(\n NonMaxSuppressionV5,\n 'number', // Result*\n [\n 'number', // boxesId\n 'number', // scoresId\n 'number', // maxOutputSize\n 'number', // iouThreshold\n 'number', // scoreThreshold\n 'number', // softNmsSigma\n ]);\n}\n\nfunction kernelFunc(args: {\n backend: BackendWasm,\n inputs: NonMaxSuppressionV5Inputs,\n attrs: NonMaxSuppressionV5Attrs\n}): TensorInfo[] {\n const {backend, inputs, attrs} = args;\n const {iouThreshold, maxOutputSize, scoreThreshold, softNmsSigma} = attrs;\n const {boxes, scores} = inputs;\n\n const boxesId = backend.dataIdMap.get(boxes.dataId).id;\n const scoresId = backend.dataIdMap.get(scores.dataId).id;\n\n const resOffset = wasmFunc(\n boxesId, scoresId, maxOutputSize, iouThreshold, scoreThreshold,\n softNmsSigma);\n\n const {pSelectedIndices, selectedSize, pSelectedScores, pValidOutputs} =\n parseResultStruct(backend, resOffset);\n\n // Since we are not using validOutputs for V5, we have to delete it from the\n // heap.\n backend.wasm._free(pValidOutputs);\n\n const selectedIndicesTensor =\n backend.makeOutput([selectedSize], 'int32', pSelectedIndices);\n const selectedScoresTensor =\n backend.makeOutput([selectedSize], 'float32', pSelectedScores);\n\n return [selectedIndicesTensor, selectedScoresTensor];\n}\n\nexport const nonMaxSuppressionV5Config: KernelConfig = {\n kernelName: NonMaxSuppressionV5,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: kernelFunc as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, NotEqual} from '@tensorflow/tfjs-core';\n\nimport {createBinaryKernelConfig} from './binary_kernel';\nconst supportsFullBroadcast = false;\nexport const notEqualConfig: KernelConfig =\n createBinaryKernelConfig(NotEqual, supportsFullBroadcast, 'bool');\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, OneHot, OneHotAttrs, OneHotInputs} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nlet wasmOneHot: (\n indicesId: number, depth: number, onValue: number, offValue: number,\n outId: number) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmOneHot = backend.wasm.cwrap(OneHot, null /* void */, [\n 'number', // indices_id\n 'number', // depth,\n 'number', // onValue\n 'number', // offValue\n 'number' // out_id\n ]);\n}\n\nfunction oneHot(\n args: {inputs: OneHotInputs, attrs: OneHotAttrs, backend: BackendWasm}) {\n const {inputs, backend, attrs} = args;\n const {indices} = inputs;\n const {dtype, depth, onValue, offValue} = attrs;\n\n const out = backend.makeOutput([...indices.shape, depth], dtype);\n const outId = backend.dataIdMap.get(out.dataId).id;\n\n const indicesData = backend.dataIdMap.get(indices.dataId);\n const indicesId = indicesData.id;\n\n wasmOneHot(indicesId, depth, onValue, offValue, outId);\n\n return out;\n}\n\nexport const oneHotConfig: KernelConfig = {\n kernelName: OneHot,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: oneHot as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, OnesLike, OnesLikeInputs} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nfunction onesLike(args: {inputs: OnesLikeInputs, backend: BackendWasm}) {\n const {inputs: {x}, backend} = args;\n const out = backend.makeOutput(x.shape, x.dtype);\n const outVals = backend.typedArrayFromHeap(out);\n outVals.fill(1);\n return out;\n}\n\nexport const onesLikeConfig: KernelConfig = {\n kernelName: OnesLike,\n backendName: 'wasm',\n kernelFunc: onesLike as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Pack, PackAttrs, PackInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\nimport {BackendWasm} from '../backend_wasm';\n\nimport {concat} from './Concat';\nimport {expandDims} from './ExpandDims';\n\nexport function pack(\n args: {inputs: PackInputs, backend: BackendWasm, attrs: PackAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {axis} = attrs;\n\n if (inputs.length === 1) {\n return expandDims(\n {inputs: {input: inputs[0]}, backend, attrs: {dim: axis}});\n }\n\n const shape = inputs[0].shape;\n const dtype = inputs[0].dtype;\n\n inputs.forEach(t => {\n util.assertShapesMatch(\n shape, t.shape,\n 'All tensors passed to stack must have matching shapes');\n util.assert(\n dtype === t.dtype,\n () => 'All tensors passed to stack must have matching dtypes');\n });\n\n const intermediateTensorInfos: TensorInfo[] = [];\n const expandedTensors = inputs.map(t => {\n const expandedT =\n expandDims({inputs: {input: t}, backend, attrs: {dim: axis}});\n intermediateTensorInfos.push(expandedT);\n return expandedT;\n });\n\n const result = concat({inputs: expandedTensors, backend, attrs: {axis}});\n\n intermediateTensorInfos.forEach(t => backend.disposeData(t.dataId));\n\n return result;\n}\n\nexport const packConfig: KernelConfig = {\n kernelName: Pack,\n backendName: 'wasm',\n kernelFunc: pack as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, PadV2, PadV2Attrs, PadV2Inputs, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {fill} from './Fill';\n\nimport {CppDType} from './types';\n\nlet wasmPadV2: (\n xId: number, xShapeBytes: Uint8Array, xShapeLength: number, xDtype: number,\n prePaddingsBytes: Uint8Array, postPaddingsBytes: Uint8Array,\n constantValue: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmPadV2 = backend.wasm.cwrap(PadV2, null /* void */, [\n 'number', // xId\n 'array', // x.shape\n 'number', // x.shape.length\n 'number', // x.dtype\n 'array', // pre-paddings\n 'array', // post-paddings\n 'number', // constantValue\n 'number', // outId\n ]);\n}\n\nfunction pad(\n args: {inputs: PadV2Inputs, backend: BackendWasm, attrs: PadV2Attrs}) {\n const {inputs: {x}, backend, attrs: {paddings, constantValue}} = args;\n\n const outShape = paddings.map(\n (p, i) => p[0] /* beforePad */ + x.shape[i] + p[1] /* afterPad */);\n\n if (util.sizeFromShape(x.shape) === 0) {\n // Short-circuit the computation, since x doesn't have value, only\n // the shape is used to compute output shape to pad.\n return fill({\n backend,\n attrs: {shape: outShape, value: constantValue, dtype: x.dtype}\n });\n }\n\n const xId = backend.dataIdMap.get(x.dataId).id;\n const out = backend.makeOutput(outShape, x.dtype);\n const outTensorData = backend.dataIdMap.get(out.dataId);\n const outId = outTensorData.id;\n\n const xShapeBytes = new Uint8Array(new Int32Array(x.shape).buffer);\n\n const prePaddingsFlat = paddings.map(padTuple => padTuple[0]);\n const postPaddingsFlat = paddings.map(padTuple => padTuple[1]);\n const prePaddingsBytes =\n new Uint8Array(new Int32Array(prePaddingsFlat).buffer);\n const postPaddingsBytes =\n new Uint8Array(new Int32Array(postPaddingsFlat).buffer);\n\n wasmPadV2(\n xId, xShapeBytes, x.shape.length, CppDType[x.dtype], prePaddingsBytes,\n postPaddingsBytes, constantValue, outId);\n return out;\n}\n\nexport const padV2Config: KernelConfig = {\n kernelName: PadV2,\n backendName: 'wasm',\n kernelFunc: pad as {} as KernelFunc,\n setupFunc: setup\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, Pow} from '@tensorflow/tfjs-core';\n\nimport {createBinaryKernelConfig} from './binary_kernel';\nconst supportsFullBroadcast = false;\nexport const powConfig: KernelConfig =\n createBinaryKernelConfig(Pow, supportsFullBroadcast);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Prelu, PreluInputs} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {cast} from './Cast';\n\nlet wasmPrelu: (xId: number, weightsId: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmPrelu = backend.wasm.cwrap(Prelu, null /* void */, [\n 'number', // x_id\n 'number', // weights_id\n 'number' // out_id\n ]);\n}\n\nfunction prelu(args: {inputs: PreluInputs, backend: BackendWasm}) {\n const {inputs, backend} = args;\n const {x, alpha} = inputs;\n const xId = backend.dataIdMap.get(x.dataId).id;\n const weightsId = backend.dataIdMap.get(alpha.dataId).id;\n\n let inputId = xId;\n const input = x;\n let castedInput = input;\n if (input.dtype !== 'float32') {\n castedInput = cast({backend, inputs: {x}, attrs: {dtype: 'float32'}});\n inputId = backend.dataIdMap.get(castedInput.dataId).id;\n }\n\n const out = backend.makeOutput(x.shape, 'float32');\n const outId = backend.dataIdMap.get(out.dataId).id;\n wasmPrelu(inputId, weightsId, outId);\n\n if (input.dtype !== 'float32') {\n backend.disposeData(castedInput.dataId);\n }\n return out;\n}\n\nexport const preluConfig: KernelConfig = {\n kernelName: Prelu,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: prelu as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, Prod, ProdAttrs, ProdInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {permuteAxesAndTranspose} from './kernel_utils';\n\nimport {CppDType} from './types';\n\nlet wasmProd: (\n xId: number, reduceSize: number,\n dtype: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm): void {\n wasmProd = backend.wasm.cwrap(Prod, null /*void*/, [\n 'number',\n 'number',\n 'number',\n 'number'\n ]);\n}\n\nfunction prod(args: {\n backend: BackendWasm,\n inputs: ProdInputs,\n attrs: ProdAttrs\n}): TensorInfo {\n const {backend, inputs, attrs} = args;\n const {axis, keepDims} = attrs;\n const {x} = inputs;\n const xId = backend.dataIdMap.get(x.dataId).id;\n let inputId = xId;\n let input = x;\n\n const {transposed, axes, originalAxes, inputWasTransposed} =\n permuteAxesAndTranspose(x, axis, backend);\n\n let reductionAxes = axes;\n if (inputWasTransposed) {\n const transposedId = backend.dataIdMap.get(transposed.dataId).id;\n if (transposedId !== xId) {\n // transpose was not a no-op. We will need to dispose of this\n // once we are done.\n input = transposed;\n inputId = transposedId;\n reductionAxes = backend_util.getInnerMostAxes(\n reductionAxes.length, input.shape.length);\n }\n }\n\n backend_util.assertAxesAreInnerMostDims(\n 'prod', reductionAxes, input.shape.length);\n const [outShape, reduceShape] =\n backend_util.computeOutAndReduceShapes(input.shape, reductionAxes);\n const reduceSize = util.sizeFromShape(reduceShape);\n\n const out = backend.makeOutput(outShape, input.dtype);\n if (util.sizeFromShape(input.shape) !== 0) {\n const outId = backend.dataIdMap.get(out.dataId).id;\n wasmProd(inputId, reduceSize, CppDType[out.dtype], outId);\n }\n\n if (inputWasTransposed) {\n // dispose of the transposed tensor.\n backend.disposeData(transposed.dataId);\n }\n\n if (keepDims) {\n // reshape\n const newShape = backend_util.expandShapeToKeepDim(out.shape, originalAxes);\n out.shape = newShape;\n }\n\n return out;\n}\n\nexport const prodConfig: KernelConfig = {\n kernelName: Prod,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: prod as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Range, RangeAttrs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\nimport {rangeImplCPU} from '../kernel_utils/shared';\n\nexport const range =\n (args: {backend: BackendWasm, attrs: RangeAttrs}): TensorInfo => {\n const {backend, attrs} = args;\n const {start, stop, step, dtype} = attrs;\n const values = rangeImplCPU(start, stop, step, dtype);\n\n const out = backend.makeOutput([values.length], dtype);\n const outVals = backend.typedArrayFromHeap(out);\n outVals.set(values);\n return out;\n };\n\nexport const rangeConfig: KernelConfig = {\n kernelName: Range,\n backendName: 'wasm',\n kernelFunc: range as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, RealDiv} from '@tensorflow/tfjs-core';\n\nimport {createBinaryKernelConfig} from './binary_kernel';\n\nconst supportsFullBroadcast = true;\nexport const realDivConfig: KernelConfig =\n createBinaryKernelConfig(RealDiv, supportsFullBroadcast);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, Relu} from '@tensorflow/tfjs-core';\n\nimport {createUnaryKernelConfig} from './unary_kernel';\nexport const reluConfig: KernelConfig = createUnaryKernelConfig(Relu);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, Relu6} from '@tensorflow/tfjs-core';\n\nimport {createUnaryKernelConfig} from './unary_kernel';\nexport const relu6Config: KernelConfig = createUnaryKernelConfig(Relu6);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, ResizeBilinear, ResizeBilinearAttrs, ResizeBilinearInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {cast} from './Cast';\n\nlet wasmResizeBilinear: (\n xId: number, batch: number, oldHeight: number, oldWidth: number,\n numChannels: number, newHeight: number, newWidth: number,\n alignCorners: number, halfPixelCenters: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm): void {\n wasmResizeBilinear = backend.wasm.cwrap(ResizeBilinear, null /*void*/, [\n 'number', // xId\n 'number', // batch\n 'number', // oldHeight\n 'number', // oldWidth\n 'number', // numChannels\n 'number', // newHeight\n 'number', // newWidth\n 'number', // alignCorners\n 'number', // halfPixelCenters\n 'number' // outId\n ]);\n}\n\nfunction resizeBilinear(args: {\n backend: BackendWasm,\n inputs: ResizeBilinearInputs,\n attrs: ResizeBilinearAttrs\n}): TensorInfo {\n const {backend, inputs, attrs} = args;\n\n const {images} = inputs;\n const {alignCorners, halfPixelCenters, size} = attrs;\n const [newHeight, newWidth] = size;\n\n const [batch, oldHeight, oldWidth, numChannels] = images.shape;\n const outShape = [batch, newHeight, newWidth, numChannels];\n\n let xData = backend.dataIdMap.get(images.dataId);\n let castedData;\n if (xData.dtype !== 'float32') {\n castedData =\n cast({backend, inputs: {x: images}, attrs: {dtype: 'float32'}});\n xData = backend.dataIdMap.get(castedData.dataId);\n }\n const xId = xData.id;\n\n const out = backend.makeOutput(outShape, 'float32');\n if (util.sizeFromShape(images.shape) === 0) {\n return out;\n }\n const outId = backend.dataIdMap.get(out.dataId).id;\n\n wasmResizeBilinear(\n xId, batch, oldHeight, oldWidth, numChannels, newHeight, newWidth,\n alignCorners ? 1 : 0, halfPixelCenters ? 1 : 0, outId);\n\n if (castedData != null) {\n backend.disposeData(castedData.dataId);\n }\n\n return out;\n}\n\nexport const resizeBilinearConfig: KernelConfig = {\n kernelName: ResizeBilinear,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: resizeBilinear as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the 'License');\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an 'AS IS' BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {\n KernelConfig,\n KernelFunc,\n ResizeNearestNeighbor,\n ResizeNearestNeighborAttrs,\n ResizeNearestNeighborInputs,\n TensorInfo,\n util,\n} from '@tensorflow/tfjs-core';\n\nimport { BackendWasm } from '../backend_wasm';\n\nimport { cast } from './Cast';\n\nlet wasmResizeNearestNeighbor: (\n xId: number,\n batch: number,\n oldHeight: number,\n oldWidth: number,\n numChannels: number,\n newHeight: number,\n newWidth: number,\n alignCorners: number,\n halfPixelCenters: number,\n outId: number\n) => void;\n\nfunction setup(backend: BackendWasm): void {\n wasmResizeNearestNeighbor = backend.wasm.cwrap(\n ResizeNearestNeighbor,\n null /*void*/,\n [\n 'number', // xId\n 'number', // batch\n 'number', // oldHeight\n 'number', // oldWidth\n 'number', // numChannels\n 'number', // newHeight\n 'number', // newWidth\n 'number', // alignCorners\n 'number', // halfPixelCenters\n 'number', // outId\n ]\n );\n}\n\nfunction resizeNearestNeighbor(args: {\n backend: BackendWasm;\n inputs: ResizeNearestNeighborInputs;\n attrs: ResizeNearestNeighborAttrs;\n}): TensorInfo {\n const { backend, inputs, attrs } = args;\n const { images } = inputs;\n const { alignCorners, halfPixelCenters, size } = attrs;\n\n const [newHeight, newWidth] = size;\n\n const [batch, oldHeight, oldWidth, numChannels] = images.shape;\n const outShape = [batch, newHeight, newWidth, numChannels];\n\n const out = backend.makeOutput(outShape, 'float32');\n if (util.sizeFromShape(images.shape) === 0) {\n return out;\n }\n\n let xData = backend.dataIdMap.get(images.dataId);\n let castedData;\n if (xData.dtype !== 'float32') {\n castedData = cast({\n backend,\n inputs: { x: images },\n attrs: { dtype: 'float32' },\n });\n xData = backend.dataIdMap.get(castedData.dataId);\n }\n\n const xId = xData.id;\n const outId = backend.dataIdMap.get(out.dataId).id;\n\n wasmResizeNearestNeighbor(\n xId,\n batch,\n oldHeight,\n oldWidth,\n numChannels,\n newHeight,\n newWidth,\n alignCorners ? 1 : 0,\n halfPixelCenters ? 1 : 0,\n outId\n );\n\n if (castedData != null) {\n backend.disposeData(castedData.dataId);\n }\n\n return out;\n}\n\nexport const resizeNearestNeighborConfig: KernelConfig = {\n kernelName: ResizeNearestNeighbor,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: resizeNearestNeighbor as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Reverse, ReverseAttrs, ReverseInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {identity} from './Identity';\nimport {reshape} from './Reshape';\n\nlet wasmReverse: (\n xId: number, axes: Uint8Array, axesLength: number, outShape: Uint8Array,\n outShapeLength: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmReverse = backend.wasm.cwrap(Reverse, null, [\n 'number', // x_id\n 'array', // axes\n 'number', // axes_length\n 'array', // out_shape\n 'number', // out_shape_length\n 'number' // out_id\n ]);\n}\n\nexport function reverse(\n args: {inputs: ReverseInputs, backend: BackendWasm, attrs: ReverseAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {dims} = attrs;\n\n const axes = util.parseAxisParam(dims, x.shape);\n\n if (x.shape.length === 0) {\n return identity({inputs: {x}, backend});\n }\n\n const out = backend.makeOutput(x.shape, x.dtype);\n const xId = backend.dataIdMap.get(x.dataId).id;\n const outId = backend.dataIdMap.get(out.dataId).id;\n\n const axesBytes = new Uint8Array(new Int32Array(axes).buffer);\n const outShapeBytes = new Uint8Array(new Int32Array(x.shape).buffer);\n\n wasmReverse(\n xId, axesBytes, axes.length, outShapeBytes, x.shape.length, outId);\n\n const reshaped =\n reshape({inputs: {x: out}, attrs: {shape: x.shape}, backend});\n\n backend.disposeData(out.dataId);\n return reshaped;\n}\n\nexport const reverseConfig: KernelConfig = {\n kernelName: Reverse,\n backendName: 'wasm',\n kernelFunc: reverse as {} as KernelFunc,\n setupFunc: setup\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, RotateWithOffset, RotateWithOffsetAttrs, RotateWithOffsetInputs, TensorInfo} from '@tensorflow/tfjs-core';\nimport {backend_util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nlet wasmRotate: (\n xId: number, batch: number, imageHeight: number, imageWidth: number,\n numChannels: number, radians: number, centerX: number, centerY: number,\n fillBytes: Uint8Array, fillLength: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmRotate = backend.wasm.cwrap(RotateWithOffset, null /* void */, [\n 'number', // xId\n 'number', // batch\n 'number', // imageHeight\n 'number', // imageWidth\n 'number', // numChannels\n 'number', // radians\n 'number', // centerX\n 'number', // centerY\n 'array', // fillBytes\n 'number', // fillLength\n 'number', // outId\n ]);\n}\n\nexport function rotateWithOffset(args: {\n inputs: RotateWithOffsetInputs,\n backend: BackendWasm,\n attrs: RotateWithOffsetAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {image} = inputs;\n const {radians, fillValue, center} = attrs;\n\n const out = backend.makeOutput(image.shape, image.dtype);\n const imageId = backend.dataIdMap.get(image.dataId).id;\n const outId = backend.dataIdMap.get(out.dataId).id;\n\n const [batch, imageHeight, imageWidth, numChannels] = image.shape;\n\n const [centerX, centerY] =\n backend_util.getImageCenter(center, imageHeight, imageWidth);\n\n const fillIsBlack = fillValue === 0;\n const fullOpacityValue = 255;\n\n const fillValues = typeof fillValue === 'number' ?\n [fillValue, fillValue, fillValue, fillIsBlack ? 0 : fullOpacityValue] :\n [...fillValue, fullOpacityValue];\n const fillBytes = new Uint8Array(new Int32Array(fillValues).buffer);\n\n wasmRotate(\n imageId, batch, imageHeight, imageWidth, numChannels, radians, centerX,\n centerY, fillBytes, fillValues.length, outId);\n return out;\n}\n\nexport const rotateWithOffsetConfig: KernelConfig = {\n kernelName: RotateWithOffset,\n backendName: 'wasm',\n kernelFunc: rotateWithOffset as {} as KernelFunc,\n setupFunc: setup\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, Round} from '@tensorflow/tfjs-core';\n\nimport {createUnaryKernelConfig} from './unary_kernel';\n\nexport const roundConfig: KernelConfig = createUnaryKernelConfig(Round);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, Rsqrt} from '@tensorflow/tfjs-core';\n\nimport {createUnaryKernelConfig} from './unary_kernel';\nexport const rsqrtConfig: KernelConfig = createUnaryKernelConfig(Rsqrt);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, scatter_util, ScatterNd, ScatterNdAttrs, ScatterNdInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {CppDType} from './types';\n\nlet wasmScatterNd: (\n indicesId: number, updatesId: number, dtype: CppDType, sliceRank: number,\n numUpdates: number, sliceSize: number, strides: Uint8Array,\n outputSize: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm): void {\n wasmScatterNd = backend.wasm.cwrap(ScatterNd, null /*void*/, [\n 'number', // indicesId\n 'number', // updatesId\n 'number', // dtype\n 'number', // sliceRank\n 'number', // numUpdates\n 'number', // sliceSize\n 'array', // strides\n 'number', // outputSize\n 'number' // outId\n ]);\n}\n\nfunction scatterNd(\n args:\n {backend: BackendWasm, inputs: ScatterNdInputs, attrs: ScatterNdAttrs}):\n TensorInfo {\n const {backend, inputs, attrs} = args;\n const {indices, updates} = inputs;\n const {shape} = attrs;\n\n const out = backend.makeOutput(shape, updates.dtype);\n if (util.sizeFromShape(shape) === 0) {\n return out;\n }\n\n const {sliceRank, numUpdates, sliceSize, strides, outputSize} =\n scatter_util.calculateShapes(updates, indices, shape);\n\n const indicesData = backend.dataIdMap.get(indices.dataId);\n const indicesId = indicesData.id;\n\n const updatesData = backend.dataIdMap.get(updates.dataId);\n const updatesId = updatesData.id;\n\n const stridesBytes = new Uint8Array(new Int32Array(strides).buffer);\n\n const outId = backend.dataIdMap.get(out.dataId).id;\n wasmScatterNd(\n indicesId, updatesId, CppDType[updates.dtype], sliceRank, numUpdates,\n sliceSize, stridesBytes, outputSize, outId);\n\n return out;\n}\n\nexport const scatterNdConfig: KernelConfig = {\n kernelName: ScatterNd,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: scatterNd as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Select, SelectInputs, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nlet wasmSelect: (\n conditionId: number, tId: number, eId: number, offset: number,\n outId: number) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmSelect = backend.wasm.cwrap('SelectV2', null, [\n 'number', // conditionId\n 'number', // tId\n 'number', // eId\n 'number', // offset\n 'number', // outId\n ]);\n}\n\nfunction select(args: {inputs: SelectInputs, backend: BackendWasm}) {\n const {inputs, backend} = args;\n const {condition, t, e} = inputs;\n\n const conditionId = backend.dataIdMap.get(condition.dataId).id;\n const tId = backend.dataIdMap.get(t.dataId).id;\n const eId = backend.dataIdMap.get(e.dataId).id;\n const out = backend.makeOutput(t.shape, t.dtype);\n const outId = backend.dataIdMap.get(out.dataId).id;\n\n const cRank = condition.shape.length;\n const tRank = t.shape.length;\n\n const offset = cRank === 0 || cRank > 1 || tRank === 1 ?\n 1 :\n util.sizeFromShape(t.shape.slice(1));\n\n wasmSelect(conditionId, tId, eId, offset, outId);\n return out;\n}\n\nexport const selectConfig: KernelConfig = {\n kernelName: Select,\n backendName: 'wasm',\n kernelFunc: select as {} as KernelFunc,\n setupFunc: setup\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Sigmoid, SigmoidInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nlet wasmFunc: (xId: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm): void {\n wasmFunc = backend.wasm.cwrap(Sigmoid, null /* void */, ['number', 'number']);\n}\n\nfunction sigmoid(args: {backend: BackendWasm, inputs: SigmoidInputs}):\n TensorInfo {\n const {backend, inputs: {x}} = args;\n const xId = backend.dataIdMap.get(x.dataId).id;\n const out = backend.makeOutput(x.shape, x.dtype);\n const outId = backend.dataIdMap.get(out.dataId).id;\n\n // Short-circuit zero-sized tensors.\n if (util.sizeFromShape(out.shape) === 0) {\n return out;\n }\n\n wasmFunc(xId, outId);\n return out;\n}\n\nexport const sigmoidConfig: KernelConfig = {\n kernelName: 'Sigmoid',\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: sigmoid as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, Sin} from '@tensorflow/tfjs-core';\n\nimport {createUnaryKernelConfig} from './unary_kernel';\nexport const sinConfig: KernelConfig = createUnaryKernelConfig(Sin);\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Softmax, SoftmaxAttrs, SoftmaxInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nlet wasmFunc: (xId: number, outId: number, channels: number, batch: number) =>\n void;\n\nfunction setup(backend: BackendWasm): void {\n wasmFunc = backend.wasm.cwrap(Softmax, null /* void */, [\n 'number', // xId\n 'number', // outId\n 'number', // channels\n 'number' // batch\n ]);\n}\n\nfunction softmax(\n args: {backend: BackendWasm, inputs: SoftmaxInputs, attrs: SoftmaxAttrs}):\n TensorInfo {\n const {backend, inputs: {logits}, attrs: {dim}} = args;\n const xId = backend.dataIdMap.get(logits.dataId).id;\n const out = backend.makeOutput(logits.shape, logits.dtype);\n const outId = backend.dataIdMap.get(out.dataId).id;\n\n const channels = logits.shape[dim];\n const batch = util.sizeFromShape(logits.shape) / channels;\n\n // Short-circuit zero-sized tensors.\n if (util.sizeFromShape(out.shape) === 0) {\n return out;\n }\n\n wasmFunc(xId, outId, channels, batch);\n return out;\n}\n\nexport const softmaxConfig: KernelConfig = {\n kernelName: Softmax,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: softmax as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, ReshapeAttrs, ReshapeInputs, SpaceToBatchND, SpaceToBatchNDAttrs, SpaceToBatchNDInputs, TensorInfo, TransposeAttrs, TransposeInputs, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {padV2Config} from './PadV2';\nimport {reshape} from './Reshape';\nimport {transpose} from './Transpose';\n\nfunction spaceToBatchND(args: {\n inputs: SpaceToBatchNDInputs,\n backend: BackendWasm,\n attrs: SpaceToBatchNDAttrs\n}) {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {blockShape, paddings} = attrs;\n\n const prod = util.sizeFromShape(blockShape);\n\n const completePaddings: Array<[number, number]> = [[0, 0]];\n completePaddings.push(...(paddings as Array<[number, number]>));\n\n for (let i = 1 + blockShape.length; i < x.shape.length; ++i) {\n completePaddings.push([0, 0]);\n }\n\n const paddedX = padV2Config.kernelFunc({\n inputs: {x},\n backend,\n attrs: {paddings: completePaddings, constantValue: 0}\n }) as TensorInfo;\n\n const reshapedPaddedShape =\n backend_util.getReshaped(paddedX.shape, blockShape, prod, false);\n\n const permutedReshapedPaddedPermutation = backend_util.getPermuted(\n reshapedPaddedShape.length, blockShape.length, false);\n\n const flattenShape =\n backend_util.getReshapedPermuted(paddedX.shape, blockShape, prod, false);\n\n const reshapeInputs: ReshapeInputs = {x: paddedX};\n const reshapeAttrs: ReshapeAttrs = {shape: reshapedPaddedShape};\n const paddedXReshaped =\n reshape({inputs: reshapeInputs, backend, attrs: reshapeAttrs});\n\n const transposeInputs: TransposeInputs = {x: paddedXReshaped};\n const transposeAttrs:\n TransposeAttrs = {perm: permutedReshapedPaddedPermutation};\n const paddedXT =\n transpose({inputs: transposeInputs, backend, attrs: transposeAttrs});\n\n const resultReshapeInputs: ReshapeInputs = {x: paddedXT};\n const resultReshapeAttrs: ReshapeAttrs = {shape: flattenShape};\n const result = reshape(\n {inputs: resultReshapeInputs, backend, attrs: resultReshapeAttrs});\n\n backend.disposeData(paddedX.dataId);\n backend.disposeData(paddedXReshaped.dataId);\n backend.disposeData(paddedXT.dataId);\n\n return result;\n}\n\nexport const spaceToBatchNDConfig: KernelConfig = {\n kernelName: SpaceToBatchND,\n backendName: 'wasm',\n kernelFunc: spaceToBatchND as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, SparseFillEmptyRows, SparseFillEmptyRowsInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\nimport {slice} from './Slice';\n\nimport {CppDType} from './types';\n\nlet wasmSparseFillEmptyRows: (\n indicesId: number, valuesId: number, valuesDType: number,\n indicesCount: number, denseRows: number, rank: number,\n defaultValueId: number, outputIndicesId: number, outputValuesId: number,\n emptyRowIndicatorId: number, reverseIndexMapId: number,\n exceptionValuesId: number) => number;\n\nexport function setup(backend: BackendWasm): void {\n wasmSparseFillEmptyRows =\n backend.wasm.cwrap('SparseFillEmptyRows', 'number', [\n 'number', // indicesId\n 'number', // valuesId\n 'number', // valuesDType\n 'number', // indicesCount\n 'number', // denseRows\n 'number', // rank\n 'number', // defaultValueId\n 'number', // outputIndicesId\n 'number', // outputValuesId\n 'number', // emptyRowIndicatorId\n 'number', // reverseIndexMapId\n 'number', // exceptionValuesId\n ]);\n}\n\nexport function sparseFillEmptyRows(args: {\n backend: BackendWasm,\n inputs: SparseFillEmptyRowsInputs,\n}): [TensorInfo, TensorInfo, TensorInfo, TensorInfo] {\n const {backend, inputs} = args;\n const {indices, values, denseShape, defaultValue} = inputs;\n\n const indicesCount = indices.shape[0];\n const rank = indices.shape[1];\n const denseRows = backend.readSync(denseShape.dataId)[0] as number;\n\n // Set output size to maximum possible and resize later (actual result\n // might be smaller).\n const maxOutputIndicesShape = [indicesCount + denseRows, rank];\n\n const indicesId = backend.dataIdMap.get(indices.dataId).id;\n const valuesId = backend.dataIdMap.get(values.dataId).id;\n const defaultValueId = backend.dataIdMap.get(defaultValue.dataId).id;\n\n const outputIndices =\n backend.makeOutput(maxOutputIndicesShape, indices.dtype);\n const outputIndicesId = backend.dataIdMap.get(outputIndices.dataId).id;\n\n const outputValues =\n backend.makeOutput(maxOutputIndicesShape.slice(0, 1), values.dtype);\n const outputValuesId = backend.dataIdMap.get(outputValues.dataId).id;\n\n const emptyRowIndicator = backend.makeOutput([denseRows], 'bool');\n const emptyRowIndicatorId =\n backend.dataIdMap.get(emptyRowIndicator.dataId).id;\n\n const reverseIndexMap = backend.makeOutput([indicesCount], indices.dtype);\n const reverseIndexMapId = backend.dataIdMap.get(reverseIndexMap.dataId).id;\n\n const exceptionValues = backend.makeOutput([4], 'int32');\n const exceptionValuesId = backend.dataIdMap.get(exceptionValues.dataId).id;\n\n const outputRows = wasmSparseFillEmptyRows(\n indicesId, valuesId, CppDType[values.dtype], indicesCount, denseRows,\n rank, defaultValueId, outputIndicesId, outputValuesId,\n emptyRowIndicatorId, reverseIndexMapId, exceptionValuesId);\n\n const exceptionValuesArray =\n backend.readSync(exceptionValues.dataId) as Int32Array;\n\n let exceptionMessage: string;\n switch (exceptionValuesArray[0]) {\n case 1: {\n exceptionMessage =\n backend_util.getSparseFillEmptyRowsIndicesDenseShapeMismatch(\n exceptionValuesArray[1]);\n break;\n }\n case 2: {\n exceptionMessage =\n backend_util.getSparseFillEmptyRowsNegativeIndexErrorMessage(\n exceptionValuesArray[1], exceptionValuesArray[2]);\n break;\n }\n case 3:\n exceptionMessage =\n backend_util.getSparseFillEmptyRowsOutOfRangeIndexErrorMessage(\n exceptionValuesArray[1], exceptionValuesArray[2],\n exceptionValuesArray[3]);\n break;\n default:\n exceptionMessage = '';\n }\n\n backend.disposeData(exceptionValues.dataId);\n if (exceptionMessage) {\n backend.disposeData(outputIndices.dataId);\n backend.disposeData(outputValues.dataId);\n backend.disposeData(emptyRowIndicator.dataId);\n backend.disposeData(reverseIndexMap.dataId);\n throw new Error(exceptionMessage);\n }\n\n let resizedIndices = outputIndices;\n let resizedValues = outputValues;\n // Overestimated output size.\n if (outputRows !== maxOutputIndicesShape[0]) {\n resizedIndices = slice({\n inputs: {x: outputIndices},\n attrs: {begin: 0, size: [outputRows, rank]},\n backend\n });\n resizedValues = slice({\n inputs: {x: outputValues},\n attrs: {begin: 0, size: outputRows},\n backend\n });\n backend.disposeData(outputIndices.dataId);\n backend.disposeData(outputValues.dataId);\n }\n\n return [resizedIndices, resizedValues, emptyRowIndicator, reverseIndexMap];\n}\n\nexport const sparseFillEmptyRowsConfig: KernelConfig = {\n kernelName: SparseFillEmptyRows,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: sparseFillEmptyRows as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, SparseReshape, SparseReshapeInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nlet wasmSparseReshape: (\n inputIndicesId: number, inputShapeId: number, newShapeId: number,\n nnz: number, newIndicesId: number, outputShapeId: number,\n exceptionValuesId: number) => void;\n\nfunction setup(backend: BackendWasm): void {\n wasmSparseReshape = backend.wasm.cwrap(SparseReshape, null /*void*/, [\n 'number', // inputIndicesId\n 'number', // inputShapeId\n 'number', // newShapeId\n 'number', // nnz\n 'number', // newIndicesId\n 'number', // outputShapeId\n 'number', // exceptionValuesId\n ]);\n}\n\nfunction sparseReshape(args: {\n backend: BackendWasm,\n inputs: SparseReshapeInputs,\n}): [TensorInfo, TensorInfo] {\n const {backend, inputs} = args;\n const {inputIndices, inputShape, newShape} = inputs;\n\n if (inputIndices.shape.length !== 2) {\n throw new Error(`Input indices should be a matrix but received shape\n ${inputIndices.shape}`);\n }\n if (inputShape.shape.length !== 1) {\n throw new Error(`Input shape should be a vector but received shape\n ${inputShape.shape}`);\n }\n if (newShape.shape.length !== 1) {\n throw new Error(\n `Target shape should be a vector but received shape ${newShape.shape}`);\n }\n\n const inputIndicesId = backend.dataIdMap.get(inputIndices.dataId).id;\n const inputShapeId = backend.dataIdMap.get(inputShape.dataId).id;\n const newShapeId = backend.dataIdMap.get(newShape.dataId).id;\n\n const nnz = inputIndices.shape[0];\n const outputRank = util.sizeFromShape(newShape.shape);\n\n const newIndices = backend.makeOutput([nnz, outputRank], inputIndices.dtype);\n const newIndicesId = backend.dataIdMap.get(newIndices.dataId).id;\n\n const outputShape = backend.makeOutput([outputRank], newShape.dtype);\n const outputShapeId = backend.dataIdMap.get(outputShape.dataId).id;\n\n const exceptionValues = backend.makeOutput([3], 'int32');\n const exceptionValuesId = backend.dataIdMap.get(exceptionValues.dataId).id;\n\n wasmSparseReshape(\n inputIndicesId, inputShapeId, newShapeId, nnz, newIndicesId,\n outputShapeId, exceptionValuesId);\n\n const exceptionValuesArray =\n backend.readSync(exceptionValues.dataId) as Int32Array;\n\n let exceptionMessage: string;\n switch (exceptionValuesArray[0]) {\n case 0: {\n exceptionMessage =\n backend_util.getSparseReshapeMultipleNegativeOneOutputDimErrorMessage(\n exceptionValuesArray[1], exceptionValuesArray[2]);\n break;\n }\n case 1: {\n exceptionMessage =\n backend_util.getSparseReshapeNegativeOutputDimErrorMessage(\n exceptionValuesArray[1], exceptionValuesArray[2]);\n break;\n }\n case 2:\n exceptionMessage =\n backend_util.getSparseReshapeEmptyTensorZeroOutputDimErrorMessage();\n break;\n case 3: {\n const inputShapeValues =\n Array.from(backend.readSync(inputShape.dataId) as Int32Array),\n outputShapeValues =\n Array.from(backend.readSync(outputShape.dataId) as Int32Array);\n exceptionMessage =\n backend_util.getSparseReshapeInputOutputMultipleErrorMessage(\n inputShapeValues, outputShapeValues);\n break;\n }\n case 4: {\n const inputShapeValues =\n Array.from(backend.readSync(inputShape.dataId) as Int32Array),\n outputShapeValues =\n Array.from(backend.readSync(outputShape.dataId) as Int32Array);\n exceptionMessage =\n backend_util.getSparseReshapeInputOutputMismatchErrorMessage(\n inputShapeValues, outputShapeValues);\n break;\n }\n default:\n exceptionMessage = '';\n }\n\n backend.disposeData(exceptionValues.dataId);\n if (exceptionMessage) {\n backend.disposeData(newIndices.dataId);\n backend.disposeData(outputShape.dataId);\n throw new Error(exceptionMessage);\n }\n\n return [newIndices, outputShape];\n}\n\nexport const sparseReshapeConfig: KernelConfig = {\n kernelName: SparseReshape,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: sparseReshape as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, SparseSegmentMeanInputs, SparseSegmentSumInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {CppDType} from './types';\n\nlet wasmSparseSegmentReduction: (\n dataId: number, dtype: number, numRow: number, indicesId: number,\n segmentIdsId: number, outputId: number, exceptionValuesId: number,\n isMean: boolean, defaultValue: number) => void;\n\nexport function setup(backend: BackendWasm): void {\n wasmSparseSegmentReduction =\n backend.wasm.cwrap('SparseSegmentReduction', null /*void*/, [\n 'number', // dataId\n 'number', // dtype\n 'number', // numRow\n 'number', // indicesId\n 'number', // segmentIdsId\n 'number', // outputId\n 'number', // exceptionValuesId,\n 'number', // isMean\n 'number', // defaultValue\n ]);\n}\n\nexport function sparseSegmentReduction(\n args: {\n backend: BackendWasm,\n inputs: SparseSegmentSumInputs|SparseSegmentMeanInputs,\n },\n isMean: boolean): TensorInfo {\n const {backend, inputs} = args;\n const {data, indices, segmentIds} = inputs;\n\n const numIndices = indices.shape[0];\n const segmentIdsBack =\n (backend.readSync(segmentIds.dataId, numIndices - 1, numIndices) as\n Int32Array)[0];\n const lastSegmentIdPlusOne = numIndices > 0 ? segmentIdsBack + 1 : 0;\n const outputRows = lastSegmentIdPlusOne;\n\n if (outputRows < 0) {\n throw (new Error(\n backend_util\n .getSparseSegmentReductionNegativeSegmentIdsErrorMessage()));\n }\n\n const outputShape = data.shape.slice();\n outputShape[0] = outputRows;\n\n const dataId = backend.dataIdMap.get(data.dataId).id;\n const indicesId = backend.dataIdMap.get(indices.dataId).id;\n const segmentIdsId = backend.dataIdMap.get(segmentIds.dataId).id;\n\n const output = backend.makeOutput(outputShape, data.dtype);\n const outputId = backend.dataIdMap.get(output.dataId).id;\n\n const exceptionValues = backend.makeOutput([4], 'int32');\n const exceptionValuesId = backend.dataIdMap.get(exceptionValues.dataId).id;\n\n wasmSparseSegmentReduction(\n dataId, CppDType[data.dtype], data.shape[0], indicesId, segmentIdsId,\n outputId, exceptionValuesId, isMean, 0);\n\n const exceptionValuesArray =\n backend.readSync(exceptionValues.dataId) as Int32Array;\n\n let exceptionMessage: string;\n switch (exceptionValuesArray[0]) {\n case 0: {\n exceptionMessage =\n backend_util\n .getSparseSegmentReductionNegativeSegmentIdsErrorMessage();\n break;\n }\n case 1: {\n exceptionMessage =\n backend_util\n .getSparseSegmentReductionNonIncreasingSegmentIdsErrorMessage();\n break;\n }\n case 2:\n exceptionMessage =\n backend_util.getSparseSegmentReductionSegmentIdOutOfRangeErrorMessage(\n exceptionValuesArray[1], exceptionValuesArray[2]);\n break;\n case 3:\n exceptionMessage =\n backend_util.getSparseSegmentReductionIndicesOutOfRangeErrorMessage(\n exceptionValuesArray[1], exceptionValuesArray[2],\n exceptionValuesArray[3]);\n break;\n default:\n exceptionMessage = '';\n }\n\n backend.disposeData(exceptionValues.dataId);\n if (exceptionMessage) {\n backend.disposeData(output.dataId);\n throw new Error(exceptionMessage);\n }\n\n return output;\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, SparseSegmentMean, SparseSegmentMeanInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {setup, sparseSegmentReduction} from './SparseSegmentReduction';\n\nfunction sparseSegmentMean(args: {\n backend: BackendWasm,\n inputs: SparseSegmentMeanInputs,\n}): TensorInfo {\n return sparseSegmentReduction(args, true);\n}\n\nexport const sparseSegmentMeanConfig: KernelConfig = {\n kernelName: SparseSegmentMean,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: sparseSegmentMean as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, SparseSegmentSum, SparseSegmentSumInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {setup, sparseSegmentReduction} from './SparseSegmentReduction';\n\nfunction sparseSegmentSum(args: {\n backend: BackendWasm,\n inputs: SparseSegmentSumInputs,\n}): TensorInfo {\n return sparseSegmentReduction(args, false);\n}\n\nexport const sparseSegmentSumConfig: KernelConfig = {\n kernelName: SparseSegmentSum,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: sparseSegmentSum as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, SplitV, SplitVAttrs, SplitVInputs, util} from '@tensorflow/tfjs-core';\nimport {backend_util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {slice} from './Slice';\n\nexport function splitV(\n args: {inputs: SplitVInputs, attrs: SplitVAttrs, backend: BackendWasm}) {\n const {inputs, attrs, backend} = args;\n const {x} = inputs;\n const {numOrSizeSplits, axis} = attrs;\n\n const $axis = util.parseAxisParam(axis, x.shape)[0];\n\n const splitSizes = backend_util.prepareSplitSize(x, numOrSizeSplits, $axis);\n const begin = new Array(x.shape.length).fill(0);\n const size = x.shape.slice();\n return splitSizes.map(s => {\n const xSliceSize = [...size];\n xSliceSize[$axis] = s;\n const xSlice =\n slice({inputs: {x}, attrs: {begin, size: xSliceSize}, backend});\n begin[$axis] += s;\n return xSlice;\n });\n}\n\nexport const splitVConfig: KernelConfig = {\n kernelName: SplitV,\n backendName: 'wasm',\n kernelFunc: splitV as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Sqrt} from '@tensorflow/tfjs-core';\n\nimport {createUnaryKernelConfig} from './unary_kernel';\nexport const sqrtConfig: KernelConfig = createUnaryKernelConfig(Sqrt);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, Square} from '@tensorflow/tfjs-core';\n\nimport {createUnaryKernelConfig} from './unary_kernel';\nexport const squareConfig: KernelConfig = createUnaryKernelConfig(Square);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, SquaredDifference} from '@tensorflow/tfjs-core';\nimport {createBinaryKernelConfig} from './binary_kernel';\nconst supportsFullBroadcast = true;\nexport const squaredDifferenceConfig: KernelConfig =\n createBinaryKernelConfig(SquaredDifference, supportsFullBroadcast);\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Step, StepAttrs, StepInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {CppDType} from './types';\n\nlet wasmStep: (xId: number, alpha: number, dtype: number, outId: number) =>\n void;\n\nfunction setup(backend: BackendWasm): void {\n wasmStep = backend.wasm.cwrap(Step, null /*void*/, [\n 'number', // x_id\n 'number', // alpha\n 'number', // dtype\n 'number', // out_id\n ]);\n}\n\nfunction step(\n args: {backend: BackendWasm, inputs: StepInputs, attrs: StepAttrs}):\n TensorInfo {\n const {backend, inputs, attrs} = args;\n const {alpha} = attrs;\n const {x} = inputs;\n const xId = backend.dataIdMap.get(x.dataId).id;\n\n const out = backend.makeOutput(x.shape, x.dtype);\n const outId = backend.dataIdMap.get(out.dataId).id;\n wasmStep(xId, alpha, CppDType[x.dtype], outId);\n return out;\n}\n\nexport const stepConfig: KernelConfig = {\n kernelName: Step,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: step as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, slice_util, StridedSlice, StridedSliceAttrs, StridedSliceInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\nimport {reshape} from './Reshape';\nimport {slice} from './Slice';\n\nlet wasmStridedSlice: (\n xId: number, xStridesBytes: Uint8Array, xRank: number,\n beginBytes: Uint8Array, endBytes: Uint8Array, stridesBytes: Uint8Array,\n outShapeBytes: Uint8Array, outStridesBytes: Uint8Array,\n outShapeLength: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm): void {\n wasmStridedSlice = backend.wasm.cwrap(StridedSlice, null /*void*/, [\n 'number', // xId\n 'array', // xStrides\n 'number', // xRank\n 'array', // beginBytes\n 'array', // endBytes\n 'array', // stridesBytes\n 'array', // outShapeBytes\n 'array', // outStridesBytes\n 'number', // outShapeLength\n 'number', // outId\n ]);\n}\n\nexport function stridedSlice(args: {\n backend: BackendWasm,\n inputs: StridedSliceInputs,\n attrs: StridedSliceAttrs\n}): TensorInfo {\n const {backend, inputs, attrs} = args;\n const {x} = inputs;\n\n const {\n begin,\n end,\n strides,\n beginMask,\n endMask,\n ellipsisMask,\n newAxisMask,\n shrinkAxisMask\n } = attrs;\n\n const {\n finalShapeSparse,\n finalShape,\n isIdentity,\n sliceDim0,\n isSimpleSlice,\n begin: $begin,\n end: $end,\n strides: $strides\n } =\n slice_util.sliceInfo(\n x.shape, begin, end, strides, beginMask, endMask, ellipsisMask,\n newAxisMask, shrinkAxisMask);\n\n let result;\n\n if (isIdentity) {\n // Optimization #1, slice is a no-op plus reshape\n result = reshape({inputs: {x}, backend, attrs: {shape: finalShape}});\n } else if (sliceDim0 || isSimpleSlice) {\n // Optimization #2, slice is memory contiguous (only occurs in dim 0)\n util.assert(\n x.shape.length >= 1,\n () => `Input must have rank at least 1, got: ${x.shape.length}`);\n\n const size = slice_util.computeOutShape($begin, $end, $strides);\n // To tolerate begin[0] > end[0] (a 0-output slice), we min(begin, end).\n const sliced = slice({inputs: {x}, backend, attrs: {begin: $begin, size}});\n result =\n reshape({inputs: {x: sliced}, backend, attrs: {shape: finalShape}});\n backend.disposeData(sliced.dataId);\n } else {\n const out = backend.makeOutput(finalShapeSparse, 'float32');\n\n const xId = backend.dataIdMap.get(x.dataId).id;\n const xStridesBytes =\n new Uint8Array(new Int32Array(util.computeStrides(x.shape)).buffer);\n const beginBytes = new Uint8Array(new Int32Array($begin).buffer);\n const endBytes = new Uint8Array(new Int32Array($end).buffer);\n const stridesBytes = new Uint8Array(new Int32Array($strides).buffer);\n\n const outputShapeBytes =\n new Uint8Array(new Int32Array(finalShapeSparse).buffer);\n const outStridesBytes = new Uint8Array(\n new Int32Array(util.computeStrides(finalShapeSparse)).buffer);\n const outId = backend.dataIdMap.get(out.dataId).id;\n\n wasmStridedSlice(\n xId, xStridesBytes, x.shape.length, beginBytes, endBytes, stridesBytes,\n outputShapeBytes, outStridesBytes, finalShapeSparse.length, outId);\n\n result = reshape({inputs: {x: out}, backend, attrs: {shape: finalShape}});\n\n backend.disposeData(out.dataId);\n }\n\n return result;\n}\n\nexport const stridedSliceConfig: KernelConfig = {\n kernelName: StridedSlice,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: stridedSlice as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, StringNGrams, StringNGramsAttrs, StringNGramsInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\nimport {stringNGramsImplCPU} from '../kernel_utils/shared';\n\nfunction stringNGrams(args: {\n backend: BackendWasm,\n inputs: StringNGramsInputs,\n attrs: StringNGramsAttrs\n}): [TensorInfo, TensorInfo] {\n const {backend, inputs, attrs} = args;\n const {data, dataSplits} = inputs;\n const {\n separator,\n nGramWidths,\n leftPad,\n rightPad,\n padWidth,\n preserveShortSequences,\n } = attrs;\n\n const $data = backend.readSync(data.dataId) as Uint8Array[];\n const $dataSplits = backend.readSync(dataSplits.dataId) as Int32Array;\n\n const [nGrams, nGramsSplits] = stringNGramsImplCPU(\n $data, $dataSplits, separator, nGramWidths, leftPad, rightPad, padWidth,\n preserveShortSequences);\n\n const nGramsOut = backend.makeOutput([nGrams.length], 'string');\n const nGramsOutData = backend.dataIdMap.get(nGramsOut.dataId);\n nGramsOutData.stringBytes = nGrams;\n\n const nGramsSplitsOut = backend.makeOutput(dataSplits.shape, 'int32');\n const nGramsSplitsOutVals = backend.typedArrayFromHeap(nGramsSplitsOut);\n nGramsSplitsOutVals.set(nGramsSplits);\n\n return [nGramsOut, nGramsSplitsOut];\n}\n\nexport const stringNGramsConfig: KernelConfig = {\n kernelName: StringNGrams,\n backendName: 'wasm',\n kernelFunc: stringNGrams as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, StringSplit, StringSplitAttrs, StringSplitInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\nimport {stringSplitImplCPU} from '../kernel_utils/shared';\n\nfunction stringSplit(args: {\n backend: BackendWasm,\n inputs: StringSplitInputs,\n attrs: StringSplitAttrs\n}): [TensorInfo, TensorInfo, TensorInfo] {\n const {backend, inputs, attrs} = args;\n const {input, delimiter} = inputs;\n const {skipEmpty} = attrs;\n\n const inputVals = backend.readSync(input.dataId) as Uint8Array[];\n const delimiterVals = backend.readSync(delimiter.dataId) as Uint8Array[];\n\n const [indices, values, shape] =\n stringSplitImplCPU(inputVals, delimiterVals[0], skipEmpty);\n const outputSize = values.length;\n\n const indicesOut = backend.makeOutput([outputSize, 2], 'int32');\n const indicesOutVals = backend.typedArrayFromHeap(indicesOut);\n indicesOutVals.set(indices);\n\n const valuesOut = backend.makeOutput([outputSize], 'string');\n const valuesOutData = backend.dataIdMap.get(valuesOut.dataId);\n valuesOutData.stringBytes = values;\n\n const shapeOut = backend.makeOutput([2], 'int32');\n const shapeOutVals = backend.typedArrayFromHeap(shapeOut);\n shapeOutVals.set(shape);\n\n return [indicesOut, valuesOut, shapeOut];\n}\n\nexport const stringSplitConfig: KernelConfig = {\n kernelName: StringSplit,\n backendName: 'wasm',\n kernelFunc: stringSplit as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, StringToHashBucketFast, StringToHashBucketFastAttrs, StringToHashBucketFastInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\nimport {stringToHashBucketFastImplCPU} from '../kernel_utils/shared';\n\nfunction stringToHashBucketFast(args: {\n backend: BackendWasm,\n inputs: StringToHashBucketFastInputs,\n attrs: StringToHashBucketFastAttrs\n}): TensorInfo {\n const {backend, inputs, attrs} = args;\n const {input} = inputs;\n const {numBuckets} = attrs;\n\n const inputVals = backend.readSync(input.dataId) as Uint8Array[];\n\n const values = stringToHashBucketFastImplCPU(inputVals, numBuckets);\n\n const out = backend.makeOutput(input.shape, 'int32');\n const outVals = backend.typedArrayFromHeap(out);\n outVals.set(values);\n return out;\n}\n\nexport const stringToHashBucketFastConfig: KernelConfig = {\n kernelName: StringToHashBucketFast,\n backendName: 'wasm',\n kernelFunc: stringToHashBucketFast as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, Sub} from '@tensorflow/tfjs-core';\nimport {createBinaryKernelConfig} from './binary_kernel';\nconst supportsFullBroadcast = true;\nexport const subConfig: KernelConfig =\n createBinaryKernelConfig(Sub, supportsFullBroadcast);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, Sum, SumAttrs, SumInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {permuteAxesAndTranspose} from './kernel_utils';\nimport {CppDType} from './types';\n\nlet wasmSum: (xId: number, reduceSize: number, dtype: number, outId: number) =>\n void;\n\nfunction setup(backend: BackendWasm): void {\n wasmSum = backend.wasm.cwrap(Sum, null /*void*/, [\n 'number', // input_id\n 'number', // reduce_size\n 'number', // dtype\n 'number', // out_id\n ]);\n}\n\nfunction sum(args: {backend: BackendWasm, inputs: SumInputs, attrs: SumAttrs}):\n TensorInfo {\n const {backend, inputs, attrs} = args;\n const {axis, keepDims} = attrs;\n const {x} = inputs;\n const xId = backend.dataIdMap.get(x.dataId).id;\n let inputId = xId;\n let input = x;\n\n const {transposed, axes, originalAxes, inputWasTransposed} =\n permuteAxesAndTranspose(x, axis, backend);\n\n let reductionAxes = axes;\n if (inputWasTransposed) {\n const transposedId = backend.dataIdMap.get(transposed.dataId).id;\n if (transposedId !== xId) {\n // transpose was not a no-op. We will need to dispose of this\n // once we are done.\n input = transposed;\n inputId = transposedId;\n reductionAxes = backend_util.getInnerMostAxes(\n reductionAxes.length, input.shape.length);\n }\n }\n\n backend_util.assertAxesAreInnerMostDims(\n 'sum', reductionAxes, input.shape.length);\n const [outShape, reduceShape] =\n backend_util.computeOutAndReduceShapes(input.shape, reductionAxes);\n const reduceSize = util.sizeFromShape(reduceShape);\n\n const out = backend.makeOutput(outShape, input.dtype);\n if (util.sizeFromShape(input.shape) !== 0) {\n const outId = backend.dataIdMap.get(out.dataId).id;\n wasmSum(inputId, reduceSize, CppDType[out.dtype], outId);\n }\n\n if (inputWasTransposed) {\n // dispose of the transposed tensor.\n backend.disposeData(transposed.dataId);\n }\n\n if (keepDims) {\n // reshape\n const newShape = backend_util.expandShapeToKeepDim(out.shape, originalAxes);\n out.shape = newShape;\n }\n\n return out;\n}\n\nexport const sumConfig: KernelConfig = {\n kernelName: Sum,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: sum as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, Tan} from '@tensorflow/tfjs-core';\n\nimport {createUnaryKernelConfig} from './unary_kernel';\nexport const tanConfig: KernelConfig = createUnaryKernelConfig(Tan);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, Tanh} from '@tensorflow/tfjs-core';\n\nimport {createUnaryKernelConfig} from './unary_kernel';\nexport const tanhConfig: KernelConfig = createUnaryKernelConfig(Tanh);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Tile, TileAttrs, TileInputs} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {CppDType} from './types';\n\nlet wasmTile: (\n xId: number, xShape: Uint8Array, xShapeSize: number, newShape: Uint8Array,\n newShapeSize: number, dtype: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmTile = backend.wasm.cwrap(Tile, null /* void */, [\n 'number', // x_id\n 'array', // x_shape\n 'number', // x_shape.length\n 'array', // new_shape\n 'number', // new_shape.length\n 'number' // out_id\n ]);\n}\n\nfunction tile(\n args: {inputs: TileInputs, backend: BackendWasm, attrs: TileAttrs}) {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const xId = backend.dataIdMap.get(x.dataId).id;\n const {reps} = attrs;\n\n const newShape: number[] = new Array(x.shape.length);\n for (let i = 0; i < newShape.length; i++) {\n newShape[i] = x.shape[i] * reps[i];\n }\n const xShapeBytes = new Uint8Array(new Int32Array(x.shape).buffer);\n const newShapeBytes = new Uint8Array(new Int32Array(newShape).buffer);\n\n const out = backend.makeOutput(newShape, x.dtype);\n const outId = backend.dataIdMap.get(out.dataId).id;\n wasmTile(\n xId, xShapeBytes, x.shape.length, newShapeBytes, newShape.length,\n CppDType[out.dtype], outId);\n return out;\n}\n\nexport const tileConfig: KernelConfig = {\n kernelName: Tile,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: tile as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, TensorInfo, TopK, TopKAttrs, TopKInputs} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\nimport {CppDType} from './types';\n\nlet wasmTopK: (\n xId: number, xShapeBytes: Uint8Array, xShapeLength: number,\n xDtype: CppDType, k: number, sorted: boolean, outValuesId: number,\n outIndicesId: number) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmTopK = backend.wasm.cwrap(TopK, null /* void */, [\n 'number', // xId\n 'array', // x.shape\n 'number', // x.shape.length\n 'number', // x.dtype\n 'number', // k\n 'bool', // sorted\n 'number', // outValuesId\n 'number', // outIndicesId\n ]);\n}\n\nexport const topk:\n (args: {inputs: TopKInputs, backend: BackendWasm, attrs: TopKAttrs}) =>\n TensorInfo[] | TensorInfo = ({inputs, backend, attrs}) => {\n const {x} = inputs;\n const {k, sorted} = attrs;\n\n const xId = backend.dataIdMap.get(x.dataId).id;\n const xShapeBytes = new Uint8Array(new Int32Array(x.shape).buffer);\n const outputShape = x.shape.slice();\n outputShape[outputShape.length - 1] = k;\n const outValues = backend.makeOutput(outputShape, x.dtype);\n const outValuesId = backend.dataIdMap.get(outValues.dataId).id;\n const outIndices = backend.makeOutput(outputShape, 'int32');\n const outIndicesId = backend.dataIdMap.get(outIndices.dataId).id;\n\n wasmTopK(\n xId, xShapeBytes, x.shape.length, CppDType[x.dtype], k, sorted,\n outValuesId, outIndicesId);\n\n return [outValues, outIndices];\n };\n\nexport const topKConfig: KernelConfig = {\n kernelName: TopK,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: topk as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, TensorInfo, Transform, TransformAttrs, TransformInputs, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nlet wasmTransform: (\n imageId: number, transformsId: number, isBatchTransform: boolean,\n batch: number, outHeight: number, outWidth: number, numChannels: number,\n imageWidth: number, imageHeight: number, inputStrides: Uint8Array,\n inputStridesLength: number, outputStrides: Uint8Array,\n outputStridesLength: number, interpolationModeId: number,\n fillModeId: number, fillValue: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm): void {\n wasmTransform = backend.wasm.cwrap(Transform, null /*void*/, [\n 'number', // imageId\n 'number', // transformsId\n 'bool', // isBatchTransform\n 'number', // batch\n 'number', // outHeight\n 'number', // outWidth\n 'number', // numChannels\n 'number', // imageWidth\n 'number', // imageHeight\n 'array', // inputStrides\n 'number', // inputStridesLength\n 'array', // outputStrides\n 'number', // outputStridesLength\n 'number', // interpolationModeId\n 'number', // fillModeId\n 'number', // fillValue\n 'number' // outId\n ]);\n}\n\nfunction transform(\n args:\n {backend: BackendWasm, inputs: TransformInputs, attrs: TransformAttrs}):\n TensorInfo {\n const {backend, inputs, attrs} = args;\n const {image, transforms} = inputs;\n const {interpolation, fillMode, fillValue, outputShape} = attrs;\n\n const [batch, imageHeight, imageWidth, numChannels] = image.shape;\n const [outHeight, outWidth] =\n outputShape != null ? outputShape : [imageHeight, imageWidth];\n const outShape =\n [batch, outHeight, outWidth,\n numChannels] as [number, number, number, number];\n const inputStrides =\n new Uint8Array(new Int32Array(util.computeStrides(image.shape)).buffer);\n\n const outputStrides =\n new Uint8Array(new Int32Array(util.computeStrides(outShape)).buffer);\n\n const out = backend.makeOutput(outShape, image.dtype);\n const outId = backend.dataIdMap.get(out.dataId).id;\n\n const imageData = backend.dataIdMap.get(image.dataId);\n const imageId = imageData.id;\n\n const transformsData = backend.dataIdMap.get(transforms.dataId);\n const transformsId = transformsData.id;\n\n const interpolationModeId = interpolation === 'nearest' ? 1 : 2;\n let fillModeId;\n switch (fillMode) {\n case 'constant':\n fillModeId = 1;\n break;\n case 'reflect':\n fillModeId = 2;\n break;\n case 'wrap':\n fillModeId = 3;\n break;\n case 'nearest':\n fillModeId = 4;\n break;\n default:\n fillModeId = 1;\n break;\n }\n\n wasmTransform(\n imageId, transformsId, (transforms.shape[0] > 1), batch, outHeight,\n outWidth, numChannels, imageWidth, imageHeight, inputStrides,\n image.shape.length - 1, outputStrides, outShape.length - 1,\n interpolationModeId, fillModeId, fillValue, outId);\n\n return out;\n}\n\nexport const transformConfig: KernelConfig = {\n kernelName: Transform,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: transform as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, TensorInfo, Unpack, UnpackAttrs, UnpackInputs} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {slice} from './Slice';\n\nfunction unpack(\n args: {inputs: UnpackInputs, backend: BackendWasm, attrs: UnpackAttrs}):\n TensorInfo[] {\n const {inputs, backend, attrs} = args;\n const {value} = inputs;\n let {axis} = attrs;\n\n if (axis < 0) {\n axis += value.shape.length;\n }\n\n const numOutputs = value.shape[axis];\n const rank = value.shape.length;\n const outShape: number[] = new Array(rank - 1);\n let outIndex = 0;\n for (let i = 0; i < rank; i++) {\n if (i !== axis) {\n outShape[outIndex++] = value.shape[i];\n }\n }\n const outs: TensorInfo[] = new Array(numOutputs);\n const begin = new Array(rank).fill(0);\n const size = value.shape.slice();\n size[axis] = 1;\n for (let i = 0; i < outs.length; i++) {\n begin[axis] = i;\n outs[i] = slice({inputs: {x: value}, attrs: {begin, size}, backend});\n }\n return outs.map(({dataId, dtype}) => ({dataId, dtype, shape: outShape}));\n}\n\nexport const unpackConfig: KernelConfig = {\n kernelName: Unpack,\n backendName: 'wasm',\n kernelFunc: unpack as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, ZerosLike, ZerosLikeInputs} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nfunction zerosLike(args: {inputs: ZerosLikeInputs, backend: BackendWasm}) {\n const {inputs: {x}, backend} = args;\n const out = backend.makeOutput(x.shape, x.dtype);\n const outVals = backend.typedArrayFromHeap(out);\n outVals.fill(0);\n return out;\n}\n\nexport const zerosLikeConfig: KernelConfig = {\n kernelName: ZerosLike,\n backendName: 'wasm',\n kernelFunc: zerosLike as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n// We explicitly import the modular kernels so they get registered in the\n// global registry when we compile the library. A modular build would replace\n// the contents of this file and import only the kernels that are needed.\nimport {KernelConfig, registerKernel} from '@tensorflow/tfjs-core';\n\nimport {_fusedMatMulConfig} from './kernels/_FusedMatMul';\nimport {absConfig} from './kernels/Abs';\nimport {addConfig} from './kernels/Add';\nimport {addNConfig} from './kernels/AddN';\nimport {allConfig} from './kernels/All';\nimport {anyConfig} from './kernels/Any';\nimport {argMaxConfig} from './kernels/ArgMax';\nimport {avgPoolConfig} from './kernels/AvgPool';\nimport {batchMatMulConfig} from './kernels/BatchMatMul';\nimport {batchToSpaceNDConfig} from './kernels/BatchToSpaceND';\nimport {castConfig} from './kernels/Cast';\nimport {ceilConfig} from './kernels/Ceil';\nimport {clipByValueConfig} from './kernels/ClipByValue';\nimport {concatConfig} from './kernels/Concat';\nimport {conv2DConfig} from './kernels/Conv2D';\nimport {conv2DBackpropInputConfig} from './kernels/Conv2DBackpropInput';\nimport {cosConfig} from './kernels/Cos';\nimport {coshConfig} from './kernels/Cosh';\nimport {cropAndResizeConfig} from './kernels/CropAndResize';\nimport {cumprodConfig} from './kernels/Cumprod';\nimport {cumsumConfig} from './kernels/Cumsum';\nimport {depthToSpaceConfig} from './kernels/DepthToSpace';\nimport {depthwiseConv2dNativeConfig} from './kernels/DepthwiseConv2dNative';\nimport {eluConfig} from './kernels/Elu';\nimport {equalConfig} from './kernels/Equal';\nimport {expConfig} from './kernels/Exp';\nimport {expandDimsConfig} from './kernels/ExpandDims';\nimport {fillConfig} from './kernels/Fill';\nimport {flipLeftRightConfig} from './kernels/FlipLeftRight';\nimport {floorConfig} from './kernels/Floor';\nimport {floorDivConfig} from './kernels/FloorDiv';\nimport {fusedBatchNormConfig} from './kernels/FusedBatchNorm';\nimport {fusedConv2DConfig} from './kernels/FusedConv2D';\nimport {fusedDepthwiseConv2DConfig} from './kernels/FusedDepthwiseConv2D';\nimport {gatherNdConfig} from './kernels/GatherNd';\nimport {gatherV2Config} from './kernels/GatherV2';\nimport {greaterConfig} from './kernels/Greater';\nimport {greaterEqualConfig} from './kernels/GreaterEqual';\nimport {identityConfig} from './kernels/Identity';\nimport {leakyReluConfig} from './kernels/LeakyRelu';\nimport {lessConfig} from './kernels/Less';\nimport {lessEqualConfig} from './kernels/LessEqual';\nimport {logConfig} from './kernels/Log';\nimport {logicalAndConfig} from './kernels/LogicalAnd';\nimport {logicalNotConfig} from './kernels/LogicalNot';\nimport {logicalOrConfig} from './kernels/LogicalOr';\nimport {logicalXorConfig} from './kernels/LogicalXor';\nimport {maxConfig} from './kernels/Max';\nimport {maximumConfig} from './kernels/Maximum';\nimport {maxPoolConfig} from './kernels/MaxPool';\nimport {meanConfig} from './kernels/Mean';\nimport {minConfig} from './kernels/Min';\nimport {minimumConfig} from './kernels/Minimum';\nimport {mirrorPadConfig} from './kernels/MirrorPad';\nimport {multiplyConfig} from './kernels/Multiply';\nimport {negConfig} from './kernels/Neg';\nimport {nonMaxSuppressionV3Config} from './kernels/NonMaxSuppressionV3';\nimport {nonMaxSuppressionV4Config} from './kernels/NonMaxSuppressionV4';\nimport {nonMaxSuppressionV5Config} from './kernels/NonMaxSuppressionV5';\nimport {notEqualConfig} from './kernels/NotEqual';\nimport {oneHotConfig} from './kernels/OneHot';\nimport {onesLikeConfig} from './kernels/OnesLike';\nimport {packConfig} from './kernels/Pack';\nimport {padV2Config} from './kernels/PadV2';\nimport {powConfig} from './kernels/Pow';\nimport {preluConfig} from './kernels/Prelu';\nimport {prodConfig} from './kernels/Prod';\nimport {rangeConfig} from './kernels/Range';\nimport {realDivConfig} from './kernels/RealDiv';\nimport {reluConfig} from './kernels/Relu';\nimport {relu6Config} from './kernels/Relu6';\nimport {reshapeConfig} from './kernels/Reshape';\nimport {resizeBilinearConfig} from './kernels/ResizeBilinear';\nimport {resizeNearestNeighborConfig} from './kernels/ResizeNearestNeighbor';\nimport {reverseConfig} from './kernels/Reverse';\nimport {rotateWithOffsetConfig} from './kernels/RotateWithOffset';\nimport {roundConfig} from './kernels/Round';\nimport {rsqrtConfig} from './kernels/Rsqrt';\nimport {scatterNdConfig} from './kernels/ScatterNd';\nimport {selectConfig} from './kernels/Select';\nimport {sigmoidConfig} from './kernels/Sigmoid';\nimport {sinConfig} from './kernels/Sin';\nimport {sliceConfig} from './kernels/Slice';\nimport {softmaxConfig} from './kernels/Softmax';\nimport {spaceToBatchNDConfig} from './kernels/SpaceToBatchND';\nimport {sparseFillEmptyRowsConfig} from './kernels/SparseFillEmptyRows';\nimport {sparseReshapeConfig} from './kernels/SparseReshape';\nimport {sparseSegmentMeanConfig} from './kernels/SparseSegmentMean';\nimport {sparseSegmentSumConfig} from './kernels/SparseSegmentSum';\nimport {splitVConfig} from './kernels/SplitV';\nimport {sqrtConfig} from './kernels/Sqrt';\nimport {squareConfig} from './kernels/Square';\nimport {squaredDifferenceConfig} from './kernels/SquaredDifference';\nimport {stepConfig} from './kernels/Step';\nimport {stridedSliceConfig} from './kernels/StridedSlice';\nimport {stringNGramsConfig} from './kernels/StringNGrams';\nimport {stringSplitConfig} from './kernels/StringSplit';\nimport {stringToHashBucketFastConfig} from './kernels/StringToHashBucketFast';\nimport {subConfig} from './kernels/Sub';\nimport {sumConfig} from './kernels/Sum';\nimport {tanConfig} from './kernels/Tan';\nimport {tanhConfig} from './kernels/Tanh';\nimport {tileConfig} from './kernels/Tile';\nimport {topKConfig} from './kernels/TopK';\nimport {transformConfig} from './kernels/Transform';\nimport {transposeConfig} from './kernels/Transpose';\nimport {unpackConfig} from './kernels/Unpack';\nimport {zerosLikeConfig} from './kernels/ZerosLike';\n\n// List all kernel configs here\nconst kernelConfigs: KernelConfig[] = [\n _fusedMatMulConfig,\n absConfig,\n addConfig,\n addNConfig,\n allConfig,\n anyConfig,\n argMaxConfig,\n avgPoolConfig,\n batchMatMulConfig,\n batchToSpaceNDConfig,\n castConfig,\n ceilConfig,\n clipByValueConfig,\n concatConfig,\n conv2DConfig,\n conv2DBackpropInputConfig,\n cosConfig,\n coshConfig,\n cropAndResizeConfig,\n cumprodConfig,\n cumsumConfig,\n depthToSpaceConfig,\n depthwiseConv2dNativeConfig,\n eluConfig,\n equalConfig,\n expConfig,\n expandDimsConfig,\n fillConfig,\n flipLeftRightConfig,\n floorConfig,\n floorDivConfig,\n fusedBatchNormConfig,\n fusedConv2DConfig,\n fusedDepthwiseConv2DConfig,\n gatherNdConfig,\n gatherV2Config,\n greaterConfig,\n greaterEqualConfig,\n identityConfig,\n leakyReluConfig,\n lessConfig,\n lessEqualConfig,\n logConfig,\n logicalAndConfig,\n logicalNotConfig,\n logicalOrConfig,\n logicalXorConfig,\n maxConfig,\n maximumConfig,\n maxPoolConfig,\n meanConfig,\n minConfig,\n minimumConfig,\n mirrorPadConfig,\n multiplyConfig,\n negConfig,\n nonMaxSuppressionV3Config,\n nonMaxSuppressionV4Config,\n nonMaxSuppressionV5Config,\n notEqualConfig,\n oneHotConfig,\n onesLikeConfig,\n packConfig,\n padV2Config,\n powConfig,\n preluConfig,\n prodConfig,\n rangeConfig,\n realDivConfig,\n reluConfig,\n relu6Config,\n reshapeConfig,\n resizeBilinearConfig,\n resizeNearestNeighborConfig,\n reverseConfig,\n rotateWithOffsetConfig,\n roundConfig,\n rsqrtConfig,\n scatterNdConfig,\n selectConfig,\n sigmoidConfig,\n sinConfig,\n sliceConfig,\n softmaxConfig,\n spaceToBatchNDConfig,\n sparseFillEmptyRowsConfig,\n sparseReshapeConfig,\n sparseSegmentMeanConfig,\n sparseSegmentSumConfig,\n splitVConfig,\n sqrtConfig,\n squareConfig,\n squaredDifferenceConfig,\n stepConfig,\n stridedSliceConfig,\n stringNGramsConfig,\n stringSplitConfig,\n stringToHashBucketFastConfig,\n subConfig,\n sumConfig,\n tanConfig,\n tanhConfig,\n tileConfig,\n topKConfig,\n transformConfig,\n transposeConfig,\n unpackConfig,\n zerosLikeConfig\n];\n\nfor (const kernelConfig of kernelConfigs) {\n registerKernel(kernelConfig);\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env} from '@tensorflow/tfjs-core';\n\nconst ENV = env();\n\n/**\n * True if SIMD is supported.\n */\n// From: https://github.com/GoogleChromeLabs/wasm-feature-detect\nENV.registerFlag('WASM_HAS_SIMD_SUPPORT', async () => {\n try {\n // This typed array passed in to WebAssembly.validate is WebAssembly binary\n // code. In this case it is a small program that contains SIMD\n // instructions.\n return WebAssembly.validate(new Uint8Array([\n 0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3,\n 2, 1, 0, 10, 9, 1, 7, 0, 65, 0, 253, 15, 26, 11\n ]));\n } catch (e) {\n return false;\n }\n});\n\n/**\n * True if threads are supported.\n */\n// From: https://github.com/GoogleChromeLabs/wasm-feature-detect\nENV.registerFlag('WASM_HAS_MULTITHREAD_SUPPORT', async () => {\n // TODO(annxingyuan): Enable node support once this is resolved:\n // https://github.com/tensorflow/tfjs/issues/3830\n if (ENV.get('IS_NODE')) {\n return false;\n }\n\n try {\n // Test for transferability of SABs (needed for Firefox)\n // https://groups.google.com/forum/#!msg/mozilla.dev.platform/IHkBZlHETpA/dwsMNchWEQAJ\n new MessageChannel().port1.postMessage(new SharedArrayBuffer(1));\n // This typed array is a WebAssembly program containing threaded\n // instructions.\n return WebAssembly.validate(new Uint8Array([\n 0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5,\n 4, 1, 3, 1, 1, 10, 11, 1, 9, 0, 65, 0, 254, 16, 2, 0, 26, 11\n ]));\n } catch (e) {\n return false;\n }\n});\n","\nvar WasmBackendModuleThreadedSimd = (() => {\n var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;\n if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;\n return (\nfunction(WasmBackendModuleThreadedSimd) {\n WasmBackendModuleThreadedSimd = WasmBackendModuleThreadedSimd || {};\n\nfunction GROWABLE_HEAP_I8(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAP8}function GROWABLE_HEAP_U8(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAPU8}function GROWABLE_HEAP_I16(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAP16}function GROWABLE_HEAP_I32(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAP32}function GROWABLE_HEAP_U32(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAPU32}function GROWABLE_HEAP_F32(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAPF32}function GROWABLE_HEAP_F64(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAPF64}var Module=typeof WasmBackendModuleThreadedSimd!=\"undefined\"?WasmBackendModuleThreadedSimd:{};var readyPromiseResolve,readyPromiseReject;Module[\"ready\"]=new Promise(function(resolve,reject){readyPromiseResolve=resolve;readyPromiseReject=reject});var beforeListeners;if(typeof process!==\"undefined\"&&process.listeners){beforeListeners={uncaughtException:process.listeners(\"uncaughtException\"),unhandledRejection:process.listeners(\"unhandledRejection\")}}var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram=\"./this.program\";var quit_=(status,toThrow)=>{throw toThrow};var ENVIRONMENT_IS_WEB=typeof window==\"object\";var ENVIRONMENT_IS_WORKER=typeof importScripts==\"function\";var ENVIRONMENT_IS_NODE=typeof process==\"object\"&&typeof process.versions==\"object\"&&typeof process.versions.node==\"string\";var ENVIRONMENT_IS_PTHREAD=Module[\"ENVIRONMENT_IS_PTHREAD\"]||false;var scriptDirectory=\"\";function locateFile(path){if(Module[\"locateFile\"]){return Module[\"locateFile\"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;function logExceptionOnExit(e){if(e instanceof ExitStatus)return;let toLog=e;err(\"exiting due to exception: \"+toLog)}if(ENVIRONMENT_IS_NODE){if(ENVIRONMENT_IS_WORKER){scriptDirectory=require(\"path\").dirname(scriptDirectory)+\"/\"}else{scriptDirectory=__dirname+\"/\"}var fs,nodePath;if(typeof require===\"function\"){fs=require(\"fs\");nodePath=require(\"path\")}read_=(filename,binary)=>{filename=nodePath[\"normalize\"](filename);return fs.readFileSync(filename,binary?undefined:\"utf8\")};readBinary=filename=>{var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}return ret};readAsync=(filename,onload,onerror)=>{filename=nodePath[\"normalize\"](filename);fs.readFile(filename,function(err,data){if(err)onerror(err);else onload(data.buffer)})};if(process[\"argv\"].length>1){thisProgram=process[\"argv\"][1].replace(/\\\\/g,\"/\")}arguments_=process[\"argv\"].slice(2);process[\"on\"](\"uncaughtException\",function(ex){if(!(ex instanceof ExitStatus)){throw ex}});process[\"on\"](\"unhandledRejection\",function(reason){throw reason});quit_=(status,toThrow)=>{if(keepRuntimeAlive()){process[\"exitCode\"]=status;throw toThrow}logExceptionOnExit(toThrow);process[\"exit\"](status)};Module[\"inspect\"]=function(){return\"[Emscripten Module object]\"};let nodeWorkerThreads;try{nodeWorkerThreads=require(\"worker_threads\")}catch(e){console.error('The \"worker_threads\" module is not supported in this node.js build - perhaps a newer version is needed?');throw e}global.Worker=nodeWorkerThreads.Worker}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!=\"undefined\"&&document.currentScript){scriptDirectory=document.currentScript.src}if(typeof _scriptDir !== \"undefined\" && _scriptDir){scriptDirectory=_scriptDir}if(scriptDirectory.indexOf(\"blob:\")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,\"\").lastIndexOf(\"/\")+1)}else{scriptDirectory=\"\"}if(!ENVIRONMENT_IS_NODE){read_=url=>{var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,false);xhr.responseType=\"arraybuffer\";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=(url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,true);xhr.responseType=\"arraybuffer\";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}setWindowTitle=title=>document.title=title}else{}if(ENVIRONMENT_IS_NODE){if(typeof performance==\"undefined\"){global.performance=require(\"perf_hooks\").performance}}var defaultPrint=console.log.bind(console);var defaultPrintErr=console.warn.bind(console);if(ENVIRONMENT_IS_NODE){defaultPrint=str=>fs.writeSync(1,str+\"\\n\");defaultPrintErr=str=>fs.writeSync(2,str+\"\\n\")}var out=Module[\"print\"]||defaultPrint;var err=Module[\"printErr\"]||defaultPrintErr;Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module[\"arguments\"])arguments_=Module[\"arguments\"];if(Module[\"thisProgram\"])thisProgram=Module[\"thisProgram\"];if(Module[\"quit\"])quit_=Module[\"quit\"];var POINTER_SIZE=4;var Atomics_load=Atomics.load;var Atomics_store=Atomics.store;var Atomics_compareExchange=Atomics.compareExchange;var wasmBinary;if(Module[\"wasmBinary\"])wasmBinary=Module[\"wasmBinary\"];var noExitRuntime=Module[\"noExitRuntime\"]||true;if(typeof WebAssembly!=\"object\"){abort(\"no native wasm support detected\")}var wasmMemory;var wasmModule;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort(text)}}var UTF8Decoder=typeof TextDecoder!=\"undefined\"?new TextDecoder(\"utf8\"):undefined;function UTF8ArrayToString(heapOrArray,idx,maxBytesToRead){var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heapOrArray[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.buffer instanceof SharedArrayBuffer?heapOrArray.slice(idx,endPtr):heapOrArray.subarray(idx,endPtr))}var str=\"\";while(idx>10,56320|ch&1023)}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(GROWABLE_HEAP_U8(),ptr,maxBytesToRead):\"\"}function stringToUTF8Array(str,heap,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,GROWABLE_HEAP_U8(),outPtr,maxBytesToWrite)}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;if(ENVIRONMENT_IS_PTHREAD){buffer=Module[\"buffer\"]}function updateGlobalBufferAndViews(buf){buffer=buf;Module[\"HEAP8\"]=HEAP8=new Int8Array(buf);Module[\"HEAP16\"]=HEAP16=new Int16Array(buf);Module[\"HEAP32\"]=HEAP32=new Int32Array(buf);Module[\"HEAPU8\"]=HEAPU8=new Uint8Array(buf);Module[\"HEAPU16\"]=HEAPU16=new Uint16Array(buf);Module[\"HEAPU32\"]=HEAPU32=new Uint32Array(buf);Module[\"HEAPF32\"]=HEAPF32=new Float32Array(buf);Module[\"HEAPF64\"]=HEAPF64=new Float64Array(buf)}var INITIAL_MEMORY=Module[\"INITIAL_MEMORY\"]||16777216;if(ENVIRONMENT_IS_PTHREAD){wasmMemory=Module[\"wasmMemory\"];buffer=Module[\"buffer\"]}else{if(Module[\"wasmMemory\"]){wasmMemory=Module[\"wasmMemory\"]}else{wasmMemory=new WebAssembly.Memory({\"initial\":INITIAL_MEMORY/65536,\"maximum\":2147483648/65536,\"shared\":true});if(!(wasmMemory.buffer instanceof SharedArrayBuffer)){err(\"requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag\");if(ENVIRONMENT_IS_NODE){console.log(\"(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)\")}throw Error(\"bad memory\")}}}if(wasmMemory){buffer=wasmMemory.buffer}INITIAL_MEMORY=buffer.byteLength;updateGlobalBufferAndViews(buffer);var wasmTable;var __ATPRERUN__=[];var __ATINIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function keepRuntimeAlive(){return noExitRuntime}function preRun(){if(Module[\"preRun\"]){if(typeof Module[\"preRun\"]==\"function\")Module[\"preRun\"]=[Module[\"preRun\"]];while(Module[\"preRun\"].length){addOnPreRun(Module[\"preRun\"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;if(ENVIRONMENT_IS_PTHREAD)return;callRuntimeCallbacks(__ATINIT__)}function postRun(){if(ENVIRONMENT_IS_PTHREAD)return;if(Module[\"postRun\"]){if(typeof Module[\"postRun\"]==\"function\")Module[\"postRun\"]=[Module[\"postRun\"]];while(Module[\"postRun\"].length){addOnPostRun(Module[\"postRun\"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnInit(cb){__ATINIT__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function addRunDependency(id){runDependencies++;if(Module[\"monitorRunDependencies\"]){Module[\"monitorRunDependencies\"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module[\"monitorRunDependencies\"]){Module[\"monitorRunDependencies\"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){if(ENVIRONMENT_IS_PTHREAD){postMessage({\"cmd\":\"onAbort\",\"arg\":what})}else{if(Module[\"onAbort\"]){Module[\"onAbort\"](what)}}what=\"Aborted(\"+what+\")\";err(what);ABORT=true;EXITSTATUS=1;what+=\". Build with -sASSERTIONS for more info.\";var e=new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e}var dataURIPrefix=\"data:application/octet-stream;base64,\";function isDataURI(filename){return filename.startsWith(dataURIPrefix)}function isFileURI(filename){return filename.startsWith(\"file://\")}var wasmBinaryFile;wasmBinaryFile=\"tfjs-backend-wasm-threaded-simd.wasm\";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(file){try{if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw\"both async and sync fetching of the wasm failed\"}catch(err){abort(err)}}function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch==\"function\"&&!isFileURI(wasmBinaryFile)){return fetch(wasmBinaryFile,{credentials:\"same-origin\"}).then(function(response){if(!response[\"ok\"]){throw\"failed to load wasm binary file at '\"+wasmBinaryFile+\"'\"}return response[\"arrayBuffer\"]()}).catch(function(){return getBinary(wasmBinaryFile)})}else{if(readAsync){return new Promise(function(resolve,reject){readAsync(wasmBinaryFile,function(response){resolve(new Uint8Array(response))},reject)})}}}return Promise.resolve().then(function(){return getBinary(wasmBinaryFile)})}function createWasm(){var info={\"env\":asmLibraryArg,\"wasi_snapshot_preview1\":asmLibraryArg};function receiveInstance(instance,module){var exports=instance.exports;Module[\"asm\"]=exports;registerTLSInit(Module[\"asm\"][\"_emscripten_tls_init\"]);wasmTable=Module[\"asm\"][\"__indirect_function_table\"];addOnInit(Module[\"asm\"][\"__wasm_call_ctors\"]);wasmModule=module;if(!ENVIRONMENT_IS_PTHREAD){var numWorkersToLoad=PThread.unusedWorkers.length;PThread.unusedWorkers.forEach(function(w){PThread.loadWasmModuleToWorker(w,function(){if(!--numWorkersToLoad)removeRunDependency(\"wasm-instantiate\")})})}}if(!ENVIRONMENT_IS_PTHREAD){addRunDependency(\"wasm-instantiate\")}function receiveInstantiationResult(result){receiveInstance(result[\"instance\"],result[\"module\"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(function(instance){return instance}).then(receiver,function(reason){err(\"failed to asynchronously prepare wasm: \"+reason);abort(reason)})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming==\"function\"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&!ENVIRONMENT_IS_NODE&&typeof fetch==\"function\"){return fetch(wasmBinaryFile,{credentials:\"same-origin\"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiationResult,function(reason){err(\"wasm streaming compile failed: \"+reason);err(\"falling back to ArrayBuffer instantiation\");return instantiateArrayBuffer(receiveInstantiationResult)})})}else{return instantiateArrayBuffer(receiveInstantiationResult)}}if(Module[\"instantiateWasm\"]){try{var exports=Module[\"instantiateWasm\"](info,receiveInstance);return exports}catch(e){err(\"Module.instantiateWasm callback failed with error: \"+e);readyPromiseReject(e)}}instantiateAsync().catch(readyPromiseReject);return{}}var tempDouble;var tempI64;var ASM_CONSTS={};function ExitStatus(status){this.name=\"ExitStatus\";this.message=\"Program terminated with exit(\"+status+\")\";this.status=status}function killThread(pthread_ptr){var worker=PThread.pthreads[pthread_ptr];delete PThread.pthreads[pthread_ptr];worker.terminate();__emscripten_thread_free_data(pthread_ptr);PThread.runningWorkers.splice(PThread.runningWorkers.indexOf(worker),1);worker.pthread_ptr=0}function cancelThread(pthread_ptr){var worker=PThread.pthreads[pthread_ptr];worker.postMessage({\"cmd\":\"cancel\"})}function cleanupThread(pthread_ptr){var worker=PThread.pthreads[pthread_ptr];assert(worker);PThread.returnWorkerToPool(worker)}function spawnThread(threadParams){var worker=PThread.getNewWorker();if(!worker){return 6}PThread.runningWorkers.push(worker);PThread.pthreads[threadParams.pthread_ptr]=worker;worker.pthread_ptr=threadParams.pthread_ptr;var msg={\"cmd\":\"run\",\"start_routine\":threadParams.startRoutine,\"arg\":threadParams.arg,\"pthread_ptr\":threadParams.pthread_ptr};worker.runPthread=()=>{msg.time=performance.now();worker.postMessage(msg,threadParams.transferList)};if(worker.loaded){worker.runPthread();delete worker.runPthread}return 0}var SYSCALLS={varargs:undefined,get:function(){SYSCALLS.varargs+=4;var ret=GROWABLE_HEAP_I32()[SYSCALLS.varargs-4>>2];return ret},getStr:function(ptr){var ret=UTF8ToString(ptr);return ret}};function _proc_exit(code){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(1,1,code);EXITSTATUS=code;if(!keepRuntimeAlive()){PThread.terminateAllThreads();if(Module[\"onExit\"])Module[\"onExit\"](code);ABORT=true}quit_(code,new ExitStatus(code))}function exitJS(status,implicit){EXITSTATUS=status;if(!implicit){if(ENVIRONMENT_IS_PTHREAD){exitOnMainThread(status);throw\"unwind\"}else{}}_proc_exit(status)}var _exit=exitJS;function handleException(e){if(e instanceof ExitStatus||e==\"unwind\"){return EXITSTATUS}quit_(1,e)}var PThread={unusedWorkers:[],runningWorkers:[],tlsInitFunctions:[],pthreads:{},init:function(){if(ENVIRONMENT_IS_PTHREAD){PThread.initWorker()}else{PThread.initMainThread()}},initMainThread:function(){var pthreadPoolSize=8;while(pthreadPoolSize--){PThread.allocateUnusedWorker()}},initWorker:function(){noExitRuntime=false},setExitStatus:function(status){EXITSTATUS=status},terminateAllThreads:function(){for(var worker of Object.values(PThread.pthreads)){PThread.returnWorkerToPool(worker)}for(var worker of PThread.unusedWorkers){worker.terminate()}PThread.unusedWorkers=[]},returnWorkerToPool:function(worker){var pthread_ptr=worker.pthread_ptr;delete PThread.pthreads[pthread_ptr];PThread.unusedWorkers.push(worker);PThread.runningWorkers.splice(PThread.runningWorkers.indexOf(worker),1);worker.pthread_ptr=0;__emscripten_thread_free_data(pthread_ptr)},receiveObjectTransfer:function(data){},threadInitTLS:function(){PThread.tlsInitFunctions.forEach(f=>f())},loadWasmModuleToWorker:function(worker,onFinishedLoading){worker.onmessage=e=>{var d=e[\"data\"];var cmd=d[\"cmd\"];if(worker.pthread_ptr)PThread.currentProxiedOperationCallerThread=worker.pthread_ptr;if(d[\"targetThread\"]&&d[\"targetThread\"]!=_pthread_self()){var targetWorker=PThread.pthreads[d.targetThread];if(targetWorker){targetWorker.postMessage(d,d[\"transferList\"])}else{err('Internal error! Worker sent a message \"'+cmd+'\" to target pthread '+d[\"targetThread\"]+\", but that thread no longer exists!\")}PThread.currentProxiedOperationCallerThread=undefined;return}if(cmd===\"processProxyingQueue\"){executeNotifiedProxyingQueue(d[\"queue\"])}else if(cmd===\"spawnThread\"){spawnThread(d)}else if(cmd===\"cleanupThread\"){cleanupThread(d[\"thread\"])}else if(cmd===\"killThread\"){killThread(d[\"thread\"])}else if(cmd===\"cancelThread\"){cancelThread(d[\"thread\"])}else if(cmd===\"loaded\"){worker.loaded=true;if(onFinishedLoading)onFinishedLoading(worker);if(worker.runPthread){worker.runPthread();delete worker.runPthread}}else if(cmd===\"print\"){out(\"Thread \"+d[\"threadId\"]+\": \"+d[\"text\"])}else if(cmd===\"printErr\"){err(\"Thread \"+d[\"threadId\"]+\": \"+d[\"text\"])}else if(cmd===\"alert\"){alert(\"Thread \"+d[\"threadId\"]+\": \"+d[\"text\"])}else if(d.target===\"setimmediate\"){worker.postMessage(d)}else if(cmd===\"onAbort\"){if(Module[\"onAbort\"]){Module[\"onAbort\"](d[\"arg\"])}}else if(cmd){err(\"worker sent an unknown command \"+cmd)}PThread.currentProxiedOperationCallerThread=undefined};worker.onerror=e=>{var message=\"worker sent an error!\";err(message+\" \"+e.filename+\":\"+e.lineno+\": \"+e.message);throw e};if(ENVIRONMENT_IS_NODE){worker.on(\"message\",function(data){worker.onmessage({data:data})});worker.on(\"error\",function(e){worker.onerror(e)});worker.on(\"detachedExit\",function(){})}worker.postMessage({\"cmd\":\"load\",\"urlOrBlob\":Module[\"mainScriptUrlOrBlob\"]||_scriptDir,\"wasmMemory\":wasmMemory,\"wasmModule\":wasmModule})},allocateUnusedWorker:function(){var pthreadMainJs=locateFile(\"tfjs-backend-wasm-threaded-simd.worker.js\");PThread.unusedWorkers.push(new Worker(pthreadMainJs))},getNewWorker:function(){if(PThread.unusedWorkers.length==0){PThread.allocateUnusedWorker();PThread.loadWasmModuleToWorker(PThread.unusedWorkers[0])}return PThread.unusedWorkers.pop()}};Module[\"PThread\"]=PThread;function callRuntimeCallbacks(callbacks){while(callbacks.length>0){callbacks.shift()(Module)}}function withStackSave(f){var stack=stackSave();var ret=f();stackRestore(stack);return ret}function demangle(func){return func}function demangleAll(text){var regex=/\\b_Z[\\w\\d_]+/g;return text.replace(regex,function(x){var y=demangle(x);return x===y?x:y+\" [\"+x+\"]\"})}function establishStackSpace(){var pthread_ptr=_pthread_self();var stackTop=GROWABLE_HEAP_I32()[pthread_ptr+44>>2];var stackSize=GROWABLE_HEAP_I32()[pthread_ptr+48>>2];var stackMax=stackTop-stackSize;_emscripten_stack_set_limits(stackTop,stackMax);stackRestore(stackTop)}Module[\"establishStackSpace\"]=establishStackSpace;function exitOnMainThread(returnCode){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(2,0,returnCode);try{_exit(returnCode)}catch(e){handleException(e)}}var wasmTableMirror=[];function getWasmTableEntry(funcPtr){var func=wasmTableMirror[funcPtr];if(!func){if(funcPtr>=wasmTableMirror.length)wasmTableMirror.length=funcPtr+1;wasmTableMirror[funcPtr]=func=wasmTable.get(funcPtr)}return func}function invokeEntryPoint(ptr,arg){var result=getWasmTableEntry(ptr)(arg);if(keepRuntimeAlive()){PThread.setExitStatus(result)}else{__emscripten_thread_exit(result)}}Module[\"invokeEntryPoint\"]=invokeEntryPoint;function jsStackTrace(){var error=new Error;if(!error.stack){try{throw new Error}catch(e){error=e}if(!error.stack){return\"(no stack trace available)\"}}return error.stack.toString()}function registerTLSInit(tlsInitFunc){PThread.tlsInitFunctions.push(tlsInitFunc)}function writeArrayToMemory(array,buffer){GROWABLE_HEAP_I8().set(array,buffer)}function ___emscripten_init_main_thread_js(tb){__emscripten_thread_init(tb,!ENVIRONMENT_IS_WORKER,1,!ENVIRONMENT_IS_WEB);PThread.threadInitTLS()}function ___emscripten_thread_cleanup(thread){if(!ENVIRONMENT_IS_PTHREAD)cleanupThread(thread);else postMessage({\"cmd\":\"cleanupThread\",\"thread\":thread})}function pthreadCreateProxied(pthread_ptr,attr,startRoutine,arg){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(3,1,pthread_ptr,attr,startRoutine,arg);return ___pthread_create_js(pthread_ptr,attr,startRoutine,arg)}function ___pthread_create_js(pthread_ptr,attr,startRoutine,arg){if(typeof SharedArrayBuffer==\"undefined\"){err(\"Current environment does not support SharedArrayBuffer, pthreads are not available!\");return 6}var transferList=[];var error=0;if(ENVIRONMENT_IS_PTHREAD&&(transferList.length===0||error)){return pthreadCreateProxied(pthread_ptr,attr,startRoutine,arg)}if(error)return error;var threadParams={startRoutine:startRoutine,pthread_ptr:pthread_ptr,arg:arg,transferList:transferList};if(ENVIRONMENT_IS_PTHREAD){threadParams.cmd=\"spawnThread\";postMessage(threadParams,transferList);return 0}return spawnThread(threadParams)}function __emscripten_default_pthread_stack_size(){return 2097152}var nowIsMonotonic=true;function __emscripten_get_now_is_monotonic(){return nowIsMonotonic}function executeNotifiedProxyingQueue(queue){Atomics.store(GROWABLE_HEAP_I32(),queue>>2,1);if(_pthread_self()){__emscripten_proxy_execute_task_queue(queue)}Atomics.compareExchange(GROWABLE_HEAP_I32(),queue>>2,1,0)}Module[\"executeNotifiedProxyingQueue\"]=executeNotifiedProxyingQueue;function __emscripten_notify_task_queue(targetThreadId,currThreadId,mainThreadId,queue){if(targetThreadId==currThreadId){setTimeout(()=>executeNotifiedProxyingQueue(queue))}else if(ENVIRONMENT_IS_PTHREAD){postMessage({\"targetThread\":targetThreadId,\"cmd\":\"processProxyingQueue\",\"queue\":queue})}else{var worker=PThread.pthreads[targetThreadId];if(!worker){return}worker.postMessage({\"cmd\":\"processProxyingQueue\",\"queue\":queue})}return 1}function __emscripten_set_offscreencanvas_size(target,width,height){return-1}function _abort(){abort(\"\")}function warnOnce(text){if(!warnOnce.shown)warnOnce.shown={};if(!warnOnce.shown[text]){warnOnce.shown[text]=1;if(ENVIRONMENT_IS_NODE)text=\"warning: \"+text;err(text)}}function _emscripten_check_blocking_allowed(){if(ENVIRONMENT_IS_NODE)return;if(ENVIRONMENT_IS_WORKER)return;warnOnce(\"Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread\")}function _emscripten_date_now(){return Date.now()}function getHeapMax(){return 2147483648}function _emscripten_get_heap_max(){return getHeapMax()}var _emscripten_get_now;if(ENVIRONMENT_IS_NODE){_emscripten_get_now=()=>{var t=process[\"hrtime\"]();return t[0]*1e3+t[1]/1e6}}else if(ENVIRONMENT_IS_PTHREAD){_emscripten_get_now=()=>performance.now()-Module[\"__performance_now_clock_drift\"]}else _emscripten_get_now=()=>performance.now();function _emscripten_memcpy_big(dest,src,num){GROWABLE_HEAP_U8().copyWithin(dest,src,src+num)}function _emscripten_num_logical_cores(){if(ENVIRONMENT_IS_NODE)return require(\"os\").cpus().length;return navigator[\"hardwareConcurrency\"]}function _emscripten_proxy_to_main_thread_js(index,sync){var numCallArgs=arguments.length-2;var outerArgs=arguments;return withStackSave(()=>{var serializedNumCallArgs=numCallArgs;var args=stackAlloc(serializedNumCallArgs*8);var b=args>>3;for(var i=0;i>3;for(var i=0;i>>16);updateGlobalBufferAndViews(wasmMemory.buffer);return 1}catch(e){}}function _emscripten_resize_heap(requestedSize){var oldSize=GROWABLE_HEAP_U8().length;requestedSize=requestedSize>>>0;if(requestedSize<=oldSize){return false}var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}let alignUp=(x,multiple)=>x+(multiple-x%multiple)%multiple;for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignUp(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=emscripten_realloc_buffer(newSize);if(replacement){return true}}return false}function _emscripten_unwind_to_js_event_loop(){throw\"unwind\"}function _fd_close(fd){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(4,1,fd);return 52}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(5,1,fd,offset_low,offset_high,whence,newOffset);return 70}var printCharBuffers=[null,[],[]];function printChar(stream,curr){var buffer=printCharBuffers[stream];if(curr===0||curr===10){(stream===1?out:err)(UTF8ArrayToString(buffer,0));buffer.length=0}else{buffer.push(curr)}}function _fd_write(fd,iov,iovcnt,pnum){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(6,1,fd,iov,iovcnt,pnum);var num=0;for(var i=0;i>2];var len=GROWABLE_HEAP_U32()[iov+4>>2];iov+=8;for(var j=0;j>2]=num;return 0}function getCFunc(ident){var func=Module[\"_\"+ident];return func}function ccall(ident,returnType,argTypes,args,opts){var toC={\"string\":str=>{var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=stackAlloc(len);stringToUTF8(str,ret,len)}return ret},\"array\":arr=>{var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType===\"string\"){return UTF8ToString(ret)}if(returnType===\"boolean\")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;itype===\"number\"||type===\"boolean\");var numericRet=returnType!==\"string\";if(numericRet&&numericArgs&&!opts){return getCFunc(ident)}return function(){return ccall(ident,returnType,argTypes,arguments,opts)}}PThread.init();var proxiedFunctionTable=[null,_proc_exit,exitOnMainThread,pthreadCreateProxied,_fd_close,_fd_seek,_fd_write];var asmLibraryArg={\"__emscripten_init_main_thread_js\":___emscripten_init_main_thread_js,\"__emscripten_thread_cleanup\":___emscripten_thread_cleanup,\"__pthread_create_js\":___pthread_create_js,\"_emscripten_default_pthread_stack_size\":__emscripten_default_pthread_stack_size,\"_emscripten_get_now_is_monotonic\":__emscripten_get_now_is_monotonic,\"_emscripten_notify_task_queue\":__emscripten_notify_task_queue,\"_emscripten_set_offscreencanvas_size\":__emscripten_set_offscreencanvas_size,\"abort\":_abort,\"emscripten_check_blocking_allowed\":_emscripten_check_blocking_allowed,\"emscripten_date_now\":_emscripten_date_now,\"emscripten_get_heap_max\":_emscripten_get_heap_max,\"emscripten_get_now\":_emscripten_get_now,\"emscripten_memcpy_big\":_emscripten_memcpy_big,\"emscripten_num_logical_cores\":_emscripten_num_logical_cores,\"emscripten_receive_on_main_thread_js\":_emscripten_receive_on_main_thread_js,\"emscripten_resize_heap\":_emscripten_resize_heap,\"emscripten_unwind_to_js_event_loop\":_emscripten_unwind_to_js_event_loop,\"exit\":_exit,\"fd_close\":_fd_close,\"fd_seek\":_fd_seek,\"fd_write\":_fd_write,\"memory\":wasmMemory||Module[\"wasmMemory\"]};var asm=createWasm();var ___wasm_call_ctors=Module[\"___wasm_call_ctors\"]=function(){return(___wasm_call_ctors=Module[\"___wasm_call_ctors\"]=Module[\"asm\"][\"__wasm_call_ctors\"]).apply(null,arguments)};var _init=Module[\"_init\"]=function(){return(_init=Module[\"_init\"]=Module[\"asm\"][\"init\"]).apply(null,arguments)};var _init_with_threads_count=Module[\"_init_with_threads_count\"]=function(){return(_init_with_threads_count=Module[\"_init_with_threads_count\"]=Module[\"asm\"][\"init_with_threads_count\"]).apply(null,arguments)};var _get_threads_count=Module[\"_get_threads_count\"]=function(){return(_get_threads_count=Module[\"_get_threads_count\"]=Module[\"asm\"][\"get_threads_count\"]).apply(null,arguments)};var _register_tensor=Module[\"_register_tensor\"]=function(){return(_register_tensor=Module[\"_register_tensor\"]=Module[\"asm\"][\"register_tensor\"]).apply(null,arguments)};var _dispose_data=Module[\"_dispose_data\"]=function(){return(_dispose_data=Module[\"_dispose_data\"]=Module[\"asm\"][\"dispose_data\"]).apply(null,arguments)};var _dispose=Module[\"_dispose\"]=function(){return(_dispose=Module[\"_dispose\"]=Module[\"asm\"][\"dispose\"]).apply(null,arguments)};var _Abs=Module[\"_Abs\"]=function(){return(_Abs=Module[\"_Abs\"]=Module[\"asm\"][\"Abs\"]).apply(null,arguments)};var _Add=Module[\"_Add\"]=function(){return(_Add=Module[\"_Add\"]=Module[\"asm\"][\"Add\"]).apply(null,arguments)};var _AddN=Module[\"_AddN\"]=function(){return(_AddN=Module[\"_AddN\"]=Module[\"asm\"][\"AddN\"]).apply(null,arguments)};var _All=Module[\"_All\"]=function(){return(_All=Module[\"_All\"]=Module[\"asm\"][\"All\"]).apply(null,arguments)};var _Any=Module[\"_Any\"]=function(){return(_Any=Module[\"_Any\"]=Module[\"asm\"][\"Any\"]).apply(null,arguments)};var _ArgMax=Module[\"_ArgMax\"]=function(){return(_ArgMax=Module[\"_ArgMax\"]=Module[\"asm\"][\"ArgMax\"]).apply(null,arguments)};var _AvgPool=Module[\"_AvgPool\"]=function(){return(_AvgPool=Module[\"_AvgPool\"]=Module[\"asm\"][\"AvgPool\"]).apply(null,arguments)};var _BatchMatMul=Module[\"_BatchMatMul\"]=function(){return(_BatchMatMul=Module[\"_BatchMatMul\"]=Module[\"asm\"][\"BatchMatMul\"]).apply(null,arguments)};var _Ceil=Module[\"_Ceil\"]=function(){return(_Ceil=Module[\"_Ceil\"]=Module[\"asm\"][\"Ceil\"]).apply(null,arguments)};var _ClipByValue=Module[\"_ClipByValue\"]=function(){return(_ClipByValue=Module[\"_ClipByValue\"]=Module[\"asm\"][\"ClipByValue\"]).apply(null,arguments)};var _Conv2D=Module[\"_Conv2D\"]=function(){return(_Conv2D=Module[\"_Conv2D\"]=Module[\"asm\"][\"Conv2D\"]).apply(null,arguments)};var _Conv2DBackpropInput=Module[\"_Conv2DBackpropInput\"]=function(){return(_Conv2DBackpropInput=Module[\"_Conv2DBackpropInput\"]=Module[\"asm\"][\"Conv2DBackpropInput\"]).apply(null,arguments)};var _Cos=Module[\"_Cos\"]=function(){return(_Cos=Module[\"_Cos\"]=Module[\"asm\"][\"Cos\"]).apply(null,arguments)};var _Cosh=Module[\"_Cosh\"]=function(){return(_Cosh=Module[\"_Cosh\"]=Module[\"asm\"][\"Cosh\"]).apply(null,arguments)};var _CropAndResize=Module[\"_CropAndResize\"]=function(){return(_CropAndResize=Module[\"_CropAndResize\"]=Module[\"asm\"][\"CropAndResize\"]).apply(null,arguments)};var _Cumprod=Module[\"_Cumprod\"]=function(){return(_Cumprod=Module[\"_Cumprod\"]=Module[\"asm\"][\"Cumprod\"]).apply(null,arguments)};var _Cumsum=Module[\"_Cumsum\"]=function(){return(_Cumsum=Module[\"_Cumsum\"]=Module[\"asm\"][\"Cumsum\"]).apply(null,arguments)};var _DepthToSpace=Module[\"_DepthToSpace\"]=function(){return(_DepthToSpace=Module[\"_DepthToSpace\"]=Module[\"asm\"][\"DepthToSpace\"]).apply(null,arguments)};var _DepthwiseConv2dNative=Module[\"_DepthwiseConv2dNative\"]=function(){return(_DepthwiseConv2dNative=Module[\"_DepthwiseConv2dNative\"]=Module[\"asm\"][\"DepthwiseConv2dNative\"]).apply(null,arguments)};var _Elu=Module[\"_Elu\"]=function(){return(_Elu=Module[\"_Elu\"]=Module[\"asm\"][\"Elu\"]).apply(null,arguments)};var _Equal=Module[\"_Equal\"]=function(){return(_Equal=Module[\"_Equal\"]=Module[\"asm\"][\"Equal\"]).apply(null,arguments)};var _Exp=Module[\"_Exp\"]=function(){return(_Exp=Module[\"_Exp\"]=Module[\"asm\"][\"Exp\"]).apply(null,arguments)};var _FlipLeftRight=Module[\"_FlipLeftRight\"]=function(){return(_FlipLeftRight=Module[\"_FlipLeftRight\"]=Module[\"asm\"][\"FlipLeftRight\"]).apply(null,arguments)};var _Floor=Module[\"_Floor\"]=function(){return(_Floor=Module[\"_Floor\"]=Module[\"asm\"][\"Floor\"]).apply(null,arguments)};var _FloorDiv=Module[\"_FloorDiv\"]=function(){return(_FloorDiv=Module[\"_FloorDiv\"]=Module[\"asm\"][\"FloorDiv\"]).apply(null,arguments)};var _FusedBatchNorm=Module[\"_FusedBatchNorm\"]=function(){return(_FusedBatchNorm=Module[\"_FusedBatchNorm\"]=Module[\"asm\"][\"FusedBatchNorm\"]).apply(null,arguments)};var _FusedConv2D=Module[\"_FusedConv2D\"]=function(){return(_FusedConv2D=Module[\"_FusedConv2D\"]=Module[\"asm\"][\"FusedConv2D\"]).apply(null,arguments)};var _FusedDepthwiseConv2D=Module[\"_FusedDepthwiseConv2D\"]=function(){return(_FusedDepthwiseConv2D=Module[\"_FusedDepthwiseConv2D\"]=Module[\"asm\"][\"FusedDepthwiseConv2D\"]).apply(null,arguments)};var _Gather=Module[\"_Gather\"]=function(){return(_Gather=Module[\"_Gather\"]=Module[\"asm\"][\"Gather\"]).apply(null,arguments)};var _GatherNd=Module[\"_GatherNd\"]=function(){return(_GatherNd=Module[\"_GatherNd\"]=Module[\"asm\"][\"GatherNd\"]).apply(null,arguments)};var _Greater=Module[\"_Greater\"]=function(){return(_Greater=Module[\"_Greater\"]=Module[\"asm\"][\"Greater\"]).apply(null,arguments)};var _GreaterEqual=Module[\"_GreaterEqual\"]=function(){return(_GreaterEqual=Module[\"_GreaterEqual\"]=Module[\"asm\"][\"GreaterEqual\"]).apply(null,arguments)};var _LeakyRelu=Module[\"_LeakyRelu\"]=function(){return(_LeakyRelu=Module[\"_LeakyRelu\"]=Module[\"asm\"][\"LeakyRelu\"]).apply(null,arguments)};var _Less=Module[\"_Less\"]=function(){return(_Less=Module[\"_Less\"]=Module[\"asm\"][\"Less\"]).apply(null,arguments)};var _LessEqual=Module[\"_LessEqual\"]=function(){return(_LessEqual=Module[\"_LessEqual\"]=Module[\"asm\"][\"LessEqual\"]).apply(null,arguments)};var _Log=Module[\"_Log\"]=function(){return(_Log=Module[\"_Log\"]=Module[\"asm\"][\"Log\"]).apply(null,arguments)};var _LogicalAnd=Module[\"_LogicalAnd\"]=function(){return(_LogicalAnd=Module[\"_LogicalAnd\"]=Module[\"asm\"][\"LogicalAnd\"]).apply(null,arguments)};var _LogicalNot=Module[\"_LogicalNot\"]=function(){return(_LogicalNot=Module[\"_LogicalNot\"]=Module[\"asm\"][\"LogicalNot\"]).apply(null,arguments)};var _LogicalOr=Module[\"_LogicalOr\"]=function(){return(_LogicalOr=Module[\"_LogicalOr\"]=Module[\"asm\"][\"LogicalOr\"]).apply(null,arguments)};var _LogicalXor=Module[\"_LogicalXor\"]=function(){return(_LogicalXor=Module[\"_LogicalXor\"]=Module[\"asm\"][\"LogicalXor\"]).apply(null,arguments)};var _Max=Module[\"_Max\"]=function(){return(_Max=Module[\"_Max\"]=Module[\"asm\"][\"Max\"]).apply(null,arguments)};var _MaxPool=Module[\"_MaxPool\"]=function(){return(_MaxPool=Module[\"_MaxPool\"]=Module[\"asm\"][\"MaxPool\"]).apply(null,arguments)};var _Maximum=Module[\"_Maximum\"]=function(){return(_Maximum=Module[\"_Maximum\"]=Module[\"asm\"][\"Maximum\"]).apply(null,arguments)};var _Mean=Module[\"_Mean\"]=function(){return(_Mean=Module[\"_Mean\"]=Module[\"asm\"][\"Mean\"]).apply(null,arguments)};var _Min=Module[\"_Min\"]=function(){return(_Min=Module[\"_Min\"]=Module[\"asm\"][\"Min\"]).apply(null,arguments)};var _Minimum=Module[\"_Minimum\"]=function(){return(_Minimum=Module[\"_Minimum\"]=Module[\"asm\"][\"Minimum\"]).apply(null,arguments)};var _MirrorPad=Module[\"_MirrorPad\"]=function(){return(_MirrorPad=Module[\"_MirrorPad\"]=Module[\"asm\"][\"MirrorPad\"]).apply(null,arguments)};var _Multiply=Module[\"_Multiply\"]=function(){return(_Multiply=Module[\"_Multiply\"]=Module[\"asm\"][\"Multiply\"]).apply(null,arguments)};var _Neg=Module[\"_Neg\"]=function(){return(_Neg=Module[\"_Neg\"]=Module[\"asm\"][\"Neg\"]).apply(null,arguments)};var _NonMaxSuppressionV3=Module[\"_NonMaxSuppressionV3\"]=function(){return(_NonMaxSuppressionV3=Module[\"_NonMaxSuppressionV3\"]=Module[\"asm\"][\"NonMaxSuppressionV3\"]).apply(null,arguments)};var _NonMaxSuppressionV4=Module[\"_NonMaxSuppressionV4\"]=function(){return(_NonMaxSuppressionV4=Module[\"_NonMaxSuppressionV4\"]=Module[\"asm\"][\"NonMaxSuppressionV4\"]).apply(null,arguments)};var _NonMaxSuppressionV5=Module[\"_NonMaxSuppressionV5\"]=function(){return(_NonMaxSuppressionV5=Module[\"_NonMaxSuppressionV5\"]=Module[\"asm\"][\"NonMaxSuppressionV5\"]).apply(null,arguments)};var _NotEqual=Module[\"_NotEqual\"]=function(){return(_NotEqual=Module[\"_NotEqual\"]=Module[\"asm\"][\"NotEqual\"]).apply(null,arguments)};var _OneHot=Module[\"_OneHot\"]=function(){return(_OneHot=Module[\"_OneHot\"]=Module[\"asm\"][\"OneHot\"]).apply(null,arguments)};var _PadV2=Module[\"_PadV2\"]=function(){return(_PadV2=Module[\"_PadV2\"]=Module[\"asm\"][\"PadV2\"]).apply(null,arguments)};var _Pow=Module[\"_Pow\"]=function(){return(_Pow=Module[\"_Pow\"]=Module[\"asm\"][\"Pow\"]).apply(null,arguments)};var _Prelu=Module[\"_Prelu\"]=function(){return(_Prelu=Module[\"_Prelu\"]=Module[\"asm\"][\"Prelu\"]).apply(null,arguments)};var _Prod=Module[\"_Prod\"]=function(){return(_Prod=Module[\"_Prod\"]=Module[\"asm\"][\"Prod\"]).apply(null,arguments)};var _RealDiv=Module[\"_RealDiv\"]=function(){return(_RealDiv=Module[\"_RealDiv\"]=Module[\"asm\"][\"RealDiv\"]).apply(null,arguments)};var _Relu=Module[\"_Relu\"]=function(){return(_Relu=Module[\"_Relu\"]=Module[\"asm\"][\"Relu\"]).apply(null,arguments)};var _Relu6=Module[\"_Relu6\"]=function(){return(_Relu6=Module[\"_Relu6\"]=Module[\"asm\"][\"Relu6\"]).apply(null,arguments)};var _ResizeBilinear=Module[\"_ResizeBilinear\"]=function(){return(_ResizeBilinear=Module[\"_ResizeBilinear\"]=Module[\"asm\"][\"ResizeBilinear\"]).apply(null,arguments)};var _ResizeNearestNeighbor=Module[\"_ResizeNearestNeighbor\"]=function(){return(_ResizeNearestNeighbor=Module[\"_ResizeNearestNeighbor\"]=Module[\"asm\"][\"ResizeNearestNeighbor\"]).apply(null,arguments)};var _Reverse=Module[\"_Reverse\"]=function(){return(_Reverse=Module[\"_Reverse\"]=Module[\"asm\"][\"Reverse\"]).apply(null,arguments)};var _RotateWithOffset=Module[\"_RotateWithOffset\"]=function(){return(_RotateWithOffset=Module[\"_RotateWithOffset\"]=Module[\"asm\"][\"RotateWithOffset\"]).apply(null,arguments)};var _Round=Module[\"_Round\"]=function(){return(_Round=Module[\"_Round\"]=Module[\"asm\"][\"Round\"]).apply(null,arguments)};var _Rsqrt=Module[\"_Rsqrt\"]=function(){return(_Rsqrt=Module[\"_Rsqrt\"]=Module[\"asm\"][\"Rsqrt\"]).apply(null,arguments)};var _ScatterNd=Module[\"_ScatterNd\"]=function(){return(_ScatterNd=Module[\"_ScatterNd\"]=Module[\"asm\"][\"ScatterNd\"]).apply(null,arguments)};var _SelectV2=Module[\"_SelectV2\"]=function(){return(_SelectV2=Module[\"_SelectV2\"]=Module[\"asm\"][\"SelectV2\"]).apply(null,arguments)};var _Sigmoid=Module[\"_Sigmoid\"]=function(){return(_Sigmoid=Module[\"_Sigmoid\"]=Module[\"asm\"][\"Sigmoid\"]).apply(null,arguments)};var _Sin=Module[\"_Sin\"]=function(){return(_Sin=Module[\"_Sin\"]=Module[\"asm\"][\"Sin\"]).apply(null,arguments)};var _Softmax=Module[\"_Softmax\"]=function(){return(_Softmax=Module[\"_Softmax\"]=Module[\"asm\"][\"Softmax\"]).apply(null,arguments)};var _SparseFillEmptyRows=Module[\"_SparseFillEmptyRows\"]=function(){return(_SparseFillEmptyRows=Module[\"_SparseFillEmptyRows\"]=Module[\"asm\"][\"SparseFillEmptyRows\"]).apply(null,arguments)};var _SparseReshape=Module[\"_SparseReshape\"]=function(){return(_SparseReshape=Module[\"_SparseReshape\"]=Module[\"asm\"][\"SparseReshape\"]).apply(null,arguments)};var _SparseSegmentReduction=Module[\"_SparseSegmentReduction\"]=function(){return(_SparseSegmentReduction=Module[\"_SparseSegmentReduction\"]=Module[\"asm\"][\"SparseSegmentReduction\"]).apply(null,arguments)};var _Sqrt=Module[\"_Sqrt\"]=function(){return(_Sqrt=Module[\"_Sqrt\"]=Module[\"asm\"][\"Sqrt\"]).apply(null,arguments)};var _Square=Module[\"_Square\"]=function(){return(_Square=Module[\"_Square\"]=Module[\"asm\"][\"Square\"]).apply(null,arguments)};var _SquaredDifference=Module[\"_SquaredDifference\"]=function(){return(_SquaredDifference=Module[\"_SquaredDifference\"]=Module[\"asm\"][\"SquaredDifference\"]).apply(null,arguments)};var _Step=Module[\"_Step\"]=function(){return(_Step=Module[\"_Step\"]=Module[\"asm\"][\"Step\"]).apply(null,arguments)};var _StridedSlice=Module[\"_StridedSlice\"]=function(){return(_StridedSlice=Module[\"_StridedSlice\"]=Module[\"asm\"][\"StridedSlice\"]).apply(null,arguments)};var _Sub=Module[\"_Sub\"]=function(){return(_Sub=Module[\"_Sub\"]=Module[\"asm\"][\"Sub\"]).apply(null,arguments)};var _Sum=Module[\"_Sum\"]=function(){return(_Sum=Module[\"_Sum\"]=Module[\"asm\"][\"Sum\"]).apply(null,arguments)};var _Tan=Module[\"_Tan\"]=function(){return(_Tan=Module[\"_Tan\"]=Module[\"asm\"][\"Tan\"]).apply(null,arguments)};var _Tanh=Module[\"_Tanh\"]=function(){return(_Tanh=Module[\"_Tanh\"]=Module[\"asm\"][\"Tanh\"]).apply(null,arguments)};var _Tile=Module[\"_Tile\"]=function(){return(_Tile=Module[\"_Tile\"]=Module[\"asm\"][\"Tile\"]).apply(null,arguments)};var _TopK=Module[\"_TopK\"]=function(){return(_TopK=Module[\"_TopK\"]=Module[\"asm\"][\"TopK\"]).apply(null,arguments)};var _Transform=Module[\"_Transform\"]=function(){return(_Transform=Module[\"_Transform\"]=Module[\"asm\"][\"Transform\"]).apply(null,arguments)};var _Transpose=Module[\"_Transpose\"]=function(){return(_Transpose=Module[\"_Transpose\"]=Module[\"asm\"][\"Transpose\"]).apply(null,arguments)};var __FusedMatMul=Module[\"__FusedMatMul\"]=function(){return(__FusedMatMul=Module[\"__FusedMatMul\"]=Module[\"asm\"][\"_FusedMatMul\"]).apply(null,arguments)};var _malloc=Module[\"_malloc\"]=function(){return(_malloc=Module[\"_malloc\"]=Module[\"asm\"][\"malloc\"]).apply(null,arguments)};var _free=Module[\"_free\"]=function(){return(_free=Module[\"_free\"]=Module[\"asm\"][\"free\"]).apply(null,arguments)};var __emscripten_tls_init=Module[\"__emscripten_tls_init\"]=function(){return(__emscripten_tls_init=Module[\"__emscripten_tls_init\"]=Module[\"asm\"][\"_emscripten_tls_init\"]).apply(null,arguments)};var _pthread_self=Module[\"_pthread_self\"]=function(){return(_pthread_self=Module[\"_pthread_self\"]=Module[\"asm\"][\"pthread_self\"]).apply(null,arguments)};var ___errno_location=Module[\"___errno_location\"]=function(){return(___errno_location=Module[\"___errno_location\"]=Module[\"asm\"][\"__errno_location\"]).apply(null,arguments)};var __emscripten_thread_init=Module[\"__emscripten_thread_init\"]=function(){return(__emscripten_thread_init=Module[\"__emscripten_thread_init\"]=Module[\"asm\"][\"_emscripten_thread_init\"]).apply(null,arguments)};var __emscripten_thread_crashed=Module[\"__emscripten_thread_crashed\"]=function(){return(__emscripten_thread_crashed=Module[\"__emscripten_thread_crashed\"]=Module[\"asm\"][\"_emscripten_thread_crashed\"]).apply(null,arguments)};var _emscripten_main_thread_process_queued_calls=Module[\"_emscripten_main_thread_process_queued_calls\"]=function(){return(_emscripten_main_thread_process_queued_calls=Module[\"_emscripten_main_thread_process_queued_calls\"]=Module[\"asm\"][\"emscripten_main_thread_process_queued_calls\"]).apply(null,arguments)};var _emscripten_main_browser_thread_id=Module[\"_emscripten_main_browser_thread_id\"]=function(){return(_emscripten_main_browser_thread_id=Module[\"_emscripten_main_browser_thread_id\"]=Module[\"asm\"][\"emscripten_main_browser_thread_id\"]).apply(null,arguments)};var _emscripten_run_in_main_runtime_thread_js=Module[\"_emscripten_run_in_main_runtime_thread_js\"]=function(){return(_emscripten_run_in_main_runtime_thread_js=Module[\"_emscripten_run_in_main_runtime_thread_js\"]=Module[\"asm\"][\"emscripten_run_in_main_runtime_thread_js\"]).apply(null,arguments)};var _emscripten_dispatch_to_thread_=Module[\"_emscripten_dispatch_to_thread_\"]=function(){return(_emscripten_dispatch_to_thread_=Module[\"_emscripten_dispatch_to_thread_\"]=Module[\"asm\"][\"emscripten_dispatch_to_thread_\"]).apply(null,arguments)};var __emscripten_proxy_execute_task_queue=Module[\"__emscripten_proxy_execute_task_queue\"]=function(){return(__emscripten_proxy_execute_task_queue=Module[\"__emscripten_proxy_execute_task_queue\"]=Module[\"asm\"][\"_emscripten_proxy_execute_task_queue\"]).apply(null,arguments)};var __emscripten_thread_free_data=Module[\"__emscripten_thread_free_data\"]=function(){return(__emscripten_thread_free_data=Module[\"__emscripten_thread_free_data\"]=Module[\"asm\"][\"_emscripten_thread_free_data\"]).apply(null,arguments)};var __emscripten_thread_exit=Module[\"__emscripten_thread_exit\"]=function(){return(__emscripten_thread_exit=Module[\"__emscripten_thread_exit\"]=Module[\"asm\"][\"_emscripten_thread_exit\"]).apply(null,arguments)};var _emscripten_stack_set_limits=Module[\"_emscripten_stack_set_limits\"]=function(){return(_emscripten_stack_set_limits=Module[\"_emscripten_stack_set_limits\"]=Module[\"asm\"][\"emscripten_stack_set_limits\"]).apply(null,arguments)};var stackSave=Module[\"stackSave\"]=function(){return(stackSave=Module[\"stackSave\"]=Module[\"asm\"][\"stackSave\"]).apply(null,arguments)};var stackRestore=Module[\"stackRestore\"]=function(){return(stackRestore=Module[\"stackRestore\"]=Module[\"asm\"][\"stackRestore\"]).apply(null,arguments)};var stackAlloc=Module[\"stackAlloc\"]=function(){return(stackAlloc=Module[\"stackAlloc\"]=Module[\"asm\"][\"stackAlloc\"]).apply(null,arguments)};var dynCall_iijjiiii=Module[\"dynCall_iijjiiii\"]=function(){return(dynCall_iijjiiii=Module[\"dynCall_iijjiiii\"]=Module[\"asm\"][\"dynCall_iijjiiii\"]).apply(null,arguments)};var dynCall_jiji=Module[\"dynCall_jiji\"]=function(){return(dynCall_jiji=Module[\"dynCall_jiji\"]=Module[\"asm\"][\"dynCall_jiji\"]).apply(null,arguments)};Module[\"keepRuntimeAlive\"]=keepRuntimeAlive;Module[\"wasmMemory\"]=wasmMemory;Module[\"cwrap\"]=cwrap;Module[\"ExitStatus\"]=ExitStatus;Module[\"PThread\"]=PThread;var calledRun;dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(args){args=args||arguments_;if(runDependencies>0){return}if(ENVIRONMENT_IS_PTHREAD){readyPromiseResolve(Module);initRuntime();postMessage({\"cmd\":\"loaded\"});return}preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module[\"calledRun\"]=true;if(ABORT)return;initRuntime();readyPromiseResolve(Module);if(Module[\"onRuntimeInitialized\"])Module[\"onRuntimeInitialized\"]();postRun()}if(Module[\"setStatus\"]){Module[\"setStatus\"](\"Running...\");setTimeout(function(){setTimeout(function(){Module[\"setStatus\"](\"\")},1);doRun()},1)}else{doRun()}}if(Module[\"preInit\"]){if(typeof Module[\"preInit\"]==\"function\")Module[\"preInit\"]=[Module[\"preInit\"]];while(Module[\"preInit\"].length>0){Module[\"preInit\"].pop()()}}run();var listenersAdded;if(beforeListeners){listenersAdded={uncaughtException:process.listeners(\"uncaughtException\").filter(function(listener){return!beforeListeners.uncaughtException.indexOf(listener)>-1}),unhandledRejection:process.listeners(\"unhandledRejection\").filter(function(listener){return!beforeListeners.unhandledRejection.indexOf(listener)>-1})}}var actualModule;if(typeof WasmBackendModule!==\"undefined\"){actualModule=WasmBackendModule}else if(typeof WasmBackendModuleThreadedSimd!==\"undefined\"){actualModule=WasmBackendModuleThreadedSimd}else{throw new Error(\"Could not find wasm module in post.js\")}if(listenersAdded){var tmpDispose=actualModule[\"_dispose\"];actualModule[\"_dispose\"]=function(){tmpDispose();listenersAdded.uncaughtException.forEach(function(listener){process.removeListener(\"uncaughtException\",listener)});listenersAdded.unhandledRejection.forEach(function(listener){process.removeListener(\"unhandledRejection\",listener)})}}\n\n\n return WasmBackendModuleThreadedSimd.ready\n}\n);\n})();\nif (typeof exports === 'object' && typeof module === 'object')\n module.exports = WasmBackendModuleThreadedSimd;\nelse if (typeof define === 'function' && define['amd'])\n define([], function() { return WasmBackendModuleThreadedSimd; });\nelse if (typeof exports === 'object')\n exports[\"WasmBackendModuleThreadedSimd\"] = WasmBackendModuleThreadedSimd;\n","module.exports.wasmWorkerContents = `\"use strict\";var Module={};var ENVIRONMENT_IS_NODE=typeof process==\"object\"&&typeof process.versions==\"object\"&&typeof process.versions.node==\"string\";if(ENVIRONMENT_IS_NODE){var nodeWorkerThreads=require(\"worker_threads\");var parentPort=nodeWorkerThreads.parentPort;parentPort.on(\"message\",data=>onmessage({data:data}));var fs=require(\"fs\");Object.assign(global,{self:global,require:require,Module:Module,location:{href:__filename},Worker:nodeWorkerThreads.Worker,importScripts:function(f){(0,eval)(fs.readFileSync(f,\"utf8\"))},postMessage:function(msg){parentPort.postMessage(msg)},performance:global.performance||{now:function(){return Date.now()}}})}var initializedJS=false;var pendingNotifiedProxyingQueues=[];function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(\" \");if(ENVIRONMENT_IS_NODE){fs.writeSync(2,text+\"\\n\");return}console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(\" \");postMessage({cmd:\"alert\",text:text,threadId:Module[\"_pthread_self\"]()})}var err=threadPrintErr;self.alert=threadAlert;Module[\"instantiateWasm\"]=(info,receiveInstance)=>{var instance=new WebAssembly.Instance(Module[\"wasmModule\"],info);receiveInstance(instance);Module[\"wasmModule\"]=null;return instance.exports};self.onunhandledrejection=e=>{throw e.reason??e};self.onmessage=e=>{try{if(e.data.cmd===\"load\"){Module[\"wasmModule\"]=e.data.wasmModule;Module[\"wasmMemory\"]=e.data.wasmMemory;Module[\"buffer\"]=Module[\"wasmMemory\"].buffer;Module[\"ENVIRONMENT_IS_PTHREAD\"]=true;if(typeof e.data.urlOrBlob==\"string\"){importScripts(e.data.urlOrBlob)}else{var objectUrl=URL.createObjectURL(e.data.urlOrBlob);importScripts(objectUrl);URL.revokeObjectURL(objectUrl)}WasmBackendModuleThreadedSimd(Module).then(function(instance){Module=instance})}else if(e.data.cmd===\"run\"){Module[\"__performance_now_clock_drift\"]=performance.now()-e.data.time;Module[\"__emscripten_thread_init\"](e.data.pthread_ptr,0,0,1);Module[\"establishStackSpace\"]();Module[\"PThread\"].receiveObjectTransfer(e.data);Module[\"PThread\"].threadInitTLS();if(!initializedJS){pendingNotifiedProxyingQueues.forEach(queue=>{Module[\"executeNotifiedProxyingQueue\"](queue)});pendingNotifiedProxyingQueues=[];initializedJS=true}try{Module[\"invokeEntryPoint\"](e.data.start_routine,e.data.arg)}catch(ex){if(ex!=\"unwind\"){if(ex instanceof Module[\"ExitStatus\"]){if(Module[\"keepRuntimeAlive\"]()){}else{Module[\"__emscripten_thread_exit\"](ex.status)}}else{throw ex}}}}else if(e.data.cmd===\"cancel\"){if(Module[\"_pthread_self\"]()){Module[\"__emscripten_thread_exit\"](-1)}}else if(e.data.target===\"setimmediate\"){}else if(e.data.cmd===\"processProxyingQueue\"){if(initializedJS){Module[\"executeNotifiedProxyingQueue\"](e.data.queue)}else{pendingNotifiedProxyingQueues.push(e.data.queue)}}else if(e.data.cmd){err(\"worker.js received unknown command \"+e.data.cmd);err(e.data)}}catch(ex){if(Module[\"__emscripten_thread_crashed\"]){Module[\"__emscripten_thread_crashed\"]()}throw ex}};`;","\nvar WasmBackendModule = (() => {\n var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;\n if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;\n return (\nfunction(WasmBackendModule) {\n WasmBackendModule = WasmBackendModule || {};\n\nvar Module=typeof WasmBackendModule!=\"undefined\"?WasmBackendModule:{};var readyPromiseResolve,readyPromiseReject;Module[\"ready\"]=new Promise(function(resolve,reject){readyPromiseResolve=resolve;readyPromiseReject=reject});var beforeListeners;if(typeof process!==\"undefined\"&&process.listeners){beforeListeners={uncaughtException:process.listeners(\"uncaughtException\"),unhandledRejection:process.listeners(\"unhandledRejection\")}}var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram=\"./this.program\";var quit_=(status,toThrow)=>{throw toThrow};var ENVIRONMENT_IS_WEB=typeof window==\"object\";var ENVIRONMENT_IS_WORKER=typeof importScripts==\"function\";var ENVIRONMENT_IS_NODE=typeof process==\"object\"&&typeof process.versions==\"object\"&&typeof process.versions.node==\"string\";var scriptDirectory=\"\";function locateFile(path){if(Module[\"locateFile\"]){return Module[\"locateFile\"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;function logExceptionOnExit(e){if(e instanceof ExitStatus)return;let toLog=e;err(\"exiting due to exception: \"+toLog)}if(ENVIRONMENT_IS_NODE){if(ENVIRONMENT_IS_WORKER){scriptDirectory=require(\"path\").dirname(scriptDirectory)+\"/\"}else{scriptDirectory=__dirname+\"/\"}var fs,nodePath;if(typeof require===\"function\"){fs=require(\"fs\");nodePath=require(\"path\")}read_=(filename,binary)=>{filename=nodePath[\"normalize\"](filename);return fs.readFileSync(filename,binary?undefined:\"utf8\")};readBinary=filename=>{var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}return ret};readAsync=(filename,onload,onerror)=>{filename=nodePath[\"normalize\"](filename);fs.readFile(filename,function(err,data){if(err)onerror(err);else onload(data.buffer)})};if(process[\"argv\"].length>1){thisProgram=process[\"argv\"][1].replace(/\\\\/g,\"/\")}arguments_=process[\"argv\"].slice(2);process[\"on\"](\"uncaughtException\",function(ex){if(!(ex instanceof ExitStatus)){throw ex}});process[\"on\"](\"unhandledRejection\",function(reason){throw reason});quit_=(status,toThrow)=>{if(keepRuntimeAlive()){process[\"exitCode\"]=status;throw toThrow}logExceptionOnExit(toThrow);process[\"exit\"](status)};Module[\"inspect\"]=function(){return\"[Emscripten Module object]\"}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!=\"undefined\"&&document.currentScript){scriptDirectory=document.currentScript.src}if(_scriptDir){scriptDirectory=_scriptDir}if(scriptDirectory.indexOf(\"blob:\")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,\"\").lastIndexOf(\"/\")+1)}else{scriptDirectory=\"\"}{read_=url=>{var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,false);xhr.responseType=\"arraybuffer\";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=(url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,true);xhr.responseType=\"arraybuffer\";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}setWindowTitle=title=>document.title=title}else{}var out=Module[\"print\"]||console.log.bind(console);var err=Module[\"printErr\"]||console.warn.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module[\"arguments\"])arguments_=Module[\"arguments\"];if(Module[\"thisProgram\"])thisProgram=Module[\"thisProgram\"];if(Module[\"quit\"])quit_=Module[\"quit\"];var POINTER_SIZE=4;var wasmBinary;if(Module[\"wasmBinary\"])wasmBinary=Module[\"wasmBinary\"];var noExitRuntime=Module[\"noExitRuntime\"]||true;if(typeof WebAssembly!=\"object\"){abort(\"no native wasm support detected\")}var wasmMemory;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort(text)}}var UTF8Decoder=typeof TextDecoder!=\"undefined\"?new TextDecoder(\"utf8\"):undefined;function UTF8ArrayToString(heapOrArray,idx,maxBytesToRead){var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heapOrArray[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str=\"\";while(idx>10,56320|ch&1023)}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):\"\"}function stringToUTF8Array(str,heap,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferAndViews(buf){buffer=buf;Module[\"HEAP8\"]=HEAP8=new Int8Array(buf);Module[\"HEAP16\"]=HEAP16=new Int16Array(buf);Module[\"HEAP32\"]=HEAP32=new Int32Array(buf);Module[\"HEAPU8\"]=HEAPU8=new Uint8Array(buf);Module[\"HEAPU16\"]=HEAPU16=new Uint16Array(buf);Module[\"HEAPU32\"]=HEAPU32=new Uint32Array(buf);Module[\"HEAPF32\"]=HEAPF32=new Float32Array(buf);Module[\"HEAPF64\"]=HEAPF64=new Float64Array(buf)}var INITIAL_MEMORY=Module[\"INITIAL_MEMORY\"]||16777216;var wasmTable;var __ATPRERUN__=[];var __ATINIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function keepRuntimeAlive(){return noExitRuntime}function preRun(){if(Module[\"preRun\"]){if(typeof Module[\"preRun\"]==\"function\")Module[\"preRun\"]=[Module[\"preRun\"]];while(Module[\"preRun\"].length){addOnPreRun(Module[\"preRun\"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;callRuntimeCallbacks(__ATINIT__)}function postRun(){if(Module[\"postRun\"]){if(typeof Module[\"postRun\"]==\"function\")Module[\"postRun\"]=[Module[\"postRun\"]];while(Module[\"postRun\"].length){addOnPostRun(Module[\"postRun\"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnInit(cb){__ATINIT__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function addRunDependency(id){runDependencies++;if(Module[\"monitorRunDependencies\"]){Module[\"monitorRunDependencies\"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module[\"monitorRunDependencies\"]){Module[\"monitorRunDependencies\"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){{if(Module[\"onAbort\"]){Module[\"onAbort\"](what)}}what=\"Aborted(\"+what+\")\";err(what);ABORT=true;EXITSTATUS=1;what+=\". Build with -sASSERTIONS for more info.\";var e=new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e}var dataURIPrefix=\"data:application/octet-stream;base64,\";function isDataURI(filename){return filename.startsWith(dataURIPrefix)}function isFileURI(filename){return filename.startsWith(\"file://\")}var wasmBinaryFile;wasmBinaryFile=\"tfjs-backend-wasm.wasm\";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(file){try{if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw\"both async and sync fetching of the wasm failed\"}catch(err){abort(err)}}function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch==\"function\"&&!isFileURI(wasmBinaryFile)){return fetch(wasmBinaryFile,{credentials:\"same-origin\"}).then(function(response){if(!response[\"ok\"]){throw\"failed to load wasm binary file at '\"+wasmBinaryFile+\"'\"}return response[\"arrayBuffer\"]()}).catch(function(){return getBinary(wasmBinaryFile)})}else{if(readAsync){return new Promise(function(resolve,reject){readAsync(wasmBinaryFile,function(response){resolve(new Uint8Array(response))},reject)})}}}return Promise.resolve().then(function(){return getBinary(wasmBinaryFile)})}function createWasm(){var info={\"env\":asmLibraryArg,\"wasi_snapshot_preview1\":asmLibraryArg};function receiveInstance(instance,module){var exports=instance.exports;Module[\"asm\"]=exports;wasmMemory=Module[\"asm\"][\"memory\"];updateGlobalBufferAndViews(wasmMemory.buffer);wasmTable=Module[\"asm\"][\"__indirect_function_table\"];addOnInit(Module[\"asm\"][\"__wasm_call_ctors\"]);removeRunDependency(\"wasm-instantiate\")}addRunDependency(\"wasm-instantiate\");function receiveInstantiationResult(result){receiveInstance(result[\"instance\"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(function(instance){return instance}).then(receiver,function(reason){err(\"failed to asynchronously prepare wasm: \"+reason);abort(reason)})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming==\"function\"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&!ENVIRONMENT_IS_NODE&&typeof fetch==\"function\"){return fetch(wasmBinaryFile,{credentials:\"same-origin\"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiationResult,function(reason){err(\"wasm streaming compile failed: \"+reason);err(\"falling back to ArrayBuffer instantiation\");return instantiateArrayBuffer(receiveInstantiationResult)})})}else{return instantiateArrayBuffer(receiveInstantiationResult)}}if(Module[\"instantiateWasm\"]){try{var exports=Module[\"instantiateWasm\"](info,receiveInstance);return exports}catch(e){err(\"Module.instantiateWasm callback failed with error: \"+e);readyPromiseReject(e)}}instantiateAsync().catch(readyPromiseReject);return{}}var tempDouble;var tempI64;function ExitStatus(status){this.name=\"ExitStatus\";this.message=\"Program terminated with exit(\"+status+\")\";this.status=status}function callRuntimeCallbacks(callbacks){while(callbacks.length>0){callbacks.shift()(Module)}}function demangle(func){return func}function demangleAll(text){var regex=/\\b_Z[\\w\\d_]+/g;return text.replace(regex,function(x){var y=demangle(x);return x===y?x:y+\" [\"+x+\"]\"})}function jsStackTrace(){var error=new Error;if(!error.stack){try{throw new Error}catch(e){error=e}if(!error.stack){return\"(no stack trace available)\"}}return error.stack.toString()}function writeArrayToMemory(array,buffer){HEAP8.set(array,buffer)}function _abort(){abort(\"\")}function getHeapMax(){return 2147483648}function _emscripten_get_heap_max(){return getHeapMax()}function _emscripten_memcpy_big(dest,src,num){HEAPU8.copyWithin(dest,src,src+num)}function emscripten_realloc_buffer(size){try{wasmMemory.grow(size-buffer.byteLength+65535>>>16);updateGlobalBufferAndViews(wasmMemory.buffer);return 1}catch(e){}}function _emscripten_resize_heap(requestedSize){var oldSize=HEAPU8.length;requestedSize=requestedSize>>>0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}let alignUp=(x,multiple)=>x+(multiple-x%multiple)%multiple;for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignUp(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=emscripten_realloc_buffer(newSize);if(replacement){return true}}return false}var SYSCALLS={varargs:undefined,get:function(){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret},getStr:function(ptr){var ret=UTF8ToString(ptr);return ret}};function _fd_close(fd){return 52}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){return 70}var printCharBuffers=[null,[],[]];function printChar(stream,curr){var buffer=printCharBuffers[stream];if(curr===0||curr===10){(stream===1?out:err)(UTF8ArrayToString(buffer,0));buffer.length=0}else{buffer.push(curr)}}function _fd_write(fd,iov,iovcnt,pnum){var num=0;for(var i=0;i>2];var len=HEAPU32[iov+4>>2];iov+=8;for(var j=0;j>2]=num;return 0}function getCFunc(ident){var func=Module[\"_\"+ident];return func}function ccall(ident,returnType,argTypes,args,opts){var toC={\"string\":str=>{var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=stackAlloc(len);stringToUTF8(str,ret,len)}return ret},\"array\":arr=>{var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType===\"string\"){return UTF8ToString(ret)}if(returnType===\"boolean\")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;itype===\"number\"||type===\"boolean\");var numericRet=returnType!==\"string\";if(numericRet&&numericArgs&&!opts){return getCFunc(ident)}return function(){return ccall(ident,returnType,argTypes,arguments,opts)}}var asmLibraryArg={\"abort\":_abort,\"emscripten_get_heap_max\":_emscripten_get_heap_max,\"emscripten_memcpy_big\":_emscripten_memcpy_big,\"emscripten_resize_heap\":_emscripten_resize_heap,\"fd_close\":_fd_close,\"fd_seek\":_fd_seek,\"fd_write\":_fd_write};var asm=createWasm();var ___wasm_call_ctors=Module[\"___wasm_call_ctors\"]=function(){return(___wasm_call_ctors=Module[\"___wasm_call_ctors\"]=Module[\"asm\"][\"__wasm_call_ctors\"]).apply(null,arguments)};var _init=Module[\"_init\"]=function(){return(_init=Module[\"_init\"]=Module[\"asm\"][\"init\"]).apply(null,arguments)};var _init_with_threads_count=Module[\"_init_with_threads_count\"]=function(){return(_init_with_threads_count=Module[\"_init_with_threads_count\"]=Module[\"asm\"][\"init_with_threads_count\"]).apply(null,arguments)};var _get_threads_count=Module[\"_get_threads_count\"]=function(){return(_get_threads_count=Module[\"_get_threads_count\"]=Module[\"asm\"][\"get_threads_count\"]).apply(null,arguments)};var _register_tensor=Module[\"_register_tensor\"]=function(){return(_register_tensor=Module[\"_register_tensor\"]=Module[\"asm\"][\"register_tensor\"]).apply(null,arguments)};var _dispose_data=Module[\"_dispose_data\"]=function(){return(_dispose_data=Module[\"_dispose_data\"]=Module[\"asm\"][\"dispose_data\"]).apply(null,arguments)};var _dispose=Module[\"_dispose\"]=function(){return(_dispose=Module[\"_dispose\"]=Module[\"asm\"][\"dispose\"]).apply(null,arguments)};var _Abs=Module[\"_Abs\"]=function(){return(_Abs=Module[\"_Abs\"]=Module[\"asm\"][\"Abs\"]).apply(null,arguments)};var _Add=Module[\"_Add\"]=function(){return(_Add=Module[\"_Add\"]=Module[\"asm\"][\"Add\"]).apply(null,arguments)};var _AddN=Module[\"_AddN\"]=function(){return(_AddN=Module[\"_AddN\"]=Module[\"asm\"][\"AddN\"]).apply(null,arguments)};var _All=Module[\"_All\"]=function(){return(_All=Module[\"_All\"]=Module[\"asm\"][\"All\"]).apply(null,arguments)};var _Any=Module[\"_Any\"]=function(){return(_Any=Module[\"_Any\"]=Module[\"asm\"][\"Any\"]).apply(null,arguments)};var _ArgMax=Module[\"_ArgMax\"]=function(){return(_ArgMax=Module[\"_ArgMax\"]=Module[\"asm\"][\"ArgMax\"]).apply(null,arguments)};var _AvgPool=Module[\"_AvgPool\"]=function(){return(_AvgPool=Module[\"_AvgPool\"]=Module[\"asm\"][\"AvgPool\"]).apply(null,arguments)};var _BatchMatMul=Module[\"_BatchMatMul\"]=function(){return(_BatchMatMul=Module[\"_BatchMatMul\"]=Module[\"asm\"][\"BatchMatMul\"]).apply(null,arguments)};var _Ceil=Module[\"_Ceil\"]=function(){return(_Ceil=Module[\"_Ceil\"]=Module[\"asm\"][\"Ceil\"]).apply(null,arguments)};var _ClipByValue=Module[\"_ClipByValue\"]=function(){return(_ClipByValue=Module[\"_ClipByValue\"]=Module[\"asm\"][\"ClipByValue\"]).apply(null,arguments)};var _Conv2D=Module[\"_Conv2D\"]=function(){return(_Conv2D=Module[\"_Conv2D\"]=Module[\"asm\"][\"Conv2D\"]).apply(null,arguments)};var _Conv2DBackpropInput=Module[\"_Conv2DBackpropInput\"]=function(){return(_Conv2DBackpropInput=Module[\"_Conv2DBackpropInput\"]=Module[\"asm\"][\"Conv2DBackpropInput\"]).apply(null,arguments)};var _Cos=Module[\"_Cos\"]=function(){return(_Cos=Module[\"_Cos\"]=Module[\"asm\"][\"Cos\"]).apply(null,arguments)};var _Cosh=Module[\"_Cosh\"]=function(){return(_Cosh=Module[\"_Cosh\"]=Module[\"asm\"][\"Cosh\"]).apply(null,arguments)};var _CropAndResize=Module[\"_CropAndResize\"]=function(){return(_CropAndResize=Module[\"_CropAndResize\"]=Module[\"asm\"][\"CropAndResize\"]).apply(null,arguments)};var _Cumprod=Module[\"_Cumprod\"]=function(){return(_Cumprod=Module[\"_Cumprod\"]=Module[\"asm\"][\"Cumprod\"]).apply(null,arguments)};var _Cumsum=Module[\"_Cumsum\"]=function(){return(_Cumsum=Module[\"_Cumsum\"]=Module[\"asm\"][\"Cumsum\"]).apply(null,arguments)};var _DepthToSpace=Module[\"_DepthToSpace\"]=function(){return(_DepthToSpace=Module[\"_DepthToSpace\"]=Module[\"asm\"][\"DepthToSpace\"]).apply(null,arguments)};var _DepthwiseConv2dNative=Module[\"_DepthwiseConv2dNative\"]=function(){return(_DepthwiseConv2dNative=Module[\"_DepthwiseConv2dNative\"]=Module[\"asm\"][\"DepthwiseConv2dNative\"]).apply(null,arguments)};var _Elu=Module[\"_Elu\"]=function(){return(_Elu=Module[\"_Elu\"]=Module[\"asm\"][\"Elu\"]).apply(null,arguments)};var _Equal=Module[\"_Equal\"]=function(){return(_Equal=Module[\"_Equal\"]=Module[\"asm\"][\"Equal\"]).apply(null,arguments)};var _Exp=Module[\"_Exp\"]=function(){return(_Exp=Module[\"_Exp\"]=Module[\"asm\"][\"Exp\"]).apply(null,arguments)};var _FlipLeftRight=Module[\"_FlipLeftRight\"]=function(){return(_FlipLeftRight=Module[\"_FlipLeftRight\"]=Module[\"asm\"][\"FlipLeftRight\"]).apply(null,arguments)};var _Floor=Module[\"_Floor\"]=function(){return(_Floor=Module[\"_Floor\"]=Module[\"asm\"][\"Floor\"]).apply(null,arguments)};var _FloorDiv=Module[\"_FloorDiv\"]=function(){return(_FloorDiv=Module[\"_FloorDiv\"]=Module[\"asm\"][\"FloorDiv\"]).apply(null,arguments)};var _FusedBatchNorm=Module[\"_FusedBatchNorm\"]=function(){return(_FusedBatchNorm=Module[\"_FusedBatchNorm\"]=Module[\"asm\"][\"FusedBatchNorm\"]).apply(null,arguments)};var _FusedConv2D=Module[\"_FusedConv2D\"]=function(){return(_FusedConv2D=Module[\"_FusedConv2D\"]=Module[\"asm\"][\"FusedConv2D\"]).apply(null,arguments)};var _FusedDepthwiseConv2D=Module[\"_FusedDepthwiseConv2D\"]=function(){return(_FusedDepthwiseConv2D=Module[\"_FusedDepthwiseConv2D\"]=Module[\"asm\"][\"FusedDepthwiseConv2D\"]).apply(null,arguments)};var _Gather=Module[\"_Gather\"]=function(){return(_Gather=Module[\"_Gather\"]=Module[\"asm\"][\"Gather\"]).apply(null,arguments)};var _GatherNd=Module[\"_GatherNd\"]=function(){return(_GatherNd=Module[\"_GatherNd\"]=Module[\"asm\"][\"GatherNd\"]).apply(null,arguments)};var _Greater=Module[\"_Greater\"]=function(){return(_Greater=Module[\"_Greater\"]=Module[\"asm\"][\"Greater\"]).apply(null,arguments)};var _GreaterEqual=Module[\"_GreaterEqual\"]=function(){return(_GreaterEqual=Module[\"_GreaterEqual\"]=Module[\"asm\"][\"GreaterEqual\"]).apply(null,arguments)};var _LeakyRelu=Module[\"_LeakyRelu\"]=function(){return(_LeakyRelu=Module[\"_LeakyRelu\"]=Module[\"asm\"][\"LeakyRelu\"]).apply(null,arguments)};var _Less=Module[\"_Less\"]=function(){return(_Less=Module[\"_Less\"]=Module[\"asm\"][\"Less\"]).apply(null,arguments)};var _LessEqual=Module[\"_LessEqual\"]=function(){return(_LessEqual=Module[\"_LessEqual\"]=Module[\"asm\"][\"LessEqual\"]).apply(null,arguments)};var _Log=Module[\"_Log\"]=function(){return(_Log=Module[\"_Log\"]=Module[\"asm\"][\"Log\"]).apply(null,arguments)};var _LogicalAnd=Module[\"_LogicalAnd\"]=function(){return(_LogicalAnd=Module[\"_LogicalAnd\"]=Module[\"asm\"][\"LogicalAnd\"]).apply(null,arguments)};var _LogicalNot=Module[\"_LogicalNot\"]=function(){return(_LogicalNot=Module[\"_LogicalNot\"]=Module[\"asm\"][\"LogicalNot\"]).apply(null,arguments)};var _LogicalOr=Module[\"_LogicalOr\"]=function(){return(_LogicalOr=Module[\"_LogicalOr\"]=Module[\"asm\"][\"LogicalOr\"]).apply(null,arguments)};var _LogicalXor=Module[\"_LogicalXor\"]=function(){return(_LogicalXor=Module[\"_LogicalXor\"]=Module[\"asm\"][\"LogicalXor\"]).apply(null,arguments)};var _Max=Module[\"_Max\"]=function(){return(_Max=Module[\"_Max\"]=Module[\"asm\"][\"Max\"]).apply(null,arguments)};var _MaxPool=Module[\"_MaxPool\"]=function(){return(_MaxPool=Module[\"_MaxPool\"]=Module[\"asm\"][\"MaxPool\"]).apply(null,arguments)};var _Maximum=Module[\"_Maximum\"]=function(){return(_Maximum=Module[\"_Maximum\"]=Module[\"asm\"][\"Maximum\"]).apply(null,arguments)};var _Mean=Module[\"_Mean\"]=function(){return(_Mean=Module[\"_Mean\"]=Module[\"asm\"][\"Mean\"]).apply(null,arguments)};var _Min=Module[\"_Min\"]=function(){return(_Min=Module[\"_Min\"]=Module[\"asm\"][\"Min\"]).apply(null,arguments)};var _Minimum=Module[\"_Minimum\"]=function(){return(_Minimum=Module[\"_Minimum\"]=Module[\"asm\"][\"Minimum\"]).apply(null,arguments)};var _MirrorPad=Module[\"_MirrorPad\"]=function(){return(_MirrorPad=Module[\"_MirrorPad\"]=Module[\"asm\"][\"MirrorPad\"]).apply(null,arguments)};var _Multiply=Module[\"_Multiply\"]=function(){return(_Multiply=Module[\"_Multiply\"]=Module[\"asm\"][\"Multiply\"]).apply(null,arguments)};var _Neg=Module[\"_Neg\"]=function(){return(_Neg=Module[\"_Neg\"]=Module[\"asm\"][\"Neg\"]).apply(null,arguments)};var _NonMaxSuppressionV3=Module[\"_NonMaxSuppressionV3\"]=function(){return(_NonMaxSuppressionV3=Module[\"_NonMaxSuppressionV3\"]=Module[\"asm\"][\"NonMaxSuppressionV3\"]).apply(null,arguments)};var _NonMaxSuppressionV4=Module[\"_NonMaxSuppressionV4\"]=function(){return(_NonMaxSuppressionV4=Module[\"_NonMaxSuppressionV4\"]=Module[\"asm\"][\"NonMaxSuppressionV4\"]).apply(null,arguments)};var _NonMaxSuppressionV5=Module[\"_NonMaxSuppressionV5\"]=function(){return(_NonMaxSuppressionV5=Module[\"_NonMaxSuppressionV5\"]=Module[\"asm\"][\"NonMaxSuppressionV5\"]).apply(null,arguments)};var _NotEqual=Module[\"_NotEqual\"]=function(){return(_NotEqual=Module[\"_NotEqual\"]=Module[\"asm\"][\"NotEqual\"]).apply(null,arguments)};var _OneHot=Module[\"_OneHot\"]=function(){return(_OneHot=Module[\"_OneHot\"]=Module[\"asm\"][\"OneHot\"]).apply(null,arguments)};var _PadV2=Module[\"_PadV2\"]=function(){return(_PadV2=Module[\"_PadV2\"]=Module[\"asm\"][\"PadV2\"]).apply(null,arguments)};var _Pow=Module[\"_Pow\"]=function(){return(_Pow=Module[\"_Pow\"]=Module[\"asm\"][\"Pow\"]).apply(null,arguments)};var _Prelu=Module[\"_Prelu\"]=function(){return(_Prelu=Module[\"_Prelu\"]=Module[\"asm\"][\"Prelu\"]).apply(null,arguments)};var _Prod=Module[\"_Prod\"]=function(){return(_Prod=Module[\"_Prod\"]=Module[\"asm\"][\"Prod\"]).apply(null,arguments)};var _RealDiv=Module[\"_RealDiv\"]=function(){return(_RealDiv=Module[\"_RealDiv\"]=Module[\"asm\"][\"RealDiv\"]).apply(null,arguments)};var _Relu=Module[\"_Relu\"]=function(){return(_Relu=Module[\"_Relu\"]=Module[\"asm\"][\"Relu\"]).apply(null,arguments)};var _Relu6=Module[\"_Relu6\"]=function(){return(_Relu6=Module[\"_Relu6\"]=Module[\"asm\"][\"Relu6\"]).apply(null,arguments)};var _ResizeBilinear=Module[\"_ResizeBilinear\"]=function(){return(_ResizeBilinear=Module[\"_ResizeBilinear\"]=Module[\"asm\"][\"ResizeBilinear\"]).apply(null,arguments)};var _ResizeNearestNeighbor=Module[\"_ResizeNearestNeighbor\"]=function(){return(_ResizeNearestNeighbor=Module[\"_ResizeNearestNeighbor\"]=Module[\"asm\"][\"ResizeNearestNeighbor\"]).apply(null,arguments)};var _Reverse=Module[\"_Reverse\"]=function(){return(_Reverse=Module[\"_Reverse\"]=Module[\"asm\"][\"Reverse\"]).apply(null,arguments)};var _RotateWithOffset=Module[\"_RotateWithOffset\"]=function(){return(_RotateWithOffset=Module[\"_RotateWithOffset\"]=Module[\"asm\"][\"RotateWithOffset\"]).apply(null,arguments)};var _Round=Module[\"_Round\"]=function(){return(_Round=Module[\"_Round\"]=Module[\"asm\"][\"Round\"]).apply(null,arguments)};var _Rsqrt=Module[\"_Rsqrt\"]=function(){return(_Rsqrt=Module[\"_Rsqrt\"]=Module[\"asm\"][\"Rsqrt\"]).apply(null,arguments)};var _ScatterNd=Module[\"_ScatterNd\"]=function(){return(_ScatterNd=Module[\"_ScatterNd\"]=Module[\"asm\"][\"ScatterNd\"]).apply(null,arguments)};var _SelectV2=Module[\"_SelectV2\"]=function(){return(_SelectV2=Module[\"_SelectV2\"]=Module[\"asm\"][\"SelectV2\"]).apply(null,arguments)};var _Sigmoid=Module[\"_Sigmoid\"]=function(){return(_Sigmoid=Module[\"_Sigmoid\"]=Module[\"asm\"][\"Sigmoid\"]).apply(null,arguments)};var _Sin=Module[\"_Sin\"]=function(){return(_Sin=Module[\"_Sin\"]=Module[\"asm\"][\"Sin\"]).apply(null,arguments)};var _Softmax=Module[\"_Softmax\"]=function(){return(_Softmax=Module[\"_Softmax\"]=Module[\"asm\"][\"Softmax\"]).apply(null,arguments)};var _SparseFillEmptyRows=Module[\"_SparseFillEmptyRows\"]=function(){return(_SparseFillEmptyRows=Module[\"_SparseFillEmptyRows\"]=Module[\"asm\"][\"SparseFillEmptyRows\"]).apply(null,arguments)};var _SparseReshape=Module[\"_SparseReshape\"]=function(){return(_SparseReshape=Module[\"_SparseReshape\"]=Module[\"asm\"][\"SparseReshape\"]).apply(null,arguments)};var _SparseSegmentReduction=Module[\"_SparseSegmentReduction\"]=function(){return(_SparseSegmentReduction=Module[\"_SparseSegmentReduction\"]=Module[\"asm\"][\"SparseSegmentReduction\"]).apply(null,arguments)};var _Sqrt=Module[\"_Sqrt\"]=function(){return(_Sqrt=Module[\"_Sqrt\"]=Module[\"asm\"][\"Sqrt\"]).apply(null,arguments)};var _Square=Module[\"_Square\"]=function(){return(_Square=Module[\"_Square\"]=Module[\"asm\"][\"Square\"]).apply(null,arguments)};var _SquaredDifference=Module[\"_SquaredDifference\"]=function(){return(_SquaredDifference=Module[\"_SquaredDifference\"]=Module[\"asm\"][\"SquaredDifference\"]).apply(null,arguments)};var _Step=Module[\"_Step\"]=function(){return(_Step=Module[\"_Step\"]=Module[\"asm\"][\"Step\"]).apply(null,arguments)};var _StridedSlice=Module[\"_StridedSlice\"]=function(){return(_StridedSlice=Module[\"_StridedSlice\"]=Module[\"asm\"][\"StridedSlice\"]).apply(null,arguments)};var _Sub=Module[\"_Sub\"]=function(){return(_Sub=Module[\"_Sub\"]=Module[\"asm\"][\"Sub\"]).apply(null,arguments)};var _Sum=Module[\"_Sum\"]=function(){return(_Sum=Module[\"_Sum\"]=Module[\"asm\"][\"Sum\"]).apply(null,arguments)};var _Tan=Module[\"_Tan\"]=function(){return(_Tan=Module[\"_Tan\"]=Module[\"asm\"][\"Tan\"]).apply(null,arguments)};var _Tanh=Module[\"_Tanh\"]=function(){return(_Tanh=Module[\"_Tanh\"]=Module[\"asm\"][\"Tanh\"]).apply(null,arguments)};var _Tile=Module[\"_Tile\"]=function(){return(_Tile=Module[\"_Tile\"]=Module[\"asm\"][\"Tile\"]).apply(null,arguments)};var _TopK=Module[\"_TopK\"]=function(){return(_TopK=Module[\"_TopK\"]=Module[\"asm\"][\"TopK\"]).apply(null,arguments)};var _Transform=Module[\"_Transform\"]=function(){return(_Transform=Module[\"_Transform\"]=Module[\"asm\"][\"Transform\"]).apply(null,arguments)};var _Transpose=Module[\"_Transpose\"]=function(){return(_Transpose=Module[\"_Transpose\"]=Module[\"asm\"][\"Transpose\"]).apply(null,arguments)};var __FusedMatMul=Module[\"__FusedMatMul\"]=function(){return(__FusedMatMul=Module[\"__FusedMatMul\"]=Module[\"asm\"][\"_FusedMatMul\"]).apply(null,arguments)};var _malloc=Module[\"_malloc\"]=function(){return(_malloc=Module[\"_malloc\"]=Module[\"asm\"][\"malloc\"]).apply(null,arguments)};var _free=Module[\"_free\"]=function(){return(_free=Module[\"_free\"]=Module[\"asm\"][\"free\"]).apply(null,arguments)};var ___errno_location=Module[\"___errno_location\"]=function(){return(___errno_location=Module[\"___errno_location\"]=Module[\"asm\"][\"__errno_location\"]).apply(null,arguments)};var stackSave=Module[\"stackSave\"]=function(){return(stackSave=Module[\"stackSave\"]=Module[\"asm\"][\"stackSave\"]).apply(null,arguments)};var stackRestore=Module[\"stackRestore\"]=function(){return(stackRestore=Module[\"stackRestore\"]=Module[\"asm\"][\"stackRestore\"]).apply(null,arguments)};var stackAlloc=Module[\"stackAlloc\"]=function(){return(stackAlloc=Module[\"stackAlloc\"]=Module[\"asm\"][\"stackAlloc\"]).apply(null,arguments)};var dynCall_iijjiiii=Module[\"dynCall_iijjiiii\"]=function(){return(dynCall_iijjiiii=Module[\"dynCall_iijjiiii\"]=Module[\"asm\"][\"dynCall_iijjiiii\"]).apply(null,arguments)};var dynCall_jiji=Module[\"dynCall_jiji\"]=function(){return(dynCall_jiji=Module[\"dynCall_jiji\"]=Module[\"asm\"][\"dynCall_jiji\"]).apply(null,arguments)};Module[\"cwrap\"]=cwrap;var calledRun;dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(args){args=args||arguments_;if(runDependencies>0){return}preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module[\"calledRun\"]=true;if(ABORT)return;initRuntime();readyPromiseResolve(Module);if(Module[\"onRuntimeInitialized\"])Module[\"onRuntimeInitialized\"]();postRun()}if(Module[\"setStatus\"]){Module[\"setStatus\"](\"Running...\");setTimeout(function(){setTimeout(function(){Module[\"setStatus\"](\"\")},1);doRun()},1)}else{doRun()}}if(Module[\"preInit\"]){if(typeof Module[\"preInit\"]==\"function\")Module[\"preInit\"]=[Module[\"preInit\"]];while(Module[\"preInit\"].length>0){Module[\"preInit\"].pop()()}}run();var listenersAdded;if(beforeListeners){listenersAdded={uncaughtException:process.listeners(\"uncaughtException\").filter(function(listener){return!beforeListeners.uncaughtException.indexOf(listener)>-1}),unhandledRejection:process.listeners(\"unhandledRejection\").filter(function(listener){return!beforeListeners.unhandledRejection.indexOf(listener)>-1})}}var actualModule;if(typeof WasmBackendModule!==\"undefined\"){actualModule=WasmBackendModule}else if(typeof WasmBackendModuleThreadedSimd!==\"undefined\"){actualModule=WasmBackendModuleThreadedSimd}else{throw new Error(\"Could not find wasm module in post.js\")}if(listenersAdded){var tmpDispose=actualModule[\"_dispose\"];actualModule[\"_dispose\"]=function(){tmpDispose();listenersAdded.uncaughtException.forEach(function(listener){process.removeListener(\"uncaughtException\",listener)});listenersAdded.unhandledRejection.forEach(function(listener){process.removeListener(\"unhandledRejection\",listener)})}}\n\n\n return WasmBackendModule.ready\n}\n);\n})();\nif (typeof exports === 'object' && typeof module === 'object')\n module.exports = WasmBackendModule;\nelse if (typeof define === 'function' && define['amd'])\n define([], function() { return WasmBackendModule; });\nelse if (typeof exports === 'object')\n exports[\"WasmBackendModule\"] = WasmBackendModule;\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport './flags_wasm';\n\nimport {backend_util, BackendTimingInfo, DataStorage, DataType, deprecationWarn, engine, env, KernelBackend, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasmModule, WasmFactoryConfig} from '../wasm-out/tfjs-backend-wasm';\nimport {BackendWasmThreadedSimdModule} from '../wasm-out/tfjs-backend-wasm-threaded-simd';\nimport * as wasmFactoryThreadedSimd_import from '../wasm-out/tfjs-backend-wasm-threaded-simd.js';\n// @ts-ignore\nimport {wasmWorkerContents} from '../wasm-out/tfjs-backend-wasm-threaded-simd.worker.js';\nimport * as wasmFactory_import from '../wasm-out/tfjs-backend-wasm.js';\n\n// This workaround is required for importing in Node.js without using\n// the node bundle (for testing). This would not be necessary if we\n// flipped esModuleInterop to true, but we likely can't do that since\n// google3 does not use it.\nconst wasmFactoryThreadedSimd = (wasmFactoryThreadedSimd_import.default\n || wasmFactoryThreadedSimd_import) as\ntypeof wasmFactoryThreadedSimd_import.default;\nconst wasmFactory = (wasmFactory_import.default\n || wasmFactory_import) as typeof wasmFactory_import.default;\n\ninterface TensorData {\n id: number;\n memoryOffset: number;\n shape: number[];\n dtype: DataType;\n refCount: number;\n /** Only used for string tensors, storing encoded bytes. */\n stringBytes?: Uint8Array[];\n}\n\nexport type DataId = object; // object instead of {} to force non-primitive.\n\nexport class BackendWasm extends KernelBackend {\n // 0 is reserved for null data ids.\n private dataIdNextNumber = 1;\n dataIdMap: DataStorage;\n\n constructor(public wasm: BackendWasmModule|BackendWasmThreadedSimdModule) {\n super();\n this.wasm.tfjs.initWithThreadsCount(threadsCount);\n actualThreadsCount = this.wasm.tfjs.getThreadsCount();\n this.dataIdMap = new DataStorage(this, engine());\n }\n\n write(values: backend_util.BackendValues, shape: number[], dtype: DataType):\n DataId {\n const dataId = {id: this.dataIdNextNumber++};\n this.move(dataId, values, shape, dtype, 1);\n return dataId;\n }\n\n numDataIds(): number {\n return this.dataIdMap.numDataIds();\n }\n\n async time(f: () => void): Promise {\n const start = util.now();\n f();\n const kernelMs = util.now() - start;\n return {kernelMs};\n }\n\n move(\n dataId: DataId, values: backend_util.BackendValues, shape: number[],\n dtype: DataType, refCount: number): void {\n const id = this.dataIdNextNumber++;\n if (dtype === 'string') {\n const stringBytes = values as Uint8Array[];\n this.dataIdMap.set(\n dataId,\n {id, stringBytes, shape, dtype, memoryOffset: null, refCount});\n return;\n }\n\n const size = util.sizeFromShape(shape);\n const numBytes = size * util.bytesPerElement(dtype);\n const memoryOffset = this.wasm._malloc(numBytes);\n\n this.dataIdMap.set(dataId, {id, memoryOffset, shape, dtype, refCount});\n\n this.wasm.tfjs.registerTensor(id, size, memoryOffset);\n\n if (values != null) {\n this.wasm.HEAPU8.set(\n new Uint8Array(\n (values as backend_util.TypedArray).buffer,\n (values as backend_util.TypedArray).byteOffset, numBytes),\n memoryOffset);\n }\n }\n\n async read(dataId: DataId): Promise {\n return this.readSync(dataId);\n }\n\n readSync(dataId: DataId, start?: number, end?: number):\n backend_util.BackendValues {\n const {memoryOffset, dtype, shape, stringBytes} =\n this.dataIdMap.get(dataId);\n if (dtype === 'string') {\n // Slice all elements.\n if ((start == null || start === 0) &&\n (end == null || end >= stringBytes.length)) {\n return stringBytes;\n }\n return stringBytes.slice(start, end);\n }\n start = start || 0;\n end = end || util.sizeFromShape(shape);\n const bytesPerElement = util.bytesPerElement(dtype);\n const bytes = this.wasm.HEAPU8.slice(\n memoryOffset + start * bytesPerElement,\n memoryOffset + end * bytesPerElement);\n return typedArrayFromBuffer(bytes.buffer, dtype);\n }\n\n /**\n * Dispose the memory if the dataId has 0 refCount. Return true if the memory\n * is released, false otherwise.\n * @param dataId\n * @oaram force Optional, remove the data regardless of refCount\n */\n disposeData(dataId: DataId, force = false): boolean {\n if (this.dataIdMap.has(dataId)) {\n const data = this.dataIdMap.get(dataId);\n data.refCount--;\n if (!force && data.refCount > 0) {\n return false;\n }\n\n this.wasm._free(data.memoryOffset);\n this.wasm.tfjs.disposeData(data.id);\n this.dataIdMap.delete(dataId);\n }\n return true;\n }\n\n /** Return refCount of a `TensorData`. */\n refCount(dataId: DataId): number {\n if (this.dataIdMap.has(dataId)) {\n const tensorData = this.dataIdMap.get(dataId);\n return tensorData.refCount;\n }\n return 0;\n }\n\n incRef(dataId: DataId) {\n const data = this.dataIdMap.get(dataId);\n if (data != null) {\n data.refCount++;\n }\n }\n\n floatPrecision(): 32 {\n return 32;\n }\n\n // Returns the memory offset of a tensor. Useful for debugging and unit\n // testing.\n getMemoryOffset(dataId: DataId): number {\n return this.dataIdMap.get(dataId).memoryOffset;\n }\n\n dispose() {\n this.wasm.tfjs.dispose();\n if ('PThread' in this.wasm) {\n this.wasm.PThread.terminateAllThreads();\n }\n this.wasm = null;\n }\n\n memory() {\n return {unreliable: false};\n }\n\n /**\n * Make a tensor info for the output of an op. If `memoryOffset` is not\n * present, this method allocates memory on the WASM heap. If `memoryOffset`\n * is present, the memory was allocated elsewhere (in c++) and we just record\n * the pointer where that memory lives.\n */\n makeOutput(shape: number[], dtype: DataType, memoryOffset?: number):\n TensorInfo {\n let dataId: {};\n if (memoryOffset == null) {\n dataId = this.write(null /* values */, shape, dtype);\n } else {\n const id = this.dataIdNextNumber++;\n dataId = {id};\n this.dataIdMap.set(dataId, {id, memoryOffset, shape, dtype, refCount: 1});\n const size = util.sizeFromShape(shape);\n this.wasm.tfjs.registerTensor(id, size, memoryOffset);\n }\n return {dataId, shape, dtype};\n }\n\n typedArrayFromHeap({shape, dtype, dataId}: TensorInfo):\n backend_util.TypedArray {\n const buffer = this.wasm.HEAPU8.buffer;\n const {memoryOffset} = this.dataIdMap.get(dataId);\n const size = util.sizeFromShape(shape);\n switch (dtype) {\n case 'float32':\n return new Float32Array(buffer, memoryOffset, size);\n case 'int32':\n return new Int32Array(buffer, memoryOffset, size);\n case 'bool':\n return new Uint8Array(buffer, memoryOffset, size);\n default:\n throw new Error(`Unknown dtype ${dtype}`);\n }\n }\n}\n\nfunction createInstantiateWasmFunc(path: string) {\n // this will be replace by rollup plugin patchWechatWebAssembly in\n // minprogram's output.\n // tslint:disable-next-line:no-any\n return (imports: any, callback: any) => {\n util.fetch(path, {credentials: 'same-origin'}).then((response) => {\n if (!response['ok']) {\n imports.env.a(`failed to load wasm binary file at '${path}'`);\n }\n response.arrayBuffer().then(binary => {\n WebAssembly.instantiate(binary, imports).then(output => {\n callback(output.instance, output.module);\n });\n });\n });\n return {};\n };\n}\n\n/**\n * Returns the path of the WASM binary.\n * @param simdSupported whether SIMD is supported\n * @param threadsSupported whether multithreading is supported\n * @param wasmModuleFolder the directory containing the WASM binaries.\n */\nfunction getPathToWasmBinary(\n simdSupported: boolean, threadsSupported: boolean,\n wasmModuleFolder: string) {\n if (wasmPath != null) {\n // If wasmPath is defined, the user has supplied a full path to\n // the vanilla .wasm binary.\n return wasmPath;\n }\n\n let path: WasmBinaryName = 'tfjs-backend-wasm.wasm';\n if (simdSupported && threadsSupported) {\n path = 'tfjs-backend-wasm-threaded-simd.wasm';\n } else if (simdSupported) {\n path = 'tfjs-backend-wasm-simd.wasm';\n }\n\n if (wasmFileMap != null) {\n if (wasmFileMap[path] != null) {\n return wasmFileMap[path];\n }\n }\n\n return wasmModuleFolder + path;\n}\n\n/**\n * Initializes the wasm module and creates the js <--> wasm bridge.\n *\n * NOTE: We wrap the wasm module in a object with property 'wasm' instead of\n * returning Promise to avoid freezing Chrome (last tested\n * in Chrome 76).\n */\nexport async function init(): Promise<{wasm: BackendWasmModule}> {\n const [simdSupported, threadsSupported] = await Promise.all([\n env().getAsync('WASM_HAS_SIMD_SUPPORT'),\n env().getAsync('WASM_HAS_MULTITHREAD_SUPPORT')\n ]);\n\n return new Promise((resolve, reject) => {\n const factoryConfig: WasmFactoryConfig = {};\n\n /**\n * This function overrides the Emscripten module locateFile utility.\n * @param path The relative path to the file that needs to be loaded.\n * @param prefix The path to the main JavaScript file's directory.\n */\n factoryConfig.locateFile = (path, prefix) => {\n if (path.endsWith('.worker.js')) {\n // Escape '\\n' because Blob will turn it into a newline.\n // There should be a setting for this, but 'endings: \"native\"' does\n // not seem to work.\n const response = (wasmWorkerContents as string).replace(/\\n/g, '\\\\n');\n const blob = new Blob([response], {type: 'application/javascript'});\n return URL.createObjectURL(blob);\n }\n\n if (path.endsWith('.wasm')) {\n return getPathToWasmBinary(\n simdSupported as boolean, threadsSupported as boolean,\n wasmPathPrefix != null ? wasmPathPrefix : prefix);\n }\n return prefix + path;\n };\n\n // Use the instantiateWasm override when system fetch is not available.\n // Reference:\n // https://github.com/emscripten-core/emscripten/blob/2bca083cbbd5a4133db61fbd74d04f7feecfa907/tests/manual_wasm_instantiate.html#L170\n if (customFetch) {\n factoryConfig.instantiateWasm =\n createInstantiateWasmFunc(getPathToWasmBinary(\n simdSupported as boolean, threadsSupported as boolean,\n wasmPathPrefix != null ? wasmPathPrefix : ''));\n }\n\n let initialized = false;\n factoryConfig.onAbort = () => {\n if (initialized) {\n // Emscripten already called console.warn so no need to double log.\n return;\n }\n if (initAborted) {\n // Emscripten calls `onAbort` twice, resulting in double error\n // messages.\n return;\n }\n initAborted = true;\n const rejectMsg =\n 'Make sure the server can serve the `.wasm` file relative to the ' +\n 'bundled js file. For more details see https://github.com/tensorflow/tfjs/blob/master/tfjs-backend-wasm/README.md#using-bundlers';\n reject({message: rejectMsg});\n };\n\n let wasm: Promise;\n // If `wasmPath` has been defined we must initialize the vanilla module.\n if (threadsSupported && simdSupported && wasmPath == null) {\n factoryConfig.mainScriptUrlOrBlob = new Blob(\n [`var WasmBackendModuleThreadedSimd = ` +\n wasmFactoryThreadedSimd.toString()],\n {type: 'text/javascript'});\n wasm = wasmFactoryThreadedSimd(factoryConfig);\n } else {\n // The wasmFactory works for both vanilla and SIMD binaries.\n wasm = wasmFactory(factoryConfig);\n }\n\n // The `wasm` promise will resolve to the WASM module created by\n // the factory, but it might have had errors during creation. Most\n // errors are caught by the onAbort callback defined above.\n // However, some errors, such as those occurring from a\n // failed fetch, result in this promise being rejected. These are\n // caught and re-rejected below.\n wasm.then((module) => {\n initialized = true;\n initAborted = false;\n\n const voidReturnType: string = null;\n // Using the tfjs namespace to avoid conflict with emscripten's API.\n module.tfjs = {\n init: module.cwrap('init', null, []),\n initWithThreadsCount:\n module.cwrap('init_with_threads_count', null, ['number']),\n getThreadsCount: module.cwrap('get_threads_count', 'number', []),\n registerTensor: module.cwrap(\n 'register_tensor', null,\n [\n 'number', // id\n 'number', // size\n 'number', // memoryOffset\n ]),\n disposeData: module.cwrap('dispose_data', voidReturnType, ['number']),\n dispose: module.cwrap('dispose', voidReturnType, []),\n };\n\n resolve({wasm: module});\n }).catch(reject);\n });\n}\n\nfunction typedArrayFromBuffer(\n buffer: ArrayBuffer, dtype: DataType): backend_util.TypedArray {\n switch (dtype) {\n case 'float32':\n return new Float32Array(buffer);\n case 'int32':\n return new Int32Array(buffer);\n case 'bool':\n return new Uint8Array(buffer);\n default:\n throw new Error(`Unknown dtype ${dtype}`);\n }\n}\n\nconst wasmBinaryNames = [\n 'tfjs-backend-wasm.wasm', 'tfjs-backend-wasm-simd.wasm',\n 'tfjs-backend-wasm-threaded-simd.wasm'\n] as const ;\ntype WasmBinaryName = typeof wasmBinaryNames[number];\n\nlet wasmPath: string = null;\nlet wasmPathPrefix: string = null;\nlet wasmFileMap: {[key in WasmBinaryName]?: string} = {};\nlet initAborted = false;\nlet customFetch = false;\n\n/**\n * @deprecated Use `setWasmPaths` instead.\n * Sets the path to the `.wasm` file which will be fetched when the wasm\n * backend is initialized. See\n * https://github.com/tensorflow/tfjs/blob/master/tfjs-backend-wasm/README.md#using-bundlers\n * for more details.\n * @param path wasm file path or url\n * @param usePlatformFetch optional boolean to use platform fetch to download\n * the wasm file, default to false.\n *\n * @doc {heading: 'Environment', namespace: 'wasm'}\n */\nexport function setWasmPath(path: string, usePlatformFetch = false): void {\n deprecationWarn(\n 'setWasmPath has been deprecated in favor of setWasmPaths and' +\n ' will be removed in a future release.');\n if (initAborted) {\n throw new Error(\n 'The WASM backend was already initialized. Make sure you call ' +\n '`setWasmPath()` before you call `tf.setBackend()` or `tf.ready()`');\n }\n wasmPath = path;\n customFetch = usePlatformFetch;\n}\n\n/**\n * Configures the locations of the WASM binaries.\n *\n * ```js\n * setWasmPaths({\n * 'tfjs-backend-wasm.wasm': 'renamed.wasm',\n * 'tfjs-backend-wasm-simd.wasm': 'renamed-simd.wasm',\n * 'tfjs-backend-wasm-threaded-simd.wasm': 'renamed-threaded-simd.wasm'\n * });\n * tf.setBackend('wasm');\n * ```\n *\n * @param prefixOrFileMap This can be either a string or object:\n * - (string) The path to the directory where the WASM binaries are located.\n * Note that this prefix will be used to load each binary (vanilla,\n * SIMD-enabled, threading-enabled, etc.).\n * - (object) Mapping from names of WASM binaries to custom\n * full paths specifying the locations of those binaries. This is useful if\n * your WASM binaries are not all located in the same directory, or if your\n * WASM binaries have been renamed.\n * @param usePlatformFetch optional boolean to use platform fetch to download\n * the wasm file, default to false.\n *\n * @doc {heading: 'Environment', namespace: 'wasm'}\n */\nexport function setWasmPaths(\n prefixOrFileMap: string|{[key in WasmBinaryName]?: string},\n usePlatformFetch = false): void {\n if (initAborted) {\n throw new Error(\n 'The WASM backend was already initialized. Make sure you call ' +\n '`setWasmPaths()` before you call `tf.setBackend()` or ' +\n '`tf.ready()`');\n }\n\n if (typeof prefixOrFileMap === 'string') {\n wasmPathPrefix = prefixOrFileMap;\n } else {\n wasmFileMap = prefixOrFileMap;\n const missingPaths =\n wasmBinaryNames.filter(name => wasmFileMap[name] == null);\n if (missingPaths.length > 0) {\n throw new Error(\n `There were no entries found for the following binaries: ` +\n `${missingPaths.join(',')}. Please either call setWasmPaths with a ` +\n `map providing a path for each binary, or with a string indicating ` +\n `the directory where all the binaries can be found.`);\n }\n }\n\n customFetch = usePlatformFetch;\n}\n\n/** Used in unit tests. */\nexport function resetWasmPath(): void {\n wasmPath = null;\n wasmPathPrefix = null;\n wasmFileMap = {};\n customFetch = false;\n initAborted = false;\n}\n\nlet threadsCount = -1;\nlet actualThreadsCount = -1;\n\n/**\n * Sets the number of threads that will be used by XNNPACK to create\n * threadpool (default to the number of logical CPU cores).\n *\n * This must be called before calling `tf.setBackend('wasm')`.\n */\nexport function setThreadsCount(numThreads: number) {\n threadsCount = numThreads;\n}\n\n/**\n * Gets the actual threads count that is used by XNNPACK.\n *\n * It is set after the backend is intialized.\n */\nexport function getThreadsCount(): number {\n if (actualThreadsCount === -1) {\n throw new Error(`WASM backend not initialized.`);\n }\n return actualThreadsCount;\n}\n","/** @license See the LICENSE file. */\n\n// This code is auto-generated, do not modify this file!\nconst version = '4.0.0';\nexport {version};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport './flags_wasm';\n\nimport {registerBackend} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm, init} from './backend_wasm';\n\nexport {BackendWasm, getThreadsCount, setThreadsCount, setWasmPath, setWasmPaths} from './backend_wasm';\nexport {version as version_wasm} from './version';\n\nconst WASM_PRIORITY = 2;\nregisterBackend('wasm', async () => {\n const {wasm} = await init();\n return new BackendWasm(wasm);\n}, WASM_PRIORITY);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport './register_all_kernels';\nexport * from './base';\n",null,null,null,null,null,"/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env} from '@tensorflow/tfjs-core';\n\nconst ENV = env();\n\n/** Whether to keep intermediate tensors. */\nENV.registerFlag('KEEP_INTERMEDIATE_TENSORS', () => false, debugValue => {\n if (debugValue) {\n console.warn(\n 'Keep intermediate tensors is ON. This will print the values of all ' +\n 'intermediate tensors during model inference. Not all models ' +\n 'support this mode. For details, check e2e/benchmarks/ ' +\n 'model_config.js. This significantly impacts performance.');\n }\n});\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * =============================================================================\n */\n\n/* tslint:disable */\n\n/** Properties of an Any. */\nexport declare interface IAny {\n /** Any typeUrl */\n typeUrl?: (string|null);\n\n /** Any value */\n value?: (Uint8Array|null);\n}\n\n/** DataType enum. */\nexport enum DataType {\n // Not a legal value for DataType. Used to indicate a DataType field\n // has not been set.\n DT_INVALID = 0,\n\n // Data types that all computation devices are expected to be\n // capable to support.\n DT_FLOAT = 1,\n DT_DOUBLE = 2,\n DT_INT32 = 3,\n DT_UINT8 = 4,\n DT_INT16 = 5,\n DT_INT8 = 6,\n DT_STRING = 7,\n DT_COMPLEX64 = 8, // Single-precision complex\n DT_INT64 = 9,\n DT_BOOL = 10,\n DT_QINT8 = 11, // Quantized int8\n DT_QUINT8 = 12, // Quantized uint8\n DT_QINT32 = 13, // Quantized int32\n DT_BFLOAT16 = 14, // Float32 truncated to 16 bits. Only for cast ops.\n DT_QINT16 = 15, // Quantized int16\n DT_QUINT16 = 16, // Quantized uint16\n DT_UINT16 = 17,\n DT_COMPLEX128 = 18, // Double-precision complex\n DT_HALF = 19,\n DT_RESOURCE = 20,\n DT_VARIANT = 21, // Arbitrary C++ data types\n DT_UINT32 = 22,\n DT_UINT64 = 23,\n\n // Do not use! These are only for parameters. Every enum above\n // should have a corresponding value below (verified by types_test).\n DT_FLOAT_REF = 101,\n DT_DOUBLE_REF = 102,\n DT_INT32_REF = 103,\n DT_UINT8_REF = 104,\n DT_INT16_REF = 105,\n DT_INT8_REF = 106,\n DT_STRING_REF = 107,\n DT_COMPLEX64_REF = 108,\n DT_INT64_REF = 109,\n DT_BOOL_REF = 110,\n DT_QINT8_REF = 111,\n DT_QUINT8_REF = 112,\n DT_QINT32_REF = 113,\n DT_BFLOAT16_REF = 114,\n DT_QINT16_REF = 115,\n DT_QUINT16_REF = 116,\n DT_UINT16_REF = 117,\n DT_COMPLEX128_REF = 118,\n DT_HALF_REF = 119,\n DT_RESOURCE_REF = 120,\n DT_VARIANT_REF = 121,\n DT_UINT32_REF = 122,\n DT_UINT64_REF = 123,\n}\n\n/** Properties of a TensorShape. */\nexport declare interface ITensorShape {\n /** TensorShape dim */\n dim?: (TensorShape.IDim[]|null);\n\n /** TensorShape unknownRank */\n unknownRank?: (boolean|null);\n}\n\nexport namespace TensorShape {\n /** Properties of a Dim. */\n export declare interface IDim {\n /** Dim size */\n size?: (number|string|null);\n\n /** Dim name */\n name?: (string|null);\n }\n}\n\n/** Properties of a Tensor. */\nexport declare interface ITensor {\n /** Tensor dtype */\n dtype?: (DataType|null);\n\n /** Tensor tensorShape */\n tensorShape?: (ITensorShape|null);\n\n /** Tensor versionNumber */\n versionNumber?: (number|null);\n\n /** Tensor tensorContent */\n tensorContent?: (Uint8Array|null);\n\n /** Tensor floatVal */\n floatVal?: (number[]|null);\n\n /** Tensor doubleVal */\n doubleVal?: (number[]|null);\n\n /** Tensor intVal */\n intVal?: (number[]|null);\n\n /** Tensor stringVal */\n stringVal?: (Uint8Array[]|null);\n\n /** Tensor scomplexVal */\n scomplexVal?: (number[]|null);\n\n /** Tensor int64Val */\n int64Val?: ((number | string)[]|null);\n\n /** Tensor boolVal */\n boolVal?: (boolean[]|null);\n\n /** Tensor uint32Val */\n uint32Val?: (number[]|null);\n\n /** Tensor uint64Val */\n uint64Val?: ((number | string)[]|null);\n}\n\n/** Properties of an AttrValue. */\nexport declare interface IAttrValue {\n /** AttrValue list */\n list?: (AttrValue.IListValue|null);\n\n /** AttrValue s */\n s?: (string|null);\n\n /** AttrValue i */\n i?: (number|string|null);\n\n /** AttrValue f */\n f?: (number|null);\n\n /** AttrValue b */\n b?: (boolean|null);\n\n /** AttrValue type */\n type?: (DataType|null);\n\n /** AttrValue shape */\n shape?: (ITensorShape|null);\n\n /** AttrValue tensor */\n tensor?: (ITensor|null);\n\n /** AttrValue placeholder */\n placeholder?: (string|null);\n\n /** AttrValue func */\n func?: (INameAttrList|null);\n}\n\nexport namespace AttrValue {\n /** Properties of a ListValue. */\n export declare interface IListValue {\n /** ListValue s */\n s?: (string[]|null);\n\n /** ListValue i */\n i?: ((number | string)[]|null);\n\n /** ListValue f */\n f?: (number[]|null);\n\n /** ListValue b */\n b?: (boolean[]|null);\n\n /** ListValue type */\n type?: (DataType[]|null);\n\n /** ListValue shape */\n shape?: (ITensorShape[]|null);\n\n /** ListValue tensor */\n tensor?: (ITensor[]|null);\n\n /** ListValue func */\n func?: (INameAttrList[]|null);\n }\n}\n\n/** Properties of a NameAttrList. */\nexport declare interface INameAttrList {\n /** NameAttrList name */\n name?: (string|null);\n\n /** NameAttrList attr */\n attr?: ({[k: string]: IAttrValue}|null);\n}\n\n/** Properties of a NodeDef. */\nexport declare interface INodeDef {\n /** NodeDef name */\n name?: (string|null);\n\n /** NodeDef op */\n op?: (string|null);\n\n /** NodeDef input */\n input?: (string[]|null);\n\n /** NodeDef device */\n device?: (string|null);\n\n /** NodeDef attr */\n attr?: ({[k: string]: IAttrValue}|null);\n}\n\n/** Properties of a VersionDef. */\nexport declare interface IVersionDef {\n /** VersionDef producer */\n producer?: (number|null);\n\n /** VersionDef minConsumer */\n minConsumer?: (number|null);\n\n /** VersionDef badConsumers */\n badConsumers?: (number[]|null);\n}\n\n/** Properties of a GraphDef. */\nexport declare interface IGraphDef {\n /** GraphDef node */\n node?: (INodeDef[]|null);\n\n /** GraphDef versions */\n versions?: (IVersionDef|null);\n\n /** GraphDef library */\n library?: (IFunctionDefLibrary|null);\n}\n\n/** Properties of a CollectionDef. */\nexport declare interface ICollectionDef {\n /** CollectionDef nodeList */\n nodeList?: (CollectionDef.INodeList|null);\n\n /** CollectionDef bytesList */\n bytesList?: (CollectionDef.IBytesList|null);\n\n /** CollectionDef int64List */\n int64List?: (CollectionDef.IInt64List|null);\n\n /** CollectionDef floatList */\n floatList?: (CollectionDef.IFloatList|null);\n\n /** CollectionDef anyList */\n anyList?: (CollectionDef.IAnyList|null);\n}\n\nexport namespace CollectionDef {\n /** Properties of a NodeList. */\n export declare interface INodeList {\n /** NodeList value */\n value?: (string[]|null);\n }\n\n /** Properties of a BytesList. */\n export declare interface IBytesList {\n /** BytesList value */\n value?: (Uint8Array[]|null);\n }\n\n /** Properties of an Int64List. */\n export declare interface IInt64List {\n /** Int64List value */\n value?: ((number | string)[]|null);\n }\n\n /** Properties of a FloatList. */\n export declare interface IFloatList {\n /** FloatList value */\n value?: (number[]|null);\n }\n\n /** Properties of an AnyList. */\n export declare interface IAnyList {\n /** AnyList value */\n value?: (IAny[]|null);\n }\n}\n\n/** Properties of a SaverDef. */\nexport declare interface ISaverDef {\n /** SaverDef filenameTensorName */\n filenameTensorName?: (string|null);\n\n /** SaverDef saveTensorName */\n saveTensorName?: (string|null);\n\n /** SaverDef restoreOpName */\n restoreOpName?: (string|null);\n\n /** SaverDef maxToKeep */\n maxToKeep?: (number|null);\n\n /** SaverDef sharded */\n sharded?: (boolean|null);\n\n /** SaverDef keepCheckpointEveryNHours */\n keepCheckpointEveryNHours?: (number|null);\n\n /** SaverDef version */\n version?: (SaverDef.CheckpointFormatVersion|null);\n}\n\nexport namespace SaverDef {\n /** CheckpointFormatVersion enum. */\n export enum CheckpointFormatVersion {'LEGACY' = 0, 'V1' = 1, 'V2' = 2}\n}\n\n/** Properties of a TensorInfo. */\nexport declare interface ITensorInfo {\n /** TensorInfo name */\n name?: (string|null);\n\n /** TensorInfo cooSparse */\n cooSparse?: (TensorInfo.ICooSparse|null);\n\n /** TensorInfo dtype */\n dtype?: (DataType|string|null);\n\n /** TensorInfo tensorShape */\n tensorShape?: (ITensorShape|null);\n\n /** Resource id tensor was originally assigned to. */\n resourceId?: (number|null);\n}\n\nexport namespace TensorInfo {\n /** Properties of a CooSparse. */\n export declare interface ICooSparse {\n /** CooSparse valuesTensorName */\n valuesTensorName?: (string|null);\n\n /** CooSparse indicesTensorName */\n indicesTensorName?: (string|null);\n\n /** CooSparse denseShapeTensorName */\n denseShapeTensorName?: (string|null);\n }\n}\n\n/** Properties of a SignatureDef. */\nexport declare interface ISignatureDef {\n /** SignatureDef inputs */\n inputs?: ({[k: string]: ITensorInfo}|null);\n\n /** SignatureDef outputs */\n outputs?: ({[k: string]: ITensorInfo}|null);\n\n /** SignatureDef methodName */\n methodName?: (string|null);\n}\n\n/** Properties of an AssetFileDef. */\nexport declare interface IAssetFileDef {\n /** AssetFileDef tensorInfo */\n tensorInfo?: (ITensorInfo|null);\n\n /** AssetFileDef filename */\n filename?: (string|null);\n}\n\n/** Properties of an OpDef. */\nexport declare interface IOpDef {\n /** OpDef name */\n name?: (string|null);\n\n /** OpDef inputArg */\n inputArg?: (OpDef.IArgDef[]|null);\n\n /** OpDef outputArg */\n outputArg?: (OpDef.IArgDef[]|null);\n\n /** OpDef attr */\n attr?: (OpDef.IAttrDef[]|null);\n\n /** OpDef deprecation */\n deprecation?: (OpDef.IOpDeprecation|null);\n\n /** OpDef summary */\n summary?: (string|null);\n\n /** OpDef description */\n description?: (string|null);\n\n /** OpDef isCommutative */\n isCommutative?: (boolean|null);\n\n /** OpDef isAggregate */\n isAggregate?: (boolean|null);\n\n /** OpDef isStateful */\n isStateful?: (boolean|null);\n\n /** OpDef allowsUninitializedInput */\n allowsUninitializedInput?: (boolean|null);\n}\n\nexport namespace OpDef {\n /** Properties of an ArgDef. */\n export declare interface IArgDef {\n /** ArgDef name */\n name?: (string|null);\n\n /** ArgDef description */\n description?: (string|null);\n\n /** ArgDef type */\n type?: (DataType|null);\n\n /** ArgDef typeAttr */\n typeAttr?: (string|null);\n\n /** ArgDef numberAttr */\n numberAttr?: (string|null);\n\n /** ArgDef typeListAttr */\n typeListAttr?: (string|null);\n\n /** ArgDef isRef */\n isRef?: (boolean|null);\n }\n\n /** Properties of an AttrDef. */\n export declare interface IAttrDef {\n /** AttrDef name */\n name?: (string|null);\n\n /** AttrDef type */\n type?: (string|null);\n\n /** AttrDef defaultValue */\n defaultValue?: (IAttrValue|null);\n\n /** AttrDef description */\n description?: (string|null);\n\n /** AttrDef hasMinimum */\n hasMinimum?: (boolean|null);\n\n /** AttrDef minimum */\n minimum?: (number|string|null);\n\n /** AttrDef allowedValues */\n allowedValues?: (IAttrValue|null);\n }\n\n /** Properties of an OpDeprecation. */\n export declare interface IOpDeprecation {\n /** OpDeprecation version */\n version?: (number|null);\n\n /** OpDeprecation explanation */\n explanation?: (string|null);\n }\n}\n\n/** Properties of an OpList. */\nexport declare interface IOpList {\n /** OpList op */\n op?: (IOpDef[]|null);\n}\n\n/** Properties of a MetaGraphDef. */\nexport declare interface IMetaGraphDef {\n /** MetaGraphDef metaInfoDef */\n metaInfoDef?: (MetaGraphDef.IMetaInfoDef|null);\n\n /** MetaGraphDef graphDef */\n graphDef?: (IGraphDef|null);\n\n /** MetaGraphDef saverDef */\n saverDef?: (ISaverDef|null);\n\n /** MetaGraphDef collectionDef */\n collectionDef?: ({[k: string]: ICollectionDef}|null);\n\n /** MetaGraphDef signatureDef */\n signatureDef?: ({[k: string]: ISignatureDef}|null);\n\n /** MetaGraphDef assetFileDef */\n assetFileDef?: (IAssetFileDef[]|null);\n}\n\nexport namespace MetaGraphDef {\n /** Properties of a MetaInfoDef. */\n export declare interface IMetaInfoDef {\n /** MetaInfoDef metaGraphVersion */\n metaGraphVersion?: (string|null);\n\n /** MetaInfoDef strippedOpList */\n strippedOpList?: (IOpList|null);\n\n /** MetaInfoDef anyInfo */\n anyInfo?: (IAny|null);\n\n /** MetaInfoDef tags */\n tags?: (string[]|null);\n\n /** MetaInfoDef tensorflowVersion */\n tensorflowVersion?: (string|null);\n\n /** MetaInfoDef tensorflowGitVersion */\n tensorflowGitVersion?: (string|null);\n }\n}\n\n/** Properties of a SavedModel. */\nexport declare interface ISavedModel {\n /** SavedModel savedModelSchemaVersion */\n savedModelSchemaVersion?: (number|string|null);\n\n /** SavedModel metaGraphs */\n metaGraphs?: (IMetaGraphDef[]|null);\n}\n\n/** Properties of a FunctionDefLibrary. */\nexport declare interface IFunctionDefLibrary {\n /** FunctionDefLibrary function */\n 'function'?: (IFunctionDef[]|null);\n\n /** FunctionDefLibrary gradient */\n gradient?: (IGradientDef[]|null);\n}\n\n/** Properties of a FunctionDef. */\nexport declare interface IFunctionDef {\n /** FunctionDef signature */\n signature?: (IOpDef|null);\n\n /** FunctionDef attr */\n attr?: ({[k: string]: IAttrValue}|null);\n\n /** FunctionDef nodeDef */\n nodeDef?: (INodeDef[]|null);\n\n /** FunctionDef ret */\n ret?: ({[k: string]: string}|null);\n}\n\n/** Properties of a GradientDef. */\nexport declare interface IGradientDef {\n /** GradientDef functionName */\n functionName?: (string|null);\n\n /** GradientDef gradientFunc */\n gradientFunc?: (string|null);\n}\n","\n/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpExecutor, OpMapper} from '../types';\n\nconst CUSTOM_OPS: {[key: string]: OpMapper} = {};\n\n/**\n * Register an Op for graph model executor. This allows you to register\n * TensorFlow custom op or override existing op.\n *\n * Here is an example of registering a new MatMul Op.\n * ```js\n * const customMatmul = (node) =>\n * tf.matMul(\n * node.inputs[0], node.inputs[1],\n * node.attrs['transpose_a'], node.attrs['transpose_b']);\n *\n * tf.registerOp('MatMul', customMatmul);\n * ```\n * The inputs and attrs of the node object are based on the TensorFlow op\n * registry.\n *\n * @param name The Tensorflow Op name.\n * @param opFunc An op function which is called with the current graph node\n * during execution and needs to return a tensor or a list of tensors. The node\n * has the following attributes:\n * - attr: A map from attribute name to its value\n * - inputs: A list of input tensors\n *\n * @doc {heading: 'Models', subheading: 'Op Registry'}\n */\nexport function registerOp(name: string, opFunc: OpExecutor) {\n const opMapper: OpMapper = {\n tfOpName: name,\n category: 'custom',\n inputs: [],\n attrs: [],\n customExecutor: opFunc\n };\n\n CUSTOM_OPS[name] = opMapper;\n}\n\n/**\n * Retrieve the OpMapper object for the registered op.\n *\n * @param name The Tensorflow Op name.\n *\n * @doc {heading: 'Models', subheading: 'Op Registry'}\n */\nexport function getRegisteredOp(name: string): OpMapper {\n return CUSTOM_OPS[name];\n}\n\n/**\n * Deregister the Op for graph model executor.\n *\n * @param name The Tensorflow Op name.\n *\n * @doc {heading: 'Models', subheading: 'Op Registry'}\n */\nexport function deregisterOp(name: string) {\n delete CUSTOM_OPS[name];\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {clone, Tensor, util} from '@tensorflow/tfjs-core';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {ResourceManager} from '../../executor/resource_manager';\nimport {Node, ValueType} from '../types';\n\nexport function getParamValue(\n paramName: string, node: Node, tensorMap: NamedTensorsMap,\n context: ExecutionContext, resourceManager?: ResourceManager): ValueType {\n const inputParam = node.inputParams[paramName];\n if (inputParam && inputParam.inputIndexStart !== undefined) {\n const start = inputParam.inputIndexStart;\n const end = inputParam.inputIndexEnd === 0 ?\n undefined :\n (inputParam.inputIndexEnd === undefined ? start + 1 :\n inputParam.inputIndexEnd);\n if (inputParam.type === 'tensor') {\n return getTensor(\n node.inputNames[inputParam.inputIndexStart], tensorMap, context,\n resourceManager);\n }\n if (inputParam.type === 'tensors') {\n const inputs = node.inputNames.slice(start, end);\n\n return inputs.map(\n name => getTensor(name, tensorMap, context, resourceManager));\n }\n const tensor = getTensor(\n node.inputNames.slice(start)[0], tensorMap, context, resourceManager);\n const data = tensor.dataSync();\n return inputParam.type === 'number' ?\n data[0] :\n util.toNestedArray(tensor.shape, data);\n }\n const attrParam = node.attrParams[paramName];\n return attrParam && attrParam.value;\n}\n\n/**\n * Retrieve the tensor from tensorsMap based on input name.\n * @param name Node input name\n * @param tensorsMap Tensors map keyed by the node\n * @param context contains tensors and information for running the current node.\n * @param resourceManager Optional. Contains global resources of the model.\n */\nexport function getTensor(\n name: string, tensorsMap: NamedTensorsMap, context: ExecutionContext,\n resourceManager?: ResourceManager): Tensor {\n const [nodeName, index] = parseNodeName(name);\n\n if (resourceManager != null) {\n const tensor = resourceManager.getHashTableHandleByName(nodeName);\n if (tensor != null) {\n return tensor;\n }\n }\n\n const contextId = context.currentContextIds.find(contextId => {\n return !!tensorsMap[getNodeNameWithContextId(nodeName, contextId)];\n });\n\n return contextId !== undefined ?\n tensorsMap[getNodeNameWithContextId(nodeName, contextId)][index] :\n undefined;\n}\n\n/**\n * Retrieve the tensors based on input name for current context.\n * @param name Node input name\n * @param tensorsMap Tensors map keyed by the node\n */\nexport function getTensorsForCurrentContenxt(\n name: string, tensorsMap: NamedTensorsMap,\n context: ExecutionContext): Tensor[] {\n return tensorsMap[getNodeNameWithContextId(name, context.currentContextId)];\n}\n\n/**\n * Returns the node name, outputName and index from the Node input name.\n * @param inputName The input name of the node, in format of\n * node_name:output_index, i.e. MatMul:0, if the output_index is not set, it is\n * default to 0.\n * If the input name contains output name i.e. StringSplit:indices:0, it will\n * return ['StringSplit', 0, 'indices'].\n */\nexport function getNodeNameAndIndex(\n inputName: string, context?: ExecutionContext): [string, number, string] {\n const [nodeName, index, outputName] = parseNodeName(inputName);\n\n return [\n getNodeNameWithContextId(nodeName, context && context.currentContextId),\n index, outputName\n ];\n}\n\nfunction getNodeNameWithContextId(name: string, contextId?: string): string {\n return !!contextId ? `${name}-${contextId}` : name;\n}\n\nexport function parseNodeName(name: string): [string, number, string] {\n const parts = name.split(':');\n if (parts.length === 1) {\n return [name, 0, undefined];\n }\n\n const nodeName = parts[0];\n const outputName = parts.length === 3 ? parts[1] : undefined;\n const index = Number(parts[parts.length - 1]);\n return [nodeName, index, outputName];\n}\n\nexport function split(arr: number[], size: number) {\n const res = [];\n for (let i = 0; i < arr.length; i += size) {\n res.push(arr.slice(i, i + size));\n }\n return res;\n}\nexport function getPadding(\n node: Node, tensorMap: NamedTensorsMap,\n context: ExecutionContext): ValueType {\n let pad = getParamValue('pad', node, tensorMap, context);\n if (pad === 'explicit') {\n // This is 1d array, we need to convert it to 2d array\n pad = getParamValue('explicitPaddings', node, tensorMap, context);\n const explicitPadding: [\n [number, number], [number, number], [number, number], [number, number]\n ] = [[0, 0], [0, 0], [0, 0], [0, 0]];\n for (let i = 0; i < 4; i++) {\n explicitPadding[i][0] = (pad as number[])[i * 2];\n explicitPadding[i][1] = (pad as number[])[i * 2 + 1];\n }\n return explicitPadding;\n }\n return pad;\n}\n\n/**\n * Reuse the tensor if it is marked as keep, otherwise clone the tensor to\n * avoid disposal. This is important for TensorArray and TensorList ops, since\n * internally they use a tensor as the id for TensorArray and TensorList, and\n * to simplify lookup, they also use Tensor.id as the key to the internal map.\n * These id tensors have been marked as kept in the backend, we need avoid clone\n * them in order to create new Tensor.id.\n * @param tensor\n */\nexport function cloneTensor(tensor: Tensor): Tensor {\n return tensor.kept ? tensor : clone(tensor);\n}\n","\n/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpMapper} from '../types';\n\nexport const json: OpMapper[] = [\n {\n 'tfOpName': 'Add',\n 'category': 'arithmetic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'AddV2',\n 'category': 'arithmetic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'AddN',\n 'category': 'arithmetic',\n 'inputs': [\n {\n 'start': 0,\n 'end': 0,\n 'name': 'tensors',\n 'type': 'tensors'\n }\n ]\n },\n {\n 'tfOpName': 'BiasAdd',\n 'category': 'arithmetic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n },\n {\n 'tfName': 'data_format',\n 'name': 'dataFormat',\n 'type': 'string',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Sub',\n 'category': 'arithmetic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'RealDiv',\n 'category': 'arithmetic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Div',\n 'category': 'arithmetic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'DivNoNan',\n 'category': 'arithmetic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'FloorDiv',\n 'category': 'arithmetic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Mul',\n 'category': 'arithmetic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Maximum',\n 'category': 'arithmetic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Minimum',\n 'category': 'arithmetic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Pow',\n 'category': 'arithmetic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'SquaredDifference',\n 'category': 'arithmetic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Mod',\n 'category': 'arithmetic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'FloorMod',\n 'category': 'arithmetic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n }\n];\n","\n/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpMapper} from '../types';\n\nexport const json: OpMapper[] = [\n {\n 'tfOpName': 'Abs',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Acos',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Asin',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Atan',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Atan2',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'y',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Ceil',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'ClipByValue',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'clipValueMin',\n 'type': 'number'\n },\n {\n 'start': 2,\n 'name': 'clipValueMax',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Complex',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'real',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'imag',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'ComplexAbs',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Cos',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Cosh',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Elu',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Exp',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Floor',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Log',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Imag',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n },\n {\n 'tfName': 'Tout',\n 'name': 'outputType',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Neg',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Real',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n },\n {\n 'tfName': 'Tout',\n 'name': 'outputType',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Prelu',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'alpha',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Relu',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Relu6',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Selu',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Sigmoid',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Sin',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Sinh',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Sqrt',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Rsqrt',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Square',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Tan',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Tanh',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Sign',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Round',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Expm1',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Log1p',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Reciprocal',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Softplus',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Asinh',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Acosh',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Atanh',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Erf',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Prod',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'axes',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'keep_dims',\n 'name': 'keepDims',\n 'type': 'bool',\n 'notSupported': true\n },\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'LeakyRelu',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'alpha',\n 'name': 'alpha',\n 'type': 'number',\n 'defaultValue': 0.2\n },\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'IsNan',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n }\n];\n","\n/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpMapper} from '../types';\n\nexport const json: OpMapper[] = [\n {\n 'tfOpName': 'EmptyTensorList',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'elementShape',\n 'type': 'shape'\n },\n {\n 'start': 1,\n 'name': 'maxNumElements',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'element_dtype',\n 'name': 'elementDType',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'LoopCond',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'pred',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'Switch',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'data',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'pred',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'Merge',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'end': 0,\n 'name': 'tensors',\n 'type': 'tensors'\n }\n ]\n },\n {\n 'tfOpName': 'Enter',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensor',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n },\n {\n 'tfName': 'frame_name',\n 'name': 'frameName',\n 'type': 'string'\n },\n {\n 'tfName': 'is_constant',\n 'name': 'isConstant',\n 'type': 'bool'\n }\n ]\n },\n {\n 'tfOpName': 'Exit',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensor',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'NextIteration',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensor',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'TensorArrayV3',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'size',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'dtype',\n 'name': 'dtype',\n 'type': 'dtype'\n },\n {\n 'tfName': 'element_shape',\n 'name': 'elementShape',\n 'type': 'shape'\n },\n {\n 'tfName': 'dynamic_size',\n 'name': 'dynamicSize',\n 'type': 'bool'\n },\n {\n 'tfName': 'clear_after_read',\n 'name': 'clearAfterRead',\n 'type': 'bool'\n },\n {\n 'tfName': 'identical_element_shapes',\n 'name': 'identicalElementShapes',\n 'type': 'bool'\n },\n {\n 'tfName': 'tensor_array_name',\n 'name': 'name',\n 'type': 'string'\n }\n ]\n },\n {\n 'tfOpName': 'TensorArrayWriteV3',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensorArrayId',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'index',\n 'type': 'number'\n },\n {\n 'start': 2,\n 'name': 'tensor',\n 'type': 'tensor'\n },\n {\n 'start': 3,\n 'name': 'flowIn',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'TensorArrayReadV3',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensorArrayId',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'index',\n 'type': 'number'\n },\n {\n 'start': 2,\n 'name': 'flowIn',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'dtype',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'TensorArrayGatherV3',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensorArrayId',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'indices',\n 'type': 'number[]'\n },\n {\n 'start': 2,\n 'name': 'flowIn',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'dtype',\n 'name': 'dtype',\n 'type': 'dtype'\n },\n {\n 'tfName': 'element_shape',\n 'name': 'elementShape',\n 'type': 'shape'\n }\n ]\n },\n {\n 'tfOpName': 'TensorArrayScatterV3',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensorArrayId',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'indices',\n 'type': 'number[]'\n },\n {\n 'start': 2,\n 'name': 'tensor',\n 'type': 'tensor'\n },\n {\n 'start': 3,\n 'name': 'flowIn',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'TensorArrayConcatV3',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensorArrayId',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'flowIn',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'dtype',\n 'name': 'dtype',\n 'type': 'dtype'\n },\n {\n 'tfName': 'element_shape_except0',\n 'name': 'elementShapeExcept0',\n 'type': 'shape',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'TensorArraySplitV3',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensorArrayId',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'tensor',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'lengths',\n 'type': 'number[]'\n },\n {\n 'start': 3,\n 'name': 'flowIn',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'TensorArraySizeV3',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensorArrayId',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'flowIn',\n 'type': 'number'\n }\n ]\n },\n {\n 'tfOpName': 'TensorArrayCloseV3',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensorArrayId',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'StatelessIf',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'cond',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'end': 0,\n 'name': 'args',\n 'type': 'tensors'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'then_branch',\n 'name': 'thenBranch',\n 'type': 'func'\n },\n {\n 'tfName': 'else_branch',\n 'name': 'elseBranch',\n 'type': 'func'\n }\n ]\n },\n {\n 'tfOpName': 'If',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'cond',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'end': 0,\n 'name': 'args',\n 'type': 'tensors'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'then_branch',\n 'name': 'thenBranch',\n 'type': 'func'\n },\n {\n 'tfName': 'else_branch',\n 'name': 'elseBranch',\n 'type': 'func'\n }\n ]\n },\n {\n 'tfOpName': 'StatelessWhile',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'end': 0,\n 'name': 'args',\n 'type': 'tensors'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'cond',\n 'name': 'cond',\n 'type': 'func'\n },\n {\n 'tfName': 'body',\n 'name': 'body',\n 'type': 'func'\n }\n ]\n },\n {\n 'tfOpName': 'While',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'end': 0,\n 'name': 'args',\n 'type': 'tensors'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'cond',\n 'name': 'cond',\n 'type': 'func'\n },\n {\n 'tfName': 'body',\n 'name': 'body',\n 'type': 'func'\n }\n ]\n },\n {\n 'tfOpName': 'TensorListScatter',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensor',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'indices',\n 'type': 'number[]'\n },\n {\n 'start': 2,\n 'name': 'elementShape',\n 'type': 'shape'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'element_dtype',\n 'name': 'elementDType',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'TensorListScatterV2',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensor',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'indices',\n 'type': 'number[]'\n },\n {\n 'start': 2,\n 'name': 'elementShape',\n 'type': 'shape'\n },\n {\n 'start': 3,\n 'name': 'numElements',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'element_dtype',\n 'name': 'elementDType',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'TensorListGather',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensorListId',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'indices',\n 'type': 'number[]'\n },\n {\n 'start': 2,\n 'name': 'elementShape',\n 'type': 'shape'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'element_dtype',\n 'name': 'elementDType',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'TensorListGetItem',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensorListId',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'index',\n 'type': 'number'\n },\n {\n 'start': 2,\n 'name': 'elementShape',\n 'type': 'shape'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'element_dtype',\n 'name': 'elementDType',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'TensorListSetItem',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensorListId',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'index',\n 'type': 'number'\n },\n {\n 'start': 2,\n 'name': 'tensor',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'element_dtype',\n 'name': 'elementDType',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'TensorListReserve',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'elementShape',\n 'type': 'shape'\n },\n {\n 'start': 1,\n 'name': 'numElements',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'element_dtype',\n 'name': 'elementDType',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'TensorListFromTensor',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensor',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'elementShape',\n 'type': 'shape'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'element_dtype',\n 'name': 'elementDType',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'TensorListStack',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensorListId',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'elementShape',\n 'type': 'shape'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'element_dtype',\n 'name': 'elementDType',\n 'type': 'dtype'\n },\n {\n 'tfName': 'num_elements',\n 'name': 'numElements',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'TensorListSplit',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensor',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'elementShape',\n 'type': 'shape'\n },\n {\n 'start': 2,\n 'name': 'lengths',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'element_dtype',\n 'name': 'elementDType',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'TensorListConcat',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensorListId',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'element_shape',\n 'name': 'elementShape',\n 'type': 'shape'\n },\n {\n 'tfName': 'element_dtype',\n 'name': 'elementDType',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'TensorListConcatV2',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensorListId',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'element_shape',\n 'name': 'elementShape',\n 'type': 'shape'\n },\n {\n 'tfName': 'element_dtype',\n 'name': 'elementDType',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'TensorListPopBack',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensorListId',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'elementShape',\n 'type': 'shape'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'element_dtype',\n 'name': 'elementDType',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'TensorListPushBack',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensorListId',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'tensor',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'element_dtype',\n 'name': 'elementDType',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'TensorListLength',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensorListId',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'TensorListResize',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensorListId',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'size',\n 'type': 'number'\n }\n ]\n }\n]\n;\n","\n/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpMapper} from '../types';\n\nexport const json: OpMapper[] = [\n {\n 'tfOpName': 'AvgPool',\n 'category': 'convolution',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'strides',\n 'name': 'strides',\n 'type': 'number[]'\n },\n {\n 'tfName': 'padding',\n 'name': 'pad',\n 'type': 'string'\n },\n {\n 'tfName': 'data_format',\n 'name': 'dataFormat',\n 'type': 'string',\n 'notSupported': true\n },\n {\n 'tfName': 'ksize',\n 'name': 'kernelSize',\n 'type': 'number[]'\n },\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'MaxPool',\n 'category': 'convolution',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'strides',\n 'name': 'strides',\n 'type': 'number[]'\n },\n {\n 'tfName': 'padding',\n 'name': 'pad',\n 'type': 'string'\n },\n {\n 'tfName': 'data_format',\n 'name': 'dataFormat',\n 'type': 'string',\n 'notSupported': true\n },\n {\n 'tfName': 'ksize',\n 'name': 'kernelSize',\n 'type': 'number[]'\n },\n {\n 'tfName': 'explicit_paddings',\n 'name': 'explicitPaddings',\n 'type': 'number[]',\n 'defaultValue': [],\n 'notSupported': true\n },\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'MaxPoolWithArgmax',\n 'category': 'convolution',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'strides',\n 'name': 'strides',\n 'type': 'number[]'\n },\n {\n 'tfName': 'padding',\n 'name': 'pad',\n 'type': 'string'\n },\n {\n 'tfName': 'ksize',\n 'name': 'kernelSize',\n 'type': 'number[]'\n },\n {\n 'tfName': 'include_batch_in_index',\n 'name': 'includeBatchInIndex',\n 'type': 'bool'\n },\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'AvgPool3D',\n 'category': 'convolution',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'strides',\n 'name': 'strides',\n 'type': 'number[]'\n },\n {\n 'tfName': 'padding',\n 'name': 'pad',\n 'type': 'string'\n },\n {\n 'tfName': 'data_format',\n 'name': 'dataFormat',\n 'type': 'string',\n 'notSupported': true\n },\n {\n 'tfName': 'ksize',\n 'name': 'kernelSize',\n 'type': 'number[]'\n },\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'MaxPool3D',\n 'category': 'convolution',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'strides',\n 'name': 'strides',\n 'type': 'number[]'\n },\n {\n 'tfName': 'padding',\n 'name': 'pad',\n 'type': 'string'\n },\n {\n 'tfName': 'data_format',\n 'name': 'dataFormat',\n 'type': 'string',\n 'notSupported': true\n },\n {\n 'tfName': 'ksize',\n 'name': 'kernelSize',\n 'type': 'number[]'\n },\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Conv1D',\n 'category': 'convolution',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'filter',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'stride',\n 'name': 'stride',\n 'type': 'number'\n },\n {\n 'tfName': 'padding',\n 'name': 'pad',\n 'type': 'string'\n },\n {\n 'tfName': 'data_format',\n 'name': 'dataFormat',\n 'type': 'string',\n 'defaultValue': 'NWC'\n },\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n },\n {\n 'tfName': 'dilation',\n 'name': 'dilation',\n 'type': 'number',\n 'defaultValue': 1\n }\n ]\n },\n {\n 'tfOpName': 'Conv2D',\n 'category': 'convolution',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'filter',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n },\n {\n 'tfName': 'strides',\n 'name': 'strides',\n 'type': 'number[]'\n },\n {\n 'tfName': 'padding',\n 'name': 'pad',\n 'type': 'string'\n },\n {\n 'tfName': 'useCudnnOnGpu',\n 'name': 'useCudnnOnGpu',\n 'type': 'bool'\n },\n {\n 'tfName': 'data_format',\n 'name': 'dataFormat',\n 'type': 'string',\n 'defaultValue': 'NHWC'\n },\n {\n 'tfName': 'explicit_paddings',\n 'name': 'explicitPaddings',\n 'type': 'number[]',\n 'defaultValue': []\n },\n {\n 'tfName': 'dilations',\n 'name': 'dilations',\n 'type': 'number[]'\n }\n ]\n },\n {\n 'tfOpName': '_FusedConv2D',\n 'category': 'convolution',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'filter',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'end': 0,\n 'name': 'args',\n 'type': 'tensors'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'num_args',\n 'name': 'numArgs',\n 'type': 'number'\n },\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n },\n {\n 'tfName': 'strides',\n 'name': 'strides',\n 'type': 'number[]'\n },\n {\n 'tfName': 'padding',\n 'name': 'pad',\n 'type': 'string'\n },\n {\n 'tfName': 'explicit_paddings',\n 'name': 'explicitPaddings',\n 'type': 'number[]',\n 'defaultValue': []\n },\n {\n 'tfName': 'use_cudnn_on_gpu',\n 'name': 'useCudnnOnGpu',\n 'type': 'bool',\n 'defaultValue': true\n },\n {\n 'tfName': 'data_format',\n 'name': 'dataFormat',\n 'type': 'string',\n 'defaultValue': 'NHWC'\n },\n {\n 'tfName': 'dilations',\n 'name': 'dilations',\n 'type': 'number[]',\n 'defaultValue': [\n 1,\n 1,\n 1,\n 1\n ]\n },\n {\n 'tfName': 'fused_ops',\n 'name': 'fusedOps',\n 'type': 'string[]',\n 'defaultValue': []\n },\n {\n 'tfName': 'epsilon',\n 'name': 'epsilon',\n 'type': 'number',\n 'defaultValue': 0.0001\n },\n {\n 'tfName': 'leakyrelu_alpha',\n 'name': 'leakyreluAlpha',\n 'type': 'number',\n 'defaultValue': 0.2\n }\n ]\n },\n {\n 'tfOpName': 'Conv2DBackpropInput',\n 'category': 'convolution',\n 'inputs': [\n {\n 'start': 2,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'filter',\n 'type': 'tensor'\n },\n {\n 'start': 0,\n 'name': 'outputShape',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'strides',\n 'name': 'strides',\n 'type': 'number[]'\n },\n {\n 'tfName': 'padding',\n 'name': 'pad',\n 'type': 'string'\n },\n {\n 'tfName': 'data_format',\n 'name': 'dataFormat',\n 'type': 'string',\n 'notSupported': true\n },\n {\n 'tfName': 'explicit_paddings',\n 'name': 'explicitPaddings',\n 'type': 'number[]',\n 'defaultValue': []\n },\n {\n 'tfName': 'dilations',\n 'name': 'dilations',\n 'type': 'number[]',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'DepthwiseConv2d',\n 'category': 'convolution',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'input',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'filter',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'strides',\n 'name': 'strides',\n 'type': 'number[]'\n },\n {\n 'tfName': 'padding',\n 'name': 'pad',\n 'type': 'string'\n },\n {\n 'tfName': 'data_format',\n 'name': 'dataFormat',\n 'type': 'string',\n 'defaultValue': 'NHWC'\n },\n {\n 'tfName': 'explicit_paddings',\n 'name': 'explicitPaddings',\n 'type': 'number[]',\n 'defaultValue': []\n },\n {\n 'tfName': 'dilations',\n 'name': 'dilations',\n 'type': 'number[]'\n }\n ]\n },\n {\n 'tfOpName': 'DepthwiseConv2dNative',\n 'category': 'convolution',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'input',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'filter',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'strides',\n 'name': 'strides',\n 'type': 'number[]'\n },\n {\n 'tfName': 'padding',\n 'name': 'pad',\n 'type': 'string'\n },\n {\n 'tfName': 'data_format',\n 'name': 'dataFormat',\n 'type': 'string',\n 'defaultValue': 'NHWC'\n },\n {\n 'tfName': 'explicit_paddings',\n 'name': 'explicitPaddings',\n 'type': 'number[]',\n 'defaultValue': []\n },\n {\n 'tfName': 'dilations',\n 'name': 'dilations',\n 'type': 'number[]'\n }\n ]\n },\n {\n 'tfOpName': 'FusedDepthwiseConv2dNative',\n 'category': 'convolution',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'filter',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'end': 0,\n 'name': 'args',\n 'type': 'tensors'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'num_args',\n 'name': 'numArgs',\n 'type': 'number'\n },\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n },\n {\n 'tfName': 'strides',\n 'name': 'strides',\n 'type': 'number[]'\n },\n {\n 'tfName': 'padding',\n 'name': 'pad',\n 'type': 'string'\n },\n {\n 'tfName': 'data_format',\n 'name': 'dataFormat',\n 'type': 'string',\n 'defaultValue': 'NHWC'\n },\n {\n 'tfName': 'dilations',\n 'name': 'dilations',\n 'type': 'number[]',\n 'defaultValue': [\n 1,\n 1,\n 1,\n 1\n ]\n },\n {\n 'tfName': 'fused_ops',\n 'name': 'fusedOps',\n 'type': 'string[]',\n 'defaultValue': []\n },\n {\n 'tfName': 'explicit_paddings',\n 'name': 'explicitPaddings',\n 'type': 'number[]',\n 'defaultValue': []\n }\n ]\n },\n {\n 'tfOpName': 'Conv3D',\n 'category': 'convolution',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'filter',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'strides',\n 'name': 'strides',\n 'type': 'number[]'\n },\n {\n 'tfName': 'padding',\n 'name': 'pad',\n 'type': 'string'\n },\n {\n 'tfName': 'data_format',\n 'name': 'dataFormat',\n 'type': 'string',\n 'defaultValue': 'NHWC'\n },\n {\n 'tfName': 'dilations',\n 'name': 'dilations',\n 'type': 'number[]'\n }\n ]\n },\n {\n 'tfOpName': 'Dilation2D',\n 'category': 'convolution',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'filter',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'strides',\n 'name': 'strides',\n 'type': 'number[]'\n },\n {\n 'tfName': 'rates',\n 'name': 'dilations',\n 'type': 'number[]'\n },\n {\n 'tfName': 'padding',\n 'name': 'pad',\n 'type': 'string'\n }\n ]\n }\n]\n;\n","\n/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpMapper} from '../types';\n\nexport const json: OpMapper[] = [\n {\n 'tfOpName': 'Fill',\n 'category': 'creation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'shape',\n 'type': 'number[]'\n },\n {\n 'start': 1,\n 'name': 'value',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'LinSpace',\n 'category': 'creation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'start',\n 'type': 'number'\n },\n {\n 'start': 1,\n 'name': 'stop',\n 'type': 'number'\n },\n {\n 'start': 2,\n 'name': 'num',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'OneHot',\n 'category': 'creation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'indices',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'depth',\n 'type': 'number'\n },\n {\n 'start': 2,\n 'name': 'onValue',\n 'type': 'number',\n 'defaultValue': 1\n },\n {\n 'start': 3,\n 'name': 'offValue',\n 'type': 'number',\n 'defaultValue': 0\n }\n ],\n 'attrs': [\n {\n 'tfName': 'axis',\n 'name': 'axis',\n 'type': 'number',\n 'notSupported': true\n },\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'Ones',\n 'category': 'creation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'shape',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'OnesLike',\n 'category': 'creation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'dtype',\n 'name': 'dtype',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'RandomStandardNormal',\n 'category': 'creation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'shape',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'seed',\n 'name': 'seed',\n 'type': 'number',\n 'defaultValue': 0\n },\n {\n 'tfName': 'seed2',\n 'name': 'seed2',\n 'type': 'number',\n 'defaultValue': 0,\n 'notSupported': true\n },\n {\n 'tfName': 'dtype',\n 'name': 'dtype',\n 'type': 'dtype'\n },\n {\n 'tfName': 'T',\n 'name': 'T',\n 'type': 'number',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'RandomUniform',\n 'category': 'creation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'shape',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'minval',\n 'name': 'minval',\n 'type': 'number',\n 'defaultValue': 0\n },\n {\n 'tfName': 'maxval',\n 'name': 'maxval',\n 'type': 'number',\n 'defaultValue': 1\n },\n {\n 'tfName': 'dtype',\n 'name': 'dtype',\n 'type': 'dtype'\n },\n {\n 'tfName': 'seed',\n 'name': 'seed',\n 'type': 'number',\n 'defaultValue': 0\n },\n {\n 'tfName': 'seed2',\n 'name': 'seed2',\n 'type': 'number',\n 'defaultValue': 0,\n 'notSupported': true\n },\n {\n 'tfName': 'T',\n 'name': 'T',\n 'type': 'number',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Range',\n 'category': 'creation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'start',\n 'type': 'number'\n },\n {\n 'start': 1,\n 'name': 'stop',\n 'type': 'number'\n },\n {\n 'start': 2,\n 'name': 'step',\n 'type': 'number',\n 'defaultValue': 0\n }\n ],\n 'attrs': [\n {\n 'tfName': 'Tidx',\n 'name': 'dtype',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'TruncatedNormal',\n 'category': 'creation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'shape',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'means',\n 'name': 'mean',\n 'type': 'number',\n 'defaultValue': 0\n },\n {\n 'tfName': 'stddev',\n 'name': 'stdDev',\n 'type': 'number',\n 'defaultValue': 1\n },\n {\n 'tfName': 'seed',\n 'name': 'seed',\n 'type': 'number'\n },\n {\n 'tfName': 'seed2',\n 'name': 'seed2',\n 'type': 'number',\n 'defaultValue': 0,\n 'notSupported': true\n },\n {\n 'tfName': 'dtype',\n 'name': 'dtype',\n 'type': 'dtype'\n },\n {\n 'tfName': 'T',\n 'name': 'T',\n 'type': 'number',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Zeros',\n 'category': 'creation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'shape',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'ZerosLike',\n 'category': 'creation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'Multinomial',\n 'category': 'creation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'logits',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'numSamples',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'seed',\n 'name': 'seed',\n 'type': 'number'\n },\n {\n 'tfName': 'seed2',\n 'name': 'seed2',\n 'type': 'number'\n },\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype'\n },\n {\n 'tfName': 'output_dtype',\n 'name': 'output_dtype',\n 'type': 'dtype'\n }\n ]\n }\n]\n;\n","\n/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpMapper} from '../types';\n\nexport const json: OpMapper[] = [\n {\n 'tfOpName': 'NonMaxSuppressionV2',\n 'category': 'dynamic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'boxes',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'scores',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'maxOutputSize',\n 'type': 'number'\n },\n {\n 'start': 3,\n 'name': 'iouThreshold',\n 'type': 'number'\n }\n ]\n },\n {\n 'tfOpName': 'NonMaxSuppressionV3',\n 'category': 'dynamic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'boxes',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'scores',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'maxOutputSize',\n 'type': 'number'\n },\n {\n 'start': 3,\n 'name': 'iouThreshold',\n 'type': 'number'\n },\n {\n 'start': 4,\n 'name': 'scoreThreshold',\n 'type': 'number'\n }\n ]\n },\n {\n 'tfOpName': 'NonMaxSuppressionV4',\n 'category': 'dynamic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'boxes',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'scores',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'maxOutputSize',\n 'type': 'number'\n },\n {\n 'start': 3,\n 'name': 'iouThreshold',\n 'type': 'number'\n },\n {\n 'start': 4,\n 'name': 'scoreThreshold',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n },\n {\n 'tfName': 'T_threshold',\n 'name': 'threshold',\n 'type': 'dtype',\n 'notSupported': true\n },\n {\n 'tfName': 'pad_to_max_output_size',\n 'name': 'padToMaxOutputSize',\n 'type': 'bool'\n }\n ]\n },\n {\n 'tfOpName': 'NonMaxSuppressionV5',\n 'category': 'dynamic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'boxes',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'scores',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'maxOutputSize',\n 'type': 'number'\n },\n {\n 'start': 3,\n 'name': 'iouThreshold',\n 'type': 'number'\n },\n {\n 'start': 4,\n 'name': 'scoreThreshold',\n 'type': 'number'\n },\n {\n 'start': 5,\n 'name': 'softNmsSigma',\n 'type': 'number'\n }\n ]\n },\n {\n 'tfOpName': 'Where',\n 'category': 'dynamic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'condition',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'ListDiff',\n 'category': 'dynamic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'y',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n }\n];\n","\n/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpMapper} from '../types';\n\nexport const json: OpMapper[] = [\n {\n 'tfOpName': 'LowerBound',\n 'category': 'evaluation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'sortedSequence',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'values',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'TopKV2',\n 'category': 'evaluation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'k',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'sorted',\n 'name': 'sorted',\n 'type': 'bool'\n }\n ]\n },\n {\n 'tfOpName': 'UpperBound',\n 'category': 'evaluation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'sortedSequence',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'values',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'Unique',\n 'category': 'evaluation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'UniqueV2',\n 'category': 'evaluation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'axis',\n 'type': 'number'\n }\n ]\n }\n]\n;\n","\n/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpMapper} from '../types';\n\nexport const json: OpMapper[] = [\n {\n 'tfOpName': 'PlaceholderWithDefault',\n 'category': 'graph',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'default',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'shape',\n 'name': 'shape',\n 'type': 'shape'\n },\n {\n 'tfName': 'dtype',\n 'name': 'dtype',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'Placeholder',\n 'category': 'graph',\n 'attrs': [\n {\n 'tfName': 'shape',\n 'name': 'shape',\n 'type': 'shape'\n },\n {\n 'tfName': 'dtype',\n 'name': 'dtype',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'Const',\n 'category': 'graph'\n },\n {\n 'tfOpName': 'Identity',\n 'category': 'graph',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'IdentityN',\n 'category': 'graph',\n 'inputs': [\n {\n 'start': 0,\n 'end': 0,\n 'name': 'x',\n 'type': 'tensors'\n }\n ]\n },\n {\n 'tfOpName': 'Snapshot',\n 'category': 'graph',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'Rank',\n 'category': 'graph',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'Size',\n 'category': 'graph',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'Shape',\n 'category': 'graph',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'ShapeN',\n 'category': 'graph',\n 'inputs': [\n {\n 'start': 0,\n 'end': 0,\n 'name': 'x',\n 'type': 'tensors'\n }\n ]\n },\n {\n 'tfOpName': 'Print',\n 'category': 'graph',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'data',\n 'type': 'tensors'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'message',\n 'name': 'message',\n 'type': 'string'\n },\n {\n 'tfName': 'first_n',\n 'name': 'firstN',\n 'type': 'number',\n 'notSupported': true\n },\n {\n 'tfName': 'summarize',\n 'name': 'summarize',\n 'type': 'number',\n 'defaultValue': 3\n }\n ]\n },\n {\n 'tfOpName': 'NoOp',\n 'category': 'graph',\n 'inputs': []\n },\n {\n 'tfOpName': 'StopGradient',\n 'category': 'graph',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'FakeQuantWithMinMaxVars',\n 'category': 'graph',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'min',\n 'name': 'min',\n 'type': 'number'\n },\n {\n 'tfName': 'max',\n 'name': 'max',\n 'type': 'number'\n }\n ]\n }\n];\n","\n/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpMapper} from '../types';\n\nexport const json: OpMapper[] = [\n {\n 'tfOpName': 'HashTable',\n 'category': 'hash_table',\n 'inputs': [],\n 'attrs': [\n {\n 'tfName': 'shared_name',\n 'name': 'sharedName',\n 'type': 'string'\n },\n {\n 'tfName': 'use_node_name_sharing',\n 'name': 'useNodeNameSharing',\n 'type': 'bool'\n },\n {\n 'tfName': 'key_dtype',\n 'name': 'keyDType',\n 'type': 'dtype'\n },\n {\n 'tfName': 'value_dtype',\n 'name': 'valueDType',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'HashTableV2',\n 'category': 'hash_table',\n 'inputs': [],\n 'attrs': [\n {\n 'tfName': 'shared_name',\n 'name': 'sharedName',\n 'type': 'string'\n },\n {\n 'tfName': 'use_node_name_sharing',\n 'name': 'useNodeNameSharing',\n 'type': 'bool'\n },\n {\n 'tfName': 'key_dtype',\n 'name': 'keyDType',\n 'type': 'dtype'\n },\n {\n 'tfName': 'value_dtype',\n 'name': 'valueDType',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'LookupTableImport',\n 'category': 'hash_table',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tableHandle',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'keys',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'values',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'Tin',\n 'name': 'tIn',\n 'type': 'dtype',\n 'notSupported': true\n },\n {\n 'tfName': 'Tout',\n 'name': 'tOut',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'LookupTableImportV2',\n 'category': 'hash_table',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tableHandle',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'keys',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'values',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'Tin',\n 'name': 'tIn',\n 'type': 'dtype',\n 'notSupported': true\n },\n {\n 'tfName': 'Tout',\n 'name': 'tOut',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'LookupTableFind',\n 'category': 'hash_table',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tableHandle',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'keys',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'defaultValue',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'Tin',\n 'name': 'tIn',\n 'type': 'dtype',\n 'notSupported': true\n },\n {\n 'tfName': 'Tout',\n 'name': 'tOut',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'LookupTableFindV2',\n 'category': 'hash_table',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tableHandle',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'keys',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'defaultValue',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'Tin',\n 'name': 'tIn',\n 'type': 'dtype',\n 'notSupported': true\n },\n {\n 'tfName': 'Tout',\n 'name': 'tOut',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'LookupTableSize',\n 'category': 'hash_table',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tableHandle',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'LookupTableSizeV2',\n 'category': 'hash_table',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tableHandle',\n 'type': 'tensor'\n }\n ]\n }\n];\n","\n/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpMapper} from '../types';\n\nexport const json: OpMapper[] = [\n {\n 'tfOpName': 'ResizeBilinear',\n 'category': 'image',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'images',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'size',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'align_corners',\n 'name': 'alignCorners',\n 'type': 'bool'\n },\n {\n 'tfName': 'half_pixel_centers',\n 'name': 'halfPixelCenters',\n 'type': 'bool'\n },\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'ResizeNearestNeighbor',\n 'category': 'image',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'images',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'size',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'align_corners',\n 'name': 'alignCorners',\n 'type': 'bool'\n },\n {\n 'tfName': 'half_pixel_centers',\n 'name': 'halfPixelCenters',\n 'type': 'bool'\n },\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'CropAndResize',\n 'category': 'image',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'image',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'boxes',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'boxInd',\n 'type': 'tensor'\n },\n {\n 'start': 3,\n 'name': 'cropSize',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'method',\n 'name': 'method',\n 'type': 'string'\n },\n {\n 'tfName': 'extrapolation_value',\n 'name': 'extrapolationValue',\n 'type': 'number'\n }\n ]\n },\n {\n 'tfOpName': 'ImageProjectiveTransformV3',\n 'category': 'image',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'images',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'transforms',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'outputShape',\n 'type': 'number[]'\n },\n {\n 'start': 3,\n 'name': 'fillValue',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'interpolation',\n 'name': 'interpolation',\n 'type': 'string'\n },\n {\n 'tfName': 'fill_mode',\n 'name': 'fillMode',\n 'type': 'string'\n }\n ]\n }\n];\n","\n/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpMapper} from '../types';\n\nexport const json: OpMapper[] = [\n {\n 'tfOpName': 'Equal',\n 'category': 'logical',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'NotEqual',\n 'category': 'logical',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Greater',\n 'category': 'logical',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'GreaterEqual',\n 'category': 'logical',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Less',\n 'category': 'logical',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'LessEqual',\n 'category': 'logical',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'LogicalAnd',\n 'category': 'logical',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'LogicalNot',\n 'category': 'logical',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'LogicalOr',\n 'category': 'logical',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Select',\n 'category': 'logical',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'condition',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'SelectV2',\n 'category': 'logical',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'condition',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n }\n];\n","\n/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpMapper} from '../types';\n\nexport const json: OpMapper[] = [\n {\n 'tfOpName': '_FusedMatMul',\n 'category': 'matrices',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'end': 0,\n 'name': 'args',\n 'type': 'tensors'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'num_args',\n 'name': 'numArgs',\n 'type': 'number'\n },\n {\n 'tfName': 'fused_ops',\n 'name': 'fusedOps',\n 'type': 'string[]',\n 'defaultValue': []\n },\n {\n 'tfName': 'epsilon',\n 'name': 'epsilon',\n 'type': 'number',\n 'defaultValue': 0.0001\n },\n {\n 'tfName': 'transpose_a',\n 'name': 'transposeA',\n 'type': 'bool',\n 'defaultValue': false\n },\n {\n 'tfName': 'transpose_b',\n 'name': 'transposeB',\n 'type': 'bool',\n 'defaultValue': false\n },\n {\n 'tfName': 'leakyrelu_alpha',\n 'name': 'leakyreluAlpha',\n 'type': 'number',\n 'defaultValue': 0.2\n },\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'MatMul',\n 'category': 'matrices',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'transpose_a',\n 'name': 'transposeA',\n 'type': 'bool',\n 'defaultValue': false\n },\n {\n 'tfName': 'transpose_b',\n 'name': 'transposeB',\n 'type': 'bool',\n 'defaultValue': false\n },\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'BatchMatMul',\n 'category': 'matrices',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'adj_x',\n 'name': 'transposeA',\n 'type': 'bool',\n 'defaultValue': false\n },\n {\n 'tfName': 'adj_y',\n 'name': 'transposeB',\n 'type': 'bool',\n 'defaultValue': false\n },\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'BatchMatMulV2',\n 'category': 'matrices',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'adj_x',\n 'name': 'transposeA',\n 'type': 'bool',\n 'defaultValue': false\n },\n {\n 'tfName': 'adj_y',\n 'name': 'transposeB',\n 'type': 'bool',\n 'defaultValue': false\n },\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Transpose',\n 'category': 'matrices',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'perm',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Einsum',\n 'category': 'matrices',\n 'inputs': [\n {\n 'start': 0,\n 'end': 0,\n 'name': 'tensors',\n 'type': 'tensors'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'equation',\n 'name': 'equation',\n 'type': 'string'\n },\n {\n 'tfName': 'N',\n 'name': 'n',\n 'type': 'number',\n 'defaultValue': 2\n },\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype'\n }\n ]\n }\n]\n;\n","\n/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpMapper} from '../types';\n\nexport const json: OpMapper[] = [\n {\n 'tfOpName': 'EuclideanNorm',\n 'category': 'normalization',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'axis',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'keep_dims',\n 'name': 'keepDims',\n 'type': 'bool',\n 'defaultValue': false\n }\n ]\n },\n {\n 'tfOpName': 'FusedBatchNorm',\n 'category': 'normalization',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'scale',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'offset',\n 'type': 'tensor'\n },\n {\n 'start': 3,\n 'name': 'mean',\n 'type': 'tensor'\n },\n {\n 'start': 4,\n 'name': 'variance',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'epsilon',\n 'name': 'epsilon',\n 'type': 'number',\n 'defaultValue': 0.001\n },\n {\n 'tfName': 'data_format',\n 'name': 'dataFormat',\n 'type': 'string',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'FusedBatchNormV2',\n 'category': 'normalization',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'scale',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'offset',\n 'type': 'tensor'\n },\n {\n 'start': 3,\n 'name': 'mean',\n 'type': 'tensor'\n },\n {\n 'start': 4,\n 'name': 'variance',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'epsilon',\n 'name': 'epsilon',\n 'type': 'number',\n 'defaultValue': 0.001\n },\n {\n 'tfName': 'data_format',\n 'name': 'dataFormat',\n 'type': 'string',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'FusedBatchNormV3',\n 'category': 'normalization',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'scale',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'offset',\n 'type': 'tensor'\n },\n {\n 'start': 3,\n 'name': 'mean',\n 'type': 'tensor'\n },\n {\n 'start': 4,\n 'name': 'variance',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'epsilon',\n 'name': 'epsilon',\n 'type': 'number',\n 'defaultValue': 0.001\n },\n {\n 'tfName': 'data_format',\n 'name': 'dataFormat',\n 'type': 'string',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'LRN',\n 'category': 'normalization',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'depth_radius',\n 'name': 'radius',\n 'type': 'number',\n 'defaultValue': 5\n },\n {\n 'tfName': 'bias',\n 'name': 'bias',\n 'type': 'number',\n 'defaultValue': 1\n },\n {\n 'tfName': 'alpha',\n 'name': 'alpha',\n 'type': 'number',\n 'defaultValue': 1\n },\n {\n 'tfName': 'beta',\n 'name': 'beta',\n 'type': 'number',\n 'defaultValue': 0.5\n }\n ]\n },\n {\n 'tfOpName': 'Softmax',\n 'category': 'normalization',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'LogSoftmax',\n 'category': 'normalization',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'SparseToDense',\n 'category': 'normalization',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'sparseIndices',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'outputShape',\n 'type': 'number[]'\n },\n {\n 'start': 2,\n 'name': 'sparseValues',\n 'type': 'tensor'\n },\n {\n 'start': 3,\n 'name': 'defaultValue',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'validate_indices',\n 'name': 'validateIndices',\n 'type': 'bool',\n 'defaultValue': true,\n 'notSupported': true\n }\n ]\n }\n]\n;\n","\n/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpMapper} from '../types';\n\nexport const json: OpMapper[] = [\n {\n 'tfOpName': 'Bincount',\n 'category': 'reduction',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'size',\n 'type': 'number'\n },\n {\n 'start': 2,\n 'name': 'weights',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'DenseBincount',\n 'category': 'reduction',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'size',\n 'type': 'number'\n },\n {\n 'start': 2,\n 'name': 'weights',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'binary_output',\n 'name': 'binaryOutput',\n 'type': 'bool'\n }\n ]\n },\n {\n 'tfOpName': 'Max',\n 'category': 'reduction',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'axis',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'keep_dims',\n 'name': 'keepDims',\n 'type': 'bool'\n }\n ]\n },\n {\n 'tfOpName': 'Mean',\n 'category': 'reduction',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'axis',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'keep_dims',\n 'name': 'keepDims',\n 'type': 'bool'\n }\n ]\n },\n {\n 'tfOpName': 'Min',\n 'category': 'reduction',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'axis',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'keep_dims',\n 'name': 'keepDims',\n 'type': 'bool'\n }\n ]\n },\n {\n 'tfOpName': 'Sum',\n 'category': 'reduction',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'axis',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'keep_dims',\n 'name': 'keepDims',\n 'type': 'bool'\n }\n ]\n },\n {\n 'tfOpName': 'All',\n 'category': 'reduction',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'axis',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'keep_dims',\n 'name': 'keepDims',\n 'type': 'bool'\n }\n ]\n },\n {\n 'tfOpName': 'Any',\n 'category': 'reduction',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'axis',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'keep_dims',\n 'name': 'keepDims',\n 'type': 'bool'\n }\n ]\n },\n {\n 'tfOpName': 'ArgMax',\n 'category': 'reduction',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'axis',\n 'type': 'number'\n }\n ]\n },\n {\n 'tfOpName': 'ArgMin',\n 'category': 'reduction',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'axis',\n 'type': 'number'\n }\n ]\n },\n {\n 'tfOpName': 'Prod',\n 'category': 'reduction',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'axis',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'keep_dims',\n 'name': 'keepDims',\n 'type': 'bool'\n }\n ]\n },\n {\n 'tfOpName': 'Cumprod',\n 'category': 'reduction',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'axis',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'exclusive',\n 'name': 'exclusive',\n 'type': 'bool'\n },\n {\n 'tfName': 'reverse',\n 'name': 'reverse',\n 'type': 'bool'\n }\n ]\n },\n {\n 'tfOpName': 'Cumsum',\n 'category': 'reduction',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'axis',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'exclusive',\n 'name': 'exclusive',\n 'type': 'bool'\n },\n {\n 'tfName': 'reverse',\n 'name': 'reverse',\n 'type': 'bool'\n }\n ]\n }\n]\n;\n","\n/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpMapper} from '../types';\n\nexport const json: OpMapper[] = [\n {\n 'tfOpName': 'ConcatV2',\n 'category': 'slice_join',\n 'inputs': [\n {\n 'start': 0,\n 'end': -1,\n 'name': 'tensors',\n 'type': 'tensors'\n },\n {\n 'start': -1,\n 'name': 'axis',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'N',\n 'name': 'n',\n 'type': 'number',\n 'defaultValue': 2\n }\n ]\n },\n {\n 'tfOpName': 'Concat',\n 'category': 'slice_join',\n 'inputs': [\n {\n 'start': 1,\n 'end': 0,\n 'name': 'tensors',\n 'type': 'tensors'\n },\n {\n 'start': 0,\n 'name': 'axis',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'N',\n 'name': 'n',\n 'type': 'number',\n 'defaultValue': 2\n }\n ]\n },\n {\n 'tfOpName': 'GatherV2',\n 'category': 'slice_join',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'indices',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'axis',\n 'type': 'number',\n 'defaultValue': 0\n }\n ],\n 'attrs': [\n {\n 'tfName': 'batch_dims',\n 'name': 'batchDims',\n 'type': 'number',\n 'defaultValue': 0\n }\n ]\n },\n {\n 'tfOpName': 'Gather',\n 'category': 'slice_join',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'indices',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'validate_indices',\n 'name': 'validateIndices',\n 'type': 'bool',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Reverse',\n 'category': 'slice_join',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'dims',\n 'type': 'bool[]'\n }\n ]\n },\n {\n 'tfOpName': 'ReverseV2',\n 'category': 'slice_join',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'axis',\n 'type': 'number[]'\n }\n ]\n },\n {\n 'tfOpName': 'Slice',\n 'category': 'slice_join',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'begin',\n 'type': 'number[]'\n },\n {\n 'start': 2,\n 'name': 'size',\n 'type': 'number[]'\n }\n ]\n },\n {\n 'tfOpName': 'StridedSlice',\n 'category': 'slice_join',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'begin',\n 'type': 'number[]'\n },\n {\n 'start': 2,\n 'name': 'end',\n 'type': 'number[]'\n },\n {\n 'start': 3,\n 'name': 'strides',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'begin_mask',\n 'name': 'beginMask',\n 'type': 'number',\n 'defaultValue': 0\n },\n {\n 'tfName': 'end_mask',\n 'name': 'endMask',\n 'type': 'number',\n 'defaultValue': 0\n },\n {\n 'tfName': 'new_axis_mask',\n 'name': 'newAxisMask',\n 'type': 'number',\n 'defaultValue': 0\n },\n {\n 'tfName': 'ellipsis_mask',\n 'name': 'ellipsisMask',\n 'type': 'number',\n 'defaultValue': 0\n },\n {\n 'tfName': 'shrink_axis_mask',\n 'name': 'shrinkAxisMask',\n 'type': 'number',\n 'defaultValue': 0\n }\n ]\n },\n {\n 'tfOpName': 'Pack',\n 'category': 'slice_join',\n 'inputs': [\n {\n 'start': 0,\n 'end': 0,\n 'name': 'tensors',\n 'type': 'tensors'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'axis',\n 'name': 'axis',\n 'type': 'number',\n 'defaultValue': 0\n }\n ]\n },\n {\n 'tfOpName': 'Unpack',\n 'category': 'slice_join',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensor',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'axis',\n 'name': 'axis',\n 'type': 'number',\n 'defaultValue': 0\n },\n {\n 'tfName': 'num',\n 'name': 'num',\n 'type': 'number',\n 'defaultValue': 0,\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Tile',\n 'category': 'slice_join',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'reps',\n 'type': 'number[]'\n }\n ]\n },\n {\n 'tfOpName': 'Split',\n 'category': 'slice_join',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'axis',\n 'type': 'number',\n 'defaultValue': 0\n },\n {\n 'start': 1,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'num_split',\n 'name': 'numOrSizeSplits',\n 'type': 'number',\n 'defaultValue': 1\n }\n ]\n },\n {\n 'tfOpName': 'SplitV',\n 'category': 'slice_join',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'numOrSizeSplits',\n 'type': 'number[]'\n },\n {\n 'start': 2,\n 'name': 'axis',\n 'type': 'number',\n 'defaultValue': 0\n }\n ]\n },\n {\n 'tfOpName': 'ScatterNd',\n 'category': 'slice_join',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'indices',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'values',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'shape',\n 'type': 'number[]'\n }\n ]\n },\n {\n 'tfOpName': 'GatherNd',\n 'category': 'slice_join',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'indices',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'SparseToDense',\n 'category': 'slice_join',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'sparseIndices',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'outputShape',\n 'type': 'number[]'\n },\n {\n 'start': 2,\n 'name': 'sparseValues',\n 'type': 'tensor'\n },\n {\n 'start': 3,\n 'name': 'defaultValue',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'validate_indices',\n 'name': 'validateIndices',\n 'type': 'bool',\n 'defaultValue': false,\n 'notSupported': true\n }\n ]\n }\n];\n","\n/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpMapper} from '../types';\n\nexport const json: OpMapper[] = [\n {\n 'tfOpName': 'SparseFillEmptyRows',\n 'category': 'sparse',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'indices',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'values',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'denseShape',\n 'type': 'tensor'\n },\n {\n 'start': 3,\n 'name': 'defaultValue',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'SparseReshape',\n 'category': 'sparse',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'inputIndices',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'inputShape',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'newShape',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'SparseSegmentMean',\n 'category': 'sparse',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'data',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'indices',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'segmentIds',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'SparseSegmentSum',\n 'category': 'sparse',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'data',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'indices',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'segmentIds',\n 'type': 'tensor'\n }\n ]\n }\n];\n","\n/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpMapper} from '../types';\n\nexport const json: OpMapper[] = [\n {\n 'tfOpName': 'FFT',\n 'category': 'spectral',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'IFFT',\n 'category': 'spectral',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'RFFT',\n 'category': 'spectral',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'fft_length',\n 'type': 'number',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'IRFFT',\n 'category': 'spectral',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'fft_length',\n 'type': 'number',\n 'notSupported': true\n }\n ]\n }\n];\n","\n/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpMapper} from '../types';\n\nexport const json: OpMapper[] = [\n {\n 'tfOpName': 'StringNGrams',\n 'category': 'string',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'data',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'dataSplits',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'separator',\n 'name': 'separator',\n 'type': 'string'\n },\n {\n 'tfName': 'ngram_widths',\n 'name': 'nGramWidths',\n 'type': 'number[]'\n },\n {\n 'tfName': 'left_pad',\n 'name': 'leftPad',\n 'type': 'string'\n },\n {\n 'tfName': 'right_pad',\n 'name': 'rightPad',\n 'type': 'string'\n },\n {\n 'tfName': 'pad_width',\n 'name': 'padWidth',\n 'type': 'number'\n },\n {\n 'tfName': 'preserve_short_sequences',\n 'name': 'preserveShortSequences',\n 'type': 'bool'\n }\n ],\n 'outputs': [\n 'ngrams',\n 'ngrams_splits'\n ]\n },\n {\n 'tfOpName': 'StringSplit',\n 'category': 'string',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'input',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'delimiter',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'skip_empty',\n 'name': 'skipEmpty',\n 'type': 'bool'\n }\n ],\n 'outputs': [\n 'indices',\n 'values',\n 'shape'\n ]\n },\n {\n 'tfOpName': 'StringToHashBucketFast',\n 'category': 'string',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'input',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'num_buckets',\n 'name': 'numBuckets',\n 'type': 'number'\n }\n ]\n }\n];\n","\n/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpMapper} from '../types';\n\nexport const json: OpMapper[] = [\n {\n 'tfOpName': 'Cast',\n 'category': 'transformation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'SrcT',\n 'name': 'sdtype',\n 'type': 'dtype',\n 'notSupported': true\n },\n {\n 'tfName': 'DstT',\n 'name': 'dtype',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'ExpandDims',\n 'category': 'transformation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'axis',\n 'type': 'number'\n }\n ]\n },\n {\n 'tfOpName': 'MirrorPad',\n 'category': 'transformation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'padding',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'mode',\n 'name': 'mode',\n 'type': 'string'\n }\n ]\n },\n {\n 'tfOpName': 'Pad',\n 'category': 'transformation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'padding',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'constant_value',\n 'name': 'constantValue',\n 'type': 'number',\n 'defaultValue': 0\n }\n ]\n },\n {\n 'tfOpName': 'PadV2',\n 'category': 'transformation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'padding',\n 'type': 'number[]'\n },\n {\n 'start': 2,\n 'name': 'constantValue',\n 'type': 'number',\n 'defaultValue': 0\n }\n ]\n },\n {\n 'tfOpName': 'Reshape',\n 'category': 'transformation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'shape',\n 'type': 'number[]'\n }\n ]\n },\n {\n 'tfOpName': 'Squeeze',\n 'category': 'transformation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'axis',\n 'tfDeprecatedName': 'squeeze_dims',\n 'name': 'axis',\n 'type': 'number[]'\n }\n ]\n },\n {\n 'tfOpName': 'SpaceToBatchND',\n 'category': 'transformation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'blockShape',\n 'type': 'number[]'\n },\n {\n 'start': 2,\n 'name': 'paddings',\n 'type': 'number[]'\n }\n ]\n },\n {\n 'tfOpName': 'BatchToSpaceND',\n 'category': 'transformation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'blockShape',\n 'type': 'number[]'\n },\n {\n 'start': 2,\n 'name': 'crops',\n 'type': 'number[]'\n }\n ]\n },\n {\n 'tfOpName': 'DepthToSpace',\n 'category': 'transformation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'block_size',\n 'name': 'blockSize',\n 'type': 'number'\n },\n {\n 'tfName': 'data_format',\n 'name': 'dataFormat',\n 'type': 'string'\n }\n ]\n },\n {\n 'tfOpName': 'BroadcastTo',\n 'category': 'transformation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'shape',\n 'type': 'number[]'\n }\n ],\n 'attrs': []\n },\n {\n 'tfOpName': 'BroadcastArgs',\n 'category': 'transformation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 's0',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 's1',\n 'type': 'tensor'\n }\n ],\n 'attrs': []\n }\n];\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataType, env} from '@tensorflow/tfjs-core';\n\nimport * as tensorflow from '../data/compiled_api';\n\nimport {getRegisteredOp} from './custom_op/register';\nimport {getNodeNameAndIndex} from './executors/utils';\nimport * as arithmetic from './op_list/arithmetic';\nimport * as basicMath from './op_list/basic_math';\nimport * as control from './op_list/control';\nimport * as convolution from './op_list/convolution';\nimport * as creation from './op_list/creation';\nimport * as dynamic from './op_list/dynamic';\nimport * as evaluation from './op_list/evaluation';\nimport * as graph from './op_list/graph';\nimport * as hashTable from './op_list/hash_table';\nimport * as image from './op_list/image';\nimport * as logical from './op_list/logical';\nimport * as matrices from './op_list/matrices';\nimport * as normalization from './op_list/normalization';\nimport * as reduction from './op_list/reduction';\nimport * as sliceJoin from './op_list/slice_join';\nimport * as sparse from './op_list/sparse';\nimport * as spectral from './op_list/spectral';\nimport * as string from './op_list/string';\nimport * as transformation from './op_list/transformation';\nimport {Graph, InputParamValue, Node, OpMapper, ParamValue} from './types';\n\nexport class OperationMapper {\n private static _instance: OperationMapper;\n\n private opMappers: {[key: string]: OpMapper};\n\n // Singleton instance for the mapper\n public static get Instance() {\n return this._instance || (this._instance = new this());\n }\n\n // Loads the op mapping from the JSON file.\n private constructor() {\n const ops = [\n arithmetic, basicMath, control, convolution, creation, dynamic,\n evaluation, graph, hashTable, image, logical, matrices, normalization,\n reduction, sliceJoin, sparse, spectral, string, transformation\n ];\n const mappersJson: OpMapper[] = [].concat(...ops.map(op => op.json));\n\n this.opMappers = mappersJson.reduce<{[key: string]: OpMapper}>(\n (map, mapper: OpMapper) => {\n map[mapper.tfOpName] = mapper;\n return map;\n },\n {});\n }\n\n // Converts the model inference graph from Tensorflow GraphDef to local\n // representation for TensorFlow.js API\n transformGraph(\n graph: tensorflow.IGraphDef,\n signature: tensorflow.ISignatureDef = {}): Graph {\n const tfNodes = graph.node;\n const placeholders: Node[] = [];\n const weights: Node[] = [];\n const initNodes: Node[] = [];\n const nodes = tfNodes.reduce<{[key: string]: Node}>((map, node) => {\n map[node.name] = this.mapNode(node);\n if (node.op.startsWith('Placeholder')) {\n placeholders.push(map[node.name]);\n } else if (node.op === 'Const') {\n weights.push(map[node.name]);\n } else if (node.input == null || node.input.length === 0) {\n initNodes.push(map[node.name]);\n }\n return map;\n }, {});\n\n let inputs: Node[] = [];\n const outputs: Node[] = [];\n let inputNodeNameToKey: {[key: string]: string} = {};\n let outputNodeNameToKey: {[key: string]: string} = {};\n if (signature != null) {\n inputNodeNameToKey = this.mapSignatureEntries(signature.inputs);\n outputNodeNameToKey = this.mapSignatureEntries(signature.outputs);\n }\n const allNodes = Object.keys(nodes);\n allNodes.forEach(key => {\n const node = nodes[key];\n node.inputNames.forEach((name, index) => {\n const [nodeName, , outputName] = getNodeNameAndIndex(name);\n const inputNode = nodes[nodeName];\n if (inputNode.outputs != null) {\n const outputIndex = inputNode.outputs.indexOf(outputName);\n if (outputIndex !== -1) {\n const inputName = `${nodeName}:${outputIndex}`;\n // update the input name to use the mapped output index directly.\n node.inputNames[index] = inputName;\n }\n }\n node.inputs.push(inputNode);\n inputNode.children.push(node);\n });\n });\n\n // if signature has not outputs set, add any node that does not have\n // outputs.\n if (Object.keys(outputNodeNameToKey).length === 0) {\n allNodes.forEach(key => {\n const node = nodes[key];\n if (node.children.length === 0) {\n outputs.push(node);\n }\n });\n } else {\n Object.keys(outputNodeNameToKey).forEach(name => {\n const [nodeName, ] = getNodeNameAndIndex(name);\n const node = nodes[nodeName];\n if (node != null) {\n node.signatureKey = outputNodeNameToKey[name];\n outputs.push(node);\n }\n });\n }\n\n if (Object.keys(inputNodeNameToKey).length > 0) {\n Object.keys(inputNodeNameToKey).forEach(name => {\n const [nodeName, ] = getNodeNameAndIndex(name);\n const node = nodes[nodeName];\n if (node) {\n node.signatureKey = inputNodeNameToKey[name];\n inputs.push(node);\n }\n });\n } else {\n inputs = placeholders;\n }\n\n let functions = {};\n if (graph.library != null && graph.library.function != null) {\n functions = graph.library.function.reduce((functions, func) => {\n functions[func.signature.name] = this.mapFunction(func);\n return functions;\n }, {} as {[key: string]: Graph});\n }\n\n const result: Graph =\n {nodes, inputs, outputs, weights, placeholders, signature, functions};\n\n if (initNodes.length > 0) {\n result.initNodes = initNodes;\n }\n\n return result;\n }\n\n private mapSignatureEntries(entries: {[k: string]: tensorflow.ITensorInfo}) {\n return Object.keys(entries || {})\n .reduce<{[key: string]: string}>((prev, curr) => {\n prev[entries[curr].name] = curr;\n return prev;\n }, {});\n }\n\n private mapNode(node: tensorflow.INodeDef): Node {\n // Unsupported ops will cause an error at run-time (not parse time), since\n // they may not be used by the actual execution subgraph.\n const mapper =\n getRegisteredOp(node.op) || this.opMappers[node.op] || {} as OpMapper;\n if (node.attr == null) {\n node.attr = {};\n }\n\n const newNode: Node = {\n name: node.name,\n op: node.op,\n category: mapper.category,\n inputNames:\n (node.input ||\n []).map(input => input.startsWith('^') ? input.slice(1) : input),\n inputs: [],\n children: [],\n inputParams: {},\n attrParams: {},\n rawAttrs: node.attr,\n outputs: mapper.outputs\n };\n\n if (mapper.inputs != null) {\n newNode.inputParams =\n mapper.inputs.reduce<{[key: string]: InputParamValue}>(\n (map, param) => {\n map[param.name] = {\n type: param.type,\n inputIndexStart: param.start,\n inputIndexEnd: param.end\n };\n return map;\n },\n {});\n }\n if (mapper.attrs != null) {\n newNode.attrParams =\n mapper.attrs.reduce<{[key: string]: ParamValue}>((map, param) => {\n const type = param.type;\n let value = undefined;\n switch (param.type) {\n case 'string':\n value = getStringParam(\n node.attr, param.tfName, param.defaultValue as string);\n\n if (value === undefined && !!param.tfDeprecatedName) {\n value = getStringParam(\n node.attr, param.tfDeprecatedName,\n param.defaultValue as string);\n }\n break;\n case 'string[]':\n value = getStringArrayParam(\n node.attr, param.tfName, param.defaultValue as string[]);\n\n if (value === undefined && !!param.tfDeprecatedName) {\n value = getStringArrayParam(\n node.attr, param.tfDeprecatedName,\n param.defaultValue as string[]);\n }\n break;\n case 'number':\n value = getNumberParam(\n node.attr, param.tfName,\n (param.defaultValue || 0) as number);\n if (value === undefined && !!param.tfDeprecatedName) {\n value = getNumberParam(\n node.attr, param.tfDeprecatedName,\n param.defaultValue as number);\n }\n break;\n case 'number[]':\n value = getNumericArrayParam(\n node.attr, param.tfName, param.defaultValue as number[]);\n if (value === undefined && !!param.tfDeprecatedName) {\n value = getNumericArrayParam(\n node.attr, param.tfDeprecatedName,\n param.defaultValue as number[]);\n }\n break;\n case 'bool':\n value = getBoolParam(\n node.attr, param.tfName, param.defaultValue as boolean);\n if (value === undefined && !!param.tfDeprecatedName) {\n value = getBoolParam(\n node.attr, param.tfDeprecatedName,\n param.defaultValue as boolean);\n }\n break;\n case 'bool[]':\n value = getBoolArrayParam(\n node.attr, param.tfName, param.defaultValue as boolean[]);\n if (value === undefined && !!param.tfDeprecatedName) {\n value = getBoolArrayParam(\n node.attr, param.tfDeprecatedName,\n param.defaultValue as boolean[]);\n }\n break;\n case 'shape':\n value = getTensorShapeParam(\n node.attr, param.tfName, param.defaultValue as number[]);\n if (value === undefined && !!param.tfDeprecatedName) {\n value = getTensorShapeParam(\n node.attr, param.tfDeprecatedName,\n param.defaultValue as number[]);\n }\n break;\n case 'shape[]':\n value = getTensorShapeArrayParam(\n node.attr, param.tfName, param.defaultValue as number[][]);\n if (value === undefined && !!param.tfDeprecatedName) {\n value = getTensorShapeArrayParam(\n node.attr, param.tfDeprecatedName,\n param.defaultValue as number[][]);\n }\n break;\n case 'dtype':\n value = getDtypeParam(\n node.attr, param.tfName, param.defaultValue as DataType);\n if (value === undefined && !!param.tfDeprecatedName) {\n value = getDtypeParam(\n node.attr, param.tfDeprecatedName,\n param.defaultValue as DataType);\n }\n break;\n case 'dtype[]':\n value = getDtypeArrayParam(\n node.attr, param.tfName, param.defaultValue as DataType[]);\n if (value === undefined && !!param.tfDeprecatedName) {\n value = getDtypeArrayParam(\n node.attr, param.tfDeprecatedName,\n param.defaultValue as DataType[]);\n }\n break;\n case 'func':\n value = getFuncParam(\n node.attr, param.tfName, param.defaultValue as string);\n if (value === undefined && !!param.tfDeprecatedName) {\n value = getFuncParam(\n node.attr, param.tfDeprecatedName,\n param.defaultValue as string);\n }\n break;\n case 'tensor':\n case 'tensors':\n break;\n default:\n throw new Error(\n `Unsupported param type: ${param.type} for op: ${node.op}`);\n }\n map[param.name] = {value, type};\n return map;\n }, {});\n }\n return newNode;\n }\n\n // map the TFunctionDef to TFJS graph object\n private mapFunction(functionDef: tensorflow.IFunctionDef): Graph {\n const tfNodes = functionDef.nodeDef;\n const placeholders: Node[] = [];\n const weights: Node[] = [];\n let nodes: {[key: string]: Node} = {};\n if (tfNodes != null) {\n nodes = tfNodes.reduce<{[key: string]: Node}>((map, node) => {\n map[node.name] = this.mapNode(node);\n if (node.op === 'Const') {\n weights.push(map[node.name]);\n }\n return map;\n }, {});\n }\n const inputs: Node[] = [];\n const outputs: Node[] = [];\n\n functionDef.signature.inputArg.forEach(arg => {\n const [nodeName, ] = getNodeNameAndIndex(arg.name);\n const node: Node = {\n name: nodeName,\n op: 'Placeholder',\n inputs: [],\n inputNames: [],\n category: 'graph',\n inputParams: {},\n attrParams: {dtype: {value: parseDtypeParam(arg.type), type: 'dtype'}},\n children: []\n };\n node.signatureKey = arg.name;\n inputs.push(node);\n nodes[nodeName] = node;\n });\n\n const allNodes = Object.keys(nodes);\n allNodes.forEach(key => {\n const node = nodes[key];\n node.inputNames.forEach((name, index) => {\n const [nodeName, , outputName] = getNodeNameAndIndex(name);\n const inputNode = nodes[nodeName];\n if (inputNode.outputs != null) {\n const outputIndex = inputNode.outputs.indexOf(outputName);\n if (outputIndex !== -1) {\n const inputName = `${nodeName}:${outputIndex}`;\n // update the input name to use the mapped output index directly.\n node.inputNames[index] = inputName;\n }\n }\n node.inputs.push(inputNode);\n inputNode.children.push(node);\n });\n });\n\n const returnNodeMap = functionDef.ret;\n\n functionDef.signature.outputArg.forEach(output => {\n const [nodeName, index] = getNodeNameAndIndex(returnNodeMap[output.name]);\n const node = nodes[nodeName];\n if (node != null) {\n node.defaultOutput = index;\n outputs.push(node);\n }\n });\n\n const signature = this.mapArgsToSignature(functionDef);\n return {nodes, inputs, outputs, weights, placeholders, signature};\n }\n\n private mapArgsToSignature(functionDef: tensorflow.IFunctionDef):\n tensorflow.ISignatureDef {\n return {\n methodName: functionDef.signature.name,\n inputs: functionDef.signature.inputArg.reduce(\n (map, arg) => {\n map[arg.name] = this.mapArgToTensorInfo(arg);\n return map;\n },\n {} as {[key: string]: tensorflow.ITensorInfo}),\n outputs: functionDef.signature.outputArg.reduce(\n (map, arg) => {\n map[arg.name] = this.mapArgToTensorInfo(arg, functionDef.ret);\n return map;\n },\n {} as {[key: string]: tensorflow.ITensorInfo}),\n };\n }\n\n private mapArgToTensorInfo(\n arg: tensorflow.OpDef.IArgDef,\n nameMap?: {[key: string]: string}): tensorflow.ITensorInfo {\n let name = arg.name;\n if (nameMap != null) {\n name = nameMap[name];\n }\n return {name, dtype: arg.type};\n }\n}\n\nexport function decodeBase64(text: string): string {\n const global = env().global;\n if (typeof global.atob !== 'undefined') {\n return global.atob(text);\n } else if (typeof Buffer !== 'undefined') {\n return new Buffer(text, 'base64').toString();\n } else {\n throw new Error(\n 'Unable to decode base64 in this environment. ' +\n 'Missing built-in atob() or Buffer()');\n }\n}\n\nexport function parseStringParam(s: []|string, keepCase: boolean): string {\n const value =\n Array.isArray(s) ? String.fromCharCode.apply(null, s) : decodeBase64(s);\n return keepCase ? value : value.toLowerCase();\n}\n\nexport function getStringParam(\n attrs: {[key: string]: tensorflow.IAttrValue}, name: string, def: string,\n keepCase = false): string {\n const param = attrs[name];\n if (param != null) {\n return parseStringParam(param.s, keepCase);\n }\n return def;\n}\n\nexport function getBoolParam(\n attrs: {[key: string]: tensorflow.IAttrValue}, name: string,\n def: boolean): boolean {\n const param = attrs[name];\n return param ? param.b : def;\n}\n\nexport function getNumberParam(\n attrs: {[key: string]: tensorflow.IAttrValue}, name: string,\n def: number): number {\n const param = attrs[name] || {};\n const value =\n param['i'] != null ? param['i'] : (param['f'] != null ? param['f'] : def);\n return (typeof value === 'number') ? value : parseInt(value, 10);\n}\n\nexport function parseDtypeParam(value: string|tensorflow.DataType): DataType {\n if (typeof (value) === 'string') {\n // tslint:disable-next-line:no-any\n value = tensorflow.DataType[value as any];\n }\n switch (value) {\n case tensorflow.DataType.DT_FLOAT:\n case tensorflow.DataType.DT_HALF:\n return 'float32';\n case tensorflow.DataType.DT_INT32:\n case tensorflow.DataType.DT_INT64:\n case tensorflow.DataType.DT_INT8:\n case tensorflow.DataType.DT_UINT8:\n return 'int32';\n case tensorflow.DataType.DT_BOOL:\n return 'bool';\n case tensorflow.DataType.DT_DOUBLE:\n return 'float32';\n case tensorflow.DataType.DT_STRING:\n return 'string';\n default:\n // Unknown dtype error will happen at runtime (instead of parse time),\n // since these nodes might not be used by the actual subgraph execution.\n return null;\n }\n}\n\nexport function getFuncParam(\n attrs: {[key: string]: tensorflow.IAttrValue}, name: string,\n def: string): string {\n const param = attrs[name];\n if (param && param.func) {\n return param.func.name;\n }\n return def;\n}\n\nexport function getDtypeParam(\n attrs: {[key: string]: tensorflow.IAttrValue}, name: string,\n def: DataType): DataType {\n const param = attrs[name];\n if (param && param.type) {\n return parseDtypeParam(param.type);\n }\n return def;\n}\n\nexport function getDtypeArrayParam(\n attrs: {[key: string]: tensorflow.IAttrValue}, name: string,\n def: DataType[]): DataType[] {\n const param = attrs[name];\n if (param && param.list && param.list.type) {\n return param.list.type.map(v => parseDtypeParam(v));\n }\n return def;\n}\n\nexport function parseTensorShapeParam(shape: tensorflow.ITensorShape): number[]|\n undefined {\n if (shape.unknownRank) {\n return undefined;\n }\n if (shape.dim != null) {\n return shape.dim.map(\n dim =>\n (typeof dim.size === 'number') ? dim.size : parseInt(dim.size, 10));\n }\n return [];\n}\n\nexport function getTensorShapeParam(\n attrs: {[key: string]: tensorflow.IAttrValue}, name: string,\n def?: number[]): number[]|undefined {\n const param = attrs[name];\n if (param && param.shape) {\n return parseTensorShapeParam(param.shape);\n }\n return def;\n}\n\nexport function getNumericArrayParam(\n attrs: {[key: string]: tensorflow.IAttrValue}, name: string,\n def: number[]): number[] {\n const param = attrs[name];\n if (param) {\n return ((param.list.f && param.list.f.length ? param.list.f :\n param.list.i) ||\n [])\n .map(v => (typeof v === 'number') ? v : parseInt(v, 10));\n }\n return def;\n}\n\nexport function getStringArrayParam(\n attrs: {[key: string]: tensorflow.IAttrValue}, name: string, def: string[],\n keepCase = false): string[] {\n const param = attrs[name];\n if (param && param.list && param.list.s) {\n return param.list.s.map((v) => {\n return parseStringParam(v, keepCase);\n });\n }\n return def;\n}\n\nexport function getTensorShapeArrayParam(\n attrs: {[key: string]: tensorflow.IAttrValue}, name: string,\n def: number[][]): number[][] {\n const param = attrs[name];\n if (param && param.list && param.list.shape) {\n return param.list.shape.map((v) => {\n return parseTensorShapeParam(v);\n });\n }\n return def;\n}\n\nexport function getBoolArrayParam(\n attrs: {[key: string]: tensorflow.IAttrValue}, name: string,\n def: boolean[]): boolean[] {\n const param = attrs[name];\n if (param && param.list && param.list.b) {\n return param.list.b;\n }\n return def;\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataType, Tensor} from '@tensorflow/tfjs-core';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {getTensor} from '../executors/utils';\nimport {getBoolArrayParam, getBoolParam, getDtypeArrayParam, getDtypeParam, getNumberParam, getNumericArrayParam, getStringArrayParam, getStringParam, getTensorShapeArrayParam, getTensorShapeParam} from '../operation_mapper';\nimport {GraphNode, Node, ValueType} from '../types';\n\n/**\n * Helper class for lookup inputs and params for nodes in the model graph.\n */\nexport class NodeValueImpl implements GraphNode {\n public readonly inputs: Tensor[] = [];\n public readonly attrs: {[key: string]: ValueType} = {};\n constructor(\n private node: Node, private tensorMap: NamedTensorsMap,\n private context: ExecutionContext) {\n this.inputs = node.inputNames.map(name => this.getInput(name));\n if (node.rawAttrs != null) {\n this.attrs = Object.keys(node.rawAttrs)\n .reduce((attrs: {[key: string]: ValueType}, key) => {\n attrs[key] = this.getAttr(key);\n return attrs;\n }, {});\n }\n }\n\n /**\n * Return the value of the attribute or input param.\n * @param name String: name of attribute or input param.\n */\n private getInput(name: string): Tensor {\n return getTensor(name, this.tensorMap, this.context);\n }\n\n /**\n * Return the value of the attribute or input param.\n * @param name String: name of attribute or input param.\n */\n private getAttr(name: string, defaultValue?: ValueType): ValueType {\n const value = this.node.rawAttrs[name];\n if (value.tensor != null) {\n return getTensor(name, this.tensorMap, this.context);\n }\n if (value.i != null || value.f != null) {\n return getNumberParam(this.node.rawAttrs, name, defaultValue as number);\n }\n if (value.s != null) {\n return getStringParam(this.node.rawAttrs, name, defaultValue as string);\n }\n if (value.b != null) {\n return getBoolParam(this.node.rawAttrs, name, defaultValue as boolean);\n }\n if (value.shape != null) {\n return getTensorShapeParam(\n this.node.rawAttrs, name, defaultValue as number[]);\n }\n if (value.type != null) {\n return getDtypeParam(this.node.rawAttrs, name, defaultValue as DataType);\n }\n if (value.list != null) {\n if (value.list.i != null || value.list.f != null) {\n return getNumericArrayParam(\n this.node.rawAttrs, name, defaultValue as number[]);\n }\n if (value.list.s != null) {\n return getStringArrayParam(\n this.node.rawAttrs, name, defaultValue as string[]);\n }\n if (value.list.shape != null) {\n return getTensorShapeArrayParam(\n this.node.rawAttrs, name, defaultValue as number[][]);\n }\n if (value.list.b != null) {\n return getBoolArrayParam(\n this.node.rawAttrs, name, defaultValue as boolean[]);\n }\n if (value.list.type != null) {\n return getDtypeArrayParam(\n this.node.rawAttrs, name, defaultValue as DataType[]);\n }\n }\n\n return defaultValue;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/**\n * This file exports ops used by the converters executors. By default it\n * re-exports all ops. In a custom build this is aliased to a file that will\n * only exports ops for a given model.json.\n */\nexport * from './ops';\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '@tensorflow/tfjs-core';\n// tslint:disable-next-line: no-imports-from-dist\nimport * as tfOps from '@tensorflow/tfjs-core/dist/ops/ops_for_converter';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {InternalOpExecutor, Node} from '../types';\n\nimport {getParamValue} from './utils';\n\nexport const executeOp: InternalOpExecutor =\n (node: Node, tensorMap: NamedTensorsMap,\n context: ExecutionContext, ops = tfOps): Tensor[] => {\n switch (node.op) {\n case 'BiasAdd':\n case 'AddV2':\n case 'Add': {\n return [ops.add(\n (getParamValue('a', node, tensorMap, context) as Tensor),\n getParamValue('b', node, tensorMap, context) as Tensor)];\n }\n case 'AddN': {\n return [ops.addN((\n getParamValue('tensors', node, tensorMap, context) as Tensor[]))];\n }\n case 'FloorMod':\n case 'Mod':\n return [ops.mod(\n getParamValue('a', node, tensorMap, context) as Tensor,\n getParamValue('b', node, tensorMap, context) as Tensor)];\n case 'Mul':\n return [ops.mul(\n getParamValue('a', node, tensorMap, context) as Tensor,\n getParamValue('b', node, tensorMap, context) as Tensor)];\n case 'RealDiv':\n case 'Div': {\n return [ops.div(\n getParamValue('a', node, tensorMap, context) as Tensor,\n getParamValue('b', node, tensorMap, context) as Tensor)];\n }\n case 'DivNoNan': {\n return [ops.divNoNan(\n getParamValue('a', node, tensorMap, context) as Tensor,\n getParamValue('b', node, tensorMap, context) as Tensor)];\n }\n case 'FloorDiv': {\n return [ops.floorDiv(\n getParamValue('a', node, tensorMap, context) as Tensor,\n getParamValue('b', node, tensorMap, context) as Tensor)];\n }\n case 'Sub': {\n return [ops.sub(\n getParamValue('a', node, tensorMap, context) as Tensor,\n getParamValue('b', node, tensorMap, context) as Tensor)];\n }\n case 'Minimum': {\n return [ops.minimum(\n getParamValue('a', node, tensorMap, context) as Tensor,\n getParamValue('b', node, tensorMap, context) as Tensor)];\n }\n case 'Maximum': {\n return [ops.maximum(\n getParamValue('a', node, tensorMap, context) as Tensor,\n getParamValue('b', node, tensorMap, context) as Tensor)];\n }\n case 'Pow': {\n return [ops.pow(\n getParamValue('a', node, tensorMap, context) as Tensor,\n getParamValue('b', node, tensorMap, context) as Tensor)];\n }\n case 'SquaredDifference': {\n return [ops.squaredDifference(\n getParamValue('a', node, tensorMap, context) as Tensor,\n getParamValue('b', node, tensorMap, context) as Tensor)];\n }\n default:\n throw TypeError(`Node type ${node.op} is not implemented`);\n }\n };\n\nexport const CATEGORY = 'arithmetic';\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '@tensorflow/tfjs-core';\n// tslint:disable-next-line: no-imports-from-dist\nimport * as tfOps from '@tensorflow/tfjs-core/dist/ops/ops_for_converter';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {InternalOpExecutor, Node} from '../types';\n\nimport {getParamValue, getTensor} from './utils';\n\nexport const executeOp: InternalOpExecutor =\n (node: Node, tensorMap: NamedTensorsMap,\n context: ExecutionContext, ops = tfOps): Tensor[] => {\n switch (node.op) {\n case 'Abs':\n case 'ComplexAbs':\n return [ops.abs(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Acos':\n return [ops.acos(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Acosh':\n return [ops.acosh(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Asin':\n return [ops.asin(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Asinh':\n return [ops.asinh(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Atan':\n return [ops.atan(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Atan2':\n return [ops.atan2(\n getParamValue('x', node, tensorMap, context) as Tensor,\n getParamValue('y', node, tensorMap, context) as Tensor)];\n case 'Atanh':\n return [ops.atanh(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Ceil':\n return [ops.ceil(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Complex':\n return [ops.complex(\n getParamValue('real', node, tensorMap, context) as Tensor,\n getParamValue('imag', node, tensorMap, context) as Tensor)];\n case 'Cos':\n return [ops.cos(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Cosh':\n return [ops.cosh(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Elu':\n return [ops.elu(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Erf':\n return [ops.erf(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Exp':\n return [ops.exp(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Expm1': {\n return [ops.expm1(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n }\n case 'Floor':\n return [ops.floor(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Log':\n return [ops.log(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Log1p': {\n return [ops.log1p(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n }\n case 'Imag':\n return [ops.imag(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n\n case 'Neg':\n return [ops.neg(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Reciprocal': {\n return [ops.reciprocal(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n }\n case 'Real':\n return [ops.real(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Relu':\n return [ops.relu(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Round': {\n return [ops.round(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n }\n case 'Selu':\n return [ops.selu(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Sigmoid':\n return [ops.sigmoid(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Sin':\n return [ops.sin(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Sign': {\n return [ops.sign(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n }\n case 'Sinh': {\n return [ops.sinh(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n }\n case 'Softplus': {\n return [ops.softplus(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n }\n case 'Sqrt': {\n return [ops.sqrt(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n }\n case 'Square': {\n return [ops.square(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n }\n case 'Tanh': {\n return [ops.tanh(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n }\n case 'Tan':\n return [ops.tan(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'ClipByValue':\n return [ops.clipByValue(\n getParamValue('x', node, tensorMap, context) as Tensor,\n getParamValue('clipValueMin', node, tensorMap, context) as number,\n getParamValue('clipValueMax', node, tensorMap, context) as\n number)];\n case 'Relu6':\n return [ops.relu6(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Rsqrt':\n return [ops.rsqrt(\n getTensor(node.inputNames[0], tensorMap, context))];\n case 'Prod':\n return [ops.prod(\n getParamValue('x', node, tensorMap, context) as Tensor,\n getParamValue('axes', node, tensorMap, context) as number[])];\n case 'LeakyRelu':\n return [ops.leakyRelu(\n getParamValue('x', node, tensorMap, context) as Tensor,\n getParamValue('alpha', node, tensorMap, context) as number)];\n case 'Prelu':\n return [ops.prelu(\n getParamValue('x', node, tensorMap, context) as Tensor,\n getParamValue('alpha', node, tensorMap, context) as Tensor)];\n case 'IsNan':\n return [ops.isNaN(\n getTensor(node.inputNames[0], tensorMap, context))];\n default:\n throw TypeError(`Node type ${node.op} is not implemented`);\n }\n };\n\nexport const CATEGORY = 'basic_math';\n","\n/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n/**\n * This differs from util.assertShapesMatch in that it allows values of\n * negative one, an undefined size of a dimensinon, in a shape to match\n * anything.\n */\n\nimport {Tensor, util} from '@tensorflow/tfjs-core';\n\n/**\n * Used by TensorList and TensorArray to verify if elementShape matches, support\n * negative value as the dim shape.\n * @param shapeA\n * @param shapeB\n * @param errorMessagePrefix\n */\nexport function assertShapesMatchAllowUndefinedSize(\n shapeA: number|number[], shapeB: number|number[],\n errorMessagePrefix = ''): void {\n // constant shape means unknown rank\n if (typeof shapeA === 'number' || typeof shapeB === 'number') {\n return;\n }\n util.assert(\n shapeA.length === shapeB.length,\n () => errorMessagePrefix + ` Shapes ${shapeA} and ${shapeB} must match`);\n for (let i = 0; i < shapeA.length; i++) {\n const dim0 = shapeA[i];\n const dim1 = shapeB[i];\n util.assert(\n dim0 < 0 || dim1 < 0 || dim0 === dim1,\n () =>\n errorMessagePrefix + ` Shapes ${shapeA} and ${shapeB} must match`);\n }\n}\n\nexport function fullDefinedShape(elementShape: number|number[]): boolean {\n if (typeof elementShape === 'number' || elementShape.some(dim => dim < 0)) {\n return false;\n }\n return true;\n}\n/**\n * Generate the output element shape from the list elementShape, list tensors\n * and input param.\n * @param listElementShape\n * @param tensors\n * @param elementShape\n */\nexport function inferElementShape(\n listElementShape: number|number[], tensors: Tensor[],\n elementShape: number|number[]): number[] {\n let partialShape = mergeElementShape(listElementShape, elementShape);\n const notfullDefinedShape = !fullDefinedShape(partialShape);\n if (notfullDefinedShape && tensors.length === 0) {\n throw new Error(\n `Tried to calculate elements of an empty list` +\n ` with non-fully-defined elementShape: ${partialShape}`);\n }\n if (notfullDefinedShape) {\n tensors.forEach(tensor => {\n partialShape = mergeElementShape(tensor.shape, partialShape);\n });\n }\n if (!fullDefinedShape(partialShape)) {\n throw new Error(`Non-fully-defined elementShape: ${partialShape}`);\n }\n return partialShape as number[];\n}\n\nexport function mergeElementShape(\n elementShapeA: number|number[], elementShapeB: number|number[]): number|\n number[] {\n if (typeof elementShapeA === 'number') {\n return elementShapeB;\n }\n if (typeof elementShapeB === 'number') {\n return elementShapeA;\n }\n\n if (elementShapeA.length !== elementShapeB.length) {\n throw new Error(`Incompatible ranks during merge: ${elementShapeA} vs. ${\n elementShapeB}`);\n }\n\n const result: number[] = [];\n for (let i = 0; i < elementShapeA.length; ++i) {\n const dim0 = elementShapeA[i];\n const dim1 = elementShapeB[i];\n if (dim0 >= 0 && dim1 >= 0 && dim0 !== dim1) {\n throw new Error(`Incompatible shape during merge: ${elementShapeA} vs. ${\n elementShapeB}`);\n }\n result[i] = dim0 >= 0 ? dim0 : dim1;\n }\n return result;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {concat, DataType, keep, reshape, scalar, slice, stack, Tensor, tensor, tidy, unstack} from '@tensorflow/tfjs-core';\n\nimport {assertShapesMatchAllowUndefinedSize} from './tensor_utils';\n\nexport interface TensorWithState {\n tensor?: Tensor;\n written?: boolean;\n read?: boolean;\n cleared?: boolean;\n}\n/**\n * The TensorArray object keeps an array of Tensors. It\n * allows reading from the array and writing to the array.\n */\nexport class TensorArray {\n private tensors: TensorWithState[] = [];\n private closed_ = false;\n readonly idTensor: Tensor;\n constructor(\n readonly name: string, readonly dtype: DataType, private maxSize: number,\n private elementShape: number[], readonly identicalElementShapes: boolean,\n readonly dynamicSize: boolean, readonly clearAfterRead: boolean) {\n this.idTensor = scalar(0);\n keep(this.idTensor);\n }\n\n get id() {\n return this.idTensor.id;\n }\n\n get closed() {\n return this.closed_;\n }\n\n /**\n * Dispose the tensors and idTensor and mark the TensoryArray as closed.\n */\n clearAndClose(keepIds?: Set) {\n this.tensors.forEach(tensor => {\n if (keepIds == null || !keepIds.has(tensor.tensor.id)) {\n tensor.tensor.dispose();\n }\n });\n this.tensors = [];\n this.closed_ = true;\n this.idTensor.dispose();\n }\n\n size(): number {\n return this.tensors.length;\n }\n\n /**\n * Read the value at location index in the TensorArray.\n * @param index Number the index to read from.\n */\n read(index: number): Tensor {\n if (this.closed_) {\n throw new Error(`TensorArray ${this.name} has already been closed.`);\n }\n\n if (index < 0 || index >= this.size()) {\n throw new Error(`Tried to read from index ${index}, but array size is: ${\n this.size()}`);\n }\n\n const tensorWithState = this.tensors[index];\n if (tensorWithState.cleared) {\n throw new Error(\n `TensorArray ${this.name}: Could not read index ${\n index} twice because it was cleared after a previous read ` +\n `(perhaps try setting clear_after_read = false?).`);\n }\n\n if (this.clearAfterRead) {\n tensorWithState.cleared = true;\n }\n\n tensorWithState.read = true;\n return tensorWithState.tensor;\n }\n\n /**\n * Helper method to read multiple tensors from the specified indices.\n */\n readMany(indices: number[]): Tensor[] {\n return indices.map(index => this.read(index));\n }\n\n /**\n * Write value into the index of the TensorArray.\n * @param index number the index to write to.\n * @param tensor\n */\n write(index: number, tensor: Tensor) {\n if (this.closed_) {\n throw new Error(`TensorArray ${this.name} has already been closed.`);\n }\n\n if (index < 0 || !this.dynamicSize && index >= this.maxSize) {\n throw new Error(`Tried to write to index ${\n index}, but array is not resizeable and size is: ${this.maxSize}`);\n }\n\n const t = this.tensors[index] || {};\n\n if (tensor.dtype !== this.dtype) {\n throw new Error(`TensorArray ${\n this.name}: Could not write to TensorArray index ${index},\n because the value dtype is ${\n tensor.dtype}, but TensorArray dtype is ${this.dtype}.`);\n }\n\n // Set the shape for the first time write to unknow shape tensor array\n if (this.size() === 0 &&\n (this.elementShape == null || this.elementShape.length === 0)) {\n this.elementShape = tensor.shape;\n }\n\n assertShapesMatchAllowUndefinedSize(\n this.elementShape, tensor.shape,\n `TensorArray ${this.name}: Could not write to TensorArray index ${\n index}.`);\n\n if (t.read) {\n throw new Error(\n `TensorArray ${this.name}: Could not write to TensorArray index ${\n index}, because it has already been read.`);\n }\n\n if (t.written) {\n throw new Error(\n `TensorArray ${this.name}: Could not write to TensorArray index ${\n index}, because it has already been written.`);\n }\n\n t.tensor = tensor;\n keep(tensor);\n t.written = true;\n\n this.tensors[index] = t;\n }\n\n /**\n * Helper method to write multiple tensors to the specified indices.\n */\n writeMany(indices: number[], tensors: Tensor[]) {\n if (indices.length !== tensors.length) {\n throw new Error(\n `TensorArray ${this.name}: could not write multiple tensors,` +\n `because the index size: ${\n indices.length} is not the same as tensors size: ${\n tensors.length}.`);\n }\n\n indices.forEach((i, index) => this.write(i, tensors[index]));\n }\n\n /**\n * Return selected values in the TensorArray as a packed Tensor. All of\n * selected values must have been written and their shapes must all match.\n * @param [indices] number[] Optional. Taking values in [0, max_value). If the\n * TensorArray is not dynamic, max_value=size(). If not specified returns\n * all tensors in the original order.\n * @param [dtype]\n */\n gather(indices?: number[], dtype?: DataType): Tensor {\n if (!!dtype && dtype !== this.dtype) {\n throw new Error(`TensorArray dtype is ${\n this.dtype} but gather requested dtype ${dtype}`);\n }\n\n if (!indices) {\n indices = [];\n for (let i = 0; i < this.size(); i++) {\n indices.push(i);\n }\n } else {\n indices = indices.slice(0, this.size());\n }\n\n if (indices.length === 0) {\n return tensor([], [0].concat(this.elementShape));\n }\n\n // Read all the PersistentTensors into a vector to keep track of\n // their memory.\n const tensors = this.readMany(indices);\n\n assertShapesMatchAllowUndefinedSize(\n this.elementShape, tensors[0].shape, 'TensorArray shape mismatch: ');\n\n return stack(tensors, 0);\n }\n\n /**\n * Return the values in the TensorArray as a concatenated Tensor.\n */\n concat(dtype?: DataType): Tensor {\n if (!!dtype && dtype !== this.dtype) {\n throw new Error(`TensorArray dtype is ${\n this.dtype} but concat requested dtype ${dtype}`);\n }\n\n if (this.size() === 0) {\n return tensor([], [0].concat(this.elementShape));\n }\n\n const indices = [];\n for (let i = 0; i < this.size(); i++) {\n indices.push(i);\n }\n // Collect all the tensors from the tensors array.\n const tensors = this.readMany(indices);\n\n assertShapesMatchAllowUndefinedSize(\n this.elementShape, tensors[0].shape,\n `TensorArray shape mismatch: tensor array shape (${\n this.elementShape}) vs first tensor shape (${tensors[0].shape})`);\n\n return concat(tensors, 0);\n }\n\n /**\n * Scatter the values of a Tensor in specific indices of a TensorArray.\n * @param indices nummber[] values in [0, max_value). If the\n * TensorArray is not dynamic, max_value=size().\n * @param tensor Tensor input tensor.\n */\n scatter(indices: number[], tensor: Tensor) {\n if (tensor.dtype !== this.dtype) {\n throw new Error(`TensorArray dtype is ${\n this.dtype} but tensor has dtype ${tensor.dtype}`);\n }\n\n if (indices.length !== tensor.shape[0]) {\n throw new Error(`Expected len(indices) == tensor.shape[0], but saw: ${\n indices.length} vs. ${tensor.shape[0]}`);\n }\n\n const maxIndex = Math.max(...indices);\n\n if (!this.dynamicSize && maxIndex >= this.maxSize) {\n throw new Error(\n `Max index must be < array size (${maxIndex} vs. ${this.maxSize})`);\n }\n\n this.writeMany(indices, unstack(tensor, 0));\n }\n\n /**\n * Split the values of a Tensor into the TensorArray.\n * @param length number[] with the lengths to use when splitting value along\n * its first dimension.\n * @param tensor Tensor, the tensor to split.\n */\n split(length: number[], tensor: Tensor) {\n if (tensor.dtype !== this.dtype) {\n throw new Error(`TensorArray dtype is ${\n this.dtype} but tensor has dtype ${tensor.dtype}`);\n }\n let totalLength = 0;\n const cumulativeLengths = length.map(len => {\n totalLength += len;\n return totalLength;\n });\n\n if (totalLength !== tensor.shape[0]) {\n throw new Error(`Expected sum of lengths to be equal to\n tensor.shape[0], but sum of lengths is\n ${totalLength}, and tensor's shape is: ${tensor.shape}`);\n }\n\n if (!this.dynamicSize && length.length !== this.maxSize) {\n throw new Error(\n `TensorArray's size is not equal to the size of lengths (${\n this.maxSize} vs. ${length.length}), ` +\n 'and the TensorArray is not marked as dynamically resizeable');\n }\n\n const elementPerRow = totalLength === 0 ? 0 : tensor.size / totalLength;\n const tensors: Tensor[] = [];\n tidy(() => {\n tensor = reshape(tensor, [1, totalLength, elementPerRow]);\n for (let i = 0; i < length.length; ++i) {\n const previousLength = (i === 0) ? 0 : cumulativeLengths[i - 1];\n const indices = [0, previousLength, 0];\n const sizes = [1, length[i], elementPerRow];\n tensors[i] = reshape(slice(tensor, indices, sizes), this.elementShape);\n }\n return tensors;\n });\n const indices = [];\n for (let i = 0; i < length.length; i++) {\n indices[i] = i;\n }\n this.writeMany(indices, tensors);\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {concat, DataType, keep, reshape, scalar, slice, stack, Tensor, tensor, tidy, unstack} from '@tensorflow/tfjs-core';\n\nimport {assertShapesMatchAllowUndefinedSize, inferElementShape, mergeElementShape} from './tensor_utils';\n\n/**\n * TensorList stores a container of `tf.Tensor` objects, which are accessible\n * via tensors field.\n *\n * In order to get a copy of the underlying list, use the copy method:\n * ```\n * TensorList b = a.copy();\n * b.tensors().pushBack(t); // This does not modify a.tensors().\n * ```\n *\n * Note that this is not a deep copy: the memory locations of the underlying\n * tensors will still point to the same locations of the corresponding tensors\n * in the original.\n */\n\nexport class TensorList {\n readonly idTensor: Tensor;\n maxNumElements: number;\n\n get id() {\n return this.idTensor.id;\n }\n /**\n *\n * @param tensors list of tensors\n * @param elementShape shape of each tensor, this can be a single number (any\n * shape is allowed) or partial shape (dim = -1).\n * @param elementDtype data type of each tensor\n * @param maxNumElements The maximum allowed size of `tensors`. Defaults to -1\n * meaning that the size of `tensors` is unbounded.\n */\n constructor(\n readonly tensors: Tensor[], readonly elementShape: number|number[],\n readonly elementDtype: DataType, maxNumElements = -1) {\n if (tensors != null) {\n tensors.forEach(tensor => {\n if (elementDtype !== tensor.dtype) {\n throw new Error(`Invalid data types; op elements ${\n elementDtype}, but list elements ${tensor.dtype}`);\n }\n assertShapesMatchAllowUndefinedSize(\n elementShape, tensor.shape, 'TensorList shape mismatch: ');\n\n keep(tensor);\n });\n }\n this.idTensor = scalar(0);\n this.maxNumElements = maxNumElements;\n keep(this.idTensor);\n }\n\n /**\n * Get a new TensorList containing a copy of the underlying tensor container.\n */\n copy(): TensorList {\n return new TensorList(\n [...this.tensors], this.elementShape, this.elementDtype);\n }\n\n /**\n * Dispose the tensors and idTensor and clear the tensor list.\n */\n clearAndClose(keepIds?: Set) {\n this.tensors.forEach(tensor => {\n if (keepIds == null || !keepIds.has(tensor.id)) {\n tensor.dispose();\n }\n });\n this.tensors.length = 0;\n this.idTensor.dispose();\n }\n /**\n * The size of the tensors in the tensor list.\n */\n size() {\n return this.tensors.length;\n }\n\n /**\n * Return a tensor that stacks a list of rank-R tf.Tensors into one rank-(R+1)\n * tf.Tensor.\n * @param elementShape shape of each tensor\n * @param elementDtype data type of each tensor\n * @param numElements the number of elements to stack\n */\n stack(elementShape: number[], elementDtype: DataType, numElements = -1):\n Tensor {\n if (elementDtype !== this.elementDtype) {\n throw new Error(`Invalid data types; op elements ${\n elementDtype}, but list elements ${this.elementDtype}`);\n }\n if (numElements !== -1 && this.tensors.length !== numElements) {\n throw new Error(`Operation expected a list with ${\n numElements} elements but got a list with ${\n this.tensors.length} elements.`);\n }\n assertShapesMatchAllowUndefinedSize(\n elementShape, this.elementShape, 'TensorList shape mismatch: ');\n const outputElementShape =\n inferElementShape(this.elementShape, this.tensors, elementShape);\n return tidy(() => {\n const reshapedTensors =\n this.tensors.map(tensor => reshape(tensor, outputElementShape));\n return stack(reshapedTensors, 0);\n });\n }\n\n /**\n * Pop a tensor from the end of the list.\n * @param elementShape shape of the tensor\n * @param elementDtype data type of the tensor\n */\n popBack(elementShape: number[], elementDtype: DataType): Tensor {\n if (elementDtype !== this.elementDtype) {\n throw new Error(`Invalid data types; op elements ${\n elementDtype}, but list elements ${this.elementDtype}`);\n }\n\n if (this.size() === 0) {\n throw new Error('Trying to pop from an empty list.');\n }\n const outputElementShape =\n inferElementShape(this.elementShape, this.tensors, elementShape);\n const tensor = this.tensors.pop();\n tensor.kept = false;\n\n assertShapesMatchAllowUndefinedSize(\n tensor.shape, elementShape, 'TensorList shape mismatch: ');\n\n return reshape(tensor, outputElementShape);\n }\n\n /**\n * Push a tensor to the end of the list.\n * @param tensor Tensor to be pushed.\n */\n pushBack(tensor: Tensor) {\n if (tensor.dtype !== this.elementDtype) {\n throw new Error(`Invalid data types; op elements ${\n tensor.dtype}, but list elements ${this.elementDtype}`);\n }\n\n assertShapesMatchAllowUndefinedSize(\n tensor.shape, this.elementShape, 'TensorList shape mismatch: ');\n\n if (this.maxNumElements === this.size()) {\n throw new Error(`Trying to push element into a full list.`);\n }\n keep(tensor);\n this.tensors.push(tensor);\n }\n\n /**\n * Update the size of the list.\n * @param size the new size of the list.\n */\n resize(size: number) {\n if (size < 0) {\n throw new Error(\n `TensorListResize expects size to be non-negative. Got: ${size}`);\n }\n\n if (this.maxNumElements !== -1 && size > this.maxNumElements) {\n throw new Error(`TensorListResize input size ${\n size} is greater maxNumElement ${this.maxNumElements}.`);\n }\n\n const destTensorList: TensorList = new TensorList(\n [], this.elementShape, this.elementDtype, this.maxNumElements);\n destTensorList.tensors.length = size;\n for (let i = 0; i < Math.min(this.tensors.length, size); ++i) {\n destTensorList.tensors[i] = this.tensors[i];\n }\n return destTensorList;\n }\n\n /**\n * Retrieve the element at the provided index\n * @param elementShape shape of the tensor\n * @param elementDtype dtype of the tensor\n * @param elementIndex index of the tensor\n */\n getItem(elementIndex: number, elementShape: number[], elementDtype: DataType):\n Tensor {\n if (elementDtype !== this.elementDtype) {\n throw new Error(`Invalid data types; op elements ${\n elementDtype}, but list elements ${this.elementDtype}`);\n }\n if (elementIndex < 0 || elementIndex > this.tensors.length) {\n throw new Error(`Trying to access element ${\n elementIndex} in a list with ${this.tensors.length} elements.`);\n }\n\n if (this.tensors[elementIndex] == null) {\n throw new Error(`element at index ${elementIndex} is null.`);\n }\n\n assertShapesMatchAllowUndefinedSize(\n this.tensors[elementIndex].shape, elementShape,\n 'TensorList shape mismatch: ');\n const outputElementShape =\n inferElementShape(this.elementShape, this.tensors, elementShape);\n return reshape(this.tensors[elementIndex], outputElementShape);\n }\n\n /**\n * Set the tensor at the index\n * @param elementIndex index of the tensor\n * @param tensor the tensor to be inserted into the list\n */\n setItem(elementIndex: number, tensor: Tensor) {\n if (tensor.dtype !== this.elementDtype) {\n throw new Error(`Invalid data types; op elements ${\n tensor.dtype}, but list elements ${this.elementDtype}`);\n }\n\n if (elementIndex < 0 ||\n this.maxNumElements !== -1 && elementIndex >= this.maxNumElements) {\n throw new Error(`Trying to set element ${\n elementIndex} in a list with max ${this.maxNumElements} elements.`);\n }\n\n assertShapesMatchAllowUndefinedSize(\n this.elementShape, tensor.shape, 'TensorList shape mismatch: ');\n keep(tensor);\n\n // dispose the previous value if it is replacing.\n if (this.tensors[elementIndex] != null) {\n this.tensors[elementIndex].kept = false;\n }\n\n this.tensors[elementIndex] = tensor;\n }\n\n /**\n * Return selected values in the TensorList as a stacked Tensor. All of\n * selected values must have been written and their shapes must all match.\n * @param indices indices of tensors to gather\n * @param elementDtype output tensor dtype\n * @param elementShape output tensor element shape\n */\n gather(indices: number[], elementDtype: DataType, elementShape: number[]):\n Tensor {\n if (elementDtype !== this.elementDtype) {\n throw new Error(`Invalid data types; op elements ${\n elementDtype}, but list elements ${this.elementDtype}`);\n }\n\n assertShapesMatchAllowUndefinedSize(\n this.elementShape, elementShape, 'TensorList shape mismatch: ');\n\n // When indices is greater than the size of the list, indices beyond the\n // size of the list are ignored.\n indices = indices.slice(0, this.size());\n const outputElementShape =\n inferElementShape(this.elementShape, this.tensors, elementShape);\n if (indices.length === 0) {\n return tensor([], [0].concat(outputElementShape));\n }\n\n return tidy(() => {\n const tensors =\n indices.map(i => reshape(this.tensors[i], outputElementShape));\n return stack(tensors, 0);\n });\n }\n\n /**\n * Return the values in the TensorList as a concatenated Tensor.\n * @param elementDtype output tensor dtype\n * @param elementShape output tensor element shape\n */\n concat(elementDtype: DataType, elementShape: number[]): Tensor {\n if (!!elementDtype && elementDtype !== this.elementDtype) {\n throw new Error(`TensorList dtype is ${\n this.elementDtype} but concat requested dtype ${elementDtype}`);\n }\n\n assertShapesMatchAllowUndefinedSize(\n this.elementShape, elementShape, 'TensorList shape mismatch: ');\n const outputElementShape =\n inferElementShape(this.elementShape, this.tensors, elementShape);\n\n if (this.size() === 0) {\n return tensor([], [0].concat(outputElementShape));\n }\n return tidy(() => {\n const tensors = this.tensors.map(t => reshape(t, outputElementShape));\n return concat(tensors, 0);\n });\n }\n}\n\n/**\n * Creates a TensorList which, when stacked, has the value of tensor.\n * @param tensor from tensor\n * @param elementShape output tensor element shape\n */\nexport function fromTensor(\n tensor: Tensor, elementShape: number[], elementDtype: DataType) {\n const dtype = tensor.dtype;\n if (tensor.shape.length < 1) {\n throw new Error(\n `Tensor must be at least a vector, but saw shape: ${tensor.shape}`);\n }\n if (tensor.dtype !== elementDtype) {\n throw new Error(`Invalid data types; op elements ${\n tensor.dtype}, but list elements ${elementDtype}`);\n }\n const tensorElementShape = tensor.shape.slice(1);\n assertShapesMatchAllowUndefinedSize(\n tensorElementShape, elementShape, 'TensorList shape mismatch: ');\n const tensorList: Tensor[] = unstack(tensor);\n return new TensorList(tensorList, elementShape, dtype);\n}\n\n/**\n * Return a TensorList of the given size with empty elements.\n * @param elementShape the shape of the future elements of the list\n * @param elementDtype the desired type of elements in the list\n * @param numElements the number of elements to reserve\n * @param maxNumElements the maximum number of elements in th list\n */\nexport function reserve(\n elementShape: number[], elementDtype: DataType, numElements: number,\n maxNumElements: number) {\n return new TensorList([], elementShape, elementDtype, maxNumElements);\n}\n\n/**\n * Put tensors at specific indices of a stacked tensor into a TensorList.\n * @param indices list of indices on how to scatter the tensor.\n * @param tensor input tensor.\n * @param elementShape the shape of the future elements of the list\n * @param numElements the number of elements to scatter\n */\nexport function scatter(\n tensor: Tensor, indices: number[], elementShape: number[],\n numElements?: number): TensorList {\n if (indices.length !== tensor.shape[0]) {\n throw new Error(`Expected len(indices) == tensor.shape[0], but saw: ${\n indices.length} vs. ${tensor.shape[0]}`);\n }\n\n const maxIndex = Math.max(...indices);\n\n if (numElements != null && numElements !== -1 && maxIndex >= numElements) {\n throw new Error(\n `Max index must be < array size (${maxIndex} vs. ${numElements})`);\n }\n\n const list = new TensorList([], elementShape, tensor.dtype, numElements);\n const tensors = unstack(tensor, 0);\n indices.forEach((value, index) => {\n list.setItem(value, tensors[index]);\n });\n return list;\n}\n\n/**\n * Split the values of a Tensor into a TensorList.\n * @param length the lengths to use when splitting value along\n * its first dimension.\n * @param tensor the tensor to split.\n * @param elementShape the shape of the future elements of the list\n */\nexport function split(\n tensor: Tensor, length: number[], elementShape: number[]) {\n let totalLength = 0;\n const cumulativeLengths = length.map(len => {\n totalLength += len;\n return totalLength;\n });\n\n if (totalLength !== tensor.shape[0]) {\n throw new Error(`Expected sum of lengths to be equal to\n tensor.shape[0], but sum of lengths is\n ${totalLength}, and tensor's shape is: ${tensor.shape}`);\n }\n\n const shapeWithoutFirstDim = tensor.shape.slice(1);\n const outputElementShape =\n mergeElementShape(shapeWithoutFirstDim, elementShape);\n const elementPerRow = totalLength === 0 ? 0 : tensor.size / totalLength;\n const tensors: Tensor[] = tidy(() => {\n const tensors = [];\n tensor = reshape(tensor, [1, totalLength, elementPerRow]);\n for (let i = 0; i < length.length; ++i) {\n const previousLength = (i === 0) ? 0 : cumulativeLengths[i - 1];\n const indices = [0, previousLength, 0];\n const sizes = [1, length[i], elementPerRow];\n tensors[i] = reshape(\n slice(tensor, indices, sizes), outputElementShape as number[]);\n }\n tensor.dispose();\n return tensors;\n });\n\n const list = new TensorList([], elementShape, tensor.dtype, length.length);\n\n for (let i = 0; i < tensors.length; i++) {\n list.setItem(i, tensors[i]);\n }\n return list;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataType, scalar, Tensor} from '@tensorflow/tfjs-core';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {TensorArray} from '../../executor/tensor_array';\nimport {fromTensor, reserve, scatter, split} from '../../executor/tensor_list';\nimport {InternalOpAsyncExecutor, Node} from '../types';\n\nimport {cloneTensor, getParamValue, getTensor} from './utils';\n\nexport const executeOp: InternalOpAsyncExecutor = async(\n node: Node, tensorMap: NamedTensorsMap,\n context: ExecutionContext): Promise => {\n switch (node.op) {\n case 'If':\n case 'StatelessIf': {\n const thenFunc =\n getParamValue('thenBranch', node, tensorMap, context) as string;\n const elseFunc =\n getParamValue('elseBranch', node, tensorMap, context) as string;\n const cond = getParamValue('cond', node, tensorMap, context) as Tensor;\n const args = getParamValue('args', node, tensorMap, context) as Tensor[];\n const condValue = await cond.data();\n if (condValue[0]) {\n return context.functionMap[thenFunc].executeFunctionAsync(\n args, context.tensorArrayMap, context.tensorListMap);\n } else {\n return context.functionMap[elseFunc].executeFunctionAsync(\n args, context.tensorArrayMap, context.tensorListMap);\n }\n }\n case 'While':\n case 'StatelessWhile': {\n const bodyFunc =\n getParamValue('body', node, tensorMap, context) as string;\n const condFunc =\n getParamValue('cond', node, tensorMap, context) as string;\n const args = getParamValue('args', node, tensorMap, context) as Tensor[];\n\n // Calculate the condition of the loop\n const condResult =\n (await context.functionMap[condFunc].executeFunctionAsync(\n args, context.tensorArrayMap, context.tensorListMap));\n const argIds = args.map(tensor => tensor.id);\n let condValue = await condResult[0].data();\n // Dispose the intermediate tensors for condition function\n condResult.forEach(tensor => {\n if (!tensor.kept && argIds.indexOf(tensor.id) === -1) {\n tensor.dispose();\n }\n });\n\n let result: Tensor[] = args;\n\n while (condValue[0]) {\n // Record the previous result for intermediate tensor tracking\n const origResult = result;\n // Execution the body of the loop\n result = await context.functionMap[bodyFunc].executeFunctionAsync(\n result, context.tensorArrayMap, context.tensorListMap);\n const resultIds = result.map(tensor => tensor.id);\n\n // Dispose the intermediate tensor for body function that is not global\n // kept, not input/output of the body function\n origResult.forEach(tensor => {\n if (!tensor.kept && argIds.indexOf(tensor.id) === -1 &&\n resultIds.indexOf(tensor.id) === -1) {\n tensor.dispose();\n }\n });\n\n // Recalcuate the condition of the loop using the latest results.\n const condResult =\n (await context.functionMap[condFunc].executeFunctionAsync(\n result, context.tensorArrayMap, context.tensorListMap));\n condValue = await condResult[0].data();\n // Dispose the intermediate tensors for condition function\n condResult.forEach(tensor => {\n if (!tensor.kept && argIds.indexOf(tensor.id) === -1 &&\n resultIds.indexOf(tensor.id) === -1) {\n tensor.dispose();\n }\n });\n }\n return result;\n }\n case 'LoopCond': {\n const pred = getParamValue('pred', node, tensorMap, context) as Tensor;\n return [cloneTensor(pred)];\n }\n case 'Switch': {\n const pred = getParamValue('pred', node, tensorMap, context) as Tensor;\n let data = getParamValue('data', node, tensorMap, context) as Tensor;\n if (!data.kept) {\n data = cloneTensor(data);\n }\n // Outputs nodes :0 => false, :1 => true\n return (await pred.data())[0] ? [undefined, data] : [data, undefined];\n }\n case 'Merge': {\n const inputName = node.inputNames.find(\n name => getTensor(name, tensorMap, context) !== undefined);\n if (inputName) {\n const data = getTensor(inputName, tensorMap, context);\n return [cloneTensor(data)];\n }\n return undefined;\n }\n case 'Enter': {\n const frameId =\n getParamValue('frameName', node, tensorMap, context) as string;\n const data = getParamValue('tensor', node, tensorMap, context) as Tensor;\n context.enterFrame(frameId);\n return [cloneTensor(data)];\n }\n case 'Exit': {\n const data = getParamValue('tensor', node, tensorMap, context) as Tensor;\n context.exitFrame();\n return [cloneTensor(data)];\n }\n case 'NextIteration': {\n const data = getParamValue('tensor', node, tensorMap, context) as Tensor;\n context.nextIteration();\n return [cloneTensor(data)];\n }\n case 'TensorArrayV3': {\n const size = getParamValue('size', node, tensorMap, context) as number;\n const dtype =\n getParamValue('dtype', node, tensorMap, context) as DataType;\n const elementShape =\n getParamValue('elementShape', node, tensorMap, context) as number[];\n const dynamicSize =\n getParamValue('dynamicSize', node, tensorMap, context) as boolean;\n const clearAfterRead =\n getParamValue('clearAfterRead', node, tensorMap, context) as boolean;\n const identicalElementShapes =\n getParamValue('identicalElementShapes', node, tensorMap, context) as\n boolean;\n const name = getParamValue('name', node, tensorMap, context) as string;\n const tensorArray = new TensorArray(\n name, dtype, size, elementShape, identicalElementShapes, dynamicSize,\n clearAfterRead);\n context.addTensorArray(tensorArray);\n return [tensorArray.idTensor, scalar(1.0)];\n }\n case 'TensorArrayWriteV3': {\n const id =\n getParamValue('tensorArrayId', node, tensorMap, context) as Tensor;\n const index = getParamValue('index', node, tensorMap, context) as number;\n const writeTensor =\n getParamValue('tensor', node, tensorMap, context) as Tensor;\n const writeTensorArray = context.getTensorArray(id.id);\n writeTensorArray.write(index, writeTensor);\n return [writeTensorArray.idTensor];\n }\n case 'TensorArrayReadV3': {\n const readId =\n getParamValue('tensorArrayId', node, tensorMap, context) as Tensor;\n const readIndex =\n getParamValue('index', node, tensorMap, context) as number;\n const readTensorArray = context.getTensorArray(readId.id);\n return [readTensorArray.read(readIndex)];\n }\n case 'TensorArrayGatherV3': {\n const gatherId =\n getParamValue('tensorArrayId', node, tensorMap, context) as Tensor;\n const gatherIndices =\n getParamValue('indices', node, tensorMap, context) as number[];\n const gatherDtype =\n getParamValue('dtype', node, tensorMap, context) as DataType;\n const gatherTensorArray = context.getTensorArray(gatherId.id);\n return [gatherTensorArray.gather(gatherIndices, gatherDtype)];\n }\n case 'TensorArrayScatterV3': {\n const scatterId =\n getParamValue('tensorArrayId', node, tensorMap, context) as Tensor;\n const scatterIndices =\n getParamValue('indices', node, tensorMap, context) as number[];\n const scatterTensor =\n getParamValue('tensor', node, tensorMap, context) as Tensor;\n const scatterTensorArray = context.getTensorArray(scatterId.id);\n scatterTensorArray.scatter(scatterIndices, scatterTensor);\n return [scatterTensorArray.idTensor];\n }\n case 'TensorArrayConcatV3': {\n const concatId =\n getParamValue('tensorArrayId', node, tensorMap, context) as Tensor;\n const concatTensorArray = context.getTensorArray(concatId.id);\n const concatDtype =\n getParamValue('dtype', node, tensorMap, context) as DataType;\n return [concatTensorArray.concat(concatDtype)];\n }\n case 'TensorArraySplitV3': {\n const splitId =\n getParamValue('tensorArrayId', node, tensorMap, context) as Tensor;\n const splitTensor =\n getParamValue('tensor', node, tensorMap, context) as Tensor;\n const lengths =\n getParamValue('lengths', node, tensorMap, context) as number[];\n const splitTensorArray = context.getTensorArray(splitId.id);\n splitTensorArray.split(lengths, splitTensor);\n return [splitTensorArray.idTensor];\n }\n case 'TensorArraySizeV3': {\n const sizeId =\n getParamValue('tensorArrayId', node, tensorMap, context) as Tensor;\n const sizeTensorArray = context.getTensorArray(sizeId.id);\n return [scalar(sizeTensorArray.size(), 'int32')];\n }\n case 'TensorArrayCloseV3': {\n const closeId =\n getParamValue('tensorArrayId', node, tensorMap, context) as Tensor;\n const closeTensorArray = context.getTensorArray(closeId.id);\n closeTensorArray.clearAndClose();\n return [closeTensorArray.idTensor];\n }\n case 'TensorListSetItem': {\n const idTensor =\n getParamValue('tensorListId', node, tensorMap, context) as Tensor;\n const index = getParamValue('index', node, tensorMap, context) as number;\n const writeTensor =\n getParamValue('tensor', node, tensorMap, context) as Tensor;\n const tensorList = context.getTensorList(idTensor.id);\n tensorList.setItem(index, writeTensor);\n return [tensorList.idTensor];\n }\n case 'TensorListGetItem': {\n const idTensor =\n getParamValue('tensorListId', node, tensorMap, context) as Tensor;\n const readIndex =\n getParamValue('index', node, tensorMap, context) as number;\n const elementShape =\n getParamValue('elementShape', node, tensorMap, context) as number[];\n\n const elementDType =\n getParamValue('elementDType', node, tensorMap, context) as DataType;\n const tensorList = context.getTensorList(idTensor.id);\n return [tensorList.getItem(readIndex, elementShape, elementDType)];\n }\n case 'TensorListScatterV2':\n case 'TensorListScatter': {\n const scatterIndices =\n getParamValue('indices', node, tensorMap, context) as number[];\n const scatterTensor =\n getParamValue('tensor', node, tensorMap, context) as Tensor;\n const elementShape =\n getParamValue('elementShape', node, tensorMap, context) as number[];\n const numElements =\n getParamValue('numElements', node, tensorMap, context) as number;\n const tensorList =\n scatter(scatterTensor, scatterIndices, elementShape, numElements);\n context.addTensorList(tensorList);\n return [tensorList.idTensor];\n }\n case 'TensorListReserve':\n case 'EmptyTensorList': {\n const elementShape =\n getParamValue('elementShape', node, tensorMap, context) as number[];\n const elementDtype =\n getParamValue('elementDType', node, tensorMap, context) as DataType;\n let numElementsParam;\n\n if (node.op === 'TensorListReserve') {\n numElementsParam = 'numElements';\n } else {\n numElementsParam = 'maxNumElements';\n }\n\n const numElements =\n getParamValue(numElementsParam, node, tensorMap, context) as number;\n const maxNumElements = node.op === 'TensorListReserve' ? -1 : numElements;\n const tensorList =\n reserve(elementShape, elementDtype, numElements, maxNumElements);\n context.addTensorList(tensorList);\n return [tensorList.idTensor];\n }\n case 'TensorListGather': {\n const gatherId =\n getParamValue('tensorListId', node, tensorMap, context) as Tensor;\n const gatherIndices =\n getParamValue('indices', node, tensorMap, context) as number[];\n const elementShape =\n getParamValue('elementShape', node, tensorMap, context) as number[];\n const elementDtype =\n getParamValue('elementDType', node, tensorMap, context) as DataType;\n const tensorList = context.getTensorList(gatherId.id);\n return [tensorList.gather(gatherIndices, elementDtype, elementShape)];\n }\n case 'TensorListStack': {\n const idTensor =\n getParamValue('tensorListId', node, tensorMap, context) as Tensor;\n const elementShape =\n getParamValue('elementShape', node, tensorMap, context) as number[];\n const elementDtype =\n getParamValue('elementDType', node, tensorMap, context) as DataType;\n const numElements =\n getParamValue('numElements', node, tensorMap, context) as number;\n const tensorList = context.getTensorList(idTensor.id);\n return [tensorList.stack(elementShape, elementDtype, numElements)];\n }\n case 'TensorListFromTensor': {\n const tensor =\n getParamValue('tensor', node, tensorMap, context) as Tensor;\n const elementShape =\n getParamValue('elementShape', node, tensorMap, context) as number[];\n const elementDtype =\n getParamValue('elementDType', node, tensorMap, context) as DataType;\n const tensorList = fromTensor(tensor, elementShape, elementDtype);\n context.addTensorList(tensorList);\n return [tensorList.idTensor];\n }\n case 'TensorListConcat':\n case 'TensorListConcatV2': {\n const concatId =\n getParamValue('tensorListId', node, tensorMap, context) as Tensor;\n const tensorList = context.getTensorList(concatId.id);\n const concatDtype =\n getParamValue('dtype', node, tensorMap, context) as DataType;\n const elementShape =\n getParamValue('elementShape', node, tensorMap, context) as number[];\n return [tensorList.concat(concatDtype, elementShape)];\n }\n case 'TensorListPushBack': {\n const idTensor =\n getParamValue('tensorListId', node, tensorMap, context) as Tensor;\n const writeTensor =\n getParamValue('tensor', node, tensorMap, context) as Tensor;\n const tensorList = context.getTensorList(idTensor.id);\n tensorList.pushBack(writeTensor);\n return [tensorList.idTensor];\n }\n case 'TensorListPopBack': {\n const idTensor =\n getParamValue('tensorListId', node, tensorMap, context) as Tensor;\n const elementShape =\n getParamValue('elementShape', node, tensorMap, context) as number[];\n const elementDType =\n getParamValue('elementDType', node, tensorMap, context) as DataType;\n const tensorList = context.getTensorList(idTensor.id);\n return [tensorList.popBack(elementShape, elementDType)];\n }\n case 'TensorListSplit': {\n const splitTensor =\n getParamValue('tensor', node, tensorMap, context) as Tensor;\n const elementShape =\n getParamValue('elementShape', node, tensorMap, context) as number[];\n const lengths =\n getParamValue('lengths', node, tensorMap, context) as number[];\n\n const tensorList = split(splitTensor, lengths, elementShape);\n context.addTensorList(tensorList);\n return [tensorList.idTensor];\n }\n case 'TensorListLength': {\n const idTensor =\n getParamValue('tensorListId', node, tensorMap, context) as Tensor;\n const tensorList = context.getTensorList(idTensor.id);\n return [scalar(tensorList.size(), 'int32')];\n }\n case 'TensorListResize': {\n const idTensor =\n getParamValue('tensorListId', node, tensorMap, context) as Tensor;\n const size = getParamValue('size', node, tensorMap, context) as number;\n\n const srcTensorList = context.getTensorList(idTensor.id);\n const destTensorList = srcTensorList.resize(size);\n context.addTensorList(destTensorList);\n return [destTensorList.idTensor];\n }\n default:\n throw TypeError(`Node type ${node.op} is not implemented`);\n }\n};\n\nexport const CATEGORY = 'control';\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Rank, Tensor, Tensor3D, Tensor4D, Tensor5D} from '@tensorflow/tfjs-core';\n// tslint:disable-next-line: no-imports-from-dist\nimport * as tfOps from '@tensorflow/tfjs-core/dist/ops/ops_for_converter';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {InternalOpExecutor, Node} from '../types';\n\nimport {getPadding, getParamValue} from './utils';\n\nfunction fusedConvAndDepthWiseParams(\n node: Node, tensorMap: NamedTensorsMap, context: ExecutionContext) {\n const [extraOp, activationFunc] =\n (getParamValue('fusedOps', node, tensorMap, context) as string[]);\n\n const isBiasAdd = extraOp === 'biasadd';\n const noBiasAdd = !isBiasAdd;\n const isPrelu = activationFunc === 'prelu';\n const isBatchNorm = extraOp === 'fusedbatchnorm';\n\n const numArgs =\n (getParamValue('numArgs', node, tensorMap, context) as number);\n if (isBiasAdd) {\n if (isPrelu && numArgs !== 2) {\n throw new Error(\n 'FusedConv2d and DepthwiseConv2d with BiasAdd and Prelu ' +\n 'must have two extra arguments: bias and alpha.');\n }\n if (!isPrelu && isBiasAdd && numArgs !== 1) {\n throw new Error(\n 'FusedConv2d and DepthwiseConv2d with BiasAdd must have ' +\n 'one extra argument: bias.');\n }\n }\n if (isBatchNorm) {\n throw new Error(\n 'FusedConv2d and DepthwiseConv2d with FusedBatchNorm is not supported');\n }\n const stride = getParamValue('strides', node, tensorMap, context) as number[];\n const pad = getPadding(node, tensorMap, context);\n const dataFormat =\n (getParamValue('dataFormat', node, tensorMap, context) as string)\n .toUpperCase();\n const dilations =\n getParamValue('dilations', node, tensorMap, context) as number[];\n let [biasArg, preluArg] =\n getParamValue('args', node, tensorMap, context) as Tensor[];\n if (noBiasAdd) {\n preluArg = biasArg;\n biasArg = undefined;\n }\n const leakyreluAlpha =\n getParamValue('leakyreluAlpha', node, tensorMap, context) as number;\n\n return {\n stride,\n pad,\n dataFormat,\n dilations,\n biasArg,\n preluArg,\n activationFunc,\n leakyreluAlpha\n };\n}\n\nexport const executeOp: InternalOpExecutor =\n (node: Node, tensorMap: NamedTensorsMap,\n context: ExecutionContext, ops = tfOps): Tensor[] => {\n switch (node.op) {\n case 'Conv1D': {\n const stride =\n getParamValue('stride', node, tensorMap, context) as number;\n const pad = getParamValue('pad', node, tensorMap, context);\n const dataFormat =\n (getParamValue('dataFormat', node, tensorMap, context) as string)\n .toUpperCase();\n const dilation =\n getParamValue('dilation', node, tensorMap, context) as number;\n return [ops.conv1d(\n getParamValue('x', node, tensorMap, context) as Tensor3D,\n getParamValue('filter', node, tensorMap, context) as Tensor3D,\n stride, pad as 'valid' | 'same', dataFormat as 'NWC' | 'NCW',\n dilation)];\n }\n case 'Conv2D': {\n const stride =\n getParamValue('strides', node, tensorMap, context) as number[];\n const pad = getPadding(node, tensorMap, context);\n const dataFormat =\n (getParamValue('dataFormat', node, tensorMap, context) as string)\n .toUpperCase();\n const dilations =\n getParamValue('dilations', node, tensorMap, context) as number[];\n return [ops.conv2d(\n getParamValue('x', node, tensorMap, context) as Tensor3D |\n Tensor4D,\n getParamValue('filter', node, tensorMap, context) as Tensor4D,\n [stride[1], stride[2]], pad as 'valid' | 'same',\n dataFormat as 'NHWC' | 'NCHW', [dilations[1], dilations[2]])];\n }\n case '_FusedConv2D': {\n const {\n stride,\n pad,\n dataFormat,\n dilations,\n biasArg,\n preluArg,\n activationFunc,\n leakyreluAlpha\n } = fusedConvAndDepthWiseParams(node, tensorMap, context);\n\n return [ops.fused.conv2d({\n x: getParamValue('x', node, tensorMap, context) as Tensor3D |\n Tensor4D,\n filter: getParamValue('filter', node, tensorMap, context) as\n Tensor4D,\n strides: [stride[1], stride[2]],\n pad: pad as 'valid' | 'same',\n dataFormat: dataFormat as 'NHWC' | 'NCHW',\n dilations: [dilations[1], dilations[2]],\n bias: biasArg,\n activation: activationFunc as tfOps.fused.Activation,\n preluActivationWeights: preluArg,\n leakyreluAlpha\n })];\n }\n\n case 'FusedDepthwiseConv2dNative': {\n const {\n stride,\n pad,\n dataFormat,\n dilations,\n biasArg,\n preluArg,\n activationFunc,\n leakyreluAlpha,\n } = fusedConvAndDepthWiseParams(node, tensorMap, context);\n\n return [ops.fused.depthwiseConv2d({\n x: getParamValue('x', node, tensorMap, context) as Tensor3D |\n Tensor4D,\n filter: getParamValue('filter', node, tensorMap, context) as\n Tensor4D,\n strides: [stride[1], stride[2]],\n pad: pad as 'valid' | 'same',\n dataFormat: dataFormat as 'NHWC' | 'NCHW',\n dilations: [dilations[1], dilations[2]],\n bias: biasArg,\n activation: activationFunc as tfOps.fused.Activation,\n preluActivationWeights: preluArg,\n leakyreluAlpha\n })];\n }\n case 'Conv2DBackpropInput':\n case 'Conv2dTranspose': {\n const shape = getParamValue(\n 'outputShape', node, tensorMap,\n context) as [number, number, number] |\n [number, number, number, number];\n const stride =\n getParamValue('strides', node, tensorMap, context) as number[];\n const pad = getPadding(node, tensorMap, context);\n return [ops.conv2dTranspose(\n getParamValue('x', node, tensorMap, context) as Tensor3D |\n Tensor4D,\n getParamValue('filter', node, tensorMap, context) as Tensor4D,\n shape, [stride[1], stride[2]], pad as 'valid' | 'same')];\n }\n case 'DepthwiseConv2dNative':\n case 'DepthwiseConv2d': {\n const stride =\n getParamValue('strides', node, tensorMap, context) as number[];\n const pad = getPadding(node, tensorMap, context);\n const dilations =\n getParamValue('dilations', node, tensorMap, context) as number[];\n const dataFormat =\n (getParamValue('dataFormat', node, tensorMap, context) as string)\n .toUpperCase();\n\n return [ops.depthwiseConv2d(\n getParamValue('input', node, tensorMap, context) as Tensor3D |\n Tensor4D,\n getParamValue('filter', node, tensorMap, context) as Tensor4D,\n [stride[1], stride[2]], pad as 'valid' | 'same',\n dataFormat as 'NHWC' | 'NCHW', [dilations[1], dilations[2]])];\n }\n case 'Conv3D': {\n const stride =\n getParamValue('strides', node, tensorMap, context) as number[];\n const pad = getParamValue('pad', node, tensorMap, context);\n const dataFormat =\n (getParamValue('dataFormat', node, tensorMap, context) as string)\n .toUpperCase();\n const dilations =\n getParamValue('dilations', node, tensorMap, context) as number[];\n return [ops.conv3d(\n getParamValue('x', node, tensorMap, context) as Tensor4D |\n Tensor,\n getParamValue('filter', node, tensorMap, context) as\n Tensor,\n [stride[1], stride[2], stride[3]], pad as 'valid' | 'same',\n dataFormat as 'NDHWC' | 'NCDHW',\n [dilations[1], dilations[2], dilations[3]])];\n }\n case 'AvgPool': {\n const stride =\n getParamValue('strides', node, tensorMap, context) as number[];\n const pad = getParamValue('pad', node, tensorMap, context);\n const kernelSize =\n getParamValue('kernelSize', node, tensorMap, context) as number[];\n\n return [ops.avgPool(\n getParamValue('x', node, tensorMap, context) as Tensor3D |\n Tensor4D,\n [kernelSize[1], kernelSize[2]], [stride[1], stride[2]],\n pad as 'valid' | 'same')];\n }\n case 'MaxPool': {\n const stride =\n getParamValue('strides', node, tensorMap, context) as number[];\n const pad = getParamValue('pad', node, tensorMap, context);\n const kernelSize =\n getParamValue('kernelSize', node, tensorMap, context) as number[];\n\n return [ops.maxPool(\n getParamValue('x', node, tensorMap, context) as Tensor3D |\n Tensor4D,\n [kernelSize[1], kernelSize[2]], [stride[1], stride[2]],\n pad as 'valid' | 'same')];\n }\n case 'MaxPoolWithArgmax': {\n const stride =\n getParamValue('strides', node, tensorMap, context) as number[];\n const pad = getParamValue('pad', node, tensorMap, context);\n const kernelSize =\n getParamValue('kernelSize', node, tensorMap, context) as number[];\n const includeBatchInIndex =\n getParamValue('includeBatchInIndex', node, tensorMap, context) as\n boolean;\n const {result, indexes} = ops.maxPoolWithArgmax(\n getParamValue('x', node, tensorMap, context) as Tensor4D,\n [kernelSize[1], kernelSize[2]], [stride[1], stride[2]],\n pad as 'valid' | 'same', includeBatchInIndex);\n return [result, indexes];\n }\n case 'AvgPool3D': {\n const stride =\n getParamValue('strides', node, tensorMap, context) as number[];\n const pad = getParamValue('pad', node, tensorMap, context);\n const kernelSize =\n getParamValue('kernelSize', node, tensorMap, context) as number[];\n\n return [ops.avgPool3d(\n getParamValue('x', node, tensorMap, context) as Tensor5D,\n [kernelSize[1], kernelSize[2], kernelSize[3]],\n [stride[1], stride[2], stride[3]], pad as 'valid' | 'same')];\n }\n\n case 'MaxPool3D': {\n const stride =\n getParamValue('strides', node, tensorMap, context) as number[];\n const pad = getParamValue('pad', node, tensorMap, context);\n const kernelSize =\n getParamValue('kernelSize', node, tensorMap, context) as number[];\n\n return [ops.maxPool3d(\n getParamValue('x', node, tensorMap, context) as Tensor5D,\n [kernelSize[1], kernelSize[2], kernelSize[3]],\n [stride[1], stride[2], stride[3]], pad as 'valid' | 'same')];\n }\n\n case 'Dilation2D': {\n const strides =\n getParamValue('strides', node, tensorMap, context) as number[];\n const pad = getParamValue('pad', node, tensorMap, context);\n const dilations =\n getParamValue('dilations', node, tensorMap, context) as number[];\n\n // strides: [1, stride_height, stride_width, 1].\n const strideHeight = strides[1];\n const strideWidth = strides[2];\n\n // dilations: [1, dilation_height, dilation_width, 1].\n const dilationHeight = dilations[1];\n const dilationWidth = dilations[2];\n\n return [ops.dilation2d(\n getParamValue('x', node, tensorMap, context) as Tensor3D |\n Tensor4D,\n getParamValue('filter', node, tensorMap, context) as Tensor3D,\n [strideHeight, strideWidth], pad as 'valid' | 'same',\n [dilationHeight, dilationWidth], 'NHWC' /* dataFormat */)];\n }\n\n default:\n throw TypeError(`Node type ${node.op} is not implemented`);\n }\n };\n\nexport const CATEGORY = 'convolution';\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataType, Tensor, Tensor1D} from '@tensorflow/tfjs-core';\n// tslint:disable-next-line: no-imports-from-dist\nimport * as tfOps from '@tensorflow/tfjs-core/dist/ops/ops_for_converter';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {InternalOpExecutor, Node} from '../types';\n\nimport {getParamValue} from './utils';\n\nexport const executeOp: InternalOpExecutor =\n (node: Node, tensorMap: NamedTensorsMap, context: ExecutionContext,\n ops = tfOps): Tensor[] => {\n switch (node.op) {\n case 'Fill': {\n const shape =\n getParamValue('shape', node, tensorMap, context) as number[];\n const dtype =\n getParamValue('dtype', node, tensorMap, context) as DataType;\n const value =\n getParamValue('value', node, tensorMap, context) as number;\n return [ops.fill(shape, value, dtype)];\n }\n case 'LinSpace': {\n const start =\n getParamValue('start', node, tensorMap, context) as number;\n const stop =\n getParamValue('stop', node, tensorMap, context) as number;\n const num = getParamValue('num', node, tensorMap, context) as number;\n return [ops.linspace(start, stop, num)];\n }\n case 'Multinomial': {\n const logits =\n getParamValue('logits', node, tensorMap, context) as Tensor1D;\n const numSamples =\n getParamValue('numSamples', node, tensorMap, context) as number;\n const seed =\n getParamValue('seed', node, tensorMap, context) as number;\n return [ops.multinomial(logits, numSamples, seed)];\n }\n case 'OneHot': {\n const indices =\n getParamValue('indices', node, tensorMap, context) as Tensor1D;\n const depth =\n getParamValue('depth', node, tensorMap, context) as number;\n const onValue =\n getParamValue('onValue', node, tensorMap, context) as number;\n const offValue =\n getParamValue('offValue', node, tensorMap, context) as number;\n const dtype =\n getParamValue('dtype', node, tensorMap, context) as DataType;\n return [ops.oneHot(indices, depth, onValue, offValue, dtype)];\n }\n case 'Ones': {\n return [ops.ones(\n getParamValue('shape', node, tensorMap, context) as number[],\n getParamValue('dtype', node, tensorMap, context) as DataType)];\n }\n case 'OnesLike': {\n return [ops.onesLike(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n }\n case 'RandomStandardNormal': {\n return [ops.randomStandardNormal(\n getParamValue('shape', node, tensorMap, context) as number[],\n getParamValue('dtype', node, tensorMap, context) as 'float32' |\n 'int32',\n getParamValue('seed', node, tensorMap, context) as number)];\n }\n case 'RandomUniform': {\n return [ops.randomUniform(\n // tslint:disable-next-line:no-any\n getParamValue('shape', node, tensorMap, context) as any,\n getParamValue('minval', node, tensorMap, context) as number,\n getParamValue('maxval', node, tensorMap, context) as number,\n getParamValue('dtype', node, tensorMap, context) as DataType)];\n }\n case 'Range': {\n const start =\n getParamValue('start', node, tensorMap, context) as number;\n const stop =\n getParamValue('stop', node, tensorMap, context) as number;\n const step =\n getParamValue('step', node, tensorMap, context) as number;\n return [ops.range(\n start, stop, step,\n getParamValue('dtype', node, tensorMap, context) as 'float32' |\n 'int32')];\n }\n case 'TruncatedNormal': {\n const shape =\n getParamValue('shape', node, tensorMap, context) as number[];\n const mean =\n getParamValue('mean', node, tensorMap, context) as number;\n const stdDev =\n getParamValue('stdDev', node, tensorMap, context) as number;\n const seed =\n getParamValue('seed', node, tensorMap, context) as number;\n return [ops.truncatedNormal(\n shape, mean, stdDev,\n getParamValue('dtype', node, tensorMap, context) as 'float32' |\n 'int32',\n seed)];\n }\n case 'Zeros': {\n return [ops.zeros(\n getParamValue('shape', node, tensorMap, context) as number[],\n getParamValue('dtype', node, tensorMap, context) as DataType)];\n }\n case 'ZerosLike': {\n return [ops.zerosLike(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n }\n default:\n throw TypeError(`Node type ${node.op} is not implemented`);\n }\n };\n\nexport const CATEGORY = 'creation';\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor, Tensor1D, Tensor2D} from '@tensorflow/tfjs-core';\n// tslint:disable-next-line: no-imports-from-dist\nimport * as tfOps from '@tensorflow/tfjs-core/dist/ops/ops_for_converter';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport { ResourceManager } from '../../executor/resource_manager';\nimport {InternalOpAsyncExecutor, Node} from '../types';\n\nimport {getParamValue} from './utils';\n\nfunction nmsParams(\n node: Node, tensorMap: NamedTensorsMap, context: ExecutionContext) {\n const boxes = getParamValue('boxes', node, tensorMap, context) as Tensor;\n const scores = getParamValue('scores', node, tensorMap, context) as Tensor;\n const maxOutputSize =\n getParamValue('maxOutputSize', node, tensorMap, context) as number;\n const iouThreshold =\n getParamValue('iouThreshold', node, tensorMap, context) as number;\n const scoreThreshold =\n getParamValue('scoreThreshold', node, tensorMap, context) as number;\n const softNmsSigma =\n getParamValue('softNmsSigma', node, tensorMap, context) as number;\n\n return {\n boxes,\n scores,\n maxOutputSize,\n iouThreshold,\n scoreThreshold,\n softNmsSigma\n };\n}\n\nexport const executeOp: InternalOpAsyncExecutor = async(\n node: Node, tensorMap: NamedTensorsMap,\n context: ExecutionContext, resourceManager: ResourceManager,\n ops = tfOps): Promise => {\n switch (node.op) {\n case 'NonMaxSuppressionV5': {\n const {\n boxes,\n scores,\n maxOutputSize,\n iouThreshold,\n scoreThreshold,\n softNmsSigma\n } = nmsParams(node, tensorMap, context);\n\n const result = await ops.image.nonMaxSuppressionWithScoreAsync(\n boxes as Tensor2D, scores as Tensor1D, maxOutputSize, iouThreshold,\n scoreThreshold, softNmsSigma);\n\n return [result.selectedIndices, result.selectedScores];\n }\n case 'NonMaxSuppressionV4': {\n const {boxes, scores, maxOutputSize, iouThreshold, scoreThreshold} =\n nmsParams(node, tensorMap, context);\n\n const padToMaxOutputSize =\n getParamValue('padToMaxOutputSize', node, tensorMap, context) as\n boolean;\n\n const result = await ops.image.nonMaxSuppressionPaddedAsync(\n boxes as Tensor2D, scores as Tensor1D, maxOutputSize, iouThreshold,\n scoreThreshold, padToMaxOutputSize);\n\n return [result.selectedIndices, result.validOutputs];\n }\n case 'NonMaxSuppressionV3':\n case 'NonMaxSuppressionV2': {\n const {boxes, scores, maxOutputSize, iouThreshold, scoreThreshold} =\n nmsParams(node, tensorMap, context);\n\n return [await ops.image.nonMaxSuppressionAsync(\n boxes as Tensor2D, scores as Tensor1D, maxOutputSize, iouThreshold,\n scoreThreshold)];\n }\n case 'Where': {\n const condition = ops.cast(\n (getParamValue('condition', node, tensorMap, context) as Tensor),\n 'bool');\n const result = [await ops.whereAsync(condition)];\n condition.dispose();\n return result;\n }\n case 'ListDiff': {\n return ops.setdiff1dAsync(\n getParamValue('x', node, tensorMap, context) as Tensor,\n getParamValue('y', node, tensorMap, context) as Tensor);\n }\n default:\n throw TypeError(`Node type ${node.op} is not implemented`);\n }\n};\n\nexport const CATEGORY = 'dynamic';\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '@tensorflow/tfjs-core';\n// tslint:disable-next-line: no-imports-from-dist\nimport * as tfOps from '@tensorflow/tfjs-core/dist/ops/ops_for_converter';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {InternalOpExecutor, Node} from '../types';\n\nimport {getParamValue} from './utils';\n\nexport const executeOp: InternalOpExecutor =\n (node: Node, tensorMap: NamedTensorsMap, context: ExecutionContext,\n ops = tfOps):\n Tensor[] => {\n switch (node.op) {\n case 'LowerBound': {\n const sortedSequence =\n getParamValue('sortedSequence', node, tensorMap, context) as\n Tensor;\n const values =\n getParamValue('values', node, tensorMap, context) as Tensor;\n return [ops.lowerBound(sortedSequence, values)];\n }\n case 'TopKV2': {\n const x = getParamValue('x', node, tensorMap, context) as Tensor;\n const k = getParamValue('k', node, tensorMap, context) as number;\n const sorted =\n getParamValue('sorted', node, tensorMap, context) as boolean;\n const result = ops.topk(x, k, sorted);\n return [result.values, result.indices];\n }\n case 'UpperBound': {\n const sortedSequence =\n getParamValue('sortedSequence', node, tensorMap, context) as\n Tensor;\n const values =\n getParamValue('values', node, tensorMap, context) as Tensor;\n return [ops.upperBound(sortedSequence, values)];\n }\n case 'Unique': {\n const x = getParamValue('x', node, tensorMap, context) as Tensor;\n const result = ops.unique(x);\n return [result.values, result.indices];\n }\n case 'UniqueV2': {\n const x = getParamValue('x', node, tensorMap, context) as Tensor;\n const axis =\n getParamValue('axis', node, tensorMap, context) as number;\n const result = ops.unique(x, axis);\n return [result.values, result.indices];\n }\n default:\n throw TypeError(`Node type ${node.op} is not implemented`);\n }\n };\n\nexport const CATEGORY = 'evaluation';\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '@tensorflow/tfjs-core';\n// tslint:disable-next-line: no-imports-from-dist\nimport * as tfOps from '@tensorflow/tfjs-core/dist/ops/ops_for_converter';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {InternalOpExecutor, Node} from '../types';\n\nimport {cloneTensor, getParamValue, getTensor} from './utils';\n\nexport const executeOp: InternalOpExecutor =\n (node: Node, tensorMap: NamedTensorsMap,\n context: ExecutionContext, ops = tfOps): Tensor[] => {\n switch (node.op) {\n case 'Const': {\n return tensorMap[node.name];\n }\n case 'PlaceholderWithDefault':\n const def =\n getParamValue('default', node, tensorMap, context) as Tensor;\n return [getTensor(node.name, tensorMap, context) || def];\n case 'Placeholder':\n return [getTensor(node.name, tensorMap, context)];\n case 'Identity':\n case 'StopGradient':\n case 'FakeQuantWithMinMaxVars': { // This op is currently ignored.\n const data = getParamValue('x', node, tensorMap, context) as Tensor;\n return [cloneTensor(data)];\n }\n case 'IdentityN':\n return (getParamValue('x', node, tensorMap, context) as Tensor[])\n .map((t: Tensor) => cloneTensor(t));\n case 'Snapshot':\n const snapshot =\n (getParamValue('x', node, tensorMap, context) as Tensor);\n return [cloneTensor(snapshot)];\n case 'Shape':\n return [ops.tensor1d(\n (getParamValue('x', node, tensorMap, context) as Tensor).shape,\n 'int32')];\n case 'ShapeN':\n return (getParamValue('x', node, tensorMap, context) as Tensor[])\n .map((t: Tensor) => ops.tensor1d(t.shape));\n case 'Size':\n return [ops.scalar(\n (getParamValue('x', node, tensorMap, context) as Tensor).size,\n 'int32')];\n case 'Rank':\n return [ops.scalar(\n (getParamValue('x', node, tensorMap, context) as Tensor).rank,\n 'int32')];\n case 'NoOp':\n return [ops.scalar(1)];\n case 'Print':\n const input = getParamValue('x', node, tensorMap, context) as Tensor;\n const data =\n getParamValue('data', node, tensorMap, context) as Tensor[];\n const message =\n getParamValue('message', node, tensorMap, context) as string;\n const summarize =\n getParamValue('summarize', node, tensorMap, context) as number;\n console.warn(\n 'The graph has a tf.print() operation,' +\n 'usually used for debugging, which slows down performance.');\n console.log(message);\n for (let i = 0; i < data.length; i++) {\n console.log(Array.prototype.slice.call(data[i].dataSync())\n .slice(0, summarize));\n }\n return [input];\n\n default:\n throw TypeError(`Node type ${node.op} is not implemented`);\n }\n };\n\nexport const CATEGORY = 'graph';\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {DataType, keep, scalar, stack, Tensor, tidy, unstack, util} from '@tensorflow/tfjs-core';\n// tslint:disable-next-line: no-imports-from-dist\nimport * as tfOps from '@tensorflow/tfjs-core/dist/ops/ops_for_converter';\n\n/**\n * Hashtable contains a set of tensors, which can be accessed by key.\n */\nexport class HashTable {\n readonly handle: Tensor;\n\n // tslint:disable-next-line: no-any\n private tensorMap: Map;\n\n get id() {\n return this.handle.id;\n }\n\n /**\n * Constructor of HashTable. Creates a hash table.\n *\n * @param keyDType `dtype` of the table keys.\n * @param valueDType `dtype` of the table values.\n */\n constructor(readonly keyDType: DataType, readonly valueDType: DataType) {\n this.handle = scalar(0);\n // tslint:disable-next-line: no-any\n this.tensorMap = new Map();\n\n keep(this.handle);\n }\n\n /**\n * Dispose the tensors and handle and clear the hashtable.\n */\n clearAndClose() {\n this.tensorMap.forEach(value => value.dispose());\n this.tensorMap.clear();\n this.handle.dispose();\n }\n\n /**\n * The number of items in the hash table.\n */\n size(): number {\n return this.tensorMap.size;\n }\n\n /**\n * The number of items in the hash table as a rank-0 tensor.\n */\n tensorSize(): Tensor {\n return tfOps.scalar(this.size(), 'int32');\n }\n\n /**\n * Replaces the contents of the table with the specified keys and values.\n * @param keys Keys to store in the hashtable.\n * @param values Values to store in the hashtable.\n */\n async import(keys: Tensor, values: Tensor): Promise {\n this.checkKeyAndValueTensor(keys, values);\n\n // We only store the primitive values of the keys, this allows lookup\n // to be O(1).\n const $keys = await keys.data();\n\n // Clear the hashTable before inserting new values.\n this.tensorMap.forEach(value => value.dispose());\n this.tensorMap.clear();\n\n return tidy(() => {\n const $values = unstack(values);\n\n const keysLength = $keys.length;\n const valuesLength = $values.length;\n\n util.assert(\n keysLength === valuesLength,\n () => `The number of elements doesn't match, keys has ` +\n `${keysLength} elements, the values has ${valuesLength} ` +\n `elements.`);\n\n for (let i = 0; i < keysLength; i++) {\n const key = $keys[i];\n const value = $values[i];\n\n keep(value);\n this.tensorMap.set(key, value);\n }\n\n return this.handle;\n });\n }\n\n /**\n * Looks up keys in a hash table, outputs the corresponding values.\n *\n * Performs batch lookups, for every element in the key tensor, `find`\n * stacks the corresponding value into the return tensor.\n *\n * If an element is not present in the table, the given `defaultValue` is\n * used.\n *\n * @param keys Keys to look up. Must have the same type as the keys of the\n * table.\n * @param defaultValue The scalar `defaultValue` is the value output for keys\n * not present in the table. It must also be of the same type as the\n * table values.\n */\n async find(keys: Tensor, defaultValue: Tensor): Promise {\n this.checkKeyAndValueTensor(keys, defaultValue);\n\n const $keys = await keys.data();\n\n return tidy(() => {\n const result: Tensor[] = [];\n\n for (let i = 0; i < $keys.length; i++) {\n const key = $keys[i];\n\n const value = this.findWithDefault(key, defaultValue);\n result.push(value);\n }\n\n return stack(result);\n });\n }\n\n // tslint:disable-next-line: no-any\n private findWithDefault(key: any, defaultValue: Tensor): Tensor {\n const result = this.tensorMap.get(key);\n\n return result != null ? result : defaultValue;\n }\n\n private checkKeyAndValueTensor(key: Tensor, value: Tensor) {\n if (key.dtype !== this.keyDType) {\n throw new Error(\n `Expect key dtype ${this.keyDType}, but got ` +\n `${key.dtype}`);\n }\n\n if (value.dtype !== this.valueDType) {\n throw new Error(\n `Expect value dtype ${this.valueDType}, but got ` +\n `${value.dtype}`);\n }\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataType, Tensor} from '@tensorflow/tfjs-core';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {HashTable} from '../../executor/hash_table';\nimport {ResourceManager} from '../../executor/resource_manager';\nimport {InternalOpAsyncExecutor, Node} from '../types';\n\nimport {getParamValue} from './utils';\n\nexport const executeOp: InternalOpAsyncExecutor = async(\n node: Node, tensorMap: NamedTensorsMap, context: ExecutionContext,\n resourceManager: ResourceManager): Promise => {\n switch (node.op) {\n case 'HashTable':\n case 'HashTableV2': {\n const existingTableHandle =\n resourceManager.getHashTableHandleByName(node.name);\n // Table is shared with initializer.\n if (existingTableHandle != null) {\n return [existingTableHandle];\n } else {\n const keyDType =\n getParamValue('keyDType', node, tensorMap, context) as DataType;\n const valueDType =\n getParamValue('valueDType', node, tensorMap, context) as DataType;\n\n const hashTable = new HashTable(keyDType, valueDType);\n resourceManager.addHashTable(node.name, hashTable);\n return [hashTable.handle];\n }\n }\n case 'LookupTableImport':\n case 'LookupTableImportV2': {\n const handle = getParamValue(\n 'tableHandle', node, tensorMap, context,\n resourceManager) as Tensor;\n const keys = getParamValue('keys', node, tensorMap, context) as Tensor;\n const values =\n getParamValue('values', node, tensorMap, context) as Tensor;\n\n const hashTable = resourceManager.getHashTableById(handle.id);\n\n return [await hashTable.import(keys, values)];\n }\n case 'LookupTableFind':\n case 'LookupTableFindV2': {\n const handle = getParamValue(\n 'tableHandle', node, tensorMap, context,\n resourceManager) as Tensor;\n const keys = getParamValue('keys', node, tensorMap, context) as Tensor;\n const defaultValue =\n getParamValue('defaultValue', node, tensorMap, context) as Tensor;\n\n const hashTable = resourceManager.getHashTableById(handle.id);\n return [await hashTable.find(keys, defaultValue)];\n }\n case 'LookupTableSize':\n case 'LookupTableSizeV2': {\n const handle = getParamValue(\n 'tableHandle', node, tensorMap, context,\n resourceManager) as Tensor;\n\n const hashTable = resourceManager.getHashTableById(handle.id);\n return [hashTable.tensorSize()];\n }\n default:\n throw TypeError(`Node type ${node.op} is not implemented`);\n }\n};\n\nexport const CATEGORY = 'hash_table';\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor, Tensor1D, Tensor2D, Tensor3D, Tensor4D} from '@tensorflow/tfjs-core';\n// tslint:disable-next-line: no-imports-from-dist\nimport * as tfOps from '@tensorflow/tfjs-core/dist/ops/ops_for_converter';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {InternalOpExecutor, Node} from '../types';\n\nimport {getParamValue} from './utils';\n\nexport const executeOp: InternalOpExecutor =\n (node: Node, tensorMap: NamedTensorsMap,\n context: ExecutionContext, ops = tfOps): Tensor[] => {\n switch (node.op) {\n case 'ResizeBilinear': {\n const images =\n getParamValue('images', node, tensorMap, context) as Tensor;\n const size =\n getParamValue('size', node, tensorMap, context) as number[];\n const alignCorners =\n getParamValue('alignCorners', node, tensorMap, context) as\n boolean;\n const halfPixelCenters =\n getParamValue('halfPixelCenters', node, tensorMap, context) as\n boolean;\n return [ops.image.resizeBilinear(\n images as Tensor3D | Tensor4D, [size[0], size[1]], alignCorners,\n halfPixelCenters)];\n }\n case 'ResizeNearestNeighbor': {\n const images =\n getParamValue('images', node, tensorMap, context) as Tensor;\n const size =\n getParamValue('size', node, tensorMap, context) as number[];\n const alignCorners =\n getParamValue('alignCorners', node, tensorMap, context) as\n boolean;\n const halfPixelCenters =\n getParamValue('halfPixelCenters', node, tensorMap, context) as\n boolean;\n return [ops.image.resizeNearestNeighbor(\n images as Tensor3D | Tensor4D, [size[0], size[1]], alignCorners,\n halfPixelCenters)];\n }\n case 'CropAndResize': {\n const image =\n getParamValue('image', node, tensorMap, context) as Tensor;\n const boxes =\n getParamValue('boxes', node, tensorMap, context) as Tensor;\n const boxInd =\n getParamValue('boxInd', node, tensorMap, context) as Tensor;\n const cropSize =\n getParamValue('cropSize', node, tensorMap, context) as number[];\n const method =\n getParamValue('method', node, tensorMap, context) as string;\n const extrapolationValue =\n getParamValue('extrapolationValue', node, tensorMap, context) as\n number;\n return [ops.image.cropAndResize(\n image as Tensor4D, boxes as Tensor2D, boxInd as Tensor1D,\n cropSize as [number, number], method as 'bilinear' | 'nearest',\n extrapolationValue)];\n }\n case 'ImageProjectiveTransformV3': {\n const images =\n getParamValue('images', node, tensorMap, context) as Tensor;\n const transforms =\n getParamValue('transforms', node, tensorMap, context) as Tensor;\n const outputShape =\n getParamValue('outputShape', node, tensorMap, context) as\n number[];\n const fillValue =\n getParamValue('fillValue', node, tensorMap, context) as number;\n const interpolation =\n getParamValue('interpolation', node, tensorMap, context) as\n string;\n const fillMode =\n getParamValue('fillMode', node, tensorMap, context) as string;\n return [ops.image.transform(\n images as Tensor4D,\n transforms as Tensor2D,\n interpolation.toLowerCase() as 'bilinear' | 'nearest',\n fillMode.toLowerCase() as 'constant' | 'reflect' | 'wrap' | 'nearest',\n fillValue,\n outputShape as [number, number])];\n }\n default:\n throw TypeError(`Node type ${node.op} is not implemented`);\n }\n };\n\nexport const CATEGORY = 'image';\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '@tensorflow/tfjs-core';\n// tslint:disable-next-line: no-imports-from-dist\nimport * as tfOps from '@tensorflow/tfjs-core/dist/ops/ops_for_converter';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {InternalOpExecutor, Node} from '../types';\n\nimport {getParamValue} from './utils';\n\nexport const executeOp: InternalOpExecutor =\n (node: Node, tensorMap: NamedTensorsMap,\n context: ExecutionContext, ops = tfOps): Tensor[] => {\n switch (node.op) {\n case 'Equal': {\n return [ops.equal(\n getParamValue('a', node, tensorMap, context) as Tensor,\n getParamValue('b', node, tensorMap, context) as Tensor)];\n }\n case 'NotEqual': {\n return [ops.notEqual(\n getParamValue('a', node, tensorMap, context) as Tensor,\n getParamValue('b', node, tensorMap, context) as Tensor)];\n }\n case 'Greater': {\n return [ops.greater(\n getParamValue('a', node, tensorMap, context) as Tensor,\n getParamValue('b', node, tensorMap, context) as Tensor)];\n }\n case 'GreaterEqual': {\n return [ops.greaterEqual(\n getParamValue('a', node, tensorMap, context) as Tensor,\n getParamValue('b', node, tensorMap, context) as Tensor)];\n }\n case 'Less': {\n return [ops.less(\n getParamValue('a', node, tensorMap, context) as Tensor,\n getParamValue('b', node, tensorMap, context) as Tensor)];\n }\n case 'LessEqual': {\n return [ops.lessEqual(\n getParamValue('a', node, tensorMap, context) as Tensor,\n getParamValue('b', node, tensorMap, context) as Tensor)];\n }\n case 'LogicalAnd': {\n return [ops.logicalAnd(\n getParamValue('a', node, tensorMap, context) as Tensor,\n getParamValue('b', node, tensorMap, context) as Tensor)];\n }\n case 'LogicalNot': {\n return [ops.logicalNot(\n getParamValue('a', node, tensorMap, context) as Tensor)];\n }\n case 'LogicalOr': {\n return [ops.logicalOr(\n getParamValue('a', node, tensorMap, context) as Tensor,\n getParamValue('b', node, tensorMap, context) as Tensor)];\n }\n case 'Select':\n case 'SelectV2': {\n return [ops.where(\n getParamValue('condition', node, tensorMap, context) as Tensor,\n getParamValue('a', node, tensorMap, context) as Tensor,\n getParamValue('b', node, tensorMap, context) as Tensor)];\n }\n default:\n throw TypeError(`Node type ${node.op} is not implemented`);\n }\n };\n\nexport const CATEGORY = 'logical';\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor, Tensor2D} from '@tensorflow/tfjs-core';\n// tslint:disable-next-line: no-imports-from-dist\nimport * as tfOps from '@tensorflow/tfjs-core/dist/ops/ops_for_converter';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {InternalOpExecutor, Node} from '../types';\n\nimport {getParamValue} from './utils';\n\nexport const executeOp: InternalOpExecutor =\n (node: Node, tensorMap: NamedTensorsMap,\n context: ExecutionContext, ops = tfOps): Tensor[] => {\n switch (node.op) {\n case 'BatchMatMul':\n case 'BatchMatMulV2':\n case 'MatMul':\n return [ops.matMul(\n getParamValue('a', node, tensorMap, context) as Tensor2D,\n getParamValue('b', node, tensorMap, context) as Tensor2D,\n getParamValue('transposeA', node, tensorMap, context) as boolean,\n getParamValue('transposeB', node, tensorMap, context) as\n boolean)];\n\n case 'Einsum':\n return [ops.einsum(\n getParamValue('equation', node, tensorMap, context) as string,\n ...getParamValue('tensors', node, tensorMap, context) as\n Tensor[])];\n\n case 'Transpose':\n return [ops.transpose(\n getParamValue('x', node, tensorMap, context) as Tensor,\n getParamValue('perm', node, tensorMap, context) as number[])];\n\n case '_FusedMatMul':\n const [extraOp, activationFunc] =\n (getParamValue('fusedOps', node, tensorMap, context) as string[]);\n\n const isBiasAdd = extraOp === 'biasadd';\n const isPrelu = activationFunc === 'prelu';\n\n const numArgs =\n (getParamValue('numArgs', node, tensorMap, context) as number);\n const leakyreluAlpha =\n getParamValue('leakyreluAlpha', node, tensorMap, context) as\n number;\n\n if (isBiasAdd) {\n if (isPrelu && numArgs !== 2) {\n throw new Error(\n 'Fused MatMul with BiasAdd and Prelu must have two ' +\n 'extra arguments: bias and alpha.');\n }\n if (!isPrelu && numArgs !== 1) {\n throw new Error(\n 'Fused MatMul with BiasAdd must have one extra argument: bias.');\n }\n }\n const [biasArg, preluArg] =\n getParamValue('args', node, tensorMap, context) as Tensor[];\n return [ops.fused.matMul({\n a: getParamValue('a', node, tensorMap, context) as Tensor2D,\n b: getParamValue('b', node, tensorMap, context) as Tensor2D,\n transposeA: getParamValue('transposeA', node, tensorMap, context) as\n boolean,\n transposeB: getParamValue('transposeB', node, tensorMap, context) as\n boolean,\n bias: biasArg,\n activation: activationFunc as tfOps.fused.Activation,\n preluActivationWeights: preluArg,\n leakyreluAlpha\n })];\n\n default:\n throw TypeError(`Node type ${node.op} is not implemented`);\n }\n };\n\nexport const CATEGORY = 'matrices';\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Scalar, Tensor, Tensor3D, Tensor4D} from '@tensorflow/tfjs-core';\n// tslint:disable-next-line: no-imports-from-dist\nimport * as tfOps from '@tensorflow/tfjs-core/dist/ops/ops_for_converter';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {InternalOpExecutor, Node} from '../types';\n\nimport {getParamValue} from './utils';\n\nexport const executeOp: InternalOpExecutor =\n (node: Node, tensorMap: NamedTensorsMap,\n context: ExecutionContext, ops = tfOps): Tensor[] => {\n switch (node.op) {\n case 'EuclideanNorm':\n return [ops.euclideanNorm(\n getParamValue('x', node, tensorMap, context) as Tensor,\n getParamValue('axis', node, tensorMap, context) as number[],\n getParamValue('keepDims', node, tensorMap, context) as boolean)];\n case 'FusedBatchNorm':\n case 'FusedBatchNormV2': {\n return [ops.batchNorm(\n getParamValue('x', node, tensorMap, context) as Tensor,\n getParamValue('mean', node, tensorMap, context) as Tensor,\n getParamValue('variance', node, tensorMap, context) as Tensor,\n getParamValue('offset', node, tensorMap, context) as Tensor,\n getParamValue('scale', node, tensorMap, context) as Tensor,\n getParamValue('epsilon', node, tensorMap, context) as number)];\n }\n case 'FusedBatchNormV3': {\n return [ops.batchNorm(\n getParamValue('x', node, tensorMap, context) as Tensor,\n getParamValue('mean', node, tensorMap, context) as Tensor,\n getParamValue('variance', node, tensorMap, context) as Tensor,\n getParamValue('offset', node, tensorMap, context) as Tensor,\n getParamValue('scale', node, tensorMap, context) as Tensor,\n getParamValue('epsilon', node, tensorMap, context) as number)];\n }\n case 'LRN': {\n return [ops.localResponseNormalization(\n getParamValue('x', node, tensorMap, context) as Tensor3D |\n Tensor4D,\n getParamValue('radius', node, tensorMap, context) as number,\n getParamValue('bias', node, tensorMap, context) as number,\n getParamValue('alpha', node, tensorMap, context) as number,\n getParamValue('beta', node, tensorMap, context) as number)];\n }\n case 'Softmax': {\n return [ops.softmax(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n }\n case 'LogSoftmax': {\n return [ops.logSoftmax(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n }\n case 'SparseToDense': {\n return [ops.sparseToDense(\n getParamValue('sparseIndices', node, tensorMap, context) as\n Tensor,\n getParamValue('outputShape', node, tensorMap, context) as Tensor,\n getParamValue('sparseValues', node, tensorMap, context) as\n number[],\n getParamValue('defaultValue', node, tensorMap, context) as\n Scalar)];\n }\n default:\n throw TypeError(`Node type ${node.op} is not implemented`);\n }\n };\n\nexport const CATEGORY = 'normalization';\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor, Tensor1D, Tensor2D} from '@tensorflow/tfjs-core';\n// tslint:disable-next-line: no-imports-from-dist\nimport * as tfOps from '@tensorflow/tfjs-core/dist/ops/ops_for_converter';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {InternalOpExecutor, Node} from '../types';\n\nimport {getParamValue} from './utils';\n\nexport const executeOp: InternalOpExecutor =\n (node: Node, tensorMap: NamedTensorsMap,\n context: ExecutionContext, ops = tfOps): Tensor[] => {\n switch (node.op) {\n case 'Max': {\n const axis =\n getParamValue('axis', node, tensorMap, context) as number[];\n const keepDims =\n getParamValue('keepDims', node, tensorMap, context) as boolean;\n return [ops.max(\n getParamValue('x', node, tensorMap, context) as Tensor, axis,\n keepDims)];\n }\n case 'Mean': {\n const axis =\n getParamValue('axis', node, tensorMap, context) as number[];\n const keepDims =\n getParamValue('keepDims', node, tensorMap, context) as boolean;\n return [ops.mean(\n getParamValue('x', node, tensorMap, context) as Tensor, axis,\n keepDims)];\n }\n case 'Min': {\n const axis =\n getParamValue('axis', node, tensorMap, context) as number[];\n const keepDims =\n getParamValue('keepDims', node, tensorMap, context) as boolean;\n return [ops.min(\n getParamValue('x', node, tensorMap, context) as Tensor, axis,\n keepDims)];\n }\n case 'Sum': {\n const axis =\n getParamValue('axis', node, tensorMap, context) as number[];\n const keepDims =\n getParamValue('keepDims', node, tensorMap, context) as boolean;\n return [ops.sum(\n getParamValue('x', node, tensorMap, context) as Tensor, axis,\n keepDims)];\n }\n case 'All': {\n const axis =\n getParamValue('axis', node, tensorMap, context) as number[];\n const keepDims =\n getParamValue('keepDims', node, tensorMap, context) as boolean;\n return [ops.all(\n getParamValue('x', node, tensorMap, context) as Tensor, axis,\n keepDims)];\n }\n case 'Any': {\n const axis =\n getParamValue('axis', node, tensorMap, context) as number[];\n const keepDims =\n getParamValue('keepDims', node, tensorMap, context) as boolean;\n return [ops.any(\n getParamValue('x', node, tensorMap, context) as Tensor, axis,\n keepDims)];\n }\n case 'ArgMax': {\n const axis =\n getParamValue('axis', node, tensorMap, context) as number;\n return [ops.argMax(\n getParamValue('x', node, tensorMap, context) as Tensor, axis)];\n }\n case 'ArgMin': {\n const axis =\n getParamValue('axis', node, tensorMap, context) as number;\n return [ops.argMin(\n getParamValue('x', node, tensorMap, context) as Tensor, axis)];\n }\n case 'Prod': {\n const axis =\n getParamValue('axis', node, tensorMap, context) as number[];\n const keepDims =\n getParamValue('keepDims', node, tensorMap, context) as boolean;\n return [ops.prod(\n getParamValue('x', node, tensorMap, context) as Tensor, axis,\n keepDims)];\n }\n case 'Cumprod': {\n const axis =\n getParamValue('axis', node, tensorMap, context) as number;\n const exclusive =\n getParamValue('exclusive', node, tensorMap, context) as boolean;\n const reverse =\n getParamValue('reverse', node, tensorMap, context) as boolean;\n return [ops.cumprod(\n getParamValue('x', node, tensorMap, context) as Tensor, axis,\n exclusive, reverse)];\n }\n case 'Cumsum': {\n const axis =\n getParamValue('axis', node, tensorMap, context) as number;\n const exclusive =\n getParamValue('exclusive', node, tensorMap, context) as boolean;\n const reverse =\n getParamValue('reverse', node, tensorMap, context) as boolean;\n return [ops.cumsum(\n getParamValue('x', node, tensorMap, context) as Tensor, axis,\n exclusive, reverse)];\n }\n case 'Bincount':\n const x = getParamValue('x', node, tensorMap, context) as Tensor1D;\n const weights =\n getParamValue('weights', node, tensorMap, context) as Tensor1D;\n const size =\n getParamValue('size', node, tensorMap, context) as number;\n\n return [ops.bincount(x, weights, size)];\n case 'DenseBincount': {\n const x = getParamValue('x', node, tensorMap, context) as Tensor1D |\n Tensor2D;\n const weights =\n getParamValue('weights', node, tensorMap, context) as Tensor1D |\n Tensor2D;\n const size =\n getParamValue('size', node, tensorMap, context) as number;\n\n const binaryOutput =\n getParamValue('binaryOutput', node, tensorMap, context) as\n boolean;\n\n return [ops.denseBincount(x, weights, size, binaryOutput)];\n }\n default:\n throw TypeError(`Node type ${node.op} is not implemented`);\n }\n };\n\nexport const CATEGORY = 'reduction';\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Scalar, Tensor, Tensor1D, tidy, util} from '@tensorflow/tfjs-core';\n// tslint:disable-next-line: no-imports-from-dist\nimport * as tfOps from '@tensorflow/tfjs-core/dist/ops/ops_for_converter';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {InternalOpExecutor, Node} from '../types';\n\nimport {getParamValue} from './utils';\n\nexport const executeOp: InternalOpExecutor =\n (node: Node, tensorMap: NamedTensorsMap,\n context: ExecutionContext, ops = tfOps): Tensor[] => {\n switch (node.op) {\n case 'ConcatV2':\n case 'Concat': {\n const n = getParamValue('n', node, tensorMap, context) as number;\n const axis =\n getParamValue('axis', node, tensorMap, context) as number;\n let inputs =\n getParamValue('tensors', node, tensorMap, context) as Tensor[];\n inputs = inputs.slice(0, n);\n return [ops.concat(inputs, axis)];\n }\n case 'Gather': {\n const input = getParamValue('x', node, tensorMap, context) as Tensor;\n const indices =\n getParamValue('indices', node, tensorMap, context) as Tensor1D;\n return [ops.gather(input, ops.cast(indices, 'int32'), 0)];\n }\n case 'GatherV2': {\n const axis =\n getParamValue('axis', node, tensorMap, context) as number;\n const batchDims =\n getParamValue('batchDims', node, tensorMap, context) as number;\n const input = getParamValue('x', node, tensorMap, context) as Tensor;\n const indices =\n getParamValue('indices', node, tensorMap, context) as Tensor1D;\n return [ops.gather(\n input, ops.cast(indices, 'int32'), axis, batchDims)];\n }\n case 'Reverse': {\n const dims =\n getParamValue('dims', node, tensorMap, context) as boolean[];\n const axis = [];\n for (let i = 0; i < dims.length; i++) {\n if (dims[i]) {\n axis.push(i);\n }\n }\n const input = getParamValue('x', node, tensorMap, context) as Tensor;\n return [ops.reverse(input, axis)];\n }\n case 'ReverseV2': {\n const axis =\n getParamValue('axis', node, tensorMap, context) as number[];\n const input = getParamValue('x', node, tensorMap, context) as Tensor;\n return [ops.reverse(input, axis)];\n }\n case 'Slice': {\n // tslint:disable-next-line:no-any\n const begin = getParamValue('begin', node, tensorMap, context) as any;\n // tslint:disable-next-line:no-any\n const size = getParamValue('size', node, tensorMap, context) as any;\n return [ops.slice(\n getParamValue('x', node, tensorMap, context) as Tensor, begin,\n size)];\n }\n case 'StridedSlice': {\n const begin =\n getParamValue('begin', node, tensorMap, context) as number[];\n const end =\n getParamValue('end', node, tensorMap, context) as number[];\n const strides =\n getParamValue('strides', node, tensorMap, context) as number[];\n const beginMask =\n getParamValue('beginMask', node, tensorMap, context) as number;\n const endMask =\n getParamValue('endMask', node, tensorMap, context) as number;\n const ellipsisMask =\n getParamValue('ellipsisMask', node, tensorMap, context) as number;\n const newAxisMask =\n getParamValue('newAxisMask', node, tensorMap, context) as number;\n const shrinkAxisMask =\n getParamValue('shrinkAxisMask', node, tensorMap, context) as\n number;\n const tensor = getParamValue('x', node, tensorMap, context) as Tensor;\n\n return [ops.stridedSlice(\n tensor, begin, end, strides, beginMask, endMask, ellipsisMask,\n newAxisMask, shrinkAxisMask)];\n }\n case 'Pack': {\n return tidy(() => {\n const axis =\n getParamValue('axis', node, tensorMap, context) as number;\n const tensors =\n getParamValue('tensors', node, tensorMap, context) as Tensor[];\n // Reshape the tensors to the first tensor's shape if they don't\n // match.\n const shape = tensors[0].shape;\n const squeezedShape = ops.squeeze(tensors[0]).shape;\n const mapped = tensors.map(tensor => {\n const sameShape = util.arraysEqual(tensor.shape, shape);\n if (!sameShape &&\n !util.arraysEqual(\n ops.squeeze(tensor).shape, squeezedShape)) {\n throw new Error('the input tensors shape does not match');\n }\n return sameShape ? tensor : ops.reshape(tensor, shape);\n });\n return [ops.stack(mapped, axis)];\n });\n }\n case 'Unpack': {\n const axis =\n getParamValue('axis', node, tensorMap, context) as number;\n const tensor =\n getParamValue('tensor', node, tensorMap, context) as Tensor;\n return ops.unstack(tensor, axis);\n }\n case 'Tile': {\n const reps =\n getParamValue('reps', node, tensorMap, context) as number[];\n return [ops.tile(\n getParamValue('x', node, tensorMap, context) as Tensor, reps)];\n }\n case 'Split':\n case 'SplitV': {\n const axis =\n getParamValue('axis', node, tensorMap, context) as number;\n const numOrSizeSplits =\n getParamValue('numOrSizeSplits', node, tensorMap, context) as\n number |\n number[];\n const tensor = getParamValue('x', node, tensorMap, context) as Tensor;\n\n return ops.split(tensor, numOrSizeSplits, axis);\n }\n case 'ScatterNd': {\n const indices =\n getParamValue('indices', node, tensorMap, context) as Tensor;\n const values =\n getParamValue('values', node, tensorMap, context) as Tensor;\n const shape =\n getParamValue('shape', node, tensorMap, context) as number[];\n return [ops.scatterND(indices, values, shape)];\n }\n case 'GatherNd': {\n const x = getParamValue('x', node, tensorMap, context) as Tensor;\n const indices =\n getParamValue('indices', node, tensorMap, context) as Tensor;\n return [ops.gatherND(x, indices)];\n }\n case 'SparseToDense': {\n const indices =\n getParamValue('sparseIndices', node, tensorMap, context) as\n Tensor;\n const shape =\n getParamValue('outputShape', node, tensorMap, context) as\n number[];\n const sparseValues =\n getParamValue('sparseValues', node, tensorMap, context) as Tensor;\n const defaultValue =\n getParamValue('defaultValue', node, tensorMap, context) as Scalar;\n return [ops.sparseToDense(\n indices, sparseValues, shape,\n sparseValues.dtype === defaultValue.dtype ?\n defaultValue :\n ops.cast(defaultValue, sparseValues.dtype))];\n }\n default:\n throw TypeError(`Node type ${node.op} is not implemented`);\n }\n };\n\nexport const CATEGORY = 'slice_join';\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Scalar, Tensor, Tensor1D, Tensor2D} from '@tensorflow/tfjs-core';\n// tslint:disable-next-line: no-imports-from-dist\nimport * as tfOps from '@tensorflow/tfjs-core/dist/ops/ops_for_converter';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {InternalOpExecutor, Node} from '../types';\n\nimport {getParamValue} from './utils';\n\nexport const executeOp: InternalOpExecutor =\n (node: Node, tensorMap: NamedTensorsMap,\n context: ExecutionContext, ops = tfOps): Tensor[] => {\n switch (node.op) {\n case 'SparseFillEmptyRows': {\n const {\n outputIndices,\n outputValues,\n emptyRowIndicator,\n reverseIndexMap\n } =\n ops.sparse.sparseFillEmptyRows(\n getParamValue('indices', node, tensorMap, context) as\n Tensor2D,\n getParamValue('values', node, tensorMap, context) as Tensor1D,\n getParamValue('denseShape', node, tensorMap, context) as\n Tensor1D,\n getParamValue('defaultValue', node, tensorMap, context) as\n Scalar);\n return [\n outputIndices, outputValues, emptyRowIndicator, reverseIndexMap\n ];\n }\n case 'SparseReshape': {\n const {outputIndices, outputShape} = ops.sparse.sparseReshape(\n getParamValue('inputIndices', node, tensorMap, context) as\n Tensor2D,\n getParamValue('inputShape', node, tensorMap, context) as Tensor1D,\n getParamValue('newShape', node, tensorMap, context) as Tensor1D);\n return [outputIndices, outputShape];\n }\n case 'SparseSegmentMean': {\n const outputData = ops.sparse.sparseSegmentMean(\n getParamValue('data', node, tensorMap, context) as Tensor,\n getParamValue('indices', node, tensorMap, context) as Tensor1D,\n getParamValue('segmentIds', node, tensorMap, context) as\n Tensor1D);\n return [outputData];\n }\n case 'SparseSegmentSum': {\n const outputData = ops.sparse.sparseSegmentSum(\n getParamValue('data', node, tensorMap, context) as Tensor,\n getParamValue('indices', node, tensorMap, context) as Tensor1D,\n getParamValue('segmentIds', node, tensorMap, context) as\n Tensor1D);\n return [outputData];\n }\n default:\n throw TypeError(`Node type ${node.op} is not implemented`);\n }\n };\n\nexport const CATEGORY = 'sparse';\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '@tensorflow/tfjs-core';\n// tslint:disable-next-line: no-imports-from-dist\nimport * as tfOps from '@tensorflow/tfjs-core/dist/ops/ops_for_converter';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {InternalOpExecutor, Node} from '../types';\n\nimport {getParamValue} from './utils';\n\nexport const executeOp: InternalOpExecutor =\n (node: Node, tensorMap: NamedTensorsMap, context: ExecutionContext,\n ops = tfOps): Tensor[] => {\n switch (node.op) {\n case 'FFT': {\n return [ops.fft(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n }\n case 'IFFT': {\n return [ops.ifft(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n }\n case 'RFFT': {\n return [ops.rfft(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n }\n case 'IRFFT': {\n return [ops.irfft(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n }\n default:\n throw TypeError(`Node type ${node.op} is not implemented`);\n }\n };\n\nexport const CATEGORY = 'spectral';\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Scalar, Tensor, Tensor1D} from '@tensorflow/tfjs-core';\n// tslint:disable-next-line: no-imports-from-dist\nimport * as tfOps from '@tensorflow/tfjs-core/dist/ops/ops_for_converter';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {InternalOpExecutor, Node} from '../types';\n\nimport {getParamValue} from './utils';\n\nexport const executeOp: InternalOpExecutor =\n (node: Node, tensorMap: NamedTensorsMap,\n context: ExecutionContext, ops = tfOps): Tensor[] => {\n switch (node.op) {\n case 'StringNGrams': {\n const {nGrams, nGramsSplits} = ops.string.stringNGrams(\n getParamValue('data', node, tensorMap, context) as Tensor1D,\n getParamValue('dataSplits', node, tensorMap, context) as Tensor,\n getParamValue('separator', node, tensorMap, context) as string,\n getParamValue('nGramWidths', node, tensorMap, context) as\n number[],\n getParamValue('leftPad', node, tensorMap, context) as string,\n getParamValue('rightPad', node, tensorMap, context) as string,\n getParamValue('padWidth', node, tensorMap, context) as number,\n getParamValue(\n 'preserveShortSequences', node, tensorMap, context) as\n boolean);\n return [nGrams, nGramsSplits];\n }\n case 'StringSplit': {\n const {indices, values, shape} = ops.string.stringSplit(\n getParamValue('input', node, tensorMap, context) as Tensor1D,\n getParamValue('delimiter', node, tensorMap, context) as Scalar,\n getParamValue('skipEmpty', node, tensorMap, context) as boolean);\n return [indices, values, shape];\n }\n case 'StringToHashBucketFast': {\n const output = ops.string.stringToHashBucketFast(\n getParamValue('input', node, tensorMap, context) as Tensor,\n getParamValue('numBuckets', node, tensorMap, context) as number);\n return [output];\n }\n default:\n throw TypeError(`Node type ${node.op} is not implemented`);\n }\n };\n\nexport const CATEGORY = 'string';\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor, Tensor4D} from '@tensorflow/tfjs-core';\n// tslint:disable-next-line: no-imports-from-dist\nimport * as tfOps from '@tensorflow/tfjs-core/dist/ops/ops_for_converter';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {InternalOpExecutor, Node} from '../types';\n\nimport {getParamValue} from './utils';\n\nexport const executeOp: InternalOpExecutor =\n (node: Node, tensorMap: NamedTensorsMap,\n context: ExecutionContext, ops = tfOps): Tensor[] => {\n switch (node.op) {\n case 'Cast': {\n return [ops.cast(\n getParamValue('x', node, tensorMap, context) as Tensor,\n getParamValue('dtype', node, tensorMap, context) as 'int32' |\n 'float32' | 'bool')];\n }\n case 'ExpandDims': {\n const axis =\n getParamValue('axis', node, tensorMap, context) as number;\n return [ops.expandDims(\n getParamValue('x', node, tensorMap, context) as Tensor, axis)];\n }\n case 'Squeeze': {\n const axis =\n getParamValue('axis', node, tensorMap, context) as number[];\n return [ops.squeeze(\n getParamValue('x', node, tensorMap, context) as Tensor, axis)];\n }\n\n case 'Reshape': {\n return [ops.reshape(\n getParamValue('x', node, tensorMap, context) as Tensor,\n getParamValue('shape', node, tensorMap, context) as number[])];\n }\n case 'MirrorPad': {\n return [ops.mirrorPad(\n getParamValue('x', node, tensorMap, context) as Tensor,\n getParamValue('padding', node, tensorMap, context) as\n Array<[number, number]>,\n getParamValue('mode', node, tensorMap, context) as 'reflect' |\n 'symmetric')];\n }\n case 'PadV2':\n case 'Pad': {\n return [ops.pad(\n getParamValue('x', node, tensorMap, context) as Tensor,\n getParamValue('padding', node, tensorMap, context) as\n Array<[number, number]>,\n getParamValue('constantValue', node, tensorMap, context) as\n number)];\n }\n case 'SpaceToBatchND': {\n const blockShape =\n getParamValue('blockShape', node, tensorMap, context) as number[];\n const paddings =\n getParamValue('paddings', node, tensorMap, context) as number[][];\n return [ops.spaceToBatchND(\n getParamValue('x', node, tensorMap, context) as Tensor,\n blockShape, paddings)];\n }\n case 'BatchToSpaceND': {\n const blockShape =\n getParamValue('blockShape', node, tensorMap, context) as number[];\n const crops =\n getParamValue('crops', node, tensorMap, context) as number[][];\n return [ops.batchToSpaceND(\n getParamValue('x', node, tensorMap, context) as Tensor,\n blockShape, crops)];\n }\n case 'DepthToSpace': {\n const blockSize =\n getParamValue('blockSize', node, tensorMap, context) as number;\n const dataFormat =\n (getParamValue('dataFormat', node, tensorMap, context) as\n string).toUpperCase() as 'NHWC' |\n 'NCHW';\n return [ops.depthToSpace(\n getParamValue('x', node, tensorMap, context) as Tensor4D,\n blockSize, dataFormat)];\n }\n case 'BroadcastTo': {\n return [ops.broadcastTo(\n getParamValue('x', node, tensorMap, context) as Tensor,\n getParamValue('shape', node, tensorMap, context) as number[])];\n }\n case 'BroadcastArgs': {\n return [ops.broadcastArgs(\n getParamValue('s0', node, tensorMap, context) as Tensor,\n getParamValue('s1', node, tensorMap, context) as Tensor)];\n }\n default:\n throw TypeError(`Node type ${node.op} is not implemented`);\n }\n };\n\nexport const CATEGORY = 'transformation';\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport * as tfc from '@tensorflow/tfjs-core';\n\nimport {NamedTensorsMap} from '../data/types';\nimport {ExecutionContext} from '../executor/execution_context';\nimport {ResourceManager} from '../executor/resource_manager';\n\nimport {NodeValueImpl} from './custom_op/node_value_impl';\nimport {getRegisteredOp} from './custom_op/register';\nimport * as arithmetic from './executors/arithmetic_executor';\nimport * as basicMath from './executors/basic_math_executor';\nimport * as control from './executors/control_executor';\nimport * as convolution from './executors/convolution_executor';\nimport * as creation from './executors/creation_executor';\nimport * as dynamic from './executors/dynamic_executor';\nimport * as evaluation from './executors/evaluation_executor';\nimport * as graph from './executors/graph_executor';\nimport * as hashTable from './executors/hash_table_executor';\nimport * as image from './executors/image_executor';\nimport * as logical from './executors/logical_executor';\nimport * as matrices from './executors/matrices_executor';\nimport * as normalization from './executors/normalization_executor';\nimport * as reduction from './executors/reduction_executor';\nimport * as sliceJoin from './executors/slice_join_executor';\nimport * as sparse from './executors/sparse_executor';\nimport * as spectral from './executors/spectral_executor';\nimport * as string from './executors/string_executor';\nimport * as transformation from './executors/transformation_executor';\nimport {Node} from './types';\n\n/**\n * Executes the op defined by the node object.\n * @param node\n * @param tensorMap contains tensors for executed nodes and weights\n * @param context contains tensors and information for running the current node.\n * @param resourceManager Optional. Contains global resources of the model.\n */\nexport function executeOp(\n node: Node, tensorMap: NamedTensorsMap, context: ExecutionContext,\n resourceManager?: ResourceManager, tidy = tfc.tidy): tfc.Tensor[]|\n Promise {\n const value =\n ((node: Node, tensorMap: NamedTensorsMap, context: ExecutionContext) => {\n switch (node.category) {\n case 'arithmetic':\n return tidy(() => arithmetic.executeOp(node, tensorMap, context));\n case 'basic_math':\n return tidy(() => basicMath.executeOp(node, tensorMap, context));\n case 'control':\n return control.executeOp(node, tensorMap, context);\n case 'convolution':\n return tidy(() => convolution.executeOp(node, tensorMap, context));\n case 'creation':\n return tidy(() => creation.executeOp(node, tensorMap, context));\n case 'dynamic':\n return dynamic.executeOp(node, tensorMap, context);\n case 'evaluation':\n return tidy(() => evaluation.executeOp(node, tensorMap, context));\n case 'image':\n return tidy(() => image.executeOp(node, tensorMap, context));\n case 'graph':\n return tidy(() => graph.executeOp(node, tensorMap, context));\n case 'logical':\n return tidy(() => logical.executeOp(node, tensorMap, context));\n case 'matrices':\n return tidy(() => matrices.executeOp(node, tensorMap, context));\n case 'normalization':\n return tidy(\n () => normalization.executeOp(node, tensorMap, context));\n case 'reduction':\n return tidy(() => reduction.executeOp(node, tensorMap, context));\n case 'slice_join':\n return tidy(() => sliceJoin.executeOp(node, tensorMap, context));\n case 'sparse':\n return tidy(() => sparse.executeOp(node, tensorMap, context));\n case 'spectral':\n return tidy(() => spectral.executeOp(node, tensorMap, context));\n case 'string':\n return tidy(() => string.executeOp(node, tensorMap, context));\n case 'transformation':\n return tidy(\n () => transformation.executeOp(node, tensorMap, context));\n case 'hash_table':\n return hashTable.executeOp(\n node, tensorMap, context, resourceManager);\n case 'custom':\n const opMapper = getRegisteredOp(node.op);\n if (opMapper && opMapper.customExecutor) {\n return opMapper.customExecutor(\n new NodeValueImpl(node, tensorMap, context));\n } else {\n throw TypeError(`Custom op ${node.op} is not registered.`);\n }\n default:\n throw TypeError(\n `Unknown op '${node.op}'. File an issue at ` +\n `https://github.com/tensorflow/tfjs/issues so we can add it` +\n `, or register a custom execution with tf.registerOp()`);\n }\n })(node, tensorMap, context);\n if (tfc.util.isPromise(value)) {\n return value.then((data) => [].concat(data));\n }\n return [].concat(value);\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor} from '@tensorflow/tfjs-core';\n\nimport {NamedTensorsMap, TensorArrayMap, TensorListMap} from '../data/types';\n\nimport {TensorArray} from './tensor_array';\nimport {TensorList} from './tensor_list';\nimport {FunctionExecutor} from './types';\n\nexport interface ExecutionContextInfo {\n id: number; // the unique id of the context info\n frameName: string; // The frame name of the loop, this comes from\n // the TensorFlow NodeDef.\n iterationId: number; // The iteration id of the loop\n}\n\n/**\n * ExecutionContext captures the runtime environment of the node. It keeps\n * track of the current frame and iteration for the control flow ops.\n *\n * For example, typical Dynamic RNN model may contain loops, for which\n * TensorFlow will generate graphs with Enter/Exit nodes to control the\n * current execution frame, and NextIteration Nodes for iteration id increment.\n * For model with branch logic, TensorFLow will generate Switch/Merge ops.\n */\nexport class ExecutionContext {\n private rootContext = {id: 0, frameName: '', iterationId: 0};\n private contexts: ExecutionContextInfo[] = [this.rootContext];\n private lastId = 0;\n private _currentContextIds: string[];\n\n constructor(\n readonly weightMap: NamedTensorsMap = {},\n readonly tensorArrayMap: TensorArrayMap = {},\n readonly tensorListMap: TensorListMap = {},\n readonly functionMap: {[key: string]: FunctionExecutor} = {}) {\n this.generateCurrentContextIds();\n }\n\n private newFrame(id: number, frameName: string) {\n return {id, frameName, iterationId: 0};\n }\n\n /**\n * Set the current context\n * @param contexts: ExecutionContextInfo[] the current path of execution\n * frames\n */\n set currentContext(contexts: ExecutionContextInfo[]) {\n if (this.contexts !== contexts) {\n this.contexts = contexts;\n this.generateCurrentContextIds();\n }\n }\n\n get currentContext(): ExecutionContextInfo[] {\n return this.contexts;\n }\n\n /**\n * Returns the current context in string format.\n */\n get currentContextId(): string {\n return this._currentContextIds[0];\n }\n\n /**\n * Returns the current context and all parent contexts in string format.\n * This allow access to the nodes in the current and parent frames.\n */\n get currentContextIds(): string[] {\n return this._currentContextIds;\n }\n\n private generateCurrentContextIds() {\n const names = [];\n for (let i = 0; i < this.contexts.length - 1; i++) {\n const contexts = this.contexts.slice(0, this.contexts.length - i);\n names.push(this.contextIdforContexts(contexts));\n }\n names.push('');\n this._currentContextIds = names;\n }\n\n private contextIdforContexts(contexts: ExecutionContextInfo[]) {\n return contexts ?\n contexts\n .map(\n context => (context.id === 0 && context.iterationId === 0) ?\n '' :\n `${context.frameName}-${context.iterationId}`)\n .join('/') :\n '';\n }\n\n /**\n * Enter a new frame, a new context is pushed on the current context list.\n * @param frameId new frame id\n */\n enterFrame(frameId: string) {\n if (this.contexts) {\n this.lastId++;\n this.contexts = this.contexts.slice();\n this.contexts.push(this.newFrame(this.lastId, frameId));\n this._currentContextIds.unshift(this.contextIdforContexts(this.contexts));\n }\n }\n\n /**\n * Exit the current frame, the last context is removed from the current\n * context list.\n */\n exitFrame() {\n if (this.contexts && this.contexts.length > 1) {\n this.contexts = this.contexts.slice();\n this.contexts.splice(-1);\n this.currentContextIds.shift();\n } else {\n throw new Error('Cannot exit frame, the context is empty');\n }\n }\n\n /**\n * Enter the next iteration of a loop, the iteration id of last context is\n * increased.\n */\n nextIteration() {\n if (this.contexts && this.contexts.length > 0) {\n this.contexts = this.contexts.slice();\n this.lastId++;\n const context =\n Object.assign({}, this.contexts[this.contexts.length - 1]);\n context.iterationId += 1;\n context.id = this.lastId;\n this.contexts.splice(-1, 1, context);\n this._currentContextIds.splice(\n 0, 1, this.contextIdforContexts(this.contexts));\n } else {\n throw new Error('Cannot increase frame iteration, the context is empty');\n }\n }\n\n getWeight(name: string): Tensor[] {\n return this.weightMap[name];\n }\n\n addTensorArray(tensorArray: TensorArray) {\n this.tensorArrayMap[tensorArray.id] = tensorArray;\n }\n\n getTensorArray(id: number): TensorArray {\n return this.tensorArrayMap[id];\n }\n\n addTensorList(tensorList: TensorList) {\n this.tensorListMap[tensorList.id] = tensorList;\n }\n\n getTensorList(id: number): TensorList {\n return this.tensorListMap[id];\n }\n\n dispose(keepIds: Set) {\n for (const key in this.tensorArrayMap) {\n this.tensorArrayMap[key].clearAndClose(keepIds);\n }\n\n for (const key in this.tensorListMap) {\n this.tensorListMap[key].clearAndClose(keepIds);\n }\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {NamedTensorMap} from '@tensorflow/tfjs-core';\n\nimport {NamedTensorsMap} from '../data/types';\nimport {parseNodeName} from '../operations/executors/utils';\nimport {Graph, Node} from '../operations/types';\n\nexport interface ExecutionInfo {\n inputs: NamedTensorMap;\n outputs: Node[];\n usedNodes: Set;\n missingInputs: string[];\n dynamicNode: Node;\n syncInputs: string[];\n}\n\n/**\n * Given graph inputs and desired outputs, find the minimal set of nodes\n * to execute in order to compute the outputs. In addition return other useful\n * info such:\n * - Missing inputs needed to compute the output.\n * - Whether the subgraph contains dynamic ops (control flow, dynamic shape).\n * - Alternative inputs in order to avoid async (dynamic op) execution.\n */\nexport function getExecutionSubgraph(\n inputs: NamedTensorMap, outputs: Node[], weightMap: NamedTensorsMap,\n initNodes?: Node[]): ExecutionInfo {\n const usedNodes = new Set();\n const missingInputs: string[] = [];\n let dynamicNode: Node = null;\n let syncInputs: string[] = null;\n\n // Start with the outputs, going backwards and find all the nodes that are\n // needed to compute those outputs.\n const seen = new Set();\n const inputNodeNames =\n Object.keys(inputs).map(name => parseNodeName(name)[0]);\n\n let initNodeNames: string[] = [];\n if (initNodes != null) {\n initNodeNames = initNodes.map(node => parseNodeName(node.name)[0]);\n }\n\n const frontier = [...outputs];\n while (frontier.length > 0) {\n const node = frontier.pop();\n if (isControlFlow(node) || isDynamicShape(node) || isHashTable(node)) {\n if (dynamicNode == null) {\n dynamicNode = node;\n syncInputs = dynamicNode.children.map(child => child.name)\n .filter(name => usedNodes.has(name));\n }\n }\n usedNodes.add(node.name);\n\n // Weights are dead end since we already have their values.\n if (weightMap[node.name] != null) {\n continue;\n }\n // This node is a dead end since it's one of the user-provided inputs.\n if (inputNodeNames.indexOf(node.name) !== -1) {\n continue;\n }\n // This node is a dead end since it doesn't have any inputs.\n if (initNodeNames.indexOf(node.name) !== -1) {\n continue;\n }\n if (node.inputs.length === 0) {\n missingInputs.push(node.name);\n continue;\n }\n node.inputs.forEach(input => {\n // Don't add to the frontier if it is already there.\n if (seen.has(input.name)) {\n return;\n }\n seen.add(input.name);\n frontier.push(input);\n });\n }\n return {inputs, outputs, usedNodes, missingInputs, dynamicNode, syncInputs};\n}\n\n/**\n * Given the execution info, return a list of nodes in topological order that\n * need to be executed to compute the output.\n */\nexport function getNodesInTopologicalOrder(\n graph: Graph, weightMap: NamedTensorsMap,\n executionInfo: ExecutionInfo): Node[] {\n const {usedNodes, inputs} = executionInfo;\n const frontier: Node[] = [];\n const inputNodes = Object.keys(inputs)\n .map(name => parseNodeName(name)[0])\n .map(name => graph.nodes[name]);\n const initNodes = graph.initNodes;\n\n inputNodes.forEach(input => {\n if (usedNodes.has(input.name)) {\n frontier.push(input);\n }\n });\n graph.weights.forEach(weight => {\n if (usedNodes.has(weight.name)) {\n frontier.push(weight);\n }\n });\n if (initNodes != null) {\n initNodes.forEach(node => {\n if (usedNodes.has(node.name)) {\n frontier.push(node);\n }\n });\n }\n const seen = new Set();\n const orderedNodes: Node[] = [];\n while (frontier.length > 0) {\n const node = frontier.pop();\n seen.add(node.name);\n if (!weightMap[node.name]) {\n orderedNodes.push(node);\n }\n node.children.forEach(child => {\n if (!seen.has(child.name) && usedNodes.has(child.name) &&\n child.inputs.every(input => seen.has(input.name))) {\n frontier.push(child);\n }\n });\n }\n return orderedNodes;\n}\n\nconst CONTROL_FLOW_OPS = [\n 'Switch', 'Merge', 'Enter', 'Exit', 'NextIteration', 'StatelessIf',\n 'StatelessWhile', 'if', 'While'\n];\nconst DYNAMIC_SHAPE_OPS = [\n 'NonMaxSuppressionV2', 'NonMaxSuppressionV3', 'NonMaxSuppressionV5', 'Where'\n];\nconst HASH_TABLE_OPS = [\n 'HashTable', 'HashTableV2', 'LookupTableImport', 'LookupTableImportV2',\n 'LookupTableFind', 'LookupTableFindV2', 'LookupTableSize', 'LookupTableSizeV2'\n];\n\nexport function isControlFlow(node: Node) {\n return CONTROL_FLOW_OPS.indexOf(node.op) >= 0;\n}\n\nexport function isDynamicShape(node: Node) {\n return DYNAMIC_SHAPE_OPS.indexOf(node.op) >= 0;\n}\n\nexport function isHashTable(node: Node) {\n return HASH_TABLE_OPS.indexOf(node.op) >= 0;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataType, env, NamedTensorMap, Tensor, tidy, util} from '@tensorflow/tfjs-core';\n\nimport {ISignatureDef} from '../data/compiled_api';\nimport {NamedTensorsMap, TensorArrayMap, TensorInfo, TensorListMap} from '../data/types';\nimport {getNodeNameAndIndex, getParamValue, getTensor, getTensorsForCurrentContenxt, parseNodeName} from '../operations/executors/utils';\nimport {executeOp} from '../operations/operation_executor';\nimport {Graph, Node} from '../operations/types';\n\nimport {ExecutionContext, ExecutionContextInfo} from './execution_context';\nimport {getExecutionSubgraph, getNodesInTopologicalOrder, isControlFlow} from './model_analysis';\nimport {ResourceManager} from './resource_manager';\nimport {FunctionExecutor} from './types';\n\ninterface NodeWithContexts {\n contexts: ExecutionContextInfo[];\n node: Node;\n}\n\nexport class GraphExecutor implements FunctionExecutor {\n private compiledMap: Map = new Map();\n private _weightMap: NamedTensorsMap = {};\n private _weightIds: number[];\n private _signature: ISignatureDef;\n private _inputs: Node[];\n private _outputs: Node[];\n private _initNodes: Node[]; // Internal init nodes to start initialization.\n private SEPERATOR = ',';\n private _functions: {[key: string]: Graph} = {};\n private _functionExecutorMap: {[key: string]: FunctionExecutor} = {};\n private _resourceManager: ResourceManager;\n private intermediateTensors: NamedTensorsMap = {};\n private keepIds: Set;\n private tensorsMap: NamedTensorsMap;\n private keepTensorForDebug = false;\n\n get weightIds(): number[] {\n return this.parent ? this.parent.weightIds : this._weightIds;\n }\n\n get functionExecutorMap(): {[key: string]: FunctionExecutor} {\n return this.parent ? this.parent.functionExecutorMap :\n this._functionExecutorMap;\n }\n\n get weightMap(): NamedTensorsMap {\n return this.parent ? this.parent.weightMap : this._weightMap;\n }\n\n set weightMap(weightMap: NamedTensorsMap) {\n const weightIds = Object.keys(weightMap).map(\n key => weightMap[key].map(tensor => tensor.id));\n this._weightIds = [].concat(...weightIds);\n this._weightMap = weightMap;\n }\n\n /**\n * Set `ResourceManager` shared by executors of a model.\n * @param resourceManager: `ResourceManager` of the `GraphModel`.\n */\n set resourceManager(resourceManager: ResourceManager) {\n this._resourceManager = resourceManager;\n }\n\n get inputs(): TensorInfo[] {\n return this._inputs.map(node => {\n return {\n name: node.name,\n shape: node.attrParams['shape'] ?\n node.attrParams['shape'].value as number[] :\n undefined,\n dtype: node.attrParams['dtype'] ?\n node.attrParams['dtype'].value as DataType :\n undefined\n };\n });\n }\n\n get outputs(): TensorInfo[] {\n return this._outputs.map(node => {\n return {\n name: node.name,\n shape: node.attrParams['shape'] ?\n node.attrParams['shape'].value as number[] :\n undefined,\n dtype: node.attrParams['dtype'] ?\n node.attrParams['dtype'].value as DataType :\n undefined\n };\n });\n }\n\n get inputNodes(): string[] {\n return this._inputs.map(node => node.signatureKey || node.name);\n }\n\n get outputNodes(): string[] {\n return this._outputs.map((node) => {\n const name = node.signatureKey || node.name;\n return node.defaultOutput ? (`${name}:${node.defaultOutput}`) : name;\n });\n }\n\n get functions(): {[key: string]: ISignatureDef} {\n return Object.keys(this._functions).reduce((map, key) => {\n map[key] = this._functions[key].signature;\n return map;\n }, {} as {[key: string]: ISignatureDef});\n }\n\n /**\n *\n * @param graph Graph the model or function graph to be executed.\n * @param parent When building function exector you need to set the parent\n * executor. Since the weights and function executor maps are set at parant\n * level, that function executor can access the function maps and weight maps\n * through the parent.\n */\n constructor(private graph: Graph, private parent?: GraphExecutor) {\n this._outputs = graph.outputs;\n this._inputs = graph.inputs;\n this._initNodes = graph.initNodes;\n this._signature = graph.signature;\n this._functions = graph.functions;\n // create sub-graph executors\n if (graph.functions != null) {\n Object.keys(graph.functions).forEach(name => {\n this._functionExecutorMap[name] =\n new GraphExecutor(graph.functions[name], this);\n });\n }\n }\n\n private getCompilationKey(inputs: Node[], outputs: Node[]): string {\n const sortedInputs = inputs.map(node => node.name).sort();\n const sortedOutputs = outputs.map(node => node.name).sort();\n return sortedInputs.join(this.SEPERATOR) + '--' +\n sortedOutputs.join(this.SEPERATOR);\n }\n\n /**\n * Compiles the inference graph and returns the minimal set of nodes that are\n * required for execution, in the correct execution order.\n */\n private compile(inputs: NamedTensorMap, outputs: Node[]): Node[] {\n const executionInfo =\n getExecutionSubgraph(inputs, outputs, this.weightMap, this._initNodes);\n const {missingInputs, dynamicNode, syncInputs} = executionInfo;\n if (dynamicNode != null) {\n throw new Error(\n `This execution contains the node '${dynamicNode.name}', which has ` +\n `the dynamic op '${dynamicNode.op}'. Please use ` +\n `model.executeAsync() instead. Alternatively, to avoid the ` +\n `dynamic ops, specify the inputs [${syncInputs}]`);\n }\n\n if (missingInputs.length > 0) {\n const outNames = outputs.map(n => n.name);\n const inNames = Object.keys(inputs);\n throw new Error(\n `Cannot compute the outputs [${outNames}] from the provided inputs ` +\n `[${inNames}]. Missing the following inputs: [${missingInputs}]`);\n }\n\n return getNodesInTopologicalOrder(\n this.graph, this.weightMap, executionInfo);\n }\n\n /**\n * Executes the inference for given input tensors.\n * @param inputs Tensor map for the model inputs, keyed by the input node\n * names.\n * @param outputs Optional. output node name from the Tensorflow model, if\n * no outputs are specified, the default outputs of the model would be used.\n * You can inspect intermediate nodes of the model by adding them to the\n * outputs array.\n */\n execute(inputs: NamedTensorMap, outputs?: string[]): Tensor[] {\n inputs = this.mapInputs(inputs);\n const names = Object.keys(inputs).sort();\n this.checkInputs(inputs);\n this.checkInputShapeAndType(inputs);\n outputs = this.mapOutputs(outputs);\n this.checkOutputs(outputs);\n const inputNodes =\n names.map(name => this.graph.nodes[parseNodeName(name)[0]]);\n const outputNodeNames = outputs.map(name => parseNodeName(name)[0]);\n let outputNodes = outputNodeNames.map(name => this.graph.nodes[name]);\n this.resetIntermediateTensors();\n // If no outputs are specified, then use the default outputs of the model.\n if (outputNodes.length === 0) {\n outputNodes = this._outputs;\n }\n\n const compilationKey = this.getCompilationKey(inputNodes, outputNodes);\n\n // Do nothing if the compiled graph cache contains the input.\n let orderedNodes = this.compiledMap.get(compilationKey);\n if (orderedNodes == null) {\n orderedNodes = this.compile(inputs, outputNodes);\n this.compiledMap.set(compilationKey, orderedNodes);\n }\n\n const tensorArrayMap: TensorArrayMap = {};\n const tensorListMap: TensorListMap = {};\n\n return tidy(() => {\n const context = new ExecutionContext(\n this.weightMap, tensorArrayMap, tensorListMap,\n this.functionExecutorMap);\n const tensorsMap: NamedTensorsMap = {...this.weightMap};\n\n Object.keys(inputs).forEach(name => {\n const [nodeName, index] = parseNodeName(name);\n const tensors: Tensor[] = [];\n tensors[index] = inputs[name];\n tensorsMap[nodeName] = tensors;\n });\n\n const tensorsToKeep = this.getFrozenTensorIds(tensorsMap);\n const intermediateTensorConsumerCount: {[key: number]: number} = {};\n for (let i = 0; i < orderedNodes.length; i++) {\n const node = orderedNodes[i];\n if (!tensorsMap[node.name]) {\n const tensors =\n executeOp(node, tensorsMap, context, this._resourceManager) as\n Tensor[];\n if (util.isPromise(tensors)) {\n throw new Error(\n `The execution of the op '${node.op}' returned a promise. ` +\n `Please use model.executeAsync() instead.`);\n }\n tensorsMap[node.name] = tensors;\n this.checkTensorForDisposal(\n node.name, node, tensorsMap, context, tensorsToKeep,\n outputNodeNames, intermediateTensorConsumerCount);\n }\n }\n // dispose the context for the root executor\n if (this.parent == null) {\n context.dispose(tensorsToKeep);\n }\n return outputs.map(name => getTensor(name, tensorsMap, context));\n });\n }\n\n private getFrozenTensorIds(tensorMap: NamedTensorsMap): Set {\n const ids = [].concat.apply(\n [],\n Object.keys(tensorMap)\n .map(key => tensorMap[key])\n .map(tensors => tensors.map(tensor => tensor.id)));\n return new Set(ids);\n }\n private checkTensorForDisposal(\n nodeName: string, node: Node, tensorMap: NamedTensorsMap,\n context: ExecutionContext, tensorsToKeep: Set,\n outputNames: string[],\n intermediateTensorConsumerCount: {[key: string]: number}) {\n // Skip output nodes and any control flow nodes, since its dependency is\n // tricky to track correctly.\n if (node.category === 'control' || outputNames.indexOf(nodeName) !== -1) {\n return;\n }\n\n tensorMap[nodeName].forEach(tensor => {\n if (tensor != null) {\n intermediateTensorConsumerCount[tensor.id] =\n (intermediateTensorConsumerCount[tensor.id] || 0) +\n node.children.length;\n }\n });\n node.inputs.forEach(input => {\n // Skip any control flow nodes, since its dependency is tricky to track\n // correctly.\n if (input.category !== 'control') {\n const tensors =\n getTensorsForCurrentContenxt(input.name, tensorMap, context);\n if (tensors != null) {\n tensors.forEach(tensor => {\n if (tensor && !tensor.kept && !tensorsToKeep.has(tensor.id)) {\n const count = intermediateTensorConsumerCount[tensor.id];\n if (count === 1) {\n if (!this.keepTensorForDebug) {\n tensor.dispose();\n } else {\n const [nodeName, index] =\n getNodeNameAndIndex(node.name, context);\n if (this.intermediateTensors[nodeName]) {\n this.intermediateTensors[nodeName][index] = tensor;\n } else {\n this.intermediateTensors[nodeName] = [];\n this.intermediateTensors[nodeName][index] = tensor;\n }\n }\n delete intermediateTensorConsumerCount[tensor.id];\n } else if (count != null) {\n // only intermediate nodes has count set, inputs and weights are\n // not.\n intermediateTensorConsumerCount[tensor.id]--;\n }\n }\n });\n }\n }\n });\n }\n\n /**\n * Executes the inference for given input tensors in Async fashion.\n * @param inputs Tensor map for the model inputs, keyed by the input node\n * names.\n * @param outputs output node name from the Tensorflow model, if no outputs\n * are specified, the default outputs of the model would be used. You can\n * inspect intermediate nodes of the model by adding them to the outputs\n * array.\n */\n async executeAsync(inputs: NamedTensorMap, outputs?: string[]):\n Promise {\n return this._executeAsync(inputs, outputs);\n }\n\n disposeIntermediateTensors() {\n if (!this.intermediateTensors) {\n return;\n }\n Object.keys(this.intermediateTensors)\n .forEach(\n key => this.intermediateTensors[key].forEach(\n tensor => tensor.dispose()));\n this.disposeTensorsMap();\n }\n\n private disposeTensorsMap() {\n if (!this.tensorsMap) {\n return;\n }\n Object.keys(this.tensorsMap).forEach(key => {\n const tensorArray = this.tensorsMap[key];\n tensorArray.forEach(tensor => {\n if (tensor && !tensor.kept && !tensor.isDisposed &&\n !this.keepIds.has(tensor.id)) {\n tensor.dispose();\n }\n });\n });\n }\n\n getIntermediateTensors(): NamedTensorsMap {\n return this.tensorsMap;\n }\n\n private resetIntermediateTensors() {\n for (const key in this.intermediateTensors) {\n this.intermediateTensors[key].forEach(tensor => tensor.dispose());\n delete this.intermediateTensors[key];\n }\n }\n\n /**\n * Executes the inference for given input tensors in Async fashion.\n * @param inputs Tensor map for the model inputs, keyed by the input node\n * names.\n * @param outputs Optional. output node name from the Tensorflow model,\n * if no outputs are specified, the default outputs of the model would be\n * used. You can inspect intermediate nodes of the model by adding them to the\n * outputs array.\n * @param isFunctionExecution Optional. Flag for executing a function.\n * @param tensorArrayMap Optional, global TensorArray map by id. Used for\n * function execution.\n * @param tensorArrayMap Optinal global TensorList map by id. Used for\n * function execution.\n */\n private async _executeAsync(\n inputs: NamedTensorMap, outputs?: string[], isFunctionExecution = false,\n tensorArrayMap: TensorArrayMap = {},\n tensorListMap: TensorListMap = {}): Promise {\n if (!isFunctionExecution) {\n inputs = this.mapInputs(inputs);\n this.checkInputs(inputs);\n this.checkInputShapeAndType(inputs);\n outputs = this.mapOutputs(outputs);\n this.checkOutputs(outputs);\n }\n\n // For model debug.\n try {\n this.keepTensorForDebug = env().getBool('KEEP_INTERMEDIATE_TENSORS');\n } catch (e) {\n console.warn(e.message);\n }\n this.resetIntermediateTensors();\n\n const context = new ExecutionContext(\n this.weightMap, tensorArrayMap, tensorListMap,\n this.functionExecutorMap);\n\n // Graph with control flow op requires runtime evaluation of the execution\n // order, while without control flow the execution order is pre-determined\n // in the compile method.\n this.tensorsMap = await this.executeWithControlFlow(\n inputs, context, outputs, isFunctionExecution);\n const results =\n outputs.map(name => getTensor(name, this.tensorsMap, context));\n\n // dispose all the intermediate tensors\n const outputIds = results.map(t => t.id);\n const inputIds = Object.keys(inputs).map(name => inputs[name].id);\n this.keepIds =\n new Set([...outputIds, ...inputIds, ...this.weightIds]);\n if (!this.keepTensorForDebug) {\n this.disposeTensorsMap();\n }\n\n // dispose the context for the root executor\n if (this.parent == null) {\n context.dispose(this.keepIds);\n }\n\n return results;\n }\n\n async executeFunctionAsync(\n inputs: Tensor[], tensorArrayMap: TensorArrayMap,\n tensorListMap: TensorListMap): Promise {\n const mappedInputs = inputs.reduce((map, tensor, index) => {\n map[this.inputs[index].name] = tensor;\n return map;\n }, {} as NamedTensorMap);\n\n return this._executeAsync(\n mappedInputs, this.outputNodes, true, tensorArrayMap, tensorListMap);\n }\n\n /**\n * When there are control flow nodes in the graph, the graph execution use\n * ExecutionContext to keep track of the frames and loop iterators.\n * @param inputs placeholder tensors for the graph.\n * @param context the execution context object for current execution.\n * @param outputNames Optional. output node name from the Tensorflow model,\n * if no outputs are specified, the default outputs of the model would be\n * used. You can inspect intermediate nodes of the model by adding them to the\n * outputs array.\n * @param isFunctionExecution Flag for executing a function.\n */\n private async executeWithControlFlow(\n inputs: NamedTensorMap, context: ExecutionContext, outputNames?: string[],\n isFunctionExecution?: boolean): Promise {\n const names = Object.keys(inputs);\n const inputNodes =\n names.map(name => this.graph.nodes[parseNodeName(name)[0]]);\n const outputNodeNames = outputNames.map(name => parseNodeName(name)[0]);\n let outputNodes = outputNodeNames.map(name => this.graph.nodes[name]);\n\n // If no outputs are specified, then use the default outputs of the model.\n if (outputNodes.length === 0) {\n outputNodes = this._outputs;\n }\n\n const {usedNodes, missingInputs, dynamicNode, syncInputs} =\n getExecutionSubgraph(\n inputs, outputNodes, this.weightMap, this._initNodes);\n\n // First nodes to execute include inputNodes, weights, and initNodes.\n const stack: NodeWithContexts[] = [\n ...inputNodes, ...this.graph.weights, ...(this._initNodes || [])\n ].map(node => {\n return {node, contexts: context.currentContext};\n });\n const tensorsMap: NamedTensorsMap = {...this.weightMap};\n Object.keys(inputs).forEach(name => {\n const [nodeName, index] = parseNodeName(name);\n const tensors: Tensor[] = [];\n tensors[index] = inputs[name];\n tensorsMap[nodeName] = tensors;\n });\n const intermediateTensorConsumerCount: {[key: number]: number} = {};\n const tensorsToKeep = this.getFrozenTensorIds(tensorsMap);\n const added: {[key: string]: boolean} = {};\n while (stack.length > 0) {\n const promises = this.processStack(\n inputNodes, stack, context, tensorsMap, added, tensorsToKeep,\n outputNodeNames, intermediateTensorConsumerCount, usedNodes);\n await Promise.all(promises);\n }\n if (dynamicNode == null && !isFunctionExecution) {\n console.warn(\n `This model execution did not contain any nodes with control flow ` +\n `or dynamic output shapes. You can use model.execute() instead.`);\n }\n const missingOutputs =\n outputNodes\n .filter(\n node => !isControlFlow(node) &&\n !getTensor(node.name, tensorsMap, context))\n .map(node => node.name);\n if (missingOutputs.length > 0) {\n let alternativeMsg = '';\n if (dynamicNode != null) {\n alternativeMsg =\n `Alternatively, to avoid the dynamic ops, use model.execute() ` +\n `and specify the inputs [${syncInputs}]`;\n }\n throw new Error(\n `Cannot compute the outputs [${missingOutputs}] from the provided ` +\n `inputs [${names}]. Consider providing the following inputs: ` +\n `[${missingInputs}]. ${alternativeMsg}`);\n }\n return tensorsMap;\n }\n\n private processStack(\n inputNodes: Node[], stack: NodeWithContexts[], context: ExecutionContext,\n tensorMap: NamedTensorsMap, added: {[key: string]: boolean},\n tensorsToKeep: Set, outputNames: string[],\n intermediateTensorConsumerCount: {[key: number]: number},\n usedNodes: Set) {\n const promises: Array> = [];\n while (stack.length > 0) {\n const item = stack.pop();\n context.currentContext = item.contexts;\n let nodeName = '';\n // The tensor of the Enter op with isConstant set should be set\n // in the parent scope, so it will be available as constant for the\n // whole loop.\n if (item.node.op === 'Enter' &&\n getParamValue('isConstant', item.node, tensorMap, context)) {\n [nodeName] = getNodeNameAndIndex(item.node.name, context);\n }\n\n // only process nodes that are not in the tensorMap yet, this include\n // inputNodes and internal initNodes.\n if (tensorMap[item.node.name] == null) {\n const tensors =\n executeOp(item.node, tensorMap, context, this._resourceManager);\n if (!nodeName) {\n [nodeName] = getNodeNameAndIndex(item.node.name, context);\n }\n const currentContext = context.currentContext;\n if (util.isPromise(tensors)) {\n promises.push(tensors.then(t => {\n tensorMap[nodeName] = t;\n context.currentContext = currentContext;\n this.checkTensorForDisposal(\n nodeName, item.node, tensorMap, context, tensorsToKeep,\n outputNames, intermediateTensorConsumerCount);\n this.processChildNodes(\n item.node, stack, context, tensorMap, added, usedNodes);\n return t;\n }));\n } else {\n tensorMap[nodeName] = tensors;\n this.checkTensorForDisposal(\n nodeName, item.node, tensorMap, context, tensorsToKeep,\n outputNames, intermediateTensorConsumerCount);\n this.processChildNodes(\n item.node, stack, context, tensorMap, added, usedNodes);\n }\n } else {\n this.processChildNodes(\n item.node, stack, context, tensorMap, added, usedNodes);\n }\n }\n return promises;\n }\n\n private processChildNodes(\n node: Node, stack: NodeWithContexts[], context: ExecutionContext,\n tensorMap: NamedTensorsMap, added: {[key: string]: boolean},\n usedNodes: Set) {\n node.children.forEach((childNode) => {\n const [nodeName, ] = getNodeNameAndIndex(childNode.name, context);\n if (added[nodeName] || !usedNodes.has(childNode.name)) {\n return;\n }\n // Merge op can be pushed if any of its inputs has value.\n if (childNode.op === 'Merge') {\n if (childNode.inputNames.some(name => {\n return !!getTensor(name, tensorMap, context);\n })) {\n added[nodeName] = true;\n stack.push({contexts: context.currentContext, node: childNode});\n }\n } else // Otherwise all inputs must to have value.\n if (childNode.inputNames.every(name => {\n return !!getTensor(name, tensorMap, context);\n })) {\n added[nodeName] = true;\n stack.push({contexts: context.currentContext, node: childNode});\n }\n });\n }\n\n /**\n * Releases the memory used by the weight tensors.\n */\n dispose() {\n Object.keys(this.weightMap)\n .forEach(\n key => this.weightMap[key].forEach(tensor => tensor.dispose()));\n }\n\n private checkInputShapeAndType(inputs: NamedTensorMap) {\n Object.keys(inputs).forEach(name => {\n const input = inputs[name];\n const [nodeName, ] = parseNodeName(name);\n const node = this.graph.nodes[nodeName];\n if (node.attrParams['shape'] && node.attrParams['shape'].value) {\n const shape = node.attrParams['shape'].value as number[];\n const match = shape.length === input.shape.length &&\n input.shape.every(\n (dim, index) => shape[index] === -1 || shape[index] === dim);\n util.assert(\n match,\n () => `The shape of dict['${node.name}'] provided in ` +\n `model.execute(dict) must be [${shape}], but was ` +\n `[${input.shape}]`);\n }\n if (node.attrParams['dtype'] && node.attrParams['dtype'].value) {\n util.assert(\n input.dtype === node.attrParams['dtype'].value as string,\n () => `The dtype of dict['${node.name}'] provided in ` +\n `model.execute(dict) must be ` +\n `${node.attrParams['dtype'].value}, but was ${input.dtype}`);\n }\n });\n }\n\n private mapInputs(inputs: NamedTensorMap) {\n const result: NamedTensorMap = {};\n for (const inputName in inputs) {\n if (this._signature != null && this._signature.inputs != null &&\n this._signature.inputs[inputName] != null) {\n const tensor = this._signature.inputs[inputName];\n result[tensor.name] = inputs[inputName];\n } else {\n result[inputName] = inputs[inputName];\n }\n }\n return result;\n }\n\n private checkInputs(inputs: NamedTensorMap) {\n const notInGraph = Object.keys(inputs).filter(name => {\n const [nodeName] = parseNodeName(name);\n return this.graph.nodes[nodeName] == null;\n });\n if (notInGraph.length > 0) {\n throw new Error(\n `The dict provided in model.execute(dict) has ` +\n `keys: [${notInGraph}] that are not part of graph`);\n }\n }\n\n private mapOutputs(outputs: string[]) {\n return outputs.map(name => {\n if (this._signature != null && this._signature.outputs != null &&\n this._signature.outputs[name] != null) {\n const tensor = this._signature.outputs[name];\n return tensor.name;\n }\n return name;\n }, {});\n }\n\n private checkOutputs(outputs: string[]): void {\n outputs.forEach(name => {\n const [normalizedName] = parseNodeName(name);\n if (!this.graph.nodes[normalizedName]) {\n throw new Error(`The output '${name}' is not found in the graph`);\n }\n });\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {HashTableMap, NamedTensorMap} from '../data/types';\nimport {HashTable} from './hash_table';\n\n/**\n * Contains global resources of a model.\n */\nexport class ResourceManager {\n constructor(\n readonly hashTableNameToHandle: NamedTensorMap = {},\n readonly hashTableMap: HashTableMap = {}) {}\n\n /**\n * Register a `HashTable` in the resource manager.\n *\n * The `HashTable` can be retrieved by `resourceManager.getHashTableById`,\n * where id is the table handle tensor's id.\n *\n * @param name Op node name that creates the `HashTable`.\n * @param hashTable The `HashTable` to be added to resource manager.\n */\n addHashTable(name: string, hashTable: HashTable) {\n this.hashTableNameToHandle[name] = hashTable.handle;\n this.hashTableMap[hashTable.id] = hashTable;\n }\n\n /**\n * Get the table handle by node name.\n * @param name Op node name that creates the `HashTable`. This name is also\n * used in the inputs list of lookup and import `HashTable` ops.\n */\n getHashTableHandleByName(name: string) {\n return this.hashTableNameToHandle[name];\n }\n\n /**\n * Get the actual `HashTable` by its handle tensor's id.\n * @param id The id of the handle tensor.\n */\n getHashTableById(id: number): HashTable {\n return this.hashTableMap[id];\n }\n\n /**\n * Dispose `ResourceManager`, including its hashTables and tensors in them.\n */\n dispose() {\n for (const key in this.hashTableMap) {\n this.hashTableMap[key].clearAndClose();\n delete this.hashTableMap[key];\n }\n\n for (const name in this.hashTableNameToHandle) {\n this.hashTableNameToHandle[name].dispose();\n delete this.hashTableNameToHandle[name];\n }\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {dispose, InferenceModel, io, ModelPredictConfig, NamedTensorMap, Tensor, util} from '@tensorflow/tfjs-core';\n\nimport * as tensorflow from '../data/compiled_api';\nimport {NamedTensorsMap, TensorInfo} from '../data/types';\nimport {OperationMapper} from '../operations/operation_mapper';\n\nimport {GraphExecutor} from './graph_executor';\nimport {ResourceManager} from './resource_manager';\n\nexport const TFHUB_SEARCH_PARAM = '?tfjs-format=file';\nexport const DEFAULT_MODEL_NAME = 'model.json';\ntype Url = string|io.IOHandler|io.IOHandlerSync;\ntype UrlIOHandler = T extends string ? io.IOHandler : T;\n\n/**\n * A `tf.GraphModel` is a directed, acyclic graph built from a\n * SavedModel GraphDef and allows inference execution.\n *\n * A `tf.GraphModel` can only be created by loading from a model converted from\n * a [TensorFlow SavedModel](https://www.tensorflow.org/guide/saved_model) using\n * the command line converter tool and loaded via `tf.loadGraphModel`.\n *\n * @doc {heading: 'Models', subheading: 'Classes'}\n */\nexport class GraphModel implements\n InferenceModel {\n private executor: GraphExecutor;\n private version = 'n/a';\n private handler: UrlIOHandler;\n private artifacts: io.ModelArtifacts;\n private initializer: GraphExecutor;\n private resourceIdToCapturedInput: {[key: number]: Tensor};\n private resourceManager: ResourceManager;\n private signature: tensorflow.ISignatureDef;\n private initializerSignature: tensorflow.ISignatureDef;\n private structuredOutputKeys: string[];\n private readonly io: typeof io;\n\n // Returns the version information for the tensorflow model GraphDef.\n get modelVersion(): string {\n return this.version;\n }\n\n get inputNodes(): string[] {\n return this.executor.inputNodes;\n }\n\n get outputNodes(): string[] {\n return this.executor.outputNodes;\n }\n\n get inputs(): TensorInfo[] {\n return this.executor.inputs;\n }\n\n get outputs(): TensorInfo[] {\n return this.executor.outputs;\n }\n\n get weights(): NamedTensorsMap {\n return this.executor.weightMap;\n }\n\n get metadata(): {} {\n return this.artifacts.userDefinedMetadata;\n }\n\n get modelSignature(): {} {\n return this.signature;\n }\n\n get modelStructuredOutputKeys(): {} {\n return this.structuredOutputKeys;\n }\n\n /**\n * @param modelUrl url for the model, or an `io.IOHandler`.\n * @param weightManifestUrl url for the weight file generated by\n * scripts/convert.py script.\n * @param requestOption options for Request, which allows to send credentials\n * and custom headers.\n * @param onProgress Optional, progress callback function, fired periodically\n * before the load is completed.\n */\n constructor(\n private modelUrl: ModelURL, private loadOptions: io.LoadOptions = {},\n tfio = io) {\n this.io = tfio;\n if (loadOptions == null) {\n this.loadOptions = {};\n }\n this.resourceManager = new ResourceManager();\n }\n\n private findIOHandler() {\n type IOHandler = UrlIOHandler;\n const path = this.modelUrl;\n if ((path as io.IOHandler).load != null) {\n // Path is an IO Handler.\n this.handler = path as IOHandler;\n } else if (this.loadOptions.requestInit != null) {\n this.handler = this.io.browserHTTPRequest(\n path as string, this.loadOptions) as IOHandler;\n } else {\n const handlers =\n this.io.getLoadHandlers(path as string, this.loadOptions);\n if (handlers.length === 0) {\n // For backward compatibility: if no load handler can be found,\n // assume it is a relative http path.\n handlers.push(\n this.io.browserHTTPRequest(path as string, this.loadOptions));\n } else if (handlers.length > 1) {\n throw new Error(\n `Found more than one (${handlers.length}) load handlers for ` +\n `URL '${[path]}'`);\n }\n this.handler = handlers[0] as IOHandler;\n }\n }\n\n /**\n * Loads the model and weight files, construct the in memory weight map and\n * compile the inference graph.\n */\n load(): UrlIOHandler extends io.IOHandlerSync? boolean:\n Promise {\n type IOHandler = UrlIOHandler;\n this.findIOHandler();\n if (this.handler.load == null) {\n throw new Error(\n 'Cannot proceed with model loading because the IOHandler provided ' +\n 'does not have the `load` method implemented.');\n }\n\n type Result =\n IOHandler extends io.IOHandlerSync ? boolean : Promise;\n\n const loadResult = this.handler.load() as ReturnType;\n if (util.isPromise(loadResult)) {\n return loadResult.then(artifacts => this.loadSync(artifacts)) as Result;\n }\n\n return this.loadSync(loadResult) as Result;\n }\n\n /**\n * Synchronously construct the in memory weight map and\n * compile the inference graph.\n *\n * @doc {heading: 'Models', subheading: 'Classes', ignoreCI: true}\n */\n loadSync(artifacts: io.ModelArtifacts) {\n this.artifacts = artifacts;\n const graph = this.artifacts.modelTopology as tensorflow.IGraphDef;\n\n let signature = this.artifacts.signature;\n if (this.artifacts.userDefinedMetadata != null) {\n const metadata = this.artifacts.userDefinedMetadata;\n if (metadata.signature != null) {\n signature = metadata.signature;\n }\n\n if (metadata.structuredOutputKeys != null) {\n this.structuredOutputKeys = metadata.structuredOutputKeys as string[];\n }\n }\n this.signature = signature;\n\n this.version = `${graph.versions.producer}.${graph.versions.minConsumer}`;\n const weightMap = this.io.decodeWeights(\n this.artifacts.weightData, this.artifacts.weightSpecs);\n this.executor = new GraphExecutor(\n OperationMapper.Instance.transformGraph(graph, this.signature));\n this.executor.weightMap = this.convertTensorMapToTensorsMap(weightMap);\n // Attach a model-level resourceManager to each executor to share resources,\n // such as `HashTable`.\n this.executor.resourceManager = this.resourceManager;\n\n if (artifacts.modelInitializer != null &&\n (artifacts.modelInitializer as tensorflow.IGraphDef).node != null) {\n const initializer =\n OperationMapper.Instance.transformGraph(artifacts.modelInitializer);\n this.initializer = new GraphExecutor(initializer);\n this.initializer.weightMap = this.executor.weightMap;\n // Attach a model-level resourceManager to the initializer, the\n // hashTables created from when executing the initializer will be stored\n // in the resourceManager.\n this.initializer.resourceManager = this.resourceManager;\n this.initializerSignature = artifacts.initializerSignature;\n }\n\n return true;\n }\n\n /**\n * Save the configuration and/or weights of the GraphModel.\n *\n * An `IOHandler` is an object that has a `save` method of the proper\n * signature defined. The `save` method manages the storing or\n * transmission of serialized data (\"artifacts\") that represent the\n * model's topology and weights onto or via a specific medium, such as\n * file downloads, local storage, IndexedDB in the web browser and HTTP\n * requests to a server. TensorFlow.js provides `IOHandler`\n * implementations for a number of frequently used saving mediums, such as\n * `tf.io.browserDownloads` and `tf.io.browserLocalStorage`. See `tf.io`\n * for more details.\n *\n * This method also allows you to refer to certain types of `IOHandler`s\n * as URL-like string shortcuts, such as 'localstorage://' and\n * 'indexeddb://'.\n *\n * Example 1: Save `model`'s topology and weights to browser [local\n * storage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage);\n * then load it back.\n *\n * ```js\n * const modelUrl =\n * 'https://storage.googleapis.com/tfjs-models/savedmodel/mobilenet_v2_1.0_224/model.json';\n * const model = await tf.loadGraphModel(modelUrl);\n * const zeros = tf.zeros([1, 224, 224, 3]);\n * model.predict(zeros).print();\n *\n * const saveResults = await model.save('localstorage://my-model-1');\n *\n * const loadedModel = await tf.loadGraphModel('localstorage://my-model-1');\n * console.log('Prediction from loaded model:');\n * model.predict(zeros).print();\n * ```\n *\n * @param handlerOrURL An instance of `IOHandler` or a URL-like,\n * scheme-based string shortcut for `IOHandler`.\n * @param config Options for saving the model.\n * @returns A `Promise` of `SaveResult`, which summarizes the result of\n * the saving, such as byte sizes of the saved artifacts for the model's\n * topology and weight values.\n *\n * @doc {heading: 'Models', subheading: 'Classes', ignoreCI: true}\n */\n async save(handlerOrURL: io.IOHandler|string, config?: io.SaveConfig):\n Promise {\n if (typeof handlerOrURL === 'string') {\n const handlers = this.io.getSaveHandlers(handlerOrURL);\n if (handlers.length === 0) {\n throw new Error(\n `Cannot find any save handlers for URL '${handlerOrURL}'`);\n } else if (handlers.length > 1) {\n throw new Error(\n `Found more than one (${handlers.length}) save handlers for ` +\n `URL '${handlerOrURL}'`);\n }\n handlerOrURL = handlers[0];\n }\n if (handlerOrURL.save == null) {\n throw new Error(\n 'GraphModel.save() cannot proceed because the IOHandler ' +\n 'provided does not have the `save` attribute defined.');\n }\n\n return handlerOrURL.save(this.artifacts);\n }\n\n /**\n * Execute the inference for the input tensors.\n *\n * @param input The input tensors, when there is single input for the model,\n * inputs param should be a `tf.Tensor`. For models with mutliple inputs,\n * inputs params should be in either `tf.Tensor`[] if the input order is\n * fixed, or otherwise NamedTensorMap format.\n *\n * For model with multiple inputs, we recommend you use NamedTensorMap as the\n * input type, if you use `tf.Tensor`[], the order of the array needs to\n * follow the\n * order of inputNodes array. @see {@link GraphModel.inputNodes}\n *\n * You can also feed any intermediate nodes using the NamedTensorMap as the\n * input type. For example, given the graph\n * InputNode => Intermediate => OutputNode,\n * you can execute the subgraph Intermediate => OutputNode by calling\n * model.execute('IntermediateNode' : tf.tensor(...));\n *\n * This is useful for models that uses tf.dynamic_rnn, where the intermediate\n * state needs to be fed manually.\n *\n * For batch inference execution, the tensors for each input need to be\n * concatenated together. For example with mobilenet, the required input shape\n * is [1, 244, 244, 3], which represents the [batch, height, width, channel].\n * If we are provide a batched data of 100 images, the input tensor should be\n * in the shape of [100, 244, 244, 3].\n *\n * @param config Prediction configuration for specifying the batch size.\n * Currently the batch size option is ignored for graph model.\n *\n * @returns Inference result tensors. If the model is converted and it\n * originally had structured_outputs in tensorflow, then a NamedTensorMap\n * will be returned matching the structured_outputs. If no structured_outputs\n * are present, the output will be single `tf.Tensor` if the model has single\n * output node, otherwise Tensor[].\n *\n * @doc {heading: 'Models', subheading: 'Classes'}\n */\n predict(inputs: Tensor|Tensor[]|NamedTensorMap, config?: ModelPredictConfig):\n Tensor|Tensor[]|NamedTensorMap {\n const outputTensors = this.execute(inputs, this.outputNodes);\n if (this.structuredOutputKeys) {\n const outputTensorsArray =\n outputTensors instanceof Tensor ? [outputTensors] : outputTensors;\n const outputTensorMap: NamedTensorMap = {};\n\n outputTensorsArray.forEach(\n (outputTensor, i) => outputTensorMap[this.structuredOutputKeys[i]] =\n outputTensor);\n\n return outputTensorMap;\n }\n return outputTensors;\n }\n\n private normalizeInputs(inputs: Tensor|Tensor[]|\n NamedTensorMap): NamedTensorMap {\n if (!(inputs instanceof Tensor) && !Array.isArray(inputs)) {\n // The input is already a NamedTensorMap.\n if (this.signature != null && this.signature.inputs != null) {\n for (const input in this.signature.inputs) {\n const tensor = this.signature.inputs[input];\n if (tensor.resourceId != null) {\n inputs[input] = this.resourceIdToCapturedInput[tensor.resourceId];\n }\n }\n }\n return inputs;\n }\n inputs = Array.isArray(inputs) ? inputs : [inputs];\n\n const numCapturedInputs =\n Object.keys(this.resourceIdToCapturedInput).length;\n if (inputs.length + numCapturedInputs !== this.inputNodes.length) {\n throw new Error(`Input tensor count mismatch, the graph model has ${\n this.inputNodes.length -\n numCapturedInputs} non-resource placeholders, while there are ${\n inputs.length} input tensors provided.`);\n }\n\n let inputIndex = 0;\n return this.inputNodes.reduce((map, inputName) => {\n const signature =\n this.signature ? this.signature.inputs[inputName] : null;\n if (signature != null && signature.resourceId != null) {\n map[inputName] = this.resourceIdToCapturedInput[signature.resourceId];\n } else {\n map[inputName] = (inputs as Tensor[])[inputIndex++];\n }\n return map;\n }, {} as NamedTensorMap);\n }\n\n private normalizeOutputs(outputs: string|string[]): string[] {\n outputs = outputs || this.outputNodes;\n return !Array.isArray(outputs) ? [outputs] : outputs;\n }\n\n private executeInitializerGraph() {\n if (this.initializer == null) {\n return [];\n }\n if (this.initializerSignature == null) {\n return this.initializer.execute({}, []);\n } else {\n return this.initializer.execute(\n {}, Object.keys(this.initializerSignature.outputs));\n }\n }\n\n private async executeInitializerGraphAsync() {\n if (this.initializer == null) {\n return [];\n }\n if (this.initializerSignature == null) {\n return this.initializer.executeAsync({}, []);\n } else {\n return this.initializer.executeAsync(\n {}, Object.keys(this.initializerSignature.outputs));\n }\n }\n\n private setResourceIdToCapturedInput(outputs: Tensor[]) {\n this.resourceIdToCapturedInput = {};\n\n if (this.initializerSignature) {\n const outputNames = Object.keys(this.initializerSignature.outputs);\n for (let i = 0; i < outputNames.length; i++) {\n const outputName = outputNames[i];\n const tensorInfo = this.initializerSignature.outputs[outputName];\n this.resourceIdToCapturedInput[tensorInfo.resourceId] = outputs[i];\n }\n }\n }\n\n /**\n * Executes inference for the model for given input tensors.\n * @param inputs tensor, tensor array or tensor map of the inputs for the\n * model, keyed by the input node names.\n * @param outputs output node name from the TensorFlow model, if no\n * outputs are specified, the default outputs of the model would be used.\n * You can inspect intermediate nodes of the model by adding them to the\n * outputs array.\n *\n * @returns A single tensor if provided with a single output or no outputs\n * are provided and there is only one default output, otherwise return a\n * tensor array. The order of the tensor array is the same as the outputs\n * if provided, otherwise the order of outputNodes attribute of the model.\n *\n * @doc {heading: 'Models', subheading: 'Classes'}\n */\n execute(inputs: Tensor|Tensor[]|NamedTensorMap, outputs?: string|string[]):\n Tensor|Tensor[] {\n if (this.resourceIdToCapturedInput == null) {\n this.setResourceIdToCapturedInput(this.executeInitializerGraph());\n }\n inputs = this.normalizeInputs(inputs);\n outputs = this.normalizeOutputs(outputs);\n const result = this.executor.execute(inputs, outputs);\n return result.length > 1 ? result : result[0];\n }\n\n /**\n * Executes inference for the model for given input tensors in async\n * fashion, use this method when your model contains control flow ops.\n * @param inputs tensor, tensor array or tensor map of the inputs for the\n * model, keyed by the input node names.\n * @param outputs output node name from the TensorFlow model, if no outputs\n * are specified, the default outputs of the model would be used. You can\n * inspect intermediate nodes of the model by adding them to the outputs\n * array.\n *\n * @returns A Promise of single tensor if provided with a single output or\n * no outputs are provided and there is only one default output, otherwise\n * return a tensor map.\n *\n * @doc {heading: 'Models', subheading: 'Classes'}\n */\n async executeAsync(\n inputs: Tensor|Tensor[]|NamedTensorMap,\n outputs?: string|string[]): Promise {\n if (this.resourceIdToCapturedInput == null) {\n this.setResourceIdToCapturedInput(\n await this.executeInitializerGraphAsync());\n }\n inputs = this.normalizeInputs(inputs);\n outputs = this.normalizeOutputs(outputs);\n const result = await this.executor.executeAsync(inputs, outputs);\n return result.length > 1 ? result : result[0];\n }\n\n /**\n * Get intermediate tensors for model debugging mode (flag\n * KEEP_INTERMEDIATE_TENSORS is true).\n *\n * @doc {heading: 'Models', subheading: 'Classes'}\n */\n getIntermediateTensors(): NamedTensorsMap {\n return this.executor.getIntermediateTensors();\n }\n\n /**\n * Dispose intermediate tensors for model debugging mode (flag\n * KEEP_INTERMEDIATE_TENSORS is true).\n *\n * @doc {heading: 'Models', subheading: 'Classes'}\n */\n disposeIntermediateTensors() {\n this.executor.disposeIntermediateTensors();\n }\n\n private convertTensorMapToTensorsMap(map: NamedTensorMap): NamedTensorsMap {\n return Object.keys(map).reduce((newMap: NamedTensorsMap, key) => {\n newMap[key] = [map[key]];\n return newMap;\n }, {});\n }\n\n /**\n * Releases the memory used by the weight tensors and resourceManager.\n *\n * @doc {heading: 'Models', subheading: 'Classes'}\n */\n dispose() {\n this.executor.dispose();\n\n if (this.initializer) {\n this.initializer.dispose();\n if (this.resourceIdToCapturedInput) {\n dispose(this.resourceIdToCapturedInput);\n }\n }\n\n this.resourceManager.dispose();\n }\n}\n\n/**\n * Load a graph model given a URL to the model definition.\n *\n * Example of loading MobileNetV2 from a URL and making a prediction with a\n * zeros input:\n *\n * ```js\n * const modelUrl =\n * 'https://storage.googleapis.com/tfjs-models/savedmodel/mobilenet_v2_1.0_224/model.json';\n * const model = await tf.loadGraphModel(modelUrl);\n * const zeros = tf.zeros([1, 224, 224, 3]);\n * model.predict(zeros).print();\n * ```\n *\n * Example of loading MobileNetV2 from a TF Hub URL and making a prediction\n * with a zeros input:\n *\n * ```js\n * const modelUrl =\n * 'https://tfhub.dev/google/imagenet/mobilenet_v2_140_224/classification/2';\n * const model = await tf.loadGraphModel(modelUrl, {fromTFHub: true});\n * const zeros = tf.zeros([1, 224, 224, 3]);\n * model.predict(zeros).print();\n * ```\n * @param modelUrl The url or an `io.IOHandler` that loads the model.\n * @param options Options for the HTTP request, which allows to send\n * credentials\n * and custom headers.\n *\n * @doc {heading: 'Models', subheading: 'Loading'}\n */\nexport async function loadGraphModel(\n modelUrl: string|io.IOHandler, options: io.LoadOptions = {},\n tfio = io): Promise {\n if (modelUrl == null) {\n throw new Error(\n 'modelUrl in loadGraphModel() cannot be null. Please provide a url ' +\n 'or an IOHandler that loads the model');\n }\n if (options == null) {\n options = {};\n }\n\n if (options.fromTFHub && typeof modelUrl === 'string') {\n modelUrl = getTFHubUrl(modelUrl);\n }\n const model = new GraphModel(modelUrl, options, tfio);\n await model.load();\n return model;\n}\n\n/**\n * Load a graph model given a synchronous IO handler with a 'load' method.\n *\n * @param modelSource The `io.IOHandlerSync` that loads the model, or the\n * `io.ModelArtifacts` that encode the model, or a tuple of\n * `[io.ModelJSON, ArrayBuffer]` of which the first element encodes the\n * model and the second contains the weights.\n *\n * @doc {heading: 'Models', subheading: 'Loading'}\n */\nexport function loadGraphModelSync(modelSource: io.IOHandlerSync\n | io.ModelArtifacts | [io.ModelJSON, /* Weights */ ArrayBuffer]):\n GraphModel {\n\n if (modelSource == null) {\n throw new Error(\n 'modelUrl in loadGraphModelSync() cannot be null. Please provide ' +\n 'model artifacts or an IOHandler that loads the model');\n }\n\n let ioHandler: io.IOHandlerSync;\n if (modelSource instanceof Array) {\n const [modelJSON, weights] = modelSource;\n if (!modelJSON) {\n throw new Error('modelJSON must be the first element of the array');\n }\n if (!weights || !(weights instanceof ArrayBuffer)) {\n throw new Error('An ArrayBuffer of weights must be the second element of'\n + ' the array');\n }\n if (!('modelTopology' in modelJSON)) {\n throw new Error('Model JSON is missing \\'modelTopology\\'');\n }\n if (!('weightsManifest' in modelJSON)) {\n throw new Error('Model JSON is missing \\'weightsManifest\\'');\n }\n\n const weightSpecs = io.getWeightSpecs(modelJSON.weightsManifest);\n const modelArtifacts = io.getModelArtifactsForJSONSync(modelJSON,\n weightSpecs,\n weights);\n ioHandler = io.fromMemorySync(modelArtifacts);\n } else if ('load' in modelSource) {\n // Then modelSource is already an IOHandlerSync.\n ioHandler = modelSource;\n } else if ('modelTopology' in modelSource && 'weightSpecs' in modelSource\n && 'weightData' in modelSource) {\n // modelSource is of type ModelArtifacts.\n ioHandler = io.fromMemorySync(modelSource);\n } else {\n throw new Error('Unknown model format');\n }\n\n const model = new GraphModel(ioHandler);\n model.load();\n return model;\n}\n\nfunction getTFHubUrl(modelUrl: string): string {\n if (!modelUrl.endsWith('/')) {\n modelUrl = (modelUrl) + '/';\n }\n return `${modelUrl}${DEFAULT_MODEL_NAME}${TFHUB_SEARCH_PARAM}`;\n}\n","/** @license See the LICENSE file. */\n\n// This code is auto-generated, do not modify this file!\nconst version = '4.0.0';\nexport {version};\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport './flags';\n\nexport {IAttrValue, INameAttrList, INodeDef, ITensor, ITensorShape} from './data/compiled_api';\nexport {GraphModel, loadGraphModel, loadGraphModelSync} from './executor/graph_model';\nexport {deregisterOp, registerOp} from './operations/custom_op/register';\nexport {GraphNode, OpExecutor} from './operations/types';\nexport {version as version_converter} from './version';\n",null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"// Polyfills\n\nif ( Number.EPSILON === undefined ) {\n\n\tNumber.EPSILON = Math.pow( 2, - 52 );\n\n}\n\nif ( Number.isInteger === undefined ) {\n\n\t// Missing in IE\n\t// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger\n\n\tNumber.isInteger = function ( value ) {\n\n\t\treturn typeof value === 'number' && isFinite( value ) && Math.floor( value ) === value;\n\n\t};\n\n}\n\n//\n\nif ( Math.sign === undefined ) {\n\n\t// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign\n\n\tMath.sign = function ( x ) {\n\n\t\treturn ( x < 0 ) ? - 1 : ( x > 0 ) ? 1 : + x;\n\n\t};\n\n}\n\nif ( 'name' in Function.prototype === false ) {\n\n\t// Missing in IE\n\t// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name\n\n\tObject.defineProperty( Function.prototype, 'name', {\n\n\t\tget: function () {\n\n\t\t\treturn this.toString().match( /^\\s*function\\s*([^\\(\\s]*)/ )[ 1 ];\n\n\t\t}\n\n\t} );\n\n}\n\nif ( Object.assign === undefined ) {\n\n\t// Missing in IE\n\t// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign\n\n\tObject.assign = function ( target ) {\n\n\t\tif ( target === undefined || target === null ) {\n\n\t\t\tthrow new TypeError( 'Cannot convert undefined or null to object' );\n\n\t\t}\n\n\t\tvar output = Object( target );\n\n\t\tfor ( var index = 1; index < arguments.length; index ++ ) {\n\n\t\t\tvar source = arguments[ index ];\n\n\t\t\tif ( source !== undefined && source !== null ) {\n\n\t\t\t\tfor ( var nextKey in source ) {\n\n\t\t\t\t\tif ( Object.prototype.hasOwnProperty.call( source, nextKey ) ) {\n\n\t\t\t\t\t\toutput[ nextKey ] = source[ nextKey ];\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn output;\n\n\t};\n\n}\n\nvar REVISION = '113';\nvar MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };\nvar TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };\nvar CullFaceNone = 0;\nvar CullFaceBack = 1;\nvar CullFaceFront = 2;\nvar CullFaceFrontBack = 3;\nvar FrontFaceDirectionCW = 0;\nvar FrontFaceDirectionCCW = 1;\nvar BasicShadowMap = 0;\nvar PCFShadowMap = 1;\nvar PCFSoftShadowMap = 2;\nvar VSMShadowMap = 3;\nvar FrontSide = 0;\nvar BackSide = 1;\nvar DoubleSide = 2;\nvar FlatShading = 1;\nvar SmoothShading = 2;\nvar NoColors = 0;\nvar FaceColors = 1;\nvar VertexColors = 2;\nvar NoBlending = 0;\nvar NormalBlending = 1;\nvar AdditiveBlending = 2;\nvar SubtractiveBlending = 3;\nvar MultiplyBlending = 4;\nvar CustomBlending = 5;\nvar AddEquation = 100;\nvar SubtractEquation = 101;\nvar ReverseSubtractEquation = 102;\nvar MinEquation = 103;\nvar MaxEquation = 104;\nvar ZeroFactor = 200;\nvar OneFactor = 201;\nvar SrcColorFactor = 202;\nvar OneMinusSrcColorFactor = 203;\nvar SrcAlphaFactor = 204;\nvar OneMinusSrcAlphaFactor = 205;\nvar DstAlphaFactor = 206;\nvar OneMinusDstAlphaFactor = 207;\nvar DstColorFactor = 208;\nvar OneMinusDstColorFactor = 209;\nvar SrcAlphaSaturateFactor = 210;\nvar NeverDepth = 0;\nvar AlwaysDepth = 1;\nvar LessDepth = 2;\nvar LessEqualDepth = 3;\nvar EqualDepth = 4;\nvar GreaterEqualDepth = 5;\nvar GreaterDepth = 6;\nvar NotEqualDepth = 7;\nvar MultiplyOperation = 0;\nvar MixOperation = 1;\nvar AddOperation = 2;\nvar NoToneMapping = 0;\nvar LinearToneMapping = 1;\nvar ReinhardToneMapping = 2;\nvar Uncharted2ToneMapping = 3;\nvar CineonToneMapping = 4;\nvar ACESFilmicToneMapping = 5;\n\nvar UVMapping = 300;\nvar CubeReflectionMapping = 301;\nvar CubeRefractionMapping = 302;\nvar EquirectangularReflectionMapping = 303;\nvar EquirectangularRefractionMapping = 304;\nvar SphericalReflectionMapping = 305;\nvar CubeUVReflectionMapping = 306;\nvar CubeUVRefractionMapping = 307;\nvar RepeatWrapping = 1000;\nvar ClampToEdgeWrapping = 1001;\nvar MirroredRepeatWrapping = 1002;\nvar NearestFilter = 1003;\nvar NearestMipmapNearestFilter = 1004;\nvar NearestMipMapNearestFilter = 1004;\nvar NearestMipmapLinearFilter = 1005;\nvar NearestMipMapLinearFilter = 1005;\nvar LinearFilter = 1006;\nvar LinearMipmapNearestFilter = 1007;\nvar LinearMipMapNearestFilter = 1007;\nvar LinearMipmapLinearFilter = 1008;\nvar LinearMipMapLinearFilter = 1008;\nvar UnsignedByteType = 1009;\nvar ByteType = 1010;\nvar ShortType = 1011;\nvar UnsignedShortType = 1012;\nvar IntType = 1013;\nvar UnsignedIntType = 1014;\nvar FloatType = 1015;\nvar HalfFloatType = 1016;\nvar UnsignedShort4444Type = 1017;\nvar UnsignedShort5551Type = 1018;\nvar UnsignedShort565Type = 1019;\nvar UnsignedInt248Type = 1020;\nvar AlphaFormat = 1021;\nvar RGBFormat = 1022;\nvar RGBAFormat = 1023;\nvar LuminanceFormat = 1024;\nvar LuminanceAlphaFormat = 1025;\nvar RGBEFormat = RGBAFormat;\nvar DepthFormat = 1026;\nvar DepthStencilFormat = 1027;\nvar RedFormat = 1028;\nvar RedIntegerFormat = 1029;\nvar RGFormat = 1030;\nvar RGIntegerFormat = 1031;\nvar RGBIntegerFormat = 1032;\nvar RGBAIntegerFormat = 1033;\n\nvar RGB_S3TC_DXT1_Format = 33776;\nvar RGBA_S3TC_DXT1_Format = 33777;\nvar RGBA_S3TC_DXT3_Format = 33778;\nvar RGBA_S3TC_DXT5_Format = 33779;\nvar RGB_PVRTC_4BPPV1_Format = 35840;\nvar RGB_PVRTC_2BPPV1_Format = 35841;\nvar RGBA_PVRTC_4BPPV1_Format = 35842;\nvar RGBA_PVRTC_2BPPV1_Format = 35843;\nvar RGB_ETC1_Format = 36196;\nvar RGBA_ASTC_4x4_Format = 37808;\nvar RGBA_ASTC_5x4_Format = 37809;\nvar RGBA_ASTC_5x5_Format = 37810;\nvar RGBA_ASTC_6x5_Format = 37811;\nvar RGBA_ASTC_6x6_Format = 37812;\nvar RGBA_ASTC_8x5_Format = 37813;\nvar RGBA_ASTC_8x6_Format = 37814;\nvar RGBA_ASTC_8x8_Format = 37815;\nvar RGBA_ASTC_10x5_Format = 37816;\nvar RGBA_ASTC_10x6_Format = 37817;\nvar RGBA_ASTC_10x8_Format = 37818;\nvar RGBA_ASTC_10x10_Format = 37819;\nvar RGBA_ASTC_12x10_Format = 37820;\nvar RGBA_ASTC_12x12_Format = 37821;\nvar LoopOnce = 2200;\nvar LoopRepeat = 2201;\nvar LoopPingPong = 2202;\nvar InterpolateDiscrete = 2300;\nvar InterpolateLinear = 2301;\nvar InterpolateSmooth = 2302;\nvar ZeroCurvatureEnding = 2400;\nvar ZeroSlopeEnding = 2401;\nvar WrapAroundEnding = 2402;\nvar TrianglesDrawMode = 0;\nvar TriangleStripDrawMode = 1;\nvar TriangleFanDrawMode = 2;\nvar LinearEncoding = 3000;\nvar sRGBEncoding = 3001;\nvar GammaEncoding = 3007;\nvar RGBEEncoding = 3002;\nvar LogLuvEncoding = 3003;\nvar RGBM7Encoding = 3004;\nvar RGBM16Encoding = 3005;\nvar RGBDEncoding = 3006;\nvar BasicDepthPacking = 3200;\nvar RGBADepthPacking = 3201;\nvar TangentSpaceNormalMap = 0;\nvar ObjectSpaceNormalMap = 1;\n\nvar ZeroStencilOp = 0;\nvar KeepStencilOp = 7680;\nvar ReplaceStencilOp = 7681;\nvar IncrementStencilOp = 7682;\nvar DecrementStencilOp = 7683;\nvar IncrementWrapStencilOp = 34055;\nvar DecrementWrapStencilOp = 34056;\nvar InvertStencilOp = 5386;\n\nvar NeverStencilFunc = 512;\nvar LessStencilFunc = 513;\nvar EqualStencilFunc = 514;\nvar LessEqualStencilFunc = 515;\nvar GreaterStencilFunc = 516;\nvar NotEqualStencilFunc = 517;\nvar GreaterEqualStencilFunc = 518;\nvar AlwaysStencilFunc = 519;\n\nvar StaticDrawUsage = 35044;\nvar DynamicDrawUsage = 35048;\nvar StreamDrawUsage = 35040;\nvar StaticReadUsage = 35045;\nvar DynamicReadUsage = 35049;\nvar StreamReadUsage = 35041;\nvar StaticCopyUsage = 35046;\nvar DynamicCopyUsage = 35050;\nvar StreamCopyUsage = 35042;\n\n/**\n * https://github.com/mrdoob/eventdispatcher.js/\n */\n\nfunction EventDispatcher() {}\n\nObject.assign( EventDispatcher.prototype, {\n\n\taddEventListener: function ( type, listener ) {\n\n\t\tif ( this._listeners === undefined ) this._listeners = {};\n\n\t\tvar listeners = this._listeners;\n\n\t\tif ( listeners[ type ] === undefined ) {\n\n\t\t\tlisteners[ type ] = [];\n\n\t\t}\n\n\t\tif ( listeners[ type ].indexOf( listener ) === - 1 ) {\n\n\t\t\tlisteners[ type ].push( listener );\n\n\t\t}\n\n\t},\n\n\thasEventListener: function ( type, listener ) {\n\n\t\tif ( this._listeners === undefined ) return false;\n\n\t\tvar listeners = this._listeners;\n\n\t\treturn listeners[ type ] !== undefined && listeners[ type ].indexOf( listener ) !== - 1;\n\n\t},\n\n\tremoveEventListener: function ( type, listener ) {\n\n\t\tif ( this._listeners === undefined ) return;\n\n\t\tvar listeners = this._listeners;\n\t\tvar listenerArray = listeners[ type ];\n\n\t\tif ( listenerArray !== undefined ) {\n\n\t\t\tvar index = listenerArray.indexOf( listener );\n\n\t\t\tif ( index !== - 1 ) {\n\n\t\t\t\tlistenerArray.splice( index, 1 );\n\n\t\t\t}\n\n\t\t}\n\n\t},\n\n\tdispatchEvent: function ( event ) {\n\n\t\tif ( this._listeners === undefined ) return;\n\n\t\tvar listeners = this._listeners;\n\t\tvar listenerArray = listeners[ event.type ];\n\n\t\tif ( listenerArray !== undefined ) {\n\n\t\t\tevent.target = this;\n\n\t\t\tvar array = listenerArray.slice( 0 );\n\n\t\t\tfor ( var i = 0, l = array.length; i < l; i ++ ) {\n\n\t\t\t\tarray[ i ].call( this, event );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n} );\n\n/**\n * @author alteredq / http://alteredqualia.com/\n * @author mrdoob / http://mrdoob.com/\n * @author WestLangley / http://github.com/WestLangley\n * @author thezwap\n */\n\nvar _lut = [];\n\nfor ( var i = 0; i < 256; i ++ ) {\n\n\t_lut[ i ] = ( i < 16 ? '0' : '' ) + ( i ).toString( 16 );\n\n}\n\nvar MathUtils = {\n\n\tDEG2RAD: Math.PI / 180,\n\tRAD2DEG: 180 / Math.PI,\n\n\tgenerateUUID: function () {\n\n\t\t// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136\n\n\t\tvar d0 = Math.random() * 0xffffffff | 0;\n\t\tvar d1 = Math.random() * 0xffffffff | 0;\n\t\tvar d2 = Math.random() * 0xffffffff | 0;\n\t\tvar d3 = Math.random() * 0xffffffff | 0;\n\t\tvar uuid = _lut[ d0 & 0xff ] + _lut[ d0 >> 8 & 0xff ] + _lut[ d0 >> 16 & 0xff ] + _lut[ d0 >> 24 & 0xff ] + '-' +\n\t\t\t_lut[ d1 & 0xff ] + _lut[ d1 >> 8 & 0xff ] + '-' + _lut[ d1 >> 16 & 0x0f | 0x40 ] + _lut[ d1 >> 24 & 0xff ] + '-' +\n\t\t\t_lut[ d2 & 0x3f | 0x80 ] + _lut[ d2 >> 8 & 0xff ] + '-' + _lut[ d2 >> 16 & 0xff ] + _lut[ d2 >> 24 & 0xff ] +\n\t\t\t_lut[ d3 & 0xff ] + _lut[ d3 >> 8 & 0xff ] + _lut[ d3 >> 16 & 0xff ] + _lut[ d3 >> 24 & 0xff ];\n\n\t\t// .toUpperCase() here flattens concatenated strings to save heap memory space.\n\t\treturn uuid.toUpperCase();\n\n\t},\n\n\tclamp: function ( value, min, max ) {\n\n\t\treturn Math.max( min, Math.min( max, value ) );\n\n\t},\n\n\t// compute euclidian modulo of m % n\n\t// https://en.wikipedia.org/wiki/Modulo_operation\n\n\teuclideanModulo: function ( n, m ) {\n\n\t\treturn ( ( n % m ) + m ) % m;\n\n\t},\n\n\t// Linear mapping from range to range \n\n\tmapLinear: function ( x, a1, a2, b1, b2 ) {\n\n\t\treturn b1 + ( x - a1 ) * ( b2 - b1 ) / ( a2 - a1 );\n\n\t},\n\n\t// https://en.wikipedia.org/wiki/Linear_interpolation\n\n\tlerp: function ( x, y, t ) {\n\n\t\treturn ( 1 - t ) * x + t * y;\n\n\t},\n\n\t// http://en.wikipedia.org/wiki/Smoothstep\n\n\tsmoothstep: function ( x, min, max ) {\n\n\t\tif ( x <= min ) return 0;\n\t\tif ( x >= max ) return 1;\n\n\t\tx = ( x - min ) / ( max - min );\n\n\t\treturn x * x * ( 3 - 2 * x );\n\n\t},\n\n\tsmootherstep: function ( x, min, max ) {\n\n\t\tif ( x <= min ) return 0;\n\t\tif ( x >= max ) return 1;\n\n\t\tx = ( x - min ) / ( max - min );\n\n\t\treturn x * x * x * ( x * ( x * 6 - 15 ) + 10 );\n\n\t},\n\n\t// Random integer from interval\n\n\trandInt: function ( low, high ) {\n\n\t\treturn low + Math.floor( Math.random() * ( high - low + 1 ) );\n\n\t},\n\n\t// Random float from interval\n\n\trandFloat: function ( low, high ) {\n\n\t\treturn low + Math.random() * ( high - low );\n\n\t},\n\n\t// Random float from <-range/2, range/2> interval\n\n\trandFloatSpread: function ( range ) {\n\n\t\treturn range * ( 0.5 - Math.random() );\n\n\t},\n\n\tdegToRad: function ( degrees ) {\n\n\t\treturn degrees * MathUtils.DEG2RAD;\n\n\t},\n\n\tradToDeg: function ( radians ) {\n\n\t\treturn radians * MathUtils.RAD2DEG;\n\n\t},\n\n\tisPowerOfTwo: function ( value ) {\n\n\t\treturn ( value & ( value - 1 ) ) === 0 && value !== 0;\n\n\t},\n\n\tceilPowerOfTwo: function ( value ) {\n\n\t\treturn Math.pow( 2, Math.ceil( Math.log( value ) / Math.LN2 ) );\n\n\t},\n\n\tfloorPowerOfTwo: function ( value ) {\n\n\t\treturn Math.pow( 2, Math.floor( Math.log( value ) / Math.LN2 ) );\n\n\t},\n\n\tsetQuaternionFromProperEuler: function ( q, a, b, c, order ) {\n\n\t\t// Intrinsic Proper Euler Angles - see https://en.wikipedia.org/wiki/Euler_angles\n\n\t\t// rotations are applied to the axes in the order specified by 'order'\n\t\t// rotation by angle 'a' is applied first, then by angle 'b', then by angle 'c'\n\t\t// angles are in radians\n\n\t\tvar cos = Math.cos;\n\t\tvar sin = Math.sin;\n\n\t\tvar c2 = cos( b / 2 );\n\t\tvar s2 = sin( b / 2 );\n\n\t\tvar c13 = cos( ( a + c ) / 2 );\n\t\tvar s13 = sin( ( a + c ) / 2 );\n\n\t\tvar c1_3 = cos( ( a - c ) / 2 );\n\t\tvar s1_3 = sin( ( a - c ) / 2 );\n\n\t\tvar c3_1 = cos( ( c - a ) / 2 );\n\t\tvar s3_1 = sin( ( c - a ) / 2 );\n\n\t\tif ( order === 'XYX' ) {\n\n\t\t\tq.set( c2 * s13, s2 * c1_3, s2 * s1_3, c2 * c13 );\n\n\t\t} else if ( order === 'YZY' ) {\n\n\t\t\tq.set( s2 * s1_3, c2 * s13, s2 * c1_3, c2 * c13 );\n\n\t\t} else if ( order === 'ZXZ' ) {\n\n\t\t\tq.set( s2 * c1_3, s2 * s1_3, c2 * s13, c2 * c13 );\n\n\t\t} else if ( order === 'XZX' ) {\n\n\t\t\tq.set( c2 * s13, s2 * s3_1, s2 * c3_1, c2 * c13 );\n\n\t\t} else if ( order === 'YXY' ) {\n\n\t\t\tq.set( s2 * c3_1, c2 * s13, s2 * s3_1, c2 * c13 );\n\n\t\t} else if ( order === 'ZYZ' ) {\n\n\t\t\tq.set( s2 * s3_1, s2 * c3_1, c2 * s13, c2 * c13 );\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order.' );\n\n\t\t}\n\n\t}\n\n};\n\n/**\n * @author mrdoob / http://mrdoob.com/\n * @author philogb / http://blog.thejit.org/\n * @author egraether / http://egraether.com/\n * @author zz85 / http://www.lab4games.net/zz85/blog\n */\n\nfunction Vector2( x, y ) {\n\n\tthis.x = x || 0;\n\tthis.y = y || 0;\n\n}\n\nObject.defineProperties( Vector2.prototype, {\n\n\t\"width\": {\n\n\t\tget: function () {\n\n\t\t\treturn this.x;\n\n\t\t},\n\n\t\tset: function ( value ) {\n\n\t\t\tthis.x = value;\n\n\t\t}\n\n\t},\n\n\t\"height\": {\n\n\t\tget: function () {\n\n\t\t\treturn this.y;\n\n\t\t},\n\n\t\tset: function ( value ) {\n\n\t\t\tthis.y = value;\n\n\t\t}\n\n\t}\n\n} );\n\nObject.assign( Vector2.prototype, {\n\n\tisVector2: true,\n\n\tset: function ( x, y ) {\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t},\n\n\tsetScalar: function ( scalar ) {\n\n\t\tthis.x = scalar;\n\t\tthis.y = scalar;\n\n\t\treturn this;\n\n\t},\n\n\tsetX: function ( x ) {\n\n\t\tthis.x = x;\n\n\t\treturn this;\n\n\t},\n\n\tsetY: function ( y ) {\n\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t},\n\n\tsetComponent: function ( index, value ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: this.x = value; break;\n\t\t\tcase 1: this.y = value; break;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tgetComponent: function ( index ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: return this.x;\n\t\t\tcase 1: return this.y;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t},\n\n\tclone: function () {\n\n\t\treturn new this.constructor( this.x, this.y );\n\n\t},\n\n\tcopy: function ( v ) {\n\n\t\tthis.x = v.x;\n\t\tthis.y = v.y;\n\n\t\treturn this;\n\n\t},\n\n\tadd: function ( v, w ) {\n\n\t\tif ( w !== undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead.' );\n\t\t\treturn this.addVectors( v, w );\n\n\t\t}\n\n\t\tthis.x += v.x;\n\t\tthis.y += v.y;\n\n\t\treturn this;\n\n\t},\n\n\taddScalar: function ( s ) {\n\n\t\tthis.x += s;\n\t\tthis.y += s;\n\n\t\treturn this;\n\n\t},\n\n\taddVectors: function ( a, b ) {\n\n\t\tthis.x = a.x + b.x;\n\t\tthis.y = a.y + b.y;\n\n\t\treturn this;\n\n\t},\n\n\taddScaledVector: function ( v, s ) {\n\n\t\tthis.x += v.x * s;\n\t\tthis.y += v.y * s;\n\n\t\treturn this;\n\n\t},\n\n\tsub: function ( v, w ) {\n\n\t\tif ( w !== undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' );\n\t\t\treturn this.subVectors( v, w );\n\n\t\t}\n\n\t\tthis.x -= v.x;\n\t\tthis.y -= v.y;\n\n\t\treturn this;\n\n\t},\n\n\tsubScalar: function ( s ) {\n\n\t\tthis.x -= s;\n\t\tthis.y -= s;\n\n\t\treturn this;\n\n\t},\n\n\tsubVectors: function ( a, b ) {\n\n\t\tthis.x = a.x - b.x;\n\t\tthis.y = a.y - b.y;\n\n\t\treturn this;\n\n\t},\n\n\tmultiply: function ( v ) {\n\n\t\tthis.x *= v.x;\n\t\tthis.y *= v.y;\n\n\t\treturn this;\n\n\t},\n\n\tmultiplyScalar: function ( scalar ) {\n\n\t\tthis.x *= scalar;\n\t\tthis.y *= scalar;\n\n\t\treturn this;\n\n\t},\n\n\tdivide: function ( v ) {\n\n\t\tthis.x /= v.x;\n\t\tthis.y /= v.y;\n\n\t\treturn this;\n\n\t},\n\n\tdivideScalar: function ( scalar ) {\n\n\t\treturn this.multiplyScalar( 1 / scalar );\n\n\t},\n\n\tapplyMatrix3: function ( m ) {\n\n\t\tvar x = this.x, y = this.y;\n\t\tvar e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 3 ] * y + e[ 6 ];\n\t\tthis.y = e[ 1 ] * x + e[ 4 ] * y + e[ 7 ];\n\n\t\treturn this;\n\n\t},\n\n\tmin: function ( v ) {\n\n\t\tthis.x = Math.min( this.x, v.x );\n\t\tthis.y = Math.min( this.y, v.y );\n\n\t\treturn this;\n\n\t},\n\n\tmax: function ( v ) {\n\n\t\tthis.x = Math.max( this.x, v.x );\n\t\tthis.y = Math.max( this.y, v.y );\n\n\t\treturn this;\n\n\t},\n\n\tclamp: function ( min, max ) {\n\n\t\t// assumes min < max, componentwise\n\n\t\tthis.x = Math.max( min.x, Math.min( max.x, this.x ) );\n\t\tthis.y = Math.max( min.y, Math.min( max.y, this.y ) );\n\n\t\treturn this;\n\n\t},\n\n\tclampScalar: function ( minVal, maxVal ) {\n\n\t\tthis.x = Math.max( minVal, Math.min( maxVal, this.x ) );\n\t\tthis.y = Math.max( minVal, Math.min( maxVal, this.y ) );\n\n\t\treturn this;\n\n\t},\n\n\tclampLength: function ( min, max ) {\n\n\t\tvar length = this.length();\n\n\t\treturn this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );\n\n\t},\n\n\tfloor: function () {\n\n\t\tthis.x = Math.floor( this.x );\n\t\tthis.y = Math.floor( this.y );\n\n\t\treturn this;\n\n\t},\n\n\tceil: function () {\n\n\t\tthis.x = Math.ceil( this.x );\n\t\tthis.y = Math.ceil( this.y );\n\n\t\treturn this;\n\n\t},\n\n\tround: function () {\n\n\t\tthis.x = Math.round( this.x );\n\t\tthis.y = Math.round( this.y );\n\n\t\treturn this;\n\n\t},\n\n\troundToZero: function () {\n\n\t\tthis.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x );\n\t\tthis.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );\n\n\t\treturn this;\n\n\t},\n\n\tnegate: function () {\n\n\t\tthis.x = - this.x;\n\t\tthis.y = - this.y;\n\n\t\treturn this;\n\n\t},\n\n\tdot: function ( v ) {\n\n\t\treturn this.x * v.x + this.y * v.y;\n\n\t},\n\n\tcross: function ( v ) {\n\n\t\treturn this.x * v.y - this.y * v.x;\n\n\t},\n\n\tlengthSq: function () {\n\n\t\treturn this.x * this.x + this.y * this.y;\n\n\t},\n\n\tlength: function () {\n\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y );\n\n\t},\n\n\tmanhattanLength: function () {\n\n\t\treturn Math.abs( this.x ) + Math.abs( this.y );\n\n\t},\n\n\tnormalize: function () {\n\n\t\treturn this.divideScalar( this.length() || 1 );\n\n\t},\n\n\tangle: function () {\n\n\t\t// computes the angle in radians with respect to the positive x-axis\n\n\t\tvar angle = Math.atan2( this.y, this.x );\n\n\t\tif ( angle < 0 ) angle += 2 * Math.PI;\n\n\t\treturn angle;\n\n\t},\n\n\tdistanceTo: function ( v ) {\n\n\t\treturn Math.sqrt( this.distanceToSquared( v ) );\n\n\t},\n\n\tdistanceToSquared: function ( v ) {\n\n\t\tvar dx = this.x - v.x, dy = this.y - v.y;\n\t\treturn dx * dx + dy * dy;\n\n\t},\n\n\tmanhattanDistanceTo: function ( v ) {\n\n\t\treturn Math.abs( this.x - v.x ) + Math.abs( this.y - v.y );\n\n\t},\n\n\tsetLength: function ( length ) {\n\n\t\treturn this.normalize().multiplyScalar( length );\n\n\t},\n\n\tlerp: function ( v, alpha ) {\n\n\t\tthis.x += ( v.x - this.x ) * alpha;\n\t\tthis.y += ( v.y - this.y ) * alpha;\n\n\t\treturn this;\n\n\t},\n\n\tlerpVectors: function ( v1, v2, alpha ) {\n\n\t\treturn this.subVectors( v2, v1 ).multiplyScalar( alpha ).add( v1 );\n\n\t},\n\n\tequals: function ( v ) {\n\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) );\n\n\t},\n\n\tfromArray: function ( array, offset ) {\n\n\t\tif ( offset === undefined ) offset = 0;\n\n\t\tthis.x = array[ offset ];\n\t\tthis.y = array[ offset + 1 ];\n\n\t\treturn this;\n\n\t},\n\n\ttoArray: function ( array, offset ) {\n\n\t\tif ( array === undefined ) array = [];\n\t\tif ( offset === undefined ) offset = 0;\n\n\t\tarray[ offset ] = this.x;\n\t\tarray[ offset + 1 ] = this.y;\n\n\t\treturn array;\n\n\t},\n\n\tfromBufferAttribute: function ( attribute, index, offset ) {\n\n\t\tif ( offset !== undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Vector2: offset has been removed from .fromBufferAttribute().' );\n\n\t\t}\n\n\t\tthis.x = attribute.getX( index );\n\t\tthis.y = attribute.getY( index );\n\n\t\treturn this;\n\n\t},\n\n\trotateAround: function ( center, angle ) {\n\n\t\tvar c = Math.cos( angle ), s = Math.sin( angle );\n\n\t\tvar x = this.x - center.x;\n\t\tvar y = this.y - center.y;\n\n\t\tthis.x = x * c - y * s + center.x;\n\t\tthis.y = x * s + y * c + center.y;\n\n\t\treturn this;\n\n\t}\n\n} );\n\n/**\n * @author alteredq / http://alteredqualia.com/\n * @author WestLangley / http://github.com/WestLangley\n * @author bhouston / http://clara.io\n * @author tschw\n */\n\nfunction Matrix3() {\n\n\tthis.elements = [\n\n\t\t1, 0, 0,\n\t\t0, 1, 0,\n\t\t0, 0, 1\n\n\t];\n\n\tif ( arguments.length > 0 ) {\n\n\t\tconsole.error( 'THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.' );\n\n\t}\n\n}\n\nObject.assign( Matrix3.prototype, {\n\n\tisMatrix3: true,\n\n\tset: function ( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) {\n\n\t\tvar te = this.elements;\n\n\t\tte[ 0 ] = n11; te[ 1 ] = n21; te[ 2 ] = n31;\n\t\tte[ 3 ] = n12; te[ 4 ] = n22; te[ 5 ] = n32;\n\t\tte[ 6 ] = n13; te[ 7 ] = n23; te[ 8 ] = n33;\n\n\t\treturn this;\n\n\t},\n\n\tidentity: function () {\n\n\t\tthis.set(\n\n\t\t\t1, 0, 0,\n\t\t\t0, 1, 0,\n\t\t\t0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t},\n\n\tclone: function () {\n\n\t\treturn new this.constructor().fromArray( this.elements );\n\n\t},\n\n\tcopy: function ( m ) {\n\n\t\tvar te = this.elements;\n\t\tvar me = m.elements;\n\n\t\tte[ 0 ] = me[ 0 ]; te[ 1 ] = me[ 1 ]; te[ 2 ] = me[ 2 ];\n\t\tte[ 3 ] = me[ 3 ]; te[ 4 ] = me[ 4 ]; te[ 5 ] = me[ 5 ];\n\t\tte[ 6 ] = me[ 6 ]; te[ 7 ] = me[ 7 ]; te[ 8 ] = me[ 8 ];\n\n\t\treturn this;\n\n\t},\n\n\tsetFromMatrix4: function ( m ) {\n\n\t\tvar me = m.elements;\n\n\t\tthis.set(\n\n\t\t\tme[ 0 ], me[ 4 ], me[ 8 ],\n\t\t\tme[ 1 ], me[ 5 ], me[ 9 ],\n\t\t\tme[ 2 ], me[ 6 ], me[ 10 ]\n\n\t\t);\n\n\t\treturn this;\n\n\t},\n\n\tmultiply: function ( m ) {\n\n\t\treturn this.multiplyMatrices( this, m );\n\n\t},\n\n\tpremultiply: function ( m ) {\n\n\t\treturn this.multiplyMatrices( m, this );\n\n\t},\n\n\tmultiplyMatrices: function ( a, b ) {\n\n\t\tvar ae = a.elements;\n\t\tvar be = b.elements;\n\t\tvar te = this.elements;\n\n\t\tvar a11 = ae[ 0 ], a12 = ae[ 3 ], a13 = ae[ 6 ];\n\t\tvar a21 = ae[ 1 ], a22 = ae[ 4 ], a23 = ae[ 7 ];\n\t\tvar a31 = ae[ 2 ], a32 = ae[ 5 ], a33 = ae[ 8 ];\n\n\t\tvar b11 = be[ 0 ], b12 = be[ 3 ], b13 = be[ 6 ];\n\t\tvar b21 = be[ 1 ], b22 = be[ 4 ], b23 = be[ 7 ];\n\t\tvar b31 = be[ 2 ], b32 = be[ 5 ], b33 = be[ 8 ];\n\n\t\tte[ 0 ] = a11 * b11 + a12 * b21 + a13 * b31;\n\t\tte[ 3 ] = a11 * b12 + a12 * b22 + a13 * b32;\n\t\tte[ 6 ] = a11 * b13 + a12 * b23 + a13 * b33;\n\n\t\tte[ 1 ] = a21 * b11 + a22 * b21 + a23 * b31;\n\t\tte[ 4 ] = a21 * b12 + a22 * b22 + a23 * b32;\n\t\tte[ 7 ] = a21 * b13 + a22 * b23 + a23 * b33;\n\n\t\tte[ 2 ] = a31 * b11 + a32 * b21 + a33 * b31;\n\t\tte[ 5 ] = a31 * b12 + a32 * b22 + a33 * b32;\n\t\tte[ 8 ] = a31 * b13 + a32 * b23 + a33 * b33;\n\n\t\treturn this;\n\n\t},\n\n\tmultiplyScalar: function ( s ) {\n\n\t\tvar te = this.elements;\n\n\t\tte[ 0 ] *= s; te[ 3 ] *= s; te[ 6 ] *= s;\n\t\tte[ 1 ] *= s; te[ 4 ] *= s; te[ 7 ] *= s;\n\t\tte[ 2 ] *= s; te[ 5 ] *= s; te[ 8 ] *= s;\n\n\t\treturn this;\n\n\t},\n\n\tdeterminant: function () {\n\n\t\tvar te = this.elements;\n\n\t\tvar a = te[ 0 ], b = te[ 1 ], c = te[ 2 ],\n\t\t\td = te[ 3 ], e = te[ 4 ], f = te[ 5 ],\n\t\t\tg = te[ 6 ], h = te[ 7 ], i = te[ 8 ];\n\n\t\treturn a * e * i - a * f * h - b * d * i + b * f * g + c * d * h - c * e * g;\n\n\t},\n\n\tgetInverse: function ( matrix, throwOnDegenerate ) {\n\n\t\tif ( matrix && matrix.isMatrix4 ) {\n\n\t\t\tconsole.error( \"THREE.Matrix3: .getInverse() no longer takes a Matrix4 argument.\" );\n\n\t\t}\n\n\t\tvar me = matrix.elements,\n\t\t\tte = this.elements,\n\n\t\t\tn11 = me[ 0 ], n21 = me[ 1 ], n31 = me[ 2 ],\n\t\t\tn12 = me[ 3 ], n22 = me[ 4 ], n32 = me[ 5 ],\n\t\t\tn13 = me[ 6 ], n23 = me[ 7 ], n33 = me[ 8 ],\n\n\t\t\tt11 = n33 * n22 - n32 * n23,\n\t\t\tt12 = n32 * n13 - n33 * n12,\n\t\t\tt13 = n23 * n12 - n22 * n13,\n\n\t\t\tdet = n11 * t11 + n21 * t12 + n31 * t13;\n\n\t\tif ( det === 0 ) {\n\n\t\t\tvar msg = \"THREE.Matrix3: .getInverse() can't invert matrix, determinant is 0\";\n\n\t\t\tif ( throwOnDegenerate === true ) {\n\n\t\t\t\tthrow new Error( msg );\n\n\t\t\t} else {\n\n\t\t\t\tconsole.warn( msg );\n\n\t\t\t}\n\n\t\t\treturn this.identity();\n\n\t\t}\n\n\t\tvar detInv = 1 / det;\n\n\t\tte[ 0 ] = t11 * detInv;\n\t\tte[ 1 ] = ( n31 * n23 - n33 * n21 ) * detInv;\n\t\tte[ 2 ] = ( n32 * n21 - n31 * n22 ) * detInv;\n\n\t\tte[ 3 ] = t12 * detInv;\n\t\tte[ 4 ] = ( n33 * n11 - n31 * n13 ) * detInv;\n\t\tte[ 5 ] = ( n31 * n12 - n32 * n11 ) * detInv;\n\n\t\tte[ 6 ] = t13 * detInv;\n\t\tte[ 7 ] = ( n21 * n13 - n23 * n11 ) * detInv;\n\t\tte[ 8 ] = ( n22 * n11 - n21 * n12 ) * detInv;\n\n\t\treturn this;\n\n\t},\n\n\ttranspose: function () {\n\n\t\tvar tmp, m = this.elements;\n\n\t\ttmp = m[ 1 ]; m[ 1 ] = m[ 3 ]; m[ 3 ] = tmp;\n\t\ttmp = m[ 2 ]; m[ 2 ] = m[ 6 ]; m[ 6 ] = tmp;\n\t\ttmp = m[ 5 ]; m[ 5 ] = m[ 7 ]; m[ 7 ] = tmp;\n\n\t\treturn this;\n\n\t},\n\n\tgetNormalMatrix: function ( matrix4 ) {\n\n\t\treturn this.setFromMatrix4( matrix4 ).getInverse( this ).transpose();\n\n\t},\n\n\ttransposeIntoArray: function ( r ) {\n\n\t\tvar m = this.elements;\n\n\t\tr[ 0 ] = m[ 0 ];\n\t\tr[ 1 ] = m[ 3 ];\n\t\tr[ 2 ] = m[ 6 ];\n\t\tr[ 3 ] = m[ 1 ];\n\t\tr[ 4 ] = m[ 4 ];\n\t\tr[ 5 ] = m[ 7 ];\n\t\tr[ 6 ] = m[ 2 ];\n\t\tr[ 7 ] = m[ 5 ];\n\t\tr[ 8 ] = m[ 8 ];\n\n\t\treturn this;\n\n\t},\n\n\tsetUvTransform: function ( tx, ty, sx, sy, rotation, cx, cy ) {\n\n\t\tvar c = Math.cos( rotation );\n\t\tvar s = Math.sin( rotation );\n\n\t\tthis.set(\n\t\t\tsx * c, sx * s, - sx * ( c * cx + s * cy ) + cx + tx,\n\t\t\t- sy * s, sy * c, - sy * ( - s * cx + c * cy ) + cy + ty,\n\t\t\t0, 0, 1\n\t\t);\n\n\t},\n\n\tscale: function ( sx, sy ) {\n\n\t\tvar te = this.elements;\n\n\t\tte[ 0 ] *= sx; te[ 3 ] *= sx; te[ 6 ] *= sx;\n\t\tte[ 1 ] *= sy; te[ 4 ] *= sy; te[ 7 ] *= sy;\n\n\t\treturn this;\n\n\t},\n\n\trotate: function ( theta ) {\n\n\t\tvar c = Math.cos( theta );\n\t\tvar s = Math.sin( theta );\n\n\t\tvar te = this.elements;\n\n\t\tvar a11 = te[ 0 ], a12 = te[ 3 ], a13 = te[ 6 ];\n\t\tvar a21 = te[ 1 ], a22 = te[ 4 ], a23 = te[ 7 ];\n\n\t\tte[ 0 ] = c * a11 + s * a21;\n\t\tte[ 3 ] = c * a12 + s * a22;\n\t\tte[ 6 ] = c * a13 + s * a23;\n\n\t\tte[ 1 ] = - s * a11 + c * a21;\n\t\tte[ 4 ] = - s * a12 + c * a22;\n\t\tte[ 7 ] = - s * a13 + c * a23;\n\n\t\treturn this;\n\n\t},\n\n\ttranslate: function ( tx, ty ) {\n\n\t\tvar te = this.elements;\n\n\t\tte[ 0 ] += tx * te[ 2 ]; te[ 3 ] += tx * te[ 5 ]; te[ 6 ] += tx * te[ 8 ];\n\t\tte[ 1 ] += ty * te[ 2 ]; te[ 4 ] += ty * te[ 5 ]; te[ 7 ] += ty * te[ 8 ];\n\n\t\treturn this;\n\n\t},\n\n\tequals: function ( matrix ) {\n\n\t\tvar te = this.elements;\n\t\tvar me = matrix.elements;\n\n\t\tfor ( var i = 0; i < 9; i ++ ) {\n\n\t\t\tif ( te[ i ] !== me[ i ] ) return false;\n\n\t\t}\n\n\t\treturn true;\n\n\t},\n\n\tfromArray: function ( array, offset ) {\n\n\t\tif ( offset === undefined ) offset = 0;\n\n\t\tfor ( var i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.elements[ i ] = array[ i + offset ];\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\ttoArray: function ( array, offset ) {\n\n\t\tif ( array === undefined ) array = [];\n\t\tif ( offset === undefined ) offset = 0;\n\n\t\tvar te = this.elements;\n\n\t\tarray[ offset ] = te[ 0 ];\n\t\tarray[ offset + 1 ] = te[ 1 ];\n\t\tarray[ offset + 2 ] = te[ 2 ];\n\n\t\tarray[ offset + 3 ] = te[ 3 ];\n\t\tarray[ offset + 4 ] = te[ 4 ];\n\t\tarray[ offset + 5 ] = te[ 5 ];\n\n\t\tarray[ offset + 6 ] = te[ 6 ];\n\t\tarray[ offset + 7 ] = te[ 7 ];\n\t\tarray[ offset + 8 ] = te[ 8 ];\n\n\t\treturn array;\n\n\t}\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n * @author alteredq / http://alteredqualia.com/\n * @author szimek / https://github.com/szimek/\n */\n\nvar _canvas;\n\nvar ImageUtils = {\n\n\tgetDataURL: function ( image ) {\n\n\t\tvar canvas;\n\n\t\tif ( typeof HTMLCanvasElement == 'undefined' ) {\n\n\t\t\treturn image.src;\n\n\t\t} else if ( image instanceof HTMLCanvasElement ) {\n\n\t\t\tcanvas = image;\n\n\t\t} else {\n\n\t\t\tif ( _canvas === undefined ) _canvas = document.createElementNS( 'http://www.w3.org/1999/xhtml', 'canvas' );\n\n\t\t\t_canvas.width = image.width;\n\t\t\t_canvas.height = image.height;\n\n\t\t\tvar context = _canvas.getContext( '2d' );\n\n\t\t\tif ( image instanceof ImageData ) {\n\n\t\t\t\tcontext.putImageData( image, 0, 0 );\n\n\t\t\t} else {\n\n\t\t\t\tcontext.drawImage( image, 0, 0, image.width, image.height );\n\n\t\t\t}\n\n\t\t\tcanvas = _canvas;\n\n\t\t}\n\n\t\tif ( canvas.width > 2048 || canvas.height > 2048 ) {\n\n\t\t\treturn canvas.toDataURL( 'image/jpeg', 0.6 );\n\n\t\t} else {\n\n\t\t\treturn canvas.toDataURL( 'image/png' );\n\n\t\t}\n\n\t}\n\n};\n\n/**\n * @author mrdoob / http://mrdoob.com/\n * @author alteredq / http://alteredqualia.com/\n * @author szimek / https://github.com/szimek/\n */\n\nvar textureId = 0;\n\nfunction Texture( image, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding ) {\n\n\tObject.defineProperty( this, 'id', { value: textureId ++ } );\n\n\tthis.uuid = MathUtils.generateUUID();\n\n\tthis.name = '';\n\n\tthis.image = image !== undefined ? image : Texture.DEFAULT_IMAGE;\n\tthis.mipmaps = [];\n\n\tthis.mapping = mapping !== undefined ? mapping : Texture.DEFAULT_MAPPING;\n\n\tthis.wrapS = wrapS !== undefined ? wrapS : ClampToEdgeWrapping;\n\tthis.wrapT = wrapT !== undefined ? wrapT : ClampToEdgeWrapping;\n\n\tthis.magFilter = magFilter !== undefined ? magFilter : LinearFilter;\n\tthis.minFilter = minFilter !== undefined ? minFilter : LinearMipmapLinearFilter;\n\n\tthis.anisotropy = anisotropy !== undefined ? anisotropy : 1;\n\n\tthis.format = format !== undefined ? format : RGBAFormat;\n\tthis.internalFormat = null;\n\tthis.type = type !== undefined ? type : UnsignedByteType;\n\n\tthis.offset = new Vector2( 0, 0 );\n\tthis.repeat = new Vector2( 1, 1 );\n\tthis.center = new Vector2( 0, 0 );\n\tthis.rotation = 0;\n\n\tthis.matrixAutoUpdate = true;\n\tthis.matrix = new Matrix3();\n\n\tthis.generateMipmaps = true;\n\tthis.premultiplyAlpha = false;\n\tthis.flipY = true;\n\tthis.unpackAlignment = 4;\t// valid values: 1, 2, 4, 8 (see http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml)\n\n\t// Values of encoding !== THREE.LinearEncoding only supported on map, envMap and emissiveMap.\n\t//\n\t// Also changing the encoding after already used by a Material will not automatically make the Material\n\t// update. You need to explicitly call Material.needsUpdate to trigger it to recompile.\n\tthis.encoding = encoding !== undefined ? encoding : LinearEncoding;\n\n\tthis.version = 0;\n\tthis.onUpdate = null;\n\n}\n\nTexture.DEFAULT_IMAGE = undefined;\nTexture.DEFAULT_MAPPING = UVMapping;\n\nTexture.prototype = Object.assign( Object.create( EventDispatcher.prototype ), {\n\n\tconstructor: Texture,\n\n\tisTexture: true,\n\n\tupdateMatrix: function () {\n\n\t\tthis.matrix.setUvTransform( this.offset.x, this.offset.y, this.repeat.x, this.repeat.y, this.rotation, this.center.x, this.center.y );\n\n\t},\n\n\tclone: function () {\n\n\t\treturn new this.constructor().copy( this );\n\n\t},\n\n\tcopy: function ( source ) {\n\n\t\tthis.name = source.name;\n\n\t\tthis.image = source.image;\n\t\tthis.mipmaps = source.mipmaps.slice( 0 );\n\n\t\tthis.mapping = source.mapping;\n\n\t\tthis.wrapS = source.wrapS;\n\t\tthis.wrapT = source.wrapT;\n\n\t\tthis.magFilter = source.magFilter;\n\t\tthis.minFilter = source.minFilter;\n\n\t\tthis.anisotropy = source.anisotropy;\n\n\t\tthis.format = source.format;\n\t\tthis.internalFormat = source.internalFormat;\n\t\tthis.type = source.type;\n\n\t\tthis.offset.copy( source.offset );\n\t\tthis.repeat.copy( source.repeat );\n\t\tthis.center.copy( source.center );\n\t\tthis.rotation = source.rotation;\n\n\t\tthis.matrixAutoUpdate = source.matrixAutoUpdate;\n\t\tthis.matrix.copy( source.matrix );\n\n\t\tthis.generateMipmaps = source.generateMipmaps;\n\t\tthis.premultiplyAlpha = source.premultiplyAlpha;\n\t\tthis.flipY = source.flipY;\n\t\tthis.unpackAlignment = source.unpackAlignment;\n\t\tthis.encoding = source.encoding;\n\n\t\treturn this;\n\n\t},\n\n\ttoJSON: function ( meta ) {\n\n\t\tvar isRootObject = ( meta === undefined || typeof meta === 'string' );\n\n\t\tif ( ! isRootObject && meta.textures[ this.uuid ] !== undefined ) {\n\n\t\t\treturn meta.textures[ this.uuid ];\n\n\t\t}\n\n\t\tvar output = {\n\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.5,\n\t\t\t\ttype: 'Texture',\n\t\t\t\tgenerator: 'Texture.toJSON'\n\t\t\t},\n\n\t\t\tuuid: this.uuid,\n\t\t\tname: this.name,\n\n\t\t\tmapping: this.mapping,\n\n\t\t\trepeat: [ this.repeat.x, this.repeat.y ],\n\t\t\toffset: [ this.offset.x, this.offset.y ],\n\t\t\tcenter: [ this.center.x, this.center.y ],\n\t\t\trotation: this.rotation,\n\n\t\t\twrap: [ this.wrapS, this.wrapT ],\n\n\t\t\tformat: this.format,\n\t\t\ttype: this.type,\n\t\t\tencoding: this.encoding,\n\n\t\t\tminFilter: this.minFilter,\n\t\t\tmagFilter: this.magFilter,\n\t\t\tanisotropy: this.anisotropy,\n\n\t\t\tflipY: this.flipY,\n\n\t\t\tpremultiplyAlpha: this.premultiplyAlpha,\n\t\t\tunpackAlignment: this.unpackAlignment\n\n\t\t};\n\n\t\tif ( this.image !== undefined ) {\n\n\t\t\t// TODO: Move to THREE.Image\n\n\t\t\tvar image = this.image;\n\n\t\t\tif ( image.uuid === undefined ) {\n\n\t\t\t\timage.uuid = MathUtils.generateUUID(); // UGH\n\n\t\t\t}\n\n\t\t\tif ( ! isRootObject && meta.images[ image.uuid ] === undefined ) {\n\n\t\t\t\tvar url;\n\n\t\t\t\tif ( Array.isArray( image ) ) {\n\n\t\t\t\t\t// process array of images e.g. CubeTexture\n\n\t\t\t\t\turl = [];\n\n\t\t\t\t\tfor ( var i = 0, l = image.length; i < l; i ++ ) {\n\n\t\t\t\t\t\turl.push( ImageUtils.getDataURL( image[ i ] ) );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// process single image\n\n\t\t\t\t\turl = ImageUtils.getDataURL( image );\n\n\t\t\t\t}\n\n\t\t\t\tmeta.images[ image.uuid ] = {\n\t\t\t\t\tuuid: image.uuid,\n\t\t\t\t\turl: url\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t\toutput.image = image.uuid;\n\n\t\t}\n\n\t\tif ( ! isRootObject ) {\n\n\t\t\tmeta.textures[ this.uuid ] = output;\n\n\t\t}\n\n\t\treturn output;\n\n\t},\n\n\tdispose: function () {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t},\n\n\ttransformUv: function ( uv ) {\n\n\t\tif ( this.mapping !== UVMapping ) return uv;\n\n\t\tuv.applyMatrix3( this.matrix );\n\n\t\tif ( uv.x < 0 || uv.x > 1 ) {\n\n\t\t\tswitch ( this.wrapS ) {\n\n\t\t\t\tcase RepeatWrapping:\n\n\t\t\t\t\tuv.x = uv.x - Math.floor( uv.x );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ClampToEdgeWrapping:\n\n\t\t\t\t\tuv.x = uv.x < 0 ? 0 : 1;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase MirroredRepeatWrapping:\n\n\t\t\t\t\tif ( Math.abs( Math.floor( uv.x ) % 2 ) === 1 ) {\n\n\t\t\t\t\t\tuv.x = Math.ceil( uv.x ) - uv.x;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tuv.x = uv.x - Math.floor( uv.x );\n\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( uv.y < 0 || uv.y > 1 ) {\n\n\t\t\tswitch ( this.wrapT ) {\n\n\t\t\t\tcase RepeatWrapping:\n\n\t\t\t\t\tuv.y = uv.y - Math.floor( uv.y );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ClampToEdgeWrapping:\n\n\t\t\t\t\tuv.y = uv.y < 0 ? 0 : 1;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase MirroredRepeatWrapping:\n\n\t\t\t\t\tif ( Math.abs( Math.floor( uv.y ) % 2 ) === 1 ) {\n\n\t\t\t\t\t\tuv.y = Math.ceil( uv.y ) - uv.y;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tuv.y = uv.y - Math.floor( uv.y );\n\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.flipY ) {\n\n\t\t\tuv.y = 1 - uv.y;\n\n\t\t}\n\n\t\treturn uv;\n\n\t}\n\n} );\n\nObject.defineProperty( Texture.prototype, \"needsUpdate\", {\n\n\tset: function ( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n} );\n\n/**\n * @author supereggbert / http://www.paulbrunt.co.uk/\n * @author philogb / http://blog.thejit.org/\n * @author mikael emtinger / http://gomo.se/\n * @author egraether / http://egraether.com/\n * @author WestLangley / http://github.com/WestLangley\n */\n\nfunction Vector4( x, y, z, w ) {\n\n\tthis.x = x || 0;\n\tthis.y = y || 0;\n\tthis.z = z || 0;\n\tthis.w = ( w !== undefined ) ? w : 1;\n\n}\n\nObject.defineProperties( Vector4.prototype, {\n\n\t\"width\": {\n\n\t\tget: function () {\n\n\t\t\treturn this.z;\n\n\t\t},\n\n\t\tset: function ( value ) {\n\n\t\t\tthis.z = value;\n\n\t\t}\n\n\t},\n\n\t\"height\": {\n\n\t\tget: function () {\n\n\t\t\treturn this.w;\n\n\t\t},\n\n\t\tset: function ( value ) {\n\n\t\t\tthis.w = value;\n\n\t\t}\n\n\t}\n\n} );\n\nObject.assign( Vector4.prototype, {\n\n\tisVector4: true,\n\n\tset: function ( x, y, z, w ) {\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.z = z;\n\t\tthis.w = w;\n\n\t\treturn this;\n\n\t},\n\n\tsetScalar: function ( scalar ) {\n\n\t\tthis.x = scalar;\n\t\tthis.y = scalar;\n\t\tthis.z = scalar;\n\t\tthis.w = scalar;\n\n\t\treturn this;\n\n\t},\n\n\tsetX: function ( x ) {\n\n\t\tthis.x = x;\n\n\t\treturn this;\n\n\t},\n\n\tsetY: function ( y ) {\n\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t},\n\n\tsetZ: function ( z ) {\n\n\t\tthis.z = z;\n\n\t\treturn this;\n\n\t},\n\n\tsetW: function ( w ) {\n\n\t\tthis.w = w;\n\n\t\treturn this;\n\n\t},\n\n\tsetComponent: function ( index, value ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: this.x = value; break;\n\t\t\tcase 1: this.y = value; break;\n\t\t\tcase 2: this.z = value; break;\n\t\t\tcase 3: this.w = value; break;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tgetComponent: function ( index ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: return this.x;\n\t\t\tcase 1: return this.y;\n\t\t\tcase 2: return this.z;\n\t\t\tcase 3: return this.w;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t},\n\n\tclone: function () {\n\n\t\treturn new this.constructor( this.x, this.y, this.z, this.w );\n\n\t},\n\n\tcopy: function ( v ) {\n\n\t\tthis.x = v.x;\n\t\tthis.y = v.y;\n\t\tthis.z = v.z;\n\t\tthis.w = ( v.w !== undefined ) ? v.w : 1;\n\n\t\treturn this;\n\n\t},\n\n\tadd: function ( v, w ) {\n\n\t\tif ( w !== undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead.' );\n\t\t\treturn this.addVectors( v, w );\n\n\t\t}\n\n\t\tthis.x += v.x;\n\t\tthis.y += v.y;\n\t\tthis.z += v.z;\n\t\tthis.w += v.w;\n\n\t\treturn this;\n\n\t},\n\n\taddScalar: function ( s ) {\n\n\t\tthis.x += s;\n\t\tthis.y += s;\n\t\tthis.z += s;\n\t\tthis.w += s;\n\n\t\treturn this;\n\n\t},\n\n\taddVectors: function ( a, b ) {\n\n\t\tthis.x = a.x + b.x;\n\t\tthis.y = a.y + b.y;\n\t\tthis.z = a.z + b.z;\n\t\tthis.w = a.w + b.w;\n\n\t\treturn this;\n\n\t},\n\n\taddScaledVector: function ( v, s ) {\n\n\t\tthis.x += v.x * s;\n\t\tthis.y += v.y * s;\n\t\tthis.z += v.z * s;\n\t\tthis.w += v.w * s;\n\n\t\treturn this;\n\n\t},\n\n\tsub: function ( v, w ) {\n\n\t\tif ( w !== undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' );\n\t\t\treturn this.subVectors( v, w );\n\n\t\t}\n\n\t\tthis.x -= v.x;\n\t\tthis.y -= v.y;\n\t\tthis.z -= v.z;\n\t\tthis.w -= v.w;\n\n\t\treturn this;\n\n\t},\n\n\tsubScalar: function ( s ) {\n\n\t\tthis.x -= s;\n\t\tthis.y -= s;\n\t\tthis.z -= s;\n\t\tthis.w -= s;\n\n\t\treturn this;\n\n\t},\n\n\tsubVectors: function ( a, b ) {\n\n\t\tthis.x = a.x - b.x;\n\t\tthis.y = a.y - b.y;\n\t\tthis.z = a.z - b.z;\n\t\tthis.w = a.w - b.w;\n\n\t\treturn this;\n\n\t},\n\n\tmultiplyScalar: function ( scalar ) {\n\n\t\tthis.x *= scalar;\n\t\tthis.y *= scalar;\n\t\tthis.z *= scalar;\n\t\tthis.w *= scalar;\n\n\t\treturn this;\n\n\t},\n\n\tapplyMatrix4: function ( m ) {\n\n\t\tvar x = this.x, y = this.y, z = this.z, w = this.w;\n\t\tvar e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] * w;\n\t\tthis.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] * w;\n\t\tthis.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] * w;\n\t\tthis.w = e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] * w;\n\n\t\treturn this;\n\n\t},\n\n\tdivideScalar: function ( scalar ) {\n\n\t\treturn this.multiplyScalar( 1 / scalar );\n\n\t},\n\n\tsetAxisAngleFromQuaternion: function ( q ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm\n\n\t\t// q is assumed to be normalized\n\n\t\tthis.w = 2 * Math.acos( q.w );\n\n\t\tvar s = Math.sqrt( 1 - q.w * q.w );\n\n\t\tif ( s < 0.0001 ) {\n\n\t\t\tthis.x = 1;\n\t\t\tthis.y = 0;\n\t\t\tthis.z = 0;\n\n\t\t} else {\n\n\t\t\tthis.x = q.x / s;\n\t\t\tthis.y = q.y / s;\n\t\t\tthis.z = q.z / s;\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tsetAxisAngleFromRotationMatrix: function ( m ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tvar angle, x, y, z,\t\t// variables for result\n\t\t\tepsilon = 0.01,\t\t// margin to allow for rounding errors\n\t\t\tepsilon2 = 0.1,\t\t// margin to distinguish between 0 and 180 degrees\n\n\t\t\tte = m.elements,\n\n\t\t\tm11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ],\n\t\t\tm21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ],\n\t\t\tm31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ];\n\n\t\tif ( ( Math.abs( m12 - m21 ) < epsilon ) &&\n\t\t ( Math.abs( m13 - m31 ) < epsilon ) &&\n\t\t ( Math.abs( m23 - m32 ) < epsilon ) ) {\n\n\t\t\t// singularity found\n\t\t\t// first check for identity matrix which must have +1 for all terms\n\t\t\t// in leading diagonal and zero in other terms\n\n\t\t\tif ( ( Math.abs( m12 + m21 ) < epsilon2 ) &&\n\t\t\t ( Math.abs( m13 + m31 ) < epsilon2 ) &&\n\t\t\t ( Math.abs( m23 + m32 ) < epsilon2 ) &&\n\t\t\t ( Math.abs( m11 + m22 + m33 - 3 ) < epsilon2 ) ) {\n\n\t\t\t\t// this singularity is identity matrix so angle = 0\n\n\t\t\t\tthis.set( 1, 0, 0, 0 );\n\n\t\t\t\treturn this; // zero angle, arbitrary axis\n\n\t\t\t}\n\n\t\t\t// otherwise this singularity is angle = 180\n\n\t\t\tangle = Math.PI;\n\n\t\t\tvar xx = ( m11 + 1 ) / 2;\n\t\t\tvar yy = ( m22 + 1 ) / 2;\n\t\t\tvar zz = ( m33 + 1 ) / 2;\n\t\t\tvar xy = ( m12 + m21 ) / 4;\n\t\t\tvar xz = ( m13 + m31 ) / 4;\n\t\t\tvar yz = ( m23 + m32 ) / 4;\n\n\t\t\tif ( ( xx > yy ) && ( xx > zz ) ) {\n\n\t\t\t\t// m11 is the largest diagonal term\n\n\t\t\t\tif ( xx < epsilon ) {\n\n\t\t\t\t\tx = 0;\n\t\t\t\t\ty = 0.707106781;\n\t\t\t\t\tz = 0.707106781;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tx = Math.sqrt( xx );\n\t\t\t\t\ty = xy / x;\n\t\t\t\t\tz = xz / x;\n\n\t\t\t\t}\n\n\t\t\t} else if ( yy > zz ) {\n\n\t\t\t\t// m22 is the largest diagonal term\n\n\t\t\t\tif ( yy < epsilon ) {\n\n\t\t\t\t\tx = 0.707106781;\n\t\t\t\t\ty = 0;\n\t\t\t\t\tz = 0.707106781;\n\n\t\t\t\t} else {\n\n\t\t\t\t\ty = Math.sqrt( yy );\n\t\t\t\t\tx = xy / y;\n\t\t\t\t\tz = yz / y;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// m33 is the largest diagonal term so base result on this\n\n\t\t\t\tif ( zz < epsilon ) {\n\n\t\t\t\t\tx = 0.707106781;\n\t\t\t\t\ty = 0.707106781;\n\t\t\t\t\tz = 0;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tz = Math.sqrt( zz );\n\t\t\t\t\tx = xz / z;\n\t\t\t\t\ty = yz / z;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.set( x, y, z, angle );\n\n\t\t\treturn this; // return 180 deg rotation\n\n\t\t}\n\n\t\t// as we have reached here there are no singularities so we can handle normally\n\n\t\tvar s = Math.sqrt( ( m32 - m23 ) * ( m32 - m23 ) +\n\t\t ( m13 - m31 ) * ( m13 - m31 ) +\n\t\t ( m21 - m12 ) * ( m21 - m12 ) ); // used to normalize\n\n\t\tif ( Math.abs( s ) < 0.001 ) s = 1;\n\n\t\t// prevent divide by zero, should not happen if matrix is orthogonal and should be\n\t\t// caught by singularity test above, but I've left it in just in case\n\n\t\tthis.x = ( m32 - m23 ) / s;\n\t\tthis.y = ( m13 - m31 ) / s;\n\t\tthis.z = ( m21 - m12 ) / s;\n\t\tthis.w = Math.acos( ( m11 + m22 + m33 - 1 ) / 2 );\n\n\t\treturn this;\n\n\t},\n\n\tmin: function ( v ) {\n\n\t\tthis.x = Math.min( this.x, v.x );\n\t\tthis.y = Math.min( this.y, v.y );\n\t\tthis.z = Math.min( this.z, v.z );\n\t\tthis.w = Math.min( this.w, v.w );\n\n\t\treturn this;\n\n\t},\n\n\tmax: function ( v ) {\n\n\t\tthis.x = Math.max( this.x, v.x );\n\t\tthis.y = Math.max( this.y, v.y );\n\t\tthis.z = Math.max( this.z, v.z );\n\t\tthis.w = Math.max( this.w, v.w );\n\n\t\treturn this;\n\n\t},\n\n\tclamp: function ( min, max ) {\n\n\t\t// assumes min < max, componentwise\n\n\t\tthis.x = Math.max( min.x, Math.min( max.x, this.x ) );\n\t\tthis.y = Math.max( min.y, Math.min( max.y, this.y ) );\n\t\tthis.z = Math.max( min.z, Math.min( max.z, this.z ) );\n\t\tthis.w = Math.max( min.w, Math.min( max.w, this.w ) );\n\n\t\treturn this;\n\n\t},\n\n\tclampScalar: function ( minVal, maxVal ) {\n\n\t\tthis.x = Math.max( minVal, Math.min( maxVal, this.x ) );\n\t\tthis.y = Math.max( minVal, Math.min( maxVal, this.y ) );\n\t\tthis.z = Math.max( minVal, Math.min( maxVal, this.z ) );\n\t\tthis.w = Math.max( minVal, Math.min( maxVal, this.w ) );\n\n\t\treturn this;\n\n\t},\n\n\tclampLength: function ( min, max ) {\n\n\t\tvar length = this.length();\n\n\t\treturn this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );\n\n\t},\n\n\tfloor: function () {\n\n\t\tthis.x = Math.floor( this.x );\n\t\tthis.y = Math.floor( this.y );\n\t\tthis.z = Math.floor( this.z );\n\t\tthis.w = Math.floor( this.w );\n\n\t\treturn this;\n\n\t},\n\n\tceil: function () {\n\n\t\tthis.x = Math.ceil( this.x );\n\t\tthis.y = Math.ceil( this.y );\n\t\tthis.z = Math.ceil( this.z );\n\t\tthis.w = Math.ceil( this.w );\n\n\t\treturn this;\n\n\t},\n\n\tround: function () {\n\n\t\tthis.x = Math.round( this.x );\n\t\tthis.y = Math.round( this.y );\n\t\tthis.z = Math.round( this.z );\n\t\tthis.w = Math.round( this.w );\n\n\t\treturn this;\n\n\t},\n\n\troundToZero: function () {\n\n\t\tthis.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x );\n\t\tthis.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );\n\t\tthis.z = ( this.z < 0 ) ? Math.ceil( this.z ) : Math.floor( this.z );\n\t\tthis.w = ( this.w < 0 ) ? Math.ceil( this.w ) : Math.floor( this.w );\n\n\t\treturn this;\n\n\t},\n\n\tnegate: function () {\n\n\t\tthis.x = - this.x;\n\t\tthis.y = - this.y;\n\t\tthis.z = - this.z;\n\t\tthis.w = - this.w;\n\n\t\treturn this;\n\n\t},\n\n\tdot: function ( v ) {\n\n\t\treturn this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w;\n\n\t},\n\n\tlengthSq: function () {\n\n\t\treturn this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w;\n\n\t},\n\n\tlength: function () {\n\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w );\n\n\t},\n\n\tmanhattanLength: function () {\n\n\t\treturn Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z ) + Math.abs( this.w );\n\n\t},\n\n\tnormalize: function () {\n\n\t\treturn this.divideScalar( this.length() || 1 );\n\n\t},\n\n\tsetLength: function ( length ) {\n\n\t\treturn this.normalize().multiplyScalar( length );\n\n\t},\n\n\tlerp: function ( v, alpha ) {\n\n\t\tthis.x += ( v.x - this.x ) * alpha;\n\t\tthis.y += ( v.y - this.y ) * alpha;\n\t\tthis.z += ( v.z - this.z ) * alpha;\n\t\tthis.w += ( v.w - this.w ) * alpha;\n\n\t\treturn this;\n\n\t},\n\n\tlerpVectors: function ( v1, v2, alpha ) {\n\n\t\treturn this.subVectors( v2, v1 ).multiplyScalar( alpha ).add( v1 );\n\n\t},\n\n\tequals: function ( v ) {\n\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) && ( v.w === this.w ) );\n\n\t},\n\n\tfromArray: function ( array, offset ) {\n\n\t\tif ( offset === undefined ) offset = 0;\n\n\t\tthis.x = array[ offset ];\n\t\tthis.y = array[ offset + 1 ];\n\t\tthis.z = array[ offset + 2 ];\n\t\tthis.w = array[ offset + 3 ];\n\n\t\treturn this;\n\n\t},\n\n\ttoArray: function ( array, offset ) {\n\n\t\tif ( array === undefined ) array = [];\n\t\tif ( offset === undefined ) offset = 0;\n\n\t\tarray[ offset ] = this.x;\n\t\tarray[ offset + 1 ] = this.y;\n\t\tarray[ offset + 2 ] = this.z;\n\t\tarray[ offset + 3 ] = this.w;\n\n\t\treturn array;\n\n\t},\n\n\tfromBufferAttribute: function ( attribute, index, offset ) {\n\n\t\tif ( offset !== undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Vector4: offset has been removed from .fromBufferAttribute().' );\n\n\t\t}\n\n\t\tthis.x = attribute.getX( index );\n\t\tthis.y = attribute.getY( index );\n\t\tthis.z = attribute.getZ( index );\n\t\tthis.w = attribute.getW( index );\n\n\t\treturn this;\n\n\t}\n\n} );\n\n/**\n * @author szimek / https://github.com/szimek/\n * @author alteredq / http://alteredqualia.com/\n * @author Marius Kintel / https://github.com/kintel\n */\n\n/*\n In options, we can specify:\n * Texture parameters for an auto-generated target texture\n * depthBuffer/stencilBuffer: Booleans to indicate if we should generate these buffers\n*/\nfunction WebGLRenderTarget( width, height, options ) {\n\n\tthis.width = width;\n\tthis.height = height;\n\n\tthis.scissor = new Vector4( 0, 0, width, height );\n\tthis.scissorTest = false;\n\n\tthis.viewport = new Vector4( 0, 0, width, height );\n\n\toptions = options || {};\n\n\tthis.texture = new Texture( undefined, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding );\n\n\tthis.texture.image = {};\n\tthis.texture.image.width = width;\n\tthis.texture.image.height = height;\n\n\tthis.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;\n\tthis.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter;\n\n\tthis.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true;\n\tthis.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : true;\n\tthis.depthTexture = options.depthTexture !== undefined ? options.depthTexture : null;\n\n}\n\nWebGLRenderTarget.prototype = Object.assign( Object.create( EventDispatcher.prototype ), {\n\n\tconstructor: WebGLRenderTarget,\n\n\tisWebGLRenderTarget: true,\n\n\tsetSize: function ( width, height ) {\n\n\t\tif ( this.width !== width || this.height !== height ) {\n\n\t\t\tthis.width = width;\n\t\t\tthis.height = height;\n\n\t\t\tthis.texture.image.width = width;\n\t\t\tthis.texture.image.height = height;\n\n\t\t\tthis.dispose();\n\n\t\t}\n\n\t\tthis.viewport.set( 0, 0, width, height );\n\t\tthis.scissor.set( 0, 0, width, height );\n\n\t},\n\n\tclone: function () {\n\n\t\treturn new this.constructor().copy( this );\n\n\t},\n\n\tcopy: function ( source ) {\n\n\t\tthis.width = source.width;\n\t\tthis.height = source.height;\n\n\t\tthis.viewport.copy( source.viewport );\n\n\t\tthis.texture = source.texture.clone();\n\n\t\tthis.depthBuffer = source.depthBuffer;\n\t\tthis.stencilBuffer = source.stencilBuffer;\n\t\tthis.depthTexture = source.depthTexture;\n\n\t\treturn this;\n\n\t},\n\n\tdispose: function () {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n} );\n\n/**\n * @author Mugen87 / https://github.com/Mugen87\n * @author Matt DesLauriers / @mattdesl\n */\n\nfunction WebGLMultisampleRenderTarget( width, height, options ) {\n\n\tWebGLRenderTarget.call( this, width, height, options );\n\n\tthis.samples = 4;\n\n}\n\nWebGLMultisampleRenderTarget.prototype = Object.assign( Object.create( WebGLRenderTarget.prototype ), {\n\n\tconstructor: WebGLMultisampleRenderTarget,\n\n\tisWebGLMultisampleRenderTarget: true,\n\n\tcopy: function ( source ) {\n\n\t\tWebGLRenderTarget.prototype.copy.call( this, source );\n\n\t\tthis.samples = source.samples;\n\n\t\treturn this;\n\n\t}\n\n} );\n\n/**\n * @author mikael emtinger / http://gomo.se/\n * @author alteredq / http://alteredqualia.com/\n * @author WestLangley / http://github.com/WestLangley\n * @author bhouston / http://clara.io\n */\n\nfunction Quaternion( x, y, z, w ) {\n\n\tthis._x = x || 0;\n\tthis._y = y || 0;\n\tthis._z = z || 0;\n\tthis._w = ( w !== undefined ) ? w : 1;\n\n}\n\nObject.assign( Quaternion, {\n\n\tslerp: function ( qa, qb, qm, t ) {\n\n\t\treturn qm.copy( qa ).slerp( qb, t );\n\n\t},\n\n\tslerpFlat: function ( dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t ) {\n\n\t\t// fuzz-free, array-based Quaternion SLERP operation\n\n\t\tvar x0 = src0[ srcOffset0 + 0 ],\n\t\t\ty0 = src0[ srcOffset0 + 1 ],\n\t\t\tz0 = src0[ srcOffset0 + 2 ],\n\t\t\tw0 = src0[ srcOffset0 + 3 ],\n\n\t\t\tx1 = src1[ srcOffset1 + 0 ],\n\t\t\ty1 = src1[ srcOffset1 + 1 ],\n\t\t\tz1 = src1[ srcOffset1 + 2 ],\n\t\t\tw1 = src1[ srcOffset1 + 3 ];\n\n\t\tif ( w0 !== w1 || x0 !== x1 || y0 !== y1 || z0 !== z1 ) {\n\n\t\t\tvar s = 1 - t,\n\n\t\t\t\tcos = x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1,\n\n\t\t\t\tdir = ( cos >= 0 ? 1 : - 1 ),\n\t\t\t\tsqrSin = 1 - cos * cos;\n\n\t\t\t// Skip the Slerp for tiny steps to avoid numeric problems:\n\t\t\tif ( sqrSin > Number.EPSILON ) {\n\n\t\t\t\tvar sin = Math.sqrt( sqrSin ),\n\t\t\t\t\tlen = Math.atan2( sin, cos * dir );\n\n\t\t\t\ts = Math.sin( s * len ) / sin;\n\t\t\t\tt = Math.sin( t * len ) / sin;\n\n\t\t\t}\n\n\t\t\tvar tDir = t * dir;\n\n\t\t\tx0 = x0 * s + x1 * tDir;\n\t\t\ty0 = y0 * s + y1 * tDir;\n\t\t\tz0 = z0 * s + z1 * tDir;\n\t\t\tw0 = w0 * s + w1 * tDir;\n\n\t\t\t// Normalize in case we just did a lerp:\n\t\t\tif ( s === 1 - t ) {\n\n\t\t\t\tvar f = 1 / Math.sqrt( x0 * x0 + y0 * y0 + z0 * z0 + w0 * w0 );\n\n\t\t\t\tx0 *= f;\n\t\t\t\ty0 *= f;\n\t\t\t\tz0 *= f;\n\t\t\t\tw0 *= f;\n\n\t\t\t}\n\n\t\t}\n\n\t\tdst[ dstOffset ] = x0;\n\t\tdst[ dstOffset + 1 ] = y0;\n\t\tdst[ dstOffset + 2 ] = z0;\n\t\tdst[ dstOffset + 3 ] = w0;\n\n\t}\n\n} );\n\nObject.defineProperties( Quaternion.prototype, {\n\n\tx: {\n\n\t\tget: function () {\n\n\t\t\treturn this._x;\n\n\t\t},\n\n\t\tset: function ( value ) {\n\n\t\t\tthis._x = value;\n\t\t\tthis._onChangeCallback();\n\n\t\t}\n\n\t},\n\n\ty: {\n\n\t\tget: function () {\n\n\t\t\treturn this._y;\n\n\t\t},\n\n\t\tset: function ( value ) {\n\n\t\t\tthis._y = value;\n\t\t\tthis._onChangeCallback();\n\n\t\t}\n\n\t},\n\n\tz: {\n\n\t\tget: function () {\n\n\t\t\treturn this._z;\n\n\t\t},\n\n\t\tset: function ( value ) {\n\n\t\t\tthis._z = value;\n\t\t\tthis._onChangeCallback();\n\n\t\t}\n\n\t},\n\n\tw: {\n\n\t\tget: function () {\n\n\t\t\treturn this._w;\n\n\t\t},\n\n\t\tset: function ( value ) {\n\n\t\t\tthis._w = value;\n\t\t\tthis._onChangeCallback();\n\n\t\t}\n\n\t}\n\n} );\n\nObject.assign( Quaternion.prototype, {\n\n\tisQuaternion: true,\n\n\tset: function ( x, y, z, w ) {\n\n\t\tthis._x = x;\n\t\tthis._y = y;\n\t\tthis._z = z;\n\t\tthis._w = w;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t},\n\n\tclone: function () {\n\n\t\treturn new this.constructor( this._x, this._y, this._z, this._w );\n\n\t},\n\n\tcopy: function ( quaternion ) {\n\n\t\tthis._x = quaternion.x;\n\t\tthis._y = quaternion.y;\n\t\tthis._z = quaternion.z;\n\t\tthis._w = quaternion.w;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t},\n\n\tsetFromEuler: function ( euler, update ) {\n\n\t\tif ( ! ( euler && euler.isEuler ) ) {\n\n\t\t\tthrow new Error( 'THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.' );\n\n\t\t}\n\n\t\tvar x = euler._x, y = euler._y, z = euler._z, order = euler.order;\n\n\t\t// http://www.mathworks.com/matlabcentral/fileexchange/\n\t\t// \t20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/\n\t\t//\tcontent/SpinCalc.m\n\n\t\tvar cos = Math.cos;\n\t\tvar sin = Math.sin;\n\n\t\tvar c1 = cos( x / 2 );\n\t\tvar c2 = cos( y / 2 );\n\t\tvar c3 = cos( z / 2 );\n\n\t\tvar s1 = sin( x / 2 );\n\t\tvar s2 = sin( y / 2 );\n\t\tvar s3 = sin( z / 2 );\n\n\t\tif ( order === 'XYZ' ) {\n\n\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\n\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\n\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\n\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\n\n\t\t} else if ( order === 'YXZ' ) {\n\n\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\n\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\n\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\n\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\n\n\t\t} else if ( order === 'ZXY' ) {\n\n\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\n\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\n\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\n\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\n\n\t\t} else if ( order === 'ZYX' ) {\n\n\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\n\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\n\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\n\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\n\n\t\t} else if ( order === 'YZX' ) {\n\n\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\n\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\n\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\n\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\n\n\t\t} else if ( order === 'XZY' ) {\n\n\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\n\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\n\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\n\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\n\n\t\t}\n\n\t\tif ( update !== false ) this._onChangeCallback();\n\n\t\treturn this;\n\n\t},\n\n\tsetFromAxisAngle: function ( axis, angle ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm\n\n\t\t// assumes axis is normalized\n\n\t\tvar halfAngle = angle / 2, s = Math.sin( halfAngle );\n\n\t\tthis._x = axis.x * s;\n\t\tthis._y = axis.y * s;\n\t\tthis._z = axis.z * s;\n\t\tthis._w = Math.cos( halfAngle );\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t},\n\n\tsetFromRotationMatrix: function ( m ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tvar te = m.elements,\n\n\t\t\tm11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ],\n\t\t\tm21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ],\n\t\t\tm31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ],\n\n\t\t\ttrace = m11 + m22 + m33,\n\t\t\ts;\n\n\t\tif ( trace > 0 ) {\n\n\t\t\ts = 0.5 / Math.sqrt( trace + 1.0 );\n\n\t\t\tthis._w = 0.25 / s;\n\t\t\tthis._x = ( m32 - m23 ) * s;\n\t\t\tthis._y = ( m13 - m31 ) * s;\n\t\t\tthis._z = ( m21 - m12 ) * s;\n\n\t\t} else if ( m11 > m22 && m11 > m33 ) {\n\n\t\t\ts = 2.0 * Math.sqrt( 1.0 + m11 - m22 - m33 );\n\n\t\t\tthis._w = ( m32 - m23 ) / s;\n\t\t\tthis._x = 0.25 * s;\n\t\t\tthis._y = ( m12 + m21 ) / s;\n\t\t\tthis._z = ( m13 + m31 ) / s;\n\n\t\t} else if ( m22 > m33 ) {\n\n\t\t\ts = 2.0 * Math.sqrt( 1.0 + m22 - m11 - m33 );\n\n\t\t\tthis._w = ( m13 - m31 ) / s;\n\t\t\tthis._x = ( m12 + m21 ) / s;\n\t\t\tthis._y = 0.25 * s;\n\t\t\tthis._z = ( m23 + m32 ) / s;\n\n\t\t} else {\n\n\t\t\ts = 2.0 * Math.sqrt( 1.0 + m33 - m11 - m22 );\n\n\t\t\tthis._w = ( m21 - m12 ) / s;\n\t\t\tthis._x = ( m13 + m31 ) / s;\n\t\t\tthis._y = ( m23 + m32 ) / s;\n\t\t\tthis._z = 0.25 * s;\n\n\t\t}\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t},\n\n\tsetFromUnitVectors: function ( vFrom, vTo ) {\n\n\t\t// assumes direction vectors vFrom and vTo are normalized\n\n\t\tvar EPS = 0.000001;\n\n\t\tvar r = vFrom.dot( vTo ) + 1;\n\n\t\tif ( r < EPS ) {\n\n\t\t\tr = 0;\n\n\t\t\tif ( Math.abs( vFrom.x ) > Math.abs( vFrom.z ) ) {\n\n\t\t\t\tthis._x = - vFrom.y;\n\t\t\t\tthis._y = vFrom.x;\n\t\t\t\tthis._z = 0;\n\t\t\t\tthis._w = r;\n\n\t\t\t} else {\n\n\t\t\t\tthis._x = 0;\n\t\t\t\tthis._y = - vFrom.z;\n\t\t\t\tthis._z = vFrom.y;\n\t\t\t\tthis._w = r;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// crossVectors( vFrom, vTo ); // inlined to avoid cyclic dependency on Vector3\n\n\t\t\tthis._x = vFrom.y * vTo.z - vFrom.z * vTo.y;\n\t\t\tthis._y = vFrom.z * vTo.x - vFrom.x * vTo.z;\n\t\t\tthis._z = vFrom.x * vTo.y - vFrom.y * vTo.x;\n\t\t\tthis._w = r;\n\n\t\t}\n\n\t\treturn this.normalize();\n\n\t},\n\n\tangleTo: function ( q ) {\n\n\t\treturn 2 * Math.acos( Math.abs( MathUtils.clamp( this.dot( q ), - 1, 1 ) ) );\n\n\t},\n\n\trotateTowards: function ( q, step ) {\n\n\t\tvar angle = this.angleTo( q );\n\n\t\tif ( angle === 0 ) return this;\n\n\t\tvar t = Math.min( 1, step / angle );\n\n\t\tthis.slerp( q, t );\n\n\t\treturn this;\n\n\t},\n\n\tinverse: function () {\n\n\t\t// quaternion is assumed to have unit length\n\n\t\treturn this.conjugate();\n\n\t},\n\n\tconjugate: function () {\n\n\t\tthis._x *= - 1;\n\t\tthis._y *= - 1;\n\t\tthis._z *= - 1;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t},\n\n\tdot: function ( v ) {\n\n\t\treturn this._x * v._x + this._y * v._y + this._z * v._z + this._w * v._w;\n\n\t},\n\n\tlengthSq: function () {\n\n\t\treturn this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w;\n\n\t},\n\n\tlength: function () {\n\n\t\treturn Math.sqrt( this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w );\n\n\t},\n\n\tnormalize: function () {\n\n\t\tvar l = this.length();\n\n\t\tif ( l === 0 ) {\n\n\t\t\tthis._x = 0;\n\t\t\tthis._y = 0;\n\t\t\tthis._z = 0;\n\t\t\tthis._w = 1;\n\n\t\t} else {\n\n\t\t\tl = 1 / l;\n\n\t\t\tthis._x = this._x * l;\n\t\t\tthis._y = this._y * l;\n\t\t\tthis._z = this._z * l;\n\t\t\tthis._w = this._w * l;\n\n\t\t}\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t},\n\n\tmultiply: function ( q, p ) {\n\n\t\tif ( p !== undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead.' );\n\t\t\treturn this.multiplyQuaternions( q, p );\n\n\t\t}\n\n\t\treturn this.multiplyQuaternions( this, q );\n\n\t},\n\n\tpremultiply: function ( q ) {\n\n\t\treturn this.multiplyQuaternions( q, this );\n\n\t},\n\n\tmultiplyQuaternions: function ( a, b ) {\n\n\t\t// from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm\n\n\t\tvar qax = a._x, qay = a._y, qaz = a._z, qaw = a._w;\n\t\tvar qbx = b._x, qby = b._y, qbz = b._z, qbw = b._w;\n\n\t\tthis._x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby;\n\t\tthis._y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz;\n\t\tthis._z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;\n\t\tthis._w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t},\n\n\tslerp: function ( qb, t ) {\n\n\t\tif ( t === 0 ) return this;\n\t\tif ( t === 1 ) return this.copy( qb );\n\n\t\tvar x = this._x, y = this._y, z = this._z, w = this._w;\n\n\t\t// http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/\n\n\t\tvar cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z;\n\n\t\tif ( cosHalfTheta < 0 ) {\n\n\t\t\tthis._w = - qb._w;\n\t\t\tthis._x = - qb._x;\n\t\t\tthis._y = - qb._y;\n\t\t\tthis._z = - qb._z;\n\n\t\t\tcosHalfTheta = - cosHalfTheta;\n\n\t\t} else {\n\n\t\t\tthis.copy( qb );\n\n\t\t}\n\n\t\tif ( cosHalfTheta >= 1.0 ) {\n\n\t\t\tthis._w = w;\n\t\t\tthis._x = x;\n\t\t\tthis._y = y;\n\t\t\tthis._z = z;\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tvar sqrSinHalfTheta = 1.0 - cosHalfTheta * cosHalfTheta;\n\n\t\tif ( sqrSinHalfTheta <= Number.EPSILON ) {\n\n\t\t\tvar s = 1 - t;\n\t\t\tthis._w = s * w + t * this._w;\n\t\t\tthis._x = s * x + t * this._x;\n\t\t\tthis._y = s * y + t * this._y;\n\t\t\tthis._z = s * z + t * this._z;\n\n\t\t\tthis.normalize();\n\t\t\tthis._onChangeCallback();\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tvar sinHalfTheta = Math.sqrt( sqrSinHalfTheta );\n\t\tvar halfTheta = Math.atan2( sinHalfTheta, cosHalfTheta );\n\t\tvar ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta,\n\t\t\tratioB = Math.sin( t * halfTheta ) / sinHalfTheta;\n\n\t\tthis._w = ( w * ratioA + this._w * ratioB );\n\t\tthis._x = ( x * ratioA + this._x * ratioB );\n\t\tthis._y = ( y * ratioA + this._y * ratioB );\n\t\tthis._z = ( z * ratioA + this._z * ratioB );\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t},\n\n\tequals: function ( quaternion ) {\n\n\t\treturn ( quaternion._x === this._x ) && ( quaternion._y === this._y ) && ( quaternion._z === this._z ) && ( quaternion._w === this._w );\n\n\t},\n\n\tfromArray: function ( array, offset ) {\n\n\t\tif ( offset === undefined ) offset = 0;\n\n\t\tthis._x = array[ offset ];\n\t\tthis._y = array[ offset + 1 ];\n\t\tthis._z = array[ offset + 2 ];\n\t\tthis._w = array[ offset + 3 ];\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t},\n\n\ttoArray: function ( array, offset ) {\n\n\t\tif ( array === undefined ) array = [];\n\t\tif ( offset === undefined ) offset = 0;\n\n\t\tarray[ offset ] = this._x;\n\t\tarray[ offset + 1 ] = this._y;\n\t\tarray[ offset + 2 ] = this._z;\n\t\tarray[ offset + 3 ] = this._w;\n\n\t\treturn array;\n\n\t},\n\n\t_onChange: function ( callback ) {\n\n\t\tthis._onChangeCallback = callback;\n\n\t\treturn this;\n\n\t},\n\n\t_onChangeCallback: function () {}\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n * @author kile / http://kile.stravaganza.org/\n * @author philogb / http://blog.thejit.org/\n * @author mikael emtinger / http://gomo.se/\n * @author egraether / http://egraether.com/\n * @author WestLangley / http://github.com/WestLangley\n */\n\nvar _vector = new Vector3();\nvar _quaternion = new Quaternion();\n\nfunction Vector3( x, y, z ) {\n\n\tthis.x = x || 0;\n\tthis.y = y || 0;\n\tthis.z = z || 0;\n\n}\n\nObject.assign( Vector3.prototype, {\n\n\tisVector3: true,\n\n\tset: function ( x, y, z ) {\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.z = z;\n\n\t\treturn this;\n\n\t},\n\n\tsetScalar: function ( scalar ) {\n\n\t\tthis.x = scalar;\n\t\tthis.y = scalar;\n\t\tthis.z = scalar;\n\n\t\treturn this;\n\n\t},\n\n\tsetX: function ( x ) {\n\n\t\tthis.x = x;\n\n\t\treturn this;\n\n\t},\n\n\tsetY: function ( y ) {\n\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t},\n\n\tsetZ: function ( z ) {\n\n\t\tthis.z = z;\n\n\t\treturn this;\n\n\t},\n\n\tsetComponent: function ( index, value ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: this.x = value; break;\n\t\t\tcase 1: this.y = value; break;\n\t\t\tcase 2: this.z = value; break;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tgetComponent: function ( index ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: return this.x;\n\t\t\tcase 1: return this.y;\n\t\t\tcase 2: return this.z;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t},\n\n\tclone: function () {\n\n\t\treturn new this.constructor( this.x, this.y, this.z );\n\n\t},\n\n\tcopy: function ( v ) {\n\n\t\tthis.x = v.x;\n\t\tthis.y = v.y;\n\t\tthis.z = v.z;\n\n\t\treturn this;\n\n\t},\n\n\tadd: function ( v, w ) {\n\n\t\tif ( w !== undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead.' );\n\t\t\treturn this.addVectors( v, w );\n\n\t\t}\n\n\t\tthis.x += v.x;\n\t\tthis.y += v.y;\n\t\tthis.z += v.z;\n\n\t\treturn this;\n\n\t},\n\n\taddScalar: function ( s ) {\n\n\t\tthis.x += s;\n\t\tthis.y += s;\n\t\tthis.z += s;\n\n\t\treturn this;\n\n\t},\n\n\taddVectors: function ( a, b ) {\n\n\t\tthis.x = a.x + b.x;\n\t\tthis.y = a.y + b.y;\n\t\tthis.z = a.z + b.z;\n\n\t\treturn this;\n\n\t},\n\n\taddScaledVector: function ( v, s ) {\n\n\t\tthis.x += v.x * s;\n\t\tthis.y += v.y * s;\n\t\tthis.z += v.z * s;\n\n\t\treturn this;\n\n\t},\n\n\tsub: function ( v, w ) {\n\n\t\tif ( w !== undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' );\n\t\t\treturn this.subVectors( v, w );\n\n\t\t}\n\n\t\tthis.x -= v.x;\n\t\tthis.y -= v.y;\n\t\tthis.z -= v.z;\n\n\t\treturn this;\n\n\t},\n\n\tsubScalar: function ( s ) {\n\n\t\tthis.x -= s;\n\t\tthis.y -= s;\n\t\tthis.z -= s;\n\n\t\treturn this;\n\n\t},\n\n\tsubVectors: function ( a, b ) {\n\n\t\tthis.x = a.x - b.x;\n\t\tthis.y = a.y - b.y;\n\t\tthis.z = a.z - b.z;\n\n\t\treturn this;\n\n\t},\n\n\tmultiply: function ( v, w ) {\n\n\t\tif ( w !== undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead.' );\n\t\t\treturn this.multiplyVectors( v, w );\n\n\t\t}\n\n\t\tthis.x *= v.x;\n\t\tthis.y *= v.y;\n\t\tthis.z *= v.z;\n\n\t\treturn this;\n\n\t},\n\n\tmultiplyScalar: function ( scalar ) {\n\n\t\tthis.x *= scalar;\n\t\tthis.y *= scalar;\n\t\tthis.z *= scalar;\n\n\t\treturn this;\n\n\t},\n\n\tmultiplyVectors: function ( a, b ) {\n\n\t\tthis.x = a.x * b.x;\n\t\tthis.y = a.y * b.y;\n\t\tthis.z = a.z * b.z;\n\n\t\treturn this;\n\n\t},\n\n\tapplyEuler: function ( euler ) {\n\n\t\tif ( ! ( euler && euler.isEuler ) ) {\n\n\t\t\tconsole.error( 'THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.' );\n\n\t\t}\n\n\t\treturn this.applyQuaternion( _quaternion.setFromEuler( euler ) );\n\n\t},\n\n\tapplyAxisAngle: function ( axis, angle ) {\n\n\t\treturn this.applyQuaternion( _quaternion.setFromAxisAngle( axis, angle ) );\n\n\t},\n\n\tapplyMatrix3: function ( m ) {\n\n\t\tvar x = this.x, y = this.y, z = this.z;\n\t\tvar e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 3 ] * y + e[ 6 ] * z;\n\t\tthis.y = e[ 1 ] * x + e[ 4 ] * y + e[ 7 ] * z;\n\t\tthis.z = e[ 2 ] * x + e[ 5 ] * y + e[ 8 ] * z;\n\n\t\treturn this;\n\n\t},\n\n\tapplyNormalMatrix: function ( m ) {\n\n\t\treturn this.applyMatrix3( m ).normalize();\n\n\t},\n\n\tapplyMatrix4: function ( m ) {\n\n\t\tvar x = this.x, y = this.y, z = this.z;\n\t\tvar e = m.elements;\n\n\t\tvar w = 1 / ( e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] );\n\n\t\tthis.x = ( e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] ) * w;\n\t\tthis.y = ( e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] ) * w;\n\t\tthis.z = ( e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] ) * w;\n\n\t\treturn this;\n\n\t},\n\n\tapplyQuaternion: function ( q ) {\n\n\t\tvar x = this.x, y = this.y, z = this.z;\n\t\tvar qx = q.x, qy = q.y, qz = q.z, qw = q.w;\n\n\t\t// calculate quat * vector\n\n\t\tvar ix = qw * x + qy * z - qz * y;\n\t\tvar iy = qw * y + qz * x - qx * z;\n\t\tvar iz = qw * z + qx * y - qy * x;\n\t\tvar iw = - qx * x - qy * y - qz * z;\n\n\t\t// calculate result * inverse quat\n\n\t\tthis.x = ix * qw + iw * - qx + iy * - qz - iz * - qy;\n\t\tthis.y = iy * qw + iw * - qy + iz * - qx - ix * - qz;\n\t\tthis.z = iz * qw + iw * - qz + ix * - qy - iy * - qx;\n\n\t\treturn this;\n\n\t},\n\n\tproject: function ( camera ) {\n\n\t\treturn this.applyMatrix4( camera.matrixWorldInverse ).applyMatrix4( camera.projectionMatrix );\n\n\t},\n\n\tunproject: function ( camera ) {\n\n\t\treturn this.applyMatrix4( camera.projectionMatrixInverse ).applyMatrix4( camera.matrixWorld );\n\n\t},\n\n\ttransformDirection: function ( m ) {\n\n\t\t// input: THREE.Matrix4 affine matrix\n\t\t// vector interpreted as a direction\n\n\t\tvar x = this.x, y = this.y, z = this.z;\n\t\tvar e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z;\n\t\tthis.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z;\n\t\tthis.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z;\n\n\t\treturn this.normalize();\n\n\t},\n\n\tdivide: function ( v ) {\n\n\t\tthis.x /= v.x;\n\t\tthis.y /= v.y;\n\t\tthis.z /= v.z;\n\n\t\treturn this;\n\n\t},\n\n\tdivideScalar: function ( scalar ) {\n\n\t\treturn this.multiplyScalar( 1 / scalar );\n\n\t},\n\n\tmin: function ( v ) {\n\n\t\tthis.x = Math.min( this.x, v.x );\n\t\tthis.y = Math.min( this.y, v.y );\n\t\tthis.z = Math.min( this.z, v.z );\n\n\t\treturn this;\n\n\t},\n\n\tmax: function ( v ) {\n\n\t\tthis.x = Math.max( this.x, v.x );\n\t\tthis.y = Math.max( this.y, v.y );\n\t\tthis.z = Math.max( this.z, v.z );\n\n\t\treturn this;\n\n\t},\n\n\tclamp: function ( min, max ) {\n\n\t\t// assumes min < max, componentwise\n\n\t\tthis.x = Math.max( min.x, Math.min( max.x, this.x ) );\n\t\tthis.y = Math.max( min.y, Math.min( max.y, this.y ) );\n\t\tthis.z = Math.max( min.z, Math.min( max.z, this.z ) );\n\n\t\treturn this;\n\n\t},\n\n\tclampScalar: function ( minVal, maxVal ) {\n\n\t\tthis.x = Math.max( minVal, Math.min( maxVal, this.x ) );\n\t\tthis.y = Math.max( minVal, Math.min( maxVal, this.y ) );\n\t\tthis.z = Math.max( minVal, Math.min( maxVal, this.z ) );\n\n\t\treturn this;\n\n\t},\n\n\tclampLength: function ( min, max ) {\n\n\t\tvar length = this.length();\n\n\t\treturn this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );\n\n\t},\n\n\tfloor: function () {\n\n\t\tthis.x = Math.floor( this.x );\n\t\tthis.y = Math.floor( this.y );\n\t\tthis.z = Math.floor( this.z );\n\n\t\treturn this;\n\n\t},\n\n\tceil: function () {\n\n\t\tthis.x = Math.ceil( this.x );\n\t\tthis.y = Math.ceil( this.y );\n\t\tthis.z = Math.ceil( this.z );\n\n\t\treturn this;\n\n\t},\n\n\tround: function () {\n\n\t\tthis.x = Math.round( this.x );\n\t\tthis.y = Math.round( this.y );\n\t\tthis.z = Math.round( this.z );\n\n\t\treturn this;\n\n\t},\n\n\troundToZero: function () {\n\n\t\tthis.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x );\n\t\tthis.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );\n\t\tthis.z = ( this.z < 0 ) ? Math.ceil( this.z ) : Math.floor( this.z );\n\n\t\treturn this;\n\n\t},\n\n\tnegate: function () {\n\n\t\tthis.x = - this.x;\n\t\tthis.y = - this.y;\n\t\tthis.z = - this.z;\n\n\t\treturn this;\n\n\t},\n\n\tdot: function ( v ) {\n\n\t\treturn this.x * v.x + this.y * v.y + this.z * v.z;\n\n\t},\n\n\t// TODO lengthSquared?\n\n\tlengthSq: function () {\n\n\t\treturn this.x * this.x + this.y * this.y + this.z * this.z;\n\n\t},\n\n\tlength: function () {\n\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z );\n\n\t},\n\n\tmanhattanLength: function () {\n\n\t\treturn Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z );\n\n\t},\n\n\tnormalize: function () {\n\n\t\treturn this.divideScalar( this.length() || 1 );\n\n\t},\n\n\tsetLength: function ( length ) {\n\n\t\treturn this.normalize().multiplyScalar( length );\n\n\t},\n\n\tlerp: function ( v, alpha ) {\n\n\t\tthis.x += ( v.x - this.x ) * alpha;\n\t\tthis.y += ( v.y - this.y ) * alpha;\n\t\tthis.z += ( v.z - this.z ) * alpha;\n\n\t\treturn this;\n\n\t},\n\n\tlerpVectors: function ( v1, v2, alpha ) {\n\n\t\treturn this.subVectors( v2, v1 ).multiplyScalar( alpha ).add( v1 );\n\n\t},\n\n\tcross: function ( v, w ) {\n\n\t\tif ( w !== undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead.' );\n\t\t\treturn this.crossVectors( v, w );\n\n\t\t}\n\n\t\treturn this.crossVectors( this, v );\n\n\t},\n\n\tcrossVectors: function ( a, b ) {\n\n\t\tvar ax = a.x, ay = a.y, az = a.z;\n\t\tvar bx = b.x, by = b.y, bz = b.z;\n\n\t\tthis.x = ay * bz - az * by;\n\t\tthis.y = az * bx - ax * bz;\n\t\tthis.z = ax * by - ay * bx;\n\n\t\treturn this;\n\n\t},\n\n\tprojectOnVector: function ( v ) {\n\n\t\tvar denominator = v.lengthSq();\n\n\t\tif ( denominator === 0 ) return this.set( 0, 0, 0 );\n\n\t\tvar scalar = v.dot( this ) / denominator;\n\n\t\treturn this.copy( v ).multiplyScalar( scalar );\n\n\t},\n\n\tprojectOnPlane: function ( planeNormal ) {\n\n\t\t_vector.copy( this ).projectOnVector( planeNormal );\n\n\t\treturn this.sub( _vector );\n\n\t},\n\n\treflect: function ( normal ) {\n\n\t\t// reflect incident vector off plane orthogonal to normal\n\t\t// normal is assumed to have unit length\n\n\t\treturn this.sub( _vector.copy( normal ).multiplyScalar( 2 * this.dot( normal ) ) );\n\n\t},\n\n\tangleTo: function ( v ) {\n\n\t\tvar denominator = Math.sqrt( this.lengthSq() * v.lengthSq() );\n\n\t\tif ( denominator === 0 ) return Math.PI / 2;\n\n\t\tvar theta = this.dot( v ) / denominator;\n\n\t\t// clamp, to handle numerical problems\n\n\t\treturn Math.acos( MathUtils.clamp( theta, - 1, 1 ) );\n\n\t},\n\n\tdistanceTo: function ( v ) {\n\n\t\treturn Math.sqrt( this.distanceToSquared( v ) );\n\n\t},\n\n\tdistanceToSquared: function ( v ) {\n\n\t\tvar dx = this.x - v.x, dy = this.y - v.y, dz = this.z - v.z;\n\n\t\treturn dx * dx + dy * dy + dz * dz;\n\n\t},\n\n\tmanhattanDistanceTo: function ( v ) {\n\n\t\treturn Math.abs( this.x - v.x ) + Math.abs( this.y - v.y ) + Math.abs( this.z - v.z );\n\n\t},\n\n\tsetFromSpherical: function ( s ) {\n\n\t\treturn this.setFromSphericalCoords( s.radius, s.phi, s.theta );\n\n\t},\n\n\tsetFromSphericalCoords: function ( radius, phi, theta ) {\n\n\t\tvar sinPhiRadius = Math.sin( phi ) * radius;\n\n\t\tthis.x = sinPhiRadius * Math.sin( theta );\n\t\tthis.y = Math.cos( phi ) * radius;\n\t\tthis.z = sinPhiRadius * Math.cos( theta );\n\n\t\treturn this;\n\n\t},\n\n\tsetFromCylindrical: function ( c ) {\n\n\t\treturn this.setFromCylindricalCoords( c.radius, c.theta, c.y );\n\n\t},\n\n\tsetFromCylindricalCoords: function ( radius, theta, y ) {\n\n\t\tthis.x = radius * Math.sin( theta );\n\t\tthis.y = y;\n\t\tthis.z = radius * Math.cos( theta );\n\n\t\treturn this;\n\n\t},\n\n\tsetFromMatrixPosition: function ( m ) {\n\n\t\tvar e = m.elements;\n\n\t\tthis.x = e[ 12 ];\n\t\tthis.y = e[ 13 ];\n\t\tthis.z = e[ 14 ];\n\n\t\treturn this;\n\n\t},\n\n\tsetFromMatrixScale: function ( m ) {\n\n\t\tvar sx = this.setFromMatrixColumn( m, 0 ).length();\n\t\tvar sy = this.setFromMatrixColumn( m, 1 ).length();\n\t\tvar sz = this.setFromMatrixColumn( m, 2 ).length();\n\n\t\tthis.x = sx;\n\t\tthis.y = sy;\n\t\tthis.z = sz;\n\n\t\treturn this;\n\n\t},\n\n\tsetFromMatrixColumn: function ( m, index ) {\n\n\t\treturn this.fromArray( m.elements, index * 4 );\n\n\t},\n\n\tsetFromMatrix3Column: function ( m, index ) {\n\n\t\treturn this.fromArray( m.elements, index * 3 );\n\n\t},\n\n\tequals: function ( v ) {\n\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) );\n\n\t},\n\n\tfromArray: function ( array, offset ) {\n\n\t\tif ( offset === undefined ) offset = 0;\n\n\t\tthis.x = array[ offset ];\n\t\tthis.y = array[ offset + 1 ];\n\t\tthis.z = array[ offset + 2 ];\n\n\t\treturn this;\n\n\t},\n\n\ttoArray: function ( array, offset ) {\n\n\t\tif ( array === undefined ) array = [];\n\t\tif ( offset === undefined ) offset = 0;\n\n\t\tarray[ offset ] = this.x;\n\t\tarray[ offset + 1 ] = this.y;\n\t\tarray[ offset + 2 ] = this.z;\n\n\t\treturn array;\n\n\t},\n\n\tfromBufferAttribute: function ( attribute, index, offset ) {\n\n\t\tif ( offset !== undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Vector3: offset has been removed from .fromBufferAttribute().' );\n\n\t\t}\n\n\t\tthis.x = attribute.getX( index );\n\t\tthis.y = attribute.getY( index );\n\t\tthis.z = attribute.getZ( index );\n\n\t\treturn this;\n\n\t}\n\n} );\n\nvar _v1 = new Vector3();\nvar _m1 = new Matrix4();\nvar _zero = new Vector3( 0, 0, 0 );\nvar _one = new Vector3( 1, 1, 1 );\nvar _x = new Vector3();\nvar _y = new Vector3();\nvar _z = new Vector3();\n\n/**\n * @author mrdoob / http://mrdoob.com/\n * @author supereggbert / http://www.paulbrunt.co.uk/\n * @author philogb / http://blog.thejit.org/\n * @author jordi_ros / http://plattsoft.com\n * @author D1plo1d / http://github.com/D1plo1d\n * @author alteredq / http://alteredqualia.com/\n * @author mikael emtinger / http://gomo.se/\n * @author timknip / http://www.floorplanner.com/\n * @author bhouston / http://clara.io\n * @author WestLangley / http://github.com/WestLangley\n */\n\nfunction Matrix4() {\n\n\tthis.elements = [\n\n\t\t1, 0, 0, 0,\n\t\t0, 1, 0, 0,\n\t\t0, 0, 1, 0,\n\t\t0, 0, 0, 1\n\n\t];\n\n\tif ( arguments.length > 0 ) {\n\n\t\tconsole.error( 'THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.' );\n\n\t}\n\n}\n\nObject.assign( Matrix4.prototype, {\n\n\tisMatrix4: true,\n\n\tset: function ( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {\n\n\t\tvar te = this.elements;\n\n\t\tte[ 0 ] = n11; te[ 4 ] = n12; te[ 8 ] = n13; te[ 12 ] = n14;\n\t\tte[ 1 ] = n21; te[ 5 ] = n22; te[ 9 ] = n23; te[ 13 ] = n24;\n\t\tte[ 2 ] = n31; te[ 6 ] = n32; te[ 10 ] = n33; te[ 14 ] = n34;\n\t\tte[ 3 ] = n41; te[ 7 ] = n42; te[ 11 ] = n43; te[ 15 ] = n44;\n\n\t\treturn this;\n\n\t},\n\n\tidentity: function () {\n\n\t\tthis.set(\n\n\t\t\t1, 0, 0, 0,\n\t\t\t0, 1, 0, 0,\n\t\t\t0, 0, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t},\n\n\tclone: function () {\n\n\t\treturn new Matrix4().fromArray( this.elements );\n\n\t},\n\n\tcopy: function ( m ) {\n\n\t\tvar te = this.elements;\n\t\tvar me = m.elements;\n\n\t\tte[ 0 ] = me[ 0 ]; te[ 1 ] = me[ 1 ]; te[ 2 ] = me[ 2 ]; te[ 3 ] = me[ 3 ];\n\t\tte[ 4 ] = me[ 4 ]; te[ 5 ] = me[ 5 ]; te[ 6 ] = me[ 6 ]; te[ 7 ] = me[ 7 ];\n\t\tte[ 8 ] = me[ 8 ]; te[ 9 ] = me[ 9 ]; te[ 10 ] = me[ 10 ]; te[ 11 ] = me[ 11 ];\n\t\tte[ 12 ] = me[ 12 ]; te[ 13 ] = me[ 13 ]; te[ 14 ] = me[ 14 ]; te[ 15 ] = me[ 15 ];\n\n\t\treturn this;\n\n\t},\n\n\tcopyPosition: function ( m ) {\n\n\t\tvar te = this.elements, me = m.elements;\n\n\t\tte[ 12 ] = me[ 12 ];\n\t\tte[ 13 ] = me[ 13 ];\n\t\tte[ 14 ] = me[ 14 ];\n\n\t\treturn this;\n\n\t},\n\n\textractBasis: function ( xAxis, yAxis, zAxis ) {\n\n\t\txAxis.setFromMatrixColumn( this, 0 );\n\t\tyAxis.setFromMatrixColumn( this, 1 );\n\t\tzAxis.setFromMatrixColumn( this, 2 );\n\n\t\treturn this;\n\n\t},\n\n\tmakeBasis: function ( xAxis, yAxis, zAxis ) {\n\n\t\tthis.set(\n\t\t\txAxis.x, yAxis.x, zAxis.x, 0,\n\t\t\txAxis.y, yAxis.y, zAxis.y, 0,\n\t\t\txAxis.z, yAxis.z, zAxis.z, 0,\n\t\t\t0, 0, 0, 1\n\t\t);\n\n\t\treturn this;\n\n\t},\n\n\textractRotation: function ( m ) {\n\n\t\t// this method does not support reflection matrices\n\n\t\tvar te = this.elements;\n\t\tvar me = m.elements;\n\n\t\tvar scaleX = 1 / _v1.setFromMatrixColumn( m, 0 ).length();\n\t\tvar scaleY = 1 / _v1.setFromMatrixColumn( m, 1 ).length();\n\t\tvar scaleZ = 1 / _v1.setFromMatrixColumn( m, 2 ).length();\n\n\t\tte[ 0 ] = me[ 0 ] * scaleX;\n\t\tte[ 1 ] = me[ 1 ] * scaleX;\n\t\tte[ 2 ] = me[ 2 ] * scaleX;\n\t\tte[ 3 ] = 0;\n\n\t\tte[ 4 ] = me[ 4 ] * scaleY;\n\t\tte[ 5 ] = me[ 5 ] * scaleY;\n\t\tte[ 6 ] = me[ 6 ] * scaleY;\n\t\tte[ 7 ] = 0;\n\n\t\tte[ 8 ] = me[ 8 ] * scaleZ;\n\t\tte[ 9 ] = me[ 9 ] * scaleZ;\n\t\tte[ 10 ] = me[ 10 ] * scaleZ;\n\t\tte[ 11 ] = 0;\n\n\t\tte[ 12 ] = 0;\n\t\tte[ 13 ] = 0;\n\t\tte[ 14 ] = 0;\n\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t},\n\n\tmakeRotationFromEuler: function ( euler ) {\n\n\t\tif ( ! ( euler && euler.isEuler ) ) {\n\n\t\t\tconsole.error( 'THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.' );\n\n\t\t}\n\n\t\tvar te = this.elements;\n\n\t\tvar x = euler.x, y = euler.y, z = euler.z;\n\t\tvar a = Math.cos( x ), b = Math.sin( x );\n\t\tvar c = Math.cos( y ), d = Math.sin( y );\n\t\tvar e = Math.cos( z ), f = Math.sin( z );\n\n\t\tif ( euler.order === 'XYZ' ) {\n\n\t\t\tvar ae = a * e, af = a * f, be = b * e, bf = b * f;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = - c * f;\n\t\t\tte[ 8 ] = d;\n\n\t\t\tte[ 1 ] = af + be * d;\n\t\t\tte[ 5 ] = ae - bf * d;\n\t\t\tte[ 9 ] = - b * c;\n\n\t\t\tte[ 2 ] = bf - ae * d;\n\t\t\tte[ 6 ] = be + af * d;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'YXZ' ) {\n\n\t\t\tvar ce = c * e, cf = c * f, de = d * e, df = d * f;\n\n\t\t\tte[ 0 ] = ce + df * b;\n\t\t\tte[ 4 ] = de * b - cf;\n\t\t\tte[ 8 ] = a * d;\n\n\t\t\tte[ 1 ] = a * f;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = - b;\n\n\t\t\tte[ 2 ] = cf * b - de;\n\t\t\tte[ 6 ] = df + ce * b;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'ZXY' ) {\n\n\t\t\tvar ce = c * e, cf = c * f, de = d * e, df = d * f;\n\n\t\t\tte[ 0 ] = ce - df * b;\n\t\t\tte[ 4 ] = - a * f;\n\t\t\tte[ 8 ] = de + cf * b;\n\n\t\t\tte[ 1 ] = cf + de * b;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = df - ce * b;\n\n\t\t\tte[ 2 ] = - a * d;\n\t\t\tte[ 6 ] = b;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'ZYX' ) {\n\n\t\t\tvar ae = a * e, af = a * f, be = b * e, bf = b * f;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = be * d - af;\n\t\t\tte[ 8 ] = ae * d + bf;\n\n\t\t\tte[ 1 ] = c * f;\n\t\t\tte[ 5 ] = bf * d + ae;\n\t\t\tte[ 9 ] = af * d - be;\n\n\t\t\tte[ 2 ] = - d;\n\t\t\tte[ 6 ] = b * c;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'YZX' ) {\n\n\t\t\tvar ac = a * c, ad = a * d, bc = b * c, bd = b * d;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = bd - ac * f;\n\t\t\tte[ 8 ] = bc * f + ad;\n\n\t\t\tte[ 1 ] = f;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = - b * e;\n\n\t\t\tte[ 2 ] = - d * e;\n\t\t\tte[ 6 ] = ad * f + bc;\n\t\t\tte[ 10 ] = ac - bd * f;\n\n\t\t} else if ( euler.order === 'XZY' ) {\n\n\t\t\tvar ac = a * c, ad = a * d, bc = b * c, bd = b * d;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = - f;\n\t\t\tte[ 8 ] = d * e;\n\n\t\t\tte[ 1 ] = ac * f + bd;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = ad * f - bc;\n\n\t\t\tte[ 2 ] = bc * f - ad;\n\t\t\tte[ 6 ] = b * e;\n\t\t\tte[ 10 ] = bd * f + ac;\n\n\t\t}\n\n\t\t// bottom row\n\t\tte[ 3 ] = 0;\n\t\tte[ 7 ] = 0;\n\t\tte[ 11 ] = 0;\n\n\t\t// last column\n\t\tte[ 12 ] = 0;\n\t\tte[ 13 ] = 0;\n\t\tte[ 14 ] = 0;\n\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t},\n\n\tmakeRotationFromQuaternion: function ( q ) {\n\n\t\treturn this.compose( _zero, q, _one );\n\n\t},\n\n\tlookAt: function ( eye, target, up ) {\n\n\t\tvar te = this.elements;\n\n\t\t_z.subVectors( eye, target );\n\n\t\tif ( _z.lengthSq() === 0 ) {\n\n\t\t\t// eye and target are in the same position\n\n\t\t\t_z.z = 1;\n\n\t\t}\n\n\t\t_z.normalize();\n\t\t_x.crossVectors( up, _z );\n\n\t\tif ( _x.lengthSq() === 0 ) {\n\n\t\t\t// up and z are parallel\n\n\t\t\tif ( Math.abs( up.z ) === 1 ) {\n\n\t\t\t\t_z.x += 0.0001;\n\n\t\t\t} else {\n\n\t\t\t\t_z.z += 0.0001;\n\n\t\t\t}\n\n\t\t\t_z.normalize();\n\t\t\t_x.crossVectors( up, _z );\n\n\t\t}\n\n\t\t_x.normalize();\n\t\t_y.crossVectors( _z, _x );\n\n\t\tte[ 0 ] = _x.x; te[ 4 ] = _y.x; te[ 8 ] = _z.x;\n\t\tte[ 1 ] = _x.y; te[ 5 ] = _y.y; te[ 9 ] = _z.y;\n\t\tte[ 2 ] = _x.z; te[ 6 ] = _y.z; te[ 10 ] = _z.z;\n\n\t\treturn this;\n\n\t},\n\n\tmultiply: function ( m, n ) {\n\n\t\tif ( n !== undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead.' );\n\t\t\treturn this.multiplyMatrices( m, n );\n\n\t\t}\n\n\t\treturn this.multiplyMatrices( this, m );\n\n\t},\n\n\tpremultiply: function ( m ) {\n\n\t\treturn this.multiplyMatrices( m, this );\n\n\t},\n\n\tmultiplyMatrices: function ( a, b ) {\n\n\t\tvar ae = a.elements;\n\t\tvar be = b.elements;\n\t\tvar te = this.elements;\n\n\t\tvar a11 = ae[ 0 ], a12 = ae[ 4 ], a13 = ae[ 8 ], a14 = ae[ 12 ];\n\t\tvar a21 = ae[ 1 ], a22 = ae[ 5 ], a23 = ae[ 9 ], a24 = ae[ 13 ];\n\t\tvar a31 = ae[ 2 ], a32 = ae[ 6 ], a33 = ae[ 10 ], a34 = ae[ 14 ];\n\t\tvar a41 = ae[ 3 ], a42 = ae[ 7 ], a43 = ae[ 11 ], a44 = ae[ 15 ];\n\n\t\tvar b11 = be[ 0 ], b12 = be[ 4 ], b13 = be[ 8 ], b14 = be[ 12 ];\n\t\tvar b21 = be[ 1 ], b22 = be[ 5 ], b23 = be[ 9 ], b24 = be[ 13 ];\n\t\tvar b31 = be[ 2 ], b32 = be[ 6 ], b33 = be[ 10 ], b34 = be[ 14 ];\n\t\tvar b41 = be[ 3 ], b42 = be[ 7 ], b43 = be[ 11 ], b44 = be[ 15 ];\n\n\t\tte[ 0 ] = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41;\n\t\tte[ 4 ] = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42;\n\t\tte[ 8 ] = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43;\n\t\tte[ 12 ] = a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44;\n\n\t\tte[ 1 ] = a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41;\n\t\tte[ 5 ] = a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42;\n\t\tte[ 9 ] = a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43;\n\t\tte[ 13 ] = a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44;\n\n\t\tte[ 2 ] = a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41;\n\t\tte[ 6 ] = a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42;\n\t\tte[ 10 ] = a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43;\n\t\tte[ 14 ] = a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44;\n\n\t\tte[ 3 ] = a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41;\n\t\tte[ 7 ] = a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42;\n\t\tte[ 11 ] = a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43;\n\t\tte[ 15 ] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44;\n\n\t\treturn this;\n\n\t},\n\n\tmultiplyScalar: function ( s ) {\n\n\t\tvar te = this.elements;\n\n\t\tte[ 0 ] *= s; te[ 4 ] *= s; te[ 8 ] *= s; te[ 12 ] *= s;\n\t\tte[ 1 ] *= s; te[ 5 ] *= s; te[ 9 ] *= s; te[ 13 ] *= s;\n\t\tte[ 2 ] *= s; te[ 6 ] *= s; te[ 10 ] *= s; te[ 14 ] *= s;\n\t\tte[ 3 ] *= s; te[ 7 ] *= s; te[ 11 ] *= s; te[ 15 ] *= s;\n\n\t\treturn this;\n\n\t},\n\n\tdeterminant: function () {\n\n\t\tvar te = this.elements;\n\n\t\tvar n11 = te[ 0 ], n12 = te[ 4 ], n13 = te[ 8 ], n14 = te[ 12 ];\n\t\tvar n21 = te[ 1 ], n22 = te[ 5 ], n23 = te[ 9 ], n24 = te[ 13 ];\n\t\tvar n31 = te[ 2 ], n32 = te[ 6 ], n33 = te[ 10 ], n34 = te[ 14 ];\n\t\tvar n41 = te[ 3 ], n42 = te[ 7 ], n43 = te[ 11 ], n44 = te[ 15 ];\n\n\t\t//TODO: make this more efficient\n\t\t//( based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm )\n\n\t\treturn (\n\t\t\tn41 * (\n\t\t\t\t+ n14 * n23 * n32\n\t\t\t\t - n13 * n24 * n32\n\t\t\t\t - n14 * n22 * n33\n\t\t\t\t + n12 * n24 * n33\n\t\t\t\t + n13 * n22 * n34\n\t\t\t\t - n12 * n23 * n34\n\t\t\t) +\n\t\t\tn42 * (\n\t\t\t\t+ n11 * n23 * n34\n\t\t\t\t - n11 * n24 * n33\n\t\t\t\t + n14 * n21 * n33\n\t\t\t\t - n13 * n21 * n34\n\t\t\t\t + n13 * n24 * n31\n\t\t\t\t - n14 * n23 * n31\n\t\t\t) +\n\t\t\tn43 * (\n\t\t\t\t+ n11 * n24 * n32\n\t\t\t\t - n11 * n22 * n34\n\t\t\t\t - n14 * n21 * n32\n\t\t\t\t + n12 * n21 * n34\n\t\t\t\t + n14 * n22 * n31\n\t\t\t\t - n12 * n24 * n31\n\t\t\t) +\n\t\t\tn44 * (\n\t\t\t\t- n13 * n22 * n31\n\t\t\t\t - n11 * n23 * n32\n\t\t\t\t + n11 * n22 * n33\n\t\t\t\t + n13 * n21 * n32\n\t\t\t\t - n12 * n21 * n33\n\t\t\t\t + n12 * n23 * n31\n\t\t\t)\n\n\t\t);\n\n\t},\n\n\ttranspose: function () {\n\n\t\tvar te = this.elements;\n\t\tvar tmp;\n\n\t\ttmp = te[ 1 ]; te[ 1 ] = te[ 4 ]; te[ 4 ] = tmp;\n\t\ttmp = te[ 2 ]; te[ 2 ] = te[ 8 ]; te[ 8 ] = tmp;\n\t\ttmp = te[ 6 ]; te[ 6 ] = te[ 9 ]; te[ 9 ] = tmp;\n\n\t\ttmp = te[ 3 ]; te[ 3 ] = te[ 12 ]; te[ 12 ] = tmp;\n\t\ttmp = te[ 7 ]; te[ 7 ] = te[ 13 ]; te[ 13 ] = tmp;\n\t\ttmp = te[ 11 ]; te[ 11 ] = te[ 14 ]; te[ 14 ] = tmp;\n\n\t\treturn this;\n\n\t},\n\n\tsetPosition: function ( x, y, z ) {\n\n\t\tvar te = this.elements;\n\n\t\tif ( x.isVector3 ) {\n\n\t\t\tte[ 12 ] = x.x;\n\t\t\tte[ 13 ] = x.y;\n\t\t\tte[ 14 ] = x.z;\n\n\t\t} else {\n\n\t\t\tte[ 12 ] = x;\n\t\t\tte[ 13 ] = y;\n\t\t\tte[ 14 ] = z;\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tgetInverse: function ( m, throwOnDegenerate ) {\n\n\t\t// based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm\n\t\tvar te = this.elements,\n\t\t\tme = m.elements,\n\n\t\t\tn11 = me[ 0 ], n21 = me[ 1 ], n31 = me[ 2 ], n41 = me[ 3 ],\n\t\t\tn12 = me[ 4 ], n22 = me[ 5 ], n32 = me[ 6 ], n42 = me[ 7 ],\n\t\t\tn13 = me[ 8 ], n23 = me[ 9 ], n33 = me[ 10 ], n43 = me[ 11 ],\n\t\t\tn14 = me[ 12 ], n24 = me[ 13 ], n34 = me[ 14 ], n44 = me[ 15 ],\n\n\t\t\tt11 = n23 * n34 * n42 - n24 * n33 * n42 + n24 * n32 * n43 - n22 * n34 * n43 - n23 * n32 * n44 + n22 * n33 * n44,\n\t\t\tt12 = n14 * n33 * n42 - n13 * n34 * n42 - n14 * n32 * n43 + n12 * n34 * n43 + n13 * n32 * n44 - n12 * n33 * n44,\n\t\t\tt13 = n13 * n24 * n42 - n14 * n23 * n42 + n14 * n22 * n43 - n12 * n24 * n43 - n13 * n22 * n44 + n12 * n23 * n44,\n\t\t\tt14 = n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34;\n\n\t\tvar det = n11 * t11 + n21 * t12 + n31 * t13 + n41 * t14;\n\n\t\tif ( det === 0 ) {\n\n\t\t\tvar msg = \"THREE.Matrix4: .getInverse() can't invert matrix, determinant is 0\";\n\n\t\t\tif ( throwOnDegenerate === true ) {\n\n\t\t\t\tthrow new Error( msg );\n\n\t\t\t} else {\n\n\t\t\t\tconsole.warn( msg );\n\n\t\t\t}\n\n\t\t\treturn this.identity();\n\n\t\t}\n\n\t\tvar detInv = 1 / det;\n\n\t\tte[ 0 ] = t11 * detInv;\n\t\tte[ 1 ] = ( n24 * n33 * n41 - n23 * n34 * n41 - n24 * n31 * n43 + n21 * n34 * n43 + n23 * n31 * n44 - n21 * n33 * n44 ) * detInv;\n\t\tte[ 2 ] = ( n22 * n34 * n41 - n24 * n32 * n41 + n24 * n31 * n42 - n21 * n34 * n42 - n22 * n31 * n44 + n21 * n32 * n44 ) * detInv;\n\t\tte[ 3 ] = ( n23 * n32 * n41 - n22 * n33 * n41 - n23 * n31 * n42 + n21 * n33 * n42 + n22 * n31 * n43 - n21 * n32 * n43 ) * detInv;\n\n\t\tte[ 4 ] = t12 * detInv;\n\t\tte[ 5 ] = ( n13 * n34 * n41 - n14 * n33 * n41 + n14 * n31 * n43 - n11 * n34 * n43 - n13 * n31 * n44 + n11 * n33 * n44 ) * detInv;\n\t\tte[ 6 ] = ( n14 * n32 * n41 - n12 * n34 * n41 - n14 * n31 * n42 + n11 * n34 * n42 + n12 * n31 * n44 - n11 * n32 * n44 ) * detInv;\n\t\tte[ 7 ] = ( n12 * n33 * n41 - n13 * n32 * n41 + n13 * n31 * n42 - n11 * n33 * n42 - n12 * n31 * n43 + n11 * n32 * n43 ) * detInv;\n\n\t\tte[ 8 ] = t13 * detInv;\n\t\tte[ 9 ] = ( n14 * n23 * n41 - n13 * n24 * n41 - n14 * n21 * n43 + n11 * n24 * n43 + n13 * n21 * n44 - n11 * n23 * n44 ) * detInv;\n\t\tte[ 10 ] = ( n12 * n24 * n41 - n14 * n22 * n41 + n14 * n21 * n42 - n11 * n24 * n42 - n12 * n21 * n44 + n11 * n22 * n44 ) * detInv;\n\t\tte[ 11 ] = ( n13 * n22 * n41 - n12 * n23 * n41 - n13 * n21 * n42 + n11 * n23 * n42 + n12 * n21 * n43 - n11 * n22 * n43 ) * detInv;\n\n\t\tte[ 12 ] = t14 * detInv;\n\t\tte[ 13 ] = ( n13 * n24 * n31 - n14 * n23 * n31 + n14 * n21 * n33 - n11 * n24 * n33 - n13 * n21 * n34 + n11 * n23 * n34 ) * detInv;\n\t\tte[ 14 ] = ( n14 * n22 * n31 - n12 * n24 * n31 - n14 * n21 * n32 + n11 * n24 * n32 + n12 * n21 * n34 - n11 * n22 * n34 ) * detInv;\n\t\tte[ 15 ] = ( n12 * n23 * n31 - n13 * n22 * n31 + n13 * n21 * n32 - n11 * n23 * n32 - n12 * n21 * n33 + n11 * n22 * n33 ) * detInv;\n\n\t\treturn this;\n\n\t},\n\n\tscale: function ( v ) {\n\n\t\tvar te = this.elements;\n\t\tvar x = v.x, y = v.y, z = v.z;\n\n\t\tte[ 0 ] *= x; te[ 4 ] *= y; te[ 8 ] *= z;\n\t\tte[ 1 ] *= x; te[ 5 ] *= y; te[ 9 ] *= z;\n\t\tte[ 2 ] *= x; te[ 6 ] *= y; te[ 10 ] *= z;\n\t\tte[ 3 ] *= x; te[ 7 ] *= y; te[ 11 ] *= z;\n\n\t\treturn this;\n\n\t},\n\n\tgetMaxScaleOnAxis: function () {\n\n\t\tvar te = this.elements;\n\n\t\tvar scaleXSq = te[ 0 ] * te[ 0 ] + te[ 1 ] * te[ 1 ] + te[ 2 ] * te[ 2 ];\n\t\tvar scaleYSq = te[ 4 ] * te[ 4 ] + te[ 5 ] * te[ 5 ] + te[ 6 ] * te[ 6 ];\n\t\tvar scaleZSq = te[ 8 ] * te[ 8 ] + te[ 9 ] * te[ 9 ] + te[ 10 ] * te[ 10 ];\n\n\t\treturn Math.sqrt( Math.max( scaleXSq, scaleYSq, scaleZSq ) );\n\n\t},\n\n\tmakeTranslation: function ( x, y, z ) {\n\n\t\tthis.set(\n\n\t\t\t1, 0, 0, x,\n\t\t\t0, 1, 0, y,\n\t\t\t0, 0, 1, z,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t},\n\n\tmakeRotationX: function ( theta ) {\n\n\t\tvar c = Math.cos( theta ), s = Math.sin( theta );\n\n\t\tthis.set(\n\n\t\t\t1, 0, 0, 0,\n\t\t\t0, c, - s, 0,\n\t\t\t0, s, c, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t},\n\n\tmakeRotationY: function ( theta ) {\n\n\t\tvar c = Math.cos( theta ), s = Math.sin( theta );\n\n\t\tthis.set(\n\n\t\t\t c, 0, s, 0,\n\t\t\t 0, 1, 0, 0,\n\t\t\t- s, 0, c, 0,\n\t\t\t 0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t},\n\n\tmakeRotationZ: function ( theta ) {\n\n\t\tvar c = Math.cos( theta ), s = Math.sin( theta );\n\n\t\tthis.set(\n\n\t\t\tc, - s, 0, 0,\n\t\t\ts, c, 0, 0,\n\t\t\t0, 0, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t},\n\n\tmakeRotationAxis: function ( axis, angle ) {\n\n\t\t// Based on http://www.gamedev.net/reference/articles/article1199.asp\n\n\t\tvar c = Math.cos( angle );\n\t\tvar s = Math.sin( angle );\n\t\tvar t = 1 - c;\n\t\tvar x = axis.x, y = axis.y, z = axis.z;\n\t\tvar tx = t * x, ty = t * y;\n\n\t\tthis.set(\n\n\t\t\ttx * x + c, tx * y - s * z, tx * z + s * y, 0,\n\t\t\ttx * y + s * z, ty * y + c, ty * z - s * x, 0,\n\t\t\ttx * z - s * y, ty * z + s * x, t * z * z + c, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\t return this;\n\n\t},\n\n\tmakeScale: function ( x, y, z ) {\n\n\t\tthis.set(\n\n\t\t\tx, 0, 0, 0,\n\t\t\t0, y, 0, 0,\n\t\t\t0, 0, z, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t},\n\n\tmakeShear: function ( x, y, z ) {\n\n\t\tthis.set(\n\n\t\t\t1, y, z, 0,\n\t\t\tx, 1, z, 0,\n\t\t\tx, y, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t},\n\n\tcompose: function ( position, quaternion, scale ) {\n\n\t\tvar te = this.elements;\n\n\t\tvar x = quaternion._x, y = quaternion._y, z = quaternion._z, w = quaternion._w;\n\t\tvar x2 = x + x,\ty2 = y + y, z2 = z + z;\n\t\tvar xx = x * x2, xy = x * y2, xz = x * z2;\n\t\tvar yy = y * y2, yz = y * z2, zz = z * z2;\n\t\tvar wx = w * x2, wy = w * y2, wz = w * z2;\n\n\t\tvar sx = scale.x, sy = scale.y, sz = scale.z;\n\n\t\tte[ 0 ] = ( 1 - ( yy + zz ) ) * sx;\n\t\tte[ 1 ] = ( xy + wz ) * sx;\n\t\tte[ 2 ] = ( xz - wy ) * sx;\n\t\tte[ 3 ] = 0;\n\n\t\tte[ 4 ] = ( xy - wz ) * sy;\n\t\tte[ 5 ] = ( 1 - ( xx + zz ) ) * sy;\n\t\tte[ 6 ] = ( yz + wx ) * sy;\n\t\tte[ 7 ] = 0;\n\n\t\tte[ 8 ] = ( xz + wy ) * sz;\n\t\tte[ 9 ] = ( yz - wx ) * sz;\n\t\tte[ 10 ] = ( 1 - ( xx + yy ) ) * sz;\n\t\tte[ 11 ] = 0;\n\n\t\tte[ 12 ] = position.x;\n\t\tte[ 13 ] = position.y;\n\t\tte[ 14 ] = position.z;\n\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t},\n\n\tdecompose: function ( position, quaternion, scale ) {\n\n\t\tvar te = this.elements;\n\n\t\tvar sx = _v1.set( te[ 0 ], te[ 1 ], te[ 2 ] ).length();\n\t\tvar sy = _v1.set( te[ 4 ], te[ 5 ], te[ 6 ] ).length();\n\t\tvar sz = _v1.set( te[ 8 ], te[ 9 ], te[ 10 ] ).length();\n\n\t\t// if determine is negative, we need to invert one scale\n\t\tvar det = this.determinant();\n\t\tif ( det < 0 ) sx = - sx;\n\n\t\tposition.x = te[ 12 ];\n\t\tposition.y = te[ 13 ];\n\t\tposition.z = te[ 14 ];\n\n\t\t// scale the rotation part\n\t\t_m1.copy( this );\n\n\t\tvar invSX = 1 / sx;\n\t\tvar invSY = 1 / sy;\n\t\tvar invSZ = 1 / sz;\n\n\t\t_m1.elements[ 0 ] *= invSX;\n\t\t_m1.elements[ 1 ] *= invSX;\n\t\t_m1.elements[ 2 ] *= invSX;\n\n\t\t_m1.elements[ 4 ] *= invSY;\n\t\t_m1.elements[ 5 ] *= invSY;\n\t\t_m1.elements[ 6 ] *= invSY;\n\n\t\t_m1.elements[ 8 ] *= invSZ;\n\t\t_m1.elements[ 9 ] *= invSZ;\n\t\t_m1.elements[ 10 ] *= invSZ;\n\n\t\tquaternion.setFromRotationMatrix( _m1 );\n\n\t\tscale.x = sx;\n\t\tscale.y = sy;\n\t\tscale.z = sz;\n\n\t\treturn this;\n\n\t},\n\n\tmakePerspective: function ( left, right, top, bottom, near, far ) {\n\n\t\tif ( far === undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.' );\n\n\t\t}\n\n\t\tvar te = this.elements;\n\t\tvar x = 2 * near / ( right - left );\n\t\tvar y = 2 * near / ( top - bottom );\n\n\t\tvar a = ( right + left ) / ( right - left );\n\t\tvar b = ( top + bottom ) / ( top - bottom );\n\t\tvar c = - ( far + near ) / ( far - near );\n\t\tvar d = - 2 * far * near / ( far - near );\n\n\t\tte[ 0 ] = x;\tte[ 4 ] = 0;\tte[ 8 ] = a;\tte[ 12 ] = 0;\n\t\tte[ 1 ] = 0;\tte[ 5 ] = y;\tte[ 9 ] = b;\tte[ 13 ] = 0;\n\t\tte[ 2 ] = 0;\tte[ 6 ] = 0;\tte[ 10 ] = c;\tte[ 14 ] = d;\n\t\tte[ 3 ] = 0;\tte[ 7 ] = 0;\tte[ 11 ] = - 1;\tte[ 15 ] = 0;\n\n\t\treturn this;\n\n\t},\n\n\tmakeOrthographic: function ( left, right, top, bottom, near, far ) {\n\n\t\tvar te = this.elements;\n\t\tvar w = 1.0 / ( right - left );\n\t\tvar h = 1.0 / ( top - bottom );\n\t\tvar p = 1.0 / ( far - near );\n\n\t\tvar x = ( right + left ) * w;\n\t\tvar y = ( top + bottom ) * h;\n\t\tvar z = ( far + near ) * p;\n\n\t\tte[ 0 ] = 2 * w;\tte[ 4 ] = 0;\tte[ 8 ] = 0;\tte[ 12 ] = - x;\n\t\tte[ 1 ] = 0;\tte[ 5 ] = 2 * h;\tte[ 9 ] = 0;\tte[ 13 ] = - y;\n\t\tte[ 2 ] = 0;\tte[ 6 ] = 0;\tte[ 10 ] = - 2 * p;\tte[ 14 ] = - z;\n\t\tte[ 3 ] = 0;\tte[ 7 ] = 0;\tte[ 11 ] = 0;\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t},\n\n\tequals: function ( matrix ) {\n\n\t\tvar te = this.elements;\n\t\tvar me = matrix.elements;\n\n\t\tfor ( var i = 0; i < 16; i ++ ) {\n\n\t\t\tif ( te[ i ] !== me[ i ] ) return false;\n\n\t\t}\n\n\t\treturn true;\n\n\t},\n\n\tfromArray: function ( array, offset ) {\n\n\t\tif ( offset === undefined ) offset = 0;\n\n\t\tfor ( var i = 0; i < 16; i ++ ) {\n\n\t\t\tthis.elements[ i ] = array[ i + offset ];\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\ttoArray: function ( array, offset ) {\n\n\t\tif ( array === undefined ) array = [];\n\t\tif ( offset === undefined ) offset = 0;\n\n\t\tvar te = this.elements;\n\n\t\tarray[ offset ] = te[ 0 ];\n\t\tarray[ offset + 1 ] = te[ 1 ];\n\t\tarray[ offset + 2 ] = te[ 2 ];\n\t\tarray[ offset + 3 ] = te[ 3 ];\n\n\t\tarray[ offset + 4 ] = te[ 4 ];\n\t\tarray[ offset + 5 ] = te[ 5 ];\n\t\tarray[ offset + 6 ] = te[ 6 ];\n\t\tarray[ offset + 7 ] = te[ 7 ];\n\n\t\tarray[ offset + 8 ] = te[ 8 ];\n\t\tarray[ offset + 9 ] = te[ 9 ];\n\t\tarray[ offset + 10 ] = te[ 10 ];\n\t\tarray[ offset + 11 ] = te[ 11 ];\n\n\t\tarray[ offset + 12 ] = te[ 12 ];\n\t\tarray[ offset + 13 ] = te[ 13 ];\n\t\tarray[ offset + 14 ] = te[ 14 ];\n\t\tarray[ offset + 15 ] = te[ 15 ];\n\n\t\treturn array;\n\n\t}\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n * @author WestLangley / http://github.com/WestLangley\n * @author bhouston / http://clara.io\n */\n\nvar _matrix = new Matrix4();\nvar _quaternion$1 = new Quaternion();\n\nfunction Euler( x, y, z, order ) {\n\n\tthis._x = x || 0;\n\tthis._y = y || 0;\n\tthis._z = z || 0;\n\tthis._order = order || Euler.DefaultOrder;\n\n}\n\nEuler.RotationOrders = [ 'XYZ', 'YZX', 'ZXY', 'XZY', 'YXZ', 'ZYX' ];\n\nEuler.DefaultOrder = 'XYZ';\n\nObject.defineProperties( Euler.prototype, {\n\n\tx: {\n\n\t\tget: function () {\n\n\t\t\treturn this._x;\n\n\t\t},\n\n\t\tset: function ( value ) {\n\n\t\t\tthis._x = value;\n\t\t\tthis._onChangeCallback();\n\n\t\t}\n\n\t},\n\n\ty: {\n\n\t\tget: function () {\n\n\t\t\treturn this._y;\n\n\t\t},\n\n\t\tset: function ( value ) {\n\n\t\t\tthis._y = value;\n\t\t\tthis._onChangeCallback();\n\n\t\t}\n\n\t},\n\n\tz: {\n\n\t\tget: function () {\n\n\t\t\treturn this._z;\n\n\t\t},\n\n\t\tset: function ( value ) {\n\n\t\t\tthis._z = value;\n\t\t\tthis._onChangeCallback();\n\n\t\t}\n\n\t},\n\n\torder: {\n\n\t\tget: function () {\n\n\t\t\treturn this._order;\n\n\t\t},\n\n\t\tset: function ( value ) {\n\n\t\t\tthis._order = value;\n\t\t\tthis._onChangeCallback();\n\n\t\t}\n\n\t}\n\n} );\n\nObject.assign( Euler.prototype, {\n\n\tisEuler: true,\n\n\tset: function ( x, y, z, order ) {\n\n\t\tthis._x = x;\n\t\tthis._y = y;\n\t\tthis._z = z;\n\t\tthis._order = order || this._order;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t},\n\n\tclone: function () {\n\n\t\treturn new this.constructor( this._x, this._y, this._z, this._order );\n\n\t},\n\n\tcopy: function ( euler ) {\n\n\t\tthis._x = euler._x;\n\t\tthis._y = euler._y;\n\t\tthis._z = euler._z;\n\t\tthis._order = euler._order;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t},\n\n\tsetFromRotationMatrix: function ( m, order, update ) {\n\n\t\tvar clamp = MathUtils.clamp;\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tvar te = m.elements;\n\t\tvar m11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ];\n\t\tvar m21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ];\n\t\tvar m31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ];\n\n\t\torder = order || this._order;\n\n\t\tif ( order === 'XYZ' ) {\n\n\t\t\tthis._y = Math.asin( clamp( m13, - 1, 1 ) );\n\n\t\t\tif ( Math.abs( m13 ) < 0.9999999 ) {\n\n\t\t\t\tthis._x = Math.atan2( - m23, m33 );\n\t\t\t\tthis._z = Math.atan2( - m12, m11 );\n\n\t\t\t} else {\n\n\t\t\t\tthis._x = Math.atan2( m32, m22 );\n\t\t\t\tthis._z = 0;\n\n\t\t\t}\n\n\t\t} else if ( order === 'YXZ' ) {\n\n\t\t\tthis._x = Math.asin( - clamp( m23, - 1, 1 ) );\n\n\t\t\tif ( Math.abs( m23 ) < 0.9999999 ) {\n\n\t\t\t\tthis._y = Math.atan2( m13, m33 );\n\t\t\t\tthis._z = Math.atan2( m21, m22 );\n\n\t\t\t} else {\n\n\t\t\t\tthis._y = Math.atan2( - m31, m11 );\n\t\t\t\tthis._z = 0;\n\n\t\t\t}\n\n\t\t} else if ( order === 'ZXY' ) {\n\n\t\t\tthis._x = Math.asin( clamp( m32, - 1, 1 ) );\n\n\t\t\tif ( Math.abs( m32 ) < 0.9999999 ) {\n\n\t\t\t\tthis._y = Math.atan2( - m31, m33 );\n\t\t\t\tthis._z = Math.atan2( - m12, m22 );\n\n\t\t\t} else {\n\n\t\t\t\tthis._y = 0;\n\t\t\t\tthis._z = Math.atan2( m21, m11 );\n\n\t\t\t}\n\n\t\t} else if ( order === 'ZYX' ) {\n\n\t\t\tthis._y = Math.asin( - clamp( m31, - 1, 1 ) );\n\n\t\t\tif ( Math.abs( m31 ) < 0.9999999 ) {\n\n\t\t\t\tthis._x = Math.atan2( m32, m33 );\n\t\t\t\tthis._z = Math.atan2( m21, m11 );\n\n\t\t\t} else {\n\n\t\t\t\tthis._x = 0;\n\t\t\t\tthis._z = Math.atan2( - m12, m22 );\n\n\t\t\t}\n\n\t\t} else if ( order === 'YZX' ) {\n\n\t\t\tthis._z = Math.asin( clamp( m21, - 1, 1 ) );\n\n\t\t\tif ( Math.abs( m21 ) < 0.9999999 ) {\n\n\t\t\t\tthis._x = Math.atan2( - m23, m22 );\n\t\t\t\tthis._y = Math.atan2( - m31, m11 );\n\n\t\t\t} else {\n\n\t\t\t\tthis._x = 0;\n\t\t\t\tthis._y = Math.atan2( m13, m33 );\n\n\t\t\t}\n\n\t\t} else if ( order === 'XZY' ) {\n\n\t\t\tthis._z = Math.asin( - clamp( m12, - 1, 1 ) );\n\n\t\t\tif ( Math.abs( m12 ) < 0.9999999 ) {\n\n\t\t\t\tthis._x = Math.atan2( m32, m22 );\n\t\t\t\tthis._y = Math.atan2( m13, m11 );\n\n\t\t\t} else {\n\n\t\t\t\tthis._x = Math.atan2( - m23, m33 );\n\t\t\t\tthis._y = 0;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.Euler: .setFromRotationMatrix() given unsupported order: ' + order );\n\n\t\t}\n\n\t\tthis._order = order;\n\n\t\tif ( update !== false ) this._onChangeCallback();\n\n\t\treturn this;\n\n\t},\n\n\tsetFromQuaternion: function ( q, order, update ) {\n\n\t\t_matrix.makeRotationFromQuaternion( q );\n\n\t\treturn this.setFromRotationMatrix( _matrix, order, update );\n\n\t},\n\n\tsetFromVector3: function ( v, order ) {\n\n\t\treturn this.set( v.x, v.y, v.z, order || this._order );\n\n\t},\n\n\treorder: function ( newOrder ) {\n\n\t\t// WARNING: this discards revolution information -bhouston\n\n\t\t_quaternion$1.setFromEuler( this );\n\n\t\treturn this.setFromQuaternion( _quaternion$1, newOrder );\n\n\t},\n\n\tequals: function ( euler ) {\n\n\t\treturn ( euler._x === this._x ) && ( euler._y === this._y ) && ( euler._z === this._z ) && ( euler._order === this._order );\n\n\t},\n\n\tfromArray: function ( array ) {\n\n\t\tthis._x = array[ 0 ];\n\t\tthis._y = array[ 1 ];\n\t\tthis._z = array[ 2 ];\n\t\tif ( array[ 3 ] !== undefined ) this._order = array[ 3 ];\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t},\n\n\ttoArray: function ( array, offset ) {\n\n\t\tif ( array === undefined ) array = [];\n\t\tif ( offset === undefined ) offset = 0;\n\n\t\tarray[ offset ] = this._x;\n\t\tarray[ offset + 1 ] = this._y;\n\t\tarray[ offset + 2 ] = this._z;\n\t\tarray[ offset + 3 ] = this._order;\n\n\t\treturn array;\n\n\t},\n\n\ttoVector3: function ( optionalResult ) {\n\n\t\tif ( optionalResult ) {\n\n\t\t\treturn optionalResult.set( this._x, this._y, this._z );\n\n\t\t} else {\n\n\t\t\treturn new Vector3( this._x, this._y, this._z );\n\n\t\t}\n\n\t},\n\n\t_onChange: function ( callback ) {\n\n\t\tthis._onChangeCallback = callback;\n\n\t\treturn this;\n\n\t},\n\n\t_onChangeCallback: function () {}\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction Layers() {\n\n\tthis.mask = 1 | 0;\n\n}\n\nObject.assign( Layers.prototype, {\n\n\tset: function ( channel ) {\n\n\t\tthis.mask = 1 << channel | 0;\n\n\t},\n\n\tenable: function ( channel ) {\n\n\t\tthis.mask |= 1 << channel | 0;\n\n\t},\n\n\tenableAll: function () {\n\n\t\tthis.mask = 0xffffffff | 0;\n\n\t},\n\n\ttoggle: function ( channel ) {\n\n\t\tthis.mask ^= 1 << channel | 0;\n\n\t},\n\n\tdisable: function ( channel ) {\n\n\t\tthis.mask &= ~ ( 1 << channel | 0 );\n\n\t},\n\n\tdisableAll: function () {\n\n\t\tthis.mask = 0;\n\n\t},\n\n\ttest: function ( layers ) {\n\n\t\treturn ( this.mask & layers.mask ) !== 0;\n\n\t}\n\n} );\n\nvar _object3DId = 0;\n\nvar _v1$1 = new Vector3();\nvar _q1 = new Quaternion();\nvar _m1$1 = new Matrix4();\nvar _target = new Vector3();\n\nvar _position = new Vector3();\nvar _scale = new Vector3();\nvar _quaternion$2 = new Quaternion();\n\nvar _xAxis = new Vector3( 1, 0, 0 );\nvar _yAxis = new Vector3( 0, 1, 0 );\nvar _zAxis = new Vector3( 0, 0, 1 );\n\nvar _addedEvent = { type: 'added' };\nvar _removedEvent = { type: 'removed' };\n\n/**\n * @author mrdoob / http://mrdoob.com/\n * @author mikael emtinger / http://gomo.se/\n * @author alteredq / http://alteredqualia.com/\n * @author WestLangley / http://github.com/WestLangley\n * @author elephantatwork / www.elephantatwork.ch\n */\n\nfunction Object3D() {\n\n\tObject.defineProperty( this, 'id', { value: _object3DId ++ } );\n\n\tthis.uuid = MathUtils.generateUUID();\n\n\tthis.name = '';\n\tthis.type = 'Object3D';\n\n\tthis.parent = null;\n\tthis.children = [];\n\n\tthis.up = Object3D.DefaultUp.clone();\n\n\tvar position = new Vector3();\n\tvar rotation = new Euler();\n\tvar quaternion = new Quaternion();\n\tvar scale = new Vector3( 1, 1, 1 );\n\n\tfunction onRotationChange() {\n\n\t\tquaternion.setFromEuler( rotation, false );\n\n\t}\n\n\tfunction onQuaternionChange() {\n\n\t\trotation.setFromQuaternion( quaternion, undefined, false );\n\n\t}\n\n\trotation._onChange( onRotationChange );\n\tquaternion._onChange( onQuaternionChange );\n\n\tObject.defineProperties( this, {\n\t\tposition: {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: true,\n\t\t\tvalue: position\n\t\t},\n\t\trotation: {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: true,\n\t\t\tvalue: rotation\n\t\t},\n\t\tquaternion: {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: true,\n\t\t\tvalue: quaternion\n\t\t},\n\t\tscale: {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: true,\n\t\t\tvalue: scale\n\t\t},\n\t\tmodelViewMatrix: {\n\t\t\tvalue: new Matrix4()\n\t\t},\n\t\tnormalMatrix: {\n\t\t\tvalue: new Matrix3()\n\t\t}\n\t} );\n\n\tthis.matrix = new Matrix4();\n\tthis.matrixWorld = new Matrix4();\n\n\tthis.matrixAutoUpdate = Object3D.DefaultMatrixAutoUpdate;\n\tthis.matrixWorldNeedsUpdate = false;\n\n\tthis.layers = new Layers();\n\tthis.visible = true;\n\n\tthis.castShadow = false;\n\tthis.receiveShadow = false;\n\n\tthis.frustumCulled = true;\n\tthis.renderOrder = 0;\n\n\tthis.userData = {};\n\n}\n\nObject3D.DefaultUp = new Vector3( 0, 1, 0 );\nObject3D.DefaultMatrixAutoUpdate = true;\n\nObject3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ), {\n\n\tconstructor: Object3D,\n\n\tisObject3D: true,\n\n\tonBeforeRender: function () {},\n\tonAfterRender: function () {},\n\n\tapplyMatrix4: function ( matrix ) {\n\n\t\tif ( this.matrixAutoUpdate ) this.updateMatrix();\n\n\t\tthis.matrix.premultiply( matrix );\n\n\t\tthis.matrix.decompose( this.position, this.quaternion, this.scale );\n\n\t},\n\n\tapplyQuaternion: function ( q ) {\n\n\t\tthis.quaternion.premultiply( q );\n\n\t\treturn this;\n\n\t},\n\n\tsetRotationFromAxisAngle: function ( axis, angle ) {\n\n\t\t// assumes axis is normalized\n\n\t\tthis.quaternion.setFromAxisAngle( axis, angle );\n\n\t},\n\n\tsetRotationFromEuler: function ( euler ) {\n\n\t\tthis.quaternion.setFromEuler( euler, true );\n\n\t},\n\n\tsetRotationFromMatrix: function ( m ) {\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tthis.quaternion.setFromRotationMatrix( m );\n\n\t},\n\n\tsetRotationFromQuaternion: function ( q ) {\n\n\t\t// assumes q is normalized\n\n\t\tthis.quaternion.copy( q );\n\n\t},\n\n\trotateOnAxis: function ( axis, angle ) {\n\n\t\t// rotate object on axis in object space\n\t\t// axis is assumed to be normalized\n\n\t\t_q1.setFromAxisAngle( axis, angle );\n\n\t\tthis.quaternion.multiply( _q1 );\n\n\t\treturn this;\n\n\t},\n\n\trotateOnWorldAxis: function ( axis, angle ) {\n\n\t\t// rotate object on axis in world space\n\t\t// axis is assumed to be normalized\n\t\t// method assumes no rotated parent\n\n\t\t_q1.setFromAxisAngle( axis, angle );\n\n\t\tthis.quaternion.premultiply( _q1 );\n\n\t\treturn this;\n\n\t},\n\n\trotateX: function ( angle ) {\n\n\t\treturn this.rotateOnAxis( _xAxis, angle );\n\n\t},\n\n\trotateY: function ( angle ) {\n\n\t\treturn this.rotateOnAxis( _yAxis, angle );\n\n\t},\n\n\trotateZ: function ( angle ) {\n\n\t\treturn this.rotateOnAxis( _zAxis, angle );\n\n\t},\n\n\ttranslateOnAxis: function ( axis, distance ) {\n\n\t\t// translate object by distance along axis in object space\n\t\t// axis is assumed to be normalized\n\n\t\t_v1$1.copy( axis ).applyQuaternion( this.quaternion );\n\n\t\tthis.position.add( _v1$1.multiplyScalar( distance ) );\n\n\t\treturn this;\n\n\t},\n\n\ttranslateX: function ( distance ) {\n\n\t\treturn this.translateOnAxis( _xAxis, distance );\n\n\t},\n\n\ttranslateY: function ( distance ) {\n\n\t\treturn this.translateOnAxis( _yAxis, distance );\n\n\t},\n\n\ttranslateZ: function ( distance ) {\n\n\t\treturn this.translateOnAxis( _zAxis, distance );\n\n\t},\n\n\tlocalToWorld: function ( vector ) {\n\n\t\treturn vector.applyMatrix4( this.matrixWorld );\n\n\t},\n\n\tworldToLocal: function ( vector ) {\n\n\t\treturn vector.applyMatrix4( _m1$1.getInverse( this.matrixWorld ) );\n\n\t},\n\n\tlookAt: function ( x, y, z ) {\n\n\t\t// This method does not support objects having non-uniformly-scaled parent(s)\n\n\t\tif ( x.isVector3 ) {\n\n\t\t\t_target.copy( x );\n\n\t\t} else {\n\n\t\t\t_target.set( x, y, z );\n\n\t\t}\n\n\t\tvar parent = this.parent;\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\t_position.setFromMatrixPosition( this.matrixWorld );\n\n\t\tif ( this.isCamera || this.isLight ) {\n\n\t\t\t_m1$1.lookAt( _position, _target, this.up );\n\n\t\t} else {\n\n\t\t\t_m1$1.lookAt( _target, _position, this.up );\n\n\t\t}\n\n\t\tthis.quaternion.setFromRotationMatrix( _m1$1 );\n\n\t\tif ( parent ) {\n\n\t\t\t_m1$1.extractRotation( parent.matrixWorld );\n\t\t\t_q1.setFromRotationMatrix( _m1$1 );\n\t\t\tthis.quaternion.premultiply( _q1.inverse() );\n\n\t\t}\n\n\t},\n\n\tadd: function ( object ) {\n\n\t\tif ( arguments.length > 1 ) {\n\n\t\t\tfor ( var i = 0; i < arguments.length; i ++ ) {\n\n\t\t\t\tthis.add( arguments[ i ] );\n\n\t\t\t}\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tif ( object === this ) {\n\n\t\t\tconsole.error( \"THREE.Object3D.add: object can't be added as a child of itself.\", object );\n\t\t\treturn this;\n\n\t\t}\n\n\t\tif ( ( object && object.isObject3D ) ) {\n\n\t\t\tif ( object.parent !== null ) {\n\n\t\t\t\tobject.parent.remove( object );\n\n\t\t\t}\n\n\t\t\tobject.parent = this;\n\t\t\tthis.children.push( object );\n\n\t\t\tobject.dispatchEvent( _addedEvent );\n\n\t\t} else {\n\n\t\t\tconsole.error( \"THREE.Object3D.add: object not an instance of THREE.Object3D.\", object );\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tremove: function ( object ) {\n\n\t\tif ( arguments.length > 1 ) {\n\n\t\t\tfor ( var i = 0; i < arguments.length; i ++ ) {\n\n\t\t\t\tthis.remove( arguments[ i ] );\n\n\t\t\t}\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tvar index = this.children.indexOf( object );\n\n\t\tif ( index !== - 1 ) {\n\n\t\t\tobject.parent = null;\n\t\t\tthis.children.splice( index, 1 );\n\n\t\t\tobject.dispatchEvent( _removedEvent );\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tattach: function ( object ) {\n\n\t\t// adds object as a child of this, while maintaining the object's world transform\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\t_m1$1.getInverse( this.matrixWorld );\n\n\t\tif ( object.parent !== null ) {\n\n\t\t\tobject.parent.updateWorldMatrix( true, false );\n\n\t\t\t_m1$1.multiply( object.parent.matrixWorld );\n\n\t\t}\n\n\t\tobject.applyMatrix4( _m1$1 );\n\n\t\tobject.updateWorldMatrix( false, false );\n\n\t\tthis.add( object );\n\n\t\treturn this;\n\n\t},\n\n\tgetObjectById: function ( id ) {\n\n\t\treturn this.getObjectByProperty( 'id', id );\n\n\t},\n\n\tgetObjectByName: function ( name ) {\n\n\t\treturn this.getObjectByProperty( 'name', name );\n\n\t},\n\n\tgetObjectByProperty: function ( name, value ) {\n\n\t\tif ( this[ name ] === value ) return this;\n\n\t\tfor ( var i = 0, l = this.children.length; i < l; i ++ ) {\n\n\t\t\tvar child = this.children[ i ];\n\t\t\tvar object = child.getObjectByProperty( name, value );\n\n\t\t\tif ( object !== undefined ) {\n\n\t\t\t\treturn object;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn undefined;\n\n\t},\n\n\tgetWorldPosition: function ( target ) {\n\n\t\tif ( target === undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Object3D: .getWorldPosition() target is now required' );\n\t\t\ttarget = new Vector3();\n\n\t\t}\n\n\t\tthis.updateMatrixWorld( true );\n\n\t\treturn target.setFromMatrixPosition( this.matrixWorld );\n\n\t},\n\n\tgetWorldQuaternion: function ( target ) {\n\n\t\tif ( target === undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Object3D: .getWorldQuaternion() target is now required' );\n\t\t\ttarget = new Quaternion();\n\n\t\t}\n\n\t\tthis.updateMatrixWorld( true );\n\n\t\tthis.matrixWorld.decompose( _position, target, _scale );\n\n\t\treturn target;\n\n\t},\n\n\tgetWorldScale: function ( target ) {\n\n\t\tif ( target === undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Object3D: .getWorldScale() target is now required' );\n\t\t\ttarget = new Vector3();\n\n\t\t}\n\n\t\tthis.updateMatrixWorld( true );\n\n\t\tthis.matrixWorld.decompose( _position, _quaternion$2, target );\n\n\t\treturn target;\n\n\t},\n\n\tgetWorldDirection: function ( target ) {\n\n\t\tif ( target === undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Object3D: .getWorldDirection() target is now required' );\n\t\t\ttarget = new Vector3();\n\n\t\t}\n\n\t\tthis.updateMatrixWorld( true );\n\n\t\tvar e = this.matrixWorld.elements;\n\n\t\treturn target.set( e[ 8 ], e[ 9 ], e[ 10 ] ).normalize();\n\n\t},\n\n\traycast: function () {},\n\n\ttraverse: function ( callback ) {\n\n\t\tcallback( this );\n\n\t\tvar children = this.children;\n\n\t\tfor ( var i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tchildren[ i ].traverse( callback );\n\n\t\t}\n\n\t},\n\n\ttraverseVisible: function ( callback ) {\n\n\t\tif ( this.visible === false ) return;\n\n\t\tcallback( this );\n\n\t\tvar children = this.children;\n\n\t\tfor ( var i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tchildren[ i ].traverseVisible( callback );\n\n\t\t}\n\n\t},\n\n\ttraverseAncestors: function ( callback ) {\n\n\t\tvar parent = this.parent;\n\n\t\tif ( parent !== null ) {\n\n\t\t\tcallback( parent );\n\n\t\t\tparent.traverseAncestors( callback );\n\n\t\t}\n\n\t},\n\n\tupdateMatrix: function () {\n\n\t\tthis.matrix.compose( this.position, this.quaternion, this.scale );\n\n\t\tthis.matrixWorldNeedsUpdate = true;\n\n\t},\n\n\tupdateMatrixWorld: function ( force ) {\n\n\t\tif ( this.matrixAutoUpdate ) this.updateMatrix();\n\n\t\tif ( this.matrixWorldNeedsUpdate || force ) {\n\n\t\t\tif ( this.parent === null ) {\n\n\t\t\t\tthis.matrixWorld.copy( this.matrix );\n\n\t\t\t} else {\n\n\t\t\t\tthis.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );\n\n\t\t\t}\n\n\t\t\tthis.matrixWorldNeedsUpdate = false;\n\n\t\t\tforce = true;\n\n\t\t}\n\n\t\t// update children\n\n\t\tvar children = this.children;\n\n\t\tfor ( var i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tchildren[ i ].updateMatrixWorld( force );\n\n\t\t}\n\n\t},\n\n\tupdateWorldMatrix: function ( updateParents, updateChildren ) {\n\n\t\tvar parent = this.parent;\n\n\t\tif ( updateParents === true && parent !== null ) {\n\n\t\t\tparent.updateWorldMatrix( true, false );\n\n\t\t}\n\n\t\tif ( this.matrixAutoUpdate ) this.updateMatrix();\n\n\t\tif ( this.parent === null ) {\n\n\t\t\tthis.matrixWorld.copy( this.matrix );\n\n\t\t} else {\n\n\t\t\tthis.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );\n\n\t\t}\n\n\t\t// update children\n\n\t\tif ( updateChildren === true ) {\n\n\t\t\tvar children = this.children;\n\n\t\t\tfor ( var i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\t\tchildren[ i ].updateWorldMatrix( false, true );\n\n\t\t\t}\n\n\t\t}\n\n\t},\n\n\ttoJSON: function ( meta ) {\n\n\t\t// meta is a string when called from JSON.stringify\n\t\tvar isRootObject = ( meta === undefined || typeof meta === 'string' );\n\n\t\tvar output = {};\n\n\t\t// meta is a hash used to collect geometries, materials.\n\t\t// not providing it implies that this is the root object\n\t\t// being serialized.\n\t\tif ( isRootObject ) {\n\n\t\t\t// initialize meta obj\n\t\t\tmeta = {\n\t\t\t\tgeometries: {},\n\t\t\t\tmaterials: {},\n\t\t\t\ttextures: {},\n\t\t\t\timages: {},\n\t\t\t\tshapes: {}\n\t\t\t};\n\n\t\t\toutput.metadata = {\n\t\t\t\tversion: 4.5,\n\t\t\t\ttype: 'Object',\n\t\t\t\tgenerator: 'Object3D.toJSON'\n\t\t\t};\n\n\t\t}\n\n\t\t// standard Object3D serialization\n\n\t\tvar object = {};\n\n\t\tobject.uuid = this.uuid;\n\t\tobject.type = this.type;\n\n\t\tif ( this.name !== '' ) object.name = this.name;\n\t\tif ( this.castShadow === true ) object.castShadow = true;\n\t\tif ( this.receiveShadow === true ) object.receiveShadow = true;\n\t\tif ( this.visible === false ) object.visible = false;\n\t\tif ( this.frustumCulled === false ) object.frustumCulled = false;\n\t\tif ( this.renderOrder !== 0 ) object.renderOrder = this.renderOrder;\n\t\tif ( JSON.stringify( this.userData ) !== '{}' ) object.userData = this.userData;\n\n\t\tobject.layers = this.layers.mask;\n\t\tobject.matrix = this.matrix.toArray();\n\n\t\tif ( this.matrixAutoUpdate === false ) object.matrixAutoUpdate = false;\n\n\t\t// object specific properties\n\n\t\tif ( this.isInstancedMesh ) {\n\n\t\t\tobject.type = 'InstancedMesh';\n\t\t\tobject.count = this.count;\n\t\t\tobject.instanceMatrix = this.instanceMatrix.toJSON();\n\n\t\t}\n\n\t\t//\n\n\t\tfunction serialize( library, element ) {\n\n\t\t\tif ( library[ element.uuid ] === undefined ) {\n\n\t\t\t\tlibrary[ element.uuid ] = element.toJSON( meta );\n\n\t\t\t}\n\n\t\t\treturn element.uuid;\n\n\t\t}\n\n\t\tif ( this.isMesh || this.isLine || this.isPoints ) {\n\n\t\t\tobject.geometry = serialize( meta.geometries, this.geometry );\n\n\t\t\tvar parameters = this.geometry.parameters;\n\n\t\t\tif ( parameters !== undefined && parameters.shapes !== undefined ) {\n\n\t\t\t\tvar shapes = parameters.shapes;\n\n\t\t\t\tif ( Array.isArray( shapes ) ) {\n\n\t\t\t\t\tfor ( var i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\t\t\t\tvar shape = shapes[ i ];\n\n\t\t\t\t\t\tserialize( meta.shapes, shape );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tserialize( meta.shapes, shapes );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.material !== undefined ) {\n\n\t\t\tif ( Array.isArray( this.material ) ) {\n\n\t\t\t\tvar uuids = [];\n\n\t\t\t\tfor ( var i = 0, l = this.material.length; i < l; i ++ ) {\n\n\t\t\t\t\tuuids.push( serialize( meta.materials, this.material[ i ] ) );\n\n\t\t\t\t}\n\n\t\t\t\tobject.material = uuids;\n\n\t\t\t} else {\n\n\t\t\t\tobject.material = serialize( meta.materials, this.material );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tif ( this.children.length > 0 ) {\n\n\t\t\tobject.children = [];\n\n\t\t\tfor ( var i = 0; i < this.children.length; i ++ ) {\n\n\t\t\t\tobject.children.push( this.children[ i ].toJSON( meta ).object );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( isRootObject ) {\n\n\t\t\tvar geometries = extractFromCache( meta.geometries );\n\t\t\tvar materials = extractFromCache( meta.materials );\n\t\t\tvar textures = extractFromCache( meta.textures );\n\t\t\tvar images = extractFromCache( meta.images );\n\t\t\tvar shapes = extractFromCache( meta.shapes );\n\n\t\t\tif ( geometries.length > 0 ) output.geometries = geometries;\n\t\t\tif ( materials.length > 0 ) output.materials = materials;\n\t\t\tif ( textures.length > 0 ) output.textures = textures;\n\t\t\tif ( images.length > 0 ) output.images = images;\n\t\t\tif ( shapes.length > 0 ) output.shapes = shapes;\n\n\t\t}\n\n\t\toutput.object = object;\n\n\t\treturn output;\n\n\t\t// extract data from the cache hash\n\t\t// remove metadata on each item\n\t\t// and return as array\n\t\tfunction extractFromCache( cache ) {\n\n\t\t\tvar values = [];\n\t\t\tfor ( var key in cache ) {\n\n\t\t\t\tvar data = cache[ key ];\n\t\t\t\tdelete data.metadata;\n\t\t\t\tvalues.push( data );\n\n\t\t\t}\n\t\t\treturn values;\n\n\t\t}\n\n\t},\n\n\tclone: function ( recursive ) {\n\n\t\treturn new this.constructor().copy( this, recursive );\n\n\t},\n\n\tcopy: function ( source, recursive ) {\n\n\t\tif ( recursive === undefined ) recursive = true;\n\n\t\tthis.name = source.name;\n\n\t\tthis.up.copy( source.up );\n\n\t\tthis.position.copy( source.position );\n\t\tthis.quaternion.copy( source.quaternion );\n\t\tthis.scale.copy( source.scale );\n\n\t\tthis.matrix.copy( source.matrix );\n\t\tthis.matrixWorld.copy( source.matrixWorld );\n\n\t\tthis.matrixAutoUpdate = source.matrixAutoUpdate;\n\t\tthis.matrixWorldNeedsUpdate = source.matrixWorldNeedsUpdate;\n\n\t\tthis.layers.mask = source.layers.mask;\n\t\tthis.visible = source.visible;\n\n\t\tthis.castShadow = source.castShadow;\n\t\tthis.receiveShadow = source.receiveShadow;\n\n\t\tthis.frustumCulled = source.frustumCulled;\n\t\tthis.renderOrder = source.renderOrder;\n\n\t\tthis.userData = JSON.parse( JSON.stringify( source.userData ) );\n\n\t\tif ( recursive === true ) {\n\n\t\t\tfor ( var i = 0; i < source.children.length; i ++ ) {\n\n\t\t\t\tvar child = source.children[ i ];\n\t\t\t\tthis.add( child.clone() );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction Scene() {\n\n\tObject3D.call( this );\n\n\tthis.type = 'Scene';\n\n\tthis.background = null;\n\tthis.environment = null;\n\tthis.fog = null;\n\n\tthis.overrideMaterial = null;\n\n\tthis.autoUpdate = true; // checked by the renderer\n\n\tif ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {\n\n\t\t__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'observe', { detail: this } ) ); // eslint-disable-line no-undef\n\n\t}\n\n}\n\nScene.prototype = Object.assign( Object.create( Object3D.prototype ), {\n\n\tconstructor: Scene,\n\n\tisScene: true,\n\n\tcopy: function ( source, recursive ) {\n\n\t\tObject3D.prototype.copy.call( this, source, recursive );\n\n\t\tif ( source.background !== null ) this.background = source.background.clone();\n\t\tif ( source.environment !== null ) this.environment = source.environment.clone();\n\t\tif ( source.fog !== null ) this.fog = source.fog.clone();\n\n\t\tif ( source.overrideMaterial !== null ) this.overrideMaterial = source.overrideMaterial.clone();\n\n\t\tthis.autoUpdate = source.autoUpdate;\n\t\tthis.matrixAutoUpdate = source.matrixAutoUpdate;\n\n\t\treturn this;\n\n\t},\n\n\ttoJSON: function ( meta ) {\n\n\t\tvar data = Object3D.prototype.toJSON.call( this, meta );\n\n\t\tif ( this.background !== null ) data.object.background = this.background.toJSON( meta );\n\t\tif ( this.environment !== null ) data.object.environment = this.environment.toJSON( meta );\n\t\tif ( this.fog !== null ) data.object.fog = this.fog.toJSON();\n\n\t\treturn data;\n\n\t},\n\n\tdispose: function () {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n} );\n\nvar _points = [\n\tnew Vector3(),\n\tnew Vector3(),\n\tnew Vector3(),\n\tnew Vector3(),\n\tnew Vector3(),\n\tnew Vector3(),\n\tnew Vector3(),\n\tnew Vector3()\n];\n\nvar _vector$1 = new Vector3();\n\nvar _box = new Box3();\n\n// triangle centered vertices\n\nvar _v0 = new Vector3();\nvar _v1$2 = new Vector3();\nvar _v2 = new Vector3();\n\n// triangle edge vectors\n\nvar _f0 = new Vector3();\nvar _f1 = new Vector3();\nvar _f2 = new Vector3();\n\nvar _center = new Vector3();\nvar _extents = new Vector3();\nvar _triangleNormal = new Vector3();\nvar _testAxis = new Vector3();\n\n/**\n * @author bhouston / http://clara.io\n * @author WestLangley / http://github.com/WestLangley\n */\n\nfunction Box3( min, max ) {\n\n\tthis.min = ( min !== undefined ) ? min : new Vector3( + Infinity, + Infinity, + Infinity );\n\tthis.max = ( max !== undefined ) ? max : new Vector3( - Infinity, - Infinity, - Infinity );\n\n}\n\n\nObject.assign( Box3.prototype, {\n\n\tisBox3: true,\n\n\tset: function ( min, max ) {\n\n\t\tthis.min.copy( min );\n\t\tthis.max.copy( max );\n\n\t\treturn this;\n\n\t},\n\n\tsetFromArray: function ( array ) {\n\n\t\tvar minX = + Infinity;\n\t\tvar minY = + Infinity;\n\t\tvar minZ = + Infinity;\n\n\t\tvar maxX = - Infinity;\n\t\tvar maxY = - Infinity;\n\t\tvar maxZ = - Infinity;\n\n\t\tfor ( var i = 0, l = array.length; i < l; i += 3 ) {\n\n\t\t\tvar x = array[ i ];\n\t\t\tvar y = array[ i + 1 ];\n\t\t\tvar z = array[ i + 2 ];\n\n\t\t\tif ( x < minX ) minX = x;\n\t\t\tif ( y < minY ) minY = y;\n\t\t\tif ( z < minZ ) minZ = z;\n\n\t\t\tif ( x > maxX ) maxX = x;\n\t\t\tif ( y > maxY ) maxY = y;\n\t\t\tif ( z > maxZ ) maxZ = z;\n\n\t\t}\n\n\t\tthis.min.set( minX, minY, minZ );\n\t\tthis.max.set( maxX, maxY, maxZ );\n\n\t\treturn this;\n\n\t},\n\n\tsetFromBufferAttribute: function ( attribute ) {\n\n\t\tvar minX = + Infinity;\n\t\tvar minY = + Infinity;\n\t\tvar minZ = + Infinity;\n\n\t\tvar maxX = - Infinity;\n\t\tvar maxY = - Infinity;\n\t\tvar maxZ = - Infinity;\n\n\t\tfor ( var i = 0, l = attribute.count; i < l; i ++ ) {\n\n\t\t\tvar x = attribute.getX( i );\n\t\t\tvar y = attribute.getY( i );\n\t\t\tvar z = attribute.getZ( i );\n\n\t\t\tif ( x < minX ) minX = x;\n\t\t\tif ( y < minY ) minY = y;\n\t\t\tif ( z < minZ ) minZ = z;\n\n\t\t\tif ( x > maxX ) maxX = x;\n\t\t\tif ( y > maxY ) maxY = y;\n\t\t\tif ( z > maxZ ) maxZ = z;\n\n\t\t}\n\n\t\tthis.min.set( minX, minY, minZ );\n\t\tthis.max.set( maxX, maxY, maxZ );\n\n\t\treturn this;\n\n\t},\n\n\tsetFromPoints: function ( points ) {\n\n\t\tthis.makeEmpty();\n\n\t\tfor ( var i = 0, il = points.length; i < il; i ++ ) {\n\n\t\t\tthis.expandByPoint( points[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tsetFromCenterAndSize: function ( center, size ) {\n\n\t\tvar halfSize = _vector$1.copy( size ).multiplyScalar( 0.5 );\n\n\t\tthis.min.copy( center ).sub( halfSize );\n\t\tthis.max.copy( center ).add( halfSize );\n\n\t\treturn this;\n\n\t},\n\n\tsetFromObject: function ( object ) {\n\n\t\tthis.makeEmpty();\n\n\t\treturn this.expandByObject( object );\n\n\t},\n\n\tclone: function () {\n\n\t\treturn new this.constructor().copy( this );\n\n\t},\n\n\tcopy: function ( box ) {\n\n\t\tthis.min.copy( box.min );\n\t\tthis.max.copy( box.max );\n\n\t\treturn this;\n\n\t},\n\n\tmakeEmpty: function () {\n\n\t\tthis.min.x = this.min.y = this.min.z = + Infinity;\n\t\tthis.max.x = this.max.y = this.max.z = - Infinity;\n\n\t\treturn this;\n\n\t},\n\n\tisEmpty: function () {\n\n\t\t// this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes\n\n\t\treturn ( this.max.x < this.min.x ) || ( this.max.y < this.min.y ) || ( this.max.z < this.min.z );\n\n\t},\n\n\tgetCenter: function ( target ) {\n\n\t\tif ( target === undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Box3: .getCenter() target is now required' );\n\t\t\ttarget = new Vector3();\n\n\t\t}\n\n\t\treturn this.isEmpty() ? target.set( 0, 0, 0 ) : target.addVectors( this.min, this.max ).multiplyScalar( 0.5 );\n\n\t},\n\n\tgetSize: function ( target ) {\n\n\t\tif ( target === undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Box3: .getSize() target is now required' );\n\t\t\ttarget = new Vector3();\n\n\t\t}\n\n\t\treturn this.isEmpty() ? target.set( 0, 0, 0 ) : target.subVectors( this.max, this.min );\n\n\t},\n\n\texpandByPoint: function ( point ) {\n\n\t\tthis.min.min( point );\n\t\tthis.max.max( point );\n\n\t\treturn this;\n\n\t},\n\n\texpandByVector: function ( vector ) {\n\n\t\tthis.min.sub( vector );\n\t\tthis.max.add( vector );\n\n\t\treturn this;\n\n\t},\n\n\texpandByScalar: function ( scalar ) {\n\n\t\tthis.min.addScalar( - scalar );\n\t\tthis.max.addScalar( scalar );\n\n\t\treturn this;\n\n\t},\n\n\texpandByObject: function ( object ) {\n\n\t\t// Computes the world-axis-aligned bounding box of an object (including its children),\n\t\t// accounting for both the object's, and children's, world transforms\n\n\t\tobject.updateWorldMatrix( false, false );\n\n\t\tvar geometry = object.geometry;\n\n\t\tif ( geometry !== undefined ) {\n\n\t\t\tif ( geometry.boundingBox === null ) {\n\n\t\t\t\tgeometry.computeBoundingBox();\n\n\t\t\t}\n\n\t\t\t_box.copy( geometry.boundingBox );\n\t\t\t_box.applyMatrix4( object.matrixWorld );\n\n\t\t\tthis.expandByPoint( _box.min );\n\t\t\tthis.expandByPoint( _box.max );\n\n\t\t}\n\n\t\tvar children = object.children;\n\n\t\tfor ( var i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tthis.expandByObject( children[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tcontainsPoint: function ( point ) {\n\n\t\treturn point.x < this.min.x || point.x > this.max.x ||\n\t\t\tpoint.y < this.min.y || point.y > this.max.y ||\n\t\t\tpoint.z < this.min.z || point.z > this.max.z ? false : true;\n\n\t},\n\n\tcontainsBox: function ( box ) {\n\n\t\treturn this.min.x <= box.min.x && box.max.x <= this.max.x &&\n\t\t\tthis.min.y <= box.min.y && box.max.y <= this.max.y &&\n\t\t\tthis.min.z <= box.min.z && box.max.z <= this.max.z;\n\n\t},\n\n\tgetParameter: function ( point, target ) {\n\n\t\t// This can potentially have a divide by zero if the box\n\t\t// has a size dimension of 0.\n\n\t\tif ( target === undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Box3: .getParameter() target is now required' );\n\t\t\ttarget = new Vector3();\n\n\t\t}\n\n\t\treturn target.set(\n\t\t\t( point.x - this.min.x ) / ( this.max.x - this.min.x ),\n\t\t\t( point.y - this.min.y ) / ( this.max.y - this.min.y ),\n\t\t\t( point.z - this.min.z ) / ( this.max.z - this.min.z )\n\t\t);\n\n\t},\n\n\tintersectsBox: function ( box ) {\n\n\t\t// using 6 splitting planes to rule out intersections.\n\t\treturn box.max.x < this.min.x || box.min.x > this.max.x ||\n\t\t\tbox.max.y < this.min.y || box.min.y > this.max.y ||\n\t\t\tbox.max.z < this.min.z || box.min.z > this.max.z ? false : true;\n\n\t},\n\n\tintersectsSphere: function ( sphere ) {\n\n\t\t// Find the point on the AABB closest to the sphere center.\n\t\tthis.clampPoint( sphere.center, _vector$1 );\n\n\t\t// If that point is inside the sphere, the AABB and sphere intersect.\n\t\treturn _vector$1.distanceToSquared( sphere.center ) <= ( sphere.radius * sphere.radius );\n\n\t},\n\n\tintersectsPlane: function ( plane ) {\n\n\t\t// We compute the minimum and maximum dot product values. If those values\n\t\t// are on the same side (back or front) of the plane, then there is no intersection.\n\n\t\tvar min, max;\n\n\t\tif ( plane.normal.x > 0 ) {\n\n\t\t\tmin = plane.normal.x * this.min.x;\n\t\t\tmax = plane.normal.x * this.max.x;\n\n\t\t} else {\n\n\t\t\tmin = plane.normal.x * this.max.x;\n\t\t\tmax = plane.normal.x * this.min.x;\n\n\t\t}\n\n\t\tif ( plane.normal.y > 0 ) {\n\n\t\t\tmin += plane.normal.y * this.min.y;\n\t\t\tmax += plane.normal.y * this.max.y;\n\n\t\t} else {\n\n\t\t\tmin += plane.normal.y * this.max.y;\n\t\t\tmax += plane.normal.y * this.min.y;\n\n\t\t}\n\n\t\tif ( plane.normal.z > 0 ) {\n\n\t\t\tmin += plane.normal.z * this.min.z;\n\t\t\tmax += plane.normal.z * this.max.z;\n\n\t\t} else {\n\n\t\t\tmin += plane.normal.z * this.max.z;\n\t\t\tmax += plane.normal.z * this.min.z;\n\n\t\t}\n\n\t\treturn ( min <= - plane.constant && max >= - plane.constant );\n\n\t},\n\n\tintersectsTriangle: function ( triangle ) {\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\t// compute box center and extents\n\t\tthis.getCenter( _center );\n\t\t_extents.subVectors( this.max, _center );\n\n\t\t// translate triangle to aabb origin\n\t\t_v0.subVectors( triangle.a, _center );\n\t\t_v1$2.subVectors( triangle.b, _center );\n\t\t_v2.subVectors( triangle.c, _center );\n\n\t\t// compute edge vectors for triangle\n\t\t_f0.subVectors( _v1$2, _v0 );\n\t\t_f1.subVectors( _v2, _v1$2 );\n\t\t_f2.subVectors( _v0, _v2 );\n\n\t\t// test against axes that are given by cross product combinations of the edges of the triangle and the edges of the aabb\n\t\t// make an axis testing of each of the 3 sides of the aabb against each of the 3 sides of the triangle = 9 axis of separation\n\t\t// axis_ij = u_i x f_j (u0, u1, u2 = face normals of aabb = x,y,z axes vectors since aabb is axis aligned)\n\t\tvar axes = [\n\t\t\t0, - _f0.z, _f0.y, 0, - _f1.z, _f1.y, 0, - _f2.z, _f2.y,\n\t\t\t_f0.z, 0, - _f0.x, _f1.z, 0, - _f1.x, _f2.z, 0, - _f2.x,\n\t\t\t- _f0.y, _f0.x, 0, - _f1.y, _f1.x, 0, - _f2.y, _f2.x, 0\n\t\t];\n\t\tif ( ! satForAxes( axes, _v0, _v1$2, _v2, _extents ) ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\t// test 3 face normals from the aabb\n\t\taxes = [ 1, 0, 0, 0, 1, 0, 0, 0, 1 ];\n\t\tif ( ! satForAxes( axes, _v0, _v1$2, _v2, _extents ) ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\t// finally testing the face normal of the triangle\n\t\t// use already existing triangle edge vectors here\n\t\t_triangleNormal.crossVectors( _f0, _f1 );\n\t\taxes = [ _triangleNormal.x, _triangleNormal.y, _triangleNormal.z ];\n\n\t\treturn satForAxes( axes, _v0, _v1$2, _v2, _extents );\n\n\t},\n\n\tclampPoint: function ( point, target ) {\n\n\t\tif ( target === undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Box3: .clampPoint() target is now required' );\n\t\t\ttarget = new Vector3();\n\n\t\t}\n\n\t\treturn target.copy( point ).clamp( this.min, this.max );\n\n\t},\n\n\tdistanceToPoint: function ( point ) {\n\n\t\tvar clampedPoint = _vector$1.copy( point ).clamp( this.min, this.max );\n\n\t\treturn clampedPoint.sub( point ).length();\n\n\t},\n\n\tgetBoundingSphere: function ( target ) {\n\n\t\tif ( target === undefined ) {\n\n\t\t\tconsole.error( 'THREE.Box3: .getBoundingSphere() target is now required' );\n\t\t\t//target = new Sphere(); // removed to avoid cyclic dependency\n\n\t\t}\n\n\t\tthis.getCenter( target.center );\n\n\t\ttarget.radius = this.getSize( _vector$1 ).length() * 0.5;\n\n\t\treturn target;\n\n\t},\n\n\tintersect: function ( box ) {\n\n\t\tthis.min.max( box.min );\n\t\tthis.max.min( box.max );\n\n\t\t// ensure that if there is no overlap, the result is fully empty, not slightly empty with non-inf/+inf values that will cause subsequence intersects to erroneously return valid values.\n\t\tif ( this.isEmpty() ) this.makeEmpty();\n\n\t\treturn this;\n\n\t},\n\n\tunion: function ( box ) {\n\n\t\tthis.min.min( box.min );\n\t\tthis.max.max( box.max );\n\n\t\treturn this;\n\n\t},\n\n\tapplyMatrix4: function ( matrix ) {\n\n\t\t// transform of empty box is an empty box.\n\t\tif ( this.isEmpty() ) return this;\n\n\t\t// NOTE: I am using a binary pattern to specify all 2^3 combinations below\n\t\t_points[ 0 ].set( this.min.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 000\n\t\t_points[ 1 ].set( this.min.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 001\n\t\t_points[ 2 ].set( this.min.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 010\n\t\t_points[ 3 ].set( this.min.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 011\n\t\t_points[ 4 ].set( this.max.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 100\n\t\t_points[ 5 ].set( this.max.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 101\n\t\t_points[ 6 ].set( this.max.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 110\n\t\t_points[ 7 ].set( this.max.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 111\n\n\t\tthis.setFromPoints( _points );\n\n\t\treturn this;\n\n\t},\n\n\ttranslate: function ( offset ) {\n\n\t\tthis.min.add( offset );\n\t\tthis.max.add( offset );\n\n\t\treturn this;\n\n\t},\n\n\tequals: function ( box ) {\n\n\t\treturn box.min.equals( this.min ) && box.max.equals( this.max );\n\n\t}\n\n} );\n\nfunction satForAxes( axes, v0, v1, v2, extents ) {\n\n\tvar i, j;\n\n\tfor ( i = 0, j = axes.length - 3; i <= j; i += 3 ) {\n\n\t\t_testAxis.fromArray( axes, i );\n\t\t// project the aabb onto the seperating axis\n\t\tvar r = extents.x * Math.abs( _testAxis.x ) + extents.y * Math.abs( _testAxis.y ) + extents.z * Math.abs( _testAxis.z );\n\t\t// project all 3 vertices of the triangle onto the seperating axis\n\t\tvar p0 = v0.dot( _testAxis );\n\t\tvar p1 = v1.dot( _testAxis );\n\t\tvar p2 = v2.dot( _testAxis );\n\t\t// actual test, basically see if either of the most extreme of the triangle points intersects r\n\t\tif ( Math.max( - Math.max( p0, p1, p2 ), Math.min( p0, p1, p2 ) ) > r ) {\n\n\t\t\t// points of the projected triangle are outside the projected half-length of the aabb\n\t\t\t// the axis is seperating and we can exit\n\t\t\treturn false;\n\n\t\t}\n\n\t}\n\n\treturn true;\n\n}\n\nvar _box$1 = new Box3();\n\n/**\n * @author bhouston / http://clara.io\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction Sphere( center, radius ) {\n\n\tthis.center = ( center !== undefined ) ? center : new Vector3();\n\tthis.radius = ( radius !== undefined ) ? radius : 0;\n\n}\n\nObject.assign( Sphere.prototype, {\n\n\tset: function ( center, radius ) {\n\n\t\tthis.center.copy( center );\n\t\tthis.radius = radius;\n\n\t\treturn this;\n\n\t},\n\n\tsetFromPoints: function ( points, optionalCenter ) {\n\n\t\tvar center = this.center;\n\n\t\tif ( optionalCenter !== undefined ) {\n\n\t\t\tcenter.copy( optionalCenter );\n\n\t\t} else {\n\n\t\t\t_box$1.setFromPoints( points ).getCenter( center );\n\n\t\t}\n\n\t\tvar maxRadiusSq = 0;\n\n\t\tfor ( var i = 0, il = points.length; i < il; i ++ ) {\n\n\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( points[ i ] ) );\n\n\t\t}\n\n\t\tthis.radius = Math.sqrt( maxRadiusSq );\n\n\t\treturn this;\n\n\t},\n\n\tclone: function () {\n\n\t\treturn new this.constructor().copy( this );\n\n\t},\n\n\tcopy: function ( sphere ) {\n\n\t\tthis.center.copy( sphere.center );\n\t\tthis.radius = sphere.radius;\n\n\t\treturn this;\n\n\t},\n\n\tempty: function () {\n\n\t\treturn ( this.radius <= 0 );\n\n\t},\n\n\tcontainsPoint: function ( point ) {\n\n\t\treturn ( point.distanceToSquared( this.center ) <= ( this.radius * this.radius ) );\n\n\t},\n\n\tdistanceToPoint: function ( point ) {\n\n\t\treturn ( point.distanceTo( this.center ) - this.radius );\n\n\t},\n\n\tintersectsSphere: function ( sphere ) {\n\n\t\tvar radiusSum = this.radius + sphere.radius;\n\n\t\treturn sphere.center.distanceToSquared( this.center ) <= ( radiusSum * radiusSum );\n\n\t},\n\n\tintersectsBox: function ( box ) {\n\n\t\treturn box.intersectsSphere( this );\n\n\t},\n\n\tintersectsPlane: function ( plane ) {\n\n\t\treturn Math.abs( plane.distanceToPoint( this.center ) ) <= this.radius;\n\n\t},\n\n\tclampPoint: function ( point, target ) {\n\n\t\tvar deltaLengthSq = this.center.distanceToSquared( point );\n\n\t\tif ( target === undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Sphere: .clampPoint() target is now required' );\n\t\t\ttarget = new Vector3();\n\n\t\t}\n\n\t\ttarget.copy( point );\n\n\t\tif ( deltaLengthSq > ( this.radius * this.radius ) ) {\n\n\t\t\ttarget.sub( this.center ).normalize();\n\t\t\ttarget.multiplyScalar( this.radius ).add( this.center );\n\n\t\t}\n\n\t\treturn target;\n\n\t},\n\n\tgetBoundingBox: function ( target ) {\n\n\t\tif ( target === undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Sphere: .getBoundingBox() target is now required' );\n\t\t\ttarget = new Box3();\n\n\t\t}\n\n\t\ttarget.set( this.center, this.center );\n\t\ttarget.expandByScalar( this.radius );\n\n\t\treturn target;\n\n\t},\n\n\tapplyMatrix4: function ( matrix ) {\n\n\t\tthis.center.applyMatrix4( matrix );\n\t\tthis.radius = this.radius * matrix.getMaxScaleOnAxis();\n\n\t\treturn this;\n\n\t},\n\n\ttranslate: function ( offset ) {\n\n\t\tthis.center.add( offset );\n\n\t\treturn this;\n\n\t},\n\n\tequals: function ( sphere ) {\n\n\t\treturn sphere.center.equals( this.center ) && ( sphere.radius === this.radius );\n\n\t}\n\n} );\n\nvar _vector$2 = new Vector3();\nvar _segCenter = new Vector3();\nvar _segDir = new Vector3();\nvar _diff = new Vector3();\n\nvar _edge1 = new Vector3();\nvar _edge2 = new Vector3();\nvar _normal = new Vector3();\n\n/**\n * @author bhouston / http://clara.io\n */\n\nfunction Ray( origin, direction ) {\n\n\tthis.origin = ( origin !== undefined ) ? origin : new Vector3();\n\tthis.direction = ( direction !== undefined ) ? direction : new Vector3( 0, 0, - 1 );\n\n}\n\nObject.assign( Ray.prototype, {\n\n\tset: function ( origin, direction ) {\n\n\t\tthis.origin.copy( origin );\n\t\tthis.direction.copy( direction );\n\n\t\treturn this;\n\n\t},\n\n\tclone: function () {\n\n\t\treturn new this.constructor().copy( this );\n\n\t},\n\n\tcopy: function ( ray ) {\n\n\t\tthis.origin.copy( ray.origin );\n\t\tthis.direction.copy( ray.direction );\n\n\t\treturn this;\n\n\t},\n\n\tat: function ( t, target ) {\n\n\t\tif ( target === undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Ray: .at() target is now required' );\n\t\t\ttarget = new Vector3();\n\n\t\t}\n\n\t\treturn target.copy( this.direction ).multiplyScalar( t ).add( this.origin );\n\n\t},\n\n\tlookAt: function ( v ) {\n\n\t\tthis.direction.copy( v ).sub( this.origin ).normalize();\n\n\t\treturn this;\n\n\t},\n\n\trecast: function ( t ) {\n\n\t\tthis.origin.copy( this.at( t, _vector$2 ) );\n\n\t\treturn this;\n\n\t},\n\n\tclosestPointToPoint: function ( point, target ) {\n\n\t\tif ( target === undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Ray: .closestPointToPoint() target is now required' );\n\t\t\ttarget = new Vector3();\n\n\t\t}\n\n\t\ttarget.subVectors( point, this.origin );\n\n\t\tvar directionDistance = target.dot( this.direction );\n\n\t\tif ( directionDistance < 0 ) {\n\n\t\t\treturn target.copy( this.origin );\n\n\t\t}\n\n\t\treturn target.copy( this.direction ).multiplyScalar( directionDistance ).add( this.origin );\n\n\t},\n\n\tdistanceToPoint: function ( point ) {\n\n\t\treturn Math.sqrt( this.distanceSqToPoint( point ) );\n\n\t},\n\n\tdistanceSqToPoint: function ( point ) {\n\n\t\tvar directionDistance = _vector$2.subVectors( point, this.origin ).dot( this.direction );\n\n\t\t// point behind the ray\n\n\t\tif ( directionDistance < 0 ) {\n\n\t\t\treturn this.origin.distanceToSquared( point );\n\n\t\t}\n\n\t\t_vector$2.copy( this.direction ).multiplyScalar( directionDistance ).add( this.origin );\n\n\t\treturn _vector$2.distanceToSquared( point );\n\n\t},\n\n\tdistanceSqToSegment: function ( v0, v1, optionalPointOnRay, optionalPointOnSegment ) {\n\n\t\t// from http://www.geometrictools.com/GTEngine/Include/Mathematics/GteDistRaySegment.h\n\t\t// It returns the min distance between the ray and the segment\n\t\t// defined by v0 and v1\n\t\t// It can also set two optional targets :\n\t\t// - The closest point on the ray\n\t\t// - The closest point on the segment\n\n\t\t_segCenter.copy( v0 ).add( v1 ).multiplyScalar( 0.5 );\n\t\t_segDir.copy( v1 ).sub( v0 ).normalize();\n\t\t_diff.copy( this.origin ).sub( _segCenter );\n\n\t\tvar segExtent = v0.distanceTo( v1 ) * 0.5;\n\t\tvar a01 = - this.direction.dot( _segDir );\n\t\tvar b0 = _diff.dot( this.direction );\n\t\tvar b1 = - _diff.dot( _segDir );\n\t\tvar c = _diff.lengthSq();\n\t\tvar det = Math.abs( 1 - a01 * a01 );\n\t\tvar s0, s1, sqrDist, extDet;\n\n\t\tif ( det > 0 ) {\n\n\t\t\t// The ray and segment are not parallel.\n\n\t\t\ts0 = a01 * b1 - b0;\n\t\t\ts1 = a01 * b0 - b1;\n\t\t\textDet = segExtent * det;\n\n\t\t\tif ( s0 >= 0 ) {\n\n\t\t\t\tif ( s1 >= - extDet ) {\n\n\t\t\t\t\tif ( s1 <= extDet ) {\n\n\t\t\t\t\t\t// region 0\n\t\t\t\t\t\t// Minimum at interior points of ray and segment.\n\n\t\t\t\t\t\tvar invDet = 1 / det;\n\t\t\t\t\t\ts0 *= invDet;\n\t\t\t\t\t\ts1 *= invDet;\n\t\t\t\t\t\tsqrDist = s0 * ( s0 + a01 * s1 + 2 * b0 ) + s1 * ( a01 * s0 + s1 + 2 * b1 ) + c;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// region 1\n\n\t\t\t\t\t\ts1 = segExtent;\n\t\t\t\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\n\t\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// region 5\n\n\t\t\t\t\ts1 = - segExtent;\n\t\t\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\n\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif ( s1 <= - extDet ) {\n\n\t\t\t\t\t// region 4\n\n\t\t\t\t\ts0 = Math.max( 0, - ( - a01 * segExtent + b0 ) );\n\t\t\t\t\ts1 = ( s0 > 0 ) ? - segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent );\n\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t} else if ( s1 <= extDet ) {\n\n\t\t\t\t\t// region 3\n\n\t\t\t\t\ts0 = 0;\n\t\t\t\t\ts1 = Math.min( Math.max( - segExtent, - b1 ), segExtent );\n\t\t\t\t\tsqrDist = s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// region 2\n\n\t\t\t\t\ts0 = Math.max( 0, - ( a01 * segExtent + b0 ) );\n\t\t\t\t\ts1 = ( s0 > 0 ) ? segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent );\n\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// Ray and segment are parallel.\n\n\t\t\ts1 = ( a01 > 0 ) ? - segExtent : segExtent;\n\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\n\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t}\n\n\t\tif ( optionalPointOnRay ) {\n\n\t\t\toptionalPointOnRay.copy( this.direction ).multiplyScalar( s0 ).add( this.origin );\n\n\t\t}\n\n\t\tif ( optionalPointOnSegment ) {\n\n\t\t\toptionalPointOnSegment.copy( _segDir ).multiplyScalar( s1 ).add( _segCenter );\n\n\t\t}\n\n\t\treturn sqrDist;\n\n\t},\n\n\tintersectSphere: function ( sphere, target ) {\n\n\t\t_vector$2.subVectors( sphere.center, this.origin );\n\t\tvar tca = _vector$2.dot( this.direction );\n\t\tvar d2 = _vector$2.dot( _vector$2 ) - tca * tca;\n\t\tvar radius2 = sphere.radius * sphere.radius;\n\n\t\tif ( d2 > radius2 ) return null;\n\n\t\tvar thc = Math.sqrt( radius2 - d2 );\n\n\t\t// t0 = first intersect point - entrance on front of sphere\n\t\tvar t0 = tca - thc;\n\n\t\t// t1 = second intersect point - exit point on back of sphere\n\t\tvar t1 = tca + thc;\n\n\t\t// test to see if both t0 and t1 are behind the ray - if so, return null\n\t\tif ( t0 < 0 && t1 < 0 ) return null;\n\n\t\t// test to see if t0 is behind the ray:\n\t\t// if it is, the ray is inside the sphere, so return the second exit point scaled by t1,\n\t\t// in order to always return an intersect point that is in front of the ray.\n\t\tif ( t0 < 0 ) return this.at( t1, target );\n\n\t\t// else t0 is in front of the ray, so return the first collision point scaled by t0\n\t\treturn this.at( t0, target );\n\n\t},\n\n\tintersectsSphere: function ( sphere ) {\n\n\t\treturn this.distanceSqToPoint( sphere.center ) <= ( sphere.radius * sphere.radius );\n\n\t},\n\n\tdistanceToPlane: function ( plane ) {\n\n\t\tvar denominator = plane.normal.dot( this.direction );\n\n\t\tif ( denominator === 0 ) {\n\n\t\t\t// line is coplanar, return origin\n\t\t\tif ( plane.distanceToPoint( this.origin ) === 0 ) {\n\n\t\t\t\treturn 0;\n\n\t\t\t}\n\n\t\t\t// Null is preferable to undefined since undefined means.... it is undefined\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tvar t = - ( this.origin.dot( plane.normal ) + plane.constant ) / denominator;\n\n\t\t// Return if the ray never intersects the plane\n\n\t\treturn t >= 0 ? t : null;\n\n\t},\n\n\tintersectPlane: function ( plane, target ) {\n\n\t\tvar t = this.distanceToPlane( plane );\n\n\t\tif ( t === null ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\treturn this.at( t, target );\n\n\t},\n\n\tintersectsPlane: function ( plane ) {\n\n\t\t// check if the ray lies on the plane first\n\n\t\tvar distToPoint = plane.distanceToPoint( this.origin );\n\n\t\tif ( distToPoint === 0 ) {\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\tvar denominator = plane.normal.dot( this.direction );\n\n\t\tif ( denominator * distToPoint < 0 ) {\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\t// ray origin is behind the plane (and is pointing behind it)\n\n\t\treturn false;\n\n\t},\n\n\tintersectBox: function ( box, target ) {\n\n\t\tvar tmin, tmax, tymin, tymax, tzmin, tzmax;\n\n\t\tvar invdirx = 1 / this.direction.x,\n\t\t\tinvdiry = 1 / this.direction.y,\n\t\t\tinvdirz = 1 / this.direction.z;\n\n\t\tvar origin = this.origin;\n\n\t\tif ( invdirx >= 0 ) {\n\n\t\t\ttmin = ( box.min.x - origin.x ) * invdirx;\n\t\t\ttmax = ( box.max.x - origin.x ) * invdirx;\n\n\t\t} else {\n\n\t\t\ttmin = ( box.max.x - origin.x ) * invdirx;\n\t\t\ttmax = ( box.min.x - origin.x ) * invdirx;\n\n\t\t}\n\n\t\tif ( invdiry >= 0 ) {\n\n\t\t\ttymin = ( box.min.y - origin.y ) * invdiry;\n\t\t\ttymax = ( box.max.y - origin.y ) * invdiry;\n\n\t\t} else {\n\n\t\t\ttymin = ( box.max.y - origin.y ) * invdiry;\n\t\t\ttymax = ( box.min.y - origin.y ) * invdiry;\n\n\t\t}\n\n\t\tif ( ( tmin > tymax ) || ( tymin > tmax ) ) return null;\n\n\t\t// These lines also handle the case where tmin or tmax is NaN\n\t\t// (result of 0 * Infinity). x !== x returns true if x is NaN\n\n\t\tif ( tymin > tmin || tmin !== tmin ) tmin = tymin;\n\n\t\tif ( tymax < tmax || tmax !== tmax ) tmax = tymax;\n\n\t\tif ( invdirz >= 0 ) {\n\n\t\t\ttzmin = ( box.min.z - origin.z ) * invdirz;\n\t\t\ttzmax = ( box.max.z - origin.z ) * invdirz;\n\n\t\t} else {\n\n\t\t\ttzmin = ( box.max.z - origin.z ) * invdirz;\n\t\t\ttzmax = ( box.min.z - origin.z ) * invdirz;\n\n\t\t}\n\n\t\tif ( ( tmin > tzmax ) || ( tzmin > tmax ) ) return null;\n\n\t\tif ( tzmin > tmin || tmin !== tmin ) tmin = tzmin;\n\n\t\tif ( tzmax < tmax || tmax !== tmax ) tmax = tzmax;\n\n\t\t//return point closest to the ray (positive side)\n\n\t\tif ( tmax < 0 ) return null;\n\n\t\treturn this.at( tmin >= 0 ? tmin : tmax, target );\n\n\t},\n\n\tintersectsBox: function ( box ) {\n\n\t\treturn this.intersectBox( box, _vector$2 ) !== null;\n\n\t},\n\n\tintersectTriangle: function ( a, b, c, backfaceCulling, target ) {\n\n\t\t// Compute the offset origin, edges, and normal.\n\n\t\t// from http://www.geometrictools.com/GTEngine/Include/Mathematics/GteIntrRay3Triangle3.h\n\n\t\t_edge1.subVectors( b, a );\n\t\t_edge2.subVectors( c, a );\n\t\t_normal.crossVectors( _edge1, _edge2 );\n\n\t\t// Solve Q + t*D = b1*E1 + b2*E2 (Q = kDiff, D = ray direction,\n\t\t// E1 = kEdge1, E2 = kEdge2, N = Cross(E1,E2)) by\n\t\t// |Dot(D,N)|*b1 = sign(Dot(D,N))*Dot(D,Cross(Q,E2))\n\t\t// |Dot(D,N)|*b2 = sign(Dot(D,N))*Dot(D,Cross(E1,Q))\n\t\t// |Dot(D,N)|*t = -sign(Dot(D,N))*Dot(Q,N)\n\t\tvar DdN = this.direction.dot( _normal );\n\t\tvar sign;\n\n\t\tif ( DdN > 0 ) {\n\n\t\t\tif ( backfaceCulling ) return null;\n\t\t\tsign = 1;\n\n\t\t} else if ( DdN < 0 ) {\n\n\t\t\tsign = - 1;\n\t\t\tDdN = - DdN;\n\n\t\t} else {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t_diff.subVectors( this.origin, a );\n\t\tvar DdQxE2 = sign * this.direction.dot( _edge2.crossVectors( _diff, _edge2 ) );\n\n\t\t// b1 < 0, no intersection\n\t\tif ( DdQxE2 < 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tvar DdE1xQ = sign * this.direction.dot( _edge1.cross( _diff ) );\n\n\t\t// b2 < 0, no intersection\n\t\tif ( DdE1xQ < 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// b1+b2 > 1, no intersection\n\t\tif ( DdQxE2 + DdE1xQ > DdN ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// Line intersects triangle, check if ray does.\n\t\tvar QdN = - sign * _diff.dot( _normal );\n\n\t\t// t < 0, no intersection\n\t\tif ( QdN < 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// Ray intersects triangle.\n\t\treturn this.at( QdN / DdN, target );\n\n\t},\n\n\tapplyMatrix4: function ( matrix4 ) {\n\n\t\tthis.origin.applyMatrix4( matrix4 );\n\t\tthis.direction.transformDirection( matrix4 );\n\n\t\treturn this;\n\n\t},\n\n\tequals: function ( ray ) {\n\n\t\treturn ray.origin.equals( this.origin ) && ray.direction.equals( this.direction );\n\n\t}\n\n} );\n\n/**\n * @author bhouston / http://clara.io\n */\n\nvar _vector1 = new Vector3();\nvar _vector2 = new Vector3();\nvar _normalMatrix = new Matrix3();\n\nfunction Plane( normal, constant ) {\n\n\t// normal is assumed to be normalized\n\n\tthis.normal = ( normal !== undefined ) ? normal : new Vector3( 1, 0, 0 );\n\tthis.constant = ( constant !== undefined ) ? constant : 0;\n\n}\n\nObject.assign( Plane.prototype, {\n\n\tisPlane: true,\n\n\tset: function ( normal, constant ) {\n\n\t\tthis.normal.copy( normal );\n\t\tthis.constant = constant;\n\n\t\treturn this;\n\n\t},\n\n\tsetComponents: function ( x, y, z, w ) {\n\n\t\tthis.normal.set( x, y, z );\n\t\tthis.constant = w;\n\n\t\treturn this;\n\n\t},\n\n\tsetFromNormalAndCoplanarPoint: function ( normal, point ) {\n\n\t\tthis.normal.copy( normal );\n\t\tthis.constant = - point.dot( this.normal );\n\n\t\treturn this;\n\n\t},\n\n\tsetFromCoplanarPoints: function ( a, b, c ) {\n\n\t\tvar normal = _vector1.subVectors( c, b ).cross( _vector2.subVectors( a, b ) ).normalize();\n\n\t\t// Q: should an error be thrown if normal is zero (e.g. degenerate plane)?\n\n\t\tthis.setFromNormalAndCoplanarPoint( normal, a );\n\n\t\treturn this;\n\n\t},\n\n\tclone: function () {\n\n\t\treturn new this.constructor().copy( this );\n\n\t},\n\n\tcopy: function ( plane ) {\n\n\t\tthis.normal.copy( plane.normal );\n\t\tthis.constant = plane.constant;\n\n\t\treturn this;\n\n\t},\n\n\tnormalize: function () {\n\n\t\t// Note: will lead to a divide by zero if the plane is invalid.\n\n\t\tvar inverseNormalLength = 1.0 / this.normal.length();\n\t\tthis.normal.multiplyScalar( inverseNormalLength );\n\t\tthis.constant *= inverseNormalLength;\n\n\t\treturn this;\n\n\t},\n\n\tnegate: function () {\n\n\t\tthis.constant *= - 1;\n\t\tthis.normal.negate();\n\n\t\treturn this;\n\n\t},\n\n\tdistanceToPoint: function ( point ) {\n\n\t\treturn this.normal.dot( point ) + this.constant;\n\n\t},\n\n\tdistanceToSphere: function ( sphere ) {\n\n\t\treturn this.distanceToPoint( sphere.center ) - sphere.radius;\n\n\t},\n\n\tprojectPoint: function ( point, target ) {\n\n\t\tif ( target === undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Plane: .projectPoint() target is now required' );\n\t\t\ttarget = new Vector3();\n\n\t\t}\n\n\t\treturn target.copy( this.normal ).multiplyScalar( - this.distanceToPoint( point ) ).add( point );\n\n\t},\n\n\tintersectLine: function ( line, target ) {\n\n\t\tif ( target === undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Plane: .intersectLine() target is now required' );\n\t\t\ttarget = new Vector3();\n\n\t\t}\n\n\t\tvar direction = line.delta( _vector1 );\n\n\t\tvar denominator = this.normal.dot( direction );\n\n\t\tif ( denominator === 0 ) {\n\n\t\t\t// line is coplanar, return origin\n\t\t\tif ( this.distanceToPoint( line.start ) === 0 ) {\n\n\t\t\t\treturn target.copy( line.start );\n\n\t\t\t}\n\n\t\t\t// Unsure if this is the correct method to handle this case.\n\t\t\treturn undefined;\n\n\t\t}\n\n\t\tvar t = - ( line.start.dot( this.normal ) + this.constant ) / denominator;\n\n\t\tif ( t < 0 || t > 1 ) {\n\n\t\t\treturn undefined;\n\n\t\t}\n\n\t\treturn target.copy( direction ).multiplyScalar( t ).add( line.start );\n\n\t},\n\n\tintersectsLine: function ( line ) {\n\n\t\t// Note: this tests if a line intersects the plane, not whether it (or its end-points) are coplanar with it.\n\n\t\tvar startSign = this.distanceToPoint( line.start );\n\t\tvar endSign = this.distanceToPoint( line.end );\n\n\t\treturn ( startSign < 0 && endSign > 0 ) || ( endSign < 0 && startSign > 0 );\n\n\t},\n\n\tintersectsBox: function ( box ) {\n\n\t\treturn box.intersectsPlane( this );\n\n\t},\n\n\tintersectsSphere: function ( sphere ) {\n\n\t\treturn sphere.intersectsPlane( this );\n\n\t},\n\n\tcoplanarPoint: function ( target ) {\n\n\t\tif ( target === undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Plane: .coplanarPoint() target is now required' );\n\t\t\ttarget = new Vector3();\n\n\t\t}\n\n\t\treturn target.copy( this.normal ).multiplyScalar( - this.constant );\n\n\t},\n\n\tapplyMatrix4: function ( matrix, optionalNormalMatrix ) {\n\n\t\tvar normalMatrix = optionalNormalMatrix || _normalMatrix.getNormalMatrix( matrix );\n\n\t\tvar referencePoint = this.coplanarPoint( _vector1 ).applyMatrix4( matrix );\n\n\t\tvar normal = this.normal.applyMatrix3( normalMatrix ).normalize();\n\n\t\tthis.constant = - referencePoint.dot( normal );\n\n\t\treturn this;\n\n\t},\n\n\ttranslate: function ( offset ) {\n\n\t\tthis.constant -= offset.dot( this.normal );\n\n\t\treturn this;\n\n\t},\n\n\tequals: function ( plane ) {\n\n\t\treturn plane.normal.equals( this.normal ) && ( plane.constant === this.constant );\n\n\t}\n\n} );\n\n/**\n * @author bhouston / http://clara.io\n * @author mrdoob / http://mrdoob.com/\n */\n\nvar _v0$1 = new Vector3();\nvar _v1$3 = new Vector3();\nvar _v2$1 = new Vector3();\nvar _v3 = new Vector3();\n\nvar _vab = new Vector3();\nvar _vac = new Vector3();\nvar _vbc = new Vector3();\nvar _vap = new Vector3();\nvar _vbp = new Vector3();\nvar _vcp = new Vector3();\n\nfunction Triangle( a, b, c ) {\n\n\tthis.a = ( a !== undefined ) ? a : new Vector3();\n\tthis.b = ( b !== undefined ) ? b : new Vector3();\n\tthis.c = ( c !== undefined ) ? c : new Vector3();\n\n}\n\nObject.assign( Triangle, {\n\n\tgetNormal: function ( a, b, c, target ) {\n\n\t\tif ( target === undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Triangle: .getNormal() target is now required' );\n\t\t\ttarget = new Vector3();\n\n\t\t}\n\n\t\ttarget.subVectors( c, b );\n\t\t_v0$1.subVectors( a, b );\n\t\ttarget.cross( _v0$1 );\n\n\t\tvar targetLengthSq = target.lengthSq();\n\t\tif ( targetLengthSq > 0 ) {\n\n\t\t\treturn target.multiplyScalar( 1 / Math.sqrt( targetLengthSq ) );\n\n\t\t}\n\n\t\treturn target.set( 0, 0, 0 );\n\n\t},\n\n\t// static/instance method to calculate barycentric coordinates\n\t// based on: http://www.blackpawn.com/texts/pointinpoly/default.html\n\tgetBarycoord: function ( point, a, b, c, target ) {\n\n\t\t_v0$1.subVectors( c, a );\n\t\t_v1$3.subVectors( b, a );\n\t\t_v2$1.subVectors( point, a );\n\n\t\tvar dot00 = _v0$1.dot( _v0$1 );\n\t\tvar dot01 = _v0$1.dot( _v1$3 );\n\t\tvar dot02 = _v0$1.dot( _v2$1 );\n\t\tvar dot11 = _v1$3.dot( _v1$3 );\n\t\tvar dot12 = _v1$3.dot( _v2$1 );\n\n\t\tvar denom = ( dot00 * dot11 - dot01 * dot01 );\n\n\t\tif ( target === undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Triangle: .getBarycoord() target is now required' );\n\t\t\ttarget = new Vector3();\n\n\t\t}\n\n\t\t// collinear or singular triangle\n\t\tif ( denom === 0 ) {\n\n\t\t\t// arbitrary location outside of triangle?\n\t\t\t// not sure if this is the best idea, maybe should be returning undefined\n\t\t\treturn target.set( - 2, - 1, - 1 );\n\n\t\t}\n\n\t\tvar invDenom = 1 / denom;\n\t\tvar u = ( dot11 * dot02 - dot01 * dot12 ) * invDenom;\n\t\tvar v = ( dot00 * dot12 - dot01 * dot02 ) * invDenom;\n\n\t\t// barycentric coordinates must always sum to 1\n\t\treturn target.set( 1 - u - v, v, u );\n\n\t},\n\n\tcontainsPoint: function ( point, a, b, c ) {\n\n\t\tTriangle.getBarycoord( point, a, b, c, _v3 );\n\n\t\treturn ( _v3.x >= 0 ) && ( _v3.y >= 0 ) && ( ( _v3.x + _v3.y ) <= 1 );\n\n\t},\n\n\tgetUV: function ( point, p1, p2, p3, uv1, uv2, uv3, target ) {\n\n\t\tthis.getBarycoord( point, p1, p2, p3, _v3 );\n\n\t\ttarget.set( 0, 0 );\n\t\ttarget.addScaledVector( uv1, _v3.x );\n\t\ttarget.addScaledVector( uv2, _v3.y );\n\t\ttarget.addScaledVector( uv3, _v3.z );\n\n\t\treturn target;\n\n\t},\n\n\tisFrontFacing: function ( a, b, c, direction ) {\n\n\t\t_v0$1.subVectors( c, b );\n\t\t_v1$3.subVectors( a, b );\n\n\t\t// strictly front facing\n\t\treturn ( _v0$1.cross( _v1$3 ).dot( direction ) < 0 ) ? true : false;\n\n\t}\n\n} );\n\nObject.assign( Triangle.prototype, {\n\n\tset: function ( a, b, c ) {\n\n\t\tthis.a.copy( a );\n\t\tthis.b.copy( b );\n\t\tthis.c.copy( c );\n\n\t\treturn this;\n\n\t},\n\n\tsetFromPointsAndIndices: function ( points, i0, i1, i2 ) {\n\n\t\tthis.a.copy( points[ i0 ] );\n\t\tthis.b.copy( points[ i1 ] );\n\t\tthis.c.copy( points[ i2 ] );\n\n\t\treturn this;\n\n\t},\n\n\tclone: function () {\n\n\t\treturn new this.constructor().copy( this );\n\n\t},\n\n\tcopy: function ( triangle ) {\n\n\t\tthis.a.copy( triangle.a );\n\t\tthis.b.copy( triangle.b );\n\t\tthis.c.copy( triangle.c );\n\n\t\treturn this;\n\n\t},\n\n\tgetArea: function () {\n\n\t\t_v0$1.subVectors( this.c, this.b );\n\t\t_v1$3.subVectors( this.a, this.b );\n\n\t\treturn _v0$1.cross( _v1$3 ).length() * 0.5;\n\n\t},\n\n\tgetMidpoint: function ( target ) {\n\n\t\tif ( target === undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Triangle: .getMidpoint() target is now required' );\n\t\t\ttarget = new Vector3();\n\n\t\t}\n\n\t\treturn target.addVectors( this.a, this.b ).add( this.c ).multiplyScalar( 1 / 3 );\n\n\t},\n\n\tgetNormal: function ( target ) {\n\n\t\treturn Triangle.getNormal( this.a, this.b, this.c, target );\n\n\t},\n\n\tgetPlane: function ( target ) {\n\n\t\tif ( target === undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Triangle: .getPlane() target is now required' );\n\t\t\ttarget = new Plane();\n\n\t\t}\n\n\t\treturn target.setFromCoplanarPoints( this.a, this.b, this.c );\n\n\t},\n\n\tgetBarycoord: function ( point, target ) {\n\n\t\treturn Triangle.getBarycoord( point, this.a, this.b, this.c, target );\n\n\t},\n\n\tgetUV: function ( point, uv1, uv2, uv3, target ) {\n\n\t\treturn Triangle.getUV( point, this.a, this.b, this.c, uv1, uv2, uv3, target );\n\n\t},\n\n\tcontainsPoint: function ( point ) {\n\n\t\treturn Triangle.containsPoint( point, this.a, this.b, this.c );\n\n\t},\n\n\tisFrontFacing: function ( direction ) {\n\n\t\treturn Triangle.isFrontFacing( this.a, this.b, this.c, direction );\n\n\t},\n\n\tintersectsBox: function ( box ) {\n\n\t\treturn box.intersectsTriangle( this );\n\n\t},\n\n\tclosestPointToPoint: function ( p, target ) {\n\n\t\tif ( target === undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Triangle: .closestPointToPoint() target is now required' );\n\t\t\ttarget = new Vector3();\n\n\t\t}\n\n\t\tvar a = this.a, b = this.b, c = this.c;\n\t\tvar v, w;\n\n\t\t// algorithm thanks to Real-Time Collision Detection by Christer Ericson,\n\t\t// published by Morgan Kaufmann Publishers, (c) 2005 Elsevier Inc.,\n\t\t// under the accompanying license; see chapter 5.1.5 for detailed explanation.\n\t\t// basically, we're distinguishing which of the voronoi regions of the triangle\n\t\t// the point lies in with the minimum amount of redundant computation.\n\n\t\t_vab.subVectors( b, a );\n\t\t_vac.subVectors( c, a );\n\t\t_vap.subVectors( p, a );\n\t\tvar d1 = _vab.dot( _vap );\n\t\tvar d2 = _vac.dot( _vap );\n\t\tif ( d1 <= 0 && d2 <= 0 ) {\n\n\t\t\t// vertex region of A; barycentric coords (1, 0, 0)\n\t\t\treturn target.copy( a );\n\n\t\t}\n\n\t\t_vbp.subVectors( p, b );\n\t\tvar d3 = _vab.dot( _vbp );\n\t\tvar d4 = _vac.dot( _vbp );\n\t\tif ( d3 >= 0 && d4 <= d3 ) {\n\n\t\t\t// vertex region of B; barycentric coords (0, 1, 0)\n\t\t\treturn target.copy( b );\n\n\t\t}\n\n\t\tvar vc = d1 * d4 - d3 * d2;\n\t\tif ( vc <= 0 && d1 >= 0 && d3 <= 0 ) {\n\n\t\t\tv = d1 / ( d1 - d3 );\n\t\t\t// edge region of AB; barycentric coords (1-v, v, 0)\n\t\t\treturn target.copy( a ).addScaledVector( _vab, v );\n\n\t\t}\n\n\t\t_vcp.subVectors( p, c );\n\t\tvar d5 = _vab.dot( _vcp );\n\t\tvar d6 = _vac.dot( _vcp );\n\t\tif ( d6 >= 0 && d5 <= d6 ) {\n\n\t\t\t// vertex region of C; barycentric coords (0, 0, 1)\n\t\t\treturn target.copy( c );\n\n\t\t}\n\n\t\tvar vb = d5 * d2 - d1 * d6;\n\t\tif ( vb <= 0 && d2 >= 0 && d6 <= 0 ) {\n\n\t\t\tw = d2 / ( d2 - d6 );\n\t\t\t// edge region of AC; barycentric coords (1-w, 0, w)\n\t\t\treturn target.copy( a ).addScaledVector( _vac, w );\n\n\t\t}\n\n\t\tvar va = d3 * d6 - d5 * d4;\n\t\tif ( va <= 0 && ( d4 - d3 ) >= 0 && ( d5 - d6 ) >= 0 ) {\n\n\t\t\t_vbc.subVectors( c, b );\n\t\t\tw = ( d4 - d3 ) / ( ( d4 - d3 ) + ( d5 - d6 ) );\n\t\t\t// edge region of BC; barycentric coords (0, 1-w, w)\n\t\t\treturn target.copy( b ).addScaledVector( _vbc, w ); // edge region of BC\n\n\t\t}\n\n\t\t// face region\n\t\tvar denom = 1 / ( va + vb + vc );\n\t\t// u = va * denom\n\t\tv = vb * denom;\n\t\tw = vc * denom;\n\n\t\treturn target.copy( a ).addScaledVector( _vab, v ).addScaledVector( _vac, w );\n\n\t},\n\n\tequals: function ( triangle ) {\n\n\t\treturn triangle.a.equals( this.a ) && triangle.b.equals( this.b ) && triangle.c.equals( this.c );\n\n\t}\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nvar _colorKeywords = { 'aliceblue': 0xF0F8FF, 'antiquewhite': 0xFAEBD7, 'aqua': 0x00FFFF, 'aquamarine': 0x7FFFD4, 'azure': 0xF0FFFF,\n\t'beige': 0xF5F5DC, 'bisque': 0xFFE4C4, 'black': 0x000000, 'blanchedalmond': 0xFFEBCD, 'blue': 0x0000FF, 'blueviolet': 0x8A2BE2,\n\t'brown': 0xA52A2A, 'burlywood': 0xDEB887, 'cadetblue': 0x5F9EA0, 'chartreuse': 0x7FFF00, 'chocolate': 0xD2691E, 'coral': 0xFF7F50,\n\t'cornflowerblue': 0x6495ED, 'cornsilk': 0xFFF8DC, 'crimson': 0xDC143C, 'cyan': 0x00FFFF, 'darkblue': 0x00008B, 'darkcyan': 0x008B8B,\n\t'darkgoldenrod': 0xB8860B, 'darkgray': 0xA9A9A9, 'darkgreen': 0x006400, 'darkgrey': 0xA9A9A9, 'darkkhaki': 0xBDB76B, 'darkmagenta': 0x8B008B,\n\t'darkolivegreen': 0x556B2F, 'darkorange': 0xFF8C00, 'darkorchid': 0x9932CC, 'darkred': 0x8B0000, 'darksalmon': 0xE9967A, 'darkseagreen': 0x8FBC8F,\n\t'darkslateblue': 0x483D8B, 'darkslategray': 0x2F4F4F, 'darkslategrey': 0x2F4F4F, 'darkturquoise': 0x00CED1, 'darkviolet': 0x9400D3,\n\t'deeppink': 0xFF1493, 'deepskyblue': 0x00BFFF, 'dimgray': 0x696969, 'dimgrey': 0x696969, 'dodgerblue': 0x1E90FF, 'firebrick': 0xB22222,\n\t'floralwhite': 0xFFFAF0, 'forestgreen': 0x228B22, 'fuchsia': 0xFF00FF, 'gainsboro': 0xDCDCDC, 'ghostwhite': 0xF8F8FF, 'gold': 0xFFD700,\n\t'goldenrod': 0xDAA520, 'gray': 0x808080, 'green': 0x008000, 'greenyellow': 0xADFF2F, 'grey': 0x808080, 'honeydew': 0xF0FFF0, 'hotpink': 0xFF69B4,\n\t'indianred': 0xCD5C5C, 'indigo': 0x4B0082, 'ivory': 0xFFFFF0, 'khaki': 0xF0E68C, 'lavender': 0xE6E6FA, 'lavenderblush': 0xFFF0F5, 'lawngreen': 0x7CFC00,\n\t'lemonchiffon': 0xFFFACD, 'lightblue': 0xADD8E6, 'lightcoral': 0xF08080, 'lightcyan': 0xE0FFFF, 'lightgoldenrodyellow': 0xFAFAD2, 'lightgray': 0xD3D3D3,\n\t'lightgreen': 0x90EE90, 'lightgrey': 0xD3D3D3, 'lightpink': 0xFFB6C1, 'lightsalmon': 0xFFA07A, 'lightseagreen': 0x20B2AA, 'lightskyblue': 0x87CEFA,\n\t'lightslategray': 0x778899, 'lightslategrey': 0x778899, 'lightsteelblue': 0xB0C4DE, 'lightyellow': 0xFFFFE0, 'lime': 0x00FF00, 'limegreen': 0x32CD32,\n\t'linen': 0xFAF0E6, 'magenta': 0xFF00FF, 'maroon': 0x800000, 'mediumaquamarine': 0x66CDAA, 'mediumblue': 0x0000CD, 'mediumorchid': 0xBA55D3,\n\t'mediumpurple': 0x9370DB, 'mediumseagreen': 0x3CB371, 'mediumslateblue': 0x7B68EE, 'mediumspringgreen': 0x00FA9A, 'mediumturquoise': 0x48D1CC,\n\t'mediumvioletred': 0xC71585, 'midnightblue': 0x191970, 'mintcream': 0xF5FFFA, 'mistyrose': 0xFFE4E1, 'moccasin': 0xFFE4B5, 'navajowhite': 0xFFDEAD,\n\t'navy': 0x000080, 'oldlace': 0xFDF5E6, 'olive': 0x808000, 'olivedrab': 0x6B8E23, 'orange': 0xFFA500, 'orangered': 0xFF4500, 'orchid': 0xDA70D6,\n\t'palegoldenrod': 0xEEE8AA, 'palegreen': 0x98FB98, 'paleturquoise': 0xAFEEEE, 'palevioletred': 0xDB7093, 'papayawhip': 0xFFEFD5, 'peachpuff': 0xFFDAB9,\n\t'peru': 0xCD853F, 'pink': 0xFFC0CB, 'plum': 0xDDA0DD, 'powderblue': 0xB0E0E6, 'purple': 0x800080, 'rebeccapurple': 0x663399, 'red': 0xFF0000, 'rosybrown': 0xBC8F8F,\n\t'royalblue': 0x4169E1, 'saddlebrown': 0x8B4513, 'salmon': 0xFA8072, 'sandybrown': 0xF4A460, 'seagreen': 0x2E8B57, 'seashell': 0xFFF5EE,\n\t'sienna': 0xA0522D, 'silver': 0xC0C0C0, 'skyblue': 0x87CEEB, 'slateblue': 0x6A5ACD, 'slategray': 0x708090, 'slategrey': 0x708090, 'snow': 0xFFFAFA,\n\t'springgreen': 0x00FF7F, 'steelblue': 0x4682B4, 'tan': 0xD2B48C, 'teal': 0x008080, 'thistle': 0xD8BFD8, 'tomato': 0xFF6347, 'turquoise': 0x40E0D0,\n\t'violet': 0xEE82EE, 'wheat': 0xF5DEB3, 'white': 0xFFFFFF, 'whitesmoke': 0xF5F5F5, 'yellow': 0xFFFF00, 'yellowgreen': 0x9ACD32 };\n\nvar _hslA = { h: 0, s: 0, l: 0 };\nvar _hslB = { h: 0, s: 0, l: 0 };\n\nfunction Color( r, g, b ) {\n\n\tif ( g === undefined && b === undefined ) {\n\n\t\t// r is THREE.Color, hex or string\n\t\treturn this.set( r );\n\n\t}\n\n\treturn this.setRGB( r, g, b );\n\n}\n\nfunction hue2rgb( p, q, t ) {\n\n\tif ( t < 0 ) t += 1;\n\tif ( t > 1 ) t -= 1;\n\tif ( t < 1 / 6 ) return p + ( q - p ) * 6 * t;\n\tif ( t < 1 / 2 ) return q;\n\tif ( t < 2 / 3 ) return p + ( q - p ) * 6 * ( 2 / 3 - t );\n\treturn p;\n\n}\n\nfunction SRGBToLinear( c ) {\n\n\treturn ( c < 0.04045 ) ? c * 0.0773993808 : Math.pow( c * 0.9478672986 + 0.0521327014, 2.4 );\n\n}\n\nfunction LinearToSRGB( c ) {\n\n\treturn ( c < 0.0031308 ) ? c * 12.92 : 1.055 * ( Math.pow( c, 0.41666 ) ) - 0.055;\n\n}\n\nObject.assign( Color.prototype, {\n\n\tisColor: true,\n\n\tr: 1, g: 1, b: 1,\n\n\tset: function ( value ) {\n\n\t\tif ( value && value.isColor ) {\n\n\t\t\tthis.copy( value );\n\n\t\t} else if ( typeof value === 'number' ) {\n\n\t\t\tthis.setHex( value );\n\n\t\t} else if ( typeof value === 'string' ) {\n\n\t\t\tthis.setStyle( value );\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tsetScalar: function ( scalar ) {\n\n\t\tthis.r = scalar;\n\t\tthis.g = scalar;\n\t\tthis.b = scalar;\n\n\t\treturn this;\n\n\t},\n\n\tsetHex: function ( hex ) {\n\n\t\thex = Math.floor( hex );\n\n\t\tthis.r = ( hex >> 16 & 255 ) / 255;\n\t\tthis.g = ( hex >> 8 & 255 ) / 255;\n\t\tthis.b = ( hex & 255 ) / 255;\n\n\t\treturn this;\n\n\t},\n\n\tsetRGB: function ( r, g, b ) {\n\n\t\tthis.r = r;\n\t\tthis.g = g;\n\t\tthis.b = b;\n\n\t\treturn this;\n\n\t},\n\n\tsetHSL: function ( h, s, l ) {\n\n\t\t// h,s,l ranges are in 0.0 - 1.0\n\t\th = MathUtils.euclideanModulo( h, 1 );\n\t\ts = MathUtils.clamp( s, 0, 1 );\n\t\tl = MathUtils.clamp( l, 0, 1 );\n\n\t\tif ( s === 0 ) {\n\n\t\t\tthis.r = this.g = this.b = l;\n\n\t\t} else {\n\n\t\t\tvar p = l <= 0.5 ? l * ( 1 + s ) : l + s - ( l * s );\n\t\t\tvar q = ( 2 * l ) - p;\n\n\t\t\tthis.r = hue2rgb( q, p, h + 1 / 3 );\n\t\t\tthis.g = hue2rgb( q, p, h );\n\t\t\tthis.b = hue2rgb( q, p, h - 1 / 3 );\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tsetStyle: function ( style ) {\n\n\t\tfunction handleAlpha( string ) {\n\n\t\t\tif ( string === undefined ) return;\n\n\t\t\tif ( parseFloat( string ) < 1 ) {\n\n\t\t\t\tconsole.warn( 'THREE.Color: Alpha component of ' + style + ' will be ignored.' );\n\n\t\t\t}\n\n\t\t}\n\n\n\t\tvar m;\n\n\t\tif ( m = /^((?:rgb|hsl)a?)\\(\\s*([^\\)]*)\\)/.exec( style ) ) {\n\n\t\t\t// rgb / hsl\n\n\t\t\tvar color;\n\t\t\tvar name = m[ 1 ];\n\t\t\tvar components = m[ 2 ];\n\n\t\t\tswitch ( name ) {\n\n\t\t\t\tcase 'rgb':\n\t\t\t\tcase 'rgba':\n\n\t\t\t\t\tif ( color = /^(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(,\\s*([0-9]*\\.?[0-9]+)\\s*)?$/.exec( components ) ) {\n\n\t\t\t\t\t\t// rgb(255,0,0) rgba(255,0,0,0.5)\n\t\t\t\t\t\tthis.r = Math.min( 255, parseInt( color[ 1 ], 10 ) ) / 255;\n\t\t\t\t\t\tthis.g = Math.min( 255, parseInt( color[ 2 ], 10 ) ) / 255;\n\t\t\t\t\t\tthis.b = Math.min( 255, parseInt( color[ 3 ], 10 ) ) / 255;\n\n\t\t\t\t\t\thandleAlpha( color[ 5 ] );\n\n\t\t\t\t\t\treturn this;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( color = /^(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(,\\s*([0-9]*\\.?[0-9]+)\\s*)?$/.exec( components ) ) {\n\n\t\t\t\t\t\t// rgb(100%,0%,0%) rgba(100%,0%,0%,0.5)\n\t\t\t\t\t\tthis.r = Math.min( 100, parseInt( color[ 1 ], 10 ) ) / 100;\n\t\t\t\t\t\tthis.g = Math.min( 100, parseInt( color[ 2 ], 10 ) ) / 100;\n\t\t\t\t\t\tthis.b = Math.min( 100, parseInt( color[ 3 ], 10 ) ) / 100;\n\n\t\t\t\t\t\thandleAlpha( color[ 5 ] );\n\n\t\t\t\t\t\treturn this;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'hsl':\n\t\t\t\tcase 'hsla':\n\n\t\t\t\t\tif ( color = /^([0-9]*\\.?[0-9]+)\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(,\\s*([0-9]*\\.?[0-9]+)\\s*)?$/.exec( components ) ) {\n\n\t\t\t\t\t\t// hsl(120,50%,50%) hsla(120,50%,50%,0.5)\n\t\t\t\t\t\tvar h = parseFloat( color[ 1 ] ) / 360;\n\t\t\t\t\t\tvar s = parseInt( color[ 2 ], 10 ) / 100;\n\t\t\t\t\t\tvar l = parseInt( color[ 3 ], 10 ) / 100;\n\n\t\t\t\t\t\thandleAlpha( color[ 5 ] );\n\n\t\t\t\t\t\treturn this.setHSL( h, s, l );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t} else if ( m = /^\\#([A-Fa-f0-9]+)$/.exec( style ) ) {\n\n\t\t\t// hex color\n\n\t\t\tvar hex = m[ 1 ];\n\t\t\tvar size = hex.length;\n\n\t\t\tif ( size === 3 ) {\n\n\t\t\t\t// #ff0\n\t\t\t\tthis.r = parseInt( hex.charAt( 0 ) + hex.charAt( 0 ), 16 ) / 255;\n\t\t\t\tthis.g = parseInt( hex.charAt( 1 ) + hex.charAt( 1 ), 16 ) / 255;\n\t\t\t\tthis.b = parseInt( hex.charAt( 2 ) + hex.charAt( 2 ), 16 ) / 255;\n\n\t\t\t\treturn this;\n\n\t\t\t} else if ( size === 6 ) {\n\n\t\t\t\t// #ff0000\n\t\t\t\tthis.r = parseInt( hex.charAt( 0 ) + hex.charAt( 1 ), 16 ) / 255;\n\t\t\t\tthis.g = parseInt( hex.charAt( 2 ) + hex.charAt( 3 ), 16 ) / 255;\n\t\t\t\tthis.b = parseInt( hex.charAt( 4 ) + hex.charAt( 5 ), 16 ) / 255;\n\n\t\t\t\treturn this;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( style && style.length > 0 ) {\n\n\t\t\treturn this.setColorName( style );\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tsetColorName: function ( style ) {\n\n\t\t// color keywords\n\t\tvar hex = _colorKeywords[ style ];\n\n\t\tif ( hex !== undefined ) {\n\n\t\t\t// red\n\t\t\tthis.setHex( hex );\n\n\t\t} else {\n\n\t\t\t// unknown color\n\t\t\tconsole.warn( 'THREE.Color: Unknown color ' + style );\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tclone: function () {\n\n\t\treturn new this.constructor( this.r, this.g, this.b );\n\n\t},\n\n\tcopy: function ( color ) {\n\n\t\tthis.r = color.r;\n\t\tthis.g = color.g;\n\t\tthis.b = color.b;\n\n\t\treturn this;\n\n\t},\n\n\tcopyGammaToLinear: function ( color, gammaFactor ) {\n\n\t\tif ( gammaFactor === undefined ) gammaFactor = 2.0;\n\n\t\tthis.r = Math.pow( color.r, gammaFactor );\n\t\tthis.g = Math.pow( color.g, gammaFactor );\n\t\tthis.b = Math.pow( color.b, gammaFactor );\n\n\t\treturn this;\n\n\t},\n\n\tcopyLinearToGamma: function ( color, gammaFactor ) {\n\n\t\tif ( gammaFactor === undefined ) gammaFactor = 2.0;\n\n\t\tvar safeInverse = ( gammaFactor > 0 ) ? ( 1.0 / gammaFactor ) : 1.0;\n\n\t\tthis.r = Math.pow( color.r, safeInverse );\n\t\tthis.g = Math.pow( color.g, safeInverse );\n\t\tthis.b = Math.pow( color.b, safeInverse );\n\n\t\treturn this;\n\n\t},\n\n\tconvertGammaToLinear: function ( gammaFactor ) {\n\n\t\tthis.copyGammaToLinear( this, gammaFactor );\n\n\t\treturn this;\n\n\t},\n\n\tconvertLinearToGamma: function ( gammaFactor ) {\n\n\t\tthis.copyLinearToGamma( this, gammaFactor );\n\n\t\treturn this;\n\n\t},\n\n\tcopySRGBToLinear: function ( color ) {\n\n\t\tthis.r = SRGBToLinear( color.r );\n\t\tthis.g = SRGBToLinear( color.g );\n\t\tthis.b = SRGBToLinear( color.b );\n\n\t\treturn this;\n\n\t},\n\n\tcopyLinearToSRGB: function ( color ) {\n\n\t\tthis.r = LinearToSRGB( color.r );\n\t\tthis.g = LinearToSRGB( color.g );\n\t\tthis.b = LinearToSRGB( color.b );\n\n\t\treturn this;\n\n\t},\n\n\tconvertSRGBToLinear: function () {\n\n\t\tthis.copySRGBToLinear( this );\n\n\t\treturn this;\n\n\t},\n\n\tconvertLinearToSRGB: function () {\n\n\t\tthis.copyLinearToSRGB( this );\n\n\t\treturn this;\n\n\t},\n\n\tgetHex: function () {\n\n\t\treturn ( this.r * 255 ) << 16 ^ ( this.g * 255 ) << 8 ^ ( this.b * 255 ) << 0;\n\n\t},\n\n\tgetHexString: function () {\n\n\t\treturn ( '000000' + this.getHex().toString( 16 ) ).slice( - 6 );\n\n\t},\n\n\tgetHSL: function ( target ) {\n\n\t\t// h,s,l ranges are in 0.0 - 1.0\n\n\t\tif ( target === undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Color: .getHSL() target is now required' );\n\t\t\ttarget = { h: 0, s: 0, l: 0 };\n\n\t\t}\n\n\t\tvar r = this.r, g = this.g, b = this.b;\n\n\t\tvar max = Math.max( r, g, b );\n\t\tvar min = Math.min( r, g, b );\n\n\t\tvar hue, saturation;\n\t\tvar lightness = ( min + max ) / 2.0;\n\n\t\tif ( min === max ) {\n\n\t\t\thue = 0;\n\t\t\tsaturation = 0;\n\n\t\t} else {\n\n\t\t\tvar delta = max - min;\n\n\t\t\tsaturation = lightness <= 0.5 ? delta / ( max + min ) : delta / ( 2 - max - min );\n\n\t\t\tswitch ( max ) {\n\n\t\t\t\tcase r: hue = ( g - b ) / delta + ( g < b ? 6 : 0 ); break;\n\t\t\t\tcase g: hue = ( b - r ) / delta + 2; break;\n\t\t\t\tcase b: hue = ( r - g ) / delta + 4; break;\n\n\t\t\t}\n\n\t\t\thue /= 6;\n\n\t\t}\n\n\t\ttarget.h = hue;\n\t\ttarget.s = saturation;\n\t\ttarget.l = lightness;\n\n\t\treturn target;\n\n\t},\n\n\tgetStyle: function () {\n\n\t\treturn 'rgb(' + ( ( this.r * 255 ) | 0 ) + ',' + ( ( this.g * 255 ) | 0 ) + ',' + ( ( this.b * 255 ) | 0 ) + ')';\n\n\t},\n\n\toffsetHSL: function ( h, s, l ) {\n\n\t\tthis.getHSL( _hslA );\n\n\t\t_hslA.h += h; _hslA.s += s; _hslA.l += l;\n\n\t\tthis.setHSL( _hslA.h, _hslA.s, _hslA.l );\n\n\t\treturn this;\n\n\t},\n\n\tadd: function ( color ) {\n\n\t\tthis.r += color.r;\n\t\tthis.g += color.g;\n\t\tthis.b += color.b;\n\n\t\treturn this;\n\n\t},\n\n\taddColors: function ( color1, color2 ) {\n\n\t\tthis.r = color1.r + color2.r;\n\t\tthis.g = color1.g + color2.g;\n\t\tthis.b = color1.b + color2.b;\n\n\t\treturn this;\n\n\t},\n\n\taddScalar: function ( s ) {\n\n\t\tthis.r += s;\n\t\tthis.g += s;\n\t\tthis.b += s;\n\n\t\treturn this;\n\n\t},\n\n\tsub: function ( color ) {\n\n\t\tthis.r = Math.max( 0, this.r - color.r );\n\t\tthis.g = Math.max( 0, this.g - color.g );\n\t\tthis.b = Math.max( 0, this.b - color.b );\n\n\t\treturn this;\n\n\t},\n\n\tmultiply: function ( color ) {\n\n\t\tthis.r *= color.r;\n\t\tthis.g *= color.g;\n\t\tthis.b *= color.b;\n\n\t\treturn this;\n\n\t},\n\n\tmultiplyScalar: function ( s ) {\n\n\t\tthis.r *= s;\n\t\tthis.g *= s;\n\t\tthis.b *= s;\n\n\t\treturn this;\n\n\t},\n\n\tlerp: function ( color, alpha ) {\n\n\t\tthis.r += ( color.r - this.r ) * alpha;\n\t\tthis.g += ( color.g - this.g ) * alpha;\n\t\tthis.b += ( color.b - this.b ) * alpha;\n\n\t\treturn this;\n\n\t},\n\n\tlerpHSL: function ( color, alpha ) {\n\n\t\tthis.getHSL( _hslA );\n\t\tcolor.getHSL( _hslB );\n\n\t\tvar h = MathUtils.lerp( _hslA.h, _hslB.h, alpha );\n\t\tvar s = MathUtils.lerp( _hslA.s, _hslB.s, alpha );\n\t\tvar l = MathUtils.lerp( _hslA.l, _hslB.l, alpha );\n\n\t\tthis.setHSL( h, s, l );\n\n\t\treturn this;\n\n\t},\n\n\tequals: function ( c ) {\n\n\t\treturn ( c.r === this.r ) && ( c.g === this.g ) && ( c.b === this.b );\n\n\t},\n\n\tfromArray: function ( array, offset ) {\n\n\t\tif ( offset === undefined ) offset = 0;\n\n\t\tthis.r = array[ offset ];\n\t\tthis.g = array[ offset + 1 ];\n\t\tthis.b = array[ offset + 2 ];\n\n\t\treturn this;\n\n\t},\n\n\ttoArray: function ( array, offset ) {\n\n\t\tif ( array === undefined ) array = [];\n\t\tif ( offset === undefined ) offset = 0;\n\n\t\tarray[ offset ] = this.r;\n\t\tarray[ offset + 1 ] = this.g;\n\t\tarray[ offset + 2 ] = this.b;\n\n\t\treturn array;\n\n\t},\n\n\ttoJSON: function () {\n\n\t\treturn this.getHex();\n\n\t}\n\n} );\n\nColor.NAMES = _colorKeywords;\n\n/**\n * @author mrdoob / http://mrdoob.com/\n * @author alteredq / http://alteredqualia.com/\n */\n\nfunction Face3( a, b, c, normal, color, materialIndex ) {\n\n\tthis.a = a;\n\tthis.b = b;\n\tthis.c = c;\n\n\tthis.normal = ( normal && normal.isVector3 ) ? normal : new Vector3();\n\tthis.vertexNormals = Array.isArray( normal ) ? normal : [];\n\n\tthis.color = ( color && color.isColor ) ? color : new Color();\n\tthis.vertexColors = Array.isArray( color ) ? color : [];\n\n\tthis.materialIndex = materialIndex !== undefined ? materialIndex : 0;\n\n}\n\nObject.assign( Face3.prototype, {\n\n\tclone: function () {\n\n\t\treturn new this.constructor().copy( this );\n\n\t},\n\n\tcopy: function ( source ) {\n\n\t\tthis.a = source.a;\n\t\tthis.b = source.b;\n\t\tthis.c = source.c;\n\n\t\tthis.normal.copy( source.normal );\n\t\tthis.color.copy( source.color );\n\n\t\tthis.materialIndex = source.materialIndex;\n\n\t\tfor ( var i = 0, il = source.vertexNormals.length; i < il; i ++ ) {\n\n\t\t\tthis.vertexNormals[ i ] = source.vertexNormals[ i ].clone();\n\n\t\t}\n\n\t\tfor ( var i = 0, il = source.vertexColors.length; i < il; i ++ ) {\n\n\t\t\tthis.vertexColors[ i ] = source.vertexColors[ i ].clone();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n * @author alteredq / http://alteredqualia.com/\n */\n\nvar materialId = 0;\n\nfunction Material() {\n\n\tObject.defineProperty( this, 'id', { value: materialId ++ } );\n\n\tthis.uuid = MathUtils.generateUUID();\n\n\tthis.name = '';\n\tthis.type = 'Material';\n\n\tthis.fog = true;\n\n\tthis.blending = NormalBlending;\n\tthis.side = FrontSide;\n\tthis.flatShading = false;\n\tthis.vertexTangents = false;\n\tthis.vertexColors = NoColors; // THREE.NoColors, THREE.VertexColors, THREE.FaceColors\n\n\tthis.opacity = 1;\n\tthis.transparent = false;\n\n\tthis.blendSrc = SrcAlphaFactor;\n\tthis.blendDst = OneMinusSrcAlphaFactor;\n\tthis.blendEquation = AddEquation;\n\tthis.blendSrcAlpha = null;\n\tthis.blendDstAlpha = null;\n\tthis.blendEquationAlpha = null;\n\n\tthis.depthFunc = LessEqualDepth;\n\tthis.depthTest = true;\n\tthis.depthWrite = true;\n\n\tthis.stencilWriteMask = 0xff;\n\tthis.stencilFunc = AlwaysStencilFunc;\n\tthis.stencilRef = 0;\n\tthis.stencilFuncMask = 0xff;\n\tthis.stencilFail = KeepStencilOp;\n\tthis.stencilZFail = KeepStencilOp;\n\tthis.stencilZPass = KeepStencilOp;\n\tthis.stencilWrite = false;\n\n\tthis.clippingPlanes = null;\n\tthis.clipIntersection = false;\n\tthis.clipShadows = false;\n\n\tthis.shadowSide = null;\n\n\tthis.colorWrite = true;\n\n\tthis.precision = null; // override the renderer's default precision for this material\n\n\tthis.polygonOffset = false;\n\tthis.polygonOffsetFactor = 0;\n\tthis.polygonOffsetUnits = 0;\n\n\tthis.dithering = false;\n\n\tthis.alphaTest = 0;\n\tthis.premultipliedAlpha = false;\n\n\tthis.visible = true;\n\n\tthis.toneMapped = true;\n\n\tthis.userData = {};\n\n\tthis.version = 0;\n\n}\n\nMaterial.prototype = Object.assign( Object.create( EventDispatcher.prototype ), {\n\n\tconstructor: Material,\n\n\tisMaterial: true,\n\n\tonBeforeCompile: function () {},\n\n\tsetValues: function ( values ) {\n\n\t\tif ( values === undefined ) return;\n\n\t\tfor ( var key in values ) {\n\n\t\t\tvar newValue = values[ key ];\n\n\t\t\tif ( newValue === undefined ) {\n\n\t\t\t\tconsole.warn( \"THREE.Material: '\" + key + \"' parameter is undefined.\" );\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\t// for backward compatability if shading is set in the constructor\n\t\t\tif ( key === 'shading' ) {\n\n\t\t\t\tconsole.warn( 'THREE.' + this.type + ': .shading has been removed. Use the boolean .flatShading instead.' );\n\t\t\t\tthis.flatShading = ( newValue === FlatShading ) ? true : false;\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tvar currentValue = this[ key ];\n\n\t\t\tif ( currentValue === undefined ) {\n\n\t\t\t\tconsole.warn( \"THREE.\" + this.type + \": '\" + key + \"' is not a property of this material.\" );\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tif ( currentValue && currentValue.isColor ) {\n\n\t\t\t\tcurrentValue.set( newValue );\n\n\t\t\t} else if ( ( currentValue && currentValue.isVector3 ) && ( newValue && newValue.isVector3 ) ) {\n\n\t\t\t\tcurrentValue.copy( newValue );\n\n\t\t\t} else {\n\n\t\t\t\tthis[ key ] = newValue;\n\n\t\t\t}\n\n\t\t}\n\n\t},\n\n\ttoJSON: function ( meta ) {\n\n\t\tvar isRoot = ( meta === undefined || typeof meta === 'string' );\n\n\t\tif ( isRoot ) {\n\n\t\t\tmeta = {\n\t\t\t\ttextures: {},\n\t\t\t\timages: {}\n\t\t\t};\n\n\t\t}\n\n\t\tvar data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.5,\n\t\t\t\ttype: 'Material',\n\t\t\t\tgenerator: 'Material.toJSON'\n\t\t\t}\n\t\t};\n\n\t\t// standard Material serialization\n\t\tdata.uuid = this.uuid;\n\t\tdata.type = this.type;\n\n\t\tif ( this.name !== '' ) data.name = this.name;\n\n\t\tif ( this.color && this.color.isColor ) data.color = this.color.getHex();\n\n\t\tif ( this.roughness !== undefined ) data.roughness = this.roughness;\n\t\tif ( this.metalness !== undefined ) data.metalness = this.metalness;\n\n\t\tif ( this.sheen && this.sheen.isColor ) data.sheen = this.sheen.getHex();\n\t\tif ( this.emissive && this.emissive.isColor ) data.emissive = this.emissive.getHex();\n\t\tif ( this.emissiveIntensity && this.emissiveIntensity !== 1 ) data.emissiveIntensity = this.emissiveIntensity;\n\n\t\tif ( this.specular && this.specular.isColor ) data.specular = this.specular.getHex();\n\t\tif ( this.shininess !== undefined ) data.shininess = this.shininess;\n\t\tif ( this.clearcoat !== undefined ) data.clearcoat = this.clearcoat;\n\t\tif ( this.clearcoatRoughness !== undefined ) data.clearcoatRoughness = this.clearcoatRoughness;\n\n\t\tif ( this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture ) {\n\n\t\t\tdata.clearcoatNormalMap = this.clearcoatNormalMap.toJSON( meta ).uuid;\n\t\t\tdata.clearcoatNormalScale = this.clearcoatNormalScale.toArray();\n\n\t\t}\n\n\t\tif ( this.map && this.map.isTexture ) data.map = this.map.toJSON( meta ).uuid;\n\t\tif ( this.matcap && this.matcap.isTexture ) data.matcap = this.matcap.toJSON( meta ).uuid;\n\t\tif ( this.alphaMap && this.alphaMap.isTexture ) data.alphaMap = this.alphaMap.toJSON( meta ).uuid;\n\t\tif ( this.lightMap && this.lightMap.isTexture ) data.lightMap = this.lightMap.toJSON( meta ).uuid;\n\n\t\tif ( this.aoMap && this.aoMap.isTexture ) {\n\n\t\t\tdata.aoMap = this.aoMap.toJSON( meta ).uuid;\n\t\t\tdata.aoMapIntensity = this.aoMapIntensity;\n\n\t\t}\n\n\t\tif ( this.bumpMap && this.bumpMap.isTexture ) {\n\n\t\t\tdata.bumpMap = this.bumpMap.toJSON( meta ).uuid;\n\t\t\tdata.bumpScale = this.bumpScale;\n\n\t\t}\n\n\t\tif ( this.normalMap && this.normalMap.isTexture ) {\n\n\t\t\tdata.normalMap = this.normalMap.toJSON( meta ).uuid;\n\t\t\tdata.normalMapType = this.normalMapType;\n\t\t\tdata.normalScale = this.normalScale.toArray();\n\n\t\t}\n\n\t\tif ( this.displacementMap && this.displacementMap.isTexture ) {\n\n\t\t\tdata.displacementMap = this.displacementMap.toJSON( meta ).uuid;\n\t\t\tdata.displacementScale = this.displacementScale;\n\t\t\tdata.displacementBias = this.displacementBias;\n\n\t\t}\n\n\t\tif ( this.roughnessMap && this.roughnessMap.isTexture ) data.roughnessMap = this.roughnessMap.toJSON( meta ).uuid;\n\t\tif ( this.metalnessMap && this.metalnessMap.isTexture ) data.metalnessMap = this.metalnessMap.toJSON( meta ).uuid;\n\n\t\tif ( this.emissiveMap && this.emissiveMap.isTexture ) data.emissiveMap = this.emissiveMap.toJSON( meta ).uuid;\n\t\tif ( this.specularMap && this.specularMap.isTexture ) data.specularMap = this.specularMap.toJSON( meta ).uuid;\n\n\t\tif ( this.envMap && this.envMap.isTexture ) {\n\n\t\t\tdata.envMap = this.envMap.toJSON( meta ).uuid;\n\t\t\tdata.reflectivity = this.reflectivity; // Scale behind envMap\n\t\t\tdata.refractionRatio = this.refractionRatio;\n\n\t\t\tif ( this.combine !== undefined ) data.combine = this.combine;\n\t\t\tif ( this.envMapIntensity !== undefined ) data.envMapIntensity = this.envMapIntensity;\n\n\t\t}\n\n\t\tif ( this.gradientMap && this.gradientMap.isTexture ) {\n\n\t\t\tdata.gradientMap = this.gradientMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.size !== undefined ) data.size = this.size;\n\t\tif ( this.sizeAttenuation !== undefined ) data.sizeAttenuation = this.sizeAttenuation;\n\n\t\tif ( this.blending !== NormalBlending ) data.blending = this.blending;\n\t\tif ( this.flatShading === true ) data.flatShading = this.flatShading;\n\t\tif ( this.side !== FrontSide ) data.side = this.side;\n\t\tif ( this.vertexColors !== NoColors ) data.vertexColors = this.vertexColors;\n\n\t\tif ( this.opacity < 1 ) data.opacity = this.opacity;\n\t\tif ( this.transparent === true ) data.transparent = this.transparent;\n\n\t\tdata.depthFunc = this.depthFunc;\n\t\tdata.depthTest = this.depthTest;\n\t\tdata.depthWrite = this.depthWrite;\n\n\t\tdata.stencilWrite = this.stencilWrite;\n\t\tdata.stencilWriteMask = this.stencilWriteMask;\n\t\tdata.stencilFunc = this.stencilFunc;\n\t\tdata.stencilRef = this.stencilRef;\n\t\tdata.stencilFuncMask = this.stencilFuncMask;\n\t\tdata.stencilFail = this.stencilFail;\n\t\tdata.stencilZFail = this.stencilZFail;\n\t\tdata.stencilZPass = this.stencilZPass;\n\n\t\t// rotation (SpriteMaterial)\n\t\tif ( this.rotation && this.rotation !== 0 ) data.rotation = this.rotation;\n\n\t\tif ( this.polygonOffset === true ) data.polygonOffset = true;\n\t\tif ( this.polygonOffsetFactor !== 0 ) data.polygonOffsetFactor = this.polygonOffsetFactor;\n\t\tif ( this.polygonOffsetUnits !== 0 ) data.polygonOffsetUnits = this.polygonOffsetUnits;\n\n\t\tif ( this.linewidth && this.linewidth !== 1 ) data.linewidth = this.linewidth;\n\t\tif ( this.dashSize !== undefined ) data.dashSize = this.dashSize;\n\t\tif ( this.gapSize !== undefined ) data.gapSize = this.gapSize;\n\t\tif ( this.scale !== undefined ) data.scale = this.scale;\n\n\t\tif ( this.dithering === true ) data.dithering = true;\n\n\t\tif ( this.alphaTest > 0 ) data.alphaTest = this.alphaTest;\n\t\tif ( this.premultipliedAlpha === true ) data.premultipliedAlpha = this.premultipliedAlpha;\n\n\t\tif ( this.wireframe === true ) data.wireframe = this.wireframe;\n\t\tif ( this.wireframeLinewidth > 1 ) data.wireframeLinewidth = this.wireframeLinewidth;\n\t\tif ( this.wireframeLinecap !== 'round' ) data.wireframeLinecap = this.wireframeLinecap;\n\t\tif ( this.wireframeLinejoin !== 'round' ) data.wireframeLinejoin = this.wireframeLinejoin;\n\n\t\tif ( this.morphTargets === true ) data.morphTargets = true;\n\t\tif ( this.morphNormals === true ) data.morphNormals = true;\n\t\tif ( this.skinning === true ) data.skinning = true;\n\n\t\tif ( this.visible === false ) data.visible = false;\n\n\t\tif ( this.toneMapped === false ) data.toneMapped = false;\n\n\t\tif ( JSON.stringify( this.userData ) !== '{}' ) data.userData = this.userData;\n\n\t\t// TODO: Copied from Object3D.toJSON\n\n\t\tfunction extractFromCache( cache ) {\n\n\t\t\tvar values = [];\n\n\t\t\tfor ( var key in cache ) {\n\n\t\t\t\tvar data = cache[ key ];\n\t\t\t\tdelete data.metadata;\n\t\t\t\tvalues.push( data );\n\n\t\t\t}\n\n\t\t\treturn values;\n\n\t\t}\n\n\t\tif ( isRoot ) {\n\n\t\t\tvar textures = extractFromCache( meta.textures );\n\t\t\tvar images = extractFromCache( meta.images );\n\n\t\t\tif ( textures.length > 0 ) data.textures = textures;\n\t\t\tif ( images.length > 0 ) data.images = images;\n\n\t\t}\n\n\t\treturn data;\n\n\t},\n\n\tclone: function () {\n\n\t\treturn new this.constructor().copy( this );\n\n\t},\n\n\tcopy: function ( source ) {\n\n\t\tthis.name = source.name;\n\n\t\tthis.fog = source.fog;\n\n\t\tthis.blending = source.blending;\n\t\tthis.side = source.side;\n\t\tthis.flatShading = source.flatShading;\n\t\tthis.vertexTangents = source.vertexTangents;\n\t\tthis.vertexColors = source.vertexColors;\n\n\t\tthis.opacity = source.opacity;\n\t\tthis.transparent = source.transparent;\n\n\t\tthis.blendSrc = source.blendSrc;\n\t\tthis.blendDst = source.blendDst;\n\t\tthis.blendEquation = source.blendEquation;\n\t\tthis.blendSrcAlpha = source.blendSrcAlpha;\n\t\tthis.blendDstAlpha = source.blendDstAlpha;\n\t\tthis.blendEquationAlpha = source.blendEquationAlpha;\n\n\t\tthis.depthFunc = source.depthFunc;\n\t\tthis.depthTest = source.depthTest;\n\t\tthis.depthWrite = source.depthWrite;\n\n\t\tthis.stencilWriteMask = source.stencilWriteMask;\n\t\tthis.stencilFunc = source.stencilFunc;\n\t\tthis.stencilRef = source.stencilRef;\n\t\tthis.stencilFuncMask = source.stencilFuncMask;\n\t\tthis.stencilFail = source.stencilFail;\n\t\tthis.stencilZFail = source.stencilZFail;\n\t\tthis.stencilZPass = source.stencilZPass;\n\t\tthis.stencilWrite = source.stencilWrite;\n\n\t\tvar srcPlanes = source.clippingPlanes,\n\t\t\tdstPlanes = null;\n\n\t\tif ( srcPlanes !== null ) {\n\n\t\t\tvar n = srcPlanes.length;\n\t\t\tdstPlanes = new Array( n );\n\n\t\t\tfor ( var i = 0; i !== n; ++ i )\n\t\t\t\tdstPlanes[ i ] = srcPlanes[ i ].clone();\n\n\t\t}\n\n\t\tthis.clippingPlanes = dstPlanes;\n\t\tthis.clipIntersection = source.clipIntersection;\n\t\tthis.clipShadows = source.clipShadows;\n\n\t\tthis.shadowSide = source.shadowSide;\n\n\t\tthis.colorWrite = source.colorWrite;\n\n\t\tthis.precision = source.precision;\n\n\t\tthis.polygonOffset = source.polygonOffset;\n\t\tthis.polygonOffsetFactor = source.polygonOffsetFactor;\n\t\tthis.polygonOffsetUnits = source.polygonOffsetUnits;\n\n\t\tthis.dithering = source.dithering;\n\n\t\tthis.alphaTest = source.alphaTest;\n\t\tthis.premultipliedAlpha = source.premultipliedAlpha;\n\n\t\tthis.visible = source.visible;\n\n\t\tthis.toneMapped = source.toneMapped;\n\n\t\tthis.userData = JSON.parse( JSON.stringify( source.userData ) );\n\n\t\treturn this;\n\n\t},\n\n\tdispose: function () {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n} );\n\nObject.defineProperty( Material.prototype, 'needsUpdate', {\n\n\tset: function ( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n * @author alteredq / http://alteredqualia.com/\n *\n * parameters = {\n * color: ,\n * opacity: ,\n * map: new THREE.Texture( ),\n *\n * lightMap: new THREE.Texture( ),\n * lightMapIntensity: \n *\n * aoMap: new THREE.Texture( ),\n * aoMapIntensity: \n *\n * specularMap: new THREE.Texture( ),\n *\n * alphaMap: new THREE.Texture( ),\n *\n * envMap: new THREE.CubeTexture( [posx, negx, posy, negy, posz, negz] ),\n * combine: THREE.Multiply,\n * reflectivity: ,\n * refractionRatio: ,\n *\n * depthTest: ,\n * depthWrite: ,\n *\n * wireframe: ,\n * wireframeLinewidth: ,\n *\n * skinning: ,\n * morphTargets: \n * }\n */\n\nfunction MeshBasicMaterial( parameters ) {\n\n\tMaterial.call( this );\n\n\tthis.type = 'MeshBasicMaterial';\n\n\tthis.color = new Color( 0xffffff ); // emissive\n\n\tthis.map = null;\n\n\tthis.lightMap = null;\n\tthis.lightMapIntensity = 1.0;\n\n\tthis.aoMap = null;\n\tthis.aoMapIntensity = 1.0;\n\n\tthis.specularMap = null;\n\n\tthis.alphaMap = null;\n\n\tthis.envMap = null;\n\tthis.combine = MultiplyOperation;\n\tthis.reflectivity = 1;\n\tthis.refractionRatio = 0.98;\n\n\tthis.wireframe = false;\n\tthis.wireframeLinewidth = 1;\n\tthis.wireframeLinecap = 'round';\n\tthis.wireframeLinejoin = 'round';\n\n\tthis.skinning = false;\n\tthis.morphTargets = false;\n\n\tthis.setValues( parameters );\n\n}\n\nMeshBasicMaterial.prototype = Object.create( Material.prototype );\nMeshBasicMaterial.prototype.constructor = MeshBasicMaterial;\n\nMeshBasicMaterial.prototype.isMeshBasicMaterial = true;\n\nMeshBasicMaterial.prototype.copy = function ( source ) {\n\n\tMaterial.prototype.copy.call( this, source );\n\n\tthis.color.copy( source.color );\n\n\tthis.map = source.map;\n\n\tthis.lightMap = source.lightMap;\n\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\tthis.aoMap = source.aoMap;\n\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\tthis.specularMap = source.specularMap;\n\n\tthis.alphaMap = source.alphaMap;\n\n\tthis.envMap = source.envMap;\n\tthis.combine = source.combine;\n\tthis.reflectivity = source.reflectivity;\n\tthis.refractionRatio = source.refractionRatio;\n\n\tthis.wireframe = source.wireframe;\n\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\tthis.wireframeLinecap = source.wireframeLinecap;\n\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\tthis.skinning = source.skinning;\n\tthis.morphTargets = source.morphTargets;\n\n\treturn this;\n\n};\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nvar _vector$3 = new Vector3();\n\nfunction BufferAttribute( array, itemSize, normalized ) {\n\n\tif ( Array.isArray( array ) ) {\n\n\t\tthrow new TypeError( 'THREE.BufferAttribute: array should be a Typed Array.' );\n\n\t}\n\n\tthis.name = '';\n\n\tthis.array = array;\n\tthis.itemSize = itemSize;\n\tthis.count = array !== undefined ? array.length / itemSize : 0;\n\tthis.normalized = normalized === true;\n\n\tthis.usage = StaticDrawUsage;\n\tthis.updateRange = { offset: 0, count: - 1 };\n\n\tthis.version = 0;\n\n}\n\nObject.defineProperty( BufferAttribute.prototype, 'needsUpdate', {\n\n\tset: function ( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n} );\n\nObject.assign( BufferAttribute.prototype, {\n\n\tisBufferAttribute: true,\n\n\tonUploadCallback: function () {},\n\n\tsetUsage: function ( value ) {\n\n\t\tthis.usage = value;\n\n\t\treturn this;\n\n\t},\n\n\tcopy: function ( source ) {\n\n\t\tthis.name = source.name;\n\t\tthis.array = new source.array.constructor( source.array );\n\t\tthis.itemSize = source.itemSize;\n\t\tthis.count = source.count;\n\t\tthis.normalized = source.normalized;\n\n\t\tthis.usage = source.usage;\n\n\t\treturn this;\n\n\t},\n\n\tcopyAt: function ( index1, attribute, index2 ) {\n\n\t\tindex1 *= this.itemSize;\n\t\tindex2 *= attribute.itemSize;\n\n\t\tfor ( var i = 0, l = this.itemSize; i < l; i ++ ) {\n\n\t\t\tthis.array[ index1 + i ] = attribute.array[ index2 + i ];\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tcopyArray: function ( array ) {\n\n\t\tthis.array.set( array );\n\n\t\treturn this;\n\n\t},\n\n\tcopyColorsArray: function ( colors ) {\n\n\t\tvar array = this.array, offset = 0;\n\n\t\tfor ( var i = 0, l = colors.length; i < l; i ++ ) {\n\n\t\t\tvar color = colors[ i ];\n\n\t\t\tif ( color === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.BufferAttribute.copyColorsArray(): color is undefined', i );\n\t\t\t\tcolor = new Color();\n\n\t\t\t}\n\n\t\t\tarray[ offset ++ ] = color.r;\n\t\t\tarray[ offset ++ ] = color.g;\n\t\t\tarray[ offset ++ ] = color.b;\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tcopyVector2sArray: function ( vectors ) {\n\n\t\tvar array = this.array, offset = 0;\n\n\t\tfor ( var i = 0, l = vectors.length; i < l; i ++ ) {\n\n\t\t\tvar vector = vectors[ i ];\n\n\t\t\tif ( vector === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.BufferAttribute.copyVector2sArray(): vector is undefined', i );\n\t\t\t\tvector = new Vector2();\n\n\t\t\t}\n\n\t\t\tarray[ offset ++ ] = vector.x;\n\t\t\tarray[ offset ++ ] = vector.y;\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tcopyVector3sArray: function ( vectors ) {\n\n\t\tvar array = this.array, offset = 0;\n\n\t\tfor ( var i = 0, l = vectors.length; i < l; i ++ ) {\n\n\t\t\tvar vector = vectors[ i ];\n\n\t\t\tif ( vector === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.BufferAttribute.copyVector3sArray(): vector is undefined', i );\n\t\t\t\tvector = new Vector3();\n\n\t\t\t}\n\n\t\t\tarray[ offset ++ ] = vector.x;\n\t\t\tarray[ offset ++ ] = vector.y;\n\t\t\tarray[ offset ++ ] = vector.z;\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tcopyVector4sArray: function ( vectors ) {\n\n\t\tvar array = this.array, offset = 0;\n\n\t\tfor ( var i = 0, l = vectors.length; i < l; i ++ ) {\n\n\t\t\tvar vector = vectors[ i ];\n\n\t\t\tif ( vector === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.BufferAttribute.copyVector4sArray(): vector is undefined', i );\n\t\t\t\tvector = new Vector4();\n\n\t\t\t}\n\n\t\t\tarray[ offset ++ ] = vector.x;\n\t\t\tarray[ offset ++ ] = vector.y;\n\t\t\tarray[ offset ++ ] = vector.z;\n\t\t\tarray[ offset ++ ] = vector.w;\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tapplyMatrix3: function ( m ) {\n\n\t\tfor ( var i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$3.x = this.getX( i );\n\t\t\t_vector$3.y = this.getY( i );\n\t\t\t_vector$3.z = this.getZ( i );\n\n\t\t\t_vector$3.applyMatrix3( m );\n\n\t\t\tthis.setXYZ( i, _vector$3.x, _vector$3.y, _vector$3.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tapplyMatrix4: function ( m ) {\n\n\t\tfor ( var i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$3.x = this.getX( i );\n\t\t\t_vector$3.y = this.getY( i );\n\t\t\t_vector$3.z = this.getZ( i );\n\n\t\t\t_vector$3.applyMatrix4( m );\n\n\t\t\tthis.setXYZ( i, _vector$3.x, _vector$3.y, _vector$3.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tapplyNormalMatrix: function ( m ) {\n\n\t\tfor ( var i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$3.x = this.getX( i );\n\t\t\t_vector$3.y = this.getY( i );\n\t\t\t_vector$3.z = this.getZ( i );\n\n\t\t\t_vector$3.applyNormalMatrix( m );\n\n\t\t\tthis.setXYZ( i, _vector$3.x, _vector$3.y, _vector$3.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\ttransformDirection: function ( m ) {\n\n\t\tfor ( var i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$3.x = this.getX( i );\n\t\t\t_vector$3.y = this.getY( i );\n\t\t\t_vector$3.z = this.getZ( i );\n\n\t\t\t_vector$3.transformDirection( m );\n\n\t\t\tthis.setXYZ( i, _vector$3.x, _vector$3.y, _vector$3.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tset: function ( value, offset ) {\n\n\t\tif ( offset === undefined ) offset = 0;\n\n\t\tthis.array.set( value, offset );\n\n\t\treturn this;\n\n\t},\n\n\tgetX: function ( index ) {\n\n\t\treturn this.array[ index * this.itemSize ];\n\n\t},\n\n\tsetX: function ( index, x ) {\n\n\t\tthis.array[ index * this.itemSize ] = x;\n\n\t\treturn this;\n\n\t},\n\n\tgetY: function ( index ) {\n\n\t\treturn this.array[ index * this.itemSize + 1 ];\n\n\t},\n\n\tsetY: function ( index, y ) {\n\n\t\tthis.array[ index * this.itemSize + 1 ] = y;\n\n\t\treturn this;\n\n\t},\n\n\tgetZ: function ( index ) {\n\n\t\treturn this.array[ index * this.itemSize + 2 ];\n\n\t},\n\n\tsetZ: function ( index, z ) {\n\n\t\tthis.array[ index * this.itemSize + 2 ] = z;\n\n\t\treturn this;\n\n\t},\n\n\tgetW: function ( index ) {\n\n\t\treturn this.array[ index * this.itemSize + 3 ];\n\n\t},\n\n\tsetW: function ( index, w ) {\n\n\t\tthis.array[ index * this.itemSize + 3 ] = w;\n\n\t\treturn this;\n\n\t},\n\n\tsetXY: function ( index, x, y ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tthis.array[ index + 0 ] = x;\n\t\tthis.array[ index + 1 ] = y;\n\n\t\treturn this;\n\n\t},\n\n\tsetXYZ: function ( index, x, y, z ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tthis.array[ index + 0 ] = x;\n\t\tthis.array[ index + 1 ] = y;\n\t\tthis.array[ index + 2 ] = z;\n\n\t\treturn this;\n\n\t},\n\n\tsetXYZW: function ( index, x, y, z, w ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tthis.array[ index + 0 ] = x;\n\t\tthis.array[ index + 1 ] = y;\n\t\tthis.array[ index + 2 ] = z;\n\t\tthis.array[ index + 3 ] = w;\n\n\t\treturn this;\n\n\t},\n\n\tonUpload: function ( callback ) {\n\n\t\tthis.onUploadCallback = callback;\n\n\t\treturn this;\n\n\t},\n\n\tclone: function () {\n\n\t\treturn new this.constructor( this.array, this.itemSize ).copy( this );\n\n\t},\n\n\ttoJSON: function () {\n\n\t\treturn {\n\t\t\titemSize: this.itemSize,\n\t\t\ttype: this.array.constructor.name,\n\t\t\tarray: Array.prototype.slice.call( this.array ),\n\t\t\tnormalized: this.normalized\n\t\t};\n\n\t}\n\n} );\n\n//\n\nfunction Int8BufferAttribute( array, itemSize, normalized ) {\n\n\tBufferAttribute.call( this, new Int8Array( array ), itemSize, normalized );\n\n}\n\nInt8BufferAttribute.prototype = Object.create( BufferAttribute.prototype );\nInt8BufferAttribute.prototype.constructor = Int8BufferAttribute;\n\n\nfunction Uint8BufferAttribute( array, itemSize, normalized ) {\n\n\tBufferAttribute.call( this, new Uint8Array( array ), itemSize, normalized );\n\n}\n\nUint8BufferAttribute.prototype = Object.create( BufferAttribute.prototype );\nUint8BufferAttribute.prototype.constructor = Uint8BufferAttribute;\n\n\nfunction Uint8ClampedBufferAttribute( array, itemSize, normalized ) {\n\n\tBufferAttribute.call( this, new Uint8ClampedArray( array ), itemSize, normalized );\n\n}\n\nUint8ClampedBufferAttribute.prototype = Object.create( BufferAttribute.prototype );\nUint8ClampedBufferAttribute.prototype.constructor = Uint8ClampedBufferAttribute;\n\n\nfunction Int16BufferAttribute( array, itemSize, normalized ) {\n\n\tBufferAttribute.call( this, new Int16Array( array ), itemSize, normalized );\n\n}\n\nInt16BufferAttribute.prototype = Object.create( BufferAttribute.prototype );\nInt16BufferAttribute.prototype.constructor = Int16BufferAttribute;\n\n\nfunction Uint16BufferAttribute( array, itemSize, normalized ) {\n\n\tBufferAttribute.call( this, new Uint16Array( array ), itemSize, normalized );\n\n}\n\nUint16BufferAttribute.prototype = Object.create( BufferAttribute.prototype );\nUint16BufferAttribute.prototype.constructor = Uint16BufferAttribute;\n\n\nfunction Int32BufferAttribute( array, itemSize, normalized ) {\n\n\tBufferAttribute.call( this, new Int32Array( array ), itemSize, normalized );\n\n}\n\nInt32BufferAttribute.prototype = Object.create( BufferAttribute.prototype );\nInt32BufferAttribute.prototype.constructor = Int32BufferAttribute;\n\n\nfunction Uint32BufferAttribute( array, itemSize, normalized ) {\n\n\tBufferAttribute.call( this, new Uint32Array( array ), itemSize, normalized );\n\n}\n\nUint32BufferAttribute.prototype = Object.create( BufferAttribute.prototype );\nUint32BufferAttribute.prototype.constructor = Uint32BufferAttribute;\n\n\nfunction Float32BufferAttribute( array, itemSize, normalized ) {\n\n\tBufferAttribute.call( this, new Float32Array( array ), itemSize, normalized );\n\n}\n\nFloat32BufferAttribute.prototype = Object.create( BufferAttribute.prototype );\nFloat32BufferAttribute.prototype.constructor = Float32BufferAttribute;\n\n\nfunction Float64BufferAttribute( array, itemSize, normalized ) {\n\n\tBufferAttribute.call( this, new Float64Array( array ), itemSize, normalized );\n\n}\n\nFloat64BufferAttribute.prototype = Object.create( BufferAttribute.prototype );\nFloat64BufferAttribute.prototype.constructor = Float64BufferAttribute;\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction DirectGeometry() {\n\n\tthis.vertices = [];\n\tthis.normals = [];\n\tthis.colors = [];\n\tthis.uvs = [];\n\tthis.uvs2 = [];\n\n\tthis.groups = [];\n\n\tthis.morphTargets = {};\n\n\tthis.skinWeights = [];\n\tthis.skinIndices = [];\n\n\t// this.lineDistances = [];\n\n\tthis.boundingBox = null;\n\tthis.boundingSphere = null;\n\n\t// update flags\n\n\tthis.verticesNeedUpdate = false;\n\tthis.normalsNeedUpdate = false;\n\tthis.colorsNeedUpdate = false;\n\tthis.uvsNeedUpdate = false;\n\tthis.groupsNeedUpdate = false;\n\n}\n\nObject.assign( DirectGeometry.prototype, {\n\n\tcomputeGroups: function ( geometry ) {\n\n\t\tvar group;\n\t\tvar groups = [];\n\t\tvar materialIndex = undefined;\n\n\t\tvar faces = geometry.faces;\n\n\t\tfor ( var i = 0; i < faces.length; i ++ ) {\n\n\t\t\tvar face = faces[ i ];\n\n\t\t\t// materials\n\n\t\t\tif ( face.materialIndex !== materialIndex ) {\n\n\t\t\t\tmaterialIndex = face.materialIndex;\n\n\t\t\t\tif ( group !== undefined ) {\n\n\t\t\t\t\tgroup.count = ( i * 3 ) - group.start;\n\t\t\t\t\tgroups.push( group );\n\n\t\t\t\t}\n\n\t\t\t\tgroup = {\n\t\t\t\t\tstart: i * 3,\n\t\t\t\t\tmaterialIndex: materialIndex\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( group !== undefined ) {\n\n\t\t\tgroup.count = ( i * 3 ) - group.start;\n\t\t\tgroups.push( group );\n\n\t\t}\n\n\t\tthis.groups = groups;\n\n\t},\n\n\tfromGeometry: function ( geometry ) {\n\n\t\tvar faces = geometry.faces;\n\t\tvar vertices = geometry.vertices;\n\t\tvar faceVertexUvs = geometry.faceVertexUvs;\n\n\t\tvar hasFaceVertexUv = faceVertexUvs[ 0 ] && faceVertexUvs[ 0 ].length > 0;\n\t\tvar hasFaceVertexUv2 = faceVertexUvs[ 1 ] && faceVertexUvs[ 1 ].length > 0;\n\n\t\t// morphs\n\n\t\tvar morphTargets = geometry.morphTargets;\n\t\tvar morphTargetsLength = morphTargets.length;\n\n\t\tvar morphTargetsPosition;\n\n\t\tif ( morphTargetsLength > 0 ) {\n\n\t\t\tmorphTargetsPosition = [];\n\n\t\t\tfor ( var i = 0; i < morphTargetsLength; i ++ ) {\n\n\t\t\t\tmorphTargetsPosition[ i ] = {\n\t\t\t\t\tname: morphTargets[ i ].name,\n\t\t\t\t \tdata: []\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t\tthis.morphTargets.position = morphTargetsPosition;\n\n\t\t}\n\n\t\tvar morphNormals = geometry.morphNormals;\n\t\tvar morphNormalsLength = morphNormals.length;\n\n\t\tvar morphTargetsNormal;\n\n\t\tif ( morphNormalsLength > 0 ) {\n\n\t\t\tmorphTargetsNormal = [];\n\n\t\t\tfor ( var i = 0; i < morphNormalsLength; i ++ ) {\n\n\t\t\t\tmorphTargetsNormal[ i ] = {\n\t\t\t\t\tname: morphNormals[ i ].name,\n\t\t\t\t \tdata: []\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t\tthis.morphTargets.normal = morphTargetsNormal;\n\n\t\t}\n\n\t\t// skins\n\n\t\tvar skinIndices = geometry.skinIndices;\n\t\tvar skinWeights = geometry.skinWeights;\n\n\t\tvar hasSkinIndices = skinIndices.length === vertices.length;\n\t\tvar hasSkinWeights = skinWeights.length === vertices.length;\n\n\t\t//\n\n\t\tif ( vertices.length > 0 && faces.length === 0 ) {\n\n\t\t\tconsole.error( 'THREE.DirectGeometry: Faceless geometries are not supported.' );\n\n\t\t}\n\n\t\tfor ( var i = 0; i < faces.length; i ++ ) {\n\n\t\t\tvar face = faces[ i ];\n\n\t\t\tthis.vertices.push( vertices[ face.a ], vertices[ face.b ], vertices[ face.c ] );\n\n\t\t\tvar vertexNormals = face.vertexNormals;\n\n\t\t\tif ( vertexNormals.length === 3 ) {\n\n\t\t\t\tthis.normals.push( vertexNormals[ 0 ], vertexNormals[ 1 ], vertexNormals[ 2 ] );\n\n\t\t\t} else {\n\n\t\t\t\tvar normal = face.normal;\n\n\t\t\t\tthis.normals.push( normal, normal, normal );\n\n\t\t\t}\n\n\t\t\tvar vertexColors = face.vertexColors;\n\n\t\t\tif ( vertexColors.length === 3 ) {\n\n\t\t\t\tthis.colors.push( vertexColors[ 0 ], vertexColors[ 1 ], vertexColors[ 2 ] );\n\n\t\t\t} else {\n\n\t\t\t\tvar color = face.color;\n\n\t\t\t\tthis.colors.push( color, color, color );\n\n\t\t\t}\n\n\t\t\tif ( hasFaceVertexUv === true ) {\n\n\t\t\t\tvar vertexUvs = faceVertexUvs[ 0 ][ i ];\n\n\t\t\t\tif ( vertexUvs !== undefined ) {\n\n\t\t\t\t\tthis.uvs.push( vertexUvs[ 0 ], vertexUvs[ 1 ], vertexUvs[ 2 ] );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.warn( 'THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ', i );\n\n\t\t\t\t\tthis.uvs.push( new Vector2(), new Vector2(), new Vector2() );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( hasFaceVertexUv2 === true ) {\n\n\t\t\t\tvar vertexUvs = faceVertexUvs[ 1 ][ i ];\n\n\t\t\t\tif ( vertexUvs !== undefined ) {\n\n\t\t\t\t\tthis.uvs2.push( vertexUvs[ 0 ], vertexUvs[ 1 ], vertexUvs[ 2 ] );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.warn( 'THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ', i );\n\n\t\t\t\t\tthis.uvs2.push( new Vector2(), new Vector2(), new Vector2() );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// morphs\n\n\t\t\tfor ( var j = 0; j < morphTargetsLength; j ++ ) {\n\n\t\t\t\tvar morphTarget = morphTargets[ j ].vertices;\n\n\t\t\t\tmorphTargetsPosition[ j ].data.push( morphTarget[ face.a ], morphTarget[ face.b ], morphTarget[ face.c ] );\n\n\t\t\t}\n\n\t\t\tfor ( var j = 0; j < morphNormalsLength; j ++ ) {\n\n\t\t\t\tvar morphNormal = morphNormals[ j ].vertexNormals[ i ];\n\n\t\t\t\tmorphTargetsNormal[ j ].data.push( morphNormal.a, morphNormal.b, morphNormal.c );\n\n\t\t\t}\n\n\t\t\t// skins\n\n\t\t\tif ( hasSkinIndices ) {\n\n\t\t\t\tthis.skinIndices.push( skinIndices[ face.a ], skinIndices[ face.b ], skinIndices[ face.c ] );\n\n\t\t\t}\n\n\t\t\tif ( hasSkinWeights ) {\n\n\t\t\t\tthis.skinWeights.push( skinWeights[ face.a ], skinWeights[ face.b ], skinWeights[ face.c ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.computeGroups( geometry );\n\n\t\tthis.verticesNeedUpdate = geometry.verticesNeedUpdate;\n\t\tthis.normalsNeedUpdate = geometry.normalsNeedUpdate;\n\t\tthis.colorsNeedUpdate = geometry.colorsNeedUpdate;\n\t\tthis.uvsNeedUpdate = geometry.uvsNeedUpdate;\n\t\tthis.groupsNeedUpdate = geometry.groupsNeedUpdate;\n\n\t\tif ( geometry.boundingSphere !== null ) {\n\n\t\t\tthis.boundingSphere = geometry.boundingSphere.clone();\n\n\t\t}\n\n\t\tif ( geometry.boundingBox !== null ) {\n\n\t\t\tthis.boundingBox = geometry.boundingBox.clone();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction arrayMax( array ) {\n\n\tif ( array.length === 0 ) return - Infinity;\n\n\tvar max = array[ 0 ];\n\n\tfor ( var i = 1, l = array.length; i < l; ++ i ) {\n\n\t\tif ( array[ i ] > max ) max = array[ i ];\n\n\t}\n\n\treturn max;\n\n}\n\n/**\n * @author alteredq / http://alteredqualia.com/\n * @author mrdoob / http://mrdoob.com/\n */\n\nvar _bufferGeometryId = 1; // BufferGeometry uses odd numbers as Id\n\nvar _m1$2 = new Matrix4();\nvar _obj = new Object3D();\nvar _offset = new Vector3();\nvar _box$2 = new Box3();\nvar _boxMorphTargets = new Box3();\nvar _vector$4 = new Vector3();\n\nfunction BufferGeometry() {\n\n\tObject.defineProperty( this, 'id', { value: _bufferGeometryId += 2 } );\n\n\tthis.uuid = MathUtils.generateUUID();\n\n\tthis.name = '';\n\tthis.type = 'BufferGeometry';\n\n\tthis.index = null;\n\tthis.attributes = {};\n\n\tthis.morphAttributes = {};\n\tthis.morphTargetsRelative = false;\n\n\tthis.groups = [];\n\n\tthis.boundingBox = null;\n\tthis.boundingSphere = null;\n\n\tthis.drawRange = { start: 0, count: Infinity };\n\n\tthis.userData = {};\n\n}\n\nBufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), {\n\n\tconstructor: BufferGeometry,\n\n\tisBufferGeometry: true,\n\n\tgetIndex: function () {\n\n\t\treturn this.index;\n\n\t},\n\n\tsetIndex: function ( index ) {\n\n\t\tif ( Array.isArray( index ) ) {\n\n\t\t\tthis.index = new ( arrayMax( index ) > 65535 ? Uint32BufferAttribute : Uint16BufferAttribute )( index, 1 );\n\n\t\t} else {\n\n\t\t\tthis.index = index;\n\n\t\t}\n\n\t},\n\n\tgetAttribute: function ( name ) {\n\n\t\treturn this.attributes[ name ];\n\n\t},\n\n\tsetAttribute: function ( name, attribute ) {\n\n\t\tthis.attributes[ name ] = attribute;\n\n\t\treturn this;\n\n\t},\n\n\tdeleteAttribute: function ( name ) {\n\n\t\tdelete this.attributes[ name ];\n\n\t\treturn this;\n\n\t},\n\n\taddGroup: function ( start, count, materialIndex ) {\n\n\t\tthis.groups.push( {\n\n\t\t\tstart: start,\n\t\t\tcount: count,\n\t\t\tmaterialIndex: materialIndex !== undefined ? materialIndex : 0\n\n\t\t} );\n\n\t},\n\n\tclearGroups: function () {\n\n\t\tthis.groups = [];\n\n\t},\n\n\tsetDrawRange: function ( start, count ) {\n\n\t\tthis.drawRange.start = start;\n\t\tthis.drawRange.count = count;\n\n\t},\n\n\tapplyMatrix4: function ( matrix ) {\n\n\t\tvar position = this.attributes.position;\n\n\t\tif ( position !== undefined ) {\n\n\t\t\tposition.applyMatrix4( matrix );\n\n\t\t\tposition.needsUpdate = true;\n\n\t\t}\n\n\t\tvar normal = this.attributes.normal;\n\n\t\tif ( normal !== undefined ) {\n\n\t\t\tvar normalMatrix = new Matrix3().getNormalMatrix( matrix );\n\n\t\t\tnormal.applyNormalMatrix( normalMatrix );\n\n\t\t\tnormal.needsUpdate = true;\n\n\t\t}\n\n\t\tvar tangent = this.attributes.tangent;\n\n\t\tif ( tangent !== undefined ) {\n\n\t\t\ttangent.transformDirection( matrix );\n\n\t\t\ttangent.needsUpdate = true;\n\n\t\t}\n\n\t\tif ( this.boundingBox !== null ) {\n\n\t\t\tthis.computeBoundingBox();\n\n\t\t}\n\n\t\tif ( this.boundingSphere !== null ) {\n\n\t\t\tthis.computeBoundingSphere();\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\trotateX: function ( angle ) {\n\n\t\t// rotate geometry around world x-axis\n\n\t\t_m1$2.makeRotationX( angle );\n\n\t\tthis.applyMatrix4( _m1$2 );\n\n\t\treturn this;\n\n\t},\n\n\trotateY: function ( angle ) {\n\n\t\t// rotate geometry around world y-axis\n\n\t\t_m1$2.makeRotationY( angle );\n\n\t\tthis.applyMatrix4( _m1$2 );\n\n\t\treturn this;\n\n\t},\n\n\trotateZ: function ( angle ) {\n\n\t\t// rotate geometry around world z-axis\n\n\t\t_m1$2.makeRotationZ( angle );\n\n\t\tthis.applyMatrix4( _m1$2 );\n\n\t\treturn this;\n\n\t},\n\n\ttranslate: function ( x, y, z ) {\n\n\t\t// translate geometry\n\n\t\t_m1$2.makeTranslation( x, y, z );\n\n\t\tthis.applyMatrix4( _m1$2 );\n\n\t\treturn this;\n\n\t},\n\n\tscale: function ( x, y, z ) {\n\n\t\t// scale geometry\n\n\t\t_m1$2.makeScale( x, y, z );\n\n\t\tthis.applyMatrix4( _m1$2 );\n\n\t\treturn this;\n\n\t},\n\n\tlookAt: function ( vector ) {\n\n\t\t_obj.lookAt( vector );\n\n\t\t_obj.updateMatrix();\n\n\t\tthis.applyMatrix4( _obj.matrix );\n\n\t\treturn this;\n\n\t},\n\n\tcenter: function () {\n\n\t\tthis.computeBoundingBox();\n\n\t\tthis.boundingBox.getCenter( _offset ).negate();\n\n\t\tthis.translate( _offset.x, _offset.y, _offset.z );\n\n\t\treturn this;\n\n\t},\n\n\tsetFromObject: function ( object ) {\n\n\t\t// console.log( 'THREE.BufferGeometry.setFromObject(). Converting', object, this );\n\n\t\tvar geometry = object.geometry;\n\n\t\tif ( object.isPoints || object.isLine ) {\n\n\t\t\tvar positions = new Float32BufferAttribute( geometry.vertices.length * 3, 3 );\n\t\t\tvar colors = new Float32BufferAttribute( geometry.colors.length * 3, 3 );\n\n\t\t\tthis.setAttribute( 'position', positions.copyVector3sArray( geometry.vertices ) );\n\t\t\tthis.setAttribute( 'color', colors.copyColorsArray( geometry.colors ) );\n\n\t\t\tif ( geometry.lineDistances && geometry.lineDistances.length === geometry.vertices.length ) {\n\n\t\t\t\tvar lineDistances = new Float32BufferAttribute( geometry.lineDistances.length, 1 );\n\n\t\t\t\tthis.setAttribute( 'lineDistance', lineDistances.copyArray( geometry.lineDistances ) );\n\n\t\t\t}\n\n\t\t\tif ( geometry.boundingSphere !== null ) {\n\n\t\t\t\tthis.boundingSphere = geometry.boundingSphere.clone();\n\n\t\t\t}\n\n\t\t\tif ( geometry.boundingBox !== null ) {\n\n\t\t\t\tthis.boundingBox = geometry.boundingBox.clone();\n\n\t\t\t}\n\n\t\t} else if ( object.isMesh ) {\n\n\t\t\tif ( geometry && geometry.isGeometry ) {\n\n\t\t\t\tthis.fromGeometry( geometry );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tsetFromPoints: function ( points ) {\n\n\t\tvar position = [];\n\n\t\tfor ( var i = 0, l = points.length; i < l; i ++ ) {\n\n\t\t\tvar point = points[ i ];\n\t\t\tposition.push( point.x, point.y, point.z || 0 );\n\n\t\t}\n\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( position, 3 ) );\n\n\t\treturn this;\n\n\t},\n\n\tupdateFromObject: function ( object ) {\n\n\t\tvar geometry = object.geometry;\n\n\t\tif ( object.isMesh ) {\n\n\t\t\tvar direct = geometry.__directGeometry;\n\n\t\t\tif ( geometry.elementsNeedUpdate === true ) {\n\n\t\t\t\tdirect = undefined;\n\t\t\t\tgeometry.elementsNeedUpdate = false;\n\n\t\t\t}\n\n\t\t\tif ( direct === undefined ) {\n\n\t\t\t\treturn this.fromGeometry( geometry );\n\n\t\t\t}\n\n\t\t\tdirect.verticesNeedUpdate = geometry.verticesNeedUpdate;\n\t\t\tdirect.normalsNeedUpdate = geometry.normalsNeedUpdate;\n\t\t\tdirect.colorsNeedUpdate = geometry.colorsNeedUpdate;\n\t\t\tdirect.uvsNeedUpdate = geometry.uvsNeedUpdate;\n\t\t\tdirect.groupsNeedUpdate = geometry.groupsNeedUpdate;\n\n\t\t\tgeometry.verticesNeedUpdate = false;\n\t\t\tgeometry.normalsNeedUpdate = false;\n\t\t\tgeometry.colorsNeedUpdate = false;\n\t\t\tgeometry.uvsNeedUpdate = false;\n\t\t\tgeometry.groupsNeedUpdate = false;\n\n\t\t\tgeometry = direct;\n\n\t\t}\n\n\t\tvar attribute;\n\n\t\tif ( geometry.verticesNeedUpdate === true ) {\n\n\t\t\tattribute = this.attributes.position;\n\n\t\t\tif ( attribute !== undefined ) {\n\n\t\t\t\tattribute.copyVector3sArray( geometry.vertices );\n\t\t\t\tattribute.needsUpdate = true;\n\n\t\t\t}\n\n\t\t\tgeometry.verticesNeedUpdate = false;\n\n\t\t}\n\n\t\tif ( geometry.normalsNeedUpdate === true ) {\n\n\t\t\tattribute = this.attributes.normal;\n\n\t\t\tif ( attribute !== undefined ) {\n\n\t\t\t\tattribute.copyVector3sArray( geometry.normals );\n\t\t\t\tattribute.needsUpdate = true;\n\n\t\t\t}\n\n\t\t\tgeometry.normalsNeedUpdate = false;\n\n\t\t}\n\n\t\tif ( geometry.colorsNeedUpdate === true ) {\n\n\t\t\tattribute = this.attributes.color;\n\n\t\t\tif ( attribute !== undefined ) {\n\n\t\t\t\tattribute.copyColorsArray( geometry.colors );\n\t\t\t\tattribute.needsUpdate = true;\n\n\t\t\t}\n\n\t\t\tgeometry.colorsNeedUpdate = false;\n\n\t\t}\n\n\t\tif ( geometry.uvsNeedUpdate ) {\n\n\t\t\tattribute = this.attributes.uv;\n\n\t\t\tif ( attribute !== undefined ) {\n\n\t\t\t\tattribute.copyVector2sArray( geometry.uvs );\n\t\t\t\tattribute.needsUpdate = true;\n\n\t\t\t}\n\n\t\t\tgeometry.uvsNeedUpdate = false;\n\n\t\t}\n\n\t\tif ( geometry.lineDistancesNeedUpdate ) {\n\n\t\t\tattribute = this.attributes.lineDistance;\n\n\t\t\tif ( attribute !== undefined ) {\n\n\t\t\t\tattribute.copyArray( geometry.lineDistances );\n\t\t\t\tattribute.needsUpdate = true;\n\n\t\t\t}\n\n\t\t\tgeometry.lineDistancesNeedUpdate = false;\n\n\t\t}\n\n\t\tif ( geometry.groupsNeedUpdate ) {\n\n\t\t\tgeometry.computeGroups( object.geometry );\n\t\t\tthis.groups = geometry.groups;\n\n\t\t\tgeometry.groupsNeedUpdate = false;\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tfromGeometry: function ( geometry ) {\n\n\t\tgeometry.__directGeometry = new DirectGeometry().fromGeometry( geometry );\n\n\t\treturn this.fromDirectGeometry( geometry.__directGeometry );\n\n\t},\n\n\tfromDirectGeometry: function ( geometry ) {\n\n\t\tvar positions = new Float32Array( geometry.vertices.length * 3 );\n\t\tthis.setAttribute( 'position', new BufferAttribute( positions, 3 ).copyVector3sArray( geometry.vertices ) );\n\n\t\tif ( geometry.normals.length > 0 ) {\n\n\t\t\tvar normals = new Float32Array( geometry.normals.length * 3 );\n\t\t\tthis.setAttribute( 'normal', new BufferAttribute( normals, 3 ).copyVector3sArray( geometry.normals ) );\n\n\t\t}\n\n\t\tif ( geometry.colors.length > 0 ) {\n\n\t\t\tvar colors = new Float32Array( geometry.colors.length * 3 );\n\t\t\tthis.setAttribute( 'color', new BufferAttribute( colors, 3 ).copyColorsArray( geometry.colors ) );\n\n\t\t}\n\n\t\tif ( geometry.uvs.length > 0 ) {\n\n\t\t\tvar uvs = new Float32Array( geometry.uvs.length * 2 );\n\t\t\tthis.setAttribute( 'uv', new BufferAttribute( uvs, 2 ).copyVector2sArray( geometry.uvs ) );\n\n\t\t}\n\n\t\tif ( geometry.uvs2.length > 0 ) {\n\n\t\t\tvar uvs2 = new Float32Array( geometry.uvs2.length * 2 );\n\t\t\tthis.setAttribute( 'uv2', new BufferAttribute( uvs2, 2 ).copyVector2sArray( geometry.uvs2 ) );\n\n\t\t}\n\n\t\t// groups\n\n\t\tthis.groups = geometry.groups;\n\n\t\t// morphs\n\n\t\tfor ( var name in geometry.morphTargets ) {\n\n\t\t\tvar array = [];\n\t\t\tvar morphTargets = geometry.morphTargets[ name ];\n\n\t\t\tfor ( var i = 0, l = morphTargets.length; i < l; i ++ ) {\n\n\t\t\t\tvar morphTarget = morphTargets[ i ];\n\n\t\t\t\tvar attribute = new Float32BufferAttribute( morphTarget.data.length * 3, 3 );\n\t\t\t\tattribute.name = morphTarget.name;\n\n\t\t\t\tarray.push( attribute.copyVector3sArray( morphTarget.data ) );\n\n\t\t\t}\n\n\t\t\tthis.morphAttributes[ name ] = array;\n\n\t\t}\n\n\t\t// skinning\n\n\t\tif ( geometry.skinIndices.length > 0 ) {\n\n\t\t\tvar skinIndices = new Float32BufferAttribute( geometry.skinIndices.length * 4, 4 );\n\t\t\tthis.setAttribute( 'skinIndex', skinIndices.copyVector4sArray( geometry.skinIndices ) );\n\n\t\t}\n\n\t\tif ( geometry.skinWeights.length > 0 ) {\n\n\t\t\tvar skinWeights = new Float32BufferAttribute( geometry.skinWeights.length * 4, 4 );\n\t\t\tthis.setAttribute( 'skinWeight', skinWeights.copyVector4sArray( geometry.skinWeights ) );\n\n\t\t}\n\n\t\t//\n\n\t\tif ( geometry.boundingSphere !== null ) {\n\n\t\t\tthis.boundingSphere = geometry.boundingSphere.clone();\n\n\t\t}\n\n\t\tif ( geometry.boundingBox !== null ) {\n\n\t\t\tthis.boundingBox = geometry.boundingBox.clone();\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tcomputeBoundingBox: function () {\n\n\t\tif ( this.boundingBox === null ) {\n\n\t\t\tthis.boundingBox = new Box3();\n\n\t\t}\n\n\t\tvar position = this.attributes.position;\n\t\tvar morphAttributesPosition = this.morphAttributes.position;\n\n\t\tif ( position !== undefined ) {\n\n\t\t\tthis.boundingBox.setFromBufferAttribute( position );\n\n\t\t\t// process morph attributes if present\n\n\t\t\tif ( morphAttributesPosition ) {\n\n\t\t\t\tfor ( var i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {\n\n\t\t\t\t\tvar morphAttribute = morphAttributesPosition[ i ];\n\t\t\t\t\t_box$2.setFromBufferAttribute( morphAttribute );\n\n\t\t\t\t\tif ( this.morphTargetsRelative ) {\n\n\t\t\t\t\t\t_vector$4.addVectors( this.boundingBox.min, _box$2.min );\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _vector$4 );\n\n\t\t\t\t\t\t_vector$4.addVectors( this.boundingBox.max, _box$2.max );\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _vector$4 );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _box$2.min );\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _box$2.max );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tthis.boundingBox.makeEmpty();\n\n\t\t}\n\n\t\tif ( isNaN( this.boundingBox.min.x ) || isNaN( this.boundingBox.min.y ) || isNaN( this.boundingBox.min.z ) ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The \"position\" attribute is likely to have NaN values.', this );\n\n\t\t}\n\n\t},\n\n\tcomputeBoundingSphere: function () {\n\n\t\tif ( this.boundingSphere === null ) {\n\n\t\t\tthis.boundingSphere = new Sphere();\n\n\t\t}\n\n\t\tvar position = this.attributes.position;\n\t\tvar morphAttributesPosition = this.morphAttributes.position;\n\n\t\tif ( position ) {\n\n\t\t\t// first, find the center of the bounding sphere\n\n\t\t\tvar center = this.boundingSphere.center;\n\n\t\t\t_box$2.setFromBufferAttribute( position );\n\n\t\t\t// process morph attributes if present\n\n\t\t\tif ( morphAttributesPosition ) {\n\n\t\t\t\tfor ( var i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {\n\n\t\t\t\t\tvar morphAttribute = morphAttributesPosition[ i ];\n\t\t\t\t\t_boxMorphTargets.setFromBufferAttribute( morphAttribute );\n\n\t\t\t\t\tif ( this.morphTargetsRelative ) {\n\n\t\t\t\t\t\t_vector$4.addVectors( _box$2.min, _boxMorphTargets.min );\n\t\t\t\t\t\t_box$2.expandByPoint( _vector$4 );\n\n\t\t\t\t\t\t_vector$4.addVectors( _box$2.max, _boxMorphTargets.max );\n\t\t\t\t\t\t_box$2.expandByPoint( _vector$4 );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t_box$2.expandByPoint( _boxMorphTargets.min );\n\t\t\t\t\t\t_box$2.expandByPoint( _boxMorphTargets.max );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t_box$2.getCenter( center );\n\n\t\t\t// second, try to find a boundingSphere with a radius smaller than the\n\t\t\t// boundingSphere of the boundingBox: sqrt(3) smaller in the best case\n\n\t\t\tvar maxRadiusSq = 0;\n\n\t\t\tfor ( var i = 0, il = position.count; i < il; i ++ ) {\n\n\t\t\t\t_vector$4.fromBufferAttribute( position, i );\n\n\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector$4 ) );\n\n\t\t\t}\n\n\t\t\t// process morph attributes if present\n\n\t\t\tif ( morphAttributesPosition ) {\n\n\t\t\t\tfor ( var i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {\n\n\t\t\t\t\tvar morphAttribute = morphAttributesPosition[ i ];\n\t\t\t\t\tvar morphTargetsRelative = this.morphTargetsRelative;\n\n\t\t\t\t\tfor ( var j = 0, jl = morphAttribute.count; j < jl; j ++ ) {\n\n\t\t\t\t\t\t_vector$4.fromBufferAttribute( morphAttribute, j );\n\n\t\t\t\t\t\tif ( morphTargetsRelative ) {\n\n\t\t\t\t\t\t\t_offset.fromBufferAttribute( position, j );\n\t\t\t\t\t\t\t_vector$4.add( _offset );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector$4 ) );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.boundingSphere.radius = Math.sqrt( maxRadiusSq );\n\n\t\t\tif ( isNaN( this.boundingSphere.radius ) ) {\n\n\t\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The \"position\" attribute is likely to have NaN values.', this );\n\n\t\t\t}\n\n\t\t}\n\n\t},\n\n\tcomputeFaceNormals: function () {\n\n\t\t// backwards compatibility\n\n\t},\n\n\tcomputeVertexNormals: function () {\n\n\t\tvar index = this.index;\n\t\tvar attributes = this.attributes;\n\n\t\tif ( attributes.position ) {\n\n\t\t\tvar positions = attributes.position.array;\n\n\t\t\tif ( attributes.normal === undefined ) {\n\n\t\t\t\tthis.setAttribute( 'normal', new BufferAttribute( new Float32Array( positions.length ), 3 ) );\n\n\t\t\t} else {\n\n\t\t\t\t// reset existing normals to zero\n\n\t\t\t\tvar array = attributes.normal.array;\n\n\t\t\t\tfor ( var i = 0, il = array.length; i < il; i ++ ) {\n\n\t\t\t\t\tarray[ i ] = 0;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tvar normals = attributes.normal.array;\n\n\t\t\tvar vA, vB, vC;\n\t\t\tvar pA = new Vector3(), pB = new Vector3(), pC = new Vector3();\n\t\t\tvar cb = new Vector3(), ab = new Vector3();\n\n\t\t\t// indexed elements\n\n\t\t\tif ( index ) {\n\n\t\t\t\tvar indices = index.array;\n\n\t\t\t\tfor ( var i = 0, il = index.count; i < il; i += 3 ) {\n\n\t\t\t\t\tvA = indices[ i + 0 ] * 3;\n\t\t\t\t\tvB = indices[ i + 1 ] * 3;\n\t\t\t\t\tvC = indices[ i + 2 ] * 3;\n\n\t\t\t\t\tpA.fromArray( positions, vA );\n\t\t\t\t\tpB.fromArray( positions, vB );\n\t\t\t\t\tpC.fromArray( positions, vC );\n\n\t\t\t\t\tcb.subVectors( pC, pB );\n\t\t\t\t\tab.subVectors( pA, pB );\n\t\t\t\t\tcb.cross( ab );\n\n\t\t\t\t\tnormals[ vA ] += cb.x;\n\t\t\t\t\tnormals[ vA + 1 ] += cb.y;\n\t\t\t\t\tnormals[ vA + 2 ] += cb.z;\n\n\t\t\t\t\tnormals[ vB ] += cb.x;\n\t\t\t\t\tnormals[ vB + 1 ] += cb.y;\n\t\t\t\t\tnormals[ vB + 2 ] += cb.z;\n\n\t\t\t\t\tnormals[ vC ] += cb.x;\n\t\t\t\t\tnormals[ vC + 1 ] += cb.y;\n\t\t\t\t\tnormals[ vC + 2 ] += cb.z;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// non-indexed elements (unconnected triangle soup)\n\n\t\t\t\tfor ( var i = 0, il = positions.length; i < il; i += 9 ) {\n\n\t\t\t\t\tpA.fromArray( positions, i );\n\t\t\t\t\tpB.fromArray( positions, i + 3 );\n\t\t\t\t\tpC.fromArray( positions, i + 6 );\n\n\t\t\t\t\tcb.subVectors( pC, pB );\n\t\t\t\t\tab.subVectors( pA, pB );\n\t\t\t\t\tcb.cross( ab );\n\n\t\t\t\t\tnormals[ i ] = cb.x;\n\t\t\t\t\tnormals[ i + 1 ] = cb.y;\n\t\t\t\t\tnormals[ i + 2 ] = cb.z;\n\n\t\t\t\t\tnormals[ i + 3 ] = cb.x;\n\t\t\t\t\tnormals[ i + 4 ] = cb.y;\n\t\t\t\t\tnormals[ i + 5 ] = cb.z;\n\n\t\t\t\t\tnormals[ i + 6 ] = cb.x;\n\t\t\t\t\tnormals[ i + 7 ] = cb.y;\n\t\t\t\t\tnormals[ i + 8 ] = cb.z;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.normalizeNormals();\n\n\t\t\tattributes.normal.needsUpdate = true;\n\n\t\t}\n\n\t},\n\n\tmerge: function ( geometry, offset ) {\n\n\t\tif ( ! ( geometry && geometry.isBufferGeometry ) ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.', geometry );\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( offset === undefined ) {\n\n\t\t\toffset = 0;\n\n\t\t\tconsole.warn(\n\t\t\t\t'THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. '\n\t\t\t\t+ 'Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge.'\n\t\t\t);\n\n\t\t}\n\n\t\tvar attributes = this.attributes;\n\n\t\tfor ( var key in attributes ) {\n\n\t\t\tif ( geometry.attributes[ key ] === undefined ) continue;\n\n\t\t\tvar attribute1 = attributes[ key ];\n\t\t\tvar attributeArray1 = attribute1.array;\n\n\t\t\tvar attribute2 = geometry.attributes[ key ];\n\t\t\tvar attributeArray2 = attribute2.array;\n\n\t\t\tvar attributeOffset = attribute2.itemSize * offset;\n\t\t\tvar length = Math.min( attributeArray2.length, attributeArray1.length - attributeOffset );\n\n\t\t\tfor ( var i = 0, j = attributeOffset; i < length; i ++, j ++ ) {\n\n\t\t\t\tattributeArray1[ j ] = attributeArray2[ i ];\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tnormalizeNormals: function () {\n\n\t\tvar normals = this.attributes.normal;\n\n\t\tfor ( var i = 0, il = normals.count; i < il; i ++ ) {\n\n\t\t\t_vector$4.x = normals.getX( i );\n\t\t\t_vector$4.y = normals.getY( i );\n\t\t\t_vector$4.z = normals.getZ( i );\n\n\t\t\t_vector$4.normalize();\n\n\t\t\tnormals.setXYZ( i, _vector$4.x, _vector$4.y, _vector$4.z );\n\n\t\t}\n\n\t},\n\n\ttoNonIndexed: function () {\n\n\t\tfunction convertBufferAttribute( attribute, indices ) {\n\n\t\t\tvar array = attribute.array;\n\t\t\tvar itemSize = attribute.itemSize;\n\n\t\t\tvar array2 = new array.constructor( indices.length * itemSize );\n\n\t\t\tvar index = 0, index2 = 0;\n\n\t\t\tfor ( var i = 0, l = indices.length; i < l; i ++ ) {\n\n\t\t\t\tindex = indices[ i ] * itemSize;\n\n\t\t\t\tfor ( var j = 0; j < itemSize; j ++ ) {\n\n\t\t\t\t\tarray2[ index2 ++ ] = array[ index ++ ];\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn new BufferAttribute( array2, itemSize );\n\n\t\t}\n\n\t\t//\n\n\t\tif ( this.index === null ) {\n\n\t\t\tconsole.warn( 'THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed.' );\n\t\t\treturn this;\n\n\t\t}\n\n\t\tvar geometry2 = new BufferGeometry();\n\n\t\tvar indices = this.index.array;\n\t\tvar attributes = this.attributes;\n\n\t\t// attributes\n\n\t\tfor ( var name in attributes ) {\n\n\t\t\tvar attribute = attributes[ name ];\n\n\t\t\tvar newAttribute = convertBufferAttribute( attribute, indices );\n\n\t\t\tgeometry2.setAttribute( name, newAttribute );\n\n\t\t}\n\n\t\t// morph attributes\n\n\t\tvar morphAttributes = this.morphAttributes;\n\n\t\tfor ( name in morphAttributes ) {\n\n\t\t\tvar morphArray = [];\n\t\t\tvar morphAttribute = morphAttributes[ name ]; // morphAttribute: array of Float32BufferAttributes\n\n\t\t\tfor ( var i = 0, il = morphAttribute.length; i < il; i ++ ) {\n\n\t\t\t\tvar attribute = morphAttribute[ i ];\n\n\t\t\t\tvar newAttribute = convertBufferAttribute( attribute, indices );\n\n\t\t\t\tmorphArray.push( newAttribute );\n\n\t\t\t}\n\n\t\t\tgeometry2.morphAttributes[ name ] = morphArray;\n\n\t\t}\n\n\t\tgeometry2.morphTargetsRelative = this.morphTargetsRelative;\n\n\t\t// groups\n\n\t\tvar groups = this.groups;\n\n\t\tfor ( var i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\t\tvar group = groups[ i ];\n\t\t\tgeometry2.addGroup( group.start, group.count, group.materialIndex );\n\n\t\t}\n\n\t\treturn geometry2;\n\n\t},\n\n\ttoJSON: function () {\n\n\t\tvar data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.5,\n\t\t\t\ttype: 'BufferGeometry',\n\t\t\t\tgenerator: 'BufferGeometry.toJSON'\n\t\t\t}\n\t\t};\n\n\t\t// standard BufferGeometry serialization\n\n\t\tdata.uuid = this.uuid;\n\t\tdata.type = this.type;\n\t\tif ( this.name !== '' ) data.name = this.name;\n\t\tif ( Object.keys( this.userData ).length > 0 ) data.userData = this.userData;\n\n\t\tif ( this.parameters !== undefined ) {\n\n\t\t\tvar parameters = this.parameters;\n\n\t\t\tfor ( var key in parameters ) {\n\n\t\t\t\tif ( parameters[ key ] !== undefined ) data[ key ] = parameters[ key ];\n\n\t\t\t}\n\n\t\t\treturn data;\n\n\t\t}\n\n\t\tdata.data = { attributes: {} };\n\n\t\tvar index = this.index;\n\n\t\tif ( index !== null ) {\n\n\t\t\tdata.data.index = {\n\t\t\t\ttype: index.array.constructor.name,\n\t\t\t\tarray: Array.prototype.slice.call( index.array )\n\t\t\t};\n\n\t\t}\n\n\t\tvar attributes = this.attributes;\n\n\t\tfor ( var key in attributes ) {\n\n\t\t\tvar attribute = attributes[ key ];\n\n\t\t\tvar attributeData = attribute.toJSON();\n\n\t\t\tif ( attribute.name !== '' ) attributeData.name = attribute.name;\n\n\t\t\tdata.data.attributes[ key ] = attributeData;\n\n\t\t}\n\n\t\tvar morphAttributes = {};\n\t\tvar hasMorphAttributes = false;\n\n\t\tfor ( var key in this.morphAttributes ) {\n\n\t\t\tvar attributeArray = this.morphAttributes[ key ];\n\n\t\t\tvar array = [];\n\n\t\t\tfor ( var i = 0, il = attributeArray.length; i < il; i ++ ) {\n\n\t\t\t\tvar attribute = attributeArray[ i ];\n\n\t\t\t\tvar attributeData = attribute.toJSON();\n\n\t\t\t\tif ( attribute.name !== '' ) attributeData.name = attribute.name;\n\n\t\t\t\tarray.push( attributeData );\n\n\t\t\t}\n\n\t\t\tif ( array.length > 0 ) {\n\n\t\t\t\tmorphAttributes[ key ] = array;\n\n\t\t\t\thasMorphAttributes = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( hasMorphAttributes ) {\n\n\t\t\tdata.data.morphAttributes = morphAttributes;\n\t\t\tdata.data.morphTargetsRelative = this.morphTargetsRelative;\n\n\t\t}\n\n\t\tvar groups = this.groups;\n\n\t\tif ( groups.length > 0 ) {\n\n\t\t\tdata.data.groups = JSON.parse( JSON.stringify( groups ) );\n\n\t\t}\n\n\t\tvar boundingSphere = this.boundingSphere;\n\n\t\tif ( boundingSphere !== null ) {\n\n\t\t\tdata.data.boundingSphere = {\n\t\t\t\tcenter: boundingSphere.center.toArray(),\n\t\t\t\tradius: boundingSphere.radius\n\t\t\t};\n\n\t\t}\n\n\t\treturn data;\n\n\t},\n\n\tclone: function () {\n\n\t\t/*\n\t\t // Handle primitives\n\n\t\t var parameters = this.parameters;\n\n\t\t if ( parameters !== undefined ) {\n\n\t\t var values = [];\n\n\t\t for ( var key in parameters ) {\n\n\t\t values.push( parameters[ key ] );\n\n\t\t }\n\n\t\t var geometry = Object.create( this.constructor.prototype );\n\t\t this.constructor.apply( geometry, values );\n\t\t return geometry;\n\n\t\t }\n\n\t\t return new this.constructor().copy( this );\n\t\t */\n\n\t\treturn new BufferGeometry().copy( this );\n\n\t},\n\n\tcopy: function ( source ) {\n\n\t\tvar name, i, l;\n\n\t\t// reset\n\n\t\tthis.index = null;\n\t\tthis.attributes = {};\n\t\tthis.morphAttributes = {};\n\t\tthis.groups = [];\n\t\tthis.boundingBox = null;\n\t\tthis.boundingSphere = null;\n\n\t\t// name\n\n\t\tthis.name = source.name;\n\n\t\t// index\n\n\t\tvar index = source.index;\n\n\t\tif ( index !== null ) {\n\n\t\t\tthis.setIndex( index.clone() );\n\n\t\t}\n\n\t\t// attributes\n\n\t\tvar attributes = source.attributes;\n\n\t\tfor ( name in attributes ) {\n\n\t\t\tvar attribute = attributes[ name ];\n\t\t\tthis.setAttribute( name, attribute.clone() );\n\n\t\t}\n\n\t\t// morph attributes\n\n\t\tvar morphAttributes = source.morphAttributes;\n\n\t\tfor ( name in morphAttributes ) {\n\n\t\t\tvar array = [];\n\t\t\tvar morphAttribute = morphAttributes[ name ]; // morphAttribute: array of Float32BufferAttributes\n\n\t\t\tfor ( i = 0, l = morphAttribute.length; i < l; i ++ ) {\n\n\t\t\t\tarray.push( morphAttribute[ i ].clone() );\n\n\t\t\t}\n\n\t\t\tthis.morphAttributes[ name ] = array;\n\n\t\t}\n\n\t\tthis.morphTargetsRelative = source.morphTargetsRelative;\n\n\t\t// groups\n\n\t\tvar groups = source.groups;\n\n\t\tfor ( i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\t\tvar group = groups[ i ];\n\t\t\tthis.addGroup( group.start, group.count, group.materialIndex );\n\n\t\t}\n\n\t\t// bounding box\n\n\t\tvar boundingBox = source.boundingBox;\n\n\t\tif ( boundingBox !== null ) {\n\n\t\t\tthis.boundingBox = boundingBox.clone();\n\n\t\t}\n\n\t\t// bounding sphere\n\n\t\tvar boundingSphere = source.boundingSphere;\n\n\t\tif ( boundingSphere !== null ) {\n\n\t\t\tthis.boundingSphere = boundingSphere.clone();\n\n\t\t}\n\n\t\t// draw range\n\n\t\tthis.drawRange.start = source.drawRange.start;\n\t\tthis.drawRange.count = source.drawRange.count;\n\n\t\t// user data\n\n\t\tthis.userData = source.userData;\n\n\t\treturn this;\n\n\t},\n\n\tdispose: function () {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n * @author alteredq / http://alteredqualia.com/\n * @author mikael emtinger / http://gomo.se/\n * @author jonobr1 / http://jonobr1.com/\n */\n\nvar _inverseMatrix = new Matrix4();\nvar _ray = new Ray();\nvar _sphere = new Sphere();\n\nvar _vA = new Vector3();\nvar _vB = new Vector3();\nvar _vC = new Vector3();\n\nvar _tempA = new Vector3();\nvar _tempB = new Vector3();\nvar _tempC = new Vector3();\n\nvar _morphA = new Vector3();\nvar _morphB = new Vector3();\nvar _morphC = new Vector3();\n\nvar _uvA = new Vector2();\nvar _uvB = new Vector2();\nvar _uvC = new Vector2();\n\nvar _intersectionPoint = new Vector3();\nvar _intersectionPointWorld = new Vector3();\n\nfunction Mesh( geometry, material ) {\n\n\tObject3D.call( this );\n\n\tthis.type = 'Mesh';\n\n\tthis.geometry = geometry !== undefined ? geometry : new BufferGeometry();\n\tthis.material = material !== undefined ? material : new MeshBasicMaterial();\n\n\tthis.updateMorphTargets();\n\n}\n\nMesh.prototype = Object.assign( Object.create( Object3D.prototype ), {\n\n\tconstructor: Mesh,\n\n\tisMesh: true,\n\n\tcopy: function ( source ) {\n\n\t\tObject3D.prototype.copy.call( this, source );\n\n\t\tif ( source.morphTargetInfluences !== undefined ) {\n\n\t\t\tthis.morphTargetInfluences = source.morphTargetInfluences.slice();\n\n\t\t}\n\n\t\tif ( source.morphTargetDictionary !== undefined ) {\n\n\t\t\tthis.morphTargetDictionary = Object.assign( {}, source.morphTargetDictionary );\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tupdateMorphTargets: function () {\n\n\t\tvar geometry = this.geometry;\n\t\tvar m, ml, name;\n\n\t\tif ( geometry.isBufferGeometry ) {\n\n\t\t\tvar morphAttributes = geometry.morphAttributes;\n\t\t\tvar keys = Object.keys( morphAttributes );\n\n\t\t\tif ( keys.length > 0 ) {\n\n\t\t\t\tvar morphAttribute = morphAttributes[ keys[ 0 ] ];\n\n\t\t\t\tif ( morphAttribute !== undefined ) {\n\n\t\t\t\t\tthis.morphTargetInfluences = [];\n\t\t\t\t\tthis.morphTargetDictionary = {};\n\n\t\t\t\t\tfor ( m = 0, ml = morphAttribute.length; m < ml; m ++ ) {\n\n\t\t\t\t\t\tname = morphAttribute[ m ].name || String( m );\n\n\t\t\t\t\t\tthis.morphTargetInfluences.push( 0 );\n\t\t\t\t\t\tthis.morphTargetDictionary[ name ] = m;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tvar morphTargets = geometry.morphTargets;\n\n\t\t\tif ( morphTargets !== undefined && morphTargets.length > 0 ) {\n\n\t\t\t\tconsole.error( 'THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.' );\n\n\t\t\t}\n\n\t\t}\n\n\t},\n\n\traycast: function ( raycaster, intersects ) {\n\n\t\tvar geometry = this.geometry;\n\t\tvar material = this.material;\n\t\tvar matrixWorld = this.matrixWorld;\n\n\t\tif ( material === undefined ) return;\n\n\t\t// Checking boundingSphere distance to ray\n\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t_sphere.copy( geometry.boundingSphere );\n\t\t_sphere.applyMatrix4( matrixWorld );\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere ) === false ) return;\n\n\t\t//\n\n\t\t_inverseMatrix.getInverse( matrixWorld );\n\t\t_ray.copy( raycaster.ray ).applyMatrix4( _inverseMatrix );\n\n\t\t// Check boundingBox before continuing\n\n\t\tif ( geometry.boundingBox !== null ) {\n\n\t\t\tif ( _ray.intersectsBox( geometry.boundingBox ) === false ) return;\n\n\t\t}\n\n\t\tvar intersection;\n\n\t\tif ( geometry.isBufferGeometry ) {\n\n\t\t\tvar a, b, c;\n\t\t\tvar index = geometry.index;\n\t\t\tvar position = geometry.attributes.position;\n\t\t\tvar morphPosition = geometry.morphAttributes.position;\n\t\t\tvar morphTargetsRelative = geometry.morphTargetsRelative;\n\t\t\tvar uv = geometry.attributes.uv;\n\t\t\tvar uv2 = geometry.attributes.uv2;\n\t\t\tvar groups = geometry.groups;\n\t\t\tvar drawRange = geometry.drawRange;\n\t\t\tvar i, j, il, jl;\n\t\t\tvar group, groupMaterial;\n\t\t\tvar start, end;\n\n\t\t\tif ( index !== null ) {\n\n\t\t\t\t// indexed buffer geometry\n\n\t\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\t\tfor ( i = 0, il = groups.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tgroup = groups[ i ];\n\t\t\t\t\t\tgroupMaterial = material[ group.materialIndex ];\n\n\t\t\t\t\t\tstart = Math.max( group.start, drawRange.start );\n\t\t\t\t\t\tend = Math.min( ( group.start + group.count ), ( drawRange.start + drawRange.count ) );\n\n\t\t\t\t\t\tfor ( j = start, jl = end; j < jl; j += 3 ) {\n\n\t\t\t\t\t\t\ta = index.getX( j );\n\t\t\t\t\t\t\tb = index.getX( j + 1 );\n\t\t\t\t\t\t\tc = index.getX( j + 2 );\n\n\t\t\t\t\t\t\tintersection = checkBufferGeometryIntersection( this, groupMaterial, raycaster, _ray, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c );\n\n\t\t\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\t\t\tintersection.faceIndex = Math.floor( j / 3 ); // triangle number in indexed buffer semantics\n\t\t\t\t\t\t\t\tintersection.face.materialIndex = group.materialIndex;\n\t\t\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tstart = Math.max( 0, drawRange.start );\n\t\t\t\t\tend = Math.min( index.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\t\t\tfor ( i = start, il = end; i < il; i += 3 ) {\n\n\t\t\t\t\t\ta = index.getX( i );\n\t\t\t\t\t\tb = index.getX( i + 1 );\n\t\t\t\t\t\tc = index.getX( i + 2 );\n\n\t\t\t\t\t\tintersection = checkBufferGeometryIntersection( this, material, raycaster, _ray, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c );\n\n\t\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\t\tintersection.faceIndex = Math.floor( i / 3 ); // triangle number in indexed buffer semantics\n\t\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else if ( position !== undefined ) {\n\n\t\t\t\t// non-indexed buffer geometry\n\n\t\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\t\tfor ( i = 0, il = groups.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tgroup = groups[ i ];\n\t\t\t\t\t\tgroupMaterial = material[ group.materialIndex ];\n\n\t\t\t\t\t\tstart = Math.max( group.start, drawRange.start );\n\t\t\t\t\t\tend = Math.min( ( group.start + group.count ), ( drawRange.start + drawRange.count ) );\n\n\t\t\t\t\t\tfor ( j = start, jl = end; j < jl; j += 3 ) {\n\n\t\t\t\t\t\t\ta = j;\n\t\t\t\t\t\t\tb = j + 1;\n\t\t\t\t\t\t\tc = j + 2;\n\n\t\t\t\t\t\t\tintersection = checkBufferGeometryIntersection( this, groupMaterial, raycaster, _ray, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c );\n\n\t\t\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\t\t\tintersection.faceIndex = Math.floor( j / 3 ); // triangle number in non-indexed buffer semantics\n\t\t\t\t\t\t\t\tintersection.face.materialIndex = group.materialIndex;\n\t\t\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tstart = Math.max( 0, drawRange.start );\n\t\t\t\t\tend = Math.min( position.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\t\t\tfor ( i = start, il = end; i < il; i += 3 ) {\n\n\t\t\t\t\t\ta = i;\n\t\t\t\t\t\tb = i + 1;\n\t\t\t\t\t\tc = i + 2;\n\n\t\t\t\t\t\tintersection = checkBufferGeometryIntersection( this, material, raycaster, _ray, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c );\n\n\t\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\t\tintersection.faceIndex = Math.floor( i / 3 ); // triangle number in non-indexed buffer semantics\n\t\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else if ( geometry.isGeometry ) {\n\n\t\t\tvar fvA, fvB, fvC;\n\t\t\tvar isMultiMaterial = Array.isArray( material );\n\n\t\t\tvar vertices = geometry.vertices;\n\t\t\tvar faces = geometry.faces;\n\t\t\tvar uvs;\n\n\t\t\tvar faceVertexUvs = geometry.faceVertexUvs[ 0 ];\n\t\t\tif ( faceVertexUvs.length > 0 ) uvs = faceVertexUvs;\n\n\t\t\tfor ( var f = 0, fl = faces.length; f < fl; f ++ ) {\n\n\t\t\t\tvar face = faces[ f ];\n\t\t\t\tvar faceMaterial = isMultiMaterial ? material[ face.materialIndex ] : material;\n\n\t\t\t\tif ( faceMaterial === undefined ) continue;\n\n\t\t\t\tfvA = vertices[ face.a ];\n\t\t\t\tfvB = vertices[ face.b ];\n\t\t\t\tfvC = vertices[ face.c ];\n\n\t\t\t\tintersection = checkIntersection( this, faceMaterial, raycaster, _ray, fvA, fvB, fvC, _intersectionPoint );\n\n\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\tif ( uvs && uvs[ f ] ) {\n\n\t\t\t\t\t\tvar uvs_f = uvs[ f ];\n\t\t\t\t\t\t_uvA.copy( uvs_f[ 0 ] );\n\t\t\t\t\t\t_uvB.copy( uvs_f[ 1 ] );\n\t\t\t\t\t\t_uvC.copy( uvs_f[ 2 ] );\n\n\t\t\t\t\t\tintersection.uv = Triangle.getUV( _intersectionPoint, fvA, fvB, fvC, _uvA, _uvB, _uvC, new Vector2() );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tintersection.face = face;\n\t\t\t\t\tintersection.faceIndex = f;\n\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t},\n\n\tclone: function () {\n\n\t\treturn new this.constructor( this.geometry, this.material ).copy( this );\n\n\t}\n\n} );\n\nfunction checkIntersection( object, material, raycaster, ray, pA, pB, pC, point ) {\n\n\tvar intersect;\n\n\tif ( material.side === BackSide ) {\n\n\t\tintersect = ray.intersectTriangle( pC, pB, pA, true, point );\n\n\t} else {\n\n\t\tintersect = ray.intersectTriangle( pA, pB, pC, material.side !== DoubleSide, point );\n\n\t}\n\n\tif ( intersect === null ) return null;\n\n\t_intersectionPointWorld.copy( point );\n\t_intersectionPointWorld.applyMatrix4( object.matrixWorld );\n\n\tvar distance = raycaster.ray.origin.distanceTo( _intersectionPointWorld );\n\n\tif ( distance < raycaster.near || distance > raycaster.far ) return null;\n\n\treturn {\n\t\tdistance: distance,\n\t\tpoint: _intersectionPointWorld.clone(),\n\t\tobject: object\n\t};\n\n}\n\nfunction checkBufferGeometryIntersection( object, material, raycaster, ray, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c ) {\n\n\t_vA.fromBufferAttribute( position, a );\n\t_vB.fromBufferAttribute( position, b );\n\t_vC.fromBufferAttribute( position, c );\n\n\tvar morphInfluences = object.morphTargetInfluences;\n\n\tif ( material.morphTargets && morphPosition && morphInfluences ) {\n\n\t\t_morphA.set( 0, 0, 0 );\n\t\t_morphB.set( 0, 0, 0 );\n\t\t_morphC.set( 0, 0, 0 );\n\n\t\tfor ( var i = 0, il = morphPosition.length; i < il; i ++ ) {\n\n\t\t\tvar influence = morphInfluences[ i ];\n\t\t\tvar morphAttribute = morphPosition[ i ];\n\n\t\t\tif ( influence === 0 ) continue;\n\n\t\t\t_tempA.fromBufferAttribute( morphAttribute, a );\n\t\t\t_tempB.fromBufferAttribute( morphAttribute, b );\n\t\t\t_tempC.fromBufferAttribute( morphAttribute, c );\n\n\t\t\tif ( morphTargetsRelative ) {\n\n\t\t\t\t_morphA.addScaledVector( _tempA, influence );\n\t\t\t\t_morphB.addScaledVector( _tempB, influence );\n\t\t\t\t_morphC.addScaledVector( _tempC, influence );\n\n\t\t\t} else {\n\n\t\t\t\t_morphA.addScaledVector( _tempA.sub( _vA ), influence );\n\t\t\t\t_morphB.addScaledVector( _tempB.sub( _vB ), influence );\n\t\t\t\t_morphC.addScaledVector( _tempC.sub( _vC ), influence );\n\n\t\t\t}\n\n\t\t}\n\n\t\t_vA.add( _morphA );\n\t\t_vB.add( _morphB );\n\t\t_vC.add( _morphC );\n\n\t}\n\n\tvar intersection = checkIntersection( object, material, raycaster, ray, _vA, _vB, _vC, _intersectionPoint );\n\n\tif ( intersection ) {\n\n\t\tif ( uv ) {\n\n\t\t\t_uvA.fromBufferAttribute( uv, a );\n\t\t\t_uvB.fromBufferAttribute( uv, b );\n\t\t\t_uvC.fromBufferAttribute( uv, c );\n\n\t\t\tintersection.uv = Triangle.getUV( _intersectionPoint, _vA, _vB, _vC, _uvA, _uvB, _uvC, new Vector2() );\n\n\t\t}\n\n\t\tif ( uv2 ) {\n\n\t\t\t_uvA.fromBufferAttribute( uv2, a );\n\t\t\t_uvB.fromBufferAttribute( uv2, b );\n\t\t\t_uvC.fromBufferAttribute( uv2, c );\n\n\t\t\tintersection.uv2 = Triangle.getUV( _intersectionPoint, _vA, _vB, _vC, _uvA, _uvB, _uvC, new Vector2() );\n\n\t\t}\n\n\t\tvar face = new Face3( a, b, c );\n\t\tTriangle.getNormal( _vA, _vB, _vC, face.normal );\n\n\t\tintersection.face = face;\n\n\t}\n\n\treturn intersection;\n\n}\n\n/**\n * @author mrdoob / http://mrdoob.com/\n * @author kile / http://kile.stravaganza.org/\n * @author alteredq / http://alteredqualia.com/\n * @author mikael emtinger / http://gomo.se/\n * @author zz85 / http://www.lab4games.net/zz85/blog\n * @author bhouston / http://clara.io\n */\n\nvar _geometryId = 0; // Geometry uses even numbers as Id\nvar _m1$3 = new Matrix4();\nvar _obj$1 = new Object3D();\nvar _offset$1 = new Vector3();\n\nfunction Geometry() {\n\n\tObject.defineProperty( this, 'id', { value: _geometryId += 2 } );\n\n\tthis.uuid = MathUtils.generateUUID();\n\n\tthis.name = '';\n\tthis.type = 'Geometry';\n\n\tthis.vertices = [];\n\tthis.colors = [];\n\tthis.faces = [];\n\tthis.faceVertexUvs = [[]];\n\n\tthis.morphTargets = [];\n\tthis.morphNormals = [];\n\n\tthis.skinWeights = [];\n\tthis.skinIndices = [];\n\n\tthis.lineDistances = [];\n\n\tthis.boundingBox = null;\n\tthis.boundingSphere = null;\n\n\t// update flags\n\n\tthis.elementsNeedUpdate = false;\n\tthis.verticesNeedUpdate = false;\n\tthis.uvsNeedUpdate = false;\n\tthis.normalsNeedUpdate = false;\n\tthis.colorsNeedUpdate = false;\n\tthis.lineDistancesNeedUpdate = false;\n\tthis.groupsNeedUpdate = false;\n\n}\n\nGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), {\n\n\tconstructor: Geometry,\n\n\tisGeometry: true,\n\n\tapplyMatrix4: function ( matrix ) {\n\n\t\tvar normalMatrix = new Matrix3().getNormalMatrix( matrix );\n\n\t\tfor ( var i = 0, il = this.vertices.length; i < il; i ++ ) {\n\n\t\t\tvar vertex = this.vertices[ i ];\n\t\t\tvertex.applyMatrix4( matrix );\n\n\t\t}\n\n\t\tfor ( var i = 0, il = this.faces.length; i < il; i ++ ) {\n\n\t\t\tvar face = this.faces[ i ];\n\t\t\tface.normal.applyMatrix3( normalMatrix ).normalize();\n\n\t\t\tfor ( var j = 0, jl = face.vertexNormals.length; j < jl; j ++ ) {\n\n\t\t\t\tface.vertexNormals[ j ].applyMatrix3( normalMatrix ).normalize();\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.boundingBox !== null ) {\n\n\t\t\tthis.computeBoundingBox();\n\n\t\t}\n\n\t\tif ( this.boundingSphere !== null ) {\n\n\t\t\tthis.computeBoundingSphere();\n\n\t\t}\n\n\t\tthis.verticesNeedUpdate = true;\n\t\tthis.normalsNeedUpdate = true;\n\n\t\treturn this;\n\n\t},\n\n\trotateX: function ( angle ) {\n\n\t\t// rotate geometry around world x-axis\n\n\t\t_m1$3.makeRotationX( angle );\n\n\t\tthis.applyMatrix4( _m1$3 );\n\n\t\treturn this;\n\n\t},\n\n\trotateY: function ( angle ) {\n\n\t\t// rotate geometry around world y-axis\n\n\t\t_m1$3.makeRotationY( angle );\n\n\t\tthis.applyMatrix4( _m1$3 );\n\n\t\treturn this;\n\n\t},\n\n\trotateZ: function ( angle ) {\n\n\t\t// rotate geometry around world z-axis\n\n\t\t_m1$3.makeRotationZ( angle );\n\n\t\tthis.applyMatrix4( _m1$3 );\n\n\t\treturn this;\n\n\t},\n\n\ttranslate: function ( x, y, z ) {\n\n\t\t// translate geometry\n\n\t\t_m1$3.makeTranslation( x, y, z );\n\n\t\tthis.applyMatrix4( _m1$3 );\n\n\t\treturn this;\n\n\t},\n\n\tscale: function ( x, y, z ) {\n\n\t\t// scale geometry\n\n\t\t_m1$3.makeScale( x, y, z );\n\n\t\tthis.applyMatrix4( _m1$3 );\n\n\t\treturn this;\n\n\t},\n\n\tlookAt: function ( vector ) {\n\n\t\t_obj$1.lookAt( vector );\n\n\t\t_obj$1.updateMatrix();\n\n\t\tthis.applyMatrix4( _obj$1.matrix );\n\n\t\treturn this;\n\n\t},\n\n\tfromBufferGeometry: function ( geometry ) {\n\n\t\tvar scope = this;\n\n\t\tvar indices = geometry.index !== null ? geometry.index.array : undefined;\n\t\tvar attributes = geometry.attributes;\n\n\t\tif ( attributes.position === undefined ) {\n\n\t\t\tconsole.error( 'THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion.' );\n\t\t\treturn this;\n\n\t\t}\n\n\t\tvar positions = attributes.position.array;\n\t\tvar normals = attributes.normal !== undefined ? attributes.normal.array : undefined;\n\t\tvar colors = attributes.color !== undefined ? attributes.color.array : undefined;\n\t\tvar uvs = attributes.uv !== undefined ? attributes.uv.array : undefined;\n\t\tvar uvs2 = attributes.uv2 !== undefined ? attributes.uv2.array : undefined;\n\n\t\tif ( uvs2 !== undefined ) this.faceVertexUvs[ 1 ] = [];\n\n\t\tfor ( var i = 0; i < positions.length; i += 3 ) {\n\n\t\t\tscope.vertices.push( new Vector3().fromArray( positions, i ) );\n\n\t\t\tif ( colors !== undefined ) {\n\n\t\t\t\tscope.colors.push( new Color().fromArray( colors, i ) );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction addFace( a, b, c, materialIndex ) {\n\n\t\t\tvar vertexColors = ( colors === undefined ) ? [] : [\n\t\t\t\tscope.colors[ a ].clone(),\n\t\t\t\tscope.colors[ b ].clone(),\n\t\t\t\tscope.colors[ c ].clone() ];\n\n\t\t\tvar vertexNormals = ( normals === undefined ) ? [] : [\n\t\t\t\tnew Vector3().fromArray( normals, a * 3 ),\n\t\t\t\tnew Vector3().fromArray( normals, b * 3 ),\n\t\t\t\tnew Vector3().fromArray( normals, c * 3 )\n\t\t\t];\n\n\t\t\tvar face = new Face3( a, b, c, vertexNormals, vertexColors, materialIndex );\n\n\t\t\tscope.faces.push( face );\n\n\t\t\tif ( uvs !== undefined ) {\n\n\t\t\t\tscope.faceVertexUvs[ 0 ].push( [\n\t\t\t\t\tnew Vector2().fromArray( uvs, a * 2 ),\n\t\t\t\t\tnew Vector2().fromArray( uvs, b * 2 ),\n\t\t\t\t\tnew Vector2().fromArray( uvs, c * 2 )\n\t\t\t\t] );\n\n\t\t\t}\n\n\t\t\tif ( uvs2 !== undefined ) {\n\n\t\t\t\tscope.faceVertexUvs[ 1 ].push( [\n\t\t\t\t\tnew Vector2().fromArray( uvs2, a * 2 ),\n\t\t\t\t\tnew Vector2().fromArray( uvs2, b * 2 ),\n\t\t\t\t\tnew Vector2().fromArray( uvs2, c * 2 )\n\t\t\t\t] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvar groups = geometry.groups;\n\n\t\tif ( groups.length > 0 ) {\n\n\t\t\tfor ( var i = 0; i < groups.length; i ++ ) {\n\n\t\t\t\tvar group = groups[ i ];\n\n\t\t\t\tvar start = group.start;\n\t\t\t\tvar count = group.count;\n\n\t\t\t\tfor ( var j = start, jl = start + count; j < jl; j += 3 ) {\n\n\t\t\t\t\tif ( indices !== undefined ) {\n\n\t\t\t\t\t\taddFace( indices[ j ], indices[ j + 1 ], indices[ j + 2 ], group.materialIndex );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\taddFace( j, j + 1, j + 2, group.materialIndex );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tif ( indices !== undefined ) {\n\n\t\t\t\tfor ( var i = 0; i < indices.length; i += 3 ) {\n\n\t\t\t\t\taddFace( indices[ i ], indices[ i + 1 ], indices[ i + 2 ] );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tfor ( var i = 0; i < positions.length / 3; i += 3 ) {\n\n\t\t\t\t\taddFace( i, i + 1, i + 2 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.computeFaceNormals();\n\n\t\tif ( geometry.boundingBox !== null ) {\n\n\t\t\tthis.boundingBox = geometry.boundingBox.clone();\n\n\t\t}\n\n\t\tif ( geometry.boundingSphere !== null ) {\n\n\t\t\tthis.boundingSphere = geometry.boundingSphere.clone();\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tcenter: function () {\n\n\t\tthis.computeBoundingBox();\n\n\t\tthis.boundingBox.getCenter( _offset$1 ).negate();\n\n\t\tthis.translate( _offset$1.x, _offset$1.y, _offset$1.z );\n\n\t\treturn this;\n\n\t},\n\n\tnormalize: function () {\n\n\t\tthis.computeBoundingSphere();\n\n\t\tvar center = this.boundingSphere.center;\n\t\tvar radius = this.boundingSphere.radius;\n\n\t\tvar s = radius === 0 ? 1 : 1.0 / radius;\n\n\t\tvar matrix = new Matrix4();\n\t\tmatrix.set(\n\t\t\ts, 0, 0, - s * center.x,\n\t\t\t0, s, 0, - s * center.y,\n\t\t\t0, 0, s, - s * center.z,\n\t\t\t0, 0, 0, 1\n\t\t);\n\n\t\tthis.applyMatrix4( matrix );\n\n\t\treturn this;\n\n\t},\n\n\tcomputeFaceNormals: function () {\n\n\t\tvar cb = new Vector3(), ab = new Vector3();\n\n\t\tfor ( var f = 0, fl = this.faces.length; f < fl; f ++ ) {\n\n\t\t\tvar face = this.faces[ f ];\n\n\t\t\tvar vA = this.vertices[ face.a ];\n\t\t\tvar vB = this.vertices[ face.b ];\n\t\t\tvar vC = this.vertices[ face.c ];\n\n\t\t\tcb.subVectors( vC, vB );\n\t\t\tab.subVectors( vA, vB );\n\t\t\tcb.cross( ab );\n\n\t\t\tcb.normalize();\n\n\t\t\tface.normal.copy( cb );\n\n\t\t}\n\n\t},\n\n\tcomputeVertexNormals: function ( areaWeighted ) {\n\n\t\tif ( areaWeighted === undefined ) areaWeighted = true;\n\n\t\tvar v, vl, f, fl, face, vertices;\n\n\t\tvertices = new Array( this.vertices.length );\n\n\t\tfor ( v = 0, vl = this.vertices.length; v < vl; v ++ ) {\n\n\t\t\tvertices[ v ] = new Vector3();\n\n\t\t}\n\n\t\tif ( areaWeighted ) {\n\n\t\t\t// vertex normals weighted by triangle areas\n\t\t\t// http://www.iquilezles.org/www/articles/normals/normals.htm\n\n\t\t\tvar vA, vB, vC;\n\t\t\tvar cb = new Vector3(), ab = new Vector3();\n\n\t\t\tfor ( f = 0, fl = this.faces.length; f < fl; f ++ ) {\n\n\t\t\t\tface = this.faces[ f ];\n\n\t\t\t\tvA = this.vertices[ face.a ];\n\t\t\t\tvB = this.vertices[ face.b ];\n\t\t\t\tvC = this.vertices[ face.c ];\n\n\t\t\t\tcb.subVectors( vC, vB );\n\t\t\t\tab.subVectors( vA, vB );\n\t\t\t\tcb.cross( ab );\n\n\t\t\t\tvertices[ face.a ].add( cb );\n\t\t\t\tvertices[ face.b ].add( cb );\n\t\t\t\tvertices[ face.c ].add( cb );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tthis.computeFaceNormals();\n\n\t\t\tfor ( f = 0, fl = this.faces.length; f < fl; f ++ ) {\n\n\t\t\t\tface = this.faces[ f ];\n\n\t\t\t\tvertices[ face.a ].add( face.normal );\n\t\t\t\tvertices[ face.b ].add( face.normal );\n\t\t\t\tvertices[ face.c ].add( face.normal );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( v = 0, vl = this.vertices.length; v < vl; v ++ ) {\n\n\t\t\tvertices[ v ].normalize();\n\n\t\t}\n\n\t\tfor ( f = 0, fl = this.faces.length; f < fl; f ++ ) {\n\n\t\t\tface = this.faces[ f ];\n\n\t\t\tvar vertexNormals = face.vertexNormals;\n\n\t\t\tif ( vertexNormals.length === 3 ) {\n\n\t\t\t\tvertexNormals[ 0 ].copy( vertices[ face.a ] );\n\t\t\t\tvertexNormals[ 1 ].copy( vertices[ face.b ] );\n\t\t\t\tvertexNormals[ 2 ].copy( vertices[ face.c ] );\n\n\t\t\t} else {\n\n\t\t\t\tvertexNormals[ 0 ] = vertices[ face.a ].clone();\n\t\t\t\tvertexNormals[ 1 ] = vertices[ face.b ].clone();\n\t\t\t\tvertexNormals[ 2 ] = vertices[ face.c ].clone();\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.faces.length > 0 ) {\n\n\t\t\tthis.normalsNeedUpdate = true;\n\n\t\t}\n\n\t},\n\n\tcomputeFlatVertexNormals: function () {\n\n\t\tvar f, fl, face;\n\n\t\tthis.computeFaceNormals();\n\n\t\tfor ( f = 0, fl = this.faces.length; f < fl; f ++ ) {\n\n\t\t\tface = this.faces[ f ];\n\n\t\t\tvar vertexNormals = face.vertexNormals;\n\n\t\t\tif ( vertexNormals.length === 3 ) {\n\n\t\t\t\tvertexNormals[ 0 ].copy( face.normal );\n\t\t\t\tvertexNormals[ 1 ].copy( face.normal );\n\t\t\t\tvertexNormals[ 2 ].copy( face.normal );\n\n\t\t\t} else {\n\n\t\t\t\tvertexNormals[ 0 ] = face.normal.clone();\n\t\t\t\tvertexNormals[ 1 ] = face.normal.clone();\n\t\t\t\tvertexNormals[ 2 ] = face.normal.clone();\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.faces.length > 0 ) {\n\n\t\t\tthis.normalsNeedUpdate = true;\n\n\t\t}\n\n\t},\n\n\tcomputeMorphNormals: function () {\n\n\t\tvar i, il, f, fl, face;\n\n\t\t// save original normals\n\t\t// - create temp variables on first access\n\t\t// otherwise just copy (for faster repeated calls)\n\n\t\tfor ( f = 0, fl = this.faces.length; f < fl; f ++ ) {\n\n\t\t\tface = this.faces[ f ];\n\n\t\t\tif ( ! face.__originalFaceNormal ) {\n\n\t\t\t\tface.__originalFaceNormal = face.normal.clone();\n\n\t\t\t} else {\n\n\t\t\t\tface.__originalFaceNormal.copy( face.normal );\n\n\t\t\t}\n\n\t\t\tif ( ! face.__originalVertexNormals ) face.__originalVertexNormals = [];\n\n\t\t\tfor ( i = 0, il = face.vertexNormals.length; i < il; i ++ ) {\n\n\t\t\t\tif ( ! face.__originalVertexNormals[ i ] ) {\n\n\t\t\t\t\tface.__originalVertexNormals[ i ] = face.vertexNormals[ i ].clone();\n\n\t\t\t\t} else {\n\n\t\t\t\t\tface.__originalVertexNormals[ i ].copy( face.vertexNormals[ i ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// use temp geometry to compute face and vertex normals for each morph\n\n\t\tvar tmpGeo = new Geometry();\n\t\ttmpGeo.faces = this.faces;\n\n\t\tfor ( i = 0, il = this.morphTargets.length; i < il; i ++ ) {\n\n\t\t\t// create on first access\n\n\t\t\tif ( ! this.morphNormals[ i ] ) {\n\n\t\t\t\tthis.morphNormals[ i ] = {};\n\t\t\t\tthis.morphNormals[ i ].faceNormals = [];\n\t\t\t\tthis.morphNormals[ i ].vertexNormals = [];\n\n\t\t\t\tvar dstNormalsFace = this.morphNormals[ i ].faceNormals;\n\t\t\t\tvar dstNormalsVertex = this.morphNormals[ i ].vertexNormals;\n\n\t\t\t\tvar faceNormal, vertexNormals;\n\n\t\t\t\tfor ( f = 0, fl = this.faces.length; f < fl; f ++ ) {\n\n\t\t\t\t\tfaceNormal = new Vector3();\n\t\t\t\t\tvertexNormals = { a: new Vector3(), b: new Vector3(), c: new Vector3() };\n\n\t\t\t\t\tdstNormalsFace.push( faceNormal );\n\t\t\t\t\tdstNormalsVertex.push( vertexNormals );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tvar morphNormals = this.morphNormals[ i ];\n\n\t\t\t// set vertices to morph target\n\n\t\t\ttmpGeo.vertices = this.morphTargets[ i ].vertices;\n\n\t\t\t// compute morph normals\n\n\t\t\ttmpGeo.computeFaceNormals();\n\t\t\ttmpGeo.computeVertexNormals();\n\n\t\t\t// store morph normals\n\n\t\t\tvar faceNormal, vertexNormals;\n\n\t\t\tfor ( f = 0, fl = this.faces.length; f < fl; f ++ ) {\n\n\t\t\t\tface = this.faces[ f ];\n\n\t\t\t\tfaceNormal = morphNormals.faceNormals[ f ];\n\t\t\t\tvertexNormals = morphNormals.vertexNormals[ f ];\n\n\t\t\t\tfaceNormal.copy( face.normal );\n\n\t\t\t\tvertexNormals.a.copy( face.vertexNormals[ 0 ] );\n\t\t\t\tvertexNormals.b.copy( face.vertexNormals[ 1 ] );\n\t\t\t\tvertexNormals.c.copy( face.vertexNormals[ 2 ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// restore original normals\n\n\t\tfor ( f = 0, fl = this.faces.length; f < fl; f ++ ) {\n\n\t\t\tface = this.faces[ f ];\n\n\t\t\tface.normal = face.__originalFaceNormal;\n\t\t\tface.vertexNormals = face.__originalVertexNormals;\n\n\t\t}\n\n\t},\n\n\tcomputeBoundingBox: function () {\n\n\t\tif ( this.boundingBox === null ) {\n\n\t\t\tthis.boundingBox = new Box3();\n\n\t\t}\n\n\t\tthis.boundingBox.setFromPoints( this.vertices );\n\n\t},\n\n\tcomputeBoundingSphere: function () {\n\n\t\tif ( this.boundingSphere === null ) {\n\n\t\t\tthis.boundingSphere = new Sphere();\n\n\t\t}\n\n\t\tthis.boundingSphere.setFromPoints( this.vertices );\n\n\t},\n\n\tmerge: function ( geometry, matrix, materialIndexOffset ) {\n\n\t\tif ( ! ( geometry && geometry.isGeometry ) ) {\n\n\t\t\tconsole.error( 'THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.', geometry );\n\t\t\treturn;\n\n\t\t}\n\n\t\tvar normalMatrix,\n\t\t\tvertexOffset = this.vertices.length,\n\t\t\tvertices1 = this.vertices,\n\t\t\tvertices2 = geometry.vertices,\n\t\t\tfaces1 = this.faces,\n\t\t\tfaces2 = geometry.faces,\n\t\t\tcolors1 = this.colors,\n\t\t\tcolors2 = geometry.colors;\n\n\t\tif ( materialIndexOffset === undefined ) materialIndexOffset = 0;\n\n\t\tif ( matrix !== undefined ) {\n\n\t\t\tnormalMatrix = new Matrix3().getNormalMatrix( matrix );\n\n\t\t}\n\n\t\t// vertices\n\n\t\tfor ( var i = 0, il = vertices2.length; i < il; i ++ ) {\n\n\t\t\tvar vertex = vertices2[ i ];\n\n\t\t\tvar vertexCopy = vertex.clone();\n\n\t\t\tif ( matrix !== undefined ) vertexCopy.applyMatrix4( matrix );\n\n\t\t\tvertices1.push( vertexCopy );\n\n\t\t}\n\n\t\t// colors\n\n\t\tfor ( var i = 0, il = colors2.length; i < il; i ++ ) {\n\n\t\t\tcolors1.push( colors2[ i ].clone() );\n\n\t\t}\n\n\t\t// faces\n\n\t\tfor ( i = 0, il = faces2.length; i < il; i ++ ) {\n\n\t\t\tvar face = faces2[ i ], faceCopy, normal, color,\n\t\t\t\tfaceVertexNormals = face.vertexNormals,\n\t\t\t\tfaceVertexColors = face.vertexColors;\n\n\t\t\tfaceCopy = new Face3( face.a + vertexOffset, face.b + vertexOffset, face.c + vertexOffset );\n\t\t\tfaceCopy.normal.copy( face.normal );\n\n\t\t\tif ( normalMatrix !== undefined ) {\n\n\t\t\t\tfaceCopy.normal.applyMatrix3( normalMatrix ).normalize();\n\n\t\t\t}\n\n\t\t\tfor ( var j = 0, jl = faceVertexNormals.length; j < jl; j ++ ) {\n\n\t\t\t\tnormal = faceVertexNormals[ j ].clone();\n\n\t\t\t\tif ( normalMatrix !== undefined ) {\n\n\t\t\t\t\tnormal.applyMatrix3( normalMatrix ).normalize();\n\n\t\t\t\t}\n\n\t\t\t\tfaceCopy.vertexNormals.push( normal );\n\n\t\t\t}\n\n\t\t\tfaceCopy.color.copy( face.color );\n\n\t\t\tfor ( var j = 0, jl = faceVertexColors.length; j < jl; j ++ ) {\n\n\t\t\t\tcolor = faceVertexColors[ j ];\n\t\t\t\tfaceCopy.vertexColors.push( color.clone() );\n\n\t\t\t}\n\n\t\t\tfaceCopy.materialIndex = face.materialIndex + materialIndexOffset;\n\n\t\t\tfaces1.push( faceCopy );\n\n\t\t}\n\n\t\t// uvs\n\n\t\tfor ( var i = 0, il = geometry.faceVertexUvs.length; i < il; i ++ ) {\n\n\t\t\tvar faceVertexUvs2 = geometry.faceVertexUvs[ i ];\n\n\t\t\tif ( this.faceVertexUvs[ i ] === undefined ) this.faceVertexUvs[ i ] = [];\n\n\t\t\tfor ( var j = 0, jl = faceVertexUvs2.length; j < jl; j ++ ) {\n\n\t\t\t\tvar uvs2 = faceVertexUvs2[ j ], uvsCopy = [];\n\n\t\t\t\tfor ( var k = 0, kl = uvs2.length; k < kl; k ++ ) {\n\n\t\t\t\t\tuvsCopy.push( uvs2[ k ].clone() );\n\n\t\t\t\t}\n\n\t\t\t\tthis.faceVertexUvs[ i ].push( uvsCopy );\n\n\t\t\t}\n\n\t\t}\n\n\t},\n\n\tmergeMesh: function ( mesh ) {\n\n\t\tif ( ! ( mesh && mesh.isMesh ) ) {\n\n\t\t\tconsole.error( 'THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.', mesh );\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( mesh.matrixAutoUpdate ) mesh.updateMatrix();\n\n\t\tthis.merge( mesh.geometry, mesh.matrix );\n\n\t},\n\n\t/*\n\t * Checks for duplicate vertices with hashmap.\n\t * Duplicated vertices are removed\n\t * and faces' vertices are updated.\n\t */\n\n\tmergeVertices: function () {\n\n\t\tvar verticesMap = {}; // Hashmap for looking up vertices by position coordinates (and making sure they are unique)\n\t\tvar unique = [], changes = [];\n\n\t\tvar v, key;\n\t\tvar precisionPoints = 4; // number of decimal points, e.g. 4 for epsilon of 0.0001\n\t\tvar precision = Math.pow( 10, precisionPoints );\n\t\tvar i, il, face;\n\t\tvar indices, j, jl;\n\n\t\tfor ( i = 0, il = this.vertices.length; i < il; i ++ ) {\n\n\t\t\tv = this.vertices[ i ];\n\t\t\tkey = Math.round( v.x * precision ) + '_' + Math.round( v.y * precision ) + '_' + Math.round( v.z * precision );\n\n\t\t\tif ( verticesMap[ key ] === undefined ) {\n\n\t\t\t\tverticesMap[ key ] = i;\n\t\t\t\tunique.push( this.vertices[ i ] );\n\t\t\t\tchanges[ i ] = unique.length - 1;\n\n\t\t\t} else {\n\n\t\t\t\t//console.log('Duplicate vertex found. ', i, ' could be using ', verticesMap[key]);\n\t\t\t\tchanges[ i ] = changes[ verticesMap[ key ] ];\n\n\t\t\t}\n\n\t\t}\n\n\n\t\t// if faces are completely degenerate after merging vertices, we\n\t\t// have to remove them from the geometry.\n\t\tvar faceIndicesToRemove = [];\n\n\t\tfor ( i = 0, il = this.faces.length; i < il; i ++ ) {\n\n\t\t\tface = this.faces[ i ];\n\n\t\t\tface.a = changes[ face.a ];\n\t\t\tface.b = changes[ face.b ];\n\t\t\tface.c = changes[ face.c ];\n\n\t\t\tindices = [ face.a, face.b, face.c ];\n\n\t\t\t// if any duplicate vertices are found in a Face3\n\t\t\t// we have to remove the face as nothing can be saved\n\t\t\tfor ( var n = 0; n < 3; n ++ ) {\n\n\t\t\t\tif ( indices[ n ] === indices[ ( n + 1 ) % 3 ] ) {\n\n\t\t\t\t\tfaceIndicesToRemove.push( i );\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( i = faceIndicesToRemove.length - 1; i >= 0; i -- ) {\n\n\t\t\tvar idx = faceIndicesToRemove[ i ];\n\n\t\t\tthis.faces.splice( idx, 1 );\n\n\t\t\tfor ( j = 0, jl = this.faceVertexUvs.length; j < jl; j ++ ) {\n\n\t\t\t\tthis.faceVertexUvs[ j ].splice( idx, 1 );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Use unique set of vertices\n\n\t\tvar diff = this.vertices.length - unique.length;\n\t\tthis.vertices = unique;\n\t\treturn diff;\n\n\t},\n\n\tsetFromPoints: function ( points ) {\n\n\t\tthis.vertices = [];\n\n\t\tfor ( var i = 0, l = points.length; i < l; i ++ ) {\n\n\t\t\tvar point = points[ i ];\n\t\t\tthis.vertices.push( new Vector3( point.x, point.y, point.z || 0 ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tsortFacesByMaterialIndex: function () {\n\n\t\tvar faces = this.faces;\n\t\tvar length = faces.length;\n\n\t\t// tag faces\n\n\t\tfor ( var i = 0; i < length; i ++ ) {\n\n\t\t\tfaces[ i ]._id = i;\n\n\t\t}\n\n\t\t// sort faces\n\n\t\tfunction materialIndexSort( a, b ) {\n\n\t\t\treturn a.materialIndex - b.materialIndex;\n\n\t\t}\n\n\t\tfaces.sort( materialIndexSort );\n\n\t\t// sort uvs\n\n\t\tvar uvs1 = this.faceVertexUvs[ 0 ];\n\t\tvar uvs2 = this.faceVertexUvs[ 1 ];\n\n\t\tvar newUvs1, newUvs2;\n\n\t\tif ( uvs1 && uvs1.length === length ) newUvs1 = [];\n\t\tif ( uvs2 && uvs2.length === length ) newUvs2 = [];\n\n\t\tfor ( var i = 0; i < length; i ++ ) {\n\n\t\t\tvar id = faces[ i ]._id;\n\n\t\t\tif ( newUvs1 ) newUvs1.push( uvs1[ id ] );\n\t\t\tif ( newUvs2 ) newUvs2.push( uvs2[ id ] );\n\n\t\t}\n\n\t\tif ( newUvs1 ) this.faceVertexUvs[ 0 ] = newUvs1;\n\t\tif ( newUvs2 ) this.faceVertexUvs[ 1 ] = newUvs2;\n\n\t},\n\n\ttoJSON: function () {\n\n\t\tvar data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.5,\n\t\t\t\ttype: 'Geometry',\n\t\t\t\tgenerator: 'Geometry.toJSON'\n\t\t\t}\n\t\t};\n\n\t\t// standard Geometry serialization\n\n\t\tdata.uuid = this.uuid;\n\t\tdata.type = this.type;\n\t\tif ( this.name !== '' ) data.name = this.name;\n\n\t\tif ( this.parameters !== undefined ) {\n\n\t\t\tvar parameters = this.parameters;\n\n\t\t\tfor ( var key in parameters ) {\n\n\t\t\t\tif ( parameters[ key ] !== undefined ) data[ key ] = parameters[ key ];\n\n\t\t\t}\n\n\t\t\treturn data;\n\n\t\t}\n\n\t\tvar vertices = [];\n\n\t\tfor ( var i = 0; i < this.vertices.length; i ++ ) {\n\n\t\t\tvar vertex = this.vertices[ i ];\n\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t}\n\n\t\tvar faces = [];\n\t\tvar normals = [];\n\t\tvar normalsHash = {};\n\t\tvar colors = [];\n\t\tvar colorsHash = {};\n\t\tvar uvs = [];\n\t\tvar uvsHash = {};\n\n\t\tfor ( var i = 0; i < this.faces.length; i ++ ) {\n\n\t\t\tvar face = this.faces[ i ];\n\n\t\t\tvar hasMaterial = true;\n\t\t\tvar hasFaceUv = false; // deprecated\n\t\t\tvar hasFaceVertexUv = this.faceVertexUvs[ 0 ][ i ] !== undefined;\n\t\t\tvar hasFaceNormal = face.normal.length() > 0;\n\t\t\tvar hasFaceVertexNormal = face.vertexNormals.length > 0;\n\t\t\tvar hasFaceColor = face.color.r !== 1 || face.color.g !== 1 || face.color.b !== 1;\n\t\t\tvar hasFaceVertexColor = face.vertexColors.length > 0;\n\n\t\t\tvar faceType = 0;\n\n\t\t\tfaceType = setBit( faceType, 0, 0 ); // isQuad\n\t\t\tfaceType = setBit( faceType, 1, hasMaterial );\n\t\t\tfaceType = setBit( faceType, 2, hasFaceUv );\n\t\t\tfaceType = setBit( faceType, 3, hasFaceVertexUv );\n\t\t\tfaceType = setBit( faceType, 4, hasFaceNormal );\n\t\t\tfaceType = setBit( faceType, 5, hasFaceVertexNormal );\n\t\t\tfaceType = setBit( faceType, 6, hasFaceColor );\n\t\t\tfaceType = setBit( faceType, 7, hasFaceVertexColor );\n\n\t\t\tfaces.push( faceType );\n\t\t\tfaces.push( face.a, face.b, face.c );\n\t\t\tfaces.push( face.materialIndex );\n\n\t\t\tif ( hasFaceVertexUv ) {\n\n\t\t\t\tvar faceVertexUvs = this.faceVertexUvs[ 0 ][ i ];\n\n\t\t\t\tfaces.push(\n\t\t\t\t\tgetUvIndex( faceVertexUvs[ 0 ] ),\n\t\t\t\t\tgetUvIndex( faceVertexUvs[ 1 ] ),\n\t\t\t\t\tgetUvIndex( faceVertexUvs[ 2 ] )\n\t\t\t\t);\n\n\t\t\t}\n\n\t\t\tif ( hasFaceNormal ) {\n\n\t\t\t\tfaces.push( getNormalIndex( face.normal ) );\n\n\t\t\t}\n\n\t\t\tif ( hasFaceVertexNormal ) {\n\n\t\t\t\tvar vertexNormals = face.vertexNormals;\n\n\t\t\t\tfaces.push(\n\t\t\t\t\tgetNormalIndex( vertexNormals[ 0 ] ),\n\t\t\t\t\tgetNormalIndex( vertexNormals[ 1 ] ),\n\t\t\t\t\tgetNormalIndex( vertexNormals[ 2 ] )\n\t\t\t\t);\n\n\t\t\t}\n\n\t\t\tif ( hasFaceColor ) {\n\n\t\t\t\tfaces.push( getColorIndex( face.color ) );\n\n\t\t\t}\n\n\t\t\tif ( hasFaceVertexColor ) {\n\n\t\t\t\tvar vertexColors = face.vertexColors;\n\n\t\t\t\tfaces.push(\n\t\t\t\t\tgetColorIndex( vertexColors[ 0 ] ),\n\t\t\t\t\tgetColorIndex( vertexColors[ 1 ] ),\n\t\t\t\t\tgetColorIndex( vertexColors[ 2 ] )\n\t\t\t\t);\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction setBit( value, position, enabled ) {\n\n\t\t\treturn enabled ? value | ( 1 << position ) : value & ( ~ ( 1 << position ) );\n\n\t\t}\n\n\t\tfunction getNormalIndex( normal ) {\n\n\t\t\tvar hash = normal.x.toString() + normal.y.toString() + normal.z.toString();\n\n\t\t\tif ( normalsHash[ hash ] !== undefined ) {\n\n\t\t\t\treturn normalsHash[ hash ];\n\n\t\t\t}\n\n\t\t\tnormalsHash[ hash ] = normals.length / 3;\n\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\treturn normalsHash[ hash ];\n\n\t\t}\n\n\t\tfunction getColorIndex( color ) {\n\n\t\t\tvar hash = color.r.toString() + color.g.toString() + color.b.toString();\n\n\t\t\tif ( colorsHash[ hash ] !== undefined ) {\n\n\t\t\t\treturn colorsHash[ hash ];\n\n\t\t\t}\n\n\t\t\tcolorsHash[ hash ] = colors.length;\n\t\t\tcolors.push( color.getHex() );\n\n\t\t\treturn colorsHash[ hash ];\n\n\t\t}\n\n\t\tfunction getUvIndex( uv ) {\n\n\t\t\tvar hash = uv.x.toString() + uv.y.toString();\n\n\t\t\tif ( uvsHash[ hash ] !== undefined ) {\n\n\t\t\t\treturn uvsHash[ hash ];\n\n\t\t\t}\n\n\t\t\tuvsHash[ hash ] = uvs.length / 2;\n\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t\treturn uvsHash[ hash ];\n\n\t\t}\n\n\t\tdata.data = {};\n\n\t\tdata.data.vertices = vertices;\n\t\tdata.data.normals = normals;\n\t\tif ( colors.length > 0 ) data.data.colors = colors;\n\t\tif ( uvs.length > 0 ) data.data.uvs = [ uvs ]; // temporal backward compatibility\n\t\tdata.data.faces = faces;\n\n\t\treturn data;\n\n\t},\n\n\tclone: function () {\n\n\t\t/*\n\t\t // Handle primitives\n\n\t\t var parameters = this.parameters;\n\n\t\t if ( parameters !== undefined ) {\n\n\t\t var values = [];\n\n\t\t for ( var key in parameters ) {\n\n\t\t values.push( parameters[ key ] );\n\n\t\t }\n\n\t\t var geometry = Object.create( this.constructor.prototype );\n\t\t this.constructor.apply( geometry, values );\n\t\t return geometry;\n\n\t\t }\n\n\t\t return new this.constructor().copy( this );\n\t\t */\n\n\t\treturn new Geometry().copy( this );\n\n\t},\n\n\tcopy: function ( source ) {\n\n\t\tvar i, il, j, jl, k, kl;\n\n\t\t// reset\n\n\t\tthis.vertices = [];\n\t\tthis.colors = [];\n\t\tthis.faces = [];\n\t\tthis.faceVertexUvs = [[]];\n\t\tthis.morphTargets = [];\n\t\tthis.morphNormals = [];\n\t\tthis.skinWeights = [];\n\t\tthis.skinIndices = [];\n\t\tthis.lineDistances = [];\n\t\tthis.boundingBox = null;\n\t\tthis.boundingSphere = null;\n\n\t\t// name\n\n\t\tthis.name = source.name;\n\n\t\t// vertices\n\n\t\tvar vertices = source.vertices;\n\n\t\tfor ( i = 0, il = vertices.length; i < il; i ++ ) {\n\n\t\t\tthis.vertices.push( vertices[ i ].clone() );\n\n\t\t}\n\n\t\t// colors\n\n\t\tvar colors = source.colors;\n\n\t\tfor ( i = 0, il = colors.length; i < il; i ++ ) {\n\n\t\t\tthis.colors.push( colors[ i ].clone() );\n\n\t\t}\n\n\t\t// faces\n\n\t\tvar faces = source.faces;\n\n\t\tfor ( i = 0, il = faces.length; i < il; i ++ ) {\n\n\t\t\tthis.faces.push( faces[ i ].clone() );\n\n\t\t}\n\n\t\t// face vertex uvs\n\n\t\tfor ( i = 0, il = source.faceVertexUvs.length; i < il; i ++ ) {\n\n\t\t\tvar faceVertexUvs = source.faceVertexUvs[ i ];\n\n\t\t\tif ( this.faceVertexUvs[ i ] === undefined ) {\n\n\t\t\t\tthis.faceVertexUvs[ i ] = [];\n\n\t\t\t}\n\n\t\t\tfor ( j = 0, jl = faceVertexUvs.length; j < jl; j ++ ) {\n\n\t\t\t\tvar uvs = faceVertexUvs[ j ], uvsCopy = [];\n\n\t\t\t\tfor ( k = 0, kl = uvs.length; k < kl; k ++ ) {\n\n\t\t\t\t\tvar uv = uvs[ k ];\n\n\t\t\t\t\tuvsCopy.push( uv.clone() );\n\n\t\t\t\t}\n\n\t\t\t\tthis.faceVertexUvs[ i ].push( uvsCopy );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// morph targets\n\n\t\tvar morphTargets = source.morphTargets;\n\n\t\tfor ( i = 0, il = morphTargets.length; i < il; i ++ ) {\n\n\t\t\tvar morphTarget = {};\n\t\t\tmorphTarget.name = morphTargets[ i ].name;\n\n\t\t\t// vertices\n\n\t\t\tif ( morphTargets[ i ].vertices !== undefined ) {\n\n\t\t\t\tmorphTarget.vertices = [];\n\n\t\t\t\tfor ( j = 0, jl = morphTargets[ i ].vertices.length; j < jl; j ++ ) {\n\n\t\t\t\t\tmorphTarget.vertices.push( morphTargets[ i ].vertices[ j ].clone() );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// normals\n\n\t\t\tif ( morphTargets[ i ].normals !== undefined ) {\n\n\t\t\t\tmorphTarget.normals = [];\n\n\t\t\t\tfor ( j = 0, jl = morphTargets[ i ].normals.length; j < jl; j ++ ) {\n\n\t\t\t\t\tmorphTarget.normals.push( morphTargets[ i ].normals[ j ].clone() );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.morphTargets.push( morphTarget );\n\n\t\t}\n\n\t\t// morph normals\n\n\t\tvar morphNormals = source.morphNormals;\n\n\t\tfor ( i = 0, il = morphNormals.length; i < il; i ++ ) {\n\n\t\t\tvar morphNormal = {};\n\n\t\t\t// vertex normals\n\n\t\t\tif ( morphNormals[ i ].vertexNormals !== undefined ) {\n\n\t\t\t\tmorphNormal.vertexNormals = [];\n\n\t\t\t\tfor ( j = 0, jl = morphNormals[ i ].vertexNormals.length; j < jl; j ++ ) {\n\n\t\t\t\t\tvar srcVertexNormal = morphNormals[ i ].vertexNormals[ j ];\n\t\t\t\t\tvar destVertexNormal = {};\n\n\t\t\t\t\tdestVertexNormal.a = srcVertexNormal.a.clone();\n\t\t\t\t\tdestVertexNormal.b = srcVertexNormal.b.clone();\n\t\t\t\t\tdestVertexNormal.c = srcVertexNormal.c.clone();\n\n\t\t\t\t\tmorphNormal.vertexNormals.push( destVertexNormal );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// face normals\n\n\t\t\tif ( morphNormals[ i ].faceNormals !== undefined ) {\n\n\t\t\t\tmorphNormal.faceNormals = [];\n\n\t\t\t\tfor ( j = 0, jl = morphNormals[ i ].faceNormals.length; j < jl; j ++ ) {\n\n\t\t\t\t\tmorphNormal.faceNormals.push( morphNormals[ i ].faceNormals[ j ].clone() );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.morphNormals.push( morphNormal );\n\n\t\t}\n\n\t\t// skin weights\n\n\t\tvar skinWeights = source.skinWeights;\n\n\t\tfor ( i = 0, il = skinWeights.length; i < il; i ++ ) {\n\n\t\t\tthis.skinWeights.push( skinWeights[ i ].clone() );\n\n\t\t}\n\n\t\t// skin indices\n\n\t\tvar skinIndices = source.skinIndices;\n\n\t\tfor ( i = 0, il = skinIndices.length; i < il; i ++ ) {\n\n\t\t\tthis.skinIndices.push( skinIndices[ i ].clone() );\n\n\t\t}\n\n\t\t// line distances\n\n\t\tvar lineDistances = source.lineDistances;\n\n\t\tfor ( i = 0, il = lineDistances.length; i < il; i ++ ) {\n\n\t\t\tthis.lineDistances.push( lineDistances[ i ] );\n\n\t\t}\n\n\t\t// bounding box\n\n\t\tvar boundingBox = source.boundingBox;\n\n\t\tif ( boundingBox !== null ) {\n\n\t\t\tthis.boundingBox = boundingBox.clone();\n\n\t\t}\n\n\t\t// bounding sphere\n\n\t\tvar boundingSphere = source.boundingSphere;\n\n\t\tif ( boundingSphere !== null ) {\n\n\t\t\tthis.boundingSphere = boundingSphere.clone();\n\n\t\t}\n\n\t\t// update flags\n\n\t\tthis.elementsNeedUpdate = source.elementsNeedUpdate;\n\t\tthis.verticesNeedUpdate = source.verticesNeedUpdate;\n\t\tthis.uvsNeedUpdate = source.uvsNeedUpdate;\n\t\tthis.normalsNeedUpdate = source.normalsNeedUpdate;\n\t\tthis.colorsNeedUpdate = source.colorsNeedUpdate;\n\t\tthis.lineDistancesNeedUpdate = source.lineDistancesNeedUpdate;\n\t\tthis.groupsNeedUpdate = source.groupsNeedUpdate;\n\n\t\treturn this;\n\n\t},\n\n\tdispose: function () {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n * @author Mugen87 / https://github.com/Mugen87\n */\n\n// BoxGeometry\n\nclass BoxGeometry extends Geometry {\n\n\tconstructor( width, height, depth, widthSegments, heightSegments, depthSegments ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'BoxGeometry';\n\n\t\tthis.parameters = {\n\t\t\twidth: width,\n\t\t\theight: height,\n\t\t\tdepth: depth,\n\t\t\twidthSegments: widthSegments,\n\t\t\theightSegments: heightSegments,\n\t\t\tdepthSegments: depthSegments\n\t\t};\n\n\t\tthis.fromBufferGeometry( new BoxBufferGeometry( width, height, depth, widthSegments, heightSegments, depthSegments ) );\n\t\tthis.mergeVertices();\n\n\t}\n\n}\n\n// BoxBufferGeometry\n\nclass BoxBufferGeometry extends BufferGeometry {\n\n\tconstructor( width, height, depth, widthSegments, heightSegments, depthSegments ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'BoxBufferGeometry';\n\n\t\tthis.parameters = {\n\t\t\twidth: width,\n\t\t\theight: height,\n\t\t\tdepth: depth,\n\t\t\twidthSegments: widthSegments,\n\t\t\theightSegments: heightSegments,\n\t\t\tdepthSegments: depthSegments\n\t\t};\n\n\t\tvar scope = this;\n\n\t\twidth = width || 1;\n\t\theight = height || 1;\n\t\tdepth = depth || 1;\n\n\t\t// segments\n\n\t\twidthSegments = Math.floor( widthSegments ) || 1;\n\t\theightSegments = Math.floor( heightSegments ) || 1;\n\t\tdepthSegments = Math.floor( depthSegments ) || 1;\n\n\t\t// buffers\n\n\t\tvar indices = [];\n\t\tvar vertices = [];\n\t\tvar normals = [];\n\t\tvar uvs = [];\n\n\t\t// helper variables\n\n\t\tvar numberOfVertices = 0;\n\t\tvar groupStart = 0;\n\n\t\t// build each side of the box geometry\n\n\t\tbuildPlane( 'z', 'y', 'x', - 1, - 1, depth, height, width, depthSegments, heightSegments, 0 ); // px\n\t\tbuildPlane( 'z', 'y', 'x', 1, - 1, depth, height, - width, depthSegments, heightSegments, 1 ); // nx\n\t\tbuildPlane( 'x', 'z', 'y', 1, 1, width, depth, height, widthSegments, depthSegments, 2 ); // py\n\t\tbuildPlane( 'x', 'z', 'y', 1, - 1, width, depth, - height, widthSegments, depthSegments, 3 ); // ny\n\t\tbuildPlane( 'x', 'y', 'z', 1, - 1, width, height, depth, widthSegments, heightSegments, 4 ); // pz\n\t\tbuildPlane( 'x', 'y', 'z', - 1, - 1, width, height, - depth, widthSegments, heightSegments, 5 ); // nz\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t\tfunction buildPlane( u, v, w, udir, vdir, width, height, depth, gridX, gridY, materialIndex ) {\n\n\t\t\tvar segmentWidth = width / gridX;\n\t\t\tvar segmentHeight = height / gridY;\n\n\t\t\tvar widthHalf = width / 2;\n\t\t\tvar heightHalf = height / 2;\n\t\t\tvar depthHalf = depth / 2;\n\n\t\t\tvar gridX1 = gridX + 1;\n\t\t\tvar gridY1 = gridY + 1;\n\n\t\t\tvar vertexCounter = 0;\n\t\t\tvar groupCount = 0;\n\n\t\t\tvar ix, iy;\n\n\t\t\tvar vector = new Vector3();\n\n\t\t\t// generate vertices, normals and uvs\n\n\t\t\tfor ( iy = 0; iy < gridY1; iy ++ ) {\n\n\t\t\t\tvar y = iy * segmentHeight - heightHalf;\n\n\t\t\t\tfor ( ix = 0; ix < gridX1; ix ++ ) {\n\n\t\t\t\t\tvar x = ix * segmentWidth - widthHalf;\n\n\t\t\t\t\t// set values to correct vector component\n\n\t\t\t\t\tvector[ u ] = x * udir;\n\t\t\t\t\tvector[ v ] = y * vdir;\n\t\t\t\t\tvector[ w ] = depthHalf;\n\n\t\t\t\t\t// now apply vector to vertex buffer\n\n\t\t\t\t\tvertices.push( vector.x, vector.y, vector.z );\n\n\t\t\t\t\t// set values to correct vector component\n\n\t\t\t\t\tvector[ u ] = 0;\n\t\t\t\t\tvector[ v ] = 0;\n\t\t\t\t\tvector[ w ] = depth > 0 ? 1 : - 1;\n\n\t\t\t\t\t// now apply vector to normal buffer\n\n\t\t\t\t\tnormals.push( vector.x, vector.y, vector.z );\n\n\t\t\t\t\t// uvs\n\n\t\t\t\t\tuvs.push( ix / gridX );\n\t\t\t\t\tuvs.push( 1 - ( iy / gridY ) );\n\n\t\t\t\t\t// counters\n\n\t\t\t\t\tvertexCounter += 1;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// indices\n\n\t\t\t// 1. you need three indices to draw a single face\n\t\t\t// 2. a single segment consists of two faces\n\t\t\t// 3. so we need to generate six (2*3) indices per segment\n\n\t\t\tfor ( iy = 0; iy < gridY; iy ++ ) {\n\n\t\t\t\tfor ( ix = 0; ix < gridX; ix ++ ) {\n\n\t\t\t\t\tvar a = numberOfVertices + ix + gridX1 * iy;\n\t\t\t\t\tvar b = numberOfVertices + ix + gridX1 * ( iy + 1 );\n\t\t\t\t\tvar c = numberOfVertices + ( ix + 1 ) + gridX1 * ( iy + 1 );\n\t\t\t\t\tvar d = numberOfVertices + ( ix + 1 ) + gridX1 * iy;\n\n\t\t\t\t\t// faces\n\n\t\t\t\t\tindices.push( a, b, d );\n\t\t\t\t\tindices.push( b, c, d );\n\n\t\t\t\t\t// increase counter\n\n\t\t\t\t\tgroupCount += 6;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// add a group to the geometry. this will ensure multi material support\n\n\t\t\tscope.addGroup( groupStart, groupCount, materialIndex );\n\n\t\t\t// calculate new start value for groups\n\n\t\t\tgroupStart += groupCount;\n\n\t\t\t// update total number of vertices\n\n\t\t\tnumberOfVertices += vertexCounter;\n\n\t\t}\n\n\t}\n\n}\n\n/**\n * Uniform Utilities\n */\n\nfunction cloneUniforms( src ) {\n\n\tvar dst = {};\n\n\tfor ( var u in src ) {\n\n\t\tdst[ u ] = {};\n\n\t\tfor ( var p in src[ u ] ) {\n\n\t\t\tvar property = src[ u ][ p ];\n\n\t\t\tif ( property && ( property.isColor ||\n\t\t\t\tproperty.isMatrix3 || property.isMatrix4 ||\n\t\t\t\tproperty.isVector2 || property.isVector3 || property.isVector4 ||\n\t\t\t\tproperty.isTexture ) ) {\n\n\t\t\t\tdst[ u ][ p ] = property.clone();\n\n\t\t\t} else if ( Array.isArray( property ) ) {\n\n\t\t\t\tdst[ u ][ p ] = property.slice();\n\n\t\t\t} else {\n\n\t\t\t\tdst[ u ][ p ] = property;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\treturn dst;\n\n}\n\nfunction mergeUniforms( uniforms ) {\n\n\tvar merged = {};\n\n\tfor ( var u = 0; u < uniforms.length; u ++ ) {\n\n\t\tvar tmp = cloneUniforms( uniforms[ u ] );\n\n\t\tfor ( var p in tmp ) {\n\n\t\t\tmerged[ p ] = tmp[ p ];\n\n\t\t}\n\n\t}\n\n\treturn merged;\n\n}\n\n// Legacy\n\nvar UniformsUtils = { clone: cloneUniforms, merge: mergeUniforms };\n\nvar default_vertex = \"void main() {\\n\\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\\n}\";\n\nvar default_fragment = \"void main() {\\n\\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\\n}\";\n\n/**\n * @author alteredq / http://alteredqualia.com/\n *\n * parameters = {\n * defines: { \"label\" : \"value\" },\n * uniforms: { \"parameter1\": { value: 1.0 }, \"parameter2\": { value2: 2 } },\n *\n * fragmentShader: ,\n * vertexShader: ,\n *\n * wireframe: ,\n * wireframeLinewidth: ,\n *\n * lights: ,\n *\n * skinning: ,\n * morphTargets: ,\n * morphNormals: \n * }\n */\n\nfunction ShaderMaterial( parameters ) {\n\n\tMaterial.call( this );\n\n\tthis.type = 'ShaderMaterial';\n\n\tthis.defines = {};\n\tthis.uniforms = {};\n\n\tthis.vertexShader = default_vertex;\n\tthis.fragmentShader = default_fragment;\n\n\tthis.linewidth = 1;\n\n\tthis.wireframe = false;\n\tthis.wireframeLinewidth = 1;\n\n\tthis.fog = false; // set to use scene fog\n\tthis.lights = false; // set to use scene lights\n\tthis.clipping = false; // set to use user-defined clipping planes\n\n\tthis.skinning = false; // set to use skinning attribute streams\n\tthis.morphTargets = false; // set to use morph targets\n\tthis.morphNormals = false; // set to use morph normals\n\n\tthis.extensions = {\n\t\tderivatives: false, // set to use derivatives\n\t\tfragDepth: false, // set to use fragment depth values\n\t\tdrawBuffers: false, // set to use draw buffers\n\t\tshaderTextureLOD: false // set to use shader texture LOD\n\t};\n\n\t// When rendered geometry doesn't include these attributes but the material does,\n\t// use these default values in WebGL. This avoids errors when buffer data is missing.\n\tthis.defaultAttributeValues = {\n\t\t'color': [ 1, 1, 1 ],\n\t\t'uv': [ 0, 0 ],\n\t\t'uv2': [ 0, 0 ]\n\t};\n\n\tthis.index0AttributeName = undefined;\n\tthis.uniformsNeedUpdate = false;\n\n\tif ( parameters !== undefined ) {\n\n\t\tif ( parameters.attributes !== undefined ) {\n\n\t\t\tconsole.error( 'THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead.' );\n\n\t\t}\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n}\n\nShaderMaterial.prototype = Object.create( Material.prototype );\nShaderMaterial.prototype.constructor = ShaderMaterial;\n\nShaderMaterial.prototype.isShaderMaterial = true;\n\nShaderMaterial.prototype.copy = function ( source ) {\n\n\tMaterial.prototype.copy.call( this, source );\n\n\tthis.fragmentShader = source.fragmentShader;\n\tthis.vertexShader = source.vertexShader;\n\n\tthis.uniforms = cloneUniforms( source.uniforms );\n\n\tthis.defines = Object.assign( {}, source.defines );\n\n\tthis.wireframe = source.wireframe;\n\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\n\tthis.lights = source.lights;\n\tthis.clipping = source.clipping;\n\n\tthis.skinning = source.skinning;\n\n\tthis.morphTargets = source.morphTargets;\n\tthis.morphNormals = source.morphNormals;\n\n\tthis.extensions = source.extensions;\n\n\treturn this;\n\n};\n\nShaderMaterial.prototype.toJSON = function ( meta ) {\n\n\tvar data = Material.prototype.toJSON.call( this, meta );\n\n\tdata.uniforms = {};\n\n\tfor ( var name in this.uniforms ) {\n\n\t\tvar uniform = this.uniforms[ name ];\n\t\tvar value = uniform.value;\n\n\t\tif ( value && value.isTexture ) {\n\n\t\t\tdata.uniforms[ name ] = {\n\t\t\t\ttype: 't',\n\t\t\t\tvalue: value.toJSON( meta ).uuid\n\t\t\t};\n\n\t\t} else if ( value && value.isColor ) {\n\n\t\t\tdata.uniforms[ name ] = {\n\t\t\t\ttype: 'c',\n\t\t\t\tvalue: value.getHex()\n\t\t\t};\n\n\t\t} else if ( value && value.isVector2 ) {\n\n\t\t\tdata.uniforms[ name ] = {\n\t\t\t\ttype: 'v2',\n\t\t\t\tvalue: value.toArray()\n\t\t\t};\n\n\t\t} else if ( value && value.isVector3 ) {\n\n\t\t\tdata.uniforms[ name ] = {\n\t\t\t\ttype: 'v3',\n\t\t\t\tvalue: value.toArray()\n\t\t\t};\n\n\t\t} else if ( value && value.isVector4 ) {\n\n\t\t\tdata.uniforms[ name ] = {\n\t\t\t\ttype: 'v4',\n\t\t\t\tvalue: value.toArray()\n\t\t\t};\n\n\t\t} else if ( value && value.isMatrix3 ) {\n\n\t\t\tdata.uniforms[ name ] = {\n\t\t\t\ttype: 'm3',\n\t\t\t\tvalue: value.toArray()\n\t\t\t};\n\n\t\t} else if ( value && value.isMatrix4 ) {\n\n\t\t\tdata.uniforms[ name ] = {\n\t\t\t\ttype: 'm4',\n\t\t\t\tvalue: value.toArray()\n\t\t\t};\n\n\t\t} else {\n\n\t\t\tdata.uniforms[ name ] = {\n\t\t\t\tvalue: value\n\t\t\t};\n\n\t\t\t// note: the array variants v2v, v3v, v4v, m4v and tv are not supported so far\n\n\t\t}\n\n\t}\n\n\tif ( Object.keys( this.defines ).length > 0 ) data.defines = this.defines;\n\n\tdata.vertexShader = this.vertexShader;\n\tdata.fragmentShader = this.fragmentShader;\n\n\tvar extensions = {};\n\n\tfor ( var key in this.extensions ) {\n\n\t\tif ( this.extensions[ key ] === true ) extensions[ key ] = true;\n\n\t}\n\n\tif ( Object.keys( extensions ).length > 0 ) data.extensions = extensions;\n\n\treturn data;\n\n};\n\n/**\n * @author mrdoob / http://mrdoob.com/\n * @author mikael emtinger / http://gomo.se/\n * @author WestLangley / http://github.com/WestLangley\n*/\n\nfunction Camera() {\n\n\tObject3D.call( this );\n\n\tthis.type = 'Camera';\n\n\tthis.matrixWorldInverse = new Matrix4();\n\n\tthis.projectionMatrix = new Matrix4();\n\tthis.projectionMatrixInverse = new Matrix4();\n\n}\n\nCamera.prototype = Object.assign( Object.create( Object3D.prototype ), {\n\n\tconstructor: Camera,\n\n\tisCamera: true,\n\n\tcopy: function ( source, recursive ) {\n\n\t\tObject3D.prototype.copy.call( this, source, recursive );\n\n\t\tthis.matrixWorldInverse.copy( source.matrixWorldInverse );\n\n\t\tthis.projectionMatrix.copy( source.projectionMatrix );\n\t\tthis.projectionMatrixInverse.copy( source.projectionMatrixInverse );\n\n\t\treturn this;\n\n\t},\n\n\tgetWorldDirection: function ( target ) {\n\n\t\tif ( target === undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Camera: .getWorldDirection() target is now required' );\n\t\t\ttarget = new Vector3();\n\n\t\t}\n\n\t\tthis.updateMatrixWorld( true );\n\n\t\tvar e = this.matrixWorld.elements;\n\n\t\treturn target.set( - e[ 8 ], - e[ 9 ], - e[ 10 ] ).normalize();\n\n\t},\n\n\tupdateMatrixWorld: function ( force ) {\n\n\t\tObject3D.prototype.updateMatrixWorld.call( this, force );\n\n\t\tthis.matrixWorldInverse.getInverse( this.matrixWorld );\n\n\t},\n\n\tupdateWorldMatrix: function ( updateParents, updateChildren ) {\n\n\t\tObject3D.prototype.updateWorldMatrix.call( this, updateParents, updateChildren );\n\n\t\tthis.matrixWorldInverse.getInverse( this.matrixWorld );\n\n\t},\n\n\tclone: function () {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n * @author greggman / http://games.greggman.com/\n * @author zz85 / http://www.lab4games.net/zz85/blog\n * @author tschw\n */\n\nfunction PerspectiveCamera( fov, aspect, near, far ) {\n\n\tCamera.call( this );\n\n\tthis.type = 'PerspectiveCamera';\n\n\tthis.fov = fov !== undefined ? fov : 50;\n\tthis.zoom = 1;\n\n\tthis.near = near !== undefined ? near : 0.1;\n\tthis.far = far !== undefined ? far : 2000;\n\tthis.focus = 10;\n\n\tthis.aspect = aspect !== undefined ? aspect : 1;\n\tthis.view = null;\n\n\tthis.filmGauge = 35;\t// width of the film (default in millimeters)\n\tthis.filmOffset = 0;\t// horizontal film offset (same unit as gauge)\n\n\tthis.updateProjectionMatrix();\n\n}\n\nPerspectiveCamera.prototype = Object.assign( Object.create( Camera.prototype ), {\n\n\tconstructor: PerspectiveCamera,\n\n\tisPerspectiveCamera: true,\n\n\tcopy: function ( source, recursive ) {\n\n\t\tCamera.prototype.copy.call( this, source, recursive );\n\n\t\tthis.fov = source.fov;\n\t\tthis.zoom = source.zoom;\n\n\t\tthis.near = source.near;\n\t\tthis.far = source.far;\n\t\tthis.focus = source.focus;\n\n\t\tthis.aspect = source.aspect;\n\t\tthis.view = source.view === null ? null : Object.assign( {}, source.view );\n\n\t\tthis.filmGauge = source.filmGauge;\n\t\tthis.filmOffset = source.filmOffset;\n\n\t\treturn this;\n\n\t},\n\n\t/**\n\t * Sets the FOV by focal length in respect to the current .filmGauge.\n\t *\n\t * The default film gauge is 35, so that the focal length can be specified for\n\t * a 35mm (full frame) camera.\n\t *\n\t * Values for focal length and film gauge must have the same unit.\n\t */\n\tsetFocalLength: function ( focalLength ) {\n\n\t\t// see http://www.bobatkins.com/photography/technical/field_of_view.html\n\t\tvar vExtentSlope = 0.5 * this.getFilmHeight() / focalLength;\n\n\t\tthis.fov = MathUtils.RAD2DEG * 2 * Math.atan( vExtentSlope );\n\t\tthis.updateProjectionMatrix();\n\n\t},\n\n\t/**\n\t * Calculates the focal length from the current .fov and .filmGauge.\n\t */\n\tgetFocalLength: function () {\n\n\t\tvar vExtentSlope = Math.tan( MathUtils.DEG2RAD * 0.5 * this.fov );\n\n\t\treturn 0.5 * this.getFilmHeight() / vExtentSlope;\n\n\t},\n\n\tgetEffectiveFOV: function () {\n\n\t\treturn MathUtils.RAD2DEG * 2 * Math.atan(\n\t\t\tMath.tan( MathUtils.DEG2RAD * 0.5 * this.fov ) / this.zoom );\n\n\t},\n\n\tgetFilmWidth: function () {\n\n\t\t// film not completely covered in portrait format (aspect < 1)\n\t\treturn this.filmGauge * Math.min( this.aspect, 1 );\n\n\t},\n\n\tgetFilmHeight: function () {\n\n\t\t// film not completely covered in landscape format (aspect > 1)\n\t\treturn this.filmGauge / Math.max( this.aspect, 1 );\n\n\t},\n\n\t/**\n\t * Sets an offset in a larger frustum. This is useful for multi-window or\n\t * multi-monitor/multi-machine setups.\n\t *\n\t * For example, if you have 3x2 monitors and each monitor is 1920x1080 and\n\t * the monitors are in grid like this\n\t *\n\t * +---+---+---+\n\t * | A | B | C |\n\t * +---+---+---+\n\t * | D | E | F |\n\t * +---+---+---+\n\t *\n\t * then for each monitor you would call it like this\n\t *\n\t * var w = 1920;\n\t * var h = 1080;\n\t * var fullWidth = w * 3;\n\t * var fullHeight = h * 2;\n\t *\n\t * --A--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );\n\t * --B--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );\n\t * --C--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );\n\t * --D--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );\n\t * --E--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );\n\t * --F--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );\n\t *\n\t * Note there is no reason monitors have to be the same size or in a grid.\n\t */\n\tsetViewOffset: function ( fullWidth, fullHeight, x, y, width, height ) {\n\n\t\tthis.aspect = fullWidth / fullHeight;\n\n\t\tif ( this.view === null ) {\n\n\t\t\tthis.view = {\n\t\t\t\tenabled: true,\n\t\t\t\tfullWidth: 1,\n\t\t\t\tfullHeight: 1,\n\t\t\t\toffsetX: 0,\n\t\t\t\toffsetY: 0,\n\t\t\t\twidth: 1,\n\t\t\t\theight: 1\n\t\t\t};\n\n\t\t}\n\n\t\tthis.view.enabled = true;\n\t\tthis.view.fullWidth = fullWidth;\n\t\tthis.view.fullHeight = fullHeight;\n\t\tthis.view.offsetX = x;\n\t\tthis.view.offsetY = y;\n\t\tthis.view.width = width;\n\t\tthis.view.height = height;\n\n\t\tthis.updateProjectionMatrix();\n\n\t},\n\n\tclearViewOffset: function () {\n\n\t\tif ( this.view !== null ) {\n\n\t\t\tthis.view.enabled = false;\n\n\t\t}\n\n\t\tthis.updateProjectionMatrix();\n\n\t},\n\n\tupdateProjectionMatrix: function () {\n\n\t\tvar near = this.near,\n\t\t\ttop = near * Math.tan( MathUtils.DEG2RAD * 0.5 * this.fov ) / this.zoom,\n\t\t\theight = 2 * top,\n\t\t\twidth = this.aspect * height,\n\t\t\tleft = - 0.5 * width,\n\t\t\tview = this.view;\n\n\t\tif ( this.view !== null && this.view.enabled ) {\n\n\t\t\tvar fullWidth = view.fullWidth,\n\t\t\t\tfullHeight = view.fullHeight;\n\n\t\t\tleft += view.offsetX * width / fullWidth;\n\t\t\ttop -= view.offsetY * height / fullHeight;\n\t\t\twidth *= view.width / fullWidth;\n\t\t\theight *= view.height / fullHeight;\n\n\t\t}\n\n\t\tvar skew = this.filmOffset;\n\t\tif ( skew !== 0 ) left += near * skew / this.getFilmWidth();\n\n\t\tthis.projectionMatrix.makePerspective( left, left + width, top, top - height, near, this.far );\n\n\t\tthis.projectionMatrixInverse.getInverse( this.projectionMatrix );\n\n\t},\n\n\ttoJSON: function ( meta ) {\n\n\t\tvar data = Object3D.prototype.toJSON.call( this, meta );\n\n\t\tdata.object.fov = this.fov;\n\t\tdata.object.zoom = this.zoom;\n\n\t\tdata.object.near = this.near;\n\t\tdata.object.far = this.far;\n\t\tdata.object.focus = this.focus;\n\n\t\tdata.object.aspect = this.aspect;\n\n\t\tif ( this.view !== null ) data.object.view = Object.assign( {}, this.view );\n\n\t\tdata.object.filmGauge = this.filmGauge;\n\t\tdata.object.filmOffset = this.filmOffset;\n\n\t\treturn data;\n\n\t}\n\n} );\n\n/**\n * Camera for rendering cube maps\n *\t- renders scene into axis-aligned cube\n *\n * @author alteredq / http://alteredqualia.com/\n */\n\nvar fov = 90, aspect = 1;\n\nfunction CubeCamera( near, far, cubeResolution, options ) {\n\n\tObject3D.call( this );\n\n\tthis.type = 'CubeCamera';\n\n\tvar cameraPX = new PerspectiveCamera( fov, aspect, near, far );\n\tcameraPX.up.set( 0, - 1, 0 );\n\tcameraPX.lookAt( new Vector3( 1, 0, 0 ) );\n\tthis.add( cameraPX );\n\n\tvar cameraNX = new PerspectiveCamera( fov, aspect, near, far );\n\tcameraNX.up.set( 0, - 1, 0 );\n\tcameraNX.lookAt( new Vector3( - 1, 0, 0 ) );\n\tthis.add( cameraNX );\n\n\tvar cameraPY = new PerspectiveCamera( fov, aspect, near, far );\n\tcameraPY.up.set( 0, 0, 1 );\n\tcameraPY.lookAt( new Vector3( 0, 1, 0 ) );\n\tthis.add( cameraPY );\n\n\tvar cameraNY = new PerspectiveCamera( fov, aspect, near, far );\n\tcameraNY.up.set( 0, 0, - 1 );\n\tcameraNY.lookAt( new Vector3( 0, - 1, 0 ) );\n\tthis.add( cameraNY );\n\n\tvar cameraPZ = new PerspectiveCamera( fov, aspect, near, far );\n\tcameraPZ.up.set( 0, - 1, 0 );\n\tcameraPZ.lookAt( new Vector3( 0, 0, 1 ) );\n\tthis.add( cameraPZ );\n\n\tvar cameraNZ = new PerspectiveCamera( fov, aspect, near, far );\n\tcameraNZ.up.set( 0, - 1, 0 );\n\tcameraNZ.lookAt( new Vector3( 0, 0, - 1 ) );\n\tthis.add( cameraNZ );\n\n\toptions = options || { format: RGBFormat, magFilter: LinearFilter, minFilter: LinearFilter };\n\n\tthis.renderTarget = new WebGLCubeRenderTarget( cubeResolution, options );\n\tthis.renderTarget.texture.name = \"CubeCamera\";\n\n\tthis.update = function ( renderer, scene ) {\n\n\t\tif ( this.parent === null ) this.updateMatrixWorld();\n\n\t\tvar currentRenderTarget = renderer.getRenderTarget();\n\n\t\tvar renderTarget = this.renderTarget;\n\t\tvar generateMipmaps = renderTarget.texture.generateMipmaps;\n\n\t\trenderTarget.texture.generateMipmaps = false;\n\n\t\trenderer.setRenderTarget( renderTarget, 0 );\n\t\trenderer.render( scene, cameraPX );\n\n\t\trenderer.setRenderTarget( renderTarget, 1 );\n\t\trenderer.render( scene, cameraNX );\n\n\t\trenderer.setRenderTarget( renderTarget, 2 );\n\t\trenderer.render( scene, cameraPY );\n\n\t\trenderer.setRenderTarget( renderTarget, 3 );\n\t\trenderer.render( scene, cameraNY );\n\n\t\trenderer.setRenderTarget( renderTarget, 4 );\n\t\trenderer.render( scene, cameraPZ );\n\n\t\trenderTarget.texture.generateMipmaps = generateMipmaps;\n\n\t\trenderer.setRenderTarget( renderTarget, 5 );\n\t\trenderer.render( scene, cameraNZ );\n\n\t\trenderer.setRenderTarget( currentRenderTarget );\n\n\t};\n\n\tthis.clear = function ( renderer, color, depth, stencil ) {\n\n\t\tvar currentRenderTarget = renderer.getRenderTarget();\n\n\t\tvar renderTarget = this.renderTarget;\n\n\t\tfor ( var i = 0; i < 6; i ++ ) {\n\n\t\t\trenderer.setRenderTarget( renderTarget, i );\n\n\t\t\trenderer.clear( color, depth, stencil );\n\n\t\t}\n\n\t\trenderer.setRenderTarget( currentRenderTarget );\n\n\t};\n\n}\n\nCubeCamera.prototype = Object.create( Object3D.prototype );\nCubeCamera.prototype.constructor = CubeCamera;\n\n/**\n * @author alteredq / http://alteredqualia.com\n * @author WestLangley / http://github.com/WestLangley\n */\n\nfunction WebGLCubeRenderTarget( size, options, dummy ) {\n\n\tif ( Number.isInteger( options ) ) {\n\n\t\tconsole.warn( 'THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )' );\n\n\t\toptions = dummy;\n\n\t}\n\n\tWebGLRenderTarget.call( this, size, size, options );\n\n}\n\nWebGLCubeRenderTarget.prototype = Object.create( WebGLRenderTarget.prototype );\nWebGLCubeRenderTarget.prototype.constructor = WebGLCubeRenderTarget;\n\nWebGLCubeRenderTarget.prototype.isWebGLCubeRenderTarget = true;\n\nWebGLCubeRenderTarget.prototype.fromEquirectangularTexture = function ( renderer, texture ) {\n\n\tthis.texture.type = texture.type;\n\tthis.texture.format = texture.format;\n\tthis.texture.encoding = texture.encoding;\n\n\tvar scene = new Scene();\n\n\tvar shader = {\n\n\t\tuniforms: {\n\t\t\ttEquirect: { value: null },\n\t\t},\n\n\t\tvertexShader: [\n\n\t\t\t\"varying vec3 vWorldDirection;\",\n\n\t\t\t\"vec3 transformDirection( in vec3 dir, in mat4 matrix ) {\",\n\n\t\t\t\"\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\",\n\n\t\t\t\"}\",\n\n\t\t\t\"void main() {\",\n\n\t\t\t\"\tvWorldDirection = transformDirection( position, modelMatrix );\",\n\n\t\t\t\"\t#include \",\n\t\t\t\"\t#include \",\n\n\t\t\t\"}\"\n\n\t\t].join( '\\n' ),\n\n\t\tfragmentShader: [\n\n\t\t\t\"uniform sampler2D tEquirect;\",\n\n\t\t\t\"varying vec3 vWorldDirection;\",\n\n\t\t\t\"#define RECIPROCAL_PI 0.31830988618\",\n\t\t\t\"#define RECIPROCAL_PI2 0.15915494\",\n\n\t\t\t\"void main() {\",\n\n\t\t\t\"\tvec3 direction = normalize( vWorldDirection );\",\n\n\t\t\t\"\tvec2 sampleUV;\",\n\n\t\t\t\"\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\",\n\n\t\t\t\"\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\",\n\n\t\t\t\"\tgl_FragColor = texture2D( tEquirect, sampleUV );\",\n\n\t\t\t\"}\"\n\n\t\t].join( '\\n' ),\n\t};\n\n\tvar material = new ShaderMaterial( {\n\n\t\ttype: 'CubemapFromEquirect',\n\n\t\tuniforms: cloneUniforms( shader.uniforms ),\n\t\tvertexShader: shader.vertexShader,\n\t\tfragmentShader: shader.fragmentShader,\n\t\tside: BackSide,\n\t\tblending: NoBlending\n\n\t} );\n\n\tmaterial.uniforms.tEquirect.value = texture;\n\n\tvar mesh = new Mesh( new BoxBufferGeometry( 5, 5, 5 ), material );\n\n\tscene.add( mesh );\n\n\tvar camera = new CubeCamera( 1, 10, 1 );\n\n\tcamera.renderTarget = this;\n\tcamera.renderTarget.texture.name = 'CubeCameraTexture';\n\n\tcamera.update( renderer, scene );\n\n\tmesh.geometry.dispose();\n\tmesh.material.dispose();\n\n\treturn this;\n\n};\n\n/**\n * @author alteredq / http://alteredqualia.com/\n */\n\nfunction DataTexture( data, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, encoding ) {\n\n\tTexture.call( this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding );\n\n\tthis.image = { data: data || null, width: width || 1, height: height || 1 };\n\n\tthis.magFilter = magFilter !== undefined ? magFilter : NearestFilter;\n\tthis.minFilter = minFilter !== undefined ? minFilter : NearestFilter;\n\n\tthis.generateMipmaps = false;\n\tthis.flipY = false;\n\tthis.unpackAlignment = 1;\n\n\tthis.needsUpdate = true;\n\n}\n\nDataTexture.prototype = Object.create( Texture.prototype );\nDataTexture.prototype.constructor = DataTexture;\n\nDataTexture.prototype.isDataTexture = true;\n\n/**\n * @author mrdoob / http://mrdoob.com/\n * @author alteredq / http://alteredqualia.com/\n * @author bhouston / http://clara.io\n */\n\nvar _sphere$1 = new Sphere();\nvar _vector$5 = new Vector3();\n\nfunction Frustum( p0, p1, p2, p3, p4, p5 ) {\n\n\tthis.planes = [\n\n\t\t( p0 !== undefined ) ? p0 : new Plane(),\n\t\t( p1 !== undefined ) ? p1 : new Plane(),\n\t\t( p2 !== undefined ) ? p2 : new Plane(),\n\t\t( p3 !== undefined ) ? p3 : new Plane(),\n\t\t( p4 !== undefined ) ? p4 : new Plane(),\n\t\t( p5 !== undefined ) ? p5 : new Plane()\n\n\t];\n\n}\n\nObject.assign( Frustum.prototype, {\n\n\tset: function ( p0, p1, p2, p3, p4, p5 ) {\n\n\t\tvar planes = this.planes;\n\n\t\tplanes[ 0 ].copy( p0 );\n\t\tplanes[ 1 ].copy( p1 );\n\t\tplanes[ 2 ].copy( p2 );\n\t\tplanes[ 3 ].copy( p3 );\n\t\tplanes[ 4 ].copy( p4 );\n\t\tplanes[ 5 ].copy( p5 );\n\n\t\treturn this;\n\n\t},\n\n\tclone: function () {\n\n\t\treturn new this.constructor().copy( this );\n\n\t},\n\n\tcopy: function ( frustum ) {\n\n\t\tvar planes = this.planes;\n\n\t\tfor ( var i = 0; i < 6; i ++ ) {\n\n\t\t\tplanes[ i ].copy( frustum.planes[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tsetFromProjectionMatrix: function ( m ) {\n\n\t\tvar planes = this.planes;\n\t\tvar me = m.elements;\n\t\tvar me0 = me[ 0 ], me1 = me[ 1 ], me2 = me[ 2 ], me3 = me[ 3 ];\n\t\tvar me4 = me[ 4 ], me5 = me[ 5 ], me6 = me[ 6 ], me7 = me[ 7 ];\n\t\tvar me8 = me[ 8 ], me9 = me[ 9 ], me10 = me[ 10 ], me11 = me[ 11 ];\n\t\tvar me12 = me[ 12 ], me13 = me[ 13 ], me14 = me[ 14 ], me15 = me[ 15 ];\n\n\t\tplanes[ 0 ].setComponents( me3 - me0, me7 - me4, me11 - me8, me15 - me12 ).normalize();\n\t\tplanes[ 1 ].setComponents( me3 + me0, me7 + me4, me11 + me8, me15 + me12 ).normalize();\n\t\tplanes[ 2 ].setComponents( me3 + me1, me7 + me5, me11 + me9, me15 + me13 ).normalize();\n\t\tplanes[ 3 ].setComponents( me3 - me1, me7 - me5, me11 - me9, me15 - me13 ).normalize();\n\t\tplanes[ 4 ].setComponents( me3 - me2, me7 - me6, me11 - me10, me15 - me14 ).normalize();\n\t\tplanes[ 5 ].setComponents( me3 + me2, me7 + me6, me11 + me10, me15 + me14 ).normalize();\n\n\t\treturn this;\n\n\t},\n\n\tintersectsObject: function ( object ) {\n\n\t\tvar geometry = object.geometry;\n\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t_sphere$1.copy( geometry.boundingSphere ).applyMatrix4( object.matrixWorld );\n\n\t\treturn this.intersectsSphere( _sphere$1 );\n\n\t},\n\n\tintersectsSprite: function ( sprite ) {\n\n\t\t_sphere$1.center.set( 0, 0, 0 );\n\t\t_sphere$1.radius = 0.7071067811865476;\n\t\t_sphere$1.applyMatrix4( sprite.matrixWorld );\n\n\t\treturn this.intersectsSphere( _sphere$1 );\n\n\t},\n\n\tintersectsSphere: function ( sphere ) {\n\n\t\tvar planes = this.planes;\n\t\tvar center = sphere.center;\n\t\tvar negRadius = - sphere.radius;\n\n\t\tfor ( var i = 0; i < 6; i ++ ) {\n\n\t\t\tvar distance = planes[ i ].distanceToPoint( center );\n\n\t\t\tif ( distance < negRadius ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t},\n\n\tintersectsBox: function ( box ) {\n\n\t\tvar planes = this.planes;\n\n\t\tfor ( var i = 0; i < 6; i ++ ) {\n\n\t\t\tvar plane = planes[ i ];\n\n\t\t\t// corner at max distance\n\n\t\t\t_vector$5.x = plane.normal.x > 0 ? box.max.x : box.min.x;\n\t\t\t_vector$5.y = plane.normal.y > 0 ? box.max.y : box.min.y;\n\t\t\t_vector$5.z = plane.normal.z > 0 ? box.max.z : box.min.z;\n\n\t\t\tif ( plane.distanceToPoint( _vector$5 ) < 0 ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t},\n\n\tcontainsPoint: function ( point ) {\n\n\t\tvar planes = this.planes;\n\n\t\tfor ( var i = 0; i < 6; i ++ ) {\n\n\t\t\tif ( planes[ i ].distanceToPoint( point ) < 0 ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n} );\n\n/**\n * Uniforms library for shared webgl shaders\n */\n\nvar UniformsLib = {\n\n\tcommon: {\n\n\t\tdiffuse: { value: new Color( 0xeeeeee ) },\n\t\topacity: { value: 1.0 },\n\n\t\tmap: { value: null },\n\t\tuvTransform: { value: new Matrix3() },\n\t\tuv2Transform: { value: new Matrix3() },\n\n\t\talphaMap: { value: null },\n\n\t},\n\n\tspecularmap: {\n\n\t\tspecularMap: { value: null },\n\n\t},\n\n\tenvmap: {\n\n\t\tenvMap: { value: null },\n\t\tflipEnvMap: { value: - 1 },\n\t\treflectivity: { value: 1.0 },\n\t\trefractionRatio: { value: 0.98 },\n\t\tmaxMipLevel: { value: 0 }\n\n\t},\n\n\taomap: {\n\n\t\taoMap: { value: null },\n\t\taoMapIntensity: { value: 1 }\n\n\t},\n\n\tlightmap: {\n\n\t\tlightMap: { value: null },\n\t\tlightMapIntensity: { value: 1 }\n\n\t},\n\n\temissivemap: {\n\n\t\temissiveMap: { value: null }\n\n\t},\n\n\tbumpmap: {\n\n\t\tbumpMap: { value: null },\n\t\tbumpScale: { value: 1 }\n\n\t},\n\n\tnormalmap: {\n\n\t\tnormalMap: { value: null },\n\t\tnormalScale: { value: new Vector2( 1, 1 ) }\n\n\t},\n\n\tdisplacementmap: {\n\n\t\tdisplacementMap: { value: null },\n\t\tdisplacementScale: { value: 1 },\n\t\tdisplacementBias: { value: 0 }\n\n\t},\n\n\troughnessmap: {\n\n\t\troughnessMap: { value: null }\n\n\t},\n\n\tmetalnessmap: {\n\n\t\tmetalnessMap: { value: null }\n\n\t},\n\n\tgradientmap: {\n\n\t\tgradientMap: { value: null }\n\n\t},\n\n\tfog: {\n\n\t\tfogDensity: { value: 0.00025 },\n\t\tfogNear: { value: 1 },\n\t\tfogFar: { value: 2000 },\n\t\tfogColor: { value: new Color( 0xffffff ) }\n\n\t},\n\n\tlights: {\n\n\t\tambientLightColor: { value: [] },\n\n\t\tlightProbe: { value: [] },\n\n\t\tdirectionalLights: { value: [], properties: {\n\t\t\tdirection: {},\n\t\t\tcolor: {},\n\n\t\t\tshadow: {},\n\t\t\tshadowBias: {},\n\t\t\tshadowRadius: {},\n\t\t\tshadowMapSize: {}\n\t\t} },\n\n\t\tdirectionalShadowMap: { value: [] },\n\t\tdirectionalShadowMatrix: { value: [] },\n\n\t\tspotLights: { value: [], properties: {\n\t\t\tcolor: {},\n\t\t\tposition: {},\n\t\t\tdirection: {},\n\t\t\tdistance: {},\n\t\t\tconeCos: {},\n\t\t\tpenumbraCos: {},\n\t\t\tdecay: {},\n\n\t\t\tshadow: {},\n\t\t\tshadowBias: {},\n\t\t\tshadowRadius: {},\n\t\t\tshadowMapSize: {}\n\t\t} },\n\n\t\tspotShadowMap: { value: [] },\n\t\tspotShadowMatrix: { value: [] },\n\n\t\tpointLights: { value: [], properties: {\n\t\t\tcolor: {},\n\t\t\tposition: {},\n\t\t\tdecay: {},\n\t\t\tdistance: {},\n\n\t\t\tshadow: {},\n\t\t\tshadowBias: {},\n\t\t\tshadowRadius: {},\n\t\t\tshadowMapSize: {},\n\t\t\tshadowCameraNear: {},\n\t\t\tshadowCameraFar: {}\n\t\t} },\n\n\t\tpointShadowMap: { value: [] },\n\t\tpointShadowMatrix: { value: [] },\n\n\t\themisphereLights: { value: [], properties: {\n\t\t\tdirection: {},\n\t\t\tskyColor: {},\n\t\t\tgroundColor: {}\n\t\t} },\n\n\t\t// TODO (abelnation): RectAreaLight BRDF data needs to be moved from example to main src\n\t\trectAreaLights: { value: [], properties: {\n\t\t\tcolor: {},\n\t\t\tposition: {},\n\t\t\twidth: {},\n\t\t\theight: {}\n\t\t} }\n\n\t},\n\n\tpoints: {\n\n\t\tdiffuse: { value: new Color( 0xeeeeee ) },\n\t\topacity: { value: 1.0 },\n\t\tsize: { value: 1.0 },\n\t\tscale: { value: 1.0 },\n\t\tmap: { value: null },\n\t\talphaMap: { value: null },\n\t\tuvTransform: { value: new Matrix3() }\n\n\t},\n\n\tsprite: {\n\n\t\tdiffuse: { value: new Color( 0xeeeeee ) },\n\t\topacity: { value: 1.0 },\n\t\tcenter: { value: new Vector2( 0.5, 0.5 ) },\n\t\trotation: { value: 0.0 },\n\t\tmap: { value: null },\n\t\talphaMap: { value: null },\n\t\tuvTransform: { value: new Matrix3() }\n\n\t}\n\n};\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction WebGLAnimation() {\n\n\tvar context = null;\n\tvar isAnimating = false;\n\tvar animationLoop = null;\n\n\tfunction onAnimationFrame( time, frame ) {\n\n\t\tif ( isAnimating === false ) return;\n\n\t\tanimationLoop( time, frame );\n\n\t\tcontext.requestAnimationFrame( onAnimationFrame );\n\n\t}\n\n\treturn {\n\n\t\tstart: function () {\n\n\t\t\tif ( isAnimating === true ) return;\n\t\t\tif ( animationLoop === null ) return;\n\n\t\t\tcontext.requestAnimationFrame( onAnimationFrame );\n\n\t\t\tisAnimating = true;\n\n\t\t},\n\n\t\tstop: function () {\n\n\t\t\tisAnimating = false;\n\n\t\t},\n\n\t\tsetAnimationLoop: function ( callback ) {\n\n\t\t\tanimationLoop = callback;\n\n\t\t},\n\n\t\tsetContext: function ( value ) {\n\n\t\t\tcontext = value;\n\n\t\t}\n\n\t};\n\n}\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction WebGLAttributes( gl, capabilities ) {\n\n\tvar isWebGL2 = capabilities.isWebGL2;\n\n\tvar buffers = new WeakMap();\n\n\tfunction createBuffer( attribute, bufferType ) {\n\n\t\tvar array = attribute.array;\n\t\tvar usage = attribute.usage;\n\n\t\tvar buffer = gl.createBuffer();\n\n\t\tgl.bindBuffer( bufferType, buffer );\n\t\tgl.bufferData( bufferType, array, usage );\n\n\t\tattribute.onUploadCallback();\n\n\t\tvar type = 5126;\n\n\t\tif ( array instanceof Float32Array ) {\n\n\t\t\ttype = 5126;\n\n\t\t} else if ( array instanceof Float64Array ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLAttributes: Unsupported data buffer format: Float64Array.' );\n\n\t\t} else if ( array instanceof Uint16Array ) {\n\n\t\t\ttype = 5123;\n\n\t\t} else if ( array instanceof Int16Array ) {\n\n\t\t\ttype = 5122;\n\n\t\t} else if ( array instanceof Uint32Array ) {\n\n\t\t\ttype = 5125;\n\n\t\t} else if ( array instanceof Int32Array ) {\n\n\t\t\ttype = 5124;\n\n\t\t} else if ( array instanceof Int8Array ) {\n\n\t\t\ttype = 5120;\n\n\t\t} else if ( array instanceof Uint8Array ) {\n\n\t\t\ttype = 5121;\n\n\t\t}\n\n\t\treturn {\n\t\t\tbuffer: buffer,\n\t\t\ttype: type,\n\t\t\tbytesPerElement: array.BYTES_PER_ELEMENT,\n\t\t\tversion: attribute.version\n\t\t};\n\n\t}\n\n\tfunction updateBuffer( buffer, attribute, bufferType ) {\n\n\t\tvar array = attribute.array;\n\t\tvar updateRange = attribute.updateRange;\n\n\t\tgl.bindBuffer( bufferType, buffer );\n\n\t\tif ( updateRange.count === - 1 ) {\n\n\t\t\t// Not using update ranges\n\n\t\t\tgl.bufferSubData( bufferType, 0, array );\n\n\t\t} else {\n\n\t\t\tif ( isWebGL2 ) {\n\n\t\t\t\tgl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,\n\t\t\t\t\tarray, updateRange.offset, updateRange.count );\n\n\t\t\t} else {\n\n\t\t\t\tgl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,\n\t\t\t\t\tarray.subarray( updateRange.offset, updateRange.offset + updateRange.count ) );\n\n\t\t\t}\n\n\t\t\tupdateRange.count = - 1; // reset range\n\n\t\t}\n\n\t}\n\n\t//\n\n\tfunction get( attribute ) {\n\n\t\tif ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;\n\n\t\treturn buffers.get( attribute );\n\n\t}\n\n\tfunction remove( attribute ) {\n\n\t\tif ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;\n\n\t\tvar data = buffers.get( attribute );\n\n\t\tif ( data ) {\n\n\t\t\tgl.deleteBuffer( data.buffer );\n\n\t\t\tbuffers.delete( attribute );\n\n\t\t}\n\n\t}\n\n\tfunction update( attribute, bufferType ) {\n\n\t\tif ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;\n\n\t\tvar data = buffers.get( attribute );\n\n\t\tif ( data === undefined ) {\n\n\t\t\tbuffers.set( attribute, createBuffer( attribute, bufferType ) );\n\n\t\t} else if ( data.version < attribute.version ) {\n\n\t\t\tupdateBuffer( data.buffer, attribute, bufferType );\n\n\t\t\tdata.version = attribute.version;\n\n\t\t}\n\n\t}\n\n\treturn {\n\n\t\tget: get,\n\t\tremove: remove,\n\t\tupdate: update\n\n\t};\n\n}\n\n/**\n * @author mrdoob / http://mrdoob.com/\n * @author Mugen87 / https://github.com/Mugen87\n */\n\n// PlaneGeometry\n\nfunction PlaneGeometry( width, height, widthSegments, heightSegments ) {\n\n\tGeometry.call( this );\n\n\tthis.type = 'PlaneGeometry';\n\n\tthis.parameters = {\n\t\twidth: width,\n\t\theight: height,\n\t\twidthSegments: widthSegments,\n\t\theightSegments: heightSegments\n\t};\n\n\tthis.fromBufferGeometry( new PlaneBufferGeometry( width, height, widthSegments, heightSegments ) );\n\tthis.mergeVertices();\n\n}\n\nPlaneGeometry.prototype = Object.create( Geometry.prototype );\nPlaneGeometry.prototype.constructor = PlaneGeometry;\n\n// PlaneBufferGeometry\n\nfunction PlaneBufferGeometry( width, height, widthSegments, heightSegments ) {\n\n\tBufferGeometry.call( this );\n\n\tthis.type = 'PlaneBufferGeometry';\n\n\tthis.parameters = {\n\t\twidth: width,\n\t\theight: height,\n\t\twidthSegments: widthSegments,\n\t\theightSegments: heightSegments\n\t};\n\n\twidth = width || 1;\n\theight = height || 1;\n\n\tvar width_half = width / 2;\n\tvar height_half = height / 2;\n\n\tvar gridX = Math.floor( widthSegments ) || 1;\n\tvar gridY = Math.floor( heightSegments ) || 1;\n\n\tvar gridX1 = gridX + 1;\n\tvar gridY1 = gridY + 1;\n\n\tvar segment_width = width / gridX;\n\tvar segment_height = height / gridY;\n\n\tvar ix, iy;\n\n\t// buffers\n\n\tvar indices = [];\n\tvar vertices = [];\n\tvar normals = [];\n\tvar uvs = [];\n\n\t// generate vertices, normals and uvs\n\n\tfor ( iy = 0; iy < gridY1; iy ++ ) {\n\n\t\tvar y = iy * segment_height - height_half;\n\n\t\tfor ( ix = 0; ix < gridX1; ix ++ ) {\n\n\t\t\tvar x = ix * segment_width - width_half;\n\n\t\t\tvertices.push( x, - y, 0 );\n\n\t\t\tnormals.push( 0, 0, 1 );\n\n\t\t\tuvs.push( ix / gridX );\n\t\t\tuvs.push( 1 - ( iy / gridY ) );\n\n\t\t}\n\n\t}\n\n\t// indices\n\n\tfor ( iy = 0; iy < gridY; iy ++ ) {\n\n\t\tfor ( ix = 0; ix < gridX; ix ++ ) {\n\n\t\t\tvar a = ix + gridX1 * iy;\n\t\t\tvar b = ix + gridX1 * ( iy + 1 );\n\t\t\tvar c = ( ix + 1 ) + gridX1 * ( iy + 1 );\n\t\t\tvar d = ( ix + 1 ) + gridX1 * iy;\n\n\t\t\t// faces\n\n\t\t\tindices.push( a, b, d );\n\t\t\tindices.push( b, c, d );\n\n\t\t}\n\n\t}\n\n\t// build geometry\n\n\tthis.setIndex( indices );\n\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n}\n\nPlaneBufferGeometry.prototype = Object.create( BufferGeometry.prototype );\nPlaneBufferGeometry.prototype.constructor = PlaneBufferGeometry;\n\nvar alphamap_fragment = \"#ifdef USE_ALPHAMAP\\n\\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\\n#endif\";\n\nvar alphamap_pars_fragment = \"#ifdef USE_ALPHAMAP\\n\\tuniform sampler2D alphaMap;\\n#endif\";\n\nvar alphatest_fragment = \"#ifdef ALPHATEST\\n\\tif ( diffuseColor.a < ALPHATEST ) discard;\\n#endif\";\n\nvar aomap_fragment = \"#ifdef USE_AOMAP\\n\\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\\n\\treflectedLight.indirectDiffuse *= ambientOcclusion;\\n\\t#if defined( USE_ENVMAP ) && defined( STANDARD )\\n\\t\\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\\n\\t\\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\\n\\t#endif\\n#endif\";\n\nvar aomap_pars_fragment = \"#ifdef USE_AOMAP\\n\\tuniform sampler2D aoMap;\\n\\tuniform float aoMapIntensity;\\n#endif\";\n\nvar begin_vertex = \"vec3 transformed = vec3( position );\";\n\nvar beginnormal_vertex = \"vec3 objectNormal = vec3( normal );\\n#ifdef USE_TANGENT\\n\\tvec3 objectTangent = vec3( tangent.xyz );\\n#endif\";\n\nvar bsdfs = \"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\\n\\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\\n\\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\\n\\tvec4 r = roughness * c0 + c1;\\n\\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\\n\\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\\n}\\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\\n\\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\\n\\tif( cutoffDistance > 0.0 ) {\\n\\t\\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\\n\\t}\\n\\treturn distanceFalloff;\\n#else\\n\\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\\n\\t\\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\\n\\t}\\n\\treturn 1.0;\\n#endif\\n}\\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\\n\\treturn RECIPROCAL_PI * diffuseColor;\\n}\\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\\n\\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\\n\\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\\n}\\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\\n\\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\\n\\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\\n\\treturn Fr * fresnel + F0;\\n}\\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\\n\\tfloat a2 = pow2( alpha );\\n\\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\\n\\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\\n\\treturn 1.0 / ( gl * gv );\\n}\\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\\n\\tfloat a2 = pow2( alpha );\\n\\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\\n\\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\\n\\treturn 0.5 / max( gv + gl, EPSILON );\\n}\\nfloat D_GGX( const in float alpha, const in float dotNH ) {\\n\\tfloat a2 = pow2( alpha );\\n\\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\\n\\treturn RECIPROCAL_PI * a2 / pow2( denom );\\n}\\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\\n\\tfloat alpha = pow2( roughness );\\n\\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\\n\\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\\n\\tvec3 F = F_Schlick( specularColor, dotLH );\\n\\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\\n\\tfloat D = D_GGX( alpha, dotNH );\\n\\treturn F * ( G * D );\\n}\\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\\n\\tconst float LUT_SIZE = 64.0;\\n\\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\\n\\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\\n\\tfloat dotNV = saturate( dot( N, V ) );\\n\\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\\n\\tuv = uv * LUT_SCALE + LUT_BIAS;\\n\\treturn uv;\\n}\\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\\n\\tfloat l = length( f );\\n\\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\\n}\\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\\n\\tfloat x = dot( v1, v2 );\\n\\tfloat y = abs( x );\\n\\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\\n\\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\\n\\tfloat v = a / b;\\n\\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\\n\\treturn cross( v1, v2 ) * theta_sintheta;\\n}\\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\\n\\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\\n\\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\\n\\tvec3 lightNormal = cross( v1, v2 );\\n\\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\\n\\tvec3 T1, T2;\\n\\tT1 = normalize( V - N * dot( V, N ) );\\n\\tT2 = - cross( N, T1 );\\n\\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\\n\\tvec3 coords[ 4 ];\\n\\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\\n\\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\\n\\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\\n\\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\\n\\tcoords[ 0 ] = normalize( coords[ 0 ] );\\n\\tcoords[ 1 ] = normalize( coords[ 1 ] );\\n\\tcoords[ 2 ] = normalize( coords[ 2 ] );\\n\\tcoords[ 3 ] = normalize( coords[ 3 ] );\\n\\tvec3 vectorFormFactor = vec3( 0.0 );\\n\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\\n\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\\n\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\\n\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\\n\\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\\n\\treturn vec3( result );\\n}\\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\\n\\treturn specularColor * brdf.x + brdf.y;\\n}\\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\\n\\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\\n\\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\\n\\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\\n\\tvec3 FssEss = F * brdf.x + brdf.y;\\n\\tfloat Ess = brdf.x + brdf.y;\\n\\tfloat Ems = 1.0 - Ess;\\n\\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\\n\\tsingleScatter += FssEss;\\n\\tmultiScatter += Fms * Ems;\\n}\\nfloat G_BlinnPhong_Implicit( ) {\\n\\treturn 0.25;\\n}\\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\\n\\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\\n}\\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\\n\\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\\n\\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\\n\\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\\n\\tvec3 F = F_Schlick( specularColor, dotLH );\\n\\tfloat G = G_BlinnPhong_Implicit( );\\n\\tfloat D = D_BlinnPhong( shininess, dotNH );\\n\\treturn F * ( G * D );\\n}\\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\\n\\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\\n}\\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\\n\\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\\n}\\n#if defined( USE_SHEEN )\\nfloat D_Charlie(float roughness, float NoH) {\\n\\tfloat invAlpha = 1.0 / roughness;\\n\\tfloat cos2h = NoH * NoH;\\n\\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\\n}\\nfloat V_Neubelt(float NoV, float NoL) {\\n\\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\\n}\\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\\n\\tvec3 N = geometry.normal;\\n\\tvec3 V = geometry.viewDir;\\n\\tvec3 H = normalize( V + L );\\n\\tfloat dotNH = saturate( dot( N, H ) );\\n\\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\\n}\\n#endif\";\n\nvar bumpmap_pars_fragment = \"#ifdef USE_BUMPMAP\\n\\tuniform sampler2D bumpMap;\\n\\tuniform float bumpScale;\\n\\tvec2 dHdxy_fwd() {\\n\\t\\tvec2 dSTdx = dFdx( vUv );\\n\\t\\tvec2 dSTdy = dFdy( vUv );\\n\\t\\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\\n\\t\\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\\n\\t\\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\\n\\t\\treturn vec2( dBx, dBy );\\n\\t}\\n\\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\\n\\t\\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\\n\\t\\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\\n\\t\\tvec3 vN = surf_norm;\\n\\t\\tvec3 R1 = cross( vSigmaY, vN );\\n\\t\\tvec3 R2 = cross( vN, vSigmaX );\\n\\t\\tfloat fDet = dot( vSigmaX, R1 );\\n\\t\\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\\n\\t\\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\\n\\t\\treturn normalize( abs( fDet ) * surf_norm - vGrad );\\n\\t}\\n#endif\";\n\nvar clipping_planes_fragment = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvec4 plane;\\n\\t#pragma unroll_loop\\n\\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\\n\\t\\tplane = clippingPlanes[ i ];\\n\\t\\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\\n\\t}\\n\\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\\n\\t\\tbool clipped = true;\\n\\t\\t#pragma unroll_loop\\n\\t\\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\\n\\t\\t\\tplane = clippingPlanes[ i ];\\n\\t\\t\\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\\n\\t\\t}\\n\\t\\tif ( clipped ) discard;\\n\\t#endif\\n#endif\";\n\nvar clipping_planes_pars_fragment = \"#if NUM_CLIPPING_PLANES > 0\\n\\t#if ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP )\\n\\t\\tvarying vec3 vViewPosition;\\n\\t#endif\\n\\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\\n#endif\";\n\nvar clipping_planes_pars_vertex = \"#if NUM_CLIPPING_PLANES > 0 && ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP )\\n\\tvarying vec3 vViewPosition;\\n#endif\";\n\nvar clipping_planes_vertex = \"#if NUM_CLIPPING_PLANES > 0 && ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP )\\n\\tvViewPosition = - mvPosition.xyz;\\n#endif\";\n\nvar color_fragment = \"#ifdef USE_COLOR\\n\\tdiffuseColor.rgb *= vColor;\\n#endif\";\n\nvar color_pars_fragment = \"#ifdef USE_COLOR\\n\\tvarying vec3 vColor;\\n#endif\";\n\nvar color_pars_vertex = \"#ifdef USE_COLOR\\n\\tvarying vec3 vColor;\\n#endif\";\n\nvar color_vertex = \"#ifdef USE_COLOR\\n\\tvColor.xyz = color.xyz;\\n#endif\";\n\nvar common = \"#define PI 3.14159265359\\n#define PI2 6.28318530718\\n#define PI_HALF 1.5707963267949\\n#define RECIPROCAL_PI 0.31830988618\\n#define RECIPROCAL_PI2 0.15915494\\n#define LOG2 1.442695\\n#define EPSILON 1e-6\\n#ifndef saturate\\n#define saturate(a) clamp( a, 0.0, 1.0 )\\n#endif\\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\\nfloat pow2( const in float x ) { return x*x; }\\nfloat pow3( const in float x ) { return x*x*x; }\\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\\nhighp float rand( const in vec2 uv ) {\\n\\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\\n\\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\\n\\treturn fract(sin(sn) * c);\\n}\\n#ifdef HIGH_PRECISION\\n\\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\\n#else\\n\\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\\n\\tfloat precisionSafeLength( vec3 v ) {\\n\\t\\tfloat maxComponent = max3( abs( v ) );\\n\\t\\treturn length( v / maxComponent ) * maxComponent;\\n\\t}\\n#endif\\nstruct IncidentLight {\\n\\tvec3 color;\\n\\tvec3 direction;\\n\\tbool visible;\\n};\\nstruct ReflectedLight {\\n\\tvec3 directDiffuse;\\n\\tvec3 directSpecular;\\n\\tvec3 indirectDiffuse;\\n\\tvec3 indirectSpecular;\\n};\\nstruct GeometricContext {\\n\\tvec3 position;\\n\\tvec3 normal;\\n\\tvec3 viewDir;\\n#ifdef CLEARCOAT\\n\\tvec3 clearcoatNormal;\\n#endif\\n};\\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\\n\\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\\n}\\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\\n\\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\\n}\\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\\n\\tfloat distance = dot( planeNormal, point - pointOnPlane );\\n\\treturn - distance * planeNormal + point;\\n}\\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\\n\\treturn sign( dot( point - pointOnPlane, planeNormal ) );\\n}\\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\\n\\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\\n}\\nmat3 transposeMat3( const in mat3 m ) {\\n\\tmat3 tmp;\\n\\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\\n\\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\\n\\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\\n\\treturn tmp;\\n}\\nfloat linearToRelativeLuminance( const in vec3 color ) {\\n\\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\\n\\treturn dot( weights, color.rgb );\\n}\\nbool isPerspectiveMatrix( mat4 m ) {\\n return m[ 2 ][ 3 ] == - 1.0;\\n}\";\n\nvar cube_uv_reflection_fragment = \"#ifdef ENVMAP_TYPE_CUBE_UV\\n#define cubeUV_maxMipLevel 8.0\\n#define cubeUV_minMipLevel 4.0\\n#define cubeUV_maxTileSize 256.0\\n#define cubeUV_minTileSize 16.0\\nfloat getFace(vec3 direction) {\\n vec3 absDirection = abs(direction);\\n float face = -1.0;\\n if (absDirection.x > absDirection.z) {\\n if (absDirection.x > absDirection.y)\\n face = direction.x > 0.0 ? 0.0 : 3.0;\\n else\\n face = direction.y > 0.0 ? 1.0 : 4.0;\\n } else {\\n if (absDirection.z > absDirection.y)\\n face = direction.z > 0.0 ? 2.0 : 5.0;\\n else\\n face = direction.y > 0.0 ? 1.0 : 4.0;\\n }\\n return face;\\n}\\nvec2 getUV(vec3 direction, float face) {\\n vec2 uv;\\n if (face == 0.0) {\\n uv = vec2(-direction.z, direction.y) / abs(direction.x);\\n } else if (face == 1.0) {\\n uv = vec2(direction.x, -direction.z) / abs(direction.y);\\n } else if (face == 2.0) {\\n uv = direction.xy / abs(direction.z);\\n } else if (face == 3.0) {\\n uv = vec2(direction.z, direction.y) / abs(direction.x);\\n } else if (face == 4.0) {\\n uv = direction.xz / abs(direction.y);\\n } else {\\n uv = vec2(-direction.x, direction.y) / abs(direction.z);\\n }\\n return 0.5 * (uv + 1.0);\\n}\\nvec3 bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) {\\n float face = getFace(direction);\\n float filterInt = max(cubeUV_minMipLevel - mipInt, 0.0);\\n mipInt = max(mipInt, cubeUV_minMipLevel);\\n float faceSize = exp2(mipInt);\\n float texelSize = 1.0 / (3.0 * cubeUV_maxTileSize);\\n vec2 uv = getUV(direction, face) * (faceSize - 1.0);\\n vec2 f = fract(uv);\\n uv += 0.5 - f;\\n if (face > 2.0) {\\n uv.y += faceSize;\\n face -= 3.0;\\n }\\n uv.x += face * faceSize;\\n if(mipInt < cubeUV_maxMipLevel){\\n uv.y += 2.0 * cubeUV_maxTileSize;\\n }\\n uv.y += filterInt * 2.0 * cubeUV_minTileSize;\\n uv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize);\\n uv *= texelSize;\\n vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\\n uv.x += texelSize;\\n vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\\n uv.y += texelSize;\\n vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\\n uv.x -= texelSize;\\n vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\\n vec3 tm = mix(tl, tr, f.x);\\n vec3 bm = mix(bl, br, f.x);\\n return mix(tm, bm, f.y);\\n}\\n#define r0 1.0\\n#define v0 0.339\\n#define m0 -2.0\\n#define r1 0.8\\n#define v1 0.276\\n#define m1 -1.0\\n#define r4 0.4\\n#define v4 0.046\\n#define m4 2.0\\n#define r5 0.305\\n#define v5 0.016\\n#define m5 3.0\\n#define r6 0.21\\n#define v6 0.0038\\n#define m6 4.0\\nfloat roughnessToMip(float roughness) {\\n float mip = 0.0;\\n if (roughness >= r1) {\\n mip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0;\\n } else if (roughness >= r4) {\\n mip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1;\\n } else if (roughness >= r5) {\\n mip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4;\\n } else if (roughness >= r6) {\\n mip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5;\\n } else {\\n mip = -2.0 * log2(1.16 * roughness); }\\n return mip;\\n}\\nvec4 textureCubeUV(sampler2D envMap, vec3 sampleDir, float roughness) {\\n float mip = clamp(roughnessToMip(roughness), m0, cubeUV_maxMipLevel);\\n float mipF = fract(mip);\\n float mipInt = floor(mip);\\n vec3 color0 = bilinearCubeUV(envMap, sampleDir, mipInt);\\n if (mipF == 0.0) {\\n return vec4(color0, 1.0);\\n } else {\\n vec3 color1 = bilinearCubeUV(envMap, sampleDir, mipInt + 1.0);\\n return vec4(mix(color0, color1, mipF), 1.0);\\n }\\n}\\n#endif\";\n\nvar defaultnormal_vertex = \"vec3 transformedNormal = objectNormal;\\n#ifdef USE_INSTANCING\\n\\ttransformedNormal = mat3( instanceMatrix ) * transformedNormal;\\n#endif\\ntransformedNormal = normalMatrix * transformedNormal;\\n#ifdef FLIP_SIDED\\n\\ttransformedNormal = - transformedNormal;\\n#endif\\n#ifdef USE_TANGENT\\n\\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\\n\\t#ifdef FLIP_SIDED\\n\\t\\ttransformedTangent = - transformedTangent;\\n\\t#endif\\n#endif\";\n\nvar displacementmap_pars_vertex = \"#ifdef USE_DISPLACEMENTMAP\\n\\tuniform sampler2D displacementMap;\\n\\tuniform float displacementScale;\\n\\tuniform float displacementBias;\\n#endif\";\n\nvar displacementmap_vertex = \"#ifdef USE_DISPLACEMENTMAP\\n\\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\\n#endif\";\n\nvar emissivemap_fragment = \"#ifdef USE_EMISSIVEMAP\\n\\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\\n\\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\\n\\ttotalEmissiveRadiance *= emissiveColor.rgb;\\n#endif\";\n\nvar emissivemap_pars_fragment = \"#ifdef USE_EMISSIVEMAP\\n\\tuniform sampler2D emissiveMap;\\n#endif\";\n\nvar encodings_fragment = \"gl_FragColor = linearToOutputTexel( gl_FragColor );\";\n\nvar encodings_pars_fragment = \"\\nvec4 LinearToLinear( in vec4 value ) {\\n\\treturn value;\\n}\\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\\n\\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\\n}\\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\\n\\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\\n}\\nvec4 sRGBToLinear( in vec4 value ) {\\n\\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\\n}\\nvec4 LinearTosRGB( in vec4 value ) {\\n\\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\\n}\\nvec4 RGBEToLinear( in vec4 value ) {\\n\\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\\n}\\nvec4 LinearToRGBE( in vec4 value ) {\\n\\tfloat maxComponent = max( max( value.r, value.g ), value.b );\\n\\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\\n\\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\\n}\\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\\n\\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\\n}\\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\\n\\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\\n\\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\\n\\tM = ceil( M * 255.0 ) / 255.0;\\n\\treturn vec4( value.rgb / ( M * maxRange ), M );\\n}\\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\\n\\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\\n}\\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\\n\\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\\n\\tfloat D = max( maxRange / maxRGB, 1.0 );\\n\\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\\n\\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\\n}\\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\\nvec4 LinearToLogLuv( in vec4 value ) {\\n\\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\\n\\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\\n\\tvec4 vResult;\\n\\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\\n\\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\\n\\tvResult.w = fract( Le );\\n\\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\\n\\treturn vResult;\\n}\\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\\nvec4 LogLuvToLinear( in vec4 value ) {\\n\\tfloat Le = value.z * 255.0 + value.w;\\n\\tvec3 Xp_Y_XYZp;\\n\\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\\n\\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\\n\\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\\n\\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\\n\\treturn vec4( max( vRGB, 0.0 ), 1.0 );\\n}\";\n\nvar envmap_fragment = \"#ifdef USE_ENVMAP\\n\\t#ifdef ENV_WORLDPOS\\n\\t\\tvec3 cameraToFrag;\\n\\t\\t\\n\\t\\tif ( isOrthographic ) {\\n\\t\\t\\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\\n\\t\\t} else {\\n\\t\\t\\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\\n\\t\\t}\\n\\t\\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\\n\\t\\t#ifdef ENVMAP_MODE_REFLECTION\\n\\t\\t\\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\\n\\t\\t#else\\n\\t\\t\\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\\n\\t\\t#endif\\n\\t#else\\n\\t\\tvec3 reflectVec = vReflect;\\n\\t#endif\\n\\t#ifdef ENVMAP_TYPE_CUBE\\n\\t\\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\\n\\t#elif defined( ENVMAP_TYPE_CUBE_UV )\\n\\t\\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\\n\\t#elif defined( ENVMAP_TYPE_EQUIREC )\\n\\t\\tvec2 sampleUV;\\n\\t\\treflectVec = normalize( reflectVec );\\n\\t\\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\\n\\t\\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\\n\\t\\tvec4 envColor = texture2D( envMap, sampleUV );\\n\\t#elif defined( ENVMAP_TYPE_SPHERE )\\n\\t\\treflectVec = normalize( reflectVec );\\n\\t\\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\\n\\t\\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\\n\\t#else\\n\\t\\tvec4 envColor = vec4( 0.0 );\\n\\t#endif\\n\\t#ifndef ENVMAP_TYPE_CUBE_UV\\n\\t\\tenvColor = envMapTexelToLinear( envColor );\\n\\t#endif\\n\\t#ifdef ENVMAP_BLENDING_MULTIPLY\\n\\t\\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\\n\\t#elif defined( ENVMAP_BLENDING_MIX )\\n\\t\\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\\n\\t#elif defined( ENVMAP_BLENDING_ADD )\\n\\t\\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\\n\\t#endif\\n#endif\";\n\nvar envmap_common_pars_fragment = \"#ifdef USE_ENVMAP\\n\\tuniform float envMapIntensity;\\n\\tuniform float flipEnvMap;\\n\\tuniform int maxMipLevel;\\n\\t#ifdef ENVMAP_TYPE_CUBE\\n\\t\\tuniform samplerCube envMap;\\n\\t#else\\n\\t\\tuniform sampler2D envMap;\\n\\t#endif\\n\\t\\n#endif\";\n\nvar envmap_pars_fragment = \"#ifdef USE_ENVMAP\\n\\tuniform float reflectivity;\\n\\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\\n\\t\\t#define ENV_WORLDPOS\\n\\t#endif\\n\\t#ifdef ENV_WORLDPOS\\n\\t\\tvarying vec3 vWorldPosition;\\n\\t\\tuniform float refractionRatio;\\n\\t#else\\n\\t\\tvarying vec3 vReflect;\\n\\t#endif\\n#endif\";\n\nvar envmap_pars_vertex = \"#ifdef USE_ENVMAP\\n\\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\\n\\t\\t#define ENV_WORLDPOS\\n\\t#endif\\n\\t#ifdef ENV_WORLDPOS\\n\\t\\t\\n\\t\\tvarying vec3 vWorldPosition;\\n\\t#else\\n\\t\\tvarying vec3 vReflect;\\n\\t\\tuniform float refractionRatio;\\n\\t#endif\\n#endif\";\n\nvar envmap_vertex = \"#ifdef USE_ENVMAP\\n\\t#ifdef ENV_WORLDPOS\\n\\t\\tvWorldPosition = worldPosition.xyz;\\n\\t#else\\n\\t\\tvec3 cameraToVertex;\\n\\t\\tif ( isOrthographic ) { \\n\\t\\t\\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\\n\\t\\t} else {\\n\\t\\t\\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\\n\\t\\t}\\n\\t\\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\\n\\t\\t#ifdef ENVMAP_MODE_REFLECTION\\n\\t\\t\\tvReflect = reflect( cameraToVertex, worldNormal );\\n\\t\\t#else\\n\\t\\t\\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\\n\\t\\t#endif\\n\\t#endif\\n#endif\";\n\nvar fog_vertex = \"#ifdef USE_FOG\\n\\tfogDepth = -mvPosition.z;\\n#endif\";\n\nvar fog_pars_vertex = \"#ifdef USE_FOG\\n\\tvarying float fogDepth;\\n#endif\";\n\nvar fog_fragment = \"#ifdef USE_FOG\\n\\t#ifdef FOG_EXP2\\n\\t\\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\\n\\t#else\\n\\t\\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\\n\\t#endif\\n\\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\\n#endif\";\n\nvar fog_pars_fragment = \"#ifdef USE_FOG\\n\\tuniform vec3 fogColor;\\n\\tvarying float fogDepth;\\n\\t#ifdef FOG_EXP2\\n\\t\\tuniform float fogDensity;\\n\\t#else\\n\\t\\tuniform float fogNear;\\n\\t\\tuniform float fogFar;\\n\\t#endif\\n#endif\";\n\nvar gradientmap_pars_fragment = \"#ifdef USE_GRADIENTMAP\\n\\tuniform sampler2D gradientMap;\\n#endif\\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\\n\\tfloat dotNL = dot( normal, lightDirection );\\n\\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\\n\\t#ifdef USE_GRADIENTMAP\\n\\t\\treturn texture2D( gradientMap, coord ).rgb;\\n\\t#else\\n\\t\\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\\n\\t#endif\\n}\";\n\nvar lightmap_fragment = \"#ifdef USE_LIGHTMAP\\n\\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\\n\\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\\n#endif\";\n\nvar lightmap_pars_fragment = \"#ifdef USE_LIGHTMAP\\n\\tuniform sampler2D lightMap;\\n\\tuniform float lightMapIntensity;\\n#endif\";\n\nvar lights_lambert_vertex = \"vec3 diffuse = vec3( 1.0 );\\nGeometricContext geometry;\\ngeometry.position = mvPosition.xyz;\\ngeometry.normal = normalize( transformedNormal );\\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\\nGeometricContext backGeometry;\\nbackGeometry.position = geometry.position;\\nbackGeometry.normal = -geometry.normal;\\nbackGeometry.viewDir = geometry.viewDir;\\nvLightFront = vec3( 0.0 );\\nvIndirectFront = vec3( 0.0 );\\n#ifdef DOUBLE_SIDED\\n\\tvLightBack = vec3( 0.0 );\\n\\tvIndirectBack = vec3( 0.0 );\\n#endif\\nIncidentLight directLight;\\nfloat dotNL;\\nvec3 directLightColor_Diffuse;\\n#if NUM_POINT_LIGHTS > 0\\n\\t#pragma unroll_loop\\n\\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\\n\\t\\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\\n\\t\\tdotNL = dot( geometry.normal, directLight.direction );\\n\\t\\tdirectLightColor_Diffuse = PI * directLight.color;\\n\\t\\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\\n\\t\\t#ifdef DOUBLE_SIDED\\n\\t\\t\\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\\n\\t\\t#endif\\n\\t}\\n#endif\\n#if NUM_SPOT_LIGHTS > 0\\n\\t#pragma unroll_loop\\n\\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\\n\\t\\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\\n\\t\\tdotNL = dot( geometry.normal, directLight.direction );\\n\\t\\tdirectLightColor_Diffuse = PI * directLight.color;\\n\\t\\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\\n\\t\\t#ifdef DOUBLE_SIDED\\n\\t\\t\\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\\n\\t\\t#endif\\n\\t}\\n#endif\\n#if NUM_DIR_LIGHTS > 0\\n\\t#pragma unroll_loop\\n\\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\\n\\t\\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\\n\\t\\tdotNL = dot( geometry.normal, directLight.direction );\\n\\t\\tdirectLightColor_Diffuse = PI * directLight.color;\\n\\t\\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\\n\\t\\t#ifdef DOUBLE_SIDED\\n\\t\\t\\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\\n\\t\\t#endif\\n\\t}\\n#endif\\n#if NUM_HEMI_LIGHTS > 0\\n\\t#pragma unroll_loop\\n\\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\\n\\t\\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\\n\\t\\t#ifdef DOUBLE_SIDED\\n\\t\\t\\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\\n\\t\\t#endif\\n\\t}\\n#endif\";\n\nvar lights_pars_begin = \"uniform bool receiveShadow;\\nuniform vec3 ambientLightColor;\\nuniform vec3 lightProbe[ 9 ];\\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\\n\\tfloat x = normal.x, y = normal.y, z = normal.z;\\n\\tvec3 result = shCoefficients[ 0 ] * 0.886227;\\n\\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\\n\\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\\n\\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\\n\\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\\n\\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\\n\\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\\n\\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\\n\\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\\n\\treturn result;\\n}\\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\\n\\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\\n\\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\\n\\treturn irradiance;\\n}\\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\\n\\tvec3 irradiance = ambientLightColor;\\n\\t#ifndef PHYSICALLY_CORRECT_LIGHTS\\n\\t\\tirradiance *= PI;\\n\\t#endif\\n\\treturn irradiance;\\n}\\n#if NUM_DIR_LIGHTS > 0\\n\\tstruct DirectionalLight {\\n\\t\\tvec3 direction;\\n\\t\\tvec3 color;\\n\\t\\tint shadow;\\n\\t\\tfloat shadowBias;\\n\\t\\tfloat shadowRadius;\\n\\t\\tvec2 shadowMapSize;\\n\\t};\\n\\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\\n\\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\\n\\t\\tdirectLight.color = directionalLight.color;\\n\\t\\tdirectLight.direction = directionalLight.direction;\\n\\t\\tdirectLight.visible = true;\\n\\t}\\n#endif\\n#if NUM_POINT_LIGHTS > 0\\n\\tstruct PointLight {\\n\\t\\tvec3 position;\\n\\t\\tvec3 color;\\n\\t\\tfloat distance;\\n\\t\\tfloat decay;\\n\\t\\tint shadow;\\n\\t\\tfloat shadowBias;\\n\\t\\tfloat shadowRadius;\\n\\t\\tvec2 shadowMapSize;\\n\\t\\tfloat shadowCameraNear;\\n\\t\\tfloat shadowCameraFar;\\n\\t};\\n\\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\\n\\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\\n\\t\\tvec3 lVector = pointLight.position - geometry.position;\\n\\t\\tdirectLight.direction = normalize( lVector );\\n\\t\\tfloat lightDistance = length( lVector );\\n\\t\\tdirectLight.color = pointLight.color;\\n\\t\\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\\n\\t\\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\\n\\t}\\n#endif\\n#if NUM_SPOT_LIGHTS > 0\\n\\tstruct SpotLight {\\n\\t\\tvec3 position;\\n\\t\\tvec3 direction;\\n\\t\\tvec3 color;\\n\\t\\tfloat distance;\\n\\t\\tfloat decay;\\n\\t\\tfloat coneCos;\\n\\t\\tfloat penumbraCos;\\n\\t\\tint shadow;\\n\\t\\tfloat shadowBias;\\n\\t\\tfloat shadowRadius;\\n\\t\\tvec2 shadowMapSize;\\n\\t};\\n\\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\\n\\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\\n\\t\\tvec3 lVector = spotLight.position - geometry.position;\\n\\t\\tdirectLight.direction = normalize( lVector );\\n\\t\\tfloat lightDistance = length( lVector );\\n\\t\\tfloat angleCos = dot( directLight.direction, spotLight.direction );\\n\\t\\tif ( angleCos > spotLight.coneCos ) {\\n\\t\\t\\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\\n\\t\\t\\tdirectLight.color = spotLight.color;\\n\\t\\t\\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\\n\\t\\t\\tdirectLight.visible = true;\\n\\t\\t} else {\\n\\t\\t\\tdirectLight.color = vec3( 0.0 );\\n\\t\\t\\tdirectLight.visible = false;\\n\\t\\t}\\n\\t}\\n#endif\\n#if NUM_RECT_AREA_LIGHTS > 0\\n\\tstruct RectAreaLight {\\n\\t\\tvec3 color;\\n\\t\\tvec3 position;\\n\\t\\tvec3 halfWidth;\\n\\t\\tvec3 halfHeight;\\n\\t};\\n\\tuniform sampler2D ltc_1;\\tuniform sampler2D ltc_2;\\n\\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\\n#endif\\n#if NUM_HEMI_LIGHTS > 0\\n\\tstruct HemisphereLight {\\n\\t\\tvec3 direction;\\n\\t\\tvec3 skyColor;\\n\\t\\tvec3 groundColor;\\n\\t};\\n\\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\\n\\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\\n\\t\\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\\n\\t\\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\\n\\t\\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\\n\\t\\t#ifndef PHYSICALLY_CORRECT_LIGHTS\\n\\t\\t\\tirradiance *= PI;\\n\\t\\t#endif\\n\\t\\treturn irradiance;\\n\\t}\\n#endif\";\n\nvar envmap_physical_pars_fragment = \"#if defined( USE_ENVMAP )\\n\\t#ifdef ENVMAP_MODE_REFRACTION\\n\\t\\tuniform float refractionRatio;\\n\\t#endif\\n\\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\\n\\t\\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\\n\\t\\t#ifdef ENVMAP_TYPE_CUBE\\n\\t\\t\\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\\n\\t\\t\\t#ifdef TEXTURE_LOD_EXT\\n\\t\\t\\t\\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\\n\\t\\t\\t#else\\n\\t\\t\\t\\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\\n\\t\\t\\t#endif\\n\\t\\t\\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\\n\\t\\t#elif defined( ENVMAP_TYPE_CUBE_UV )\\n\\t\\t\\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\\n\\t\\t#else\\n\\t\\t\\tvec4 envMapColor = vec4( 0.0 );\\n\\t\\t#endif\\n\\t\\treturn PI * envMapColor.rgb * envMapIntensity;\\n\\t}\\n\\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\\n\\t\\tfloat maxMIPLevelScalar = float( maxMIPLevel );\\n\\t\\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\\n\\t\\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\\n\\t\\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\\n\\t}\\n\\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\\n\\t\\t#ifdef ENVMAP_MODE_REFLECTION\\n\\t\\t vec3 reflectVec = reflect( -viewDir, normal );\\n\\t\\t reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\\n\\t\\t#else\\n\\t\\t vec3 reflectVec = refract( -viewDir, normal, refractionRatio );\\n\\t\\t#endif\\n\\t\\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\\n\\t\\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\\n\\t\\t#ifdef ENVMAP_TYPE_CUBE\\n\\t\\t\\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\\n\\t\\t\\t#ifdef TEXTURE_LOD_EXT\\n\\t\\t\\t\\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\\n\\t\\t\\t#else\\n\\t\\t\\t\\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\\n\\t\\t\\t#endif\\n\\t\\t\\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\\n\\t\\t#elif defined( ENVMAP_TYPE_CUBE_UV )\\n\\t\\t\\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\\n\\t\\t#elif defined( ENVMAP_TYPE_EQUIREC )\\n\\t\\t\\tvec2 sampleUV;\\n\\t\\t\\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\\n\\t\\t\\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\\n\\t\\t\\t#ifdef TEXTURE_LOD_EXT\\n\\t\\t\\t\\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\\n\\t\\t\\t#else\\n\\t\\t\\t\\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\\n\\t\\t\\t#endif\\n\\t\\t\\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\\n\\t\\t#elif defined( ENVMAP_TYPE_SPHERE )\\n\\t\\t\\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\\n\\t\\t\\t#ifdef TEXTURE_LOD_EXT\\n\\t\\t\\t\\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\\n\\t\\t\\t#else\\n\\t\\t\\t\\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\\n\\t\\t\\t#endif\\n\\t\\t\\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\\n\\t\\t#endif\\n\\t\\treturn envMapColor.rgb * envMapIntensity;\\n\\t}\\n#endif\";\n\nvar lights_toon_fragment = \"ToonMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb;\\nmaterial.specularColor = specular;\\nmaterial.specularShininess = shininess;\\nmaterial.specularStrength = specularStrength;\";\n\nvar lights_toon_pars_fragment = \"varying vec3 vViewPosition;\\n#ifndef FLAT_SHADED\\n\\tvarying vec3 vNormal;\\n#endif\\nstruct ToonMaterial {\\n\\tvec3\\tdiffuseColor;\\n\\tvec3\\tspecularColor;\\n\\tfloat\\tspecularShininess;\\n\\tfloat\\tspecularStrength;\\n};\\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\\n\\t#ifndef PHYSICALLY_CORRECT_LIGHTS\\n\\t\\tirradiance *= PI;\\n\\t#endif\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\\n\\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\\n}\\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\\n\\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\\n}\\n#define RE_Direct\\t\\t\\t\\tRE_Direct_Toon\\n#define RE_IndirectDiffuse\\t\\tRE_IndirectDiffuse_Toon\\n#define Material_LightProbeLOD( material )\\t(0)\";\n\nvar lights_phong_fragment = \"BlinnPhongMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb;\\nmaterial.specularColor = specular;\\nmaterial.specularShininess = shininess;\\nmaterial.specularStrength = specularStrength;\";\n\nvar lights_phong_pars_fragment = \"varying vec3 vViewPosition;\\n#ifndef FLAT_SHADED\\n\\tvarying vec3 vNormal;\\n#endif\\nstruct BlinnPhongMaterial {\\n\\tvec3\\tdiffuseColor;\\n\\tvec3\\tspecularColor;\\n\\tfloat\\tspecularShininess;\\n\\tfloat\\tspecularStrength;\\n};\\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\\n\\tvec3 irradiance = dotNL * directLight.color;\\n\\t#ifndef PHYSICALLY_CORRECT_LIGHTS\\n\\t\\tirradiance *= PI;\\n\\t#endif\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\\n\\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\\n}\\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\\n\\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\\n}\\n#define RE_Direct\\t\\t\\t\\tRE_Direct_BlinnPhong\\n#define RE_IndirectDiffuse\\t\\tRE_IndirectDiffuse_BlinnPhong\\n#define Material_LightProbeLOD( material )\\t(0)\";\n\nvar lights_physical_fragment = \"PhysicalMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\\nmaterial.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\\n#ifdef REFLECTIVITY\\n\\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\\n#else\\n\\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\\n#endif\\n#ifdef CLEARCOAT\\n\\tmaterial.clearcoat = saturate( clearcoat );\\tmaterial.clearcoatRoughness = max( clearcoatRoughness, 0.0525 );\\n\\tmaterial.clearcoatRoughness += geometryRoughness;\\n\\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\\n#endif\\n#ifdef USE_SHEEN\\n\\tmaterial.sheenColor = sheen;\\n#endif\";\n\nvar lights_physical_pars_fragment = \"struct PhysicalMaterial {\\n\\tvec3\\tdiffuseColor;\\n\\tfloat\\tspecularRoughness;\\n\\tvec3\\tspecularColor;\\n#ifdef CLEARCOAT\\n\\tfloat clearcoat;\\n\\tfloat clearcoatRoughness;\\n#endif\\n#ifdef USE_SHEEN\\n\\tvec3 sheenColor;\\n#endif\\n};\\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\\n\\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\\n}\\n#if NUM_RECT_AREA_LIGHTS > 0\\n\\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\n\\t\\tvec3 normal = geometry.normal;\\n\\t\\tvec3 viewDir = geometry.viewDir;\\n\\t\\tvec3 position = geometry.position;\\n\\t\\tvec3 lightPos = rectAreaLight.position;\\n\\t\\tvec3 halfWidth = rectAreaLight.halfWidth;\\n\\t\\tvec3 halfHeight = rectAreaLight.halfHeight;\\n\\t\\tvec3 lightColor = rectAreaLight.color;\\n\\t\\tfloat roughness = material.specularRoughness;\\n\\t\\tvec3 rectCoords[ 4 ];\\n\\t\\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\\t\\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\\n\\t\\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\\n\\t\\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\\n\\t\\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\\n\\t\\tvec4 t1 = texture2D( ltc_1, uv );\\n\\t\\tvec4 t2 = texture2D( ltc_2, uv );\\n\\t\\tmat3 mInv = mat3(\\n\\t\\t\\tvec3( t1.x, 0, t1.y ),\\n\\t\\t\\tvec3( 0, 1, 0 ),\\n\\t\\t\\tvec3( t1.z, 0, t1.w )\\n\\t\\t);\\n\\t\\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\\n\\t\\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\\n\\t\\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\\n\\t}\\n#endif\\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\\n\\tvec3 irradiance = dotNL * directLight.color;\\n\\t#ifndef PHYSICALLY_CORRECT_LIGHTS\\n\\t\\tirradiance *= PI;\\n\\t#endif\\n\\t#ifdef CLEARCOAT\\n\\t\\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\\n\\t\\tvec3 ccIrradiance = ccDotNL * directLight.color;\\n\\t\\t#ifndef PHYSICALLY_CORRECT_LIGHTS\\n\\t\\t\\tccIrradiance *= PI;\\n\\t\\t#endif\\n\\t\\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\\n\\t\\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\\n\\t#else\\n\\t\\tfloat clearcoatDHR = 0.0;\\n\\t#endif\\n\\t#ifdef USE_SHEEN\\n\\t\\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\\n\\t\\t\\tmaterial.specularRoughness,\\n\\t\\t\\tdirectLight.direction,\\n\\t\\t\\tgeometry,\\n\\t\\t\\tmaterial.sheenColor\\n\\t\\t);\\n\\t#else\\n\\t\\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\\n\\t#endif\\n\\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\n\\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\\n\\t#ifdef CLEARCOAT\\n\\t\\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\\n\\t\\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\\n\\t\\tfloat ccDotNL = ccDotNV;\\n\\t\\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\\n\\t#else\\n\\t\\tfloat clearcoatDHR = 0.0;\\n\\t#endif\\n\\tfloat clearcoatInv = 1.0 - clearcoatDHR;\\n\\tvec3 singleScattering = vec3( 0.0 );\\n\\tvec3 multiScattering = vec3( 0.0 );\\n\\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\\n\\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\\n\\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\\n\\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\\n\\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\\n\\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\\n}\\n#define RE_Direct\\t\\t\\t\\tRE_Direct_Physical\\n#define RE_Direct_RectArea\\t\\tRE_Direct_RectArea_Physical\\n#define RE_IndirectDiffuse\\t\\tRE_IndirectDiffuse_Physical\\n#define RE_IndirectSpecular\\t\\tRE_IndirectSpecular_Physical\\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\\n\\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\\n}\";\n\nvar lights_fragment_begin = \"\\nGeometricContext geometry;\\ngeometry.position = - vViewPosition;\\ngeometry.normal = normal;\\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\\n#ifdef CLEARCOAT\\n\\tgeometry.clearcoatNormal = clearcoatNormal;\\n#endif\\nIncidentLight directLight;\\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\\n\\tPointLight pointLight;\\n\\t#pragma unroll_loop\\n\\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\\n\\t\\tpointLight = pointLights[ i ];\\n\\t\\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\\n\\t\\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\\n\\t\\tdirectLight.color *= all( bvec3( pointLight.shadow, directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\\n\\t\\t#endif\\n\\t\\tRE_Direct( directLight, geometry, material, reflectedLight );\\n\\t}\\n#endif\\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\\n\\tSpotLight spotLight;\\n\\t#pragma unroll_loop\\n\\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\\n\\t\\tspotLight = spotLights[ i ];\\n\\t\\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\\n\\t\\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\\n\\t\\tdirectLight.color *= all( bvec3( spotLight.shadow, directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\\n\\t\\t#endif\\n\\t\\tRE_Direct( directLight, geometry, material, reflectedLight );\\n\\t}\\n#endif\\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\\n\\tDirectionalLight directionalLight;\\n\\t#pragma unroll_loop\\n\\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\\n\\t\\tdirectionalLight = directionalLights[ i ];\\n\\t\\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\\n\\t\\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\\n\\t\\tdirectLight.color *= all( bvec3( directionalLight.shadow, directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\\n\\t\\t#endif\\n\\t\\tRE_Direct( directLight, geometry, material, reflectedLight );\\n\\t}\\n#endif\\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\\n\\tRectAreaLight rectAreaLight;\\n\\t#pragma unroll_loop\\n\\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\\n\\t\\trectAreaLight = rectAreaLights[ i ];\\n\\t\\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\\n\\t}\\n#endif\\n#if defined( RE_IndirectDiffuse )\\n\\tvec3 iblIrradiance = vec3( 0.0 );\\n\\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\\n\\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\\n\\t#if ( NUM_HEMI_LIGHTS > 0 )\\n\\t\\t#pragma unroll_loop\\n\\t\\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\\n\\t\\t\\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\\n\\t\\t}\\n\\t#endif\\n#endif\\n#if defined( RE_IndirectSpecular )\\n\\tvec3 radiance = vec3( 0.0 );\\n\\tvec3 clearcoatRadiance = vec3( 0.0 );\\n#endif\";\n\nvar lights_fragment_maps = \"#if defined( RE_IndirectDiffuse )\\n\\t#ifdef USE_LIGHTMAP\\n\\t\\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\\n\\t\\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\\n\\t\\t#ifndef PHYSICALLY_CORRECT_LIGHTS\\n\\t\\t\\tlightMapIrradiance *= PI;\\n\\t\\t#endif\\n\\t\\tirradiance += lightMapIrradiance;\\n\\t#endif\\n\\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\\n\\t\\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\\n\\t#endif\\n#endif\\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\\n\\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\\n\\t#ifdef CLEARCOAT\\n\\t\\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\\n\\t#endif\\n#endif\";\n\nvar lights_fragment_end = \"#if defined( RE_IndirectDiffuse )\\n\\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\\n#endif\\n#if defined( RE_IndirectSpecular )\\n\\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\\n#endif\";\n\nvar logdepthbuf_fragment = \"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\\n\\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\\n#endif\";\n\nvar logdepthbuf_pars_fragment = \"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\\n\\tuniform float logDepthBufFC;\\n\\tvarying float vFragDepth;\\n\\tvarying float vIsPerspective;\\n#endif\";\n\nvar logdepthbuf_pars_vertex = \"#ifdef USE_LOGDEPTHBUF\\n\\t#ifdef USE_LOGDEPTHBUF_EXT\\n\\t\\tvarying float vFragDepth;\\n\\t\\tvarying float vIsPerspective;\\n\\t#else\\n\\t\\tuniform float logDepthBufFC;\\n\\t#endif\\n#endif\";\n\nvar logdepthbuf_vertex = \"#ifdef USE_LOGDEPTHBUF\\n\\t#ifdef USE_LOGDEPTHBUF_EXT\\n\\t\\tvFragDepth = 1.0 + gl_Position.w;\\n\\t\\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\\n\\t#else\\n\\t\\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\\n\\t\\t\\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\\n\\t\\t\\tgl_Position.z *= gl_Position.w;\\n\\t\\t}\\n\\t#endif\\n#endif\";\n\nvar map_fragment = \"#ifdef USE_MAP\\n\\tvec4 texelColor = texture2D( map, vUv );\\n\\ttexelColor = mapTexelToLinear( texelColor );\\n\\tdiffuseColor *= texelColor;\\n#endif\";\n\nvar map_pars_fragment = \"#ifdef USE_MAP\\n\\tuniform sampler2D map;\\n#endif\";\n\nvar map_particle_fragment = \"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\\n\\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\\n#endif\\n#ifdef USE_MAP\\n\\tvec4 mapTexel = texture2D( map, uv );\\n\\tdiffuseColor *= mapTexelToLinear( mapTexel );\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\\n#endif\";\n\nvar map_particle_pars_fragment = \"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\\n\\tuniform mat3 uvTransform;\\n#endif\\n#ifdef USE_MAP\\n\\tuniform sampler2D map;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tuniform sampler2D alphaMap;\\n#endif\";\n\nvar metalnessmap_fragment = \"float metalnessFactor = metalness;\\n#ifdef USE_METALNESSMAP\\n\\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\\n\\tmetalnessFactor *= texelMetalness.b;\\n#endif\";\n\nvar metalnessmap_pars_fragment = \"#ifdef USE_METALNESSMAP\\n\\tuniform sampler2D metalnessMap;\\n#endif\";\n\nvar morphnormal_vertex = \"#ifdef USE_MORPHNORMALS\\n\\tobjectNormal *= morphTargetBaseInfluence;\\n\\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\\n\\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\\n\\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\\n\\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\\n#endif\";\n\nvar morphtarget_pars_vertex = \"#ifdef USE_MORPHTARGETS\\n\\tuniform float morphTargetBaseInfluence;\\n\\t#ifndef USE_MORPHNORMALS\\n\\tuniform float morphTargetInfluences[ 8 ];\\n\\t#else\\n\\tuniform float morphTargetInfluences[ 4 ];\\n\\t#endif\\n#endif\";\n\nvar morphtarget_vertex = \"#ifdef USE_MORPHTARGETS\\n\\ttransformed *= morphTargetBaseInfluence;\\n\\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\\n\\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\\n\\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\\n\\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\\n\\t#ifndef USE_MORPHNORMALS\\n\\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\\n\\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\\n\\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\\n\\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\\n\\t#endif\\n#endif\";\n\nvar normal_fragment_begin = \"#ifdef FLAT_SHADED\\n\\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\\n\\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\\n\\tvec3 normal = normalize( cross( fdx, fdy ) );\\n#else\\n\\tvec3 normal = normalize( vNormal );\\n\\t#ifdef DOUBLE_SIDED\\n\\t\\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\\n\\t#endif\\n\\t#ifdef USE_TANGENT\\n\\t\\tvec3 tangent = normalize( vTangent );\\n\\t\\tvec3 bitangent = normalize( vBitangent );\\n\\t\\t#ifdef DOUBLE_SIDED\\n\\t\\t\\ttangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\\n\\t\\t\\tbitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\\n\\t\\t#endif\\n\\t\\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\\n\\t\\t\\tmat3 vTBN = mat3( tangent, bitangent, normal );\\n\\t\\t#endif\\n\\t#endif\\n#endif\\nvec3 geometryNormal = normal;\";\n\nvar normal_fragment_maps = \"#ifdef OBJECTSPACE_NORMALMAP\\n\\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\\n\\t#ifdef FLIP_SIDED\\n\\t\\tnormal = - normal;\\n\\t#endif\\n\\t#ifdef DOUBLE_SIDED\\n\\t\\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\\n\\t#endif\\n\\tnormal = normalize( normalMatrix * normal );\\n#elif defined( TANGENTSPACE_NORMALMAP )\\n\\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\\n\\tmapN.xy *= normalScale;\\n\\t#ifdef USE_TANGENT\\n\\t\\tnormal = normalize( vTBN * mapN );\\n\\t#else\\n\\t\\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN );\\n\\t#endif\\n#elif defined( USE_BUMPMAP )\\n\\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\\n#endif\";\n\nvar normalmap_pars_fragment = \"#ifdef USE_NORMALMAP\\n\\tuniform sampler2D normalMap;\\n\\tuniform vec2 normalScale;\\n#endif\\n#ifdef OBJECTSPACE_NORMALMAP\\n\\tuniform mat3 normalMatrix;\\n#endif\\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\\n\\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN ) {\\n\\t\\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\\n\\t\\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\\n\\t\\tvec2 st0 = dFdx( vUv.st );\\n\\t\\tvec2 st1 = dFdy( vUv.st );\\n\\t\\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\\n\\t\\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\\n\\t\\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\\n\\t\\tvec3 N = normalize( surf_norm );\\n\\t\\tmat3 tsn = mat3( S, T, N );\\n\\t\\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\\n\\t\\treturn normalize( tsn * mapN );\\n\\t}\\n#endif\";\n\nvar clearcoat_normal_fragment_begin = \"#ifdef CLEARCOAT\\n\\tvec3 clearcoatNormal = geometryNormal;\\n#endif\";\n\nvar clearcoat_normal_fragment_maps = \"#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\\n\\tclearcoatMapN.xy *= clearcoatNormalScale;\\n\\t#ifdef USE_TANGENT\\n\\t\\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\\n\\t#else\\n\\t\\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN );\\n\\t#endif\\n#endif\";\n\nvar clearcoat_normalmap_pars_fragment = \"#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tuniform sampler2D clearcoatNormalMap;\\n\\tuniform vec2 clearcoatNormalScale;\\n#endif\";\n\nvar packing = \"vec3 packNormalToRGB( const in vec3 normal ) {\\n\\treturn normalize( normal ) * 0.5 + 0.5;\\n}\\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\\n\\treturn 2.0 * rgb.xyz - 1.0;\\n}\\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\\nconst float ShiftRight8 = 1. / 256.;\\nvec4 packDepthToRGBA( const in float v ) {\\n\\tvec4 r = vec4( fract( v * PackFactors ), v );\\n\\tr.yzw -= r.xyz * ShiftRight8;\\treturn r * PackUpscale;\\n}\\nfloat unpackRGBAToDepth( const in vec4 v ) {\\n\\treturn dot( v, UnpackFactors );\\n}\\nvec4 pack2HalfToRGBA( vec2 v ) {\\n\\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\\n\\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\\n}\\nvec2 unpackRGBATo2Half( vec4 v ) {\\n\\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\\n}\\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\\n\\treturn ( viewZ + near ) / ( near - far );\\n}\\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\\n\\treturn linearClipZ * ( near - far ) - near;\\n}\\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\\n\\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\\n}\\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\\n\\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\\n}\";\n\nvar premultiplied_alpha_fragment = \"#ifdef PREMULTIPLIED_ALPHA\\n\\tgl_FragColor.rgb *= gl_FragColor.a;\\n#endif\";\n\nvar project_vertex = \"vec4 mvPosition = vec4( transformed, 1.0 );\\n#ifdef USE_INSTANCING\\n\\tmvPosition = instanceMatrix * mvPosition;\\n#endif\\nmvPosition = modelViewMatrix * mvPosition;\\ngl_Position = projectionMatrix * mvPosition;\";\n\nvar dithering_fragment = \"#ifdef DITHERING\\n\\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\\n#endif\";\n\nvar dithering_pars_fragment = \"#ifdef DITHERING\\n\\tvec3 dithering( vec3 color ) {\\n\\t\\tfloat grid_position = rand( gl_FragCoord.xy );\\n\\t\\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\\n\\t\\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\\n\\t\\treturn color + dither_shift_RGB;\\n\\t}\\n#endif\";\n\nvar roughnessmap_fragment = \"float roughnessFactor = roughness;\\n#ifdef USE_ROUGHNESSMAP\\n\\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\\n\\troughnessFactor *= texelRoughness.g;\\n#endif\";\n\nvar roughnessmap_pars_fragment = \"#ifdef USE_ROUGHNESSMAP\\n\\tuniform sampler2D roughnessMap;\\n#endif\";\n\nvar shadowmap_pars_fragment = \"#ifdef USE_SHADOWMAP\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\\t\\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_SPOT_LIGHT_SHADOWS > 0\\n\\t\\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\\t\\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t#endif\\n\\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\\n\\t\\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\\n\\t}\\n\\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\\n\\t\\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\\n\\t}\\n\\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\\n\\t\\tfloat occlusion = 1.0;\\n\\t\\tvec2 distribution = texture2DDistribution( shadow, uv );\\n\\t\\tfloat hard_shadow = step( compare , distribution.x );\\n\\t\\tif (hard_shadow != 1.0 ) {\\n\\t\\t\\tfloat distance = compare - distribution.x ;\\n\\t\\t\\tfloat variance = max( 0.00000, distribution.y * distribution.y );\\n\\t\\t\\tfloat softness_probability = variance / (variance + distance * distance );\\t\\t\\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\\t\\t\\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\\n\\t\\t}\\n\\t\\treturn occlusion;\\n\\t}\\n\\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\\n\\t\\tfloat shadow = 1.0;\\n\\t\\tshadowCoord.xyz /= shadowCoord.w;\\n\\t\\tshadowCoord.z += shadowBias;\\n\\t\\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\\n\\t\\tbool inFrustum = all( inFrustumVec );\\n\\t\\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\\n\\t\\tbool frustumTest = all( frustumTestVec );\\n\\t\\tif ( frustumTest ) {\\n\\t\\t#if defined( SHADOWMAP_TYPE_PCF )\\n\\t\\t\\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\\n\\t\\t\\tfloat dx0 = - texelSize.x * shadowRadius;\\n\\t\\t\\tfloat dy0 = - texelSize.y * shadowRadius;\\n\\t\\t\\tfloat dx1 = + texelSize.x * shadowRadius;\\n\\t\\t\\tfloat dy1 = + texelSize.y * shadowRadius;\\n\\t\\t\\tfloat dx2 = dx0 / 2.0;\\n\\t\\t\\tfloat dy2 = dy0 / 2.0;\\n\\t\\t\\tfloat dx3 = dx1 / 2.0;\\n\\t\\t\\tfloat dy3 = dy1 / 2.0;\\n\\t\\t\\tshadow = (\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\\n\\t\\t\\t) * ( 1.0 / 17.0 );\\n\\t\\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\\n\\t\\t\\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\\n\\t\\t\\tfloat dx = texelSize.x;\\n\\t\\t\\tfloat dy = texelSize.y;\\n\\t\\t\\tvec2 uv = shadowCoord.xy;\\n\\t\\t\\tvec2 f = fract( uv * shadowMapSize + 0.5 );\\n\\t\\t\\tuv -= f * texelSize;\\n\\t\\t\\tshadow = (\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\\n\\t\\t\\t\\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \\n\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t f.x ) +\\n\\t\\t\\t\\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \\n\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t f.x ) +\\n\\t\\t\\t\\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \\n\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t f.y ) +\\n\\t\\t\\t\\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \\n\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t f.y ) +\\n\\t\\t\\t\\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \\n\\t\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t\\t f.x ),\\n\\t\\t\\t\\t\\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \\n\\t\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t\\t f.x ),\\n\\t\\t\\t\\t\\t f.y )\\n\\t\\t\\t) * ( 1.0 / 9.0 );\\n\\t\\t#elif defined( SHADOWMAP_TYPE_VSM )\\n\\t\\t\\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\\n\\t\\t#else\\n\\t\\t\\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\\n\\t\\t#endif\\n\\t\\t}\\n\\t\\treturn shadow;\\n\\t}\\n\\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\\n\\t\\tvec3 absV = abs( v );\\n\\t\\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\\n\\t\\tabsV *= scaleToCube;\\n\\t\\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\\n\\t\\tvec2 planar = v.xy;\\n\\t\\tfloat almostATexel = 1.5 * texelSizeY;\\n\\t\\tfloat almostOne = 1.0 - almostATexel;\\n\\t\\tif ( absV.z >= almostOne ) {\\n\\t\\t\\tif ( v.z > 0.0 )\\n\\t\\t\\t\\tplanar.x = 4.0 - v.x;\\n\\t\\t} else if ( absV.x >= almostOne ) {\\n\\t\\t\\tfloat signX = sign( v.x );\\n\\t\\t\\tplanar.x = v.z * signX + 2.0 * signX;\\n\\t\\t} else if ( absV.y >= almostOne ) {\\n\\t\\t\\tfloat signY = sign( v.y );\\n\\t\\t\\tplanar.x = v.x + 2.0 * signY + 2.0;\\n\\t\\t\\tplanar.y = v.z * signY - 2.0;\\n\\t\\t}\\n\\t\\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\\n\\t}\\n\\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\\n\\t\\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\\n\\t\\tvec3 lightToPosition = shadowCoord.xyz;\\n\\t\\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\\t\\tdp += shadowBias;\\n\\t\\tvec3 bd3D = normalize( lightToPosition );\\n\\t\\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\\n\\t\\t\\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\\n\\t\\t\\treturn (\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\\n\\t\\t\\t) * ( 1.0 / 9.0 );\\n\\t\\t#else\\n\\t\\t\\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\\n\\t\\t#endif\\n\\t}\\n#endif\";\n\nvar shadowmap_pars_vertex = \"#ifdef USE_SHADOWMAP\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\\t\\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_SPOT_LIGHT_SHADOWS > 0\\n\\t\\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\\t\\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t#endif\\n#endif\";\n\nvar shadowmap_vertex = \"#ifdef USE_SHADOWMAP\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\\t#pragma unroll_loop\\n\\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\\n\\t\\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\\n\\t}\\n\\t#endif\\n\\t#if NUM_SPOT_LIGHT_SHADOWS > 0\\n\\t#pragma unroll_loop\\n\\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\\n\\t\\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\\n\\t}\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\\t#pragma unroll_loop\\n\\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\\n\\t\\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\\n\\t}\\n\\t#endif\\n#endif\";\n\nvar shadowmask_pars_fragment = \"float getShadowMask() {\\n\\tfloat shadow = 1.0;\\n\\t#ifdef USE_SHADOWMAP\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\\tDirectionalLight directionalLight;\\n\\t#pragma unroll_loop\\n\\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\\n\\t\\tdirectionalLight = directionalLights[ i ];\\n\\t\\tshadow *= all( bvec2( directionalLight.shadow, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\\n\\t}\\n\\t#endif\\n\\t#if NUM_SPOT_LIGHT_SHADOWS > 0\\n\\tSpotLight spotLight;\\n\\t#pragma unroll_loop\\n\\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\\n\\t\\tspotLight = spotLights[ i ];\\n\\t\\tshadow *= all( bvec2( spotLight.shadow, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\\n\\t}\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\\tPointLight pointLight;\\n\\t#pragma unroll_loop\\n\\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\\n\\t\\tpointLight = pointLights[ i ];\\n\\t\\tshadow *= all( bvec2( pointLight.shadow, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\\n\\t}\\n\\t#endif\\n\\t#endif\\n\\treturn shadow;\\n}\";\n\nvar skinbase_vertex = \"#ifdef USE_SKINNING\\n\\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\\n\\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\\n\\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\\n\\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\\n#endif\";\n\nvar skinning_pars_vertex = \"#ifdef USE_SKINNING\\n\\tuniform mat4 bindMatrix;\\n\\tuniform mat4 bindMatrixInverse;\\n\\t#ifdef BONE_TEXTURE\\n\\t\\tuniform highp sampler2D boneTexture;\\n\\t\\tuniform int boneTextureSize;\\n\\t\\tmat4 getBoneMatrix( const in float i ) {\\n\\t\\t\\tfloat j = i * 4.0;\\n\\t\\t\\tfloat x = mod( j, float( boneTextureSize ) );\\n\\t\\t\\tfloat y = floor( j / float( boneTextureSize ) );\\n\\t\\t\\tfloat dx = 1.0 / float( boneTextureSize );\\n\\t\\t\\tfloat dy = 1.0 / float( boneTextureSize );\\n\\t\\t\\ty = dy * ( y + 0.5 );\\n\\t\\t\\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\\n\\t\\t\\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\\n\\t\\t\\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\\n\\t\\t\\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\\n\\t\\t\\tmat4 bone = mat4( v1, v2, v3, v4 );\\n\\t\\t\\treturn bone;\\n\\t\\t}\\n\\t#else\\n\\t\\tuniform mat4 boneMatrices[ MAX_BONES ];\\n\\t\\tmat4 getBoneMatrix( const in float i ) {\\n\\t\\t\\tmat4 bone = boneMatrices[ int(i) ];\\n\\t\\t\\treturn bone;\\n\\t\\t}\\n\\t#endif\\n#endif\";\n\nvar skinning_vertex = \"#ifdef USE_SKINNING\\n\\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\\n\\tvec4 skinned = vec4( 0.0 );\\n\\tskinned += boneMatX * skinVertex * skinWeight.x;\\n\\tskinned += boneMatY * skinVertex * skinWeight.y;\\n\\tskinned += boneMatZ * skinVertex * skinWeight.z;\\n\\tskinned += boneMatW * skinVertex * skinWeight.w;\\n\\ttransformed = ( bindMatrixInverse * skinned ).xyz;\\n#endif\";\n\nvar skinnormal_vertex = \"#ifdef USE_SKINNING\\n\\tmat4 skinMatrix = mat4( 0.0 );\\n\\tskinMatrix += skinWeight.x * boneMatX;\\n\\tskinMatrix += skinWeight.y * boneMatY;\\n\\tskinMatrix += skinWeight.z * boneMatZ;\\n\\tskinMatrix += skinWeight.w * boneMatW;\\n\\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\\n\\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\\n\\t#ifdef USE_TANGENT\\n\\t\\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\\n\\t#endif\\n#endif\";\n\nvar specularmap_fragment = \"float specularStrength;\\n#ifdef USE_SPECULARMAP\\n\\tvec4 texelSpecular = texture2D( specularMap, vUv );\\n\\tspecularStrength = texelSpecular.r;\\n#else\\n\\tspecularStrength = 1.0;\\n#endif\";\n\nvar specularmap_pars_fragment = \"#ifdef USE_SPECULARMAP\\n\\tuniform sampler2D specularMap;\\n#endif\";\n\nvar tonemapping_fragment = \"#if defined( TONE_MAPPING )\\n\\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\\n#endif\";\n\nvar tonemapping_pars_fragment = \"#ifndef saturate\\n#define saturate(a) clamp( a, 0.0, 1.0 )\\n#endif\\nuniform float toneMappingExposure;\\nuniform float toneMappingWhitePoint;\\nvec3 LinearToneMapping( vec3 color ) {\\n\\treturn toneMappingExposure * color;\\n}\\nvec3 ReinhardToneMapping( vec3 color ) {\\n\\tcolor *= toneMappingExposure;\\n\\treturn saturate( color / ( vec3( 1.0 ) + color ) );\\n}\\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\\nvec3 Uncharted2ToneMapping( vec3 color ) {\\n\\tcolor *= toneMappingExposure;\\n\\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\\n}\\nvec3 OptimizedCineonToneMapping( vec3 color ) {\\n\\tcolor *= toneMappingExposure;\\n\\tcolor = max( vec3( 0.0 ), color - 0.004 );\\n\\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\\n}\\nvec3 ACESFilmicToneMapping( vec3 color ) {\\n\\tcolor *= toneMappingExposure;\\n\\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\\n}\";\n\nvar uv_pars_fragment = \"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\\n\\tvarying vec2 vUv;\\n#endif\";\n\nvar uv_pars_vertex = \"#ifdef USE_UV\\n\\t#ifdef UVS_VERTEX_ONLY\\n\\t\\tvec2 vUv;\\n\\t#else\\n\\t\\tvarying vec2 vUv;\\n\\t#endif\\n\\tuniform mat3 uvTransform;\\n#endif\";\n\nvar uv_vertex = \"#ifdef USE_UV\\n\\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\\n#endif\";\n\nvar uv2_pars_fragment = \"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\\n\\tvarying vec2 vUv2;\\n#endif\";\n\nvar uv2_pars_vertex = \"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\\n\\tattribute vec2 uv2;\\n\\tvarying vec2 vUv2;\\n\\tuniform mat3 uv2Transform;\\n#endif\";\n\nvar uv2_vertex = \"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\\n\\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\\n#endif\";\n\nvar worldpos_vertex = \"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\\n\\tvec4 worldPosition = vec4( transformed, 1.0 );\\n\\t#ifdef USE_INSTANCING\\n\\t\\tworldPosition = instanceMatrix * worldPosition;\\n\\t#endif\\n\\tworldPosition = modelMatrix * worldPosition;\\n#endif\";\n\nvar background_frag = \"uniform sampler2D t2D;\\nvarying vec2 vUv;\\nvoid main() {\\n\\tvec4 texColor = texture2D( t2D, vUv );\\n\\tgl_FragColor = mapTexelToLinear( texColor );\\n\\t#include \\n\\t#include \\n}\";\n\nvar background_vert = \"varying vec2 vUv;\\nuniform mat3 uvTransform;\\nvoid main() {\\n\\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\\n\\tgl_Position = vec4( position.xy, 1.0, 1.0 );\\n}\";\n\nvar cube_frag = \"#include \\nuniform float opacity;\\nvarying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\tvec3 vReflect = vWorldDirection;\\n\\t#include \\n\\tgl_FragColor = envColor;\\n\\tgl_FragColor.a *= opacity;\\n\\t#include \\n\\t#include \\n}\";\n\nvar cube_vert = \"varying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\tvWorldDirection = transformDirection( position, modelMatrix );\\n\\t#include \\n\\t#include \\n\\tgl_Position.z = gl_Position.w;\\n}\";\n\nvar depth_frag = \"#if DEPTH_PACKING == 3200\\n\\tuniform float opacity;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec4 diffuseColor = vec4( 1.0 );\\n\\t#if DEPTH_PACKING == 3200\\n\\t\\tdiffuseColor.a = opacity;\\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#if DEPTH_PACKING == 3200\\n\\t\\tgl_FragColor = vec4( vec3( 1.0 - gl_FragCoord.z ), opacity );\\n\\t#elif DEPTH_PACKING == 3201\\n\\t\\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\\n\\t#endif\\n}\";\n\nvar depth_vert = \"#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#ifdef USE_DISPLACEMENTMAP\\n\\t\\t#include \\n\\t\\t#include \\n\\t\\t#include \\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nvar distanceRGBA_frag = \"#define DISTANCE\\nuniform vec3 referencePosition;\\nuniform float nearDistance;\\nuniform float farDistance;\\nvarying vec3 vWorldPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main () {\\n\\t#include \\n\\tvec4 diffuseColor = vec4( 1.0 );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\tfloat dist = length( vWorldPosition - referencePosition );\\n\\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\\n\\tdist = saturate( dist );\\n\\tgl_FragColor = packDepthToRGBA( dist );\\n}\";\n\nvar distanceRGBA_vert = \"#define DISTANCE\\nvarying vec3 vWorldPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#ifdef USE_DISPLACEMENTMAP\\n\\t\\t#include \\n\\t\\t#include \\n\\t\\t#include \\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvWorldPosition = worldPosition.xyz;\\n}\";\n\nvar equirect_frag = \"uniform sampler2D tEquirect;\\nvarying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\tvec3 direction = normalize( vWorldDirection );\\n\\tvec2 sampleUV;\\n\\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\\n\\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\\n\\tvec4 texColor = texture2D( tEquirect, sampleUV );\\n\\tgl_FragColor = mapTexelToLinear( texColor );\\n\\t#include \\n\\t#include \\n}\";\n\nvar equirect_vert = \"varying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\tvWorldDirection = transformDirection( position, modelMatrix );\\n\\t#include \\n\\t#include \\n}\";\n\nvar linedashed_frag = \"uniform vec3 diffuse;\\nuniform float opacity;\\nuniform float dashSize;\\nuniform float totalSize;\\nvarying float vLineDistance;\\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\\n\\t\\tdiscard;\\n\\t}\\n\\tvec3 outgoingLight = vec3( 0.0 );\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\t#include \\n\\toutgoingLight = diffuseColor.rgb;\\n\\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nvar linedashed_vert = \"uniform float scale;\\nattribute float lineDistance;\\nvarying float vLineDistance;\\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvLineDistance = scale * lineDistance;\\n\\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\\n\\tgl_Position = projectionMatrix * mvPosition;\\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nvar meshbasic_frag = \"uniform vec3 diffuse;\\nuniform float opacity;\\n#ifndef FLAT_SHADED\\n\\tvarying vec3 vNormal;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\t#ifdef USE_LIGHTMAP\\n\\t\\n\\t\\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\\n\\t\\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\\n\\t#else\\n\\t\\treflectedLight.indirectDiffuse += vec3( 1.0 );\\n\\t#endif\\n\\t#include \\n\\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\\n\\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\\n\\t#include \\n\\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nvar meshbasic_vert = \"#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#ifdef USE_ENVMAP\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nvar meshlambert_frag = \"uniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform float opacity;\\nvarying vec3 vLightFront;\\nvarying vec3 vIndirectFront;\\n#ifdef DOUBLE_SIDED\\n\\tvarying vec3 vLightBack;\\n\\tvarying vec3 vIndirectBack;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\tvec3 totalEmissiveRadiance = emissive;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\\n\\t#ifdef DOUBLE_SIDED\\n\\t\\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\\n\\t#else\\n\\t\\treflectedLight.indirectDiffuse += vIndirectFront;\\n\\t#endif\\n\\t#include \\n\\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\\n\\t#ifdef DOUBLE_SIDED\\n\\t\\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\\n\\t#else\\n\\t\\treflectedLight.directDiffuse = vLightFront;\\n\\t#endif\\n\\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\\n\\t#include \\n\\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\\n\\t#include \\n\\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nvar meshlambert_vert = \"#define LAMBERT\\nvarying vec3 vLightFront;\\nvarying vec3 vIndirectFront;\\n#ifdef DOUBLE_SIDED\\n\\tvarying vec3 vLightBack;\\n\\tvarying vec3 vIndirectBack;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nvar meshmatcap_frag = \"#define MATCAP\\nuniform vec3 diffuse;\\nuniform float opacity;\\nuniform sampler2D matcap;\\nvarying vec3 vViewPosition;\\n#ifndef FLAT_SHADED\\n\\tvarying vec3 vNormal;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvec3 viewDir = normalize( vViewPosition );\\n\\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\\n\\tvec3 y = cross( viewDir, x );\\n\\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\\n\\t#ifdef USE_MATCAP\\n\\t\\tvec4 matcapColor = texture2D( matcap, uv );\\n\\t\\tmatcapColor = matcapTexelToLinear( matcapColor );\\n\\t#else\\n\\t\\tvec4 matcapColor = vec4( 1.0 );\\n\\t#endif\\n\\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\\n\\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nvar meshmatcap_vert = \"#define MATCAP\\nvarying vec3 vViewPosition;\\n#ifndef FLAT_SHADED\\n\\tvarying vec3 vNormal;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#ifndef FLAT_SHADED\\n\\t\\tvNormal = normalize( transformedNormal );\\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n}\";\n\nvar meshtoon_frag = \"#define TOON\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform vec3 specular;\\nuniform float shininess;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\tvec3 totalEmissiveRadiance = emissive;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\\n\\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nvar meshtoon_vert = \"#define TOON\\nvarying vec3 vViewPosition;\\n#ifndef FLAT_SHADED\\n\\tvarying vec3 vNormal;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n#ifndef FLAT_SHADED\\n\\tvNormal = normalize( transformedNormal );\\n#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nvar meshphong_frag = \"#define PHONG\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform vec3 specular;\\nuniform float shininess;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\tvec3 totalEmissiveRadiance = emissive;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\\n\\t#include \\n\\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nvar meshphong_vert = \"#define PHONG\\nvarying vec3 vViewPosition;\\n#ifndef FLAT_SHADED\\n\\tvarying vec3 vNormal;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n#ifndef FLAT_SHADED\\n\\tvNormal = normalize( transformedNormal );\\n#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nvar meshphysical_frag = \"#define STANDARD\\n#ifdef PHYSICAL\\n\\t#define REFLECTIVITY\\n\\t#define CLEARCOAT\\n\\t#define TRANSPARENCY\\n#endif\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform float roughness;\\nuniform float metalness;\\nuniform float opacity;\\n#ifdef TRANSPARENCY\\n\\tuniform float transparency;\\n#endif\\n#ifdef REFLECTIVITY\\n\\tuniform float reflectivity;\\n#endif\\n#ifdef CLEARCOAT\\n\\tuniform float clearcoat;\\n\\tuniform float clearcoatRoughness;\\n#endif\\n#ifdef USE_SHEEN\\n\\tuniform vec3 sheen;\\n#endif\\nvarying vec3 vViewPosition;\\n#ifndef FLAT_SHADED\\n\\tvarying vec3 vNormal;\\n\\t#ifdef USE_TANGENT\\n\\t\\tvarying vec3 vTangent;\\n\\t\\tvarying vec3 vBitangent;\\n\\t#endif\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\tvec3 totalEmissiveRadiance = emissive;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\\n\\t#ifdef TRANSPARENCY\\n\\t\\tdiffuseColor.a *= saturate( 1. - transparency + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) );\\n\\t#endif\\n\\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nvar meshphysical_vert = \"#define STANDARD\\nvarying vec3 vViewPosition;\\n#ifndef FLAT_SHADED\\n\\tvarying vec3 vNormal;\\n\\t#ifdef USE_TANGENT\\n\\t\\tvarying vec3 vTangent;\\n\\t\\tvarying vec3 vBitangent;\\n\\t#endif\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n#ifndef FLAT_SHADED\\n\\tvNormal = normalize( transformedNormal );\\n\\t#ifdef USE_TANGENT\\n\\t\\tvTangent = normalize( transformedTangent );\\n\\t\\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\\n\\t#endif\\n#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nvar normal_frag = \"#define NORMAL\\nuniform float opacity;\\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\\n\\tvarying vec3 vViewPosition;\\n#endif\\n#ifndef FLAT_SHADED\\n\\tvarying vec3 vNormal;\\n\\t#ifdef USE_TANGENT\\n\\t\\tvarying vec3 vTangent;\\n\\t\\tvarying vec3 vBitangent;\\n\\t#endif\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\\n}\";\n\nvar normal_vert = \"#define NORMAL\\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\\n\\tvarying vec3 vViewPosition;\\n#endif\\n#ifndef FLAT_SHADED\\n\\tvarying vec3 vNormal;\\n\\t#ifdef USE_TANGENT\\n\\t\\tvarying vec3 vTangent;\\n\\t\\tvarying vec3 vBitangent;\\n\\t#endif\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n#ifndef FLAT_SHADED\\n\\tvNormal = normalize( transformedNormal );\\n\\t#ifdef USE_TANGENT\\n\\t\\tvTangent = normalize( transformedTangent );\\n\\t\\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\\n\\t#endif\\n#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\\n\\tvViewPosition = - mvPosition.xyz;\\n#endif\\n}\";\n\nvar points_frag = \"uniform vec3 diffuse;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec3 outgoingLight = vec3( 0.0 );\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\toutgoingLight = diffuseColor.rgb;\\n\\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nvar points_vert = \"uniform float size;\\nuniform float scale;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tgl_PointSize = size;\\n\\t#ifdef USE_SIZEATTENUATION\\n\\t\\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\\n\\t\\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nvar shadow_frag = \"uniform vec3 color;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nvar shadow_vert = \"#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nvar sprite_frag = \"uniform vec3 diffuse;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec3 outgoingLight = vec3( 0.0 );\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\toutgoingLight = diffuseColor.rgb;\\n\\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nvar sprite_vert = \"uniform float rotation;\\nuniform vec2 center;\\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\\n\\tvec2 scale;\\n\\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\\n\\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\\n\\t#ifndef USE_SIZEATTENUATION\\n\\t\\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\\n\\t\\tif ( isPerspective ) scale *= - mvPosition.z;\\n\\t#endif\\n\\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\\n\\tvec2 rotatedPosition;\\n\\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\\n\\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\\n\\tmvPosition.xy += rotatedPosition;\\n\\tgl_Position = projectionMatrix * mvPosition;\\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nvar ShaderChunk = {\n\talphamap_fragment: alphamap_fragment,\n\talphamap_pars_fragment: alphamap_pars_fragment,\n\talphatest_fragment: alphatest_fragment,\n\taomap_fragment: aomap_fragment,\n\taomap_pars_fragment: aomap_pars_fragment,\n\tbegin_vertex: begin_vertex,\n\tbeginnormal_vertex: beginnormal_vertex,\n\tbsdfs: bsdfs,\n\tbumpmap_pars_fragment: bumpmap_pars_fragment,\n\tclipping_planes_fragment: clipping_planes_fragment,\n\tclipping_planes_pars_fragment: clipping_planes_pars_fragment,\n\tclipping_planes_pars_vertex: clipping_planes_pars_vertex,\n\tclipping_planes_vertex: clipping_planes_vertex,\n\tcolor_fragment: color_fragment,\n\tcolor_pars_fragment: color_pars_fragment,\n\tcolor_pars_vertex: color_pars_vertex,\n\tcolor_vertex: color_vertex,\n\tcommon: common,\n\tcube_uv_reflection_fragment: cube_uv_reflection_fragment,\n\tdefaultnormal_vertex: defaultnormal_vertex,\n\tdisplacementmap_pars_vertex: displacementmap_pars_vertex,\n\tdisplacementmap_vertex: displacementmap_vertex,\n\temissivemap_fragment: emissivemap_fragment,\n\temissivemap_pars_fragment: emissivemap_pars_fragment,\n\tencodings_fragment: encodings_fragment,\n\tencodings_pars_fragment: encodings_pars_fragment,\n\tenvmap_fragment: envmap_fragment,\n\tenvmap_common_pars_fragment: envmap_common_pars_fragment,\n\tenvmap_pars_fragment: envmap_pars_fragment,\n\tenvmap_pars_vertex: envmap_pars_vertex,\n\tenvmap_physical_pars_fragment: envmap_physical_pars_fragment,\n\tenvmap_vertex: envmap_vertex,\n\tfog_vertex: fog_vertex,\n\tfog_pars_vertex: fog_pars_vertex,\n\tfog_fragment: fog_fragment,\n\tfog_pars_fragment: fog_pars_fragment,\n\tgradientmap_pars_fragment: gradientmap_pars_fragment,\n\tlightmap_fragment: lightmap_fragment,\n\tlightmap_pars_fragment: lightmap_pars_fragment,\n\tlights_lambert_vertex: lights_lambert_vertex,\n\tlights_pars_begin: lights_pars_begin,\n\tlights_toon_fragment: lights_toon_fragment,\n\tlights_toon_pars_fragment: lights_toon_pars_fragment,\n\tlights_phong_fragment: lights_phong_fragment,\n\tlights_phong_pars_fragment: lights_phong_pars_fragment,\n\tlights_physical_fragment: lights_physical_fragment,\n\tlights_physical_pars_fragment: lights_physical_pars_fragment,\n\tlights_fragment_begin: lights_fragment_begin,\n\tlights_fragment_maps: lights_fragment_maps,\n\tlights_fragment_end: lights_fragment_end,\n\tlogdepthbuf_fragment: logdepthbuf_fragment,\n\tlogdepthbuf_pars_fragment: logdepthbuf_pars_fragment,\n\tlogdepthbuf_pars_vertex: logdepthbuf_pars_vertex,\n\tlogdepthbuf_vertex: logdepthbuf_vertex,\n\tmap_fragment: map_fragment,\n\tmap_pars_fragment: map_pars_fragment,\n\tmap_particle_fragment: map_particle_fragment,\n\tmap_particle_pars_fragment: map_particle_pars_fragment,\n\tmetalnessmap_fragment: metalnessmap_fragment,\n\tmetalnessmap_pars_fragment: metalnessmap_pars_fragment,\n\tmorphnormal_vertex: morphnormal_vertex,\n\tmorphtarget_pars_vertex: morphtarget_pars_vertex,\n\tmorphtarget_vertex: morphtarget_vertex,\n\tnormal_fragment_begin: normal_fragment_begin,\n\tnormal_fragment_maps: normal_fragment_maps,\n\tnormalmap_pars_fragment: normalmap_pars_fragment,\n\tclearcoat_normal_fragment_begin: clearcoat_normal_fragment_begin,\n\tclearcoat_normal_fragment_maps: clearcoat_normal_fragment_maps,\n\tclearcoat_normalmap_pars_fragment: clearcoat_normalmap_pars_fragment,\n\tpacking: packing,\n\tpremultiplied_alpha_fragment: premultiplied_alpha_fragment,\n\tproject_vertex: project_vertex,\n\tdithering_fragment: dithering_fragment,\n\tdithering_pars_fragment: dithering_pars_fragment,\n\troughnessmap_fragment: roughnessmap_fragment,\n\troughnessmap_pars_fragment: roughnessmap_pars_fragment,\n\tshadowmap_pars_fragment: shadowmap_pars_fragment,\n\tshadowmap_pars_vertex: shadowmap_pars_vertex,\n\tshadowmap_vertex: shadowmap_vertex,\n\tshadowmask_pars_fragment: shadowmask_pars_fragment,\n\tskinbase_vertex: skinbase_vertex,\n\tskinning_pars_vertex: skinning_pars_vertex,\n\tskinning_vertex: skinning_vertex,\n\tskinnormal_vertex: skinnormal_vertex,\n\tspecularmap_fragment: specularmap_fragment,\n\tspecularmap_pars_fragment: specularmap_pars_fragment,\n\ttonemapping_fragment: tonemapping_fragment,\n\ttonemapping_pars_fragment: tonemapping_pars_fragment,\n\tuv_pars_fragment: uv_pars_fragment,\n\tuv_pars_vertex: uv_pars_vertex,\n\tuv_vertex: uv_vertex,\n\tuv2_pars_fragment: uv2_pars_fragment,\n\tuv2_pars_vertex: uv2_pars_vertex,\n\tuv2_vertex: uv2_vertex,\n\tworldpos_vertex: worldpos_vertex,\n\n\tbackground_frag: background_frag,\n\tbackground_vert: background_vert,\n\tcube_frag: cube_frag,\n\tcube_vert: cube_vert,\n\tdepth_frag: depth_frag,\n\tdepth_vert: depth_vert,\n\tdistanceRGBA_frag: distanceRGBA_frag,\n\tdistanceRGBA_vert: distanceRGBA_vert,\n\tequirect_frag: equirect_frag,\n\tequirect_vert: equirect_vert,\n\tlinedashed_frag: linedashed_frag,\n\tlinedashed_vert: linedashed_vert,\n\tmeshbasic_frag: meshbasic_frag,\n\tmeshbasic_vert: meshbasic_vert,\n\tmeshlambert_frag: meshlambert_frag,\n\tmeshlambert_vert: meshlambert_vert,\n\tmeshmatcap_frag: meshmatcap_frag,\n\tmeshmatcap_vert: meshmatcap_vert,\n\tmeshtoon_frag: meshtoon_frag,\n\tmeshtoon_vert: meshtoon_vert,\n\tmeshphong_frag: meshphong_frag,\n\tmeshphong_vert: meshphong_vert,\n\tmeshphysical_frag: meshphysical_frag,\n\tmeshphysical_vert: meshphysical_vert,\n\tnormal_frag: normal_frag,\n\tnormal_vert: normal_vert,\n\tpoints_frag: points_frag,\n\tpoints_vert: points_vert,\n\tshadow_frag: shadow_frag,\n\tshadow_vert: shadow_vert,\n\tsprite_frag: sprite_frag,\n\tsprite_vert: sprite_vert\n};\n\n/**\n * @author alteredq / http://alteredqualia.com/\n * @author mrdoob / http://mrdoob.com/\n * @author mikael emtinger / http://gomo.se/\n */\n\nvar ShaderLib = {\n\n\tbasic: {\n\n\t\tuniforms: mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.specularmap,\n\t\t\tUniformsLib.envmap,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.fog\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshbasic_vert,\n\t\tfragmentShader: ShaderChunk.meshbasic_frag\n\n\t},\n\n\tlambert: {\n\n\t\tuniforms: mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.specularmap,\n\t\t\tUniformsLib.envmap,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.emissivemap,\n\t\t\tUniformsLib.fog,\n\t\t\tUniformsLib.lights,\n\t\t\t{\n\t\t\t\temissive: { value: new Color( 0x000000 ) }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshlambert_vert,\n\t\tfragmentShader: ShaderChunk.meshlambert_frag\n\n\t},\n\n\tphong: {\n\n\t\tuniforms: mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.specularmap,\n\t\t\tUniformsLib.envmap,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.emissivemap,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.fog,\n\t\t\tUniformsLib.lights,\n\t\t\t{\n\t\t\t\temissive: { value: new Color( 0x000000 ) },\n\t\t\t\tspecular: { value: new Color( 0x111111 ) },\n\t\t\t\tshininess: { value: 30 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshphong_vert,\n\t\tfragmentShader: ShaderChunk.meshphong_frag\n\n\t},\n\n\tstandard: {\n\n\t\tuniforms: mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.envmap,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.emissivemap,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.roughnessmap,\n\t\t\tUniformsLib.metalnessmap,\n\t\t\tUniformsLib.fog,\n\t\t\tUniformsLib.lights,\n\t\t\t{\n\t\t\t\temissive: { value: new Color( 0x000000 ) },\n\t\t\t\troughness: { value: 0.5 },\n\t\t\t\tmetalness: { value: 0.5 },\n\t\t\t\tenvMapIntensity: { value: 1 } // temporary\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshphysical_vert,\n\t\tfragmentShader: ShaderChunk.meshphysical_frag\n\n\t},\n\n\ttoon: {\n\n\t\tuniforms: mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.specularmap,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.emissivemap,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.gradientmap,\n\t\t\tUniformsLib.fog,\n\t\t\tUniformsLib.lights,\n\t\t\t{\n\t\t\t\temissive: { value: new Color( 0x000000 ) },\n\t\t\t\tspecular: { value: new Color( 0x111111 ) },\n\t\t\t\tshininess: { value: 30 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshtoon_vert,\n\t\tfragmentShader: ShaderChunk.meshtoon_frag\n\n\t},\n\n\tmatcap: {\n\n\t\tuniforms: mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.fog,\n\t\t\t{\n\t\t\t\tmatcap: { value: null }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshmatcap_vert,\n\t\tfragmentShader: ShaderChunk.meshmatcap_frag\n\n\t},\n\n\tpoints: {\n\n\t\tuniforms: mergeUniforms( [\n\t\t\tUniformsLib.points,\n\t\t\tUniformsLib.fog\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.points_vert,\n\t\tfragmentShader: ShaderChunk.points_frag\n\n\t},\n\n\tdashed: {\n\n\t\tuniforms: mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.fog,\n\t\t\t{\n\t\t\t\tscale: { value: 1 },\n\t\t\t\tdashSize: { value: 1 },\n\t\t\t\ttotalSize: { value: 2 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.linedashed_vert,\n\t\tfragmentShader: ShaderChunk.linedashed_frag\n\n\t},\n\n\tdepth: {\n\n\t\tuniforms: mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.displacementmap\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.depth_vert,\n\t\tfragmentShader: ShaderChunk.depth_frag\n\n\t},\n\n\tnormal: {\n\n\t\tuniforms: mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\t{\n\t\t\t\topacity: { value: 1.0 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.normal_vert,\n\t\tfragmentShader: ShaderChunk.normal_frag\n\n\t},\n\n\tsprite: {\n\n\t\tuniforms: mergeUniforms( [\n\t\t\tUniformsLib.sprite,\n\t\t\tUniformsLib.fog\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.sprite_vert,\n\t\tfragmentShader: ShaderChunk.sprite_frag\n\n\t},\n\n\tbackground: {\n\n\t\tuniforms: {\n\t\t\tuvTransform: { value: new Matrix3() },\n\t\t\tt2D: { value: null },\n\t\t},\n\n\t\tvertexShader: ShaderChunk.background_vert,\n\t\tfragmentShader: ShaderChunk.background_frag\n\n\t},\n\t/* -------------------------------------------------------------------------\n\t//\tCube map shader\n\t ------------------------------------------------------------------------- */\n\n\tcube: {\n\n\t\tuniforms: mergeUniforms( [\n\t\t\tUniformsLib.envmap,\n\t\t\t{\n\t\t\t\topacity: { value: 1.0 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.cube_vert,\n\t\tfragmentShader: ShaderChunk.cube_frag\n\n\t},\n\n\tequirect: {\n\n\t\tuniforms: {\n\t\t\ttEquirect: { value: null },\n\t\t},\n\n\t\tvertexShader: ShaderChunk.equirect_vert,\n\t\tfragmentShader: ShaderChunk.equirect_frag\n\n\t},\n\n\tdistanceRGBA: {\n\n\t\tuniforms: mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.displacementmap,\n\t\t\t{\n\t\t\t\treferencePosition: { value: new Vector3() },\n\t\t\t\tnearDistance: { value: 1 },\n\t\t\t\tfarDistance: { value: 1000 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.distanceRGBA_vert,\n\t\tfragmentShader: ShaderChunk.distanceRGBA_frag\n\n\t},\n\n\tshadow: {\n\n\t\tuniforms: mergeUniforms( [\n\t\t\tUniformsLib.lights,\n\t\t\tUniformsLib.fog,\n\t\t\t{\n\t\t\t\tcolor: { value: new Color( 0x00000 ) },\n\t\t\t\topacity: { value: 1.0 }\n\t\t\t},\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.shadow_vert,\n\t\tfragmentShader: ShaderChunk.shadow_frag\n\n\t}\n\n};\n\nShaderLib.physical = {\n\n\tuniforms: mergeUniforms( [\n\t\tShaderLib.standard.uniforms,\n\t\t{\n\t\t\ttransparency: { value: 0 },\n\t\t\tclearcoat: { value: 0 },\n\t\t\tclearcoatRoughness: { value: 0 },\n\t\t\tsheen: { value: new Color( 0x000000 ) },\n\t\t\tclearcoatNormalScale: { value: new Vector2( 1, 1 ) },\n\t\t\tclearcoatNormalMap: { value: null },\n\t\t}\n\t] ),\n\n\tvertexShader: ShaderChunk.meshphysical_vert,\n\tfragmentShader: ShaderChunk.meshphysical_frag\n\n};\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction WebGLBackground( renderer, state, objects, premultipliedAlpha ) {\n\n\tvar clearColor = new Color( 0x000000 );\n\tvar clearAlpha = 0;\n\n\tvar planeMesh;\n\tvar boxMesh;\n\n\tvar currentBackground = null;\n\tvar currentBackgroundVersion = 0;\n\tvar currentTonemapping = null;\n\n\tfunction render( renderList, scene, camera, forceClear ) {\n\n\t\tvar background = scene.background;\n\n\t\t// Ignore background in AR\n\t\t// TODO: Reconsider this.\n\n\t\tvar xr = renderer.xr;\n\t\tvar session = xr.getSession && xr.getSession();\n\n\t\tif ( session && session.environmentBlendMode === 'additive' ) {\n\n\t\t\tbackground = null;\n\n\t\t}\n\n\t\tif ( background === null ) {\n\n\t\t\tsetClear( clearColor, clearAlpha );\n\n\t\t} else if ( background && background.isColor ) {\n\n\t\t\tsetClear( background, 1 );\n\t\t\tforceClear = true;\n\n\t\t}\n\n\t\tif ( renderer.autoClear || forceClear ) {\n\n\t\t\trenderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil );\n\n\t\t}\n\n\t\tif ( background && ( background.isCubeTexture || background.isWebGLCubeRenderTarget || background.mapping === CubeUVReflectionMapping ) ) {\n\n\t\t\tif ( boxMesh === undefined ) {\n\n\t\t\t\tboxMesh = new Mesh(\n\t\t\t\t\tnew BoxBufferGeometry( 1, 1, 1 ),\n\t\t\t\t\tnew ShaderMaterial( {\n\t\t\t\t\t\ttype: 'BackgroundCubeMaterial',\n\t\t\t\t\t\tuniforms: cloneUniforms( ShaderLib.cube.uniforms ),\n\t\t\t\t\t\tvertexShader: ShaderLib.cube.vertexShader,\n\t\t\t\t\t\tfragmentShader: ShaderLib.cube.fragmentShader,\n\t\t\t\t\t\tside: BackSide,\n\t\t\t\t\t\tdepthTest: false,\n\t\t\t\t\t\tdepthWrite: false,\n\t\t\t\t\t\tfog: false\n\t\t\t\t\t} )\n\t\t\t\t);\n\n\t\t\t\tboxMesh.geometry.deleteAttribute( 'normal' );\n\t\t\t\tboxMesh.geometry.deleteAttribute( 'uv' );\n\n\t\t\t\tboxMesh.onBeforeRender = function ( renderer, scene, camera ) {\n\n\t\t\t\t\tthis.matrixWorld.copyPosition( camera.matrixWorld );\n\n\t\t\t\t};\n\n\t\t\t\t// enable code injection for non-built-in material\n\t\t\t\tObject.defineProperty( boxMesh.material, 'envMap', {\n\n\t\t\t\t\tget: function () {\n\n\t\t\t\t\t\treturn this.uniforms.envMap.value;\n\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\n\t\t\t\tobjects.update( boxMesh );\n\n\t\t\t}\n\n\t\t\tvar texture = background.isWebGLCubeRenderTarget ? background.texture : background;\n\n\t\t\tboxMesh.material.uniforms.envMap.value = texture;\n\t\t\tboxMesh.material.uniforms.flipEnvMap.value = texture.isCubeTexture ? - 1 : 1;\n\n\t\t\tif ( currentBackground !== background ||\n\t\t\t\tcurrentBackgroundVersion !== texture.version ||\n\t\t\t\tcurrentTonemapping !== renderer.toneMapping ) {\n\n\t\t\t\tboxMesh.material.needsUpdate = true;\n\n\t\t\t\tcurrentBackground = background;\n\t\t\t\tcurrentBackgroundVersion = texture.version;\n\t\t\t\tcurrentTonemapping = renderer.toneMapping;\n\n\t\t\t}\n\n\t\t\t// push to the pre-sorted opaque render list\n\t\t\trenderList.unshift( boxMesh, boxMesh.geometry, boxMesh.material, 0, 0, null );\n\n\t\t} else if ( background && background.isTexture ) {\n\n\t\t\tif ( planeMesh === undefined ) {\n\n\t\t\t\tplaneMesh = new Mesh(\n\t\t\t\t\tnew PlaneBufferGeometry( 2, 2 ),\n\t\t\t\t\tnew ShaderMaterial( {\n\t\t\t\t\t\ttype: 'BackgroundMaterial',\n\t\t\t\t\t\tuniforms: cloneUniforms( ShaderLib.background.uniforms ),\n\t\t\t\t\t\tvertexShader: ShaderLib.background.vertexShader,\n\t\t\t\t\t\tfragmentShader: ShaderLib.background.fragmentShader,\n\t\t\t\t\t\tside: FrontSide,\n\t\t\t\t\t\tdepthTest: false,\n\t\t\t\t\t\tdepthWrite: false,\n\t\t\t\t\t\tfog: false\n\t\t\t\t\t} )\n\t\t\t\t);\n\n\t\t\t\tplaneMesh.geometry.deleteAttribute( 'normal' );\n\n\t\t\t\t// enable code injection for non-built-in material\n\t\t\t\tObject.defineProperty( planeMesh.material, 'map', {\n\n\t\t\t\t\tget: function () {\n\n\t\t\t\t\t\treturn this.uniforms.t2D.value;\n\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\n\t\t\t\tobjects.update( planeMesh );\n\n\t\t\t}\n\n\t\t\tplaneMesh.material.uniforms.t2D.value = background;\n\n\t\t\tif ( background.matrixAutoUpdate === true ) {\n\n\t\t\t\tbackground.updateMatrix();\n\n\t\t\t}\n\n\t\t\tplaneMesh.material.uniforms.uvTransform.value.copy( background.matrix );\n\n\t\t\tif ( currentBackground !== background ||\n\t\t\t\tcurrentBackgroundVersion !== background.version ||\n\t\t\t\tcurrentTonemapping !== renderer.toneMapping ) {\n\n\t\t\t\tplaneMesh.material.needsUpdate = true;\n\n\t\t\t\tcurrentBackground = background;\n\t\t\t\tcurrentBackgroundVersion = background.version;\n\t\t\t\tcurrentTonemapping = renderer.toneMapping;\n\n\t\t\t}\n\n\n\t\t\t// push to the pre-sorted opaque render list\n\t\t\trenderList.unshift( planeMesh, planeMesh.geometry, planeMesh.material, 0, 0, null );\n\n\t\t}\n\n\t}\n\n\tfunction setClear( color, alpha ) {\n\n\t\tstate.buffers.color.setClear( color.r, color.g, color.b, alpha, premultipliedAlpha );\n\n\t}\n\n\treturn {\n\n\t\tgetClearColor: function () {\n\n\t\t\treturn clearColor;\n\n\t\t},\n\t\tsetClearColor: function ( color, alpha ) {\n\n\t\t\tclearColor.set( color );\n\t\t\tclearAlpha = alpha !== undefined ? alpha : 1;\n\t\t\tsetClear( clearColor, clearAlpha );\n\n\t\t},\n\t\tgetClearAlpha: function () {\n\n\t\t\treturn clearAlpha;\n\n\t\t},\n\t\tsetClearAlpha: function ( alpha ) {\n\n\t\t\tclearAlpha = alpha;\n\t\t\tsetClear( clearColor, clearAlpha );\n\n\t\t},\n\t\trender: render\n\n\t};\n\n}\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction WebGLBufferRenderer( gl, extensions, info, capabilities ) {\n\n\tvar isWebGL2 = capabilities.isWebGL2;\n\n\tvar mode;\n\n\tfunction setMode( value ) {\n\n\t\tmode = value;\n\n\t}\n\n\tfunction render( start, count ) {\n\n\t\tgl.drawArrays( mode, start, count );\n\n\t\tinfo.update( count, mode );\n\n\t}\n\n\tfunction renderInstances( geometry, start, count, primcount ) {\n\n\t\tif ( primcount === 0 ) return;\n\n\t\tvar extension, methodName;\n\n\t\tif ( isWebGL2 ) {\n\n\t\t\textension = gl;\n\t\t\tmethodName = 'drawArraysInstanced';\n\n\t\t} else {\n\n\t\t\textension = extensions.get( 'ANGLE_instanced_arrays' );\n\t\t\tmethodName = 'drawArraysInstancedANGLE';\n\n\t\t\tif ( extension === null ) {\n\n\t\t\t\tconsole.error( 'THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t\textension[ methodName ]( mode, start, count, primcount );\n\n\t\tinfo.update( count, mode, primcount );\n\n\t}\n\n\t//\n\n\tthis.setMode = setMode;\n\tthis.render = render;\n\tthis.renderInstances = renderInstances;\n\n}\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction WebGLCapabilities( gl, extensions, parameters ) {\n\n\tvar maxAnisotropy;\n\n\tfunction getMaxAnisotropy() {\n\n\t\tif ( maxAnisotropy !== undefined ) return maxAnisotropy;\n\n\t\tvar extension = extensions.get( 'EXT_texture_filter_anisotropic' );\n\n\t\tif ( extension !== null ) {\n\n\t\t\tmaxAnisotropy = gl.getParameter( extension.MAX_TEXTURE_MAX_ANISOTROPY_EXT );\n\n\t\t} else {\n\n\t\t\tmaxAnisotropy = 0;\n\n\t\t}\n\n\t\treturn maxAnisotropy;\n\n\t}\n\n\tfunction getMaxPrecision( precision ) {\n\n\t\tif ( precision === 'highp' ) {\n\n\t\t\tif ( gl.getShaderPrecisionFormat( 35633, 36338 ).precision > 0 &&\n\t\t\t\tgl.getShaderPrecisionFormat( 35632, 36338 ).precision > 0 ) {\n\n\t\t\t\treturn 'highp';\n\n\t\t\t}\n\n\t\t\tprecision = 'mediump';\n\n\t\t}\n\n\t\tif ( precision === 'mediump' ) {\n\n\t\t\tif ( gl.getShaderPrecisionFormat( 35633, 36337 ).precision > 0 &&\n\t\t\t\tgl.getShaderPrecisionFormat( 35632, 36337 ).precision > 0 ) {\n\n\t\t\t\treturn 'mediump';\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn 'lowp';\n\n\t}\n\n\t/* eslint-disable no-undef */\n\tvar isWebGL2 = ( typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext ) ||\n\t\t( typeof WebGL2ComputeRenderingContext !== 'undefined' && gl instanceof WebGL2ComputeRenderingContext );\n\t/* eslint-enable no-undef */\n\n\tvar precision = parameters.precision !== undefined ? parameters.precision : 'highp';\n\tvar maxPrecision = getMaxPrecision( precision );\n\n\tif ( maxPrecision !== precision ) {\n\n\t\tconsole.warn( 'THREE.WebGLRenderer:', precision, 'not supported, using', maxPrecision, 'instead.' );\n\t\tprecision = maxPrecision;\n\n\t}\n\n\tvar logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;\n\n\tvar maxTextures = gl.getParameter( 34930 );\n\tvar maxVertexTextures = gl.getParameter( 35660 );\n\tvar maxTextureSize = gl.getParameter( 3379 );\n\tvar maxCubemapSize = gl.getParameter( 34076 );\n\n\tvar maxAttributes = gl.getParameter( 34921 );\n\tvar maxVertexUniforms = gl.getParameter( 36347 );\n\tvar maxVaryings = gl.getParameter( 36348 );\n\tvar maxFragmentUniforms = gl.getParameter( 36349 );\n\n\tvar vertexTextures = maxVertexTextures > 0;\n\tvar floatFragmentTextures = isWebGL2 || !! extensions.get( 'OES_texture_float' );\n\tvar floatVertexTextures = vertexTextures && floatFragmentTextures;\n\n\tvar maxSamples = isWebGL2 ? gl.getParameter( 36183 ) : 0;\n\n\treturn {\n\n\t\tisWebGL2: isWebGL2,\n\n\t\tgetMaxAnisotropy: getMaxAnisotropy,\n\t\tgetMaxPrecision: getMaxPrecision,\n\n\t\tprecision: precision,\n\t\tlogarithmicDepthBuffer: logarithmicDepthBuffer,\n\n\t\tmaxTextures: maxTextures,\n\t\tmaxVertexTextures: maxVertexTextures,\n\t\tmaxTextureSize: maxTextureSize,\n\t\tmaxCubemapSize: maxCubemapSize,\n\n\t\tmaxAttributes: maxAttributes,\n\t\tmaxVertexUniforms: maxVertexUniforms,\n\t\tmaxVaryings: maxVaryings,\n\t\tmaxFragmentUniforms: maxFragmentUniforms,\n\n\t\tvertexTextures: vertexTextures,\n\t\tfloatFragmentTextures: floatFragmentTextures,\n\t\tfloatVertexTextures: floatVertexTextures,\n\n\t\tmaxSamples: maxSamples\n\n\t};\n\n}\n\n/**\n * @author tschw\n */\n\nfunction WebGLClipping() {\n\n\tvar scope = this,\n\n\t\tglobalState = null,\n\t\tnumGlobalPlanes = 0,\n\t\tlocalClippingEnabled = false,\n\t\trenderingShadows = false,\n\n\t\tplane = new Plane(),\n\t\tviewNormalMatrix = new Matrix3(),\n\n\t\tuniform = { value: null, needsUpdate: false };\n\n\tthis.uniform = uniform;\n\tthis.numPlanes = 0;\n\tthis.numIntersection = 0;\n\n\tthis.init = function ( planes, enableLocalClipping, camera ) {\n\n\t\tvar enabled =\n\t\t\tplanes.length !== 0 ||\n\t\t\tenableLocalClipping ||\n\t\t\t// enable state of previous frame - the clipping code has to\n\t\t\t// run another frame in order to reset the state:\n\t\t\tnumGlobalPlanes !== 0 ||\n\t\t\tlocalClippingEnabled;\n\n\t\tlocalClippingEnabled = enableLocalClipping;\n\n\t\tglobalState = projectPlanes( planes, camera, 0 );\n\t\tnumGlobalPlanes = planes.length;\n\n\t\treturn enabled;\n\n\t};\n\n\tthis.beginShadows = function () {\n\n\t\trenderingShadows = true;\n\t\tprojectPlanes( null );\n\n\t};\n\n\tthis.endShadows = function () {\n\n\t\trenderingShadows = false;\n\t\tresetGlobalState();\n\n\t};\n\n\tthis.setState = function ( planes, clipIntersection, clipShadows, camera, cache, fromCache ) {\n\n\t\tif ( ! localClippingEnabled || planes === null || planes.length === 0 || renderingShadows && ! clipShadows ) {\n\n\t\t\t// there's no local clipping\n\n\t\t\tif ( renderingShadows ) {\n\n\t\t\t\t// there's no global clipping\n\n\t\t\t\tprojectPlanes( null );\n\n\t\t\t} else {\n\n\t\t\t\tresetGlobalState();\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tvar nGlobal = renderingShadows ? 0 : numGlobalPlanes,\n\t\t\t\tlGlobal = nGlobal * 4,\n\n\t\t\t\tdstArray = cache.clippingState || null;\n\n\t\t\tuniform.value = dstArray; // ensure unique state\n\n\t\t\tdstArray = projectPlanes( planes, camera, lGlobal, fromCache );\n\n\t\t\tfor ( var i = 0; i !== lGlobal; ++ i ) {\n\n\t\t\t\tdstArray[ i ] = globalState[ i ];\n\n\t\t\t}\n\n\t\t\tcache.clippingState = dstArray;\n\t\t\tthis.numIntersection = clipIntersection ? this.numPlanes : 0;\n\t\t\tthis.numPlanes += nGlobal;\n\n\t\t}\n\n\n\t};\n\n\tfunction resetGlobalState() {\n\n\t\tif ( uniform.value !== globalState ) {\n\n\t\t\tuniform.value = globalState;\n\t\t\tuniform.needsUpdate = numGlobalPlanes > 0;\n\n\t\t}\n\n\t\tscope.numPlanes = numGlobalPlanes;\n\t\tscope.numIntersection = 0;\n\n\t}\n\n\tfunction projectPlanes( planes, camera, dstOffset, skipTransform ) {\n\n\t\tvar nPlanes = planes !== null ? planes.length : 0,\n\t\t\tdstArray = null;\n\n\t\tif ( nPlanes !== 0 ) {\n\n\t\t\tdstArray = uniform.value;\n\n\t\t\tif ( skipTransform !== true || dstArray === null ) {\n\n\t\t\t\tvar flatSize = dstOffset + nPlanes * 4,\n\t\t\t\t\tviewMatrix = camera.matrixWorldInverse;\n\n\t\t\t\tviewNormalMatrix.getNormalMatrix( viewMatrix );\n\n\t\t\t\tif ( dstArray === null || dstArray.length < flatSize ) {\n\n\t\t\t\t\tdstArray = new Float32Array( flatSize );\n\n\t\t\t\t}\n\n\t\t\t\tfor ( var i = 0, i4 = dstOffset; i !== nPlanes; ++ i, i4 += 4 ) {\n\n\t\t\t\t\tplane.copy( planes[ i ] ).applyMatrix4( viewMatrix, viewNormalMatrix );\n\n\t\t\t\t\tplane.normal.toArray( dstArray, i4 );\n\t\t\t\t\tdstArray[ i4 + 3 ] = plane.constant;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tuniform.value = dstArray;\n\t\t\tuniform.needsUpdate = true;\n\n\t\t}\n\n\t\tscope.numPlanes = nPlanes;\n\n\t\treturn dstArray;\n\n\t}\n\n}\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction WebGLExtensions( gl ) {\n\n\tvar extensions = {};\n\n\treturn {\n\n\t\tget: function ( name ) {\n\n\t\t\tif ( extensions[ name ] !== undefined ) {\n\n\t\t\t\treturn extensions[ name ];\n\n\t\t\t}\n\n\t\t\tvar extension;\n\n\t\t\tswitch ( name ) {\n\n\t\t\t\tcase 'WEBGL_depth_texture':\n\t\t\t\t\textension = gl.getExtension( 'WEBGL_depth_texture' ) || gl.getExtension( 'MOZ_WEBGL_depth_texture' ) || gl.getExtension( 'WEBKIT_WEBGL_depth_texture' );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'EXT_texture_filter_anisotropic':\n\t\t\t\t\textension = gl.getExtension( 'EXT_texture_filter_anisotropic' ) || gl.getExtension( 'MOZ_EXT_texture_filter_anisotropic' ) || gl.getExtension( 'WEBKIT_EXT_texture_filter_anisotropic' );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'WEBGL_compressed_texture_s3tc':\n\t\t\t\t\textension = gl.getExtension( 'WEBGL_compressed_texture_s3tc' ) || gl.getExtension( 'MOZ_WEBGL_compressed_texture_s3tc' ) || gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_s3tc' );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'WEBGL_compressed_texture_pvrtc':\n\t\t\t\t\textension = gl.getExtension( 'WEBGL_compressed_texture_pvrtc' ) || gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_pvrtc' );\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\textension = gl.getExtension( name );\n\n\t\t\t}\n\n\t\t\tif ( extension === null ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: ' + name + ' extension not supported.' );\n\n\t\t\t}\n\n\t\t\textensions[ name ] = extension;\n\n\t\t\treturn extension;\n\n\t\t}\n\n\t};\n\n}\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction WebGLGeometries( gl, attributes, info ) {\n\n\tvar geometries = new WeakMap();\n\tvar wireframeAttributes = new WeakMap();\n\n\tfunction onGeometryDispose( event ) {\n\n\t\tvar geometry = event.target;\n\t\tvar buffergeometry = geometries.get( geometry );\n\n\t\tif ( buffergeometry.index !== null ) {\n\n\t\t\tattributes.remove( buffergeometry.index );\n\n\t\t}\n\n\t\tfor ( var name in buffergeometry.attributes ) {\n\n\t\t\tattributes.remove( buffergeometry.attributes[ name ] );\n\n\t\t}\n\n\t\tgeometry.removeEventListener( 'dispose', onGeometryDispose );\n\n\t\tgeometries.delete( geometry );\n\n\t\tvar attribute = wireframeAttributes.get( buffergeometry );\n\n\t\tif ( attribute ) {\n\n\t\t\tattributes.remove( attribute );\n\t\t\twireframeAttributes.delete( buffergeometry );\n\n\t\t}\n\n\t\t//\n\n\t\tinfo.memory.geometries --;\n\n\t}\n\n\tfunction get( object, geometry ) {\n\n\t\tvar buffergeometry = geometries.get( geometry );\n\n\t\tif ( buffergeometry ) return buffergeometry;\n\n\t\tgeometry.addEventListener( 'dispose', onGeometryDispose );\n\n\t\tif ( geometry.isBufferGeometry ) {\n\n\t\t\tbuffergeometry = geometry;\n\n\t\t} else if ( geometry.isGeometry ) {\n\n\t\t\tif ( geometry._bufferGeometry === undefined ) {\n\n\t\t\t\tgeometry._bufferGeometry = new BufferGeometry().setFromObject( object );\n\n\t\t\t}\n\n\t\t\tbuffergeometry = geometry._bufferGeometry;\n\n\t\t}\n\n\t\tgeometries.set( geometry, buffergeometry );\n\n\t\tinfo.memory.geometries ++;\n\n\t\treturn buffergeometry;\n\n\t}\n\n\tfunction update( geometry ) {\n\n\t\tvar index = geometry.index;\n\t\tvar geometryAttributes = geometry.attributes;\n\n\t\tif ( index !== null ) {\n\n\t\t\tattributes.update( index, 34963 );\n\n\t\t}\n\n\t\tfor ( var name in geometryAttributes ) {\n\n\t\t\tattributes.update( geometryAttributes[ name ], 34962 );\n\n\t\t}\n\n\t\t// morph targets\n\n\t\tvar morphAttributes = geometry.morphAttributes;\n\n\t\tfor ( var name in morphAttributes ) {\n\n\t\t\tvar array = morphAttributes[ name ];\n\n\t\t\tfor ( var i = 0, l = array.length; i < l; i ++ ) {\n\n\t\t\t\tattributes.update( array[ i ], 34962 );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction updateWireframeAttribute( geometry ) {\n\n\t\tvar indices = [];\n\n\t\tvar geometryIndex = geometry.index;\n\t\tvar geometryPosition = geometry.attributes.position;\n\t\tvar version = 0;\n\n\t\tif ( geometryIndex !== null ) {\n\n\t\t\tvar array = geometryIndex.array;\n\t\t\tversion = geometryIndex.version;\n\n\t\t\tfor ( var i = 0, l = array.length; i < l; i += 3 ) {\n\n\t\t\t\tvar a = array[ i + 0 ];\n\t\t\t\tvar b = array[ i + 1 ];\n\t\t\t\tvar c = array[ i + 2 ];\n\n\t\t\t\tindices.push( a, b, b, c, c, a );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tvar array = geometryPosition.array;\n\t\t\tversion = geometryPosition.version;\n\n\t\t\tfor ( var i = 0, l = ( array.length / 3 ) - 1; i < l; i += 3 ) {\n\n\t\t\t\tvar a = i + 0;\n\t\t\t\tvar b = i + 1;\n\t\t\t\tvar c = i + 2;\n\n\t\t\t\tindices.push( a, b, b, c, c, a );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvar attribute = new ( arrayMax( indices ) > 65535 ? Uint32BufferAttribute : Uint16BufferAttribute )( indices, 1 );\n\t\tattribute.version = version;\n\n\t\tattributes.update( attribute, 34963 );\n\n\t\t//\n\n\t\tvar previousAttribute = wireframeAttributes.get( geometry );\n\n\t\tif ( previousAttribute ) attributes.remove( previousAttribute );\n\n\t\t//\n\n\t\twireframeAttributes.set( geometry, attribute );\n\n\t}\n\n\tfunction getWireframeAttribute( geometry ) {\n\n\t\tvar currentAttribute = wireframeAttributes.get( geometry );\n\n\t\tif ( currentAttribute ) {\n\n\t\t\tvar geometryIndex = geometry.index;\n\n\t\t\tif ( geometryIndex !== null ) {\n\n\t\t\t\t// if the attribute is obsolete, create a new one\n\n\t\t\t\tif ( currentAttribute.version < geometryIndex.version ) {\n\n\t\t\t\t\tupdateWireframeAttribute( geometry );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tupdateWireframeAttribute( geometry );\n\n\t\t}\n\n\t\treturn wireframeAttributes.get( geometry );\n\n\t}\n\n\treturn {\n\n\t\tget: get,\n\t\tupdate: update,\n\n\t\tgetWireframeAttribute: getWireframeAttribute\n\n\t};\n\n}\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction WebGLIndexedBufferRenderer( gl, extensions, info, capabilities ) {\n\n\tvar isWebGL2 = capabilities.isWebGL2;\n\n\tvar mode;\n\n\tfunction setMode( value ) {\n\n\t\tmode = value;\n\n\t}\n\n\tvar type, bytesPerElement;\n\n\tfunction setIndex( value ) {\n\n\t\ttype = value.type;\n\t\tbytesPerElement = value.bytesPerElement;\n\n\t}\n\n\tfunction render( start, count ) {\n\n\t\tgl.drawElements( mode, count, type, start * bytesPerElement );\n\n\t\tinfo.update( count, mode );\n\n\t}\n\n\tfunction renderInstances( geometry, start, count, primcount ) {\n\n\t\tif ( primcount === 0 ) return;\n\n\t\tvar extension, methodName;\n\n\t\tif ( isWebGL2 ) {\n\n\t\t\textension = gl;\n\t\t\tmethodName = 'drawElementsInstanced';\n\n\t\t} else {\n\n\t\t\textension = extensions.get( 'ANGLE_instanced_arrays' );\n\t\t\tmethodName = 'drawElementsInstancedANGLE';\n\n\t\t\tif ( extension === null ) {\n\n\t\t\t\tconsole.error( 'THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t\textension[ methodName ]( mode, count, type, start * bytesPerElement, primcount );\n\n\t\tinfo.update( count, mode, primcount );\n\n\t}\n\n\t//\n\n\tthis.setMode = setMode;\n\tthis.setIndex = setIndex;\n\tthis.render = render;\n\tthis.renderInstances = renderInstances;\n\n}\n\n/**\n * @author Mugen87 / https://github.com/Mugen87\n */\n\nfunction WebGLInfo( gl ) {\n\n\tvar memory = {\n\t\tgeometries: 0,\n\t\ttextures: 0\n\t};\n\n\tvar render = {\n\t\tframe: 0,\n\t\tcalls: 0,\n\t\ttriangles: 0,\n\t\tpoints: 0,\n\t\tlines: 0\n\t};\n\n\tfunction update( count, mode, instanceCount ) {\n\n\t\tinstanceCount = instanceCount || 1;\n\n\t\trender.calls ++;\n\n\t\tswitch ( mode ) {\n\n\t\t\tcase 4:\n\t\t\t\trender.triangles += instanceCount * ( count / 3 );\n\t\t\t\tbreak;\n\n\t\t\tcase 1:\n\t\t\t\trender.lines += instanceCount * ( count / 2 );\n\t\t\t\tbreak;\n\n\t\t\tcase 3:\n\t\t\t\trender.lines += instanceCount * ( count - 1 );\n\t\t\t\tbreak;\n\n\t\t\tcase 2:\n\t\t\t\trender.lines += instanceCount * count;\n\t\t\t\tbreak;\n\n\t\t\tcase 0:\n\t\t\t\trender.points += instanceCount * count;\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tconsole.error( 'THREE.WebGLInfo: Unknown draw mode:', mode );\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\tfunction reset() {\n\n\t\trender.frame ++;\n\t\trender.calls = 0;\n\t\trender.triangles = 0;\n\t\trender.points = 0;\n\t\trender.lines = 0;\n\n\t}\n\n\treturn {\n\t\tmemory: memory,\n\t\trender: render,\n\t\tprograms: null,\n\t\tautoReset: true,\n\t\treset: reset,\n\t\tupdate: update\n\t};\n\n}\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction absNumericalSort( a, b ) {\n\n\treturn Math.abs( b[ 1 ] ) - Math.abs( a[ 1 ] );\n\n}\n\nfunction WebGLMorphtargets( gl ) {\n\n\tvar influencesList = {};\n\tvar morphInfluences = new Float32Array( 8 );\n\n\tfunction update( object, geometry, material, program ) {\n\n\t\tvar objectInfluences = object.morphTargetInfluences;\n\n\t\t// When object doesn't have morph target influences defined, we treat it as a 0-length array\n\t\t// This is important to make sure we set up morphTargetBaseInfluence / morphTargetInfluences\n\n\t\tvar length = objectInfluences === undefined ? 0 : objectInfluences.length;\n\n\t\tvar influences = influencesList[ geometry.id ];\n\n\t\tif ( influences === undefined ) {\n\n\t\t\t// initialise list\n\n\t\t\tinfluences = [];\n\n\t\t\tfor ( var i = 0; i < length; i ++ ) {\n\n\t\t\t\tinfluences[ i ] = [ i, 0 ];\n\n\t\t\t}\n\n\t\t\tinfluencesList[ geometry.id ] = influences;\n\n\t\t}\n\n\t\tvar morphTargets = material.morphTargets && geometry.morphAttributes.position;\n\t\tvar morphNormals = material.morphNormals && geometry.morphAttributes.normal;\n\n\t\t// Remove current morphAttributes\n\n\t\tfor ( var i = 0; i < length; i ++ ) {\n\n\t\t\tvar influence = influences[ i ];\n\n\t\t\tif ( influence[ 1 ] !== 0 ) {\n\n\t\t\t\tif ( morphTargets ) geometry.deleteAttribute( 'morphTarget' + i );\n\t\t\t\tif ( morphNormals ) geometry.deleteAttribute( 'morphNormal' + i );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Collect influences\n\n\t\tfor ( var i = 0; i < length; i ++ ) {\n\n\t\t\tvar influence = influences[ i ];\n\n\t\t\tinfluence[ 0 ] = i;\n\t\t\tinfluence[ 1 ] = objectInfluences[ i ];\n\n\t\t}\n\n\t\tinfluences.sort( absNumericalSort );\n\n\t\t// Add morphAttributes\n\n\t\tvar morphInfluencesSum = 0;\n\n\t\tfor ( var i = 0; i < 8; i ++ ) {\n\n\t\t\tvar influence = influences[ i ];\n\n\t\t\tif ( influence ) {\n\n\t\t\t\tvar index = influence[ 0 ];\n\t\t\t\tvar value = influence[ 1 ];\n\n\t\t\t\tif ( value ) {\n\n\t\t\t\t\tif ( morphTargets ) geometry.setAttribute( 'morphTarget' + i, morphTargets[ index ] );\n\t\t\t\t\tif ( morphNormals ) geometry.setAttribute( 'morphNormal' + i, morphNormals[ index ] );\n\n\t\t\t\t\tmorphInfluences[ i ] = value;\n\t\t\t\t\tmorphInfluencesSum += value;\n\t\t\t\t\tcontinue;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tmorphInfluences[ i ] = 0;\n\n\t\t}\n\n\t\t// GLSL shader uses formula baseinfluence * base + sum(target * influence)\n\t\t// This allows us to switch between absolute morphs and relative morphs without changing shader code\n\t\t// When baseinfluence = 1 - sum(influence), the above is equivalent to sum((target - base) * influence)\n\t\tvar morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;\n\n\t\tprogram.getUniforms().setValue( gl, 'morphTargetBaseInfluence', morphBaseInfluence );\n\t\tprogram.getUniforms().setValue( gl, 'morphTargetInfluences', morphInfluences );\n\n\t}\n\n\treturn {\n\n\t\tupdate: update\n\n\t};\n\n}\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction WebGLObjects( gl, geometries, attributes, info ) {\n\n\tvar updateList = {};\n\n\tfunction update( object ) {\n\n\t\tvar frame = info.render.frame;\n\n\t\tvar geometry = object.geometry;\n\t\tvar buffergeometry = geometries.get( object, geometry );\n\n\t\t// Update once per frame\n\n\t\tif ( updateList[ buffergeometry.id ] !== frame ) {\n\n\t\t\tif ( geometry.isGeometry ) {\n\n\t\t\t\tbuffergeometry.updateFromObject( object );\n\n\t\t\t}\n\n\t\t\tgeometries.update( buffergeometry );\n\n\t\t\tupdateList[ buffergeometry.id ] = frame;\n\n\t\t}\n\n\t\tif ( object.isInstancedMesh ) {\n\n\t\t\tattributes.update( object.instanceMatrix, 34962 );\n\n\t\t}\n\n\t\treturn buffergeometry;\n\n\t}\n\n\tfunction dispose() {\n\n\t\tupdateList = {};\n\n\t}\n\n\treturn {\n\n\t\tupdate: update,\n\t\tdispose: dispose\n\n\t};\n\n}\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction CubeTexture( images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding ) {\n\n\timages = images !== undefined ? images : [];\n\tmapping = mapping !== undefined ? mapping : CubeReflectionMapping;\n\tformat = format !== undefined ? format : RGBFormat;\n\n\tTexture.call( this, images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding );\n\n\tthis.flipY = false;\n\n}\n\nCubeTexture.prototype = Object.create( Texture.prototype );\nCubeTexture.prototype.constructor = CubeTexture;\n\nCubeTexture.prototype.isCubeTexture = true;\n\nObject.defineProperty( CubeTexture.prototype, 'images', {\n\n\tget: function () {\n\n\t\treturn this.image;\n\n\t},\n\n\tset: function ( value ) {\n\n\t\tthis.image = value;\n\n\t}\n\n} );\n\n/**\n * @author Takahiro https://github.com/takahirox\n */\n\nfunction DataTexture2DArray( data, width, height, depth ) {\n\n\tTexture.call( this, null );\n\n\tthis.image = { data: data || null, width: width || 1, height: height || 1, depth: depth || 1 };\n\n\tthis.magFilter = NearestFilter;\n\tthis.minFilter = NearestFilter;\n\n\tthis.wrapR = ClampToEdgeWrapping;\n\n\tthis.generateMipmaps = false;\n\tthis.flipY = false;\n\n\tthis.needsUpdate = true;\n\n}\n\nDataTexture2DArray.prototype = Object.create( Texture.prototype );\nDataTexture2DArray.prototype.constructor = DataTexture2DArray;\nDataTexture2DArray.prototype.isDataTexture2DArray = true;\n\n/**\n * @author Artur Trzesiok\n */\n\nfunction DataTexture3D( data, width, height, depth ) {\n\n\t// We're going to add .setXXX() methods for setting properties later.\n\t// Users can still set in DataTexture3D directly.\n\t//\n\t//\tvar texture = new THREE.DataTexture3D( data, width, height, depth );\n\t// \ttexture.anisotropy = 16;\n\t//\n\t// See #14839\n\n\tTexture.call( this, null );\n\n\tthis.image = { data: data || null, width: width || 1, height: height || 1, depth: depth || 1 };\n\n\tthis.magFilter = NearestFilter;\n\tthis.minFilter = NearestFilter;\n\n\tthis.wrapR = ClampToEdgeWrapping;\n\n\tthis.generateMipmaps = false;\n\tthis.flipY = false;\n\n\tthis.needsUpdate = true;\n\n\n}\n\nDataTexture3D.prototype = Object.create( Texture.prototype );\nDataTexture3D.prototype.constructor = DataTexture3D;\nDataTexture3D.prototype.isDataTexture3D = true;\n\n/**\n * @author tschw\n * @author Mugen87 / https://github.com/Mugen87\n * @author mrdoob / http://mrdoob.com/\n *\n * Uniforms of a program.\n * Those form a tree structure with a special top-level container for the root,\n * which you get by calling 'new WebGLUniforms( gl, program )'.\n *\n *\n * Properties of inner nodes including the top-level container:\n *\n * .seq - array of nested uniforms\n * .map - nested uniforms by name\n *\n *\n * Methods of all nodes except the top-level container:\n *\n * .setValue( gl, value, [textures] )\n *\n * \t\tuploads a uniform value(s)\n * \tthe 'textures' parameter is needed for sampler uniforms\n *\n *\n * Static methods of the top-level container (textures factorizations):\n *\n * .upload( gl, seq, values, textures )\n *\n * \t\tsets uniforms in 'seq' to 'values[id].value'\n *\n * .seqWithValue( seq, values ) : filteredSeq\n *\n * \t\tfilters 'seq' entries with corresponding entry in values\n *\n *\n * Methods of the top-level container (textures factorizations):\n *\n * .setValue( gl, name, value, textures )\n *\n * \t\tsets uniform with name 'name' to 'value'\n *\n * .setOptional( gl, obj, prop )\n *\n * \t\tlike .set for an optional property of the object\n *\n */\n\nvar emptyTexture = new Texture();\nvar emptyTexture2dArray = new DataTexture2DArray();\nvar emptyTexture3d = new DataTexture3D();\nvar emptyCubeTexture = new CubeTexture();\n\n// --- Utilities ---\n\n// Array Caches (provide typed arrays for temporary by size)\n\nvar arrayCacheF32 = [];\nvar arrayCacheI32 = [];\n\n// Float32Array caches used for uploading Matrix uniforms\n\nvar mat4array = new Float32Array( 16 );\nvar mat3array = new Float32Array( 9 );\nvar mat2array = new Float32Array( 4 );\n\n// Flattening for arrays of vectors and matrices\n\nfunction flatten( array, nBlocks, blockSize ) {\n\n\tvar firstElem = array[ 0 ];\n\n\tif ( firstElem <= 0 || firstElem > 0 ) return array;\n\t// unoptimized: ! isNaN( firstElem )\n\t// see http://jacksondunstan.com/articles/983\n\n\tvar n = nBlocks * blockSize,\n\t\tr = arrayCacheF32[ n ];\n\n\tif ( r === undefined ) {\n\n\t\tr = new Float32Array( n );\n\t\tarrayCacheF32[ n ] = r;\n\n\t}\n\n\tif ( nBlocks !== 0 ) {\n\n\t\tfirstElem.toArray( r, 0 );\n\n\t\tfor ( var i = 1, offset = 0; i !== nBlocks; ++ i ) {\n\n\t\t\toffset += blockSize;\n\t\t\tarray[ i ].toArray( r, offset );\n\n\t\t}\n\n\t}\n\n\treturn r;\n\n}\n\nfunction arraysEqual( a, b ) {\n\n\tif ( a.length !== b.length ) return false;\n\n\tfor ( var i = 0, l = a.length; i < l; i ++ ) {\n\n\t\tif ( a[ i ] !== b[ i ] ) return false;\n\n\t}\n\n\treturn true;\n\n}\n\nfunction copyArray( a, b ) {\n\n\tfor ( var i = 0, l = b.length; i < l; i ++ ) {\n\n\t\ta[ i ] = b[ i ];\n\n\t}\n\n}\n\n// Texture unit allocation\n\nfunction allocTexUnits( textures, n ) {\n\n\tvar r = arrayCacheI32[ n ];\n\n\tif ( r === undefined ) {\n\n\t\tr = new Int32Array( n );\n\t\tarrayCacheI32[ n ] = r;\n\n\t}\n\n\tfor ( var i = 0; i !== n; ++ i )\n\t\tr[ i ] = textures.allocateTextureUnit();\n\n\treturn r;\n\n}\n\n// --- Setters ---\n\n// Note: Defining these methods externally, because they come in a bunch\n// and this way their names minify.\n\n// Single scalar\n\nfunction setValueV1f( gl, v ) {\n\n\tvar cache = this.cache;\n\n\tif ( cache[ 0 ] === v ) return;\n\n\tgl.uniform1f( this.addr, v );\n\n\tcache[ 0 ] = v;\n\n}\n\n// Single float vector (from flat array or THREE.VectorN)\n\nfunction setValueV2f( gl, v ) {\n\n\tvar cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y ) {\n\n\t\t\tgl.uniform2f( this.addr, v.x, v.y );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform2fv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV3f( gl, v ) {\n\n\tvar cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z ) {\n\n\t\t\tgl.uniform3f( this.addr, v.x, v.y, v.z );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\n\t\t}\n\n\t} else if ( v.r !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.r || cache[ 1 ] !== v.g || cache[ 2 ] !== v.b ) {\n\n\t\t\tgl.uniform3f( this.addr, v.r, v.g, v.b );\n\n\t\t\tcache[ 0 ] = v.r;\n\t\t\tcache[ 1 ] = v.g;\n\t\t\tcache[ 2 ] = v.b;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform3fv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV4f( gl, v ) {\n\n\tvar cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z || cache[ 3 ] !== v.w ) {\n\n\t\t\tgl.uniform4f( this.addr, v.x, v.y, v.z, v.w );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\t\t\tcache[ 3 ] = v.w;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform4fv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\n// Single matrix (from flat array or MatrixN)\n\nfunction setValueM2( gl, v ) {\n\n\tvar cache = this.cache;\n\tvar elements = v.elements;\n\n\tif ( elements === undefined ) {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniformMatrix2fv( this.addr, false, v );\n\n\t\tcopyArray( cache, v );\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, elements ) ) return;\n\n\t\tmat2array.set( elements );\n\n\t\tgl.uniformMatrix2fv( this.addr, false, mat2array );\n\n\t\tcopyArray( cache, elements );\n\n\t}\n\n}\n\nfunction setValueM3( gl, v ) {\n\n\tvar cache = this.cache;\n\tvar elements = v.elements;\n\n\tif ( elements === undefined ) {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniformMatrix3fv( this.addr, false, v );\n\n\t\tcopyArray( cache, v );\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, elements ) ) return;\n\n\t\tmat3array.set( elements );\n\n\t\tgl.uniformMatrix3fv( this.addr, false, mat3array );\n\n\t\tcopyArray( cache, elements );\n\n\t}\n\n}\n\nfunction setValueM4( gl, v ) {\n\n\tvar cache = this.cache;\n\tvar elements = v.elements;\n\n\tif ( elements === undefined ) {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniformMatrix4fv( this.addr, false, v );\n\n\t\tcopyArray( cache, v );\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, elements ) ) return;\n\n\t\tmat4array.set( elements );\n\n\t\tgl.uniformMatrix4fv( this.addr, false, mat4array );\n\n\t\tcopyArray( cache, elements );\n\n\t}\n\n}\n\n// Single texture (2D / Cube)\n\nfunction setValueT1( gl, v, textures ) {\n\n\tvar cache = this.cache;\n\tvar unit = textures.allocateTextureUnit();\n\n\tif ( cache[ 0 ] !== unit ) {\n\n\t\tgl.uniform1i( this.addr, unit );\n\t\tcache[ 0 ] = unit;\n\n\t}\n\n\ttextures.safeSetTexture2D( v || emptyTexture, unit );\n\n}\n\nfunction setValueT2DArray1( gl, v, textures ) {\n\n\tvar cache = this.cache;\n\tvar unit = textures.allocateTextureUnit();\n\n\tif ( cache[ 0 ] !== unit ) {\n\n\t\tgl.uniform1i( this.addr, unit );\n\t\tcache[ 0 ] = unit;\n\n\t}\n\n\ttextures.setTexture2DArray( v || emptyTexture2dArray, unit );\n\n}\n\nfunction setValueT3D1( gl, v, textures ) {\n\n\tvar cache = this.cache;\n\tvar unit = textures.allocateTextureUnit();\n\n\tif ( cache[ 0 ] !== unit ) {\n\n\t\tgl.uniform1i( this.addr, unit );\n\t\tcache[ 0 ] = unit;\n\n\t}\n\n\ttextures.setTexture3D( v || emptyTexture3d, unit );\n\n}\n\nfunction setValueT6( gl, v, textures ) {\n\n\tvar cache = this.cache;\n\tvar unit = textures.allocateTextureUnit();\n\n\tif ( cache[ 0 ] !== unit ) {\n\n\t\tgl.uniform1i( this.addr, unit );\n\t\tcache[ 0 ] = unit;\n\n\t}\n\n\ttextures.safeSetTextureCube( v || emptyCubeTexture, unit );\n\n}\n\n// Integer / Boolean vectors or arrays thereof (always flat arrays)\n\nfunction setValueV1i( gl, v ) {\n\n\tvar cache = this.cache;\n\n\tif ( cache[ 0 ] === v ) return;\n\n\tgl.uniform1i( this.addr, v );\n\n\tcache[ 0 ] = v;\n\n}\n\nfunction setValueV2i( gl, v ) {\n\n\tvar cache = this.cache;\n\n\tif ( arraysEqual( cache, v ) ) return;\n\n\tgl.uniform2iv( this.addr, v );\n\n\tcopyArray( cache, v );\n\n}\n\nfunction setValueV3i( gl, v ) {\n\n\tvar cache = this.cache;\n\n\tif ( arraysEqual( cache, v ) ) return;\n\n\tgl.uniform3iv( this.addr, v );\n\n\tcopyArray( cache, v );\n\n}\n\nfunction setValueV4i( gl, v ) {\n\n\tvar cache = this.cache;\n\n\tif ( arraysEqual( cache, v ) ) return;\n\n\tgl.uniform4iv( this.addr, v );\n\n\tcopyArray( cache, v );\n\n}\n\n// uint\n\nfunction setValueV1ui( gl, v ) {\n\n\tvar cache = this.cache;\n\n\tif ( cache[ 0 ] === v ) return;\n\n\tgl.uniform1ui( this.addr, v );\n\n\tcache[ 0 ] = v;\n\n}\n\n// Helper to pick the right setter for the singular case\n\nfunction getSingularSetter( type ) {\n\n\tswitch ( type ) {\n\n\t\tcase 0x1406: return setValueV1f; // FLOAT\n\t\tcase 0x8b50: return setValueV2f; // _VEC2\n\t\tcase 0x8b51: return setValueV3f; // _VEC3\n\t\tcase 0x8b52: return setValueV4f; // _VEC4\n\n\t\tcase 0x8b5a: return setValueM2; // _MAT2\n\t\tcase 0x8b5b: return setValueM3; // _MAT3\n\t\tcase 0x8b5c: return setValueM4; // _MAT4\n\n\t\tcase 0x1404: case 0x8b56: return setValueV1i; // INT, BOOL\n\t\tcase 0x8b53: case 0x8b57: return setValueV2i; // _VEC2\n\t\tcase 0x8b54: case 0x8b58: return setValueV3i; // _VEC3\n\t\tcase 0x8b55: case 0x8b59: return setValueV4i; // _VEC4\n\n\t\tcase 0x1405: return setValueV1ui; // UINT\n\n\t\tcase 0x8b5e: // SAMPLER_2D\n\t\tcase 0x8d66: // SAMPLER_EXTERNAL_OES\n\t\tcase 0x8dca: // INT_SAMPLER_2D\n\t\tcase 0x8dd2: // UNSIGNED_INT_SAMPLER_2D\n\t\tcase 0x8b62: // SAMPLER_2D_SHADOW\n\t\t\treturn setValueT1;\n\n\t\tcase 0x8b5f: // SAMPLER_3D\n\t\tcase 0x8dcb: // INT_SAMPLER_3D\n\t\tcase 0x8dd3: // UNSIGNED_INT_SAMPLER_3D\n\t\t\treturn setValueT3D1;\n\n\t\tcase 0x8b60: // SAMPLER_CUBE\n\t\tcase 0x8dcc: // INT_SAMPLER_CUBE\n\t\tcase 0x8dd4: // UNSIGNED_INT_SAMPLER_CUBE\n\t\tcase 0x8dc5: // SAMPLER_CUBE_SHADOW\n\t\t\treturn setValueT6;\n\n\t\tcase 0x8dc1: // SAMPLER_2D_ARRAY\n\t\tcase 0x8dcf: // INT_SAMPLER_2D_ARRAY\n\t\tcase 0x8dd7: // UNSIGNED_INT_SAMPLER_2D_ARRAY\n\t\tcase 0x8dc4: // SAMPLER_2D_ARRAY_SHADOW\n\t\t\treturn setValueT2DArray1;\n\n\t}\n\n}\n\n// Array of scalars\nfunction setValueV1fArray( gl, v ) {\n\n\tgl.uniform1fv( this.addr, v );\n\n}\n\n// Integer / Boolean vectors or arrays thereof (always flat arrays)\nfunction setValueV1iArray( gl, v ) {\n\n\tgl.uniform1iv( this.addr, v );\n\n}\n\nfunction setValueV2iArray( gl, v ) {\n\n\tgl.uniform2iv( this.addr, v );\n\n}\n\nfunction setValueV3iArray( gl, v ) {\n\n\tgl.uniform3iv( this.addr, v );\n\n}\n\nfunction setValueV4iArray( gl, v ) {\n\n\tgl.uniform4iv( this.addr, v );\n\n}\n\n\n// Array of vectors (flat or from THREE classes)\n\nfunction setValueV2fArray( gl, v ) {\n\n\tvar data = flatten( v, this.size, 2 );\n\n\tgl.uniform2fv( this.addr, data );\n\n}\n\nfunction setValueV3fArray( gl, v ) {\n\n\tvar data = flatten( v, this.size, 3 );\n\n\tgl.uniform3fv( this.addr, data );\n\n}\n\nfunction setValueV4fArray( gl, v ) {\n\n\tvar data = flatten( v, this.size, 4 );\n\n\tgl.uniform4fv( this.addr, data );\n\n}\n\n// Array of matrices (flat or from THREE clases)\n\nfunction setValueM2Array( gl, v ) {\n\n\tvar data = flatten( v, this.size, 4 );\n\n\tgl.uniformMatrix2fv( this.addr, false, data );\n\n}\n\nfunction setValueM3Array( gl, v ) {\n\n\tvar data = flatten( v, this.size, 9 );\n\n\tgl.uniformMatrix3fv( this.addr, false, data );\n\n}\n\nfunction setValueM4Array( gl, v ) {\n\n\tvar data = flatten( v, this.size, 16 );\n\n\tgl.uniformMatrix4fv( this.addr, false, data );\n\n}\n\n// Array of textures (2D / Cube)\n\nfunction setValueT1Array( gl, v, textures ) {\n\n\tvar n = v.length;\n\n\tvar units = allocTexUnits( textures, n );\n\n\tgl.uniform1iv( this.addr, units );\n\n\tfor ( var i = 0; i !== n; ++ i ) {\n\n\t\ttextures.safeSetTexture2D( v[ i ] || emptyTexture, units[ i ] );\n\n\t}\n\n}\n\nfunction setValueT6Array( gl, v, textures ) {\n\n\tvar n = v.length;\n\n\tvar units = allocTexUnits( textures, n );\n\n\tgl.uniform1iv( this.addr, units );\n\n\tfor ( var i = 0; i !== n; ++ i ) {\n\n\t\ttextures.safeSetTextureCube( v[ i ] || emptyCubeTexture, units[ i ] );\n\n\t}\n\n}\n\n// Helper to pick the right setter for a pure (bottom-level) array\n\nfunction getPureArraySetter( type ) {\n\n\tswitch ( type ) {\n\n\t\tcase 0x1406: return setValueV1fArray; // FLOAT\n\t\tcase 0x8b50: return setValueV2fArray; // _VEC2\n\t\tcase 0x8b51: return setValueV3fArray; // _VEC3\n\t\tcase 0x8b52: return setValueV4fArray; // _VEC4\n\n\t\tcase 0x8b5a: return setValueM2Array; // _MAT2\n\t\tcase 0x8b5b: return setValueM3Array; // _MAT3\n\t\tcase 0x8b5c: return setValueM4Array; // _MAT4\n\n\t\tcase 0x1404: case 0x8b56: return setValueV1iArray; // INT, BOOL\n\t\tcase 0x8b53: case 0x8b57: return setValueV2iArray; // _VEC2\n\t\tcase 0x8b54: case 0x8b58: return setValueV3iArray; // _VEC3\n\t\tcase 0x8b55: case 0x8b59: return setValueV4iArray; // _VEC4\n\n\t\tcase 0x8b5e: // SAMPLER_2D\n\t\tcase 0x8d66: // SAMPLER_EXTERNAL_OES\n\t\tcase 0x8dca: // INT_SAMPLER_2D\n\t\tcase 0x8dd2: // UNSIGNED_INT_SAMPLER_2D\n\t\tcase 0x8b62: // SAMPLER_2D_SHADOW\n\t\t\treturn setValueT1Array;\n\n\t\tcase 0x8b60: // SAMPLER_CUBE\n\t\tcase 0x8dcc: // INT_SAMPLER_CUBE\n\t\tcase 0x8dd4: // UNSIGNED_INT_SAMPLER_CUBE\n\t\tcase 0x8dc5: // SAMPLER_CUBE_SHADOW\n\t\t\treturn setValueT6Array;\n\n\t}\n\n}\n\n// --- Uniform Classes ---\n\nfunction SingleUniform( id, activeInfo, addr ) {\n\n\tthis.id = id;\n\tthis.addr = addr;\n\tthis.cache = [];\n\tthis.setValue = getSingularSetter( activeInfo.type );\n\n\t// this.path = activeInfo.name; // DEBUG\n\n}\n\nfunction PureArrayUniform( id, activeInfo, addr ) {\n\n\tthis.id = id;\n\tthis.addr = addr;\n\tthis.cache = [];\n\tthis.size = activeInfo.size;\n\tthis.setValue = getPureArraySetter( activeInfo.type );\n\n\t// this.path = activeInfo.name; // DEBUG\n\n}\n\nPureArrayUniform.prototype.updateCache = function ( data ) {\n\n\tvar cache = this.cache;\n\n\tif ( data instanceof Float32Array && cache.length !== data.length ) {\n\n\t\tthis.cache = new Float32Array( data.length );\n\n\t}\n\n\tcopyArray( cache, data );\n\n};\n\nfunction StructuredUniform( id ) {\n\n\tthis.id = id;\n\n\tthis.seq = [];\n\tthis.map = {};\n\n}\n\nStructuredUniform.prototype.setValue = function ( gl, value, textures ) {\n\n\tvar seq = this.seq;\n\n\tfor ( var i = 0, n = seq.length; i !== n; ++ i ) {\n\n\t\tvar u = seq[ i ];\n\t\tu.setValue( gl, value[ u.id ], textures );\n\n\t}\n\n};\n\n// --- Top-level ---\n\n// Parser - builds up the property tree from the path strings\n\nvar RePathPart = /([\\w\\d_]+)(\\])?(\\[|\\.)?/g;\n\n// extracts\n// \t- the identifier (member name or array index)\n// - followed by an optional right bracket (found when array index)\n// - followed by an optional left bracket or dot (type of subscript)\n//\n// Note: These portions can be read in a non-overlapping fashion and\n// allow straightforward parsing of the hierarchy that WebGL encodes\n// in the uniform names.\n\nfunction addUniform( container, uniformObject ) {\n\n\tcontainer.seq.push( uniformObject );\n\tcontainer.map[ uniformObject.id ] = uniformObject;\n\n}\n\nfunction parseUniform( activeInfo, addr, container ) {\n\n\tvar path = activeInfo.name,\n\t\tpathLength = path.length;\n\n\t// reset RegExp object, because of the early exit of a previous run\n\tRePathPart.lastIndex = 0;\n\n\twhile ( true ) {\n\n\t\tvar match = RePathPart.exec( path ),\n\t\t\tmatchEnd = RePathPart.lastIndex,\n\n\t\t\tid = match[ 1 ],\n\t\t\tidIsIndex = match[ 2 ] === ']',\n\t\t\tsubscript = match[ 3 ];\n\n\t\tif ( idIsIndex ) id = id | 0; // convert to integer\n\n\t\tif ( subscript === undefined || subscript === '[' && matchEnd + 2 === pathLength ) {\n\n\t\t\t// bare name or \"pure\" bottom-level array \"[0]\" suffix\n\n\t\t\taddUniform( container, subscript === undefined ?\n\t\t\t\tnew SingleUniform( id, activeInfo, addr ) :\n\t\t\t\tnew PureArrayUniform( id, activeInfo, addr ) );\n\n\t\t\tbreak;\n\n\t\t} else {\n\n\t\t\t// step into inner node / create it in case it doesn't exist\n\n\t\t\tvar map = container.map, next = map[ id ];\n\n\t\t\tif ( next === undefined ) {\n\n\t\t\t\tnext = new StructuredUniform( id );\n\t\t\t\taddUniform( container, next );\n\n\t\t\t}\n\n\t\t\tcontainer = next;\n\n\t\t}\n\n\t}\n\n}\n\n// Root Container\n\nfunction WebGLUniforms( gl, program ) {\n\n\tthis.seq = [];\n\tthis.map = {};\n\n\tvar n = gl.getProgramParameter( program, 35718 );\n\n\tfor ( var i = 0; i < n; ++ i ) {\n\n\t\tvar info = gl.getActiveUniform( program, i ),\n\t\t\taddr = gl.getUniformLocation( program, info.name );\n\n\t\tparseUniform( info, addr, this );\n\n\t}\n\n}\n\nWebGLUniforms.prototype.setValue = function ( gl, name, value, textures ) {\n\n\tvar u = this.map[ name ];\n\n\tif ( u !== undefined ) u.setValue( gl, value, textures );\n\n};\n\nWebGLUniforms.prototype.setOptional = function ( gl, object, name ) {\n\n\tvar v = object[ name ];\n\n\tif ( v !== undefined ) this.setValue( gl, name, v );\n\n};\n\n\n// Static interface\n\nWebGLUniforms.upload = function ( gl, seq, values, textures ) {\n\n\tfor ( var i = 0, n = seq.length; i !== n; ++ i ) {\n\n\t\tvar u = seq[ i ],\n\t\t\tv = values[ u.id ];\n\n\t\tif ( v.needsUpdate !== false ) {\n\n\t\t\t// note: always updating when .needsUpdate is undefined\n\t\t\tu.setValue( gl, v.value, textures );\n\n\t\t}\n\n\t}\n\n};\n\nWebGLUniforms.seqWithValue = function ( seq, values ) {\n\n\tvar r = [];\n\n\tfor ( var i = 0, n = seq.length; i !== n; ++ i ) {\n\n\t\tvar u = seq[ i ];\n\t\tif ( u.id in values ) r.push( u );\n\n\t}\n\n\treturn r;\n\n};\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction WebGLShader( gl, type, string ) {\n\n\tvar shader = gl.createShader( type );\n\n\tgl.shaderSource( shader, string );\n\tgl.compileShader( shader );\n\n\treturn shader;\n\n}\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nvar programIdCount = 0;\n\nfunction addLineNumbers( string ) {\n\n\tvar lines = string.split( '\\n' );\n\n\tfor ( var i = 0; i < lines.length; i ++ ) {\n\n\t\tlines[ i ] = ( i + 1 ) + ': ' + lines[ i ];\n\n\t}\n\n\treturn lines.join( '\\n' );\n\n}\n\nfunction getEncodingComponents( encoding ) {\n\n\tswitch ( encoding ) {\n\n\t\tcase LinearEncoding:\n\t\t\treturn [ 'Linear', '( value )' ];\n\t\tcase sRGBEncoding:\n\t\t\treturn [ 'sRGB', '( value )' ];\n\t\tcase RGBEEncoding:\n\t\t\treturn [ 'RGBE', '( value )' ];\n\t\tcase RGBM7Encoding:\n\t\t\treturn [ 'RGBM', '( value, 7.0 )' ];\n\t\tcase RGBM16Encoding:\n\t\t\treturn [ 'RGBM', '( value, 16.0 )' ];\n\t\tcase RGBDEncoding:\n\t\t\treturn [ 'RGBD', '( value, 256.0 )' ];\n\t\tcase GammaEncoding:\n\t\t\treturn [ 'Gamma', '( value, float( GAMMA_FACTOR ) )' ];\n\t\tcase LogLuvEncoding:\n\t\t\treturn [ 'LogLuv', '( value )' ];\n\t\tdefault:\n\t\t\tthrow new Error( 'unsupported encoding: ' + encoding );\n\n\t}\n\n}\n\nfunction getShaderErrors( gl, shader, type ) {\n\n\tvar status = gl.getShaderParameter( shader, 35713 );\n\tvar log = gl.getShaderInfoLog( shader ).trim();\n\n\tif ( status && log === '' ) return '';\n\n\t// --enable-privileged-webgl-extension\n\t// console.log( '**' + type + '**', gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( shader ) );\n\n\tvar source = gl.getShaderSource( shader );\n\n\treturn 'THREE.WebGLShader: gl.getShaderInfoLog() ' + type + '\\n' + log + addLineNumbers( source );\n\n}\n\nfunction getTexelDecodingFunction( functionName, encoding ) {\n\n\tvar components = getEncodingComponents( encoding );\n\treturn 'vec4 ' + functionName + '( vec4 value ) { return ' + components[ 0 ] + 'ToLinear' + components[ 1 ] + '; }';\n\n}\n\nfunction getTexelEncodingFunction( functionName, encoding ) {\n\n\tvar components = getEncodingComponents( encoding );\n\treturn 'vec4 ' + functionName + '( vec4 value ) { return LinearTo' + components[ 0 ] + components[ 1 ] + '; }';\n\n}\n\nfunction getToneMappingFunction( functionName, toneMapping ) {\n\n\tvar toneMappingName;\n\n\tswitch ( toneMapping ) {\n\n\t\tcase LinearToneMapping:\n\t\t\ttoneMappingName = 'Linear';\n\t\t\tbreak;\n\n\t\tcase ReinhardToneMapping:\n\t\t\ttoneMappingName = 'Reinhard';\n\t\t\tbreak;\n\n\t\tcase Uncharted2ToneMapping:\n\t\t\ttoneMappingName = 'Uncharted2';\n\t\t\tbreak;\n\n\t\tcase CineonToneMapping:\n\t\t\ttoneMappingName = 'OptimizedCineon';\n\t\t\tbreak;\n\n\t\tcase ACESFilmicToneMapping:\n\t\t\ttoneMappingName = 'ACESFilmic';\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tthrow new Error( 'unsupported toneMapping: ' + toneMapping );\n\n\t}\n\n\treturn 'vec3 ' + functionName + '( vec3 color ) { return ' + toneMappingName + 'ToneMapping( color ); }';\n\n}\n\nfunction generateExtensions( parameters ) {\n\n\tvar chunks = [\n\t\t( parameters.extensionDerivatives || parameters.envMapCubeUV || parameters.bumpMap || parameters.tangentSpaceNormalMap || parameters.clearcoatNormalMap || parameters.flatShading || parameters.shaderID === 'physical' ) ? '#extension GL_OES_standard_derivatives : enable' : '',\n\t\t( parameters.extensionFragDepth || parameters.logarithmicDepthBuffer ) && parameters.rendererExtensionFragDepth ? '#extension GL_EXT_frag_depth : enable' : '',\n\t\t( parameters.extensionDrawBuffers && parameters.rendererExtensionDrawBuffers ) ? '#extension GL_EXT_draw_buffers : require' : '',\n\t\t( parameters.extensionShaderTextureLOD || parameters.envMap ) && parameters.rendererExtensionShaderTextureLod ? '#extension GL_EXT_shader_texture_lod : enable' : ''\n\t];\n\n\treturn chunks.filter( filterEmptyLine ).join( '\\n' );\n\n}\n\nfunction generateDefines( defines ) {\n\n\tvar chunks = [];\n\n\tfor ( var name in defines ) {\n\n\t\tvar value = defines[ name ];\n\n\t\tif ( value === false ) continue;\n\n\t\tchunks.push( '#define ' + name + ' ' + value );\n\n\t}\n\n\treturn chunks.join( '\\n' );\n\n}\n\nfunction fetchAttributeLocations( gl, program ) {\n\n\tvar attributes = {};\n\n\tvar n = gl.getProgramParameter( program, 35721 );\n\n\tfor ( var i = 0; i < n; i ++ ) {\n\n\t\tvar info = gl.getActiveAttrib( program, i );\n\t\tvar name = info.name;\n\n\t\t// console.log( 'THREE.WebGLProgram: ACTIVE VERTEX ATTRIBUTE:', name, i );\n\n\t\tattributes[ name ] = gl.getAttribLocation( program, name );\n\n\t}\n\n\treturn attributes;\n\n}\n\nfunction filterEmptyLine( string ) {\n\n\treturn string !== '';\n\n}\n\nfunction replaceLightNums( string, parameters ) {\n\n\treturn string\n\t\t.replace( /NUM_DIR_LIGHTS/g, parameters.numDirLights )\n\t\t.replace( /NUM_SPOT_LIGHTS/g, parameters.numSpotLights )\n\t\t.replace( /NUM_RECT_AREA_LIGHTS/g, parameters.numRectAreaLights )\n\t\t.replace( /NUM_POINT_LIGHTS/g, parameters.numPointLights )\n\t\t.replace( /NUM_HEMI_LIGHTS/g, parameters.numHemiLights )\n\t\t.replace( /NUM_DIR_LIGHT_SHADOWS/g, parameters.numDirLightShadows )\n\t\t.replace( /NUM_SPOT_LIGHT_SHADOWS/g, parameters.numSpotLightShadows )\n\t\t.replace( /NUM_POINT_LIGHT_SHADOWS/g, parameters.numPointLightShadows );\n\n}\n\nfunction replaceClippingPlaneNums( string, parameters ) {\n\n\treturn string\n\t\t.replace( /NUM_CLIPPING_PLANES/g, parameters.numClippingPlanes )\n\t\t.replace( /UNION_CLIPPING_PLANES/g, ( parameters.numClippingPlanes - parameters.numClipIntersection ) );\n\n}\n\n// Resolve Includes\n\nvar includePattern = /^[ \\t]*#include +<([\\w\\d./]+)>/gm;\n\nfunction resolveIncludes( string ) {\n\n\treturn string.replace( includePattern, includeReplacer );\n\n}\n\nfunction includeReplacer( match, include ) {\n\n\tvar string = ShaderChunk[ include ];\n\n\tif ( string === undefined ) {\n\n\t\tthrow new Error( 'Can not resolve #include <' + include + '>' );\n\n\t}\n\n\treturn resolveIncludes( string );\n\n}\n\n// Unroll Loops\n\nvar loopPattern = /#pragma unroll_loop[\\s]+?for \\( int i \\= (\\d+)\\; i < (\\d+)\\; i \\+\\+ \\) \\{([\\s\\S]+?)(?=\\})\\}/g;\n\nfunction unrollLoops( string ) {\n\n\treturn string.replace( loopPattern, loopReplacer );\n\n}\n\nfunction loopReplacer( match, start, end, snippet ) {\n\n\tvar string = '';\n\n\tfor ( var i = parseInt( start ); i < parseInt( end ); i ++ ) {\n\n\t\tstring += snippet\n\t\t\t.replace( /\\[ i \\]/g, '[ ' + i + ' ]' )\n\t\t\t.replace( /UNROLLED_LOOP_INDEX/g, i );\n\n\t}\n\n\treturn string;\n\n}\n\n//\n\nfunction generatePrecision( parameters ) {\n\n\tvar precisionstring = \"precision \" + parameters.precision + \" float;\\nprecision \" + parameters.precision + \" int;\";\n\n\tif ( parameters.precision === \"highp\" ) {\n\n\t\tprecisionstring += \"\\n#define HIGH_PRECISION\";\n\n\t} else if ( parameters.precision === \"mediump\" ) {\n\n\t\tprecisionstring += \"\\n#define MEDIUM_PRECISION\";\n\n\t} else if ( parameters.precision === \"lowp\" ) {\n\n\t\tprecisionstring += \"\\n#define LOW_PRECISION\";\n\n\t}\n\n\treturn precisionstring;\n\n}\n\nfunction generateShadowMapTypeDefine( parameters ) {\n\n\tvar shadowMapTypeDefine = 'SHADOWMAP_TYPE_BASIC';\n\n\tif ( parameters.shadowMapType === PCFShadowMap ) {\n\n\t\tshadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF';\n\n\t} else if ( parameters.shadowMapType === PCFSoftShadowMap ) {\n\n\t\tshadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF_SOFT';\n\n\t} else if ( parameters.shadowMapType === VSMShadowMap ) {\n\n\t\tshadowMapTypeDefine = 'SHADOWMAP_TYPE_VSM';\n\n\t}\n\n\treturn shadowMapTypeDefine;\n\n}\n\nfunction generateEnvMapTypeDefine( parameters ) {\n\n\tvar envMapTypeDefine = 'ENVMAP_TYPE_CUBE';\n\n\tif ( parameters.envMap ) {\n\n\t\tswitch ( parameters.envMapMode ) {\n\n\t\t\tcase CubeReflectionMapping:\n\t\t\tcase CubeRefractionMapping:\n\t\t\t\tenvMapTypeDefine = 'ENVMAP_TYPE_CUBE';\n\t\t\t\tbreak;\n\n\t\t\tcase CubeUVReflectionMapping:\n\t\t\tcase CubeUVRefractionMapping:\n\t\t\t\tenvMapTypeDefine = 'ENVMAP_TYPE_CUBE_UV';\n\t\t\t\tbreak;\n\n\t\t\tcase EquirectangularReflectionMapping:\n\t\t\tcase EquirectangularRefractionMapping:\n\t\t\t\tenvMapTypeDefine = 'ENVMAP_TYPE_EQUIREC';\n\t\t\t\tbreak;\n\n\t\t\tcase SphericalReflectionMapping:\n\t\t\t\tenvMapTypeDefine = 'ENVMAP_TYPE_SPHERE';\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\treturn envMapTypeDefine;\n\n}\n\nfunction generateEnvMapModeDefine( parameters ) {\n\n\tvar envMapModeDefine = 'ENVMAP_MODE_REFLECTION';\n\n\tif ( parameters.envMap ) {\n\n\t\tswitch ( parameters.envMapMode ) {\n\n\t\t\tcase CubeRefractionMapping:\n\t\t\tcase EquirectangularRefractionMapping:\n\t\t\t\tenvMapModeDefine = 'ENVMAP_MODE_REFRACTION';\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\treturn envMapModeDefine;\n\n}\n\nfunction generateEnvMapBlendingDefine( parameters ) {\n\n\tvar envMapBlendingDefine = 'ENVMAP_BLENDING_NONE';\n\n\tif ( parameters.envMap ) {\n\n\t\tswitch ( parameters.combine ) {\n\n\t\t\tcase MultiplyOperation:\n\t\t\t\tenvMapBlendingDefine = 'ENVMAP_BLENDING_MULTIPLY';\n\t\t\t\tbreak;\n\n\t\t\tcase MixOperation:\n\t\t\t\tenvMapBlendingDefine = 'ENVMAP_BLENDING_MIX';\n\t\t\t\tbreak;\n\n\t\t\tcase AddOperation:\n\t\t\t\tenvMapBlendingDefine = 'ENVMAP_BLENDING_ADD';\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\treturn envMapBlendingDefine;\n\n}\n\nfunction WebGLProgram( renderer, cacheKey, parameters ) {\n\n\tvar gl = renderer.getContext();\n\n\tvar defines = parameters.defines;\n\n\tvar vertexShader = parameters.vertexShader;\n\tvar fragmentShader = parameters.fragmentShader;\n\tvar shadowMapTypeDefine = generateShadowMapTypeDefine( parameters );\n\tvar envMapTypeDefine = generateEnvMapTypeDefine( parameters );\n\tvar envMapModeDefine = generateEnvMapModeDefine( parameters );\n\tvar envMapBlendingDefine = generateEnvMapBlendingDefine( parameters );\n\n\n\tvar gammaFactorDefine = ( renderer.gammaFactor > 0 ) ? renderer.gammaFactor : 1.0;\n\n\tvar customExtensions = parameters.isWebGL2 ? '' : generateExtensions( parameters );\n\n\tvar customDefines = generateDefines( defines );\n\n\tvar program = gl.createProgram();\n\n\tvar prefixVertex, prefixFragment;\n\n\tvar numMultiviewViews = parameters.numMultiviewViews;\n\n\tif ( parameters.isRawShaderMaterial ) {\n\n\t\tprefixVertex = [\n\n\t\t\tcustomDefines\n\n\t\t].filter( filterEmptyLine ).join( '\\n' );\n\n\t\tif ( prefixVertex.length > 0 ) {\n\n\t\t\tprefixVertex += '\\n';\n\n\t\t}\n\n\t\tprefixFragment = [\n\n\t\t\tcustomExtensions,\n\t\t\tcustomDefines\n\n\t\t].filter( filterEmptyLine ).join( '\\n' );\n\n\t\tif ( prefixFragment.length > 0 ) {\n\n\t\t\tprefixFragment += '\\n';\n\n\t\t}\n\n\t} else {\n\n\t\tprefixVertex = [\n\n\t\t\tgeneratePrecision( parameters ),\n\n\t\t\t'#define SHADER_NAME ' + parameters.shaderName,\n\n\t\t\tcustomDefines,\n\n\t\t\tparameters.instancing ? '#define USE_INSTANCING' : '',\n\t\t\tparameters.supportsVertexTextures ? '#define VERTEX_TEXTURES' : '',\n\n\t\t\t'#define GAMMA_FACTOR ' + gammaFactorDefine,\n\n\t\t\t'#define MAX_BONES ' + parameters.maxBones,\n\t\t\t( parameters.useFog && parameters.fog ) ? '#define USE_FOG' : '',\n\t\t\t( parameters.useFog && parameters.fogExp2 ) ? '#define FOG_EXP2' : '',\n\n\t\t\tparameters.map ? '#define USE_MAP' : '',\n\t\t\tparameters.envMap ? '#define USE_ENVMAP' : '',\n\t\t\tparameters.envMap ? '#define ' + envMapModeDefine : '',\n\t\t\tparameters.lightMap ? '#define USE_LIGHTMAP' : '',\n\t\t\tparameters.aoMap ? '#define USE_AOMAP' : '',\n\t\t\tparameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',\n\t\t\tparameters.bumpMap ? '#define USE_BUMPMAP' : '',\n\t\t\tparameters.normalMap ? '#define USE_NORMALMAP' : '',\n\t\t\t( parameters.normalMap && parameters.objectSpaceNormalMap ) ? '#define OBJECTSPACE_NORMALMAP' : '',\n\t\t\t( parameters.normalMap && parameters.tangentSpaceNormalMap ) ? '#define TANGENTSPACE_NORMALMAP' : '',\n\n\t\t\tparameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '',\n\t\t\tparameters.displacementMap && parameters.supportsVertexTextures ? '#define USE_DISPLACEMENTMAP' : '',\n\t\t\tparameters.specularMap ? '#define USE_SPECULARMAP' : '',\n\t\t\tparameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '',\n\t\t\tparameters.metalnessMap ? '#define USE_METALNESSMAP' : '',\n\t\t\tparameters.alphaMap ? '#define USE_ALPHAMAP' : '',\n\n\t\t\tparameters.vertexTangents ? '#define USE_TANGENT' : '',\n\t\t\tparameters.vertexColors ? '#define USE_COLOR' : '',\n\t\t\tparameters.vertexUvs ? '#define USE_UV' : '',\n\t\t\tparameters.uvsVertexOnly ? '#define UVS_VERTEX_ONLY' : '',\n\n\t\t\tparameters.flatShading ? '#define FLAT_SHADED' : '',\n\n\t\t\tparameters.skinning ? '#define USE_SKINNING' : '',\n\t\t\tparameters.useVertexTexture ? '#define BONE_TEXTURE' : '',\n\n\t\t\tparameters.morphTargets ? '#define USE_MORPHTARGETS' : '',\n\t\t\tparameters.morphNormals && parameters.flatShading === false ? '#define USE_MORPHNORMALS' : '',\n\t\t\tparameters.doubleSided ? '#define DOUBLE_SIDED' : '',\n\t\t\tparameters.flipSided ? '#define FLIP_SIDED' : '',\n\n\t\t\tparameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '',\n\t\t\tparameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '',\n\n\t\t\tparameters.sizeAttenuation ? '#define USE_SIZEATTENUATION' : '',\n\n\t\t\tparameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',\n\t\t\t( parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ) ? '#define USE_LOGDEPTHBUF_EXT' : '',\n\n\t\t\t'uniform mat4 modelMatrix;',\n\t\t\t'uniform mat4 modelViewMatrix;',\n\t\t\t'uniform mat4 projectionMatrix;',\n\t\t\t'uniform mat4 viewMatrix;',\n\t\t\t'uniform mat3 normalMatrix;',\n\t\t\t'uniform vec3 cameraPosition;',\n\t\t\t'uniform bool isOrthographic;',\n\n\t\t\t'#ifdef USE_INSTANCING',\n\n\t\t\t' attribute mat4 instanceMatrix;',\n\n\t\t\t'#endif',\n\n\t\t\t'attribute vec3 position;',\n\t\t\t'attribute vec3 normal;',\n\t\t\t'attribute vec2 uv;',\n\n\t\t\t'#ifdef USE_TANGENT',\n\n\t\t\t'\tattribute vec4 tangent;',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_COLOR',\n\n\t\t\t'\tattribute vec3 color;',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_MORPHTARGETS',\n\n\t\t\t'\tattribute vec3 morphTarget0;',\n\t\t\t'\tattribute vec3 morphTarget1;',\n\t\t\t'\tattribute vec3 morphTarget2;',\n\t\t\t'\tattribute vec3 morphTarget3;',\n\n\t\t\t'\t#ifdef USE_MORPHNORMALS',\n\n\t\t\t'\t\tattribute vec3 morphNormal0;',\n\t\t\t'\t\tattribute vec3 morphNormal1;',\n\t\t\t'\t\tattribute vec3 morphNormal2;',\n\t\t\t'\t\tattribute vec3 morphNormal3;',\n\n\t\t\t'\t#else',\n\n\t\t\t'\t\tattribute vec3 morphTarget4;',\n\t\t\t'\t\tattribute vec3 morphTarget5;',\n\t\t\t'\t\tattribute vec3 morphTarget6;',\n\t\t\t'\t\tattribute vec3 morphTarget7;',\n\n\t\t\t'\t#endif',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_SKINNING',\n\n\t\t\t'\tattribute vec4 skinIndex;',\n\t\t\t'\tattribute vec4 skinWeight;',\n\n\t\t\t'#endif',\n\n\t\t\t'\\n'\n\n\t\t].filter( filterEmptyLine ).join( '\\n' );\n\n\t\tprefixFragment = [\n\n\t\t\tcustomExtensions,\n\n\t\t\tgeneratePrecision( parameters ),\n\n\t\t\t'#define SHADER_NAME ' + parameters.shaderName,\n\n\t\t\tcustomDefines,\n\n\t\t\tparameters.alphaTest ? '#define ALPHATEST ' + parameters.alphaTest + ( parameters.alphaTest % 1 ? '' : '.0' ) : '', // add '.0' if integer\n\n\t\t\t'#define GAMMA_FACTOR ' + gammaFactorDefine,\n\n\t\t\t( parameters.useFog && parameters.fog ) ? '#define USE_FOG' : '',\n\t\t\t( parameters.useFog && parameters.fogExp2 ) ? '#define FOG_EXP2' : '',\n\n\t\t\tparameters.map ? '#define USE_MAP' : '',\n\t\t\tparameters.matcap ? '#define USE_MATCAP' : '',\n\t\t\tparameters.envMap ? '#define USE_ENVMAP' : '',\n\t\t\tparameters.envMap ? '#define ' + envMapTypeDefine : '',\n\t\t\tparameters.envMap ? '#define ' + envMapModeDefine : '',\n\t\t\tparameters.envMap ? '#define ' + envMapBlendingDefine : '',\n\t\t\tparameters.lightMap ? '#define USE_LIGHTMAP' : '',\n\t\t\tparameters.aoMap ? '#define USE_AOMAP' : '',\n\t\t\tparameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',\n\t\t\tparameters.bumpMap ? '#define USE_BUMPMAP' : '',\n\t\t\tparameters.normalMap ? '#define USE_NORMALMAP' : '',\n\t\t\t( parameters.normalMap && parameters.objectSpaceNormalMap ) ? '#define OBJECTSPACE_NORMALMAP' : '',\n\t\t\t( parameters.normalMap && parameters.tangentSpaceNormalMap ) ? '#define TANGENTSPACE_NORMALMAP' : '',\n\t\t\tparameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '',\n\t\t\tparameters.specularMap ? '#define USE_SPECULARMAP' : '',\n\t\t\tparameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '',\n\t\t\tparameters.metalnessMap ? '#define USE_METALNESSMAP' : '',\n\t\t\tparameters.alphaMap ? '#define USE_ALPHAMAP' : '',\n\n\t\t\tparameters.sheen ? '#define USE_SHEEN' : '',\n\n\t\t\tparameters.vertexTangents ? '#define USE_TANGENT' : '',\n\t\t\tparameters.vertexColors ? '#define USE_COLOR' : '',\n\t\t\tparameters.vertexUvs ? '#define USE_UV' : '',\n\t\t\tparameters.uvsVertexOnly ? '#define UVS_VERTEX_ONLY' : '',\n\n\t\t\tparameters.gradientMap ? '#define USE_GRADIENTMAP' : '',\n\n\t\t\tparameters.flatShading ? '#define FLAT_SHADED' : '',\n\n\t\t\tparameters.doubleSided ? '#define DOUBLE_SIDED' : '',\n\t\t\tparameters.flipSided ? '#define FLIP_SIDED' : '',\n\n\t\t\tparameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '',\n\t\t\tparameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '',\n\n\t\t\tparameters.premultipliedAlpha ? '#define PREMULTIPLIED_ALPHA' : '',\n\n\t\t\tparameters.physicallyCorrectLights ? '#define PHYSICALLY_CORRECT_LIGHTS' : '',\n\n\t\t\tparameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',\n\t\t\t( parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ) ? '#define USE_LOGDEPTHBUF_EXT' : '',\n\n\t\t\t( ( parameters.extensionShaderTextureLOD || parameters.envMap ) && parameters.rendererExtensionShaderTextureLod ) ? '#define TEXTURE_LOD_EXT' : '',\n\n\t\t\t'uniform mat4 viewMatrix;',\n\t\t\t'uniform vec3 cameraPosition;',\n\t\t\t'uniform bool isOrthographic;',\n\n\t\t\t( parameters.toneMapping !== NoToneMapping ) ? '#define TONE_MAPPING' : '',\n\t\t\t( parameters.toneMapping !== NoToneMapping ) ? ShaderChunk[ 'tonemapping_pars_fragment' ] : '', // this code is required here because it is used by the toneMapping() function defined below\n\t\t\t( parameters.toneMapping !== NoToneMapping ) ? getToneMappingFunction( 'toneMapping', parameters.toneMapping ) : '',\n\n\t\t\tparameters.dithering ? '#define DITHERING' : '',\n\n\t\t\t( parameters.outputEncoding || parameters.mapEncoding || parameters.matcapEncoding || parameters.envMapEncoding || parameters.emissiveMapEncoding || parameters.lightMapEncoding ) ?\n\t\t\t\tShaderChunk[ 'encodings_pars_fragment' ] : '', // this code is required here because it is used by the various encoding/decoding function defined below\n\t\t\tparameters.mapEncoding ? getTexelDecodingFunction( 'mapTexelToLinear', parameters.mapEncoding ) : '',\n\t\t\tparameters.matcapEncoding ? getTexelDecodingFunction( 'matcapTexelToLinear', parameters.matcapEncoding ) : '',\n\t\t\tparameters.envMapEncoding ? getTexelDecodingFunction( 'envMapTexelToLinear', parameters.envMapEncoding ) : '',\n\t\t\tparameters.emissiveMapEncoding ? getTexelDecodingFunction( 'emissiveMapTexelToLinear', parameters.emissiveMapEncoding ) : '',\n\t\t\tparameters.lightMapEncoding ? getTexelDecodingFunction( 'lightMapTexelToLinear', parameters.lightMapEncoding ) : '',\n\t\t\tparameters.outputEncoding ? getTexelEncodingFunction( 'linearToOutputTexel', parameters.outputEncoding ) : '',\n\n\t\t\tparameters.depthPacking ? '#define DEPTH_PACKING ' + parameters.depthPacking : '',\n\n\t\t\t'\\n'\n\n\t\t].filter( filterEmptyLine ).join( '\\n' );\n\n\t}\n\n\tvertexShader = resolveIncludes( vertexShader );\n\tvertexShader = replaceLightNums( vertexShader, parameters );\n\tvertexShader = replaceClippingPlaneNums( vertexShader, parameters );\n\n\tfragmentShader = resolveIncludes( fragmentShader );\n\tfragmentShader = replaceLightNums( fragmentShader, parameters );\n\tfragmentShader = replaceClippingPlaneNums( fragmentShader, parameters );\n\n\tvertexShader = unrollLoops( vertexShader );\n\tfragmentShader = unrollLoops( fragmentShader );\n\n\tif ( parameters.isWebGL2 && ! parameters.isRawShaderMaterial ) {\n\n\t\tvar isGLSL3ShaderMaterial = false;\n\n\t\tvar versionRegex = /^\\s*#version\\s+300\\s+es\\s*\\n/;\n\n\t\tif ( parameters.isShaderMaterial &&\n\t\t\tvertexShader.match( versionRegex ) !== null &&\n\t\t\tfragmentShader.match( versionRegex ) !== null ) {\n\n\t\t\tisGLSL3ShaderMaterial = true;\n\n\t\t\tvertexShader = vertexShader.replace( versionRegex, '' );\n\t\t\tfragmentShader = fragmentShader.replace( versionRegex, '' );\n\n\t\t}\n\n\t\t// GLSL 3.0 conversion\n\n\t\tprefixVertex = [\n\t\t\t'#version 300 es\\n',\n\t\t\t'#define attribute in',\n\t\t\t'#define varying out',\n\t\t\t'#define texture2D texture'\n\t\t].join( '\\n' ) + '\\n' + prefixVertex;\n\n\t\tprefixFragment = [\n\t\t\t'#version 300 es\\n',\n\t\t\t'#define varying in',\n\t\t\tisGLSL3ShaderMaterial ? '' : 'out highp vec4 pc_fragColor;',\n\t\t\tisGLSL3ShaderMaterial ? '' : '#define gl_FragColor pc_fragColor',\n\t\t\t'#define gl_FragDepthEXT gl_FragDepth',\n\t\t\t'#define texture2D texture',\n\t\t\t'#define textureCube texture',\n\t\t\t'#define texture2DProj textureProj',\n\t\t\t'#define texture2DLodEXT textureLod',\n\t\t\t'#define texture2DProjLodEXT textureProjLod',\n\t\t\t'#define textureCubeLodEXT textureLod',\n\t\t\t'#define texture2DGradEXT textureGrad',\n\t\t\t'#define texture2DProjGradEXT textureProjGrad',\n\t\t\t'#define textureCubeGradEXT textureGrad'\n\t\t].join( '\\n' ) + '\\n' + prefixFragment;\n\n\t\t// Multiview\n\n\t\tif ( numMultiviewViews > 0 ) {\n\n\t\t\tprefixVertex = prefixVertex.replace(\n\t\t\t\t'#version 300 es\\n',\n\t\t\t\t[\n\t\t\t\t\t'#version 300 es\\n',\n\t\t\t\t\t'#extension GL_OVR_multiview2 : require',\n\t\t\t\t\t'layout(num_views = ' + numMultiviewViews + ') in;',\n\t\t\t\t\t'#define VIEW_ID gl_ViewID_OVR'\n\t\t\t\t].join( '\\n' )\n\t\t\t);\n\n\t\t\tprefixVertex = prefixVertex.replace(\n\t\t\t\t[\n\t\t\t\t\t'uniform mat4 modelViewMatrix;',\n\t\t\t\t\t'uniform mat4 projectionMatrix;',\n\t\t\t\t\t'uniform mat4 viewMatrix;',\n\t\t\t\t\t'uniform mat3 normalMatrix;'\n\t\t\t\t].join( '\\n' ),\n\t\t\t\t[\n\t\t\t\t\t'uniform mat4 modelViewMatrices[' + numMultiviewViews + '];',\n\t\t\t\t\t'uniform mat4 projectionMatrices[' + numMultiviewViews + '];',\n\t\t\t\t\t'uniform mat4 viewMatrices[' + numMultiviewViews + '];',\n\t\t\t\t\t'uniform mat3 normalMatrices[' + numMultiviewViews + '];',\n\n\t\t\t\t\t'#define modelViewMatrix modelViewMatrices[VIEW_ID]',\n\t\t\t\t\t'#define projectionMatrix projectionMatrices[VIEW_ID]',\n\t\t\t\t\t'#define viewMatrix viewMatrices[VIEW_ID]',\n\t\t\t\t\t'#define normalMatrix normalMatrices[VIEW_ID]'\n\t\t\t\t].join( '\\n' )\n\t\t\t);\n\n\t\t\tprefixFragment = prefixFragment.replace(\n\t\t\t\t'#version 300 es\\n',\n\t\t\t\t[\n\t\t\t\t\t'#version 300 es\\n',\n\t\t\t\t\t'#extension GL_OVR_multiview2 : require',\n\t\t\t\t\t'#define VIEW_ID gl_ViewID_OVR'\n\t\t\t\t].join( '\\n' )\n\t\t\t);\n\n\t\t\tprefixFragment = prefixFragment.replace(\n\t\t\t\t'uniform mat4 viewMatrix;',\n\t\t\t\t[\n\t\t\t\t\t'uniform mat4 viewMatrices[' + numMultiviewViews + '];',\n\t\t\t\t\t'#define viewMatrix viewMatrices[VIEW_ID]'\n\t\t\t\t].join( '\\n' )\n\t\t\t);\n\n\t\t}\n\n\t}\n\n\tvar vertexGlsl = prefixVertex + vertexShader;\n\tvar fragmentGlsl = prefixFragment + fragmentShader;\n\n\t// console.log( '*VERTEX*', vertexGlsl );\n\t// console.log( '*FRAGMENT*', fragmentGlsl );\n\n\tvar glVertexShader = WebGLShader( gl, 35633, vertexGlsl );\n\tvar glFragmentShader = WebGLShader( gl, 35632, fragmentGlsl );\n\n\tgl.attachShader( program, glVertexShader );\n\tgl.attachShader( program, glFragmentShader );\n\n\t// Force a particular attribute to index 0.\n\n\tif ( parameters.index0AttributeName !== undefined ) {\n\n\t\tgl.bindAttribLocation( program, 0, parameters.index0AttributeName );\n\n\t} else if ( parameters.morphTargets === true ) {\n\n\t\t// programs with morphTargets displace position out of attribute 0\n\t\tgl.bindAttribLocation( program, 0, 'position' );\n\n\t}\n\n\tgl.linkProgram( program );\n\n\t// check for link errors\n\tif ( renderer.debug.checkShaderErrors ) {\n\n\t\tvar programLog = gl.getProgramInfoLog( program ).trim();\n\t\tvar vertexLog = gl.getShaderInfoLog( glVertexShader ).trim();\n\t\tvar fragmentLog = gl.getShaderInfoLog( glFragmentShader ).trim();\n\n\t\tvar runnable = true;\n\t\tvar haveDiagnostics = true;\n\n\t\tif ( gl.getProgramParameter( program, 35714 ) === false ) {\n\n\t\t\trunnable = false;\n\n\t\t\tvar vertexErrors = getShaderErrors( gl, glVertexShader, 'vertex' );\n\t\t\tvar fragmentErrors = getShaderErrors( gl, glFragmentShader, 'fragment' );\n\n\t\t\tconsole.error( 'THREE.WebGLProgram: shader error: ', gl.getError(), '35715', gl.getProgramParameter( program, 35715 ), 'gl.getProgramInfoLog', programLog, vertexErrors, fragmentErrors );\n\n\t\t} else if ( programLog !== '' ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLProgram: gl.getProgramInfoLog()', programLog );\n\n\t\t} else if ( vertexLog === '' || fragmentLog === '' ) {\n\n\t\t\thaveDiagnostics = false;\n\n\t\t}\n\n\t\tif ( haveDiagnostics ) {\n\n\t\t\tthis.diagnostics = {\n\n\t\t\t\trunnable: runnable,\n\n\t\t\t\tprogramLog: programLog,\n\n\t\t\t\tvertexShader: {\n\n\t\t\t\t\tlog: vertexLog,\n\t\t\t\t\tprefix: prefixVertex\n\n\t\t\t\t},\n\n\t\t\t\tfragmentShader: {\n\n\t\t\t\t\tlog: fragmentLog,\n\t\t\t\t\tprefix: prefixFragment\n\n\t\t\t\t}\n\n\t\t\t};\n\n\t\t}\n\n\t}\n\n\t// clean up\n\n\tgl.deleteShader( glVertexShader );\n\tgl.deleteShader( glFragmentShader );\n\n\t// set up caching for uniform locations\n\n\tvar cachedUniforms;\n\n\tthis.getUniforms = function () {\n\n\t\tif ( cachedUniforms === undefined ) {\n\n\t\t\tcachedUniforms = new WebGLUniforms( gl, program );\n\n\t\t}\n\n\t\treturn cachedUniforms;\n\n\t};\n\n\t// set up caching for attribute locations\n\n\tvar cachedAttributes;\n\n\tthis.getAttributes = function () {\n\n\t\tif ( cachedAttributes === undefined ) {\n\n\t\t\tcachedAttributes = fetchAttributeLocations( gl, program );\n\n\t\t}\n\n\t\treturn cachedAttributes;\n\n\t};\n\n\t// free resource\n\n\tthis.destroy = function () {\n\n\t\tgl.deleteProgram( program );\n\t\tthis.program = undefined;\n\n\t};\n\n\t//\n\n\tthis.name = parameters.shaderName;\n\tthis.id = programIdCount ++;\n\tthis.cacheKey = cacheKey;\n\tthis.usedTimes = 1;\n\tthis.program = program;\n\tthis.vertexShader = glVertexShader;\n\tthis.fragmentShader = glFragmentShader;\n\tthis.numMultiviewViews = numMultiviewViews;\n\n\treturn this;\n\n}\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction WebGLPrograms( renderer, extensions, capabilities ) {\n\n\tvar programs = [];\n\n\tvar isWebGL2 = capabilities.isWebGL2;\n\tvar logarithmicDepthBuffer = capabilities.logarithmicDepthBuffer;\n\tvar floatVertexTextures = capabilities.floatVertexTextures;\n\tvar precision = capabilities.precision;\n\tvar maxVertexUniforms = capabilities.maxVertexUniforms;\n\tvar vertexTextures = capabilities.vertexTextures;\n\n\tvar shaderIDs = {\n\t\tMeshDepthMaterial: 'depth',\n\t\tMeshDistanceMaterial: 'distanceRGBA',\n\t\tMeshNormalMaterial: 'normal',\n\t\tMeshBasicMaterial: 'basic',\n\t\tMeshLambertMaterial: 'lambert',\n\t\tMeshPhongMaterial: 'phong',\n\t\tMeshToonMaterial: 'toon',\n\t\tMeshStandardMaterial: 'physical',\n\t\tMeshPhysicalMaterial: 'physical',\n\t\tMeshMatcapMaterial: 'matcap',\n\t\tLineBasicMaterial: 'basic',\n\t\tLineDashedMaterial: 'dashed',\n\t\tPointsMaterial: 'points',\n\t\tShadowMaterial: 'shadow',\n\t\tSpriteMaterial: 'sprite'\n\t};\n\n\tvar parameterNames = [\n\t\t\"precision\", \"isWebGL2\", \"supportsVertexTextures\", \"outputEncoding\", \"instancing\", \"numMultiviewViews\",\n\t\t\"map\", \"mapEncoding\", \"matcap\", \"matcapEncoding\", \"envMap\", \"envMapMode\", \"envMapEncoding\", \"envMapCubeUV\",\n\t\t\"lightMap\", \"lightMapEncoding\", \"aoMap\", \"emissiveMap\", \"emissiveMapEncoding\", \"bumpMap\", \"normalMap\", \"objectSpaceNormalMap\", \"tangentSpaceNormalMap\", \"clearcoatNormalMap\", \"displacementMap\", \"specularMap\",\n\t\t\"roughnessMap\", \"metalnessMap\", \"gradientMap\",\n\t\t\"alphaMap\", \"combine\", \"vertexColors\", \"vertexTangents\", \"vertexUvs\", \"uvsVertexOnly\", \"fog\", \"useFog\", \"fogExp2\",\n\t\t\"flatShading\", \"sizeAttenuation\", \"logarithmicDepthBuffer\", \"skinning\",\n\t\t\"maxBones\", \"useVertexTexture\", \"morphTargets\", \"morphNormals\",\n\t\t\"maxMorphTargets\", \"maxMorphNormals\", \"premultipliedAlpha\",\n\t\t\"numDirLights\", \"numPointLights\", \"numSpotLights\", \"numHemiLights\", \"numRectAreaLights\",\n\t\t\"numDirLightShadows\", \"numPointLightShadows\", \"numSpotLightShadows\",\n\t\t\"shadowMapEnabled\", \"shadowMapType\", \"toneMapping\", 'physicallyCorrectLights',\n\t\t\"alphaTest\", \"doubleSided\", \"flipSided\", \"numClippingPlanes\", \"numClipIntersection\", \"depthPacking\", \"dithering\",\n\t\t\"sheen\"\n\t];\n\n\tfunction getShaderObject( material, shaderID ) {\n\n\t\tvar shaderobject;\n\n\t\tif ( shaderID ) {\n\n\t\t\tvar shader = ShaderLib[ shaderID ];\n\n\t\t\tshaderobject = {\n\t\t\t\tname: material.type,\n\t\t\t\tuniforms: UniformsUtils.clone( shader.uniforms ),\n\t\t\t\tvertexShader: shader.vertexShader,\n\t\t\t\tfragmentShader: shader.fragmentShader\n\t\t\t};\n\n\t\t} else {\n\n\t\t\tshaderobject = {\n\t\t\t\tname: material.type,\n\t\t\t\tuniforms: material.uniforms,\n\t\t\t\tvertexShader: material.vertexShader,\n\t\t\t\tfragmentShader: material.fragmentShader\n\t\t\t};\n\n\t\t}\n\n\t\treturn shaderobject;\n\n\t}\n\n\tfunction allocateBones( object ) {\n\n\t\tvar skeleton = object.skeleton;\n\t\tvar bones = skeleton.bones;\n\n\t\tif ( floatVertexTextures ) {\n\n\t\t\treturn 1024;\n\n\t\t} else {\n\n\t\t\t// default for when object is not specified\n\t\t\t// ( for example when prebuilding shader to be used with multiple objects )\n\t\t\t//\n\t\t\t// - leave some extra space for other uniforms\n\t\t\t// - limit here is ANGLE's 254 max uniform vectors\n\t\t\t// (up to 54 should be safe)\n\n\t\t\tvar nVertexUniforms = maxVertexUniforms;\n\t\t\tvar nVertexMatrices = Math.floor( ( nVertexUniforms - 20 ) / 4 );\n\n\t\t\tvar maxBones = Math.min( nVertexMatrices, bones.length );\n\n\t\t\tif ( maxBones < bones.length ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Skeleton has ' + bones.length + ' bones. This GPU supports ' + maxBones + '.' );\n\t\t\t\treturn 0;\n\n\t\t\t}\n\n\t\t\treturn maxBones;\n\n\t\t}\n\n\t}\n\n\tfunction getTextureEncodingFromMap( map ) {\n\n\t\tvar encoding;\n\n\t\tif ( ! map ) {\n\n\t\t\tencoding = LinearEncoding;\n\n\t\t} else if ( map.isTexture ) {\n\n\t\t\tencoding = map.encoding;\n\n\t\t} else if ( map.isWebGLRenderTarget ) {\n\n\t\t\tconsole.warn( \"THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead.\" );\n\t\t\tencoding = map.texture.encoding;\n\n\t\t}\n\n\t\treturn encoding;\n\n\t}\n\n\tthis.getParameters = function ( material, lights, shadows, scene, nClipPlanes, nClipIntersection, object ) {\n\n\t\tvar fog = scene.fog;\n\t\tvar environment = material.isMeshStandardMaterial ? scene.environment : null;\n\n\t\tvar envMap = material.envMap || environment;\n\n\t\tvar shaderID = shaderIDs[ material.type ];\n\n\t\t// heuristics to create shader parameters according to lights in the scene\n\t\t// (not to blow over maxLights budget)\n\n\t\tvar maxBones = object.isSkinnedMesh ? allocateBones( object ) : 0;\n\n\t\tif ( material.precision !== null ) {\n\n\t\t\tprecision = capabilities.getMaxPrecision( material.precision );\n\n\t\t\tif ( precision !== material.precision ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLProgram.getParameters:', material.precision, 'not supported, using', precision, 'instead.' );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvar shaderobject = getShaderObject( material, shaderID );\n\t\tmaterial.onBeforeCompile( shaderobject, renderer );\n\n\t\tvar currentRenderTarget = renderer.getRenderTarget();\n\t\tvar numMultiviewViews = currentRenderTarget && currentRenderTarget.isWebGLMultiviewRenderTarget ? currentRenderTarget.numViews : 0;\n\n\t\tvar parameters = {\n\n\t\t\tisWebGL2: isWebGL2,\n\n\t\t\tshaderID: shaderID,\n\t\t\tshaderName: shaderobject.name,\n\n\t\t\tuniforms: shaderobject.uniforms,\n\t\t\tvertexShader: shaderobject.vertexShader,\n\t\t\tfragmentShader: shaderobject.fragmentShader,\n\t\t\tdefines: material.defines,\n\n\t\t\tisRawShaderMaterial: material.isRawShaderMaterial,\n\t\t\tisShaderMaterial: material.isShaderMaterial,\n\n\t\t\tprecision: precision,\n\n\t\t\tinstancing: object.isInstancedMesh === true,\n\n\t\t\tsupportsVertexTextures: vertexTextures,\n\t\t\tnumMultiviewViews: numMultiviewViews,\n\t\t\toutputEncoding: ( currentRenderTarget !== null ) ? getTextureEncodingFromMap( currentRenderTarget.texture ) : renderer.outputEncoding,\n\t\t\tmap: !! material.map,\n\t\t\tmapEncoding: getTextureEncodingFromMap( material.map ),\n\t\t\tmatcap: !! material.matcap,\n\t\t\tmatcapEncoding: getTextureEncodingFromMap( material.matcap ),\n\t\t\tenvMap: !! envMap,\n\t\t\tenvMapMode: envMap && envMap.mapping,\n\t\t\tenvMapEncoding: getTextureEncodingFromMap( envMap ),\n\t\t\tenvMapCubeUV: ( !! envMap ) && ( ( envMap.mapping === CubeUVReflectionMapping ) || ( envMap.mapping === CubeUVRefractionMapping ) ),\n\t\t\tlightMap: !! material.lightMap,\n\t\t\tlightMapEncoding: getTextureEncodingFromMap( material.lightMap ),\n\t\t\taoMap: !! material.aoMap,\n\t\t\temissiveMap: !! material.emissiveMap,\n\t\t\temissiveMapEncoding: getTextureEncodingFromMap( material.emissiveMap ),\n\t\t\tbumpMap: !! material.bumpMap,\n\t\t\tnormalMap: !! material.normalMap,\n\t\t\tobjectSpaceNormalMap: material.normalMapType === ObjectSpaceNormalMap,\n\t\t\ttangentSpaceNormalMap: material.normalMapType === TangentSpaceNormalMap,\n\t\t\tclearcoatNormalMap: !! material.clearcoatNormalMap,\n\t\t\tdisplacementMap: !! material.displacementMap,\n\t\t\troughnessMap: !! material.roughnessMap,\n\t\t\tmetalnessMap: !! material.metalnessMap,\n\t\t\tspecularMap: !! material.specularMap,\n\t\t\talphaMap: !! material.alphaMap,\n\n\t\t\tgradientMap: !! material.gradientMap,\n\n\t\t\tsheen: !! material.sheen,\n\n\t\t\tcombine: material.combine,\n\n\t\t\tvertexTangents: ( material.normalMap && material.vertexTangents ),\n\t\t\tvertexColors: material.vertexColors,\n\t\t\tvertexUvs: !! material.map || !! material.bumpMap || !! material.normalMap || !! material.specularMap || !! material.alphaMap || !! material.emissiveMap || !! material.roughnessMap || !! material.metalnessMap || !! material.clearcoatNormalMap || !! material.displacementMap,\n\t\t\tuvsVertexOnly: ! ( !! material.map || !! material.bumpMap || !! material.normalMap || !! material.specularMap || !! material.alphaMap || !! material.emissiveMap || !! material.roughnessMap || !! material.metalnessMap || !! material.clearcoatNormalMap ) && !! material.displacementMap,\n\n\t\t\tfog: !! fog,\n\t\t\tuseFog: material.fog,\n\t\t\tfogExp2: ( fog && fog.isFogExp2 ),\n\n\t\t\tflatShading: material.flatShading,\n\n\t\t\tsizeAttenuation: material.sizeAttenuation,\n\t\t\tlogarithmicDepthBuffer: logarithmicDepthBuffer,\n\n\t\t\tskinning: material.skinning && maxBones > 0,\n\t\t\tmaxBones: maxBones,\n\t\t\tuseVertexTexture: floatVertexTextures,\n\n\t\t\tmorphTargets: material.morphTargets,\n\t\t\tmorphNormals: material.morphNormals,\n\t\t\tmaxMorphTargets: renderer.maxMorphTargets,\n\t\t\tmaxMorphNormals: renderer.maxMorphNormals,\n\n\t\t\tnumDirLights: lights.directional.length,\n\t\t\tnumPointLights: lights.point.length,\n\t\t\tnumSpotLights: lights.spot.length,\n\t\t\tnumRectAreaLights: lights.rectArea.length,\n\t\t\tnumHemiLights: lights.hemi.length,\n\n\t\t\tnumDirLightShadows: lights.directionalShadowMap.length,\n\t\t\tnumPointLightShadows: lights.pointShadowMap.length,\n\t\t\tnumSpotLightShadows: lights.spotShadowMap.length,\n\n\t\t\tnumClippingPlanes: nClipPlanes,\n\t\t\tnumClipIntersection: nClipIntersection,\n\n\t\t\tdithering: material.dithering,\n\n\t\t\tshadowMapEnabled: renderer.shadowMap.enabled && shadows.length > 0,\n\t\t\tshadowMapType: renderer.shadowMap.type,\n\n\t\t\ttoneMapping: material.toneMapped ? renderer.toneMapping : NoToneMapping,\n\t\t\tphysicallyCorrectLights: renderer.physicallyCorrectLights,\n\n\t\t\tpremultipliedAlpha: material.premultipliedAlpha,\n\n\t\t\talphaTest: material.alphaTest,\n\t\t\tdoubleSided: material.side === DoubleSide,\n\t\t\tflipSided: material.side === BackSide,\n\n\t\t\tdepthPacking: ( material.depthPacking !== undefined ) ? material.depthPacking : false,\n\n\t\t\tindex0AttributeName: material.index0AttributeName,\n\n\t\t\textensionDerivatives: material.extensions && material.extensions.derivatives,\n\t\t\textensionFragDepth: material.extensions && material.extensions.frawbuffers,\n\t\t\textensionDrawbuffers: material.extensions && material.extensions.drawbuffers,\n\t\t\textensionShaderTextureLOD: material.extensions && material.extensions.shaderTextureLOD,\n\n\t\t\trendererExtensionFragDepth: isWebGL2 || extensions.get( 'EXT_frag_depth' ) !== null,\n\t\t\trendererExtensionDrawBuffers: isWebGL2 || extensions.get( 'WEBGL_draw_buffers' ) !== null,\n\t\t\trendererExtensionShaderTextureLod: isWebGL2 || extensions.get( 'EXT_shader_texture_lod' ) !== null,\n\n\t\t\tonBeforeCompile: material.onBeforeCompile\n\n\t\t};\n\n\t\treturn parameters;\n\n\t};\n\n\tthis.getProgramCacheKey = function ( parameters ) {\n\n\t\tvar array = [];\n\n\t\tif ( parameters.shaderID ) {\n\n\t\t\tarray.push( parameters.shaderID );\n\n\t\t} else {\n\n\t\t\tarray.push( parameters.fragmentShader );\n\t\t\tarray.push( parameters.vertexShader );\n\n\t\t}\n\n\t\tif ( parameters.defines !== undefined ) {\n\n\t\t\tfor ( var name in parameters.defines ) {\n\n\t\t\t\tarray.push( name );\n\t\t\t\tarray.push( parameters.defines[ name ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( parameters.isRawShaderMaterial === undefined ) {\n\n\t\t\tfor ( var i = 0; i < parameterNames.length; i ++ ) {\n\n\t\t\t\tarray.push( parameters[ parameterNames[ i ] ] );\n\n\t\t\t}\n\n\t\t\tarray.push( renderer.outputEncoding );\n\t\t\tarray.push( renderer.gammaFactor );\n\n\t\t}\n\n\t\tarray.push( parameters.onBeforeCompile.toString() );\n\n\t\treturn array.join();\n\n\t};\n\n\tthis.acquireProgram = function ( parameters, cacheKey ) {\n\n\t\tvar program;\n\n\t\t// Check if code has been already compiled\n\t\tfor ( var p = 0, pl = programs.length; p < pl; p ++ ) {\n\n\t\t\tvar preexistingProgram = programs[ p ];\n\n\t\t\tif ( preexistingProgram.cacheKey === cacheKey ) {\n\n\t\t\t\tprogram = preexistingProgram;\n\t\t\t\t++ program.usedTimes;\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( program === undefined ) {\n\n\t\t\tprogram = new WebGLProgram( renderer, cacheKey, parameters );\n\t\t\tprograms.push( program );\n\n\t\t}\n\n\t\treturn program;\n\n\t};\n\n\tthis.releaseProgram = function ( program ) {\n\n\t\tif ( -- program.usedTimes === 0 ) {\n\n\t\t\t// Remove from unordered set\n\t\t\tvar i = programs.indexOf( program );\n\t\t\tprograms[ i ] = programs[ programs.length - 1 ];\n\t\t\tprograms.pop();\n\n\t\t\t// Free WebGL resources\n\t\t\tprogram.destroy();\n\n\t\t}\n\n\t};\n\n\t// Exposed for resource monitoring & error feedback via renderer.info:\n\tthis.programs = programs;\n\n}\n\n/**\n * @author fordacious / fordacious.github.io\n */\n\nfunction WebGLProperties() {\n\n\tvar properties = new WeakMap();\n\n\tfunction get( object ) {\n\n\t\tvar map = properties.get( object );\n\n\t\tif ( map === undefined ) {\n\n\t\t\tmap = {};\n\t\t\tproperties.set( object, map );\n\n\t\t}\n\n\t\treturn map;\n\n\t}\n\n\tfunction remove( object ) {\n\n\t\tproperties.delete( object );\n\n\t}\n\n\tfunction update( object, key, value ) {\n\n\t\tproperties.get( object )[ key ] = value;\n\n\t}\n\n\tfunction dispose() {\n\n\t\tproperties = new WeakMap();\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tremove: remove,\n\t\tupdate: update,\n\t\tdispose: dispose\n\t};\n\n}\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction painterSortStable( a, b ) {\n\n\tif ( a.groupOrder !== b.groupOrder ) {\n\n\t\treturn a.groupOrder - b.groupOrder;\n\n\t} else if ( a.renderOrder !== b.renderOrder ) {\n\n\t\treturn a.renderOrder - b.renderOrder;\n\n\t} else if ( a.program !== b.program ) {\n\n\t\treturn a.program.id - b.program.id;\n\n\t} else if ( a.material.id !== b.material.id ) {\n\n\t\treturn a.material.id - b.material.id;\n\n\t} else if ( a.z !== b.z ) {\n\n\t\treturn a.z - b.z;\n\n\t} else {\n\n\t\treturn a.id - b.id;\n\n\t}\n\n}\n\nfunction reversePainterSortStable( a, b ) {\n\n\tif ( a.groupOrder !== b.groupOrder ) {\n\n\t\treturn a.groupOrder - b.groupOrder;\n\n\t} else if ( a.renderOrder !== b.renderOrder ) {\n\n\t\treturn a.renderOrder - b.renderOrder;\n\n\t} else if ( a.z !== b.z ) {\n\n\t\treturn b.z - a.z;\n\n\t} else {\n\n\t\treturn a.id - b.id;\n\n\t}\n\n}\n\n\nfunction WebGLRenderList() {\n\n\tvar renderItems = [];\n\tvar renderItemsIndex = 0;\n\n\tvar opaque = [];\n\tvar transparent = [];\n\n\tvar defaultProgram = { id: - 1 };\n\n\tfunction init() {\n\n\t\trenderItemsIndex = 0;\n\n\t\topaque.length = 0;\n\t\ttransparent.length = 0;\n\n\t}\n\n\tfunction getNextRenderItem( object, geometry, material, groupOrder, z, group ) {\n\n\t\tvar renderItem = renderItems[ renderItemsIndex ];\n\n\t\tif ( renderItem === undefined ) {\n\n\t\t\trenderItem = {\n\t\t\t\tid: object.id,\n\t\t\t\tobject: object,\n\t\t\t\tgeometry: geometry,\n\t\t\t\tmaterial: material,\n\t\t\t\tprogram: material.program || defaultProgram,\n\t\t\t\tgroupOrder: groupOrder,\n\t\t\t\trenderOrder: object.renderOrder,\n\t\t\t\tz: z,\n\t\t\t\tgroup: group\n\t\t\t};\n\n\t\t\trenderItems[ renderItemsIndex ] = renderItem;\n\n\t\t} else {\n\n\t\t\trenderItem.id = object.id;\n\t\t\trenderItem.object = object;\n\t\t\trenderItem.geometry = geometry;\n\t\t\trenderItem.material = material;\n\t\t\trenderItem.program = material.program || defaultProgram;\n\t\t\trenderItem.groupOrder = groupOrder;\n\t\t\trenderItem.renderOrder = object.renderOrder;\n\t\t\trenderItem.z = z;\n\t\t\trenderItem.group = group;\n\n\t\t}\n\n\t\trenderItemsIndex ++;\n\n\t\treturn renderItem;\n\n\t}\n\n\tfunction push( object, geometry, material, groupOrder, z, group ) {\n\n\t\tvar renderItem = getNextRenderItem( object, geometry, material, groupOrder, z, group );\n\n\t\t( material.transparent === true ? transparent : opaque ).push( renderItem );\n\n\t}\n\n\tfunction unshift( object, geometry, material, groupOrder, z, group ) {\n\n\t\tvar renderItem = getNextRenderItem( object, geometry, material, groupOrder, z, group );\n\n\t\t( material.transparent === true ? transparent : opaque ).unshift( renderItem );\n\n\t}\n\n\tfunction sort( customOpaqueSort, customTransparentSort ) {\n\n\t\tif ( opaque.length > 1 ) opaque.sort( customOpaqueSort || painterSortStable );\n\t\tif ( transparent.length > 1 ) transparent.sort( customTransparentSort || reversePainterSortStable );\n\n\t}\n\n\treturn {\n\t\topaque: opaque,\n\t\ttransparent: transparent,\n\n\t\tinit: init,\n\t\tpush: push,\n\t\tunshift: unshift,\n\n\t\tsort: sort\n\t};\n\n}\n\nfunction WebGLRenderLists() {\n\n\tvar lists = new WeakMap();\n\n\tfunction onSceneDispose( event ) {\n\n\t\tvar scene = event.target;\n\n\t\tscene.removeEventListener( 'dispose', onSceneDispose );\n\n\t\tlists.delete( scene );\n\n\t}\n\n\tfunction get( scene, camera ) {\n\n\t\tvar cameras = lists.get( scene );\n\t\tvar list;\n\t\tif ( cameras === undefined ) {\n\n\t\t\tlist = new WebGLRenderList();\n\t\t\tlists.set( scene, new WeakMap() );\n\t\t\tlists.get( scene ).set( camera, list );\n\n\t\t\tscene.addEventListener( 'dispose', onSceneDispose );\n\n\t\t} else {\n\n\t\t\tlist = cameras.get( camera );\n\t\t\tif ( list === undefined ) {\n\n\t\t\t\tlist = new WebGLRenderList();\n\t\t\t\tcameras.set( camera, list );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn list;\n\n\t}\n\n\tfunction dispose() {\n\n\t\tlists = new WeakMap();\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tdispose: dispose\n\t};\n\n}\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction UniformsCache() {\n\n\tvar lights = {};\n\n\treturn {\n\n\t\tget: function ( light ) {\n\n\t\t\tif ( lights[ light.id ] !== undefined ) {\n\n\t\t\t\treturn lights[ light.id ];\n\n\t\t\t}\n\n\t\t\tvar uniforms;\n\n\t\t\tswitch ( light.type ) {\n\n\t\t\t\tcase 'DirectionalLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tdirection: new Vector3(),\n\t\t\t\t\t\tcolor: new Color(),\n\n\t\t\t\t\t\tshadow: false,\n\t\t\t\t\t\tshadowBias: 0,\n\t\t\t\t\t\tshadowRadius: 1,\n\t\t\t\t\t\tshadowMapSize: new Vector2()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'SpotLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tposition: new Vector3(),\n\t\t\t\t\t\tdirection: new Vector3(),\n\t\t\t\t\t\tcolor: new Color(),\n\t\t\t\t\t\tdistance: 0,\n\t\t\t\t\t\tconeCos: 0,\n\t\t\t\t\t\tpenumbraCos: 0,\n\t\t\t\t\t\tdecay: 0,\n\n\t\t\t\t\t\tshadow: false,\n\t\t\t\t\t\tshadowBias: 0,\n\t\t\t\t\t\tshadowRadius: 1,\n\t\t\t\t\t\tshadowMapSize: new Vector2()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'PointLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tposition: new Vector3(),\n\t\t\t\t\t\tcolor: new Color(),\n\t\t\t\t\t\tdistance: 0,\n\t\t\t\t\t\tdecay: 0,\n\n\t\t\t\t\t\tshadow: false,\n\t\t\t\t\t\tshadowBias: 0,\n\t\t\t\t\t\tshadowRadius: 1,\n\t\t\t\t\t\tshadowMapSize: new Vector2(),\n\t\t\t\t\t\tshadowCameraNear: 1,\n\t\t\t\t\t\tshadowCameraFar: 1000\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'HemisphereLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tdirection: new Vector3(),\n\t\t\t\t\t\tskyColor: new Color(),\n\t\t\t\t\t\tgroundColor: new Color()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'RectAreaLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tcolor: new Color(),\n\t\t\t\t\t\tposition: new Vector3(),\n\t\t\t\t\t\thalfWidth: new Vector3(),\n\t\t\t\t\t\thalfHeight: new Vector3()\n\t\t\t\t\t\t// TODO (abelnation): set RectAreaLight shadow uniforms\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tlights[ light.id ] = uniforms;\n\n\t\t\treturn uniforms;\n\n\t\t}\n\n\t};\n\n}\n\nvar nextVersion = 0;\n\nfunction shadowCastingLightsFirst( lightA, lightB ) {\n\n\treturn ( lightB.castShadow ? 1 : 0 ) - ( lightA.castShadow ? 1 : 0 );\n\n}\n\nfunction WebGLLights() {\n\n\tvar cache = new UniformsCache();\n\n\tvar state = {\n\n\t\tversion: 0,\n\n\t\thash: {\n\t\t\tdirectionalLength: - 1,\n\t\t\tpointLength: - 1,\n\t\t\tspotLength: - 1,\n\t\t\trectAreaLength: - 1,\n\t\t\themiLength: - 1,\n\n\t\t\tnumDirectionalShadows: - 1,\n\t\t\tnumPointShadows: - 1,\n\t\t\tnumSpotShadows: - 1,\n\t\t},\n\n\t\tambient: [ 0, 0, 0 ],\n\t\tprobe: [],\n\t\tdirectional: [],\n\t\tdirectionalShadowMap: [],\n\t\tdirectionalShadowMatrix: [],\n\t\tspot: [],\n\t\tspotShadowMap: [],\n\t\tspotShadowMatrix: [],\n\t\trectArea: [],\n\t\tpoint: [],\n\t\tpointShadowMap: [],\n\t\tpointShadowMatrix: [],\n\t\themi: [],\n\n\t\tnumDirectionalShadows: - 1,\n\t\tnumPointShadows: - 1,\n\t\tnumSpotShadows: - 1\n\n\t};\n\n\tfor ( var i = 0; i < 9; i ++ ) state.probe.push( new Vector3() );\n\n\tvar vector3 = new Vector3();\n\tvar matrix4 = new Matrix4();\n\tvar matrix42 = new Matrix4();\n\n\tfunction setup( lights, shadows, camera ) {\n\n\t\tvar r = 0, g = 0, b = 0;\n\n\t\tfor ( var i = 0; i < 9; i ++ ) state.probe[ i ].set( 0, 0, 0 );\n\n\t\tvar directionalLength = 0;\n\t\tvar pointLength = 0;\n\t\tvar spotLength = 0;\n\t\tvar rectAreaLength = 0;\n\t\tvar hemiLength = 0;\n\n\t\tvar numDirectionalShadows = 0;\n\t\tvar numPointShadows = 0;\n\t\tvar numSpotShadows = 0;\n\n\t\tvar viewMatrix = camera.matrixWorldInverse;\n\n\t\tlights.sort( shadowCastingLightsFirst );\n\n\t\tfor ( var i = 0, l = lights.length; i < l; i ++ ) {\n\n\t\t\tvar light = lights[ i ];\n\n\t\t\tvar color = light.color;\n\t\t\tvar intensity = light.intensity;\n\t\t\tvar distance = light.distance;\n\n\t\t\tvar shadowMap = ( light.shadow && light.shadow.map ) ? light.shadow.map.texture : null;\n\n\t\t\tif ( light.isAmbientLight ) {\n\n\t\t\t\tr += color.r * intensity;\n\t\t\t\tg += color.g * intensity;\n\t\t\t\tb += color.b * intensity;\n\n\t\t\t} else if ( light.isLightProbe ) {\n\n\t\t\t\tfor ( var j = 0; j < 9; j ++ ) {\n\n\t\t\t\t\tstate.probe[ j ].addScaledVector( light.sh.coefficients[ j ], intensity );\n\n\t\t\t\t}\n\n\t\t\t} else if ( light.isDirectionalLight ) {\n\n\t\t\t\tvar uniforms = cache.get( light );\n\n\t\t\t\tuniforms.color.copy( light.color ).multiplyScalar( light.intensity );\n\t\t\t\tuniforms.direction.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tvector3.setFromMatrixPosition( light.target.matrixWorld );\n\t\t\t\tuniforms.direction.sub( vector3 );\n\t\t\t\tuniforms.direction.transformDirection( viewMatrix );\n\n\t\t\t\tuniforms.shadow = light.castShadow;\n\n\t\t\t\tif ( light.castShadow ) {\n\n\t\t\t\t\tvar shadow = light.shadow;\n\n\t\t\t\t\tuniforms.shadowBias = shadow.bias;\n\t\t\t\t\tuniforms.shadowRadius = shadow.radius;\n\t\t\t\t\tuniforms.shadowMapSize = shadow.mapSize;\n\n\t\t\t\t\tstate.directionalShadowMap[ directionalLength ] = shadowMap;\n\t\t\t\t\tstate.directionalShadowMatrix[ directionalLength ] = light.shadow.matrix;\n\n\t\t\t\t\tnumDirectionalShadows ++;\n\n\t\t\t\t}\n\n\t\t\t\tstate.directional[ directionalLength ] = uniforms;\n\n\t\t\t\tdirectionalLength ++;\n\n\t\t\t} else if ( light.isSpotLight ) {\n\n\t\t\t\tvar uniforms = cache.get( light );\n\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tuniforms.position.applyMatrix4( viewMatrix );\n\n\t\t\t\tuniforms.color.copy( color ).multiplyScalar( intensity );\n\t\t\t\tuniforms.distance = distance;\n\n\t\t\t\tuniforms.direction.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tvector3.setFromMatrixPosition( light.target.matrixWorld );\n\t\t\t\tuniforms.direction.sub( vector3 );\n\t\t\t\tuniforms.direction.transformDirection( viewMatrix );\n\n\t\t\t\tuniforms.coneCos = Math.cos( light.angle );\n\t\t\t\tuniforms.penumbraCos = Math.cos( light.angle * ( 1 - light.penumbra ) );\n\t\t\t\tuniforms.decay = light.decay;\n\n\t\t\t\tuniforms.shadow = light.castShadow;\n\n\t\t\t\tif ( light.castShadow ) {\n\n\t\t\t\t\tvar shadow = light.shadow;\n\n\t\t\t\t\tuniforms.shadowBias = shadow.bias;\n\t\t\t\t\tuniforms.shadowRadius = shadow.radius;\n\t\t\t\t\tuniforms.shadowMapSize = shadow.mapSize;\n\n\t\t\t\t\tstate.spotShadowMap[ spotLength ] = shadowMap;\n\t\t\t\t\tstate.spotShadowMatrix[ spotLength ] = light.shadow.matrix;\n\n\t\t\t\t\tnumSpotShadows ++;\n\n\t\t\t\t}\n\n\t\t\t\tstate.spot[ spotLength ] = uniforms;\n\n\t\t\t\tspotLength ++;\n\n\t\t\t} else if ( light.isRectAreaLight ) {\n\n\t\t\t\tvar uniforms = cache.get( light );\n\n\t\t\t\t// (a) intensity is the total visible light emitted\n\t\t\t\t//uniforms.color.copy( color ).multiplyScalar( intensity / ( light.width * light.height * Math.PI ) );\n\n\t\t\t\t// (b) intensity is the brightness of the light\n\t\t\t\tuniforms.color.copy( color ).multiplyScalar( intensity );\n\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tuniforms.position.applyMatrix4( viewMatrix );\n\n\t\t\t\t// extract local rotation of light to derive width/height half vectors\n\t\t\t\tmatrix42.identity();\n\t\t\t\tmatrix4.copy( light.matrixWorld );\n\t\t\t\tmatrix4.premultiply( viewMatrix );\n\t\t\t\tmatrix42.extractRotation( matrix4 );\n\n\t\t\t\tuniforms.halfWidth.set( light.width * 0.5, 0.0, 0.0 );\n\t\t\t\tuniforms.halfHeight.set( 0.0, light.height * 0.5, 0.0 );\n\n\t\t\t\tuniforms.halfWidth.applyMatrix4( matrix42 );\n\t\t\t\tuniforms.halfHeight.applyMatrix4( matrix42 );\n\n\t\t\t\t// TODO (abelnation): RectAreaLight distance?\n\t\t\t\t// uniforms.distance = distance;\n\n\t\t\t\tstate.rectArea[ rectAreaLength ] = uniforms;\n\n\t\t\t\trectAreaLength ++;\n\n\t\t\t} else if ( light.isPointLight ) {\n\n\t\t\t\tvar uniforms = cache.get( light );\n\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tuniforms.position.applyMatrix4( viewMatrix );\n\n\t\t\t\tuniforms.color.copy( light.color ).multiplyScalar( light.intensity );\n\t\t\t\tuniforms.distance = light.distance;\n\t\t\t\tuniforms.decay = light.decay;\n\n\t\t\t\tuniforms.shadow = light.castShadow;\n\n\t\t\t\tif ( light.castShadow ) {\n\n\t\t\t\t\tvar shadow = light.shadow;\n\n\t\t\t\t\tuniforms.shadowBias = shadow.bias;\n\t\t\t\t\tuniforms.shadowRadius = shadow.radius;\n\t\t\t\t\tuniforms.shadowMapSize = shadow.mapSize;\n\t\t\t\t\tuniforms.shadowCameraNear = shadow.camera.near;\n\t\t\t\t\tuniforms.shadowCameraFar = shadow.camera.far;\n\n\t\t\t\t\tstate.pointShadowMap[ pointLength ] = shadowMap;\n\t\t\t\t\tstate.pointShadowMatrix[ pointLength ] = light.shadow.matrix;\n\n\t\t\t\t\tnumPointShadows ++;\n\n\t\t\t\t}\n\n\t\t\t\tstate.point[ pointLength ] = uniforms;\n\n\t\t\t\tpointLength ++;\n\n\t\t\t} else if ( light.isHemisphereLight ) {\n\n\t\t\t\tvar uniforms = cache.get( light );\n\n\t\t\t\tuniforms.direction.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tuniforms.direction.transformDirection( viewMatrix );\n\t\t\t\tuniforms.direction.normalize();\n\n\t\t\t\tuniforms.skyColor.copy( light.color ).multiplyScalar( intensity );\n\t\t\t\tuniforms.groundColor.copy( light.groundColor ).multiplyScalar( intensity );\n\n\t\t\t\tstate.hemi[ hemiLength ] = uniforms;\n\n\t\t\t\themiLength ++;\n\n\t\t\t}\n\n\t\t}\n\n\t\tstate.ambient[ 0 ] = r;\n\t\tstate.ambient[ 1 ] = g;\n\t\tstate.ambient[ 2 ] = b;\n\n\t\tvar hash = state.hash;\n\n\t\tif ( hash.directionalLength !== directionalLength ||\n\t\t\thash.pointLength !== pointLength ||\n\t\t\thash.spotLength !== spotLength ||\n\t\t\thash.rectAreaLength !== rectAreaLength ||\n\t\t\thash.hemiLength !== hemiLength ||\n\t\t\thash.numDirectionalShadows !== numDirectionalShadows ||\n\t\t\thash.numPointShadows !== numPointShadows ||\n\t\t\thash.numSpotShadows !== numSpotShadows ) {\n\n\t\t\tstate.directional.length = directionalLength;\n\t\t\tstate.spot.length = spotLength;\n\t\t\tstate.rectArea.length = rectAreaLength;\n\t\t\tstate.point.length = pointLength;\n\t\t\tstate.hemi.length = hemiLength;\n\n\t\t\tstate.directionalShadowMap.length = numDirectionalShadows;\n\t\t\tstate.pointShadowMap.length = numPointShadows;\n\t\t\tstate.spotShadowMap.length = numSpotShadows;\n\t\t\tstate.directionalShadowMatrix.length = numDirectionalShadows;\n\t\t\tstate.pointShadowMatrix.length = numPointShadows;\n\t\t\tstate.spotShadowMatrix.length = numSpotShadows;\n\n\t\t\thash.directionalLength = directionalLength;\n\t\t\thash.pointLength = pointLength;\n\t\t\thash.spotLength = spotLength;\n\t\t\thash.rectAreaLength = rectAreaLength;\n\t\t\thash.hemiLength = hemiLength;\n\n\t\t\thash.numDirectionalShadows = numDirectionalShadows;\n\t\t\thash.numPointShadows = numPointShadows;\n\t\t\thash.numSpotShadows = numSpotShadows;\n\n\t\t\tstate.version = nextVersion ++;\n\n\t\t}\n\n\t}\n\n\treturn {\n\t\tsetup: setup,\n\t\tstate: state\n\t};\n\n}\n\n/**\n * @author Mugen87 / https://github.com/Mugen87\n */\n\nfunction WebGLRenderState() {\n\n\tvar lights = new WebGLLights();\n\n\tvar lightsArray = [];\n\tvar shadowsArray = [];\n\n\tfunction init() {\n\n\t\tlightsArray.length = 0;\n\t\tshadowsArray.length = 0;\n\n\t}\n\n\tfunction pushLight( light ) {\n\n\t\tlightsArray.push( light );\n\n\t}\n\n\tfunction pushShadow( shadowLight ) {\n\n\t\tshadowsArray.push( shadowLight );\n\n\t}\n\n\tfunction setupLights( camera ) {\n\n\t\tlights.setup( lightsArray, shadowsArray, camera );\n\n\t}\n\n\tvar state = {\n\t\tlightsArray: lightsArray,\n\t\tshadowsArray: shadowsArray,\n\n\t\tlights: lights\n\t};\n\n\treturn {\n\t\tinit: init,\n\t\tstate: state,\n\t\tsetupLights: setupLights,\n\n\t\tpushLight: pushLight,\n\t\tpushShadow: pushShadow\n\t};\n\n}\n\nfunction WebGLRenderStates() {\n\n\tvar renderStates = new WeakMap();\n\n\tfunction onSceneDispose( event ) {\n\n\t\tvar scene = event.target;\n\n\t\tscene.removeEventListener( 'dispose', onSceneDispose );\n\n\t\trenderStates.delete( scene );\n\n\t}\n\n\tfunction get( scene, camera ) {\n\n\t\tvar renderState;\n\n\t\tif ( renderStates.has( scene ) === false ) {\n\n\t\t\trenderState = new WebGLRenderState();\n\t\t\trenderStates.set( scene, new WeakMap() );\n\t\t\trenderStates.get( scene ).set( camera, renderState );\n\n\t\t\tscene.addEventListener( 'dispose', onSceneDispose );\n\n\t\t} else {\n\n\t\t\tif ( renderStates.get( scene ).has( camera ) === false ) {\n\n\t\t\t\trenderState = new WebGLRenderState();\n\t\t\t\trenderStates.get( scene ).set( camera, renderState );\n\n\t\t\t} else {\n\n\t\t\t\trenderState = renderStates.get( scene ).get( camera );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn renderState;\n\n\t}\n\n\tfunction dispose() {\n\n\t\trenderStates = new WeakMap();\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tdispose: dispose\n\t};\n\n}\n\n/**\n * @author mrdoob / http://mrdoob.com/\n * @author alteredq / http://alteredqualia.com/\n * @author bhouston / https://clara.io\n * @author WestLangley / http://github.com/WestLangley\n *\n * parameters = {\n *\n * opacity: ,\n *\n * map: new THREE.Texture( ),\n *\n * alphaMap: new THREE.Texture( ),\n *\n * displacementMap: new THREE.Texture( ),\n * displacementScale: ,\n * displacementBias: ,\n *\n * wireframe: ,\n * wireframeLinewidth: \n * }\n */\n\nfunction MeshDepthMaterial( parameters ) {\n\n\tMaterial.call( this );\n\n\tthis.type = 'MeshDepthMaterial';\n\n\tthis.depthPacking = BasicDepthPacking;\n\n\tthis.skinning = false;\n\tthis.morphTargets = false;\n\n\tthis.map = null;\n\n\tthis.alphaMap = null;\n\n\tthis.displacementMap = null;\n\tthis.displacementScale = 1;\n\tthis.displacementBias = 0;\n\n\tthis.wireframe = false;\n\tthis.wireframeLinewidth = 1;\n\n\tthis.fog = false;\n\n\tthis.setValues( parameters );\n\n}\n\nMeshDepthMaterial.prototype = Object.create( Material.prototype );\nMeshDepthMaterial.prototype.constructor = MeshDepthMaterial;\n\nMeshDepthMaterial.prototype.isMeshDepthMaterial = true;\n\nMeshDepthMaterial.prototype.copy = function ( source ) {\n\n\tMaterial.prototype.copy.call( this, source );\n\n\tthis.depthPacking = source.depthPacking;\n\n\tthis.skinning = source.skinning;\n\tthis.morphTargets = source.morphTargets;\n\n\tthis.map = source.map;\n\n\tthis.alphaMap = source.alphaMap;\n\n\tthis.displacementMap = source.displacementMap;\n\tthis.displacementScale = source.displacementScale;\n\tthis.displacementBias = source.displacementBias;\n\n\tthis.wireframe = source.wireframe;\n\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\n\treturn this;\n\n};\n\n/**\n * @author WestLangley / http://github.com/WestLangley\n *\n * parameters = {\n *\n * referencePosition: ,\n * nearDistance: ,\n * farDistance: ,\n *\n * skinning: ,\n * morphTargets: ,\n *\n * map: new THREE.Texture( ),\n *\n * alphaMap: new THREE.Texture( ),\n *\n * displacementMap: new THREE.Texture( ),\n * displacementScale: ,\n * displacementBias: \n *\n * }\n */\n\nfunction MeshDistanceMaterial( parameters ) {\n\n\tMaterial.call( this );\n\n\tthis.type = 'MeshDistanceMaterial';\n\n\tthis.referencePosition = new Vector3();\n\tthis.nearDistance = 1;\n\tthis.farDistance = 1000;\n\n\tthis.skinning = false;\n\tthis.morphTargets = false;\n\n\tthis.map = null;\n\n\tthis.alphaMap = null;\n\n\tthis.displacementMap = null;\n\tthis.displacementScale = 1;\n\tthis.displacementBias = 0;\n\n\tthis.fog = false;\n\n\tthis.setValues( parameters );\n\n}\n\nMeshDistanceMaterial.prototype = Object.create( Material.prototype );\nMeshDistanceMaterial.prototype.constructor = MeshDistanceMaterial;\n\nMeshDistanceMaterial.prototype.isMeshDistanceMaterial = true;\n\nMeshDistanceMaterial.prototype.copy = function ( source ) {\n\n\tMaterial.prototype.copy.call( this, source );\n\n\tthis.referencePosition.copy( source.referencePosition );\n\tthis.nearDistance = source.nearDistance;\n\tthis.farDistance = source.farDistance;\n\n\tthis.skinning = source.skinning;\n\tthis.morphTargets = source.morphTargets;\n\n\tthis.map = source.map;\n\n\tthis.alphaMap = source.alphaMap;\n\n\tthis.displacementMap = source.displacementMap;\n\tthis.displacementScale = source.displacementScale;\n\tthis.displacementBias = source.displacementBias;\n\n\treturn this;\n\n};\n\nvar vsm_frag = \"uniform sampler2D shadow_pass;\\nuniform vec2 resolution;\\nuniform float radius;\\n#include \\nvoid main() {\\n float mean = 0.0;\\n float squared_mean = 0.0;\\n\\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\\n for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\\n #ifdef HORIZONAL_PASS\\n vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\\n mean += distribution.x;\\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\\n #else\\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\\n mean += depth;\\n squared_mean += depth * depth;\\n #endif\\n }\\n mean = mean * HALF_SAMPLE_RATE;\\n squared_mean = squared_mean * HALF_SAMPLE_RATE;\\n float std_dev = sqrt( squared_mean - mean * mean );\\n gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\\n}\";\n\nvar vsm_vert = \"void main() {\\n\\tgl_Position = vec4( position, 1.0 );\\n}\";\n\n/**\n * @author alteredq / http://alteredqualia.com/\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction WebGLShadowMap( _renderer, _objects, maxTextureSize ) {\n\n\tvar _frustum = new Frustum(),\n\n\t\t_shadowMapSize = new Vector2(),\n\t\t_viewportSize = new Vector2(),\n\n\t\t_viewport = new Vector4(),\n\n\t\t_depthMaterials = [],\n\t\t_distanceMaterials = [],\n\n\t\t_materialCache = {};\n\n\tvar shadowSide = { 0: BackSide, 1: FrontSide, 2: DoubleSide };\n\n\tvar shadowMaterialVertical = new ShaderMaterial( {\n\n\t\tdefines: {\n\t\t\tSAMPLE_RATE: 2.0 / 8.0,\n\t\t\tHALF_SAMPLE_RATE: 1.0 / 8.0\n\t\t},\n\n\t\tuniforms: {\n\t\t\tshadow_pass: { value: null },\n\t\t\tresolution: { value: new Vector2() },\n\t\t\tradius: { value: 4.0 }\n\t\t},\n\n\t\tvertexShader: vsm_vert,\n\n\t\tfragmentShader: vsm_frag\n\n\t} );\n\n\tvar shadowMaterialHorizonal = shadowMaterialVertical.clone();\n\tshadowMaterialHorizonal.defines.HORIZONAL_PASS = 1;\n\n\tvar fullScreenTri = new BufferGeometry();\n\tfullScreenTri.setAttribute(\n\t\t\"position\",\n\t\tnew BufferAttribute(\n\t\t\tnew Float32Array( [ - 1, - 1, 0.5, 3, - 1, 0.5, - 1, 3, 0.5 ] ),\n\t\t\t3\n\t\t)\n\t);\n\n\tvar fullScreenMesh = new Mesh( fullScreenTri, shadowMaterialVertical );\n\n\tvar scope = this;\n\n\tthis.enabled = false;\n\n\tthis.autoUpdate = true;\n\tthis.needsUpdate = false;\n\n\tthis.type = PCFShadowMap;\n\n\tthis.render = function ( lights, scene, camera ) {\n\n\t\tif ( scope.enabled === false ) return;\n\t\tif ( scope.autoUpdate === false && scope.needsUpdate === false ) return;\n\n\t\tif ( lights.length === 0 ) return;\n\n\t\tvar currentRenderTarget = _renderer.getRenderTarget();\n\t\tvar activeCubeFace = _renderer.getActiveCubeFace();\n\t\tvar activeMipmapLevel = _renderer.getActiveMipmapLevel();\n\n\t\tvar _state = _renderer.state;\n\n\t\t// Set GL state for depth map.\n\t\t_state.setBlending( NoBlending );\n\t\t_state.buffers.color.setClear( 1, 1, 1, 1 );\n\t\t_state.buffers.depth.setTest( true );\n\t\t_state.setScissorTest( false );\n\n\t\t// render depth map\n\n\t\tfor ( var i = 0, il = lights.length; i < il; i ++ ) {\n\n\t\t\tvar light = lights[ i ];\n\t\t\tvar shadow = light.shadow;\n\n\t\t\tif ( shadow === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLShadowMap:', light, 'has no shadow.' );\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\t_shadowMapSize.copy( shadow.mapSize );\n\n\t\t\tvar shadowFrameExtents = shadow.getFrameExtents();\n\n\t\t\t_shadowMapSize.multiply( shadowFrameExtents );\n\n\t\t\t_viewportSize.copy( shadow.mapSize );\n\n\t\t\tif ( _shadowMapSize.x > maxTextureSize || _shadowMapSize.y > maxTextureSize ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLShadowMap:', light, 'has shadow exceeding max texture size, reducing' );\n\n\t\t\t\tif ( _shadowMapSize.x > maxTextureSize ) {\n\n\t\t\t\t\t_viewportSize.x = Math.floor( maxTextureSize / shadowFrameExtents.x );\n\t\t\t\t\t_shadowMapSize.x = _viewportSize.x * shadowFrameExtents.x;\n\t\t\t\t\tshadow.mapSize.x = _viewportSize.x;\n\n\t\t\t\t}\n\n\t\t\t\tif ( _shadowMapSize.y > maxTextureSize ) {\n\n\t\t\t\t\t_viewportSize.y = Math.floor( maxTextureSize / shadowFrameExtents.y );\n\t\t\t\t\t_shadowMapSize.y = _viewportSize.y * shadowFrameExtents.y;\n\t\t\t\t\tshadow.mapSize.y = _viewportSize.y;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( shadow.map === null && ! shadow.isPointLightShadow && this.type === VSMShadowMap ) {\n\n\t\t\t\tvar pars = { minFilter: LinearFilter, magFilter: LinearFilter, format: RGBAFormat };\n\n\t\t\t\tshadow.map = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y, pars );\n\t\t\t\tshadow.map.texture.name = light.name + \".shadowMap\";\n\n\t\t\t\tshadow.mapPass = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y, pars );\n\n\t\t\t\tshadow.camera.updateProjectionMatrix();\n\n\t\t\t}\n\n\t\t\tif ( shadow.map === null ) {\n\n\t\t\t\tvar pars = { minFilter: NearestFilter, magFilter: NearestFilter, format: RGBAFormat };\n\n\t\t\t\tshadow.map = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y, pars );\n\t\t\t\tshadow.map.texture.name = light.name + \".shadowMap\";\n\n\t\t\t\tshadow.camera.updateProjectionMatrix();\n\n\t\t\t}\n\n\t\t\t_renderer.setRenderTarget( shadow.map );\n\t\t\t_renderer.clear();\n\n\t\t\tvar viewportCount = shadow.getViewportCount();\n\n\t\t\tfor ( var vp = 0; vp < viewportCount; vp ++ ) {\n\n\t\t\t\tvar viewport = shadow.getViewport( vp );\n\n\t\t\t\t_viewport.set(\n\t\t\t\t\t_viewportSize.x * viewport.x,\n\t\t\t\t\t_viewportSize.y * viewport.y,\n\t\t\t\t\t_viewportSize.x * viewport.z,\n\t\t\t\t\t_viewportSize.y * viewport.w\n\t\t\t\t);\n\n\t\t\t\t_state.viewport( _viewport );\n\n\t\t\t\tshadow.updateMatrices( light, vp );\n\n\t\t\t\t_frustum = shadow.getFrustum();\n\n\t\t\t\trenderObject( scene, camera, shadow.camera, light, this.type );\n\n\t\t\t}\n\n\t\t\t// do blur pass for VSM\n\n\t\t\tif ( ! shadow.isPointLightShadow && this.type === VSMShadowMap ) {\n\n\t\t\t\tVSMPass( shadow, camera );\n\n\t\t\t}\n\n\t\t}\n\n\t\tscope.needsUpdate = false;\n\n\t\t_renderer.setRenderTarget( currentRenderTarget, activeCubeFace, activeMipmapLevel );\n\n\t};\n\n\tfunction VSMPass( shadow, camera ) {\n\n\t\tvar geometry = _objects.update( fullScreenMesh );\n\n\t\t// vertical pass\n\n\t\tshadowMaterialVertical.uniforms.shadow_pass.value = shadow.map.texture;\n\t\tshadowMaterialVertical.uniforms.resolution.value = shadow.mapSize;\n\t\tshadowMaterialVertical.uniforms.radius.value = shadow.radius;\n\t\t_renderer.setRenderTarget( shadow.mapPass );\n\t\t_renderer.clear();\n\t\t_renderer.renderBufferDirect( camera, null, geometry, shadowMaterialVertical, fullScreenMesh, null );\n\n\t\t// horizonal pass\n\n\t\tshadowMaterialHorizonal.uniforms.shadow_pass.value = shadow.mapPass.texture;\n\t\tshadowMaterialHorizonal.uniforms.resolution.value = shadow.mapSize;\n\t\tshadowMaterialHorizonal.uniforms.radius.value = shadow.radius;\n\t\t_renderer.setRenderTarget( shadow.map );\n\t\t_renderer.clear();\n\t\t_renderer.renderBufferDirect( camera, null, geometry, shadowMaterialHorizonal, fullScreenMesh, null );\n\n\t}\n\n\tfunction getDepthMaterialVariant( useMorphing, useSkinning, useInstancing ) {\n\n\t\tvar index = useMorphing << 0 | useSkinning << 1 | useInstancing << 2;\n\n\t\tvar material = _depthMaterials[ index ];\n\n\t\tif ( material === undefined ) {\n\n\t\t\tmaterial = new MeshDepthMaterial( {\n\n\t\t\t\tdepthPacking: RGBADepthPacking,\n\n\t\t\t\tmorphTargets: useMorphing,\n\t\t\t\tskinning: useSkinning\n\n\t\t\t} );\n\n\t\t\t_depthMaterials[ index ] = material;\n\n\t\t}\n\n\t\treturn material;\n\n\t}\n\n\tfunction getDistanceMaterialVariant( useMorphing, useSkinning, useInstancing ) {\n\n\t\tvar index = useMorphing << 0 | useSkinning << 1 | useInstancing << 2;\n\n\t\tvar material = _distanceMaterials[ index ];\n\n\t\tif ( material === undefined ) {\n\n\t\t\tmaterial = new MeshDistanceMaterial( {\n\n\t\t\t\tmorphTargets: useMorphing,\n\t\t\t\tskinning: useSkinning\n\n\t\t\t} );\n\n\t\t\t_distanceMaterials[ index ] = material;\n\n\t\t}\n\n\t\treturn material;\n\n\t}\n\n\tfunction getDepthMaterial( object, material, light, shadowCameraNear, shadowCameraFar, type ) {\n\n\t\tvar geometry = object.geometry;\n\n\t\tvar result = null;\n\n\t\tvar getMaterialVariant = getDepthMaterialVariant;\n\t\tvar customMaterial = object.customDepthMaterial;\n\n\t\tif ( light.isPointLight === true ) {\n\n\t\t\tgetMaterialVariant = getDistanceMaterialVariant;\n\t\t\tcustomMaterial = object.customDistanceMaterial;\n\n\t\t}\n\n\t\tif ( customMaterial === undefined ) {\n\n\t\t\tvar useMorphing = false;\n\n\t\t\tif ( material.morphTargets === true ) {\n\n\t\t\t\tif ( geometry.isBufferGeometry === true ) {\n\n\t\t\t\t\tuseMorphing = geometry.morphAttributes && geometry.morphAttributes.position && geometry.morphAttributes.position.length > 0;\n\n\t\t\t\t} else if ( geometry.isGeometry === true ) {\n\n\t\t\t\t\tuseMorphing = geometry.morphTargets && geometry.morphTargets.length > 0;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tvar useSkinning = false;\n\n\t\t\tif ( object.isSkinnedMesh === true ) {\n\n\t\t\t\tif ( material.skinning === true ) {\n\n\t\t\t\t\tuseSkinning = true;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.warn( 'THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:', object );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tvar useInstancing = object.isInstancedMesh === true;\n\n\t\t\tresult = getMaterialVariant( useMorphing, useSkinning, useInstancing );\n\n\t\t} else {\n\n\t\t\tresult = customMaterial;\n\n\t\t}\n\n\t\tif ( _renderer.localClippingEnabled &&\n\t\t\t\tmaterial.clipShadows === true &&\n\t\t\t\tmaterial.clippingPlanes.length !== 0 ) {\n\n\t\t\t// in this case we need a unique material instance reflecting the\n\t\t\t// appropriate state\n\n\t\t\tvar keyA = result.uuid, keyB = material.uuid;\n\n\t\t\tvar materialsForVariant = _materialCache[ keyA ];\n\n\t\t\tif ( materialsForVariant === undefined ) {\n\n\t\t\t\tmaterialsForVariant = {};\n\t\t\t\t_materialCache[ keyA ] = materialsForVariant;\n\n\t\t\t}\n\n\t\t\tvar cachedMaterial = materialsForVariant[ keyB ];\n\n\t\t\tif ( cachedMaterial === undefined ) {\n\n\t\t\t\tcachedMaterial = result.clone();\n\t\t\t\tmaterialsForVariant[ keyB ] = cachedMaterial;\n\n\t\t\t}\n\n\t\t\tresult = cachedMaterial;\n\n\t\t}\n\n\t\tresult.visible = material.visible;\n\t\tresult.wireframe = material.wireframe;\n\n\t\tif ( type === VSMShadowMap ) {\n\n\t\t\tresult.side = ( material.shadowSide !== null ) ? material.shadowSide : material.side;\n\n\t\t} else {\n\n\t\t\tresult.side = ( material.shadowSide !== null ) ? material.shadowSide : shadowSide[ material.side ];\n\n\t\t}\n\n\t\tresult.clipShadows = material.clipShadows;\n\t\tresult.clippingPlanes = material.clippingPlanes;\n\t\tresult.clipIntersection = material.clipIntersection;\n\n\t\tresult.wireframeLinewidth = material.wireframeLinewidth;\n\t\tresult.linewidth = material.linewidth;\n\n\t\tif ( light.isPointLight === true && result.isMeshDistanceMaterial === true ) {\n\n\t\t\tresult.referencePosition.setFromMatrixPosition( light.matrixWorld );\n\t\t\tresult.nearDistance = shadowCameraNear;\n\t\t\tresult.farDistance = shadowCameraFar;\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\tfunction renderObject( object, camera, shadowCamera, light, type ) {\n\n\t\tif ( object.visible === false ) return;\n\n\t\tvar visible = object.layers.test( camera.layers );\n\n\t\tif ( visible && ( object.isMesh || object.isLine || object.isPoints ) ) {\n\n\t\t\tif ( ( object.castShadow || ( object.receiveShadow && type === VSMShadowMap ) ) && ( ! object.frustumCulled || _frustum.intersectsObject( object ) ) ) {\n\n\t\t\t\tobject.modelViewMatrix.multiplyMatrices( shadowCamera.matrixWorldInverse, object.matrixWorld );\n\n\t\t\t\tvar geometry = _objects.update( object );\n\t\t\t\tvar material = object.material;\n\n\t\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\t\tvar groups = geometry.groups;\n\n\t\t\t\t\tfor ( var k = 0, kl = groups.length; k < kl; k ++ ) {\n\n\t\t\t\t\t\tvar group = groups[ k ];\n\t\t\t\t\t\tvar groupMaterial = material[ group.materialIndex ];\n\n\t\t\t\t\t\tif ( groupMaterial && groupMaterial.visible ) {\n\n\t\t\t\t\t\t\tvar depthMaterial = getDepthMaterial( object, groupMaterial, light, shadowCamera.near, shadowCamera.far, type );\n\n\t\t\t\t\t\t\t_renderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, group );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( material.visible ) {\n\n\t\t\t\t\tvar depthMaterial = getDepthMaterial( object, material, light, shadowCamera.near, shadowCamera.far, type );\n\n\t\t\t\t\t_renderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, null );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tvar children = object.children;\n\n\t\tfor ( var i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\trenderObject( children[ i ], camera, shadowCamera, light, type );\n\n\t\t}\n\n\t}\n\n}\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction WebGLState( gl, extensions, capabilities ) {\n\n\tvar isWebGL2 = capabilities.isWebGL2;\n\n\tfunction ColorBuffer() {\n\n\t\tvar locked = false;\n\n\t\tvar color = new Vector4();\n\t\tvar currentColorMask = null;\n\t\tvar currentColorClear = new Vector4( 0, 0, 0, 0 );\n\n\t\treturn {\n\n\t\t\tsetMask: function ( colorMask ) {\n\n\t\t\t\tif ( currentColorMask !== colorMask && ! locked ) {\n\n\t\t\t\t\tgl.colorMask( colorMask, colorMask, colorMask, colorMask );\n\t\t\t\t\tcurrentColorMask = colorMask;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetLocked: function ( lock ) {\n\n\t\t\t\tlocked = lock;\n\n\t\t\t},\n\n\t\t\tsetClear: function ( r, g, b, a, premultipliedAlpha ) {\n\n\t\t\t\tif ( premultipliedAlpha === true ) {\n\n\t\t\t\t\tr *= a; g *= a; b *= a;\n\n\t\t\t\t}\n\n\t\t\t\tcolor.set( r, g, b, a );\n\n\t\t\t\tif ( currentColorClear.equals( color ) === false ) {\n\n\t\t\t\t\tgl.clearColor( r, g, b, a );\n\t\t\t\t\tcurrentColorClear.copy( color );\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\treset: function () {\n\n\t\t\t\tlocked = false;\n\n\t\t\t\tcurrentColorMask = null;\n\t\t\t\tcurrentColorClear.set( - 1, 0, 0, 0 ); // set to invalid state\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\tfunction DepthBuffer() {\n\n\t\tvar locked = false;\n\n\t\tvar currentDepthMask = null;\n\t\tvar currentDepthFunc = null;\n\t\tvar currentDepthClear = null;\n\n\t\treturn {\n\n\t\t\tsetTest: function ( depthTest ) {\n\n\t\t\t\tif ( depthTest ) {\n\n\t\t\t\t\tenable( 2929 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tdisable( 2929 );\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetMask: function ( depthMask ) {\n\n\t\t\t\tif ( currentDepthMask !== depthMask && ! locked ) {\n\n\t\t\t\t\tgl.depthMask( depthMask );\n\t\t\t\t\tcurrentDepthMask = depthMask;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetFunc: function ( depthFunc ) {\n\n\t\t\t\tif ( currentDepthFunc !== depthFunc ) {\n\n\t\t\t\t\tif ( depthFunc ) {\n\n\t\t\t\t\t\tswitch ( depthFunc ) {\n\n\t\t\t\t\t\t\tcase NeverDepth:\n\n\t\t\t\t\t\t\t\tgl.depthFunc( 512 );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase AlwaysDepth:\n\n\t\t\t\t\t\t\t\tgl.depthFunc( 519 );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase LessDepth:\n\n\t\t\t\t\t\t\t\tgl.depthFunc( 513 );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase LessEqualDepth:\n\n\t\t\t\t\t\t\t\tgl.depthFunc( 515 );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase EqualDepth:\n\n\t\t\t\t\t\t\t\tgl.depthFunc( 514 );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase GreaterEqualDepth:\n\n\t\t\t\t\t\t\t\tgl.depthFunc( 518 );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase GreaterDepth:\n\n\t\t\t\t\t\t\t\tgl.depthFunc( 516 );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase NotEqualDepth:\n\n\t\t\t\t\t\t\t\tgl.depthFunc( 517 );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tdefault:\n\n\t\t\t\t\t\t\t\tgl.depthFunc( 515 );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tgl.depthFunc( 515 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tcurrentDepthFunc = depthFunc;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetLocked: function ( lock ) {\n\n\t\t\t\tlocked = lock;\n\n\t\t\t},\n\n\t\t\tsetClear: function ( depth ) {\n\n\t\t\t\tif ( currentDepthClear !== depth ) {\n\n\t\t\t\t\tgl.clearDepth( depth );\n\t\t\t\t\tcurrentDepthClear = depth;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\treset: function () {\n\n\t\t\t\tlocked = false;\n\n\t\t\t\tcurrentDepthMask = null;\n\t\t\t\tcurrentDepthFunc = null;\n\t\t\t\tcurrentDepthClear = null;\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\tfunction StencilBuffer() {\n\n\t\tvar locked = false;\n\n\t\tvar currentStencilMask = null;\n\t\tvar currentStencilFunc = null;\n\t\tvar currentStencilRef = null;\n\t\tvar currentStencilFuncMask = null;\n\t\tvar currentStencilFail = null;\n\t\tvar currentStencilZFail = null;\n\t\tvar currentStencilZPass = null;\n\t\tvar currentStencilClear = null;\n\n\t\treturn {\n\n\t\t\tsetTest: function ( stencilTest ) {\n\n\t\t\t\tif ( ! locked ) {\n\n\t\t\t\t\tif ( stencilTest ) {\n\n\t\t\t\t\t\tenable( 2960 );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tdisable( 2960 );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetMask: function ( stencilMask ) {\n\n\t\t\t\tif ( currentStencilMask !== stencilMask && ! locked ) {\n\n\t\t\t\t\tgl.stencilMask( stencilMask );\n\t\t\t\t\tcurrentStencilMask = stencilMask;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetFunc: function ( stencilFunc, stencilRef, stencilMask ) {\n\n\t\t\t\tif ( currentStencilFunc !== stencilFunc ||\n\t\t\t\t currentStencilRef \t!== stencilRef \t||\n\t\t\t\t currentStencilFuncMask !== stencilMask ) {\n\n\t\t\t\t\tgl.stencilFunc( stencilFunc, stencilRef, stencilMask );\n\n\t\t\t\t\tcurrentStencilFunc = stencilFunc;\n\t\t\t\t\tcurrentStencilRef = stencilRef;\n\t\t\t\t\tcurrentStencilFuncMask = stencilMask;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetOp: function ( stencilFail, stencilZFail, stencilZPass ) {\n\n\t\t\t\tif ( currentStencilFail\t !== stencilFail \t||\n\t\t\t\t currentStencilZFail !== stencilZFail ||\n\t\t\t\t currentStencilZPass !== stencilZPass ) {\n\n\t\t\t\t\tgl.stencilOp( stencilFail, stencilZFail, stencilZPass );\n\n\t\t\t\t\tcurrentStencilFail = stencilFail;\n\t\t\t\t\tcurrentStencilZFail = stencilZFail;\n\t\t\t\t\tcurrentStencilZPass = stencilZPass;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetLocked: function ( lock ) {\n\n\t\t\t\tlocked = lock;\n\n\t\t\t},\n\n\t\t\tsetClear: function ( stencil ) {\n\n\t\t\t\tif ( currentStencilClear !== stencil ) {\n\n\t\t\t\t\tgl.clearStencil( stencil );\n\t\t\t\t\tcurrentStencilClear = stencil;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\treset: function () {\n\n\t\t\t\tlocked = false;\n\n\t\t\t\tcurrentStencilMask = null;\n\t\t\t\tcurrentStencilFunc = null;\n\t\t\t\tcurrentStencilRef = null;\n\t\t\t\tcurrentStencilFuncMask = null;\n\t\t\t\tcurrentStencilFail = null;\n\t\t\t\tcurrentStencilZFail = null;\n\t\t\t\tcurrentStencilZPass = null;\n\t\t\t\tcurrentStencilClear = null;\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\t//\n\n\tvar colorBuffer = new ColorBuffer();\n\tvar depthBuffer = new DepthBuffer();\n\tvar stencilBuffer = new StencilBuffer();\n\n\tvar maxVertexAttributes = gl.getParameter( 34921 );\n\tvar newAttributes = new Uint8Array( maxVertexAttributes );\n\tvar enabledAttributes = new Uint8Array( maxVertexAttributes );\n\tvar attributeDivisors = new Uint8Array( maxVertexAttributes );\n\n\tvar enabledCapabilities = {};\n\n\tvar currentProgram = null;\n\n\tvar currentBlendingEnabled = null;\n\tvar currentBlending = null;\n\tvar currentBlendEquation = null;\n\tvar currentBlendSrc = null;\n\tvar currentBlendDst = null;\n\tvar currentBlendEquationAlpha = null;\n\tvar currentBlendSrcAlpha = null;\n\tvar currentBlendDstAlpha = null;\n\tvar currentPremultipledAlpha = false;\n\n\tvar currentFlipSided = null;\n\tvar currentCullFace = null;\n\n\tvar currentLineWidth = null;\n\n\tvar currentPolygonOffsetFactor = null;\n\tvar currentPolygonOffsetUnits = null;\n\n\tvar maxTextures = gl.getParameter( 35661 );\n\n\tvar lineWidthAvailable = false;\n\tvar version = 0;\n\tvar glVersion = gl.getParameter( 7938 );\n\n\tif ( glVersion.indexOf( 'WebGL' ) !== - 1 ) {\n\n\t\tversion = parseFloat( /^WebGL\\ ([0-9])/.exec( glVersion )[ 1 ] );\n\t\tlineWidthAvailable = ( version >= 1.0 );\n\n\t} else if ( glVersion.indexOf( 'OpenGL ES' ) !== - 1 ) {\n\n\t\tversion = parseFloat( /^OpenGL\\ ES\\ ([0-9])/.exec( glVersion )[ 1 ] );\n\t\tlineWidthAvailable = ( version >= 2.0 );\n\n\t}\n\n\tvar currentTextureSlot = null;\n\tvar currentBoundTextures = {};\n\n\tvar currentScissor = new Vector4();\n\tvar currentViewport = new Vector4();\n\n\tfunction createTexture( type, target, count ) {\n\n\t\tvar data = new Uint8Array( 4 ); // 4 is required to match default unpack alignment of 4.\n\t\tvar texture = gl.createTexture();\n\n\t\tgl.bindTexture( type, texture );\n\t\tgl.texParameteri( type, 10241, 9728 );\n\t\tgl.texParameteri( type, 10240, 9728 );\n\n\t\tfor ( var i = 0; i < count; i ++ ) {\n\n\t\t\tgl.texImage2D( target + i, 0, 6408, 1, 1, 0, 6408, 5121, data );\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n\tvar emptyTextures = {};\n\temptyTextures[ 3553 ] = createTexture( 3553, 3553, 1 );\n\temptyTextures[ 34067 ] = createTexture( 34067, 34069, 6 );\n\n\t// init\n\n\tcolorBuffer.setClear( 0, 0, 0, 1 );\n\tdepthBuffer.setClear( 1 );\n\tstencilBuffer.setClear( 0 );\n\n\tenable( 2929 );\n\tdepthBuffer.setFunc( LessEqualDepth );\n\n\tsetFlipSided( false );\n\tsetCullFace( CullFaceBack );\n\tenable( 2884 );\n\n\tsetBlending( NoBlending );\n\n\t//\n\n\tfunction initAttributes() {\n\n\t\tfor ( var i = 0, l = newAttributes.length; i < l; i ++ ) {\n\n\t\t\tnewAttributes[ i ] = 0;\n\n\t\t}\n\n\t}\n\n\tfunction enableAttribute( attribute ) {\n\n\t\tenableAttributeAndDivisor( attribute, 0 );\n\n\t}\n\n\tfunction enableAttributeAndDivisor( attribute, meshPerAttribute ) {\n\n\t\tnewAttributes[ attribute ] = 1;\n\n\t\tif ( enabledAttributes[ attribute ] === 0 ) {\n\n\t\t\tgl.enableVertexAttribArray( attribute );\n\t\t\tenabledAttributes[ attribute ] = 1;\n\n\t\t}\n\n\t\tif ( attributeDivisors[ attribute ] !== meshPerAttribute ) {\n\n\t\t\tvar extension = isWebGL2 ? gl : extensions.get( 'ANGLE_instanced_arrays' );\n\n\t\t\textension[ isWebGL2 ? 'vertexAttribDivisor' : 'vertexAttribDivisorANGLE' ]( attribute, meshPerAttribute );\n\t\t\tattributeDivisors[ attribute ] = meshPerAttribute;\n\n\t\t}\n\n\t}\n\n\tfunction disableUnusedAttributes() {\n\n\t\tfor ( var i = 0, l = enabledAttributes.length; i !== l; ++ i ) {\n\n\t\t\tif ( enabledAttributes[ i ] !== newAttributes[ i ] ) {\n\n\t\t\t\tgl.disableVertexAttribArray( i );\n\t\t\t\tenabledAttributes[ i ] = 0;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction enable( id ) {\n\n\t\tif ( enabledCapabilities[ id ] !== true ) {\n\n\t\t\tgl.enable( id );\n\t\t\tenabledCapabilities[ id ] = true;\n\n\t\t}\n\n\t}\n\n\tfunction disable( id ) {\n\n\t\tif ( enabledCapabilities[ id ] !== false ) {\n\n\t\t\tgl.disable( id );\n\t\t\tenabledCapabilities[ id ] = false;\n\n\t\t}\n\n\t}\n\n\tfunction useProgram( program ) {\n\n\t\tif ( currentProgram !== program ) {\n\n\t\t\tgl.useProgram( program );\n\n\t\t\tcurrentProgram = program;\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\treturn false;\n\n\t}\n\n\tvar equationToGL = {\n\t\t[ AddEquation ]: 32774,\n\t\t[ SubtractEquation ]: 32778,\n\t\t[ ReverseSubtractEquation ]: 32779\n\t};\n\n\tif ( isWebGL2 ) {\n\n\t\tequationToGL[ MinEquation ] = 32775;\n\t\tequationToGL[ MaxEquation ] = 32776;\n\n\t} else {\n\n\t\tvar extension = extensions.get( 'EXT_blend_minmax' );\n\n\t\tif ( extension !== null ) {\n\n\t\t\tequationToGL[ MinEquation ] = extension.MIN_EXT;\n\t\t\tequationToGL[ MaxEquation ] = extension.MAX_EXT;\n\n\t\t}\n\n\t}\n\n\tvar factorToGL = {\n\t\t[ ZeroFactor ]: 0,\n\t\t[ OneFactor ]: 1,\n\t\t[ SrcColorFactor ]: 768,\n\t\t[ SrcAlphaFactor ]: 770,\n\t\t[ SrcAlphaSaturateFactor ]: 776,\n\t\t[ DstColorFactor ]: 774,\n\t\t[ DstAlphaFactor ]: 772,\n\t\t[ OneMinusSrcColorFactor ]: 769,\n\t\t[ OneMinusSrcAlphaFactor ]: 771,\n\t\t[ OneMinusDstColorFactor ]: 775,\n\t\t[ OneMinusDstAlphaFactor ]: 773\n\t};\n\n\tfunction setBlending( blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha, premultipliedAlpha ) {\n\n\t\tif ( blending === NoBlending ) {\n\n\t\t\tif ( currentBlendingEnabled ) {\n\n\t\t\t\tdisable( 3042 );\n\t\t\t\tcurrentBlendingEnabled = false;\n\n\t\t\t}\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( ! currentBlendingEnabled ) {\n\n\t\t\tenable( 3042 );\n\t\t\tcurrentBlendingEnabled = true;\n\n\t\t}\n\n\t\tif ( blending !== CustomBlending ) {\n\n\t\t\tif ( blending !== currentBlending || premultipliedAlpha !== currentPremultipledAlpha ) {\n\n\t\t\t\tif ( currentBlendEquation !== AddEquation || currentBlendEquationAlpha !== AddEquation ) {\n\n\t\t\t\t\tgl.blendEquation( 32774 );\n\n\t\t\t\t\tcurrentBlendEquation = AddEquation;\n\t\t\t\t\tcurrentBlendEquationAlpha = AddEquation;\n\n\t\t\t\t}\n\n\t\t\t\tif ( premultipliedAlpha ) {\n\n\t\t\t\t\tswitch ( blending ) {\n\n\t\t\t\t\t\tcase NormalBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( 1, 771, 1, 771 );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase AdditiveBlending:\n\t\t\t\t\t\t\tgl.blendFunc( 1, 1 );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase SubtractiveBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( 0, 0, 769, 771 );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase MultiplyBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( 0, 768, 0, 770 );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tconsole.error( 'THREE.WebGLState: Invalid blending: ', blending );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tswitch ( blending ) {\n\n\t\t\t\t\t\tcase NormalBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( 770, 771, 1, 771 );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase AdditiveBlending:\n\t\t\t\t\t\t\tgl.blendFunc( 770, 1 );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase SubtractiveBlending:\n\t\t\t\t\t\t\tgl.blendFunc( 0, 769 );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase MultiplyBlending:\n\t\t\t\t\t\t\tgl.blendFunc( 0, 768 );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tconsole.error( 'THREE.WebGLState: Invalid blending: ', blending );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tcurrentBlendSrc = null;\n\t\t\t\tcurrentBlendDst = null;\n\t\t\t\tcurrentBlendSrcAlpha = null;\n\t\t\t\tcurrentBlendDstAlpha = null;\n\n\t\t\t\tcurrentBlending = blending;\n\t\t\t\tcurrentPremultipledAlpha = premultipliedAlpha;\n\n\t\t\t}\n\n\t\t\treturn;\n\n\t\t}\n\n\t\t// custom blending\n\n\t\tblendEquationAlpha = blendEquationAlpha || blendEquation;\n\t\tblendSrcAlpha = blendSrcAlpha || blendSrc;\n\t\tblendDstAlpha = blendDstAlpha || blendDst;\n\n\t\tif ( blendEquation !== currentBlendEquation || blendEquationAlpha !== currentBlendEquationAlpha ) {\n\n\t\t\tgl.blendEquationSeparate( equationToGL[ blendEquation ], equationToGL[ blendEquationAlpha ] );\n\n\t\t\tcurrentBlendEquation = blendEquation;\n\t\t\tcurrentBlendEquationAlpha = blendEquationAlpha;\n\n\t\t}\n\n\t\tif ( blendSrc !== currentBlendSrc || blendDst !== currentBlendDst || blendSrcAlpha !== currentBlendSrcAlpha || blendDstAlpha !== currentBlendDstAlpha ) {\n\n\t\t\tgl.blendFuncSeparate( factorToGL[ blendSrc ], factorToGL[ blendDst ], factorToGL[ blendSrcAlpha ], factorToGL[ blendDstAlpha ] );\n\n\t\t\tcurrentBlendSrc = blendSrc;\n\t\t\tcurrentBlendDst = blendDst;\n\t\t\tcurrentBlendSrcAlpha = blendSrcAlpha;\n\t\t\tcurrentBlendDstAlpha = blendDstAlpha;\n\n\t\t}\n\n\t\tcurrentBlending = blending;\n\t\tcurrentPremultipledAlpha = null;\n\n\t}\n\n\tfunction setMaterial( material, frontFaceCW ) {\n\n\t\tmaterial.side === DoubleSide\n\t\t\t? disable( 2884 )\n\t\t\t: enable( 2884 );\n\n\t\tvar flipSided = ( material.side === BackSide );\n\t\tif ( frontFaceCW ) flipSided = ! flipSided;\n\n\t\tsetFlipSided( flipSided );\n\n\t\t( material.blending === NormalBlending && material.transparent === false )\n\t\t\t? setBlending( NoBlending )\n\t\t\t: setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst, material.blendEquationAlpha, material.blendSrcAlpha, material.blendDstAlpha, material.premultipliedAlpha );\n\n\t\tdepthBuffer.setFunc( material.depthFunc );\n\t\tdepthBuffer.setTest( material.depthTest );\n\t\tdepthBuffer.setMask( material.depthWrite );\n\t\tcolorBuffer.setMask( material.colorWrite );\n\n\t\tvar stencilWrite = material.stencilWrite;\n\t\tstencilBuffer.setTest( stencilWrite );\n\t\tif ( stencilWrite ) {\n\n\t\t\tstencilBuffer.setMask( material.stencilWriteMask );\n\t\t\tstencilBuffer.setFunc( material.stencilFunc, material.stencilRef, material.stencilFuncMask );\n\t\t\tstencilBuffer.setOp( material.stencilFail, material.stencilZFail, material.stencilZPass );\n\n\t\t}\n\n\t\tsetPolygonOffset( material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits );\n\n\t}\n\n\t//\n\n\tfunction setFlipSided( flipSided ) {\n\n\t\tif ( currentFlipSided !== flipSided ) {\n\n\t\t\tif ( flipSided ) {\n\n\t\t\t\tgl.frontFace( 2304 );\n\n\t\t\t} else {\n\n\t\t\t\tgl.frontFace( 2305 );\n\n\t\t\t}\n\n\t\t\tcurrentFlipSided = flipSided;\n\n\t\t}\n\n\t}\n\n\tfunction setCullFace( cullFace ) {\n\n\t\tif ( cullFace !== CullFaceNone ) {\n\n\t\t\tenable( 2884 );\n\n\t\t\tif ( cullFace !== currentCullFace ) {\n\n\t\t\t\tif ( cullFace === CullFaceBack ) {\n\n\t\t\t\t\tgl.cullFace( 1029 );\n\n\t\t\t\t} else if ( cullFace === CullFaceFront ) {\n\n\t\t\t\t\tgl.cullFace( 1028 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tgl.cullFace( 1032 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tdisable( 2884 );\n\n\t\t}\n\n\t\tcurrentCullFace = cullFace;\n\n\t}\n\n\tfunction setLineWidth( width ) {\n\n\t\tif ( width !== currentLineWidth ) {\n\n\t\t\tif ( lineWidthAvailable ) gl.lineWidth( width );\n\n\t\t\tcurrentLineWidth = width;\n\n\t\t}\n\n\t}\n\n\tfunction setPolygonOffset( polygonOffset, factor, units ) {\n\n\t\tif ( polygonOffset ) {\n\n\t\t\tenable( 32823 );\n\n\t\t\tif ( currentPolygonOffsetFactor !== factor || currentPolygonOffsetUnits !== units ) {\n\n\t\t\t\tgl.polygonOffset( factor, units );\n\n\t\t\t\tcurrentPolygonOffsetFactor = factor;\n\t\t\t\tcurrentPolygonOffsetUnits = units;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tdisable( 32823 );\n\n\t\t}\n\n\t}\n\n\tfunction setScissorTest( scissorTest ) {\n\n\t\tif ( scissorTest ) {\n\n\t\t\tenable( 3089 );\n\n\t\t} else {\n\n\t\t\tdisable( 3089 );\n\n\t\t}\n\n\t}\n\n\t// texture\n\n\tfunction activeTexture( webglSlot ) {\n\n\t\tif ( webglSlot === undefined ) webglSlot = 33984 + maxTextures - 1;\n\n\t\tif ( currentTextureSlot !== webglSlot ) {\n\n\t\t\tgl.activeTexture( webglSlot );\n\t\t\tcurrentTextureSlot = webglSlot;\n\n\t\t}\n\n\t}\n\n\tfunction bindTexture( webglType, webglTexture ) {\n\n\t\tif ( currentTextureSlot === null ) {\n\n\t\t\tactiveTexture();\n\n\t\t}\n\n\t\tvar boundTexture = currentBoundTextures[ currentTextureSlot ];\n\n\t\tif ( boundTexture === undefined ) {\n\n\t\t\tboundTexture = { type: undefined, texture: undefined };\n\t\t\tcurrentBoundTextures[ currentTextureSlot ] = boundTexture;\n\n\t\t}\n\n\t\tif ( boundTexture.type !== webglType || boundTexture.texture !== webglTexture ) {\n\n\t\t\tgl.bindTexture( webglType, webglTexture || emptyTextures[ webglType ] );\n\n\t\t\tboundTexture.type = webglType;\n\t\t\tboundTexture.texture = webglTexture;\n\n\t\t}\n\n\t}\n\n\tfunction unbindTexture() {\n\n\t\tvar boundTexture = currentBoundTextures[ currentTextureSlot ];\n\n\t\tif ( boundTexture !== undefined && boundTexture.type !== undefined ) {\n\n\t\t\tgl.bindTexture( boundTexture.type, null );\n\n\t\t\tboundTexture.type = undefined;\n\t\t\tboundTexture.texture = undefined;\n\n\t\t}\n\n\t}\n\n\tfunction compressedTexImage2D() {\n\n\t\ttry {\n\n\t\t\tgl.compressedTexImage2D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texImage2D() {\n\n\t\ttry {\n\n\t\t\tgl.texImage2D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texImage3D() {\n\n\t\ttry {\n\n\t\t\tgl.texImage3D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\t//\n\n\tfunction scissor( scissor ) {\n\n\t\tif ( currentScissor.equals( scissor ) === false ) {\n\n\t\t\tgl.scissor( scissor.x, scissor.y, scissor.z, scissor.w );\n\t\t\tcurrentScissor.copy( scissor );\n\n\t\t}\n\n\t}\n\n\tfunction viewport( viewport ) {\n\n\t\tif ( currentViewport.equals( viewport ) === false ) {\n\n\t\t\tgl.viewport( viewport.x, viewport.y, viewport.z, viewport.w );\n\t\t\tcurrentViewport.copy( viewport );\n\n\t\t}\n\n\t}\n\n\t//\n\n\tfunction reset() {\n\n\t\tfor ( var i = 0; i < enabledAttributes.length; i ++ ) {\n\n\t\t\tif ( enabledAttributes[ i ] === 1 ) {\n\n\t\t\t\tgl.disableVertexAttribArray( i );\n\t\t\t\tenabledAttributes[ i ] = 0;\n\n\t\t\t}\n\n\t\t}\n\n\t\tenabledCapabilities = {};\n\n\t\tcurrentTextureSlot = null;\n\t\tcurrentBoundTextures = {};\n\n\t\tcurrentProgram = null;\n\n\t\tcurrentBlending = null;\n\n\t\tcurrentFlipSided = null;\n\t\tcurrentCullFace = null;\n\n\t\tcolorBuffer.reset();\n\t\tdepthBuffer.reset();\n\t\tstencilBuffer.reset();\n\n\t}\n\n\treturn {\n\n\t\tbuffers: {\n\t\t\tcolor: colorBuffer,\n\t\t\tdepth: depthBuffer,\n\t\t\tstencil: stencilBuffer\n\t\t},\n\n\t\tinitAttributes: initAttributes,\n\t\tenableAttribute: enableAttribute,\n\t\tenableAttributeAndDivisor: enableAttributeAndDivisor,\n\t\tdisableUnusedAttributes: disableUnusedAttributes,\n\t\tenable: enable,\n\t\tdisable: disable,\n\n\t\tuseProgram: useProgram,\n\n\t\tsetBlending: setBlending,\n\t\tsetMaterial: setMaterial,\n\n\t\tsetFlipSided: setFlipSided,\n\t\tsetCullFace: setCullFace,\n\n\t\tsetLineWidth: setLineWidth,\n\t\tsetPolygonOffset: setPolygonOffset,\n\n\t\tsetScissorTest: setScissorTest,\n\n\t\tactiveTexture: activeTexture,\n\t\tbindTexture: bindTexture,\n\t\tunbindTexture: unbindTexture,\n\t\tcompressedTexImage2D: compressedTexImage2D,\n\t\ttexImage2D: texImage2D,\n\t\ttexImage3D: texImage3D,\n\n\t\tscissor: scissor,\n\t\tviewport: viewport,\n\n\t\treset: reset\n\n\t};\n\n}\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info ) {\n\n\tvar isWebGL2 = capabilities.isWebGL2;\n\tvar maxTextures = capabilities.maxTextures;\n\tvar maxCubemapSize = capabilities.maxCubemapSize;\n\tvar maxTextureSize = capabilities.maxTextureSize;\n\tvar maxSamples = capabilities.maxSamples;\n\n\tvar _videoTextures = new WeakMap();\n\tvar _canvas;\n\n\t// cordova iOS (as of 5.0) still uses UIWebView, which provides OffscreenCanvas,\n\t// also OffscreenCanvas.getContext(\"webgl\"), but not OffscreenCanvas.getContext(\"2d\")!\n\t// Some implementations may only implement OffscreenCanvas partially (e.g. lacking 2d).\n\n\tvar useOffscreenCanvas = false;\n\n\ttry {\n\n\t\tuseOffscreenCanvas = typeof OffscreenCanvas !== 'undefined'\n\t\t\t&& ( new OffscreenCanvas( 1, 1 ).getContext( \"2d\" ) ) !== null;\n\n\t} catch ( err ) {\n\n\t\t// Ignore any errors\n\n\t}\n\n\tfunction createCanvas( width, height ) {\n\n\t\t// Use OffscreenCanvas when available. Specially needed in web workers\n\n\t\treturn useOffscreenCanvas ?\n\t\t\tnew OffscreenCanvas( width, height ) :\n\t\t\tdocument.createElementNS( 'http://www.w3.org/1999/xhtml', 'canvas' );\n\n\t}\n\n\tfunction resizeImage( image, needsPowerOfTwo, needsNewCanvas, maxSize ) {\n\n\t\tvar scale = 1;\n\n\t\t// handle case if texture exceeds max size\n\n\t\tif ( image.width > maxSize || image.height > maxSize ) {\n\n\t\t\tscale = maxSize / Math.max( image.width, image.height );\n\n\t\t}\n\n\t\t// only perform resize if necessary\n\n\t\tif ( scale < 1 || needsPowerOfTwo === true ) {\n\n\t\t\t// only perform resize for certain image types\n\n\t\t\tif ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||\n\t\t\t\t( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||\n\t\t\t\t( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) {\n\n\t\t\t\tvar floor = needsPowerOfTwo ? MathUtils.floorPowerOfTwo : Math.floor;\n\n\t\t\t\tvar width = floor( scale * image.width );\n\t\t\t\tvar height = floor( scale * image.height );\n\n\t\t\t\tif ( _canvas === undefined ) _canvas = createCanvas( width, height );\n\n\t\t\t\t// cube textures can't reuse the same canvas\n\n\t\t\t\tvar canvas = needsNewCanvas ? createCanvas( width, height ) : _canvas;\n\n\t\t\t\tcanvas.width = width;\n\t\t\t\tcanvas.height = height;\n\n\t\t\t\tvar context = canvas.getContext( '2d' );\n\t\t\t\tcontext.drawImage( image, 0, 0, width, height );\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture has been resized from (' + image.width + 'x' + image.height + ') to (' + width + 'x' + height + ').' );\n\n\t\t\t\treturn canvas;\n\n\t\t\t} else {\n\n\t\t\t\tif ( 'data' in image ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Image in DataTexture is too big (' + image.width + 'x' + image.height + ').' );\n\n\t\t\t\t}\n\n\t\t\t\treturn image;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn image;\n\n\t}\n\n\tfunction isPowerOfTwo( image ) {\n\n\t\treturn MathUtils.isPowerOfTwo( image.width ) && MathUtils.isPowerOfTwo( image.height );\n\n\t}\n\n\tfunction textureNeedsPowerOfTwo( texture ) {\n\n\t\tif ( isWebGL2 ) return false;\n\n\t\treturn ( texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping ) ||\n\t\t\t( texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter );\n\n\t}\n\n\tfunction textureNeedsGenerateMipmaps( texture, supportsMips ) {\n\n\t\treturn texture.generateMipmaps && supportsMips &&\n\t\t\ttexture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter;\n\n\t}\n\n\tfunction generateMipmap( target, texture, width, height ) {\n\n\t\t_gl.generateMipmap( target );\n\n\t\tvar textureProperties = properties.get( texture );\n\n\t\t// Note: Math.log( x ) * Math.LOG2E used instead of Math.log2( x ) which is not supported by IE11\n\t\ttextureProperties.__maxMipLevel = Math.log( Math.max( width, height ) ) * Math.LOG2E;\n\n\t}\n\n\tfunction getInternalFormat( internalFormatName, glFormat, glType ) {\n\n\t\tif ( isWebGL2 === false ) return glFormat;\n\n\t\tif ( internalFormatName !== null ) {\n\n\t\t\tif ( _gl[ internalFormatName ] !== undefined ) return _gl[ internalFormatName ];\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format \\'' + internalFormatName + '\\'' );\n\n\t\t}\n\n\t\tvar internalFormat = glFormat;\n\n\t\tif ( glFormat === 6403 ) {\n\n\t\t\tif ( glType === 5126 ) internalFormat = 33326;\n\t\t\tif ( glType === 5131 ) internalFormat = 33325;\n\t\t\tif ( glType === 5121 ) internalFormat = 33321;\n\n\t\t}\n\n\t\tif ( glFormat === 6407 ) {\n\n\t\t\tif ( glType === 5126 ) internalFormat = 34837;\n\t\t\tif ( glType === 5131 ) internalFormat = 34843;\n\t\t\tif ( glType === 5121 ) internalFormat = 32849;\n\n\t\t}\n\n\t\tif ( glFormat === 6408 ) {\n\n\t\t\tif ( glType === 5126 ) internalFormat = 34836;\n\t\t\tif ( glType === 5131 ) internalFormat = 34842;\n\t\t\tif ( glType === 5121 ) internalFormat = 32856;\n\n\t\t}\n\n\t\tif ( internalFormat === 33325 || internalFormat === 33326 ||\n\t\t\tinternalFormat === 34842 || internalFormat === 34836 ) {\n\n\t\t\textensions.get( 'EXT_color_buffer_float' );\n\n\t\t} else if ( internalFormat === 34843 || internalFormat === 34837 ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Floating point textures with RGB format not supported. Please use RGBA instead.' );\n\n\t\t}\n\n\t\treturn internalFormat;\n\n\t}\n\n\t// Fallback filters for non-power-of-2 textures\n\n\tfunction filterFallback( f ) {\n\n\t\tif ( f === NearestFilter || f === NearestMipmapNearestFilter || f === NearestMipmapLinearFilter ) {\n\n\t\t\treturn 9728;\n\n\t\t}\n\n\t\treturn 9729;\n\n\t}\n\n\t//\n\n\tfunction onTextureDispose( event ) {\n\n\t\tvar texture = event.target;\n\n\t\ttexture.removeEventListener( 'dispose', onTextureDispose );\n\n\t\tdeallocateTexture( texture );\n\n\t\tif ( texture.isVideoTexture ) {\n\n\t\t\t_videoTextures.delete( texture );\n\n\t\t}\n\n\t\tinfo.memory.textures --;\n\n\t}\n\n\tfunction onRenderTargetDispose( event ) {\n\n\t\tvar renderTarget = event.target;\n\n\t\trenderTarget.removeEventListener( 'dispose', onRenderTargetDispose );\n\n\t\tdeallocateRenderTarget( renderTarget );\n\n\t\tinfo.memory.textures --;\n\n\t}\n\n\t//\n\n\tfunction deallocateTexture( texture ) {\n\n\t\tvar textureProperties = properties.get( texture );\n\n\t\tif ( textureProperties.__webglInit === undefined ) return;\n\n\t\t_gl.deleteTexture( textureProperties.__webglTexture );\n\n\t\tproperties.remove( texture );\n\n\t}\n\n\tfunction deallocateRenderTarget( renderTarget ) {\n\n\t\tvar renderTargetProperties = properties.get( renderTarget );\n\t\tvar textureProperties = properties.get( renderTarget.texture );\n\n\t\tif ( ! renderTarget ) return;\n\n\t\tif ( textureProperties.__webglTexture !== undefined ) {\n\n\t\t\t_gl.deleteTexture( textureProperties.__webglTexture );\n\n\t\t}\n\n\t\tif ( renderTarget.depthTexture ) {\n\n\t\t\trenderTarget.depthTexture.dispose();\n\n\t\t}\n\n\t\tif ( renderTarget.isWebGLCubeRenderTarget ) {\n\n\t\t\tfor ( var i = 0; i < 6; i ++ ) {\n\n\t\t\t\t_gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer[ i ] );\n\t\t\t\tif ( renderTargetProperties.__webglDepthbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthbuffer[ i ] );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t_gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer );\n\t\t\tif ( renderTargetProperties.__webglDepthbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthbuffer );\n\n\t\t}\n\n\t\tif ( renderTarget.isWebGLMultiviewRenderTarget ) {\n\n\t\t\t_gl.deleteTexture( renderTargetProperties.__webglColorTexture );\n\t\t\t_gl.deleteTexture( renderTargetProperties.__webglDepthStencilTexture );\n\n\t\t\tinfo.memory.textures -= 2;\n\n\t\t\tfor ( var i = 0, il = renderTargetProperties.__webglViewFramebuffers.length; i < il; i ++ ) {\n\n\t\t\t\t_gl.deleteFramebuffer( renderTargetProperties.__webglViewFramebuffers[ i ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tproperties.remove( renderTarget.texture );\n\t\tproperties.remove( renderTarget );\n\n\t}\n\n\t//\n\n\tvar textureUnits = 0;\n\n\tfunction resetTextureUnits() {\n\n\t\ttextureUnits = 0;\n\n\t}\n\n\tfunction allocateTextureUnit() {\n\n\t\tvar textureUnit = textureUnits;\n\n\t\tif ( textureUnit >= maxTextures ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLTextures: Trying to use ' + textureUnit + ' texture units while this GPU supports only ' + maxTextures );\n\n\t\t}\n\n\t\ttextureUnits += 1;\n\n\t\treturn textureUnit;\n\n\t}\n\n\t//\n\n\tfunction setTexture2D( texture, slot ) {\n\n\t\tvar textureProperties = properties.get( texture );\n\n\t\tif ( texture.isVideoTexture ) updateVideoTexture( texture );\n\n\t\tif ( texture.version > 0 && textureProperties.__version !== texture.version ) {\n\n\t\t\tvar image = texture.image;\n\n\t\t\tif ( image === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture marked for update but image is undefined' );\n\n\t\t\t} else if ( image.complete === false ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture marked for update but image is incomplete' );\n\n\t\t\t} else {\n\n\t\t\t\tuploadTexture( textureProperties, texture, slot );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t\tstate.activeTexture( 33984 + slot );\n\t\tstate.bindTexture( 3553, textureProperties.__webglTexture );\n\n\t}\n\n\tfunction setTexture2DArray( texture, slot ) {\n\n\t\tvar textureProperties = properties.get( texture );\n\n\t\tif ( texture.version > 0 && textureProperties.__version !== texture.version ) {\n\n\t\t\tuploadTexture( textureProperties, texture, slot );\n\t\t\treturn;\n\n\t\t}\n\n\t\tstate.activeTexture( 33984 + slot );\n\t\tstate.bindTexture( 35866, textureProperties.__webglTexture );\n\n\t}\n\n\tfunction setTexture3D( texture, slot ) {\n\n\t\tvar textureProperties = properties.get( texture );\n\n\t\tif ( texture.version > 0 && textureProperties.__version !== texture.version ) {\n\n\t\t\tuploadTexture( textureProperties, texture, slot );\n\t\t\treturn;\n\n\t\t}\n\n\t\tstate.activeTexture( 33984 + slot );\n\t\tstate.bindTexture( 32879, textureProperties.__webglTexture );\n\n\t}\n\n\tfunction setTextureCube( texture, slot ) {\n\n\t\tif ( texture.image.length !== 6 ) return;\n\n\t\tvar textureProperties = properties.get( texture );\n\n\t\tif ( texture.version > 0 && textureProperties.__version !== texture.version ) {\n\n\t\t\tinitTexture( textureProperties, texture );\n\n\t\t\tstate.activeTexture( 33984 + slot );\n\t\t\tstate.bindTexture( 34067, textureProperties.__webglTexture );\n\n\t\t\t_gl.pixelStorei( 37440, texture.flipY );\n\n\t\t\tvar isCompressed = ( texture && ( texture.isCompressedTexture || texture.image[ 0 ].isCompressedTexture ) );\n\t\t\tvar isDataTexture = ( texture.image[ 0 ] && texture.image[ 0 ].isDataTexture );\n\n\t\t\tvar cubeImage = [];\n\n\t\t\tfor ( var i = 0; i < 6; i ++ ) {\n\n\t\t\t\tif ( ! isCompressed && ! isDataTexture ) {\n\n\t\t\t\t\tcubeImage[ i ] = resizeImage( texture.image[ i ], false, true, maxCubemapSize );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tcubeImage[ i ] = isDataTexture ? texture.image[ i ].image : texture.image[ i ];\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tvar image = cubeImage[ 0 ],\n\t\t\t\tsupportsMips = isPowerOfTwo( image ) || isWebGL2,\n\t\t\t\tglFormat = utils.convert( texture.format ),\n\t\t\t\tglType = utils.convert( texture.type ),\n\t\t\t\tglInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType );\n\n\t\t\tsetTextureParameters( 34067, texture, supportsMips );\n\n\t\t\tvar mipmaps;\n\n\t\t\tif ( isCompressed ) {\n\n\t\t\t\tfor ( var i = 0; i < 6; i ++ ) {\n\n\t\t\t\t\tmipmaps = cubeImage[ i ].mipmaps;\n\n\t\t\t\t\tfor ( var j = 0; j < mipmaps.length; j ++ ) {\n\n\t\t\t\t\t\tvar mipmap = mipmaps[ j ];\n\n\t\t\t\t\t\tif ( texture.format !== RGBAFormat && texture.format !== RGBFormat ) {\n\n\t\t\t\t\t\t\tif ( glFormat !== null ) {\n\n\t\t\t\t\t\t\t\tstate.compressedTexImage2D( 34069 + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()' );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tstate.texImage2D( 34069 + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\ttextureProperties.__maxMipLevel = mipmaps.length - 1;\n\n\t\t\t} else {\n\n\t\t\t\tmipmaps = texture.mipmaps;\n\n\t\t\t\tfor ( var i = 0; i < 6; i ++ ) {\n\n\t\t\t\t\tif ( isDataTexture ) {\n\n\t\t\t\t\t\tstate.texImage2D( 34069 + i, 0, glInternalFormat, cubeImage[ i ].width, cubeImage[ i ].height, 0, glFormat, glType, cubeImage[ i ].data );\n\n\t\t\t\t\t\tfor ( var j = 0; j < mipmaps.length; j ++ ) {\n\n\t\t\t\t\t\t\tvar mipmap = mipmaps[ j ];\n\t\t\t\t\t\t\tvar mipmapImage = mipmap.image[ i ].image;\n\n\t\t\t\t\t\t\tstate.texImage2D( 34069 + i, j + 1, glInternalFormat, mipmapImage.width, mipmapImage.height, 0, glFormat, glType, mipmapImage.data );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tstate.texImage2D( 34069 + i, 0, glInternalFormat, glFormat, glType, cubeImage[ i ] );\n\n\t\t\t\t\t\tfor ( var j = 0; j < mipmaps.length; j ++ ) {\n\n\t\t\t\t\t\t\tvar mipmap = mipmaps[ j ];\n\n\t\t\t\t\t\t\tstate.texImage2D( 34069 + i, j + 1, glInternalFormat, glFormat, glType, mipmap.image[ i ] );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\ttextureProperties.__maxMipLevel = mipmaps.length;\n\n\t\t\t}\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {\n\n\t\t\t\t// We assume images for cube map have the same size.\n\t\t\t\tgenerateMipmap( 34067, texture, image.width, image.height );\n\n\t\t\t}\n\n\t\t\ttextureProperties.__version = texture.version;\n\n\t\t\tif ( texture.onUpdate ) texture.onUpdate( texture );\n\n\t\t} else {\n\n\t\t\tstate.activeTexture( 33984 + slot );\n\t\t\tstate.bindTexture( 34067, textureProperties.__webglTexture );\n\n\t\t}\n\n\t}\n\n\tfunction setTextureCubeDynamic( texture, slot ) {\n\n\t\tstate.activeTexture( 33984 + slot );\n\t\tstate.bindTexture( 34067, properties.get( texture ).__webglTexture );\n\n\t}\n\n\tvar wrappingToGL = {\n\t\t[ RepeatWrapping ]: 10497,\n\t\t[ ClampToEdgeWrapping ]: 33071,\n\t\t[ MirroredRepeatWrapping ]: 33648\n\t};\n\n\tvar filterToGL = {\n\t\t[ NearestFilter ]: 9728,\n\t\t[ NearestMipmapNearestFilter ]: 9984,\n\t\t[ NearestMipmapLinearFilter ]: 9986,\n\n\t\t[ LinearFilter ]: 9729,\n\t\t[ LinearMipmapNearestFilter ]: 9985,\n\t\t[ LinearMipmapLinearFilter ]: 9987\n\t};\n\n\tfunction setTextureParameters( textureType, texture, supportsMips ) {\n\n\t\tif ( supportsMips ) {\n\n\t\t\t_gl.texParameteri( textureType, 10242, wrappingToGL[ texture.wrapS ] );\n\t\t\t_gl.texParameteri( textureType, 10243, wrappingToGL[ texture.wrapT ] );\n\n\t\t\tif ( textureType === 32879 || textureType === 35866 ) {\n\n\t\t\t\t_gl.texParameteri( textureType, 32882, wrappingToGL[ texture.wrapR ] );\n\n\t\t\t}\n\n\t\t\t_gl.texParameteri( textureType, 10240, filterToGL[ texture.magFilter ] );\n\t\t\t_gl.texParameteri( textureType, 10241, filterToGL[ texture.minFilter ] );\n\n\t\t} else {\n\n\t\t\t_gl.texParameteri( textureType, 10242, 33071 );\n\t\t\t_gl.texParameteri( textureType, 10243, 33071 );\n\n\t\t\tif ( textureType === 32879 || textureType === 35866 ) {\n\n\t\t\t\t_gl.texParameteri( textureType, 32882, 33071 );\n\n\t\t\t}\n\n\t\t\tif ( texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.' );\n\n\t\t\t}\n\n\t\t\t_gl.texParameteri( textureType, 10240, filterFallback( texture.magFilter ) );\n\t\t\t_gl.texParameteri( textureType, 10241, filterFallback( texture.minFilter ) );\n\n\t\t\tif ( texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.' );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvar extension = extensions.get( 'EXT_texture_filter_anisotropic' );\n\n\t\tif ( extension ) {\n\n\t\t\tif ( texture.type === FloatType && extensions.get( 'OES_texture_float_linear' ) === null ) return;\n\t\t\tif ( texture.type === HalfFloatType && ( isWebGL2 || extensions.get( 'OES_texture_half_float_linear' ) ) === null ) return;\n\n\t\t\tif ( texture.anisotropy > 1 || properties.get( texture ).__currentAnisotropy ) {\n\n\t\t\t\t_gl.texParameterf( textureType, extension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min( texture.anisotropy, capabilities.getMaxAnisotropy() ) );\n\t\t\t\tproperties.get( texture ).__currentAnisotropy = texture.anisotropy;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction initTexture( textureProperties, texture ) {\n\n\t\tif ( textureProperties.__webglInit === undefined ) {\n\n\t\t\ttextureProperties.__webglInit = true;\n\n\t\t\ttexture.addEventListener( 'dispose', onTextureDispose );\n\n\t\t\ttextureProperties.__webglTexture = _gl.createTexture();\n\n\t\t\tinfo.memory.textures ++;\n\n\t\t}\n\n\t}\n\n\tfunction uploadTexture( textureProperties, texture, slot ) {\n\n\t\tvar textureType = 3553;\n\n\t\tif ( texture.isDataTexture2DArray ) textureType = 35866;\n\t\tif ( texture.isDataTexture3D ) textureType = 32879;\n\n\t\tinitTexture( textureProperties, texture );\n\n\t\tstate.activeTexture( 33984 + slot );\n\t\tstate.bindTexture( textureType, textureProperties.__webglTexture );\n\n\t\t_gl.pixelStorei( 37440, texture.flipY );\n\t\t_gl.pixelStorei( 37441, texture.premultiplyAlpha );\n\t\t_gl.pixelStorei( 3317, texture.unpackAlignment );\n\n\t\tvar needsPowerOfTwo = textureNeedsPowerOfTwo( texture ) && isPowerOfTwo( texture.image ) === false;\n\t\tvar image = resizeImage( texture.image, needsPowerOfTwo, false, maxTextureSize );\n\n\t\tvar supportsMips = isPowerOfTwo( image ) || isWebGL2,\n\t\t\tglFormat = utils.convert( texture.format ),\n\t\t\tglType = utils.convert( texture.type ),\n\t\t\tglInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType );\n\n\t\tsetTextureParameters( textureType, texture, supportsMips );\n\n\t\tvar mipmap, mipmaps = texture.mipmaps;\n\n\t\tif ( texture.isDepthTexture ) {\n\n\t\t\t// populate depth texture with dummy data\n\n\t\t\tglInternalFormat = 6402;\n\n\t\t\tif ( texture.type === FloatType ) {\n\n\t\t\t\tif ( isWebGL2 === false ) throw new Error( 'Float Depth Texture only supported in WebGL2.0' );\n\t\t\t\tglInternalFormat = 36012;\n\n\t\t\t} else if ( isWebGL2 ) {\n\n\t\t\t\t// WebGL 2.0 requires signed internalformat for glTexImage2D\n\t\t\t\tglInternalFormat = 33189;\n\n\t\t\t}\n\n\t\t\tif ( texture.format === DepthFormat && glInternalFormat === 6402 ) {\n\n\t\t\t\t// The error INVALID_OPERATION is generated by texImage2D if format and internalformat are\n\t\t\t\t// DEPTH_COMPONENT and type is not UNSIGNED_SHORT or UNSIGNED_INT\n\t\t\t\t// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)\n\t\t\t\tif ( texture.type !== UnsignedShortType && texture.type !== UnsignedIntType ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture.' );\n\n\t\t\t\t\ttexture.type = UnsignedShortType;\n\t\t\t\t\tglType = utils.convert( texture.type );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// Depth stencil textures need the DEPTH_STENCIL internal format\n\t\t\t// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)\n\t\t\tif ( texture.format === DepthStencilFormat ) {\n\n\t\t\t\tglInternalFormat = 34041;\n\n\t\t\t\t// The error INVALID_OPERATION is generated by texImage2D if format and internalformat are\n\t\t\t\t// DEPTH_STENCIL and type is not UNSIGNED_INT_24_8_WEBGL.\n\t\t\t\t// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)\n\t\t\t\tif ( texture.type !== UnsignedInt248Type ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture.' );\n\n\t\t\t\t\ttexture.type = UnsignedInt248Type;\n\t\t\t\t\tglType = utils.convert( texture.type );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tstate.texImage2D( 3553, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, null );\n\n\t\t} else if ( texture.isDataTexture ) {\n\n\t\t\t// use manually created mipmaps if available\n\t\t\t// if there are no manual mipmaps\n\t\t\t// set 0 level mipmap and then use GL to generate other mipmap levels\n\n\t\t\tif ( mipmaps.length > 0 && supportsMips ) {\n\n\t\t\t\tfor ( var i = 0, il = mipmaps.length; i < il; i ++ ) {\n\n\t\t\t\t\tmipmap = mipmaps[ i ];\n\t\t\t\t\tstate.texImage2D( 3553, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );\n\n\t\t\t\t}\n\n\t\t\t\ttexture.generateMipmaps = false;\n\t\t\t\ttextureProperties.__maxMipLevel = mipmaps.length - 1;\n\n\t\t\t} else {\n\n\t\t\t\tstate.texImage2D( 3553, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, image.data );\n\t\t\t\ttextureProperties.__maxMipLevel = 0;\n\n\t\t\t}\n\n\t\t} else if ( texture.isCompressedTexture ) {\n\n\t\t\tfor ( var i = 0, il = mipmaps.length; i < il; i ++ ) {\n\n\t\t\t\tmipmap = mipmaps[ i ];\n\n\t\t\t\tif ( texture.format !== RGBAFormat && texture.format !== RGBFormat ) {\n\n\t\t\t\t\tif ( glFormat !== null ) {\n\n\t\t\t\t\t\tstate.compressedTexImage2D( 3553, i, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()' );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tstate.texImage2D( 3553, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\ttextureProperties.__maxMipLevel = mipmaps.length - 1;\n\n\t\t} else if ( texture.isDataTexture2DArray ) {\n\n\t\t\tstate.texImage3D( 35866, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data );\n\t\t\ttextureProperties.__maxMipLevel = 0;\n\n\t\t} else if ( texture.isDataTexture3D ) {\n\n\t\t\tstate.texImage3D( 32879, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data );\n\t\t\ttextureProperties.__maxMipLevel = 0;\n\n\t\t} else {\n\n\t\t\t// regular Texture (image, video, canvas)\n\n\t\t\t// use manually created mipmaps if available\n\t\t\t// if there are no manual mipmaps\n\t\t\t// set 0 level mipmap and then use GL to generate other mipmap levels\n\n\t\t\tif ( mipmaps.length > 0 && supportsMips ) {\n\n\t\t\t\tfor ( var i = 0, il = mipmaps.length; i < il; i ++ ) {\n\n\t\t\t\t\tmipmap = mipmaps[ i ];\n\t\t\t\t\tstate.texImage2D( 3553, i, glInternalFormat, glFormat, glType, mipmap );\n\n\t\t\t\t}\n\n\t\t\t\ttexture.generateMipmaps = false;\n\t\t\t\ttextureProperties.__maxMipLevel = mipmaps.length - 1;\n\n\t\t\t} else {\n\n\t\t\t\tstate.texImage2D( 3553, 0, glInternalFormat, glFormat, glType, image );\n\t\t\t\ttextureProperties.__maxMipLevel = 0;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {\n\n\t\t\tgenerateMipmap( textureType, texture, image.width, image.height );\n\n\t\t}\n\n\t\ttextureProperties.__version = texture.version;\n\n\t\tif ( texture.onUpdate ) texture.onUpdate( texture );\n\n\t}\n\n\t// Render targets\n\n\t// Setup storage for target texture and bind it to correct framebuffer\n\tfunction setupFrameBufferTexture( framebuffer, renderTarget, attachment, textureTarget ) {\n\n\t\tvar glFormat = utils.convert( renderTarget.texture.format );\n\t\tvar glType = utils.convert( renderTarget.texture.type );\n\t\tvar glInternalFormat = getInternalFormat( renderTarget.texture.internalFormat, glFormat, glType );\n\t\tstate.texImage2D( textureTarget, 0, glInternalFormat, renderTarget.width, renderTarget.height, 0, glFormat, glType, null );\n\t\t_gl.bindFramebuffer( 36160, framebuffer );\n\t\t_gl.framebufferTexture2D( 36160, attachment, textureTarget, properties.get( renderTarget.texture ).__webglTexture, 0 );\n\t\t_gl.bindFramebuffer( 36160, null );\n\n\t}\n\n\t// Setup storage for internal depth/stencil buffers and bind to correct framebuffer\n\tfunction setupRenderBufferStorage( renderbuffer, renderTarget, isMultisample ) {\n\n\t\t_gl.bindRenderbuffer( 36161, renderbuffer );\n\n\t\tif ( renderTarget.depthBuffer && ! renderTarget.stencilBuffer ) {\n\n\t\t\tif ( isMultisample ) {\n\n\t\t\t\tvar samples = getRenderTargetSamples( renderTarget );\n\n\t\t\t\t_gl.renderbufferStorageMultisample( 36161, samples, 33189, renderTarget.width, renderTarget.height );\n\n\t\t\t} else {\n\n\t\t\t\t_gl.renderbufferStorage( 36161, 33189, renderTarget.width, renderTarget.height );\n\n\t\t\t}\n\n\t\t\t_gl.framebufferRenderbuffer( 36160, 36096, 36161, renderbuffer );\n\n\t\t} else if ( renderTarget.depthBuffer && renderTarget.stencilBuffer ) {\n\n\t\t\tif ( isMultisample ) {\n\n\t\t\t\tvar samples = getRenderTargetSamples( renderTarget );\n\n\t\t\t\t_gl.renderbufferStorageMultisample( 36161, samples, 35056, renderTarget.width, renderTarget.height );\n\n\t\t\t} else {\n\n\t\t\t\t_gl.renderbufferStorage( 36161, 34041, renderTarget.width, renderTarget.height );\n\n\t\t\t}\n\n\n\t\t\t_gl.framebufferRenderbuffer( 36160, 33306, 36161, renderbuffer );\n\n\t\t} else {\n\n\t\t\tvar glFormat = utils.convert( renderTarget.texture.format );\n\t\t\tvar glType = utils.convert( renderTarget.texture.type );\n\t\t\tvar glInternalFormat = getInternalFormat( renderTarget.texture.internalFormat, glFormat, glType );\n\n\t\t\tif ( isMultisample ) {\n\n\t\t\t\tvar samples = getRenderTargetSamples( renderTarget );\n\n\t\t\t\t_gl.renderbufferStorageMultisample( 36161, samples, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t} else {\n\n\t\t\t\t_gl.renderbufferStorage( 36161, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t}\n\n\t\t}\n\n\t\t_gl.bindRenderbuffer( 36161, null );\n\n\t}\n\n\t// Setup resources for a Depth Texture for a FBO (needs an extension)\n\tfunction setupDepthTexture( framebuffer, renderTarget ) {\n\n\t\tvar isCube = ( renderTarget && renderTarget.isWebGLCubeRenderTarget );\n\t\tif ( isCube ) throw new Error( 'Depth Texture with cube render targets is not supported' );\n\n\t\t_gl.bindFramebuffer( 36160, framebuffer );\n\n\t\tif ( ! ( renderTarget.depthTexture && renderTarget.depthTexture.isDepthTexture ) ) {\n\n\t\t\tthrow new Error( 'renderTarget.depthTexture must be an instance of THREE.DepthTexture' );\n\n\t\t}\n\n\t\t// upload an empty depth texture with framebuffer size\n\t\tif ( ! properties.get( renderTarget.depthTexture ).__webglTexture ||\n\t\t\t\trenderTarget.depthTexture.image.width !== renderTarget.width ||\n\t\t\t\trenderTarget.depthTexture.image.height !== renderTarget.height ) {\n\n\t\t\trenderTarget.depthTexture.image.width = renderTarget.width;\n\t\t\trenderTarget.depthTexture.image.height = renderTarget.height;\n\t\t\trenderTarget.depthTexture.needsUpdate = true;\n\n\t\t}\n\n\t\tsetTexture2D( renderTarget.depthTexture, 0 );\n\n\t\tvar webglDepthTexture = properties.get( renderTarget.depthTexture ).__webglTexture;\n\n\t\tif ( renderTarget.depthTexture.format === DepthFormat ) {\n\n\t\t\t_gl.framebufferTexture2D( 36160, 36096, 3553, webglDepthTexture, 0 );\n\n\t\t} else if ( renderTarget.depthTexture.format === DepthStencilFormat ) {\n\n\t\t\t_gl.framebufferTexture2D( 36160, 33306, 3553, webglDepthTexture, 0 );\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'Unknown depthTexture format' );\n\n\t\t}\n\n\t}\n\n\t// Setup GL resources for a non-texture depth buffer\n\tfunction setupDepthRenderbuffer( renderTarget ) {\n\n\t\tvar renderTargetProperties = properties.get( renderTarget );\n\n\t\tvar isCube = ( renderTarget.isWebGLCubeRenderTarget === true );\n\n\t\tif ( renderTarget.depthTexture ) {\n\n\t\t\tif ( isCube ) throw new Error( 'target.depthTexture not supported in Cube render targets' );\n\n\t\t\tsetupDepthTexture( renderTargetProperties.__webglFramebuffer, renderTarget );\n\n\t\t} else {\n\n\t\t\tif ( isCube ) {\n\n\t\t\t\trenderTargetProperties.__webglDepthbuffer = [];\n\n\t\t\t\tfor ( var i = 0; i < 6; i ++ ) {\n\n\t\t\t\t\t_gl.bindFramebuffer( 36160, renderTargetProperties.__webglFramebuffer[ i ] );\n\t\t\t\t\trenderTargetProperties.__webglDepthbuffer[ i ] = _gl.createRenderbuffer();\n\t\t\t\t\tsetupRenderBufferStorage( renderTargetProperties.__webglDepthbuffer[ i ], renderTarget );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t_gl.bindFramebuffer( 36160, renderTargetProperties.__webglFramebuffer );\n\t\t\t\trenderTargetProperties.__webglDepthbuffer = _gl.createRenderbuffer();\n\t\t\t\tsetupRenderBufferStorage( renderTargetProperties.__webglDepthbuffer, renderTarget );\n\n\t\t\t}\n\n\t\t}\n\n\t\t_gl.bindFramebuffer( 36160, null );\n\n\t}\n\n\t// Set up GL resources for the render target\n\tfunction setupRenderTarget( renderTarget ) {\n\n\t\tvar renderTargetProperties = properties.get( renderTarget );\n\t\tvar textureProperties = properties.get( renderTarget.texture );\n\n\t\trenderTarget.addEventListener( 'dispose', onRenderTargetDispose );\n\n\t\ttextureProperties.__webglTexture = _gl.createTexture();\n\n\t\tinfo.memory.textures ++;\n\n\t\tvar isCube = ( renderTarget.isWebGLCubeRenderTarget === true );\n\t\tvar isMultisample = ( renderTarget.isWebGLMultisampleRenderTarget === true );\n\t\tvar isMultiview = ( renderTarget.isWebGLMultiviewRenderTarget === true );\n\t\tvar supportsMips = isPowerOfTwo( renderTarget ) || isWebGL2;\n\n\t\t// Setup framebuffer\n\n\t\tif ( isCube ) {\n\n\t\t\trenderTargetProperties.__webglFramebuffer = [];\n\n\t\t\tfor ( var i = 0; i < 6; i ++ ) {\n\n\t\t\t\trenderTargetProperties.__webglFramebuffer[ i ] = _gl.createFramebuffer();\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\trenderTargetProperties.__webglFramebuffer = _gl.createFramebuffer();\n\n\t\t\tif ( isMultisample ) {\n\n\t\t\t\tif ( isWebGL2 ) {\n\n\t\t\t\t\trenderTargetProperties.__webglMultisampledFramebuffer = _gl.createFramebuffer();\n\t\t\t\t\trenderTargetProperties.__webglColorRenderbuffer = _gl.createRenderbuffer();\n\n\t\t\t\t\t_gl.bindRenderbuffer( 36161, renderTargetProperties.__webglColorRenderbuffer );\n\n\t\t\t\t\tvar glFormat = utils.convert( renderTarget.texture.format );\n\t\t\t\t\tvar glType = utils.convert( renderTarget.texture.type );\n\t\t\t\t\tvar glInternalFormat = getInternalFormat( renderTarget.texture.internalFormat, glFormat, glType );\n\t\t\t\t\tvar samples = getRenderTargetSamples( renderTarget );\n\t\t\t\t\t_gl.renderbufferStorageMultisample( 36161, samples, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t\t_gl.bindFramebuffer( 36160, renderTargetProperties.__webglMultisampledFramebuffer );\n\t\t\t\t\t_gl.framebufferRenderbuffer( 36160, 36064, 36161, renderTargetProperties.__webglColorRenderbuffer );\n\t\t\t\t\t_gl.bindRenderbuffer( 36161, null );\n\n\t\t\t\t\tif ( renderTarget.depthBuffer ) {\n\n\t\t\t\t\t\trenderTargetProperties.__webglDepthRenderbuffer = _gl.createRenderbuffer();\n\t\t\t\t\t\tsetupRenderBufferStorage( renderTargetProperties.__webglDepthRenderbuffer, renderTarget, true );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t_gl.bindFramebuffer( 36160, null );\n\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.' );\n\n\t\t\t\t}\n\n\t\t\t} else if ( isMultiview ) {\n\n\t\t\t\tvar width = renderTarget.width;\n\t\t\t\tvar height = renderTarget.height;\n\t\t\t\tvar numViews = renderTarget.numViews;\n\n\t\t\t\t_gl.bindFramebuffer( 36160, renderTargetProperties.__webglFramebuffer );\n\n\t\t\t\tvar ext = extensions.get( 'OVR_multiview2' );\n\n\t\t\t\tinfo.memory.textures += 2;\n\n\t\t\t\tvar colorTexture = _gl.createTexture();\n\t\t\t\t_gl.bindTexture( 35866, colorTexture );\n\t\t\t\t_gl.texParameteri( 35866, 10240, 9728 );\n\t\t\t\t_gl.texParameteri( 35866, 10241, 9728 );\n\t\t\t\t_gl.texImage3D( 35866, 0, 32856, width, height, numViews, 0, 6408, 5121, null );\n\t\t\t\text.framebufferTextureMultiviewOVR( 36160, 36064, colorTexture, 0, 0, numViews );\n\n\t\t\t\tvar depthStencilTexture = _gl.createTexture();\n\t\t\t\t_gl.bindTexture( 35866, depthStencilTexture );\n\t\t\t\t_gl.texParameteri( 35866, 10240, 9728 );\n\t\t\t\t_gl.texParameteri( 35866, 10241, 9728 );\n\t\t\t\t_gl.texImage3D( 35866, 0, 35056, width, height, numViews, 0, 34041, 34042, null );\n\t\t\t\text.framebufferTextureMultiviewOVR( 36160, 33306, depthStencilTexture, 0, 0, numViews );\n\n\t\t\t\tvar viewFramebuffers = new Array( numViews );\n\t\t\t\tfor ( var i = 0; i < numViews; ++ i ) {\n\n\t\t\t\t\tviewFramebuffers[ i ] = _gl.createFramebuffer();\n\t\t\t\t\t_gl.bindFramebuffer( 36160, viewFramebuffers[ i ] );\n\t\t\t\t\t_gl.framebufferTextureLayer( 36160, 36064, colorTexture, 0, i );\n\n\t\t\t\t}\n\n\t\t\t\trenderTargetProperties.__webglColorTexture = colorTexture;\n\t\t\t\trenderTargetProperties.__webglDepthStencilTexture = depthStencilTexture;\n\t\t\t\trenderTargetProperties.__webglViewFramebuffers = viewFramebuffers;\n\n\t\t\t\t_gl.bindFramebuffer( 36160, null );\n\t\t\t\t_gl.bindTexture( 35866, null );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Setup color buffer\n\n\t\tif ( isCube ) {\n\n\t\t\tstate.bindTexture( 34067, textureProperties.__webglTexture );\n\t\t\tsetTextureParameters( 34067, renderTarget.texture, supportsMips );\n\n\t\t\tfor ( var i = 0; i < 6; i ++ ) {\n\n\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer[ i ], renderTarget, 36064, 34069 + i );\n\n\t\t\t}\n\n\t\t\tif ( textureNeedsGenerateMipmaps( renderTarget.texture, supportsMips ) ) {\n\n\t\t\t\tgenerateMipmap( 34067, renderTarget.texture, renderTarget.width, renderTarget.height );\n\n\t\t\t}\n\n\t\t\tstate.bindTexture( 34067, null );\n\n\t\t} else if ( ! isMultiview ) {\n\n\t\t\tstate.bindTexture( 3553, textureProperties.__webglTexture );\n\t\t\tsetTextureParameters( 3553, renderTarget.texture, supportsMips );\n\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, 36064, 3553 );\n\n\t\t\tif ( textureNeedsGenerateMipmaps( renderTarget.texture, supportsMips ) ) {\n\n\t\t\t\tgenerateMipmap( 3553, renderTarget.texture, renderTarget.width, renderTarget.height );\n\n\t\t\t}\n\n\t\t\tstate.bindTexture( 3553, null );\n\n\t\t}\n\n\t\t// Setup depth and stencil buffers\n\n\t\tif ( renderTarget.depthBuffer ) {\n\n\t\t\tsetupDepthRenderbuffer( renderTarget );\n\n\t\t}\n\n\t}\n\n\tfunction updateRenderTargetMipmap( renderTarget ) {\n\n\t\tvar texture = renderTarget.texture;\n\t\tvar supportsMips = isPowerOfTwo( renderTarget ) || isWebGL2;\n\n\t\tif ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {\n\n\t\t\tvar target = renderTarget.isWebGLCubeRenderTarget ? 34067 : 3553;\n\t\t\tvar webglTexture = properties.get( texture ).__webglTexture;\n\n\t\t\tstate.bindTexture( target, webglTexture );\n\t\t\tgenerateMipmap( target, texture, renderTarget.width, renderTarget.height );\n\t\t\tstate.bindTexture( target, null );\n\n\t\t}\n\n\t}\n\n\tfunction updateMultisampleRenderTarget( renderTarget ) {\n\n\t\tif ( renderTarget.isWebGLMultisampleRenderTarget ) {\n\n\t\t\tif ( isWebGL2 ) {\n\n\t\t\t\tvar renderTargetProperties = properties.get( renderTarget );\n\n\t\t\t\t_gl.bindFramebuffer( 36008, renderTargetProperties.__webglMultisampledFramebuffer );\n\t\t\t\t_gl.bindFramebuffer( 36009, renderTargetProperties.__webglFramebuffer );\n\n\t\t\t\tvar width = renderTarget.width;\n\t\t\t\tvar height = renderTarget.height;\n\t\t\t\tvar mask = 16384;\n\n\t\t\t\tif ( renderTarget.depthBuffer ) mask |= 256;\n\t\t\t\tif ( renderTarget.stencilBuffer ) mask |= 1024;\n\n\t\t\t\t_gl.blitFramebuffer( 0, 0, width, height, 0, 0, width, height, mask, 9728 );\n\n\t\t\t} else {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.' );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction getRenderTargetSamples( renderTarget ) {\n\n\t\treturn ( isWebGL2 && renderTarget.isWebGLMultisampleRenderTarget ) ?\n\t\t\tMath.min( maxSamples, renderTarget.samples ) : 0;\n\n\t}\n\n\tfunction updateVideoTexture( texture ) {\n\n\t\tvar frame = info.render.frame;\n\n\t\t// Check the last frame we updated the VideoTexture\n\n\t\tif ( _videoTextures.get( texture ) !== frame ) {\n\n\t\t\t_videoTextures.set( texture, frame );\n\t\t\ttexture.update();\n\n\t\t}\n\n\t}\n\n\t// backwards compatibility\n\n\tvar warnedTexture2D = false;\n\tvar warnedTextureCube = false;\n\n\tfunction safeSetTexture2D( texture, slot ) {\n\n\t\tif ( texture && texture.isWebGLRenderTarget ) {\n\n\t\t\tif ( warnedTexture2D === false ) {\n\n\t\t\t\tconsole.warn( \"THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead.\" );\n\t\t\t\twarnedTexture2D = true;\n\n\t\t\t}\n\n\t\t\ttexture = texture.texture;\n\n\t\t}\n\n\t\tsetTexture2D( texture, slot );\n\n\t}\n\n\tfunction safeSetTextureCube( texture, slot ) {\n\n\t\tif ( texture && texture.isWebGLCubeRenderTarget ) {\n\n\t\t\tif ( warnedTextureCube === false ) {\n\n\t\t\t\tconsole.warn( \"THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead.\" );\n\t\t\t\twarnedTextureCube = true;\n\n\t\t\t}\n\n\t\t\ttexture = texture.texture;\n\n\t\t}\n\n\t\t// currently relying on the fact that WebGLCubeRenderTarget.texture is a Texture and NOT a CubeTexture\n\t\t// TODO: unify these code paths\n\t\tif ( ( texture && texture.isCubeTexture ) ||\n\t\t\t( Array.isArray( texture.image ) && texture.image.length === 6 ) ) {\n\n\t\t\t// CompressedTexture can have Array in image :/\n\n\t\t\t// this function alone should take care of cube textures\n\t\t\tsetTextureCube( texture, slot );\n\n\t\t} else {\n\n\t\t\t// assumed: texture property of THREE.WebGLCubeRenderTarget\n\t\t\tsetTextureCubeDynamic( texture, slot );\n\n\t\t}\n\n\t}\n\n\t//\n\n\tthis.allocateTextureUnit = allocateTextureUnit;\n\tthis.resetTextureUnits = resetTextureUnits;\n\n\tthis.setTexture2D = setTexture2D;\n\tthis.setTexture2DArray = setTexture2DArray;\n\tthis.setTexture3D = setTexture3D;\n\tthis.setTextureCube = setTextureCube;\n\tthis.setTextureCubeDynamic = setTextureCubeDynamic;\n\tthis.setupRenderTarget = setupRenderTarget;\n\tthis.updateRenderTargetMipmap = updateRenderTargetMipmap;\n\tthis.updateMultisampleRenderTarget = updateMultisampleRenderTarget;\n\n\tthis.safeSetTexture2D = safeSetTexture2D;\n\tthis.safeSetTextureCube = safeSetTextureCube;\n\n}\n\n/**\n * @author thespite / http://www.twitter.com/thespite\n */\n\nfunction WebGLUtils( gl, extensions, capabilities ) {\n\n\tvar isWebGL2 = capabilities.isWebGL2;\n\n\tfunction convert( p ) {\n\n\t\tvar extension;\n\n\t\tif ( p === UnsignedByteType ) return 5121;\n\t\tif ( p === UnsignedShort4444Type ) return 32819;\n\t\tif ( p === UnsignedShort5551Type ) return 32820;\n\t\tif ( p === UnsignedShort565Type ) return 33635;\n\n\t\tif ( p === ByteType ) return 5120;\n\t\tif ( p === ShortType ) return 5122;\n\t\tif ( p === UnsignedShortType ) return 5123;\n\t\tif ( p === IntType ) return 5124;\n\t\tif ( p === UnsignedIntType ) return 5125;\n\t\tif ( p === FloatType ) return 5126;\n\n\t\tif ( p === HalfFloatType ) {\n\n\t\t\tif ( isWebGL2 ) return 5131;\n\n\t\t\textension = extensions.get( 'OES_texture_half_float' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\treturn extension.HALF_FLOAT_OES;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( p === AlphaFormat ) return 6406;\n\t\tif ( p === RGBFormat ) return 6407;\n\t\tif ( p === RGBAFormat ) return 6408;\n\t\tif ( p === LuminanceFormat ) return 6409;\n\t\tif ( p === LuminanceAlphaFormat ) return 6410;\n\t\tif ( p === DepthFormat ) return 6402;\n\t\tif ( p === DepthStencilFormat ) return 34041;\n\t\tif ( p === RedFormat ) return 6403;\n\n\t\t// WebGL2 formats.\n\n\t\tif ( p === RedIntegerFormat ) return 36244;\n\t\tif ( p === RGFormat ) return 33319;\n\t\tif ( p === RGIntegerFormat ) return 33320;\n\t\tif ( p === RGBIntegerFormat ) return 36248;\n\t\tif ( p === RGBAIntegerFormat ) return 36249;\n\n\t\tif ( p === RGB_S3TC_DXT1_Format || p === RGBA_S3TC_DXT1_Format ||\n\t\t\tp === RGBA_S3TC_DXT3_Format || p === RGBA_S3TC_DXT5_Format ) {\n\n\t\t\textension = extensions.get( 'WEBGL_compressed_texture_s3tc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGB_S3TC_DXT1_Format ) return extension.COMPRESSED_RGB_S3TC_DXT1_EXT;\n\t\t\t\tif ( p === RGBA_S3TC_DXT1_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT1_EXT;\n\t\t\t\tif ( p === RGBA_S3TC_DXT3_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT3_EXT;\n\t\t\t\tif ( p === RGBA_S3TC_DXT5_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT5_EXT;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( p === RGB_PVRTC_4BPPV1_Format || p === RGB_PVRTC_2BPPV1_Format ||\n\t\t\tp === RGBA_PVRTC_4BPPV1_Format || p === RGBA_PVRTC_2BPPV1_Format ) {\n\n\t\t\textension = extensions.get( 'WEBGL_compressed_texture_pvrtc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGB_PVRTC_4BPPV1_Format ) return extension.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;\n\t\t\t\tif ( p === RGB_PVRTC_2BPPV1_Format ) return extension.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;\n\t\t\t\tif ( p === RGBA_PVRTC_4BPPV1_Format ) return extension.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;\n\t\t\t\tif ( p === RGBA_PVRTC_2BPPV1_Format ) return extension.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( p === RGB_ETC1_Format ) {\n\n\t\t\textension = extensions.get( 'WEBGL_compressed_texture_etc1' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\treturn extension.COMPRESSED_RGB_ETC1_WEBGL;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( p === RGBA_ASTC_4x4_Format || p === RGBA_ASTC_5x4_Format || p === RGBA_ASTC_5x5_Format ||\n\t\t\tp === RGBA_ASTC_6x5_Format || p === RGBA_ASTC_6x6_Format || p === RGBA_ASTC_8x5_Format ||\n\t\t\tp === RGBA_ASTC_8x6_Format || p === RGBA_ASTC_8x8_Format || p === RGBA_ASTC_10x5_Format ||\n\t\t\tp === RGBA_ASTC_10x6_Format || p === RGBA_ASTC_10x8_Format || p === RGBA_ASTC_10x10_Format ||\n\t\t\tp === RGBA_ASTC_12x10_Format || p === RGBA_ASTC_12x12_Format ) {\n\n\t\t\textension = extensions.get( 'WEBGL_compressed_texture_astc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\t// TODO Complete?\n\n\t\t\t\treturn p;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( p === UnsignedInt248Type ) {\n\n\t\t\tif ( isWebGL2 ) return 34042;\n\n\t\t\textension = extensions.get( 'WEBGL_depth_texture' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\treturn extension.UNSIGNED_INT_24_8_WEBGL;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\treturn { convert: convert };\n\n}\n\n/**\n * @author fernandojsg / http://fernandojsg.com\n * @author Takahiro https://github.com/takahirox\n */\n\nfunction WebGLMultiviewRenderTarget( width, height, numViews, options ) {\n\n\tWebGLRenderTarget.call( this, width, height, options );\n\n\tthis.depthBuffer = false;\n\tthis.stencilBuffer = false;\n\n\tthis.numViews = numViews;\n\n}\n\nWebGLMultiviewRenderTarget.prototype = Object.assign( Object.create( WebGLRenderTarget.prototype ), {\n\n\tconstructor: WebGLMultiviewRenderTarget,\n\n\tisWebGLMultiviewRenderTarget: true,\n\n\tcopy: function ( source ) {\n\n\t\tWebGLRenderTarget.prototype.copy.call( this, source );\n\n\t\tthis.numViews = source.numViews;\n\n\t\treturn this;\n\n\t},\n\n\tsetNumViews: function ( numViews ) {\n\n\t\tif ( this.numViews !== numViews ) {\n\n\t\t\tthis.numViews = numViews;\n\t\t\tthis.dispose();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n} );\n\n/**\n * @author fernandojsg / http://fernandojsg.com\n * @author Takahiro https://github.com/takahirox\n */\n\nfunction WebGLMultiview( renderer, gl ) {\n\n\tvar DEFAULT_NUMVIEWS = 2;\n\n\tvar extensions = renderer.extensions;\n\tvar properties = renderer.properties;\n\n\tvar renderTarget, currentRenderTarget;\n\tvar mat3, mat4, cameraArray, renderSize;\n\n\tvar available;\n\tvar maxNumViews = 0;\n\n\t//\n\n\tfunction isAvailable() {\n\n\t\tif ( available === undefined ) {\n\n\t\t\tvar extension = extensions.get( 'OVR_multiview2' );\n\n\t\t\tavailable = extension !== null && gl.getContextAttributes().antialias === false;\n\n\t\t\tif ( available ) {\n\n\t\t\t\tmaxNumViews = gl.getParameter( extension.MAX_VIEWS_OVR );\n\t\t\t\trenderTarget = new WebGLMultiviewRenderTarget( 0, 0, DEFAULT_NUMVIEWS );\n\n\t\t\t\trenderSize = new Vector2();\n\t\t\t\tmat4 = [];\n\t\t\t\tmat3 = [];\n\t\t\t\tcameraArray = [];\n\n\t\t\t\tfor ( var i = 0; i < maxNumViews; i ++ ) {\n\n\t\t\t\t\tmat4[ i ] = new Matrix4();\n\t\t\t\t\tmat3[ i ] = new Matrix3();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn available;\n\n\t}\n\n\tfunction getCameraArray( camera ) {\n\n\t\tif ( camera.isArrayCamera ) return camera.cameras;\n\n\t\tcameraArray[ 0 ] = camera;\n\n\t\treturn cameraArray;\n\n\t}\n\n\tfunction updateCameraProjectionMatricesUniform( camera, uniforms ) {\n\n\t\tvar cameras = getCameraArray( camera );\n\n\t\tfor ( var i = 0; i < cameras.length; i ++ ) {\n\n\t\t\tmat4[ i ].copy( cameras[ i ].projectionMatrix );\n\n\t\t}\n\n\t\tuniforms.setValue( gl, 'projectionMatrices', mat4 );\n\n\t}\n\n\tfunction updateCameraViewMatricesUniform( camera, uniforms ) {\n\n\t\tvar cameras = getCameraArray( camera );\n\n\t\tfor ( var i = 0; i < cameras.length; i ++ ) {\n\n\t\t\tmat4[ i ].copy( cameras[ i ].matrixWorldInverse );\n\n\t\t}\n\n\t\tuniforms.setValue( gl, 'viewMatrices', mat4 );\n\n\t}\n\n\tfunction updateObjectMatricesUniforms( object, camera, uniforms ) {\n\n\t\tvar cameras = getCameraArray( camera );\n\n\t\tfor ( var i = 0; i < cameras.length; i ++ ) {\n\n\t\t\tmat4[ i ].multiplyMatrices( cameras[ i ].matrixWorldInverse, object.matrixWorld );\n\t\t\tmat3[ i ].getNormalMatrix( mat4[ i ] );\n\n\t\t}\n\n\t\tuniforms.setValue( gl, 'modelViewMatrices', mat4 );\n\t\tuniforms.setValue( gl, 'normalMatrices', mat3 );\n\n\t}\n\n\tfunction isMultiviewCompatible( camera ) {\n\n\t\tif ( camera.isArrayCamera === undefined ) return true;\n\n\t\tvar cameras = camera.cameras;\n\n\t\tif ( cameras.length > maxNumViews ) return false;\n\n\t\tfor ( var i = 1, il = cameras.length; i < il; i ++ ) {\n\n\t\t\tif ( cameras[ 0 ].viewport.z !== cameras[ i ].viewport.z ||\n\t\t\t\tcameras[ 0 ].viewport.w !== cameras[ i ].viewport.w ) return false;\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tfunction resizeRenderTarget( camera ) {\n\n\t\tif ( currentRenderTarget ) {\n\n\t\t\trenderSize.set( currentRenderTarget.width, currentRenderTarget.height );\n\n\t\t} else {\n\n\t\t\trenderer.getDrawingBufferSize( renderSize );\n\n\t\t}\n\n\t\tif ( camera.isArrayCamera ) {\n\n\t\t\tvar viewport = camera.cameras[ 0 ].viewport;\n\n\t\t\trenderTarget.setSize( viewport.z, viewport.w );\n\t\t\trenderTarget.setNumViews( camera.cameras.length );\n\n\t\t} else {\n\n\t\t\trenderTarget.setSize( renderSize.x, renderSize.y );\n\t\t\trenderTarget.setNumViews( DEFAULT_NUMVIEWS );\n\n\t\t}\n\n\t}\n\n\tfunction attachCamera( camera ) {\n\n\t\tif ( isMultiviewCompatible( camera ) === false ) return;\n\n\t\tcurrentRenderTarget = renderer.getRenderTarget();\n\t\tresizeRenderTarget( camera );\n\t\trenderer.setRenderTarget( renderTarget );\n\n\t}\n\n\tfunction detachCamera( camera ) {\n\n\t\tif ( renderTarget !== renderer.getRenderTarget() ) return;\n\n\t\trenderer.setRenderTarget( currentRenderTarget );\n\n\t\tflush( camera );\n\n\t}\n\n\tfunction flush( camera ) {\n\n\t\tvar srcRenderTarget = renderTarget;\n\t\tvar numViews = srcRenderTarget.numViews;\n\n\t\tvar srcFramebuffers = properties.get( srcRenderTarget ).__webglViewFramebuffers;\n\n\t\tvar viewWidth = srcRenderTarget.width;\n\t\tvar viewHeight = srcRenderTarget.height;\n\n\t\tif ( camera.isArrayCamera ) {\n\n\t\t\tfor ( var i = 0; i < numViews; i ++ ) {\n\n\t\t\t\tvar viewport = camera.cameras[ i ].viewport;\n\n\t\t\t\tvar x1 = viewport.x;\n\t\t\t\tvar y1 = viewport.y;\n\t\t\t\tvar x2 = x1 + viewport.z;\n\t\t\t\tvar y2 = y1 + viewport.w;\n\n\t\t\t\tgl.bindFramebuffer( 36008, srcFramebuffers[ i ] );\n\t\t\t\tgl.blitFramebuffer( 0, 0, viewWidth, viewHeight, x1, y1, x2, y2, 16384, 9728 );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tgl.bindFramebuffer( 36008, srcFramebuffers[ 0 ] );\n\t\t\tgl.blitFramebuffer( 0, 0, viewWidth, viewHeight, 0, 0, renderSize.x, renderSize.y, 16384, 9728 );\n\n\t\t}\n\n\t}\n\n\tthis.isAvailable = isAvailable;\n\tthis.attachCamera = attachCamera;\n\tthis.detachCamera = detachCamera;\n\tthis.updateCameraProjectionMatricesUniform = updateCameraProjectionMatricesUniform;\n\tthis.updateCameraViewMatricesUniform = updateCameraViewMatricesUniform;\n\tthis.updateObjectMatricesUniforms = updateObjectMatricesUniforms;\n\n}\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction ArrayCamera( array ) {\n\n\tPerspectiveCamera.call( this );\n\n\tthis.cameras = array || [];\n\n}\n\nArrayCamera.prototype = Object.assign( Object.create( PerspectiveCamera.prototype ), {\n\n\tconstructor: ArrayCamera,\n\n\tisArrayCamera: true\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction Group() {\n\n\tObject3D.call( this );\n\n\tthis.type = 'Group';\n\n}\n\nGroup.prototype = Object.assign( Object.create( Object3D.prototype ), {\n\n\tconstructor: Group,\n\n\tisGroup: true\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction WebXRManager( renderer, gl ) {\n\n\tvar scope = this;\n\n\tvar session = null;\n\n\t// var framebufferScaleFactor = 1.0;\n\n\tvar referenceSpace = null;\n\tvar referenceSpaceType = 'local-floor';\n\n\tvar pose = null;\n\n\tvar controllers = [];\n\tvar inputSourcesMap = new Map();\n\n\t//\n\n\tvar cameraL = new PerspectiveCamera();\n\tcameraL.layers.enable( 1 );\n\tcameraL.viewport = new Vector4();\n\n\tvar cameraR = new PerspectiveCamera();\n\tcameraR.layers.enable( 2 );\n\tcameraR.viewport = new Vector4();\n\n\tvar cameraVR = new ArrayCamera( [ cameraL, cameraR ] );\n\tcameraVR.layers.enable( 1 );\n\tcameraVR.layers.enable( 2 );\n\n\tvar _currentDepthNear = null;\n\tvar _currentDepthFar = null;\n\n\t//\n\n\tthis.enabled = false;\n\n\tthis.isPresenting = false;\n\n\tthis.getController = function ( id ) {\n\n\t\tvar controller = controllers[ id ];\n\n\t\tif ( controller === undefined ) {\n\n\t\t\tcontroller = {};\n\t\t\tcontrollers[ id ] = controller;\n\n\t\t}\n\n\t\tif ( controller.targetRay === undefined ) {\n\n\t\t\tcontroller.targetRay = new Group();\n\t\t\tcontroller.targetRay.matrixAutoUpdate = false;\n\t\t\tcontroller.targetRay.visible = false;\n\n\t\t}\n\n\t\treturn controller.targetRay;\n\n\t};\n\n\tthis.getControllerGrip = function ( id ) {\n\n\t\tvar controller = controllers[ id ];\n\n\t\tif ( controller === undefined ) {\n\n\t\t\tcontroller = {};\n\t\t\tcontrollers[ id ] = controller;\n\n\t\t}\n\n\t\tif ( controller.grip === undefined ) {\n\n\t\t\tcontroller.grip = new Group();\n\t\t\tcontroller.grip.matrixAutoUpdate = false;\n\t\t\tcontroller.grip.visible = false;\n\n\t\t}\n\n\t\treturn controller.grip;\n\n\t};\n\n\t//\n\n\tfunction onSessionEvent( event ) {\n\n\t\tvar controller = inputSourcesMap.get( event.inputSource );\n\n\t\tif ( controller ) {\n\n\t\t\tif ( controller.targetRay ) {\n\n\t\t\t\tcontroller.targetRay.dispatchEvent( { type: event.type } );\n\n\t\t\t}\n\n\t\t\tif ( controller.grip ) {\n\n\t\t\t\tcontroller.grip.dispatchEvent( { type: event.type } );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction onSessionEnd() {\n\n\t\tinputSourcesMap.forEach( function ( controller, inputSource ) {\n\n\t\t\tif ( controller.targetRay ) {\n\n\t\t\t\tcontroller.targetRay.dispatchEvent( { type: 'disconnected', data: inputSource } );\n\t\t\t\tcontroller.targetRay.visible = false;\n\n\t\t\t}\n\n\t\t\tif ( controller.grip ) {\n\n\t\t\t\tcontroller.grip.dispatchEvent( { type: 'disconnected', data: inputSource } );\n\t\t\t\tcontroller.grip.visible = false;\n\n\t\t\t}\n\n\t\t} );\n\n\t\tinputSourcesMap.clear();\n\n\t\t//\n\n\t\trenderer.setFramebuffer( null );\n\t\trenderer.setRenderTarget( renderer.getRenderTarget() ); // Hack #15830\n\t\tanimation.stop();\n\n\t\tscope.isPresenting = false;\n\n\t\tscope.dispatchEvent( { type: 'sessionend' } );\n\n\t}\n\n\tfunction onRequestReferenceSpace( value ) {\n\n\t\treferenceSpace = value;\n\n\t\tanimation.setContext( session );\n\t\tanimation.start();\n\n\t\tscope.isPresenting = true;\n\n\t\tscope.dispatchEvent( { type: 'sessionstart' } );\n\n\t}\n\n\tthis.setFramebufferScaleFactor = function ( /* value */ ) {\n\n\t\t// framebufferScaleFactor = value;\n\n\t};\n\n\tthis.setReferenceSpaceType = function ( value ) {\n\n\t\treferenceSpaceType = value;\n\n\t};\n\n\tthis.getReferenceSpace = function () {\n\n\t\treturn referenceSpace;\n\n\t};\n\n\tthis.getSession = function () {\n\n\t\treturn session;\n\n\t};\n\n\tthis.setSession = function ( value ) {\n\n\t\tsession = value;\n\n\t\tif ( session !== null ) {\n\n\t\t\tsession.addEventListener( 'select', onSessionEvent );\n\t\t\tsession.addEventListener( 'selectstart', onSessionEvent );\n\t\t\tsession.addEventListener( 'selectend', onSessionEvent );\n\t\t\tsession.addEventListener( 'squeeze', onSessionEvent );\n\t\t\tsession.addEventListener( 'squeezestart', onSessionEvent );\n\t\t\tsession.addEventListener( 'squeezeend', onSessionEvent );\n\t\t\tsession.addEventListener( 'end', onSessionEnd );\n\n\t\t\tvar attributes = gl.getContextAttributes();\n\n\t\t\tvar layerInit = {\n\t\t\t\tantialias: attributes.antialias,\n\t\t\t\talpha: attributes.alpha,\n\t\t\t\tdepth: attributes.depth,\n\t\t\t\tstencil: attributes.stencil\n\t\t\t};\n\n\t\t\t// eslint-disable-next-line no-undef\n\t\t\tvar baseLayer = new XRWebGLLayer( session, gl, layerInit );\n\n\t\t\tsession.updateRenderState( { baseLayer: baseLayer } );\n\n\t\t\tsession.requestReferenceSpace( referenceSpaceType ).then( onRequestReferenceSpace );\n\n\t\t\t//\n\n\t\t\tsession.addEventListener( 'inputsourceschange', updateInputSources );\n\n\t\t}\n\n\t};\n\n\tfunction updateInputSources( event ) {\n\n\t\tvar inputSources = session.inputSources;\n\n\t\t// Assign inputSources to available controllers\n\n\t\tfor ( var i = 0; i < controllers.length; i ++ ) {\n\n\t\t\tinputSourcesMap.set( inputSources[ i ], controllers[ i ] );\n\n\t\t}\n\n\t\t// Notify disconnected\n\n\t\tfor ( var i = 0; i < event.removed.length; i ++ ) {\n\n\t\t\tvar inputSource = event.removed[ i ];\n\t\t\tvar controller = inputSourcesMap.get( inputSource );\n\n\t\t\tif ( controller ) {\n\n\t\t\t\tif ( controller.targetRay ) {\n\n\t\t\t\t\tcontroller.targetRay.dispatchEvent( { type: 'disconnected', data: inputSource } );\n\n\t\t\t\t}\n\n\t\t\t\tif ( controller.grip ) {\n\n\t\t\t\t\tcontroller.grip.dispatchEvent( { type: 'disconnected', data: inputSource } );\n\n\t\t\t\t}\n\n\t\t\t\tinputSourcesMap.delete( inputSource );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Notify connected\n\n\t\tfor ( var i = 0; i < event.added.length; i ++ ) {\n\n\t\t\tvar inputSource = event.added[ i ];\n\t\t\tvar controller = inputSourcesMap.get( inputSource );\n\n\t\t\tif ( controller ) {\n\n\t\t\t\tif ( controller.targetRay ) {\n\n\t\t\t\t\tcontroller.targetRay.dispatchEvent( { type: 'connected', data: inputSource } );\n\n\t\t\t\t}\n\n\t\t\t\tif ( controller.grip ) {\n\n\t\t\t\t\tcontroller.grip.dispatchEvent( { type: 'connected', data: inputSource } );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t//\n\n\tvar cameraLPos = new Vector3();\n\tvar cameraRPos = new Vector3();\n\n\t/**\n\t * @author jsantell / https://www.jsantell.com/\n\t *\n\t * Assumes 2 cameras that are parallel and share an X-axis, and that\n\t * the cameras' projection and world matrices have already been set.\n\t * And that near and far planes are identical for both cameras.\n\t * Visualization of this technique: https://computergraphics.stackexchange.com/a/4765\n\t */\n\tfunction setProjectionFromUnion( camera, cameraL, cameraR ) {\n\n\t\tcameraLPos.setFromMatrixPosition( cameraL.matrixWorld );\n\t\tcameraRPos.setFromMatrixPosition( cameraR.matrixWorld );\n\n\t\tvar ipd = cameraLPos.distanceTo( cameraRPos );\n\n\t\tvar projL = cameraL.projectionMatrix.elements;\n\t\tvar projR = cameraR.projectionMatrix.elements;\n\n\t\t// VR systems will have identical far and near planes, and\n\t\t// most likely identical top and bottom frustum extents.\n\t\t// Use the left camera for these values.\n\t\tvar near = projL[ 14 ] / ( projL[ 10 ] - 1 );\n\t\tvar far = projL[ 14 ] / ( projL[ 10 ] + 1 );\n\t\tvar topFov = ( projL[ 9 ] + 1 ) / projL[ 5 ];\n\t\tvar bottomFov = ( projL[ 9 ] - 1 ) / projL[ 5 ];\n\n\t\tvar leftFov = ( projL[ 8 ] - 1 ) / projL[ 0 ];\n\t\tvar rightFov = ( projR[ 8 ] + 1 ) / projR[ 0 ];\n\t\tvar left = near * leftFov;\n\t\tvar right = near * rightFov;\n\n\t\t// Calculate the new camera's position offset from the\n\t\t// left camera. xOffset should be roughly half `ipd`.\n\t\tvar zOffset = ipd / ( - leftFov + rightFov );\n\t\tvar xOffset = zOffset * - leftFov;\n\n\t\t// TODO: Better way to apply this offset?\n\t\tcameraL.matrixWorld.decompose( camera.position, camera.quaternion, camera.scale );\n\t\tcamera.translateX( xOffset );\n\t\tcamera.translateZ( zOffset );\n\t\tcamera.matrixWorld.compose( camera.position, camera.quaternion, camera.scale );\n\t\tcamera.matrixWorldInverse.getInverse( camera.matrixWorld );\n\n\t\t// Find the union of the frustum values of the cameras and scale\n\t\t// the values so that the near plane's position does not change in world space,\n\t\t// although must now be relative to the new union camera.\n\t\tvar near2 = near + zOffset;\n\t\tvar far2 = far + zOffset;\n\t\tvar left2 = left - xOffset;\n\t\tvar right2 = right + ( ipd - xOffset );\n\t\tvar top2 = topFov * far / far2 * near2;\n\t\tvar bottom2 = bottomFov * far / far2 * near2;\n\n\t\tcamera.projectionMatrix.makePerspective( left2, right2, top2, bottom2, near2, far2 );\n\n\t}\n\n\tfunction updateCamera( camera, parent ) {\n\n\t\tif ( parent === null ) {\n\n\t\t\tcamera.matrixWorld.copy( camera.matrix );\n\n\t\t} else {\n\n\t\t\tcamera.matrixWorld.multiplyMatrices( parent.matrixWorld, camera.matrix );\n\n\t\t}\n\n\t\tcamera.matrixWorldInverse.getInverse( camera.matrixWorld );\n\n\t}\n\n\tthis.getCamera = function ( camera ) {\n\n\t\tcameraVR.near = cameraR.near = cameraL.near = camera.near;\n\t\tcameraVR.far = cameraR.far = cameraL.far = camera.far;\n\n\t\tif ( _currentDepthNear !== cameraVR.near || _currentDepthFar !== cameraVR.far ) {\n\n\t\t\t// Note that the new renderState won't apply until the next frame. See #18320\n\n\t\t\tsession.updateRenderState( {\n\t\t\t\tdepthNear: cameraVR.near,\n\t\t\t\tdepthFar: cameraVR.far\n\t\t\t} );\n\n\t\t\t_currentDepthNear = cameraVR.near;\n\t\t\t_currentDepthFar = cameraVR.far;\n\n\t\t}\n\n\t\tvar parent = camera.parent;\n\t\tvar cameras = cameraVR.cameras;\n\n\t\tupdateCamera( cameraVR, parent );\n\n\t\tfor ( var i = 0; i < cameras.length; i ++ ) {\n\n\t\t\tupdateCamera( cameras[ i ], parent );\n\n\t\t}\n\n\t\t// update camera and its children\n\n\t\tcamera.matrixWorld.copy( cameraVR.matrixWorld );\n\n\t\tvar children = camera.children;\n\n\t\tfor ( var i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tchildren[ i ].updateMatrixWorld( true );\n\n\t\t}\n\n\t\tsetProjectionFromUnion( cameraVR, cameraL, cameraR );\n\n\t\treturn cameraVR;\n\n\t};\n\n\t// Animation Loop\n\n\tvar onAnimationFrameCallback = null;\n\n\tfunction onAnimationFrame( time, frame ) {\n\n\t\tpose = frame.getViewerPose( referenceSpace );\n\n\t\tif ( pose !== null ) {\n\n\t\t\tvar views = pose.views;\n\t\t\tvar baseLayer = session.renderState.baseLayer;\n\n\t\t\trenderer.setFramebuffer( baseLayer.framebuffer );\n\n\t\t\tfor ( var i = 0; i < views.length; i ++ ) {\n\n\t\t\t\tvar view = views[ i ];\n\t\t\t\tvar viewport = baseLayer.getViewport( view );\n\n\t\t\t\tvar camera = cameraVR.cameras[ i ];\n\t\t\t\tcamera.matrix.fromArray( view.transform.matrix );\n\t\t\t\tcamera.projectionMatrix.fromArray( view.projectionMatrix );\n\t\t\t\tcamera.viewport.set( viewport.x, viewport.y, viewport.width, viewport.height );\n\n\t\t\t\tif ( i === 0 ) {\n\n\t\t\t\t\tcameraVR.matrix.copy( camera.matrix );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tvar inputSources = session.inputSources;\n\n\t\tfor ( var i = 0; i < controllers.length; i ++ ) {\n\n\t\t\tvar controller = controllers[ i ];\n\n\t\t\tvar inputSource = inputSources[ i ];\n\n\t\t\tvar inputPose = null;\n\t\t\tvar gripPose = null;\n\n\t\t\tif ( inputSource ) {\n\n\t\t\t\tif ( controller.targetRay ) {\n\n\t\t\t\t\tinputPose = frame.getPose( inputSource.targetRaySpace, referenceSpace );\n\n\t\t\t\t\tif ( inputPose !== null ) {\n\n\t\t\t\t\t\tcontroller.targetRay.matrix.fromArray( inputPose.transform.matrix );\n\t\t\t\t\t\tcontroller.targetRay.matrix.decompose( controller.targetRay.position, controller.targetRay.rotation, controller.targetRay.scale );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( controller.grip && inputSource.gripSpace ) {\n\n\t\t\t\t\tgripPose = frame.getPose( inputSource.gripSpace, referenceSpace );\n\n\t\t\t\t\tif ( gripPose !== null ) {\n\n\t\t\t\t\t\tcontroller.grip.matrix.fromArray( gripPose.transform.matrix );\n\t\t\t\t\t\tcontroller.grip.matrix.decompose( controller.grip.position, controller.grip.rotation, controller.grip.scale );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( controller.targetRay ) {\n\n\t\t\t\tcontroller.targetRay.visible = inputPose !== null;\n\n\t\t\t}\n\n\t\t\tif ( controller.grip ) {\n\n\t\t\t\tcontroller.grip.visible = gripPose !== null;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( onAnimationFrameCallback ) onAnimationFrameCallback( time, frame );\n\n\t}\n\n\tvar animation = new WebGLAnimation();\n\tanimation.setAnimationLoop( onAnimationFrame );\n\n\tthis.setAnimationLoop = function ( callback ) {\n\n\t\tonAnimationFrameCallback = callback;\n\n\t};\n\n\tthis.dispose = function () {};\n\n}\n\nObject.assign( WebXRManager.prototype, EventDispatcher.prototype );\n\n/**\n * @author supereggbert / http://www.paulbrunt.co.uk/\n * @author mrdoob / http://mrdoob.com/\n * @author alteredq / http://alteredqualia.com/\n * @author szimek / https://github.com/szimek/\n * @author tschw\n */\n\nfunction WebGLRenderer( parameters ) {\n\n\tparameters = parameters || {};\n\n\tvar _canvas = parameters.canvas !== undefined ? parameters.canvas : document.createElementNS( 'http://www.w3.org/1999/xhtml', 'canvas' ),\n\t\t_context = parameters.context !== undefined ? parameters.context : null,\n\n\t\t_alpha = parameters.alpha !== undefined ? parameters.alpha : false,\n\t\t_depth = parameters.depth !== undefined ? parameters.depth : true,\n\t\t_stencil = parameters.stencil !== undefined ? parameters.stencil : true,\n\t\t_antialias = parameters.antialias !== undefined ? parameters.antialias : false,\n\t\t_premultipliedAlpha = parameters.premultipliedAlpha !== undefined ? parameters.premultipliedAlpha : true,\n\t\t_preserveDrawingBuffer = parameters.preserveDrawingBuffer !== undefined ? parameters.preserveDrawingBuffer : false,\n\t\t_powerPreference = parameters.powerPreference !== undefined ? parameters.powerPreference : 'default',\n\t\t_failIfMajorPerformanceCaveat = parameters.failIfMajorPerformanceCaveat !== undefined ? parameters.failIfMajorPerformanceCaveat : false;\n\n\tvar currentRenderList = null;\n\tvar currentRenderState = null;\n\n\t// public properties\n\n\tthis.domElement = _canvas;\n\n\t// Debug configuration container\n\tthis.debug = {\n\n\t\t/**\n\t\t * Enables error checking and reporting when shader programs are being compiled\n\t\t * @type {boolean}\n\t\t */\n\t\tcheckShaderErrors: true\n\t};\n\n\t// clearing\n\n\tthis.autoClear = true;\n\tthis.autoClearColor = true;\n\tthis.autoClearDepth = true;\n\tthis.autoClearStencil = true;\n\n\t// scene graph\n\n\tthis.sortObjects = true;\n\n\t// user-defined clipping\n\n\tthis.clippingPlanes = [];\n\tthis.localClippingEnabled = false;\n\n\t// physically based shading\n\n\tthis.gammaFactor = 2.0;\t// for backwards compatibility\n\tthis.outputEncoding = LinearEncoding;\n\n\t// physical lights\n\n\tthis.physicallyCorrectLights = false;\n\n\t// tone mapping\n\n\tthis.toneMapping = LinearToneMapping;\n\tthis.toneMappingExposure = 1.0;\n\tthis.toneMappingWhitePoint = 1.0;\n\n\t// morphs\n\n\tthis.maxMorphTargets = 8;\n\tthis.maxMorphNormals = 4;\n\n\t// internal properties\n\n\tvar _this = this,\n\n\t\t_isContextLost = false,\n\n\t\t// internal state cache\n\n\t\t_framebuffer = null,\n\n\t\t_currentActiveCubeFace = 0,\n\t\t_currentActiveMipmapLevel = 0,\n\t\t_currentRenderTarget = null,\n\t\t_currentFramebuffer = null,\n\t\t_currentMaterialId = - 1,\n\n\t\t// geometry and program caching\n\n\t\t_currentGeometryProgram = {\n\t\t\tgeometry: null,\n\t\t\tprogram: null,\n\t\t\twireframe: false\n\t\t},\n\n\t\t_currentCamera = null,\n\t\t_currentArrayCamera = null,\n\n\t\t_currentViewport = new Vector4(),\n\t\t_currentScissor = new Vector4(),\n\t\t_currentScissorTest = null,\n\n\t\t//\n\n\t\t_width = _canvas.width,\n\t\t_height = _canvas.height,\n\n\t\t_pixelRatio = 1,\n\t\t_opaqueSort = null,\n\t\t_transparentSort = null,\n\n\t\t_viewport = new Vector4( 0, 0, _width, _height ),\n\t\t_scissor = new Vector4( 0, 0, _width, _height ),\n\t\t_scissorTest = false,\n\n\t\t// frustum\n\n\t\t_frustum = new Frustum(),\n\n\t\t// clipping\n\n\t\t_clipping = new WebGLClipping(),\n\t\t_clippingEnabled = false,\n\t\t_localClippingEnabled = false,\n\n\t\t// camera matrices cache\n\n\t\t_projScreenMatrix = new Matrix4(),\n\n\t\t_vector3 = new Vector3();\n\n\tfunction getTargetPixelRatio() {\n\n\t\treturn _currentRenderTarget === null ? _pixelRatio : 1;\n\n\t}\n\n\t// initialize\n\n\tvar _gl;\n\n\ttry {\n\n\t\tvar contextAttributes = {\n\t\t\talpha: _alpha,\n\t\t\tdepth: _depth,\n\t\t\tstencil: _stencil,\n\t\t\tantialias: _antialias,\n\t\t\tpremultipliedAlpha: _premultipliedAlpha,\n\t\t\tpreserveDrawingBuffer: _preserveDrawingBuffer,\n\t\t\tpowerPreference: _powerPreference,\n\t\t\tfailIfMajorPerformanceCaveat: _failIfMajorPerformanceCaveat,\n\t\t\txrCompatible: true\n\t\t};\n\n\t\t// event listeners must be registered before WebGL context is created, see #12753\n\n\t\t_canvas.addEventListener( 'webglcontextlost', onContextLost, false );\n\t\t_canvas.addEventListener( 'webglcontextrestored', onContextRestore, false );\n\n\t\t_gl = _context || _canvas.getContext( 'webgl', contextAttributes ) || _canvas.getContext( 'experimental-webgl', contextAttributes );\n\n\t\tif ( _gl === null ) {\n\n\t\t\tif ( _canvas.getContext( 'webgl' ) !== null ) {\n\n\t\t\t\tthrow new Error( 'Error creating WebGL context with your selected attributes.' );\n\n\t\t\t} else {\n\n\t\t\t\tthrow new Error( 'Error creating WebGL context.' );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Some experimental-webgl implementations do not have getShaderPrecisionFormat\n\n\t\tif ( _gl.getShaderPrecisionFormat === undefined ) {\n\n\t\t\t_gl.getShaderPrecisionFormat = function () {\n\n\t\t\t\treturn { 'rangeMin': 1, 'rangeMax': 1, 'precision': 1 };\n\n\t\t\t};\n\n\t\t}\n\n\t} catch ( error ) {\n\n\t\tconsole.error( 'THREE.WebGLRenderer: ' + error.message );\n\t\tthrow error;\n\n\t}\n\n\tvar extensions, capabilities, state, info;\n\tvar properties, textures, attributes, geometries, objects;\n\tvar programCache, renderLists, renderStates;\n\n\tvar background, morphtargets, bufferRenderer, indexedBufferRenderer;\n\n\tvar utils;\n\n\tfunction initGLContext() {\n\n\t\textensions = new WebGLExtensions( _gl );\n\n\t\tcapabilities = new WebGLCapabilities( _gl, extensions, parameters );\n\n\t\tif ( capabilities.isWebGL2 === false ) {\n\n\t\t\textensions.get( 'WEBGL_depth_texture' );\n\t\t\textensions.get( 'OES_texture_float' );\n\t\t\textensions.get( 'OES_texture_half_float' );\n\t\t\textensions.get( 'OES_texture_half_float_linear' );\n\t\t\textensions.get( 'OES_standard_derivatives' );\n\t\t\textensions.get( 'OES_element_index_uint' );\n\t\t\textensions.get( 'ANGLE_instanced_arrays' );\n\n\t\t}\n\n\t\textensions.get( 'OES_texture_float_linear' );\n\n\t\tutils = new WebGLUtils( _gl, extensions, capabilities );\n\n\t\tstate = new WebGLState( _gl, extensions, capabilities );\n\t\tstate.scissor( _currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ).floor() );\n\t\tstate.viewport( _currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ).floor() );\n\n\t\tinfo = new WebGLInfo( _gl );\n\t\tproperties = new WebGLProperties();\n\t\ttextures = new WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info );\n\t\tattributes = new WebGLAttributes( _gl, capabilities );\n\t\tgeometries = new WebGLGeometries( _gl, attributes, info );\n\t\tobjects = new WebGLObjects( _gl, geometries, attributes, info );\n\t\tmorphtargets = new WebGLMorphtargets( _gl );\n\t\tprogramCache = new WebGLPrograms( _this, extensions, capabilities );\n\t\trenderLists = new WebGLRenderLists();\n\t\trenderStates = new WebGLRenderStates();\n\n\t\tbackground = new WebGLBackground( _this, state, objects, _premultipliedAlpha );\n\n\t\tbufferRenderer = new WebGLBufferRenderer( _gl, extensions, info, capabilities );\n\t\tindexedBufferRenderer = new WebGLIndexedBufferRenderer( _gl, extensions, info, capabilities );\n\n\t\tinfo.programs = programCache.programs;\n\n\t\t_this.capabilities = capabilities;\n\t\t_this.extensions = extensions;\n\t\t_this.properties = properties;\n\t\t_this.renderLists = renderLists;\n\t\t_this.state = state;\n\t\t_this.info = info;\n\n\t}\n\n\tinitGLContext();\n\n\t// xr\n\n\tvar xr = new WebXRManager( _this, _gl );\n\n\tthis.xr = xr;\n\n\t// Multiview\n\n\tvar multiview = new WebGLMultiview( _this, _gl );\n\n\t// shadow map\n\n\tvar shadowMap = new WebGLShadowMap( _this, objects, capabilities.maxTextureSize );\n\n\tthis.shadowMap = shadowMap;\n\n\t// API\n\n\tthis.getContext = function () {\n\n\t\treturn _gl;\n\n\t};\n\n\tthis.getContextAttributes = function () {\n\n\t\treturn _gl.getContextAttributes();\n\n\t};\n\n\tthis.forceContextLoss = function () {\n\n\t\tvar extension = extensions.get( 'WEBGL_lose_context' );\n\t\tif ( extension ) extension.loseContext();\n\n\t};\n\n\tthis.forceContextRestore = function () {\n\n\t\tvar extension = extensions.get( 'WEBGL_lose_context' );\n\t\tif ( extension ) extension.restoreContext();\n\n\t};\n\n\tthis.getPixelRatio = function () {\n\n\t\treturn _pixelRatio;\n\n\t};\n\n\tthis.setPixelRatio = function ( value ) {\n\n\t\tif ( value === undefined ) return;\n\n\t\t_pixelRatio = value;\n\n\t\tthis.setSize( _width, _height, false );\n\n\t};\n\n\tthis.getSize = function ( target ) {\n\n\t\tif ( target === undefined ) {\n\n\t\t\tconsole.warn( 'WebGLRenderer: .getsize() now requires a Vector2 as an argument' );\n\n\t\t\ttarget = new Vector2();\n\n\t\t}\n\n\t\treturn target.set( _width, _height );\n\n\t};\n\n\tthis.setSize = function ( width, height, updateStyle ) {\n\n\t\tif ( xr.isPresenting ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Can\\'t change size while VR device is presenting.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\t_width = width;\n\t\t_height = height;\n\n\t\t_canvas.width = Math.floor( width * _pixelRatio );\n\t\t_canvas.height = Math.floor( height * _pixelRatio );\n\n\t\tif ( updateStyle !== false ) {\n\n\t\t\t_canvas.style.width = width + 'px';\n\t\t\t_canvas.style.height = height + 'px';\n\n\t\t}\n\n\t\tthis.setViewport( 0, 0, width, height );\n\n\t};\n\n\tthis.getDrawingBufferSize = function ( target ) {\n\n\t\tif ( target === undefined ) {\n\n\t\t\tconsole.warn( 'WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument' );\n\n\t\t\ttarget = new Vector2();\n\n\t\t}\n\n\t\treturn target.set( _width * _pixelRatio, _height * _pixelRatio ).floor();\n\n\t};\n\n\tthis.setDrawingBufferSize = function ( width, height, pixelRatio ) {\n\n\t\t_width = width;\n\t\t_height = height;\n\n\t\t_pixelRatio = pixelRatio;\n\n\t\t_canvas.width = Math.floor( width * pixelRatio );\n\t\t_canvas.height = Math.floor( height * pixelRatio );\n\n\t\tthis.setViewport( 0, 0, width, height );\n\n\t};\n\n\tthis.getCurrentViewport = function ( target ) {\n\n\t\tif ( target === undefined ) {\n\n\t\t\tconsole.warn( 'WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument' );\n\n\t\t\ttarget = new Vector4();\n\n\t\t}\n\n\t\treturn target.copy( _currentViewport );\n\n\t};\n\n\tthis.getViewport = function ( target ) {\n\n\t\treturn target.copy( _viewport );\n\n\t};\n\n\tthis.setViewport = function ( x, y, width, height ) {\n\n\t\tif ( x.isVector4 ) {\n\n\t\t\t_viewport.set( x.x, x.y, x.z, x.w );\n\n\t\t} else {\n\n\t\t\t_viewport.set( x, y, width, height );\n\n\t\t}\n\n\t\tstate.viewport( _currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ).floor() );\n\n\t};\n\n\tthis.getScissor = function ( target ) {\n\n\t\treturn target.copy( _scissor );\n\n\t};\n\n\tthis.setScissor = function ( x, y, width, height ) {\n\n\t\tif ( x.isVector4 ) {\n\n\t\t\t_scissor.set( x.x, x.y, x.z, x.w );\n\n\t\t} else {\n\n\t\t\t_scissor.set( x, y, width, height );\n\n\t\t}\n\n\t\tstate.scissor( _currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ).floor() );\n\n\t};\n\n\tthis.getScissorTest = function () {\n\n\t\treturn _scissorTest;\n\n\t};\n\n\tthis.setScissorTest = function ( boolean ) {\n\n\t\tstate.setScissorTest( _scissorTest = boolean );\n\n\t};\n\n\tthis.setOpaqueSort = function ( method ) {\n\n\t\t_opaqueSort = method;\n\n\t};\n\n\tthis.setTransparentSort = function ( method ) {\n\n\t\t_transparentSort = method;\n\n\t};\n\n\t// Clearing\n\n\tthis.getClearColor = function () {\n\n\t\treturn background.getClearColor();\n\n\t};\n\n\tthis.setClearColor = function () {\n\n\t\tbackground.setClearColor.apply( background, arguments );\n\n\t};\n\n\tthis.getClearAlpha = function () {\n\n\t\treturn background.getClearAlpha();\n\n\t};\n\n\tthis.setClearAlpha = function () {\n\n\t\tbackground.setClearAlpha.apply( background, arguments );\n\n\t};\n\n\tthis.clear = function ( color, depth, stencil ) {\n\n\t\tvar bits = 0;\n\n\t\tif ( color === undefined || color ) bits |= 16384;\n\t\tif ( depth === undefined || depth ) bits |= 256;\n\t\tif ( stencil === undefined || stencil ) bits |= 1024;\n\n\t\t_gl.clear( bits );\n\n\t};\n\n\tthis.clearColor = function () {\n\n\t\tthis.clear( true, false, false );\n\n\t};\n\n\tthis.clearDepth = function () {\n\n\t\tthis.clear( false, true, false );\n\n\t};\n\n\tthis.clearStencil = function () {\n\n\t\tthis.clear( false, false, true );\n\n\t};\n\n\t//\n\n\tthis.dispose = function () {\n\n\t\t_canvas.removeEventListener( 'webglcontextlost', onContextLost, false );\n\t\t_canvas.removeEventListener( 'webglcontextrestored', onContextRestore, false );\n\n\t\trenderLists.dispose();\n\t\trenderStates.dispose();\n\t\tproperties.dispose();\n\t\tobjects.dispose();\n\n\t\txr.dispose();\n\n\t\tanimation.stop();\n\n\t};\n\n\t// Events\n\n\tfunction onContextLost( event ) {\n\n\t\tevent.preventDefault();\n\n\t\tconsole.log( 'THREE.WebGLRenderer: Context Lost.' );\n\n\t\t_isContextLost = true;\n\n\t}\n\n\tfunction onContextRestore( /* event */ ) {\n\n\t\tconsole.log( 'THREE.WebGLRenderer: Context Restored.' );\n\n\t\t_isContextLost = false;\n\n\t\tinitGLContext();\n\n\t}\n\n\tfunction onMaterialDispose( event ) {\n\n\t\tvar material = event.target;\n\n\t\tmaterial.removeEventListener( 'dispose', onMaterialDispose );\n\n\t\tdeallocateMaterial( material );\n\n\t}\n\n\t// Buffer deallocation\n\n\tfunction deallocateMaterial( material ) {\n\n\t\treleaseMaterialProgramReference( material );\n\n\t\tproperties.remove( material );\n\n\t}\n\n\n\tfunction releaseMaterialProgramReference( material ) {\n\n\t\tvar programInfo = properties.get( material ).program;\n\n\t\tmaterial.program = undefined;\n\n\t\tif ( programInfo !== undefined ) {\n\n\t\t\tprogramCache.releaseProgram( programInfo );\n\n\t\t}\n\n\t}\n\n\t// Buffer rendering\n\n\tfunction renderObjectImmediate( object, program ) {\n\n\t\tobject.render( function ( object ) {\n\n\t\t\t_this.renderBufferImmediate( object, program );\n\n\t\t} );\n\n\t}\n\n\tthis.renderBufferImmediate = function ( object, program ) {\n\n\t\tstate.initAttributes();\n\n\t\tvar buffers = properties.get( object );\n\n\t\tif ( object.hasPositions && ! buffers.position ) buffers.position = _gl.createBuffer();\n\t\tif ( object.hasNormals && ! buffers.normal ) buffers.normal = _gl.createBuffer();\n\t\tif ( object.hasUvs && ! buffers.uv ) buffers.uv = _gl.createBuffer();\n\t\tif ( object.hasColors && ! buffers.color ) buffers.color = _gl.createBuffer();\n\n\t\tvar programAttributes = program.getAttributes();\n\n\t\tif ( object.hasPositions ) {\n\n\t\t\t_gl.bindBuffer( 34962, buffers.position );\n\t\t\t_gl.bufferData( 34962, object.positionArray, 35048 );\n\n\t\t\tstate.enableAttribute( programAttributes.position );\n\t\t\t_gl.vertexAttribPointer( programAttributes.position, 3, 5126, false, 0, 0 );\n\n\t\t}\n\n\t\tif ( object.hasNormals ) {\n\n\t\t\t_gl.bindBuffer( 34962, buffers.normal );\n\t\t\t_gl.bufferData( 34962, object.normalArray, 35048 );\n\n\t\t\tstate.enableAttribute( programAttributes.normal );\n\t\t\t_gl.vertexAttribPointer( programAttributes.normal, 3, 5126, false, 0, 0 );\n\n\t\t}\n\n\t\tif ( object.hasUvs ) {\n\n\t\t\t_gl.bindBuffer( 34962, buffers.uv );\n\t\t\t_gl.bufferData( 34962, object.uvArray, 35048 );\n\n\t\t\tstate.enableAttribute( programAttributes.uv );\n\t\t\t_gl.vertexAttribPointer( programAttributes.uv, 2, 5126, false, 0, 0 );\n\n\t\t}\n\n\t\tif ( object.hasColors ) {\n\n\t\t\t_gl.bindBuffer( 34962, buffers.color );\n\t\t\t_gl.bufferData( 34962, object.colorArray, 35048 );\n\n\t\t\tstate.enableAttribute( programAttributes.color );\n\t\t\t_gl.vertexAttribPointer( programAttributes.color, 3, 5126, false, 0, 0 );\n\n\t\t}\n\n\t\tstate.disableUnusedAttributes();\n\n\t\t_gl.drawArrays( 4, 0, object.count );\n\n\t\tobject.count = 0;\n\n\t};\n\n\tvar tempScene = new Scene();\n\n\tthis.renderBufferDirect = function ( camera, scene, geometry, material, object, group ) {\n\n\t\tif ( scene === null ) scene = tempScene; // renderBufferDirect second parameter used to be fog (could be null)\n\n\t\tvar frontFaceCW = ( object.isMesh && object.matrixWorld.determinant() < 0 );\n\n\t\tvar program = setProgram( camera, scene, material, object );\n\n\t\tstate.setMaterial( material, frontFaceCW );\n\n\t\tvar updateBuffers = false;\n\n\t\tif ( _currentGeometryProgram.geometry !== geometry.id ||\n\t\t\t_currentGeometryProgram.program !== program.id ||\n\t\t\t_currentGeometryProgram.wireframe !== ( material.wireframe === true ) ) {\n\n\t\t\t_currentGeometryProgram.geometry = geometry.id;\n\t\t\t_currentGeometryProgram.program = program.id;\n\t\t\t_currentGeometryProgram.wireframe = material.wireframe === true;\n\t\t\tupdateBuffers = true;\n\n\t\t}\n\n\t\tif ( material.morphTargets || material.morphNormals ) {\n\n\t\t\tmorphtargets.update( object, geometry, material, program );\n\n\t\t\tupdateBuffers = true;\n\n\t\t}\n\n\t\t//\n\n\t\tvar index = geometry.index;\n\t\tvar position = geometry.attributes.position;\n\n\t\t//\n\n\t\tif ( index === null ) {\n\n\t\t\tif ( position === undefined || position.count === 0 ) return;\n\n\t\t} else if ( index.count === 0 ) {\n\n\t\t\treturn;\n\n\t\t}\n\n\t\t//\n\n\t\tvar rangeFactor = 1;\n\n\t\tif ( material.wireframe === true ) {\n\n\t\t\tindex = geometries.getWireframeAttribute( geometry );\n\t\t\trangeFactor = 2;\n\n\t\t}\n\n\t\tvar attribute;\n\t\tvar renderer = bufferRenderer;\n\n\t\tif ( index !== null ) {\n\n\t\t\tattribute = attributes.get( index );\n\n\t\t\trenderer = indexedBufferRenderer;\n\t\t\trenderer.setIndex( attribute );\n\n\t\t}\n\n\t\tif ( updateBuffers ) {\n\n\t\t\tsetupVertexAttributes( object, geometry, material, program );\n\n\t\t\tif ( index !== null ) {\n\n\t\t\t\t_gl.bindBuffer( 34963, attribute.buffer );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tvar dataCount = ( index !== null ) ? index.count : position.count;\n\n\t\tvar rangeStart = geometry.drawRange.start * rangeFactor;\n\t\tvar rangeCount = geometry.drawRange.count * rangeFactor;\n\n\t\tvar groupStart = group !== null ? group.start * rangeFactor : 0;\n\t\tvar groupCount = group !== null ? group.count * rangeFactor : Infinity;\n\n\t\tvar drawStart = Math.max( rangeStart, groupStart );\n\t\tvar drawEnd = Math.min( dataCount, rangeStart + rangeCount, groupStart + groupCount ) - 1;\n\n\t\tvar drawCount = Math.max( 0, drawEnd - drawStart + 1 );\n\n\t\tif ( drawCount === 0 ) return;\n\n\t\t//\n\n\t\tif ( object.isMesh ) {\n\n\t\t\tif ( material.wireframe === true ) {\n\n\t\t\t\tstate.setLineWidth( material.wireframeLinewidth * getTargetPixelRatio() );\n\t\t\t\trenderer.setMode( 1 );\n\n\t\t\t} else {\n\n\t\t\t\trenderer.setMode( 4 );\n\n\t\t\t}\n\n\t\t} else if ( object.isLine ) {\n\n\t\t\tvar lineWidth = material.linewidth;\n\n\t\t\tif ( lineWidth === undefined ) lineWidth = 1; // Not using Line*Material\n\n\t\t\tstate.setLineWidth( lineWidth * getTargetPixelRatio() );\n\n\t\t\tif ( object.isLineSegments ) {\n\n\t\t\t\trenderer.setMode( 1 );\n\n\t\t\t} else if ( object.isLineLoop ) {\n\n\t\t\t\trenderer.setMode( 2 );\n\n\t\t\t} else {\n\n\t\t\t\trenderer.setMode( 3 );\n\n\t\t\t}\n\n\t\t} else if ( object.isPoints ) {\n\n\t\t\trenderer.setMode( 0 );\n\n\t\t} else if ( object.isSprite ) {\n\n\t\t\trenderer.setMode( 4 );\n\n\t\t}\n\n\t\tif ( object.isInstancedMesh ) {\n\n\t\t\trenderer.renderInstances( geometry, drawStart, drawCount, object.count );\n\n\t\t} else if ( geometry.isInstancedBufferGeometry ) {\n\n\t\t\trenderer.renderInstances( geometry, drawStart, drawCount, geometry.maxInstancedCount );\n\n\t\t} else {\n\n\t\t\trenderer.render( drawStart, drawCount );\n\n\t\t}\n\n\t};\n\n\tfunction setupVertexAttributes( object, geometry, material, program ) {\n\n\t\tif ( capabilities.isWebGL2 === false && ( object.isInstancedMesh || geometry.isInstancedBufferGeometry ) ) {\n\n\t\t\tif ( extensions.get( 'ANGLE_instanced_arrays' ) === null ) return;\n\n\t\t}\n\n\t\tstate.initAttributes();\n\n\t\tvar geometryAttributes = geometry.attributes;\n\n\t\tvar programAttributes = program.getAttributes();\n\n\t\tvar materialDefaultAttributeValues = material.defaultAttributeValues;\n\n\t\tfor ( var name in programAttributes ) {\n\n\t\t\tvar programAttribute = programAttributes[ name ];\n\n\t\t\tif ( programAttribute >= 0 ) {\n\n\t\t\t\tvar geometryAttribute = geometryAttributes[ name ];\n\n\t\t\t\tif ( geometryAttribute !== undefined ) {\n\n\t\t\t\t\tvar normalized = geometryAttribute.normalized;\n\t\t\t\t\tvar size = geometryAttribute.itemSize;\n\n\t\t\t\t\tvar attribute = attributes.get( geometryAttribute );\n\n\t\t\t\t\t// TODO Attribute may not be available on context restore\n\n\t\t\t\t\tif ( attribute === undefined ) continue;\n\n\t\t\t\t\tvar buffer = attribute.buffer;\n\t\t\t\t\tvar type = attribute.type;\n\t\t\t\t\tvar bytesPerElement = attribute.bytesPerElement;\n\n\t\t\t\t\tif ( geometryAttribute.isInterleavedBufferAttribute ) {\n\n\t\t\t\t\t\tvar data = geometryAttribute.data;\n\t\t\t\t\t\tvar stride = data.stride;\n\t\t\t\t\t\tvar offset = geometryAttribute.offset;\n\n\t\t\t\t\t\tif ( data && data.isInstancedInterleavedBuffer ) {\n\n\t\t\t\t\t\t\tstate.enableAttributeAndDivisor( programAttribute, data.meshPerAttribute );\n\n\t\t\t\t\t\t\tif ( geometry.maxInstancedCount === undefined ) {\n\n\t\t\t\t\t\t\t\tgeometry.maxInstancedCount = data.meshPerAttribute * data.count;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tstate.enableAttribute( programAttribute );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t_gl.bindBuffer( 34962, buffer );\n\t\t\t\t\t\t_gl.vertexAttribPointer( programAttribute, size, type, normalized, stride * bytesPerElement, offset * bytesPerElement );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tif ( geometryAttribute.isInstancedBufferAttribute ) {\n\n\t\t\t\t\t\t\tstate.enableAttributeAndDivisor( programAttribute, geometryAttribute.meshPerAttribute );\n\n\t\t\t\t\t\t\tif ( geometry.maxInstancedCount === undefined ) {\n\n\t\t\t\t\t\t\t\tgeometry.maxInstancedCount = geometryAttribute.meshPerAttribute * geometryAttribute.count;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tstate.enableAttribute( programAttribute );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t_gl.bindBuffer( 34962, buffer );\n\t\t\t\t\t\t_gl.vertexAttribPointer( programAttribute, size, type, normalized, 0, 0 );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( name === 'instanceMatrix' ) {\n\n\t\t\t\t\tvar attribute = attributes.get( object.instanceMatrix );\n\n\t\t\t\t\t// TODO Attribute may not be available on context restore\n\n\t\t\t\t\tif ( attribute === undefined ) continue;\n\n\t\t\t\t\tvar buffer = attribute.buffer;\n\t\t\t\t\tvar type = attribute.type;\n\n\t\t\t\t\tstate.enableAttributeAndDivisor( programAttribute + 0, 1 );\n\t\t\t\t\tstate.enableAttributeAndDivisor( programAttribute + 1, 1 );\n\t\t\t\t\tstate.enableAttributeAndDivisor( programAttribute + 2, 1 );\n\t\t\t\t\tstate.enableAttributeAndDivisor( programAttribute + 3, 1 );\n\n\t\t\t\t\t_gl.bindBuffer( 34962, buffer );\n\n\t\t\t\t\t_gl.vertexAttribPointer( programAttribute + 0, 4, type, false, 64, 0 );\n\t\t\t\t\t_gl.vertexAttribPointer( programAttribute + 1, 4, type, false, 64, 16 );\n\t\t\t\t\t_gl.vertexAttribPointer( programAttribute + 2, 4, type, false, 64, 32 );\n\t\t\t\t\t_gl.vertexAttribPointer( programAttribute + 3, 4, type, false, 64, 48 );\n\n\t\t\t\t} else if ( materialDefaultAttributeValues !== undefined ) {\n\n\t\t\t\t\tvar value = materialDefaultAttributeValues[ name ];\n\n\t\t\t\t\tif ( value !== undefined ) {\n\n\t\t\t\t\t\tswitch ( value.length ) {\n\n\t\t\t\t\t\t\tcase 2:\n\t\t\t\t\t\t\t\t_gl.vertexAttrib2fv( programAttribute, value );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase 3:\n\t\t\t\t\t\t\t\t_gl.vertexAttrib3fv( programAttribute, value );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase 4:\n\t\t\t\t\t\t\t\t_gl.vertexAttrib4fv( programAttribute, value );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t_gl.vertexAttrib1fv( programAttribute, value );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tstate.disableUnusedAttributes();\n\n\t}\n\n\t// Compile\n\n\tthis.compile = function ( scene, camera ) {\n\n\t\tcurrentRenderState = renderStates.get( scene, camera );\n\t\tcurrentRenderState.init();\n\n\t\tscene.traverse( function ( object ) {\n\n\t\t\tif ( object.isLight ) {\n\n\t\t\t\tcurrentRenderState.pushLight( object );\n\n\t\t\t\tif ( object.castShadow ) {\n\n\t\t\t\t\tcurrentRenderState.pushShadow( object );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} );\n\n\t\tcurrentRenderState.setupLights( camera );\n\n\t\tvar compiled = {};\n\n\t\tscene.traverse( function ( object ) {\n\n\t\t\tif ( object.material ) {\n\n\t\t\t\tif ( Array.isArray( object.material ) ) {\n\n\t\t\t\t\tfor ( var i = 0; i < object.material.length; i ++ ) {\n\n\t\t\t\t\t\tif ( object.material[ i ].uuid in compiled === false ) {\n\n\t\t\t\t\t\t\tinitMaterial( object.material[ i ], scene, object );\n\t\t\t\t\t\t\tcompiled[ object.material[ i ].uuid ] = true;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( object.material.uuid in compiled === false ) {\n\n\t\t\t\t\tinitMaterial( object.material, scene, object );\n\t\t\t\t\tcompiled[ object.material.uuid ] = true;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} );\n\n\t};\n\n\t// Animation Loop\n\n\tvar onAnimationFrameCallback = null;\n\n\tfunction onAnimationFrame( time ) {\n\n\t\tif ( xr.isPresenting ) return;\n\t\tif ( onAnimationFrameCallback ) onAnimationFrameCallback( time );\n\n\t}\n\n\tvar animation = new WebGLAnimation();\n\tanimation.setAnimationLoop( onAnimationFrame );\n\n\tif ( typeof window !== 'undefined' ) animation.setContext( window );\n\n\tthis.setAnimationLoop = function ( callback ) {\n\n\t\tonAnimationFrameCallback = callback;\n\t\txr.setAnimationLoop( callback );\n\n\t\tanimation.start();\n\n\t};\n\n\t// Rendering\n\n\tthis.render = function ( scene, camera ) {\n\n\t\tvar renderTarget, forceClear;\n\n\t\tif ( arguments[ 2 ] !== undefined ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead.' );\n\t\t\trenderTarget = arguments[ 2 ];\n\n\t\t}\n\n\t\tif ( arguments[ 3 ] !== undefined ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead.' );\n\t\t\tforceClear = arguments[ 3 ];\n\n\t\t}\n\n\t\tif ( ! ( camera && camera.isCamera ) ) {\n\n\t\t\tconsole.error( 'THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( _isContextLost ) return;\n\n\t\t// reset caching for this frame\n\n\t\t_currentGeometryProgram.geometry = null;\n\t\t_currentGeometryProgram.program = null;\n\t\t_currentGeometryProgram.wireframe = false;\n\t\t_currentMaterialId = - 1;\n\t\t_currentCamera = null;\n\n\t\t// update scene graph\n\n\t\tif ( scene.autoUpdate === true ) scene.updateMatrixWorld();\n\n\t\t// update camera matrices and frustum\n\n\t\tif ( camera.parent === null ) camera.updateMatrixWorld();\n\n\t\tif ( xr.enabled && xr.isPresenting ) {\n\n\t\t\tcamera = xr.getCamera( camera );\n\n\t\t}\n\n\t\t//\n\n\t\tcurrentRenderState = renderStates.get( scene, camera );\n\t\tcurrentRenderState.init();\n\n\t\tscene.onBeforeRender( _this, scene, camera, renderTarget || _currentRenderTarget );\n\n\t\t_projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );\n\t\t_frustum.setFromProjectionMatrix( _projScreenMatrix );\n\n\t\t_localClippingEnabled = this.localClippingEnabled;\n\t\t_clippingEnabled = _clipping.init( this.clippingPlanes, _localClippingEnabled, camera );\n\n\t\tcurrentRenderList = renderLists.get( scene, camera );\n\t\tcurrentRenderList.init();\n\n\t\tprojectObject( scene, camera, 0, _this.sortObjects );\n\n\t\tif ( _this.sortObjects === true ) {\n\n\t\t\tcurrentRenderList.sort( _opaqueSort, _transparentSort );\n\n\t\t}\n\n\t\t//\n\n\t\tif ( _clippingEnabled ) _clipping.beginShadows();\n\n\t\tvar shadowsArray = currentRenderState.state.shadowsArray;\n\n\t\tshadowMap.render( shadowsArray, scene, camera );\n\n\t\tcurrentRenderState.setupLights( camera );\n\n\t\tif ( _clippingEnabled ) _clipping.endShadows();\n\n\t\t//\n\n\t\tif ( this.info.autoReset ) this.info.reset();\n\n\t\tif ( renderTarget !== undefined ) {\n\n\t\t\tthis.setRenderTarget( renderTarget );\n\n\t\t}\n\n\t\tif ( xr.enabled && multiview.isAvailable() ) {\n\n\t\t\tmultiview.attachCamera( camera );\n\n\t\t}\n\n\t\t//\n\n\t\tbackground.render( currentRenderList, scene, camera, forceClear );\n\n\t\t// render scene\n\n\t\tvar opaqueObjects = currentRenderList.opaque;\n\t\tvar transparentObjects = currentRenderList.transparent;\n\n\t\tif ( scene.overrideMaterial ) {\n\n\t\t\tvar overrideMaterial = scene.overrideMaterial;\n\n\t\t\tif ( opaqueObjects.length ) renderObjects( opaqueObjects, scene, camera, overrideMaterial );\n\t\t\tif ( transparentObjects.length ) renderObjects( transparentObjects, scene, camera, overrideMaterial );\n\n\t\t} else {\n\n\t\t\t// opaque pass (front-to-back order)\n\n\t\t\tif ( opaqueObjects.length ) renderObjects( opaqueObjects, scene, camera );\n\n\t\t\t// transparent pass (back-to-front order)\n\n\t\t\tif ( transparentObjects.length ) renderObjects( transparentObjects, scene, camera );\n\n\t\t}\n\n\t\t//\n\n\t\tscene.onAfterRender( _this, scene, camera );\n\n\t\t//\n\n\t\tif ( _currentRenderTarget !== null ) {\n\n\t\t\t// Generate mipmap if we're using any kind of mipmap filtering\n\n\t\t\ttextures.updateRenderTargetMipmap( _currentRenderTarget );\n\n\t\t\t// resolve multisample renderbuffers to a single-sample texture if necessary\n\n\t\t\ttextures.updateMultisampleRenderTarget( _currentRenderTarget );\n\n\t\t}\n\n\t\t// Ensure depth buffer writing is enabled so it can be cleared on next render\n\n\t\tstate.buffers.depth.setTest( true );\n\t\tstate.buffers.depth.setMask( true );\n\t\tstate.buffers.color.setMask( true );\n\n\t\tstate.setPolygonOffset( false );\n\n\t\tif ( xr.enabled ) {\n\n\t\t\tif ( multiview.isAvailable() ) {\n\n\t\t\t\tmultiview.detachCamera( camera );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// _gl.finish();\n\n\t\tcurrentRenderList = null;\n\t\tcurrentRenderState = null;\n\n\t};\n\n\tfunction projectObject( object, camera, groupOrder, sortObjects ) {\n\n\t\tif ( object.visible === false ) return;\n\n\t\tvar visible = object.layers.test( camera.layers );\n\n\t\tif ( visible ) {\n\n\t\t\tif ( object.isGroup ) {\n\n\t\t\t\tgroupOrder = object.renderOrder;\n\n\t\t\t} else if ( object.isLOD ) {\n\n\t\t\t\tif ( object.autoUpdate === true ) object.update( camera );\n\n\t\t\t} else if ( object.isLight ) {\n\n\t\t\t\tcurrentRenderState.pushLight( object );\n\n\t\t\t\tif ( object.castShadow ) {\n\n\t\t\t\t\tcurrentRenderState.pushShadow( object );\n\n\t\t\t\t}\n\n\t\t\t} else if ( object.isSprite ) {\n\n\t\t\t\tif ( ! object.frustumCulled || _frustum.intersectsSprite( object ) ) {\n\n\t\t\t\t\tif ( sortObjects ) {\n\n\t\t\t\t\t\t_vector3.setFromMatrixPosition( object.matrixWorld )\n\t\t\t\t\t\t\t.applyMatrix4( _projScreenMatrix );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tvar geometry = objects.update( object );\n\t\t\t\t\tvar material = object.material;\n\n\t\t\t\t\tif ( material.visible ) {\n\n\t\t\t\t\t\tcurrentRenderList.push( object, geometry, material, groupOrder, _vector3.z, null );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else if ( object.isImmediateRenderObject ) {\n\n\t\t\t\tif ( sortObjects ) {\n\n\t\t\t\t\t_vector3.setFromMatrixPosition( object.matrixWorld )\n\t\t\t\t\t\t.applyMatrix4( _projScreenMatrix );\n\n\t\t\t\t}\n\n\t\t\t\tcurrentRenderList.push( object, null, object.material, groupOrder, _vector3.z, null );\n\n\t\t\t} else if ( object.isMesh || object.isLine || object.isPoints ) {\n\n\t\t\t\tif ( object.isSkinnedMesh ) {\n\n\t\t\t\t\t// update skeleton only once in a frame\n\n\t\t\t\t\tif ( object.skeleton.frame !== info.render.frame ) {\n\n\t\t\t\t\t\tobject.skeleton.update();\n\t\t\t\t\t\tobject.skeleton.frame = info.render.frame;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( ! object.frustumCulled || _frustum.intersectsObject( object ) ) {\n\n\t\t\t\t\tif ( sortObjects ) {\n\n\t\t\t\t\t\t_vector3.setFromMatrixPosition( object.matrixWorld )\n\t\t\t\t\t\t\t.applyMatrix4( _projScreenMatrix );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tvar geometry = objects.update( object );\n\t\t\t\t\tvar material = object.material;\n\n\t\t\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\t\t\tvar groups = geometry.groups;\n\n\t\t\t\t\t\tfor ( var i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\t\t\t\t\t\tvar group = groups[ i ];\n\t\t\t\t\t\t\tvar groupMaterial = material[ group.materialIndex ];\n\n\t\t\t\t\t\t\tif ( groupMaterial && groupMaterial.visible ) {\n\n\t\t\t\t\t\t\t\tcurrentRenderList.push( object, geometry, groupMaterial, groupOrder, _vector3.z, group );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else if ( material.visible ) {\n\n\t\t\t\t\t\tcurrentRenderList.push( object, geometry, material, groupOrder, _vector3.z, null );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tvar children = object.children;\n\n\t\tfor ( var i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tprojectObject( children[ i ], camera, groupOrder, sortObjects );\n\n\t\t}\n\n\t}\n\n\tfunction renderObjects( renderList, scene, camera, overrideMaterial ) {\n\n\t\tfor ( var i = 0, l = renderList.length; i < l; i ++ ) {\n\n\t\t\tvar renderItem = renderList[ i ];\n\n\t\t\tvar object = renderItem.object;\n\t\t\tvar geometry = renderItem.geometry;\n\t\t\tvar material = overrideMaterial === undefined ? renderItem.material : overrideMaterial;\n\t\t\tvar group = renderItem.group;\n\n\t\t\tif ( camera.isArrayCamera ) {\n\n\t\t\t\t_currentArrayCamera = camera;\n\n\t\t\t\tif ( xr.enabled && multiview.isAvailable() ) {\n\n\t\t\t\t\trenderObject( object, scene, camera, geometry, material, group );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tvar cameras = camera.cameras;\n\n\t\t\t\t\tfor ( var j = 0, jl = cameras.length; j < jl; j ++ ) {\n\n\t\t\t\t\t\tvar camera2 = cameras[ j ];\n\n\t\t\t\t\t\tif ( object.layers.test( camera2.layers ) ) {\n\n\t\t\t\t\t\t\tstate.viewport( _currentViewport.copy( camera2.viewport ) );\n\n\t\t\t\t\t\t\tcurrentRenderState.setupLights( camera2 );\n\n\t\t\t\t\t\t\trenderObject( object, scene, camera2, geometry, material, group );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t_currentArrayCamera = null;\n\n\t\t\t\trenderObject( object, scene, camera, geometry, material, group );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction renderObject( object, scene, camera, geometry, material, group ) {\n\n\t\tobject.onBeforeRender( _this, scene, camera, geometry, material, group );\n\t\tcurrentRenderState = renderStates.get( scene, _currentArrayCamera || camera );\n\n\t\tobject.modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld );\n\t\tobject.normalMatrix.getNormalMatrix( object.modelViewMatrix );\n\n\t\tif ( object.isImmediateRenderObject ) {\n\n\t\t\tvar program = setProgram( camera, scene, material, object );\n\n\t\t\tstate.setMaterial( material );\n\n\t\t\t_currentGeometryProgram.geometry = null;\n\t\t\t_currentGeometryProgram.program = null;\n\t\t\t_currentGeometryProgram.wireframe = false;\n\n\t\t\trenderObjectImmediate( object, program );\n\n\t\t} else {\n\n\t\t\t_this.renderBufferDirect( camera, scene, geometry, material, object, group );\n\n\t\t}\n\n\t\tobject.onAfterRender( _this, scene, camera, geometry, material, group );\n\t\tcurrentRenderState = renderStates.get( scene, _currentArrayCamera || camera );\n\n\t}\n\n\tfunction initMaterial( material, scene, object ) {\n\n\t\tvar materialProperties = properties.get( material );\n\n\t\tvar lights = currentRenderState.state.lights;\n\t\tvar shadowsArray = currentRenderState.state.shadowsArray;\n\n\t\tvar lightsStateVersion = lights.state.version;\n\n\t\tvar parameters = programCache.getParameters( material, lights.state, shadowsArray, scene, _clipping.numPlanes, _clipping.numIntersection, object );\n\t\tvar programCacheKey = programCache.getProgramCacheKey( parameters );\n\n\t\tvar program = materialProperties.program;\n\t\tvar programChange = true;\n\n\t\tif ( program === undefined ) {\n\n\t\t\t// new material\n\t\t\tmaterial.addEventListener( 'dispose', onMaterialDispose );\n\n\t\t} else if ( program.cacheKey !== programCacheKey ) {\n\n\t\t\t// changed glsl or parameters\n\t\t\treleaseMaterialProgramReference( material );\n\n\t\t} else if ( materialProperties.lightsStateVersion !== lightsStateVersion ) {\n\n\t\t\tmaterialProperties.lightsStateVersion = lightsStateVersion;\n\n\t\t\tprogramChange = false;\n\n\t\t} else if ( parameters.shaderID !== undefined ) {\n\n\t\t\t// same glsl and uniform list\n\t\t\treturn;\n\n\t\t} else {\n\n\t\t\t// only rebuild uniform list\n\t\t\tprogramChange = false;\n\n\t\t}\n\n\t\tif ( programChange ) {\n\n\t\t\tprogram = programCache.acquireProgram( parameters, programCacheKey );\n\n\t\t\tmaterialProperties.program = program;\n\t\t\tmaterialProperties.uniforms = parameters.uniforms;\n\t\t\tmaterialProperties.environment = material.isMeshStandardMaterial ? scene.environment : null;\n\t\t\tmaterialProperties.outputEncoding = _this.outputEncoding;\n\t\t\tmaterial.program = program;\n\n\t\t}\n\n\t\tvar programAttributes = program.getAttributes();\n\n\t\tif ( material.morphTargets ) {\n\n\t\t\tmaterial.numSupportedMorphTargets = 0;\n\n\t\t\tfor ( var i = 0; i < _this.maxMorphTargets; i ++ ) {\n\n\t\t\t\tif ( programAttributes[ 'morphTarget' + i ] >= 0 ) {\n\n\t\t\t\t\tmaterial.numSupportedMorphTargets ++;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.morphNormals ) {\n\n\t\t\tmaterial.numSupportedMorphNormals = 0;\n\n\t\t\tfor ( var i = 0; i < _this.maxMorphNormals; i ++ ) {\n\n\t\t\t\tif ( programAttributes[ 'morphNormal' + i ] >= 0 ) {\n\n\t\t\t\t\tmaterial.numSupportedMorphNormals ++;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tvar uniforms = materialProperties.uniforms;\n\n\t\tif ( ! material.isShaderMaterial &&\n\t\t\t! material.isRawShaderMaterial ||\n\t\t\tmaterial.clipping === true ) {\n\n\t\t\tmaterialProperties.numClippingPlanes = _clipping.numPlanes;\n\t\t\tmaterialProperties.numIntersection = _clipping.numIntersection;\n\t\t\tuniforms.clippingPlanes = _clipping.uniform;\n\n\t\t}\n\n\t\tmaterialProperties.fog = scene.fog;\n\n\t\t// store the light setup it was created for\n\n\t\tmaterialProperties.needsLights = materialNeedsLights( material );\n\t\tmaterialProperties.lightsStateVersion = lightsStateVersion;\n\n\t\tif ( materialProperties.needsLights ) {\n\n\t\t\t// wire up the material to this renderer's lighting state\n\n\t\t\tuniforms.ambientLightColor.value = lights.state.ambient;\n\t\t\tuniforms.lightProbe.value = lights.state.probe;\n\t\t\tuniforms.directionalLights.value = lights.state.directional;\n\t\t\tuniforms.spotLights.value = lights.state.spot;\n\t\t\tuniforms.rectAreaLights.value = lights.state.rectArea;\n\t\t\tuniforms.pointLights.value = lights.state.point;\n\t\t\tuniforms.hemisphereLights.value = lights.state.hemi;\n\n\t\t\tuniforms.directionalShadowMap.value = lights.state.directionalShadowMap;\n\t\t\tuniforms.directionalShadowMatrix.value = lights.state.directionalShadowMatrix;\n\t\t\tuniforms.spotShadowMap.value = lights.state.spotShadowMap;\n\t\t\tuniforms.spotShadowMatrix.value = lights.state.spotShadowMatrix;\n\t\t\tuniforms.pointShadowMap.value = lights.state.pointShadowMap;\n\t\t\tuniforms.pointShadowMatrix.value = lights.state.pointShadowMatrix;\n\t\t\t// TODO (abelnation): add area lights shadow info to uniforms\n\n\t\t}\n\n\t\tvar progUniforms = materialProperties.program.getUniforms(),\n\t\t\tuniformsList =\n\t\t\t\tWebGLUniforms.seqWithValue( progUniforms.seq, uniforms );\n\n\t\tmaterialProperties.uniformsList = uniformsList;\n\n\t}\n\n\tfunction setProgram( camera, scene, material, object ) {\n\n\t\ttextures.resetTextureUnits();\n\n\t\tvar fog = scene.fog;\n\t\tvar environment = material.isMeshStandardMaterial ? scene.environment : null;\n\n\t\tvar materialProperties = properties.get( material );\n\t\tvar lights = currentRenderState.state.lights;\n\n\t\tif ( _clippingEnabled ) {\n\n\t\t\tif ( _localClippingEnabled || camera !== _currentCamera ) {\n\n\t\t\t\tvar useCache =\n\t\t\t\t\tcamera === _currentCamera &&\n\t\t\t\t\tmaterial.id === _currentMaterialId;\n\n\t\t\t\t// we might want to call this function with some ClippingGroup\n\t\t\t\t// object instead of the material, once it becomes feasible\n\t\t\t\t// (#8465, #8379)\n\t\t\t\t_clipping.setState(\n\t\t\t\t\tmaterial.clippingPlanes, material.clipIntersection, material.clipShadows,\n\t\t\t\t\tcamera, materialProperties, useCache );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.version === materialProperties.__version ) {\n\n\t\t\tif ( materialProperties.program === undefined ) {\n\n\t\t\t\tinitMaterial( material, scene, object );\n\n\t\t\t} else if ( material.fog && materialProperties.fog !== fog ) {\n\n\t\t\t\tinitMaterial( material, scene, object );\n\n\t\t\t} else if ( materialProperties.environment !== environment ) {\n\n\t\t\t\tinitMaterial( material, scene, object );\n\n\t\t\t} else if ( materialProperties.needsLights && ( materialProperties.lightsStateVersion !== lights.state.version ) ) {\n\n\t\t\t\tinitMaterial( material, scene, object );\n\n\t\t\t} else if ( materialProperties.numClippingPlanes !== undefined &&\n\t\t\t\t( materialProperties.numClippingPlanes !== _clipping.numPlanes ||\n\t\t\t\tmaterialProperties.numIntersection !== _clipping.numIntersection ) ) {\n\n\t\t\t\tinitMaterial( material, scene, object );\n\n\t\t\t} else if ( materialProperties.outputEncoding !== _this.outputEncoding ) {\n\n\t\t\t\tinitMaterial( material, scene, object );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tinitMaterial( material, scene, object );\n\t\t\tmaterialProperties.__version = material.version;\n\n\t\t}\n\n\t\tvar refreshProgram = false;\n\t\tvar refreshMaterial = false;\n\t\tvar refreshLights = false;\n\n\t\tvar program = materialProperties.program,\n\t\t\tp_uniforms = program.getUniforms(),\n\t\t\tm_uniforms = materialProperties.uniforms;\n\n\t\tif ( state.useProgram( program.program ) ) {\n\n\t\t\trefreshProgram = true;\n\t\t\trefreshMaterial = true;\n\t\t\trefreshLights = true;\n\n\t\t}\n\n\t\tif ( material.id !== _currentMaterialId ) {\n\n\t\t\t_currentMaterialId = material.id;\n\n\t\t\trefreshMaterial = true;\n\n\t\t}\n\n\t\tif ( refreshProgram || _currentCamera !== camera ) {\n\n\t\t\tif ( program.numMultiviewViews > 0 ) {\n\n\t\t\t\tmultiview.updateCameraProjectionMatricesUniform( camera, p_uniforms );\n\n\t\t\t} else {\n\n\t\t\t\tp_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );\n\n\t\t\t}\n\n\t\t\tif ( capabilities.logarithmicDepthBuffer ) {\n\n\t\t\t\tp_uniforms.setValue( _gl, 'logDepthBufFC',\n\t\t\t\t\t2.0 / ( Math.log( camera.far + 1.0 ) / Math.LN2 ) );\n\n\t\t\t}\n\n\t\t\tif ( _currentCamera !== camera ) {\n\n\t\t\t\t_currentCamera = camera;\n\n\t\t\t\t// lighting uniforms depend on the camera so enforce an update\n\t\t\t\t// now, in case this material supports lights - or later, when\n\t\t\t\t// the next material that does gets activated:\n\n\t\t\t\trefreshMaterial = true;\t\t// set to true on material change\n\t\t\t\trefreshLights = true;\t\t// remains set until update done\n\n\t\t\t}\n\n\t\t\t// load material specific uniforms\n\t\t\t// (shader material also gets them for the sake of genericity)\n\n\t\t\tif ( material.isShaderMaterial ||\n\t\t\t\tmaterial.isMeshPhongMaterial ||\n\t\t\t\tmaterial.isMeshToonMaterial ||\n\t\t\t\tmaterial.isMeshStandardMaterial ||\n\t\t\t\tmaterial.envMap ) {\n\n\t\t\t\tvar uCamPos = p_uniforms.map.cameraPosition;\n\n\t\t\t\tif ( uCamPos !== undefined ) {\n\n\t\t\t\t\tuCamPos.setValue( _gl,\n\t\t\t\t\t\t_vector3.setFromMatrixPosition( camera.matrixWorld ) );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( material.isMeshPhongMaterial ||\n\t\t\t\tmaterial.isMeshToonMaterial ||\n\t\t\t\tmaterial.isMeshLambertMaterial ||\n\t\t\t\tmaterial.isMeshBasicMaterial ||\n\t\t\t\tmaterial.isMeshStandardMaterial ||\n\t\t\t\tmaterial.isShaderMaterial ) {\n\n\t\t\t\tp_uniforms.setValue( _gl, 'isOrthographic', camera.isOrthographicCamera === true );\n\n\t\t\t}\n\n\t\t\tif ( material.isMeshPhongMaterial ||\n\t\t\t\tmaterial.isMeshToonMaterial ||\n\t\t\t\tmaterial.isMeshLambertMaterial ||\n\t\t\t\tmaterial.isMeshBasicMaterial ||\n\t\t\t\tmaterial.isMeshStandardMaterial ||\n\t\t\t\tmaterial.isShaderMaterial ||\n\t\t\t\tmaterial.skinning ) {\n\n\t\t\t\tif ( program.numMultiviewViews > 0 ) {\n\n\t\t\t\t\tmultiview.updateCameraViewMatricesUniform( camera, p_uniforms );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tp_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// skinning uniforms must be set even if material didn't change\n\t\t// auto-setting of texture unit for bone texture must go before other textures\n\t\t// not sure why, but otherwise weird things happen\n\n\t\tif ( material.skinning ) {\n\n\t\t\tp_uniforms.setOptional( _gl, object, 'bindMatrix' );\n\t\t\tp_uniforms.setOptional( _gl, object, 'bindMatrixInverse' );\n\n\t\t\tvar skeleton = object.skeleton;\n\n\t\t\tif ( skeleton ) {\n\n\t\t\t\tvar bones = skeleton.bones;\n\n\t\t\t\tif ( capabilities.floatVertexTextures ) {\n\n\t\t\t\t\tif ( skeleton.boneTexture === undefined ) {\n\n\t\t\t\t\t\t// layout (1 matrix = 4 pixels)\n\t\t\t\t\t\t// RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4)\n\t\t\t\t\t\t// with 8x8 pixel texture max 16 bones * 4 pixels = (8 * 8)\n\t\t\t\t\t\t// 16x16 pixel texture max 64 bones * 4 pixels = (16 * 16)\n\t\t\t\t\t\t// 32x32 pixel texture max 256 bones * 4 pixels = (32 * 32)\n\t\t\t\t\t\t// 64x64 pixel texture max 1024 bones * 4 pixels = (64 * 64)\n\n\n\t\t\t\t\t\tvar size = Math.sqrt( bones.length * 4 ); // 4 pixels needed for 1 matrix\n\t\t\t\t\t\tsize = MathUtils.ceilPowerOfTwo( size );\n\t\t\t\t\t\tsize = Math.max( size, 4 );\n\n\t\t\t\t\t\tvar boneMatrices = new Float32Array( size * size * 4 ); // 4 floats per RGBA pixel\n\t\t\t\t\t\tboneMatrices.set( skeleton.boneMatrices ); // copy current values\n\n\t\t\t\t\t\tvar boneTexture = new DataTexture( boneMatrices, size, size, RGBAFormat, FloatType );\n\n\t\t\t\t\t\tskeleton.boneMatrices = boneMatrices;\n\t\t\t\t\t\tskeleton.boneTexture = boneTexture;\n\t\t\t\t\t\tskeleton.boneTextureSize = size;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tp_uniforms.setValue( _gl, 'boneTexture', skeleton.boneTexture, textures );\n\t\t\t\t\tp_uniforms.setValue( _gl, 'boneTextureSize', skeleton.boneTextureSize );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tp_uniforms.setOptional( _gl, skeleton, 'boneMatrices' );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( refreshMaterial || materialProperties.receiveShadow !== object.receiveShadow ) {\n\n\t\t\tmaterialProperties.receiveShadow = object.receiveShadow;\n\t\t\tp_uniforms.setValue( _gl, 'receiveShadow', object.receiveShadow );\n\n\t\t}\n\n\t\tif ( refreshMaterial ) {\n\n\t\t\tp_uniforms.setValue( _gl, 'toneMappingExposure', _this.toneMappingExposure );\n\t\t\tp_uniforms.setValue( _gl, 'toneMappingWhitePoint', _this.toneMappingWhitePoint );\n\n\t\t\tif ( materialProperties.needsLights ) {\n\n\t\t\t\t// the current material requires lighting info\n\n\t\t\t\t// note: all lighting uniforms are always set correctly\n\t\t\t\t// they simply reference the renderer's state for their\n\t\t\t\t// values\n\t\t\t\t//\n\t\t\t\t// use the current material's .needsUpdate flags to set\n\t\t\t\t// the GL state when required\n\n\t\t\t\tmarkUniformsLightsNeedsUpdate( m_uniforms, refreshLights );\n\n\t\t\t}\n\n\t\t\t// refresh uniforms common to several materials\n\n\t\t\tif ( fog && material.fog ) {\n\n\t\t\t\trefreshUniformsFog( m_uniforms, fog );\n\n\t\t\t}\n\n\t\t\tif ( material.isMeshBasicMaterial ) {\n\n\t\t\t\trefreshUniformsCommon( m_uniforms, material );\n\n\t\t\t} else if ( material.isMeshLambertMaterial ) {\n\n\t\t\t\trefreshUniformsCommon( m_uniforms, material );\n\t\t\t\trefreshUniformsLambert( m_uniforms, material );\n\n\t\t\t} else if ( material.isMeshToonMaterial ) {\n\n\t\t\t\trefreshUniformsCommon( m_uniforms, material );\n\t\t\t\trefreshUniformsToon( m_uniforms, material );\n\n\t\t\t} else if ( material.isMeshPhongMaterial ) {\n\n\t\t\t\trefreshUniformsCommon( m_uniforms, material );\n\t\t\t\trefreshUniformsPhong( m_uniforms, material );\n\n\t\t\t} else if ( material.isMeshStandardMaterial ) {\n\n\t\t\t\trefreshUniformsCommon( m_uniforms, material, environment );\n\n\t\t\t\tif ( material.isMeshPhysicalMaterial ) {\n\n\t\t\t\t\trefreshUniformsPhysical( m_uniforms, material, environment );\n\n\t\t\t\t} else {\n\n\t\t\t\t\trefreshUniformsStandard( m_uniforms, material, environment );\n\n\t\t\t\t}\n\n\t\t\t} else if ( material.isMeshMatcapMaterial ) {\n\n\t\t\t\trefreshUniformsCommon( m_uniforms, material );\n\t\t\t\trefreshUniformsMatcap( m_uniforms, material );\n\n\t\t\t} else if ( material.isMeshDepthMaterial ) {\n\n\t\t\t\trefreshUniformsCommon( m_uniforms, material );\n\t\t\t\trefreshUniformsDepth( m_uniforms, material );\n\n\t\t\t} else if ( material.isMeshDistanceMaterial ) {\n\n\t\t\t\trefreshUniformsCommon( m_uniforms, material );\n\t\t\t\trefreshUniformsDistance( m_uniforms, material );\n\n\t\t\t} else if ( material.isMeshNormalMaterial ) {\n\n\t\t\t\trefreshUniformsCommon( m_uniforms, material );\n\t\t\t\trefreshUniformsNormal( m_uniforms, material );\n\n\t\t\t} else if ( material.isLineBasicMaterial ) {\n\n\t\t\t\trefreshUniformsLine( m_uniforms, material );\n\n\t\t\t\tif ( material.isLineDashedMaterial ) {\n\n\t\t\t\t\trefreshUniformsDash( m_uniforms, material );\n\n\t\t\t\t}\n\n\t\t\t} else if ( material.isPointsMaterial ) {\n\n\t\t\t\trefreshUniformsPoints( m_uniforms, material );\n\n\t\t\t} else if ( material.isSpriteMaterial ) {\n\n\t\t\t\trefreshUniformsSprites( m_uniforms, material );\n\n\t\t\t} else if ( material.isShadowMaterial ) {\n\n\t\t\t\tm_uniforms.color.value.copy( material.color );\n\t\t\t\tm_uniforms.opacity.value = material.opacity;\n\n\t\t\t}\n\n\t\t\t// RectAreaLight Texture\n\t\t\t// TODO (mrdoob): Find a nicer implementation\n\n\t\t\tif ( m_uniforms.ltc_1 !== undefined ) m_uniforms.ltc_1.value = UniformsLib.LTC_1;\n\t\t\tif ( m_uniforms.ltc_2 !== undefined ) m_uniforms.ltc_2.value = UniformsLib.LTC_2;\n\n\t\t\tWebGLUniforms.upload( _gl, materialProperties.uniformsList, m_uniforms, textures );\n\n\t\t\tif ( material.isShaderMaterial ) {\n\n\t\t\t\tmaterial.uniformsNeedUpdate = false; // #15581\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.isShaderMaterial && material.uniformsNeedUpdate === true ) {\n\n\t\t\tWebGLUniforms.upload( _gl, materialProperties.uniformsList, m_uniforms, textures );\n\t\t\tmaterial.uniformsNeedUpdate = false;\n\n\t\t}\n\n\t\tif ( material.isSpriteMaterial ) {\n\n\t\t\tp_uniforms.setValue( _gl, 'center', object.center );\n\n\t\t}\n\n\t\t// common matrices\n\n\t\tif ( program.numMultiviewViews > 0 ) {\n\n\t\t\tmultiview.updateObjectMatricesUniforms( object, camera, p_uniforms );\n\n\t\t} else {\n\n\t\t\tp_uniforms.setValue( _gl, 'modelViewMatrix', object.modelViewMatrix );\n\t\t\tp_uniforms.setValue( _gl, 'normalMatrix', object.normalMatrix );\n\n\t\t}\n\n\t\tp_uniforms.setValue( _gl, 'modelMatrix', object.matrixWorld );\n\n\t\treturn program;\n\n\t}\n\n\t// Uniforms (refresh uniforms objects)\n\n\tfunction refreshUniformsCommon( uniforms, material, environment ) {\n\n\t\tuniforms.opacity.value = material.opacity;\n\n\t\tif ( material.color ) {\n\n\t\t\tuniforms.diffuse.value.copy( material.color );\n\n\t\t}\n\n\t\tif ( material.emissive ) {\n\n\t\t\tuniforms.emissive.value.copy( material.emissive ).multiplyScalar( material.emissiveIntensity );\n\n\t\t}\n\n\t\tif ( material.map ) {\n\n\t\t\tuniforms.map.value = material.map;\n\n\t\t}\n\n\t\tif ( material.alphaMap ) {\n\n\t\t\tuniforms.alphaMap.value = material.alphaMap;\n\n\t\t}\n\n\t\tif ( material.specularMap ) {\n\n\t\t\tuniforms.specularMap.value = material.specularMap;\n\n\t\t}\n\n\t\tvar envMap = material.envMap || environment;\n\n\t\tif ( envMap ) {\n\n\t\t\tuniforms.envMap.value = envMap;\n\n\t\t\tuniforms.flipEnvMap.value = envMap.isCubeTexture ? - 1 : 1;\n\n\t\t\tuniforms.reflectivity.value = material.reflectivity;\n\t\t\tuniforms.refractionRatio.value = material.refractionRatio;\n\n\t\t\tuniforms.maxMipLevel.value = properties.get( envMap ).__maxMipLevel;\n\n\t\t}\n\n\t\tif ( material.lightMap ) {\n\n\t\t\tuniforms.lightMap.value = material.lightMap;\n\t\t\tuniforms.lightMapIntensity.value = material.lightMapIntensity;\n\n\t\t}\n\n\t\tif ( material.aoMap ) {\n\n\t\t\tuniforms.aoMap.value = material.aoMap;\n\t\t\tuniforms.aoMapIntensity.value = material.aoMapIntensity;\n\n\t\t}\n\n\t\t// uv repeat and offset setting priorities\n\t\t// 1. color map\n\t\t// 2. specular map\n\t\t// 3. normal map\n\t\t// 4. bump map\n\t\t// 5. alpha map\n\t\t// 6. emissive map\n\n\t\tvar uvScaleMap;\n\n\t\tif ( material.map ) {\n\n\t\t\tuvScaleMap = material.map;\n\n\t\t} else if ( material.specularMap ) {\n\n\t\t\tuvScaleMap = material.specularMap;\n\n\t\t} else if ( material.displacementMap ) {\n\n\t\t\tuvScaleMap = material.displacementMap;\n\n\t\t} else if ( material.normalMap ) {\n\n\t\t\tuvScaleMap = material.normalMap;\n\n\t\t} else if ( material.bumpMap ) {\n\n\t\t\tuvScaleMap = material.bumpMap;\n\n\t\t} else if ( material.roughnessMap ) {\n\n\t\t\tuvScaleMap = material.roughnessMap;\n\n\t\t} else if ( material.metalnessMap ) {\n\n\t\t\tuvScaleMap = material.metalnessMap;\n\n\t\t} else if ( material.alphaMap ) {\n\n\t\t\tuvScaleMap = material.alphaMap;\n\n\t\t} else if ( material.emissiveMap ) {\n\n\t\t\tuvScaleMap = material.emissiveMap;\n\n\t\t}\n\n\t\tif ( uvScaleMap !== undefined ) {\n\n\t\t\t// backwards compatibility\n\t\t\tif ( uvScaleMap.isWebGLRenderTarget ) {\n\n\t\t\t\tuvScaleMap = uvScaleMap.texture;\n\n\t\t\t}\n\n\t\t\tif ( uvScaleMap.matrixAutoUpdate === true ) {\n\n\t\t\t\tuvScaleMap.updateMatrix();\n\n\t\t\t}\n\n\t\t\tuniforms.uvTransform.value.copy( uvScaleMap.matrix );\n\n\t\t}\n\n\t\t// uv repeat and offset setting priorities for uv2\n\t\t// 1. ao map\n\t\t// 2. light map\n\n\t\tvar uv2ScaleMap;\n\n\t\tif ( material.aoMap ) {\n\n\t\t\tuv2ScaleMap = material.aoMap;\n\n\t\t} else if ( material.lightMap ) {\n\n\t\t\tuv2ScaleMap = material.lightMap;\n\n\t\t}\n\n\t\tif ( uv2ScaleMap !== undefined ) {\n\n\t\t\t// backwards compatibility\n\t\t\tif ( uv2ScaleMap.isWebGLRenderTarget ) {\n\n\t\t\t\tuv2ScaleMap = uv2ScaleMap.texture;\n\n\t\t\t}\n\n\t\t\tif ( uv2ScaleMap.matrixAutoUpdate === true ) {\n\n\t\t\t\tuv2ScaleMap.updateMatrix();\n\n\t\t\t}\n\n\t\t\tuniforms.uv2Transform.value.copy( uv2ScaleMap.matrix );\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsLine( uniforms, material ) {\n\n\t\tuniforms.diffuse.value.copy( material.color );\n\t\tuniforms.opacity.value = material.opacity;\n\n\t}\n\n\tfunction refreshUniformsDash( uniforms, material ) {\n\n\t\tuniforms.dashSize.value = material.dashSize;\n\t\tuniforms.totalSize.value = material.dashSize + material.gapSize;\n\t\tuniforms.scale.value = material.scale;\n\n\t}\n\n\tfunction refreshUniformsPoints( uniforms, material ) {\n\n\t\tuniforms.diffuse.value.copy( material.color );\n\t\tuniforms.opacity.value = material.opacity;\n\t\tuniforms.size.value = material.size * _pixelRatio;\n\t\tuniforms.scale.value = _height * 0.5;\n\n\t\tif ( material.map ) {\n\n\t\t\tuniforms.map.value = material.map;\n\n\t\t}\n\n\t\tif ( material.alphaMap ) {\n\n\t\t\tuniforms.alphaMap.value = material.alphaMap;\n\n\t\t}\n\n\t\t// uv repeat and offset setting priorities\n\t\t// 1. color map\n\t\t// 2. alpha map\n\n\t\tvar uvScaleMap;\n\n\t\tif ( material.map ) {\n\n\t\t\tuvScaleMap = material.map;\n\n\t\t} else if ( material.alphaMap ) {\n\n\t\t\tuvScaleMap = material.alphaMap;\n\n\t\t}\n\n\t\tif ( uvScaleMap !== undefined ) {\n\n\t\t\tif ( uvScaleMap.matrixAutoUpdate === true ) {\n\n\t\t\t\tuvScaleMap.updateMatrix();\n\n\t\t\t}\n\n\t\t\tuniforms.uvTransform.value.copy( uvScaleMap.matrix );\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsSprites( uniforms, material ) {\n\n\t\tuniforms.diffuse.value.copy( material.color );\n\t\tuniforms.opacity.value = material.opacity;\n\t\tuniforms.rotation.value = material.rotation;\n\n\t\tif ( material.map ) {\n\n\t\t\tuniforms.map.value = material.map;\n\n\t\t}\n\n\t\tif ( material.alphaMap ) {\n\n\t\t\tuniforms.alphaMap.value = material.alphaMap;\n\n\t\t}\n\n\t\t// uv repeat and offset setting priorities\n\t\t// 1. color map\n\t\t// 2. alpha map\n\n\t\tvar uvScaleMap;\n\n\t\tif ( material.map ) {\n\n\t\t\tuvScaleMap = material.map;\n\n\t\t} else if ( material.alphaMap ) {\n\n\t\t\tuvScaleMap = material.alphaMap;\n\n\t\t}\n\n\t\tif ( uvScaleMap !== undefined ) {\n\n\t\t\tif ( uvScaleMap.matrixAutoUpdate === true ) {\n\n\t\t\t\tuvScaleMap.updateMatrix();\n\n\t\t\t}\n\n\t\t\tuniforms.uvTransform.value.copy( uvScaleMap.matrix );\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsFog( uniforms, fog ) {\n\n\t\tuniforms.fogColor.value.copy( fog.color );\n\n\t\tif ( fog.isFog ) {\n\n\t\t\tuniforms.fogNear.value = fog.near;\n\t\t\tuniforms.fogFar.value = fog.far;\n\n\t\t} else if ( fog.isFogExp2 ) {\n\n\t\t\tuniforms.fogDensity.value = fog.density;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsLambert( uniforms, material ) {\n\n\t\tif ( material.emissiveMap ) {\n\n\t\t\tuniforms.emissiveMap.value = material.emissiveMap;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsPhong( uniforms, material ) {\n\n\t\tuniforms.specular.value.copy( material.specular );\n\t\tuniforms.shininess.value = Math.max( material.shininess, 1e-4 ); // to prevent pow( 0.0, 0.0 )\n\n\t\tif ( material.emissiveMap ) {\n\n\t\t\tuniforms.emissiveMap.value = material.emissiveMap;\n\n\t\t}\n\n\t\tif ( material.bumpMap ) {\n\n\t\t\tuniforms.bumpMap.value = material.bumpMap;\n\t\t\tuniforms.bumpScale.value = material.bumpScale;\n\t\t\tif ( material.side === BackSide ) uniforms.bumpScale.value *= - 1;\n\n\t\t}\n\n\t\tif ( material.normalMap ) {\n\n\t\t\tuniforms.normalMap.value = material.normalMap;\n\t\t\tuniforms.normalScale.value.copy( material.normalScale );\n\t\t\tif ( material.side === BackSide ) uniforms.normalScale.value.negate();\n\n\t\t}\n\n\t\tif ( material.displacementMap ) {\n\n\t\t\tuniforms.displacementMap.value = material.displacementMap;\n\t\t\tuniforms.displacementScale.value = material.displacementScale;\n\t\t\tuniforms.displacementBias.value = material.displacementBias;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsToon( uniforms, material ) {\n\n\t\tuniforms.specular.value.copy( material.specular );\n\t\tuniforms.shininess.value = Math.max( material.shininess, 1e-4 ); // to prevent pow( 0.0, 0.0 )\n\n\t\tif ( material.gradientMap ) {\n\n\t\t\tuniforms.gradientMap.value = material.gradientMap;\n\n\t\t}\n\n\t\tif ( material.emissiveMap ) {\n\n\t\t\tuniforms.emissiveMap.value = material.emissiveMap;\n\n\t\t}\n\n\t\tif ( material.bumpMap ) {\n\n\t\t\tuniforms.bumpMap.value = material.bumpMap;\n\t\t\tuniforms.bumpScale.value = material.bumpScale;\n\t\t\tif ( material.side === BackSide ) uniforms.bumpScale.value *= - 1;\n\n\t\t}\n\n\t\tif ( material.normalMap ) {\n\n\t\t\tuniforms.normalMap.value = material.normalMap;\n\t\t\tuniforms.normalScale.value.copy( material.normalScale );\n\t\t\tif ( material.side === BackSide ) uniforms.normalScale.value.negate();\n\n\t\t}\n\n\t\tif ( material.displacementMap ) {\n\n\t\t\tuniforms.displacementMap.value = material.displacementMap;\n\t\t\tuniforms.displacementScale.value = material.displacementScale;\n\t\t\tuniforms.displacementBias.value = material.displacementBias;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsStandard( uniforms, material, environment ) {\n\n\t\tuniforms.roughness.value = material.roughness;\n\t\tuniforms.metalness.value = material.metalness;\n\n\t\tif ( material.roughnessMap ) {\n\n\t\t\tuniforms.roughnessMap.value = material.roughnessMap;\n\n\t\t}\n\n\t\tif ( material.metalnessMap ) {\n\n\t\t\tuniforms.metalnessMap.value = material.metalnessMap;\n\n\t\t}\n\n\t\tif ( material.emissiveMap ) {\n\n\t\t\tuniforms.emissiveMap.value = material.emissiveMap;\n\n\t\t}\n\n\t\tif ( material.bumpMap ) {\n\n\t\t\tuniforms.bumpMap.value = material.bumpMap;\n\t\t\tuniforms.bumpScale.value = material.bumpScale;\n\t\t\tif ( material.side === BackSide ) uniforms.bumpScale.value *= - 1;\n\n\t\t}\n\n\t\tif ( material.normalMap ) {\n\n\t\t\tuniforms.normalMap.value = material.normalMap;\n\t\t\tuniforms.normalScale.value.copy( material.normalScale );\n\t\t\tif ( material.side === BackSide ) uniforms.normalScale.value.negate();\n\n\t\t}\n\n\t\tif ( material.displacementMap ) {\n\n\t\t\tuniforms.displacementMap.value = material.displacementMap;\n\t\t\tuniforms.displacementScale.value = material.displacementScale;\n\t\t\tuniforms.displacementBias.value = material.displacementBias;\n\n\t\t}\n\n\t\tif ( material.envMap || environment ) {\n\n\t\t\t//uniforms.envMap.value = material.envMap; // part of uniforms common\n\t\t\tuniforms.envMapIntensity.value = material.envMapIntensity;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsPhysical( uniforms, material, environment ) {\n\n\t\trefreshUniformsStandard( uniforms, material, environment );\n\n\t\tuniforms.reflectivity.value = material.reflectivity; // also part of uniforms common\n\n\t\tuniforms.clearcoat.value = material.clearcoat;\n\t\tuniforms.clearcoatRoughness.value = material.clearcoatRoughness;\n\t\tif ( material.sheen ) uniforms.sheen.value.copy( material.sheen );\n\n\t\tif ( material.clearcoatNormalMap ) {\n\n\t\t\tuniforms.clearcoatNormalScale.value.copy( material.clearcoatNormalScale );\n\t\t\tuniforms.clearcoatNormalMap.value = material.clearcoatNormalMap;\n\n\t\t\tif ( material.side === BackSide ) {\n\n\t\t\t\tuniforms.clearcoatNormalScale.value.negate();\n\n\t\t\t}\n\n\t\t}\n\n\t\tuniforms.transparency.value = material.transparency;\n\n\t}\n\n\tfunction refreshUniformsMatcap( uniforms, material ) {\n\n\t\tif ( material.matcap ) {\n\n\t\t\tuniforms.matcap.value = material.matcap;\n\n\t\t}\n\n\t\tif ( material.bumpMap ) {\n\n\t\t\tuniforms.bumpMap.value = material.bumpMap;\n\t\t\tuniforms.bumpScale.value = material.bumpScale;\n\t\t\tif ( material.side === BackSide ) uniforms.bumpScale.value *= - 1;\n\n\t\t}\n\n\t\tif ( material.normalMap ) {\n\n\t\t\tuniforms.normalMap.value = material.normalMap;\n\t\t\tuniforms.normalScale.value.copy( material.normalScale );\n\t\t\tif ( material.side === BackSide ) uniforms.normalScale.value.negate();\n\n\t\t}\n\n\t\tif ( material.displacementMap ) {\n\n\t\t\tuniforms.displacementMap.value = material.displacementMap;\n\t\t\tuniforms.displacementScale.value = material.displacementScale;\n\t\t\tuniforms.displacementBias.value = material.displacementBias;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsDepth( uniforms, material ) {\n\n\t\tif ( material.displacementMap ) {\n\n\t\t\tuniforms.displacementMap.value = material.displacementMap;\n\t\t\tuniforms.displacementScale.value = material.displacementScale;\n\t\t\tuniforms.displacementBias.value = material.displacementBias;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsDistance( uniforms, material ) {\n\n\t\tif ( material.displacementMap ) {\n\n\t\t\tuniforms.displacementMap.value = material.displacementMap;\n\t\t\tuniforms.displacementScale.value = material.displacementScale;\n\t\t\tuniforms.displacementBias.value = material.displacementBias;\n\n\t\t}\n\n\t\tuniforms.referencePosition.value.copy( material.referencePosition );\n\t\tuniforms.nearDistance.value = material.nearDistance;\n\t\tuniforms.farDistance.value = material.farDistance;\n\n\t}\n\n\tfunction refreshUniformsNormal( uniforms, material ) {\n\n\t\tif ( material.bumpMap ) {\n\n\t\t\tuniforms.bumpMap.value = material.bumpMap;\n\t\t\tuniforms.bumpScale.value = material.bumpScale;\n\t\t\tif ( material.side === BackSide ) uniforms.bumpScale.value *= - 1;\n\n\t\t}\n\n\t\tif ( material.normalMap ) {\n\n\t\t\tuniforms.normalMap.value = material.normalMap;\n\t\t\tuniforms.normalScale.value.copy( material.normalScale );\n\t\t\tif ( material.side === BackSide ) uniforms.normalScale.value.negate();\n\n\t\t}\n\n\t\tif ( material.displacementMap ) {\n\n\t\t\tuniforms.displacementMap.value = material.displacementMap;\n\t\t\tuniforms.displacementScale.value = material.displacementScale;\n\t\t\tuniforms.displacementBias.value = material.displacementBias;\n\n\t\t}\n\n\t}\n\n\t// If uniforms are marked as clean, they don't need to be loaded to the GPU.\n\n\tfunction markUniformsLightsNeedsUpdate( uniforms, value ) {\n\n\t\tuniforms.ambientLightColor.needsUpdate = value;\n\t\tuniforms.lightProbe.needsUpdate = value;\n\n\t\tuniforms.directionalLights.needsUpdate = value;\n\t\tuniforms.pointLights.needsUpdate = value;\n\t\tuniforms.spotLights.needsUpdate = value;\n\t\tuniforms.rectAreaLights.needsUpdate = value;\n\t\tuniforms.hemisphereLights.needsUpdate = value;\n\n\t}\n\n\tfunction materialNeedsLights( material ) {\n\n\t\treturn material.isMeshLambertMaterial || material.isMeshToonMaterial || material.isMeshPhongMaterial ||\n\t\t\tmaterial.isMeshStandardMaterial || material.isShadowMaterial ||\n\t\t\t( material.isShaderMaterial && material.lights === true );\n\n\t}\n\n\t//\n\tthis.setFramebuffer = function ( value ) {\n\n\t\tif ( _framebuffer !== value && _currentRenderTarget === null ) _gl.bindFramebuffer( 36160, value );\n\n\t\t_framebuffer = value;\n\n\t};\n\n\tthis.getActiveCubeFace = function () {\n\n\t\treturn _currentActiveCubeFace;\n\n\t};\n\n\tthis.getActiveMipmapLevel = function () {\n\n\t\treturn _currentActiveMipmapLevel;\n\n\t};\n\n\tthis.getRenderTarget = function () {\n\n\t\treturn _currentRenderTarget;\n\n\t};\n\n\tthis.setRenderTarget = function ( renderTarget, activeCubeFace, activeMipmapLevel ) {\n\n\t\t_currentRenderTarget = renderTarget;\n\t\t_currentActiveCubeFace = activeCubeFace;\n\t\t_currentActiveMipmapLevel = activeMipmapLevel;\n\n\t\tif ( renderTarget && properties.get( renderTarget ).__webglFramebuffer === undefined ) {\n\n\t\t\ttextures.setupRenderTarget( renderTarget );\n\n\t\t}\n\n\t\tvar framebuffer = _framebuffer;\n\t\tvar isCube = false;\n\n\t\tif ( renderTarget ) {\n\n\t\t\tvar __webglFramebuffer = properties.get( renderTarget ).__webglFramebuffer;\n\n\t\t\tif ( renderTarget.isWebGLCubeRenderTarget ) {\n\n\t\t\t\tframebuffer = __webglFramebuffer[ activeCubeFace || 0 ];\n\t\t\t\tisCube = true;\n\n\t\t\t} else if ( renderTarget.isWebGLMultisampleRenderTarget ) {\n\n\t\t\t\tframebuffer = properties.get( renderTarget ).__webglMultisampledFramebuffer;\n\n\t\t\t} else {\n\n\t\t\t\tframebuffer = __webglFramebuffer;\n\n\t\t\t}\n\n\t\t\t_currentViewport.copy( renderTarget.viewport );\n\t\t\t_currentScissor.copy( renderTarget.scissor );\n\t\t\t_currentScissorTest = renderTarget.scissorTest;\n\n\t\t} else {\n\n\t\t\t_currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ).floor();\n\t\t\t_currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ).floor();\n\t\t\t_currentScissorTest = _scissorTest;\n\n\t\t}\n\n\t\tif ( _currentFramebuffer !== framebuffer ) {\n\n\t\t\t_gl.bindFramebuffer( 36160, framebuffer );\n\t\t\t_currentFramebuffer = framebuffer;\n\n\t\t}\n\n\t\tstate.viewport( _currentViewport );\n\t\tstate.scissor( _currentScissor );\n\t\tstate.setScissorTest( _currentScissorTest );\n\n\t\tif ( isCube ) {\n\n\t\t\tvar textureProperties = properties.get( renderTarget.texture );\n\t\t\t_gl.framebufferTexture2D( 36160, 36064, 34069 + ( activeCubeFace || 0 ), textureProperties.__webglTexture, activeMipmapLevel || 0 );\n\n\t\t}\n\n\t};\n\n\tthis.readRenderTargetPixels = function ( renderTarget, x, y, width, height, buffer, activeCubeFaceIndex ) {\n\n\t\tif ( ! ( renderTarget && renderTarget.isWebGLRenderTarget ) ) {\n\n\t\t\tconsole.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tvar framebuffer = properties.get( renderTarget ).__webglFramebuffer;\n\n\t\tif ( renderTarget.isWebGLCubeRenderTarget && activeCubeFaceIndex !== undefined ) {\n\n\t\t\tframebuffer = framebuffer[ activeCubeFaceIndex ];\n\n\t\t}\n\n\t\tif ( framebuffer ) {\n\n\t\t\tvar restore = false;\n\n\t\t\tif ( framebuffer !== _currentFramebuffer ) {\n\n\t\t\t\t_gl.bindFramebuffer( 36160, framebuffer );\n\n\t\t\t\trestore = true;\n\n\t\t\t}\n\n\t\t\ttry {\n\n\t\t\t\tvar texture = renderTarget.texture;\n\t\t\t\tvar textureFormat = texture.format;\n\t\t\t\tvar textureType = texture.type;\n\n\t\t\t\tif ( textureFormat !== RGBAFormat && utils.convert( textureFormat ) !== _gl.getParameter( 35739 ) ) {\n\n\t\t\t\t\tconsole.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.' );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t\tif ( textureType !== UnsignedByteType && utils.convert( textureType ) !== _gl.getParameter( 35738 ) && // IE11, Edge and Chrome Mac < 52 (#9513)\n\t\t\t\t\t! ( textureType === FloatType && ( capabilities.isWebGL2 || extensions.get( 'OES_texture_float' ) || extensions.get( 'WEBGL_color_buffer_float' ) ) ) && // Chrome Mac >= 52 and Firefox\n\t\t\t\t\t! ( textureType === HalfFloatType && ( capabilities.isWebGL2 ? extensions.get( 'EXT_color_buffer_float' ) : extensions.get( 'EXT_color_buffer_half_float' ) ) ) ) {\n\n\t\t\t\t\tconsole.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.' );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t\tif ( _gl.checkFramebufferStatus( 36160 ) === 36053 ) {\n\n\t\t\t\t\t// the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604)\n\n\t\t\t\t\tif ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {\n\n\t\t\t\t\t\t_gl.readPixels( x, y, width, height, utils.convert( textureFormat ), utils.convert( textureType ), buffer );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( 'THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.' );\n\n\t\t\t\t}\n\n\t\t\t} finally {\n\n\t\t\t\tif ( restore ) {\n\n\t\t\t\t\t_gl.bindFramebuffer( 36160, _currentFramebuffer );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t};\n\n\tthis.copyFramebufferToTexture = function ( position, texture, level ) {\n\n\t\tif ( level === undefined ) level = 0;\n\n\t\tvar levelScale = Math.pow( 2, - level );\n\t\tvar width = Math.floor( texture.image.width * levelScale );\n\t\tvar height = Math.floor( texture.image.height * levelScale );\n\t\tvar glFormat = utils.convert( texture.format );\n\n\t\ttextures.setTexture2D( texture, 0 );\n\n\t\t_gl.copyTexImage2D( 3553, level, glFormat, position.x, position.y, width, height, 0 );\n\n\t\tstate.unbindTexture();\n\n\t};\n\n\tthis.copyTextureToTexture = function ( position, srcTexture, dstTexture, level ) {\n\n\t\tvar width = srcTexture.image.width;\n\t\tvar height = srcTexture.image.height;\n\t\tvar glFormat = utils.convert( dstTexture.format );\n\t\tvar glType = utils.convert( dstTexture.type );\n\n\t\ttextures.setTexture2D( dstTexture, 0 );\n\n\t\tif ( srcTexture.isDataTexture ) {\n\n\t\t\t_gl.texSubImage2D( 3553, level || 0, position.x, position.y, width, height, glFormat, glType, srcTexture.image.data );\n\n\t\t} else {\n\n\t\t\t_gl.texSubImage2D( 3553, level || 0, position.x, position.y, glFormat, glType, srcTexture.image );\n\n\t\t}\n\n\t\tstate.unbindTexture();\n\n\t};\n\n\tthis.initTexture = function ( texture ) {\n\n\t\ttextures.setTexture2D( texture, 0 );\n\n\t\tstate.unbindTexture();\n\n\t};\n\n\tif ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {\n\n\t\t__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'observe', { detail: this } ) ); // eslint-disable-line no-undef\n\n\t}\n\n}\n\n/**\n * @author mrdoob / http://mrdoob.com/\n * @author alteredq / http://alteredqualia.com/\n */\n\nfunction FogExp2( color, density ) {\n\n\tthis.name = '';\n\n\tthis.color = new Color( color );\n\tthis.density = ( density !== undefined ) ? density : 0.00025;\n\n}\n\nObject.assign( FogExp2.prototype, {\n\n\tisFogExp2: true,\n\n\tclone: function () {\n\n\t\treturn new FogExp2( this.color, this.density );\n\n\t},\n\n\ttoJSON: function ( /* meta */ ) {\n\n\t\treturn {\n\t\t\ttype: 'FogExp2',\n\t\t\tcolor: this.color.getHex(),\n\t\t\tdensity: this.density\n\t\t};\n\n\t}\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n * @author alteredq / http://alteredqualia.com/\n */\n\nfunction Fog( color, near, far ) {\n\n\tthis.name = '';\n\n\tthis.color = new Color( color );\n\n\tthis.near = ( near !== undefined ) ? near : 1;\n\tthis.far = ( far !== undefined ) ? far : 1000;\n\n}\n\nObject.assign( Fog.prototype, {\n\n\tisFog: true,\n\n\tclone: function () {\n\n\t\treturn new Fog( this.color, this.near, this.far );\n\n\t},\n\n\ttoJSON: function ( /* meta */ ) {\n\n\t\treturn {\n\t\t\ttype: 'Fog',\n\t\t\tcolor: this.color.getHex(),\n\t\t\tnear: this.near,\n\t\t\tfar: this.far\n\t\t};\n\n\t}\n\n} );\n\n/**\n * @author benaadams / https://twitter.com/ben_a_adams\n */\n\nfunction InterleavedBuffer( array, stride ) {\n\n\tthis.array = array;\n\tthis.stride = stride;\n\tthis.count = array !== undefined ? array.length / stride : 0;\n\n\tthis.usage = StaticDrawUsage;\n\tthis.updateRange = { offset: 0, count: - 1 };\n\n\tthis.version = 0;\n\n}\n\nObject.defineProperty( InterleavedBuffer.prototype, 'needsUpdate', {\n\n\tset: function ( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n} );\n\nObject.assign( InterleavedBuffer.prototype, {\n\n\tisInterleavedBuffer: true,\n\n\tonUploadCallback: function () {},\n\n\tsetUsage: function ( value ) {\n\n\t\tthis.usage = value;\n\n\t\treturn this;\n\n\t},\n\n\tcopy: function ( source ) {\n\n\t\tthis.array = new source.array.constructor( source.array );\n\t\tthis.count = source.count;\n\t\tthis.stride = source.stride;\n\t\tthis.usage = source.usage;\n\n\t\treturn this;\n\n\t},\n\n\tcopyAt: function ( index1, attribute, index2 ) {\n\n\t\tindex1 *= this.stride;\n\t\tindex2 *= attribute.stride;\n\n\t\tfor ( var i = 0, l = this.stride; i < l; i ++ ) {\n\n\t\t\tthis.array[ index1 + i ] = attribute.array[ index2 + i ];\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tset: function ( value, offset ) {\n\n\t\tif ( offset === undefined ) offset = 0;\n\n\t\tthis.array.set( value, offset );\n\n\t\treturn this;\n\n\t},\n\n\tclone: function () {\n\n\t\treturn new this.constructor().copy( this );\n\n\t},\n\n\tonUpload: function ( callback ) {\n\n\t\tthis.onUploadCallback = callback;\n\n\t\treturn this;\n\n\t}\n\n} );\n\n/**\n * @author benaadams / https://twitter.com/ben_a_adams\n */\n\nvar _vector$6 = new Vector3();\n\nfunction InterleavedBufferAttribute( interleavedBuffer, itemSize, offset, normalized ) {\n\n\tthis.data = interleavedBuffer;\n\tthis.itemSize = itemSize;\n\tthis.offset = offset;\n\n\tthis.normalized = normalized === true;\n\n}\n\nObject.defineProperties( InterleavedBufferAttribute.prototype, {\n\n\tcount: {\n\n\t\tget: function () {\n\n\t\t\treturn this.data.count;\n\n\t\t}\n\n\t},\n\n\tarray: {\n\n\t\tget: function () {\n\n\t\t\treturn this.data.array;\n\n\t\t}\n\n\t}\n\n} );\n\nObject.assign( InterleavedBufferAttribute.prototype, {\n\n\tisInterleavedBufferAttribute: true,\n\n\tapplyMatrix4: function ( m ) {\n\n\t\tfor ( var i = 0, l = this.data.count; i < l; i ++ ) {\n\n\t\t\t_vector$6.x = this.getX( i );\n\t\t\t_vector$6.y = this.getY( i );\n\t\t\t_vector$6.z = this.getZ( i );\n\n\t\t\t_vector$6.applyMatrix4( m );\n\n\t\t\tthis.setXYZ( i, _vector$6.x, _vector$6.y, _vector$6.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tsetX: function ( index, x ) {\n\n\t\tthis.data.array[ index * this.data.stride + this.offset ] = x;\n\n\t\treturn this;\n\n\t},\n\n\tsetY: function ( index, y ) {\n\n\t\tthis.data.array[ index * this.data.stride + this.offset + 1 ] = y;\n\n\t\treturn this;\n\n\t},\n\n\tsetZ: function ( index, z ) {\n\n\t\tthis.data.array[ index * this.data.stride + this.offset + 2 ] = z;\n\n\t\treturn this;\n\n\t},\n\n\tsetW: function ( index, w ) {\n\n\t\tthis.data.array[ index * this.data.stride + this.offset + 3 ] = w;\n\n\t\treturn this;\n\n\t},\n\n\tgetX: function ( index ) {\n\n\t\treturn this.data.array[ index * this.data.stride + this.offset ];\n\n\t},\n\n\tgetY: function ( index ) {\n\n\t\treturn this.data.array[ index * this.data.stride + this.offset + 1 ];\n\n\t},\n\n\tgetZ: function ( index ) {\n\n\t\treturn this.data.array[ index * this.data.stride + this.offset + 2 ];\n\n\t},\n\n\tgetW: function ( index ) {\n\n\t\treturn this.data.array[ index * this.data.stride + this.offset + 3 ];\n\n\t},\n\n\tsetXY: function ( index, x, y ) {\n\n\t\tindex = index * this.data.stride + this.offset;\n\n\t\tthis.data.array[ index + 0 ] = x;\n\t\tthis.data.array[ index + 1 ] = y;\n\n\t\treturn this;\n\n\t},\n\n\tsetXYZ: function ( index, x, y, z ) {\n\n\t\tindex = index * this.data.stride + this.offset;\n\n\t\tthis.data.array[ index + 0 ] = x;\n\t\tthis.data.array[ index + 1 ] = y;\n\t\tthis.data.array[ index + 2 ] = z;\n\n\t\treturn this;\n\n\t},\n\n\tsetXYZW: function ( index, x, y, z, w ) {\n\n\t\tindex = index * this.data.stride + this.offset;\n\n\t\tthis.data.array[ index + 0 ] = x;\n\t\tthis.data.array[ index + 1 ] = y;\n\t\tthis.data.array[ index + 2 ] = z;\n\t\tthis.data.array[ index + 3 ] = w;\n\n\t\treturn this;\n\n\t}\n\n} );\n\n/**\n * @author alteredq / http://alteredqualia.com/\n *\n * parameters = {\n * color: ,\n * map: new THREE.Texture( ),\n * alphaMap: new THREE.Texture( ),\n * rotation: ,\n * sizeAttenuation: \n * }\n */\n\nfunction SpriteMaterial( parameters ) {\n\n\tMaterial.call( this );\n\n\tthis.type = 'SpriteMaterial';\n\n\tthis.color = new Color( 0xffffff );\n\n\tthis.map = null;\n\n\tthis.alphaMap = null;\n\n\tthis.rotation = 0;\n\n\tthis.sizeAttenuation = true;\n\n\tthis.transparent = true;\n\n\tthis.setValues( parameters );\n\n}\n\nSpriteMaterial.prototype = Object.create( Material.prototype );\nSpriteMaterial.prototype.constructor = SpriteMaterial;\nSpriteMaterial.prototype.isSpriteMaterial = true;\n\nSpriteMaterial.prototype.copy = function ( source ) {\n\n\tMaterial.prototype.copy.call( this, source );\n\n\tthis.color.copy( source.color );\n\n\tthis.map = source.map;\n\n\tthis.alphaMap = source.alphaMap;\n\n\tthis.rotation = source.rotation;\n\n\tthis.sizeAttenuation = source.sizeAttenuation;\n\n\treturn this;\n\n};\n\n/**\n * @author mikael emtinger / http://gomo.se/\n * @author alteredq / http://alteredqualia.com/\n */\n\nvar _geometry;\n\nvar _intersectPoint = new Vector3();\nvar _worldScale = new Vector3();\nvar _mvPosition = new Vector3();\n\nvar _alignedPosition = new Vector2();\nvar _rotatedPosition = new Vector2();\nvar _viewWorldMatrix = new Matrix4();\n\nvar _vA$1 = new Vector3();\nvar _vB$1 = new Vector3();\nvar _vC$1 = new Vector3();\n\nvar _uvA$1 = new Vector2();\nvar _uvB$1 = new Vector2();\nvar _uvC$1 = new Vector2();\n\nfunction Sprite( material ) {\n\n\tObject3D.call( this );\n\n\tthis.type = 'Sprite';\n\n\tif ( _geometry === undefined ) {\n\n\t\t_geometry = new BufferGeometry();\n\n\t\tvar float32Array = new Float32Array( [\n\t\t\t- 0.5, - 0.5, 0, 0, 0,\n\t\t\t0.5, - 0.5, 0, 1, 0,\n\t\t\t0.5, 0.5, 0, 1, 1,\n\t\t\t- 0.5, 0.5, 0, 0, 1\n\t\t] );\n\n\t\tvar interleavedBuffer = new InterleavedBuffer( float32Array, 5 );\n\n\t\t_geometry.setIndex( [ 0, 1, 2,\t0, 2, 3 ] );\n\t\t_geometry.setAttribute( 'position', new InterleavedBufferAttribute( interleavedBuffer, 3, 0, false ) );\n\t\t_geometry.setAttribute( 'uv', new InterleavedBufferAttribute( interleavedBuffer, 2, 3, false ) );\n\n\t}\n\n\tthis.geometry = _geometry;\n\tthis.material = ( material !== undefined ) ? material : new SpriteMaterial();\n\n\tthis.center = new Vector2( 0.5, 0.5 );\n\n}\n\nSprite.prototype = Object.assign( Object.create( Object3D.prototype ), {\n\n\tconstructor: Sprite,\n\n\tisSprite: true,\n\n\traycast: function ( raycaster, intersects ) {\n\n\t\tif ( raycaster.camera === null ) {\n\n\t\t\tconsole.error( 'THREE.Sprite: \"Raycaster.camera\" needs to be set in order to raycast against sprites.' );\n\n\t\t}\n\n\t\t_worldScale.setFromMatrixScale( this.matrixWorld );\n\n\t\t_viewWorldMatrix.copy( raycaster.camera.matrixWorld );\n\t\tthis.modelViewMatrix.multiplyMatrices( raycaster.camera.matrixWorldInverse, this.matrixWorld );\n\n\t\t_mvPosition.setFromMatrixPosition( this.modelViewMatrix );\n\n\t\tif ( raycaster.camera.isPerspectiveCamera && this.material.sizeAttenuation === false ) {\n\n\t\t\t_worldScale.multiplyScalar( - _mvPosition.z );\n\n\t\t}\n\n\t\tvar rotation = this.material.rotation;\n\t\tvar sin, cos;\n\t\tif ( rotation !== 0 ) {\n\n\t\t\tcos = Math.cos( rotation );\n\t\t\tsin = Math.sin( rotation );\n\n\t\t}\n\n\t\tvar center = this.center;\n\n\t\ttransformVertex( _vA$1.set( - 0.5, - 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\n\t\ttransformVertex( _vB$1.set( 0.5, - 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\n\t\ttransformVertex( _vC$1.set( 0.5, 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\n\n\t\t_uvA$1.set( 0, 0 );\n\t\t_uvB$1.set( 1, 0 );\n\t\t_uvC$1.set( 1, 1 );\n\n\t\t// check first triangle\n\t\tvar intersect = raycaster.ray.intersectTriangle( _vA$1, _vB$1, _vC$1, false, _intersectPoint );\n\n\t\tif ( intersect === null ) {\n\n\t\t\t// check second triangle\n\t\t\ttransformVertex( _vB$1.set( - 0.5, 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\n\t\t\t_uvB$1.set( 0, 1 );\n\n\t\t\tintersect = raycaster.ray.intersectTriangle( _vA$1, _vC$1, _vB$1, false, _intersectPoint );\n\t\t\tif ( intersect === null ) {\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t\tvar distance = raycaster.ray.origin.distanceTo( _intersectPoint );\n\n\t\tif ( distance < raycaster.near || distance > raycaster.far ) return;\n\n\t\tintersects.push( {\n\n\t\t\tdistance: distance,\n\t\t\tpoint: _intersectPoint.clone(),\n\t\t\tuv: Triangle.getUV( _intersectPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2() ),\n\t\t\tface: null,\n\t\t\tobject: this\n\n\t\t} );\n\n\t},\n\n\tclone: function () {\n\n\t\treturn new this.constructor( this.material ).copy( this );\n\n\t},\n\n\tcopy: function ( source ) {\n\n\t\tObject3D.prototype.copy.call( this, source );\n\n\t\tif ( source.center !== undefined ) this.center.copy( source.center );\n\n\t\treturn this;\n\n\t}\n\n\n} );\n\nfunction transformVertex( vertexPosition, mvPosition, center, scale, sin, cos ) {\n\n\t// compute position in camera space\n\t_alignedPosition.subVectors( vertexPosition, center ).addScalar( 0.5 ).multiply( scale );\n\n\t// to check if rotation is not zero\n\tif ( sin !== undefined ) {\n\n\t\t_rotatedPosition.x = ( cos * _alignedPosition.x ) - ( sin * _alignedPosition.y );\n\t\t_rotatedPosition.y = ( sin * _alignedPosition.x ) + ( cos * _alignedPosition.y );\n\n\t} else {\n\n\t\t_rotatedPosition.copy( _alignedPosition );\n\n\t}\n\n\n\tvertexPosition.copy( mvPosition );\n\tvertexPosition.x += _rotatedPosition.x;\n\tvertexPosition.y += _rotatedPosition.y;\n\n\t// transform to world space\n\tvertexPosition.applyMatrix4( _viewWorldMatrix );\n\n}\n\n/**\n * @author mikael emtinger / http://gomo.se/\n * @author alteredq / http://alteredqualia.com/\n * @author mrdoob / http://mrdoob.com/\n */\n\nvar _v1$4 = new Vector3();\nvar _v2$2 = new Vector3();\n\nfunction LOD() {\n\n\tObject3D.call( this );\n\n\tthis.type = 'LOD';\n\n\tObject.defineProperties( this, {\n\t\tlevels: {\n\t\t\tenumerable: true,\n\t\t\tvalue: []\n\t\t}\n\t} );\n\n\tthis.autoUpdate = true;\n\n}\n\nLOD.prototype = Object.assign( Object.create( Object3D.prototype ), {\n\n\tconstructor: LOD,\n\n\tisLOD: true,\n\n\tcopy: function ( source ) {\n\n\t\tObject3D.prototype.copy.call( this, source, false );\n\n\t\tvar levels = source.levels;\n\n\t\tfor ( var i = 0, l = levels.length; i < l; i ++ ) {\n\n\t\t\tvar level = levels[ i ];\n\n\t\t\tthis.addLevel( level.object.clone(), level.distance );\n\n\t\t}\n\n\t\tthis.autoUpdate = source.autoUpdate;\n\n\t\treturn this;\n\n\t},\n\n\taddLevel: function ( object, distance ) {\n\n\t\tif ( distance === undefined ) distance = 0;\n\n\t\tdistance = Math.abs( distance );\n\n\t\tvar levels = this.levels;\n\n\t\tfor ( var l = 0; l < levels.length; l ++ ) {\n\n\t\t\tif ( distance < levels[ l ].distance ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tlevels.splice( l, 0, { distance: distance, object: object } );\n\n\t\tthis.add( object );\n\n\t\treturn this;\n\n\t},\n\n\tgetObjectForDistance: function ( distance ) {\n\n\t\tvar levels = this.levels;\n\n\t\tif ( levels.length > 0 ) {\n\n\t\t\tfor ( var i = 1, l = levels.length; i < l; i ++ ) {\n\n\t\t\t\tif ( distance < levels[ i ].distance ) {\n\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn levels[ i - 1 ].object;\n\n\t\t}\n\n\t\treturn null;\n\n\t},\n\n\traycast: function ( raycaster, intersects ) {\n\n\t\tvar levels = this.levels;\n\n\t\tif ( levels.length > 0 ) {\n\n\t\t\t_v1$4.setFromMatrixPosition( this.matrixWorld );\n\n\t\t\tvar distance = raycaster.ray.origin.distanceTo( _v1$4 );\n\n\t\t\tthis.getObjectForDistance( distance ).raycast( raycaster, intersects );\n\n\t\t}\n\n\t},\n\n\tupdate: function ( camera ) {\n\n\t\tvar levels = this.levels;\n\n\t\tif ( levels.length > 1 ) {\n\n\t\t\t_v1$4.setFromMatrixPosition( camera.matrixWorld );\n\t\t\t_v2$2.setFromMatrixPosition( this.matrixWorld );\n\n\t\t\tvar distance = _v1$4.distanceTo( _v2$2 );\n\n\t\t\tlevels[ 0 ].object.visible = true;\n\n\t\t\tfor ( var i = 1, l = levels.length; i < l; i ++ ) {\n\n\t\t\t\tif ( distance >= levels[ i ].distance ) {\n\n\t\t\t\t\tlevels[ i - 1 ].object.visible = false;\n\t\t\t\t\tlevels[ i ].object.visible = true;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tfor ( ; i < l; i ++ ) {\n\n\t\t\t\tlevels[ i ].object.visible = false;\n\n\t\t\t}\n\n\t\t}\n\n\t},\n\n\ttoJSON: function ( meta ) {\n\n\t\tvar data = Object3D.prototype.toJSON.call( this, meta );\n\n\t\tif ( this.autoUpdate === false ) data.object.autoUpdate = false;\n\n\t\tdata.object.levels = [];\n\n\t\tvar levels = this.levels;\n\n\t\tfor ( var i = 0, l = levels.length; i < l; i ++ ) {\n\n\t\t\tvar level = levels[ i ];\n\n\t\t\tdata.object.levels.push( {\n\t\t\t\tobject: level.object.uuid,\n\t\t\t\tdistance: level.distance\n\t\t\t} );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n} );\n\n/**\n * @author mikael emtinger / http://gomo.se/\n * @author alteredq / http://alteredqualia.com/\n * @author ikerr / http://verold.com\n */\n\nfunction SkinnedMesh( geometry, material ) {\n\n\tif ( geometry && geometry.isGeometry ) {\n\n\t\tconsole.error( 'THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.' );\n\n\t}\n\n\tMesh.call( this, geometry, material );\n\n\tthis.type = 'SkinnedMesh';\n\n\tthis.bindMode = 'attached';\n\tthis.bindMatrix = new Matrix4();\n\tthis.bindMatrixInverse = new Matrix4();\n\n}\n\nSkinnedMesh.prototype = Object.assign( Object.create( Mesh.prototype ), {\n\n\tconstructor: SkinnedMesh,\n\n\tisSkinnedMesh: true,\n\n\tbind: function ( skeleton, bindMatrix ) {\n\n\t\tthis.skeleton = skeleton;\n\n\t\tif ( bindMatrix === undefined ) {\n\n\t\t\tthis.updateMatrixWorld( true );\n\n\t\t\tthis.skeleton.calculateInverses();\n\n\t\t\tbindMatrix = this.matrixWorld;\n\n\t\t}\n\n\t\tthis.bindMatrix.copy( bindMatrix );\n\t\tthis.bindMatrixInverse.getInverse( bindMatrix );\n\n\t},\n\n\tpose: function () {\n\n\t\tthis.skeleton.pose();\n\n\t},\n\n\tnormalizeSkinWeights: function () {\n\n\t\tvar vector = new Vector4();\n\n\t\tvar skinWeight = this.geometry.attributes.skinWeight;\n\n\t\tfor ( var i = 0, l = skinWeight.count; i < l; i ++ ) {\n\n\t\t\tvector.x = skinWeight.getX( i );\n\t\t\tvector.y = skinWeight.getY( i );\n\t\t\tvector.z = skinWeight.getZ( i );\n\t\t\tvector.w = skinWeight.getW( i );\n\n\t\t\tvar scale = 1.0 / vector.manhattanLength();\n\n\t\t\tif ( scale !== Infinity ) {\n\n\t\t\t\tvector.multiplyScalar( scale );\n\n\t\t\t} else {\n\n\t\t\t\tvector.set( 1, 0, 0, 0 ); // do something reasonable\n\n\t\t\t}\n\n\t\t\tskinWeight.setXYZW( i, vector.x, vector.y, vector.z, vector.w );\n\n\t\t}\n\n\t},\n\n\tupdateMatrixWorld: function ( force ) {\n\n\t\tMesh.prototype.updateMatrixWorld.call( this, force );\n\n\t\tif ( this.bindMode === 'attached' ) {\n\n\t\t\tthis.bindMatrixInverse.getInverse( this.matrixWorld );\n\n\t\t} else if ( this.bindMode === 'detached' ) {\n\n\t\t\tthis.bindMatrixInverse.getInverse( this.bindMatrix );\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.SkinnedMesh: Unrecognized bindMode: ' + this.bindMode );\n\n\t\t}\n\n\t},\n\n\tclone: function () {\n\n\t\treturn new this.constructor( this.geometry, this.material ).copy( this );\n\n\t}\n\n} );\n\n/**\n * @author mikael emtinger / http://gomo.se/\n * @author alteredq / http://alteredqualia.com/\n * @author michael guerrero / http://realitymeltdown.com\n * @author ikerr / http://verold.com\n */\n\nvar _offsetMatrix = new Matrix4();\nvar _identityMatrix = new Matrix4();\n\nfunction Skeleton( bones, boneInverses ) {\n\n\t// copy the bone array\n\n\tbones = bones || [];\n\n\tthis.bones = bones.slice( 0 );\n\tthis.boneMatrices = new Float32Array( this.bones.length * 16 );\n\n\tthis.frame = - 1;\n\n\t// use the supplied bone inverses or calculate the inverses\n\n\tif ( boneInverses === undefined ) {\n\n\t\tthis.calculateInverses();\n\n\t} else {\n\n\t\tif ( this.bones.length === boneInverses.length ) {\n\n\t\t\tthis.boneInverses = boneInverses.slice( 0 );\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.Skeleton boneInverses is the wrong length.' );\n\n\t\t\tthis.boneInverses = [];\n\n\t\t\tfor ( var i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\t\tthis.boneInverses.push( new Matrix4() );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\nObject.assign( Skeleton.prototype, {\n\n\tcalculateInverses: function () {\n\n\t\tthis.boneInverses = [];\n\n\t\tfor ( var i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\tvar inverse = new Matrix4();\n\n\t\t\tif ( this.bones[ i ] ) {\n\n\t\t\t\tinverse.getInverse( this.bones[ i ].matrixWorld );\n\n\t\t\t}\n\n\t\t\tthis.boneInverses.push( inverse );\n\n\t\t}\n\n\t},\n\n\tpose: function () {\n\n\t\tvar bone, i, il;\n\n\t\t// recover the bind-time world matrices\n\n\t\tfor ( i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\tbone = this.bones[ i ];\n\n\t\t\tif ( bone ) {\n\n\t\t\t\tbone.matrixWorld.getInverse( this.boneInverses[ i ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// compute the local matrices, positions, rotations and scales\n\n\t\tfor ( i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\tbone = this.bones[ i ];\n\n\t\t\tif ( bone ) {\n\n\t\t\t\tif ( bone.parent && bone.parent.isBone ) {\n\n\t\t\t\t\tbone.matrix.getInverse( bone.parent.matrixWorld );\n\t\t\t\t\tbone.matrix.multiply( bone.matrixWorld );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tbone.matrix.copy( bone.matrixWorld );\n\n\t\t\t\t}\n\n\t\t\t\tbone.matrix.decompose( bone.position, bone.quaternion, bone.scale );\n\n\t\t\t}\n\n\t\t}\n\n\t},\n\n\tupdate: function () {\n\n\t\tvar bones = this.bones;\n\t\tvar boneInverses = this.boneInverses;\n\t\tvar boneMatrices = this.boneMatrices;\n\t\tvar boneTexture = this.boneTexture;\n\n\t\t// flatten bone matrices to array\n\n\t\tfor ( var i = 0, il = bones.length; i < il; i ++ ) {\n\n\t\t\t// compute the offset between the current and the original transform\n\n\t\t\tvar matrix = bones[ i ] ? bones[ i ].matrixWorld : _identityMatrix;\n\n\t\t\t_offsetMatrix.multiplyMatrices( matrix, boneInverses[ i ] );\n\t\t\t_offsetMatrix.toArray( boneMatrices, i * 16 );\n\n\t\t}\n\n\t\tif ( boneTexture !== undefined ) {\n\n\t\t\tboneTexture.needsUpdate = true;\n\n\t\t}\n\n\t},\n\n\tclone: function () {\n\n\t\treturn new Skeleton( this.bones, this.boneInverses );\n\n\t},\n\n\tgetBoneByName: function ( name ) {\n\n\t\tfor ( var i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\tvar bone = this.bones[ i ];\n\n\t\t\tif ( bone.name === name ) {\n\n\t\t\t\treturn bone;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn undefined;\n\n\t}\n\n} );\n\n/**\n * @author mikael emtinger / http://gomo.se/\n * @author alteredq / http://alteredqualia.com/\n * @author ikerr / http://verold.com\n */\n\nfunction Bone() {\n\n\tObject3D.call( this );\n\n\tthis.type = 'Bone';\n\n}\n\nBone.prototype = Object.assign( Object.create( Object3D.prototype ), {\n\n\tconstructor: Bone,\n\n\tisBone: true\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nvar _instanceLocalMatrix = new Matrix4();\nvar _instanceWorldMatrix = new Matrix4();\n\nvar _instanceIntersects = [];\n\nvar _mesh = new Mesh();\n\nfunction InstancedMesh( geometry, material, count ) {\n\n\tMesh.call( this, geometry, material );\n\n\tthis.instanceMatrix = new BufferAttribute( new Float32Array( count * 16 ), 16 );\n\n\tthis.count = count;\n\n\tthis.frustumCulled = false;\n\n}\n\nInstancedMesh.prototype = Object.assign( Object.create( Mesh.prototype ), {\n\n\tconstructor: InstancedMesh,\n\n\tisInstancedMesh: true,\n\n\tgetMatrixAt: function ( index, matrix ) {\n\n\t\tmatrix.fromArray( this.instanceMatrix.array, index * 16 );\n\n\t},\n\n\traycast: function ( raycaster, intersects ) {\n\n\t\tvar matrixWorld = this.matrixWorld;\n\t\tvar raycastTimes = this.count;\n\n\t\t_mesh.geometry = this.geometry;\n\t\t_mesh.material = this.material;\n\n\t\tif ( _mesh.material === undefined ) return;\n\n\t\tfor ( var instanceId = 0; instanceId < raycastTimes; instanceId ++ ) {\n\n\t\t\t// calculate the world matrix for each instance\n\n\t\t\tthis.getMatrixAt( instanceId, _instanceLocalMatrix );\n\n\t\t\t_instanceWorldMatrix.multiplyMatrices( matrixWorld, _instanceLocalMatrix );\n\n\t\t\t// the mesh represents this single instance\n\n\t\t\t_mesh.matrixWorld = _instanceWorldMatrix;\n\n\t\t\t_mesh.raycast( raycaster, _instanceIntersects );\n\n\t\t\t// process the result of raycast\n\n\t\t\tif ( _instanceIntersects.length > 0 ) {\n\n\t\t\t\t_instanceIntersects[ 0 ].instanceId = instanceId;\n\t\t\t\t_instanceIntersects[ 0 ].object = this;\n\n\t\t\t\tintersects.push( _instanceIntersects[ 0 ] );\n\n\t\t\t\t_instanceIntersects.length = 0;\n\n\t\t\t}\n\n\t\t}\n\n\t},\n\n\tsetMatrixAt: function ( index, matrix ) {\n\n\t\tmatrix.toArray( this.instanceMatrix.array, index * 16 );\n\n\t},\n\n\tupdateMorphTargets: function () {\n\n\t}\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n * @author alteredq / http://alteredqualia.com/\n *\n * parameters = {\n * color: ,\n * opacity: ,\n *\n * linewidth: ,\n * linecap: \"round\",\n * linejoin: \"round\"\n * }\n */\n\nfunction LineBasicMaterial( parameters ) {\n\n\tMaterial.call( this );\n\n\tthis.type = 'LineBasicMaterial';\n\n\tthis.color = new Color( 0xffffff );\n\n\tthis.linewidth = 1;\n\tthis.linecap = 'round';\n\tthis.linejoin = 'round';\n\n\tthis.setValues( parameters );\n\n}\n\nLineBasicMaterial.prototype = Object.create( Material.prototype );\nLineBasicMaterial.prototype.constructor = LineBasicMaterial;\n\nLineBasicMaterial.prototype.isLineBasicMaterial = true;\n\nLineBasicMaterial.prototype.copy = function ( source ) {\n\n\tMaterial.prototype.copy.call( this, source );\n\n\tthis.color.copy( source.color );\n\n\tthis.linewidth = source.linewidth;\n\tthis.linecap = source.linecap;\n\tthis.linejoin = source.linejoin;\n\n\treturn this;\n\n};\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nvar _start = new Vector3();\nvar _end = new Vector3();\nvar _inverseMatrix$1 = new Matrix4();\nvar _ray$1 = new Ray();\nvar _sphere$2 = new Sphere();\n\nfunction Line( geometry, material, mode ) {\n\n\tif ( mode === 1 ) {\n\n\t\tconsole.error( 'THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead.' );\n\n\t}\n\n\tObject3D.call( this );\n\n\tthis.type = 'Line';\n\n\tthis.geometry = geometry !== undefined ? geometry : new BufferGeometry();\n\tthis.material = material !== undefined ? material : new LineBasicMaterial();\n\n}\n\nLine.prototype = Object.assign( Object.create( Object3D.prototype ), {\n\n\tconstructor: Line,\n\n\tisLine: true,\n\n\tcomputeLineDistances: function () {\n\n\t\tvar geometry = this.geometry;\n\n\t\tif ( geometry.isBufferGeometry ) {\n\n\t\t\t// we assume non-indexed geometry\n\n\t\t\tif ( geometry.index === null ) {\n\n\t\t\t\tvar positionAttribute = geometry.attributes.position;\n\t\t\t\tvar lineDistances = [ 0 ];\n\n\t\t\t\tfor ( var i = 1, l = positionAttribute.count; i < l; i ++ ) {\n\n\t\t\t\t\t_start.fromBufferAttribute( positionAttribute, i - 1 );\n\t\t\t\t\t_end.fromBufferAttribute( positionAttribute, i );\n\n\t\t\t\t\tlineDistances[ i ] = lineDistances[ i - 1 ];\n\t\t\t\t\tlineDistances[ i ] += _start.distanceTo( _end );\n\n\t\t\t\t}\n\n\t\t\t\tgeometry.setAttribute( 'lineDistance', new Float32BufferAttribute( lineDistances, 1 ) );\n\n\t\t\t} else {\n\n\t\t\t\tconsole.warn( 'THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.' );\n\n\t\t\t}\n\n\t\t} else if ( geometry.isGeometry ) {\n\n\t\t\tvar vertices = geometry.vertices;\n\t\t\tvar lineDistances = geometry.lineDistances;\n\n\t\t\tlineDistances[ 0 ] = 0;\n\n\t\t\tfor ( var i = 1, l = vertices.length; i < l; i ++ ) {\n\n\t\t\t\tlineDistances[ i ] = lineDistances[ i - 1 ];\n\t\t\t\tlineDistances[ i ] += vertices[ i - 1 ].distanceTo( vertices[ i ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\traycast: function ( raycaster, intersects ) {\n\n\t\tvar precision = raycaster.linePrecision;\n\n\t\tvar geometry = this.geometry;\n\t\tvar matrixWorld = this.matrixWorld;\n\n\t\t// Checking boundingSphere distance to ray\n\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t_sphere$2.copy( geometry.boundingSphere );\n\t\t_sphere$2.applyMatrix4( matrixWorld );\n\t\t_sphere$2.radius += precision;\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere$2 ) === false ) return;\n\n\t\t//\n\n\t\t_inverseMatrix$1.getInverse( matrixWorld );\n\t\t_ray$1.copy( raycaster.ray ).applyMatrix4( _inverseMatrix$1 );\n\n\t\tvar localPrecision = precision / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 );\n\t\tvar localPrecisionSq = localPrecision * localPrecision;\n\n\t\tvar vStart = new Vector3();\n\t\tvar vEnd = new Vector3();\n\t\tvar interSegment = new Vector3();\n\t\tvar interRay = new Vector3();\n\t\tvar step = ( this && this.isLineSegments ) ? 2 : 1;\n\n\t\tif ( geometry.isBufferGeometry ) {\n\n\t\t\tvar index = geometry.index;\n\t\t\tvar attributes = geometry.attributes;\n\t\t\tvar positions = attributes.position.array;\n\n\t\t\tif ( index !== null ) {\n\n\t\t\t\tvar indices = index.array;\n\n\t\t\t\tfor ( var i = 0, l = indices.length - 1; i < l; i += step ) {\n\n\t\t\t\t\tvar a = indices[ i ];\n\t\t\t\t\tvar b = indices[ i + 1 ];\n\n\t\t\t\t\tvStart.fromArray( positions, a * 3 );\n\t\t\t\t\tvEnd.fromArray( positions, b * 3 );\n\n\t\t\t\t\tvar distSq = _ray$1.distanceSqToSegment( vStart, vEnd, interRay, interSegment );\n\n\t\t\t\t\tif ( distSq > localPrecisionSq ) continue;\n\n\t\t\t\t\tinterRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation\n\n\t\t\t\t\tvar distance = raycaster.ray.origin.distanceTo( interRay );\n\n\t\t\t\t\tif ( distance < raycaster.near || distance > raycaster.far ) continue;\n\n\t\t\t\t\tintersects.push( {\n\n\t\t\t\t\t\tdistance: distance,\n\t\t\t\t\t\t// What do we want? intersection point on the ray or on the segment??\n\t\t\t\t\t\t// point: raycaster.ray.at( distance ),\n\t\t\t\t\t\tpoint: interSegment.clone().applyMatrix4( this.matrixWorld ),\n\t\t\t\t\t\tindex: i,\n\t\t\t\t\t\tface: null,\n\t\t\t\t\t\tfaceIndex: null,\n\t\t\t\t\t\tobject: this\n\n\t\t\t\t\t} );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tfor ( var i = 0, l = positions.length / 3 - 1; i < l; i += step ) {\n\n\t\t\t\t\tvStart.fromArray( positions, 3 * i );\n\t\t\t\t\tvEnd.fromArray( positions, 3 * i + 3 );\n\n\t\t\t\t\tvar distSq = _ray$1.distanceSqToSegment( vStart, vEnd, interRay, interSegment );\n\n\t\t\t\t\tif ( distSq > localPrecisionSq ) continue;\n\n\t\t\t\t\tinterRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation\n\n\t\t\t\t\tvar distance = raycaster.ray.origin.distanceTo( interRay );\n\n\t\t\t\t\tif ( distance < raycaster.near || distance > raycaster.far ) continue;\n\n\t\t\t\t\tintersects.push( {\n\n\t\t\t\t\t\tdistance: distance,\n\t\t\t\t\t\t// What do we want? intersection point on the ray or on the segment??\n\t\t\t\t\t\t// point: raycaster.ray.at( distance ),\n\t\t\t\t\t\tpoint: interSegment.clone().applyMatrix4( this.matrixWorld ),\n\t\t\t\t\t\tindex: i,\n\t\t\t\t\t\tface: null,\n\t\t\t\t\t\tfaceIndex: null,\n\t\t\t\t\t\tobject: this\n\n\t\t\t\t\t} );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else if ( geometry.isGeometry ) {\n\n\t\t\tvar vertices = geometry.vertices;\n\t\t\tvar nbVertices = vertices.length;\n\n\t\t\tfor ( var i = 0; i < nbVertices - 1; i += step ) {\n\n\t\t\t\tvar distSq = _ray$1.distanceSqToSegment( vertices[ i ], vertices[ i + 1 ], interRay, interSegment );\n\n\t\t\t\tif ( distSq > localPrecisionSq ) continue;\n\n\t\t\t\tinterRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation\n\n\t\t\t\tvar distance = raycaster.ray.origin.distanceTo( interRay );\n\n\t\t\t\tif ( distance < raycaster.near || distance > raycaster.far ) continue;\n\n\t\t\t\tintersects.push( {\n\n\t\t\t\t\tdistance: distance,\n\t\t\t\t\t// What do we want? intersection point on the ray or on the segment??\n\t\t\t\t\t// point: raycaster.ray.at( distance ),\n\t\t\t\t\tpoint: interSegment.clone().applyMatrix4( this.matrixWorld ),\n\t\t\t\t\tindex: i,\n\t\t\t\t\tface: null,\n\t\t\t\t\tfaceIndex: null,\n\t\t\t\t\tobject: this\n\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t}\n\n\t},\n\n\tclone: function () {\n\n\t\treturn new this.constructor( this.geometry, this.material ).copy( this );\n\n\t}\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nvar _start$1 = new Vector3();\nvar _end$1 = new Vector3();\n\nfunction LineSegments( geometry, material ) {\n\n\tLine.call( this, geometry, material );\n\n\tthis.type = 'LineSegments';\n\n}\n\nLineSegments.prototype = Object.assign( Object.create( Line.prototype ), {\n\n\tconstructor: LineSegments,\n\n\tisLineSegments: true,\n\n\tcomputeLineDistances: function () {\n\n\t\tvar geometry = this.geometry;\n\n\t\tif ( geometry.isBufferGeometry ) {\n\n\t\t\t// we assume non-indexed geometry\n\n\t\t\tif ( geometry.index === null ) {\n\n\t\t\t\tvar positionAttribute = geometry.attributes.position;\n\t\t\t\tvar lineDistances = [];\n\n\t\t\t\tfor ( var i = 0, l = positionAttribute.count; i < l; i += 2 ) {\n\n\t\t\t\t\t_start$1.fromBufferAttribute( positionAttribute, i );\n\t\t\t\t\t_end$1.fromBufferAttribute( positionAttribute, i + 1 );\n\n\t\t\t\t\tlineDistances[ i ] = ( i === 0 ) ? 0 : lineDistances[ i - 1 ];\n\t\t\t\t\tlineDistances[ i + 1 ] = lineDistances[ i ] + _start$1.distanceTo( _end$1 );\n\n\t\t\t\t}\n\n\t\t\t\tgeometry.setAttribute( 'lineDistance', new Float32BufferAttribute( lineDistances, 1 ) );\n\n\t\t\t} else {\n\n\t\t\t\tconsole.warn( 'THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.' );\n\n\t\t\t}\n\n\t\t} else if ( geometry.isGeometry ) {\n\n\t\t\tvar vertices = geometry.vertices;\n\t\t\tvar lineDistances = geometry.lineDistances;\n\n\t\t\tfor ( var i = 0, l = vertices.length; i < l; i += 2 ) {\n\n\t\t\t\t_start$1.copy( vertices[ i ] );\n\t\t\t\t_end$1.copy( vertices[ i + 1 ] );\n\n\t\t\t\tlineDistances[ i ] = ( i === 0 ) ? 0 : lineDistances[ i - 1 ];\n\t\t\t\tlineDistances[ i + 1 ] = lineDistances[ i ] + _start$1.distanceTo( _end$1 );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n} );\n\n/**\n * @author mgreter / http://github.com/mgreter\n */\n\nfunction LineLoop( geometry, material ) {\n\n\tLine.call( this, geometry, material );\n\n\tthis.type = 'LineLoop';\n\n}\n\nLineLoop.prototype = Object.assign( Object.create( Line.prototype ), {\n\n\tconstructor: LineLoop,\n\n\tisLineLoop: true,\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n * @author alteredq / http://alteredqualia.com/\n *\n * parameters = {\n * color: ,\n * opacity: ,\n * map: new THREE.Texture( ),\n * alphaMap: new THREE.Texture( ),\n *\n * size: ,\n * sizeAttenuation: \n *\n * morphTargets: \n * }\n */\n\nfunction PointsMaterial( parameters ) {\n\n\tMaterial.call( this );\n\n\tthis.type = 'PointsMaterial';\n\n\tthis.color = new Color( 0xffffff );\n\n\tthis.map = null;\n\n\tthis.alphaMap = null;\n\n\tthis.size = 1;\n\tthis.sizeAttenuation = true;\n\n\tthis.morphTargets = false;\n\n\tthis.setValues( parameters );\n\n}\n\nPointsMaterial.prototype = Object.create( Material.prototype );\nPointsMaterial.prototype.constructor = PointsMaterial;\n\nPointsMaterial.prototype.isPointsMaterial = true;\n\nPointsMaterial.prototype.copy = function ( source ) {\n\n\tMaterial.prototype.copy.call( this, source );\n\n\tthis.color.copy( source.color );\n\n\tthis.map = source.map;\n\n\tthis.alphaMap = source.alphaMap;\n\n\tthis.size = source.size;\n\tthis.sizeAttenuation = source.sizeAttenuation;\n\n\tthis.morphTargets = source.morphTargets;\n\n\treturn this;\n\n};\n\n/**\n * @author alteredq / http://alteredqualia.com/\n */\n\nvar _inverseMatrix$2 = new Matrix4();\nvar _ray$2 = new Ray();\nvar _sphere$3 = new Sphere();\nvar _position$1 = new Vector3();\n\nfunction Points( geometry, material ) {\n\n\tObject3D.call( this );\n\n\tthis.type = 'Points';\n\n\tthis.geometry = geometry !== undefined ? geometry : new BufferGeometry();\n\tthis.material = material !== undefined ? material : new PointsMaterial();\n\n\tthis.updateMorphTargets();\n\n}\n\nPoints.prototype = Object.assign( Object.create( Object3D.prototype ), {\n\n\tconstructor: Points,\n\n\tisPoints: true,\n\n\traycast: function ( raycaster, intersects ) {\n\n\t\tvar geometry = this.geometry;\n\t\tvar matrixWorld = this.matrixWorld;\n\t\tvar threshold = raycaster.params.Points.threshold;\n\n\t\t// Checking boundingSphere distance to ray\n\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t_sphere$3.copy( geometry.boundingSphere );\n\t\t_sphere$3.applyMatrix4( matrixWorld );\n\t\t_sphere$3.radius += threshold;\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere$3 ) === false ) return;\n\n\t\t//\n\n\t\t_inverseMatrix$2.getInverse( matrixWorld );\n\t\t_ray$2.copy( raycaster.ray ).applyMatrix4( _inverseMatrix$2 );\n\n\t\tvar localThreshold = threshold / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 );\n\t\tvar localThresholdSq = localThreshold * localThreshold;\n\n\t\tif ( geometry.isBufferGeometry ) {\n\n\t\t\tvar index = geometry.index;\n\t\t\tvar attributes = geometry.attributes;\n\t\t\tvar positions = attributes.position.array;\n\n\t\t\tif ( index !== null ) {\n\n\t\t\t\tvar indices = index.array;\n\n\t\t\t\tfor ( var i = 0, il = indices.length; i < il; i ++ ) {\n\n\t\t\t\t\tvar a = indices[ i ];\n\n\t\t\t\t\t_position$1.fromArray( positions, a * 3 );\n\n\t\t\t\t\ttestPoint( _position$1, a, localThresholdSq, matrixWorld, raycaster, intersects, this );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tfor ( var i = 0, l = positions.length / 3; i < l; i ++ ) {\n\n\t\t\t\t\t_position$1.fromArray( positions, i * 3 );\n\n\t\t\t\t\ttestPoint( _position$1, i, localThresholdSq, matrixWorld, raycaster, intersects, this );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tvar vertices = geometry.vertices;\n\n\t\t\tfor ( var i = 0, l = vertices.length; i < l; i ++ ) {\n\n\t\t\t\ttestPoint( vertices[ i ], i, localThresholdSq, matrixWorld, raycaster, intersects, this );\n\n\t\t\t}\n\n\t\t}\n\n\t},\n\n\tupdateMorphTargets: function () {\n\n\t\tvar geometry = this.geometry;\n\t\tvar m, ml, name;\n\n\t\tif ( geometry.isBufferGeometry ) {\n\n\t\t\tvar morphAttributes = geometry.morphAttributes;\n\t\t\tvar keys = Object.keys( morphAttributes );\n\n\t\t\tif ( keys.length > 0 ) {\n\n\t\t\t\tvar morphAttribute = morphAttributes[ keys[ 0 ] ];\n\n\t\t\t\tif ( morphAttribute !== undefined ) {\n\n\t\t\t\t\tthis.morphTargetInfluences = [];\n\t\t\t\t\tthis.morphTargetDictionary = {};\n\n\t\t\t\t\tfor ( m = 0, ml = morphAttribute.length; m < ml; m ++ ) {\n\n\t\t\t\t\t\tname = morphAttribute[ m ].name || String( m );\n\n\t\t\t\t\t\tthis.morphTargetInfluences.push( 0 );\n\t\t\t\t\t\tthis.morphTargetDictionary[ name ] = m;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tvar morphTargets = geometry.morphTargets;\n\n\t\t\tif ( morphTargets !== undefined && morphTargets.length > 0 ) {\n\n\t\t\t\tconsole.error( 'THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.' );\n\n\t\t\t}\n\n\t\t}\n\n\t},\n\n\tclone: function () {\n\n\t\treturn new this.constructor( this.geometry, this.material ).copy( this );\n\n\t}\n\n} );\n\nfunction testPoint( point, index, localThresholdSq, matrixWorld, raycaster, intersects, object ) {\n\n\tvar rayPointDistanceSq = _ray$2.distanceSqToPoint( point );\n\n\tif ( rayPointDistanceSq < localThresholdSq ) {\n\n\t\tvar intersectPoint = new Vector3();\n\n\t\t_ray$2.closestPointToPoint( point, intersectPoint );\n\t\tintersectPoint.applyMatrix4( matrixWorld );\n\n\t\tvar distance = raycaster.ray.origin.distanceTo( intersectPoint );\n\n\t\tif ( distance < raycaster.near || distance > raycaster.far ) return;\n\n\t\tintersects.push( {\n\n\t\t\tdistance: distance,\n\t\t\tdistanceToRay: Math.sqrt( rayPointDistanceSq ),\n\t\t\tpoint: intersectPoint,\n\t\t\tindex: index,\n\t\t\tface: null,\n\t\t\tobject: object\n\n\t\t} );\n\n\t}\n\n}\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction VideoTexture( video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {\n\n\tTexture.call( this, video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\n\n\tthis.format = format !== undefined ? format : RGBFormat;\n\n\tthis.minFilter = minFilter !== undefined ? minFilter : LinearFilter;\n\tthis.magFilter = magFilter !== undefined ? magFilter : LinearFilter;\n\n\tthis.generateMipmaps = false;\n\n}\n\nVideoTexture.prototype = Object.assign( Object.create( Texture.prototype ), {\n\n\tconstructor: VideoTexture,\n\n\tisVideoTexture: true,\n\n\tupdate: function () {\n\n\t\tvar video = this.image;\n\n\t\tif ( video.readyState >= video.HAVE_CURRENT_DATA ) {\n\n\t\t\tthis.needsUpdate = true;\n\n\t\t}\n\n\t}\n\n} );\n\n/**\n * @author alteredq / http://alteredqualia.com/\n */\n\nfunction CompressedTexture( mipmaps, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, encoding ) {\n\n\tTexture.call( this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding );\n\n\tthis.image = { width: width, height: height };\n\tthis.mipmaps = mipmaps;\n\n\t// no flipping for cube textures\n\t// (also flipping doesn't work for compressed textures )\n\n\tthis.flipY = false;\n\n\t// can't generate mipmaps for compressed textures\n\t// mips must be embedded in DDS files\n\n\tthis.generateMipmaps = false;\n\n}\n\nCompressedTexture.prototype = Object.create( Texture.prototype );\nCompressedTexture.prototype.constructor = CompressedTexture;\n\nCompressedTexture.prototype.isCompressedTexture = true;\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction CanvasTexture( canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {\n\n\tTexture.call( this, canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\n\n\tthis.needsUpdate = true;\n\n}\n\nCanvasTexture.prototype = Object.create( Texture.prototype );\nCanvasTexture.prototype.constructor = CanvasTexture;\nCanvasTexture.prototype.isCanvasTexture = true;\n\n/**\n * @author Matt DesLauriers / @mattdesl\n * @author atix / arthursilber.de\n */\n\nfunction DepthTexture( width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format ) {\n\n\tformat = format !== undefined ? format : DepthFormat;\n\n\tif ( format !== DepthFormat && format !== DepthStencilFormat ) {\n\n\t\tthrow new Error( 'DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat' );\n\n\t}\n\n\tif ( type === undefined && format === DepthFormat ) type = UnsignedShortType;\n\tif ( type === undefined && format === DepthStencilFormat ) type = UnsignedInt248Type;\n\n\tTexture.call( this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\n\n\tthis.image = { width: width, height: height };\n\n\tthis.magFilter = magFilter !== undefined ? magFilter : NearestFilter;\n\tthis.minFilter = minFilter !== undefined ? minFilter : NearestFilter;\n\n\tthis.flipY = false;\n\tthis.generateMipmaps\t= false;\n\n}\n\nDepthTexture.prototype = Object.create( Texture.prototype );\nDepthTexture.prototype.constructor = DepthTexture;\nDepthTexture.prototype.isDepthTexture = true;\n\n/**\n * @author mrdoob / http://mrdoob.com/\n * @author Mugen87 / https://github.com/Mugen87\n */\n\nfunction WireframeGeometry( geometry ) {\n\n\tBufferGeometry.call( this );\n\n\tthis.type = 'WireframeGeometry';\n\n\t// buffer\n\n\tvar vertices = [];\n\n\t// helper variables\n\n\tvar i, j, l, o, ol;\n\tvar edge = [ 0, 0 ], edges = {}, e, edge1, edge2;\n\tvar key, keys = [ 'a', 'b', 'c' ];\n\tvar vertex;\n\n\t// different logic for Geometry and BufferGeometry\n\n\tif ( geometry && geometry.isGeometry ) {\n\n\t\t// create a data structure that contains all edges without duplicates\n\n\t\tvar faces = geometry.faces;\n\n\t\tfor ( i = 0, l = faces.length; i < l; i ++ ) {\n\n\t\t\tvar face = faces[ i ];\n\n\t\t\tfor ( j = 0; j < 3; j ++ ) {\n\n\t\t\t\tedge1 = face[ keys[ j ] ];\n\t\t\t\tedge2 = face[ keys[ ( j + 1 ) % 3 ] ];\n\t\t\t\tedge[ 0 ] = Math.min( edge1, edge2 ); // sorting prevents duplicates\n\t\t\t\tedge[ 1 ] = Math.max( edge1, edge2 );\n\n\t\t\t\tkey = edge[ 0 ] + ',' + edge[ 1 ];\n\n\t\t\t\tif ( edges[ key ] === undefined ) {\n\n\t\t\t\t\tedges[ key ] = { index1: edge[ 0 ], index2: edge[ 1 ] };\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate vertices\n\n\t\tfor ( key in edges ) {\n\n\t\t\te = edges[ key ];\n\n\t\t\tvertex = geometry.vertices[ e.index1 ];\n\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\tvertex = geometry.vertices[ e.index2 ];\n\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t}\n\n\t} else if ( geometry && geometry.isBufferGeometry ) {\n\n\t\tvar position, indices, groups;\n\t\tvar group, start, count;\n\t\tvar index1, index2;\n\n\t\tvertex = new Vector3();\n\n\t\tif ( geometry.index !== null ) {\n\n\t\t\t// indexed BufferGeometry\n\n\t\t\tposition = geometry.attributes.position;\n\t\t\tindices = geometry.index;\n\t\t\tgroups = geometry.groups;\n\n\t\t\tif ( groups.length === 0 ) {\n\n\t\t\t\tgroups = [ { start: 0, count: indices.count, materialIndex: 0 } ];\n\n\t\t\t}\n\n\t\t\t// create a data structure that contains all eges without duplicates\n\n\t\t\tfor ( o = 0, ol = groups.length; o < ol; ++ o ) {\n\n\t\t\t\tgroup = groups[ o ];\n\n\t\t\t\tstart = group.start;\n\t\t\t\tcount = group.count;\n\n\t\t\t\tfor ( i = start, l = ( start + count ); i < l; i += 3 ) {\n\n\t\t\t\t\tfor ( j = 0; j < 3; j ++ ) {\n\n\t\t\t\t\t\tedge1 = indices.getX( i + j );\n\t\t\t\t\t\tedge2 = indices.getX( i + ( j + 1 ) % 3 );\n\t\t\t\t\t\tedge[ 0 ] = Math.min( edge1, edge2 ); // sorting prevents duplicates\n\t\t\t\t\t\tedge[ 1 ] = Math.max( edge1, edge2 );\n\n\t\t\t\t\t\tkey = edge[ 0 ] + ',' + edge[ 1 ];\n\n\t\t\t\t\t\tif ( edges[ key ] === undefined ) {\n\n\t\t\t\t\t\t\tedges[ key ] = { index1: edge[ 0 ], index2: edge[ 1 ] };\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// generate vertices\n\n\t\t\tfor ( key in edges ) {\n\n\t\t\t\te = edges[ key ];\n\n\t\t\t\tvertex.fromBufferAttribute( position, e.index1 );\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\tvertex.fromBufferAttribute( position, e.index2 );\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// non-indexed BufferGeometry\n\n\t\t\tposition = geometry.attributes.position;\n\n\t\t\tfor ( i = 0, l = ( position.count / 3 ); i < l; i ++ ) {\n\n\t\t\t\tfor ( j = 0; j < 3; j ++ ) {\n\n\t\t\t\t\t// three edges per triangle, an edge is represented as (index1, index2)\n\t\t\t\t\t// e.g. the first triangle has the following edges: (0,1),(1,2),(2,0)\n\n\t\t\t\t\tindex1 = 3 * i + j;\n\t\t\t\t\tvertex.fromBufferAttribute( position, index1 );\n\t\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t\tindex2 = 3 * i + ( ( j + 1 ) % 3 );\n\t\t\t\t\tvertex.fromBufferAttribute( position, index2 );\n\t\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t// build geometry\n\n\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\n}\n\nWireframeGeometry.prototype = Object.create( BufferGeometry.prototype );\nWireframeGeometry.prototype.constructor = WireframeGeometry;\n\n/**\n * @author zz85 / https://github.com/zz85\n * @author Mugen87 / https://github.com/Mugen87\n *\n * Parametric Surfaces Geometry\n * based on the brilliant article by @prideout https://prideout.net/blog/old/blog/index.html@p=44.html\n */\n\n// ParametricGeometry\n\nfunction ParametricGeometry( func, slices, stacks ) {\n\n\tGeometry.call( this );\n\n\tthis.type = 'ParametricGeometry';\n\n\tthis.parameters = {\n\t\tfunc: func,\n\t\tslices: slices,\n\t\tstacks: stacks\n\t};\n\n\tthis.fromBufferGeometry( new ParametricBufferGeometry( func, slices, stacks ) );\n\tthis.mergeVertices();\n\n}\n\nParametricGeometry.prototype = Object.create( Geometry.prototype );\nParametricGeometry.prototype.constructor = ParametricGeometry;\n\n// ParametricBufferGeometry\n\nfunction ParametricBufferGeometry( func, slices, stacks ) {\n\n\tBufferGeometry.call( this );\n\n\tthis.type = 'ParametricBufferGeometry';\n\n\tthis.parameters = {\n\t\tfunc: func,\n\t\tslices: slices,\n\t\tstacks: stacks\n\t};\n\n\t// buffers\n\n\tvar indices = [];\n\tvar vertices = [];\n\tvar normals = [];\n\tvar uvs = [];\n\n\tvar EPS = 0.00001;\n\n\tvar normal = new Vector3();\n\n\tvar p0 = new Vector3(), p1 = new Vector3();\n\tvar pu = new Vector3(), pv = new Vector3();\n\n\tvar i, j;\n\n\tif ( func.length < 3 ) {\n\n\t\tconsole.error( 'THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.' );\n\n\t}\n\n\t// generate vertices, normals and uvs\n\n\tvar sliceCount = slices + 1;\n\n\tfor ( i = 0; i <= stacks; i ++ ) {\n\n\t\tvar v = i / stacks;\n\n\t\tfor ( j = 0; j <= slices; j ++ ) {\n\n\t\t\tvar u = j / slices;\n\n\t\t\t// vertex\n\n\t\t\tfunc( u, v, p0 );\n\t\t\tvertices.push( p0.x, p0.y, p0.z );\n\n\t\t\t// normal\n\n\t\t\t// approximate tangent vectors via finite differences\n\n\t\t\tif ( u - EPS >= 0 ) {\n\n\t\t\t\tfunc( u - EPS, v, p1 );\n\t\t\t\tpu.subVectors( p0, p1 );\n\n\t\t\t} else {\n\n\t\t\t\tfunc( u + EPS, v, p1 );\n\t\t\t\tpu.subVectors( p1, p0 );\n\n\t\t\t}\n\n\t\t\tif ( v - EPS >= 0 ) {\n\n\t\t\t\tfunc( u, v - EPS, p1 );\n\t\t\t\tpv.subVectors( p0, p1 );\n\n\t\t\t} else {\n\n\t\t\t\tfunc( u, v + EPS, p1 );\n\t\t\t\tpv.subVectors( p1, p0 );\n\n\t\t\t}\n\n\t\t\t// cross product of tangent vectors returns surface normal\n\n\t\t\tnormal.crossVectors( pu, pv ).normalize();\n\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t// uv\n\n\t\t\tuvs.push( u, v );\n\n\t\t}\n\n\t}\n\n\t// generate indices\n\n\tfor ( i = 0; i < stacks; i ++ ) {\n\n\t\tfor ( j = 0; j < slices; j ++ ) {\n\n\t\t\tvar a = i * sliceCount + j;\n\t\t\tvar b = i * sliceCount + j + 1;\n\t\t\tvar c = ( i + 1 ) * sliceCount + j + 1;\n\t\t\tvar d = ( i + 1 ) * sliceCount + j;\n\n\t\t\t// faces one and two\n\n\t\t\tindices.push( a, b, d );\n\t\t\tindices.push( b, c, d );\n\n\t\t}\n\n\t}\n\n\t// build geometry\n\n\tthis.setIndex( indices );\n\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n}\n\nParametricBufferGeometry.prototype = Object.create( BufferGeometry.prototype );\nParametricBufferGeometry.prototype.constructor = ParametricBufferGeometry;\n\n/**\n * @author clockworkgeek / https://github.com/clockworkgeek\n * @author timothypratley / https://github.com/timothypratley\n * @author WestLangley / http://github.com/WestLangley\n * @author Mugen87 / https://github.com/Mugen87\n */\n\n// PolyhedronGeometry\n\nfunction PolyhedronGeometry( vertices, indices, radius, detail ) {\n\n\tGeometry.call( this );\n\n\tthis.type = 'PolyhedronGeometry';\n\n\tthis.parameters = {\n\t\tvertices: vertices,\n\t\tindices: indices,\n\t\tradius: radius,\n\t\tdetail: detail\n\t};\n\n\tthis.fromBufferGeometry( new PolyhedronBufferGeometry( vertices, indices, radius, detail ) );\n\tthis.mergeVertices();\n\n}\n\nPolyhedronGeometry.prototype = Object.create( Geometry.prototype );\nPolyhedronGeometry.prototype.constructor = PolyhedronGeometry;\n\n// PolyhedronBufferGeometry\n\nfunction PolyhedronBufferGeometry( vertices, indices, radius, detail ) {\n\n\tBufferGeometry.call( this );\n\n\tthis.type = 'PolyhedronBufferGeometry';\n\n\tthis.parameters = {\n\t\tvertices: vertices,\n\t\tindices: indices,\n\t\tradius: radius,\n\t\tdetail: detail\n\t};\n\n\tradius = radius || 1;\n\tdetail = detail || 0;\n\n\t// default buffer data\n\n\tvar vertexBuffer = [];\n\tvar uvBuffer = [];\n\n\t// the subdivision creates the vertex buffer data\n\n\tsubdivide( detail );\n\n\t// all vertices should lie on a conceptual sphere with a given radius\n\n\tapplyRadius( radius );\n\n\t// finally, create the uv data\n\n\tgenerateUVs();\n\n\t// build non-indexed geometry\n\n\tthis.setAttribute( 'position', new Float32BufferAttribute( vertexBuffer, 3 ) );\n\tthis.setAttribute( 'normal', new Float32BufferAttribute( vertexBuffer.slice(), 3 ) );\n\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvBuffer, 2 ) );\n\n\tif ( detail === 0 ) {\n\n\t\tthis.computeVertexNormals(); // flat normals\n\n\t} else {\n\n\t\tthis.normalizeNormals(); // smooth normals\n\n\t}\n\n\t// helper functions\n\n\tfunction subdivide( detail ) {\n\n\t\tvar a = new Vector3();\n\t\tvar b = new Vector3();\n\t\tvar c = new Vector3();\n\n\t\t// iterate over all faces and apply a subdivison with the given detail value\n\n\t\tfor ( var i = 0; i < indices.length; i += 3 ) {\n\n\t\t\t// get the vertices of the face\n\n\t\t\tgetVertexByIndex( indices[ i + 0 ], a );\n\t\t\tgetVertexByIndex( indices[ i + 1 ], b );\n\t\t\tgetVertexByIndex( indices[ i + 2 ], c );\n\n\t\t\t// perform subdivision\n\n\t\t\tsubdivideFace( a, b, c, detail );\n\n\t\t}\n\n\t}\n\n\tfunction subdivideFace( a, b, c, detail ) {\n\n\t\tvar cols = Math.pow( 2, detail );\n\n\t\t// we use this multidimensional array as a data structure for creating the subdivision\n\n\t\tvar v = [];\n\n\t\tvar i, j;\n\n\t\t// construct all of the vertices for this subdivision\n\n\t\tfor ( i = 0; i <= cols; i ++ ) {\n\n\t\t\tv[ i ] = [];\n\n\t\t\tvar aj = a.clone().lerp( c, i / cols );\n\t\t\tvar bj = b.clone().lerp( c, i / cols );\n\n\t\t\tvar rows = cols - i;\n\n\t\t\tfor ( j = 0; j <= rows; j ++ ) {\n\n\t\t\t\tif ( j === 0 && i === cols ) {\n\n\t\t\t\t\tv[ i ][ j ] = aj;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tv[ i ][ j ] = aj.clone().lerp( bj, j / rows );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// construct all of the faces\n\n\t\tfor ( i = 0; i < cols; i ++ ) {\n\n\t\t\tfor ( j = 0; j < 2 * ( cols - i ) - 1; j ++ ) {\n\n\t\t\t\tvar k = Math.floor( j / 2 );\n\n\t\t\t\tif ( j % 2 === 0 ) {\n\n\t\t\t\t\tpushVertex( v[ i ][ k + 1 ] );\n\t\t\t\t\tpushVertex( v[ i + 1 ][ k ] );\n\t\t\t\t\tpushVertex( v[ i ][ k ] );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tpushVertex( v[ i ][ k + 1 ] );\n\t\t\t\t\tpushVertex( v[ i + 1 ][ k + 1 ] );\n\t\t\t\t\tpushVertex( v[ i + 1 ][ k ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction applyRadius( radius ) {\n\n\t\tvar vertex = new Vector3();\n\n\t\t// iterate over the entire buffer and apply the radius to each vertex\n\n\t\tfor ( var i = 0; i < vertexBuffer.length; i += 3 ) {\n\n\t\t\tvertex.x = vertexBuffer[ i + 0 ];\n\t\t\tvertex.y = vertexBuffer[ i + 1 ];\n\t\t\tvertex.z = vertexBuffer[ i + 2 ];\n\n\t\t\tvertex.normalize().multiplyScalar( radius );\n\n\t\t\tvertexBuffer[ i + 0 ] = vertex.x;\n\t\t\tvertexBuffer[ i + 1 ] = vertex.y;\n\t\t\tvertexBuffer[ i + 2 ] = vertex.z;\n\n\t\t}\n\n\t}\n\n\tfunction generateUVs() {\n\n\t\tvar vertex = new Vector3();\n\n\t\tfor ( var i = 0; i < vertexBuffer.length; i += 3 ) {\n\n\t\t\tvertex.x = vertexBuffer[ i + 0 ];\n\t\t\tvertex.y = vertexBuffer[ i + 1 ];\n\t\t\tvertex.z = vertexBuffer[ i + 2 ];\n\n\t\t\tvar u = azimuth( vertex ) / 2 / Math.PI + 0.5;\n\t\t\tvar v = inclination( vertex ) / Math.PI + 0.5;\n\t\t\tuvBuffer.push( u, 1 - v );\n\n\t\t}\n\n\t\tcorrectUVs();\n\n\t\tcorrectSeam();\n\n\t}\n\n\tfunction correctSeam() {\n\n\t\t// handle case when face straddles the seam, see #3269\n\n\t\tfor ( var i = 0; i < uvBuffer.length; i += 6 ) {\n\n\t\t\t// uv data of a single face\n\n\t\t\tvar x0 = uvBuffer[ i + 0 ];\n\t\t\tvar x1 = uvBuffer[ i + 2 ];\n\t\t\tvar x2 = uvBuffer[ i + 4 ];\n\n\t\t\tvar max = Math.max( x0, x1, x2 );\n\t\t\tvar min = Math.min( x0, x1, x2 );\n\n\t\t\t// 0.9 is somewhat arbitrary\n\n\t\t\tif ( max > 0.9 && min < 0.1 ) {\n\n\t\t\t\tif ( x0 < 0.2 ) uvBuffer[ i + 0 ] += 1;\n\t\t\t\tif ( x1 < 0.2 ) uvBuffer[ i + 2 ] += 1;\n\t\t\t\tif ( x2 < 0.2 ) uvBuffer[ i + 4 ] += 1;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction pushVertex( vertex ) {\n\n\t\tvertexBuffer.push( vertex.x, vertex.y, vertex.z );\n\n\t}\n\n\tfunction getVertexByIndex( index, vertex ) {\n\n\t\tvar stride = index * 3;\n\n\t\tvertex.x = vertices[ stride + 0 ];\n\t\tvertex.y = vertices[ stride + 1 ];\n\t\tvertex.z = vertices[ stride + 2 ];\n\n\t}\n\n\tfunction correctUVs() {\n\n\t\tvar a = new Vector3();\n\t\tvar b = new Vector3();\n\t\tvar c = new Vector3();\n\n\t\tvar centroid = new Vector3();\n\n\t\tvar uvA = new Vector2();\n\t\tvar uvB = new Vector2();\n\t\tvar uvC = new Vector2();\n\n\t\tfor ( var i = 0, j = 0; i < vertexBuffer.length; i += 9, j += 6 ) {\n\n\t\t\ta.set( vertexBuffer[ i + 0 ], vertexBuffer[ i + 1 ], vertexBuffer[ i + 2 ] );\n\t\t\tb.set( vertexBuffer[ i + 3 ], vertexBuffer[ i + 4 ], vertexBuffer[ i + 5 ] );\n\t\t\tc.set( vertexBuffer[ i + 6 ], vertexBuffer[ i + 7 ], vertexBuffer[ i + 8 ] );\n\n\t\t\tuvA.set( uvBuffer[ j + 0 ], uvBuffer[ j + 1 ] );\n\t\t\tuvB.set( uvBuffer[ j + 2 ], uvBuffer[ j + 3 ] );\n\t\t\tuvC.set( uvBuffer[ j + 4 ], uvBuffer[ j + 5 ] );\n\n\t\t\tcentroid.copy( a ).add( b ).add( c ).divideScalar( 3 );\n\n\t\t\tvar azi = azimuth( centroid );\n\n\t\t\tcorrectUV( uvA, j + 0, a, azi );\n\t\t\tcorrectUV( uvB, j + 2, b, azi );\n\t\t\tcorrectUV( uvC, j + 4, c, azi );\n\n\t\t}\n\n\t}\n\n\tfunction correctUV( uv, stride, vector, azimuth ) {\n\n\t\tif ( ( azimuth < 0 ) && ( uv.x === 1 ) ) {\n\n\t\t\tuvBuffer[ stride ] = uv.x - 1;\n\n\t\t}\n\n\t\tif ( ( vector.x === 0 ) && ( vector.z === 0 ) ) {\n\n\t\t\tuvBuffer[ stride ] = azimuth / 2 / Math.PI + 0.5;\n\n\t\t}\n\n\t}\n\n\t// Angle around the Y axis, counter-clockwise when looking from above.\n\n\tfunction azimuth( vector ) {\n\n\t\treturn Math.atan2( vector.z, - vector.x );\n\n\t}\n\n\n\t// Angle above the XZ plane.\n\n\tfunction inclination( vector ) {\n\n\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\n\t}\n\n}\n\nPolyhedronBufferGeometry.prototype = Object.create( BufferGeometry.prototype );\nPolyhedronBufferGeometry.prototype.constructor = PolyhedronBufferGeometry;\n\n/**\n * @author timothypratley / https://github.com/timothypratley\n * @author Mugen87 / https://github.com/Mugen87\n */\n\n// TetrahedronGeometry\n\nfunction TetrahedronGeometry( radius, detail ) {\n\n\tGeometry.call( this );\n\n\tthis.type = 'TetrahedronGeometry';\n\n\tthis.parameters = {\n\t\tradius: radius,\n\t\tdetail: detail\n\t};\n\n\tthis.fromBufferGeometry( new TetrahedronBufferGeometry( radius, detail ) );\n\tthis.mergeVertices();\n\n}\n\nTetrahedronGeometry.prototype = Object.create( Geometry.prototype );\nTetrahedronGeometry.prototype.constructor = TetrahedronGeometry;\n\n// TetrahedronBufferGeometry\n\nfunction TetrahedronBufferGeometry( radius, detail ) {\n\n\tvar vertices = [\n\t\t1, 1, 1, \t- 1, - 1, 1, \t- 1, 1, - 1, \t1, - 1, - 1\n\t];\n\n\tvar indices = [\n\t\t2, 1, 0, \t0, 3, 2,\t1, 3, 0,\t2, 3, 1\n\t];\n\n\tPolyhedronBufferGeometry.call( this, vertices, indices, radius, detail );\n\n\tthis.type = 'TetrahedronBufferGeometry';\n\n\tthis.parameters = {\n\t\tradius: radius,\n\t\tdetail: detail\n\t};\n\n}\n\nTetrahedronBufferGeometry.prototype = Object.create( PolyhedronBufferGeometry.prototype );\nTetrahedronBufferGeometry.prototype.constructor = TetrahedronBufferGeometry;\n\n/**\n * @author timothypratley / https://github.com/timothypratley\n * @author Mugen87 / https://github.com/Mugen87\n */\n\n// OctahedronGeometry\n\nfunction OctahedronGeometry( radius, detail ) {\n\n\tGeometry.call( this );\n\n\tthis.type = 'OctahedronGeometry';\n\n\tthis.parameters = {\n\t\tradius: radius,\n\t\tdetail: detail\n\t};\n\n\tthis.fromBufferGeometry( new OctahedronBufferGeometry( radius, detail ) );\n\tthis.mergeVertices();\n\n}\n\nOctahedronGeometry.prototype = Object.create( Geometry.prototype );\nOctahedronGeometry.prototype.constructor = OctahedronGeometry;\n\n// OctahedronBufferGeometry\n\nfunction OctahedronBufferGeometry( radius, detail ) {\n\n\tvar vertices = [\n\t\t1, 0, 0, \t- 1, 0, 0,\t0, 1, 0,\n\t\t0, - 1, 0, \t0, 0, 1,\t0, 0, - 1\n\t];\n\n\tvar indices = [\n\t\t0, 2, 4,\t0, 4, 3,\t0, 3, 5,\n\t\t0, 5, 2,\t1, 2, 5,\t1, 5, 3,\n\t\t1, 3, 4,\t1, 4, 2\n\t];\n\n\tPolyhedronBufferGeometry.call( this, vertices, indices, radius, detail );\n\n\tthis.type = 'OctahedronBufferGeometry';\n\n\tthis.parameters = {\n\t\tradius: radius,\n\t\tdetail: detail\n\t};\n\n}\n\nOctahedronBufferGeometry.prototype = Object.create( PolyhedronBufferGeometry.prototype );\nOctahedronBufferGeometry.prototype.constructor = OctahedronBufferGeometry;\n\n/**\n * @author timothypratley / https://github.com/timothypratley\n * @author Mugen87 / https://github.com/Mugen87\n */\n\n// IcosahedronGeometry\n\nfunction IcosahedronGeometry( radius, detail ) {\n\n\tGeometry.call( this );\n\n\tthis.type = 'IcosahedronGeometry';\n\n\tthis.parameters = {\n\t\tradius: radius,\n\t\tdetail: detail\n\t};\n\n\tthis.fromBufferGeometry( new IcosahedronBufferGeometry( radius, detail ) );\n\tthis.mergeVertices();\n\n}\n\nIcosahedronGeometry.prototype = Object.create( Geometry.prototype );\nIcosahedronGeometry.prototype.constructor = IcosahedronGeometry;\n\n// IcosahedronBufferGeometry\n\nfunction IcosahedronBufferGeometry( radius, detail ) {\n\n\tvar t = ( 1 + Math.sqrt( 5 ) ) / 2;\n\n\tvar vertices = [\n\t\t- 1, t, 0, \t1, t, 0, \t- 1, - t, 0, \t1, - t, 0,\n\t\t 0, - 1, t, \t0, 1, t,\t0, - 1, - t, \t0, 1, - t,\n\t\t t, 0, - 1, \tt, 0, 1, \t- t, 0, - 1, \t- t, 0, 1\n\t];\n\n\tvar indices = [\n\t\t 0, 11, 5, \t0, 5, 1, \t0, 1, 7, \t0, 7, 10, \t0, 10, 11,\n\t\t 1, 5, 9, \t5, 11, 4,\t11, 10, 2,\t10, 7, 6,\t7, 1, 8,\n\t\t 3, 9, 4, \t3, 4, 2,\t3, 2, 6,\t3, 6, 8,\t3, 8, 9,\n\t\t 4, 9, 5, \t2, 4, 11,\t6, 2, 10,\t8, 6, 7,\t9, 8, 1\n\t];\n\n\tPolyhedronBufferGeometry.call( this, vertices, indices, radius, detail );\n\n\tthis.type = 'IcosahedronBufferGeometry';\n\n\tthis.parameters = {\n\t\tradius: radius,\n\t\tdetail: detail\n\t};\n\n}\n\nIcosahedronBufferGeometry.prototype = Object.create( PolyhedronBufferGeometry.prototype );\nIcosahedronBufferGeometry.prototype.constructor = IcosahedronBufferGeometry;\n\n/**\n * @author Abe Pazos / https://hamoid.com\n * @author Mugen87 / https://github.com/Mugen87\n */\n\n// DodecahedronGeometry\n\nfunction DodecahedronGeometry( radius, detail ) {\n\n\tGeometry.call( this );\n\n\tthis.type = 'DodecahedronGeometry';\n\n\tthis.parameters = {\n\t\tradius: radius,\n\t\tdetail: detail\n\t};\n\n\tthis.fromBufferGeometry( new DodecahedronBufferGeometry( radius, detail ) );\n\tthis.mergeVertices();\n\n}\n\nDodecahedronGeometry.prototype = Object.create( Geometry.prototype );\nDodecahedronGeometry.prototype.constructor = DodecahedronGeometry;\n\n// DodecahedronBufferGeometry\n\nfunction DodecahedronBufferGeometry( radius, detail ) {\n\n\tvar t = ( 1 + Math.sqrt( 5 ) ) / 2;\n\tvar r = 1 / t;\n\n\tvar vertices = [\n\n\t\t// (±1, ±1, ±1)\n\t\t- 1, - 1, - 1,\t- 1, - 1, 1,\n\t\t- 1, 1, - 1, - 1, 1, 1,\n\t\t1, - 1, - 1, 1, - 1, 1,\n\t\t1, 1, - 1, 1, 1, 1,\n\n\t\t// (0, ±1/φ, ±φ)\n\t\t 0, - r, - t, 0, - r, t,\n\t\t 0, r, - t, 0, r, t,\n\n\t\t// (±1/φ, ±φ, 0)\n\t\t- r, - t, 0, - r, t, 0,\n\t\t r, - t, 0, r, t, 0,\n\n\t\t// (±φ, 0, ±1/φ)\n\t\t- t, 0, - r, t, 0, - r,\n\t\t- t, 0, r, t, 0, r\n\t];\n\n\tvar indices = [\n\t\t3, 11, 7, \t3, 7, 15, \t3, 15, 13,\n\t\t7, 19, 17, \t7, 17, 6, \t7, 6, 15,\n\t\t17, 4, 8, \t17, 8, 10, \t17, 10, 6,\n\t\t8, 0, 16, \t8, 16, 2, \t8, 2, 10,\n\t\t0, 12, 1, \t0, 1, 18, \t0, 18, 16,\n\t\t6, 10, 2, \t6, 2, 13, \t6, 13, 15,\n\t\t2, 16, 18, \t2, 18, 3, \t2, 3, 13,\n\t\t18, 1, 9, \t18, 9, 11, \t18, 11, 3,\n\t\t4, 14, 12, \t4, 12, 0, \t4, 0, 8,\n\t\t11, 9, 5, \t11, 5, 19, \t11, 19, 7,\n\t\t19, 5, 14, \t19, 14, 4, \t19, 4, 17,\n\t\t1, 12, 14, \t1, 14, 5, \t1, 5, 9\n\t];\n\n\tPolyhedronBufferGeometry.call( this, vertices, indices, radius, detail );\n\n\tthis.type = 'DodecahedronBufferGeometry';\n\n\tthis.parameters = {\n\t\tradius: radius,\n\t\tdetail: detail\n\t};\n\n}\n\nDodecahedronBufferGeometry.prototype = Object.create( PolyhedronBufferGeometry.prototype );\nDodecahedronBufferGeometry.prototype.constructor = DodecahedronBufferGeometry;\n\n/**\n * @author oosmoxiecode / https://github.com/oosmoxiecode\n * @author WestLangley / https://github.com/WestLangley\n * @author zz85 / https://github.com/zz85\n * @author miningold / https://github.com/miningold\n * @author jonobr1 / https://github.com/jonobr1\n * @author Mugen87 / https://github.com/Mugen87\n *\n */\n\n// TubeGeometry\n\nfunction TubeGeometry( path, tubularSegments, radius, radialSegments, closed, taper ) {\n\n\tGeometry.call( this );\n\n\tthis.type = 'TubeGeometry';\n\n\tthis.parameters = {\n\t\tpath: path,\n\t\ttubularSegments: tubularSegments,\n\t\tradius: radius,\n\t\tradialSegments: radialSegments,\n\t\tclosed: closed\n\t};\n\n\tif ( taper !== undefined ) console.warn( 'THREE.TubeGeometry: taper has been removed.' );\n\n\tvar bufferGeometry = new TubeBufferGeometry( path, tubularSegments, radius, radialSegments, closed );\n\n\t// expose internals\n\n\tthis.tangents = bufferGeometry.tangents;\n\tthis.normals = bufferGeometry.normals;\n\tthis.binormals = bufferGeometry.binormals;\n\n\t// create geometry\n\n\tthis.fromBufferGeometry( bufferGeometry );\n\tthis.mergeVertices();\n\n}\n\nTubeGeometry.prototype = Object.create( Geometry.prototype );\nTubeGeometry.prototype.constructor = TubeGeometry;\n\n// TubeBufferGeometry\n\nfunction TubeBufferGeometry( path, tubularSegments, radius, radialSegments, closed ) {\n\n\tBufferGeometry.call( this );\n\n\tthis.type = 'TubeBufferGeometry';\n\n\tthis.parameters = {\n\t\tpath: path,\n\t\ttubularSegments: tubularSegments,\n\t\tradius: radius,\n\t\tradialSegments: radialSegments,\n\t\tclosed: closed\n\t};\n\n\ttubularSegments = tubularSegments || 64;\n\tradius = radius || 1;\n\tradialSegments = radialSegments || 8;\n\tclosed = closed || false;\n\n\tvar frames = path.computeFrenetFrames( tubularSegments, closed );\n\n\t// expose internals\n\n\tthis.tangents = frames.tangents;\n\tthis.normals = frames.normals;\n\tthis.binormals = frames.binormals;\n\n\t// helper variables\n\n\tvar vertex = new Vector3();\n\tvar normal = new Vector3();\n\tvar uv = new Vector2();\n\tvar P = new Vector3();\n\n\tvar i, j;\n\n\t// buffer\n\n\tvar vertices = [];\n\tvar normals = [];\n\tvar uvs = [];\n\tvar indices = [];\n\n\t// create buffer data\n\n\tgenerateBufferData();\n\n\t// build geometry\n\n\tthis.setIndex( indices );\n\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t// functions\n\n\tfunction generateBufferData() {\n\n\t\tfor ( i = 0; i < tubularSegments; i ++ ) {\n\n\t\t\tgenerateSegment( i );\n\n\t\t}\n\n\t\t// if the geometry is not closed, generate the last row of vertices and normals\n\t\t// at the regular position on the given path\n\t\t//\n\t\t// if the geometry is closed, duplicate the first row of vertices and normals (uvs will differ)\n\n\t\tgenerateSegment( ( closed === false ) ? tubularSegments : 0 );\n\n\t\t// uvs are generated in a separate function.\n\t\t// this makes it easy compute correct values for closed geometries\n\n\t\tgenerateUVs();\n\n\t\t// finally create faces\n\n\t\tgenerateIndices();\n\n\t}\n\n\tfunction generateSegment( i ) {\n\n\t\t// we use getPointAt to sample evenly distributed points from the given path\n\n\t\tP = path.getPointAt( i / tubularSegments, P );\n\n\t\t// retrieve corresponding normal and binormal\n\n\t\tvar N = frames.normals[ i ];\n\t\tvar B = frames.binormals[ i ];\n\n\t\t// generate normals and vertices for the current segment\n\n\t\tfor ( j = 0; j <= radialSegments; j ++ ) {\n\n\t\t\tvar v = j / radialSegments * Math.PI * 2;\n\n\t\t\tvar sin = Math.sin( v );\n\t\t\tvar cos = - Math.cos( v );\n\n\t\t\t// normal\n\n\t\t\tnormal.x = ( cos * N.x + sin * B.x );\n\t\t\tnormal.y = ( cos * N.y + sin * B.y );\n\t\t\tnormal.z = ( cos * N.z + sin * B.z );\n\t\t\tnormal.normalize();\n\n\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t// vertex\n\n\t\t\tvertex.x = P.x + radius * normal.x;\n\t\t\tvertex.y = P.y + radius * normal.y;\n\t\t\tvertex.z = P.z + radius * normal.z;\n\n\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t}\n\n\t}\n\n\tfunction generateIndices() {\n\n\t\tfor ( j = 1; j <= tubularSegments; j ++ ) {\n\n\t\t\tfor ( i = 1; i <= radialSegments; i ++ ) {\n\n\t\t\t\tvar a = ( radialSegments + 1 ) * ( j - 1 ) + ( i - 1 );\n\t\t\t\tvar b = ( radialSegments + 1 ) * j + ( i - 1 );\n\t\t\t\tvar c = ( radialSegments + 1 ) * j + i;\n\t\t\t\tvar d = ( radialSegments + 1 ) * ( j - 1 ) + i;\n\n\t\t\t\t// faces\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction generateUVs() {\n\n\t\tfor ( i = 0; i <= tubularSegments; i ++ ) {\n\n\t\t\tfor ( j = 0; j <= radialSegments; j ++ ) {\n\n\t\t\t\tuv.x = i / tubularSegments;\n\t\t\t\tuv.y = j / radialSegments;\n\n\t\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\nTubeBufferGeometry.prototype = Object.create( BufferGeometry.prototype );\nTubeBufferGeometry.prototype.constructor = TubeBufferGeometry;\n\nTubeBufferGeometry.prototype.toJSON = function () {\n\n\tvar data = BufferGeometry.prototype.toJSON.call( this );\n\n\tdata.path = this.parameters.path.toJSON();\n\n\treturn data;\n\n};\n\n/**\n * @author oosmoxiecode\n * @author Mugen87 / https://github.com/Mugen87\n *\n * based on http://www.blackpawn.com/texts/pqtorus/\n */\n\n// TorusKnotGeometry\n\nfunction TorusKnotGeometry( radius, tube, tubularSegments, radialSegments, p, q, heightScale ) {\n\n\tGeometry.call( this );\n\n\tthis.type = 'TorusKnotGeometry';\n\n\tthis.parameters = {\n\t\tradius: radius,\n\t\ttube: tube,\n\t\ttubularSegments: tubularSegments,\n\t\tradialSegments: radialSegments,\n\t\tp: p,\n\t\tq: q\n\t};\n\n\tif ( heightScale !== undefined ) console.warn( 'THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead.' );\n\n\tthis.fromBufferGeometry( new TorusKnotBufferGeometry( radius, tube, tubularSegments, radialSegments, p, q ) );\n\tthis.mergeVertices();\n\n}\n\nTorusKnotGeometry.prototype = Object.create( Geometry.prototype );\nTorusKnotGeometry.prototype.constructor = TorusKnotGeometry;\n\n// TorusKnotBufferGeometry\n\nfunction TorusKnotBufferGeometry( radius, tube, tubularSegments, radialSegments, p, q ) {\n\n\tBufferGeometry.call( this );\n\n\tthis.type = 'TorusKnotBufferGeometry';\n\n\tthis.parameters = {\n\t\tradius: radius,\n\t\ttube: tube,\n\t\ttubularSegments: tubularSegments,\n\t\tradialSegments: radialSegments,\n\t\tp: p,\n\t\tq: q\n\t};\n\n\tradius = radius || 1;\n\ttube = tube || 0.4;\n\ttubularSegments = Math.floor( tubularSegments ) || 64;\n\tradialSegments = Math.floor( radialSegments ) || 8;\n\tp = p || 2;\n\tq = q || 3;\n\n\t// buffers\n\n\tvar indices = [];\n\tvar vertices = [];\n\tvar normals = [];\n\tvar uvs = [];\n\n\t// helper variables\n\n\tvar i, j;\n\n\tvar vertex = new Vector3();\n\tvar normal = new Vector3();\n\n\tvar P1 = new Vector3();\n\tvar P2 = new Vector3();\n\n\tvar B = new Vector3();\n\tvar T = new Vector3();\n\tvar N = new Vector3();\n\n\t// generate vertices, normals and uvs\n\n\tfor ( i = 0; i <= tubularSegments; ++ i ) {\n\n\t\t// the radian \"u\" is used to calculate the position on the torus curve of the current tubular segement\n\n\t\tvar u = i / tubularSegments * p * Math.PI * 2;\n\n\t\t// now we calculate two points. P1 is our current position on the curve, P2 is a little farther ahead.\n\t\t// these points are used to create a special \"coordinate space\", which is necessary to calculate the correct vertex positions\n\n\t\tcalculatePositionOnCurve( u, p, q, radius, P1 );\n\t\tcalculatePositionOnCurve( u + 0.01, p, q, radius, P2 );\n\n\t\t// calculate orthonormal basis\n\n\t\tT.subVectors( P2, P1 );\n\t\tN.addVectors( P2, P1 );\n\t\tB.crossVectors( T, N );\n\t\tN.crossVectors( B, T );\n\n\t\t// normalize B, N. T can be ignored, we don't use it\n\n\t\tB.normalize();\n\t\tN.normalize();\n\n\t\tfor ( j = 0; j <= radialSegments; ++ j ) {\n\n\t\t\t// now calculate the vertices. they are nothing more than an extrusion of the torus curve.\n\t\t\t// because we extrude a shape in the xy-plane, there is no need to calculate a z-value.\n\n\t\t\tvar v = j / radialSegments * Math.PI * 2;\n\t\t\tvar cx = - tube * Math.cos( v );\n\t\t\tvar cy = tube * Math.sin( v );\n\n\t\t\t// now calculate the final vertex position.\n\t\t\t// first we orient the extrusion with our basis vectos, then we add it to the current position on the curve\n\n\t\t\tvertex.x = P1.x + ( cx * N.x + cy * B.x );\n\t\t\tvertex.y = P1.y + ( cx * N.y + cy * B.y );\n\t\t\tvertex.z = P1.z + ( cx * N.z + cy * B.z );\n\n\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t// normal (P1 is always the center/origin of the extrusion, thus we can use it to calculate the normal)\n\n\t\t\tnormal.subVectors( vertex, P1 ).normalize();\n\n\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t// uv\n\n\t\t\tuvs.push( i / tubularSegments );\n\t\t\tuvs.push( j / radialSegments );\n\n\t\t}\n\n\t}\n\n\t// generate indices\n\n\tfor ( j = 1; j <= tubularSegments; j ++ ) {\n\n\t\tfor ( i = 1; i <= radialSegments; i ++ ) {\n\n\t\t\t// indices\n\n\t\t\tvar a = ( radialSegments + 1 ) * ( j - 1 ) + ( i - 1 );\n\t\t\tvar b = ( radialSegments + 1 ) * j + ( i - 1 );\n\t\t\tvar c = ( radialSegments + 1 ) * j + i;\n\t\t\tvar d = ( radialSegments + 1 ) * ( j - 1 ) + i;\n\n\t\t\t// faces\n\n\t\t\tindices.push( a, b, d );\n\t\t\tindices.push( b, c, d );\n\n\t\t}\n\n\t}\n\n\t// build geometry\n\n\tthis.setIndex( indices );\n\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t// this function calculates the current position on the torus curve\n\n\tfunction calculatePositionOnCurve( u, p, q, radius, position ) {\n\n\t\tvar cu = Math.cos( u );\n\t\tvar su = Math.sin( u );\n\t\tvar quOverP = q / p * u;\n\t\tvar cs = Math.cos( quOverP );\n\n\t\tposition.x = radius * ( 2 + cs ) * 0.5 * cu;\n\t\tposition.y = radius * ( 2 + cs ) * su * 0.5;\n\t\tposition.z = radius * Math.sin( quOverP ) * 0.5;\n\n\t}\n\n}\n\nTorusKnotBufferGeometry.prototype = Object.create( BufferGeometry.prototype );\nTorusKnotBufferGeometry.prototype.constructor = TorusKnotBufferGeometry;\n\n/**\n * @author oosmoxiecode\n * @author mrdoob / http://mrdoob.com/\n * @author Mugen87 / https://github.com/Mugen87\n */\n\n// TorusGeometry\n\nfunction TorusGeometry( radius, tube, radialSegments, tubularSegments, arc ) {\n\n\tGeometry.call( this );\n\n\tthis.type = 'TorusGeometry';\n\n\tthis.parameters = {\n\t\tradius: radius,\n\t\ttube: tube,\n\t\tradialSegments: radialSegments,\n\t\ttubularSegments: tubularSegments,\n\t\tarc: arc\n\t};\n\n\tthis.fromBufferGeometry( new TorusBufferGeometry( radius, tube, radialSegments, tubularSegments, arc ) );\n\tthis.mergeVertices();\n\n}\n\nTorusGeometry.prototype = Object.create( Geometry.prototype );\nTorusGeometry.prototype.constructor = TorusGeometry;\n\n// TorusBufferGeometry\n\nfunction TorusBufferGeometry( radius, tube, radialSegments, tubularSegments, arc ) {\n\n\tBufferGeometry.call( this );\n\n\tthis.type = 'TorusBufferGeometry';\n\n\tthis.parameters = {\n\t\tradius: radius,\n\t\ttube: tube,\n\t\tradialSegments: radialSegments,\n\t\ttubularSegments: tubularSegments,\n\t\tarc: arc\n\t};\n\n\tradius = radius || 1;\n\ttube = tube || 0.4;\n\tradialSegments = Math.floor( radialSegments ) || 8;\n\ttubularSegments = Math.floor( tubularSegments ) || 6;\n\tarc = arc || Math.PI * 2;\n\n\t// buffers\n\n\tvar indices = [];\n\tvar vertices = [];\n\tvar normals = [];\n\tvar uvs = [];\n\n\t// helper variables\n\n\tvar center = new Vector3();\n\tvar vertex = new Vector3();\n\tvar normal = new Vector3();\n\n\tvar j, i;\n\n\t// generate vertices, normals and uvs\n\n\tfor ( j = 0; j <= radialSegments; j ++ ) {\n\n\t\tfor ( i = 0; i <= tubularSegments; i ++ ) {\n\n\t\t\tvar u = i / tubularSegments * arc;\n\t\t\tvar v = j / radialSegments * Math.PI * 2;\n\n\t\t\t// vertex\n\n\t\t\tvertex.x = ( radius + tube * Math.cos( v ) ) * Math.cos( u );\n\t\t\tvertex.y = ( radius + tube * Math.cos( v ) ) * Math.sin( u );\n\t\t\tvertex.z = tube * Math.sin( v );\n\n\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t// normal\n\n\t\t\tcenter.x = radius * Math.cos( u );\n\t\t\tcenter.y = radius * Math.sin( u );\n\t\t\tnormal.subVectors( vertex, center ).normalize();\n\n\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t// uv\n\n\t\t\tuvs.push( i / tubularSegments );\n\t\t\tuvs.push( j / radialSegments );\n\n\t\t}\n\n\t}\n\n\t// generate indices\n\n\tfor ( j = 1; j <= radialSegments; j ++ ) {\n\n\t\tfor ( i = 1; i <= tubularSegments; i ++ ) {\n\n\t\t\t// indices\n\n\t\t\tvar a = ( tubularSegments + 1 ) * j + i - 1;\n\t\t\tvar b = ( tubularSegments + 1 ) * ( j - 1 ) + i - 1;\n\t\t\tvar c = ( tubularSegments + 1 ) * ( j - 1 ) + i;\n\t\t\tvar d = ( tubularSegments + 1 ) * j + i;\n\n\t\t\t// faces\n\n\t\t\tindices.push( a, b, d );\n\t\t\tindices.push( b, c, d );\n\n\t\t}\n\n\t}\n\n\t// build geometry\n\n\tthis.setIndex( indices );\n\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n}\n\nTorusBufferGeometry.prototype = Object.create( BufferGeometry.prototype );\nTorusBufferGeometry.prototype.constructor = TorusBufferGeometry;\n\n/**\n * @author Mugen87 / https://github.com/Mugen87\n * Port from https://github.com/mapbox/earcut (v2.1.5)\n */\n\nvar Earcut = {\n\n\ttriangulate: function ( data, holeIndices, dim ) {\n\n\t\tdim = dim || 2;\n\n\t\tvar hasHoles = holeIndices && holeIndices.length,\n\t\t\touterLen = hasHoles ? holeIndices[ 0 ] * dim : data.length,\n\t\t\touterNode = linkedList( data, 0, outerLen, dim, true ),\n\t\t\ttriangles = [];\n\n\t\tif ( ! outerNode || outerNode.next === outerNode.prev ) return triangles;\n\n\t\tvar minX, minY, maxX, maxY, x, y, invSize;\n\n\t\tif ( hasHoles ) outerNode = eliminateHoles( data, holeIndices, outerNode, dim );\n\n\t\t// if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n\t\tif ( data.length > 80 * dim ) {\n\n\t\t\tminX = maxX = data[ 0 ];\n\t\t\tminY = maxY = data[ 1 ];\n\n\t\t\tfor ( var i = dim; i < outerLen; i += dim ) {\n\n\t\t\t\tx = data[ i ];\n\t\t\t\ty = data[ i + 1 ];\n\t\t\t\tif ( x < minX ) minX = x;\n\t\t\t\tif ( y < minY ) minY = y;\n\t\t\t\tif ( x > maxX ) maxX = x;\n\t\t\t\tif ( y > maxY ) maxY = y;\n\n\t\t\t}\n\n\t\t\t// minX, minY and invSize are later used to transform coords into integers for z-order calculation\n\t\t\tinvSize = Math.max( maxX - minX, maxY - minY );\n\t\t\tinvSize = invSize !== 0 ? 1 / invSize : 0;\n\n\t\t}\n\n\t\tearcutLinked( outerNode, triangles, dim, minX, minY, invSize );\n\n\t\treturn triangles;\n\n\t}\n\n};\n\n// create a circular doubly linked list from polygon points in the specified winding order\nfunction linkedList( data, start, end, dim, clockwise ) {\n\n\tvar i, last;\n\n\tif ( clockwise === ( signedArea( data, start, end, dim ) > 0 ) ) {\n\n\t\tfor ( i = start; i < end; i += dim ) last = insertNode( i, data[ i ], data[ i + 1 ], last );\n\n\t} else {\n\n\t\tfor ( i = end - dim; i >= start; i -= dim ) last = insertNode( i, data[ i ], data[ i + 1 ], last );\n\n\t}\n\n\tif ( last && equals( last, last.next ) ) {\n\n\t\tremoveNode( last );\n\t\tlast = last.next;\n\n\t}\n\n\treturn last;\n\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints( start, end ) {\n\n\tif ( ! start ) return start;\n\tif ( ! end ) end = start;\n\n\tvar p = start,\n\t\tagain;\n\tdo {\n\n\t\tagain = false;\n\n\t\tif ( ! p.steiner && ( equals( p, p.next ) || area( p.prev, p, p.next ) === 0 ) ) {\n\n\t\t\tremoveNode( p );\n\t\t\tp = end = p.prev;\n\t\t\tif ( p === p.next ) break;\n\t\t\tagain = true;\n\n\t\t} else {\n\n\t\t\tp = p.next;\n\n\t\t}\n\n\t} while ( again || p !== end );\n\n\treturn end;\n\n}\n\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction earcutLinked( ear, triangles, dim, minX, minY, invSize, pass ) {\n\n\tif ( ! ear ) return;\n\n\t// interlink polygon nodes in z-order\n\tif ( ! pass && invSize ) indexCurve( ear, minX, minY, invSize );\n\n\tvar stop = ear,\n\t\tprev, next;\n\n\t// iterate through ears, slicing them one by one\n\twhile ( ear.prev !== ear.next ) {\n\n\t\tprev = ear.prev;\n\t\tnext = ear.next;\n\n\t\tif ( invSize ? isEarHashed( ear, minX, minY, invSize ) : isEar( ear ) ) {\n\n\t\t\t// cut off the triangle\n\t\t\ttriangles.push( prev.i / dim );\n\t\t\ttriangles.push( ear.i / dim );\n\t\t\ttriangles.push( next.i / dim );\n\n\t\t\tremoveNode( ear );\n\n\t\t\t// skipping the next vertex leads to less sliver triangles\n\t\t\tear = next.next;\n\t\t\tstop = next.next;\n\n\t\t\tcontinue;\n\n\t\t}\n\n\t\tear = next;\n\n\t\t// if we looped through the whole remaining polygon and can't find any more ears\n\t\tif ( ear === stop ) {\n\n\t\t\t// try filtering points and slicing again\n\t\t\tif ( ! pass ) {\n\n\t\t\t\tearcutLinked( filterPoints( ear ), triangles, dim, minX, minY, invSize, 1 );\n\n\t\t\t\t// if this didn't work, try curing all small self-intersections locally\n\n\t\t\t} else if ( pass === 1 ) {\n\n\t\t\t\tear = cureLocalIntersections( ear, triangles, dim );\n\t\t\t\tearcutLinked( ear, triangles, dim, minX, minY, invSize, 2 );\n\n\t\t\t\t// as a last resort, try splitting the remaining polygon into two\n\n\t\t\t} else if ( pass === 2 ) {\n\n\t\t\t\tsplitEarcut( ear, triangles, dim, minX, minY, invSize );\n\n\t\t\t}\n\n\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n}\n\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction isEar( ear ) {\n\n\tvar a = ear.prev,\n\t\tb = ear,\n\t\tc = ear.next;\n\n\tif ( area( a, b, c ) >= 0 ) return false; // reflex, can't be an ear\n\n\t// now make sure we don't have other points inside the potential ear\n\tvar p = ear.next.next;\n\n\twhile ( p !== ear.prev ) {\n\n\t\tif ( pointInTriangle( a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y ) &&\n\t\t\tarea( p.prev, p, p.next ) >= 0 ) return false;\n\t\tp = p.next;\n\n\t}\n\n\treturn true;\n\n}\n\nfunction isEarHashed( ear, minX, minY, invSize ) {\n\n\tvar a = ear.prev,\n\t\tb = ear,\n\t\tc = ear.next;\n\n\tif ( area( a, b, c ) >= 0 ) return false; // reflex, can't be an ear\n\n\t// triangle bbox; min & max are calculated like this for speed\n\tvar minTX = a.x < b.x ? ( a.x < c.x ? a.x : c.x ) : ( b.x < c.x ? b.x : c.x ),\n\t\tminTY = a.y < b.y ? ( a.y < c.y ? a.y : c.y ) : ( b.y < c.y ? b.y : c.y ),\n\t\tmaxTX = a.x > b.x ? ( a.x > c.x ? a.x : c.x ) : ( b.x > c.x ? b.x : c.x ),\n\t\tmaxTY = a.y > b.y ? ( a.y > c.y ? a.y : c.y ) : ( b.y > c.y ? b.y : c.y );\n\n\t// z-order range for the current triangle bbox;\n\tvar minZ = zOrder( minTX, minTY, minX, minY, invSize ),\n\t\tmaxZ = zOrder( maxTX, maxTY, minX, minY, invSize );\n\n\tvar p = ear.prevZ,\n\t\tn = ear.nextZ;\n\n\t// look for points inside the triangle in both directions\n\twhile ( p && p.z >= minZ && n && n.z <= maxZ ) {\n\n\t\tif ( p !== ear.prev && p !== ear.next &&\n\t\t\tpointInTriangle( a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y ) &&\n\t\t\tarea( p.prev, p, p.next ) >= 0 ) return false;\n\t\tp = p.prevZ;\n\n\t\tif ( n !== ear.prev && n !== ear.next &&\n\t\t\tpointInTriangle( a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y ) &&\n\t\t\tarea( n.prev, n, n.next ) >= 0 ) return false;\n\t\tn = n.nextZ;\n\n\t}\n\n\t// look for remaining points in decreasing z-order\n\twhile ( p && p.z >= minZ ) {\n\n\t\tif ( p !== ear.prev && p !== ear.next &&\n\t\t\tpointInTriangle( a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y ) &&\n\t\t\tarea( p.prev, p, p.next ) >= 0 ) return false;\n\t\tp = p.prevZ;\n\n\t}\n\n\t// look for remaining points in increasing z-order\n\twhile ( n && n.z <= maxZ ) {\n\n\t\tif ( n !== ear.prev && n !== ear.next &&\n\t\t\tpointInTriangle( a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y ) &&\n\t\t\tarea( n.prev, n, n.next ) >= 0 ) return false;\n\t\tn = n.nextZ;\n\n\t}\n\n\treturn true;\n\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections( start, triangles, dim ) {\n\n\tvar p = start;\n\tdo {\n\n\t\tvar a = p.prev,\n\t\t\tb = p.next.next;\n\n\t\tif ( ! equals( a, b ) && intersects( a, p, p.next, b ) && locallyInside( a, b ) && locallyInside( b, a ) ) {\n\n\t\t\ttriangles.push( a.i / dim );\n\t\t\ttriangles.push( p.i / dim );\n\t\t\ttriangles.push( b.i / dim );\n\n\t\t\t// remove two nodes involved\n\t\t\tremoveNode( p );\n\t\t\tremoveNode( p.next );\n\n\t\t\tp = start = b;\n\n\t\t}\n\n\t\tp = p.next;\n\n\t} while ( p !== start );\n\n\treturn p;\n\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut( start, triangles, dim, minX, minY, invSize ) {\n\n\t// look for a valid diagonal that divides the polygon into two\n\tvar a = start;\n\tdo {\n\n\t\tvar b = a.next.next;\n\t\twhile ( b !== a.prev ) {\n\n\t\t\tif ( a.i !== b.i && isValidDiagonal( a, b ) ) {\n\n\t\t\t\t// split the polygon in two by the diagonal\n\t\t\t\tvar c = splitPolygon( a, b );\n\n\t\t\t\t// filter colinear points around the cuts\n\t\t\t\ta = filterPoints( a, a.next );\n\t\t\t\tc = filterPoints( c, c.next );\n\n\t\t\t\t// run earcut on each half\n\t\t\t\tearcutLinked( a, triangles, dim, minX, minY, invSize );\n\t\t\t\tearcutLinked( c, triangles, dim, minX, minY, invSize );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tb = b.next;\n\n\t\t}\n\n\t\ta = a.next;\n\n\t} while ( a !== start );\n\n}\n\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction eliminateHoles( data, holeIndices, outerNode, dim ) {\n\n\tvar queue = [],\n\t\ti, len, start, end, list;\n\n\tfor ( i = 0, len = holeIndices.length; i < len; i ++ ) {\n\n\t\tstart = holeIndices[ i ] * dim;\n\t\tend = i < len - 1 ? holeIndices[ i + 1 ] * dim : data.length;\n\t\tlist = linkedList( data, start, end, dim, false );\n\t\tif ( list === list.next ) list.steiner = true;\n\t\tqueue.push( getLeftmost( list ) );\n\n\t}\n\n\tqueue.sort( compareX );\n\n\t// process holes from left to right\n\tfor ( i = 0; i < queue.length; i ++ ) {\n\n\t\teliminateHole( queue[ i ], outerNode );\n\t\touterNode = filterPoints( outerNode, outerNode.next );\n\n\t}\n\n\treturn outerNode;\n\n}\n\nfunction compareX( a, b ) {\n\n\treturn a.x - b.x;\n\n}\n\n// find a bridge between vertices that connects hole with an outer ring and and link it\nfunction eliminateHole( hole, outerNode ) {\n\n\touterNode = findHoleBridge( hole, outerNode );\n\tif ( outerNode ) {\n\n\t\tvar b = splitPolygon( outerNode, hole );\n\t\tfilterPoints( b, b.next );\n\n\t}\n\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge( hole, outerNode ) {\n\n\tvar p = outerNode,\n\t\thx = hole.x,\n\t\thy = hole.y,\n\t\tqx = - Infinity,\n\t\tm;\n\n\t// find a segment intersected by a ray from the hole's leftmost point to the left;\n\t// segment's endpoint with lesser x will be potential connection point\n\tdo {\n\n\t\tif ( hy <= p.y && hy >= p.next.y && p.next.y !== p.y ) {\n\n\t\t\tvar x = p.x + ( hy - p.y ) * ( p.next.x - p.x ) / ( p.next.y - p.y );\n\t\t\tif ( x <= hx && x > qx ) {\n\n\t\t\t\tqx = x;\n\t\t\t\tif ( x === hx ) {\n\n\t\t\t\t\tif ( hy === p.y ) return p;\n\t\t\t\t\tif ( hy === p.next.y ) return p.next;\n\n\t\t\t\t}\n\n\t\t\t\tm = p.x < p.next.x ? p : p.next;\n\n\t\t\t}\n\n\t\t}\n\n\t\tp = p.next;\n\n\t} while ( p !== outerNode );\n\n\tif ( ! m ) return null;\n\n\tif ( hx === qx ) return m.prev; // hole touches outer segment; pick lower endpoint\n\n\t// look for points inside the triangle of hole point, segment intersection and endpoint;\n\t// if there are no points found, we have a valid connection;\n\t// otherwise choose the point of the minimum angle with the ray as connection point\n\n\tvar stop = m,\n\t\tmx = m.x,\n\t\tmy = m.y,\n\t\ttanMin = Infinity,\n\t\ttan;\n\n\tp = m.next;\n\n\twhile ( p !== stop ) {\n\n\t\tif ( hx >= p.x && p.x >= mx && hx !== p.x &&\n\t\t\t\tpointInTriangle( hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y ) ) {\n\n\t\t\ttan = Math.abs( hy - p.y ) / ( hx - p.x ); // tangential\n\n\t\t\tif ( ( tan < tanMin || ( tan === tanMin && p.x > m.x ) ) && locallyInside( p, hole ) ) {\n\n\t\t\t\tm = p;\n\t\t\t\ttanMin = tan;\n\n\t\t\t}\n\n\t\t}\n\n\t\tp = p.next;\n\n\t}\n\n\treturn m;\n\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve( start, minX, minY, invSize ) {\n\n\tvar p = start;\n\tdo {\n\n\t\tif ( p.z === null ) p.z = zOrder( p.x, p.y, minX, minY, invSize );\n\t\tp.prevZ = p.prev;\n\t\tp.nextZ = p.next;\n\t\tp = p.next;\n\n\t} while ( p !== start );\n\n\tp.prevZ.nextZ = null;\n\tp.prevZ = null;\n\n\tsortLinked( p );\n\n}\n\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction sortLinked( list ) {\n\n\tvar i, p, q, e, tail, numMerges, pSize, qSize,\n\t\tinSize = 1;\n\n\tdo {\n\n\t\tp = list;\n\t\tlist = null;\n\t\ttail = null;\n\t\tnumMerges = 0;\n\n\t\twhile ( p ) {\n\n\t\t\tnumMerges ++;\n\t\t\tq = p;\n\t\t\tpSize = 0;\n\t\t\tfor ( i = 0; i < inSize; i ++ ) {\n\n\t\t\t\tpSize ++;\n\t\t\t\tq = q.nextZ;\n\t\t\t\tif ( ! q ) break;\n\n\t\t\t}\n\n\t\t\tqSize = inSize;\n\n\t\t\twhile ( pSize > 0 || ( qSize > 0 && q ) ) {\n\n\t\t\t\tif ( pSize !== 0 && ( qSize === 0 || ! q || p.z <= q.z ) ) {\n\n\t\t\t\t\te = p;\n\t\t\t\t\tp = p.nextZ;\n\t\t\t\t\tpSize --;\n\n\t\t\t\t} else {\n\n\t\t\t\t\te = q;\n\t\t\t\t\tq = q.nextZ;\n\t\t\t\t\tqSize --;\n\n\t\t\t\t}\n\n\t\t\t\tif ( tail ) tail.nextZ = e;\n\t\t\t\telse list = e;\n\n\t\t\t\te.prevZ = tail;\n\t\t\t\ttail = e;\n\n\t\t\t}\n\n\t\t\tp = q;\n\n\t\t}\n\n\t\ttail.nextZ = null;\n\t\tinSize *= 2;\n\n\t} while ( numMerges > 1 );\n\n\treturn list;\n\n}\n\n// z-order of a point given coords and inverse of the longer side of data bbox\nfunction zOrder( x, y, minX, minY, invSize ) {\n\n\t// coords are transformed into non-negative 15-bit integer range\n\tx = 32767 * ( x - minX ) * invSize;\n\ty = 32767 * ( y - minY ) * invSize;\n\n\tx = ( x | ( x << 8 ) ) & 0x00FF00FF;\n\tx = ( x | ( x << 4 ) ) & 0x0F0F0F0F;\n\tx = ( x | ( x << 2 ) ) & 0x33333333;\n\tx = ( x | ( x << 1 ) ) & 0x55555555;\n\n\ty = ( y | ( y << 8 ) ) & 0x00FF00FF;\n\ty = ( y | ( y << 4 ) ) & 0x0F0F0F0F;\n\ty = ( y | ( y << 2 ) ) & 0x33333333;\n\ty = ( y | ( y << 1 ) ) & 0x55555555;\n\n\treturn x | ( y << 1 );\n\n}\n\n// find the leftmost node of a polygon ring\nfunction getLeftmost( start ) {\n\n\tvar p = start,\n\t\tleftmost = start;\n\tdo {\n\n\t\tif ( p.x < leftmost.x || ( p.x === leftmost.x && p.y < leftmost.y ) ) leftmost = p;\n\t\tp = p.next;\n\n\t} while ( p !== start );\n\n\treturn leftmost;\n\n}\n\n// check if a point lies within a convex triangle\nfunction pointInTriangle( ax, ay, bx, by, cx, cy, px, py ) {\n\n\treturn ( cx - px ) * ( ay - py ) - ( ax - px ) * ( cy - py ) >= 0 &&\n\t\t ( ax - px ) * ( by - py ) - ( bx - px ) * ( ay - py ) >= 0 &&\n\t\t ( bx - px ) * ( cy - py ) - ( cx - px ) * ( by - py ) >= 0;\n\n}\n\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal( a, b ) {\n\n\treturn a.next.i !== b.i && a.prev.i !== b.i && ! intersectsPolygon( a, b ) &&\n\t\t locallyInside( a, b ) && locallyInside( b, a ) && middleInside( a, b );\n\n}\n\n// signed area of a triangle\nfunction area( p, q, r ) {\n\n\treturn ( q.y - p.y ) * ( r.x - q.x ) - ( q.x - p.x ) * ( r.y - q.y );\n\n}\n\n// check if two points are equal\nfunction equals( p1, p2 ) {\n\n\treturn p1.x === p2.x && p1.y === p2.y;\n\n}\n\n// check if two segments intersect\nfunction intersects( p1, q1, p2, q2 ) {\n\n\tif ( ( equals( p1, p2 ) && equals( q1, q2 ) ) ||\n\t\t( equals( p1, q2 ) && equals( p2, q1 ) ) ) return true;\n\treturn area( p1, q1, p2 ) > 0 !== area( p1, q1, q2 ) > 0 &&\n\t\t area( p2, q2, p1 ) > 0 !== area( p2, q2, q1 ) > 0;\n\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon( a, b ) {\n\n\tvar p = a;\n\tdo {\n\n\t\tif ( p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n\t\t\t\tintersects( p, p.next, a, b ) ) return true;\n\t\tp = p.next;\n\n\t} while ( p !== a );\n\n\treturn false;\n\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside( a, b ) {\n\n\treturn area( a.prev, a, a.next ) < 0 ?\n\t\tarea( a, b, a.next ) >= 0 && area( a, a.prev, b ) >= 0 :\n\t\tarea( a, b, a.prev ) < 0 || area( a, a.next, b ) < 0;\n\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside( a, b ) {\n\n\tvar p = a,\n\t\tinside = false,\n\t\tpx = ( a.x + b.x ) / 2,\n\t\tpy = ( a.y + b.y ) / 2;\n\tdo {\n\n\t\tif ( ( ( p.y > py ) !== ( p.next.y > py ) ) && p.next.y !== p.y &&\n\t\t\t\t( px < ( p.next.x - p.x ) * ( py - p.y ) / ( p.next.y - p.y ) + p.x ) )\n\t\t\tinside = ! inside;\n\t\tp = p.next;\n\n\t} while ( p !== a );\n\n\treturn inside;\n\n}\n\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction splitPolygon( a, b ) {\n\n\tvar a2 = new Node( a.i, a.x, a.y ),\n\t\tb2 = new Node( b.i, b.x, b.y ),\n\t\tan = a.next,\n\t\tbp = b.prev;\n\n\ta.next = b;\n\tb.prev = a;\n\n\ta2.next = an;\n\tan.prev = a2;\n\n\tb2.next = a2;\n\ta2.prev = b2;\n\n\tbp.next = b2;\n\tb2.prev = bp;\n\n\treturn b2;\n\n}\n\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction insertNode( i, x, y, last ) {\n\n\tvar p = new Node( i, x, y );\n\n\tif ( ! last ) {\n\n\t\tp.prev = p;\n\t\tp.next = p;\n\n\t} else {\n\n\t\tp.next = last.next;\n\t\tp.prev = last;\n\t\tlast.next.prev = p;\n\t\tlast.next = p;\n\n\t}\n\n\treturn p;\n\n}\n\nfunction removeNode( p ) {\n\n\tp.next.prev = p.prev;\n\tp.prev.next = p.next;\n\n\tif ( p.prevZ ) p.prevZ.nextZ = p.nextZ;\n\tif ( p.nextZ ) p.nextZ.prevZ = p.prevZ;\n\n}\n\nfunction Node( i, x, y ) {\n\n\t// vertex index in coordinates array\n\tthis.i = i;\n\n\t// vertex coordinates\n\tthis.x = x;\n\tthis.y = y;\n\n\t// previous and next vertex nodes in a polygon ring\n\tthis.prev = null;\n\tthis.next = null;\n\n\t// z-order curve value\n\tthis.z = null;\n\n\t// previous and next nodes in z-order\n\tthis.prevZ = null;\n\tthis.nextZ = null;\n\n\t// indicates whether this is a steiner point\n\tthis.steiner = false;\n\n}\n\nfunction signedArea( data, start, end, dim ) {\n\n\tvar sum = 0;\n\tfor ( var i = start, j = end - dim; i < end; i += dim ) {\n\n\t\tsum += ( data[ j ] - data[ i ] ) * ( data[ i + 1 ] + data[ j + 1 ] );\n\t\tj = i;\n\n\t}\n\n\treturn sum;\n\n}\n\n/**\n * @author zz85 / http://www.lab4games.net/zz85/blog\n */\n\nvar ShapeUtils = {\n\n\t// calculate area of the contour polygon\n\n\tarea: function ( contour ) {\n\n\t\tvar n = contour.length;\n\t\tvar a = 0.0;\n\n\t\tfor ( var p = n - 1, q = 0; q < n; p = q ++ ) {\n\n\t\t\ta += contour[ p ].x * contour[ q ].y - contour[ q ].x * contour[ p ].y;\n\n\t\t}\n\n\t\treturn a * 0.5;\n\n\t},\n\n\tisClockWise: function ( pts ) {\n\n\t\treturn ShapeUtils.area( pts ) < 0;\n\n\t},\n\n\ttriangulateShape: function ( contour, holes ) {\n\n\t\tvar vertices = []; // flat array of vertices like [ x0,y0, x1,y1, x2,y2, ... ]\n\t\tvar holeIndices = []; // array of hole indices\n\t\tvar faces = []; // final array of vertex indices like [ [ a,b,d ], [ b,c,d ] ]\n\n\t\tremoveDupEndPts( contour );\n\t\taddContour( vertices, contour );\n\n\t\t//\n\n\t\tvar holeIndex = contour.length;\n\n\t\tholes.forEach( removeDupEndPts );\n\n\t\tfor ( var i = 0; i < holes.length; i ++ ) {\n\n\t\t\tholeIndices.push( holeIndex );\n\t\t\tholeIndex += holes[ i ].length;\n\t\t\taddContour( vertices, holes[ i ] );\n\n\t\t}\n\n\t\t//\n\n\t\tvar triangles = Earcut.triangulate( vertices, holeIndices );\n\n\t\t//\n\n\t\tfor ( var i = 0; i < triangles.length; i += 3 ) {\n\n\t\t\tfaces.push( triangles.slice( i, i + 3 ) );\n\n\t\t}\n\n\t\treturn faces;\n\n\t}\n\n};\n\nfunction removeDupEndPts( points ) {\n\n\tvar l = points.length;\n\n\tif ( l > 2 && points[ l - 1 ].equals( points[ 0 ] ) ) {\n\n\t\tpoints.pop();\n\n\t}\n\n}\n\nfunction addContour( vertices, contour ) {\n\n\tfor ( var i = 0; i < contour.length; i ++ ) {\n\n\t\tvertices.push( contour[ i ].x );\n\t\tvertices.push( contour[ i ].y );\n\n\t}\n\n}\n\n/**\n * @author zz85 / http://www.lab4games.net/zz85/blog\n *\n * Creates extruded geometry from a path shape.\n *\n * parameters = {\n *\n * curveSegments: , // number of points on the curves\n * steps: , // number of points for z-side extrusions / used for subdividing segments of extrude spline too\n * depth: , // Depth to extrude the shape\n *\n * bevelEnabled: , // turn on bevel\n * bevelThickness: , // how deep into the original shape bevel goes\n * bevelSize: , // how far from shape outline (including bevelOffset) is bevel\n * bevelOffset: , // how far from shape outline does bevel start\n * bevelSegments: , // number of bevel layers\n *\n * extrudePath: // curve to extrude shape along\n *\n * UVGenerator: // object that provides UV generator functions\n *\n * }\n */\n\n// ExtrudeGeometry\n\nfunction ExtrudeGeometry( shapes, options ) {\n\n\tGeometry.call( this );\n\n\tthis.type = 'ExtrudeGeometry';\n\n\tthis.parameters = {\n\t\tshapes: shapes,\n\t\toptions: options\n\t};\n\n\tthis.fromBufferGeometry( new ExtrudeBufferGeometry( shapes, options ) );\n\tthis.mergeVertices();\n\n}\n\nExtrudeGeometry.prototype = Object.create( Geometry.prototype );\nExtrudeGeometry.prototype.constructor = ExtrudeGeometry;\n\nExtrudeGeometry.prototype.toJSON = function () {\n\n\tvar data = Geometry.prototype.toJSON.call( this );\n\n\tvar shapes = this.parameters.shapes;\n\tvar options = this.parameters.options;\n\n\treturn toJSON( shapes, options, data );\n\n};\n\n// ExtrudeBufferGeometry\n\nfunction ExtrudeBufferGeometry( shapes, options ) {\n\n\tBufferGeometry.call( this );\n\n\tthis.type = 'ExtrudeBufferGeometry';\n\n\tthis.parameters = {\n\t\tshapes: shapes,\n\t\toptions: options\n\t};\n\n\tshapes = Array.isArray( shapes ) ? shapes : [ shapes ];\n\n\tvar scope = this;\n\n\tvar verticesArray = [];\n\tvar uvArray = [];\n\n\tfor ( var i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\tvar shape = shapes[ i ];\n\t\taddShape( shape );\n\n\t}\n\n\t// build geometry\n\n\tthis.setAttribute( 'position', new Float32BufferAttribute( verticesArray, 3 ) );\n\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvArray, 2 ) );\n\n\tthis.computeVertexNormals();\n\n\t// functions\n\n\tfunction addShape( shape ) {\n\n\t\tvar placeholder = [];\n\n\t\t// options\n\n\t\tvar curveSegments = options.curveSegments !== undefined ? options.curveSegments : 12;\n\t\tvar steps = options.steps !== undefined ? options.steps : 1;\n\t\tvar depth = options.depth !== undefined ? options.depth : 100;\n\n\t\tvar bevelEnabled = options.bevelEnabled !== undefined ? options.bevelEnabled : true;\n\t\tvar bevelThickness = options.bevelThickness !== undefined ? options.bevelThickness : 6;\n\t\tvar bevelSize = options.bevelSize !== undefined ? options.bevelSize : bevelThickness - 2;\n\t\tvar bevelOffset = options.bevelOffset !== undefined ? options.bevelOffset : 0;\n\t\tvar bevelSegments = options.bevelSegments !== undefined ? options.bevelSegments : 3;\n\n\t\tvar extrudePath = options.extrudePath;\n\n\t\tvar uvgen = options.UVGenerator !== undefined ? options.UVGenerator : WorldUVGenerator;\n\n\t\t// deprecated options\n\n\t\tif ( options.amount !== undefined ) {\n\n\t\t\tconsole.warn( 'THREE.ExtrudeBufferGeometry: amount has been renamed to depth.' );\n\t\t\tdepth = options.amount;\n\n\t\t}\n\n\t\t//\n\n\t\tvar extrudePts, extrudeByPath = false;\n\t\tvar splineTube, binormal, normal, position2;\n\n\t\tif ( extrudePath ) {\n\n\t\t\textrudePts = extrudePath.getSpacedPoints( steps );\n\n\t\t\textrudeByPath = true;\n\t\t\tbevelEnabled = false; // bevels not supported for path extrusion\n\n\t\t\t// SETUP TNB variables\n\n\t\t\t// TODO1 - have a .isClosed in spline?\n\n\t\t\tsplineTube = extrudePath.computeFrenetFrames( steps, false );\n\n\t\t\t// console.log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length);\n\n\t\t\tbinormal = new Vector3();\n\t\t\tnormal = new Vector3();\n\t\t\tposition2 = new Vector3();\n\n\t\t}\n\n\t\t// Safeguards if bevels are not enabled\n\n\t\tif ( ! bevelEnabled ) {\n\n\t\t\tbevelSegments = 0;\n\t\t\tbevelThickness = 0;\n\t\t\tbevelSize = 0;\n\t\t\tbevelOffset = 0;\n\n\t\t}\n\n\t\t// Variables initialization\n\n\t\tvar ahole, h, hl; // looping of holes\n\n\t\tvar shapePoints = shape.extractPoints( curveSegments );\n\n\t\tvar vertices = shapePoints.shape;\n\t\tvar holes = shapePoints.holes;\n\n\t\tvar reverse = ! ShapeUtils.isClockWise( vertices );\n\n\t\tif ( reverse ) {\n\n\t\t\tvertices = vertices.reverse();\n\n\t\t\t// Maybe we should also check if holes are in the opposite direction, just to be safe ...\n\n\t\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\tahole = holes[ h ];\n\n\t\t\t\tif ( ShapeUtils.isClockWise( ahole ) ) {\n\n\t\t\t\t\tholes[ h ] = ahole.reverse();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\n\t\tvar faces = ShapeUtils.triangulateShape( vertices, holes );\n\n\t\t/* Vertices */\n\n\t\tvar contour = vertices; // vertices has all points but contour has only points of circumference\n\n\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\tahole = holes[ h ];\n\n\t\t\tvertices = vertices.concat( ahole );\n\n\t\t}\n\n\n\t\tfunction scalePt2( pt, vec, size ) {\n\n\t\t\tif ( ! vec ) console.error( \"THREE.ExtrudeGeometry: vec does not exist\" );\n\n\t\t\treturn vec.clone().multiplyScalar( size ).add( pt );\n\n\t\t}\n\n\t\tvar b, bs, t, z,\n\t\t\tvert, vlen = vertices.length,\n\t\t\tface, flen = faces.length;\n\n\n\t\t// Find directions for point movement\n\n\n\t\tfunction getBevelVec( inPt, inPrev, inNext ) {\n\n\t\t\t// computes for inPt the corresponding point inPt' on a new contour\n\t\t\t// shifted by 1 unit (length of normalized vector) to the left\n\t\t\t// if we walk along contour clockwise, this new contour is outside the old one\n\t\t\t//\n\t\t\t// inPt' is the intersection of the two lines parallel to the two\n\t\t\t// adjacent edges of inPt at a distance of 1 unit on the left side.\n\n\t\t\tvar v_trans_x, v_trans_y, shrink_by; // resulting translation vector for inPt\n\n\t\t\t// good reading for geometry algorithms (here: line-line intersection)\n\t\t\t// http://geomalgorithms.com/a05-_intersect-1.html\n\n\t\t\tvar v_prev_x = inPt.x - inPrev.x,\n\t\t\t\tv_prev_y = inPt.y - inPrev.y;\n\t\t\tvar v_next_x = inNext.x - inPt.x,\n\t\t\t\tv_next_y = inNext.y - inPt.y;\n\n\t\t\tvar v_prev_lensq = ( v_prev_x * v_prev_x + v_prev_y * v_prev_y );\n\n\t\t\t// check for collinear edges\n\t\t\tvar collinear0 = ( v_prev_x * v_next_y - v_prev_y * v_next_x );\n\n\t\t\tif ( Math.abs( collinear0 ) > Number.EPSILON ) {\n\n\t\t\t\t// not collinear\n\n\t\t\t\t// length of vectors for normalizing\n\n\t\t\t\tvar v_prev_len = Math.sqrt( v_prev_lensq );\n\t\t\t\tvar v_next_len = Math.sqrt( v_next_x * v_next_x + v_next_y * v_next_y );\n\n\t\t\t\t// shift adjacent points by unit vectors to the left\n\n\t\t\t\tvar ptPrevShift_x = ( inPrev.x - v_prev_y / v_prev_len );\n\t\t\t\tvar ptPrevShift_y = ( inPrev.y + v_prev_x / v_prev_len );\n\n\t\t\t\tvar ptNextShift_x = ( inNext.x - v_next_y / v_next_len );\n\t\t\t\tvar ptNextShift_y = ( inNext.y + v_next_x / v_next_len );\n\n\t\t\t\t// scaling factor for v_prev to intersection point\n\n\t\t\t\tvar sf = ( ( ptNextShift_x - ptPrevShift_x ) * v_next_y -\n\t\t\t\t\t\t( ptNextShift_y - ptPrevShift_y ) * v_next_x ) /\n\t\t\t\t\t( v_prev_x * v_next_y - v_prev_y * v_next_x );\n\n\t\t\t\t// vector from inPt to intersection point\n\n\t\t\t\tv_trans_x = ( ptPrevShift_x + v_prev_x * sf - inPt.x );\n\t\t\t\tv_trans_y = ( ptPrevShift_y + v_prev_y * sf - inPt.y );\n\n\t\t\t\t// Don't normalize!, otherwise sharp corners become ugly\n\t\t\t\t// but prevent crazy spikes\n\t\t\t\tvar v_trans_lensq = ( v_trans_x * v_trans_x + v_trans_y * v_trans_y );\n\t\t\t\tif ( v_trans_lensq <= 2 ) {\n\n\t\t\t\t\treturn new Vector2( v_trans_x, v_trans_y );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tshrink_by = Math.sqrt( v_trans_lensq / 2 );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// handle special case of collinear edges\n\n\t\t\t\tvar direction_eq = false; // assumes: opposite\n\t\t\t\tif ( v_prev_x > Number.EPSILON ) {\n\n\t\t\t\t\tif ( v_next_x > Number.EPSILON ) {\n\n\t\t\t\t\t\tdirection_eq = true;\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( v_prev_x < - Number.EPSILON ) {\n\n\t\t\t\t\t\tif ( v_next_x < - Number.EPSILON ) {\n\n\t\t\t\t\t\t\tdirection_eq = true;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tif ( Math.sign( v_prev_y ) === Math.sign( v_next_y ) ) {\n\n\t\t\t\t\t\t\tdirection_eq = true;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( direction_eq ) {\n\n\t\t\t\t\t// console.log(\"Warning: lines are a straight sequence\");\n\t\t\t\t\tv_trans_x = - v_prev_y;\n\t\t\t\t\tv_trans_y = v_prev_x;\n\t\t\t\t\tshrink_by = Math.sqrt( v_prev_lensq );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// console.log(\"Warning: lines are a straight spike\");\n\t\t\t\t\tv_trans_x = v_prev_x;\n\t\t\t\t\tv_trans_y = v_prev_y;\n\t\t\t\t\tshrink_by = Math.sqrt( v_prev_lensq / 2 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn new Vector2( v_trans_x / shrink_by, v_trans_y / shrink_by );\n\n\t\t}\n\n\n\t\tvar contourMovements = [];\n\n\t\tfor ( var i = 0, il = contour.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) {\n\n\t\t\tif ( j === il ) j = 0;\n\t\t\tif ( k === il ) k = 0;\n\n\t\t\t// (j)---(i)---(k)\n\t\t\t// console.log('i,j,k', i, j , k)\n\n\t\t\tcontourMovements[ i ] = getBevelVec( contour[ i ], contour[ j ], contour[ k ] );\n\n\t\t}\n\n\t\tvar holesMovements = [],\n\t\t\toneHoleMovements, verticesMovements = contourMovements.concat();\n\n\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\tahole = holes[ h ];\n\n\t\t\toneHoleMovements = [];\n\n\t\t\tfor ( i = 0, il = ahole.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) {\n\n\t\t\t\tif ( j === il ) j = 0;\n\t\t\t\tif ( k === il ) k = 0;\n\n\t\t\t\t// (j)---(i)---(k)\n\t\t\t\toneHoleMovements[ i ] = getBevelVec( ahole[ i ], ahole[ j ], ahole[ k ] );\n\n\t\t\t}\n\n\t\t\tholesMovements.push( oneHoleMovements );\n\t\t\tverticesMovements = verticesMovements.concat( oneHoleMovements );\n\n\t\t}\n\n\n\t\t// Loop bevelSegments, 1 for the front, 1 for the back\n\n\t\tfor ( b = 0; b < bevelSegments; b ++ ) {\n\n\t\t\t//for ( b = bevelSegments; b > 0; b -- ) {\n\n\t\t\tt = b / bevelSegments;\n\t\t\tz = bevelThickness * Math.cos( t * Math.PI / 2 );\n\t\t\tbs = bevelSize * Math.sin( t * Math.PI / 2 ) + bevelOffset;\n\n\t\t\t// contract shape\n\n\t\t\tfor ( i = 0, il = contour.length; i < il; i ++ ) {\n\n\t\t\t\tvert = scalePt2( contour[ i ], contourMovements[ i ], bs );\n\n\t\t\t\tv( vert.x, vert.y, - z );\n\n\t\t\t}\n\n\t\t\t// expand holes\n\n\t\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\tahole = holes[ h ];\n\t\t\t\toneHoleMovements = holesMovements[ h ];\n\n\t\t\t\tfor ( i = 0, il = ahole.length; i < il; i ++ ) {\n\n\t\t\t\t\tvert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs );\n\n\t\t\t\t\tv( vert.x, vert.y, - z );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tbs = bevelSize + bevelOffset;\n\n\t\t// Back facing vertices\n\n\t\tfor ( i = 0; i < vlen; i ++ ) {\n\n\t\t\tvert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ];\n\n\t\t\tif ( ! extrudeByPath ) {\n\n\t\t\t\tv( vert.x, vert.y, 0 );\n\n\t\t\t} else {\n\n\t\t\t\t// v( vert.x, vert.y + extrudePts[ 0 ].y, extrudePts[ 0 ].x );\n\n\t\t\t\tnormal.copy( splineTube.normals[ 0 ] ).multiplyScalar( vert.x );\n\t\t\t\tbinormal.copy( splineTube.binormals[ 0 ] ).multiplyScalar( vert.y );\n\n\t\t\t\tposition2.copy( extrudePts[ 0 ] ).add( normal ).add( binormal );\n\n\t\t\t\tv( position2.x, position2.y, position2.z );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Add stepped vertices...\n\t\t// Including front facing vertices\n\n\t\tvar s;\n\n\t\tfor ( s = 1; s <= steps; s ++ ) {\n\n\t\t\tfor ( i = 0; i < vlen; i ++ ) {\n\n\t\t\t\tvert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ];\n\n\t\t\t\tif ( ! extrudeByPath ) {\n\n\t\t\t\t\tv( vert.x, vert.y, depth / steps * s );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// v( vert.x, vert.y + extrudePts[ s - 1 ].y, extrudePts[ s - 1 ].x );\n\n\t\t\t\t\tnormal.copy( splineTube.normals[ s ] ).multiplyScalar( vert.x );\n\t\t\t\t\tbinormal.copy( splineTube.binormals[ s ] ).multiplyScalar( vert.y );\n\n\t\t\t\t\tposition2.copy( extrudePts[ s ] ).add( normal ).add( binormal );\n\n\t\t\t\t\tv( position2.x, position2.y, position2.z );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\n\t\t// Add bevel segments planes\n\n\t\t//for ( b = 1; b <= bevelSegments; b ++ ) {\n\t\tfor ( b = bevelSegments - 1; b >= 0; b -- ) {\n\n\t\t\tt = b / bevelSegments;\n\t\t\tz = bevelThickness * Math.cos( t * Math.PI / 2 );\n\t\t\tbs = bevelSize * Math.sin( t * Math.PI / 2 ) + bevelOffset;\n\n\t\t\t// contract shape\n\n\t\t\tfor ( i = 0, il = contour.length; i < il; i ++ ) {\n\n\t\t\t\tvert = scalePt2( contour[ i ], contourMovements[ i ], bs );\n\t\t\t\tv( vert.x, vert.y, depth + z );\n\n\t\t\t}\n\n\t\t\t// expand holes\n\n\t\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\tahole = holes[ h ];\n\t\t\t\toneHoleMovements = holesMovements[ h ];\n\n\t\t\t\tfor ( i = 0, il = ahole.length; i < il; i ++ ) {\n\n\t\t\t\t\tvert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs );\n\n\t\t\t\t\tif ( ! extrudeByPath ) {\n\n\t\t\t\t\t\tv( vert.x, vert.y, depth + z );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tv( vert.x, vert.y + extrudePts[ steps - 1 ].y, extrudePts[ steps - 1 ].x + z );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t/* Faces */\n\n\t\t// Top and bottom faces\n\n\t\tbuildLidFaces();\n\n\t\t// Sides faces\n\n\t\tbuildSideFaces();\n\n\n\t\t///// Internal functions\n\n\t\tfunction buildLidFaces() {\n\n\t\t\tvar start = verticesArray.length / 3;\n\n\t\t\tif ( bevelEnabled ) {\n\n\t\t\t\tvar layer = 0; // steps + 1\n\t\t\t\tvar offset = vlen * layer;\n\n\t\t\t\t// Bottom faces\n\n\t\t\t\tfor ( i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\tface = faces[ i ];\n\t\t\t\t\tf3( face[ 2 ] + offset, face[ 1 ] + offset, face[ 0 ] + offset );\n\n\t\t\t\t}\n\n\t\t\t\tlayer = steps + bevelSegments * 2;\n\t\t\t\toffset = vlen * layer;\n\n\t\t\t\t// Top faces\n\n\t\t\t\tfor ( i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\tface = faces[ i ];\n\t\t\t\t\tf3( face[ 0 ] + offset, face[ 1 ] + offset, face[ 2 ] + offset );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// Bottom faces\n\n\t\t\t\tfor ( i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\tface = faces[ i ];\n\t\t\t\t\tf3( face[ 2 ], face[ 1 ], face[ 0 ] );\n\n\t\t\t\t}\n\n\t\t\t\t// Top faces\n\n\t\t\t\tfor ( i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\tface = faces[ i ];\n\t\t\t\t\tf3( face[ 0 ] + vlen * steps, face[ 1 ] + vlen * steps, face[ 2 ] + vlen * steps );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tscope.addGroup( start, verticesArray.length / 3 - start, 0 );\n\n\t\t}\n\n\t\t// Create faces for the z-sides of the shape\n\n\t\tfunction buildSideFaces() {\n\n\t\t\tvar start = verticesArray.length / 3;\n\t\t\tvar layeroffset = 0;\n\t\t\tsidewalls( contour, layeroffset );\n\t\t\tlayeroffset += contour.length;\n\n\t\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\tahole = holes[ h ];\n\t\t\t\tsidewalls( ahole, layeroffset );\n\n\t\t\t\t//, true\n\t\t\t\tlayeroffset += ahole.length;\n\n\t\t\t}\n\n\n\t\t\tscope.addGroup( start, verticesArray.length / 3 - start, 1 );\n\n\n\t\t}\n\n\t\tfunction sidewalls( contour, layeroffset ) {\n\n\t\t\tvar j, k;\n\t\t\ti = contour.length;\n\n\t\t\twhile ( -- i >= 0 ) {\n\n\t\t\t\tj = i;\n\t\t\t\tk = i - 1;\n\t\t\t\tif ( k < 0 ) k = contour.length - 1;\n\n\t\t\t\t//console.log('b', i,j, i-1, k,vertices.length);\n\n\t\t\t\tvar s = 0,\n\t\t\t\t\tsl = steps + bevelSegments * 2;\n\n\t\t\t\tfor ( s = 0; s < sl; s ++ ) {\n\n\t\t\t\t\tvar slen1 = vlen * s;\n\t\t\t\t\tvar slen2 = vlen * ( s + 1 );\n\n\t\t\t\t\tvar a = layeroffset + j + slen1,\n\t\t\t\t\t\tb = layeroffset + k + slen1,\n\t\t\t\t\t\tc = layeroffset + k + slen2,\n\t\t\t\t\t\td = layeroffset + j + slen2;\n\n\t\t\t\t\tf4( a, b, c, d );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction v( x, y, z ) {\n\n\t\t\tplaceholder.push( x );\n\t\t\tplaceholder.push( y );\n\t\t\tplaceholder.push( z );\n\n\t\t}\n\n\n\t\tfunction f3( a, b, c ) {\n\n\t\t\taddVertex( a );\n\t\t\taddVertex( b );\n\t\t\taddVertex( c );\n\n\t\t\tvar nextIndex = verticesArray.length / 3;\n\t\t\tvar uvs = uvgen.generateTopUV( scope, verticesArray, nextIndex - 3, nextIndex - 2, nextIndex - 1 );\n\n\t\t\taddUV( uvs[ 0 ] );\n\t\t\taddUV( uvs[ 1 ] );\n\t\t\taddUV( uvs[ 2 ] );\n\n\t\t}\n\n\t\tfunction f4( a, b, c, d ) {\n\n\t\t\taddVertex( a );\n\t\t\taddVertex( b );\n\t\t\taddVertex( d );\n\n\t\t\taddVertex( b );\n\t\t\taddVertex( c );\n\t\t\taddVertex( d );\n\n\n\t\t\tvar nextIndex = verticesArray.length / 3;\n\t\t\tvar uvs = uvgen.generateSideWallUV( scope, verticesArray, nextIndex - 6, nextIndex - 3, nextIndex - 2, nextIndex - 1 );\n\n\t\t\taddUV( uvs[ 0 ] );\n\t\t\taddUV( uvs[ 1 ] );\n\t\t\taddUV( uvs[ 3 ] );\n\n\t\t\taddUV( uvs[ 1 ] );\n\t\t\taddUV( uvs[ 2 ] );\n\t\t\taddUV( uvs[ 3 ] );\n\n\t\t}\n\n\t\tfunction addVertex( index ) {\n\n\t\t\tverticesArray.push( placeholder[ index * 3 + 0 ] );\n\t\t\tverticesArray.push( placeholder[ index * 3 + 1 ] );\n\t\t\tverticesArray.push( placeholder[ index * 3 + 2 ] );\n\n\t\t}\n\n\n\t\tfunction addUV( vector2 ) {\n\n\t\t\tuvArray.push( vector2.x );\n\t\t\tuvArray.push( vector2.y );\n\n\t\t}\n\n\t}\n\n}\n\nExtrudeBufferGeometry.prototype = Object.create( BufferGeometry.prototype );\nExtrudeBufferGeometry.prototype.constructor = ExtrudeBufferGeometry;\n\nExtrudeBufferGeometry.prototype.toJSON = function () {\n\n\tvar data = BufferGeometry.prototype.toJSON.call( this );\n\n\tvar shapes = this.parameters.shapes;\n\tvar options = this.parameters.options;\n\n\treturn toJSON( shapes, options, data );\n\n};\n\n//\n\nvar WorldUVGenerator = {\n\n\tgenerateTopUV: function ( geometry, vertices, indexA, indexB, indexC ) {\n\n\t\tvar a_x = vertices[ indexA * 3 ];\n\t\tvar a_y = vertices[ indexA * 3 + 1 ];\n\t\tvar b_x = vertices[ indexB * 3 ];\n\t\tvar b_y = vertices[ indexB * 3 + 1 ];\n\t\tvar c_x = vertices[ indexC * 3 ];\n\t\tvar c_y = vertices[ indexC * 3 + 1 ];\n\n\t\treturn [\n\t\t\tnew Vector2( a_x, a_y ),\n\t\t\tnew Vector2( b_x, b_y ),\n\t\t\tnew Vector2( c_x, c_y )\n\t\t];\n\n\t},\n\n\tgenerateSideWallUV: function ( geometry, vertices, indexA, indexB, indexC, indexD ) {\n\n\t\tvar a_x = vertices[ indexA * 3 ];\n\t\tvar a_y = vertices[ indexA * 3 + 1 ];\n\t\tvar a_z = vertices[ indexA * 3 + 2 ];\n\t\tvar b_x = vertices[ indexB * 3 ];\n\t\tvar b_y = vertices[ indexB * 3 + 1 ];\n\t\tvar b_z = vertices[ indexB * 3 + 2 ];\n\t\tvar c_x = vertices[ indexC * 3 ];\n\t\tvar c_y = vertices[ indexC * 3 + 1 ];\n\t\tvar c_z = vertices[ indexC * 3 + 2 ];\n\t\tvar d_x = vertices[ indexD * 3 ];\n\t\tvar d_y = vertices[ indexD * 3 + 1 ];\n\t\tvar d_z = vertices[ indexD * 3 + 2 ];\n\n\t\tif ( Math.abs( a_y - b_y ) < 0.01 ) {\n\n\t\t\treturn [\n\t\t\t\tnew Vector2( a_x, 1 - a_z ),\n\t\t\t\tnew Vector2( b_x, 1 - b_z ),\n\t\t\t\tnew Vector2( c_x, 1 - c_z ),\n\t\t\t\tnew Vector2( d_x, 1 - d_z )\n\t\t\t];\n\n\t\t} else {\n\n\t\t\treturn [\n\t\t\t\tnew Vector2( a_y, 1 - a_z ),\n\t\t\t\tnew Vector2( b_y, 1 - b_z ),\n\t\t\t\tnew Vector2( c_y, 1 - c_z ),\n\t\t\t\tnew Vector2( d_y, 1 - d_z )\n\t\t\t];\n\n\t\t}\n\n\t}\n};\n\nfunction toJSON( shapes, options, data ) {\n\n\t//\n\n\tdata.shapes = [];\n\n\tif ( Array.isArray( shapes ) ) {\n\n\t\tfor ( var i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\tvar shape = shapes[ i ];\n\n\t\t\tdata.shapes.push( shape.uuid );\n\n\t\t}\n\n\t} else {\n\n\t\tdata.shapes.push( shapes.uuid );\n\n\t}\n\n\t//\n\n\tif ( options.extrudePath !== undefined ) data.options.extrudePath = options.extrudePath.toJSON();\n\n\treturn data;\n\n}\n\n/**\n * @author zz85 / http://www.lab4games.net/zz85/blog\n * @author alteredq / http://alteredqualia.com/\n *\n * Text = 3D Text\n *\n * parameters = {\n * font: , // font\n *\n * size: , // size of the text\n * height: , // thickness to extrude text\n * curveSegments: , // number of points on the curves\n *\n * bevelEnabled: , // turn on bevel\n * bevelThickness: , // how deep into text bevel goes\n * bevelSize: , // how far from text outline (including bevelOffset) is bevel\n * bevelOffset: // how far from text outline does bevel start\n * }\n */\n\n// TextGeometry\n\nfunction TextGeometry( text, parameters ) {\n\n\tGeometry.call( this );\n\n\tthis.type = 'TextGeometry';\n\n\tthis.parameters = {\n\t\ttext: text,\n\t\tparameters: parameters\n\t};\n\n\tthis.fromBufferGeometry( new TextBufferGeometry( text, parameters ) );\n\tthis.mergeVertices();\n\n}\n\nTextGeometry.prototype = Object.create( Geometry.prototype );\nTextGeometry.prototype.constructor = TextGeometry;\n\n// TextBufferGeometry\n\nfunction TextBufferGeometry( text, parameters ) {\n\n\tparameters = parameters || {};\n\n\tvar font = parameters.font;\n\n\tif ( ! ( font && font.isFont ) ) {\n\n\t\tconsole.error( 'THREE.TextGeometry: font parameter is not an instance of THREE.Font.' );\n\t\treturn new Geometry();\n\n\t}\n\n\tvar shapes = font.generateShapes( text, parameters.size );\n\n\t// translate parameters to ExtrudeGeometry API\n\n\tparameters.depth = parameters.height !== undefined ? parameters.height : 50;\n\n\t// defaults\n\n\tif ( parameters.bevelThickness === undefined ) parameters.bevelThickness = 10;\n\tif ( parameters.bevelSize === undefined ) parameters.bevelSize = 8;\n\tif ( parameters.bevelEnabled === undefined ) parameters.bevelEnabled = false;\n\n\tExtrudeBufferGeometry.call( this, shapes, parameters );\n\n\tthis.type = 'TextBufferGeometry';\n\n}\n\nTextBufferGeometry.prototype = Object.create( ExtrudeBufferGeometry.prototype );\nTextBufferGeometry.prototype.constructor = TextBufferGeometry;\n\n/**\n * @author mrdoob / http://mrdoob.com/\n * @author benaadams / https://twitter.com/ben_a_adams\n * @author Mugen87 / https://github.com/Mugen87\n */\n\n// SphereGeometry\n\nfunction SphereGeometry( radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength ) {\n\n\tGeometry.call( this );\n\n\tthis.type = 'SphereGeometry';\n\n\tthis.parameters = {\n\t\tradius: radius,\n\t\twidthSegments: widthSegments,\n\t\theightSegments: heightSegments,\n\t\tphiStart: phiStart,\n\t\tphiLength: phiLength,\n\t\tthetaStart: thetaStart,\n\t\tthetaLength: thetaLength\n\t};\n\n\tthis.fromBufferGeometry( new SphereBufferGeometry( radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength ) );\n\tthis.mergeVertices();\n\n}\n\nSphereGeometry.prototype = Object.create( Geometry.prototype );\nSphereGeometry.prototype.constructor = SphereGeometry;\n\n// SphereBufferGeometry\n\nfunction SphereBufferGeometry( radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength ) {\n\n\tBufferGeometry.call( this );\n\n\tthis.type = 'SphereBufferGeometry';\n\n\tthis.parameters = {\n\t\tradius: radius,\n\t\twidthSegments: widthSegments,\n\t\theightSegments: heightSegments,\n\t\tphiStart: phiStart,\n\t\tphiLength: phiLength,\n\t\tthetaStart: thetaStart,\n\t\tthetaLength: thetaLength\n\t};\n\n\tradius = radius || 1;\n\n\twidthSegments = Math.max( 3, Math.floor( widthSegments ) || 8 );\n\theightSegments = Math.max( 2, Math.floor( heightSegments ) || 6 );\n\n\tphiStart = phiStart !== undefined ? phiStart : 0;\n\tphiLength = phiLength !== undefined ? phiLength : Math.PI * 2;\n\n\tthetaStart = thetaStart !== undefined ? thetaStart : 0;\n\tthetaLength = thetaLength !== undefined ? thetaLength : Math.PI;\n\n\tvar thetaEnd = Math.min( thetaStart + thetaLength, Math.PI );\n\n\tvar ix, iy;\n\n\tvar index = 0;\n\tvar grid = [];\n\n\tvar vertex = new Vector3();\n\tvar normal = new Vector3();\n\n\t// buffers\n\n\tvar indices = [];\n\tvar vertices = [];\n\tvar normals = [];\n\tvar uvs = [];\n\n\t// generate vertices, normals and uvs\n\n\tfor ( iy = 0; iy <= heightSegments; iy ++ ) {\n\n\t\tvar verticesRow = [];\n\n\t\tvar v = iy / heightSegments;\n\n\t\t// special case for the poles\n\n\t\tvar uOffset = 0;\n\n\t\tif ( iy == 0 && thetaStart == 0 ) {\n\n\t\t\tuOffset = 0.5 / widthSegments;\n\n\t\t} else if ( iy == heightSegments && thetaEnd == Math.PI ) {\n\n\t\t\tuOffset = - 0.5 / widthSegments;\n\n\t\t}\n\n\t\tfor ( ix = 0; ix <= widthSegments; ix ++ ) {\n\n\t\t\tvar u = ix / widthSegments;\n\n\t\t\t// vertex\n\n\t\t\tvertex.x = - radius * Math.cos( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );\n\t\t\tvertex.y = radius * Math.cos( thetaStart + v * thetaLength );\n\t\t\tvertex.z = radius * Math.sin( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );\n\n\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t// normal\n\n\t\t\tnormal.copy( vertex ).normalize();\n\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t// uv\n\n\t\t\tuvs.push( u + uOffset, 1 - v );\n\n\t\t\tverticesRow.push( index ++ );\n\n\t\t}\n\n\t\tgrid.push( verticesRow );\n\n\t}\n\n\t// indices\n\n\tfor ( iy = 0; iy < heightSegments; iy ++ ) {\n\n\t\tfor ( ix = 0; ix < widthSegments; ix ++ ) {\n\n\t\t\tvar a = grid[ iy ][ ix + 1 ];\n\t\t\tvar b = grid[ iy ][ ix ];\n\t\t\tvar c = grid[ iy + 1 ][ ix ];\n\t\t\tvar d = grid[ iy + 1 ][ ix + 1 ];\n\n\t\t\tif ( iy !== 0 || thetaStart > 0 ) indices.push( a, b, d );\n\t\t\tif ( iy !== heightSegments - 1 || thetaEnd < Math.PI ) indices.push( b, c, d );\n\n\t\t}\n\n\t}\n\n\t// build geometry\n\n\tthis.setIndex( indices );\n\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n}\n\nSphereBufferGeometry.prototype = Object.create( BufferGeometry.prototype );\nSphereBufferGeometry.prototype.constructor = SphereBufferGeometry;\n\n/**\n * @author Kaleb Murphy\n * @author Mugen87 / https://github.com/Mugen87\n */\n\n// RingGeometry\n\nfunction RingGeometry( innerRadius, outerRadius, thetaSegments, phiSegments, thetaStart, thetaLength ) {\n\n\tGeometry.call( this );\n\n\tthis.type = 'RingGeometry';\n\n\tthis.parameters = {\n\t\tinnerRadius: innerRadius,\n\t\touterRadius: outerRadius,\n\t\tthetaSegments: thetaSegments,\n\t\tphiSegments: phiSegments,\n\t\tthetaStart: thetaStart,\n\t\tthetaLength: thetaLength\n\t};\n\n\tthis.fromBufferGeometry( new RingBufferGeometry( innerRadius, outerRadius, thetaSegments, phiSegments, thetaStart, thetaLength ) );\n\tthis.mergeVertices();\n\n}\n\nRingGeometry.prototype = Object.create( Geometry.prototype );\nRingGeometry.prototype.constructor = RingGeometry;\n\n// RingBufferGeometry\n\nfunction RingBufferGeometry( innerRadius, outerRadius, thetaSegments, phiSegments, thetaStart, thetaLength ) {\n\n\tBufferGeometry.call( this );\n\n\tthis.type = 'RingBufferGeometry';\n\n\tthis.parameters = {\n\t\tinnerRadius: innerRadius,\n\t\touterRadius: outerRadius,\n\t\tthetaSegments: thetaSegments,\n\t\tphiSegments: phiSegments,\n\t\tthetaStart: thetaStart,\n\t\tthetaLength: thetaLength\n\t};\n\n\tinnerRadius = innerRadius || 0.5;\n\touterRadius = outerRadius || 1;\n\n\tthetaStart = thetaStart !== undefined ? thetaStart : 0;\n\tthetaLength = thetaLength !== undefined ? thetaLength : Math.PI * 2;\n\n\tthetaSegments = thetaSegments !== undefined ? Math.max( 3, thetaSegments ) : 8;\n\tphiSegments = phiSegments !== undefined ? Math.max( 1, phiSegments ) : 1;\n\n\t// buffers\n\n\tvar indices = [];\n\tvar vertices = [];\n\tvar normals = [];\n\tvar uvs = [];\n\n\t// some helper variables\n\n\tvar segment;\n\tvar radius = innerRadius;\n\tvar radiusStep = ( ( outerRadius - innerRadius ) / phiSegments );\n\tvar vertex = new Vector3();\n\tvar uv = new Vector2();\n\tvar j, i;\n\n\t// generate vertices, normals and uvs\n\n\tfor ( j = 0; j <= phiSegments; j ++ ) {\n\n\t\tfor ( i = 0; i <= thetaSegments; i ++ ) {\n\n\t\t\t// values are generate from the inside of the ring to the outside\n\n\t\t\tsegment = thetaStart + i / thetaSegments * thetaLength;\n\n\t\t\t// vertex\n\n\t\t\tvertex.x = radius * Math.cos( segment );\n\t\t\tvertex.y = radius * Math.sin( segment );\n\n\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t// normal\n\n\t\t\tnormals.push( 0, 0, 1 );\n\n\t\t\t// uv\n\n\t\t\tuv.x = ( vertex.x / outerRadius + 1 ) / 2;\n\t\t\tuv.y = ( vertex.y / outerRadius + 1 ) / 2;\n\n\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t}\n\n\t\t// increase the radius for next row of vertices\n\n\t\tradius += radiusStep;\n\n\t}\n\n\t// indices\n\n\tfor ( j = 0; j < phiSegments; j ++ ) {\n\n\t\tvar thetaSegmentLevel = j * ( thetaSegments + 1 );\n\n\t\tfor ( i = 0; i < thetaSegments; i ++ ) {\n\n\t\t\tsegment = i + thetaSegmentLevel;\n\n\t\t\tvar a = segment;\n\t\t\tvar b = segment + thetaSegments + 1;\n\t\t\tvar c = segment + thetaSegments + 2;\n\t\t\tvar d = segment + 1;\n\n\t\t\t// faces\n\n\t\t\tindices.push( a, b, d );\n\t\t\tindices.push( b, c, d );\n\n\t\t}\n\n\t}\n\n\t// build geometry\n\n\tthis.setIndex( indices );\n\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n}\n\nRingBufferGeometry.prototype = Object.create( BufferGeometry.prototype );\nRingBufferGeometry.prototype.constructor = RingBufferGeometry;\n\n/**\n * @author zz85 / https://github.com/zz85\n * @author bhouston / http://clara.io\n * @author Mugen87 / https://github.com/Mugen87\n */\n\n// LatheGeometry\n\nfunction LatheGeometry( points, segments, phiStart, phiLength ) {\n\n\tGeometry.call( this );\n\n\tthis.type = 'LatheGeometry';\n\n\tthis.parameters = {\n\t\tpoints: points,\n\t\tsegments: segments,\n\t\tphiStart: phiStart,\n\t\tphiLength: phiLength\n\t};\n\n\tthis.fromBufferGeometry( new LatheBufferGeometry( points, segments, phiStart, phiLength ) );\n\tthis.mergeVertices();\n\n}\n\nLatheGeometry.prototype = Object.create( Geometry.prototype );\nLatheGeometry.prototype.constructor = LatheGeometry;\n\n// LatheBufferGeometry\n\nfunction LatheBufferGeometry( points, segments, phiStart, phiLength ) {\n\n\tBufferGeometry.call( this );\n\n\tthis.type = 'LatheBufferGeometry';\n\n\tthis.parameters = {\n\t\tpoints: points,\n\t\tsegments: segments,\n\t\tphiStart: phiStart,\n\t\tphiLength: phiLength\n\t};\n\n\tsegments = Math.floor( segments ) || 12;\n\tphiStart = phiStart || 0;\n\tphiLength = phiLength || Math.PI * 2;\n\n\t// clamp phiLength so it's in range of [ 0, 2PI ]\n\n\tphiLength = MathUtils.clamp( phiLength, 0, Math.PI * 2 );\n\n\n\t// buffers\n\n\tvar indices = [];\n\tvar vertices = [];\n\tvar uvs = [];\n\n\t// helper variables\n\n\tvar base;\n\tvar inverseSegments = 1.0 / segments;\n\tvar vertex = new Vector3();\n\tvar uv = new Vector2();\n\tvar i, j;\n\n\t// generate vertices and uvs\n\n\tfor ( i = 0; i <= segments; i ++ ) {\n\n\t\tvar phi = phiStart + i * inverseSegments * phiLength;\n\n\t\tvar sin = Math.sin( phi );\n\t\tvar cos = Math.cos( phi );\n\n\t\tfor ( j = 0; j <= ( points.length - 1 ); j ++ ) {\n\n\t\t\t// vertex\n\n\t\t\tvertex.x = points[ j ].x * sin;\n\t\t\tvertex.y = points[ j ].y;\n\t\t\tvertex.z = points[ j ].x * cos;\n\n\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t// uv\n\n\t\t\tuv.x = i / segments;\n\t\t\tuv.y = j / ( points.length - 1 );\n\n\t\t\tuvs.push( uv.x, uv.y );\n\n\n\t\t}\n\n\t}\n\n\t// indices\n\n\tfor ( i = 0; i < segments; i ++ ) {\n\n\t\tfor ( j = 0; j < ( points.length - 1 ); j ++ ) {\n\n\t\t\tbase = j + i * points.length;\n\n\t\t\tvar a = base;\n\t\t\tvar b = base + points.length;\n\t\t\tvar c = base + points.length + 1;\n\t\t\tvar d = base + 1;\n\n\t\t\t// faces\n\n\t\t\tindices.push( a, b, d );\n\t\t\tindices.push( b, c, d );\n\n\t\t}\n\n\t}\n\n\t// build geometry\n\n\tthis.setIndex( indices );\n\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t// generate normals\n\n\tthis.computeVertexNormals();\n\n\t// if the geometry is closed, we need to average the normals along the seam.\n\t// because the corresponding vertices are identical (but still have different UVs).\n\n\tif ( phiLength === Math.PI * 2 ) {\n\n\t\tvar normals = this.attributes.normal.array;\n\t\tvar n1 = new Vector3();\n\t\tvar n2 = new Vector3();\n\t\tvar n = new Vector3();\n\n\t\t// this is the buffer offset for the last line of vertices\n\n\t\tbase = segments * points.length * 3;\n\n\t\tfor ( i = 0, j = 0; i < points.length; i ++, j += 3 ) {\n\n\t\t\t// select the normal of the vertex in the first line\n\n\t\t\tn1.x = normals[ j + 0 ];\n\t\t\tn1.y = normals[ j + 1 ];\n\t\t\tn1.z = normals[ j + 2 ];\n\n\t\t\t// select the normal of the vertex in the last line\n\n\t\t\tn2.x = normals[ base + j + 0 ];\n\t\t\tn2.y = normals[ base + j + 1 ];\n\t\t\tn2.z = normals[ base + j + 2 ];\n\n\t\t\t// average normals\n\n\t\t\tn.addVectors( n1, n2 ).normalize();\n\n\t\t\t// assign the new values to both normals\n\n\t\t\tnormals[ j + 0 ] = normals[ base + j + 0 ] = n.x;\n\t\t\tnormals[ j + 1 ] = normals[ base + j + 1 ] = n.y;\n\t\t\tnormals[ j + 2 ] = normals[ base + j + 2 ] = n.z;\n\n\t\t}\n\n\t}\n\n}\n\nLatheBufferGeometry.prototype = Object.create( BufferGeometry.prototype );\nLatheBufferGeometry.prototype.constructor = LatheBufferGeometry;\n\n/**\n * @author jonobr1 / http://jonobr1.com\n * @author Mugen87 / https://github.com/Mugen87\n */\n\n// ShapeGeometry\n\nfunction ShapeGeometry( shapes, curveSegments ) {\n\n\tGeometry.call( this );\n\n\tthis.type = 'ShapeGeometry';\n\n\tif ( typeof curveSegments === 'object' ) {\n\n\t\tconsole.warn( 'THREE.ShapeGeometry: Options parameter has been removed.' );\n\n\t\tcurveSegments = curveSegments.curveSegments;\n\n\t}\n\n\tthis.parameters = {\n\t\tshapes: shapes,\n\t\tcurveSegments: curveSegments\n\t};\n\n\tthis.fromBufferGeometry( new ShapeBufferGeometry( shapes, curveSegments ) );\n\tthis.mergeVertices();\n\n}\n\nShapeGeometry.prototype = Object.create( Geometry.prototype );\nShapeGeometry.prototype.constructor = ShapeGeometry;\n\nShapeGeometry.prototype.toJSON = function () {\n\n\tvar data = Geometry.prototype.toJSON.call( this );\n\n\tvar shapes = this.parameters.shapes;\n\n\treturn toJSON$1( shapes, data );\n\n};\n\n// ShapeBufferGeometry\n\nfunction ShapeBufferGeometry( shapes, curveSegments ) {\n\n\tBufferGeometry.call( this );\n\n\tthis.type = 'ShapeBufferGeometry';\n\n\tthis.parameters = {\n\t\tshapes: shapes,\n\t\tcurveSegments: curveSegments\n\t};\n\n\tcurveSegments = curveSegments || 12;\n\n\t// buffers\n\n\tvar indices = [];\n\tvar vertices = [];\n\tvar normals = [];\n\tvar uvs = [];\n\n\t// helper variables\n\n\tvar groupStart = 0;\n\tvar groupCount = 0;\n\n\t// allow single and array values for \"shapes\" parameter\n\n\tif ( Array.isArray( shapes ) === false ) {\n\n\t\taddShape( shapes );\n\n\t} else {\n\n\t\tfor ( var i = 0; i < shapes.length; i ++ ) {\n\n\t\t\taddShape( shapes[ i ] );\n\n\t\t\tthis.addGroup( groupStart, groupCount, i ); // enables MultiMaterial support\n\n\t\t\tgroupStart += groupCount;\n\t\t\tgroupCount = 0;\n\n\t\t}\n\n\t}\n\n\t// build geometry\n\n\tthis.setIndex( indices );\n\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\n\t// helper functions\n\n\tfunction addShape( shape ) {\n\n\t\tvar i, l, shapeHole;\n\n\t\tvar indexOffset = vertices.length / 3;\n\t\tvar points = shape.extractPoints( curveSegments );\n\n\t\tvar shapeVertices = points.shape;\n\t\tvar shapeHoles = points.holes;\n\n\t\t// check direction of vertices\n\n\t\tif ( ShapeUtils.isClockWise( shapeVertices ) === false ) {\n\n\t\t\tshapeVertices = shapeVertices.reverse();\n\n\t\t}\n\n\t\tfor ( i = 0, l = shapeHoles.length; i < l; i ++ ) {\n\n\t\t\tshapeHole = shapeHoles[ i ];\n\n\t\t\tif ( ShapeUtils.isClockWise( shapeHole ) === true ) {\n\n\t\t\t\tshapeHoles[ i ] = shapeHole.reverse();\n\n\t\t\t}\n\n\t\t}\n\n\t\tvar faces = ShapeUtils.triangulateShape( shapeVertices, shapeHoles );\n\n\t\t// join vertices of inner and outer paths to a single array\n\n\t\tfor ( i = 0, l = shapeHoles.length; i < l; i ++ ) {\n\n\t\t\tshapeHole = shapeHoles[ i ];\n\t\t\tshapeVertices = shapeVertices.concat( shapeHole );\n\n\t\t}\n\n\t\t// vertices, normals, uvs\n\n\t\tfor ( i = 0, l = shapeVertices.length; i < l; i ++ ) {\n\n\t\t\tvar vertex = shapeVertices[ i ];\n\n\t\t\tvertices.push( vertex.x, vertex.y, 0 );\n\t\t\tnormals.push( 0, 0, 1 );\n\t\t\tuvs.push( vertex.x, vertex.y ); // world uvs\n\n\t\t}\n\n\t\t// incides\n\n\t\tfor ( i = 0, l = faces.length; i < l; i ++ ) {\n\n\t\t\tvar face = faces[ i ];\n\n\t\t\tvar a = face[ 0 ] + indexOffset;\n\t\t\tvar b = face[ 1 ] + indexOffset;\n\t\t\tvar c = face[ 2 ] + indexOffset;\n\n\t\t\tindices.push( a, b, c );\n\t\t\tgroupCount += 3;\n\n\t\t}\n\n\t}\n\n}\n\nShapeBufferGeometry.prototype = Object.create( BufferGeometry.prototype );\nShapeBufferGeometry.prototype.constructor = ShapeBufferGeometry;\n\nShapeBufferGeometry.prototype.toJSON = function () {\n\n\tvar data = BufferGeometry.prototype.toJSON.call( this );\n\n\tvar shapes = this.parameters.shapes;\n\n\treturn toJSON$1( shapes, data );\n\n};\n\n//\n\nfunction toJSON$1( shapes, data ) {\n\n\tdata.shapes = [];\n\n\tif ( Array.isArray( shapes ) ) {\n\n\t\tfor ( var i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\tvar shape = shapes[ i ];\n\n\t\t\tdata.shapes.push( shape.uuid );\n\n\t\t}\n\n\t} else {\n\n\t\tdata.shapes.push( shapes.uuid );\n\n\t}\n\n\treturn data;\n\n}\n\n/**\n * @author WestLangley / http://github.com/WestLangley\n * @author Mugen87 / https://github.com/Mugen87\n */\n\nfunction EdgesGeometry( geometry, thresholdAngle ) {\n\n\tBufferGeometry.call( this );\n\n\tthis.type = 'EdgesGeometry';\n\n\tthis.parameters = {\n\t\tthresholdAngle: thresholdAngle\n\t};\n\n\tthresholdAngle = ( thresholdAngle !== undefined ) ? thresholdAngle : 1;\n\n\t// buffer\n\n\tvar vertices = [];\n\n\t// helper variables\n\n\tvar thresholdDot = Math.cos( MathUtils.DEG2RAD * thresholdAngle );\n\tvar edge = [ 0, 0 ], edges = {}, edge1, edge2;\n\tvar key, keys = [ 'a', 'b', 'c' ];\n\n\t// prepare source geometry\n\n\tvar geometry2;\n\n\tif ( geometry.isBufferGeometry ) {\n\n\t\tgeometry2 = new Geometry();\n\t\tgeometry2.fromBufferGeometry( geometry );\n\n\t} else {\n\n\t\tgeometry2 = geometry.clone();\n\n\t}\n\n\tgeometry2.mergeVertices();\n\tgeometry2.computeFaceNormals();\n\n\tvar sourceVertices = geometry2.vertices;\n\tvar faces = geometry2.faces;\n\n\t// now create a data structure where each entry represents an edge with its adjoining faces\n\n\tfor ( var i = 0, l = faces.length; i < l; i ++ ) {\n\n\t\tvar face = faces[ i ];\n\n\t\tfor ( var j = 0; j < 3; j ++ ) {\n\n\t\t\tedge1 = face[ keys[ j ] ];\n\t\t\tedge2 = face[ keys[ ( j + 1 ) % 3 ] ];\n\t\t\tedge[ 0 ] = Math.min( edge1, edge2 );\n\t\t\tedge[ 1 ] = Math.max( edge1, edge2 );\n\n\t\t\tkey = edge[ 0 ] + ',' + edge[ 1 ];\n\n\t\t\tif ( edges[ key ] === undefined ) {\n\n\t\t\t\tedges[ key ] = { index1: edge[ 0 ], index2: edge[ 1 ], face1: i, face2: undefined };\n\n\t\t\t} else {\n\n\t\t\t\tedges[ key ].face2 = i;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t// generate vertices\n\n\tfor ( key in edges ) {\n\n\t\tvar e = edges[ key ];\n\n\t\t// an edge is only rendered if the angle (in degrees) between the face normals of the adjoining faces exceeds this value. default = 1 degree.\n\n\t\tif ( e.face2 === undefined || faces[ e.face1 ].normal.dot( faces[ e.face2 ].normal ) <= thresholdDot ) {\n\n\t\t\tvar vertex = sourceVertices[ e.index1 ];\n\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\tvertex = sourceVertices[ e.index2 ];\n\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t}\n\n\t}\n\n\t// build geometry\n\n\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\n}\n\nEdgesGeometry.prototype = Object.create( BufferGeometry.prototype );\nEdgesGeometry.prototype.constructor = EdgesGeometry;\n\n/**\n * @author mrdoob / http://mrdoob.com/\n * @author Mugen87 / https://github.com/Mugen87\n */\n\n// CylinderGeometry\n\nfunction CylinderGeometry( radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength ) {\n\n\tGeometry.call( this );\n\n\tthis.type = 'CylinderGeometry';\n\n\tthis.parameters = {\n\t\tradiusTop: radiusTop,\n\t\tradiusBottom: radiusBottom,\n\t\theight: height,\n\t\tradialSegments: radialSegments,\n\t\theightSegments: heightSegments,\n\t\topenEnded: openEnded,\n\t\tthetaStart: thetaStart,\n\t\tthetaLength: thetaLength\n\t};\n\n\tthis.fromBufferGeometry( new CylinderBufferGeometry( radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength ) );\n\tthis.mergeVertices();\n\n}\n\nCylinderGeometry.prototype = Object.create( Geometry.prototype );\nCylinderGeometry.prototype.constructor = CylinderGeometry;\n\n// CylinderBufferGeometry\n\nfunction CylinderBufferGeometry( radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength ) {\n\n\tBufferGeometry.call( this );\n\n\tthis.type = 'CylinderBufferGeometry';\n\n\tthis.parameters = {\n\t\tradiusTop: radiusTop,\n\t\tradiusBottom: radiusBottom,\n\t\theight: height,\n\t\tradialSegments: radialSegments,\n\t\theightSegments: heightSegments,\n\t\topenEnded: openEnded,\n\t\tthetaStart: thetaStart,\n\t\tthetaLength: thetaLength\n\t};\n\n\tvar scope = this;\n\n\tradiusTop = radiusTop !== undefined ? radiusTop : 1;\n\tradiusBottom = radiusBottom !== undefined ? radiusBottom : 1;\n\theight = height || 1;\n\n\tradialSegments = Math.floor( radialSegments ) || 8;\n\theightSegments = Math.floor( heightSegments ) || 1;\n\n\topenEnded = openEnded !== undefined ? openEnded : false;\n\tthetaStart = thetaStart !== undefined ? thetaStart : 0.0;\n\tthetaLength = thetaLength !== undefined ? thetaLength : Math.PI * 2;\n\n\t// buffers\n\n\tvar indices = [];\n\tvar vertices = [];\n\tvar normals = [];\n\tvar uvs = [];\n\n\t// helper variables\n\n\tvar index = 0;\n\tvar indexArray = [];\n\tvar halfHeight = height / 2;\n\tvar groupStart = 0;\n\n\t// generate geometry\n\n\tgenerateTorso();\n\n\tif ( openEnded === false ) {\n\n\t\tif ( radiusTop > 0 ) generateCap( true );\n\t\tif ( radiusBottom > 0 ) generateCap( false );\n\n\t}\n\n\t// build geometry\n\n\tthis.setIndex( indices );\n\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\tfunction generateTorso() {\n\n\t\tvar x, y;\n\t\tvar normal = new Vector3();\n\t\tvar vertex = new Vector3();\n\n\t\tvar groupCount = 0;\n\n\t\t// this will be used to calculate the normal\n\t\tvar slope = ( radiusBottom - radiusTop ) / height;\n\n\t\t// generate vertices, normals and uvs\n\n\t\tfor ( y = 0; y <= heightSegments; y ++ ) {\n\n\t\t\tvar indexRow = [];\n\n\t\t\tvar v = y / heightSegments;\n\n\t\t\t// calculate the radius of the current row\n\n\t\t\tvar radius = v * ( radiusBottom - radiusTop ) + radiusTop;\n\n\t\t\tfor ( x = 0; x <= radialSegments; x ++ ) {\n\n\t\t\t\tvar u = x / radialSegments;\n\n\t\t\t\tvar theta = u * thetaLength + thetaStart;\n\n\t\t\t\tvar sinTheta = Math.sin( theta );\n\t\t\t\tvar cosTheta = Math.cos( theta );\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = radius * sinTheta;\n\t\t\t\tvertex.y = - v * height + halfHeight;\n\t\t\t\tvertex.z = radius * cosTheta;\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormal.set( sinTheta, slope, cosTheta ).normalize();\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t// uv\n\n\t\t\t\tuvs.push( u, 1 - v );\n\n\t\t\t\t// save index of vertex in respective row\n\n\t\t\t\tindexRow.push( index ++ );\n\n\t\t\t}\n\n\t\t\t// now save vertices of the row in our index array\n\n\t\t\tindexArray.push( indexRow );\n\n\t\t}\n\n\t\t// generate indices\n\n\t\tfor ( x = 0; x < radialSegments; x ++ ) {\n\n\t\t\tfor ( y = 0; y < heightSegments; y ++ ) {\n\n\t\t\t\t// we use the index array to access the correct indices\n\n\t\t\t\tvar a = indexArray[ y ][ x ];\n\t\t\t\tvar b = indexArray[ y + 1 ][ x ];\n\t\t\t\tvar c = indexArray[ y + 1 ][ x + 1 ];\n\t\t\t\tvar d = indexArray[ y ][ x + 1 ];\n\n\t\t\t\t// faces\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( b, c, d );\n\n\t\t\t\t// update group counter\n\n\t\t\t\tgroupCount += 6;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// add a group to the geometry. this will ensure multi material support\n\n\t\tscope.addGroup( groupStart, groupCount, 0 );\n\n\t\t// calculate new start value for groups\n\n\t\tgroupStart += groupCount;\n\n\t}\n\n\tfunction generateCap( top ) {\n\n\t\tvar x, centerIndexStart, centerIndexEnd;\n\n\t\tvar uv = new Vector2();\n\t\tvar vertex = new Vector3();\n\n\t\tvar groupCount = 0;\n\n\t\tvar radius = ( top === true ) ? radiusTop : radiusBottom;\n\t\tvar sign = ( top === true ) ? 1 : - 1;\n\n\t\t// save the index of the first center vertex\n\t\tcenterIndexStart = index;\n\n\t\t// first we generate the center vertex data of the cap.\n\t\t// because the geometry needs one set of uvs per face,\n\t\t// we must generate a center vertex per face/segment\n\n\t\tfor ( x = 1; x <= radialSegments; x ++ ) {\n\n\t\t\t// vertex\n\n\t\t\tvertices.push( 0, halfHeight * sign, 0 );\n\n\t\t\t// normal\n\n\t\t\tnormals.push( 0, sign, 0 );\n\n\t\t\t// uv\n\n\t\t\tuvs.push( 0.5, 0.5 );\n\n\t\t\t// increase index\n\n\t\t\tindex ++;\n\n\t\t}\n\n\t\t// save the index of the last center vertex\n\n\t\tcenterIndexEnd = index;\n\n\t\t// now we generate the surrounding vertices, normals and uvs\n\n\t\tfor ( x = 0; x <= radialSegments; x ++ ) {\n\n\t\t\tvar u = x / radialSegments;\n\t\t\tvar theta = u * thetaLength + thetaStart;\n\n\t\t\tvar cosTheta = Math.cos( theta );\n\t\t\tvar sinTheta = Math.sin( theta );\n\n\t\t\t// vertex\n\n\t\t\tvertex.x = radius * sinTheta;\n\t\t\tvertex.y = halfHeight * sign;\n\t\t\tvertex.z = radius * cosTheta;\n\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t// normal\n\n\t\t\tnormals.push( 0, sign, 0 );\n\n\t\t\t// uv\n\n\t\t\tuv.x = ( cosTheta * 0.5 ) + 0.5;\n\t\t\tuv.y = ( sinTheta * 0.5 * sign ) + 0.5;\n\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t\t// increase index\n\n\t\t\tindex ++;\n\n\t\t}\n\n\t\t// generate indices\n\n\t\tfor ( x = 0; x < radialSegments; x ++ ) {\n\n\t\t\tvar c = centerIndexStart + x;\n\t\t\tvar i = centerIndexEnd + x;\n\n\t\t\tif ( top === true ) {\n\n\t\t\t\t// face top\n\n\t\t\t\tindices.push( i, i + 1, c );\n\n\t\t\t} else {\n\n\t\t\t\t// face bottom\n\n\t\t\t\tindices.push( i + 1, i, c );\n\n\t\t\t}\n\n\t\t\tgroupCount += 3;\n\n\t\t}\n\n\t\t// add a group to the geometry. this will ensure multi material support\n\n\t\tscope.addGroup( groupStart, groupCount, top === true ? 1 : 2 );\n\n\t\t// calculate new start value for groups\n\n\t\tgroupStart += groupCount;\n\n\t}\n\n}\n\nCylinderBufferGeometry.prototype = Object.create( BufferGeometry.prototype );\nCylinderBufferGeometry.prototype.constructor = CylinderBufferGeometry;\n\n/**\n * @author abelnation / http://github.com/abelnation\n */\n\n// ConeGeometry\n\nfunction ConeGeometry( radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength ) {\n\n\tCylinderGeometry.call( this, 0, radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength );\n\n\tthis.type = 'ConeGeometry';\n\n\tthis.parameters = {\n\t\tradius: radius,\n\t\theight: height,\n\t\tradialSegments: radialSegments,\n\t\theightSegments: heightSegments,\n\t\topenEnded: openEnded,\n\t\tthetaStart: thetaStart,\n\t\tthetaLength: thetaLength\n\t};\n\n}\n\nConeGeometry.prototype = Object.create( CylinderGeometry.prototype );\nConeGeometry.prototype.constructor = ConeGeometry;\n\n// ConeBufferGeometry\n\nfunction ConeBufferGeometry( radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength ) {\n\n\tCylinderBufferGeometry.call( this, 0, radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength );\n\n\tthis.type = 'ConeBufferGeometry';\n\n\tthis.parameters = {\n\t\tradius: radius,\n\t\theight: height,\n\t\tradialSegments: radialSegments,\n\t\theightSegments: heightSegments,\n\t\topenEnded: openEnded,\n\t\tthetaStart: thetaStart,\n\t\tthetaLength: thetaLength\n\t};\n\n}\n\nConeBufferGeometry.prototype = Object.create( CylinderBufferGeometry.prototype );\nConeBufferGeometry.prototype.constructor = ConeBufferGeometry;\n\n/**\n * @author benaadams / https://twitter.com/ben_a_adams\n * @author Mugen87 / https://github.com/Mugen87\n * @author hughes\n */\n\n// CircleGeometry\n\nfunction CircleGeometry( radius, segments, thetaStart, thetaLength ) {\n\n\tGeometry.call( this );\n\n\tthis.type = 'CircleGeometry';\n\n\tthis.parameters = {\n\t\tradius: radius,\n\t\tsegments: segments,\n\t\tthetaStart: thetaStart,\n\t\tthetaLength: thetaLength\n\t};\n\n\tthis.fromBufferGeometry( new CircleBufferGeometry( radius, segments, thetaStart, thetaLength ) );\n\tthis.mergeVertices();\n\n}\n\nCircleGeometry.prototype = Object.create( Geometry.prototype );\nCircleGeometry.prototype.constructor = CircleGeometry;\n\n// CircleBufferGeometry\n\nfunction CircleBufferGeometry( radius, segments, thetaStart, thetaLength ) {\n\n\tBufferGeometry.call( this );\n\n\tthis.type = 'CircleBufferGeometry';\n\n\tthis.parameters = {\n\t\tradius: radius,\n\t\tsegments: segments,\n\t\tthetaStart: thetaStart,\n\t\tthetaLength: thetaLength\n\t};\n\n\tradius = radius || 1;\n\tsegments = segments !== undefined ? Math.max( 3, segments ) : 8;\n\n\tthetaStart = thetaStart !== undefined ? thetaStart : 0;\n\tthetaLength = thetaLength !== undefined ? thetaLength : Math.PI * 2;\n\n\t// buffers\n\n\tvar indices = [];\n\tvar vertices = [];\n\tvar normals = [];\n\tvar uvs = [];\n\n\t// helper variables\n\n\tvar i, s;\n\tvar vertex = new Vector3();\n\tvar uv = new Vector2();\n\n\t// center point\n\n\tvertices.push( 0, 0, 0 );\n\tnormals.push( 0, 0, 1 );\n\tuvs.push( 0.5, 0.5 );\n\n\tfor ( s = 0, i = 3; s <= segments; s ++, i += 3 ) {\n\n\t\tvar segment = thetaStart + s / segments * thetaLength;\n\n\t\t// vertex\n\n\t\tvertex.x = radius * Math.cos( segment );\n\t\tvertex.y = radius * Math.sin( segment );\n\n\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t// normal\n\n\t\tnormals.push( 0, 0, 1 );\n\n\t\t// uvs\n\n\t\tuv.x = ( vertices[ i ] / radius + 1 ) / 2;\n\t\tuv.y = ( vertices[ i + 1 ] / radius + 1 ) / 2;\n\n\t\tuvs.push( uv.x, uv.y );\n\n\t}\n\n\t// indices\n\n\tfor ( i = 1; i <= segments; i ++ ) {\n\n\t\tindices.push( i, i + 1, 0 );\n\n\t}\n\n\t// build geometry\n\n\tthis.setIndex( indices );\n\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n}\n\nCircleBufferGeometry.prototype = Object.create( BufferGeometry.prototype );\nCircleBufferGeometry.prototype.constructor = CircleBufferGeometry;\n\n\n\nvar Geometries = /*#__PURE__*/Object.freeze({\n\t__proto__: null,\n\tWireframeGeometry: WireframeGeometry,\n\tParametricGeometry: ParametricGeometry,\n\tParametricBufferGeometry: ParametricBufferGeometry,\n\tTetrahedronGeometry: TetrahedronGeometry,\n\tTetrahedronBufferGeometry: TetrahedronBufferGeometry,\n\tOctahedronGeometry: OctahedronGeometry,\n\tOctahedronBufferGeometry: OctahedronBufferGeometry,\n\tIcosahedronGeometry: IcosahedronGeometry,\n\tIcosahedronBufferGeometry: IcosahedronBufferGeometry,\n\tDodecahedronGeometry: DodecahedronGeometry,\n\tDodecahedronBufferGeometry: DodecahedronBufferGeometry,\n\tPolyhedronGeometry: PolyhedronGeometry,\n\tPolyhedronBufferGeometry: PolyhedronBufferGeometry,\n\tTubeGeometry: TubeGeometry,\n\tTubeBufferGeometry: TubeBufferGeometry,\n\tTorusKnotGeometry: TorusKnotGeometry,\n\tTorusKnotBufferGeometry: TorusKnotBufferGeometry,\n\tTorusGeometry: TorusGeometry,\n\tTorusBufferGeometry: TorusBufferGeometry,\n\tTextGeometry: TextGeometry,\n\tTextBufferGeometry: TextBufferGeometry,\n\tSphereGeometry: SphereGeometry,\n\tSphereBufferGeometry: SphereBufferGeometry,\n\tRingGeometry: RingGeometry,\n\tRingBufferGeometry: RingBufferGeometry,\n\tPlaneGeometry: PlaneGeometry,\n\tPlaneBufferGeometry: PlaneBufferGeometry,\n\tLatheGeometry: LatheGeometry,\n\tLatheBufferGeometry: LatheBufferGeometry,\n\tShapeGeometry: ShapeGeometry,\n\tShapeBufferGeometry: ShapeBufferGeometry,\n\tExtrudeGeometry: ExtrudeGeometry,\n\tExtrudeBufferGeometry: ExtrudeBufferGeometry,\n\tEdgesGeometry: EdgesGeometry,\n\tConeGeometry: ConeGeometry,\n\tConeBufferGeometry: ConeBufferGeometry,\n\tCylinderGeometry: CylinderGeometry,\n\tCylinderBufferGeometry: CylinderBufferGeometry,\n\tCircleGeometry: CircleGeometry,\n\tCircleBufferGeometry: CircleBufferGeometry,\n\tBoxGeometry: BoxGeometry,\n\tBoxBufferGeometry: BoxBufferGeometry\n});\n\n/**\n * @author mrdoob / http://mrdoob.com/\n *\n * parameters = {\n * color: \n * }\n */\n\nfunction ShadowMaterial( parameters ) {\n\n\tMaterial.call( this );\n\n\tthis.type = 'ShadowMaterial';\n\n\tthis.color = new Color( 0x000000 );\n\tthis.transparent = true;\n\n\tthis.setValues( parameters );\n\n}\n\nShadowMaterial.prototype = Object.create( Material.prototype );\nShadowMaterial.prototype.constructor = ShadowMaterial;\n\nShadowMaterial.prototype.isShadowMaterial = true;\n\nShadowMaterial.prototype.copy = function ( source ) {\n\n\tMaterial.prototype.copy.call( this, source );\n\n\tthis.color.copy( source.color );\n\n\treturn this;\n\n};\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction RawShaderMaterial( parameters ) {\n\n\tShaderMaterial.call( this, parameters );\n\n\tthis.type = 'RawShaderMaterial';\n\n}\n\nRawShaderMaterial.prototype = Object.create( ShaderMaterial.prototype );\nRawShaderMaterial.prototype.constructor = RawShaderMaterial;\n\nRawShaderMaterial.prototype.isRawShaderMaterial = true;\n\n/**\n * @author WestLangley / http://github.com/WestLangley\n *\n * parameters = {\n * color: ,\n * roughness: ,\n * metalness: ,\n * opacity: ,\n *\n * map: new THREE.Texture( ),\n *\n * lightMap: new THREE.Texture( ),\n * lightMapIntensity: \n *\n * aoMap: new THREE.Texture( ),\n * aoMapIntensity: \n *\n * emissive: ,\n * emissiveIntensity: \n * emissiveMap: new THREE.Texture( ),\n *\n * bumpMap: new THREE.Texture( ),\n * bumpScale: ,\n *\n * normalMap: new THREE.Texture( ),\n * normalMapType: THREE.TangentSpaceNormalMap,\n * normalScale: ,\n *\n * displacementMap: new THREE.Texture( ),\n * displacementScale: ,\n * displacementBias: ,\n *\n * roughnessMap: new THREE.Texture( ),\n *\n * metalnessMap: new THREE.Texture( ),\n *\n * alphaMap: new THREE.Texture( ),\n *\n * envMap: new THREE.CubeTexture( [posx, negx, posy, negy, posz, negz] ),\n * envMapIntensity: \n *\n * refractionRatio: ,\n *\n * wireframe: ,\n * wireframeLinewidth: ,\n *\n * skinning: ,\n * morphTargets: ,\n * morphNormals: \n * }\n */\n\nfunction MeshStandardMaterial( parameters ) {\n\n\tMaterial.call( this );\n\n\tthis.defines = { 'STANDARD': '' };\n\n\tthis.type = 'MeshStandardMaterial';\n\n\tthis.color = new Color( 0xffffff ); // diffuse\n\tthis.roughness = 1.0;\n\tthis.metalness = 0.0;\n\n\tthis.map = null;\n\n\tthis.lightMap = null;\n\tthis.lightMapIntensity = 1.0;\n\n\tthis.aoMap = null;\n\tthis.aoMapIntensity = 1.0;\n\n\tthis.emissive = new Color( 0x000000 );\n\tthis.emissiveIntensity = 1.0;\n\tthis.emissiveMap = null;\n\n\tthis.bumpMap = null;\n\tthis.bumpScale = 1;\n\n\tthis.normalMap = null;\n\tthis.normalMapType = TangentSpaceNormalMap;\n\tthis.normalScale = new Vector2( 1, 1 );\n\n\tthis.displacementMap = null;\n\tthis.displacementScale = 1;\n\tthis.displacementBias = 0;\n\n\tthis.roughnessMap = null;\n\n\tthis.metalnessMap = null;\n\n\tthis.alphaMap = null;\n\n\tthis.envMap = null;\n\tthis.envMapIntensity = 1.0;\n\n\tthis.refractionRatio = 0.98;\n\n\tthis.wireframe = false;\n\tthis.wireframeLinewidth = 1;\n\tthis.wireframeLinecap = 'round';\n\tthis.wireframeLinejoin = 'round';\n\n\tthis.skinning = false;\n\tthis.morphTargets = false;\n\tthis.morphNormals = false;\n\n\tthis.setValues( parameters );\n\n}\n\nMeshStandardMaterial.prototype = Object.create( Material.prototype );\nMeshStandardMaterial.prototype.constructor = MeshStandardMaterial;\n\nMeshStandardMaterial.prototype.isMeshStandardMaterial = true;\n\nMeshStandardMaterial.prototype.copy = function ( source ) {\n\n\tMaterial.prototype.copy.call( this, source );\n\n\tthis.defines = { 'STANDARD': '' };\n\n\tthis.color.copy( source.color );\n\tthis.roughness = source.roughness;\n\tthis.metalness = source.metalness;\n\n\tthis.map = source.map;\n\n\tthis.lightMap = source.lightMap;\n\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\tthis.aoMap = source.aoMap;\n\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\tthis.emissive.copy( source.emissive );\n\tthis.emissiveMap = source.emissiveMap;\n\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\tthis.bumpMap = source.bumpMap;\n\tthis.bumpScale = source.bumpScale;\n\n\tthis.normalMap = source.normalMap;\n\tthis.normalMapType = source.normalMapType;\n\tthis.normalScale.copy( source.normalScale );\n\n\tthis.displacementMap = source.displacementMap;\n\tthis.displacementScale = source.displacementScale;\n\tthis.displacementBias = source.displacementBias;\n\n\tthis.roughnessMap = source.roughnessMap;\n\n\tthis.metalnessMap = source.metalnessMap;\n\n\tthis.alphaMap = source.alphaMap;\n\n\tthis.envMap = source.envMap;\n\tthis.envMapIntensity = source.envMapIntensity;\n\n\tthis.refractionRatio = source.refractionRatio;\n\n\tthis.wireframe = source.wireframe;\n\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\tthis.wireframeLinecap = source.wireframeLinecap;\n\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\tthis.skinning = source.skinning;\n\tthis.morphTargets = source.morphTargets;\n\tthis.morphNormals = source.morphNormals;\n\n\treturn this;\n\n};\n\n/**\n * @author WestLangley / http://github.com/WestLangley\n *\n * parameters = {\n * reflectivity: \n * clearcoat: \n * clearcoatRoughness: \n *\n * sheen: \n *\n * clearcoatNormalScale: ,\n * clearcoatNormalMap: new THREE.Texture( ),\n * }\n */\n\nfunction MeshPhysicalMaterial( parameters ) {\n\n\tMeshStandardMaterial.call( this );\n\n\tthis.defines = {\n\n\t\t'STANDARD': '',\n\t\t'PHYSICAL': ''\n\n\t};\n\n\tthis.type = 'MeshPhysicalMaterial';\n\n\tthis.reflectivity = 0.5; // maps to F0 = 0.04\n\n\tthis.clearcoat = 0.0;\n\tthis.clearcoatRoughness = 0.0;\n\n\tthis.sheen = null; // null will disable sheen bsdf\n\n\tthis.clearcoatNormalScale = new Vector2( 1, 1 );\n\tthis.clearcoatNormalMap = null;\n\n\tthis.transparency = 0.0;\n\n\tthis.setValues( parameters );\n\n}\n\nMeshPhysicalMaterial.prototype = Object.create( MeshStandardMaterial.prototype );\nMeshPhysicalMaterial.prototype.constructor = MeshPhysicalMaterial;\n\nMeshPhysicalMaterial.prototype.isMeshPhysicalMaterial = true;\n\nMeshPhysicalMaterial.prototype.copy = function ( source ) {\n\n\tMeshStandardMaterial.prototype.copy.call( this, source );\n\n\tthis.defines = {\n\n\t\t'STANDARD': '',\n\t\t'PHYSICAL': ''\n\n\t};\n\n\tthis.reflectivity = source.reflectivity;\n\n\tthis.clearcoat = source.clearcoat;\n\tthis.clearcoatRoughness = source.clearcoatRoughness;\n\n\tif ( source.sheen ) this.sheen = ( this.sheen || new Color() ).copy( source.sheen );\n\telse this.sheen = null;\n\n\tthis.clearcoatNormalMap = source.clearcoatNormalMap;\n\tthis.clearcoatNormalScale.copy( source.clearcoatNormalScale );\n\n\tthis.transparency = source.transparency;\n\n\treturn this;\n\n};\n\n/**\n * @author mrdoob / http://mrdoob.com/\n * @author alteredq / http://alteredqualia.com/\n *\n * parameters = {\n * color: ,\n * specular: ,\n * shininess: ,\n * opacity: ,\n *\n * map: new THREE.Texture( ),\n *\n * lightMap: new THREE.Texture( ),\n * lightMapIntensity: \n *\n * aoMap: new THREE.Texture( ),\n * aoMapIntensity: \n *\n * emissive: ,\n * emissiveIntensity: \n * emissiveMap: new THREE.Texture( ),\n *\n * bumpMap: new THREE.Texture( ),\n * bumpScale: ,\n *\n * normalMap: new THREE.Texture( ),\n * normalMapType: THREE.TangentSpaceNormalMap,\n * normalScale: ,\n *\n * displacementMap: new THREE.Texture( ),\n * displacementScale: ,\n * displacementBias: ,\n *\n * specularMap: new THREE.Texture( ),\n *\n * alphaMap: new THREE.Texture( ),\n *\n * envMap: new THREE.CubeTexture( [posx, negx, posy, negy, posz, negz] ),\n * combine: THREE.MultiplyOperation,\n * reflectivity: ,\n * refractionRatio: ,\n *\n * wireframe: ,\n * wireframeLinewidth: ,\n *\n * skinning: ,\n * morphTargets: ,\n * morphNormals: \n * }\n */\n\nfunction MeshPhongMaterial( parameters ) {\n\n\tMaterial.call( this );\n\n\tthis.type = 'MeshPhongMaterial';\n\n\tthis.color = new Color( 0xffffff ); // diffuse\n\tthis.specular = new Color( 0x111111 );\n\tthis.shininess = 30;\n\n\tthis.map = null;\n\n\tthis.lightMap = null;\n\tthis.lightMapIntensity = 1.0;\n\n\tthis.aoMap = null;\n\tthis.aoMapIntensity = 1.0;\n\n\tthis.emissive = new Color( 0x000000 );\n\tthis.emissiveIntensity = 1.0;\n\tthis.emissiveMap = null;\n\n\tthis.bumpMap = null;\n\tthis.bumpScale = 1;\n\n\tthis.normalMap = null;\n\tthis.normalMapType = TangentSpaceNormalMap;\n\tthis.normalScale = new Vector2( 1, 1 );\n\n\tthis.displacementMap = null;\n\tthis.displacementScale = 1;\n\tthis.displacementBias = 0;\n\n\tthis.specularMap = null;\n\n\tthis.alphaMap = null;\n\n\tthis.envMap = null;\n\tthis.combine = MultiplyOperation;\n\tthis.reflectivity = 1;\n\tthis.refractionRatio = 0.98;\n\n\tthis.wireframe = false;\n\tthis.wireframeLinewidth = 1;\n\tthis.wireframeLinecap = 'round';\n\tthis.wireframeLinejoin = 'round';\n\n\tthis.skinning = false;\n\tthis.morphTargets = false;\n\tthis.morphNormals = false;\n\n\tthis.setValues( parameters );\n\n}\n\nMeshPhongMaterial.prototype = Object.create( Material.prototype );\nMeshPhongMaterial.prototype.constructor = MeshPhongMaterial;\n\nMeshPhongMaterial.prototype.isMeshPhongMaterial = true;\n\nMeshPhongMaterial.prototype.copy = function ( source ) {\n\n\tMaterial.prototype.copy.call( this, source );\n\n\tthis.color.copy( source.color );\n\tthis.specular.copy( source.specular );\n\tthis.shininess = source.shininess;\n\n\tthis.map = source.map;\n\n\tthis.lightMap = source.lightMap;\n\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\tthis.aoMap = source.aoMap;\n\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\tthis.emissive.copy( source.emissive );\n\tthis.emissiveMap = source.emissiveMap;\n\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\tthis.bumpMap = source.bumpMap;\n\tthis.bumpScale = source.bumpScale;\n\n\tthis.normalMap = source.normalMap;\n\tthis.normalMapType = source.normalMapType;\n\tthis.normalScale.copy( source.normalScale );\n\n\tthis.displacementMap = source.displacementMap;\n\tthis.displacementScale = source.displacementScale;\n\tthis.displacementBias = source.displacementBias;\n\n\tthis.specularMap = source.specularMap;\n\n\tthis.alphaMap = source.alphaMap;\n\n\tthis.envMap = source.envMap;\n\tthis.combine = source.combine;\n\tthis.reflectivity = source.reflectivity;\n\tthis.refractionRatio = source.refractionRatio;\n\n\tthis.wireframe = source.wireframe;\n\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\tthis.wireframeLinecap = source.wireframeLinecap;\n\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\tthis.skinning = source.skinning;\n\tthis.morphTargets = source.morphTargets;\n\tthis.morphNormals = source.morphNormals;\n\n\treturn this;\n\n};\n\n/**\n * @author takahirox / http://github.com/takahirox\n *\n * parameters = {\n * color: ,\n * specular: ,\n * shininess: ,\n *\n * map: new THREE.Texture( ),\n * gradientMap: new THREE.Texture( ),\n *\n * lightMap: new THREE.Texture( ),\n * lightMapIntensity: \n *\n * aoMap: new THREE.Texture( ),\n * aoMapIntensity: \n *\n * emissive: ,\n * emissiveIntensity: \n * emissiveMap: new THREE.Texture( ),\n *\n * bumpMap: new THREE.Texture( ),\n * bumpScale: ,\n *\n * normalMap: new THREE.Texture( ),\n * normalMapType: THREE.TangentSpaceNormalMap,\n * normalScale: ,\n *\n * displacementMap: new THREE.Texture( ),\n * displacementScale: ,\n * displacementBias: ,\n *\n * specularMap: new THREE.Texture( ),\n *\n * alphaMap: new THREE.Texture( ),\n *\n * wireframe: ,\n * wireframeLinewidth: ,\n *\n * skinning: ,\n * morphTargets: ,\n * morphNormals: \n * }\n */\n\nfunction MeshToonMaterial( parameters ) {\n\n\tMaterial.call( this );\n\n\tthis.defines = { 'TOON': '' };\n\n\tthis.type = 'MeshToonMaterial';\n\n\tthis.color = new Color( 0xffffff );\n\tthis.specular = new Color( 0x111111 );\n\tthis.shininess = 30;\n\n\tthis.map = null;\n\tthis.gradientMap = null;\n\n\tthis.lightMap = null;\n\tthis.lightMapIntensity = 1.0;\n\n\tthis.aoMap = null;\n\tthis.aoMapIntensity = 1.0;\n\n\tthis.emissive = new Color( 0x000000 );\n\tthis.emissiveIntensity = 1.0;\n\tthis.emissiveMap = null;\n\n\tthis.bumpMap = null;\n\tthis.bumpScale = 1;\n\n\tthis.normalMap = null;\n\tthis.normalMapType = TangentSpaceNormalMap;\n\tthis.normalScale = new Vector2( 1, 1 );\n\n\tthis.displacementMap = null;\n\tthis.displacementScale = 1;\n\tthis.displacementBias = 0;\n\n\tthis.specularMap = null;\n\n\tthis.alphaMap = null;\n\n\tthis.wireframe = false;\n\tthis.wireframeLinewidth = 1;\n\tthis.wireframeLinecap = 'round';\n\tthis.wireframeLinejoin = 'round';\n\n\tthis.skinning = false;\n\tthis.morphTargets = false;\n\tthis.morphNormals = false;\n\n\tthis.setValues( parameters );\n\n}\n\nMeshToonMaterial.prototype = Object.create( Material.prototype );\nMeshToonMaterial.prototype.constructor = MeshToonMaterial;\n\nMeshToonMaterial.prototype.isMeshToonMaterial = true;\n\nMeshToonMaterial.prototype.copy = function ( source ) {\n\n\tMaterial.prototype.copy.call( this, source );\n\n\tthis.color.copy( source.color );\n\tthis.specular.copy( source.specular );\n\tthis.shininess = source.shininess;\n\n\tthis.map = source.map;\n\tthis.gradientMap = source.gradientMap;\n\n\tthis.lightMap = source.lightMap;\n\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\tthis.aoMap = source.aoMap;\n\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\tthis.emissive.copy( source.emissive );\n\tthis.emissiveMap = source.emissiveMap;\n\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\tthis.bumpMap = source.bumpMap;\n\tthis.bumpScale = source.bumpScale;\n\n\tthis.normalMap = source.normalMap;\n\tthis.normalMapType = source.normalMapType;\n\tthis.normalScale.copy( source.normalScale );\n\n\tthis.displacementMap = source.displacementMap;\n\tthis.displacementScale = source.displacementScale;\n\tthis.displacementBias = source.displacementBias;\n\n\tthis.specularMap = source.specularMap;\n\n\tthis.alphaMap = source.alphaMap;\n\n\tthis.wireframe = source.wireframe;\n\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\tthis.wireframeLinecap = source.wireframeLinecap;\n\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\tthis.skinning = source.skinning;\n\tthis.morphTargets = source.morphTargets;\n\tthis.morphNormals = source.morphNormals;\n\n\treturn this;\n\n};\n\n/**\n * @author mrdoob / http://mrdoob.com/\n * @author WestLangley / http://github.com/WestLangley\n *\n * parameters = {\n * opacity: ,\n *\n * bumpMap: new THREE.Texture( ),\n * bumpScale: ,\n *\n * normalMap: new THREE.Texture( ),\n * normalMapType: THREE.TangentSpaceNormalMap,\n * normalScale: ,\n *\n * displacementMap: new THREE.Texture( ),\n * displacementScale: ,\n * displacementBias: ,\n *\n * wireframe: ,\n * wireframeLinewidth: \n *\n * skinning: ,\n * morphTargets: ,\n * morphNormals: \n * }\n */\n\nfunction MeshNormalMaterial( parameters ) {\n\n\tMaterial.call( this );\n\n\tthis.type = 'MeshNormalMaterial';\n\n\tthis.bumpMap = null;\n\tthis.bumpScale = 1;\n\n\tthis.normalMap = null;\n\tthis.normalMapType = TangentSpaceNormalMap;\n\tthis.normalScale = new Vector2( 1, 1 );\n\n\tthis.displacementMap = null;\n\tthis.displacementScale = 1;\n\tthis.displacementBias = 0;\n\n\tthis.wireframe = false;\n\tthis.wireframeLinewidth = 1;\n\n\tthis.fog = false;\n\n\tthis.skinning = false;\n\tthis.morphTargets = false;\n\tthis.morphNormals = false;\n\n\tthis.setValues( parameters );\n\n}\n\nMeshNormalMaterial.prototype = Object.create( Material.prototype );\nMeshNormalMaterial.prototype.constructor = MeshNormalMaterial;\n\nMeshNormalMaterial.prototype.isMeshNormalMaterial = true;\n\nMeshNormalMaterial.prototype.copy = function ( source ) {\n\n\tMaterial.prototype.copy.call( this, source );\n\n\tthis.bumpMap = source.bumpMap;\n\tthis.bumpScale = source.bumpScale;\n\n\tthis.normalMap = source.normalMap;\n\tthis.normalMapType = source.normalMapType;\n\tthis.normalScale.copy( source.normalScale );\n\n\tthis.displacementMap = source.displacementMap;\n\tthis.displacementScale = source.displacementScale;\n\tthis.displacementBias = source.displacementBias;\n\n\tthis.wireframe = source.wireframe;\n\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\n\tthis.skinning = source.skinning;\n\tthis.morphTargets = source.morphTargets;\n\tthis.morphNormals = source.morphNormals;\n\n\treturn this;\n\n};\n\n/**\n * @author mrdoob / http://mrdoob.com/\n * @author alteredq / http://alteredqualia.com/\n *\n * parameters = {\n * color: ,\n * opacity: ,\n *\n * map: new THREE.Texture( ),\n *\n * lightMap: new THREE.Texture( ),\n * lightMapIntensity: \n *\n * aoMap: new THREE.Texture( ),\n * aoMapIntensity: \n *\n * emissive: ,\n * emissiveIntensity: \n * emissiveMap: new THREE.Texture( ),\n *\n * specularMap: new THREE.Texture( ),\n *\n * alphaMap: new THREE.Texture( ),\n *\n * envMap: new THREE.CubeTexture( [posx, negx, posy, negy, posz, negz] ),\n * combine: THREE.Multiply,\n * reflectivity: ,\n * refractionRatio: ,\n *\n * wireframe: ,\n * wireframeLinewidth: ,\n *\n * skinning: ,\n * morphTargets: ,\n * morphNormals: \n * }\n */\n\nfunction MeshLambertMaterial( parameters ) {\n\n\tMaterial.call( this );\n\n\tthis.type = 'MeshLambertMaterial';\n\n\tthis.color = new Color( 0xffffff ); // diffuse\n\n\tthis.map = null;\n\n\tthis.lightMap = null;\n\tthis.lightMapIntensity = 1.0;\n\n\tthis.aoMap = null;\n\tthis.aoMapIntensity = 1.0;\n\n\tthis.emissive = new Color( 0x000000 );\n\tthis.emissiveIntensity = 1.0;\n\tthis.emissiveMap = null;\n\n\tthis.specularMap = null;\n\n\tthis.alphaMap = null;\n\n\tthis.envMap = null;\n\tthis.combine = MultiplyOperation;\n\tthis.reflectivity = 1;\n\tthis.refractionRatio = 0.98;\n\n\tthis.wireframe = false;\n\tthis.wireframeLinewidth = 1;\n\tthis.wireframeLinecap = 'round';\n\tthis.wireframeLinejoin = 'round';\n\n\tthis.skinning = false;\n\tthis.morphTargets = false;\n\tthis.morphNormals = false;\n\n\tthis.setValues( parameters );\n\n}\n\nMeshLambertMaterial.prototype = Object.create( Material.prototype );\nMeshLambertMaterial.prototype.constructor = MeshLambertMaterial;\n\nMeshLambertMaterial.prototype.isMeshLambertMaterial = true;\n\nMeshLambertMaterial.prototype.copy = function ( source ) {\n\n\tMaterial.prototype.copy.call( this, source );\n\n\tthis.color.copy( source.color );\n\n\tthis.map = source.map;\n\n\tthis.lightMap = source.lightMap;\n\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\tthis.aoMap = source.aoMap;\n\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\tthis.emissive.copy( source.emissive );\n\tthis.emissiveMap = source.emissiveMap;\n\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\tthis.specularMap = source.specularMap;\n\n\tthis.alphaMap = source.alphaMap;\n\n\tthis.envMap = source.envMap;\n\tthis.combine = source.combine;\n\tthis.reflectivity = source.reflectivity;\n\tthis.refractionRatio = source.refractionRatio;\n\n\tthis.wireframe = source.wireframe;\n\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\tthis.wireframeLinecap = source.wireframeLinecap;\n\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\tthis.skinning = source.skinning;\n\tthis.morphTargets = source.morphTargets;\n\tthis.morphNormals = source.morphNormals;\n\n\treturn this;\n\n};\n\n/**\n * @author WestLangley / http://github.com/WestLangley\n *\n * parameters = {\n * color: ,\n * opacity: ,\n *\n * matcap: new THREE.Texture( ),\n *\n * map: new THREE.Texture( ),\n *\n * bumpMap: new THREE.Texture( ),\n * bumpScale: ,\n *\n * normalMap: new THREE.Texture( ),\n * normalMapType: THREE.TangentSpaceNormalMap,\n * normalScale: ,\n *\n * displacementMap: new THREE.Texture( ),\n * displacementScale: ,\n * displacementBias: ,\n *\n * alphaMap: new THREE.Texture( ),\n *\n * skinning: ,\n * morphTargets: ,\n * morphNormals: \n * }\n */\n\nfunction MeshMatcapMaterial( parameters ) {\n\n\tMaterial.call( this );\n\n\tthis.defines = { 'MATCAP': '' };\n\n\tthis.type = 'MeshMatcapMaterial';\n\n\tthis.color = new Color( 0xffffff ); // diffuse\n\n\tthis.matcap = null;\n\n\tthis.map = null;\n\n\tthis.bumpMap = null;\n\tthis.bumpScale = 1;\n\n\tthis.normalMap = null;\n\tthis.normalMapType = TangentSpaceNormalMap;\n\tthis.normalScale = new Vector2( 1, 1 );\n\n\tthis.displacementMap = null;\n\tthis.displacementScale = 1;\n\tthis.displacementBias = 0;\n\n\tthis.alphaMap = null;\n\n\tthis.skinning = false;\n\tthis.morphTargets = false;\n\tthis.morphNormals = false;\n\n\tthis.setValues( parameters );\n\n}\n\nMeshMatcapMaterial.prototype = Object.create( Material.prototype );\nMeshMatcapMaterial.prototype.constructor = MeshMatcapMaterial;\n\nMeshMatcapMaterial.prototype.isMeshMatcapMaterial = true;\n\nMeshMatcapMaterial.prototype.copy = function ( source ) {\n\n\tMaterial.prototype.copy.call( this, source );\n\n\tthis.defines = { 'MATCAP': '' };\n\n\tthis.color.copy( source.color );\n\n\tthis.matcap = source.matcap;\n\n\tthis.map = source.map;\n\n\tthis.bumpMap = source.bumpMap;\n\tthis.bumpScale = source.bumpScale;\n\n\tthis.normalMap = source.normalMap;\n\tthis.normalMapType = source.normalMapType;\n\tthis.normalScale.copy( source.normalScale );\n\n\tthis.displacementMap = source.displacementMap;\n\tthis.displacementScale = source.displacementScale;\n\tthis.displacementBias = source.displacementBias;\n\n\tthis.alphaMap = source.alphaMap;\n\n\tthis.skinning = source.skinning;\n\tthis.morphTargets = source.morphTargets;\n\tthis.morphNormals = source.morphNormals;\n\n\treturn this;\n\n};\n\n/**\n * @author alteredq / http://alteredqualia.com/\n *\n * parameters = {\n * color: ,\n * opacity: ,\n *\n * linewidth: ,\n *\n * scale: ,\n * dashSize: ,\n * gapSize: \n * }\n */\n\nfunction LineDashedMaterial( parameters ) {\n\n\tLineBasicMaterial.call( this );\n\n\tthis.type = 'LineDashedMaterial';\n\n\tthis.scale = 1;\n\tthis.dashSize = 3;\n\tthis.gapSize = 1;\n\n\tthis.setValues( parameters );\n\n}\n\nLineDashedMaterial.prototype = Object.create( LineBasicMaterial.prototype );\nLineDashedMaterial.prototype.constructor = LineDashedMaterial;\n\nLineDashedMaterial.prototype.isLineDashedMaterial = true;\n\nLineDashedMaterial.prototype.copy = function ( source ) {\n\n\tLineBasicMaterial.prototype.copy.call( this, source );\n\n\tthis.scale = source.scale;\n\tthis.dashSize = source.dashSize;\n\tthis.gapSize = source.gapSize;\n\n\treturn this;\n\n};\n\n\n\nvar Materials = /*#__PURE__*/Object.freeze({\n\t__proto__: null,\n\tShadowMaterial: ShadowMaterial,\n\tSpriteMaterial: SpriteMaterial,\n\tRawShaderMaterial: RawShaderMaterial,\n\tShaderMaterial: ShaderMaterial,\n\tPointsMaterial: PointsMaterial,\n\tMeshPhysicalMaterial: MeshPhysicalMaterial,\n\tMeshStandardMaterial: MeshStandardMaterial,\n\tMeshPhongMaterial: MeshPhongMaterial,\n\tMeshToonMaterial: MeshToonMaterial,\n\tMeshNormalMaterial: MeshNormalMaterial,\n\tMeshLambertMaterial: MeshLambertMaterial,\n\tMeshDepthMaterial: MeshDepthMaterial,\n\tMeshDistanceMaterial: MeshDistanceMaterial,\n\tMeshBasicMaterial: MeshBasicMaterial,\n\tMeshMatcapMaterial: MeshMatcapMaterial,\n\tLineDashedMaterial: LineDashedMaterial,\n\tLineBasicMaterial: LineBasicMaterial,\n\tMaterial: Material\n});\n\n/**\n * @author tschw\n * @author Ben Houston / http://clara.io/\n * @author David Sarno / http://lighthaus.us/\n */\n\nvar AnimationUtils = {\n\n\t// same as Array.prototype.slice, but also works on typed arrays\n\tarraySlice: function ( array, from, to ) {\n\n\t\tif ( AnimationUtils.isTypedArray( array ) ) {\n\n\t\t\t// in ios9 array.subarray(from, undefined) will return empty array\n\t\t\t// but array.subarray(from) or array.subarray(from, len) is correct\n\t\t\treturn new array.constructor( array.subarray( from, to !== undefined ? to : array.length ) );\n\n\t\t}\n\n\t\treturn array.slice( from, to );\n\n\t},\n\n\t// converts an array to a specific type\n\tconvertArray: function ( array, type, forceClone ) {\n\n\t\tif ( ! array || // let 'undefined' and 'null' pass\n\t\t\t! forceClone && array.constructor === type ) return array;\n\n\t\tif ( typeof type.BYTES_PER_ELEMENT === 'number' ) {\n\n\t\t\treturn new type( array ); // create typed array\n\n\t\t}\n\n\t\treturn Array.prototype.slice.call( array ); // create Array\n\n\t},\n\n\tisTypedArray: function ( object ) {\n\n\t\treturn ArrayBuffer.isView( object ) &&\n\t\t\t! ( object instanceof DataView );\n\n\t},\n\n\t// returns an array by which times and values can be sorted\n\tgetKeyframeOrder: function ( times ) {\n\n\t\tfunction compareTime( i, j ) {\n\n\t\t\treturn times[ i ] - times[ j ];\n\n\t\t}\n\n\t\tvar n = times.length;\n\t\tvar result = new Array( n );\n\t\tfor ( var i = 0; i !== n; ++ i ) result[ i ] = i;\n\n\t\tresult.sort( compareTime );\n\n\t\treturn result;\n\n\t},\n\n\t// uses the array previously returned by 'getKeyframeOrder' to sort data\n\tsortedArray: function ( values, stride, order ) {\n\n\t\tvar nValues = values.length;\n\t\tvar result = new values.constructor( nValues );\n\n\t\tfor ( var i = 0, dstOffset = 0; dstOffset !== nValues; ++ i ) {\n\n\t\t\tvar srcOffset = order[ i ] * stride;\n\n\t\t\tfor ( var j = 0; j !== stride; ++ j ) {\n\n\t\t\t\tresult[ dstOffset ++ ] = values[ srcOffset + j ];\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn result;\n\n\t},\n\n\t// function for parsing AOS keyframe formats\n\tflattenJSON: function ( jsonKeys, times, values, valuePropertyName ) {\n\n\t\tvar i = 1, key = jsonKeys[ 0 ];\n\n\t\twhile ( key !== undefined && key[ valuePropertyName ] === undefined ) {\n\n\t\t\tkey = jsonKeys[ i ++ ];\n\n\t\t}\n\n\t\tif ( key === undefined ) return; // no data\n\n\t\tvar value = key[ valuePropertyName ];\n\t\tif ( value === undefined ) return; // no data\n\n\t\tif ( Array.isArray( value ) ) {\n\n\t\t\tdo {\n\n\t\t\t\tvalue = key[ valuePropertyName ];\n\n\t\t\t\tif ( value !== undefined ) {\n\n\t\t\t\t\ttimes.push( key.time );\n\t\t\t\t\tvalues.push.apply( values, value ); // push all elements\n\n\t\t\t\t}\n\n\t\t\t\tkey = jsonKeys[ i ++ ];\n\n\t\t\t} while ( key !== undefined );\n\n\t\t} else if ( value.toArray !== undefined ) {\n\n\t\t\t// ...assume THREE.Math-ish\n\n\t\t\tdo {\n\n\t\t\t\tvalue = key[ valuePropertyName ];\n\n\t\t\t\tif ( value !== undefined ) {\n\n\t\t\t\t\ttimes.push( key.time );\n\t\t\t\t\tvalue.toArray( values, values.length );\n\n\t\t\t\t}\n\n\t\t\t\tkey = jsonKeys[ i ++ ];\n\n\t\t\t} while ( key !== undefined );\n\n\t\t} else {\n\n\t\t\t// otherwise push as-is\n\n\t\t\tdo {\n\n\t\t\t\tvalue = key[ valuePropertyName ];\n\n\t\t\t\tif ( value !== undefined ) {\n\n\t\t\t\t\ttimes.push( key.time );\n\t\t\t\t\tvalues.push( value );\n\n\t\t\t\t}\n\n\t\t\t\tkey = jsonKeys[ i ++ ];\n\n\t\t\t} while ( key !== undefined );\n\n\t\t}\n\n\t},\n\n\tsubclip: function ( sourceClip, name, startFrame, endFrame, fps ) {\n\n\t\tfps = fps || 30;\n\n\t\tvar clip = sourceClip.clone();\n\n\t\tclip.name = name;\n\n\t\tvar tracks = [];\n\n\t\tfor ( var i = 0; i < clip.tracks.length; ++ i ) {\n\n\t\t\tvar track = clip.tracks[ i ];\n\t\t\tvar valueSize = track.getValueSize();\n\n\t\t\tvar times = [];\n\t\t\tvar values = [];\n\n\t\t\tfor ( var j = 0; j < track.times.length; ++ j ) {\n\n\t\t\t\tvar frame = track.times[ j ] * fps;\n\n\t\t\t\tif ( frame < startFrame || frame >= endFrame ) continue;\n\n\t\t\t\ttimes.push( track.times[ j ] );\n\n\t\t\t\tfor ( var k = 0; k < valueSize; ++ k ) {\n\n\t\t\t\t\tvalues.push( track.values[ j * valueSize + k ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( times.length === 0 ) continue;\n\n\t\t\ttrack.times = AnimationUtils.convertArray( times, track.times.constructor );\n\t\t\ttrack.values = AnimationUtils.convertArray( values, track.values.constructor );\n\n\t\t\ttracks.push( track );\n\n\t\t}\n\n\t\tclip.tracks = tracks;\n\n\t\t// find minimum .times value across all tracks in the trimmed clip\n\n\t\tvar minStartTime = Infinity;\n\n\t\tfor ( var i = 0; i < clip.tracks.length; ++ i ) {\n\n\t\t\tif ( minStartTime > clip.tracks[ i ].times[ 0 ] ) {\n\n\t\t\t\tminStartTime = clip.tracks[ i ].times[ 0 ];\n\n\t\t\t}\n\n\t\t}\n\n\t\t// shift all tracks such that clip begins at t=0\n\n\t\tfor ( var i = 0; i < clip.tracks.length; ++ i ) {\n\n\t\t\tclip.tracks[ i ].shift( - 1 * minStartTime );\n\n\t\t}\n\n\t\tclip.resetDuration();\n\n\t\treturn clip;\n\n\t}\n\n};\n\n/**\n * Abstract base class of interpolants over parametric samples.\n *\n * The parameter domain is one dimensional, typically the time or a path\n * along a curve defined by the data.\n *\n * The sample values can have any dimensionality and derived classes may\n * apply special interpretations to the data.\n *\n * This class provides the interval seek in a Template Method, deferring\n * the actual interpolation to derived classes.\n *\n * Time complexity is O(1) for linear access crossing at most two points\n * and O(log N) for random access, where N is the number of positions.\n *\n * References:\n *\n * \t\thttp://www.oodesign.com/template-method-pattern.html\n *\n * @author tschw\n */\n\nfunction Interpolant( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\tthis.parameterPositions = parameterPositions;\n\tthis._cachedIndex = 0;\n\n\tthis.resultBuffer = resultBuffer !== undefined ?\n\t\tresultBuffer : new sampleValues.constructor( sampleSize );\n\tthis.sampleValues = sampleValues;\n\tthis.valueSize = sampleSize;\n\n}\n\nObject.assign( Interpolant.prototype, {\n\n\tevaluate: function ( t ) {\n\n\t\tvar pp = this.parameterPositions,\n\t\t\ti1 = this._cachedIndex,\n\n\t\t\tt1 = pp[ i1 ],\n\t\t\tt0 = pp[ i1 - 1 ];\n\n\t\tvalidate_interval: {\n\n\t\t\tseek: {\n\n\t\t\t\tvar right;\n\n\t\t\t\tlinear_scan: {\n\n\t\t\t\t\t//- See http://jsperf.com/comparison-to-undefined/3\n\t\t\t\t\t//- slower code:\n\t\t\t\t\t//-\n\t\t\t\t\t//- \t\t\t\tif ( t >= t1 || t1 === undefined ) {\n\t\t\t\t\tforward_scan: if ( ! ( t < t1 ) ) {\n\n\t\t\t\t\t\tfor ( var giveUpAt = i1 + 2; ; ) {\n\n\t\t\t\t\t\t\tif ( t1 === undefined ) {\n\n\t\t\t\t\t\t\t\tif ( t < t0 ) break forward_scan;\n\n\t\t\t\t\t\t\t\t// after end\n\n\t\t\t\t\t\t\t\ti1 = pp.length;\n\t\t\t\t\t\t\t\tthis._cachedIndex = i1;\n\t\t\t\t\t\t\t\treturn this.afterEnd_( i1 - 1, t, t0 );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( i1 === giveUpAt ) break; // this loop\n\n\t\t\t\t\t\t\tt0 = t1;\n\t\t\t\t\t\t\tt1 = pp[ ++ i1 ];\n\n\t\t\t\t\t\t\tif ( t < t1 ) {\n\n\t\t\t\t\t\t\t\t// we have arrived at the sought interval\n\t\t\t\t\t\t\t\tbreak seek;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// prepare binary search on the right side of the index\n\t\t\t\t\t\tright = pp.length;\n\t\t\t\t\t\tbreak linear_scan;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t//- slower code:\n\t\t\t\t\t//-\t\t\t\t\tif ( t < t0 || t0 === undefined ) {\n\t\t\t\t\tif ( ! ( t >= t0 ) ) {\n\n\t\t\t\t\t\t// looping?\n\n\t\t\t\t\t\tvar t1global = pp[ 1 ];\n\n\t\t\t\t\t\tif ( t < t1global ) {\n\n\t\t\t\t\t\t\ti1 = 2; // + 1, using the scan for the details\n\t\t\t\t\t\t\tt0 = t1global;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// linear reverse scan\n\n\t\t\t\t\t\tfor ( var giveUpAt = i1 - 2; ; ) {\n\n\t\t\t\t\t\t\tif ( t0 === undefined ) {\n\n\t\t\t\t\t\t\t\t// before start\n\n\t\t\t\t\t\t\t\tthis._cachedIndex = 0;\n\t\t\t\t\t\t\t\treturn this.beforeStart_( 0, t, t1 );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( i1 === giveUpAt ) break; // this loop\n\n\t\t\t\t\t\t\tt1 = t0;\n\t\t\t\t\t\t\tt0 = pp[ -- i1 - 1 ];\n\n\t\t\t\t\t\t\tif ( t >= t0 ) {\n\n\t\t\t\t\t\t\t\t// we have arrived at the sought interval\n\t\t\t\t\t\t\t\tbreak seek;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// prepare binary search on the left side of the index\n\t\t\t\t\t\tright = i1;\n\t\t\t\t\t\ti1 = 0;\n\t\t\t\t\t\tbreak linear_scan;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// the interval is valid\n\n\t\t\t\t\tbreak validate_interval;\n\n\t\t\t\t} // linear scan\n\n\t\t\t\t// binary search\n\n\t\t\t\twhile ( i1 < right ) {\n\n\t\t\t\t\tvar mid = ( i1 + right ) >>> 1;\n\n\t\t\t\t\tif ( t < pp[ mid ] ) {\n\n\t\t\t\t\t\tright = mid;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\ti1 = mid + 1;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tt1 = pp[ i1 ];\n\t\t\t\tt0 = pp[ i1 - 1 ];\n\n\t\t\t\t// check boundary cases, again\n\n\t\t\t\tif ( t0 === undefined ) {\n\n\t\t\t\t\tthis._cachedIndex = 0;\n\t\t\t\t\treturn this.beforeStart_( 0, t, t1 );\n\n\t\t\t\t}\n\n\t\t\t\tif ( t1 === undefined ) {\n\n\t\t\t\t\ti1 = pp.length;\n\t\t\t\t\tthis._cachedIndex = i1;\n\t\t\t\t\treturn this.afterEnd_( i1 - 1, t0, t );\n\n\t\t\t\t}\n\n\t\t\t} // seek\n\n\t\t\tthis._cachedIndex = i1;\n\n\t\t\tthis.intervalChanged_( i1, t0, t1 );\n\n\t\t} // validate_interval\n\n\t\treturn this.interpolate_( i1, t0, t, t1 );\n\n\t},\n\n\tsettings: null, // optional, subclass-specific settings structure\n\t// Note: The indirection allows central control of many interpolants.\n\n\t// --- Protected interface\n\n\tDefaultSettings_: {},\n\n\tgetSettings_: function () {\n\n\t\treturn this.settings || this.DefaultSettings_;\n\n\t},\n\n\tcopySampleValue_: function ( index ) {\n\n\t\t// copies a sample value to the result buffer\n\n\t\tvar result = this.resultBuffer,\n\t\t\tvalues = this.sampleValues,\n\t\t\tstride = this.valueSize,\n\t\t\toffset = index * stride;\n\n\t\tfor ( var i = 0; i !== stride; ++ i ) {\n\n\t\t\tresult[ i ] = values[ offset + i ];\n\n\t\t}\n\n\t\treturn result;\n\n\t},\n\n\t// Template methods for derived classes:\n\n\tinterpolate_: function ( /* i1, t0, t, t1 */ ) {\n\n\t\tthrow new Error( 'call to abstract method' );\n\t\t// implementations shall return this.resultBuffer\n\n\t},\n\n\tintervalChanged_: function ( /* i1, t0, t1 */ ) {\n\n\t\t// empty\n\n\t}\n\n} );\n\n//!\\ DECLARE ALIAS AFTER assign prototype !\nObject.assign( Interpolant.prototype, {\n\n\t//( 0, t, t0 ), returns this.resultBuffer\n\tbeforeStart_: Interpolant.prototype.copySampleValue_,\n\n\t//( N-1, tN-1, t ), returns this.resultBuffer\n\tafterEnd_: Interpolant.prototype.copySampleValue_,\n\n} );\n\n/**\n * Fast and simple cubic spline interpolant.\n *\n * It was derived from a Hermitian construction setting the first derivative\n * at each sample position to the linear slope between neighboring positions\n * over their parameter interval.\n *\n * @author tschw\n */\n\nfunction CubicInterpolant( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\tInterpolant.call( this, parameterPositions, sampleValues, sampleSize, resultBuffer );\n\n\tthis._weightPrev = - 0;\n\tthis._offsetPrev = - 0;\n\tthis._weightNext = - 0;\n\tthis._offsetNext = - 0;\n\n}\n\nCubicInterpolant.prototype = Object.assign( Object.create( Interpolant.prototype ), {\n\n\tconstructor: CubicInterpolant,\n\n\tDefaultSettings_: {\n\n\t\tendingStart: ZeroCurvatureEnding,\n\t\tendingEnd: ZeroCurvatureEnding\n\n\t},\n\n\tintervalChanged_: function ( i1, t0, t1 ) {\n\n\t\tvar pp = this.parameterPositions,\n\t\t\tiPrev = i1 - 2,\n\t\t\tiNext = i1 + 1,\n\n\t\t\ttPrev = pp[ iPrev ],\n\t\t\ttNext = pp[ iNext ];\n\n\t\tif ( tPrev === undefined ) {\n\n\t\t\tswitch ( this.getSettings_().endingStart ) {\n\n\t\t\t\tcase ZeroSlopeEnding:\n\n\t\t\t\t\t// f'(t0) = 0\n\t\t\t\t\tiPrev = i1;\n\t\t\t\t\ttPrev = 2 * t0 - t1;\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase WrapAroundEnding:\n\n\t\t\t\t\t// use the other end of the curve\n\t\t\t\t\tiPrev = pp.length - 2;\n\t\t\t\t\ttPrev = t0 + pp[ iPrev ] - pp[ iPrev + 1 ];\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault: // ZeroCurvatureEnding\n\n\t\t\t\t\t// f''(t0) = 0 a.k.a. Natural Spline\n\t\t\t\t\tiPrev = i1;\n\t\t\t\t\ttPrev = t1;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( tNext === undefined ) {\n\n\t\t\tswitch ( this.getSettings_().endingEnd ) {\n\n\t\t\t\tcase ZeroSlopeEnding:\n\n\t\t\t\t\t// f'(tN) = 0\n\t\t\t\t\tiNext = i1;\n\t\t\t\t\ttNext = 2 * t1 - t0;\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase WrapAroundEnding:\n\n\t\t\t\t\t// use the other end of the curve\n\t\t\t\t\tiNext = 1;\n\t\t\t\t\ttNext = t1 + pp[ 1 ] - pp[ 0 ];\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault: // ZeroCurvatureEnding\n\n\t\t\t\t\t// f''(tN) = 0, a.k.a. Natural Spline\n\t\t\t\t\tiNext = i1 - 1;\n\t\t\t\t\ttNext = t0;\n\n\t\t\t}\n\n\t\t}\n\n\t\tvar halfDt = ( t1 - t0 ) * 0.5,\n\t\t\tstride = this.valueSize;\n\n\t\tthis._weightPrev = halfDt / ( t0 - tPrev );\n\t\tthis._weightNext = halfDt / ( tNext - t1 );\n\t\tthis._offsetPrev = iPrev * stride;\n\t\tthis._offsetNext = iNext * stride;\n\n\t},\n\n\tinterpolate_: function ( i1, t0, t, t1 ) {\n\n\t\tvar result = this.resultBuffer,\n\t\t\tvalues = this.sampleValues,\n\t\t\tstride = this.valueSize,\n\n\t\t\to1 = i1 * stride,\t\to0 = o1 - stride,\n\t\t\toP = this._offsetPrev, \toN = this._offsetNext,\n\t\t\twP = this._weightPrev,\twN = this._weightNext,\n\n\t\t\tp = ( t - t0 ) / ( t1 - t0 ),\n\t\t\tpp = p * p,\n\t\t\tppp = pp * p;\n\n\t\t// evaluate polynomials\n\n\t\tvar sP = - wP * ppp + 2 * wP * pp - wP * p;\n\t\tvar s0 = ( 1 + wP ) * ppp + ( - 1.5 - 2 * wP ) * pp + ( - 0.5 + wP ) * p + 1;\n\t\tvar s1 = ( - 1 - wN ) * ppp + ( 1.5 + wN ) * pp + 0.5 * p;\n\t\tvar sN = wN * ppp - wN * pp;\n\n\t\t// combine data linearly\n\n\t\tfor ( var i = 0; i !== stride; ++ i ) {\n\n\t\t\tresult[ i ] =\n\t\t\t\t\tsP * values[ oP + i ] +\n\t\t\t\t\ts0 * values[ o0 + i ] +\n\t\t\t\t\ts1 * values[ o1 + i ] +\n\t\t\t\t\tsN * values[ oN + i ];\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n} );\n\n/**\n * @author tschw\n */\n\nfunction LinearInterpolant( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\tInterpolant.call( this, parameterPositions, sampleValues, sampleSize, resultBuffer );\n\n}\n\nLinearInterpolant.prototype = Object.assign( Object.create( Interpolant.prototype ), {\n\n\tconstructor: LinearInterpolant,\n\n\tinterpolate_: function ( i1, t0, t, t1 ) {\n\n\t\tvar result = this.resultBuffer,\n\t\t\tvalues = this.sampleValues,\n\t\t\tstride = this.valueSize,\n\n\t\t\toffset1 = i1 * stride,\n\t\t\toffset0 = offset1 - stride,\n\n\t\t\tweight1 = ( t - t0 ) / ( t1 - t0 ),\n\t\t\tweight0 = 1 - weight1;\n\n\t\tfor ( var i = 0; i !== stride; ++ i ) {\n\n\t\t\tresult[ i ] =\n\t\t\t\t\tvalues[ offset0 + i ] * weight0 +\n\t\t\t\t\tvalues[ offset1 + i ] * weight1;\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n} );\n\n/**\n *\n * Interpolant that evaluates to the sample value at the position preceeding\n * the parameter.\n *\n * @author tschw\n */\n\nfunction DiscreteInterpolant( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\tInterpolant.call( this, parameterPositions, sampleValues, sampleSize, resultBuffer );\n\n}\n\nDiscreteInterpolant.prototype = Object.assign( Object.create( Interpolant.prototype ), {\n\n\tconstructor: DiscreteInterpolant,\n\n\tinterpolate_: function ( i1 /*, t0, t, t1 */ ) {\n\n\t\treturn this.copySampleValue_( i1 - 1 );\n\n\t}\n\n} );\n\n/**\n *\n * A timed sequence of keyframes for a specific property.\n *\n *\n * @author Ben Houston / http://clara.io/\n * @author David Sarno / http://lighthaus.us/\n * @author tschw\n */\n\nfunction KeyframeTrack( name, times, values, interpolation ) {\n\n\tif ( name === undefined ) throw new Error( 'THREE.KeyframeTrack: track name is undefined' );\n\tif ( times === undefined || times.length === 0 ) throw new Error( 'THREE.KeyframeTrack: no keyframes in track named ' + name );\n\n\tthis.name = name;\n\n\tthis.times = AnimationUtils.convertArray( times, this.TimeBufferType );\n\tthis.values = AnimationUtils.convertArray( values, this.ValueBufferType );\n\n\tthis.setInterpolation( interpolation || this.DefaultInterpolation );\n\n}\n\n// Static methods\n\nObject.assign( KeyframeTrack, {\n\n\t// Serialization (in static context, because of constructor invocation\n\t// and automatic invocation of .toJSON):\n\n\ttoJSON: function ( track ) {\n\n\t\tvar trackType = track.constructor;\n\n\t\tvar json;\n\n\t\t// derived classes can define a static toJSON method\n\t\tif ( trackType.toJSON !== undefined ) {\n\n\t\t\tjson = trackType.toJSON( track );\n\n\t\t} else {\n\n\t\t\t// by default, we assume the data can be serialized as-is\n\t\t\tjson = {\n\n\t\t\t\t'name': track.name,\n\t\t\t\t'times': AnimationUtils.convertArray( track.times, Array ),\n\t\t\t\t'values': AnimationUtils.convertArray( track.values, Array )\n\n\t\t\t};\n\n\t\t\tvar interpolation = track.getInterpolation();\n\n\t\t\tif ( interpolation !== track.DefaultInterpolation ) {\n\n\t\t\t\tjson.interpolation = interpolation;\n\n\t\t\t}\n\n\t\t}\n\n\t\tjson.type = track.ValueTypeName; // mandatory\n\n\t\treturn json;\n\n\t}\n\n} );\n\nObject.assign( KeyframeTrack.prototype, {\n\n\tconstructor: KeyframeTrack,\n\n\tTimeBufferType: Float32Array,\n\n\tValueBufferType: Float32Array,\n\n\tDefaultInterpolation: InterpolateLinear,\n\n\tInterpolantFactoryMethodDiscrete: function ( result ) {\n\n\t\treturn new DiscreteInterpolant( this.times, this.values, this.getValueSize(), result );\n\n\t},\n\n\tInterpolantFactoryMethodLinear: function ( result ) {\n\n\t\treturn new LinearInterpolant( this.times, this.values, this.getValueSize(), result );\n\n\t},\n\n\tInterpolantFactoryMethodSmooth: function ( result ) {\n\n\t\treturn new CubicInterpolant( this.times, this.values, this.getValueSize(), result );\n\n\t},\n\n\tsetInterpolation: function ( interpolation ) {\n\n\t\tvar factoryMethod;\n\n\t\tswitch ( interpolation ) {\n\n\t\t\tcase InterpolateDiscrete:\n\n\t\t\t\tfactoryMethod = this.InterpolantFactoryMethodDiscrete;\n\n\t\t\t\tbreak;\n\n\t\t\tcase InterpolateLinear:\n\n\t\t\t\tfactoryMethod = this.InterpolantFactoryMethodLinear;\n\n\t\t\t\tbreak;\n\n\t\t\tcase InterpolateSmooth:\n\n\t\t\t\tfactoryMethod = this.InterpolantFactoryMethodSmooth;\n\n\t\t\t\tbreak;\n\n\t\t}\n\n\t\tif ( factoryMethod === undefined ) {\n\n\t\t\tvar message = \"unsupported interpolation for \" +\n\t\t\t\tthis.ValueTypeName + \" keyframe track named \" + this.name;\n\n\t\t\tif ( this.createInterpolant === undefined ) {\n\n\t\t\t\t// fall back to default, unless the default itself is messed up\n\t\t\t\tif ( interpolation !== this.DefaultInterpolation ) {\n\n\t\t\t\t\tthis.setInterpolation( this.DefaultInterpolation );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthrow new Error( message ); // fatal, in this case\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconsole.warn( 'THREE.KeyframeTrack:', message );\n\t\t\treturn this;\n\n\t\t}\n\n\t\tthis.createInterpolant = factoryMethod;\n\n\t\treturn this;\n\n\t},\n\n\tgetInterpolation: function () {\n\n\t\tswitch ( this.createInterpolant ) {\n\n\t\t\tcase this.InterpolantFactoryMethodDiscrete:\n\n\t\t\t\treturn InterpolateDiscrete;\n\n\t\t\tcase this.InterpolantFactoryMethodLinear:\n\n\t\t\t\treturn InterpolateLinear;\n\n\t\t\tcase this.InterpolantFactoryMethodSmooth:\n\n\t\t\t\treturn InterpolateSmooth;\n\n\t\t}\n\n\t},\n\n\tgetValueSize: function () {\n\n\t\treturn this.values.length / this.times.length;\n\n\t},\n\n\t// move all keyframes either forwards or backwards in time\n\tshift: function ( timeOffset ) {\n\n\t\tif ( timeOffset !== 0.0 ) {\n\n\t\t\tvar times = this.times;\n\n\t\t\tfor ( var i = 0, n = times.length; i !== n; ++ i ) {\n\n\t\t\t\ttimes[ i ] += timeOffset;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\t// scale all keyframe times by a factor (useful for frame <-> seconds conversions)\n\tscale: function ( timeScale ) {\n\n\t\tif ( timeScale !== 1.0 ) {\n\n\t\t\tvar times = this.times;\n\n\t\t\tfor ( var i = 0, n = times.length; i !== n; ++ i ) {\n\n\t\t\t\ttimes[ i ] *= timeScale;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\t// removes keyframes before and after animation without changing any values within the range [startTime, endTime].\n\t// IMPORTANT: We do not shift around keys to the start of the track time, because for interpolated keys this will change their values\n\ttrim: function ( startTime, endTime ) {\n\n\t\tvar times = this.times,\n\t\t\tnKeys = times.length,\n\t\t\tfrom = 0,\n\t\t\tto = nKeys - 1;\n\n\t\twhile ( from !== nKeys && times[ from ] < startTime ) {\n\n\t\t\t++ from;\n\n\t\t}\n\n\t\twhile ( to !== - 1 && times[ to ] > endTime ) {\n\n\t\t\t-- to;\n\n\t\t}\n\n\t\t++ to; // inclusive -> exclusive bound\n\n\t\tif ( from !== 0 || to !== nKeys ) {\n\n\t\t\t// empty tracks are forbidden, so keep at least one keyframe\n\t\t\tif ( from >= to ) to = Math.max( to, 1 ), from = to - 1;\n\n\t\t\tvar stride = this.getValueSize();\n\t\t\tthis.times = AnimationUtils.arraySlice( times, from, to );\n\t\t\tthis.values = AnimationUtils.arraySlice( this.values, from * stride, to * stride );\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\t// ensure we do not get a GarbageInGarbageOut situation, make sure tracks are at least minimally viable\n\tvalidate: function () {\n\n\t\tvar valid = true;\n\n\t\tvar valueSize = this.getValueSize();\n\t\tif ( valueSize - Math.floor( valueSize ) !== 0 ) {\n\n\t\t\tconsole.error( 'THREE.KeyframeTrack: Invalid value size in track.', this );\n\t\t\tvalid = false;\n\n\t\t}\n\n\t\tvar times = this.times,\n\t\t\tvalues = this.values,\n\n\t\t\tnKeys = times.length;\n\n\t\tif ( nKeys === 0 ) {\n\n\t\t\tconsole.error( 'THREE.KeyframeTrack: Track is empty.', this );\n\t\t\tvalid = false;\n\n\t\t}\n\n\t\tvar prevTime = null;\n\n\t\tfor ( var i = 0; i !== nKeys; i ++ ) {\n\n\t\t\tvar currTime = times[ i ];\n\n\t\t\tif ( typeof currTime === 'number' && isNaN( currTime ) ) {\n\n\t\t\t\tconsole.error( 'THREE.KeyframeTrack: Time is not a valid number.', this, i, currTime );\n\t\t\t\tvalid = false;\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tif ( prevTime !== null && prevTime > currTime ) {\n\n\t\t\t\tconsole.error( 'THREE.KeyframeTrack: Out of order keys.', this, i, currTime, prevTime );\n\t\t\t\tvalid = false;\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tprevTime = currTime;\n\n\t\t}\n\n\t\tif ( values !== undefined ) {\n\n\t\t\tif ( AnimationUtils.isTypedArray( values ) ) {\n\n\t\t\t\tfor ( var i = 0, n = values.length; i !== n; ++ i ) {\n\n\t\t\t\t\tvar value = values[ i ];\n\n\t\t\t\t\tif ( isNaN( value ) ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.KeyframeTrack: Value is not a valid number.', this, i, value );\n\t\t\t\t\t\tvalid = false;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn valid;\n\n\t},\n\n\t// removes equivalent sequential keys as common in morph target sequences\n\t// (0,0,0,0,1,1,1,0,0,0,0,0,0,0) --> (0,0,1,1,0,0)\n\toptimize: function () {\n\n\t\t// times or values may be shared with other tracks, so overwriting is unsafe\n\t\tvar times = AnimationUtils.arraySlice( this.times ),\n\t\t\tvalues = AnimationUtils.arraySlice( this.values ),\n\t\t\tstride = this.getValueSize(),\n\n\t\t\tsmoothInterpolation = this.getInterpolation() === InterpolateSmooth,\n\n\t\t\twriteIndex = 1,\n\t\t\tlastIndex = times.length - 1;\n\n\t\tfor ( var i = 1; i < lastIndex; ++ i ) {\n\n\t\t\tvar keep = false;\n\n\t\t\tvar time = times[ i ];\n\t\t\tvar timeNext = times[ i + 1 ];\n\n\t\t\t// remove adjacent keyframes scheduled at the same time\n\n\t\t\tif ( time !== timeNext && ( i !== 1 || time !== time[ 0 ] ) ) {\n\n\t\t\t\tif ( ! smoothInterpolation ) {\n\n\t\t\t\t\t// remove unnecessary keyframes same as their neighbors\n\n\t\t\t\t\tvar offset = i * stride,\n\t\t\t\t\t\toffsetP = offset - stride,\n\t\t\t\t\t\toffsetN = offset + stride;\n\n\t\t\t\t\tfor ( var j = 0; j !== stride; ++ j ) {\n\n\t\t\t\t\t\tvar value = values[ offset + j ];\n\n\t\t\t\t\t\tif ( value !== values[ offsetP + j ] ||\n\t\t\t\t\t\t\tvalue !== values[ offsetN + j ] ) {\n\n\t\t\t\t\t\t\tkeep = true;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tkeep = true;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// in-place compaction\n\n\t\t\tif ( keep ) {\n\n\t\t\t\tif ( i !== writeIndex ) {\n\n\t\t\t\t\ttimes[ writeIndex ] = times[ i ];\n\n\t\t\t\t\tvar readOffset = i * stride,\n\t\t\t\t\t\twriteOffset = writeIndex * stride;\n\n\t\t\t\t\tfor ( var j = 0; j !== stride; ++ j ) {\n\n\t\t\t\t\t\tvalues[ writeOffset + j ] = values[ readOffset + j ];\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t++ writeIndex;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// flush last keyframe (compaction looks ahead)\n\n\t\tif ( lastIndex > 0 ) {\n\n\t\t\ttimes[ writeIndex ] = times[ lastIndex ];\n\n\t\t\tfor ( var readOffset = lastIndex * stride, writeOffset = writeIndex * stride, j = 0; j !== stride; ++ j ) {\n\n\t\t\t\tvalues[ writeOffset + j ] = values[ readOffset + j ];\n\n\t\t\t}\n\n\t\t\t++ writeIndex;\n\n\t\t}\n\n\t\tif ( writeIndex !== times.length ) {\n\n\t\t\tthis.times = AnimationUtils.arraySlice( times, 0, writeIndex );\n\t\t\tthis.values = AnimationUtils.arraySlice( values, 0, writeIndex * stride );\n\n\t\t} else {\n\n\t\t\tthis.times = times;\n\t\t\tthis.values = values;\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tclone: function () {\n\n\t\tvar times = AnimationUtils.arraySlice( this.times, 0 );\n\t\tvar values = AnimationUtils.arraySlice( this.values, 0 );\n\n\t\tvar TypedKeyframeTrack = this.constructor;\n\t\tvar track = new TypedKeyframeTrack( this.name, times, values );\n\n\t\t// Interpolant argument to constructor is not saved, so copy the factory method directly.\n\t\ttrack.createInterpolant = this.createInterpolant;\n\n\t\treturn track;\n\n\t}\n\n} );\n\n/**\n *\n * A Track of Boolean keyframe values.\n *\n *\n * @author Ben Houston / http://clara.io/\n * @author David Sarno / http://lighthaus.us/\n * @author tschw\n */\n\nfunction BooleanKeyframeTrack( name, times, values ) {\n\n\tKeyframeTrack.call( this, name, times, values );\n\n}\n\nBooleanKeyframeTrack.prototype = Object.assign( Object.create( KeyframeTrack.prototype ), {\n\n\tconstructor: BooleanKeyframeTrack,\n\n\tValueTypeName: 'bool',\n\tValueBufferType: Array,\n\n\tDefaultInterpolation: InterpolateDiscrete,\n\n\tInterpolantFactoryMethodLinear: undefined,\n\tInterpolantFactoryMethodSmooth: undefined\n\n\t// Note: Actually this track could have a optimized / compressed\n\t// representation of a single value and a custom interpolant that\n\t// computes \"firstValue ^ isOdd( index )\".\n\n} );\n\n/**\n *\n * A Track of keyframe values that represent color.\n *\n *\n * @author Ben Houston / http://clara.io/\n * @author David Sarno / http://lighthaus.us/\n * @author tschw\n */\n\nfunction ColorKeyframeTrack( name, times, values, interpolation ) {\n\n\tKeyframeTrack.call( this, name, times, values, interpolation );\n\n}\n\nColorKeyframeTrack.prototype = Object.assign( Object.create( KeyframeTrack.prototype ), {\n\n\tconstructor: ColorKeyframeTrack,\n\n\tValueTypeName: 'color'\n\n\t// ValueBufferType is inherited\n\n\t// DefaultInterpolation is inherited\n\n\t// Note: Very basic implementation and nothing special yet.\n\t// However, this is the place for color space parameterization.\n\n} );\n\n/**\n *\n * A Track of numeric keyframe values.\n *\n * @author Ben Houston / http://clara.io/\n * @author David Sarno / http://lighthaus.us/\n * @author tschw\n */\n\nfunction NumberKeyframeTrack( name, times, values, interpolation ) {\n\n\tKeyframeTrack.call( this, name, times, values, interpolation );\n\n}\n\nNumberKeyframeTrack.prototype = Object.assign( Object.create( KeyframeTrack.prototype ), {\n\n\tconstructor: NumberKeyframeTrack,\n\n\tValueTypeName: 'number'\n\n\t// ValueBufferType is inherited\n\n\t// DefaultInterpolation is inherited\n\n} );\n\n/**\n * Spherical linear unit quaternion interpolant.\n *\n * @author tschw\n */\n\nfunction QuaternionLinearInterpolant( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\tInterpolant.call( this, parameterPositions, sampleValues, sampleSize, resultBuffer );\n\n}\n\nQuaternionLinearInterpolant.prototype = Object.assign( Object.create( Interpolant.prototype ), {\n\n\tconstructor: QuaternionLinearInterpolant,\n\n\tinterpolate_: function ( i1, t0, t, t1 ) {\n\n\t\tvar result = this.resultBuffer,\n\t\t\tvalues = this.sampleValues,\n\t\t\tstride = this.valueSize,\n\n\t\t\toffset = i1 * stride,\n\n\t\t\talpha = ( t - t0 ) / ( t1 - t0 );\n\n\t\tfor ( var end = offset + stride; offset !== end; offset += 4 ) {\n\n\t\t\tQuaternion.slerpFlat( result, 0, values, offset - stride, values, offset, alpha );\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n} );\n\n/**\n *\n * A Track of quaternion keyframe values.\n *\n * @author Ben Houston / http://clara.io/\n * @author David Sarno / http://lighthaus.us/\n * @author tschw\n */\n\nfunction QuaternionKeyframeTrack( name, times, values, interpolation ) {\n\n\tKeyframeTrack.call( this, name, times, values, interpolation );\n\n}\n\nQuaternionKeyframeTrack.prototype = Object.assign( Object.create( KeyframeTrack.prototype ), {\n\n\tconstructor: QuaternionKeyframeTrack,\n\n\tValueTypeName: 'quaternion',\n\n\t// ValueBufferType is inherited\n\n\tDefaultInterpolation: InterpolateLinear,\n\n\tInterpolantFactoryMethodLinear: function ( result ) {\n\n\t\treturn new QuaternionLinearInterpolant( this.times, this.values, this.getValueSize(), result );\n\n\t},\n\n\tInterpolantFactoryMethodSmooth: undefined // not yet implemented\n\n} );\n\n/**\n *\n * A Track that interpolates Strings\n *\n *\n * @author Ben Houston / http://clara.io/\n * @author David Sarno / http://lighthaus.us/\n * @author tschw\n */\n\nfunction StringKeyframeTrack( name, times, values, interpolation ) {\n\n\tKeyframeTrack.call( this, name, times, values, interpolation );\n\n}\n\nStringKeyframeTrack.prototype = Object.assign( Object.create( KeyframeTrack.prototype ), {\n\n\tconstructor: StringKeyframeTrack,\n\n\tValueTypeName: 'string',\n\tValueBufferType: Array,\n\n\tDefaultInterpolation: InterpolateDiscrete,\n\n\tInterpolantFactoryMethodLinear: undefined,\n\n\tInterpolantFactoryMethodSmooth: undefined\n\n} );\n\n/**\n *\n * A Track of vectored keyframe values.\n *\n *\n * @author Ben Houston / http://clara.io/\n * @author David Sarno / http://lighthaus.us/\n * @author tschw\n */\n\nfunction VectorKeyframeTrack( name, times, values, interpolation ) {\n\n\tKeyframeTrack.call( this, name, times, values, interpolation );\n\n}\n\nVectorKeyframeTrack.prototype = Object.assign( Object.create( KeyframeTrack.prototype ), {\n\n\tconstructor: VectorKeyframeTrack,\n\n\tValueTypeName: 'vector'\n\n\t// ValueBufferType is inherited\n\n\t// DefaultInterpolation is inherited\n\n} );\n\n/**\n *\n * Reusable set of Tracks that represent an animation.\n *\n * @author Ben Houston / http://clara.io/\n * @author David Sarno / http://lighthaus.us/\n */\n\nfunction AnimationClip( name, duration, tracks ) {\n\n\tthis.name = name;\n\tthis.tracks = tracks;\n\tthis.duration = ( duration !== undefined ) ? duration : - 1;\n\n\tthis.uuid = MathUtils.generateUUID();\n\n\t// this means it should figure out its duration by scanning the tracks\n\tif ( this.duration < 0 ) {\n\n\t\tthis.resetDuration();\n\n\t}\n\n}\n\nfunction getTrackTypeForValueTypeName( typeName ) {\n\n\tswitch ( typeName.toLowerCase() ) {\n\n\t\tcase 'scalar':\n\t\tcase 'double':\n\t\tcase 'float':\n\t\tcase 'number':\n\t\tcase 'integer':\n\n\t\t\treturn NumberKeyframeTrack;\n\n\t\tcase 'vector':\n\t\tcase 'vector2':\n\t\tcase 'vector3':\n\t\tcase 'vector4':\n\n\t\t\treturn VectorKeyframeTrack;\n\n\t\tcase 'color':\n\n\t\t\treturn ColorKeyframeTrack;\n\n\t\tcase 'quaternion':\n\n\t\t\treturn QuaternionKeyframeTrack;\n\n\t\tcase 'bool':\n\t\tcase 'boolean':\n\n\t\t\treturn BooleanKeyframeTrack;\n\n\t\tcase 'string':\n\n\t\t\treturn StringKeyframeTrack;\n\n\t}\n\n\tthrow new Error( 'THREE.KeyframeTrack: Unsupported typeName: ' + typeName );\n\n}\n\nfunction parseKeyframeTrack( json ) {\n\n\tif ( json.type === undefined ) {\n\n\t\tthrow new Error( 'THREE.KeyframeTrack: track type undefined, can not parse' );\n\n\t}\n\n\tvar trackType = getTrackTypeForValueTypeName( json.type );\n\n\tif ( json.times === undefined ) {\n\n\t\tvar times = [], values = [];\n\n\t\tAnimationUtils.flattenJSON( json.keys, times, values, 'value' );\n\n\t\tjson.times = times;\n\t\tjson.values = values;\n\n\t}\n\n\t// derived classes can define a static parse method\n\tif ( trackType.parse !== undefined ) {\n\n\t\treturn trackType.parse( json );\n\n\t} else {\n\n\t\t// by default, we assume a constructor compatible with the base\n\t\treturn new trackType( json.name, json.times, json.values, json.interpolation );\n\n\t}\n\n}\n\nObject.assign( AnimationClip, {\n\n\tparse: function ( json ) {\n\n\t\tvar tracks = [],\n\t\t\tjsonTracks = json.tracks,\n\t\t\tframeTime = 1.0 / ( json.fps || 1.0 );\n\n\t\tfor ( var i = 0, n = jsonTracks.length; i !== n; ++ i ) {\n\n\t\t\ttracks.push( parseKeyframeTrack( jsonTracks[ i ] ).scale( frameTime ) );\n\n\t\t}\n\n\t\treturn new AnimationClip( json.name, json.duration, tracks );\n\n\t},\n\n\ttoJSON: function ( clip ) {\n\n\t\tvar tracks = [],\n\t\t\tclipTracks = clip.tracks;\n\n\t\tvar json = {\n\n\t\t\t'name': clip.name,\n\t\t\t'duration': clip.duration,\n\t\t\t'tracks': tracks,\n\t\t\t'uuid': clip.uuid\n\n\t\t};\n\n\t\tfor ( var i = 0, n = clipTracks.length; i !== n; ++ i ) {\n\n\t\t\ttracks.push( KeyframeTrack.toJSON( clipTracks[ i ] ) );\n\n\t\t}\n\n\t\treturn json;\n\n\t},\n\n\tCreateFromMorphTargetSequence: function ( name, morphTargetSequence, fps, noLoop ) {\n\n\t\tvar numMorphTargets = morphTargetSequence.length;\n\t\tvar tracks = [];\n\n\t\tfor ( var i = 0; i < numMorphTargets; i ++ ) {\n\n\t\t\tvar times = [];\n\t\t\tvar values = [];\n\n\t\t\ttimes.push(\n\t\t\t\t( i + numMorphTargets - 1 ) % numMorphTargets,\n\t\t\t\ti,\n\t\t\t\t( i + 1 ) % numMorphTargets );\n\n\t\t\tvalues.push( 0, 1, 0 );\n\n\t\t\tvar order = AnimationUtils.getKeyframeOrder( times );\n\t\t\ttimes = AnimationUtils.sortedArray( times, 1, order );\n\t\t\tvalues = AnimationUtils.sortedArray( values, 1, order );\n\n\t\t\t// if there is a key at the first frame, duplicate it as the\n\t\t\t// last frame as well for perfect loop.\n\t\t\tif ( ! noLoop && times[ 0 ] === 0 ) {\n\n\t\t\t\ttimes.push( numMorphTargets );\n\t\t\t\tvalues.push( values[ 0 ] );\n\n\t\t\t}\n\n\t\t\ttracks.push(\n\t\t\t\tnew NumberKeyframeTrack(\n\t\t\t\t\t'.morphTargetInfluences[' + morphTargetSequence[ i ].name + ']',\n\t\t\t\t\ttimes, values\n\t\t\t\t).scale( 1.0 / fps ) );\n\n\t\t}\n\n\t\treturn new AnimationClip( name, - 1, tracks );\n\n\t},\n\n\tfindByName: function ( objectOrClipArray, name ) {\n\n\t\tvar clipArray = objectOrClipArray;\n\n\t\tif ( ! Array.isArray( objectOrClipArray ) ) {\n\n\t\t\tvar o = objectOrClipArray;\n\t\t\tclipArray = o.geometry && o.geometry.animations || o.animations;\n\n\t\t}\n\n\t\tfor ( var i = 0; i < clipArray.length; i ++ ) {\n\n\t\t\tif ( clipArray[ i ].name === name ) {\n\n\t\t\t\treturn clipArray[ i ];\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn null;\n\n\t},\n\n\tCreateClipsFromMorphTargetSequences: function ( morphTargets, fps, noLoop ) {\n\n\t\tvar animationToMorphTargets = {};\n\n\t\t// tested with https://regex101.com/ on trick sequences\n\t\t// such flamingo_flyA_003, flamingo_run1_003, crdeath0059\n\t\tvar pattern = /^([\\w-]*?)([\\d]+)$/;\n\n\t\t// sort morph target names into animation groups based\n\t\t// patterns like Walk_001, Walk_002, Run_001, Run_002\n\t\tfor ( var i = 0, il = morphTargets.length; i < il; i ++ ) {\n\n\t\t\tvar morphTarget = morphTargets[ i ];\n\t\t\tvar parts = morphTarget.name.match( pattern );\n\n\t\t\tif ( parts && parts.length > 1 ) {\n\n\t\t\t\tvar name = parts[ 1 ];\n\n\t\t\t\tvar animationMorphTargets = animationToMorphTargets[ name ];\n\t\t\t\tif ( ! animationMorphTargets ) {\n\n\t\t\t\t\tanimationToMorphTargets[ name ] = animationMorphTargets = [];\n\n\t\t\t\t}\n\n\t\t\t\tanimationMorphTargets.push( morphTarget );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvar clips = [];\n\n\t\tfor ( var name in animationToMorphTargets ) {\n\n\t\t\tclips.push( AnimationClip.CreateFromMorphTargetSequence( name, animationToMorphTargets[ name ], fps, noLoop ) );\n\n\t\t}\n\n\t\treturn clips;\n\n\t},\n\n\t// parse the animation.hierarchy format\n\tparseAnimation: function ( animation, bones ) {\n\n\t\tif ( ! animation ) {\n\n\t\t\tconsole.error( 'THREE.AnimationClip: No animation in JSONLoader data.' );\n\t\t\treturn null;\n\n\t\t}\n\n\t\tvar addNonemptyTrack = function ( trackType, trackName, animationKeys, propertyName, destTracks ) {\n\n\t\t\t// only return track if there are actually keys.\n\t\t\tif ( animationKeys.length !== 0 ) {\n\n\t\t\t\tvar times = [];\n\t\t\t\tvar values = [];\n\n\t\t\t\tAnimationUtils.flattenJSON( animationKeys, times, values, propertyName );\n\n\t\t\t\t// empty keys are filtered out, so check again\n\t\t\t\tif ( times.length !== 0 ) {\n\n\t\t\t\t\tdestTracks.push( new trackType( trackName, times, values ) );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t};\n\n\t\tvar tracks = [];\n\n\t\tvar clipName = animation.name || 'default';\n\t\t// automatic length determination in AnimationClip.\n\t\tvar duration = animation.length || - 1;\n\t\tvar fps = animation.fps || 30;\n\n\t\tvar hierarchyTracks = animation.hierarchy || [];\n\n\t\tfor ( var h = 0; h < hierarchyTracks.length; h ++ ) {\n\n\t\t\tvar animationKeys = hierarchyTracks[ h ].keys;\n\n\t\t\t// skip empty tracks\n\t\t\tif ( ! animationKeys || animationKeys.length === 0 ) continue;\n\n\t\t\t// process morph targets\n\t\t\tif ( animationKeys[ 0 ].morphTargets ) {\n\n\t\t\t\t// figure out all morph targets used in this track\n\t\t\t\tvar morphTargetNames = {};\n\n\t\t\t\tfor ( var k = 0; k < animationKeys.length; k ++ ) {\n\n\t\t\t\t\tif ( animationKeys[ k ].morphTargets ) {\n\n\t\t\t\t\t\tfor ( var m = 0; m < animationKeys[ k ].morphTargets.length; m ++ ) {\n\n\t\t\t\t\t\t\tmorphTargetNames[ animationKeys[ k ].morphTargets[ m ] ] = - 1;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t// create a track for each morph target with all zero\n\t\t\t\t// morphTargetInfluences except for the keys in which\n\t\t\t\t// the morphTarget is named.\n\t\t\t\tfor ( var morphTargetName in morphTargetNames ) {\n\n\t\t\t\t\tvar times = [];\n\t\t\t\t\tvar values = [];\n\n\t\t\t\t\tfor ( var m = 0; m !== animationKeys[ k ].morphTargets.length; ++ m ) {\n\n\t\t\t\t\t\tvar animationKey = animationKeys[ k ];\n\n\t\t\t\t\t\ttimes.push( animationKey.time );\n\t\t\t\t\t\tvalues.push( ( animationKey.morphTarget === morphTargetName ) ? 1 : 0 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttracks.push( new NumberKeyframeTrack( '.morphTargetInfluence[' + morphTargetName + ']', times, values ) );\n\n\t\t\t\t}\n\n\t\t\t\tduration = morphTargetNames.length * ( fps || 1.0 );\n\n\t\t\t} else {\n\n\t\t\t\t// ...assume skeletal animation\n\n\t\t\t\tvar boneName = '.bones[' + bones[ h ].name + ']';\n\n\t\t\t\taddNonemptyTrack(\n\t\t\t\t\tVectorKeyframeTrack, boneName + '.position',\n\t\t\t\t\tanimationKeys, 'pos', tracks );\n\n\t\t\t\taddNonemptyTrack(\n\t\t\t\t\tQuaternionKeyframeTrack, boneName + '.quaternion',\n\t\t\t\t\tanimationKeys, 'rot', tracks );\n\n\t\t\t\taddNonemptyTrack(\n\t\t\t\t\tVectorKeyframeTrack, boneName + '.scale',\n\t\t\t\t\tanimationKeys, 'scl', tracks );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( tracks.length === 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tvar clip = new AnimationClip( clipName, duration, tracks );\n\n\t\treturn clip;\n\n\t}\n\n} );\n\nObject.assign( AnimationClip.prototype, {\n\n\tresetDuration: function () {\n\n\t\tvar tracks = this.tracks, duration = 0;\n\n\t\tfor ( var i = 0, n = tracks.length; i !== n; ++ i ) {\n\n\t\t\tvar track = this.tracks[ i ];\n\n\t\t\tduration = Math.max( duration, track.times[ track.times.length - 1 ] );\n\n\t\t}\n\n\t\tthis.duration = duration;\n\n\t\treturn this;\n\n\t},\n\n\ttrim: function () {\n\n\t\tfor ( var i = 0; i < this.tracks.length; i ++ ) {\n\n\t\t\tthis.tracks[ i ].trim( 0, this.duration );\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tvalidate: function () {\n\n\t\tvar valid = true;\n\n\t\tfor ( var i = 0; i < this.tracks.length; i ++ ) {\n\n\t\t\tvalid = valid && this.tracks[ i ].validate();\n\n\t\t}\n\n\t\treturn valid;\n\n\t},\n\n\toptimize: function () {\n\n\t\tfor ( var i = 0; i < this.tracks.length; i ++ ) {\n\n\t\t\tthis.tracks[ i ].optimize();\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tclone: function () {\n\n\t\tvar tracks = [];\n\n\t\tfor ( var i = 0; i < this.tracks.length; i ++ ) {\n\n\t\t\ttracks.push( this.tracks[ i ].clone() );\n\n\t\t}\n\n\t\treturn new AnimationClip( this.name, this.duration, tracks );\n\n\t}\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nvar Cache = {\n\n\tenabled: false,\n\n\tfiles: {},\n\n\tadd: function ( key, file ) {\n\n\t\tif ( this.enabled === false ) return;\n\n\t\t// console.log( 'THREE.Cache', 'Adding key:', key );\n\n\t\tthis.files[ key ] = file;\n\n\t},\n\n\tget: function ( key ) {\n\n\t\tif ( this.enabled === false ) return;\n\n\t\t// console.log( 'THREE.Cache', 'Checking key:', key );\n\n\t\treturn this.files[ key ];\n\n\t},\n\n\tremove: function ( key ) {\n\n\t\tdelete this.files[ key ];\n\n\t},\n\n\tclear: function () {\n\n\t\tthis.files = {};\n\n\t}\n\n};\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction LoadingManager( onLoad, onProgress, onError ) {\n\n\tvar scope = this;\n\n\tvar isLoading = false;\n\tvar itemsLoaded = 0;\n\tvar itemsTotal = 0;\n\tvar urlModifier = undefined;\n\tvar handlers = [];\n\n\t// Refer to #5689 for the reason why we don't set .onStart\n\t// in the constructor\n\n\tthis.onStart = undefined;\n\tthis.onLoad = onLoad;\n\tthis.onProgress = onProgress;\n\tthis.onError = onError;\n\n\tthis.itemStart = function ( url ) {\n\n\t\titemsTotal ++;\n\n\t\tif ( isLoading === false ) {\n\n\t\t\tif ( scope.onStart !== undefined ) {\n\n\t\t\t\tscope.onStart( url, itemsLoaded, itemsTotal );\n\n\t\t\t}\n\n\t\t}\n\n\t\tisLoading = true;\n\n\t};\n\n\tthis.itemEnd = function ( url ) {\n\n\t\titemsLoaded ++;\n\n\t\tif ( scope.onProgress !== undefined ) {\n\n\t\t\tscope.onProgress( url, itemsLoaded, itemsTotal );\n\n\t\t}\n\n\t\tif ( itemsLoaded === itemsTotal ) {\n\n\t\t\tisLoading = false;\n\n\t\t\tif ( scope.onLoad !== undefined ) {\n\n\t\t\t\tscope.onLoad();\n\n\t\t\t}\n\n\t\t}\n\n\t};\n\n\tthis.itemError = function ( url ) {\n\n\t\tif ( scope.onError !== undefined ) {\n\n\t\t\tscope.onError( url );\n\n\t\t}\n\n\t};\n\n\tthis.resolveURL = function ( url ) {\n\n\t\tif ( urlModifier ) {\n\n\t\t\treturn urlModifier( url );\n\n\t\t}\n\n\t\treturn url;\n\n\t};\n\n\tthis.setURLModifier = function ( transform ) {\n\n\t\turlModifier = transform;\n\n\t\treturn this;\n\n\t};\n\n\tthis.addHandler = function ( regex, loader ) {\n\n\t\thandlers.push( regex, loader );\n\n\t\treturn this;\n\n\t};\n\n\tthis.removeHandler = function ( regex ) {\n\n\t\tvar index = handlers.indexOf( regex );\n\n\t\tif ( index !== - 1 ) {\n\n\t\t\thandlers.splice( index, 2 );\n\n\t\t}\n\n\t\treturn this;\n\n\t};\n\n\tthis.getHandler = function ( file ) {\n\n\t\tfor ( var i = 0, l = handlers.length; i < l; i += 2 ) {\n\n\t\t\tvar regex = handlers[ i ];\n\t\t\tvar loader = handlers[ i + 1 ];\n\n\t\t\tif ( regex.global ) regex.lastIndex = 0; // see #17920\n\n\t\t\tif ( regex.test( file ) ) {\n\n\t\t\t\treturn loader;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn null;\n\n\t};\n\n}\n\nvar DefaultLoadingManager = new LoadingManager();\n\n/**\n * @author alteredq / http://alteredqualia.com/\n */\n\nfunction Loader( manager ) {\n\n\tthis.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;\n\n\tthis.crossOrigin = 'anonymous';\n\tthis.path = '';\n\tthis.resourcePath = '';\n\n}\n\nObject.assign( Loader.prototype, {\n\n\tload: function ( /* url, onLoad, onProgress, onError */ ) {},\n\n\tparse: function ( /* data */ ) {},\n\n\tsetCrossOrigin: function ( crossOrigin ) {\n\n\t\tthis.crossOrigin = crossOrigin;\n\t\treturn this;\n\n\t},\n\n\tsetPath: function ( path ) {\n\n\t\tthis.path = path;\n\t\treturn this;\n\n\t},\n\n\tsetResourcePath: function ( resourcePath ) {\n\n\t\tthis.resourcePath = resourcePath;\n\t\treturn this;\n\n\t}\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nvar loading = {};\n\nfunction FileLoader( manager ) {\n\n\tLoader.call( this, manager );\n\n}\n\nFileLoader.prototype = Object.assign( Object.create( Loader.prototype ), {\n\n\tconstructor: FileLoader,\n\n\tload: function ( url, onLoad, onProgress, onError ) {\n\n\t\tif ( url === undefined ) url = '';\n\n\t\tif ( this.path !== undefined ) url = this.path + url;\n\n\t\turl = this.manager.resolveURL( url );\n\n\t\tvar scope = this;\n\n\t\tvar cached = Cache.get( url );\n\n\t\tif ( cached !== undefined ) {\n\n\t\t\tscope.manager.itemStart( url );\n\n\t\t\tsetTimeout( function () {\n\n\t\t\t\tif ( onLoad ) onLoad( cached );\n\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t}, 0 );\n\n\t\t\treturn cached;\n\n\t\t}\n\n\t\t// Check if request is duplicate\n\n\t\tif ( loading[ url ] !== undefined ) {\n\n\t\t\tloading[ url ].push( {\n\n\t\t\t\tonLoad: onLoad,\n\t\t\t\tonProgress: onProgress,\n\t\t\t\tonError: onError\n\n\t\t\t} );\n\n\t\t\treturn;\n\n\t\t}\n\n\t\t// Check for data: URI\n\t\tvar dataUriRegex = /^data:(.*?)(;base64)?,(.*)$/;\n\t\tvar dataUriRegexResult = url.match( dataUriRegex );\n\n\t\t// Safari can not handle Data URIs through XMLHttpRequest so process manually\n\t\tif ( dataUriRegexResult ) {\n\n\t\t\tvar mimeType = dataUriRegexResult[ 1 ];\n\t\t\tvar isBase64 = !! dataUriRegexResult[ 2 ];\n\t\t\tvar data = dataUriRegexResult[ 3 ];\n\n\t\t\tdata = decodeURIComponent( data );\n\n\t\t\tif ( isBase64 ) data = atob( data );\n\n\t\t\ttry {\n\n\t\t\t\tvar response;\n\t\t\t\tvar responseType = ( this.responseType || '' ).toLowerCase();\n\n\t\t\t\tswitch ( responseType ) {\n\n\t\t\t\t\tcase 'arraybuffer':\n\t\t\t\t\tcase 'blob':\n\n\t\t\t\t\t\tvar view = new Uint8Array( data.length );\n\n\t\t\t\t\t\tfor ( var i = 0; i < data.length; i ++ ) {\n\n\t\t\t\t\t\t\tview[ i ] = data.charCodeAt( i );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( responseType === 'blob' ) {\n\n\t\t\t\t\t\t\tresponse = new Blob( [ view.buffer ], { type: mimeType } );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tresponse = view.buffer;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'document':\n\n\t\t\t\t\t\tvar parser = new DOMParser();\n\t\t\t\t\t\tresponse = parser.parseFromString( data, mimeType );\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'json':\n\n\t\t\t\t\t\tresponse = JSON.parse( data );\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault: // 'text' or other\n\n\t\t\t\t\t\tresponse = data;\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t\t// Wait for next browser tick like standard XMLHttpRequest event dispatching does\n\t\t\t\tsetTimeout( function () {\n\n\t\t\t\t\tif ( onLoad ) onLoad( response );\n\n\t\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t\t}, 0 );\n\n\t\t\t} catch ( error ) {\n\n\t\t\t\t// Wait for next browser tick like standard XMLHttpRequest event dispatching does\n\t\t\t\tsetTimeout( function () {\n\n\t\t\t\t\tif ( onError ) onError( error );\n\n\t\t\t\t\tscope.manager.itemError( url );\n\t\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t\t}, 0 );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// Initialise array for duplicate requests\n\n\t\t\tloading[ url ] = [];\n\n\t\t\tloading[ url ].push( {\n\n\t\t\t\tonLoad: onLoad,\n\t\t\t\tonProgress: onProgress,\n\t\t\t\tonError: onError\n\n\t\t\t} );\n\n\t\t\tvar request = new XMLHttpRequest();\n\n\t\t\trequest.open( 'GET', url, true );\n\n\t\t\trequest.addEventListener( 'load', function ( event ) {\n\n\t\t\t\tvar response = this.response;\n\n\t\t\t\tvar callbacks = loading[ url ];\n\n\t\t\t\tdelete loading[ url ];\n\n\t\t\t\tif ( this.status === 200 || this.status === 0 ) {\n\n\t\t\t\t\t// Some browsers return HTTP Status 0 when using non-http protocol\n\t\t\t\t\t// e.g. 'file://' or 'data://'. Handle as success.\n\n\t\t\t\t\tif ( this.status === 0 ) console.warn( 'THREE.FileLoader: HTTP Status 0 received.' );\n\n\t\t\t\t\t// Add to cache only on HTTP success, so that we do not cache\n\t\t\t\t\t// error response bodies as proper responses to requests.\n\t\t\t\t\tCache.add( url, response );\n\n\t\t\t\t\tfor ( var i = 0, il = callbacks.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tvar callback = callbacks[ i ];\n\t\t\t\t\t\tif ( callback.onLoad ) callback.onLoad( response );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tfor ( var i = 0, il = callbacks.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tvar callback = callbacks[ i ];\n\t\t\t\t\t\tif ( callback.onError ) callback.onError( event );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tscope.manager.itemError( url );\n\t\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t\t}\n\n\t\t\t}, false );\n\n\t\t\trequest.addEventListener( 'progress', function ( event ) {\n\n\t\t\t\tvar callbacks = loading[ url ];\n\n\t\t\t\tfor ( var i = 0, il = callbacks.length; i < il; i ++ ) {\n\n\t\t\t\t\tvar callback = callbacks[ i ];\n\t\t\t\t\tif ( callback.onProgress ) callback.onProgress( event );\n\n\t\t\t\t}\n\n\t\t\t}, false );\n\n\t\t\trequest.addEventListener( 'error', function ( event ) {\n\n\t\t\t\tvar callbacks = loading[ url ];\n\n\t\t\t\tdelete loading[ url ];\n\n\t\t\t\tfor ( var i = 0, il = callbacks.length; i < il; i ++ ) {\n\n\t\t\t\t\tvar callback = callbacks[ i ];\n\t\t\t\t\tif ( callback.onError ) callback.onError( event );\n\n\t\t\t\t}\n\n\t\t\t\tscope.manager.itemError( url );\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t}, false );\n\n\t\t\trequest.addEventListener( 'abort', function ( event ) {\n\n\t\t\t\tvar callbacks = loading[ url ];\n\n\t\t\t\tdelete loading[ url ];\n\n\t\t\t\tfor ( var i = 0, il = callbacks.length; i < il; i ++ ) {\n\n\t\t\t\t\tvar callback = callbacks[ i ];\n\t\t\t\t\tif ( callback.onError ) callback.onError( event );\n\n\t\t\t\t}\n\n\t\t\t\tscope.manager.itemError( url );\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t}, false );\n\n\t\t\tif ( this.responseType !== undefined ) request.responseType = this.responseType;\n\t\t\tif ( this.withCredentials !== undefined ) request.withCredentials = this.withCredentials;\n\n\t\t\tif ( request.overrideMimeType ) request.overrideMimeType( this.mimeType !== undefined ? this.mimeType : 'text/plain' );\n\n\t\t\tfor ( var header in this.requestHeader ) {\n\n\t\t\t\trequest.setRequestHeader( header, this.requestHeader[ header ] );\n\n\t\t\t}\n\n\t\t\trequest.send( null );\n\n\t\t}\n\n\t\tscope.manager.itemStart( url );\n\n\t\treturn request;\n\n\t},\n\n\tsetResponseType: function ( value ) {\n\n\t\tthis.responseType = value;\n\t\treturn this;\n\n\t},\n\n\tsetWithCredentials: function ( value ) {\n\n\t\tthis.withCredentials = value;\n\t\treturn this;\n\n\t},\n\n\tsetMimeType: function ( value ) {\n\n\t\tthis.mimeType = value;\n\t\treturn this;\n\n\t},\n\n\tsetRequestHeader: function ( value ) {\n\n\t\tthis.requestHeader = value;\n\t\treturn this;\n\n\t}\n\n} );\n\n/**\n * @author bhouston / http://clara.io/\n */\n\nfunction AnimationLoader( manager ) {\n\n\tLoader.call( this, manager );\n\n}\n\nAnimationLoader.prototype = Object.assign( Object.create( Loader.prototype ), {\n\n\tconstructor: AnimationLoader,\n\n\tload: function ( url, onLoad, onProgress, onError ) {\n\n\t\tvar scope = this;\n\n\t\tvar loader = new FileLoader( scope.manager );\n\t\tloader.setPath( scope.path );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\tonLoad( scope.parse( JSON.parse( text ) ) );\n\n\t\t}, onProgress, onError );\n\n\t},\n\n\tparse: function ( json ) {\n\n\t\tvar animations = [];\n\n\t\tfor ( var i = 0; i < json.length; i ++ ) {\n\n\t\t\tvar clip = AnimationClip.parse( json[ i ] );\n\n\t\t\tanimations.push( clip );\n\n\t\t}\n\n\t\treturn animations;\n\n\t}\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n *\n * Abstract Base class to block based textures loader (dds, pvr, ...)\n *\n * Sub classes have to implement the parse() method which will be used in load().\n */\n\nfunction CompressedTextureLoader( manager ) {\n\n\tLoader.call( this, manager );\n\n}\n\nCompressedTextureLoader.prototype = Object.assign( Object.create( Loader.prototype ), {\n\n\tconstructor: CompressedTextureLoader,\n\n\tload: function ( url, onLoad, onProgress, onError ) {\n\n\t\tvar scope = this;\n\n\t\tvar images = [];\n\n\t\tvar texture = new CompressedTexture();\n\t\ttexture.image = images;\n\n\t\tvar loader = new FileLoader( this.manager );\n\t\tloader.setPath( this.path );\n\t\tloader.setResponseType( 'arraybuffer' );\n\n\t\tfunction loadTexture( i ) {\n\n\t\t\tloader.load( url[ i ], function ( buffer ) {\n\n\t\t\t\tvar texDatas = scope.parse( buffer, true );\n\n\t\t\t\timages[ i ] = {\n\t\t\t\t\twidth: texDatas.width,\n\t\t\t\t\theight: texDatas.height,\n\t\t\t\t\tformat: texDatas.format,\n\t\t\t\t\tmipmaps: texDatas.mipmaps\n\t\t\t\t};\n\n\t\t\t\tloaded += 1;\n\n\t\t\t\tif ( loaded === 6 ) {\n\n\t\t\t\t\tif ( texDatas.mipmapCount === 1 )\n\t\t\t\t\t\ttexture.minFilter = LinearFilter;\n\n\t\t\t\t\ttexture.format = texDatas.format;\n\t\t\t\t\ttexture.needsUpdate = true;\n\n\t\t\t\t\tif ( onLoad ) onLoad( texture );\n\n\t\t\t\t}\n\n\t\t\t}, onProgress, onError );\n\n\t\t}\n\n\t\tif ( Array.isArray( url ) ) {\n\n\t\t\tvar loaded = 0;\n\n\t\t\tfor ( var i = 0, il = url.length; i < il; ++ i ) {\n\n\t\t\t\tloadTexture( i );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// compressed cubemap texture stored in a single DDS file\n\n\t\t\tloader.load( url, function ( buffer ) {\n\n\t\t\t\tvar texDatas = scope.parse( buffer, true );\n\n\t\t\t\tif ( texDatas.isCubemap ) {\n\n\t\t\t\t\tvar faces = texDatas.mipmaps.length / texDatas.mipmapCount;\n\n\t\t\t\t\tfor ( var f = 0; f < faces; f ++ ) {\n\n\t\t\t\t\t\timages[ f ] = { mipmaps: [] };\n\n\t\t\t\t\t\tfor ( var i = 0; i < texDatas.mipmapCount; i ++ ) {\n\n\t\t\t\t\t\t\timages[ f ].mipmaps.push( texDatas.mipmaps[ f * texDatas.mipmapCount + i ] );\n\t\t\t\t\t\t\timages[ f ].format = texDatas.format;\n\t\t\t\t\t\t\timages[ f ].width = texDatas.width;\n\t\t\t\t\t\t\timages[ f ].height = texDatas.height;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\ttexture.image.width = texDatas.width;\n\t\t\t\t\ttexture.image.height = texDatas.height;\n\t\t\t\t\ttexture.mipmaps = texDatas.mipmaps;\n\n\t\t\t\t}\n\n\t\t\t\tif ( texDatas.mipmapCount === 1 ) {\n\n\t\t\t\t\ttexture.minFilter = LinearFilter;\n\n\t\t\t\t}\n\n\t\t\t\ttexture.format = texDatas.format;\n\t\t\t\ttexture.needsUpdate = true;\n\n\t\t\t\tif ( onLoad ) onLoad( texture );\n\n\t\t\t}, onProgress, onError );\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n} );\n\n/**\n * @author Nikos M. / https://github.com/foo123/\n *\n * Abstract Base class to load generic binary textures formats (rgbe, hdr, ...)\n *\n * Sub classes have to implement the parse() method which will be used in load().\n */\n\nfunction DataTextureLoader( manager ) {\n\n\tLoader.call( this, manager );\n\n}\n\nDataTextureLoader.prototype = Object.assign( Object.create( Loader.prototype ), {\n\n\tconstructor: DataTextureLoader,\n\n\tload: function ( url, onLoad, onProgress, onError ) {\n\n\t\tvar scope = this;\n\n\t\tvar texture = new DataTexture();\n\n\t\tvar loader = new FileLoader( this.manager );\n\t\tloader.setResponseType( 'arraybuffer' );\n\t\tloader.setPath( this.path );\n\t\tloader.load( url, function ( buffer ) {\n\n\t\t\tvar texData = scope.parse( buffer );\n\n\t\t\tif ( ! texData ) return;\n\n\t\t\tif ( texData.image !== undefined ) {\n\n\t\t\t\ttexture.image = texData.image;\n\n\t\t\t} else if ( texData.data !== undefined ) {\n\n\t\t\t\ttexture.image.width = texData.width;\n\t\t\t\ttexture.image.height = texData.height;\n\t\t\t\ttexture.image.data = texData.data;\n\n\t\t\t}\n\n\t\t\ttexture.wrapS = texData.wrapS !== undefined ? texData.wrapS : ClampToEdgeWrapping;\n\t\t\ttexture.wrapT = texData.wrapT !== undefined ? texData.wrapT : ClampToEdgeWrapping;\n\n\t\t\ttexture.magFilter = texData.magFilter !== undefined ? texData.magFilter : LinearFilter;\n\t\t\ttexture.minFilter = texData.minFilter !== undefined ? texData.minFilter : LinearFilter;\n\n\t\t\ttexture.anisotropy = texData.anisotropy !== undefined ? texData.anisotropy : 1;\n\n\t\t\tif ( texData.format !== undefined ) {\n\n\t\t\t\ttexture.format = texData.format;\n\n\t\t\t}\n\t\t\tif ( texData.type !== undefined ) {\n\n\t\t\t\ttexture.type = texData.type;\n\n\t\t\t}\n\n\t\t\tif ( texData.mipmaps !== undefined ) {\n\n\t\t\t\ttexture.mipmaps = texData.mipmaps;\n\t\t\t\ttexture.minFilter = LinearMipmapLinearFilter; // presumably...\n\n\t\t\t}\n\n\t\t\tif ( texData.mipmapCount === 1 ) {\n\n\t\t\t\ttexture.minFilter = LinearFilter;\n\n\t\t\t}\n\n\t\t\ttexture.needsUpdate = true;\n\n\t\t\tif ( onLoad ) onLoad( texture, texData );\n\n\t\t}, onProgress, onError );\n\n\n\t\treturn texture;\n\n\t}\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction ImageLoader( manager ) {\n\n\tLoader.call( this, manager );\n\n}\n\nImageLoader.prototype = Object.assign( Object.create( Loader.prototype ), {\n\n\tconstructor: ImageLoader,\n\n\tload: function ( url, onLoad, onProgress, onError ) {\n\n\t\tif ( this.path !== undefined ) url = this.path + url;\n\n\t\turl = this.manager.resolveURL( url );\n\n\t\tvar scope = this;\n\n\t\tvar cached = Cache.get( url );\n\n\t\tif ( cached !== undefined ) {\n\n\t\t\tscope.manager.itemStart( url );\n\n\t\t\tsetTimeout( function () {\n\n\t\t\t\tif ( onLoad ) onLoad( cached );\n\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t}, 0 );\n\n\t\t\treturn cached;\n\n\t\t}\n\n\t\tvar image = document.createElementNS( 'http://www.w3.org/1999/xhtml', 'img' );\n\n\t\tfunction onImageLoad() {\n\n\t\t\timage.removeEventListener( 'load', onImageLoad, false );\n\t\t\timage.removeEventListener( 'error', onImageError, false );\n\n\t\t\tCache.add( url, this );\n\n\t\t\tif ( onLoad ) onLoad( this );\n\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t}\n\n\t\tfunction onImageError( event ) {\n\n\t\t\timage.removeEventListener( 'load', onImageLoad, false );\n\t\t\timage.removeEventListener( 'error', onImageError, false );\n\n\t\t\tif ( onError ) onError( event );\n\n\t\t\tscope.manager.itemError( url );\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t}\n\n\t\timage.addEventListener( 'load', onImageLoad, false );\n\t\timage.addEventListener( 'error', onImageError, false );\n\n\t\tif ( url.substr( 0, 5 ) !== 'data:' ) {\n\n\t\t\tif ( this.crossOrigin !== undefined ) image.crossOrigin = this.crossOrigin;\n\n\t\t}\n\n\t\tscope.manager.itemStart( url );\n\n\t\timage.src = url;\n\n\t\treturn image;\n\n\t}\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\n\nfunction CubeTextureLoader( manager ) {\n\n\tLoader.call( this, manager );\n\n}\n\nCubeTextureLoader.prototype = Object.assign( Object.create( Loader.prototype ), {\n\n\tconstructor: CubeTextureLoader,\n\n\tload: function ( urls, onLoad, onProgress, onError ) {\n\n\t\tvar texture = new CubeTexture();\n\n\t\tvar loader = new ImageLoader( this.manager );\n\t\tloader.setCrossOrigin( this.crossOrigin );\n\t\tloader.setPath( this.path );\n\n\t\tvar loaded = 0;\n\n\t\tfunction loadTexture( i ) {\n\n\t\t\tloader.load( urls[ i ], function ( image ) {\n\n\t\t\t\ttexture.images[ i ] = image;\n\n\t\t\t\tloaded ++;\n\n\t\t\t\tif ( loaded === 6 ) {\n\n\t\t\t\t\ttexture.needsUpdate = true;\n\n\t\t\t\t\tif ( onLoad ) onLoad( texture );\n\n\t\t\t\t}\n\n\t\t\t}, undefined, onError );\n\n\t\t}\n\n\t\tfor ( var i = 0; i < urls.length; ++ i ) {\n\n\t\t\tloadTexture( i );\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction TextureLoader( manager ) {\n\n\tLoader.call( this, manager );\n\n}\n\nTextureLoader.prototype = Object.assign( Object.create( Loader.prototype ), {\n\n\tconstructor: TextureLoader,\n\n\tload: function ( url, onLoad, onProgress, onError ) {\n\n\t\tvar texture = new Texture();\n\n\t\tvar loader = new ImageLoader( this.manager );\n\t\tloader.setCrossOrigin( this.crossOrigin );\n\t\tloader.setPath( this.path );\n\n\t\tloader.load( url, function ( image ) {\n\n\t\t\ttexture.image = image;\n\n\t\t\t// JPEGs can't have an alpha channel, so memory can be saved by storing them as RGB.\n\t\t\tvar isJPEG = url.search( /\\.jpe?g($|\\?)/i ) > 0 || url.search( /^data\\:image\\/jpeg/ ) === 0;\n\n\t\t\ttexture.format = isJPEG ? RGBFormat : RGBAFormat;\n\t\t\ttexture.needsUpdate = true;\n\n\t\t\tif ( onLoad !== undefined ) {\n\n\t\t\t\tonLoad( texture );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t\treturn texture;\n\n\t}\n\n} );\n\n/**\n * @author zz85 / http://www.lab4games.net/zz85/blog\n * Extensible curve object\n *\n * Some common of curve methods:\n * .getPoint( t, optionalTarget ), .getTangent( t )\n * .getPointAt( u, optionalTarget ), .getTangentAt( u )\n * .getPoints(), .getSpacedPoints()\n * .getLength()\n * .updateArcLengths()\n *\n * This following curves inherit from THREE.Curve:\n *\n * -- 2D curves --\n * THREE.ArcCurve\n * THREE.CubicBezierCurve\n * THREE.EllipseCurve\n * THREE.LineCurve\n * THREE.QuadraticBezierCurve\n * THREE.SplineCurve\n *\n * -- 3D curves --\n * THREE.CatmullRomCurve3\n * THREE.CubicBezierCurve3\n * THREE.LineCurve3\n * THREE.QuadraticBezierCurve3\n *\n * A series of curves can be represented as a THREE.CurvePath.\n *\n **/\n\n/**************************************************************\n *\tAbstract Curve base class\n **************************************************************/\n\nfunction Curve() {\n\n\tthis.type = 'Curve';\n\n\tthis.arcLengthDivisions = 200;\n\n}\n\nObject.assign( Curve.prototype, {\n\n\t// Virtual base class method to overwrite and implement in subclasses\n\t//\t- t [0 .. 1]\n\n\tgetPoint: function ( /* t, optionalTarget */ ) {\n\n\t\tconsole.warn( 'THREE.Curve: .getPoint() not implemented.' );\n\t\treturn null;\n\n\t},\n\n\t// Get point at relative position in curve according to arc length\n\t// - u [0 .. 1]\n\n\tgetPointAt: function ( u, optionalTarget ) {\n\n\t\tvar t = this.getUtoTmapping( u );\n\t\treturn this.getPoint( t, optionalTarget );\n\n\t},\n\n\t// Get sequence of points using getPoint( t )\n\n\tgetPoints: function ( divisions ) {\n\n\t\tif ( divisions === undefined ) divisions = 5;\n\n\t\tvar points = [];\n\n\t\tfor ( var d = 0; d <= divisions; d ++ ) {\n\n\t\t\tpoints.push( this.getPoint( d / divisions ) );\n\n\t\t}\n\n\t\treturn points;\n\n\t},\n\n\t// Get sequence of points using getPointAt( u )\n\n\tgetSpacedPoints: function ( divisions ) {\n\n\t\tif ( divisions === undefined ) divisions = 5;\n\n\t\tvar points = [];\n\n\t\tfor ( var d = 0; d <= divisions; d ++ ) {\n\n\t\t\tpoints.push( this.getPointAt( d / divisions ) );\n\n\t\t}\n\n\t\treturn points;\n\n\t},\n\n\t// Get total curve arc length\n\n\tgetLength: function () {\n\n\t\tvar lengths = this.getLengths();\n\t\treturn lengths[ lengths.length - 1 ];\n\n\t},\n\n\t// Get list of cumulative segment lengths\n\n\tgetLengths: function ( divisions ) {\n\n\t\tif ( divisions === undefined ) divisions = this.arcLengthDivisions;\n\n\t\tif ( this.cacheArcLengths &&\n\t\t\t( this.cacheArcLengths.length === divisions + 1 ) &&\n\t\t\t! this.needsUpdate ) {\n\n\t\t\treturn this.cacheArcLengths;\n\n\t\t}\n\n\t\tthis.needsUpdate = false;\n\n\t\tvar cache = [];\n\t\tvar current, last = this.getPoint( 0 );\n\t\tvar p, sum = 0;\n\n\t\tcache.push( 0 );\n\n\t\tfor ( p = 1; p <= divisions; p ++ ) {\n\n\t\t\tcurrent = this.getPoint( p / divisions );\n\t\t\tsum += current.distanceTo( last );\n\t\t\tcache.push( sum );\n\t\t\tlast = current;\n\n\t\t}\n\n\t\tthis.cacheArcLengths = cache;\n\n\t\treturn cache; // { sums: cache, sum: sum }; Sum is in the last element.\n\n\t},\n\n\tupdateArcLengths: function () {\n\n\t\tthis.needsUpdate = true;\n\t\tthis.getLengths();\n\n\t},\n\n\t// Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant\n\n\tgetUtoTmapping: function ( u, distance ) {\n\n\t\tvar arcLengths = this.getLengths();\n\n\t\tvar i = 0, il = arcLengths.length;\n\n\t\tvar targetArcLength; // The targeted u distance value to get\n\n\t\tif ( distance ) {\n\n\t\t\ttargetArcLength = distance;\n\n\t\t} else {\n\n\t\t\ttargetArcLength = u * arcLengths[ il - 1 ];\n\n\t\t}\n\n\t\t// binary search for the index with largest value smaller than target u distance\n\n\t\tvar low = 0, high = il - 1, comparison;\n\n\t\twhile ( low <= high ) {\n\n\t\t\ti = Math.floor( low + ( high - low ) / 2 ); // less likely to overflow, though probably not issue here, JS doesn't really have integers, all numbers are floats\n\n\t\t\tcomparison = arcLengths[ i ] - targetArcLength;\n\n\t\t\tif ( comparison < 0 ) {\n\n\t\t\t\tlow = i + 1;\n\n\t\t\t} else if ( comparison > 0 ) {\n\n\t\t\t\thigh = i - 1;\n\n\t\t\t} else {\n\n\t\t\t\thigh = i;\n\t\t\t\tbreak;\n\n\t\t\t\t// DONE\n\n\t\t\t}\n\n\t\t}\n\n\t\ti = high;\n\n\t\tif ( arcLengths[ i ] === targetArcLength ) {\n\n\t\t\treturn i / ( il - 1 );\n\n\t\t}\n\n\t\t// we could get finer grain at lengths, or use simple interpolation between two points\n\n\t\tvar lengthBefore = arcLengths[ i ];\n\t\tvar lengthAfter = arcLengths[ i + 1 ];\n\n\t\tvar segmentLength = lengthAfter - lengthBefore;\n\n\t\t// determine where we are between the 'before' and 'after' points\n\n\t\tvar segmentFraction = ( targetArcLength - lengthBefore ) / segmentLength;\n\n\t\t// add that fractional amount to t\n\n\t\tvar t = ( i + segmentFraction ) / ( il - 1 );\n\n\t\treturn t;\n\n\t},\n\n\t// Returns a unit vector tangent at t\n\t// In case any sub curve does not implement its tangent derivation,\n\t// 2 points a small delta apart will be used to find its gradient\n\t// which seems to give a reasonable approximation\n\n\tgetTangent: function ( t ) {\n\n\t\tvar delta = 0.0001;\n\t\tvar t1 = t - delta;\n\t\tvar t2 = t + delta;\n\n\t\t// Capping in case of danger\n\n\t\tif ( t1 < 0 ) t1 = 0;\n\t\tif ( t2 > 1 ) t2 = 1;\n\n\t\tvar pt1 = this.getPoint( t1 );\n\t\tvar pt2 = this.getPoint( t2 );\n\n\t\tvar vec = pt2.clone().sub( pt1 );\n\t\treturn vec.normalize();\n\n\t},\n\n\tgetTangentAt: function ( u ) {\n\n\t\tvar t = this.getUtoTmapping( u );\n\t\treturn this.getTangent( t );\n\n\t},\n\n\tcomputeFrenetFrames: function ( segments, closed ) {\n\n\t\t// see http://www.cs.indiana.edu/pub/techreports/TR425.pdf\n\n\t\tvar normal = new Vector3();\n\n\t\tvar tangents = [];\n\t\tvar normals = [];\n\t\tvar binormals = [];\n\n\t\tvar vec = new Vector3();\n\t\tvar mat = new Matrix4();\n\n\t\tvar i, u, theta;\n\n\t\t// compute the tangent vectors for each segment on the curve\n\n\t\tfor ( i = 0; i <= segments; i ++ ) {\n\n\t\t\tu = i / segments;\n\n\t\t\ttangents[ i ] = this.getTangentAt( u );\n\t\t\ttangents[ i ].normalize();\n\n\t\t}\n\n\t\t// select an initial normal vector perpendicular to the first tangent vector,\n\t\t// and in the direction of the minimum tangent xyz component\n\n\t\tnormals[ 0 ] = new Vector3();\n\t\tbinormals[ 0 ] = new Vector3();\n\t\tvar min = Number.MAX_VALUE;\n\t\tvar tx = Math.abs( tangents[ 0 ].x );\n\t\tvar ty = Math.abs( tangents[ 0 ].y );\n\t\tvar tz = Math.abs( tangents[ 0 ].z );\n\n\t\tif ( tx <= min ) {\n\n\t\t\tmin = tx;\n\t\t\tnormal.set( 1, 0, 0 );\n\n\t\t}\n\n\t\tif ( ty <= min ) {\n\n\t\t\tmin = ty;\n\t\t\tnormal.set( 0, 1, 0 );\n\n\t\t}\n\n\t\tif ( tz <= min ) {\n\n\t\t\tnormal.set( 0, 0, 1 );\n\n\t\t}\n\n\t\tvec.crossVectors( tangents[ 0 ], normal ).normalize();\n\n\t\tnormals[ 0 ].crossVectors( tangents[ 0 ], vec );\n\t\tbinormals[ 0 ].crossVectors( tangents[ 0 ], normals[ 0 ] );\n\n\n\t\t// compute the slowly-varying normal and binormal vectors for each segment on the curve\n\n\t\tfor ( i = 1; i <= segments; i ++ ) {\n\n\t\t\tnormals[ i ] = normals[ i - 1 ].clone();\n\n\t\t\tbinormals[ i ] = binormals[ i - 1 ].clone();\n\n\t\t\tvec.crossVectors( tangents[ i - 1 ], tangents[ i ] );\n\n\t\t\tif ( vec.length() > Number.EPSILON ) {\n\n\t\t\t\tvec.normalize();\n\n\t\t\t\ttheta = Math.acos( MathUtils.clamp( tangents[ i - 1 ].dot( tangents[ i ] ), - 1, 1 ) ); // clamp for floating pt errors\n\n\t\t\t\tnormals[ i ].applyMatrix4( mat.makeRotationAxis( vec, theta ) );\n\n\t\t\t}\n\n\t\t\tbinormals[ i ].crossVectors( tangents[ i ], normals[ i ] );\n\n\t\t}\n\n\t\t// if the curve is closed, postprocess the vectors so the first and last normal vectors are the same\n\n\t\tif ( closed === true ) {\n\n\t\t\ttheta = Math.acos( MathUtils.clamp( normals[ 0 ].dot( normals[ segments ] ), - 1, 1 ) );\n\t\t\ttheta /= segments;\n\n\t\t\tif ( tangents[ 0 ].dot( vec.crossVectors( normals[ 0 ], normals[ segments ] ) ) > 0 ) {\n\n\t\t\t\ttheta = - theta;\n\n\t\t\t}\n\n\t\t\tfor ( i = 1; i <= segments; i ++ ) {\n\n\t\t\t\t// twist a little...\n\t\t\t\tnormals[ i ].applyMatrix4( mat.makeRotationAxis( tangents[ i ], theta * i ) );\n\t\t\t\tbinormals[ i ].crossVectors( tangents[ i ], normals[ i ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn {\n\t\t\ttangents: tangents,\n\t\t\tnormals: normals,\n\t\t\tbinormals: binormals\n\t\t};\n\n\t},\n\n\tclone: function () {\n\n\t\treturn new this.constructor().copy( this );\n\n\t},\n\n\tcopy: function ( source ) {\n\n\t\tthis.arcLengthDivisions = source.arcLengthDivisions;\n\n\t\treturn this;\n\n\t},\n\n\ttoJSON: function () {\n\n\t\tvar data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.5,\n\t\t\t\ttype: 'Curve',\n\t\t\t\tgenerator: 'Curve.toJSON'\n\t\t\t}\n\t\t};\n\n\t\tdata.arcLengthDivisions = this.arcLengthDivisions;\n\t\tdata.type = this.type;\n\n\t\treturn data;\n\n\t},\n\n\tfromJSON: function ( json ) {\n\n\t\tthis.arcLengthDivisions = json.arcLengthDivisions;\n\n\t\treturn this;\n\n\t}\n\n} );\n\nfunction EllipseCurve( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) {\n\n\tCurve.call( this );\n\n\tthis.type = 'EllipseCurve';\n\n\tthis.aX = aX || 0;\n\tthis.aY = aY || 0;\n\n\tthis.xRadius = xRadius || 1;\n\tthis.yRadius = yRadius || 1;\n\n\tthis.aStartAngle = aStartAngle || 0;\n\tthis.aEndAngle = aEndAngle || 2 * Math.PI;\n\n\tthis.aClockwise = aClockwise || false;\n\n\tthis.aRotation = aRotation || 0;\n\n}\n\nEllipseCurve.prototype = Object.create( Curve.prototype );\nEllipseCurve.prototype.constructor = EllipseCurve;\n\nEllipseCurve.prototype.isEllipseCurve = true;\n\nEllipseCurve.prototype.getPoint = function ( t, optionalTarget ) {\n\n\tvar point = optionalTarget || new Vector2();\n\n\tvar twoPi = Math.PI * 2;\n\tvar deltaAngle = this.aEndAngle - this.aStartAngle;\n\tvar samePoints = Math.abs( deltaAngle ) < Number.EPSILON;\n\n\t// ensures that deltaAngle is 0 .. 2 PI\n\twhile ( deltaAngle < 0 ) deltaAngle += twoPi;\n\twhile ( deltaAngle > twoPi ) deltaAngle -= twoPi;\n\n\tif ( deltaAngle < Number.EPSILON ) {\n\n\t\tif ( samePoints ) {\n\n\t\t\tdeltaAngle = 0;\n\n\t\t} else {\n\n\t\t\tdeltaAngle = twoPi;\n\n\t\t}\n\n\t}\n\n\tif ( this.aClockwise === true && ! samePoints ) {\n\n\t\tif ( deltaAngle === twoPi ) {\n\n\t\t\tdeltaAngle = - twoPi;\n\n\t\t} else {\n\n\t\t\tdeltaAngle = deltaAngle - twoPi;\n\n\t\t}\n\n\t}\n\n\tvar angle = this.aStartAngle + t * deltaAngle;\n\tvar x = this.aX + this.xRadius * Math.cos( angle );\n\tvar y = this.aY + this.yRadius * Math.sin( angle );\n\n\tif ( this.aRotation !== 0 ) {\n\n\t\tvar cos = Math.cos( this.aRotation );\n\t\tvar sin = Math.sin( this.aRotation );\n\n\t\tvar tx = x - this.aX;\n\t\tvar ty = y - this.aY;\n\n\t\t// Rotate the point about the center of the ellipse.\n\t\tx = tx * cos - ty * sin + this.aX;\n\t\ty = tx * sin + ty * cos + this.aY;\n\n\t}\n\n\treturn point.set( x, y );\n\n};\n\nEllipseCurve.prototype.copy = function ( source ) {\n\n\tCurve.prototype.copy.call( this, source );\n\n\tthis.aX = source.aX;\n\tthis.aY = source.aY;\n\n\tthis.xRadius = source.xRadius;\n\tthis.yRadius = source.yRadius;\n\n\tthis.aStartAngle = source.aStartAngle;\n\tthis.aEndAngle = source.aEndAngle;\n\n\tthis.aClockwise = source.aClockwise;\n\n\tthis.aRotation = source.aRotation;\n\n\treturn this;\n\n};\n\n\nEllipseCurve.prototype.toJSON = function () {\n\n\tvar data = Curve.prototype.toJSON.call( this );\n\n\tdata.aX = this.aX;\n\tdata.aY = this.aY;\n\n\tdata.xRadius = this.xRadius;\n\tdata.yRadius = this.yRadius;\n\n\tdata.aStartAngle = this.aStartAngle;\n\tdata.aEndAngle = this.aEndAngle;\n\n\tdata.aClockwise = this.aClockwise;\n\n\tdata.aRotation = this.aRotation;\n\n\treturn data;\n\n};\n\nEllipseCurve.prototype.fromJSON = function ( json ) {\n\n\tCurve.prototype.fromJSON.call( this, json );\n\n\tthis.aX = json.aX;\n\tthis.aY = json.aY;\n\n\tthis.xRadius = json.xRadius;\n\tthis.yRadius = json.yRadius;\n\n\tthis.aStartAngle = json.aStartAngle;\n\tthis.aEndAngle = json.aEndAngle;\n\n\tthis.aClockwise = json.aClockwise;\n\n\tthis.aRotation = json.aRotation;\n\n\treturn this;\n\n};\n\nfunction ArcCurve( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\n\n\tEllipseCurve.call( this, aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise );\n\n\tthis.type = 'ArcCurve';\n\n}\n\nArcCurve.prototype = Object.create( EllipseCurve.prototype );\nArcCurve.prototype.constructor = ArcCurve;\n\nArcCurve.prototype.isArcCurve = true;\n\n/**\n * @author zz85 https://github.com/zz85\n *\n * Centripetal CatmullRom Curve - which is useful for avoiding\n * cusps and self-intersections in non-uniform catmull rom curves.\n * http://www.cemyuksel.com/research/catmullrom_param/catmullrom.pdf\n *\n * curve.type accepts centripetal(default), chordal and catmullrom\n * curve.tension is used for catmullrom which defaults to 0.5\n */\n\n\n/*\nBased on an optimized c++ solution in\n - http://stackoverflow.com/questions/9489736/catmull-rom-curve-with-no-cusps-and-no-self-intersections/\n - http://ideone.com/NoEbVM\n\nThis CubicPoly class could be used for reusing some variables and calculations,\nbut for three.js curve use, it could be possible inlined and flatten into a single function call\nwhich can be placed in CurveUtils.\n*/\n\nfunction CubicPoly() {\n\n\tvar c0 = 0, c1 = 0, c2 = 0, c3 = 0;\n\n\t/*\n\t * Compute coefficients for a cubic polynomial\n\t * p(s) = c0 + c1*s + c2*s^2 + c3*s^3\n\t * such that\n\t * p(0) = x0, p(1) = x1\n\t * and\n\t * p'(0) = t0, p'(1) = t1.\n\t */\n\tfunction init( x0, x1, t0, t1 ) {\n\n\t\tc0 = x0;\n\t\tc1 = t0;\n\t\tc2 = - 3 * x0 + 3 * x1 - 2 * t0 - t1;\n\t\tc3 = 2 * x0 - 2 * x1 + t0 + t1;\n\n\t}\n\n\treturn {\n\n\t\tinitCatmullRom: function ( x0, x1, x2, x3, tension ) {\n\n\t\t\tinit( x1, x2, tension * ( x2 - x0 ), tension * ( x3 - x1 ) );\n\n\t\t},\n\n\t\tinitNonuniformCatmullRom: function ( x0, x1, x2, x3, dt0, dt1, dt2 ) {\n\n\t\t\t// compute tangents when parameterized in [t1,t2]\n\t\t\tvar t1 = ( x1 - x0 ) / dt0 - ( x2 - x0 ) / ( dt0 + dt1 ) + ( x2 - x1 ) / dt1;\n\t\t\tvar t2 = ( x2 - x1 ) / dt1 - ( x3 - x1 ) / ( dt1 + dt2 ) + ( x3 - x2 ) / dt2;\n\n\t\t\t// rescale tangents for parametrization in [0,1]\n\t\t\tt1 *= dt1;\n\t\t\tt2 *= dt1;\n\n\t\t\tinit( x1, x2, t1, t2 );\n\n\t\t},\n\n\t\tcalc: function ( t ) {\n\n\t\t\tvar t2 = t * t;\n\t\t\tvar t3 = t2 * t;\n\t\t\treturn c0 + c1 * t + c2 * t2 + c3 * t3;\n\n\t\t}\n\n\t};\n\n}\n\n//\n\nvar tmp = new Vector3();\nvar px = new CubicPoly(), py = new CubicPoly(), pz = new CubicPoly();\n\nfunction CatmullRomCurve3( points, closed, curveType, tension ) {\n\n\tCurve.call( this );\n\n\tthis.type = 'CatmullRomCurve3';\n\n\tthis.points = points || [];\n\tthis.closed = closed || false;\n\tthis.curveType = curveType || 'centripetal';\n\tthis.tension = tension || 0.5;\n\n}\n\nCatmullRomCurve3.prototype = Object.create( Curve.prototype );\nCatmullRomCurve3.prototype.constructor = CatmullRomCurve3;\n\nCatmullRomCurve3.prototype.isCatmullRomCurve3 = true;\n\nCatmullRomCurve3.prototype.getPoint = function ( t, optionalTarget ) {\n\n\tvar point = optionalTarget || new Vector3();\n\n\tvar points = this.points;\n\tvar l = points.length;\n\n\tvar p = ( l - ( this.closed ? 0 : 1 ) ) * t;\n\tvar intPoint = Math.floor( p );\n\tvar weight = p - intPoint;\n\n\tif ( this.closed ) {\n\n\t\tintPoint += intPoint > 0 ? 0 : ( Math.floor( Math.abs( intPoint ) / l ) + 1 ) * l;\n\n\t} else if ( weight === 0 && intPoint === l - 1 ) {\n\n\t\tintPoint = l - 2;\n\t\tweight = 1;\n\n\t}\n\n\tvar p0, p1, p2, p3; // 4 points\n\n\tif ( this.closed || intPoint > 0 ) {\n\n\t\tp0 = points[ ( intPoint - 1 ) % l ];\n\n\t} else {\n\n\t\t// extrapolate first point\n\t\ttmp.subVectors( points[ 0 ], points[ 1 ] ).add( points[ 0 ] );\n\t\tp0 = tmp;\n\n\t}\n\n\tp1 = points[ intPoint % l ];\n\tp2 = points[ ( intPoint + 1 ) % l ];\n\n\tif ( this.closed || intPoint + 2 < l ) {\n\n\t\tp3 = points[ ( intPoint + 2 ) % l ];\n\n\t} else {\n\n\t\t// extrapolate last point\n\t\ttmp.subVectors( points[ l - 1 ], points[ l - 2 ] ).add( points[ l - 1 ] );\n\t\tp3 = tmp;\n\n\t}\n\n\tif ( this.curveType === 'centripetal' || this.curveType === 'chordal' ) {\n\n\t\t// init Centripetal / Chordal Catmull-Rom\n\t\tvar pow = this.curveType === 'chordal' ? 0.5 : 0.25;\n\t\tvar dt0 = Math.pow( p0.distanceToSquared( p1 ), pow );\n\t\tvar dt1 = Math.pow( p1.distanceToSquared( p2 ), pow );\n\t\tvar dt2 = Math.pow( p2.distanceToSquared( p3 ), pow );\n\n\t\t// safety check for repeated points\n\t\tif ( dt1 < 1e-4 ) dt1 = 1.0;\n\t\tif ( dt0 < 1e-4 ) dt0 = dt1;\n\t\tif ( dt2 < 1e-4 ) dt2 = dt1;\n\n\t\tpx.initNonuniformCatmullRom( p0.x, p1.x, p2.x, p3.x, dt0, dt1, dt2 );\n\t\tpy.initNonuniformCatmullRom( p0.y, p1.y, p2.y, p3.y, dt0, dt1, dt2 );\n\t\tpz.initNonuniformCatmullRom( p0.z, p1.z, p2.z, p3.z, dt0, dt1, dt2 );\n\n\t} else if ( this.curveType === 'catmullrom' ) {\n\n\t\tpx.initCatmullRom( p0.x, p1.x, p2.x, p3.x, this.tension );\n\t\tpy.initCatmullRom( p0.y, p1.y, p2.y, p3.y, this.tension );\n\t\tpz.initCatmullRom( p0.z, p1.z, p2.z, p3.z, this.tension );\n\n\t}\n\n\tpoint.set(\n\t\tpx.calc( weight ),\n\t\tpy.calc( weight ),\n\t\tpz.calc( weight )\n\t);\n\n\treturn point;\n\n};\n\nCatmullRomCurve3.prototype.copy = function ( source ) {\n\n\tCurve.prototype.copy.call( this, source );\n\n\tthis.points = [];\n\n\tfor ( var i = 0, l = source.points.length; i < l; i ++ ) {\n\n\t\tvar point = source.points[ i ];\n\n\t\tthis.points.push( point.clone() );\n\n\t}\n\n\tthis.closed = source.closed;\n\tthis.curveType = source.curveType;\n\tthis.tension = source.tension;\n\n\treturn this;\n\n};\n\nCatmullRomCurve3.prototype.toJSON = function () {\n\n\tvar data = Curve.prototype.toJSON.call( this );\n\n\tdata.points = [];\n\n\tfor ( var i = 0, l = this.points.length; i < l; i ++ ) {\n\n\t\tvar point = this.points[ i ];\n\t\tdata.points.push( point.toArray() );\n\n\t}\n\n\tdata.closed = this.closed;\n\tdata.curveType = this.curveType;\n\tdata.tension = this.tension;\n\n\treturn data;\n\n};\n\nCatmullRomCurve3.prototype.fromJSON = function ( json ) {\n\n\tCurve.prototype.fromJSON.call( this, json );\n\n\tthis.points = [];\n\n\tfor ( var i = 0, l = json.points.length; i < l; i ++ ) {\n\n\t\tvar point = json.points[ i ];\n\t\tthis.points.push( new Vector3().fromArray( point ) );\n\n\t}\n\n\tthis.closed = json.closed;\n\tthis.curveType = json.curveType;\n\tthis.tension = json.tension;\n\n\treturn this;\n\n};\n\n/**\n * @author zz85 / http://www.lab4games.net/zz85/blog\n *\n * Bezier Curves formulas obtained from\n * http://en.wikipedia.org/wiki/Bézier_curve\n */\n\nfunction CatmullRom( t, p0, p1, p2, p3 ) {\n\n\tvar v0 = ( p2 - p0 ) * 0.5;\n\tvar v1 = ( p3 - p1 ) * 0.5;\n\tvar t2 = t * t;\n\tvar t3 = t * t2;\n\treturn ( 2 * p1 - 2 * p2 + v0 + v1 ) * t3 + ( - 3 * p1 + 3 * p2 - 2 * v0 - v1 ) * t2 + v0 * t + p1;\n\n}\n\n//\n\nfunction QuadraticBezierP0( t, p ) {\n\n\tvar k = 1 - t;\n\treturn k * k * p;\n\n}\n\nfunction QuadraticBezierP1( t, p ) {\n\n\treturn 2 * ( 1 - t ) * t * p;\n\n}\n\nfunction QuadraticBezierP2( t, p ) {\n\n\treturn t * t * p;\n\n}\n\nfunction QuadraticBezier( t, p0, p1, p2 ) {\n\n\treturn QuadraticBezierP0( t, p0 ) + QuadraticBezierP1( t, p1 ) +\n\t\tQuadraticBezierP2( t, p2 );\n\n}\n\n//\n\nfunction CubicBezierP0( t, p ) {\n\n\tvar k = 1 - t;\n\treturn k * k * k * p;\n\n}\n\nfunction CubicBezierP1( t, p ) {\n\n\tvar k = 1 - t;\n\treturn 3 * k * k * t * p;\n\n}\n\nfunction CubicBezierP2( t, p ) {\n\n\treturn 3 * ( 1 - t ) * t * t * p;\n\n}\n\nfunction CubicBezierP3( t, p ) {\n\n\treturn t * t * t * p;\n\n}\n\nfunction CubicBezier( t, p0, p1, p2, p3 ) {\n\n\treturn CubicBezierP0( t, p0 ) + CubicBezierP1( t, p1 ) + CubicBezierP2( t, p2 ) +\n\t\tCubicBezierP3( t, p3 );\n\n}\n\nfunction CubicBezierCurve( v0, v1, v2, v3 ) {\n\n\tCurve.call( this );\n\n\tthis.type = 'CubicBezierCurve';\n\n\tthis.v0 = v0 || new Vector2();\n\tthis.v1 = v1 || new Vector2();\n\tthis.v2 = v2 || new Vector2();\n\tthis.v3 = v3 || new Vector2();\n\n}\n\nCubicBezierCurve.prototype = Object.create( Curve.prototype );\nCubicBezierCurve.prototype.constructor = CubicBezierCurve;\n\nCubicBezierCurve.prototype.isCubicBezierCurve = true;\n\nCubicBezierCurve.prototype.getPoint = function ( t, optionalTarget ) {\n\n\tvar point = optionalTarget || new Vector2();\n\n\tvar v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3;\n\n\tpoint.set(\n\t\tCubicBezier( t, v0.x, v1.x, v2.x, v3.x ),\n\t\tCubicBezier( t, v0.y, v1.y, v2.y, v3.y )\n\t);\n\n\treturn point;\n\n};\n\nCubicBezierCurve.prototype.copy = function ( source ) {\n\n\tCurve.prototype.copy.call( this, source );\n\n\tthis.v0.copy( source.v0 );\n\tthis.v1.copy( source.v1 );\n\tthis.v2.copy( source.v2 );\n\tthis.v3.copy( source.v3 );\n\n\treturn this;\n\n};\n\nCubicBezierCurve.prototype.toJSON = function () {\n\n\tvar data = Curve.prototype.toJSON.call( this );\n\n\tdata.v0 = this.v0.toArray();\n\tdata.v1 = this.v1.toArray();\n\tdata.v2 = this.v2.toArray();\n\tdata.v3 = this.v3.toArray();\n\n\treturn data;\n\n};\n\nCubicBezierCurve.prototype.fromJSON = function ( json ) {\n\n\tCurve.prototype.fromJSON.call( this, json );\n\n\tthis.v0.fromArray( json.v0 );\n\tthis.v1.fromArray( json.v1 );\n\tthis.v2.fromArray( json.v2 );\n\tthis.v3.fromArray( json.v3 );\n\n\treturn this;\n\n};\n\nfunction CubicBezierCurve3( v0, v1, v2, v3 ) {\n\n\tCurve.call( this );\n\n\tthis.type = 'CubicBezierCurve3';\n\n\tthis.v0 = v0 || new Vector3();\n\tthis.v1 = v1 || new Vector3();\n\tthis.v2 = v2 || new Vector3();\n\tthis.v3 = v3 || new Vector3();\n\n}\n\nCubicBezierCurve3.prototype = Object.create( Curve.prototype );\nCubicBezierCurve3.prototype.constructor = CubicBezierCurve3;\n\nCubicBezierCurve3.prototype.isCubicBezierCurve3 = true;\n\nCubicBezierCurve3.prototype.getPoint = function ( t, optionalTarget ) {\n\n\tvar point = optionalTarget || new Vector3();\n\n\tvar v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3;\n\n\tpoint.set(\n\t\tCubicBezier( t, v0.x, v1.x, v2.x, v3.x ),\n\t\tCubicBezier( t, v0.y, v1.y, v2.y, v3.y ),\n\t\tCubicBezier( t, v0.z, v1.z, v2.z, v3.z )\n\t);\n\n\treturn point;\n\n};\n\nCubicBezierCurve3.prototype.copy = function ( source ) {\n\n\tCurve.prototype.copy.call( this, source );\n\n\tthis.v0.copy( source.v0 );\n\tthis.v1.copy( source.v1 );\n\tthis.v2.copy( source.v2 );\n\tthis.v3.copy( source.v3 );\n\n\treturn this;\n\n};\n\nCubicBezierCurve3.prototype.toJSON = function () {\n\n\tvar data = Curve.prototype.toJSON.call( this );\n\n\tdata.v0 = this.v0.toArray();\n\tdata.v1 = this.v1.toArray();\n\tdata.v2 = this.v2.toArray();\n\tdata.v3 = this.v3.toArray();\n\n\treturn data;\n\n};\n\nCubicBezierCurve3.prototype.fromJSON = function ( json ) {\n\n\tCurve.prototype.fromJSON.call( this, json );\n\n\tthis.v0.fromArray( json.v0 );\n\tthis.v1.fromArray( json.v1 );\n\tthis.v2.fromArray( json.v2 );\n\tthis.v3.fromArray( json.v3 );\n\n\treturn this;\n\n};\n\nfunction LineCurve( v1, v2 ) {\n\n\tCurve.call( this );\n\n\tthis.type = 'LineCurve';\n\n\tthis.v1 = v1 || new Vector2();\n\tthis.v2 = v2 || new Vector2();\n\n}\n\nLineCurve.prototype = Object.create( Curve.prototype );\nLineCurve.prototype.constructor = LineCurve;\n\nLineCurve.prototype.isLineCurve = true;\n\nLineCurve.prototype.getPoint = function ( t, optionalTarget ) {\n\n\tvar point = optionalTarget || new Vector2();\n\n\tif ( t === 1 ) {\n\n\t\tpoint.copy( this.v2 );\n\n\t} else {\n\n\t\tpoint.copy( this.v2 ).sub( this.v1 );\n\t\tpoint.multiplyScalar( t ).add( this.v1 );\n\n\t}\n\n\treturn point;\n\n};\n\n// Line curve is linear, so we can overwrite default getPointAt\n\nLineCurve.prototype.getPointAt = function ( u, optionalTarget ) {\n\n\treturn this.getPoint( u, optionalTarget );\n\n};\n\nLineCurve.prototype.getTangent = function ( /* t */ ) {\n\n\tvar tangent = this.v2.clone().sub( this.v1 );\n\n\treturn tangent.normalize();\n\n};\n\nLineCurve.prototype.copy = function ( source ) {\n\n\tCurve.prototype.copy.call( this, source );\n\n\tthis.v1.copy( source.v1 );\n\tthis.v2.copy( source.v2 );\n\n\treturn this;\n\n};\n\nLineCurve.prototype.toJSON = function () {\n\n\tvar data = Curve.prototype.toJSON.call( this );\n\n\tdata.v1 = this.v1.toArray();\n\tdata.v2 = this.v2.toArray();\n\n\treturn data;\n\n};\n\nLineCurve.prototype.fromJSON = function ( json ) {\n\n\tCurve.prototype.fromJSON.call( this, json );\n\n\tthis.v1.fromArray( json.v1 );\n\tthis.v2.fromArray( json.v2 );\n\n\treturn this;\n\n};\n\nfunction LineCurve3( v1, v2 ) {\n\n\tCurve.call( this );\n\n\tthis.type = 'LineCurve3';\n\n\tthis.v1 = v1 || new Vector3();\n\tthis.v2 = v2 || new Vector3();\n\n}\n\nLineCurve3.prototype = Object.create( Curve.prototype );\nLineCurve3.prototype.constructor = LineCurve3;\n\nLineCurve3.prototype.isLineCurve3 = true;\n\nLineCurve3.prototype.getPoint = function ( t, optionalTarget ) {\n\n\tvar point = optionalTarget || new Vector3();\n\n\tif ( t === 1 ) {\n\n\t\tpoint.copy( this.v2 );\n\n\t} else {\n\n\t\tpoint.copy( this.v2 ).sub( this.v1 );\n\t\tpoint.multiplyScalar( t ).add( this.v1 );\n\n\t}\n\n\treturn point;\n\n};\n\n// Line curve is linear, so we can overwrite default getPointAt\n\nLineCurve3.prototype.getPointAt = function ( u, optionalTarget ) {\n\n\treturn this.getPoint( u, optionalTarget );\n\n};\n\nLineCurve3.prototype.copy = function ( source ) {\n\n\tCurve.prototype.copy.call( this, source );\n\n\tthis.v1.copy( source.v1 );\n\tthis.v2.copy( source.v2 );\n\n\treturn this;\n\n};\n\nLineCurve3.prototype.toJSON = function () {\n\n\tvar data = Curve.prototype.toJSON.call( this );\n\n\tdata.v1 = this.v1.toArray();\n\tdata.v2 = this.v2.toArray();\n\n\treturn data;\n\n};\n\nLineCurve3.prototype.fromJSON = function ( json ) {\n\n\tCurve.prototype.fromJSON.call( this, json );\n\n\tthis.v1.fromArray( json.v1 );\n\tthis.v2.fromArray( json.v2 );\n\n\treturn this;\n\n};\n\nfunction QuadraticBezierCurve( v0, v1, v2 ) {\n\n\tCurve.call( this );\n\n\tthis.type = 'QuadraticBezierCurve';\n\n\tthis.v0 = v0 || new Vector2();\n\tthis.v1 = v1 || new Vector2();\n\tthis.v2 = v2 || new Vector2();\n\n}\n\nQuadraticBezierCurve.prototype = Object.create( Curve.prototype );\nQuadraticBezierCurve.prototype.constructor = QuadraticBezierCurve;\n\nQuadraticBezierCurve.prototype.isQuadraticBezierCurve = true;\n\nQuadraticBezierCurve.prototype.getPoint = function ( t, optionalTarget ) {\n\n\tvar point = optionalTarget || new Vector2();\n\n\tvar v0 = this.v0, v1 = this.v1, v2 = this.v2;\n\n\tpoint.set(\n\t\tQuadraticBezier( t, v0.x, v1.x, v2.x ),\n\t\tQuadraticBezier( t, v0.y, v1.y, v2.y )\n\t);\n\n\treturn point;\n\n};\n\nQuadraticBezierCurve.prototype.copy = function ( source ) {\n\n\tCurve.prototype.copy.call( this, source );\n\n\tthis.v0.copy( source.v0 );\n\tthis.v1.copy( source.v1 );\n\tthis.v2.copy( source.v2 );\n\n\treturn this;\n\n};\n\nQuadraticBezierCurve.prototype.toJSON = function () {\n\n\tvar data = Curve.prototype.toJSON.call( this );\n\n\tdata.v0 = this.v0.toArray();\n\tdata.v1 = this.v1.toArray();\n\tdata.v2 = this.v2.toArray();\n\n\treturn data;\n\n};\n\nQuadraticBezierCurve.prototype.fromJSON = function ( json ) {\n\n\tCurve.prototype.fromJSON.call( this, json );\n\n\tthis.v0.fromArray( json.v0 );\n\tthis.v1.fromArray( json.v1 );\n\tthis.v2.fromArray( json.v2 );\n\n\treturn this;\n\n};\n\nfunction QuadraticBezierCurve3( v0, v1, v2 ) {\n\n\tCurve.call( this );\n\n\tthis.type = 'QuadraticBezierCurve3';\n\n\tthis.v0 = v0 || new Vector3();\n\tthis.v1 = v1 || new Vector3();\n\tthis.v2 = v2 || new Vector3();\n\n}\n\nQuadraticBezierCurve3.prototype = Object.create( Curve.prototype );\nQuadraticBezierCurve3.prototype.constructor = QuadraticBezierCurve3;\n\nQuadraticBezierCurve3.prototype.isQuadraticBezierCurve3 = true;\n\nQuadraticBezierCurve3.prototype.getPoint = function ( t, optionalTarget ) {\n\n\tvar point = optionalTarget || new Vector3();\n\n\tvar v0 = this.v0, v1 = this.v1, v2 = this.v2;\n\n\tpoint.set(\n\t\tQuadraticBezier( t, v0.x, v1.x, v2.x ),\n\t\tQuadraticBezier( t, v0.y, v1.y, v2.y ),\n\t\tQuadraticBezier( t, v0.z, v1.z, v2.z )\n\t);\n\n\treturn point;\n\n};\n\nQuadraticBezierCurve3.prototype.copy = function ( source ) {\n\n\tCurve.prototype.copy.call( this, source );\n\n\tthis.v0.copy( source.v0 );\n\tthis.v1.copy( source.v1 );\n\tthis.v2.copy( source.v2 );\n\n\treturn this;\n\n};\n\nQuadraticBezierCurve3.prototype.toJSON = function () {\n\n\tvar data = Curve.prototype.toJSON.call( this );\n\n\tdata.v0 = this.v0.toArray();\n\tdata.v1 = this.v1.toArray();\n\tdata.v2 = this.v2.toArray();\n\n\treturn data;\n\n};\n\nQuadraticBezierCurve3.prototype.fromJSON = function ( json ) {\n\n\tCurve.prototype.fromJSON.call( this, json );\n\n\tthis.v0.fromArray( json.v0 );\n\tthis.v1.fromArray( json.v1 );\n\tthis.v2.fromArray( json.v2 );\n\n\treturn this;\n\n};\n\nfunction SplineCurve( points /* array of Vector2 */ ) {\n\n\tCurve.call( this );\n\n\tthis.type = 'SplineCurve';\n\n\tthis.points = points || [];\n\n}\n\nSplineCurve.prototype = Object.create( Curve.prototype );\nSplineCurve.prototype.constructor = SplineCurve;\n\nSplineCurve.prototype.isSplineCurve = true;\n\nSplineCurve.prototype.getPoint = function ( t, optionalTarget ) {\n\n\tvar point = optionalTarget || new Vector2();\n\n\tvar points = this.points;\n\tvar p = ( points.length - 1 ) * t;\n\n\tvar intPoint = Math.floor( p );\n\tvar weight = p - intPoint;\n\n\tvar p0 = points[ intPoint === 0 ? intPoint : intPoint - 1 ];\n\tvar p1 = points[ intPoint ];\n\tvar p2 = points[ intPoint > points.length - 2 ? points.length - 1 : intPoint + 1 ];\n\tvar p3 = points[ intPoint > points.length - 3 ? points.length - 1 : intPoint + 2 ];\n\n\tpoint.set(\n\t\tCatmullRom( weight, p0.x, p1.x, p2.x, p3.x ),\n\t\tCatmullRom( weight, p0.y, p1.y, p2.y, p3.y )\n\t);\n\n\treturn point;\n\n};\n\nSplineCurve.prototype.copy = function ( source ) {\n\n\tCurve.prototype.copy.call( this, source );\n\n\tthis.points = [];\n\n\tfor ( var i = 0, l = source.points.length; i < l; i ++ ) {\n\n\t\tvar point = source.points[ i ];\n\n\t\tthis.points.push( point.clone() );\n\n\t}\n\n\treturn this;\n\n};\n\nSplineCurve.prototype.toJSON = function () {\n\n\tvar data = Curve.prototype.toJSON.call( this );\n\n\tdata.points = [];\n\n\tfor ( var i = 0, l = this.points.length; i < l; i ++ ) {\n\n\t\tvar point = this.points[ i ];\n\t\tdata.points.push( point.toArray() );\n\n\t}\n\n\treturn data;\n\n};\n\nSplineCurve.prototype.fromJSON = function ( json ) {\n\n\tCurve.prototype.fromJSON.call( this, json );\n\n\tthis.points = [];\n\n\tfor ( var i = 0, l = json.points.length; i < l; i ++ ) {\n\n\t\tvar point = json.points[ i ];\n\t\tthis.points.push( new Vector2().fromArray( point ) );\n\n\t}\n\n\treturn this;\n\n};\n\n\n\nvar Curves = /*#__PURE__*/Object.freeze({\n\t__proto__: null,\n\tArcCurve: ArcCurve,\n\tCatmullRomCurve3: CatmullRomCurve3,\n\tCubicBezierCurve: CubicBezierCurve,\n\tCubicBezierCurve3: CubicBezierCurve3,\n\tEllipseCurve: EllipseCurve,\n\tLineCurve: LineCurve,\n\tLineCurve3: LineCurve3,\n\tQuadraticBezierCurve: QuadraticBezierCurve,\n\tQuadraticBezierCurve3: QuadraticBezierCurve3,\n\tSplineCurve: SplineCurve\n});\n\n/**\n * @author zz85 / http://www.lab4games.net/zz85/blog\n *\n **/\n\n/**************************************************************\n *\tCurved Path - a curve path is simply a array of connected\n * curves, but retains the api of a curve\n **************************************************************/\n\nfunction CurvePath() {\n\n\tCurve.call( this );\n\n\tthis.type = 'CurvePath';\n\n\tthis.curves = [];\n\tthis.autoClose = false; // Automatically closes the path\n\n}\n\nCurvePath.prototype = Object.assign( Object.create( Curve.prototype ), {\n\n\tconstructor: CurvePath,\n\n\tadd: function ( curve ) {\n\n\t\tthis.curves.push( curve );\n\n\t},\n\n\tclosePath: function () {\n\n\t\t// Add a line curve if start and end of lines are not connected\n\t\tvar startPoint = this.curves[ 0 ].getPoint( 0 );\n\t\tvar endPoint = this.curves[ this.curves.length - 1 ].getPoint( 1 );\n\n\t\tif ( ! startPoint.equals( endPoint ) ) {\n\n\t\t\tthis.curves.push( new LineCurve( endPoint, startPoint ) );\n\n\t\t}\n\n\t},\n\n\t// To get accurate point with reference to\n\t// entire path distance at time t,\n\t// following has to be done:\n\n\t// 1. Length of each sub path have to be known\n\t// 2. Locate and identify type of curve\n\t// 3. Get t for the curve\n\t// 4. Return curve.getPointAt(t')\n\n\tgetPoint: function ( t ) {\n\n\t\tvar d = t * this.getLength();\n\t\tvar curveLengths = this.getCurveLengths();\n\t\tvar i = 0;\n\n\t\t// To think about boundaries points.\n\n\t\twhile ( i < curveLengths.length ) {\n\n\t\t\tif ( curveLengths[ i ] >= d ) {\n\n\t\t\t\tvar diff = curveLengths[ i ] - d;\n\t\t\t\tvar curve = this.curves[ i ];\n\n\t\t\t\tvar segmentLength = curve.getLength();\n\t\t\t\tvar u = segmentLength === 0 ? 0 : 1 - diff / segmentLength;\n\n\t\t\t\treturn curve.getPointAt( u );\n\n\t\t\t}\n\n\t\t\ti ++;\n\n\t\t}\n\n\t\treturn null;\n\n\t\t// loop where sum != 0, sum > d , sum+1 1 && ! points[ points.length - 1 ].equals( points[ 0 ] ) ) {\n\n\t\t\tpoints.push( points[ 0 ] );\n\n\t\t}\n\n\t\treturn points;\n\n\t},\n\n\tcopy: function ( source ) {\n\n\t\tCurve.prototype.copy.call( this, source );\n\n\t\tthis.curves = [];\n\n\t\tfor ( var i = 0, l = source.curves.length; i < l; i ++ ) {\n\n\t\t\tvar curve = source.curves[ i ];\n\n\t\t\tthis.curves.push( curve.clone() );\n\n\t\t}\n\n\t\tthis.autoClose = source.autoClose;\n\n\t\treturn this;\n\n\t},\n\n\ttoJSON: function () {\n\n\t\tvar data = Curve.prototype.toJSON.call( this );\n\n\t\tdata.autoClose = this.autoClose;\n\t\tdata.curves = [];\n\n\t\tfor ( var i = 0, l = this.curves.length; i < l; i ++ ) {\n\n\t\t\tvar curve = this.curves[ i ];\n\t\t\tdata.curves.push( curve.toJSON() );\n\n\t\t}\n\n\t\treturn data;\n\n\t},\n\n\tfromJSON: function ( json ) {\n\n\t\tCurve.prototype.fromJSON.call( this, json );\n\n\t\tthis.autoClose = json.autoClose;\n\t\tthis.curves = [];\n\n\t\tfor ( var i = 0, l = json.curves.length; i < l; i ++ ) {\n\n\t\t\tvar curve = json.curves[ i ];\n\t\t\tthis.curves.push( new Curves[ curve.type ]().fromJSON( curve ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n} );\n\n/**\n * @author zz85 / http://www.lab4games.net/zz85/blog\n * Creates free form 2d path using series of points, lines or curves.\n **/\n\nfunction Path( points ) {\n\n\tCurvePath.call( this );\n\n\tthis.type = 'Path';\n\n\tthis.currentPoint = new Vector2();\n\n\tif ( points ) {\n\n\t\tthis.setFromPoints( points );\n\n\t}\n\n}\n\nPath.prototype = Object.assign( Object.create( CurvePath.prototype ), {\n\n\tconstructor: Path,\n\n\tsetFromPoints: function ( points ) {\n\n\t\tthis.moveTo( points[ 0 ].x, points[ 0 ].y );\n\n\t\tfor ( var i = 1, l = points.length; i < l; i ++ ) {\n\n\t\t\tthis.lineTo( points[ i ].x, points[ i ].y );\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tmoveTo: function ( x, y ) {\n\n\t\tthis.currentPoint.set( x, y ); // TODO consider referencing vectors instead of copying?\n\n\t\treturn this;\n\n\t},\n\n\tlineTo: function ( x, y ) {\n\n\t\tvar curve = new LineCurve( this.currentPoint.clone(), new Vector2( x, y ) );\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.set( x, y );\n\n\t\treturn this;\n\n\t},\n\n\tquadraticCurveTo: function ( aCPx, aCPy, aX, aY ) {\n\n\t\tvar curve = new QuadraticBezierCurve(\n\t\t\tthis.currentPoint.clone(),\n\t\t\tnew Vector2( aCPx, aCPy ),\n\t\t\tnew Vector2( aX, aY )\n\t\t);\n\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.set( aX, aY );\n\n\t\treturn this;\n\n\t},\n\n\tbezierCurveTo: function ( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY ) {\n\n\t\tvar curve = new CubicBezierCurve(\n\t\t\tthis.currentPoint.clone(),\n\t\t\tnew Vector2( aCP1x, aCP1y ),\n\t\t\tnew Vector2( aCP2x, aCP2y ),\n\t\t\tnew Vector2( aX, aY )\n\t\t);\n\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.set( aX, aY );\n\n\t\treturn this;\n\n\t},\n\n\tsplineThru: function ( pts /*Array of Vector*/ ) {\n\n\t\tvar npts = [ this.currentPoint.clone() ].concat( pts );\n\n\t\tvar curve = new SplineCurve( npts );\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.copy( pts[ pts.length - 1 ] );\n\n\t\treturn this;\n\n\t},\n\n\tarc: function ( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\n\n\t\tvar x0 = this.currentPoint.x;\n\t\tvar y0 = this.currentPoint.y;\n\n\t\tthis.absarc( aX + x0, aY + y0, aRadius,\n\t\t\taStartAngle, aEndAngle, aClockwise );\n\n\t\treturn this;\n\n\t},\n\n\tabsarc: function ( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\n\n\t\tthis.absellipse( aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise );\n\n\t\treturn this;\n\n\t},\n\n\tellipse: function ( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) {\n\n\t\tvar x0 = this.currentPoint.x;\n\t\tvar y0 = this.currentPoint.y;\n\n\t\tthis.absellipse( aX + x0, aY + y0, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation );\n\n\t\treturn this;\n\n\t},\n\n\tabsellipse: function ( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) {\n\n\t\tvar curve = new EllipseCurve( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation );\n\n\t\tif ( this.curves.length > 0 ) {\n\n\t\t\t// if a previous curve is present, attempt to join\n\t\t\tvar firstPoint = curve.getPoint( 0 );\n\n\t\t\tif ( ! firstPoint.equals( this.currentPoint ) ) {\n\n\t\t\t\tthis.lineTo( firstPoint.x, firstPoint.y );\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.curves.push( curve );\n\n\t\tvar lastPoint = curve.getPoint( 1 );\n\t\tthis.currentPoint.copy( lastPoint );\n\n\t\treturn this;\n\n\t},\n\n\tcopy: function ( source ) {\n\n\t\tCurvePath.prototype.copy.call( this, source );\n\n\t\tthis.currentPoint.copy( source.currentPoint );\n\n\t\treturn this;\n\n\t},\n\n\ttoJSON: function () {\n\n\t\tvar data = CurvePath.prototype.toJSON.call( this );\n\n\t\tdata.currentPoint = this.currentPoint.toArray();\n\n\t\treturn data;\n\n\t},\n\n\tfromJSON: function ( json ) {\n\n\t\tCurvePath.prototype.fromJSON.call( this, json );\n\n\t\tthis.currentPoint.fromArray( json.currentPoint );\n\n\t\treturn this;\n\n\t}\n\n} );\n\n/**\n * @author zz85 / http://www.lab4games.net/zz85/blog\n * Defines a 2d shape plane using paths.\n **/\n\n// STEP 1 Create a path.\n// STEP 2 Turn path into shape.\n// STEP 3 ExtrudeGeometry takes in Shape/Shapes\n// STEP 3a - Extract points from each shape, turn to vertices\n// STEP 3b - Triangulate each shape, add faces.\n\nfunction Shape( points ) {\n\n\tPath.call( this, points );\n\n\tthis.uuid = MathUtils.generateUUID();\n\n\tthis.type = 'Shape';\n\n\tthis.holes = [];\n\n}\n\nShape.prototype = Object.assign( Object.create( Path.prototype ), {\n\n\tconstructor: Shape,\n\n\tgetPointsHoles: function ( divisions ) {\n\n\t\tvar holesPts = [];\n\n\t\tfor ( var i = 0, l = this.holes.length; i < l; i ++ ) {\n\n\t\t\tholesPts[ i ] = this.holes[ i ].getPoints( divisions );\n\n\t\t}\n\n\t\treturn holesPts;\n\n\t},\n\n\t// get points of shape and holes (keypoints based on segments parameter)\n\n\textractPoints: function ( divisions ) {\n\n\t\treturn {\n\n\t\t\tshape: this.getPoints( divisions ),\n\t\t\tholes: this.getPointsHoles( divisions )\n\n\t\t};\n\n\t},\n\n\tcopy: function ( source ) {\n\n\t\tPath.prototype.copy.call( this, source );\n\n\t\tthis.holes = [];\n\n\t\tfor ( var i = 0, l = source.holes.length; i < l; i ++ ) {\n\n\t\t\tvar hole = source.holes[ i ];\n\n\t\t\tthis.holes.push( hole.clone() );\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\ttoJSON: function () {\n\n\t\tvar data = Path.prototype.toJSON.call( this );\n\n\t\tdata.uuid = this.uuid;\n\t\tdata.holes = [];\n\n\t\tfor ( var i = 0, l = this.holes.length; i < l; i ++ ) {\n\n\t\t\tvar hole = this.holes[ i ];\n\t\t\tdata.holes.push( hole.toJSON() );\n\n\t\t}\n\n\t\treturn data;\n\n\t},\n\n\tfromJSON: function ( json ) {\n\n\t\tPath.prototype.fromJSON.call( this, json );\n\n\t\tthis.uuid = json.uuid;\n\t\tthis.holes = [];\n\n\t\tfor ( var i = 0, l = json.holes.length; i < l; i ++ ) {\n\n\t\t\tvar hole = json.holes[ i ];\n\t\t\tthis.holes.push( new Path().fromJSON( hole ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n * @author alteredq / http://alteredqualia.com/\n */\n\nfunction Light( color, intensity ) {\n\n\tObject3D.call( this );\n\n\tthis.type = 'Light';\n\n\tthis.color = new Color( color );\n\tthis.intensity = intensity !== undefined ? intensity : 1;\n\n\tthis.receiveShadow = undefined;\n\n}\n\nLight.prototype = Object.assign( Object.create( Object3D.prototype ), {\n\n\tconstructor: Light,\n\n\tisLight: true,\n\n\tcopy: function ( source ) {\n\n\t\tObject3D.prototype.copy.call( this, source );\n\n\t\tthis.color.copy( source.color );\n\t\tthis.intensity = source.intensity;\n\n\t\treturn this;\n\n\t},\n\n\ttoJSON: function ( meta ) {\n\n\t\tvar data = Object3D.prototype.toJSON.call( this, meta );\n\n\t\tdata.object.color = this.color.getHex();\n\t\tdata.object.intensity = this.intensity;\n\n\t\tif ( this.groundColor !== undefined ) data.object.groundColor = this.groundColor.getHex();\n\n\t\tif ( this.distance !== undefined ) data.object.distance = this.distance;\n\t\tif ( this.angle !== undefined ) data.object.angle = this.angle;\n\t\tif ( this.decay !== undefined ) data.object.decay = this.decay;\n\t\tif ( this.penumbra !== undefined ) data.object.penumbra = this.penumbra;\n\n\t\tif ( this.shadow !== undefined ) data.object.shadow = this.shadow.toJSON();\n\n\t\treturn data;\n\n\t}\n\n} );\n\n/**\n * @author alteredq / http://alteredqualia.com/\n */\n\nfunction HemisphereLight( skyColor, groundColor, intensity ) {\n\n\tLight.call( this, skyColor, intensity );\n\n\tthis.type = 'HemisphereLight';\n\n\tthis.castShadow = undefined;\n\n\tthis.position.copy( Object3D.DefaultUp );\n\tthis.updateMatrix();\n\n\tthis.groundColor = new Color( groundColor );\n\n}\n\nHemisphereLight.prototype = Object.assign( Object.create( Light.prototype ), {\n\n\tconstructor: HemisphereLight,\n\n\tisHemisphereLight: true,\n\n\tcopy: function ( source ) {\n\n\t\tLight.prototype.copy.call( this, source );\n\n\t\tthis.groundColor.copy( source.groundColor );\n\n\t\treturn this;\n\n\t}\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction LightShadow( camera ) {\n\n\tthis.camera = camera;\n\n\tthis.bias = 0;\n\tthis.radius = 1;\n\n\tthis.mapSize = new Vector2( 512, 512 );\n\n\tthis.map = null;\n\tthis.mapPass = null;\n\tthis.matrix = new Matrix4();\n\n\tthis._frustum = new Frustum();\n\tthis._frameExtents = new Vector2( 1, 1 );\n\n\tthis._viewportCount = 1;\n\n\tthis._viewports = [\n\n\t\tnew Vector4( 0, 0, 1, 1 )\n\n\t];\n\n}\n\nObject.assign( LightShadow.prototype, {\n\n\t_projScreenMatrix: new Matrix4(),\n\n\t_lightPositionWorld: new Vector3(),\n\n\t_lookTarget: new Vector3(),\n\n\tgetViewportCount: function () {\n\n\t\treturn this._viewportCount;\n\n\t},\n\n\tgetFrustum: function () {\n\n\t\treturn this._frustum;\n\n\t},\n\n\tupdateMatrices: function ( light ) {\n\n\t\tvar shadowCamera = this.camera,\n\t\t\tshadowMatrix = this.matrix,\n\t\t\tprojScreenMatrix = this._projScreenMatrix,\n\t\t\tlookTarget = this._lookTarget,\n\t\t\tlightPositionWorld = this._lightPositionWorld;\n\n\t\tlightPositionWorld.setFromMatrixPosition( light.matrixWorld );\n\t\tshadowCamera.position.copy( lightPositionWorld );\n\n\t\tlookTarget.setFromMatrixPosition( light.target.matrixWorld );\n\t\tshadowCamera.lookAt( lookTarget );\n\t\tshadowCamera.updateMatrixWorld();\n\n\t\tprojScreenMatrix.multiplyMatrices( shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse );\n\t\tthis._frustum.setFromProjectionMatrix( projScreenMatrix );\n\n\t\tshadowMatrix.set(\n\t\t\t0.5, 0.0, 0.0, 0.5,\n\t\t\t0.0, 0.5, 0.0, 0.5,\n\t\t\t0.0, 0.0, 0.5, 0.5,\n\t\t\t0.0, 0.0, 0.0, 1.0\n\t\t);\n\n\t\tshadowMatrix.multiply( shadowCamera.projectionMatrix );\n\t\tshadowMatrix.multiply( shadowCamera.matrixWorldInverse );\n\n\t},\n\n\tgetViewport: function ( viewportIndex ) {\n\n\t\treturn this._viewports[ viewportIndex ];\n\n\t},\n\n\tgetFrameExtents: function () {\n\n\t\treturn this._frameExtents;\n\n\t},\n\n\tcopy: function ( source ) {\n\n\t\tthis.camera = source.camera.clone();\n\n\t\tthis.bias = source.bias;\n\t\tthis.radius = source.radius;\n\n\t\tthis.mapSize.copy( source.mapSize );\n\n\t\treturn this;\n\n\t},\n\n\tclone: function () {\n\n\t\treturn new this.constructor().copy( this );\n\n\t},\n\n\ttoJSON: function () {\n\n\t\tvar object = {};\n\n\t\tif ( this.bias !== 0 ) object.bias = this.bias;\n\t\tif ( this.radius !== 1 ) object.radius = this.radius;\n\t\tif ( this.mapSize.x !== 512 || this.mapSize.y !== 512 ) object.mapSize = this.mapSize.toArray();\n\n\t\tobject.camera = this.camera.toJSON( false ).object;\n\t\tdelete object.camera.matrix;\n\n\t\treturn object;\n\n\t}\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction SpotLightShadow() {\n\n\tLightShadow.call( this, new PerspectiveCamera( 50, 1, 0.5, 500 ) );\n\n}\n\nSpotLightShadow.prototype = Object.assign( Object.create( LightShadow.prototype ), {\n\n\tconstructor: SpotLightShadow,\n\n\tisSpotLightShadow: true,\n\n\tupdateMatrices: function ( light ) {\n\n\t\tvar camera = this.camera;\n\n\t\tvar fov = MathUtils.RAD2DEG * 2 * light.angle;\n\t\tvar aspect = this.mapSize.width / this.mapSize.height;\n\t\tvar far = light.distance || camera.far;\n\n\t\tif ( fov !== camera.fov || aspect !== camera.aspect || far !== camera.far ) {\n\n\t\t\tcamera.fov = fov;\n\t\t\tcamera.aspect = aspect;\n\t\t\tcamera.far = far;\n\t\t\tcamera.updateProjectionMatrix();\n\n\t\t}\n\n\t\tLightShadow.prototype.updateMatrices.call( this, light );\n\n\t}\n\n} );\n\n/**\n * @author alteredq / http://alteredqualia.com/\n */\n\nfunction SpotLight( color, intensity, distance, angle, penumbra, decay ) {\n\n\tLight.call( this, color, intensity );\n\n\tthis.type = 'SpotLight';\n\n\tthis.position.copy( Object3D.DefaultUp );\n\tthis.updateMatrix();\n\n\tthis.target = new Object3D();\n\n\tObject.defineProperty( this, 'power', {\n\t\tget: function () {\n\n\t\t\t// intensity = power per solid angle.\n\t\t\t// ref: equation (17) from https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\n\t\t\treturn this.intensity * Math.PI;\n\n\t\t},\n\t\tset: function ( power ) {\n\n\t\t\t// intensity = power per solid angle.\n\t\t\t// ref: equation (17) from https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\n\t\t\tthis.intensity = power / Math.PI;\n\n\t\t}\n\t} );\n\n\tthis.distance = ( distance !== undefined ) ? distance : 0;\n\tthis.angle = ( angle !== undefined ) ? angle : Math.PI / 3;\n\tthis.penumbra = ( penumbra !== undefined ) ? penumbra : 0;\n\tthis.decay = ( decay !== undefined ) ? decay : 1;\t// for physically correct lights, should be 2.\n\n\tthis.shadow = new SpotLightShadow();\n\n}\n\nSpotLight.prototype = Object.assign( Object.create( Light.prototype ), {\n\n\tconstructor: SpotLight,\n\n\tisSpotLight: true,\n\n\tcopy: function ( source ) {\n\n\t\tLight.prototype.copy.call( this, source );\n\n\t\tthis.distance = source.distance;\n\t\tthis.angle = source.angle;\n\t\tthis.penumbra = source.penumbra;\n\t\tthis.decay = source.decay;\n\n\t\tthis.target = source.target.clone();\n\n\t\tthis.shadow = source.shadow.clone();\n\n\t\treturn this;\n\n\t}\n\n} );\n\nfunction PointLightShadow() {\n\n\tLightShadow.call( this, new PerspectiveCamera( 90, 1, 0.5, 500 ) );\n\n\tthis._frameExtents = new Vector2( 4, 2 );\n\n\tthis._viewportCount = 6;\n\n\tthis._viewports = [\n\t\t// These viewports map a cube-map onto a 2D texture with the\n\t\t// following orientation:\n\t\t//\n\t\t// xzXZ\n\t\t// y Y\n\t\t//\n\t\t// X - Positive x direction\n\t\t// x - Negative x direction\n\t\t// Y - Positive y direction\n\t\t// y - Negative y direction\n\t\t// Z - Positive z direction\n\t\t// z - Negative z direction\n\n\t\t// positive X\n\t\tnew Vector4( 2, 1, 1, 1 ),\n\t\t// negative X\n\t\tnew Vector4( 0, 1, 1, 1 ),\n\t\t// positive Z\n\t\tnew Vector4( 3, 1, 1, 1 ),\n\t\t// negative Z\n\t\tnew Vector4( 1, 1, 1, 1 ),\n\t\t// positive Y\n\t\tnew Vector4( 3, 0, 1, 1 ),\n\t\t// negative Y\n\t\tnew Vector4( 1, 0, 1, 1 )\n\t];\n\n\tthis._cubeDirections = [\n\t\tnew Vector3( 1, 0, 0 ), new Vector3( - 1, 0, 0 ), new Vector3( 0, 0, 1 ),\n\t\tnew Vector3( 0, 0, - 1 ), new Vector3( 0, 1, 0 ), new Vector3( 0, - 1, 0 )\n\t];\n\n\tthis._cubeUps = [\n\t\tnew Vector3( 0, 1, 0 ), new Vector3( 0, 1, 0 ), new Vector3( 0, 1, 0 ),\n\t\tnew Vector3( 0, 1, 0 ), new Vector3( 0, 0, 1 ),\tnew Vector3( 0, 0, - 1 )\n\t];\n\n}\n\nPointLightShadow.prototype = Object.assign( Object.create( LightShadow.prototype ), {\n\n\tconstructor: PointLightShadow,\n\n\tisPointLightShadow: true,\n\n\tupdateMatrices: function ( light, viewportIndex ) {\n\n\t\tif ( viewportIndex === undefined ) viewportIndex = 0;\n\n\t\tvar camera = this.camera,\n\t\t\tshadowMatrix = this.matrix,\n\t\t\tlightPositionWorld = this._lightPositionWorld,\n\t\t\tlookTarget = this._lookTarget,\n\t\t\tprojScreenMatrix = this._projScreenMatrix;\n\n\t\tlightPositionWorld.setFromMatrixPosition( light.matrixWorld );\n\t\tcamera.position.copy( lightPositionWorld );\n\n\t\tlookTarget.copy( camera.position );\n\t\tlookTarget.add( this._cubeDirections[ viewportIndex ] );\n\t\tcamera.up.copy( this._cubeUps[ viewportIndex ] );\n\t\tcamera.lookAt( lookTarget );\n\t\tcamera.updateMatrixWorld();\n\n\t\tshadowMatrix.makeTranslation( - lightPositionWorld.x, - lightPositionWorld.y, - lightPositionWorld.z );\n\n\t\tprojScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );\n\t\tthis._frustum.setFromProjectionMatrix( projScreenMatrix );\n\n\t}\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\n\nfunction PointLight( color, intensity, distance, decay ) {\n\n\tLight.call( this, color, intensity );\n\n\tthis.type = 'PointLight';\n\n\tObject.defineProperty( this, 'power', {\n\t\tget: function () {\n\n\t\t\t// intensity = power per solid angle.\n\t\t\t// ref: equation (15) from https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\n\t\t\treturn this.intensity * 4 * Math.PI;\n\n\t\t},\n\t\tset: function ( power ) {\n\n\t\t\t// intensity = power per solid angle.\n\t\t\t// ref: equation (15) from https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\n\t\t\tthis.intensity = power / ( 4 * Math.PI );\n\n\t\t}\n\t} );\n\n\tthis.distance = ( distance !== undefined ) ? distance : 0;\n\tthis.decay = ( decay !== undefined ) ? decay : 1;\t// for physically correct lights, should be 2.\n\n\tthis.shadow = new PointLightShadow();\n\n}\n\nPointLight.prototype = Object.assign( Object.create( Light.prototype ), {\n\n\tconstructor: PointLight,\n\n\tisPointLight: true,\n\n\tcopy: function ( source ) {\n\n\t\tLight.prototype.copy.call( this, source );\n\n\t\tthis.distance = source.distance;\n\t\tthis.decay = source.decay;\n\n\t\tthis.shadow = source.shadow.clone();\n\n\t\treturn this;\n\n\t}\n\n} );\n\n/**\n * @author alteredq / http://alteredqualia.com/\n * @author arose / http://github.com/arose\n */\n\nfunction OrthographicCamera( left, right, top, bottom, near, far ) {\n\n\tCamera.call( this );\n\n\tthis.type = 'OrthographicCamera';\n\n\tthis.zoom = 1;\n\tthis.view = null;\n\n\tthis.left = ( left !== undefined ) ? left : - 1;\n\tthis.right = ( right !== undefined ) ? right : 1;\n\tthis.top = ( top !== undefined ) ? top : 1;\n\tthis.bottom = ( bottom !== undefined ) ? bottom : - 1;\n\n\tthis.near = ( near !== undefined ) ? near : 0.1;\n\tthis.far = ( far !== undefined ) ? far : 2000;\n\n\tthis.updateProjectionMatrix();\n\n}\n\nOrthographicCamera.prototype = Object.assign( Object.create( Camera.prototype ), {\n\n\tconstructor: OrthographicCamera,\n\n\tisOrthographicCamera: true,\n\n\tcopy: function ( source, recursive ) {\n\n\t\tCamera.prototype.copy.call( this, source, recursive );\n\n\t\tthis.left = source.left;\n\t\tthis.right = source.right;\n\t\tthis.top = source.top;\n\t\tthis.bottom = source.bottom;\n\t\tthis.near = source.near;\n\t\tthis.far = source.far;\n\n\t\tthis.zoom = source.zoom;\n\t\tthis.view = source.view === null ? null : Object.assign( {}, source.view );\n\n\t\treturn this;\n\n\t},\n\n\tsetViewOffset: function ( fullWidth, fullHeight, x, y, width, height ) {\n\n\t\tif ( this.view === null ) {\n\n\t\t\tthis.view = {\n\t\t\t\tenabled: true,\n\t\t\t\tfullWidth: 1,\n\t\t\t\tfullHeight: 1,\n\t\t\t\toffsetX: 0,\n\t\t\t\toffsetY: 0,\n\t\t\t\twidth: 1,\n\t\t\t\theight: 1\n\t\t\t};\n\n\t\t}\n\n\t\tthis.view.enabled = true;\n\t\tthis.view.fullWidth = fullWidth;\n\t\tthis.view.fullHeight = fullHeight;\n\t\tthis.view.offsetX = x;\n\t\tthis.view.offsetY = y;\n\t\tthis.view.width = width;\n\t\tthis.view.height = height;\n\n\t\tthis.updateProjectionMatrix();\n\n\t},\n\n\tclearViewOffset: function () {\n\n\t\tif ( this.view !== null ) {\n\n\t\t\tthis.view.enabled = false;\n\n\t\t}\n\n\t\tthis.updateProjectionMatrix();\n\n\t},\n\n\tupdateProjectionMatrix: function () {\n\n\t\tvar dx = ( this.right - this.left ) / ( 2 * this.zoom );\n\t\tvar dy = ( this.top - this.bottom ) / ( 2 * this.zoom );\n\t\tvar cx = ( this.right + this.left ) / 2;\n\t\tvar cy = ( this.top + this.bottom ) / 2;\n\n\t\tvar left = cx - dx;\n\t\tvar right = cx + dx;\n\t\tvar top = cy + dy;\n\t\tvar bottom = cy - dy;\n\n\t\tif ( this.view !== null && this.view.enabled ) {\n\n\t\t\tvar scaleW = ( this.right - this.left ) / this.view.fullWidth / this.zoom;\n\t\t\tvar scaleH = ( this.top - this.bottom ) / this.view.fullHeight / this.zoom;\n\n\t\t\tleft += scaleW * this.view.offsetX;\n\t\t\tright = left + scaleW * this.view.width;\n\t\t\ttop -= scaleH * this.view.offsetY;\n\t\t\tbottom = top - scaleH * this.view.height;\n\n\t\t}\n\n\t\tthis.projectionMatrix.makeOrthographic( left, right, top, bottom, this.near, this.far );\n\n\t\tthis.projectionMatrixInverse.getInverse( this.projectionMatrix );\n\n\t},\n\n\ttoJSON: function ( meta ) {\n\n\t\tvar data = Object3D.prototype.toJSON.call( this, meta );\n\n\t\tdata.object.zoom = this.zoom;\n\t\tdata.object.left = this.left;\n\t\tdata.object.right = this.right;\n\t\tdata.object.top = this.top;\n\t\tdata.object.bottom = this.bottom;\n\t\tdata.object.near = this.near;\n\t\tdata.object.far = this.far;\n\n\t\tif ( this.view !== null ) data.object.view = Object.assign( {}, this.view );\n\n\t\treturn data;\n\n\t}\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction DirectionalLightShadow() {\n\n\tLightShadow.call( this, new OrthographicCamera( - 5, 5, 5, - 5, 0.5, 500 ) );\n\n}\n\nDirectionalLightShadow.prototype = Object.assign( Object.create( LightShadow.prototype ), {\n\n\tconstructor: DirectionalLightShadow,\n\n\tisDirectionalLightShadow: true,\n\n\tupdateMatrices: function ( light ) {\n\n\t\tLightShadow.prototype.updateMatrices.call( this, light );\n\n\t}\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n * @author alteredq / http://alteredqualia.com/\n */\n\nfunction DirectionalLight( color, intensity ) {\n\n\tLight.call( this, color, intensity );\n\n\tthis.type = 'DirectionalLight';\n\n\tthis.position.copy( Object3D.DefaultUp );\n\tthis.updateMatrix();\n\n\tthis.target = new Object3D();\n\n\tthis.shadow = new DirectionalLightShadow();\n\n}\n\nDirectionalLight.prototype = Object.assign( Object.create( Light.prototype ), {\n\n\tconstructor: DirectionalLight,\n\n\tisDirectionalLight: true,\n\n\tcopy: function ( source ) {\n\n\t\tLight.prototype.copy.call( this, source );\n\n\t\tthis.target = source.target.clone();\n\n\t\tthis.shadow = source.shadow.clone();\n\n\t\treturn this;\n\n\t}\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction AmbientLight( color, intensity ) {\n\n\tLight.call( this, color, intensity );\n\n\tthis.type = 'AmbientLight';\n\n\tthis.castShadow = undefined;\n\n}\n\nAmbientLight.prototype = Object.assign( Object.create( Light.prototype ), {\n\n\tconstructor: AmbientLight,\n\n\tisAmbientLight: true\n\n} );\n\n/**\n * @author abelnation / http://github.com/abelnation\n */\n\nfunction RectAreaLight( color, intensity, width, height ) {\n\n\tLight.call( this, color, intensity );\n\n\tthis.type = 'RectAreaLight';\n\n\tthis.width = ( width !== undefined ) ? width : 10;\n\tthis.height = ( height !== undefined ) ? height : 10;\n\n}\n\nRectAreaLight.prototype = Object.assign( Object.create( Light.prototype ), {\n\n\tconstructor: RectAreaLight,\n\n\tisRectAreaLight: true,\n\n\tcopy: function ( source ) {\n\n\t\tLight.prototype.copy.call( this, source );\n\n\t\tthis.width = source.width;\n\t\tthis.height = source.height;\n\n\t\treturn this;\n\n\t},\n\n\ttoJSON: function ( meta ) {\n\n\t\tvar data = Light.prototype.toJSON.call( this, meta );\n\n\t\tdata.object.width = this.width;\n\t\tdata.object.height = this.height;\n\n\t\treturn data;\n\n\t}\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction MaterialLoader( manager ) {\n\n\tLoader.call( this, manager );\n\n\tthis.textures = {};\n\n}\n\nMaterialLoader.prototype = Object.assign( Object.create( Loader.prototype ), {\n\n\tconstructor: MaterialLoader,\n\n\tload: function ( url, onLoad, onProgress, onError ) {\n\n\t\tvar scope = this;\n\n\t\tvar loader = new FileLoader( scope.manager );\n\t\tloader.setPath( scope.path );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\tonLoad( scope.parse( JSON.parse( text ) ) );\n\n\t\t}, onProgress, onError );\n\n\t},\n\n\tparse: function ( json ) {\n\n\t\tvar textures = this.textures;\n\n\t\tfunction getTexture( name ) {\n\n\t\t\tif ( textures[ name ] === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.MaterialLoader: Undefined texture', name );\n\n\t\t\t}\n\n\t\t\treturn textures[ name ];\n\n\t\t}\n\n\t\tvar material = new Materials[ json.type ]();\n\n\t\tif ( json.uuid !== undefined ) material.uuid = json.uuid;\n\t\tif ( json.name !== undefined ) material.name = json.name;\n\t\tif ( json.color !== undefined ) material.color.setHex( json.color );\n\t\tif ( json.roughness !== undefined ) material.roughness = json.roughness;\n\t\tif ( json.metalness !== undefined ) material.metalness = json.metalness;\n\t\tif ( json.sheen !== undefined ) material.sheen = new Color().setHex( json.sheen );\n\t\tif ( json.emissive !== undefined ) material.emissive.setHex( json.emissive );\n\t\tif ( json.specular !== undefined ) material.specular.setHex( json.specular );\n\t\tif ( json.shininess !== undefined ) material.shininess = json.shininess;\n\t\tif ( json.clearcoat !== undefined ) material.clearcoat = json.clearcoat;\n\t\tif ( json.clearcoatRoughness !== undefined ) material.clearcoatRoughness = json.clearcoatRoughness;\n\t\tif ( json.vertexColors !== undefined ) material.vertexColors = json.vertexColors;\n\t\tif ( json.fog !== undefined ) material.fog = json.fog;\n\t\tif ( json.flatShading !== undefined ) material.flatShading = json.flatShading;\n\t\tif ( json.blending !== undefined ) material.blending = json.blending;\n\t\tif ( json.combine !== undefined ) material.combine = json.combine;\n\t\tif ( json.side !== undefined ) material.side = json.side;\n\t\tif ( json.opacity !== undefined ) material.opacity = json.opacity;\n\t\tif ( json.transparent !== undefined ) material.transparent = json.transparent;\n\t\tif ( json.alphaTest !== undefined ) material.alphaTest = json.alphaTest;\n\t\tif ( json.depthTest !== undefined ) material.depthTest = json.depthTest;\n\t\tif ( json.depthWrite !== undefined ) material.depthWrite = json.depthWrite;\n\t\tif ( json.colorWrite !== undefined ) material.colorWrite = json.colorWrite;\n\n\t\tif ( json.stencilWrite !== undefined ) material.stencilWrite = json.stencilWrite;\n\t\tif ( json.stencilWriteMask !== undefined ) material.stencilWriteMask = json.stencilWriteMask;\n\t\tif ( json.stencilFunc !== undefined ) material.stencilFunc = json.stencilFunc;\n\t\tif ( json.stencilRef !== undefined ) material.stencilRef = json.stencilRef;\n\t\tif ( json.stencilFuncMask !== undefined ) material.stencilFuncMask = json.stencilFuncMask;\n\t\tif ( json.stencilFail !== undefined ) material.stencilFail = json.stencilFail;\n\t\tif ( json.stencilZFail !== undefined ) material.stencilZFail = json.stencilZFail;\n\t\tif ( json.stencilZPass !== undefined ) material.stencilZPass = json.stencilZPass;\n\n\t\tif ( json.wireframe !== undefined ) material.wireframe = json.wireframe;\n\t\tif ( json.wireframeLinewidth !== undefined ) material.wireframeLinewidth = json.wireframeLinewidth;\n\t\tif ( json.wireframeLinecap !== undefined ) material.wireframeLinecap = json.wireframeLinecap;\n\t\tif ( json.wireframeLinejoin !== undefined ) material.wireframeLinejoin = json.wireframeLinejoin;\n\n\t\tif ( json.rotation !== undefined ) material.rotation = json.rotation;\n\n\t\tif ( json.linewidth !== 1 ) material.linewidth = json.linewidth;\n\t\tif ( json.dashSize !== undefined ) material.dashSize = json.dashSize;\n\t\tif ( json.gapSize !== undefined ) material.gapSize = json.gapSize;\n\t\tif ( json.scale !== undefined ) material.scale = json.scale;\n\n\t\tif ( json.polygonOffset !== undefined ) material.polygonOffset = json.polygonOffset;\n\t\tif ( json.polygonOffsetFactor !== undefined ) material.polygonOffsetFactor = json.polygonOffsetFactor;\n\t\tif ( json.polygonOffsetUnits !== undefined ) material.polygonOffsetUnits = json.polygonOffsetUnits;\n\n\t\tif ( json.skinning !== undefined ) material.skinning = json.skinning;\n\t\tif ( json.morphTargets !== undefined ) material.morphTargets = json.morphTargets;\n\t\tif ( json.morphNormals !== undefined ) material.morphNormals = json.morphNormals;\n\t\tif ( json.dithering !== undefined ) material.dithering = json.dithering;\n\n\t\tif ( json.visible !== undefined ) material.visible = json.visible;\n\n\t\tif ( json.toneMapped !== undefined ) material.toneMapped = json.toneMapped;\n\n\t\tif ( json.userData !== undefined ) material.userData = json.userData;\n\n\t\t// Shader Material\n\n\t\tif ( json.uniforms !== undefined ) {\n\n\t\t\tfor ( var name in json.uniforms ) {\n\n\t\t\t\tvar uniform = json.uniforms[ name ];\n\n\t\t\t\tmaterial.uniforms[ name ] = {};\n\n\t\t\t\tswitch ( uniform.type ) {\n\n\t\t\t\t\tcase 't':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = getTexture( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'c':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Color().setHex( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'v2':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Vector2().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'v3':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Vector3().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'v4':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Vector4().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'm3':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Matrix3().fromArray( uniform.value );\n\n\t\t\t\t\tcase 'm4':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Matrix4().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = uniform.value;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( json.defines !== undefined ) material.defines = json.defines;\n\t\tif ( json.vertexShader !== undefined ) material.vertexShader = json.vertexShader;\n\t\tif ( json.fragmentShader !== undefined ) material.fragmentShader = json.fragmentShader;\n\n\t\tif ( json.extensions !== undefined ) {\n\n\t\t\tfor ( var key in json.extensions ) {\n\n\t\t\t\tmaterial.extensions[ key ] = json.extensions[ key ];\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Deprecated\n\n\t\tif ( json.shading !== undefined ) material.flatShading = json.shading === 1; // THREE.FlatShading\n\n\t\t// for PointsMaterial\n\n\t\tif ( json.size !== undefined ) material.size = json.size;\n\t\tif ( json.sizeAttenuation !== undefined ) material.sizeAttenuation = json.sizeAttenuation;\n\n\t\t// maps\n\n\t\tif ( json.map !== undefined ) material.map = getTexture( json.map );\n\t\tif ( json.matcap !== undefined ) material.matcap = getTexture( json.matcap );\n\n\t\tif ( json.alphaMap !== undefined ) {\n\n\t\t\tmaterial.alphaMap = getTexture( json.alphaMap );\n\t\t\tmaterial.transparent = true;\n\n\t\t}\n\n\t\tif ( json.bumpMap !== undefined ) material.bumpMap = getTexture( json.bumpMap );\n\t\tif ( json.bumpScale !== undefined ) material.bumpScale = json.bumpScale;\n\n\t\tif ( json.normalMap !== undefined ) material.normalMap = getTexture( json.normalMap );\n\t\tif ( json.normalMapType !== undefined ) material.normalMapType = json.normalMapType;\n\t\tif ( json.normalScale !== undefined ) {\n\n\t\t\tvar normalScale = json.normalScale;\n\n\t\t\tif ( Array.isArray( normalScale ) === false ) {\n\n\t\t\t\t// Blender exporter used to export a scalar. See #7459\n\n\t\t\t\tnormalScale = [ normalScale, normalScale ];\n\n\t\t\t}\n\n\t\t\tmaterial.normalScale = new Vector2().fromArray( normalScale );\n\n\t\t}\n\n\t\tif ( json.displacementMap !== undefined ) material.displacementMap = getTexture( json.displacementMap );\n\t\tif ( json.displacementScale !== undefined ) material.displacementScale = json.displacementScale;\n\t\tif ( json.displacementBias !== undefined ) material.displacementBias = json.displacementBias;\n\n\t\tif ( json.roughnessMap !== undefined ) material.roughnessMap = getTexture( json.roughnessMap );\n\t\tif ( json.metalnessMap !== undefined ) material.metalnessMap = getTexture( json.metalnessMap );\n\n\t\tif ( json.emissiveMap !== undefined ) material.emissiveMap = getTexture( json.emissiveMap );\n\t\tif ( json.emissiveIntensity !== undefined ) material.emissiveIntensity = json.emissiveIntensity;\n\n\t\tif ( json.specularMap !== undefined ) material.specularMap = getTexture( json.specularMap );\n\n\t\tif ( json.envMap !== undefined ) material.envMap = getTexture( json.envMap );\n\t\tif ( json.envMapIntensity !== undefined ) material.envMapIntensity = json.envMapIntensity;\n\n\t\tif ( json.reflectivity !== undefined ) material.reflectivity = json.reflectivity;\n\t\tif ( json.refractionRatio !== undefined ) material.refractionRatio = json.refractionRatio;\n\n\t\tif ( json.lightMap !== undefined ) material.lightMap = getTexture( json.lightMap );\n\t\tif ( json.lightMapIntensity !== undefined ) material.lightMapIntensity = json.lightMapIntensity;\n\n\t\tif ( json.aoMap !== undefined ) material.aoMap = getTexture( json.aoMap );\n\t\tif ( json.aoMapIntensity !== undefined ) material.aoMapIntensity = json.aoMapIntensity;\n\n\t\tif ( json.gradientMap !== undefined ) material.gradientMap = getTexture( json.gradientMap );\n\n\t\tif ( json.clearcoatNormalMap !== undefined ) material.clearcoatNormalMap = getTexture( json.clearcoatNormalMap );\n\t\tif ( json.clearcoatNormalScale !== undefined ) material.clearcoatNormalScale = new Vector2().fromArray( json.clearcoatNormalScale );\n\n\t\treturn material;\n\n\t},\n\n\tsetTextures: function ( value ) {\n\n\t\tthis.textures = value;\n\t\treturn this;\n\n\t}\n\n} );\n\n/**\n * @author Don McCurdy / https://www.donmccurdy.com\n */\n\nvar LoaderUtils = {\n\n\tdecodeText: function ( array ) {\n\n\t\tif ( typeof TextDecoder !== 'undefined' ) {\n\n\t\t\treturn new TextDecoder().decode( array );\n\n\t\t}\n\n\t\t// Avoid the String.fromCharCode.apply(null, array) shortcut, which\n\t\t// throws a \"maximum call stack size exceeded\" error for large arrays.\n\n\t\tvar s = '';\n\n\t\tfor ( var i = 0, il = array.length; i < il; i ++ ) {\n\n\t\t\t// Implicitly assumes little-endian.\n\t\t\ts += String.fromCharCode( array[ i ] );\n\n\t\t}\n\n\t\ttry {\n\n\t\t\t// merges multi-byte utf-8 characters.\n\n\t\t\treturn decodeURIComponent( escape( s ) );\n\n\t\t} catch ( e ) { // see #16358\n\n\t\t\treturn s;\n\n\t\t}\n\n\t},\n\n\textractUrlBase: function ( url ) {\n\n\t\tvar index = url.lastIndexOf( '/' );\n\n\t\tif ( index === - 1 ) return './';\n\n\t\treturn url.substr( 0, index + 1 );\n\n\t}\n\n};\n\n/**\n * @author benaadams / https://twitter.com/ben_a_adams\n */\n\nfunction InstancedBufferGeometry() {\n\n\tBufferGeometry.call( this );\n\n\tthis.type = 'InstancedBufferGeometry';\n\tthis.maxInstancedCount = undefined;\n\n}\n\nInstancedBufferGeometry.prototype = Object.assign( Object.create( BufferGeometry.prototype ), {\n\n\tconstructor: InstancedBufferGeometry,\n\n\tisInstancedBufferGeometry: true,\n\n\tcopy: function ( source ) {\n\n\t\tBufferGeometry.prototype.copy.call( this, source );\n\n\t\tthis.maxInstancedCount = source.maxInstancedCount;\n\n\t\treturn this;\n\n\t},\n\n\tclone: function () {\n\n\t\treturn new this.constructor().copy( this );\n\n\t},\n\n\ttoJSON: function () {\n\n\t\tvar data = BufferGeometry.prototype.toJSON.call( this );\n\n\t\tdata.maxInstancedCount = this.maxInstancedCount;\n\n\t\tdata.isInstancedBufferGeometry = true;\n\n\t\treturn data;\n\n\t}\n\n} );\n\n/**\n * @author benaadams / https://twitter.com/ben_a_adams\n */\n\nfunction InstancedBufferAttribute( array, itemSize, normalized, meshPerAttribute ) {\n\n\tif ( typeof ( normalized ) === 'number' ) {\n\n\t\tmeshPerAttribute = normalized;\n\n\t\tnormalized = false;\n\n\t\tconsole.error( 'THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.' );\n\n\t}\n\n\tBufferAttribute.call( this, array, itemSize, normalized );\n\n\tthis.meshPerAttribute = meshPerAttribute || 1;\n\n}\n\nInstancedBufferAttribute.prototype = Object.assign( Object.create( BufferAttribute.prototype ), {\n\n\tconstructor: InstancedBufferAttribute,\n\n\tisInstancedBufferAttribute: true,\n\n\tcopy: function ( source ) {\n\n\t\tBufferAttribute.prototype.copy.call( this, source );\n\n\t\tthis.meshPerAttribute = source.meshPerAttribute;\n\n\t\treturn this;\n\n\t},\n\n\ttoJSON: function ()\t{\n\n\t\tvar data = BufferAttribute.prototype.toJSON.call( this );\n\n\t\tdata.meshPerAttribute = this.meshPerAttribute;\n\n\t\tdata.isInstancedBufferAttribute = true;\n\n\t\treturn data;\n\n\t}\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction BufferGeometryLoader( manager ) {\n\n\tLoader.call( this, manager );\n\n}\n\nBufferGeometryLoader.prototype = Object.assign( Object.create( Loader.prototype ), {\n\n\tconstructor: BufferGeometryLoader,\n\n\tload: function ( url, onLoad, onProgress, onError ) {\n\n\t\tvar scope = this;\n\n\t\tvar loader = new FileLoader( scope.manager );\n\t\tloader.setPath( scope.path );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\tonLoad( scope.parse( JSON.parse( text ) ) );\n\n\t\t}, onProgress, onError );\n\n\t},\n\n\tparse: function ( json ) {\n\n\t\tvar geometry = json.isInstancedBufferGeometry ? new InstancedBufferGeometry() : new BufferGeometry();\n\n\t\tvar index = json.data.index;\n\n\t\tif ( index !== undefined ) {\n\n\t\t\tvar typedArray = new TYPED_ARRAYS[ index.type ]( index.array );\n\t\t\tgeometry.setIndex( new BufferAttribute( typedArray, 1 ) );\n\n\t\t}\n\n\t\tvar attributes = json.data.attributes;\n\n\t\tfor ( var key in attributes ) {\n\n\t\t\tvar attribute = attributes[ key ];\n\t\t\tvar typedArray = new TYPED_ARRAYS[ attribute.type ]( attribute.array );\n\t\t\tvar bufferAttributeConstr = attribute.isInstancedBufferAttribute ? InstancedBufferAttribute : BufferAttribute;\n\t\t\tvar bufferAttribute = new bufferAttributeConstr( typedArray, attribute.itemSize, attribute.normalized );\n\t\t\tif ( attribute.name !== undefined ) bufferAttribute.name = attribute.name;\n\t\t\tgeometry.setAttribute( key, bufferAttribute );\n\n\t\t}\n\n\t\tvar morphAttributes = json.data.morphAttributes;\n\n\t\tif ( morphAttributes ) {\n\n\t\t\tfor ( var key in morphAttributes ) {\n\n\t\t\t\tvar attributeArray = morphAttributes[ key ];\n\n\t\t\t\tvar array = [];\n\n\t\t\t\tfor ( var i = 0, il = attributeArray.length; i < il; i ++ ) {\n\n\t\t\t\t\tvar attribute = attributeArray[ i ];\n\t\t\t\t\tvar typedArray = new TYPED_ARRAYS[ attribute.type ]( attribute.array );\n\n\t\t\t\t\tvar bufferAttribute = new BufferAttribute( typedArray, attribute.itemSize, attribute.normalized );\n\t\t\t\t\tif ( attribute.name !== undefined ) bufferAttribute.name = attribute.name;\n\t\t\t\t\tarray.push( bufferAttribute );\n\n\t\t\t\t}\n\n\t\t\t\tgeometry.morphAttributes[ key ] = array;\n\n\t\t\t}\n\n\t\t}\n\n\t\tvar morphTargetsRelative = json.data.morphTargetsRelative;\n\n\t\tif ( morphTargetsRelative ) {\n\n\t\t\tgeometry.morphTargetsRelative = true;\n\n\t\t}\n\n\t\tvar groups = json.data.groups || json.data.drawcalls || json.data.offsets;\n\n\t\tif ( groups !== undefined ) {\n\n\t\t\tfor ( var i = 0, n = groups.length; i !== n; ++ i ) {\n\n\t\t\t\tvar group = groups[ i ];\n\n\t\t\t\tgeometry.addGroup( group.start, group.count, group.materialIndex );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvar boundingSphere = json.data.boundingSphere;\n\n\t\tif ( boundingSphere !== undefined ) {\n\n\t\t\tvar center = new Vector3();\n\n\t\t\tif ( boundingSphere.center !== undefined ) {\n\n\t\t\t\tcenter.fromArray( boundingSphere.center );\n\n\t\t\t}\n\n\t\t\tgeometry.boundingSphere = new Sphere( center, boundingSphere.radius );\n\n\t\t}\n\n\t\tif ( json.name ) geometry.name = json.name;\n\t\tif ( json.userData ) geometry.userData = json.userData;\n\n\t\treturn geometry;\n\n\t}\n\n} );\n\nvar TYPED_ARRAYS = {\n\tInt8Array: Int8Array,\n\tUint8Array: Uint8Array,\n\t// Workaround for IE11 pre KB2929437. See #11440\n\tUint8ClampedArray: typeof Uint8ClampedArray !== 'undefined' ? Uint8ClampedArray : Uint8Array,\n\tInt16Array: Int16Array,\n\tUint16Array: Uint16Array,\n\tInt32Array: Int32Array,\n\tUint32Array: Uint32Array,\n\tFloat32Array: Float32Array,\n\tFloat64Array: Float64Array\n};\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction ObjectLoader( manager ) {\n\n\tLoader.call( this, manager );\n\n}\n\nObjectLoader.prototype = Object.assign( Object.create( Loader.prototype ), {\n\n\tconstructor: ObjectLoader,\n\n\tload: function ( url, onLoad, onProgress, onError ) {\n\n\t\tvar scope = this;\n\n\t\tvar path = ( this.path === '' ) ? LoaderUtils.extractUrlBase( url ) : this.path;\n\t\tthis.resourcePath = this.resourcePath || path;\n\n\t\tvar loader = new FileLoader( scope.manager );\n\t\tloader.setPath( this.path );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\tvar json = null;\n\n\t\t\ttry {\n\n\t\t\t\tjson = JSON.parse( text );\n\n\t\t\t} catch ( error ) {\n\n\t\t\t\tif ( onError !== undefined ) onError( error );\n\n\t\t\t\tconsole.error( 'THREE:ObjectLoader: Can\\'t parse ' + url + '.', error.message );\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tvar metadata = json.metadata;\n\n\t\t\tif ( metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry' ) {\n\n\t\t\t\tconsole.error( 'THREE.ObjectLoader: Can\\'t load ' + url );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tscope.parse( json, onLoad );\n\n\t\t}, onProgress, onError );\n\n\t},\n\n\tparse: function ( json, onLoad ) {\n\n\t\tvar shapes = this.parseShape( json.shapes );\n\t\tvar geometries = this.parseGeometries( json.geometries, shapes );\n\n\t\tvar images = this.parseImages( json.images, function () {\n\n\t\t\tif ( onLoad !== undefined ) onLoad( object );\n\n\t\t} );\n\n\t\tvar textures = this.parseTextures( json.textures, images );\n\t\tvar materials = this.parseMaterials( json.materials, textures );\n\n\t\tvar object = this.parseObject( json.object, geometries, materials );\n\n\t\tif ( json.animations ) {\n\n\t\t\tobject.animations = this.parseAnimations( json.animations );\n\n\t\t}\n\n\t\tif ( json.images === undefined || json.images.length === 0 ) {\n\n\t\t\tif ( onLoad !== undefined ) onLoad( object );\n\n\t\t}\n\n\t\treturn object;\n\n\t},\n\n\tparseShape: function ( json ) {\n\n\t\tvar shapes = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tfor ( var i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tvar shape = new Shape().fromJSON( json[ i ] );\n\n\t\t\t\tshapes[ shape.uuid ] = shape;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn shapes;\n\n\t},\n\n\tparseGeometries: function ( json, shapes ) {\n\n\t\tvar geometries = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tvar bufferGeometryLoader = new BufferGeometryLoader();\n\n\t\t\tfor ( var i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tvar geometry;\n\t\t\t\tvar data = json[ i ];\n\n\t\t\t\tswitch ( data.type ) {\n\n\t\t\t\t\tcase 'PlaneGeometry':\n\t\t\t\t\tcase 'PlaneBufferGeometry':\n\n\t\t\t\t\t\tgeometry = new Geometries[ data.type ](\n\t\t\t\t\t\t\tdata.width,\n\t\t\t\t\t\t\tdata.height,\n\t\t\t\t\t\t\tdata.widthSegments,\n\t\t\t\t\t\t\tdata.heightSegments\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'BoxGeometry':\n\t\t\t\t\tcase 'BoxBufferGeometry':\n\t\t\t\t\tcase 'CubeGeometry': // backwards compatible\n\n\t\t\t\t\t\tgeometry = new Geometries[ data.type ](\n\t\t\t\t\t\t\tdata.width,\n\t\t\t\t\t\t\tdata.height,\n\t\t\t\t\t\t\tdata.depth,\n\t\t\t\t\t\t\tdata.widthSegments,\n\t\t\t\t\t\t\tdata.heightSegments,\n\t\t\t\t\t\t\tdata.depthSegments\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'CircleGeometry':\n\t\t\t\t\tcase 'CircleBufferGeometry':\n\n\t\t\t\t\t\tgeometry = new Geometries[ data.type ](\n\t\t\t\t\t\t\tdata.radius,\n\t\t\t\t\t\t\tdata.segments,\n\t\t\t\t\t\t\tdata.thetaStart,\n\t\t\t\t\t\t\tdata.thetaLength\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'CylinderGeometry':\n\t\t\t\t\tcase 'CylinderBufferGeometry':\n\n\t\t\t\t\t\tgeometry = new Geometries[ data.type ](\n\t\t\t\t\t\t\tdata.radiusTop,\n\t\t\t\t\t\t\tdata.radiusBottom,\n\t\t\t\t\t\t\tdata.height,\n\t\t\t\t\t\t\tdata.radialSegments,\n\t\t\t\t\t\t\tdata.heightSegments,\n\t\t\t\t\t\t\tdata.openEnded,\n\t\t\t\t\t\t\tdata.thetaStart,\n\t\t\t\t\t\t\tdata.thetaLength\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'ConeGeometry':\n\t\t\t\t\tcase 'ConeBufferGeometry':\n\n\t\t\t\t\t\tgeometry = new Geometries[ data.type ](\n\t\t\t\t\t\t\tdata.radius,\n\t\t\t\t\t\t\tdata.height,\n\t\t\t\t\t\t\tdata.radialSegments,\n\t\t\t\t\t\t\tdata.heightSegments,\n\t\t\t\t\t\t\tdata.openEnded,\n\t\t\t\t\t\t\tdata.thetaStart,\n\t\t\t\t\t\t\tdata.thetaLength\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'SphereGeometry':\n\t\t\t\t\tcase 'SphereBufferGeometry':\n\n\t\t\t\t\t\tgeometry = new Geometries[ data.type ](\n\t\t\t\t\t\t\tdata.radius,\n\t\t\t\t\t\t\tdata.widthSegments,\n\t\t\t\t\t\t\tdata.heightSegments,\n\t\t\t\t\t\t\tdata.phiStart,\n\t\t\t\t\t\t\tdata.phiLength,\n\t\t\t\t\t\t\tdata.thetaStart,\n\t\t\t\t\t\t\tdata.thetaLength\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'DodecahedronGeometry':\n\t\t\t\t\tcase 'DodecahedronBufferGeometry':\n\t\t\t\t\tcase 'IcosahedronGeometry':\n\t\t\t\t\tcase 'IcosahedronBufferGeometry':\n\t\t\t\t\tcase 'OctahedronGeometry':\n\t\t\t\t\tcase 'OctahedronBufferGeometry':\n\t\t\t\t\tcase 'TetrahedronGeometry':\n\t\t\t\t\tcase 'TetrahedronBufferGeometry':\n\n\t\t\t\t\t\tgeometry = new Geometries[ data.type ](\n\t\t\t\t\t\t\tdata.radius,\n\t\t\t\t\t\t\tdata.detail\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'RingGeometry':\n\t\t\t\t\tcase 'RingBufferGeometry':\n\n\t\t\t\t\t\tgeometry = new Geometries[ data.type ](\n\t\t\t\t\t\t\tdata.innerRadius,\n\t\t\t\t\t\t\tdata.outerRadius,\n\t\t\t\t\t\t\tdata.thetaSegments,\n\t\t\t\t\t\t\tdata.phiSegments,\n\t\t\t\t\t\t\tdata.thetaStart,\n\t\t\t\t\t\t\tdata.thetaLength\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'TorusGeometry':\n\t\t\t\t\tcase 'TorusBufferGeometry':\n\n\t\t\t\t\t\tgeometry = new Geometries[ data.type ](\n\t\t\t\t\t\t\tdata.radius,\n\t\t\t\t\t\t\tdata.tube,\n\t\t\t\t\t\t\tdata.radialSegments,\n\t\t\t\t\t\t\tdata.tubularSegments,\n\t\t\t\t\t\t\tdata.arc\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'TorusKnotGeometry':\n\t\t\t\t\tcase 'TorusKnotBufferGeometry':\n\n\t\t\t\t\t\tgeometry = new Geometries[ data.type ](\n\t\t\t\t\t\t\tdata.radius,\n\t\t\t\t\t\t\tdata.tube,\n\t\t\t\t\t\t\tdata.tubularSegments,\n\t\t\t\t\t\t\tdata.radialSegments,\n\t\t\t\t\t\t\tdata.p,\n\t\t\t\t\t\t\tdata.q\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'TubeGeometry':\n\t\t\t\t\tcase 'TubeBufferGeometry':\n\n\t\t\t\t\t\t// This only works for built-in curves (e.g. CatmullRomCurve3).\n\t\t\t\t\t\t// User defined curves or instances of CurvePath will not be deserialized.\n\t\t\t\t\t\tgeometry = new Geometries[ data.type ](\n\t\t\t\t\t\t\tnew Curves[ data.path.type ]().fromJSON( data.path ),\n\t\t\t\t\t\t\tdata.tubularSegments,\n\t\t\t\t\t\t\tdata.radius,\n\t\t\t\t\t\t\tdata.radialSegments,\n\t\t\t\t\t\t\tdata.closed\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'LatheGeometry':\n\t\t\t\t\tcase 'LatheBufferGeometry':\n\n\t\t\t\t\t\tgeometry = new Geometries[ data.type ](\n\t\t\t\t\t\t\tdata.points,\n\t\t\t\t\t\t\tdata.segments,\n\t\t\t\t\t\t\tdata.phiStart,\n\t\t\t\t\t\t\tdata.phiLength\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'PolyhedronGeometry':\n\t\t\t\t\tcase 'PolyhedronBufferGeometry':\n\n\t\t\t\t\t\tgeometry = new Geometries[ data.type ](\n\t\t\t\t\t\t\tdata.vertices,\n\t\t\t\t\t\t\tdata.indices,\n\t\t\t\t\t\t\tdata.radius,\n\t\t\t\t\t\t\tdata.details\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'ShapeGeometry':\n\t\t\t\t\tcase 'ShapeBufferGeometry':\n\n\t\t\t\t\t\tvar geometryShapes = [];\n\n\t\t\t\t\t\tfor ( var j = 0, jl = data.shapes.length; j < jl; j ++ ) {\n\n\t\t\t\t\t\t\tvar shape = shapes[ data.shapes[ j ] ];\n\n\t\t\t\t\t\t\tgeometryShapes.push( shape );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tgeometry = new Geometries[ data.type ](\n\t\t\t\t\t\t\tgeometryShapes,\n\t\t\t\t\t\t\tdata.curveSegments\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tbreak;\n\n\n\t\t\t\t\tcase 'ExtrudeGeometry':\n\t\t\t\t\tcase 'ExtrudeBufferGeometry':\n\n\t\t\t\t\t\tvar geometryShapes = [];\n\n\t\t\t\t\t\tfor ( var j = 0, jl = data.shapes.length; j < jl; j ++ ) {\n\n\t\t\t\t\t\t\tvar shape = shapes[ data.shapes[ j ] ];\n\n\t\t\t\t\t\t\tgeometryShapes.push( shape );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tvar extrudePath = data.options.extrudePath;\n\n\t\t\t\t\t\tif ( extrudePath !== undefined ) {\n\n\t\t\t\t\t\t\tdata.options.extrudePath = new Curves[ extrudePath.type ]().fromJSON( extrudePath );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tgeometry = new Geometries[ data.type ](\n\t\t\t\t\t\t\tgeometryShapes,\n\t\t\t\t\t\t\tdata.options\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'BufferGeometry':\n\t\t\t\t\tcase 'InstancedBufferGeometry':\n\n\t\t\t\t\t\tgeometry = bufferGeometryLoader.parse( data );\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'Geometry':\n\n\t\t\t\t\t\tif ( 'THREE' in window && 'LegacyJSONLoader' in THREE ) {\n\n\t\t\t\t\t\t\tvar geometryLoader = new THREE.LegacyJSONLoader();\n\t\t\t\t\t\t\tgeometry = geometryLoader.parse( data, this.resourcePath ).geometry;\n\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tconsole.error( 'THREE.ObjectLoader: You have to import LegacyJSONLoader in order load geometry data of type \"Geometry\".' );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\n\t\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Unsupported geometry type \"' + data.type + '\"' );\n\n\t\t\t\t\t\tcontinue;\n\n\t\t\t\t}\n\n\t\t\t\tgeometry.uuid = data.uuid;\n\n\t\t\t\tif ( data.name !== undefined ) geometry.name = data.name;\n\t\t\t\tif ( geometry.isBufferGeometry === true && data.userData !== undefined ) geometry.userData = data.userData;\n\n\t\t\t\tgeometries[ data.uuid ] = geometry;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn geometries;\n\n\t},\n\n\tparseMaterials: function ( json, textures ) {\n\n\t\tvar cache = {}; // MultiMaterial\n\t\tvar materials = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tvar loader = new MaterialLoader();\n\t\t\tloader.setTextures( textures );\n\n\t\t\tfor ( var i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tvar data = json[ i ];\n\n\t\t\t\tif ( data.type === 'MultiMaterial' ) {\n\n\t\t\t\t\t// Deprecated\n\n\t\t\t\t\tvar array = [];\n\n\t\t\t\t\tfor ( var j = 0; j < data.materials.length; j ++ ) {\n\n\t\t\t\t\t\tvar material = data.materials[ j ];\n\n\t\t\t\t\t\tif ( cache[ material.uuid ] === undefined ) {\n\n\t\t\t\t\t\t\tcache[ material.uuid ] = loader.parse( material );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tarray.push( cache[ material.uuid ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tmaterials[ data.uuid ] = array;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( cache[ data.uuid ] === undefined ) {\n\n\t\t\t\t\t\tcache[ data.uuid ] = loader.parse( data );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tmaterials[ data.uuid ] = cache[ data.uuid ];\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn materials;\n\n\t},\n\n\tparseAnimations: function ( json ) {\n\n\t\tvar animations = [];\n\n\t\tfor ( var i = 0; i < json.length; i ++ ) {\n\n\t\t\tvar data = json[ i ];\n\n\t\t\tvar clip = AnimationClip.parse( data );\n\n\t\t\tif ( data.uuid !== undefined ) clip.uuid = data.uuid;\n\n\t\t\tanimations.push( clip );\n\n\t\t}\n\n\t\treturn animations;\n\n\t},\n\n\tparseImages: function ( json, onLoad ) {\n\n\t\tvar scope = this;\n\t\tvar images = {};\n\n\t\tfunction loadImage( url ) {\n\n\t\t\tscope.manager.itemStart( url );\n\n\t\t\treturn loader.load( url, function () {\n\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t}, undefined, function () {\n\n\t\t\t\tscope.manager.itemError( url );\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t} );\n\n\t\t}\n\n\t\tif ( json !== undefined && json.length > 0 ) {\n\n\t\t\tvar manager = new LoadingManager( onLoad );\n\n\t\t\tvar loader = new ImageLoader( manager );\n\t\t\tloader.setCrossOrigin( this.crossOrigin );\n\n\t\t\tfor ( var i = 0, il = json.length; i < il; i ++ ) {\n\n\t\t\t\tvar image = json[ i ];\n\t\t\t\tvar url = image.url;\n\n\t\t\t\tif ( Array.isArray( url ) ) {\n\n\t\t\t\t\t// load array of images e.g CubeTexture\n\n\t\t\t\t\timages[ image.uuid ] = [];\n\n\t\t\t\t\tfor ( var j = 0, jl = url.length; j < jl; j ++ ) {\n\n\t\t\t\t\t\tvar currentUrl = url[ j ];\n\n\t\t\t\t\t\tvar path = /^(\\/\\/)|([a-z]+:(\\/\\/)?)/i.test( currentUrl ) ? currentUrl : scope.resourcePath + currentUrl;\n\n\t\t\t\t\t\timages[ image.uuid ].push( loadImage( path ) );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// load single image\n\n\t\t\t\t\tvar path = /^(\\/\\/)|([a-z]+:(\\/\\/)?)/i.test( image.url ) ? image.url : scope.resourcePath + image.url;\n\n\t\t\t\t\timages[ image.uuid ] = loadImage( path );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn images;\n\n\t},\n\n\tparseTextures: function ( json, images ) {\n\n\t\tfunction parseConstant( value, type ) {\n\n\t\t\tif ( typeof value === 'number' ) return value;\n\n\t\t\tconsole.warn( 'THREE.ObjectLoader.parseTexture: Constant should be in numeric form.', value );\n\n\t\t\treturn type[ value ];\n\n\t\t}\n\n\t\tvar textures = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tfor ( var i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tvar data = json[ i ];\n\n\t\t\t\tif ( data.image === undefined ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: No \"image\" specified for', data.uuid );\n\n\t\t\t\t}\n\n\t\t\t\tif ( images[ data.image ] === undefined ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined image', data.image );\n\n\t\t\t\t}\n\n\t\t\t\tvar texture;\n\n\t\t\t\tif ( Array.isArray( images[ data.image ] ) ) {\n\n\t\t\t\t\ttexture = new CubeTexture( images[ data.image ] );\n\n\t\t\t\t} else {\n\n\t\t\t\t\ttexture = new Texture( images[ data.image ] );\n\n\t\t\t\t}\n\n\t\t\t\ttexture.needsUpdate = true;\n\n\t\t\t\ttexture.uuid = data.uuid;\n\n\t\t\t\tif ( data.name !== undefined ) texture.name = data.name;\n\n\t\t\t\tif ( data.mapping !== undefined ) texture.mapping = parseConstant( data.mapping, TEXTURE_MAPPING );\n\n\t\t\t\tif ( data.offset !== undefined ) texture.offset.fromArray( data.offset );\n\t\t\t\tif ( data.repeat !== undefined ) texture.repeat.fromArray( data.repeat );\n\t\t\t\tif ( data.center !== undefined ) texture.center.fromArray( data.center );\n\t\t\t\tif ( data.rotation !== undefined ) texture.rotation = data.rotation;\n\n\t\t\t\tif ( data.wrap !== undefined ) {\n\n\t\t\t\t\ttexture.wrapS = parseConstant( data.wrap[ 0 ], TEXTURE_WRAPPING );\n\t\t\t\t\ttexture.wrapT = parseConstant( data.wrap[ 1 ], TEXTURE_WRAPPING );\n\n\t\t\t\t}\n\n\t\t\t\tif ( data.format !== undefined ) texture.format = data.format;\n\t\t\t\tif ( data.type !== undefined ) texture.type = data.type;\n\t\t\t\tif ( data.encoding !== undefined ) texture.encoding = data.encoding;\n\n\t\t\t\tif ( data.minFilter !== undefined ) texture.minFilter = parseConstant( data.minFilter, TEXTURE_FILTER );\n\t\t\t\tif ( data.magFilter !== undefined ) texture.magFilter = parseConstant( data.magFilter, TEXTURE_FILTER );\n\t\t\t\tif ( data.anisotropy !== undefined ) texture.anisotropy = data.anisotropy;\n\n\t\t\t\tif ( data.flipY !== undefined ) texture.flipY = data.flipY;\n\n\t\t\t\tif ( data.premultiplyAlpha !== undefined ) texture.premultiplyAlpha = data.premultiplyAlpha;\n\t\t\t\tif ( data.unpackAlignment !== undefined ) texture.unpackAlignment = data.unpackAlignment;\n\n\t\t\t\ttextures[ data.uuid ] = texture;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn textures;\n\n\t},\n\n\tparseObject: function ( data, geometries, materials ) {\n\n\t\tvar object;\n\n\t\tfunction getGeometry( name ) {\n\n\t\t\tif ( geometries[ name ] === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined geometry', name );\n\n\t\t\t}\n\n\t\t\treturn geometries[ name ];\n\n\t\t}\n\n\t\tfunction getMaterial( name ) {\n\n\t\t\tif ( name === undefined ) return undefined;\n\n\t\t\tif ( Array.isArray( name ) ) {\n\n\t\t\t\tvar array = [];\n\n\t\t\t\tfor ( var i = 0, l = name.length; i < l; i ++ ) {\n\n\t\t\t\t\tvar uuid = name[ i ];\n\n\t\t\t\t\tif ( materials[ uuid ] === undefined ) {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined material', uuid );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tarray.push( materials[ uuid ] );\n\n\t\t\t\t}\n\n\t\t\t\treturn array;\n\n\t\t\t}\n\n\t\t\tif ( materials[ name ] === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined material', name );\n\n\t\t\t}\n\n\t\t\treturn materials[ name ];\n\n\t\t}\n\n\t\tswitch ( data.type ) {\n\n\t\t\tcase 'Scene':\n\n\t\t\t\tobject = new Scene();\n\n\t\t\t\tif ( data.background !== undefined ) {\n\n\t\t\t\t\tif ( Number.isInteger( data.background ) ) {\n\n\t\t\t\t\t\tobject.background = new Color( data.background );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( data.fog !== undefined ) {\n\n\t\t\t\t\tif ( data.fog.type === 'Fog' ) {\n\n\t\t\t\t\t\tobject.fog = new Fog( data.fog.color, data.fog.near, data.fog.far );\n\n\t\t\t\t\t} else if ( data.fog.type === 'FogExp2' ) {\n\n\t\t\t\t\t\tobject.fog = new FogExp2( data.fog.color, data.fog.density );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'PerspectiveCamera':\n\n\t\t\t\tobject = new PerspectiveCamera( data.fov, data.aspect, data.near, data.far );\n\n\t\t\t\tif ( data.focus !== undefined ) object.focus = data.focus;\n\t\t\t\tif ( data.zoom !== undefined ) object.zoom = data.zoom;\n\t\t\t\tif ( data.filmGauge !== undefined ) object.filmGauge = data.filmGauge;\n\t\t\t\tif ( data.filmOffset !== undefined ) object.filmOffset = data.filmOffset;\n\t\t\t\tif ( data.view !== undefined ) object.view = Object.assign( {}, data.view );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'OrthographicCamera':\n\n\t\t\t\tobject = new OrthographicCamera( data.left, data.right, data.top, data.bottom, data.near, data.far );\n\n\t\t\t\tif ( data.zoom !== undefined ) object.zoom = data.zoom;\n\t\t\t\tif ( data.view !== undefined ) object.view = Object.assign( {}, data.view );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'AmbientLight':\n\n\t\t\t\tobject = new AmbientLight( data.color, data.intensity );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'DirectionalLight':\n\n\t\t\t\tobject = new DirectionalLight( data.color, data.intensity );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'PointLight':\n\n\t\t\t\tobject = new PointLight( data.color, data.intensity, data.distance, data.decay );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'RectAreaLight':\n\n\t\t\t\tobject = new RectAreaLight( data.color, data.intensity, data.width, data.height );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'SpotLight':\n\n\t\t\t\tobject = new SpotLight( data.color, data.intensity, data.distance, data.angle, data.penumbra, data.decay );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'HemisphereLight':\n\n\t\t\t\tobject = new HemisphereLight( data.color, data.groundColor, data.intensity );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'SkinnedMesh':\n\n\t\t\t\tconsole.warn( 'THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.' );\n\n\t\t\tcase 'Mesh':\n\n\t\t\t\tvar geometry = getGeometry( data.geometry );\n\t\t\t\tvar material = getMaterial( data.material );\n\n\t\t\t\tif ( geometry.bones && geometry.bones.length > 0 ) {\n\n\t\t\t\t\tobject = new SkinnedMesh( geometry, material );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tobject = new Mesh( geometry, material );\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'InstancedMesh':\n\n\t\t\t\tvar geometry = getGeometry( data.geometry );\n\t\t\t\tvar material = getMaterial( data.material );\n\t\t\t\tvar count = data.count;\n\t\t\t\tvar instanceMatrix = data.instanceMatrix;\n\n\t\t\t\tobject = new InstancedMesh( geometry, material, count );\n\t\t\t\tobject.instanceMatrix = new BufferAttribute( new Float32Array( instanceMatrix.array ), 16 );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'LOD':\n\n\t\t\t\tobject = new LOD();\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Line':\n\n\t\t\t\tobject = new Line( getGeometry( data.geometry ), getMaterial( data.material ), data.mode );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'LineLoop':\n\n\t\t\t\tobject = new LineLoop( getGeometry( data.geometry ), getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'LineSegments':\n\n\t\t\t\tobject = new LineSegments( getGeometry( data.geometry ), getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'PointCloud':\n\t\t\tcase 'Points':\n\n\t\t\t\tobject = new Points( getGeometry( data.geometry ), getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Sprite':\n\n\t\t\t\tobject = new Sprite( getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Group':\n\n\t\t\t\tobject = new Group();\n\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\n\t\t\t\tobject = new Object3D();\n\n\t\t}\n\n\t\tobject.uuid = data.uuid;\n\n\t\tif ( data.name !== undefined ) object.name = data.name;\n\n\t\tif ( data.matrix !== undefined ) {\n\n\t\t\tobject.matrix.fromArray( data.matrix );\n\n\t\t\tif ( data.matrixAutoUpdate !== undefined ) object.matrixAutoUpdate = data.matrixAutoUpdate;\n\t\t\tif ( object.matrixAutoUpdate ) object.matrix.decompose( object.position, object.quaternion, object.scale );\n\n\t\t} else {\n\n\t\t\tif ( data.position !== undefined ) object.position.fromArray( data.position );\n\t\t\tif ( data.rotation !== undefined ) object.rotation.fromArray( data.rotation );\n\t\t\tif ( data.quaternion !== undefined ) object.quaternion.fromArray( data.quaternion );\n\t\t\tif ( data.scale !== undefined ) object.scale.fromArray( data.scale );\n\n\t\t}\n\n\t\tif ( data.castShadow !== undefined ) object.castShadow = data.castShadow;\n\t\tif ( data.receiveShadow !== undefined ) object.receiveShadow = data.receiveShadow;\n\n\t\tif ( data.shadow ) {\n\n\t\t\tif ( data.shadow.bias !== undefined ) object.shadow.bias = data.shadow.bias;\n\t\t\tif ( data.shadow.radius !== undefined ) object.shadow.radius = data.shadow.radius;\n\t\t\tif ( data.shadow.mapSize !== undefined ) object.shadow.mapSize.fromArray( data.shadow.mapSize );\n\t\t\tif ( data.shadow.camera !== undefined ) object.shadow.camera = this.parseObject( data.shadow.camera );\n\n\t\t}\n\n\t\tif ( data.visible !== undefined ) object.visible = data.visible;\n\t\tif ( data.frustumCulled !== undefined ) object.frustumCulled = data.frustumCulled;\n\t\tif ( data.renderOrder !== undefined ) object.renderOrder = data.renderOrder;\n\t\tif ( data.userData !== undefined ) object.userData = data.userData;\n\t\tif ( data.layers !== undefined ) object.layers.mask = data.layers;\n\n\t\tif ( data.children !== undefined ) {\n\n\t\t\tvar children = data.children;\n\n\t\t\tfor ( var i = 0; i < children.length; i ++ ) {\n\n\t\t\t\tobject.add( this.parseObject( children[ i ], geometries, materials ) );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( data.type === 'LOD' ) {\n\n\t\t\tif ( data.autoUpdate !== undefined ) object.autoUpdate = data.autoUpdate;\n\n\t\t\tvar levels = data.levels;\n\n\t\t\tfor ( var l = 0; l < levels.length; l ++ ) {\n\n\t\t\t\tvar level = levels[ l ];\n\t\t\t\tvar child = object.getObjectByProperty( 'uuid', level.object );\n\n\t\t\t\tif ( child !== undefined ) {\n\n\t\t\t\t\tobject.addLevel( child, level.distance );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn object;\n\n\t}\n\n} );\n\nvar TEXTURE_MAPPING = {\n\tUVMapping: UVMapping,\n\tCubeReflectionMapping: CubeReflectionMapping,\n\tCubeRefractionMapping: CubeRefractionMapping,\n\tEquirectangularReflectionMapping: EquirectangularReflectionMapping,\n\tEquirectangularRefractionMapping: EquirectangularRefractionMapping,\n\tSphericalReflectionMapping: SphericalReflectionMapping,\n\tCubeUVReflectionMapping: CubeUVReflectionMapping,\n\tCubeUVRefractionMapping: CubeUVRefractionMapping\n};\n\nvar TEXTURE_WRAPPING = {\n\tRepeatWrapping: RepeatWrapping,\n\tClampToEdgeWrapping: ClampToEdgeWrapping,\n\tMirroredRepeatWrapping: MirroredRepeatWrapping\n};\n\nvar TEXTURE_FILTER = {\n\tNearestFilter: NearestFilter,\n\tNearestMipmapNearestFilter: NearestMipmapNearestFilter,\n\tNearestMipmapLinearFilter: NearestMipmapLinearFilter,\n\tLinearFilter: LinearFilter,\n\tLinearMipmapNearestFilter: LinearMipmapNearestFilter,\n\tLinearMipmapLinearFilter: LinearMipmapLinearFilter\n};\n\n/**\n * @author thespite / http://clicktorelease.com/\n */\n\n\nfunction ImageBitmapLoader( manager ) {\n\n\tif ( typeof createImageBitmap === 'undefined' ) {\n\n\t\tconsole.warn( 'THREE.ImageBitmapLoader: createImageBitmap() not supported.' );\n\n\t}\n\n\tif ( typeof fetch === 'undefined' ) {\n\n\t\tconsole.warn( 'THREE.ImageBitmapLoader: fetch() not supported.' );\n\n\t}\n\n\tLoader.call( this, manager );\n\n\tthis.options = undefined;\n\n}\n\nImageBitmapLoader.prototype = Object.assign( Object.create( Loader.prototype ), {\n\n\tconstructor: ImageBitmapLoader,\n\n\tsetOptions: function setOptions( options ) {\n\n\t\tthis.options = options;\n\n\t\treturn this;\n\n\t},\n\n\tload: function ( url, onLoad, onProgress, onError ) {\n\n\t\tif ( url === undefined ) url = '';\n\n\t\tif ( this.path !== undefined ) url = this.path + url;\n\n\t\turl = this.manager.resolveURL( url );\n\n\t\tvar scope = this;\n\n\t\tvar cached = Cache.get( url );\n\n\t\tif ( cached !== undefined ) {\n\n\t\t\tscope.manager.itemStart( url );\n\n\t\t\tsetTimeout( function () {\n\n\t\t\t\tif ( onLoad ) onLoad( cached );\n\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t}, 0 );\n\n\t\t\treturn cached;\n\n\t\t}\n\n\t\tfetch( url ).then( function ( res ) {\n\n\t\t\treturn res.blob();\n\n\t\t} ).then( function ( blob ) {\n\n\t\t\tif ( scope.options === undefined ) {\n\n\t\t\t\t// Workaround for FireFox. It causes an error if you pass options.\n\t\t\t\treturn createImageBitmap( blob );\n\n\t\t\t} else {\n\n\t\t\t\treturn createImageBitmap( blob, scope.options );\n\n\t\t\t}\n\n\t\t} ).then( function ( imageBitmap ) {\n\n\t\t\tCache.add( url, imageBitmap );\n\n\t\t\tif ( onLoad ) onLoad( imageBitmap );\n\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t} ).catch( function ( e ) {\n\n\t\t\tif ( onError ) onError( e );\n\n\t\t\tscope.manager.itemError( url );\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t} );\n\n\t\tscope.manager.itemStart( url );\n\n\t}\n\n} );\n\n/**\n * @author zz85 / http://www.lab4games.net/zz85/blog\n * minimal class for proxing functions to Path. Replaces old \"extractSubpaths()\"\n **/\n\nfunction ShapePath() {\n\n\tthis.type = 'ShapePath';\n\n\tthis.color = new Color();\n\n\tthis.subPaths = [];\n\tthis.currentPath = null;\n\n}\n\nObject.assign( ShapePath.prototype, {\n\n\tmoveTo: function ( x, y ) {\n\n\t\tthis.currentPath = new Path();\n\t\tthis.subPaths.push( this.currentPath );\n\t\tthis.currentPath.moveTo( x, y );\n\n\t\treturn this;\n\n\t},\n\n\tlineTo: function ( x, y ) {\n\n\t\tthis.currentPath.lineTo( x, y );\n\n\t\treturn this;\n\n\t},\n\n\tquadraticCurveTo: function ( aCPx, aCPy, aX, aY ) {\n\n\t\tthis.currentPath.quadraticCurveTo( aCPx, aCPy, aX, aY );\n\n\t\treturn this;\n\n\t},\n\n\tbezierCurveTo: function ( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY ) {\n\n\t\tthis.currentPath.bezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY );\n\n\t\treturn this;\n\n\t},\n\n\tsplineThru: function ( pts ) {\n\n\t\tthis.currentPath.splineThru( pts );\n\n\t\treturn this;\n\n\t},\n\n\ttoShapes: function ( isCCW, noHoles ) {\n\n\t\tfunction toShapesNoHoles( inSubpaths ) {\n\n\t\t\tvar shapes = [];\n\n\t\t\tfor ( var i = 0, l = inSubpaths.length; i < l; i ++ ) {\n\n\t\t\t\tvar tmpPath = inSubpaths[ i ];\n\n\t\t\t\tvar tmpShape = new Shape();\n\t\t\t\ttmpShape.curves = tmpPath.curves;\n\n\t\t\t\tshapes.push( tmpShape );\n\n\t\t\t}\n\n\t\t\treturn shapes;\n\n\t\t}\n\n\t\tfunction isPointInsidePolygon( inPt, inPolygon ) {\n\n\t\t\tvar polyLen = inPolygon.length;\n\n\t\t\t// inPt on polygon contour => immediate success or\n\t\t\t// toggling of inside/outside at every single! intersection point of an edge\n\t\t\t// with the horizontal line through inPt, left of inPt\n\t\t\t// not counting lowerY endpoints of edges and whole edges on that line\n\t\t\tvar inside = false;\n\t\t\tfor ( var p = polyLen - 1, q = 0; q < polyLen; p = q ++ ) {\n\n\t\t\t\tvar edgeLowPt = inPolygon[ p ];\n\t\t\t\tvar edgeHighPt = inPolygon[ q ];\n\n\t\t\t\tvar edgeDx = edgeHighPt.x - edgeLowPt.x;\n\t\t\t\tvar edgeDy = edgeHighPt.y - edgeLowPt.y;\n\n\t\t\t\tif ( Math.abs( edgeDy ) > Number.EPSILON ) {\n\n\t\t\t\t\t// not parallel\n\t\t\t\t\tif ( edgeDy < 0 ) {\n\n\t\t\t\t\t\tedgeLowPt = inPolygon[ q ]; edgeDx = - edgeDx;\n\t\t\t\t\t\tedgeHighPt = inPolygon[ p ]; edgeDy = - edgeDy;\n\n\t\t\t\t\t}\n\t\t\t\t\tif ( ( inPt.y < edgeLowPt.y ) || ( inPt.y > edgeHighPt.y ) ) \t\tcontinue;\n\n\t\t\t\t\tif ( inPt.y === edgeLowPt.y ) {\n\n\t\t\t\t\t\tif ( inPt.x === edgeLowPt.x )\t\treturn\ttrue;\t\t// inPt is on contour ?\n\t\t\t\t\t\t// continue;\t\t\t\t// no intersection or edgeLowPt => doesn't count !!!\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tvar perpEdge = edgeDy * ( inPt.x - edgeLowPt.x ) - edgeDx * ( inPt.y - edgeLowPt.y );\n\t\t\t\t\t\tif ( perpEdge === 0 )\t\t\t\treturn\ttrue;\t\t// inPt is on contour ?\n\t\t\t\t\t\tif ( perpEdge < 0 ) \t\t\t\tcontinue;\n\t\t\t\t\t\tinside = ! inside;\t\t// true intersection left of inPt\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// parallel or collinear\n\t\t\t\t\tif ( inPt.y !== edgeLowPt.y ) \t\tcontinue;\t\t\t// parallel\n\t\t\t\t\t// edge lies on the same horizontal line as inPt\n\t\t\t\t\tif ( ( ( edgeHighPt.x <= inPt.x ) && ( inPt.x <= edgeLowPt.x ) ) ||\n\t\t\t\t\t\t ( ( edgeLowPt.x <= inPt.x ) && ( inPt.x <= edgeHighPt.x ) ) )\t\treturn\ttrue;\t// inPt: Point on contour !\n\t\t\t\t\t// continue;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn\tinside;\n\n\t\t}\n\n\t\tvar isClockWise = ShapeUtils.isClockWise;\n\n\t\tvar subPaths = this.subPaths;\n\t\tif ( subPaths.length === 0 ) return [];\n\n\t\tif ( noHoles === true )\treturn\ttoShapesNoHoles( subPaths );\n\n\n\t\tvar solid, tmpPath, tmpShape, shapes = [];\n\n\t\tif ( subPaths.length === 1 ) {\n\n\t\t\ttmpPath = subPaths[ 0 ];\n\t\t\ttmpShape = new Shape();\n\t\t\ttmpShape.curves = tmpPath.curves;\n\t\t\tshapes.push( tmpShape );\n\t\t\treturn shapes;\n\n\t\t}\n\n\t\tvar holesFirst = ! isClockWise( subPaths[ 0 ].getPoints() );\n\t\tholesFirst = isCCW ? ! holesFirst : holesFirst;\n\n\t\t// console.log(\"Holes first\", holesFirst);\n\n\t\tvar betterShapeHoles = [];\n\t\tvar newShapes = [];\n\t\tvar newShapeHoles = [];\n\t\tvar mainIdx = 0;\n\t\tvar tmpPoints;\n\n\t\tnewShapes[ mainIdx ] = undefined;\n\t\tnewShapeHoles[ mainIdx ] = [];\n\n\t\tfor ( var i = 0, l = subPaths.length; i < l; i ++ ) {\n\n\t\t\ttmpPath = subPaths[ i ];\n\t\t\ttmpPoints = tmpPath.getPoints();\n\t\t\tsolid = isClockWise( tmpPoints );\n\t\t\tsolid = isCCW ? ! solid : solid;\n\n\t\t\tif ( solid ) {\n\n\t\t\t\tif ( ( ! holesFirst ) && ( newShapes[ mainIdx ] ) )\tmainIdx ++;\n\n\t\t\t\tnewShapes[ mainIdx ] = { s: new Shape(), p: tmpPoints };\n\t\t\t\tnewShapes[ mainIdx ].s.curves = tmpPath.curves;\n\n\t\t\t\tif ( holesFirst )\tmainIdx ++;\n\t\t\t\tnewShapeHoles[ mainIdx ] = [];\n\n\t\t\t\t//console.log('cw', i);\n\n\t\t\t} else {\n\n\t\t\t\tnewShapeHoles[ mainIdx ].push( { h: tmpPath, p: tmpPoints[ 0 ] } );\n\n\t\t\t\t//console.log('ccw', i);\n\n\t\t\t}\n\n\t\t}\n\n\t\t// only Holes? -> probably all Shapes with wrong orientation\n\t\tif ( ! newShapes[ 0 ] )\treturn\ttoShapesNoHoles( subPaths );\n\n\n\t\tif ( newShapes.length > 1 ) {\n\n\t\t\tvar ambiguous = false;\n\t\t\tvar toChange = [];\n\n\t\t\tfor ( var sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {\n\n\t\t\t\tbetterShapeHoles[ sIdx ] = [];\n\n\t\t\t}\n\n\t\t\tfor ( var sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {\n\n\t\t\t\tvar sho = newShapeHoles[ sIdx ];\n\n\t\t\t\tfor ( var hIdx = 0; hIdx < sho.length; hIdx ++ ) {\n\n\t\t\t\t\tvar ho = sho[ hIdx ];\n\t\t\t\t\tvar hole_unassigned = true;\n\n\t\t\t\t\tfor ( var s2Idx = 0; s2Idx < newShapes.length; s2Idx ++ ) {\n\n\t\t\t\t\t\tif ( isPointInsidePolygon( ho.p, newShapes[ s2Idx ].p ) ) {\n\n\t\t\t\t\t\t\tif ( sIdx !== s2Idx )\ttoChange.push( { froms: sIdx, tos: s2Idx, hole: hIdx } );\n\t\t\t\t\t\t\tif ( hole_unassigned ) {\n\n\t\t\t\t\t\t\t\thole_unassigned = false;\n\t\t\t\t\t\t\t\tbetterShapeHoles[ s2Idx ].push( ho );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tambiguous = true;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t\tif ( hole_unassigned ) {\n\n\t\t\t\t\t\tbetterShapeHoles[ sIdx ].push( ho );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t\t// console.log(\"ambiguous: \", ambiguous);\n\t\t\tif ( toChange.length > 0 ) {\n\n\t\t\t\t// console.log(\"to change: \", toChange);\n\t\t\t\tif ( ! ambiguous )\tnewShapeHoles = betterShapeHoles;\n\n\t\t\t}\n\n\t\t}\n\n\t\tvar tmpHoles;\n\n\t\tfor ( var i = 0, il = newShapes.length; i < il; i ++ ) {\n\n\t\t\ttmpShape = newShapes[ i ].s;\n\t\t\tshapes.push( tmpShape );\n\t\t\ttmpHoles = newShapeHoles[ i ];\n\n\t\t\tfor ( var j = 0, jl = tmpHoles.length; j < jl; j ++ ) {\n\n\t\t\t\ttmpShape.holes.push( tmpHoles[ j ].h );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//console.log(\"shape\", shapes);\n\n\t\treturn shapes;\n\n\t}\n\n} );\n\n/**\n * @author zz85 / http://www.lab4games.net/zz85/blog\n * @author mrdoob / http://mrdoob.com/\n */\n\n\nfunction Font( data ) {\n\n\tthis.type = 'Font';\n\n\tthis.data = data;\n\n}\n\nObject.assign( Font.prototype, {\n\n\tisFont: true,\n\n\tgenerateShapes: function ( text, size ) {\n\n\t\tif ( size === undefined ) size = 100;\n\n\t\tvar shapes = [];\n\t\tvar paths = createPaths( text, size, this.data );\n\n\t\tfor ( var p = 0, pl = paths.length; p < pl; p ++ ) {\n\n\t\t\tArray.prototype.push.apply( shapes, paths[ p ].toShapes() );\n\n\t\t}\n\n\t\treturn shapes;\n\n\t}\n\n} );\n\nfunction createPaths( text, size, data ) {\n\n\tvar chars = Array.from ? Array.from( text ) : String( text ).split( '' ); // workaround for IE11, see #13988\n\tvar scale = size / data.resolution;\n\tvar line_height = ( data.boundingBox.yMax - data.boundingBox.yMin + data.underlineThickness ) * scale;\n\n\tvar paths = [];\n\n\tvar offsetX = 0, offsetY = 0;\n\n\tfor ( var i = 0; i < chars.length; i ++ ) {\n\n\t\tvar char = chars[ i ];\n\n\t\tif ( char === '\\n' ) {\n\n\t\t\toffsetX = 0;\n\t\t\toffsetY -= line_height;\n\n\t\t} else {\n\n\t\t\tvar ret = createPath( char, scale, offsetX, offsetY, data );\n\t\t\toffsetX += ret.offsetX;\n\t\t\tpaths.push( ret.path );\n\n\t\t}\n\n\t}\n\n\treturn paths;\n\n}\n\nfunction createPath( char, scale, offsetX, offsetY, data ) {\n\n\tvar glyph = data.glyphs[ char ] || data.glyphs[ '?' ];\n\n\tif ( ! glyph ) {\n\n\t\tconsole.error( 'THREE.Font: character \"' + char + '\" does not exists in font family ' + data.familyName + '.' );\n\n\t\treturn;\n\n\t}\n\n\tvar path = new ShapePath();\n\n\tvar x, y, cpx, cpy, cpx1, cpy1, cpx2, cpy2;\n\n\tif ( glyph.o ) {\n\n\t\tvar outline = glyph._cachedOutline || ( glyph._cachedOutline = glyph.o.split( ' ' ) );\n\n\t\tfor ( var i = 0, l = outline.length; i < l; ) {\n\n\t\t\tvar action = outline[ i ++ ];\n\n\t\t\tswitch ( action ) {\n\n\t\t\t\tcase 'm': // moveTo\n\n\t\t\t\t\tx = outline[ i ++ ] * scale + offsetX;\n\t\t\t\t\ty = outline[ i ++ ] * scale + offsetY;\n\n\t\t\t\t\tpath.moveTo( x, y );\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'l': // lineTo\n\n\t\t\t\t\tx = outline[ i ++ ] * scale + offsetX;\n\t\t\t\t\ty = outline[ i ++ ] * scale + offsetY;\n\n\t\t\t\t\tpath.lineTo( x, y );\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'q': // quadraticCurveTo\n\n\t\t\t\t\tcpx = outline[ i ++ ] * scale + offsetX;\n\t\t\t\t\tcpy = outline[ i ++ ] * scale + offsetY;\n\t\t\t\t\tcpx1 = outline[ i ++ ] * scale + offsetX;\n\t\t\t\t\tcpy1 = outline[ i ++ ] * scale + offsetY;\n\n\t\t\t\t\tpath.quadraticCurveTo( cpx1, cpy1, cpx, cpy );\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'b': // bezierCurveTo\n\n\t\t\t\t\tcpx = outline[ i ++ ] * scale + offsetX;\n\t\t\t\t\tcpy = outline[ i ++ ] * scale + offsetY;\n\t\t\t\t\tcpx1 = outline[ i ++ ] * scale + offsetX;\n\t\t\t\t\tcpy1 = outline[ i ++ ] * scale + offsetY;\n\t\t\t\t\tcpx2 = outline[ i ++ ] * scale + offsetX;\n\t\t\t\t\tcpy2 = outline[ i ++ ] * scale + offsetY;\n\n\t\t\t\t\tpath.bezierCurveTo( cpx1, cpy1, cpx2, cpy2, cpx, cpy );\n\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\treturn { offsetX: glyph.ha * scale, path: path };\n\n}\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction FontLoader( manager ) {\n\n\tLoader.call( this, manager );\n\n}\n\nFontLoader.prototype = Object.assign( Object.create( Loader.prototype ), {\n\n\tconstructor: FontLoader,\n\n\tload: function ( url, onLoad, onProgress, onError ) {\n\n\t\tvar scope = this;\n\n\t\tvar loader = new FileLoader( this.manager );\n\t\tloader.setPath( this.path );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\tvar json;\n\n\t\t\ttry {\n\n\t\t\t\tjson = JSON.parse( text );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\tconsole.warn( 'THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead.' );\n\t\t\t\tjson = JSON.parse( text.substring( 65, text.length - 2 ) );\n\n\t\t\t}\n\n\t\t\tvar font = scope.parse( json );\n\n\t\t\tif ( onLoad ) onLoad( font );\n\n\t\t}, onProgress, onError );\n\n\t},\n\n\tparse: function ( json ) {\n\n\t\treturn new Font( json );\n\n\t}\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nvar _context;\n\nvar AudioContext = {\n\n\tgetContext: function () {\n\n\t\tif ( _context === undefined ) {\n\n\t\t\t_context = new ( window.AudioContext || window.webkitAudioContext )();\n\n\t\t}\n\n\t\treturn _context;\n\n\t},\n\n\tsetContext: function ( value ) {\n\n\t\t_context = value;\n\n\t}\n\n};\n\n/**\n * @author Reece Aaron Lecrivain / http://reecenotes.com/\n */\n\nfunction AudioLoader( manager ) {\n\n\tLoader.call( this, manager );\n\n}\n\nAudioLoader.prototype = Object.assign( Object.create( Loader.prototype ), {\n\n\tconstructor: AudioLoader,\n\n\tload: function ( url, onLoad, onProgress, onError ) {\n\n\t\tvar loader = new FileLoader( this.manager );\n\t\tloader.setResponseType( 'arraybuffer' );\n\t\tloader.setPath( this.path );\n\t\tloader.load( url, function ( buffer ) {\n\n\t\t\t// Create a copy of the buffer. The `decodeAudioData` method\n\t\t\t// detaches the buffer when complete, preventing reuse.\n\t\t\tvar bufferCopy = buffer.slice( 0 );\n\n\t\t\tvar context = AudioContext.getContext();\n\t\t\tcontext.decodeAudioData( bufferCopy, function ( audioBuffer ) {\n\n\t\t\t\tonLoad( audioBuffer );\n\n\t\t\t} );\n\n\t\t}, onProgress, onError );\n\n\t}\n\n} );\n\n/**\n * @author bhouston / http://clara.io\n * @author WestLangley / http://github.com/WestLangley\n *\n * Primary reference:\n * https://graphics.stanford.edu/papers/envmap/envmap.pdf\n *\n * Secondary reference:\n * https://www.ppsloan.org/publications/StupidSH36.pdf\n */\n\n// 3-band SH defined by 9 coefficients\n\nfunction SphericalHarmonics3() {\n\n\tthis.coefficients = [];\n\n\tfor ( var i = 0; i < 9; i ++ ) {\n\n\t\tthis.coefficients.push( new Vector3() );\n\n\t}\n\n}\n\nObject.assign( SphericalHarmonics3.prototype, {\n\n\tisSphericalHarmonics3: true,\n\n\tset: function ( coefficients ) {\n\n\t\tfor ( var i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].copy( coefficients[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tzero: function () {\n\n\t\tfor ( var i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].set( 0, 0, 0 );\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\t// get the radiance in the direction of the normal\n\t// target is a Vector3\n\tgetAt: function ( normal, target ) {\n\n\t\t// normal is assumed to be unit length\n\n\t\tvar x = normal.x, y = normal.y, z = normal.z;\n\n\t\tvar coeff = this.coefficients;\n\n\t\t// band 0\n\t\ttarget.copy( coeff[ 0 ] ).multiplyScalar( 0.282095 );\n\n\t\t// band 1\n\t\ttarget.addScale( coeff[ 1 ], 0.488603 * y );\n\t\ttarget.addScale( coeff[ 2 ], 0.488603 * z );\n\t\ttarget.addScale( coeff[ 3 ], 0.488603 * x );\n\n\t\t// band 2\n\t\ttarget.addScale( coeff[ 4 ], 1.092548 * ( x * y ) );\n\t\ttarget.addScale( coeff[ 5 ], 1.092548 * ( y * z ) );\n\t\ttarget.addScale( coeff[ 6 ], 0.315392 * ( 3.0 * z * z - 1.0 ) );\n\t\ttarget.addScale( coeff[ 7 ], 1.092548 * ( x * z ) );\n\t\ttarget.addScale( coeff[ 8 ], 0.546274 * ( x * x - y * y ) );\n\n\t\treturn target;\n\n\t},\n\n\t// get the irradiance (radiance convolved with cosine lobe) in the direction of the normal\n\t// target is a Vector3\n\t// https://graphics.stanford.edu/papers/envmap/envmap.pdf\n\tgetIrradianceAt: function ( normal, target ) {\n\n\t\t// normal is assumed to be unit length\n\n\t\tvar x = normal.x, y = normal.y, z = normal.z;\n\n\t\tvar coeff = this.coefficients;\n\n\t\t// band 0\n\t\ttarget.copy( coeff[ 0 ] ).multiplyScalar( 0.886227 ); // π * 0.282095\n\n\t\t// band 1\n\t\ttarget.addScale( coeff[ 1 ], 2.0 * 0.511664 * y ); // ( 2 * π / 3 ) * 0.488603\n\t\ttarget.addScale( coeff[ 2 ], 2.0 * 0.511664 * z );\n\t\ttarget.addScale( coeff[ 3 ], 2.0 * 0.511664 * x );\n\n\t\t// band 2\n\t\ttarget.addScale( coeff[ 4 ], 2.0 * 0.429043 * x * y ); // ( π / 4 ) * 1.092548\n\t\ttarget.addScale( coeff[ 5 ], 2.0 * 0.429043 * y * z );\n\t\ttarget.addScale( coeff[ 6 ], 0.743125 * z * z - 0.247708 ); // ( π / 4 ) * 0.315392 * 3\n\t\ttarget.addScale( coeff[ 7 ], 2.0 * 0.429043 * x * z );\n\t\ttarget.addScale( coeff[ 8 ], 0.429043 * ( x * x - y * y ) ); // ( π / 4 ) * 0.546274\n\n\t\treturn target;\n\n\t},\n\n\tadd: function ( sh ) {\n\n\t\tfor ( var i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].add( sh.coefficients[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\n\tscale: function ( s ) {\n\n\t\tfor ( var i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].multiplyScalar( s );\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tlerp: function ( sh, alpha ) {\n\n\t\tfor ( var i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].lerp( sh.coefficients[ i ], alpha );\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tequals: function ( sh ) {\n\n\t\tfor ( var i = 0; i < 9; i ++ ) {\n\n\t\t\tif ( ! this.coefficients[ i ].equals( sh.coefficients[ i ] ) ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t},\n\n\tcopy: function ( sh ) {\n\n\t\treturn this.set( sh.coefficients );\n\n\t},\n\n\tclone: function () {\n\n\t\treturn new this.constructor().copy( this );\n\n\t},\n\n\tfromArray: function ( array, offset ) {\n\n\t\tif ( offset === undefined ) offset = 0;\n\n\t\tvar coefficients = this.coefficients;\n\n\t\tfor ( var i = 0; i < 9; i ++ ) {\n\n\t\t\tcoefficients[ i ].fromArray( array, offset + ( i * 3 ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\ttoArray: function ( array, offset ) {\n\n\t\tif ( array === undefined ) array = [];\n\t\tif ( offset === undefined ) offset = 0;\n\n\t\tvar coefficients = this.coefficients;\n\n\t\tfor ( var i = 0; i < 9; i ++ ) {\n\n\t\t\tcoefficients[ i ].toArray( array, offset + ( i * 3 ) );\n\n\t\t}\n\n\t\treturn array;\n\n\t}\n\n} );\n\nObject.assign( SphericalHarmonics3, {\n\n\t// evaluate the basis functions\n\t// shBasis is an Array[ 9 ]\n\tgetBasisAt: function ( normal, shBasis ) {\n\n\t\t// normal is assumed to be unit length\n\n\t\tvar x = normal.x, y = normal.y, z = normal.z;\n\n\t\t// band 0\n\t\tshBasis[ 0 ] = 0.282095;\n\n\t\t// band 1\n\t\tshBasis[ 1 ] = 0.488603 * y;\n\t\tshBasis[ 2 ] = 0.488603 * z;\n\t\tshBasis[ 3 ] = 0.488603 * x;\n\n\t\t// band 2\n\t\tshBasis[ 4 ] = 1.092548 * x * y;\n\t\tshBasis[ 5 ] = 1.092548 * y * z;\n\t\tshBasis[ 6 ] = 0.315392 * ( 3 * z * z - 1 );\n\t\tshBasis[ 7 ] = 1.092548 * x * z;\n\t\tshBasis[ 8 ] = 0.546274 * ( x * x - y * y );\n\n\t}\n\n} );\n\n/**\n * @author WestLangley / http://github.com/WestLangley\n *\n * A LightProbe is a source of indirect-diffuse light\n */\n\nfunction LightProbe( sh, intensity ) {\n\n\tLight.call( this, undefined, intensity );\n\n\tthis.sh = ( sh !== undefined ) ? sh : new SphericalHarmonics3();\n\n}\n\nLightProbe.prototype = Object.assign( Object.create( Light.prototype ), {\n\n\tconstructor: LightProbe,\n\n\tisLightProbe: true,\n\n\tcopy: function ( source ) {\n\n\t\tLight.prototype.copy.call( this, source );\n\n\t\tthis.sh.copy( source.sh );\n\t\tthis.intensity = source.intensity;\n\n\t\treturn this;\n\n\t},\n\n\ttoJSON: function ( meta ) {\n\n\t\tvar data = Light.prototype.toJSON.call( this, meta );\n\n\t\t// data.sh = this.sh.toArray(); // todo\n\n\t\treturn data;\n\n\t}\n\n} );\n\n/**\n * @author WestLangley / http://github.com/WestLangley\n */\n\nfunction HemisphereLightProbe( skyColor, groundColor, intensity ) {\n\n\tLightProbe.call( this, undefined, intensity );\n\n\tvar color1 = new Color().set( skyColor );\n\tvar color2 = new Color().set( groundColor );\n\n\tvar sky = new Vector3( color1.r, color1.g, color1.b );\n\tvar ground = new Vector3( color2.r, color2.g, color2.b );\n\n\t// without extra factor of PI in the shader, should = 1 / Math.sqrt( Math.PI );\n\tvar c0 = Math.sqrt( Math.PI );\n\tvar c1 = c0 * Math.sqrt( 0.75 );\n\n\tthis.sh.coefficients[ 0 ].copy( sky ).add( ground ).multiplyScalar( c0 );\n\tthis.sh.coefficients[ 1 ].copy( sky ).sub( ground ).multiplyScalar( c1 );\n\n}\n\nHemisphereLightProbe.prototype = Object.assign( Object.create( LightProbe.prototype ), {\n\n\tconstructor: HemisphereLightProbe,\n\n\tisHemisphereLightProbe: true,\n\n\tcopy: function ( source ) { // modifying colors not currently supported\n\n\t\tLightProbe.prototype.copy.call( this, source );\n\n\t\treturn this;\n\n\t},\n\n\ttoJSON: function ( meta ) {\n\n\t\tvar data = LightProbe.prototype.toJSON.call( this, meta );\n\n\t\t// data.sh = this.sh.toArray(); // todo\n\n\t\treturn data;\n\n\t}\n\n} );\n\n/**\n * @author WestLangley / http://github.com/WestLangley\n */\n\nfunction AmbientLightProbe( color, intensity ) {\n\n\tLightProbe.call( this, undefined, intensity );\n\n\tvar color1 = new Color().set( color );\n\n\t// without extra factor of PI in the shader, would be 2 / Math.sqrt( Math.PI );\n\tthis.sh.coefficients[ 0 ].set( color1.r, color1.g, color1.b ).multiplyScalar( 2 * Math.sqrt( Math.PI ) );\n\n}\n\nAmbientLightProbe.prototype = Object.assign( Object.create( LightProbe.prototype ), {\n\n\tconstructor: AmbientLightProbe,\n\n\tisAmbientLightProbe: true,\n\n\tcopy: function ( source ) { // modifying color not currently supported\n\n\t\tLightProbe.prototype.copy.call( this, source );\n\n\t\treturn this;\n\n\t},\n\n\ttoJSON: function ( meta ) {\n\n\t\tvar data = LightProbe.prototype.toJSON.call( this, meta );\n\n\t\t// data.sh = this.sh.toArray(); // todo\n\n\t\treturn data;\n\n\t}\n\n} );\n\nvar _eyeRight = new Matrix4();\nvar _eyeLeft = new Matrix4();\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction StereoCamera() {\n\n\tthis.type = 'StereoCamera';\n\n\tthis.aspect = 1;\n\n\tthis.eyeSep = 0.064;\n\n\tthis.cameraL = new PerspectiveCamera();\n\tthis.cameraL.layers.enable( 1 );\n\tthis.cameraL.matrixAutoUpdate = false;\n\n\tthis.cameraR = new PerspectiveCamera();\n\tthis.cameraR.layers.enable( 2 );\n\tthis.cameraR.matrixAutoUpdate = false;\n\n\tthis._cache = {\n\t\tfocus: null,\n\t\tfov: null,\n\t\taspect: null,\n\t\tnear: null,\n\t\tfar: null,\n\t\tzoom: null,\n\t\teyeSep: null\n\t};\n\n}\n\nObject.assign( StereoCamera.prototype, {\n\n\tupdate: function ( camera ) {\n\n\t\tvar cache = this._cache;\n\n\t\tvar needsUpdate = cache.focus !== camera.focus || cache.fov !== camera.fov ||\n\t\t\tcache.aspect !== camera.aspect * this.aspect || cache.near !== camera.near ||\n\t\t\tcache.far !== camera.far || cache.zoom !== camera.zoom || cache.eyeSep !== this.eyeSep;\n\n\t\tif ( needsUpdate ) {\n\n\t\t\tcache.focus = camera.focus;\n\t\t\tcache.fov = camera.fov;\n\t\t\tcache.aspect = camera.aspect * this.aspect;\n\t\t\tcache.near = camera.near;\n\t\t\tcache.far = camera.far;\n\t\t\tcache.zoom = camera.zoom;\n\t\t\tcache.eyeSep = this.eyeSep;\n\n\t\t\t// Off-axis stereoscopic effect based on\n\t\t\t// http://paulbourke.net/stereographics/stereorender/\n\n\t\t\tvar projectionMatrix = camera.projectionMatrix.clone();\n\t\t\tvar eyeSepHalf = cache.eyeSep / 2;\n\t\t\tvar eyeSepOnProjection = eyeSepHalf * cache.near / cache.focus;\n\t\t\tvar ymax = ( cache.near * Math.tan( MathUtils.DEG2RAD * cache.fov * 0.5 ) ) / cache.zoom;\n\t\t\tvar xmin, xmax;\n\n\t\t\t// translate xOffset\n\n\t\t\t_eyeLeft.elements[ 12 ] = - eyeSepHalf;\n\t\t\t_eyeRight.elements[ 12 ] = eyeSepHalf;\n\n\t\t\t// for left eye\n\n\t\t\txmin = - ymax * cache.aspect + eyeSepOnProjection;\n\t\t\txmax = ymax * cache.aspect + eyeSepOnProjection;\n\n\t\t\tprojectionMatrix.elements[ 0 ] = 2 * cache.near / ( xmax - xmin );\n\t\t\tprojectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin );\n\n\t\t\tthis.cameraL.projectionMatrix.copy( projectionMatrix );\n\n\t\t\t// for right eye\n\n\t\t\txmin = - ymax * cache.aspect - eyeSepOnProjection;\n\t\t\txmax = ymax * cache.aspect - eyeSepOnProjection;\n\n\t\t\tprojectionMatrix.elements[ 0 ] = 2 * cache.near / ( xmax - xmin );\n\t\t\tprojectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin );\n\n\t\t\tthis.cameraR.projectionMatrix.copy( projectionMatrix );\n\n\t\t}\n\n\t\tthis.cameraL.matrixWorld.copy( camera.matrixWorld ).multiply( _eyeLeft );\n\t\tthis.cameraR.matrixWorld.copy( camera.matrixWorld ).multiply( _eyeRight );\n\n\t}\n\n} );\n\n/**\n * @author alteredq / http://alteredqualia.com/\n */\n\nfunction Clock( autoStart ) {\n\n\tthis.autoStart = ( autoStart !== undefined ) ? autoStart : true;\n\n\tthis.startTime = 0;\n\tthis.oldTime = 0;\n\tthis.elapsedTime = 0;\n\n\tthis.running = false;\n\n}\n\nObject.assign( Clock.prototype, {\n\n\tstart: function () {\n\n\t\tthis.startTime = ( typeof performance === 'undefined' ? Date : performance ).now(); // see #10732\n\n\t\tthis.oldTime = this.startTime;\n\t\tthis.elapsedTime = 0;\n\t\tthis.running = true;\n\n\t},\n\n\tstop: function () {\n\n\t\tthis.getElapsedTime();\n\t\tthis.running = false;\n\t\tthis.autoStart = false;\n\n\t},\n\n\tgetElapsedTime: function () {\n\n\t\tthis.getDelta();\n\t\treturn this.elapsedTime;\n\n\t},\n\n\tgetDelta: function () {\n\n\t\tvar diff = 0;\n\n\t\tif ( this.autoStart && ! this.running ) {\n\n\t\t\tthis.start();\n\t\t\treturn 0;\n\n\t\t}\n\n\t\tif ( this.running ) {\n\n\t\t\tvar newTime = ( typeof performance === 'undefined' ? Date : performance ).now();\n\n\t\t\tdiff = ( newTime - this.oldTime ) / 1000;\n\t\t\tthis.oldTime = newTime;\n\n\t\t\tthis.elapsedTime += diff;\n\n\t\t}\n\n\t\treturn diff;\n\n\t}\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nvar _position$2 = new Vector3();\nvar _quaternion$3 = new Quaternion();\nvar _scale$1 = new Vector3();\nvar _orientation = new Vector3();\n\nfunction AudioListener() {\n\n\tObject3D.call( this );\n\n\tthis.type = 'AudioListener';\n\n\tthis.context = AudioContext.getContext();\n\n\tthis.gain = this.context.createGain();\n\tthis.gain.connect( this.context.destination );\n\n\tthis.filter = null;\n\n\tthis.timeDelta = 0;\n\n\t// private\n\n\tthis._clock = new Clock();\n\n}\n\nAudioListener.prototype = Object.assign( Object.create( Object3D.prototype ), {\n\n\tconstructor: AudioListener,\n\n\tgetInput: function () {\n\n\t\treturn this.gain;\n\n\t},\n\n\tremoveFilter: function ( ) {\n\n\t\tif ( this.filter !== null ) {\n\n\t\t\tthis.gain.disconnect( this.filter );\n\t\t\tthis.filter.disconnect( this.context.destination );\n\t\t\tthis.gain.connect( this.context.destination );\n\t\t\tthis.filter = null;\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tgetFilter: function () {\n\n\t\treturn this.filter;\n\n\t},\n\n\tsetFilter: function ( value ) {\n\n\t\tif ( this.filter !== null ) {\n\n\t\t\tthis.gain.disconnect( this.filter );\n\t\t\tthis.filter.disconnect( this.context.destination );\n\n\t\t} else {\n\n\t\t\tthis.gain.disconnect( this.context.destination );\n\n\t\t}\n\n\t\tthis.filter = value;\n\t\tthis.gain.connect( this.filter );\n\t\tthis.filter.connect( this.context.destination );\n\n\t\treturn this;\n\n\t},\n\n\tgetMasterVolume: function () {\n\n\t\treturn this.gain.gain.value;\n\n\t},\n\n\tsetMasterVolume: function ( value ) {\n\n\t\tthis.gain.gain.setTargetAtTime( value, this.context.currentTime, 0.01 );\n\n\t\treturn this;\n\n\t},\n\n\tupdateMatrixWorld: function ( force ) {\n\n\t\tObject3D.prototype.updateMatrixWorld.call( this, force );\n\n\t\tvar listener = this.context.listener;\n\t\tvar up = this.up;\n\n\t\tthis.timeDelta = this._clock.getDelta();\n\n\t\tthis.matrixWorld.decompose( _position$2, _quaternion$3, _scale$1 );\n\n\t\t_orientation.set( 0, 0, - 1 ).applyQuaternion( _quaternion$3 );\n\n\t\tif ( listener.positionX ) {\n\n\t\t\t// code path for Chrome (see #14393)\n\n\t\t\tvar endTime = this.context.currentTime + this.timeDelta;\n\n\t\t\tlistener.positionX.linearRampToValueAtTime( _position$2.x, endTime );\n\t\t\tlistener.positionY.linearRampToValueAtTime( _position$2.y, endTime );\n\t\t\tlistener.positionZ.linearRampToValueAtTime( _position$2.z, endTime );\n\t\t\tlistener.forwardX.linearRampToValueAtTime( _orientation.x, endTime );\n\t\t\tlistener.forwardY.linearRampToValueAtTime( _orientation.y, endTime );\n\t\t\tlistener.forwardZ.linearRampToValueAtTime( _orientation.z, endTime );\n\t\t\tlistener.upX.linearRampToValueAtTime( up.x, endTime );\n\t\t\tlistener.upY.linearRampToValueAtTime( up.y, endTime );\n\t\t\tlistener.upZ.linearRampToValueAtTime( up.z, endTime );\n\n\t\t} else {\n\n\t\t\tlistener.setPosition( _position$2.x, _position$2.y, _position$2.z );\n\t\t\tlistener.setOrientation( _orientation.x, _orientation.y, _orientation.z, up.x, up.y, up.z );\n\n\t\t}\n\n\t}\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n * @author Reece Aaron Lecrivain / http://reecenotes.com/\n */\n\nfunction Audio( listener ) {\n\n\tObject3D.call( this );\n\n\tthis.type = 'Audio';\n\n\tthis.listener = listener;\n\tthis.context = listener.context;\n\n\tthis.gain = this.context.createGain();\n\tthis.gain.connect( listener.getInput() );\n\n\tthis.autoplay = false;\n\n\tthis.buffer = null;\n\tthis.detune = 0;\n\tthis.loop = false;\n\tthis.loopStart = 0;\n\tthis.loopEnd = 0;\n\tthis.offset = 0;\n\tthis.duration = undefined;\n\tthis.playbackRate = 1;\n\tthis.isPlaying = false;\n\tthis.hasPlaybackControl = true;\n\tthis.sourceType = 'empty';\n\n\tthis._startedAt = 0;\n\tthis._pausedAt = 0;\n\n\tthis.filters = [];\n\n}\n\nAudio.prototype = Object.assign( Object.create( Object3D.prototype ), {\n\n\tconstructor: Audio,\n\n\tgetOutput: function () {\n\n\t\treturn this.gain;\n\n\t},\n\n\tsetNodeSource: function ( audioNode ) {\n\n\t\tthis.hasPlaybackControl = false;\n\t\tthis.sourceType = 'audioNode';\n\t\tthis.source = audioNode;\n\t\tthis.connect();\n\n\t\treturn this;\n\n\t},\n\n\tsetMediaElementSource: function ( mediaElement ) {\n\n\t\tthis.hasPlaybackControl = false;\n\t\tthis.sourceType = 'mediaNode';\n\t\tthis.source = this.context.createMediaElementSource( mediaElement );\n\t\tthis.connect();\n\n\t\treturn this;\n\n\t},\n\n\tsetMediaStreamSource: function ( mediaStream ) {\n\n\t\tthis.hasPlaybackControl = false;\n\t\tthis.sourceType = 'mediaStreamNode';\n\t\tthis.source = this.context.createMediaStreamSource( mediaStream );\n\t\tthis.connect();\n\n\t\treturn this;\n\n\t},\n\n\tsetBuffer: function ( audioBuffer ) {\n\n\t\tthis.buffer = audioBuffer;\n\t\tthis.sourceType = 'buffer';\n\n\t\tif ( this.autoplay ) this.play();\n\n\t\treturn this;\n\n\t},\n\n\tplay: function ( delay ) {\n\n\t\tif ( delay === undefined ) delay = 0;\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: Audio is already playing.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tthis._startedAt = this.context.currentTime + delay;\n\n\t\tvar source = this.context.createBufferSource();\n\t\tsource.buffer = this.buffer;\n\t\tsource.loop = this.loop;\n\t\tsource.loopStart = this.loopStart;\n\t\tsource.loopEnd = this.loopEnd;\n\t\tsource.onended = this.onEnded.bind( this );\n\t\tsource.start( this._startedAt, this._pausedAt + this.offset, this.duration );\n\n\t\tthis.isPlaying = true;\n\n\t\tthis.source = source;\n\n\t\tthis.setDetune( this.detune );\n\t\tthis.setPlaybackRate( this.playbackRate );\n\n\t\treturn this.connect();\n\n\t},\n\n\tpause: function () {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\tthis._pausedAt = ( this.context.currentTime - this._startedAt ) * this.playbackRate;\n\n\t\t\tthis.source.stop();\n\t\t\tthis.source.onended = null;\n\n\t\t\tthis.isPlaying = false;\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tstop: function () {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tthis._pausedAt = 0;\n\n\t\tthis.source.stop();\n\t\tthis.source.onended = null;\n\t\tthis.isPlaying = false;\n\n\t\treturn this;\n\n\t},\n\n\tconnect: function () {\n\n\t\tif ( this.filters.length > 0 ) {\n\n\t\t\tthis.source.connect( this.filters[ 0 ] );\n\n\t\t\tfor ( var i = 1, l = this.filters.length; i < l; i ++ ) {\n\n\t\t\t\tthis.filters[ i - 1 ].connect( this.filters[ i ] );\n\n\t\t\t}\n\n\t\t\tthis.filters[ this.filters.length - 1 ].connect( this.getOutput() );\n\n\t\t} else {\n\n\t\t\tthis.source.connect( this.getOutput() );\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tdisconnect: function () {\n\n\t\tif ( this.filters.length > 0 ) {\n\n\t\t\tthis.source.disconnect( this.filters[ 0 ] );\n\n\t\t\tfor ( var i = 1, l = this.filters.length; i < l; i ++ ) {\n\n\t\t\t\tthis.filters[ i - 1 ].disconnect( this.filters[ i ] );\n\n\t\t\t}\n\n\t\t\tthis.filters[ this.filters.length - 1 ].disconnect( this.getOutput() );\n\n\t\t} else {\n\n\t\t\tthis.source.disconnect( this.getOutput() );\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tgetFilters: function () {\n\n\t\treturn this.filters;\n\n\t},\n\n\tsetFilters: function ( value ) {\n\n\t\tif ( ! value ) value = [];\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\tthis.disconnect();\n\t\t\tthis.filters = value;\n\t\t\tthis.connect();\n\n\t\t} else {\n\n\t\t\tthis.filters = value;\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tsetDetune: function ( value ) {\n\n\t\tthis.detune = value;\n\n\t\tif ( this.source.detune === undefined ) return; // only set detune when available\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\tthis.source.detune.setTargetAtTime( this.detune, this.context.currentTime, 0.01 );\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tgetDetune: function () {\n\n\t\treturn this.detune;\n\n\t},\n\n\tgetFilter: function () {\n\n\t\treturn this.getFilters()[ 0 ];\n\n\t},\n\n\tsetFilter: function ( filter ) {\n\n\t\treturn this.setFilters( filter ? [ filter ] : [] );\n\n\t},\n\n\tsetPlaybackRate: function ( value ) {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tthis.playbackRate = value;\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\tthis.source.playbackRate.setTargetAtTime( this.playbackRate, this.context.currentTime, 0.01 );\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tgetPlaybackRate: function () {\n\n\t\treturn this.playbackRate;\n\n\t},\n\n\tonEnded: function () {\n\n\t\tthis.isPlaying = false;\n\n\t},\n\n\tgetLoop: function () {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn false;\n\n\t\t}\n\n\t\treturn this.loop;\n\n\t},\n\n\tsetLoop: function ( value ) {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tthis.loop = value;\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\tthis.source.loop = this.loop;\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tsetLoopStart: function ( value ) {\n\n\t\tthis.loopStart = value;\n\n\t\treturn this;\n\n\t},\n\n\tsetLoopEnd: function ( value ) {\n\n\t\tthis.loopEnd = value;\n\n\t\treturn this;\n\n\t},\n\n\tgetVolume: function () {\n\n\t\treturn this.gain.gain.value;\n\n\t},\n\n\tsetVolume: function ( value ) {\n\n\t\tthis.gain.gain.setTargetAtTime( value, this.context.currentTime, 0.01 );\n\n\t\treturn this;\n\n\t}\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nvar _position$3 = new Vector3();\nvar _quaternion$4 = new Quaternion();\nvar _scale$2 = new Vector3();\nvar _orientation$1 = new Vector3();\n\nfunction PositionalAudio( listener ) {\n\n\tAudio.call( this, listener );\n\n\tthis.panner = this.context.createPanner();\n\tthis.panner.panningModel = 'HRTF';\n\tthis.panner.connect( this.gain );\n\n}\n\nPositionalAudio.prototype = Object.assign( Object.create( Audio.prototype ), {\n\n\tconstructor: PositionalAudio,\n\n\tgetOutput: function () {\n\n\t\treturn this.panner;\n\n\t},\n\n\tgetRefDistance: function () {\n\n\t\treturn this.panner.refDistance;\n\n\t},\n\n\tsetRefDistance: function ( value ) {\n\n\t\tthis.panner.refDistance = value;\n\n\t\treturn this;\n\n\t},\n\n\tgetRolloffFactor: function () {\n\n\t\treturn this.panner.rolloffFactor;\n\n\t},\n\n\tsetRolloffFactor: function ( value ) {\n\n\t\tthis.panner.rolloffFactor = value;\n\n\t\treturn this;\n\n\t},\n\n\tgetDistanceModel: function () {\n\n\t\treturn this.panner.distanceModel;\n\n\t},\n\n\tsetDistanceModel: function ( value ) {\n\n\t\tthis.panner.distanceModel = value;\n\n\t\treturn this;\n\n\t},\n\n\tgetMaxDistance: function () {\n\n\t\treturn this.panner.maxDistance;\n\n\t},\n\n\tsetMaxDistance: function ( value ) {\n\n\t\tthis.panner.maxDistance = value;\n\n\t\treturn this;\n\n\t},\n\n\tsetDirectionalCone: function ( coneInnerAngle, coneOuterAngle, coneOuterGain ) {\n\n\t\tthis.panner.coneInnerAngle = coneInnerAngle;\n\t\tthis.panner.coneOuterAngle = coneOuterAngle;\n\t\tthis.panner.coneOuterGain = coneOuterGain;\n\n\t\treturn this;\n\n\t},\n\n\tupdateMatrixWorld: function ( force ) {\n\n\t\tObject3D.prototype.updateMatrixWorld.call( this, force );\n\n\t\tif ( this.hasPlaybackControl === true && this.isPlaying === false ) return;\n\n\t\tthis.matrixWorld.decompose( _position$3, _quaternion$4, _scale$2 );\n\n\t\t_orientation$1.set( 0, 0, 1 ).applyQuaternion( _quaternion$4 );\n\n\t\tvar panner = this.panner;\n\n\t\tif ( panner.positionX ) {\n\n\t\t\t// code path for Chrome and Firefox (see #14393)\n\n\t\t\tvar endTime = this.context.currentTime + this.listener.timeDelta;\n\n\t\t\tpanner.positionX.linearRampToValueAtTime( _position$3.x, endTime );\n\t\t\tpanner.positionY.linearRampToValueAtTime( _position$3.y, endTime );\n\t\t\tpanner.positionZ.linearRampToValueAtTime( _position$3.z, endTime );\n\t\t\tpanner.orientationX.linearRampToValueAtTime( _orientation$1.x, endTime );\n\t\t\tpanner.orientationY.linearRampToValueAtTime( _orientation$1.y, endTime );\n\t\t\tpanner.orientationZ.linearRampToValueAtTime( _orientation$1.z, endTime );\n\n\t\t} else {\n\n\t\t\tpanner.setPosition( _position$3.x, _position$3.y, _position$3.z );\n\t\t\tpanner.setOrientation( _orientation$1.x, _orientation$1.y, _orientation$1.z );\n\n\t\t}\n\n\t}\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction AudioAnalyser( audio, fftSize ) {\n\n\tthis.analyser = audio.context.createAnalyser();\n\tthis.analyser.fftSize = fftSize !== undefined ? fftSize : 2048;\n\n\tthis.data = new Uint8Array( this.analyser.frequencyBinCount );\n\n\taudio.getOutput().connect( this.analyser );\n\n}\n\nObject.assign( AudioAnalyser.prototype, {\n\n\tgetFrequencyData: function () {\n\n\t\tthis.analyser.getByteFrequencyData( this.data );\n\n\t\treturn this.data;\n\n\t},\n\n\tgetAverageFrequency: function () {\n\n\t\tvar value = 0, data = this.getFrequencyData();\n\n\t\tfor ( var i = 0; i < data.length; i ++ ) {\n\n\t\t\tvalue += data[ i ];\n\n\t\t}\n\n\t\treturn value / data.length;\n\n\t}\n\n} );\n\n/**\n *\n * Buffered scene graph property that allows weighted accumulation.\n *\n *\n * @author Ben Houston / http://clara.io/\n * @author David Sarno / http://lighthaus.us/\n * @author tschw\n */\n\nfunction PropertyMixer( binding, typeName, valueSize ) {\n\n\tthis.binding = binding;\n\tthis.valueSize = valueSize;\n\n\tvar bufferType = Float64Array,\n\t\tmixFunction;\n\n\tswitch ( typeName ) {\n\n\t\tcase 'quaternion':\n\t\t\tmixFunction = this._slerp;\n\t\t\tbreak;\n\n\t\tcase 'string':\n\t\tcase 'bool':\n\t\t\tbufferType = Array;\n\t\t\tmixFunction = this._select;\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tmixFunction = this._lerp;\n\n\t}\n\n\tthis.buffer = new bufferType( valueSize * 4 );\n\t// layout: [ incoming | accu0 | accu1 | orig ]\n\t//\n\t// interpolators can use .buffer as their .result\n\t// the data then goes to 'incoming'\n\t//\n\t// 'accu0' and 'accu1' are used frame-interleaved for\n\t// the cumulative result and are compared to detect\n\t// changes\n\t//\n\t// 'orig' stores the original state of the property\n\n\tthis._mixBufferRegion = mixFunction;\n\n\tthis.cumulativeWeight = 0;\n\n\tthis.useCount = 0;\n\tthis.referenceCount = 0;\n\n}\n\nObject.assign( PropertyMixer.prototype, {\n\n\t// accumulate data in the 'incoming' region into 'accu'\n\taccumulate: function ( accuIndex, weight ) {\n\n\t\t// note: happily accumulating nothing when weight = 0, the caller knows\n\t\t// the weight and shouldn't have made the call in the first place\n\n\t\tvar buffer = this.buffer,\n\t\t\tstride = this.valueSize,\n\t\t\toffset = accuIndex * stride + stride,\n\n\t\t\tcurrentWeight = this.cumulativeWeight;\n\n\t\tif ( currentWeight === 0 ) {\n\n\t\t\t// accuN := incoming * weight\n\n\t\t\tfor ( var i = 0; i !== stride; ++ i ) {\n\n\t\t\t\tbuffer[ offset + i ] = buffer[ i ];\n\n\t\t\t}\n\n\t\t\tcurrentWeight = weight;\n\n\t\t} else {\n\n\t\t\t// accuN := accuN + incoming * weight\n\n\t\t\tcurrentWeight += weight;\n\t\t\tvar mix = weight / currentWeight;\n\t\t\tthis._mixBufferRegion( buffer, offset, 0, mix, stride );\n\n\t\t}\n\n\t\tthis.cumulativeWeight = currentWeight;\n\n\t},\n\n\t// apply the state of 'accu' to the binding when accus differ\n\tapply: function ( accuIndex ) {\n\n\t\tvar stride = this.valueSize,\n\t\t\tbuffer = this.buffer,\n\t\t\toffset = accuIndex * stride + stride,\n\n\t\t\tweight = this.cumulativeWeight,\n\n\t\t\tbinding = this.binding;\n\n\t\tthis.cumulativeWeight = 0;\n\n\t\tif ( weight < 1 ) {\n\n\t\t\t// accuN := accuN + original * ( 1 - cumulativeWeight )\n\n\t\t\tvar originalValueOffset = stride * 3;\n\n\t\t\tthis._mixBufferRegion(\n\t\t\t\tbuffer, offset, originalValueOffset, 1 - weight, stride );\n\n\t\t}\n\n\t\tfor ( var i = stride, e = stride + stride; i !== e; ++ i ) {\n\n\t\t\tif ( buffer[ i ] !== buffer[ i + stride ] ) {\n\n\t\t\t\t// value has changed -> update scene graph\n\n\t\t\t\tbinding.setValue( buffer, offset );\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t},\n\n\t// remember the state of the bound property and copy it to both accus\n\tsaveOriginalState: function () {\n\n\t\tvar binding = this.binding;\n\n\t\tvar buffer = this.buffer,\n\t\t\tstride = this.valueSize,\n\n\t\t\toriginalValueOffset = stride * 3;\n\n\t\tbinding.getValue( buffer, originalValueOffset );\n\n\t\t// accu[0..1] := orig -- initially detect changes against the original\n\t\tfor ( var i = stride, e = originalValueOffset; i !== e; ++ i ) {\n\n\t\t\tbuffer[ i ] = buffer[ originalValueOffset + ( i % stride ) ];\n\n\t\t}\n\n\t\tthis.cumulativeWeight = 0;\n\n\t},\n\n\t// apply the state previously taken via 'saveOriginalState' to the binding\n\trestoreOriginalState: function () {\n\n\t\tvar originalValueOffset = this.valueSize * 3;\n\t\tthis.binding.setValue( this.buffer, originalValueOffset );\n\n\t},\n\n\n\t// mix functions\n\n\t_select: function ( buffer, dstOffset, srcOffset, t, stride ) {\n\n\t\tif ( t >= 0.5 ) {\n\n\t\t\tfor ( var i = 0; i !== stride; ++ i ) {\n\n\t\t\t\tbuffer[ dstOffset + i ] = buffer[ srcOffset + i ];\n\n\t\t\t}\n\n\t\t}\n\n\t},\n\n\t_slerp: function ( buffer, dstOffset, srcOffset, t ) {\n\n\t\tQuaternion.slerpFlat( buffer, dstOffset, buffer, dstOffset, buffer, srcOffset, t );\n\n\t},\n\n\t_lerp: function ( buffer, dstOffset, srcOffset, t, stride ) {\n\n\t\tvar s = 1 - t;\n\n\t\tfor ( var i = 0; i !== stride; ++ i ) {\n\n\t\t\tvar j = dstOffset + i;\n\n\t\t\tbuffer[ j ] = buffer[ j ] * s + buffer[ srcOffset + i ] * t;\n\n\t\t}\n\n\t}\n\n} );\n\n/**\n *\n * A reference to a real property in the scene graph.\n *\n *\n * @author Ben Houston / http://clara.io/\n * @author David Sarno / http://lighthaus.us/\n * @author tschw\n */\n\n// Characters [].:/ are reserved for track binding syntax.\nvar _RESERVED_CHARS_RE = '\\\\[\\\\]\\\\.:\\\\/';\nvar _reservedRe = new RegExp( '[' + _RESERVED_CHARS_RE + ']', 'g' );\n\n// Attempts to allow node names from any language. ES5's `\\w` regexp matches\n// only latin characters, and the unicode \\p{L} is not yet supported. So\n// instead, we exclude reserved characters and match everything else.\nvar _wordChar = '[^' + _RESERVED_CHARS_RE + ']';\nvar _wordCharOrDot = '[^' + _RESERVED_CHARS_RE.replace( '\\\\.', '' ) + ']';\n\n// Parent directories, delimited by '/' or ':'. Currently unused, but must\n// be matched to parse the rest of the track name.\nvar _directoryRe = /((?:WC+[\\/:])*)/.source.replace( 'WC', _wordChar );\n\n// Target node. May contain word characters (a-zA-Z0-9_) and '.' or '-'.\nvar _nodeRe = /(WCOD+)?/.source.replace( 'WCOD', _wordCharOrDot );\n\n// Object on target node, and accessor. May not contain reserved\n// characters. Accessor may contain any character except closing bracket.\nvar _objectRe = /(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace( 'WC', _wordChar );\n\n// Property and accessor. May not contain reserved characters. Accessor may\n// contain any non-bracket characters.\nvar _propertyRe = /\\.(WC+)(?:\\[(.+)\\])?/.source.replace( 'WC', _wordChar );\n\nvar _trackRe = new RegExp( ''\n\t+ '^'\n\t+ _directoryRe\n\t+ _nodeRe\n\t+ _objectRe\n\t+ _propertyRe\n\t+ '$'\n);\n\nvar _supportedObjectNames = [ 'material', 'materials', 'bones' ];\n\nfunction Composite( targetGroup, path, optionalParsedPath ) {\n\n\tvar parsedPath = optionalParsedPath || PropertyBinding.parseTrackName( path );\n\n\tthis._targetGroup = targetGroup;\n\tthis._bindings = targetGroup.subscribe_( path, parsedPath );\n\n}\n\nObject.assign( Composite.prototype, {\n\n\tgetValue: function ( array, offset ) {\n\n\t\tthis.bind(); // bind all binding\n\n\t\tvar firstValidIndex = this._targetGroup.nCachedObjects_,\n\t\t\tbinding = this._bindings[ firstValidIndex ];\n\n\t\t// and only call .getValue on the first\n\t\tif ( binding !== undefined ) binding.getValue( array, offset );\n\n\t},\n\n\tsetValue: function ( array, offset ) {\n\n\t\tvar bindings = this._bindings;\n\n\t\tfor ( var i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\tbindings[ i ].setValue( array, offset );\n\n\t\t}\n\n\t},\n\n\tbind: function () {\n\n\t\tvar bindings = this._bindings;\n\n\t\tfor ( var i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\tbindings[ i ].bind();\n\n\t\t}\n\n\t},\n\n\tunbind: function () {\n\n\t\tvar bindings = this._bindings;\n\n\t\tfor ( var i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\tbindings[ i ].unbind();\n\n\t\t}\n\n\t}\n\n} );\n\n\nfunction PropertyBinding( rootNode, path, parsedPath ) {\n\n\tthis.path = path;\n\tthis.parsedPath = parsedPath || PropertyBinding.parseTrackName( path );\n\n\tthis.node = PropertyBinding.findNode( rootNode, this.parsedPath.nodeName ) || rootNode;\n\n\tthis.rootNode = rootNode;\n\n}\n\nObject.assign( PropertyBinding, {\n\n\tComposite: Composite,\n\n\tcreate: function ( root, path, parsedPath ) {\n\n\t\tif ( ! ( root && root.isAnimationObjectGroup ) ) {\n\n\t\t\treturn new PropertyBinding( root, path, parsedPath );\n\n\t\t} else {\n\n\t\t\treturn new PropertyBinding.Composite( root, path, parsedPath );\n\n\t\t}\n\n\t},\n\n\t/**\n\t * Replaces spaces with underscores and removes unsupported characters from\n\t * node names, to ensure compatibility with parseTrackName().\n\t *\n\t * @param {string} name Node name to be sanitized.\n\t * @return {string}\n\t */\n\tsanitizeNodeName: function ( name ) {\n\n\t\treturn name.replace( /\\s/g, '_' ).replace( _reservedRe, '' );\n\n\t},\n\n\tparseTrackName: function ( trackName ) {\n\n\t\tvar matches = _trackRe.exec( trackName );\n\n\t\tif ( ! matches ) {\n\n\t\t\tthrow new Error( 'PropertyBinding: Cannot parse trackName: ' + trackName );\n\n\t\t}\n\n\t\tvar results = {\n\t\t\t// directoryName: matches[ 1 ], // (tschw) currently unused\n\t\t\tnodeName: matches[ 2 ],\n\t\t\tobjectName: matches[ 3 ],\n\t\t\tobjectIndex: matches[ 4 ],\n\t\t\tpropertyName: matches[ 5 ], // required\n\t\t\tpropertyIndex: matches[ 6 ]\n\t\t};\n\n\t\tvar lastDot = results.nodeName && results.nodeName.lastIndexOf( '.' );\n\n\t\tif ( lastDot !== undefined && lastDot !== - 1 ) {\n\n\t\t\tvar objectName = results.nodeName.substring( lastDot + 1 );\n\n\t\t\t// Object names must be checked against a whitelist. Otherwise, there\n\t\t\t// is no way to parse 'foo.bar.baz': 'baz' must be a property, but\n\t\t\t// 'bar' could be the objectName, or part of a nodeName (which can\n\t\t\t// include '.' characters).\n\t\t\tif ( _supportedObjectNames.indexOf( objectName ) !== - 1 ) {\n\n\t\t\t\tresults.nodeName = results.nodeName.substring( 0, lastDot );\n\t\t\t\tresults.objectName = objectName;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( results.propertyName === null || results.propertyName.length === 0 ) {\n\n\t\t\tthrow new Error( 'PropertyBinding: can not parse propertyName from trackName: ' + trackName );\n\n\t\t}\n\n\t\treturn results;\n\n\t},\n\n\tfindNode: function ( root, nodeName ) {\n\n\t\tif ( ! nodeName || nodeName === \"\" || nodeName === \"root\" || nodeName === \".\" || nodeName === - 1 || nodeName === root.name || nodeName === root.uuid ) {\n\n\t\t\treturn root;\n\n\t\t}\n\n\t\t// search into skeleton bones.\n\t\tif ( root.skeleton ) {\n\n\t\t\tvar bone = root.skeleton.getBoneByName( nodeName );\n\n\t\t\tif ( bone !== undefined ) {\n\n\t\t\t\treturn bone;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// search into node subtree.\n\t\tif ( root.children ) {\n\n\t\t\tvar searchNodeSubtree = function ( children ) {\n\n\t\t\t\tfor ( var i = 0; i < children.length; i ++ ) {\n\n\t\t\t\t\tvar childNode = children[ i ];\n\n\t\t\t\t\tif ( childNode.name === nodeName || childNode.uuid === nodeName ) {\n\n\t\t\t\t\t\treturn childNode;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tvar result = searchNodeSubtree( childNode.children );\n\n\t\t\t\t\tif ( result ) return result;\n\n\t\t\t\t}\n\n\t\t\t\treturn null;\n\n\t\t\t};\n\n\t\t\tvar subTreeNode = searchNodeSubtree( root.children );\n\n\t\t\tif ( subTreeNode ) {\n\n\t\t\t\treturn subTreeNode;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn null;\n\n\t}\n\n} );\n\nObject.assign( PropertyBinding.prototype, { // prototype, continued\n\n\t// these are used to \"bind\" a nonexistent property\n\t_getValue_unavailable: function () {},\n\t_setValue_unavailable: function () {},\n\n\tBindingType: {\n\t\tDirect: 0,\n\t\tEntireArray: 1,\n\t\tArrayElement: 2,\n\t\tHasFromToArray: 3\n\t},\n\n\tVersioning: {\n\t\tNone: 0,\n\t\tNeedsUpdate: 1,\n\t\tMatrixWorldNeedsUpdate: 2\n\t},\n\n\tGetterByBindingType: [\n\n\t\tfunction getValue_direct( buffer, offset ) {\n\n\t\t\tbuffer[ offset ] = this.node[ this.propertyName ];\n\n\t\t},\n\n\t\tfunction getValue_array( buffer, offset ) {\n\n\t\t\tvar source = this.resolvedProperty;\n\n\t\t\tfor ( var i = 0, n = source.length; i !== n; ++ i ) {\n\n\t\t\t\tbuffer[ offset ++ ] = source[ i ];\n\n\t\t\t}\n\n\t\t},\n\n\t\tfunction getValue_arrayElement( buffer, offset ) {\n\n\t\t\tbuffer[ offset ] = this.resolvedProperty[ this.propertyIndex ];\n\n\t\t},\n\n\t\tfunction getValue_toArray( buffer, offset ) {\n\n\t\t\tthis.resolvedProperty.toArray( buffer, offset );\n\n\t\t}\n\n\t],\n\n\tSetterByBindingTypeAndVersioning: [\n\n\t\t[\n\t\t\t// Direct\n\n\t\t\tfunction setValue_direct( buffer, offset ) {\n\n\t\t\t\tthis.targetObject[ this.propertyName ] = buffer[ offset ];\n\n\t\t\t},\n\n\t\t\tfunction setValue_direct_setNeedsUpdate( buffer, offset ) {\n\n\t\t\t\tthis.targetObject[ this.propertyName ] = buffer[ offset ];\n\t\t\t\tthis.targetObject.needsUpdate = true;\n\n\t\t\t},\n\n\t\t\tfunction setValue_direct_setMatrixWorldNeedsUpdate( buffer, offset ) {\n\n\t\t\t\tthis.targetObject[ this.propertyName ] = buffer[ offset ];\n\t\t\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\n\n\t\t\t}\n\n\t\t], [\n\n\t\t\t// EntireArray\n\n\t\t\tfunction setValue_array( buffer, offset ) {\n\n\t\t\t\tvar dest = this.resolvedProperty;\n\n\t\t\t\tfor ( var i = 0, n = dest.length; i !== n; ++ i ) {\n\n\t\t\t\t\tdest[ i ] = buffer[ offset ++ ];\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tfunction setValue_array_setNeedsUpdate( buffer, offset ) {\n\n\t\t\t\tvar dest = this.resolvedProperty;\n\n\t\t\t\tfor ( var i = 0, n = dest.length; i !== n; ++ i ) {\n\n\t\t\t\t\tdest[ i ] = buffer[ offset ++ ];\n\n\t\t\t\t}\n\n\t\t\t\tthis.targetObject.needsUpdate = true;\n\n\t\t\t},\n\n\t\t\tfunction setValue_array_setMatrixWorldNeedsUpdate( buffer, offset ) {\n\n\t\t\t\tvar dest = this.resolvedProperty;\n\n\t\t\t\tfor ( var i = 0, n = dest.length; i !== n; ++ i ) {\n\n\t\t\t\t\tdest[ i ] = buffer[ offset ++ ];\n\n\t\t\t\t}\n\n\t\t\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\n\n\t\t\t}\n\n\t\t], [\n\n\t\t\t// ArrayElement\n\n\t\t\tfunction setValue_arrayElement( buffer, offset ) {\n\n\t\t\t\tthis.resolvedProperty[ this.propertyIndex ] = buffer[ offset ];\n\n\t\t\t},\n\n\t\t\tfunction setValue_arrayElement_setNeedsUpdate( buffer, offset ) {\n\n\t\t\t\tthis.resolvedProperty[ this.propertyIndex ] = buffer[ offset ];\n\t\t\t\tthis.targetObject.needsUpdate = true;\n\n\t\t\t},\n\n\t\t\tfunction setValue_arrayElement_setMatrixWorldNeedsUpdate( buffer, offset ) {\n\n\t\t\t\tthis.resolvedProperty[ this.propertyIndex ] = buffer[ offset ];\n\t\t\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\n\n\t\t\t}\n\n\t\t], [\n\n\t\t\t// HasToFromArray\n\n\t\t\tfunction setValue_fromArray( buffer, offset ) {\n\n\t\t\t\tthis.resolvedProperty.fromArray( buffer, offset );\n\n\t\t\t},\n\n\t\t\tfunction setValue_fromArray_setNeedsUpdate( buffer, offset ) {\n\n\t\t\t\tthis.resolvedProperty.fromArray( buffer, offset );\n\t\t\t\tthis.targetObject.needsUpdate = true;\n\n\t\t\t},\n\n\t\t\tfunction setValue_fromArray_setMatrixWorldNeedsUpdate( buffer, offset ) {\n\n\t\t\t\tthis.resolvedProperty.fromArray( buffer, offset );\n\t\t\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\n\n\t\t\t}\n\n\t\t]\n\n\t],\n\n\tgetValue: function getValue_unbound( targetArray, offset ) {\n\n\t\tthis.bind();\n\t\tthis.getValue( targetArray, offset );\n\n\t\t// Note: This class uses a State pattern on a per-method basis:\n\t\t// 'bind' sets 'this.getValue' / 'setValue' and shadows the\n\t\t// prototype version of these methods with one that represents\n\t\t// the bound state. When the property is not found, the methods\n\t\t// become no-ops.\n\n\t},\n\n\tsetValue: function getValue_unbound( sourceArray, offset ) {\n\n\t\tthis.bind();\n\t\tthis.setValue( sourceArray, offset );\n\n\t},\n\n\t// create getter / setter pair for a property in the scene graph\n\tbind: function () {\n\n\t\tvar targetObject = this.node,\n\t\t\tparsedPath = this.parsedPath,\n\n\t\t\tobjectName = parsedPath.objectName,\n\t\t\tpropertyName = parsedPath.propertyName,\n\t\t\tpropertyIndex = parsedPath.propertyIndex;\n\n\t\tif ( ! targetObject ) {\n\n\t\t\ttargetObject = PropertyBinding.findNode( this.rootNode, parsedPath.nodeName ) || this.rootNode;\n\n\t\t\tthis.node = targetObject;\n\n\t\t}\n\n\t\t// set fail state so we can just 'return' on error\n\t\tthis.getValue = this._getValue_unavailable;\n\t\tthis.setValue = this._setValue_unavailable;\n\n\t\t// ensure there is a value node\n\t\tif ( ! targetObject ) {\n\n\t\t\tconsole.error( 'THREE.PropertyBinding: Trying to update node for track: ' + this.path + ' but it wasn\\'t found.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( objectName ) {\n\n\t\t\tvar objectIndex = parsedPath.objectIndex;\n\n\t\t\t// special cases were we need to reach deeper into the hierarchy to get the face materials....\n\t\t\tswitch ( objectName ) {\n\n\t\t\t\tcase 'materials':\n\n\t\t\t\t\tif ( ! targetObject.material ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to material as node does not have a material.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! targetObject.material.materials ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttargetObject = targetObject.material.materials;\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'bones':\n\n\t\t\t\t\tif ( ! targetObject.skeleton ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// potential future optimization: skip this if propertyIndex is already an integer\n\t\t\t\t\t// and convert the integer string to a true integer.\n\n\t\t\t\t\ttargetObject = targetObject.skeleton.bones;\n\n\t\t\t\t\t// support resolving morphTarget names into indices.\n\t\t\t\t\tfor ( var i = 0; i < targetObject.length; i ++ ) {\n\n\t\t\t\t\t\tif ( targetObject[ i ].name === objectIndex ) {\n\n\t\t\t\t\t\t\tobjectIndex = i;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\n\t\t\t\t\tif ( targetObject[ objectName ] === undefined ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to objectName of node undefined.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttargetObject = targetObject[ objectName ];\n\n\t\t\t}\n\n\n\t\t\tif ( objectIndex !== undefined ) {\n\n\t\t\t\tif ( targetObject[ objectIndex ] === undefined ) {\n\n\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.', this, targetObject );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t\ttargetObject = targetObject[ objectIndex ];\n\n\t\t\t}\n\n\t\t}\n\n\t\t// resolve property\n\t\tvar nodeProperty = targetObject[ propertyName ];\n\n\t\tif ( nodeProperty === undefined ) {\n\n\t\t\tvar nodeName = parsedPath.nodeName;\n\n\t\t\tconsole.error( 'THREE.PropertyBinding: Trying to update property for track: ' + nodeName +\n\t\t\t\t'.' + propertyName + ' but it wasn\\'t found.', targetObject );\n\t\t\treturn;\n\n\t\t}\n\n\t\t// determine versioning scheme\n\t\tvar versioning = this.Versioning.None;\n\n\t\tthis.targetObject = targetObject;\n\n\t\tif ( targetObject.needsUpdate !== undefined ) { // material\n\n\t\t\tversioning = this.Versioning.NeedsUpdate;\n\n\t\t} else if ( targetObject.matrixWorldNeedsUpdate !== undefined ) { // node transform\n\n\t\t\tversioning = this.Versioning.MatrixWorldNeedsUpdate;\n\n\t\t}\n\n\t\t// determine how the property gets bound\n\t\tvar bindingType = this.BindingType.Direct;\n\n\t\tif ( propertyIndex !== undefined ) {\n\n\t\t\t// access a sub element of the property array (only primitives are supported right now)\n\n\t\t\tif ( propertyName === \"morphTargetInfluences\" ) {\n\n\t\t\t\t// potential optimization, skip this if propertyIndex is already an integer, and convert the integer string to a true integer.\n\n\t\t\t\t// support resolving morphTarget names into indices.\n\t\t\t\tif ( ! targetObject.geometry ) {\n\n\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.', this );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t\tif ( targetObject.geometry.isBufferGeometry ) {\n\n\t\t\t\t\tif ( ! targetObject.geometry.morphAttributes ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfor ( var i = 0; i < this.node.geometry.morphAttributes.position.length; i ++ ) {\n\n\t\t\t\t\t\tif ( targetObject.geometry.morphAttributes.position[ i ].name === propertyIndex ) {\n\n\t\t\t\t\t\t\tpropertyIndex = i;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( ! targetObject.geometry.morphTargets ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphTargets.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfor ( var i = 0; i < this.node.geometry.morphTargets.length; i ++ ) {\n\n\t\t\t\t\t\tif ( targetObject.geometry.morphTargets[ i ].name === propertyIndex ) {\n\n\t\t\t\t\t\t\tpropertyIndex = i;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tbindingType = this.BindingType.ArrayElement;\n\n\t\t\tthis.resolvedProperty = nodeProperty;\n\t\t\tthis.propertyIndex = propertyIndex;\n\n\t\t} else if ( nodeProperty.fromArray !== undefined && nodeProperty.toArray !== undefined ) {\n\n\t\t\t// must use copy for Object3D.Euler/Quaternion\n\n\t\t\tbindingType = this.BindingType.HasFromToArray;\n\n\t\t\tthis.resolvedProperty = nodeProperty;\n\n\t\t} else if ( Array.isArray( nodeProperty ) ) {\n\n\t\t\tbindingType = this.BindingType.EntireArray;\n\n\t\t\tthis.resolvedProperty = nodeProperty;\n\n\t\t} else {\n\n\t\t\tthis.propertyName = propertyName;\n\n\t\t}\n\n\t\t// select getter / setter\n\t\tthis.getValue = this.GetterByBindingType[ bindingType ];\n\t\tthis.setValue = this.SetterByBindingTypeAndVersioning[ bindingType ][ versioning ];\n\n\t},\n\n\tunbind: function () {\n\n\t\tthis.node = null;\n\n\t\t// back to the prototype version of getValue / setValue\n\t\t// note: avoiding to mutate the shape of 'this' via 'delete'\n\t\tthis.getValue = this._getValue_unbound;\n\t\tthis.setValue = this._setValue_unbound;\n\n\t}\n\n} );\n\n//!\\ DECLARE ALIAS AFTER assign prototype !\nObject.assign( PropertyBinding.prototype, {\n\n\t// initial state of these methods that calls 'bind'\n\t_getValue_unbound: PropertyBinding.prototype.getValue,\n\t_setValue_unbound: PropertyBinding.prototype.setValue,\n\n} );\n\n/**\n *\n * A group of objects that receives a shared animation state.\n *\n * Usage:\n *\n * - Add objects you would otherwise pass as 'root' to the\n * constructor or the .clipAction method of AnimationMixer.\n *\n * - Instead pass this object as 'root'.\n *\n * - You can also add and remove objects later when the mixer\n * is running.\n *\n * Note:\n *\n * Objects of this class appear as one object to the mixer,\n * so cache control of the individual objects must be done\n * on the group.\n *\n * Limitation:\n *\n * - The animated properties must be compatible among the\n * all objects in the group.\n *\n * - A single property can either be controlled through a\n * target group or directly, but not both.\n *\n * @author tschw\n */\n\nfunction AnimationObjectGroup() {\n\n\tthis.uuid = MathUtils.generateUUID();\n\n\t// cached objects followed by the active ones\n\tthis._objects = Array.prototype.slice.call( arguments );\n\n\tthis.nCachedObjects_ = 0; // threshold\n\t// note: read by PropertyBinding.Composite\n\n\tvar indices = {};\n\tthis._indicesByUUID = indices; // for bookkeeping\n\n\tfor ( var i = 0, n = arguments.length; i !== n; ++ i ) {\n\n\t\tindices[ arguments[ i ].uuid ] = i;\n\n\t}\n\n\tthis._paths = []; // inside: string\n\tthis._parsedPaths = []; // inside: { we don't care, here }\n\tthis._bindings = []; // inside: Array< PropertyBinding >\n\tthis._bindingsIndicesByPath = {}; // inside: indices in these arrays\n\n\tvar scope = this;\n\n\tthis.stats = {\n\n\t\tobjects: {\n\t\t\tget total() {\n\n\t\t\t\treturn scope._objects.length;\n\n\t\t\t},\n\t\t\tget inUse() {\n\n\t\t\t\treturn this.total - scope.nCachedObjects_;\n\n\t\t\t}\n\t\t},\n\t\tget bindingsPerObject() {\n\n\t\t\treturn scope._bindings.length;\n\n\t\t}\n\n\t};\n\n}\n\nObject.assign( AnimationObjectGroup.prototype, {\n\n\tisAnimationObjectGroup: true,\n\n\tadd: function () {\n\n\t\tvar objects = this._objects,\n\t\t\tnObjects = objects.length,\n\t\t\tnCachedObjects = this.nCachedObjects_,\n\t\t\tindicesByUUID = this._indicesByUUID,\n\t\t\tpaths = this._paths,\n\t\t\tparsedPaths = this._parsedPaths,\n\t\t\tbindings = this._bindings,\n\t\t\tnBindings = bindings.length,\n\t\t\tknownObject = undefined;\n\n\t\tfor ( var i = 0, n = arguments.length; i !== n; ++ i ) {\n\n\t\t\tvar object = arguments[ i ],\n\t\t\t\tuuid = object.uuid,\n\t\t\t\tindex = indicesByUUID[ uuid ];\n\n\t\t\tif ( index === undefined ) {\n\n\t\t\t\t// unknown object -> add it to the ACTIVE region\n\n\t\t\t\tindex = nObjects ++;\n\t\t\t\tindicesByUUID[ uuid ] = index;\n\t\t\t\tobjects.push( object );\n\n\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\tfor ( var j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\tbindings[ j ].push( new PropertyBinding( object, paths[ j ], parsedPaths[ j ] ) );\n\n\t\t\t\t}\n\n\t\t\t} else if ( index < nCachedObjects ) {\n\n\t\t\t\tknownObject = objects[ index ];\n\n\t\t\t\t// move existing object to the ACTIVE region\n\n\t\t\t\tvar firstActiveIndex = -- nCachedObjects,\n\t\t\t\t\tlastCachedObject = objects[ firstActiveIndex ];\n\n\t\t\t\tindicesByUUID[ lastCachedObject.uuid ] = index;\n\t\t\t\tobjects[ index ] = lastCachedObject;\n\n\t\t\t\tindicesByUUID[ uuid ] = firstActiveIndex;\n\t\t\t\tobjects[ firstActiveIndex ] = object;\n\n\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\tfor ( var j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\tvar bindingsForPath = bindings[ j ],\n\t\t\t\t\t\tlastCached = bindingsForPath[ firstActiveIndex ],\n\t\t\t\t\t\tbinding = bindingsForPath[ index ];\n\n\t\t\t\t\tbindingsForPath[ index ] = lastCached;\n\n\t\t\t\t\tif ( binding === undefined ) {\n\n\t\t\t\t\t\t// since we do not bother to create new bindings\n\t\t\t\t\t\t// for objects that are cached, the binding may\n\t\t\t\t\t\t// or may not exist\n\n\t\t\t\t\t\tbinding = new PropertyBinding( object, paths[ j ], parsedPaths[ j ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbindingsForPath[ firstActiveIndex ] = binding;\n\n\t\t\t\t}\n\n\t\t\t} else if ( objects[ index ] !== knownObject ) {\n\n\t\t\t\tconsole.error( 'THREE.AnimationObjectGroup: Different objects with the same UUID ' +\n\t\t\t\t\t'detected. Clean the caches or recreate your infrastructure when reloading scenes.' );\n\n\t\t\t} // else the object is already where we want it to be\n\n\t\t} // for arguments\n\n\t\tthis.nCachedObjects_ = nCachedObjects;\n\n\t},\n\n\tremove: function () {\n\n\t\tvar objects = this._objects,\n\t\t\tnCachedObjects = this.nCachedObjects_,\n\t\t\tindicesByUUID = this._indicesByUUID,\n\t\t\tbindings = this._bindings,\n\t\t\tnBindings = bindings.length;\n\n\t\tfor ( var i = 0, n = arguments.length; i !== n; ++ i ) {\n\n\t\t\tvar object = arguments[ i ],\n\t\t\t\tuuid = object.uuid,\n\t\t\t\tindex = indicesByUUID[ uuid ];\n\n\t\t\tif ( index !== undefined && index >= nCachedObjects ) {\n\n\t\t\t\t// move existing object into the CACHED region\n\n\t\t\t\tvar lastCachedIndex = nCachedObjects ++,\n\t\t\t\t\tfirstActiveObject = objects[ lastCachedIndex ];\n\n\t\t\t\tindicesByUUID[ firstActiveObject.uuid ] = index;\n\t\t\t\tobjects[ index ] = firstActiveObject;\n\n\t\t\t\tindicesByUUID[ uuid ] = lastCachedIndex;\n\t\t\t\tobjects[ lastCachedIndex ] = object;\n\n\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\tfor ( var j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\tvar bindingsForPath = bindings[ j ],\n\t\t\t\t\t\tfirstActive = bindingsForPath[ lastCachedIndex ],\n\t\t\t\t\t\tbinding = bindingsForPath[ index ];\n\n\t\t\t\t\tbindingsForPath[ index ] = firstActive;\n\t\t\t\t\tbindingsForPath[ lastCachedIndex ] = binding;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} // for arguments\n\n\t\tthis.nCachedObjects_ = nCachedObjects;\n\n\t},\n\n\t// remove & forget\n\tuncache: function () {\n\n\t\tvar objects = this._objects,\n\t\t\tnObjects = objects.length,\n\t\t\tnCachedObjects = this.nCachedObjects_,\n\t\t\tindicesByUUID = this._indicesByUUID,\n\t\t\tbindings = this._bindings,\n\t\t\tnBindings = bindings.length;\n\n\t\tfor ( var i = 0, n = arguments.length; i !== n; ++ i ) {\n\n\t\t\tvar object = arguments[ i ],\n\t\t\t\tuuid = object.uuid,\n\t\t\t\tindex = indicesByUUID[ uuid ];\n\n\t\t\tif ( index !== undefined ) {\n\n\t\t\t\tdelete indicesByUUID[ uuid ];\n\n\t\t\t\tif ( index < nCachedObjects ) {\n\n\t\t\t\t\t// object is cached, shrink the CACHED region\n\n\t\t\t\t\tvar firstActiveIndex = -- nCachedObjects,\n\t\t\t\t\t\tlastCachedObject = objects[ firstActiveIndex ],\n\t\t\t\t\t\tlastIndex = -- nObjects,\n\t\t\t\t\t\tlastObject = objects[ lastIndex ];\n\n\t\t\t\t\t// last cached object takes this object's place\n\t\t\t\t\tindicesByUUID[ lastCachedObject.uuid ] = index;\n\t\t\t\t\tobjects[ index ] = lastCachedObject;\n\n\t\t\t\t\t// last object goes to the activated slot and pop\n\t\t\t\t\tindicesByUUID[ lastObject.uuid ] = firstActiveIndex;\n\t\t\t\t\tobjects[ firstActiveIndex ] = lastObject;\n\t\t\t\t\tobjects.pop();\n\n\t\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\t\tfor ( var j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\t\tvar bindingsForPath = bindings[ j ],\n\t\t\t\t\t\t\tlastCached = bindingsForPath[ firstActiveIndex ],\n\t\t\t\t\t\t\tlast = bindingsForPath[ lastIndex ];\n\n\t\t\t\t\t\tbindingsForPath[ index ] = lastCached;\n\t\t\t\t\t\tbindingsForPath[ firstActiveIndex ] = last;\n\t\t\t\t\t\tbindingsForPath.pop();\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// object is active, just swap with the last and pop\n\n\t\t\t\t\tvar lastIndex = -- nObjects,\n\t\t\t\t\t\tlastObject = objects[ lastIndex ];\n\n\t\t\t\t\tindicesByUUID[ lastObject.uuid ] = index;\n\t\t\t\t\tobjects[ index ] = lastObject;\n\t\t\t\t\tobjects.pop();\n\n\t\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\t\tfor ( var j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\t\tvar bindingsForPath = bindings[ j ];\n\n\t\t\t\t\t\tbindingsForPath[ index ] = bindingsForPath[ lastIndex ];\n\t\t\t\t\t\tbindingsForPath.pop();\n\n\t\t\t\t\t}\n\n\t\t\t\t} // cached or active\n\n\t\t\t} // if object is known\n\n\t\t} // for arguments\n\n\t\tthis.nCachedObjects_ = nCachedObjects;\n\n\t},\n\n\t// Internal interface used by befriended PropertyBinding.Composite:\n\n\tsubscribe_: function ( path, parsedPath ) {\n\n\t\t// returns an array of bindings for the given path that is changed\n\t\t// according to the contained objects in the group\n\n\t\tvar indicesByPath = this._bindingsIndicesByPath,\n\t\t\tindex = indicesByPath[ path ],\n\t\t\tbindings = this._bindings;\n\n\t\tif ( index !== undefined ) return bindings[ index ];\n\n\t\tvar paths = this._paths,\n\t\t\tparsedPaths = this._parsedPaths,\n\t\t\tobjects = this._objects,\n\t\t\tnObjects = objects.length,\n\t\t\tnCachedObjects = this.nCachedObjects_,\n\t\t\tbindingsForPath = new Array( nObjects );\n\n\t\tindex = bindings.length;\n\n\t\tindicesByPath[ path ] = index;\n\n\t\tpaths.push( path );\n\t\tparsedPaths.push( parsedPath );\n\t\tbindings.push( bindingsForPath );\n\n\t\tfor ( var i = nCachedObjects, n = objects.length; i !== n; ++ i ) {\n\n\t\t\tvar object = objects[ i ];\n\t\t\tbindingsForPath[ i ] = new PropertyBinding( object, path, parsedPath );\n\n\t\t}\n\n\t\treturn bindingsForPath;\n\n\t},\n\n\tunsubscribe_: function ( path ) {\n\n\t\t// tells the group to forget about a property path and no longer\n\t\t// update the array previously obtained with 'subscribe_'\n\n\t\tvar indicesByPath = this._bindingsIndicesByPath,\n\t\t\tindex = indicesByPath[ path ];\n\n\t\tif ( index !== undefined ) {\n\n\t\t\tvar paths = this._paths,\n\t\t\t\tparsedPaths = this._parsedPaths,\n\t\t\t\tbindings = this._bindings,\n\t\t\t\tlastBindingsIndex = bindings.length - 1,\n\t\t\t\tlastBindings = bindings[ lastBindingsIndex ],\n\t\t\t\tlastBindingsPath = path[ lastBindingsIndex ];\n\n\t\t\tindicesByPath[ lastBindingsPath ] = index;\n\n\t\t\tbindings[ index ] = lastBindings;\n\t\t\tbindings.pop();\n\n\t\t\tparsedPaths[ index ] = parsedPaths[ lastBindingsIndex ];\n\t\t\tparsedPaths.pop();\n\n\t\t\tpaths[ index ] = paths[ lastBindingsIndex ];\n\t\t\tpaths.pop();\n\n\t\t}\n\n\t}\n\n} );\n\n/**\n *\n * Action provided by AnimationMixer for scheduling clip playback on specific\n * objects.\n *\n * @author Ben Houston / http://clara.io/\n * @author David Sarno / http://lighthaus.us/\n * @author tschw\n *\n */\n\nfunction AnimationAction( mixer, clip, localRoot ) {\n\n\tthis._mixer = mixer;\n\tthis._clip = clip;\n\tthis._localRoot = localRoot || null;\n\n\tvar tracks = clip.tracks,\n\t\tnTracks = tracks.length,\n\t\tinterpolants = new Array( nTracks );\n\n\tvar interpolantSettings = {\n\t\tendingStart: ZeroCurvatureEnding,\n\t\tendingEnd: ZeroCurvatureEnding\n\t};\n\n\tfor ( var i = 0; i !== nTracks; ++ i ) {\n\n\t\tvar interpolant = tracks[ i ].createInterpolant( null );\n\t\tinterpolants[ i ] = interpolant;\n\t\tinterpolant.settings = interpolantSettings;\n\n\t}\n\n\tthis._interpolantSettings = interpolantSettings;\n\n\tthis._interpolants = interpolants; // bound by the mixer\n\n\t// inside: PropertyMixer (managed by the mixer)\n\tthis._propertyBindings = new Array( nTracks );\n\n\tthis._cacheIndex = null; // for the memory manager\n\tthis._byClipCacheIndex = null; // for the memory manager\n\n\tthis._timeScaleInterpolant = null;\n\tthis._weightInterpolant = null;\n\n\tthis.loop = LoopRepeat;\n\tthis._loopCount = - 1;\n\n\t// global mixer time when the action is to be started\n\t// it's set back to 'null' upon start of the action\n\tthis._startTime = null;\n\n\t// scaled local time of the action\n\t// gets clamped or wrapped to 0..clip.duration according to loop\n\tthis.time = 0;\n\n\tthis.timeScale = 1;\n\tthis._effectiveTimeScale = 1;\n\n\tthis.weight = 1;\n\tthis._effectiveWeight = 1;\n\n\tthis.repetitions = Infinity; // no. of repetitions when looping\n\n\tthis.paused = false; // true -> zero effective time scale\n\tthis.enabled = true; // false -> zero effective weight\n\n\tthis.clampWhenFinished = false;// keep feeding the last frame?\n\n\tthis.zeroSlopeAtStart = true;// for smooth interpolation w/o separate\n\tthis.zeroSlopeAtEnd = true;// clips for start, loop and end\n\n}\n\nObject.assign( AnimationAction.prototype, {\n\n\t// State & Scheduling\n\n\tplay: function () {\n\n\t\tthis._mixer._activateAction( this );\n\n\t\treturn this;\n\n\t},\n\n\tstop: function () {\n\n\t\tthis._mixer._deactivateAction( this );\n\n\t\treturn this.reset();\n\n\t},\n\n\treset: function () {\n\n\t\tthis.paused = false;\n\t\tthis.enabled = true;\n\n\t\tthis.time = 0; // restart clip\n\t\tthis._loopCount = - 1;// forget previous loops\n\t\tthis._startTime = null;// forget scheduling\n\n\t\treturn this.stopFading().stopWarping();\n\n\t},\n\n\tisRunning: function () {\n\n\t\treturn this.enabled && ! this.paused && this.timeScale !== 0 &&\n\t\t\tthis._startTime === null && this._mixer._isActiveAction( this );\n\n\t},\n\n\t// return true when play has been called\n\tisScheduled: function () {\n\n\t\treturn this._mixer._isActiveAction( this );\n\n\t},\n\n\tstartAt: function ( time ) {\n\n\t\tthis._startTime = time;\n\n\t\treturn this;\n\n\t},\n\n\tsetLoop: function ( mode, repetitions ) {\n\n\t\tthis.loop = mode;\n\t\tthis.repetitions = repetitions;\n\n\t\treturn this;\n\n\t},\n\n\t// Weight\n\n\t// set the weight stopping any scheduled fading\n\t// although .enabled = false yields an effective weight of zero, this\n\t// method does *not* change .enabled, because it would be confusing\n\tsetEffectiveWeight: function ( weight ) {\n\n\t\tthis.weight = weight;\n\n\t\t// note: same logic as when updated at runtime\n\t\tthis._effectiveWeight = this.enabled ? weight : 0;\n\n\t\treturn this.stopFading();\n\n\t},\n\n\t// return the weight considering fading and .enabled\n\tgetEffectiveWeight: function () {\n\n\t\treturn this._effectiveWeight;\n\n\t},\n\n\tfadeIn: function ( duration ) {\n\n\t\treturn this._scheduleFading( duration, 0, 1 );\n\n\t},\n\n\tfadeOut: function ( duration ) {\n\n\t\treturn this._scheduleFading( duration, 1, 0 );\n\n\t},\n\n\tcrossFadeFrom: function ( fadeOutAction, duration, warp ) {\n\n\t\tfadeOutAction.fadeOut( duration );\n\t\tthis.fadeIn( duration );\n\n\t\tif ( warp ) {\n\n\t\t\tvar fadeInDuration = this._clip.duration,\n\t\t\t\tfadeOutDuration = fadeOutAction._clip.duration,\n\n\t\t\t\tstartEndRatio = fadeOutDuration / fadeInDuration,\n\t\t\t\tendStartRatio = fadeInDuration / fadeOutDuration;\n\n\t\t\tfadeOutAction.warp( 1.0, startEndRatio, duration );\n\t\t\tthis.warp( endStartRatio, 1.0, duration );\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tcrossFadeTo: function ( fadeInAction, duration, warp ) {\n\n\t\treturn fadeInAction.crossFadeFrom( this, duration, warp );\n\n\t},\n\n\tstopFading: function () {\n\n\t\tvar weightInterpolant = this._weightInterpolant;\n\n\t\tif ( weightInterpolant !== null ) {\n\n\t\t\tthis._weightInterpolant = null;\n\t\t\tthis._mixer._takeBackControlInterpolant( weightInterpolant );\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\t// Time Scale Control\n\n\t// set the time scale stopping any scheduled warping\n\t// although .paused = true yields an effective time scale of zero, this\n\t// method does *not* change .paused, because it would be confusing\n\tsetEffectiveTimeScale: function ( timeScale ) {\n\n\t\tthis.timeScale = timeScale;\n\t\tthis._effectiveTimeScale = this.paused ? 0 : timeScale;\n\n\t\treturn this.stopWarping();\n\n\t},\n\n\t// return the time scale considering warping and .paused\n\tgetEffectiveTimeScale: function () {\n\n\t\treturn this._effectiveTimeScale;\n\n\t},\n\n\tsetDuration: function ( duration ) {\n\n\t\tthis.timeScale = this._clip.duration / duration;\n\n\t\treturn this.stopWarping();\n\n\t},\n\n\tsyncWith: function ( action ) {\n\n\t\tthis.time = action.time;\n\t\tthis.timeScale = action.timeScale;\n\n\t\treturn this.stopWarping();\n\n\t},\n\n\thalt: function ( duration ) {\n\n\t\treturn this.warp( this._effectiveTimeScale, 0, duration );\n\n\t},\n\n\twarp: function ( startTimeScale, endTimeScale, duration ) {\n\n\t\tvar mixer = this._mixer, now = mixer.time,\n\t\t\tinterpolant = this._timeScaleInterpolant,\n\n\t\t\ttimeScale = this.timeScale;\n\n\t\tif ( interpolant === null ) {\n\n\t\t\tinterpolant = mixer._lendControlInterpolant();\n\t\t\tthis._timeScaleInterpolant = interpolant;\n\n\t\t}\n\n\t\tvar times = interpolant.parameterPositions,\n\t\t\tvalues = interpolant.sampleValues;\n\n\t\ttimes[ 0 ] = now;\n\t\ttimes[ 1 ] = now + duration;\n\n\t\tvalues[ 0 ] = startTimeScale / timeScale;\n\t\tvalues[ 1 ] = endTimeScale / timeScale;\n\n\t\treturn this;\n\n\t},\n\n\tstopWarping: function () {\n\n\t\tvar timeScaleInterpolant = this._timeScaleInterpolant;\n\n\t\tif ( timeScaleInterpolant !== null ) {\n\n\t\t\tthis._timeScaleInterpolant = null;\n\t\t\tthis._mixer._takeBackControlInterpolant( timeScaleInterpolant );\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\t// Object Accessors\n\n\tgetMixer: function () {\n\n\t\treturn this._mixer;\n\n\t},\n\n\tgetClip: function () {\n\n\t\treturn this._clip;\n\n\t},\n\n\tgetRoot: function () {\n\n\t\treturn this._localRoot || this._mixer._root;\n\n\t},\n\n\t// Interna\n\n\t_update: function ( time, deltaTime, timeDirection, accuIndex ) {\n\n\t\t// called by the mixer\n\n\t\tif ( ! this.enabled ) {\n\n\t\t\t// call ._updateWeight() to update ._effectiveWeight\n\n\t\t\tthis._updateWeight( time );\n\t\t\treturn;\n\n\t\t}\n\n\t\tvar startTime = this._startTime;\n\n\t\tif ( startTime !== null ) {\n\n\t\t\t// check for scheduled start of action\n\n\t\t\tvar timeRunning = ( time - startTime ) * timeDirection;\n\t\t\tif ( timeRunning < 0 || timeDirection === 0 ) {\n\n\t\t\t\treturn; // yet to come / don't decide when delta = 0\n\n\t\t\t}\n\n\t\t\t// start\n\n\t\t\tthis._startTime = null; // unschedule\n\t\t\tdeltaTime = timeDirection * timeRunning;\n\n\t\t}\n\n\t\t// apply time scale and advance time\n\n\t\tdeltaTime *= this._updateTimeScale( time );\n\t\tvar clipTime = this._updateTime( deltaTime );\n\n\t\t// note: _updateTime may disable the action resulting in\n\t\t// an effective weight of 0\n\n\t\tvar weight = this._updateWeight( time );\n\n\t\tif ( weight > 0 ) {\n\n\t\t\tvar interpolants = this._interpolants;\n\t\t\tvar propertyMixers = this._propertyBindings;\n\n\t\t\tfor ( var j = 0, m = interpolants.length; j !== m; ++ j ) {\n\n\t\t\t\tinterpolants[ j ].evaluate( clipTime );\n\t\t\t\tpropertyMixers[ j ].accumulate( accuIndex, weight );\n\n\t\t\t}\n\n\t\t}\n\n\t},\n\n\t_updateWeight: function ( time ) {\n\n\t\tvar weight = 0;\n\n\t\tif ( this.enabled ) {\n\n\t\t\tweight = this.weight;\n\t\t\tvar interpolant = this._weightInterpolant;\n\n\t\t\tif ( interpolant !== null ) {\n\n\t\t\t\tvar interpolantValue = interpolant.evaluate( time )[ 0 ];\n\n\t\t\t\tweight *= interpolantValue;\n\n\t\t\t\tif ( time > interpolant.parameterPositions[ 1 ] ) {\n\n\t\t\t\t\tthis.stopFading();\n\n\t\t\t\t\tif ( interpolantValue === 0 ) {\n\n\t\t\t\t\t\t// faded out, disable\n\t\t\t\t\t\tthis.enabled = false;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis._effectiveWeight = weight;\n\t\treturn weight;\n\n\t},\n\n\t_updateTimeScale: function ( time ) {\n\n\t\tvar timeScale = 0;\n\n\t\tif ( ! this.paused ) {\n\n\t\t\ttimeScale = this.timeScale;\n\n\t\t\tvar interpolant = this._timeScaleInterpolant;\n\n\t\t\tif ( interpolant !== null ) {\n\n\t\t\t\tvar interpolantValue = interpolant.evaluate( time )[ 0 ];\n\n\t\t\t\ttimeScale *= interpolantValue;\n\n\t\t\t\tif ( time > interpolant.parameterPositions[ 1 ] ) {\n\n\t\t\t\t\tthis.stopWarping();\n\n\t\t\t\t\tif ( timeScale === 0 ) {\n\n\t\t\t\t\t\t// motion has halted, pause\n\t\t\t\t\t\tthis.paused = true;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// warp done - apply final time scale\n\t\t\t\t\t\tthis.timeScale = timeScale;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis._effectiveTimeScale = timeScale;\n\t\treturn timeScale;\n\n\t},\n\n\t_updateTime: function ( deltaTime ) {\n\n\t\tvar time = this.time + deltaTime;\n\t\tvar duration = this._clip.duration;\n\t\tvar loop = this.loop;\n\t\tvar loopCount = this._loopCount;\n\n\t\tvar pingPong = ( loop === LoopPingPong );\n\n\t\tif ( deltaTime === 0 ) {\n\n\t\t\tif ( loopCount === - 1 ) return time;\n\n\t\t\treturn ( pingPong && ( loopCount & 1 ) === 1 ) ? duration - time : time;\n\n\t\t}\n\n\t\tif ( loop === LoopOnce ) {\n\n\t\t\tif ( loopCount === - 1 ) {\n\n\t\t\t\t// just started\n\n\t\t\t\tthis._loopCount = 0;\n\t\t\t\tthis._setEndings( true, true, false );\n\n\t\t\t}\n\n\t\t\thandle_stop: {\n\n\t\t\t\tif ( time >= duration ) {\n\n\t\t\t\t\ttime = duration;\n\n\t\t\t\t} else if ( time < 0 ) {\n\n\t\t\t\t\ttime = 0;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis.time = time;\n\n\t\t\t\t\tbreak handle_stop;\n\n\t\t\t\t}\n\n\t\t\t\tif ( this.clampWhenFinished ) this.paused = true;\n\t\t\t\telse this.enabled = false;\n\n\t\t\t\tthis.time = time;\n\n\t\t\t\tthis._mixer.dispatchEvent( {\n\t\t\t\t\ttype: 'finished', action: this,\n\t\t\t\t\tdirection: deltaTime < 0 ? - 1 : 1\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t} else { // repetitive Repeat or PingPong\n\n\t\t\tif ( loopCount === - 1 ) {\n\n\t\t\t\t// just started\n\n\t\t\t\tif ( deltaTime >= 0 ) {\n\n\t\t\t\t\tloopCount = 0;\n\n\t\t\t\t\tthis._setEndings( true, this.repetitions === 0, pingPong );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// when looping in reverse direction, the initial\n\t\t\t\t\t// transition through zero counts as a repetition,\n\t\t\t\t\t// so leave loopCount at -1\n\n\t\t\t\t\tthis._setEndings( this.repetitions === 0, true, pingPong );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( time >= duration || time < 0 ) {\n\n\t\t\t\t// wrap around\n\n\t\t\t\tvar loopDelta = Math.floor( time / duration ); // signed\n\t\t\t\ttime -= duration * loopDelta;\n\n\t\t\t\tloopCount += Math.abs( loopDelta );\n\n\t\t\t\tvar pending = this.repetitions - loopCount;\n\n\t\t\t\tif ( pending <= 0 ) {\n\n\t\t\t\t\t// have to stop (switch state, clamp time, fire event)\n\n\t\t\t\t\tif ( this.clampWhenFinished ) this.paused = true;\n\t\t\t\t\telse this.enabled = false;\n\n\t\t\t\t\ttime = deltaTime > 0 ? duration : 0;\n\n\t\t\t\t\tthis.time = time;\n\n\t\t\t\t\tthis._mixer.dispatchEvent( {\n\t\t\t\t\t\ttype: 'finished', action: this,\n\t\t\t\t\t\tdirection: deltaTime > 0 ? 1 : - 1\n\t\t\t\t\t} );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// keep running\n\n\t\t\t\t\tif ( pending === 1 ) {\n\n\t\t\t\t\t\t// entering the last round\n\n\t\t\t\t\t\tvar atStart = deltaTime < 0;\n\t\t\t\t\t\tthis._setEndings( atStart, ! atStart, pingPong );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tthis._setEndings( false, false, pingPong );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tthis._loopCount = loopCount;\n\n\t\t\t\t\tthis.time = time;\n\n\t\t\t\t\tthis._mixer.dispatchEvent( {\n\t\t\t\t\t\ttype: 'loop', action: this, loopDelta: loopDelta\n\t\t\t\t\t} );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tthis.time = time;\n\n\t\t\t}\n\n\t\t\tif ( pingPong && ( loopCount & 1 ) === 1 ) {\n\n\t\t\t\t// invert time for the \"pong round\"\n\n\t\t\t\treturn duration - time;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn time;\n\n\t},\n\n\t_setEndings: function ( atStart, atEnd, pingPong ) {\n\n\t\tvar settings = this._interpolantSettings;\n\n\t\tif ( pingPong ) {\n\n\t\t\tsettings.endingStart = ZeroSlopeEnding;\n\t\t\tsettings.endingEnd = ZeroSlopeEnding;\n\n\t\t} else {\n\n\t\t\t// assuming for LoopOnce atStart == atEnd == true\n\n\t\t\tif ( atStart ) {\n\n\t\t\t\tsettings.endingStart = this.zeroSlopeAtStart ? ZeroSlopeEnding : ZeroCurvatureEnding;\n\n\t\t\t} else {\n\n\t\t\t\tsettings.endingStart = WrapAroundEnding;\n\n\t\t\t}\n\n\t\t\tif ( atEnd ) {\n\n\t\t\t\tsettings.endingEnd = this.zeroSlopeAtEnd ? ZeroSlopeEnding : ZeroCurvatureEnding;\n\n\t\t\t} else {\n\n\t\t\t\tsettings.endingEnd \t = WrapAroundEnding;\n\n\t\t\t}\n\n\t\t}\n\n\t},\n\n\t_scheduleFading: function ( duration, weightNow, weightThen ) {\n\n\t\tvar mixer = this._mixer, now = mixer.time,\n\t\t\tinterpolant = this._weightInterpolant;\n\n\t\tif ( interpolant === null ) {\n\n\t\t\tinterpolant = mixer._lendControlInterpolant();\n\t\t\tthis._weightInterpolant = interpolant;\n\n\t\t}\n\n\t\tvar times = interpolant.parameterPositions,\n\t\t\tvalues = interpolant.sampleValues;\n\n\t\ttimes[ 0 ] = now;\n\t\tvalues[ 0 ] = weightNow;\n\t\ttimes[ 1 ] = now + duration;\n\t\tvalues[ 1 ] = weightThen;\n\n\t\treturn this;\n\n\t}\n\n} );\n\n/**\n *\n * Player for AnimationClips.\n *\n *\n * @author Ben Houston / http://clara.io/\n * @author David Sarno / http://lighthaus.us/\n * @author tschw\n */\n\nfunction AnimationMixer( root ) {\n\n\tthis._root = root;\n\tthis._initMemoryManager();\n\tthis._accuIndex = 0;\n\n\tthis.time = 0;\n\n\tthis.timeScale = 1.0;\n\n}\n\nAnimationMixer.prototype = Object.assign( Object.create( EventDispatcher.prototype ), {\n\n\tconstructor: AnimationMixer,\n\n\t_bindAction: function ( action, prototypeAction ) {\n\n\t\tvar root = action._localRoot || this._root,\n\t\t\ttracks = action._clip.tracks,\n\t\t\tnTracks = tracks.length,\n\t\t\tbindings = action._propertyBindings,\n\t\t\tinterpolants = action._interpolants,\n\t\t\trootUuid = root.uuid,\n\t\t\tbindingsByRoot = this._bindingsByRootAndName,\n\t\t\tbindingsByName = bindingsByRoot[ rootUuid ];\n\n\t\tif ( bindingsByName === undefined ) {\n\n\t\t\tbindingsByName = {};\n\t\t\tbindingsByRoot[ rootUuid ] = bindingsByName;\n\n\t\t}\n\n\t\tfor ( var i = 0; i !== nTracks; ++ i ) {\n\n\t\t\tvar track = tracks[ i ],\n\t\t\t\ttrackName = track.name,\n\t\t\t\tbinding = bindingsByName[ trackName ];\n\n\t\t\tif ( binding !== undefined ) {\n\n\t\t\t\tbindings[ i ] = binding;\n\n\t\t\t} else {\n\n\t\t\t\tbinding = bindings[ i ];\n\n\t\t\t\tif ( binding !== undefined ) {\n\n\t\t\t\t\t// existing binding, make sure the cache knows\n\n\t\t\t\t\tif ( binding._cacheIndex === null ) {\n\n\t\t\t\t\t\t++ binding.referenceCount;\n\t\t\t\t\t\tthis._addInactiveBinding( binding, rootUuid, trackName );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tcontinue;\n\n\t\t\t\t}\n\n\t\t\t\tvar path = prototypeAction && prototypeAction.\n\t\t\t\t\t_propertyBindings[ i ].binding.parsedPath;\n\n\t\t\t\tbinding = new PropertyMixer(\n\t\t\t\t\tPropertyBinding.create( root, trackName, path ),\n\t\t\t\t\ttrack.ValueTypeName, track.getValueSize() );\n\n\t\t\t\t++ binding.referenceCount;\n\t\t\t\tthis._addInactiveBinding( binding, rootUuid, trackName );\n\n\t\t\t\tbindings[ i ] = binding;\n\n\t\t\t}\n\n\t\t\tinterpolants[ i ].resultBuffer = binding.buffer;\n\n\t\t}\n\n\t},\n\n\t_activateAction: function ( action ) {\n\n\t\tif ( ! this._isActiveAction( action ) ) {\n\n\t\t\tif ( action._cacheIndex === null ) {\n\n\t\t\t\t// this action has been forgotten by the cache, but the user\n\t\t\t\t// appears to be still using it -> rebind\n\n\t\t\t\tvar rootUuid = ( action._localRoot || this._root ).uuid,\n\t\t\t\t\tclipUuid = action._clip.uuid,\n\t\t\t\t\tactionsForClip = this._actionsByClip[ clipUuid ];\n\n\t\t\t\tthis._bindAction( action,\n\t\t\t\t\tactionsForClip && actionsForClip.knownActions[ 0 ] );\n\n\t\t\t\tthis._addInactiveAction( action, clipUuid, rootUuid );\n\n\t\t\t}\n\n\t\t\tvar bindings = action._propertyBindings;\n\n\t\t\t// increment reference counts / sort out state\n\t\t\tfor ( var i = 0, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\t\tvar binding = bindings[ i ];\n\n\t\t\t\tif ( binding.useCount ++ === 0 ) {\n\n\t\t\t\t\tthis._lendBinding( binding );\n\t\t\t\t\tbinding.saveOriginalState();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis._lendAction( action );\n\n\t\t}\n\n\t},\n\n\t_deactivateAction: function ( action ) {\n\n\t\tif ( this._isActiveAction( action ) ) {\n\n\t\t\tvar bindings = action._propertyBindings;\n\n\t\t\t// decrement reference counts / sort out state\n\t\t\tfor ( var i = 0, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\t\tvar binding = bindings[ i ];\n\n\t\t\t\tif ( -- binding.useCount === 0 ) {\n\n\t\t\t\t\tbinding.restoreOriginalState();\n\t\t\t\t\tthis._takeBackBinding( binding );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis._takeBackAction( action );\n\n\t\t}\n\n\t},\n\n\t// Memory manager\n\n\t_initMemoryManager: function () {\n\n\t\tthis._actions = []; // 'nActiveActions' followed by inactive ones\n\t\tthis._nActiveActions = 0;\n\n\t\tthis._actionsByClip = {};\n\t\t// inside:\n\t\t// {\n\t\t// \tknownActions: Array< AnimationAction > - used as prototypes\n\t\t// \tactionByRoot: AnimationAction - lookup\n\t\t// }\n\n\n\t\tthis._bindings = []; // 'nActiveBindings' followed by inactive ones\n\t\tthis._nActiveBindings = 0;\n\n\t\tthis._bindingsByRootAndName = {}; // inside: Map< name, PropertyMixer >\n\n\n\t\tthis._controlInterpolants = []; // same game as above\n\t\tthis._nActiveControlInterpolants = 0;\n\n\t\tvar scope = this;\n\n\t\tthis.stats = {\n\n\t\t\tactions: {\n\t\t\t\tget total() {\n\n\t\t\t\t\treturn scope._actions.length;\n\n\t\t\t\t},\n\t\t\t\tget inUse() {\n\n\t\t\t\t\treturn scope._nActiveActions;\n\n\t\t\t\t}\n\t\t\t},\n\t\t\tbindings: {\n\t\t\t\tget total() {\n\n\t\t\t\t\treturn scope._bindings.length;\n\n\t\t\t\t},\n\t\t\t\tget inUse() {\n\n\t\t\t\t\treturn scope._nActiveBindings;\n\n\t\t\t\t}\n\t\t\t},\n\t\t\tcontrolInterpolants: {\n\t\t\t\tget total() {\n\n\t\t\t\t\treturn scope._controlInterpolants.length;\n\n\t\t\t\t},\n\t\t\t\tget inUse() {\n\n\t\t\t\t\treturn scope._nActiveControlInterpolants;\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t};\n\n\t},\n\n\t// Memory management for AnimationAction objects\n\n\t_isActiveAction: function ( action ) {\n\n\t\tvar index = action._cacheIndex;\n\t\treturn index !== null && index < this._nActiveActions;\n\n\t},\n\n\t_addInactiveAction: function ( action, clipUuid, rootUuid ) {\n\n\t\tvar actions = this._actions,\n\t\t\tactionsByClip = this._actionsByClip,\n\t\t\tactionsForClip = actionsByClip[ clipUuid ];\n\n\t\tif ( actionsForClip === undefined ) {\n\n\t\t\tactionsForClip = {\n\n\t\t\t\tknownActions: [ action ],\n\t\t\t\tactionByRoot: {}\n\n\t\t\t};\n\n\t\t\taction._byClipCacheIndex = 0;\n\n\t\t\tactionsByClip[ clipUuid ] = actionsForClip;\n\n\t\t} else {\n\n\t\t\tvar knownActions = actionsForClip.knownActions;\n\n\t\t\taction._byClipCacheIndex = knownActions.length;\n\t\t\tknownActions.push( action );\n\n\t\t}\n\n\t\taction._cacheIndex = actions.length;\n\t\tactions.push( action );\n\n\t\tactionsForClip.actionByRoot[ rootUuid ] = action;\n\n\t},\n\n\t_removeInactiveAction: function ( action ) {\n\n\t\tvar actions = this._actions,\n\t\t\tlastInactiveAction = actions[ actions.length - 1 ],\n\t\t\tcacheIndex = action._cacheIndex;\n\n\t\tlastInactiveAction._cacheIndex = cacheIndex;\n\t\tactions[ cacheIndex ] = lastInactiveAction;\n\t\tactions.pop();\n\n\t\taction._cacheIndex = null;\n\n\n\t\tvar clipUuid = action._clip.uuid,\n\t\t\tactionsByClip = this._actionsByClip,\n\t\t\tactionsForClip = actionsByClip[ clipUuid ],\n\t\t\tknownActionsForClip = actionsForClip.knownActions,\n\n\t\t\tlastKnownAction =\n\t\t\t\tknownActionsForClip[ knownActionsForClip.length - 1 ],\n\n\t\t\tbyClipCacheIndex = action._byClipCacheIndex;\n\n\t\tlastKnownAction._byClipCacheIndex = byClipCacheIndex;\n\t\tknownActionsForClip[ byClipCacheIndex ] = lastKnownAction;\n\t\tknownActionsForClip.pop();\n\n\t\taction._byClipCacheIndex = null;\n\n\n\t\tvar actionByRoot = actionsForClip.actionByRoot,\n\t\t\trootUuid = ( action._localRoot || this._root ).uuid;\n\n\t\tdelete actionByRoot[ rootUuid ];\n\n\t\tif ( knownActionsForClip.length === 0 ) {\n\n\t\t\tdelete actionsByClip[ clipUuid ];\n\n\t\t}\n\n\t\tthis._removeInactiveBindingsForAction( action );\n\n\t},\n\n\t_removeInactiveBindingsForAction: function ( action ) {\n\n\t\tvar bindings = action._propertyBindings;\n\t\tfor ( var i = 0, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\tvar binding = bindings[ i ];\n\n\t\t\tif ( -- binding.referenceCount === 0 ) {\n\n\t\t\t\tthis._removeInactiveBinding( binding );\n\n\t\t\t}\n\n\t\t}\n\n\t},\n\n\t_lendAction: function ( action ) {\n\n\t\t// [ active actions | inactive actions ]\n\t\t// [ active actions >| inactive actions ]\n\t\t// s a\n\t\t// <-swap->\n\t\t// a s\n\n\t\tvar actions = this._actions,\n\t\t\tprevIndex = action._cacheIndex,\n\n\t\t\tlastActiveIndex = this._nActiveActions ++,\n\n\t\t\tfirstInactiveAction = actions[ lastActiveIndex ];\n\n\t\taction._cacheIndex = lastActiveIndex;\n\t\tactions[ lastActiveIndex ] = action;\n\n\t\tfirstInactiveAction._cacheIndex = prevIndex;\n\t\tactions[ prevIndex ] = firstInactiveAction;\n\n\t},\n\n\t_takeBackAction: function ( action ) {\n\n\t\t// [ active actions | inactive actions ]\n\t\t// [ active actions |< inactive actions ]\n\t\t// a s\n\t\t// <-swap->\n\t\t// s a\n\n\t\tvar actions = this._actions,\n\t\t\tprevIndex = action._cacheIndex,\n\n\t\t\tfirstInactiveIndex = -- this._nActiveActions,\n\n\t\t\tlastActiveAction = actions[ firstInactiveIndex ];\n\n\t\taction._cacheIndex = firstInactiveIndex;\n\t\tactions[ firstInactiveIndex ] = action;\n\n\t\tlastActiveAction._cacheIndex = prevIndex;\n\t\tactions[ prevIndex ] = lastActiveAction;\n\n\t},\n\n\t// Memory management for PropertyMixer objects\n\n\t_addInactiveBinding: function ( binding, rootUuid, trackName ) {\n\n\t\tvar bindingsByRoot = this._bindingsByRootAndName,\n\t\t\tbindingByName = bindingsByRoot[ rootUuid ],\n\n\t\t\tbindings = this._bindings;\n\n\t\tif ( bindingByName === undefined ) {\n\n\t\t\tbindingByName = {};\n\t\t\tbindingsByRoot[ rootUuid ] = bindingByName;\n\n\t\t}\n\n\t\tbindingByName[ trackName ] = binding;\n\n\t\tbinding._cacheIndex = bindings.length;\n\t\tbindings.push( binding );\n\n\t},\n\n\t_removeInactiveBinding: function ( binding ) {\n\n\t\tvar bindings = this._bindings,\n\t\t\tpropBinding = binding.binding,\n\t\t\trootUuid = propBinding.rootNode.uuid,\n\t\t\ttrackName = propBinding.path,\n\t\t\tbindingsByRoot = this._bindingsByRootAndName,\n\t\t\tbindingByName = bindingsByRoot[ rootUuid ],\n\n\t\t\tlastInactiveBinding = bindings[ bindings.length - 1 ],\n\t\t\tcacheIndex = binding._cacheIndex;\n\n\t\tlastInactiveBinding._cacheIndex = cacheIndex;\n\t\tbindings[ cacheIndex ] = lastInactiveBinding;\n\t\tbindings.pop();\n\n\t\tdelete bindingByName[ trackName ];\n\n\t\tif ( Object.keys( bindingByName ).length === 0 ) {\n\n\t\t\tdelete bindingsByRoot[ rootUuid ];\n\n\t\t}\n\n\t},\n\n\t_lendBinding: function ( binding ) {\n\n\t\tvar bindings = this._bindings,\n\t\t\tprevIndex = binding._cacheIndex,\n\n\t\t\tlastActiveIndex = this._nActiveBindings ++,\n\n\t\t\tfirstInactiveBinding = bindings[ lastActiveIndex ];\n\n\t\tbinding._cacheIndex = lastActiveIndex;\n\t\tbindings[ lastActiveIndex ] = binding;\n\n\t\tfirstInactiveBinding._cacheIndex = prevIndex;\n\t\tbindings[ prevIndex ] = firstInactiveBinding;\n\n\t},\n\n\t_takeBackBinding: function ( binding ) {\n\n\t\tvar bindings = this._bindings,\n\t\t\tprevIndex = binding._cacheIndex,\n\n\t\t\tfirstInactiveIndex = -- this._nActiveBindings,\n\n\t\t\tlastActiveBinding = bindings[ firstInactiveIndex ];\n\n\t\tbinding._cacheIndex = firstInactiveIndex;\n\t\tbindings[ firstInactiveIndex ] = binding;\n\n\t\tlastActiveBinding._cacheIndex = prevIndex;\n\t\tbindings[ prevIndex ] = lastActiveBinding;\n\n\t},\n\n\n\t// Memory management of Interpolants for weight and time scale\n\n\t_lendControlInterpolant: function () {\n\n\t\tvar interpolants = this._controlInterpolants,\n\t\t\tlastActiveIndex = this._nActiveControlInterpolants ++,\n\t\t\tinterpolant = interpolants[ lastActiveIndex ];\n\n\t\tif ( interpolant === undefined ) {\n\n\t\t\tinterpolant = new LinearInterpolant(\n\t\t\t\tnew Float32Array( 2 ), new Float32Array( 2 ),\n\t\t\t\t1, this._controlInterpolantsResultBuffer );\n\n\t\t\tinterpolant.__cacheIndex = lastActiveIndex;\n\t\t\tinterpolants[ lastActiveIndex ] = interpolant;\n\n\t\t}\n\n\t\treturn interpolant;\n\n\t},\n\n\t_takeBackControlInterpolant: function ( interpolant ) {\n\n\t\tvar interpolants = this._controlInterpolants,\n\t\t\tprevIndex = interpolant.__cacheIndex,\n\n\t\t\tfirstInactiveIndex = -- this._nActiveControlInterpolants,\n\n\t\t\tlastActiveInterpolant = interpolants[ firstInactiveIndex ];\n\n\t\tinterpolant.__cacheIndex = firstInactiveIndex;\n\t\tinterpolants[ firstInactiveIndex ] = interpolant;\n\n\t\tlastActiveInterpolant.__cacheIndex = prevIndex;\n\t\tinterpolants[ prevIndex ] = lastActiveInterpolant;\n\n\t},\n\n\t_controlInterpolantsResultBuffer: new Float32Array( 1 ),\n\n\t// return an action for a clip optionally using a custom root target\n\t// object (this method allocates a lot of dynamic memory in case a\n\t// previously unknown clip/root combination is specified)\n\tclipAction: function ( clip, optionalRoot ) {\n\n\t\tvar root = optionalRoot || this._root,\n\t\t\trootUuid = root.uuid,\n\n\t\t\tclipObject = typeof clip === 'string' ?\n\t\t\t\tAnimationClip.findByName( root, clip ) : clip,\n\n\t\t\tclipUuid = clipObject !== null ? clipObject.uuid : clip,\n\n\t\t\tactionsForClip = this._actionsByClip[ clipUuid ],\n\t\t\tprototypeAction = null;\n\n\t\tif ( actionsForClip !== undefined ) {\n\n\t\t\tvar existingAction =\n\t\t\t\t\tactionsForClip.actionByRoot[ rootUuid ];\n\n\t\t\tif ( existingAction !== undefined ) {\n\n\t\t\t\treturn existingAction;\n\n\t\t\t}\n\n\t\t\t// we know the clip, so we don't have to parse all\n\t\t\t// the bindings again but can just copy\n\t\t\tprototypeAction = actionsForClip.knownActions[ 0 ];\n\n\t\t\t// also, take the clip from the prototype action\n\t\t\tif ( clipObject === null )\n\t\t\t\tclipObject = prototypeAction._clip;\n\n\t\t}\n\n\t\t// clip must be known when specified via string\n\t\tif ( clipObject === null ) return null;\n\n\t\t// allocate all resources required to run it\n\t\tvar newAction = new AnimationAction( this, clipObject, optionalRoot );\n\n\t\tthis._bindAction( newAction, prototypeAction );\n\n\t\t// and make the action known to the memory manager\n\t\tthis._addInactiveAction( newAction, clipUuid, rootUuid );\n\n\t\treturn newAction;\n\n\t},\n\n\t// get an existing action\n\texistingAction: function ( clip, optionalRoot ) {\n\n\t\tvar root = optionalRoot || this._root,\n\t\t\trootUuid = root.uuid,\n\n\t\t\tclipObject = typeof clip === 'string' ?\n\t\t\t\tAnimationClip.findByName( root, clip ) : clip,\n\n\t\t\tclipUuid = clipObject ? clipObject.uuid : clip,\n\n\t\t\tactionsForClip = this._actionsByClip[ clipUuid ];\n\n\t\tif ( actionsForClip !== undefined ) {\n\n\t\t\treturn actionsForClip.actionByRoot[ rootUuid ] || null;\n\n\t\t}\n\n\t\treturn null;\n\n\t},\n\n\t// deactivates all previously scheduled actions\n\tstopAllAction: function () {\n\n\t\tvar actions = this._actions,\n\t\t\tnActions = this._nActiveActions,\n\t\t\tbindings = this._bindings,\n\t\t\tnBindings = this._nActiveBindings;\n\n\t\tthis._nActiveActions = 0;\n\t\tthis._nActiveBindings = 0;\n\n\t\tfor ( var i = 0; i !== nActions; ++ i ) {\n\n\t\t\tactions[ i ].reset();\n\n\t\t}\n\n\t\tfor ( var i = 0; i !== nBindings; ++ i ) {\n\n\t\t\tbindings[ i ].useCount = 0;\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\t// advance the time and update apply the animation\n\tupdate: function ( deltaTime ) {\n\n\t\tdeltaTime *= this.timeScale;\n\n\t\tvar actions = this._actions,\n\t\t\tnActions = this._nActiveActions,\n\n\t\t\ttime = this.time += deltaTime,\n\t\t\ttimeDirection = Math.sign( deltaTime ),\n\n\t\t\taccuIndex = this._accuIndex ^= 1;\n\n\t\t// run active actions\n\n\t\tfor ( var i = 0; i !== nActions; ++ i ) {\n\n\t\t\tvar action = actions[ i ];\n\n\t\t\taction._update( time, deltaTime, timeDirection, accuIndex );\n\n\t\t}\n\n\t\t// update scene graph\n\n\t\tvar bindings = this._bindings,\n\t\t\tnBindings = this._nActiveBindings;\n\n\t\tfor ( var i = 0; i !== nBindings; ++ i ) {\n\n\t\t\tbindings[ i ].apply( accuIndex );\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\t// Allows you to seek to a specific time in an animation.\n\tsetTime: function ( timeInSeconds ) {\n\n\t\tthis.time = 0; // Zero out time attribute for AnimationMixer object;\n\t\tfor ( var i = 0; i < this._actions.length; i ++ ) {\n\n\t\t\tthis._actions[ i ].time = 0; // Zero out time attribute for all associated AnimationAction objects.\n\n\t\t}\n\n\t\treturn this.update( timeInSeconds ); // Update used to set exact time. Returns \"this\" AnimationMixer object.\n\n\t},\n\n\t// return this mixer's root target object\n\tgetRoot: function () {\n\n\t\treturn this._root;\n\n\t},\n\n\t// free all resources specific to a particular clip\n\tuncacheClip: function ( clip ) {\n\n\t\tvar actions = this._actions,\n\t\t\tclipUuid = clip.uuid,\n\t\t\tactionsByClip = this._actionsByClip,\n\t\t\tactionsForClip = actionsByClip[ clipUuid ];\n\n\t\tif ( actionsForClip !== undefined ) {\n\n\t\t\t// note: just calling _removeInactiveAction would mess up the\n\t\t\t// iteration state and also require updating the state we can\n\t\t\t// just throw away\n\n\t\t\tvar actionsToRemove = actionsForClip.knownActions;\n\n\t\t\tfor ( var i = 0, n = actionsToRemove.length; i !== n; ++ i ) {\n\n\t\t\t\tvar action = actionsToRemove[ i ];\n\n\t\t\t\tthis._deactivateAction( action );\n\n\t\t\t\tvar cacheIndex = action._cacheIndex,\n\t\t\t\t\tlastInactiveAction = actions[ actions.length - 1 ];\n\n\t\t\t\taction._cacheIndex = null;\n\t\t\t\taction._byClipCacheIndex = null;\n\n\t\t\t\tlastInactiveAction._cacheIndex = cacheIndex;\n\t\t\t\tactions[ cacheIndex ] = lastInactiveAction;\n\t\t\t\tactions.pop();\n\n\t\t\t\tthis._removeInactiveBindingsForAction( action );\n\n\t\t\t}\n\n\t\t\tdelete actionsByClip[ clipUuid ];\n\n\t\t}\n\n\t},\n\n\t// free all resources specific to a particular root target object\n\tuncacheRoot: function ( root ) {\n\n\t\tvar rootUuid = root.uuid,\n\t\t\tactionsByClip = this._actionsByClip;\n\n\t\tfor ( var clipUuid in actionsByClip ) {\n\n\t\t\tvar actionByRoot = actionsByClip[ clipUuid ].actionByRoot,\n\t\t\t\taction = actionByRoot[ rootUuid ];\n\n\t\t\tif ( action !== undefined ) {\n\n\t\t\t\tthis._deactivateAction( action );\n\t\t\t\tthis._removeInactiveAction( action );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvar bindingsByRoot = this._bindingsByRootAndName,\n\t\t\tbindingByName = bindingsByRoot[ rootUuid ];\n\n\t\tif ( bindingByName !== undefined ) {\n\n\t\t\tfor ( var trackName in bindingByName ) {\n\n\t\t\t\tvar binding = bindingByName[ trackName ];\n\t\t\t\tbinding.restoreOriginalState();\n\t\t\t\tthis._removeInactiveBinding( binding );\n\n\t\t\t}\n\n\t\t}\n\n\t},\n\n\t// remove a targeted clip from the cache\n\tuncacheAction: function ( clip, optionalRoot ) {\n\n\t\tvar action = this.existingAction( clip, optionalRoot );\n\n\t\tif ( action !== null ) {\n\n\t\t\tthis._deactivateAction( action );\n\t\t\tthis._removeInactiveAction( action );\n\n\t\t}\n\n\t}\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction Uniform( value ) {\n\n\tif ( typeof value === 'string' ) {\n\n\t\tconsole.warn( 'THREE.Uniform: Type parameter is no longer needed.' );\n\t\tvalue = arguments[ 1 ];\n\n\t}\n\n\tthis.value = value;\n\n}\n\nUniform.prototype.clone = function () {\n\n\treturn new Uniform( this.value.clone === undefined ? this.value : this.value.clone() );\n\n};\n\n/**\n * @author benaadams / https://twitter.com/ben_a_adams\n */\n\nfunction InstancedInterleavedBuffer( array, stride, meshPerAttribute ) {\n\n\tInterleavedBuffer.call( this, array, stride );\n\n\tthis.meshPerAttribute = meshPerAttribute || 1;\n\n}\n\nInstancedInterleavedBuffer.prototype = Object.assign( Object.create( InterleavedBuffer.prototype ), {\n\n\tconstructor: InstancedInterleavedBuffer,\n\n\tisInstancedInterleavedBuffer: true,\n\n\tcopy: function ( source ) {\n\n\t\tInterleavedBuffer.prototype.copy.call( this, source );\n\n\t\tthis.meshPerAttribute = source.meshPerAttribute;\n\n\t\treturn this;\n\n\t}\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n * @author bhouston / http://clara.io/\n * @author stephomi / http://stephaneginier.com/\n */\n\nfunction Raycaster( origin, direction, near, far ) {\n\n\tthis.ray = new Ray( origin, direction );\n\t// direction is assumed to be normalized (for accurate distance calculations)\n\n\tthis.near = near || 0;\n\tthis.far = far || Infinity;\n\tthis.camera = null;\n\n\tthis.params = {\n\t\tMesh: {},\n\t\tLine: {},\n\t\tLOD: {},\n\t\tPoints: { threshold: 1 },\n\t\tSprite: {}\n\t};\n\n\tObject.defineProperties( this.params, {\n\t\tPointCloud: {\n\t\t\tget: function () {\n\n\t\t\t\tconsole.warn( 'THREE.Raycaster: params.PointCloud has been renamed to params.Points.' );\n\t\t\t\treturn this.Points;\n\n\t\t\t}\n\t\t}\n\t} );\n\n}\n\nfunction ascSort( a, b ) {\n\n\treturn a.distance - b.distance;\n\n}\n\nfunction intersectObject( object, raycaster, intersects, recursive ) {\n\n\tif ( object.visible === false ) return;\n\n\tobject.raycast( raycaster, intersects );\n\n\tif ( recursive === true ) {\n\n\t\tvar children = object.children;\n\n\t\tfor ( var i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tintersectObject( children[ i ], raycaster, intersects, true );\n\n\t\t}\n\n\t}\n\n}\n\nObject.assign( Raycaster.prototype, {\n\n\tlinePrecision: 1,\n\n\tset: function ( origin, direction ) {\n\n\t\t// direction is assumed to be normalized (for accurate distance calculations)\n\n\t\tthis.ray.set( origin, direction );\n\n\t},\n\n\tsetFromCamera: function ( coords, camera ) {\n\n\t\tif ( ( camera && camera.isPerspectiveCamera ) ) {\n\n\t\t\tthis.ray.origin.setFromMatrixPosition( camera.matrixWorld );\n\t\t\tthis.ray.direction.set( coords.x, coords.y, 0.5 ).unproject( camera ).sub( this.ray.origin ).normalize();\n\t\t\tthis.camera = camera;\n\n\t\t} else if ( ( camera && camera.isOrthographicCamera ) ) {\n\n\t\t\tthis.ray.origin.set( coords.x, coords.y, ( camera.near + camera.far ) / ( camera.near - camera.far ) ).unproject( camera ); // set origin in plane of camera\n\t\t\tthis.ray.direction.set( 0, 0, - 1 ).transformDirection( camera.matrixWorld );\n\t\t\tthis.camera = camera;\n\n\t\t} else {\n\n\t\t\tconsole.error( 'THREE.Raycaster: Unsupported camera type.' );\n\n\t\t}\n\n\t},\n\n\tintersectObject: function ( object, recursive, optionalTarget ) {\n\n\t\tvar intersects = optionalTarget || [];\n\n\t\tintersectObject( object, this, intersects, recursive );\n\n\t\tintersects.sort( ascSort );\n\n\t\treturn intersects;\n\n\t},\n\n\tintersectObjects: function ( objects, recursive, optionalTarget ) {\n\n\t\tvar intersects = optionalTarget || [];\n\n\t\tif ( Array.isArray( objects ) === false ) {\n\n\t\t\tconsole.warn( 'THREE.Raycaster.intersectObjects: objects is not an Array.' );\n\t\t\treturn intersects;\n\n\t\t}\n\n\t\tfor ( var i = 0, l = objects.length; i < l; i ++ ) {\n\n\t\t\tintersectObject( objects[ i ], this, intersects, recursive );\n\n\t\t}\n\n\t\tintersects.sort( ascSort );\n\n\t\treturn intersects;\n\n\t}\n\n} );\n\n/**\n * @author bhouston / http://clara.io\n * @author WestLangley / http://github.com/WestLangley\n *\n * Ref: https://en.wikipedia.org/wiki/Spherical_coordinate_system\n *\n * The polar angle (phi) is measured from the positive y-axis. The positive y-axis is up.\n * The azimuthal angle (theta) is measured from the positive z-axis.\n */\n\nfunction Spherical( radius, phi, theta ) {\n\n\tthis.radius = ( radius !== undefined ) ? radius : 1.0;\n\tthis.phi = ( phi !== undefined ) ? phi : 0; // polar angle\n\tthis.theta = ( theta !== undefined ) ? theta : 0; // azimuthal angle\n\n\treturn this;\n\n}\n\nObject.assign( Spherical.prototype, {\n\n\tset: function ( radius, phi, theta ) {\n\n\t\tthis.radius = radius;\n\t\tthis.phi = phi;\n\t\tthis.theta = theta;\n\n\t\treturn this;\n\n\t},\n\n\tclone: function () {\n\n\t\treturn new this.constructor().copy( this );\n\n\t},\n\n\tcopy: function ( other ) {\n\n\t\tthis.radius = other.radius;\n\t\tthis.phi = other.phi;\n\t\tthis.theta = other.theta;\n\n\t\treturn this;\n\n\t},\n\n\t// restrict phi to be betwee EPS and PI-EPS\n\tmakeSafe: function () {\n\n\t\tvar EPS = 0.000001;\n\t\tthis.phi = Math.max( EPS, Math.min( Math.PI - EPS, this.phi ) );\n\n\t\treturn this;\n\n\t},\n\n\tsetFromVector3: function ( v ) {\n\n\t\treturn this.setFromCartesianCoords( v.x, v.y, v.z );\n\n\t},\n\n\tsetFromCartesianCoords: function ( x, y, z ) {\n\n\t\tthis.radius = Math.sqrt( x * x + y * y + z * z );\n\n\t\tif ( this.radius === 0 ) {\n\n\t\t\tthis.theta = 0;\n\t\t\tthis.phi = 0;\n\n\t\t} else {\n\n\t\t\tthis.theta = Math.atan2( x, z );\n\t\t\tthis.phi = Math.acos( MathUtils.clamp( y / this.radius, - 1, 1 ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n} );\n\n/**\n * @author Mugen87 / https://github.com/Mugen87\n *\n * Ref: https://en.wikipedia.org/wiki/Cylindrical_coordinate_system\n *\n */\n\nfunction Cylindrical( radius, theta, y ) {\n\n\tthis.radius = ( radius !== undefined ) ? radius : 1.0; // distance from the origin to a point in the x-z plane\n\tthis.theta = ( theta !== undefined ) ? theta : 0; // counterclockwise angle in the x-z plane measured in radians from the positive z-axis\n\tthis.y = ( y !== undefined ) ? y : 0; // height above the x-z plane\n\n\treturn this;\n\n}\n\nObject.assign( Cylindrical.prototype, {\n\n\tset: function ( radius, theta, y ) {\n\n\t\tthis.radius = radius;\n\t\tthis.theta = theta;\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t},\n\n\tclone: function () {\n\n\t\treturn new this.constructor().copy( this );\n\n\t},\n\n\tcopy: function ( other ) {\n\n\t\tthis.radius = other.radius;\n\t\tthis.theta = other.theta;\n\t\tthis.y = other.y;\n\n\t\treturn this;\n\n\t},\n\n\tsetFromVector3: function ( v ) {\n\n\t\treturn this.setFromCartesianCoords( v.x, v.y, v.z );\n\n\t},\n\n\tsetFromCartesianCoords: function ( x, y, z ) {\n\n\t\tthis.radius = Math.sqrt( x * x + z * z );\n\t\tthis.theta = Math.atan2( x, z );\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n} );\n\n/**\n * @author bhouston / http://clara.io\n */\n\nvar _vector$7 = new Vector2();\n\nfunction Box2( min, max ) {\n\n\tthis.min = ( min !== undefined ) ? min : new Vector2( + Infinity, + Infinity );\n\tthis.max = ( max !== undefined ) ? max : new Vector2( - Infinity, - Infinity );\n\n}\n\nObject.assign( Box2.prototype, {\n\n\tset: function ( min, max ) {\n\n\t\tthis.min.copy( min );\n\t\tthis.max.copy( max );\n\n\t\treturn this;\n\n\t},\n\n\tsetFromPoints: function ( points ) {\n\n\t\tthis.makeEmpty();\n\n\t\tfor ( var i = 0, il = points.length; i < il; i ++ ) {\n\n\t\t\tthis.expandByPoint( points[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tsetFromCenterAndSize: function ( center, size ) {\n\n\t\tvar halfSize = _vector$7.copy( size ).multiplyScalar( 0.5 );\n\t\tthis.min.copy( center ).sub( halfSize );\n\t\tthis.max.copy( center ).add( halfSize );\n\n\t\treturn this;\n\n\t},\n\n\tclone: function () {\n\n\t\treturn new this.constructor().copy( this );\n\n\t},\n\n\tcopy: function ( box ) {\n\n\t\tthis.min.copy( box.min );\n\t\tthis.max.copy( box.max );\n\n\t\treturn this;\n\n\t},\n\n\tmakeEmpty: function () {\n\n\t\tthis.min.x = this.min.y = + Infinity;\n\t\tthis.max.x = this.max.y = - Infinity;\n\n\t\treturn this;\n\n\t},\n\n\tisEmpty: function () {\n\n\t\t// this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes\n\n\t\treturn ( this.max.x < this.min.x ) || ( this.max.y < this.min.y );\n\n\t},\n\n\tgetCenter: function ( target ) {\n\n\t\tif ( target === undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Box2: .getCenter() target is now required' );\n\t\t\ttarget = new Vector2();\n\n\t\t}\n\n\t\treturn this.isEmpty() ? target.set( 0, 0 ) : target.addVectors( this.min, this.max ).multiplyScalar( 0.5 );\n\n\t},\n\n\tgetSize: function ( target ) {\n\n\t\tif ( target === undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Box2: .getSize() target is now required' );\n\t\t\ttarget = new Vector2();\n\n\t\t}\n\n\t\treturn this.isEmpty() ? target.set( 0, 0 ) : target.subVectors( this.max, this.min );\n\n\t},\n\n\texpandByPoint: function ( point ) {\n\n\t\tthis.min.min( point );\n\t\tthis.max.max( point );\n\n\t\treturn this;\n\n\t},\n\n\texpandByVector: function ( vector ) {\n\n\t\tthis.min.sub( vector );\n\t\tthis.max.add( vector );\n\n\t\treturn this;\n\n\t},\n\n\texpandByScalar: function ( scalar ) {\n\n\t\tthis.min.addScalar( - scalar );\n\t\tthis.max.addScalar( scalar );\n\n\t\treturn this;\n\n\t},\n\n\tcontainsPoint: function ( point ) {\n\n\t\treturn point.x < this.min.x || point.x > this.max.x ||\n\t\t\tpoint.y < this.min.y || point.y > this.max.y ? false : true;\n\n\t},\n\n\tcontainsBox: function ( box ) {\n\n\t\treturn this.min.x <= box.min.x && box.max.x <= this.max.x &&\n\t\t\tthis.min.y <= box.min.y && box.max.y <= this.max.y;\n\n\t},\n\n\tgetParameter: function ( point, target ) {\n\n\t\t// This can potentially have a divide by zero if the box\n\t\t// has a size dimension of 0.\n\n\t\tif ( target === undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Box2: .getParameter() target is now required' );\n\t\t\ttarget = new Vector2();\n\n\t\t}\n\n\t\treturn target.set(\n\t\t\t( point.x - this.min.x ) / ( this.max.x - this.min.x ),\n\t\t\t( point.y - this.min.y ) / ( this.max.y - this.min.y )\n\t\t);\n\n\t},\n\n\tintersectsBox: function ( box ) {\n\n\t\t// using 4 splitting planes to rule out intersections\n\n\t\treturn box.max.x < this.min.x || box.min.x > this.max.x ||\n\t\t\tbox.max.y < this.min.y || box.min.y > this.max.y ? false : true;\n\n\t},\n\n\tclampPoint: function ( point, target ) {\n\n\t\tif ( target === undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Box2: .clampPoint() target is now required' );\n\t\t\ttarget = new Vector2();\n\n\t\t}\n\n\t\treturn target.copy( point ).clamp( this.min, this.max );\n\n\t},\n\n\tdistanceToPoint: function ( point ) {\n\n\t\tvar clampedPoint = _vector$7.copy( point ).clamp( this.min, this.max );\n\t\treturn clampedPoint.sub( point ).length();\n\n\t},\n\n\tintersect: function ( box ) {\n\n\t\tthis.min.max( box.min );\n\t\tthis.max.min( box.max );\n\n\t\treturn this;\n\n\t},\n\n\tunion: function ( box ) {\n\n\t\tthis.min.min( box.min );\n\t\tthis.max.max( box.max );\n\n\t\treturn this;\n\n\t},\n\n\ttranslate: function ( offset ) {\n\n\t\tthis.min.add( offset );\n\t\tthis.max.add( offset );\n\n\t\treturn this;\n\n\t},\n\n\tequals: function ( box ) {\n\n\t\treturn box.min.equals( this.min ) && box.max.equals( this.max );\n\n\t}\n\n} );\n\n/**\n * @author bhouston / http://clara.io\n */\n\nvar _startP = new Vector3();\nvar _startEnd = new Vector3();\n\nfunction Line3( start, end ) {\n\n\tthis.start = ( start !== undefined ) ? start : new Vector3();\n\tthis.end = ( end !== undefined ) ? end : new Vector3();\n\n}\n\nObject.assign( Line3.prototype, {\n\n\tset: function ( start, end ) {\n\n\t\tthis.start.copy( start );\n\t\tthis.end.copy( end );\n\n\t\treturn this;\n\n\t},\n\n\tclone: function () {\n\n\t\treturn new this.constructor().copy( this );\n\n\t},\n\n\tcopy: function ( line ) {\n\n\t\tthis.start.copy( line.start );\n\t\tthis.end.copy( line.end );\n\n\t\treturn this;\n\n\t},\n\n\tgetCenter: function ( target ) {\n\n\t\tif ( target === undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Line3: .getCenter() target is now required' );\n\t\t\ttarget = new Vector3();\n\n\t\t}\n\n\t\treturn target.addVectors( this.start, this.end ).multiplyScalar( 0.5 );\n\n\t},\n\n\tdelta: function ( target ) {\n\n\t\tif ( target === undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Line3: .delta() target is now required' );\n\t\t\ttarget = new Vector3();\n\n\t\t}\n\n\t\treturn target.subVectors( this.end, this.start );\n\n\t},\n\n\tdistanceSq: function () {\n\n\t\treturn this.start.distanceToSquared( this.end );\n\n\t},\n\n\tdistance: function () {\n\n\t\treturn this.start.distanceTo( this.end );\n\n\t},\n\n\tat: function ( t, target ) {\n\n\t\tif ( target === undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Line3: .at() target is now required' );\n\t\t\ttarget = new Vector3();\n\n\t\t}\n\n\t\treturn this.delta( target ).multiplyScalar( t ).add( this.start );\n\n\t},\n\n\tclosestPointToPointParameter: function ( point, clampToLine ) {\n\n\t\t_startP.subVectors( point, this.start );\n\t\t_startEnd.subVectors( this.end, this.start );\n\n\t\tvar startEnd2 = _startEnd.dot( _startEnd );\n\t\tvar startEnd_startP = _startEnd.dot( _startP );\n\n\t\tvar t = startEnd_startP / startEnd2;\n\n\t\tif ( clampToLine ) {\n\n\t\t\tt = MathUtils.clamp( t, 0, 1 );\n\n\t\t}\n\n\t\treturn t;\n\n\t},\n\n\tclosestPointToPoint: function ( point, clampToLine, target ) {\n\n\t\tvar t = this.closestPointToPointParameter( point, clampToLine );\n\n\t\tif ( target === undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Line3: .closestPointToPoint() target is now required' );\n\t\t\ttarget = new Vector3();\n\n\t\t}\n\n\t\treturn this.delta( target ).multiplyScalar( t ).add( this.start );\n\n\t},\n\n\tapplyMatrix4: function ( matrix ) {\n\n\t\tthis.start.applyMatrix4( matrix );\n\t\tthis.end.applyMatrix4( matrix );\n\n\t\treturn this;\n\n\t},\n\n\tequals: function ( line ) {\n\n\t\treturn line.start.equals( this.start ) && line.end.equals( this.end );\n\n\t}\n\n} );\n\n/**\n * @author alteredq / http://alteredqualia.com/\n */\n\nfunction ImmediateRenderObject( material ) {\n\n\tObject3D.call( this );\n\n\tthis.material = material;\n\tthis.render = function ( /* renderCallback */ ) {};\n\n}\n\nImmediateRenderObject.prototype = Object.create( Object3D.prototype );\nImmediateRenderObject.prototype.constructor = ImmediateRenderObject;\n\nImmediateRenderObject.prototype.isImmediateRenderObject = true;\n\n/**\n * @author alteredq / http://alteredqualia.com/\n * @author mrdoob / http://mrdoob.com/\n * @author WestLangley / http://github.com/WestLangley\n */\n\nvar _vector$8 = new Vector3();\n\nfunction SpotLightHelper( light, color ) {\n\n\tObject3D.call( this );\n\n\tthis.light = light;\n\tthis.light.updateMatrixWorld();\n\n\tthis.matrix = light.matrixWorld;\n\tthis.matrixAutoUpdate = false;\n\n\tthis.color = color;\n\n\tvar geometry = new BufferGeometry();\n\n\tvar positions = [\n\t\t0, 0, 0, \t0, 0, 1,\n\t\t0, 0, 0, \t1, 0, 1,\n\t\t0, 0, 0,\t- 1, 0, 1,\n\t\t0, 0, 0, \t0, 1, 1,\n\t\t0, 0, 0, \t0, - 1, 1\n\t];\n\n\tfor ( var i = 0, j = 1, l = 32; i < l; i ++, j ++ ) {\n\n\t\tvar p1 = ( i / l ) * Math.PI * 2;\n\t\tvar p2 = ( j / l ) * Math.PI * 2;\n\n\t\tpositions.push(\n\t\t\tMath.cos( p1 ), Math.sin( p1 ), 1,\n\t\t\tMath.cos( p2 ), Math.sin( p2 ), 1\n\t\t);\n\n\t}\n\n\tgeometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );\n\n\tvar material = new LineBasicMaterial( { fog: false } );\n\n\tthis.cone = new LineSegments( geometry, material );\n\tthis.add( this.cone );\n\n\tthis.update();\n\n}\n\nSpotLightHelper.prototype = Object.create( Object3D.prototype );\nSpotLightHelper.prototype.constructor = SpotLightHelper;\n\nSpotLightHelper.prototype.dispose = function () {\n\n\tthis.cone.geometry.dispose();\n\tthis.cone.material.dispose();\n\n};\n\nSpotLightHelper.prototype.update = function () {\n\n\tthis.light.updateMatrixWorld();\n\n\tvar coneLength = this.light.distance ? this.light.distance : 1000;\n\tvar coneWidth = coneLength * Math.tan( this.light.angle );\n\n\tthis.cone.scale.set( coneWidth, coneWidth, coneLength );\n\n\t_vector$8.setFromMatrixPosition( this.light.target.matrixWorld );\n\n\tthis.cone.lookAt( _vector$8 );\n\n\tif ( this.color !== undefined ) {\n\n\t\tthis.cone.material.color.set( this.color );\n\n\t} else {\n\n\t\tthis.cone.material.color.copy( this.light.color );\n\n\t}\n\n};\n\n/**\n * @author Sean Griffin / http://twitter.com/sgrif\n * @author Michael Guerrero / http://realitymeltdown.com\n * @author mrdoob / http://mrdoob.com/\n * @author ikerr / http://verold.com\n * @author Mugen87 / https://github.com/Mugen87\n */\n\nvar _vector$9 = new Vector3();\nvar _boneMatrix = new Matrix4();\nvar _matrixWorldInv = new Matrix4();\n\nfunction getBoneList( object ) {\n\n\tvar boneList = [];\n\n\tif ( object && object.isBone ) {\n\n\t\tboneList.push( object );\n\n\t}\n\n\tfor ( var i = 0; i < object.children.length; i ++ ) {\n\n\t\tboneList.push.apply( boneList, getBoneList( object.children[ i ] ) );\n\n\t}\n\n\treturn boneList;\n\n}\n\nfunction SkeletonHelper( object ) {\n\n\tvar bones = getBoneList( object );\n\n\tvar geometry = new BufferGeometry();\n\n\tvar vertices = [];\n\tvar colors = [];\n\n\tvar color1 = new Color( 0, 0, 1 );\n\tvar color2 = new Color( 0, 1, 0 );\n\n\tfor ( var i = 0; i < bones.length; i ++ ) {\n\n\t\tvar bone = bones[ i ];\n\n\t\tif ( bone.parent && bone.parent.isBone ) {\n\n\t\t\tvertices.push( 0, 0, 0 );\n\t\t\tvertices.push( 0, 0, 0 );\n\t\t\tcolors.push( color1.r, color1.g, color1.b );\n\t\t\tcolors.push( color2.r, color2.g, color2.b );\n\n\t\t}\n\n\t}\n\n\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\tvar material = new LineBasicMaterial( { vertexColors: VertexColors, depthTest: false, depthWrite: false, transparent: true } );\n\n\tLineSegments.call( this, geometry, material );\n\n\tthis.root = object;\n\tthis.bones = bones;\n\n\tthis.matrix = object.matrixWorld;\n\tthis.matrixAutoUpdate = false;\n\n}\n\nSkeletonHelper.prototype = Object.create( LineSegments.prototype );\nSkeletonHelper.prototype.constructor = SkeletonHelper;\n\nSkeletonHelper.prototype.updateMatrixWorld = function ( force ) {\n\n\tvar bones = this.bones;\n\n\tvar geometry = this.geometry;\n\tvar position = geometry.getAttribute( 'position' );\n\n\t_matrixWorldInv.getInverse( this.root.matrixWorld );\n\n\tfor ( var i = 0, j = 0; i < bones.length; i ++ ) {\n\n\t\tvar bone = bones[ i ];\n\n\t\tif ( bone.parent && bone.parent.isBone ) {\n\n\t\t\t_boneMatrix.multiplyMatrices( _matrixWorldInv, bone.matrixWorld );\n\t\t\t_vector$9.setFromMatrixPosition( _boneMatrix );\n\t\t\tposition.setXYZ( j, _vector$9.x, _vector$9.y, _vector$9.z );\n\n\t\t\t_boneMatrix.multiplyMatrices( _matrixWorldInv, bone.parent.matrixWorld );\n\t\t\t_vector$9.setFromMatrixPosition( _boneMatrix );\n\t\t\tposition.setXYZ( j + 1, _vector$9.x, _vector$9.y, _vector$9.z );\n\n\t\t\tj += 2;\n\n\t\t}\n\n\t}\n\n\tgeometry.getAttribute( 'position' ).needsUpdate = true;\n\n\tObject3D.prototype.updateMatrixWorld.call( this, force );\n\n};\n\n/**\n * @author alteredq / http://alteredqualia.com/\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction PointLightHelper( light, sphereSize, color ) {\n\n\tthis.light = light;\n\tthis.light.updateMatrixWorld();\n\n\tthis.color = color;\n\n\tvar geometry = new SphereBufferGeometry( sphereSize, 4, 2 );\n\tvar material = new MeshBasicMaterial( { wireframe: true, fog: false } );\n\n\tMesh.call( this, geometry, material );\n\n\tthis.matrix = this.light.matrixWorld;\n\tthis.matrixAutoUpdate = false;\n\n\tthis.update();\n\n\n\t/*\n\tvar distanceGeometry = new THREE.IcosahedronBufferGeometry( 1, 2 );\n\tvar distanceMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false, wireframe: true, opacity: 0.1, transparent: true } );\n\n\tthis.lightSphere = new THREE.Mesh( bulbGeometry, bulbMaterial );\n\tthis.lightDistance = new THREE.Mesh( distanceGeometry, distanceMaterial );\n\n\tvar d = light.distance;\n\n\tif ( d === 0.0 ) {\n\n\t\tthis.lightDistance.visible = false;\n\n\t} else {\n\n\t\tthis.lightDistance.scale.set( d, d, d );\n\n\t}\n\n\tthis.add( this.lightDistance );\n\t*/\n\n}\n\nPointLightHelper.prototype = Object.create( Mesh.prototype );\nPointLightHelper.prototype.constructor = PointLightHelper;\n\nPointLightHelper.prototype.dispose = function () {\n\n\tthis.geometry.dispose();\n\tthis.material.dispose();\n\n};\n\nPointLightHelper.prototype.update = function () {\n\n\tif ( this.color !== undefined ) {\n\n\t\tthis.material.color.set( this.color );\n\n\t} else {\n\n\t\tthis.material.color.copy( this.light.color );\n\n\t}\n\n\t/*\n\tvar d = this.light.distance;\n\n\tif ( d === 0.0 ) {\n\n\t\tthis.lightDistance.visible = false;\n\n\t} else {\n\n\t\tthis.lightDistance.visible = true;\n\t\tthis.lightDistance.scale.set( d, d, d );\n\n\t}\n\t*/\n\n};\n\n/**\n * @author alteredq / http://alteredqualia.com/\n * @author mrdoob / http://mrdoob.com/\n * @author Mugen87 / https://github.com/Mugen87\n */\n\nvar _vector$a = new Vector3();\nvar _color1 = new Color();\nvar _color2 = new Color();\n\nfunction HemisphereLightHelper( light, size, color ) {\n\n\tObject3D.call( this );\n\n\tthis.light = light;\n\tthis.light.updateMatrixWorld();\n\n\tthis.matrix = light.matrixWorld;\n\tthis.matrixAutoUpdate = false;\n\n\tthis.color = color;\n\n\tvar geometry = new OctahedronBufferGeometry( size );\n\tgeometry.rotateY( Math.PI * 0.5 );\n\n\tthis.material = new MeshBasicMaterial( { wireframe: true, fog: false } );\n\tif ( this.color === undefined ) this.material.vertexColors = VertexColors;\n\n\tvar position = geometry.getAttribute( 'position' );\n\tvar colors = new Float32Array( position.count * 3 );\n\n\tgeometry.setAttribute( 'color', new BufferAttribute( colors, 3 ) );\n\n\tthis.add( new Mesh( geometry, this.material ) );\n\n\tthis.update();\n\n}\n\nHemisphereLightHelper.prototype = Object.create( Object3D.prototype );\nHemisphereLightHelper.prototype.constructor = HemisphereLightHelper;\n\nHemisphereLightHelper.prototype.dispose = function () {\n\n\tthis.children[ 0 ].geometry.dispose();\n\tthis.children[ 0 ].material.dispose();\n\n};\n\nHemisphereLightHelper.prototype.update = function () {\n\n\tvar mesh = this.children[ 0 ];\n\n\tif ( this.color !== undefined ) {\n\n\t\tthis.material.color.set( this.color );\n\n\t} else {\n\n\t\tvar colors = mesh.geometry.getAttribute( 'color' );\n\n\t\t_color1.copy( this.light.color );\n\t\t_color2.copy( this.light.groundColor );\n\n\t\tfor ( var i = 0, l = colors.count; i < l; i ++ ) {\n\n\t\t\tvar color = ( i < ( l / 2 ) ) ? _color1 : _color2;\n\n\t\t\tcolors.setXYZ( i, color.r, color.g, color.b );\n\n\t\t}\n\n\t\tcolors.needsUpdate = true;\n\n\t}\n\n\tmesh.lookAt( _vector$a.setFromMatrixPosition( this.light.matrixWorld ).negate() );\n\n};\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction GridHelper( size, divisions, color1, color2 ) {\n\n\tsize = size || 10;\n\tdivisions = divisions || 10;\n\tcolor1 = new Color( color1 !== undefined ? color1 : 0x444444 );\n\tcolor2 = new Color( color2 !== undefined ? color2 : 0x888888 );\n\n\tvar center = divisions / 2;\n\tvar step = size / divisions;\n\tvar halfSize = size / 2;\n\n\tvar vertices = [], colors = [];\n\n\tfor ( var i = 0, j = 0, k = - halfSize; i <= divisions; i ++, k += step ) {\n\n\t\tvertices.push( - halfSize, 0, k, halfSize, 0, k );\n\t\tvertices.push( k, 0, - halfSize, k, 0, halfSize );\n\n\t\tvar color = i === center ? color1 : color2;\n\n\t\tcolor.toArray( colors, j ); j += 3;\n\t\tcolor.toArray( colors, j ); j += 3;\n\t\tcolor.toArray( colors, j ); j += 3;\n\t\tcolor.toArray( colors, j ); j += 3;\n\n\t}\n\n\tvar geometry = new BufferGeometry();\n\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\tvar material = new LineBasicMaterial( { vertexColors: VertexColors } );\n\n\tLineSegments.call( this, geometry, material );\n\n}\n\nGridHelper.prototype = Object.assign( Object.create( LineSegments.prototype ), {\n\n\tconstructor: GridHelper,\n\n\tcopy: function ( source ) {\n\n\t\tLineSegments.prototype.copy.call( this, source );\n\n\t\tthis.geometry.copy( source.geometry );\n\t\tthis.material.copy( source.material );\n\n\t\treturn this;\n\n\t},\n\n\tclone: function () {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n} );\n\n/**\n * @author mrdoob / http://mrdoob.com/\n * @author Mugen87 / http://github.com/Mugen87\n * @author Hectate / http://www.github.com/Hectate\n */\n\nfunction PolarGridHelper( radius, radials, circles, divisions, color1, color2 ) {\n\n\tradius = radius || 10;\n\tradials = radials || 16;\n\tcircles = circles || 8;\n\tdivisions = divisions || 64;\n\tcolor1 = new Color( color1 !== undefined ? color1 : 0x444444 );\n\tcolor2 = new Color( color2 !== undefined ? color2 : 0x888888 );\n\n\tvar vertices = [];\n\tvar colors = [];\n\n\tvar x, z;\n\tvar v, i, j, r, color;\n\n\t// create the radials\n\n\tfor ( i = 0; i <= radials; i ++ ) {\n\n\t\tv = ( i / radials ) * ( Math.PI * 2 );\n\n\t\tx = Math.sin( v ) * radius;\n\t\tz = Math.cos( v ) * radius;\n\n\t\tvertices.push( 0, 0, 0 );\n\t\tvertices.push( x, 0, z );\n\n\t\tcolor = ( i & 1 ) ? color1 : color2;\n\n\t\tcolors.push( color.r, color.g, color.b );\n\t\tcolors.push( color.r, color.g, color.b );\n\n\t}\n\n\t// create the circles\n\n\tfor ( i = 0; i <= circles; i ++ ) {\n\n\t\tcolor = ( i & 1 ) ? color1 : color2;\n\n\t\tr = radius - ( radius / circles * i );\n\n\t\tfor ( j = 0; j < divisions; j ++ ) {\n\n\t\t\t// first vertex\n\n\t\t\tv = ( j / divisions ) * ( Math.PI * 2 );\n\n\t\t\tx = Math.sin( v ) * r;\n\t\t\tz = Math.cos( v ) * r;\n\n\t\t\tvertices.push( x, 0, z );\n\t\t\tcolors.push( color.r, color.g, color.b );\n\n\t\t\t// second vertex\n\n\t\t\tv = ( ( j + 1 ) / divisions ) * ( Math.PI * 2 );\n\n\t\t\tx = Math.sin( v ) * r;\n\t\t\tz = Math.cos( v ) * r;\n\n\t\t\tvertices.push( x, 0, z );\n\t\t\tcolors.push( color.r, color.g, color.b );\n\n\t\t}\n\n\t}\n\n\tvar geometry = new BufferGeometry();\n\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\tvar material = new LineBasicMaterial( { vertexColors: VertexColors } );\n\n\tLineSegments.call( this, geometry, material );\n\n}\n\nPolarGridHelper.prototype = Object.create( LineSegments.prototype );\nPolarGridHelper.prototype.constructor = PolarGridHelper;\n\n/**\n * @author alteredq / http://alteredqualia.com/\n * @author mrdoob / http://mrdoob.com/\n * @author WestLangley / http://github.com/WestLangley\n */\n\nvar _v1$5 = new Vector3();\nvar _v2$3 = new Vector3();\nvar _v3$1 = new Vector3();\n\nfunction DirectionalLightHelper( light, size, color ) {\n\n\tObject3D.call( this );\n\n\tthis.light = light;\n\tthis.light.updateMatrixWorld();\n\n\tthis.matrix = light.matrixWorld;\n\tthis.matrixAutoUpdate = false;\n\n\tthis.color = color;\n\n\tif ( size === undefined ) size = 1;\n\n\tvar geometry = new BufferGeometry();\n\tgeometry.setAttribute( 'position', new Float32BufferAttribute( [\n\t\t- size, size, 0,\n\t\tsize, size, 0,\n\t\tsize, - size, 0,\n\t\t- size, - size, 0,\n\t\t- size, size, 0\n\t], 3 ) );\n\n\tvar material = new LineBasicMaterial( { fog: false } );\n\n\tthis.lightPlane = new Line( geometry, material );\n\tthis.add( this.lightPlane );\n\n\tgeometry = new BufferGeometry();\n\tgeometry.setAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0, 0, 0, 1 ], 3 ) );\n\n\tthis.targetLine = new Line( geometry, material );\n\tthis.add( this.targetLine );\n\n\tthis.update();\n\n}\n\nDirectionalLightHelper.prototype = Object.create( Object3D.prototype );\nDirectionalLightHelper.prototype.constructor = DirectionalLightHelper;\n\nDirectionalLightHelper.prototype.dispose = function () {\n\n\tthis.lightPlane.geometry.dispose();\n\tthis.lightPlane.material.dispose();\n\tthis.targetLine.geometry.dispose();\n\tthis.targetLine.material.dispose();\n\n};\n\nDirectionalLightHelper.prototype.update = function () {\n\n\t_v1$5.setFromMatrixPosition( this.light.matrixWorld );\n\t_v2$3.setFromMatrixPosition( this.light.target.matrixWorld );\n\t_v3$1.subVectors( _v2$3, _v1$5 );\n\n\tthis.lightPlane.lookAt( _v2$3 );\n\n\tif ( this.color !== undefined ) {\n\n\t\tthis.lightPlane.material.color.set( this.color );\n\t\tthis.targetLine.material.color.set( this.color );\n\n\t} else {\n\n\t\tthis.lightPlane.material.color.copy( this.light.color );\n\t\tthis.targetLine.material.color.copy( this.light.color );\n\n\t}\n\n\tthis.targetLine.lookAt( _v2$3 );\n\tthis.targetLine.scale.z = _v3$1.length();\n\n};\n\n/**\n * @author alteredq / http://alteredqualia.com/\n * @author Mugen87 / https://github.com/Mugen87\n *\n *\t- shows frustum, line of sight and up of the camera\n *\t- suitable for fast updates\n * \t- based on frustum visualization in lightgl.js shadowmap example\n *\t\thttp://evanw.github.com/lightgl.js/tests/shadowmap.html\n */\n\nvar _vector$b = new Vector3();\nvar _camera = new Camera();\n\nfunction CameraHelper( camera ) {\n\n\tvar geometry = new BufferGeometry();\n\tvar material = new LineBasicMaterial( { color: 0xffffff, vertexColors: FaceColors } );\n\n\tvar vertices = [];\n\tvar colors = [];\n\n\tvar pointMap = {};\n\n\t// colors\n\n\tvar colorFrustum = new Color( 0xffaa00 );\n\tvar colorCone = new Color( 0xff0000 );\n\tvar colorUp = new Color( 0x00aaff );\n\tvar colorTarget = new Color( 0xffffff );\n\tvar colorCross = new Color( 0x333333 );\n\n\t// near\n\n\taddLine( 'n1', 'n2', colorFrustum );\n\taddLine( 'n2', 'n4', colorFrustum );\n\taddLine( 'n4', 'n3', colorFrustum );\n\taddLine( 'n3', 'n1', colorFrustum );\n\n\t// far\n\n\taddLine( 'f1', 'f2', colorFrustum );\n\taddLine( 'f2', 'f4', colorFrustum );\n\taddLine( 'f4', 'f3', colorFrustum );\n\taddLine( 'f3', 'f1', colorFrustum );\n\n\t// sides\n\n\taddLine( 'n1', 'f1', colorFrustum );\n\taddLine( 'n2', 'f2', colorFrustum );\n\taddLine( 'n3', 'f3', colorFrustum );\n\taddLine( 'n4', 'f4', colorFrustum );\n\n\t// cone\n\n\taddLine( 'p', 'n1', colorCone );\n\taddLine( 'p', 'n2', colorCone );\n\taddLine( 'p', 'n3', colorCone );\n\taddLine( 'p', 'n4', colorCone );\n\n\t// up\n\n\taddLine( 'u1', 'u2', colorUp );\n\taddLine( 'u2', 'u3', colorUp );\n\taddLine( 'u3', 'u1', colorUp );\n\n\t// target\n\n\taddLine( 'c', 't', colorTarget );\n\taddLine( 'p', 'c', colorCross );\n\n\t// cross\n\n\taddLine( 'cn1', 'cn2', colorCross );\n\taddLine( 'cn3', 'cn4', colorCross );\n\n\taddLine( 'cf1', 'cf2', colorCross );\n\taddLine( 'cf3', 'cf4', colorCross );\n\n\tfunction addLine( a, b, color ) {\n\n\t\taddPoint( a, color );\n\t\taddPoint( b, color );\n\n\t}\n\n\tfunction addPoint( id, color ) {\n\n\t\tvertices.push( 0, 0, 0 );\n\t\tcolors.push( color.r, color.g, color.b );\n\n\t\tif ( pointMap[ id ] === undefined ) {\n\n\t\t\tpointMap[ id ] = [];\n\n\t\t}\n\n\t\tpointMap[ id ].push( ( vertices.length / 3 ) - 1 );\n\n\t}\n\n\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\tLineSegments.call( this, geometry, material );\n\n\tthis.camera = camera;\n\tif ( this.camera.updateProjectionMatrix ) this.camera.updateProjectionMatrix();\n\n\tthis.matrix = camera.matrixWorld;\n\tthis.matrixAutoUpdate = false;\n\n\tthis.pointMap = pointMap;\n\n\tthis.update();\n\n}\n\nCameraHelper.prototype = Object.create( LineSegments.prototype );\nCameraHelper.prototype.constructor = CameraHelper;\n\nCameraHelper.prototype.update = function () {\n\n\tvar geometry = this.geometry;\n\tvar pointMap = this.pointMap;\n\n\tvar w = 1, h = 1;\n\n\t// we need just camera projection matrix inverse\n\t// world matrix must be identity\n\n\t_camera.projectionMatrixInverse.copy( this.camera.projectionMatrixInverse );\n\n\t// center / target\n\n\tsetPoint( 'c', pointMap, geometry, _camera, 0, 0, - 1 );\n\tsetPoint( 't', pointMap, geometry, _camera, 0, 0, 1 );\n\n\t// near\n\n\tsetPoint( 'n1', pointMap, geometry, _camera, - w, - h, - 1 );\n\tsetPoint( 'n2', pointMap, geometry, _camera, w, - h, - 1 );\n\tsetPoint( 'n3', pointMap, geometry, _camera, - w, h, - 1 );\n\tsetPoint( 'n4', pointMap, geometry, _camera, w, h, - 1 );\n\n\t// far\n\n\tsetPoint( 'f1', pointMap, geometry, _camera, - w, - h, 1 );\n\tsetPoint( 'f2', pointMap, geometry, _camera, w, - h, 1 );\n\tsetPoint( 'f3', pointMap, geometry, _camera, - w, h, 1 );\n\tsetPoint( 'f4', pointMap, geometry, _camera, w, h, 1 );\n\n\t// up\n\n\tsetPoint( 'u1', pointMap, geometry, _camera, w * 0.7, h * 1.1, - 1 );\n\tsetPoint( 'u2', pointMap, geometry, _camera, - w * 0.7, h * 1.1, - 1 );\n\tsetPoint( 'u3', pointMap, geometry, _camera, 0, h * 2, - 1 );\n\n\t// cross\n\n\tsetPoint( 'cf1', pointMap, geometry, _camera, - w, 0, 1 );\n\tsetPoint( 'cf2', pointMap, geometry, _camera, w, 0, 1 );\n\tsetPoint( 'cf3', pointMap, geometry, _camera, 0, - h, 1 );\n\tsetPoint( 'cf4', pointMap, geometry, _camera, 0, h, 1 );\n\n\tsetPoint( 'cn1', pointMap, geometry, _camera, - w, 0, - 1 );\n\tsetPoint( 'cn2', pointMap, geometry, _camera, w, 0, - 1 );\n\tsetPoint( 'cn3', pointMap, geometry, _camera, 0, - h, - 1 );\n\tsetPoint( 'cn4', pointMap, geometry, _camera, 0, h, - 1 );\n\n\tgeometry.getAttribute( 'position' ).needsUpdate = true;\n\n};\n\nfunction setPoint( point, pointMap, geometry, camera, x, y, z ) {\n\n\t_vector$b.set( x, y, z ).unproject( camera );\n\n\tvar points = pointMap[ point ];\n\n\tif ( points !== undefined ) {\n\n\t\tvar position = geometry.getAttribute( 'position' );\n\n\t\tfor ( var i = 0, l = points.length; i < l; i ++ ) {\n\n\t\t\tposition.setXYZ( points[ i ], _vector$b.x, _vector$b.y, _vector$b.z );\n\n\t\t}\n\n\t}\n\n}\n\n/**\n * @author mrdoob / http://mrdoob.com/\n * @author Mugen87 / http://github.com/Mugen87\n */\n\nvar _box$3 = new Box3();\n\nfunction BoxHelper( object, color ) {\n\n\tthis.object = object;\n\n\tif ( color === undefined ) color = 0xffff00;\n\n\tvar indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] );\n\tvar positions = new Float32Array( 8 * 3 );\n\n\tvar geometry = new BufferGeometry();\n\tgeometry.setIndex( new BufferAttribute( indices, 1 ) );\n\tgeometry.setAttribute( 'position', new BufferAttribute( positions, 3 ) );\n\n\tLineSegments.call( this, geometry, new LineBasicMaterial( { color: color } ) );\n\n\tthis.matrixAutoUpdate = false;\n\n\tthis.update();\n\n}\n\nBoxHelper.prototype = Object.create( LineSegments.prototype );\nBoxHelper.prototype.constructor = BoxHelper;\n\nBoxHelper.prototype.update = function ( object ) {\n\n\tif ( object !== undefined ) {\n\n\t\tconsole.warn( 'THREE.BoxHelper: .update() has no longer arguments.' );\n\n\t}\n\n\tif ( this.object !== undefined ) {\n\n\t\t_box$3.setFromObject( this.object );\n\n\t}\n\n\tif ( _box$3.isEmpty() ) return;\n\n\tvar min = _box$3.min;\n\tvar max = _box$3.max;\n\n\t/*\n\t 5____4\n\t1/___0/|\n\t| 6__|_7\n\t2/___3/\n\n\t0: max.x, max.y, max.z\n\t1: min.x, max.y, max.z\n\t2: min.x, min.y, max.z\n\t3: max.x, min.y, max.z\n\t4: max.x, max.y, min.z\n\t5: min.x, max.y, min.z\n\t6: min.x, min.y, min.z\n\t7: max.x, min.y, min.z\n\t*/\n\n\tvar position = this.geometry.attributes.position;\n\tvar array = position.array;\n\n\tarray[ 0 ] = max.x; array[ 1 ] = max.y; array[ 2 ] = max.z;\n\tarray[ 3 ] = min.x; array[ 4 ] = max.y; array[ 5 ] = max.z;\n\tarray[ 6 ] = min.x; array[ 7 ] = min.y; array[ 8 ] = max.z;\n\tarray[ 9 ] = max.x; array[ 10 ] = min.y; array[ 11 ] = max.z;\n\tarray[ 12 ] = max.x; array[ 13 ] = max.y; array[ 14 ] = min.z;\n\tarray[ 15 ] = min.x; array[ 16 ] = max.y; array[ 17 ] = min.z;\n\tarray[ 18 ] = min.x; array[ 19 ] = min.y; array[ 20 ] = min.z;\n\tarray[ 21 ] = max.x; array[ 22 ] = min.y; array[ 23 ] = min.z;\n\n\tposition.needsUpdate = true;\n\n\tthis.geometry.computeBoundingSphere();\n\n\n};\n\nBoxHelper.prototype.setFromObject = function ( object ) {\n\n\tthis.object = object;\n\tthis.update();\n\n\treturn this;\n\n};\n\nBoxHelper.prototype.copy = function ( source ) {\n\n\tLineSegments.prototype.copy.call( this, source );\n\n\tthis.object = source.object;\n\n\treturn this;\n\n};\n\nBoxHelper.prototype.clone = function () {\n\n\treturn new this.constructor().copy( this );\n\n};\n\n/**\n * @author WestLangley / http://github.com/WestLangley\n */\n\nfunction Box3Helper( box, color ) {\n\n\tthis.type = 'Box3Helper';\n\n\tthis.box = box;\n\n\tcolor = color || 0xffff00;\n\n\tvar indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] );\n\n\tvar positions = [ 1, 1, 1, - 1, 1, 1, - 1, - 1, 1, 1, - 1, 1, 1, 1, - 1, - 1, 1, - 1, - 1, - 1, - 1, 1, - 1, - 1 ];\n\n\tvar geometry = new BufferGeometry();\n\n\tgeometry.setIndex( new BufferAttribute( indices, 1 ) );\n\n\tgeometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );\n\n\tLineSegments.call( this, geometry, new LineBasicMaterial( { color: color } ) );\n\n\tthis.geometry.computeBoundingSphere();\n\n}\n\nBox3Helper.prototype = Object.create( LineSegments.prototype );\nBox3Helper.prototype.constructor = Box3Helper;\n\nBox3Helper.prototype.updateMatrixWorld = function ( force ) {\n\n\tvar box = this.box;\n\n\tif ( box.isEmpty() ) return;\n\n\tbox.getCenter( this.position );\n\n\tbox.getSize( this.scale );\n\n\tthis.scale.multiplyScalar( 0.5 );\n\n\tObject3D.prototype.updateMatrixWorld.call( this, force );\n\n};\n\n/**\n * @author WestLangley / http://github.com/WestLangley\n */\n\nfunction PlaneHelper( plane, size, hex ) {\n\n\tthis.type = 'PlaneHelper';\n\n\tthis.plane = plane;\n\n\tthis.size = ( size === undefined ) ? 1 : size;\n\n\tvar color = ( hex !== undefined ) ? hex : 0xffff00;\n\n\tvar positions = [ 1, - 1, 1, - 1, 1, 1, - 1, - 1, 1, 1, 1, 1, - 1, 1, 1, - 1, - 1, 1, 1, - 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0 ];\n\n\tvar geometry = new BufferGeometry();\n\tgeometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );\n\tgeometry.computeBoundingSphere();\n\n\tLine.call( this, geometry, new LineBasicMaterial( { color: color } ) );\n\n\t//\n\n\tvar positions2 = [ 1, 1, 1, - 1, 1, 1, - 1, - 1, 1, 1, 1, 1, - 1, - 1, 1, 1, - 1, 1 ];\n\n\tvar geometry2 = new BufferGeometry();\n\tgeometry2.setAttribute( 'position', new Float32BufferAttribute( positions2, 3 ) );\n\tgeometry2.computeBoundingSphere();\n\n\tthis.add( new Mesh( geometry2, new MeshBasicMaterial( { color: color, opacity: 0.2, transparent: true, depthWrite: false } ) ) );\n\n}\n\nPlaneHelper.prototype = Object.create( Line.prototype );\nPlaneHelper.prototype.constructor = PlaneHelper;\n\nPlaneHelper.prototype.updateMatrixWorld = function ( force ) {\n\n\tvar scale = - this.plane.constant;\n\n\tif ( Math.abs( scale ) < 1e-8 ) scale = 1e-8; // sign does not matter\n\n\tthis.scale.set( 0.5 * this.size, 0.5 * this.size, scale );\n\n\tthis.children[ 0 ].material.side = ( scale < 0 ) ? BackSide : FrontSide; // renderer flips side when determinant < 0; flipping not wanted here\n\n\tthis.lookAt( this.plane.normal );\n\n\tObject3D.prototype.updateMatrixWorld.call( this, force );\n\n};\n\n/**\n * @author WestLangley / http://github.com/WestLangley\n * @author zz85 / http://github.com/zz85\n * @author bhouston / http://clara.io\n *\n * Creates an arrow for visualizing directions\n *\n * Parameters:\n * dir - Vector3\n * origin - Vector3\n * length - Number\n * color - color in hex value\n * headLength - Number\n * headWidth - Number\n */\n\nvar _axis = new Vector3();\nvar _lineGeometry, _coneGeometry;\n\nfunction ArrowHelper( dir, origin, length, color, headLength, headWidth ) {\n\n\t// dir is assumed to be normalized\n\n\tObject3D.call( this );\n\n\tif ( dir === undefined ) dir = new Vector3( 0, 0, 1 );\n\tif ( origin === undefined ) origin = new Vector3( 0, 0, 0 );\n\tif ( length === undefined ) length = 1;\n\tif ( color === undefined ) color = 0xffff00;\n\tif ( headLength === undefined ) headLength = 0.2 * length;\n\tif ( headWidth === undefined ) headWidth = 0.2 * headLength;\n\n\tif ( _lineGeometry === undefined ) {\n\n\t\t_lineGeometry = new BufferGeometry();\n\t\t_lineGeometry.setAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0, 0, 1, 0 ], 3 ) );\n\n\t\t_coneGeometry = new CylinderBufferGeometry( 0, 0.5, 1, 5, 1 );\n\t\t_coneGeometry.translate( 0, - 0.5, 0 );\n\n\t}\n\n\tthis.position.copy( origin );\n\n\tthis.line = new Line( _lineGeometry, new LineBasicMaterial( { color: color } ) );\n\tthis.line.matrixAutoUpdate = false;\n\tthis.add( this.line );\n\n\tthis.cone = new Mesh( _coneGeometry, new MeshBasicMaterial( { color: color } ) );\n\tthis.cone.matrixAutoUpdate = false;\n\tthis.add( this.cone );\n\n\tthis.setDirection( dir );\n\tthis.setLength( length, headLength, headWidth );\n\n}\n\nArrowHelper.prototype = Object.create( Object3D.prototype );\nArrowHelper.prototype.constructor = ArrowHelper;\n\nArrowHelper.prototype.setDirection = function ( dir ) {\n\n\t// dir is assumed to be normalized\n\n\tif ( dir.y > 0.99999 ) {\n\n\t\tthis.quaternion.set( 0, 0, 0, 1 );\n\n\t} else if ( dir.y < - 0.99999 ) {\n\n\t\tthis.quaternion.set( 1, 0, 0, 0 );\n\n\t} else {\n\n\t\t_axis.set( dir.z, 0, - dir.x ).normalize();\n\n\t\tvar radians = Math.acos( dir.y );\n\n\t\tthis.quaternion.setFromAxisAngle( _axis, radians );\n\n\t}\n\n};\n\nArrowHelper.prototype.setLength = function ( length, headLength, headWidth ) {\n\n\tif ( headLength === undefined ) headLength = 0.2 * length;\n\tif ( headWidth === undefined ) headWidth = 0.2 * headLength;\n\n\tthis.line.scale.set( 1, Math.max( 0.0001, length - headLength ), 1 ); // see #17458\n\tthis.line.updateMatrix();\n\n\tthis.cone.scale.set( headWidth, headLength, headWidth );\n\tthis.cone.position.y = length;\n\tthis.cone.updateMatrix();\n\n};\n\nArrowHelper.prototype.setColor = function ( color ) {\n\n\tthis.line.material.color.set( color );\n\tthis.cone.material.color.set( color );\n\n};\n\nArrowHelper.prototype.copy = function ( source ) {\n\n\tObject3D.prototype.copy.call( this, source, false );\n\n\tthis.line.copy( source.line );\n\tthis.cone.copy( source.cone );\n\n\treturn this;\n\n};\n\nArrowHelper.prototype.clone = function () {\n\n\treturn new this.constructor().copy( this );\n\n};\n\n/**\n * @author sroucheray / http://sroucheray.org/\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction AxesHelper( size ) {\n\n\tsize = size || 1;\n\n\tvar vertices = [\n\t\t0, 0, 0,\tsize, 0, 0,\n\t\t0, 0, 0,\t0, size, 0,\n\t\t0, 0, 0,\t0, 0, size\n\t];\n\n\tvar colors = [\n\t\t1, 0, 0,\t1, 0.6, 0,\n\t\t0, 1, 0,\t0.6, 1, 0,\n\t\t0, 0, 1,\t0, 0.6, 1\n\t];\n\n\tvar geometry = new BufferGeometry();\n\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\tvar material = new LineBasicMaterial( { vertexColors: VertexColors } );\n\n\tLineSegments.call( this, geometry, material );\n\n}\n\nAxesHelper.prototype = Object.create( LineSegments.prototype );\nAxesHelper.prototype.constructor = AxesHelper;\n\n/**\n * @author Emmett Lalish / elalish\n *\n * This class generates a Prefiltered, Mipmapped Radiance Environment Map\n * (PMREM) from a cubeMap environment texture. This allows different levels of\n * blur to be quickly accessed based on material roughness. It is packed into a\n * special CubeUV format that allows us to perform custom interpolation so that\n * we can support nonlinear formats such as RGBE. Unlike a traditional mipmap\n * chain, it only goes down to the LOD_MIN level (above), and then creates extra\n * even more filtered 'mips' at the same LOD_MIN resolution, associated with\n * higher roughness levels. In this way we maintain resolution to smoothly\n * interpolate diffuse lighting while limiting sampling computation.\n */\n\nvar LOD_MIN = 4;\nvar LOD_MAX = 8;\nvar SIZE_MAX = Math.pow( 2, LOD_MAX );\n// The standard deviations (radians) associated with the extra mips. These are\n// chosen to approximate a Trowbridge-Reitz distribution function times the\n// geometric shadowing function. These sigma values squared must match the\n// variance #defines in cube_uv_reflection_fragment.glsl.js.\nvar EXTRA_LOD_SIGMA = [ 0.125, 0.215, 0.35, 0.446, 0.526, 0.582 ];\nvar TOTAL_LODS = LOD_MAX - LOD_MIN + 1 + EXTRA_LOD_SIGMA.length;\n// The maximum length of the blur for loop. Smaller sigmas will use fewer\n// samples and exit early, but not recompile the shader.\nvar MAX_SAMPLES = 20;\nvar ENCODINGS = {\n\t[ LinearEncoding ]: 0,\n\t[ sRGBEncoding ]: 1,\n\t[ RGBEEncoding ]: 2,\n\t[ RGBM7Encoding ]: 3,\n\t[ RGBM16Encoding ]: 4,\n\t[ RGBDEncoding ]: 5,\n\t[ GammaEncoding ]: 6\n};\n\nvar _flatCamera = new OrthographicCamera();\nvar _blurMaterial = _getBlurShader( MAX_SAMPLES );\nvar _equirectShader = null;\nvar _cubemapShader = null;\n\nvar { _lodPlanes, _sizeLods, _sigmas } = _createPlanes();\nvar _pingPongRenderTarget = null;\nvar _renderer = null;\n\nvar _oldTarget = null;\n\n// Golden Ratio\nvar PHI = ( 1 + Math.sqrt( 5 ) ) / 2;\nvar INV_PHI = 1 / PHI;\n// Vertices of a dodecahedron (except the opposites, which represent the\n// same axis), used as axis directions evenly spread on a sphere.\nvar _axisDirections = [\n\tnew Vector3( 1, 1, 1 ),\n\tnew Vector3( - 1, 1, 1 ),\n\tnew Vector3( 1, 1, - 1 ),\n\tnew Vector3( - 1, 1, - 1 ),\n\tnew Vector3( 0, PHI, INV_PHI ),\n\tnew Vector3( 0, PHI, - INV_PHI ),\n\tnew Vector3( INV_PHI, 0, PHI ),\n\tnew Vector3( - INV_PHI, 0, PHI ),\n\tnew Vector3( PHI, INV_PHI, 0 ),\n\tnew Vector3( - PHI, INV_PHI, 0 ) ];\n\nfunction PMREMGenerator( renderer ) {\n\n\t_renderer = renderer;\n\t_compileMaterial( _blurMaterial );\n\n}\n\nPMREMGenerator.prototype = {\n\n\tconstructor: PMREMGenerator,\n\n\t/**\n\t * Generates a PMREM from a supplied Scene, which can be faster than using an\n\t * image if networking bandwidth is low. Optional sigma specifies a blur radius\n\t * in radians to be applied to the scene before PMREM generation. Optional near\n\t * and far planes ensure the scene is rendered in its entirety (the cubeCamera\n\t * is placed at the origin).\n\t */\n\tfromScene: function ( scene, sigma = 0, near = 0.1, far = 100 ) {\n\n\t\t_oldTarget = _renderer.getRenderTarget();\n\t\tvar cubeUVRenderTarget = _allocateTargets();\n\t\t_sceneToCubeUV( scene, near, far, cubeUVRenderTarget );\n\t\tif ( sigma > 0 ) {\n\n\t\t\t_blur( cubeUVRenderTarget, 0, 0, sigma );\n\n\t\t}\n\t\t_applyPMREM( cubeUVRenderTarget );\n\t\t_cleanup( cubeUVRenderTarget );\n\n\t\treturn cubeUVRenderTarget;\n\n\t},\n\n\t/**\n\t * Generates a PMREM from an equirectangular texture, which can be either LDR\n\t * (RGBFormat) or HDR (RGBEFormat). The ideal input image size is 1k (1024 x 512),\n\t * as this matches best with the 256 x 256 cubemap output.\n\t */\n\tfromEquirectangular: function ( equirectangular ) {\n\n\t\tequirectangular.magFilter = NearestFilter;\n\t\tequirectangular.minFilter = NearestFilter;\n\t\tequirectangular.generateMipmaps = false;\n\n\t\treturn this.fromCubemap( equirectangular );\n\n\t},\n\n\t/**\n\t * Generates a PMREM from an cubemap texture, which can be either LDR\n\t * (RGBFormat) or HDR (RGBEFormat). The ideal input cube size is 256 x 256,\n\t * as this matches best with the 256 x 256 cubemap output.\n\t */\n\tfromCubemap: function ( cubemap ) {\n\n\t\t_oldTarget = _renderer.getRenderTarget();\n\t\tvar cubeUVRenderTarget = _allocateTargets( cubemap );\n\t\t_textureToCubeUV( cubemap, cubeUVRenderTarget );\n\t\t_applyPMREM( cubeUVRenderTarget );\n\t\t_cleanup( cubeUVRenderTarget );\n\n\t\treturn cubeUVRenderTarget;\n\n\t},\n\n\t/**\n\t * Pre-compiles the cubemap shader. You can get faster start-up by invoking this method during\n\t * your texture's network fetch for increased concurrency.\n\t */\n\tcompileCubemapShader: function () {\n\n\t\tif ( _cubemapShader == null ) {\n\n\t\t\t_cubemapShader = _getCubemapShader();\n\t\t\t_compileMaterial( _cubemapShader );\n\n\t\t}\n\n\t},\n\n\t/**\n\t * Pre-compiles the equirectangular shader. You can get faster start-up by invoking this method during\n\t * your texture's network fetch for increased concurrency.\n\t */\n\tcompileEquirectangularShader: function () {\n\n\t\tif ( _equirectShader == null ) {\n\n\t\t\t_equirectShader = _getEquirectShader();\n\t\t\t_compileMaterial( _equirectShader );\n\n\t\t}\n\n\t},\n\n\t/**\n\t * Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class,\n\t * so you should not need more than one PMREMGenerator object. If you do, calling dispose() on\n\t * one of them will cause any others to also become unusable.\n\t */\n\tdispose: function () {\n\n\t\t_blurMaterial.dispose();\n\n\t\tif ( _cubemapShader != null ) _cubemapShader.dispose();\n\t\tif ( _equirectShader != null ) _equirectShader.dispose();\n\n\t\tfor ( var i = 0; i < _lodPlanes.length; i ++ ) {\n\n\t\t\t_lodPlanes[ i ].dispose();\n\n\t\t}\n\n\t},\n\n};\n\nfunction _createPlanes() {\n\n\tvar _lodPlanes = [];\n\tvar _sizeLods = [];\n\tvar _sigmas = [];\n\n\tvar lod = LOD_MAX;\n\tfor ( var i = 0; i < TOTAL_LODS; i ++ ) {\n\n\t\tvar sizeLod = Math.pow( 2, lod );\n\t\t_sizeLods.push( sizeLod );\n\t\tvar sigma = 1.0 / sizeLod;\n\t\tif ( i > LOD_MAX - LOD_MIN ) {\n\n\t\t\tsigma = EXTRA_LOD_SIGMA[ i - LOD_MAX + LOD_MIN - 1 ];\n\n\t\t} else if ( i == 0 ) {\n\n\t\t\tsigma = 0;\n\n\t\t}\n\t\t_sigmas.push( sigma );\n\n\t\tvar texelSize = 1.0 / ( sizeLod - 1 );\n\t\tvar min = - texelSize / 2;\n\t\tvar max = 1 + texelSize / 2;\n\t\tvar uv1 = [ min, min, max, min, max, max, min, min, max, max, min, max ];\n\n\t\tvar cubeFaces = 6;\n\t\tvar vertices = 6;\n\t\tvar positionSize = 3;\n\t\tvar uvSize = 2;\n\t\tvar faceIndexSize = 1;\n\n\t\tvar position = new Float32Array( positionSize * vertices * cubeFaces );\n\t\tvar uv = new Float32Array( uvSize * vertices * cubeFaces );\n\t\tvar faceIndex = new Float32Array( faceIndexSize * vertices * cubeFaces );\n\n\t\tfor ( var face = 0; face < cubeFaces; face ++ ) {\n\n\t\t\tvar x = ( face % 3 ) * 2 / 3 - 1;\n\t\t\tvar y = face > 2 ? 0 : - 1;\n\t\t\tvar coordinates = [\n\t\t\t\tx, y, 0,\n\t\t\t\tx + 2 / 3, y, 0,\n\t\t\t\tx + 2 / 3, y + 1, 0,\n\t\t\t\tx, y, 0,\n\t\t\t\tx + 2 / 3, y + 1, 0,\n\t\t\t\tx, y + 1, 0\n\t\t\t];\n\t\t\tposition.set( coordinates, positionSize * vertices * face );\n\t\t\tuv.set( uv1, uvSize * vertices * face );\n\t\t\tvar fill = [ face, face, face, face, face, face ];\n\t\t\tfaceIndex.set( fill, faceIndexSize * vertices * face );\n\n\t\t}\n\t\tvar planes = new BufferGeometry();\n\t\tplanes.setAttribute( 'position', new BufferAttribute( position, positionSize ) );\n\t\tplanes.setAttribute( 'uv', new BufferAttribute( uv, uvSize ) );\n\t\tplanes.setAttribute( 'faceIndex', new BufferAttribute( faceIndex, faceIndexSize ) );\n\t\t_lodPlanes.push( planes );\n\n\t\tif ( lod > LOD_MIN ) {\n\n\t\t\tlod --;\n\n\t\t}\n\n\t}\n\treturn { _lodPlanes, _sizeLods, _sigmas };\n\n}\n\nfunction _allocateTargets( equirectangular ) {\n\n\tvar params = {\n\t\tmagFilter: NearestFilter,\n\t\tminFilter: NearestFilter,\n\t\tgenerateMipmaps: false,\n\t\ttype: equirectangular ? equirectangular.type : UnsignedByteType,\n\t\tformat: equirectangular ? equirectangular.format : RGBEFormat,\n\t\tencoding: equirectangular ? equirectangular.encoding : RGBEEncoding,\n\t\tdepthBuffer: false,\n\t\tstencilBuffer: false\n\t};\n\tvar cubeUVRenderTarget = _createRenderTarget( params );\n\tcubeUVRenderTarget.depthBuffer = equirectangular ? false : true;\n\t_pingPongRenderTarget = _createRenderTarget( params );\n\treturn cubeUVRenderTarget;\n\n}\n\nfunction _cleanup( outputTarget ) {\n\n\t_pingPongRenderTarget.dispose();\n\t_renderer.setRenderTarget( _oldTarget );\n\toutputTarget.scissorTest = false;\n\t// reset viewport and scissor\n\toutputTarget.setSize( outputTarget.width, outputTarget.height );\n\n}\n\nfunction _sceneToCubeUV( scene, near, far, cubeUVRenderTarget ) {\n\n\tvar fov = 90;\n\tvar aspect = 1;\n\tvar cubeCamera = new PerspectiveCamera( fov, aspect, near, far );\n\tvar upSign = [ 1, 1, 1, 1, - 1, 1 ];\n\tvar forwardSign = [ 1, 1, - 1, - 1, - 1, 1 ];\n\n\tvar outputEncoding = _renderer.outputEncoding;\n\tvar toneMapping = _renderer.toneMapping;\n\tvar toneMappingExposure = _renderer.toneMappingExposure;\n\tvar clearColor = _renderer.getClearColor();\n\tvar clearAlpha = _renderer.getClearAlpha();\n\n\t_renderer.toneMapping = LinearToneMapping;\n\t_renderer.toneMappingExposure = 1.0;\n\t_renderer.outputEncoding = LinearEncoding;\n\tscene.scale.z *= - 1;\n\n\tvar background = scene.background;\n\tif ( background && background.isColor ) {\n\n\t\tbackground.convertSRGBToLinear();\n\t\t// Convert linear to RGBE\n\t\tvar maxComponent = Math.max( background.r, background.g, background.b );\n\t\tvar fExp = Math.min( Math.max( Math.ceil( Math.log2( maxComponent ) ), - 128.0 ), 127.0 );\n\t\tbackground = background.multiplyScalar( Math.pow( 2.0, - fExp ) );\n\t\tvar alpha = ( fExp + 128.0 ) / 255.0;\n\t\t_renderer.setClearColor( background, alpha );\n\t\tscene.background = null;\n\n\t}\n\n\tfor ( var i = 0; i < 6; i ++ ) {\n\n\t\tvar col = i % 3;\n\t\tif ( col == 0 ) {\n\n\t\t\tcubeCamera.up.set( 0, upSign[ i ], 0 );\n\t\t\tcubeCamera.lookAt( forwardSign[ i ], 0, 0 );\n\n\t\t} else if ( col == 1 ) {\n\n\t\t\tcubeCamera.up.set( 0, 0, upSign[ i ] );\n\t\t\tcubeCamera.lookAt( 0, forwardSign[ i ], 0 );\n\n\t\t} else {\n\n\t\t\tcubeCamera.up.set( 0, upSign[ i ], 0 );\n\t\t\tcubeCamera.lookAt( 0, 0, forwardSign[ i ] );\n\n\t\t}\n\t\t_setViewport( cubeUVRenderTarget,\n\t\t\tcol * SIZE_MAX, i > 2 ? SIZE_MAX : 0, SIZE_MAX, SIZE_MAX );\n\t\t_renderer.setRenderTarget( cubeUVRenderTarget );\n\t\t_renderer.render( scene, cubeCamera );\n\n\t}\n\n\t_renderer.toneMapping = toneMapping;\n\t_renderer.toneMappingExposure = toneMappingExposure;\n\t_renderer.outputEncoding = outputEncoding;\n\t_renderer.setClearColor( clearColor, clearAlpha );\n\tscene.scale.z *= - 1;\n\n}\n\nfunction _textureToCubeUV( texture, cubeUVRenderTarget ) {\n\n\tvar scene = new Scene();\n\tif ( texture.isCubeTexture ) {\n\n\t\tif ( _cubemapShader == null ) {\n\n\t\t\t_cubemapShader = _getCubemapShader();\n\n\t\t}\n\n\t} else {\n\n\t\tif ( _equirectShader == null ) {\n\n\t\t\t_equirectShader = _getEquirectShader();\n\n\t\t}\n\n\t}\n\tvar material = texture.isCubeTexture ? _cubemapShader : _equirectShader;\n\tscene.add( new Mesh( _lodPlanes[ 0 ], material ) );\n\tvar uniforms = material.uniforms;\n\n\tuniforms[ 'envMap' ].value = texture;\n\tif ( ! texture.isCubeTexture ) {\n\n\t\tuniforms[ 'texelSize' ].value.set( 1.0 / texture.image.width, 1.0 / texture.image.height );\n\n\t}\n\tuniforms[ 'inputEncoding' ].value = ENCODINGS[ texture.encoding ];\n\tuniforms[ 'outputEncoding' ].value = ENCODINGS[ texture.encoding ];\n\n\t_setViewport( cubeUVRenderTarget, 0, 0, 3 * SIZE_MAX, 2 * SIZE_MAX );\n\t_renderer.setRenderTarget( cubeUVRenderTarget );\n\t_renderer.render( scene, _flatCamera );\n\n}\n\nfunction _compileMaterial( material ) {\n\n\tvar tmpScene = new Scene();\n\ttmpScene.add( new Mesh( _lodPlanes[ 0 ], material ) );\n\t_renderer.compile( tmpScene, _flatCamera );\n\n}\n\nfunction _createRenderTarget( params ) {\n\n\tvar cubeUVRenderTarget = new WebGLRenderTarget( 3 * SIZE_MAX, 3 * SIZE_MAX, params );\n\tcubeUVRenderTarget.texture.mapping = CubeUVReflectionMapping;\n\tcubeUVRenderTarget.texture.name = 'PMREM.cubeUv';\n\tcubeUVRenderTarget.scissorTest = true;\n\treturn cubeUVRenderTarget;\n\n}\n\nfunction _setViewport( target, x, y, width, height ) {\n\n\ttarget.viewport.set( x, y, width, height );\n\ttarget.scissor.set( x, y, width, height );\n\n}\n\nfunction _applyPMREM( cubeUVRenderTarget ) {\n\n\tvar autoClear = _renderer.autoClear;\n\t_renderer.autoClear = false;\n\n\tfor ( var i = 1; i < TOTAL_LODS; i ++ ) {\n\n\t\tvar sigma = Math.sqrt(\n\t\t\t_sigmas[ i ] * _sigmas[ i ] -\n\t\t_sigmas[ i - 1 ] * _sigmas[ i - 1 ] );\n\t\tvar poleAxis =\n\t\t_axisDirections[ ( i - 1 ) % _axisDirections.length ];\n\t\t_blur( cubeUVRenderTarget, i - 1, i, sigma, poleAxis );\n\n\t}\n\n\t_renderer.autoClear = autoClear;\n\n}\n\n/**\n * This is a two-pass Gaussian blur for a cubemap. Normally this is done\n * vertically and horizontally, but this breaks down on a cube. Here we apply\n * the blur latitudinally (around the poles), and then longitudinally (towards\n * the poles) to approximate the orthogonally-separable blur. It is least\n * accurate at the poles, but still does a decent job.\n */\nfunction _blur( cubeUVRenderTarget, lodIn, lodOut, sigma, poleAxis ) {\n\n\t_halfBlur(\n\t\tcubeUVRenderTarget,\n\t\t_pingPongRenderTarget,\n\t\tlodIn,\n\t\tlodOut,\n\t\tsigma,\n\t\t'latitudinal',\n\t\tpoleAxis );\n\n\t_halfBlur(\n\t\t_pingPongRenderTarget,\n\t\tcubeUVRenderTarget,\n\t\tlodOut,\n\t\tlodOut,\n\t\tsigma,\n\t\t'longitudinal',\n\t\tpoleAxis );\n\n}\n\nfunction _halfBlur( targetIn, targetOut, lodIn, lodOut, sigmaRadians, direction, poleAxis ) {\n\n\tif ( direction !== 'latitudinal' && direction !== 'longitudinal' ) {\n\n\t\tconsole.error(\n\t\t\t'blur direction must be either latitudinal or longitudinal!' );\n\n\t}\n\n\t// Number of standard deviations at which to cut off the discrete approximation.\n\tvar STANDARD_DEVIATIONS = 3;\n\n\tvar blurScene = new Scene();\n\tblurScene.add( new Mesh( _lodPlanes[ lodOut ], _blurMaterial ) );\n\tvar blurUniforms = _blurMaterial.uniforms;\n\n\tvar pixels = _sizeLods[ lodIn ] - 1;\n\tvar radiansPerPixel = isFinite( sigmaRadians ) ? Math.PI / ( 2 * pixels ) : 2 * Math.PI / ( 2 * MAX_SAMPLES - 1 );\n\tvar sigmaPixels = sigmaRadians / radiansPerPixel;\n\tvar samples = isFinite( sigmaRadians ) ? 1 + Math.floor( STANDARD_DEVIATIONS * sigmaPixels ) : MAX_SAMPLES;\n\n\tif ( samples > MAX_SAMPLES ) {\n\n\t\tconsole.warn( `sigmaRadians, ${\n\t\t\tsigmaRadians}, is too large and will clip, as it requested ${\n\t\t\tsamples} samples when the maximum is set to ${MAX_SAMPLES}` );\n\n\t}\n\n\tvar weights = [];\n\tvar sum = 0;\n\n\tfor ( var i = 0; i < MAX_SAMPLES; ++ i ) {\n\n\t\tvar x = i / sigmaPixels;\n\t\tvar weight = Math.exp( - x * x / 2 );\n\t\tweights.push( weight );\n\n\t\tif ( i == 0 ) {\n\n\t\t\tsum += weight;\n\n\t\t} else if ( i < samples ) {\n\n\t\t\tsum += 2 * weight;\n\n\t\t}\n\n\t}\n\n\tfor ( var i = 0; i < weights.length; i ++ ) {\n\n\t\tweights[ i ] = weights[ i ] / sum;\n\n\t}\n\n\tblurUniforms[ 'envMap' ].value = targetIn.texture;\n\tblurUniforms[ 'samples' ].value = samples;\n\tblurUniforms[ 'weights' ].value = weights;\n\tblurUniforms[ 'latitudinal' ].value = direction === 'latitudinal';\n\tif ( poleAxis ) {\n\n\t\tblurUniforms[ 'poleAxis' ].value = poleAxis;\n\n\t}\n\tblurUniforms[ 'dTheta' ].value = radiansPerPixel;\n\tblurUniforms[ 'mipInt' ].value = LOD_MAX - lodIn;\n\tblurUniforms[ 'inputEncoding' ].value = ENCODINGS[ targetIn.texture.encoding ];\n\tblurUniforms[ 'outputEncoding' ].value = ENCODINGS[ targetIn.texture.encoding ];\n\n\tvar outputSize = _sizeLods[ lodOut ];\n\tvar x = 3 * Math.max( 0, SIZE_MAX - 2 * outputSize );\n\tvar y = ( lodOut === 0 ? 0 : 2 * SIZE_MAX ) +\n\t2 * outputSize *\n\t\t( lodOut > LOD_MAX - LOD_MIN ? lodOut - LOD_MAX + LOD_MIN : 0 );\n\n\t_setViewport( targetOut, x, y, 3 * outputSize, 2 * outputSize );\n\t_renderer.setRenderTarget( targetOut );\n\t_renderer.render( blurScene, _flatCamera );\n\n}\n\nfunction _getBlurShader( maxSamples ) {\n\n\tvar weights = new Float32Array( maxSamples );\n\tvar poleAxis = new Vector3( 0, 1, 0 );\n\tvar shaderMaterial = new RawShaderMaterial( {\n\n\t\tdefines: { 'n': maxSamples },\n\n\t\tuniforms: {\n\t\t\t'envMap': { value: null },\n\t\t\t'samples': { value: 1 },\n\t\t\t'weights': { value: weights },\n\t\t\t'latitudinal': { value: false },\n\t\t\t'dTheta': { value: 0 },\n\t\t\t'mipInt': { value: 0 },\n\t\t\t'poleAxis': { value: poleAxis },\n\t\t\t'inputEncoding': { value: ENCODINGS[ LinearEncoding ] },\n\t\t\t'outputEncoding': { value: ENCODINGS[ LinearEncoding ] }\n\t\t},\n\n\t\tvertexShader: _getCommonVertexShader(),\n\n\t\tfragmentShader: `\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform int samples;\nuniform float weights[n];\nuniform bool latitudinal;\nuniform float dTheta;\nuniform float mipInt;\nuniform vec3 poleAxis;\n\n${_getEncodings()}\n\n#define ENVMAP_TYPE_CUBE_UV\n#include \n\nvoid main() {\n\tgl_FragColor = vec4(0.0);\n\tfor (int i = 0; i < n; i++) {\n\t\tif (i >= samples)\n\t\t\tbreak;\n\t\tfor (int dir = -1; dir < 2; dir += 2) {\n\t\t\tif (i == 0 && dir == 1)\n\t\t\t\tcontinue;\n\t\t\tvec3 axis = latitudinal ? poleAxis : cross(poleAxis, vOutputDirection);\n\t\t\tif (all(equal(axis, vec3(0.0))))\n\t\t\t\taxis = cross(vec3(0.0, 1.0, 0.0), vOutputDirection);\n\t\t\taxis = normalize(axis);\n\t\t\tfloat theta = dTheta * float(dir * i);\n\t\t\tfloat cosTheta = cos(theta);\n\t\t\t// Rodrigues' axis-angle rotation\n\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross(axis, vOutputDirection) * sin(theta)\n\t\t\t\t\t+ axis * dot(axis, vOutputDirection) * (1.0 - cosTheta);\n\t\t\tgl_FragColor.rgb +=\n\t\t\t\t\tweights[i] * bilinearCubeUV(envMap, sampleDirection, mipInt);\n\t\t}\n\t}\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t`,\n\n\t\tblending: NoBlending,\n\t\tdepthTest: false,\n\t\tdepthWrite: false\n\n\t} );\n\n\tshaderMaterial.type = 'SphericalGaussianBlur';\n\n\treturn shaderMaterial;\n\n}\n\nfunction _getEquirectShader() {\n\n\tvar texelSize = new Vector2( 1, 1 );\n\tvar shaderMaterial = new RawShaderMaterial( {\n\n\t\tuniforms: {\n\t\t\t'envMap': { value: null },\n\t\t\t'texelSize': { value: texelSize },\n\t\t\t'inputEncoding': { value: ENCODINGS[ LinearEncoding ] },\n\t\t\t'outputEncoding': { value: ENCODINGS[ LinearEncoding ] }\n\t\t},\n\n\t\tvertexShader: _getCommonVertexShader(),\n\n\t\tfragmentShader: `\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform vec2 texelSize;\n\n${_getEncodings()}\n\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n\nvoid main() {\n\tgl_FragColor = vec4(0.0);\n\tvec3 outputDirection = normalize(vOutputDirection);\n\tvec2 uv;\n\tuv.y = asin(clamp(outputDirection.y, -1.0, 1.0)) * RECIPROCAL_PI + 0.5;\n\tuv.x = atan(outputDirection.z, outputDirection.x) * RECIPROCAL_PI2 + 0.5;\n\tvec2 f = fract(uv / texelSize - 0.5);\n\tuv -= f * texelSize;\n\tvec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.x += texelSize.x;\n\tvec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.y += texelSize.y;\n\tvec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.x -= texelSize.x;\n\tvec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tvec3 tm = mix(tl, tr, f.x);\n\tvec3 bm = mix(bl, br, f.x);\n\tgl_FragColor.rgb = mix(tm, bm, f.y);\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t`,\n\n\t\tblending: NoBlending,\n\t\tdepthTest: false,\n\t\tdepthWrite: false\n\n\t} );\n\n\tshaderMaterial.type = 'EquirectangularToCubeUV';\n\n\treturn shaderMaterial;\n\n}\n\nfunction _getCubemapShader() {\n\n\tvar shaderMaterial = new RawShaderMaterial( {\n\n\t\tuniforms: {\n\t\t\t'envMap': { value: null },\n\t\t\t'inputEncoding': { value: ENCODINGS[ LinearEncoding ] },\n\t\t\t'outputEncoding': { value: ENCODINGS[ LinearEncoding ] }\n\t\t},\n\n\t\tvertexShader: _getCommonVertexShader(),\n\n\t\tfragmentShader: `\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform samplerCube envMap;\n\n${_getEncodings()}\n\nvoid main() {\n\tgl_FragColor = vec4(0.0);\n\tgl_FragColor.rgb = envMapTexelToLinear(textureCube(envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ))).rgb;\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t`,\n\n\t\tblending: NoBlending,\n\t\tdepthTest: false,\n\t\tdepthWrite: false\n\n\t} );\n\n\tshaderMaterial.type = 'CubemapToCubeUV';\n\n\treturn shaderMaterial;\n\n}\n\nfunction _getCommonVertexShader() {\n\n\treturn `\nprecision mediump float;\nprecision mediump int;\nattribute vec3 position;\nattribute vec2 uv;\nattribute float faceIndex;\nvarying vec3 vOutputDirection;\nvec3 getDirection(vec2 uv, float face) {\n\tuv = 2.0 * uv - 1.0;\n\tvec3 direction = vec3(uv, 1.0);\n\tif (face == 0.0) {\n\t\tdirection = direction.zyx;\n\t\tdirection.z *= -1.0;\n\t} else if (face == 1.0) {\n\t\tdirection = direction.xzy;\n\t\tdirection.z *= -1.0;\n\t} else if (face == 3.0) {\n\t\tdirection = direction.zyx;\n\t\tdirection.x *= -1.0;\n\t} else if (face == 4.0) {\n\t\tdirection = direction.xzy;\n\t\tdirection.y *= -1.0;\n\t} else if (face == 5.0) {\n\t\tdirection.xz *= -1.0;\n\t}\n\treturn direction;\n}\nvoid main() {\n\tvOutputDirection = getDirection(uv, faceIndex);\n\tgl_Position = vec4( position, 1.0 );\n}\n\t`;\n\n}\n\nfunction _getEncodings() {\n\n\treturn `\nuniform int inputEncoding;\nuniform int outputEncoding;\n\n#include \n\nvec4 inputTexelToLinear(vec4 value){\n\tif(inputEncoding == 0){\n\t\treturn value;\n\t}else if(inputEncoding == 1){\n\t\treturn sRGBToLinear(value);\n\t}else if(inputEncoding == 2){\n\t\treturn RGBEToLinear(value);\n\t}else if(inputEncoding == 3){\n\t\treturn RGBMToLinear(value, 7.0);\n\t}else if(inputEncoding == 4){\n\t\treturn RGBMToLinear(value, 16.0);\n\t}else if(inputEncoding == 5){\n\t\treturn RGBDToLinear(value, 256.0);\n\t}else{\n\t\treturn GammaToLinear(value, 2.2);\n\t}\n}\n\nvec4 linearToOutputTexel(vec4 value){\n\tif(outputEncoding == 0){\n\t\treturn value;\n\t}else if(outputEncoding == 1){\n\t\treturn LinearTosRGB(value);\n\t}else if(outputEncoding == 2){\n\t\treturn LinearToRGBE(value);\n\t}else if(outputEncoding == 3){\n\t\treturn LinearToRGBM(value, 7.0);\n\t}else if(outputEncoding == 4){\n\t\treturn LinearToRGBM(value, 16.0);\n\t}else if(outputEncoding == 5){\n\t\treturn LinearToRGBD(value, 256.0);\n\t}else{\n\t\treturn LinearToGamma(value, 2.2);\n\t}\n}\n\nvec4 envMapTexelToLinear(vec4 color) {\n\treturn inputTexelToLinear(color);\n}\n\t`;\n\n}\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nfunction Face4( a, b, c, d, normal, color, materialIndex ) {\n\n\tconsole.warn( 'THREE.Face4 has been removed. A THREE.Face3 will be created instead.' );\n\treturn new Face3( a, b, c, normal, color, materialIndex );\n\n}\n\nvar LineStrip = 0;\n\nvar LinePieces = 1;\n\nfunction MeshFaceMaterial( materials ) {\n\n\tconsole.warn( 'THREE.MeshFaceMaterial has been removed. Use an Array instead.' );\n\treturn materials;\n\n}\n\nfunction MultiMaterial( materials ) {\n\n\tif ( materials === undefined ) materials = [];\n\n\tconsole.warn( 'THREE.MultiMaterial has been removed. Use an Array instead.' );\n\tmaterials.isMultiMaterial = true;\n\tmaterials.materials = materials;\n\tmaterials.clone = function () {\n\n\t\treturn materials.slice();\n\n\t};\n\treturn materials;\n\n}\n\nfunction PointCloud( geometry, material ) {\n\n\tconsole.warn( 'THREE.PointCloud has been renamed to THREE.Points.' );\n\treturn new Points( geometry, material );\n\n}\n\nfunction Particle( material ) {\n\n\tconsole.warn( 'THREE.Particle has been renamed to THREE.Sprite.' );\n\treturn new Sprite( material );\n\n}\n\nfunction ParticleSystem( geometry, material ) {\n\n\tconsole.warn( 'THREE.ParticleSystem has been renamed to THREE.Points.' );\n\treturn new Points( geometry, material );\n\n}\n\nfunction PointCloudMaterial( parameters ) {\n\n\tconsole.warn( 'THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial.' );\n\treturn new PointsMaterial( parameters );\n\n}\n\nfunction ParticleBasicMaterial( parameters ) {\n\n\tconsole.warn( 'THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial.' );\n\treturn new PointsMaterial( parameters );\n\n}\n\nfunction ParticleSystemMaterial( parameters ) {\n\n\tconsole.warn( 'THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial.' );\n\treturn new PointsMaterial( parameters );\n\n}\n\nfunction Vertex( x, y, z ) {\n\n\tconsole.warn( 'THREE.Vertex has been removed. Use THREE.Vector3 instead.' );\n\treturn new Vector3( x, y, z );\n\n}\n\n//\n\nfunction DynamicBufferAttribute( array, itemSize ) {\n\n\tconsole.warn( 'THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead.' );\n\treturn new BufferAttribute( array, itemSize ).setUsage( DynamicDrawUsage );\n\n}\n\nfunction Int8Attribute( array, itemSize ) {\n\n\tconsole.warn( 'THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead.' );\n\treturn new Int8BufferAttribute( array, itemSize );\n\n}\n\nfunction Uint8Attribute( array, itemSize ) {\n\n\tconsole.warn( 'THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead.' );\n\treturn new Uint8BufferAttribute( array, itemSize );\n\n}\n\nfunction Uint8ClampedAttribute( array, itemSize ) {\n\n\tconsole.warn( 'THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead.' );\n\treturn new Uint8ClampedBufferAttribute( array, itemSize );\n\n}\n\nfunction Int16Attribute( array, itemSize ) {\n\n\tconsole.warn( 'THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead.' );\n\treturn new Int16BufferAttribute( array, itemSize );\n\n}\n\nfunction Uint16Attribute( array, itemSize ) {\n\n\tconsole.warn( 'THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead.' );\n\treturn new Uint16BufferAttribute( array, itemSize );\n\n}\n\nfunction Int32Attribute( array, itemSize ) {\n\n\tconsole.warn( 'THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead.' );\n\treturn new Int32BufferAttribute( array, itemSize );\n\n}\n\nfunction Uint32Attribute( array, itemSize ) {\n\n\tconsole.warn( 'THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead.' );\n\treturn new Uint32BufferAttribute( array, itemSize );\n\n}\n\nfunction Float32Attribute( array, itemSize ) {\n\n\tconsole.warn( 'THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead.' );\n\treturn new Float32BufferAttribute( array, itemSize );\n\n}\n\nfunction Float64Attribute( array, itemSize ) {\n\n\tconsole.warn( 'THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead.' );\n\treturn new Float64BufferAttribute( array, itemSize );\n\n}\n\n//\n\nCurve.create = function ( construct, getPoint ) {\n\n\tconsole.log( 'THREE.Curve.create() has been deprecated' );\n\n\tconstruct.prototype = Object.create( Curve.prototype );\n\tconstruct.prototype.constructor = construct;\n\tconstruct.prototype.getPoint = getPoint;\n\n\treturn construct;\n\n};\n\n//\n\nObject.assign( CurvePath.prototype, {\n\n\tcreatePointsGeometry: function ( divisions ) {\n\n\t\tconsole.warn( 'THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.' );\n\n\t\t// generate geometry from path points (for Line or Points objects)\n\n\t\tvar pts = this.getPoints( divisions );\n\t\treturn this.createGeometry( pts );\n\n\t},\n\n\tcreateSpacedPointsGeometry: function ( divisions ) {\n\n\t\tconsole.warn( 'THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.' );\n\n\t\t// generate geometry from equidistant sampling along the path\n\n\t\tvar pts = this.getSpacedPoints( divisions );\n\t\treturn this.createGeometry( pts );\n\n\t},\n\n\tcreateGeometry: function ( points ) {\n\n\t\tconsole.warn( 'THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.' );\n\n\t\tvar geometry = new Geometry();\n\n\t\tfor ( var i = 0, l = points.length; i < l; i ++ ) {\n\n\t\t\tvar point = points[ i ];\n\t\t\tgeometry.vertices.push( new Vector3( point.x, point.y, point.z || 0 ) );\n\n\t\t}\n\n\t\treturn geometry;\n\n\t}\n\n} );\n\n//\n\nObject.assign( Path.prototype, {\n\n\tfromPoints: function ( points ) {\n\n\t\tconsole.warn( 'THREE.Path: .fromPoints() has been renamed to .setFromPoints().' );\n\t\treturn this.setFromPoints( points );\n\n\t}\n\n} );\n\n//\n\nfunction ClosedSplineCurve3( points ) {\n\n\tconsole.warn( 'THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.' );\n\n\tCatmullRomCurve3.call( this, points );\n\tthis.type = 'catmullrom';\n\tthis.closed = true;\n\n}\n\nClosedSplineCurve3.prototype = Object.create( CatmullRomCurve3.prototype );\n\n//\n\nfunction SplineCurve3( points ) {\n\n\tconsole.warn( 'THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.' );\n\n\tCatmullRomCurve3.call( this, points );\n\tthis.type = 'catmullrom';\n\n}\n\nSplineCurve3.prototype = Object.create( CatmullRomCurve3.prototype );\n\n//\n\nfunction Spline( points ) {\n\n\tconsole.warn( 'THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead.' );\n\n\tCatmullRomCurve3.call( this, points );\n\tthis.type = 'catmullrom';\n\n}\n\nSpline.prototype = Object.create( CatmullRomCurve3.prototype );\n\nObject.assign( Spline.prototype, {\n\n\tinitFromArray: function ( /* a */ ) {\n\n\t\tconsole.error( 'THREE.Spline: .initFromArray() has been removed.' );\n\n\t},\n\tgetControlPointsArray: function ( /* optionalTarget */ ) {\n\n\t\tconsole.error( 'THREE.Spline: .getControlPointsArray() has been removed.' );\n\n\t},\n\treparametrizeByArcLength: function ( /* samplingCoef */ ) {\n\n\t\tconsole.error( 'THREE.Spline: .reparametrizeByArcLength() has been removed.' );\n\n\t}\n\n} );\n\n//\n\nfunction AxisHelper( size ) {\n\n\tconsole.warn( 'THREE.AxisHelper has been renamed to THREE.AxesHelper.' );\n\treturn new AxesHelper( size );\n\n}\n\nfunction BoundingBoxHelper( object, color ) {\n\n\tconsole.warn( 'THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead.' );\n\treturn new BoxHelper( object, color );\n\n}\n\nfunction EdgesHelper( object, hex ) {\n\n\tconsole.warn( 'THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead.' );\n\treturn new LineSegments( new EdgesGeometry( object.geometry ), new LineBasicMaterial( { color: hex !== undefined ? hex : 0xffffff } ) );\n\n}\n\nGridHelper.prototype.setColors = function () {\n\n\tconsole.error( 'THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.' );\n\n};\n\nSkeletonHelper.prototype.update = function () {\n\n\tconsole.error( 'THREE.SkeletonHelper: update() no longer needs to be called.' );\n\n};\n\nfunction WireframeHelper( object, hex ) {\n\n\tconsole.warn( 'THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead.' );\n\treturn new LineSegments( new WireframeGeometry( object.geometry ), new LineBasicMaterial( { color: hex !== undefined ? hex : 0xffffff } ) );\n\n}\n\n//\n\nObject.assign( Loader.prototype, {\n\n\textractUrlBase: function ( url ) {\n\n\t\tconsole.warn( 'THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead.' );\n\t\treturn LoaderUtils.extractUrlBase( url );\n\n\t}\n\n} );\n\nLoader.Handlers = {\n\n\tadd: function ( /* regex, loader */ ) {\n\n\t\tconsole.error( 'THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.' );\n\n\t},\n\n\tget: function ( /* file */ ) {\n\n\t\tconsole.error( 'THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.' );\n\n\t}\n\n};\n\nfunction XHRLoader( manager ) {\n\n\tconsole.warn( 'THREE.XHRLoader has been renamed to THREE.FileLoader.' );\n\treturn new FileLoader( manager );\n\n}\n\nfunction BinaryTextureLoader( manager ) {\n\n\tconsole.warn( 'THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader.' );\n\treturn new DataTextureLoader( manager );\n\n}\n\nObject.assign( ObjectLoader.prototype, {\n\n\tsetTexturePath: function ( value ) {\n\n\t\tconsole.warn( 'THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath().' );\n\t\treturn this.setResourcePath( value );\n\n\t}\n\n} );\n\n//\n\nObject.assign( Box2.prototype, {\n\n\tcenter: function ( optionalTarget ) {\n\n\t\tconsole.warn( 'THREE.Box2: .center() has been renamed to .getCenter().' );\n\t\treturn this.getCenter( optionalTarget );\n\n\t},\n\tempty: function () {\n\n\t\tconsole.warn( 'THREE.Box2: .empty() has been renamed to .isEmpty().' );\n\t\treturn this.isEmpty();\n\n\t},\n\tisIntersectionBox: function ( box ) {\n\n\t\tconsole.warn( 'THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox().' );\n\t\treturn this.intersectsBox( box );\n\n\t},\n\tsize: function ( optionalTarget ) {\n\n\t\tconsole.warn( 'THREE.Box2: .size() has been renamed to .getSize().' );\n\t\treturn this.getSize( optionalTarget );\n\n\t}\n} );\n\nObject.assign( Box3.prototype, {\n\n\tcenter: function ( optionalTarget ) {\n\n\t\tconsole.warn( 'THREE.Box3: .center() has been renamed to .getCenter().' );\n\t\treturn this.getCenter( optionalTarget );\n\n\t},\n\tempty: function () {\n\n\t\tconsole.warn( 'THREE.Box3: .empty() has been renamed to .isEmpty().' );\n\t\treturn this.isEmpty();\n\n\t},\n\tisIntersectionBox: function ( box ) {\n\n\t\tconsole.warn( 'THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox().' );\n\t\treturn this.intersectsBox( box );\n\n\t},\n\tisIntersectionSphere: function ( sphere ) {\n\n\t\tconsole.warn( 'THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere().' );\n\t\treturn this.intersectsSphere( sphere );\n\n\t},\n\tsize: function ( optionalTarget ) {\n\n\t\tconsole.warn( 'THREE.Box3: .size() has been renamed to .getSize().' );\n\t\treturn this.getSize( optionalTarget );\n\n\t}\n} );\n\nFrustum.prototype.setFromMatrix = function ( m ) {\n\n\tconsole.warn( 'THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix().' );\n\treturn this.setFromProjectionMatrix( m );\n\n};\n\nLine3.prototype.center = function ( optionalTarget ) {\n\n\tconsole.warn( 'THREE.Line3: .center() has been renamed to .getCenter().' );\n\treturn this.getCenter( optionalTarget );\n\n};\n\nObject.assign( MathUtils, {\n\n\trandom16: function () {\n\n\t\tconsole.warn( 'THREE.Math: .random16() has been deprecated. Use Math.random() instead.' );\n\t\treturn Math.random();\n\n\t},\n\n\tnearestPowerOfTwo: function ( value ) {\n\n\t\tconsole.warn( 'THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo().' );\n\t\treturn MathUtils.floorPowerOfTwo( value );\n\n\t},\n\n\tnextPowerOfTwo: function ( value ) {\n\n\t\tconsole.warn( 'THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo().' );\n\t\treturn MathUtils.ceilPowerOfTwo( value );\n\n\t}\n\n} );\n\nObject.assign( Matrix3.prototype, {\n\n\tflattenToArrayOffset: function ( array, offset ) {\n\n\t\tconsole.warn( \"THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead.\" );\n\t\treturn this.toArray( array, offset );\n\n\t},\n\tmultiplyVector3: function ( vector ) {\n\n\t\tconsole.warn( 'THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.' );\n\t\treturn vector.applyMatrix3( this );\n\n\t},\n\tmultiplyVector3Array: function ( /* a */ ) {\n\n\t\tconsole.error( 'THREE.Matrix3: .multiplyVector3Array() has been removed.' );\n\n\t},\n\tapplyToBufferAttribute: function ( attribute ) {\n\n\t\tconsole.warn( 'THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead.' );\n\t\treturn attribute.applyMatrix3( this );\n\n\t},\n\tapplyToVector3Array: function ( /* array, offset, length */ ) {\n\n\t\tconsole.error( 'THREE.Matrix3: .applyToVector3Array() has been removed.' );\n\n\t}\n\n} );\n\nObject.assign( Matrix4.prototype, {\n\n\textractPosition: function ( m ) {\n\n\t\tconsole.warn( 'THREE.Matrix4: .extractPosition() has been renamed to .copyPosition().' );\n\t\treturn this.copyPosition( m );\n\n\t},\n\tflattenToArrayOffset: function ( array, offset ) {\n\n\t\tconsole.warn( \"THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead.\" );\n\t\treturn this.toArray( array, offset );\n\n\t},\n\tgetPosition: function () {\n\n\t\tconsole.warn( 'THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.' );\n\t\treturn new Vector3().setFromMatrixColumn( this, 3 );\n\n\t},\n\tsetRotationFromQuaternion: function ( q ) {\n\n\t\tconsole.warn( 'THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().' );\n\t\treturn this.makeRotationFromQuaternion( q );\n\n\t},\n\tmultiplyToArray: function () {\n\n\t\tconsole.warn( 'THREE.Matrix4: .multiplyToArray() has been removed.' );\n\n\t},\n\tmultiplyVector3: function ( vector ) {\n\n\t\tconsole.warn( 'THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead.' );\n\t\treturn vector.applyMatrix4( this );\n\n\t},\n\tmultiplyVector4: function ( vector ) {\n\n\t\tconsole.warn( 'THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.' );\n\t\treturn vector.applyMatrix4( this );\n\n\t},\n\tmultiplyVector3Array: function ( /* a */ ) {\n\n\t\tconsole.error( 'THREE.Matrix4: .multiplyVector3Array() has been removed.' );\n\n\t},\n\trotateAxis: function ( v ) {\n\n\t\tconsole.warn( 'THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.' );\n\t\tv.transformDirection( this );\n\n\t},\n\tcrossVector: function ( vector ) {\n\n\t\tconsole.warn( 'THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.' );\n\t\treturn vector.applyMatrix4( this );\n\n\t},\n\ttranslate: function () {\n\n\t\tconsole.error( 'THREE.Matrix4: .translate() has been removed.' );\n\n\t},\n\trotateX: function () {\n\n\t\tconsole.error( 'THREE.Matrix4: .rotateX() has been removed.' );\n\n\t},\n\trotateY: function () {\n\n\t\tconsole.error( 'THREE.Matrix4: .rotateY() has been removed.' );\n\n\t},\n\trotateZ: function () {\n\n\t\tconsole.error( 'THREE.Matrix4: .rotateZ() has been removed.' );\n\n\t},\n\trotateByAxis: function () {\n\n\t\tconsole.error( 'THREE.Matrix4: .rotateByAxis() has been removed.' );\n\n\t},\n\tapplyToBufferAttribute: function ( attribute ) {\n\n\t\tconsole.warn( 'THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead.' );\n\t\treturn attribute.applyMatrix4( this );\n\n\t},\n\tapplyToVector3Array: function ( /* array, offset, length */ ) {\n\n\t\tconsole.error( 'THREE.Matrix4: .applyToVector3Array() has been removed.' );\n\n\t},\n\tmakeFrustum: function ( left, right, bottom, top, near, far ) {\n\n\t\tconsole.warn( 'THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead.' );\n\t\treturn this.makePerspective( left, right, top, bottom, near, far );\n\n\t}\n\n} );\n\nPlane.prototype.isIntersectionLine = function ( line ) {\n\n\tconsole.warn( 'THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine().' );\n\treturn this.intersectsLine( line );\n\n};\n\nQuaternion.prototype.multiplyVector3 = function ( vector ) {\n\n\tconsole.warn( 'THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.' );\n\treturn vector.applyQuaternion( this );\n\n};\n\nObject.assign( Ray.prototype, {\n\n\tisIntersectionBox: function ( box ) {\n\n\t\tconsole.warn( 'THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox().' );\n\t\treturn this.intersectsBox( box );\n\n\t},\n\tisIntersectionPlane: function ( plane ) {\n\n\t\tconsole.warn( 'THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane().' );\n\t\treturn this.intersectsPlane( plane );\n\n\t},\n\tisIntersectionSphere: function ( sphere ) {\n\n\t\tconsole.warn( 'THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere().' );\n\t\treturn this.intersectsSphere( sphere );\n\n\t}\n\n} );\n\nObject.assign( Triangle.prototype, {\n\n\tarea: function () {\n\n\t\tconsole.warn( 'THREE.Triangle: .area() has been renamed to .getArea().' );\n\t\treturn this.getArea();\n\n\t},\n\tbarycoordFromPoint: function ( point, target ) {\n\n\t\tconsole.warn( 'THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord().' );\n\t\treturn this.getBarycoord( point, target );\n\n\t},\n\tmidpoint: function ( target ) {\n\n\t\tconsole.warn( 'THREE.Triangle: .midpoint() has been renamed to .getMidpoint().' );\n\t\treturn this.getMidpoint( target );\n\n\t},\n\tnormal: function ( target ) {\n\n\t\tconsole.warn( 'THREE.Triangle: .normal() has been renamed to .getNormal().' );\n\t\treturn this.getNormal( target );\n\n\t},\n\tplane: function ( target ) {\n\n\t\tconsole.warn( 'THREE.Triangle: .plane() has been renamed to .getPlane().' );\n\t\treturn this.getPlane( target );\n\n\t}\n\n} );\n\nObject.assign( Triangle, {\n\n\tbarycoordFromPoint: function ( point, a, b, c, target ) {\n\n\t\tconsole.warn( 'THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord().' );\n\t\treturn Triangle.getBarycoord( point, a, b, c, target );\n\n\t},\n\tnormal: function ( a, b, c, target ) {\n\n\t\tconsole.warn( 'THREE.Triangle: .normal() has been renamed to .getNormal().' );\n\t\treturn Triangle.getNormal( a, b, c, target );\n\n\t}\n\n} );\n\nObject.assign( Shape.prototype, {\n\n\textractAllPoints: function ( divisions ) {\n\n\t\tconsole.warn( 'THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead.' );\n\t\treturn this.extractPoints( divisions );\n\n\t},\n\textrude: function ( options ) {\n\n\t\tconsole.warn( 'THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead.' );\n\t\treturn new ExtrudeGeometry( this, options );\n\n\t},\n\tmakeGeometry: function ( options ) {\n\n\t\tconsole.warn( 'THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead.' );\n\t\treturn new ShapeGeometry( this, options );\n\n\t}\n\n} );\n\nObject.assign( Vector2.prototype, {\n\n\tfromAttribute: function ( attribute, index, offset ) {\n\n\t\tconsole.warn( 'THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute().' );\n\t\treturn this.fromBufferAttribute( attribute, index, offset );\n\n\t},\n\tdistanceToManhattan: function ( v ) {\n\n\t\tconsole.warn( 'THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo().' );\n\t\treturn this.manhattanDistanceTo( v );\n\n\t},\n\tlengthManhattan: function () {\n\n\t\tconsole.warn( 'THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength().' );\n\t\treturn this.manhattanLength();\n\n\t}\n\n} );\n\nObject.assign( Vector3.prototype, {\n\n\tsetEulerFromRotationMatrix: function () {\n\n\t\tconsole.error( 'THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.' );\n\n\t},\n\tsetEulerFromQuaternion: function () {\n\n\t\tconsole.error( 'THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.' );\n\n\t},\n\tgetPositionFromMatrix: function ( m ) {\n\n\t\tconsole.warn( 'THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().' );\n\t\treturn this.setFromMatrixPosition( m );\n\n\t},\n\tgetScaleFromMatrix: function ( m ) {\n\n\t\tconsole.warn( 'THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().' );\n\t\treturn this.setFromMatrixScale( m );\n\n\t},\n\tgetColumnFromMatrix: function ( index, matrix ) {\n\n\t\tconsole.warn( 'THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().' );\n\t\treturn this.setFromMatrixColumn( matrix, index );\n\n\t},\n\tapplyProjection: function ( m ) {\n\n\t\tconsole.warn( 'THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead.' );\n\t\treturn this.applyMatrix4( m );\n\n\t},\n\tfromAttribute: function ( attribute, index, offset ) {\n\n\t\tconsole.warn( 'THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute().' );\n\t\treturn this.fromBufferAttribute( attribute, index, offset );\n\n\t},\n\tdistanceToManhattan: function ( v ) {\n\n\t\tconsole.warn( 'THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo().' );\n\t\treturn this.manhattanDistanceTo( v );\n\n\t},\n\tlengthManhattan: function () {\n\n\t\tconsole.warn( 'THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength().' );\n\t\treturn this.manhattanLength();\n\n\t}\n\n} );\n\nObject.assign( Vector4.prototype, {\n\n\tfromAttribute: function ( attribute, index, offset ) {\n\n\t\tconsole.warn( 'THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute().' );\n\t\treturn this.fromBufferAttribute( attribute, index, offset );\n\n\t},\n\tlengthManhattan: function () {\n\n\t\tconsole.warn( 'THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength().' );\n\t\treturn this.manhattanLength();\n\n\t}\n\n} );\n\n//\n\nObject.assign( Geometry.prototype, {\n\n\tcomputeTangents: function () {\n\n\t\tconsole.error( 'THREE.Geometry: .computeTangents() has been removed.' );\n\n\t},\n\tcomputeLineDistances: function () {\n\n\t\tconsole.error( 'THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.' );\n\n\t},\n\tapplyMatrix: function ( matrix ) {\n\n\t\tconsole.warn( 'THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4().' );\n\t\treturn this.applyMatrix4( matrix );\n\n\t}\n\n} );\n\nObject.assign( Object3D.prototype, {\n\n\tgetChildByName: function ( name ) {\n\n\t\tconsole.warn( 'THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().' );\n\t\treturn this.getObjectByName( name );\n\n\t},\n\trenderDepth: function () {\n\n\t\tconsole.warn( 'THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.' );\n\n\t},\n\ttranslate: function ( distance, axis ) {\n\n\t\tconsole.warn( 'THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.' );\n\t\treturn this.translateOnAxis( axis, distance );\n\n\t},\n\tgetWorldRotation: function () {\n\n\t\tconsole.error( 'THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.' );\n\n\t},\n\tapplyMatrix: function ( matrix ) {\n\n\t\tconsole.warn( 'THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4().' );\n\t\treturn this.applyMatrix4( matrix );\n\n\t}\n\n} );\n\nObject.defineProperties( Object3D.prototype, {\n\n\teulerOrder: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.Object3D: .eulerOrder is now .rotation.order.' );\n\t\t\treturn this.rotation.order;\n\n\t\t},\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.Object3D: .eulerOrder is now .rotation.order.' );\n\t\t\tthis.rotation.order = value;\n\n\t\t}\n\t},\n\tuseQuaternion: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.' );\n\n\t\t},\n\t\tset: function () {\n\n\t\t\tconsole.warn( 'THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.' );\n\n\t\t}\n\t}\n\n} );\n\nObject.assign( Mesh.prototype, {\n\n\tsetDrawMode: function () {\n\n\t\tconsole.error( 'THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.' );\n\n\t},\n\n} );\n\nObject.defineProperties( Mesh.prototype, {\n\n\tdrawMode: {\n\t\tget: function () {\n\n\t\t\tconsole.error( 'THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode.' );\n\t\t\treturn TrianglesDrawMode;\n\n\t\t},\n\t\tset: function () {\n\n\t\t\tconsole.error( 'THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.' );\n\n\t\t}\n\t}\n\n} );\n\nObject.defineProperties( LOD.prototype, {\n\n\tobjects: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.LOD: .objects has been renamed to .levels.' );\n\t\t\treturn this.levels;\n\n\t\t}\n\t}\n\n} );\n\nObject.defineProperty( Skeleton.prototype, 'useVertexTexture', {\n\n\tget: function () {\n\n\t\tconsole.warn( 'THREE.Skeleton: useVertexTexture has been removed.' );\n\n\t},\n\tset: function () {\n\n\t\tconsole.warn( 'THREE.Skeleton: useVertexTexture has been removed.' );\n\n\t}\n\n} );\n\nSkinnedMesh.prototype.initBones = function () {\n\n\tconsole.error( 'THREE.SkinnedMesh: initBones() has been removed.' );\n\n};\n\nObject.defineProperty( Curve.prototype, '__arcLengthDivisions', {\n\n\tget: function () {\n\n\t\tconsole.warn( 'THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions.' );\n\t\treturn this.arcLengthDivisions;\n\n\t},\n\tset: function ( value ) {\n\n\t\tconsole.warn( 'THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions.' );\n\t\tthis.arcLengthDivisions = value;\n\n\t}\n\n} );\n\n//\n\nPerspectiveCamera.prototype.setLens = function ( focalLength, filmGauge ) {\n\n\tconsole.warn( \"THREE.PerspectiveCamera.setLens is deprecated. \" +\n\t\t\t\"Use .setFocalLength and .filmGauge for a photographic setup.\" );\n\n\tif ( filmGauge !== undefined ) this.filmGauge = filmGauge;\n\tthis.setFocalLength( focalLength );\n\n};\n\n//\n\nObject.defineProperties( Light.prototype, {\n\tonlyShadow: {\n\t\tset: function () {\n\n\t\t\tconsole.warn( 'THREE.Light: .onlyShadow has been removed.' );\n\n\t\t}\n\t},\n\tshadowCameraFov: {\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.Light: .shadowCameraFov is now .shadow.camera.fov.' );\n\t\t\tthis.shadow.camera.fov = value;\n\n\t\t}\n\t},\n\tshadowCameraLeft: {\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.Light: .shadowCameraLeft is now .shadow.camera.left.' );\n\t\t\tthis.shadow.camera.left = value;\n\n\t\t}\n\t},\n\tshadowCameraRight: {\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.Light: .shadowCameraRight is now .shadow.camera.right.' );\n\t\t\tthis.shadow.camera.right = value;\n\n\t\t}\n\t},\n\tshadowCameraTop: {\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.Light: .shadowCameraTop is now .shadow.camera.top.' );\n\t\t\tthis.shadow.camera.top = value;\n\n\t\t}\n\t},\n\tshadowCameraBottom: {\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom.' );\n\t\t\tthis.shadow.camera.bottom = value;\n\n\t\t}\n\t},\n\tshadowCameraNear: {\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.Light: .shadowCameraNear is now .shadow.camera.near.' );\n\t\t\tthis.shadow.camera.near = value;\n\n\t\t}\n\t},\n\tshadowCameraFar: {\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.Light: .shadowCameraFar is now .shadow.camera.far.' );\n\t\t\tthis.shadow.camera.far = value;\n\n\t\t}\n\t},\n\tshadowCameraVisible: {\n\t\tset: function () {\n\n\t\t\tconsole.warn( 'THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.' );\n\n\t\t}\n\t},\n\tshadowBias: {\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.Light: .shadowBias is now .shadow.bias.' );\n\t\t\tthis.shadow.bias = value;\n\n\t\t}\n\t},\n\tshadowDarkness: {\n\t\tset: function () {\n\n\t\t\tconsole.warn( 'THREE.Light: .shadowDarkness has been removed.' );\n\n\t\t}\n\t},\n\tshadowMapWidth: {\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.Light: .shadowMapWidth is now .shadow.mapSize.width.' );\n\t\t\tthis.shadow.mapSize.width = value;\n\n\t\t}\n\t},\n\tshadowMapHeight: {\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.Light: .shadowMapHeight is now .shadow.mapSize.height.' );\n\t\t\tthis.shadow.mapSize.height = value;\n\n\t\t}\n\t}\n} );\n\n//\n\nObject.defineProperties( BufferAttribute.prototype, {\n\n\tlength: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.BufferAttribute: .length has been deprecated. Use .count instead.' );\n\t\t\treturn this.array.length;\n\n\t\t}\n\t},\n\tdynamic: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead.' );\n\t\t\treturn this.usage === DynamicDrawUsage;\n\n\t\t},\n\t\tset: function ( /* value */ ) {\n\n\t\t\tconsole.warn( 'THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead.' );\n\t\t\tthis.setUsage( DynamicDrawUsage );\n\n\t\t}\n\t}\n\n} );\n\nObject.assign( BufferAttribute.prototype, {\n\tsetDynamic: function ( value ) {\n\n\t\tconsole.warn( 'THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead.' );\n\t\tthis.setUsage( value === true ? DynamicDrawUsage : StaticDrawUsage );\n\t\treturn this;\n\n\t},\n\tcopyIndicesArray: function ( /* indices */ ) {\n\n\t\tconsole.error( 'THREE.BufferAttribute: .copyIndicesArray() has been removed.' );\n\n\t},\n\tsetArray: function ( /* array */ ) {\n\n\t\tconsole.error( 'THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers' );\n\n\t}\n} );\n\nObject.assign( BufferGeometry.prototype, {\n\n\taddIndex: function ( index ) {\n\n\t\tconsole.warn( 'THREE.BufferGeometry: .addIndex() has been renamed to .setIndex().' );\n\t\tthis.setIndex( index );\n\n\t},\n\taddAttribute: function ( name, attribute ) {\n\n\t\tconsole.warn( 'THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute().' );\n\n\t\tif ( ! ( attribute && attribute.isBufferAttribute ) && ! ( attribute && attribute.isInterleavedBufferAttribute ) ) {\n\n\t\t\tconsole.warn( 'THREE.BufferGeometry: .addAttribute() now expects ( name, attribute ).' );\n\n\t\t\treturn this.setAttribute( name, new BufferAttribute( arguments[ 1 ], arguments[ 2 ] ) );\n\n\t\t}\n\n\t\tif ( name === 'index' ) {\n\n\t\t\tconsole.warn( 'THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute.' );\n\t\t\tthis.setIndex( attribute );\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\treturn this.setAttribute( name, attribute );\n\n\t},\n\taddDrawCall: function ( start, count, indexOffset ) {\n\n\t\tif ( indexOffset !== undefined ) {\n\n\t\t\tconsole.warn( 'THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset.' );\n\n\t\t}\n\t\tconsole.warn( 'THREE.BufferGeometry: .addDrawCall() is now .addGroup().' );\n\t\tthis.addGroup( start, count );\n\n\t},\n\tclearDrawCalls: function () {\n\n\t\tconsole.warn( 'THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups().' );\n\t\tthis.clearGroups();\n\n\t},\n\tcomputeTangents: function () {\n\n\t\tconsole.warn( 'THREE.BufferGeometry: .computeTangents() has been removed.' );\n\n\t},\n\tcomputeOffsets: function () {\n\n\t\tconsole.warn( 'THREE.BufferGeometry: .computeOffsets() has been removed.' );\n\n\t},\n\tremoveAttribute: function ( name ) {\n\n\t\tconsole.warn( 'THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute().' );\n\n\t\treturn this.deleteAttribute( name );\n\n\t},\n\tapplyMatrix: function ( matrix ) {\n\n\t\tconsole.warn( 'THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4().' );\n\t\treturn this.applyMatrix4( matrix );\n\n\t}\n\n} );\n\nObject.defineProperties( BufferGeometry.prototype, {\n\n\tdrawcalls: {\n\t\tget: function () {\n\n\t\t\tconsole.error( 'THREE.BufferGeometry: .drawcalls has been renamed to .groups.' );\n\t\t\treturn this.groups;\n\n\t\t}\n\t},\n\toffsets: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.BufferGeometry: .offsets has been renamed to .groups.' );\n\t\t\treturn this.groups;\n\n\t\t}\n\t}\n\n} );\n\nObject.defineProperties( InterleavedBuffer.prototype, {\n\n\tdynamic: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead.' );\n\t\t\treturn this.usage === DynamicDrawUsage;\n\n\t\t},\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead.' );\n\t\t\tthis.setUsage( value );\n\n\t\t}\n\t}\n\n} );\n\nObject.assign( InterleavedBuffer.prototype, {\n\tsetDynamic: function ( value ) {\n\n\t\tconsole.warn( 'THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead.' );\n\t\tthis.setUsage( value === true ? DynamicDrawUsage : StaticDrawUsage );\n\t\treturn this;\n\n\t},\n\tsetArray: function ( /* array */ ) {\n\n\t\tconsole.error( 'THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers' );\n\n\t}\n} );\n\n//\n\nObject.assign( ExtrudeBufferGeometry.prototype, {\n\n\tgetArrays: function () {\n\n\t\tconsole.error( 'THREE.ExtrudeBufferGeometry: .getArrays() has been removed.' );\n\n\t},\n\n\taddShapeList: function () {\n\n\t\tconsole.error( 'THREE.ExtrudeBufferGeometry: .addShapeList() has been removed.' );\n\n\t},\n\n\taddShape: function () {\n\n\t\tconsole.error( 'THREE.ExtrudeBufferGeometry: .addShape() has been removed.' );\n\n\t}\n\n} );\n\n//\n\nObject.defineProperties( Uniform.prototype, {\n\n\tdynamic: {\n\t\tset: function () {\n\n\t\t\tconsole.warn( 'THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.' );\n\n\t\t}\n\t},\n\tonUpdate: {\n\t\tvalue: function () {\n\n\t\t\tconsole.warn( 'THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead.' );\n\t\t\treturn this;\n\n\t\t}\n\t}\n\n} );\n\n//\n\nObject.defineProperties( Material.prototype, {\n\n\twrapAround: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.Material: .wrapAround has been removed.' );\n\n\t\t},\n\t\tset: function () {\n\n\t\t\tconsole.warn( 'THREE.Material: .wrapAround has been removed.' );\n\n\t\t}\n\t},\n\n\toverdraw: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.Material: .overdraw has been removed.' );\n\n\t\t},\n\t\tset: function () {\n\n\t\t\tconsole.warn( 'THREE.Material: .overdraw has been removed.' );\n\n\t\t}\n\t},\n\n\twrapRGB: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.Material: .wrapRGB has been removed.' );\n\t\t\treturn new Color();\n\n\t\t}\n\t},\n\n\tshading: {\n\t\tget: function () {\n\n\t\t\tconsole.error( 'THREE.' + this.type + ': .shading has been removed. Use the boolean .flatShading instead.' );\n\n\t\t},\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.' + this.type + ': .shading has been removed. Use the boolean .flatShading instead.' );\n\t\t\tthis.flatShading = ( value === FlatShading );\n\n\t\t}\n\t},\n\n\tstencilMask: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.' + this.type + ': .stencilMask has been removed. Use .stencilFuncMask instead.' );\n\t\t\treturn this.stencilFuncMask;\n\n\t\t},\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.' + this.type + ': .stencilMask has been removed. Use .stencilFuncMask instead.' );\n\t\t\tthis.stencilFuncMask = value;\n\n\t\t}\n\t}\n\n} );\n\nObject.defineProperties( MeshPhongMaterial.prototype, {\n\n\tmetal: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead.' );\n\t\t\treturn false;\n\n\t\t},\n\t\tset: function () {\n\n\t\t\tconsole.warn( 'THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead' );\n\n\t\t}\n\t}\n\n} );\n\nObject.defineProperties( ShaderMaterial.prototype, {\n\n\tderivatives: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives.' );\n\t\t\treturn this.extensions.derivatives;\n\n\t\t},\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives.' );\n\t\t\tthis.extensions.derivatives = value;\n\n\t\t}\n\t}\n\n} );\n\n//\n\nObject.assign( WebGLRenderer.prototype, {\n\n\tclearTarget: function ( renderTarget, color, depth, stencil ) {\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead.' );\n\t\tthis.setRenderTarget( renderTarget );\n\t\tthis.clear( color, depth, stencil );\n\n\t},\n\tanimate: function ( callback ) {\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: .animate() is now .setAnimationLoop().' );\n\t\tthis.setAnimationLoop( callback );\n\n\t},\n\tgetCurrentRenderTarget: function () {\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget().' );\n\t\treturn this.getRenderTarget();\n\n\t},\n\tgetMaxAnisotropy: function () {\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy().' );\n\t\treturn this.capabilities.getMaxAnisotropy();\n\n\t},\n\tgetPrecision: function () {\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision.' );\n\t\treturn this.capabilities.precision;\n\n\t},\n\tresetGLState: function () {\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: .resetGLState() is now .state.reset().' );\n\t\treturn this.state.reset();\n\n\t},\n\tsupportsFloatTextures: function () {\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( \\'OES_texture_float\\' ).' );\n\t\treturn this.extensions.get( 'OES_texture_float' );\n\n\t},\n\tsupportsHalfFloatTextures: function () {\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( \\'OES_texture_half_float\\' ).' );\n\t\treturn this.extensions.get( 'OES_texture_half_float' );\n\n\t},\n\tsupportsStandardDerivatives: function () {\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( \\'OES_standard_derivatives\\' ).' );\n\t\treturn this.extensions.get( 'OES_standard_derivatives' );\n\n\t},\n\tsupportsCompressedTextureS3TC: function () {\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( \\'WEBGL_compressed_texture_s3tc\\' ).' );\n\t\treturn this.extensions.get( 'WEBGL_compressed_texture_s3tc' );\n\n\t},\n\tsupportsCompressedTexturePVRTC: function () {\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( \\'WEBGL_compressed_texture_pvrtc\\' ).' );\n\t\treturn this.extensions.get( 'WEBGL_compressed_texture_pvrtc' );\n\n\t},\n\tsupportsBlendMinMax: function () {\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( \\'EXT_blend_minmax\\' ).' );\n\t\treturn this.extensions.get( 'EXT_blend_minmax' );\n\n\t},\n\tsupportsVertexTextures: function () {\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures.' );\n\t\treturn this.capabilities.vertexTextures;\n\n\t},\n\tsupportsInstancedArrays: function () {\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( \\'ANGLE_instanced_arrays\\' ).' );\n\t\treturn this.extensions.get( 'ANGLE_instanced_arrays' );\n\n\t},\n\tenableScissorTest: function ( boolean ) {\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest().' );\n\t\tthis.setScissorTest( boolean );\n\n\t},\n\tinitMaterial: function () {\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: .initMaterial() has been removed.' );\n\n\t},\n\taddPrePlugin: function () {\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: .addPrePlugin() has been removed.' );\n\n\t},\n\taddPostPlugin: function () {\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: .addPostPlugin() has been removed.' );\n\n\t},\n\tupdateShadowMap: function () {\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: .updateShadowMap() has been removed.' );\n\n\t},\n\tsetFaceCulling: function () {\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: .setFaceCulling() has been removed.' );\n\n\t},\n\tallocTextureUnit: function () {\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: .allocTextureUnit() has been removed.' );\n\n\t},\n\tsetTexture: function () {\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: .setTexture() has been removed.' );\n\n\t},\n\tsetTexture2D: function () {\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: .setTexture2D() has been removed.' );\n\n\t},\n\tsetTextureCube: function () {\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: .setTextureCube() has been removed.' );\n\n\t},\n\tgetActiveMipMapLevel: function () {\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel().' );\n\t\treturn this.getActiveMipmapLevel();\n\n\t}\n\n} );\n\nObject.defineProperties( WebGLRenderer.prototype, {\n\n\tshadowMapEnabled: {\n\t\tget: function () {\n\n\t\t\treturn this.shadowMap.enabled;\n\n\t\t},\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled.' );\n\t\t\tthis.shadowMap.enabled = value;\n\n\t\t}\n\t},\n\tshadowMapType: {\n\t\tget: function () {\n\n\t\t\treturn this.shadowMap.type;\n\n\t\t},\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type.' );\n\t\t\tthis.shadowMap.type = value;\n\n\t\t}\n\t},\n\tshadowMapCullFace: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.' );\n\t\t\treturn undefined;\n\n\t\t},\n\t\tset: function ( /* value */ ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.' );\n\n\t\t}\n\t},\n\tcontext: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: .context has been removed. Use .getContext() instead.' );\n\t\t\treturn this.getContext();\n\n\t\t}\n\t},\n\tvr: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: .vr has been renamed to .xr' );\n\t\t\treturn this.xr;\n\n\t\t}\n\t},\n\tgammaInput: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.' );\n\t\t\treturn false;\n\n\t\t},\n\t\tset: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.' );\n\n\t\t}\n\t},\n\tgammaOutput: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead.' );\n\t\t\treturn false;\n\n\t\t},\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead.' );\n\t\t\tthis.outputEncoding = ( value === true ) ? sRGBEncoding : LinearEncoding;\n\n\t\t}\n\t}\n\n} );\n\nObject.defineProperties( WebGLShadowMap.prototype, {\n\n\tcullFace: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.' );\n\t\t\treturn undefined;\n\n\t\t},\n\t\tset: function ( /* cullFace */ ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.' );\n\n\t\t}\n\t},\n\trenderReverseSided: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.' );\n\t\t\treturn undefined;\n\n\t\t},\n\t\tset: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.' );\n\n\t\t}\n\t},\n\trenderSingleSided: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.' );\n\t\t\treturn undefined;\n\n\t\t},\n\t\tset: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.' );\n\n\t\t}\n\t}\n\n} );\n\nfunction WebGLRenderTargetCube( width, height, options ) {\n\n\tconsole.warn( 'THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options ).' );\n\treturn new WebGLCubeRenderTarget( width, options );\n\n}\n\n//\n\nObject.defineProperties( WebGLRenderTarget.prototype, {\n\n\twrapS: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.' );\n\t\t\treturn this.texture.wrapS;\n\n\t\t},\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.' );\n\t\t\tthis.texture.wrapS = value;\n\n\t\t}\n\t},\n\twrapT: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.' );\n\t\t\treturn this.texture.wrapT;\n\n\t\t},\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.' );\n\t\t\tthis.texture.wrapT = value;\n\n\t\t}\n\t},\n\tmagFilter: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.' );\n\t\t\treturn this.texture.magFilter;\n\n\t\t},\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.' );\n\t\t\tthis.texture.magFilter = value;\n\n\t\t}\n\t},\n\tminFilter: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.' );\n\t\t\treturn this.texture.minFilter;\n\n\t\t},\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.' );\n\t\t\tthis.texture.minFilter = value;\n\n\t\t}\n\t},\n\tanisotropy: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.' );\n\t\t\treturn this.texture.anisotropy;\n\n\t\t},\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.' );\n\t\t\tthis.texture.anisotropy = value;\n\n\t\t}\n\t},\n\toffset: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .offset is now .texture.offset.' );\n\t\t\treturn this.texture.offset;\n\n\t\t},\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .offset is now .texture.offset.' );\n\t\t\tthis.texture.offset = value;\n\n\t\t}\n\t},\n\trepeat: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .repeat is now .texture.repeat.' );\n\t\t\treturn this.texture.repeat;\n\n\t\t},\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .repeat is now .texture.repeat.' );\n\t\t\tthis.texture.repeat = value;\n\n\t\t}\n\t},\n\tformat: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .format is now .texture.format.' );\n\t\t\treturn this.texture.format;\n\n\t\t},\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .format is now .texture.format.' );\n\t\t\tthis.texture.format = value;\n\n\t\t}\n\t},\n\ttype: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .type is now .texture.type.' );\n\t\t\treturn this.texture.type;\n\n\t\t},\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .type is now .texture.type.' );\n\t\t\tthis.texture.type = value;\n\n\t\t}\n\t},\n\tgenerateMipmaps: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.' );\n\t\t\treturn this.texture.generateMipmaps;\n\n\t\t},\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.' );\n\t\t\tthis.texture.generateMipmaps = value;\n\n\t\t}\n\t}\n\n} );\n\n//\n\nObject.defineProperties( Audio.prototype, {\n\n\tload: {\n\t\tvalue: function ( file ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.' );\n\t\t\tvar scope = this;\n\t\t\tvar audioLoader = new AudioLoader();\n\t\t\taudioLoader.load( file, function ( buffer ) {\n\n\t\t\t\tscope.setBuffer( buffer );\n\n\t\t\t} );\n\t\t\treturn this;\n\n\t\t}\n\t},\n\tstartTime: {\n\t\tset: function () {\n\n\t\t\tconsole.warn( 'THREE.Audio: .startTime is now .play( delay ).' );\n\n\t\t}\n\t}\n\n} );\n\nAudioAnalyser.prototype.getData = function () {\n\n\tconsole.warn( 'THREE.AudioAnalyser: .getData() is now .getFrequencyData().' );\n\treturn this.getFrequencyData();\n\n};\n\n//\n\nCubeCamera.prototype.updateCubeMap = function ( renderer, scene ) {\n\n\tconsole.warn( 'THREE.CubeCamera: .updateCubeMap() is now .update().' );\n\treturn this.update( renderer, scene );\n\n};\n\n//\n\nvar GeometryUtils = {\n\n\tmerge: function ( geometry1, geometry2, materialIndexOffset ) {\n\n\t\tconsole.warn( 'THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.' );\n\t\tvar matrix;\n\n\t\tif ( geometry2.isMesh ) {\n\n\t\t\tgeometry2.matrixAutoUpdate && geometry2.updateMatrix();\n\n\t\t\tmatrix = geometry2.matrix;\n\t\t\tgeometry2 = geometry2.geometry;\n\n\t\t}\n\n\t\tgeometry1.merge( geometry2, matrix, materialIndexOffset );\n\n\t},\n\n\tcenter: function ( geometry ) {\n\n\t\tconsole.warn( 'THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead.' );\n\t\treturn geometry.center();\n\n\t}\n\n};\n\nImageUtils.crossOrigin = undefined;\n\nImageUtils.loadTexture = function ( url, mapping, onLoad, onError ) {\n\n\tconsole.warn( 'THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.' );\n\n\tvar loader = new TextureLoader();\n\tloader.setCrossOrigin( this.crossOrigin );\n\n\tvar texture = loader.load( url, onLoad, undefined, onError );\n\n\tif ( mapping ) texture.mapping = mapping;\n\n\treturn texture;\n\n};\n\nImageUtils.loadTextureCube = function ( urls, mapping, onLoad, onError ) {\n\n\tconsole.warn( 'THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.' );\n\n\tvar loader = new CubeTextureLoader();\n\tloader.setCrossOrigin( this.crossOrigin );\n\n\tvar texture = loader.load( urls, onLoad, undefined, onError );\n\n\tif ( mapping ) texture.mapping = mapping;\n\n\treturn texture;\n\n};\n\nImageUtils.loadCompressedTexture = function () {\n\n\tconsole.error( 'THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.' );\n\n};\n\nImageUtils.loadCompressedTextureCube = function () {\n\n\tconsole.error( 'THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.' );\n\n};\n\n//\n\nfunction CanvasRenderer() {\n\n\tconsole.error( 'THREE.CanvasRenderer has been removed' );\n\n}\n\n//\n\nfunction JSONLoader() {\n\n\tconsole.error( 'THREE.JSONLoader has been removed.' );\n\n}\n\n//\n\nvar SceneUtils = {\n\n\tcreateMultiMaterialObject: function ( /* geometry, materials */ ) {\n\n\t\tconsole.error( 'THREE.SceneUtils has been moved to /examples/js/utils/SceneUtils.js' );\n\n\t},\n\n\tdetach: function ( /* child, parent, scene */ ) {\n\n\t\tconsole.error( 'THREE.SceneUtils has been moved to /examples/js/utils/SceneUtils.js' );\n\n\t},\n\n\tattach: function ( /* child, scene, parent */ ) {\n\n\t\tconsole.error( 'THREE.SceneUtils has been moved to /examples/js/utils/SceneUtils.js' );\n\n\t}\n\n};\n\n//\n\nfunction LensFlare() {\n\n\tconsole.error( 'THREE.LensFlare has been moved to /examples/js/objects/Lensflare.js' );\n\n}\n\nif ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {\n\n\t/* eslint-disable no-undef */\n\t__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'register', { detail: {\n\t\trevision: REVISION,\n\t} } ) );\n\t/* eslint-enable no-undef */\n\n}\n\nexport { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveBlending, AlphaFormat, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AmbientLightProbe, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrayCamera, ArrowHelper, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, AxisHelper, BackSide, BasicDepthPacking, BasicShadowMap, BinaryTextureLoader, Bone, BooleanKeyframeTrack, BoundingBoxHelper, Box2, Box3, Box3Helper, BoxBufferGeometry, BoxGeometry, BoxHelper, BufferAttribute, BufferGeometry, BufferGeometryLoader, ByteType, Cache, Camera, CameraHelper, CanvasRenderer, CanvasTexture, CatmullRomCurve3, CineonToneMapping, CircleBufferGeometry, CircleGeometry, ClampToEdgeWrapping, Clock, ClosedSplineCurve3, Color, ColorKeyframeTrack, CompressedTexture, CompressedTextureLoader, ConeBufferGeometry, ConeGeometry, CubeCamera, BoxGeometry as CubeGeometry, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeTextureLoader, CubeUVReflectionMapping, CubeUVRefractionMapping, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceBack, CullFaceFront, CullFaceFrontBack, CullFaceNone, Curve, CurvePath, CustomBlending, CylinderBufferGeometry, CylinderGeometry, Cylindrical, DataTexture, DataTexture2DArray, DataTexture3D, DataTextureLoader, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DepthTexture, DirectionalLight, DirectionalLightHelper, DirectionalLightShadow, DiscreteInterpolant, DodecahedronBufferGeometry, DodecahedronGeometry, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicBufferAttribute, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EdgesHelper, EllipseCurve, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, ExtrudeBufferGeometry, ExtrudeGeometry, Face3, Face4, FaceColors, FileLoader, FlatShading, Float32Attribute, Float32BufferAttribute, Float64Attribute, Float64BufferAttribute, FloatType, Fog, FogExp2, Font, FontLoader, FrontFaceDirectionCCW, FrontFaceDirectionCW, FrontSide, Frustum, GammaEncoding, Geometry, GeometryUtils, GreaterDepth, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HalfFloatType, HemisphereLight, HemisphereLightHelper, HemisphereLightProbe, IcosahedronBufferGeometry, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, ImmediateRenderObject, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16Attribute, Int16BufferAttribute, Int32Attribute, Int32BufferAttribute, Int8Attribute, Int8BufferAttribute, IntType, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InvertStencilOp, JSONLoader, KeepStencilOp, KeyframeTrack, LOD, LatheBufferGeometry, LatheGeometry, Layers, LensFlare, LessDepth, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, LightShadow, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LinePieces, LineSegments, LineStrip, LinearEncoding, LinearFilter, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearToneMapping, Loader, LoaderUtils, LoadingManager, LogLuvEncoding, LoopOnce, LoopPingPong, LoopRepeat, LuminanceAlphaFormat, LuminanceFormat, MOUSE, Material, MaterialLoader, MathUtils as Math, MathUtils, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshFaceMaterial, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiMaterial, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeverDepth, NeverStencilFunc, NoBlending, NoColors, NoToneMapping, NormalBlending, NotEqualDepth, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, ObjectSpaceNormalMap, OctahedronBufferGeometry, OctahedronGeometry, OneFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, PMREMGenerator, ParametricBufferGeometry, ParametricGeometry, Particle, ParticleBasicMaterial, ParticleSystem, ParticleSystemMaterial, Path, PerspectiveCamera, Plane, PlaneBufferGeometry, PlaneGeometry, PlaneHelper, PointCloud, PointCloudMaterial, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronBufferGeometry, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, REVISION, RGBADepthPacking, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBDEncoding, RGBEEncoding, RGBEFormat, RGBFormat, RGBIntegerFormat, RGBM16Encoding, RGBM7Encoding, RGB_ETC1_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, RawShaderMaterial, Ray, Raycaster, RectAreaLight, RedFormat, RedIntegerFormat, ReinhardToneMapping, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, RingBufferGeometry, RingGeometry, Scene, SceneUtils, ShaderChunk, ShaderLib, ShaderMaterial, ShadowMaterial, Shape, ShapeBufferGeometry, ShapeGeometry, ShapePath, ShapeUtils, ShortType, Skeleton, SkeletonHelper, SkinnedMesh, SmoothShading, Sphere, SphereBufferGeometry, SphereGeometry, Spherical, SphericalHarmonics3, SphericalReflectionMapping, Spline, SplineCurve, SplineCurve3, SpotLight, SpotLightHelper, SpotLightShadow, Sprite, SpriteMaterial, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, SubtractEquation, SubtractiveBlending, TOUCH, TangentSpaceNormalMap, TetrahedronBufferGeometry, TetrahedronGeometry, TextBufferGeometry, TextGeometry, Texture, TextureLoader, TorusBufferGeometry, TorusGeometry, TorusKnotBufferGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeBufferGeometry, TubeGeometry, UVMapping, Uint16Attribute, Uint16BufferAttribute, Uint32Attribute, Uint32BufferAttribute, Uint8Attribute, Uint8BufferAttribute, Uint8ClampedAttribute, Uint8ClampedBufferAttribute, Uncharted2ToneMapping, Uniform, UniformsLib, UniformsUtils, UnsignedByteType, UnsignedInt248Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShort565Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, VectorKeyframeTrack, Vertex, VertexColors, VideoTexture, WebGLCubeRenderTarget, WebGLMultisampleRenderTarget, WebGLRenderTarget, WebGLRenderTargetCube, WebGLRenderer, WebGLUtils, WireframeGeometry, WireframeHelper, WrapAroundEnding, XHRLoader, ZeroCurvatureEnding, ZeroFactor, ZeroSlopeEnding, ZeroStencilOp, sRGBEncoding };\n","/**\n * @author qiao / https://github.com/qiao\n * @author mrdoob / http://mrdoob.com\n * @author alteredq / http://alteredqualia.com/\n * @author WestLangley / http://github.com/WestLangley\n * @author erich666 / http://erichaines.com\n * @author ScieCode / http://github.com/sciecode\n */\n\nimport {\n\tEventDispatcher,\n\tMOUSE,\n\tQuaternion,\n\tSpherical,\n\tTOUCH,\n\tVector2,\n\tVector3\n} from \"../../../build/three.module.js\";\n\n// This set of controls performs orbiting, dollying (zooming), and panning.\n// Unlike TrackballControls, it maintains the \"up\" direction object.up (+Y by default).\n//\n// Orbit - left mouse / touch: one-finger move\n// Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish\n// Pan - right mouse, or left mouse + ctrl/meta/shiftKey, or arrow keys / touch: two-finger move\n\nvar OrbitControls = function ( object, domElement ) {\n\n\tif ( domElement === undefined ) console.warn( 'THREE.OrbitControls: The second parameter \"domElement\" is now mandatory.' );\n\tif ( domElement === document ) console.error( 'THREE.OrbitControls: \"document\" should not be used as the target \"domElement\". Please use \"renderer.domElement\" instead.' );\n\n\tthis.object = object;\n\tthis.domElement = domElement;\n\n\t// Set to false to disable this control\n\tthis.enabled = true;\n\n\t// \"target\" sets the location of focus, where the object orbits around\n\tthis.target = new Vector3();\n\n\t// How far you can dolly in and out ( PerspectiveCamera only )\n\tthis.minDistance = 0;\n\tthis.maxDistance = Infinity;\n\n\t// How far you can zoom in and out ( OrthographicCamera only )\n\tthis.minZoom = 0;\n\tthis.maxZoom = Infinity;\n\n\t// How far you can orbit vertically, upper and lower limits.\n\t// Range is 0 to Math.PI radians.\n\tthis.minPolarAngle = 0; // radians\n\tthis.maxPolarAngle = Math.PI; // radians\n\n\t// How far you can orbit horizontally, upper and lower limits.\n\t// If set, must be a sub-interval of the interval [ - Math.PI, Math.PI ].\n\tthis.minAzimuthAngle = - Infinity; // radians\n\tthis.maxAzimuthAngle = Infinity; // radians\n\n\t// Set to true to enable damping (inertia)\n\t// If damping is enabled, you must call controls.update() in your animation loop\n\tthis.enableDamping = false;\n\tthis.dampingFactor = 0.05;\n\n\t// This option actually enables dollying in and out; left as \"zoom\" for backwards compatibility.\n\t// Set to false to disable zooming\n\tthis.enableZoom = true;\n\tthis.zoomSpeed = 1.0;\n\n\t// Set to false to disable rotating\n\tthis.enableRotate = true;\n\tthis.rotateSpeed = 1.0;\n\n\t// Set to false to disable panning\n\tthis.enablePan = true;\n\tthis.panSpeed = 1.0;\n\tthis.screenSpacePanning = false; // if true, pan in screen-space\n\tthis.keyPanSpeed = 7.0;\t// pixels moved per arrow key push\n\n\t// Set to true to automatically rotate around the target\n\t// If auto-rotate is enabled, you must call controls.update() in your animation loop\n\tthis.autoRotate = false;\n\tthis.autoRotateSpeed = 2.0; // 30 seconds per round when fps is 60\n\n\t// Set to false to disable use of the keys\n\tthis.enableKeys = true;\n\n\t// The four arrow keys\n\tthis.keys = { LEFT: 37, UP: 38, RIGHT: 39, BOTTOM: 40 };\n\n\t// Mouse buttons\n\tthis.mouseButtons = { LEFT: MOUSE.ROTATE, MIDDLE: MOUSE.DOLLY, RIGHT: MOUSE.PAN };\n\n\t// Touch fingers\n\tthis.touches = { ONE: TOUCH.ROTATE, TWO: TOUCH.DOLLY_PAN };\n\n\t// for reset\n\tthis.target0 = this.target.clone();\n\tthis.position0 = this.object.position.clone();\n\tthis.zoom0 = this.object.zoom;\n\n\t//\n\t// public methods\n\t//\n\n\tthis.getPolarAngle = function () {\n\n\t\treturn spherical.phi;\n\n\t};\n\n\tthis.getAzimuthalAngle = function () {\n\n\t\treturn spherical.theta;\n\n\t};\n\n\tthis.saveState = function () {\n\n\t\tscope.target0.copy( scope.target );\n\t\tscope.position0.copy( scope.object.position );\n\t\tscope.zoom0 = scope.object.zoom;\n\n\t};\n\n\tthis.reset = function () {\n\n\t\tscope.target.copy( scope.target0 );\n\t\tscope.object.position.copy( scope.position0 );\n\t\tscope.object.zoom = scope.zoom0;\n\n\t\tscope.object.updateProjectionMatrix();\n\t\tscope.dispatchEvent( changeEvent );\n\n\t\tscope.update();\n\n\t\tstate = STATE.NONE;\n\n\t};\n\n\t// this method is exposed, but perhaps it would be better if we can make it private...\n\tthis.update = function () {\n\n\t\tvar offset = new Vector3();\n\n\t\t// so camera.up is the orbit axis\n\t\tvar quat = new Quaternion().setFromUnitVectors( object.up, new Vector3( 0, 1, 0 ) );\n\t\tvar quatInverse = quat.clone().inverse();\n\n\t\tvar lastPosition = new Vector3();\n\t\tvar lastQuaternion = new Quaternion();\n\n\t\treturn function update() {\n\n\t\t\tvar position = scope.object.position;\n\n\t\t\toffset.copy( position ).sub( scope.target );\n\n\t\t\t// rotate offset to \"y-axis-is-up\" space\n\t\t\toffset.applyQuaternion( quat );\n\n\t\t\t// angle from z-axis around y-axis\n\t\t\tspherical.setFromVector3( offset );\n\n\t\t\tif ( scope.autoRotate && state === STATE.NONE ) {\n\n\t\t\t\trotateLeft( getAutoRotationAngle() );\n\n\t\t\t}\n\n\t\t\tif ( scope.enableDamping ) {\n\n\t\t\t\tspherical.theta += sphericalDelta.theta * scope.dampingFactor;\n\t\t\t\tspherical.phi += sphericalDelta.phi * scope.dampingFactor;\n\n\t\t\t} else {\n\n\t\t\t\tspherical.theta += sphericalDelta.theta;\n\t\t\t\tspherical.phi += sphericalDelta.phi;\n\n\t\t\t}\n\n\t\t\t// restrict theta to be between desired limits\n\t\t\tspherical.theta = Math.max( scope.minAzimuthAngle, Math.min( scope.maxAzimuthAngle, spherical.theta ) );\n\n\t\t\t// restrict phi to be between desired limits\n\t\t\tspherical.phi = Math.max( scope.minPolarAngle, Math.min( scope.maxPolarAngle, spherical.phi ) );\n\n\t\t\tspherical.makeSafe();\n\n\n\t\t\tspherical.radius *= scale;\n\n\t\t\t// restrict radius to be between desired limits\n\t\t\tspherical.radius = Math.max( scope.minDistance, Math.min( scope.maxDistance, spherical.radius ) );\n\n\t\t\t// move target to panned location\n\n\t\t\tif ( scope.enableDamping === true ) {\n\n\t\t\t\tscope.target.addScaledVector( panOffset, scope.dampingFactor );\n\n\t\t\t} else {\n\n\t\t\t\tscope.target.add( panOffset );\n\n\t\t\t}\n\n\t\t\toffset.setFromSpherical( spherical );\n\n\t\t\t// rotate offset back to \"camera-up-vector-is-up\" space\n\t\t\toffset.applyQuaternion( quatInverse );\n\n\t\t\tposition.copy( scope.target ).add( offset );\n\n\t\t\tscope.object.lookAt( scope.target );\n\n\t\t\tif ( scope.enableDamping === true ) {\n\n\t\t\t\tsphericalDelta.theta *= ( 1 - scope.dampingFactor );\n\t\t\t\tsphericalDelta.phi *= ( 1 - scope.dampingFactor );\n\n\t\t\t\tpanOffset.multiplyScalar( 1 - scope.dampingFactor );\n\n\t\t\t} else {\n\n\t\t\t\tsphericalDelta.set( 0, 0, 0 );\n\n\t\t\t\tpanOffset.set( 0, 0, 0 );\n\n\t\t\t}\n\n\t\t\tscale = 1;\n\n\t\t\t// update condition is:\n\t\t\t// min(camera displacement, camera rotation in radians)^2 > EPS\n\t\t\t// using small-angle approximation cos(x/2) = 1 - x^2 / 8\n\n\t\t\tif ( zoomChanged ||\n\t\t\t\tlastPosition.distanceToSquared( scope.object.position ) > EPS ||\n\t\t\t\t8 * ( 1 - lastQuaternion.dot( scope.object.quaternion ) ) > EPS ) {\n\n\t\t\t\tscope.dispatchEvent( changeEvent );\n\n\t\t\t\tlastPosition.copy( scope.object.position );\n\t\t\t\tlastQuaternion.copy( scope.object.quaternion );\n\t\t\t\tzoomChanged = false;\n\n\t\t\t\treturn true;\n\n\t\t\t}\n\n\t\t\treturn false;\n\n\t\t};\n\n\t}();\n\n\tthis.dispose = function () {\n\n\t\tscope.domElement.removeEventListener( 'contextmenu', onContextMenu, false );\n\t\tscope.domElement.removeEventListener( 'mousedown', onMouseDown, false );\n\t\tscope.domElement.removeEventListener( 'wheel', onMouseWheel, false );\n\n\t\tscope.domElement.removeEventListener( 'touchstart', onTouchStart, false );\n\t\tscope.domElement.removeEventListener( 'touchend', onTouchEnd, false );\n\t\tscope.domElement.removeEventListener( 'touchmove', onTouchMove, false );\n\n\t\tdocument.removeEventListener( 'mousemove', onMouseMove, false );\n\t\tdocument.removeEventListener( 'mouseup', onMouseUp, false );\n\n\t\tscope.domElement.removeEventListener( 'keydown', onKeyDown, false );\n\n\t\t//scope.dispatchEvent( { type: 'dispose' } ); // should this be added here?\n\n\t};\n\n\t//\n\t// internals\n\t//\n\n\tvar scope = this;\n\n\tvar changeEvent = { type: 'change' };\n\tvar startEvent = { type: 'start' };\n\tvar endEvent = { type: 'end' };\n\n\tvar STATE = {\n\t\tNONE: - 1,\n\t\tROTATE: 0,\n\t\tDOLLY: 1,\n\t\tPAN: 2,\n\t\tTOUCH_ROTATE: 3,\n\t\tTOUCH_PAN: 4,\n\t\tTOUCH_DOLLY_PAN: 5,\n\t\tTOUCH_DOLLY_ROTATE: 6\n\t};\n\n\tvar state = STATE.NONE;\n\n\tvar EPS = 0.000001;\n\n\t// current position in spherical coordinates\n\tvar spherical = new Spherical();\n\tvar sphericalDelta = new Spherical();\n\n\tvar scale = 1;\n\tvar panOffset = new Vector3();\n\tvar zoomChanged = false;\n\n\tvar rotateStart = new Vector2();\n\tvar rotateEnd = new Vector2();\n\tvar rotateDelta = new Vector2();\n\n\tvar panStart = new Vector2();\n\tvar panEnd = new Vector2();\n\tvar panDelta = new Vector2();\n\n\tvar dollyStart = new Vector2();\n\tvar dollyEnd = new Vector2();\n\tvar dollyDelta = new Vector2();\n\n\tfunction getAutoRotationAngle() {\n\n\t\treturn 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;\n\n\t}\n\n\tfunction getZoomScale() {\n\n\t\treturn Math.pow( 0.95, scope.zoomSpeed );\n\n\t}\n\n\tfunction rotateLeft( angle ) {\n\n\t\tsphericalDelta.theta -= angle;\n\n\t}\n\n\tfunction rotateUp( angle ) {\n\n\t\tsphericalDelta.phi -= angle;\n\n\t}\n\n\tvar panLeft = function () {\n\n\t\tvar v = new Vector3();\n\n\t\treturn function panLeft( distance, objectMatrix ) {\n\n\t\t\tv.setFromMatrixColumn( objectMatrix, 0 ); // get X column of objectMatrix\n\t\t\tv.multiplyScalar( - distance );\n\n\t\t\tpanOffset.add( v );\n\n\t\t};\n\n\t}();\n\n\tvar panUp = function () {\n\n\t\tvar v = new Vector3();\n\n\t\treturn function panUp( distance, objectMatrix ) {\n\n\t\t\tif ( scope.screenSpacePanning === true ) {\n\n\t\t\t\tv.setFromMatrixColumn( objectMatrix, 1 );\n\n\t\t\t} else {\n\n\t\t\t\tv.setFromMatrixColumn( objectMatrix, 0 );\n\t\t\t\tv.crossVectors( scope.object.up, v );\n\n\t\t\t}\n\n\t\t\tv.multiplyScalar( distance );\n\n\t\t\tpanOffset.add( v );\n\n\t\t};\n\n\t}();\n\n\t// deltaX and deltaY are in pixels; right and down are positive\n\tvar pan = function () {\n\n\t\tvar offset = new Vector3();\n\n\t\treturn function pan( deltaX, deltaY ) {\n\n\t\t\tvar element = scope.domElement;\n\n\t\t\tif ( scope.object.isPerspectiveCamera ) {\n\n\t\t\t\t// perspective\n\t\t\t\tvar position = scope.object.position;\n\t\t\t\toffset.copy( position ).sub( scope.target );\n\t\t\t\tvar targetDistance = offset.length();\n\n\t\t\t\t// half of the fov is center to top of screen\n\t\t\t\ttargetDistance *= Math.tan( ( scope.object.fov / 2 ) * Math.PI / 180.0 );\n\n\t\t\t\t// we use only clientHeight here so aspect ratio does not distort speed\n\t\t\t\tpanLeft( 2 * deltaX * targetDistance / element.clientHeight, scope.object.matrix );\n\t\t\t\tpanUp( 2 * deltaY * targetDistance / element.clientHeight, scope.object.matrix );\n\n\t\t\t} else if ( scope.object.isOrthographicCamera ) {\n\n\t\t\t\t// orthographic\n\t\t\t\tpanLeft( deltaX * ( scope.object.right - scope.object.left ) / scope.object.zoom / element.clientWidth, scope.object.matrix );\n\t\t\t\tpanUp( deltaY * ( scope.object.top - scope.object.bottom ) / scope.object.zoom / element.clientHeight, scope.object.matrix );\n\n\t\t\t} else {\n\n\t\t\t\t// camera neither orthographic nor perspective\n\t\t\t\tconsole.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.' );\n\t\t\t\tscope.enablePan = false;\n\n\t\t\t}\n\n\t\t};\n\n\t}();\n\n\tfunction dollyIn( dollyScale ) {\n\n\t\tif ( scope.object.isPerspectiveCamera ) {\n\n\t\t\tscale /= dollyScale;\n\n\t\t} else if ( scope.object.isOrthographicCamera ) {\n\n\t\t\tscope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom * dollyScale ) );\n\t\t\tscope.object.updateProjectionMatrix();\n\t\t\tzoomChanged = true;\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );\n\t\t\tscope.enableZoom = false;\n\n\t\t}\n\n\t}\n\n\tfunction dollyOut( dollyScale ) {\n\n\t\tif ( scope.object.isPerspectiveCamera ) {\n\n\t\t\tscale *= dollyScale;\n\n\t\t} else if ( scope.object.isOrthographicCamera ) {\n\n\t\t\tscope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / dollyScale ) );\n\t\t\tscope.object.updateProjectionMatrix();\n\t\t\tzoomChanged = true;\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );\n\t\t\tscope.enableZoom = false;\n\n\t\t}\n\n\t}\n\n\t//\n\t// event callbacks - update the object state\n\t//\n\n\tfunction handleMouseDownRotate( event ) {\n\n\t\trotateStart.set( event.clientX, event.clientY );\n\n\t}\n\n\tfunction handleMouseDownDolly( event ) {\n\n\t\tdollyStart.set( event.clientX, event.clientY );\n\n\t}\n\n\tfunction handleMouseDownPan( event ) {\n\n\t\tpanStart.set( event.clientX, event.clientY );\n\n\t}\n\n\tfunction handleMouseMoveRotate( event ) {\n\n\t\trotateEnd.set( event.clientX, event.clientY );\n\n\t\trotateDelta.subVectors( rotateEnd, rotateStart ).multiplyScalar( scope.rotateSpeed );\n\n\t\tvar element = scope.domElement;\n\n\t\trotateLeft( 2 * Math.PI * rotateDelta.x / element.clientHeight ); // yes, height\n\n\t\trotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight );\n\n\t\trotateStart.copy( rotateEnd );\n\n\t\tscope.update();\n\n\t}\n\n\tfunction handleMouseMoveDolly( event ) {\n\n\t\tdollyEnd.set( event.clientX, event.clientY );\n\n\t\tdollyDelta.subVectors( dollyEnd, dollyStart );\n\n\t\tif ( dollyDelta.y > 0 ) {\n\n\t\t\tdollyIn( getZoomScale() );\n\n\t\t} else if ( dollyDelta.y < 0 ) {\n\n\t\t\tdollyOut( getZoomScale() );\n\n\t\t}\n\n\t\tdollyStart.copy( dollyEnd );\n\n\t\tscope.update();\n\n\t}\n\n\tfunction handleMouseMovePan( event ) {\n\n\t\tpanEnd.set( event.clientX, event.clientY );\n\n\t\tpanDelta.subVectors( panEnd, panStart ).multiplyScalar( scope.panSpeed );\n\n\t\tpan( panDelta.x, panDelta.y );\n\n\t\tpanStart.copy( panEnd );\n\n\t\tscope.update();\n\n\t}\n\n\tfunction handleMouseUp( /*event*/ ) {\n\n\t\t// no-op\n\n\t}\n\n\tfunction handleMouseWheel( event ) {\n\n\t\tif ( event.deltaY < 0 ) {\n\n\t\t\tdollyOut( getZoomScale() );\n\n\t\t} else if ( event.deltaY > 0 ) {\n\n\t\t\tdollyIn( getZoomScale() );\n\n\t\t}\n\n\t\tscope.update();\n\n\t}\n\n\tfunction handleKeyDown( event ) {\n\n\t\tvar needsUpdate = false;\n\n\t\tswitch ( event.keyCode ) {\n\n\t\t\tcase scope.keys.UP:\n\t\t\t\tpan( 0, scope.keyPanSpeed );\n\t\t\t\tneedsUpdate = true;\n\t\t\t\tbreak;\n\n\t\t\tcase scope.keys.BOTTOM:\n\t\t\t\tpan( 0, - scope.keyPanSpeed );\n\t\t\t\tneedsUpdate = true;\n\t\t\t\tbreak;\n\n\t\t\tcase scope.keys.LEFT:\n\t\t\t\tpan( scope.keyPanSpeed, 0 );\n\t\t\t\tneedsUpdate = true;\n\t\t\t\tbreak;\n\n\t\t\tcase scope.keys.RIGHT:\n\t\t\t\tpan( - scope.keyPanSpeed, 0 );\n\t\t\t\tneedsUpdate = true;\n\t\t\t\tbreak;\n\n\t\t}\n\n\t\tif ( needsUpdate ) {\n\n\t\t\t// prevent the browser from scrolling on cursor keys\n\t\t\tevent.preventDefault();\n\n\t\t\tscope.update();\n\n\t\t}\n\n\n\t}\n\n\tfunction handleTouchStartRotate( event ) {\n\n\t\tif ( event.touches.length == 1 ) {\n\n\t\t\trotateStart.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );\n\n\t\t} else {\n\n\t\t\tvar x = 0.5 * ( event.touches[ 0 ].pageX + event.touches[ 1 ].pageX );\n\t\t\tvar y = 0.5 * ( event.touches[ 0 ].pageY + event.touches[ 1 ].pageY );\n\n\t\t\trotateStart.set( x, y );\n\n\t\t}\n\n\t}\n\n\tfunction handleTouchStartPan( event ) {\n\n\t\tif ( event.touches.length == 1 ) {\n\n\t\t\tpanStart.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );\n\n\t\t} else {\n\n\t\t\tvar x = 0.5 * ( event.touches[ 0 ].pageX + event.touches[ 1 ].pageX );\n\t\t\tvar y = 0.5 * ( event.touches[ 0 ].pageY + event.touches[ 1 ].pageY );\n\n\t\t\tpanStart.set( x, y );\n\n\t\t}\n\n\t}\n\n\tfunction handleTouchStartDolly( event ) {\n\n\t\tvar dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX;\n\t\tvar dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY;\n\n\t\tvar distance = Math.sqrt( dx * dx + dy * dy );\n\n\t\tdollyStart.set( 0, distance );\n\n\t}\n\n\tfunction handleTouchStartDollyPan( event ) {\n\n\t\tif ( scope.enableZoom ) handleTouchStartDolly( event );\n\n\t\tif ( scope.enablePan ) handleTouchStartPan( event );\n\n\t}\n\n\tfunction handleTouchStartDollyRotate( event ) {\n\n\t\tif ( scope.enableZoom ) handleTouchStartDolly( event );\n\n\t\tif ( scope.enableRotate ) handleTouchStartRotate( event );\n\n\t}\n\n\tfunction handleTouchMoveRotate( event ) {\n\n\t\tif ( event.touches.length == 1 ) {\n\n\t\t\trotateEnd.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );\n\n\t\t} else {\n\n\t\t\tvar x = 0.5 * ( event.touches[ 0 ].pageX + event.touches[ 1 ].pageX );\n\t\t\tvar y = 0.5 * ( event.touches[ 0 ].pageY + event.touches[ 1 ].pageY );\n\n\t\t\trotateEnd.set( x, y );\n\n\t\t}\n\n\t\trotateDelta.subVectors( rotateEnd, rotateStart ).multiplyScalar( scope.rotateSpeed );\n\n\t\tvar element = scope.domElement;\n\n\t\trotateLeft( 2 * Math.PI * rotateDelta.x / element.clientHeight ); // yes, height\n\n\t\trotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight );\n\n\t\trotateStart.copy( rotateEnd );\n\n\t}\n\n\tfunction handleTouchMovePan( event ) {\n\n\t\tif ( event.touches.length == 1 ) {\n\n\t\t\tpanEnd.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );\n\n\t\t} else {\n\n\t\t\tvar x = 0.5 * ( event.touches[ 0 ].pageX + event.touches[ 1 ].pageX );\n\t\t\tvar y = 0.5 * ( event.touches[ 0 ].pageY + event.touches[ 1 ].pageY );\n\n\t\t\tpanEnd.set( x, y );\n\n\t\t}\n\n\t\tpanDelta.subVectors( panEnd, panStart ).multiplyScalar( scope.panSpeed );\n\n\t\tpan( panDelta.x, panDelta.y );\n\n\t\tpanStart.copy( panEnd );\n\n\t}\n\n\tfunction handleTouchMoveDolly( event ) {\n\n\t\tvar dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX;\n\t\tvar dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY;\n\n\t\tvar distance = Math.sqrt( dx * dx + dy * dy );\n\n\t\tdollyEnd.set( 0, distance );\n\n\t\tdollyDelta.set( 0, Math.pow( dollyEnd.y / dollyStart.y, scope.zoomSpeed ) );\n\n\t\tdollyIn( dollyDelta.y );\n\n\t\tdollyStart.copy( dollyEnd );\n\n\t}\n\n\tfunction handleTouchMoveDollyPan( event ) {\n\n\t\tif ( scope.enableZoom ) handleTouchMoveDolly( event );\n\n\t\tif ( scope.enablePan ) handleTouchMovePan( event );\n\n\t}\n\n\tfunction handleTouchMoveDollyRotate( event ) {\n\n\t\tif ( scope.enableZoom ) handleTouchMoveDolly( event );\n\n\t\tif ( scope.enableRotate ) handleTouchMoveRotate( event );\n\n\t}\n\n\tfunction handleTouchEnd( /*event*/ ) {\n\n\t\t// no-op\n\n\t}\n\n\t//\n\t// event handlers - FSM: listen for events and reset state\n\t//\n\n\tfunction onMouseDown( event ) {\n\n\t\tif ( scope.enabled === false ) return;\n\n\t\t// Prevent the browser from scrolling.\n\t\tevent.preventDefault();\n\n\t\t// Manually set the focus since calling preventDefault above\n\t\t// prevents the browser from setting it automatically.\n\n\t\tscope.domElement.focus ? scope.domElement.focus() : window.focus();\n\n\t\tvar mouseAction;\n\n\t\tswitch ( event.button ) {\n\n\t\t\tcase 0:\n\n\t\t\t\tmouseAction = scope.mouseButtons.LEFT;\n\t\t\t\tbreak;\n\n\t\t\tcase 1:\n\n\t\t\t\tmouseAction = scope.mouseButtons.MIDDLE;\n\t\t\t\tbreak;\n\n\t\t\tcase 2:\n\n\t\t\t\tmouseAction = scope.mouseButtons.RIGHT;\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\n\t\t\t\tmouseAction = - 1;\n\n\t\t}\n\n\t\tswitch ( mouseAction ) {\n\n\t\t\tcase MOUSE.DOLLY:\n\n\t\t\t\tif ( scope.enableZoom === false ) return;\n\n\t\t\t\thandleMouseDownDolly( event );\n\n\t\t\t\tstate = STATE.DOLLY;\n\n\t\t\t\tbreak;\n\n\t\t\tcase MOUSE.ROTATE:\n\n\t\t\t\tif ( event.ctrlKey || event.metaKey || event.shiftKey ) {\n\n\t\t\t\t\tif ( scope.enablePan === false ) return;\n\n\t\t\t\t\thandleMouseDownPan( event );\n\n\t\t\t\t\tstate = STATE.PAN;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( scope.enableRotate === false ) return;\n\n\t\t\t\t\thandleMouseDownRotate( event );\n\n\t\t\t\t\tstate = STATE.ROTATE;\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase MOUSE.PAN:\n\n\t\t\t\tif ( event.ctrlKey || event.metaKey || event.shiftKey ) {\n\n\t\t\t\t\tif ( scope.enableRotate === false ) return;\n\n\t\t\t\t\thandleMouseDownRotate( event );\n\n\t\t\t\t\tstate = STATE.ROTATE;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( scope.enablePan === false ) return;\n\n\t\t\t\t\thandleMouseDownPan( event );\n\n\t\t\t\t\tstate = STATE.PAN;\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\n\t\t\t\tstate = STATE.NONE;\n\n\t\t}\n\n\t\tif ( state !== STATE.NONE ) {\n\n\t\t\tdocument.addEventListener( 'mousemove', onMouseMove, false );\n\t\t\tdocument.addEventListener( 'mouseup', onMouseUp, false );\n\n\t\t\tscope.dispatchEvent( startEvent );\n\n\t\t}\n\n\t}\n\n\tfunction onMouseMove( event ) {\n\n\t\tif ( scope.enabled === false ) return;\n\n\t\tevent.preventDefault();\n\n\t\tswitch ( state ) {\n\n\t\t\tcase STATE.ROTATE:\n\n\t\t\t\tif ( scope.enableRotate === false ) return;\n\n\t\t\t\thandleMouseMoveRotate( event );\n\n\t\t\t\tbreak;\n\n\t\t\tcase STATE.DOLLY:\n\n\t\t\t\tif ( scope.enableZoom === false ) return;\n\n\t\t\t\thandleMouseMoveDolly( event );\n\n\t\t\t\tbreak;\n\n\t\t\tcase STATE.PAN:\n\n\t\t\t\tif ( scope.enablePan === false ) return;\n\n\t\t\t\thandleMouseMovePan( event );\n\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\tfunction onMouseUp( event ) {\n\n\t\tif ( scope.enabled === false ) return;\n\n\t\thandleMouseUp( event );\n\n\t\tdocument.removeEventListener( 'mousemove', onMouseMove, false );\n\t\tdocument.removeEventListener( 'mouseup', onMouseUp, false );\n\n\t\tscope.dispatchEvent( endEvent );\n\n\t\tstate = STATE.NONE;\n\n\t}\n\n\tfunction onMouseWheel( event ) {\n\n\t\tif ( scope.enabled === false || scope.enableZoom === false || ( state !== STATE.NONE && state !== STATE.ROTATE ) ) return;\n\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\n\t\tscope.dispatchEvent( startEvent );\n\n\t\thandleMouseWheel( event );\n\n\t\tscope.dispatchEvent( endEvent );\n\n\t}\n\n\tfunction onKeyDown( event ) {\n\n\t\tif ( scope.enabled === false || scope.enableKeys === false || scope.enablePan === false ) return;\n\n\t\thandleKeyDown( event );\n\n\t}\n\n\tfunction onTouchStart( event ) {\n\n\t\tif ( scope.enabled === false ) return;\n\n\t\tevent.preventDefault();\n\n\t\tswitch ( event.touches.length ) {\n\n\t\t\tcase 1:\n\n\t\t\t\tswitch ( scope.touches.ONE ) {\n\n\t\t\t\t\tcase TOUCH.ROTATE:\n\n\t\t\t\t\t\tif ( scope.enableRotate === false ) return;\n\n\t\t\t\t\t\thandleTouchStartRotate( event );\n\n\t\t\t\t\t\tstate = STATE.TOUCH_ROTATE;\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase TOUCH.PAN:\n\n\t\t\t\t\t\tif ( scope.enablePan === false ) return;\n\n\t\t\t\t\t\thandleTouchStartPan( event );\n\n\t\t\t\t\t\tstate = STATE.TOUCH_PAN;\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\n\t\t\t\t\t\tstate = STATE.NONE;\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 2:\n\n\t\t\t\tswitch ( scope.touches.TWO ) {\n\n\t\t\t\t\tcase TOUCH.DOLLY_PAN:\n\n\t\t\t\t\t\tif ( scope.enableZoom === false && scope.enablePan === false ) return;\n\n\t\t\t\t\t\thandleTouchStartDollyPan( event );\n\n\t\t\t\t\t\tstate = STATE.TOUCH_DOLLY_PAN;\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase TOUCH.DOLLY_ROTATE:\n\n\t\t\t\t\t\tif ( scope.enableZoom === false && scope.enableRotate === false ) return;\n\n\t\t\t\t\t\thandleTouchStartDollyRotate( event );\n\n\t\t\t\t\t\tstate = STATE.TOUCH_DOLLY_ROTATE;\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\n\t\t\t\t\t\tstate = STATE.NONE;\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\n\t\t\t\tstate = STATE.NONE;\n\n\t\t}\n\n\t\tif ( state !== STATE.NONE ) {\n\n\t\t\tscope.dispatchEvent( startEvent );\n\n\t\t}\n\n\t}\n\n\tfunction onTouchMove( event ) {\n\n\t\tif ( scope.enabled === false ) return;\n\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\n\t\tswitch ( state ) {\n\n\t\t\tcase STATE.TOUCH_ROTATE:\n\n\t\t\t\tif ( scope.enableRotate === false ) return;\n\n\t\t\t\thandleTouchMoveRotate( event );\n\n\t\t\t\tscope.update();\n\n\t\t\t\tbreak;\n\n\t\t\tcase STATE.TOUCH_PAN:\n\n\t\t\t\tif ( scope.enablePan === false ) return;\n\n\t\t\t\thandleTouchMovePan( event );\n\n\t\t\t\tscope.update();\n\n\t\t\t\tbreak;\n\n\t\t\tcase STATE.TOUCH_DOLLY_PAN:\n\n\t\t\t\tif ( scope.enableZoom === false && scope.enablePan === false ) return;\n\n\t\t\t\thandleTouchMoveDollyPan( event );\n\n\t\t\t\tscope.update();\n\n\t\t\t\tbreak;\n\n\t\t\tcase STATE.TOUCH_DOLLY_ROTATE:\n\n\t\t\t\tif ( scope.enableZoom === false && scope.enableRotate === false ) return;\n\n\t\t\t\thandleTouchMoveDollyRotate( event );\n\n\t\t\t\tscope.update();\n\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\n\t\t\t\tstate = STATE.NONE;\n\n\t\t}\n\n\t}\n\n\tfunction onTouchEnd( event ) {\n\n\t\tif ( scope.enabled === false ) return;\n\n\t\thandleTouchEnd( event );\n\n\t\tscope.dispatchEvent( endEvent );\n\n\t\tstate = STATE.NONE;\n\n\t}\n\n\tfunction onContextMenu( event ) {\n\n\t\tif ( scope.enabled === false ) return;\n\n\t\tevent.preventDefault();\n\n\t}\n\n\t//\n\n\tscope.domElement.addEventListener( 'contextmenu', onContextMenu, false );\n\n\tscope.domElement.addEventListener( 'mousedown', onMouseDown, false );\n\tscope.domElement.addEventListener( 'wheel', onMouseWheel, false );\n\n\tscope.domElement.addEventListener( 'touchstart', onTouchStart, false );\n\tscope.domElement.addEventListener( 'touchend', onTouchEnd, false );\n\tscope.domElement.addEventListener( 'touchmove', onTouchMove, false );\n\n\tscope.domElement.addEventListener( 'keydown', onKeyDown, false );\n\n\t// make sure element can receive keys.\n\n\tif ( scope.domElement.tabIndex === - 1 ) {\n\n\t\tscope.domElement.tabIndex = 0;\n\n\t}\n\n\t// force an update at start\n\n\tthis.update();\n\n};\n\nOrbitControls.prototype = Object.create( EventDispatcher.prototype );\nOrbitControls.prototype.constructor = OrbitControls;\n\n\n// This set of controls performs orbiting, dollying (zooming), and panning.\n// Unlike TrackballControls, it maintains the \"up\" direction object.up (+Y by default).\n// This is very similar to OrbitControls, another set of touch behavior\n//\n// Orbit - right mouse, or left mouse + ctrl/meta/shiftKey / touch: two-finger rotate\n// Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish\n// Pan - left mouse, or arrow keys / touch: one-finger move\n\nvar MapControls = function ( object, domElement ) {\n\n\tOrbitControls.call( this, object, domElement );\n\n\tthis.mouseButtons.LEFT = MOUSE.PAN;\n\tthis.mouseButtons.RIGHT = MOUSE.ROTATE;\n\n\tthis.touches.ONE = TOUCH.PAN;\n\tthis.touches.TWO = TOUCH.DOLLY_ROTATE;\n\n};\n\nMapControls.prototype = Object.create( EventDispatcher.prototype );\nMapControls.prototype.constructor = MapControls;\n\nexport { OrbitControls, MapControls };\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar LabelRenderParams = (function () {\n function LabelRenderParams(pointIndices, labelStrings, scaleFactors, useSceneOpacityFlags, defaultFontSize, fillColors, strokeColors) {\n this.pointIndices = pointIndices;\n this.labelStrings = labelStrings;\n this.scaleFactors = scaleFactors;\n this.useSceneOpacityFlags = useSceneOpacityFlags;\n this.defaultFontSize = defaultFontSize;\n this.fillColors = fillColors;\n this.strokeColors = strokeColors;\n }\n return LabelRenderParams;\n}());\nexports.LabelRenderParams = LabelRenderParams;\nvar CameraType;\n(function (CameraType) {\n CameraType[CameraType[\"Perspective\"] = 0] = \"Perspective\";\n CameraType[CameraType[\"Orthographic\"] = 1] = \"Orthographic\";\n})(CameraType = exports.CameraType || (exports.CameraType = {}));\nvar RenderContext = (function () {\n function RenderContext(camera, cameraType, cameraTarget, screenWidth, screenHeight, nearestCameraSpacePointZ, farthestCameraSpacePointZ, backgroundColor, pointColors, pointScaleFactors, labels, polylineColors, polylineOpacities, polylineWidths) {\n this.camera = camera;\n this.cameraType = cameraType;\n this.cameraTarget = cameraTarget;\n this.screenWidth = screenWidth;\n this.screenHeight = screenHeight;\n this.nearestCameraSpacePointZ = nearestCameraSpacePointZ;\n this.farthestCameraSpacePointZ = farthestCameraSpacePointZ;\n this.backgroundColor = backgroundColor;\n this.pointColors = pointColors;\n this.pointScaleFactors = pointScaleFactors;\n this.labels = labels;\n this.polylineColors = polylineColors;\n this.polylineOpacities = polylineOpacities;\n this.polylineWidths = polylineWidths;\n }\n return RenderContext;\n}());\nexports.RenderContext = RenderContext;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar THREE = require(\"three\");\nfunction vector3DToScreenCoords(cam, w, h, v) {\n var dpr = window.devicePixelRatio;\n var pv = new THREE.Vector3().copy(v).project(cam);\n var coords = [\n ((pv.x + 1) / 2) * w * dpr,\n -(((pv.y - 1) / 2) * h) * dpr,\n ];\n return coords;\n}\nexports.vector3DToScreenCoords = vector3DToScreenCoords;\nfunction vector3FromPackedArray(a, pointIndex) {\n var offset = pointIndex * 3;\n return new THREE.Vector3(a[offset], a[offset + 1], a[offset + 2]);\n}\nexports.vector3FromPackedArray = vector3FromPackedArray;\nfunction getNearFarPoints(worldSpacePoints, cameraPos, cameraTarget) {\n var shortestDist = Infinity;\n var furthestDist = 0;\n var camToTarget = new THREE.Vector3().copy(cameraTarget).sub(cameraPos);\n var camPlaneNormal = new THREE.Vector3().copy(camToTarget).normalize();\n var n = worldSpacePoints.length / 3;\n var src = 0;\n var p = new THREE.Vector3();\n var camToPoint = new THREE.Vector3();\n for (var i = 0; i < n; i++) {\n p.x = worldSpacePoints[src];\n p.y = worldSpacePoints[src + 1];\n p.z = worldSpacePoints[src + 2];\n src += 3;\n camToPoint.copy(p).sub(cameraPos);\n var dist = camPlaneNormal.dot(camToPoint);\n if (dist < 0) {\n continue;\n }\n furthestDist = dist > furthestDist ? dist : furthestDist;\n shortestDist = dist < shortestDist ? dist : shortestDist;\n }\n return [shortestDist, furthestDist];\n}\nexports.getNearFarPoints = getNearFarPoints;\nfunction prepareTexture(texture, needsUpdate) {\n if (needsUpdate === void 0) { needsUpdate = true; }\n texture.needsUpdate = needsUpdate;\n texture.minFilter = THREE.LinearFilter;\n texture.generateMipmaps = false;\n texture.flipY = false;\n return texture;\n}\nfunction createTextureFromCanvas(image) {\n var texture = new THREE.Texture(image);\n return prepareTexture(texture);\n}\nexports.createTextureFromCanvas = createTextureFromCanvas;\nfunction createTextureFromImage(image, onImageLoad) {\n var texture = new THREE.Texture(image);\n image.onload = function () {\n texture.needsUpdate = true;\n onImageLoad();\n };\n return prepareTexture(texture, false);\n}\nexports.createTextureFromImage = createTextureFromImage;\nfunction hasWebGLSupport() {\n try {\n var c = document.createElement('canvas');\n var gl = c.getContext('webgl') || c.getContext('experimental-webgl');\n return gl != null;\n }\n catch (e) {\n return false;\n }\n}\nexports.hasWebGLSupport = hasWebGLSupport;\nfunction extent(data) {\n var minimum = Infinity;\n var maximum = -Infinity;\n for (var i = 0; i < data.length; i++) {\n var item = data[i];\n if (item < minimum)\n minimum = item;\n if (item > maximum)\n maximum = item;\n }\n return [minimum, maximum];\n}\nexports.extent = extent;\nfunction scaleLinear(value, domain, range) {\n var domainDifference = domain[1] - domain[0];\n var rangeDifference = range[1] - range[0];\n var percentDomain = (value - domain[0]) / domainDifference;\n return percentDomain * rangeDifference + range[0];\n}\nexports.scaleLinear = scaleLinear;\nfunction scaleExponential(value, domain, range) {\n var domainDifference = Math.pow(domain[1], Math.E) - Math.pow(domain[0], Math.E);\n var rangeDifference = range[1] - range[0];\n var percentDomain = (Math.pow(value, Math.E) - domain[0]) / domainDifference;\n return percentDomain * rangeDifference + range[0];\n}\nexports.scaleExponential = scaleExponential;\nfunction packRgbIntoUint8Array(rgbArray, labelIndex, r, g, b) {\n rgbArray[labelIndex * 3] = r;\n rgbArray[labelIndex * 3 + 1] = g;\n rgbArray[labelIndex * 3 + 2] = b;\n}\nexports.packRgbIntoUint8Array = packRgbIntoUint8Array;\nfunction styleRgbFromHexColor(hex) {\n var c = new THREE.Color(hex);\n return [(c.r * 255) | 0, (c.g * 255) | 0, (c.b * 255) | 0];\n}\nexports.styleRgbFromHexColor = styleRgbFromHexColor;\nvar toPercent = function (percent) { return 100 * percent + \"%\"; };\nfunction getDefaultPointInPolylineColor(index, totalPoints, startHue, endHue, saturation, lightness) {\n var hue = startHue + ((endHue - startHue) * index) / totalPoints;\n var hsl = \"hsl(\" + hue + \", \" + toPercent(saturation) + \", \" + toPercent(lightness) + \")\";\n return new THREE.Color(hsl);\n}\nexports.getDefaultPointInPolylineColor = getDefaultPointInPolylineColor;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar ScatterPlotRectangleSelector = (function () {\n function ScatterPlotRectangleSelector(container, selectionCallback, styles) {\n this.startCoordinates = [0, 0];\n this.svgElement = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n this.svgElement.style.display = 'none';\n this.svgElement.style.height = '100%';\n this.svgElement.style.width = '100%';\n this.svgElement.style.position = 'absolute';\n container.insertAdjacentElement('afterbegin', this.svgElement);\n this.rectElement = document.createElementNS('http://www.w3.org/2000/svg', 'rect');\n this.rectElement.style.stroke = styles.select.stroke;\n this.rectElement.style.strokeDasharray = styles.select.strokeDashArray;\n this.rectElement.style.strokeWidth = \"\" + styles.select.strokeWidth;\n this.rectElement.style.fill = styles.select.fill;\n this.rectElement.style.fillOpacity = \"\" + styles.select.fillOpacity;\n this.svgElement.appendChild(this.rectElement);\n this.selectionCallback = selectionCallback;\n this.isMouseDown = false;\n }\n ScatterPlotRectangleSelector.prototype.onMouseDown = function (offsetX, offsetY) {\n this.isMouseDown = true;\n this.rectElement.style.display = 'block';\n this.svgElement.style.display = 'block';\n this.startCoordinates = [offsetX, offsetY];\n this.lastBoundingBox = {\n x: this.startCoordinates[0],\n y: this.startCoordinates[1],\n width: 1,\n height: 1,\n };\n };\n ScatterPlotRectangleSelector.prototype.onMouseMove = function (offsetX, offsetY) {\n if (!this.isMouseDown) {\n return;\n }\n this.lastBoundingBox.x = Math.min(offsetX, this.startCoordinates[0]);\n this.lastBoundingBox.y = Math.max(offsetY, this.startCoordinates[1]);\n this.lastBoundingBox.width =\n Math.max(offsetX, this.startCoordinates[0]) - this.lastBoundingBox.x;\n this.lastBoundingBox.height =\n this.lastBoundingBox.y - Math.min(offsetY, this.startCoordinates[1]);\n this.rectElement.setAttribute('x', '' + this.lastBoundingBox.x);\n this.rectElement.setAttribute('y', '' + (this.lastBoundingBox.y - this.lastBoundingBox.height));\n this.rectElement.setAttribute('width', '' + this.lastBoundingBox.width);\n this.rectElement.setAttribute('height', '' + this.lastBoundingBox.height);\n };\n ScatterPlotRectangleSelector.prototype.onMouseUp = function () {\n this.isMouseDown = false;\n this.svgElement.style.display = 'none';\n this.rectElement.style.display = 'none';\n this.rectElement.setAttribute('width', '0');\n this.rectElement.setAttribute('height', '0');\n this.selectionCallback(this.lastBoundingBox);\n };\n return ScatterPlotRectangleSelector;\n}());\nexports.ScatterPlotRectangleSelector = ScatterPlotRectangleSelector;\n","\"use strict\";\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __values = (this && this.__values) || function(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar THREE = require(\"three\");\nvar OrbitControls_1 = require(\"three/examples/jsm/controls/OrbitControls\");\nvar render_1 = require(\"./render\");\nvar util = require(\"./util\");\nvar scatter_plot_rectangle_selector_1 = require(\"./scatter_plot_rectangle_selector\");\nvar CUBE_LENGTH = 2;\nvar MAX_ZOOM = 5 * CUBE_LENGTH;\nvar MIN_ZOOM = 0.025 * CUBE_LENGTH;\nvar PERSP_CAMERA_FOV_VERTICAL = 70;\nvar PERSP_CAMERA_NEAR_CLIP_PLANE = 0.01;\nvar PERSP_CAMERA_FAR_CLIP_PLANE = 100;\nvar ORTHO_CAMERA_FRUSTUM_HALF_EXTENT = 1.2;\nvar SHIFT_KEY = 16;\nvar CTRL_KEY = 17;\nvar START_CAMERA_POS_3D = new THREE.Vector3(0.45, 0.9, 1.6);\nvar START_CAMERA_TARGET_3D = new THREE.Vector3(0, 0, 0);\nvar START_CAMERA_POS_2D = new THREE.Vector3(0, 0, 4);\nvar START_CAMERA_TARGET_2D = new THREE.Vector3(0, 0, 0);\nvar DEFAULT_ORBIT_CONTROL_PARAMS = {\n mouseRotateSpeed: 1,\n autoRotateSpeed: 2,\n zoomSpeed: 0.125,\n};\nvar ScatterPlot = (function () {\n function ScatterPlot(containerElement, params) {\n var _this = this;\n this.clickCallback = function () { };\n this.hoverCallback = function () { };\n this.selectCallback = function () { };\n this.selectEnabled = true;\n this.visualizers = new Map();\n this.onCameraMoveListeners = [];\n this.height = 0;\n this.width = 0;\n this.dimensions = 3;\n this.interactionMode = \"PAN\";\n this.pickingTexture = new THREE.WebGLRenderTarget(0, 0);\n this.orbitAnimationOnNextCameraCreation = false;\n this.orbitAnimationId = null;\n this.worldSpacePointPositions = new Float32Array(0);\n this.pointColors = new Float32Array(0);\n this.pointScaleFactors = new Float32Array(0);\n this.polylineColors = {};\n this.polylineOpacities = new Float32Array(0);\n this.polylineWidths = new Float32Array(0);\n this.selecting = false;\n this.nearestPoint = null;\n this.mouseIsDown = false;\n this.isDragSequence = false;\n this.lastHovered = null;\n this.container = containerElement;\n this.styles = params.styles;\n this.setParameters(params);\n this.computeLayoutValues();\n this.scene = new THREE.Scene();\n this.renderer = new THREE.WebGLRenderer({\n alpha: true,\n premultipliedAlpha: false,\n antialias: false,\n });\n this.renderer.setClearColor(this.styles.backgroundColor, 1);\n this.container.appendChild(this.renderer.domElement);\n this.light = new THREE.PointLight(0xffecbf, 1, 0);\n this.scene.add(this.light);\n this.orbitControlParams = __assign(__assign({}, DEFAULT_ORBIT_CONTROL_PARAMS), params.orbitControlParams);\n this.rectangleSelector = new scatter_plot_rectangle_selector_1.ScatterPlotRectangleSelector(this.container, function (boundingBox) {\n _this.selectBoundingBox(boundingBox);\n }, this.styles);\n this.addInteractionListeners();\n this.setDimensions(3);\n this.makeCamera(params.camera);\n this.resize();\n }\n ScatterPlot.prototype.setParameters = function (p) {\n if (p.onClick !== undefined)\n this.clickCallback = p.onClick;\n if (p.onHover !== undefined)\n this.hoverCallback = p.onHover;\n if (p.onSelect !== undefined)\n this.selectCallback = p.onSelect;\n if (p.selectEnabled !== undefined)\n this.selectEnabled = p.selectEnabled;\n };\n ScatterPlot.prototype.addInteractionListeners = function () {\n this.container.addEventListener('mousemove', this.onMouseMove.bind(this));\n this.container.addEventListener('mousedown', this.onMouseDown.bind(this));\n this.container.addEventListener('mouseup', this.onMouseUp.bind(this));\n this.container.addEventListener('click', this.onClick.bind(this));\n window.addEventListener('keydown', this.onKeyDown.bind(this), false);\n window.addEventListener('keyup', this.onKeyUp.bind(this), false);\n };\n ScatterPlot.prototype.addCameraControlsEventListeners = function (cameraControls) {\n var _this = this;\n cameraControls.addEventListener('start', function () {\n _this.stopOrbitAnimation();\n _this.onCameraMoveListeners.forEach(function (l) {\n return l(_this.camera.position, cameraControls.target);\n });\n });\n cameraControls.addEventListener('change', function () {\n _this.render();\n });\n cameraControls.addEventListener('end', function () { });\n };\n ScatterPlot.prototype.makeOrbitControls = function (camera, cameraIs3D) {\n if (this.orbitCameraControls != null) {\n this.orbitCameraControls.dispose();\n }\n var occ = new OrbitControls_1.OrbitControls(camera, this.renderer.domElement);\n occ.zoomSpeed = this.orbitControlParams.zoomSpeed;\n occ.enableRotate = cameraIs3D;\n occ.autoRotate = false;\n occ.enableKeys = false;\n occ.rotateSpeed = this.orbitControlParams.mouseRotateSpeed;\n if (cameraIs3D) {\n occ.mouseButtons.LEFT = THREE.MOUSE.LEFT;\n occ.mouseButtons.RIGHT = THREE.MOUSE.RIGHT;\n }\n else {\n occ.mouseButtons.LEFT = THREE.MOUSE.RIGHT;\n occ.mouseButtons.RIGHT = THREE.MOUSE.LEFT;\n }\n occ.reset();\n this.camera = camera;\n this.orbitCameraControls = occ;\n this.addCameraControlsEventListeners(this.orbitCameraControls);\n };\n ScatterPlot.prototype.makeCamera = function (cameraParams) {\n if (cameraParams === void 0) { cameraParams = {}; }\n var def = this.makeDefaultCameraDef(this.dimensions, cameraParams);\n this.recreateCamera(def);\n if (this.dimensions === 3 && this.styles.axesVisible) {\n this.add3dAxes();\n }\n else {\n this.remove3dAxesFromScene();\n }\n };\n ScatterPlot.prototype.makeCamera3D = function (cameraDef, w, h) {\n var camera;\n {\n var aspectRatio = w / h;\n camera = new THREE.PerspectiveCamera(PERSP_CAMERA_FOV_VERTICAL, aspectRatio, PERSP_CAMERA_NEAR_CLIP_PLANE, PERSP_CAMERA_FAR_CLIP_PLANE);\n camera.position.set(cameraDef.position[0], cameraDef.position[1], cameraDef.position[2]);\n var at = new THREE.Vector3(cameraDef.target[0], cameraDef.target[1], cameraDef.target[2]);\n camera.lookAt(at);\n camera.zoom = cameraDef.zoom;\n camera.updateProjectionMatrix();\n }\n this.camera = camera;\n this.makeOrbitControls(camera, true);\n };\n ScatterPlot.prototype.makeCamera2D = function (cameraDef, w, h) {\n var camera;\n var target = new THREE.Vector3(cameraDef.target[0], cameraDef.target[1], cameraDef.target[2]);\n {\n var aspectRatio = w / h;\n var left = -ORTHO_CAMERA_FRUSTUM_HALF_EXTENT;\n var right = ORTHO_CAMERA_FRUSTUM_HALF_EXTENT;\n var bottom = -ORTHO_CAMERA_FRUSTUM_HALF_EXTENT;\n var top_1 = ORTHO_CAMERA_FRUSTUM_HALF_EXTENT;\n if (aspectRatio > 1) {\n left *= aspectRatio;\n right *= aspectRatio;\n }\n else {\n top_1 /= aspectRatio;\n bottom /= aspectRatio;\n }\n camera = new THREE.OrthographicCamera(left, right, top_1, bottom, -1000, 1000);\n camera.position.set(cameraDef.position[0], cameraDef.position[1], cameraDef.position[2]);\n camera.up = new THREE.Vector3(0, 0, 1);\n camera.lookAt(target);\n camera.zoom = cameraDef.zoom;\n camera.updateProjectionMatrix();\n }\n this.camera = camera;\n this.makeOrbitControls(camera, false);\n };\n ScatterPlot.prototype.makeDefaultCameraDef = function (dimensions, cameraParams) {\n if (cameraParams === void 0) { cameraParams = {}; }\n var orthographic = dimensions === 2;\n var position = orthographic ? START_CAMERA_POS_2D : START_CAMERA_POS_3D;\n var target = orthographic\n ? START_CAMERA_TARGET_2D\n : START_CAMERA_TARGET_3D;\n var def = {\n orthographic: orthographic,\n zoom: 1.0,\n position: [position.x, position.y, position.z],\n target: [target.x, target.y, target.z],\n };\n if (cameraParams.zoom)\n def.zoom = cameraParams.zoom;\n if (cameraParams.position)\n def.position = cameraParams.position;\n if (cameraParams.target)\n def.target = cameraParams.target;\n return def;\n };\n ScatterPlot.prototype.recreateCamera = function (cameraDef) {\n if (cameraDef.orthographic) {\n this.makeCamera2D(cameraDef, this.width, this.height);\n }\n else {\n this.makeCamera3D(cameraDef, this.width, this.height);\n }\n this.orbitCameraControls.minDistance = MIN_ZOOM;\n this.orbitCameraControls.maxDistance = MAX_ZOOM;\n this.orbitCameraControls.update();\n if (this.orbitAnimationOnNextCameraCreation) {\n this.startOrbitAnimation();\n }\n };\n ScatterPlot.prototype.setInteractionMode = function (interactionMode) {\n this.interactionMode = interactionMode;\n if (interactionMode === \"SELECT\") {\n this.selecting = true;\n this.container.style.cursor = 'crosshair';\n }\n else {\n this.selecting = false;\n this.container.style.cursor = 'default';\n }\n };\n ScatterPlot.prototype.onClick = function (e, notify) {\n if (notify === void 0) { notify = true; }\n if (e && this.selecting) {\n return;\n }\n if (!this.isDragSequence && notify) {\n var selection = this.nearestPoint != null ? [this.nearestPoint] : [];\n this.selectCallback(selection);\n this.clickCallback(this.nearestPoint);\n }\n this.isDragSequence = false;\n this.render();\n };\n ScatterPlot.prototype.onMouseDown = function (e) {\n this.isDragSequence = false;\n this.mouseIsDown = true;\n if (this.selecting) {\n this.orbitCameraControls.enabled = false;\n this.rectangleSelector.onMouseDown(e.offsetX, e.offsetY);\n this.setNearestPointToMouse(e);\n }\n else if (!e.ctrlKey &&\n this.sceneIs3D() &&\n this.orbitCameraControls.mouseButtons.ORBIT === THREE.MOUSE.RIGHT) {\n this.orbitCameraControls.mouseButtons.ORBIT = THREE.MOUSE.LEFT;\n this.orbitCameraControls.mouseButtons.PAN = THREE.MOUSE.RIGHT;\n }\n else if (e.ctrlKey &&\n this.sceneIs3D() &&\n this.orbitCameraControls.mouseButtons.ORBIT === THREE.MOUSE.LEFT) {\n this.orbitCameraControls.mouseButtons.ORBIT = THREE.MOUSE.RIGHT;\n this.orbitCameraControls.mouseButtons.PAN = THREE.MOUSE.LEFT;\n }\n };\n ScatterPlot.prototype.onMouseUp = function (e) {\n if (this.selecting) {\n this.orbitCameraControls.enabled = true;\n this.rectangleSelector.onMouseUp();\n this.render();\n }\n this.mouseIsDown = false;\n };\n ScatterPlot.prototype.onMouseMove = function (e) {\n this.isDragSequence = this.mouseIsDown;\n if (this.selecting && this.mouseIsDown) {\n this.rectangleSelector.onMouseMove(e.offsetX, e.offsetY);\n this.render();\n }\n else if (!this.mouseIsDown) {\n this.setNearestPointToMouse(e);\n if (this.nearestPoint != this.lastHovered) {\n this.lastHovered = this.nearestPoint;\n this.hoverCallback(this.nearestPoint);\n }\n }\n };\n ScatterPlot.prototype.onKeyDown = function (e) {\n if (e.keyCode === CTRL_KEY && this.sceneIs3D()) {\n this.orbitCameraControls.mouseButtons.ORBIT = THREE.MOUSE.RIGHT;\n this.orbitCameraControls.mouseButtons.PAN = THREE.MOUSE.LEFT;\n }\n if (e.keyCode === SHIFT_KEY && this.selectEnabled) {\n this.selecting = true;\n this.container.style.cursor = 'crosshair';\n }\n };\n ScatterPlot.prototype.onKeyUp = function (e) {\n if (e.keyCode === CTRL_KEY && this.sceneIs3D()) {\n this.orbitCameraControls.mouseButtons.ORBIT = THREE.MOUSE.LEFT;\n this.orbitCameraControls.mouseButtons.PAN = THREE.MOUSE.RIGHT;\n }\n if (e.keyCode === SHIFT_KEY && this.selectEnabled) {\n this.selecting = false;\n this.container.style.cursor = 'default';\n this.render();\n }\n };\n ScatterPlot.prototype.getPointIndicesFromBoundingBox = function (boundingBox) {\n if (this.worldSpacePointPositions == null) {\n return [];\n }\n this.camera.updateMatrixWorld();\n var dpr = window.devicePixelRatio || 1;\n var selectionX = Math.floor(boundingBox.x * dpr);\n var selectionY = Math.floor(boundingBox.y * dpr);\n var selectionWidth = Math.max(Math.floor(boundingBox.width * dpr), 1);\n var selectionHeight = Math.max(Math.floor(boundingBox.height * dpr), 1);\n if (selectionWidth <= 2 && selectionHeight <= 2) {\n return this.getPointIndicesFromBoundingBoxPickingTexture(boundingBox);\n }\n var canvas = this.renderer.domElement;\n var canvasWidth = canvas.width;\n var canvasHeight = canvas.height;\n var pointIndices = [];\n var vector3 = new THREE.Vector3();\n for (var i = 0; i < this.worldSpacePointPositions.length; i++) {\n var start = i * 3;\n var _a = __read(this.worldSpacePointPositions.slice(start, start + 3), 3), worldX = _a[0], worldY = _a[1], worldZ = _a[2];\n vector3.x = worldX;\n vector3.y = worldY;\n vector3.z = worldZ;\n var screenVector = vector3.project(this.camera);\n var x = ((screenVector.x + 1) * canvasWidth) / 2;\n var y = (-(screenVector.y - 1) * canvasHeight) / 2;\n if (x >= selectionX && x <= selectionX + selectionWidth) {\n if (y <= selectionY && y >= selectionY - selectionHeight) {\n pointIndices.push(i);\n }\n }\n }\n return pointIndices;\n };\n ScatterPlot.prototype.getPointIndicesFromBoundingBoxPickingTexture = function (boundingBox) {\n if (this.worldSpacePointPositions == null) {\n return [];\n }\n var pointCount = this.worldSpacePointPositions.length / 3;\n var dpr = window.devicePixelRatio || 1;\n var x = Math.floor(boundingBox.x * dpr);\n var y = Math.floor(boundingBox.y * dpr);\n var width = Math.max(Math.floor(boundingBox.width * dpr), 1);\n var height = Math.max(Math.floor(boundingBox.height * dpr), 1);\n var pixelBuffer = new Uint8Array(width * height * 4);\n this.renderer.readRenderTargetPixels(this.pickingTexture, x, this.pickingTexture.height - y, width, height, pixelBuffer);\n var pointIndicesSelection = new Uint8Array(this.worldSpacePointPositions.length);\n for (var i = 0; i < width * height; i++) {\n var id = (pixelBuffer[i * 4] << 16) |\n (pixelBuffer[i * 4 + 1] << 8) |\n pixelBuffer[i * 4 + 2];\n if (id !== 0xffffff && id < pointCount) {\n pointIndicesSelection[id] = 1;\n }\n }\n var pointIndices = [];\n for (var i = 0; i < pointIndicesSelection.length; i++) {\n if (pointIndicesSelection[i] === 1) {\n pointIndices.push(i);\n }\n }\n return pointIndices;\n };\n ScatterPlot.prototype.selectBoundingBox = function (boundingBox) {\n var pointIndices = this.getPointIndicesFromBoundingBox(boundingBox);\n this.selectCallback(pointIndices);\n };\n ScatterPlot.prototype.setNearestPointToMouse = function (e) {\n if (this.pickingTexture == null) {\n this.nearestPoint = null;\n return;\n }\n var boundingBox = {\n x: e.offsetX,\n y: e.offsetY,\n width: 1,\n height: 1,\n };\n var pointIndices = this.getPointIndicesFromBoundingBoxPickingTexture(boundingBox);\n this.nearestPoint = pointIndices.length ? pointIndices[0] : null;\n };\n ScatterPlot.prototype.computeLayoutValues = function () {\n this.width = this.container.offsetWidth;\n this.height = Math.max(1, this.container.offsetHeight);\n return [this.width, this.height];\n };\n ScatterPlot.prototype.sceneIs3D = function () {\n return this.dimensions === 3;\n };\n ScatterPlot.prototype.remove3dAxesFromScene = function () {\n var axes = this.scene.getObjectByName('axes');\n if (axes != null) {\n this.scene.remove(axes);\n }\n return axes;\n };\n ScatterPlot.prototype.add3dAxes = function () {\n var axes = new THREE.AxesHelper();\n axes.name = 'axes';\n this.scene.add(axes);\n };\n ScatterPlot.prototype.setDimensions = function (dimensions) {\n if (dimensions !== 2 && dimensions !== 3) {\n throw new RangeError('dimensions must be 2 or 3');\n }\n if (this.dimensions !== dimensions) {\n this.dimensions = dimensions;\n this.makeCamera();\n }\n };\n ScatterPlot.prototype.getCameraPosition = function () {\n var currPos = this.camera.position;\n return [currPos.x, currPos.y, currPos.z];\n };\n ScatterPlot.prototype.getCameraTarget = function () {\n var currTarget = this.orbitCameraControls.target;\n return [currTarget.x, currTarget.y, currTarget.z];\n };\n ScatterPlot.prototype.setCameraPositionAndTarget = function (position, target) {\n this.stopOrbitAnimation();\n this.camera.position.set(position[0], position[1], position[2]);\n this.orbitCameraControls.target.set(target[0], target[1], target[2]);\n this.orbitCameraControls.update();\n this.render();\n };\n ScatterPlot.prototype.startOrbitAnimation = function () {\n if (!this.sceneIs3D()) {\n return;\n }\n if (this.orbitAnimationId != null) {\n this.stopOrbitAnimation();\n }\n this.orbitCameraControls.autoRotate = true;\n this.orbitCameraControls.autoRotateSpeed = this.orbitControlParams.autoRotateSpeed;\n this.updateOrbitAnimation();\n };\n ScatterPlot.prototype.orbitIsAnimating = function () {\n return this.orbitAnimationId != null;\n };\n ScatterPlot.prototype.updateOrbitAnimation = function () {\n var _this = this;\n this.orbitCameraControls.update();\n this.orbitAnimationId = requestAnimationFrame(function () {\n return _this.updateOrbitAnimation();\n });\n };\n ScatterPlot.prototype.stopOrbitAnimation = function () {\n this.orbitCameraControls.autoRotate = false;\n this.orbitCameraControls.rotateSpeed = this.orbitControlParams.mouseRotateSpeed;\n if (this.orbitAnimationId != null) {\n cancelAnimationFrame(this.orbitAnimationId);\n this.orbitAnimationId = null;\n }\n };\n ScatterPlot.prototype.setActiveVisualizers = function (visualizers) {\n var e_1, _a, e_2, _b;\n var nextVisualizerIds = new Set(visualizers.map(function (v) { return v.id; }));\n try {\n for (var _c = __values(this.visualizers.values()), _d = _c.next(); !_d.done; _d = _c.next()) {\n var visualizer = _d.value;\n if (!nextVisualizerIds.has(visualizer.id)) {\n visualizer.dispose();\n this.visualizers.delete(visualizer.id);\n }\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_d && !_d.done && (_a = _c.return)) _a.call(_c);\n }\n finally { if (e_1) throw e_1.error; }\n }\n try {\n for (var visualizers_1 = __values(visualizers), visualizers_1_1 = visualizers_1.next(); !visualizers_1_1.done; visualizers_1_1 = visualizers_1.next()) {\n var visualizer = visualizers_1_1.value;\n this.visualizers.set(visualizer.id, visualizer);\n visualizer.setScene(this.scene);\n visualizer.onResize(this.width, this.height);\n if (this.worldSpacePointPositions) {\n visualizer.onPointPositionsChanged(this.worldSpacePointPositions);\n }\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (visualizers_1_1 && !visualizers_1_1.done && (_b = visualizers_1.return)) _b.call(visualizers_1);\n }\n finally { if (e_2) throw e_2.error; }\n }\n };\n ScatterPlot.prototype.disposeAllVisualizers = function () {\n this.visualizers.forEach(function (v) { return v.dispose(); });\n this.visualizers.clear();\n };\n ScatterPlot.prototype.setPointPositions = function (worldSpacePointPositions) {\n this.worldSpacePointPositions = worldSpacePointPositions;\n this.visualizers.forEach(function (v) {\n return v.onPointPositionsChanged(worldSpacePointPositions);\n });\n };\n ScatterPlot.prototype.render = function () {\n {\n var lightPos = this.camera.position.clone();\n lightPos.x += 1;\n lightPos.y += 1;\n this.light.position.set(lightPos.x, lightPos.y, lightPos.z);\n }\n var cameraType = this.camera instanceof THREE.PerspectiveCamera\n ? render_1.CameraType.Perspective\n : render_1.CameraType.Orthographic;\n var cameraSpacePointExtents = [0, 0];\n if (this.worldSpacePointPositions != null) {\n cameraSpacePointExtents = util.getNearFarPoints(this.worldSpacePointPositions, this.camera.position, this.orbitCameraControls.target);\n }\n var rc = new render_1.RenderContext(this.camera, cameraType, this.orbitCameraControls.target, this.width, this.height, cameraSpacePointExtents[0], cameraSpacePointExtents[1], this.styles.backgroundColor, this.pointColors, this.pointScaleFactors, this.labels, this.polylineColors, this.polylineOpacities, this.polylineWidths);\n this.visualizers.forEach(function (v) { return v.onPickingRender(rc); });\n {\n var axes = this.remove3dAxesFromScene();\n this.renderer.setRenderTarget(this.pickingTexture);\n this.renderer.render(this.scene, this.camera);\n if (axes != null) {\n this.scene.add(axes);\n }\n }\n this.visualizers.forEach(function (v) { return v.onRender(rc); });\n this.renderer.setRenderTarget(null);\n this.renderer.render(this.scene, this.camera);\n };\n ScatterPlot.prototype.setPointColors = function (colors) {\n this.pointColors = colors;\n };\n ScatterPlot.prototype.setPointScaleFactors = function (scaleFactors) {\n this.pointScaleFactors = scaleFactors;\n };\n ScatterPlot.prototype.setLabels = function (labels) {\n this.labels = labels;\n };\n ScatterPlot.prototype.setPolylineColors = function (colors) {\n this.polylineColors = colors;\n };\n ScatterPlot.prototype.setPolylineOpacities = function (opacities) {\n this.polylineOpacities = opacities;\n };\n ScatterPlot.prototype.setPolylineWidths = function (widths) {\n this.polylineWidths = widths;\n };\n ScatterPlot.prototype.resetZoom = function () {\n this.recreateCamera(this.makeDefaultCameraDef(this.dimensions));\n this.render();\n };\n ScatterPlot.prototype.setDayNightMode = function (isNight) {\n var canvases = this.container.querySelectorAll('canvas');\n var filterValue = isNight ? 'invert(100%)' : '';\n for (var i = 0; i < canvases.length; i++) {\n canvases[i].style.filter = filterValue;\n }\n };\n ScatterPlot.prototype.resize = function (render) {\n if (render === void 0) { render = true; }\n var _a = __read([this.width, this.height], 2), oldW = _a[0], oldH = _a[1];\n var _b = __read(this.computeLayoutValues(), 2), newW = _b[0], newH = _b[1];\n if (this.dimensions === 3) {\n var camera = this.camera;\n camera.aspect = newW / newH;\n camera.updateProjectionMatrix();\n }\n else {\n var camera = this.camera;\n var scaleW = newW / oldW;\n var scaleH = newH / oldH;\n var newCamHalfWidth = ((camera.right - camera.left) * scaleW) / 2;\n var newCamHalfHeight = ((camera.top - camera.bottom) * scaleH) / 2;\n camera.top = newCamHalfHeight;\n camera.bottom = -newCamHalfHeight;\n camera.left = -newCamHalfWidth;\n camera.right = newCamHalfWidth;\n camera.updateProjectionMatrix();\n }\n var dpr = window.devicePixelRatio || 1;\n this.renderer.setPixelRatio(dpr);\n this.renderer.setSize(newW, newH);\n {\n var renderCanvasSize = new THREE.Vector2();\n this.renderer.getSize(renderCanvasSize);\n var pixelRatio = this.renderer.getPixelRatio();\n this.pickingTexture = new THREE.WebGLRenderTarget(renderCanvasSize.width * pixelRatio, renderCanvasSize.height * pixelRatio);\n this.pickingTexture.texture.minFilter = THREE.LinearFilter;\n }\n this.visualizers.forEach(function (v) { return v.onResize(newW, newH); });\n if (render) {\n this.render();\n }\n };\n ScatterPlot.prototype.onCameraMove = function (listener) {\n this.onCameraMoveListeners.push(listener);\n };\n ScatterPlot.prototype.clickOnPoint = function (pointIndex) {\n this.nearestPoint = pointIndex;\n this.onClick(null, false);\n };\n return ScatterPlot;\n}());\nexports.ScatterPlot = ScatterPlot;\n","\"use strict\";\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar THREE = require(\"three\");\nvar cache = new Map();\nvar regex = /^(rgba|hsla)\\((\\d+),\\s*(\\d+%?),\\s*(\\d+%?)(?:,\\s*(\\d+(?:\\.\\d+)?))?\\)$/;\nfunction parseOpacity(colorString) {\n var result = regex.exec(colorString);\n if (result) {\n var _a = __read(result, 6), _ = _a[0], rgbaOrHsla = _a[1], rh = _a[2], gs = _a[3], bl = _a[4], opacity = _a[5];\n var colorString_1 = rgbaOrHsla.replace('a', '') + \"(\" + rh + \",\" + gs + \",\" + bl + \")\";\n return { colorString: colorString_1, opacity: parseFloat(opacity) };\n }\n return { colorString: colorString, opacity: 1 };\n}\nfunction parseColor(inputColorString) {\n if (cache.has(inputColorString))\n return cache.get(inputColorString);\n var _a = parseOpacity(inputColorString), colorString = _a.colorString, opacity = _a.opacity;\n var color = new THREE.Color(colorString);\n var r = color.r, g = color.g, b = color.b;\n var item = { r: r, g: g, b: b, opacity: opacity };\n cache.set(inputColorString, item);\n return item;\n}\nexports.parseColor = parseColor;\n","\"use strict\";\nvar __values = (this && this.__values) || function(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar DIMENSIONALITY_ERROR_MESSAGE = 'Points must be an array of either 2 or 3 dimensional number arrays';\nvar Dataset = (function () {\n function Dataset(points, metadata) {\n var e_1, _a;\n if (metadata === void 0) { metadata = []; }\n this.points = points;\n this.metadata = metadata;\n var dimensions = points[0].length;\n if (!(dimensions === 2 || dimensions === 3)) {\n throw new Error(DIMENSIONALITY_ERROR_MESSAGE);\n }\n try {\n for (var points_1 = __values(points), points_1_1 = points_1.next(); !points_1_1.done; points_1_1 = points_1.next()) {\n var point = points_1_1.value;\n if (dimensions !== point.length) {\n throw new Error(DIMENSIONALITY_ERROR_MESSAGE);\n }\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (points_1_1 && !points_1_1.done && (_a = points_1.return)) _a.call(points_1);\n }\n finally { if (e_1) throw e_1.error; }\n }\n this.dimensions = dimensions;\n }\n Dataset.prototype.setSpriteMetadata = function (spriteMetadata) {\n this.spriteMetadata = spriteMetadata;\n };\n return Dataset;\n}());\nexports.Dataset = Dataset;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar makeDefaultStyles = function () {\n var defaultStyles = {\n backgroundColor: '#ffffff',\n axesVisible: true,\n fog: {\n color: '#ffffff',\n enabled: true,\n threshold: 5000,\n },\n label: {\n fontSize: 10,\n scaleDefault: 1,\n scaleLarge: 2,\n fillColorSelected: '#000000',\n fillColorHover: '#000000',\n strokeColorSelected: '#ffffff',\n strokeColorHover: '#ffffff',\n strokeWidth: 3,\n fillWidth: 6,\n },\n label3D: {\n fontSize: 80,\n scale: 2.2,\n color: 'black',\n backgroundColor: '#ffffff',\n colorUnselected: '#ffffff',\n colorNoSelection: '#ffffff',\n },\n point: {\n colorUnselected: 'rgba(227, 227, 227, 0.7)',\n colorNoSelection: 'rgba(117, 117, 217, 0.7)',\n colorSelected: 'rgba(250, 102, 102, 0.7)',\n colorHover: 'rgba(118, 11, 79, 0.7)',\n scaleDefault: 1.0,\n scaleSelected: 1.2,\n scaleHover: 1.2,\n },\n polyline: {\n startHue: 60,\n endHue: 360,\n saturation: 1,\n lightness: 0.3,\n defaultOpacity: 0.2,\n defaultLineWidth: 2,\n selectedOpacity: 0.9,\n selectedLineWidth: 3,\n deselectedOpacity: 0.05,\n },\n select: {\n fill: '#dddddd',\n fillOpacity: 0.2,\n stroke: '#aaaaaa',\n strokeWidth: 2,\n strokeDashArray: '10 5',\n },\n sprites: {\n minPointSize: 5.0,\n imageSize: 30,\n colorUnselected: '#ffffff',\n colorNoSelection: '#ffffff',\n },\n };\n return defaultStyles;\n};\nfunction makeStyles(userStyles) {\n var defaultStyles = makeDefaultStyles();\n if (userStyles === undefined) {\n return defaultStyles;\n }\n for (var key in defaultStyles) {\n var _key = key;\n if (typeof defaultStyles[_key] === 'object' &&\n typeof userStyles[_key] === 'object') {\n defaultStyles[_key] = Object.assign(defaultStyles[_key], userStyles[_key]);\n }\n else if (userStyles[_key] !== undefined) {\n defaultStyles[_key] = userStyles[_key];\n }\n }\n return defaultStyles;\n}\nexports.makeStyles = makeStyles;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.RGB_NUM_ELEMENTS = 3;\nexports.RGBA_NUM_ELEMENTS = 4;\nexports.XYZ_NUM_ELEMENTS = 3;\nexports.UV_NUM_ELEMENTS = 2;\nexports.INDEX_NUM_ELEMENTS = 1;\nexports.SCATTER_PLOT_CUBE_LENGTH = 2;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar THREE = require(\"three\");\nvar util = require(\"./util\");\nvar constants_1 = require(\"./constants\");\nvar MAX_CANVAS_DIMENSION = 8192;\nvar NUM_GLYPHS = 256;\nvar VERTICES_PER_GLYPH = 2 * 3;\nvar makeVertexShader = function (fontSize, scale) { return \"\\n attribute vec2 posObj;\\n attribute vec4 color;\\n varying vec2 vUv;\\n varying vec4 vColor;\\n\\n void main() {\\n vUv = uv;\\n vColor = color;\\n\\n // Rotate label to face camera.\\n\\n vec4 vRight = vec4(\\n modelViewMatrix[0][0], modelViewMatrix[1][0], modelViewMatrix[2][0], 0);\\n\\n vec4 vUp = vec4(\\n modelViewMatrix[0][1], modelViewMatrix[1][1], modelViewMatrix[2][1], 0);\\n\\n vec4 vAt = -vec4(\\n modelViewMatrix[0][2], modelViewMatrix[1][2], modelViewMatrix[2][2], 0);\\n\\n mat4 pointToCamera = mat4(vRight, vUp, vAt, vec4(0, 0, 0, 1));\\n\\n vec2 scaledPos = posObj * \" + 1 / fontSize + \" * \" + scale + \";\\n\\n vec4 posRotated = pointToCamera * vec4(scaledPos, 0, 1);\\n vec4 mvPosition = modelViewMatrix * (vec4(position, 0) + posRotated);\\n gl_Position = projectionMatrix * mvPosition;\\n }\"; };\nvar FRAGMENT_SHADER = \"\\n uniform sampler2D texture;\\n uniform bool picking;\\n varying vec2 vUv;\\n varying vec4 vColor;\\n\\n void main() {\\n if (picking) {\\n gl_FragColor = vColor;\\n } else {\\n vec4 fromTexture = texture2D(texture, vUv);\\n gl_FragColor = vColor * fromTexture;\\n }\\n }\";\nvar ScatterPlotVisualizer3DLabels = (function () {\n function ScatterPlotVisualizer3DLabels(styles) {\n this.styles = styles;\n this.id = '3D_LABELS';\n this.labelStrings = [];\n this.worldSpacePointPositions = new Float32Array(0);\n this.pickingColors = new Float32Array(0);\n this.renderColors = new Float32Array(0);\n this.uniforms = {};\n this.totalVertexCount = 0;\n this.labelVertexMap = [];\n }\n ScatterPlotVisualizer3DLabels.prototype.createGlyphTexture = function () {\n var _a = this.styles.label3D, fontSize = _a.fontSize, backgroundColor = _a.backgroundColor, color = _a.color;\n var canvas = document.createElement('canvas');\n canvas.width = MAX_CANVAS_DIMENSION;\n canvas.height = fontSize;\n var ctx = canvas.getContext('2d');\n ctx.font = 'bold ' + fontSize + 'px roboto';\n ctx.textBaseline = 'top';\n ctx.fillStyle = backgroundColor;\n ctx.rect(0, 0, canvas.width, canvas.height);\n ctx.fill();\n ctx.fillStyle = color;\n var spaceOffset = ctx.measureText(' ').width;\n var glyphLengths = new Float32Array(NUM_GLYPHS);\n var glyphOffset = new Float32Array(NUM_GLYPHS);\n var leftCoord = 0;\n for (var i = 0; i < NUM_GLYPHS; i++) {\n var text = ' ' + String.fromCharCode(i);\n var textLength = ctx.measureText(text).width;\n glyphLengths[i] = textLength - spaceOffset;\n glyphOffset[i] = leftCoord;\n ctx.fillText(text, leftCoord - spaceOffset, 0);\n leftCoord += textLength;\n }\n var tex = util.createTextureFromCanvas(canvas);\n return { texture: tex, lengths: glyphLengths, offsets: glyphOffset };\n };\n ScatterPlotVisualizer3DLabels.prototype.processLabelVerts = function (pointCount) {\n var numTotalLetters = 0;\n this.labelVertexMap = [];\n for (var i = 0; i < pointCount; i++) {\n var label = this.labelStrings[i];\n var vertsArray = [];\n for (var j = 0; j < label.length; j++) {\n for (var k = 0; k < VERTICES_PER_GLYPH; k++) {\n vertsArray.push(numTotalLetters * VERTICES_PER_GLYPH + k);\n }\n numTotalLetters++;\n }\n this.labelVertexMap.push(vertsArray);\n }\n this.totalVertexCount = numTotalLetters * VERTICES_PER_GLYPH;\n };\n ScatterPlotVisualizer3DLabels.prototype.createColorBuffers = function (pointCount) {\n var _this = this;\n this.pickingColors = new Float32Array(this.totalVertexCount * constants_1.RGB_NUM_ELEMENTS);\n this.renderColors = new Float32Array(this.totalVertexCount * constants_1.RGB_NUM_ELEMENTS);\n var _loop_1 = function (i) {\n var pickingColor = new THREE.Color(i);\n this_1.labelVertexMap[i].forEach(function (j) {\n _this.pickingColors[constants_1.RGB_NUM_ELEMENTS * j] = pickingColor.r;\n _this.pickingColors[constants_1.RGB_NUM_ELEMENTS * j + 1] = pickingColor.g;\n _this.pickingColors[constants_1.RGB_NUM_ELEMENTS * j + 2] = pickingColor.b;\n _this.renderColors[constants_1.RGB_NUM_ELEMENTS * j] = 1.0;\n _this.renderColors[constants_1.RGB_NUM_ELEMENTS * j + 1] = 1.0;\n _this.renderColors[constants_1.RGB_NUM_ELEMENTS * j + 2] = 1.0;\n });\n };\n var this_1 = this;\n for (var i = 0; i < pointCount; i++) {\n _loop_1(i);\n }\n };\n ScatterPlotVisualizer3DLabels.prototype.createLabels = function () {\n var _this = this;\n var _a = this.styles.label3D, fontSize = _a.fontSize, scale = _a.scale;\n if (this.labelStrings == null || this.worldSpacePointPositions == null) {\n return;\n }\n var pointCount = this.worldSpacePointPositions.length / constants_1.XYZ_NUM_ELEMENTS;\n if (pointCount !== this.labelStrings.length) {\n return;\n }\n this.glyphTexture = this.createGlyphTexture();\n this.uniforms = {\n texture: { type: 't' },\n picking: { type: 'bool' },\n };\n this.material = new THREE.ShaderMaterial({\n uniforms: this.uniforms,\n transparent: true,\n vertexShader: makeVertexShader(fontSize, scale),\n fragmentShader: FRAGMENT_SHADER,\n });\n this.processLabelVerts(pointCount);\n this.createColorBuffers(pointCount);\n var positionArray = new Float32Array(this.totalVertexCount * constants_1.XYZ_NUM_ELEMENTS);\n this.positions = new THREE.BufferAttribute(positionArray, constants_1.XYZ_NUM_ELEMENTS);\n var posArray = new Float32Array(this.totalVertexCount * constants_1.XYZ_NUM_ELEMENTS);\n var uvArray = new Float32Array(this.totalVertexCount * constants_1.UV_NUM_ELEMENTS);\n var colorsArray = new Float32Array(this.totalVertexCount * constants_1.RGB_NUM_ELEMENTS);\n var positionObject = new THREE.BufferAttribute(posArray, 2);\n var uv = new THREE.BufferAttribute(uvArray, constants_1.UV_NUM_ELEMENTS);\n var colors = new THREE.BufferAttribute(colorsArray, constants_1.RGB_NUM_ELEMENTS);\n this.geometry = new THREE.BufferGeometry();\n this.geometry.setAttribute('posObj', positionObject);\n this.geometry.setAttribute('position', this.positions);\n this.geometry.setAttribute('uv', uv);\n this.geometry.setAttribute('color', colors);\n var lettersSoFar = 0;\n for (var i = 0; i < pointCount; i++) {\n var label = this.labelStrings[i];\n var leftOffset = 0;\n for (var j = 0; j < label.length; j++) {\n var letterCode = label.charCodeAt(j);\n leftOffset += this.glyphTexture.lengths[letterCode];\n }\n leftOffset /= -2;\n for (var j = 0; j < label.length; j++) {\n var letterCode = label.charCodeAt(j);\n var letterWidth = this.glyphTexture.lengths[letterCode];\n var scale_1 = fontSize;\n var right = (leftOffset + letterWidth) / scale_1;\n var left = leftOffset / scale_1;\n var top_1 = fontSize / scale_1;\n positionObject.setXY(lettersSoFar * VERTICES_PER_GLYPH + 0, left, 0);\n positionObject.setXY(lettersSoFar * VERTICES_PER_GLYPH + 1, right, 0);\n positionObject.setXY(lettersSoFar * VERTICES_PER_GLYPH + 2, left, top_1);\n positionObject.setXY(lettersSoFar * VERTICES_PER_GLYPH + 3, left, top_1);\n positionObject.setXY(lettersSoFar * VERTICES_PER_GLYPH + 4, right, 0);\n positionObject.setXY(lettersSoFar * VERTICES_PER_GLYPH + 5, right, top_1);\n var uLeft = this.glyphTexture.offsets[letterCode];\n var uRight = this.glyphTexture.offsets[letterCode] + letterWidth;\n uLeft /= MAX_CANVAS_DIMENSION;\n uRight /= MAX_CANVAS_DIMENSION;\n var vTop = 1;\n var vBottom = 0;\n uv.setXY(lettersSoFar * VERTICES_PER_GLYPH + 0, uLeft, vTop);\n uv.setXY(lettersSoFar * VERTICES_PER_GLYPH + 1, uRight, vTop);\n uv.setXY(lettersSoFar * VERTICES_PER_GLYPH + 2, uLeft, vBottom);\n uv.setXY(lettersSoFar * VERTICES_PER_GLYPH + 3, uLeft, vBottom);\n uv.setXY(lettersSoFar * VERTICES_PER_GLYPH + 4, uRight, vTop);\n uv.setXY(lettersSoFar * VERTICES_PER_GLYPH + 5, uRight, vBottom);\n lettersSoFar++;\n leftOffset += letterWidth;\n }\n }\n var _loop_2 = function (i) {\n var p = util.vector3FromPackedArray(this_2.worldSpacePointPositions, i);\n this_2.labelVertexMap[i].forEach(function (j) {\n _this.positions.setXYZ(j, p.x, p.y, p.z);\n });\n };\n var this_2 = this;\n for (var i = 0; i < pointCount; i++) {\n _loop_2(i);\n }\n this.labelsMesh = new THREE.Mesh(this.geometry, this.material);\n this.labelsMesh.frustumCulled = false;\n this.scene.add(this.labelsMesh);\n };\n ScatterPlotVisualizer3DLabels.prototype.colorLabels = function (pointColors) {\n if (this.labelStrings == null ||\n this.geometry == null ||\n pointColors == null) {\n return;\n }\n var colors = this.geometry.getAttribute('color');\n colors.array = this.renderColors;\n var n = pointColors.length / constants_1.RGBA_NUM_ELEMENTS;\n var src = 0;\n for (var i = 0; i < n; ++i) {\n var c = new THREE.Color(pointColors[src], pointColors[src + 1], pointColors[src + 2]);\n var m = this.labelVertexMap[i].length;\n for (var j = 0; j < m; ++j) {\n colors.setXYZ(this.labelVertexMap[i][j], c.r, c.g, c.b);\n }\n src += constants_1.RGBA_NUM_ELEMENTS;\n }\n colors.needsUpdate = true;\n };\n ScatterPlotVisualizer3DLabels.prototype.setScene = function (scene) {\n this.scene = scene;\n };\n ScatterPlotVisualizer3DLabels.prototype.dispose = function () {\n if (this.labelsMesh) {\n if (this.scene) {\n this.scene.remove(this.labelsMesh);\n }\n this.labelsMesh = null;\n }\n if (this.geometry) {\n this.geometry.dispose();\n this.geometry = null;\n }\n if (this.glyphTexture != null && this.glyphTexture.texture != null) {\n this.glyphTexture.texture.dispose();\n this.glyphTexture.texture = null;\n }\n };\n ScatterPlotVisualizer3DLabels.prototype.onPickingRender = function (rc) {\n if (this.geometry == null) {\n this.createLabels();\n return;\n }\n this.material.uniforms.texture.value = this.glyphTexture.texture;\n this.material.uniforms.picking.value = true;\n var colors = this.geometry.getAttribute('color');\n colors.array = this.pickingColors;\n colors.needsUpdate = true;\n };\n ScatterPlotVisualizer3DLabels.prototype.onRender = function (rc) {\n if (this.geometry == null) {\n this.createLabels();\n return;\n }\n this.colorLabels(rc.pointColors);\n this.material.uniforms.texture.value = this.glyphTexture.texture;\n this.material.uniforms.picking.value = false;\n var colors = this.geometry.getAttribute('color');\n colors.array = this.renderColors;\n colors.needsUpdate = true;\n };\n ScatterPlotVisualizer3DLabels.prototype.onPointPositionsChanged = function (newPositions) {\n this.worldSpacePointPositions = newPositions;\n this.dispose();\n };\n ScatterPlotVisualizer3DLabels.prototype.setLabelStrings = function (labelStrings) {\n this.labelStrings = labelStrings;\n this.dispose();\n };\n ScatterPlotVisualizer3DLabels.prototype.onResize = function (newWidth, newHeight) { };\n return ScatterPlotVisualizer3DLabels;\n}());\nexports.ScatterPlotVisualizer3DLabels = ScatterPlotVisualizer3DLabels;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar THREE = require(\"three\");\nvar render_1 = require(\"./render\");\nvar util = require(\"./util\");\nvar constants_1 = require(\"./constants\");\nvar makeVertexShader = function (minPointSize) { return \"\\n // Index of the specific vertex (passed in as bufferAttribute), and the\\n // variable that will be used to pass it to the fragment shader.\\n attribute float spriteIndex;\\n attribute vec4 color;\\n attribute float scaleFactor;\\n\\n varying vec2 xyIndex;\\n varying vec4 vColor;\\n\\n uniform bool sizeAttenuation;\\n uniform float pointSize;\\n uniform float spritesPerRow;\\n uniform float spritesPerColumn;\\n\\n varying float fogDepth;\\n\\n void main() {\\n // Pass index and color values to fragment shader.\\n vColor = color;\\n xyIndex = vec2(mod(spriteIndex, spritesPerRow),\\n floor(spriteIndex / spritesPerColumn));\\n\\n // Transform current vertex by modelViewMatrix (model world position and\\n // camera world position matrix).\\n vec4 cameraSpacePos = modelViewMatrix * vec4(position, 1.0);\\n\\n // Project vertex in camera-space to screen coordinates using the camera's\\n // projection matrix.\\n gl_Position = projectionMatrix * cameraSpacePos;\\n\\n // Create size attenuation (if we're in 3D mode) by making the size of\\n // each point inversly proportional to its distance to the camera.\\n float outputPointSize = pointSize;\\n if (sizeAttenuation) {\\n outputPointSize = -pointSize / cameraSpacePos.z;\\n fogDepth = pointSize / outputPointSize * 1.2;\\n } else { // Create size attenuation (if we're in 2D mode)\\n const float PI = 3.1415926535897932384626433832795;\\n const float minScale = 0.1; // minimum scaling factor\\n const float outSpeed = 2.0; // shrink speed when zooming out\\n const float outNorm = (1. - minScale) / atan(outSpeed);\\n const float maxScale = 15.0; // maximum scaling factor\\n const float inSpeed = 0.02; // enlarge speed when zooming in\\n const float zoomOffset = 0.3; // offset zoom pivot\\n float zoom = projectionMatrix[0][0] + zoomOffset; // zoom pivot\\n float scale = zoom < 1. ? 1. + outNorm * atan(outSpeed * (zoom - 1.)) :\\n 1. + 2. / PI * (maxScale - 1.) * atan(inSpeed * (zoom - 1.));\\n outputPointSize = pointSize * scale;\\n }\\n\\n gl_PointSize =\\n max(outputPointSize * scaleFactor, \" + minPointSize.toFixed(1) + \");\\n }\"; };\nvar FRAGMENT_SHADER_POINT_TEST_CHUNK = \"\\n bool point_in_unit_circle(vec2 spriteCoord) {\\n vec2 centerToP = spriteCoord - vec2(0.5, 0.5);\\n return dot(centerToP, centerToP) < (0.5 * 0.5);\\n }\\n\\n bool point_in_unit_equilateral_triangle(vec2 spriteCoord) {\\n vec3 v0 = vec3(0, 1, 0);\\n vec3 v1 = vec3(0.5, 0, 0);\\n vec3 v2 = vec3(1, 1, 0);\\n vec3 p = vec3(spriteCoord, 0);\\n float p_in_v0_v1 = cross(v1 - v0, p - v0).z;\\n float p_in_v1_v2 = cross(v2 - v1, p - v1).z;\\n return (p_in_v0_v1 > 0.0) && (p_in_v1_v2 > 0.0);\\n }\\n\\n bool point_in_unit_square(vec2 spriteCoord) {\\n return true;\\n }\\n \";\nvar FRAGMENT_SHADER = \"\\n varying vec2 xyIndex;\\n varying vec4 vColor;\\n\\n uniform sampler2D texture;\\n uniform float spritesPerRow;\\n uniform float spritesPerColumn;\\n uniform bool isImage;\\n\\n \" + THREE.ShaderChunk['common'] + \"\\n \" + FRAGMENT_SHADER_POINT_TEST_CHUNK + \"\\n uniform vec3 fogColor;\\n varying float fogDepth;\\n\\t\\tuniform float fogNear;\\n uniform float fogFar;\\n\\n void main() {\\n if (isImage) {\\n // Coordinates of the vertex within the entire sprite image.\\n vec2 coords =\\n (gl_PointCoord + xyIndex) / vec2(spritesPerRow, spritesPerColumn);\\n gl_FragColor = vColor * texture2D(texture, coords);\\n } else {\\n bool inside = point_in_unit_circle(gl_PointCoord);\\n if (!inside) {\\n discard;\\n }\\n gl_FragColor = vColor;\\n }\\n float fogFactor = smoothstep( fogNear, fogFar, fogDepth );\\n gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\\n }\";\nvar FRAGMENT_SHADER_PICKING = \"\\n varying vec2 xyIndex;\\n varying vec4 vColor;\\n uniform bool isImage;\\n\\n \" + FRAGMENT_SHADER_POINT_TEST_CHUNK + \"\\n\\n varying float fogDepth;\\n\\n void main() {\\n xyIndex; // Silence 'unused variable' warning.\\n fogDepth; // Silence 'unused variable' warning.\\n if (isImage) {\\n gl_FragColor = vColor;\\n } else {\\n bool inside = point_in_unit_circle(gl_PointCoord);\\n if (!inside) {\\n discard;\\n }\\n gl_FragColor = vColor;\\n }\\n }\";\nvar ScatterPlotVisualizerSprites = (function () {\n function ScatterPlotVisualizerSprites(styles, spriteSheetParams) {\n this.styles = styles;\n this.id = 'SPRITES';\n this.isSpriteSheetMode = false;\n this.spritesPerRow = 0;\n this.spritesPerColumn = 0;\n this.spriteDimensions = [0, 0];\n this.worldSpacePointPositions = new Float32Array(0);\n this.pickingColors = new Float32Array(0);\n this.renderColors = new Float32Array(0);\n this.standinTextureForPoints = util.createTextureFromCanvas(document.createElement('canvas'));\n if (spriteSheetParams) {\n this.spriteSheetParams = spriteSheetParams;\n this.setSpriteSheet(spriteSheetParams);\n this.isSpriteSheetMode = true;\n }\n this.renderMaterial = this.createRenderMaterial();\n this.pickingMaterial = this.createPickingMaterial();\n }\n ScatterPlotVisualizerSprites.prototype.createUniforms = function () {\n return {\n texture: { type: 't' },\n spritesPerRow: { type: 'f' },\n spritesPerColumn: { type: 'f' },\n fogColor: { type: 'c' },\n fogNear: { type: 'f' },\n fogFar: { type: 'f' },\n isImage: { type: 'bool' },\n sizeAttenuation: { type: 'bool' },\n pointSize: { type: 'f' },\n };\n };\n ScatterPlotVisualizerSprites.prototype.createRenderMaterial = function () {\n var isSpriteSheetMode = this.isSpriteSheetMode;\n var uniforms = this.createUniforms();\n return new THREE.ShaderMaterial({\n uniforms: uniforms,\n vertexShader: makeVertexShader(this.styles.sprites.minPointSize),\n fragmentShader: FRAGMENT_SHADER,\n transparent: true,\n depthFunc: THREE.LessDepth,\n fog: this.styles.fog.enabled,\n blending: THREE.NormalBlending,\n });\n };\n ScatterPlotVisualizerSprites.prototype.createPickingMaterial = function () {\n var uniforms = this.createUniforms();\n return new THREE.ShaderMaterial({\n uniforms: uniforms,\n vertexShader: makeVertexShader(this.styles.sprites.minPointSize),\n fragmentShader: FRAGMENT_SHADER_PICKING,\n transparent: true,\n depthTest: true,\n depthWrite: true,\n fog: false,\n blending: THREE.NormalBlending,\n });\n };\n ScatterPlotVisualizerSprites.prototype.createPointSprites = function (scene, positions) {\n var pointCount = positions != null ? positions.length / constants_1.XYZ_NUM_ELEMENTS : 0;\n var geometry = this.createGeometry(pointCount);\n this.fog = new THREE.Fog(0xffffff);\n this.points = new THREE.Points(geometry, this.renderMaterial);\n this.points.frustumCulled = false;\n if (this.spriteIndexBufferAttribute != null) {\n this.points.geometry.setAttribute('spriteIndex', this.spriteIndexBufferAttribute);\n }\n scene.add(this.points);\n };\n ScatterPlotVisualizerSprites.prototype.calculatePointSize = function (sceneIs3D) {\n var imageSize = this.styles.sprites.imageSize;\n if (this.texture) {\n return sceneIs3D ? imageSize : this.spriteDimensions[0];\n }\n var n = this.worldSpacePointPositions != null\n ? this.worldSpacePointPositions.length / constants_1.XYZ_NUM_ELEMENTS\n : 1;\n var SCALE = 200;\n var LOG_BASE = 8;\n var DIVISOR = 1.5;\n var pointSize = SCALE / Math.log(n) / Math.log(LOG_BASE);\n return sceneIs3D ? pointSize : pointSize / DIVISOR;\n };\n ScatterPlotVisualizerSprites.prototype.createGeometry = function (pointCount) {\n var n = pointCount;\n this.pickingColors = new Float32Array(n * constants_1.RGBA_NUM_ELEMENTS);\n {\n var dst = 0;\n for (var i = 0; i < n; i++) {\n var c = new THREE.Color(i);\n this.pickingColors[dst++] = c.r;\n this.pickingColors[dst++] = c.g;\n this.pickingColors[dst++] = c.b;\n this.pickingColors[dst++] = 1;\n }\n }\n var geometry = new THREE.BufferGeometry();\n geometry.setAttribute('position', new THREE.BufferAttribute(new Float32Array([]), constants_1.XYZ_NUM_ELEMENTS));\n geometry.setAttribute('color', new THREE.BufferAttribute(new Float32Array([]), constants_1.RGBA_NUM_ELEMENTS));\n geometry.setAttribute('scaleFactor', new THREE.BufferAttribute(new Float32Array([]), constants_1.INDEX_NUM_ELEMENTS));\n geometry.computeVertexNormals();\n return geometry;\n };\n ScatterPlotVisualizerSprites.prototype.setFogDistances = function (sceneIs3D, nearestPointZ, farthestPointZ) {\n var _a = this.styles.fog, threshold = _a.threshold, enabled = _a.enabled;\n if (sceneIs3D && enabled) {\n var n = this.worldSpacePointPositions.length / constants_1.XYZ_NUM_ELEMENTS;\n this.fog.near = nearestPointZ;\n var multiplier = 2 - Math.min(n, threshold) / threshold;\n this.fog.far = farthestPointZ * multiplier;\n }\n else {\n this.fog.near = Infinity;\n this.fog.far = Infinity;\n }\n };\n ScatterPlotVisualizerSprites.prototype.dispose = function () {\n this.disposeGeometry();\n this.disposeSpriteSheet();\n };\n ScatterPlotVisualizerSprites.prototype.disposeGeometry = function () {\n if (this.points != null) {\n this.scene.remove(this.points);\n this.points.geometry.dispose();\n this.points = null;\n this.worldSpacePointPositions = null;\n }\n };\n ScatterPlotVisualizerSprites.prototype.disposeSpriteSheet = function () {\n if (this.texture) {\n this.texture.dispose();\n }\n this.texture = null;\n this.renderMaterial = null;\n this.pickingMaterial = null;\n this.spriteSheetImage = null;\n };\n ScatterPlotVisualizerSprites.prototype.setScene = function (scene) {\n this.scene = scene;\n };\n ScatterPlotVisualizerSprites.prototype.setSpriteSheet = function (spriteSheetParams) {\n var _this = this;\n var spriteDimensions = spriteSheetParams.spriteDimensions, spriteIndices = spriteSheetParams.spriteIndices, onImageLoad = spriteSheetParams.onImageLoad;\n var spriteSheet = spriteSheetParams.spritesheetImage;\n if (typeof spriteSheet === 'string') {\n var spriteSheetUrl = spriteSheet;\n spriteSheet = new Image();\n spriteSheet.src = spriteSheetUrl;\n }\n this.spriteSheetImage = spriteSheet;\n this.texture = util.createTextureFromImage(this.spriteSheetImage, function () {\n _this.spritesPerRow = _this.spriteSheetImage.width / spriteDimensions[0];\n _this.spritesPerColumn =\n _this.spriteSheetImage.height / spriteDimensions[1];\n onImageLoad();\n });\n this.spriteDimensions = spriteDimensions;\n this.spriteIndexBufferAttribute = new THREE.BufferAttribute(spriteIndices, constants_1.INDEX_NUM_ELEMENTS);\n if (this.points != null) {\n this.points.geometry.setAttribute('spriteIndex', this.spriteIndexBufferAttribute);\n }\n };\n ScatterPlotVisualizerSprites.prototype.onPointPositionsChanged = function (newPositions) {\n if (this.points != null) {\n if (this.worldSpacePointPositions.length !== newPositions.length) {\n this.disposeGeometry();\n }\n }\n this.worldSpacePointPositions = newPositions;\n if (this.points == null) {\n this.createPointSprites(this.scene, newPositions);\n }\n if (this.spriteSheetParams) {\n this.setSpriteSheet(this.spriteSheetParams);\n }\n this.renderMaterial = this.createRenderMaterial();\n this.pickingMaterial = this.createPickingMaterial();\n var positions = this.points\n .geometry.getAttribute('position');\n positions.array = newPositions;\n positions.count = newPositions.length / constants_1.XYZ_NUM_ELEMENTS;\n positions.needsUpdate = true;\n };\n ScatterPlotVisualizerSprites.prototype.onPickingRender = function (rc) {\n var sceneIs3D = rc.cameraType === render_1.CameraType.Perspective;\n this.pickingMaterial.uniforms.spritesPerRow.value = this.spritesPerRow;\n this.pickingMaterial.uniforms.spritesPerRow.value = this.spritesPerColumn;\n this.pickingMaterial.uniforms.sizeAttenuation.value = sceneIs3D;\n this.pickingMaterial.uniforms.pointSize.value = this.calculatePointSize(sceneIs3D);\n this.points.material = this.pickingMaterial;\n var colors = this.points.geometry.getAttribute('color');\n colors.array = this.pickingColors;\n colors.count = this.pickingColors.length / constants_1.RGBA_NUM_ELEMENTS;\n colors.needsUpdate = true;\n var scaleFactors = this.points\n .geometry.getAttribute('scaleFactor');\n scaleFactors.array = rc.pointScaleFactors;\n scaleFactors.count = rc.pointScaleFactors.length;\n scaleFactors.count = rc.pointScaleFactors.length / constants_1.INDEX_NUM_ELEMENTS;\n scaleFactors.needsUpdate = true;\n };\n ScatterPlotVisualizerSprites.prototype.onRender = function (rc) {\n var sceneIs3D = rc.camera instanceof THREE.PerspectiveCamera;\n this.setFogDistances(sceneIs3D, rc.nearestCameraSpacePointZ, rc.farthestCameraSpacePointZ);\n this.scene.fog = this.fog;\n this.scene.fog.color = new THREE.Color(rc.backgroundColor);\n this.renderMaterial.uniforms.fogColor.value = this.scene.fog.color;\n this.renderMaterial.uniforms.fogNear.value = this.fog.near;\n this.renderMaterial.uniforms.fogFar.value = this.fog.far;\n this.renderMaterial.uniforms.spritesPerRow.value = this.spritesPerRow;\n this.renderMaterial.uniforms.spritesPerColumn.value = this.spritesPerColumn;\n this.renderMaterial.uniforms.isImage.value = this.texture != null;\n this.renderMaterial.uniforms.texture.value =\n this.texture != null ? this.texture : this.standinTextureForPoints;\n this.renderMaterial.uniforms.sizeAttenuation.value = sceneIs3D;\n this.renderMaterial.uniforms.pointSize.value = this.calculatePointSize(sceneIs3D);\n this.points.material = this.renderMaterial;\n var colors = this.points.geometry.getAttribute('color');\n this.renderColors = rc.pointColors;\n colors.array = this.renderColors;\n colors.count = this.renderColors.length / constants_1.RGBA_NUM_ELEMENTS;\n colors.needsUpdate = true;\n var scaleFactors = this.points\n .geometry.getAttribute('scaleFactor');\n scaleFactors.array = rc.pointScaleFactors;\n scaleFactors.count = rc.pointScaleFactors.length / constants_1.INDEX_NUM_ELEMENTS;\n scaleFactors.needsUpdate = true;\n };\n ScatterPlotVisualizerSprites.prototype.onResize = function (newWidth, newHeight) { };\n return ScatterPlotVisualizerSprites;\n}());\nexports.ScatterPlotVisualizerSprites = ScatterPlotVisualizerSprites;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar CollisionGrid = (function () {\n function CollisionGrid(bound, cellWidth, cellHeight) {\n this.bound = bound;\n this.cellWidth = cellWidth;\n this.cellHeight = cellHeight;\n this.numHorizCells = Math.ceil(this.boundWidth(bound) / cellWidth);\n this.numVertCells = Math.ceil(this.boundHeight(bound) / cellHeight);\n this.grid = new Array(this.numHorizCells * this.numVertCells);\n }\n CollisionGrid.prototype.boundWidth = function (bound) {\n return bound.hiX - bound.loX;\n };\n CollisionGrid.prototype.boundHeight = function (bound) {\n return bound.hiY - bound.loY;\n };\n CollisionGrid.prototype.boundsIntersect = function (a, b) {\n return !(a.loX > b.hiX || a.loY > b.hiY || a.hiX < b.loX || a.hiY < b.loY);\n };\n CollisionGrid.prototype.insert = function (bound, justTest) {\n if (justTest === void 0) { justTest = false; }\n if (bound.hiX < this.bound.loX ||\n bound.loX > this.bound.hiX ||\n bound.hiY < this.bound.loY ||\n bound.loY > this.bound.hiY) {\n return false;\n }\n var minCellX = this.getCellX(bound.loX);\n var maxCellX = this.getCellX(bound.hiX);\n var minCellY = this.getCellY(bound.loY);\n var maxCellY = this.getCellY(bound.hiY);\n var baseIdx = minCellY * this.numHorizCells + minCellX;\n var idx = baseIdx;\n for (var j = minCellY; j <= maxCellY; j++) {\n for (var i = minCellX; i <= maxCellX; i++) {\n var cell = this.grid[idx++];\n if (cell) {\n for (var k = 0; k < cell.length; k++) {\n if (this.boundsIntersect(bound, cell[k])) {\n return false;\n }\n }\n }\n }\n idx += this.numHorizCells - (maxCellX - minCellX + 1);\n }\n if (justTest) {\n return true;\n }\n idx = baseIdx;\n for (var j = minCellY; j <= maxCellY; j++) {\n for (var i = minCellX; i <= maxCellX; i++) {\n if (!this.grid[idx]) {\n this.grid[idx] = [bound];\n }\n else {\n this.grid[idx].push(bound);\n }\n idx++;\n }\n idx += this.numHorizCells - (maxCellX - minCellX + 1);\n }\n return true;\n };\n CollisionGrid.prototype.getCellX = function (x) {\n return Math.floor((x - this.bound.loX) / this.cellWidth);\n };\n CollisionGrid.prototype.getCellY = function (y) {\n return Math.floor((y - this.bound.loY) / this.cellHeight);\n };\n return CollisionGrid;\n}());\nexports.CollisionGrid = CollisionGrid;\n","\"use strict\";\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar THREE = require(\"three\");\nvar render_1 = require(\"./render\");\nvar label_1 = require(\"./label\");\nvar util = require(\"./util\");\nvar MAX_LABELS_ON_SCREEN = 10000;\nvar ScatterPlotVisualizerCanvasLabels = (function () {\n function ScatterPlotVisualizerCanvasLabels(container, styles) {\n this.styles = styles;\n this.id = 'CANVAS_LABELS';\n this.worldSpacePointPositions = new Float32Array(0);\n this.labelsActive = true;\n this.canvas = document.createElement('canvas');\n container.appendChild(this.canvas);\n this.gc = this.canvas.getContext('2d');\n this.canvas.style.position = 'absolute';\n this.canvas.style.left = '0';\n this.canvas.style.top = '0';\n this.canvas.style.pointerEvents = 'none';\n }\n ScatterPlotVisualizerCanvasLabels.prototype.removeAllLabels = function () {\n var pixelWidth = this.canvas.width * window.devicePixelRatio;\n var pixelHeight = this.canvas.height * window.devicePixelRatio;\n this.gc.clearRect(0, 0, pixelWidth, pixelHeight);\n };\n ScatterPlotVisualizerCanvasLabels.prototype.makeLabels = function (rc) {\n if (rc.labels == null || rc.labels.pointIndices.length === 0) {\n return;\n }\n if (this.worldSpacePointPositions == null) {\n return;\n }\n var lrc = rc.labels;\n var sceneIs3D = rc.cameraType === render_1.CameraType.Perspective;\n var labelHeight = parseInt(this.gc.font, 10);\n var dpr = window.devicePixelRatio;\n var grid;\n {\n var pixw = this.canvas.width * dpr;\n var pixh = this.canvas.height * dpr;\n var bb = { loX: 0, hiX: pixw, loY: 0, hiY: pixh };\n grid = new label_1.CollisionGrid(bb, pixw / 25, pixh / 50);\n }\n var cameraDomain = [\n rc.farthestCameraSpacePointZ,\n rc.nearestCameraSpacePointZ,\n ];\n var opacityMap = function (x) {\n return util.scaleExponential(x, cameraDomain, [0.1, 1]);\n };\n var camPos = rc.camera.position;\n var camToTarget = camPos.clone().sub(rc.cameraTarget);\n var camToPoint = new THREE.Vector3();\n this.gc.textBaseline = 'middle';\n this.gc.miterLimit = 2;\n var labelMargin = 2;\n var xShift = 4;\n var n = Math.min(MAX_LABELS_ON_SCREEN, lrc.pointIndices.length);\n for (var i = 0; i < n; ++i) {\n var point = void 0;\n {\n var pi = lrc.pointIndices[i];\n point = util.vector3FromPackedArray(this.worldSpacePointPositions, pi);\n }\n camToPoint.copy(camPos).sub(point);\n if (camToTarget.dot(camToPoint) < 0) {\n continue;\n }\n var _a = __read(util.vector3DToScreenCoords(rc.camera, rc.screenWidth, rc.screenHeight, point), 2), x = _a[0], y = _a[1];\n x += xShift;\n var textBoundingBox = {\n loX: x - labelMargin,\n hiX: x + 1 + labelMargin,\n loY: y - labelHeight / 2 - labelMargin,\n hiY: y + labelHeight / 2 + labelMargin,\n };\n if (grid.insert(textBoundingBox, true)) {\n var text = lrc.labelStrings[i];\n var fontSize = lrc.defaultFontSize * lrc.scaleFactors[i] * dpr;\n this.gc.font = fontSize + 'px roboto';\n textBoundingBox.hiX += this.gc.measureText(text).width - 1;\n if (grid.insert(textBoundingBox)) {\n var opacity = 1;\n if (sceneIs3D && lrc.useSceneOpacityFlags[i] === 1) {\n opacity = opacityMap(camToPoint.length());\n }\n this.gc.fillStyle = this.styleStringFromPackedRgba(lrc.fillColors, i, opacity);\n this.gc.strokeStyle = this.styleStringFromPackedRgba(lrc.strokeColors, i, opacity);\n this.gc.lineWidth = this.styles.label.strokeWidth;\n this.gc.strokeText(text, x, y);\n this.gc.lineWidth = this.styles.label.fillWidth;\n this.gc.fillText(text, x, y);\n }\n }\n }\n };\n ScatterPlotVisualizerCanvasLabels.prototype.styleStringFromPackedRgba = function (packedRgbaArray, colorIndex, opacity) {\n var offset = colorIndex * 3;\n var r = packedRgbaArray[offset];\n var g = packedRgbaArray[offset + 1];\n var b = packedRgbaArray[offset + 2];\n return 'rgba(' + r + ',' + g + ',' + b + ',' + opacity + ')';\n };\n ScatterPlotVisualizerCanvasLabels.prototype.onResize = function (newWidth, newHeight) {\n var dpr = window.devicePixelRatio;\n this.canvas.width = newWidth * dpr;\n this.canvas.height = newHeight * dpr;\n this.canvas.style.width = newWidth + 'px';\n this.canvas.style.height = newHeight + 'px';\n };\n ScatterPlotVisualizerCanvasLabels.prototype.dispose = function () {\n this.removeAllLabels();\n };\n ScatterPlotVisualizerCanvasLabels.prototype.onPointPositionsChanged = function (newPositions) {\n this.worldSpacePointPositions = newPositions;\n this.removeAllLabels();\n };\n ScatterPlotVisualizerCanvasLabels.prototype.onRender = function (rc) {\n if (!this.labelsActive) {\n return;\n }\n this.removeAllLabels();\n this.makeLabels(rc);\n };\n ScatterPlotVisualizerCanvasLabels.prototype.setScene = function (scene) { };\n ScatterPlotVisualizerCanvasLabels.prototype.onPickingRender = function (renderContext) { };\n return ScatterPlotVisualizerCanvasLabels;\n}());\nexports.ScatterPlotVisualizerCanvasLabels = ScatterPlotVisualizerCanvasLabels;\n","\"use strict\";\nvar __values = (this && this.__values) || function(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar THREE = require(\"three\");\nvar util = require(\"./util\");\nvar constants_1 = require(\"./constants\");\nvar ScatterPlotVisualizerPolylines = (function () {\n function ScatterPlotVisualizerPolylines() {\n this.id = 'POLYLINES';\n this.sequences = [];\n this.polylines = [];\n this.polylinePositionBuffer = {};\n this.polylineColorBuffer = {};\n this.pointSequenceIndices = new Map();\n }\n ScatterPlotVisualizerPolylines.prototype.getPointSequenceIndex = function (pointIndex) {\n return this.pointSequenceIndices.get(pointIndex);\n };\n ScatterPlotVisualizerPolylines.prototype.updateSequenceIndices = function () {\n for (var i = 0; i < this.sequences.length; i++) {\n var sequence = this.sequences[i];\n for (var j = 0; j < sequence.indices.length - 1; j++) {\n var pointIndex = sequence.indices[j];\n this.pointSequenceIndices.set(pointIndex, i);\n this.pointSequenceIndices.set(pointIndex + 1, i);\n }\n }\n };\n ScatterPlotVisualizerPolylines.prototype.createPolylines = function () {\n var e_1, _a;\n this.updateSequenceIndices();\n try {\n for (var _b = __values(this.polylines), _c = _b.next(); !_c.done; _c = _b.next()) {\n var polyline = _c.value;\n this.scene.remove(polyline);\n polyline.geometry.dispose();\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_1) throw e_1.error; }\n }\n this.polylines = [];\n for (var i = 0; i < this.sequences.length; i++) {\n var geometry = new THREE.BufferGeometry();\n geometry.addAttribute('position', this.polylinePositionBuffer[i]);\n geometry.addAttribute('color', this.polylineColorBuffer[i]);\n var material = new THREE.LineBasicMaterial({\n linewidth: 1,\n opacity: 1.0,\n transparent: true,\n vertexColors: THREE.VertexColors,\n });\n var polyline = new THREE.LineSegments(geometry, material);\n polyline.frustumCulled = false;\n this.polylines.push(polyline);\n this.scene.add(polyline);\n }\n };\n ScatterPlotVisualizerPolylines.prototype.dispose = function () {\n var e_2, _a;\n try {\n for (var _b = __values(this.polylines), _c = _b.next(); !_c.done; _c = _b.next()) {\n var polyline = _c.value;\n this.scene.remove(polyline);\n polyline.geometry.dispose();\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_2) throw e_2.error; }\n }\n this.polylines = [];\n this.polylinePositionBuffer = {};\n this.polylineColorBuffer = {};\n };\n ScatterPlotVisualizerPolylines.prototype.setScene = function (scene) {\n this.scene = scene;\n };\n ScatterPlotVisualizerPolylines.prototype.setSequences = function (sequences) {\n this.sequences = sequences;\n };\n ScatterPlotVisualizerPolylines.prototype.onPointPositionsChanged = function (newPositions) {\n if (newPositions == null)\n this.dispose();\n if (newPositions == null || this.sequences.length === 0) {\n return;\n }\n for (var i = 0; i < this.sequences.length; i++) {\n var sequence = this.sequences[i];\n var vertexCount = 2 * (sequence.indices.length - 1);\n var polylines = new Float32Array(vertexCount * constants_1.XYZ_NUM_ELEMENTS);\n this.polylinePositionBuffer[i] = new THREE.BufferAttribute(polylines, constants_1.XYZ_NUM_ELEMENTS);\n var colors = new Float32Array(vertexCount * constants_1.RGBA_NUM_ELEMENTS);\n this.polylineColorBuffer[i] = new THREE.BufferAttribute(colors, constants_1.RGBA_NUM_ELEMENTS);\n }\n for (var i = 0; i < this.sequences.length; i++) {\n var sequence = this.sequences[i];\n var src = 0;\n for (var j = 0; j < sequence.indices.length - 1; j++) {\n var p1Index = sequence.indices[j];\n var p2Index = sequence.indices[j + 1];\n var p1 = util.vector3FromPackedArray(newPositions, p1Index);\n var p2 = util.vector3FromPackedArray(newPositions, p2Index);\n this.polylinePositionBuffer[i].setXYZ(src, p1.x, p1.y, p1.z);\n this.polylinePositionBuffer[i].setXYZ(src + 1, p2.x, p2.y, p2.z);\n src += 2;\n }\n this.polylinePositionBuffer[i].needsUpdate = true;\n }\n this.createPolylines();\n };\n ScatterPlotVisualizerPolylines.prototype.onRender = function (renderContext) {\n for (var i = 0; i < this.polylines.length; i++) {\n var material = this.polylines[i].material;\n material.opacity = renderContext.polylineOpacities[i];\n material.linewidth = renderContext.polylineWidths[i];\n this.polylineColorBuffer[i].array = renderContext.polylineColors[i];\n this.polylineColorBuffer[i].needsUpdate = true;\n }\n };\n ScatterPlotVisualizerPolylines.prototype.onPickingRender = function (renderContext) { };\n ScatterPlotVisualizerPolylines.prototype.onResize = function (newWidth, newHeight) { };\n return ScatterPlotVisualizerPolylines;\n}());\nexports.ScatterPlotVisualizerPolylines = ScatterPlotVisualizerPolylines;\n","\"use strict\";\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spread = (this && this.__spread) || function () {\n for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));\n return ar;\n};\nvar __values = (this && this.__values) || function(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar scatter_plot_1 = require(\"./scatter_plot\");\nvar color_1 = require(\"./color\");\nvar data_1 = require(\"./data\");\nvar render_1 = require(\"./render\");\nvar styles_1 = require(\"./styles\");\nvar util = require(\"./util\");\nvar constants_1 = require(\"./constants\");\nvar scatter_plot_visualizer_3d_labels_1 = require(\"./scatter_plot_visualizer_3d_labels\");\nvar scatter_plot_visualizer_sprites_1 = require(\"./scatter_plot_visualizer_sprites\");\nvar scatter_plot_visualizer_canvas_labels_1 = require(\"./scatter_plot_visualizer_canvas_labels\");\nvar scatter_plot_visualizer_polylines_1 = require(\"./scatter_plot_visualizer_polylines\");\nvar ScatterGL = (function () {\n function ScatterGL(containerElement, params) {\n var _this = this;\n if (params === void 0) { params = {}; }\n this.pointColorer = null;\n this.sequences = [];\n this.renderMode = \"POINT\";\n this.rotateOnStart = true;\n this.selectEnabled = true;\n this.showLabelsOnHover = true;\n this.hoverPointIndex = null;\n this.selectedPointIndices = new Set();\n this.clickCallback = function () { };\n this.hoverCallback = function () { };\n this.selectCallback = function () { };\n this.cameraMoveCallback = function () { };\n this.onHover = function (pointIndex) {\n _this.hoverCallback(pointIndex);\n _this.hoverPointIndex = pointIndex;\n _this.updateScatterPlotAttributes();\n _this.renderScatterPlot();\n };\n this.onClick = function (pointIndex) {\n _this.clickCallback(pointIndex);\n };\n this.select = function (pointIndices) {\n if (!_this.selectEnabled)\n return;\n _this.selectedPointIndices = new Set(pointIndices);\n _this.updateScatterPlotAttributes();\n _this.renderScatterPlot();\n };\n this.onSelect = function (pointIndices) {\n if (!_this.selectEnabled)\n return;\n _this.selectCallback(pointIndices);\n _this.select(pointIndices);\n };\n this.containerElement = containerElement;\n this.styles = styles_1.makeStyles(params.styles);\n this.setParameters(params);\n this.scatterPlot = new scatter_plot_1.ScatterPlot(containerElement, {\n camera: params.camera,\n onClick: this.onClick,\n onHover: this.onHover,\n onSelect: this.onSelect,\n selectEnabled: this.selectEnabled,\n styles: this.styles,\n orbitControlParams: params.orbitControls,\n });\n this.scatterPlot.onCameraMove(this.cameraMoveCallback);\n }\n ScatterGL.prototype.setParameters = function (p) {\n if (p.onClick !== undefined)\n this.clickCallback = p.onClick;\n if (p.onHover !== undefined)\n this.hoverCallback = p.onHover;\n if (p.onSelect !== undefined)\n this.selectCallback = p.onSelect;\n if (p.onCameraMove !== undefined)\n this.cameraMoveCallback = p.onCameraMove;\n if (p.pointColorer !== undefined)\n this.pointColorer = p.pointColorer;\n if (p.renderMode !== undefined)\n this.renderMode = p.renderMode;\n if (p.rotateOnStart !== undefined)\n this.rotateOnStart = p.rotateOnStart;\n if (p.selectEnabled !== undefined)\n this.selectEnabled = p.selectEnabled;\n if (p.showLabelsOnHover !== undefined)\n this.showLabelsOnHover = p.showLabelsOnHover;\n };\n ScatterGL.prototype.render = function (dataset) {\n this.updateDataset(dataset);\n this.setVisualizers();\n if (this.rotateOnStart) {\n this.scatterPlot.startOrbitAnimation();\n }\n };\n ScatterGL.prototype.renderScatterPlot = function () {\n if (this.dataset)\n this.scatterPlot.render();\n };\n ScatterGL.prototype.setRenderMode = function (renderMode) {\n this.renderMode = renderMode;\n this.setVisualizers();\n this.updateScatterPlotAttributes();\n this.updateScatterPlotPositions();\n };\n ScatterGL.prototype.setTextRenderMode = function () {\n this.setRenderMode(\"TEXT\");\n this.renderScatterPlot();\n };\n ScatterGL.prototype.setPointRenderMode = function () {\n this.setRenderMode(\"POINT\");\n this.renderScatterPlot();\n };\n ScatterGL.prototype.setSpriteRenderMode = function () {\n if (this.dataset && this.dataset.spriteMetadata) {\n this.setRenderMode(\"SPRITE\");\n this.renderScatterPlot();\n }\n };\n ScatterGL.prototype.setSequences = function (sequences) {\n this.sequences = sequences;\n this.updatePolylineAttributes();\n this.setVisualizers();\n this.renderScatterPlot();\n };\n ScatterGL.prototype.setPanMode = function () {\n this.scatterPlot.setInteractionMode(\"PAN\");\n };\n ScatterGL.prototype.setSelectMode = function () {\n this.scatterPlot.setInteractionMode(\"SELECT\");\n };\n ScatterGL.prototype.setDimensions = function (nDimensions) {\n var outsideRange = nDimensions < 2 || nDimensions > 3;\n var moreThanDataset = this.dataset && nDimensions > this.dataset.dimensions;\n if (outsideRange || moreThanDataset) {\n throw new RangeError('Setting invalid dimensionality');\n }\n else {\n this.scatterPlot.setDimensions(nDimensions);\n this.renderScatterPlot();\n }\n };\n ScatterGL.prototype.setPointColorer = function (pointColorer) {\n this.pointColorer = pointColorer;\n this.updateScatterPlotAttributes();\n this.renderScatterPlot();\n };\n ScatterGL.prototype.callPointColorer = function (pointColorer, index) {\n return pointColorer(index, this.selectedPointIndices, this.hoverPointIndex);\n };\n ScatterGL.prototype.setHoverPointIndex = function (index) {\n this.hoverPointIndex = index;\n this.updateScatterPlotAttributes();\n if (this.scatterPlot.orbitIsAnimating())\n return;\n this.renderScatterPlot();\n };\n ScatterGL.prototype.resize = function () {\n this.scatterPlot.resize();\n };\n ScatterGL.prototype.updateDataset = function (dataset) {\n this.setDataset(dataset);\n this.scatterPlot.setDimensions(dataset.dimensions);\n this.updateScatterPlotAttributes();\n this.updateScatterPlotPositions();\n this.renderScatterPlot();\n };\n ScatterGL.prototype.isOrbiting = function () {\n return this.scatterPlot.orbitIsAnimating();\n };\n ScatterGL.prototype.startOrbitAnimation = function () {\n this.scatterPlot.startOrbitAnimation();\n };\n ScatterGL.prototype.stopOrbitAnimation = function () {\n this.scatterPlot.stopOrbitAnimation();\n };\n ScatterGL.prototype.setDataset = function (dataset) {\n this.dataset = dataset;\n if (this.labels3DVisualizer) {\n this.labels3DVisualizer.setLabelStrings(this.generate3DLabelsArray());\n }\n };\n ScatterGL.prototype.updateScatterPlotPositions = function () {\n var dataset = this.dataset;\n if (!dataset)\n return;\n var newPositions = this.generatePointPositionArray(dataset);\n this.scatterPlot.setPointPositions(newPositions);\n };\n ScatterGL.prototype.updateScatterPlotAttributes = function () {\n var dataset = this.dataset;\n if (!dataset)\n return;\n var pointColors = this.generatePointColorArray(dataset);\n var pointScaleFactors = this.generatePointScaleFactorArray(dataset);\n var labels = this.generateVisibleLabelRenderParams();\n this.scatterPlot.setPointColors(pointColors);\n this.scatterPlot.setPointScaleFactors(pointScaleFactors);\n this.scatterPlot.setLabels(labels);\n };\n ScatterGL.prototype.updatePolylineAttributes = function () {\n var dataset = this.dataset;\n if (!dataset)\n return;\n var polylineColors = this.generateLineSegmentColorMap(dataset);\n var polylineOpacities = this.generateLineSegmentOpacityArray(dataset);\n var polylineWidths = this.generateLineSegmentWidthArray(dataset);\n this.scatterPlot.setPolylineColors(polylineColors);\n this.scatterPlot.setPolylineOpacities(polylineOpacities);\n this.scatterPlot.setPolylineWidths(polylineWidths);\n };\n ScatterGL.prototype.generatePointPositionArray = function (dataset) {\n var xExtent = [0, 0];\n var yExtent = [0, 0];\n var zExtent = [0, 0];\n xExtent = util.extent(dataset.points.map(function (p) { return p[0]; }));\n yExtent = util.extent(dataset.points.map(function (p) { return p[1]; }));\n if (dataset.dimensions === 3) {\n zExtent = util.extent(dataset.points.map(function (p) { return p[2]; }));\n }\n var getRange = function (extent) { return Math.abs(extent[1] - extent[0]); };\n var xRange = getRange(xExtent);\n var yRange = getRange(yExtent);\n var zRange = getRange(zExtent);\n var maxRange = Math.max(xRange, yRange, zRange);\n var halfCube = constants_1.SCATTER_PLOT_CUBE_LENGTH / 2;\n var makeScaleRange = function (range, base) { return [\n -base * (range / maxRange),\n base * (range / maxRange),\n ]; };\n var xScale = makeScaleRange(xRange, halfCube);\n var yScale = makeScaleRange(yRange, halfCube);\n var zScale = makeScaleRange(zRange, halfCube);\n var positions = new Float32Array(dataset.points.length * 3);\n var dst = 0;\n dataset.points.forEach(function (d, i) {\n var vector = dataset.points[i];\n positions[dst++] = util.scaleLinear(vector[0], xExtent, xScale);\n positions[dst++] = util.scaleLinear(vector[1], yExtent, yScale);\n if (dataset.dimensions === 3) {\n positions[dst++] = util.scaleLinear(vector[2], zExtent, zScale);\n }\n else {\n positions[dst++] = 0.0;\n }\n });\n return positions;\n };\n ScatterGL.prototype.generateVisibleLabelRenderParams = function () {\n var _a = this, hoverPointIndex = _a.hoverPointIndex, selectedPointIndices = _a.selectedPointIndices, styles = _a.styles;\n var n = hoverPointIndex !== null ? 1 : 0;\n var visibleLabels = new Uint32Array(n);\n var scale = new Float32Array(n);\n var opacityFlags = new Int8Array(n);\n var fillColors = new Uint8Array(n * 3);\n var strokeColors = new Uint8Array(n * 3);\n var labelStrings = [];\n scale.fill(styles.label.scaleDefault);\n opacityFlags.fill(1);\n var dst = 0;\n if (hoverPointIndex !== null) {\n labelStrings.push(this.getLabelText(hoverPointIndex));\n visibleLabels[dst] = hoverPointIndex;\n scale[dst] = styles.label.scaleLarge;\n opacityFlags[dst] = 0;\n var fillRgb = util.styleRgbFromHexColor(styles.label.fillColorHover);\n util.packRgbIntoUint8Array(fillColors, dst, fillRgb[0], fillRgb[1], fillRgb[2]);\n var strokeRgb = util.styleRgbFromHexColor(styles.label.strokeColorHover);\n util.packRgbIntoUint8Array(strokeColors, dst, strokeRgb[0], strokeRgb[1], strokeRgb[1]);\n ++dst;\n }\n {\n var fillRgb = util.styleRgbFromHexColor(styles.label.fillColorSelected);\n var strokeRgb = util.styleRgbFromHexColor(styles.label.strokeColorSelected);\n if (selectedPointIndices.size === 1) {\n var labelIndex = __spread(selectedPointIndices)[0];\n labelStrings.push(this.getLabelText(labelIndex));\n visibleLabels[dst] = labelIndex;\n scale[dst] = styles.label.scaleLarge;\n opacityFlags[dst] = 0;\n util.packRgbIntoUint8Array(fillColors, dst, fillRgb[0], fillRgb[1], fillRgb[2]);\n util.packRgbIntoUint8Array(strokeColors, dst, strokeRgb[0], strokeRgb[1], strokeRgb[2]);\n }\n }\n return new render_1.LabelRenderParams(new Float32Array(visibleLabels), labelStrings, scale, opacityFlags, styles.label.fontSize, fillColors, strokeColors);\n };\n ScatterGL.prototype.generatePointScaleFactorArray = function (dataset) {\n var e_1, _a;\n var _b = this, hoverPointIndex = _b.hoverPointIndex, selectedPointIndices = _b.selectedPointIndices, styles = _b.styles;\n var _c = styles.point, scaleDefault = _c.scaleDefault, scaleSelected = _c.scaleSelected, scaleHover = _c.scaleHover;\n var scale = new Float32Array(dataset.points.length);\n scale.fill(scaleDefault);\n var selectedPointCount = selectedPointIndices.size;\n {\n try {\n for (var _d = __values(selectedPointIndices.values()), _e = _d.next(); !_e.done; _e = _d.next()) {\n var p = _e.value;\n scale[p] = scaleSelected;\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_e && !_e.done && (_a = _d.return)) _a.call(_d);\n }\n finally { if (e_1) throw e_1.error; }\n }\n }\n if (hoverPointIndex != null) {\n scale[hoverPointIndex] = scaleHover;\n }\n return scale;\n };\n ScatterGL.prototype.generatePointColorArray = function (dataset) {\n var e_2, _a;\n var _b = this, hoverPointIndex = _b.hoverPointIndex, pointColorer = _b.pointColorer, selectedPointIndices = _b.selectedPointIndices, styles = _b.styles;\n var _c = styles.point, colorHover = _c.colorHover, colorNoSelection = _c.colorNoSelection, colorSelected = _c.colorSelected, colorUnselected = _c.colorUnselected;\n var colors = new Float32Array(dataset.points.length * constants_1.RGBA_NUM_ELEMENTS);\n var unselectedColor = colorUnselected;\n var noSelectionColor = colorNoSelection;\n if (this.renderMode === \"TEXT\") {\n unselectedColor = this.styles.label3D.colorUnselected;\n noSelectionColor = this.styles.label3D.colorNoSelection;\n }\n if (this.renderMode === \"SPRITE\") {\n unselectedColor = this.styles.sprites.colorUnselected;\n noSelectionColor = this.styles.sprites.colorNoSelection;\n }\n var n = dataset.points.length;\n var selectedPointCount = this.selectedPointIndices.size;\n if (pointColorer) {\n var dst = 0;\n for (var i = 0; i < n; ++i) {\n var c = color_1.parseColor(this.callPointColorer(pointColorer, i) || noSelectionColor);\n colors[dst++] = c.r;\n colors[dst++] = c.g;\n colors[dst++] = c.b;\n colors[dst++] = c.opacity;\n }\n }\n else {\n var dst = 0;\n var c = selectedPointCount > 0\n ? color_1.parseColor(unselectedColor)\n : color_1.parseColor(noSelectionColor);\n for (var i = 0; i < n; ++i) {\n colors[dst++] = c.r;\n colors[dst++] = c.g;\n colors[dst++] = c.b;\n colors[dst++] = c.opacity;\n }\n c = color_1.parseColor(colorSelected);\n try {\n for (var _d = __values(selectedPointIndices.values()), _e = _d.next(); !_e.done; _e = _d.next()) {\n var selectedPointIndex = _e.value;\n var dst_1 = selectedPointIndex * constants_1.RGBA_NUM_ELEMENTS;\n colors[dst_1++] = c.r;\n colors[dst_1++] = c.g;\n colors[dst_1++] = c.b;\n colors[dst_1++] = c.opacity;\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (_e && !_e.done && (_a = _d.return)) _a.call(_d);\n }\n finally { if (e_2) throw e_2.error; }\n }\n if (hoverPointIndex != null) {\n var c_1 = color_1.parseColor(colorHover);\n var dst_2 = hoverPointIndex * constants_1.RGBA_NUM_ELEMENTS;\n colors[dst_2++] = c_1.r;\n colors[dst_2++] = c_1.g;\n colors[dst_2++] = c_1.b;\n colors[dst_2++] = c_1.opacity;\n }\n }\n return colors;\n };\n ScatterGL.prototype.generate3DLabelsArray = function () {\n var dataset = this.dataset;\n if (!dataset)\n return [];\n var labels = [];\n var n = dataset.points.length;\n for (var i = 0; i < n; ++i) {\n labels.push(this.getLabelText(i));\n }\n return labels;\n };\n ScatterGL.prototype.generateLineSegmentColorMap = function (dataset) {\n var _a = this, pointColorer = _a.pointColorer, styles = _a.styles;\n var polylineColorArrayMap = {};\n for (var i = 0; i < this.sequences.length; i++) {\n var sequence = this.sequences[i];\n var colors = new Float32Array(2 * (sequence.indices.length - 1) * 3);\n var colorIndex = 0;\n if (pointColorer) {\n for (var j = 0; j < sequence.indices.length - 1; j++) {\n var c1 = color_1.parseColor(this.callPointColorer(pointColorer, sequence.indices[j]));\n var c2 = color_1.parseColor(this.callPointColorer(pointColorer, sequence.indices[j + 1]));\n colors[colorIndex++] = c1.r;\n colors[colorIndex++] = c1.g;\n colors[colorIndex++] = c1.b;\n colors[colorIndex++] = c2.r;\n colors[colorIndex++] = c2.g;\n colors[colorIndex++] = c2.b;\n }\n }\n else {\n for (var j = 0; j < sequence.indices.length - 1; j++) {\n var c1 = util.getDefaultPointInPolylineColor(j, sequence.indices.length, styles.polyline.startHue, styles.polyline.endHue, styles.polyline.saturation, styles.polyline.lightness);\n var c2 = util.getDefaultPointInPolylineColor(j + 1, sequence.indices.length, styles.polyline.startHue, styles.polyline.endHue, styles.polyline.saturation, styles.polyline.lightness);\n colors[colorIndex++] = c1.r;\n colors[colorIndex++] = c1.g;\n colors[colorIndex++] = c1.b;\n colors[colorIndex++] = c2.r;\n colors[colorIndex++] = c2.g;\n colors[colorIndex++] = c2.b;\n }\n }\n polylineColorArrayMap[i] = colors;\n }\n return polylineColorArrayMap;\n };\n ScatterGL.prototype.generateLineSegmentOpacityArray = function (dataset) {\n var _a = this, selectedPointIndices = _a.selectedPointIndices, styles = _a.styles;\n var opacities = new Float32Array(this.sequences.length);\n var selectedPointCount = selectedPointIndices.size;\n if (selectedPointCount > 0) {\n opacities.fill(styles.polyline.deselectedOpacity);\n var i = this.polylineVisualizer.getPointSequenceIndex(__spread(selectedPointIndices)[0]);\n if (i !== undefined)\n opacities[i] = styles.polyline.selectedOpacity;\n }\n else {\n opacities.fill(styles.polyline.defaultOpacity);\n }\n return opacities;\n };\n ScatterGL.prototype.generateLineSegmentWidthArray = function (dataset) {\n var _a = this, selectedPointIndices = _a.selectedPointIndices, styles = _a.styles;\n var widths = new Float32Array(this.sequences.length);\n widths.fill(styles.polyline.defaultLineWidth);\n var selectedPointCount = selectedPointIndices.size;\n if (selectedPointCount > 0) {\n var i = this.polylineVisualizer.getPointSequenceIndex(__spread(selectedPointIndices)[0]);\n if (i !== undefined)\n widths[i] = styles.polyline.selectedLineWidth;\n }\n return widths;\n };\n ScatterGL.prototype.getLabelText = function (i) {\n var dataset = this.dataset;\n if (!dataset)\n return '';\n var metadata = dataset.metadata[i];\n return metadata && metadata.label != null ? \"\" + metadata.label : '';\n };\n ScatterGL.prototype.initializeCanvasLabelsVisualizer = function () {\n if (!this.canvasLabelsVisualizer) {\n this.canvasLabelsVisualizer = new scatter_plot_visualizer_canvas_labels_1.ScatterPlotVisualizerCanvasLabels(this.containerElement, this.styles);\n }\n return this.canvasLabelsVisualizer;\n };\n ScatterGL.prototype.initialize3DLabelsVisualizer = function () {\n if (!this.labels3DVisualizer) {\n this.labels3DVisualizer = new scatter_plot_visualizer_3d_labels_1.ScatterPlotVisualizer3DLabels(this.styles);\n }\n this.labels3DVisualizer.setLabelStrings(this.generate3DLabelsArray());\n return this.labels3DVisualizer;\n };\n ScatterGL.prototype.initializePointVisualizer = function () {\n if (!this.pointVisualizer) {\n this.pointVisualizer = new scatter_plot_visualizer_sprites_1.ScatterPlotVisualizerSprites(this.styles);\n }\n return this.pointVisualizer;\n };\n ScatterGL.prototype.initializeSpritesheetVisualizer = function () {\n var _this = this;\n var styles = this.styles;\n var dataset = this.dataset;\n var spriteMetadata = dataset.spriteMetadata;\n if (!this.spritesheetVisualizer && spriteMetadata) {\n if (!spriteMetadata.spriteImage || !spriteMetadata.singleSpriteSize) {\n return;\n }\n var n = dataset.points.length;\n var spriteIndices = void 0;\n if (spriteMetadata.spriteIndices) {\n spriteIndices = new Float32Array(spriteMetadata.spriteIndices);\n }\n else {\n spriteIndices = new Float32Array(n);\n for (var i = 0; i < n; ++i) {\n spriteIndices[i] = i;\n }\n }\n var onImageLoad = function () { return _this.renderScatterPlot(); };\n var spritesheetVisualizer = new scatter_plot_visualizer_sprites_1.ScatterPlotVisualizerSprites(styles, {\n spritesheetImage: spriteMetadata.spriteImage,\n spriteDimensions: spriteMetadata.singleSpriteSize,\n spriteIndices: spriteIndices,\n onImageLoad: onImageLoad,\n });\n spritesheetVisualizer.id = 'SPRITE_SHEET_VISUALIZER';\n this.spritesheetVisualizer = spritesheetVisualizer;\n }\n return this.spritesheetVisualizer;\n };\n ScatterGL.prototype.initializePolylineVisualizer = function () {\n if (!this.polylineVisualizer) {\n this.polylineVisualizer = new scatter_plot_visualizer_polylines_1.ScatterPlotVisualizerPolylines();\n }\n this.polylineVisualizer.setSequences(this.sequences);\n return this.polylineVisualizer;\n };\n ScatterGL.prototype.setVisualizers = function () {\n var _a = this, dataset = _a.dataset, renderMode = _a.renderMode;\n var activeVisualizers = [];\n if (renderMode === \"TEXT\") {\n var visualizer = this.initialize3DLabelsVisualizer();\n activeVisualizers.push(visualizer);\n }\n else if (renderMode === \"POINT\") {\n var visualizer = this.initializePointVisualizer();\n activeVisualizers.push(visualizer);\n }\n else if (renderMode === \"SPRITE\" && dataset.spriteMetadata) {\n var visualizer = this.initializeSpritesheetVisualizer();\n if (visualizer)\n activeVisualizers.push(visualizer);\n }\n if (this.sequences.length > 0) {\n var visualizer = this.initializePolylineVisualizer();\n activeVisualizers.push(visualizer);\n }\n var textLabelsRenderMode = renderMode === \"POINT\" || renderMode === \"SPRITE\";\n if (textLabelsRenderMode && this.showLabelsOnHover) {\n var visualizer = this.initializeCanvasLabelsVisualizer();\n activeVisualizers.push(visualizer);\n }\n this.scatterPlot.setActiveVisualizers(activeVisualizers);\n };\n ScatterGL.Dataset = data_1.Dataset;\n return ScatterGL;\n}());\nexports.ScatterGL = ScatterGL;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar scatter_gl_1 = require(\"./scatter_gl\");\nexports.ScatterGL = scatter_gl_1.ScatterGL;\nvar data_1 = require(\"./data\");\nexports.Dataset = data_1.Dataset;\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport * as posedetection from '@tensorflow-models/pose-detection';\nimport * as tf from '@tensorflow/tfjs-core';\n\nimport * as params from './params';\n\n/**\n * Records each flag's default value under the runtime environment and is a\n * constant in runtime.\n */\nlet TUNABLE_FLAG_DEFAULT_VALUE_MAP;\n\nlet enableTrackingController;\nlet scoreThresholdController;\n\nconst stringValueMap = {};\nlet backendFolder;\n\nexport async function setupDatGui(urlParams) {\n const gui = new dat.GUI({width: 300});\n gui.domElement.id = 'gui';\n\n // The camera folder contains options for video settings.\n const cameraFolder = gui.addFolder('Camera');\n const fpsController = cameraFolder.add(params.STATE.camera, 'targetFPS');\n fpsController.onFinishChange((_) => {\n params.STATE.isTargetFPSChanged = true;\n });\n const sizeController = cameraFolder.add(\n params.STATE.camera, 'sizeOption', Object.keys(params.VIDEO_SIZE));\n sizeController.onChange(_ => {\n params.STATE.isSizeOptionChanged = true;\n });\n cameraFolder.open();\n\n // The model folder contains options for model selection.\n const modelFolder = gui.addFolder('Model');\n\n const model = urlParams.get('model');\n let type = urlParams.get('type');\n const backendFromURL = urlParams.get('backend');\n\n switch (model) {\n case 'posenet':\n params.STATE.model = posedetection.SupportedModels.PoseNet;\n break;\n case 'movenet':\n params.STATE.model = posedetection.SupportedModels.MoveNet;\n if (type !== 'lightning' && type !== 'thunder' && type !== 'multipose') {\n // Nulify invalid value.\n type = null;\n }\n break;\n case 'blazepose':\n params.STATE.model = posedetection.SupportedModels.BlazePose;\n if (type !== 'full' && type !== 'lite' && type !== 'heavy') {\n // Nulify invalid value.\n type = null;\n }\n break;\n default:\n alert(`${urlParams.get('model')}`);\n break;\n }\n\n const modelController = modelFolder.add(\n params.STATE, 'model', Object.values(posedetection.SupportedModels));\n\n modelController.onChange(_ => {\n params.STATE.isModelChanged = true;\n showModelConfigs(modelFolder);\n showBackendConfigs(backendFolder);\n });\n\n showModelConfigs(modelFolder, type);\n\n modelFolder.open();\n\n backendFolder = gui.addFolder('Backend');\n params.STATE.backend = backendFromURL;\n\n showBackendConfigs(backendFolder);\n\n backendFolder.open();\n\n return gui;\n}\n\nexport async function showBackendConfigs(folderController) {\n if (folderController == null) {\n folderController = backendFolder;\n }\n // Clean up backend configs for the previous model.\n const fixedSelectionCount = 0;\n while (folderController.__controllers.length > fixedSelectionCount) {\n folderController.remove(\n folderController\n .__controllers[folderController.__controllers.length - 1]);\n }\n const backends = params.MODEL_BACKEND_MAP[params.STATE.model];\n if(params.STATE.backend == null) {\n // The first element of the array is the default backend for the model.\n params.STATE.backend = backends[0];\n }\n const backendController =\n folderController.add(params.STATE, 'backend', backends);\n backendController.name('runtime-backend');\n backendController.onChange(async backend => {\n params.STATE.isBackendChanged = true;\n await showFlagSettings(folderController, backend);\n });\n await showFlagSettings(folderController, params.STATE.backend);\n}\n\nfunction showModelConfigs(folderController, type) {\n // Clean up model configs for the previous model.\n // The first constroller under the `folderController` is the model\n // selection.\n const fixedSelectionCount = 1;\n while (folderController.__controllers.length > fixedSelectionCount) {\n folderController.remove(\n folderController\n .__controllers[folderController.__controllers.length - 1]);\n }\n\n switch (params.STATE.model) {\n case posedetection.SupportedModels.PoseNet:\n addPoseNetControllers(folderController);\n break;\n case posedetection.SupportedModels.MoveNet:\n addMoveNetControllers(folderController, type);\n break;\n case posedetection.SupportedModels.BlazePose:\n addBlazePoseControllers(folderController, type);\n break;\n default:\n alert(`Model ${params.STATE.model} is not supported.`);\n }\n}\n\n// The PoseNet model config folder contains options for PoseNet config\n// settings.\nfunction addPoseNetControllers(modelConfigFolder) {\n params.STATE.modelConfig = {...params.POSENET_CONFIG};\n\n modelConfigFolder.add(params.STATE.modelConfig, 'maxPoses', [1, 2, 3, 4, 5]);\n modelConfigFolder.add(params.STATE.modelConfig, 'scoreThreshold', 0, 1);\n}\n\n// The MoveNet model config folder contains options for MoveNet config\n// settings.\nfunction addMoveNetControllers(modelConfigFolder, type) {\n params.STATE.modelConfig = {...params.MOVENET_CONFIG};\n params.STATE.modelConfig.type = type != null ? type : 'lightning';\n\n // Set multipose defaults on initial page load.\n if (params.STATE.modelConfig.type === 'multipose') {\n params.STATE.modelConfig.enableTracking = true;\n params.STATE.modelConfig.scoreThreshold = 0.2;\n }\n\n const typeController = modelConfigFolder.add(\n params.STATE.modelConfig, 'type', ['lightning', 'thunder', 'multipose']);\n typeController.onChange(type => {\n // Set isModelChanged to true, so that we don't render any result during\n // changing models.\n params.STATE.isModelChanged = true;\n if (type === 'multipose') {\n // Defaults to enable tracking for multi pose.\n if (enableTrackingController) {\n enableTrackingController.setValue(true);\n }\n // Defaults to a lower scoreThreshold for multi pose.\n if (scoreThresholdController) {\n scoreThresholdController.setValue(0.2);\n }\n } else {\n enableTrackingController.setValue(false);\n }\n });\n\n const customModelController =\n modelConfigFolder.add(params.STATE.modelConfig, 'customModel');\n customModelController.onFinishChange(_ => {\n params.STATE.isModelChanged = true;\n });\n\n scoreThresholdController =\n modelConfigFolder.add(params.STATE.modelConfig, 'scoreThreshold', 0, 1);\n\n enableTrackingController = modelConfigFolder.add(\n params.STATE.modelConfig,\n 'enableTracking',\n );\n enableTrackingController.onChange(_ => {\n // Set isModelChanged to true, so that we don't render any result during\n // changing models.\n params.STATE.isModelChanged = true;\n })\n}\n\n// The BlazePose model config folder contains options for BlazePose config\n// settings.\nfunction addBlazePoseControllers(modelConfigFolder, type) {\n params.STATE.modelConfig = {...params.BLAZEPOSE_CONFIG};\n params.STATE.modelConfig.type = type != null ? type : 'full';\n\n const typeController = modelConfigFolder.add(\n params.STATE.modelConfig, 'type', ['lite', 'full', 'heavy']);\n typeController.onChange(_ => {\n // Set isModelChanged to true, so that we don't render any result during\n // changing models.\n params.STATE.isModelChanged = true;\n });\n\n modelConfigFolder.add(params.STATE.modelConfig, 'scoreThreshold', 0, 1);\n\n const render3DController =\n modelConfigFolder.add(params.STATE.modelConfig, 'render3D');\n render3DController.onChange(render3D => {\n document.querySelector('#scatter-gl-container').style.display =\n render3D ? 'inline-block' : 'none';\n });\n}\n\n/**\n * Query all tunable flags' default value and populate `STATE.flags` with them.\n */\nasync function initDefaultValueMap() {\n // Clean up the cache to query tunable flags' default values.\n TUNABLE_FLAG_DEFAULT_VALUE_MAP = {};\n params.STATE.flags = {};\n for (const backend in params.BACKEND_FLAGS_MAP) {\n for (let index = 0; index < params.BACKEND_FLAGS_MAP[backend].length;\n index++) {\n const flag = params.BACKEND_FLAGS_MAP[backend][index];\n TUNABLE_FLAG_DEFAULT_VALUE_MAP[flag] = await tf.env().getAsync(flag);\n }\n }\n\n // Initialize STATE.flags with tunable flags' default values.\n for (const flag in TUNABLE_FLAG_DEFAULT_VALUE_MAP) {\n if (params.BACKEND_FLAGS_MAP[params.STATE.backend].indexOf(flag) > -1) {\n params.STATE.flags[flag] = TUNABLE_FLAG_DEFAULT_VALUE_MAP[flag];\n }\n }\n}\n\n/**\n * Heuristically determine flag's value range based on flag's default value.\n *\n * Assume that the flag's default value has already chosen the best option for\n * the runtime environment, so users can only tune the flag value downwards.\n *\n * For example, if the default value of `WEBGL_RENDER_FLOAT32_CAPABLE` is false,\n * the tunable range is [false]; otherwise, the tunable range is [true. false].\n *\n * @param {string} flag\n */\nfunction getTunableRange(flag) {\n const defaultValue = TUNABLE_FLAG_DEFAULT_VALUE_MAP[flag];\n if (flag === 'WEBGL_FORCE_F16_TEXTURES') {\n return [false, true];\n } else if (flag === 'WEBGL_VERSION') {\n const tunableRange = [];\n for (let value = 1; value <= defaultValue; value++) {\n tunableRange.push(value);\n }\n return tunableRange;\n } else if (flag === 'WEBGL_FLUSH_THRESHOLD') {\n const tunableRange = [-1];\n for (let value = 0; value <= 2; value += 0.25) {\n tunableRange.push(value);\n }\n return tunableRange;\n } else if (typeof defaultValue === 'boolean') {\n return defaultValue ? [false, true] : [false];\n } else if (params.TUNABLE_FLAG_VALUE_RANGE_MAP[flag] != null) {\n return params.TUNABLE_FLAG_VALUE_RANGE_MAP[flag];\n } else {\n return [defaultValue];\n }\n}\n\n/**\n * Show flag settings for the given backend under the UI element of\n * `folderController`.\n *\n * @param {dat.gui.GUI} folderController\n * @param {string} backendName\n */\nfunction showBackendFlagSettings(folderController, backendName) {\n const tunableFlags = params.BACKEND_FLAGS_MAP[backendName];\n for (let index = 0; index < tunableFlags.length; index++) {\n const flag = tunableFlags[index];\n const flagName = params.TUNABLE_FLAG_NAME_MAP[flag] || flag;\n\n // When tunable (bool) and range (array) attributes of `flagRegistry` is\n // implemented, we can apply them to here.\n const flagValueRange = getTunableRange(flag);\n // Heuristically consider a flag with at least two options as tunable.\n if (flagValueRange.length < 2) {\n console.warn(\n `The ${flag} is considered as untunable, ` +\n `because its value range is [${flagValueRange}].`);\n continue;\n }\n\n let flagController;\n if (typeof flagValueRange[0] === 'boolean') {\n // Show checkbox for boolean flags.\n flagController = folderController.add(params.STATE.flags, flag);\n } else {\n // Show dropdown for other types of flags.\n flagController =\n folderController.add(params.STATE.flags, flag, flagValueRange);\n\n // Because dat.gui always casts dropdown option values to string, we need\n // `stringValueMap` and `onFinishChange()` to recover the value type.\n if (stringValueMap[flag] == null) {\n stringValueMap[flag] = {};\n for (let index = 0; index < flagValueRange.length; index++) {\n const realValue = flagValueRange[index];\n const stringValue = String(flagValueRange[index]);\n stringValueMap[flag][stringValue] = realValue;\n }\n }\n flagController.onFinishChange(stringValue => {\n params.STATE.flags[flag] = stringValueMap[flag][stringValue];\n });\n }\n flagController.name(flagName).onChange(() => {\n params.STATE.isFlagChanged = true;\n });\n }\n}\n\n/**\n * Set up flag settings under the UI element of `folderController`:\n * - If it is the first call, initialize the flags' default value and show flag\n * settings for both the general and the given backend.\n * - Else, clean up flag settings for the previous backend and show flag\n * settings for the new backend.\n *\n * @param {dat.gui.GUI} folderController\n * @param {string} backendName\n */\nasync function showFlagSettings(folderController, backendName) {\n await initDefaultValueMap();\n\n // Clean up flag settings for the previous backend.\n // The first constroller under the `folderController` is the backend\n // setting.\n const fixedSelectionCount = 1;\n while (folderController.__controllers.length > fixedSelectionCount) {\n folderController.remove(\n folderController\n .__controllers[folderController.__controllers.length - 1]);\n }\n\n // Show flag settings for the new backend.\n showBackendFlagSettings(folderController, backendName);\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport * as tf from '@tensorflow/tfjs-core';\nimport {showBackendConfigs} from './option_panel';\nimport {STATE, TUNABLE_FLAG_VALUE_RANGE_MAP} from './params';\n\nexport function isiOS() {\n return /iPhone|iPad|iPod/i.test(navigator.userAgent);\n}\n\nexport function isAndroid() {\n return /Android/i.test(navigator.userAgent);\n}\n\nexport function isMobile() {\n return isAndroid() || isiOS();\n}\n\n/**\n * Reset the target backend.\n *\n * @param backendName The name of the backend to be reset.\n */\nasync function resetBackend(backendName) {\n const ENGINE = tf.engine();\n if (!(backendName in ENGINE.registryFactory)) {\n if(backendName === 'webgpu') {\n alert('webgpu backend is not registered. Your browser may not support WebGPU yet. To test this backend, please use a supported browser, e.g. Chrome canary with --enable-unsafe-webgpu flag');\n STATE.backend = !!STATE.lastTFJSBackend ? STATE.lastTFJSBackend : 'tfjs-webgl';\n showBackendConfigs();\n return;\n } else {\n throw new Error(`${backendName} backend is not registered.`);\n }\n }\n\n if (backendName in ENGINE.registry) {\n const backendFactory = tf.findBackendFactory(backendName);\n tf.removeBackend(backendName);\n tf.registerBackend(backendName, backendFactory);\n }\n\n await tf.setBackend(backendName);\n STATE.lastTFJSBackend = `tfjs-${backendName}`;\n}\n\n/**\n * Set environment flags.\n *\n * This is a wrapper function of `tf.env().setFlags()` to constrain users to\n * only set tunable flags (the keys of `TUNABLE_FLAG_TYPE_MAP`).\n *\n * ```js\n * const flagConfig = {\n * WEBGL_PACK: false,\n * };\n * await setEnvFlags(flagConfig);\n *\n * console.log(tf.env().getBool('WEBGL_PACK')); // false\n * console.log(tf.env().getBool('WEBGL_PACK_BINARY_OPERATIONS')); // false\n * ```\n *\n * @param flagConfig An object to store flag-value pairs.\n */\nexport async function setBackendAndEnvFlags(flagConfig, backend) {\n if (flagConfig == null) {\n return;\n } else if (typeof flagConfig !== 'object') {\n throw new Error(\n `An object is expected, while a(n) ${typeof flagConfig} is found.`);\n }\n\n // Check the validation of flags and values.\n for (const flag in flagConfig) {\n // TODO: check whether flag can be set as flagConfig[flag].\n if (!(flag in TUNABLE_FLAG_VALUE_RANGE_MAP)) {\n throw new Error(`${flag} is not a tunable or valid environment flag.`);\n }\n if (TUNABLE_FLAG_VALUE_RANGE_MAP[flag].indexOf(flagConfig[flag]) === -1) {\n throw new Error(\n `${flag} value is expected to be in the range [${\n TUNABLE_FLAG_VALUE_RANGE_MAP[flag]}], while ${flagConfig[flag]}` +\n ' is found.');\n }\n }\n\n tf.env().setFlags(flagConfig);\n\n const [runtime, $backend] = backend.split('-');\n\n if (runtime === 'tfjs') {\n await resetBackend($backend);\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport * as posedetection from '@tensorflow-models/pose-detection';\nimport {isiOS} from './util';\n\nexport const DEFAULT_LINE_WIDTH = 2;\nexport const DEFAULT_RADIUS = 4;\n\nexport const VIDEO_SIZE = {\n '640 X 480': {width: 640, height: 480},\n '640 X 360': {width: 640, height: 360},\n '360 X 270': {width: 360, height: 270}\n};\nexport const STATE = {\n camera: {targetFPS: 60, sizeOption: '640 X 480'},\n backend: '',\n flags: {},\n modelConfig: {}\n};\nexport const BLAZEPOSE_CONFIG = {\n maxPoses: 1,\n type: 'full',\n scoreThreshold: 0.65,\n render3D: true\n};\nexport const POSENET_CONFIG = {\n maxPoses: 1,\n scoreThreshold: 0.5\n};\nexport const MOVENET_CONFIG = {\n maxPoses: 1,\n type: 'lightning',\n scoreThreshold: 0.3,\n customModel: '',\n enableTracking: false\n};\n/**\n * This map descripes tunable flags and theior corresponding types.\n *\n * The flags (keys) in the map satisfy the following two conditions:\n * - Is tunable. For example, `IS_BROWSER` and `IS_CHROME` is not tunable,\n * because they are fixed when running the scripts.\n * - Does not depend on other flags when registering in `ENV.registerFlag()`.\n * This rule aims to make the list streamlined, and, since there are\n * dependencies between flags, only modifying an independent flag without\n * modifying its dependents may cause inconsistency.\n * (`WEBGL_RENDER_FLOAT32_CAPABLE` is an exception, because only exposing\n * `WEBGL_FORCE_F16_TEXTURES` may confuse users.)\n */\nexport const TUNABLE_FLAG_VALUE_RANGE_MAP = {\n WEBGL_VERSION: [1, 2],\n WASM_HAS_SIMD_SUPPORT: [true, false],\n WASM_HAS_MULTITHREAD_SUPPORT: [true, false],\n WEBGL_CPU_FORWARD: [true, false],\n WEBGL_PACK: [true, false],\n WEBGL_FORCE_F16_TEXTURES: [true, false],\n WEBGL_RENDER_FLOAT32_CAPABLE: [true, false],\n WEBGL_FLUSH_THRESHOLD: [-1, 0, 0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2],\n CHECK_COMPUTATION_FOR_ERRORS: [true, false],\n};\n\nexport const BACKEND_FLAGS_MAP = {\n ['tfjs-wasm']: ['WASM_HAS_SIMD_SUPPORT', 'WASM_HAS_MULTITHREAD_SUPPORT'],\n ['tfjs-webgl']: [\n 'WEBGL_VERSION', 'WEBGL_CPU_FORWARD', 'WEBGL_PACK',\n 'WEBGL_FORCE_F16_TEXTURES', 'WEBGL_RENDER_FLOAT32_CAPABLE',\n 'WEBGL_FLUSH_THRESHOLD'\n ],\n ['tfjs-webgpu']: [],\n ['mediapipe-gpu']: []\n};\n\nexport const MODEL_BACKEND_MAP = {\n [posedetection.SupportedModels.PoseNet]: ['tfjs-webgl', 'tfjs-webgpu'],\n [posedetection.SupportedModels.MoveNet]: ['tfjs-webgl', 'tfjs-wasm', 'tfjs-webgpu'],\n [posedetection.SupportedModels.BlazePose]: ['mediapipe-gpu', 'tfjs-webgl', 'tfjs-webgpu']\n}\n\nexport const TUNABLE_FLAG_NAME_MAP = {\n PROD: 'production mode',\n WEBGL_VERSION: 'webgl version',\n WASM_HAS_SIMD_SUPPORT: 'wasm SIMD',\n WASM_HAS_MULTITHREAD_SUPPORT: 'wasm multithread',\n WEBGL_CPU_FORWARD: 'cpu forward',\n WEBGL_PACK: 'webgl pack',\n WEBGL_FORCE_F16_TEXTURES: 'enforce float16',\n WEBGL_RENDER_FLOAT32_CAPABLE: 'enable float32',\n WEBGL_FLUSH_THRESHOLD: 'GL flush wait time(ms)'\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport * as posedetection from '@tensorflow-models/pose-detection';\nimport * as scatter from 'scatter-gl';\n\nimport * as params from './params';\nimport {isMobile} from './util';\n\n// These anchor points allow the pose pointcloud to resize according to its\n// position in the input.\nconst ANCHOR_POINTS = [[0, 0, 0], [0, 1, 0], [-1, 0, 0], [-1, -1, 0]];\n\n// #ffffff - White\n// #800000 - Maroon\n// #469990 - Malachite\n// #e6194b - Crimson\n// #42d4f4 - Picton Blue\n// #fabed4 - Cupid\n// #aaffc3 - Mint Green\n// #9a6324 - Kumera\n// #000075 - Navy Blue\n// #f58231 - Jaffa\n// #4363d8 - Royal Blue\n// #ffd8b1 - Caramel\n// #dcbeff - Mauve\n// #808000 - Olive\n// #ffe119 - Candlelight\n// #911eb4 - Seance\n// #bfef45 - Inchworm\n// #f032e6 - Razzle Dazzle Rose\n// #3cb44b - Chateau Green\n// #a9a9a9 - Silver Chalice\nconst COLOR_PALETTE = [\n '#ffffff', '#800000', '#469990', '#e6194b', '#42d4f4', '#fabed4', '#aaffc3',\n '#9a6324', '#000075', '#f58231', '#4363d8', '#ffd8b1', '#dcbeff', '#808000',\n '#ffe119', '#911eb4', '#bfef45', '#f032e6', '#3cb44b', '#a9a9a9'\n];\nexport class Camera {\n constructor() {\n this.video = document.getElementById('video');\n this.canvas = document.getElementById('output');\n this.ctx = this.canvas.getContext('2d');\n this.scatterGLEl = document.querySelector('#scatter-gl-container');\n this.scatterGL = new scatter.ScatterGL(this.scatterGLEl, {\n 'rotateOnStart': true,\n 'selectEnabled': false,\n 'styles': {polyline: {defaultOpacity: 1, deselectedOpacity: 1}}\n });\n this.scatterGLHasInitialized = false;\n }\n\n /**\n * Initiate a Camera instance and wait for the camera stream to be ready.\n * @param cameraParam From app `STATE.camera`.\n */\n static async setupCamera(cameraParam) {\n if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) {\n throw new Error(\n 'Browser API navigator.mediaDevices.getUserMedia not available');\n }\n\n const {targetFPS, sizeOption} = cameraParam;\n const $size = params.VIDEO_SIZE[sizeOption];\n const videoConfig = {\n 'audio': false,\n 'video': {\n facingMode: 'user',\n // Only setting the video to a specified size for large screen, on\n // mobile devices accept the default size.\n width: isMobile() ? params.VIDEO_SIZE['360 X 270'].width : $size.width,\n height: isMobile() ? params.VIDEO_SIZE['360 X 270'].height :\n $size.height,\n frameRate: {\n ideal: targetFPS,\n }\n }\n };\n\n const stream = await navigator.mediaDevices.getUserMedia(videoConfig);\n\n const camera = new Camera();\n camera.video.srcObject = stream;\n\n await new Promise((resolve) => {\n camera.video.onloadedmetadata = () => {\n resolve(video);\n };\n });\n\n camera.video.play();\n\n const videoWidth = camera.video.videoWidth;\n const videoHeight = camera.video.videoHeight;\n // Must set below two lines, otherwise video element doesn't show.\n camera.video.width = videoWidth;\n camera.video.height = videoHeight;\n\n camera.canvas.width = videoWidth;\n camera.canvas.height = videoHeight;\n const canvasContainer = document.querySelector('.canvas-wrapper');\n canvasContainer.style = `width: ${videoWidth}px; height: ${videoHeight}px`;\n\n // Because the image from camera is mirrored, need to flip horizontally.\n camera.ctx.translate(camera.video.videoWidth, 0);\n camera.ctx.scale(-1, 1);\n\n camera.scatterGLEl.style =\n `width: ${videoWidth}px; height: ${videoHeight}px;`;\n camera.scatterGL.resize();\n\n camera.scatterGLEl.style.display =\n params.STATE.modelConfig.render3D ? 'inline-block' : 'none';\n\n return camera;\n }\n\n drawCtx() {\n this.ctx.drawImage(\n this.video, 0, 0, this.video.videoWidth, this.video.videoHeight);\n }\n\n clearCtx() {\n this.ctx.clearRect(0, 0, this.video.videoWidth, this.video.videoHeight);\n }\n\n /**\n * Draw the keypoints and skeleton on the video.\n * @param poses A list of poses to render.\n */\n drawResults(poses) {\n for (const pose of poses) {\n this.drawResult(pose);\n }\n }\n\n /**\n * Draw the keypoints and skeleton on the video.\n * @param pose A pose with keypoints to render.\n */\n drawResult(pose) {\n if (pose.keypoints != null) {\n this.drawKeypoints(pose.keypoints);\n this.drawSkeleton(pose.keypoints, pose.id);\n }\n if (pose.keypoints3D != null && params.STATE.modelConfig.render3D) {\n this.drawKeypoints3D(pose.keypoints3D);\n }\n }\n\n /**\n * Draw the keypoints on the video.\n * @param keypoints A list of keypoints.\n */\n drawKeypoints(keypoints) {\n const keypointInd =\n posedetection.util.getKeypointIndexBySide(params.STATE.model);\n this.ctx.fillStyle = 'Red';\n this.ctx.strokeStyle = 'White';\n this.ctx.lineWidth = params.DEFAULT_LINE_WIDTH;\n\n for (const i of keypointInd.middle) {\n this.drawKeypoint(keypoints[i]);\n }\n\n this.ctx.fillStyle = 'Green';\n for (const i of keypointInd.left) {\n this.drawKeypoint(keypoints[i]);\n }\n\n this.ctx.fillStyle = 'Orange';\n for (const i of keypointInd.right) {\n this.drawKeypoint(keypoints[i]);\n }\n }\n\n drawKeypoint(keypoint) {\n // If score is null, just show the keypoint.\n const score = keypoint.score != null ? keypoint.score : 1;\n const scoreThreshold = params.STATE.modelConfig.scoreThreshold || 0;\n\n if (score >= scoreThreshold) {\n const circle = new Path2D();\n circle.arc(keypoint.x, keypoint.y, params.DEFAULT_RADIUS, 0, 2 * Math.PI);\n this.ctx.fill(circle);\n this.ctx.stroke(circle);\n }\n }\n\n /**\n * Draw the skeleton of a body on the video.\n * @param keypoints A list of keypoints.\n */\n drawSkeleton(keypoints, poseId) {\n // Each poseId is mapped to a color in the color palette.\n const color = params.STATE.modelConfig.enableTracking && poseId != null ?\n COLOR_PALETTE[poseId % 20] :\n 'White';\n this.ctx.fillStyle = color;\n this.ctx.strokeStyle = color;\n this.ctx.lineWidth = params.DEFAULT_LINE_WIDTH;\n\n posedetection.util.getAdjacentPairs(params.STATE.model).forEach(([\n i, j\n ]) => {\n const kp1 = keypoints[i];\n const kp2 = keypoints[j];\n\n // If score is null, just show the keypoint.\n const score1 = kp1.score != null ? kp1.score : 1;\n const score2 = kp2.score != null ? kp2.score : 1;\n const scoreThreshold = params.STATE.modelConfig.scoreThreshold || 0;\n\n if (score1 >= scoreThreshold && score2 >= scoreThreshold) {\n this.ctx.beginPath();\n this.ctx.moveTo(kp1.x, kp1.y);\n this.ctx.lineTo(kp2.x, kp2.y);\n this.ctx.stroke();\n }\n });\n }\n\n drawKeypoints3D(keypoints) {\n const scoreThreshold = params.STATE.modelConfig.scoreThreshold || 0;\n const pointsData =\n keypoints.map(keypoint => ([-keypoint.x, -keypoint.y, -keypoint.z]));\n\n const dataset =\n new scatter.ScatterGL.Dataset([...pointsData, ...ANCHOR_POINTS]);\n\n const keypointInd =\n posedetection.util.getKeypointIndexBySide(params.STATE.model);\n this.scatterGL.setPointColorer((i) => {\n if (keypoints[i] == null || keypoints[i].score < scoreThreshold) {\n // hide anchor points and low-confident points.\n return '#ffffff';\n }\n if (i === 0) {\n return '#ff0000' /* Red */;\n }\n if (keypointInd.left.indexOf(i) > -1) {\n return '#00ff00' /* Green */;\n }\n if (keypointInd.right.indexOf(i) > -1) {\n return '#ffa500' /* Orange */;\n }\n });\n\n if (!this.scatterGLHasInitialized) {\n this.scatterGL.render(dataset);\n } else {\n this.scatterGL.updateDataset(dataset);\n }\n const connections = posedetection.util.getAdjacentPairs(params.STATE.model);\n const sequences = connections.map(pair => ({indices: pair}));\n this.scatterGL.setSequences(sequences);\n this.scatterGLHasInitialized = true;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nexport function setupStats() {\n const stats = new Stats();\n stats.customFpsPanel = stats.addPanel(new Stats.Panel('FPS', '#0ff', '#002'));\n stats.showPanel(stats.domElement.children.length - 1);\n\n const parent = document.getElementById('stats');\n parent.appendChild(stats.domElement);\n\n const statsPanes = parent.querySelectorAll('canvas');\n\n for (let i = 0; i < statsPanes.length; ++i) {\n statsPanes[i].style.width = '140px';\n statsPanes[i].style.height = '80px';\n }\n return stats;\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport '@tensorflow/tfjs-backend-webgl';\nimport '@tensorflow/tfjs-backend-webgpu';\nimport * as mpPose from '@mediapipe/pose';\n\nimport * as tfjsWasm from '@tensorflow/tfjs-backend-wasm';\n\ntfjsWasm.setWasmPaths(\n `https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@${\n tfjsWasm.version_wasm}/dist/`);\n\nimport * as posedetection from '@tensorflow-models/pose-detection';\n\nimport {Camera} from './camera';\nimport {setupDatGui} from './option_panel';\nimport {STATE} from './params';\nimport {setupStats} from './stats_panel';\nimport {setBackendAndEnvFlags} from './util';\n\nlet detector, camera, stats;\nlet startInferenceTime, numInferences = 0;\nlet inferenceTimeSum = 0, lastPanelUpdate = 0;\nlet rafId;\n\nasync function createDetector() {\n switch (STATE.model) {\n case posedetection.SupportedModels.PoseNet:\n return posedetection.createDetector(STATE.model, {\n quantBytes: 4,\n architecture: 'MobileNetV1',\n outputStride: 16,\n inputResolution: {width: 500, height: 500},\n multiplier: 0.75\n });\n case posedetection.SupportedModels.BlazePose:\n const runtime = STATE.backend.split('-')[0];\n if (runtime === 'mediapipe') {\n return posedetection.createDetector(STATE.model, {\n runtime,\n modelType: STATE.modelConfig.type,\n solutionPath: `https://cdn.jsdelivr.net/npm/@mediapipe/pose@${mpPose.VERSION}`\n });\n } else if (runtime === 'tfjs') {\n return posedetection.createDetector(\n STATE.model, {runtime, modelType: STATE.modelConfig.type});\n }\n case posedetection.SupportedModels.MoveNet:\n let modelType;\n if (STATE.modelConfig.type == 'lightning') {\n modelType = posedetection.movenet.modelType.SINGLEPOSE_LIGHTNING;\n } else if (STATE.modelConfig.type == 'thunder') {\n modelType = posedetection.movenet.modelType.SINGLEPOSE_THUNDER;\n } else if (STATE.modelConfig.type == 'multipose') {\n modelType = posedetection.movenet.modelType.MULTIPOSE_LIGHTNING;\n }\n const modelConfig = {modelType};\n\n if (STATE.modelConfig.customModel !== '') {\n modelConfig.modelUrl = STATE.modelConfig.customModel;\n }\n if (STATE.modelConfig.type === 'multipose') {\n modelConfig.enableTracking = STATE.modelConfig.enableTracking;\n }\n return posedetection.createDetector(STATE.model, modelConfig);\n }\n}\n\nasync function checkGuiUpdate() {\n if (STATE.isTargetFPSChanged || STATE.isSizeOptionChanged) {\n camera = await Camera.setupCamera(STATE.camera);\n STATE.isTargetFPSChanged = false;\n STATE.isSizeOptionChanged = false;\n }\n\n if (STATE.isModelChanged || STATE.isFlagChanged || STATE.isBackendChanged) {\n STATE.isModelChanged = true;\n\n window.cancelAnimationFrame(rafId);\n\n if (detector != null) {\n detector.dispose();\n }\n\n if (STATE.isFlagChanged || STATE.isBackendChanged) {\n await setBackendAndEnvFlags(STATE.flags, STATE.backend);\n }\n\n try {\n detector = await createDetector(STATE.model);\n } catch (error) {\n detector = null;\n alert(error);\n }\n\n STATE.isFlagChanged = false;\n STATE.isBackendChanged = false;\n STATE.isModelChanged = false;\n }\n}\n\nfunction beginEstimatePosesStats() {\n startInferenceTime = (performance || Date).now();\n}\n\nfunction endEstimatePosesStats() {\n const endInferenceTime = (performance || Date).now();\n inferenceTimeSum += endInferenceTime - startInferenceTime;\n ++numInferences;\n\n const panelUpdateMilliseconds = 1000;\n if (endInferenceTime - lastPanelUpdate >= panelUpdateMilliseconds) {\n const averageInferenceTime = inferenceTimeSum / numInferences;\n inferenceTimeSum = 0;\n numInferences = 0;\n stats.customFpsPanel.update(\n 1000.0 / averageInferenceTime, 120 /* maxValue */);\n lastPanelUpdate = endInferenceTime;\n }\n}\n\nasync function renderResult() {\n if (camera.video.readyState < 2) {\n await new Promise((resolve) => {\n camera.video.onloadeddata = () => {\n resolve(video);\n };\n });\n }\n\n let poses = null;\n\n // Detector can be null if initialization failed (for example when loading\n // from a URL that does not exist).\n if (detector != null) {\n // FPS only counts the time it takes to finish estimatePoses.\n beginEstimatePosesStats();\n\n // Detectors can throw errors, for example when using custom URLs that\n // contain a model that doesn't provide the expected output.\n try {\n poses = await detector.estimatePoses(\n camera.video,\n {maxPoses: STATE.modelConfig.maxPoses, flipHorizontal: false});\n } catch (error) {\n detector.dispose();\n detector = null;\n alert(error);\n }\n\n endEstimatePosesStats();\n }\n\n camera.drawCtx();\n\n // The null check makes sure the UI is not in the middle of changing to a\n // different model. If during model change, the result is from an old model,\n // which shouldn't be rendered.\n if (poses && poses.length > 0 && !STATE.isModelChanged) {\n camera.drawResults(poses);\n }\n}\n\nasync function renderPrediction() {\n await checkGuiUpdate();\n\n if (!STATE.isModelChanged) {\n await renderResult();\n }\n\n rafId = requestAnimationFrame(renderPrediction);\n};\n\nasync function app() {\n // Gui content will change depending on which model is in the query string.\n const urlParams = new URLSearchParams(window.location.search);\n if (!urlParams.has('model')) {\n alert('Cannot find model in the query string.');\n return;\n }\n\n await setupDatGui(urlParams);\n\n stats = setupStats();\n\n camera = await Camera.setupCamera(STATE.camera);\n\n await setBackendAndEnvFlags(STATE.flags, STATE.backend);\n\n detector = await createDetector();\n\n renderPrediction();\n};\n\napp();\n"]} \ No newline at end of file diff --git a/mounts/zoperepo/__root__/tf_live_demo/tflw-pose-detection.js/__source__.js b/mounts/zoperepo/__root__/tf_live_demo/tflw-pose-detection.js/__source__.js deleted file mode 100644 index e2b2ae4..0000000 --- a/mounts/zoperepo/__root__/tf_live_demo/tflw-pose-detection.js/__source__.js +++ /dev/null @@ -1,166111 +0,0 @@ -var playing; -var recording; -var GLOBAL_POSES; -var GLOBAL_RECORDING = []; - -// modules are defined as an array -// [ module function, map of requires ] -// -// map of requires is short require name -> numeric require -// -// anything defined in a previous bundle is accessed via the -// orig method which is the require for previous bundles -parcelRequire = (function (modules, cache, entry, globalName) { - // Save the require from previous bundle to this closure if any - var previousRequire = typeof parcelRequire === 'function' && parcelRequire; - var nodeRequire = typeof require === 'function' && require; - - function newRequire(name, jumped) { - if (!cache[name]) { - if (!modules[name]) { - // if we cannot find the module within our internal map or - // cache jump to the current global require ie. the last bundle - // that was added to the page. - var currentRequire = typeof parcelRequire === 'function' && parcelRequire; - if (!jumped && currentRequire) { - return currentRequire(name, true); - } - - // If there are other bundles on this page the require from the - // previous one is saved to 'previousRequire'. Repeat this as - // many times as there are bundles until the module is found or - // we exhaust the require chain. - if (previousRequire) { - return previousRequire(name, true); - } - - // Try the node require function if it exists. - if (nodeRequire && typeof name === 'string') { - return nodeRequire(name); - } - - var err = new Error('Cannot find module \'' + name + '\''); - err.code = 'MODULE_NOT_FOUND'; - throw err; - } - - localRequire.resolve = resolve; - localRequire.cache = {}; - - var module = cache[name] = new newRequire.Module(name); - - modules[name][0].call(module.exports, localRequire, module, module.exports, this); - } - - return cache[name].exports; - - function localRequire(x){ - return newRequire(localRequire.resolve(x)); - } - - function resolve(x){ - return modules[name][1][x] || x; - } - } - - function Module(moduleName) { - this.id = moduleName; - this.bundle = newRequire; - this.exports = {}; - } - - newRequire.isParcelRequire = true; - newRequire.Module = Module; - newRequire.modules = modules; - newRequire.cache = cache; - newRequire.parent = previousRequire; - newRequire.register = function (id, exports) { - modules[id] = [function (require, module) { - module.exports = exports; - }, {}]; - }; - - var error; - for (var i = 0; i < entry.length; i++) { - try { - newRequire(entry[i]); - } catch (e) { - // Save first error but execute all entries - if (!error) { - error = e; - } - } - } - - if (entry.length) { - // Expose entry point to Node, AMD or browser globals - // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js - var mainExports = newRequire(entry[entry.length - 1]); - - // CommonJS - if (typeof exports === "object" && typeof module !== "undefined") { - module.exports = mainExports; - - // RequireJS - } else if (typeof define === "function" && define.amd) { - define(function () { - return mainExports; - }); - - // - - - - - - - - - - - - - - \ No newline at end of file diff --git a/mounts/zoperepo/__root__/tf_upload_demo/index_html/__source__.py b/mounts/zoperepo/__root__/tf_upload_demo/index_html/__source__.py deleted file mode 100644 index b450ede..0000000 --- a/mounts/zoperepo/__root__/tf_upload_demo/index_html/__source__.py +++ /dev/null @@ -1,3 +0,0 @@ -request = container.REQUEST -resp = request.RESPONSE -resp.redirect('index?model=movenet') diff --git a/mounts/zoperepo/__root__/tf_upload_demo/tflw-pose-detection_upload.js.map/__source__.map b/mounts/zoperepo/__root__/tf_upload_demo/tflw-pose-detection_upload.js.map/__source__.map deleted file mode 100644 index 4c77761..0000000 --- a/mounts/zoperepo/__root__/tf_upload_demo/tflw-pose-detection_upload.js.map/__source__.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../../../../../../tfjs-core/src/backends/backend.ts","../../../../../tfjs-core/src/util_base.ts","../../../../../tfjs-core/src/environment.ts","node_modules/process/browser.js","../../../../../tfjs-core/src/global_util.ts","../../../../../tfjs-core/src/kernel_names.ts","../../../../../tfjs-core/src/log.ts","../../../../../tfjs-core/src/kernel_registry.ts","node_modules/long/src/long.js","../../../../../tfjs-core/src/hash_util.ts","../../../../../tfjs-core/src/util.ts","../../../../../tfjs-core/src/profiler.ts","../../../../../tfjs-core/src/tape.ts","../../../../../tfjs-core/src/tensor_format.ts","../../../../../tfjs-core/src/tensor.ts","../../../../../tfjs-core/src/types.ts","../../../../../tfjs-core/src/tensor_util.ts","../../../../../tfjs-core/src/engine.ts","../../../../../tfjs-core/src/device_util.ts","../../../../../tfjs-core/src/flags.ts","../../../../../tfjs-core/src/tensor_util_env.ts","../../../../../../tfjs-core/src/ops/operation.ts","../../../../../../tfjs-core/src/ops/complex.ts","../../../../../../tfjs-core/src/ops/tensor_ops_util.ts","../../../../../../tfjs-core/src/ops/tensor.ts","../../../../../../tfjs-core/src/io/types.ts","node_modules/base64-js/index.js","node_modules/ieee754/index.js","node_modules/isarray/index.js","node_modules/buffer/index.js","../../../../../../tfjs-core/src/io/io_utils.ts","../../../../../../tfjs-core/src/io/router_registry.ts","../../../../../../tfjs-core/src/io/indexed_db.ts","../../../../../../tfjs-core/src/io/local_storage.ts","../../../../../../tfjs-core/src/io/model_management.ts","../../../../../../tfjs-core/src/platforms/platform_browser.ts","../../../../../../tfjs-core/src/platforms/platform_node.ts","../../../../../../tfjs-core/src/ops/buffer.ts","../../../../../../tfjs-core/src/ops/cast.ts","../../../../../../tfjs-core/src/ops/clone.ts","../../../../../../tfjs-core/src/ops/print.ts","../../../../../tfjs-core/src/base_side_effects.ts","../../../../../../tfjs-core/src/io/browser_files.ts","../../../../../../tfjs-core/src/io/progress.ts","../../../../../../tfjs-core/src/io/weights_loader.ts","../../../../../../tfjs-core/src/io/http.ts","../../../../../../tfjs-core/src/io/passthrough.ts","../../../../../../tfjs-core/src/io/io.ts","../../../../../../tfjs-core/src/ops/mat_mul.ts","../../../../../../tfjs-core/src/ops/one_hot.ts","../../../../../tfjs-core/src/globals.ts","../../../../../../tfjs-core/src/ops/imag.ts","../../../../../../tfjs-core/src/ops/neg.ts","../../../../../../tfjs-core/src/ops/real.ts","../../../../../../tfjs-core/src/ops/transpose.ts","../../../../../../tfjs-core/src/ops/confusion_matrix.ts","../../../../../tfjs-core/src/math.ts","../../../../../../tfjs-core/src/ops/broadcast_util.ts","../../../../../../tfjs-core/src/ops/tensor3d.ts","../../../../../../tfjs-core/src/ops/browser.ts","../../../../../../tfjs-core/src/ops/gather_nd_util.ts","../../../../../../tfjs-core/src/ops/scatter_nd_util.ts","../../../../../../tfjs-core/src/ops/slice_util.ts","../../../../../tfjs-core/src/serialization.ts","../../../../../tfjs-core/src/test_util.ts","../../../../../tfjs-core/src/version.ts","../../../../../../tfjs-core/src/ops/add.ts","../../../../../../tfjs-core/src/ops/floorDiv.ts","../../../../../../tfjs-core/src/ops/div.ts","../../../../../../tfjs-core/src/ops/mul.ts","../../../../../../tfjs-core/src/ops/abs.ts","../../../../../../tfjs-core/src/ops/acos.ts","../../../../../../tfjs-core/src/ops/acosh.ts","../../../../../../tfjs-core/src/ops/add_n.ts","../../../../../../tfjs-core/src/ops/all.ts","../../../../../../tfjs-core/src/ops/any.ts","../../../../../../tfjs-core/src/ops/arg_max.ts","../../../../../../tfjs-core/src/ops/arg_min.ts","../../../../../../tfjs-core/src/ops/asin.ts","../../../../../../tfjs-core/src/ops/asinh.ts","../../../../../../tfjs-core/src/ops/atan.ts","../../../../../../tfjs-core/src/ops/atan2.ts","../../../../../../tfjs-core/src/ops/atanh.ts","../../../../../../tfjs-core/src/ops/conv_util.ts","../../../../../../tfjs-core/src/ops/reshape.ts","../../../../../../tfjs-core/src/ops/avg_pool.ts","../../../../../../tfjs-core/src/ops/avg_pool_3d.ts","../../../../../../tfjs-core/src/ops/concat.ts","../../../../../../tfjs-core/src/ops/sigmoid.ts","../../../../../../tfjs-core/src/ops/slice.ts","../../../../../../tfjs-core/src/ops/tanh.ts","../../../../../../tfjs-core/src/ops/basic_lstm_cell.ts","../../../../../../tfjs-core/src/ops/batch_to_space_nd.ts","../../../../../../tfjs-core/src/ops/batchnorm_util.ts","../../../../../../tfjs-core/src/ops/batchnorm.ts","../../../../../../tfjs-core/src/ops/batchnorm2d.ts","../../../../../../tfjs-core/src/ops/batchnorm3d.ts","../../../../../../tfjs-core/src/ops/batchnorm4d.ts","../../../../../../tfjs-core/src/ops/bincount.ts","../../../../../../tfjs-core/src/ops/broadcast_args.ts","../../../../../../tfjs-core/src/ops/broadcast_to.ts","../../../../../../tfjs-core/src/ops/ceil.ts","../../../../../../tfjs-core/src/ops/fill.ts","../../../../../../tfjs-core/src/ops/clip_by_value.ts","../../../../../../tfjs-core/src/ops/concat_1d.ts","../../../../../../tfjs-core/src/ops/concat_2d.ts","../../../../../../tfjs-core/src/ops/concat_3d.ts","../../../../../../tfjs-core/src/ops/concat_4d.ts","../../../../../../tfjs-core/src/ops/conv2d.ts","../../../../../../tfjs-core/src/ops/conv1d.ts","../../../../../../tfjs-core/src/ops/conv2d_backprop_input.ts","../../../../../../tfjs-core/src/ops/conv2d_transpose.ts","../../../../../../tfjs-core/src/ops/conv3d.ts","../../../../../../tfjs-core/src/ops/conv3d_backprop_input.ts","../../../../../../tfjs-core/src/ops/conv3d_transpose.ts","../../../../../../tfjs-core/src/ops/cos.ts","../../../../../../tfjs-core/src/ops/cosh.ts","../../../../../../tfjs-core/src/ops/cumprod.ts","../../../../../../tfjs-core/src/ops/cumsum.ts","../../../../../../tfjs-core/src/ops/dense_bincount.ts","../../../../../../tfjs-core/src/ops/depth_to_space.ts","../../../../../../tfjs-core/src/ops/depthwise_conv2d.ts","../../../../../../tfjs-core/src/ops/diag.ts","../../../../../../tfjs-core/src/ops/dilation2d.ts","../../../../../../tfjs-core/src/ops/equal.ts","../../../../../../tfjs-core/src/ops/where.ts","../../../../../../tfjs-core/src/ops/zeros_like.ts","../../../../../../tfjs-core/src/ops/div_no_nan.ts","../../../../../../tfjs-core/src/ops/dot.ts","../../../../../../tfjs-core/src/ops/einsum.ts","../../../../../../tfjs-core/src/ops/elu.ts","../../../../../../tfjs-core/src/ops/erf.ts","../../../../../../tfjs-core/src/ops/axis_util.ts","../../../../../../tfjs-core/src/ops/max.ts","../../../../../../tfjs-core/src/ops/min.ts","../../../../../../tfjs-core/src/ops/pow.ts","../../../../../../tfjs-core/src/ops/scalar.ts","../../../../../../tfjs-core/src/ops/sqrt.ts","../../../../../../tfjs-core/src/ops/square.ts","../../../../../../tfjs-core/src/ops/sum.ts","../../../../../../tfjs-core/src/ops/norm.ts","../../../../../../tfjs-core/src/ops/euclidean_norm.ts","../../../../../../tfjs-core/src/ops/exp.ts","../../../../../../tfjs-core/src/ops/expand_dims.ts","../../../../../../tfjs-core/src/ops/expm1.ts","../../../../../../tfjs-core/src/ops/tile.ts","../../../../../../tfjs-core/src/ops/eye.ts","../../../../../../tfjs-core/src/ops/floor.ts","../../../../../../tfjs-core/src/ops/gather.ts","../../../../../../tfjs-core/src/ops/greater.ts","../../../../../../tfjs-core/src/ops/greater_equal.ts","../../../../../../tfjs-core/src/ops/is_finite.ts","../../../../../../tfjs-core/src/ops/is_inf.ts","../../../../../../tfjs-core/src/ops/is_nan.ts","../../../../../../tfjs-core/src/ops/leaky_relu.ts","../../../../../../tfjs-core/src/ops/less.ts","../../../../../../tfjs-core/src/ops/less_equal.ts","../../../../../../tfjs-core/src/ops/linspace.ts","../../../../../../tfjs-core/src/ops/local_response_normalization.ts","../../../../../../tfjs-core/src/ops/log.ts","../../../../../../tfjs-core/src/ops/log1p.ts","../../../../../tfjs-core/src/gradients.ts","../../../../../../tfjs-core/src/ops/softplus.ts","../../../../../../tfjs-core/src/ops/log_sigmoid.ts","../../../../../../tfjs-core/src/ops/sub.ts","../../../../../../tfjs-core/src/ops/log_softmax.ts","../../../../../../tfjs-core/src/ops/log_sum_exp.ts","../../../../../../tfjs-core/src/ops/logical_and.ts","../../../../../../tfjs-core/src/ops/logical_not.ts","../../../../../../tfjs-core/src/ops/logical_or.ts","../../../../../../tfjs-core/src/ops/logical_xor.ts","../../../../../../tfjs-core/src/ops/search_sorted.ts","../../../../../../tfjs-core/src/ops/lower_bound.ts","../../../../../../tfjs-core/src/ops/max_pool.ts","../../../../../../tfjs-core/src/ops/max_pool_3d.ts","../../../../../../tfjs-core/src/ops/max_pool_with_argmax.ts","../../../../../../tfjs-core/src/ops/maximum.ts","../../../../../../tfjs-core/src/ops/mean.ts","../../../../../../tfjs-core/src/ops/zeros.ts","../../../../../../tfjs-core/src/ops/ones.ts","../../../../../../tfjs-core/src/ops/meshgrid.ts","../../../../../../tfjs-core/src/ops/minimum.ts","../../../../../../tfjs-core/src/ops/mirror_pad.ts","../../../../../../tfjs-core/src/ops/mod.ts","../../../../../../tfjs-core/src/ops/moments.ts","../../../../../../tfjs-core/src/ops/multi_rnn_cell.ts","../../../../../../tfjs-core/src/ops/multinomial.ts","../../../../../../tfjs-core/src/ops/not_equal.ts","../../../../../../tfjs-core/src/ops/ones_like.ts","../../../../../../tfjs-core/src/ops/outer_product.ts","../../../../../../tfjs-core/src/ops/pad.ts","../../../../../../tfjs-core/src/ops/pad1d.ts","../../../../../../tfjs-core/src/ops/pad2d.ts","../../../../../../tfjs-core/src/ops/pad3d.ts","../../../../../../tfjs-core/src/ops/pad4d.ts","../../../../../../tfjs-core/src/ops/space_to_batch_nd.ts","../../../../../../tfjs-core/src/ops/pool.ts","../../../../../../tfjs-core/src/ops/prelu.ts","../../../../../../tfjs-core/src/ops/prod.ts","../../../../../../tfjs-core/src/ops/ragged_gather.ts","../../../../../../tfjs-core/src/ops/ragged_range.ts","../../../../../../tfjs-core/src/ops/ragged_tensor_to_tensor.ts","../../../../../../tfjs-core/src/ops/rand.ts","node_modules/seedrandom/lib/alea.js","node_modules/seedrandom/lib/xor128.js","node_modules/seedrandom/lib/xorwow.js","node_modules/seedrandom/lib/xorshift7.js","node_modules/seedrandom/lib/xor4096.js","node_modules/seedrandom/lib/tychei.js","node_modules/seedrandom/seedrandom.js","node_modules/seedrandom/index.js","../../../../../../tfjs-core/src/ops/rand_util.ts","../../../../../../tfjs-core/src/ops/random_gamma.ts","../../../../../../tfjs-core/src/ops/random_normal.ts","../../../../../../tfjs-core/src/ops/random_standard_normal.ts","../../../../../../tfjs-core/src/ops/random_uniform.ts","../../../../../../tfjs-core/src/ops/range.ts","../../../../../../tfjs-core/src/ops/reciprocal.ts","../../../../../../tfjs-core/src/ops/relu.ts","../../../../../../tfjs-core/src/ops/relu6.ts","../../../../../../tfjs-core/src/ops/reverse.ts","../../../../../../tfjs-core/src/ops/reverse_1d.ts","../../../../../../tfjs-core/src/ops/reverse_2d.ts","../../../../../../tfjs-core/src/ops/reverse_3d.ts","../../../../../../tfjs-core/src/ops/reverse_4d.ts","../../../../../../tfjs-core/src/ops/round.ts","../../../../../../tfjs-core/src/ops/rsqrt.ts","../../../../../../tfjs-core/src/ops/selu.ts","../../../../../../tfjs-core/src/ops/separable_conv2d.ts","../../../../../../tfjs-core/src/ops/setdiff1d_async.ts","../../../../../../tfjs-core/src/ops/sign.ts","../../../../../../tfjs-core/src/ops/sin.ts","../../../../../../tfjs-core/src/ops/sinh.ts","../../../../../../tfjs-core/src/ops/slice1d.ts","../../../../../../tfjs-core/src/ops/slice2d.ts","../../../../../../tfjs-core/src/ops/slice3d.ts","../../../../../../tfjs-core/src/ops/slice4d.ts","../../../../../../tfjs-core/src/ops/softmax.ts","../../../../../../../tfjs-core/src/ops/spectral/fft.ts","../../../../../../../tfjs-core/src/ops/spectral/ifft.ts","../../../../../../../tfjs-core/src/ops/spectral/irfft.ts","../../../../../../tfjs-core/src/ops/split.ts","../../../../../../../tfjs-core/src/ops/spectral/rfft.ts","../../../../../../tfjs-core/src/ops/squared_difference.ts","../../../../../../tfjs-core/src/ops/squeeze.ts","../../../../../../tfjs-core/src/ops/stack.ts","../../../../../../tfjs-core/src/ops/step.ts","../../../../../../tfjs-core/src/ops/strided_slice.ts","../../../../../../tfjs-core/src/ops/tan.ts","../../../../../../tfjs-core/src/ops/tensor1d.ts","../../../../../../tfjs-core/src/ops/tensor2d.ts","../../../../../../tfjs-core/src/ops/tensor4d.ts","../../../../../../tfjs-core/src/ops/tensor5d.ts","../../../../../../tfjs-core/src/ops/tensor6d.ts","../../../../../../tfjs-core/src/ops/topk.ts","../../../../../../tfjs-core/src/ops/truncated_normal.ts","../../../../../../tfjs-core/src/ops/unique.ts","../../../../../../tfjs-core/src/ops/unsorted_segment_sum.ts","../../../../../../tfjs-core/src/ops/unstack.ts","../../../../../../tfjs-core/src/ops/upper_bound.ts","../../../../../../tfjs-core/src/ops/variable.ts","../../../../../../tfjs-core/src/backends/where_impl.ts","../../../../../../tfjs-core/src/ops/where_async.ts","../../../../../../tfjs-core/src/ops/boolean_mask.ts","../../../../../../tfjs-core/src/ops/moving_average.ts","../../../../../../tfjs-core/src/ops/scatter_nd.ts","../../../../../../tfjs-core/src/ops/sparse_to_dense_util.ts","../../../../../../tfjs-core/src/ops/sparse_to_dense.ts","../../../../../../tfjs-core/src/ops/gather_nd.ts","../../../../../../tfjs-core/src/ops/dropout_util.ts","../../../../../../tfjs-core/src/ops/dropout.ts","../../../../../../tfjs-core/src/ops/signal_ops_util.ts","../../../../../../tfjs-core/src/ops/in_top_k.ts","../../../../../../tfjs-core/src/ops/conv2d_backprop_filter.ts","../../../../../../tfjs-core/src/ops/fused_util.ts","../../../../../../../tfjs-core/src/ops/fused/conv2d.ts","../../../../../../tfjs-core/src/ops/depthwise_conv2d_native_backprop_filter.ts","../../../../../../tfjs-core/src/ops/depthwise_conv2d_native_backprop_input.ts","../../../../../../../tfjs-core/src/ops/fused/depthwise_conv2d.ts","../../../../../../../tfjs-core/src/ops/fused/mat_mul.ts","../../../../../../tfjs-core/src/ops/fused_ops.ts","../../../../../../../tfjs-core/src/ops/signal/hamming_window.ts","../../../../../../../tfjs-core/src/ops/signal/hann_window.ts","../../../../../../../tfjs-core/src/ops/signal/frame.ts","../../../../../../../tfjs-core/src/ops/signal/stft.ts","../../../../../../../tfjs-core/src/ops/image/crop_and_resize.ts","../../../../../../../tfjs-core/src/ops/image/flip_left_right.ts","../../../../../../../tfjs-core/src/ops/image/grayscale_to_rgb.ts","../../../../../../../tfjs-core/src/ops/image/rotate_with_offset.ts","../../../../../../tfjs-core/src/ops/nonmax_util.ts","../../../../../../../tfjs-core/src/ops/image/non_max_suppression.ts","../../../../../../tfjs-core/src/backends/non_max_suppression_util.ts","../../../../../../tfjs-core/src/backends/non_max_suppression_impl.ts","../../../../../../../tfjs-core/src/ops/image/non_max_suppression_async.ts","../../../../../../../tfjs-core/src/ops/image/non_max_suppression_with_score.ts","../../../../../../../tfjs-core/src/ops/image/non_max_suppression_with_score_async.ts","../../../../../../../tfjs-core/src/ops/image/non_max_suppression_padded.ts","../../../../../../../tfjs-core/src/ops/image/non_max_suppression_padded_async.ts","../../../../../../../tfjs-core/src/ops/image/resize_bilinear.ts","../../../../../../../tfjs-core/src/ops/image/resize_nearest_neighbor.ts","../../../../../../../tfjs-core/src/ops/image/threshold.ts","../../../../../../../tfjs-core/src/ops/image/transform.ts","../../../../../../../tfjs-core/src/ops/linalg/band_part.ts","../../../../../../../tfjs-core/src/ops/linalg/gram_schmidt.ts","../../../../../../../tfjs-core/src/ops/linalg/qr.ts","../../../../../../tfjs-core/src/ops/loss_ops_utils.ts","../../../../../../../tfjs-core/src/ops/losses/compute_weighted_loss.ts","../../../../../../../tfjs-core/src/ops/losses/absolute_difference.ts","../../../../../../../tfjs-core/src/ops/losses/cosine_distance.ts","../../../../../../../tfjs-core/src/ops/losses/hinge_loss.ts","../../../../../../../tfjs-core/src/ops/losses/huber_loss.ts","../../../../../../../tfjs-core/src/ops/losses/log_loss.ts","../../../../../../../tfjs-core/src/ops/losses/mean_squared_error.ts","../../../../../../../tfjs-core/src/ops/losses/sigmoid_cross_entropy.ts","../../../../../../../tfjs-core/src/ops/losses/softmax_cross_entropy.ts","../../../../../../../tfjs-core/src/ops/sparse/sparse_fill_empty_rows.ts","../../../../../../../tfjs-core/src/ops/sparse/sparse_reshape.ts","../../../../../../../tfjs-core/src/ops/sparse/sparse_segment_mean.ts","../../../../../../../tfjs-core/src/ops/sparse/sparse_segment_sum.ts","../../../../../../../tfjs-core/src/ops/string/string_n_grams.ts","../../../../../../../tfjs-core/src/ops/string/string_split.ts","../../../../../../../tfjs-core/src/ops/string/string_to_hash_bucket_fast.ts","../../../../../../tfjs-core/src/ops/ops.ts","../../../../../../tfjs-core/src/optimizers/optimizer.ts","../../../../../../tfjs-core/src/optimizers/adadelta_optimizer.ts","../../../../../../tfjs-core/src/optimizers/adagrad_optimizer.ts","../../../../../../tfjs-core/src/optimizers/adam_optimizer.ts","../../../../../../tfjs-core/src/optimizers/adamax_optimizer.ts","../../../../../../tfjs-core/src/optimizers/sgd_optimizer.ts","../../../../../../tfjs-core/src/optimizers/momentum_optimizer.ts","../../../../../../tfjs-core/src/optimizers/rmsprop_optimizer.ts","../../../../../../tfjs-core/src/optimizers/optimizer_constructors.ts","../../../../../tfjs-core/src/train.ts","../../../../../tfjs-core/src/browser_util.ts","../../../../../../tfjs-core/src/ops/concat_util.ts","../../../../../../tfjs-core/src/ops/ragged_to_dense_util.ts","../../../../../../tfjs-core/src/ops/reduce_util.ts","../../../../../../tfjs-core/src/ops/rotate_util.ts","../../../../../../tfjs-core/src/ops/array_ops_util.ts","../../../../../../tfjs-core/src/ops/selu_util.ts","../../../../../../tfjs-core/src/ops/erf_util.ts","../../../../../../tfjs-core/src/backends/complex_util.ts","../../../../../../tfjs-core/src/backends/einsum_util.ts","../../../../../../tfjs-core/src/ops/split_util.ts","../../../../../../../tfjs-core/src/ops/sparse/sparse_fill_empty_rows_util.ts","../../../../../../../tfjs-core/src/ops/sparse/sparse_reshape_util.ts","../../../../../../../tfjs-core/src/ops/sparse/sparse_segment_reduction_util.ts","../../../../../../tfjs-core/src/ops/segment_util.ts","../../../../../../tfjs-core/src/backends/backend_util.ts","../../../../../../tfjs-core/src/backends/kernel_impls.ts","../../../../../tfjs-core/src/base.ts","../../../../../tfjs-core/src/index.ts","../../../../../tfjs-backend-webgl/src/canvas_util.ts","../../../../../tfjs-backend-webgl/src/tex_util.ts","../../../../../tfjs-backend-webgl/src/webgl_util.ts","../../../../../tfjs-backend-webgl/src/flags_webgl.ts","../../../../../tfjs-backend-webgl/src/glsl_version.ts","../../../../../tfjs-backend-webgl/src/shader_compiler_util.ts","../../../../../tfjs-backend-webgl/src/shader_compiler.ts","../../../../../tfjs-backend-webgl/src/gpgpu_math.ts","../../../../../tfjs-backend-webgl/src/decode_matrix_gpu.ts","../../../../../tfjs-backend-webgl/src/decode_matrix_packed_gpu.ts","../../../../../tfjs-backend-webgl/src/encode_float_gpu.ts","../../../../../tfjs-backend-webgl/src/encode_float_packed_gpu.ts","../../../../../tfjs-backend-webgl/src/encode_matrix_gpu.ts","../../../../../tfjs-backend-webgl/src/encode_matrix_packed_gpu.ts","../../../../../tfjs-backend-webgl/src/gpgpu_util.ts","../../../../../tfjs-backend-webgl/src/gpgpu_context.ts","../../../../../tfjs-backend-cpu/src/cpu_util.ts","../../../../../../tfjs-backend-cpu/src/kernels/Abs.ts","../../../../../../tfjs-backend-cpu/src/utils/binary_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/Complex.ts","../../../../../../tfjs-backend-cpu/src/utils/zeros_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/Identity.ts","../../../../../../tfjs-backend-cpu/src/kernels/Real.ts","../../../../../../tfjs-backend-cpu/src/kernels/Cast.ts","../../../../../../tfjs-backend-cpu/src/utils/binary_utils.ts","../../../../../../tfjs-backend-cpu/src/kernels/Add.ts","../../../../../../tfjs-backend-cpu/src/kernels/Bincount_impl.ts","../../../../../../tfjs-backend-cpu/src/utils/unary_impl.ts","../../../../../../tfjs-backend-cpu/src/utils/unary_utils.ts","../../../../../../tfjs-backend-cpu/src/kernels/Ceil.ts","../../../../../../tfjs-backend-cpu/src/kernels/Concat_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/Equal.ts","../../../../../../tfjs-backend-cpu/src/kernels/Exp.ts","../../../../../../tfjs-backend-cpu/src/kernels/Expm1.ts","../../../../../../tfjs-backend-cpu/src/kernels/Floor.ts","../../../../../../tfjs-backend-cpu/src/kernels/GatherNd_Impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/GatherV2_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/Greater.ts","../../../../../../tfjs-backend-cpu/src/kernels/GreaterEqual.ts","../../../../../../tfjs-backend-cpu/src/kernels/Less.ts","../../../../../../tfjs-backend-cpu/src/kernels/LessEqual.ts","../../../../../../tfjs-backend-cpu/src/kernels/LinSpace_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/Log.ts","../../../../../../tfjs-backend-cpu/src/kernels/Max_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/Maximum.ts","../../../../../../tfjs-backend-cpu/src/kernels/Minimum.ts","../../../../../../tfjs-backend-cpu/src/kernels/Multiply.ts","../../../../../../tfjs-backend-cpu/src/kernels/Neg.ts","../../../../../../tfjs-backend-cpu/src/kernels/NotEqual.ts","../../../../../../tfjs-backend-cpu/src/kernels/Transpose_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/Transpose.ts","../../../../../../tfjs-backend-cpu/src/kernels/Prod.ts","../../../../../../tfjs-backend-cpu/src/kernels/RaggedGather_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/RaggedRange_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/RaggedTensorToTensor_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/Range_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/Rsqrt.ts","../../../../../../tfjs-backend-cpu/src/kernels/Scatter_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/Sigmoid.ts","../../../../../../tfjs-backend-cpu/src/kernels/Slice.ts","../../../../../../tfjs-backend-cpu/src/kernels/SparseFillEmptyRows_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/SparseReshape_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/SparseSegmentReduction_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/Sqrt.ts","../../../../../../tfjs-backend-cpu/src/kernels/SquaredDifference.ts","../../../../../../tfjs-backend-cpu/src/kernels/StridedSlice_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/StringNGrams_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/StringSplit_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/StringToHashBucketFast_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/Sub.ts","../../../../../../tfjs-backend-cpu/src/kernels/Tile_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/TopK_impl.ts","../../../../../../tfjs-backend-cpu/src/kernels/Unique_impl.ts","../../../../../tfjs-backend-cpu/src/shared.ts","../../../../../../tfjs-backend-webgl/src/kernel_utils/shared.ts","../../../../../tfjs-backend-webgl/src/packing_util.ts","../../../../../tfjs-backend-webgl/src/pack_gpu.ts","../../../../../tfjs-backend-webgl/src/reshape_packed_gpu.ts","../../../../../tfjs-backend-webgl/src/texture_manager.ts","../../../../../tfjs-backend-webgl/src/unaryop_gpu.ts","../../../../../tfjs-backend-webgl/src/unaryop_packed_gpu.ts","../../../../../tfjs-backend-webgl/src/unpack_gpu.ts","../../../../../tfjs-backend-webgl/src/backend_webgl.ts","../../../../../tfjs-backend-webgl/src/version.ts","../../../../../tfjs-backend-webgl/src/webgl.ts","../../../../../tfjs-backend-webgl/src/base.ts","../../../../../tfjs-backend-webgl/src/binaryop_gpu.ts","../../../../../tfjs-backend-webgl/src/binaryop_packed_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/Identity.ts","../../../../../../tfjs-backend-webgl/src/kernels/Complex.ts","../../../../../../tfjs-backend-webgl/src/kernels/LeakyRelu.ts","../../../../../../tfjs-backend-webgl/src/kernels/Prelu.ts","../../../../../../tfjs-backend-webgl/src/kernel_utils/kernel_funcs_utils.ts","../../../../../tfjs-backend-webgl/src/mulmat_packed_gpu.ts","../../../../../tfjs-backend-webgl/src/binaryop_complex_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/Multiply.ts","../../../../../../tfjs-backend-webgl/src/kernel_utils/reshape.ts","../../../../../../tfjs-backend-webgl/src/kernels/Reshape.ts","../../../../../tfjs-backend-webgl/src/mean_gpu.ts","../../../../../tfjs-backend-webgl/src/reduce_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernel_utils/reduce.ts","../../../../../tfjs-backend-webgl/src/transpose_gpu.ts","../../../../../tfjs-backend-webgl/src/transpose_packed_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/Transpose_impl.ts","../../../../../../tfjs-backend-webgl/src/kernels/Sum_impl.ts","../../../../../../tfjs-backend-webgl/src/kernels/Sum.ts","../../../../../../tfjs-backend-webgl/src/kernels/Transpose.ts","../../../../../../tfjs-backend-webgl/src/kernels/BatchMatMul_impl.ts","../../../../../../tfjs-backend-webgl/src/kernels/_FusedMatMul.ts","../../../../../../tfjs-backend-webgl/src/kernels/Abs.ts","../../../../../../tfjs-backend-webgl/src/kernels/Acos.ts","../../../../../../tfjs-backend-webgl/src/kernels/Acosh.ts","../../../../../../tfjs-backend-webgl/src/kernels/Add.ts","../../../../../tfjs-backend-webgl/src/addn_gpu.ts","../../../../../tfjs-backend-webgl/src/addn_packed_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/AddN.ts","../../../../../../tfjs-backend-webgl/src/kernels/All.ts","../../../../../../tfjs-backend-webgl/src/kernels/Any.ts","../../../../../tfjs-backend-webgl/src/argminmax_gpu.ts","../../../../../tfjs-backend-webgl/src/argminmax_packed_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernel_utils/arg_min_max.ts","../../../../../../tfjs-backend-webgl/src/kernels/ArgMax.ts","../../../../../../tfjs-backend-webgl/src/kernels/ArgMin.ts","../../../../../../tfjs-backend-webgl/src/kernels/Asin.ts","../../../../../../tfjs-backend-webgl/src/kernels/Asinh.ts","../../../../../../tfjs-backend-webgl/src/kernels/Atan.ts","../../../../../../tfjs-backend-webgl/src/kernels/Atan2.ts","../../../../../../tfjs-backend-webgl/src/kernels/Atanh.ts","../../../../../tfjs-backend-webgl/src/pool_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/AvgPool.ts","../../../../../../tfjs-backend-webgl/src/kernels/AvgPool3D.ts","../../../../../tfjs-backend-webgl/src/avg_pool_backprop_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/AvgPool3DGrad.ts","../../../../../../tfjs-backend-webgl/src/kernels/AvgPoolGrad.ts","../../../../../../tfjs-backend-webgl/src/kernels/BatchMatMul.ts","../../../../../tfjs-backend-webgl/src/batchnorm_gpu.ts","../../../../../tfjs-backend-webgl/src/batchnorm_packed_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/BatchNorm.ts","../../../../../tfjs-backend-webgl/src/slice_gpu.ts","../../../../../tfjs-backend-webgl/src/slice_packed_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/Slice.ts","../../../../../../tfjs-backend-webgl/src/kernels/BatchToSpaceND.ts","../../../../../../tfjs-backend-webgl/src/kernels/Bincount.ts","../../../../../../tfjs-backend-webgl/src/kernels/BroadcastArgs.ts","../../../../../../tfjs-backend-webgl/src/kernels/NotEqual.ts","../../../../../../tfjs-backend-webgl/src/kernels/Real.ts","../../../../../../tfjs-backend-webgl/src/kernel_utils/int.ts","../../../../../../tfjs-backend-webgl/src/kernels/Cast.ts","../../../../../../tfjs-backend-webgl/src/kernels/Ceil.ts","../../../../../tfjs-backend-webgl/src/clip_gpu.ts","../../../../../tfjs-backend-webgl/src/clip_packed_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/ClipByValue.ts","../../../../../tfjs-backend-webgl/src/complex_abs_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/ComplexAbs.ts","../../../../../tfjs-backend-webgl/src/concat_gpu.ts","../../../../../tfjs-backend-webgl/src/concat_packed_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/Imag.ts","../../../../../../tfjs-backend-webgl/src/kernels/Concat_impl.ts","../../../../../../tfjs-backend-webgl/src/kernels/Concat.ts","../../../../../tfjs-backend-webgl/src/conv_gpu.ts","../../../../../tfjs-backend-webgl/src/conv_packed_gpu.ts","../../../../../tfjs-backend-webgl/src/im2col_packed_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/Conv2D_impl.ts","../../../../../../tfjs-backend-webgl/src/kernels/Conv2D.ts","../../../../../tfjs-backend-webgl/src/conv_backprop_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/Conv2DBackpropFilter.ts","../../../../../../tfjs-backend-webgl/src/kernels/Conv2DBackpropInput.ts","../../../../../../tfjs-backend-webgl/src/kernels/Conv3D.ts","../../../../../../tfjs-backend-webgl/src/kernels/Conv3DBackpropFilterV2.ts","../../../../../../tfjs-backend-webgl/src/kernels/Conv3DBackpropInputV2.ts","../../../../../../tfjs-backend-webgl/src/kernels/Cos.ts","../../../../../../tfjs-backend-webgl/src/kernels/Cosh.ts","../../../../../tfjs-backend-webgl/src/crop_and_resize_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/CropAndResize.ts","../../../../../tfjs-backend-webgl/src/cum_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/Cum_impl.ts","../../../../../../tfjs-backend-webgl/src/kernels/Cumprod.ts","../../../../../../tfjs-backend-webgl/src/kernels/Cumsum.ts","../../../../../../tfjs-backend-webgl/src/kernels/DenseBincount.ts","../../../../../tfjs-backend-webgl/src/depth_to_space_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/DepthToSpace.ts","../../../../../tfjs-backend-webgl/src/conv_gpu_depthwise.ts","../../../../../tfjs-backend-webgl/src/conv_packed_gpu_depthwise.ts","../../../../../../tfjs-backend-webgl/src/kernels/DepthwiseConv2dNative.ts","../../../../../tfjs-backend-webgl/src/conv_backprop_gpu_depthwise.ts","../../../../../../tfjs-backend-webgl/src/kernels/DepthwiseConv2dNativeBackpropFilter.ts","../../../../../../tfjs-backend-webgl/src/kernels/DepthwiseConv2dNativeBackpropInput.ts","../../../../../tfjs-backend-webgl/src/diag_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/Diag.ts","../../../../../tfjs-backend-webgl/src/dilation_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/Dilation2D.ts","../../../../../../tfjs-backend-webgl/src/kernels/Einsum.ts","../../../../../../tfjs-backend-webgl/src/kernels/Elu.ts","../../../../../../tfjs-backend-webgl/src/kernels/EluGrad.ts","../../../../../../tfjs-backend-webgl/src/kernels/Equal.ts","../../../../../../tfjs-backend-webgl/src/kernels/Erf.ts","../../../../../../tfjs-backend-webgl/src/kernels/Exp.ts","../../../../../../tfjs-backend-webgl/src/kernels/ExpandDims.ts","../../../../../../tfjs-backend-webgl/src/kernels/Expm1.ts","../../../../../tfjs-backend-webgl/src/fft_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/FFT_impl.ts","../../../../../../tfjs-backend-webgl/src/kernels/FFT.ts","../../../../../tfjs-backend-webgl/src/fill_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/Fill.ts","../../../../../tfjs-backend-webgl/src/flip_left_right_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/FlipLeftRight.ts","../../../../../../tfjs-backend-webgl/src/kernels/Floor.ts","../../../../../../tfjs-backend-webgl/src/kernels/FloorDiv.ts","../../../../../../../tfjs-backend-webgl/src/kernels/FromPixels_utils/from_pixels_gpu.ts","../../../../../../../tfjs-backend-webgl/src/kernels/FromPixels_utils/from_pixels_packed_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/FromPixels.ts","../../../../../../tfjs-backend-webgl/src/kernels/FusedConv2D.ts","../../../../../../tfjs-backend-webgl/src/kernels/FusedDepthwiseConv2D.ts","../../../../../tfjs-backend-webgl/src/gather_nd_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/GatherNd.ts","../../../../../tfjs-backend-webgl/src/gather_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/GatherV2.ts","../../../../../../tfjs-backend-webgl/src/kernels/Greater.ts","../../../../../../tfjs-backend-webgl/src/kernels/GreaterEqual.ts","../../../../../../tfjs-backend-webgl/src/kernels/IFFT.ts","../../../../../../tfjs-backend-webgl/src/kernels/IsFinite.ts","../../../../../../tfjs-backend-webgl/src/kernels/IsInf.ts","../../../../../../tfjs-backend-webgl/src/kernels/IsNaN.ts","../../../../../../tfjs-backend-webgl/src/kernels/Less.ts","../../../../../../tfjs-backend-webgl/src/kernels/LessEqual.ts","../../../../../../tfjs-backend-webgl/src/kernels/LinSpace.ts","../../../../../../tfjs-backend-webgl/src/kernels/Log.ts","../../../../../../tfjs-backend-webgl/src/kernels/Log1p.ts","../../../../../../tfjs-backend-webgl/src/kernels/LogicalAnd.ts","../../../../../../tfjs-backend-webgl/src/kernels/LogicalNot.ts","../../../../../../tfjs-backend-webgl/src/kernels/LogicalOr.ts","../../../../../tfjs-backend-webgl/src/lrn_gpu.ts","../../../../../tfjs-backend-webgl/src/lrn_packed_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/LRN.ts","../../../../../tfjs-backend-webgl/src/lrn_grad_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/LRNGrad.ts","../../../../../../tfjs-backend-webgl/src/kernels/Max_impl.ts","../../../../../../tfjs-backend-webgl/src/kernels/Max.ts","../../../../../../tfjs-backend-webgl/src/kernels/Maximum.ts","../../../../../../tfjs-backend-webgl/src/kernels/MaxPool.ts","../../../../../../tfjs-backend-webgl/src/kernels/MaxPool3D.ts","../../../../../tfjs-backend-webgl/src/max_pool_backprop_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/MaxPool3DGrad.ts","../../../../../../tfjs-backend-webgl/src/kernels/MaxPoolGrad.ts","../../../../../../tfjs-backend-webgl/src/kernels/MaxPoolWithArgmax_impl.ts","../../../../../../tfjs-backend-webgl/src/kernels/MaxPoolWithArgmax.ts","../../../../../../tfjs-backend-webgl/src/kernels/Mean_impl.ts","../../../../../../tfjs-backend-webgl/src/kernels/Mean.ts","../../../../../../tfjs-backend-webgl/src/kernels/Min.ts","../../../../../../tfjs-backend-webgl/src/kernels/Minimum.ts","../../../../../tfjs-backend-webgl/src/mirror_pad_gpu.ts","../../../../../tfjs-backend-webgl/src/mirror_pad_packed_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/MirrorPad.ts","../../../../../../tfjs-backend-webgl/src/kernels/Mod.ts","../../../../../tfjs-backend-webgl/src/multinomial_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/RealDiv.ts","../../../../../../tfjs-backend-webgl/src/kernels/Sub.ts","../../../../../../tfjs-backend-webgl/src/kernels/Softmax.ts","../../../../../../tfjs-backend-webgl/src/kernels/Multinomial.ts","../../../../../../tfjs-backend-webgl/src/kernels/Neg.ts","../../../../../../tfjs-backend-webgl/src/kernels/NonMaxSuppressionV3.ts","../../../../../../tfjs-backend-webgl/src/kernels/NonMaxSuppressionV4.ts","../../../../../../tfjs-backend-webgl/src/kernels/NonMaxSuppressionV5.ts","../../../../../tfjs-backend-webgl/src/onehot_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/OneHot.ts","../../../../../../tfjs-backend-webgl/src/kernels/ZerosLike.ts","../../../../../../tfjs-backend-webgl/src/kernels/OnesLike.ts","../../../../../../tfjs-backend-webgl/src/kernels/Pack.ts","../../../../../tfjs-backend-webgl/src/pad_gpu.ts","../../../../../tfjs-backend-webgl/src/pad_packed_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/PadV2.ts","../../../../../../tfjs-backend-webgl/src/kernels/Pow.ts","../../../../../../tfjs-backend-webgl/src/kernels/Prod.ts","../../../../../../tfjs-backend-webgl/src/kernels/RaggedGather.ts","../../../../../../tfjs-backend-webgl/src/kernels/RaggedRange.ts","../../../../../../tfjs-backend-webgl/src/kernels/RaggedTensorToTensor.ts","../../../../../../tfjs-backend-webgl/src/kernels/Range.ts","../../../../../../tfjs-backend-webgl/src/kernels/Reciprocal.ts","../../../../../../tfjs-backend-webgl/src/kernels/Relu.ts","../../../../../../tfjs-backend-webgl/src/kernels/Relu6.ts","../../../../../tfjs-backend-webgl/src/resize_bilinear_gpu.ts","../../../../../tfjs-backend-webgl/src/resize_bilinear_packed_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/ResizeBilinear.ts","../../../../../tfjs-backend-webgl/src/resize_bilinear_backprop_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/ResizeBilinearGrad.ts","../../../../../tfjs-backend-webgl/src/resize_nearest_neighbor_gpu.ts","../../../../../tfjs-backend-webgl/src/resize_nearest_neighbor_packed_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/ResizeNearestNeighbor.ts","../../../../../tfjs-backend-webgl/src/resize_nearest_neighbor_backprop_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/ResizeNearestNeighborGrad.ts","../../../../../tfjs-backend-webgl/src/reverse_gpu.ts","../../../../../tfjs-backend-webgl/src/reverse_packed_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/Reverse.ts","../../../../../tfjs-backend-webgl/src/rotate_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/RotateWithOffset.ts","../../../../../../tfjs-backend-webgl/src/kernels/Round.ts","../../../../../../tfjs-backend-webgl/src/kernels/Rsqrt.ts","../../../../../tfjs-backend-webgl/src/scatter_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/ScatterNd.ts","../../../../../tfjs-backend-webgl/src/search_sorted_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/SearchSorted.ts","../../../../../tfjs-backend-webgl/src/select_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/Select.ts","../../../../../../tfjs-backend-webgl/src/kernels/Selu.ts","../../../../../../tfjs-backend-webgl/src/kernels/Sigmoid.ts","../../../../../../tfjs-backend-webgl/src/kernels/Sign.ts","../../../../../../tfjs-backend-webgl/src/kernels/Sin.ts","../../../../../../tfjs-backend-webgl/src/kernels/Sinh.ts","../../../../../../tfjs-backend-webgl/src/kernels/Softplus.ts","../../../../../../tfjs-backend-webgl/src/kernels/SpaceToBatchND.ts","../../../../../../tfjs-backend-webgl/src/kernels/SparseFillEmptyRows.ts","../../../../../../tfjs-backend-webgl/src/kernels/SparseReshape.ts","../../../../../../tfjs-backend-webgl/src/kernels/SparseSegmentMean.ts","../../../../../../tfjs-backend-webgl/src/kernels/SparseSegmentSum.ts","../../../../../../tfjs-backend-webgl/src/kernels/SparseToDense.ts","../../../../../../tfjs-backend-webgl/src/kernels/SplitV.ts","../../../../../../tfjs-backend-webgl/src/kernels/Sqrt.ts","../../../../../../tfjs-backend-webgl/src/kernels/Square.ts","../../../../../../tfjs-backend-webgl/src/kernels/SquaredDifference.ts","../../../../../../tfjs-backend-webgl/src/kernels/Step.ts","../../../../../tfjs-backend-webgl/src/strided_slice_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/StridedSlice.ts","../../../../../../tfjs-backend-webgl/src/kernels/StringNGrams.ts","../../../../../../tfjs-backend-webgl/src/kernels/StringSplit.ts","../../../../../../tfjs-backend-webgl/src/kernels/StringToHashBucketFast.ts","../../../../../../tfjs-backend-webgl/src/kernels/Tan.ts","../../../../../../tfjs-backend-webgl/src/kernels/Tanh.ts","../../../../../tfjs-backend-webgl/src/tile_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/Tile.ts","../../../../../tfjs-backend-webgl/src/top_k_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/TopK.ts","../../../../../tfjs-backend-webgl/src/transform_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/Transform.ts","../../../../../../tfjs-backend-webgl/src/kernels/Unique.ts","../../../../../../tfjs-backend-webgl/src/kernels/Unpack.ts","../../../../../tfjs-backend-webgl/src/segment_gpu.ts","../../../../../../tfjs-backend-webgl/src/kernels/UnsortedSegmentSum.ts","../../../../../tfjs-backend-webgl/src/register_all_kernels.ts","../../../../../tfjs-backend-webgl/src/index.ts","../../../../../tfjs-backend-webgpu/src/flags_webgpu.ts","../../../../../tfjs-backend-webgpu/src/adapter_info.ts","../../../../../tfjs-backend-webgpu/src/buffer_manager.ts","../../../../../tfjs-backend-webgpu/src/texture_manager.ts","../../../../../tfjs-backend-webgpu/src/shader_util.ts","../../../../../tfjs-backend-webgpu/src/webgpu_program.ts","../../../../../tfjs-backend-webgpu/src/webgpu_util.ts","../../../../../tfjs-backend-webgpu/src/backend_webgpu.ts","../../../../../tfjs-backend-webgpu/src/webgpu.ts","../../../../../tfjs-backend-webgpu/src/base.ts","../../../../../tfjs-backend-webgpu/src/binary_op_util.ts","../../../../../tfjs-backend-webgpu/src/unary_op_util.ts","../../../../../tfjs-backend-webgpu/src/activation_util.ts","../../../../../tfjs-backend-webgpu/src/matmul_packed_webgpu.ts","../../../../../tfjs-backend-webgpu/src/matmul_reduce_webgpu.ts","../../../../../tfjs-backend-webgpu/src/matmul_small_output_size_webgpu.ts","../../../../../tfjs-backend-webgpu/src/matmul_splitK_webgpu.ts","../../../../../tfjs-backend-webgpu/src/fill_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Fill.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Reshape.ts","../../../../../../tfjs-backend-webgpu/src/kernels/BatchMatMul_impl.ts","../../../../../../tfjs-backend-webgpu/src/kernels/_FusedMatMul.ts","../../../../../tfjs-backend-webgpu/src/binary_op_complex_webgpu.ts","../../../../../tfjs-backend-webgpu/src/binary_op_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Identity.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Complex.ts","../../../../../tfjs-backend-webgpu/src/unary_op_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernel_utils/kernel_funcs_utils.ts","../../../../../../tfjs-backend-webgpu/src/kernel_utils/shared.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Abs.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Add.ts","../../../../../tfjs-backend-webgpu/src/addn_packed_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/AddN.ts","../../../../../tfjs-backend-webgpu/src/argminmax_webgpu.ts","../../../../../tfjs-backend-webgpu/src/transpose_shared_webgpu.ts","../../../../../tfjs-backend-webgpu/src/transpose_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Transpose.ts","../../../../../../tfjs-backend-webgpu/src/kernels/ArgMax.ts","../../../../../../tfjs-backend-webgpu/src/kernels/ArgMin.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Atan2.ts","../../../../../tfjs-backend-webgpu/src/pool2d_webgpu.ts","../../../../../tfjs-backend-webgpu/src/pool_filtersizeone_webgpu.ts","../../../../../tfjs-backend-webgpu/src/reduce_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernel_utils/reduce.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Max.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Mean.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Pool_impl.ts","../../../../../../tfjs-backend-webgpu/src/kernels/AvgPool.ts","../../../../../../tfjs-backend-webgpu/src/kernels/BatchMatMul.ts","../../../../../tfjs-backend-webgpu/src/slice_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Slice.ts","../../../../../../tfjs-backend-webgpu/src/kernels/BatchToSpaceND.ts","../../../../../../tfjs-backend-webgpu/src/kernels/NotEqual.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Real.ts","../../../../../../tfjs-backend-webgpu/src/kernel_utils/int.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Cast.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Ceil.ts","../../../../../tfjs-backend-webgpu/src/clip_vec4_webgpu.ts","../../../../../tfjs-backend-webgpu/src/clip_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/ClipByValue.ts","../../../../../tfjs-backend-webgpu/src/concat_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Imag.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Concat_impl.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Concat.ts","../../../../../tfjs-backend-webgpu/src/conv2d_mm_webgpu.ts","../../../../../tfjs-backend-webgpu/src/conv2d_naive_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Conv2D_impl.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Conv2D.ts","../../../../../tfjs-backend-webgpu/src/conv_backprop_mm_webgpu.ts","../../../../../tfjs-backend-webgpu/src/conv_backprop_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Conv2DBackpropInput.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Cos.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Cosh.ts","../../../../../tfjs-backend-webgpu/src/crop_and_resize_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/CropAndResize.ts","../../../../../tfjs-backend-webgpu/src/cum_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Cum_impl.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Cumprod.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Cumsum.ts","../../../../../tfjs-backend-webgpu/src/depth_to_space_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/DepthToSpace.ts","../../../../../tfjs-backend-webgpu/src/depthwise_conv2d_nchw_shared_webgpu.ts","../../../../../tfjs-backend-webgpu/src/depthwise_conv2d_vec4_webgpu.ts","../../../../../tfjs-backend-webgpu/src/depthwise_conv2d_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/DepthwiseConv2dNative.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Multiply.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Sum.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Einsum.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Elu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Equal.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Exp.ts","../../../../../../tfjs-backend-webgpu/src/kernels/ExpandDims.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Expm1.ts","../../../../../tfjs-backend-webgpu/src/flip_left_right_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/FlipLeftRight.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Floor.ts","../../../../../../tfjs-backend-webgpu/src/kernels/FloorDiv.ts","../../../../../tfjs-backend-webgpu/src/from_pixels_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/FromPixels.ts","../../../../../tfjs-backend-webgpu/src/batchnorm_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/FusedBatchNorm.ts","../../../../../../tfjs-backend-webgpu/src/kernels/FusedConv2D.ts","../../../../../../tfjs-backend-webgpu/src/kernels/FusedDepthwiseConv2D.ts","../../../../../tfjs-backend-webgpu/src/gather_nd_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/GatherNd.ts","../../../../../tfjs-backend-webgpu/src/gather_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/GatherV2.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Greater.ts","../../../../../../tfjs-backend-webgpu/src/kernels/GreaterEqual.ts","../../../../../../tfjs-backend-webgpu/src/kernels/IsNaN.ts","../../../../../../tfjs-backend-webgpu/src/kernels/LeakyRelu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Less.ts","../../../../../../tfjs-backend-webgpu/src/kernels/LessEqual.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Log.ts","../../../../../../tfjs-backend-webgpu/src/kernels/LogicalAnd.ts","../../../../../../tfjs-backend-webgpu/src/kernels/LogicalNot.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Maximum.ts","../../../../../../tfjs-backend-webgpu/src/kernels/MaxPool.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Min.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Minimum.ts","../../../../../tfjs-backend-webgpu/src/mirror_pad_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/MirrorPad.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Neg.ts","../../../../../../tfjs-backend-webgpu/src/kernels/NonMaxSuppressionV3.ts","../../../../../../tfjs-backend-webgpu/src/kernels/NonMaxSuppressionV5.ts","../../../../../../tfjs-backend-webgpu/src/kernels/ZerosLike.ts","../../../../../../tfjs-backend-webgpu/src/kernels/OnesLike.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Pack.ts","../../../../../tfjs-backend-webgpu/src/pad_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/PadV2.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Pow.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Prelu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Prod.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Range.ts","../../../../../../tfjs-backend-webgpu/src/kernels/RealDiv.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Reciprocal.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Relu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Relu6.ts","../../../../../tfjs-backend-webgpu/src/resize_bilinear_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/ResizeBilinear.ts","../../../../../tfjs-backend-webgpu/src/resize_nearest_neighbor_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/ResizeNearestNeighbor.ts","../../../../../tfjs-backend-webgpu/src/rotate_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/RotateWithOffset.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Rsqrt.ts","../../../../../tfjs-backend-webgpu/src/scatter_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/ScatterNd.ts","../../../../../tfjs-backend-webgpu/src/select_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Select.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Sigmoid.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Sin.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Sinh.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Sub.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Softmax.ts","../../../../../../tfjs-backend-webgpu/src/kernels/SpaceToBatchND.ts","../../../../../tfjs-backend-webgpu/src/tile_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Tile.ts","../../../../../../tfjs-backend-webgpu/src/kernels/SparseToDense.ts","../../../../../../tfjs-backend-webgpu/src/kernels/SplitV.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Sqrt.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Square.ts","../../../../../../tfjs-backend-webgpu/src/kernels/SquaredDifference.ts","../../../../../tfjs-backend-webgpu/src/strided_slice_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/StridedSlice.ts","../../../../../../tfjs-backend-webgpu/src/kernels/StringNGrams.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Tanh.ts","../../../../../tfjs-backend-webgpu/src/top_k_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/TopK.ts","../../../../../tfjs-backend-webgpu/src/transform_webgpu.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Transform.ts","../../../../../../tfjs-backend-webgpu/src/kernels/Unpack.ts","../../../../../tfjs-backend-webgpu/src/register_all_kernels.ts","../../../../../tfjs-backend-webgpu/src/index.ts","node_modules/@mediapipe/pose/pose.js","../../../../../../tfjs-backend-wasm/src/kernels/types.ts","../../../../../../tfjs-backend-wasm/src/kernels/_FusedMatMul.ts","../../../../../../tfjs-backend-wasm/src/kernels/unary_kernel.ts","../../../../../../tfjs-backend-wasm/src/kernels/Abs.ts","../../../../../../tfjs-backend-wasm/src/kernels/binary_kernel.ts","../../../../../../tfjs-backend-wasm/src/kernels/Add.ts","../../../../../../tfjs-backend-wasm/src/kernels/AddN.ts","../../../../../../tfjs-backend-wasm/src/kernels/Identity.ts","../../../../../../tfjs-backend-wasm/src/kernels/Transpose.ts","../../../../../../tfjs-backend-wasm/src/kernels/kernel_utils.ts","../../../../../../tfjs-backend-wasm/src/kernels/All.ts","../../../../../../tfjs-backend-wasm/src/kernels/Any.ts","../../../../../../tfjs-backend-wasm/src/kernels/ArgMax.ts","../../../../../../tfjs-backend-wasm/src/kernels/AvgPool.ts","../../../../../../tfjs-backend-wasm/src/kernels/Reshape.ts","../../../../../../tfjs-backend-wasm/src/kernels/BatchMatMul.ts","../../../../../../tfjs-backend-wasm/src/kernel_utils/shared.ts","../../../../../../tfjs-backend-wasm/src/kernels/Slice.ts","../../../../../../tfjs-backend-wasm/src/kernels/BatchToSpaceND.ts","../../../../../../tfjs-backend-wasm/src/kernels/Cast.ts","../../../../../../tfjs-backend-wasm/src/kernels/Ceil.ts","../../../../../../tfjs-backend-wasm/src/kernels/ClipByValue.ts","../../../../../../tfjs-backend-wasm/src/kernels/Concat.ts","../../../../../../tfjs-backend-wasm/src/kernels/Conv2D.ts","../../../../../../tfjs-backend-wasm/src/kernels/Conv2DBackpropInput.ts","../../../../../../tfjs-backend-wasm/src/kernels/Cos.ts","../../../../../../tfjs-backend-wasm/src/kernels/Cosh.ts","../../../../../../tfjs-backend-wasm/src/kernels/CropAndResize.ts","../../../../../../tfjs-backend-wasm/src/kernels/Cumprod.ts","../../../../../../tfjs-backend-wasm/src/kernels/Cumsum.ts","../../../../../../tfjs-backend-wasm/src/kernels/DepthToSpace.ts","../../../../../../tfjs-backend-wasm/src/kernels/DepthwiseConv2dNative.ts","../../../../../../tfjs-backend-wasm/src/kernels/Elu.ts","../../../../../../tfjs-backend-wasm/src/kernels/Equal.ts","../../../../../../tfjs-backend-wasm/src/kernels/Exp.ts","../../../../../../tfjs-backend-wasm/src/kernels/ExpandDims.ts","../../../../../../tfjs-backend-wasm/src/kernels/Fill.ts","../../../../../../tfjs-backend-wasm/src/kernels/FlipLeftRight.ts","../../../../../../tfjs-backend-wasm/src/kernels/Floor.ts","../../../../../../tfjs-backend-wasm/src/kernels/FloorDiv.ts","../../../../../../tfjs-backend-wasm/src/kernels/FusedBatchNorm.ts","../../../../../../tfjs-backend-wasm/src/kernels/FusedConv2D.ts","../../../../../../tfjs-backend-wasm/src/kernels/FusedDepthwiseConv2D.ts","../../../../../../tfjs-backend-wasm/src/kernels/GatherNd.ts","../../../../../../tfjs-backend-wasm/src/kernels/GatherV2.ts","../../../../../../tfjs-backend-wasm/src/kernels/Greater.ts","../../../../../../tfjs-backend-wasm/src/kernels/GreaterEqual.ts","../../../../../../tfjs-backend-wasm/src/kernels/LeakyRelu.ts","../../../../../../tfjs-backend-wasm/src/kernels/Less.ts","../../../../../../tfjs-backend-wasm/src/kernels/LessEqual.ts","../../../../../../tfjs-backend-wasm/src/kernels/Log.ts","../../../../../../tfjs-backend-wasm/src/kernels/LogicalAnd.ts","../../../../../../tfjs-backend-wasm/src/kernels/LogicalNot.ts","../../../../../../tfjs-backend-wasm/src/kernels/LogicalOr.ts","../../../../../../tfjs-backend-wasm/src/kernels/LogicalXor.ts","../../../../../../tfjs-backend-wasm/src/kernels/Max.ts","../../../../../../tfjs-backend-wasm/src/kernels/Maximum.ts","../../../../../../tfjs-backend-wasm/src/kernels/MaxPool.ts","../../../../../../tfjs-backend-wasm/src/kernels/Mean.ts","../../../../../../tfjs-backend-wasm/src/kernels/Min.ts","../../../../../../tfjs-backend-wasm/src/kernels/Minimum.ts","../../../../../../tfjs-backend-wasm/src/kernels/MirrorPad.ts","../../../../../../tfjs-backend-wasm/src/kernels/Multiply.ts","../../../../../../tfjs-backend-wasm/src/kernels/Neg.ts","../../../../../../tfjs-backend-wasm/src/kernels/NonMaxSuppression_util.ts","../../../../../../tfjs-backend-wasm/src/kernels/NonMaxSuppressionV3.ts","../../../../../../tfjs-backend-wasm/src/kernels/NonMaxSuppressionV4.ts","../../../../../../tfjs-backend-wasm/src/kernels/NonMaxSuppressionV5.ts","../../../../../../tfjs-backend-wasm/src/kernels/NotEqual.ts","../../../../../../tfjs-backend-wasm/src/kernels/OneHot.ts","../../../../../../tfjs-backend-wasm/src/kernels/OnesLike.ts","../../../../../../tfjs-backend-wasm/src/kernels/Pack.ts","../../../../../../tfjs-backend-wasm/src/kernels/PadV2.ts","../../../../../../tfjs-backend-wasm/src/kernels/Pow.ts","../../../../../../tfjs-backend-wasm/src/kernels/Prelu.ts","../../../../../../tfjs-backend-wasm/src/kernels/Prod.ts","../../../../../../tfjs-backend-wasm/src/kernels/Range.ts","../../../../../../tfjs-backend-wasm/src/kernels/RealDiv.ts","../../../../../../tfjs-backend-wasm/src/kernels/Relu.ts","../../../../../../tfjs-backend-wasm/src/kernels/Relu6.ts","../../../../../../tfjs-backend-wasm/src/kernels/ResizeBilinear.ts","../../../../../../tfjs-backend-wasm/src/kernels/ResizeNearestNeighbor.ts","../../../../../../tfjs-backend-wasm/src/kernels/Reverse.ts","../../../../../../tfjs-backend-wasm/src/kernels/RotateWithOffset.ts","../../../../../../tfjs-backend-wasm/src/kernels/Round.ts","../../../../../../tfjs-backend-wasm/src/kernels/Rsqrt.ts","../../../../../../tfjs-backend-wasm/src/kernels/ScatterNd.ts","../../../../../../tfjs-backend-wasm/src/kernels/Select.ts","../../../../../../tfjs-backend-wasm/src/kernels/Sigmoid.ts","../../../../../../tfjs-backend-wasm/src/kernels/Sin.ts","../../../../../../tfjs-backend-wasm/src/kernels/Softmax.ts","../../../../../../tfjs-backend-wasm/src/kernels/SpaceToBatchND.ts","../../../../../../tfjs-backend-wasm/src/kernels/SparseFillEmptyRows.ts","../../../../../../tfjs-backend-wasm/src/kernels/SparseReshape.ts","../../../../../../tfjs-backend-wasm/src/kernels/SparseSegmentReduction.ts","../../../../../../tfjs-backend-wasm/src/kernels/SparseSegmentMean.ts","../../../../../../tfjs-backend-wasm/src/kernels/SparseSegmentSum.ts","../../../../../../tfjs-backend-wasm/src/kernels/SplitV.ts","../../../../../../tfjs-backend-wasm/src/kernels/Sqrt.ts","../../../../../../tfjs-backend-wasm/src/kernels/Square.ts","../../../../../../tfjs-backend-wasm/src/kernels/SquaredDifference.ts","../../../../../../tfjs-backend-wasm/src/kernels/Step.ts","../../../../../../tfjs-backend-wasm/src/kernels/StridedSlice.ts","../../../../../../tfjs-backend-wasm/src/kernels/StringNGrams.ts","../../../../../../tfjs-backend-wasm/src/kernels/StringSplit.ts","../../../../../../tfjs-backend-wasm/src/kernels/StringToHashBucketFast.ts","../../../../../../tfjs-backend-wasm/src/kernels/Sub.ts","../../../../../../tfjs-backend-wasm/src/kernels/Sum.ts","../../../../../../tfjs-backend-wasm/src/kernels/Tan.ts","../../../../../../tfjs-backend-wasm/src/kernels/Tanh.ts","../../../../../../tfjs-backend-wasm/src/kernels/Tile.ts","../../../../../../tfjs-backend-wasm/src/kernels/TopK.ts","../../../../../../tfjs-backend-wasm/src/kernels/Transform.ts","../../../../../../tfjs-backend-wasm/src/kernels/Unpack.ts","../../../../../../tfjs-backend-wasm/src/kernels/ZerosLike.ts","../../../../../tfjs-backend-wasm/src/register_all_kernels.ts","../../../../../tfjs-backend-wasm/src/flags_wasm.ts","node_modules/@tensorflow/tfjs-backend-wasm/wasm-out/tfjs-backend-wasm-threaded-simd.js","node_modules/@tensorflow/tfjs-backend-wasm/wasm-out/tfjs-backend-wasm-threaded-simd.worker.js","node_modules/@tensorflow/tfjs-backend-wasm/wasm-out/tfjs-backend-wasm.js","../../../../../tfjs-backend-wasm/src/backend_wasm.ts","../../../../../tfjs-backend-wasm/src/version.ts","../../../../../tfjs-backend-wasm/src/base.ts","../../../../../tfjs-backend-wasm/src/index.ts","../src/constants.ts","../../../src/shared/calculators/mask_util.ts","../../src/blazepose_mediapipe/constants.ts","../../src/blazepose_mediapipe/detector_utils.ts","../../src/blazepose_mediapipe/detector.ts","../../../../../tfjs-converter/src/flags.ts","../../../../../../tfjs-converter/src/data/compiled_api.ts","../../../../../../../tfjs-converter/src/operations/custom_op/register.ts","../../../../../../../tfjs-converter/src/operations/executors/utils.ts","../../../../../../../tfjs-converter/src/operations/op_list/arithmetic.ts","../../../../../../../tfjs-converter/src/operations/op_list/basic_math.ts","../../../../../../../tfjs-converter/src/operations/op_list/control.ts","../../../../../../../tfjs-converter/src/operations/op_list/convolution.ts","../../../../../../../tfjs-converter/src/operations/op_list/creation.ts","../../../../../../../tfjs-converter/src/operations/op_list/dynamic.ts","../../../../../../../tfjs-converter/src/operations/op_list/evaluation.ts","../../../../../../../tfjs-converter/src/operations/op_list/graph.ts","../../../../../../../tfjs-converter/src/operations/op_list/hash_table.ts","../../../../../../../tfjs-converter/src/operations/op_list/image.ts","../../../../../../../tfjs-converter/src/operations/op_list/logical.ts","../../../../../../../tfjs-converter/src/operations/op_list/matrices.ts","../../../../../../../tfjs-converter/src/operations/op_list/normalization.ts","../../../../../../../tfjs-converter/src/operations/op_list/reduction.ts","../../../../../../../tfjs-converter/src/operations/op_list/slice_join.ts","../../../../../../../tfjs-converter/src/operations/op_list/sparse.ts","../../../../../../../tfjs-converter/src/operations/op_list/spectral.ts","../../../../../../../tfjs-converter/src/operations/op_list/string.ts","../../../../../../../tfjs-converter/src/operations/op_list/transformation.ts","../../../../../../tfjs-converter/src/operations/operation_mapper.ts","../../../../../../../tfjs-converter/src/operations/custom_op/node_value_impl.ts","../../../../../../tfjs-core/src/ops/ops_for_converter.ts","../../../../../../../tfjs-converter/src/operations/executors/arithmetic_executor.ts","../../../../../../../tfjs-converter/src/operations/executors/basic_math_executor.ts","../../../../../../tfjs-converter/src/executor/tensor_utils.ts","../../../../../../tfjs-converter/src/executor/tensor_array.ts","../../../../../../tfjs-converter/src/executor/tensor_list.ts","../../../../../../../tfjs-converter/src/operations/executors/control_executor.ts","../../../../../../../tfjs-converter/src/operations/executors/convolution_executor.ts","../../../../../../../tfjs-converter/src/operations/executors/creation_executor.ts","../../../../../../../tfjs-converter/src/operations/executors/dynamic_executor.ts","../../../../../../../tfjs-converter/src/operations/executors/evaluation_executor.ts","../../../../../../../tfjs-converter/src/operations/executors/graph_executor.ts","../../../../../../tfjs-converter/src/executor/hash_table.ts","../../../../../../../tfjs-converter/src/operations/executors/hash_table_executor.ts","../../../../../../../tfjs-converter/src/operations/executors/image_executor.ts","../../../../../../../tfjs-converter/src/operations/executors/logical_executor.ts","../../../../../../../tfjs-converter/src/operations/executors/matrices_executor.ts","../../../../../../../tfjs-converter/src/operations/executors/normalization_executor.ts","../../../../../../../tfjs-converter/src/operations/executors/reduction_executor.ts","../../../../../../../tfjs-converter/src/operations/executors/slice_join_executor.ts","../../../../../../../tfjs-converter/src/operations/executors/sparse_executor.ts","../../../../../../../tfjs-converter/src/operations/executors/spectral_executor.ts","../../../../../../../tfjs-converter/src/operations/executors/string_executor.ts","../../../../../../../tfjs-converter/src/operations/executors/transformation_executor.ts","../../../../../../tfjs-converter/src/operations/operation_executor.ts","../../../../../../tfjs-converter/src/executor/execution_context.ts","../../../../../../tfjs-converter/src/executor/model_analysis.ts","../../../../../../tfjs-converter/src/executor/graph_executor.ts","../../../../../../tfjs-converter/src/executor/resource_manager.ts","../../../../../../tfjs-converter/src/executor/graph_model.ts","../../../../../tfjs-converter/src/version.ts","../../../../../tfjs-converter/src/index.ts","../../../src/shared/calculators/image_utils.ts","../../../src/shared/calculators/detection_to_rect.ts","../../../src/shared/calculators/calculate_alignment_points_rects.ts","../../../src/shared/calculators/calculate_inverse_matrix.ts","../../../src/shared/calculators/calculate_landmark_projection.ts","../../../src/shared/calculators/calculate_score_copy.ts","../../../src/shared/calculators/calculate_world_landmark_projection.ts","../../../src/shared/calculators/constants.ts","../../../src/shared/calculators/get_rotated_sub_rect_to_rect_transformation_matrix.ts","../../../src/shared/calculators/shift_image_value.ts","../../../src/shared/calculators/convert_image_to_tensor.ts","../../../src/shared/calculators/create_ssd_anchors.ts","../../../src/shared/calculators/split_detection_result.ts","../../../src/shared/calculators/detector_result.ts","../../../src/shared/calculators/is_video.ts","../../../src/shared/calculators/landmarks_to_detection.ts","../../../src/shared/calculators/non_max_suppression.ts","../../../src/shared/calculators/normalized_keypoints_to_keypoints.ts","../../../src/shared/calculators/refine_landmarks_from_heatmap.ts","../../../src/shared/calculators/remove_detection_letterbox.ts","../../../src/shared/calculators/remove_landmark_letterbox.ts","../../../src/shared/calculators/segmentation_smoothing.ts","../../../src/shared/calculators/tensors_to_detections.ts","../../../src/shared/calculators/sigmoid.ts","../../../src/shared/calculators/tensors_to_landmarks.ts","../../../src/shared/calculators/tensors_to_segmentation.ts","../../../src/shared/calculators/transform_rect.ts","../../../src/shared/calculators/get_object_scale.ts","../../../src/shared/calculators/keypoints_to_normalized_keypoints.ts","../../../src/shared/filters/low_pass_filter.ts","../../../src/shared/filters/one_euro_filter.ts","../../../src/shared/filters/keypoints_one_euro_filter.ts","../../../src/shared/filters/relative_velocity_filter.ts","../../../src/shared/filters/keypoints_velocity_filter.ts","../../../src/shared/filters/keypoints_smoothing.ts","../../../src/shared/filters/visibility_smoothing.ts","../../src/blazepose_tfjs/constants.ts","../../src/blazepose_tfjs/detector_utils.ts","../../src/blazepose_tfjs/detector.ts","../../src/calculators/tracker_utils.ts","../../src/calculators/tracker.ts","../../src/calculators/bounding_box_tracker.ts","../../src/calculators/keypoint_tracker.ts","../../src/calculators/types.ts","../src/types.ts","../src/util.ts","../../src/movenet/constants.ts","../../src/movenet/crop_utils.ts","../../src/movenet/detector_utils.ts","../../src/movenet/detector.ts","../../src/posenet/constants.ts","../../../src/posenet/calculators/max_heap.ts","../../../src/posenet/calculators/build_part_with_score_queue.ts","../../../src/posenet/calculators/decode_multiple_poses_util.ts","../../../src/posenet/calculators/decode_multiple_poses.ts","../../../src/posenet/calculators/decode_single_pose_util.ts","../../../src/posenet/calculators/decode_single_pose.ts","../../../src/posenet/calculators/flip_poses.ts","../../../src/posenet/calculators/scale_poses.ts","../../src/posenet/detector_utils.ts","../../src/posenet/load_utils.ts","../../src/posenet/detector.ts","../src/create_detector.ts","../src/index.ts","src/stats_panel.js","src/params.js","src/camera.js","src/option_panel.js","src/util.js","src/index.js"],"names":["process","module","exports","cachedSetTimeout","cachedClearTimeout","defaultSetTimout","Error","defaultClearTimeout","setTimeout","e","clearTimeout","runTimeout","fun","call","runClearTimeout","marker","queue","draining","currentQueue","queueIndex","cleanUpNextTick","length","concat","drainQueue","timeout","len","run","nextTick","args","Array","arguments","i","push","Item","array","prototype","apply","title","env","argv","version","versions","noop","on","addListener","once","off","removeListener","removeAllListeners","emit","prependListener","prependOnceListener","listeners","name","binding","cwd","chdir","dir","umask","setupStats","stats","Stats","customFpsPanel","addPanel","Panel","showPanel","domElement","children","parent","document","getElementById","appendChild","statsPanes","querySelectorAll","style","width","height","DEFAULT_LINE_WIDTH","DEFAULT_RADIUS","STATE","backend","flags","modelConfig","BLAZEPOSE_CONFIG","maxPoses","type","scoreThreshold","POSENET_CONFIG","MOVENET_CONFIG","TUNABLE_FLAG_VALUE_RANGE_MAP","WEBGL_VERSION","WASM_HAS_SIMD_SUPPORT","WASM_HAS_MULTITHREAD_SUPPORT","WEBGL_CPU_FORWARD","WEBGL_PACK","WEBGL_FORCE_F16_TEXTURES","WEBGL_RENDER_FLOAT32_CAPABLE","WEBGL_FLUSH_THRESHOLD","CHECK_COMPUTATION_FOR_ERRORS","BACKEND_FLAGS_MAP","MODEL_BACKEND_MAP","posedetection","SupportedModels","PoseNet","MoveNet","BlazePose","TUNABLE_FLAG_NAME_MAP","PROD","Context","constructor","video","canvas","source","ctx","getContext","stream","captureStream","options","mimeType","mediaRecorder","MediaRecorder","ondataavailable","handleDataAvailable","drawCtx","drawImage","videoWidth","videoHeight","clearCtx","clearRect","drawResults","poses","pose","drawResult","keypoints","drawKeypoints","drawSkeleton","keypointInd","util","getKeypointIndexBySide","params","model","fillStyle","strokeStyle","lineWidth","middle","drawKeypoint","left","right","keypoint","score","circle","Path2D","arc","x","y","Math","PI","fill","stroke","getAdjacentPairs","forEach","j","kp1","kp2","score1","score2","beginPath","moveTo","lineTo","start","stop","event","data","size","recordedChunks","blob","Blob","url","URL","createObjectURL","a","createElement","body","href","download","click","window","revokeObjectURL","TUNABLE_FLAG_DEFAULT_VALUE_MAP","stringValueMap","backendFolder","setupDatGui","urlParams","gui","dat","GUI","id","modelFolder","addFolder","get","backendFromURL","alert","modelController","add","Object","values","onChange","_","isModelChanged","showModelConfigs","showBackendConfigs","open","folderController","fixedSelectionCount","__controllers","remove","backends","backendController","isBackendChanged","showFlagSettings","addPoseNetControllers","addMoveNetControllers","addBlazePoseControllers","modelConfigFolder","typeController","initDefaultValueMap","index","flag","tf","getAsync","indexOf","getTunableRange","defaultValue","tunableRange","value","showBackendFlagSettings","backendName","tunableFlags","flagName","flagValueRange","console","warn","flagController","realValue","stringValue","String","onFinishChange","isFlagChanged","isMobile","isAndroid","test","navigator","userAgent","isiOS","resetBackend","ENGINE","engine","registryFactory","lastTFJSBackend","registry","backendFactory","findBackendFactory","removeBackend","registerBackend","setBackend","setBackendAndEnvFlags","flagConfig","setFlags","runtime","$backend","split","tfjsWasm","setWasmPaths","version_wasm","detector","camera","startInferenceTime","numInferences","inferenceTimeSum","lastPanelUpdate","rafId","statusElement","createDetector","quantBytes","architecture","outputStride","inputResolution","multiplier","modelType","solutionPath","mpPose","VERSION","movenet","SINGLEPOSE_LIGHTNING","SINGLEPOSE_THUNDER","checkGuiUpdate","cancelAnimationFrame","dispose","beginEstimatePosesStats","performance","Date","now","endEstimatePosesStats","endInferenceTime","panelUpdateMilliseconds","averageInferenceTime","update","renderResult","estimatePoses","flipHorizontal","updateVideo","currentSrc","file","target","files","src","load","Promise","resolve","onloadeddata","innerHTML","runFrame","paused","visibility","requestAnimationFrame","warmUpTensor","pause","currentTime","play","onseeked","app","URLSearchParams","location","search","has","runButton","onclick","uploadButton","onchange"],"mappings":";;;;;;;A8XiBA,AKAA,ACAA,AKAA,AEAA,ASAA,AEAA,ACAA,AEDA,AGCA,ACAA,ACAA,AGAA,ACAA,ACAA,ACAA,AEAA,ACEA,AtBDA,AuBDA,AtDAA,ASAA,AXAA,A0mBjBA,AviBAA,AsmBAA;A/pBiBA,APA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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;ACzxCA;;;;;;AAlBA;;;;;;;;;;;;;;;;AAgBA;AACA;AAEA;AACA,MAAM,IAAI,GACN;AACC,WAAmB,CAAC,OAApB,IAA+B,W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AAGA,SAAO,eAAO,UAAP,CAAkB,MAAlB,EAAwC,KAAxC,EAA+C,KAA/C,CAAP;AACD;;;;;;;;;ACpED;;AAIA;;AAtBA;;;;;;;;;;;;;;;;;AAwBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0FM,SAAU,MAAV,CACF,MADE,EAC4B,KAD5B,EAEF,KAFE,EAEc;AAClB,QAAM,aAAa,GAAG,iCAAW,MAAX,EAAmB,KAAnB,CAAtB;AACA,SAAO,iCAAW,MAAX,EAAmB,KAAnB,EAA0B,aAA1B,EAAyC,KAAzC,CAAP;AACD;;;;;;;;;ACvHD;;;;;;;;;;;;;;;;;AAiBA;;AAEA;;;AAGO,MAAM,oBAAoB,GAA8B;AAC7D,aAAW,CADkD;AAE7D,aAAW,CAFkD;AAG7D,WAAS,CAHoD;AAI7D,YAAU,CAJmD;AAK7D,WAAS,CALoD;AAM7D,UAAQ,CANqD;AAO7D,eAAa;AAPgD,CAAxD;;;ACtBP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrFA;AACA;AACA;AACA;AACA;AACA;;;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;AC5uDA;;AACA;;AAGA;;AAEA;;AAvBA;;;;;;;;;;;;;;;;;AAyBA;AACA,MAAM,uBAAuB,GAAG,CAAhC;AAEA;;;;;;;;;;;;;;;;;;AAiBO,eAAe,aAAf,CACH,OADG,EACoC,KADpC,EACuD;AAE5D;AACA,QAAM,KAAK,GAA2B,EAAtC;AACA,QAAM,YAAY,GAA+B,EAAjD;AAEA,QAAM,KAAK,GAAa,KAAK,CAAC,OAAN,CAAc,OAAd,IACpB,OAAO,CAAC,GAAR,CAAY,MAAM,IAAI,MAAM,CAAC,IAA7B,CADoB,GAEpB,MAAM,CAAC,IAAP,CAAY,OAAZ,CAFJ;;AAIA,OAAK,IAAI,CAAC,GAAG,CAAb,EAAgB,CAAC,GAAG,KAAK,CAAC,MAA1B,EAAkC,EAAE,CAApC,EAAuC;AACrC,UAAM,IAAI,GAAG,KAAK,CAAC,CAAD,CAAlB;AACA,UAAM,CAAC,GAAG,KAAK,CAA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EAA0B,CAAC,EAA3B,EAA+B;AAC7B,IAAA,MAAM,CAAC,CAAD,CAAN,GAAY,YAAY,EAAxB;AACD;;AACD,SAAO,eAAO,UAAP,CAAkB,MAAlB,EAA0B,KAA1B,EAAiC,KAAjC,CAAP;AACD;;AAEM,MAAM,IAAI,GAAG,mBAAG;AAAC,EAAA;AAAD,CAAH,CAAb;;;;ACvDP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AClHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACjFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACtFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACjGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AClJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACvGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7PA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;AC3CA;;AAEA;;;;;;AAnBA;;;;;;;;;;;;;;;;AAwCA;AACM,MAAO,WAAP,CAAkB;AAUtB,EA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ACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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,OAAT;AAAsB,MAAA,OAAtB;AAA+B,MAAA,KAAK,EAAE;AAAC,QAAA;AAAD;AAAtC,KAAV,CAAT;AACD;;AAED,EAAA,SAAS,CAAC,OAAV,CAAkB,CAAC,IAAI,OAAO,CAAC,6BAAR,CAAsC,CAAtC,CAAvB;AACA,SAAO,MAAP;AACD;;AAEM,MAAM,wBAAwB,GAAiB;AACpD,EAAA,UAAU,EAAE,4BADwC;AAEpD,EAAA,WAAW,EAAE,OAFuC;AAGpD,EAAA,UAAU,EAAE;AAHwC,CAA/C;;;;;AC7FP;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;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AAtB,CAAvB;AACA,SAAO,GAAP;AACD;;AAEM,MAAM,YAAY,GAAiB;AACxC,EAAA,UAAU,EAAE,gBAD4B;AAExC,EAAA,WAAW,EAAE,QAF2B;AAGxC,EAAA,UAAU,EAAE;AAH4B,CAAnC;;;;;ACpDP;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAzHA;;;;;;;;;;;;;;;;AA2HA;AACA,MAAM,aAAa,GAAmB,CACpC,+BADoC,EAEpC,cAFoC,EAGpC,cAHoC,EAIpC,gBAJoC,EAKpC,oBALoC,EAMpC,oBANoC,EAOpC,iBAPoC,EAQpC,sBARoC,EASpC,8BAToC,EAUpC,oCAVoC,EAWpC,gBAXoC,EAYpC,gBAZoC,EAapC,8BAboC,EAcpC,sBAdoC,EAepC,oBAfoC,EAgBpC,oBAhBoC,EAiBpC,8CAjBoC,EAkBpC,cAlBoC,EAmBpC,gBAnBoC,EAoBpC,kCApBoC,EAqBpC,sBArBoC,EAsBpC,oBAtBoC,EAuBpC,gCAvBoC,EAwBpC,k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AgBC,MAApC,CAAlB;;AACA,MAAI,CAAC7I,SAAS,CAAC8I,GAAV,CAAc,OAAd,CAAL,EAA6B;AAC3BrI,IAAAA,KAAK,CAAC,wCAAD,CAAL;AACA;AACD;;AAED,QAAM,+BAAYT,SAAZ,CAAN;AACApI,EAAAA,KAAK,GAAG,8BAAR;AACAuN,EAAAA,MAAM,GAAG,IAAIvK,eAAJ,EAAT;AAEA,QAAM,iCAAsB7B,cAAME,KAA5B,EAAmCF,cAAMC,OAAzC,CAAN;AACAkM,EAAAA,QAAQ,GAAG,MAAMQ,cAAc,EAA/B;AAEA,QAAMqD,SAAS,GAAG1Q,QAAQ,CAACC,cAAT,CAAwB,QAAxB,CAAlB;AACAyQ,EAAAA,SAAS,CAACC,OAAV,GAAoBtT,GAApB;AAEA,QAAMuT,YAAY,GAAG5Q,QAAQ,CAACC,cAAT,CAAwB,WAAxB,CAArB;AACA2Q,EAAAA,YAAY,CAACC,QAAb,GAAwB5B,WAAxB;AACD;;AAAA;AAEDoB,GAAG","file":"src.a2b27638.js","sourceRoot":"..","sourcesContent":["/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Backend, DataId, DataToGPUOptions, GPUData, Tensor} from '../tensor';\nimport {BackendValues, DataType, WebGLData} from '../types';\n\nexport const EPSILON_FLOAT32 = 1e-7;\nexport const EPSILON_FLOAT16 = 1e-4;\n\n// Required information for all backends.\nexport interface BackendTimingInfo {\n kernelMs: number|{error: string};\n getExtraProfileInfo?(): string; // a field for additional timing information\n // e.g. packing / unpacking for WebGL backend\n}\n\nexport interface TensorStorage {\n read(dataId: DataId): Promise;\n readSync(dataId: DataId): BackendValues;\n disposeData(dataId: DataId, force?: boolean): boolean;\n write(values: BackendValues, shape: number[], dtype: DataType): DataId;\n move(\n dataId: DataId, values: BackendValues, shape: number[], dtype: DataType,\n refCount: number): void;\n memory(): {unreliable: boolean;}; // Backend-specific information.\n /** Returns number of data ids currently in the storage. */\n numDataIds(): number;\n refCount(dataId: DataId): number;\n}\n\n/** Convenient class for storing tensor-related data. */\nexport class DataStorage {\n private data = new WeakMap();\n private dataIdsCount = 0;\n\n constructor(private backend: KernelBackend, private dataMover: DataMover) {}\n\n get(dataId: DataId) {\n if (!this.data.has(dataId)) {\n this.dataMover.moveData(this.backend, dataId);\n }\n return this.data.get(dataId);\n }\n\n set(dataId: DataId, value: T): void {\n this.dataIdsCount++;\n this.data.set(dataId, value);\n }\n\n has(dataId: DataId): boolean {\n return this.data.has(dataId);\n }\n\n delete(dataId: DataId): boolean {\n this.dataIdsCount--;\n return this.data.delete(dataId);\n }\n\n numDataIds(): number {\n return this.dataIdsCount;\n }\n}\n\nexport interface DataMover {\n /**\n * To be called by backends whenever they see a dataId that they don't own.\n * Upon calling this method, the mover will fetch the tensor from another\n * backend and register it with the current active backend.\n */\n moveData(backend: KernelBackend, dataId: DataId): void;\n}\n\nexport interface BackendTimer {\n // check if backend timer is available\n timerAvailable(): boolean;\n time(f: () => void): Promise;\n}\n\n/**\n * The interface that defines the kernels that should be implemented when\n * adding a new backend. New backends don't need to implement every one of the\n * methods, this can be done gradually (throw an error for unimplemented\n * methods).\n */\nexport class KernelBackend implements TensorStorage, Backend, BackendTimer {\n refCount(dataId: DataId): number {\n return notYetImplemented('refCount');\n }\n incRef(dataId: DataId): void {\n return notYetImplemented('incRef');\n }\n timerAvailable(): boolean {\n return true;\n }\n time(f: () => void): Promise {\n return notYetImplemented('time');\n }\n read(dataId: object): Promise {\n return notYetImplemented('read');\n }\n readSync(dataId: object): BackendValues {\n return notYetImplemented('readSync');\n }\n readToGPU(dataId: object, options?: DataToGPUOptions): GPUData {\n return notYetImplemented('readToGPU');\n }\n numDataIds(): number {\n return notYetImplemented('numDataIds');\n }\n disposeData(dataId: object, force?: boolean): boolean {\n return notYetImplemented('disposeData');\n }\n write(values: BackendValues, shape: number[], dtype: DataType): DataId {\n return notYetImplemented('write');\n }\n move(\n dataId: DataId, values: BackendValues, shape: number[], dtype: DataType,\n refCount: number): void {\n return notYetImplemented('move');\n }\n createTensorFromTexture(values: WebGLData, shape: number[], dtype: DataType):\n Tensor {\n return notYetImplemented('createTensorFromTexture');\n }\n memory(): {unreliable: boolean; reasons?: string[]} {\n return notYetImplemented('memory');\n }\n /** Returns the highest precision for floats in bits (e.g. 16 or 32) */\n floatPrecision(): 16|32 {\n return notYetImplemented('floatPrecision');\n }\n /** Returns the smallest representable number. */\n epsilon(): number {\n return this.floatPrecision() === 32 ? EPSILON_FLOAT32 : EPSILON_FLOAT16;\n }\n dispose(): void {\n return notYetImplemented('dispose');\n }\n}\n\nfunction notYetImplemented(kernelName: string): never {\n throw new Error(\n `'${kernelName}' not yet implemented or not found in the registry. ` +\n `This kernel may not be supported by the tfjs backend you have chosen`);\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataType, DataTypeMap, FlatVector, NumericDataType, RecursiveArray, TensorLike, TypedArray, WebGLData} from './types';\n\n/**\n * Shuffles the array in-place using Fisher-Yates algorithm.\n *\n * ```js\n * const a = [1, 2, 3, 4, 5];\n * tf.util.shuffle(a);\n * console.log(a);\n * ```\n *\n * @param array The array to shuffle in-place.\n *\n * @doc {heading: 'Util', namespace: 'util'}\n */\n// tslint:disable-next-line:no-any\nexport function shuffle(array: any[]|Uint32Array|Int32Array|\n Float32Array): void {\n let counter = array.length;\n let index = 0;\n // While there are elements in the array\n while (counter > 0) {\n // Pick a random index\n index = (Math.random() * counter) | 0;\n // Decrease counter by 1\n counter--;\n // And swap the last element with it\n swap(array, counter, index);\n }\n}\n\n/**\n * Shuffles two arrays in-place the same way using Fisher-Yates algorithm.\n *\n * ```js\n * const a = [1,2,3,4,5];\n * const b = [11,22,33,44,55];\n * tf.util.shuffleCombo(a, b);\n * console.log(a, b);\n * ```\n *\n * @param array The first array to shuffle in-place.\n * @param array2 The second array to shuffle in-place with the same permutation\n * as the first array.\n *\n * @doc {heading: 'Util', namespace: 'util'}\n */\nexport function shuffleCombo(\n // tslint:disable-next-line:no-any\n array: any[]|Uint32Array|Int32Array|Float32Array,\n // tslint:disable-next-line:no-any\n array2: any[]|Uint32Array|Int32Array|Float32Array): void {\n if (array.length !== array2.length) {\n throw new Error(\n `Array sizes must match to be shuffled together ` +\n `First array length was ${array.length}` +\n `Second array length was ${array2.length}`);\n }\n let counter = array.length;\n let index = 0;\n // While there are elements in the array\n while (counter > 0) {\n // Pick a random index\n index = (Math.random() * counter) | 0;\n // Decrease counter by 1\n counter--;\n // And swap the last element of each array with it\n swap(array, counter, index);\n swap(array2, counter, index);\n }\n}\n\n/** Clamps a value to a specified range. */\nexport function clamp(min: number, x: number, max: number): number {\n return Math.max(min, Math.min(x, max));\n}\n\nexport function nearestLargerEven(val: number): number {\n return val % 2 === 0 ? val : val + 1;\n}\n\nexport function swap(\n object: {[index: number]: T}, left: number, right: number) {\n const temp = object[left];\n object[left] = object[right];\n object[right] = temp;\n}\n\nexport function sum(arr: number[]): number {\n let sum = 0;\n for (let i = 0; i < arr.length; i++) {\n sum += arr[i];\n }\n return sum;\n}\n\n/**\n * Returns a sample from a uniform [a, b) distribution.\n *\n * @param a The minimum support (inclusive).\n * @param b The maximum support (exclusive).\n * @return A pseudorandom number on the half-open interval [a,b).\n */\nexport function randUniform(a: number, b: number) {\n const r = Math.random();\n return (b * r) + (1 - r) * a;\n}\n\n/** Returns the squared Euclidean distance between two vectors. */\nexport function distSquared(a: FlatVector, b: FlatVector): number {\n let result = 0;\n for (let i = 0; i < a.length; i++) {\n const diff = Number(a[i]) - Number(b[i]);\n result += diff * diff;\n }\n return result;\n}\n\n/**\n * Asserts that the expression is true. Otherwise throws an error with the\n * provided message.\n *\n * ```js\n * const x = 2;\n * tf.util.assert(x === 2, 'x is not 2');\n * ```\n *\n * @param expr The expression to assert (as a boolean).\n * @param msg A function that returns the message to report when throwing an\n * error. We use a function for performance reasons.\n *\n * @doc {heading: 'Util', namespace: 'util'}\n */\nexport function assert(expr: boolean, msg: () => string) {\n if (!expr) {\n throw new Error(typeof msg === 'string' ? msg : msg());\n }\n}\n\nexport function assertShapesMatch(\n shapeA: number[], shapeB: number[], errorMessagePrefix = ''): void {\n assert(\n arraysEqual(shapeA, shapeB),\n () => errorMessagePrefix + ` Shapes ${shapeA} and ${shapeB} must match`);\n}\n\nexport function assertNonNull(a: TensorLike): void {\n assert(\n a != null,\n () => `The input to the tensor constructor must be a non-null value.`);\n}\n\n// NOTE: We explicitly type out what T extends instead of any so that\n// util.flatten on a nested array of number doesn't try to infer T as a\n// number[][], causing us to explicitly type util.flatten().\n/**\n * Flattens an arbitrarily nested array.\n *\n * ```js\n * const a = [[1, 2], [3, 4], [5, [6, [7]]]];\n * const flat = tf.util.flatten(a);\n * console.log(flat);\n * ```\n *\n * @param arr The nested array to flatten.\n * @param result The destination array which holds the elements.\n * @param skipTypedArray If true, avoids flattening the typed arrays. Defaults\n * to false.\n *\n * @doc {heading: 'Util', namespace: 'util'}\n */\nexport function\nflatten|TypedArray>(\n arr: T|RecursiveArray, result: T[] = [], skipTypedArray = false): T[] {\n if (result == null) {\n result = [];\n }\n if (Array.isArray(arr) || isTypedArray(arr) && !skipTypedArray) {\n for (let i = 0; i < arr.length; ++i) {\n flatten(arr[i], result, skipTypedArray);\n }\n } else {\n result.push(arr as T);\n }\n return result;\n}\n\n/**\n * Returns the size (number of elements) of the tensor given its shape.\n *\n * ```js\n * const shape = [3, 4, 2];\n * const size = tf.util.sizeFromShape(shape);\n * console.log(size);\n * ```\n *\n * @doc {heading: 'Util', namespace: 'util'}\n */\nexport function sizeFromShape(shape: number[]): number {\n if (shape.length === 0) {\n // Scalar.\n return 1;\n }\n let size = shape[0];\n for (let i = 1; i < shape.length; i++) {\n size *= shape[i];\n }\n return size;\n}\n\nexport function isScalarShape(shape: number[]): boolean {\n return shape.length === 0;\n}\n\nexport function arraysEqual(n1: FlatVector, n2: FlatVector) {\n if (n1 === n2) {\n return true;\n }\n if (n1 == null || n2 == null) {\n return false;\n }\n\n if (n1.length !== n2.length) {\n return false;\n }\n for (let i = 0; i < n1.length; i++) {\n if (n1[i] !== n2[i]) {\n return false;\n }\n }\n return true;\n}\n\nexport function isInt(a: number): boolean {\n return a % 1 === 0;\n}\n\nexport function tanh(x: number): number {\n // tslint:disable-next-line:no-any\n if ((Math as any).tanh != null) {\n // tslint:disable-next-line:no-any\n return (Math as any).tanh(x);\n }\n if (x === Infinity) {\n return 1;\n } else if (x === -Infinity) {\n return -1;\n } else {\n const e2x = Math.exp(2 * x);\n return (e2x - 1) / (e2x + 1);\n }\n}\n\nexport function sizeToSquarishShape(size: number): [number, number] {\n const width = Math.ceil(Math.sqrt(size));\n return [width, Math.ceil(size / width)];\n}\n\n/**\n * Creates a new array with randomized indices to a given quantity.\n *\n * ```js\n * const randomTen = tf.util.createShuffledIndices(10);\n * console.log(randomTen);\n * ```\n *\n * @param number Quantity of how many shuffled indices to create.\n *\n * @doc {heading: 'Util', namespace: 'util'}\n */\nexport function createShuffledIndices(n: number): Uint32Array {\n const shuffledIndices = new Uint32Array(n);\n for (let i = 0; i < n; ++i) {\n shuffledIndices[i] = i;\n }\n shuffle(shuffledIndices);\n return shuffledIndices;\n}\n\nexport function rightPad(a: string, size: number): string {\n if (size <= a.length) {\n return a;\n }\n return a + ' '.repeat(size - a.length);\n}\n\nexport function repeatedTry(\n checkFn: () => boolean, delayFn = (counter: number) => 0,\n maxCounter?: number,\n scheduleFn?: (functionRef: Function, delay: number) => void\n ): Promise {\n return new Promise((resolve, reject) => {\n let tryCount = 0;\n\n const tryFn = () => {\n if (checkFn()) {\n resolve();\n return;\n }\n\n tryCount++;\n\n const nextBackoff = delayFn(tryCount);\n\n if (maxCounter != null && tryCount >= maxCounter) {\n reject();\n return;\n }\n\n if (scheduleFn != null) {\n scheduleFn(tryFn, nextBackoff);\n } else {\n // google3 does not allow assigning another variable to setTimeout.\n // Don't refactor this so scheduleFn has a default value of setTimeout.\n setTimeout(tryFn, nextBackoff);\n }\n };\n\n tryFn();\n });\n}\n\n/**\n * Given the full size of the array and a shape that may contain -1 as the\n * implicit dimension, returns the inferred shape where -1 is replaced.\n * E.g. For shape=[2, -1, 3] and size=24, it will return [2, 4, 3].\n *\n * @param shape The shape, which may contain -1 in some dimension.\n * @param size The full size (number of elements) of the array.\n * @return The inferred shape where -1 is replaced with the inferred size.\n */\nexport function inferFromImplicitShape(\n shape: number[], size: number): number[] {\n let shapeProd = 1;\n let implicitIdx = -1;\n\n for (let i = 0; i < shape.length; ++i) {\n if (shape[i] >= 0) {\n shapeProd *= shape[i];\n } else if (shape[i] === -1) {\n if (implicitIdx !== -1) {\n throw Error(\n `Shapes can only have 1 implicit size. ` +\n `Found -1 at dim ${implicitIdx} and dim ${i}`);\n }\n implicitIdx = i;\n } else if (shape[i] < 0) {\n throw Error(`Shapes can not be < 0. Found ${shape[i]} at dim ${i}`);\n }\n }\n\n if (implicitIdx === -1) {\n if (size > 0 && size !== shapeProd) {\n throw Error(`Size(${size}) must match the product of shape ${shape}`);\n }\n return shape;\n }\n\n if (shapeProd === 0) {\n throw Error(\n `Cannot infer the missing size in [${shape}] when ` +\n `there are 0 elements`);\n }\n if (size % shapeProd !== 0) {\n throw Error(\n `The implicit shape can't be a fractional number. ` +\n `Got ${size} / ${shapeProd}`);\n }\n\n const newShape = shape.slice();\n newShape[implicitIdx] = size / shapeProd;\n return newShape;\n}\n\nexport function parseAxisParam(\n axis: number|number[], shape: number[]): number[] {\n const rank = shape.length;\n\n // Normalize input\n axis = axis == null ? shape.map((s, i) => i) : [].concat(axis);\n\n // Check for valid range\n assert(\n axis.every(ax => ax >= -rank && ax < rank),\n () =>\n `All values in axis param must be in range [-${rank}, ${rank}) but ` +\n `got axis ${axis}`);\n\n // Check for only integers\n assert(\n axis.every(ax => isInt(ax)),\n () => `All values in axis param must be integers but ` +\n `got axis ${axis}`);\n\n // Handle negative axis.\n return axis.map(a => a < 0 ? rank + a : a);\n}\n\n/** Reduces the shape by removing all dimensions of shape 1. */\nexport function squeezeShape(shape: number[], axis?: number[]):\n {newShape: number[], keptDims: number[]} {\n const newShape: number[] = [];\n const keptDims: number[] = [];\n const isEmptyArray = axis != null && Array.isArray(axis) && axis.length === 0;\n const axes = (axis == null || isEmptyArray) ?\n null :\n parseAxisParam(axis, shape).sort();\n let j = 0;\n for (let i = 0; i < shape.length; ++i) {\n if (axes != null) {\n if (axes[j] === i && shape[i] !== 1) {\n throw new Error(\n `Can't squeeze axis ${i} since its dim '${shape[i]}' is not 1`);\n }\n if ((axes[j] == null || axes[j] > i) && shape[i] === 1) {\n newShape.push(shape[i]);\n keptDims.push(i);\n }\n if (axes[j] <= i) {\n j++;\n }\n }\n if (shape[i] !== 1) {\n newShape.push(shape[i]);\n keptDims.push(i);\n }\n }\n return {newShape, keptDims};\n}\n\nexport function getTypedArrayFromDType(\n dtype: D, size: number): DataTypeMap[D] {\n let values = null;\n if (dtype == null || dtype === 'float32') {\n values = new Float32Array(size);\n } else if (dtype === 'int32') {\n values = new Int32Array(size);\n } else if (dtype === 'bool') {\n values = new Uint8Array(size);\n } else {\n throw new Error(`Unknown data type ${dtype}`);\n }\n return values as DataTypeMap[D];\n}\n\nexport function getArrayFromDType(\n dtype: D, size: number): DataTypeMap[D] {\n let values = null;\n if (dtype == null || dtype === 'float32') {\n values = new Float32Array(size);\n } else if (dtype === 'int32') {\n values = new Int32Array(size);\n } else if (dtype === 'bool') {\n values = new Uint8Array(size);\n } else if (dtype === 'string') {\n values = new Array<'string'>(size);\n } else {\n throw new Error(`Unknown data type ${dtype}`);\n }\n return values as DataTypeMap[D];\n}\n\nexport function checkConversionForErrors(\n vals: DataTypeMap[D]|number[], dtype: D): void {\n for (let i = 0; i < vals.length; i++) {\n const num = vals[i] as number;\n if (isNaN(num) || !isFinite(num)) {\n throw Error(`A tensor of type ${dtype} being uploaded contains ${num}.`);\n }\n }\n}\n\n/** Returns true if the dtype is valid. */\nexport function isValidDtype(dtype: DataType): boolean {\n return dtype === 'bool' || dtype === 'complex64' || dtype === 'float32' ||\n dtype === 'int32' || dtype === 'string';\n}\n\n/**\n * Returns true if the new type can't encode the old type without loss of\n * precision.\n */\nexport function hasEncodingLoss(oldType: DataType, newType: DataType): boolean {\n if (newType === 'complex64') {\n return false;\n }\n if (newType === 'float32' && oldType !== 'complex64') {\n return false;\n }\n if (newType === 'int32' && oldType !== 'float32' && oldType !== 'complex64') {\n return false;\n }\n if (newType === 'bool' && oldType === 'bool') {\n return false;\n }\n return true;\n}\n\nexport function isTypedArray(a: {}): a is Float32Array|Int32Array|Uint8Array|\n Uint8ClampedArray {\n return a instanceof Float32Array || a instanceof Int32Array ||\n a instanceof Uint8Array || a instanceof Uint8ClampedArray;\n}\n\nexport function bytesPerElement(dtype: DataType): number {\n if (dtype === 'float32' || dtype === 'int32') {\n return 4;\n } else if (dtype === 'complex64') {\n return 8;\n } else if (dtype === 'bool') {\n return 1;\n } else {\n throw new Error(`Unknown dtype ${dtype}`);\n }\n}\n\n/**\n * Returns the approximate number of bytes allocated in the string array - 2\n * bytes per character. Computing the exact bytes for a native string in JS\n * is not possible since it depends on the encoding of the html page that\n * serves the website.\n */\nexport function bytesFromStringArray(arr: Uint8Array[]): number {\n if (arr == null) {\n return 0;\n }\n let bytes = 0;\n arr.forEach(x => bytes += x.length);\n return bytes;\n}\n\n/** Returns true if the value is a string. */\nexport function isString(value: {}): value is string {\n return typeof value === 'string' || value instanceof String;\n}\n\nexport function isBoolean(value: {}): boolean {\n return typeof value === 'boolean';\n}\n\nexport function isNumber(value: {}): boolean {\n return typeof value === 'number';\n}\n\nexport function inferDtype(values: TensorLike|WebGLData): DataType {\n if (Array.isArray(values)) {\n return inferDtype(values[0]);\n }\n if (values instanceof Float32Array) {\n return 'float32';\n } else if (\n values instanceof Int32Array || values instanceof Uint8Array ||\n values instanceof Uint8ClampedArray) {\n return 'int32';\n } else if (isNumber(values)) {\n return 'float32';\n } else if (isString(values)) {\n return 'string';\n } else if (isBoolean(values)) {\n return 'bool';\n }\n return 'float32';\n}\n\nexport function isFunction(f: Function) {\n return !!(f && f.constructor && f.call && f.apply);\n}\n\nexport function nearestDivisor(size: number, start: number): number {\n for (let i = start; i < size; ++i) {\n if (size % i === 0) {\n return i;\n }\n }\n return size;\n}\n\nexport function computeStrides(shape: number[]): number[] {\n const rank = shape.length;\n if (rank < 2) {\n return [];\n }\n\n // Last dimension has implicit stride of 1, thus having D-1 (instead of D)\n // strides.\n const strides = new Array(rank - 1);\n strides[rank - 2] = shape[rank - 1];\n for (let i = rank - 3; i >= 0; --i) {\n strides[i] = strides[i + 1] * shape[i + 1];\n }\n return strides;\n}\n\nfunction createNestedArray(\n offset: number, shape: number[], a: TypedArray, isComplex = false) {\n const ret = new Array();\n if (shape.length === 1) {\n const d = shape[0] * (isComplex ? 2 : 1);\n for (let i = 0; i < d; i++) {\n ret[i] = a[offset + i];\n }\n } else {\n const d = shape[0];\n const rest = shape.slice(1);\n const len = rest.reduce((acc, c) => acc * c) * (isComplex ? 2 : 1);\n for (let i = 0; i < d; i++) {\n ret[i] = createNestedArray(offset + i * len, rest, a, isComplex);\n }\n }\n return ret;\n}\n\n// Provide a nested array of TypedArray in given shape.\nexport function toNestedArray(\n shape: number[], a: TypedArray, isComplex = false) {\n if (shape.length === 0) {\n // Scalar type should return a single number.\n return a[0];\n }\n const size = shape.reduce((acc, c) => acc * c) * (isComplex ? 2 : 1);\n if (size === 0) {\n // A tensor with shape zero should be turned into empty list.\n return [];\n }\n if (size !== a.length) {\n throw new Error(`[${shape}] does not match the input size ${a.length}${\n isComplex ? ' for a complex tensor' : ''}.`);\n }\n\n return createNestedArray(0, shape, a, isComplex);\n}\n\nexport function makeOnesTypedArray(\n size: number, dtype: D): DataTypeMap[D] {\n const array = makeZerosTypedArray(size, dtype);\n for (let i = 0; i < array.length; i++) {\n array[i] = 1;\n }\n return array;\n}\n\nexport function makeZerosTypedArray(\n size: number, dtype: D): DataTypeMap[D] {\n if (dtype == null || dtype === 'float32' || dtype === 'complex64') {\n return new Float32Array(size) as DataTypeMap[D];\n } else if (dtype === 'int32') {\n return new Int32Array(size) as DataTypeMap[D];\n } else if (dtype === 'bool') {\n return new Uint8Array(size) as DataTypeMap[D];\n } else {\n throw new Error(`Unknown data type ${dtype}`);\n }\n}\n\n/**\n * Make nested `TypedArray` filled with zeros.\n * @param shape The shape information for the nested array.\n * @param dtype dtype of the array element.\n */\nexport function makeZerosNestedTypedArray(\n shape: number[], dtype: D) {\n const size = shape.reduce((prev, curr) => prev * curr, 1);\n if (dtype == null || dtype === 'float32') {\n return toNestedArray(shape, new Float32Array(size));\n } else if (dtype === 'int32') {\n return toNestedArray(shape, new Int32Array(size));\n } else if (dtype === 'bool') {\n return toNestedArray(shape, new Uint8Array(size));\n } else {\n throw new Error(`Unknown data type ${dtype}`);\n }\n}\n\nexport function assertNonNegativeIntegerDimensions(shape: number[]) {\n shape.forEach(dimSize => {\n assert(\n Number.isInteger(dimSize) && dimSize >= 0,\n () =>\n `Tensor must have a shape comprised of positive integers but got ` +\n `shape [${shape}].`);\n });\n}\n\n/**\n * Computes flat index for a given location (multidimentionsal index) in a\n * Tensor/multidimensional array.\n *\n * @param locs Location in the tensor.\n * @param rank Rank of the tensor.\n * @param strides Tensor strides.\n */\nexport function locToIndex(\n locs: number[], rank: number, strides: number[]): number {\n if (rank === 0) {\n return 0;\n } else if (rank === 1) {\n return locs[0];\n }\n let index = locs[locs.length - 1];\n for (let i = 0; i < locs.length - 1; ++i) {\n index += strides[i] * locs[i];\n }\n return index;\n}\n\n/**\n * Computes the location (multidimensional index) in a\n * tensor/multidimentional array for a given flat index.\n *\n * @param index Index in flat array.\n * @param rank Rank of tensor.\n * @param strides Strides of tensor.\n */\nexport function indexToLoc(\n index: number, rank: number, strides: number[]): number[] {\n if (rank === 0) {\n return [];\n } else if (rank === 1) {\n return [index];\n }\n const locs: number[] = new Array(rank);\n for (let i = 0; i < locs.length - 1; ++i) {\n locs[i] = Math.floor(index / strides[i]);\n index -= locs[i] * strides[i];\n }\n locs[locs.length - 1] = index;\n return locs;\n}\n\n/**\n * This method asserts whether an object is a Promise instance.\n * @param object\n */\n// tslint:disable-next-line: no-any\nexport function isPromise(object: any): object is Promise {\n // We chose to not use 'obj instanceOf Promise' for two reasons:\n // 1. It only reliably works for es6 Promise, not other Promise\n // implementations.\n // 2. It doesn't work with framework that uses zone.js. zone.js monkey\n // patch the async calls, so it is possible the obj (patched) is\n // comparing to a pre-patched Promise.\n return object && object.then && typeof object.then === 'function';\n}\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Platform} from './platforms/platform';\nimport {isPromise} from './util_base';\n\n// Expects flags from URL in the format ?tfjsflags=FLAG1:1,FLAG2:true.\nconst TENSORFLOWJS_FLAGS_PREFIX = 'tfjsflags';\n\ntype FlagValue = number|boolean;\ntype FlagEvaluationFn = (() => FlagValue)|(() => Promise);\nexport type Flags = {\n [featureName: string]: FlagValue\n};\nexport type FlagRegistryEntry = {\n evaluationFn: FlagEvaluationFn;\n setHook?: (value: FlagValue) => void;\n};\n\n/**\n * The environment contains evaluated flags as well as the registered platform.\n * This is always used as a global singleton and can be retrieved with\n * `tf.env()`.\n *\n * @doc {heading: 'Environment'}\n */\nexport class Environment {\n private flags: Flags = {};\n private flagRegistry: {[flagName: string]: FlagRegistryEntry} = {};\n\n private urlFlags: Flags = {};\n\n platformName: string;\n platform: Platform;\n\n // Jasmine spies on this in 'environment_test.ts'\n getQueryParams = getQueryParams;\n\n // tslint:disable-next-line: no-any\n constructor(public global: any) {\n this.populateURLFlags();\n }\n\n setPlatform(platformName: string, platform: Platform) {\n if (this.platform != null) {\n if (!(env().getBool('IS_TEST') || env().getBool('PROD'))) {\n console.warn(\n `Platform ${this.platformName} has already been set. ` +\n `Overwriting the platform with ${platformName}.`);\n }\n }\n this.platformName = platformName;\n this.platform = platform;\n }\n\n registerFlag(\n flagName: string, evaluationFn: FlagEvaluationFn,\n setHook?: (value: FlagValue) => void) {\n this.flagRegistry[flagName] = {evaluationFn, setHook};\n\n // Override the flag value from the URL. This has to happen here because\n // the environment is initialized before flags get registered.\n if (this.urlFlags[flagName] != null) {\n const flagValue = this.urlFlags[flagName];\n if (!(env().getBool('IS_TEST') || env().getBool('PROD'))) {\n console.warn(\n `Setting feature override from URL ${flagName}: ${flagValue}.`);\n }\n this.set(flagName, flagValue);\n }\n }\n\n async getAsync(flagName: string): Promise {\n if (flagName in this.flags) {\n return this.flags[flagName];\n }\n\n this.flags[flagName] = await this.evaluateFlag(flagName);\n return this.flags[flagName];\n }\n\n get(flagName: string): FlagValue {\n if (flagName in this.flags) {\n return this.flags[flagName];\n }\n\n const flagValue = this.evaluateFlag(flagName);\n if (isPromise(flagValue)) {\n throw new Error(\n `Flag ${flagName} cannot be synchronously evaluated. ` +\n `Please use getAsync() instead.`);\n }\n\n this.flags[flagName] = flagValue;\n return this.flags[flagName];\n }\n\n getNumber(flagName: string): number {\n return this.get(flagName) as number;\n }\n\n getBool(flagName: string): boolean {\n return this.get(flagName) as boolean;\n }\n\n getFlags(): Flags {\n return this.flags;\n }\n // For backwards compatibility.\n get features(): Flags {\n return this.flags;\n }\n\n set(flagName: string, value: FlagValue): void {\n if (this.flagRegistry[flagName] == null) {\n throw new Error(\n `Cannot set flag ${flagName} as it has not been registered.`);\n }\n this.flags[flagName] = value;\n if (this.flagRegistry[flagName].setHook != null) {\n this.flagRegistry[flagName].setHook(value);\n }\n }\n\n private evaluateFlag(flagName: string): FlagValue|Promise {\n if (this.flagRegistry[flagName] == null) {\n throw new Error(\n `Cannot evaluate flag '${flagName}': no evaluation function found.`);\n }\n return this.flagRegistry[flagName].evaluationFn();\n }\n\n setFlags(flags: Flags) {\n this.flags = Object.assign({}, flags);\n }\n\n reset() {\n this.flags = {};\n this.urlFlags = {};\n this.populateURLFlags();\n }\n\n private populateURLFlags(): void {\n if (typeof this.global === 'undefined' ||\n typeof this.global.location === 'undefined' ||\n typeof this.global.location.search === 'undefined') {\n return;\n }\n\n const urlParams = this.getQueryParams(this.global.location.search);\n if (TENSORFLOWJS_FLAGS_PREFIX in urlParams) {\n const keyValues = urlParams[TENSORFLOWJS_FLAGS_PREFIX].split(',');\n keyValues.forEach(keyValue => {\n const [key, value] = keyValue.split(':') as [string, string];\n this.urlFlags[key] = parseValue(key, value);\n });\n }\n }\n}\n\nexport function getQueryParams(queryString: string): {[key: string]: string} {\n const params = {};\n queryString.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g, (s, ...t) => {\n decodeParam(params, t[0], t[1]);\n return t.join('=');\n });\n return params;\n}\n\nfunction decodeParam(\n params: {[key: string]: string}, name: string, value?: string) {\n params[decodeURIComponent(name)] = decodeURIComponent(value || '');\n}\n\nfunction parseValue(flagName: string, value: string): FlagValue {\n value = value.toLowerCase();\n if (value === 'true' || value === 'false') {\n return value === 'true';\n } else if (`${+ value}` === value) {\n return +value;\n }\n throw new Error(\n `Could not parse value flag value ${value} for flag ${flagName}.`);\n}\n\n/**\n * Returns the current environment (a global singleton).\n *\n * The environment object contains the evaluated feature values as well as the\n * active platform.\n *\n * @doc {heading: 'Environment'}\n */\nexport function env() {\n return ENV;\n}\n\nexport let ENV: Environment = null;\nexport function setEnvironmentGlobal(environment: Environment) {\n ENV = environment;\n}\n","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// Note that the identifier globalNameSpace is scoped to this module, but will\n// always resolve to the same global object regardless of how the module is\n// resolved.\n// tslint:disable-next-line:no-any\nlet globalNameSpace: {_tfGlobals: Map};\n// tslint:disable-next-line:no-any\nexport function getGlobalNamespace(): {_tfGlobals: Map} {\n if (globalNameSpace == null) {\n // tslint:disable-next-line:no-any\n let ns: any;\n if (typeof (window) !== 'undefined') {\n ns = window;\n } else if (typeof (global) !== 'undefined') {\n ns = global;\n } else if (typeof (process) !== 'undefined') {\n ns = process;\n } else if (typeof (self) !== 'undefined') {\n ns = self;\n } else {\n throw new Error('Could not find a global object');\n }\n globalNameSpace = ns;\n }\n return globalNameSpace;\n}\n\n// tslint:disable-next-line:no-any\nfunction getGlobalMap(): Map {\n const ns = getGlobalNamespace();\n if (ns._tfGlobals == null) {\n ns._tfGlobals = new Map();\n }\n return ns._tfGlobals;\n}\n\n/**\n * Returns a globally accessible 'singleton' object.\n *\n * @param key the name of the object\n * @param init a function to initialize to initialize this object\n * the first time it is fetched.\n */\nexport function getGlobal(key: string, init: () => T): T {\n const globalMap = getGlobalMap();\n if (globalMap.has(key)) {\n return globalMap.get(key);\n } else {\n const singleton = init();\n globalMap.set(key, singleton);\n return globalMap.get(key);\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n// Allow UpperCamelCase variable names\n// tslint:disable: variable-name\n// Unfortunately just enabling PascalCase per file (tslint:enable:\n// allow-pascal-case) doesn't work.\nimport {NamedTensorInfoMap, TensorInfo} from './kernel_registry';\nimport {ExplicitPadding} from './ops/conv_util';\nimport {Activation} from './ops/fused_types';\nimport {DataType, PixelData} from './types';\n\nexport const Abs = 'Abs';\nexport type AbsInputs = UnaryInputs;\n\nexport const Acos = 'Acos';\nexport type AcosInputs = UnaryInputs;\n\nexport const Acosh = 'Acosh';\nexport type AcoshInputs = UnaryInputs;\n\nexport const Add = 'Add';\nexport type AddInputs = BinaryInputs;\n\nexport const AddN = 'AddN';\nexport type AddNInputs = TensorInfo[];\n\nexport const All = 'All';\nexport type AllInputs = Pick;\nexport interface AllAttrs {\n axis: number|number[];\n keepDims: boolean;\n}\n\nexport const Any = 'Any';\nexport type AnyInputs = Pick;\nexport interface AnyAttrs {\n axis: number|number[];\n keepDims: boolean;\n}\n\nexport const ArgMax = 'ArgMax';\nexport type ArgMaxInputs = Pick;\nexport interface ArgMaxAttrs {\n axis: number;\n}\n\nexport const ArgMin = 'ArgMin';\nexport type ArgMinInputs = Pick;\nexport interface ArgMinAttrs {\n axis: number;\n}\n\nexport const Asin = 'Asin';\nexport type AsinInputs = UnaryInputs;\n\nexport const Asinh = 'Asinh';\nexport type AsinhInputs = UnaryInputs;\n\nexport const Atan = 'Atan';\nexport type AtanInputs = UnaryInputs;\n\nexport const Atanh = 'Atanh';\nexport type AtanhInputs = UnaryInputs;\n\nexport const Atan2 = 'Atan2';\nexport type Atan2Inputs = BinaryInputs;\n\nexport const AvgPool = 'AvgPool';\nexport type AvgPoolInputs = Pick;\nexport interface AvgPoolAttrs {\n filterSize: [number, number]|number;\n strides: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n}\n\nexport const AvgPoolGrad = 'AvgPoolGrad';\nexport type AvgPoolGradInputs = Pick;\nexport interface AvgPoolGradAttrs {\n filterSize: [number, number]|number;\n strides: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n}\n\nexport const AvgPool3D = 'AvgPool3D';\nexport type AvgPool3DInputs = Pick;\nexport interface AvgPool3DAttrs {\n filterSize: [number, number, number]|number;\n strides: [number, number, number]|number;\n pad: 'valid'|'same'|number;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n dataFormat: 'NDHWC'|'NCDHW';\n}\n\nexport const AvgPool3DGrad = 'AvgPool3DGrad';\nexport type AvgPool3DGradInputs = Pick;\nexport interface AvgPool3DGradAttrs {\n filterSize: [number, number, number]|number;\n strides: [number, number, number]|number;\n pad: 'valid'|'same'|number;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n}\n\nexport const BatchMatMul = 'BatchMatMul';\nexport type BatchMatMulInputs = Pick;\nexport interface BatchMatMulAttrs {\n transposeA: boolean;\n transposeB: boolean;\n}\n\nexport const BatchToSpaceND = 'BatchToSpaceND';\nexport type BatchToSpaceNDInputs = Pick;\nexport interface BatchToSpaceNDAttrs {\n blockShape: number[];\n crops: number[][];\n}\n\nexport type BinaryInputs = Pick;\n\nexport const Bincount = 'Bincount';\nexport type BincountInputs = Pick;\nexport interface BincountAttrs {\n size: number;\n}\n\nexport const BroadcastTo = 'BroadcastTo';\nexport type BroadcastToInputs = Pick;\nexport interface BroadCastToAttrs {\n shape: number[];\n inputShape: number[]; // for gradient\n}\n\nexport const BroadcastArgs = 'BroadcastArgs';\nexport type BroadcastArgsInputs = Pick;\n\nexport const Cast = 'Cast';\nexport type CastInputs = UnaryInputs;\nexport interface CastAttrs {\n dtype: DataType;\n}\n\nexport const Ceil = 'Ceil';\nexport type CeilInputs = UnaryInputs;\n\nexport const ClipByValue = 'ClipByValue';\nexport type ClipByValueInputs = UnaryInputs;\nexport interface ClipByValueAttrs {\n clipValueMin: number;\n clipValueMax: number;\n}\n\nexport const Complex = 'Complex';\nexport type ComplexInputs = Pick;\n\nexport const ComplexAbs = 'ComplexAbs';\nexport type ComplexAbsInputs = UnaryInputs;\n\nexport const Concat = 'Concat';\nexport type ConcatInputs = TensorInfo[];\nexport interface ConcatAttrs {\n axis: number;\n}\n\nexport const Conv2D = 'Conv2D';\nexport type Conv2DInputs = Pick;\nexport interface Conv2DAttrs {\n strides: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n dataFormat: 'NHWC'|'NCHW';\n dilations: [number, number]|number;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n}\n\nexport const Conv2DBackpropFilter = 'Conv2DBackpropFilter';\nexport type Conv2DBackpropFilterInputs = Pick;\nexport interface Conv2DBackpropFilterAttrs {\n strides: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n dataFormat: 'NHWC'|'NCHW';\n dimRoundingMode?: 'floor'|'round'|'ceil';\n filterShape: [number, number, number, number];\n}\n\nexport const Conv2DBackpropInput = 'Conv2DBackpropInput';\nexport type Conv2DBackpropInputInputs = Pick;\nexport interface Conv2DBackpropInputAttrs {\n strides: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n dataFormat: 'NHWC'|'NCHW';\n dimRoundingMode?: 'floor'|'round'|'ceil';\n inputShape: [number, number, number, number];\n}\n\nexport const Conv3D = 'Conv3D';\nexport type Conv3DInputs = Pick;\nexport interface Conv3DAttrs {\n strides: [number, number, number]|number;\n pad: 'valid'|'same';\n dataFormat: 'NDHWC'|'NCDHW';\n dilations: [number, number, number]|number;\n}\n\nexport const Conv3DBackpropFilterV2 = 'Conv3DBackpropFilterV2';\nexport type Conv3DBackpropFilterV2Inputs = Pick;\n\nexport interface Conv3DBackpropFilterV2Attrs {\n strides: [number, number, number]|number;\n pad: 'valid'|'same';\n filterShape: [number, number, number, number, number];\n}\n\nexport const Conv3DBackpropInputV2 = 'Conv3DBackpropInputV2';\nexport type Conv3DBackpropInputV2Inputs =\n Pick;\nexport interface Conv3DBackpropInputV2Attrs {\n strides: [number, number, number]|number;\n pad: 'valid'|'same';\n inputShape: [number, number, number, number, number];\n}\n\nexport const Cos = 'Cos';\nexport type CosInputs = UnaryInputs;\n\nexport const Cosh = 'Cosh';\nexport type CoshInputs = UnaryInputs;\n\nexport const Cumprod = 'Cumprod';\nexport type CumprodInputs = Pick;\nexport interface CumprodAttrs {\n axis: number;\n exclusive: boolean;\n reverse: boolean;\n}\n\nexport const Cumsum = 'Cumsum';\nexport type CumsumInputs = Pick;\nexport interface CumsumAttrs {\n axis: number;\n exclusive: boolean;\n reverse: boolean;\n}\n\nexport const CropAndResize = 'CropAndResize';\nexport type CropAndResizeInputs =\n Pick;\nexport interface CropAndResizeAttrs {\n cropSize: [number, number];\n method: 'bilinear'|'nearest';\n extrapolationValue: number;\n}\n\nexport const DenseBincount = 'DenseBincount';\nexport type DenseBincountInputs = Pick;\nexport interface DenseBincountAttrs {\n size: number;\n binaryOutput?: boolean;\n}\n\nexport const DepthToSpace = 'DepthToSpace';\nexport type DepthToSpaceInputs = Pick;\nexport interface DepthToSpaceAttrs {\n blockSize: number;\n dataFormat: 'NHWC'|'NCHW';\n}\n\nexport const DepthwiseConv2dNative = 'DepthwiseConv2dNative';\nexport type DepthwiseConv2dNativeInputs =\n Pick;\nexport interface DepthwiseConv2dNativeAttrs {\n strides: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n dataFormat: 'NHWC'|'NCHW';\n dilations: [number, number]|number;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n}\n\nexport const DepthwiseConv2dNativeBackpropFilter =\n 'DepthwiseConv2dNativeBackpropFilter';\nexport type DepthwiseConv2dNativeBackpropFilterInputs =\n Pick;\nexport interface DepthwiseConv2dNativeBackpropFilterAttrs {\n strides: [number, number]|number;\n dilations: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n filterShape: [number, number, number, number];\n}\n\nexport const DepthwiseConv2dNativeBackpropInput =\n 'DepthwiseConv2dNativeBackpropInput';\nexport type DepthwiseConv2dNativeBackpropInputInputs =\n Pick;\nexport interface DepthwiseConv2dNativeBackpropInputAttrs {\n strides: [number, number]|number;\n dilations: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n inputShape: [number, number, number, number];\n}\n\nexport const Diag = 'Diag';\nexport type DiagInputs = Pick;\n\nexport const Dilation2D = 'Dilation2D';\nexport type Dilation2DInputs = Pick;\nexport interface Dilation2DAttrs {\n strides: [number, number]|number;\n pad: 'valid'|'same'|number;\n dilations: [number, number]|number;\n}\n\nexport const Dilation2DBackpropInput = 'Dilation2DBackpropInput';\nexport type Dilation2DBackpropInputInputs =\n Pick;\n\nexport const Dilation2DBackpropFilter = 'Dilation2DBackpropFilter';\nexport type Dilation2DBackpropFilterInputs =\n Pick;\n\nexport const RealDiv = 'RealDiv';\nexport type RealDivInputs = BinaryInputs;\n\nexport const Einsum = 'Einsum';\nexport type EinsumInputs = TensorInfo[];\nexport interface EinsumAttrs {\n equation: string;\n}\n\nexport const Elu = 'Elu';\nexport type EluInputs = Pick;\n\nexport const EluGrad = 'EluGrad';\nexport type EluGradInputs = Pick;\n\nexport const Erf = 'Erf';\nexport type ErfInputs = UnaryInputs;\n\nexport const Equal = 'Equal';\nexport type EqualInputs = BinaryInputs;\n\nexport const Exp = 'Exp';\nexport type ExpInputs = UnaryInputs;\n\nexport const ExpandDims = 'ExpandDims';\nexport type ExpandDimsInputs = Pick;\nexport interface ExpandDimsAttrs {\n dim: number;\n}\n\nexport const Expm1 = 'Expm1';\nexport type Expm1Inputs = UnaryInputs;\n\nexport const FFT = 'FFT';\nexport type FFTInputs = Pick;\n\nexport const Fill = 'Fill';\nexport interface FillAttrs {\n shape: number[];\n value: number|string;\n dtype: DataType;\n}\n\nexport const FlipLeftRight = 'FlipLeftRight';\nexport type FlipLeftRightInputs = Pick;\n\nexport const Floor = 'Floor';\nexport type FloorInputs = UnaryInputs;\n\nexport const FloorDiv = 'FloorDiv';\nexport type FloorDivInputs = BinaryInputs;\n\nexport const FusedBatchNorm = 'FusedBatchNorm';\nexport type FusedBatchNormInputs =\n Pick;\nexport interface FusedBatchNormAttrs {\n varianceEpsilon: number;\n}\n\nexport const GatherV2 = 'GatherV2';\nexport type GatherV2Inputs = Pick;\nexport interface GatherV2Attrs {\n axis: number;\n batchDims: number;\n}\n\nexport const GatherNd = 'GatherNd';\nexport type GatherNdInputs = Pick;\n\nexport const Greater = 'Greater';\nexport type GreaterInputs = BinaryInputs;\n\nexport const GreaterEqual = 'GreaterEqual';\nexport type GreaterEqualInputs = BinaryInputs;\n\nexport const Identity = 'Identity';\nexport type IdentityInputs = Pick;\n\nexport const IFFT = 'IFFT';\nexport type IFFTInputs = Pick;\n\nexport const Imag = 'Imag';\nexport type ImagInputs = Pick;\n\nexport const IsFinite = 'IsFinite';\nexport type IsFiniteInputs = UnaryInputs;\n\nexport const IsInf = 'IsInf';\nexport type IsInfInputs = UnaryInputs;\n\nexport const IsNan = 'IsNan';\nexport type IsNanInputs = UnaryInputs;\n\nexport const LeakyRelu = 'LeakyRelu';\nexport type LeakyReluInputs = Pick;\nexport interface LeakyReluAttrs {\n alpha: number;\n}\n\nexport const Less = 'Less';\nexport type LessInputs = BinaryInputs;\n\nexport const LessEqual = 'LessEqual';\nexport type LessEqualInputs = BinaryInputs;\n\nexport const LinSpace = 'LinSpace';\nexport interface LinSpaceAttrs {\n start: number;\n stop: number;\n num: number;\n}\nexport const Log = 'Log';\nexport type LogInputs = UnaryInputs;\n\nexport const Log1p = 'Log1p';\nexport type Log1pInputs = UnaryInputs;\n\nexport const LogicalAnd = 'LogicalAnd';\nexport type LogicalAndInputs = BinaryInputs;\n\nexport const LogicalNot = 'LogicalNot';\nexport type LogicalNotInputs = Pick;\n\nexport const LogicalOr = 'LogicalOr';\nexport type LogicalOrInputs = BinaryInputs;\n\nexport const LogicalXor = 'LogicalXor';\nexport type LogicalXorInputs = BinaryInputs;\n\nexport const LogSoftmax = 'LogSoftmax';\nexport type LogSoftmaxInputs = Pick;\nexport interface LogSoftmaxAttrs {\n axis: number;\n}\n\nexport const LowerBound = 'LowerBound';\nexport type LowerBoundInputs =\n Pick;\n\nexport const LRN = 'LRN';\nexport type LRNInputs = Pick;\nexport interface LRNAttrs {\n depthRadius: number;\n bias: number;\n alpha: number;\n beta: number;\n}\n\nexport const LRNGrad = 'LRNGrad';\nexport type LRNGradInputs = Pick;\nexport interface LRNGradAttrs {\n depthRadius: number;\n bias: number;\n alpha: number;\n beta: number;\n}\n\nexport const Max = 'Max';\nexport type MaxInputs = Pick;\nexport interface MaxAttrs {\n reductionIndices: number|number[];\n keepDims: boolean;\n}\n\nexport const Maximum = 'Maximum';\nexport type MaximumInputs = BinaryInputs;\n\nexport const MaxPool = 'MaxPool';\nexport type MaxPoolInputs = Pick;\nexport interface MaxPoolAttrs {\n filterSize: [number, number]|number;\n strides: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n}\n\nexport const MaxPoolGrad = 'MaxPoolGrad';\nexport type MaxPoolGradInputs = Pick;\nexport interface MaxPoolGradAttrs {\n filterSize: [number, number]|number;\n strides: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n}\n\nexport const MaxPool3D = 'MaxPool3D';\nexport type MaxPool3DInputs = Pick;\nexport interface MaxPool3DAttrs {\n filterSize: [number, number, number]|number;\n strides: [number, number, number]|number;\n pad: 'valid'|'same'|number;\n dataFormat: 'NDHWC'|'NCDHW';\n dimRoundingMode?: 'floor'|'round'|'ceil';\n}\n\nexport const MaxPool3DGrad = 'MaxPool3DGrad';\nexport type MaxPool3DGradInputs =\n Pick;\nexport interface MaxPool3DGradAttrs {\n filterSize: [number, number, number]|number;\n strides: [number, number, number]|number;\n pad: 'valid'|'same'|number;\n dimRoundingMode?: 'floor'|'round'|'ceil';\n}\n\nexport const MaxPoolWithArgmax = 'MaxPoolWithArgmax';\nexport type MaxPoolWithArgmaxInputs = Pick;\nexport interface MaxPoolWithArgmaxAttrs {\n filterSize: [number, number]|number;\n strides: [number, number]|number;\n pad: 'valid'|'same'|number;\n includeBatchInIndex: boolean;\n}\n\nexport const Mean = 'Mean';\nexport type MeanInputs = Pick;\nexport interface MeanAttrs {\n axis: number|number[];\n keepDims: boolean;\n}\n\nexport const Min = 'Min';\nexport type MinInputs = Pick;\nexport interface MinAttrs {\n axis: number|number[];\n keepDims: boolean;\n}\n\nexport const Minimum = 'Minimum';\nexport type MinimumInputs = BinaryInputs;\n\nexport const MirrorPad = 'MirrorPad';\nexport type MirrorPadInputs = Pick;\nexport interface MirrorPadAttrs {\n paddings: Array<[number, number]>;\n mode: 'reflect'|'symmetric';\n}\n\nexport const Mod = 'Mod';\nexport type ModInputs = BinaryInputs;\n\nexport const Multinomial = 'Multinomial';\nexport type MultinomialInputs = Pick;\nexport interface MultinomialAttrs {\n numSamples: number;\n seed: number;\n normalized: boolean;\n}\n\nexport const Multiply = 'Multiply';\nexport type MultiplyInputs = BinaryInputs;\n\nexport const Neg = 'Neg';\nexport type NegInputs = UnaryInputs;\n\nexport const NotEqual = 'NotEqual';\nexport type NotEqualInputs = BinaryInputs;\n\nexport const NonMaxSuppressionV3 = 'NonMaxSuppressionV3';\nexport type NonMaxSuppressionV3Inputs =\n Pick;\nexport interface NonMaxSuppressionV3Attrs {\n maxOutputSize: number;\n iouThreshold: number;\n scoreThreshold: number;\n}\n\nexport const NonMaxSuppressionV4 = 'NonMaxSuppressionV4';\nexport type NonMaxSuppressionV4Inputs =\n Pick;\nexport interface NonMaxSuppressionV4Attrs {\n maxOutputSize: number;\n iouThreshold: number;\n scoreThreshold: number;\n padToMaxOutputSize: boolean;\n}\n\nexport const NonMaxSuppressionV5 = 'NonMaxSuppressionV5';\nexport type NonMaxSuppressionV5Inputs =\n Pick;\nexport interface NonMaxSuppressionV5Attrs {\n maxOutputSize: number;\n iouThreshold: number;\n scoreThreshold: number;\n softNmsSigma: number;\n}\n\nexport const OnesLike = 'OnesLike';\nexport type OnesLikeInputs = UnaryInputs;\n\nexport const OneHot = 'OneHot';\nexport type OneHotInputs = Pick;\nexport interface OneHotAttrs {\n depth: number;\n onValue: number;\n offValue: number;\n dtype: DataType;\n}\n\nexport const Pack = 'Pack';\nexport type PackInputs = TensorInfo[];\nexport interface PackAttrs {\n axis: number;\n}\n\nexport const PadV2 = 'PadV2';\nexport type PadV2Inputs = Pick;\nexport interface PadV2Attrs {\n paddings: Array<[number, number]>;\n constantValue: number;\n}\n\nexport const Pool = 'Pool';\nexport type PoolInputs = Pick;\n\nexport const Pow = 'Pow';\nexport type PowInputs = BinaryInputs;\n\nexport const Prelu = 'Prelu';\nexport type PreluInputs = Pick;\n\nexport const Prod = 'Prod';\nexport type ProdInputs = Pick;\nexport interface ProdAttrs {\n axis: number|number[];\n keepDims: boolean;\n}\n\nexport const RaggedGather = 'RaggedGather';\nexport type RaggedGatherInputs = {\n paramsNestedSplits: TensorInfo[]\n}&Pick;\nexport interface RaggedGatherAttrs {\n outputRaggedRank: number;\n}\n\nexport const RaggedRange = 'RaggedRange';\nexport type RaggedRangeInputs =\n Pick;\n\nexport const RaggedTensorToTensor = 'RaggedTensorToTensor';\nexport type RaggedTensorToTensorInputs =\n Pick&\n {rowPartitionTensors: TensorInfo[]};\nexport interface RaggedTensorToTensorAttrs {\n rowPartitionTypes: string[];\n}\n\nexport const Range = 'Range';\nexport interface RangeAttrs {\n start: number;\n stop: number;\n step: number;\n dtype: 'float32'|'int32';\n}\n\nexport const Real = 'Real';\nexport type RealInputs = Pick;\n\nexport const Reciprocal = 'Reciprocal';\nexport type ReciprocalInputs = UnaryInputs;\n\nexport const Relu = 'Relu';\nexport type ReluInputs = Pick;\n\nexport const Reshape = 'Reshape';\nexport type ReshapeInputs = Pick;\nexport interface ReshapeAttrs {\n shape: number[];\n}\n\nexport const ResizeNearestNeighbor = 'ResizeNearestNeighbor';\nexport type ResizeNearestNeighborInputs = Pick;\nexport interface ResizeNearestNeighborAttrs {\n alignCorners: boolean;\n halfPixelCenters: boolean;\n size: [number, number];\n}\n\nexport const ResizeNearestNeighborGrad = 'ResizeNearestNeighborGrad';\nexport type ResizeNearestNeighborGradInputs =\n Pick;\nexport type ResizeNearestNeighborGradAttrs = ResizeNearestNeighborAttrs;\n\nexport const ResizeBilinear = 'ResizeBilinear';\nexport type ResizeBilinearInputs = Pick;\nexport interface ResizeBilinearAttrs {\n alignCorners: boolean;\n halfPixelCenters: boolean;\n size: [number, number];\n}\n\nexport const ResizeBilinearGrad = 'ResizeBilinearGrad';\nexport type ResizeBilinearGradInputs = Pick;\nexport type ResizeBilinearGradAttrs = ResizeBilinearAttrs;\n\nexport const Relu6 = 'Relu6';\nexport type Relu6Inputs = Pick;\n\nexport const Reverse = 'Reverse';\nexport type ReverseInputs = Pick;\nexport interface ReverseAttrs {\n dims: number|number[];\n}\n\nexport const Round = 'Round';\nexport type RoundInputs = UnaryInputs;\n\nexport const Rsqrt = 'Rsqrt';\nexport type RsqrtInputs = UnaryInputs;\n\nexport const ScatterNd = 'ScatterNd';\nexport type ScatterNdInputs = Pick;\nexport interface ScatterNdAttrs {\n shape: number[];\n}\n\nexport const SearchSorted = 'SearchSorted';\nexport type SearchSortedInputs =\n Pick;\nexport interface SearchSortedAttrs {\n side: 'left'|'right';\n}\n\nexport const Select = 'Select';\nexport type SelectInputs = Pick;\n\nexport const Selu = 'Selu';\nexport type SeluInputs = Pick;\n\nexport const Slice = 'Slice';\nexport type SliceInputs = Pick;\nexport interface SliceAttrs {\n begin: number|number[];\n size: number|number[];\n}\nexport const Sin = 'Sin';\nexport type SinInputs = UnaryInputs;\n\nexport const Sinh = 'Sinh';\nexport type SinhInputs = UnaryInputs;\n\nexport const Sign = 'Sign';\nexport type SignInputs = UnaryInputs;\n\nexport const Sigmoid = 'Sigmoid';\nexport type SigmoidInputs = UnaryInputs;\n\nexport const Softplus = 'Softplus';\nexport type SoftplusInputs = UnaryInputs;\n\nexport const Sqrt = 'Sqrt';\nexport type SqrtInputs = UnaryInputs;\n\nexport const Sum = 'Sum';\nexport type SumInputs = Pick;\nexport interface SumAttrs {\n axis: number|number[];\n keepDims: boolean;\n}\n\nexport const SpaceToBatchND = 'SpaceToBatchND';\nexport type SpaceToBatchNDInputs = Pick;\nexport interface SpaceToBatchNDAttrs {\n blockShape: number[];\n paddings: number[][];\n}\n\nexport const SplitV = 'SplitV';\nexport type SplitVInputs = Pick;\nexport interface SplitVAttrs {\n numOrSizeSplits: number[]|number;\n axis: number;\n}\n\nexport const Softmax = 'Softmax';\nexport type SoftmaxInputs = Pick;\nexport interface SoftmaxAttrs {\n dim: number;\n}\n\nexport const SparseFillEmptyRows = 'SparseFillEmptyRows';\nexport type SparseFillEmptyRowsInputs =\n Pick;\n\nexport const SparseReshape = 'SparseReshape';\nexport type SparseReshapeInputs =\n Pick;\n\nexport const SparseSegmentMean = 'SparseSegmentMean';\nexport type SparseSegmentMeanInputs =\n Pick;\n\nexport const SparseSegmentSum = 'SparseSegmentSum';\nexport type SparseSegmentSumInputs =\n Pick;\n\nexport const SparseToDense = 'SparseToDense';\nexport type SparseToDenseInputs =\n Pick;\nexport interface SparseToDenseAttrs {\n outputShape: number[];\n}\n\nexport const SquaredDifference = 'SquaredDifference';\nexport type SquaredDifferenceInputs = BinaryInputs;\n\nexport const Square = 'Square';\nexport type SquareInputs = Pick;\n\nexport const StridedSlice = 'StridedSlice';\nexport type StridedSliceInputs = Pick;\nexport interface StridedSliceAttrs {\n begin: number[];\n end: number[];\n strides: number[];\n beginMask: number;\n endMask: number;\n ellipsisMask: number;\n newAxisMask: number;\n shrinkAxisMask: number;\n}\n\nexport const StringNGrams = 'StringNGrams';\nexport type StringNGramsInputs = Pick;\nexport interface StringNGramsAttrs {\n separator: string;\n nGramWidths: number[];\n leftPad: string;\n rightPad: string;\n padWidth: number;\n preserveShortSequences: boolean;\n}\n\nexport const StringSplit = 'StringSplit';\nexport type StringSplitInputs = Pick;\nexport interface StringSplitAttrs {\n skipEmpty: boolean;\n}\n\nexport const StringToHashBucketFast = 'StringToHashBucketFast';\nexport type StringToHashBucketFastInputs = Pick;\nexport interface StringToHashBucketFastAttrs {\n numBuckets: number;\n}\n\nexport const Sub = 'Sub';\nexport type SubInputs = BinaryInputs;\n\nexport const Tan = 'Tan';\nexport type TanInputs = UnaryInputs;\n\nexport const Tanh = 'Tanh';\nexport type TanhInputs = UnaryInputs;\n\nexport const Tile = 'Tile';\nexport type TileInputs = Pick;\nexport interface TileAttrs {\n reps: number[];\n}\n\nexport const TopK = 'TopK';\nexport type TopKInputs = Pick;\nexport interface TopKAttrs {\n k: number;\n sorted: boolean;\n}\n\nexport const Transform = 'Transform';\nexport type TransformInputs = Pick;\nexport interface TransformAttrs {\n interpolation: 'nearest'|'bilinear';\n fillMode: 'constant'|'reflect'|'wrap'|'nearest';\n fillValue: number;\n outputShape?: [number, number];\n}\n\nexport const Transpose = 'Transpose';\nexport type TransposeInputs = Pick;\nexport interface TransposeAttrs {\n perm: number[];\n}\n\nexport const Unique = 'Unique';\nexport type UniqueInputs = Pick;\nexport interface UniqueAttrs {\n axis: number;\n}\n\nexport type UnaryInputs = Pick;\n\nexport const Unpack = 'Unpack';\nexport type UnpackInputs = Pick;\nexport interface UnpackAttrs {\n axis: number;\n}\n\nexport const UnsortedSegmentSum = 'UnsortedSegmentSum';\nexport type UnsortedSegmentSumInputs =\n Pick;\nexport interface UnsortedSegmentSumAttrs {\n numSegments: number;\n}\n\nexport const UpperBound = 'UpperBound';\nexport type UpperBoundInputs =\n Pick;\n\nexport const ZerosLike = 'ZerosLike';\nexport type ZerosLikeInputs = UnaryInputs;\n\n/**\n * TensorFlow.js-only kernels\n */\nexport const Step = 'Step';\nexport type StepInputs = UnaryInputs;\nexport interface StepAttrs {\n alpha: number;\n}\n\nexport const FromPixels = 'FromPixels';\nexport interface FromPixelsInputs {\n pixels: PixelData|ImageData|HTMLImageElement|HTMLCanvasElement|\n HTMLVideoElement|ImageBitmap;\n}\nexport interface FromPixelsAttrs {\n numChannels: number;\n}\n\nexport const RotateWithOffset = 'RotateWithOffset';\nexport type RotateWithOffsetInputs = Pick;\nexport interface RotateWithOffsetAttrs {\n radians: number;\n fillValue: number|[number, number, number];\n center: number|[number, number];\n}\n\nexport const _FusedMatMul = '_FusedMatMul';\n// tslint:disable-next-line: class-name\nexport interface _FusedMatMulInputs extends NamedTensorInfoMap {\n a: TensorInfo;\n b: TensorInfo;\n bias?: TensorInfo;\n preluActivationWeights?: TensorInfo;\n}\n// tslint:disable-next-line: class-name\nexport interface _FusedMatMulAttrs {\n transposeA: boolean;\n transposeB: boolean;\n activation: Activation;\n leakyreluAlpha?: number;\n}\n\nexport const FusedConv2D = 'FusedConv2D';\nexport interface FusedConv2DInputs extends NamedTensorInfoMap {\n x: TensorInfo;\n filter: TensorInfo;\n bias?: TensorInfo;\n preluActivationWeights?: TensorInfo;\n}\nexport interface FusedConv2DAttrs {\n strides: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n dataFormat: 'NHWC'|'NCHW';\n dilations: [number, number]|number;\n dimRoundingMode: 'floor'|'round'|'ceil';\n activation: Activation;\n leakyreluAlpha?: number;\n}\n\nexport const FusedDepthwiseConv2D = 'FusedDepthwiseConv2D';\nexport interface FusedDepthwiseConv2DInputs extends NamedTensorInfoMap {\n x: TensorInfo;\n filter: TensorInfo;\n bias?: TensorInfo;\n preluActivationWeights?: TensorInfo;\n}\nexport interface FusedDepthwiseConv2DAttrs {\n strides: [number, number]|number;\n pad: 'valid'|'same'|number|ExplicitPadding;\n dataFormat: 'NHWC'|'NCHW';\n dilations: [number, number]|number;\n dimRoundingMode: 'floor'|'round'|'ceil';\n activation: Activation;\n leakyreluAlpha?: number;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env} from './environment';\n\nexport function warn(...msg: Array<{}>): void {\n if (!(env().getBool('IS_TEST') || env().getBool('PROD'))) {\n console.warn(...msg);\n }\n}\n\nexport function log(...msg: Array<{}>): void {\n if (!(env().getBool('IS_TEST') || env().getBool('PROD'))) {\n console.log(...msg);\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {env} from './environment';\nimport {getGlobal} from './global_util';\nimport * as log from './log';\nimport {NamedGradientMap} from './tape';\nimport {Tensor} from './tensor';\nimport {DataType, RecursiveArray} from './types';\n\nconst kernelRegistry =\n getGlobal('kernelRegistry', () => new Map());\nconst gradRegistry =\n getGlobal('gradRegistry', () => new Map());\n\nexport type DataId = object;\n\ntype AttributeValue =\n number|number[]|boolean|boolean[]|string|string[]|NamedAttrMap;\n\n/** These are extra non-tensor/primitive params passed to kernel functions. */\nexport type Attribute = AttributeValue|RecursiveArray;\n\n/** Specifies the code to run when executing a kernel. */\nexport type KernelFunc = (params: {\n inputs: NamedTensorInfoMap,\n backend: {},\n attrs?: NamedAttrMap,\n}) => TensorInfo|TensorInfo[];\n\n/** The function to run when computing a gradient during backprop. */\nexport type GradFunc =\n (dy: Tensor|Tensor[], saved: Tensor[], attrs: NamedAttrMap) =>\n NamedGradientMap;\n\n/** Function that gets called after the backend initializes. */\nexport type KernelSetupFunc = (backend: {}) => void;\n/** Function that gets called right before the backend is disposed. */\nexport type KernelDisposeFunc = KernelSetupFunc;\n\n/** Config object for registering a kernel in the global registry. */\nexport interface KernelConfig {\n kernelName: string;\n backendName: string;\n kernelFunc: KernelFunc;\n setupFunc?: KernelSetupFunc;\n disposeFunc?: KernelDisposeFunc;\n}\n\n/** Config object for registering a gradient in the global registry. */\nexport interface GradConfig {\n kernelName: string;\n inputsToSave?: string[];\n // When saveAllInputs is true, all inputs will be saved. Only use this flag\n // if inputs is an array of Tensors.\n saveAllInputs?: boolean;\n outputsToSave?: boolean[];\n gradFunc: GradFunc;\n}\n\n/** Holds metadata for a given tensor. */\nexport interface TensorInfo {\n dataId: DataId;\n shape: number[];\n dtype: DataType;\n}\n\nexport interface NamedTensorInfoMap {\n [name: string]: TensorInfo|undefined;\n}\n\nexport interface NamedAttrMap {\n [name: string]: Attribute;\n}\n\n/**\n * Returns the kernel function (code) associated with the provided names.\n *\n * @param kernelName The official name of the kernel.\n * @param backendName The official name of the backend.\n */\nexport function getKernel(\n kernelName: string, backendName: string): KernelConfig {\n const key = makeKey(kernelName, backendName);\n return kernelRegistry.get(key);\n}\n\n/**\n * Returns the registered gradient info associated with the provided kernel.\n * @param kernelName The official TF kernel name.\n */\nexport function getGradient(kernelName: string): GradConfig {\n return gradRegistry.get(kernelName);\n}\n\nexport function getKernelsForBackend(backendName: string): KernelConfig[] {\n const it = kernelRegistry.entries();\n const result: KernelConfig[] = [];\n\n while (true) {\n const {done, value} = it.next();\n if (done) {\n break;\n }\n const [key, config] = value;\n const [backend, ] = key.split('_');\n if (backend === backendName) {\n result.push(config);\n }\n }\n return result;\n}\n\n/**\n * Registers the function (forward pass) for the kernel in a global registry.\n *\n * @param config A config object with the following properties:\n * - `kernelName` The official name of the kernel.\n * - `backendName` The official name of the backend.\n * - `kernelFunc` The function to run during the forward pass of the kernel.\n * - `setupFunc` Optional. Gets called once, after the backend initializes.\n * - `disposeFunc` Optional. Gets called once, right before the backend is\n * disposed.\n */\nexport function registerKernel(config: KernelConfig) {\n const {kernelName, backendName} = config;\n const key = makeKey(kernelName, backendName);\n if (kernelRegistry.has(key)) {\n log.warn(\n `The kernel '${kernelName}' for backend ` +\n `'${backendName}' is already registered`);\n }\n kernelRegistry.set(key, config);\n}\n\n/**\n * Registers a gradient function for a given kernel in the global registry,\n * to be used during the back-propagation of that kernel.\n *\n * @param config An object with the following properties:\n * - `kernelName` The name of the kernel that the gradient function is for.\n * - `gradFunc` The function to run during back-propagation.\n */\nexport function registerGradient(config: GradConfig) {\n const {kernelName} = config;\n\n if (gradRegistry.has(kernelName)) {\n // TODO (yassogba) after 3.0 assess whether we need to keep this gated\n // to debug mode.\n if (env().getBool('DEBUG')) {\n log.warn(`Overriding the gradient for '${kernelName}'`);\n }\n }\n gradRegistry.set(kernelName, config);\n}\n\n/**\n * Removes the kernel function from the registry.\n *\n * @param kernelName The official name of the kernel.\n * @param backendName The official name of the backend.\n *\n */\nexport function unregisterKernel(\n kernelName: string, backendName: string): void {\n const key = makeKey(kernelName, backendName);\n if (!kernelRegistry.has(key)) {\n throw new Error(\n `The kernel '${kernelName}' for backend ` +\n `'${backendName}' is not registered`);\n }\n kernelRegistry.delete(key);\n}\n\n/** Removes the registered gradient from the global registry. */\nexport function unregisterGradient(kernelName: string): void {\n if (!gradRegistry.has(kernelName)) {\n throw new Error(\n `The gradient '${kernelName}' for backend is not registered`);\n }\n gradRegistry.delete(kernelName);\n}\n\n/**\n * Finds kernels that have already been registered to a backend and re-registers\n * them for a new backend. Useful for registering custom backends.\n * @param registeredBackendName Already registered backend.\n * @param newBackendName New backend.\n */\nexport function copyRegisteredKernels(\n registeredBackendName: string, newBackendName: string): void {\n const kernels = getKernelsForBackend(registeredBackendName);\n kernels.forEach(kernelConfig => {\n const newKernelConfig =\n Object.assign({}, kernelConfig, {backendName: newBackendName});\n registerKernel(newKernelConfig);\n });\n}\n\nfunction makeKey(kernelName: string, backendName: string) {\n return `${backendName}_${kernelName}`;\n}\n","module.exports = Long;\r\n\r\n/**\r\n * wasm optimizations, to do native i64 multiplication and divide\r\n */\r\nvar wasm = null;\r\n\r\ntry {\r\n wasm = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([\r\n 0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11\r\n ])), {}).exports;\r\n} catch (e) {\r\n // no wasm support :(\r\n}\r\n\r\n/**\r\n * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.\r\n * See the from* functions below for more convenient ways of constructing Longs.\r\n * @exports Long\r\n * @class A Long class for representing a 64 bit two's-complement integer value.\r\n * @param {number} low The low (signed) 32 bits of the long\r\n * @param {number} high The high (signed) 32 bits of the long\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @constructor\r\n */\r\nfunction Long(low, high, unsigned) {\r\n\r\n /**\r\n * The low 32 bits as a signed value.\r\n * @type {number}\r\n */\r\n this.low = low | 0;\r\n\r\n /**\r\n * The high 32 bits as a signed value.\r\n * @type {number}\r\n */\r\n this.high = high | 0;\r\n\r\n /**\r\n * Whether unsigned or not.\r\n * @type {boolean}\r\n */\r\n this.unsigned = !!unsigned;\r\n}\r\n\r\n// The internal representation of a long is the two given signed, 32-bit values.\r\n// We use 32-bit pieces because these are the size of integers on which\r\n// Javascript performs bit-operations. For operations like addition and\r\n// multiplication, we split each number into 16 bit pieces, which can easily be\r\n// multiplied within Javascript's floating-point representation without overflow\r\n// or change in sign.\r\n//\r\n// In the algorithms below, we frequently reduce the negative case to the\r\n// positive case by negating the input(s) and then post-processing the result.\r\n// Note that we must ALWAYS check specially whether those values are MIN_VALUE\r\n// (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as\r\n// a positive number, it overflows back into a negative). Not handling this\r\n// case would often result in infinite recursion.\r\n//\r\n// Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*\r\n// methods on which they depend.\r\n\r\n/**\r\n * An indicator used to reliably determine if an object is a Long or not.\r\n * @type {boolean}\r\n * @const\r\n * @private\r\n */\r\nLong.prototype.__isLong__;\r\n\r\nObject.defineProperty(Long.prototype, \"__isLong__\", { value: true });\r\n\r\n/**\r\n * @function\r\n * @param {*} obj Object\r\n * @returns {boolean}\r\n * @inner\r\n */\r\nfunction isLong(obj) {\r\n return (obj && obj[\"__isLong__\"]) === true;\r\n}\r\n\r\n/**\r\n * Tests if the specified object is a Long.\r\n * @function\r\n * @param {*} obj Object\r\n * @returns {boolean}\r\n */\r\nLong.isLong = isLong;\r\n\r\n/**\r\n * A cache of the Long representations of small integer values.\r\n * @type {!Object}\r\n * @inner\r\n */\r\nvar INT_CACHE = {};\r\n\r\n/**\r\n * A cache of the Long representations of small unsigned integer values.\r\n * @type {!Object}\r\n * @inner\r\n */\r\nvar UINT_CACHE = {};\r\n\r\n/**\r\n * @param {number} value\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromInt(value, unsigned) {\r\n var obj, cachedObj, cache;\r\n if (unsigned) {\r\n value >>>= 0;\r\n if (cache = (0 <= value && value < 256)) {\r\n cachedObj = UINT_CACHE[value];\r\n if (cachedObj)\r\n return cachedObj;\r\n }\r\n obj = fromBits(value, (value | 0) < 0 ? -1 : 0, true);\r\n if (cache)\r\n UINT_CACHE[value] = obj;\r\n return obj;\r\n } else {\r\n value |= 0;\r\n if (cache = (-128 <= value && value < 128)) {\r\n cachedObj = INT_CACHE[value];\r\n if (cachedObj)\r\n return cachedObj;\r\n }\r\n obj = fromBits(value, value < 0 ? -1 : 0, false);\r\n if (cache)\r\n INT_CACHE[value] = obj;\r\n return obj;\r\n }\r\n}\r\n\r\n/**\r\n * Returns a Long representing the given 32 bit integer value.\r\n * @function\r\n * @param {number} value The 32 bit integer in question\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromInt = fromInt;\r\n\r\n/**\r\n * @param {number} value\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromNumber(value, unsigned) {\r\n if (isNaN(value))\r\n return unsigned ? UZERO : ZERO;\r\n if (unsigned) {\r\n if (value < 0)\r\n return UZERO;\r\n if (value >= TWO_PWR_64_DBL)\r\n return MAX_UNSIGNED_VALUE;\r\n } else {\r\n if (value <= -TWO_PWR_63_DBL)\r\n return MIN_VALUE;\r\n if (value + 1 >= TWO_PWR_63_DBL)\r\n return MAX_VALUE;\r\n }\r\n if (value < 0)\r\n return fromNumber(-value, unsigned).neg();\r\n return fromBits((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);\r\n}\r\n\r\n/**\r\n * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.\r\n * @function\r\n * @param {number} value The number in question\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromNumber = fromNumber;\r\n\r\n/**\r\n * @param {number} lowBits\r\n * @param {number} highBits\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromBits(lowBits, highBits, unsigned) {\r\n return new Long(lowBits, highBits, unsigned);\r\n}\r\n\r\n/**\r\n * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is\r\n * assumed to use 32 bits.\r\n * @function\r\n * @param {number} lowBits The low 32 bits\r\n * @param {number} highBits The high 32 bits\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromBits = fromBits;\r\n\r\n/**\r\n * @function\r\n * @param {number} base\r\n * @param {number} exponent\r\n * @returns {number}\r\n * @inner\r\n */\r\nvar pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4)\r\n\r\n/**\r\n * @param {string} str\r\n * @param {(boolean|number)=} unsigned\r\n * @param {number=} radix\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromString(str, unsigned, radix) {\r\n if (str.length === 0)\r\n throw Error('empty string');\r\n if (str === \"NaN\" || str === \"Infinity\" || str === \"+Infinity\" || str === \"-Infinity\")\r\n return ZERO;\r\n if (typeof unsigned === 'number') {\r\n // For goog.math.long compatibility\r\n radix = unsigned,\r\n unsigned = false;\r\n } else {\r\n unsigned = !! unsigned;\r\n }\r\n radix = radix || 10;\r\n if (radix < 2 || 36 < radix)\r\n throw RangeError('radix');\r\n\r\n var p;\r\n if ((p = str.indexOf('-')) > 0)\r\n throw Error('interior hyphen');\r\n else if (p === 0) {\r\n return fromString(str.substring(1), unsigned, radix).neg();\r\n }\r\n\r\n // Do several (8) digits each time through the loop, so as to\r\n // minimize the calls to the very expensive emulated div.\r\n var radixToPower = fromNumber(pow_dbl(radix, 8));\r\n\r\n var result = ZERO;\r\n for (var i = 0; i < str.length; i += 8) {\r\n var size = Math.min(8, str.length - i),\r\n value = parseInt(str.substring(i, i + size), radix);\r\n if (size < 8) {\r\n var power = fromNumber(pow_dbl(radix, size));\r\n result = result.mul(power).add(fromNumber(value));\r\n } else {\r\n result = result.mul(radixToPower);\r\n result = result.add(fromNumber(value));\r\n }\r\n }\r\n result.unsigned = unsigned;\r\n return result;\r\n}\r\n\r\n/**\r\n * Returns a Long representation of the given string, written using the specified radix.\r\n * @function\r\n * @param {string} str The textual representation of the Long\r\n * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to signed\r\n * @param {number=} radix The radix in which the text is written (2-36), defaults to 10\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromString = fromString;\r\n\r\n/**\r\n * @function\r\n * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromValue(val, unsigned) {\r\n if (typeof val === 'number')\r\n return fromNumber(val, unsigned);\r\n if (typeof val === 'string')\r\n return fromString(val, unsigned);\r\n // Throws for non-objects, converts non-instanceof Long:\r\n return fromBits(val.low, val.high, typeof unsigned === 'boolean' ? unsigned : val.unsigned);\r\n}\r\n\r\n/**\r\n * Converts the specified value to a Long using the appropriate from* function for its type.\r\n * @function\r\n * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long}\r\n */\r\nLong.fromValue = fromValue;\r\n\r\n// NOTE: the compiler should inline these constant values below and then remove these variables, so there should be\r\n// no runtime penalty for these.\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_16_DBL = 1 << 16;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_24_DBL = 1 << 24;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;\r\n\r\n/**\r\n * @type {!Long}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar ZERO = fromInt(0);\r\n\r\n/**\r\n * Signed zero.\r\n * @type {!Long}\r\n */\r\nLong.ZERO = ZERO;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar UZERO = fromInt(0, true);\r\n\r\n/**\r\n * Unsigned zero.\r\n * @type {!Long}\r\n */\r\nLong.UZERO = UZERO;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar ONE = fromInt(1);\r\n\r\n/**\r\n * Signed one.\r\n * @type {!Long}\r\n */\r\nLong.ONE = ONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar UONE = fromInt(1, true);\r\n\r\n/**\r\n * Unsigned one.\r\n * @type {!Long}\r\n */\r\nLong.UONE = UONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar NEG_ONE = fromInt(-1);\r\n\r\n/**\r\n * Signed negative one.\r\n * @type {!Long}\r\n */\r\nLong.NEG_ONE = NEG_ONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MAX_VALUE = fromBits(0xFFFFFFFF|0, 0x7FFFFFFF|0, false);\r\n\r\n/**\r\n * Maximum signed value.\r\n * @type {!Long}\r\n */\r\nLong.MAX_VALUE = MAX_VALUE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF|0, 0xFFFFFFFF|0, true);\r\n\r\n/**\r\n * Maximum unsigned value.\r\n * @type {!Long}\r\n */\r\nLong.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MIN_VALUE = fromBits(0, 0x80000000|0, false);\r\n\r\n/**\r\n * Minimum signed value.\r\n * @type {!Long}\r\n */\r\nLong.MIN_VALUE = MIN_VALUE;\r\n\r\n/**\r\n * @alias Long.prototype\r\n * @inner\r\n */\r\nvar LongPrototype = Long.prototype;\r\n\r\n/**\r\n * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.\r\n * @returns {number}\r\n */\r\nLongPrototype.toInt = function toInt() {\r\n return this.unsigned ? this.low >>> 0 : this.low;\r\n};\r\n\r\n/**\r\n * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).\r\n * @returns {number}\r\n */\r\nLongPrototype.toNumber = function toNumber() {\r\n if (this.unsigned)\r\n return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0);\r\n return this.high * TWO_PWR_32_DBL + (this.low >>> 0);\r\n};\r\n\r\n/**\r\n * Converts the Long to a string written in the specified radix.\r\n * @param {number=} radix Radix (2-36), defaults to 10\r\n * @returns {string}\r\n * @override\r\n * @throws {RangeError} If `radix` is out of range\r\n */\r\nLongPrototype.toString = function toString(radix) {\r\n radix = radix || 10;\r\n if (radix < 2 || 36 < radix)\r\n throw RangeError('radix');\r\n if (this.isZero())\r\n return '0';\r\n if (this.isNegative()) { // Unsigned Longs are never negative\r\n if (this.eq(MIN_VALUE)) {\r\n // We need to change the Long value before it can be negated, so we remove\r\n // the bottom-most digit in this base and then recurse to do the rest.\r\n var radixLong = fromNumber(radix),\r\n div = this.div(radixLong),\r\n rem1 = div.mul(radixLong).sub(this);\r\n return div.toString(radix) + rem1.toInt().toString(radix);\r\n } else\r\n return '-' + this.neg().toString(radix);\r\n }\r\n\r\n // Do several (6) digits each time through the loop, so as to\r\n // minimize the calls to the very expensive emulated div.\r\n var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned),\r\n rem = this;\r\n var result = '';\r\n while (true) {\r\n var remDiv = rem.div(radixToPower),\r\n intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0,\r\n digits = intval.toString(radix);\r\n rem = remDiv;\r\n if (rem.isZero())\r\n return digits + result;\r\n else {\r\n while (digits.length < 6)\r\n digits = '0' + digits;\r\n result = '' + digits + result;\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Gets the high 32 bits as a signed integer.\r\n * @returns {number} Signed high bits\r\n */\r\nLongPrototype.getHighBits = function getHighBits() {\r\n return this.high;\r\n};\r\n\r\n/**\r\n * Gets the high 32 bits as an unsigned integer.\r\n * @returns {number} Unsigned high bits\r\n */\r\nLongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {\r\n return this.high >>> 0;\r\n};\r\n\r\n/**\r\n * Gets the low 32 bits as a signed integer.\r\n * @returns {number} Signed low bits\r\n */\r\nLongPrototype.getLowBits = function getLowBits() {\r\n return this.low;\r\n};\r\n\r\n/**\r\n * Gets the low 32 bits as an unsigned integer.\r\n * @returns {number} Unsigned low bits\r\n */\r\nLongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {\r\n return this.low >>> 0;\r\n};\r\n\r\n/**\r\n * Gets the number of bits needed to represent the absolute value of this Long.\r\n * @returns {number}\r\n */\r\nLongPrototype.getNumBitsAbs = function getNumBitsAbs() {\r\n if (this.isNegative()) // Unsigned Longs are never negative\r\n return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();\r\n var val = this.high != 0 ? this.high : this.low;\r\n for (var bit = 31; bit > 0; bit--)\r\n if ((val & (1 << bit)) != 0)\r\n break;\r\n return this.high != 0 ? bit + 33 : bit + 1;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals zero.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isZero = function isZero() {\r\n return this.high === 0 && this.low === 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals zero. This is an alias of {@link Long#isZero}.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.eqz = LongPrototype.isZero;\r\n\r\n/**\r\n * Tests if this Long's value is negative.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isNegative = function isNegative() {\r\n return !this.unsigned && this.high < 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is positive.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isPositive = function isPositive() {\r\n return this.unsigned || this.high >= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is odd.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isOdd = function isOdd() {\r\n return (this.low & 1) === 1;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is even.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isEven = function isEven() {\r\n return (this.low & 1) === 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.equals = function equals(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1)\r\n return false;\r\n return this.high === other.high && this.low === other.low;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.eq = LongPrototype.equals;\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.notEquals = function notEquals(other) {\r\n return !this.eq(/* validates */ other);\r\n};\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.neq = LongPrototype.notEquals;\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.ne = LongPrototype.notEquals;\r\n\r\n/**\r\n * Tests if this Long's value is less than the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lessThan = function lessThan(other) {\r\n return this.comp(/* validates */ other) < 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lt = LongPrototype.lessThan;\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {\r\n return this.comp(/* validates */ other) <= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lte = LongPrototype.lessThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.le = LongPrototype.lessThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is greater than the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.greaterThan = function greaterThan(other) {\r\n return this.comp(/* validates */ other) > 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.gt = LongPrototype.greaterThan;\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {\r\n return this.comp(/* validates */ other) >= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.gte = LongPrototype.greaterThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.ge = LongPrototype.greaterThanOrEqual;\r\n\r\n/**\r\n * Compares this Long's value with the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {number} 0 if they are the same, 1 if the this is greater and -1\r\n * if the given one is greater\r\n */\r\nLongPrototype.compare = function compare(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n if (this.eq(other))\r\n return 0;\r\n var thisNeg = this.isNegative(),\r\n otherNeg = other.isNegative();\r\n if (thisNeg && !otherNeg)\r\n return -1;\r\n if (!thisNeg && otherNeg)\r\n return 1;\r\n // At this point the sign bits are the same\r\n if (!this.unsigned)\r\n return this.sub(other).isNegative() ? -1 : 1;\r\n // Both are positive if at least one is unsigned\r\n return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1;\r\n};\r\n\r\n/**\r\n * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {number} 0 if they are the same, 1 if the this is greater and -1\r\n * if the given one is greater\r\n */\r\nLongPrototype.comp = LongPrototype.compare;\r\n\r\n/**\r\n * Negates this Long's value.\r\n * @returns {!Long} Negated Long\r\n */\r\nLongPrototype.negate = function negate() {\r\n if (!this.unsigned && this.eq(MIN_VALUE))\r\n return MIN_VALUE;\r\n return this.not().add(ONE);\r\n};\r\n\r\n/**\r\n * Negates this Long's value. This is an alias of {@link Long#negate}.\r\n * @function\r\n * @returns {!Long} Negated Long\r\n */\r\nLongPrototype.neg = LongPrototype.negate;\r\n\r\n/**\r\n * Returns the sum of this and the specified Long.\r\n * @param {!Long|number|string} addend Addend\r\n * @returns {!Long} Sum\r\n */\r\nLongPrototype.add = function add(addend) {\r\n if (!isLong(addend))\r\n addend = fromValue(addend);\r\n\r\n // Divide each number into 4 chunks of 16 bits, and then sum the chunks.\r\n\r\n var a48 = this.high >>> 16;\r\n var a32 = this.high & 0xFFFF;\r\n var a16 = this.low >>> 16;\r\n var a00 = this.low & 0xFFFF;\r\n\r\n var b48 = addend.high >>> 16;\r\n var b32 = addend.high & 0xFFFF;\r\n var b16 = addend.low >>> 16;\r\n var b00 = addend.low & 0xFFFF;\r\n\r\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\r\n c00 += a00 + b00;\r\n c16 += c00 >>> 16;\r\n c00 &= 0xFFFF;\r\n c16 += a16 + b16;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c32 += a32 + b32;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c48 += a48 + b48;\r\n c48 &= 0xFFFF;\r\n return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the difference of this and the specified Long.\r\n * @param {!Long|number|string} subtrahend Subtrahend\r\n * @returns {!Long} Difference\r\n */\r\nLongPrototype.subtract = function subtract(subtrahend) {\r\n if (!isLong(subtrahend))\r\n subtrahend = fromValue(subtrahend);\r\n return this.add(subtrahend.neg());\r\n};\r\n\r\n/**\r\n * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.\r\n * @function\r\n * @param {!Long|number|string} subtrahend Subtrahend\r\n * @returns {!Long} Difference\r\n */\r\nLongPrototype.sub = LongPrototype.subtract;\r\n\r\n/**\r\n * Returns the product of this and the specified Long.\r\n * @param {!Long|number|string} multiplier Multiplier\r\n * @returns {!Long} Product\r\n */\r\nLongPrototype.multiply = function multiply(multiplier) {\r\n if (this.isZero())\r\n return ZERO;\r\n if (!isLong(multiplier))\r\n multiplier = fromValue(multiplier);\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n var low = wasm.mul(this.low,\r\n this.high,\r\n multiplier.low,\r\n multiplier.high);\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n if (multiplier.isZero())\r\n return ZERO;\r\n if (this.eq(MIN_VALUE))\r\n return multiplier.isOdd() ? MIN_VALUE : ZERO;\r\n if (multiplier.eq(MIN_VALUE))\r\n return this.isOdd() ? MIN_VALUE : ZERO;\r\n\r\n if (this.isNegative()) {\r\n if (multiplier.isNegative())\r\n return this.neg().mul(multiplier.neg());\r\n else\r\n return this.neg().mul(multiplier).neg();\r\n } else if (multiplier.isNegative())\r\n return this.mul(multiplier.neg()).neg();\r\n\r\n // If both longs are small, use float multiplication\r\n if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))\r\n return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);\r\n\r\n // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.\r\n // We can skip products that would overflow.\r\n\r\n var a48 = this.high >>> 16;\r\n var a32 = this.high & 0xFFFF;\r\n var a16 = this.low >>> 16;\r\n var a00 = this.low & 0xFFFF;\r\n\r\n var b48 = multiplier.high >>> 16;\r\n var b32 = multiplier.high & 0xFFFF;\r\n var b16 = multiplier.low >>> 16;\r\n var b00 = multiplier.low & 0xFFFF;\r\n\r\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\r\n c00 += a00 * b00;\r\n c16 += c00 >>> 16;\r\n c00 &= 0xFFFF;\r\n c16 += a16 * b00;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c16 += a00 * b16;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c32 += a32 * b00;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c32 += a16 * b16;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c32 += a00 * b32;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;\r\n c48 &= 0xFFFF;\r\n return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.\r\n * @function\r\n * @param {!Long|number|string} multiplier Multiplier\r\n * @returns {!Long} Product\r\n */\r\nLongPrototype.mul = LongPrototype.multiply;\r\n\r\n/**\r\n * Returns this Long divided by the specified. The result is signed if this Long is signed or\r\n * unsigned if this Long is unsigned.\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Quotient\r\n */\r\nLongPrototype.divide = function divide(divisor) {\r\n if (!isLong(divisor))\r\n divisor = fromValue(divisor);\r\n if (divisor.isZero())\r\n throw Error('division by zero');\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n // guard against signed division overflow: the largest\r\n // negative number / -1 would be 1 larger than the largest\r\n // positive number, due to two's complement.\r\n if (!this.unsigned &&\r\n this.high === -0x80000000 &&\r\n divisor.low === -1 && divisor.high === -1) {\r\n // be consistent with non-wasm code path\r\n return this;\r\n }\r\n var low = (this.unsigned ? wasm.div_u : wasm.div_s)(\r\n this.low,\r\n this.high,\r\n divisor.low,\r\n divisor.high\r\n );\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n if (this.isZero())\r\n return this.unsigned ? UZERO : ZERO;\r\n var approx, rem, res;\r\n if (!this.unsigned) {\r\n // This section is only relevant for signed longs and is derived from the\r\n // closure library as a whole.\r\n if (this.eq(MIN_VALUE)) {\r\n if (divisor.eq(ONE) || divisor.eq(NEG_ONE))\r\n return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE\r\n else if (divisor.eq(MIN_VALUE))\r\n return ONE;\r\n else {\r\n // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.\r\n var halfThis = this.shr(1);\r\n approx = halfThis.div(divisor).shl(1);\r\n if (approx.eq(ZERO)) {\r\n return divisor.isNegative() ? ONE : NEG_ONE;\r\n } else {\r\n rem = this.sub(divisor.mul(approx));\r\n res = approx.add(rem.div(divisor));\r\n return res;\r\n }\r\n }\r\n } else if (divisor.eq(MIN_VALUE))\r\n return this.unsigned ? UZERO : ZERO;\r\n if (this.isNegative()) {\r\n if (divisor.isNegative())\r\n return this.neg().div(divisor.neg());\r\n return this.neg().div(divisor).neg();\r\n } else if (divisor.isNegative())\r\n return this.div(divisor.neg()).neg();\r\n res = ZERO;\r\n } else {\r\n // The algorithm below has not been made for unsigned longs. It's therefore\r\n // required to take special care of the MSB prior to running it.\r\n if (!divisor.unsigned)\r\n divisor = divisor.toUnsigned();\r\n if (divisor.gt(this))\r\n return UZERO;\r\n if (divisor.gt(this.shru(1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true\r\n return UONE;\r\n res = UZERO;\r\n }\r\n\r\n // Repeat the following until the remainder is less than other: find a\r\n // floating-point that approximates remainder / other *from below*, add this\r\n // into the result, and subtract it from the remainder. It is critical that\r\n // the approximate value is less than or equal to the real value so that the\r\n // remainder never becomes negative.\r\n rem = this;\r\n while (rem.gte(divisor)) {\r\n // Approximate the result of division. This may be a little greater or\r\n // smaller than the actual value.\r\n approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));\r\n\r\n // We will tweak the approximate result by changing it in the 48-th digit or\r\n // the smallest non-fractional digit, whichever is larger.\r\n var log2 = Math.ceil(Math.log(approx) / Math.LN2),\r\n delta = (log2 <= 48) ? 1 : pow_dbl(2, log2 - 48),\r\n\r\n // Decrease the approximation until it is smaller than the remainder. Note\r\n // that if it is too large, the product overflows and is negative.\r\n approxRes = fromNumber(approx),\r\n approxRem = approxRes.mul(divisor);\r\n while (approxRem.isNegative() || approxRem.gt(rem)) {\r\n approx -= delta;\r\n approxRes = fromNumber(approx, this.unsigned);\r\n approxRem = approxRes.mul(divisor);\r\n }\r\n\r\n // We know the answer can't be zero... and actually, zero would cause\r\n // infinite recursion since we would make no progress.\r\n if (approxRes.isZero())\r\n approxRes = ONE;\r\n\r\n res = res.add(approxRes);\r\n rem = rem.sub(approxRem);\r\n }\r\n return res;\r\n};\r\n\r\n/**\r\n * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Quotient\r\n */\r\nLongPrototype.div = LongPrototype.divide;\r\n\r\n/**\r\n * Returns this Long modulo the specified.\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.modulo = function modulo(divisor) {\r\n if (!isLong(divisor))\r\n divisor = fromValue(divisor);\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n var low = (this.unsigned ? wasm.rem_u : wasm.rem_s)(\r\n this.low,\r\n this.high,\r\n divisor.low,\r\n divisor.high\r\n );\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n return this.sub(this.div(divisor).mul(divisor));\r\n};\r\n\r\n/**\r\n * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.mod = LongPrototype.modulo;\r\n\r\n/**\r\n * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.rem = LongPrototype.modulo;\r\n\r\n/**\r\n * Returns the bitwise NOT of this Long.\r\n * @returns {!Long}\r\n */\r\nLongPrototype.not = function not() {\r\n return fromBits(~this.low, ~this.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise AND of this Long and the specified.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.and = function and(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low & other.low, this.high & other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise OR of this Long and the specified.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.or = function or(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low | other.low, this.high | other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise XOR of this Long and the given one.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.xor = function xor(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits shifted to the left by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftLeft = function shiftLeft(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n if ((numBits &= 63) === 0)\r\n return this;\r\n else if (numBits < 32)\r\n return fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);\r\n else\r\n return fromBits(0, this.low << (numBits - 32), this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shl = LongPrototype.shiftLeft;\r\n\r\n/**\r\n * Returns this Long with bits arithmetically shifted to the right by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftRight = function shiftRight(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n if ((numBits &= 63) === 0)\r\n return this;\r\n else if (numBits < 32)\r\n return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);\r\n else\r\n return fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shr = LongPrototype.shiftRight;\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n numBits &= 63;\r\n if (numBits === 0)\r\n return this;\r\n else {\r\n var high = this.high;\r\n if (numBits < 32) {\r\n var low = this.low;\r\n return fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned);\r\n } else if (numBits === 32)\r\n return fromBits(high, 0, this.unsigned);\r\n else\r\n return fromBits(high >>> (numBits - 32), 0, this.unsigned);\r\n }\r\n};\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shru = LongPrototype.shiftRightUnsigned;\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shr_u = LongPrototype.shiftRightUnsigned;\r\n\r\n/**\r\n * Converts this Long to signed.\r\n * @returns {!Long} Signed long\r\n */\r\nLongPrototype.toSigned = function toSigned() {\r\n if (!this.unsigned)\r\n return this;\r\n return fromBits(this.low, this.high, false);\r\n};\r\n\r\n/**\r\n * Converts this Long to unsigned.\r\n * @returns {!Long} Unsigned long\r\n */\r\nLongPrototype.toUnsigned = function toUnsigned() {\r\n if (this.unsigned)\r\n return this;\r\n return fromBits(this.low, this.high, true);\r\n};\r\n\r\n/**\r\n * Converts this Long to its byte representation.\r\n * @param {boolean=} le Whether little or big endian, defaults to big endian\r\n * @returns {!Array.} Byte representation\r\n */\r\nLongPrototype.toBytes = function toBytes(le) {\r\n return le ? this.toBytesLE() : this.toBytesBE();\r\n};\r\n\r\n/**\r\n * Converts this Long to its little endian byte representation.\r\n * @returns {!Array.} Little endian byte representation\r\n */\r\nLongPrototype.toBytesLE = function toBytesLE() {\r\n var hi = this.high,\r\n lo = this.low;\r\n return [\r\n lo & 0xff,\r\n lo >>> 8 & 0xff,\r\n lo >>> 16 & 0xff,\r\n lo >>> 24 ,\r\n hi & 0xff,\r\n hi >>> 8 & 0xff,\r\n hi >>> 16 & 0xff,\r\n hi >>> 24\r\n ];\r\n};\r\n\r\n/**\r\n * Converts this Long to its big endian byte representation.\r\n * @returns {!Array.} Big endian byte representation\r\n */\r\nLongPrototype.toBytesBE = function toBytesBE() {\r\n var hi = this.high,\r\n lo = this.low;\r\n return [\r\n hi >>> 24 ,\r\n hi >>> 16 & 0xff,\r\n hi >>> 8 & 0xff,\r\n hi & 0xff,\r\n lo >>> 24 ,\r\n lo >>> 16 & 0xff,\r\n lo >>> 8 & 0xff,\r\n lo & 0xff\r\n ];\r\n};\r\n\r\n/**\r\n * Creates a Long from its byte representation.\r\n * @param {!Array.} bytes Byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @param {boolean=} le Whether little or big endian, defaults to big endian\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytes = function fromBytes(bytes, unsigned, le) {\r\n return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned);\r\n};\r\n\r\n/**\r\n * Creates a Long from its little endian byte representation.\r\n * @param {!Array.} bytes Little endian byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytesLE = function fromBytesLE(bytes, unsigned) {\r\n return new Long(\r\n bytes[0] |\r\n bytes[1] << 8 |\r\n bytes[2] << 16 |\r\n bytes[3] << 24,\r\n bytes[4] |\r\n bytes[5] << 8 |\r\n bytes[6] << 16 |\r\n bytes[7] << 24,\r\n unsigned\r\n );\r\n};\r\n\r\n/**\r\n * Creates a Long from its big endian byte representation.\r\n * @param {!Array.} bytes Big endian byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytesBE = function fromBytesBE(bytes, unsigned) {\r\n return new Long(\r\n bytes[4] << 24 |\r\n bytes[5] << 16 |\r\n bytes[6] << 8 |\r\n bytes[7],\r\n bytes[0] << 24 |\r\n bytes[1] << 16 |\r\n bytes[2] << 8 |\r\n bytes[3],\r\n unsigned\r\n );\r\n};\r\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n// Workaround for allowing cjs module to be included in bundle created by\n// rollup.\nimport * as LongExports from 'long';\n// tslint:disable-next-line\nconst Long: LongExports.LongConstructor =\n // tslint:disable-next-line\n (LongExports as any).default || LongExports;\n\nexport function hexToLong(hex: string): Long {\n return Long.fromString(hex, true, 16);\n}\n\n// Some primes between 2^63 and 2^64 for various uses.\n// Hex 0xc3a5c85c97cb3127\nconst k0: Long = hexToLong('c3a5c85c97cb3127');\n// Hex 0xb492b66fbe98f273\nconst k1: Long = hexToLong('b492b66fbe98f273');\n// Hex 0x9ae16a3b2f90404f\nconst k2: Long = hexToLong('9ae16a3b2f90404f');\n\nfunction shiftMix(val: Long): Long {\n return val.xor(val.shru(47));\n}\n\nfunction fetch(s: Uint8Array, offset: number, numBytes: number): Long {\n const bytes = s.slice(offset, offset + numBytes);\n return Long.fromBytes(Array.from(bytes), true, true);\n}\n\nfunction fetch64(s: Uint8Array, offset: number): Long {\n return fetch(s, offset, 8);\n}\n\nfunction fetch32(s: Uint8Array, offset: number): Long {\n return fetch(s, offset, 4);\n}\n\nfunction rotate64(val: Long, shift: number): Long {\n // Avoid shifting by 64: doing so yields an undefined result.\n return shift === 0 ? val : val.shru(shift).or(val.shl(64 - shift));\n}\n\nfunction hashLen16(u: Long, v: Long, mul = hexToLong('9ddfea08eb382d69')) {\n // Murmur-inspired hashing.\n let a = u.xor(v).mul(mul);\n a = a.xor(a.shru(47));\n let b = v.xor(a).mul(mul);\n b = b.xor(b.shru(47));\n b = b.mul(mul);\n return b;\n}\n\n// Return a 16-byte hash for 48 bytes. Quick and dirty.\n// Callers do best to use \"random-looking\" values for a and b.\nfunction weakHashLen32WithSeeds(\n w: Long, x: Long, y: Long, z: Long, a: Long, b: Long) {\n a = a.add(w);\n b = rotate64(b.add(a).add(z), 21);\n const c = a;\n a = a.add(x);\n a = a.add(y);\n b = b.add(rotate64(a, 44));\n return [a.add(z), b.add(c)];\n}\n\nfunction weakHashLen32WithSeedsStr(\n s: Uint8Array, offset: number, a: Long, b: Long) {\n return weakHashLen32WithSeeds(\n fetch64(s, offset), fetch64(s, offset + 8), fetch64(s, offset + 16),\n fetch64(s, offset + 24), a, b);\n}\n\nfunction hashLen0to16(s: Uint8Array, len = s.length): Long {\n if (len >= 8) {\n const mul = k2.add(len * 2);\n const a = fetch64(s, 0).add(k2);\n const b = fetch64(s, len - 8);\n const c = rotate64(b, 37).mul(mul).add(a);\n const d = rotate64(a, 25).add(b).mul(mul);\n return hashLen16(c, d, mul);\n }\n if (len >= 4) {\n const mul = k2.add(len * 2);\n const a = fetch32(s, 0);\n return hashLen16(a.shl(3).add(len), fetch32(s, len - 4), mul);\n }\n if (len > 0) {\n const a = s[0];\n const b = s[len >> 1];\n const c = s[len - 1];\n const y = a + (b << 8);\n const z = len + (c << 2);\n return shiftMix(k2.mul(y).xor(k0.mul(z))).mul(k2);\n }\n return k2;\n}\n\nfunction hashLen17to32(s: Uint8Array, len = s.length): Long {\n const mul = k2.add(len * 2);\n const a = fetch64(s, 0).mul(k1);\n const b = fetch64(s, 8);\n const c = fetch64(s, len - 8).mul(mul);\n const d = fetch64(s, len - 16).mul(k2);\n return hashLen16(\n rotate64(a.add(b), 43).add(rotate64(c, 30)).add(d),\n a.add(rotate64(b.add(k2), 18)).add(c), mul);\n}\n\nfunction hashLen33to64(s: Uint8Array, len = s.length): Long {\n const mul = k2.add(len * 2);\n const a = fetch64(s, 0).mul(k2);\n const b = fetch64(s, 8);\n const c = fetch64(s, len - 8).mul(mul);\n const d = fetch64(s, len - 16).mul(k2);\n const y = rotate64(a.add(b), 43).add(rotate64(c, 30)).add(d);\n const z = hashLen16(y, a.add(rotate64(b.add(k2), 18)).add(c), mul);\n const e = fetch64(s, 16).mul(mul);\n const f = fetch64(s, 24);\n const g = y.add(fetch64(s, len - 32)).mul(mul);\n const h = z.add(fetch64(s, len - 24)).mul(mul);\n return hashLen16(\n rotate64(e.add(f), 43).add(rotate64(g, 30)).add(h),\n e.add(rotate64(f.add(a), 18)).add(g), mul);\n}\n\nexport function fingerPrint64(s: Uint8Array, len = s.length): Long {\n const seed: Long = Long.fromNumber(81, true);\n if (len <= 32) {\n if (len <= 16) {\n return hashLen0to16(s, len);\n } else {\n return hashLen17to32(s, len);\n }\n } else if (len <= 64) {\n return hashLen33to64(s, len);\n }\n\n // For strings over 64 bytes we loop. Internal state consists of\n // 56 bytes: v, w, x, y, and z.\n let x = seed;\n let y = seed.mul(k1).add(113);\n\n let z = shiftMix(y.mul(k2).add(113)).mul(k2);\n let v = [Long.UZERO, Long.UZERO];\n let w = [Long.UZERO, Long.UZERO];\n x = x.mul(k2).add(fetch64(s, 0));\n\n let offset = 0;\n // Set end so that after the loop we have 1 to 64 bytes left to process.\n const end = ((len - 1) >> 6) * 64;\n const last64 = end + ((len - 1) & 63) - 63;\n\n do {\n x = rotate64(x.add(y).add(v[0]).add(fetch64(s, offset + 8)), 37).mul(k1);\n y = rotate64(y.add(v[1]).add(fetch64(s, offset + 48)), 42).mul(k1);\n x = x.xor(w[1]);\n y = y.add(v[0]).add(fetch64(s, offset + 40));\n z = rotate64(z.add(w[0]), 33).mul(k1);\n v = weakHashLen32WithSeedsStr(s, offset, v[1].mul(k1), x.add(w[0]));\n w = weakHashLen32WithSeedsStr(\n s, offset + 32, z.add(w[1]), y.add(fetch64(s, offset + 16)));\n\n [z, x] = [x, z];\n offset += 64;\n } while (offset !== end);\n const mul = k1.add(z.and(0xff).shl(1));\n // Point to the last 64 bytes of input.\n offset = last64;\n\n w[0] = w[0].add((len - 1) & 63);\n v[0] = v[0].add(w[0]);\n w[0] = w[0].add(v[0]);\n\n x = rotate64(x.add(y).add(v[0]).add(fetch64(s, offset + 8)), 37).mul(mul);\n y = rotate64(y.add(v[1]).add(fetch64(s, offset + 48)), 42).mul(mul);\n x = x.xor(w[1].mul(9));\n y = y.add(v[0].mul(9).add(fetch64(s, offset + 40)));\n z = rotate64(z.add(w[0]), 33).mul(mul);\n v = weakHashLen32WithSeedsStr(s, offset, v[1].mul(mul), x.add(w[0]));\n w = weakHashLen32WithSeedsStr(\n s, offset + 32, z.add(w[1]), y.add(fetch64(s, offset + 16)));\n\n [z, x] = [x, z];\n\n return hashLen16(\n hashLen16(v[0], w[0], mul).add(shiftMix(y).mul(k0)).add(z),\n hashLen16(v[1], w[1], mul).add(x), mul);\n}\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env} from './environment';\nimport {BackendValues, DataType, TensorLike, TypedArray} from './types';\nimport * as base from './util_base';\nexport * from './util_base';\nexport * from './hash_util';\n\n/**\n * Create typed array for scalar value. Used for storing in `DataStorage`.\n */\nexport function createScalarValue(\n value: DataType, dtype: DataType): BackendValues {\n if (dtype === 'string') {\n return encodeString(value);\n }\n\n return toTypedArray([value], dtype);\n}\n\nfunction noConversionNeeded(a: TensorLike, dtype: DataType): boolean {\n return (a instanceof Float32Array && dtype === 'float32') ||\n (a instanceof Int32Array && dtype === 'int32') ||\n (a instanceof Uint8Array && dtype === 'bool');\n}\n\nexport function toTypedArray(a: TensorLike, dtype: DataType): TypedArray {\n if (dtype === 'string') {\n throw new Error('Cannot convert a string[] to a TypedArray');\n }\n if (Array.isArray(a)) {\n a = base.flatten(a);\n }\n\n if (env().getBool('DEBUG')) {\n base.checkConversionForErrors(a as number[], dtype);\n }\n if (noConversionNeeded(a, dtype)) {\n return a as TypedArray;\n }\n if (dtype == null || dtype === 'float32' || dtype === 'complex64') {\n return new Float32Array(a as number[]);\n } else if (dtype === 'int32') {\n return new Int32Array(a as number[]);\n } else if (dtype === 'bool') {\n const bool = new Uint8Array((a as number[]).length);\n for (let i = 0; i < bool.length; ++i) {\n if (Math.round((a as number[])[i]) !== 0) {\n bool[i] = 1;\n }\n }\n return bool;\n } else {\n throw new Error(`Unknown data type ${dtype}`);\n }\n}\n\n/**\n * Returns the current high-resolution time in milliseconds relative to an\n * arbitrary time in the past. It works across different platforms (node.js,\n * browsers).\n *\n * ```js\n * console.log(tf.util.now());\n * ```\n *\n * @doc {heading: 'Util', namespace: 'util'}\n */\nexport function now(): number {\n return env().platform.now();\n}\n\n/**\n * Returns a platform-specific implementation of\n * [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API).\n *\n * If `fetch` is defined on the global object (`window`, `process`, etc.),\n * `tf.util.fetch` returns that function.\n *\n * If not, `tf.util.fetch` returns a platform-specific solution.\n *\n * ```js\n * const resource = await tf.util.fetch('https://unpkg.com/@tensorflow/tfjs');\n * // handle response\n * ```\n *\n * @doc {heading: 'Util'}\n */\nexport function fetch(\n path: string, requestInits?: RequestInit): Promise {\n return env().platform.fetch(path, requestInits);\n}\n\n/**\n * Encodes the provided string into bytes using the provided encoding scheme.\n *\n * @param s The string to encode.\n * @param encoding The encoding scheme. Defaults to utf-8.\n *\n * @doc {heading: 'Util'}\n */\nexport function encodeString(s: string, encoding = 'utf-8'): Uint8Array {\n encoding = encoding || 'utf-8';\n return env().platform.encode(s, encoding);\n}\n\n/**\n * Decodes the provided bytes into a string using the provided encoding scheme.\n * @param bytes The bytes to decode.\n *\n * @param encoding The encoding scheme. Defaults to utf-8.\n *\n * @doc {heading: 'Util'}\n */\nexport function decodeString(bytes: Uint8Array, encoding = 'utf-8'): string {\n encoding = encoding || 'utf-8';\n return env().platform.decode(bytes, encoding);\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {BackendTimer, BackendTimingInfo} from './backends/backend';\nimport {env} from './environment';\nimport {Tensor} from './tensor';\nimport {NamedTensorMap} from './tensor_types';\nimport {DataType, DataTypeMap, TypedArray} from './types';\nimport * as util from './util';\n\nexport type KernelProfile = {\n kernelName: string,\n outputs: Tensor[],\n inputs: NamedTensorMap,\n timeMs: Promise,\n extraInfo: Promise\n};\n\nexport class Profiler {\n constructor(private backendTimer: BackendTimer, private logger?: Logger) {\n if (logger == null) {\n this.logger = new Logger();\n }\n }\n\n profileKernel(kernelName: string, inputs: NamedTensorMap, f: () => Tensor[]):\n KernelProfile {\n let outputs: Tensor[];\n const holdResultWrapperFn = () => {\n outputs = f();\n };\n let timer: Promise;\n const start = util.now();\n if (this.backendTimer.timerAvailable()) {\n timer = this.backendTimer.time(holdResultWrapperFn);\n } else {\n holdResultWrapperFn();\n for (const output of outputs) {\n output.dataSync();\n }\n timer = Promise.resolve({kernelMs: util.now() - start});\n }\n if (env().getBool('CHECK_COMPUTATION_FOR_ERRORS')) {\n for (let i = 0; i < outputs.length; i++) {\n const output = outputs[i];\n // Dangling promise here because we don't want to propagate up\n // asynchronicity.\n output.data().then(tensorVals => {\n checkComputationForErrors(tensorVals, output.dtype, kernelName);\n });\n }\n }\n\n const kernelProfile = {\n kernelName,\n outputs,\n inputs,\n timeMs: timer.then(timing => timing.kernelMs),\n extraInfo: timer.then(\n timing => timing.getExtraProfileInfo != null ?\n timing.getExtraProfileInfo() :\n '')\n };\n return kernelProfile;\n }\n\n logKernelProfile(kernelProfile: KernelProfile): void {\n const {kernelName, outputs, timeMs, inputs, extraInfo} = kernelProfile;\n\n outputs.forEach(result => {\n Promise.all([result.data(), timeMs, extraInfo]).then(valueContainer => {\n this.logger.logKernelProfile(\n kernelName, result, valueContainer[0], valueContainer[1], inputs,\n valueContainer[2]);\n });\n });\n }\n}\n\nexport function checkComputationForErrors(\n vals: DataTypeMap[D], dtype: D, kernelName: string): boolean {\n if (dtype !== 'float32') {\n // Only floating point computations will generate NaN values\n return false;\n }\n for (let i = 0; i < vals.length; i++) {\n const num = vals[i] as number;\n if (isNaN(num) || !isFinite(num)) {\n // Throwing custom exception so behavior is testable.\n console.warn(`Found ${num} in the result of '${kernelName}'`);\n return true;\n }\n }\n return false;\n}\n\nexport class Logger {\n logKernelProfile(\n name: string, result: Tensor, vals: TypedArray,\n timeMs: number|{error: string}, inputs: NamedTensorMap,\n extraInfo?: string) {\n const time = typeof timeMs === 'number' ? util.rightPad(`${timeMs}ms`, 9) :\n timeMs['error'];\n const paddedName = util.rightPad(name, 25);\n const rank = result.rank;\n const size = result.size;\n const shape = util.rightPad(result.shape.toString(), 14);\n let inputShapesDescription = '';\n\n for (const name in inputs) {\n const input = inputs[name];\n if (input != null) {\n // The input might be a non-tensor (e.g HTMLImageElement), in which case\n // we claim the output shape as input shape.\n const inputShape = input.shape || result.shape;\n const inputRank = inputShape.length;\n inputShapesDescription +=\n `${name}: ${inputRank}D ${inputRank > 0 ? inputShape : ''} `;\n }\n }\n\n console.log(\n `%c${paddedName}\\t%c${time}\\t%c${rank}D ${shape}\\t%c${size}\\t%c${\n inputShapesDescription}\\t%c${extraInfo}`,\n 'font-weight:bold', 'color:red', 'color:blue', 'color: orange',\n 'color: green', 'color: steelblue');\n }\n}\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from './tensor';\nimport {NamedTensorMap} from './tensor_types';\nimport * as util from './util';\n\nexport interface TapeNode {\n id: number;\n kernelName: string;\n outputs: Tensor[];\n inputs: NamedTensorMap;\n // Optional params, defined only for ops with gradient impl.\n gradient?: (dys: Tensor[]) => NamedGradientMap;\n saved?: Tensor[];\n}\n\nexport type NamedGradientMap = {\n [inputName: string]: () => Tensor;\n};\n\n/**\n * Computes a list of TapeNodes that connect x to y, filtering everything else\n * out and preserving the order of the original tape elements.\n *\n * @param tape The tape elements to filter.\n * @param xs The input Tensors.\n * @param y The output Tensor.\n */\nexport function getFilteredNodesXToY(\n tape: TapeNode[], xs: Tensor[], y: Tensor): TapeNode[] {\n // Forward pass to compute all the nodes and Tensors that are transitively a\n // function of x.\n const tensorsFromX: {[tensorId: number]: boolean} = {};\n const nodesFromX: {[nodeId: number]: boolean} = {};\n for (let i = 0; i < xs.length; i++) {\n tensorsFromX[xs[i].id] = true;\n }\n\n for (let i = 0; i < tape.length; i++) {\n const node = tape[i];\n const nodeInputs = node.inputs;\n for (const inputName in nodeInputs) {\n const input = nodeInputs[inputName];\n\n let anyInputFromX = false;\n for (let j = 0; j < xs.length; j++) {\n if (tensorsFromX[input.id]) {\n node.outputs.forEach(output => tensorsFromX[output.id] = true);\n anyInputFromX = true;\n nodesFromX[node.id] = true;\n break;\n }\n }\n\n if (anyInputFromX) {\n break;\n }\n }\n }\n\n // Backward pass to find all of the nodes and Tensors that lead to y.\n const tensorsLeadToY: {[tensorId: number]: boolean} = {};\n tensorsLeadToY[y.id] = true;\n const nodesToY: {[nodeId: number]: boolean} = {};\n\n for (let i = tape.length - 1; i >= 0; i--) {\n const node = tape[i];\n const nodeInputs = node.inputs;\n\n // If any of the outputs lead to y, mark all of the inputs as leading to y.\n for (let j = 0; j < node.outputs.length; j++) {\n if (tensorsLeadToY[node.outputs[j].id]) {\n for (const inputName in nodeInputs) {\n tensorsLeadToY[nodeInputs[inputName].id] = true;\n nodesToY[node.id] = true;\n }\n break;\n }\n }\n }\n\n // Return the paths that come from x and lead to y.\n const filteredTape: TapeNode[] = [];\n for (let i = 0; i < tape.length; i++) {\n const node = tape[i];\n\n if (nodesFromX[node.id] && nodesToY[node.id]) {\n // Prune the inputs from the node that aren't a function of x.\n const prunedInputs: {[inputName: string]: Tensor} = {};\n for (const inputName in node.inputs) {\n const nodeInput = node.inputs[inputName];\n if (tensorsFromX[nodeInput.id]) {\n prunedInputs[inputName] = nodeInput;\n }\n }\n\n // Copy the node and overwrite inputsAndArgs to the pruned version.\n const prunedNode = Object.assign({}, node);\n prunedNode.inputs = prunedInputs;\n prunedNode.outputs = node.outputs;\n\n filteredTape.push(prunedNode);\n }\n }\n\n return filteredTape;\n}\n\n/**\n * Backpropagate gradients through the filtered TapeNodes.\n *\n * @param tensorAccumulatedGradientMap A map of Tensor to its gradient. This map\n * is mutated by this method.\n * @param filteredTape The filtered TapeNodes to backprop through.\n */\nexport function backpropagateGradients(\n tensorAccumulatedGradientMap: {[tensorId: number]: Tensor},\n filteredTape: TapeNode[], tidy: (f: Function) => Tensor,\n add: (a: Tensor, b: Tensor) => Tensor) {\n // Walk the tape backward and keep a map of Tensor to its gradient.\n for (let i = filteredTape.length - 1; i >= 0; i--) {\n const node = filteredTape[i];\n\n const dys: Tensor[] = [];\n node.outputs.forEach(o => {\n const gradTensor = tensorAccumulatedGradientMap[o.id];\n if (gradTensor != null) {\n dys.push(gradTensor);\n } else {\n // This particular output is not in the back-propagation subgraph, so it\n // does not affect the final output, thus we put null for its dy.\n dys.push(null);\n }\n });\n\n if (node.gradient == null) {\n throw new Error(\n `Cannot compute gradient: gradient function not found ` +\n `for ${node.kernelName}.`);\n }\n\n // Backprop dy through this node and accumulate gradients over the inputs.\n const inputGradients = node.gradient(dys);\n\n for (const inputName in node.inputs) {\n if (!(inputName in inputGradients)) {\n throw new Error(\n `Cannot backprop through input ${inputName}. ` +\n `Available gradients found: ${Object.keys(inputGradients)}.`);\n }\n\n // Call the gradient function.\n const dx = tidy(() => inputGradients[inputName]());\n if (dx.dtype !== 'float32') {\n throw new Error(\n `Error in gradient for op ${\n node.kernelName}. The gradient of input ` +\n `${inputName} must have 'float32' dtype, but has '${dx.dtype}'`);\n }\n const x = node.inputs[inputName];\n if (!util.arraysEqual(dx.shape, x.shape)) {\n throw new Error(\n `Error in gradient for op ${\n node.kernelName}. The gradient of input ` +\n `'${inputName}' has shape '${dx.shape}', which does not match ` +\n `the shape of the input '${x.shape}'`);\n }\n\n if (tensorAccumulatedGradientMap[x.id] == null) {\n tensorAccumulatedGradientMap[x.id] = dx;\n } else {\n const curGradient = tensorAccumulatedGradientMap[x.id];\n tensorAccumulatedGradientMap[x.id] = add(curGradient, dx);\n curGradient.dispose();\n }\n }\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataType, TypedArray} from './types';\nimport {computeStrides, isString, rightPad, sizeFromShape} from './util';\n\n// Maximum number of values before we decide to show ellipsis.\nconst FORMAT_LIMIT_NUM_VALS = 20;\n// Number of first and last values to show when displaying a, b,...,y, z.\nconst FORMAT_NUM_FIRST_LAST_VALS = 3;\n// Number of significant digits to show.\nconst FORMAT_NUM_SIG_DIGITS = 7;\n\nexport function tensorToString(\n vals: TypedArray|string[], shape: number[], dtype: DataType,\n verbose: boolean) {\n const strides = computeStrides(shape);\n const padPerCol = computeMaxSizePerColumn(vals, shape, dtype, strides);\n const rank = shape.length;\n const valsLines = subTensorToString(vals, shape, dtype, strides, padPerCol);\n const lines = ['Tensor'];\n if (verbose) {\n lines.push(` dtype: ${dtype}`);\n lines.push(` rank: ${rank}`);\n lines.push(` shape: [${shape}]`);\n lines.push(` values:`);\n }\n lines.push(valsLines.map(l => ' ' + l).join('\\n'));\n return lines.join('\\n');\n}\n\nfunction computeMaxSizePerColumn(\n vals: TypedArray|string[], shape: number[], dtype: DataType,\n strides: number[]): number[] {\n const n = sizeFromShape(shape);\n const numCols = strides[strides.length - 1];\n const padPerCol = new Array(numCols).fill(0);\n const rank = shape.length;\n const valuesOrTuples =\n dtype === 'complex64' ? createComplexTuples(vals) : vals;\n\n if (rank > 1) {\n for (let row = 0; row < n / numCols; row++) {\n const offset = row * numCols;\n for (let j = 0; j < numCols; j++) {\n padPerCol[j] = Math.max(\n padPerCol[j],\n valToString(valuesOrTuples[offset + j], 0, dtype).length);\n }\n }\n }\n return padPerCol;\n}\n\nfunction valToString(\n val: number|string|[number, number], pad: number, dtype: DataType) {\n let valStr: string;\n if (Array.isArray(val)) {\n valStr = `${parseFloat(val[0].toFixed(FORMAT_NUM_SIG_DIGITS))} + ` +\n `${parseFloat(val[1].toFixed(FORMAT_NUM_SIG_DIGITS))}j`;\n } else if (isString(val)) {\n valStr = `'${val}'`;\n } else if (dtype === 'bool') {\n valStr = boolNumToString(val);\n } else {\n valStr = parseFloat(val.toFixed(FORMAT_NUM_SIG_DIGITS)).toString();\n }\n\n return rightPad(valStr, pad);\n}\n\nfunction boolNumToString(v: number): string {\n return v === 0 ? 'false' : 'true';\n}\n\nfunction subTensorToString(\n vals: TypedArray|string[], shape: number[], dtype: DataType,\n strides: number[], padPerCol: number[], isLast = true): string[] {\n const storagePerElement = dtype === 'complex64' ? 2 : 1;\n\n const size = shape[0];\n const rank = shape.length;\n if (rank === 0) {\n if (dtype === 'complex64') {\n const complexTuple = createComplexTuples(vals);\n return [valToString(complexTuple[0], 0, dtype)];\n }\n if (dtype === 'bool') {\n return [boolNumToString(vals[0] as number)];\n }\n return [vals[0].toString()];\n }\n\n if (rank === 1) {\n if (size > FORMAT_LIMIT_NUM_VALS) {\n const firstValsSize = FORMAT_NUM_FIRST_LAST_VALS * storagePerElement;\n\n let firstVals = Array.from(\n vals.slice(0, firstValsSize));\n let lastVals = Array.from(vals.slice(\n (size - FORMAT_NUM_FIRST_LAST_VALS) * storagePerElement,\n size * storagePerElement));\n if (dtype === 'complex64') {\n firstVals = createComplexTuples(firstVals);\n lastVals = createComplexTuples(lastVals);\n }\n return [\n '[' +\n firstVals.map((x, i) => valToString(x, padPerCol[i], dtype))\n .join(', ') +\n ', ..., ' +\n lastVals\n .map(\n (x, i) => valToString(\n x, padPerCol[size - FORMAT_NUM_FIRST_LAST_VALS + i], dtype))\n .join(', ') +\n ']'\n ];\n }\n const displayVals: Array =\n dtype === 'complex64' ? createComplexTuples(vals) :\n Array.from(vals);\n\n return [\n '[' +\n displayVals.map((x, i) => valToString(x, padPerCol[i], dtype))\n .join(', ') +\n ']'\n ];\n }\n\n // The array is rank 2 or more.\n const subshape = shape.slice(1);\n const substrides = strides.slice(1);\n const stride = strides[0] * storagePerElement;\n const lines: string[] = [];\n if (size > FORMAT_LIMIT_NUM_VALS) {\n for (let i = 0; i < FORMAT_NUM_FIRST_LAST_VALS; i++) {\n const start = i * stride;\n const end = start + stride;\n lines.push(...subTensorToString(\n vals.slice(start, end), subshape, dtype, substrides, padPerCol,\n false /* isLast */));\n }\n lines.push('...');\n for (let i = size - FORMAT_NUM_FIRST_LAST_VALS; i < size; i++) {\n const start = i * stride;\n const end = start + stride;\n lines.push(...subTensorToString(\n vals.slice(start, end), subshape, dtype, substrides, padPerCol,\n i === size - 1 /* isLast */));\n }\n } else {\n for (let i = 0; i < size; i++) {\n const start = i * stride;\n const end = start + stride;\n lines.push(...subTensorToString(\n vals.slice(start, end), subshape, dtype, substrides, padPerCol,\n i === size - 1 /* isLast */));\n }\n }\n const sep = rank === 2 ? ',' : '';\n lines[0] = '[' + lines[0] + sep;\n for (let i = 1; i < lines.length - 1; i++) {\n lines[i] = ' ' + lines[i] + sep;\n }\n let newLineSep = ',\\n';\n for (let i = 2; i < rank; i++) {\n newLineSep += '\\n';\n }\n lines[lines.length - 1] =\n ' ' + lines[lines.length - 1] + ']' + (isLast ? '' : newLineSep);\n return lines;\n}\n\nfunction createComplexTuples(vals: Array<{}>|\n TypedArray): Array<[number, number]> {\n const complexTuples: Array<[number, number]> = [];\n for (let i = 0; i < vals.length; i += 2) {\n complexTuples.push([vals[i], vals[i + 1]] as [number, number]);\n }\n return complexTuples;\n}\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// Workaround for: https://github.com/bazelbuild/rules_nodejs/issues/1265\n/// \n\nimport {getGlobal} from './global_util';\nimport {tensorToString} from './tensor_format';\nimport {ArrayMap, BackendValues, DataType, DataTypeMap, DataValues, NumericDataType, Rank, ShapeMap, SingleValueMap, TypedArray} from './types';\nimport * as util from './util';\nimport {computeStrides, toNestedArray} from './util';\n\nexport interface TensorData {\n dataId?: DataId;\n values?: DataTypeMap[D];\n}\n\n// This interface mimics KernelBackend (in backend.ts), which would create a\n// circular dependency if imported.\nexport interface Backend {}\n\n/**\n * A mutable object, similar to `tf.Tensor`, that allows users to set values\n * at locations before converting to an immutable `tf.Tensor`.\n *\n * See `tf.buffer` for creating a tensor buffer.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\nexport class TensorBuffer {\n size: number;\n shape: ShapeMap[R];\n strides: number[];\n values: DataTypeMap[D];\n\n constructor(shape: ShapeMap[R], public dtype: D, values?: DataTypeMap[D]) {\n this.shape = shape.slice() as ShapeMap[R];\n this.size = util.sizeFromShape(shape);\n\n if (values != null) {\n const n = values.length;\n util.assert(\n n === this.size,\n () => `Length of values '${n}' does not match the size ` +\n `inferred by the shape '${this.size}'.`);\n }\n if (dtype === 'complex64') {\n throw new Error(\n `complex64 dtype TensorBuffers are not supported. Please create ` +\n `a TensorBuffer for the real and imaginary parts separately and ` +\n `call tf.complex(real, imag).`);\n }\n this.values = values || util.getArrayFromDType(dtype, this.size);\n this.strides = computeStrides(shape);\n }\n\n /**\n * Sets a value in the buffer at a given location.\n *\n * @param value The value to set.\n * @param locs The location indices.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\n set(value: SingleValueMap[D], ...locs: number[]): void {\n if (locs.length === 0) {\n locs = [0];\n }\n util.assert(\n locs.length === this.rank,\n () => `The number of provided coordinates (${locs.length}) must ` +\n `match the rank (${this.rank})`);\n\n const index = this.locToIndex(locs);\n this.values[index] = value as number;\n }\n\n /**\n * Returns the value in the buffer at the provided location.\n *\n * @param locs The location indices.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\n get(...locs: number[]): SingleValueMap[D] {\n if (locs.length === 0) {\n locs = [0];\n }\n let i = 0;\n for (const loc of locs) {\n if (loc < 0 || loc >= this.shape[i]) {\n const msg = `Requested out of range element at ${locs}. ` +\n ` Buffer shape=${this.shape}`;\n throw new Error(msg);\n }\n i++;\n }\n let index = locs[locs.length - 1];\n for (let i = 0; i < locs.length - 1; ++i) {\n index += this.strides[i] * locs[i];\n }\n return this.values[index] as SingleValueMap[D];\n }\n\n locToIndex(locs: number[]): number {\n if (this.rank === 0) {\n return 0;\n } else if (this.rank === 1) {\n return locs[0];\n }\n let index = locs[locs.length - 1];\n for (let i = 0; i < locs.length - 1; ++i) {\n index += this.strides[i] * locs[i];\n }\n return index;\n }\n\n indexToLoc(index: number): number[] {\n if (this.rank === 0) {\n return [];\n } else if (this.rank === 1) {\n return [index];\n }\n const locs: number[] = new Array(this.shape.length);\n for (let i = 0; i < locs.length - 1; ++i) {\n locs[i] = Math.floor(index / this.strides[i]);\n index -= locs[i] * this.strides[i];\n }\n locs[locs.length - 1] = index;\n return locs;\n }\n\n get rank() {\n return this.shape.length;\n }\n\n /**\n * Creates an immutable `tf.Tensor` object from the buffer.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\n toTensor(): Tensor {\n return trackerFn().makeTensor(this.values, this.shape, this.dtype) as\n Tensor;\n }\n}\n\nexport interface DataToGPUWebGLOption {\n customTexShape?: [number, number];\n}\n\nexport type DataToGPUOptions = DataToGPUWebGLOption;\n\nexport interface GPUData {\n tensorRef: Tensor;\n texture?: WebGLTexture;\n buffer?: GPUBuffer;\n texShape?: [number, number];\n bufSize?: number;\n}\n\nexport interface TensorTracker {\n makeTensor(\n values: DataValues, shape: number[], dtype: DataType,\n backend?: Backend): Tensor;\n makeVariable(\n initialValue: Tensor, trainable?: boolean, name?: string,\n dtype?: DataType): Variable;\n incRef(a: Tensor, backend: Backend): void;\n disposeTensor(t: Tensor): void;\n disposeVariable(v: Variable): void;\n read(dataId: DataId): Promise;\n readSync(dataId: DataId): BackendValues;\n readToGPU(dataId: DataId, options?: DataToGPUOptions): GPUData;\n}\n\n/**\n * The Tensor class calls into this handler to delegate chaining operations.\n */\nexport interface OpHandler {\n cast(x: T, dtype: DataType): T;\n buffer(\n shape: ShapeMap[R], dtype: D,\n values?: DataTypeMap[D]): TensorBuffer;\n print(x: T, verbose: boolean): void;\n clone(x: T): T;\n // TODO(yassogba) bring reshape back?\n}\n\n// For tracking tensor creation and disposal.\nlet trackerFn: () => TensorTracker = null;\n// Used by chaining methods to call into ops.\nlet opHandler: OpHandler = null;\n// Used to warn about deprecated methods.\nlet deprecationWarningFn: (msg: string) => void = null;\n// This here so that we can use this method on dev branches and keep the\n// functionality at master.\n// tslint:disable-next-line:no-unused-expression\n[deprecationWarningFn];\n\n/**\n * An external consumer can register itself as the tensor tracker. This way\n * the Tensor class can notify the tracker for every tensor created and\n * disposed.\n */\nexport function setTensorTracker(fn: () => TensorTracker) {\n trackerFn = fn;\n}\n\n/**\n * An external consumer can register itself as the op handler. This way the\n * Tensor class can have chaining methods that call into ops via the op\n * handler.\n */\nexport function setOpHandler(handler: OpHandler) {\n opHandler = handler;\n}\n\n/**\n * Sets the deprecation warning function to be used by this file. This way the\n * Tensor class can be a leaf but still use the environment.\n */\nexport function setDeprecationWarningFn(fn: (msg: string) => void) {\n deprecationWarningFn = fn;\n}\n\n/**\n * We wrap data id since we use weak map to avoid memory leaks.\n * Since we have our own memory management, we have a reference counter\n * mapping a tensor to its data, so there is always a pointer (even if that\n * data is otherwise garbage collectable).\n * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/\n * Global_Objects/WeakMap\n */\nexport type DataId = object; // object instead of {} to force non-primitive.\n\n// Declare this namespace to make Tensor class augmentation work in google3.\nexport declare namespace Tensor {}\n/**\n * A `tf.Tensor` object represents an immutable, multidimensional array of\n * numbers that has a shape and a data type.\n *\n * For performance reasons, functions that create tensors do not necessarily\n * perform a copy of the data passed to them (e.g. if the data is passed as a\n * `Float32Array`), and changes to the data will change the tensor. This is not\n * a feature and is not supported. To avoid this behavior, use the tensor before\n * changing the input data or create a copy with `copy = tf.add(yourTensor, 0)`.\n *\n * See `tf.tensor` for details on how to create a `tf.Tensor`.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\nexport class Tensor {\n /** Unique id of this tensor. */\n readonly id: number;\n /**\n * Id of the bucket holding the data for this tensor. Multiple arrays can\n * point to the same bucket (e.g. when calling array.reshape()).\n */\n dataId: DataId;\n /** The shape of the tensor. */\n readonly shape: ShapeMap[R];\n /** Number of elements in the tensor. */\n readonly size: number;\n /** The data type for the array. */\n readonly dtype: DataType;\n /** The rank type for the array (see `Rank` enum). */\n readonly rankType: R;\n\n /** Whether this tensor has been globally kept. */\n kept = false;\n /** The id of the scope this tensor is being tracked in. */\n scopeId: number;\n\n /**\n * Number of elements to skip in each dimension when indexing. See\n * https://docs.scipy.org/doc/numpy/reference/generated/\\\n * numpy.ndarray.strides.html\n */\n readonly strides: number[];\n\n constructor(shape: ShapeMap[R], dtype: DataType, dataId: DataId, id: number) {\n this.shape = shape.slice() as ShapeMap[R];\n this.dtype = dtype || 'float32';\n this.size = util.sizeFromShape(shape);\n this.strides = computeStrides(shape);\n this.dataId = dataId;\n this.id = id;\n this.rankType = (this.rank < 5 ? this.rank.toString() : 'higher') as R;\n }\n\n get rank(): number {\n return this.shape.length;\n }\n\n /**\n * Returns a promise of `tf.TensorBuffer` that holds the underlying data.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n async buffer(): Promise> {\n const vals = await this.data();\n return opHandler.buffer(this.shape, this.dtype as D, vals);\n }\n\n /**\n * Returns a `tf.TensorBuffer` that holds the underlying data.\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n bufferSync(): TensorBuffer {\n return opHandler.buffer(this.shape, this.dtype as D, this.dataSync());\n }\n\n /**\n * Returns the tensor data as a nested array. The transfer of data is done\n * asynchronously.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n async array(): Promise {\n const vals = await this.data();\n return toNestedArray(this.shape, vals, this.dtype === 'complex64') as\n ArrayMap[R];\n }\n\n /**\n * Returns the tensor data as a nested array. The transfer of data is done\n * synchronously.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n arraySync(): ArrayMap[R] {\n return toNestedArray(\n this.shape, this.dataSync(), this.dtype === 'complex64') as\n ArrayMap[R];\n }\n\n /**\n * Asynchronously downloads the values from the `tf.Tensor`. Returns a\n * promise of `TypedArray` that resolves when the computation has finished.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n async data(): Promise {\n this.throwIfDisposed();\n const data = trackerFn().read(this.dataId);\n if (this.dtype === 'string') {\n const bytes = await data as Uint8Array[];\n try {\n return bytes.map(b => util.decodeString(b)) as DataTypeMap[D];\n } catch {\n throw new Error(\n 'Failed to decode the string bytes into utf-8. ' +\n 'To get the original bytes, call tensor.bytes().');\n }\n }\n return data as Promise;\n }\n\n /**\n * Copy the tensor's data to a new GPU resource. Comparing to the `dataSync()`\n * and `data()`, this method prevents data from being downloaded to CPU.\n *\n * For WebGL backend, the data will be stored on a densely packed texture.\n * This means that the texture will use the RGBA channels to store value.\n *\n * For WebGPU backend, the data will be stored on a buffer. There is no\n * parameter, so can not use a user-defined size to create the buffer.\n *\n * @param options:\n * For WebGL,\n * - customTexShape: Optional. If set, will use the user defined\n * texture shape to create the texture.\n *\n * @returns For WebGL backend, a GPUData contains the new texture and\n * its information.\n * {\n * tensorRef: The tensor that is associated with this texture,\n * texture: WebGLTexture,\n * texShape: [number, number] // [height, width]\n * }\n *\n * For WebGPU backend, a GPUData contains the new buffer and\n * its information.\n * {\n * tensorRef: The tensor that is associated with this buffer,\n * buffer: GPUBuffer,\n * bufSize: number\n * }\n *\n * Remember to dispose the GPUData after it is used by\n * `res.tensorRef.dispose()`.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n dataToGPU(options?: DataToGPUOptions): GPUData {\n this.throwIfDisposed();\n return trackerFn().readToGPU(this.dataId, options);\n }\n\n /**\n * Synchronously downloads the values from the `tf.Tensor`. This blocks the\n * UI thread until the values are ready, which can cause performance issues.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n dataSync(): DataTypeMap[D] {\n this.throwIfDisposed();\n const data = trackerFn().readSync(this.dataId);\n if (this.dtype === 'string') {\n try {\n return (data as Uint8Array[]).map(b => util.decodeString(b)) as\n DataTypeMap[D];\n } catch {\n throw new Error(\n 'Failed to decode the string bytes into utf-8. ' +\n 'To get the original bytes, call tensor.bytes().');\n }\n }\n return data as DataTypeMap[D];\n }\n\n /** Returns the underlying bytes of the tensor's data. */\n async bytes(): Promise {\n this.throwIfDisposed();\n const data = await trackerFn().read(this.dataId);\n if (this.dtype === 'string') {\n return data as Uint8Array[];\n } else {\n return new Uint8Array((data as TypedArray).buffer);\n }\n }\n\n /**\n * Disposes `tf.Tensor` from memory.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n dispose(): void {\n if (this.isDisposed) {\n return;\n }\n trackerFn().disposeTensor(this);\n this.isDisposedInternal = true;\n }\n\n protected isDisposedInternal = false;\n get isDisposed(): boolean {\n return this.isDisposedInternal;\n }\n\n throwIfDisposed() {\n if (this.isDisposed) {\n throw new Error(`Tensor is disposed.`);\n }\n }\n\n /**\n * Prints the `tf.Tensor`. See `tf.print` for details.\n *\n * @param verbose Whether to print verbose information about the tensor,\n * including dtype and size.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n print(verbose = false): void {\n return opHandler.print(this, verbose);\n }\n\n /**\n * Returns a copy of the tensor. See `tf.clone` for details.\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n clone(this: T): T {\n this.throwIfDisposed();\n return opHandler.clone(this);\n }\n\n /**\n * Returns a human-readable description of the tensor. Useful for logging.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n toString(verbose = false): string {\n const vals = this.dataSync();\n return tensorToString(vals, this.shape, this.dtype, verbose);\n }\n\n cast(dtype: DataType): T {\n this.throwIfDisposed();\n return opHandler.cast(this as T, dtype);\n }\n variable(trainable = true, name?: string, dtype?: DataType): Variable {\n this.throwIfDisposed();\n return trackerFn().makeVariable(this, trainable, name, dtype) as\n Variable;\n }\n}\n\nObject.defineProperty(Tensor, Symbol.hasInstance, {\n value: (instance: Tensor) => {\n // Implementation note: we should use properties of the object that will be\n // defined before the constructor body has finished executing (methods).\n // This is because when this code is transpiled by babel, babel will call\n // classCallCheck before the constructor body is run.\n // See https://github.com/tensorflow/tfjs/issues/3384 for backstory.\n return !!instance && instance.data != null && instance.dataSync != null &&\n instance.throwIfDisposed != null;\n }\n});\n\nexport function getGlobalTensorClass() {\n // Use getGlobal so that we can augment the Tensor class across package\n // boundaries becase the node resolution alg may result in different modules\n // being returned for this file depending on the path they are loaded from.\n return getGlobal('Tensor', () => {\n return Tensor;\n });\n}\n\n// Global side effect. Cache global reference to Tensor class\ngetGlobalTensorClass();\n\nexport interface NumericTensor extends Tensor {\n dtype: NumericDataType;\n dataSync(): DataTypeMap[D];\n data(): Promise;\n dataToGPU(options?: DataToGPUOptions): GPUData;\n}\n\nexport interface StringTensor extends Tensor {\n dtype: 'string';\n dataSync(): DataTypeMap[D];\n data(): Promise;\n}\n\n/** @doclink Tensor */\nexport type Scalar = Tensor;\n/** @doclink Tensor */\nexport type Tensor1D = Tensor;\n/** @doclink Tensor */\nexport type Tensor2D = Tensor;\n/** @doclink Tensor */\nexport type Tensor3D = Tensor;\n/** @doclink Tensor */\nexport type Tensor4D = Tensor;\n/** @doclink Tensor */\nexport type Tensor5D = Tensor;\n/** @doclink Tensor */\nexport type Tensor6D = Tensor;\n\n/**\n * A mutable `tf.Tensor`, useful for persisting state, e.g. for training.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\nexport class Variable extends Tensor {\n name: string;\n\n constructor(\n initialValue: Tensor, public trainable: boolean, name: string,\n tensorId: number) {\n super(\n initialValue.shape, initialValue.dtype, initialValue.dataId, tensorId);\n this.name = name;\n }\n\n /**\n * Assign a new `tf.Tensor` to this variable. The new `tf.Tensor` must have\n * the same shape and dtype as the old `tf.Tensor`.\n *\n * @param newValue New tensor to be assigned to this variable.\n *\n * @doc {heading: 'Tensors', subheading: 'Classes'}\n */\n assign(newValue: Tensor): void {\n if (newValue.dtype !== this.dtype) {\n throw new Error(\n `dtype of the new value (${newValue.dtype}) and ` +\n `previous value (${this.dtype}) must match`);\n }\n if (!util.arraysEqual(newValue.shape, this.shape)) {\n throw new Error(\n `shape of the new value (${newValue.shape}) and ` +\n `previous value (${this.shape}) must match`);\n }\n trackerFn().disposeTensor(this);\n this.dataId = newValue.dataId;\n trackerFn().incRef(this, null /* backend */);\n }\n\n dispose(): void {\n trackerFn().disposeVariable(this);\n this.isDisposedInternal = true;\n }\n}\n\nObject.defineProperty(Variable, Symbol.hasInstance, {\n value: (instance: Variable) => {\n return instance instanceof Tensor && instance.assign != null &&\n instance.assign instanceof Function;\n }\n});\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/** @docalias number[] */\nexport interface ShapeMap {\n R0: number[];\n R1: [number];\n R2: [number, number];\n R3: [number, number, number];\n R4: [number, number, number, number];\n R5: [number, number, number, number, number];\n R6: [number, number, number, number, number, number];\n}\n\n/** @docalias number[] */\nexport interface ArrayMap {\n R0: number;\n R1: number[];\n R2: number[][];\n R3: number[][][];\n R4: number[][][][];\n R5: number[][][][][];\n R6: number[][][][][][];\n}\n\nexport interface DataTypeMap {\n float32: Float32Array;\n int32: Int32Array;\n bool: Uint8Array;\n complex64: Float32Array;\n string: string[];\n}\n\nexport interface SingleValueMap {\n bool: boolean;\n int32: number;\n float32: number;\n complex64: number;\n string: string;\n}\n\n/** @docalias 'float32'|'int32'|'bool'|'complex64'|'string' */\nexport type DataType = keyof DataTypeMap;\nexport type NumericDataType = 'float32'|'int32'|'bool'|'complex64';\nexport type TypedArray = Float32Array|Int32Array|Uint8Array;\n/** Tensor data used in tensor creation and user-facing API. */\nexport type DataValues = DataTypeMap[DataType];\n/** The underlying tensor data that gets stored in a backend. */\nexport type BackendValues = Float32Array|Int32Array|Uint8Array|Uint8Array[];\n\nexport enum Rank {\n R0 = 'R0',\n R1 = 'R1',\n R2 = 'R2',\n R3 = 'R3',\n R4 = 'R4',\n R5 = 'R5',\n R6 = 'R6'\n}\n\nexport type FlatVector = boolean[]|number[]|TypedArray;\nexport type RegularArray =\n T[]|T[][]|T[][][]|T[][][][]|T[][][][][]|T[][][][][][];\n\n// tslint:disable-next-line:no-any\nexport interface RecursiveArray {\n [index: number]: T|RecursiveArray;\n}\n\n// Looks for upcasting types. Used, for example, in operations with mixed dtype\n// inputs.\nenum UpcastInt32AndMap {\n 'float32' = 'float32',\n 'int32' = 'int32',\n 'bool' = 'int32',\n 'complex64' = 'complex64'\n}\n\nenum UpcastBoolAndMap {\n 'float32' = 'float32',\n 'int32' = 'int32',\n 'bool' = 'bool',\n 'complex64' = 'complex64'\n}\n\nenum UpcastFloat32AndMap {\n 'float32' = 'float32',\n 'int32' = 'float32',\n 'bool' = 'float32',\n 'complex64' = 'complex64'\n}\n\nenum UpcastComplex64AndMap {\n 'float32' = 'complex64',\n 'int32' = 'complex64',\n 'bool' = 'complex64',\n 'complex64' = 'complex64'\n}\n\nconst upcastTypeMap = {\n 'float32': UpcastFloat32AndMap,\n 'int32': UpcastInt32AndMap,\n 'bool': UpcastBoolAndMap,\n 'complex64': UpcastComplex64AndMap\n};\n\nexport function upcastType(typeA: DataType, typeB: DataType): DataType {\n if (typeA === 'string' || typeB === 'string') {\n if (typeA === 'string' && typeB === 'string') {\n return 'string';\n }\n throw new Error(`Can not upcast ${typeA} with ${typeB}`);\n }\n return upcastTypeMap[typeA][typeB];\n}\n\n/** Returns the output type after summation. */\nexport function sumOutType(type: DataType): DataType {\n return upcastType(type, 'int32');\n}\n\n/** @docalias TypedArray|Array */\nexport type TensorLike =\n TypedArray|number|boolean|string|RecursiveArray|\n RecursiveArray|RecursiveArray|Uint8Array[];\nexport type ScalarLike = number|boolean|string|Uint8Array;\n/** @docalias TypedArray|Array */\nexport type TensorLike1D = TypedArray|number[]|boolean[]|string[]|Uint8Array[];\n/** @docalias TypedArray|Array */\nexport type TensorLike2D = TypedArray|number[]|number[][]|boolean[]|boolean[][]|\n string[]|string[][]|Uint8Array[]|Uint8Array[][];\n/** @docalias TypedArray|Array */\nexport type TensorLike3D = TypedArray|number[]|number[][][]|boolean[]|\n boolean[][][]|string[]|string[][][]|Uint8Array[]|Uint8Array[][][];\n/** @docalias TypedArray|Array */\nexport type TensorLike4D = TypedArray|number[]|number[][][][]|boolean[]|\n boolean[][][][]|string[]|string[][][][]|Uint8Array[]|Uint8Array[][][][];\n/** @docalias TypedArray|Array */\nexport type TensorLike5D =\n TypedArray|number[]|number[][][][][]|boolean[]|boolean[][][][][]|string[]|\n string[][][][][]|Uint8Array[]|Uint8Array[][][][][];\n/** @docalias TypedArray|Array */\nexport type TensorLike6D =\n TypedArray|number[]|number[][][][][][]|boolean[]|boolean[][][][][][]|\n string[]|string[][][][][][]|Uint8Array[]|Uint8Array[][][][][];\n\n/** Type for representing image data in Uint8Array type. */\nexport interface PixelData {\n width: number;\n height: number;\n data: Uint8Array;\n}\n\n/**\n * Type for representing all permutations and combinations of 'RGBA' channels.\n */\nexport type WebGLChannels = 'A'|'B'|'G'|'R'|'AB'|'AG'|'AR'|'BA'|'BG'|'BR'|'GA'|\n 'GB'|'GR'|'RA'|'RB'|'RG'|'ABG'|'ABR'|'AGB'|'AGR'|'ARB'|'ARG'|'BAG'|'BAR'|\n 'BGA'|'BGR'|'BRA'|'BRG'|'GAB'|'GAR'|'GBA'|'GBR'|'GRA'|'GRB'|'RAB'|'RAG'|\n 'RBA'|'RBG'|'RGA'|'RGB'|'ABGR'|'ABRG'|'AGBR'|'AGRB'|'ARBG'|'ARGB'|'BAGR'|\n 'BARG'|'BGAR'|'BGRA'|'BRAG'|'BRGA'|'GABR'|'GARB'|'GBAR'|'GBRA'|'GRAB'|\n 'GRBA'|'RABG'|'RAGB'|'RBAG'|'RBGA'|'RGAB'|'RGBA';\n\n/** Type for representing a texture data to create a tensor. */\nexport interface WebGLData {\n texture: WebGLTexture;\n height: number;\n width: number;\n channels: WebGLChannels;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from './tensor';\nimport {TensorContainer, TensorContainerArray} from './tensor_types';\nimport {upcastType} from './types';\nimport {assert} from './util';\n\nexport function makeTypesMatch(a: T, b: T): [T, T] {\n if (a.dtype === b.dtype) {\n return [a, b];\n }\n const dtype = upcastType(a.dtype, b.dtype);\n return [a.cast(dtype), b.cast(dtype)];\n}\n\nexport function assertTypesMatch(a: Tensor, b: Tensor): void {\n assert(\n a.dtype === b.dtype,\n () => `The dtypes of the first(${a.dtype}) and` +\n ` second(${b.dtype}) input must match`);\n}\n\nexport function isTensorInList(tensor: Tensor, tensorList: Tensor[]): boolean {\n return tensorList.some(x => x.id === tensor.id);\n}\n\n/**\n * Extracts any `Tensor`s found within the provided object.\n *\n * @param container an object that may be a `Tensor` or may directly contain\n * `Tensor`s, such as a `Tensor[]` or `{key: Tensor, ...}`. In general it\n * is safe to pass any object here, except that `Promise`s are not\n * supported.\n * @returns An array of `Tensors` found within the passed object. If the\n * argument is simply a `Tensor', a list containing that `Tensor` is\n * returned. If the object is not a `Tensor` or does not\n * contain `Tensors`, an empty list is returned.\n */\nexport function getTensorsInContainer(result: TensorContainer): Tensor[] {\n const list: Tensor[] = [];\n const seen = new Set<{}|void>();\n walkTensorContainer(result, list, seen);\n return list;\n}\n\nfunction walkTensorContainer(\n container: TensorContainer, list: Tensor[], seen: Set<{}|void>): void {\n if (container == null) {\n return;\n }\n if (container instanceof Tensor) {\n list.push(container);\n return;\n }\n if (!isIterable(container)) {\n return;\n }\n // Iteration over keys works also for arrays.\n const iterable = container as TensorContainerArray;\n for (const k in iterable) {\n const val = iterable[k];\n if (!seen.has(val)) {\n seen.add(val);\n walkTensorContainer(val, list, seen);\n }\n }\n}\n\n// tslint:disable-next-line:no-any\nfunction isIterable(obj: any): boolean {\n return Array.isArray(obj) || typeof obj === 'object';\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {BackendTimingInfo, DataMover, KernelBackend} from './backends/backend';\nimport {Environment, setEnvironmentGlobal} from './environment';\nimport {getGlobalNamespace} from './global_util';\nimport {Add, Cast, Identity} from './kernel_names';\nimport {getGradient, getKernel, getKernelsForBackend, GradFunc, NamedAttrMap, TensorInfo} from './kernel_registry';\nimport * as log from './log';\nimport {KernelProfile, Profiler} from './profiler';\nimport {backpropagateGradients, getFilteredNodesXToY, TapeNode} from './tape';\nimport {DataId, DataToGPUOptions, GPUData, setTensorTracker, Tensor, TensorTracker, Variable} from './tensor';\nimport {GradSaveFunc, NamedTensorMap, NamedVariableMap, TensorContainer} from './tensor_types';\nimport {getTensorsInContainer} from './tensor_util';\nimport {BackendValues, DataType, DataValues} from './types';\nimport * as util from './util';\nimport {bytesFromStringArray, makeOnesTypedArray, now, sizeFromShape} from './util';\n\n/**\n * A function that computes an output. The save function is for saving tensors\n * computed in the forward pass, that we need in the backward pass.\n */\nexport type ForwardFunc = (backend: KernelBackend, save?: GradSaveFunc) => T;\n\n/**\n * @docalias (a: Tensor, b: Tensor,..., save?: Function) => {\n * value: Tensor,\n * gradFunc: (dy: Tensor, saved?: NamedTensorMap) => Tensor | Tensor[]\n * }\n */\nexport type CustomGradientFunc =\n (...inputs: Array) => {\n value: T;\n gradFunc: (dy: T, saved: Tensor[]) => Tensor | Tensor[];\n };\n\nexport type MemoryInfo = {\n numTensors: number; numDataBuffers: number; numBytes: number;\n unreliable?: boolean; reasons: string[];\n};\n\ntype KernelInfo = {\n name: string; bytesAdded: number; totalBytesSnapshot: number;\n tensorsAdded: number;\n totalTensorsSnapshot: number;\n inputShapes: number[][];\n outputShapes: number[][];\n kernelTimeMs: number | {error: string} | Promise;\n extraInfo: string | Promise;\n};\n\nexport type ProfileInfo = {\n newBytes: number; newTensors: number; peakBytes: number;\n kernels: KernelInfo[];\n result: TensorContainer;\n kernelNames: string[];\n};\n\nexport interface TimingInfo extends BackendTimingInfo {\n wallMs: number;\n}\n\n/** @docalias Function */\nexport type ScopeFn = () => T;\n\ninterface ScopeState {\n track: Tensor[];\n name: string;\n id: number;\n}\n\ninterface RegisteredKernelInvocation {\n kernelName: string;\n inputs: I;\n attrs?: NamedAttrMap;\n}\n\ninterface CustomGradKernelInvocation {\n forwardFunc: ForwardFunc;\n backwardsFunc: (dy: T, saved: Tensor[]) => {\n [P in keyof I]: () => I[P]\n };\n inputs: I;\n attrs?: NamedAttrMap;\n}\n\nfunction isRegisteredKernelInvocation(\n kernelInvocation: RegisteredKernelInvocation|\n CustomGradKernelInvocation):\n kernelInvocation is RegisteredKernelInvocation {\n return (kernelInvocation as RegisteredKernelInvocation).kernelName != null;\n}\n\nclass EngineState {\n // Public since optimizers will use it.\n registeredVariables: NamedVariableMap = {};\n\n nextTapeNodeId = 0;\n numBytes = 0;\n numTensors = 0;\n numStringTensors = 0;\n numDataBuffers = 0;\n\n activeTape: TapeNode[];\n // Number of nested tf.grad() statements when computing higher-order\n // gradients. E.g. `1` for first-order gradients and `2` for second-order\n // gradients. Used to track if the tape should be removed after a backprop.\n gradientDepth = 0;\n // Number of nested kernel calls. When kernel depth is greater than 1, we turn\n // off the tape.\n kernelDepth = 0;\n\n // Keep Tensors that parallel the tapes.\n activeScope: ScopeState;\n scopeStack: ScopeState[] = [];\n /**\n * Keeps track of the number of data moves during a kernel execution. We\n * maintain a stack since kernels can call other kernels, recursively.\n */\n numDataMovesStack: number[] = [];\n nextScopeId = 0;\n\n tensorInfo = new WeakMap();\n\n profiling = false;\n activeProfile: ProfileInfo = {\n newBytes: 0,\n newTensors: 0,\n peakBytes: 0,\n kernels: [],\n result: null,\n get kernelNames():\n string[] {\n return Array.from(new Set(this.kernels.map(k => k.name)));\n }\n };\n\n dispose() {\n for (const variableName in this.registeredVariables) {\n this.registeredVariables[variableName].dispose();\n }\n }\n}\n\nexport class Engine implements TensorTracker, DataMover {\n state: EngineState;\n backendName: string;\n registry: {[id: string]: KernelBackend} = {};\n registryFactory: {\n [id: string]: {\n factory: () => KernelBackend | Promise,\n priority: number\n }\n } = {};\n\n private profiler: Profiler;\n private backendInstance: KernelBackend;\n private pendingBackendInit: Promise;\n private pendingBackendInitId = 0;\n\n constructor(public ENV: Environment) {\n this.state = new EngineState();\n }\n\n async ready(): Promise {\n if (this.pendingBackendInit != null) {\n return this.pendingBackendInit.then(() => {});\n }\n if (this.backendInstance != null) {\n return;\n }\n const sortedBackends = this.getSortedBackends();\n\n for (let i = 0; i < sortedBackends.length; i++) {\n const backendName = sortedBackends[i];\n const success = await this.initializeBackend(backendName).success;\n if (success) {\n await this.setBackend(backendName);\n return;\n }\n }\n\n throw new Error(\n `Could not initialize any backends, all backend initializations ` +\n `failed.`);\n }\n\n get backend(): KernelBackend {\n if (this.pendingBackendInit != null) {\n throw new Error(\n `Backend '${this.backendName}' has not yet been initialized. Make ` +\n `sure to await tf.ready() or await tf.setBackend() before calling ` +\n `other methods`);\n }\n if (this.backendInstance == null) {\n const {name, asyncInit} = this.initializeBackendsAndReturnBest();\n if (asyncInit) {\n throw new Error(\n `The highest priority backend '${name}' has not yet been ` +\n `initialized. Make sure to await tf.ready() or ` +\n `await tf.setBackend() before calling other methods`);\n }\n this.setBackend(name);\n }\n return this.backendInstance;\n }\n\n backendNames(): string[] {\n return Object.keys(this.registryFactory);\n }\n\n findBackend(backendName: string): KernelBackend {\n if (!(backendName in this.registry)) {\n // If the backend hasn't been initialized but we have a registry entry for\n // it, initialize it and return it.\n if (backendName in this.registryFactory) {\n const {asyncInit} = this.initializeBackend(backendName);\n if (asyncInit) {\n // Backend is not ready yet.\n return null;\n }\n } else {\n return null;\n }\n }\n return this.registry[backendName];\n }\n\n findBackendFactory(backendName: string):\n () => KernelBackend | Promise {\n if (!(backendName in this.registryFactory)) {\n return null;\n }\n return this.registryFactory[backendName].factory;\n }\n\n registerBackend(\n backendName: string,\n factory: () => KernelBackend | Promise,\n priority = 1): boolean {\n if (backendName in this.registryFactory) {\n log.warn(\n `${backendName} backend was already registered. ` +\n `Reusing existing backend factory.`);\n return false;\n }\n this.registryFactory[backendName] = {factory, priority};\n return true;\n }\n\n async setBackend(backendName: string): Promise {\n if (this.registryFactory[backendName] == null) {\n throw new Error(`Backend name '${backendName}' not found in registry`);\n }\n this.backendName = backendName;\n if (this.registry[backendName] == null) {\n this.backendInstance = null;\n const {success, asyncInit} = this.initializeBackend(backendName);\n const result = asyncInit ? await success : success;\n if (!result) {\n return false;\n }\n }\n this.backendInstance = this.registry[backendName];\n this.setupRegisteredKernels();\n // Reset the profiler.\n this.profiler = new Profiler(this.backendInstance);\n\n return true;\n }\n\n private setupRegisteredKernels(): void {\n const kernels = getKernelsForBackend(this.backendName);\n kernels.forEach(kernel => {\n if (kernel.setupFunc != null) {\n kernel.setupFunc(this.backendInstance);\n }\n });\n }\n\n private disposeRegisteredKernels(backendName: string): void {\n const kernels = getKernelsForBackend(backendName);\n kernels.forEach(kernel => {\n if (kernel.disposeFunc != null) {\n kernel.disposeFunc(this.registry[backendName]);\n }\n });\n }\n\n /**\n * Initializes a backend by looking up the backend name in the factory\n * registry and calling the factory method. Returns a boolean representing\n * whether the initialization of the backend suceeded. Throws an error if\n * there is no backend in the factory registry.\n */\n private initializeBackend(backendName: string):\n {success: boolean|Promise, asyncInit: boolean} {\n const registryFactoryEntry = this.registryFactory[backendName];\n if (registryFactoryEntry == null) {\n throw new Error(\n `Cannot initialize backend ${backendName}, no registration found.`);\n }\n\n try {\n const backend = registryFactoryEntry.factory();\n /* Test if the factory returns a promise.\n Done in a more liberal way than\n previous 'Promise.resolve(backend)===backend'\n as we needed to account for custom Promise\n implementations (e.g. Angular) */\n if (backend && !(backend instanceof KernelBackend) &&\n typeof backend.then === 'function') {\n const promiseId = ++this.pendingBackendInitId;\n const success =\n backend\n .then(backendInstance => {\n // Outdated promise. Another backend was set in the meantime.\n if (promiseId < this.pendingBackendInitId) {\n return false;\n }\n this.registry[backendName] = backendInstance;\n this.pendingBackendInit = null;\n return true;\n })\n .catch(err => {\n // Outdated promise. Another backend was set in the meantime.\n if (promiseId < this.pendingBackendInitId) {\n return false;\n }\n this.pendingBackendInit = null;\n log.warn(`Initialization of backend ${backendName} failed`);\n log.warn(err.stack || err.message);\n return false;\n });\n this.pendingBackendInit = success;\n return {success, asyncInit: true};\n } else {\n this.registry[backendName] = backend as KernelBackend;\n return {success: true, asyncInit: false};\n }\n } catch (err) {\n log.warn(`Initialization of backend ${backendName} failed`);\n log.warn(err.stack || err.message);\n return {success: false, asyncInit: false};\n }\n }\n\n removeBackend(backendName: string): void {\n if (!(backendName in this.registryFactory)) {\n throw new Error(`${backendName} backend not found in registry`);\n }\n if (this.backendName === backendName && this.pendingBackendInit != null) {\n // There is a pending promise of the backend we want to remove. Make it\n // obsolete.\n this.pendingBackendInitId++;\n }\n\n if (backendName in this.registry) {\n this.disposeRegisteredKernels(backendName);\n this.registry[backendName].dispose();\n delete this.registry[backendName];\n }\n\n delete this.registryFactory[backendName];\n\n // Unset the backend if it is active.\n if (this.backendName === backendName) {\n this.pendingBackendInit = null;\n this.backendName = null;\n this.backendInstance = null;\n }\n }\n\n private getSortedBackends(): string[] {\n if (Object.keys(this.registryFactory).length === 0) {\n throw new Error('No backend found in registry.');\n }\n return Object.keys(this.registryFactory).sort((a: string, b: string) => {\n // Highest priority comes first.\n return this.registryFactory[b].priority -\n this.registryFactory[a].priority;\n });\n }\n\n private initializeBackendsAndReturnBest():\n {name: string, asyncInit: boolean} {\n const sortedBackends = this.getSortedBackends();\n\n for (let i = 0; i < sortedBackends.length; i++) {\n const backendName = sortedBackends[i];\n const {success, asyncInit} = this.initializeBackend(backendName);\n if (asyncInit || success) {\n return {name: backendName, asyncInit};\n }\n }\n throw new Error(\n `Could not initialize any backends, all backend initializations ` +\n `failed.`);\n }\n\n moveData(backend: KernelBackend, dataId: DataId) {\n const info = this.state.tensorInfo.get(dataId);\n const srcBackend = info.backend;\n const values = this.readSync(dataId);\n const refCount = srcBackend.refCount(dataId);\n // Delete the tensor from the old backend and move it to the new\n // backend.\n srcBackend.disposeData(dataId, true);\n info.backend = backend;\n backend.move(dataId, values, info.shape, info.dtype, refCount);\n if (this.shouldCheckForMemLeaks()) {\n // Track the number of moves during a kernel execution to correctly\n // detect memory leaks.\n this.state.numDataMovesStack[this.state.numDataMovesStack.length - 1]++;\n }\n }\n\n tidy(nameOrFn: string|ScopeFn, fn?: ScopeFn):\n T {\n let name: string = null;\n if (fn == null) {\n // Called with only 1 argument.\n if (typeof nameOrFn !== 'function') {\n throw new Error('Please provide a function to tidy()');\n }\n fn = nameOrFn;\n } else {\n // Called with 2 arguments.\n if (typeof nameOrFn !== 'string' && !(nameOrFn instanceof String)) {\n throw new Error(\n 'When calling with two arguments, the first argument ' +\n 'to tidy() must be a string');\n }\n if (typeof fn !== 'function') {\n throw new Error(\n 'When calling with two arguments, the 2nd argument ' +\n 'to tidy() must be a function');\n }\n name = nameOrFn as string;\n // TODO(nsthorat,smilkov): Do operation logging and performance\n // profiling.\n }\n let result: T;\n return this.scopedRun(\n () => this.startScope(name), () => this.endScope(result), () => {\n result = fn();\n if (result instanceof Promise) {\n console.error('Cannot return a Promise inside of tidy.');\n }\n return result;\n });\n }\n\n private scopedRun(start: () => void, end: () => void, f: () => T): T {\n start();\n try {\n const res = f();\n end();\n return res;\n } catch (ex) {\n end();\n throw ex;\n }\n }\n\n private static nextTensorId = 0;\n private nextTensorId(): number {\n return Engine.nextTensorId++;\n }\n\n private static nextVariableId = 0;\n private nextVariableId(): number {\n return Engine.nextVariableId++;\n }\n\n /**\n * This method is called instead of the public-facing tensor.clone() when\n * saving a tensor for backwards pass. It makes sure to add the clone\n * operation to the tape regardless of being called inside a kernel\n * execution.\n */\n private clone(x: Tensor): Tensor {\n const y: Tensor = ENGINE.runKernel(Identity, {x} as {} as NamedTensorMap);\n const inputs = {x};\n const grad = (dy: Tensor) => ({\n x: () => {\n const dtype = 'float32';\n const gradInputs = {x: dy};\n const attrs = {dtype};\n\n return ENGINE.runKernel(\n Cast, gradInputs as {} as NamedTensorMap,\n // tslint:disable-next-line: no-unnecessary-type-assertion\n attrs as {} as NamedAttrMap) as Tensor;\n }\n });\n const saved: Tensor[] = [];\n this.addTapeNode(this.state.activeScope.name, inputs, [y], grad, saved, {});\n return y;\n }\n\n /**\n * Execute a kernel with the given name and return the output tensor.\n *\n * @param kernelName The name of the kernel to execute.\n * @param inputs A map of input names to tensors.\n * @param attrs A map of attribute names to their values. An attribute is a\n * primitive (non-tensor) input to the kernel.\n * @param inputsToSave A list of tensors, inputs to save for the backprop\n * computation.\n * @param outputsToSave A list of booleans, specifying which output to save\n * for the backprop computation. These are booleans since the output\n * tensors are not visible to the user.\n */\n runKernel(\n kernelName: string, inputs: NamedTensorMap, attrs?: NamedAttrMap): T {\n if (this.backendName == null) {\n // backend has not been initialized yet (backend initialization is lazy\n // can be deferred until an op/ kernel is run).\n // The below getter has side effects that will try to initialize the\n // backend and set properties like this.backendName\n // tslint:disable-next-line: no-unused-expression\n this.backend;\n }\n const hasKernel = getKernel(kernelName, this.backendName) != null;\n if (!hasKernel) {\n throw new Error(`Kernel '${kernelName}' not registered for backend '${\n this.backendName}'`);\n }\n return this.runKernelFunc({kernelName, inputs, attrs});\n }\n\n private shouldCheckForMemLeaks(): boolean {\n return this.ENV.getBool('IS_TEST');\n }\n\n private checkKernelForMemLeak(\n kernelName: string, numDataIdsBefore: number,\n outInfos: TensorInfo[]): void {\n const numDataIdsAfter = this.backend.numDataIds();\n\n // Count the number of data ids associated with the result of the kernel.\n let numOutputDataIds = 0;\n outInfos.forEach(info => {\n // Complex numbers allocate 3 data ids, one for 'real', one for\n // 'imaginary', and one for the container that holds the former two.\n numOutputDataIds += (info.dtype === 'complex64' ? 3 : 1);\n });\n\n // Account for the number of moves during kernel execution. A \"data move\"\n // can happen in the middle of a kernel execution, placing a new (key,value)\n // pair in the data storage. Since data moves have net zero effect (we\n // always remove the data from the old backend), we have to cancel them out\n // when detecting memory leaks.\n const numMoves =\n this.state.numDataMovesStack[this.state.numDataMovesStack.length - 1];\n const dataIdsLeaked =\n numDataIdsAfter - numDataIdsBefore - numOutputDataIds - numMoves;\n if (dataIdsLeaked > 0) {\n throw new Error(\n `Backend '${this.backendName}' has an internal memory leak ` +\n `(${dataIdsLeaked} data ids) after running '${kernelName}'`);\n }\n }\n\n /**\n * Internal helper method to execute a kernel Func\n *\n * Use `runKernel` to execute kernels from outside of engine.\n */\n private runKernelFunc(\n kernelParams: RegisteredKernelInvocation|\n CustomGradKernelInvocation): T {\n let outputs: Tensor[];\n let saved: Tensor[] = [];\n const isTapeOn = this.isTapeOn();\n\n const startingBytecount = this.state.numBytes;\n const startingNumTensors = this.state.numTensors;\n\n if (this.shouldCheckForMemLeaks()) {\n this.state.numDataMovesStack.push(0);\n }\n\n let kernelFunc: () => Tensor[];\n if (this.backendName == null) {\n // backend has not been initialized yet (backend initialization is lazy\n // can be deferred until an op/ kernel is run).\n // The below getter has side effects that will try to initialize the\n // backend and set properties like this.backendName\n // tslint:disable-next-line: no-unused-expression\n this.backend;\n }\n\n let out: TensorInfo|TensorInfo[];\n\n const kernelOrScopeName = isRegisteredKernelInvocation(kernelParams) ?\n kernelParams.kernelName :\n this.state.activeScope != null ? this.state.activeScope.name : '';\n\n // Create the kernelFunc from either a registered kernel OR passed in\n // forward/backward functions (used by custom grad). In this context a\n // kernelFunc wraps a kernel implementation with some bookkeeping.\n\n if (isRegisteredKernelInvocation(kernelParams)) {\n const {kernelName, inputs, attrs} = kernelParams;\n if (this.backendName == null) {\n // backend has not been initialized yet (backend initialization is lazy\n // can be deferred until an op/ kernel is run).\n // The below getter has side effects that will try to initialize the\n // backend and set properties like this.backendName\n // tslint:disable-next-line: no-unused-expression\n this.backend;\n }\n const kernel = getKernel(kernelName, this.backendName);\n util.assert(\n kernel != null,\n () => `Cannot find registered kernel '${kernelName}' for backend '${\n this.backendName}'`);\n\n kernelFunc = () => {\n const numDataIdsBefore = this.backend.numDataIds();\n out = kernel.kernelFunc({inputs, attrs, backend: this.backend});\n const outInfos = Array.isArray(out) ? out : [out];\n if (this.shouldCheckForMemLeaks()) {\n this.checkKernelForMemLeak(kernelName, numDataIdsBefore, outInfos);\n }\n\n const outTensors = outInfos.map((outInfo: TensorInfo|Tensor) => {\n // todo (yassogba) remove this option (Tensor) when node backend\n // methods have been modularized and they all return tensorInfo.\n // TensorInfos do not have a rank attribute.\n if ((outInfo as Tensor).rank != null) {\n return outInfo as Tensor;\n }\n return this.makeTensorFromTensorInfo(outInfo);\n });\n\n // Save any required inputs and outputs.\n\n // Do not save unless we are recording to the tape. Otherwise it would\n // cause a mem leak since there would be no backprop for these tensors\n // (which would otherwise dispose them).\n if (isTapeOn) {\n const tensorsToSave =\n this.getTensorsForGradient(kernelName, inputs, outTensors);\n saved = this.saveTensorsForBackwardMode(tensorsToSave);\n }\n return outTensors;\n };\n } else {\n const {forwardFunc} = kernelParams;\n // Running a customGrad op.\n const saveFunc: GradSaveFunc = (tensors) => {\n // Do not save unless we are recording to the tape. Otherwise it would\n // cause a mem leak since we would never run backprop, which disposes\n // the kept tensors.\n if (!isTapeOn) {\n return;\n }\n saved = tensors.map(tensor => this.keep(this.clone(tensor)));\n };\n\n kernelFunc = () => {\n const numDataIdsBefore = this.backend.numDataIds();\n out = this.tidy(() => forwardFunc(this.backend, saveFunc));\n const outs = (Array.isArray(out) ? out : [out]) as Tensor[];\n if (this.shouldCheckForMemLeaks()) {\n // Scope name is used to print a more helpful error message if needed.\n this.checkKernelForMemLeak(kernelOrScopeName, numDataIdsBefore, outs);\n }\n return outs;\n };\n }\n\n //\n // Run the kernelFunc. Optionally profiling it.\n //\n const {inputs, attrs} = kernelParams;\n const backwardsFunc = isRegisteredKernelInvocation(kernelParams) ?\n null :\n kernelParams.backwardsFunc;\n\n let kernelProfile: KernelProfile;\n this.scopedRun(\n // Stop recording to a tape when running a kernel.\n () => this.state.kernelDepth++, () => this.state.kernelDepth--, () => {\n if (!this.ENV.getBool('DEBUG') && !this.state.profiling) {\n outputs = kernelFunc();\n } else {\n kernelProfile = this.profiler.profileKernel(\n kernelOrScopeName, inputs, () => kernelFunc());\n if (this.ENV.getBool('DEBUG')) {\n this.profiler.logKernelProfile(kernelProfile);\n }\n outputs = kernelProfile.outputs;\n }\n });\n\n if (isTapeOn) {\n this.addTapeNode(\n kernelOrScopeName, inputs, outputs, backwardsFunc, saved, attrs);\n }\n\n if (this.state.profiling) {\n this.state.activeProfile.kernels.push({\n name: kernelOrScopeName,\n bytesAdded: this.state.numBytes - startingBytecount,\n totalBytesSnapshot: this.state.numBytes,\n tensorsAdded: this.state.numTensors - startingNumTensors,\n totalTensorsSnapshot: this.state.numTensors,\n inputShapes: Object.keys(inputs).map(\n key => inputs[key] != null ? inputs[key].shape : null),\n outputShapes: outputs.map(item => item.shape),\n kernelTimeMs: kernelProfile.timeMs,\n extraInfo: kernelProfile.extraInfo\n });\n }\n return (Array.isArray(out) ? outputs : outputs[0]) as T;\n }\n\n /**\n * Saves tensors used in forward mode for use in backward mode.\n *\n * @param tensors the list of tensors to save.\n */\n private saveTensorsForBackwardMode(tensors: Tensor[]): Tensor[] {\n const saved = tensors.map(tensor => this.keep(this.clone(tensor)));\n return saved;\n }\n\n /**\n * Returns a list of tensors to save for a given gradient calculation.\n *\n * @param kernelName name of kernel to look up gradient for.\n * @param inputs a map of input tensors.\n * @param outputs an array of output tensors from forward mode of kernel.\n */\n private getTensorsForGradient(\n kernelName: string, inputs: NamedTensorMap,\n outputs: Tensor[]): Tensor[]|null {\n const gradConfig = getGradient(kernelName);\n if (gradConfig != null) {\n const inputsToSave: string[] = gradConfig.inputsToSave || [];\n const outputsToSave: boolean[] = gradConfig.outputsToSave || [];\n\n // If saveAllInputs is true, all inputs will be saved. Otherwise, inputs\n // specified in inputsToSave will be saved.\n let inputTensorsToSave: Tensor[];\n if (gradConfig.saveAllInputs) {\n util.assert(\n Array.isArray(inputs),\n () => 'saveAllInputs is true, expected inputs to be an array.');\n\n inputTensorsToSave = Object.keys(inputs).map((key) => inputs[key]);\n } else {\n inputTensorsToSave = inputsToSave.map((inputName) => inputs[inputName]);\n }\n\n const outputTensorsToSave: Tensor[] =\n outputs.filter((_, i) => outputsToSave[i]);\n\n return inputTensorsToSave.concat(outputTensorsToSave);\n }\n // We return an empty list rather than throw an error because the kernel we\n // are looking up may not actually be relevant to backproping through the\n // overall function\n //\n // See 'does not error if irrelevant (pruned) ops are missing grads' test\n // in gradients_test.ts for an example.\n return [];\n }\n\n /**\n * Internal method used by public APIs for tensor creation. Makes a new\n * tensor with the provided shape, dtype and values. It always\n * creates a new data id and writes the values to the underlying backend.\n */\n makeTensor(\n values: DataValues, shape: number[], dtype: DataType,\n backend?: KernelBackend): Tensor {\n if (values == null) {\n throw new Error('Values passed to engine.makeTensor() are null');\n }\n dtype = dtype || 'float32';\n backend = backend || this.backend;\n let backendVals = values as BackendValues;\n if (dtype === 'string' && util.isString(values[0])) {\n backendVals = (values as string[]).map(d => util.encodeString(d));\n }\n const dataId = backend.write(backendVals, shape, dtype);\n const t = new Tensor(shape, dtype, dataId, this.nextTensorId());\n this.trackTensor(t, backend);\n\n // Count bytes for string tensors.\n if (dtype === 'string') {\n const info = this.state.tensorInfo.get(dataId);\n const newBytes = bytesFromStringArray(backendVals as Uint8Array[]);\n this.state.numBytes += newBytes - info.bytes;\n info.bytes = newBytes;\n }\n return t;\n }\n\n /**\n * Internal method used by backends. Makes a new tensor\n * that is a wrapper around an existing data id. It doesn't create\n * a new data id, only increments the ref count used in memory tracking.\n * @deprecated\n */\n makeTensorFromDataId(\n dataId: DataId, shape: number[], dtype: DataType,\n backend?: KernelBackend): Tensor {\n dtype = dtype || 'float32';\n const tensorInfo: TensorInfo = {dataId, shape, dtype};\n return this.makeTensorFromTensorInfo(tensorInfo, backend);\n }\n\n /**\n * Internal method used by backends. Makes a new tensor that is a wrapper\n * around an existing data id in TensorInfo. It doesn't create a new data id,\n * only increments the ref count used in memory tracking.\n */\n makeTensorFromTensorInfo(tensorInfo: TensorInfo, backend?: KernelBackend):\n Tensor {\n const {dataId, shape, dtype} = tensorInfo;\n const t = new Tensor(shape, dtype, dataId, this.nextTensorId());\n this.trackTensor(t, backend);\n return t;\n }\n\n makeVariable(\n initialValue: Tensor, trainable = true, name?: string,\n dtype?: DataType): Variable {\n name = name || this.nextVariableId().toString();\n if (dtype != null && dtype !== initialValue.dtype) {\n initialValue = initialValue.cast(dtype);\n }\n const v = new Variable(initialValue, trainable, name, this.nextTensorId());\n if (this.state.registeredVariables[v.name] != null) {\n throw new Error(`Variable with name ${v.name} was already registered`);\n }\n this.state.registeredVariables[v.name] = v;\n this.incRef(v, this.backend);\n return v;\n }\n\n trackTensor(a: Tensor, backend: KernelBackend): void {\n this.state.numTensors++;\n if (a.dtype === 'string') {\n this.state.numStringTensors++;\n }\n // Bytes for complex numbers are counted by their components. Bytes for\n // string tensors are counted when writing values.\n let bytes = 0;\n if (a.dtype !== 'complex64' && a.dtype !== 'string') {\n bytes = a.size * util.bytesPerElement(a.dtype);\n }\n this.state.numBytes += bytes;\n\n if (!this.state.tensorInfo.has(a.dataId)) {\n this.state.numDataBuffers++;\n this.state.tensorInfo.set(a.dataId, {\n backend: backend || this.backend,\n dtype: a.dtype,\n shape: a.shape,\n bytes\n });\n }\n\n if (!(a instanceof Variable)) {\n this.track(a);\n }\n }\n\n // Track the tensor by dataId and increase the refCount for the dataId in the\n // backend.\n // TODO(pyu10055): This is currently used by makeVariable method, to increase\n // refCount on the backend for the dataId. It can potentially be replaced with\n // Identity op indead of calling backend directly.\n incRef(a: Tensor, backend: KernelBackend): void {\n this.trackTensor(a, backend);\n this.backend.incRef(a.dataId);\n }\n\n removeDataId(dataId: DataId, backend: KernelBackend) {\n if (this.state.tensorInfo.has(dataId) &&\n this.state.tensorInfo.get(dataId).backend === backend) {\n this.state.tensorInfo.delete(dataId);\n this.state.numDataBuffers--;\n }\n }\n disposeTensor(a: Tensor): void {\n if (!this.state.tensorInfo.has(a.dataId)) {\n return;\n }\n const info = this.state.tensorInfo.get(a.dataId);\n\n this.state.numTensors--;\n if (a.dtype === 'string') {\n this.state.numStringTensors--;\n this.state.numBytes -= info.bytes;\n }\n // Don't count bytes for complex numbers as they are counted by their\n // components.\n if (a.dtype !== 'complex64' && a.dtype !== 'string') {\n const bytes = a.size * util.bytesPerElement(a.dtype);\n this.state.numBytes -= bytes;\n }\n\n // Remove the reference to dataId if backend dispose the data successfully\n if (info.backend.disposeData(a.dataId)) {\n this.removeDataId(a.dataId, info.backend);\n }\n\n // TODO(nsthorat): Construct an error and save the stack trace for\n // debugging when in debug mode. Creating a stack trace is too expensive\n // to do unconditionally.\n }\n\n disposeVariables(): void {\n for (const varName in this.state.registeredVariables) {\n const v = this.state.registeredVariables[varName];\n this.disposeVariable(v);\n }\n }\n\n disposeVariable(v: Variable): void {\n this.disposeTensor(v);\n if (this.state.registeredVariables[v.name] != null) {\n delete this.state.registeredVariables[v.name];\n }\n }\n\n memory(): MemoryInfo {\n const info = this.backend.memory() as MemoryInfo;\n info.numTensors = this.state.numTensors;\n info.numDataBuffers = this.state.numDataBuffers;\n info.numBytes = this.state.numBytes;\n if (this.state.numStringTensors > 0) {\n info.unreliable = true;\n if (info.reasons == null) {\n info.reasons = [];\n }\n info.reasons.push(\n 'Memory usage by string tensors is approximate ' +\n '(2 bytes per character)');\n }\n return info;\n }\n\n async profile(query: () => (TensorContainer | Promise)):\n Promise {\n this.state.profiling = true;\n\n const startBytes = this.state.numBytes;\n const startNumTensors = this.state.numTensors;\n\n this.state.activeProfile.kernels = [];\n this.state.activeProfile.result = await query();\n\n this.state.profiling = false;\n\n this.state.activeProfile.peakBytes = Math.max(\n ...this.state.activeProfile.kernels.map(d => d.totalBytesSnapshot));\n this.state.activeProfile.newBytes = this.state.numBytes - startBytes;\n this.state.activeProfile.newTensors =\n this.state.numTensors - startNumTensors;\n for (const kernel of this.state.activeProfile.kernels) {\n kernel.kernelTimeMs = await kernel.kernelTimeMs;\n kernel.extraInfo = await kernel.extraInfo;\n }\n return this.state.activeProfile;\n }\n\n isTapeOn(): boolean {\n return this.state.gradientDepth > 0 && this.state.kernelDepth === 0;\n }\n\n private addTapeNode(\n kernelName: string, inputs: NamedTensorMap, outputs: Tensor[],\n gradientsFunc: GradFunc, saved: Tensor[], attrs: NamedAttrMap): void {\n const tapeNode: TapeNode =\n {id: this.state.nextTapeNodeId++, kernelName, inputs, outputs, saved};\n\n const gradConfig = getGradient(kernelName);\n if (gradConfig != null) {\n gradientsFunc = gradConfig.gradFunc;\n }\n if (gradientsFunc != null) {\n tapeNode.gradient = (dys: Tensor[]) => {\n // TODO(smilkov): To optimize back-prop, pass dys that are not used in\n // the backprop graph to the user as null instead of zeros\n dys = dys.map((dy, i) => {\n if (dy == null) {\n const output = outputs[i];\n const vals = util.makeZerosTypedArray(output.size, output.dtype);\n return this.makeTensor(vals, output.shape, output.dtype);\n }\n return dy;\n });\n // Grad functions of ops with single outputs expect a dy, while ops\n // with multiple outputs expect dys (array of dy).\n return gradientsFunc(dys.length > 1 ? dys : dys[0], saved, attrs);\n };\n }\n this.state.activeTape.push(tapeNode);\n }\n\n keep(result: T): T {\n result.kept = true;\n return result;\n }\n\n private startTape() {\n if (this.state.gradientDepth === 0) {\n this.state.activeTape = [];\n }\n this.state.gradientDepth++;\n }\n\n private endTape() {\n this.state.gradientDepth--;\n }\n\n /**\n * Start a scope. Use this with endScope() to achieve the same functionality\n * as scope() without the need for a function closure.\n */\n startScope(name?: string) {\n const scopeInfo: ScopeState = {\n track: [],\n name: 'unnamed scope',\n id: this.state.nextScopeId++\n };\n if (name) {\n scopeInfo.name = name;\n }\n this.state.scopeStack.push(scopeInfo);\n this.state.activeScope = scopeInfo;\n }\n\n /**\n * End a scope. Use this with startScope() to achieve the same functionality\n * as scope() without the need for a function closure.\n */\n endScope(result?: TensorContainer) {\n const tensorsToTrackInParent = getTensorsInContainer(result);\n const tensorsToTrackInParentSet =\n new Set(tensorsToTrackInParent.map(t => t.id));\n\n // Dispose the arrays tracked in this scope.\n for (let i = 0; i < this.state.activeScope.track.length; i++) {\n const tensor = this.state.activeScope.track[i];\n if (!tensor.kept && !tensorsToTrackInParentSet.has(tensor.id)) {\n tensor.dispose();\n }\n }\n\n const oldScope = this.state.scopeStack.pop();\n this.state.activeScope = this.state.scopeStack.length === 0 ?\n null :\n this.state.scopeStack[this.state.scopeStack.length - 1];\n\n // Track the current result in the parent scope.\n tensorsToTrackInParent.forEach(tensor => {\n // Only track the tensor if was allocated in the inner scope and is not\n // globally kept.\n if (!tensor.kept && tensor.scopeId === oldScope.id) {\n this.track(tensor);\n }\n });\n }\n\n /**\n * Returns gradients of `f` with respect to each of the `xs`. The gradients\n * returned are of the same length as `xs`, but some might be null if `f`\n * was not a function of that `x`. It also takes optional dy to multiply the\n * gradient, which defaults to `1`.\n */\n gradients(\n f: () => T, xs: Tensor[], dy?: T,\n allowNoGradients = false): {value: T, grads: Tensor[]} {\n util.assert(\n xs.length > 0, () => 'gradients() received an empty list of xs.');\n if (dy != null && dy.dtype !== 'float32') {\n throw new Error(`dy must have 'float32' dtype, but has '${dy.dtype}'`);\n }\n\n const y = this.scopedRun(\n () => this.startTape(), () => this.endTape(),\n () => this.tidy('forward', f));\n\n util.assert(\n y instanceof Tensor,\n () => 'The result y returned by f() must be a tensor.');\n // Filter out the nodes that don't connect x => y.\n const filteredTape = getFilteredNodesXToY(this.state.activeTape, xs, y);\n if (!allowNoGradients && filteredTape.length === 0 && xs.length > 0) {\n throw new Error(\n 'Cannot compute gradient of y=f(x) with respect to x. Make sure ' +\n 'that the f you passed encloses all operations that lead from x ' +\n 'to y.');\n }\n\n return this.tidy('backward', () => {\n const accumulatedGradientMap: {[tensorId: number]: Tensor} = {};\n accumulatedGradientMap[y.id] = (dy == null) ? ones(y.shape) : dy;\n\n // Backprop gradients through the filtered nodes.\n backpropagateGradients(\n accumulatedGradientMap, filteredTape,\n // Pass the tidy function to avoid circular dep with `tape.ts`.\n f => this.tidy(f as ScopeFn),\n // Pass an add function to avoide a circular dep with `tape.ts`.\n add);\n const grads = xs.map(x => accumulatedGradientMap[x.id]);\n\n if (this.state.gradientDepth === 0) {\n // This means that we are not computing higher-order gradients\n // and can clean up the tape.\n this.state.activeTape.forEach(node => {\n for (const tensor of node.saved) {\n tensor.dispose();\n }\n });\n this.state.activeTape = null;\n }\n return {value: y, grads};\n });\n }\n\n customGrad(f: CustomGradientFunc):\n (...args: Array) => T {\n util.assert(\n util.isFunction(f),\n () => 'The f passed in customGrad(f) must be a function.');\n return (...inputs: Tensor[]): T => {\n util.assert(\n inputs.every(t => t instanceof Tensor),\n () => 'The args passed in customGrad(f)(x1, x2,...) must all be ' +\n 'tensors');\n\n let res: {\n value: T,\n gradFunc: (dy: T, saved: Tensor[]) => Tensor | Tensor[],\n };\n const inputMap: NamedTensorMap = {};\n inputs.forEach((input, i) => {\n inputMap[i] = input;\n });\n\n const forwardFunc: ForwardFunc = (_, save) => {\n res = f(...[...inputs, save]);\n util.assert(\n res.value instanceof Tensor,\n () => 'The function f passed in customGrad(f) must return an ' +\n 'object where `obj.value` is a tensor');\n util.assert(\n util.isFunction(res.gradFunc),\n () => 'The function f passed in customGrad(f) must return an ' +\n 'object where `obj.gradFunc` is a function.');\n return res.value;\n };\n\n const backwardsFunc = (dy: T, saved: Tensor[]) => {\n const gradRes = res.gradFunc(dy, saved);\n const grads: Tensor[] = Array.isArray(gradRes) ? gradRes : [gradRes];\n util.assert(\n grads.length === inputs.length,\n () => 'The function f passed in customGrad(f) must return an ' +\n 'object where `obj.gradFunc` is a function that returns ' +\n 'the same number of tensors as inputs passed to f(...).');\n util.assert(\n grads.every(t => t instanceof Tensor),\n () => 'The function f passed in customGrad(f) must return an ' +\n 'object where `obj.gradFunc` is a function that returns ' +\n 'a list of only tensors.');\n const gradMap: {[key: string]: () => Tensor} = {};\n grads.forEach((grad, i) => {\n gradMap[i] = () => grad;\n });\n return gradMap;\n };\n\n return this.runKernelFunc({\n forwardFunc,\n backwardsFunc,\n inputs: inputMap,\n });\n };\n }\n\n readSync(dataId: DataId): BackendValues {\n // Route the read to the correct backend.\n const info = this.state.tensorInfo.get(dataId);\n return info.backend.readSync(dataId);\n }\n read(dataId: DataId): Promise {\n // Route the read to the correct backend.\n const info = this.state.tensorInfo.get(dataId);\n return info.backend.read(dataId);\n }\n\n readToGPU(dataId: DataId, options?: DataToGPUOptions): GPUData {\n // Route the read to the correct backend.\n const info = this.state.tensorInfo.get(dataId);\n return info.backend.readToGPU(dataId, options);\n }\n\n async time(query: () => void): Promise {\n const start = now();\n const timingInfo = await this.backend.time(query) as TimingInfo;\n timingInfo.wallMs = now() - start;\n return timingInfo;\n }\n\n /**\n * Tracks a Tensor in the current scope to be automatically cleaned up\n * when the current scope ends, and returns the value.\n *\n * @param result The Tensor to track in the current scope.\n */\n private track(result: T): T {\n if (this.state.activeScope != null) {\n result.scopeId = this.state.activeScope.id;\n this.state.activeScope.track.push(result);\n }\n\n return result;\n }\n\n get registeredVariables(): NamedVariableMap {\n return this.state.registeredVariables;\n }\n\n /**\n * Resets the engine state. Removes all backends but does not remove\n * registered backend factories.\n */\n reset(): void {\n // Make any pending promise obsolete.\n this.pendingBackendInitId++;\n\n this.state.dispose();\n this.ENV.reset();\n this.state = new EngineState();\n\n for (const backendName in this.registry) {\n this.disposeRegisteredKernels(backendName);\n this.registry[backendName].dispose();\n delete this.registry[backendName];\n }\n this.backendName = null;\n this.backendInstance = null;\n this.pendingBackendInit = null;\n }\n}\n\nfunction ones(shape: number[]): Tensor {\n const values = makeOnesTypedArray(sizeFromShape(shape), 'float32');\n return ENGINE.makeTensor(values, shape, 'float32');\n}\n\nexport function getOrMakeEngine(): Engine {\n const ns = getGlobalNamespace() as {} as {_tfengine: Engine};\n if (ns._tfengine == null) {\n const environment = new Environment(ns);\n ns._tfengine = new Engine(environment);\n }\n setEnvironmentGlobal(ns._tfengine.ENV);\n\n // Tell the current tensor interface that the global engine is responsible\n // for tracking.\n setTensorTracker(() => ns._tfengine);\n return ns._tfengine;\n}\n\nexport const ENGINE = getOrMakeEngine();\n\n/**\n * A implementation of the add op for use within engine and tape.\n *\n * This allows us to avoid a circular dependency between add.ts and engine.\n * It is exported to be available in tape tests.\n */\nexport function add(a: Tensor, b: Tensor): Tensor {\n // We duplicate Add here to avoid a circular dependency with add.ts.\n const inputs = {a, b};\n return ENGINE.runKernel(Add, inputs as {} as NamedTensorMap);\n}\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// tslint:disable-next-line:no-any\nfunction _isNavigatorDefined(): boolean {\n return typeof navigator !== 'undefined' && navigator != null;\n}\n\nlet isMobileMockValue: boolean|undefined;\n\nexport function mockIsMobile(value: boolean|undefined) {\n isMobileMockValue = value;\n}\n\nexport function isMobile(nav?: Navigator): boolean {\n if (isMobileMockValue !== undefined) {\n return isMobileMockValue;\n }\n if (nav || _isNavigatorDefined()) {\n if (!nav) {\n nav = navigator;\n }\n if (nav.product === 'ReactNative') {\n return true;\n }\n\n const a = nav.userAgent || nav.vendor ||\n // tslint:disable-next-line:no-any\n (typeof window !== 'undefined' ? (window as any).opera : '');\n // Use `navigator.userAgentData.mobile` as fallback.\n if (!a) {\n // tslint:disable-next-line:no-any\n const navAny = nav as any;\n return navAny.userAgentData && navAny.userAgentData.mobile;\n }\n // tslint:disable-next-line:max-line-length\n return /(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i\n .test(a) ||\n // tslint:disable-next-line:max-line-length\n /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|i230|iac( |\\-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc\\-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|\\-[a-w])|libw|lynx|m1\\-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m\\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\\-2|po(ck|rt|se)|prox|psio|pt\\-g|qa\\-a|qc(07|12|21|32|60|\\-[2-7]|i\\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\\-|oo|p\\-)|sdk\\/|se(c(\\-|0|1)|47|mc|nd|ri)|sgh\\-|shar|sie(\\-|m)|sk\\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\\-|v\\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\\-|tdg\\-|tel(i|m)|tim\\-|t\\-mo|to(pl|sh)|ts(70|m\\-|m3|m5)|tx\\-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\\-|your|zeto|zte\\-/i\n .test(a.substr(0, 4));\n }\n return false;\n}\n\nexport function isBrowser(): boolean {\n return (typeof window !== 'undefined' && window.document != null) ||\n //@ts-ignore\n (typeof WorkerGlobalScope !== 'undefined');\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport './engine';\n\nimport * as device_util from './device_util';\nimport {env} from './environment';\n\nconst ENV = env();\n\n/**\n * This file contains environment-related flag registrations.\n */\n\n/** Whether to enable debug mode. */\nENV.registerFlag('DEBUG', () => false, debugValue => {\n if (debugValue) {\n console.warn(\n 'Debugging mode is ON. The output of every math call will ' +\n 'be downloaded to CPU and checked for NaNs. ' +\n 'This significantly impacts performance.');\n }\n});\n\n/** Whether we are in a browser (as versus, say, node.js) environment. */\nENV.registerFlag('IS_BROWSER', () => device_util.isBrowser());\n\n/** Whether we are in a browser (as versus, say, node.js) environment. */\nENV.registerFlag(\n 'IS_NODE',\n () => (typeof process !== 'undefined') &&\n (typeof process.versions !== 'undefined') &&\n (typeof process.versions.node !== 'undefined'));\n\n/** Whether this browser is Chrome. */\nENV.registerFlag(\n 'IS_CHROME',\n () => typeof navigator !== 'undefined' && navigator != null &&\n navigator.userAgent != null && /Chrome/.test(navigator.userAgent) &&\n /Google Inc/.test(navigator.vendor));\n\n/**\n * True when the environment is \"production\" where we disable safety checks\n * to gain performance.\n */\nENV.registerFlag('PROD', () => false);\n\n/**\n * Whether to do sanity checks when inferring a shape from user-provided\n * values, used when creating a new tensor.\n */\nENV.registerFlag(\n 'TENSORLIKE_CHECK_SHAPE_CONSISTENCY', () => ENV.getBool('DEBUG'));\n\n/** Whether deprecation warnings are enabled. */\nENV.registerFlag('DEPRECATION_WARNINGS_ENABLED', () => true);\n\n/** True if running unit tests. */\nENV.registerFlag('IS_TEST', () => false);\n\n/** Whether to check computation result for errors. */\nENV.registerFlag('CHECK_COMPUTATION_FOR_ERRORS', () => true);\n\n/** Whether the backend needs to wrap input to imageBitmap. */\nENV.registerFlag('WRAP_TO_IMAGEBITMAP', () => false);\n\n/** Experimental flag, whether enter compile only phase. */\nENV.registerFlag('ENGINE_COMPILE_ONLY', () => false);\n\n/** Whether to enable canvas2d willReadFrequently for GPU backends */\nENV.registerFlag('CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU', () => false);\n\n/** Whether to use setTimeoutCustom */\nENV.registerFlag('USE_SETTIMEOUTCUSTOM', () => false);\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from './engine';\nimport {env} from './environment';\nimport {Tensor} from './tensor';\nimport {DataType, TensorLike, WebGLData} from './types';\nimport {assert, flatten, inferDtype, isTypedArray, toTypedArray} from './util';\n\nexport function inferShape(\n val: TensorLike|WebGLData, dtype?: DataType): number[] {\n let firstElem: typeof val = val;\n\n if (isTypedArray(val)) {\n return dtype === 'string' ? [] : [val.length];\n }\n if (typeof val === 'object' && 'texture' in val) {\n const usedChannels = val.channels || 'RGBA';\n return [val.height, val.width * usedChannels.length];\n }\n if (!Array.isArray(val)) {\n return []; // Scalar.\n }\n const shape: number[] = [];\n\n while (Array.isArray(firstElem) ||\n isTypedArray(firstElem) && dtype !== 'string') {\n shape.push(firstElem.length);\n firstElem = firstElem[0];\n }\n if (Array.isArray(val) &&\n env().getBool('TENSORLIKE_CHECK_SHAPE_CONSISTENCY')) {\n deepAssertShapeConsistency(val, shape, []);\n }\n\n return shape;\n}\n\nfunction deepAssertShapeConsistency(\n val: TensorLike, shape: number[], indices: number[]) {\n indices = indices || [];\n if (!(Array.isArray(val)) && !isTypedArray(val)) {\n assert(\n shape.length === 0,\n () => `Element arr[${indices.join('][')}] is a primitive, ` +\n `but should be an array/TypedArray of ${shape[0]} elements`);\n return;\n }\n assert(\n shape.length > 0,\n () => `Element arr[${indices.join('][')}] should be a primitive, ` +\n `but is an array of ${val.length} elements`);\n assert(\n val.length === shape[0],\n () => `Element arr[${indices.join('][')}] should have ${shape[0]} ` +\n `elements, but has ${val.length} elements`);\n const subShape = shape.slice(1);\n for (let i = 0; i < val.length; ++i) {\n deepAssertShapeConsistency(val[i], subShape, indices.concat(i));\n }\n}\n\nfunction assertDtype(\n expectedDtype: DataType|'numeric'|'string_or_numeric',\n actualDType: DataType, argName: string, functionName: string) {\n if (expectedDtype === 'string_or_numeric') {\n return;\n }\n if (expectedDtype == null) {\n throw new Error(`Expected dtype cannot be null.`);\n }\n if (expectedDtype !== 'numeric' && expectedDtype !== actualDType ||\n expectedDtype === 'numeric' && actualDType === 'string') {\n throw new Error(\n `Argument '${argName}' passed to '${functionName}' must ` +\n `be ${expectedDtype} tensor, but got ${actualDType} tensor`);\n }\n}\n\nexport function convertToTensor(\n x: T|TensorLike, argName: string, functionName: string,\n parseAsDtype: DataType|'numeric'|'string_or_numeric' = 'numeric'): T {\n if (x instanceof Tensor) {\n assertDtype(parseAsDtype, x.dtype, argName, functionName);\n return x;\n }\n let inferredDtype = inferDtype(x);\n // If the user expects a bool/int/float, use that info to update the\n // inferredDtype when it is not a string.\n if (inferredDtype !== 'string' &&\n ['bool', 'int32', 'float32'].indexOf(parseAsDtype) >= 0) {\n inferredDtype = parseAsDtype as DataType;\n }\n assertDtype(parseAsDtype, inferredDtype, argName, functionName);\n\n if ((x == null) ||\n (!isTypedArray(x) && !Array.isArray(x) && typeof x !== 'number' &&\n typeof x !== 'boolean' && typeof x !== 'string')) {\n const type = x == null ? 'null' : (x as {}).constructor.name;\n throw new Error(\n `Argument '${argName}' passed to '${functionName}' must be a ` +\n `Tensor or TensorLike, but got '${type}'`);\n }\n const inferredShape = inferShape(x, inferredDtype);\n if (!isTypedArray(x) && !Array.isArray(x)) {\n x = [x] as number[];\n }\n const skipTypedArray = true;\n const values = inferredDtype !== 'string' ?\n toTypedArray(x, inferredDtype as DataType) :\n flatten(x as string[], [], skipTypedArray) as string[];\n return ENGINE.makeTensor(values, inferredShape, inferredDtype) as T;\n}\n\nexport function convertToTensorArray(\n arg: Array, argName: string, functionName: string,\n parseAsDtype: DataType|'numeric'|'string_or_numeric' = 'numeric'): T[] {\n if (!Array.isArray(arg)) {\n throw new Error(\n `Argument ${argName} passed to ${functionName} must be a ` +\n '`Tensor[]` or `TensorLike[]`');\n }\n const tensors = arg as T[];\n return tensors.map(\n (t, i) =>\n convertToTensor(t, `${argName}[${i}]`, functionName, parseAsDtype));\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {isPromise} from '../util';\n\nexport const OP_SCOPE_SUFFIX = '__op';\n\n/**\n * Used for wrapping functions that perform math operations on\n * Tensors. The function will be wrapped in a named scope that cleans all\n * memory usage after the function is done.\n */\nexport function op(f: {[name: string]: T}): T {\n const keys = Object.keys(f);\n if (keys.length !== 1) {\n throw new Error(\n `Please provide an object with a single key ` +\n `(operation name) mapping to a function. Got an object with ` +\n `${keys.length} keys.`);\n }\n\n let opName = keys[0];\n const fn = f[opName];\n\n // Strip the underscore from the end of the function name.\n if (opName.endsWith('_')) {\n opName = opName.substring(0, opName.length - 1);\n }\n\n // add an __op suffix to distinguish ops from kernels in tf.profile\n opName = opName + OP_SCOPE_SUFFIX;\n\n // tslint:disable-next-line:no-any\n const f2 = (...args: any[]) => {\n ENGINE.startScope(opName);\n try {\n const result = fn(...args);\n if (isPromise(result)) {\n console.error('Cannot return a Promise inside of tidy.');\n }\n ENGINE.endScope(result);\n return result;\n } catch (ex) {\n ENGINE.endScope(null);\n throw ex;\n }\n };\n Object.defineProperty(f2, 'name', {value: opName, configurable: true});\n\n // tslint:disable-next-line:no-any\n return f2 as any as T;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Complex, ComplexInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\n\n/**\n * Converts two real numbers to a complex number.\n *\n * Given a tensor `real` representing the real part of a complex number, and a\n * tensor `imag` representing the imaginary part of a complex number, this\n * operation returns complex numbers elementwise of the form [r0, i0, r1, i1],\n * where r represents the real part and i represents the imag part.\n *\n * The input tensors real and imag must have the same shape.\n *\n * ```js\n * const real = tf.tensor1d([2.25, 3.25]);\n * const imag = tf.tensor1d([4.75, 5.75]);\n * const complex = tf.complex(real, imag);\n *\n * complex.print();\n * ```\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nfunction complex_(real: T|TensorLike, imag: T|TensorLike): T {\n const $real = convertToTensor(real, 'real', 'complex');\n const $imag = convertToTensor(imag, 'imag', 'complex');\n util.assertShapesMatch(\n $real.shape, $imag.shape,\n `real and imag shapes, ${$real.shape} and ${$imag.shape}, ` +\n `must match in call to tf.complex().`);\n\n const inputs: ComplexInputs = {real: $real, imag: $imag};\n return ENGINE.runKernel(Complex, inputs as {} as NamedTensorMap);\n}\n\nexport const complex = op({complex_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Tensor} from '../tensor';\nimport {TensorLike, TypedArray, WebGLData} from '../types';\nimport {DataType} from '../types';\nimport {assert, assertNonNegativeIntegerDimensions, flatten, inferDtype, isTypedArray, sizeFromShape, toTypedArray} from '../util';\n\n/** This is shared code across all tensor creation methods. */\nexport function makeTensor(\n values: TensorLike|WebGLData, shape: number[], inferredShape: number[],\n dtype?: DataType): Tensor {\n if (dtype == null) {\n dtype = inferDtype(values);\n }\n if (dtype === 'complex64') {\n throw new Error(\n `Cannot construct a complex64 tensor directly. ` +\n `Please use tf.complex(real, imag).`);\n }\n if (typeof values === 'object' && 'texture' in values) {\n if (dtype !== 'float32' && dtype !== 'int32') {\n throw new Error(\n `Creating tensor from texture only supports ` +\n `'float32'|'int32' dtype, while the dtype is ${dtype}.`);\n }\n values.channels = values.channels || 'RGBA';\n return ENGINE.backend.createTensorFromTexture(\n values, shape || inferredShape, dtype);\n }\n if (!isTypedArray(values) && !Array.isArray(values) &&\n typeof values !== 'number' && typeof values !== 'boolean' &&\n typeof values !== 'string') {\n throw new Error(\n 'values passed to tensor(values) must be a number/boolean/string or ' +\n 'an array of numbers/booleans/strings, or a TypedArray');\n }\n // Verify that the shape matches the inferred shape.\n if (shape != null) {\n assertNonNegativeIntegerDimensions(shape);\n\n const providedSize = sizeFromShape(shape);\n const inferredSize = sizeFromShape(inferredShape);\n assert(\n providedSize === inferredSize,\n () =>\n `Based on the provided shape, [${shape}], the tensor should have ` +\n `${providedSize} values but has ${inferredSize}`);\n\n for (let i = 0; i < inferredShape.length; ++i) {\n const inferred = inferredShape[i];\n const flatDimsDontMatch = i === inferredShape.length - 1 ?\n inferred !== sizeFromShape(shape.slice(i)) :\n true;\n assert(\n inferredShape[i] === shape[i] || !flatDimsDontMatch,\n () => `Error creating a new Tensor. Inferred shape ` +\n `(${inferredShape}) does not match the provided ` +\n `shape (${shape}). `);\n }\n }\n\n if (!isTypedArray(values) && !Array.isArray(values)) {\n values = [values] as number[];\n }\n\n shape = shape || inferredShape;\n values = dtype !== 'string' ?\n toTypedArray(values, dtype) :\n flatten(values as string[], [], true) as string[];\n return ENGINE.makeTensor(values as TypedArray, shape, dtype);\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport {inferShape} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {DataType, Rank, ShapeMap, WebGLData} from '../types';\n\nimport {makeTensor} from './tensor_ops_util';\n\n/**\n * Creates a `tf.Tensor` with the provided values, shape and dtype.\n *\n * ```js\n * // Pass an array of values to create a vector.\n * tf.tensor([1, 2, 3, 4]).print();\n * ```\n *\n * ```js\n * // Pass a nested array of values to make a matrix or a higher\n * // dimensional tensor.\n * tf.tensor([[1, 2], [3, 4]]).print();\n * ```\n *\n * ```js\n * // Pass a flat array and specify a shape yourself.\n * tf.tensor([1, 2, 3, 4], [2, 2]).print();\n * ```\n *\n * ```js\n * // Pass a `WebGLData` object and specify a shape yourself.\n *\n * // This makes it possible for TF.js applications to avoid GPU / CPU sync.\n * // For example, if your application includes a preprocessing step on the GPU,\n * // you could upload the GPU output directly to TF.js, rather than first\n * // downloading the values.\n *\n * // Example for WebGL2:\n * const customCanvas = document.createElement('canvas');\n * const customBackend = new tf.MathBackendWebGL(customCanvas);\n * tf.registerBackend('custom-webgl', () => customBackend);\n * await tf.setBackend('custom-webgl');\n * const gl = customBackend.gpgpu.gl;\n * const texture = gl.createTexture();\n * const tex2d = gl.TEXTURE_2D;\n * const width = 2;\n * const height = 2;\n *\n * gl.bindTexture(tex2d, texture);\n * gl.texParameteri(tex2d, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n * gl.texParameteri(tex2d, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n * gl.texParameteri(tex2d, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n * gl.texParameteri(tex2d, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n * gl.texImage2D(\n * tex2d, 0, gl.RGBA32F, // internalFormat\n * width, height, 0,\n * gl.RGBA, // textureFormat\n * gl.FLOAT, // textureType\n * new Float32Array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])\n * );\n *\n * // Currently, the `texture` has 4 pixels:\n * // Pixel0 is {R:0, G:1, B:2, A:3}\n * // Pixel1 is {R:4, G:5, B:6, A:7}\n * // Pixel2 is {R:8, G:9, B:10, A:11}\n * // Pixel3 is {R:12, G:13, B:14, A:15}\n *\n * const logicalShape = [height * width * 2];\n * const a = tf.tensor({texture, height, width, channels: 'BR'}, logicalShape);\n * // Tensor value will be [2, 0, 6, 4, 10, 8, 14, 12], since [2, 0] is the\n * // values of 'B' and 'R' channels of Pixel0, [6, 4] is the values of 'B' and\n * 'R'\n * // channels of Pixel1...\n *\n * // For postprocessing on the GPU, it's possible to retrieve the texture\n * // backing any tensor by calling the tensor's `dataToGPU` method like\n * // so:\n *\n * const tex = a.dataToGPU();\n * ```\n * @param values The values of the tensor. Can be nested array of numbers,\n * or a flat array, or a `TypedArray`, or a `WebGLData` object. If the\n * values are strings, they will be encoded as utf-8 and kept as `Uint8Array[]`.\n * If the values is a `WebGLData` object, the dtype could only be 'float32' or\n * 'int32' and the object has to have: 1. texture, a `WebGLTexture`, the texture\n * must share the same `WebGLRenderingContext` with TFJS's WebGL backend (you\n * could create a custom WebGL backend from your texture's canvas) and the\n * internal texture format for the input texture must be floating point or\n * normalized integer; 2. height, the height of the texture; 3. width, the width\n * of the texture; 4. channels, a non-empty subset of 'RGBA', indicating the\n * values of which channels will be passed to the tensor, such as 'R' or 'BR'\n * (The order of the channels affect the order of tensor values. ). (If the\n * values passed from texture is less than the tensor size, zeros will be padded\n * at the rear.)\n * @param shape The shape of the tensor. Optional. If not provided,\n * it is inferred from `values`.\n * @param dtype The data type.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nexport function tensor(\n values: TensorLike|WebGLData, shape?: ShapeMap[R],\n dtype?: DataType): Tensor {\n const inferredShape = inferShape(values, dtype);\n return makeTensor(values, shape, inferredShape, dtype) as Tensor;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/* Type definitions for exporting and importing of models. */\n\n/**\n * A map from Tensor dtype to number of bytes per element of the Tensor.\n */\nexport const DTYPE_VALUE_SIZE_MAP: {[dtype: string]: number} = {\n 'float32': 4,\n 'float16': 2,\n 'int32': 4,\n 'uint16': 2,\n 'uint8': 1,\n 'bool': 1,\n 'complex64': 8\n};\n\n/**\n * A weight manifest.\n *\n * The weight manifest consists of an ordered list of weight-manifest groups.\n * Each weight-manifest group (\"group\" for short hereafter) consists of a\n * number of weight values stored in a number of paths.\n * See the documentation of `WeightManifestGroupConfig` below for more details.\n */\nexport declare type WeightsManifestConfig = WeightsManifestGroupConfig[];\n\n/**\n * A weight-manifest group.\n *\n * Consists of an ordered list of weight values encoded in binary format,\n * stored in an ordered list of paths.\n */\nexport declare interface WeightsManifestGroupConfig {\n /**\n * An ordered list of paths.\n *\n * Paths are intentionally abstract in order to be general. For example, they\n * can be relative URL paths or relative paths on the file system.\n */\n paths: string[];\n\n /**\n * Specifications of the weights stored in the paths.\n */\n weights: WeightsManifestEntry[];\n}\n\n/**\n * Group to which the weight belongs.\n *\n * - 'optimizer': Weight from a stateful optimizer.\n */\nexport type WeightGroup = 'model'|'optimizer';\n\n/**\n * An entry in the weight manifest.\n *\n * The entry contains specification of a weight.\n */\nexport declare interface WeightsManifestEntry {\n /**\n * Name of the weight, e.g., 'Dense_1/bias'\n */\n name: string;\n\n /**\n * Shape of the weight.\n */\n shape: number[];\n\n /**\n * Data type of the weight.\n */\n dtype: 'float32'|'int32'|'bool'|'string'|'complex64';\n\n /**\n * Type of the weight.\n *\n * Optional.\n *\n * The value 'optimizer' indicates the weight belongs to an optimizer\n * (i.e., used only during model training and not during inference).\n */\n group?: WeightGroup;\n\n /**\n * Information for dequantization of the weight.\n */\n quantization?: {\n scale?: number, // The scaling constant to multiply by.\n min?: number, // The (possibly nudged) minimum weight to add.\n dtype: 'uint16'|'uint8'|'float16' // The dtype of the quantized weights.\n };\n}\n\n/**\n * Options for saving a model.\n * @innamespace io\n */\nexport interface SaveConfig {\n /**\n * Whether to save only the trainable weights of the model, ignoring the\n * non-trainable ones.\n */\n trainableOnly?: boolean;\n\n /**\n * Whether the optimizer will be saved (if exists).\n *\n * Default: `false`.\n */\n includeOptimizer?: boolean;\n}\n\n/**\n * Result of a saving operation.\n */\nexport interface SaveResult {\n /**\n * Information about the model artifacts saved.\n */\n modelArtifactsInfo: ModelArtifactsInfo;\n\n /**\n * HTTP responses from the server that handled the model-saving request (if\n * any). This is applicable only to server-based saving routes.\n */\n responses?: Response[];\n\n /**\n * Error messages and related data (if any).\n */\n errors?: Array<{}|string>;\n}\n\nexport declare interface ModelArtifactsInfo {\n /**\n * Timestamp for when the model is saved.\n */\n dateSaved: Date;\n\n /**\n * TODO (cais,yassogba) consider removing GraphDef as GraphDefs now\n * come in a JSON format and none of our IOHandlers support a non json\n * format. We could conder replacing this with 'Binary' if we want to\n * allow future handlers to save to non json formats (though they will\n * probably want more information than 'Binary').\n * Type of the model topology\n *\n * Type of the model topology\n *\n * Possible values:\n * - JSON: JSON config (human-readable, e.g., Keras JSON).\n * - GraphDef: TensorFlow\n * [GraphDef](https://www.tensorflow.org/extend/tool_developers/#graphdef)\n * protocol buffer (binary).\n */\n modelTopologyType: 'JSON'|'GraphDef';\n\n /**\n * Size of model topology (Keras JSON or GraphDef), in bytes.\n */\n modelTopologyBytes?: number;\n\n /**\n * Size of weight specification or manifest, in bytes.\n */\n weightSpecsBytes?: number;\n\n /**\n * Size of weight value data, in bytes.\n */\n weightDataBytes?: number;\n}\n\n/** Model training configuration. */\nexport declare interface TrainingConfig {\n // TODO(cais): Tighten the typing once keras spec is available to tfjs-core.\n // See\n // tslint:disable-next-line:max-line-length\n // https://github.com/tensorflow/tfjs-layers/blob/master/src/keras_format/training_config.ts\n /** Optimizer used for the model training. */\n optimizer_config: {};\n\n // TODO(cais): Tighten the typing once keras spec is available to tfjs-core.\n /** Loss function(s) for the model's output(s). */\n loss: string|string[]|{[key: string]: string};\n\n // TODO(cais): Tighten the typing once keras spec is available to tfjs-core.\n /** Metric function(s) for the model's output(s). */\n metrics?: string[]|{[key: string]: string};\n\n // TODO(cais): Tighten the typing once keras spec is available to tfjs-core.\n weighted_metrics?: string[];\n\n // TODO(cais): Tighten the typing once keras spec is available to tfjs-core.\n sample_weight_mode?: string;\n\n loss_weights?: number[]|{[key: string]: number};\n}\n\n/**\n * The serialized artifacts of a model, including topology and weights.\n *\n * The `modelTopology`, `trainingConfig`, `weightSpecs` and `weightData` fields\n * of this interface are optional, in order to support topology- or weights-only\n * saving and loading.\n *\n * Note this interface is used internally in IOHandlers. For the file format\n * written to disk as `model.json`, see `ModelJSON`.\n */\nexport declare interface ModelArtifacts {\n /**\n * Model topology.\n *\n * For Keras-style `tf.Model`s, this is a JSON object.\n * For TensorFlow-style models (e.g., `SavedModel`), this is the JSON\n * encoding of the `GraphDef` protocol buffer.\n */\n modelTopology?: {}|ArrayBuffer;\n\n /**\n * Serialized configuration for the model's training.\n */\n trainingConfig?: TrainingConfig;\n\n /**\n * Weight specifications.\n *\n * This corresponds to the weightsData below.\n */\n weightSpecs?: WeightsManifestEntry[];\n\n /**\n * Binary buffer for all weight values concatenated in the order specified\n * by `weightSpecs`.\n */\n weightData?: ArrayBuffer;\n\n /**\n * Hard-coded format name for models saved from TensorFlow.js or converted\n * by TensorFlow.js Converter.\n */\n format?: string;\n\n /**\n * What library is responsible for originally generating this artifact.\n *\n * Used for debugging purposes. E.g., 'TensorFlow.js v1.0.0'.\n */\n generatedBy?: string;\n\n /**\n * What library or tool is responsible for converting the original model\n * to this format, applicable only if the model is output by a converter.\n *\n * Used for debugging purposes. E.g., 'TensorFlow.js Converter v1.0.0'.\n *\n * A value of `null` means the model artifacts are generated without any\n * conversion process (e.g., saved directly from a TensorFlow.js\n * `tf.LayersModel` instance.)\n */\n convertedBy?: string|null;\n\n /**\n * Inputs and outputs signature for saved model.\n */\n signature?: {};\n\n /**\n * User-defined metadata about the model.\n */\n userDefinedMetadata?: {[key: string]: {}};\n\n /**\n * Initializer for the model.\n */\n modelInitializer?: {};\n\n /**\n * Inputs and outputs signature for model initializer.\n */\n initializerSignature?: {};\n}\n\n/**\n * The on-disk format of the `model.json` file.\n *\n * TF.js 1.0 always populates the optional fields when writing model.json.\n * Prior versions did not provide those fields.\n */\nexport declare interface ModelJSON {\n /**\n * Model topology.\n *\n * For Keras-style `tf.Model`s, this is a JSON object.\n * For TensorFlow-style models (e.g., `SavedModel`), this is the JSON\n * encoding of the `GraphDef` protocol buffer.\n */\n modelTopology: {};\n\n /** Model training configuration. */\n trainingConfig?: TrainingConfig;\n\n /**\n * Weights manifest.\n *\n * The weights manifest consists of an ordered list of weight-manifest\n * groups. Each weight-manifest group consists of a number of weight values\n * stored in a number of paths. See the documentation of\n * `WeightsManifestConfig` for more details.\n */\n weightsManifest: WeightsManifestConfig;\n\n /**\n * Hard-coded format name for models saved from TensorFlow.js or converted\n * by TensorFlow.js Converter.\n */\n format?: string;\n\n /**\n * What library is responsible for originally generating this artifact.\n *\n * Used for debugging purposes. E.g., 'TensorFlow.js v1.0.0'.\n */\n generatedBy?: string;\n\n /**\n * What library or tool is responsible for converting the original model\n * to this format, applicable only if the model is output by a converter.\n *\n * Used for debugging purposes. E.g., 'TensorFlow.js Converter v1.0.0'.\n *\n * A value of `null` means the model artifacts are generated without any\n * conversion process (e.g., saved directly from a TensorFlow.js\n * `tf.LayersModel` instance.)\n */\n convertedBy?: string|null;\n\n /**\n * Inputs and outputs signature for saved model.\n */\n signature?: {};\n\n /**\n * User-defined metadata about the model.\n */\n userDefinedMetadata?: {[key: string]: {}};\n\n /**\n * Initializer for the model.\n */\n modelInitializer?: {};\n\n /**\n * Inputs and outputs signature for model initializer.\n */\n initializerSignature?: {};\n}\n\n/**\n * Type definition for handlers of loading operations.\n */\nexport type LoadHandler = () => Promise;\n\n/**\n * Type definition for handlers of saving operations.\n */\nexport type SaveHandler = (modelArtifact: ModelArtifacts) =>\n Promise;\n\n/**\n * Interface for a model import/export handler.\n *\n * The `save` and `load` handlers are both optional, in order to allow handlers\n * that support only saving or loading.\n */\n// tslint:disable-next-line:interface-name\nexport interface IOHandler {\n save?: SaveHandler;\n load?: LoadHandler;\n}\n\n/**\n * Type definition for handlers of synchronous loading operations.\n */\nexport type LoadHandlerSync = () => ModelArtifacts;\n\n/**\n * Type definition for handlers of synchronous saving operations.\n */\nexport type SaveHandlerSync = (modelArtifact: ModelArtifacts) => SaveResult;\n\n/**\n * Interface for a synchronous model import/export handler.\n *\n * The `save` and `load` handlers are both optional, in order to allow handlers\n * that support only saving or loading.\n */\n// tslint:disable-next-line:interface-name\nexport type IOHandlerSync = {\n save?: SaveHandlerSync;\n load?: LoadHandlerSync;\n};\n\n/**\n * An interface for the manager of a model store.\n *\n * A model store is defined as a storage medium on which multiple models can\n * be stored. Each stored model has a unique `path` as its identifier.\n * A `ModelStoreManager` for the store allows actions including\n *\n * - Listing the models stored in the store.\n * - Deleting a model from the store.\n */\nexport interface ModelStoreManager {\n /**\n * List all models in the model store.\n *\n * @returns A dictionary mapping paths of existing models to their\n * model artifacts info. Model artifacts info include type of the model's\n * topology, byte sizes of the topology, weights, etc.\n */\n listModels(): Promise<{[path: string]: ModelArtifactsInfo}>;\n\n /**\n * Remove a model specified by `path`.\n *\n * @param path\n * @returns ModelArtifactsInfo of the deleted model (if and only if deletion\n * is successful).\n * @throws Error if deletion fails, e.g., if no model exists at `path`.\n */\n removeModel(path: string): Promise;\n}\n\n/**\n * Callback for the progress of a long-running action such as an HTTP\n * request for a large binary object.\n *\n * `fraction` should be a number in the [0, 1] interval, indicating how\n * much of the action has completed.\n */\nexport type OnProgressCallback = (fraction: number) => void;\n\n/** @innamespace io */\nexport interface LoadOptions {\n /**\n * RequestInit (options) for HTTP requests.\n *\n * For detailed information on the supported fields, see\n * [https://developer.mozilla.org/en-US/docs/Web/API/Request/Request](\n * https://developer.mozilla.org/en-US/docs/Web/API/Request/Request)\n */\n requestInit?: RequestInit;\n\n /**\n * Progress callback.\n */\n onProgress?: OnProgressCallback;\n\n /**\n * A function used to override the `window.fetch` function.\n */\n fetchFunc?: Function;\n\n /**\n * Strict loading model: whether extraneous weights or missing\n * weights should trigger an `Error`.\n *\n * If `true`, require that the provided weights exactly match those\n * required by the layers. `false` means that both extra weights\n * and missing weights will be silently ignored.\n *\n * Default: `true`.\n */\n strict?: boolean;\n\n /**\n * Path prefix for weight files, by default this is calculated from the\n * path of the model JSON file.\n *\n * For instance, if the path to the model JSON file is\n * `http://localhost/foo/model.json`, then the default path prefix will be\n * `http://localhost/foo/`. If a weight file has the path value\n * `group1-shard1of2` in the weight manifest, then the weight file will be\n * loaded from `http://localhost/foo/group1-shard1of2` by default. However,\n * if you provide a `weightPathPrefix` value of\n * `http://localhost/foo/alt-weights`, then the weight file will be loaded\n * from the path `http://localhost/foo/alt-weights/group1-shard1of2` instead.\n */\n weightPathPrefix?: string;\n\n /**\n * Whether the module or model is to be loaded from TF Hub.\n *\n * Setting this to `true` allows passing a TF-Hub module URL, omitting the\n * standard model file name and the query parameters.\n *\n * Default: `false`.\n */\n fromTFHub?: boolean;\n\n /**\n * An async function to convert weight file name to URL. The weight file\n * names are stored in model.json's weightsManifest.paths field. By default we\n * consider weight files are colocated with the model.json file. For example:\n * model.json URL: https://www.google.com/models/1/model.json\n * group1-shard1of1.bin url:\n * https://www.google.com/models/1/group1-shard1of1.bin\n *\n * With this func you can convert the weight file name to any URL.\n */\n weightUrlConverter?: (weightFileName: string) => Promise;\n}\n\n/**\n * Additional options for Platform.fetch\n */\nexport interface RequestDetails {\n /**\n * Is this request for a binary file (as opposed to a json file)\n */\n isBinary?: boolean;\n}\n","'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n","/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nvar base64 = require('base64-js')\nvar ieee754 = require('ieee754')\nvar isArray = require('isarray')\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\n/*\n * Export kMaxLength after typed array support is determined.\n */\nexports.kMaxLength = kMaxLength()\n\nfunction typedArraySupport () {\n try {\n var arr = new Uint8Array(1)\n arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n if (kMaxLength() < length) {\n throw new RangeError('Invalid typed array length')\n }\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length)\n }\n that.length = length\n }\n\n return that\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype\n return arr\n}\n\nfunction from (that, value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(that, value, encodingOrOffset)\n }\n\n return fromObject(that, value)\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length)\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n if (typeof Symbol !== 'undefined' && Symbol.species &&\n Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n })\n }\n}\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be a number')\n } else if (size < 0) {\n throw new RangeError('\"size\" argument must not be negative')\n }\n}\n\nfunction alloc (that, size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(that, size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(that, size).fill(fill, encoding)\n : createBuffer(that, size).fill(fill)\n }\n return createBuffer(that, size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(null, size, fill, encoding)\n}\n\nfunction allocUnsafe (that, size) {\n assertSize(size)\n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < size; ++i) {\n that[i] = 0\n }\n }\n return that\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(null, size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(null, size)\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding')\n }\n\n var length = byteLength(string, encoding) | 0\n that = createBuffer(that, length)\n\n var actual = that.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n that = that.slice(0, actual)\n }\n\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0\n that = createBuffer(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array, byteOffset, length) {\n array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\\'offset\\' is out of bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\\'length\\' is out of bounds')\n }\n\n if (byteOffset === undefined && length === undefined) {\n array = new Uint8Array(array)\n } else if (length === undefined) {\n array = new Uint8Array(array, byteOffset)\n } else {\n array = new Uint8Array(array, byteOffset, length)\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = array\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromArrayLike(that, array)\n }\n return that\n}\n\nfunction fromObject (that, obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0\n that = createBuffer(that, len)\n\n if (that.length === 0) {\n return that\n }\n\n obj.copy(that, 0, 0, len)\n return that\n }\n\n if (obj) {\n if ((typeof ArrayBuffer !== 'undefined' &&\n obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n if (typeof obj.length !== 'number' || isnan(obj.length)) {\n return createBuffer(that, 0)\n }\n return fromArrayLike(that, obj)\n }\n\n if (obj.type === 'Buffer' && isArray(obj.data)) {\n return fromArrayLike(that, obj.data)\n }\n }\n\n throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength()` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n var buffer = Buffer.allocUnsafe(length)\n var pos = 0\n for (i = 0; i < list.length; ++i) {\n var buf = list[i]\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n buf.copy(buffer, pos)\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n string = '' + string\n }\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n case undefined:\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n var i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n var len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n var len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n var len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return ''\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (!Buffer.isBuffer(target)) {\n throw new TypeError('Argument must be a Buffer')\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart\n var y = end - start\n var len = Math.min(x, y)\n\n var thisCopy = this.slice(thisStart, thisEnd)\n var targetCopy = target.slice(start, end)\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (isNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (Buffer.TYPED_ARRAY_SUPPORT &&\n typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1\n var arrLength = arr.length\n var valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i\n if (dir) {\n var foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n var found = true\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end)\n newBuf.__proto__ = Buffer.prototype\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; ++i) {\n newBuf[i] = this[i + start]\n }\n }\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; ++i) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, start + len),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0)\n if (code < 256) {\n val = code\n }\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n } else if (typeof val === 'number') {\n val = val & 255\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n var i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n var bytes = Buffer.isBuffer(val)\n ? val\n : utf8ToBytes(new Buffer(val, encoding).toString())\n var len = bytes.length\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\nfunction isnan (val) {\n return val !== val // eslint-disable-line no-self-compare\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {complex} from '../ops/complex';\nimport {tensor} from '../ops/tensor';\nimport {NamedTensor, NamedTensorMap} from '../tensor_types';\nimport {TypedArray} from '../types';\nimport {sizeFromShape} from '../util';\n\nimport {DTYPE_VALUE_SIZE_MAP, ModelArtifacts, ModelArtifactsInfo, ModelJSON, WeightGroup, WeightsManifestConfig, WeightsManifestEntry} from './types';\n\n/** Number of bytes reserved for the length of the string. (32bit integer). */\nconst NUM_BYTES_STRING_LENGTH = 4;\n\n/**\n * Encode a map from names to weight values as an ArrayBuffer, along with an\n * `Array` of `WeightsManifestEntry` as specification of the encoded weights.\n *\n * This function does not perform sharding.\n *\n * This function is the reverse of `decodeWeights`.\n *\n * @param tensors A map (\"dict\") from names to tensors.\n * @param group Group to which the weights belong (optional).\n * @returns A `Promise` of\n * - A flat `ArrayBuffer` with all the binary values of the `Tensor`s\n * concatenated.\n * - An `Array` of `WeightManifestEntry`s, carrying information including\n * tensor names, `dtype`s and shapes.\n * @throws Error: on unsupported tensor `dtype`.\n */\nexport async function encodeWeights(\n tensors: NamedTensorMap|NamedTensor[], group?: WeightGroup):\n Promise<{data: ArrayBuffer, specs: WeightsManifestEntry[]}> {\n // TODO(adarob, cais): Support quantization.\n const specs: WeightsManifestEntry[] = [];\n const dataPromises: Array> = [];\n\n const names: string[] = Array.isArray(tensors) ?\n tensors.map(tensor => tensor.name) :\n Object.keys(tensors);\n\n for (let i = 0; i < names.length; ++i) {\n const name = names[i];\n const t = Array.isArray(tensors) ? tensors[i].tensor : tensors[name];\n if (t.dtype !== 'float32' && t.dtype !== 'int32' && t.dtype !== 'bool' &&\n t.dtype !== 'string' && t.dtype !== 'complex64') {\n throw new Error(`Unsupported dtype in weight '${name}': ${t.dtype}`);\n }\n const spec: WeightsManifestEntry = {name, shape: t.shape, dtype: t.dtype};\n if (t.dtype === 'string') {\n const utf8bytes = new Promise(async resolve => {\n const vals = await t.bytes() as Uint8Array[];\n const totalNumBytes = vals.reduce((p, c) => p + c.length, 0) +\n NUM_BYTES_STRING_LENGTH * vals.length;\n const bytes = new Uint8Array(totalNumBytes);\n let offset = 0;\n for (let i = 0; i < vals.length; i++) {\n const val = vals[i];\n const bytesOfLength =\n new Uint8Array(new Uint32Array([val.length]).buffer);\n bytes.set(bytesOfLength, offset);\n offset += NUM_BYTES_STRING_LENGTH;\n bytes.set(val, offset);\n offset += val.length;\n }\n resolve(bytes);\n });\n dataPromises.push(utf8bytes);\n } else {\n dataPromises.push(t.data());\n }\n if (group != null) {\n spec.group = group;\n }\n specs.push(spec);\n }\n\n const tensorValues = await Promise.all(dataPromises);\n return {data: concatenateTypedArrays(tensorValues), specs};\n}\n\n/**\n * Decode flat ArrayBuffer as weights.\n *\n * This function does not handle sharding.\n *\n * This function is the reverse of `encodeWeights`.\n *\n * @param buffer A flat ArrayBuffer carrying the binary values of the tensors\n * concatenated in the order specified in `specs`.\n * @param specs Specifications of the names, dtypes and shapes of the tensors\n * whose value are encoded by `buffer`.\n * @return A map from tensor name to tensor value, with the names corresponding\n * to names in `specs`.\n * @throws Error, if any of the tensors has unsupported dtype.\n */\nexport function decodeWeights(\n buffer: ArrayBuffer, specs: WeightsManifestEntry[]): NamedTensorMap {\n // TODO(adarob, cais): Support quantization.\n const out: NamedTensorMap = {};\n let float16Decode: (buffer: Uint16Array) => Float32Array | undefined;\n let offset = 0;\n for (const spec of specs) {\n const name = spec.name;\n const dtype = spec.dtype;\n const shape = spec.shape;\n const size = sizeFromShape(shape);\n let values: TypedArray|string[]|Uint8Array[];\n\n if ('quantization' in spec) {\n const quantization = spec.quantization;\n if (quantization.dtype === 'uint8' || quantization.dtype === 'uint16') {\n if (!('min' in quantization && 'scale' in quantization)) {\n throw new Error(\n `Weight ${spec.name} with quantization ${quantization.dtype} ` +\n `doesn't have corresponding metadata min and scale.`);\n }\n } else if (quantization.dtype === 'float16') {\n if (dtype !== 'float32') {\n throw new Error(\n `Weight ${spec.name} is quantized with ${quantization.dtype} ` +\n `which only supports weights of type float32 not ${dtype}.`);\n }\n } else {\n throw new Error(\n `Weight ${spec.name} has unknown ` +\n `quantization dtype ${quantization.dtype}. ` +\n `Supported quantization dtypes are: ` +\n `'uint8', 'uint16', and 'float16'.`);\n }\n const quantizationSizeFactor = DTYPE_VALUE_SIZE_MAP[quantization.dtype];\n const byteBuffer =\n buffer.slice(offset, offset + size * quantizationSizeFactor);\n const quantizedArray = (quantization.dtype === 'uint8') ?\n new Uint8Array(byteBuffer) :\n new Uint16Array(byteBuffer);\n if (dtype === 'float32') {\n if (quantization.dtype === 'uint8' || quantization.dtype === 'uint16') {\n values = new Float32Array(quantizedArray.length);\n for (let i = 0; i < quantizedArray.length; i++) {\n const v = quantizedArray[i];\n values[i] = v * quantization.scale + quantization.min;\n }\n } else if (quantization.dtype === 'float16') {\n if (float16Decode === undefined) {\n float16Decode = getFloat16Decoder();\n }\n values = float16Decode(quantizedArray as Uint16Array);\n } else {\n throw new Error(\n `Unsupported quantization type ${quantization.dtype} ` +\n `for weight type float32.`);\n }\n } else if (dtype === 'int32') {\n if (quantization.dtype !== 'uint8' && quantization.dtype !== 'uint16') {\n throw new Error(\n `Unsupported quantization type ${quantization.dtype} ` +\n `for weight type int32.`);\n }\n values = new Int32Array(quantizedArray.length);\n for (let i = 0; i < quantizedArray.length; i++) {\n const v = quantizedArray[i];\n values[i] = Math.round(v * quantization.scale + quantization.min);\n }\n } else {\n throw new Error(`Unsupported dtype in weight '${name}': ${dtype}`);\n }\n offset += size * quantizationSizeFactor;\n } else if (dtype === 'string') {\n const size = sizeFromShape(spec.shape);\n values = [];\n for (let i = 0; i < size; i++) {\n const byteLength = new Uint32Array(\n buffer.slice(offset, offset + NUM_BYTES_STRING_LENGTH))[0];\n offset += NUM_BYTES_STRING_LENGTH;\n const bytes = new Uint8Array(buffer.slice(offset, offset + byteLength));\n (values as Uint8Array[]).push(bytes);\n offset += byteLength;\n }\n } else {\n const dtypeFactor = DTYPE_VALUE_SIZE_MAP[dtype];\n const byteBuffer = buffer.slice(offset, offset + size * dtypeFactor);\n\n if (dtype === 'float32') {\n values = new Float32Array(byteBuffer);\n } else if (dtype === 'int32') {\n values = new Int32Array(byteBuffer);\n } else if (dtype === 'bool') {\n values = new Uint8Array(byteBuffer);\n } else if (dtype === 'complex64') {\n values = new Float32Array(byteBuffer);\n const real = new Float32Array(values.length / 2);\n const image = new Float32Array(values.length / 2);\n for (let i = 0; i < real.length; i++) {\n real[i] = values[i * 2];\n image[i] = values[i * 2 + 1];\n }\n const realTensor = tensor(real, shape, 'float32');\n const imageTensor = tensor(image, shape, 'float32');\n out[name] = complex(realTensor, imageTensor);\n realTensor.dispose();\n imageTensor.dispose();\n } else {\n throw new Error(`Unsupported dtype in weight '${name}': ${dtype}`);\n }\n offset += size * dtypeFactor;\n }\n if (dtype !== 'complex64') {\n out[name] = tensor(values, shape, dtype);\n }\n }\n return out;\n}\n\n/**\n * Concatenate TypedArrays into an ArrayBuffer.\n */\nexport function concatenateTypedArrays(xs: TypedArray[]): ArrayBuffer {\n // TODO(adarob, cais): Support quantization.\n if (xs === null) {\n throw new Error(`Invalid input value: ${JSON.stringify(xs)}`);\n }\n\n let totalByteLength = 0;\n\n // `normalizedXs` is here for this reason: a `TypedArray`'s `buffer'\n // can have a different byte length from that of the `TypedArray` itself,\n // for example, when the `TypedArray` is created from an offset in an\n // `ArrayBuffer`. `normliazedXs` holds `TypedArray`s whose `buffer`s match\n // the `TypedArray` in byte length. If an element of `xs` does not show\n // this property, a new `TypedArray` that satisfy this property will be\n // constructed and pushed into `normalizedXs`.\n const normalizedXs: TypedArray[] = [];\n xs.forEach((x: TypedArray) => {\n totalByteLength += x.byteLength;\n // tslint:disable:no-any\n normalizedXs.push(\n x.byteLength === x.buffer.byteLength ? x :\n new (x.constructor as any)(x));\n if (!(x as any instanceof Float32Array || x as any instanceof Int32Array ||\n x as any instanceof Uint8Array)) {\n throw new Error(`Unsupported TypedArray subtype: ${x.constructor.name}`);\n }\n // tslint:enable:no-any\n });\n\n const y = new Uint8Array(totalByteLength);\n let offset = 0;\n normalizedXs.forEach((x: TypedArray) => {\n y.set(new Uint8Array(x.buffer), offset);\n offset += x.byteLength;\n });\n\n return y.buffer;\n}\n\n// Use Buffer on Node.js instead of Blob/atob/btoa\nconst useNodeBuffer = typeof Buffer !== 'undefined' &&\n (typeof Blob === 'undefined' || typeof atob === 'undefined' ||\n typeof btoa === 'undefined');\n\n/**\n * Calculate the byte length of a JavaScript string.\n *\n * Note that a JavaScript string can contain wide characters, therefore the\n * length of the string is not necessarily equal to the byte length.\n *\n * @param str Input string.\n * @returns Byte length.\n */\nexport function stringByteLength(str: string): number {\n if (useNodeBuffer) {\n return Buffer.byteLength(str);\n }\n return new Blob([str]).size;\n}\n\n/**\n * Encode an ArrayBuffer as a base64 encoded string.\n *\n * @param buffer `ArrayBuffer` to be converted.\n * @returns A string that base64-encodes `buffer`.\n */\nexport function arrayBufferToBase64String(buffer: ArrayBuffer): string {\n if (useNodeBuffer) {\n return Buffer.from(buffer).toString('base64');\n }\n const buf = new Uint8Array(buffer);\n let s = '';\n for (let i = 0, l = buf.length; i < l; i++) {\n s += String.fromCharCode(buf[i]);\n }\n return btoa(s);\n}\n\n/**\n * Decode a base64 string as an ArrayBuffer.\n *\n * @param str Base64 string.\n * @returns Decoded `ArrayBuffer`.\n */\nexport function base64StringToArrayBuffer(str: string): ArrayBuffer {\n if (useNodeBuffer) {\n const buf = Buffer.from(str, 'base64');\n return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);\n }\n const s = atob(str);\n const buffer = new Uint8Array(s.length);\n for (let i = 0; i < s.length; ++i) {\n buffer.set([s.charCodeAt(i)], i);\n }\n return buffer.buffer;\n}\n\n/**\n * Concatenate a number of ArrayBuffers into one.\n *\n * @param buffers A number of array buffers to concatenate.\n * @returns Result of concatenating `buffers` in order.\n */\nexport function concatenateArrayBuffers(buffers: ArrayBuffer[]): ArrayBuffer {\n if (buffers.length === 1) {\n return buffers[0];\n }\n\n let totalByteLength = 0;\n buffers.forEach((buffer: ArrayBuffer) => {\n totalByteLength += buffer.byteLength;\n });\n\n const temp = new Uint8Array(totalByteLength);\n let offset = 0;\n buffers.forEach((buffer: ArrayBuffer) => {\n temp.set(new Uint8Array(buffer), offset);\n offset += buffer.byteLength;\n });\n return temp.buffer;\n}\n\n/**\n * Get the basename of a path.\n *\n * Behaves in a way analogous to Linux's basename command.\n *\n * @param path\n */\nexport function basename(path: string): string {\n const SEPARATOR = '/';\n path = path.trim();\n while (path.endsWith(SEPARATOR)) {\n path = path.slice(0, path.length - 1);\n }\n const items = path.split(SEPARATOR);\n return items[items.length - 1];\n}\n\n/**\n * Create `ModelJSON` from `ModelArtifacts`.\n *\n * @param artifacts Model artifacts, describing the model and its weights.\n * @param manifest Weight manifest, describing where the weights of the\n * `ModelArtifacts` are stored, and some metadata about them.\n * @returns Object representing the `model.json` file describing the model\n * artifacts and weights\n */\nexport function getModelJSONForModelArtifacts(\n artifacts: ModelArtifacts, manifest: WeightsManifestConfig): ModelJSON {\n const result: ModelJSON = {\n modelTopology: artifacts.modelTopology,\n format: artifacts.format,\n generatedBy: artifacts.generatedBy,\n convertedBy: artifacts.convertedBy,\n weightsManifest: manifest\n };\n if (artifacts.signature != null) {\n result.signature = artifacts.signature;\n }\n if (artifacts.userDefinedMetadata != null) {\n result.userDefinedMetadata = artifacts.userDefinedMetadata;\n }\n if (artifacts.modelInitializer != null) {\n result.modelInitializer = artifacts.modelInitializer;\n }\n if (artifacts.initializerSignature != null) {\n result.initializerSignature = artifacts.initializerSignature;\n }\n if (artifacts.trainingConfig != null) {\n result.trainingConfig = artifacts.trainingConfig;\n }\n return result;\n}\n\n/**\n * Create `ModelArtifacts` from a JSON file and weights.\n *\n * @param modelJSON Object containing the parsed JSON of `model.json`\n * @param weightSpecs The list of WeightsManifestEntry for the model. Must be\n * passed if the modelJSON has a weightsManifest.\n * @param weightData An ArrayBuffer of weight data for the model corresponding\n * to the weights in weightSpecs. Must be passed if the modelJSON has a\n * weightsManifest.\n * @returns A Promise of the `ModelArtifacts`, as described by the JSON file.\n */\nexport function getModelArtifactsForJSONSync(\n modelJSON: ModelJSON, weightSpecs?: WeightsManifestEntry[],\n weightData?: ArrayBuffer): ModelArtifacts {\n\n const modelArtifacts: ModelArtifacts = {\n modelTopology: modelJSON.modelTopology,\n format: modelJSON.format,\n generatedBy: modelJSON.generatedBy,\n convertedBy: modelJSON.convertedBy\n };\n\n if (modelJSON.trainingConfig != null) {\n modelArtifacts.trainingConfig = modelJSON.trainingConfig;\n }\n if (modelJSON.weightsManifest != null) {\n if (!weightSpecs) {\n throw new Error('modelJSON has weightsManifest but weightSpecs is null');\n }\n if (!weightData) {\n throw new Error('modelJSON has weightsManifest but weightData is null');\n }\n modelArtifacts.weightSpecs = weightSpecs;\n modelArtifacts.weightData = weightData;\n }\n if (modelJSON.signature != null) {\n modelArtifacts.signature = modelJSON.signature;\n }\n if (modelJSON.userDefinedMetadata != null) {\n modelArtifacts.userDefinedMetadata = modelJSON.userDefinedMetadata;\n }\n if (modelJSON.modelInitializer != null) {\n modelArtifacts.modelInitializer = modelJSON.modelInitializer;\n }\n if (modelJSON.initializerSignature != null) {\n modelArtifacts.initializerSignature = modelJSON.initializerSignature;\n }\n\n return modelArtifacts;\n}\n\n/**\n * Create `ModelArtifacts` from a JSON file.\n *\n * @param modelJSON Object containing the parsed JSON of `model.json`\n * @param loadWeights Function that takes the JSON file's weights manifest,\n * reads weights from the listed path(s), and returns a Promise of the\n * weight manifest entries along with the weights data.\n * @returns A Promise of the `ModelArtifacts`, as described by the JSON file.\n */\nexport async function getModelArtifactsForJSON(\n modelJSON: ModelJSON,\n loadWeights: (weightsManifest: WeightsManifestConfig) => Promise<[\n /* weightSpecs */ WeightsManifestEntry[], /* weightData */ ArrayBuffer\n ]>): Promise {\n let weightSpecs: WeightsManifestEntry[] | undefined;\n let weightData: ArrayBuffer | undefined;\n\n if (modelJSON.weightsManifest != null) {\n [weightSpecs, weightData] = await loadWeights(modelJSON.weightsManifest);\n }\n\n return getModelArtifactsForJSONSync(modelJSON, weightSpecs, weightData);\n}\n\n/**\n * Populate ModelArtifactsInfo fields for a model with JSON topology.\n * @param modelArtifacts\n * @returns A ModelArtifactsInfo object.\n */\nexport function getModelArtifactsInfoForJSON(modelArtifacts: ModelArtifacts):\n ModelArtifactsInfo {\n if (modelArtifacts.modelTopology instanceof ArrayBuffer) {\n throw new Error('Expected JSON model topology, received ArrayBuffer.');\n }\n\n return {\n dateSaved: new Date(),\n modelTopologyType: 'JSON',\n modelTopologyBytes: modelArtifacts.modelTopology == null ?\n 0 :\n stringByteLength(JSON.stringify(modelArtifacts.modelTopology)),\n weightSpecsBytes: modelArtifacts.weightSpecs == null ?\n 0 :\n stringByteLength(JSON.stringify(modelArtifacts.weightSpecs)),\n weightDataBytes: modelArtifacts.weightData == null ?\n 0 :\n modelArtifacts.weightData.byteLength,\n };\n}\n\n/**\n * Concatenate the weights stored in a WeightsManifestConfig into a list of\n * WeightsManifestEntry\n *\n * @param weightsManifest The WeightsManifestConfig to extract weights from.\n * @returns A list of WeightsManifestEntry of the weights in the weightsManifest\n */\nexport function getWeightSpecs(weightsManifest: WeightsManifestConfig):\n WeightsManifestEntry[] {\n const weightSpecs: WeightsManifestEntry[] = [];\n for (const entry of weightsManifest) {\n weightSpecs.push(...entry.weights);\n }\n return weightSpecs;\n}\n\n/**\n * Computes mantisa table for casting Float16 to Float32\n * See http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf\n *\n * @returns Uint32Array, 2048 mantissa lookup values.\n */\nfunction computeFloat16MantisaTable(): Uint32Array {\n const convertMantissa = (i: number): number => {\n let m = i << 13;\n let e = 0;\n\n while ((m & 0x00800000) === 0) {\n e -= 0x00800000;\n m <<= 1;\n }\n m &= ~0x00800000;\n e += 0x38800000;\n\n return m | e;\n };\n\n const mantisaTable = new Uint32Array(2048);\n\n mantisaTable[0] = 0;\n for (let i = 1; i < 1024; i++) {\n mantisaTable[i] = convertMantissa(i);\n }\n for (let i = 1024; i < 2048; i++) {\n mantisaTable[i] = 0x38000000 + ((i - 1024) << 13);\n }\n\n return mantisaTable;\n}\n\n/**\n * Computes exponent table for casting Float16 to Float32\n * See http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf\n *\n * @returns Uint32Array, 64 exponent lookup values.\n */\nfunction computeFloat16ExponentTable(): Uint32Array {\n const exponentTable = new Uint32Array(64);\n\n exponentTable[0] = 0;\n exponentTable[31] = 0x47800000;\n exponentTable[32] = 0x80000000;\n exponentTable[63] = 0xc7800000;\n for (let i = 1; i < 31; i++) {\n exponentTable[i] = i << 23;\n }\n for (let i = 33; i < 63; i++) {\n exponentTable[i] = 0x80000000 + ((i - 32) << 23);\n }\n\n return exponentTable;\n}\n\n/**\n * Computes offset table for casting Float16 to Float32\n * See http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf\n *\n * @returns Uint32Array, 6d offset values.\n */\nfunction computeFloat16OffsetTable(): Uint32Array {\n const offsetTable = new Uint32Array(64);\n\n for (let i = 0; i < 64; i++) {\n offsetTable[i] = 1024;\n }\n offsetTable[0] = offsetTable[32] = 0;\n\n return offsetTable;\n}\n\n/**\n * Retrieve a Float16 decoder which will decode a ByteArray of Float16 values\n * to a Float32Array.\n *\n * @returns Function (buffer: Uint16Array) => Float32Array which decodes\n * the Uint16Array of Float16 bytes to a Float32Array.\n */\nexport function getFloat16Decoder(): (buffer: Uint16Array) => Float32Array {\n // Algorithm is based off of\n // http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf\n\n // Cache lookup tables\n const mantisaTable = computeFloat16MantisaTable();\n const exponentTable = computeFloat16ExponentTable();\n const offsetTable = computeFloat16OffsetTable();\n\n return (quantizedArray: Uint16Array) => {\n const buffer = new ArrayBuffer(4 * quantizedArray.length);\n const bufferUint32View = new Uint32Array(buffer);\n for (let index = 0; index < quantizedArray.length; index++) {\n const float16Bits = quantizedArray[index];\n const float32Bits =\n mantisaTable[offsetTable[float16Bits >> 10] + (float16Bits & 0x3ff)] +\n exponentTable[float16Bits >> 10];\n bufferUint32View[index] = float32Bits;\n }\n return new Float32Array(buffer);\n };\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {IOHandler, LoadOptions} from './types';\n\nexport type IORouter = (url: string|string[], loadOptions?: LoadOptions) =>\n IOHandler;\n\nexport class IORouterRegistry {\n // Singleton instance.\n private static instance: IORouterRegistry;\n\n private saveRouters: IORouter[];\n private loadRouters: IORouter[];\n\n private constructor() {\n this.saveRouters = [];\n this.loadRouters = [];\n }\n\n private static getInstance(): IORouterRegistry {\n if (IORouterRegistry.instance == null) {\n IORouterRegistry.instance = new IORouterRegistry();\n }\n return IORouterRegistry.instance;\n }\n\n /**\n * Register a save-handler router.\n *\n * @param saveRouter A function that maps a URL-like string onto an instance\n * of `IOHandler` with the `save` method defined or `null`.\n */\n static registerSaveRouter(saveRouter: IORouter) {\n IORouterRegistry.getInstance().saveRouters.push(saveRouter);\n }\n\n /**\n * Register a load-handler router.\n *\n * @param loadRouter A function that maps a URL-like string onto an instance\n * of `IOHandler` with the `load` method defined or `null`.\n */\n static registerLoadRouter(loadRouter: IORouter) {\n IORouterRegistry.getInstance().loadRouters.push(loadRouter);\n }\n\n /**\n * Look up IOHandler for saving, given a URL-like string.\n *\n * @param url\n * @returns If only one match is found, an instance of IOHandler with the\n * `save` method defined. If no match is found, `null`.\n * @throws Error, if more than one match is found.\n */\n static getSaveHandlers(url: string|string[]): IOHandler[] {\n return IORouterRegistry.getHandlers(url, 'save');\n }\n\n /**\n * Look up IOHandler for loading, given a URL-like string.\n *\n * @param url\n * @param loadOptions Optional, custom load options.\n * @returns All valid handlers for `url`, given the currently registered\n * handler routers.\n */\n static getLoadHandlers(url: string|string[], loadOptions?: LoadOptions):\n IOHandler[] {\n return IORouterRegistry.getHandlers(url, 'load', loadOptions);\n }\n\n private static getHandlers(\n url: string|string[], handlerType: 'save'|'load',\n loadOptions?: LoadOptions): IOHandler[] {\n const validHandlers: IOHandler[] = [];\n const routers = handlerType === 'load' ?\n IORouterRegistry.getInstance().loadRouters :\n IORouterRegistry.getInstance().saveRouters;\n routers.forEach(router => {\n const handler = router(url, loadOptions);\n if (handler !== null) {\n validHandlers.push(handler);\n }\n });\n return validHandlers;\n }\n}\n\nexport const registerSaveRouter = (loudRouter: IORouter) =>\n IORouterRegistry.registerSaveRouter(loudRouter);\nexport const registerLoadRouter = (loudRouter: IORouter) =>\n IORouterRegistry.registerLoadRouter(loudRouter);\nexport const getSaveHandlers = (url: string|string[]) =>\n IORouterRegistry.getSaveHandlers(url);\nexport const getLoadHandlers =\n (url: string|string[], loadOptions?: LoadOptions) =>\n IORouterRegistry.getLoadHandlers(url, loadOptions);\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport '../flags';\n\nimport {env} from '../environment';\n\nimport {getModelArtifactsInfoForJSON} from './io_utils';\nimport {IORouter, IORouterRegistry} from './router_registry';\nimport {IOHandler, ModelArtifacts, ModelArtifactsInfo, ModelStoreManager, SaveResult} from './types';\n\nconst DATABASE_NAME = 'tensorflowjs';\nconst DATABASE_VERSION = 1;\n\n// Model data and ModelArtifactsInfo (metadata) are stored in two separate\n// stores for efficient access of the list of stored models and their metadata.\n// 1. The object store for model data: topology, weights and weight manifests.\nconst MODEL_STORE_NAME = 'models_store';\n// 2. The object store for ModelArtifactsInfo, including meta-information such\n// as the type of topology (JSON vs binary), byte size of the topology, byte\n// size of the weights, etc.\nconst INFO_STORE_NAME = 'model_info_store';\n\n/**\n * Delete the entire database for tensorflow.js, including the models store.\n */\nexport async function deleteDatabase(): Promise {\n const idbFactory = getIndexedDBFactory();\n\n return new Promise((resolve, reject) => {\n const deleteRequest = idbFactory.deleteDatabase(DATABASE_NAME);\n deleteRequest.onsuccess = () => resolve();\n deleteRequest.onerror = error => reject(error);\n });\n}\n\nfunction getIndexedDBFactory(): IDBFactory {\n if (!env().getBool('IS_BROWSER')) {\n // TODO(cais): Add more info about what IOHandler subtypes are available.\n // Maybe point to a doc page on the web and/or automatically determine\n // the available IOHandlers and print them in the error message.\n throw new Error(\n 'Failed to obtain IndexedDB factory because the current environment' +\n 'is not a web browser.');\n }\n // tslint:disable-next-line:no-any\n const theWindow: any = typeof window === 'undefined' ? self : window;\n const factory = theWindow.indexedDB || theWindow.mozIndexedDB ||\n theWindow.webkitIndexedDB || theWindow.msIndexedDB ||\n theWindow.shimIndexedDB;\n if (factory == null) {\n throw new Error(\n 'The current browser does not appear to support IndexedDB.');\n }\n return factory;\n}\n\nfunction setUpDatabase(openRequest: IDBRequest) {\n const db = openRequest.result as IDBDatabase;\n db.createObjectStore(MODEL_STORE_NAME, {keyPath: 'modelPath'});\n db.createObjectStore(INFO_STORE_NAME, {keyPath: 'modelPath'});\n}\n\n/**\n * IOHandler subclass: Browser IndexedDB.\n *\n * See the doc string of `browserIndexedDB` for more details.\n */\nexport class BrowserIndexedDB implements IOHandler {\n protected readonly indexedDB: IDBFactory;\n protected readonly modelPath: string;\n\n static readonly URL_SCHEME = 'indexeddb://';\n\n constructor(modelPath: string) {\n this.indexedDB = getIndexedDBFactory();\n\n if (modelPath == null || !modelPath) {\n throw new Error(\n 'For IndexedDB, modelPath must not be null, undefined or empty.');\n }\n this.modelPath = modelPath;\n }\n\n async save(modelArtifacts: ModelArtifacts): Promise {\n // TODO(cais): Support saving GraphDef models.\n if (modelArtifacts.modelTopology instanceof ArrayBuffer) {\n throw new Error(\n 'BrowserLocalStorage.save() does not support saving model topology ' +\n 'in binary formats yet.');\n }\n\n return this.databaseAction(this.modelPath, modelArtifacts) as\n Promise;\n }\n\n async load(): Promise {\n return this.databaseAction(this.modelPath) as Promise;\n }\n\n /**\n * Perform database action to put model artifacts into or read model artifacts\n * from IndexedDB object store.\n *\n * Whether the action is put or get depends on whether `modelArtifacts` is\n * specified. If it is specified, the action will be put; otherwise the action\n * will be get.\n *\n * @param modelPath A unique string path for the model.\n * @param modelArtifacts If specified, it will be the model artifacts to be\n * stored in IndexedDB.\n * @returns A `Promise` of `SaveResult`, if the action is put, or a `Promise`\n * of `ModelArtifacts`, if the action is get.\n */\n private databaseAction(modelPath: string, modelArtifacts?: ModelArtifacts):\n Promise {\n return new Promise((resolve, reject) => {\n const openRequest = this.indexedDB.open(DATABASE_NAME, DATABASE_VERSION);\n openRequest.onupgradeneeded = () => setUpDatabase(openRequest);\n\n openRequest.onsuccess = () => {\n const db = openRequest.result;\n\n if (modelArtifacts == null) {\n // Read model out from object store.\n const modelTx = db.transaction(MODEL_STORE_NAME, 'readonly');\n const modelStore = modelTx.objectStore(MODEL_STORE_NAME);\n const getRequest = modelStore.get(this.modelPath);\n getRequest.onsuccess = () => {\n if (getRequest.result == null) {\n db.close();\n return reject(new Error(\n `Cannot find model with path '${this.modelPath}' ` +\n `in IndexedDB.`));\n } else {\n resolve(getRequest.result.modelArtifacts);\n }\n };\n getRequest.onerror = error => {\n db.close();\n return reject(getRequest.error);\n };\n modelTx.oncomplete = () => db.close();\n } else {\n // Put model into object store.\n const modelArtifactsInfo: ModelArtifactsInfo =\n getModelArtifactsInfoForJSON(modelArtifacts);\n // First, put ModelArtifactsInfo into info store.\n const infoTx = db.transaction(INFO_STORE_NAME, 'readwrite');\n let infoStore = infoTx.objectStore(INFO_STORE_NAME);\n const putInfoRequest =\n infoStore.put({modelPath: this.modelPath, modelArtifactsInfo});\n let modelTx: IDBTransaction;\n putInfoRequest.onsuccess = () => {\n // Second, put model data into model store.\n modelTx = db.transaction(MODEL_STORE_NAME, 'readwrite');\n const modelStore = modelTx.objectStore(MODEL_STORE_NAME);\n const putModelRequest = modelStore.put({\n modelPath: this.modelPath,\n modelArtifacts,\n modelArtifactsInfo\n });\n putModelRequest.onsuccess = () => resolve({modelArtifactsInfo});\n putModelRequest.onerror = error => {\n // If the put-model request fails, roll back the info entry as\n // well.\n infoStore = infoTx.objectStore(INFO_STORE_NAME);\n const deleteInfoRequest = infoStore.delete(this.modelPath);\n deleteInfoRequest.onsuccess = () => {\n db.close();\n return reject(putModelRequest.error);\n };\n deleteInfoRequest.onerror = error => {\n db.close();\n return reject(putModelRequest.error);\n };\n };\n };\n putInfoRequest.onerror = error => {\n db.close();\n return reject(putInfoRequest.error);\n };\n infoTx.oncomplete = () => {\n if (modelTx == null) {\n db.close();\n } else {\n modelTx.oncomplete = () => db.close();\n }\n };\n }\n };\n openRequest.onerror = error => reject(openRequest.error);\n });\n }\n}\n\nexport const indexedDBRouter: IORouter = (url: string|string[]) => {\n if (!env().getBool('IS_BROWSER')) {\n return null;\n } else {\n if (!Array.isArray(url) && url.startsWith(BrowserIndexedDB.URL_SCHEME)) {\n return browserIndexedDB(url.slice(BrowserIndexedDB.URL_SCHEME.length));\n } else {\n return null;\n }\n }\n};\nIORouterRegistry.registerSaveRouter(indexedDBRouter);\nIORouterRegistry.registerLoadRouter(indexedDBRouter);\n\n/**\n * Creates a browser IndexedDB IOHandler for saving and loading models.\n *\n * ```js\n * const model = tf.sequential();\n * model.add(\n * tf.layers.dense({units: 1, inputShape: [100], activation: 'sigmoid'}));\n *\n * const saveResult = await model.save('indexeddb://MyModel'));\n * console.log(saveResult);\n * ```\n *\n * @param modelPath A unique identifier for the model to be saved. Must be a\n * non-empty string.\n * @returns An instance of `BrowserIndexedDB` (sublcass of `IOHandler`),\n * which can be used with, e.g., `tf.Model.save`.\n */\nexport function browserIndexedDB(modelPath: string): IOHandler {\n return new BrowserIndexedDB(modelPath);\n}\n\nfunction maybeStripScheme(key: string) {\n return key.startsWith(BrowserIndexedDB.URL_SCHEME) ?\n key.slice(BrowserIndexedDB.URL_SCHEME.length) :\n key;\n}\n\nexport class BrowserIndexedDBManager implements ModelStoreManager {\n private indexedDB: IDBFactory;\n\n constructor() {\n this.indexedDB = getIndexedDBFactory();\n }\n\n async listModels(): Promise<{[path: string]: ModelArtifactsInfo}> {\n return new Promise<{[path: string]: ModelArtifactsInfo}>(\n (resolve, reject) => {\n const openRequest =\n this.indexedDB.open(DATABASE_NAME, DATABASE_VERSION);\n openRequest.onupgradeneeded = () => setUpDatabase(openRequest);\n\n openRequest.onsuccess = () => {\n const db = openRequest.result;\n const tx = db.transaction(INFO_STORE_NAME, 'readonly');\n const store = tx.objectStore(INFO_STORE_NAME);\n // tslint:disable:max-line-length\n // Need to cast `store` as `any` here because TypeScript's DOM\n // library does not have the `getAll()` method even though the\n // method is supported in the latest version of most mainstream\n // browsers:\n // https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/getAll\n // tslint:enable:max-line-length\n // tslint:disable-next-line:no-any\n const getAllInfoRequest = (store as any).getAll() as IDBRequest;\n getAllInfoRequest.onsuccess = () => {\n const out: {[path: string]: ModelArtifactsInfo} = {};\n for (const item of getAllInfoRequest.result) {\n out[item.modelPath] = item.modelArtifactsInfo;\n }\n resolve(out);\n };\n getAllInfoRequest.onerror = error => {\n db.close();\n return reject(getAllInfoRequest.error);\n };\n tx.oncomplete = () => db.close();\n };\n openRequest.onerror = error => reject(openRequest.error);\n });\n }\n\n async removeModel(path: string): Promise {\n path = maybeStripScheme(path);\n return new Promise((resolve, reject) => {\n const openRequest = this.indexedDB.open(DATABASE_NAME, DATABASE_VERSION);\n openRequest.onupgradeneeded = () => setUpDatabase(openRequest);\n\n openRequest.onsuccess = () => {\n const db = openRequest.result;\n const infoTx = db.transaction(INFO_STORE_NAME, 'readwrite');\n const infoStore = infoTx.objectStore(INFO_STORE_NAME);\n\n const getInfoRequest = infoStore.get(path);\n let modelTx: IDBTransaction;\n getInfoRequest.onsuccess = () => {\n if (getInfoRequest.result == null) {\n db.close();\n return reject(new Error(\n `Cannot find model with path '${path}' ` +\n `in IndexedDB.`));\n } else {\n // First, delete the entry in the info store.\n const deleteInfoRequest = infoStore.delete(path);\n const deleteModelData = () => {\n // Second, delete the entry in the model store.\n modelTx = db.transaction(MODEL_STORE_NAME, 'readwrite');\n const modelStore = modelTx.objectStore(MODEL_STORE_NAME);\n const deleteModelRequest = modelStore.delete(path);\n deleteModelRequest.onsuccess = () =>\n resolve(getInfoRequest.result.modelArtifactsInfo);\n deleteModelRequest.onerror = error =>\n reject(getInfoRequest.error);\n };\n // Proceed with deleting model data regardless of whether deletion\n // of info data succeeds or not.\n deleteInfoRequest.onsuccess = deleteModelData;\n deleteInfoRequest.onerror = error => {\n deleteModelData();\n db.close();\n return reject(getInfoRequest.error);\n };\n }\n };\n getInfoRequest.onerror = error => {\n db.close();\n return reject(getInfoRequest.error);\n };\n\n infoTx.oncomplete = () => {\n if (modelTx == null) {\n db.close();\n } else {\n modelTx.oncomplete = () => db.close();\n }\n };\n };\n openRequest.onerror = error => reject(openRequest.error);\n });\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport '../flags';\nimport {env} from '../environment';\n\nimport {assert} from '../util';\nimport {arrayBufferToBase64String, base64StringToArrayBuffer, getModelArtifactsInfoForJSON} from './io_utils';\nimport {IORouter, IORouterRegistry} from './router_registry';\nimport {IOHandler, ModelArtifacts, ModelArtifactsInfo, ModelJSON, ModelStoreManager, SaveResult} from './types';\n\nconst PATH_SEPARATOR = '/';\nconst PATH_PREFIX = 'tensorflowjs_models';\nconst INFO_SUFFIX = 'info';\nconst MODEL_TOPOLOGY_SUFFIX = 'model_topology';\nconst WEIGHT_SPECS_SUFFIX = 'weight_specs';\nconst WEIGHT_DATA_SUFFIX = 'weight_data';\nconst MODEL_METADATA_SUFFIX = 'model_metadata';\n\n/**\n * Purge all tensorflow.js-saved model artifacts from local storage.\n *\n * @returns Paths of the models purged.\n */\nexport function purgeLocalStorageArtifacts(): string[] {\n if (!env().getBool('IS_BROWSER') || typeof window === 'undefined' ||\n typeof window.localStorage === 'undefined') {\n throw new Error(\n 'purgeLocalStorageModels() cannot proceed because local storage is ' +\n 'unavailable in the current environment.');\n }\n const LS = window.localStorage;\n const purgedModelPaths: string[] = [];\n for (let i = 0; i < LS.length; ++i) {\n const key = LS.key(i);\n const prefix = PATH_PREFIX + PATH_SEPARATOR;\n if (key.startsWith(prefix) && key.length > prefix.length) {\n LS.removeItem(key);\n const modelName = getModelPathFromKey(key);\n if (purgedModelPaths.indexOf(modelName) === -1) {\n purgedModelPaths.push(modelName);\n }\n }\n }\n return purgedModelPaths;\n}\n\ntype LocalStorageKeys = {\n /** Key of the localStorage entry storing `ModelArtifactsInfo`. */\n info: string,\n /**\n * Key of the localStorage entry storing the 'modelTopology' key of\n * `model.json`\n */\n topology: string,\n /**\n * Key of the localStorage entry storing the `weightsManifest.weights` entries\n * of `model.json`\n */\n weightSpecs: string,\n /** Key of the localStorage entry storing the weight data in Base64 */\n weightData: string,\n /**\n * Key of the localStorage entry storing the remaining fields of `model.json`\n * @see {@link ModelMetadata}\n */\n modelMetadata: string,\n};\n\ntype ModelMetadata = Omit;\n\nfunction getModelKeys(path: string): LocalStorageKeys {\n return {\n info: [PATH_PREFIX, path, INFO_SUFFIX].join(PATH_SEPARATOR),\n topology: [PATH_PREFIX, path, MODEL_TOPOLOGY_SUFFIX].join(PATH_SEPARATOR),\n weightSpecs: [PATH_PREFIX, path, WEIGHT_SPECS_SUFFIX].join(PATH_SEPARATOR),\n weightData: [PATH_PREFIX, path, WEIGHT_DATA_SUFFIX].join(PATH_SEPARATOR),\n modelMetadata:\n [PATH_PREFIX, path, MODEL_METADATA_SUFFIX].join(PATH_SEPARATOR)\n };\n}\n\nfunction removeItems(keys: LocalStorageKeys): void {\n for (const key of Object.values(keys)) {\n window.localStorage.removeItem(key);\n }\n}\n\n/**\n * Get model path from a local-storage key.\n *\n * E.g., 'tensorflowjs_models/my/model/1/info' --> 'my/model/1'\n *\n * @param key\n */\nfunction getModelPathFromKey(key: string) {\n const items = key.split(PATH_SEPARATOR);\n if (items.length < 3) {\n throw new Error(`Invalid key format: ${key}`);\n }\n return items.slice(1, items.length - 1).join(PATH_SEPARATOR);\n}\n\nfunction maybeStripScheme(key: string) {\n return key.startsWith(BrowserLocalStorage.URL_SCHEME) ?\n key.slice(BrowserLocalStorage.URL_SCHEME.length) :\n key;\n}\n\n/**\n * IOHandler subclass: Browser Local Storage.\n *\n * See the doc string to `browserLocalStorage` for more details.\n */\nexport class BrowserLocalStorage implements IOHandler {\n protected readonly LS: Storage;\n protected readonly modelPath: string;\n protected readonly keys: LocalStorageKeys;\n\n static readonly URL_SCHEME = 'localstorage://';\n\n constructor(modelPath: string) {\n if (!env().getBool('IS_BROWSER') || typeof window === 'undefined' ||\n typeof window.localStorage === 'undefined') {\n // TODO(cais): Add more info about what IOHandler subtypes are\n // available.\n // Maybe point to a doc page on the web and/or automatically determine\n // the available IOHandlers and print them in the error message.\n throw new Error(\n 'The current environment does not support local storage.');\n }\n this.LS = window.localStorage;\n\n if (modelPath == null || !modelPath) {\n throw new Error(\n 'For local storage, modelPath must not be null, undefined or empty.');\n }\n this.modelPath = modelPath;\n this.keys = getModelKeys(this.modelPath);\n }\n\n /**\n * Save model artifacts to browser local storage.\n *\n * See the documentation to `browserLocalStorage` for details on the saved\n * artifacts.\n *\n * @param modelArtifacts The model artifacts to be stored.\n * @returns An instance of SaveResult.\n */\n async save(modelArtifacts: ModelArtifacts): Promise {\n if (modelArtifacts.modelTopology instanceof ArrayBuffer) {\n throw new Error(\n 'BrowserLocalStorage.save() does not support saving model topology ' +\n 'in binary formats yet.');\n } else {\n const topology = JSON.stringify(modelArtifacts.modelTopology);\n const weightSpecs = JSON.stringify(modelArtifacts.weightSpecs);\n\n const modelArtifactsInfo: ModelArtifactsInfo =\n getModelArtifactsInfoForJSON(modelArtifacts);\n\n try {\n this.LS.setItem(this.keys.info, JSON.stringify(modelArtifactsInfo));\n this.LS.setItem(this.keys.topology, topology);\n this.LS.setItem(this.keys.weightSpecs, weightSpecs);\n this.LS.setItem(\n this.keys.weightData,\n arrayBufferToBase64String(modelArtifacts.weightData));\n\n // Note that JSON.stringify doesn't write out keys that have undefined\n // values, so for some keys, we set undefined instead of a null-ish\n // value.\n const metadata: Required = {\n format: modelArtifacts.format,\n generatedBy: modelArtifacts.generatedBy,\n convertedBy: modelArtifacts.convertedBy,\n signature: modelArtifacts.signature != null ?\n modelArtifacts.signature :\n undefined,\n userDefinedMetadata: modelArtifacts.userDefinedMetadata != null ?\n modelArtifacts.userDefinedMetadata :\n undefined,\n modelInitializer: modelArtifacts.modelInitializer != null ?\n modelArtifacts.modelInitializer :\n undefined,\n initializerSignature: modelArtifacts.initializerSignature != null ?\n modelArtifacts.initializerSignature :\n undefined,\n trainingConfig: modelArtifacts.trainingConfig != null ?\n modelArtifacts.trainingConfig :\n undefined\n };\n this.LS.setItem(this.keys.modelMetadata, JSON.stringify(metadata));\n\n return {modelArtifactsInfo};\n } catch (err) {\n // If saving failed, clean up all items saved so far.\n removeItems(this.keys);\n\n throw new Error(\n `Failed to save model '${this.modelPath}' to local storage: ` +\n `size quota being exceeded is a possible cause of this failure: ` +\n `modelTopologyBytes=${modelArtifactsInfo.modelTopologyBytes}, ` +\n `weightSpecsBytes=${modelArtifactsInfo.weightSpecsBytes}, ` +\n `weightDataBytes=${modelArtifactsInfo.weightDataBytes}.`);\n }\n }\n }\n\n /**\n * Load a model from local storage.\n *\n * See the documentation to `browserLocalStorage` for details on the saved\n * artifacts.\n *\n * @returns The loaded model (if loading succeeds).\n */\n async load(): Promise {\n const info =\n JSON.parse(this.LS.getItem(this.keys.info)) as ModelArtifactsInfo;\n if (info == null) {\n throw new Error(\n `In local storage, there is no model with name '${this.modelPath}'`);\n }\n\n if (info.modelTopologyType !== 'JSON') {\n throw new Error(\n 'BrowserLocalStorage does not support loading non-JSON model ' +\n 'topology yet.');\n }\n\n const out: ModelArtifacts = {};\n\n // Load topology.\n const topology = JSON.parse(this.LS.getItem(this.keys.topology));\n if (topology == null) {\n throw new Error(\n `In local storage, the topology of model '${this.modelPath}' ` +\n `is missing.`);\n }\n out.modelTopology = topology;\n\n // Load weight specs.\n const weightSpecs = JSON.parse(this.LS.getItem(this.keys.weightSpecs));\n if (weightSpecs == null) {\n throw new Error(\n `In local storage, the weight specs of model '${this.modelPath}' ` +\n `are missing.`);\n }\n out.weightSpecs = weightSpecs;\n\n // Load meta-data fields.\n const metadataString = this.LS.getItem(this.keys.modelMetadata);\n if (metadataString != null) {\n const metadata = JSON.parse(metadataString) as ModelMetadata;\n out.format = metadata.format;\n out.generatedBy = metadata.generatedBy;\n out.convertedBy = metadata.convertedBy;\n if (metadata.signature != null) {\n out.signature = metadata.signature;\n }\n if (metadata.userDefinedMetadata != null) {\n out.userDefinedMetadata = metadata.userDefinedMetadata;\n }\n if (metadata.modelInitializer != null) {\n out.modelInitializer = metadata.modelInitializer;\n }\n if (metadata.initializerSignature != null) {\n out.initializerSignature = metadata.initializerSignature;\n }\n if (metadata.trainingConfig != null) {\n out.trainingConfig = metadata.trainingConfig;\n }\n }\n\n // Load weight data.\n const weightDataBase64 = this.LS.getItem(this.keys.weightData);\n if (weightDataBase64 == null) {\n throw new Error(\n `In local storage, the binary weight values of model ` +\n `'${this.modelPath}' are missing.`);\n }\n out.weightData = base64StringToArrayBuffer(weightDataBase64);\n\n return out;\n }\n}\n\nexport const localStorageRouter: IORouter = (url: string|string[]) => {\n if (!env().getBool('IS_BROWSER')) {\n return null;\n } else {\n if (!Array.isArray(url) && url.startsWith(BrowserLocalStorage.URL_SCHEME)) {\n return browserLocalStorage(\n url.slice(BrowserLocalStorage.URL_SCHEME.length));\n } else {\n return null;\n }\n }\n};\nIORouterRegistry.registerSaveRouter(localStorageRouter);\nIORouterRegistry.registerLoadRouter(localStorageRouter);\n\n/**\n * Factory function for local storage IOHandler.\n *\n * This `IOHandler` supports both `save` and `load`.\n *\n * For each model's saved artifacts, four items are saved to local storage.\n * - `${PATH_SEPARATOR}/${modelPath}/info`: Contains meta-info about the\n * model, such as date saved, type of the topology, size in bytes, etc.\n * - `${PATH_SEPARATOR}/${modelPath}/topology`: Model topology. For Keras-\n * style models, this is a stringized JSON.\n * - `${PATH_SEPARATOR}/${modelPath}/weight_specs`: Weight specs of the\n * model, can be used to decode the saved binary weight values (see\n * item below).\n * - `${PATH_SEPARATOR}/${modelPath}/weight_data`: Concatenated binary\n * weight values, stored as a base64-encoded string.\n *\n * Saving may throw an `Error` if the total size of the artifacts exceed the\n * browser-specific quota.\n *\n * @param modelPath A unique identifier for the model to be saved. Must be a\n * non-empty string.\n * @returns An instance of `IOHandler`, which can be used with, e.g.,\n * `tf.Model.save`.\n */\nexport function browserLocalStorage(modelPath: string): IOHandler {\n return new BrowserLocalStorage(modelPath);\n}\n\nexport class BrowserLocalStorageManager implements ModelStoreManager {\n private readonly LS: Storage;\n\n constructor() {\n assert(\n env().getBool('IS_BROWSER'),\n () => 'Current environment is not a web browser');\n assert(\n typeof window === 'undefined' ||\n typeof window.localStorage !== 'undefined',\n () => 'Current browser does not appear to support localStorage');\n this.LS = window.localStorage;\n }\n\n async listModels(): Promise<{[path: string]: ModelArtifactsInfo}> {\n const out: {[path: string]: ModelArtifactsInfo} = {};\n const prefix = PATH_PREFIX + PATH_SEPARATOR;\n const suffix = PATH_SEPARATOR + INFO_SUFFIX;\n for (let i = 0; i < this.LS.length; ++i) {\n const key = this.LS.key(i);\n if (key.startsWith(prefix) && key.endsWith(suffix)) {\n const modelPath = getModelPathFromKey(key);\n out[modelPath] = JSON.parse(this.LS.getItem(key)) as ModelArtifactsInfo;\n }\n }\n return out;\n }\n\n async removeModel(path: string): Promise {\n path = maybeStripScheme(path);\n const keys = getModelKeys(path);\n if (this.LS.getItem(keys.info) == null) {\n throw new Error(`Cannot find model at path '${path}'`);\n }\n const info = JSON.parse(this.LS.getItem(keys.info)) as ModelArtifactsInfo;\n removeItems(keys);\n return info;\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/**\n * Classes and functions for model management across multiple storage mediums.\n *\n * Supported client actions:\n * - Listing models on all registered storage mediums.\n * - Remove model by URL from any registered storage mediums, by using URL\n * string.\n * - Moving or copying model from one path to another in the same medium or from\n * one medium to another, by using URL strings.\n */\n\nimport {assert} from '../util';\n\nimport {IORouterRegistry} from './router_registry';\nimport {ModelArtifactsInfo, ModelStoreManager} from './types';\n\nconst URL_SCHEME_SUFFIX = '://';\n\nexport class ModelStoreManagerRegistry {\n // Singleton instance.\n private static instance: ModelStoreManagerRegistry;\n\n private managers: {[scheme: string]: ModelStoreManager};\n\n private constructor() {\n this.managers = {};\n }\n\n private static getInstance(): ModelStoreManagerRegistry {\n if (ModelStoreManagerRegistry.instance == null) {\n ModelStoreManagerRegistry.instance = new ModelStoreManagerRegistry();\n }\n return ModelStoreManagerRegistry.instance;\n }\n\n /**\n * Register a save-handler router.\n *\n * @param saveRouter A function that maps a URL-like string onto an instance\n * of `IOHandler` with the `save` method defined or `null`.\n */\n static registerManager(scheme: string, manager: ModelStoreManager) {\n assert(scheme != null, () => 'scheme must not be undefined or null.');\n if (scheme.endsWith(URL_SCHEME_SUFFIX)) {\n scheme = scheme.slice(0, scheme.indexOf(URL_SCHEME_SUFFIX));\n }\n assert(scheme.length > 0, () => 'scheme must not be an empty string.');\n const registry = ModelStoreManagerRegistry.getInstance();\n assert(\n registry.managers[scheme] == null,\n () => `A model store manager is already registered for scheme '${\n scheme}'.`);\n registry.managers[scheme] = manager;\n }\n\n static getManager(scheme: string): ModelStoreManager {\n const manager = ModelStoreManagerRegistry.getInstance().managers[scheme];\n if (manager == null) {\n throw new Error(`Cannot find model manager for scheme '${scheme}'`);\n }\n return manager;\n }\n\n static getSchemes(): string[] {\n return Object.keys(ModelStoreManagerRegistry.getInstance().managers);\n }\n}\n\n/**\n * Helper method for parsing a URL string into a scheme and a path.\n *\n * @param url E.g., 'localstorage://my-model'\n * @returns A dictionary with two fields: scheme and path.\n * Scheme: e.g., 'localstorage' in the example above.\n * Path: e.g., 'my-model' in the example above.\n */\nfunction parseURL(url: string): {scheme: string, path: string} {\n if (url.indexOf(URL_SCHEME_SUFFIX) === -1) {\n throw new Error(\n `The url string provided does not contain a scheme. ` +\n `Supported schemes are: ` +\n `${ModelStoreManagerRegistry.getSchemes().join(',')}`);\n }\n return {\n scheme: url.split(URL_SCHEME_SUFFIX)[0],\n path: url.split(URL_SCHEME_SUFFIX)[1],\n };\n}\n\nasync function cloneModelInternal(\n sourceURL: string, destURL: string,\n deleteSource = false): Promise {\n assert(\n sourceURL !== destURL,\n () => `Old path and new path are the same: '${sourceURL}'`);\n\n const loadHandlers = IORouterRegistry.getLoadHandlers(sourceURL);\n assert(\n loadHandlers.length > 0,\n () => `Copying failed because no load handler is found for source URL ${\n sourceURL}.`);\n assert(\n loadHandlers.length < 2,\n () => `Copying failed because more than one (${loadHandlers.length}) ` +\n `load handlers for source URL ${sourceURL}.`);\n const loadHandler = loadHandlers[0];\n\n const saveHandlers = IORouterRegistry.getSaveHandlers(destURL);\n assert(\n saveHandlers.length > 0,\n () => `Copying failed because no save handler is found for destination ` +\n `URL ${destURL}.`);\n assert(\n saveHandlers.length < 2,\n () => `Copying failed because more than one (${loadHandlers.length}) ` +\n `save handlers for destination URL ${destURL}.`);\n const saveHandler = saveHandlers[0];\n\n const sourceScheme = parseURL(sourceURL).scheme;\n const sourcePath = parseURL(sourceURL).path;\n const sameMedium = sourceScheme === parseURL(sourceURL).scheme;\n\n const modelArtifacts = await loadHandler.load();\n\n // If moving within the same storage medium, remove the old model as soon as\n // the loading is done. Without doing this, it is possible that the combined\n // size of the two models will cause the cloning to fail.\n if (deleteSource && sameMedium) {\n await ModelStoreManagerRegistry.getManager(sourceScheme)\n .removeModel(sourcePath);\n }\n\n const saveResult = await saveHandler.save(modelArtifacts);\n\n // If moving between mediums, the deletion is done after the save succeeds.\n // This guards against the case in which saving to the destination medium\n // fails.\n if (deleteSource && !sameMedium) {\n await ModelStoreManagerRegistry.getManager(sourceScheme)\n .removeModel(sourcePath);\n }\n\n return saveResult.modelArtifactsInfo;\n}\n\n/**\n * List all models stored in registered storage mediums.\n *\n * For a web browser environment, the registered mediums are Local Storage and\n * IndexedDB.\n *\n * ```js\n * // First create and save a model.\n * const model = tf.sequential();\n * model.add(tf.layers.dense(\n * {units: 1, inputShape: [10], activation: 'sigmoid'}));\n * await model.save('localstorage://demo/management/model1');\n *\n * // Then list existing models.\n * console.log(JSON.stringify(await tf.io.listModels()));\n *\n * // Delete the model.\n * await tf.io.removeModel('localstorage://demo/management/model1');\n *\n * // List models again.\n * console.log(JSON.stringify(await tf.io.listModels()));\n * ```\n *\n * @returns A `Promise` of a dictionary mapping URLs of existing models to\n * their model artifacts info. URLs include medium-specific schemes, e.g.,\n * 'indexeddb://my/model/1'. Model artifacts info include type of the\n * model's topology, byte sizes of the topology, weights, etc.\n *\n * @doc {\n * heading: 'Models',\n * subheading: 'Management',\n * namespace: 'io',\n * ignoreCI: true\n * }\n */\nasync function listModels(): Promise<{[url: string]: ModelArtifactsInfo}> {\n const schemes = ModelStoreManagerRegistry.getSchemes();\n const out: {[url: string]: ModelArtifactsInfo} = {};\n for (const scheme of schemes) {\n const schemeOut =\n await ModelStoreManagerRegistry.getManager(scheme).listModels();\n for (const path in schemeOut) {\n const url = scheme + URL_SCHEME_SUFFIX + path;\n out[url] = schemeOut[path];\n }\n }\n return out;\n}\n\n/**\n * Remove a model specified by URL from a registered storage medium.\n *\n * ```js\n * // First create and save a model.\n * const model = tf.sequential();\n * model.add(tf.layers.dense(\n * {units: 1, inputShape: [10], activation: 'sigmoid'}));\n * await model.save('localstorage://demo/management/model1');\n *\n * // Then list existing models.\n * console.log(JSON.stringify(await tf.io.listModels()));\n *\n * // Delete the model.\n * await tf.io.removeModel('localstorage://demo/management/model1');\n *\n * // List models again.\n * console.log(JSON.stringify(await tf.io.listModels()));\n * ```\n *\n * @param url A URL to a stored model, with a scheme prefix, e.g.,\n * 'localstorage://my-model-1', 'indexeddb://my/model/2'.\n * @returns ModelArtifactsInfo of the deleted model (if and only if deletion\n * is successful).\n * @throws Error if deletion fails, e.g., if no model exists at `path`.\n *\n * @doc {\n * heading: 'Models',\n * subheading: 'Management',\n * namespace: 'io',\n * ignoreCI: true\n * }\n */\nasync function removeModel(url: string): Promise {\n const schemeAndPath = parseURL(url);\n const manager = ModelStoreManagerRegistry.getManager(schemeAndPath.scheme);\n return manager.removeModel(schemeAndPath.path);\n}\n\n/**\n * Copy a model from one URL to another.\n *\n * This function supports:\n *\n * 1. Copying within a storage medium, e.g.,\n * `tf.io.copyModel('localstorage://model-1', 'localstorage://model-2')`\n * 2. Copying between two storage mediums, e.g.,\n * `tf.io.copyModel('localstorage://model-1', 'indexeddb://model-1')`\n *\n * ```js\n * // First create and save a model.\n * const model = tf.sequential();\n * model.add(tf.layers.dense(\n * {units: 1, inputShape: [10], activation: 'sigmoid'}));\n * await model.save('localstorage://demo/management/model1');\n *\n * // Then list existing models.\n * console.log(JSON.stringify(await tf.io.listModels()));\n *\n * // Copy the model, from Local Storage to IndexedDB.\n * await tf.io.copyModel(\n * 'localstorage://demo/management/model1',\n * 'indexeddb://demo/management/model1');\n *\n * // List models again.\n * console.log(JSON.stringify(await tf.io.listModels()));\n *\n * // Remove both models.\n * await tf.io.removeModel('localstorage://demo/management/model1');\n * await tf.io.removeModel('indexeddb://demo/management/model1');\n * ```\n *\n * @param sourceURL Source URL of copying.\n * @param destURL Destination URL of copying.\n * @returns ModelArtifactsInfo of the copied model (if and only if copying\n * is successful).\n * @throws Error if copying fails, e.g., if no model exists at `sourceURL`, or\n * if `oldPath` and `newPath` are identical.\n *\n * @doc {\n * heading: 'Models',\n * subheading: 'Management',\n * namespace: 'io',\n * ignoreCI: true\n * }\n */\nasync function copyModel(\n sourceURL: string, destURL: string): Promise {\n const deleteSource = false;\n return cloneModelInternal(sourceURL, destURL, deleteSource);\n}\n\n/**\n * Move a model from one URL to another.\n *\n * This function supports:\n *\n * 1. Moving within a storage medium, e.g.,\n * `tf.io.moveModel('localstorage://model-1', 'localstorage://model-2')`\n * 2. Moving between two storage mediums, e.g.,\n * `tf.io.moveModel('localstorage://model-1', 'indexeddb://model-1')`\n *\n * ```js\n * // First create and save a model.\n * const model = tf.sequential();\n * model.add(tf.layers.dense(\n * {units: 1, inputShape: [10], activation: 'sigmoid'}));\n * await model.save('localstorage://demo/management/model1');\n *\n * // Then list existing models.\n * console.log(JSON.stringify(await tf.io.listModels()));\n *\n * // Move the model, from Local Storage to IndexedDB.\n * await tf.io.moveModel(\n * 'localstorage://demo/management/model1',\n * 'indexeddb://demo/management/model1');\n *\n * // List models again.\n * console.log(JSON.stringify(await tf.io.listModels()));\n *\n * // Remove the moved model.\n * await tf.io.removeModel('indexeddb://demo/management/model1');\n * ```\n *\n * @param sourceURL Source URL of moving.\n * @param destURL Destination URL of moving.\n * @returns ModelArtifactsInfo of the copied model (if and only if copying\n * is successful).\n * @throws Error if moving fails, e.g., if no model exists at `sourceURL`, or\n * if `oldPath` and `newPath` are identical.\n *\n * @doc {\n * heading: 'Models',\n * subheading: 'Management',\n * namespace: 'io',\n * ignoreCI: true\n * }\n */\nasync function moveModel(\n sourceURL: string, destURL: string): Promise {\n const deleteSource = true;\n return cloneModelInternal(sourceURL, destURL, deleteSource);\n}\n\nexport {moveModel, copyModel, removeModel, listModels};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport '../flags';\n\nimport {env} from '../environment';\nimport {BrowserIndexedDB, BrowserIndexedDBManager} from '../io/indexed_db';\nimport {BrowserLocalStorage, BrowserLocalStorageManager} from '../io/local_storage';\nimport {ModelStoreManagerRegistry} from '../io/model_management';\n\nimport {Platform} from './platform';\n\nexport class PlatformBrowser implements Platform {\n // According to the spec, the built-in encoder can do only UTF-8 encoding.\n // https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder/TextEncoder\n private textEncoder: TextEncoder;\n\n // For setTimeoutCustom\n private readonly messageName = 'setTimeoutCustom';\n private functionRefs: Function[] = [];\n private handledMessageCount = 0;\n private hasEventListener = false;\n\n fetch(path: string, init?: RequestInit): Promise {\n return fetch(path, init);\n }\n\n now(): number {\n return performance.now();\n }\n\n encode(text: string, encoding: string): Uint8Array {\n if (encoding !== 'utf-8' && encoding !== 'utf8') {\n throw new Error(\n `Browser's encoder only supports utf-8, but got ${encoding}`);\n }\n if (this.textEncoder == null) {\n this.textEncoder = new TextEncoder();\n }\n return this.textEncoder.encode(text);\n }\n decode(bytes: Uint8Array, encoding: string): string {\n return new TextDecoder(encoding).decode(bytes);\n }\n\n // If the setTimeout nesting level is greater than 5 and timeout is less\n // than 4ms, timeout will be clamped to 4ms, which hurts the perf.\n // Interleaving window.postMessage and setTimeout will trick the browser and\n // avoid the clamp.\n setTimeoutCustom(functionRef: Function, delay: number): void {\n if (typeof window === 'undefined' ||\n !env().getBool('USE_SETTIMEOUTCUSTOM')) {\n setTimeout(functionRef, delay);\n return;\n }\n\n this.functionRefs.push(functionRef);\n setTimeout(() => {\n window.postMessage(\n {name: this.messageName, index: this.functionRefs.length - 1}, '*');\n }, delay);\n\n if (!this.hasEventListener) {\n this.hasEventListener = true;\n window.addEventListener('message', (event: MessageEvent) => {\n if (event.source === window && event.data.name === this.messageName) {\n event.stopPropagation();\n const functionRef = this.functionRefs[event.data.index];\n functionRef();\n this.handledMessageCount++;\n if (this.handledMessageCount === this.functionRefs.length) {\n this.functionRefs = [];\n this.handledMessageCount = 0;\n }\n }\n }, true);\n }\n }\n}\n\nif (env().get('IS_BROWSER')) {\n env().setPlatform('browser', new PlatformBrowser());\n\n // Register LocalStorage IOHandler\n try {\n ModelStoreManagerRegistry.registerManager(\n BrowserLocalStorage.URL_SCHEME, new BrowserLocalStorageManager());\n } catch (err) {\n }\n\n // Register IndexedDB IOHandler\n try {\n ModelStoreManagerRegistry.registerManager(\n BrowserIndexedDB.URL_SCHEME, new BrowserIndexedDBManager());\n } catch (err) {\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {env} from '../environment';\nimport {Platform} from './platform';\n\n// We are wrapping this within an object so it can be stubbed by Jasmine.\nexport const getNodeFetch = {\n // tslint:disable-next-line:no-require-imports\n importFetch: () => require('node-fetch')\n};\n\ntype FetchFn = (url: string, init?: RequestInit) => Promise;\nlet systemFetch: FetchFn;\n// These getters and setters are for testing so we don't export a mutable\n// variable.\nexport function resetSystemFetch() {\n systemFetch = null;\n}\nexport function setSystemFetch(fetchFn: FetchFn) {\n systemFetch = fetchFn;\n}\nexport function getSystemFetch(): FetchFn {\n return systemFetch;\n}\n\nexport class PlatformNode implements Platform {\n private textEncoder: TextEncoder;\n // tslint:disable-next-line:no-any\n util: any;\n\n constructor() {\n // tslint:disable-next-line:no-require-imports\n this.util = require('util');\n // According to the spec, the built-in encoder can do only UTF-8 encoding.\n // https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder/TextEncoder\n this.textEncoder = new this.util.TextEncoder();\n }\n\n fetch(path: string, requestInits?: RequestInit): Promise {\n if (env().global.fetch != null) {\n return env().global.fetch(path, requestInits);\n }\n\n if (systemFetch == null) {\n systemFetch = getNodeFetch.importFetch();\n }\n return systemFetch(path, requestInits);\n }\n\n now(): number {\n const time = process.hrtime();\n return time[0] * 1000 + time[1] / 1000000;\n }\n\n encode(text: string, encoding: string): Uint8Array {\n if (encoding !== 'utf-8' && encoding !== 'utf8') {\n throw new Error(\n `Node built-in encoder only supports utf-8, but got ${encoding}`);\n }\n return this.textEncoder.encode(text);\n }\n decode(bytes: Uint8Array, encoding: string): string {\n if (bytes.length === 0) {\n return '';\n }\n return new this.util.TextDecoder(encoding).decode(bytes);\n }\n}\n\nif (env().get('IS_NODE') && !env().get('IS_BROWSER')) {\n env().setPlatform('node', new PlatformNode());\n}\n","/**\n * @license\n * Copyright 2020 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {TensorBuffer} from '../tensor';\nimport {DataType, DataTypeMap, Rank, ShapeMap} from '../types';\nimport * as util from '../util';\n\n/**\n * Creates an empty `tf.TensorBuffer` with the specified `shape` and `dtype`.\n *\n * The values are stored in CPU as `TypedArray`. Fill the buffer using\n * `buffer.set()`, or by modifying directly `buffer.values`.\n *\n * When done, call `buffer.toTensor()` to get an immutable `tf.Tensor` with\n * those values.\n *\n * ```js\n * // Create a buffer and set values at particular indices.\n * const buffer = tf.buffer([2, 2]);\n * buffer.set(3, 0, 0);\n * buffer.set(5, 1, 0);\n *\n * // Convert the buffer back to a tensor.\n * buffer.toTensor().print();\n * ```\n *\n * @param shape An array of integers defining the output tensor shape.\n * @param dtype The dtype of the buffer. Defaults to 'float32'.\n * @param values The values of the buffer as `TypedArray`. Defaults to\n * zeros.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nexport function buffer(\n shape: ShapeMap[R], dtype: D = 'float32' as D,\n values?: DataTypeMap[D]): TensorBuffer {\n dtype = dtype || 'float32' as D;\n util.assertNonNegativeIntegerDimensions(shape);\n return new TensorBuffer(shape, dtype, values);\n}\n","/**\n * @license\n * Copyright 2020 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Cast, CastAttrs, CastInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {DataType, TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\n\n/**\n * Casts a `tf.Tensor` to a new dtype.\n *\n * ```js\n * const x = tf.tensor1d([1.5, 2.5, 3]);\n * tf.cast(x, 'int32').print();\n * ```\n * @param x The input tensor to be casted.\n * @param dtype The dtype to cast the input tensor to.\n *\n * @doc {heading: 'Tensors', subheading: 'Transformations'}\n */\nfunction cast_(x: T|TensorLike, dtype: DataType): T {\n const $x = convertToTensor(x, 'x', 'cast');\n\n // Sanity checks.\n if (!util.isValidDtype(dtype)) {\n throw new Error(`Failed to cast to unknown dtype ${dtype}`);\n }\n if (dtype === 'string' && $x.dtype !== 'string' ||\n dtype !== 'string' && $x.dtype === 'string') {\n throw new Error('Only strings can be casted to strings');\n }\n\n const inputs: CastInputs = {x: $x};\n const attrs: CastAttrs = {dtype};\n\n return ENGINE.runKernel(\n Cast, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const cast = op({cast_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Identity, IdentityInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Creates a new tensor with the same values and shape as the specified\n * tensor.\n *\n * ```js\n * const x = tf.tensor([1, 2]);\n *\n * x.clone().print();\n * ```\n *\n * @param x The tensor to clone.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nfunction clone_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'clone', 'string_or_numeric');\n const inputs: IdentityInputs = {x: $x};\n\n // Note this op is called tf.identity in python. Hence the kernel name used\n // here.\n return ENGINE.runKernel(Identity, inputs as {} as NamedTensorMap);\n}\n\nexport const clone = op({clone_});\n","/**\n * @license\n * Copyright 2020 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\n\n/**\n * Prints information about the `tf.Tensor` including its data.\n *\n * ```js\n * const verbose = true;\n * tf.tensor2d([1, 2, 3, 4], [2, 2]).print(verbose);\n * ```\n * @param x The tensor to be printed.\n * @param verbose Whether to print verbose information about the ` Tensor`,\n * including dtype and size.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nexport function print(x: T, verbose = false): void {\n console.log(x.toString(verbose));\n}\n","/**\n * @license\n * Copyright 2020 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// Required side effectful code for tfjs-core\n\n// Set up Engine and ENV\nimport {getOrMakeEngine} from './engine';\ngetOrMakeEngine();\n\n// Register backend-agnostic flags.\nimport './flags';\n// Register platforms\nimport './platforms/platform_browser';\nimport './platforms/platform_node';\n\n// Set up OpHandler\nimport {buffer} from './ops/buffer';\nimport {cast} from './ops/cast';\nimport {clone} from './ops/clone';\nimport {print} from './ops/print';\nimport {OpHandler, setOpHandler} from './tensor';\nconst opHandler: OpHandler = {\n buffer,\n cast,\n clone,\n print\n};\nsetOpHandler(opHandler);\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/**\n * IOHandlers related to files, such as browser-triggered file downloads,\n * user-selected files in browser.\n */\n\nimport '../flags';\nimport {env} from '../environment';\n\nimport {basename, concatenateArrayBuffers, getModelArtifactsForJSON, getModelArtifactsInfoForJSON, getModelJSONForModelArtifacts} from './io_utils';\nimport {IORouter, IORouterRegistry} from './router_registry';\nimport {IOHandler, ModelArtifacts, ModelJSON, SaveResult, WeightsManifestConfig, WeightsManifestEntry} from './types';\n\nconst DEFAULT_FILE_NAME_PREFIX = 'model';\nconst DEFAULT_JSON_EXTENSION_NAME = '.json';\nconst DEFAULT_WEIGHT_DATA_EXTENSION_NAME = '.weights.bin';\n\nfunction defer(f: () => T): Promise {\n return new Promise(resolve => setTimeout(resolve)).then(f);\n}\n\nexport class BrowserDownloads implements IOHandler {\n private readonly modelJsonFileName: string;\n private readonly weightDataFileName: string;\n private readonly modelJsonAnchor: HTMLAnchorElement;\n private readonly weightDataAnchor: HTMLAnchorElement;\n\n static readonly URL_SCHEME = 'downloads://';\n\n constructor(fileNamePrefix?: string) {\n if (!env().getBool('IS_BROWSER')) {\n // TODO(cais): Provide info on what IOHandlers are available under the\n // current environment.\n throw new Error(\n 'browserDownloads() cannot proceed because the current environment ' +\n 'is not a browser.');\n }\n\n if (fileNamePrefix.startsWith(BrowserDownloads.URL_SCHEME)) {\n fileNamePrefix = fileNamePrefix.slice(BrowserDownloads.URL_SCHEME.length);\n }\n if (fileNamePrefix == null || fileNamePrefix.length === 0) {\n fileNamePrefix = DEFAULT_FILE_NAME_PREFIX;\n }\n\n this.modelJsonFileName = fileNamePrefix + DEFAULT_JSON_EXTENSION_NAME;\n this.weightDataFileName =\n fileNamePrefix + DEFAULT_WEIGHT_DATA_EXTENSION_NAME;\n }\n\n async save(modelArtifacts: ModelArtifacts): Promise {\n if (typeof (document) === 'undefined') {\n throw new Error(\n 'Browser downloads are not supported in ' +\n 'this environment since `document` is not present');\n }\n const weightsURL = window.URL.createObjectURL(new Blob(\n [modelArtifacts.weightData], {type: 'application/octet-stream'}));\n\n if (modelArtifacts.modelTopology instanceof ArrayBuffer) {\n throw new Error(\n 'BrowserDownloads.save() does not support saving model topology ' +\n 'in binary formats yet.');\n } else {\n const weightsManifest: WeightsManifestConfig = [{\n paths: ['./' + this.weightDataFileName],\n weights: modelArtifacts.weightSpecs\n }];\n const modelJSON: ModelJSON =\n getModelJSONForModelArtifacts(modelArtifacts, weightsManifest);\n\n const modelJsonURL = window.URL.createObjectURL(\n new Blob([JSON.stringify(modelJSON)], {type: 'application/json'}));\n\n // If anchor elements are not provided, create them without attaching them\n // to parents, so that the downloaded file names can be controlled.\n const jsonAnchor = this.modelJsonAnchor == null ?\n document.createElement('a') :\n this.modelJsonAnchor;\n jsonAnchor.download = this.modelJsonFileName;\n jsonAnchor.href = modelJsonURL;\n // Trigger downloads by evoking a click event on the download anchors.\n // When multiple downloads are started synchronously, Firefox will only\n // save the last one.\n await defer(() => jsonAnchor.dispatchEvent(new MouseEvent('click')));\n\n if (modelArtifacts.weightData != null) {\n const weightDataAnchor = this.weightDataAnchor == null ?\n document.createElement('a') :\n this.weightDataAnchor;\n weightDataAnchor.download = this.weightDataFileName;\n weightDataAnchor.href = weightsURL;\n await defer(\n () => weightDataAnchor.dispatchEvent(new MouseEvent('click')));\n }\n\n return {modelArtifactsInfo: getModelArtifactsInfoForJSON(modelArtifacts)};\n }\n }\n}\n\nclass BrowserFiles implements IOHandler {\n private readonly jsonFile: File;\n private readonly weightsFiles: File[];\n\n constructor(files: File[]) {\n if (files == null || files.length < 1) {\n throw new Error(\n `When calling browserFiles, at least 1 file is required, ` +\n `but received ${files}`);\n }\n this.jsonFile = files[0];\n this.weightsFiles = files.slice(1);\n }\n\n async load(): Promise {\n return new Promise((resolve, reject) => {\n const jsonReader = new FileReader();\n jsonReader.onload = (event: Event) => {\n // tslint:disable-next-line:no-any\n const modelJSON = JSON.parse((event.target as any).result) as ModelJSON;\n\n const modelTopology = modelJSON.modelTopology;\n if (modelTopology == null) {\n reject(new Error(`modelTopology field is missing from file ${\n this.jsonFile.name}`));\n return;\n }\n\n const weightsManifest = modelJSON.weightsManifest;\n if (weightsManifest == null) {\n reject(new Error(`weightManifest field is missing from file ${\n this.jsonFile.name}`));\n return;\n }\n\n if (this.weightsFiles.length === 0) {\n resolve({modelTopology});\n return;\n }\n\n const modelArtifactsPromise = getModelArtifactsForJSON(\n modelJSON, (weightsManifest) => this.loadWeights(weightsManifest));\n resolve(modelArtifactsPromise);\n };\n\n jsonReader.onerror = error => reject(\n `Failed to read model topology and weights manifest JSON ` +\n `from file '${this.jsonFile.name}'. BrowserFiles supports loading ` +\n `Keras-style tf.Model artifacts only.`);\n jsonReader.readAsText(this.jsonFile);\n });\n }\n\n private loadWeights(weightsManifest: WeightsManifestConfig): Promise<[\n /* weightSpecs */ WeightsManifestEntry[], /* weightData */ ArrayBuffer\n ]> {\n const weightSpecs: WeightsManifestEntry[] = [];\n const paths: string[] = [];\n for (const entry of weightsManifest) {\n weightSpecs.push(...entry.weights);\n paths.push(...entry.paths);\n }\n\n const pathToFile: {[path: string]: File} =\n this.checkManifestAndWeightFiles(weightsManifest);\n\n const promises: Array> =\n paths.map(path => this.loadWeightsFile(path, pathToFile[path]));\n\n return Promise.all(promises).then(\n buffers => [weightSpecs, concatenateArrayBuffers(buffers)]);\n }\n\n private loadWeightsFile(path: string, file: File): Promise {\n return new Promise((resolve, reject) => {\n const weightFileReader = new FileReader();\n weightFileReader.onload = (event: Event) => {\n // tslint:disable-next-line:no-any\n const weightData = (event.target as any).result as ArrayBuffer;\n resolve(weightData);\n };\n weightFileReader.onerror = error =>\n reject(`Failed to weights data from file of path '${path}'.`);\n weightFileReader.readAsArrayBuffer(file);\n });\n }\n\n /**\n * Check the compatibility between weights manifest and weight files.\n */\n private checkManifestAndWeightFiles(manifest: WeightsManifestConfig):\n {[path: string]: File} {\n const basenames: string[] = [];\n const fileNames = this.weightsFiles.map(file => basename(file.name));\n const pathToFile: {[path: string]: File} = {};\n for (const group of manifest) {\n group.paths.forEach(path => {\n const pathBasename = basename(path);\n if (basenames.indexOf(pathBasename) !== -1) {\n throw new Error(\n `Duplicate file basename found in weights manifest: ` +\n `'${pathBasename}'`);\n }\n basenames.push(pathBasename);\n if (fileNames.indexOf(pathBasename) === -1) {\n throw new Error(\n `Weight file with basename '${pathBasename}' is not provided.`);\n } else {\n pathToFile[path] = this.weightsFiles[fileNames.indexOf(pathBasename)];\n }\n });\n }\n\n if (basenames.length !== this.weightsFiles.length) {\n throw new Error(\n `Mismatch in the number of files in weights manifest ` +\n `(${basenames.length}) and the number of weight files provided ` +\n `(${this.weightsFiles.length}).`);\n }\n return pathToFile;\n }\n}\n\nexport const browserDownloadsRouter: IORouter = (url: string|string[]) => {\n if (!env().getBool('IS_BROWSER')) {\n return null;\n } else {\n if (!Array.isArray(url) && url.startsWith(BrowserDownloads.URL_SCHEME)) {\n return browserDownloads(url.slice(BrowserDownloads.URL_SCHEME.length));\n } else {\n return null;\n }\n }\n};\nIORouterRegistry.registerSaveRouter(browserDownloadsRouter);\n\n/**\n * Creates an IOHandler that triggers file downloads from the browser.\n *\n * The returned `IOHandler` instance can be used as model exporting methods such\n * as `tf.Model.save` and supports only saving.\n *\n * ```js\n * const model = tf.sequential();\n * model.add(tf.layers.dense(\n * {units: 1, inputShape: [10], activation: 'sigmoid'}));\n * const saveResult = await model.save('downloads://mymodel');\n * // This will trigger downloading of two files:\n * // 'mymodel.json' and 'mymodel.weights.bin'.\n * console.log(saveResult);\n * ```\n *\n * @param fileNamePrefix Prefix name of the files to be downloaded. For use with\n * `tf.Model`, `fileNamePrefix` should follow either of the following two\n * formats:\n * 1. `null` or `undefined`, in which case the default file\n * names will be used:\n * - 'model.json' for the JSON file containing the model topology and\n * weights manifest.\n * - 'model.weights.bin' for the binary file containing the binary weight\n * values.\n * 2. A single string or an Array of a single string, as the file name prefix.\n * For example, if `'foo'` is provided, the downloaded JSON\n * file and binary weights file will be named 'foo.json' and\n * 'foo.weights.bin', respectively.\n * @param config Additional configuration for triggering downloads.\n * @returns An instance of `BrowserDownloads` `IOHandler`.\n *\n * @doc {\n * heading: 'Models',\n * subheading: 'Loading',\n * namespace: 'io',\n * ignoreCI: true\n * }\n */\nexport function browserDownloads(fileNamePrefix = 'model'): IOHandler {\n return new BrowserDownloads(fileNamePrefix);\n}\n\n/**\n * Creates an IOHandler that loads model artifacts from user-selected files.\n *\n * This method can be used for loading from files such as user-selected files\n * in the browser.\n * When used in conjunction with `tf.loadLayersModel`, an instance of\n * `tf.LayersModel` (Keras-style) can be constructed from the loaded artifacts.\n *\n * ```js\n * // Note: This code snippet won't run properly without the actual file input\n * // elements in the HTML DOM.\n *\n * // Suppose there are two HTML file input (``)\n * // elements.\n * const uploadJSONInput = document.getElementById('upload-json');\n * const uploadWeightsInput = document.getElementById('upload-weights');\n * const model = await tf.loadLayersModel(tf.io.browserFiles(\n * [uploadJSONInput.files[0], uploadWeightsInput.files[0]]));\n * ```\n *\n * @param files `File`s to load from. Currently, this function supports only\n * loading from files that contain Keras-style models (i.e., `tf.Model`s), for\n * which an `Array` of `File`s is expected (in that order):\n * - A JSON file containing the model topology and weight manifest.\n * - Optionally, one or more binary files containing the binary weights.\n * These files must have names that match the paths in the `weightsManifest`\n * contained by the aforementioned JSON file, or errors will be thrown\n * during loading. These weights files have the same format as the ones\n * generated by `tensorflowjs_converter` that comes with the `tensorflowjs`\n * Python PIP package. If no weights files are provided, only the model\n * topology will be loaded from the JSON file above.\n * @returns An instance of `Files` `IOHandler`.\n *\n * @doc {\n * heading: 'Models',\n * subheading: 'Loading',\n * namespace: 'io',\n * ignoreCI: true\n * }\n */\nexport function browserFiles(files: File[]): IOHandler {\n return new BrowserFiles(files);\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {assert} from '../util';\n\nimport {OnProgressCallback} from './types';\n\n/**\n * Monitor Promise.all progress, fire onProgress callback function.\n *\n * @param promises Promise list going to be monitored\n * @param onProgress Callback function. Fired when a promise resolved.\n * @param startFraction Optional fraction start. Default to 0.\n * @param endFraction Optional fraction end. Default to 1.\n */\nexport function monitorPromisesProgress(\n promises: Array>, onProgress: OnProgressCallback,\n startFraction?: number, endFraction?: number) {\n checkPromises(promises);\n startFraction = startFraction == null ? 0 : startFraction;\n endFraction = endFraction == null ? 1 : endFraction;\n checkFraction(startFraction, endFraction);\n let resolvedPromise = 0;\n\n const registerMonitor = (promise: Promise<{}>) => {\n promise.then(value => {\n const fraction = startFraction +\n ++resolvedPromise / promises.length * (endFraction - startFraction);\n // pass fraction as parameter to callback function.\n onProgress(fraction);\n return value;\n });\n return promise;\n };\n\n function checkPromises(promises: Array>): void {\n assert(\n promises != null && Array.isArray(promises) && promises.length > 0,\n () => 'promises must be a none empty array');\n }\n\n function checkFraction(startFraction: number, endFraction: number): void {\n assert(\n startFraction >= 0 && startFraction <= 1,\n () => `Progress fraction must be in range [0, 1], but ` +\n `got startFraction ${startFraction}`);\n assert(\n endFraction >= 0 && endFraction <= 1,\n () => `Progress fraction must be in range [0, 1], but ` +\n `got endFraction ${endFraction}`);\n assert(\n endFraction >= startFraction,\n () => `startFraction must be no more than endFraction, but ` +\n `got startFraction ${startFraction} and endFraction ` +\n `${endFraction}`);\n }\n\n return Promise.all(promises.map(registerMonitor));\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env} from '../environment';\n\nimport {NamedTensorMap} from '../tensor_types';\nimport * as util from '../util';\nimport {decodeWeights} from './io_utils';\nimport {monitorPromisesProgress} from './progress';\nimport {DTYPE_VALUE_SIZE_MAP, LoadOptions, WeightsManifestConfig, WeightsManifestEntry} from './types';\n\n/**\n * Reads binary weights data from a number of URLs.\n *\n * @param fetchURLs URLs to send the HTTP requests at, using `fetch` calls.\n * @param requestOptions RequestInit (options) for the HTTP requests.\n * @param fetchFunc Optional overriding value for the `window.fetch` function.\n * @param onProgress Optional, progress callback function, fired periodically\n * before the load is completed.\n * @returns A `Promise` of an Array of `ArrayBuffer`. The Array has the same\n * length as `fetchURLs`.\n */\nexport async function loadWeightsAsArrayBuffer(\n fetchURLs: string[], loadOptions?: LoadOptions): Promise {\n if (loadOptions == null) {\n loadOptions = {};\n }\n\n const fetchFunc = loadOptions.fetchFunc == null ? env().platform.fetch :\n loadOptions.fetchFunc;\n\n // Create the requests for all of the weights in parallel.\n const requests = fetchURLs.map(\n fetchURL =>\n fetchFunc(fetchURL, loadOptions.requestInit, {isBinary: true}));\n\n const fetchStartFraction = 0;\n const fetchEndFraction = 0.5;\n\n const responses = loadOptions.onProgress == null ?\n await Promise.all(requests) :\n await monitorPromisesProgress(\n requests, loadOptions.onProgress, fetchStartFraction,\n fetchEndFraction);\n\n const bufferPromises = responses.map(response => response.arrayBuffer());\n\n const bufferStartFraction = 0.5;\n const bufferEndFraction = 1;\n\n const buffers = loadOptions.onProgress == null ?\n await Promise.all(bufferPromises) :\n await monitorPromisesProgress(\n bufferPromises, loadOptions.onProgress, bufferStartFraction,\n bufferEndFraction);\n return buffers;\n}\n\n/**\n * Reads a weights manifest JSON configuration, fetches the weights and\n * returns them as `Tensor`s.\n *\n * @param manifest The weights manifest JSON.\n * @param filePathPrefix The path prefix for filenames given in the manifest.\n * Defaults to the empty string.\n * @param weightNames The names of the weights to be fetched.\n */\nexport async function loadWeights(\n manifest: WeightsManifestConfig, filePathPrefix = '',\n weightNames?: string[],\n requestInit?: RequestInit): Promise {\n // TODO(nsthorat): Groups are currently fetched atomically. If you need a\n // single weight from a group, the whole group will be fetched. At a future\n // date, we should support fetching only the individual shards within a\n // group that are needed to reconstruct the requested weight.\n // TODO(cais): Use `decodeWeights` for implementation.\n\n const fetchWeights = (fetchUrls: string[]) =>\n loadWeightsAsArrayBuffer(fetchUrls, {requestInit});\n const loadWeights = weightsLoaderFactory(fetchWeights);\n\n return loadWeights(manifest, filePathPrefix, weightNames);\n}\n\n/**\n * Creates a function, which reads a weights manifest JSON configuration,\n * fetches the weight files using the specified function and returns them as\n * `Tensor`s.\n *\n * ```js\n * // example for creating a nodejs weight loader, which reads the weight files\n * // from disk using fs.readFileSync\n *\n * import * as fs from 'fs'\n *\n * const fetchWeightsFromDisk = (filePaths: string[]) =>\n * filePaths.map(filePath => fs.readFileSync(filePath).buffer)\n *\n * const loadWeights = tf.io.weightsLoaderFactory(fetchWeightsFromDisk)\n *\n * const manifest = JSON.parse(\n * fs.readFileSync('./my_model-weights_manifest').toString()\n * )\n * const weightMap = await loadWeights(manifest, './')\n * ```\n * @param fetchWeightsFunction The function used for fetching the weight files.\n * @returns Weight loading function.\n */\nexport function weightsLoaderFactory(\n fetchWeightsFunction: (fetchUrls: string[]) => Promise):\n (manifest: WeightsManifestConfig, filePathPrefix?: string,\n weightNames?: string[]) => Promise {\n return async(\n manifest: WeightsManifestConfig, filePathPrefix = '',\n weightNames?: string[]): Promise => {\n // Collect all the groups, weights, and their relative offsets to be\n // fetched.\n const groupIndicesToFetchMap = manifest.map(() => false);\n const groupWeightsToFetch: {\n [group: number]: Array<{\n manifestEntry: WeightsManifestEntry; groupOffset: number;\n sizeBytes: number;\n }>\n } = {};\n const weightsFound =\n weightNames != null ? weightNames.map(() => false) : [];\n const allManifestWeightNames: string[] = [];\n manifest.forEach((manifestGroupConfig, groupIndex) => {\n let groupOffset = 0;\n manifestGroupConfig.weights.forEach(weightsEntry => {\n const rawDtype = ('quantization' in weightsEntry) ?\n weightsEntry.quantization.dtype :\n weightsEntry.dtype;\n\n const weightsBytes = DTYPE_VALUE_SIZE_MAP[rawDtype] *\n util.sizeFromShape(weightsEntry.shape);\n\n const enqueueWeightsForFetchingFn = () => {\n groupIndicesToFetchMap[groupIndex] = true;\n if (groupWeightsToFetch[groupIndex] == null) {\n groupWeightsToFetch[groupIndex] = [];\n }\n\n groupWeightsToFetch[groupIndex].push({\n manifestEntry: weightsEntry,\n groupOffset,\n sizeBytes: weightsBytes\n });\n };\n\n if (weightNames != null) {\n weightNames.forEach((weightName, weightIndex) => {\n if (weightName === weightsEntry.name) {\n enqueueWeightsForFetchingFn();\n weightsFound[weightIndex] = true;\n }\n });\n } else {\n enqueueWeightsForFetchingFn();\n }\n\n allManifestWeightNames.push(weightsEntry.name);\n groupOffset += weightsBytes;\n });\n });\n\n if (!weightsFound.every(found => found)) {\n const weightsNotFound = weightNames.filter((_, i) => !weightsFound[i]);\n throw new Error(\n `Could not find weights in manifest with names: ` +\n `${weightsNotFound.join(', ')}. \\n` +\n `Manifest JSON has weights with names: ` +\n `${allManifestWeightNames.join(', ')}.`);\n }\n\n // Convert the one-hot boolean groupId => shouldFetch map to a list of group\n // IDs.\n const groupIndicesToFetch =\n groupIndicesToFetchMap.reduce((accumulator, shouldFetch, i) => {\n if (shouldFetch) {\n accumulator.push(i);\n }\n return accumulator;\n }, []);\n\n const fetchUrls: string[] = [];\n groupIndicesToFetch.forEach(i => {\n manifest[i].paths.forEach(filepath => {\n const fetchUrl = filePathPrefix +\n (!filePathPrefix.endsWith('/') ? '/' : '') + filepath;\n fetchUrls.push(fetchUrl);\n });\n });\n const buffers = await fetchWeightsFunction(fetchUrls);\n\n const weightsTensorMap: NamedTensorMap = {};\n let bufferIndexOffset = 0;\n groupIndicesToFetch.forEach(i => {\n const numBuffers = manifest[i].paths.length;\n\n let groupBytes = 0;\n for (let i = 0; i < numBuffers; i++) {\n groupBytes += buffers[bufferIndexOffset + i].byteLength;\n }\n\n // Create a buffer for the whole group.\n const groupBuffer = new ArrayBuffer(groupBytes);\n const groupByteBuffer = new Uint8Array(groupBuffer);\n let groupBufferOffset = 0;\n for (let i = 0; i < numBuffers; i++) {\n const buffer = new Uint8Array(buffers[bufferIndexOffset + i]);\n groupByteBuffer.set(buffer, groupBufferOffset);\n groupBufferOffset += buffer.byteLength;\n }\n\n const weightsEntries = groupWeightsToFetch[i];\n weightsEntries.forEach(weightsEntry => {\n const byteBuffer = groupBuffer.slice(\n weightsEntry.groupOffset,\n weightsEntry.groupOffset + weightsEntry.sizeBytes);\n const nameToTensorMap =\n decodeWeights(byteBuffer, [weightsEntry.manifestEntry]);\n for (const name in nameToTensorMap) {\n weightsTensorMap[name] = nameToTensorMap[name];\n }\n });\n\n bufferIndexOffset += numBuffers;\n });\n\n return weightsTensorMap;\n };\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/**\n * IOHandler implementations based on HTTP requests in the web browser.\n *\n * Uses [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API).\n */\n\nimport {env} from '../environment';\n\nimport {assert} from '../util';\nimport {concatenateArrayBuffers, getModelArtifactsForJSON, getModelArtifactsInfoForJSON, getModelJSONForModelArtifacts, getWeightSpecs} from './io_utils';\nimport {IORouter, IORouterRegistry} from './router_registry';\nimport {IOHandler, LoadOptions, ModelArtifacts, ModelJSON, OnProgressCallback, SaveResult, WeightsManifestConfig, WeightsManifestEntry} from './types';\nimport {loadWeightsAsArrayBuffer} from './weights_loader';\n\nconst OCTET_STREAM_MIME_TYPE = 'application/octet-stream';\nconst JSON_TYPE = 'application/json';\nexport class HTTPRequest implements IOHandler {\n protected readonly path: string;\n protected readonly requestInit: RequestInit;\n\n private readonly fetch: Function;\n private readonly weightUrlConverter: (weightName: string) => Promise;\n\n readonly DEFAULT_METHOD = 'POST';\n\n static readonly URL_SCHEME_REGEX = /^https?:\\/\\//;\n\n private readonly weightPathPrefix: string;\n private readonly onProgress: OnProgressCallback;\n\n constructor(path: string, loadOptions?: LoadOptions) {\n if (loadOptions == null) {\n loadOptions = {};\n }\n this.weightPathPrefix = loadOptions.weightPathPrefix;\n this.onProgress = loadOptions.onProgress;\n this.weightUrlConverter = loadOptions.weightUrlConverter;\n\n if (loadOptions.fetchFunc != null) {\n assert(\n typeof loadOptions.fetchFunc === 'function',\n () => 'Must pass a function that matches the signature of ' +\n '`fetch` (see ' +\n 'https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)');\n this.fetch = loadOptions.fetchFunc;\n } else {\n this.fetch = env().platform.fetch;\n }\n\n assert(\n path != null && path.length > 0,\n () => 'URL path for http must not be null, undefined or ' +\n 'empty.');\n\n if (Array.isArray(path)) {\n assert(\n path.length === 2,\n () => 'URL paths for http must have a length of 2, ' +\n `(actual length is ${path.length}).`);\n }\n this.path = path;\n\n if (loadOptions.requestInit != null &&\n loadOptions.requestInit.body != null) {\n throw new Error(\n 'requestInit is expected to have no pre-existing body, but has one.');\n }\n this.requestInit = loadOptions.requestInit || {};\n }\n\n async save(modelArtifacts: ModelArtifacts): Promise {\n if (modelArtifacts.modelTopology instanceof ArrayBuffer) {\n throw new Error(\n 'BrowserHTTPRequest.save() does not support saving model topology ' +\n 'in binary formats yet.');\n }\n\n const init = Object.assign({method: this.DEFAULT_METHOD}, this.requestInit);\n init.body = new FormData();\n\n const weightsManifest: WeightsManifestConfig = [{\n paths: ['./model.weights.bin'],\n weights: modelArtifacts.weightSpecs,\n }];\n const modelTopologyAndWeightManifest: ModelJSON =\n getModelJSONForModelArtifacts(modelArtifacts, weightsManifest);\n\n init.body.append(\n 'model.json',\n new Blob(\n [JSON.stringify(modelTopologyAndWeightManifest)],\n {type: JSON_TYPE}),\n 'model.json');\n\n if (modelArtifacts.weightData != null) {\n init.body.append(\n 'model.weights.bin',\n new Blob([modelArtifacts.weightData], {type: OCTET_STREAM_MIME_TYPE}),\n 'model.weights.bin');\n }\n\n const response = await this.fetch(this.path, init);\n\n if (response.ok) {\n return {\n modelArtifactsInfo: getModelArtifactsInfoForJSON(modelArtifacts),\n responses: [response],\n };\n } else {\n throw new Error(\n `BrowserHTTPRequest.save() failed due to HTTP response status ` +\n `${response.status}.`);\n }\n }\n\n /**\n * Load model artifacts via HTTP request(s).\n *\n * See the documentation to `tf.io.http` for details on the saved\n * artifacts.\n *\n * @returns The loaded model artifacts (if loading succeeds).\n */\n async load(): Promise {\n const modelConfigRequest = await this.fetch(this.path, this.requestInit);\n\n if (!modelConfigRequest.ok) {\n throw new Error(\n `Request to ${this.path} failed with status code ` +\n `${modelConfigRequest.status}. Please verify this URL points to ` +\n `the model JSON of the model to load.`);\n }\n let modelJSON: ModelJSON;\n try {\n modelJSON = await modelConfigRequest.json();\n } catch (e) {\n let message = `Failed to parse model JSON of response from ${this.path}.`;\n // TODO(nsthorat): Remove this after some time when we're comfortable that\n // .pb files are mostly gone.\n if (this.path.endsWith('.pb')) {\n message += ' Your path contains a .pb file extension. ' +\n 'Support for .pb models have been removed in TensorFlow.js 1.0 ' +\n 'in favor of .json models. You can re-convert your Python ' +\n 'TensorFlow model using the TensorFlow.js 1.0 conversion scripts ' +\n 'or you can convert your.pb models with the \\'pb2json\\'' +\n 'NPM script in the tensorflow/tfjs-converter repository.';\n } else {\n message += ' Please make sure the server is serving valid ' +\n 'JSON for this request.';\n }\n throw new Error(message);\n }\n\n // We do not allow both modelTopology and weightsManifest to be missing.\n const modelTopology = modelJSON.modelTopology;\n const weightsManifest = modelJSON.weightsManifest;\n if (modelTopology == null && weightsManifest == null) {\n throw new Error(\n `The JSON from HTTP path ${this.path} contains neither model ` +\n `topology or manifest for weights.`);\n }\n\n return getModelArtifactsForJSON(\n modelJSON, (weightsManifest) => this.loadWeights(weightsManifest));\n }\n\n private async loadWeights(weightsManifest: WeightsManifestConfig):\n Promise<[WeightsManifestEntry[], ArrayBuffer]> {\n const weightPath = Array.isArray(this.path) ? this.path[1] : this.path;\n const [prefix, suffix] = parseUrl(weightPath);\n const pathPrefix = this.weightPathPrefix || prefix;\n\n const weightSpecs = getWeightSpecs(weightsManifest);\n\n const fetchURLs: string[] = [];\n const urlPromises: Array> = [];\n for (const weightsGroup of weightsManifest) {\n for (const path of weightsGroup.paths) {\n if (this.weightUrlConverter != null) {\n urlPromises.push(this.weightUrlConverter(path));\n } else {\n fetchURLs.push(pathPrefix + path + suffix);\n }\n }\n }\n\n if (this.weightUrlConverter) {\n fetchURLs.push(...await Promise.all(urlPromises));\n }\n\n const buffers = await loadWeightsAsArrayBuffer(fetchURLs, {\n requestInit: this.requestInit,\n fetchFunc: this.fetch,\n onProgress: this.onProgress\n });\n return [weightSpecs, concatenateArrayBuffers(buffers)];\n }\n}\n\n/**\n * Extract the prefix and suffix of the url, where the prefix is the path before\n * the last file, and suffix is the search params after the last file.\n * ```\n * const url = 'http://tfhub.dev/model/1/tensorflowjs_model.pb?tfjs-format=file'\n * [prefix, suffix] = parseUrl(url)\n * // prefix = 'http://tfhub.dev/model/1/'\n * // suffix = '?tfjs-format=file'\n * ```\n * @param url the model url to be parsed.\n */\nexport function parseUrl(url: string): [string, string] {\n const lastSlash = url.lastIndexOf('/');\n const lastSearchParam = url.lastIndexOf('?');\n const prefix = url.substring(0, lastSlash);\n const suffix =\n lastSearchParam > lastSlash ? url.substring(lastSearchParam) : '';\n return [prefix + '/', suffix];\n}\n\nexport function isHTTPScheme(url: string): boolean {\n return url.match(HTTPRequest.URL_SCHEME_REGEX) != null;\n}\n\nexport const httpRouter: IORouter =\n (url: string, loadOptions?: LoadOptions) => {\n if (typeof fetch === 'undefined' &&\n (loadOptions == null || loadOptions.fetchFunc == null)) {\n // `http` uses `fetch` or `node-fetch`, if one wants to use it in\n // an environment that is not the browser or node they have to setup a\n // global fetch polyfill.\n return null;\n } else {\n let isHTTP = true;\n if (Array.isArray(url)) {\n isHTTP = url.every(urlItem => isHTTPScheme(urlItem));\n } else {\n isHTTP = isHTTPScheme(url);\n }\n if (isHTTP) {\n return http(url, loadOptions);\n }\n }\n return null;\n };\nIORouterRegistry.registerSaveRouter(httpRouter);\nIORouterRegistry.registerLoadRouter(httpRouter);\n\n/**\n * Creates an IOHandler subtype that sends model artifacts to HTTP server.\n *\n * An HTTP request of the `multipart/form-data` mime type will be sent to the\n * `path` URL. The form data includes artifacts that represent the topology\n * and/or weights of the model. In the case of Keras-style `tf.Model`, two\n * blobs (files) exist in form-data:\n * - A JSON file consisting of `modelTopology` and `weightsManifest`.\n * - A binary weights file consisting of the concatenated weight values.\n * These files are in the same format as the one generated by\n * [tfjs_converter](https://js.tensorflow.org/tutorials/import-keras.html).\n *\n * The following code snippet exemplifies the client-side code that uses this\n * function:\n *\n * ```js\n * const model = tf.sequential();\n * model.add(\n * tf.layers.dense({units: 1, inputShape: [100], activation: 'sigmoid'}));\n *\n * const saveResult = await model.save(tf.io.http(\n * 'http://model-server:5000/upload', {requestInit: {method: 'PUT'}}));\n * console.log(saveResult);\n * ```\n *\n * If the default `POST` method is to be used, without any custom parameters\n * such as headers, you can simply pass an HTTP or HTTPS URL to `model.save`:\n *\n * ```js\n * const saveResult = await model.save('http://model-server:5000/upload');\n * ```\n *\n * The following GitHub Gist\n * https://gist.github.com/dsmilkov/1b6046fd6132d7408d5257b0976f7864\n * implements a server based on [flask](https://github.com/pallets/flask) that\n * can receive the request. Upon receiving the model artifacts via the requst,\n * this particular server reconstitutes instances of [Keras\n * Models](https://keras.io/models/model/) in memory.\n *\n *\n * @param path A URL path to the model.\n * Can be an absolute HTTP path (e.g.,\n * 'http://localhost:8000/model-upload)') or a relative path (e.g.,\n * './model-upload').\n * @param requestInit Request configurations to be used when sending\n * HTTP request to server using `fetch`. It can contain fields such as\n * `method`, `credentials`, `headers`, `mode`, etc. See\n * https://developer.mozilla.org/en-US/docs/Web/API/Request/Request\n * for more information. `requestInit` must not have a body, because the\n * body will be set by TensorFlow.js. File blobs representing the model\n * topology (filename: 'model.json') and the weights of the model (filename:\n * 'model.weights.bin') will be appended to the body. If `requestInit` has a\n * `body`, an Error will be thrown.\n * @param loadOptions Optional configuration for the loading. It includes the\n * following fields:\n * - weightPathPrefix Optional, this specifies the path prefix for weight\n * files, by default this is calculated from the path param.\n * - fetchFunc Optional, custom `fetch` function. E.g., in Node.js,\n * the `fetch` from node-fetch can be used here.\n * - onProgress Optional, progress callback function, fired periodically\n * before the load is completed.\n * @returns An instance of `IOHandler`.\n *\n * @doc {\n * heading: 'Models',\n * subheading: 'Loading',\n * namespace: 'io',\n * ignoreCI: true\n * }\n */\nexport function http(path: string, loadOptions?: LoadOptions): IOHandler {\n return new HTTPRequest(path, loadOptions);\n}\n\n/**\n * Deprecated. Use `tf.io.http`.\n * @param path\n * @param loadOptions\n */\nexport function browserHTTPRequest(\n path: string, loadOptions?: LoadOptions): IOHandler {\n return http(path, loadOptions);\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/**\n * IOHandlers that pass through the in-memory ModelArtifacts format.\n */\n\nimport {IOHandler, IOHandlerSync, LoadHandler, ModelArtifacts, SaveHandler, SaveResult, TrainingConfig, WeightsManifestEntry} from './types';\n\nclass PassthroughLoader implements IOHandlerSync {\n constructor(private readonly modelArtifacts?: ModelArtifacts) {}\n\n load(): ModelArtifacts {\n return this.modelArtifacts;\n }\n}\n\nclass PassthroughSaver> {\n constructor(\n private readonly saveHandler: (artifacts: ModelArtifacts) => R) {}\n\n save(modelArtifacts: ModelArtifacts): R {\n return this.saveHandler(modelArtifacts);\n }\n}\n\nclass PassthroughAsync implements IOHandler {\n load?: LoadHandler;\n save?: SaveHandler;\n\n constructor(handler: IOHandlerSync) {\n if (handler.load) {\n this.load = () => Promise.resolve(handler.load());\n }\n if (handler.save) {\n this.save = (modelArtifacts: ModelArtifacts) =>\n Promise.resolve(handler.save(modelArtifacts));\n }\n }\n}\n\n/**\n * Creates an IOHandler that loads model artifacts from memory.\n *\n * When used in conjunction with `tf.loadLayersModel`, an instance of\n * `tf.LayersModel` (Keras-style) can be constructed from the loaded artifacts.\n *\n * ```js\n * const model = await tf.loadLayersModel(tf.io.fromMemory(\n * modelTopology, weightSpecs, weightData));\n * ```\n *\n * @param modelArtifacts a object containing model topology (i.e., parsed from\n * the JSON format).\n * @param weightSpecs An array of `WeightsManifestEntry` objects describing the\n * names, shapes, types, and quantization of the weight data. Optional.\n * @param weightData A single `ArrayBuffer` containing the weight data,\n * concatenated in the order described by the weightSpecs. Optional.\n * @param trainingConfig Model training configuration. Optional.\n *\n * @returns A passthrough `IOHandler` that simply loads the provided data.\n */\nexport function fromMemory(\n modelArtifacts: {}|ModelArtifacts, weightSpecs?: WeightsManifestEntry[],\n weightData?: ArrayBuffer, trainingConfig?: TrainingConfig): IOHandler {\n\n const args = arguments as unknown as Parameters;\n return new PassthroughAsync(fromMemorySync(...args));\n}\n\n/**\n * Creates an IOHandler that loads model artifacts from memory.\n *\n * When used in conjunction with `tf.loadLayersModel`, an instance of\n * `tf.LayersModel` (Keras-style) can be constructed from the loaded artifacts.\n *\n * ```js\n * const model = await tf.loadLayersModel(tf.io.fromMemory(\n * modelTopology, weightSpecs, weightData));\n * ```\n *\n * @param modelArtifacts a object containing model topology (i.e., parsed from\n * the JSON format).\n * @param weightSpecs An array of `WeightsManifestEntry` objects describing the\n * names, shapes, types, and quantization of the weight data. Optional.\n * @param weightData A single `ArrayBuffer` containing the weight data,\n * concatenated in the order described by the weightSpecs. Optional.\n * @param trainingConfig Model training configuration. Optional.\n *\n * @returns A passthrough `IOHandlerSync` that simply loads the provided data.\n */\nexport function fromMemorySync(\n modelArtifacts: {}|ModelArtifacts, weightSpecs?: WeightsManifestEntry[],\n weightData?: ArrayBuffer, trainingConfig?: TrainingConfig): IOHandlerSync {\n if (arguments.length === 1) {\n const isModelArtifacts =\n (modelArtifacts as ModelArtifacts).modelTopology != null ||\n (modelArtifacts as ModelArtifacts).weightSpecs != null;\n if (isModelArtifacts) {\n return new PassthroughLoader(modelArtifacts as ModelArtifacts);\n } else {\n // Legacy support: with only modelTopology.\n // TODO(cais): Remove this deprecated API.\n console.warn(\n 'Please call tf.io.fromMemory() with only one argument. ' +\n 'The argument should be of type ModelArtifacts. ' +\n 'The multi-argument signature of tf.io.fromMemory() has been ' +\n 'deprecated and will be removed in a future release.');\n return new PassthroughLoader({modelTopology: modelArtifacts as {}});\n }\n } else {\n // Legacy support.\n // TODO(cais): Remove this deprecated API.\n console.warn(\n 'Please call tf.io.fromMemory() with only one argument. ' +\n 'The argument should be of type ModelArtifacts. ' +\n 'The multi-argument signature of tf.io.fromMemory() has been ' +\n 'deprecated and will be removed in a future release.');\n return new PassthroughLoader({\n modelTopology: modelArtifacts as {},\n weightSpecs,\n weightData,\n trainingConfig\n });\n }\n}\n\n/**\n * Creates an IOHandler that passes saved model artifacts to a callback.\n *\n * ```js\n * function handleSave(artifacts) {\n * // ... do something with the artifacts ...\n * return {modelArtifactsInfo: {...}, ...};\n * }\n *\n * const saveResult = model.save(tf.io.withSaveHandler(handleSave));\n * ```\n *\n * @param saveHandler A function that accepts a `ModelArtifacts` and returns a\n * promise that resolves to a `SaveResult`.\n */\nexport function withSaveHandler(\n saveHandler: (artifacts: ModelArtifacts) =>\n Promise): IOHandler {\n return new PassthroughSaver(saveHandler);\n}\n\n/**\n * Creates an IOHandlerSync that passes saved model artifacts to a callback.\n *\n * ```js\n * function handleSave(artifacts) {\n * // ... do something with the artifacts ...\n * return {modelArtifactsInfo: {...}, ...};\n * }\n *\n * const saveResult = model.save(tf.io.withSaveHandler(handleSave));\n * ```\n *\n * @param saveHandler A function that accepts a `ModelArtifacts` and returns a\n * `SaveResult`.\n */\nexport function withSaveHandlerSync(\n saveHandler: (artifacts: ModelArtifacts) => SaveResult): IOHandlerSync {\n return new PassthroughSaver(saveHandler);\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// Importing local_storage and indexed_db is necessary for the routers to be\n// registered.\nimport './indexed_db';\nimport './local_storage';\n\nimport {browserFiles} from './browser_files';\nimport {browserHTTPRequest, http, isHTTPScheme} from './http';\nimport {concatenateArrayBuffers, decodeWeights, encodeWeights, getModelArtifactsForJSON, getModelArtifactsForJSONSync, getModelArtifactsInfoForJSON, getWeightSpecs} from './io_utils';\nimport {fromMemory, fromMemorySync, withSaveHandler, withSaveHandlerSync} from './passthrough';\nimport {getLoadHandlers, getSaveHandlers, registerLoadRouter, registerSaveRouter} from './router_registry';\nimport {IOHandler, IOHandlerSync, LoadHandler, LoadOptions, ModelArtifacts, ModelArtifactsInfo, ModelJSON, ModelStoreManager, OnProgressCallback, RequestDetails, SaveConfig, SaveHandler, SaveResult, TrainingConfig, WeightGroup, WeightsManifestConfig, WeightsManifestEntry} from './types';\nimport {loadWeights, weightsLoaderFactory} from './weights_loader';\n\nexport {copyModel, listModels, moveModel, removeModel} from './model_management';\nexport {\n browserFiles,\n browserHTTPRequest,\n concatenateArrayBuffers,\n decodeWeights,\n encodeWeights,\n fromMemory,\n fromMemorySync,\n getLoadHandlers,\n getModelArtifactsForJSON,\n getModelArtifactsForJSONSync,\n getModelArtifactsInfoForJSON,\n getSaveHandlers,\n getWeightSpecs,\n http,\n IOHandler,\n IOHandlerSync,\n isHTTPScheme,\n LoadHandler,\n LoadOptions,\n loadWeights,\n ModelArtifacts,\n ModelArtifactsInfo,\n ModelJSON,\n ModelStoreManager,\n OnProgressCallback,\n registerLoadRouter,\n registerSaveRouter,\n RequestDetails,\n SaveConfig,\n SaveHandler,\n SaveResult,\n TrainingConfig,\n WeightGroup,\n weightsLoaderFactory,\n WeightsManifestConfig,\n WeightsManifestEntry,\n withSaveHandler,\n withSaveHandlerSync,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {BatchMatMul, BatchMatMulAttrs, BatchMatMulInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes the dot product of two matrices, A * B. These must be matrices.\n *\n * ```js\n * const a = tf.tensor2d([1, 2], [1, 2]);\n * const b = tf.tensor2d([1, 2, 3, 4], [2, 2]);\n *\n * a.matMul(b).print(); // or tf.matMul(a, b)\n * ```\n * @param a First matrix in dot product operation.\n * @param b Second matrix in dot product operation.\n * @param transposeA If true, `a` is transposed before multiplication.\n * @param transposeB If true, `b` is transposed before multiplication.\n *\n * @doc {heading: 'Operations', subheading: 'Matrices'}\n */\nfunction matMul_(\n a: Tensor|TensorLike, b: Tensor|TensorLike, transposeA = false,\n transposeB = false): T {\n let $a = convertToTensor(a, 'a', 'matMul');\n let $b = convertToTensor(b, 'b', 'matMul');\n [$a, $b] = makeTypesMatch($a, $b);\n\n const inputs: BatchMatMulInputs = {a: $a, b: $b};\n const attrs: BatchMatMulAttrs = {transposeA, transposeB};\n\n return ENGINE.runKernel(\n BatchMatMul, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const matMul = op({matMul_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {OneHot, OneHotAttrs, OneHotInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {DataType, TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Creates a one-hot `tf.Tensor`. The locations represented by `indices` take\n * value `onValue` (defaults to 1), while all other locations take value\n * `offValue` (defaults to 0). If `indices` is rank `R`, the output has rank\n * `R+1` with the last axis of size `depth`.\n * `indices` used to encode prediction class must start from 0. For example,\n * if you have 3 classes of data, class 1 should be encoded as 0, class 2\n * should be 1, and class 3 should be 2.\n *\n * ```js\n * tf.oneHot(tf.tensor1d([0, 1], 'int32'), 3).print();\n * ```\n *\n * @param indices `tf.Tensor` of indices with dtype `int32`. Indices must\n * start from 0.\n * @param depth The depth of the one hot dimension.\n * @param onValue A number used to fill in the output when the index matches\n * the location.\n * @param offValue A number used to fill in the output when the index does\n * not match the location.\n * @param dtype The dtype of the output tensor, default to 'int32'.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nfunction oneHot_(\n indices: Tensor|TensorLike, depth: number, onValue = 1, offValue = 0,\n dtype: DataType = 'int32'): Tensor {\n if (depth < 2) {\n throw new Error(`Error in oneHot: depth must be >=2, but it is ${depth}`);\n }\n const $indices = convertToTensor(indices, 'indices', 'oneHot', 'int32');\n\n const inputs: OneHotInputs = {indices: $indices};\n const attrs: OneHotAttrs = {dtype, depth, onValue, offValue};\n\n return ENGINE.runKernel(\n OneHot, inputs as unknown as NamedTensorMap,\n attrs as unknown as NamedAttrMap);\n}\n\nexport const oneHot = op({oneHot_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelBackend} from './backends/backend';\nimport {ENGINE, Engine, MemoryInfo, ProfileInfo, ScopeFn, TimingInfo} from './engine';\nimport {env} from './environment';\n\nimport {Platform} from './platforms/platform';\nimport {setDeprecationWarningFn, Tensor} from './tensor';\nimport {TensorContainer} from './tensor_types';\nimport {getTensorsInContainer} from './tensor_util';\n\n/**\n * Enables production mode which disables correctness checks in favor of\n * performance.\n *\n * @doc {heading: 'Environment'}\n */\nexport function enableProdMode(): void {\n env().set('PROD', true);\n}\n\n/**\n * Enables debug mode which will log information about all executed kernels:\n * the elapsed time of the kernel execution, as well as the rank, shape, and\n * size of the output tensor.\n *\n * Debug mode will significantly slow down your application as it will\n * download the result of every operation to the CPU. This should not be used in\n * production. Debug mode does not affect the timing information of the kernel\n * execution as we do not measure download time in the kernel execution time.\n *\n * See also: `tf.profile`, `tf.memory`.\n *\n * @doc {heading: 'Environment'}\n */\nexport function enableDebugMode(): void {\n env().set('DEBUG', true);\n}\n\n/** Globally disables deprecation warnings */\nexport function disableDeprecationWarnings(): void {\n env().set('DEPRECATION_WARNINGS_ENABLED', false);\n console.warn(`TensorFlow.js deprecation warnings have been disabled.`);\n}\n\n/** Warn users about deprecated functionality. */\nexport function deprecationWarn(msg: string) {\n if (env().getBool('DEPRECATION_WARNINGS_ENABLED')) {\n console.warn(\n msg + ' You can disable deprecation warnings with ' +\n 'tf.disableDeprecationWarnings().');\n }\n}\nsetDeprecationWarningFn(deprecationWarn);\n\n/**\n * Dispose all variables kept in backend engine.\n *\n * @doc {heading: 'Environment'}\n */\nexport function disposeVariables(): void {\n ENGINE.disposeVariables();\n}\n\n/**\n * It returns the global engine that keeps track of all tensors and backends.\n *\n * @doc {heading: 'Environment'}\n */\nexport function engine(): Engine {\n return ENGINE;\n}\n\n/**\n * Returns memory info at the current time in the program. The result is an\n * object with the following properties:\n *\n * - `numBytes`: Number of bytes allocated (undisposed) at this time.\n * - `numTensors`: Number of unique tensors allocated.\n * - `numDataBuffers`: Number of unique data buffers allocated\n * (undisposed) at this time, which is ≤ the number of tensors\n * (e.g. `a.reshape(newShape)` makes a new Tensor that shares the same\n * data buffer with `a`).\n * - `unreliable`: True if the memory usage is unreliable. See `reasons` when\n * `unreliable` is true.\n * - `reasons`: `string[]`, reasons why the memory is unreliable, present if\n * `unreliable` is true.\n *\n * WebGL Properties:\n * - `numBytesInGPU`: Number of bytes allocated (undisposed) in the GPU only at\n * this time.\n *\n * @doc {heading: 'Performance', subheading: 'Memory'}\n */\nexport function memory(): MemoryInfo {\n return ENGINE.memory();\n}\n\n/**\n * Executes the provided function `f()` and returns a promise that resolves\n * with information about the function's memory use:\n * - `newBytes`: the number of new bytes allocated\n * - `newTensors`: the number of new tensors created\n * - `peakBytes`: the peak number of bytes allocated\n * - `kernels`: an array of objects for each kernel involved that reports\n * their input and output shapes, number of bytes used, and number of new\n * tensors created.\n * - `kernelNames`: an array of unique strings with just the names of the\n * kernels in the `kernels` array.\n *\n * ```js\n * const profile = await tf.profile(() => {\n * const x = tf.tensor1d([1, 2, 3]);\n * let x2 = x.square();\n * x2.dispose();\n * x2 = x.square();\n * x2.dispose();\n * return x;\n * });\n *\n * console.log(`newBytes: ${profile.newBytes}`);\n * console.log(`newTensors: ${profile.newTensors}`);\n * console.log(`byte usage over all kernels: ${profile.kernels.map(k =>\n * k.totalBytesSnapshot)}`);\n * ```\n *\n *\n * @doc {heading: 'Performance', subheading: 'Profile'}\n */\nexport function profile(f: () => (TensorContainer | Promise)):\n Promise {\n return ENGINE.profile(f);\n}\n\n/**\n * Executes the provided function `fn` and after it is executed, cleans up all\n * intermediate tensors allocated by `fn` except those returned by `fn`.\n * `fn` must not return a Promise (async functions not allowed). The returned\n * result can be a complex object.\n *\n * Using this method helps avoid memory leaks. In general, wrap calls to\n * operations in `tf.tidy` for automatic memory cleanup.\n *\n * NOTE: Variables do *not* get cleaned up when inside a tidy(). If you want to\n * dispose variables, please use `tf.disposeVariables` or call dispose()\n * directly on variables.\n *\n * ```js\n * // y = 2 ^ 2 + 1\n * const y = tf.tidy(() => {\n * // a, b, and one will be cleaned up when the tidy ends.\n * const one = tf.scalar(1);\n * const a = tf.scalar(2);\n * const b = a.square();\n *\n * console.log('numTensors (in tidy): ' + tf.memory().numTensors);\n *\n * // The value returned inside the tidy function will return\n * // through the tidy, in this case to the variable y.\n * return b.add(one);\n * });\n *\n * console.log('numTensors (outside tidy): ' + tf.memory().numTensors);\n * y.print();\n * ```\n *\n * @param nameOrFn The name of the closure, or the function to execute.\n * If a name is provided, the 2nd argument should be the function.\n * If debug mode is on, the timing and the memory usage of the function\n * will be tracked and displayed on the console using the provided name.\n * @param fn The function to execute.\n *\n * @doc {heading: 'Performance', subheading: 'Memory'}\n */\nexport function tidy(\n nameOrFn: string|ScopeFn, fn?: ScopeFn): T {\n return ENGINE.tidy(nameOrFn, fn);\n}\n\n/**\n * Disposes any `tf.Tensor`s found within the provided object.\n *\n * @param container an object that may be a `tf.Tensor` or may directly\n * contain `tf.Tensor`s, such as a `Tensor[]` or `{key: Tensor, ...}`. If\n * the object is not a `tf.Tensor` or does not contain `Tensors`, nothing\n * happens. In general it is safe to pass any object here, except that\n * `Promise`s are not supported.\n *\n * @doc {heading: 'Performance', subheading: 'Memory'}\n */\nexport function dispose(container: TensorContainer) {\n const tensors = getTensorsInContainer(container);\n tensors.forEach(tensor => tensor.dispose());\n}\n\n/**\n * Keeps a `tf.Tensor` generated inside a `tf.tidy` from being disposed\n * automatically.\n *\n * ```js\n * let b;\n * const y = tf.tidy(() => {\n * const one = tf.scalar(1);\n * const a = tf.scalar(2);\n *\n * // b will not be cleaned up by the tidy. a and one will be cleaned up\n * // when the tidy ends.\n * b = tf.keep(a.square());\n *\n * console.log('numTensors (in tidy): ' + tf.memory().numTensors);\n *\n * // The value returned inside the tidy function will return\n * // through the tidy, in this case to the variable y.\n * return b.add(one);\n * });\n *\n * console.log('numTensors (outside tidy): ' + tf.memory().numTensors);\n * console.log('y:');\n * y.print();\n * console.log('b:');\n * b.print();\n * ```\n *\n * @param result The tensor to keep from being disposed.\n *\n * @doc {heading: 'Performance', subheading: 'Memory'}\n */\nexport function keep(result: T): T {\n return ENGINE.keep(result);\n}\n\n/**\n * Executes `f()` and returns a promise that resolves with timing\n * information.\n *\n * The result is an object with the following properties:\n *\n * - `wallMs`: Wall execution time.\n * - `kernelMs`: Kernel execution time, ignoring data transfer. If using the\n * WebGL backend and the query timer extension is not available, this will\n * return an error object.\n * - On `WebGL` The following additional properties exist:\n * - `uploadWaitMs`: CPU blocking time on texture uploads.\n * - `downloadWaitMs`: CPU blocking time on texture downloads (readPixels).\n *\n * ```js\n * const x = tf.randomNormal([20, 20]);\n * const time = await tf.time(() => x.matMul(x));\n *\n * console.log(`kernelMs: ${time.kernelMs}, wallTimeMs: ${time.wallMs}`);\n * ```\n *\n * @param f The function to execute and time.\n *\n * @doc {heading: 'Performance', subheading: 'Timing'}\n */\nexport function time(f: () => void): Promise {\n return ENGINE.time(f);\n}\n\n/**\n * Sets the backend (cpu, webgl, wasm, etc) responsible for creating tensors and\n * executing operations on those tensors. Returns a promise that resolves\n * to a boolean if the backend initialization was successful.\n *\n * Note this disposes the current backend, if any, as well as any tensors\n * associated with it. A new backend is initialized, even if it is of the\n * same type as the previous one.\n *\n * @param backendName The name of the backend. Currently supports\n * `'webgl'|'cpu'` in the browser, `'tensorflow'` under node.js\n * (requires tfjs-node), and `'wasm'` (requires tfjs-backend-wasm).\n *\n * @doc {heading: 'Backends'}\n */\nexport function setBackend(backendName: string): Promise {\n return ENGINE.setBackend(backendName);\n}\n\n/**\n * Returns a promise that resolves when the currently selected backend (or the\n * highest priority one) has initialized. Await this promise when you are using\n * a backend that has async initialization.\n *\n * @doc {heading: 'Backends'}\n */\nexport function ready(): Promise {\n return ENGINE.ready();\n}\n\n/**\n * Returns the current backend name (cpu, webgl, etc). The backend is\n * responsible for creating tensors and executing operations on those tensors.\n *\n * @doc {heading: 'Backends'}\n */\nexport function getBackend(): string {\n return ENGINE.backendName;\n}\n\n/**\n * Removes a backend and the registered factory.\n *\n * @doc {heading: 'Backends'}\n */\nexport function removeBackend(name: string): void {\n ENGINE.removeBackend(name);\n}\n\n/**\n * Finds the backend registered under the provided name. Returns null if the\n * name is not in the registry, or the registration hasn't finished yet.\n */\nexport function findBackend(name: string): KernelBackend {\n return ENGINE.findBackend(name);\n}\n\n/**\n * Finds the backend factory registered under the provided name. Returns a\n * function that produces a new backend when called. Returns null if the name\n * is not in the registry.\n */\nexport function findBackendFactory(name: string): () =>\n KernelBackend | Promise {\n return ENGINE.findBackendFactory(name);\n}\n\n/**\n * Registers a global backend. The registration should happen when importing\n * a module file (e.g. when importing `backend_webgl.ts`), and is used for\n * modular builds (e.g. custom tfjs bundle with only webgl support).\n *\n * @param factory The backend factory function. When called, it should\n * return a backend instance, or a promise of an instance.\n * @param priority The priority of the backend (higher = more important).\n * In case multiple backends are registered, the priority is used to find\n * the best backend. Defaults to 1.\n * @return False if there is already a registered backend under this name, true\n * if not.\n *\n * @doc {heading: 'Backends'}\n */\nexport function registerBackend(\n name: string, factory: () => KernelBackend | Promise,\n priority = 1): boolean {\n return ENGINE.registerBackend(name, factory, priority);\n}\n\n/**\n * Gets the current backend. If no backends have been initialized, this will\n * attempt to initialize the best backend. Will throw an error if the highest\n * priority backend has async initialization, in which case you should call\n * 'await tf.ready()' before running other code.\n *\n * @doc {heading: 'Backends'}\n */\nexport function backend(): KernelBackend {\n return ENGINE.backend;\n}\n\n/**\n * Sets the global platform.\n *\n * @param platformName The name of this platform.\n * @param platform A platform implementation.\n */\nexport function setPlatform(platformName: string, platform: Platform) {\n env().setPlatform(platformName, platform);\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Imag, ImagInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {op} from './operation';\n/**\n * Returns the imaginary part of a complex (or real) tensor.\n *\n * Given a tensor input, this operation returns a tensor of type float that is\n * the imaginary part of each element in input considered as a complex number.\n * If input is real, a tensor of all zeros is returned.\n *\n * ```js\n * const x = tf.complex([-2.25, 3.25], [4.75, 5.75]);\n * tf.imag(x).print();\n * ```\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nfunction imag_(input: T|TensorLike): T {\n const $input = convertToTensor(input, 'input', 'imag');\n\n const inputs: ImagInputs = {input: $input};\n return ENGINE.runKernel(Imag, inputs as {} as NamedTensorMap);\n}\n\nexport const imag = op({imag_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Neg, NegInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes `-1 * x` element-wise.\n *\n * ```js\n * const x = tf.tensor2d([1, 2, -2, 0], [2, 2]);\n *\n * x.neg().print(); // or tf.neg(x)\n * ```\n *\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction neg_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'neg');\n\n const inputs: NegInputs = {x: $x};\n return ENGINE.runKernel(Neg, inputs as {} as NamedTensorMap);\n}\nexport const neg = op({neg_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Real, RealInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {op} from './operation';\n\n/**\n * Returns the real part of a complex (or real) tensor.\n *\n * Given a tensor input, this operation returns a tensor of type float that is\n * the real part of each element in input considered as a complex number.\n *\n * If the input is real, it simply makes a clone.\n *\n * ```js\n * const x = tf.complex([-2.25, 3.25], [4.75, 5.75]);\n * tf.real(x).print();\n * ```\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nfunction real_(input: T|TensorLike): T {\n const $input = convertToTensor(input, 'input', 'real');\n\n const inputs: RealInputs = {input: $input};\n return ENGINE.runKernel(Real, inputs as {} as NamedTensorMap);\n}\n\nexport const real = op({real_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {tidy} from '../globals';\nimport {Transpose, TransposeAttrs, TransposeInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\nimport {complex} from './complex';\nimport {imag} from './imag';\nimport {neg} from './neg';\nimport {op} from './operation';\nimport {real} from './real';\n\n/**\n * Transposes the `tf.Tensor`. Permutes the dimensions according to `perm`.\n *\n * The returned `tf.Tensor`'s dimension `i` will correspond to the input\n * dimension `perm[i]`. If `perm` is not given, it is set to `[n-1...0]`,\n * where `n` is the rank of the input `tf.Tensor`. Hence by default, this\n * operation performs a regular matrix transpose on 2-D input `tf.Tensor`s.\n *\n * ```js\n * const a = tf.tensor2d([1, 2, 3, 4, 5, 6], [2, 3]);\n *\n * a.transpose().print(); // or tf.transpose(a)\n * ```\n *\n * @param x The tensor to transpose.\n * @param perm The permutation of the dimensions of a.\n * @param conjugate Will conjugate complex input if true.\n *\n * @doc {heading: 'Operations', subheading: 'Matrices'}\n */\nfunction transpose_(\n x: T|TensorLike, perm?: number[], conjugate?: boolean): T {\n const $x = convertToTensor(x, 'x', 'transpose');\n\n if (perm == null) {\n perm = $x.shape.map((s, i) => i).reverse();\n }\n util.assert(\n $x.rank === perm.length,\n () => `Error in transpose: rank of input ${$x.rank} ` +\n `must match length of perm ${perm}.`);\n perm.forEach(axis => {\n util.assert(\n axis >= 0 && axis < $x.rank,\n () => `All entries in 'perm' must be between 0 and ${$x.rank - 1}` +\n ` but got ${perm}`);\n });\n\n if ($x.rank <= 1) {\n return $x.clone();\n }\n\n const inputs: TransposeInputs = {x: $x};\n const attrs: TransposeAttrs = {perm};\n\n if ($x.dtype === 'complex64') {\n return tidy(() => {\n let $real = real($x);\n let $imag = imag($x);\n $real = ENGINE.runKernel(\n Transpose, {x: $real} as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap);\n $imag = ENGINE.runKernel(\n Transpose, {x: $imag} as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap);\n if (conjugate) {\n $imag = neg($imag);\n }\n return complex($real, $imag);\n });\n }\n\n return ENGINE.runKernel(\n Transpose, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const transpose = op({transpose_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor1D, Tensor2D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {cast} from './cast';\nimport {matMul} from './mat_mul';\nimport {oneHot} from './one_hot';\nimport {op} from './operation';\nimport {transpose} from './transpose';\n\n/**\n * Computes the confusion matrix from true labels and predicted labels.\n *\n * ```js\n * const labels = tf.tensor1d([0, 1, 2, 1, 0], 'int32');\n * const predictions = tf.tensor1d([0, 2, 2, 1, 0], 'int32');\n * const numClasses = 3;\n * const out = tf.math.confusionMatrix(labels, predictions, numClasses);\n * out.print();\n * // Expected output matrix:\n * // [[2, 0, 0],\n * // [0, 1, 1],\n * // [0, 0, 1]]\n * ```\n *\n * @param labels The target labels, assumed to be 0-based integers\n * for the classes. The shape is `[numExamples]`, where\n * `numExamples` is the number of examples included.\n * @param predictions The predicted classes, assumed to be\n * 0-based integers for the classes. Must have the same shape as `labels`.\n * @param numClasses Number of all classes, as an integer.\n * Its value must be larger than the largest element in `labels` and\n * `predictions`.\n * @returns The confusion matrix as a int32-type 2D tensor. The value at\n * row `r` and column `c` is the number of times examples of actual class\n * `r` were predicted as class `c`.\n *\n * @doc {heading: 'Operations', subheading: 'Evaluation'}\n */\nexport function confusionMatrix_(\n labels: Tensor1D|TensorLike, predictions: Tensor1D|TensorLike,\n numClasses: number): Tensor2D {\n const $labels = convertToTensor(labels, 'labels', 'confusionMatrix');\n const $predictions =\n convertToTensor(predictions, 'predictions', 'confusionMatrix');\n\n util.assert(\n numClasses == null || numClasses > 0 && Number.isInteger(numClasses),\n () => `If provided, numClasses must be a positive integer, ` +\n `but got ${numClasses}`);\n util.assert(\n $labels.rank === 1,\n () => `Expected the rank of labels to be 1, but got ${$labels.rank}`);\n util.assert(\n $predictions.rank === 1,\n () => `Expected the rank of predictions to be 1, ` +\n `but got ${$predictions.rank}`);\n util.assert(\n $labels.shape[0] === $predictions.shape[0],\n () => `Mismatch in the number of examples: ` +\n `${$labels.shape[0]} vs. ${$predictions.shape[0]}. ` +\n `Labels and predictions should have the same number of elements.`);\n util.assert(\n numClasses > 0 && Number.isInteger(numClasses),\n () => `numClasses is required to be a positive integer, but got ` +\n `${numClasses}`);\n // TODO(cais): In the future, if oneHot supports tensors inputs for\n // `numClasses`, `confusionMatrix` can make `numClasses` optional.\n\n const oneHotLabels = oneHot(cast($labels, 'int32'), numClasses) as Tensor2D;\n const oneHotPredictions =\n oneHot(cast($predictions, 'int32'), numClasses) as Tensor2D;\n const oneHotLabelsT: Tensor2D = transpose(oneHotLabels);\n const product: Tensor2D = matMul(oneHotLabelsT, oneHotPredictions);\n return cast(product, 'int32');\n}\n\nexport const confusionMatrix = op({confusionMatrix_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/**\n * Exports under the tf.math.* namespace.\n */\n\nimport {confusionMatrix} from './ops/confusion_matrix';\n\nexport {confusionMatrix};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/**\n * Returns the dimensions in the input shape that are broadcasted to\n * produce the provided output shape.\n *\n * The returned dimensions are 0-indexed and sorted. An example:\n * inShape = [4, 1, 3]\n * outShape = [5, 4, 3, 3]\n * result = [1]. Dimension 1 (2nd dimension of input) gets broadcasted 1 => 3.\n */\nexport function getBroadcastDims(\n inShape: number[], outShape: number[]): number[] {\n const inRank = inShape.length;\n const dims: number[] = [];\n for (let i = 0; i < inRank; i++) {\n const dim = inRank - 1 - i;\n const a = inShape[dim] || 1;\n const b = outShape[outShape.length - 1 - i] || 1;\n if (b > 1 && a === 1) {\n dims.unshift(dim);\n }\n }\n return dims;\n}\n\n/**\n * Returns the axes in the output space that should be reduced to produce\n * the input space.\n */\nexport function getReductionAxes(\n inShape: number[], outShape: number[]): number[] {\n const result: number[] = [];\n for (let i = 0; i < outShape.length; i++) {\n const inDim = inShape[inShape.length - i - 1];\n const outAxis = outShape.length - i - 1;\n const outDim = outShape[outAxis];\n if (inDim == null || (inDim === 1 && outDim > 1)) {\n result.unshift(outAxis);\n }\n }\n return result;\n}\n\nexport function assertAndGetBroadcastShape(\n shapeA: number[], shapeB: number[]): number[] {\n const result: number[] = [];\n const l = Math.max(shapeA.length, shapeB.length);\n\n for (let i = 0; i < l; i++) {\n let a = shapeA[shapeA.length - i - 1];\n if (a == null) {\n a = 1;\n }\n let b = shapeB[shapeB.length - i - 1];\n if (b == null) {\n b = 1;\n }\n if (a === 1) {\n result.unshift(b);\n } else if (b === 1) {\n result.unshift(a);\n } else if (a !== b) {\n const errMsg = `Operands could not be broadcast together with shapes ` +\n `${shapeA} and ${shapeB}.`;\n throw Error(errMsg);\n } else {\n result.unshift(a);\n }\n }\n return result;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor3D} from '../tensor';\nimport {inferShape} from '../tensor_util_env';\nimport {TensorLike3D} from '../types';\nimport {DataType} from '../types';\nimport {assertNonNull} from '../util';\nimport {makeTensor} from './tensor_ops_util';\n\n/**\n * Creates rank-3 `tf.Tensor` with the provided values, shape and dtype.\n *\n * The same functionality can be achieved with `tf.tensor`, but in general\n * we recommend using `tf.tensor3d` as it makes the code more readable.\n *\n * ```js\n * // Pass a nested array.\n * tf.tensor3d([[[1], [2]], [[3], [4]]]).print();\n * ```\n * ```js\n * // Pass a flat array and specify a shape.\n * tf.tensor3d([1, 2, 3, 4], [2, 2, 1]).print();\n * ```\n *\n * @param values The values of the tensor. Can be nested array of numbers,\n * or a flat array, or a `TypedArray`.\n * @param shape The shape of the tensor. If not provided, it is inferred from\n * `values`.\n * @param dtype The data type.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nexport function tensor3d(\n values: TensorLike3D, shape?: [number, number, number],\n dtype?: DataType): Tensor3D {\n assertNonNull(values);\n if (shape != null && shape.length !== 3) {\n throw new Error('tensor3d() requires shape to have three numbers');\n }\n const inferredShape = inferShape(values, dtype);\n if (inferredShape.length !== 3 && inferredShape.length !== 1) {\n throw new Error(\n 'tensor3d() requires values to be number[][][] or flat/TypedArray');\n }\n if (inferredShape.length === 1 && shape == null) {\n throw new Error(\n 'tensor3d() requires shape to be provided when `values` ' +\n 'are a flat array');\n }\n return makeTensor(values, shape, inferredShape, dtype) as Tensor3D;\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {env} from '../environment';\nimport {FromPixels, FromPixelsAttrs, FromPixelsInputs} from '../kernel_names';\nimport {getKernel, NamedAttrMap} from '../kernel_registry';\nimport {Tensor, Tensor2D, Tensor3D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {PixelData, TensorLike} from '../types';\n\nimport {cast} from './cast';\nimport {op} from './operation';\nimport {tensor3d} from './tensor3d';\n\nlet fromPixels2DContext: CanvasRenderingContext2D;\n\n/**\n * Creates a `tf.Tensor` from an image.\n *\n * ```js\n * const image = new ImageData(1, 1);\n * image.data[0] = 100;\n * image.data[1] = 150;\n * image.data[2] = 200;\n * image.data[3] = 255;\n *\n * tf.browser.fromPixels(image).print();\n * ```\n *\n * @param pixels The input image to construct the tensor from. The\n * supported image types are all 4-channel. You can also pass in an image\n * object with following attributes:\n * `{data: Uint8Array; width: number; height: number}`\n * @param numChannels The number of channels of the output tensor. A\n * numChannels value less than 4 allows you to ignore channels. Defaults to\n * 3 (ignores alpha channel of input image).\n *\n * @returns A Tensor3D with the shape `[height, width, numChannels]`.\n *\n * Note: fromPixels can be lossy in some cases, same image may result in\n * slightly different tensor values, if rendered by different rendering\n * engines. This means that results from different browsers, or even same\n * browser with CPU and GPU rendering engines can be different. See discussion\n * in details:\n * https://github.com/tensorflow/tfjs/issues/5482\n *\n * @doc {heading: 'Browser', namespace: 'browser', ignoreCI: true}\n */\nfunction fromPixels_(\n pixels: PixelData|ImageData|HTMLImageElement|HTMLCanvasElement|\n HTMLVideoElement|ImageBitmap,\n numChannels = 3): Tensor3D {\n // Sanity checks.\n if (numChannels > 4) {\n throw new Error(\n 'Cannot construct Tensor with more than 4 channels from pixels.');\n }\n if (pixels == null) {\n throw new Error('pixels passed to tf.browser.fromPixels() can not be null');\n }\n let isPixelData = false;\n let isImageData = false;\n let isVideo = false;\n let isImage = false;\n let isCanvasLike = false;\n let isImageBitmap = false;\n if ((pixels as PixelData).data instanceof Uint8Array) {\n isPixelData = true;\n } else if (\n typeof (ImageData) !== 'undefined' && pixels instanceof ImageData) {\n isImageData = true;\n } else if (\n typeof (HTMLVideoElement) !== 'undefined' &&\n pixels instanceof HTMLVideoElement) {\n isVideo = true;\n } else if (\n typeof (HTMLImageElement) !== 'undefined' &&\n pixels instanceof HTMLImageElement) {\n isImage = true;\n // tslint:disable-next-line: no-any\n } else if ((pixels as any).getContext != null) {\n isCanvasLike = true;\n } else if (\n typeof (ImageBitmap) !== 'undefined' && pixels instanceof ImageBitmap) {\n isImageBitmap = true;\n } else {\n throw new Error(\n 'pixels passed to tf.browser.fromPixels() must be either an ' +\n `HTMLVideoElement, HTMLImageElement, HTMLCanvasElement, ImageData ` +\n `in browser, or OffscreenCanvas, ImageData in webworker` +\n ` or {data: Uint32Array, width: number, height: number}, ` +\n `but was ${(pixels as {}).constructor.name}`);\n }\n // If the current backend has 'FromPixels' registered, it has a more\n // efficient way of handling pixel uploads, so we call that.\n const kernel = getKernel(FromPixels, ENGINE.backendName);\n if (kernel != null) {\n const inputs: FromPixelsInputs = {pixels};\n const attrs: FromPixelsAttrs = {numChannels};\n return ENGINE.runKernel(\n FromPixels, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap);\n }\n\n const [width, height] = isVideo ?\n [\n (pixels as HTMLVideoElement).videoWidth,\n (pixels as HTMLVideoElement).videoHeight\n ] :\n [pixels.width, pixels.height];\n let vals: Uint8ClampedArray|Uint8Array;\n\n if (isCanvasLike) {\n vals =\n // tslint:disable-next-line:no-any\n (pixels as any).getContext('2d').getImageData(0, 0, width, height).data;\n } else if (isImageData || isPixelData) {\n vals = (pixels as PixelData | ImageData).data;\n } else if (isImage || isVideo || isImageBitmap) {\n if (fromPixels2DContext == null) {\n if (typeof document === 'undefined') {\n if (typeof OffscreenCanvas !== 'undefined' &&\n typeof OffscreenCanvasRenderingContext2D !== 'undefined') {\n // @ts-ignore\n fromPixels2DContext = new OffscreenCanvas(1, 1).getContext('2d');\n } else {\n throw new Error(\n 'Cannot parse input in current context. ' +\n 'Reason: OffscreenCanvas Context2D rendering is not supported.');\n }\n } else {\n fromPixels2DContext =\n document.createElement('canvas').getContext(\n '2d', {willReadFrequently: true});\n }\n }\n fromPixels2DContext.canvas.width = width;\n fromPixels2DContext.canvas.height = height;\n fromPixels2DContext.drawImage(\n pixels as HTMLVideoElement, 0, 0, width, height);\n vals = fromPixels2DContext.getImageData(0, 0, width, height).data;\n }\n let values: Int32Array;\n if (numChannels === 4) {\n values = new Int32Array(vals);\n } else {\n const numPixels = width * height;\n values = new Int32Array(numPixels * numChannels);\n for (let i = 0; i < numPixels; i++) {\n for (let channel = 0; channel < numChannels; ++channel) {\n values[i * numChannels + channel] = vals[i * 4 + channel];\n }\n }\n }\n const outShape: [number, number, number] = [height, width, numChannels];\n return tensor3d(values, outShape, 'int32');\n}\n\n// Helper functions for |fromPixelsAsync| to check whether the input can\n// be wrapped into imageBitmap.\nfunction isPixelData(pixels: PixelData|ImageData|HTMLImageElement|\n HTMLCanvasElement|HTMLVideoElement|\n ImageBitmap): pixels is PixelData {\n return (pixels != null) && ((pixels as PixelData).data instanceof Uint8Array);\n}\n\nfunction isImageBitmapFullySupported() {\n return typeof window !== 'undefined' &&\n typeof (ImageBitmap) !== 'undefined' &&\n window.hasOwnProperty('createImageBitmap');\n}\n\nfunction isNonEmptyPixels(pixels: PixelData|ImageData|HTMLImageElement|\n HTMLCanvasElement|HTMLVideoElement|ImageBitmap) {\n return pixels != null && pixels.width !== 0 && pixels.height !== 0;\n}\n\nfunction canWrapPixelsToImageBitmap(pixels: PixelData|ImageData|\n HTMLImageElement|HTMLCanvasElement|\n HTMLVideoElement|ImageBitmap) {\n return isImageBitmapFullySupported() && !(pixels instanceof ImageBitmap) &&\n isNonEmptyPixels(pixels) && !isPixelData(pixels);\n}\n\n/**\n * Creates a `tf.Tensor` from an image in async way.\n *\n * ```js\n * const image = new ImageData(1, 1);\n * image.data[0] = 100;\n * image.data[1] = 150;\n * image.data[2] = 200;\n * image.data[3] = 255;\n *\n * (await tf.browser.fromPixelsAsync(image)).print();\n * ```\n * This API is the async version of fromPixels. The API will first\n * check |WRAP_TO_IMAGEBITMAP| flag, and try to wrap the input to\n * imageBitmap if the flag is set to true.\n *\n * @param pixels The input image to construct the tensor from. The\n * supported image types are all 4-channel. You can also pass in an image\n * object with following attributes:\n * `{data: Uint8Array; width: number; height: number}`\n * @param numChannels The number of channels of the output tensor. A\n * numChannels value less than 4 allows you to ignore channels. Defaults to\n * 3 (ignores alpha channel of input image).\n *\n * @doc {heading: 'Browser', namespace: 'browser', ignoreCI: true}\n */\nexport async function fromPixelsAsync(\n pixels: PixelData|ImageData|HTMLImageElement|HTMLCanvasElement|\n HTMLVideoElement|ImageBitmap,\n numChannels = 3) {\n let inputs: PixelData|ImageData|HTMLImageElement|HTMLCanvasElement|\n HTMLVideoElement|ImageBitmap = null;\n\n // Check whether the backend needs to wrap |pixels| to imageBitmap and\n // whether |pixels| can be wrapped to imageBitmap.\n if (env().getBool('WRAP_TO_IMAGEBITMAP') &&\n canWrapPixelsToImageBitmap(pixels)) {\n // Force the imageBitmap creation to not do any premultiply alpha\n // ops.\n let imageBitmap;\n\n try {\n // wrap in try-catch block, because createImageBitmap may not work\n // properly in some browsers, e.g.\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1335594\n // tslint:disable-next-line: no-any\n imageBitmap = await (createImageBitmap as any)(\n pixels as ImageBitmapSource, {premultiplyAlpha: 'none'});\n } catch (e) {\n imageBitmap = null;\n }\n\n // createImageBitmap will clip the source size.\n // In some cases, the input will have larger size than its content.\n // E.g. new Image(10, 10) but with 1 x 1 content. Using\n // createImageBitmap will clip the size from 10 x 10 to 1 x 1, which\n // is not correct. We should avoid wrapping such resouce to\n // imageBitmap.\n if (imageBitmap != null && imageBitmap.width === pixels.width &&\n imageBitmap.height === pixels.height) {\n inputs = imageBitmap;\n } else {\n inputs = pixels;\n }\n } else {\n inputs = pixels;\n }\n\n return fromPixels_(inputs, numChannels);\n}\n\n/**\n * Draws a `tf.Tensor` of pixel values to a byte array or optionally a\n * canvas.\n *\n * When the dtype of the input is 'float32', we assume values in the range\n * [0-1]. Otherwise, when input is 'int32', we assume values in the range\n * [0-255].\n *\n * Returns a promise that resolves when the canvas has been drawn to.\n *\n * @param img A rank-2 tensor with shape `[height, width]`, or a rank-3 tensor\n * of shape `[height, width, numChannels]`. If rank-2, draws grayscale. If\n * rank-3, must have depth of 1, 3 or 4. When depth of 1, draws\n * grayscale. When depth of 3, we draw with the first three components of\n * the depth dimension corresponding to r, g, b and alpha = 1. When depth of\n * 4, all four components of the depth dimension correspond to r, g, b, a.\n * @param canvas The canvas to draw to.\n *\n * @doc {heading: 'Browser', namespace: 'browser'}\n */\nexport async function toPixels(\n img: Tensor2D|Tensor3D|TensorLike,\n canvas?: HTMLCanvasElement): Promise {\n let $img = convertToTensor(img, 'img', 'toPixels');\n if (!(img instanceof Tensor)) {\n // Assume int32 if user passed a native array.\n const originalImgTensor = $img;\n $img = cast(originalImgTensor, 'int32');\n originalImgTensor.dispose();\n }\n if ($img.rank !== 2 && $img.rank !== 3) {\n throw new Error(\n `toPixels only supports rank 2 or 3 tensors, got rank ${$img.rank}.`);\n }\n const [height, width] = $img.shape.slice(0, 2);\n const depth = $img.rank === 2 ? 1 : $img.shape[2];\n\n if (depth > 4 || depth === 2) {\n throw new Error(\n `toPixels only supports depth of size ` +\n `1, 3 or 4 but got ${depth}`);\n }\n\n if ($img.dtype !== 'float32' && $img.dtype !== 'int32') {\n throw new Error(\n `Unsupported type for toPixels: ${$img.dtype}.` +\n ` Please use float32 or int32 tensors.`);\n }\n\n const data = await $img.data();\n const multiplier = $img.dtype === 'float32' ? 255 : 1;\n const bytes = new Uint8ClampedArray(width * height * 4);\n\n for (let i = 0; i < height * width; ++i) {\n const rgba = [0, 0, 0, 255];\n\n for (let d = 0; d < depth; d++) {\n const value = data[i * depth + d];\n\n if ($img.dtype === 'float32') {\n if (value < 0 || value > 1) {\n throw new Error(\n `Tensor values for a float32 Tensor must be in the ` +\n `range [0 - 1] but encountered ${value}.`);\n }\n } else if ($img.dtype === 'int32') {\n if (value < 0 || value > 255) {\n throw new Error(\n `Tensor values for a int32 Tensor must be in the ` +\n `range [0 - 255] but encountered ${value}.`);\n }\n }\n\n if (depth === 1) {\n rgba[0] = value * multiplier;\n rgba[1] = value * multiplier;\n rgba[2] = value * multiplier;\n } else {\n rgba[d] = value * multiplier;\n }\n }\n\n const j = i * 4;\n bytes[j + 0] = Math.round(rgba[0]);\n bytes[j + 1] = Math.round(rgba[1]);\n bytes[j + 2] = Math.round(rgba[2]);\n bytes[j + 3] = Math.round(rgba[3]);\n }\n\n if (canvas != null) {\n canvas.width = width;\n canvas.height = height;\n const ctx = canvas.getContext('2d');\n const imageData = new ImageData(bytes, width, height);\n ctx.putImageData(imageData, 0, 0);\n }\n if ($img !== img) {\n $img.dispose();\n }\n return bytes;\n}\n\nexport const fromPixels = op({fromPixels_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {TensorInfo} from '../kernel_registry';\nimport {computeStrides, sizeFromShape} from '../util';\n\n/**\n * Validate gather nd inputs.\n *\n * @param tensor The tensor contains the source values.\n * @param indices The tensor contains the indices to slice the source.\n *\n * @returns [resultShape, numUpdates, sliceSize, strides]\n */\nexport function prepareAndValidate(tensor: TensorInfo, indices: TensorInfo):\n [number[], number, number, number[]] {\n const tensorRank = tensor.shape.length;\n const indicesRank = indices.shape.length;\n if (tensorRank < 1) {\n throw new Error(\n 'tf.gatherND() expects the input to be rank 1 or higher,' +\n ` but the rank was ${tensorRank}.`);\n }\n if (indicesRank < 1) {\n throw new Error(\n 'tf.gatherND() expects the indices to be rank 1 or higher,' +\n ` but the rank was ${indicesRank}.`);\n }\n if (indices.dtype !== 'int32') {\n throw new Error(\n 'tf.gatherND() expects the indices to be int32 type,' +\n ` but the dtype was ${indices.dtype}.`);\n }\n if (indices.shape[indicesRank - 1] > tensorRank) {\n throw new Error(\n 'index innermost dimension length must be <= tensor rank; saw: ' +\n `${indices.shape[indicesRank - 1]} vs. ${tensorRank}`);\n }\n\n if (sizeFromShape(tensor.shape) === 0) {\n throw new Error(\n 'Requested more than 0 entries, but input is empty.' +\n ` Input shape: ${tensor.shape}.`);\n }\n\n const indicesShape = indices.shape;\n const sliceRank = indicesShape[indicesShape.length - 1];\n\n // The result shape is\n // indices.shape[:-1] + params.shape[indices.shape[-1]:]\n let nResult = 1;\n for (let i = 0; i < indicesShape.length - 1; ++i) {\n nResult *= indicesShape[i];\n }\n\n const inputShape = tensor.shape;\n\n const resultShape = indicesShape.slice();\n resultShape.pop();\n\n let sliceSize = 1;\n for (let i = sliceRank; i < tensorRank; ++i) {\n sliceSize *= inputShape[i];\n resultShape.push(inputShape[i]);\n }\n\n const strides =\n [...computeStrides(tensor.shape).map(stride => stride / sliceSize),\n 1].slice(0, sliceRank);\n\n return [resultShape, nResult, sliceSize, strides];\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {TensorInfo} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {computeStrides, sizeFromShape} from '../util';\n\n/**\n * Check whether updates.shape = indices.shape[:batchDim] +\n * shape[sliceDim:]\n *\n * @param x The input tensor.\n */\nexport function validateUpdateShape(\n shape: number[], indices: Tensor, updates: Tensor) {\n const sliceDim = (indices.rank > 1) ? indices.shape[indices.rank - 1] : 1;\n const batchDim = (indices.rank > 1) ? indices.rank - 1 : 1;\n\n const shapeError = 'Must have updates.shape = indices.shape[:batchDim] + ' +\n `shape[sliceDim:], got updates.shape: ${updates.shape}` +\n `, indices.shape: ${indices.shape}, shape: ${shape}` +\n `, sliceDim: ${sliceDim}, and batchDim: ${batchDim}.`;\n\n if (updates.rank < batchDim) {\n throw new Error(shapeError + ` update.rank < ${batchDim}. `);\n }\n if (shape.length < sliceDim + (updates.rank - batchDim)) {\n throw new Error(\n shapeError +\n ` Output shape length < ${sliceDim + (updates.rank - batchDim)}`);\n }\n if (updates.rank !== batchDim + shape.length - sliceDim) {\n throw new Error(\n shapeError + ` update.rank != ${batchDim + shape.length - sliceDim}`);\n }\n for (let d = 0; d < batchDim; ++d) {\n if (updates.shape[d] !== indices.shape[d]) {\n throw new Error(\n shapeError +\n ` updates.shape[${d}] (${updates.shape[d]}) != indices.shape[${d}] (${\n indices.shape[d]}).`);\n }\n }\n for (let d = 0; d < updates.rank - batchDim; ++d) {\n if (updates.shape[d + batchDim] !== shape[d + sliceDim]) {\n throw new Error(\n shapeError +\n ` updates.shape[${d + batchDim}] (${\n updates.shape[d + batchDim]}) != shape[${d + batchDim}] (${\n shape[d + batchDim]})`);\n }\n }\n}\n\nexport interface ScatterShapeInfo {\n sliceRank: number;\n numUpdates: number;\n sliceSize: number;\n strides: number[];\n outputSize: number;\n}\n/**\n * Validate scatter nd inputs.\n *\n * @param update The tensor contains the update values.\n * @param indices The tensor contains the indices for the update values.\n * @param shape The shape of the output tensor.\n */\nexport function validateInput(\n updates: Tensor, indices: Tensor, shape: number[]) {\n if (indices.rank < 1) {\n throw new Error(\n 'tf.scatterND() expects the indices to be rank 1 or higher,' +\n ` but the rank was ${indices.rank}.`);\n }\n if (updates.rank < 1) {\n throw new Error(\n 'tf.scatterND() expects the updates to be rank 1 or higher,' +\n ` but the rank was ${updates.rank}.`);\n }\n if (indices.dtype !== 'int32') {\n throw new Error(`The dtype of 'indices' should be int32, but got dtype: ${\n indices.dtype}`);\n }\n if (shape.length < 1) {\n throw new Error(\n `Output rank must be greater or equal to 1, but got shape: ${shape}`);\n }\n\n if (shape.length === 0) {\n if (indices.size === 0) {\n throw new Error(`Indices specified for empty output. indices shape: ${\n indices.shape}`);\n }\n if (updates.size === 0) {\n throw new Error(`Updates specified for empty output. updates shape: ${\n updates.shape}`);\n }\n }\n\n validateUpdateShape(shape, indices, updates);\n}\n\n/**\n * Calculate the shape information for the output.\n *\n * @param update The tensor contains the update values.\n * @param indices The tensor contains the indices for the update values.\n * @param shape The shape of the output tensor.\n *\n * @returns ScatterShapeInfo\n */\nexport function calculateShapes(\n updates: TensorInfo, indices: TensorInfo,\n shape: number[]): ScatterShapeInfo {\n // Calculate the number of dimensions in indices\n const indicesRank = indices.shape.length;\n const sliceRank = (indicesRank > 1) ? indices.shape[indicesRank - 1] : 1;\n\n // Calculate the number of elements that make up each slice of our updated\n // tensor. This allows us to work with flattened tensors and copy over whole\n // slices at a time.\n const totalNd = shape.length;\n\n let sliceSize = 1;\n for (let i = sliceRank; i < totalNd; ++i) {\n sliceSize *= shape[i];\n }\n\n const safeSliceDim = (sliceRank < 1) ? 1 : sliceRank;\n const numUpdates = sizeFromShape(indices.shape) / safeSliceDim;\n\n const strides = [...computeStrides(shape.slice(0, sliceRank)), 1];\n const outputSize = sizeFromShape(shape);\n return {sliceRank, numUpdates, sliceSize, strides, outputSize};\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {TensorInfo} from '../kernel_registry';\nimport * as util from '../util';\n\nconst NEW_AXIS = -2;\nconst SHRINK_AXIS = -1;\n\n// Sparse slicing specification\n// if one does foo[3:5, ..., -3], the begin, end and strides will have length\n// of 3.\ninterface StridedSliceSparseSpec {\n dims: number;\n numAddAxisAfterEllipsis: number;\n begin: number[];\n end: number[];\n strides: number[];\n beginMask: number;\n endMask: number;\n ellipsisMask: number;\n newAxisMask: number;\n shrinkAxisMask: number;\n}\n\n// Dense slicing specification\n// all ellipses and newaxis are expanded out. So if foo[3:5, ..., -3] where foo\n// is 10 dimensional, each array of begin, end, strides will have 10 entries\n// where as the sparse can have length less than the rank of foo.\ninterface StridedSliceDenseSpec {\n dims: number;\n beginMask?: number;\n endMask?: number;\n beginValid: boolean;\n endValid: boolean;\n begin?: number[];\n end?: number[];\n strides?: number[];\n // This array helps construct the final shape of the slice.\n // The final tensor is reduced in rank whenever a single index e.g. foo[3]\n // is called for. The final tensor increases in rank with newAxis entries.\n // If an index in this array is positive, the size of the dimension is\n // obtained from canonical end-begin. Otherwise, if it is a NEW_AXIS, it will\n // be 1. A shrunk dimension is skipped.\n finalShapeGatherIndices?: number[];\n // This array has the same size as finalShapeGatherIndices, but it remembers\n // the sparse index that a dimension comes from, instead of dense index.\n // A -1 in this vector means the index is not from the sparse input.\n finalShapeGatherIndicesSparse?: number[];\n inputShapeGatherIndicesSparse?: number[];\n // The dense indexed shrink mask is which processing dimensions should be\n // shrunk. For example, if foo.shape = [10, 10, 10, 10], foo[3, ..., 5] has\n // sparseShrinkAxisMask of 5 (0101) and denseShrinkAxisMask of 9 (1001),\n // yielding a final shape [10, 10].\n shrinkAxisMask?: number;\n}\n\nexport type SliceInfo = {\n finalShapeSparse: number[],\n finalShape: number[],\n isIdentity: boolean,\n sliceDim0: boolean,\n isSimpleSlice: boolean,\n begin: number[],\n end: number[],\n strides: number[]\n};\n\nexport function assertParamsValid(\n input: TensorInfo, begin: number[], size: number[]): void {\n const inputRank = input.shape.length;\n util.assert(\n inputRank === begin.length,\n () => `Error in slice${inputRank}D: Length of begin ${begin} must ` +\n `match the rank of the array (${inputRank}).`);\n util.assert(\n inputRank === size.length,\n () => `Error in slice${inputRank}D: Length of size ${size} must ` +\n `match the rank of the array (${inputRank}).`);\n\n for (let i = 0; i < inputRank; ++i) {\n util.assert(\n begin[i] + size[i] <= input.shape[i],\n () => `Error in slice${inputRank}D: begin[${i}] + size[${i}] ` +\n `(${begin[i] + size[i]}) would overflow input.shape[${i}] (${\n input.shape[i]})`);\n }\n}\n\n/** Converts a binary mask to an array of axes. Used in stridedSlice(). */\nexport function maskToAxes(mask: number): number[] {\n const axes = [];\n let axis = 0;\n while (mask > 0) {\n if (mask & 1) {\n axes.push(axis);\n }\n mask /= 2;\n axis++;\n }\n return axes;\n}\n\n/** Computes the output shape given the strided slice params. */\nexport function computeOutShape(\n begin: number[], end: number[], strides: number[]): number[] {\n const size = [];\n for (let axis = 0; axis < begin.length; axis++) {\n size[axis] = Math.ceil((end[axis] - begin[axis]) / strides[axis]);\n }\n return size;\n}\n\n// Creates full selection at the elided dimensions. If the dimension matches\n// the ellipsis mask, override the current stride value. Otherwise, insert.\nexport function stridesWithElidedDims(\n strides: number[], ellipsisInsertionIndex: number, numElidedAxes: number,\n inputShape: number[]): number[] {\n const newStrides = [...strides];\n for (let i = newStrides.length; i < inputShape.length; i++) {\n newStrides.push(1);\n }\n for (let i = 0; i < numElidedAxes; i++) {\n if (i === 0) {\n newStrides[ellipsisInsertionIndex] = 1;\n } else {\n newStrides.splice(\n ellipsisInsertionIndex, 0 /* num elements to delete */,\n 1 /* element to add */);\n newStrides.pop();\n }\n }\n return newStrides;\n}\n\nfunction unnormalizeAxis(\n ellipsisInsertionIndex: number, numElidedAxes: number,\n normalizedAxis: number): number {\n if (normalizedAxis <= ellipsisInsertionIndex) {\n return normalizedAxis;\n }\n\n return normalizedAxis - (numElidedAxes - 1);\n}\n\nfunction getElidedAxes(numElidedAxes: number, ellipsisInsertionIndex: number) {\n const elidedAxes = [];\n for (let i = 0; i < numElidedAxes; i++) {\n elidedAxes.push(ellipsisInsertionIndex + i);\n }\n return elidedAxes;\n}\n\n// Normalize the start, end and strides.\nexport function getNormalizedAxes(\n inputShape: number[], ellipsisAxes: number[], numInterpolatedAxes: number,\n begin: number[], end: number[], strides: number[], beginMask: number,\n endMask: number,\n ellipsisMask: number): {begin: number[], end: number[], strides: number[]} {\n const inputRank = inputShape.length;\n let normalizedBegin = new Array(inputRank),\n normalizedEnd = new Array(inputRank),\n normalizedStrides = new Array(inputRank);\n if (ellipsisAxes.length && numInterpolatedAxes > 0) {\n const fullIndex = ellipsisAxes[0];\n\n // The ellipsis applies to the masked index as well as any dimensions\n // that are interpolated.\n const numElidedAxes = numInterpolatedAxes + 1;\n normalizedBegin = startIndicesWithElidedDims(\n beginMask, fullIndex, numElidedAxes, begin, inputShape);\n normalizedEnd = stopIndicesWithElidedDims(\n endMask, fullIndex, numElidedAxes, end, inputShape);\n normalizedStrides =\n stridesWithElidedDims(strides, fullIndex, numElidedAxes, inputShape);\n } else {\n for (let axis = 0; axis < inputRank; axis++) {\n normalizedBegin[axis] = startForAxis(\n beginMask, begin, strides, inputShape, axis, ellipsisMask);\n normalizedEnd[axis] =\n stopForAxis(endMask, end, strides, inputShape, axis, ellipsisMask);\n normalizedStrides[axis] = stridesForAxis(strides, axis, ellipsisMask);\n }\n }\n\n return {\n begin: normalizedBegin,\n end: normalizedEnd,\n strides: normalizedStrides\n };\n}\n\n// Creates full selection at the elided dimensions. If the dimension matches\n// the ellipsis mask, override the current start value. Otherwise, insert.\nexport function startIndicesWithElidedDims(\n beginMask: number, ellipsisInsertionIndex: number, numElidedAxes: number,\n originalBegin: number[], inputShape: number[]): number[] {\n const newIndices = [...inputShape];\n const elidedAxes = getElidedAxes(numElidedAxes, ellipsisInsertionIndex);\n\n for (let axis = 0; axis < newIndices.length; axis++) {\n if (elidedAxes.indexOf(axis) > -1) {\n newIndices[axis] = 0;\n } else {\n const originalAxis =\n unnormalizeAxis(ellipsisInsertionIndex, numElidedAxes, axis);\n let originalValue = originalBegin[originalAxis];\n if (beginMask & 1 << originalAxis) {\n originalValue = 0;\n }\n\n newIndices[axis] = originalValue;\n }\n }\n return newIndices;\n}\n\n// Creates full selection at the elided dimensions. If the dimension matches\n// the ellipsis mask, override the current stop value. Otherwise, insert.\nexport function stopIndicesWithElidedDims(\n endMask: number, ellipsisInsertionIndex: number, numElidedAxes: number,\n originalEnd: number[], inputShape: number[]): number[] {\n const newIndices = [...inputShape];\n const elidedAxes = getElidedAxes(numElidedAxes, ellipsisInsertionIndex);\n\n for (let axis = 0; axis < newIndices.length; axis++) {\n if (elidedAxes.indexOf(axis) > -1) {\n newIndices[axis] = Number.MAX_SAFE_INTEGER;\n } else {\n const originalAxis =\n unnormalizeAxis(ellipsisInsertionIndex, numElidedAxes, axis);\n let originalValue = originalEnd[originalAxis];\n if (endMask & 1 << originalAxis) {\n originalValue = Number.MAX_SAFE_INTEGER;\n }\n newIndices[axis] = originalValue;\n }\n }\n\n for (let i = 0; i < newIndices.length; i++) {\n // Handle negative indices\n const axisSize = inputShape[i];\n if (newIndices[i] < 0) {\n newIndices[i] += axisSize;\n }\n newIndices[i] = util.clamp(0, newIndices[i], inputShape[i]);\n }\n return newIndices;\n}\n\nexport function stridesForAxis(\n strides: number[], axis: number, ellipsisMask: number): number {\n let stride = strides[axis];\n if (ellipsisMask & (1 << axis) || stride == null) {\n stride = 1;\n }\n\n return stride;\n}\n\nexport function startForAxis(\n beginMask: number, startIndices: number[], strides: number[],\n inputShape: number[], axis: number, ellipsisMask: number): number {\n // Begin with the specified index\n let start = startIndices[axis];\n const stride = strides[axis] || 1;\n\n // Check the axis bit from right of masked axes, or the begin index is not set\n // for the axis.\n if (beginMask & 1 << axis || ellipsisMask & 1 << axis || start == null) {\n if (stride > 0) {\n // Forward iteration - use the first element. These values will get\n // clamped below (Note: We could have set them to 0 and axis_size-1, but\n // use lowest() and max() to maintain symmetry with StopForAxis())\n start = Number.MIN_SAFE_INTEGER;\n } else {\n // Backward iteration - use the last element.\n start = Number.MAX_SAFE_INTEGER;\n }\n }\n\n // Handle negative indices\n const axisSize = inputShape[axis];\n if (start < 0) {\n start += axisSize;\n }\n\n // Clamping\n start = util.clamp(0, start, axisSize - 1);\n\n return start;\n}\n\nexport function stopForAxis(\n endMask: number, stopIndices: number[], strides: number[],\n inputShape: number[], axis: number, ellipsisMask: number): number {\n // Begin with the specified index\n let stop = stopIndices[axis];\n const stride = strides[axis] || 1;\n\n // Check the axis bit from right of masked axes, or if the stop index is not\n // set for this axis.\n if (endMask & (1 << axis) || ellipsisMask & (1 << axis) || stop == null) {\n if (stride > 0) {\n // Forward iteration - use the last element. These values will get\n // clamped below\n stop = Number.MAX_SAFE_INTEGER;\n } else {\n // Backward iteration - use the first element.\n stop = Number.MIN_SAFE_INTEGER;\n }\n }\n\n // Handle negative indices\n const axisSize = inputShape[axis];\n if (stop < 0) {\n stop += axisSize;\n }\n\n // Clamping\n // Because the end index points one past the last element, we need slightly\n // different clamping ranges depending on the direction.\n if (stride > 0) {\n // Forward iteration\n stop = util.clamp(0, stop, axisSize);\n } else {\n // Backward iteration\n stop = util.clamp(-1, stop, axisSize - 1);\n }\n\n return stop;\n}\n\n/**\n * Returns true if the slice occupies a continous set of elements in the\n * 'flat' space.\n */\nexport function isSliceContinous(\n shape: number[], begin: number[], size: number[]) {\n // Index of the first axis that has size > 1.\n let firstNonOneAxis = size.length;\n for (let i = 0; i < size.length; i++) {\n if (size[i] > 1) {\n firstNonOneAxis = i;\n break;\n }\n }\n\n for (let i = firstNonOneAxis + 1; i < size.length; i++) {\n if (begin[i] > 0 || size[i] !== shape[i]) {\n return false;\n }\n }\n return true;\n}\n\nexport function computeFlatOffset(begin: number[], strides: number[]): number {\n let flatOffset = begin.length > 0 ? begin[begin.length - 1] : 1;\n for (let i = 0; i < begin.length - 1; i++) {\n flatOffset += begin[i] * strides[i];\n }\n return flatOffset;\n}\n\nexport function parseSliceParams(\n x: TensorInfo, begin: number|number[], size?: number|number[]) {\n // The following logic allows for more ergonomic calls.\n let begin_: number[];\n const xRank = x.shape.length;\n if (typeof begin === 'number') {\n begin_ = [begin, ...new Array(xRank - 1).fill(0)];\n } else if (begin.length < xRank) {\n begin_ = begin.concat(new Array(xRank - begin.length).fill(0));\n } else {\n begin_ = begin.slice();\n }\n begin_.forEach(d => {\n util.assert(\n d !== -1, () => 'slice() does not support negative begin indexing.');\n });\n let size_: number[];\n if (size == null) {\n size_ = new Array(xRank).fill(-1);\n } else if (typeof size === 'number') {\n size_ = [size, ...new Array(xRank - 1).fill(-1)];\n } else if (size.length < xRank) {\n size_ = size.concat(new Array(xRank - size.length).fill(-1));\n } else {\n size_ = size;\n }\n size_ = size_.map((d, i) => {\n if (d >= 0) {\n return d;\n } else {\n util.assert(\n d === -1,\n () => `Negative size values should be exactly -1 but got ` +\n `${d} for the slice() size at index ${i}.`);\n return x.shape[i] - begin_[i];\n }\n });\n return [begin_, size_];\n}\n\n// Convert the slicing specification from a sparse representation to a dense\n// representation. This means that all ellipses and newaxis are expanded out.\nexport function sliceInfo(\n xShape: number[], begin: number[], end: number[], strides: number[],\n beginMask: number, endMask: number, ellipsisMask: number,\n newAxisMask: number, shrinkAxisMask: number): SliceInfo {\n let stridesNonNull;\n if (strides == null) {\n stridesNonNull = new Array(begin.length);\n stridesNonNull.fill(1);\n } else {\n stridesNonNull = strides;\n }\n\n // Only one non-zero bit is allowed in ellipsisMask, which means ellipsisMask\n // is a power of 2. Use bit compares to ensure ellipsisMask is 0 or a power\n // of 2. When i is a power of 2, i & (i - 1) is always 0.\n // Also ref:\n // https://stackoverflow.com/questions/600293/how-to-check-if-a-number-is-a-power-of-2\n if (ellipsisMask != null && (ellipsisMask & (ellipsisMask - 1)) !== 0) {\n throw new Error('Multiple ellipses in slice is not allowed.');\n }\n\n // Step 1: Account for ellipsis and new axis.\n // Check for ellipsis and count how many non-newaxis there are after.\n let ellipsisSeen = false;\n\n const sparseSpec: StridedSliceSparseSpec = {\n dims: stridesNonNull.length,\n numAddAxisAfterEllipsis: 0,\n begin: begin.slice(),\n end: end.slice(),\n strides: stridesNonNull.slice(),\n beginMask,\n endMask,\n ellipsisMask,\n newAxisMask,\n shrinkAxisMask\n };\n\n for (let i = 0; i < sparseSpec.dims; i++) {\n if (ellipsisSeen && ((1 << i) & newAxisMask) !== 0) {\n sparseSpec.numAddAxisAfterEllipsis++;\n }\n if ((1 << i) & ellipsisMask) {\n ellipsisSeen = true;\n }\n }\n // If no ellipsis insert one at the end.\n if (!ellipsisSeen) {\n sparseSpec.ellipsisMask |= (1 << sparseSpec.dims);\n sparseSpec.dims++; // this effects loop iteration below\n }\n\n // Step 2: Make a sparse spec into a full index spec.\n //\n // The sparse spec deos not correspond to the number of dimensions.\n // Make a dense spec that cooresponds to the number of dimensions.\n //\n // For example suppose foo[...,3:] on foo.shape = [2, 2, 3] then we need to\n // produce the missing beginMask for the first two dimensions i.e. from\n // beginMaskSpec = 0, endMaskSpec = 2, we achieve beginMask = 6 (110),\n // endMask = 7 (111).\n const denseSpec: StridedSliceDenseSpec = {\n dims: xShape.length,\n beginMask: 0,\n endMask: 0,\n beginValid: false,\n endValid: false\n };\n\n buildDenseSpec(sparseSpec, denseSpec);\n\n // Step 3: Make implicit ranges (non-zero beginMasks and endMasks) explicit\n // and bounds check.\n let isIdentity = true;\n let sliceDim0 = true;\n let isSimpleSlice = true;\n const processingShape = [];\n const finalShape = [];\n\n for (let i = 0; i < xShape.length; ++i) {\n if (denseSpec.strides[i] === 0) {\n throw Error(`strides[${i}] must be non-zero`);\n }\n const shrinkI = !!(denseSpec.shrinkAxisMask & (1 << i));\n const dimI = xShape[i];\n if (dimI === -1) {\n processingShape.push(shrinkI ? 1 : -1);\n continue;\n }\n\n const masks =\n [denseSpec.beginMask & (1 << i), denseSpec.endMask & (1 << i)];\n const validRange = [\n denseSpec.strides[i] > 0 ? 0 : -1,\n denseSpec.strides[i] > 0 ? dimI : dimI - 1\n ];\n\n if (shrinkI && denseSpec.strides[i] <= 0) {\n throw Error('only stride 1 allowed on non-range indexing.');\n }\n\n isSimpleSlice = isSimpleSlice && (denseSpec.strides[i] === 1);\n\n const beginAndEndMasked =\n !!((denseSpec.beginMask & (1 << i)) && (denseSpec.endMask & (1 << i)));\n\n if (denseSpec.beginValid && denseSpec.endValid) {\n if (shrinkI) {\n // If we are shrinking, the end index is now possibly incorrect. In\n // particular foo[-1] produces sparseBegin = -1, sparseEnd = 0.\n // and canonical puts these to n-1 and 0, which implies a degenerate\n // interval. Fortunately, it is now safe to re-create end as begin + 1.\n const xFwd = denseSpec.begin[i] < 0 ? dimI + denseSpec.begin[i] :\n denseSpec.begin[i];\n denseSpec.begin[i] = xFwd;\n denseSpec.end[i] = denseSpec.begin[i] + 1;\n if (xFwd < 0 || xFwd >= dimI) {\n throw Error(`slice index ${denseSpec.begin[i]} of dimension ${\n i} out of bounds.`);\n }\n } else {\n denseSpec.begin[i] = canonical(\n denseSpec.begin[i], 0, denseSpec.strides[i], dimI, masks,\n validRange);\n denseSpec.end[i] = canonical(\n denseSpec.end[i], 1, denseSpec.strides[i], dimI, masks, validRange);\n }\n // Update optimization values\n const takeAllInDimension = denseSpec.strides[i] === 1 &&\n denseSpec.begin[i] === 0 && denseSpec.end[i] === dimI;\n isIdentity = isIdentity && takeAllInDimension;\n sliceDim0 = sliceDim0 &&\n ((i === 0 && denseSpec.strides[i] === 1) || takeAllInDimension);\n } else {\n isIdentity =\n isIdentity && ((denseSpec.strides[i] === 1) && beginAndEndMasked);\n sliceDim0 = sliceDim0 &&\n ((i === 0 && denseSpec.strides[i] === 1) || beginAndEndMasked);\n }\n // Compute the processing shape (the intermediate Eigen will produce)\n let intervalLength;\n let knownInterval = false;\n if (denseSpec.beginValid && denseSpec.endValid) {\n intervalLength = denseSpec.end[i] - denseSpec.begin[i];\n knownInterval = true;\n } else if (shrinkI) {\n // The dimension is still known as 1 for the processingShape, but will be\n // discarded for the final shape.\n intervalLength = 1;\n knownInterval = true;\n } else if (beginAndEndMasked) {\n // Even if we don't have values for begin or end, we do know that this\n // dimension covers the whole interval. If we have shape information for\n // this dimension, that tells us the interval length.\n if (dimI >= 0) {\n if (denseSpec.strides[i] < 0) {\n intervalLength = -dimI;\n } else {\n intervalLength = dimI;\n }\n knownInterval = true;\n }\n }\n if (knownInterval) {\n let sizeI;\n // Hold zero if the interval is degenerate, otherwise account for\n // remainder\n if (intervalLength === 0 ||\n ((intervalLength < 0) !== (denseSpec.strides[i] < 0))) {\n sizeI = 0;\n } else {\n sizeI = Math.trunc(intervalLength / denseSpec.strides[i]) +\n (intervalLength % denseSpec.strides[i] !== 0 ? 1 : 0);\n }\n processingShape.push(sizeI);\n } else {\n processingShape.push(-1);\n }\n }\n\n // Step 4: Compute the final shape\n //\n // newAxis will increase dimension by 1 (with a one-size dimension)\n // slices like foo[3, ...] will reduce dimension by 1.\n // This cannot be done earlier, because it depends on Step 3.\n for (let denseDim = 0; denseDim < denseSpec.finalShapeGatherIndices.length;\n ++denseDim) {\n const gatherIndex = denseSpec.finalShapeGatherIndices[denseDim];\n if (gatherIndex >= 0) {\n finalShape.push(processingShape[gatherIndex]);\n } else if (gatherIndex === NEW_AXIS) {\n finalShape.push(1);\n }\n }\n\n const finalShapeSparse = finalShape.filter(\n (dim, i) => denseSpec.finalShapeGatherIndices[i] !== NEW_AXIS);\n\n return {\n finalShapeSparse,\n finalShape,\n isIdentity,\n sliceDim0,\n isSimpleSlice,\n begin: denseSpec.begin,\n end: denseSpec.end,\n strides: denseSpec.strides\n };\n}\n\nfunction buildDenseSpec(\n sparse: StridedSliceSparseSpec, dense: StridedSliceDenseSpec) {\n dense.beginMask = 0;\n dense.endMask = 0;\n dense.shrinkAxisMask = 0;\n\n let fullIndex = 0;\n dense.beginValid = sparse.begin != null;\n dense.endValid = sparse.end != null;\n\n dense.begin = new Array(dense.dims);\n dense.end = new Array(dense.dims);\n dense.strides = new Array(dense.dims);\n dense.finalShapeGatherIndices = [];\n dense.finalShapeGatherIndicesSparse = [];\n dense.inputShapeGatherIndicesSparse = new Array(dense.dims);\n\n for (let i = 0; i < sparse.dims; i++) {\n if ((1 << i) & sparse.ellipsisMask) {\n // Only the bit that has ellipsis will fall in this condition.\n // Expand the ellipsis into the appropriate indices\n // Note: this only works because we guaranteed one ellipsis.\n const nextIndex = Math.min(\n dense.dims - (sparse.dims - i) + 1 + sparse.numAddAxisAfterEllipsis,\n dense.dims);\n for (; fullIndex < nextIndex; fullIndex++) {\n // newAxis aren't real axis so you have to skip.\n dense.begin[fullIndex] = 0;\n dense.end[fullIndex] = 0;\n dense.strides[fullIndex] = 1;\n dense.beginMask |= (1 << fullIndex);\n dense.endMask |= (1 << fullIndex);\n dense.finalShapeGatherIndices.push(fullIndex);\n dense.finalShapeGatherIndicesSparse.push(-1);\n dense.inputShapeGatherIndicesSparse[fullIndex] = i;\n }\n } else if ((1 << i) & sparse.newAxisMask) {\n // Only the bit that has newAxis will fall in this condition.\n dense.finalShapeGatherIndices.push(NEW_AXIS);\n dense.finalShapeGatherIndicesSparse.push(-1);\n } else {\n if (fullIndex === dense.begin.length) {\n throw Error(\n `Index out of range using input dim ${fullIndex}; input ` +\n `has only ${dense.dims} dims, ${dense.begin.length}.`);\n }\n\n // Gather slicing spec into appropriate index.\n if (sparse.begin != null) {\n dense.begin[fullIndex] = sparse.begin[i];\n }\n if (sparse.end != null) {\n dense.end[fullIndex] = sparse.end[i];\n }\n dense.strides[fullIndex] = sparse.strides[i];\n if (sparse.beginMask & (1 << i)) {\n dense.beginMask |= (1 << fullIndex);\n }\n if (sparse.endMask & (1 << i)) {\n dense.endMask |= (1 << fullIndex);\n }\n // If shrink, record where to get the dimensionality from (i.e. newAxis)\n // creates a fake 1 size dimension. Also remember shrink axis (now in\n // dense form) so we can ignore dense.end below.\n if (sparse.shrinkAxisMask & (1 << i)) {\n dense.finalShapeGatherIndices.push(SHRINK_AXIS);\n dense.finalShapeGatherIndicesSparse.push(-1);\n dense.shrinkAxisMask |= (1 << fullIndex);\n } else {\n dense.finalShapeGatherIndices.push(fullIndex);\n // Remember that where in the sparse shape the dense dim comes from.\n dense.finalShapeGatherIndicesSparse.push(i);\n }\n dense.inputShapeGatherIndicesSparse[fullIndex] = i;\n fullIndex++;\n }\n }\n}\n\nfunction canonical(\n x: number, c: number, strideI: number, dimI: number, masks: number[],\n validRange: number[]) {\n if (masks[c]) {\n return strideI > 0 ? validRange[c] : validRange[(c + 1) & 1];\n } else {\n const xFwd = x < 0 ? dimI + x : x; // make negative indices positive\n return xFwd < validRange[0] ? validRange[0] :\n xFwd > validRange[1] ? validRange[1] : xFwd;\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {assert} from './util';\n\n/**\n * Types to support JSON-esque data structures internally.\n *\n * Internally ConfigDict's use camelCase keys and values where the\n * values are class names to be instantiated. On the python side, these\n * will be snake_case. Internally we allow Enums into the values for better\n * type safety, but these need to be converted to raw primitives (usually\n * strings) for round-tripping with python.\n *\n * toConfig returns the TS-friendly representation. model.toJSON() returns\n * the pythonic version as that's the portable format. If you need to\n * python-ify a non-model level toConfig output, you'll need to use a\n * convertTsToPythonic from serialization_utils in -Layers.\n *\n */\nexport declare type ConfigDictValue =\n boolean | number | string | null | ConfigDictArray | ConfigDict;\nexport declare interface ConfigDict {\n [key: string]: ConfigDictValue;\n}\nexport declare interface ConfigDictArray extends Array {}\n\n/**\n * Type to represent the class-type of Serializable objects.\n *\n * Ie the class prototype with access to the constructor and any\n * static members/methods. Instance methods are not listed here.\n *\n * Source for this idea: https://stackoverflow.com/a/43607255\n */\nexport declare type SerializableConstructor = {\n // tslint:disable-next-line:no-any\n new (...args: any[]): T; className: string; fromConfig: FromConfigMethod;\n};\nexport declare type FromConfigMethod =\n (cls: SerializableConstructor, config: ConfigDict) => T;\n\n/**\n * Serializable defines the serialization contract.\n *\n * TFJS requires serializable classes to return their className when asked\n * to avoid issues with minification.\n */\nexport abstract class Serializable {\n /**\n * Return the class name for this class to use in serialization contexts.\n *\n * Generally speaking this will be the same thing that constructor.name\n * would have returned. However, the class name needs to be robust\n * against minification for serialization/deserialization to work properly.\n *\n * There's also places such as initializers.VarianceScaling, where\n * implementation details between different languages led to different\n * class hierarchies and a non-leaf node is used for serialization purposes.\n */\n getClassName(): string {\n return (this.constructor as SerializableConstructor)\n .className;\n }\n\n /**\n * Return all the non-weight state needed to serialize this object.\n */\n abstract getConfig(): ConfigDict;\n\n /**\n * Creates an instance of T from a ConfigDict.\n *\n * This works for most descendants of serializable. A few need to\n * provide special handling.\n * @param cls A Constructor for the class to instantiate.\n * @param config The Configuration for the object.\n */\n /** @nocollapse */\n static fromConfig(\n cls: SerializableConstructor, config: ConfigDict): T {\n return new cls(config);\n }\n}\n\n/**\n * Maps string keys to class constructors.\n *\n * Used during (de)serialization from the cross-language JSON format, which\n * requires the class name in the serialization format matches the class\n * names as used in Python, should it exist.\n */\nexport class SerializationMap {\n private static instance: SerializationMap;\n classNameMap: {\n [className: string]:\n [SerializableConstructor, FromConfigMethod]\n };\n\n private constructor() {\n this.classNameMap = {};\n }\n\n /**\n * Returns the singleton instance of the map.\n */\n static getMap(): SerializationMap {\n if (SerializationMap.instance == null) {\n SerializationMap.instance = new SerializationMap();\n }\n return SerializationMap.instance;\n }\n\n /**\n * Registers the class as serializable.\n */\n static register(cls: SerializableConstructor) {\n SerializationMap.getMap().classNameMap[cls.className] =\n [cls, cls.fromConfig];\n }\n}\n\n/**\n * Register a class with the serialization map of TensorFlow.js.\n *\n * This is often used for registering custom Layers, so they can be\n * serialized and deserialized.\n *\n * Example:\n *\n * ```js\n * class MyCustomLayer extends tf.layers.Layer {\n * static className = 'MyCustomLayer';\n *\n * constructor(config) {\n * super(config);\n * }\n * }\n * tf.serialization.registerClass(MyCustomLayer);\n * ```\n *\n * @param cls The class to be registered. It must have a public static member\n * called `className` defined and the value must be a non-empty string.\n *\n * @doc {heading: 'Models', subheading: 'Serialization', ignoreCI: true}\n */\nexport function registerClass(\n cls: SerializableConstructor) {\n assert(\n cls.className != null,\n () => `Class being registered does not have the static className ` +\n `property defined.`);\n assert(\n typeof cls.className === 'string',\n () => `className is required to be a string, but got type ` +\n typeof cls.className);\n assert(\n cls.className.length > 0,\n () => `Class being registered has an empty-string as its className, ` +\n `which is disallowed.`);\n\n SerializationMap.register(cls);\n}\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from './engine';\nimport {inferShape} from './tensor_util_env';\nimport {RecursiveArray, TensorLike, TypedArray} from './types';\nimport {arraysEqual, encodeString, flatten, isString, isTypedArray} from './util';\n\nconst TEST_EPSILON_FLOAT32 = 1e-3;\nexport const TEST_EPSILON_FLOAT16 = 1e-1;\n\nexport function expectArraysClose(\n actual: TypedArray|number|RecursiveArray,\n expected: TypedArray|number|RecursiveArray, epsilon?: number) {\n if (epsilon == null) {\n epsilon = testEpsilon();\n }\n return expectArraysPredicate(\n actual, expected, (a, b) => areClose(a as number, b as number, epsilon));\n}\n\nexport function testEpsilon() {\n return ENGINE.backend.floatPrecision() === 32 ? TEST_EPSILON_FLOAT32 :\n TEST_EPSILON_FLOAT16;\n}\n\nfunction expectArraysPredicate(\n actual: TensorLike, expected: TensorLike,\n predicate: (a: {}, b: {}) => boolean) {\n let checkClassType = true;\n if (isTypedArray(actual) || isTypedArray(expected)) {\n checkClassType = false;\n }\n if (isTypedArray(actual) && isTypedArray(expected)) {\n checkClassType = true;\n }\n if (checkClassType) {\n const aType = actual.constructor.name;\n const bType = expected.constructor.name;\n\n if (aType !== bType) {\n throw new Error(\n `Arrays are of different type. Actual: ${aType}. ` +\n `Expected: ${bType}`);\n }\n }\n\n if (Array.isArray(actual) && Array.isArray(expected)) {\n const actualShape = inferShape(actual);\n const expectedShape = inferShape(expected);\n if (!arraysEqual(actualShape, expectedShape)) {\n throw new Error(\n `Arrays have different shapes. ` +\n `Actual: [${actualShape}]. Expected: [${expectedShape}]`);\n }\n }\n\n const actualFlat =\n isTypedArray(actual) ? actual : flatten(actual as RecursiveArray);\n const expectedFlat = isTypedArray(expected) ?\n expected :\n flatten(expected as RecursiveArray);\n\n if (actualFlat.length !== expectedFlat.length) {\n throw new Error(\n `Arrays have different lengths actual: ${actualFlat.length} vs ` +\n `expected: ${expectedFlat.length}.\\n` +\n `Actual: ${actualFlat}.\\n` +\n `Expected: ${expectedFlat}.`);\n }\n for (let i = 0; i < expectedFlat.length; ++i) {\n const a = actualFlat[i];\n const e = expectedFlat[i];\n\n if (!predicate(a, e)) {\n throw new Error(\n `Arrays differ: actual[${i}] = ${a}, expected[${i}] = ${e}.\\n` +\n `Actual: ${actualFlat}.\\n` +\n `Expected: ${expectedFlat}.`);\n }\n }\n if (typeof expect !== 'undefined') {\n expect().nothing();\n }\n}\n\nexport interface DoneFn {\n (): void;\n fail: (message?: Error|string) => void;\n}\n\nexport function expectPromiseToFail(fn: () => Promise<{}>, done: DoneFn): void {\n fn().then(() => done.fail(), () => done());\n if (typeof expect !== 'undefined') {\n expect().nothing();\n }\n}\n\nexport function expectArraysEqual(actual: TensorLike, expected: TensorLike) {\n const exp = typeof expected === 'string' || typeof expected === 'number' ||\n typeof expected === 'boolean' ?\n [expected] as number[] :\n expected as number[];\n if (isString(actual) || isString((actual as string[])[0]) ||\n isString(expected) || isString((expected as string[])[0])) {\n // tslint:disable-next-line: triple-equals\n return expectArraysPredicate(actual, exp, (a, b) => a == b);\n }\n return expectArraysPredicate(\n actual, expected, (a, b) => areClose(a as number, b as number, 0));\n}\n\nexport function expectNumbersClose(a: number, e: number, epsilon?: number) {\n if (epsilon == null) {\n epsilon = testEpsilon();\n }\n if (!areClose(a, e, epsilon)) {\n throw new Error(`Numbers differ: actual === ${a}, expected === ${e}`);\n }\n if (typeof expect !== 'undefined') {\n expect().nothing();\n }\n}\n\nfunction areClose(a: number, e: number, epsilon: number): boolean {\n if (!isFinite(a) && !isFinite(e)) {\n return true;\n }\n if (isNaN(a) || isNaN(e) || Math.abs(a - e) > epsilon) {\n return false;\n }\n return true;\n}\n\nexport function expectValuesInRange(\n actual: TypedArray|number[], low: number, high: number) {\n for (let i = 0; i < actual.length; i++) {\n if (actual[i] < low || actual[i] > high) {\n throw new Error(\n `Value out of range:${actual[i]} low: ${low}, high: ${high}`);\n }\n }\n}\n\nexport function expectArrayBuffersEqual(\n actual: ArrayBuffer, expected: ArrayBuffer) {\n // Safari does not like comparing ArrayBuffers directly. Wrapping in\n // a Float32Array solves this issue.\n const actualArray = new Float32Array(actual);\n const expectedArray = new Float32Array(expected);\n if (actualArray.length !== expectedArray.length) {\n throw new Error(\n 'Expected ArrayBuffer to be of length ' +\n `${expectedArray.length}, but it was ${actualArray.length}`);\n }\n\n for (let i = 0; i < expectedArray.length; i++) {\n if (actualArray[i] !== expectedArray[i]) {\n throw new Error(\n `Expected ArrayBuffer value at ${i} to be ` +\n `${expectedArray[i]} but got ${actualArray[i]} instead`);\n }\n }\n}\n\n/** Encodes strings into utf-8 bytes. */\nexport function encodeStrings(a: RecursiveArray<{}>):\n RecursiveArray {\n for (let i = 0; i < (a as Array<{}>).length; i++) {\n const val = a[i];\n if (Array.isArray(val)) {\n encodeStrings(val);\n } else {\n a[i] = encodeString(val as string);\n }\n }\n return a as RecursiveArray;\n}\n\n/** Creates an HTMLVideoElement with autoplay-friendly default settings. */\nexport function createVideoElement(source: HTMLSourceElement):\n Promise {\n const video = document.createElement('video');\n if ('playsInline' in video) {\n // tslint:disable-next-line:no-any\n (video as any).playsInline = true;\n }\n video.muted = true;\n video.loop = true;\n video.style.position = 'fixed';\n video.style.left = '0px';\n video.style.top = '0px';\n\n video.preload = 'auto';\n video.appendChild(source);\n return new Promise(resolve => {\n video.addEventListener('loadeddata', _ => resolve(video));\n video.load();\n });\n}\n\nexport async function play(video: HTMLVideoElement) {\n await video.play();\n if ('requestVideoFrameCallback' in video) {\n await new Promise(resolve => {\n // tslint:disable-next-line:no-any\n (video as any).requestVideoFrameCallback(resolve);\n });\n }\n}\n","/** @license See the LICENSE file. */\n\n// This code is auto-generated, do not modify this file!\nconst version = '4.0.0';\nexport {version};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Add, AddInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Adds two `tf.Tensor`s element-wise, A + B. Supports broadcasting.\n *\n *\n * ```js\n * const a = tf.tensor1d([1, 2, 3, 4]);\n * const b = tf.tensor1d([10, 20, 30, 40]);\n *\n * a.add(b).print(); // or tf.add(a, b)\n * ```\n *\n * ```js\n * // Broadcast add a with b.\n * const a = tf.scalar(5);\n * const b = tf.tensor1d([10, 20, 30, 40]);\n *\n * a.add(b).print(); // or tf.add(a, b)\n * ```\n * @param a The first `tf.Tensor` to add.\n * @param b The second `tf.Tensor` to add. Must have the same type as `a`.\n *\n * @doc {heading: 'Operations', subheading: 'Arithmetic'}\n */\nfunction add_(a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n let $a = convertToTensor(a, 'a', 'add');\n let $b = convertToTensor(b, 'b', 'add');\n [$a, $b] = makeTypesMatch($a, $b);\n\n const inputs: AddInputs = {a: $a, b: $b};\n\n return ENGINE.runKernel(Add, inputs as {} as NamedTensorMap);\n}\n\nexport const add = op({add_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {FloorDiv, FloorDivInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Divides two `tf.Tensor`s element-wise, A / B. Supports broadcasting.\n * The result is rounded with floor function.\n *\n *\n * ```js\n * const a = tf.tensor1d([1, 4, 9, 16]);\n * const b = tf.tensor1d([1, 2, 3, 4]);\n *\n * a.floorDiv(b).print(); // or tf.div(a, b)\n * ```\n *\n * ```js\n * // Broadcast div a with b.\n * const a = tf.tensor1d([2, 4, 6, 8]);\n * const b = tf.scalar(2);\n *\n * a.floorDiv(b).print(); // or tf.floorDiv(a, b)\n * ```\n *\n * @param a The first tensor as the numerator.\n * @param b The second tensor as the denominator. Must have the same dtype as\n * `a`.\n *\n * @doc {heading: 'Operations', subheading: 'Arithmetic'}\n */\nfunction floorDiv_(\n a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n let $a = convertToTensor(a, 'a', 'floorDiv');\n let $b = convertToTensor(b, 'b', 'floorDiv');\n [$a, $b] = makeTypesMatch($a, $b);\n\n const inputs: FloorDivInputs = {a: $a, b: $b};\n\n return ENGINE.runKernel(FloorDiv, inputs as {} as NamedTensorMap);\n}\n\nexport const floorDiv = op({floorDiv_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {RealDiv, RealDivInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {floorDiv} from './floorDiv';\nimport {op} from './operation';\n\n/**\n * Divides two `tf.Tensor`s element-wise, A / B. Supports broadcasting.\n *\n * ```js\n * const a = tf.tensor1d([1, 4, 9, 16]);\n * const b = tf.tensor1d([1, 2, 3, 4]);\n *\n * a.div(b).print(); // or tf.div(a, b)\n * ```\n *\n * ```js\n * // Broadcast div a with b.\n * const a = tf.tensor1d([2, 4, 6, 8]);\n * const b = tf.scalar(2);\n *\n * a.div(b).print(); // or tf.div(a, b)\n * ```\n *\n * @param a The first tensor as the numerator.\n * @param b The second tensor as the denominator. Must have the same dtype as\n * `a`.\n *\n * @doc {heading: 'Operations', subheading: 'Arithmetic'}\n */\nfunction div_(a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n let $a = convertToTensor(a, 'a', 'div');\n let $b = convertToTensor(b, 'b', 'div');\n [$a, $b] = makeTypesMatch($a, $b);\n\n if ($a.dtype === 'int32' && $b.dtype === 'int32') {\n return floorDiv($a, $b);\n }\n\n const inputs: RealDivInputs = {a: $a, b: $b};\n const attrs = {};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n return ENGINE.runKernel(RealDiv, inputs as {} as NamedTensorMap, attrs) as T;\n}\n\nexport const div = op({div_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Multiply, MultiplyInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Multiplies two `tf.Tensor`s element-wise, A * B. Supports broadcasting.\n *\n * We also expose `tf.mulStrict` which has the same signature as this op and\n * asserts that `a` and `b` are the same shape (does not broadcast).\n *\n * ```js\n * const a = tf.tensor1d([1, 2, 3, 4]);\n * const b = tf.tensor1d([2, 3, 4, 5]);\n *\n * a.mul(b).print(); // or tf.mul(a, b)\n * ```\n *\n * ```js\n * // Broadcast mul a with b.\n * const a = tf.tensor1d([1, 2, 3, 4]);\n * const b = tf.scalar(5);\n *\n * a.mul(b).print(); // or tf.mul(a, b)\n * ```\n * @param a The first tensor to multiply.\n * @param b The second tensor to multiply. Must have the same dtype as `a`.\n *\n * @doc {heading: 'Operations', subheading: 'Arithmetic'}\n */\nfunction mul_(a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n let $a = convertToTensor(a, 'a', 'mul');\n let $b = convertToTensor(b, 'b', 'mul');\n [$a, $b] = makeTypesMatch($a, $b);\n\n const inputs: MultiplyInputs = {a: $a, b: $b};\n\n return ENGINE.runKernel(Multiply, inputs as {} as NamedTensorMap);\n}\nexport const mul = op({mul_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Abs, AbsInputs, ComplexAbs, ComplexAbsInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes absolute value element-wise: `abs(x)`\n *\n * ```js\n * const x = tf.tensor1d([-1, 2, -3, 4]);\n *\n * x.abs().print(); // or tf.abs(x)\n * ```\n * @param x The input `tf.Tensor`.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction abs_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'abs');\n\n if ($x.dtype === 'complex64') {\n const inputs: ComplexAbsInputs = {x: $x};\n return ENGINE.runKernel(ComplexAbs, inputs as {} as NamedTensorMap);\n } else {\n const inputs: AbsInputs = {x: $x};\n return ENGINE.runKernel(Abs, inputs as {} as NamedTensorMap);\n }\n}\n\nexport const abs = op({abs_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Acos, AcosInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes acos of the input `tf.Tensor` element-wise: `acos(x)`\n *\n * ```js\n * const x = tf.tensor1d([0, 1, -1, .7]);\n *\n * x.acos().print(); // or tf.acos(x)\n * ```\n * @param x The input tensor.\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction acos_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'acos');\n const inputs: AcosInputs = {x: $x};\n\n return ENGINE.runKernel(Acos, inputs as {} as NamedTensorMap);\n}\nexport const acos = op({acos_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Acosh, AcoshInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes the inverse hyperbolic cos of the input `tf.Tensor` element-wise:\n * `acosh(x)`\n *\n * ```js\n * const x = tf.tensor1d([10, 1, 3, 5.7]);\n *\n * x.acosh().print(); // or tf.acosh(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction acosh_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'acosh');\n const inputs: AcoshInputs = {x: $x};\n\n return ENGINE.runKernel(Acosh, inputs as {} as NamedTensorMap);\n}\nexport const acosh = op({acosh_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {AddN, AddNInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\n\n/**\n * Adds a list of `tf.Tensor`s element-wise, each with the same shape and dtype.\n *\n * ```js\n * const a = tf.tensor1d([1, 2]);\n * const b = tf.tensor1d([3, 4]);\n * const c = tf.tensor1d([5, 6]);\n *\n * tf.addN([a, b, c]).print();\n * ```\n * @param tensors A list of tensors with the same shape and dtype.\n * @doc {heading: 'Operations', subheading: 'Arithmetic'}\n */\nfunction addN_(tensors: Array): T {\n util.assert(\n Array.isArray(tensors),\n () => 'The argument passed to tf.addN() must be a list of tensors');\n util.assert(\n tensors.length >= 1,\n () => `Must pass at least one tensor to tf.addN(), but got ` +\n `${tensors.length}`);\n\n const $tensors =\n tensors.map((t, i) => convertToTensor(t, `tensors${i}`, 'addN'));\n\n const firstTensor = $tensors[0];\n $tensors.forEach(t => {\n if (t.dtype !== firstTensor.dtype) {\n throw new Error(\n 'All tensors passed to tf.addN() must have the same dtype');\n }\n });\n\n $tensors.forEach(t => {\n if (!util.arraysEqual(t.shape, firstTensor.shape)) {\n throw new Error(\n 'All tensors passed to tf.addN() must have the same shape');\n }\n });\n\n const inputs: AddNInputs = $tensors;\n\n return ENGINE.runKernel(AddN, inputs as {} as NamedTensorMap);\n}\n\nexport const addN = op({addN_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {All, AllAttrs, AllInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes the logical and of elements across dimensions of a `tf.Tensor`.\n *\n * Reduces the input along the dimensions given in `axes`. Unless `keepDims`\n * is true, the rank of the `tf.Tensor` is reduced by 1 for each entry in\n * `axes`. If `keepDims` is true, the reduced dimensions are retained with\n * length 1. If `axes` has no entries, all dimensions are reduced, and a\n * `tf.Tensor` with a single element is returned.\n *\n * ```js\n * const x = tf.tensor1d([1, 1, 1], 'bool');\n *\n * x.all().print(); // or tf.all(x)\n * ```\n *\n * ```js\n * const x = tf.tensor2d([1, 1, 0, 0], [2, 2], 'bool');\n *\n * const axis = 1;\n * x.all(axis).print(); // or tf.all(x, axis)\n * ```\n *\n * @param x The input tensor. Must be of dtype bool.\n * @param axis The dimension(s) to reduce. By default it reduces\n * all dimensions.\n * @param keepDims If true, retains reduced dimensions with size 1.\n *\n * @doc {heading: 'Operations', subheading: 'Reduction'}\n */\nfunction all_(\n x: Tensor|TensorLike, axis: number|number[] = null, keepDims = false): T {\n const $x = convertToTensor(x, 'x', 'all', 'bool');\n\n const inputs: AllInputs = {x: $x};\n const attrs: AllAttrs = {axis, keepDims};\n\n return ENGINE.runKernel(\n All, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const all = op({all_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Any, AnyAttrs, AnyInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes the logical or of elements across dimensions of a `tf.Tensor`.\n *\n * Reduces the input along the dimensions given in `axes`. Unless `keepDims`\n * is true, the rank of the `tf.Tensor` is reduced by 1 for each entry in\n * `axes`. If `keepDims` is true, the reduced dimensions are retained with\n * length 1. If `axes` has no entries, all dimensions are reduced, and a\n * `tf.Tensor` with a single element is returned.\n *\n * ```js\n * const x = tf.tensor1d([1, 1, 1], 'bool');\n *\n * x.any().print(); // or tf.any(x)\n * ```\n *\n * ```js\n * const x = tf.tensor2d([1, 1, 0, 0], [2, 2], 'bool');\n *\n * const axis = 1;\n * x.any(axis).print(); // or tf.any(x, axis)\n * ```\n *\n * @param x The input tensor. Must be of dtype bool.\n * @param axis The dimension(s) to reduce. By default it reduces\n * all dimensions.\n * @param keepDims If true, retains reduced dimensions with size 1.\n *\n * @doc {heading: 'Operations', subheading: 'Reduction'}\n */\nfunction any_(\n x: Tensor|TensorLike, axis: number|number[] = null, keepDims = false): T {\n const $x = convertToTensor(x, 'x', 'any', 'bool');\n\n const inputs: AnyInputs = {x: $x};\n const attrs: AnyAttrs = {axis, keepDims};\n\n return ENGINE.runKernel(\n Any, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\n// tslint:disable-next-line:variable-name\nexport const any = op({any_});\n","/**\n * @license\n * Copyright 2020 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {ArgMax, ArgMaxAttrs, ArgMaxInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Returns the indices of the maximum values along an `axis`.\n *\n * The result has the same shape as `input` with the dimension along `axis`\n * removed.\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 3]);\n *\n * x.argMax().print(); // or tf.argMax(x)\n * ```\n *\n * ```js\n * const x = tf.tensor2d([1, 2, 4, 3], [2, 2]);\n *\n * const axis = 1;\n * x.argMax(axis).print(); // or tf.argMax(x, axis)\n * ```\n *\n * @param x The input tensor.\n * @param axis The dimension to reduce. Defaults to 0 (outer-most dimension).\n *\n * @doc {heading: 'Operations', subheading: 'Reduction'}\n */\nfunction argMax_(x: Tensor|TensorLike, axis = 0): T {\n const $x = convertToTensor(x, 'x', 'argMax');\n\n const inputs: ArgMaxInputs = {x: $x};\n const attrs: ArgMaxAttrs = {axis};\n\n return ENGINE.runKernel(\n ArgMax, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const argMax = op({argMax_});\n","/**\n * @license\n * Copyright 2020 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {ArgMin, ArgMinAttrs, ArgMinInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Returns the indices of the minimum values along an `axis`.\n *\n * The result has the same shape as `input` with the dimension along `axis`\n * removed.\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 3]);\n *\n * x.argMin().print(); // or tf.argMin(x)\n * ```\n *\n * ```js\n * const x = tf.tensor2d([1, 2, 4, 3], [2, 2]);\n *\n * const axis = 1;\n * x.argMin(axis).print(); // or tf.argMin(x, axis)\n * ```\n *\n * @param x The input tensor.\n * @param axis The dimension to reduce. Defaults to 0 (outer-most dimension).\n *\n * @doc {heading: 'Operations', subheading: 'Reduction'}\n */\nfunction argMin_(x: Tensor|TensorLike, axis = 0): T {\n const $x = convertToTensor(x, 'x', 'argMin');\n\n const inputs: ArgMinInputs = {x: $x};\n const attrs: ArgMinAttrs = {axis};\n\n return ENGINE.runKernel(\n ArgMin, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const argMin = op({argMin_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Asin, AsinInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes asin of the input `tf.Tensor` element-wise: `asin(x)`\n *\n * ```js\n * const x = tf.tensor1d([0, 1, -1, .7]);\n *\n * x.asin().print(); // or tf.asin(x)\n * ```\n * @param x The input tensor.\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction asin_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'asin');\n const inputs: AsinInputs = {x: $x};\n\n return ENGINE.runKernel(Asin, inputs as {} as NamedTensorMap);\n}\nexport const asin = op({asin_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Asinh, AsinhInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes inverse hyperbolic sin of the input `tf.Tensor` element-wise:\n * `asinh(x)`\n *\n * ```js\n * const x = tf.tensor1d([0, 1, -1, .7]);\n *\n * x.asinh().print(); // or tf.asinh(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction asinh_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'asinh');\n\n const inputs: AsinhInputs = {x: $x};\n\n return ENGINE.runKernel(Asinh, inputs as {} as NamedTensorMap);\n}\nexport const asinh = op({asinh_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Atan, AtanInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes atan of the input `tf.Tensor` element-wise: `atan(x)`\n *\n * ```js\n * const x = tf.tensor1d([0, 1, -1, .7]);\n *\n * x.atan().print(); // or tf.atan(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction atan_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'atan');\n\n const inputs: AtanInputs = {x: $x};\n\n return ENGINE.runKernel(Atan, inputs as {} as NamedTensorMap);\n}\nexport const atan = op({atan_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Atan2, Atan2Inputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes arctangent of `tf.Tensor`s a / b element-wise: `atan2(a, b)`.\n * Supports broadcasting.\n *\n * ```js\n * const a = tf.tensor1d([1.0, 1.0, -1.0, .7]);\n * const b = tf.tensor1d([2.0, 13.0, 3.5, .21]);\n *\n * tf.atan2(a, b).print()\n * ```\n *\n * @param a The first tensor.\n * @param b The second tensor. Must have the same dtype as `a`.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction atan2_(\n a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n let $a = convertToTensor(a, 'a', 'atan2');\n let $b = convertToTensor(b, 'b', 'atan2');\n [$a, $b] = makeTypesMatch($a, $b);\n\n const inputs: Atan2Inputs = {a: $a, b: $b};\n\n return ENGINE.runKernel(Atan2, inputs as {} as NamedTensorMap);\n}\n\nexport const atan2 = op({atan2_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Atanh, AtanhInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes inverse hyperbolic tan of the input `tf.Tensor` element-wise:\n * `atanh(x)`\n *\n * ```js\n * const x = tf.tensor1d([0, .1, -.1, .7]);\n *\n * x.atanh().print(); // or tf.atanh(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction atanh_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'atanh');\n\n const inputs: AtanhInputs = {x: $x};\n\n return ENGINE.runKernel(Atanh, inputs as {} as NamedTensorMap);\n}\nexport const atanh = op({atanh_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport * as util from '../util';\n\ntype PadType = 'SAME'|'VALID'|'NUMBER'|'EXPLICIT';\n\n// For NHWC should be in the following form:\n// [[0, 0], [pad_top,pad_bottom], [pad_left, pad_right], [0, 0]]\n// For NCHW should be in the following form:\n// [[0, 0], [0, 0], [pad_top,pad_bottom], [pad_left, pad_right]]\n// Reference: https://www.tensorflow.org/api_docs/python/tf/nn/conv2d\nexport type ExplicitPadding =\n [[number, number], [number, number], [number, number], [number, number]];\n\nexport type PadInfo = {\n top: number,\n left: number,\n right: number,\n bottom: number,\n type: PadType\n};\n\nexport type PadInfo3D = {\n top: number,\n left: number,\n right: number,\n bottom: number,\n front: number,\n back: number,\n type: PadType\n};\n\n/**\n * Information about the forward pass of a convolution/pooling operation.\n * It includes input and output shape, strides, filter size and padding\n * information.\n */\nexport type Conv2DInfo = {\n batchSize: number,\n inHeight: number,\n inWidth: number,\n inChannels: number,\n outHeight: number,\n outWidth: number,\n outChannels: number,\n dataFormat: 'channelsFirst'|'channelsLast',\n strideHeight: number,\n strideWidth: number,\n dilationHeight: number,\n dilationWidth: number,\n filterHeight: number,\n filterWidth: number,\n effectiveFilterHeight: number,\n effectiveFilterWidth: number,\n padInfo: PadInfo,\n inShape: [number, number, number, number],\n outShape: [number, number, number, number],\n filterShape: [number, number, number, number]\n};\n\n/**\n *\n * @param inputShape Input tensor shape is of the following dimensions:\n * `[batch, height, width, inChannels]`.\n * @param filterShape The filter shape is of the following dimensions:\n * `[filterHeight, filterWidth, depth]`.\n * @param strides The strides of the sliding window for each dimension of the\n * input tensor: `[strideHeight, strideWidth]`.\n * If `strides` is a single number,\n * then `strideHeight == strideWidth`.\n * @param pad The type of padding algorithm.\n * - `same` and stride 1: output will be of same size as input,\n * regardless of filter size.\n * - `valid`: output will be smaller than input if filter is larger\n * than 1*1x1.\n * - For more info, see this guide:\n * [https://www.tensorflow.org/api_docs/python/tf/nn/convolution](\n * https://www.tensorflow.org/api_docs/python/tf/nn/convolution)\n * @param dataFormat The data format of the input and output data.\n * Defaults to 'NHWC'.\n * @param dilations The dilation rates: `[dilationHeight, dilationWidth]`.\n * Defaults to `[1, 1]`. If `dilations` is a single number, then\n * `dilationHeight == dilationWidth`.\n */\nexport function computeDilation2DInfo(\n inputShape: [number, number, number, number],\n filterShape: [number, number, number], strides: number|[number, number],\n pad: 'same'|'valid'|number, dataFormat: 'NHWC' = 'NHWC',\n dilations: number|[number, number]) {\n // `computerConv2DInfo` require filterShape to be in the dimension of:\n // `[filterHeight, filterWidth, depth, outDepth]`, dilation2d doesn't have\n // outDepth, it should have the same depth as the input.\n // Input shape: [batch, height, width, inChannels]\n const inputChannels = inputShape[3];\n const $filterShape =\n [...filterShape, inputChannels] as [number, number, number, number];\n const $dataFormat = convertConv2DDataFormat(dataFormat);\n\n return computeConv2DInfo(\n inputShape, $filterShape, strides, dilations, pad,\n null /* roundingMode */, null /* depthWise */, $dataFormat);\n}\n\nexport function computePool2DInfo(\n inShape: [number, number, number, number],\n filterSize: [number, number]|number, strides: number|[number, number],\n dilations: number|[number, number],\n pad: 'same'|'valid'|number|ExplicitPadding,\n roundingMode?: 'floor'|'round'|'ceil',\n dataFormat: 'channelsFirst'|'channelsLast' = 'channelsLast'): Conv2DInfo {\n const [filterHeight, filterWidth] = parseTupleParam(filterSize);\n\n let filterShape: [number, number, number, number];\n if (dataFormat === 'channelsLast') {\n filterShape = [filterHeight, filterWidth, inShape[3], inShape[3]];\n } else if (dataFormat === 'channelsFirst') {\n filterShape = [filterHeight, filterWidth, inShape[1], inShape[1]];\n } else {\n throw new Error(`Unknown dataFormat ${dataFormat}`);\n }\n\n return computeConv2DInfo(\n inShape, filterShape, strides, dilations, pad, roundingMode, false,\n dataFormat);\n}\n\n/**\n * Computes the information for a forward pass of a pooling3D operation.\n */\nexport function computePool3DInfo(\n inShape: [number, number, number, number, number],\n filterSize: number|[number, number, number],\n strides: number|[number, number, number],\n dilations: number|[number, number, number], pad: 'same'|'valid'|number,\n roundingMode?: 'floor'|'round'|'ceil',\n dataFormat: 'NDHWC'|'NCDHW' = 'NDHWC'): Conv3DInfo {\n const [filterDepth, filterHeight, filterWidth] = parse3TupleParam(filterSize);\n\n let filterShape: [number, number, number, number, number];\n let $dataFormat: 'channelsFirst'|'channelsLast';\n if (dataFormat === 'NDHWC') {\n $dataFormat = 'channelsLast';\n filterShape =\n [filterDepth, filterHeight, filterWidth, inShape[4], inShape[4]];\n } else if (dataFormat === 'NCDHW') {\n $dataFormat = 'channelsFirst';\n filterShape =\n [filterDepth, filterHeight, filterWidth, inShape[1], inShape[1]];\n } else {\n throw new Error(`Unknown dataFormat ${dataFormat}`);\n }\n\n return computeConv3DInfo(\n inShape, filterShape, strides, dilations, pad, false, $dataFormat,\n roundingMode);\n}\n\n/**\n * Computes the information for a forward pass of a convolution/pooling\n * operation.\n */\nexport function computeConv2DInfo(\n inShape: [number, number, number, number],\n filterShape: [number, number, number, number],\n strides: number|[number, number], dilations: number|[number, number],\n pad: 'same'|'valid'|number|ExplicitPadding,\n roundingMode?: 'floor'|'round'|'ceil', depthwise = false,\n dataFormat: 'channelsFirst'|'channelsLast' = 'channelsLast'): Conv2DInfo {\n let [batchSize, inHeight, inWidth, inChannels] = [-1, -1, -1, -1];\n if (dataFormat === 'channelsLast') {\n [batchSize, inHeight, inWidth, inChannels] = inShape;\n } else if (dataFormat === 'channelsFirst') {\n [batchSize, inChannels, inHeight, inWidth] = inShape;\n } else {\n throw new Error(`Unknown dataFormat ${dataFormat}`);\n }\n\n const [filterHeight, filterWidth, , filterChannels] = filterShape;\n const [strideHeight, strideWidth] = parseTupleParam(strides);\n const [dilationHeight, dilationWidth] = parseTupleParam(dilations);\n\n const effectiveFilterHeight =\n getEffectiveFilterSize(filterHeight, dilationHeight);\n const effectiveFilterWidth =\n getEffectiveFilterSize(filterWidth, dilationWidth);\n const {padInfo, outHeight, outWidth} = getPadAndOutInfo(\n pad, inHeight, inWidth, strideHeight, strideWidth, effectiveFilterHeight,\n effectiveFilterWidth, roundingMode, dataFormat);\n\n const outChannels = depthwise ? filterChannels * inChannels : filterChannels;\n\n let outShape: [number, number, number, number];\n if (dataFormat === 'channelsFirst') {\n outShape = [batchSize, outChannels, outHeight, outWidth];\n } else if (dataFormat === 'channelsLast') {\n outShape = [batchSize, outHeight, outWidth, outChannels];\n }\n\n return {\n batchSize,\n dataFormat,\n inHeight,\n inWidth,\n inChannels,\n outHeight,\n outWidth,\n outChannels,\n padInfo,\n strideHeight,\n strideWidth,\n filterHeight,\n filterWidth,\n effectiveFilterHeight,\n effectiveFilterWidth,\n dilationHeight,\n dilationWidth,\n inShape,\n outShape,\n filterShape\n };\n}\n\n/**\n * Information about the forward pass of a 3D convolution/pooling operation.\n * It includes input and output shape, strides, filter size and padding\n * information.\n */\nexport type Conv3DInfo = {\n batchSize: number,\n inDepth: number,\n inHeight: number,\n inWidth: number,\n inChannels: number,\n outDepth: number,\n outHeight: number,\n outWidth: number,\n outChannels: number,\n dataFormat: 'channelsFirst'|'channelsLast',\n strideDepth: number,\n strideHeight: number,\n strideWidth: number,\n dilationDepth: number,\n dilationHeight: number,\n dilationWidth: number,\n filterDepth: number,\n filterHeight: number,\n filterWidth: number,\n effectiveFilterDepth: number,\n effectiveFilterHeight: number,\n effectiveFilterWidth: number,\n padInfo: PadInfo3D,\n inShape: [number, number, number, number, number],\n outShape: [number, number, number, number, number],\n filterShape: [number, number, number, number, number]\n};\n\n/**\n * Computes the information for a forward pass of a 3D convolution/pooling\n * operation.\n */\nexport function computeConv3DInfo(\n inShape: [number, number, number, number, number],\n filterShape: [number, number, number, number, number],\n strides: number|[number, number, number],\n dilations: number|[number, number, number], pad: 'same'|'valid'|number,\n depthwise = false,\n dataFormat: 'channelsFirst'|'channelsLast' = 'channelsLast',\n roundingMode?: 'floor'|'round'|'ceil'): Conv3DInfo {\n let [batchSize, inDepth, inHeight, inWidth, inChannels] =\n [-1, -1, -1, -1, -1];\n if (dataFormat === 'channelsLast') {\n [batchSize, inDepth, inHeight, inWidth, inChannels] = inShape;\n } else if (dataFormat === 'channelsFirst') {\n [batchSize, inChannels, inDepth, inHeight, inWidth] = inShape;\n } else {\n throw new Error(`Unknown dataFormat ${dataFormat}`);\n }\n\n const [filterDepth, filterHeight, filterWidth, , filterChannels] =\n filterShape;\n const [strideDepth, strideHeight, strideWidth] = parse3TupleParam(strides);\n const [dilationDepth, dilationHeight, dilationWidth] =\n parse3TupleParam(dilations);\n\n const effectiveFilterDepth =\n getEffectiveFilterSize(filterDepth, dilationDepth);\n const effectiveFilterHeight =\n getEffectiveFilterSize(filterHeight, dilationHeight);\n const effectiveFilterWidth =\n getEffectiveFilterSize(filterWidth, dilationWidth);\n const {padInfo, outDepth, outHeight, outWidth} = get3DPadAndOutInfo(\n pad, inDepth, inHeight, inWidth, strideDepth, strideHeight, strideWidth,\n effectiveFilterDepth, effectiveFilterHeight, effectiveFilterWidth,\n roundingMode);\n\n const outChannels = depthwise ? filterChannels * inChannels : filterChannels;\n\n let outShape: [number, number, number, number, number];\n if (dataFormat === 'channelsFirst') {\n outShape = [batchSize, outChannels, outDepth, outHeight, outWidth];\n } else if (dataFormat === 'channelsLast') {\n outShape = [batchSize, outDepth, outHeight, outWidth, outChannels];\n }\n\n return {\n batchSize,\n dataFormat,\n inDepth,\n inHeight,\n inWidth,\n inChannels,\n outDepth,\n outHeight,\n outWidth,\n outChannels,\n padInfo,\n strideDepth,\n strideHeight,\n strideWidth,\n filterDepth,\n filterHeight,\n filterWidth,\n effectiveFilterDepth,\n effectiveFilterHeight,\n effectiveFilterWidth,\n dilationDepth,\n dilationHeight,\n dilationWidth,\n inShape,\n outShape,\n filterShape\n };\n}\n\nfunction computeOutputShape2D(\n inShape: [number, number], fieldSize: number, stride: number,\n zeroPad?: number, roundingMode?: 'floor'|'round'|'ceil'): [number, number] {\n if (zeroPad == null) {\n zeroPad = computeDefaultPad(inShape, fieldSize, stride);\n }\n const inputRows = inShape[0];\n const inputCols = inShape[1];\n\n const outputRows =\n round((inputRows - fieldSize + 2 * zeroPad) / stride + 1, roundingMode);\n const outputCols =\n round((inputCols - fieldSize + 2 * zeroPad) / stride + 1, roundingMode);\n\n return [outputRows, outputCols];\n}\n\nfunction computeOutputShape4D(\n inShape: [number, number, number, number], fieldSize: number,\n outChannels: number, stride: number, zeroPad?: number,\n roundingMode?: 'floor'|'round'|'ceil'): [number, number, number, number] {\n if (zeroPad == null) {\n zeroPad = computeDefaultPad(inShape, fieldSize, stride);\n }\n const inputDepth = inShape[0];\n const inputRows = inShape[1];\n const inputCols = inShape[2];\n\n const outputDepths =\n round((inputDepth - fieldSize + 2 * zeroPad) / stride + 1, roundingMode);\n const outputRows =\n round((inputRows - fieldSize + 2 * zeroPad) / stride + 1, roundingMode);\n const outputCols =\n round((inputCols - fieldSize + 2 * zeroPad) / stride + 1, roundingMode);\n\n return [outputDepths, outputRows, outputCols, outChannels];\n}\n\nexport function computeDefaultPad(\n inputShape: [number, number]|[number, number, number, number],\n fieldSize: number, stride: number, dilation = 1): number {\n const effectiveFieldSize = getEffectiveFilterSize(fieldSize, dilation);\n return Math.floor(\n (inputShape[0] * (stride - 1) - stride + effectiveFieldSize) / 2);\n}\n\nfunction parseTupleParam(param: number|number[]): [number, number, number] {\n if (typeof param === 'number') {\n return [param, param, param];\n }\n if (param.length === 2) {\n return [param[0], param[1], 1];\n }\n return param as [number, number, number];\n}\n\nfunction parse3TupleParam(param: number|[number, number, number]):\n [number, number, number] {\n return typeof param === 'number' ? [param, param, param] : param;\n}\n\n/* See https://www.tensorflow.org/api_docs/python/tf/nn/atrous_conv2d\n * Atrous convolution is equivalent to standard convolution with upsampled\n * filters with effective_filter_height =\n * filter_height + (filter_height - 1) * (dilation - 1)\n * and effective_filter_width =\n * filter_width + (filter_width - 1) * (dilation - 1),\n * produced by inserting dilation - 1 zeros along consecutive elements across\n * the filters' spatial dimensions.\n * When there is a dilation, this converts a filter dimension to the\n * effective filter dimension, so it can be used in a standard convolution.\n */\nfunction getEffectiveFilterSize(filterSize: number, dilation: number) {\n if (dilation <= 1) {\n return filterSize;\n }\n\n return filterSize + (filterSize - 1) * (dilation - 1);\n}\n\nfunction getPadAndOutInfo(\n pad: 'same'|'valid'|number|ExplicitPadding, inHeight: number,\n inWidth: number, strideHeight: number, strideWidth: number,\n filterHeight: number, filterWidth: number,\n roundingMode: 'floor'|'round'|'ceil',\n dataFormat: 'channelsFirst'|\n 'channelsLast'): {padInfo: PadInfo, outHeight: number, outWidth: number} {\n let padInfo: PadInfo;\n let outHeight: number;\n let outWidth: number;\n\n if (typeof pad === 'number') {\n const padType = (pad === 0) ? 'VALID' : 'NUMBER';\n padInfo = {top: pad, bottom: pad, left: pad, right: pad, type: padType};\n const outShape = computeOutputShape2D(\n [inHeight, inWidth], filterHeight, strideHeight, pad, roundingMode);\n outHeight = outShape[0];\n outWidth = outShape[1];\n } else if (pad === 'same') {\n outHeight = Math.ceil(inHeight / strideHeight);\n outWidth = Math.ceil(inWidth / strideWidth);\n const padAlongHeight =\n Math.max(0, (outHeight - 1) * strideHeight + filterHeight - inHeight);\n const padAlongWidth =\n Math.max(0, (outWidth - 1) * strideWidth + filterWidth - inWidth);\n const top = Math.floor(padAlongHeight / 2);\n const bottom = padAlongHeight - top;\n const left = Math.floor(padAlongWidth / 2);\n const right = padAlongWidth - left;\n padInfo = {top, bottom, left, right, type: 'SAME'};\n } else if (pad === 'valid') {\n padInfo = {top: 0, bottom: 0, left: 0, right: 0, type: 'VALID'};\n outHeight = Math.ceil((inHeight - filterHeight + 1) / strideHeight);\n outWidth = Math.ceil((inWidth - filterWidth + 1) / strideWidth);\n } else if (typeof pad === 'object') {\n const top = dataFormat === 'channelsLast' ? pad[1][0] : pad[2][0];\n const bottom = dataFormat === 'channelsLast' ? pad[1][1] : pad[2][1];\n const left = dataFormat === 'channelsLast' ? pad[2][0] : pad[3][0];\n const right = dataFormat === 'channelsLast' ? pad[2][1] : pad[3][1];\n const padType = (top === 0 && bottom === 0 && left === 0 && right === 0) ?\n 'VALID' :\n 'EXPLICIT';\n padInfo = {top, bottom, left, right, type: padType};\n outHeight = round(\n (inHeight - filterHeight + top + bottom) / strideHeight + 1,\n roundingMode);\n outWidth = round(\n (inWidth - filterWidth + left + right) / strideWidth + 1, roundingMode);\n } else {\n throw Error(`Unknown padding parameter: ${pad}`);\n }\n return {padInfo, outHeight, outWidth};\n}\n\nfunction get3DPadAndOutInfo(\n pad: 'same'|'valid'|number, inDepth: number, inHeight: number,\n inWidth: number, strideDepth: number, strideHeight: number,\n strideWidth: number, filterDepth: number, filterHeight: number,\n filterWidth: number, roundingMode?: 'floor'|'round'|'ceil'): {\n padInfo: PadInfo3D,\n outDepth: number,\n outHeight: number,\n outWidth: number\n} {\n let padInfo: PadInfo3D;\n let outDepth: number;\n let outHeight: number;\n let outWidth: number;\n\n if (typeof pad === 'number') {\n const padType = (pad === 0) ? 'VALID' : 'NUMBER';\n padInfo = {\n top: pad,\n bottom: pad,\n left: pad,\n right: pad,\n front: pad,\n back: pad,\n type: padType\n };\n const outShape = computeOutputShape4D(\n [inDepth, inHeight, inWidth, 1], filterDepth, 1, strideDepth, pad,\n roundingMode);\n outDepth = outShape[0];\n outHeight = outShape[1];\n outWidth = outShape[2];\n } else if (pad === 'same') {\n outDepth = Math.ceil(inDepth / strideDepth);\n outHeight = Math.ceil(inHeight / strideHeight);\n outWidth = Math.ceil(inWidth / strideWidth);\n const padAlongDepth = (outDepth - 1) * strideDepth + filterDepth - inDepth;\n const padAlongHeight =\n (outHeight - 1) * strideHeight + filterHeight - inHeight;\n const padAlongWidth = (outWidth - 1) * strideWidth + filterWidth - inWidth;\n const front = Math.floor(padAlongDepth / 2);\n const back = padAlongDepth - front;\n const top = Math.floor(padAlongHeight / 2);\n const bottom = padAlongHeight - top;\n const left = Math.floor(padAlongWidth / 2);\n const right = padAlongWidth - left;\n\n padInfo = {top, bottom, left, right, front, back, type: 'SAME'};\n } else if (pad === 'valid') {\n padInfo = {\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n front: 0,\n back: 0,\n type: 'VALID'\n };\n outDepth = Math.ceil((inDepth - filterDepth + 1) / strideDepth);\n outHeight = Math.ceil((inHeight - filterHeight + 1) / strideHeight);\n outWidth = Math.ceil((inWidth - filterWidth + 1) / strideWidth);\n } else {\n throw Error(`Unknown padding parameter: ${pad}`);\n }\n return {padInfo, outDepth, outHeight, outWidth};\n}\n\n/**\n * Rounds a value depending on the rounding mode\n * @param value\n * @param roundingMode A string from: 'ceil', 'round', 'floor'. If none is\n * provided, it will default to truncate.\n */\nfunction round(value: number, roundingMode?: 'floor'|'round'|'ceil') {\n if (!roundingMode) {\n return Math.trunc(value);\n }\n switch (roundingMode) {\n case 'round':\n // used for Caffe Conv\n return Math.round(value);\n case 'ceil':\n // used for Caffe Pool\n return Math.ceil(value);\n case 'floor':\n return Math.floor(value);\n default:\n throw new Error(`Unknown roundingMode ${roundingMode}`);\n }\n}\n\nexport function tupleValuesAreOne(param: number|number[]): boolean {\n const [dimA, dimB, dimC] = parseTupleParam(param);\n return dimA === 1 && dimB === 1 && dimC === 1;\n}\n\nexport function eitherStridesOrDilationsAreOne(\n strides: number|number[], dilations: number|number[]): boolean {\n return tupleValuesAreOne(strides) || tupleValuesAreOne(dilations);\n}\n\n/**\n * Convert Conv2D dataFormat from 'NHWC'|'NCHW' to\n * 'channelsLast'|'channelsFirst'\n * @param dataFormat in 'NHWC'|'NCHW' mode\n * @return dataFormat in 'channelsLast'|'channelsFirst' mode\n * @throws unknown dataFormat\n */\nexport function convertConv2DDataFormat(dataFormat: 'NHWC'|'NCHW'):\n 'channelsLast'|'channelsFirst' {\n if (dataFormat === 'NHWC') {\n return 'channelsLast';\n } else if (dataFormat === 'NCHW') {\n return 'channelsFirst';\n } else {\n throw new Error(`Unknown dataFormat ${dataFormat}`);\n }\n}\n\n/**\n * Check validity of pad when using dimRoundingMode.\n * @param opDesc A string of op description\n * @param pad The type of padding algorithm.\n * - `same` and stride 1: output will be of same size as input,\n * regardless of filter size.\n * - `valid` output will be smaller than input if filter is larger\n * than 1x1.\n * - For more info, see this guide:\n * [https://www.tensorflow.org/api_docs/python/tf/nn/convolution](\n * https://www.tensorflow.org/api_docs/python/tf/nn/convolution)\n * @param dimRoundingMode A string from: 'ceil', 'round', 'floor'. If none is\n * provided, it will default to truncate.\n * @throws unknown padding parameter\n */\nexport function checkPadOnDimRoundingMode(\n opDesc: string, pad: 'valid'|'same'|number|ExplicitPadding,\n dimRoundingMode?: 'floor'|'round'|'ceil') {\n if (dimRoundingMode != null) {\n if (typeof pad === 'string') {\n throw Error(\n `Error in ${opDesc}: pad must be an integer when using ` +\n `dimRoundingMode ${dimRoundingMode} but got pad ${pad}.`);\n } else if (typeof pad === 'number') {\n util.assert(\n util.isInt(pad),\n () => `Error in ${opDesc}: pad must be an integer when using ` +\n `dimRoundingMode ${dimRoundingMode} but got pad ${pad}.`);\n } else if (typeof pad === 'object') {\n (pad as ExplicitPadding).forEach(p => {p.forEach(v =>{\n util.assert(\n util.isInt(v),\n () => `Error in ${opDesc}: pad must be an integer when using ` +\n `dimRoundingMode ${dimRoundingMode} but got pad ${v}.`);\n });\n });\n } else {\n throw Error(`Error in ${opDesc}: Unknown padding parameter: ${pad}`);\n }\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Reshape, ReshapeAttrs, ReshapeInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {Rank, ShapeMap, TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Reshapes a `tf.Tensor` to a given shape.\n *\n * Given an input tensor, returns a new tensor with the same values as the\n * input tensor with shape `shape`.\n *\n * If one component of shape is the special value -1, the size of that\n * dimension is computed so that the total size remains constant. In\n * particular, a shape of [-1] flattens into 1-D. At most one component of\n * shape can be -1.\n *\n * If shape is 1-D or higher, then the operation returns a tensor with shape\n * shape filled with the values of tensor. In this case, the number of\n * elements implied by shape must be the same as the number of elements in\n * tensor.\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 3, 4]);\n * x.reshape([2, 2]).print();\n * ```\n *\n * @param x The input tensor to be reshaped.\n * @param shape An array of integers defining the output tensor shape.\n *\n * @doc {heading: 'Tensors', subheading: 'Transformations'}\n */\nfunction reshape_(\n x: Tensor|TensorLike, shape: ShapeMap[R]): Tensor {\n const $x = convertToTensor(x, 'x', 'reshape', 'string_or_numeric');\n\n const inputs: ReshapeInputs = {x: $x};\n const attrs: ReshapeAttrs = {shape};\n return ENGINE.runKernel(\n Reshape, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\nexport const reshape = op({reshape_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {AvgPool, AvgPoolAttrs, AvgPoolInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor3D, Tensor4D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {cast} from './cast';\nimport * as conv_util from './conv_util';\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * Computes the 2D average pooling of an image.\n *\n * @param x The input tensor, of rank 4 or rank 3 of shape\n * `[batch, height, width, inChannels]`. If rank 3, batch of 1 is assumed.\n * @param filterSize The filter size: `[filterHeight, filterWidth]`. If\n * `filterSize` is a single number, then `filterHeight == filterWidth`.\n * @param strides The strides of the pooling: `[strideHeight, strideWidth]`. If\n * `strides` is a single number, then `strideHeight == strideWidth`.\n * @param pad The type of padding algorithm:\n * - `same` and stride 1: output will be of same size as input,\n * regardless of filter size.\n * - `valid`: output will be smaller than input if filter is larger\n * than 1x1.\n * - For more info, see this guide:\n * [https://www.tensorflow.org/api_docs/python/tf/nn/convolution](\n * https://www.tensorflow.org/api_docs/python/tf/nn/convolution)\n * @param dimRoundingMode A string from: 'ceil', 'round', 'floor'. If none is\n * provided, it will default to truncate.\n */\nfunction avgPool_(\n x: T|TensorLike, filterSize: [number, number]|number,\n strides: [number, number]|number,\n pad: 'valid'|'same'|number|conv_util.ExplicitPadding,\n dimRoundingMode?: 'floor'|'round'|'ceil'): T {\n const $x = convertToTensor(x, 'x', 'avgPool', 'float32');\n const dilations = 1;\n\n util.assert(\n conv_util.eitherStridesOrDilationsAreOne(strides, dilations),\n () => 'Error in avgPool: Either strides or dilations must be 1. ' +\n `Got strides ${strides} and dilations '${dilations}'`);\n\n let x4D = $x as Tensor4D;\n let reshapedTo4D = false;\n if ($x.rank === 3) {\n reshapedTo4D = true;\n x4D = reshape($x, [1, $x.shape[0], $x.shape[1], $x.shape[2]]);\n }\n\n util.assert(\n x4D.rank === 4,\n () => `Error in avgPool: x must be rank 4 but got rank ${x4D.rank}.`);\n conv_util.checkPadOnDimRoundingMode('avgPool', pad, dimRoundingMode);\n const inputs: AvgPoolInputs = {x: x4D};\n const attrs: AvgPoolAttrs = {filterSize, strides, pad, dimRoundingMode};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n let res = ENGINE.runKernel(\n AvgPool, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as T;\n\n res = cast(res, $x.dtype);\n\n if (reshapedTo4D) {\n return reshape(res, [res.shape[1], res.shape[2], res.shape[3]]) as T;\n }\n\n return res;\n}\n\nexport const avgPool = op({avgPool_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {AvgPool3D, AvgPool3DAttrs, AvgPool3DInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor4D, Tensor5D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {checkPadOnDimRoundingMode} from './conv_util';\nimport {cast} from './cast';\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * Computes the 3D average pooling.\n *\n * ```js\n * const x = tf.tensor5d([1, 2, 3, 4, 5, 6, 7, 8], [1, 2, 2, 2, 1]);\n * const result = tf.avgPool3d(x, 2, 1, 'valid');\n * result.print();\n * ```\n *\n * @param x The input tensor, of rank 5 or rank 4 of shape\n * `[batch, depth, height, width, inChannels]`.\n * @param filterSize The filter size:\n * `[filterDepth, filterHeight, filterWidth]`.\n * If `filterSize` is a single number,\n * then `filterDepth == filterHeight == filterWidth`.\n * @param strides The strides of the pooling:\n * `[strideDepth, strideHeight, strideWidth]`.\n * If `strides` is a single number,\n * then `strideDepth == strideHeight == strideWidth`.\n * @param pad The type of padding algorithm.\n * - `same` and stride 1: output will be of same size as input,\n * regardless of filter size.\n * - `valid`: output will be smaller than input if filter is larger\n * than 1*1x1.\n * - For more info, see this guide:\n * [https://www.tensorflow.org/api_docs/python/tf/nn/convolution](\n * https://www.tensorflow.org/api_docs/python/tf/nn/convolution)\n * @param dimRoundingMode A string from: 'ceil', 'round', 'floor'. If none is\n * provided, it will default to truncate.\n * @param dataFormat An optional string from: \"NDHWC\", \"NCDHW\". Defaults to\n * \"NDHWC\". Specify the data format of the input and output data. With the\n * default format \"NDHWC\", the data is stored in the order of: [batch,\n * depth, height, width, channels]. Only \"NDHWC\" is currently supported.\n *\n * @doc {heading: 'Operations', subheading: 'Convolution'}\n */\nfunction avgPool3d_(\n x: T|TensorLike, filterSize: [number, number, number]|number,\n strides: [number, number, number]|number, pad: 'valid'|'same'|number,\n dimRoundingMode?: 'floor'|'round'|'ceil',\n dataFormat: 'NDHWC'|'NCDHW' = 'NDHWC'): T {\n const $x = convertToTensor(x, 'x', 'avgPool3d', 'float32');\n\n let x5D = $x as Tensor5D;\n let reshapedTo5D = false;\n if ($x.rank === 4) {\n reshapedTo5D = true;\n x5D = reshape($x, [1, $x.shape[0], $x.shape[1], $x.shape[2], $x.shape[3]]);\n }\n\n util.assert(\n x5D.rank === 5,\n () => `Error in avgPool3d: x must be rank 5 but got rank ${x5D.rank}.`);\n util.assert(\n dataFormat === 'NDHWC',\n () => `Error in avgPool3d: Only NDHWC is currently supported, ` +\n `but got dataFormat of ${dataFormat}`);\n checkPadOnDimRoundingMode('avgPool3d', pad, dimRoundingMode);\n const inputs: AvgPool3DInputs = {x: x5D};\n const attrs:\n AvgPool3DAttrs = {filterSize, strides, pad, dimRoundingMode, dataFormat};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n let res = ENGINE.runKernel(\n AvgPool3D, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as T;\n\n res = cast(res, x5D.dtype);\n\n if (reshapedTo5D) {\n return reshape(\n res, [res.shape[1], res.shape[2], res.shape[3], res.shape[4]]) as\n T;\n }\n\n return res;\n}\n\nexport const avgPool3d = op({avgPool3d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Concat, ConcatAttrs, ConcatInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensorArray} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {assert} from '../util';\n\nimport {clone} from './clone';\nimport {op} from './operation';\n\n/**\n * Concatenates a list of `tf.Tensor`s along a given axis.\n *\n * The tensors ranks and types must match, and their sizes must match in all\n * dimensions except `axis`.\n *\n * Also available are stricter rank-specific methods that assert that\n * `tensors` are of the given rank:\n * - `tf.concat1d`\n * - `tf.concat2d`\n * - `tf.concat3d`\n * - `tf.concat4d`\n *\n * Except `tf.concat1d` (which does not have axis param), all methods have\n * same signature as this method.\n *\n * ```js\n * const a = tf.tensor1d([1, 2]);\n * const b = tf.tensor1d([3, 4]);\n * a.concat(b).print(); // or a.concat(b)\n * ```\n *\n * ```js\n * const a = tf.tensor1d([1, 2]);\n * const b = tf.tensor1d([3, 4]);\n * const c = tf.tensor1d([5, 6]);\n * tf.concat([a, b, c]).print();\n * ```\n *\n * ```js\n * const a = tf.tensor2d([[1, 2], [10, 20]]);\n * const b = tf.tensor2d([[3, 4], [30, 40]]);\n * const axis = 1;\n * tf.concat([a, b], axis).print();\n * ```\n * @param tensors A list of tensors to concatenate.\n * @param axis The axis to concatenate along. Defaults to 0 (the first dim).\n *\n * @doc {heading: 'Tensors', subheading: 'Slicing and Joining'}\n */\nfunction concat_(tensors: Array, axis = 0): T {\n assert(tensors.length >= 1, () => 'Pass at least one tensor to concat');\n\n const $tensors =\n convertToTensorArray(tensors, 'tensors', 'concat', 'string_or_numeric');\n\n if ($tensors[0].dtype === 'complex64') {\n $tensors.forEach(tensor => {\n if (tensor.dtype !== 'complex64') {\n throw new Error(`Cannot concatenate complex64 tensors with a tensor\n with dtype ${tensor.dtype}. `);\n }\n });\n }\n\n if ($tensors.length === 1) {\n return clone($tensors[0]);\n }\n\n const inputs: ConcatInputs = $tensors;\n const attr: ConcatAttrs = {axis};\n\n return ENGINE.runKernel(\n Concat, inputs as {} as NamedTensorMap, attr as {} as NamedAttrMap);\n}\n\nexport const concat = op({concat_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Sigmoid, SigmoidInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes sigmoid element-wise, `1 / (1 + exp(-x))`\n *\n * ```js\n * const x = tf.tensor1d([0, -1, 2, -3]);\n *\n * x.sigmoid().print(); // or tf.sigmoid(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction sigmoid_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'sigmoid', 'float32');\n\n const inputs: SigmoidInputs = {x: $x};\n\n return ENGINE.runKernel(Sigmoid, inputs as {} as NamedTensorMap);\n}\nexport const sigmoid = op({sigmoid_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Slice, SliceAttrs, SliceInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {Rank, TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Extracts a slice from a `tf.Tensor` starting at coordinates `begin`\n * and is of size `size`.\n *\n * Also available are stricter rank-specific methods with the same signature\n * as this method that assert that `x` is of the given rank:\n * - `tf.slice1d`\n * - `tf.slice2d`\n * - `tf.slice3d`\n * - `tf.slice4d`\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 3, 4]);\n *\n * x.slice([1], [2]).print();\n * ```\n *\n * ```js\n * const x = tf.tensor2d([1, 2, 3, 4], [2, 2]);\n *\n * x.slice([1, 0], [1, 2]).print();\n * ```\n * @param x The input `tf.Tensor` to slice from.\n * @param begin The coordinates to start the slice from. The length can be\n * less than the rank of x - the rest of the axes will have implicit 0 as\n * start. Can also be a single number, in which case it specifies the\n * first axis.\n * @param size The size of the slice. The length can be less than the rank of\n * x - the rest of the axes will have implicit -1. A value of -1 requests\n * the rest of the dimensions in the axis. Can also be a single number,\n * in which case it specifies the size of the first axis.\n *\n * @doc {heading: 'Tensors', subheading: 'Slicing and Joining'}\n */\nfunction slice_>(\n x: T|TensorLike, begin: number|number[], size?: number|number[]): T {\n const $x = convertToTensor(x, 'x', 'slice', 'string_or_numeric');\n\n if ($x.rank === 0) {\n throw new Error('Slicing scalar is not possible');\n }\n\n const inputs: SliceInputs = {x: $x};\n const attrs: SliceAttrs = {begin, size};\n\n return ENGINE.runKernel(\n Slice, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const slice = op({slice_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Tanh, TanhInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes hyperbolic tangent of the input `tf.Tensor` element-wise: `tanh(x)`\n *\n * ```js\n * const x = tf.tensor1d([0, 1, -1, 70]);\n *\n * x.tanh().print(); // or tf.tanh(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction tanh_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'tanh', 'float32');\n\n const inputs: TanhInputs = {x: $x};\n\n return ENGINE.runKernel(Tanh, inputs as {} as NamedTensorMap);\n}\nexport const tanh = op({tanh_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Scalar, Tensor1D, Tensor2D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {add} from './add';\nimport {concat} from './concat';\nimport {matMul} from './mat_mul';\nimport {mul} from './mul';\nimport {op} from './operation';\nimport {sigmoid} from './sigmoid';\nimport {slice} from './slice';\nimport {tanh} from './tanh';\n\n/**\n * Computes the next state and output of a BasicLSTMCell.\n *\n * Returns `[newC, newH]`.\n *\n * Derived from tf.contrib.rnn.BasicLSTMCell.\n *\n * @param forgetBias Forget bias for the cell.\n * @param lstmKernel The weights for the cell.\n * @param lstmBias The bias for the cell.\n * @param data The input to the cell.\n * @param c Previous cell state.\n * @param h Previous cell output.\n *\n * @doc {heading: 'Operations', subheading: 'RNN'}\n */\nfunction basicLSTMCell_(\n forgetBias: Scalar|TensorLike, lstmKernel: Tensor2D|TensorLike,\n lstmBias: Tensor1D|TensorLike, data: Tensor2D|TensorLike,\n c: Tensor2D|TensorLike, h: Tensor2D|TensorLike): [Tensor2D, Tensor2D] {\n const $forgetBias =\n convertToTensor(forgetBias, 'forgetBias', 'basicLSTMCell');\n const $lstmKernel =\n convertToTensor(lstmKernel, 'lstmKernel', 'basicLSTMCell');\n const $lstmBias = convertToTensor(lstmBias, 'lstmBias', 'basicLSTMCell');\n const $data = convertToTensor(data, 'data', 'basicLSTMCell');\n const $c = convertToTensor(c, 'c', 'basicLSTMCell');\n const $h = convertToTensor(h, 'h', 'basicLSTMCell');\n\n const combined = concat([$data, $h], 1);\n const weighted = matMul(combined, $lstmKernel);\n const res: Tensor2D = add(weighted, $lstmBias);\n\n // i = input_gate, j = new_input, f = forget_gate, o = output_gate\n const batchSize = res.shape[0];\n const sliceCols = res.shape[1] / 4;\n const sliceSize: [number, number] = [batchSize, sliceCols];\n const i = slice(res, [0, 0], sliceSize);\n const j = slice(res, [0, sliceCols], sliceSize);\n const f = slice(res, [0, sliceCols * 2], sliceSize);\n const o = slice(res, [0, sliceCols * 3], sliceSize);\n\n const newC: Tensor2D =\n add(mul(sigmoid(i), tanh(j)),\n mul($c, sigmoid(add($forgetBias, f)) as Tensor2D));\n const newH: Tensor2D = mul(tanh(newC), sigmoid(o));\n return [newC, newH];\n}\n\nexport const basicLSTMCell = op({basicLSTMCell_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {BatchToSpaceND, BatchToSpaceNDAttrs, BatchToSpaceNDInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\n\n/**\n * This operation reshapes the \"batch\" dimension 0 into `M + 1` dimensions of\n * shape `blockShape + [batch]`, interleaves these blocks back into the grid\n * defined by the spatial dimensions `[1, ..., M]`, to obtain a result with\n * the same rank as the input. The spatial dimensions of this intermediate\n * result are then optionally cropped according to `crops` to produce the\n * output. This is the reverse of `tf.spaceToBatchND`. See below for a precise\n * description.\n *\n * ```js\n * const x = tf.tensor4d([1, 2, 3, 4], [4, 1, 1, 1]);\n * const blockShape = [2, 2];\n * const crops = [[0, 0], [0, 0]];\n *\n * x.batchToSpaceND(blockShape, crops).print();\n * ```\n *\n * @param x A `tf.Tensor`. N-D with `x.shape` = `[batch] + spatialShape +\n * remainingShape`, where spatialShape has `M` dimensions.\n * @param blockShape A 1-D array. Must have shape `[M]`, all values must\n * be >= 1.\n * @param crops A 2-D array. Must have shape `[M, 2]`, all values must be >= 0.\n * `crops[i] = [cropStart, cropEnd]` specifies the amount to crop from input\n * dimension `i + 1`, which corresponds to spatial dimension `i`. It is required\n * that `cropStart[i] + cropEnd[i] <= blockShape[i] * inputShape[i + 1]`\n *\n * This operation is equivalent to the following steps:\n *\n * 1. Reshape `x` to `reshaped` of shape: `[blockShape[0], ...,\n * blockShape[M-1], batch / prod(blockShape), x.shape[1], ...,\n * x.shape[N-1]]`\n *\n * 2. Permute dimensions of `reshaped` to produce `permuted` of shape `[batch /\n * prod(blockShape),x.shape[1], blockShape[0], ..., x.shape[M],\n * blockShape[M-1],x.shape[M+1], ..., x.shape[N-1]]`\n *\n * 3. Reshape `permuted` to produce `reshapedPermuted` of shape `[batch /\n * prod(blockShape),x.shape[1] * blockShape[0], ..., x.shape[M] *\n * blockShape[M-1],x.shape[M+1], ..., x.shape[N-1]]`\n *\n * 4. Crop the start and end of dimensions `[1, ..., M]` of `reshapedPermuted`\n * according to `crops` to produce the output of shape: `[batch /\n * prod(blockShape),x.shape[1] * blockShape[0] - crops[0,0] - crops[0,1],\n * ..., x.shape[M] * blockShape[M-1] - crops[M-1,0] -\n * crops[M-1,1],x.shape[M+1], ..., x.shape[N-1]]`\n *\n * @doc {heading: 'Tensors', subheading: 'Transformations'}\n */\nfunction batchToSpaceND_(\n x: T|TensorLike, blockShape: number[], crops: number[][]): T {\n const $x = convertToTensor(x, 'x', 'batchToSpaceND');\n const prod = blockShape.reduce((a, b) => a * b);\n\n util.assert(\n $x.rank >= 1 + blockShape.length,\n () => `input rank is ${$x.rank} but should be > than blockShape.length ${\n blockShape.length}`);\n\n util.assert(\n crops.length === blockShape.length,\n () => `crops.length is ${\n crops.length} but should be equal to blockShape.length ${\n blockShape.length}`);\n\n util.assert(\n $x.shape[0] % prod === 0,\n () => `input tensor batch is ${\n $x.shape[0]} but is not divisible by the product of ` +\n `the elements of blockShape ${blockShape.join(' * ')} === ${prod}`);\n\n const inputs: BatchToSpaceNDInputs = {x: $x};\n const attrs: BatchToSpaceNDAttrs = {blockShape, crops};\n\n return ENGINE.runKernel(\n BatchToSpaceND, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap);\n}\n\nexport const batchToSpaceND = op({batchToSpaceND_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor, Tensor4D} from '../tensor';\nimport {Rank} from '../types';\nimport {reshape} from './reshape';\n\nexport function xAs4D(x: Tensor) {\n let x4D: Tensor4D;\n if (x.rank === 0 || x.rank === 1) {\n x4D = reshape(x, [1, 1, 1, x.size]);\n } else if (x.rank === 2) {\n x4D = reshape(x, [1, 1, x.shape[0], x.shape[1]]);\n } else if (x.rank === 3) {\n x4D = reshape(x, [1, x.shape[0], x.shape[1], x.shape[2]]);\n } else {\n x4D = x as Tensor4D;\n }\n\n return x4D;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {FusedBatchNorm, FusedBatchNormAttrs, FusedBatchNormInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor, Tensor1D, Tensor4D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {Rank, TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {xAs4D} from './batchnorm_util';\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * Batch normalization.\n *\n * As described in\n * [http://arxiv.org/abs/1502.03167](http://arxiv.org/abs/1502.03167).\n *\n * Mean, variance, scale, and offset can be of two shapes:\n * - The same shape as the input.\n * - In the common case, the depth dimension is the last dimension of x, so\n * the values would be a `tf.Tensor1D` of shape [depth].\n *\n * Also available are stricter rank-specific methods with the same signature\n * as this method that assert that parameters passed are of given rank\n * - `tf.batchNorm2d`\n * - `tf.batchNorm3d`\n * - `tf.batchNorm4d`\n *\n * @param x The input Tensor.\n * @param mean A mean Tensor.\n * @param variance A variance Tensor.\n * @param offset An offset Tensor.\n * @param scale A scale Tensor.\n * @param varianceEpsilon A small float number to avoid dividing by 0.\n *\n * @doc {heading: 'Operations', subheading: 'Normalization'}\n */\nfunction batchNorm_(\n x: Tensor|TensorLike, mean: Tensor|Tensor1D|TensorLike,\n variance: Tensor|Tensor1D|TensorLike,\n offset?: Tensor|Tensor1D|TensorLike,\n scale?: Tensor|Tensor1D|TensorLike,\n varianceEpsilon?: number): Tensor {\n if (varianceEpsilon == null) {\n varianceEpsilon = 0.001;\n }\n const $x = convertToTensor(x, 'x', 'batchNorm');\n const $mean = convertToTensor(mean, 'mean', 'batchNorm');\n const $variance = convertToTensor(variance, 'variance', 'batchNorm');\n let $scale: Tensor|Tensor1D;\n if (scale != null) {\n $scale = convertToTensor(scale, 'scale', 'batchNorm');\n }\n let $offset: Tensor|Tensor1D;\n if (offset != null) {\n $offset = convertToTensor(offset, 'offset', 'batchNorm');\n }\n\n util.assert(\n $mean.rank === $variance.rank,\n () => 'Batch normalization gradient requires mean and variance to have ' +\n 'equal ranks.');\n util.assert(\n $offset == null || $mean.rank === $offset.rank,\n () => 'Batch normalization gradient requires mean and offset to have ' +\n 'equal ranks.');\n util.assert(\n $scale == null || $mean.rank === $scale.rank,\n () => 'Batch normalization gradient requires mean and scale to have ' +\n 'equal ranks.');\n\n const x4D: Tensor4D = xAs4D($x);\n\n const inputs: FusedBatchNormInputs = {\n x: x4D,\n scale: $scale,\n offset: $offset,\n mean: $mean,\n variance: $variance\n };\n\n const attrs: FusedBatchNormAttrs = {varianceEpsilon};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n const res = ENGINE.runKernel(\n FusedBatchNorm, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as Tensor;\n\n return reshape(res, $x.shape);\n}\n\nexport const batchNorm = op({batchNorm_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor1D, Tensor2D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {batchNorm} from './batchnorm';\nimport {op} from './operation';\n\n/**\n * Batch normalization, strictly for 2D. For the more relaxed version, see\n * `tf.batchNorm`.\n *\n * @param x The input Tensor.\n * @param mean A mean Tensor.\n * @param variance A variance Tensor.\n * @param offset An offset Tensor.\n * @param scale A scale Tensor.\n * @param varianceEpsilon A small float number to avoid dividing by 0.\n */\nfunction batchNorm2d_(\n x: Tensor2D|TensorLike, mean: Tensor2D|Tensor1D|TensorLike,\n variance: Tensor2D|Tensor1D|TensorLike,\n offset?: Tensor2D|Tensor1D|TensorLike, scale?: Tensor2D|Tensor1D|TensorLike,\n varianceEpsilon?: number): Tensor2D {\n const $x = convertToTensor(x, 'x', 'batchNorm');\n const $mean = convertToTensor(mean, 'mean', 'batchNorm');\n const $variance = convertToTensor(variance, 'variance', 'batchNorm');\n let $scale: Tensor2D|Tensor1D;\n if (scale != null) {\n $scale = convertToTensor(scale, 'scale', 'batchNorm');\n }\n let $offset: Tensor2D|Tensor1D;\n if (offset != null) {\n $offset = convertToTensor(offset, 'offset', 'batchNorm');\n }\n util.assert(\n $x.rank === 2,\n () => `Error in batchNorm2D: x must be rank 2 but got rank ` +\n `${$x.rank}.`);\n util.assert(\n $mean.rank === 2 || $mean.rank === 1,\n () => `Error in batchNorm2D: mean must be rank 2 or rank 1 but ` +\n `got rank ${$mean.rank}.`);\n util.assert(\n $variance.rank === 2 || $variance.rank === 1,\n () => `Error in batchNorm2D: variance must be rank 2 or rank 1 ` +\n `but got rank ${$variance.rank}.`);\n if ($scale != null) {\n util.assert(\n $scale.rank === 2 || $scale.rank === 1,\n () => `Error in batchNorm2D: scale must be rank 2 or rank 1 ` +\n `but got rank ${$scale.rank}.`);\n }\n if ($offset != null) {\n util.assert(\n $offset.rank === 2 || $offset.rank === 1,\n () => `Error in batchNorm2D: offset must be rank 2 or rank 1 ` +\n `but got rank ${$offset.rank}.`);\n }\n\n return batchNorm($x, $mean, $variance, $offset, $scale, varianceEpsilon);\n}\n\nexport const batchNorm2d = op({batchNorm2d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor1D, Tensor3D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {batchNorm} from './batchnorm';\nimport {op} from './operation';\n\n/**\n * Batch normalization, strictly for 3D. For the more relaxed version, see\n * `tf.batchNorm`.\n *\n * @param x The input Tensor.\n * @param mean A mean Tensor.\n * @param variance A variance Tensor.\n * @param offset An offset Tensor.\n * @param scale A scale Tensor.\n * @param varianceEpsilon A small float number to avoid dividing by 0.\n */\nfunction batchNorm3d_(\n x: Tensor3D|TensorLike, mean: Tensor3D|Tensor1D|TensorLike,\n variance: Tensor3D|Tensor1D|TensorLike,\n offset?: Tensor3D|Tensor1D|TensorLike, scale?: Tensor3D|Tensor1D|TensorLike,\n varianceEpsilon?: number): Tensor3D {\n const $x = convertToTensor(x, 'x', 'batchNorm');\n const $mean = convertToTensor(mean, 'mean', 'batchNorm');\n const $variance = convertToTensor(variance, 'variance', 'batchNorm');\n let $scale: Tensor3D|Tensor1D;\n if (scale != null) {\n $scale = convertToTensor(scale, 'scale', 'batchNorm');\n }\n let $offset: Tensor3D|Tensor1D;\n if (offset != null) {\n $offset = convertToTensor(offset, 'offset', 'batchNorm');\n }\n util.assert(\n $x.rank === 3,\n () => `Error in batchNorm3D: x must be rank 3 but got rank ` +\n `${$x.rank}.`);\n util.assert(\n $mean.rank === 3 || $mean.rank === 1,\n () => `Error in batchNorm3D: mean must be rank 3 or rank 1 but ` +\n `got rank ${$mean.rank}.`);\n util.assert(\n $variance.rank === 3 || $variance.rank === 1,\n () => `Error in batchNorm3D: variance must be rank 3 or rank 1 ` +\n `but got rank ${$variance.rank}.`);\n if ($scale != null) {\n util.assert(\n $scale.rank === 3 || $scale.rank === 1,\n () => `Error in batchNorm3D: scale must be rank 3 or rank 1 ` +\n `but got rank ${$scale.rank}.`);\n }\n if ($offset != null) {\n util.assert(\n $offset.rank === 3 || $offset.rank === 1,\n () => `Error in batchNorm3D: offset must be rank 3 or rank 1 ` +\n `but got rank ${$offset.rank}.`);\n }\n\n return batchNorm($x, $mean, $variance, $offset, $scale, varianceEpsilon);\n}\n\nexport const batchNorm3d = op({batchNorm3d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor1D, Tensor4D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {batchNorm} from './batchnorm';\nimport {op} from './operation';\n\n/**\n * Batch normalization, strictly for 4D. For the more relaxed version, see\n * `tf.batchNorm`.\n *\n * @param x The input Tensor.\n * @param mean A mean Tensor.\n * @param variance A variance Tensor.\n * @param offset An offset Tensor.\n * @param scale A scale Tensor.\n * @param varianceEpsilon A small float number to avoid dividing by 0.\n */\nfunction batchNorm4d_(\n x: Tensor4D|TensorLike, mean: Tensor4D|Tensor1D|TensorLike,\n variance: Tensor4D|Tensor1D|TensorLike,\n offset?: Tensor4D|Tensor1D|TensorLike, scale?: Tensor4D|Tensor1D|TensorLike,\n varianceEpsilon?: number): Tensor4D {\n const $x = convertToTensor(x, 'x', 'batchNorm');\n const $mean = convertToTensor(mean, 'mean', 'batchNorm');\n const $variance = convertToTensor(variance, 'variance', 'batchNorm');\n let $scale: Tensor4D|Tensor1D;\n if (scale != null) {\n $scale = convertToTensor(scale, 'scale', 'batchNorm');\n }\n let $offset: Tensor4D|Tensor1D;\n if (offset != null) {\n $offset = convertToTensor(offset, 'offset', 'batchNorm');\n }\n util.assert(\n $x.rank === 4,\n () => `Error in batchNorm4D: x must be rank 4 but got rank ` +\n `${$x.rank}.`);\n util.assert(\n $mean.rank === 4 || $mean.rank === 1,\n () => `Error in batchNorm4D: mean must be rank 4 or rank 1 but ` +\n `got rank ${$mean.rank}.`);\n util.assert(\n $variance.rank === 4 || $variance.rank === 1,\n () => `Error in batchNorm4D: variance must be rank 4 or rank 1 ` +\n `but got rank ${$variance.rank}.`);\n if ($scale != null) {\n util.assert(\n $scale.rank === 4 || $scale.rank === 1,\n () => `Error in batchNorm4D: scale must be rank 4 or rank 1 ` +\n `but got rank ${$scale.rank}.`);\n }\n if ($offset != null) {\n util.assert(\n $offset.rank === 4 || $offset.rank === 1,\n () => `Error in batchNorm4D: offset must be rank 4 or rank 1 ` +\n `but got rank ${$offset.rank}.`);\n }\n return batchNorm($x, $mean, $variance, $offset, $scale, varianceEpsilon);\n}\n\nexport const batchNorm4d = op({batchNorm4d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Bincount, BincountAttrs, BincountInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor1D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\n\n/**\n * Outputs a vector with length `size` and the same dtype as `weights`.\n *\n * If `weights` are empty, then index `i` stores the number of times the value\n * `i` is counted in `x`. If `weights` are non-empty, then index `i` stores the\n * sum of the value in `weights` at each index where the corresponding value in\n * `x` is `i`.\n *\n * Values in `x` outside of the range [0, size) are ignored.\n *\n * @param x The input int tensor, rank 1.\n * @param weights The weights tensor, must have the same shape as x, or a\n * length-0 Tensor, in which case it acts as all weights equal to 1.\n * @param size Non-negative integer.\n *\n * @doc {heading: 'Operations', subheading: 'Reduction'}\n */\nfunction bincount_(\n x: T|TensorLike, weights: T|TensorLike, size: number): T {\n const $x = convertToTensor(x, 'x', 'bincount');\n const $weights = convertToTensor(weights, 'weights', 'bincount');\n\n util.assert(\n $x.dtype === 'int32',\n () => `Error in bincount: input ` +\n `dtype must be int32, but got ${$x.dtype}`);\n util.assert(size >= 0, () => `size must be non-negative, but got ${size}.`);\n util.assert(\n $weights.size === $x.size || $weights.size === 0,\n () => `Error in bincount: weights must have the same size as input or` +\n `0-length, but got input shape: ${$x.shape}, weights shape: ` +\n `${$weights.shape}.`);\n\n const inputs: BincountInputs = {x: $x, weights: $weights};\n const attrs: BincountAttrs = {size};\n\n return ENGINE.runKernel(\n Bincount, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const bincount = op({bincount_});\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport { NamedTensorMap } from '../tensor_types';\nimport { ENGINE } from '../engine';\nimport { BroadcastArgs, BroadcastArgsInputs } from '../kernel_names';\nimport { Tensor } from '../tensor';\nimport { convertToTensor } from '../tensor_util_env';\nimport { Rank, TensorLike } from '../types';\n\nimport { op } from './operation';\n\n/**\n * Return the shape of s0 op s1 with broadcast.\n *\n * compute r0, the broadcasted shape as a tensor.\n * s0, s1 and r0 are all integer vectors.\n *\n * This function returns the shape of the result of an operation between\n * two tensors of size s0 and s1 performed with broadcast.\n *\n * @param s0 A tensor representing a shape\n * @param s1 A tensor representing a shape\n *\n * @doc {heading: 'Tensors', subheading: 'Transformations'}\n */\nfunction broadcastArgs_(\n s0: Tensor | TensorLike, s1: Tensor | TensorLike): Tensor {\n const shape1Input = convertToTensor(s0, 's0', 'broadcastArgs', 'int32');\n const shape2Input = convertToTensor(s1, 's1', 'broadcastArgs', 'int32');\n\n if (shape1Input.rank !== 1) {\n throw new Error(\n 'broadcastArgs(): first input must be a vector (rank=1). ' +\n `Has rank ${shape1Input.rank}`);\n }\n\n if (shape2Input.rank !== 1) {\n throw new Error(\n 'broadcastArgs(): second input must be a vector (rank=1). ' +\n `Has rank ${shape2Input.rank}`);\n }\n\n const inputs: BroadcastArgsInputs = { s0: shape1Input, s1: shape2Input };\n return ENGINE.runKernel(BroadcastArgs, inputs as {} as NamedTensorMap);\n}\n\nexport const broadcastArgs = op({ broadcastArgs_ });\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Tile, TileAttrs, TileInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {Rank, ShapeMap, TensorLike} from '../types';\n\nimport {clone} from './clone';\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * Broadcast an array to a compatible shape NumPy-style.\n *\n * The tensor's shape is compared to the broadcast shape from end to beginning.\n * Ones are prepended to the tensor's shape until it has the same length as\n * the broadcast shape. If input.shape[i]==shape[i], the (i+1)-th axis is\n * already broadcast-compatible. If input.shape[i]==1 and shape[i]==N, then\n * the input tensor is tiled N times along that axis (using tf.tile).\n *\n * @param input The tensor that is to be broadcasted.\n * @param shape The input is to be broadcast to this shape.\n *\n * @doc {heading: 'Tensors', subheading: 'Transformations'}\n */\nfunction broadcastTo_(\n x: Tensor|TensorLike, shape: ShapeMap[R]): Tensor {\n let input = convertToTensor(x, 'broadcastTo', 'x');\n const xShape = input.shape;\n\n if (shape.some(d => !(d > 0) || d % 1 !== 0)) {\n throw new Error(`broadcastTo(): Invalid broadcast shape [${shape}].`);\n }\n\n if (shape.length < input.rank) {\n throw new Error(`broadcastTo(): shape.length=${shape.length} < input.rank=${\n input.rank}.`);\n }\n\n if (shape.length > input.rank) {\n const newShape = input.shape.slice();\n while (newShape.length < shape.length) {\n newShape.unshift(1);\n }\n input = reshape(input, newShape);\n }\n\n const inputShape = input.shape;\n const reps: number[] = Array.from(shape);\n for (let i = shape.length - 1; i >= 0; i--) {\n if (inputShape[i] === shape[i]) {\n reps[i] = 1;\n } else if (input.shape[i] !== 1) {\n throw new Error(\n `broadcastTo(): [${xShape}] cannot be broadcast to [${shape}].`);\n }\n }\n const axes = reps.map((n, i) => n > 1 ? i : -1).filter(i => i >= 0);\n\n if (axes.length === 0) {\n return clone(input) as Tensor;\n }\n\n // TODO call broadcastTo kernel directly once backends implement broadcstTo\n const inputs: TileInputs = {x: input};\n const attrs: TileAttrs = {reps};\n return ENGINE.runKernel(\n Tile, inputs as {} as NamedTensorMap, attrs as unknown as NamedAttrMap);\n}\n\nexport const broadcastTo = op({broadcastTo_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Ceil, CeilInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes ceiling of input `tf.Tensor` element-wise: `ceil(x)`\n *\n * ```js\n * const x = tf.tensor1d([.6, 1.1, -3.3]);\n *\n * x.ceil().print(); // or tf.ceil(x)\n * ```\n * @param x The input Tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction ceil_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'ceil', 'float32');\n\n const inputs: CeilInputs = {x: $x};\n return ENGINE.runKernel(Ceil, inputs as {} as NamedTensorMap);\n}\nexport const ceil = op({ceil_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Fill, FillAttrs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {DataType, Rank, ShapeMap} from '../types';\n\n/**\n * Creates a `tf.Tensor` filled with a scalar value.\n *\n * ```js\n * tf.fill([2, 2], 4).print();\n * ```\n *\n * @param shape An array of integers defining the output tensor shape.\n * @param value The scalar value to fill the tensor with.\n * @param dtype The type of an element in the resulting tensor. Defaults to\n * 'float'.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nfunction fill(\n shape: ShapeMap[R], value: number|string, dtype?: DataType): Tensor {\n const attrs: FillAttrs = {shape, value, dtype};\n\n return ENGINE.runKernel(Fill, {}, attrs as {} as NamedAttrMap);\n}\n\nexport {fill};\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {ClipByValue, ClipByValueAttrs, ClipByValueInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\nimport {fill} from './fill';\n\nimport {op} from './operation';\n\n/**\n * Clips values element-wise. `max(min(x, clipValueMax), clipValueMin)`\n *\n * ```js\n * const x = tf.tensor1d([-1, 2, -3, 4]);\n *\n * x.clipByValue(-2, 3).print(); // or tf.clipByValue(x, -2, 3)\n * ```\n * @param x The input tensor.\n * @param clipValueMin Lower bound of range to be clipped to.\n * @param clipValueMax Upper bound of range to be clipped to.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction clipByValue_(\n x: T|TensorLike, clipValueMin: number, clipValueMax: number): T {\n const $x = convertToTensor(x, 'x', 'clipByValue');\n util.assert(\n (clipValueMin <= clipValueMax),\n () => `Error in clip: min (${clipValueMin}) must be ` +\n `less than or equal to max (${clipValueMax}).`);\n\n if (clipValueMin === clipValueMax) {\n return fill($x.shape, clipValueMin, $x.dtype) as T;\n }\n\n const inputs: ClipByValueInputs = {x: $x};\n const attrs: ClipByValueAttrs = {clipValueMin, clipValueMax};\n\n return ENGINE.runKernel(\n ClipByValue, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const clipByValue = op({clipByValue_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor1D} from '../tensor';\nimport {TensorLike} from '../types';\n\nimport {concat} from './concat';\nimport {op} from './operation';\n\n/**\n * Concatenates a list of`tf.Tensor1D`s along an axis. See `concat` for details.\n *\n * For example, if:\n * A: shape(3) = |r1, g1, b1|\n * B: shape(2) = |r2, g2|\n * C = tf.concat1d([A, B]) == |r1, g1, b1, r2, g2|\n *\n * @param tensors A list of`tf.Tensor`s to concatenate.\n * @return The concatenated array.\n */\nfunction concat1d_(tensors: Array): Tensor1D {\n return concat(tensors, 0 /* axis */);\n}\n\nexport const concat1d = op({concat1d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor2D} from '../tensor';\nimport {TensorLike} from '../types';\n\nimport {concat} from './concat';\nimport {op} from './operation';\n\n/**\n * Concatenates a list of`tf.Tensor2D`s along an axis. See `concat` for details.\n *\n * For example, if:\n * A: shape(2, 3) = | r1, g1, b1 |\n * | r2, g2, b2 |\n *\n * B: shape(2, 3) = | r3, g3, b3 |\n * | r4, g4, b4 |\n *\n * C = tf.concat2d([A, B], axis)\n *\n * if axis = 0:\n * C: shape(4, 3) = | r1, g1, b1 |\n * | r2, g2, b2 |\n * | r3, g3, b3 |\n * | r4, g4, b4 |\n *\n * if axis = 1:\n * C = shape(2, 6) = | r1, g1, b1, r3, g3, b3 |\n * | r2, g2, b2, r4, g4, b4 |\n *\n *\n * @param tensors A list of `tf.Tensor`s to concatenate.\n * @param axis The axis to concatenate along.\n * @return The concatenated array.\n */\nfunction concat2d_(\n tensors: Array, axis: number): Tensor2D {\n return concat(tensors, axis);\n}\n\nexport const concat2d = op({concat2d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor3D} from '../tensor';\nimport {TensorLike} from '../types';\n\nimport {concat} from './concat';\nimport {op} from './operation';\n\n/**\n * Concatenates a list of `tf.Tensor3D`s along an axis.\n * See `concat` for details.\n *\n * For example, if:\n * A: shape(2, 1, 3) = | r1, g1, b1 |\n * | r2, g2, b2 |\n *\n * B: shape(2, 1, 3) = | r3, g3, b3 |\n * | r4, g4, b4 |\n *\n * C = tf.concat3d([A, B], axis)\n *\n * if axis = 0:\n * C: shape(4, 1, 3) = | r1, g1, b1 |\n * | r2, g2, b2 |\n * | r3, g3, b3 |\n * | r4, g4, b4 |\n *\n * if axis = 1:\n * C: shape(2, 2, 3) = | r1, g1, b1, r3, g3, b3 |\n * | r2, g2, b2, r4, g4, b4 |\n *\n * if axis = 2:\n * C = shape(2, 1, 6) = | r1, g1, b1, r3, g3, b3 |\n * | r2, g2, b2, r4, g4, b4 |\n *\n * @param tensors A list of`tf.Tensor`s to concatenate.\n * @param axis The axis to concate along.\n * @return The concatenated array.\n */\nfunction concat3d_(\n tensors: Array, axis: number): Tensor3D {\n return concat(tensors, axis);\n}\n\nexport const concat3d = op({concat3d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor4D} from '../tensor';\nimport {TensorLike} from '../types';\n\nimport {concat} from './concat';\nimport {op} from './operation';\n\n/**\n * Concatenates a list of `tf.Tensor4D`s along an axis.\n * See `concat` for details.\n *\n * @param tensors A list of `tf.Tensor`s to concatenate.\n * @param axis The axis to concate along.\n * @return The concatenated array.\n */\nfunction concat4d_(\n tensors: Array, axis: number): Tensor4D {\n return concat(tensors, axis);\n}\n\nexport const concat4d = op({concat4d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Conv2D, Conv2DAttrs, Conv2DInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor3D, Tensor4D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport * as conv_util from './conv_util';\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * Computes a 2D convolution over the input x.\n *\n * @param x The input tensor, of rank 4 or rank 3, of shape\n * `[batch, height, width, inChannels]`. If rank 3, batch of 1 is\n * assumed.\n * @param filter The filter, rank 4, of shape\n * `[filterHeight, filterWidth, inDepth, outDepth]`.\n * @param strides The strides of the convolution: `[strideHeight,\n * strideWidth]`.\n * @param pad The type of padding algorithm.\n * - `same` and stride 1: output will be of same size as input,\n * regardless of filter size.\n * - `valid`: output will be smaller than input if filter is larger\n * than 1x1.\n * - For more info, see this guide:\n * [https://www.tensorflow.org/api_docs/python/tf/nn/convolution](\n * https://www.tensorflow.org/api_docs/python/tf/nn/convolution)\n * @param dataFormat: An optional string from: \"NHWC\", \"NCHW\". Defaults to\n * \"NHWC\". Specify the data format of the input and output data. With the\n * default format \"NHWC\", the data is stored in the order of: [batch,\n * height, width, channels].\n * @param dilations The dilation rates: `[dilationHeight, dilationWidth]`\n * in which we sample input values across the height and width dimensions\n * in atrous convolution. Defaults to `[1, 1]`. If `dilations` is a single\n * number, then `dilationHeight == dilationWidth`. If it is greater than\n * 1, then all values of `strides` must be 1.\n * @param dimRoundingMode A string from: 'ceil', 'round', 'floor'. If none is\n * provided, it will default to truncate.\n *\n * @doc {heading: 'Operations', subheading: 'Convolution'}\n */\nfunction conv2d_(\n x: T|TensorLike, filter: Tensor4D|TensorLike,\n strides: [number, number]|number,\n pad: 'valid'|'same'|number|conv_util.ExplicitPadding,\n dataFormat: 'NHWC'|'NCHW' = 'NHWC',\n dilations: [number, number]|number = [1, 1],\n dimRoundingMode?: 'floor'|'round'|'ceil'): T {\n const $x = convertToTensor(x, 'x', 'conv2d', 'float32');\n const $filter = convertToTensor(filter, 'filter', 'conv2d', 'float32');\n\n let x4D = $x as Tensor4D;\n let reshapedTo4D = false;\n\n if ($x.rank === 3) {\n reshapedTo4D = true;\n x4D = reshape($x, [1, $x.shape[0], $x.shape[1], $x.shape[2]]);\n }\n\n util.assert(\n x4D.rank === 4,\n () => `Error in conv2d: input must be rank 4, but got rank ${x4D.rank}.`);\n util.assert(\n $filter.rank === 4,\n () => `Error in conv2d: filter must be rank 4, but got rank ` +\n `${$filter.rank}.`);\n conv_util.checkPadOnDimRoundingMode('conv2d', pad, dimRoundingMode);\n const inDepth = dataFormat === 'NHWC' ? x4D.shape[3] : x4D.shape[1];\n util.assert(\n inDepth === $filter.shape[2],\n () => `Error in conv2d: depth of input (${inDepth}) must match ` +\n `input depth for filter ${$filter.shape[2]}.`);\n util.assert(\n conv_util.eitherStridesOrDilationsAreOne(strides, dilations),\n () => 'Error in conv2D: Either strides or dilations must be 1. ' +\n `Got strides ${strides} and dilations '${dilations}'`);\n\n const inputs: Conv2DInputs = {x: x4D, filter: $filter};\n const attrs:\n Conv2DAttrs = {strides, pad, dataFormat, dilations, dimRoundingMode};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n const res = ENGINE.runKernel(\n Conv2D, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as T;\n\n if (reshapedTo4D) {\n return reshape(res, [res.shape[1], res.shape[2], res.shape[3]]) as T;\n }\n return res;\n}\n\nexport const conv2d = op({conv2d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor2D, Tensor3D, Tensor4D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {conv2d} from './conv2d';\nimport * as conv_util from './conv_util';\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * Computes a 1D convolution over the input x.\n *\n * @param x The input tensor, of rank 3 or rank 2, of shape\n * `[batch, width, inChannels]`. If rank 2, batch of 1 is assumed.\n * @param filter The filter, rank 3, of shape\n * `[filterWidth, inDepth, outDepth]`.\n * @param stride The number of entries by which the filter is moved right at\n * each step.\n * @param pad The type of padding algorithm.\n * - `same` and stride 1: output will be of same size as input,\n * regardless of filter size.\n * - `valid`: output will be smaller than input if filter is larger\n * than 1x1.\n * - For more info, see this guide:\n * [https://www.tensorflow.org/api_docs/python/tf/nn/convolution](\n * https://www.tensorflow.org/api_docs/python/tf/nn/convolution)\n * @param dataFormat An optional string from \"NWC\", \"NCW\". Defaults to \"NWC\",\n * the data is stored in the order of [batch, in_width, in_channels]. Only\n * \"NWC\" is currently supported.\n * @param dilation The dilation rate in which we sample input values in\n * atrous convolution. Defaults to `1`. If it is greater than 1, then\n * stride must be `1`.\n * @param dimRoundingMode A string from: 'ceil', 'round', 'floor'. If none is\n * provided, it will default to truncate.\n *\n * @doc {heading: 'Operations', subheading: 'Convolution'}\n */\nfunction conv1d_(\n x: T|TensorLike, filter: Tensor3D|TensorLike, stride: number,\n pad: 'valid'|'same'|number|conv_util.ExplicitPadding,\n dataFormat: 'NWC'|'NCW' = 'NWC', dilation = 1,\n dimRoundingMode?: 'floor'|'round'|'ceil'): T {\n const $x = convertToTensor(x, 'x', 'conv1d');\n const $filter = convertToTensor(filter, 'filter', 'conv1d');\n\n let x3D = $x as Tensor3D;\n let reshapedTo3D = false;\n if ($x.rank === 2) {\n reshapedTo3D = true;\n x3D = reshape($x, [1, $x.shape[0], $x.shape[1]]);\n }\n\n util.assert(\n x3D.rank === 3,\n () => `Error in conv1d: input must be rank 3, but got rank ${x3D.rank}.`);\n util.assert(\n $filter.rank === 3,\n () => `Error in conv1d: filter must be rank 3, but got rank ` +\n `${$filter.rank}.`);\n conv_util.checkPadOnDimRoundingMode('conv1d', pad, dimRoundingMode);\n util.assert(\n x3D.shape[2] === $filter.shape[1],\n () => `Error in conv1d: depth of input (${x3D.shape[2]}) must match ` +\n `input depth for filter ${$filter.shape[1]}.`);\n util.assert(\n conv_util.eitherStridesOrDilationsAreOne(stride, dilation),\n () => 'Error in conv1D: Either stride or dilation must be 1. ' +\n `Got stride ${stride} and dilation '${dilation}'`);\n util.assert(\n dataFormat === 'NWC',\n () => `Error in conv1d: got dataFormat of ${\n dataFormat} but only NWC is currently supported.`);\n\n const filter4D = reshape(\n $filter, [1, $filter.shape[0], $filter.shape[1], $filter.shape[2]]);\n const input4D = reshape(x3D, [x3D.shape[0], 1, x3D.shape[1], x3D.shape[2]]);\n const strides: [number, number] = [1, stride];\n const dilations: [number, number] = [1, dilation];\n\n const conv2dDataFormat = 'NHWC';\n\n const res = conv2d(\n (input4D as Tensor4D), (filter4D as Tensor4D), strides, pad,\n conv2dDataFormat, dilations, dimRoundingMode);\n\n if (reshapedTo3D) {\n return reshape(res, [res.shape[2], res.shape[3]]) as T;\n }\n\n return reshape(res, [res.shape[0], res.shape[2], res.shape[3]]) as T;\n}\n\nexport const conv1d = op({conv1d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Conv2DBackpropInput, Conv2DBackpropInputAttrs, Conv2DBackpropInputInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor3D, Tensor4D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport * as util from '../util';\n\nimport * as conv_util from './conv_util';\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * Computes the derivative of the input of a 2D convolution.\n *\n * @param xShape The shape of the input: [batch, height, width, inDepth].\n * If length of 3, batch of 1 is assumed.\n * @param dy The derivative of the output, of rank 4 or rank 3 of shape\n * `[batch, outHeight, outWidth, outDepth]`. If rank 3, batch of 1 is\n * assumed.\n * @param filter The filter, rank 4, of shape\n * `[filterHeight, filterWidth, inDepth, outDepth]`.\n * @param strides The strides of the convolution: `[strideHeight,\n * strideWidth]`.\n * @param pad The type of padding algorithm used:\n * - `same` and stride 1: output will be of same size as input,\n * regardless of filter size.\n * - `valid`: output will be smaller than input if filter is larger\n * than 1x1.\n * @param dataFormat: An optional string from: \"NHWC\", \"NCHW\". Defaults to\n * \"NHWC\". Specify the data format of the input and output data. With the\n * default format \"NHWC\", the data is stored in the order of: [batch,\n * height, width, channels].\n * @param dimRoundingMode A string from: 'ceil', 'round', 'floor'. If none is\n * provided, it will default to truncate.\n */\nfunction conv2DBackpropInput_(\n xShape: [number, number, number, number]|[number, number, number], dy: T,\n filter: Tensor4D, strides: [number, number]|number,\n pad: 'valid'|'same'|number|conv_util.ExplicitPadding,\n dataFormat: 'NHWC'|'NCHW' = 'NHWC',\n dimRoundingMode?: 'floor'|'round'|'ceil'): T {\n util.assert(\n xShape.length === dy.rank,\n () => `Length of inShape ` +\n `(${xShape.length}) and rank of dy (${dy.rank}) must match`);\n\n let xShape4D = xShape as [number, number, number, number];\n let dy4D = dy as Tensor4D;\n let reshapedTo4D = false;\n if (dy.rank === 3) {\n reshapedTo4D = true;\n dy4D = reshape(dy, [1, dy.shape[0], dy.shape[1], dy.shape[2]]);\n xShape4D = [1, xShape[0], xShape[1], xShape[2]];\n }\n\n util.assert(\n xShape4D.length === 4,\n () =>\n `Error in conv2dDerInput: inShape must be length 4, but got length ` +\n `${xShape4D.length}.`);\n util.assert(\n dy4D.rank === 4,\n () => `Error in conv2dDerInput: dy must be rank 4, but got ` +\n `rank ${dy4D.rank}`);\n util.assert(\n filter.rank === 4,\n () => `Error in conv2dDerInput: filter must be rank 4, but got ` +\n `rank ${filter.rank}`);\n const inDepth = dataFormat === 'NHWC' ? xShape4D[3] : xShape4D[1];\n const outDepth = dataFormat === 'NHWC' ? dy4D.shape[3] : dy4D.shape[1];\n util.assert(\n inDepth === filter.shape[2],\n () => `Error in conv2dDerInput: depth of input (${inDepth}) must ` +\n `match input depth for filter ${filter.shape[2]}.`);\n util.assert(\n outDepth === filter.shape[3],\n () => `Error in conv2dDerInput: depth of output (${outDepth}) must ` +\n `match output depth for filter ${filter.shape[3]}.`);\n conv_util.checkPadOnDimRoundingMode('conv2dDerInput', pad, dimRoundingMode);\n const inputs: Conv2DBackpropInputInputs = {dy: dy4D, filter};\n const attrs: Conv2DBackpropInputAttrs =\n {strides, pad, dataFormat, dimRoundingMode, inputShape: xShape4D};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n const res = ENGINE.runKernel(\n Conv2DBackpropInput, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as T;\n\n if (reshapedTo4D) {\n return reshape(res, [res.shape[1], res.shape[2], res.shape[3]]) as T;\n }\n return res;\n}\n\nexport const conv2DBackpropInput = op({conv2DBackpropInput_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor3D, Tensor4D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {conv2DBackpropInput} from './conv2d_backprop_input';\nimport {ExplicitPadding} from './conv_util';\nimport {op} from './operation';\n\n/**\n * Computes the transposed 2D convolution of an image, also known as a\n * deconvolution.\n *\n * @param x The input image, of rank 4 or rank 3, of shape\n * `[batch, height, width, inDepth]`. If rank 3, batch of 1 is assumed.\n * @param filter The filter, rank 4, of shape\n * `[filterHeight, filterWidth, outDepth, inDepth]`.\n * `inDepth` must match `inDepth` in `x`.\n * @param outputShape Output shape, of rank 4 or rank 3:\n * `[batch, height, width, outDepth]`. If rank 3, batch of 1 is assumed.\n * @param strides The strides of the original convolution:\n * `[strideHeight, strideWidth]`.\n * @param pad The type of padding algorithm used in the non-transpose version\n * of the op.\n * @param dimRoundingMode A string from: 'ceil', 'round', 'floor'. If none is\n * provided, it will default to truncate.\n *\n * @doc {heading: 'Operations', subheading: 'Convolution'}\n */\nfunction conv2dTranspose_(\n x: T|TensorLike, filter: Tensor4D|TensorLike,\n outputShape: [number, number, number, number]|[number, number, number],\n strides: [number, number]|number,\n pad: 'valid'|'same'|number|ExplicitPadding,\n dimRoundingMode?: 'floor'|'round'|'ceil'): T {\n const $x = convertToTensor(x, 'x', 'conv2dTranspose');\n const $filter = convertToTensor(filter, 'filter', 'conv2dTranspose');\n\n return conv2DBackpropInput(\n outputShape, $x, $filter, strides, pad, 'NHWC', dimRoundingMode);\n}\n\nexport const conv2dTranspose = op({conv2dTranspose_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Conv3D, Conv3DAttrs, Conv3DInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor4D, Tensor5D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {eitherStridesOrDilationsAreOne} from './conv_util';\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * Computes a 3D convolution over the input x.\n *\n * @param x The input tensor, of rank 5 or rank 4, of shape\n * `[batch, depth, height, width, channels]`. If rank 4,\n * batch of 1 is assumed.\n * @param filter The filter, rank 5, of shape\n * `[filterDepth, filterHeight, filterWidth, inChannels, outChannels]`.\n * inChannels must match between input and filter.\n * @param strides The strides of the convolution: `[strideDepth, strideHeight,\n * strideWidth]`.\n * @param pad The type of padding algorithm.\n * - `same` and stride 1: output will be of same size as input,\n * regardless of filter size.\n * - `valid`: output will be smaller than input if filter is larger\n * than 1x1.\n * - For more info, see this guide:\n * [https://www.tensorflow.org/api_docs/python/tf/nn/convolution](\n * https://www.tensorflow.org/api_docs/python/tf/nn/convolution)\n * @param dataFormat: An optional string from: \"NDHWC\", \"NCDHW\". Defaults to\n * \"NDHWC\". Specify the data format of the input and output data. With the\n * default format \"NDHWC\", the data is stored in the order of: [batch,\n * depth, height, width, channels]. Only \"NDHWC\" is currently supported.\n * @param dilations The dilation rates: `[dilationDepth, dilationHeight,\n * dilationWidth]` in which we sample input values across the height\n * and width dimensions in atrous convolution. Defaults to `[1, 1, 1]`.\n * If `dilations` is a single number, then\n * `dilationDepth == dilationHeight == dilationWidth`. If it is greater\n * than 1, then all values of `strides` must be 1.\n *\n * @doc {heading: 'Operations', subheading: 'Convolution'}\n */\nfunction conv3d_(\n x: T|TensorLike, filter: Tensor5D|TensorLike,\n strides: [number, number, number]|number, pad: 'valid'|'same',\n dataFormat: 'NDHWC'|'NCDHW' = 'NDHWC',\n dilations: [number, number, number]|number = [1, 1, 1]): T {\n const $x = convertToTensor(x, 'x', 'conv3d');\n const $filter = convertToTensor(filter, 'filter', 'conv3d');\n\n let x5D = $x as Tensor5D;\n let reshapedTo5D = false;\n\n if ($x.rank === 4) {\n reshapedTo5D = true;\n x5D = reshape($x, [1, $x.shape[0], $x.shape[1], $x.shape[2], $x.shape[3]]);\n }\n util.assert(\n x5D.rank === 5,\n () => `Error in conv3d: input must be rank 5, but got rank ${x5D.rank}.`);\n util.assert(\n $filter.rank === 5,\n () => `Error in conv3d: filter must be rank 5, but got rank ` +\n `${$filter.rank}.`);\n util.assert(\n x5D.shape[4] === $filter.shape[3],\n () => `Error in conv3d: depth of input (${x5D.shape[4]}) must match ` +\n `input depth for filter ${$filter.shape[3]}.`);\n util.assert(\n eitherStridesOrDilationsAreOne(strides, dilations),\n () => 'Error in conv3D: Either strides or dilations must be 1. ' +\n `Got strides ${strides} and dilations '${dilations}'`);\n util.assert(\n dataFormat === 'NDHWC',\n () => `Error in conv3d: got dataFormat of ${\n dataFormat} but only NDHWC is currently supported.`);\n\n const inputs: Conv3DInputs = {x: x5D, filter: $filter};\n\n const attrs: Conv3DAttrs = {strides, pad, dataFormat, dilations};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n const res = ENGINE.runKernel(\n Conv3D, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as T;\n\n if (reshapedTo5D) {\n return reshape(\n res, [res.shape[1], res.shape[2], res.shape[3], res.shape[4]]) as\n T;\n }\n return res;\n}\n\nexport const conv3d = op({conv3d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Conv3DBackpropInputV2, Conv3DBackpropInputV2Attrs, Conv3DBackpropInputV2Inputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor4D, Tensor5D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport * as util from '../util';\n\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * Computes the derivative of the input of a 3D convolution.\n *\n * @param xShape The shape of the input: [batch, depth, height, width,\n * in_channels]. If length of 4, batch of 1 is assumed.\n * @param dy The derivative of the output, of rank 5 or rank 4 of shape\n * `[batch, outDepth, outHeight, outWidth, in_channels]`.\n * If rank 4, batch of 1 is assumed.\n * @param filter The filter, rank 5, of shape\n * `[filterDepth, filterHeight, filterWidth, inDepth, outDepth]`.\n * @param strides The strides of the convolution: `[strideDepth, strideHeight,\n * strideWidth]`.\n * @param pad The type of padding algorithm used:\n * - `same` and stride 1: output will be of same size as input,\n * regardless of filter size.\n * - `valid`: output will be smaller than input if filter is larger\n * than 1x1.\n */\nfunction conv3DBackpropInput_(\n xShape:\n [number, number, number, number,\n number]|[number, number, number, number],\n dy: T, filter: Tensor5D, strides: [number, number, number]|number,\n pad: 'valid'|'same'): T {\n util.assert(\n xShape.length === dy.rank,\n () => `Length of inShape ` +\n `(${xShape.length}) and rank of dy (${dy.rank}) must match`);\n\n let xShape5D = xShape as [number, number, number, number, number];\n let dy5D = dy as Tensor5D;\n let reshapedTo5D = false;\n if (dy.rank === 4) {\n reshapedTo5D = true;\n dy5D = reshape(dy, [1, dy.shape[0], dy.shape[1], dy.shape[2], dy.shape[3]]);\n xShape5D = [1, xShape[0], xShape[1], xShape[2], xShape[3]];\n }\n\n const inDepth = xShape5D[4];\n const outDepth = dy5D.shape[4];\n util.assert(\n xShape5D.length === 5,\n () =>\n `Error in conv3dDerInput: inShape must be length 5, but got length ` +\n `${xShape5D.length}.`);\n util.assert(\n dy5D.rank === 5,\n () => `Error in conv3dDerInput: dy must be rank 5, but got ` +\n `rank ${dy5D.rank}`);\n util.assert(\n filter.rank === 5,\n () => `Error in conv3dDerInput: filter must be rank 5, but got ` +\n `rank ${filter.rank}`);\n util.assert(\n inDepth === filter.shape[3],\n () => `Error in conv3dDerInput: depth of input (${inDepth}) must ` +\n `match input depth for filter ${filter.shape[3]}.`);\n util.assert(\n outDepth === filter.shape[4],\n () => `Error in conv3dDerInput: depth of output (${outDepth}) must ` +\n `match output depth for filter ${filter.shape[4]}.`);\n\n const inputs: Conv3DBackpropInputV2Inputs = {dy: dy5D, filter};\n\n const attrs:\n Conv3DBackpropInputV2Attrs = {pad, strides, inputShape: xShape5D};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n const res = ENGINE.runKernel(\n Conv3DBackpropInputV2, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as T;\n\n if (reshapedTo5D) {\n return reshape(\n res, [res.shape[1], res.shape[2], res.shape[3], res.shape[4]]) as\n T;\n }\n return res;\n}\n\nexport const conv3DBackpropInput = op({conv3DBackpropInput_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor4D, Tensor5D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {conv3DBackpropInput} from './conv3d_backprop_input';\nimport {op} from './operation';\n\n/**\n * Computes the transposed 3D convolution of a volume, also known as a\n * deconvolution.\n *\n * @param x The input image, of rank 5 or rank 4, of shape\n * `[batch, depth, height, width, inDepth]`. If rank 4, batch of 1 is assumed.\n * @param filter The filter, rank 4, of shape\n * `[depth, filterHeight, filterWidth, outDepth, inDepth]`.\n * `inDepth` must match `inDepth` in `x`.\n * @param outputShape Output shape, of rank 5 or rank 4:\n * `[batch, depth, height, width, outDepth]`. If rank 3, batch of 1 is\n * assumed.\n * @param strides The strides of the original convolution:\n * `[strideDepth, strideHeight, strideWidth]`.\n * @param pad The type of padding algorithm used in the non-transpose version\n * of the op.\n *\n * @doc {heading: 'Operations', subheading: 'Convolution'}\n */\nfunction conv3dTranspose_(\n x: T|TensorLike, filter: Tensor5D|TensorLike,\n outputShape:\n [number, number, number, number,\n number]|[number, number, number, number],\n strides: [number, number, number]|number, pad: 'valid'|'same'): T {\n const $x = convertToTensor(x, 'x', 'conv3dTranspose');\n const $filter = convertToTensor(filter, 'filter', 'conv3dTranspose');\n\n return conv3DBackpropInput(outputShape, $x, $filter, strides, pad);\n}\n\nexport const conv3dTranspose = op({conv3dTranspose_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Cos, CosInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes cos of the input `tf.Tensor` element-wise: `cos(x)`\n *\n * ```js\n * const x = tf.tensor1d([0, Math.PI / 2, Math.PI * 3 / 4]);\n *\n * x.cos().print(); // or tf.cos(x)\n * ```\n * @param x The input tensor. Must be float32 type.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction cos_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'cos', 'float32');\n\n const inputs: CosInputs = {x: $x};\n\n return ENGINE.runKernel(Cos, inputs as {} as NamedTensorMap);\n}\nexport const cos = op({cos_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Cosh, CoshInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes hyperbolic cos of the input `tf.Tensor` element-wise: `cosh(x)`\n *\n * ```js\n * const x = tf.tensor1d([0, 1, -1, .7]);\n *\n * x.cosh().print(); // or tf.cosh(x)\n * ```\n * @param x The input tensor. Must be float32 type.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction cosh_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'cosh', 'float32');\n const inputs: CoshInputs = {x: $x};\n\n return ENGINE.runKernel(Cosh, inputs as {} as NamedTensorMap);\n}\nexport const cosh = op({cosh_});\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the 'License');\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an 'AS IS' BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport { ENGINE } from '../engine';\nimport { Cumprod, CumprodAttrs, CumprodInputs } from '../kernel_names';\nimport { NamedAttrMap } from '../kernel_registry';\nimport { Tensor } from '../tensor';\nimport { NamedTensorMap } from '../tensor_types';\nimport { convertToTensor } from '../tensor_util_env';\nimport { TensorLike } from '../types';\n\nimport { op } from './operation';\n\n/**\n * Computes the cumulative product of a `tf.Tensor` along `axis`.\n *\n * ```js\n * const x = tf.tensor([1, 2, 3, 4]);\n * x.cumprod().print();\n * ```\n * ```js\n * const x = tf.tensor([[1, 2], [3, 4]]);\n * x.cumprod().print();\n * ```\n *\n * @param x The input tensor to cumulatively multiply.\n * @param axis The axis along which to multiply. Optional. Defaults to 0.\n * @param exclusive Whether to perform exclusive cumulative product. Optional.\n * Defaults to false. If set to true then the product of each tensor entry\n * does not include its own value, but only the values previous to it\n * along the specified axis.\n * @param reverse Whether to multiply in the opposite direction. Optional.\n * Defaults to false.\n *\n * @doc {heading: 'Operations', subheading: 'Scan'}\n */\nfunction cumprod_(\n x: Tensor | TensorLike,\n axis = 0,\n exclusive = false,\n reverse = false\n): T {\n const $x = convertToTensor(x, 'x', 'cumprod');\n\n const inputs: CumprodInputs = { x: $x };\n const attrs: CumprodAttrs = { axis, exclusive, reverse };\n\n return ENGINE.runKernel(\n Cumprod,\n inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap\n );\n}\n\nexport const cumprod = op({ cumprod_ });\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Cumsum, CumsumAttrs, CumsumInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes the cumulative sum of a `tf.Tensor` along `axis`.\n *\n * ```js\n * const x = tf.tensor([1, 2, 3, 4]);\n * x.cumsum().print();\n * ```\n * ```js\n * const x = tf.tensor([[1, 2], [3, 4]]);\n * x.cumsum().print();\n * ```\n *\n * @param x The input tensor to be summed.\n * @param axis The axis along which to sum. Optional. Defaults to 0.\n * @param exclusive Whether to perform exclusive cumulative sum. Optional.\n * Defaults to false. If set to true then the sum of each tensor entry\n * does not include its own value, but only the values previous to it\n * along the specified axis.\n * @param reverse Whether to sum in the opposite direction. Optional.\n * Defaults to false.\n *\n * @doc {heading: 'Operations', subheading: 'Scan'}\n */\nfunction cumsum_(\n x: Tensor|TensorLike, axis = 0, exclusive = false, reverse = false): T {\n const $x = convertToTensor(x, 'x', 'cumsum');\n\n const inputs: CumsumInputs = {x: $x};\n const attrs: CumsumAttrs = {axis, exclusive, reverse};\n\n return ENGINE.runKernel(\n Cumsum, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const cumsum = op({cumsum_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {DenseBincount, DenseBincountAttrs, DenseBincountInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor1D, Tensor2D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\n\n/**\n * Outputs a vector with length `size` and the same dtype as `weights`.\n *\n * If `weights` are empty, then index `i` stores the number of times the value\n * `i` is counted in `x`. If `weights` are non-empty, then index `i` stores the\n * sum of the value in `weights` at each index where the corresponding value in\n * `x` is `i`.\n *\n * Values in `x` outside of the range [0, size) are ignored.\n *\n * @param x The input int tensor, rank 1 or rank 2.\n * @param weights The weights tensor, must have the same shape as x, or a\n * length-0 Tensor, in which case it acts as all weights equal to 1.\n * @param size Non-negative integer.\n * @param binaryOutput Optional. Whether the kernel should count the appearance\n * or number of occurrences. Defaults to False.\n *\n * @doc {heading: 'Operations', subheading: 'Reduction'}\n */\nfunction denseBincount_(\n x: T|TensorLike, weights: T|TensorLike, size: number,\n binaryOutput = false): T {\n const $x = convertToTensor(x, 'x', 'denseBincount');\n const $weights = convertToTensor(weights, 'weights', 'denseBincount');\n\n util.assert(\n $x.dtype === 'int32',\n () => `Error in denseBincount: input ` +\n `dtype must be int32, but got ${$x.dtype}`);\n util.assert(\n $x.rank <= 2,\n () => `Error in denseBincount: input must be at most rank 2, but got ` +\n `rank ${$x.rank}.`);\n util.assert(size >= 0, () => `size must be non-negative, but got ${size}.`);\n util.assert(\n $weights.size === $x.size || $weights.size === 0,\n () =>\n `Error in denseBincount: weights must have the same shape as x or ` +\n `0-length, but got x shape: ${$x.shape}, weights shape: ` +\n `${$weights.shape}.`);\n\n const inputs: DenseBincountInputs = {x: $x, weights: $weights};\n const attrs: DenseBincountAttrs = {size, binaryOutput};\n\n return ENGINE.runKernel(\n DenseBincount, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap);\n}\n\nexport const denseBincount = op({denseBincount_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {DepthToSpace, DepthToSpaceAttrs, DepthToSpaceInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor4D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike4D} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\n\n/**\n * Rearranges data from depth into blocks of spatial data. More specifically,\n * this op outputs a copy of the input tensor where values from the `depth`\n * dimension are moved in spatial blocks to the `height` and `width` dimensions.\n * The attr `blockSize` indicates the input block size and how the data is\n * moved.\n *\n * - Chunks of data of size `blockSize * blockSize` from depth are rearranged\n * into non-overlapping blocks of size `blockSize x blockSize`\n *\n * - The width the output tensor is `inputWidth * blockSize`, whereas the\n * height is `inputHeight * blockSize`\n *\n * - The Y, X coordinates within each block of the output image are determined\n * by the high order component of the input channel index\n *\n * - The depth of the input tensor must be divisible by `blockSize *\n * blockSize`\n *\n * The `dataFormat` attr specifies the layout of the input and output tensors\n * with the following options: \"NHWC\": [ `batch, height, width, channels` ]\n * \"NCHW\": [ `batch, channels, height, width` ]\n *\n * ```js\n * const x = tf.tensor4d([1, 2, 3, 4], [1, 1, 1, 4]);\n * const blockSize = 2;\n * const dataFormat = \"NHWC\";\n *\n * tf.depthToSpace(x, blockSize, dataFormat).print();\n * ```\n *\n * @param x The input tensor of rank 4\n * @param blockSIze An `int` that is `>= 2`. The size of the spatial block\n * @param dataFormat An optional string from: \"NHWC\", \"NCHW\". Defaults to \"NHWC\"\n *\n * @doc {heading: 'Tensors', subheading: 'Transformations'}\n */\nfunction depthToSpace_(\n x: Tensor4D|TensorLike4D, blockSize: number,\n dataFormat: 'NHWC'|'NCHW' = 'NHWC'): Tensor4D {\n const $x = convertToTensor(x, 'x', 'depthToSpace', 'float32') as Tensor4D;\n\n const inputHeight = (dataFormat === 'NHWC') ? $x.shape[1] : $x.shape[2];\n const inputWidth = (dataFormat === 'NHWC') ? $x.shape[2] : $x.shape[3];\n const inputDepth = (dataFormat === 'NHWC') ? $x.shape[3] : $x.shape[1];\n\n util.assert(\n blockSize > 1,\n () => `blockSize should be > 1 for depthToSpace, but was: ${blockSize}`);\n\n util.assert(\n inputHeight * blockSize >= 0,\n () => `Negative dimension size caused by overflow when multiplying\n ${inputHeight} and ${blockSize} for depthToSpace with input shape\n ${$x.shape}`);\n\n util.assert(\n inputWidth * blockSize >= 0,\n () => `Negative dimension size caused by overflow when multiplying\n ${inputWidth} and ${blockSize} for depthToSpace with input shape\n ${$x.shape}`);\n\n util.assert(\n (inputDepth % (blockSize * blockSize) === 0),\n () => `Dimension size must be evenly divisible by ${\n blockSize * blockSize} but is ${\n inputDepth} for depthToSpace with input shape ${$x.shape}`);\n\n const inputs: DepthToSpaceInputs = {x: $x};\n const attrs: DepthToSpaceAttrs = {blockSize, dataFormat};\n\n return ENGINE.runKernel(\n DepthToSpace, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap);\n}\n\nexport const depthToSpace = op({depthToSpace_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {DepthwiseConv2dNative, DepthwiseConv2dNativeAttrs, DepthwiseConv2dNativeInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor3D, Tensor4D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport * as conv_util from './conv_util';\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * Depthwise 2D convolution.\n *\n * Given a 4D `input` array and a `filter` array of shape\n * `[filterHeight, filterWidth, inChannels, channelMultiplier]` containing\n * `inChannels` convolutional filters of depth 1, this op applies a\n * different filter to each input channel (expanding from 1 channel to\n * `channelMultiplier` channels for each), then concatenates the results\n * together. The output has `inChannels * channelMultiplier` channels.\n *\n * See\n * [https://www.tensorflow.org/api_docs/python/tf/nn/depthwise_conv2d](\n * https://www.tensorflow.org/api_docs/python/tf/nn/depthwise_conv2d)\n * for more details.\n *\n * @param x The input tensor, of rank 4 or rank 3, of shape\n * `[batch, height, width, inChannels]`. If rank 3, batch of 1 is\n * assumed.\n * @param filter The filter tensor, rank 4, of shape\n * `[filterHeight, filterWidth, inChannels, channelMultiplier]`.\n * @param strides The strides of the convolution: `[strideHeight,\n * strideWidth]`. If strides is a single number, then `strideHeight ==\n * strideWidth`.\n * @param pad The type of padding algorithm.\n * - `same` and stride 1: output will be of same size as input,\n * regardless of filter size.\n * - `valid`: output will be smaller than input if filter is larger\n * than 1x1.\n * - For more info, see this guide:\n * [https://www.tensorflow.org/api_docs/python/tf/nn/convolution](\n * https://www.tensorflow.org/api_docs/python/tf/nn/convolution)\n * @param dilations The dilation rates: `[dilationHeight, dilationWidth]`\n * in which we sample input values across the height and width dimensions\n * in atrous convolution. Defaults to `[1, 1]`. If `rate` is a single\n * number, then `dilationHeight == dilationWidth`. If it is greater than\n * 1, then all values of `strides` must be 1.\n * @param dataFormat: An optional string from: \"NHWC\", \"NCHW\". Defaults to\n * \"NHWC\". Specify the data format of the input and output data. With the\n * default format \"NHWC\", the data is stored in the order of: [batch,\n * height, width, channels]. Only \"NHWC\" is currently supported.\n * @param dimRoundingMode A string from: 'ceil', 'round', 'floor'. If none is\n * provided, it will default to truncate.\n *\n * @doc {heading: 'Operations', subheading: 'Convolution'}\n */\nfunction depthwiseConv2d_(\n x: T|TensorLike, filter: Tensor4D|TensorLike,\n strides: [number, number]|number,\n pad: 'valid'|'same'|number|conv_util.ExplicitPadding,\n dataFormat: 'NHWC'|'NCHW' = 'NHWC',\n dilations: [number, number]|number = [1, 1],\n dimRoundingMode?: 'floor'|'round'|'ceil'): T {\n const $x = convertToTensor(x, 'x', 'depthwiseConv2d', 'float32');\n const $filter =\n convertToTensor(filter, 'filter', 'depthwiseConv2d', 'float32');\n\n let x4D = $x as Tensor4D;\n let reshapedTo4D = false;\n if ($x.rank === 3) {\n reshapedTo4D = true;\n x4D = reshape($x, [1, $x.shape[0], $x.shape[1], $x.shape[2]]);\n }\n util.assert(\n x4D.rank === 4,\n () => `Error in depthwiseConv2d: input must be rank 4, but got ` +\n `rank ${x4D.rank}.`);\n util.assert(\n $filter.rank === 4,\n () => `Error in depthwiseConv2d: filter must be rank 4, but got rank ` +\n `${$filter.rank}.`);\n const inChannels = dataFormat === 'NHWC' ? x4D.shape[3] : x4D.shape[1];\n util.assert(\n inChannels === $filter.shape[2],\n () => `Error in depthwiseConv2d: number of input channels ` +\n `(${inChannels}) must match the inChannels dimension in ` +\n `filter ${$filter.shape[2]}.`);\n conv_util.checkPadOnDimRoundingMode('depthwiseConv2d', pad, dimRoundingMode);\n const inputs: DepthwiseConv2dNativeInputs = {x: x4D, filter: $filter};\n const attrs: DepthwiseConv2dNativeAttrs =\n {strides, pad, dataFormat, dilations, dimRoundingMode};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n const res = ENGINE.runKernel(\n DepthwiseConv2dNative, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as T;\n\n if (reshapedTo4D) {\n return reshape(res, [res.shape[1], res.shape[2], res.shape[3]]) as T;\n }\n return res;\n}\n\nexport const depthwiseConv2d = op({depthwiseConv2d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Diag, DiagInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\n\nimport {op} from './operation';\n\n/**\n * Returns a diagonal tensor with given diagonal values.\n *\n * Given a diagonal, this operation returns a tensor with the diagonal and\n * everything else padded with zeros.\n *\n * Assume the input has dimensions `[D1,..., Dk]`, then the output is a tensor\n * of rank 2k with dimensions `[D1,..., Dk, D1,..., Dk]`\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 3, 4]);\n *\n * tf.diag(x).print()\n * ```\n * ```js\n * const x = tf.tensor2d([1, 2, 3, 4, 5, 6, 6, 8], [4, 2])\n *\n * tf.diag(x).print()\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nfunction diag_(x: Tensor): Tensor {\n const $x = convertToTensor(x, 'x', 'diag');\n\n const inputs: DiagInputs = {x: $x};\n\n return ENGINE.runKernel(Diag, inputs as {} as NamedTensorMap);\n}\n\nexport const diag = op({diag_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Dilation2D, Dilation2DAttrs, Dilation2DInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor3D, Tensor4D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * Computes the grayscale dilation over the input `x`.\n *\n * @param x The input tensor, rank 3 or rank 4 of shape\n * `[batch, height, width, inChannels]`. If rank 3, batch of 1 is assumed.\n * @param filter The filter tensor, rank 3, of shape\n * `[filterHeight, filterWidth, depth]`.\n * @param strides The strides of the sliding window for each dimension of the\n * input tensor: `[strideHeight, strideWidth]`.\n * If `strides` is a single number,\n * then `strideHeight == strideWidth`.\n * @param pad The type of padding algorithm.\n * - `same` and stride 1: output will be of same size as input,\n * regardless of filter size.\n * - `valid`: output will be smaller than input if filter is larger\n * than 1*1x1.\n * - For more info, see this guide:\n * [https://www.tensorflow.org/api_docs/python/tf/nn/convolution](\n * https://www.tensorflow.org/api_docs/python/tf/nn/convolution)\n * @param dataFormat Specify the data format of the input and output data.\n * Defaults to 'NHWC'. Only 'NHWC' is currently supported. With the\n * default format \"NHWC\", the data is stored in the order of: [batch,\n * height, width, channels].\n * @param dilations The dilation rates: `[dilationHeight, dilationWidth]`\n * in which we sample input values across the height and width dimensions\n * for atrous morphological dilation. Defaults to `[1, 1]`. If `dilations`\n * is a single number, then `dilationHeight == dilationWidth`. If it is\n * greater than 1, then all values of `strides` must be 1.\n *\n * @doc {heading: 'Operations', subheading: 'Convolution'}\n */\nfunction dilation2d_(\n x: T|TensorLike, filter: Tensor3D|TensorLike,\n strides: [number, number]|number, pad: 'valid'|'same',\n dilations: [number, number]|number = [1, 1],\n dataFormat: 'NHWC' = 'NHWC'): T {\n const $x = convertToTensor(x, 'x', 'dilation2d');\n const $filter = convertToTensor(filter, 'filter', 'dilation2d');\n\n util.assert(\n $x.rank === 3 || $x.rank === 4,\n () => `Error in dilation2d: input must be rank 3 or 4, but got rank ` +\n `${$x.rank}.`);\n util.assert(\n $filter.rank === 3,\n () => `Error in dilation2d: filter must be rank 3, but got rank ` +\n `${$filter.rank}.`);\n util.assert(\n dataFormat === 'NHWC',\n () => `Error in dilation2d: Only NHWC is currently supported, ` +\n `but got dataFormat of ${dataFormat}`);\n\n let x4D = $x as Tensor4D;\n let reshapedTo4D = false;\n\n if ($x.rank === 3) {\n x4D = reshape($x, [1, $x.shape[0], $x.shape[1], $x.shape[2]]);\n reshapedTo4D = true;\n }\n\n const inputs: Dilation2DInputs = {x: x4D, filter: $filter};\n const attrs: Dilation2DAttrs = {strides, pad, dilations};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n const res = ENGINE.runKernel(\n Dilation2D, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as T;\n\n if (reshapedTo4D) {\n return reshape(res, [res.shape[1], res.shape[2], res.shape[3]]) as T;\n }\n\n return res;\n}\n\nexport const dilation2d = op({dilation2d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Equal, EqualInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {assertAndGetBroadcastShape} from './broadcast_util';\nimport {op} from './operation';\n\n/**\n * Returns the truth value of (a == b) element-wise. Supports broadcasting.\n *\n * ```js\n * const a = tf.tensor1d([1, 2, 3]);\n * const b = tf.tensor1d([2, 2, 2]);\n *\n * a.equal(b).print();\n * ```\n *\n * @param a The first input tensor.\n * @param b The second input tensor. Must have the same dtype as `a`.\n *\n * @doc {heading: 'Operations', subheading: 'Logical'}\n */\nfunction equal_(\n a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n let $a = convertToTensor(a, 'a', 'equal', 'string_or_numeric');\n let $b = convertToTensor(b, 'b', 'equal', 'string_or_numeric');\n [$a, $b] = makeTypesMatch($a, $b);\n\n assertAndGetBroadcastShape($a.shape, $b.shape);\n\n const inputs: EqualInputs = {a: $a, b: $b};\n\n return ENGINE.runKernel(Equal, inputs as {} as NamedTensorMap);\n}\n\nexport const equal = op({equal_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Select, SelectInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {broadcastTo} from './broadcast_to';\nimport {assertAndGetBroadcastShape} from './broadcast_util';\nimport {op} from './operation';\n\n/**\n * Returns the elements, either `a` or `b` depending on the `condition`.\n *\n * If the condition is true, select from `a`, otherwise select from `b`.\n *\n * ```js\n * const cond = tf.tensor1d([false, false, true], 'bool');\n * const a = tf.tensor1d([1 , 2, 3]);\n * const b = tf.tensor1d([-1, -2, -3]);\n *\n * a.where(cond, b).print();\n * ```\n *\n * @param condition The input condition. Must be of dtype bool.\n * @param a If `condition` is rank 1, `a` may have a higher rank but\n * its first dimension must match the size of `condition`.\n * @param b A tensor with the same dtype as `a` and with shape that is\n * compatible with `a`.\n * @return A tensor with same dtype as `a` and `b`, and shape that is\n * broadcastable from `a` and `b`.\n *\n * @doc {heading: 'Operations', subheading: 'Logical'}\n */\nfunction where_(\n condition: Tensor|TensorLike, a: T|TensorLike, b: T|TensorLike): T {\n const $a = convertToTensor(a, 'a', 'where');\n const $b = convertToTensor(b, 'b', 'where');\n const $condition = convertToTensor(condition, 'condition', 'where', 'bool');\n // TODO: move this logic to forward function when the broadcastTo op is\n // implemented in WASM.\n // Find the broadcastable shape for $condition, $a, and $b.\n const broadcastShape = assertAndGetBroadcastShape(\n assertAndGetBroadcastShape($condition.shape, $a.shape), $b.shape);\n const $broadcastedCondition = broadcastTo($condition, broadcastShape);\n const $broadcastedA = broadcastTo($a, broadcastShape);\n const $broadcastedB = broadcastTo($b, broadcastShape);\n\n const inputs: SelectInputs = {\n condition: $broadcastedCondition,\n t: $broadcastedA,\n e: $broadcastedB\n };\n return ENGINE.runKernel(Select, inputs as {} as NamedTensorMap);\n}\n\nexport const where = op({where_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {ZerosLike, ZerosLikeInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Creates a `tf.Tensor` with all elements set to 0 with the same shape as the\n * given tensor.\n *\n * ```js\n * const x = tf.tensor([1, 2]);\n * tf.zerosLike(x).print();\n * ```\n *\n * @param x The tensor of required shape.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nfunction zerosLike_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'zerosLike');\n const inputs: ZerosLikeInputs = {x: $x};\n return ENGINE.runKernel(ZerosLike, inputs as {} as NamedTensorMap);\n}\nexport const zerosLike = op({zerosLike_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {div} from './div';\nimport {equal} from './equal';\nimport {op} from './operation';\nimport {where} from './where';\nimport {zerosLike} from './zeros_like';\n\n/**\n * Divides two `tf.Tensor`s element-wise, A / B. Supports broadcasting. Return 0\n * if denominator is 0.\n *\n *\n * ```js\n * const a = tf.tensor1d([1, 4, 9, 16]);\n * const b = tf.tensor1d([1, 2, 3, 4]);\n * const c = tf.tensor1d([0, 0, 0, 0]);\n *\n * a.divNoNan(b).print(); // or tf.divNoNan(a, b)\n * a.divNoNan(c).print(); // or tf.divNoNan(a, c)\n * ```\n *\n * ```js\n * // Broadcast div a with b.\n * const a = tf.tensor1d([2, 4, 6, 8]);\n * const b = tf.scalar(2);\n * const c = tf.scalar(0);\n *\n * a.divNoNan(b).print(); // or tf.divNoNan(a, b)\n * a.divNoNan(c).print(); // or tf.divNoNan(a, c)\n * ```\n *\n * @param a The first tensor as the numerator.\n * @param b The second tensor as the denominator. Must have the same dtype as\n * `a`.\n *\n * @doc {heading: 'Operations', subheading: 'Arithmetic'}\n */\nfunction divNoNan_(\n a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n // TODO: Make this into its own kernel.\n let $a = convertToTensor(a, 'a', 'div');\n let $b = convertToTensor(b, 'b', 'div');\n [$a, $b] = makeTypesMatch($a, $b);\n\n const divResult = div($a, $b);\n const zeros = zerosLike(divResult);\n const bEqualsZero = equal($b, zeros);\n return where(bEqualsZero, zeros, divResult) as T;\n}\n\nexport const divNoNan = op({divNoNan_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor,} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {matMul} from './mat_mul';\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * Computes the dot product of two matrices and/or vectors, `t1` and `t2`.\n *\n * ```js\n * const a = tf.tensor1d([1, 2]);\n * const b = tf.tensor2d([[1, 2], [3, 4]]);\n * const c = tf.tensor2d([[1, 2, 3], [4, 5, 6]]);\n *\n * a.dot(b).print(); // or tf.dot(a, b)\n * b.dot(a).print();\n * b.dot(c).print();\n * ```\n * @param t1 The first tensor in the dot operation.\n * @param t2 The second tensor in the dot operation.\n *\n * @doc {heading: 'Operations', subheading: 'Matrices'}\n */\nfunction dot_(t1: Tensor|TensorLike, t2: Tensor|TensorLike): Tensor {\n const $t1 = convertToTensor(t1, 't1', 'dot');\n const $t2 = convertToTensor(t2, 't2', 'dot');\n\n util.assert(\n ($t1.rank === 1 || $t1.rank === 2) && ($t2.rank === 1 || $t2.rank === 2),\n () => `Error in dot: inputs must all be rank 1 or 2, but got ranks ` +\n `${$t1.rank} and ${$t2.rank}.`);\n\n const t1Inner = ($t1.rank === 1 ? $t1.size : $t1.shape[1]);\n const t2Inner = ($t2.rank === 1 ? $t2.size : $t2.shape[0]);\n\n util.assert(\n t1Inner === t2Inner,\n () => `Error in dot: inner dimensions of inputs must match, but got ` +\n `${t1Inner} and ${t2Inner}.`);\n\n if ($t1.rank === 1 && $t2.rank === 1) {\n const t12D = reshape($t1, [1, -1]);\n const t22D = reshape($t2, [-1, 1]);\n const t1t2 = matMul(t12D, t22D);\n return reshape(t1t2, []);\n } else if ($t1.rank === 1 && $t2.rank === 2) {\n const t12D = reshape($t1, [1, -1]);\n const t22D = reshape($t2, [$t2.shape[0], $t2.shape[1]]);\n const t1t2 = matMul(t12D, t22D);\n return reshape(t1t2, [t1t2.size]);\n } else if ($t1.rank === 2 && $t2.rank === 1) {\n const t22D = reshape($t2, [-1, 1]);\n const t1t2 = matMul($t1, t22D);\n return reshape(t1t2, [t1t2.size]);\n } else {\n const t22D = reshape($t2, [$t2.shape[0], $t2.shape[1]]);\n const t1t2 = matMul($t1, t22D);\n return t1t2;\n }\n}\n\nexport const dot = op({dot_});\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Einsum, EinsumAttrs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\n\nimport {op} from './operation';\n\n/**\n * Tensor contraction over specified indices and outer product.\n *\n * `einsum` allows defining Tensors by defining their element-wise computation.\n * This computation is based on\n * [Einstein summation](https://en.wikipedia.org/wiki/Einstein_notation).\n *\n * Some special cases include:\n *\n * Matrix multiplication:\n * ```js\n * const x = tf.tensor2d([[1, 2, 3], [4, 5, 6]]);\n * const y = tf.tensor2d([[0, 1], [2, 3], [4, 5]]);\n * x.print();\n * y.print();\n * tf.einsum('ij,jk->ik', x, y).print();\n * ```\n *\n * Dot product:\n * ```js\n * const x = tf.tensor1d([1, 2, 3]);\n * const y = tf.tensor1d([0, 1, 2]);\n * x.print();\n * y.print();\n * tf.einsum('i,i->', x, y).print();\n * ```\n *\n * Batch dot product:\n * ```js\n * const x = tf.tensor2d([[1, 2, 3], [4, 5, 6]]);\n * const y = tf.tensor2d([[0, 1, 2], [3, 4, 5]]);\n * x.print();\n * y.print();\n * tf.einsum('bi,bi->b', x, y).print();\n * ```\n *\n * Outer prouduct:\n * ```js\n * const x = tf.tensor1d([1, 3, 5]);\n * const y = tf.tensor1d([2, 4, 6]);\n * x.print();\n * y.print();\n * tf.einsum('i,j->ij', x, y).print();\n * ```\n *\n * Matrix transpose:\n * ```js\n * const x = tf.tensor2d([[1, 2], [3, 4]]);\n * x.print();\n * tf.einsum('ij->ji', x).print();\n * ```\n *\n * Batch matrix transpose:\n * ```js\n * const x = tf.tensor3d([[[1, 2], [3, 4]], [[-1, -2], [-3, -4]]]);\n * x.print();\n * tf.einsum('bij->bji', x).print();\n * ```\n *\n * Limitations:\n *\n * This implementation of einsum has the following limitations:\n *\n * - Does not support >2 input tensors.\n * - Does not support duplicate axes for any given input tensor. E.g., equation\n * 'ii->' is not supported.\n * - The `...` notation is not supported.\n *\n * @param equation a string describing the contraction, in the same format as\n * [numpy.einsum](https://numpy.org/doc/stable/reference/generated/numpy.einsum.html).\n * @param tensors the input(s) to contract (each one a Tensor), whose shapes\n * should be consistent with equation.\n * @returns The output tensor.\n *\n * @doc {heading: 'Tensors', subheading: 'Matrices'}\n */\nexport function einsum_(equation: string, ...tensors: Tensor[]): Tensor {\n const $tensors =\n tensors.map((t, i) => convertToTensor(t, `tensors${i}`, 'einsum'));\n const attrs: EinsumAttrs = {equation};\n return ENGINE.runKernel(\n Einsum, $tensors as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const einsum = op({einsum_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Elu, EluInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes exponential linear element-wise: `x > 0 ? x : (e ^ x) - 1`.\n *\n * ```js\n * const x = tf.tensor1d([-1, 1, -3, 2]);\n *\n * x.elu().print(); // or tf.elu(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction elu_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'elu', 'float32');\n\n const inputs: EluInputs = {x: $x};\n\n return ENGINE.runKernel(Elu, inputs as {} as NamedTensorMap);\n}\n\nexport const elu = op({elu_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Erf, ErfInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {cast} from './cast';\nimport {op} from './operation';\n\n/**\n * Computes Gauss error function of the input `tf.Tensor` element-wise:\n * `erf(x)`\n *\n * ```js\n * const x = tf.tensor1d([0, .1, -.1, .7]);\n *\n * x.erf().print(); // or tf.erf(x);\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction erf_(x: T|TensorLike): T {\n let $x = convertToTensor(x, 'x', 'erf');\n util.assert(\n $x.dtype === 'int32' || $x.dtype === 'float32',\n () => 'Input dtype must be `int32` or `float32`.');\n\n if ($x.dtype === 'int32') {\n $x = cast($x, 'float32');\n }\n\n const inputs: ErfInputs = {x: $x};\n return ENGINE.runKernel(Erf, inputs as {} as NamedTensorMap);\n}\nexport const erf = op({erf_});\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport * as util from '../util';\n\n/**\n * Returns true if the axis specifies the inner most dimensions of the\n * array.\n */\nexport function axesAreInnerMostDims(axes: number[], rank: number): boolean {\n for (let i = 0; i < axes.length; ++i) {\n if (axes[axes.length - i - 1] !== rank - 1 - i) {\n return false;\n }\n }\n return true;\n}\n\nexport function combineLocations(\n outputLoc: number[], reduceLoc: number[], axes: number[]): number[] {\n const rank = outputLoc.length + reduceLoc.length;\n const loc = [];\n let outIdx = 0;\n let reduceIdx = 0;\n   for (let dim = 0; dim < rank; dim++) {\n if (axes.indexOf(dim) === -1) {\n loc.push(outputLoc[outIdx++]);\n } else {\n loc.push(reduceLoc[reduceIdx++]);\n }\n }\n return loc;\n}\n\nexport function computeOutAndReduceShapes(\n aShape: number[], axes: number[]): [number[], number[]] {\n const outShape = [];\n const rank = aShape.length;\n for (let dim = 0; dim < rank; dim++) {\n if (axes.indexOf(dim) === -1) {\n outShape.push(aShape[dim]);\n }\n }\n const reduceShape = axes.map(dim => aShape[dim]);\n return [outShape, reduceShape];\n}\n\nexport function expandShapeToKeepDim(\n shape: number[], axes: number[]): number[] {\n const reduceSubShape = axes.map(x => 1);\n return combineLocations(shape, reduceSubShape, axes);\n}\n\nexport function assertAxesAreInnerMostDims(\n msg: string, axes: number[], rank: number): void {\n util.assert(\n axesAreInnerMostDims(axes, rank),\n () => `${msg} supports only inner-most axes for now. ` +\n `Got axes ${axes} and rank-${rank} input.`);\n}\n\n/**\n * Returns the axes permutation to be used with `tf.transpose`, if such\n * permutation is necessary. Otherwise it returns null. This method is used by\n * operations that operate only on inner-most axes.\n */\nexport function getAxesPermutation(axes: number[], rank: number): number[]|\n null {\n if (axesAreInnerMostDims(axes, rank)) {\n return null;\n }\n const result: number[] = [];\n for (let i = 0; i < rank; ++i) {\n if (axes.indexOf(i) === -1) {\n result.push(i);\n }\n }\n axes.forEach(axis => result.push(axis));\n return result;\n}\n\n/** Returns the axes permutation that undoes the original permutation. */\nexport function getUndoAxesPermutation(axes: number[]): number[] {\n return axes.map((axis, i) => [i, axis])\n .sort((a, b) => a[1] - b[1])\n .map(x => x[0]);\n}\n\nexport function getInnerMostAxes(numAxes: number, rank: number): number[] {\n const res: number[] = [];\n for (let i = rank - numAxes; i < rank; ++i) {\n res.push(i);\n }\n return res;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Max, MaxAttrs, MaxInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes the maximum of elements across dimensions of a `tf.Tensor`.\n *\n * Reduces the input along the dimensions given in `axes`. Unless `keepDims`\n * is true, the rank of the `tf.Tensor` is reduced by 1 for each entry in\n * `axes`. If `keepDims` is true, the reduced dimensions are retained with\n * length 1. If `axes` has no entries, all dimensions are reduced, and a\n * `tf.Tensor` with a single element is returned.\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 3]);\n *\n * x.max().print(); // or tf.max(x)\n * ```\n *\n * ```js\n * const x = tf.tensor2d([1, 2, 3, 4], [2, 2]);\n *\n * const axis = 1;\n * x.max(axis).print(); // or tf.max(x, axis)\n * ```\n *\n * @param x The input tensor.\n * @param axis The dimension(s) to reduce. By default it reduces\n * all dimensions.\n * @param keepDims If true, retains reduced dimensions with size 1.\n *\n * @doc {heading: 'Operations', subheading: 'Reduction'}\n */\nfunction max_(\n x: Tensor|TensorLike, axis: number|number[] = null, keepDims = false): T {\n const $x = convertToTensor(x, 'x', 'max');\n\n const inputs: MaxInputs = {x: $x};\n const attrs: MaxAttrs = {reductionIndices: axis, keepDims};\n\n return ENGINE.runKernel(\n Max, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const max = op({max_});\n","/**\n * @license\n * Copyright 2020 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Min, MinAttrs, MinInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes the minimum value from the input.\n *\n * Reduces the input along the dimensions given in `axes`. Unless `keepDims`\n * is true, the rank of the array is reduced by 1 for each entry in `axes`.\n * If `keepDims` is true, the reduced dimensions are retained with length 1.\n * If `axes` has no entries, all dimensions are reduced, and an array with a\n * single element is returned.\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 3]);\n *\n * x.min().print(); // or tf.min(x)\n * ```\n *\n * ```js\n * const x = tf.tensor2d([1, 2, 3, 4], [2, 2]);\n *\n * const axis = 1;\n * x.min(axis).print(); // or tf.min(x, axis)\n * ```\n *\n * @param x The input Tensor.\n * @param axis The dimension(s) to reduce. By default it reduces\n * all dimensions.\n * @param keepDims If true, retains reduced dimensions with size 1.\n *\n * @doc {heading: 'Operations', subheading: 'Reduction'}\n */\nfunction min_(\n x: Tensor|TensorLike, axis: number|number[] = null, keepDims = false): T {\n const $x = convertToTensor(x, 'x', 'min');\n\n const inputs: MinInputs = {x: $x};\n const attrs: MinAttrs = {axis, keepDims};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n return ENGINE.runKernel(\n Min, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as T;\n}\n\nexport const min = op({min_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Pow, PowInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes the power of one `tf.Tensor` to another. Supports broadcasting.\n *\n * Given a `tf.Tensor` x and a `tf.Tensor` y, this operation computes x^y for\n * corresponding elements in x and y. The result's dtype will be the upcasted\n * type of the `base` and `exp` dtypes.\n *\n * ```js\n * const a = tf.tensor([[2, 3], [4, 5]])\n * const b = tf.tensor([[1, 2], [3, 0]]).toInt();\n *\n * a.pow(b).print(); // or tf.pow(a, b)\n * ```\n *\n * ```js\n * const a = tf.tensor([[1, 2], [3, 4]])\n * const b = tf.tensor(2).toInt();\n *\n * a.pow(b).print(); // or tf.pow(a, b)\n * ```\n * We also expose `powStrict` which has the same signature as this op and\n * asserts that `base` and `exp` are the same shape (does not broadcast).\n *\n * @param base The base `tf.Tensor` to pow element-wise.\n * @param exp The exponent `tf.Tensor` to pow element-wise.\n *\n * @doc {heading: 'Operations', subheading: 'Arithmetic'}\n */\nfunction pow_(\n base: Tensor|TensorLike, exp: Tensor|TensorLike): T {\n let $base = convertToTensor(base, 'base', 'pow');\n let $exp = convertToTensor(exp, 'exp', 'pow');\n [$base, $exp] = makeTypesMatch($base, $exp);\n\n const inputs: PowInputs = {a: $base, b: $exp};\n\n return ENGINE.runKernel(Pow, inputs as {} as NamedTensorMap);\n}\n\nexport const pow = op({pow_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Scalar} from '../tensor';\nimport {DataType} from '../types';\nimport {isTypedArray} from '../util';\nimport {makeTensor} from './tensor_ops_util';\n\n/**\n * Creates rank-0 `tf.Tensor` (scalar) with the provided value and dtype.\n *\n * The same functionality can be achieved with `tf.tensor`, but in general\n * we recommend using `tf.scalar` as it makes the code more readable.\n *\n * ```js\n * tf.scalar(3.14).print();\n * ```\n *\n * @param value The value of the scalar.\n * @param dtype The data type.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nexport function scalar(\n value: number|boolean|string|Uint8Array, dtype?: DataType): Scalar {\n if (((isTypedArray(value) && dtype !== 'string') || Array.isArray(value)) &&\n dtype !== 'complex64') {\n throw new Error(\n 'Error creating a new Scalar: value must be a primitive ' +\n '(number|boolean|string)');\n }\n if (dtype === 'string' && isTypedArray(value) &&\n !(value instanceof Uint8Array)) {\n throw new Error(\n 'When making a scalar from encoded string, ' +\n 'the value must be `Uint8Array`.');\n }\n const shape: number[] = [];\n const inferredShape: number[] = [];\n return makeTensor(value, shape, inferredShape, dtype) as Scalar;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Sqrt, SqrtInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes square root of the input `tf.Tensor` element-wise: `y = sqrt(x)`\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 4, -1]);\n *\n * x.sqrt().print(); // or tf.sqrt(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction sqrt_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'sqrt', 'float32');\n\n const inputs: SqrtInputs = {x: $x};\n\n return ENGINE.runKernel(Sqrt, inputs as {} as NamedTensorMap);\n}\nexport const sqrt = op({sqrt_});\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Tensor} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {op} from './operation';\n\n/**\n * Computes square of `x` element-wise: `x ^ 2`\n *\n * ```js\n * const x = tf.tensor1d([1, 2, Math.sqrt(2), -1]);\n *\n * x.square().print(); // or tf.square(x)\n * ```\n * @param x The input Tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction square_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'square');\n const attrs = {};\n return ENGINE.runKernel('Square', {x: $x}, attrs);\n}\n\nexport const square = op({square_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Sum, SumAttrs, SumInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {cast} from './cast';\nimport {op} from './operation';\n\n/**\n * Computes the sum of elements across dimensions of a `tf.Tensor`.\n *\n * Reduces the input along the dimensions given in `axes`. Unless `keepDims`\n * is true, the rank of the `tf.Tensor` is reduced by 1 for each entry in\n * `axes`. If `keepDims` is true, the reduced dimensions are retained with\n * length 1. If axes has no entries, all dimensions are reduced, and a\n * `tf.Tensor` with a single element is returned.\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 3]);\n *\n * x.sum().print(); // or tf.sum(x)\n * ```\n *\n * ```js\n * const x = tf.tensor2d([1, 2, 3, 4], [2, 2]);\n *\n * const axis = 1;\n * x.sum(axis).print(); // or tf.sum(x, axis)\n * ```\n *\n * @param x The input tensor to compute the sum over. If the dtype is `bool`\n * it will be converted to `int32` and the output dtype will be `int32`.\n * @param axis The dimension(s) to reduce. By default it reduces\n * all dimensions.\n * @param keepDims If true, retains reduced dimensions with size 1.\n *\n * @doc {heading: 'Operations', subheading: 'Reduction'}\n */\nfunction sum_(\n x: Tensor|TensorLike, axis: number|number[] = null, keepDims = false): T {\n let $x = convertToTensor(x, 'x', 'sum');\n if ($x.dtype === 'bool') {\n $x = cast($x, 'int32');\n }\n\n const inputs: SumInputs = {x: $x};\n const attrs: SumAttrs = {axis, keepDims};\n\n return ENGINE.runKernel(\n Sum, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const sum = op({sum_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {parseAxisParam} from '../util';\n\nimport {abs} from './abs';\nimport * as axis_util from './axis_util';\nimport {max} from './max';\nimport {min} from './min';\nimport {op} from './operation';\nimport {pow} from './pow';\nimport {reshape} from './reshape';\nimport {scalar} from './scalar';\nimport {sqrt} from './sqrt';\nimport {square} from './square';\nimport {sum} from './sum';\n\n/**\n * Computes the norm of scalar, vectors, and matrices.\n * This function can compute several different vector norms (the 1-norm, the\n * Euclidean or 2-norm, the inf-norm, and in general the p-norm for p > 0)\n * and matrix norms (Frobenius, 1-norm, and inf-norm).\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 3, 4]);\n *\n * x.norm().print(); // or tf.norm(x)\n * ```\n *\n * @param x The input array.\n * @param ord Optional. Order of the norm. Supported norm types are\n * following:\n *\n * | ord | norm for matrices | norm for vectors\n * |------------|---------------------------|---------------------\n * |'euclidean' |Frobenius norm |2-norm\n * |'fro' |Frobenius norm\t |\n * |Infinity |max(sum(abs(x), axis=1)) |max(abs(x))\n * |-Infinity |min(sum(abs(x), axis=1)) |min(abs(x))\n * |1 |max(sum(abs(x), axis=0)) |sum(abs(x))\n * |2 | |sum(abs(x)^2)^(1/2)\n *\n * @param axis Optional. If axis is null (the default), the input is\n * considered a vector and a single vector norm is computed over the entire\n * set of values in the Tensor, i.e. norm(x, ord) is equivalent\n * to norm(x.reshape([-1]), ord). If axis is an integer, the input\n * is considered a batch of vectors, and axis determines the axis in x\n * over which to compute vector norms. If axis is a 2-tuple of integer it is\n * considered a batch of matrices and axis determines the axes in NDArray\n * over which to compute a matrix norm.\n * @param keepDims Optional. If true, the norm has the same dimensionality\n * as the input.\n *\n * @doc {heading: 'Operations', subheading: 'Matrices'}\n */\nfunction norm_(\n x: Tensor|TensorLike, ord: number|'euclidean'|'fro' = 'euclidean',\n axis: number|number[] = null, keepDims = false): Tensor {\n x = convertToTensor(x, 'x', 'norm');\n\n const norm = normImpl(x, ord, axis);\n let keepDimsShape = norm.shape;\n if (keepDims) {\n const axes = parseAxisParam(axis, x.shape);\n keepDimsShape = axis_util.expandShapeToKeepDim(norm.shape, axes);\n }\n return reshape(norm, keepDimsShape);\n}\n\nfunction normImpl(\n x: Tensor, p: number|string, axis: number|number[] = null): Tensor {\n if (x.rank === 0) {\n return abs(x);\n }\n\n // consider vector when no axis is specified\n if (x.rank !== 1 && axis === null) {\n return normImpl(reshape(x, [-1]), p, axis);\n }\n\n // vector\n if (x.rank === 1 || typeof axis === 'number' ||\n Array.isArray(axis) && axis.length === 1) {\n if (p === 1) {\n return sum(abs(x), axis);\n }\n if (p === Infinity) {\n return max(abs(x), axis);\n }\n if (p === -Infinity) {\n return min(abs(x), axis);\n }\n if (p === 'euclidean' || p === 2) {\n // norm(x, 2) = sum(abs(xi) ^ 2) ^ 1/2\n return sqrt(sum(pow(abs(x), scalar(2, 'int32')), axis));\n }\n\n throw new Error(`Error in norm: invalid ord value: ${p}`);\n }\n\n // matrix (assumption axis[0] < axis[1])\n if (Array.isArray(axis) && axis.length === 2) {\n if (p === 1) {\n return max(sum(abs(x), axis[0]), axis[1] - 1);\n }\n if (p === Infinity) {\n return max(sum(abs(x), axis[1]), axis[0]);\n }\n if (p === -Infinity) {\n return min(sum(abs(x), axis[1]), axis[0]);\n }\n if (p === 'fro' || p === 'euclidean') {\n // norm(x) = sqrt(sum(pow(x, 2)))\n return sqrt(sum(square(x), axis));\n }\n\n throw new Error(`Error in norm: invalid ord value: ${p}`);\n }\n\n throw new Error(`Error in norm: invalid axis: ${axis}`);\n}\n\nexport const norm = op({norm_});\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport {TensorLike} from '../types';\n\nimport {norm} from './norm';\nimport {op} from './operation';\n\n/**\n * Computes the Euclidean norm of scalar, vectors, and matrices.\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 3, 4]);\n *\n * x.euclideanNorm().print(); // or tf.euclideanNorm(x)\n * ```\n *\n * @param x The input array.\n * @param axis Optional. If axis is null (the default), the input is\n * considered a vector and a single vector norm is computed over the entire\n * set of values in the Tensor, i.e. euclideanNorm(x) is equivalent\n * to euclideanNorm(x.reshape([-1])). If axis is an integer, the input\n * is considered a batch of vectors, and axis determines the axis in x\n * over which to compute vector norms. If axis is a 2-tuple of integer it is\n * considered a batch of matrices and axis determines the axes in NDArray\n * over which to compute a matrix norm.\n * @param keepDims Optional. If true, the norm has the same dimensionality\n * as the input.\n *\n * @doc {heading: 'Operations', subheading: 'Matrices'}\n */\nfunction euclideanNorm_(\n x: Tensor|TensorLike, axis: number|number[] = null,\n keepDims = false): Tensor {\n return norm(x, 'euclidean', axis, keepDims);\n}\n\nexport const euclideanNorm = op({euclideanNorm_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Exp, ExpInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes exponential of the input `tf.Tensor` element-wise. `e ^ x`\n *\n * ```js\n * const x = tf.tensor1d([1, 2, -3]);\n *\n * x.exp().print(); // or tf.exp(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction exp_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'exp');\n\n const inputs: ExpInputs = {x: $x};\n return ENGINE.runKernel(Exp, inputs as {} as NamedTensorMap);\n}\nexport const exp = op({exp_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {ExpandDims, ExpandDimsAttrs, ExpandDimsInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\n\n/**\n * Returns a `tf.Tensor` that has expanded rank, by inserting a dimension\n * into the tensor's shape.\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 3, 4]);\n * const axis = 1;\n * x.expandDims(axis).print();\n * ```\n *\n * @param x The input tensor whose dimensions are to be expanded.\n * @param axis The dimension index at which to insert shape of `1`. Defaults\n * to 0 (the first dimension).\n *\n * @doc {heading: 'Tensors', subheading: 'Transformations'}\n */\nfunction expandDims_(x: Tensor|TensorLike, axis = 0): T {\n const $x = convertToTensor(x, 'x', 'expandDims', 'string_or_numeric');\n\n util.assert(axis <= $x.rank, () => 'Axis must be <= rank of the tensor');\n\n const inputs: ExpandDimsInputs = {input: $x};\n const attrs: ExpandDimsAttrs = {dim: axis};\n\n return ENGINE.runKernel(\n ExpandDims, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const expandDims = op({expandDims_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Expm1, Expm1Inputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes exponential of the input `tf.Tensor` minus one element-wise.\n * `e ^ x - 1`\n *\n * ```js\n * const x = tf.tensor1d([1, 2, -3]);\n *\n * x.expm1().print(); // or tf.expm1(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction expm1_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'expm1');\n\n const inputs: Expm1Inputs = {x: $x};\n return ENGINE.runKernel(Expm1, inputs as {} as NamedTensorMap);\n}\nexport const expm1 = op({expm1_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Tile, TileAttrs, TileInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\n\n/**\n * Construct a tensor by repeating it the number of times given by reps.\n *\n * This operation creates a new tensor by replicating `input` `reps`\n * times. The output tensor's `i`th dimension has `input.shape[i] *\n * reps[i]` elements, and the values of `input` are replicated\n * `reps[i]` times along the `i`th dimension. For example, tiling\n * `[a, b, c, d]` by `[2]` produces `[a, b, c, d, a, b, c, d]`.\n *\n * ```js\n * const a = tf.tensor1d([1, 2]);\n *\n * a.tile([2]).print(); // or a.tile([2])\n * ```\n *\n * ```js\n * const a = tf.tensor2d([1, 2, 3, 4], [2, 2]);\n *\n * a.tile([1, 2]).print(); // or a.tile([1, 2])\n * ```\n * @param x The tensor to tile.\n * @param reps Determines the number of replications per dimension.\n *\n * @doc {heading: 'Tensors', subheading: 'Slicing and Joining'}\n */\nfunction tile_(x: T|TensorLike, reps: number[]): T {\n const $x = convertToTensor(x, 'x', 'tile', 'string_or_numeric');\n util.assert(\n $x.rank === reps.length,\n () => `Error in transpose: rank of input ${$x.rank} ` +\n `must match length of reps ${reps}.`);\n\n const inputs: TileInputs = {x: $x};\n const attrs: TileAttrs = {reps};\n\n return ENGINE.runKernel(\n Tile, inputs as unknown as NamedTensorMap,\n attrs as unknown as NamedAttrMap);\n}\n\nexport const tile = op({tile_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor2D} from '../tensor';\nimport {DataType} from '../types';\n\nimport {buffer} from './buffer';\nimport {expandDims} from './expand_dims';\nimport {op} from './operation';\nimport {reshape} from './reshape';\nimport {tile} from './tile';\n\n/**\n * Create an identity matrix.\n *\n * @param numRows Number of rows.\n * @param numColumns Number of columns. Defaults to `numRows`.\n * @param batchShape If provided, will add the batch shape to the beginning\n * of the shape of the returned `tf.Tensor` by repeating the identity\n * matrix.\n * @param dtype Data type.\n * @returns Identity matrix of the specified size and data type, possibly\n * with batch repetition if `batchShape` is specified.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nfunction eye_(\n numRows: number, numColumns?: number,\n batchShape?:\n [\n number\n ]|[number,\n number]|[number, number, number]|[number, number, number, number],\n dtype: DataType = 'float32'): Tensor2D {\n if (numColumns == null) {\n numColumns = numRows;\n }\n const buff = buffer([numRows, numColumns], dtype);\n const n = numRows <= numColumns ? numRows : numColumns;\n for (let i = 0; i < n; ++i) {\n buff.set(1, i, i);\n }\n const out: Tensor2D = reshape(buff.toTensor(), [numRows, numColumns]);\n if (batchShape == null) {\n return out;\n } else {\n if (batchShape.length === 1) {\n return tile(expandDims(out, 0), [batchShape[0], 1, 1]) as Tensor2D;\n } else if (batchShape.length === 2) {\n // tslint:disable-next-line:no-unnecessary-type-assertion\n return tile(\n expandDims(expandDims(out, 0), 0),\n [batchShape[0], batchShape[1], 1, 1]) as Tensor2D;\n } else if (batchShape.length === 3) {\n // tslint:disable-next-line:no-unnecessary-type-assertion\n return tile(expandDims(expandDims(expandDims(out, 0), 0), 0), [\n batchShape[0], batchShape[1], batchShape[2], 1, 1\n ]) as Tensor2D;\n } else {\n throw new Error(\n `eye() currently supports only 1D and 2D ` +\n // tslint:disable-next-line:no-any\n `batchShapes, but received ${(batchShape as any).length}D.`);\n }\n }\n}\n\nexport const eye = op({eye_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Floor, FloorInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes floor of input `tf.Tensor` element-wise: `floor(x)`.\n *\n * ```js\n * const x = tf.tensor1d([.6, 1.1, -3.3]);\n *\n * x.floor().print(); // or tf.floor(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction floor_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'floor', 'float32');\n\n const inputs: FloorInputs = {x: $x};\n return ENGINE.runKernel(Floor, inputs as {} as NamedTensorMap);\n}\nexport const floor = op({floor_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {GatherV2, GatherV2Attrs, GatherV2Inputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Gather slices from tensor `x`'s axis `axis` according to `indices`.\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 3, 4]);\n * const indices = tf.tensor1d([1, 3, 3], 'int32');\n *\n * x.gather(indices).print();\n * ```\n *\n * ```js\n * const x = tf.tensor2d([1, 2, 3, 4], [2, 2]);\n * const indices = tf.tensor1d([1, 1, 0], 'int32');\n *\n * x.gather(indices).print();\n * ```\n * @param x The input tensor whose slices are to be gathered.\n * @param indices The indices of the values to extract.\n * @param axis The axis over which to select values. Defaults to 0.\n * @param batchDims Optional. The number of batch dimensions. It must be less\n * than or equal to rank(indices). Defaults to 0.\n * The output tensor will have shape of\n * `x.shape[:axis] + indices.shape[batchDims:] + x.shape[axis + 1:]`\n *\n * @doc {heading: 'Tensors', subheading: 'Slicing and Joining'}\n */\nfunction gather_(\n x: T|TensorLike, indices: Tensor|TensorLike, axis = 0, batchDims = 0): T {\n const $x = convertToTensor(x, 'x', 'gather');\n const $indices = convertToTensor(indices, 'indices', 'gather', 'int32');\n\n const inputs: GatherV2Inputs = {x: $x, indices: $indices};\n const attrs: GatherV2Attrs = {axis, batchDims};\n\n return ENGINE.runKernel(\n GatherV2, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const gather = op({gather_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Greater, GreaterInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {assertAndGetBroadcastShape} from './broadcast_util';\nimport {op} from './operation';\n\n/**\n * Returns the truth value of (a > b) element-wise. Supports broadcasting.\n *\n * ```js\n * const a = tf.tensor1d([1, 2, 3]);\n * const b = tf.tensor1d([2, 2, 2]);\n *\n * a.greater(b).print();\n * ```\n *\n * @param a The first input tensor.\n * @param b The second input tensor. Must have the same dtype as `a`.\n *\n * @doc {heading: 'Operations', subheading: 'Logical'}\n */\nfunction greater_(\n a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n let $a = convertToTensor(a, 'a', 'greater', 'string_or_numeric');\n let $b = convertToTensor(b, 'b', 'greater', 'string_or_numeric');\n [$a, $b] = makeTypesMatch($a, $b);\n\n assertAndGetBroadcastShape($a.shape, $b.shape);\n\n const inputs: GreaterInputs = {a: $a, b: $b};\n\n return ENGINE.runKernel(Greater, inputs as {} as NamedTensorMap);\n}\n\nexport const greater = op({greater_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {GreaterEqual, GreaterEqualInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {assertAndGetBroadcastShape} from './broadcast_util';\nimport {op} from './operation';\n\n/**\n * Returns the truth value of (a >= b) element-wise. Supports broadcasting.\n *\n * ```js\n * const a = tf.tensor1d([1, 2, 3]);\n * const b = tf.tensor1d([2, 2, 2]);\n *\n * a.greaterEqual(b).print();\n * ```\n *\n * @param a The first input tensor.\n * @param b The second input tensor. Must have the same dtype as `a`.\n *\n * @doc {heading: 'Operations', subheading: 'Logical'}\n */\nfunction greaterEqual_(\n a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n let $a = convertToTensor(a, 'a', 'greaterEqual', 'string_or_numeric');\n let $b = convertToTensor(b, 'b', 'greaterEqual', 'string_or_numeric');\n [$a, $b] = makeTypesMatch($a, $b);\n\n assertAndGetBroadcastShape($a.shape, $b.shape);\n\n const inputs: GreaterEqualInputs = {a: $a, b: $b};\n\n return ENGINE.runKernel(GreaterEqual, inputs as {} as NamedTensorMap);\n}\n\nexport const greaterEqual = op({greaterEqual_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {IsFinite, IsFiniteInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Returns which elements of x are finite.\n *\n * ```js\n * const x = tf.tensor1d([NaN, Infinity, -Infinity, 0, 1]);\n *\n * x.isFinite().print(); // or tf.isNaN(x)\n * ```\n * @param x The input Tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction isFinite_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'isFinite');\n\n const inputs: IsFiniteInputs = {x: $x};\n\n return ENGINE.runKernel(IsFinite, inputs as {} as NamedTensorMap);\n}\nexport const isFinite = op({isFinite_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {IsInf, IsInfInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Returns which elements of x are Infinity or -Infinity.\n *\n * ```js\n * const x = tf.tensor1d([NaN, Infinity, -Infinity, 0, 1]);\n *\n * x.isInf().print(); // or tf.isNaN(x)\n * ```\n * @param x The input Tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction isInf_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'isInf');\n\n const inputs: IsInfInputs = {x: $x};\n\n return ENGINE.runKernel(IsInf, inputs as {} as NamedTensorMap);\n}\nexport const isInf = op({isInf_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {IsNan, IsNanInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Returns which elements of x are NaN.\n *\n * ```js\n * const x = tf.tensor1d([NaN, Infinity, -Infinity, 0, 1]);\n *\n * x.isNaN().print(); // or tf.isNaN(x)\n * ```\n * @param x The input Tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction isNaN_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'isNaN');\n const inputs: IsNanInputs = {x: $x};\n\n return ENGINE.runKernel(IsNan, inputs as {} as NamedTensorMap);\n}\nexport const isNaN = op({isNaN_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {LeakyRelu, LeakyReluAttrs, LeakyReluInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes leaky rectified linear element-wise.\n *\n * See\n * [http://web.stanford.edu/~awni/papers/relu_hybrid_icml2013_final.pdf](\n * http://web.stanford.edu/~awni/papers/relu_hybrid_icml2013_final.pdf)\n *\n * ```js\n * const x = tf.tensor1d([-1, 2, -3, 4]);\n *\n * x.leakyRelu(0.1).print(); // or tf.leakyRelu(x, 0.1)\n * ```\n * @param x The input tensor.\n * @param alpha The scaling factor for negative values, defaults to 0.2.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction leakyRelu_(x: T|TensorLike, alpha = 0.2): T {\n const $x = convertToTensor(x, 'x', 'leakyRelu');\n\n const inputs: LeakyReluInputs = {x: $x};\n const attrs: LeakyReluAttrs = {alpha};\n\n return ENGINE.runKernel(\n LeakyRelu, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const leakyRelu = op({leakyRelu_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Less, LessInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {assertAndGetBroadcastShape} from './broadcast_util';\nimport {op} from './operation';\n\n/**\n * Returns the truth value of (a < b) element-wise. Supports broadcasting.\n *\n * ```js\n * const a = tf.tensor1d([1, 2, 3]);\n * const b = tf.tensor1d([2, 2, 2]);\n *\n * a.less(b).print();\n * ```\n * @param a The first input tensor.\n * @param b The second input tensor. Must have the same dtype as `a`.\n *\n * @doc {heading: 'Operations', subheading: 'Logical'}\n */\nfunction less_(\n a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n let $a = convertToTensor(a, 'a', 'less', 'string_or_numeric');\n let $b = convertToTensor(b, 'b', 'less', 'string_or_numeric');\n [$a, $b] = makeTypesMatch($a, $b);\n\n assertAndGetBroadcastShape($a.shape, $b.shape);\n\n const inputs: LessInputs = {a: $a, b: $b};\n\n return ENGINE.runKernel(Less, inputs as {} as NamedTensorMap);\n}\n\nexport const less = op({less_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {LessEqual, LessEqualInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {assertAndGetBroadcastShape} from './broadcast_util';\nimport {op} from './operation';\n\n/**\n * Returns the truth value of (a <= b) element-wise. Supports broadcasting.\n *\n * ```js\n * const a = tf.tensor1d([1, 2, 3]);\n * const b = tf.tensor1d([2, 2, 2]);\n *\n * a.lessEqual(b).print();\n * ```\n *\n * @param a The first input tensor.\n * @param b The second input tensor. Must have the same dtype as `a`.\n *\n * @doc {heading: 'Operations', subheading: 'Logical'}\n */\nfunction lessEqual_(\n a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n let $a = convertToTensor(a, 'a', 'lessEqual', 'string_or_numeric');\n let $b = convertToTensor(b, 'b', 'lessEqual', 'string_or_numeric');\n [$a, $b] = makeTypesMatch($a, $b);\n\n assertAndGetBroadcastShape($a.shape, $b.shape);\n\n const inputs: LessEqualInputs = {a: $a, b: $b};\n\n return ENGINE.runKernel(LessEqual, inputs as {} as NamedTensorMap);\n}\n\nexport const lessEqual = op({lessEqual_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {LinSpace, LinSpaceAttrs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor1D} from '../tensor';\n\n/**\n * Return an evenly spaced sequence of numbers over the given interval.\n *\n * ```js\n * tf.linspace(0, 9, 10).print();\n * ```\n * @param start The start value of the sequence.\n * @param stop The end value of the sequence.\n * @param num The number of values to generate.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nexport function linspace(start: number, stop: number, num: number): Tensor1D {\n if (num <= 0) {\n throw new Error('The number of values should be positive.');\n }\n\n const attrs: LinSpaceAttrs = {start, stop, num};\n return ENGINE.runKernel(LinSpace, {}, attrs as {} as NamedAttrMap);\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {LRN, LRNAttrs, LRNInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor3D, Tensor4D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * Normalizes the activation of a local neighborhood across or within\n * channels.\n *\n * @param x The input tensor. The 4-D input tensor is treated as a 3-D array\n * of 1D vectors (along the last dimension), and each vector is\n * normalized independently.\n * @param depthRadius The number of adjacent channels in the 1D normalization\n * window.\n * @param bias A constant bias term for the basis.\n * @param alpha A scale factor, usually positive.\n * @param beta An exponent.\n *\n * @doc {heading: 'Operations', subheading: 'Normalization'}\n */\nfunction localResponseNormalization_(\n x: T|TensorLike, depthRadius = 5, bias = 1, alpha = 1, beta = 0.5): T {\n const $x = convertToTensor(x, 'x', 'localResponseNormalization');\n util.assert(\n $x.rank === 4 || $x.rank === 3,\n () => `Error in localResponseNormalization: x must be rank 3 or 4 but got\n rank ${$x.rank}.`);\n util.assert(\n util.isInt(depthRadius),\n () => `Error in localResponseNormalization: depthRadius must be an ` +\n `integer but got depthRadius ${depthRadius}.`);\n\n let x4D = $x as Tensor4D;\n let reshapedTo4D = false;\n if ($x.rank === 3) {\n reshapedTo4D = true;\n x4D = reshape($x, [1, $x.shape[0], $x.shape[1], $x.shape[2]]);\n }\n\n const inputs: LRNInputs = {x: x4D};\n\n const attrs: LRNAttrs = {depthRadius, bias, alpha, beta};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n const res = ENGINE.runKernel(\n LRN, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as T;\n\n if (reshapedTo4D) {\n return reshape(res, [res.shape[1], res.shape[2], res.shape[3]]) as T;\n } else {\n return res;\n }\n}\n\nexport const localResponseNormalization = op({localResponseNormalization_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Log, LogInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes natural logarithm of the input `tf.Tensor` element-wise: `ln(x)`\n *\n * ```js\n * const x = tf.tensor1d([1, 2, Math.E]);\n *\n * x.log().print(); // or tf.log(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction log_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'log', 'float32');\n\n const inputs: LogInputs = {x: $x};\n return ENGINE.runKernel(Log, inputs as {} as NamedTensorMap);\n}\nexport const log = op({log_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Log1p, Log1pInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes natural logarithm of the input `tf.Tensor` plus one\n * element-wise: `ln(1 + x)`\n *\n * ```js\n * const x = tf.tensor1d([1, 2, Math.E - 1]);\n *\n * x.log1p().print(); // or tf.log1p(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction log1p_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'log1p');\n\n const inputs: Log1pInputs = {x: $x};\n return ENGINE.runKernel(Log1p, inputs as {} as NamedTensorMap);\n}\nexport const log1p = op({log1p_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {CustomGradientFunc, ENGINE} from './engine';\nimport {Scalar, Tensor, Variable} from './tensor';\nimport {NamedTensorMap} from './tensor_types';\nimport {convertToTensor, convertToTensorArray} from './tensor_util_env';\nimport {TensorLike} from './types';\nimport * as util from './util';\n\n/**\n * Provided `f(x)`, returns another function `g(x, dy?)`, which gives the\n * gradient of `f(x)` with respect to `x`.\n *\n * If `dy` is provided, the gradient of `f(x).mul(dy).sum()` with respect to\n * `x` is computed instead. `f(x)` must take a single tensor `x` and return a\n * single tensor `y`. If `f()` takes multiple inputs, use `tf.grads` instead.\n *\n * ```js\n * // f(x) = x ^ 2\n * const f = x => x.square();\n * // f'(x) = 2x\n * const g = tf.grad(f);\n *\n * const x = tf.tensor1d([2, 3]);\n * g(x).print();\n * ```\n *\n * ```js\n * // f(x) = x ^ 3\n * const f = x => x.pow(tf.scalar(3, 'int32'));\n * // f'(x) = 3x ^ 2\n * const g = tf.grad(f);\n * // f''(x) = 6x\n * const gg = tf.grad(g);\n *\n * const x = tf.tensor1d([2, 3]);\n * gg(x).print();\n * ```\n *\n * @param f The function f(x), to compute gradient for.\n *\n * @doc {heading: 'Training', subheading: 'Gradients'}\n */\nfunction grad(f: (x: Tensor) => Tensor): (\n x: TensorLike|Tensor, dy?: TensorLike|Tensor) => Tensor {\n util.assert(\n util.isFunction(f), () => 'The f passed in grad(f) must be a function');\n return (x: TensorLike|Tensor, dy?: TensorLike|Tensor): Tensor => {\n // x can be of any dtype, thus null as the last argument.\n const $x = convertToTensor(x, 'x', 'tf.grad', 'string_or_numeric');\n const $dy: Tensor =\n (dy != null) ? convertToTensor(dy, 'dy', 'tf.grad') : null;\n return ENGINE.tidy(() => {\n const {value, grads} = ENGINE.gradients(() => f($x), [$x], $dy);\n if ($dy != null) {\n util.assertShapesMatch(\n value.shape, $dy.shape,\n 'The shape of dy passed in grad(f)(x, dy) must match the shape ' +\n 'returned by f(x)');\n }\n checkGrads(grads);\n return grads[0];\n });\n };\n}\n\n/**\n * Provided `f(x1, x2,...)`, returns another function `g([x1, x2,...], dy?)`,\n * which gives an array of gradients of `f()` with respect to each input\n * [`x1`,`x2`,...].\n *\n * If `dy` is passed when calling `g()`, the gradient of\n * `f(x1,...).mul(dy).sum()` with respect to each input is computed instead.\n * The provided `f` must take one or more tensors and return a single tensor\n * `y`. If `f()` takes a single input, we recommend using `tf.grad` instead.\n *\n * ```js\n * // f(a, b) = a * b\n * const f = (a, b) => a.mul(b);\n * // df / da = b, df / db = a\n * const g = tf.grads(f);\n *\n * const a = tf.tensor1d([2, 3]);\n * const b = tf.tensor1d([-2, -3]);\n * const [da, db] = g([a, b]);\n * console.log('da');\n * da.print();\n * console.log('db');\n * db.print();\n * ```\n *\n * @param f The function `f(x1, x2,...)` to compute gradients for.\n *\n * @doc {heading: 'Training', subheading: 'Gradients'}\n */\nfunction grads(f: (...args: Tensor[]) => Tensor): (\n args: Array, dy?: Tensor|TensorLike) => Tensor[] {\n util.assert(\n util.isFunction(f), () => 'The f passed in grads(f) must be a function');\n return (args: Array, dy?: Tensor|TensorLike): Tensor[] => {\n util.assert(\n Array.isArray(args),\n () => 'The args passed in grads(f)(args) must be an array ' +\n 'of `Tensor`s or `TensorLike`s');\n // args can be of any dtype, thus null as the last argument.\n const $args =\n convertToTensorArray(args, 'args', 'tf.grads', 'string_or_numeric');\n const $dy: Tensor =\n (dy != null) ? convertToTensor(dy, 'dy', 'tf.grads') : null;\n return ENGINE.tidy(() => {\n const {value, grads} = ENGINE.gradients(() => f(...$args), $args, $dy);\n if ($dy != null) {\n util.assertShapesMatch(\n value.shape, $dy.shape,\n 'The shape of dy passed in grads(f)([x1,...], dy) must ' +\n 'match the shape returned by f([x1,...])');\n }\n checkGrads(grads);\n return grads;\n });\n };\n}\n\n/**\n * Like `tf.grad`, but also returns the value of `f()`. Useful when `f()`\n * returns a metric you want to show.\n *\n * The result is a rich object with the following properties:\n * - grad: The gradient of `f(x)` w.r.t. `x` (result of `tf.grad`).\n * - value: The value returned by `f(x)`.\n *\n * ```js\n * // f(x) = x ^ 2\n * const f = x => x.square();\n * // f'(x) = 2x\n * const g = tf.valueAndGrad(f);\n *\n * const x = tf.tensor1d([2, 3]);\n * const {value, grad} = g(x);\n *\n * console.log('value');\n * value.print();\n * console.log('grad');\n * grad.print();\n * ```\n *\n * @doc {heading: 'Training', subheading: 'Gradients'}\n */\nfunction valueAndGrad(f: (x: I) => O): (\n x: I, dy?: O) => {\n value: O;\n grad: I;\n} {\n util.assert(\n util.isFunction(f),\n () => 'The f passed in valueAndGrad(f) must be a function');\n return (x: I, dy?: O) => {\n util.assert(\n x instanceof Tensor,\n () => 'The x passed in valueAndGrad(f)(x) must be a tensor');\n util.assert(\n dy == null || dy instanceof Tensor,\n () => 'The dy passed in valueAndGrad(f)(x, dy) must be a tensor');\n const {grads, value} = ENGINE.gradients(() => f(x), [x], dy);\n checkGrads(grads);\n return {grad: grads[0] as I, value};\n };\n}\n\n/**\n * Like `tf.grads`, but returns also the value of `f()`. Useful when `f()`\n * returns a metric you want to show.\n *\n * The result is a rich object with the following properties:\n * - grads: The gradients of `f()` w.r.t. each input (result of `tf.grads`).\n * - value: The value returned by `f(x)`.\n *\n * ```js\n * // f(a, b) = a * b\n * const f = (a, b) => a.mul(b);\n * // df/da = b, df/db = a\n * const g = tf.valueAndGrads(f);\n *\n * const a = tf.tensor1d([2, 3]);\n * const b = tf.tensor1d([-2, -3]);\n * const {value, grads} = g([a, b]);\n *\n * const [da, db] = grads;\n *\n * console.log('value');\n * value.print();\n *\n * console.log('da');\n * da.print();\n * console.log('db');\n * db.print();\n * ```\n *\n * @doc {heading: 'Training', subheading: 'Gradients'}\n */\nfunction valueAndGrads(f: (...args: Tensor[]) => O): (\n args: Tensor[], dy?: O) => {\n grads: Tensor[];\n value: O;\n} {\n util.assert(\n util.isFunction(f),\n () => 'The f passed in valueAndGrads(f) must be a function');\n return (args: Tensor[], dy?: O) => {\n util.assert(\n Array.isArray(args) && args.every(arg => arg instanceof Tensor),\n () => 'The args passed in valueAndGrads(f)(args) must be array of ' +\n 'tensors');\n util.assert(\n dy == null || dy instanceof Tensor,\n () => 'The dy passed in valueAndGrads(f)(args, dy) must be a tensor');\n const res = ENGINE.gradients(() => f(...args), args, dy);\n if (dy != null) {\n util.assertShapesMatch(\n res.value.shape, dy.shape,\n 'The shape of dy passed in valueAndGrads(f)([x1,...], dy) must ' +\n 'match the shape returned by f([x1,...])');\n }\n checkGrads(res.grads);\n return res;\n };\n}\n\n/**\n * Computes and returns the gradient of f(x) with respect to the list of\n * trainable variables provided by `varList`. If no list is provided, it\n * defaults to all trainable variables.\n *\n * ```js\n * const a = tf.variable(tf.tensor1d([3, 4]));\n * const b = tf.variable(tf.tensor1d([5, 6]));\n * const x = tf.tensor1d([1, 2]);\n *\n * // f(a, b) = a * x ^ 2 + b * x\n * const f = () => a.mul(x.square()).add(b.mul(x)).sum();\n * // df/da = x ^ 2, df/db = x\n * const {value, grads} = tf.variableGrads(f);\n *\n * Object.keys(grads).forEach(varName => grads[varName].print());\n * ```\n *\n * @param f The function to execute. f() should return a scalar.\n * @param varList The list of variables to compute the gradients with respect\n * to. Defaults to all trainable variables.\n * @returns An object with the following keys and values:\n * - `value`: The value of the function `f`.\n * - `grads`: A map from the names of the variables to the gradients.\n * If the `varList` argument is provided explicitly and contains a subset of\n * non-trainable variables, this map in the return value will contain keys\n * that map the names of the non-trainable variables to `null`.\n *\n * @doc {heading: 'Training', subheading: 'Gradients'}\n */\nfunction variableGrads(f: () => Scalar, varList?: Variable[]):\n {value: Scalar, grads: NamedTensorMap} {\n util.assert(\n util.isFunction(f),\n () => 'The f passed in variableGrads(f) must be a function');\n util.assert(\n varList == null ||\n Array.isArray(varList) && varList.every(v => v instanceof Variable),\n () =>\n 'The varList passed in variableGrads(f, varList) must be an array ' +\n 'of variables');\n\n const specifiedVarList = varList != null;\n if (!specifiedVarList) {\n // Get all of the trainable variables.\n varList = [];\n for (const varName in ENGINE.registeredVariables) {\n varList.push(ENGINE.registeredVariables[varName]);\n }\n }\n\n const specifiedNonTrainable: Variable[] =\n specifiedVarList ? varList.filter(variable => !variable.trainable) : null;\n\n // Prune non-trainable variables.\n const originalVarCount = varList.length;\n varList = varList.filter(variable => variable.trainable);\n util.assert(\n varList.length > 0,\n () => `variableGrads() expects at least one of the input variables to ` +\n `be trainable, but none of the ${originalVarCount} variables is ` +\n `trainable.`);\n\n const allowNoGradients = true;\n const {value, grads} = ENGINE.gradients(f, varList, null, allowNoGradients);\n\n util.assert(\n grads.some(g => g != null),\n () => 'Cannot find a connection between any variable and the result of ' +\n 'the loss function y=f(x). Please make sure the operations that ' +\n 'use variables are inside the function f passed to minimize().');\n util.assert(\n value.rank === 0,\n () => `The f passed in variableGrads(f) must return a scalar, but it ` +\n `returned a rank-${value.rank} tensor`);\n\n const namedGrads: NamedTensorMap = {};\n varList.forEach((v, i) => {\n if (grads[i] != null) {\n namedGrads[v.name] = grads[i];\n }\n });\n if (specifiedNonTrainable != null) {\n // If varList is explicitly provided and contains non-trainable values,\n // add them to the returned gradients with `null` values.\n specifiedNonTrainable.forEach(v => namedGrads[v.name] = null);\n }\n return {value, grads: namedGrads};\n}\n\n/**\n * Overrides the gradient computation of a function `f`.\n *\n * Takes a function\n * `f(...inputs, save) => {value: Tensor, gradFunc: (dy, saved) => Tensor[]}`\n * and returns another function `g(...inputs)` which takes the same inputs as\n * `f`. When called, `g` returns `f().value`. In backward mode, custom gradients\n * with respect to each input of `f` are computed using `f().gradFunc`.\n *\n * The `save` function passed to `f` should be used for saving tensors needed\n * in the gradient. And the `saved` passed to the `gradFunc` is a\n * `NamedTensorMap`, which contains those saved tensors.\n *\n * ```js\n * const customOp = tf.customGrad((x, save) => {\n * // Save x to make sure it's available later for the gradient.\n * save([x]);\n * // Override gradient of our custom x ^ 2 op to be dy * abs(x);\n * return {\n * value: x.square(),\n * // Note `saved.x` which points to the `x` we saved earlier.\n * gradFunc: (dy, saved) => [dy.mul(saved[0].abs())]\n * };\n * });\n *\n * const x = tf.tensor1d([-1, -2, 3]);\n * const dx = tf.grad(x => customOp(x));\n *\n * console.log(`f(x):`);\n * customOp(x).print();\n * console.log(`f'(x):`);\n * dx(x).print();\n * ```\n *\n * @param f The function to evaluate in forward mode, which should return\n * `{value: Tensor, gradFunc: (dy, saved) => Tensor[]}`, where `gradFunc`\n * returns the custom gradients of `f` with respect to its inputs.\n *\n * @doc {heading: 'Training', subheading: 'Gradients'}\n */\nfunction customGrad(f: CustomGradientFunc):\n (...args: Tensor[]) => T {\n return ENGINE.customGrad(f);\n}\n\nfunction checkGrads(grads: Tensor[]) {\n const numNullGradients = grads.filter(g => g == null).length;\n if (numNullGradients > 0) {\n throw new Error(\n `Cannot compute gradient of y=f(x) with respect to x. Make sure that\n the f you passed encloses all operations that lead from x to y.`);\n }\n}\n\nexport {\n customGrad,\n variableGrads,\n valueAndGrad,\n valueAndGrads,\n grad,\n grads,\n};\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Softplus, SoftplusInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes softplus of the input `tf.Tensor` element-wise: `log(exp(x) + 1)`\n *\n * ```js\n * const x = tf.tensor1d([0, 1, -1, .7]);\n *\n * x.softplus().print(); // or tf.softplus(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction softplus_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'softplus');\n\n const inputs: SoftplusInputs = {x: $x};\n return ENGINE.runKernel(Softplus, inputs as {} as NamedTensorMap);\n}\nexport const softplus = op({softplus_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {customGrad} from '../gradients';\nimport {Tensor} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {mul} from './mul';\nimport {neg} from './neg';\nimport {op} from './operation';\nimport {sigmoid} from './sigmoid';\nimport {softplus} from './softplus';\n\n/**\n * Computes log sigmoid of the input `tf.Tensor` element-wise:\n * `logSigmoid(x)`. For numerical stability, we use `-tf.softplus(-x)`.\n *\n * ```js\n * const x = tf.tensor1d([0, 1, -1, .7]);\n *\n * x.logSigmoid().print(); // or tf.logSigmoid(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction logSigmoid_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'logSigmoid');\n\n // Use a custom gradient to maintain previous implementation.\n // There is no LogSigmoid kernel in TF so we can't use engine.runKernel\n // directly\n const customOp = customGrad((x: Tensor) => {\n // TODO(yassogba) we can remove the chained softplus call here only\n // after backends have modualrized softplus at which point we can call\n // engine runKernel(..., Sotfplus, ...) directly.\n const value = neg(softplus(neg(x)));\n\n const gradFunc = (dy: T) => {\n const derX = mul(dy, sigmoid(neg(x)));\n return derX;\n };\n return {value, gradFunc};\n });\n\n return customOp($x) as T;\n}\nexport const logSigmoid = op({logSigmoid_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Sub, SubInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Subtracts two `tf.Tensor`s element-wise, A - B. Supports broadcasting.\n *\n * ```js\n * const a = tf.tensor1d([10, 20, 30, 40]);\n * const b = tf.tensor1d([1, 2, 3, 4]);\n *\n * a.sub(b).print(); // or tf.sub(a, b)\n * ```\n *\n * ```js\n * // Broadcast subtract a with b.\n * const a = tf.tensor1d([10, 20, 30, 40]);\n * const b = tf.scalar(5);\n *\n * a.sub(b).print(); // or tf.sub(a, b)\n * ```\n * @param a The first `tf.Tensor` to subtract from.\n * @param b The second `tf.Tensor` to be subtracted. Must have the same dtype as\n * `a`.\n *\n * @doc {heading: 'Operations', subheading: 'Arithmetic'}\n */\nfunction sub_(a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n let $a = convertToTensor(a, 'a', 'sub');\n let $b = convertToTensor(b, 'b', 'sub');\n [$a, $b] = makeTypesMatch($a, $b);\n\n const inputs: SubInputs = {a: $a, b: $b};\n\n return ENGINE.runKernel(Sub, inputs as {} as NamedTensorMap);\n}\n\nexport const sub = op({sub_});\n","/**\n * @license\n * Copyright 2020 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {customGrad} from '../gradients';\n\nimport {Tensor} from '../tensor';\nimport {GradSaveFunc} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {cast} from './cast';\nimport {exp} from './exp';\nimport {log} from './log';\nimport {max} from './max';\nimport {mul} from './mul';\nimport {op} from './operation';\nimport {sub} from './sub';\nimport {sum} from './sum';\n\n/**\n * Computes the log softmax.\n *\n * ```js\n * const a = tf.tensor1d([1, 2, 3]);\n *\n * a.logSoftmax().print(); // or tf.logSoftmax(a)\n * ```\n *\n * ```js\n * const a = tf.tensor2d([2, 4, 6, 1, 2, 3], [2, 3]);\n *\n * a.logSoftmax().print(); // or tf.logSoftmax(a)\n * ```\n *\n * @param logits The logits array.\n * @param axis The dimension softmax would be performed on. Defaults to `-1`\n * which indicates the last dimension.\n *\n * @doc {heading: 'Operations', subheading: 'Normalization'}\n */\nfunction logSoftmax_(logits: T|TensorLike, axis = -1): T {\n const $logits = convertToTensor(logits, 'logits', 'logSoftmax');\n\n if (axis === -1) {\n axis = $logits.rank - 1;\n }\n if (axis !== $logits.rank - 1) {\n throw Error(\n 'Log Softmax along a non-last dimension is not yet supported. ' +\n `Logits was rank ${$logits.rank} and axis was ${axis}`);\n }\n\n // const forward: ForwardFunc = (backend, save) => {\n // const keepDims = true;\n // const xMax = max(logits, axis, true);\n // const shifted = sub(logits, xMax);\n // const value =\n // sub(cast(shifted, 'float32'), log(sum(exp(shifted), axis,\n // keepDims)));\n // save([value]);\n // return value;\n // };\n\n // Use a custom gradient for numerical stability.\n const customOp = customGrad((logits: Tensor, save: GradSaveFunc) => {\n const keepDims = true;\n const xMax = max(logits, axis, true);\n const shifted = sub(logits, xMax);\n const value =\n sub(cast(shifted, 'float32'), log(sum(exp(shifted), axis, keepDims)));\n save([value]);\n\n const gradFunc = (dy: Tensor, saved: Tensor[]) => {\n const [value] = saved;\n const keepDims = true;\n const softmax = exp(value);\n return sub(dy, mul(sum(dy, axis, keepDims), softmax));\n };\n return {value, gradFunc};\n });\n\n return customOp($logits) as T;\n\n // TODO Use Engine.runKernel when CPU/WebGL/WASM backends implement this.\n // const inputs: LogSoftmaxInputs = {logits: $logits};\n // const attrs: LogSoftmaxAttrs = {axis};\n // return ENGINE.runKernel(\n // LogSoftmax, inputs as {} as NamedTensorMap,\n // attrs as {} as NamedAttrMap);\n}\n\nexport const logSoftmax = op({logSoftmax_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {parseAxisParam} from '../util';\n\nimport {add} from './add';\nimport {expandShapeToKeepDim} from './axis_util';\nimport {exp} from './exp';\nimport {log} from './log';\nimport {max} from './max';\nimport {op} from './operation';\nimport {reshape} from './reshape';\nimport {sub} from './sub';\nimport {sum} from './sum';\n\n/**\n * Computes the log(sum(exp(elements across the reduction dimensions))).\n *\n * Reduces the input along the dimensions given in `axis`. Unless `keepDims`\n * is true, the rank of the array is reduced by 1 for each entry in `axis`.\n * If `keepDims` is true, the reduced dimensions are retained with length 1.\n * If `axis` has no entries, all dimensions are reduced, and an array with a\n * single element is returned.\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 3]);\n *\n * x.logSumExp().print(); // or tf.logSumExp(x)\n * ```\n *\n * ```js\n * const x = tf.tensor2d([1, 2, 3, 4], [2, 2]);\n *\n * const axis = 1;\n * x.logSumExp(axis).print(); // or tf.logSumExp(a, axis)\n * ```\n * @param x The input tensor.\n * @param axis The dimension(s) to reduce. If null (the default),\n * reduces all dimensions.\n * @param keepDims If true, retains reduced dimensions with length\n * of 1. Defaults to false.\n *\n * @doc {heading: 'Operations', subheading: 'Reduction'}\n */\nfunction logSumExp_(\n x: Tensor|TensorLike, axis: number|number[] = null, keepDims = false): T {\n const $x = convertToTensor(x, 'x', 'logSumExp');\n\n const axes = parseAxisParam(axis, $x.shape);\n const xMax = max($x, axes, true /* keepDims */);\n const a = sub($x, xMax);\n const b = exp(a);\n const c = sum(b, axes);\n const d = log(c);\n const res = add(reshape(xMax, d.shape), d);\n\n if (keepDims) {\n const newShape = expandShapeToKeepDim(res.shape, axes);\n return reshape(res, newShape) as T;\n }\n return res as T;\n}\n\nexport const logSumExp = op({logSumExp_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {LogicalAnd, LogicalAndInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {assertAndGetBroadcastShape} from './broadcast_util';\nimport {op} from './operation';\n\n/**\n * Returns the truth value of `a AND b` element-wise. Supports broadcasting.\n *\n * ```js\n * const a = tf.tensor1d([false, false, true, true], 'bool');\n * const b = tf.tensor1d([false, true, false, true], 'bool');\n *\n * a.logicalAnd(b).print();\n * ```\n *\n * @param a The first input tensor. Must be of dtype bool.\n * @param b The second input tensor. Must be of dtype bool.\n *\n * @doc {heading: 'Operations', subheading: 'Logical'}\n */\nfunction logicalAnd_(\n a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n const $a = convertToTensor(a, 'a', 'logicalAnd', 'bool');\n const $b = convertToTensor(b, 'b', 'logicalAnd', 'bool');\n assertAndGetBroadcastShape($a.shape, $b.shape);\n\n const inputs: LogicalAndInputs = {a: $a, b: $b};\n\n return ENGINE.runKernel(LogicalAnd, inputs as {} as NamedTensorMap);\n}\n\nexport const logicalAnd = op({logicalAnd_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {LogicalNot, LogicalNotInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {op} from './operation';\n\n/**\n * Returns the truth value of `NOT x` element-wise.\n *\n * ```js\n * const a = tf.tensor1d([false, true], 'bool');\n *\n * a.logicalNot().print();\n * ```\n *\n * @param x The input tensor. Must be of dtype 'bool'.\n *\n * @doc {heading: 'Operations', subheading: 'Logical'}\n */\nfunction logicalNot_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'logicalNot', 'bool');\n const inputs: LogicalNotInputs = {x: $x};\n return ENGINE.runKernel(LogicalNot, inputs as {} as NamedTensorMap);\n}\n\nexport const logicalNot = op({logicalNot_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {LogicalOr, LogicalOrInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {assertAndGetBroadcastShape} from './broadcast_util';\nimport {op} from './operation';\n\n/**\n * Returns the truth value of `a OR b` element-wise. Supports broadcasting.\n *\n * ```js\n * const a = tf.tensor1d([false, false, true, true], 'bool');\n * const b = tf.tensor1d([false, true, false, true], 'bool');\n *\n * a.logicalOr(b).print();\n * ```\n * @param a The first input tensor. Must be of dtype bool.\n * @param b The second input tensor. Must be of dtype bool.\n *\n * @doc {heading: 'Operations', subheading: 'Logical'}\n */\nfunction logicalOr_(\n a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n const $a = convertToTensor(a, 'a', 'logicalOr', 'bool');\n const $b = convertToTensor(b, 'b', 'logicalOr', 'bool');\n assertAndGetBroadcastShape($a.shape, $b.shape);\n\n const inputs: LogicalOrInputs = {a: $a, b: $b};\n return ENGINE.runKernel(LogicalOr, inputs as {} as NamedTensorMap);\n}\nexport const logicalOr = op({logicalOr_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {assertAndGetBroadcastShape} from './broadcast_util';\nimport {logicalAnd} from './logical_and';\nimport {logicalNot} from './logical_not';\nimport {logicalOr} from './logical_or';\nimport {op} from './operation';\n\n/**\n * Returns the truth value of `a XOR b` element-wise. Supports broadcasting.\n *\n * ```js\n * const a = tf.tensor1d([false, false, true, true], 'bool');\n * const b = tf.tensor1d([false, true, false, true], 'bool');\n *\n * a.logicalXor(b).print();\n * ```\n *\n * @param a The first input tensor. Must be of dtype bool.\n * @param b The second input tensor. Must be of dtype bool.\n *\n * @doc {heading: 'Operations', subheading: 'Logical'}\n */\nfunction logicalXor_(\n a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n const $a = convertToTensor(a, 'a', 'logicalXor', 'bool');\n const $b = convertToTensor(b, 'b', 'logicalXor', 'bool');\n assertAndGetBroadcastShape($a.shape, $b.shape);\n\n // x ^ y = (x | y) & ~(x & y)\n return logicalAnd(logicalOr(a, b), logicalNot(logicalAnd(a, b)));\n}\n\nexport const logicalXor = op({logicalXor_});\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {SearchSorted, SearchSortedAttrs, SearchSortedInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {sizeFromShape} from '../util_base';\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\nconst INT32_MAX = 2147483648;\n/**\n * Searches for where a value would go in a sorted sequence.\n *\n * This is not a method for checking containment (like javascript in).\n *\n * The typical use case for this operation is \"binning\", \"bucketing\", or\n * \"discretizing\". The values are assigned to bucket-indices based on the edges\n * listed in 'sortedSequence'. This operation returns the bucket-index for each\n * value.\n *\n * The side argument controls which index is returned if a value lands exactly\n * on an edge.\n *\n * The axis is not settable for this operation. It always operates on the\n * innermost dimension (axis=-1). The operation will accept any number of outer\n * dimensions.\n *\n * Note: This operation assumes that 'sortedSequence' is sorted along the\n * innermost axis, maybe using 'sort(..., axis=-1)'. If the sequence is not\n * sorted no error is raised and the content of the returned tensor is not well\n * defined.\n *\n * ```js\n * const edges = tf.tensor1d([-1, 3.3, 9.1, 10.0]);\n * let values = tf.tensor1d([0.0, 4.1, 12.0]);\n * const result1 = tf.searchSorted(edges, values, 'left');\n * result1.print(); // [1, 2, 4]\n *\n * const seq = tf.tensor1d([0, 3, 9, 10, 10]);\n * values = tf.tensor1d([0, 4, 10]);\n * const result2 = tf.searchSorted(seq, values, 'left');\n * result2.print(); // [0, 2, 3]\n * const result3 = tf.searchSorted(seq, values, 'right');\n * result3.print(); // [1, 2, 5]\n *\n * const sortedSequence = tf.tensor2d([[0., 3., 8., 9., 10.],\n * [1., 2., 3., 4., 5.]]);\n * values = tf.tensor2d([[9.8, 2.1, 4.3],\n * [0.1, 6.6, 4.5, ]]);\n * const result4 = tf.searchSorted(sortedSequence, values, 'left');\n * result4.print(); // [[4, 1, 2], [0, 5, 4]]\n * ```\n * @param sortedSequence: N-D. Sorted sequence.\n * @param values: N-D. Search values.\n * @param side: 'left'|'right'. Defaults to 'left'. 'left' corresponds to lower\n * bound and 'right' to upper bound.\n * @return An N-D int32 tensor the size of values containing the result of\n * applying either lower bound or upper bound (depending on side) to each\n * value. The result is not a global index to the entire Tensor, but the\n * index in the last dimension.\n * @doc {heading: 'Operations', subheading: 'Evaluation'}\n */\nfunction searchSorted_(\n sortedSequence: Tensor|TensorLike, values: Tensor|TensorLike,\n side: 'left'|'right' = 'left'): Tensor {\n const $sortedSequence =\n convertToTensor(sortedSequence, 'sortedSequence', 'searchSorted');\n const $values = convertToTensor(values, 'values', 'searchSorted');\n\n const sequenceSize = $sortedSequence.shape[$sortedSequence.shape.length - 1];\n const valuesSize = $values.shape[$values.shape.length - 1];\n const $sortedSequence2D = reshape($sortedSequence, [-1, sequenceSize]);\n const $values2D = reshape($values, [-1, valuesSize]);\n\n if ($sortedSequence2D.rank < 2) {\n throw new Error(`Sorted input argument must be at least 2-dimensional`);\n }\n if ($sortedSequence2D.shape[0] !== $values2D.shape[0]) {\n throw new Error(\n `Leading dimension of 'sortedSequence' and 'values' must match.`);\n }\n if (sizeFromShape($values2D.shape) >= INT32_MAX) {\n throw new Error(`values tensor size must less than ${INT32_MAX}`);\n }\n if ($sortedSequence2D.shape[1] >= INT32_MAX) {\n throw new Error(`trailing dim_size must less than ${\n INT32_MAX} for int32 output type, was ${$sortedSequence2D.shape[1]}`);\n }\n\n const inputs: SearchSortedInputs = {\n sortedSequence: $sortedSequence2D,\n values: $values2D,\n };\n const attrs: SearchSortedAttrs = {side};\n\n return ENGINE.runKernel(SearchSorted, inputs as {}, attrs as {});\n}\n\nexport const searchSorted = op({searchSorted_});\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport {TensorLike} from '../types';\nimport {searchSorted} from './search_sorted';\n\n/**\n * Searches for where a value would go in a sorted sequence.\n *\n * This is not a method for checking containment (like javascript in).\n *\n * The typical use case for this operation is \"binning\", \"bucketing\", or\n * \"discretizing\". The values are assigned to bucket-indices based on the edges\n * listed in 'sortedSequence'. This operation returns the bucket-index for each\n * value.\n *\n * The index returned corresponds to the first edge greater than or equal to the\n * value.\n *\n * The axis is not settable for this operation. It always operates on the\n * innermost dimension (axis=-1). The operation will accept any number of outer\n * dimensions.\n *\n * Note: This operation assumes that 'lowerBound' is sorted along the\n * innermost axis, maybe using 'sort(..., axis=-1)'. If the sequence is not\n * sorted no error is raised and the content of the returned tensor is not well\n * defined.\n *\n * ```js\n * const edges = tf.tensor1d([-1, 3.3, 9.1, 10.0]);\n * let values = tf.tensor1d([0.0, 4.1, 12.0]);\n * const result1 = tf.lowerBound(edges, values);\n * result1.print(); // [1, 2, 4]\n *\n * const seq = tf.tensor1d([0, 3, 9, 10, 10]);\n * values = tf.tensor1d([0, 4, 10]);\n * const result2 = tf.lowerBound(seq, values);\n * result2.print(); // [0, 2, 3]\n *\n * const sortedSequence = tf.tensor2d([[0., 3., 8., 9., 10.],\n * [1., 2., 3., 4., 5.]]);\n * values = tf.tensor2d([[9.8, 2.1, 4.3],\n * [0.1, 6.6, 4.5, ]]);\n * const result3 = tf.lowerBound(sortedSequence, values);\n * result3.print(); // [[4, 1, 2], [0, 5, 4]]\n * ```\n * @param sortedSequence: N-D. Sorted sequence.\n * @param values: N-D. Search values.\n * @return An N-D int32 tensor the size of values containing the result of\n * applying lower bound to each value. The result is not a global index to\n * the entire Tensor, but the index in the last dimension.\n * @doc {heading: 'Operations', subheading: 'Evaluation'}\n */\nexport function lowerBound(\n sortedSequence: Tensor|TensorLike, values: Tensor|TensorLike): Tensor {\n return searchSorted(sortedSequence, values, 'left');\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {MaxPool, MaxPoolAttrs, MaxPoolInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor3D, Tensor4D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport * as conv_util from './conv_util';\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * Computes the 2D max pooling of an image.\n *\n * @param x The input tensor, of rank 4 or rank 3 of shape\n * `[batch, height, width, inChannels]`. If rank 3, batch of 1 is assumed.\n * @param filterSize The filter size: `[filterHeight, filterWidth]`. If\n * `filterSize` is a single number, then `filterHeight == filterWidth`.\n * @param strides The strides of the pooling: `[strideHeight, strideWidth]`. If\n * `strides` is a single number, then `strideHeight == strideWidth`.\n * @param dilations The dilation rates: `[dilationHeight, dilationWidth]`\n * in which we sample input values across the height and width dimensions\n * in dilated pooling. Defaults to `[1, 1]`. If `dilations` is a single\n * number, then `dilationHeight == dilationWidth`. If it is greater than\n * 1, then all values of `strides` must be 1.\n * @param pad The type of padding algorithm.\n * - `same` and stride 1: output will be of same size as input,\n * regardless of filter size.\n * - `valid`: output will be smaller than input if filter is larger\n * than 1x1.\n * - For more info, see this guide:\n * [https://www.tensorflow.org/api_docs/python/tf/nn/convolution](\n * https://www.tensorflow.org/api_docs/python/tf/nn/convolution)\n * @param dimRoundingMode A string from: 'ceil', 'round', 'floor'. If none is\n * provided, it will default to truncate.\n */\nfunction maxPool_(\n x: T|TensorLike, filterSize: [number, number]|number,\n strides: [number, number]|number,\n pad: 'valid'|'same'|number|conv_util.ExplicitPadding,\n dimRoundingMode?: 'floor'|'round'|'ceil'): T {\n const $x = convertToTensor(x, 'x', 'maxPool');\n const dilations = 1;\n\n let x4D = $x as Tensor4D;\n let reshapedTo4D = false;\n if ($x.rank === 3) {\n reshapedTo4D = true;\n x4D = reshape($x, [1, $x.shape[0], $x.shape[1], $x.shape[2]]);\n }\n\n util.assert(\n x4D.rank === 4,\n () => `Error in maxPool: input must be rank 4 but got rank ${x4D.rank}.`);\n util.assert(\n conv_util.eitherStridesOrDilationsAreOne(strides, dilations),\n () => 'Error in maxPool: Either strides or dilations must be 1. ' +\n `Got strides ${strides} and dilations '${dilations}'`);\n conv_util.checkPadOnDimRoundingMode('maxPool', pad, dimRoundingMode);\n const inputs: MaxPoolInputs = {x: x4D};\n const attrs: MaxPoolAttrs = {filterSize, strides, pad, dimRoundingMode};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n const res = ENGINE.runKernel(\n MaxPool, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as T;\n\n if (reshapedTo4D) {\n return reshape(res, [res.shape[1], res.shape[2], res.shape[3]]) as T;\n }\n return res;\n}\n\nexport const maxPool = op({maxPool_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {MaxPool3D, MaxPool3DAttrs, MaxPool3DInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor4D, Tensor5D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {checkPadOnDimRoundingMode} from './conv_util';\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * Computes the 3D max pooling.\n *\n * ```js\n * const x = tf.tensor5d([1, 2, 3, 4, 5, 6, 7, 8], [1, 2, 2, 2, 1]);\n * const result = tf.maxPool3d(x, 2, 1, 'valid');\n * result.print();\n * ```\n *\n * @param x The input tensor, of rank 5 or rank 4 of shape\n * `[batch, depth, height, width, inChannels]`.\n * @param filterSize The filter size:\n * `[filterDepth, filterHeight, filterWidth]`.\n * If `filterSize` is a single number,\n * then `filterDepth == filterHeight == filterWidth`.\n * @param strides The strides of the pooling:\n * `[strideDepth, strideHeight, strideWidth]`.\n * If `strides` is a single number,\n * then `strideDepth == strideHeight == strideWidth`.\n * @param pad The type of padding algorithm.\n * - `same` and stride 1: output will be of same size as input,\n * regardless of filter size.\n * - `valid`: output will be smaller than input if filter is larger\n * than 1*1x1.\n * - For more info, see this guide:\n * [https://www.tensorflow.org/api_docs/python/tf/nn/convolution](\n * https://www.tensorflow.org/api_docs/python/tf/nn/convolution)\n * @param dimRoundingMode A string from: 'ceil', 'round', 'floor'. If none is\n * provided, it will default to truncate.\n * @param dataFormat An optional string from: \"NDHWC\", \"NCDHW\". Defaults to\n * \"NDHWC\". Specify the data format of the input and output data. With the\n * default format \"NDHWC\", the data is stored in the order of: [batch,\n * depth, height, width, channels]. Only \"NDHWC\" is currently supported.\n * @doc {heading: 'Operations', subheading: 'Convolution'}\n */\nfunction maxPool3d_(\n x: T|TensorLike, filterSize: [number, number, number]|number = [1, 1, 1],\n strides: [number, number, number]|number, pad: 'valid'|'same'|number,\n dimRoundingMode?: 'floor'|'round'|'ceil',\n dataFormat: 'NDHWC'|'NCDHW' = 'NDHWC'): T {\n const $x = convertToTensor(x, 'x', 'maxPool3d');\n\n let x5D = $x as Tensor5D;\n let reshapedTo5D = false;\n if ($x.rank === 4) {\n reshapedTo5D = true;\n x5D = reshape($x, [1, $x.shape[0], $x.shape[1], $x.shape[2], $x.shape[3]]);\n }\n\n util.assert(\n x5D.rank === 5,\n () => `Error in maxPool3d: x must be rank 5 but got rank ${x5D.rank}.`);\n util.assert(\n dataFormat === 'NDHWC',\n () => `Error in maxPool3d: Only NDHWC is currently supported, ` +\n `but got dataFormat of ${dataFormat}`);\n checkPadOnDimRoundingMode('maxPool3d', pad, dimRoundingMode);\n const inputs: MaxPool3DInputs = {x: x5D};\n const attrs:\n MaxPool3DAttrs = {filterSize, strides, pad, dimRoundingMode, dataFormat};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n const res = ENGINE.runKernel(\n MaxPool3D, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as T;\n\n if (reshapedTo5D) {\n return reshape(\n res, [res.shape[1], res.shape[2], res.shape[3], res.shape[4]]) as\n T;\n }\n\n return res;\n}\n\nexport const maxPool3d = op({maxPool3d_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {MaxPoolWithArgmax, MaxPoolWithArgmaxAttrs, MaxPoolWithArgmaxInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor, Tensor4D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes the 2D max pooling of an image with Argmax index.\n * The indices in argmax are flattened, so that a maximum value at position `[b,\n * y, x, c]` becomes flattened index: `(y * width + x) * channels + c` if\n * include_batch_in_index is False; `((b * height + y) * width + x) * channels\n * +c` if include_batch_in_index is True.\n *\n * The indices returned are always in `[0, height) x [0, width)` before\n * flattening.\n *\n * @param x The input tensor, of rank 4 or rank 3 of shape\n * `[batch, height, width, inChannels]`. If rank 3, batch of 1 is assumed.\n * @param filterSize The filter size: `[filterHeight, filterWidth]`. If\n * `filterSize` is a single number, then `filterHeight == filterWidth`.\n * @param strides The strides of the pooling: `[strideHeight, strideWidth]`. If\n * `strides` is a single number, then `strideHeight == strideWidth`.\n * @param dataFormat An optional string from: \"NDHWC\", \"NCDHW\". Defaults to\n * \"NDHWC\". Specify the data format of the input and output data. With the\n * default format \"NDHWC\", the data is stored in the order of: [batch,\n * depth, height, width, channels]. Only \"NDHWC\" is currently supported.\n * @param pad The type of padding algorithm.\n * - `same` and stride 1: output will be of same size as input,\n * regardless of filter size.\n * - `valid`: output will be smaller than input if filter is larger\n * than 1x1.\n * - For more info, see this guide:\n * [https://www.tensorflow.org/api_docs/python/tf/nn/convolution](\n * https://www.tensorflow.org/api_docs/python/tf/nn/convolution)\n * @param includeBatchIndex Defaults to False. Whether to include batch\n * dimension in flattened index of argmax.\n *\n * @doc {heading: 'Operations', subheading: 'Convolution'}\n */\nfunction maxPoolWithArgmax_(\n x: T|TensorLike, filterSize: [number, number]|number,\n strides: [number, number]|number, pad: 'valid'|'same'|number,\n includeBatchInIndex = false): NamedTensorMap {\n const $x = convertToTensor(x, 'x', 'maxPoolWithArgmax');\n\n const inputs: MaxPoolWithArgmaxInputs = {x: $x};\n const attrs:\n MaxPoolWithArgmaxAttrs = {filterSize, strides, pad, includeBatchInIndex};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n const result = ENGINE.runKernel(\n MaxPoolWithArgmax, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as Tensor[];\n\n return {result: result[0], indexes: result[1]};\n}\n\nexport const maxPoolWithArgmax = op({maxPoolWithArgmax_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Maximum, MaximumInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {assertAndGetBroadcastShape} from './broadcast_util';\nimport {cast} from './cast';\nimport {op} from './operation';\n\n/**\n * Returns the max of a and b (`a > b ? a : b`) element-wise.\n * Supports broadcasting.\n *\n * We also expose `tf.maximumStrict` which has the same signature as this op and\n * asserts that `a` and `b` are the same shape (does not broadcast).\n *\n * ```js\n * const a = tf.tensor1d([1, 4, 3, 16]);\n * const b = tf.tensor1d([1, 2, 9, 4]);\n *\n * a.maximum(b).print(); // or tf.maximum(a, b)\n * ```\n *\n * ```js\n * // Broadcast maximum a with b.\n * const a = tf.tensor1d([2, 4, 6, 8]);\n * const b = tf.scalar(5);\n *\n * a.maximum(b).print(); // or tf.maximum(a, b)\n * ```\n *\n * @param a The first tensor.\n * @param b The second tensor. Must have the same type as `a`.\n *\n * @doc {heading: 'Operations', subheading: 'Arithmetic'}\n */\nfunction maximum_(\n a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n let $a = convertToTensor(a, 'a', 'maximum');\n let $b = convertToTensor(b, 'b', 'maximum');\n [$a, $b] = makeTypesMatch($a, $b);\n\n if ($a.dtype === 'bool') {\n $a = cast($a, 'int32');\n $b = cast($b, 'int32');\n }\n assertAndGetBroadcastShape($a.shape, $b.shape);\n\n const inputs: MaximumInputs = {a: $a, b: $b};\n\n return ENGINE.runKernel(Maximum, inputs as {} as NamedTensorMap);\n}\n\nexport const maximum = op({maximum_});\n","/**\n * @license\n * Copyright 2020 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Mean, MeanAttrs, MeanInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes the mean of elements across dimensions of a `tf.Tensor`.\n *\n * Reduces `x` along the dimensions given in `axis`. Unless `keepDims` is\n * true, the rank of the `tf.Tensor` is reduced by 1 for each entry in `axis`.\n * If `keepDims` is true, the reduced dimensions are retained with length 1.\n * If `axis` has no entries, all dimensions are reduced, and a `tf.Tensor` with\n * a single element is returned.\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 3]);\n *\n * x.mean().print(); // or tf.mean(a)\n * ```\n *\n * ```js\n * const x = tf.tensor2d([1, 2, 3, 4], [2, 2]);\n *\n * const axis = 1;\n * x.mean(axis).print(); // or tf.mean(x, axis)\n * ```\n *\n * @param x The input tensor.\n * @param axis The dimension(s) to reduce. By default it reduces\n * all dimensions.\n * @param keepDims If true, retains reduced dimensions with size 1.\n *\n * @doc {heading: 'Operations', subheading: 'Reduction'}\n */\nfunction mean_(\n x: Tensor|TensorLike, axis: number|number[] = null, keepDims = false): T {\n const $x = convertToTensor(x, 'x', 'mean');\n\n const inputs: MeanInputs = {x: $x};\n const attrs: MeanAttrs = {axis, keepDims};\n\n return ENGINE.runKernel(\n Mean, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const mean = op({mean_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Tensor} from '../tensor';\nimport {DataType, Rank, ShapeMap} from '../types';\nimport {makeZerosTypedArray, sizeFromShape} from '../util';\n\nimport {complex} from './complex';\n\n/**\n * Creates a `tf.Tensor` with all elements set to 0.\n *\n * ```js\n * tf.zeros([2, 2]).print();\n * ```\n *\n * @param shape An array of integers defining the output tensor shape.\n * @param dtype The type of an element in the resulting tensor. Can\n * be 'float32', 'int32' or 'bool'. Defaults to 'float'.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nexport function zeros(\n shape: ShapeMap[R], dtype: DataType = 'float32'): Tensor {\n if (dtype === 'complex64') {\n const real = zeros(shape, 'float32');\n const imag = zeros(shape, 'float32');\n return complex(real, imag);\n }\n const values = makeZerosTypedArray(sizeFromShape(shape), dtype);\n return ENGINE.makeTensor(values, shape, dtype) as Tensor;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Tensor} from '../tensor';\nimport {DataType, Rank, ShapeMap} from '../types';\nimport {makeOnesTypedArray, sizeFromShape} from '../util';\n\nimport {complex} from './complex';\nimport {zeros} from './zeros';\n\n/**\n * Creates a `tf.Tensor` with all elements set to 1.\n *\n * ```js\n * tf.ones([2, 2]).print();\n * ```\n *\n * @param shape An array of integers defining the output tensor shape.\n * @param dtype The type of an element in the resulting tensor. Defaults to\n * 'float'.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nexport function ones(\n shape: ShapeMap[R], dtype: DataType = 'float32'): Tensor {\n if (dtype === 'complex64') {\n const real = ones(shape, 'float32');\n const imag = zeros(shape, 'float32');\n return complex(real, imag);\n }\n const values = makeOnesTypedArray(sizeFromShape(shape), dtype);\n return ENGINE.makeTensor(values, shape, dtype) as Tensor;\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {matMul} from './mat_mul';\nimport {ones} from './ones';\nimport {reshape} from './reshape';\nimport {Tensor} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {sizeFromShape} from '../util_base';\n\n/**\n * Broadcasts parameters for evaluation on an N-D grid.\n *\n * Given N one-dimensional coordinate arrays `*args`, returns a list `outputs`\n * of N-D coordinate arrays for evaluating expressions on an N-D grid.\n *\n * Notes:\n * `meshgrid` supports cartesian ('xy') and matrix ('ij') indexing conventions.\n * When the `indexing` argument is set to 'xy' (the default), the broadcasting\n * instructions for the first two dimensions are swapped.\n * Examples:\n * Calling `const [X, Y] = meshgrid(x, y)` with the tensors\n *\n * ```javascript\n * const x = [1, 2, 3];\n * const y = [4, 5, 6];\n * const [X, Y] = tf.meshgrid(x, y);\n * // X = [[1, 2, 3],\n * // [1, 2, 3],\n * // [1, 2, 3]]\n * // Y = [[4, 4, 4],\n * // [5, 5, 5],\n * // [6, 6, 6]]\n * ```\n *\n * @param x Tensor with rank geq 1.\n * @param y Tensor with rank geq 1.\n * @param indexing\n *\n * @doc {heading: 'Operations', subheading: 'Slicing and Joining'}\n */\nexport function meshgrid(\n x?: T|TensorLike, y?: T|TensorLike, {indexing = 'xy'} = {}): T[] {\n if (indexing !== 'xy' && indexing !== 'ij') {\n throw new TypeError(\n `${indexing} is not a valid third argument to meshgrid`);\n }\n if (x === undefined) {\n return [];\n }\n let $x = convertToTensor(\n x, 'x', 'meshgrid', x instanceof Tensor ? x.dtype : 'float32');\n\n if (y === undefined) {\n return [$x];\n }\n let $y = convertToTensor(\n y, 'y', 'meshgrid', y instanceof Tensor ? y.dtype : 'float32');\n\n const w = sizeFromShape($x.shape);\n const h = sizeFromShape($y.shape);\n\n if (indexing === 'xy') {\n $x = reshape($x, [1, -1]) as T;\n $y = reshape($y, [-1, 1]) as T;\n return [\n matMul(ones([h, 1], $x.dtype), $x),\n matMul($y, ones([1, w], $y.dtype)),\n ];\n }\n\n $x = reshape($x, [-1, 1]) as T;\n $y = reshape($y, [1, -1]) as T;\n return [\n matMul($x, ones([1, h], $x.dtype)),\n matMul(ones([w, 1], $y.dtype), $y),\n ];\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Minimum, MinimumInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {assertAndGetBroadcastShape} from './broadcast_util';\nimport {cast} from './cast';\nimport {op} from './operation';\n\n/**\n * Returns the min of a and b (`a < b ? a : b`) element-wise.\n * Supports broadcasting.\n *\n * We also expose `minimumStrict` which has the same signature as this op and\n * asserts that `a` and `b` are the same shape (does not broadcast).\n *\n * ```js\n * const a = tf.tensor1d([1, 4, 3, 16]);\n * const b = tf.tensor1d([1, 2, 9, 4]);\n *\n * a.minimum(b).print(); // or tf.minimum(a, b)\n * ```\n *\n * ```js\n * // Broadcast minimum a with b.\n * const a = tf.tensor1d([2, 4, 6, 8]);\n * const b = tf.scalar(5);\n *\n * a.minimum(b).print(); // or tf.minimum(a, b)\n * ```\n *\n * @param a The first tensor.\n * @param b The second tensor. Must have the same type as `a`.\n *\n * @doc {heading: 'Operations', subheading: 'Arithmetic'}\n */\nfunction minimum_(\n a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n let $a = convertToTensor(a, 'a', 'minimum');\n let $b = convertToTensor(b, 'b', 'minimum');\n [$a, $b] = makeTypesMatch($a, $b);\n\n if ($a.dtype === 'bool') {\n $a = cast($a, 'int32');\n $b = cast($b, 'int32');\n }\n\n assertAndGetBroadcastShape($a.shape, $b.shape);\n\n const inputs: MinimumInputs = {a: $a, b: $b};\n\n return ENGINE.runKernel(Minimum, inputs as {} as NamedTensorMap);\n}\n\nexport const minimum = op({minimum_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {MirrorPad, MirrorPadAttrs, MirrorPadInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\n\n/**\n * Pads a `tf.Tensor` using mirror padding.\n *\n * This operation implements the `REFLECT` and `SYMMETRIC` modes of pad.\n *\n * ```js\n * const x = tf.range(0, 9).reshape([1, 1, 3, 3]);\n * x.mirrorPad([[0, 0], [0, 0], [2, 2], [2, 2]], 'reflect').print();\n * ```\n * @param x The tensor to pad.\n * @param paddings An array of length `R` (the rank of the tensor), where\n * each element is a length-2 tuple of ints `[padBefore, padAfter]`,\n * specifying how much to pad along each dimension of the tensor.\n * In \"reflect\" mode, the padded regions do not include the borders,\n * while in \"symmetric\" mode the padded regions do include the borders.\n * For example, if the input is `[1, 2, 3]` and paddings is `[0, 2]`,\n * then the output is `[1, 2, 3, 2, 1]` in \"reflect\" mode, and\n * `[1, 2, 3, 3, 2]` in \"symmetric\" mode.\n * If `mode` is \"reflect\" then both `paddings[D, 0]` and `paddings[D, 1]`\n * must be no greater than `x.shape[D] - 1`. If mode is \"symmetric\"\n * then both `paddings[D, 0]` and `paddings[D, 1]` must be no greater than\n * `x.shape[D]`\n * @param mode String to specify padding mode. Can be `'reflect' | 'symmetric'`\n */\n/** @doc {heading: 'Tensors', subheading: 'Transformations'} */\nfunction mirrorPad_(\n x: T|TensorLike, paddings: Array<[number, number]>,\n mode: 'reflect'|'symmetric'): T {\n util.assert(\n mode === 'reflect' || mode === 'symmetric',\n () => `Invalid mode. Mode must be either reflect or symmetric. ` +\n `Got ${mode}.`);\n\n const $x = convertToTensor(x, 'x', 'mirrorPad');\n if ($x.rank === 0) {\n throw new Error(\n 'mirrorPad(scalar) is not defined. ' +\n 'Pass non-scalar to mirrorPad');\n }\n util.assert(\n paddings.length === $x.rank,\n () => `Padding doesn't match input. Must be ${$x.rank}. ` +\n `Got ${paddings.length}.`);\n const shapeOffset = mode === 'reflect' ? 1 : 0;\n for (let i = 0; i < $x.rank; i++) {\n util.assert(\n paddings[i].length === 2,\n () => `Invalid number of paddings. Must be length of 2 each.`);\n util.assert(\n paddings[i][0] >= 0 && paddings[i][0] <= $x.shape[i] - shapeOffset &&\n paddings[i][1] >= 0 && paddings[i][1] <= $x.shape[i] - shapeOffset,\n () => `Padding in dimension ${i} cannot be greater than or equal ` +\n `to ${$x.shape[i] - shapeOffset} or less than 0 for input of ` +\n `shape ${$x.shape}`);\n }\n\n const attrs: MirrorPadAttrs = {paddings, mode};\n const inputs: MirrorPadInputs = {x: $x};\n return ENGINE.runKernel(\n MirrorPad, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const mirrorPad = op({mirrorPad_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Mod, ModInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Returns the mod of a and b element-wise.\n * `floor(x / y) * y + mod(x, y) = x`\n * Supports broadcasting.\n *\n * We also expose `tf.modStrict` which has the same signature as this op and\n * asserts that `a` and `b` are the same shape (does not broadcast).\n *\n * ```js\n * const a = tf.tensor1d([1, 4, 3, 16]);\n * const b = tf.tensor1d([1, 2, 9, 4]);\n *\n * a.mod(b).print(); // or tf.mod(a, b)\n * ```\n *\n * ```js\n * // Broadcast a mod b.\n * const a = tf.tensor1d([2, 4, 6, 8]);\n * const b = tf.scalar(5);\n *\n * a.mod(b).print(); // or tf.mod(a, b)\n * ```\n *\n * @param a The first tensor.\n * @param b The second tensor. Must have the same type as `a`.\n *\n * @doc {heading: 'Operations', subheading: 'Arithmetic'}\n */\nfunction mod_(a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n let $a = convertToTensor(a, 'a', 'mod');\n let $b = convertToTensor(b, 'b', 'mod');\n [$a, $b] = makeTypesMatch($a, $b);\n\n const inputs: ModInputs = {a: $a, b: $b};\n\n return ENGINE.runKernel(Mod, inputs as {} as NamedTensorMap);\n}\n\nexport const mod = op({mod_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {parseAxisParam} from '../util';\n\nimport {expandShapeToKeepDim} from './axis_util';\nimport {cast} from './cast';\nimport {mean} from './mean';\nimport {op} from './operation';\nimport {reshape} from './reshape';\nimport {square} from './square';\nimport {sub} from './sub';\n\n/**\n * Calculates the mean and variance of `x`. The mean and variance are\n * calculated by aggregating the contents of `x` across `axes`. If `x` is\n * 1-D and `axes = [0]` this is just the mean and variance of a vector.\n *\n * @param x The input tensor.\n * @param axis The dimension(s) along with to compute mean and\n * variance. By default it reduces all dimensions.\n * @param keepDims If true, the moments have the same dimensionality as the\n * input.\n * @return An object with two keys: `mean` and `variance`.\n *\n * @doc {heading: 'Operations', subheading: 'Normalization'}\n */\nfunction moments_(\n x: Tensor|TensorLike, axis: number|number[] = null,\n keepDims = false): {mean: Tensor, variance: Tensor} {\n x = convertToTensor(x, 'x', 'moments');\n const axes = parseAxisParam(axis, x.shape);\n const xMean = mean(x, axes, keepDims);\n let keepDimsShape = xMean.shape;\n if (!keepDims) {\n keepDimsShape = expandShapeToKeepDim(xMean.shape, axes);\n }\n const devSquared =\n square(sub(cast(x, 'float32'), reshape(xMean, keepDimsShape)));\n const variance = mean(devSquared, axes, keepDims);\n return {mean: xMean, variance};\n}\n\nexport const moments = op({moments_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor2D} from '../tensor';\nimport {convertToTensor, convertToTensorArray} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {op} from './operation';\n\n/**\n * @docalias (data: Tensor2D, c: Tensor2D, h: Tensor2D): [Tensor2D, Tensor2D]\n */\nexport type LSTMCellFunc = {\n (data: Tensor2D, c: Tensor2D, h: Tensor2D): [Tensor2D, Tensor2D];\n};\n\n/**\n * Computes the next states and outputs of a stack of LSTMCells.\n *\n * Each cell output is used as input to the next cell.\n *\n * Returns `[cellState, cellOutput]`.\n *\n * Derived from tf.contrib.rn.MultiRNNCell.\n *\n * @param lstmCells Array of LSTMCell functions.\n * @param data The input to the cell.\n * @param c Array of previous cell states.\n * @param h Array of previous cell outputs.\n *\n * @doc {heading: 'Operations', subheading: 'RNN'}\n */\nfunction multiRNNCell_(\n lstmCells: LSTMCellFunc[], data: Tensor2D|TensorLike,\n c: Array,\n h: Array): [Tensor2D[], Tensor2D[]] {\n const $data = convertToTensor(data, 'data', 'multiRNNCell');\n const $c = convertToTensorArray(c, 'c', 'multiRNNCell');\n const $h = convertToTensorArray(h, 'h', 'multiRNNCell');\n\n let input = $data;\n const newStates = [];\n for (let i = 0; i < lstmCells.length; i++) {\n const output = lstmCells[i](input, $c[i], $h[i]);\n newStates.push(output[0]);\n newStates.push(output[1]);\n input = output[1];\n }\n const newC: Tensor2D[] = [];\n const newH: Tensor2D[] = [];\n for (let i = 0; i < newStates.length; i += 2) {\n newC.push(newStates[i]);\n newH.push(newStates[i + 1]);\n }\n return [newC, newH];\n}\nexport const multiRNNCell = op({multiRNNCell_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Multinomial, MultinomialAttrs, MultinomialInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor1D, Tensor2D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * Creates a `tf.Tensor` with values drawn from a multinomial distribution.\n *\n * ```js\n * const probs = tf.tensor([.75, .25]);\n * tf.multinomial(probs, 3).print();\n * ```\n *\n * @param logits 1D array with unnormalized log-probabilities, or\n * 2D array of shape `[batchSize, numOutcomes]`. See the `normalized`\n * parameter.\n * @param numSamples Number of samples to draw for each row slice.\n * @param seed The seed number.\n * @param normalized Whether the provided `logits` are normalized true\n * probabilities (sum to 1). Defaults to false.\n * @return 1D array of shape `[numSamples]`, or 2D array of shape\n * `[batchSize, numSamples]`, depending on the rank of the input.\n *\n * @doc {heading: 'Tensors', subheading: 'Random'}\n */\nfunction multinomial_(\n logits: Tensor1D|Tensor2D|TensorLike, numSamples: number, seed?: number,\n normalized = false): Tensor1D|Tensor2D {\n const $logits = convertToTensor(logits, 'logits', 'multinomial');\n const numOutcomes = $logits.size;\n const origRank = $logits.rank;\n if (numOutcomes < 2) {\n throw new Error(\n `Error in multinomial: you need at least 2 outcomes, but got ` +\n `${numOutcomes}.`);\n }\n if (origRank > 2) {\n throw new Error(`Rank of probabilities must be 1 or 2, but is ${origRank}`);\n }\n // TODO(lina128): Investigate correct seed behavior. The code seems not allow\n // setting see to 0.\n seed = seed || Math.random();\n\n // The kernel only accepts (and returns) rank 2 tensors.\n const logits2D: Tensor2D =\n origRank === 1 ? reshape($logits, [1, -1]) : $logits as Tensor2D;\n\n const inputs: MultinomialInputs = {logits: logits2D};\n const attrs: MultinomialAttrs = {numSamples, seed, normalized};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n const res = ENGINE.runKernel(\n Multinomial, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as Tensor2D;\n\n // tslint:disable-next-line:no-unnecessary-type-assertion\n return origRank === 1 ? reshape(res, [res.size]) as Tensor1D : res;\n}\n\nexport const multinomial = op({multinomial_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {NotEqual, NotEqualInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {assertAndGetBroadcastShape} from './broadcast_util';\nimport {op} from './operation';\n\n/**\n * Returns the truth value of (a != b) element-wise. Supports broadcasting.\n *\n * ```js\n * const a = tf.tensor1d([1, 2, 3]);\n * const b = tf.tensor1d([0, 2, 3]);\n *\n * a.notEqual(b).print();\n * ```\n * @param a The first input tensor.\n * @param b The second input tensor. Must have the same dtype as `a`.\n *\n * @doc {heading: 'Operations', subheading: 'Logical'}\n */\nfunction notEqual_(\n a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n let $a = convertToTensor(a, 'a', 'notEqual', 'string_or_numeric');\n let $b = convertToTensor(b, 'b', 'notEqual', 'string_or_numeric');\n [$a, $b] = makeTypesMatch($a, $b);\n\n assertAndGetBroadcastShape($a.shape, $b.shape);\n\n const inputs: NotEqualInputs = {a: $a, b: $b};\n\n return ENGINE.runKernel(NotEqual, inputs as {} as NamedTensorMap);\n}\n\nexport const notEqual = op({notEqual_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {OnesLike, OnesLikeInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Creates a `tf.Tensor` with all elements set to 1 with the same shape as the\n * given tensor.\n *\n * ```js\n * const x = tf.tensor([1, 2]);\n * tf.onesLike(x).print();\n * ```\n * @param x A tensor.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nfunction onesLike_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'onesLike');\n\n const inputs: OnesLikeInputs = {x: $x};\n return ENGINE.runKernel(OnesLike, inputs as {} as NamedTensorMap);\n}\n\nexport const onesLike = op({onesLike_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor1D, Tensor2D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {matMul} from './mat_mul';\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * Computes the outer product of two vectors, `v1` and `v2`.\n *\n * ```js\n * const a = tf.tensor1d([1, 2, 3]);\n * const b = tf.tensor1d([3, 4, 5]);\n *\n * tf.outerProduct(a, b).print();\n * ```\n * @param v1 The first vector in the outer product operation.\n * @param v2 The second vector in the outer product operation.\n *\n * @doc {heading: 'Operations', subheading: 'Matrices'}\n */\nfunction outerProduct_(\n v1: Tensor1D|TensorLike, v2: Tensor1D|TensorLike): Tensor2D {\n const $v1 = convertToTensor(v1, 'v1', 'outerProduct');\n const $v2 = convertToTensor(v2, 'v2', 'outerProduct');\n\n util.assert(\n $v1.rank === 1 && $v2.rank === 1,\n () => `Error in outerProduct: inputs must be rank 1, but got ranks ` +\n `${$v1.rank} and ${$v2.rank}.`);\n\n const v12D = reshape($v1, [-1, 1]);\n const v22D = reshape($v2, [1, -1]);\n return matMul(v12D, v22D);\n}\n\nexport const outerProduct = op({outerProduct_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {PadV2, PadV2Attrs, PadV2Inputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Pads a `tf.Tensor` with a given value and paddings.\n *\n * This operation implements `CONSTANT` mode. For `REFLECT` and `SYMMETRIC`,\n * refer to `tf.mirrorPad`.\n *\n * Also available are stricter rank-specific methods with the same signature\n * as this method that assert that `paddings` is of given length.\n * - `tf.pad1d`\n * - `tf.pad2d`\n * - `tf.pad3d`\n * - `tf.pad4d`\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 3, 4]);\n * x.pad([[1, 2]]).print();\n * ```\n * @param x The tensor to pad.\n * @param paddings An array of length `R` (the rank of the tensor), where\n * each element is a length-2 tuple of ints `[padBefore, padAfter]`,\n * specifying how much to pad along each dimension of the tensor.\n * @param constantValue The pad value to use. Defaults to 0.\n *\n * @doc {heading: 'Tensors', subheading: 'Transformations'}\n */\nfunction pad_(\n x: T|TensorLike, paddings: Array<[number, number]>, constantValue = 0): T {\n const $x = convertToTensor(x, 'x', 'pad');\n if ($x.rank === 0) {\n throw new Error('pad(scalar) is not defined. Pass non-scalar to pad');\n }\n\n const attrs: PadV2Attrs = {paddings, constantValue};\n const inputs: PadV2Inputs = {x: $x};\n return ENGINE.runKernel(\n PadV2, inputs as unknown as NamedTensorMap,\n attrs as unknown as NamedAttrMap);\n}\n\nexport const pad = op({pad_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor1D} from '../tensor';\nimport {TensorLike} from '../types';\nimport {assert} from '../util';\nimport {op} from './operation';\nimport {pad} from './pad';\n\n/**\n * Pads a `tf.Tensor1D` with a given value and paddings. See `pad` for details.\n */\nfunction pad1d_(\n x: Tensor1D|TensorLike, paddings: [number, number],\n constantValue = 0): Tensor1D {\n assert(\n paddings.length === 2,\n () => 'Invalid number of paddings. Must be length of 2.');\n return pad(x, [paddings], constantValue);\n}\n\nexport const pad1d = op({pad1d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor2D} from '../tensor';\nimport {TensorLike} from '../types';\nimport {assert} from '../util';\nimport {op} from './operation';\nimport {pad} from './pad';\n\n/**\n * Pads a `tf.Tensor2D` with a given value and paddings. See `pad` for details.\n */\nfunction pad2d_(\n x: Tensor2D|TensorLike, paddings: [[number, number], [number, number]],\n constantValue = 0): Tensor2D {\n assert(\n paddings.length === 2 && paddings[0].length === 2 &&\n paddings[1].length === 2,\n () => 'Invalid number of paddings. Must be length of 2 each.');\n return pad(x, paddings, constantValue);\n}\n\nexport const pad2d = op({pad2d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor3D} from '../tensor';\nimport {TensorLike} from '../types';\nimport {assert} from '../util';\nimport {op} from './operation';\nimport {pad} from './pad';\n\n/**\n * Pads a `tf.Tensor3D` with a given value and paddings. See `pad` for details.\n */\nfunction pad3d_(\n x: Tensor3D|TensorLike,\n paddings: [[number, number], [number, number], [number, number]],\n constantValue = 0): Tensor3D {\n assert(\n paddings.length === 3 && paddings[0].length === 2 &&\n paddings[1].length === 2 && paddings[2].length === 2,\n () => 'Invalid number of paddings. Must be length of 2 each.');\n return pad(x, paddings, constantValue);\n}\n\nexport const pad3d = op({pad3d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor4D} from '../tensor';\nimport {TensorLike} from '../types';\nimport {assert} from '../util';\nimport {op} from './operation';\nimport {pad} from './pad';\n\n/**\n * Pads a `tf.Tensor4D` with a given value and paddings. See `pad` for details.\n */\nfunction pad4d_(\n x: Tensor4D|TensorLike,\n paddings:\n [\n [number, number], [number, number], [number, number], [number, number]\n ],\n constantValue = 0): Tensor4D {\n assert(\n paddings.length === 4 && paddings[0].length === 2 &&\n paddings[1].length === 2 && paddings[2].length === 2 &&\n paddings[3].length === 2,\n () => 'Invalid number of paddings. Must be length of 2 each.');\n return pad(x, paddings, constantValue);\n}\n\nexport const pad4d = op({pad4d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {SpaceToBatchND, SpaceToBatchNDAttrs, SpaceToBatchNDInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\n\n/**\n * This operation divides \"spatial\" dimensions `[1, ..., M]` of the input into\n * a grid of blocks of shape `blockShape`, and interleaves these blocks with\n * the \"batch\" dimension (0) such that in the output, the spatial\n * dimensions `[1, ..., M]` correspond to the position within the grid,\n * and the batch dimension combines both the position within a spatial block\n * and the original batch position. Prior to division into blocks,\n * the spatial dimensions of the input are optionally zero padded\n * according to `paddings`. See below for a precise description.\n *\n * ```js\n * const x = tf.tensor4d([1, 2, 3, 4], [1, 2, 2, 1]);\n * const blockShape = [2, 2];\n * const paddings = [[0, 0], [0, 0]];\n *\n * x.spaceToBatchND(blockShape, paddings).print();\n * ```\n *\n * @param x A `tf.Tensor`. N-D with `x.shape` = `[batch] + spatialShape +\n * remainingShape`, where spatialShape has `M` dimensions.\n * @param blockShape A 1-D array. Must have shape `[M]`, all values must\n * be >= 1.\n * @param paddings A 2-D array. Must have shape `[M, 2]`, all values must be >=\n * 0. `paddings[i] = [padStart, padEnd]` specifies the amount to zero-pad\n * from input dimension `i + 1`, which corresponds to spatial dimension `i`. It\n * is required that\n * `(inputShape[i + 1] + padStart + padEnd) % blockShape[i] === 0`\n *\n * This operation is equivalent to the following steps:\n *\n * 1. Zero-pad the start and end of dimensions `[1, ..., M]` of the input\n * according to `paddings` to produce `padded` of shape paddedShape.\n *\n * 2. Reshape `padded` to `reshapedPadded` of shape:\n * `[batch] + [paddedShape[1] / blockShape[0], blockShape[0], ...,\n * paddedShape[M] / blockShape[M-1], blockShape[M-1]] + remainingShape`\n *\n * 3. Permute dimensions of `reshapedPadded` to produce `permutedReshapedPadded`\n * of shape: `blockShape + [batch] + [paddedShape[1] / blockShape[0], ...,\n * paddedShape[M] / blockShape[M-1]] + remainingShape`\n *\n * 4. Reshape `permutedReshapedPadded` to flatten `blockShape` into the\n * batch dimension, producing an output tensor of shape:\n * `[batch * prod(blockShape)] + [paddedShape[1] / blockShape[0], ...,\n * paddedShape[M] / blockShape[M-1]] + remainingShape`\n *\n * @doc {heading: 'Tensors', subheading: 'Transformations'}\n */\nfunction spaceToBatchND_(\n x: T|TensorLike, blockShape: number[], paddings: number[][]): T {\n const $x = convertToTensor(x, 'x', 'spaceToBatchND');\n\n util.assert(\n $x.rank >= 1 + blockShape.length,\n () => `input rank ${$x.rank} should be > than [blockShape] ${\n blockShape.length}`);\n\n util.assert(\n paddings.length === blockShape.length,\n () => `paddings.shape[0] ${\n paddings.length} must be equal to [blockShape] ${blockShape.length}`);\n\n util.assert(\n $x.shape.reduce(\n (a, b, i) => {\n if (i > 0 && i <= blockShape.length) {\n return a &&\n ((b + paddings[i - 1][0] + paddings[i - 1][1]) %\n blockShape[i - 1] ===\n 0);\n }\n return a;\n },\n true),\n () => `input spatial dimensions ${$x.shape.slice(1)} with paddings ${\n paddings.toString()} must be divisible by blockShapes ${\n blockShape.toString()}`);\n\n const inputs: SpaceToBatchNDInputs = {x: $x};\n const attrs: SpaceToBatchNDAttrs = {blockShape, paddings};\n\n return ENGINE.runKernel(\n SpaceToBatchND, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap);\n}\n\nexport const spaceToBatchND = op({spaceToBatchND_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor3D, Tensor4D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {avgPool} from './avg_pool';\nimport {batchToSpaceND} from './batch_to_space_nd';\nimport * as conv_util from './conv_util';\nimport {maxPool} from './max_pool';\nimport {op} from './operation';\nimport {reshape} from './reshape';\nimport {spaceToBatchND} from './space_to_batch_nd';\n\n/**\n * Performs an N-D pooling operation\n *\n * @param input The input tensor, of rank 4 or rank 3 of shape\n * `[batch, height, width, inChannels]`. If rank 3, batch of 1 is assumed.\n * @param windowShape The filter size: `[filterHeight, filterWidth]`. If\n * `filterSize` is a single number, then `filterHeight == filterWidth`.\n * @param poolingType The type of pooling, either 'max' or 'avg'.\n * @param pad The type of padding algorithm:\n * - `same` and stride 1: output will be of same size as input,\n * regardless of filter size.\n * - `valid`: output will be smaller than input if filter is larger\n * than 1x1.\n * - For more info, see this guide:\n * [https://www.tensorflow.org/api_guides/python/nn#Convolution](\n * https://www.tensorflow.org/api_guides/python/nn#Convolution)\n * @param dilations The dilation rates: `[dilationHeight, dilationWidth]`\n * in which we sample input values across the height and width dimensions\n * in dilated pooling. Defaults to `[1, 1]`. If `dilationRate` is a single\n * number, then `dilationHeight == dilationWidth`. If it is greater than\n * 1, then all values of `strides` must be 1.\n * @param strides The strides of the pooling: `[strideHeight, strideWidth]`. If\n * `strides` is a single number, then `strideHeight == strideWidth`.\n * @param dimRoundingMode A string from: 'ceil', 'round', 'floor'. If none is\n * provided, it will default to truncate.\n *\n * @doc {heading: 'Operations', subheading: 'Convolution'}\n */\nfunction pool_(\n input: T|TensorLike, windowShape: [number, number]|number,\n poolingType: 'avg'|'max',\n pad: 'valid'|'same'|number|conv_util.ExplicitPadding,\n dilations?: [number, number]|number, strides?: [number, number]|number,\n dimRoundingMode?: 'floor'|'round'|'ceil') {\n if (dilations == null) {\n dilations = [1, 1];\n }\n if (strides == null) {\n strides = 1;\n }\n if (pad === 0) {\n pad = 'valid';\n }\n\n const $x = convertToTensor(input, 'x', 'maxPool');\n let x4D = $x as Tensor4D;\n let reshapedTo4D = false;\n\n if ($x.rank === 3) {\n reshapedTo4D = true;\n x4D = reshape($x, [1, $x.shape[0], $x.shape[1], $x.shape[2]]);\n }\n\n util.assert(\n conv_util.eitherStridesOrDilationsAreOne(strides, dilations),\n () => 'Error in pool: Either strides or dilations must be 1. ' +\n `Got strides ${strides} and dilations '${dilations}'`);\n\n const convInfo = conv_util.computePool2DInfo(\n x4D.shape, windowShape, strides, dilations, pad);\n const dilation: [number, number] =\n [convInfo.dilationHeight, convInfo.dilationWidth];\n\n // The following implementation does batchToSpace(pool(spaceToBatch(x)))\n // whenever dilation > 1 since the TF kernels do not support dilation > 1.\n // tslint:disable-next-line:max-line-length\n // https://github.com/tensorflow/tensorflow/blob/50f6bb67dc98c9b74630b6047aae7a4f8a40fd02/tensorflow/python/ops/nn_ops.py#L1037\n\n let basePadding: number[][];\n if (pad === 'same') {\n basePadding = withSpaceToBatchBasePaddings(\n [convInfo.filterHeight, convInfo.filterWidth], dilation);\n } else {\n basePadding = [[0, 0], [0, 0]];\n }\n\n const isDilationOne = dilation[0] === 1 && dilation[1] === 1;\n const [adjustedPadding, adjustedCrops] = requiredSpaceToBatchPaddings(\n [convInfo.inHeight, convInfo.inWidth], dilation, basePadding);\n const convertedPad = isDilationOne ? pad : 'valid';\n const convertedX =\n isDilationOne ? x4D : spaceToBatchND(x4D, dilation, adjustedPadding);\n\n const forwardOp = poolingType === 'avg' ?\n () => avgPool(convertedX, windowShape, strides, convertedPad,\n dimRoundingMode) :\n () => maxPool(convertedX, windowShape, strides, convertedPad,\n dimRoundingMode);\n const y = forwardOp();\n\n const res = isDilationOne ? y : batchToSpaceND(y, dilation, adjustedCrops);\n\n if (reshapedTo4D) {\n return reshape(res, [res.shape[1], res.shape[2], res.shape[3]]) as T;\n }\n\n return res as T;\n}\n\n// Helper function to compute crops and paddings for pool with dilation > 1.\n// tslint:disable-next-line:max-line-length\n// https://github.com/tensorflow/tensorflow/blob/50f6bb67dc98c9b74630b6047aae7a4f8a40fd02/tensorflow/python/ops/array_ops.py#L2184\nfunction requiredSpaceToBatchPaddings(\n inputShape: [number, number], blockShape: [number, number],\n basePadding: number[][]) {\n const padStart = basePadding.map(b => b[0]);\n const origPadEnd = basePadding.map(b => b[1]);\n const fullInputShape = inputShape.concat(padStart, origPadEnd);\n const padEndExtra = blockShape.map((b, i) => (b - fullInputShape[i] % b) % b);\n const padEnd = origPadEnd.map((s, i) => s + padEndExtra[i]);\n const paddings = blockShape.map((_, i) => [padStart[i], padEnd[i]]);\n const crops = blockShape.map((_, i) => [0, padEndExtra[i]]);\n return [paddings, crops];\n}\n\n// Helper function to compute base paddings for pool with dilation > 1.\n// tslint:disable-next-line:max-line-length\n// https://github.com/tensorflow/tensorflow/blob/50f6bb67dc98c9b74630b6047aae7a4f8a40fd02/tensorflow/python/ops/nn_ops.py#L524\nfunction withSpaceToBatchBasePaddings(\n filterShape: [number, number], dilation: [number, number]) {\n // Spatial dimensions of the filters and the upsampled filters in which we\n // introduce (rate - 1) zeros between consecutive filter values.\n const dilatedFilterShape = filterShape.map((s, i) => {\n return s + (s - 1) * (dilation[i] - 1);\n });\n const padExtraShape = dilatedFilterShape.map(s => s - 1);\n\n // When padding is odd, we pad more at end, following the same\n // convention as conv2d.\n const padExtraStart = padExtraShape.map(s => Math.floor(s / 2));\n const padExtraEnd = padExtraShape.map((s, i) => s - padExtraStart[i]);\n return padExtraShape.map((_, i) => {\n return [padExtraStart[i], padExtraEnd[i]];\n });\n}\n\nexport const pool = op({pool_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Prelu, PreluInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes leaky rectified linear element-wise with parametric alphas.\n *\n * `x < 0 ? alpha * x : f(x) = x`\n *\n * ```js\n * const x = tf.tensor1d([-1, 2, -3, 4]);\n * const alpha = tf.scalar(0.1);\n *\n * x.prelu(alpha).print(); // or tf.prelu(x, alpha)\n * ```\n * @param x The input tensor.\n * @param alpha Scaling factor for negative values.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction prelu_(x: T|TensorLike, alpha: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'prelu');\n const $alpha = convertToTensor(alpha, 'alpha', 'prelu');\n\n const inputs: PreluInputs = {x: $x, alpha: $alpha};\n return ENGINE.runKernel(Prelu, inputs as {} as NamedTensorMap);\n}\n\nexport const prelu = op({prelu_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Prod, ProdAttrs, ProdInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {cast} from './cast';\nimport {op} from './operation';\n\n/**\n * Computes the product of elements across dimensions of a `tf.Tensor`.\n *\n * Reduces the input along the dimensions given in `axes`. Unless `keepDims`\n * is true, the rank of the `tf.Tensor` is reduced by 1 for each entry in\n * `axes`. If `keepDims` is true, the reduced dimensions are retained with\n * length 1. If `axes` has no entries, all dimensions are reduced, and a\n * `tf.Tensor` with a single element is returned.\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 3]);\n *\n * x.prod().print(); // or tf.prod(x)\n * ```\n *\n * ```js\n * const x = tf.tensor2d([1, 2, 3, 4], [2, 2]);\n *\n * const axis = 1;\n * x.prod(axis).print(); // or tf.prod(x, axis)\n * ```\n *\n * @param x The input tensor to compute the product over. If the dtype is `bool`\n * it will be converted to `int32` and the output dtype will be `int32`.\n * @param axis The dimension(s) to reduce. By default it reduces\n * all dimensions.\n * @param keepDims If true, retains reduced dimensions with size 1.\n *\n * @doc {heading: 'Operations', subheading: 'Reduction'}\n */\nfunction prod_(\n x: Tensor|TensorLike, axis: number|number[] = null, keepDims = false): T {\n let $x = convertToTensor(x, 'x', 'prod');\n\n if ($x.dtype === 'bool') {\n // bool is not an allowed type for the underlying kernel.\n $x = cast($x, 'int32');\n }\n\n const inputs: ProdInputs = {x: $x};\n const attrs: ProdAttrs = {axis, keepDims};\n\n return ENGINE.runKernel(\n Prod, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const prod = op({prod_});\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {RaggedGather, RaggedGatherAttrs, RaggedGatherInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {op} from './operation';\n\n/**\n * Gather ragged slices from params axis 0 according to indices.\n *\n * @param paramsNestedSplits: A list of at least 1 Tensor with type 'int32' The\n * nestedRowSplits tensors that define the row-partitioning for the params\n * RaggedTensor input.\n * @param paramsDenseValues: A Tensor. The flatValues for the params\n * RaggedTensor.\n * @param indices: A Tensor. Must be one of type: int32. Indices in the\n * outermost dimension of params of the values that should be gathered.\n * @param outputRaggedRank: An int that is >= 0. The ragged rank of the output\n * RaggedTensor. outputNestedSplits will contain this number of rowSplits\n * tensors. This value should equal indices.shape.ndims + params.raggedRank\n * - 1.\n * @return A map with the following properties:\n * - outputNestedSplits: A list of outputRaggedRank Tensor objects with the\n * same type as paramsNestedSplits.\n * - outputDenseValues: A Tensor. Has the same type as paramsDenseValues.\n * @doc {heading: 'Operations', subheading: 'Ragged'}\n */\n\ninterface RaggedGatherMap {\n outputNestedSplits: Tensor[];\n outputDenseValues: Tensor;\n}\n\nfunction raggedGather_(\n paramsNestedSplits: Tensor[], paramsDenseValues: Tensor|TensorLike,\n indices: Tensor|TensorLike, outputRaggedRank: number): RaggedGatherMap {\n const $paramsNestedSplits = paramsNestedSplits.map(\n (t, i) => convertToTensor(t, `tensors${i}`, 'raggedGather', 'int32'));\n const $paramsDenseValues =\n convertToTensor(paramsDenseValues, 'paramsDenseValues', 'raggedGather');\n const $indices = convertToTensor(indices, 'indices', 'raggedGather', 'int32');\n\n const inputs: RaggedGatherInputs = {\n paramsNestedSplits: $paramsNestedSplits,\n paramsDenseValues: $paramsDenseValues,\n indices: $indices,\n };\n const attrs: RaggedGatherAttrs = {outputRaggedRank};\n\n const result: Tensor[] =\n ENGINE.runKernel(RaggedGather, inputs as {}, attrs as {});\n return {\n outputNestedSplits: result.slice(0, result.length - 1),\n outputDenseValues: result[result.length - 1],\n };\n}\n\nexport const raggedGather = op({raggedGather_});\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {RaggedRange, RaggedRangeInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {op} from './operation';\n\n/**\n * Returns a RaggedTensor result composed from rtDenseValues and rtNestedSplits,\n * such that result[i] = [starts[i], starts[i] + deltas[i], ..., limits[i]]).\n *\n * @param starts: A Tensor. Must be one of the following types:\n * 'float32', 'int32'. The starts of each range.\n * @param limits: A Tensor. Must have the same type as starts. The limits of\n * each range.\n * @param deltas: A Tensor. Must have the same type as starts. The deltas of\n * each range.\n * @return A map with the following properties:\n * - rtNestedSplits: A Tensor of type 'int32'.\n * - rtDenseValues: A Tensor. Has the same type as starts.\n */\n\nfunction raggedRange_(\n starts: Tensor|TensorLike, limits: Tensor|TensorLike,\n deltas: Tensor|TensorLike): NamedTensorMap {\n const $starts = convertToTensor(starts, 'starts', 'raggedRange');\n const $limits =\n convertToTensor(limits, 'limits', 'raggedRange', $starts.dtype);\n const $deltas =\n convertToTensor(deltas, 'deltas', 'raggedRange', $starts.dtype);\n\n const inputs: RaggedRangeInputs = {\n starts: $starts,\n limits: $limits,\n deltas: $deltas,\n };\n\n const result: Tensor[] = ENGINE.runKernel(RaggedRange, inputs as {});\n return {\n rtNestedSplits: result[0],\n rtDenseValues: result[1],\n };\n}\n\nexport const raggedRange = op({raggedRange_});\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {RaggedTensorToTensor, RaggedTensorToTensorAttrs, RaggedTensorToTensorInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {op} from './operation';\n\n/**\n * Create a dense tensor from a ragged tensor, possibly altering its shape.\n *\n * The raggedTensorToTensor op creates a dense tensor from am array of row\n * partition tensors, a value vector, and default values. If the shape is\n * unspecified, the minimal shape required to contain all the elements in the\n * ragged tensor (the natural shape) will be used. If some dimensions are left\n * unspecified, then the size of the natural shape is used in that dimension.\n *\n * The defaultValue will be broadcast to the output shape. After that, the\n * values from the ragged tensor overwrite the default values. Note that the\n * defaultValue must have less dimensions than the value.\n *\n * The row partition tensors are in the order of the dimensions. At present, the\n * types can be: \"ROW_SPLITS\": the row_splits tensor from the ragged tensor.\n * \"VALUE_ROWIDS\": the value_rowids tensor from the ragged tensor.\n * \"FIRST_DIM_SIZE\": if value_rowids is used for the first dimension, then it\n * is preceded by \"FIRST_DIM_SIZE\".\n * ```\n * @param shape: A Tensor. Must be one of the following types: 'int32'. The\n * desired shape of the output tensor. If left unspecified (empty), the\n * minimal shape required to contain all the elements in the ragged tensor\n * (the natural shape) will be used. If some dimensions are left\n * unspecified, then the size of the natural shape is used in that\n * dimension.\n *\n * Note that dense dimensions cannot be modified by the shape argument.\n * Trying to change the size of a dense dimension will cause the op to fail.\n * Examples: natural shape: [4, 5, 6] shape: -1 output shape: [4, 5, 6]\n *\n * natural shape: [4, 5, 6] shape: [3, -1, 2] output shape: [3, 5, 2]\n *\n * natural shape: [4, 5, 6] shape: [3, 7, 2] output shape: [3, 7, 2]\n * @param values: A Tensor. A 1D tensor representing the values of the ragged\n * tensor.\n * @param defaultValue: A Tensor. Must have the same type as values. The\n * defaultValue when the shape is larger than the ragged tensor. The\n * defaultValue is broadcast until it is the shape of the output tensor,\n * and then overwritten by values in the ragged tensor. The default value\n * must be compatible with this broadcast operation, and must have fewer\n * dimensions than the value tensor.\n * @param rowPartitionTensors: A list of at least 1 Tensor objects with the same\n * type in: 'int32'.\n * @param rowPartitionTypes: A list of strings. The types of the row partition\n * tensors. At present, these can be:\n * \"ROW_SPLITS\": the row_splits tensor from the ragged tensor.\n * \"VALUE_ROWIDS\": the value_rowids tensor from the ragged tensor.\n * \"FIRST_DIM_SIZE\": if value_rowids is used for the first dimension, then\n * it is preceeded by \"FIRST_DIM_SIZE\". The tensors are in the order of\n * the dimensions.\n * @return A Tensor. Has the same type as values.\n * @doc {heading: 'Operations', subheading: 'Ragged'}\n */\nfunction raggedTensorToTensor_(\n shape: Tensor|TensorLike, values: Tensor|TensorLike,\n defaultValue: Tensor|TensorLike, rowPartitionTensors: Tensor[],\n rowPartitionTypes: string[]): Tensor {\n const $shape =\n convertToTensor(shape, 'shape', 'raggedTensorToTensor', 'int32');\n const $values = convertToTensor(values, 'values', 'raggedTensorToTensor');\n const $defaultValue = convertToTensor(\n defaultValue, 'defaultValue', 'raggedTensorToTensor', $values.dtype);\n const $rowPartitionTensors = rowPartitionTensors.map(\n (t, i) =>\n convertToTensor(t, `tensors${i}`, 'raggedTensorToTensor', 'int32'));\n\n const inputs: RaggedTensorToTensorInputs = {\n shape: $shape,\n values: $values,\n defaultValue: $defaultValue,\n rowPartitionTensors: $rowPartitionTensors\n };\n const attrs: RaggedTensorToTensorAttrs = {rowPartitionTypes};\n\n return ENGINE.runKernel(RaggedTensorToTensor, inputs as {}, attrs as {});\n}\n\nexport const raggedTensorToTensor = op({raggedTensorToTensor_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Tensor} from '../tensor';\nimport {DataType, Rank, ShapeMap} from '../types';\nimport {sizeFromShape} from '../util';\n\nimport {op} from './operation';\n\n/**\n * Creates a `tf.Tensor` with values sampled from a random number generator\n * function defined by the user.\n *\n * @param shape An array of integers defining the output tensor shape.\n * @param randFunction A random number generator function which is called\n * for each element in the output tensor.\n * @param dtype The data type of the output tensor. Defaults to 'float32'.\n *\n * @doc {heading: 'Tensors', subheading: 'Random'}\n */\nfunction rand_(\n shape: ShapeMap[R], randFunction: () => number,\n dtype?: DataType): Tensor {\n const size = sizeFromShape(shape);\n let values = null;\n if (dtype == null || dtype === 'float32') {\n values = new Float32Array(size);\n } else if (dtype === 'int32') {\n values = new Int32Array(size);\n } else if (dtype === 'bool') {\n values = new Uint8Array(size);\n } else {\n throw new Error(`Unknown data type ${dtype}`);\n }\n for (let i = 0; i < size; i++) {\n values[i] = randFunction();\n }\n return ENGINE.makeTensor(values, shape, dtype) as Tensor;\n}\n\nexport const rand = op({rand_});\n","// A port of an algorithm by Johannes Baagøe , 2010\n// http://baagoe.com/en/RandomMusings/javascript/\n// https://github.com/nquinlan/better-random-numbers-for-javascript-mirror\n// Original work is under MIT license -\n\n// Copyright (C) 2010 by Johannes Baagøe \n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n\n\n(function(global, module, define) {\n\nfunction Alea(seed) {\n var me = this, mash = Mash();\n\n me.next = function() {\n var t = 2091639 * me.s0 + me.c * 2.3283064365386963e-10; // 2^-32\n me.s0 = me.s1;\n me.s1 = me.s2;\n return me.s2 = t - (me.c = t | 0);\n };\n\n // Apply the seeding algorithm from Baagoe.\n me.c = 1;\n me.s0 = mash(' ');\n me.s1 = mash(' ');\n me.s2 = mash(' ');\n me.s0 -= mash(seed);\n if (me.s0 < 0) { me.s0 += 1; }\n me.s1 -= mash(seed);\n if (me.s1 < 0) { me.s1 += 1; }\n me.s2 -= mash(seed);\n if (me.s2 < 0) { me.s2 += 1; }\n mash = null;\n}\n\nfunction copy(f, t) {\n t.c = f.c;\n t.s0 = f.s0;\n t.s1 = f.s1;\n t.s2 = f.s2;\n return t;\n}\n\nfunction impl(seed, opts) {\n var xg = new Alea(seed),\n state = opts && opts.state,\n prng = xg.next;\n prng.int32 = function() { return (xg.next() * 0x100000000) | 0; }\n prng.double = function() {\n return prng() + (prng() * 0x200000 | 0) * 1.1102230246251565e-16; // 2^-53\n };\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nfunction Mash() {\n var n = 0xefc8249d;\n\n var mash = function(data) {\n data = String(data);\n for (var i = 0; i < data.length; i++) {\n n += data.charCodeAt(i);\n var h = 0.02519603282416938 * n;\n n = h >>> 0;\n h -= n;\n h *= n;\n n = h >>> 0;\n h -= n;\n n += h * 0x100000000; // 2^32\n }\n return (n >>> 0) * 2.3283064365386963e-10; // 2^-32\n };\n\n return mash;\n}\n\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.alea = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n","// A Javascript implementaion of the \"xor128\" prng algorithm by\n// George Marsaglia. See http://www.jstatsoft.org/v08/i14/paper\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this, strseed = '';\n\n me.x = 0;\n me.y = 0;\n me.z = 0;\n me.w = 0;\n\n // Set up generator function.\n me.next = function() {\n var t = me.x ^ (me.x << 11);\n me.x = me.y;\n me.y = me.z;\n me.z = me.w;\n return me.w ^= (me.w >>> 19) ^ t ^ (t >>> 8);\n };\n\n if (seed === (seed | 0)) {\n // Integer seed.\n me.x = seed;\n } else {\n // String seed.\n strseed += seed;\n }\n\n // Mix in string seed, then discard an initial batch of 64 values.\n for (var k = 0; k < strseed.length + 64; k++) {\n me.x ^= strseed.charCodeAt(k) | 0;\n me.next();\n }\n}\n\nfunction copy(f, t) {\n t.x = f.x;\n t.y = f.y;\n t.z = f.z;\n t.w = f.w;\n return t;\n}\n\nfunction impl(seed, opts) {\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xor128 = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n","// A Javascript implementaion of the \"xorwow\" prng algorithm by\n// George Marsaglia. See http://www.jstatsoft.org/v08/i14/paper\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this, strseed = '';\n\n // Set up generator function.\n me.next = function() {\n var t = (me.x ^ (me.x >>> 2));\n me.x = me.y; me.y = me.z; me.z = me.w; me.w = me.v;\n return (me.d = (me.d + 362437 | 0)) +\n (me.v = (me.v ^ (me.v << 4)) ^ (t ^ (t << 1))) | 0;\n };\n\n me.x = 0;\n me.y = 0;\n me.z = 0;\n me.w = 0;\n me.v = 0;\n\n if (seed === (seed | 0)) {\n // Integer seed.\n me.x = seed;\n } else {\n // String seed.\n strseed += seed;\n }\n\n // Mix in string seed, then discard an initial batch of 64 values.\n for (var k = 0; k < strseed.length + 64; k++) {\n me.x ^= strseed.charCodeAt(k) | 0;\n if (k == strseed.length) {\n me.d = me.x << 10 ^ me.x >>> 4;\n }\n me.next();\n }\n}\n\nfunction copy(f, t) {\n t.x = f.x;\n t.y = f.y;\n t.z = f.z;\n t.w = f.w;\n t.v = f.v;\n t.d = f.d;\n return t;\n}\n\nfunction impl(seed, opts) {\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xorwow = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n","// A Javascript implementaion of the \"xorshift7\" algorithm by\n// François Panneton and Pierre L'ecuyer:\n// \"On the Xorgshift Random Number Generators\"\n// http://saluc.engr.uconn.edu/refs/crypto/rng/panneton05onthexorshift.pdf\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this;\n\n // Set up generator function.\n me.next = function() {\n // Update xor generator.\n var X = me.x, i = me.i, t, v, w;\n t = X[i]; t ^= (t >>> 7); v = t ^ (t << 24);\n t = X[(i + 1) & 7]; v ^= t ^ (t >>> 10);\n t = X[(i + 3) & 7]; v ^= t ^ (t >>> 3);\n t = X[(i + 4) & 7]; v ^= t ^ (t << 7);\n t = X[(i + 7) & 7]; t = t ^ (t << 13); v ^= t ^ (t << 9);\n X[i] = v;\n me.i = (i + 1) & 7;\n return v;\n };\n\n function init(me, seed) {\n var j, w, X = [];\n\n if (seed === (seed | 0)) {\n // Seed state array using a 32-bit integer.\n w = X[0] = seed;\n } else {\n // Seed state using a string.\n seed = '' + seed;\n for (j = 0; j < seed.length; ++j) {\n X[j & 7] = (X[j & 7] << 15) ^\n (seed.charCodeAt(j) + X[(j + 1) & 7] << 13);\n }\n }\n // Enforce an array length of 8, not all zeroes.\n while (X.length < 8) X.push(0);\n for (j = 0; j < 8 && X[j] === 0; ++j);\n if (j == 8) w = X[7] = -1; else w = X[j];\n\n me.x = X;\n me.i = 0;\n\n // Discard an initial 256 values.\n for (j = 256; j > 0; --j) {\n me.next();\n }\n }\n\n init(me, seed);\n}\n\nfunction copy(f, t) {\n t.x = f.x.slice();\n t.i = f.i;\n return t;\n}\n\nfunction impl(seed, opts) {\n if (seed == null) seed = +(new Date);\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (state.x) copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xorshift7 = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n","// A Javascript implementaion of Richard Brent's Xorgens xor4096 algorithm.\n//\n// This fast non-cryptographic random number generator is designed for\n// use in Monte-Carlo algorithms. It combines a long-period xorshift\n// generator with a Weyl generator, and it passes all common batteries\n// of stasticial tests for randomness while consuming only a few nanoseconds\n// for each prng generated. For background on the generator, see Brent's\n// paper: \"Some long-period random number generators using shifts and xors.\"\n// http://arxiv.org/pdf/1004.3115v1.pdf\n//\n// Usage:\n//\n// var xor4096 = require('xor4096');\n// random = xor4096(1); // Seed with int32 or string.\n// assert.equal(random(), 0.1520436450538547); // (0, 1) range, 53 bits.\n// assert.equal(random.int32(), 1806534897); // signed int32, 32 bits.\n//\n// For nonzero numeric keys, this impelementation provides a sequence\n// identical to that by Brent's xorgens 3 implementaion in C. This\n// implementation also provides for initalizing the generator with\n// string seeds, or for saving and restoring the state of the generator.\n//\n// On Chrome, this prng benchmarks about 2.1 times slower than\n// Javascript's built-in Math.random().\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this;\n\n // Set up generator function.\n me.next = function() {\n var w = me.w,\n X = me.X, i = me.i, t, v;\n // Update Weyl generator.\n me.w = w = (w + 0x61c88647) | 0;\n // Update xor generator.\n v = X[(i + 34) & 127];\n t = X[i = ((i + 1) & 127)];\n v ^= v << 13;\n t ^= t << 17;\n v ^= v >>> 15;\n t ^= t >>> 12;\n // Update Xor generator array state.\n v = X[i] = v ^ t;\n me.i = i;\n // Result is the combination.\n return (v + (w ^ (w >>> 16))) | 0;\n };\n\n function init(me, seed) {\n var t, v, i, j, w, X = [], limit = 128;\n if (seed === (seed | 0)) {\n // Numeric seeds initialize v, which is used to generates X.\n v = seed;\n seed = null;\n } else {\n // String seeds are mixed into v and X one character at a time.\n seed = seed + '\\0';\n v = 0;\n limit = Math.max(limit, seed.length);\n }\n // Initialize circular array and weyl value.\n for (i = 0, j = -32; j < limit; ++j) {\n // Put the unicode characters into the array, and shuffle them.\n if (seed) v ^= seed.charCodeAt((j + 32) % seed.length);\n // After 32 shuffles, take v as the starting w value.\n if (j === 0) w = v;\n v ^= v << 10;\n v ^= v >>> 15;\n v ^= v << 4;\n v ^= v >>> 13;\n if (j >= 0) {\n w = (w + 0x61c88647) | 0; // Weyl.\n t = (X[j & 127] ^= (v + w)); // Combine xor and weyl to init array.\n i = (0 == t) ? i + 1 : 0; // Count zeroes.\n }\n }\n // We have detected all zeroes; make the key nonzero.\n if (i >= 128) {\n X[(seed && seed.length || 0) & 127] = -1;\n }\n // Run the generator 512 times to further mix the state before using it.\n // Factoring this as a function slows the main generator, so it is just\n // unrolled here. The weyl generator is not advanced while warming up.\n i = 127;\n for (j = 4 * 128; j > 0; --j) {\n v = X[(i + 34) & 127];\n t = X[i = ((i + 1) & 127)];\n v ^= v << 13;\n t ^= t << 17;\n v ^= v >>> 15;\n t ^= t >>> 12;\n X[i] = v ^ t;\n }\n // Storing state as object members is faster than using closure variables.\n me.w = w;\n me.X = X;\n me.i = i;\n }\n\n init(me, seed);\n}\n\nfunction copy(f, t) {\n t.i = f.i;\n t.w = f.w;\n t.X = f.X.slice();\n return t;\n};\n\nfunction impl(seed, opts) {\n if (seed == null) seed = +(new Date);\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (state.X) copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xor4096 = impl;\n}\n\n})(\n this, // window object or global\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n","// A Javascript implementaion of the \"Tyche-i\" prng algorithm by\n// Samuel Neves and Filipe Araujo.\n// See https://eden.dei.uc.pt/~sneves/pubs/2011-snfa2.pdf\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this, strseed = '';\n\n // Set up generator function.\n me.next = function() {\n var b = me.b, c = me.c, d = me.d, a = me.a;\n b = (b << 25) ^ (b >>> 7) ^ c;\n c = (c - d) | 0;\n d = (d << 24) ^ (d >>> 8) ^ a;\n a = (a - b) | 0;\n me.b = b = (b << 20) ^ (b >>> 12) ^ c;\n me.c = c = (c - d) | 0;\n me.d = (d << 16) ^ (c >>> 16) ^ a;\n return me.a = (a - b) | 0;\n };\n\n /* The following is non-inverted tyche, which has better internal\n * bit diffusion, but which is about 25% slower than tyche-i in JS.\n me.next = function() {\n var a = me.a, b = me.b, c = me.c, d = me.d;\n a = (me.a + me.b | 0) >>> 0;\n d = me.d ^ a; d = d << 16 ^ d >>> 16;\n c = me.c + d | 0;\n b = me.b ^ c; b = b << 12 ^ d >>> 20;\n me.a = a = a + b | 0;\n d = d ^ a; me.d = d = d << 8 ^ d >>> 24;\n me.c = c = c + d | 0;\n b = b ^ c;\n return me.b = (b << 7 ^ b >>> 25);\n }\n */\n\n me.a = 0;\n me.b = 0;\n me.c = 2654435769 | 0;\n me.d = 1367130551;\n\n if (seed === Math.floor(seed)) {\n // Integer seed.\n me.a = (seed / 0x100000000) | 0;\n me.b = seed | 0;\n } else {\n // String seed.\n strseed += seed;\n }\n\n // Mix in string seed, then discard an initial batch of 64 values.\n for (var k = 0; k < strseed.length + 20; k++) {\n me.b ^= strseed.charCodeAt(k) | 0;\n me.next();\n }\n}\n\nfunction copy(f, t) {\n t.a = f.a;\n t.b = f.b;\n t.c = f.c;\n t.d = f.d;\n return t;\n};\n\nfunction impl(seed, opts) {\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.tychei = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n","/*\nCopyright 2019 David Bau.\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n*/\n\n(function (global, pool, math) {\n//\n// The following constants are related to IEEE 754 limits.\n//\n\nvar width = 256, // each RC4 output is 0 <= x < 256\n chunks = 6, // at least six RC4 outputs for each double\n digits = 52, // there are 52 significant digits in a double\n rngname = 'random', // rngname: name for Math.random and Math.seedrandom\n startdenom = math.pow(width, chunks),\n significance = math.pow(2, digits),\n overflow = significance * 2,\n mask = width - 1,\n nodecrypto; // node.js crypto module, initialized at the bottom.\n\n//\n// seedrandom()\n// This is the seedrandom function described above.\n//\nfunction seedrandom(seed, options, callback) {\n var key = [];\n options = (options == true) ? { entropy: true } : (options || {});\n\n // Flatten the seed string or build one from local entropy if needed.\n var shortseed = mixkey(flatten(\n options.entropy ? [seed, tostring(pool)] :\n (seed == null) ? autoseed() : seed, 3), key);\n\n // Use the seed to initialize an ARC4 generator.\n var arc4 = new ARC4(key);\n\n // This function returns a random double in [0, 1) that contains\n // randomness in every bit of the mantissa of the IEEE 754 value.\n var prng = function() {\n var n = arc4.g(chunks), // Start with a numerator n < 2 ^ 48\n d = startdenom, // and denominator d = 2 ^ 48.\n x = 0; // and no 'extra last byte'.\n while (n < significance) { // Fill up all significant digits by\n n = (n + x) * width; // shifting numerator and\n d *= width; // denominator and generating a\n x = arc4.g(1); // new least-significant-byte.\n }\n while (n >= overflow) { // To avoid rounding up, before adding\n n /= 2; // last byte, shift everything\n d /= 2; // right using integer math until\n x >>>= 1; // we have exactly the desired bits.\n }\n return (n + x) / d; // Form the number within [0, 1).\n };\n\n prng.int32 = function() { return arc4.g(4) | 0; }\n prng.quick = function() { return arc4.g(4) / 0x100000000; }\n prng.double = prng;\n\n // Mix the randomness into accumulated entropy.\n mixkey(tostring(arc4.S), pool);\n\n // Calling convention: what to return as a function of prng, seed, is_math.\n return (options.pass || callback ||\n function(prng, seed, is_math_call, state) {\n if (state) {\n // Load the arc4 state from the given state if it has an S array.\n if (state.S) { copy(state, arc4); }\n // Only provide the .state method if requested via options.state.\n prng.state = function() { return copy(arc4, {}); }\n }\n\n // If called as a method of Math (Math.seedrandom()), mutate\n // Math.random because that is how seedrandom.js has worked since v1.0.\n if (is_math_call) { math[rngname] = prng; return seed; }\n\n // Otherwise, it is a newer calling convention, so return the\n // prng directly.\n else return prng;\n })(\n prng,\n shortseed,\n 'global' in options ? options.global : (this == math),\n options.state);\n}\n\n//\n// ARC4\n//\n// An ARC4 implementation. The constructor takes a key in the form of\n// an array of at most (width) integers that should be 0 <= x < (width).\n//\n// The g(count) method returns a pseudorandom integer that concatenates\n// the next (count) outputs from ARC4. Its return value is a number x\n// that is in the range 0 <= x < (width ^ count).\n//\nfunction ARC4(key) {\n var t, keylen = key.length,\n me = this, i = 0, j = me.i = me.j = 0, s = me.S = [];\n\n // The empty key [] is treated as [0].\n if (!keylen) { key = [keylen++]; }\n\n // Set up S using the standard key scheduling algorithm.\n while (i < width) {\n s[i] = i++;\n }\n for (i = 0; i < width; i++) {\n s[i] = s[j = mask & (j + key[i % keylen] + (t = s[i]))];\n s[j] = t;\n }\n\n // The \"g\" method returns the next (count) outputs as one number.\n (me.g = function(count) {\n // Using instance members instead of closure state nearly doubles speed.\n var t, r = 0,\n i = me.i, j = me.j, s = me.S;\n while (count--) {\n t = s[i = mask & (i + 1)];\n r = r * width + s[mask & ((s[i] = s[j = mask & (j + t)]) + (s[j] = t))];\n }\n me.i = i; me.j = j;\n return r;\n // For robust unpredictability, the function call below automatically\n // discards an initial batch of values. This is called RC4-drop[256].\n // See http://google.com/search?q=rsa+fluhrer+response&btnI\n })(width);\n}\n\n//\n// copy()\n// Copies internal state of ARC4 to or from a plain object.\n//\nfunction copy(f, t) {\n t.i = f.i;\n t.j = f.j;\n t.S = f.S.slice();\n return t;\n};\n\n//\n// flatten()\n// Converts an object tree to nested arrays of strings.\n//\nfunction flatten(obj, depth) {\n var result = [], typ = (typeof obj), prop;\n if (depth && typ == 'object') {\n for (prop in obj) {\n try { result.push(flatten(obj[prop], depth - 1)); } catch (e) {}\n }\n }\n return (result.length ? result : typ == 'string' ? obj : obj + '\\0');\n}\n\n//\n// mixkey()\n// Mixes a string seed into a key that is an array of integers, and\n// returns a shortened string seed that is equivalent to the result key.\n//\nfunction mixkey(seed, key) {\n var stringseed = seed + '', smear, j = 0;\n while (j < stringseed.length) {\n key[mask & j] =\n mask & ((smear ^= key[mask & j] * 19) + stringseed.charCodeAt(j++));\n }\n return tostring(key);\n}\n\n//\n// autoseed()\n// Returns an object for autoseeding, using window.crypto and Node crypto\n// module if available.\n//\nfunction autoseed() {\n try {\n var out;\n if (nodecrypto && (out = nodecrypto.randomBytes)) {\n // The use of 'out' to remember randomBytes makes tight minified code.\n out = out(width);\n } else {\n out = new Uint8Array(width);\n (global.crypto || global.msCrypto).getRandomValues(out);\n }\n return tostring(out);\n } catch (e) {\n var browser = global.navigator,\n plugins = browser && browser.plugins;\n return [+new Date, global, plugins, global.screen, tostring(pool)];\n }\n}\n\n//\n// tostring()\n// Converts an array of charcodes to a string\n//\nfunction tostring(a) {\n return String.fromCharCode.apply(0, a);\n}\n\n//\n// When seedrandom.js is loaded, we immediately mix a few bits\n// from the built-in RNG into the entropy pool. Because we do\n// not want to interfere with deterministic PRNG state later,\n// seedrandom will not call math.random on its own again after\n// initialization.\n//\nmixkey(math.random(), pool);\n\n//\n// Nodejs and AMD support: export the implementation as a module using\n// either convention.\n//\nif ((typeof module) == 'object' && module.exports) {\n module.exports = seedrandom;\n // When in node.js, try using crypto package for autoseeding.\n try {\n nodecrypto = require('crypto');\n } catch (ex) {}\n} else if ((typeof define) == 'function' && define.amd) {\n define(function() { return seedrandom; });\n} else {\n // When included as a plain script, set up Math.seedrandom global.\n math['seed' + rngname] = seedrandom;\n}\n\n\n// End anonymous scope, and pass initial values.\n})(\n // global: `self` in browsers (including strict mode and web workers),\n // otherwise `this` in Node and other environments\n (typeof self !== 'undefined') ? self : this,\n [], // pool: entropy pool starts empty\n Math // math: package containing random, pow, and seedrandom\n);\n","// A library of seedable RNGs implemented in Javascript.\n//\n// Usage:\n//\n// var seedrandom = require('seedrandom');\n// var random = seedrandom(1); // or any seed.\n// var x = random(); // 0 <= x < 1. Every bit is random.\n// var x = random.quick(); // 0 <= x < 1. 32 bits of randomness.\n\n// alea, a 53-bit multiply-with-carry generator by Johannes Baagøe.\n// Period: ~2^116\n// Reported to pass all BigCrush tests.\nvar alea = require('./lib/alea');\n\n// xor128, a pure xor-shift generator by George Marsaglia.\n// Period: 2^128-1.\n// Reported to fail: MatrixRank and LinearComp.\nvar xor128 = require('./lib/xor128');\n\n// xorwow, George Marsaglia's 160-bit xor-shift combined plus weyl.\n// Period: 2^192-2^32\n// Reported to fail: CollisionOver, SimpPoker, and LinearComp.\nvar xorwow = require('./lib/xorwow');\n\n// xorshift7, by François Panneton and Pierre L'ecuyer, takes\n// a different approach: it adds robustness by allowing more shifts\n// than Marsaglia's original three. It is a 7-shift generator\n// with 256 bits, that passes BigCrush with no systmatic failures.\n// Period 2^256-1.\n// No systematic BigCrush failures reported.\nvar xorshift7 = require('./lib/xorshift7');\n\n// xor4096, by Richard Brent, is a 4096-bit xor-shift with a\n// very long period that also adds a Weyl generator. It also passes\n// BigCrush with no systematic failures. Its long period may\n// be useful if you have many generators and need to avoid\n// collisions.\n// Period: 2^4128-2^32.\n// No systematic BigCrush failures reported.\nvar xor4096 = require('./lib/xor4096');\n\n// Tyche-i, by Samuel Neves and Filipe Araujo, is a bit-shifting random\n// number generator derived from ChaCha, a modern stream cipher.\n// https://eden.dei.uc.pt/~sneves/pubs/2011-snfa2.pdf\n// Period: ~2^127\n// No systematic BigCrush failures reported.\nvar tychei = require('./lib/tychei');\n\n// The original ARC4-based prng included in this library.\n// Period: ~2^1600\nvar sr = require('./seedrandom');\n\nsr.alea = alea;\nsr.xor128 = xor128;\nsr.xorwow = xorwow;\nsr.xorshift7 = xorshift7;\nsr.xor4096 = xor4096;\nsr.tychei = tychei;\n\nmodule.exports = sr;\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport * as seedrandom from 'seedrandom';\n\nimport {expectNumbersClose, testEpsilon} from '../test_util';\nimport {TypedArray} from '../types';\n\nexport interface RandomBase {\n nextValue(): number;\n}\n\nexport interface RandomGamma {\n nextValue(): number;\n}\n\nexport interface RandNormalDataTypes {\n float32: Float32Array;\n int32: Int32Array;\n}\n\nexport interface RandGammaDataTypes {\n float32: Float32Array;\n int32: Int32Array;\n}\n\n// https://en.wikipedia.org/wiki/Marsaglia_polar_method\nexport class MPRandGauss implements RandomBase {\n private mean: number;\n private stdDev: number;\n private nextVal: number;\n private dtype?: keyof RandNormalDataTypes;\n private truncated?: boolean;\n private upper?: number;\n private lower?: number;\n private random: seedrandom.prng;\n\n constructor(\n mean: number, stdDeviation: number, dtype?: keyof RandNormalDataTypes,\n truncated?: boolean, seed?: number) {\n this.mean = mean;\n this.stdDev = stdDeviation;\n this.dtype = dtype;\n this.nextVal = NaN;\n this.truncated = truncated;\n if (this.truncated) {\n this.upper = this.mean + this.stdDev * 2;\n this.lower = this.mean - this.stdDev * 2;\n }\n const seedValue = seed ? seed : Math.random();\n this.random = seedrandom.alea(seedValue.toString());\n }\n\n /** Returns next sample from a Gaussian distribution. */\n public nextValue(): number {\n if (!isNaN(this.nextVal)) {\n const value = this.nextVal;\n this.nextVal = NaN;\n return value;\n }\n\n let resultX: number, resultY: number;\n let isValid = false;\n while (!isValid) {\n let v1: number, v2: number, s: number;\n do {\n v1 = 2 * this.random() - 1;\n v2 = 2 * this.random() - 1;\n s = v1 * v1 + v2 * v2;\n } while (s >= 1 || s === 0);\n\n const mul = Math.sqrt(-2.0 * Math.log(s) / s);\n resultX = this.mean + this.stdDev * v1 * mul;\n resultY = this.mean + this.stdDev * v2 * mul;\n\n if (!this.truncated || this.isValidTruncated(resultX)) {\n isValid = true;\n }\n }\n\n if (!this.truncated || this.isValidTruncated(resultY)) {\n this.nextVal = this.convertValue(resultY);\n }\n return this.convertValue(resultX);\n }\n\n /** Handles proper rounding for non-floating-point numbers. */\n private convertValue(value: number): number {\n if (this.dtype == null || this.dtype === 'float32') {\n return value;\n }\n return Math.round(value);\n }\n\n /** Returns true if less than 2-standard-deviations from the mean. */\n private isValidTruncated(value: number): boolean {\n return value <= this.upper && value >= this.lower;\n }\n}\n\n// Marsaglia, George, and Wai Wan Tsang. 2000. \"A Simple Method for Generating\n// Gamma Variables.\"\nexport class RandGamma implements RandomGamma {\n private alpha: number;\n private beta: number;\n private d: number;\n private c: number;\n private dtype?: keyof RandGammaDataTypes;\n private randu: seedrandom.prng;\n private randn: MPRandGauss;\n\n constructor(\n alpha: number, beta: number, dtype: keyof RandGammaDataTypes,\n seed?: number) {\n this.alpha = alpha;\n this.beta = 1 / beta; // convert rate to scale parameter\n this.dtype = dtype;\n\n const seedValue = seed ? seed : Math.random();\n this.randu = seedrandom.alea(seedValue.toString());\n this.randn = new MPRandGauss(0, 1, dtype, false, this.randu());\n\n if (alpha < 1) {\n this.d = alpha + (2 / 3);\n } else {\n this.d = alpha - (1 / 3);\n }\n this.c = 1 / Math.sqrt(9 * this.d);\n }\n\n /** Returns next sample from a gamma distribution. */\n public nextValue(): number {\n let x2: number, v0: number, v1: number, x: number, u: number, v: number;\n while (true) {\n do {\n x = this.randn.nextValue();\n v = 1 + (this.c * x);\n } while (v <= 0);\n v *= v * v;\n x2 = x * x;\n v0 = 1 - (0.331 * x2 * x2);\n v1 = (0.5 * x2) + (this.d * (1 - v + Math.log(v)));\n u = this.randu();\n if (u < v0 || Math.log(u) < v1) {\n break;\n }\n }\n v = (1 / this.beta) * this.d * v;\n if (this.alpha < 1) {\n v *= Math.pow(this.randu(), 1 / this.alpha);\n }\n return this.convertValue(v);\n }\n /** Handles proper rounding for non-floating-point numbers. */\n private convertValue(value: number): number {\n if (this.dtype === 'float32') {\n return value;\n }\n return Math.round(value);\n }\n}\n\nexport class UniformRandom implements RandomBase {\n private min: number;\n private range: number;\n private random: seedrandom.prng;\n private dtype?: keyof RandNormalDataTypes;\n\n constructor(\n min = 0, max = 1, dtype?: keyof RandNormalDataTypes,\n seed?: string|number) {\n this.min = min;\n this.range = max - min;\n this.dtype = dtype;\n if (seed == null) {\n seed = Math.random();\n }\n if (typeof seed === 'number') {\n seed = seed.toString();\n }\n\n if (!this.canReturnFloat() && this.range <= 1) {\n throw new Error(\n `The difference between ${min} - ${max} <= 1 and dtype is not float`);\n }\n this.random = seedrandom.alea(seed);\n }\n\n /** Handles proper rounding for non floating point numbers. */\n private canReturnFloat = () =>\n (this.dtype == null || this.dtype === 'float32');\n\n private convertValue(value: number): number {\n if (this.canReturnFloat()) {\n return value;\n }\n return Math.round(value);\n }\n\n nextValue() {\n return this.convertValue(this.min + this.range * this.random());\n }\n}\n\nexport function jarqueBeraNormalityTest(values: TypedArray|number[]) {\n // https://en.wikipedia.org/wiki/Jarque%E2%80%93Bera_test\n const n = values.length;\n const s = skewness(values);\n const k = kurtosis(values);\n const jb = n / 6 * (Math.pow(s, 2) + 0.25 * Math.pow(k - 3, 2));\n // JB test requires 2-degress of freedom from Chi-Square @ 0.95:\n // http://www.itl.nist.gov/div898/handbook/eda/section3/eda3674.htm\n const CHI_SQUARE_2DEG = 5.991;\n if (jb > CHI_SQUARE_2DEG) {\n throw new Error(`Invalid p-value for JB: ${jb}`);\n }\n}\n\nexport function expectArrayInMeanStdRange(\n actual: TypedArray|number[], expectedMean: number, expectedStdDev: number,\n epsilon?: number) {\n if (epsilon == null) {\n epsilon = testEpsilon();\n }\n const actualMean = mean(actual);\n expectNumbersClose(actualMean, expectedMean, epsilon);\n expectNumbersClose(\n standardDeviation(actual, actualMean), expectedStdDev, epsilon);\n}\n\nfunction mean(values: TypedArray|number[]) {\n let sum = 0;\n for (let i = 0; i < values.length; i++) {\n sum += values[i];\n }\n return sum / values.length;\n}\n\nfunction standardDeviation(values: TypedArray|number[], mean: number) {\n let squareDiffSum = 0;\n for (let i = 0; i < values.length; i++) {\n const diff = values[i] - mean;\n squareDiffSum += diff * diff;\n }\n return Math.sqrt(squareDiffSum / values.length);\n}\n\nfunction kurtosis(values: TypedArray|number[]) {\n // https://en.wikipedia.org/wiki/Kurtosis\n const valuesMean = mean(values);\n const n = values.length;\n let sum2 = 0;\n let sum4 = 0;\n for (let i = 0; i < n; i++) {\n const v = values[i] - valuesMean;\n sum2 += Math.pow(v, 2);\n sum4 += Math.pow(v, 4);\n }\n return (1 / n) * sum4 / Math.pow((1 / n) * sum2, 2);\n}\n\nfunction skewness(values: TypedArray|number[]) {\n // https://en.wikipedia.org/wiki/Skewness\n const valuesMean = mean(values);\n const n = values.length;\n let sum2 = 0;\n let sum3 = 0;\n for (let i = 0; i < n; i++) {\n const v = values[i] - valuesMean;\n sum2 += Math.pow(v, 2);\n sum3 += Math.pow(v, 3);\n }\n return (1 / n) * sum3 / Math.pow((1 / (n - 1)) * sum2, 3 / 2);\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport {Rank, ShapeMap} from '../types';\n\nimport {buffer} from './buffer';\nimport {op} from './operation';\nimport {RandGamma} from './rand_util';\n\n/**\n * Creates a `tf.Tensor` with values sampled from a gamma distribution.\n *\n * ```js\n * tf.randomGamma([2, 2], 1).print();\n * ```\n *\n * @param shape An array of integers defining the output tensor shape.\n * @param alpha The shape parameter of the gamma distribution.\n * @param beta The inverse scale parameter of the gamma distribution. Defaults\n * to 1.\n * @param dtype The data type of the output. Defaults to float32.\n * @param seed The seed for the random number generator.\n *\n * @doc {heading: 'Tensors', subheading: 'Random'}\n */\nfunction randomGamma_(\n shape: ShapeMap[R], alpha: number, beta = 1,\n dtype: 'float32'|'int32' = 'float32', seed?: number): Tensor {\n if (beta == null) {\n beta = 1;\n }\n if (dtype == null) {\n dtype = 'float32';\n }\n if (dtype !== 'float32' && dtype !== 'int32') {\n throw new Error(`Unsupported data type ${dtype}`);\n }\n const rgamma = new RandGamma(alpha, beta, dtype, seed);\n const res = buffer(shape, dtype);\n for (let i = 0; i < res.values.length; i++) {\n res.values[i] = rgamma.nextValue();\n }\n return res.toTensor();\n}\n\nexport const randomGamma = op({randomGamma_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport {DataType, Rank, ShapeMap} from '../types';\n\nimport {buffer} from './buffer';\nimport {op} from './operation';\nimport {MPRandGauss} from './rand_util';\n\n/**\n * Creates a `tf.Tensor` with values sampled from a normal distribution.\n *\n * ```js\n * tf.randomNormal([2, 2]).print();\n * ```\n *\n * @param shape An array of integers defining the output tensor shape.\n * @param mean The mean of the normal distribution.\n * @param stdDev The standard deviation of the normal distribution.\n * @param dtype The data type of the output.\n * @param seed The seed for the random number generator.\n *\n * @doc {heading: 'Tensors', subheading: 'Random'}\n */\nfunction randomNormal_(\n shape: ShapeMap[R], mean = 0, stdDev = 1, dtype?: 'float32'|'int32',\n seed?: number): Tensor {\n if (dtype != null && (dtype as DataType) === 'bool') {\n throw new Error(`Unsupported data type ${dtype}`);\n }\n const randGauss =\n new MPRandGauss(mean, stdDev, dtype, false /* truncated */, seed);\n const res = buffer(shape, dtype);\n for (let i = 0; i < res.values.length; i++) {\n res.values[i] = randGauss.nextValue();\n }\n return res.toTensor();\n}\n\nexport const randomNormal = op({randomNormal_});\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport {DataType, Rank, ShapeMap} from '../types';\n\nimport {op} from './operation';\nimport {randomNormal} from './random_normal';\n\n/**\n * Creates a `tf.Tensor` with values sampled from a normal distribution.\n *\n * The generated values will have mean 0 and standard deviation 1.\n *\n * ```js\n * tf.randomStandardNormal([2, 2]).print();\n * ```\n *\n * @param shape An array of integers defining the output tensor shape.\n * @param dtype The data type of the output.\n * @param seed The seed for the random number generator.\n *\n * @doc {heading: 'Tensors', subheading: 'Random'}\n */\nfunction randomStandardNormal_(\n shape: ShapeMap[R], dtype?: 'float32'|'int32', seed?: number): Tensor {\n if (dtype != null && (dtype as DataType) === 'bool') {\n throw new Error(`Unsupported data type ${dtype}`);\n }\n return randomNormal(shape, 0, 1, dtype, seed);\n}\n\nexport const randomStandardNormal = op({randomStandardNormal_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport {DataType, Rank, ShapeMap} from '../types';\n\nimport {buffer} from './buffer';\nimport {op} from './operation';\nimport {UniformRandom} from './rand_util';\n\n/**\n * Creates a `tf.Tensor` with values sampled from a uniform distribution.\n *\n * The generated values follow a uniform distribution in the range [minval,\n * maxval). The lower bound minval is included in the range, while the upper\n * bound maxval is excluded.\n *\n * ```js\n * tf.randomUniform([2, 2]).print();\n * ```\n *\n * @param shape An array of integers defining the output tensor shape.\n * @param minval The lower bound on the range of random values to generate.\n * Defaults to 0.\n * @param maxval The upper bound on the range of random values to generate.\n * Defaults to 1.\n * @param dtype The data type of the output tensor. Defaults to 'float32'.\n *\n * @doc {heading: 'Tensors', subheading: 'Random'}\n */\nfunction randomUniform_(\n shape: ShapeMap[R], minval = 0, maxval = 1, dtype: DataType = 'float32',\n seed?: number|string): Tensor {\n const res = buffer(shape, dtype);\n const random = new UniformRandom(minval, maxval, null, seed);\n for (let i = 0; i < res.values.length; i++) {\n res.values[i] = random.nextValue();\n }\n return res.toTensor();\n}\n\nexport const randomUniform = op({randomUniform_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Range, RangeAttrs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor1D} from '../tensor';\n\n/**\n * Creates a new `tf.Tensor1D` filled with the numbers in the range provided.\n *\n * The tensor is a half-open interval meaning it includes start, but\n * excludes stop. Decrementing ranges and negative step values are also\n * supported.\n *\n *\n * ```js\n * tf.range(0, 9, 2).print();\n * ```\n *\n * @param start An integer start value\n * @param stop An integer stop value\n * @param step An integer increment (will default to 1 or -1)\n * @param dtype The data type of the output tensor. Defaults to 'float32'.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nexport function range(\n start: number, stop: number, step = 1,\n dtype: 'float32'|'int32' = 'float32'): Tensor1D {\n if (step === 0) {\n throw new Error('Cannot have a step of zero');\n }\n\n const attrs: RangeAttrs = {start, stop, step, dtype};\n\n return ENGINE.runKernel(Range, {} /* inputs */, attrs as {} as NamedAttrMap);\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Reciprocal, ReciprocalInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes reciprocal of x element-wise: `1 / x`\n *\n * ```js\n * const x = tf.tensor1d([0, 1, 2]);\n *\n * x.reciprocal().print(); // or tf.reciprocal(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction reciprocal_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'reciprocal');\n\n const inputs: ReciprocalInputs = {x: $x};\n return ENGINE.runKernel(Reciprocal, inputs as {} as NamedTensorMap);\n}\nexport const reciprocal = op({reciprocal_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Relu, ReluInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes rectified linear element-wise: `max(x, 0)`.\n *\n * ```js\n * const x = tf.tensor1d([-1, 2, -3, 4]);\n *\n * x.relu().print(); // or tf.relu(x)\n * ```\n * @param x The input tensor. If the dtype is `bool`, the output dtype will be\n * `int32`.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction relu_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'relu');\n\n const inputs: ReluInputs = {x: $x};\n\n return ENGINE.runKernel(Relu, inputs as {} as NamedTensorMap);\n}\n\nexport const relu = op({relu_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Relu6, Relu6Inputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes rectified linear 6 element-wise: `min(max(x, 0), 6)`.\n *\n * ```js\n * const x = tf.tensor1d([-1, 2, -3, 8]);\n *\n * x.relu6().print(); // or tf.relu6(x)\n * ```\n * @param x The input tensor. If the dtype is `bool`, the output dtype will be\n * `int32`.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction relu6_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'relu6');\n\n const inputs: Relu6Inputs = {x: $x};\n\n return ENGINE.runKernel(Relu6, inputs as {} as NamedTensorMap);\n}\n\nexport const relu6 = op({relu6_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Reverse, ReverseAttrs, ReverseInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Reverses a `tf.Tensor` along a specified axis.\n *\n * Also available are stricter rank-specific methods that assert that `x` is\n * of the given rank:\n * - `tf.reverse1d`\n * - `tf.reverse2d`\n * - `tf.reverse3d`\n * - `tf.reverse4d`\n *\n * Except `tf.reverse1d` (which does not have axis param), all methods have\n * same signature as this method.\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 3, 4]);\n *\n * x.reverse().print();\n * ```\n *\n * ```js\n * const x = tf.tensor2d([1, 2, 3, 4], [2, 2]);\n *\n * const axis = 1;\n * x.reverse(axis).print();\n * ```\n * @param x The input tensor to be reversed.\n * @param axis The set of dimensions to reverse. Must be in the\n * range [-rank(x), rank(x)). Defaults to all axes.\n *\n * @doc {heading: 'Tensors', subheading: 'Slicing and Joining'}\n */\nfunction reverse_(\n x: T|TensorLike, axis?: number|number[]): T {\n const $x = convertToTensor(x, 'x', 'reverse');\n\n const inputs: ReverseInputs = {x: $x};\n const attrs: ReverseAttrs = {dims: axis};\n\n return ENGINE.runKernel(\n Reverse, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const reverse = op({reverse_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor1D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\nimport {op} from './operation';\nimport {reverse} from './reverse';\n\n/**\n * Reverses a `tf.Tensor1D`.\n *\n * @param x The input tensor.\n */\nfunction reverse1d_(x: Tensor1D|TensorLike): Tensor1D {\n const $x = convertToTensor(x, 'x', 'reverse');\n util.assert(\n $x.rank === 1,\n () => `Error in reverse1D: x must be rank 1 but got rank ${$x.rank}.`);\n return reverse($x, 0);\n}\n\nexport const reverse1d = op({reverse1d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor2D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\nimport {op} from './operation';\nimport {reverse} from './reverse';\n\n/**\n * Reverses a `tf.Tensor2D` along a specified axis.\n *\n * @param x The input tensor.\n * @param axis The set of dimensions to reverse. Must be in the\n * range [-rank(x), rank(x)). Defaults to all axes.\n */\nfunction reverse2d_(x: Tensor2D|TensorLike, axis?: number|number[]): Tensor2D {\n const $x = convertToTensor(x, 'x', 'reverse');\n util.assert(\n $x.rank === 2,\n () => `Error in reverse2D: x must be rank 2 but got rank ${$x.rank}.`);\n return reverse($x, axis);\n}\n\nexport const reverse2d = op({reverse2d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor3D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\nimport {op} from './operation';\nimport {reverse} from './reverse';\n\n/**\n * Reverses a `tf.Tensor3D` along a specified axis.\n *\n * @param x The input tensor.\n * @param axis The set of dimensions to reverse. Must be in the\n * range [-rank(x), rank(x)). Defaults to all axes.\n */\nfunction reverse3d_(x: Tensor3D|TensorLike, axis?: number|number[]): Tensor3D {\n const $x = convertToTensor(x, 'x', 'reverse');\n util.assert(\n $x.rank === 3,\n () => `Error in reverse3D: x must be rank 3 but got rank ${$x.rank}.`);\n return reverse($x, axis);\n}\n\nexport const reverse3d = op({reverse3d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor4D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\nimport {op} from './operation';\nimport {reverse} from './reverse';\n\n/**\n * Reverses a `tf.Tensor4D` along a specified axis.\n *\n * @param x The input tensor.\n * @param axis The set of dimensions to reverse. Must be in the\n * range [-rank(x), rank(x)). Defaults to all axes.\n */\nfunction reverse4d_(x: Tensor4D|TensorLike, axis?: number|number[]): Tensor4D {\n const $x = convertToTensor(x, 'x', 'reverse');\n util.assert(\n $x.rank === 4,\n () => `Error in reverse4D: x must be rank 4 but got rank ${$x.rank}.`);\n return reverse($x, axis);\n}\n\nexport const reverse4d = op({reverse4d_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Round, RoundInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes round of input `tf.Tensor` element-wise: `round(x)`.\n * It implements banker's rounding.\n *\n * ```js\n * const x = tf.tensor1d([.6, 1.1, -3.3]);\n *\n * x.round().print(); // or tf.round(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction round_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'round');\n const inputs: RoundInputs = {x: $x};\n\n return ENGINE.runKernel(Round, inputs as {} as NamedTensorMap);\n}\n\nexport const round = op({round_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Rsqrt, RsqrtInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes reciprocal of square root of the input `tf.Tensor` element-wise:\n * `y = 1 / sqrt(x)`\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 4, -1]);\n *\n * x.rsqrt().print(); // or tf.rsqrt(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction rsqrt_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'rsqrt', 'float32');\n\n const inputs: RsqrtInputs = {x: $x};\n\n return ENGINE.runKernel(Rsqrt, inputs as {} as NamedTensorMap);\n}\nexport const rsqrt = op({rsqrt_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Selu, SeluInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes scaled exponential linear element-wise.\n *\n * `x < 0 ? scale * alpha * (exp(x) - 1) : scale * x`\n *\n * ```js\n * const x = tf.tensor1d([-1, 2, -3, 4]);\n *\n * x.selu().print(); // or tf.selu(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction selu_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'selu');\n\n const inputs: SeluInputs = {x: $x};\n\n return ENGINE.runKernel(Selu, inputs as {} as NamedTensorMap);\n}\n\nexport const selu = op({selu_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor3D, Tensor4D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {conv2d} from './conv2d';\nimport {depthwiseConv2d} from './depthwise_conv2d';\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * 2-D convolution with separable filters.\n *\n * Performs a depthwise convolution that acts separately on channels followed\n * by a pointwise convolution that mixes channels. Note that this is\n * separability between dimensions [1, 2] and 3, not spatial separability\n * between dimensions 1 and 2.\n *\n * See\n * [https://www.tensorflow.org/api_docs/python/tf/nn/separable_conv2d](\n * https://www.tensorflow.org/api_docs/python/tf/nn/separable_conv2d)\n * for more details.\n *\n * @param x The input tensor, of rank 4 or rank 3, of shape\n * `[batch, height, width, inChannels]`. If rank 3, batch of 1 is\n * assumed.\n * @param depthwiseFilter The depthwise filter tensor, rank 4, of shape\n * `[filterHeight, filterWidth, inChannels, channelMultiplier]`. This is\n * the filter used in the first step.\n * @param pointwiseFilter The pointwise filter tensor, rank 4, of shape\n * `[1, 1, inChannels * channelMultiplier, outChannels]`. This is\n * the filter used in the second step.\n * @param strides The strides of the convolution: `[strideHeight,\n * strideWidth]`. If strides is a single number, then `strideHeight ==\n * strideWidth`.\n * @param pad The type of padding algorithm.\n * - `same` and stride 1: output will be of same size as input,\n * regardless of filter size.\n * - `valid`: output will be smaller than input if filter is larger\n * than 1x1.\n * - For more info, see this guide:\n * [https://www.tensorflow.org/api_docs/python/tf/nn/convolution](\n * https://www.tensorflow.org/api_docs/python/tf/nn/convolution)\n * @param dilations The dilation rates: `[dilationHeight, dilationWidth]`\n * in which we sample input values across the height and width dimensions\n * in atrous convolution. Defaults to `[1, 1]`. If `rate` is a single\n * number, then `dilationHeight == dilationWidth`. If it is greater than\n * 1, then all values of `strides` must be 1.\n * @param dataFormat: An optional string from: \"NHWC\", \"NCHW\". Defaults to\n * \"NHWC\". Specify the data format of the input and output data. With the\n * default format \"NHWC\", the data is stored in the order of: [batch,\n * height, width, channels]. Only \"NHWC\" is currently supported.\n *\n * @doc {heading: 'Operations', subheading: 'Convolution'}\n */\nfunction separableConv2d_(\n x: T|TensorLike, depthwiseFilter: Tensor4D|TensorLike,\n pointwiseFilter: Tensor4D|TensorLike, strides: [number, number]|number,\n pad: 'valid'|'same', dilation: [number, number]|number = [1, 1],\n dataFormat: 'NHWC'|'NCHW' = 'NHWC'): T {\n const $x = convertToTensor(x, 'x', 'separableConv2d');\n const $depthwiseFilter =\n convertToTensor(depthwiseFilter, 'depthwiseFilter', 'separableConv2d');\n const $pointwiseFilter =\n convertToTensor(pointwiseFilter, 'pointwiseFilter', 'separableConv2d');\n\n let x4D = $x as Tensor4D;\n let reshapedTo4D = false;\n if ($x.rank === 3) {\n reshapedTo4D = true;\n x4D = reshape($x, [1, $x.shape[0], $x.shape[1], $x.shape[2]]);\n }\n\n if (dataFormat === 'NCHW') {\n throw new Error(\n 'separableConv2d currently does not support dataFormat NCHW; only ' +\n 'NHWC is supported');\n }\n\n util.assert(\n x4D.rank === 4,\n () => `Error in separableConv2d: input must be rank 4, but got ` +\n `rank ${x4D.rank}.`);\n util.assert(\n $depthwiseFilter.rank === 4,\n () => `Error in separableConv2d: depthwise filter must be rank 4, but ` +\n `got rank ${$depthwiseFilter.rank}.`);\n util.assert(\n $pointwiseFilter.rank === 4,\n () => `Error in separableConv2d: pointwise filter must be rank 4, but ` +\n `got rank ${$depthwiseFilter.rank}.`);\n util.assert(\n $pointwiseFilter.shape[0] === 1,\n () =>\n `Error in separableConv2d: the first dimension of pointwise filter ` +\n ` must be 1, but got ${$pointwiseFilter.shape[0]}.`);\n util.assert(\n $pointwiseFilter.shape[1] === 1,\n () => `Error in separableConv2d: the second dimension of pointwise ` +\n `filter must be 1, but got ${$pointwiseFilter.shape[1]}.`);\n\n const inChannels = $depthwiseFilter.shape[2];\n const channelMultiplier = $depthwiseFilter.shape[3];\n util.assert(\n $pointwiseFilter.shape[2] === inChannels * channelMultiplier,\n () =>\n `Error in separableConv2d: the third dimension of pointwise filter ` +\n `must be ${inChannels * channelMultiplier}, ` +\n `but got ${$pointwiseFilter.shape[2]}.`);\n\n const depthwise = depthwiseConv2d(\n x4D, $depthwiseFilter, strides, pad, dataFormat, dilation);\n const pointwiseStride = 1;\n const res =\n conv2d(depthwise, $pointwiseFilter, pointwiseStride, 'valid', dataFormat);\n\n if (reshapedTo4D) {\n return reshape(res, [res.shape[1], res.shape[2], res.shape[3]]) as T;\n }\n return res as T;\n}\n\nexport const separableConv2d = op({separableConv2d_});\n","/**\n * @license\n * Copyright 2020 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor, TensorBuffer} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\n/**\n * Computes the difference between two lists of numbers.\n *\n * Given a Tensor `x` and a Tensor `y`, this operation returns a Tensor `out`\n * that represents all values that are in `x` but not in `y`. The returned\n * Tensor `out` is sorted in the same order that the numbers appear in `x`\n * (duplicates are preserved). This operation also returns a Tensor indices that\n * represents the position of each out element in `x`. In other words:\n *\n * `out[i] = x[idx[i]] for i in [0, 1, ..., out.length - 1]`\n *\n * ```js\n * const x = [1, 2, 3, 4, 5, 6];\n * const y = [1, 3, 5];\n *\n * const [out, indices] = await tf.setdiff1dAsync(x, y);\n * out.print(); // [2, 4, 6]\n * indices.print(); // [1, 3, 5]\n * ```\n *\n * @param x 1-D Tensor. Values to keep.\n * @param y 1-D Tensor. Must have the same type as x. Values to exclude in the\n * output.\n * @returns Promise of Tensor tuple [out, indices].\n * out: Tensor with the same type as x.\n * indices: A Tensor of type int32.\n *\n * @doc {heading: 'Tensors', subheading: 'Transformations'}\n */\nasync function setdiff1dAsync_(\n x: Tensor|TensorLike, y: Tensor|TensorLike): Promise<[Tensor, Tensor]> {\n const $x = convertToTensor(x, 'x', 'setdiff1d');\n const $y = convertToTensor(y, 'y', 'setdiff1d');\n\n util.assert(\n $x.dtype === $y.dtype,\n () => `x and y should have the same dtype, but got x (${\n $x.dtype}) and y (${$y.dtype}).`);\n\n util.assert(\n $x.rank === 1, () => `x should be 1D tensor, but got x (${$x.shape}).`);\n\n util.assert(\n $y.rank === 1, () => `y should be 1D tensor, but got y (${$y.shape}).`);\n\n const xVals = await $x.data();\n const yVals = await $y.data();\n const ySet = new Set(yVals);\n\n let outputSize = 0;\n for (let i = 0; i < xVals.length; i++) {\n if (!ySet.has(xVals[i])) {\n outputSize++;\n }\n }\n\n const buffer = new TensorBuffer([outputSize], $x.dtype);\n const indices = new TensorBuffer([outputSize], 'int32');\n for (let i = 0, p = 0; i < xVals.length; i++) {\n if (!ySet.has(xVals[i])) {\n buffer.values[p] = xVals[i];\n indices.values[p] = i;\n p++;\n }\n }\n return [buffer.toTensor(), indices.toTensor()];\n}\nexport const setdiff1dAsync = setdiff1dAsync_;\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Sign, SignInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Returns an element-wise indication of the sign of a number.\n *\n * ```js\n * const x = tf.tensor1d([.6, 1.1, -3.3, NaN, 0]);\n *\n * x.sign().print(); // or tf.sign(x)\n * ```\n * @param x The input Tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction sign_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'sign');\n const inputs: SignInputs = {x: $x};\n return ENGINE.runKernel(Sign, inputs as {} as NamedTensorMap);\n}\nexport const sign = op({sign_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Sin, SinInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes sin of the input Tensor element-wise: `sin(x)`\n *\n * ```js\n * const x = tf.tensor1d([0, Math.PI / 2, Math.PI * 3 / 4]);\n *\n * x.sin().print(); // or tf.sin(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction sin_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'sin', 'float32');\n\n const inputs: SinInputs = {x: $x};\n\n return ENGINE.runKernel(Sin, inputs as {} as NamedTensorMap);\n}\nexport const sin = op({sin_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Sinh, SinhInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes hyperbolic sin of the input `tf.Tensor` element-wise: `sinh(x)`\n *\n * ```js\n * const x = tf.tensor1d([0, 1, -1, .7]);\n *\n * x.sinh().print(); // or tf.sinh(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction sinh_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'sinh');\n const inputs: SinhInputs = {x: $x};\n\n return ENGINE.runKernel(Sinh, inputs as {} as NamedTensorMap);\n}\nexport const sinh = op({sinh_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor1D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\nimport {slice} from './slice';\n\n/**\n * Extracts a 1D slice from 1D array starting at coordinates `begin` and is\n * of length `size`. See `slice` for details.\n */\nfunction slice1d_(\n x: Tensor1D|TensorLike, begin: number, size: number): Tensor1D {\n const $x = convertToTensor(x, 'x', 'slice1d');\n util.assert(\n $x.rank === 1,\n () =>\n `slice1d expects a rank-1 tensor, but got a rank-${$x.rank} tensor`);\n return slice($x, [begin], [size]);\n}\nexport const slice1d = op({slice1d_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor2D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\nimport {slice} from './slice';\n\n/**\n * Extracts a 2D slice from a 2D array starting at coordinates `begin` and\n * is of size `size`. See `slice` for details.\n */\nfunction slice2d_(\n x: Tensor2D|TensorLike, begin: [number, number],\n size: [number, number]): Tensor2D {\n const $x = convertToTensor(x, 'x', 'slice2d');\n util.assert(\n $x.rank === 2,\n () =>\n `slice2d expects a rank-2 tensor, but got a rank-${$x.rank} tensor`);\n return slice($x, begin, size);\n}\nexport const slice2d = op({slice2d_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor3D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\nimport {slice} from './slice';\n\n/**\n * Extracts a 3D slice from a 3D array starting at coordinates `begin` and\n * is of size `size`. See `slice` for details.\n */\nfunction slice3d_(\n x: Tensor3D|TensorLike, begin: [number, number, number],\n size: [number, number, number]): Tensor3D {\n const $x = convertToTensor(x, 'x', 'slice3d');\n util.assert(\n $x.rank === 3,\n () =>\n `slice3d expects a rank-3 tensor, but got a rank-${$x.rank} tensor`);\n return slice($x, begin, size);\n}\nexport const slice3d = op({slice3d_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor4D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\nimport {slice} from './slice';\n\n/**\n * Extracts a 4D slice from a 4D array starting at coordinates `begin` and\n * is of size `size`. See `slice` for details.\n */\nfunction slice4d_(\n x: Tensor4D|TensorLike, begin: [number, number, number, number],\n size: [number, number, number, number]): Tensor4D {\n const $x = convertToTensor(x, 'x', 'slice4d');\n util.assert(\n $x.rank === 4,\n () =>\n `slice4d expects a rank-4 tensor, but got a rank-${$x.rank} tensor`);\n return slice($x, begin, size);\n}\nexport const slice4d = op({slice4d_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Softmax, SoftmaxAttrs, SoftmaxInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes the softmax normalized vector given the logits.\n *\n * ```js\n * const a = tf.tensor1d([1, 2, 3]);\n *\n * a.softmax().print(); // or tf.softmax(a)\n * ```\n *\n * ```js\n * const a = tf.tensor2d([2, 4, 6, 1, 2, 3], [2, 3]);\n *\n * a.softmax().print(); // or tf.softmax(a)\n * ```\n *\n * @param logits The logits array.\n * @param dim The dimension softmax would be performed on. Defaults to `-1`\n * which indicates the last dimension.\n *\n * @doc {heading: 'Operations', subheading: 'Normalization'}\n */\nfunction softmax_(logits: T|TensorLike, dim = -1): T {\n const $logits = convertToTensor(logits, 'logits', 'softmax', 'float32');\n\n if (dim === -1) {\n dim = $logits.rank - 1;\n }\n if (dim !== $logits.rank - 1) {\n throw Error(\n 'Softmax along a non-last dimension is not yet supported. ' +\n `Logits was rank ${$logits.rank} and dim was ${dim}`);\n }\n\n const inputs: SoftmaxInputs = {logits: $logits};\n const attrs: SoftmaxAttrs = {dim};\n\n return ENGINE.runKernel(\n Softmax, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const softmax = op({softmax_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {FFT, FFTInputs} from '../../kernel_names';\nimport {Tensor} from '../../tensor';\nimport {NamedTensorMap} from '../../tensor_types';\nimport {assert} from '../../util';\nimport {op} from '../operation';\n\n/**\n * Fast Fourier transform.\n *\n * Computes the 1-dimensional discrete Fourier transform over the inner-most\n * dimension of input.\n *\n * ```js\n * const real = tf.tensor1d([1, 2, 3]);\n * const imag = tf.tensor1d([1, 2, 3]);\n * const x = tf.complex(real, imag);\n *\n * x.fft().print(); // tf.spectral.fft(x).print();\n * ```\n * @param input The complex input to compute an fft over.\n *\n * @doc {heading: 'Operations', subheading: 'Spectral', namespace: 'spectral'}\n */\nfunction fft_(input: Tensor): Tensor {\n assert(\n input.dtype === 'complex64',\n () => `The dtype for tf.spectral.fft() must be complex64 ` +\n `but got ${input.dtype}.`);\n\n const inputs: FFTInputs = {input};\n\n return ENGINE.runKernel(FFT, inputs as {} as NamedTensorMap);\n}\n\nexport const fft = op({fft_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {IFFT, IFFTInputs} from '../../kernel_names';\nimport {Tensor} from '../../tensor';\nimport {NamedTensorMap} from '../../tensor_types';\nimport {assert} from '../../util';\nimport {op} from '../operation';\n\n/**\n * Inverse fast Fourier transform.\n *\n * Computes the inverse 1-dimensional discrete Fourier transform over the\n * inner-most dimension of input.\n *\n * ```js\n * const real = tf.tensor1d([1, 2, 3]);\n * const imag = tf.tensor1d([1, 2, 3]);\n * const x = tf.complex(real, imag);\n *\n * x.ifft().print(); // tf.spectral.ifft(x).print();\n * ```\n * @param input The complex input to compute an ifft over.\n *\n * @doc {heading: 'Operations', subheading: 'Spectral', namespace: 'spectral'}\n */\nfunction ifft_(input: Tensor): Tensor {\n assert(\n input.dtype === 'complex64',\n () => `The dtype for tf.spectral.ifft() must be complex64 ` +\n `but got ${input.dtype}.`);\n\n const inputs: IFFTInputs = {input};\n\n return ENGINE.runKernel(IFFT, inputs as {} as NamedTensorMap);\n}\n\nexport const ifft = op({ifft_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor, Tensor2D} from '../../tensor';\nimport {complex} from '../complex';\nimport {concat} from '../concat';\nimport {imag} from '../imag';\nimport {mul} from '../mul';\nimport {op} from '../operation';\nimport {real} from '../real';\nimport {reshape} from '../reshape';\nimport {reverse} from '../reverse';\nimport {scalar} from '../scalar';\nimport {slice} from '../slice';\n\nimport {ifft} from './ifft';\n\n/**\n * Inversed real value input fast Fourier transform.\n *\n * Computes the 1-dimensional inversed discrete Fourier transform over the\n * inner-most dimension of the real input.\n *\n * ```js\n * const real = tf.tensor1d([1, 2, 3]);\n * const imag = tf.tensor1d([0, 0, 0]);\n * const x = tf.complex(real, imag);\n *\n * x.irfft().print();\n * ```\n * @param input The real value input to compute an irfft over.\n *\n * @doc {heading: 'Operations', subheading: 'Spectral', namespace: 'spectral'}\n */\nfunction irfft_(input: Tensor): Tensor {\n const innerDimensionSize = input.shape[input.shape.length - 1];\n const batch = input.size / innerDimensionSize;\n let ret: Tensor;\n if (innerDimensionSize <= 2) {\n const complexInput = reshape(input, [batch, innerDimensionSize]);\n ret = ifft(complexInput);\n } else {\n // The length of unique components of the DFT of a real-valued signal\n // is 2 * (input_len - 1)\n const outputShape = [batch, 2 * (innerDimensionSize - 1)];\n const realInput = reshape(real(input), [batch, innerDimensionSize]);\n const imagInput = reshape(imag(input), [batch, innerDimensionSize]);\n\n const realConjugate =\n reverse(slice(realInput, [0, 1], [batch, innerDimensionSize - 2]), 1);\n const imagConjugate: Tensor2D = mul(\n reverse(slice(imagInput, [0, 1], [batch, innerDimensionSize - 2]), 1),\n scalar(-1));\n\n const r = concat([realInput, realConjugate], 1);\n const i = concat([imagInput, imagConjugate], 1);\n const complexInput =\n reshape(complex(r, i), [outputShape[0], outputShape[1]]);\n ret = ifft(complexInput);\n }\n ret = real(ret);\n // reshape the result if the input is 3D tensor.\n if (input.rank === 3 && input.shape[0] !== 0) {\n const temp = ret;\n const batch = input.shape[0];\n ret = reshape(ret, [batch, ret.shape[0] / batch, ret.shape[1]]);\n temp.dispose();\n }\n return ret;\n}\n\nexport const irfft = op({irfft_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {SplitV, SplitVAttrs, SplitVInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Splits a `tf.Tensor` into sub tensors.\n *\n * If `numOrSizeSplits` is a number, splits `x` along dimension `axis`\n * into `numOrSizeSplits` smaller tensors.\n * Requires that `numOrSizeSplits` evenly divides `x.shape[axis]`.\n *\n * If `numOrSizeSplits` is a number array, splits `x` into\n * `numOrSizeSplits.length` pieces. The shape of the `i`-th piece has the\n * same size as `x` except along dimension `axis` where the size is\n * `numOrSizeSplits[i]`.\n *\n * ```js\n * const x = tf.tensor2d([1, 2, 3, 4, 5, 6, 7, 8], [2, 4]);\n * const [a, b] = tf.split(x, 2, 1);\n * a.print();\n * b.print();\n *\n * const [c, d, e] = tf.split(x, [1, 2, 1], 1);\n * c.print();\n * d.print();\n * e.print();\n * ```\n *\n * @param x The input tensor to split.\n * @param numOrSizeSplits Either an integer indicating the number of\n * splits along the axis or an array of integers containing the sizes of\n * each output tensor along the axis. If a number then it must evenly divide\n * `x.shape[axis]`; otherwise the sum of sizes must match `x.shape[axis]`.\n * Can contain one -1 indicating that dimension is to be inferred.\n * @param axis The dimension along which to split. Defaults to 0 (the first\n * dim).\n *\n * @doc {heading: 'Tensors', subheading: 'Slicing and Joining'}\n */\nfunction split_(\n x: Tensor|TensorLike, numOrSizeSplits: number[]|number, axis = 0): T[] {\n const $x = convertToTensor(x, 'x', 'split');\n\n const inputs: SplitVInputs = {x: $x};\n const attr: SplitVAttrs = {numOrSizeSplits, axis};\n\n return ENGINE.runKernel(\n SplitV, inputs as {} as NamedTensorMap,\n attr as {} as NamedAttrMap) as {} as T[];\n}\n\nexport const split = op({split_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../../tensor';\nimport {assert} from '../../util';\nimport {complex} from '../complex';\nimport {concat} from '../concat';\nimport {imag} from '../imag';\nimport {op} from '../operation';\nimport {real} from '../real';\nimport {reshape} from '../reshape';\nimport {slice} from '../slice';\nimport {split} from '../split';\nimport {zeros} from '../zeros';\nimport {zerosLike} from '../zeros_like';\n\nimport {fft} from './fft';\n\n/**\n * Real value input fast Fourier transform.\n *\n * Computes the 1-dimensional discrete Fourier transform over the\n * inner-most dimension of the real input.\n *\n * ```js\n * const real = tf.tensor1d([1, 2, 3]);\n *\n * real.rfft().print();\n * ```\n * @param input The real value input to compute an rfft over.\n *\n * @doc {heading: 'Operations', subheading: 'Spectral', namespace: 'spectral'}\n */\nfunction rfft_(input: Tensor, fftLength?: number): Tensor {\n assert(\n input.dtype === 'float32',\n () => `The dtype for rfft() must be real value but got ${input.dtype}`);\n\n let innerDimensionSize = input.shape[input.shape.length - 1];\n const batch = input.size / innerDimensionSize;\n\n let adjustedInput: Tensor;\n if (fftLength != null && fftLength < innerDimensionSize) {\n // Need to crop\n const begin = input.shape.map(v => 0);\n const size = input.shape.map(v => v);\n size[input.shape.length - 1] = fftLength;\n adjustedInput = slice(input, begin, size);\n innerDimensionSize = fftLength;\n } else if (fftLength != null && fftLength > innerDimensionSize) {\n // Need to pad with zeros\n const zerosShape = input.shape.map(v => v);\n zerosShape[input.shape.length - 1] = fftLength - innerDimensionSize;\n adjustedInput = concat([input, zeros(zerosShape)], input.shape.length - 1);\n innerDimensionSize = fftLength;\n } else {\n adjustedInput = input;\n }\n\n // Complement the input with zero imaginary numbers.\n const zerosInput = zerosLike(adjustedInput);\n const complexInput =\n reshape(complex(adjustedInput, zerosInput), [batch, innerDimensionSize]);\n\n const ret = fft(complexInput);\n\n // Exclude complex conjugations. These conjugations are put symmetrically.\n const half = Math.floor(innerDimensionSize / 2) + 1;\n const realValues = real(ret);\n const imagValues = imag(ret);\n const realComplexConjugate = split(\n realValues, [half, innerDimensionSize - half],\n realValues.shape.length - 1);\n const imagComplexConjugate = split(\n imagValues, [half, innerDimensionSize - half],\n imagValues.shape.length - 1);\n\n const outputShape = adjustedInput.shape.slice();\n outputShape[adjustedInput.shape.length - 1] = half;\n\n return reshape(\n complex(realComplexConjugate[0], imagComplexConjugate[0]), outputShape);\n}\n\nexport const rfft = op({rfft_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {SquaredDifference, SquaredDifferenceInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {makeTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {assertAndGetBroadcastShape} from './broadcast_util';\nimport {op} from './operation';\n\n/**\n * Returns (a - b) * (a - b) element-wise.\n * Supports broadcasting.\n *\n * ```js\n * const a = tf.tensor1d([1, 4, 3, 16]);\n * const b = tf.tensor1d([1, 2, 9, 4]);\n *\n * a.squaredDifference(b).print(); // or tf.squaredDifference(a, b)\n * ```\n *\n * ```js\n * // Broadcast squared difference a with b.\n * const a = tf.tensor1d([2, 4, 6, 8]);\n * const b = tf.scalar(5);\n *\n * a.squaredDifference(b).print(); // or tf.squaredDifference(a, b)\n * ```\n *\n * @param a The first tensor.\n * @param b The second tensor. Must have the same type as `a`.\n *\n * @doc {heading: 'Operations', subheading: 'Arithmetic'}\n */\nfunction squaredDifference_(\n a: Tensor|TensorLike, b: Tensor|TensorLike): T {\n let $a = convertToTensor(a, 'a', 'squaredDifference');\n let $b = convertToTensor(b, 'b', 'squaredDifference');\n [$a, $b] = makeTypesMatch($a, $b);\n\n assertAndGetBroadcastShape($a.shape, $b.shape);\n\n const inputs: SquaredDifferenceInputs = {a: $a, b: $b};\n const attrs = {};\n\n return ENGINE.runKernel(\n SquaredDifference, inputs as unknown as NamedTensorMap, attrs);\n}\n\nexport const squaredDifference = op({squaredDifference_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {squeezeShape} from '../util';\n\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * Removes dimensions of size 1 from the shape of a `tf.Tensor`.\n *\n * ```js\n * const x = tf.tensor([1, 2, 3, 4], [1, 1, 4]);\n * x.squeeze().print();\n * ```\n *\n * @param x The input tensor to be squeezed.\n * @param axis An optional list of numbers. If specified, only\n * squeezes the dimensions listed. The dimension index starts at 0. It\n * is an error to squeeze a dimension that is not 1.\n *\n * @doc {heading: 'Tensors', subheading: 'Transformations'}\n */\nfunction squeeze_(x: Tensor|TensorLike, axis?: number[]): T {\n const $x = convertToTensor(x, 'x', 'squeeze', 'string_or_numeric');\n return reshape($x, squeezeShape($x.shape, axis).newShape) as T;\n}\n\nexport const squeeze = op({squeeze_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Pack, PackAttrs, PackInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensorArray} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\n\n/**\n * Stacks a list of rank-`R` `tf.Tensor`s into one rank-`(R+1)` `tf.Tensor`.\n *\n * ```js\n * const a = tf.tensor1d([1, 2]);\n * const b = tf.tensor1d([3, 4]);\n * const c = tf.tensor1d([5, 6]);\n * tf.stack([a, b, c]).print();\n * ```\n *\n * @param tensors A list of tensor objects with the same shape and dtype.\n * @param axis The axis to stack along. Defaults to 0 (the first dim).\n *\n * @doc {heading: 'Tensors', subheading: 'Slicing and Joining'}\n */\nfunction stack_(\n tensors: Array, axis = 0): Tensor {\n const $tensors =\n convertToTensorArray(tensors, 'tensors', 'stack', 'string_or_numeric');\n\n util.assert(\n $tensors.length >= 1, () => 'Pass at least one tensor to tf.stack');\n\n if ($tensors.length > 0) {\n util.assert(\n axis <= $tensors[0].rank, () => 'Axis must be <= rank of the tensor');\n }\n\n const inputs: PackInputs = $tensors;\n const attrs: PackAttrs = {axis};\n\n return ENGINE.runKernel(\n Pack, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const stack = op({stack_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Step, StepAttrs, StepInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes step of the input `tf.Tensor` element-wise: `x > 0 ? 1 : alpha * x`\n *\n * ```js\n * const x = tf.tensor1d([0, 2, -1, -3]);\n *\n * x.step(.5).print(); // or tf.step(x, .5)\n * ```\n * @param x The input tensor.\n * @param alpha The gradient when input is negative.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction step_(x: T|TensorLike, alpha = 0.0): T {\n const $x = convertToTensor(x, 'x', 'step');\n\n const inputs: StepInputs = {x: $x};\n const attrs: StepAttrs = {alpha};\n\n return ENGINE.runKernel(\n Step, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\nexport const step = op({step_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {StridedSlice, StridedSliceAttrs, StridedSliceInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Extracts a strided slice of a tensor.\n *\n * Roughly speaking, this op extracts a slice of size (end-begin)/stride from\n * the given input tensor (x). Starting at the location specified by begin the\n * slice continues by adding stride to the index until all dimensions are not\n * less than end. Note that a stride can be negative, which causes a reverse\n * slice.\n *\n * ```js\n * const t = tf.tensor3d([1, 1, 1 ,2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6],\n * [3, 2, 3]);\n * t.stridedSlice([1, 0, 0], [2, 1, 3], [1, 1, 1]).print() // [[[3, 3, 3]]]\n * t.stridedSlice([1, 0, 0], [2, 2, 3], [1, 1, 1]).print() // [[[3, 3, 3],\n * // [4, 4, 4]]]\n * t.stridedSlice([1, -1, 0], [2, -3, 3], [1, -1, 1]).print() // [[[4, 4, 4],\n * // [3, 3, 3]]]\n * ```\n *\n * @param x The tensor to stride slice.\n * @param begin The coordinates to start the slice from.\n * @param end: The coordinates to end the slice at.\n * @param strides: The size of the slice.\n * @param beginMask: If the ith bit of beginMask is set, begin[i] is ignored\n * and the fullest possible range in that dimension is used instead.\n * @param endMask: If the ith bit of endMask is set, end[i] is ignored\n * and the fullest possible range in that dimension is used instead.\n * @param shrinkAxisMask: a bitmask where bit i implies that\n * the ith specification should shrink the dimensionality. begin and end must\n * imply a slice of size 1 in the dimension.\n *\n * @doc {heading: 'Operations', subheading: 'Slicing and Joining'}\n */\nfunction stridedSlice_(\n x: Tensor|TensorLike, begin: number[], end: number[], strides?: number[],\n beginMask = 0, endMask = 0, ellipsisMask = 0, newAxisMask = 0,\n shrinkAxisMask = 0): Tensor {\n const $x = convertToTensor(x, 'x', 'stridedSlice', 'string_or_numeric');\n\n const inputs: StridedSliceInputs = {x: $x};\n const attrs: StridedSliceAttrs = {\n begin,\n end,\n strides,\n beginMask,\n endMask,\n ellipsisMask,\n newAxisMask,\n shrinkAxisMask\n };\n\n return ENGINE.runKernel(\n StridedSlice, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap);\n}\n\nexport const stridedSlice = op({stridedSlice_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Tan, TanInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Computes tan of the input `tf.Tensor` element-wise, `tan(x)`\n *\n * ```js\n * const x = tf.tensor1d([0, Math.PI / 2, Math.PI * 3 / 4]);\n *\n * x.tan().print(); // or tf.tan(x)\n * ```\n * @param x The input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Basic math'}\n */\nfunction tan_(x: T|TensorLike): T {\n const $x = convertToTensor(x, 'x', 'tan', 'float32');\n\n const inputs: TanInputs = {x: $x};\n\n return ENGINE.runKernel(Tan, inputs as {} as NamedTensorMap);\n}\nexport const tan = op({tan_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor1D} from '../tensor';\nimport {inferShape} from '../tensor_util_env';\nimport {TensorLike1D} from '../types';\nimport {DataType} from '../types';\nimport {assertNonNull} from '../util';\nimport {makeTensor} from './tensor_ops_util';\n\n/**\n * Creates rank-1 `tf.Tensor` with the provided values, shape and dtype.\n *\n * The same functionality can be achieved with `tf.tensor`, but in general\n * we recommend using `tf.tensor1d` as it makes the code more readable.\n *\n * ```js\n * tf.tensor1d([1, 2, 3]).print();\n * ```\n *\n * @param values The values of the tensor. Can be array of numbers,\n * or a `TypedArray`.\n * @param dtype The data type.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nexport function tensor1d(values: TensorLike1D, dtype?: DataType): Tensor1D {\n assertNonNull(values);\n const inferredShape = inferShape(values, dtype);\n if (inferredShape.length !== 1) {\n throw new Error('tensor1d() requires values to be a flat/TypedArray');\n }\n const shape: number[] = null;\n return makeTensor(values, shape, inferredShape, dtype) as Tensor1D;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor2D} from '../tensor';\nimport {inferShape} from '../tensor_util_env';\nimport {TensorLike2D} from '../types';\nimport {DataType} from '../types';\nimport {assertNonNull} from '../util';\nimport {makeTensor} from './tensor_ops_util';\n\n/**\n * Creates rank-2 `tf.Tensor` with the provided values, shape and dtype.\n *\n * The same functionality can be achieved with `tf.tensor`, but in general\n * we recommend using `tf.tensor2d` as it makes the code more readable.\n *\n * ```js\n * // Pass a nested array.\n * tf.tensor2d([[1, 2], [3, 4]]).print();\n * ```\n * ```js\n * // Pass a flat array and specify a shape.\n * tf.tensor2d([1, 2, 3, 4], [2, 2]).print();\n * ```\n *\n * @param values The values of the tensor. Can be nested array of numbers,\n * or a flat array, or a `TypedArray`.\n * @param shape The shape of the tensor. If not provided, it is inferred from\n * `values`.\n * @param dtype The data type.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nexport function tensor2d(\n values: TensorLike2D, shape?: [number, number],\n dtype?: DataType): Tensor2D {\n assertNonNull(values);\n if (shape != null && shape.length !== 2) {\n throw new Error('tensor2d() requires shape to have two numbers');\n }\n const inferredShape = inferShape(values, dtype);\n if (inferredShape.length !== 2 && inferredShape.length !== 1) {\n throw new Error(\n 'tensor2d() requires values to be number[][] or flat/TypedArray');\n }\n if (inferredShape.length === 1 && shape == null) {\n throw new Error(\n 'tensor2d() requires shape to be provided when `values` ' +\n 'are a flat/TypedArray');\n }\n return makeTensor(values, shape, inferredShape, dtype) as Tensor2D;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor4D} from '../tensor';\nimport {inferShape} from '../tensor_util_env';\nimport {TensorLike4D} from '../types';\nimport {DataType} from '../types';\nimport {assertNonNull} from '../util';\nimport {makeTensor} from './tensor_ops_util';\n\n/**\n * Creates rank-4 `tf.Tensor` with the provided values, shape and dtype.\n *\n * The same functionality can be achieved with `tf.tensor`, but in general\n * we recommend using `tf.tensor4d` as it makes the code more readable.\n *\n * ```js\n * // Pass a nested array.\n * tf.tensor4d([[[[1], [2]], [[3], [4]]]]).print();\n * ```\n * ```js\n * // Pass a flat array and specify a shape.\n * tf.tensor4d([1, 2, 3, 4], [1, 2, 2, 1]).print();\n * ```\n *\n * @param values The values of the tensor. Can be nested array of numbers,\n * or a flat array, or a `TypedArray`.\n * @param shape The shape of the tensor. Optional. If not provided,\n * it is inferred from `values`.\n * @param dtype The data type.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nexport function tensor4d(\n values: TensorLike4D, shape?: [number, number, number, number],\n dtype?: DataType): Tensor4D {\n assertNonNull(values);\n if (shape != null && shape.length !== 4) {\n throw new Error('tensor4d() requires shape to have four numbers');\n }\n const inferredShape = inferShape(values, dtype);\n if (inferredShape.length !== 4 && inferredShape.length !== 1) {\n throw new Error(\n 'tensor4d() requires values to be number[][][][] or flat/TypedArray');\n }\n if (inferredShape.length === 1 && shape == null) {\n throw new Error(\n 'tensor4d() requires shape to be provided when `values` ' +\n 'are a flat array');\n }\n return makeTensor(values, shape, inferredShape, dtype) as Tensor4D;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor5D} from '../tensor';\nimport {inferShape} from '../tensor_util_env';\nimport {TensorLike5D} from '../types';\nimport {DataType} from '../types';\nimport {assertNonNull} from '../util';\nimport {makeTensor} from './tensor_ops_util';\n\n/**\n * Creates rank-5 `tf.Tensor` with the provided values, shape and dtype.\n *\n * The same functionality can be achieved with `tf.tensor`, but in general\n * we recommend using `tf.tensor5d` as it makes the code more readable.\n *\n * ```js\n * // Pass a nested array.\n * tf.tensor5d([[[[[1],[2]],[[3],[4]]],[[[5],[6]],[[7],[8]]]]]).print();\n * ```\n * ```js\n * // Pass a flat array and specify a shape.\n * tf.tensor5d([1, 2, 3, 4, 5, 6, 7, 8], [1, 2, 2, 2, 1]).print();\n * ```\n *\n * @param values The values of the tensor. Can be nested array of numbers,\n * or a flat array, or a `TypedArray`.\n * @param shape The shape of the tensor. Optional. If not provided,\n * it is inferred from `values`.\n * @param dtype The data type.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nexport function tensor5d(\n values: TensorLike5D, shape?: [number, number, number, number, number],\n dtype?: DataType): Tensor5D {\n assertNonNull(values);\n if (shape != null && shape.length !== 5) {\n throw new Error('tensor5d() requires shape to have five numbers');\n }\n const inferredShape = inferShape(values, dtype);\n if (inferredShape.length !== 5 && inferredShape.length !== 1) {\n throw new Error(\n 'tensor5d() requires values to be ' +\n 'number[][][][][] or flat/TypedArray');\n }\n if (inferredShape.length === 1 && shape == null) {\n throw new Error(\n 'tensor5d() requires shape to be provided when `values` ' +\n 'are a flat array');\n }\n return makeTensor(values, shape, inferredShape, dtype) as Tensor5D;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor6D} from '../tensor';\nimport {inferShape} from '../tensor_util_env';\nimport {TensorLike6D} from '../types';\nimport {DataType} from '../types';\nimport {assertNonNull} from '../util';\nimport {makeTensor} from './tensor_ops_util';\n\n/**\n * Creates rank-6 `tf.Tensor` with the provided values, shape and dtype.\n *\n * The same functionality can be achieved with `tf.tensor`, but in general\n * we recommend using `tf.tensor6d` as it makes the code more readable.\n *\n * ```js\n * // Pass a nested array.\n * tf.tensor6d([[[[[[1],[2]],[[3],[4]]],[[[5],[6]],[[7],[8]]]]]]).print();\n * ```\n * ```js\n * // Pass a flat array and specify a shape.\n * tf.tensor6d([1, 2, 3, 4, 5, 6, 7, 8], [1, 1, 2, 2, 2, 1]).print();\n * ```\n *\n * @param values The values of the tensor. Can be nested array of numbers,\n * or a flat array, or a `TypedArray`.\n * @param shape The shape of the tensor. Optional. If not provided,\n * it is inferred from `values`.\n * @param dtype The data type.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nexport function tensor6d(\n values: TensorLike6D,\n shape?: [number, number, number, number, number, number],\n dtype?: DataType): Tensor6D {\n assertNonNull(values);\n if (shape != null && shape.length !== 6) {\n throw new Error('tensor6d() requires shape to have six numbers');\n }\n const inferredShape = inferShape(values, dtype);\n if (inferredShape.length !== 6 && inferredShape.length !== 1) {\n throw new Error(\n 'tensor6d() requires values to be number[][][][][][] or ' +\n 'flat/TypedArray');\n }\n if (inferredShape.length === 1 && shape == null) {\n throw new Error(\n 'tensor6d() requires shape to be provided when `values` ' +\n 'are a flat array');\n }\n shape = shape ||\n inferredShape as [number, number, number, number, number, number];\n return makeTensor(values, shape, inferredShape, dtype) as Tensor6D;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {TopK, TopKAttrs, TopKInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Finds the values and indices of the `k` largest entries along the last\n * dimension.\n *\n * If the input is a vector (rank=1), finds the k largest entries in the vector\n * and outputs their values and indices as vectors. Thus values[j] is the j-th\n * largest entry in input, and its index is indices[j].\n * For higher rank inputs, computes the top k entries along the last dimension.\n *\n * If two elements are equal, the lower-index element appears first.\n *\n * ```js\n * const a = tf.tensor2d([[1, 5], [4, 3]]);\n * const {values, indices} = tf.topk(a);\n * values.print();\n * indices.print();\n * ```\n * @param x 1-D or higher `tf.Tensor` with last dimension being at least `k`.\n * @param k Number of top elements to look for along the last dimension.\n * @param sorted If true, the resulting `k` elements will be sorted by the\n * values in descending order.\n *\n * @doc {heading: 'Operations', subheading: 'Evaluation'}\n */\nfunction topk_(\n x: T|TensorLike, k = 1, sorted = true): {values: T, indices: T} {\n const $x = convertToTensor(x, 'x', 'topk');\n if ($x.rank === 0) {\n throw new Error('topk() expects the input to be of rank 1 or higher');\n }\n const lastDim = $x.shape[$x.shape.length - 1];\n\n if (k < 0) {\n throw new Error(`'k' passed to topk() must be >= 0 but got ${k}`);\n }\n\n if (k > lastDim) {\n throw new Error(\n `'k' passed to topk() must be <= the last dimension (${lastDim}) ` +\n `but got ${k}`);\n }\n\n const inputs: TopKInputs = {x: $x};\n const attrs: TopKAttrs = {k, sorted};\n\n const [values, indices] = ENGINE.runKernel(\n TopK, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap) as\n [T, T];\n\n return {values, indices};\n}\n\nexport const topk = op({topk_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport {DataType, Rank, ShapeMap} from '../types';\n\nimport {buffer} from './buffer';\nimport {op} from './operation';\nimport {MPRandGauss} from './rand_util';\n\n/**\n * Creates a `tf.Tensor` with values sampled from a truncated normal\n * distribution.\n *\n * ```js\n * tf.truncatedNormal([2, 2]).print();\n * ```\n *\n * The generated values follow a normal distribution with specified mean and\n * standard deviation, except that values whose magnitude is more than 2\n * standard deviations from the mean are dropped and re-picked.\n *\n * @param shape An array of integers defining the output tensor shape.\n * @param mean The mean of the normal distribution.\n * @param stdDev The standard deviation of the normal distribution.\n * @param dtype The data type of the output tensor.\n * @param seed The seed for the random number generator.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nfunction truncatedNormal_(\n shape: ShapeMap[R], mean = 0, stdDev = 1, dtype?: 'float32'|'int32',\n seed?: number): Tensor {\n if (dtype != null && (dtype as DataType) === 'bool') {\n throw new Error(`Unsupported data type $ { dtype }`);\n }\n const randGauss =\n new MPRandGauss(mean, stdDev, dtype, true /* truncated */, seed);\n const res = buffer(shape, dtype);\n for (let i = 0; i < res.values.length; i++) {\n res.values[i] = randGauss.nextValue();\n }\n return res.toTensor();\n}\n\nexport const truncatedNormal = op({truncatedNormal_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Unique, UniqueAttrs, UniqueInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor, Tensor1D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {assert} from '../util';\n\nimport {op} from './operation';\n\n/**\n * Finds unique elements along an axis of a tensor.\n *\n * It returns a tensor `values` containing all of the unique elements along the\n * `axis` of the given tensor `x` in the same order that they occur along the\n * `axis` in `x`; `x` does not need to be sorted. It also returns a tensor\n * `indices` the same size as the number of the elements in `x` along the `axis`\n * dimension. It contains the index in the unique output `values`.\n *\n * ```js\n * // A 1-D tensor\n * const a = tf.tensor1d([1, 1, 2, 4, 4, 4, 7, 8, 8]);\n * const {values, indices} = tf.unique(a);\n * values.print(); // [1, 2, 4, 7, 8,]\n * indices.print(); // [0, 0, 1, 2, 2, 2, 3, 4, 4]\n * ```\n *\n * ```js\n * // A 2-D tensor with axis=0\n * //\n * // 'a' is: [[1, 0, 0],\n * // [1, 0, 0],\n * // [2, 0, 0]]\n * const a = tf.tensor2d([[1, 0, 0], [1, 0, 0], [2, 0, 0]]);\n * const {values, indices} = tf.unique(a, 0)\n * values.print(); // [[1, 0, 0],\n * // [2, 0, 0]]\n * indices.print(); // [0, 0, 1]\n * ```\n *\n * ```js\n * // A 2-D tensor with axis=1\n * //\n * // 'a' is: [[1, 0, 0],\n * // [1, 0, 0],\n * // [2, 0, 0]]\n * const a = tf.tensor2d([[1, 0, 0], [1, 0, 0], [2, 0, 0]]);\n * const {values, indices} = tf.unique(a, 1)\n * values.print(); // [[1, 0],\n * // [1, 0],\n * // [2, 0]]\n * indices.print(); // [0, 1, 1]\n * ```\n * @param x A tensor (int32, string, bool).\n * @param axis The axis of the tensor to find the unique elements.\n * @returns [uniqueElements, indices] (see above for details)\n *\n * @doc {heading: 'Operations', subheading: 'Evaluation'}\n */\nfunction unique_(\n x: T|TensorLike, axis = 0): {values: T, indices: Tensor1D} {\n const $x = convertToTensor(x, 'x', 'unique', 'string_or_numeric');\n assert($x.rank > 0, () => 'The input tensor must be at least 1D');\n\n const inputs: UniqueInputs = {x: $x};\n const attrs: UniqueAttrs = {axis};\n const [values, indices] = ENGINE.runKernel(\n Unique, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as [T, Tensor1D];\n return {values, indices};\n}\n\nexport const unique = op({unique_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {UnsortedSegmentSum, UnsortedSegmentSumAttrs, UnsortedSegmentSumInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor, Tensor1D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {assert, isInt} from '../util';\n\nimport {op} from './operation';\n\n/**\n * Computes the sum along segments of a `tf.Tensor`.\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 3, 4]);\n * const segmentIds = tf.tensor1d([1, 2, 0, 1], 'int32');\n * const numSegments = 3;\n *\n * x.unsortedSegmentSum(segmentIds, numSegments).print()\n * //or tf.unsortedSegmentSum(x, segmentIds, numSegments)\n * ```\n * @param x The `tf.Tensor` that will be summed along its segments.\n * @param segmentIds A `tf.Tensor1D` whose rank is equal to the rank of `x`'s\n * dimension along the `axis`. Maps each element of `x` to a segment.\n * @param numSegments The number of distinct `segmentIds`.\n *\n * @doc {heading: 'Operations', subheading: 'Segment'}\n */\nfunction unsortedSegmentSum_(\n x: T|TensorLike, segmentIds: Tensor1D|TensorLike, numSegments: number): T {\n const $x = convertToTensor(x, 'x', 'unsortedSegmentSum');\n const $segmentIds =\n convertToTensor(segmentIds, 'segmentIds', 'unsortedSegmentSum', 'int32');\n assert(isInt(numSegments), () => 'numSegments must be of dtype int');\n\n const inputs: UnsortedSegmentSumInputs = {x: $x, segmentIds: $segmentIds};\n const attrs: UnsortedSegmentSumAttrs = {numSegments};\n\n return ENGINE.runKernel(\n UnsortedSegmentSum, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap);\n}\n\nexport const unsortedSegmentSum = op({unsortedSegmentSum_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Unpack, UnpackAttrs, UnpackInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {op} from './operation';\n\n/**\n * Unstacks a `tf.Tensor` of rank-`R` into a list of rank-`(R-1)` `tf.Tensor`s.\n *\n * ```js\n * const a = tf.tensor2d([1, 2, 3, 4], [2, 2]);\n *\n * tf.unstack(a).forEach(tensor => tensor.print());\n * ```\n *\n * @param x A tensor object.\n * @param axis The axis to unstack along. Defaults to 0 (the first dim).\n *\n * @doc {heading: 'Tensors', subheading: 'Slicing and Joining'}\n */\nfunction unstack_(x: Tensor|TensorLike, axis = 0): Tensor[] {\n const $x = convertToTensor(x, 'x', 'unstack', 'string_or_numeric');\n util.assert(\n axis >= -$x.shape.length && axis < $x.shape.length,\n () =>\n `Axis = ${axis} is not in [-${$x.shape.length}, ${$x.shape.length})`);\n\n const inputs: UnpackInputs = {value: $x};\n const attrs: UnpackAttrs = {axis};\n\n return ENGINE.runKernel(\n Unpack, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const unstack = op({unstack_});\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport {TensorLike} from '../types';\nimport {searchSorted} from './search_sorted';\n\n/**\n * Searches for where a value would go in a sorted sequence.\n *\n * This is not a method for checking containment (like javascript in).\n *\n * The typical use case for this operation is \"binning\", \"bucketing\", or\n * \"discretizing\". The values are assigned to bucket-indices based on the edges\n * listed in 'sortedSequence'. This operation returns the bucket-index for each\n * value.\n *\n * The index returned corresponds to the first edge greater than the value.\n *\n * The axis is not settable for this operation. It always operates on the\n * innermost dimension (axis=-1). The operation will accept any number of outer\n * dimensions.\n *\n * Note: This operation assumes that 'upperBound' is sorted along the\n * innermost axis, maybe using 'sort(..., axis=-1)'. If the sequence is not\n * sorted no error is raised and the content of the returned tensor is not well\n * defined.\n *\n * ```js\n * const seq = tf.tensor1d([0, 3, 9, 10, 10]);\n * const values = tf.tensor1d([0, 4, 10]);\n * const result = tf.upperBound(seq, values);\n * result.print(); // [1, 2, 5]\n * ```\n * @param sortedSequence: N-D. Sorted sequence.\n * @param values: N-D. Search values.\n * @return An N-D int32 tensor the size of values containing the result of\n * applying upper bound to each value. The result is not a global index to\n * the entire Tensor, but the index in the last dimension.\n * @doc {heading: 'Operations', subheading: 'Evaluation'}\n */\nexport function upperBound(\n sortedSequence: Tensor|TensorLike, values: Tensor|TensorLike): Tensor {\n return searchSorted(sortedSequence, values, 'right');\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {Tensor, Variable} from '../tensor';\nimport {DataType, Rank} from '../types';\n\n/**\n * Creates a new variable with the provided initial value.\n * ```js\n * const x = tf.variable(tf.tensor([1, 2, 3]));\n * x.assign(tf.tensor([4, 5, 6]));\n *\n * x.print();\n * ```\n *\n * @param initialValue Initial value for the tensor.\n * @param trainable If true, optimizers are allowed to update it.\n * @param name Name of the variable. Defaults to a unique id.\n * @param dtype If set, initialValue will be converted to the given type.\n *\n * @doc {heading: 'Tensors', subheading: 'Creation'}\n */\nexport function variable(\n initialValue: Tensor, trainable = true, name?: string,\n dtype?: DataType): Variable {\n return ENGINE.makeVariable(initialValue, trainable, name, dtype) as\n Variable;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/** An implementation of the Where kernel shared between cpu and webgl */\n\nimport {buffer} from '../ops/buffer';\nimport {Tensor2D} from '../tensor';\nimport {TypedArray} from '../types';\n\nexport function whereImpl(condShape: number[], condVals: TypedArray): Tensor2D {\n const indices = [];\n for (let i = 0; i < condVals.length; i++) {\n if (condVals[i]) {\n indices.push(i);\n }\n }\n\n const inBuffer = buffer(condShape, 'int32');\n\n const out = buffer([indices.length, condShape.length], 'int32');\n for (let i = 0; i < indices.length; i++) {\n const loc = inBuffer.indexToLoc(indices[i]);\n const offset = i * condShape.length;\n out.values.set(loc, offset);\n }\n return out.toTensor() as Tensor2D;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {whereImpl} from '../backends/where_impl';\nimport {Tensor, Tensor2D} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\n\n/**\n * Returns the coordinates of true elements of condition.\n *\n * The coordinates are returned in a 2-D tensor where the first dimension (rows)\n * represents the number of true elements, and the second dimension (columns)\n * represents the coordinates of the true elements. Keep in mind, the shape of\n * the output tensor can vary depending on how many true values there are in\n * input. Indices are output in row-major order. The resulting tensor has the\n * shape `[numTrueElems, condition.rank]`.\n *\n * This is analogous to calling the python `tf.where(cond)` without an x or y.\n *\n * ```js\n * const cond = tf.tensor1d([false, false, true], 'bool');\n * const result = await tf.whereAsync(cond);\n * result.print();\n * ```\n *\n * @doc {heading: 'Operations', subheading: 'Logical'}\n */\nasync function whereAsync_(condition: Tensor|TensorLike): Promise {\n const $condition =\n convertToTensor(condition, 'condition', 'whereAsync', 'bool');\n const vals = await $condition.data();\n const res = whereImpl($condition.shape, vals);\n if (condition !== $condition) {\n $condition.dispose();\n }\n return res;\n}\n\nexport const whereAsync = whereAsync_;\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {gather} from './gather';\nimport {reshape} from './reshape';\nimport {squeeze} from './squeeze';\nimport {whereAsync} from './where_async';\n\n/**\n * Apply boolean mask to tensor.\n *\n * ```js\n * const tensor = tf.tensor2d([1, 2, 3, 4, 5, 6], [3, 2]);\n * const mask = tf.tensor1d([1, 0, 1], 'bool');\n * const result = await tf.booleanMaskAsync(tensor, mask);\n * result.print();\n * ```\n *\n * @param tensor N-D tensor.\n * @param mask K-D boolean tensor, K <= N and K must be known statically.\n * @param axis A 0-D int Tensor representing the axis in tensor to mask from.\n * By default, axis is 0 which will mask from the first dimension.\n * Otherwise K + axis <= N.\n *\n * @doc {heading: 'Tensors', subheading: 'Slicing and Joining'}\n */\nasync function booleanMaskAsync_(\n tensor: Tensor|TensorLike, mask: Tensor|TensorLike,\n axis?: number): Promise {\n const $tensor = convertToTensor(tensor, 'tensor', 'boolMask');\n const $mask = convertToTensor(mask, 'mask', 'boolMask', 'bool');\n\n const axisFrom = axis == null ? 0 : axis;\n const maskDim = $mask.rank;\n const tensorShape = $tensor.shape;\n\n util.assert(maskDim > 0, () => 'mask cannot be scalar');\n util.assertShapesMatch(\n tensorShape.slice(axisFrom, axisFrom + maskDim), $mask.shape,\n `mask's shape must match the first K dimensions of tensor's shape,`);\n\n let leadingSize = 1;\n for (let i = axisFrom; i < axisFrom + maskDim; i++) {\n leadingSize *= tensorShape[i];\n }\n const targetTensorShape =\n tensorShape.slice(0, axisFrom)\n .concat([leadingSize], tensorShape.slice(axisFrom + maskDim));\n const reshapedTensor = reshape($tensor, targetTensorShape);\n const reshapedMask = reshape($mask, [-1]);\n const positivePositions = await whereAsync(reshapedMask);\n const indices = squeeze(positivePositions, [1]);\n\n const res = gather(reshapedTensor, indices, axisFrom);\n\n // Ensure no memory leak.\n if (tensor !== $tensor) {\n $tensor.dispose();\n }\n if (mask !== $mask) {\n $mask.dispose();\n }\n indices.dispose();\n reshapedTensor.dispose();\n reshapedMask.dispose();\n positivePositions.dispose();\n\n return res;\n}\n\nexport const booleanMaskAsync = booleanMaskAsync_;\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Scalar, Tensor} from '../tensor';\nimport {assertTypesMatch} from '../tensor_util';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {add} from './add';\nimport {div} from './div';\nimport {mul} from './mul';\nimport {op} from './operation';\nimport {pow} from './pow';\nimport {scalar} from './scalar';\nimport {sub} from './sub';\n\n/**\n * Compute the moving average of a variable.\n *\n * Without zeroDebias, the moving average operation is defined by:\n * `v += delta`\n * where\n * `delta = (1 - decay) * (x - v)`\n *\n * With zeroDebias (default), the `delta` term is scaled to debias the\n * effect of the (assumed) zero-initialization of `v`.\n * `delta /= (1 - decay ^ step)`\n *\n * For more details on the zero-debiasing algorithm, see:\n * https://arxiv.org/abs/1412.6980\n *\n * Note that this function is completely stateless and does not keep track of\n * step count. The step count needs to be maintained by the caller and passed\n * in as `step`.\n *\n * @param v The current moving average value.\n * @param x New input value, must have the same shape and dtype as `v`.\n * @param decay The decay factor. Typical values are 0.95 and 0.99.\n * @param step Step count.\n * @param zeroDebias: Whether zeroDebias is to be performed (default: `true`).\n * @returns The new moving average value.\n *\n * @doc {heading: 'Operations', subheading: 'Moving Average'}\n */\nfunction movingAverage_(\n v: T|TensorLike, x: T|TensorLike, decay: number|Scalar,\n step?: number|Scalar, zeroDebias = true): T {\n const $v = convertToTensor(v, 'v', 'movingAverage');\n const $x = convertToTensor(x, 'x', 'movingAverage');\n const $decay = convertToTensor(decay, 'decay', 'movingAverage');\n\n assertTypesMatch($v, $x);\n util.assert(\n util.arraysEqual($v.shape, $x.shape), () => 'Shape mismatch in v and x');\n\n const one = scalar(1);\n const oneMinusDecay = sub(one, $decay);\n\n let update = mul(sub($x, $v), oneMinusDecay);\n if (zeroDebias) {\n util.assert(\n step != null, () => 'When using zeroDebias: true, step is required.');\n const $step = convertToTensor(step, 'step', 'movingAverage');\n update = div(update, sub(one, pow($decay, $step)));\n }\n return add($v, update);\n}\n\nexport const movingAverage = op({movingAverage_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {ScatterNd, ScatterNdAttrs, ScatterNdInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {Rank, ShapeMap, TensorLike} from '../types';\n\nimport {op} from './operation';\nimport * as scatter_nd_util from './scatter_nd_util';\n\n/**\n * Creates a new tensor by applying sparse updates to individual\n * values or slices within a zero tensor of the given shape tensor according to\n * indices. This operator is the inverse of the `tf.gatherND` operator which\n * extracts values or slices from a given tensor.\n *\n * ```js\n * const indices = tf.tensor2d([4, 3, 1, 7], [4, 1], 'int32');\n * const updates = tf.tensor1d([9, 10, 11, 12]);\n * const shape = [8];\n * tf.scatterND(indices, updates, shape).print() //[0, 11, 0, 10, 9, 0, 0, 12]\n * ```\n *\n * @param indices The tensor contains the indices into the output tensor.\n * @param updates The tensor contains the value for the indices.\n * @param shape: The shape of the output tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Slicing and Joining'}\n */\nfunction scatterND_(\n indices: Tensor|TensorLike, updates: Tensor|TensorLike,\n shape: ShapeMap[R]): Tensor {\n const $indices = convertToTensor(indices, 'indices', 'scatterND', 'int32');\n const $updates = convertToTensor(updates, 'updates', 'scatterND');\n scatter_nd_util.validateInput($updates, $indices, shape);\n\n const inputs: ScatterNdInputs = {indices: $indices, updates: $updates};\n const attrs: ScatterNdAttrs = {shape};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n return ENGINE.runKernel(\n ScatterNd, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as Tensor;\n}\n\nexport const scatterND = op({scatterND_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor} from '../tensor';\n\n/**\n * Validate sparseToDense inputs.\n *\n * @param sparseIndices A 0-D, 1-D, or 2-D Tensor of type int32.\n * sparseIndices[i] contains the complete index where sparseValues[i] will be\n * placed.\n * @param sparseValues A 0-D or 1-D Tensor. Values\n * corresponding to each row of sparseIndices, or a scalar value to be used for\n * all sparse indices.\n * @param outputShape number[]. Shape of the dense output tensor.\n * @param validateIndices boolean. indice validation is not supported, error\n * will be thrown if it is set.\n */\nexport function validateInput(\n sparseIndices: Tensor, sparseValues: Tensor, outputShape: number[],\n defaultValues: Tensor) {\n if (sparseIndices.dtype !== 'int32') {\n throw new Error(\n 'tf.sparseToDense() expects the indices to be int32 type,' +\n ` but the dtype was ${sparseIndices.dtype}.`);\n }\n if (sparseIndices.rank > 2) {\n throw new Error(\n 'sparseIndices should be a scalar, vector, or matrix,' +\n ` but got shape ${sparseIndices.shape}.`);\n }\n\n const numElems = sparseIndices.rank > 0 ? sparseIndices.shape[0] : 1;\n const numDims = sparseIndices.rank > 1 ? sparseIndices.shape[1] : 1;\n\n if (outputShape.length !== numDims) {\n throw new Error(\n 'outputShape has incorrect number of elements:,' +\n ` ${outputShape.length}, should be: ${numDims}.`);\n }\n\n const numValues = sparseValues.size;\n if (!(sparseValues.rank === 0 ||\n sparseValues.rank === 1 && numValues === numElems)) {\n throw new Error(\n 'sparseValues has incorrect shape ' +\n `${sparseValues.shape}, should be [] or [${numElems}]`);\n }\n\n if (sparseValues.dtype !== defaultValues.dtype) {\n throw new Error('sparseValues.dtype must match defaultValues.dtype');\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {SparseToDense, SparseToDenseAttrs, SparseToDenseInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport * as sparse_to_dense from '../ops/sparse_to_dense_util';\nimport {Scalar, Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {Rank, ScalarLike, ShapeMap, TensorLike} from '../types';\n\nimport {op} from './operation';\n\n/**\n * Converts a sparse representation into a dense tensor.\n *\n * Builds an array dense with shape outputShape such that:\n *\n * // If sparseIndices is scalar\n * dense[i] = (i == sparseIndices ? sparseValues : defaultValue)\n *\n * // If sparseIndices is a vector, then for each i\n * dense[sparseIndices[i]] = sparseValues[i]\n *\n * // If sparseIndices is an n by d matrix, then for each i in [0, n)\n * dense[sparseIndices[i][0], ..., sparseIndices[i][d-1]] = sparseValues[i]\n * All other values in dense are set to defaultValue. If sparseValues is a\n * scalar, all sparse indices are set to this single value.\n *\n * If indices are repeated the final value is summed over all values for those\n * indices.\n *\n * ```js\n * const indices = tf.tensor1d([4, 5, 6, 1, 2, 3], 'int32');\n * const values = tf.tensor1d([10, 11, 12, 13, 14, 15], 'float32');\n * const shape = [8];\n * tf.sparseToDense(indices, values, shape).print();\n * ```\n *\n * @param sparseIndices A 0-D, 1-D, or 2-D Tensor of type int32.\n * sparseIndices[i] contains the complete index where sparseValues[i] will be\n * placed.\n * @param sparseValues A 0-D or 1-D Tensor. Values\n * corresponding to each row of sparseIndices, or a scalar value to be used for\n * all sparse indices.\n * @param outputShape Shape of the dense output tensor. The type is inferred.\n * @param defaultValue Scalar. Value to set for indices not specified in\n * sparseIndices. Defaults to zero.\n *\n * @doc {heading: 'Operations', subheading: 'Normalization'}\n */\nfunction sparseToDense_(\n sparseIndices: Tensor|TensorLike, sparseValues: Tensor|TensorLike,\n outputShape: ShapeMap[R], defaultValue: Scalar|ScalarLike = 0): Tensor {\n const $sparseIndices =\n convertToTensor(sparseIndices, 'sparseIndices', 'sparseToDense', 'int32');\n const $sparseValues = convertToTensor(\n sparseValues, 'sparseValues', 'sparseToDense', 'string_or_numeric');\n const $defaultValue = convertToTensor(\n defaultValue, 'defaultValue', 'sparseToDense', $sparseValues.dtype);\n\n sparse_to_dense.validateInput(\n $sparseIndices, $sparseValues, outputShape, $defaultValue);\n\n const inputs: SparseToDenseInputs = {\n sparseIndices: $sparseIndices,\n sparseValues: $sparseValues,\n defaultValue: $defaultValue\n };\n\n const attrs: SparseToDenseAttrs = {outputShape};\n\n return ENGINE.runKernel(\n SparseToDense, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap);\n}\n\nexport const sparseToDense = op({sparseToDense_});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {GatherNd, GatherNdInputs} from '../kernel_names';\nimport {Tensor} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {op} from './operation';\n\n/**\n * Gather slices from input tensor into a Tensor with shape specified by\n * `indices`.\n *\n * `indices` is a K-dimensional integer tensor, best thought of as a\n * (K-1)-dimensional tensor of indices into input, where each element defines a\n * slice of input:\n * output[\\\\(i_0, ..., i_{K-2}\\\\)] = input[indices[\\\\(i_0, ..., i_{K-2}\\\\)]]\n *\n * Whereas in `tf.gather`, `indices` defines slices into the first dimension of\n * input, in `tf.gatherND`, `indices` defines slices into the first N dimensions\n * of input, where N = indices.shape[-1].\n *\n * The last dimension of indices can be at most the rank of input:\n * indices.shape[-1] <= input.rank\n *\n * The last dimension of `indices` corresponds to elements\n * (if indices.shape[-1] == input.rank) or slices\n * (if indices.shape[-1] < input.rank) along dimension indices.shape[-1] of\n * input.\n * The output tensor has shape\n * indices.shape[:-1] + input.shape[indices.shape[-1]:]\n *\n * Note that on CPU, if an out of bound index is found, an error is returned. On\n * GPU, if an out of bound index is found, a 0 is stored in the corresponding\n * output value.\n *\n * ```js\n * const indices = tf.tensor2d([0, 1, 1, 0], [2,2], 'int32');\n * const input = tf.tensor2d([9, 10, 11, 12], [2, 2]);\n * tf.gatherND(input, indices).print() // [10, 11]\n * ```\n *\n * @param x The tensor from which to gather values.\n * @param indices Index tensor, must be of type int32.\n *\n * @doc {heading: 'Operations', subheading: 'Slicing and Joining'}\n */\nfunction gatherND_(x: Tensor|TensorLike, indices: Tensor|TensorLike): Tensor {\n const $indices = convertToTensor(indices, 'indices', 'gatherND', 'int32');\n const $x = convertToTensor(x, 'x', 'gatherND', 'string_or_numeric');\n\n const inputs: GatherNdInputs = {params: $x, indices: $indices};\n\n return ENGINE.runKernel(GatherNd, inputs as {} as NamedTensorMap);\n}\n\nexport const gatherND = op({gatherND_});\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport * as util from '../util';\n\n/**\n * Normalize noise shape based on provided tensor and noise shape.\n *\n * @param x Tensor.\n * @param noiseShape The shape for the randomly generated keep/drop flags, as\n * an array of numbers. Optional.\n * @returns Normalized noise shape.\n */\nexport function getNoiseShape(x: Tensor, noiseShape?: number[]): number[] {\n if (noiseShape == null) {\n return x.shape.slice();\n }\n if (util.arraysEqual(x.shape, noiseShape)) {\n return noiseShape;\n }\n if (x.shape.length === noiseShape.length) {\n const newDimension: number[] = [];\n for (let i = 0; i < x.shape.length; i++) {\n if (noiseShape[i] == null && x.shape[i] != null) {\n newDimension.push(x.shape[i]);\n } else {\n newDimension.push(noiseShape[i]);\n }\n }\n return newDimension;\n }\n\n return noiseShape;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport * as util from '../util';\n\nimport {add} from './add';\nimport {div} from './div';\nimport {getNoiseShape} from './dropout_util';\nimport {floor} from './floor';\nimport {mul} from './mul';\nimport {op} from './operation';\nimport {randomUniform} from './random_uniform';\n\n/**\n * Computes dropout.\n *\n * ```js\n * const x = tf.tensor1d([1, 2, 2, 1]);\n * const rate = 0.75;\n * const output = tf.dropout(x, rate);\n * output.print();\n * ```\n *\n * @param x A floating point Tensor or TensorLike.\n * @param rate A float in the range [0, 1). The probability that each element\n * of x is discarded.\n * @param noiseShape An array of numbers of type int32, representing the\n * shape for randomly generated keep/drop flags. If the noiseShape has null\n * value, it will be automatically replaced with the x's relative dimension\n * size. Optional.\n * @param seed Used to create random seeds. Optional.\n * @returns A Tensor of the same shape of x.\n *\n * @doc {heading: 'Operations', subheading: 'Dropout'}\n */\nfunction dropout_(\n x: Tensor|TensorLike, rate: number, noiseShape?: number[],\n seed?: number|string): Tensor {\n const $x = convertToTensor(x, 'x', 'dropout');\n\n util.assert(\n $x.dtype === 'float32',\n () => `x has to be a floating point tensor since it's going to be ` +\n `scaled, but got a ${$x.dtype} tensor instead.`);\n util.assert(\n rate >= 0 && rate < 1,\n () => `rate must be a float in the range [0, 1), but got ${rate}.`);\n\n if (rate === 0) {\n return x instanceof Tensor ? $x.clone() : $x;\n }\n\n const $noiseShape = getNoiseShape($x, noiseShape);\n const keepProb = 1 - rate;\n const multiplier = div(\n floor(add(randomUniform($noiseShape, 0, 1, 'float32', seed), keepProb)),\n keepProb);\n\n return mul($x, multiplier);\n}\n\nexport const dropout = op({dropout_});\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor1D} from '../tensor';\nimport {tensor1d} from './tensor1d';\n\nexport function enclosingPowerOfTwo(value: number) {\n // Return 2**N for integer N such that 2**N >= value.\n return Math.floor(Math.pow(2, Math.ceil(Math.log(value) / Math.log(2.0))));\n}\n\nexport function cosineWindow(\n windowLength: number, a: number, b: number): Tensor1D {\n const even = 1 - windowLength % 2;\n const newValues = new Float32Array(windowLength);\n for (let i = 0; i < windowLength; ++i) {\n const cosArg = (2.0 * Math.PI * i) / (windowLength + even - 1);\n newValues[i] = a - b * Math.cos(cosArg);\n }\n return tensor1d(newValues, 'float32');\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\nimport {convertToTensor} from '../tensor_util_env';\nimport {TensorLike} from '../types';\nimport {assert, assertShapesMatch, getTypedArrayFromDType} from '../util';\nimport {tensor} from './tensor';\n\n/**\n * Returns whether the targets are in the top K predictions.\n *\n * ```js\n * const predictions = tf.tensor2d([[20, 10, 40, 30], [30, 50, -20, 10]]);\n * const targets = tf.tensor1d([2, 0]);\n * const precision = await tf.inTopKAsync(predictions, targets);\n * precision.print();\n * ```\n * @param predictions 2-D or higher `tf.Tensor` with last dimension being\n * at least `k`.\n * @param targets 1-D or higher `tf.Tensor`.\n * @param k Optional Number of top elements to look at for computing precision,\n * default to 1.\n *\n * @doc {heading: 'Operations', subheading: 'Evaluation'}\n */\nasync function inTopKAsync_(\n predictions: T|TensorLike, targets: U|TensorLike, k = 1): Promise {\n const $predictions = convertToTensor(predictions, 'predictions', 'inTopK');\n const $targets = convertToTensor(targets, 'targets', 'inTopK');\n\n assert(\n $predictions.rank > 1,\n () => 'inTopK() expects the predictions to be of rank 2 or higher, ' +\n `but got ${$predictions.rank}`);\n assert(\n $predictions.rank - 1 === $targets.rank,\n () => `predictions rank should be 1 larger than ` +\n `targets rank, but got predictions rank ` +\n `${$predictions.rank} and targets rank ${$targets.rank}`);\n assertShapesMatch(\n $predictions.shape.slice(0, $predictions.shape.length - 1),\n $targets.shape,\n `predictions's shape should be align with the targets' shape, ` +\n 'except the last dimension.');\n const lastDim = $predictions.shape[$predictions.shape.length - 1];\n assert(\n k > 0 && k <= lastDim,\n () => `'k' passed to inTopK() must be > 0 && <= the predictions last ` +\n `dimension (${lastDim}), but got ${k}`);\n\n const predictionsVals = await $predictions.data();\n const targetsVals = await $targets.data();\n\n // Reshape predictionsVals into a 2d tensor [batch, lastDim]\n // and look up topK along lastDim.\n const [batch, size] = [predictionsVals.length / lastDim, lastDim];\n const precision = getTypedArrayFromDType('bool', batch);\n\n for (let b = 0; b < batch; b++) {\n const offset = b * size;\n const vals = predictionsVals.subarray(offset, offset + size);\n const valAndInd: Array<{value: number, index: number}> = [];\n for (let i = 0; i < vals.length; i++) {\n valAndInd.push({value: vals[i], index: i});\n }\n valAndInd.sort((a, b) => b.value - a.value);\n\n precision[b] = 0;\n for (let i = 0; i < k; i++) {\n if (valAndInd[i].index === targetsVals[b]) {\n precision[b] = 1;\n break;\n }\n }\n }\n\n if (predictions !== $predictions) {\n $predictions.dispose();\n }\n if (targets !== $targets) {\n $targets.dispose();\n }\n\n // Output precision has the same shape as targets.\n return tensor(precision, $targets.shape, 'bool') as U;\n}\n\nexport const inTopKAsync = inTopKAsync_;\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {Conv2DBackpropFilter, Conv2DBackpropFilterAttrs, Conv2DBackpropFilterInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor3D, Tensor4D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\nimport * as util from '../util';\n\nimport * as conv_util from './conv_util';\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\n/**\n * Computes the derivative of the filter of a 2D convolution.\n *\n * @param x The input tensor, of rank 4 or rank 3 of shape\n * [batch, height, width, inChannels]. If rank 3, batch of 1 is assumed.\n * @param dy The dy image, of rank 4 or rank 3, of shape\n * [batch, height, width, outDepth]. If rank 3, batch of 1 is assumed.\n * @param filterShape The shape of the filter, length 4,\n * [filterHeight, filterWidth, inDepth, outDepth].\n * @param strides The strides of the convolution: [strideHeight,\n * strideWidth].\n * @param pad A string from: 'same', 'valid'. The type of padding algorithm\n * used in the forward prop of the op.\n * @param dataFormat: An optional string from: \"NHWC\", \"NCHW\". Defaults to\n * \"NHWC\". Specify the data format of the input and output data. With the\n * default format \"NHWC\", the data is stored in the order of: [batch,\n * height, width, channels].\n * @param dimRoundingMode A string from: 'ceil', 'round', 'floor'. If none is\n * provided, it will default to truncate.\n */\nfunction conv2DBackpropFilter_(\n x: T, dy: T, filterShape: [number, number, number, number],\n strides: [number, number]|number,\n pad: 'valid'|'same'|number|conv_util.ExplicitPadding,\n dataFormat: 'NHWC'|'NCHW' = 'NHWC',\n dimRoundingMode?: 'floor'|'round'|'ceil'): Tensor4D {\n let x4D = x as Tensor4D;\n if (x.rank === 3) {\n x4D = reshape(x, [1, x.shape[0], x.shape[1], x.shape[2]]);\n }\n let dy4D = dy as Tensor4D;\n if (dy4D.rank === 3) {\n dy4D = reshape(dy, [1, dy.shape[0], dy.shape[1], dy.shape[2]]);\n }\n util.assert(\n x4D.rank === 4,\n () => `Error in conv2dDerFilter: input must be rank 4, but got shape ` +\n `${x4D.shape}.`);\n util.assert(\n dy4D.rank === 4,\n () => `Error in conv2dDerFilter: dy must be rank 4, but got shape ` +\n `${dy4D.shape}.`);\n util.assert(\n filterShape.length === 4,\n () => `Error in conv2dDerFilter: filterShape must be length 4, but got ` +\n `${filterShape}.`);\n const inDepth = dataFormat === 'NHWC' ? x4D.shape[3] : x4D.shape[1];\n const outDepth = dataFormat === 'NHWC' ? dy4D.shape[3] : dy4D.shape[1];\n util.assert(\n inDepth === filterShape[2],\n () => `Error in conv2dDerFilter: depth of input ${inDepth}) must ` +\n `match input depth in filter (${filterShape[2]}.`);\n util.assert(\n outDepth === filterShape[3],\n () => `Error in conv2dDerFilter: depth of dy (${outDepth}) must ` +\n `match output depth for filter (${filterShape[3]}).`);\n conv_util.checkPadOnDimRoundingMode('conv2dDerFilter', pad, dimRoundingMode);\n const inputs: Conv2DBackpropFilterInputs = {x: x4D, dy: dy4D};\n const attrs: Conv2DBackpropFilterAttrs =\n {strides, pad, dataFormat, dimRoundingMode, filterShape};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n return ENGINE.runKernel(\n Conv2DBackpropFilter, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as Tensor4D;\n}\n\nexport const conv2DBackpropFilter = op({conv2DBackpropFilter_});\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../tensor';\n\nimport * as broadcast_util from './broadcast_util';\nimport {elu} from './elu';\nimport {Activation} from './fused_types';\nimport {leakyRelu} from './leaky_relu';\nimport {mul} from './mul';\nimport {prelu} from './prelu';\nimport {relu} from './relu';\nimport {relu6} from './relu6';\nimport {reshape} from './reshape';\nimport {sigmoid} from './sigmoid';\nimport {step} from './step';\nimport {sum} from './sum';\n\n// Returns gradient for fused activation.\nexport function getFusedDyActivation(\n dy: Tensor, y: Tensor, activation: Activation): Tensor {\n if (activation == null || activation === 'linear') {\n return dy;\n }\n if (activation === 'relu') {\n return mul(dy, step(y));\n }\n throw new Error(\n `Cannot compute gradient for fused activation ${activation}.`);\n}\n\n// Returns gradient for fused bias.\nexport function getFusedBiasGradient(\n bias: Tensor, dyActivation: Tensor): Tensor {\n let res = dyActivation;\n const reduceAxes =\n broadcast_util.getReductionAxes(bias.shape, dyActivation.shape);\n if (reduceAxes.length > 0) {\n res = sum(res, reduceAxes);\n }\n return reshape(res, bias.shape);\n}\n\nexport function applyActivation(\n x: Tensor, activation: Activation, preluActivationWeights?: Tensor,\n leakyreluAlpha?: number): Tensor {\n if (activation === 'linear') {\n return x;\n } else if (activation === 'relu') {\n return relu(x);\n } else if (activation === 'elu') {\n return elu(x);\n } else if (activation === 'relu6') {\n return relu6(x);\n } else if (activation === 'prelu') {\n return prelu(x, preluActivationWeights);\n } else if (activation === 'leakyrelu') {\n return leakyRelu(x, leakyreluAlpha);\n } else if (activation === 'sigmoid') {\n return sigmoid(x);\n }\n throw new Error(`Unknown fused activation ${activation}.`);\n}\n\n// Whether we should call fused ops.\nexport const shouldFuse = (gradientDepth: number, activation: Activation) => {\n const gradientMode = gradientDepth > 0;\n return !gradientMode || activation === 'linear';\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {customGrad} from '../../gradients';\nimport {FusedConv2D, FusedConv2DAttrs, FusedConv2DInputs} from '../../kernel_names';\nimport {NamedAttrMap} from '../../kernel_registry';\nimport {Tensor, Tensor3D, Tensor4D} from '../../tensor';\nimport {GradSaveFunc, NamedTensorMap} from '../../tensor_types';\nimport {makeTypesMatch} from '../../tensor_util';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport * as util from '../../util';\nimport {add} from '../add';\nimport * as broadcast_util from '../broadcast_util';\nimport {conv2d as unfusedConv2d} from '../conv2d';\nimport {conv2DBackpropFilter} from '../conv2d_backprop_filter';\nimport {conv2DBackpropInput} from '../conv2d_backprop_input';\nimport * as conv_util from '../conv_util';\nimport {Activation} from '../fused_types';\nimport {applyActivation, getFusedBiasGradient, getFusedDyActivation, shouldFuse} from '../fused_util';\nimport {op} from '../operation';\nimport {reshape} from '../reshape';\n\n/**\n * Computes a 2D convolution over the input x, optionally fused with adding a\n * bias and applying an activation.\n *\n * ```js\n * const inputDepth = 2;\n * const inShape = [2, 2, 2, inputDepth];\n * const outputDepth = 2;\n * const fSize = 1;\n * const pad = 0;\n * const strides = 1;\n *\n * const x = tf.tensor4d( [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,\n * 16], inShape);\n * const w = tf.tensor4d([-1, 1, -2, 0.5], [fSize, fSize, inputDepth,\n * outputDepth]);\n *\n * tf.fused.conv2d({ x, filter: w, strides, pad, dataFormat: 'NHWC',\n * dilations: [1, 1], bias: tf.scalar(5), activation: 'relu' }).print();\n * ```\n *\n * @param obj An object with the following properties:\n * @param x The input tensor, of rank 4 or rank 3, of shape\n * `[batch, height, width, inChannels]`. If rank 3, batch of 1 is\n * assumed.\n * @param filter The filter, rank 4, of shape\n * `[filterHeight, filterWidth, inDepth, outDepth]`.\n * @param strides The strides of the convolution: `[strideHeight,\n * strideWidth]`.\n * @param pad The type of padding algorithm.\n * - `same` and stride 1: output will be of same size as input,\n * regardless of filter size.\n * - `valid` output will be smaller than input if filter is larger\n * than 1x1.\n * - For more info, see this guide:\n * [https://www.tensorflow.org/api_docs/python/tf/nn/convolution](\n * https://www.tensorflow.org/api_docs/python/tf/nn/convolution)\n * @param dataFormat An optional string from: \"NHWC\", \"NCHW\". Defaults to\n * \"NHWC\". Specify the data format of the input and output data. With the\n * default format \"NHWC\", the data is stored in the order of: [batch,\n * height, width, channels]. Only \"NHWC\" is currently supported.\n * @param dilations The dilation rates: `[dilationHeight, dilationWidth]`\n * in which we sample input values across the height and width dimensions\n * in atrous convolution. Defaults to `[1, 1]`. If `dilations` is a single\n * number, then `dilationHeight == dilationWidth`. If it is greater than\n * 1, then all values of `strides` must be 1.\n * @param dimRoundingMode A string from: 'ceil', 'round', 'floor'. If none is\n * provided, it will default to truncate.\n * @param bias Tensor to be added to the result.\n * @param activation Name of activation kernel (defaults to `linear`) to be\n * applied\n * after biasAdd.\n * @param preluActivationWeights Tensor of prelu weights to be applied as part\n * of a `prelu` activation, typically the same shape as `x`.\n * @param leakyreluAlpha Optional. Alpha to be applied as part of a `leakyrelu`\n * activation.\n */\nfunction fusedConv2d_({\n x,\n filter,\n strides,\n pad,\n dataFormat = 'NHWC',\n dilations = [1, 1],\n dimRoundingMode,\n bias,\n activation = 'linear',\n preluActivationWeights,\n leakyreluAlpha\n}: {\n x: T|TensorLike,\n filter: Tensor4D|TensorLike,\n strides: [number, number]|number,\n pad: 'valid'|'same'|number|conv_util.ExplicitPadding,\n dataFormat?: 'NHWC'|'NCHW',\n dilations?: [number, number]|number,\n dimRoundingMode?: 'floor'|'round'|'ceil',\n bias?: Tensor|TensorLike,\n activation?: Activation,\n preluActivationWeights?: Tensor,\n leakyreluAlpha?: number\n}): T {\n activation = activation || 'linear';\n\n if (shouldFuse(ENGINE.state.gradientDepth, activation) === false) {\n // TODO: Transpose bias and preluActivationWeights properly for NCHW\n // format before computation.\n util.assert(\n dataFormat === 'NHWC',\n () => `Error in fused conv2d: got dataFormat of ${dataFormat} but ` +\n `only NHWC is currently supported for the case of gradient depth ` +\n `is 0 and the activation is not linear.`);\n\n let result = unfusedConv2d(\n x, filter, strides, pad, dataFormat, dilations, dimRoundingMode);\n if (bias != null) {\n result = add(result, bias);\n }\n\n return applyActivation(\n result, activation, preluActivationWeights, leakyreluAlpha) as T;\n }\n\n const $x = convertToTensor(x, 'x', 'conv2d', 'float32');\n const $filter = convertToTensor(filter, 'filter', 'conv2d', 'float32');\n\n let x4D = $x as Tensor4D;\n let reshapedTo4D = false;\n\n if ($x.rank === 3) {\n reshapedTo4D = true;\n x4D = reshape($x, [1, $x.shape[0], $x.shape[1], $x.shape[2]]);\n }\n util.assert(\n x4D.rank === 4,\n () => `Error in fused conv2d: input must be rank 4, but got rank ` +\n `${x4D.rank}.`);\n util.assert(\n $filter.rank === 4,\n () => `Error in fused conv2d: filter must be rank 4, but got rank ` +\n `${$filter.rank}.`);\n conv_util.checkPadOnDimRoundingMode('fused conv2d', pad, dimRoundingMode);\n const inputChannels = dataFormat === 'NHWC' ? x4D.shape[3] : x4D.shape[1];\n util.assert(\n $filter.shape[2] === inputChannels,\n () => `Error in conv2d: depth of input (${inputChannels}) must match ` +\n `input depth for filter ${$filter.shape[2]}.`);\n util.assert(\n conv_util.eitherStridesOrDilationsAreOne(strides, dilations),\n () => 'Error in conv2D: Either strides or dilations must be 1. ' +\n `Got strides ${strides} and dilations '${dilations}'`);\n\n const convInfo = conv_util.computeConv2DInfo(\n x4D.shape, $filter.shape, strides, dilations, pad, dimRoundingMode);\n\n let $bias: Tensor;\n if (bias != null) {\n $bias = convertToTensor(bias, 'bias', 'fused conv2d');\n [$bias] = makeTypesMatch($bias, $x);\n\n // According to TensorFlow, the bias is supposed be a 1-D tensor or a\n // scalar.\n //\n // 3-D or 4-D bias is not disabled for NHWC format, because they are\n // currently being used in some cases. For examplem in our code base,\n // https://github.com/tensorflow/tfjs/blob/b53bd47e880367ae57493f0ea628abaf08db2d5d/tfjs-core/src/ops/fused/fused_conv2d_test.ts#L1972.\n if (dataFormat === 'NHWC') {\n broadcast_util.assertAndGetBroadcastShape(convInfo.outShape, $bias.shape);\n } else {\n util.assert(\n $bias.shape.length <= 1,\n () => `Error in fused conv2d: only supports scalar or 1-D Tensor ` +\n `bias for NCHW format but got the bias of ` +\n `rank-${$bias.shape.length}.`);\n\n util.assert(\n $bias.shape.length === 0 || $bias.shape[0] === convInfo.outChannels ||\n $bias.shape[0] === 1,\n () => `Error in fused conv2d: bias shape (${$bias.shape}) is not ` +\n `compatible with the number of output channels ` +\n `(${convInfo.outChannels})`);\n }\n }\n\n let $preluActivationWeights: Tensor;\n if (preluActivationWeights != null) {\n // PReLU's activation weights could be a scalar, a 1-D tensor or a 3-D\n // tensor.\n const alphaShape = preluActivationWeights.shape;\n util.assert(\n alphaShape.length <= 1 || alphaShape.length === 3,\n () => `Error in fused conv2d: only supports scalar, 1-D Tensor or ` +\n `3-D Tensor PReLU activation weights but got a tensor of ` +\n `rank-${alphaShape.length}.`);\n\n if (alphaShape.length === 1) {\n // Whether the data format is NCHW or NHWC, the 1-D PReLU activation\n // weights tensor should be aligned with the output channels of conv2d\n // result.\n util.assert(\n alphaShape[0] === 1 || alphaShape[0] === convInfo.outChannels,\n () => `Error in fused conv2d: PReLU activation weights ` +\n `(${alphaShape}) is not compatible with the number of output ` +\n `channels (${convInfo.outChannels}).`);\n } else if (alphaShape.length === 3) {\n // Whether the data format is NCHW or NHWC, the PReLU activation weights\n // tensor should has the compatible shape with the result of conv2d.\n try {\n broadcast_util.assertAndGetBroadcastShape(\n alphaShape, convInfo.outShape);\n } catch (e) {\n const errMsg =\n `Error in fused conv2d: PReLU activation weights (${alphaShape}) ` +\n `is not compatible with the output shape of the conv2d ` +\n `(${convInfo.outShape}).`;\n throw Error(errMsg);\n }\n }\n\n $preluActivationWeights = convertToTensor(\n preluActivationWeights, 'prelu weights', 'fused conv2d');\n }\n\n const grad = (dy: Tensor4D, saved: Tensor[]) => {\n util.assert(\n dataFormat === 'NHWC',\n () => `Error in gradient of fused conv2D: got dataFormat of ${\n dataFormat} but only NHWC is currently supported.`);\n\n const [$filter, x4D, y, $bias] =\n saved as [Tensor4D, Tensor4D, Tensor4D, Tensor];\n\n const dyActivation = getFusedDyActivation(dy, y, activation) as Tensor4D;\n\n util.assert(\n conv_util.tupleValuesAreOne(dilations),\n () => 'Error in gradient of fused conv2D: ' +\n `dilation rates greater than 1 ` +\n `are not yet supported in gradients. Got dilations '${dilations}'`);\n\n const xDer =\n conv2DBackpropInput(x4D.shape, dyActivation, $filter, strides, pad);\n const filterDer =\n conv2DBackpropFilter(x4D, dyActivation, $filter.shape, strides, pad);\n const der: Tensor[] = [xDer, filterDer];\n\n if ($bias != null) {\n const biasDer = getFusedBiasGradient($bias, dyActivation);\n der.push(biasDer);\n }\n return der;\n };\n\n const inputs: FusedConv2DInputs = {\n x: x4D,\n filter: $filter,\n bias: $bias,\n preluActivationWeights: $preluActivationWeights\n };\n\n const attrs: FusedConv2DAttrs = {\n strides,\n pad,\n dataFormat,\n dilations,\n dimRoundingMode,\n activation,\n leakyreluAlpha\n };\n\n // Depending on the the params passed in we will have different number of\n // inputs and thus a a different number of elements in the gradient.\n if (bias == null) {\n const customOp =\n customGrad((x4D: Tensor4D, filter: Tensor4D, save: GradSaveFunc) => {\n let res: Tensor4D|Tensor3D =\n // tslint:disable-next-line: no-unnecessary-type-assertion\n ENGINE.runKernel(\n FusedConv2D, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap);\n\n save([filter, x4D, res]);\n\n if (reshapedTo4D) {\n // tslint:disable-next-line: no-unnecessary-type-assertion\n res = reshape(res, [res.shape[1], res.shape[2], res.shape[3]]) as\n Tensor3D;\n }\n\n return {value: res, gradFunc: grad};\n });\n return customOp(x4D, $filter) as T;\n } else {\n const customOpWithBias = customGrad(\n (x4D: Tensor4D, filter: Tensor4D, bias: Tensor, save: GradSaveFunc) => {\n let res: Tensor4D|Tensor3D = ENGINE.runKernel(\n FusedConv2D, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap);\n\n save([filter, x4D, res, bias]);\n\n if (reshapedTo4D) {\n // tslint:disable-next-line: no-unnecessary-type-assertion\n res = reshape(res, [res.shape[1], res.shape[2], res.shape[3]]) as\n Tensor3D;\n }\n\n return {value: res, gradFunc: grad};\n });\n\n return customOpWithBias(x4D, $filter, $bias) as T;\n }\n}\nexport const conv2d = op({fusedConv2d_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {DepthwiseConv2dNativeBackpropFilter, DepthwiseConv2dNativeBackpropFilterAttrs, DepthwiseConv2dNativeBackpropFilterInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor3D, Tensor4D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\n\nimport {ExplicitPadding} from './conv_util';\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\nfunction depthwiseConv2dNativeBackpropFilter_(\n x: T, dy: T, filterShape: [number, number, number, number],\n strides: [number, number]|number,\n pad: 'valid'|'same'|number|ExplicitPadding,\n dilations: [number, number]|number = [1, 1],\n dimRoundingMode?: 'floor'|'round'|'ceil'): Tensor4D {\n let x4D = x as Tensor4D;\n if (x.rank === 3) {\n x4D = reshape(x, [1, x.shape[0], x.shape[1], x.shape[2]]);\n }\n let dy4D = dy as Tensor4D;\n if (dy4D.rank === 3) {\n dy4D = reshape(dy, [1, dy.shape[0], dy.shape[1], dy.shape[2]]);\n }\n\n const inputs: DepthwiseConv2dNativeBackpropFilterInputs = {x: x4D, dy: dy4D};\n const attrs: DepthwiseConv2dNativeBackpropFilterAttrs =\n {strides, pad, dimRoundingMode, dilations, filterShape};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n return ENGINE.runKernel(\n DepthwiseConv2dNativeBackpropFilter,\n inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap) as\n Tensor4D;\n}\n\nexport const depthwiseConv2dNativeBackpropFilter =\n op({depthwiseConv2dNativeBackpropFilter_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../engine';\nimport {DepthwiseConv2dNativeBackpropInput, DepthwiseConv2dNativeBackpropInputAttrs, DepthwiseConv2dNativeBackpropInputInputs} from '../kernel_names';\nimport {NamedAttrMap} from '../kernel_registry';\nimport {Tensor3D, Tensor4D} from '../tensor';\nimport {NamedTensorMap} from '../tensor_types';\n\nimport {ExplicitPadding} from './conv_util';\nimport {op} from './operation';\nimport {reshape} from './reshape';\n\nfunction depthwiseConv2dNativeBackpropInput_(\n xShape: [number, number, number, number], dy: T, filter: Tensor4D,\n strides: [number, number]|number,\n pad: 'valid'|'same'|number|ExplicitPadding,\n dilations: [number, number]|number = [1, 1],\n dimRoundingMode?: 'floor'|'round'|'ceil'): T {\n let dy4D = dy as Tensor4D;\n let reshapedTo4D = false;\n if (dy.rank === 3) {\n reshapedTo4D = true;\n dy4D = reshape(dy, [1, dy.shape[0], dy.shape[1], dy.shape[2]]);\n }\n\n const inputs: DepthwiseConv2dNativeBackpropInputInputs = {dy: dy4D, filter};\n const attrs: DepthwiseConv2dNativeBackpropInputAttrs =\n {strides, pad, dimRoundingMode, dilations, inputShape: xShape};\n\n const res =\n // tslint:disable-next-line: no-unnecessary-type-assertion\n ENGINE.runKernel(\n DepthwiseConv2dNativeBackpropInput, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as T;\n\n if (reshapedTo4D) {\n return reshape(res, [res.shape[1], res.shape[2], res.shape[3]]) as T;\n }\n return res;\n}\n\nexport const depthwiseConv2dNativeBackpropInput =\n op({depthwiseConv2dNativeBackpropInput_});\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {customGrad} from '../../gradients';\nimport {FusedDepthwiseConv2D, FusedDepthwiseConv2DAttrs, FusedDepthwiseConv2DInputs} from '../../kernel_names';\nimport {NamedAttrMap} from '../../kernel_registry';\nimport {Tensor, Tensor3D, Tensor4D} from '../../tensor';\nimport {GradSaveFunc, NamedTensorMap} from '../../tensor_types';\nimport {makeTypesMatch} from '../../tensor_util';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport * as util from '../../util';\nimport {add} from '../add';\nimport * as broadcast_util from '../broadcast_util';\nimport * as conv_util from '../conv_util';\nimport {depthwiseConv2d as unfusedDepthwiseConv2d} from '../depthwise_conv2d';\nimport {depthwiseConv2dNativeBackpropFilter} from '../depthwise_conv2d_native_backprop_filter';\nimport {depthwiseConv2dNativeBackpropInput} from '../depthwise_conv2d_native_backprop_input';\nimport {Activation} from '../fused_types';\nimport {applyActivation, getFusedBiasGradient, getFusedDyActivation, shouldFuse} from '../fused_util';\nimport {op} from '../operation';\nimport {reshape} from '../reshape';\n\n/**\n * Computes depthwise 2D convolution, optionally fused with adding a\n * bias and applying an activation.\n *\n * Given a 4D `input` array and a `filter` array of shape\n * `[filterHeight, filterWidth, inChannels, channelMultiplier]` containing\n * `inChannels` convolutional filters of depth 1, this op applies a\n * different filter to each input channel (expanding from 1 channel to\n * `channelMultiplier` channels for each), then concatenates the results\n * together. The output has `inChannels * channelMultiplier` channels.\n *\n * See\n * [https://www.tensorflow.org/api_docs/python/tf/nn/depthwise_conv2d](\n * https://www.tensorflow.org/api_docs/python/tf/nn/depthwise_conv2d)\n * for more details.\n *\n * @param obj An object with the following properties:\n * @param x The input tensor, of rank 4 or rank 3, of shape\n * `[batch, height, width, inChannels]`. If rank 3, batch of 1 is\n * assumed.\n * @param filter The filter tensor, rank 4, of shape\n * `[filterHeight, filterWidth, inChannels, channelMultiplier]`.\n * @param strides The strides of the convolution: `[strideHeight,\n * strideWidth]`. If strides is a single number, then `strideHeight ==\n * strideWidth`.\n * @param pad The type of padding algorithm.\n * - `same` and stride 1: output will be of same size as input,\n * regardless of filter size.\n * - `valid`: output will be smaller than input if filter is larger\n * than 1x1.\n * - For more info, see this guide:\n * [https://www.tensorflow.org/api_docs/python/tf/nn/convolution](\n * https://www.tensorflow.org/api_docs/python/tf/nn/convolution)\n * @param dilations The dilation rates: `[dilationHeight, dilationWidth]`\n * in which we sample input values across the height and width dimensions\n * in atrous convolution. Defaults to `[1, 1]`. If `rate` is a single\n * number, then `dilationHeight == dilationWidth`. If it is greater than\n * 1, then all values of `strides` must be 1.\n * @param dataFormat: An optional string from: \"NHWC\", \"NCHW\". Defaults to\n * \"NHWC\". Specify the data format of the input and output data. With the\n * default format \"NHWC\", the data is stored in the order of: [batch,\n * height, width, channels]. Only \"NHWC\" is currently supported.\n * @param dimRoundingMode A string from: 'ceil', 'round', 'floor'. If none is\n * provided, it will default to truncate.\n * @param bias Tensor to be added to the result.\n * @param activation Name of activation kernel (defaults to `linear`).\n * @param preluActivationWeights Tensor of prelu weights to be applied as part\n * of a `prelu` activation, typically the same shape as `x`.\n * @param leakyreluAlpha Optional. Alpha to be applied as part of a `leakyrelu`\n * activation.\n */\nfunction fusedDepthwiseConv2d_({\n x,\n filter,\n strides,\n pad,\n dataFormat = 'NHWC',\n dilations = [1, 1],\n dimRoundingMode,\n bias,\n activation = 'linear',\n preluActivationWeights,\n leakyreluAlpha\n}: {\n x: T|TensorLike,\n filter: Tensor4D|TensorLike,\n strides: [number, number]|number,\n pad: 'valid'|'same'|number,\n dataFormat?: 'NHWC'|'NCHW',\n dilations?: [number, number]|number,\n dimRoundingMode?: 'floor'|'round'|'ceil',\n bias?: Tensor|TensorLike,\n activation?: Activation,\n preluActivationWeights?: Tensor,\n leakyreluAlpha?: number\n}): T {\n if (shouldFuse(ENGINE.state.gradientDepth, activation) === false) {\n let result = unfusedDepthwiseConv2d(\n x, filter, strides, pad, dataFormat, dilations, dimRoundingMode);\n if (bias != null) {\n result = add(result, bias);\n }\n\n return applyActivation(\n result, activation, preluActivationWeights, leakyreluAlpha) as T;\n }\n\n const $x = convertToTensor(x, 'x', 'depthwiseConv2d', 'float32');\n const $filter =\n convertToTensor(filter, 'filter', 'depthwiseConv2d', 'float32');\n\n let x4D = $x as Tensor4D;\n let reshapedTo4D = false;\n if ($x.rank === 3) {\n reshapedTo4D = true;\n x4D = reshape($x, [1, $x.shape[0], $x.shape[1], $x.shape[2]]);\n }\n util.assert(\n x4D.rank === 4,\n () => `Error in fused depthwiseConv2d: input must be rank 4, but got ` +\n `rank ${x4D.rank}.`);\n util.assert(\n $filter.rank === 4,\n () => `Error in fused depthwiseConv2d: filter must be rank 4, ` +\n `but got rank ${$filter.rank}.`);\n util.assert(\n x4D.shape[3] === $filter.shape[2],\n () => `Error in fused depthwiseConv2d: number of input channels ` +\n `(${x4D.shape[3]}) must match the inChannels dimension in ` +\n `filter ${$filter.shape[2]}.`);\n if (dilations == null) {\n dilations = [1, 1];\n }\n util.assert(\n conv_util.eitherStridesOrDilationsAreOne(strides, dilations),\n () =>\n 'Error in fused depthwiseConv2d: Either strides or dilations must ' +\n `be 1. Got strides ${strides} and dilations '${dilations}'`);\n conv_util.checkPadOnDimRoundingMode(\n 'fused depthwiseConv2d', pad, dimRoundingMode);\n const convInfo = conv_util.computeConv2DInfo(\n x4D.shape, $filter.shape, strides, dilations, pad, dimRoundingMode,\n true /* depthwise */);\n\n let $bias: Tensor;\n if (bias != null) {\n $bias = convertToTensor(bias, 'bias', 'fused conv2d');\n [$bias] = makeTypesMatch($bias, $x);\n\n broadcast_util.assertAndGetBroadcastShape(convInfo.outShape, $bias.shape);\n }\n\n let $preluActivationWeights: Tensor;\n if (preluActivationWeights != null) {\n $preluActivationWeights = convertToTensor(\n preluActivationWeights, 'prelu weights', 'fused depthwiseConv2d');\n }\n\n const grad = (dy: Tensor4D, saved: Tensor[]) => {\n util.assert(\n conv_util.tupleValuesAreOne(dilations),\n () => 'Error in gradient of fused depthwiseConv2d: dilation rates ' +\n `greater than 1 are not yet supported. Got dilations ` +\n `'${dilations}'`);\n const [$filter, x4D, y, bias] = saved;\n\n const dyActivation = getFusedDyActivation(dy, y, activation) as Tensor4D;\n\n const xDer = depthwiseConv2dNativeBackpropInput(\n (x4D as Tensor4D).shape, dyActivation, $filter as Tensor4D, strides,\n pad, dilations, dimRoundingMode);\n const filterDer = depthwiseConv2dNativeBackpropFilter(\n x4D as Tensor4D, dyActivation, ($filter as Tensor4D).shape, strides,\n pad, dilations, dimRoundingMode);\n\n if (bias != null) {\n const biasDer = getFusedBiasGradient($bias, dyActivation);\n return [xDer, filterDer, biasDer];\n }\n return [xDer, filterDer];\n };\n\n const inputs: FusedDepthwiseConv2DInputs = {\n x: x4D,\n filter: $filter,\n bias: $bias,\n preluActivationWeights: $preluActivationWeights\n };\n const attrs: FusedDepthwiseConv2DAttrs = {\n strides,\n pad,\n dataFormat,\n dilations,\n dimRoundingMode,\n activation,\n leakyreluAlpha\n };\n\n // Depending on the the params passed in we will have different number of\n // inputs and thus a a different number of elements in the gradient.\n if (bias == null) {\n const customOp =\n customGrad((x4D: Tensor4D, filter: Tensor4D, save: GradSaveFunc) => {\n // tslint:disable-next-line: no-unnecessary-type-assertion\n let res: Tensor4D|Tensor3D = ENGINE.runKernel(\n FusedDepthwiseConv2D, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap);\n\n save([filter, x4D, res]);\n\n if (reshapedTo4D) {\n // tslint:disable-next-line: no-unnecessary-type-assertion\n res = reshape(res, [res.shape[1], res.shape[2], res.shape[3]]) as\n Tensor3D;\n }\n\n return {value: res, gradFunc: grad};\n });\n return customOp(x4D, $filter) as T;\n } else {\n const customOpWithBias = customGrad(\n (x4D: Tensor4D, filter: Tensor4D, bias: Tensor, save: GradSaveFunc) => {\n // tslint:disable-next-line: no-unnecessary-type-assertion\n let res: Tensor4D|Tensor3D = ENGINE.runKernel(\n FusedDepthwiseConv2D, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap);\n\n save([filter, x4D, res, bias]);\n\n if (reshapedTo4D) {\n // tslint:disable-next-line: no-unnecessary-type-assertion\n res = reshape(res, [res.shape[1], res.shape[2], res.shape[3]]) as\n Tensor3D;\n }\n\n return {value: res, gradFunc: grad};\n });\n\n return customOpWithBias(x4D, $filter, $bias) as T;\n }\n}\nexport const depthwiseConv2d = op({fusedDepthwiseConv2d_});\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {customGrad} from '../../gradients';\nimport {_FusedMatMul, _FusedMatMulAttrs, _FusedMatMulInputs} from '../../kernel_names';\nimport {NamedAttrMap} from '../../kernel_registry';\nimport {Tensor, Tensor3D} from '../../tensor';\nimport {GradSaveFunc, NamedTensorMap} from '../../tensor_types';\nimport {makeTypesMatch} from '../../tensor_util';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport * as util from '../../util';\n\nimport {add} from '../add';\nimport * as broadcast_util from '../broadcast_util';\nimport {Activation} from '../fused_types';\nimport {applyActivation, getFusedBiasGradient, getFusedDyActivation, shouldFuse} from '../fused_util';\nimport {matMul as unfusedMatMul} from '../mat_mul';\nimport {op} from '../operation';\nimport {reshape} from '../reshape';\n\n/**\n * Computes the dot product of two matrices with optional activation and bias.\n *\n * ```js\n * const a = tf.tensor2d([-1, -2], [1, 2]);\n * const b = tf.tensor2d([1, 2, 3, 4], [2, 2]);\n * const bias = tf.tensor2d([1, 2], [1, 2]);\n *\n * tf.fused.matMul({a, b, bias, activation: 'relu'}).print();\n * ```\n *\n * @param obj An object with the following properties:\n * - `a` First matrix in dot product operation.\n * - `b` Second matrix in dot product operation.\n * - `transposeA` If true, `a` is transposed before multiplication.\n * - `transposeB` If true, `b` is transposed before multiplication.\n * - `bias` Matrix to be added to the result.\n * - `activation` Name of activation kernel (defaults to `linear`).\n * - `preluActivationWeights` Tensor of prelu weights.\n * - `leakyreluAlpha` Alpha of leakyrelu.\n */\nfunction fusedMatMul_({\n a,\n b,\n transposeA = false,\n transposeB = false,\n bias,\n activation = 'linear',\n preluActivationWeights,\n leakyreluAlpha = 0.2,\n}: {\n a: Tensor|TensorLike,\n b: Tensor|TensorLike,\n transposeA?: boolean,\n transposeB?: boolean,\n bias?: Tensor|TensorLike,\n activation?: Activation,\n preluActivationWeights?: Tensor\n leakyreluAlpha?: number\n}): Tensor {\n if (shouldFuse(ENGINE.state.gradientDepth, activation) === false) {\n let result = unfusedMatMul(a, b, transposeA, transposeB);\n if (bias != null) {\n result = add(result, bias);\n }\n\n return applyActivation(\n result, activation, preluActivationWeights, leakyreluAlpha);\n }\n\n let $a = convertToTensor(a, 'a', 'fused matMul');\n let $b = convertToTensor(b, 'b', 'fused matMul');\n [$a, $b] = makeTypesMatch($a, $b);\n\n const innerShapeA =\n transposeA ? $a.shape[$a.rank - 2] : $a.shape[$a.rank - 1];\n const innerShapeB =\n transposeB ? $b.shape[$b.rank - 1] : $b.shape[$b.rank - 2];\n\n const outerShapeA =\n transposeA ? $a.shape[$a.rank - 1] : $a.shape[$a.rank - 2];\n const outerShapeB =\n transposeB ? $b.shape[$b.rank - 2] : $b.shape[$b.rank - 1];\n\n const outerDimsA = $a.shape.slice(0, -2);\n const outerDimsB = $b.shape.slice(0, -2);\n const batchDimA = util.sizeFromShape(outerDimsA);\n const batchDimB = util.sizeFromShape(outerDimsB);\n\n util.assert(\n innerShapeA === innerShapeB,\n () => `Error in fused matMul: inner shapes (${innerShapeA}) and (` +\n `${innerShapeB}) of Tensors with shapes ${$a.shape} and ` +\n `${$b.shape} and transposeA=${transposeA}` +\n ` and transposeB=${transposeB} must match.`);\n\n const outShapeOuterDims = broadcast_util.assertAndGetBroadcastShape(\n $a.shape.slice(0, -2), $b.shape.slice(0, -2));\n const outShape = outShapeOuterDims.concat([outerShapeA, outerShapeB]);\n\n const a3D: Tensor3D = transposeA ?\n reshape($a, [batchDimA, innerShapeA, outerShapeA]) :\n reshape($a, [batchDimA, outerShapeA, innerShapeA]);\n const b3D: Tensor3D = transposeB ?\n reshape($b, [batchDimB, outerShapeB, innerShapeB]) :\n reshape($b, [batchDimB, innerShapeB, outerShapeB]);\n\n let $bias: Tensor;\n if (bias != null) {\n $bias = convertToTensor(bias, 'bias', 'fused matMul');\n [$bias] = makeTypesMatch($bias, $a);\n\n broadcast_util.assertAndGetBroadcastShape(outShape, $bias.shape);\n }\n\n let $preluActivationWeights: Tensor;\n if (preluActivationWeights != null) {\n $preluActivationWeights = convertToTensor(\n preluActivationWeights, 'prelu weights', 'fused matMul');\n }\n\n const grad = (dy: Tensor3D, saved: Tensor[]) => {\n const [a3D, b3D, y, $bias] = saved;\n // we reshape dy because the result of the forward is not\n // necessarily going to be a 3d tensor due to a reshape done at the end of\n // the customOp.\n const dyActivation =\n getFusedDyActivation(reshape(dy, y.shape), y, activation);\n let aDer: Tensor;\n let bDer: Tensor;\n\n if (!transposeA && !transposeB) {\n aDer = unfusedMatMul(dyActivation, b3D, false, true);\n bDer = unfusedMatMul(a3D, dyActivation, true, false);\n } else if (!transposeA && transposeB) {\n aDer = unfusedMatMul(dyActivation, b3D, false, false);\n bDer = unfusedMatMul(dyActivation, a3D, true, false);\n } else if (transposeA && !transposeB) {\n aDer = unfusedMatMul(b3D, dyActivation, false, true);\n bDer = unfusedMatMul(a3D, dyActivation, false, false);\n } else {\n aDer = unfusedMatMul(b3D, dyActivation, true, true);\n bDer = unfusedMatMul(dyActivation, a3D, true, true);\n }\n\n if (bias != null) {\n const biasDer = getFusedBiasGradient($bias, dyActivation);\n return [aDer, bDer, biasDer];\n } else {\n return [aDer, bDer];\n }\n };\n\n const inputs: _FusedMatMulInputs = {\n a: a3D,\n b: b3D,\n bias: $bias,\n preluActivationWeights: $preluActivationWeights\n };\n const attrs: _FusedMatMulAttrs =\n {transposeA, transposeB, activation, leakyreluAlpha};\n\n // Depending on the the params passed in we will have different number of\n // inputs and thus a a different number of elements in the gradient.\n if (bias == null) {\n const customOp =\n customGrad((a3D: Tensor3D, b3D: Tensor3D, save: GradSaveFunc) => {\n const res =\n // tslint:disable-next-line: no-unnecessary-type-assertion\n ENGINE.runKernel(\n _FusedMatMul, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as Tensor;\n\n save([a3D, b3D, res]);\n\n return {value: reshape(res, outShape), gradFunc: grad};\n });\n return customOp(a3D, b3D);\n } else {\n const customOpWithBias = customGrad(\n (a3D: Tensor3D, b3D: Tensor3D, $bias: Tensor, save: GradSaveFunc) => {\n const res =\n // tslint:disable-next-line: no-unnecessary-type-assertion\n ENGINE.runKernel(\n _FusedMatMul, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as Tensor;\n\n save([a3D, b3D, res, $bias]);\n\n return {value: reshape(res, outShape), gradFunc: grad};\n });\n\n return customOpWithBias(a3D, b3D, $bias);\n }\n }\n\n export const matMul = op({fusedMatMul_});\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {conv2d} from './fused/conv2d';\nimport {depthwiseConv2d} from './fused/depthwise_conv2d';\nimport {matMul} from './fused/mat_mul';\nimport {Activation} from './fused_types';\n\nexport {Activation, conv2d, depthwiseConv2d, matMul};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor1D} from '../../tensor';\nimport {op} from '../operation';\nimport {cosineWindow} from '../signal_ops_util';\n\n/**\n * Generate a hamming window.\n *\n * See: https://en.wikipedia.org/wiki/Window_function#Hann_and_Hamming_windows\n *\n * ```js\n * tf.signal.hammingWindow(10).print();\n * ```\n * @param The length of window\n *\n * @doc {heading: 'Operations', subheading: 'Signal', namespace: 'signal'}\n */\nfunction hammingWindow_(windowLength: number): Tensor1D {\n return cosineWindow(windowLength, 0.54, 0.46);\n}\nexport const hammingWindow = op({hammingWindow_});\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor1D} from '../../tensor';\nimport {op} from '../operation';\nimport {cosineWindow} from '../signal_ops_util';\n\n/**\n * Generate a Hann window.\n *\n * See: https://en.wikipedia.org/wiki/Window_function#Hann_and_Hamming_windows\n *\n * ```js\n * tf.signal.hannWindow(10).print();\n * ```\n * @param The length of window\n *\n * @doc {heading: 'Operations', subheading: 'Signal', namespace: 'signal'}\n */\nfunction hannWindow_(windowLength: number): Tensor1D {\n return cosineWindow(windowLength, 0.5, 0.5);\n}\n\nexport const hannWindow = op({hannWindow_});\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor, Tensor1D} from '../../tensor';\nimport {concat} from '../concat';\nimport {fill} from '../fill';\nimport {op} from '../operation';\nimport {reshape} from '../reshape';\nimport {slice} from '../slice';\nimport {tensor2d} from '../tensor2d';\n\n/**\n * Expands input into frames of frameLength.\n * Slides a window size with frameStep.\n *\n * ```js\n * tf.signal.frame([1, 2, 3], 2, 1).print();\n * ```\n * @param signal The input tensor to be expanded\n * @param frameLength Length of each frame\n * @param frameStep The frame hop size in samples.\n * @param padEnd Whether to pad the end of signal with padValue.\n * @param padValue A number to use where the input signal does\n * not exist when padEnd is True.\n *\n * @doc {heading: 'Operations', subheading: 'Signal', namespace: 'signal'}\n */\nfunction frame_(\n signal: Tensor1D, frameLength: number, frameStep: number, padEnd = false,\n padValue = 0): Tensor {\n let start = 0;\n const output: Tensor[] = [];\n while (start + frameLength <= signal.size) {\n output.push(slice(signal, start, frameLength));\n start += frameStep;\n }\n\n if (padEnd) {\n while (start < signal.size) {\n const padLen = (start + frameLength) - signal.size;\n const pad = concat([\n slice(signal, start, frameLength - padLen), fill([padLen], padValue)\n ]);\n output.push(pad);\n start += frameStep;\n }\n }\n\n if (output.length === 0) {\n return tensor2d([], [0, frameLength]);\n }\n\n return reshape(concat(output), [output.length, frameLength]);\n}\nexport const frame = op({frame_});\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor, Tensor1D} from '../../tensor';\nimport {mul} from '../mul';\nimport {op} from '../operation';\nimport {enclosingPowerOfTwo} from '../signal_ops_util';\nimport {rfft} from '../spectral/rfft';\n\nimport {frame} from './frame';\nimport {hannWindow} from './hann_window';\n\n/**\n * Computes the Short-time Fourier Transform of signals\n * See: https://en.wikipedia.org/wiki/Short-time_Fourier_transform\n *\n * ```js\n * const input = tf.tensor1d([1, 1, 1, 1, 1])\n * tf.signal.stft(input, 3, 1).print();\n * ```\n * @param signal 1-dimensional real value tensor.\n * @param frameLength The window length of samples.\n * @param frameStep The number of samples to step.\n * @param fftLength The size of the FFT to apply.\n * @param windowFn A callable that takes a window length and returns 1-d tensor.\n *\n * @doc {heading: 'Operations', subheading: 'Signal', namespace: 'signal'}\n */\nfunction stft_(\n signal: Tensor1D, frameLength: number, frameStep: number,\n fftLength?: number,\n windowFn: (length: number) => Tensor1D = hannWindow): Tensor {\n if (fftLength == null) {\n fftLength = enclosingPowerOfTwo(frameLength);\n }\n const framedSignal = frame(signal, frameLength, frameStep);\n const windowedSignal = mul(framedSignal, windowFn(frameLength));\n return rfft(windowedSignal, fftLength);\n}\nexport const stft = op({stft_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {CropAndResize, CropAndResizeAttrs, CropAndResizeInputs} from '../../kernel_names';\nimport {NamedAttrMap} from '../../kernel_registry';\nimport {Tensor1D, Tensor2D, Tensor4D} from '../../tensor';\nimport {NamedTensorMap} from '../../tensor_types';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport * as util from '../../util';\n\nimport {op} from '../operation';\n\n/**\n * Extracts crops from the input image tensor and resizes them using bilinear\n * sampling or nearest neighbor sampling (possibly with aspect ratio change)\n * to a common output size specified by cropSize.\n *\n * @param image 4d tensor of shape `[batch,imageHeight,imageWidth, depth]`,\n * where imageHeight and imageWidth must be positive, specifying the\n * batch of images from which to take crops\n * @param boxes 2d float32 tensor of shape `[numBoxes, 4]`. Each entry is\n * `[y1, x1, y2, x2]`, where `(y1, x1)` and `(y2, x2)` are the normalized\n * coordinates of the box in the `boxInd[i]`th image in the batch\n * @param boxInd 1d int32 tensor of shape `[numBoxes]` with values in range\n * `[0, batch)` that specifies the image that the `i`-th box refers to.\n * @param cropSize 1d int32 tensor of 2 elements `[cropHeigh, cropWidth]`\n * specifying the size to which all crops are resized to.\n * @param method Optional string from `'bilinear' | 'nearest'`,\n * defaults to bilinear, which specifies the sampling method for resizing\n * @param extrapolationValue A threshold for deciding when to remove boxes based\n * on score. Defaults to 0.\n * @return A 4D tensor of the shape `[numBoxes,cropHeight,cropWidth,depth]`\n *\n * @doc {heading: 'Operations', subheading: 'Images', namespace: 'image'}\n */\nfunction cropAndResize_(\n image: Tensor4D|TensorLike,\n boxes: Tensor2D|TensorLike,\n boxInd: Tensor1D|TensorLike,\n cropSize: [number, number],\n method: 'bilinear'|'nearest' = 'bilinear',\n extrapolationValue = 0,\n ): Tensor4D {\n const $image = convertToTensor(image, 'image', 'cropAndResize');\n const $boxes = convertToTensor(boxes, 'boxes', 'cropAndResize', 'float32');\n const $boxInd = convertToTensor(boxInd, 'boxInd', 'cropAndResize', 'int32');\n\n const numBoxes = $boxes.shape[0];\n\n util.assert(\n $image.rank === 4,\n () => 'Error in cropAndResize: image must be rank 4,' +\n `but got rank ${$image.rank}.`);\n util.assert(\n $boxes.rank === 2 && $boxes.shape[1] === 4,\n () => `Error in cropAndResize: boxes must be have size [${numBoxes},4] ` +\n `but had shape ${$boxes.shape}.`);\n util.assert(\n $boxInd.rank === 1 && $boxInd.shape[0] === numBoxes,\n () => `Error in cropAndResize: boxInd must be have size [${numBoxes}] ` +\n `but had shape ${$boxes.shape}.`);\n util.assert(\n cropSize.length === 2,\n () => `Error in cropAndResize: cropSize must be of length 2, but got ` +\n `length ${cropSize.length}.`);\n util.assert(\n cropSize[0] >= 1 && cropSize[1] >= 1,\n () => `cropSize must be atleast [1,1], but was ${cropSize}`);\n util.assert(\n method === 'bilinear' || method === 'nearest',\n () => `method must be bilinear or nearest, but was ${method}`);\n\n const inputs:\n CropAndResizeInputs = {image: $image, boxes: $boxes, boxInd: $boxInd};\n const attrs: CropAndResizeAttrs = {method, extrapolationValue, cropSize};\n const res = ENGINE.runKernel(\n CropAndResize, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap);\n return res as Tensor4D;\n}\n\nexport const cropAndResize = op({cropAndResize_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {FlipLeftRight, FlipLeftRightInputs} from '../../kernel_names';\nimport {Tensor4D} from '../../tensor';\nimport {NamedTensorMap} from '../../tensor_types';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport * as util from '../../util';\nimport {op} from '../operation';\n\n/**\n * Flips the image left to right. Currently available in the CPU, WebGL, and\n * WASM backends.\n *\n * @param image 4d tensor of shape `[batch, imageHeight, imageWidth, depth]`.\n */\n/** @doc {heading: 'Operations', subheading: 'Images', namespace: 'image'} */\nfunction flipLeftRight_(image: Tensor4D|TensorLike): Tensor4D {\n const $image = convertToTensor(image, 'image', 'flipLeftRight', 'float32');\n\n util.assert(\n $image.rank === 4,\n () => 'Error in flipLeftRight: image must be rank 4,' +\n `but got rank ${$image.rank}.`);\n\n const inputs: FlipLeftRightInputs = {image: $image};\n const res =\n ENGINE.runKernel(FlipLeftRight, inputs as {} as NamedTensorMap, {});\n return res as Tensor4D;\n}\n\nexport const flipLeftRight = op({flipLeftRight_});\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor2D, Tensor3D, Tensor4D, Tensor5D, Tensor6D} from '../../tensor';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport * as util from '../../util';\n\nimport {op} from '../operation';\nimport {tile} from '../tile';\n\n/**\n * Converts images from grayscale to RGB format.\n *\n * @param image A grayscale tensor to convert. The `image`'s last dimension must\n * be size 1 with at least a two-dimensional shape.\n *\n * @doc {heading: 'Operations', subheading: 'Images', namespace: 'image'}\n */\nfunction grayscaleToRGB_(image: T|TensorLike): T {\n const $image = convertToTensor(image, 'image', 'grayscaleToRGB');\n\n const lastDimsIdx = $image.rank - 1;\n const lastDims = $image.shape[lastDimsIdx];\n\n util.assert(\n $image.rank >= 2,\n () => 'Error in grayscaleToRGB: images must be at least rank 2, ' +\n `but got rank ${$image.rank}.`);\n\n util.assert(\n lastDims === 1,\n () => 'Error in grayscaleToRGB: last dimension of a grayscale image ' +\n `should be size 1, but got size ${lastDims}.`);\n\n const reps = new Array($image.rank);\n\n reps.fill(1, 0, lastDimsIdx);\n reps[lastDimsIdx] = 3;\n\n return tile($image, reps);\n}\n\nexport const grayscaleToRGB = op({grayscaleToRGB_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {RotateWithOffset, RotateWithOffsetAttrs, RotateWithOffsetInputs} from '../../kernel_names';\nimport {NamedAttrMap} from '../../kernel_registry';\nimport {Tensor4D} from '../../tensor';\nimport {NamedTensorMap} from '../../tensor_types';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport * as util from '../../util';\n\nimport {op} from '../operation';\n\n/**\n * Rotates the input image tensor counter-clockwise with an optional offset\n * center of rotation. Currently available in the CPU, WebGL, and WASM backends.\n *\n * @param image 4d tensor of shape `[batch, imageHeight, imageWidth, depth]`.\n * @param radians The amount of rotation.\n * @param fillValue The value to fill in the empty space leftover\n * after rotation. Can be either a single grayscale value (0-255), or an\n * array of three numbers `[red, green, blue]` specifying the red, green,\n * and blue channels. Defaults to `0` (black).\n * @param center The center of rotation. Can be either a single value (0-1), or\n * an array of two numbers `[centerX, centerY]`. Defaults to `0.5` (rotates\n * the image around its center).\n *\n * @doc {heading: 'Operations', subheading: 'Images', namespace: 'image'}\n */\nfunction rotateWithOffset_(\n image: Tensor4D|TensorLike, radians: number,\n fillValue: number|[number, number, number] = 0,\n center: number|[number, number] = 0.5): Tensor4D {\n const $image = convertToTensor(image, 'image', 'rotateWithOffset', 'float32');\n\n util.assert(\n $image.rank === 4,\n () => 'Error in rotateWithOffset: image must be rank 4,' +\n `but got rank ${$image.rank}.`);\n\n const inputs: RotateWithOffsetInputs = {image: $image};\n const attrs: RotateWithOffsetAttrs = {radians, fillValue, center};\n const res = ENGINE.runKernel(\n RotateWithOffset, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap);\n return res as Tensor4D;\n}\n\nexport const rotateWithOffset = op({rotateWithOffset_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor1D, Tensor2D} from '../tensor';\nimport * as util from '../util';\n\nfunction nonMaxSuppSanityCheck(\n boxes: Tensor2D, scores: Tensor1D, maxOutputSize: number,\n iouThreshold: number, scoreThreshold: number, softNmsSigma?: number): {\n maxOutputSize: number,\n iouThreshold: number,\n scoreThreshold: number,\n softNmsSigma: number\n} {\n if (iouThreshold == null) {\n iouThreshold = 0.5;\n }\n if (scoreThreshold == null) {\n scoreThreshold = Number.NEGATIVE_INFINITY;\n }\n if (softNmsSigma == null) {\n softNmsSigma = 0.0;\n }\n\n const numBoxes = boxes.shape[0];\n maxOutputSize = Math.min(maxOutputSize, numBoxes);\n\n util.assert(\n 0 <= iouThreshold && iouThreshold <= 1,\n () => `iouThreshold must be in [0, 1], but was '${iouThreshold}'`);\n util.assert(\n boxes.rank === 2,\n () => `boxes must be a 2D tensor, but was of rank '${boxes.rank}'`);\n util.assert(\n boxes.shape[1] === 4,\n () =>\n `boxes must have 4 columns, but 2nd dimension was ${boxes.shape[1]}`);\n util.assert(scores.rank === 1, () => 'scores must be a 1D tensor');\n util.assert(\n scores.shape[0] === numBoxes,\n () => `scores has incompatible shape with boxes. Expected ${numBoxes}, ` +\n `but was ${scores.shape[0]}`);\n util.assert(\n 0 <= softNmsSigma && softNmsSigma <= 1,\n () => `softNmsSigma must be in [0, 1], but was '${softNmsSigma}'`);\n return {maxOutputSize, iouThreshold, scoreThreshold, softNmsSigma};\n}\n\nexport {nonMaxSuppSanityCheck};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {NonMaxSuppressionV3} from '../../kernel_names';\nimport {Tensor1D, Tensor2D} from '../../tensor';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport {nonMaxSuppSanityCheck} from '../nonmax_util';\nimport {op} from '../operation';\n\n/**\n * Performs non maximum suppression of bounding boxes based on\n * iou (intersection over union).\n *\n * @param boxes a 2d tensor of shape `[numBoxes, 4]`. Each entry is\n * `[y1, x1, y2, x2]`, where `(y1, x1)` and `(y2, x2)` are the corners of\n * the bounding box.\n * @param scores a 1d tensor providing the box scores of shape `[numBoxes]`.\n * @param maxOutputSize The maximum number of boxes to be selected.\n * @param iouThreshold A float representing the threshold for deciding whether\n * boxes overlap too much with respect to IOU. Must be between [0, 1].\n * Defaults to 0.5 (50% box overlap).\n * @param scoreThreshold A threshold for deciding when to remove boxes based\n * on score. Defaults to -inf, which means any score is accepted.\n * @return A 1D tensor with the selected box indices.\n *\n * @doc {heading: 'Operations', subheading: 'Images', namespace: 'image'}\n */\nfunction nonMaxSuppression_(\n boxes: Tensor2D|TensorLike, scores: Tensor1D|TensorLike,\n maxOutputSize: number, iouThreshold = 0.5,\n scoreThreshold = Number.NEGATIVE_INFINITY): Tensor1D {\n const $boxes =\n convertToTensor(boxes, 'boxes', 'nonMaxSuppression', 'float32');\n const $scores =\n convertToTensor(scores, 'scores', 'nonMaxSuppression', 'float32');\n\n const inputs = nonMaxSuppSanityCheck(\n $boxes, $scores, maxOutputSize, iouThreshold, scoreThreshold);\n maxOutputSize = inputs.maxOutputSize;\n iouThreshold = inputs.iouThreshold;\n scoreThreshold = inputs.scoreThreshold;\n\n const attrs = {maxOutputSize, iouThreshold, scoreThreshold};\n return ENGINE.runKernel(\n NonMaxSuppressionV3, {boxes: $boxes, scores: $scores}, attrs);\n}\n\nexport const nonMaxSuppression = op({nonMaxSuppression_});\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/**\n * Inserts a value into a sorted array. This method allows duplicate, meaning it\n * allows inserting duplicate value, in which case, the element will be inserted\n * at the lowest index of the value.\n * @param arr The array to modify.\n * @param element The element to insert.\n * @param comparator Optional. If no comparator is specified, elements are\n * compared using array_util.defaultComparator, which is suitable for Strings\n * and Numbers in ascending arrays. If the array contains multiple instances of\n * the target value, the left-most instance will be returned. To provide a\n * comparator, it should take 2 arguments to compare and return a negative,\n * zero, or a positive number.\n */\nexport function binaryInsert(\n arr: T[], element: T, comparator?: (a: T, b: T) => number) {\n const index = binarySearch(arr, element, comparator);\n const insertionPoint = index < 0 ? -(index + 1) : index;\n arr.splice(insertionPoint, 0, element);\n}\n\n/**\n * Searches the array for the target using binary search, returns the index\n * of the found element, or position to insert if element not found. If no\n * comparator is specified, elements are compared using array_\n * util.defaultComparator, which is suitable for Strings and Numbers in\n * ascending arrays. If the array contains multiple instances of the target\n * value, the left-most instance will be returned.\n * @param arr The array to be searched in.\n * @param target The target to be searched for.\n * @param comparator Should take 2 arguments to compare and return a negative,\n * zero, or a positive number.\n * @return Lowest index of the target value if found, otherwise the insertion\n * point where the target should be inserted, in the form of\n * (-insertionPoint - 1).\n */\nexport function binarySearch(\n arr: T[], target: T, comparator?: (a: T, b: T) => number) {\n return binarySearch_(arr, target, comparator || defaultComparator);\n}\n\n/**\n * Compares its two arguments for order.\n * @param a The first element to be compared.\n * @param b The second element to be compared.\n * @return A negative number, zero, or a positive number as the first\n * argument is less than, equal to, or greater than the second.\n */\nfunction defaultComparator(a: T, b: T): number {\n return a > b ? 1 : a < b ? -1 : 0;\n}\n\nfunction binarySearch_(\n arr: T[], target: T, comparator: (a: T, b: T) => number) {\n let left = 0;\n let right = arr.length;\n let middle = 0;\n let found = false;\n while (left < right) {\n middle = left + ((right - left) >>> 1);\n const compareResult = comparator(target, arr[middle]);\n if (compareResult > 0) {\n left = middle + 1;\n } else {\n right = middle;\n // If compareResult is 0, the value is found. We record it is found,\n // and then keep looking because there may be duplicate.\n found = !compareResult;\n }\n }\n\n return found ? left : -left - 1;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {TypedArray} from '../types';\nimport {binaryInsert} from './non_max_suppression_util';\n\n/**\n * Implementation of the NonMaxSuppression kernel shared between webgl and cpu.\n */\ninterface Candidate {\n score: number;\n boxIndex: number;\n suppressBeginIndex: number;\n}\n\ninterface NonMaxSuppressionResult {\n selectedIndices: number[];\n selectedScores?: number[];\n validOutputs?: number;\n}\n\nexport function nonMaxSuppressionV3Impl(\n boxes: TypedArray, scores: TypedArray, maxOutputSize: number,\n iouThreshold: number, scoreThreshold: number): NonMaxSuppressionResult {\n return nonMaxSuppressionImpl_(\n boxes, scores, maxOutputSize, iouThreshold, scoreThreshold,\n 0 /* softNmsSigma */);\n}\n\nexport function nonMaxSuppressionV4Impl(\n boxes: TypedArray, scores: TypedArray, maxOutputSize: number,\n iouThreshold: number, scoreThreshold: number,\n padToMaxOutputSize: boolean): NonMaxSuppressionResult {\n return nonMaxSuppressionImpl_(\n boxes, scores, maxOutputSize, iouThreshold, scoreThreshold,\n 0 /* softNmsSigma */, false /* returnScoresTensor */,\n padToMaxOutputSize /* padToMaxOutputSize */, true\n /* returnValidOutputs */);\n}\n\nexport function nonMaxSuppressionV5Impl(\n boxes: TypedArray, scores: TypedArray, maxOutputSize: number,\n iouThreshold: number, scoreThreshold: number,\n softNmsSigma: number): NonMaxSuppressionResult {\n return nonMaxSuppressionImpl_(\n boxes, scores, maxOutputSize, iouThreshold, scoreThreshold, softNmsSigma,\n true /* returnScoresTensor */);\n}\n\nfunction nonMaxSuppressionImpl_(\n boxes: TypedArray, scores: TypedArray, maxOutputSize: number,\n iouThreshold: number, scoreThreshold: number, softNmsSigma: number,\n returnScoresTensor = false, padToMaxOutputSize = false,\n returnValidOutputs = false): NonMaxSuppressionResult {\n // The list is sorted in ascending order, so that we can always pop the\n // candidate with the largest score in O(1) time.\n const candidates = [];\n\n for (let i = 0; i < scores.length; i++) {\n if (scores[i] > scoreThreshold) {\n candidates.push({score: scores[i], boxIndex: i, suppressBeginIndex: 0});\n }\n }\n\n candidates.sort(ascendingComparator);\n\n // If softNmsSigma is 0, the outcome of this algorithm is exactly same as\n // before.\n const scale = softNmsSigma > 0 ? (-0.5 / softNmsSigma) : 0.0;\n\n const selectedIndices: number[] = [];\n const selectedScores: number[] = [];\n\n while (selectedIndices.length < maxOutputSize && candidates.length > 0) {\n const candidate = candidates.pop();\n const {score: originalScore, boxIndex, suppressBeginIndex} = candidate;\n\n if (originalScore < scoreThreshold) {\n break;\n }\n\n // Overlapping boxes are likely to have similar scores, therefore we\n // iterate through the previously selected boxes backwards in order to\n // see if candidate's score should be suppressed. We use\n // suppressBeginIndex to track and ensure a candidate can be suppressed\n // by a selected box no more than once. Also, if the overlap exceeds\n // iouThreshold, we simply ignore the candidate.\n let ignoreCandidate = false;\n for (let j = selectedIndices.length - 1; j >= suppressBeginIndex; --j) {\n const iou = intersectionOverUnion(boxes, boxIndex, selectedIndices[j]);\n\n if (iou >= iouThreshold) {\n ignoreCandidate = true;\n break;\n }\n\n candidate.score =\n candidate.score * suppressWeight(iouThreshold, scale, iou);\n\n if (candidate.score <= scoreThreshold) {\n break;\n }\n }\n\n // At this point, if `candidate.score` has not dropped below\n // `scoreThreshold`, then we know that we went through all of the\n // previous selections and can safely update `suppressBeginIndex` to the\n // end of the selected array. Then we can re-insert the candidate with\n // the updated score and suppressBeginIndex back in the candidate list.\n // If on the other hand, `candidate.score` has dropped below the score\n // threshold, we will not add it back to the candidates list.\n candidate.suppressBeginIndex = selectedIndices.length;\n\n if (!ignoreCandidate) {\n // Candidate has passed all the tests, and is not suppressed, so\n // select the candidate.\n if (candidate.score === originalScore) {\n selectedIndices.push(boxIndex);\n selectedScores.push(candidate.score);\n } else if (candidate.score > scoreThreshold) {\n // Candidate's score is suppressed but is still high enough to be\n // considered, so add back to the candidates list.\n binaryInsert(candidates, candidate, ascendingComparator);\n }\n }\n }\n\n // NonMaxSuppressionV4 feature: padding output to maxOutputSize.\n const validOutputs = selectedIndices.length;\n const elemsToPad = maxOutputSize - validOutputs;\n\n if (padToMaxOutputSize && elemsToPad > 0) {\n selectedIndices.push(...new Array(elemsToPad).fill(0));\n selectedScores.push(...new Array(elemsToPad).fill(0.0));\n }\n\n const result: NonMaxSuppressionResult = {selectedIndices};\n\n if (returnScoresTensor) {\n result['selectedScores'] = selectedScores;\n }\n\n if (returnValidOutputs) {\n result['validOutputs'] = validOutputs;\n }\n\n return result;\n}\n\nfunction intersectionOverUnion(boxes: TypedArray, i: number, j: number) {\n const iCoord = boxes.subarray(i * 4, i * 4 + 4);\n const jCoord = boxes.subarray(j * 4, j * 4 + 4);\n const yminI = Math.min(iCoord[0], iCoord[2]);\n const xminI = Math.min(iCoord[1], iCoord[3]);\n const ymaxI = Math.max(iCoord[0], iCoord[2]);\n const xmaxI = Math.max(iCoord[1], iCoord[3]);\n const yminJ = Math.min(jCoord[0], jCoord[2]);\n const xminJ = Math.min(jCoord[1], jCoord[3]);\n const ymaxJ = Math.max(jCoord[0], jCoord[2]);\n const xmaxJ = Math.max(jCoord[1], jCoord[3]);\n const areaI = (ymaxI - yminI) * (xmaxI - xminI);\n const areaJ = (ymaxJ - yminJ) * (xmaxJ - xminJ);\n if (areaI <= 0 || areaJ <= 0) {\n return 0.0;\n }\n const intersectionYmin = Math.max(yminI, yminJ);\n const intersectionXmin = Math.max(xminI, xminJ);\n const intersectionYmax = Math.min(ymaxI, ymaxJ);\n const intersectionXmax = Math.min(xmaxI, xmaxJ);\n const intersectionArea = Math.max(intersectionYmax - intersectionYmin, 0.0) *\n Math.max(intersectionXmax - intersectionXmin, 0.0);\n return intersectionArea / (areaI + areaJ - intersectionArea);\n}\n\n// A Gaussian penalty function, this method always returns values in [0, 1].\n// The weight is a function of similarity, the more overlap two boxes are, the\n// smaller the weight is, meaning highly overlapping boxe will be significantly\n// penalized. On the other hand, a non-overlapping box will not be penalized.\nfunction suppressWeight(iouThreshold: number, scale: number, iou: number) {\n const weight = Math.exp(scale * iou * iou);\n return iou <= iouThreshold ? weight : 0.0;\n}\n\nfunction ascendingComparator(c1: Candidate, c2: Candidate) {\n // For objects with same scores, we make the object with the larger index go\n // first. In an array that pops from the end, this means that the object with\n // the smaller index will be popped first. This ensures the same output as\n // the TensorFlow python version.\n return (c1.score - c2.score) ||\n ((c1.score === c2.score) && (c2.boxIndex - c1.boxIndex));\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {nonMaxSuppressionV3Impl} from '../../backends/non_max_suppression_impl';\nimport {Tensor1D, Tensor2D} from '../../tensor';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport {nonMaxSuppSanityCheck} from '../nonmax_util';\nimport {tensor1d} from '../tensor1d';\n\n/**\n * Performs non maximum suppression of bounding boxes based on\n * iou (intersection over union).\n *\n * This is the async version of `nonMaxSuppression`\n *\n * @param boxes a 2d tensor of shape `[numBoxes, 4]`. Each entry is\n * `[y1, x1, y2, x2]`, where `(y1, x1)` and `(y2, x2)` are the corners of\n * the bounding box.\n * @param scores a 1d tensor providing the box scores of shape `[numBoxes]`.\n * @param maxOutputSize The maximum number of boxes to be selected.\n * @param iouThreshold A float representing the threshold for deciding whether\n * boxes overlap too much with respect to IOU. Must be between [0, 1].\n * Defaults to 0.5 (50% box overlap).\n * @param scoreThreshold A threshold for deciding when to remove boxes based\n * on score. Defaults to -inf, which means any score is accepted.\n * @return A 1D tensor with the selected box indices.\n *\n * @doc {heading: 'Operations', subheading: 'Images', namespace: 'image'}\n */\nasync function nonMaxSuppressionAsync_(\n boxes: Tensor2D|TensorLike, scores: Tensor1D|TensorLike,\n maxOutputSize: number, iouThreshold = 0.5,\n scoreThreshold = Number.NEGATIVE_INFINITY): Promise {\n const $boxes = convertToTensor(boxes, 'boxes', 'nonMaxSuppressionAsync');\n const $scores = convertToTensor(scores, 'scores', 'nonMaxSuppressionAsync');\n\n const inputs = nonMaxSuppSanityCheck(\n $boxes, $scores, maxOutputSize, iouThreshold, scoreThreshold);\n maxOutputSize = inputs.maxOutputSize;\n iouThreshold = inputs.iouThreshold;\n scoreThreshold = inputs.scoreThreshold;\n\n const boxesAndScores = await Promise.all([$boxes.data(), $scores.data()]);\n const boxesVals = boxesAndScores[0];\n const scoresVals = boxesAndScores[1];\n\n // We call a cpu based impl directly with the typedarray data here rather\n // than a kernel because all kernels are synchronous (and thus cannot await\n // .data()).\n const {selectedIndices} = nonMaxSuppressionV3Impl(\n boxesVals, scoresVals, maxOutputSize, iouThreshold, scoreThreshold);\n if ($boxes !== boxes) {\n $boxes.dispose();\n }\n if ($scores !== scores) {\n $scores.dispose();\n }\n\n return tensor1d(selectedIndices, 'int32');\n}\n\nexport const nonMaxSuppressionAsync = nonMaxSuppressionAsync_;\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {NonMaxSuppressionV5, NonMaxSuppressionV5Attrs, NonMaxSuppressionV5Inputs} from '../../kernel_names';\nimport {NamedAttrMap} from '../../kernel_registry';\nimport {Tensor, Tensor1D, Tensor2D} from '../../tensor';\nimport {NamedTensorMap} from '../../tensor_types';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\n\nimport {nonMaxSuppSanityCheck} from '../nonmax_util';\nimport {op} from '../operation';\n\n/**\n * Performs non maximum suppression of bounding boxes based on\n * iou (intersection over union).\n *\n * This op also supports a Soft-NMS mode (cf.\n * Bodla et al, https://arxiv.org/abs/1704.04503) where boxes reduce the score\n * of other overlapping boxes, therefore favoring different regions of the image\n * with high scores. To enable this Soft-NMS mode, set the `softNmsSigma`\n * parameter to be larger than 0.\n *\n * @param boxes a 2d tensor of shape `[numBoxes, 4]`. Each entry is\n * `[y1, x1, y2, x2]`, where `(y1, x1)` and `(y2, x2)` are the corners of\n * the bounding box.\n * @param scores a 1d tensor providing the box scores of shape `[numBoxes]`.\n * @param maxOutputSize The maximum number of boxes to be selected.\n * @param iouThreshold A float representing the threshold for deciding whether\n * boxes overlap too much with respect to IOU. Must be between [0, 1].\n * Defaults to 0.5 (50% box overlap).\n * @param scoreThreshold A threshold for deciding when to remove boxes based\n * on score. Defaults to -inf, which means any score is accepted.\n * @param softNmsSigma A float representing the sigma parameter for Soft NMS.\n * When sigma is 0, it falls back to nonMaxSuppression.\n * @return A map with the following properties:\n * - selectedIndices: A 1D tensor with the selected box indices.\n * - selectedScores: A 1D tensor with the corresponding scores for each\n * selected box.\n *\n * @doc {heading: 'Operations', subheading: 'Images', namespace: 'image'}\n */\nfunction nonMaxSuppressionWithScore_(\n boxes: Tensor2D|TensorLike, scores: Tensor1D|TensorLike,\n maxOutputSize: number, iouThreshold = 0.5,\n scoreThreshold = Number.NEGATIVE_INFINITY,\n softNmsSigma = 0.0): NamedTensorMap {\n const $boxes = convertToTensor(boxes, 'boxes', 'nonMaxSuppression');\n const $scores = convertToTensor(scores, 'scores', 'nonMaxSuppression');\n\n const params = nonMaxSuppSanityCheck(\n $boxes, $scores, maxOutputSize, iouThreshold, scoreThreshold,\n softNmsSigma);\n maxOutputSize = params.maxOutputSize;\n iouThreshold = params.iouThreshold;\n scoreThreshold = params.scoreThreshold;\n softNmsSigma = params.softNmsSigma;\n\n const inputs: NonMaxSuppressionV5Inputs = {boxes: $boxes, scores: $scores};\n const attrs: NonMaxSuppressionV5Attrs =\n {maxOutputSize, iouThreshold, scoreThreshold, softNmsSigma};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n const result = ENGINE.runKernel(\n NonMaxSuppressionV5, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as Tensor[];\n\n return {selectedIndices: result[0], selectedScores: result[1]};\n}\n\nexport const nonMaxSuppressionWithScore = op({nonMaxSuppressionWithScore_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {nonMaxSuppressionV5Impl} from '../../backends/non_max_suppression_impl';\nimport {Tensor1D, Tensor2D} from '../../tensor';\nimport {NamedTensorMap} from '../../tensor_types';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport {nonMaxSuppSanityCheck} from '../nonmax_util';\nimport {tensor1d} from '../tensor1d';\n\n/**\n * Asynchronously performs non maximum suppression of bounding boxes based on\n * iou (intersection over union).\n *\n * This op also supports a Soft-NMS mode (cf.\n * Bodla et al, https://arxiv.org/abs/1704.04503) where boxes reduce the score\n * of other overlapping boxes, therefore favoring different regions of the image\n * with high scores. To enable this Soft-NMS mode, set the `softNmsSigma`\n * parameter to be larger than 0.\n *\n * @param boxes a 2d tensor of shape `[numBoxes, 4]`. Each entry is\n * `[y1, x1, y2, x2]`, where `(y1, x1)` and `(y2, x2)` are the corners of\n * the bounding box.\n * @param scores a 1d tensor providing the box scores of shape `[numBoxes]`.\n * @param maxOutputSize The maximum number of boxes to be selected.\n * @param iouThreshold A float representing the threshold for deciding whether\n * boxes overlap too much with respect to IOU. Must be between [0, 1].\n * Defaults to 0.5 (50% box overlap).\n * @param scoreThreshold A threshold for deciding when to remove boxes based\n * on score. Defaults to -inf, which means any score is accepted.\n * @param softNmsSigma A float representing the sigma parameter for Soft NMS.\n * When sigma is 0, it falls back to nonMaxSuppression.\n * @return A map with the following properties:\n * - selectedIndices: A 1D tensor with the selected box indices.\n * - selectedScores: A 1D tensor with the corresponding scores for each\n * selected box.\n *\n * @doc {heading: 'Operations', subheading: 'Images', namespace: 'image'}\n */\nasync function nonMaxSuppressionWithScoreAsync_(\n boxes: Tensor2D|TensorLike, scores: Tensor1D|TensorLike,\n maxOutputSize: number, iouThreshold = 0.5,\n scoreThreshold = Number.NEGATIVE_INFINITY,\n softNmsSigma = 0.0): Promise {\n const $boxes = convertToTensor(boxes, 'boxes', 'nonMaxSuppressionAsync');\n const $scores = convertToTensor(scores, 'scores', 'nonMaxSuppressionAsync');\n\n const params = nonMaxSuppSanityCheck(\n $boxes, $scores, maxOutputSize, iouThreshold, scoreThreshold,\n softNmsSigma);\n maxOutputSize = params.maxOutputSize;\n iouThreshold = params.iouThreshold;\n scoreThreshold = params.scoreThreshold;\n softNmsSigma = params.softNmsSigma;\n\n const boxesAndScores = await Promise.all([$boxes.data(), $scores.data()]);\n const boxesVals = boxesAndScores[0];\n const scoresVals = boxesAndScores[1];\n\n // We call a cpu based impl directly with the typedarray data here rather\n // than a kernel because all kernels are synchronous (and thus cannot await\n // .data()).\n const {selectedIndices, selectedScores} = nonMaxSuppressionV5Impl(\n boxesVals, scoresVals, maxOutputSize, iouThreshold, scoreThreshold,\n softNmsSigma);\n\n if ($boxes !== boxes) {\n $boxes.dispose();\n }\n if ($scores !== scores) {\n $scores.dispose();\n }\n\n return {\n selectedIndices: tensor1d(selectedIndices, 'int32'),\n selectedScores: tensor1d(selectedScores)\n };\n}\n\nexport const nonMaxSuppressionWithScoreAsync = nonMaxSuppressionWithScoreAsync_;\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {NonMaxSuppressionV4, NonMaxSuppressionV4Attrs, NonMaxSuppressionV4Inputs} from '../../kernel_names';\nimport {NamedAttrMap} from '../../kernel_registry';\nimport {Tensor, Tensor1D, Tensor2D} from '../../tensor';\nimport {NamedTensorMap} from '../../tensor_types';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\n\nimport {nonMaxSuppSanityCheck} from '../nonmax_util';\nimport {op} from '../operation';\n\n/**\n * Asynchronously performs non maximum suppression of bounding boxes based on\n * iou (intersection over union), with an option to pad results.\n *\n * @param boxes a 2d tensor of shape `[numBoxes, 4]`. Each entry is\n * `[y1, x1, y2, x2]`, where `(y1, x1)` and `(y2, x2)` are the corners of\n * the bounding box.\n * @param scores a 1d tensor providing the box scores of shape `[numBoxes]`.\n * @param maxOutputSize The maximum number of boxes to be selected.\n * @param iouThreshold A float representing the threshold for deciding whether\n * boxes overlap too much with respect to IOU. Must be between [0, 1].\n * Defaults to 0.5 (50% box overlap).\n * @param scoreThreshold A threshold for deciding when to remove boxes based\n * on score. Defaults to -inf, which means any score is accepted.\n * @param padToMaxOutputSize Defaults to false. If true, size of output\n * `selectedIndices` is padded to maxOutputSize.\n * @return A map with the following properties:\n * - selectedIndices: A 1D tensor with the selected box indices.\n * - validOutputs: A scalar denoting how many elements in `selectedIndices`\n * are valid. Valid elements occur first, then padding.\n *\n * @doc {heading: 'Operations', subheading: 'Images', namespace: 'image'}\n */\nfunction nonMaxSuppressionPadded_(\n boxes: Tensor2D|TensorLike, scores: Tensor1D|TensorLike,\n maxOutputSize: number, iouThreshold = 0.5,\n scoreThreshold = Number.NEGATIVE_INFINITY,\n padToMaxOutputSize = false): NamedTensorMap {\n const $boxes = convertToTensor(boxes, 'boxes', 'nonMaxSuppression');\n const $scores = convertToTensor(scores, 'scores', 'nonMaxSuppression');\n\n const params = nonMaxSuppSanityCheck(\n $boxes, $scores, maxOutputSize, iouThreshold, scoreThreshold,\n null /* softNmsSigma */);\n const $maxOutputSize = params.maxOutputSize;\n const $iouThreshold = params.iouThreshold;\n const $scoreThreshold = params.scoreThreshold;\n\n const inputs: NonMaxSuppressionV4Inputs = {boxes: $boxes, scores: $scores};\n const attrs: NonMaxSuppressionV4Attrs = {\n maxOutputSize: $maxOutputSize,\n iouThreshold: $iouThreshold,\n scoreThreshold: $scoreThreshold,\n padToMaxOutputSize\n };\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n const result = ENGINE.runKernel(\n NonMaxSuppressionV4, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as Tensor[];\n\n return {selectedIndices: result[0], validOutputs: result[1]};\n}\n\nexport const nonMaxSuppressionPadded = op({nonMaxSuppressionPadded_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {nonMaxSuppressionV4Impl} from '../../backends/non_max_suppression_impl';\nimport {Tensor1D, Tensor2D} from '../../tensor';\nimport {NamedTensorMap} from '../../tensor_types';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport {nonMaxSuppSanityCheck} from '../nonmax_util';\nimport {scalar} from '../scalar';\nimport {tensor1d} from '../tensor1d';\n\n/**\n * Asynchronously performs non maximum suppression of bounding boxes based on\n * iou (intersection over union), with an option to pad results.\n *\n * @param boxes a 2d tensor of shape `[numBoxes, 4]`. Each entry is\n * `[y1, x1, y2, x2]`, where `(y1, x1)` and `(y2, x2)` are the corners of\n * the bounding box.\n * @param scores a 1d tensor providing the box scores of shape `[numBoxes]`.\n * @param maxOutputSize The maximum number of boxes to be selected.\n * @param iouThreshold A float representing the threshold for deciding whether\n * boxes overlap too much with respect to IOU. Must be between [0, 1].\n * Defaults to 0.5 (50% box overlap).\n * @param scoreThreshold A threshold for deciding when to remove boxes based\n * on score. Defaults to -inf, which means any score is accepted.\n * @param padToMaxOutputSize Defaults to false. If true, size of output\n * `selectedIndices` is padded to maxOutputSize.\n * @return A map with the following properties:\n * - selectedIndices: A 1D tensor with the selected box indices.\n * - validOutputs: A scalar denoting how many elements in `selectedIndices`\n * are valid. Valid elements occur first, then padding.\n *\n * @doc {heading: 'Operations', subheading: 'Images', namespace: 'image'}\n */\nasync function nonMaxSuppressionPaddedAsync_(\n boxes: Tensor2D|TensorLike, scores: Tensor1D|TensorLike,\n maxOutputSize: number, iouThreshold = 0.5,\n scoreThreshold = Number.NEGATIVE_INFINITY,\n padToMaxOutputSize = false): Promise {\n const $boxes = convertToTensor(boxes, 'boxes', 'nonMaxSuppressionAsync');\n const $scores = convertToTensor(scores, 'scores', 'nonMaxSuppressionAsync');\n\n const params = nonMaxSuppSanityCheck(\n $boxes, $scores, maxOutputSize, iouThreshold, scoreThreshold,\n null /* softNmsSigma */);\n const $maxOutputSize = params.maxOutputSize;\n const $iouThreshold = params.iouThreshold;\n const $scoreThreshold = params.scoreThreshold;\n\n const [boxesVals, scoresVals] =\n await Promise.all([$boxes.data(), $scores.data()]);\n\n // We call a cpu based impl directly with the typedarray data here rather\n // than a kernel because all kernels are synchronous (and thus cannot await\n // .data()).\n const {selectedIndices, validOutputs} = nonMaxSuppressionV4Impl(\n boxesVals, scoresVals, $maxOutputSize, $iouThreshold, $scoreThreshold,\n padToMaxOutputSize);\n\n if ($boxes !== boxes) {\n $boxes.dispose();\n }\n if ($scores !== scores) {\n $scores.dispose();\n }\n\n return {\n selectedIndices: tensor1d(selectedIndices, 'int32'),\n validOutputs: scalar(validOutputs, 'int32')\n };\n}\n\nexport const nonMaxSuppressionPaddedAsync = nonMaxSuppressionPaddedAsync_;\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {ResizeBilinear, ResizeBilinearAttrs, ResizeBilinearInputs} from '../../kernel_names';\nimport {NamedAttrMap} from '../../kernel_registry';\nimport {Tensor3D, Tensor4D} from '../../tensor';\nimport {NamedTensorMap} from '../../tensor_types';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport * as util from '../../util';\n\nimport {op} from '../operation';\nimport {reshape} from '../reshape';\n\n/**\n * Bilinear resize a single 3D image or a batch of 3D images to a new shape.\n *\n * @param images The images, of rank 4 or rank 3, of shape\n * `[batch, height, width, inChannels]`. If rank 3, batch of 1 is assumed.\n * @param size The new shape `[newHeight, newWidth]` to resize the\n * images to. Each channel is resized individually.\n * @param alignCorners Defaults to `false`. If true, rescale\n * input by `(new_height - 1) / (height - 1)`, which exactly aligns the 4\n * corners of images and resized images. If false, rescale by\n * `new_height / height`. Treat similarly the width dimension.\n * @param halfPixelCenters Defaults to `false`. Whether to assume pixel centers\n * are at 0.5, which would make the floating point coordinates of the top\n * left pixel 0.5, 0.5.\n *\n * @doc {heading: 'Operations', subheading: 'Images', namespace: 'image'}\n */\nfunction resizeBilinear_(\n images: T|TensorLike, size: [number, number], alignCorners = false,\n halfPixelCenters = false): T {\n const $images = convertToTensor(images, 'images', 'resizeBilinear');\n\n util.assert(\n $images.rank === 3 || $images.rank === 4,\n () => `Error in resizeBilinear: x must be rank 3 or 4, but got ` +\n `rank ${$images.rank}.`);\n util.assert(\n size.length === 2,\n () => `Error in resizeBilinear: new shape must 2D, but got shape ` +\n `${size}.`);\n util.assert(\n halfPixelCenters === false || alignCorners === false,\n () => `Error in resizeBilinear: If halfPixelCenters is true, ` +\n `alignCorners must be false.`);\n\n let batchImages = $images as Tensor4D;\n let reshapedTo4D = false;\n if ($images.rank === 3) {\n reshapedTo4D = true;\n batchImages = reshape(\n $images, [1, $images.shape[0], $images.shape[1], $images.shape[2]]);\n }\n\n const [] = size;\n\n const inputs: ResizeBilinearInputs = {images: batchImages};\n const attrs: ResizeBilinearAttrs = {alignCorners, halfPixelCenters, size};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n const res = ENGINE.runKernel(\n ResizeBilinear, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as T;\n\n if (reshapedTo4D) {\n return reshape(res, [res.shape[1], res.shape[2], res.shape[3]]) as T;\n }\n return res;\n}\n\nexport const resizeBilinear = op({resizeBilinear_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {ResizeNearestNeighbor, ResizeNearestNeighborAttrs, ResizeNearestNeighborInputs} from '../../kernel_names';\nimport {NamedAttrMap} from '../../kernel_registry';\nimport {Tensor3D, Tensor4D} from '../../tensor';\nimport {NamedTensorMap} from '../../tensor_types';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport * as util from '../../util';\n\nimport {op} from '../operation';\nimport {reshape} from '../reshape';\n\n/**\n * NearestNeighbor resize a batch of 3D images to a new shape.\n *\n * @param images The images, of rank 4 or rank 3, of shape\n * `[batch, height, width, inChannels]`. If rank 3, batch of 1 is assumed.\n * @param size The new shape `[newHeight, newWidth]` to resize the\n * images to. Each channel is resized individually.\n * @param alignCorners Defaults to False. If true, rescale\n * input by `(new_height - 1) / (height - 1)`, which exactly aligns the 4\n * corners of images and resized images. If false, rescale by\n * `new_height / height`. Treat similarly the width dimension.\n * @param halfPixelCenters Defaults to `false`. Whether to assume pixels are of\n * half the actual dimensions, and yield more accurate resizes. This flag\n * would also make the floating point coordinates of the top left pixel\n * 0.5, 0.5.\n *\n * @doc {heading: 'Operations', subheading: 'Images', namespace: 'image'}\n */\nfunction resizeNearestNeighbor_(\n images: T|TensorLike, size: [number, number], alignCorners = false,\n halfPixelCenters = false): T {\n const $images = convertToTensor(images, 'images', 'resizeNearestNeighbor');\n\n util.assert(\n $images.rank === 3 || $images.rank === 4,\n () => `Error in resizeNearestNeighbor: x must be rank 3 or 4, but got ` +\n `rank ${$images.rank}.`);\n util.assert(\n size.length === 2,\n () =>\n `Error in resizeNearestNeighbor: new shape must 2D, but got shape ` +\n `${size}.`);\n util.assert(\n $images.dtype === 'float32' || $images.dtype === 'int32',\n () => '`images` must have `int32` or `float32` as dtype');\n util.assert(\n halfPixelCenters === false || alignCorners === false,\n () => `Error in resizeNearestNeighbor: If halfPixelCenters is true, ` +\n `alignCorners must be false.`);\n let batchImages = $images as Tensor4D;\n let reshapedTo4D = false;\n if ($images.rank === 3) {\n reshapedTo4D = true;\n batchImages = reshape(\n $images, [1, $images.shape[0], $images.shape[1], $images.shape[2]]);\n }\n const [] = size;\n\n const inputs: ResizeNearestNeighborInputs = {images: batchImages};\n const attrs:\n ResizeNearestNeighborAttrs = {alignCorners, halfPixelCenters, size};\n\n // tslint:disable-next-line: no-unnecessary-type-assertion\n const res = ENGINE.runKernel(\n ResizeNearestNeighbor, inputs as {} as NamedTensorMap,\n attrs as {} as NamedAttrMap) as T;\n\n if (reshapedTo4D) {\n return reshape(res, [res.shape[1], res.shape[2], res.shape[3]]) as T;\n }\n return res;\n}\n\nexport const resizeNearestNeighbor = op({resizeNearestNeighbor_});\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport { Tensor1D, Tensor3D } from '../../tensor';\nimport { tensor1d } from '../tensor1d';\nimport { TensorLike } from '../../types';\nimport { op } from '../operation';\nimport { cast } from '../cast';\nimport { split } from '../split';\nimport { bincount } from '../bincount';\nimport { lessEqual } from '../less_equal';\nimport { greater } from '../greater';\nimport { sum } from '../sum';\nimport { add } from '../add';\nimport { mul } from '../mul';\nimport { div } from '../div';\nimport { sub } from '../sub';\nimport { round } from '../round';\nimport { where } from '../where';\nimport { fill } from '../fill';\nimport {slice} from '../slice';\nimport { range } from '../range';\nimport { tensor } from '../tensor';\nimport * as util from '../../util';\nimport { convertToTensor } from '../../tensor_util_env';\n\n/**\n * Performs image binarization with corresponding threshold\n * (depends on the method)value, which creates a binary image from a grayscale.\n * @param image 3d tensor of shape [imageHeight,imageWidth, depth],\n * where imageHeight and imageWidth must be positive.The image color\n * range should be [0, 255].\n * @param method Optional string from `'binary' | 'otsu'`\n * which specifies the method for thresholding. Defaults to 'binary'.\n * @param inverted Optional boolean whichspecifies\n * if colours should be inverted. Defaults to false.\n * @param threshValue Optional number which defines threshold value from 0 to 1.\n * Defaults to 0.5.\n * @return A 3d tensor of shape [imageHeight,imageWidth, depth], which\n * contains binarized image.\n */\n\nfunction threshold_(\n image: Tensor3D | TensorLike,\n method = 'binary',\n inverted = false,\n threshValue = 0.5\n): Tensor3D {\n const $image = convertToTensor(image, 'image', 'threshold');\n\n /* 0.2989, 0.5870, 0.1140 are represent luma coefficients in CCIR601.\n\tReference for converting between RGB and grayscale: https://en.wikipedia.org/wiki/Luma_%28video%29 */\n\n const RED_INTENCITY_COEF = 0.2989;\n const GREEN_INTENCITY_COEF = 0.5870;\n const BLUE_INTENCITY_COEF = 0.1140;\n const totalPixelsInImage = $image.shape[0] * $image.shape[1];\n\n let $threshold = mul(tensor1d([threshValue]), 255);\n let r, g, b, grayscale;\n\n util.assert(\n $image.rank === 3,\n () => 'Error in threshold: image must be rank 3,' +\n `but got rank ${$image.rank}.`);\n\n util.assert(\n $image.shape[2] === 3 || $image.shape[2]=== 1,\n () => 'Error in threshold: ' +\n 'image color channel must be equal to 3 or 1' +\n `but got ${$image.shape[2]}.`);\n\n util.assert(\n $image.dtype === 'int32' || $image.dtype === 'float32',\n () => 'Error in dtype: image dtype must be int32 or float32,' +\n `but got dtype ${$image.dtype}.`);\n\n util.assert(\n method === 'otsu' || method === 'binary',\n () => `Method must be binary or otsu, but was ${method}`);\n\n if ($image.shape[2] === 3) {\n [r, g, b] = split($image, [1, 1, 1], -1);\n const $r = mul(r,RED_INTENCITY_COEF);\n const $g = mul(g,GREEN_INTENCITY_COEF);\n const $b = mul(b,BLUE_INTENCITY_COEF);\n grayscale = add(add($r, $g), $b);\n } else {\n grayscale = image;\n }\n\n if (method === 'otsu') {\n const $histogram = bincount(cast(round(grayscale), 'int32') as Tensor1D,\n tensor([]),\n 256);\n $threshold = otsu($histogram, totalPixelsInImage);\n }\n\n const invCondition = inverted ?\n lessEqual(grayscale, $threshold) : greater(grayscale, $threshold);\n\n const result = cast(mul(invCondition,255), 'int32');\n\n return result as Tensor3D;\n}\n\nfunction otsu(histogram: Tensor1D, total: number):Tensor1D {\n\n let bestThresh = tensor1d([-1]);\n let bestInBetVar = tensor1d([0]);\n let cInBetVar = tensor1d([0]);\n let classFirst, classSecond, meanFirst,\n meanSec, weightForeground, weightBack;\n\n for (let index = 0; index < histogram.size-1; index++) {\n\n classFirst = slice(histogram, 0, index + 1);\n\n classSecond = slice(histogram,index + 1);\n\n weightForeground = div(sum(classFirst),total);\n\n weightBack = div(sum(classSecond),total);\n\n const meanFirstDivA = sum(mul(classFirst, range(0, classFirst.size)));\n\n meanFirst = div(meanFirstDivA, sum(classFirst) );\n\n const meanSecFill = fill(classSecond.shape, classFirst.size);\n const meanSecAdd = add(range(0,classSecond.size),meanSecFill);\n const meanSecMul = mul(classSecond, (meanSecAdd));\n meanSec = div(sum(meanSecMul), sum(classSecond));\n\n const cInBetVarSubA = sub(meanFirst, meanSec);\n const cInBetVarSubB = sub(meanFirst, meanSec);\n const cInBetVarMul = mul(weightForeground, weightBack);\n cInBetVar = mul(mul(cInBetVarMul,cInBetVarSubA), cInBetVarSubB);\n\n const condition = greater(cInBetVar, bestInBetVar);\n\n bestInBetVar = where(condition, cInBetVar, bestInBetVar);\n\n bestThresh = where(condition, tensor1d([index]), bestThresh);\n\n }\n return bestThresh;\n}\n\nexport const threshold = op({ threshold_ });\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../../engine';\nimport {Transform, TransformAttrs, TransformInputs} from '../../kernel_names';\nimport {NamedAttrMap} from '../../kernel_registry';\nimport {Tensor2D, Tensor4D} from '../../tensor';\nimport {NamedTensorMap} from '../../tensor_types';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport * as util from '../../util';\n\nimport {op} from '../operation';\n\n/**\n * Applies the given transform(s) to the image(s).\n *\n * @param image 4d tensor of shape `[batch, imageHeight, imageWidth, depth]`.\n * @param transforms Projective transform matrix/matrices. A tensor1d of length\n * 8 or tensor of size N x 8. If one row of transforms is [a0, a1, a2, b0,\n * b1, b2, c0, c1], then it maps the output point (x, y) to a transformed\n * input point (x', y') = ((a0 x + a1 y + a2) / k, (b0 x + b1 y + b2) / k),\n * where k = c0 x + c1 y + 1. The transforms are inverted compared to the\n * transform mapping input points to output points.\n * @param interpolation Interpolation mode.\n * Supported values: 'nearest', 'bilinear'. Default to 'nearest'.\n * @param fillMode Points outside the boundaries of the input are filled\n * according to the given mode, one of 'constant', 'reflect', 'wrap',\n * 'nearest'. Default to 'constant'.\n * 'reflect': (d c b a | a b c d | d c b a ) The input is extended by\n * reflecting about the edge of the last pixel.\n * 'constant': (k k k k | a b c d | k k k k) The input is extended by\n * filling all values beyond the edge with the same constant value k.\n * 'wrap': (a b c d | a b c d | a b c d) The input is extended by\n * wrapping around to the opposite edge.\n * 'nearest': (a a a a | a b c d | d d d d) The input is extended by\n * the nearest pixel.\n * @param fillValue A float represents the value to be filled outside the\n * boundaries when fillMode is 'constant'.\n * @param Output dimension after the transform, [height, width]. If undefined,\n * output is the same size as input image.\n *\n * @doc {heading: 'Operations', subheading: 'Images', namespace: 'image'}\n */\nfunction transform_(\n image: Tensor4D|TensorLike, transforms: Tensor2D|TensorLike,\n interpolation: 'nearest'|'bilinear' = 'nearest',\n fillMode: 'constant'|'reflect'|'wrap'|'nearest' = 'constant', fillValue = 0,\n outputShape?: [number, number]): Tensor4D {\n const $image = convertToTensor(image, 'image', 'transform', 'float32');\n const $transforms =\n convertToTensor(transforms, 'transforms', 'transform', 'float32');\n\n util.assert(\n $image.rank === 4,\n () => 'Error in transform: image must be rank 4,' +\n `but got rank ${$image.rank}.`);\n\n util.assert(\n $transforms.rank === 2 &&\n ($transforms.shape[0] === $image.shape[0] ||\n $transforms.shape[0] === 1) &&\n $transforms.shape[1] === 8,\n () => `Error in transform: Input transform should be batch x 8 or 1 x 8`);\n\n util.assert(\n outputShape == null || outputShape.length === 2,\n () =>\n 'Error in transform: outputShape must be [height, width] or null, ' +\n `but got ${outputShape}.`);\n\n const inputs: TransformInputs = {image: $image, transforms: $transforms};\n const attrs:\n TransformAttrs = {interpolation, fillMode, fillValue, outputShape};\n\n return ENGINE.runKernel(\n Transform, inputs as {} as NamedTensorMap, attrs as {} as NamedAttrMap);\n}\n\nexport const transform = op({transform_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../../tensor';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport {assert} from '../../util';\n\nimport {greaterEqual} from '../greater_equal';\nimport {lessEqual} from '../less_equal';\nimport {logicalAnd} from '../logical_and';\nimport {op} from '../operation';\nimport {range} from '../range';\nimport {reshape} from '../reshape';\nimport {scalar} from '../scalar';\nimport {stack} from '../stack';\nimport {sub} from '../sub';\nimport {unstack} from '../unstack';\nimport {where} from '../where';\nimport {zeros} from '../zeros';\n\n/**\n * Copy a tensor setting everything outside a central band in each innermost\n * matrix to zero.\n *\n * The band part is computed as follows: Assume input has `k` dimensions\n * `[I, J, K, ..., M, N]`, then the output is a tensor with the same shape where\n * `band[i, j, k, ..., m, n] = in_band(m, n) * input[i, j, k, ..., m, n]`.\n * The indicator function\n * `in_band(m, n) = (num_lower < 0 || (m-n) <= num_lower)`\n * `&& (num_upper < 0 || (n-m) <= num_upper)`\n *\n * ```js\n * const x = tf.tensor2d([[ 0, 1, 2, 3],\n * [-1, 0, 1, 2],\n * [-2, -1, 0, 1],\n * [-3, -2, -1, 0]]);\n * let y = tf.linalg.bandPart(x, 1, -1);\n * y.print(); // [[ 0, 1, 2, 3],\n * // [-1, 0, 1, 2],\n * // [ 0, -1, 0, 1],\n * // [ 0, 0 , -1, 0]]\n * let z = tf.linalg.bandPart(x, 2, 1);\n * z.print(); // [[ 0, 1, 0, 0],\n * // [-1, 0, 1, 0],\n * // [-2, -1, 0, 1],\n * // [ 0, -2, -1, 0]]\n * ```\n *\n * @param x Rank `k` tensor\n * @param numLower Number of subdiagonals to keep.\n * If negative, keep entire lower triangle.\n * @param numUpper Number of subdiagonals to keep.\n * If negative, keep entire upper triangle.\n * @returns Rank `k` tensor of the same shape as input.\n * The extracted banded tensor.\n *\n * @doc {heading:'Operations', subheading:'Linear Algebra', namespace:'linalg'}\n */\nfunction bandPart_(\n a: T|TensorLike, numLower: number, numUpper: number): T {\n assert(\n numLower % 1 === 0,\n () => `bandPart(): numLower must be an integer, got ${numLower}.`);\n assert(\n numUpper % 1 === 0,\n () => `bandPart(): numUpper must be an integer, got ${numUpper}.`);\n\n const $a = convertToTensor(a, 'a', 'bandPart');\n\n assert(\n $a.rank >= 2,\n () => `bandPart(): Rank must be at least 2, got ${$a.rank}.`);\n\n const shape = $a.shape;\n const [M, N] = $a.shape.slice(-2);\n\n if (!(numLower <= M)) {\n throw new Error(\n `bandPart(): numLower (${numLower})` +\n ` must not be greater than the number of rows (${M}).`);\n }\n if (!(numUpper <= N)) {\n throw new Error(\n `bandPart(): numUpper (${numUpper})` +\n ` must not be greater than the number of columns (${N}).`);\n }\n\n if (numLower < 0) {\n numLower = M;\n }\n if (numUpper < 0) {\n numUpper = N;\n }\n\n const i = reshape(range(0, M, 1, 'int32'), [-1, 1]);\n const j = range(0, N, 1, 'int32');\n const ij = sub(i, j);\n\n const inBand = logicalAnd(\n lessEqual(ij, scalar(+numLower, 'int32')),\n greaterEqual(ij, scalar(-numUpper, 'int32')));\n\n const zero = zeros([M, N], $a.dtype);\n\n return reshape(\n stack(unstack(reshape($a, [-1, M, N]))\n .map(mat => where(inBand, mat, zero))),\n shape) as T;\n}\n\nexport const bandPart = op({bandPart_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {Tensor1D, Tensor2D} from '../../tensor';\nimport {assert} from '../../util';\n\nimport {div} from '../div';\nimport {mul} from '../mul';\nimport {norm} from '../norm';\nimport {op} from '../operation';\nimport {split} from '../split';\nimport {squeeze} from '../squeeze';\nimport {stack} from '../stack';\nimport {sub} from '../sub';\nimport {sum} from '../sum';\n\n/**\n * Gram-Schmidt orthogonalization.\n *\n * ```js\n * const x = tf.tensor2d([[1, 2], [3, 4]]);\n * let y = tf.linalg.gramSchmidt(x);\n * y.print();\n * console.log('Orthogonalized:');\n * y.dot(y.transpose()).print(); // should be nearly the identity matrix.\n * console.log('First row direction maintained:');\n * const data = await y.array();\n * console.log(data[0][1] / data[0][0]); // should be nearly 2.\n * ```\n *\n * @param xs The vectors to be orthogonalized, in one of the two following\n * formats:\n * - An Array of `tf.Tensor1D`.\n * - A `tf.Tensor2D`, i.e., a matrix, in which case the vectors are the rows\n * of `xs`.\n * In each case, all the vectors must have the same length and the length\n * must be greater than or equal to the number of vectors.\n * @returns The orthogonalized and normalized vectors or matrix.\n * Orthogonalization means that the vectors or the rows of the matrix\n * are orthogonal (zero inner products). Normalization means that each\n * vector or each row of the matrix has an L2 norm that equals `1`.\n *\n * @doc {heading:'Operations', subheading:'Linear Algebra', namespace:'linalg'}\n */\nfunction gramSchmidt_(xs: Tensor1D[]|Tensor2D): Tensor1D[]|Tensor2D {\n let inputIsTensor2D: boolean;\n if (Array.isArray(xs)) {\n inputIsTensor2D = false;\n assert(\n xs != null && xs.length > 0,\n () => 'Gram-Schmidt process: input must not be null, undefined, or ' +\n 'empty');\n const dim = xs[0].shape[0];\n for (let i = 1; i < xs.length; ++i) {\n assert(\n xs[i].shape[0] === dim,\n () =>\n 'Gram-Schmidt: Non-unique lengths found in the input vectors: ' +\n `(${(xs as Tensor1D[])[i].shape[0]} vs. ${dim})`);\n }\n } else {\n inputIsTensor2D = true;\n xs = split(xs, xs.shape[0], 0).map(x => squeeze(x, [0]));\n }\n\n assert(\n xs.length <= xs[0].shape[0],\n () => `Gram-Schmidt: Number of vectors (${\n (xs as Tensor1D[]).length}) exceeds ` +\n `number of dimensions (${(xs as Tensor1D[])[0].shape[0]}).`);\n\n const ys: Tensor1D[] = [];\n const xs1d = xs;\n for (let i = 0; i < xs.length; ++i) {\n ys.push(ENGINE.tidy(() => {\n let x = xs1d[i];\n if (i > 0) {\n for (let j = 0; j < i; ++j) {\n const proj = mul(sum(mul(ys[j], x)), ys[j]);\n x = sub(x, proj);\n }\n }\n return div(x, norm(x, 'euclidean'));\n }));\n }\n\n if (inputIsTensor2D) {\n return stack(ys, 0) as Tensor2D;\n } else {\n return ys;\n }\n}\n\nexport const gramSchmidt = op({gramSchmidt_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {ENGINE} from '../../engine';\nimport {dispose} from '../../globals';\nimport {Tensor, Tensor2D} from '../../tensor';\nimport {assert} from '../../util';\n\nimport {clone} from '../clone';\nimport {concat} from '../concat';\nimport {div} from '../div';\nimport {eye} from '../eye';\nimport {greater} from '../greater';\nimport {matMul} from '../mat_mul';\nimport {mul} from '../mul';\nimport {neg} from '../neg';\nimport {norm} from '../norm';\nimport {op} from '../operation';\nimport {reshape} from '../reshape';\nimport {slice} from '../slice';\nimport {stack} from '../stack';\nimport {sub} from '../sub';\nimport {tensor2d} from '../tensor2d';\nimport {transpose} from '../transpose';\nimport {unstack} from '../unstack';\nimport {where} from '../where';\n\n/**\n * Compute QR decomposition of m-by-n matrix using Householder transformation.\n *\n * Implementation based on\n * [http://www.cs.cornell.edu/~bindel/class/cs6210-f09/lec18.pdf]\n * (http://www.cs.cornell.edu/~bindel/class/cs6210-f09/lec18.pdf)\n *\n * ```js\n * const a = tf.tensor2d([[1, 2], [3, 4]]);\n * let [q, r] = tf.linalg.qr(a);\n * console.log('Q');\n * q.print();\n * console.log('R');\n * r.print();\n * console.log('Orthogonalized');\n * q.dot(q.transpose()).print() // should be nearly the identity matrix.\n * console.log('Reconstructed');\n * q.dot(r).print(); // should be nearly [[1, 2], [3, 4]];\n * ```\n *\n * @param x The `tf.Tensor` to be QR-decomposed. Must have rank >= 2. Suppose\n * it has the shape `[..., M, N]`.\n * @param fullMatrices An optional boolean parameter. Defaults to `false`.\n * If `true`, compute full-sized `Q`. If `false` (the default),\n * compute only the leading N columns of `Q` and `R`.\n * @returns An `Array` of two `tf.Tensor`s: `[Q, R]`. `Q` is a unitary matrix,\n * i.e., its columns all have unit norm and are mutually orthogonal.\n * If `M >= N`,\n * If `fullMatrices` is `false` (default),\n * - `Q` has a shape of `[..., M, N]`,\n * - `R` has a shape of `[..., N, N]`.\n * If `fullMatrices` is `true` (default),\n * - `Q` has a shape of `[..., M, M]`,\n * - `R` has a shape of `[..., M, N]`.\n * If `M < N`,\n * - `Q` has a shape of `[..., M, M]`,\n * - `R` has a shape of `[..., M, N]`.\n * @throws If the rank of `x` is less than 2.\n *\n * @doc {heading:'Operations',\n * subheading:'Linear Algebra',\n * namespace:'linalg'}\n */\nfunction qr_(x: Tensor, fullMatrices = false): [Tensor, Tensor] {\n assert(\n x.rank >= 2,\n () => `qr() requires input tensor to have a rank >= 2, but got rank ${\n x.rank}`);\n\n if (x.rank === 2) {\n return qr2d(x as Tensor2D, fullMatrices);\n } else {\n // Rank > 2.\n // TODO(cais): Below we split the input into individual 2D tensors,\n // perform QR decomposition on them and then stack the results back\n // together. We should explore whether this can be parallelized.\n const outerDimsProd = x.shape.slice(0, x.shape.length - 2)\n .reduce((value, prev) => value * prev);\n const x2ds = unstack(\n reshape(\n x,\n [\n outerDimsProd, x.shape[x.shape.length - 2],\n x.shape[x.shape.length - 1]\n ]),\n 0);\n const q2ds: Tensor2D[] = [];\n const r2ds: Tensor2D[] = [];\n x2ds.forEach(x2d => {\n const [q2d, r2d] = qr2d(x2d as Tensor2D, fullMatrices);\n q2ds.push(q2d);\n r2ds.push(r2d);\n });\n const q = reshape(stack(q2ds, 0), x.shape);\n const r = reshape(stack(r2ds, 0), x.shape);\n return [q, r];\n }\n}\n\nfunction qr2d(x: Tensor2D, fullMatrices = false): [Tensor2D, Tensor2D] {\n return ENGINE.tidy(() => {\n assert(\n x.shape.length === 2,\n () => `qr2d() requires a 2D Tensor, but got a ${\n x.shape.length}D Tensor.`);\n\n const m = x.shape[0];\n const n = x.shape[1];\n\n let q = eye(m); // Orthogonal transform so far.\n let r = clone(x); // Transformed matrix so far.\n\n const one2D = tensor2d([[1]], [1, 1]);\n let w: Tensor2D = clone(one2D);\n\n const iters = m >= n ? n : m;\n for (let j = 0; j < iters; ++j) {\n // This tidy within the for-loop ensures we clean up temporary\n // tensors as soon as they are no longer needed.\n const rTemp = r;\n const wTemp = w;\n const qTemp = q;\n [w, r, q] = ENGINE.tidy((): [Tensor2D, Tensor2D, Tensor2D] => {\n // Find H = I - tau * w * w', to put zeros below R(j, j).\n const rjEnd1 = slice(r, [j, j], [m - j, 1]);\n const normX = norm(rjEnd1);\n const rjj = slice(r, [j, j], [1, 1]);\n\n // The sign() function returns 0 on 0, which causes division by zero.\n const s = where(greater(rjj, 0), tensor2d([[-1]]), tensor2d([[1]]));\n\n const u1 = sub(rjj, mul(s, normX));\n const wPre = div(rjEnd1, u1);\n if (wPre.shape[0] === 1) {\n w = clone(one2D);\n } else {\n w = concat(\n [\n one2D,\n slice(wPre, [1, 0], [wPre.shape[0] - 1, wPre.shape[1]]) as\n Tensor2D\n ],\n 0);\n }\n const tau = neg(div(matMul(s, u1), normX)) as Tensor2D;\n\n // -- R := HR, Q := QH.\n const rjEndAll = slice(r, [j, 0], [m - j, n]);\n const tauTimesW: Tensor2D = mul(tau, w);\n const wT: Tensor2D = transpose(w);\n if (j === 0) {\n r = sub(rjEndAll, matMul(tauTimesW, matMul(wT, rjEndAll)));\n } else {\n const rTimesTau: Tensor2D =\n sub(rjEndAll, matMul(tauTimesW, matMul(wT, rjEndAll)));\n r = concat([slice(r, [0, 0], [j, n]), rTimesTau], 0);\n }\n const tawTimesWT: Tensor2D = transpose(tauTimesW);\n const qAllJEnd = slice(q, [0, j], [m, q.shape[1] - j]);\n if (j === 0) {\n q = sub(qAllJEnd, matMul(matMul(qAllJEnd, w), tawTimesWT));\n } else {\n const qTimesTau: Tensor2D =\n sub(qAllJEnd, matMul(matMul(qAllJEnd, w), tawTimesWT));\n q = concat([slice(q, [0, 0], [m, j]), qTimesTau], 1);\n }\n return [w, r, q];\n });\n dispose([rTemp, wTemp, qTemp]);\n }\n\n if (!fullMatrices && m > n) {\n q = slice(q, [0, 0], [m, n]);\n r = slice(r, [0, 0], [n, n]);\n }\n\n return [q, r];\n }) as [Tensor2D, Tensor2D];\n}\n\nexport const qr = op({qr_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nexport enum Reduction {\n NONE,\n MEAN,\n SUM,\n SUM_BY_NONZERO_WEIGHTS\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor} from '../../tensor';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\n\nimport {cast} from '../cast';\nimport {div} from '../div';\nimport {Reduction} from '../loss_ops_utils';\nimport {mean} from '../mean';\nimport {mul} from '../mul';\nimport {notEqual} from '../not_equal';\nimport {ones} from '../ones';\nimport {op} from '../operation';\nimport {scalar} from '../scalar';\nimport {sum} from '../sum';\n\n/**\n * Computes the weighted loss between two tensors.\n *\n * @param losses Tensor of shape `[batch_size, d1, ..., dN]`.\n * @param weights Tensor whose rank is either 0, or the same rank as\n * `losses`, and must be broadcastable to `losses` (i.e., all\n * dimensions must be either `1`, or the same as the corresponding\n * `losses` dimension).\n *\n * @doc {heading: 'Training', subheading: 'Losses', namespace: 'losses'}\n */\nfunction computeWeightedLoss_(\n losses: T|TensorLike, weights?: Tensor|TensorLike,\n reduction = Reduction.SUM_BY_NONZERO_WEIGHTS): O {\n const $losses = convertToTensor(losses, 'losses', 'computeWeightedLoss');\n let $weights: Tensor = null;\n if (weights != null) {\n $weights = convertToTensor(weights, 'weights', 'computeWeightedLoss');\n }\n\n const weightedLoss = ($weights == null) ? $losses : mul($losses, $weights);\n\n if (reduction === Reduction.NONE) {\n return weightedLoss as O;\n }\n if (reduction === Reduction.SUM) {\n return sum(weightedLoss);\n }\n if (reduction === Reduction.MEAN) {\n if ($weights == null) {\n return mean(weightedLoss);\n } else {\n const broadcastFactor = $losses.size / $weights.size;\n const result = div(sum(weightedLoss), sum($weights));\n return broadcastFactor > 1 ? div(result, scalar(broadcastFactor)) :\n result as O;\n }\n }\n if (reduction === Reduction.SUM_BY_NONZERO_WEIGHTS) {\n if ($weights == null) {\n return div(sum(weightedLoss), scalar($losses.size));\n } else {\n const broadcastedWeights = mul($weights, ones($losses.shape));\n\n const numNonZeros =\n cast(sum(notEqual(broadcastedWeights, scalar(0))), 'float32');\n return div(sum(weightedLoss), numNonZeros);\n }\n }\n\n throw Error(`Unknown reduction: ${reduction}`);\n}\nexport const computeWeightedLoss = op({computeWeightedLoss_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../../tensor';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport {assertShapesMatch} from '../../util';\nimport {abs} from '../abs';\nimport {Reduction} from '../loss_ops_utils';\nimport {op} from '../operation';\nimport {sub} from '../sub';\n\nimport {computeWeightedLoss} from './compute_weighted_loss';\n\n/**\n * Computes the absolute difference loss between two tensors.\n *\n * @param labels The ground truth output tensor, same dimensions as\n * 'predictions'.\n * @param predictions The predicted outputs.\n * @param weights Tensor whose rank is either 0, or the same rank as\n * `labels`, and must be broadcastable to `labels` (i.e., all dimensions\n * must be either `1`, or the same as the corresponding `losses`\n * dimension).\n * @param reduction Type of reduction to apply to loss. Should be of type\n * `Reduction`\n *\n * @doc {heading: 'Training', subheading: 'Losses', namespace: 'losses'}\n */\nfunction absoluteDifference_(\n labels: T|TensorLike, predictions: T|TensorLike,\n weights?: Tensor|TensorLike,\n reduction = Reduction.SUM_BY_NONZERO_WEIGHTS): O {\n const $labels = convertToTensor(labels, 'labels', 'absoluteDifference');\n const $predictions =\n convertToTensor(predictions, 'predictions', 'absoluteDifference');\n let $weights: Tensor = null;\n if (weights != null) {\n $weights = convertToTensor(weights, 'weights', 'absoluteDifference');\n }\n assertShapesMatch(\n $labels.shape, $predictions.shape, 'Error in absoluteDifference: ');\n\n const losses = abs(sub($labels, $predictions));\n return computeWeightedLoss(losses, $weights, reduction);\n}\n\nexport const absoluteDifference = op({absoluteDifference_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor} from '../../tensor';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport {assertShapesMatch} from '../../util';\nimport {Reduction} from '../loss_ops_utils';\nimport {mul} from '../mul';\nimport {op} from '../operation';\nimport {scalar} from '../scalar';\nimport {sub} from '../sub';\nimport {sum} from '../sum';\n\nimport {computeWeightedLoss} from './compute_weighted_loss';\n\n/**\n * Computes the cosine distance loss between two tensors.\n *\n * @param labels The ground truth output tensor, same dimensions as\n * 'predictions'.\n * @param predictions The predicted outputs.\n * @param axis The dimension along which the cosine distance is computed.\n * @param weights Tensor whose rank is either 0, or the same rank as\n * `labels`, and must be broadcastable to `labels` (i.e., all dimensions\n * must be either `1`, or the same as the corresponding `losses`\n * dimension).\n * @param reduction Type of reduction to apply to loss. Should be of type\n * `Reduction`\n *\n * @doc {heading: 'Training', subheading: 'Losses', namespace: 'losses'}\n */\nfunction cosineDistance_(\n labels: T|TensorLike, predictions: T|TensorLike, axis: number,\n weights?: Tensor|TensorLike,\n reduction = Reduction.SUM_BY_NONZERO_WEIGHTS): O {\n const $labels = convertToTensor(labels, 'labels', 'cosineDistance');\n const $predictions =\n convertToTensor(predictions, 'predictions', 'cosineDistance');\n let $weights: Tensor = null;\n if (weights != null) {\n $weights = convertToTensor(weights, 'weights', 'cosineDistance');\n }\n assertShapesMatch(\n $labels.shape, $predictions.shape, 'Error in cosineDistance: ');\n\n const one = scalar(1);\n const losses = sub(one, sum(mul($labels, $predictions), axis, true));\n return computeWeightedLoss(losses, $weights, reduction);\n}\nexport const cosineDistance = op({cosineDistance_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor} from '../../tensor';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport {assertShapesMatch} from '../../util';\nimport {Reduction} from '../loss_ops_utils';\nimport {mul} from '../mul';\nimport {op} from '../operation';\nimport {relu} from '../relu';\nimport {scalar} from '../scalar';\nimport {sub} from '../sub';\n\nimport {computeWeightedLoss} from './compute_weighted_loss';\n\n/**\n * Computes the Hinge loss between two tensors.\n *\n * @param labels The ground truth output tensor, same dimensions as\n * 'predictions'.\n * @param predictions The predicted outputs.\n * @param weights Tensor whose rank is either 0, or the same rank as\n * `labels`, and must be broadcastable to `labels` (i.e., all dimensions\n * must be either `1`, or the same as the corresponding `losses`\n * dimension).\n * @param reduction Type of reduction to apply to loss. Should be of type\n * `Reduction`\n *\n * @doc {heading: 'Training', subheading: 'Losses', namespace: 'losses'}\n */\nfunction hingeLoss_(\n labels: T|TensorLike, predictions: T|TensorLike,\n weights?: Tensor|TensorLike,\n reduction = Reduction.SUM_BY_NONZERO_WEIGHTS): O {\n let $labels = convertToTensor(labels, 'labels', 'hingeLoss');\n const $predictions = convertToTensor(predictions, 'predictions', 'hingeLoss');\n let $weights: Tensor = null;\n if (weights != null) {\n $weights = convertToTensor(weights, 'weights', 'hingeLoss');\n }\n assertShapesMatch($labels.shape, $predictions.shape, 'Error in hingeLoss: ');\n\n const one = scalar(1);\n // Convert binary labels to (-1, 1)\n $labels = sub(mul(scalar(2), $labels), one);\n const losses = relu(sub(one, mul($labels, $predictions)));\n return computeWeightedLoss(losses, $weights, reduction);\n}\nexport const hingeLoss = op({hingeLoss_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../../tensor';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport {assertShapesMatch} from '../../util';\nimport {abs} from '../abs';\nimport {add} from '../add';\nimport {Reduction} from '../loss_ops_utils';\nimport {minimum} from '../minimum';\nimport {mul} from '../mul';\nimport {op} from '../operation';\nimport {scalar} from '../scalar';\nimport {square} from '../square';\nimport {sub} from '../sub';\n\nimport {computeWeightedLoss} from './compute_weighted_loss';\n\n/**\n * Computes the Huber loss between two tensors.\n *\n * @param labels The ground truth output tensor, same dimensions as\n * 'predictions'.\n * @param predictions The predicted outputs.\n * @param weights Tensor whose rank is either 0, or the same rank as\n * `labels`, and must be broadcastable to `labels` (i.e., all dimensions\n * must be either `1`, or the same as the corresponding `losses`\n * dimension).\n * @param delta Point where Huber loss changes from quadratic to linear.\n * @param reduction Type of reduction to apply to loss. Should be of type\n * `Reduction`.\n *\n * @doc {heading: 'Training', subheading: 'Losses', namespace: 'losses'}\n */\nfunction huberLoss_(\n labels: T|TensorLike, predictions: T|TensorLike,\n weights?: Tensor|TensorLike, delta = 1.0,\n reduction = Reduction.SUM_BY_NONZERO_WEIGHTS): O {\n const $labels = convertToTensor(labels, 'labels', 'huberLoss');\n const $predictions = convertToTensor(predictions, 'predictions', 'huberLoss');\n let $weights: Tensor = null;\n if (weights != null) {\n $weights = convertToTensor(weights, 'weights', 'huberLoss');\n }\n assertShapesMatch($labels.shape, $predictions.shape, 'Error in huberLoss: ');\n\n const deltaScalar = scalar(delta);\n const error = abs(sub($predictions, $labels));\n const quadratic = minimum(error, deltaScalar);\n const linear = sub(error, quadratic);\n\n const losses =\n add(mul(scalar(0.5), square(quadratic)), mul(deltaScalar, linear));\n return computeWeightedLoss(losses, $weights, reduction);\n}\nexport const huberLoss = op({huberLoss_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../../tensor';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport {assertShapesMatch} from '../../util';\nimport {add} from '../add';\nimport {log} from '../log';\nimport {Reduction} from '../loss_ops_utils';\nimport {mul} from '../mul';\nimport {neg} from '../neg';\nimport {op} from '../operation';\nimport {scalar} from '../scalar';\nimport {sub} from '../sub';\n\nimport {computeWeightedLoss} from './compute_weighted_loss';\n\n/**\n * Computes the log loss between two tensors.\n *\n * @param labels The ground truth output tensor, same dimensions as\n * 'predictions'.\n * @param predictions The predicted outputs.\n * @param weights Tensor whose rank is either 0, or the same rank as\n * `labels`, and must be broadcastable to `labels` (i.e., all dimensions\n * must be either `1`, or the same as the corresponding `losses`\n * dimension).\n * @param epsilon A small increment to avoid taking log of zero\n * @param reduction Type of reduction to apply to loss. Should be of type\n * `Reduction`\n *\n * @doc {heading: 'Training', subheading: 'Losses', namespace: 'losses'}\n */\nfunction logLoss_(\n labels: T|TensorLike, predictions: T|TensorLike,\n weights?: Tensor|TensorLike, epsilon = 1e-7,\n reduction = Reduction.SUM_BY_NONZERO_WEIGHTS): O {\n const $labels = convertToTensor(labels, 'labels', 'logLoss');\n const $predictions = convertToTensor(predictions, 'predictions', 'logLoss');\n let $weights: Tensor = null;\n if (weights != null) {\n $weights = convertToTensor(weights, 'weights', 'logLoss');\n }\n assertShapesMatch($labels.shape, $predictions.shape, 'Error in logLoss: ');\n\n const one = scalar(1);\n const epsilonScalar = scalar(epsilon);\n\n const l1 = neg(mul($labels, log(add($predictions, epsilonScalar))));\n const l2 =\n mul(sub(one, $labels), log(add(sub(one, $predictions), epsilonScalar)));\n const losses = sub(l1, l2);\n return computeWeightedLoss(losses, $weights, reduction);\n}\nexport const logLoss = op({logLoss_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../../tensor';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport {assertShapesMatch} from '../../util';\nimport {Reduction} from '../loss_ops_utils';\nimport {op} from '../operation';\nimport {squaredDifference} from '../squared_difference';\n\nimport {computeWeightedLoss} from './compute_weighted_loss';\n\n/**\n * Computes the mean squared error between two tensors.\n *\n * @param labels The ground truth output tensor, same dimensions as\n * 'predictions'.\n * @param predictions The predicted outputs.\n * @param weights Tensor whose rank is either 0, or the same rank as\n * `labels`, and must be broadcastable to `labels` (i.e., all dimensions\n * must be either `1`, or the same as the corresponding `losses`\n * dimension).\n * @param reduction Type of reduction to apply to loss. Should be of type\n * `Reduction`\n *\n * @doc {heading: 'Training', subheading: 'Losses', namespace: 'losses'}\n */\nfunction meanSquaredError_(\n labels: T|TensorLike, predictions: T|TensorLike,\n weights?: Tensor|TensorLike,\n reduction = Reduction.SUM_BY_NONZERO_WEIGHTS): O {\n const $labels = convertToTensor(labels, 'labels', 'meanSquaredError');\n const $predictions =\n convertToTensor(predictions, 'predictions', 'meanSquaredError');\n let $weights: Tensor = null;\n if (weights != null) {\n $weights = convertToTensor(weights, 'weights', 'meanSquaredError');\n }\n assertShapesMatch(\n $labels.shape, $predictions.shape, 'Error in meanSquaredError: ');\n\n const losses = squaredDifference($labels, $predictions);\n return computeWeightedLoss(losses, $weights, reduction);\n}\nexport const meanSquaredError = op({meanSquaredError_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '../../tensor';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport {assertShapesMatch} from '../../util';\nimport {abs} from '../abs';\nimport {add} from '../add';\nimport {exp} from '../exp';\nimport {log1p} from '../log1p';\nimport {Reduction} from '../loss_ops_utils';\nimport {mul} from '../mul';\nimport {neg} from '../neg';\nimport {op} from '../operation';\nimport {relu} from '../relu';\nimport {scalar} from '../scalar';\nimport {sub} from '../sub';\n\nimport {computeWeightedLoss} from './compute_weighted_loss';\n\nfunction sigmoidCrossEntropyWithLogits_(\n labels: T|TensorLike, logits: T|TensorLike): O {\n const $labels =\n convertToTensor(labels, 'labels', 'sigmoidCrossEntropyWithLogits');\n const $logits =\n convertToTensor(logits, 'logits', 'sigmoidCrossEntropyWithLogits');\n assertShapesMatch(\n $labels.shape, $logits.shape, 'Error in sigmoidCrossEntropyWithLogits: ');\n\n /**\n * Implementation Details:\n *\n * For brevity, let `x = logits`, `z = labels`. The logistic loss is\n * z * -log(sigmoid(x)) + (1 - z) * -log(1 - sigmoid(x))\n * = z * -log(1 / (1 + exp(-x))) + (1 - z) * -log(exp(-x) / (1 + exp(-x)))\n * = z * log(1 + exp(-x)) + (1 - z) * (-log(exp(-x)) + log(1 + exp(-x)))\n * = z * log(1 + exp(-x)) + (1 - z) * (x + log(1 + exp(-x))\n * = (1 - z) * x + log(1 + exp(-x))\n * = x - x * z + log(1 + exp(-x))\n *\n * For x < 0, to avoid overflow in exp(-x), we reformulate the above\n * x - x * z + log(1 + exp(-x))\n * = log(exp(x)) - x * z + log(1 + exp(-x))\n * = - x * z + log(1 + exp(x))\n *\n * Hence, to ensure stability and avoid overflow, the implementation uses\n * this equivalent formulation:\n * max(x, 0) - x * z + log(1 + exp(-abs(x)))\n */\n const maxOutput = relu($logits);\n const outputXTarget = mul($logits, $labels);\n const sigmoidOutput = log1p(exp(neg(abs($logits))));\n\n return add(sub(maxOutput, outputXTarget), sigmoidOutput);\n}\n\n/**\n * Computes the sigmoid cross entropy loss between two tensors.\n *\n * If labelSmoothing is nonzero, smooth the labels towards 1/2:\n *\n * newMulticlassLabels = multiclassLabels * (1 - labelSmoothing)\n * + 0.5 * labelSmoothing\n *\n * @param multiClassLabels The ground truth output tensor of shape\n * [batch_size, num_classes], same dimensions as 'predictions'.\n * @param logits The predicted outputs.\n * @param weights Tensor whose rank is either 0, or the same rank as\n * `labels`, and must be broadcastable to `labels` (i.e., all dimensions\n * must be either `1`, or the same as the corresponding `losses`\n * dimension).\n * @param labelSmoothing If greater than 0, then smooth the labels.\n * @param reduction Type of reduction to apply to loss. Should be of type\n * `Reduction`\n *\n * @doc { heading: 'Training', subheading: 'Losses', namespace: 'losses' }\n */\nfunction sigmoidCrossEntropy_(\n multiClassLabels: T|TensorLike, logits: T|TensorLike,\n weights?: Tensor|TensorLike, labelSmoothing = 0,\n reduction = Reduction.SUM_BY_NONZERO_WEIGHTS): O {\n let $multiClassLabels = convertToTensor(\n multiClassLabels, 'multiClassLabels', 'sigmoidCrossEntropy');\n const $logits = convertToTensor(logits, 'logits', 'sigmoidCrossEntropy');\n let $weights: Tensor = null;\n if (weights != null) {\n $weights = convertToTensor(weights, 'weights', 'sigmoidCrossEntropy');\n }\n assertShapesMatch(\n $multiClassLabels.shape, $logits.shape, 'Error in sigmoidCrossEntropy: ');\n\n if (labelSmoothing > 0) {\n const labelSmoothingScalar = scalar(labelSmoothing);\n const one = scalar(1);\n const half = scalar(0.5);\n\n $multiClassLabels =\n add(mul($multiClassLabels, sub(one, labelSmoothingScalar)),\n mul(half, labelSmoothingScalar));\n }\n const losses = sigmoidCrossEntropyWithLogits_($multiClassLabels, $logits);\n\n return computeWeightedLoss(losses, $weights, reduction);\n}\n\nexport const sigmoidCrossEntropy = op({sigmoidCrossEntropy_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {customGrad} from '../../gradients';\nimport {Tensor} from '../../tensor';\nimport {GradSaveFunc} from '../../tensor_types';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport {assertShapesMatch} from '../../util';\nimport {add} from '../add';\nimport {expandShapeToKeepDim} from '../axis_util';\nimport {cast} from '../cast';\nimport {div} from '../div';\nimport {exp} from '../exp';\nimport {logSumExp} from '../log_sum_exp';\nimport {Reduction} from '../loss_ops_utils';\nimport {mul} from '../mul';\nimport {neg} from '../neg';\nimport {op} from '../operation';\nimport {reshape} from '../reshape';\nimport {scalar} from '../scalar';\nimport {sub} from '../sub';\nimport {sum} from '../sum';\n\nimport {computeWeightedLoss} from './compute_weighted_loss';\n\n/**\n * Computes softmax cross entropy between logits and labels.\n *\n * Measures the probability error in discrete classification tasks in which\n * the classes are mutually exclusive (each entry is in exactly one class).\n * For example, each CIFAR-10 image is labeled with one and only one label: an\n * image can be a dog or a truck, but not both.\n *\n * `NOTE`: While the classes are mutually exclusive, their probabilities need\n * not be. All that is required is that each row of labels is a valid\n * probability distribution. If they are not, the computation of the gradient\n * will be incorrect.\n *\n * `WARNING`: This op expects unscaled logits, since it performs a softmax on\n * logits internally for efficiency. Do not call this op with the output of\n * softmax, as it will produce incorrect results.\n *\n * logits and labels must have the same shape, e.g. [batch_size, num_classes]\n * and the same dtype.\n * @param labels The labels array.\n * @param logits The logits array.\n * @param dim The dimension softmax would be performed on. Defaults to `-1`\n * which indicates the last dimension.\n */\nfunction softmaxCrossEntropyWithLogits_(\n labels: T, logits: T, dim = -1): O {\n if (dim === -1) {\n dim = logits.rank - 1;\n }\n\n if (dim !== logits.rank - 1) {\n throw Error(\n `Softmax cross entropy along a non-last dimension is not yet ` +\n `supported. Labels / logits was rank ${logits.rank} ` +\n `and dim was ${dim}`);\n }\n // Use a custom gradient for numerical stability.\n const customOp =\n customGrad((labels: Tensor, logits: Tensor, save: GradSaveFunc) => {\n // Reference:\n // 1. http://cs231n.github.io/linear-classify/#softmax\n // 2. https://blog.feedly.com/tricks-of-the-trade-logsumexp/\n const keepDims = true;\n const lse = logSumExp(logits, [dim], keepDims);\n const logResult = sub(cast(logits, 'float32'), lse);\n save([labels, logResult]);\n\n const costVector = neg(mul(logResult, labels));\n const value: O = sum(costVector, [dim]);\n\n const gradFunc = (dy: O, saved: Tensor[]) => {\n const [labels, logResult] = saved;\n const dyShape = expandShapeToKeepDim(dy.shape, [dim]);\n return [\n mul(reshape(dy, dyShape),\n sub(cast(labels, 'float32'), exp(logResult))),\n mul(reshape(dy, dyShape),\n sub(exp(logResult), cast(labels, 'float32'))),\n ];\n };\n return {value, gradFunc};\n });\n\n return customOp(labels, logits);\n}\n\n/**\n * Computes the softmax cross entropy loss between two tensors.\n *\n * If labelSmoothing is nonzero, smooth the labels towards 1/2:\n *\n * newOnehotLabels = onehotLabels * (1 - labelSmoothing)\n * + labelSmoothing / numClasses\n *\n * @param onehotLabels One hot encoded labels\n * [batch_size, num_classes], same dimensions as 'predictions'.\n * @param logits The predicted outputs.\n * @param weights Tensor whose rank is either 0, or 1, and must be\n * broadcastable to `loss` of shape [batch_size]\n * @param labelSmoothing If greater than 0, then smooth the labels.\n * @param reduction Type of reduction to apply to loss. Should be of type\n * `Reduction`\n *\n * @doc { heading: 'Training', subheading: 'Losses', namespace: 'losses' }\n */\nfunction softmaxCrossEntropy_(\n onehotLabels: T|TensorLike, logits: T|TensorLike,\n weights?: Tensor|TensorLike, labelSmoothing = 0,\n reduction = Reduction.SUM_BY_NONZERO_WEIGHTS): O {\n let $onehotLabels =\n convertToTensor(onehotLabels, 'onehotLabels', 'softmaxCrossEntropy');\n const $logits = convertToTensor(logits, 'logits', 'softmaxCrossEntropy');\n let $weights: Tensor = null;\n\n if (weights != null) {\n $weights = convertToTensor(weights, 'weights', 'softmaxCrossEntropy');\n }\n\n assertShapesMatch(\n $onehotLabels.shape, $logits.shape, 'Error in softmaxCrossEntropy: ');\n\n if (labelSmoothing > 0) {\n const labelSmoothingScalar = scalar(labelSmoothing);\n const one = scalar(1);\n const numClasses = scalar($onehotLabels.shape[1]);\n\n $onehotLabels =\n add(mul($onehotLabels, sub(one, labelSmoothingScalar)),\n div(labelSmoothingScalar, numClasses));\n }\n\n const losses = softmaxCrossEntropyWithLogits_($onehotLabels, $logits);\n\n return computeWeightedLoss(losses, $weights, reduction);\n}\n\nexport const softmaxCrossEntropy = op({softmaxCrossEntropy_});\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {SparseFillEmptyRows, SparseFillEmptyRowsInputs} from '../../kernel_names';\nimport {Scalar, Tensor, Tensor1D, Tensor2D} from '../../tensor';\nimport {NamedTensorMap} from '../../tensor_types';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {ScalarLike, TensorLike} from '../../types';\nimport {op} from '../operation';\n\n/**\n * The input SparseTensor is represented via the map of inputs {`indices`,\n * `values`, `denseShape`}. The output SparseTensor has the same `denseShape`\n * but with indices `outputIndices` and values `outputValues`. This op inserts a\n * single entry for every row that doesn't have any values. The index is created\n * as `[row, 0, ..., 0]` and the inserted value is `defaultValue`.\n *\n * For example, suppose `spInput` has shape [5, 6] and non-empty values:\n * [0, 1]: a\n * [0, 3]: b\n * [2, 0]: c\n * [3, 1]: d\n *\n * Rows 1 and 4 are empty, so the output will be of shape [5, 6] with values:\n * [0, 1]: a\n * [0, 3]: b\n * [1, 0]: `defaultValue`\n * [2, 0]: c\n * [3, 1]: d\n * [4, 0]: `defaultValue`\n *\n * The output SparseTensor will be in row-major order and will have the same\n * shape as the input.\n *\n * This op also returns an indicator vector shaped [dense_shape[0]] such that\n * emptyRowIndicator[i] = True iff row i was an empty row.\n *\n * And a reverse index map vector shaped [indices.shape[0]] that is used during\n * backpropagation, reverseIndexMap[i] = outi s.t. indices[i, j] ==\n * outputIndices[outi, j] for all j\n *\n * ```js\n * const result = tf.sparse.sparseFillEmptyRows(\n * [[0, 0], [1, 0], [1, 3], [1, 4], [3, 2], [3, 3]],\n * [0, 10, 13, 14, 32, 33], [5, 6], -1);\n * console.log(result);\n * result['outputIndices'].print(); // [[0, 0], [1, 0], [1, 3], [1, 4],\n * // [2, 0], [3, 2], [3, 3], [4, 0]]\n * result['outputValues'].print(); // [0, 10, 13, 14,-1, 32, 33, -1]\n * result['emptyRowIndicator'].print(); // [false, false, true, false, true]\n * result['reverseIndexMap'].print(); // [0, 1, 2, 3, 5, 6]\n * ```\n * @param indices: 2-D. The indices of the sparse tensor.\n * @param values: 1-D. The values of the sparse tensor.\n * @param denseShape: 1-D. The shape of the sparse tensor.\n * @param defaultValue: 0-D. Default value to insert into location [row, 0, ...,\n * 0] for rows missing from the input sparse tensor.\n * @return A map with the following properties:\n * - outputIndices\n * - outputValues: 1-D. The values of the filled sparse tensor.\n * - emptyRowIndicator: 1-D. Whether the dense row was missing in the input\n * sparse tensor.\n * - reverseIndexMap: 1-D. A map from the input indices to the output\n * indices.\n * @doc {heading: 'Operations', subheading: 'Sparse'}\n */\nfunction sparseFillEmptyRows_(\n indices: Tensor2D|TensorLike, values: Tensor1D|TensorLike,\n denseShape: Tensor1D|TensorLike,\n defaultValue: Scalar|ScalarLike): NamedTensorMap {\n const $indices =\n convertToTensor(indices, 'indices', 'sparseFillEmptyRows', 'int32');\n const $values = convertToTensor(values, 'values', 'sparseFillEmptyRows');\n const $denseShape =\n convertToTensor(denseShape, 'denseShape', 'sparseFillEmptyRows', 'int32');\n const $defaultValue = convertToTensor(\n defaultValue, 'defaultValue', 'sparseFillEmptyRows', $values.dtype);\n\n if ($indices.rank !== 2) {\n throw new Error(`Indices should be Tensor2D but received shape\n ${$indices.shape}`);\n }\n if ($values.rank !== 1) {\n throw new Error(\n `Values should be Tensor1D but received shape ${$values.shape}`);\n }\n if ($denseShape.rank !== 1) {\n throw new Error(`Dense shape should be Tensor1D but received shape ${\n $denseShape.shape}`);\n }\n if ($defaultValue.rank !== 0) {\n throw new Error(`Default value should be a scalar but received shape ${\n $defaultValue.shape}`);\n }\n\n const inputs: SparseFillEmptyRowsInputs = {\n indices: $indices,\n values: $values,\n denseShape: $denseShape,\n defaultValue: $defaultValue\n };\n\n const result: Tensor[] = ENGINE.runKernel(SparseFillEmptyRows, inputs as {});\n return {\n outputIndices: result[0],\n outputValues: result[1],\n emptyRowIndicator: result[2],\n reverseIndexMap: result[3]\n };\n}\n\nexport const sparseFillEmptyRows = op({sparseFillEmptyRows_});\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {SparseReshape, SparseReshapeInputs} from '../../kernel_names';\nimport {Tensor, Tensor1D, Tensor2D} from '../../tensor';\nimport {NamedTensorMap} from '../../tensor_types';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport {op} from '../operation';\n\n/**\n * This operation has the same semantics as reshape on the represented dense\n * tensor. The `inputIndices` are recomputed based on the requested `newShape`.\n * If one component of `newShape` is the special value -1, the size of that\n * dimension is computed so that the total dense size remains constant. At most\n * one component of `newShape` can be -1. The number of dense elements implied\n * by `newShape` must be the same as the number of dense elements originally\n * implied by `inputShape`. Reshaping does not affect the order of values in the\n * SparseTensor. If the input tensor has rank R_in and N non-empty values, and\n * `newShape` has length R_out, then `inputIndices` has shape [N, R_in],\n * `inputShape` has length R_in, `outputIndices` has shape [N, R_out], and\n * `outputShape` has length R_out.\n *\n * ```js\n * const result = tf.sparse.sparseReshape(\n * [[0, 0, 0], [0, 0, 1], [0, 1, 0], [1, 0, 0], [1, 2, 3]],\n * [2, 3, 6], [9, -1]);\n * console.log(result);\n * result['outputIndices'].print(); //[[0, 0], [0, 1], [1, 2], [4, 2], [8, 1]]\n * result['outputShape'].print(); // [9, 4]\n * ```\n * @param inputIndices: 2-D. N x R_in matrix with the indices of non-empty\n * values in a SparseTensor.\n * @param inputShape: 1-D. R_in Tensor1D with the input SparseTensor's dense\n * shape.\n * @param newShape: 1-D. R_out Tensor1D with the requested new dense shape.\n * @return A map with the following properties:\n * - outputIndices: 2-D. N x R_out matrix with the updated indices of\n * non-empty values in the output SparseTensor.\n * - outputShape: 1-D. R_out vector with the full dense shape of the output\n * SparseTensor. This is the same as newShape but with any -1 dimensions\n * filled in.\n * @doc {heading: 'Operations', subheading: 'Sparse'}\n */\nfunction sparseReshape_(\n inputIndices: Tensor2D|TensorLike, inputShape: Tensor1D|TensorLike,\n newShape: Tensor1D|TensorLike): NamedTensorMap {\n const $inputIndices =\n convertToTensor(inputIndices, 'inputIndices', 'sparseReshape', 'int32');\n const $inputShape =\n convertToTensor(inputShape, 'inputShape', 'sparseReshape', 'int32');\n const $newShape =\n convertToTensor(newShape, 'newShape', 'sparseReshape', 'int32');\n\n if ($inputIndices.rank !== 2) {\n throw new Error(`Input indices should be Tensor2D but received shape\n ${$inputIndices.shape}`);\n }\n if ($inputShape.rank !== 1) {\n throw new Error(`Input shape should be Tensor1D but received shape ${\n $inputShape.shape}`);\n }\n if ($newShape.rank !== 1) {\n throw new Error(\n `New shape should be Tensor1D but received shape ${$newShape.shape}`);\n }\n\n const inputs: SparseReshapeInputs = {\n inputIndices: $inputIndices,\n inputShape: $inputShape,\n newShape: $newShape\n };\n const result: Tensor[] = ENGINE.runKernel(SparseReshape, inputs as {});\n return {outputIndices: result[0], outputShape: result[1]};\n}\n\nexport const sparseReshape = op({sparseReshape_});\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {SparseSegmentMean, SparseSegmentMeanInputs} from '../../kernel_names';\nimport {Tensor, Tensor1D} from '../../tensor';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport {op} from '../operation';\n\n/**\n * Computes the mean along sparse segments of a tensor.\n *\n * ```js\n * const c = tf.tensor2d([[1,2,3,4], [-1,-2,-3,-4], [6,7,8,9]]);\n * // Select two rows, one segment.\n * const result1 = tf.sparse.sparseSegmentMean(c,\n * tf.tensor1d([0, 1], 'int32'),\n * tf.tensor1d([0, 0], 'int32'));\n * result1.print(); // [[0, 0, 0, 0]]\n *\n * // Select two rows, two segments.\n * const result2 = tf.sparse.sparseSegmentMean(c,\n * tf.tensor1d([0, 1], 'int32'),\n * tf.tensor1d([0, 1], 'int32'));\n * result2.print(); // [[1, 2, 3, 4], [-1, -2, -3, -4]]\n *\n * // Select all rows, two segments.\n * const result3 = tf.sparse.sparseSegmentMean(c,\n * tf.tensor1d([0, 1, 2], 'int32'),\n * tf.tensor1d([0, 1, 1], 'int32'));\n * result3.print(); // [[1.0, 2.0, 3.0, 4.0], [2.5, 2.5, 2.5, 2.5]]\n * ```\n * @param data: A Tensor of at least one dimension with data that will be\n * assembled in the output.\n * @param indices: A 1-D Tensor with indices into data. Has same rank as\n * segmentIds.\n * @param segmentIds: A 1-D Tensor with indices into the output Tensor. Values\n * should be sorted and can be repeated.\n * @return Has same shape as data, except for dimension 0 which has equal to\n * the number of segments.\n *\n * @doc {heading: 'Operations', subheading: 'Sparse'}\n */\nfunction sparseSegmentMean_(\n data: Tensor|TensorLike, indices: Tensor1D|TensorLike,\n segmentIds: Tensor1D|TensorLike): Tensor {\n const $data = convertToTensor(data, 'data', 'sparseSegmentMean');\n const $indices =\n convertToTensor(indices, 'indices', 'sparseSegmentMean', 'int32');\n const $segmentIds =\n convertToTensor(segmentIds, 'segmentIds', 'sparseSegmentMean', 'int32');\n\n if ($data.rank < 1) {\n throw new Error(\n `Data should be at least 1 dimensional but received scalar`);\n }\n if ($indices.rank !== 1) {\n throw new Error(`Indices should be Tensor1D but received shape\n ${$indices.shape}`);\n }\n if ($segmentIds.rank !== 1) {\n throw new Error(`Segment ids should be Tensor1D but received shape\n ${$segmentIds.shape}`);\n }\n\n const inputs: SparseSegmentMeanInputs = {\n data: $data,\n indices: $indices,\n segmentIds: $segmentIds\n };\n\n return ENGINE.runKernel(SparseSegmentMean, inputs as {});\n}\n\nexport const sparseSegmentMean = op({sparseSegmentMean_});\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {SparseSegmentSum, SparseSegmentSumInputs} from '../../kernel_names';\nimport {Tensor, Tensor1D} from '../../tensor';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport {op} from '../operation';\n\n/**\n * Computes the sum along sparse segments of a tensor.\n *\n * ```js\n * const c = tf.tensor2d([[1,2,3,4], [-1,-2,-3,-4], [5,6,7,8]]);\n * // Select two rows, one segment.\n * const result1 = tf.sparse.sparseSegmentSum(c,\n * tf.tensor1d([0, 1], 'int32'),\n * tf.tensor1d([0, 0], 'int32'));\n * result1.print(); // [[0, 0, 0, 0]]\n *\n * // Select two rows, two segments.\n * const result2 = tf.sparse.sparseSegmentSum(c,\n * tf.tensor1d([0, 1], 'int32'),\n * tf.tensor1d([0, 1], 'int32'));\n * result2.print(); // [[1, 2, 3, 4], [-1, -2, -3, -4]]\n *\n * // Select all rows, two segments.\n * const result3 = tf.sparse.sparseSegmentSum(c,\n * tf.tensor1d([0, 1, 2], 'int32'),\n * tf.tensor1d([0, 0, 1], 'int32'));\n * result3.print(); // [[0, 0, 0, 0], [5, 6, 7, 8]]\n * ```\n * @param data: A Tensor of at least one dimension with data that will be\n * assembled in the output.\n * @param indices: A 1-D Tensor with indices into data. Has same rank as\n * segmentIds.\n * @param segmentIds: A 1-D Tensor with indices into the output Tensor. Values\n * should be sorted and can be repeated.\n * @return Has same shape as data, except for dimension 0 which has equal to\n * the number of segments.\n *\n * @doc {heading: 'Operations', subheading: 'Sparse'}\n */\nfunction sparseSegmentSum_(\n data: Tensor|TensorLike, indices: Tensor1D|TensorLike,\n segmentIds: Tensor1D|TensorLike): Tensor {\n const $data = convertToTensor(data, 'data', 'sparseSegmentSum');\n const $indices =\n convertToTensor(indices, 'indices', 'sparseSegmentSum', 'int32');\n const $segmentIds =\n convertToTensor(segmentIds, 'segmentIds', 'sparseSegmentSum', 'int32');\n\n if ($data.rank < 1) {\n throw new Error(\n `Data should be at least 1 dimensional but received scalar`);\n }\n if ($indices.rank !== 1) {\n throw new Error(`Indices should be Tensor1D but received shape\n ${$indices.shape}`);\n }\n if ($segmentIds.rank !== 1) {\n throw new Error(`Segment ids should be Tensor1D but received shape\n ${$segmentIds.shape}`);\n }\n\n const inputs: SparseSegmentSumInputs = {\n data: $data,\n indices: $indices,\n segmentIds: $segmentIds\n };\n\n return ENGINE.runKernel(SparseSegmentSum, inputs as {});\n}\n\nexport const sparseSegmentSum = op({sparseSegmentSum_});\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {StringNGrams, StringNGramsAttrs, StringNGramsInputs} from '../../kernel_names';\nimport {Tensor, Tensor1D} from '../../tensor';\nimport {NamedTensorMap} from '../../tensor_types';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport {op} from '../operation';\n\n/**\n * Creates ngrams from ragged string data.\n *\n * This op accepts a ragged tensor with 1 ragged dimension containing only\n * strings and outputs a ragged tensor with 1 ragged dimension containing ngrams\n * of that string, joined along the innermost axis.\n *\n * ```js\n * const result = tf.string.stringNGrams(\n * ['a', 'b', 'c', 'd'], tf.tensor1d([0, 2, 4], 'int32'),\n * '|', [1, 2], 'LP', 'RP', -1, false);\n * result['nGrams'].print(); // ['a', 'b', 'LP|a', 'a|b', 'b|RP',\n * // 'c', 'd', 'LP|c', 'c|d', 'd|RP']\n * result['nGramsSplits'].print(); // [0, 5, 10]\n * ```\n * @param data: The values tensor of the ragged string tensor to make ngrams out\n * of. Must be a 1D string tensor.\n * @param dataSplits: The splits tensor of the ragged string tensor to make\n * ngrams out of.\n * @param separator: The string to append between elements of the token. Use \"\"\n * for no separator.\n * @param nGramWidths: The sizes of the ngrams to create.\n * @param leftPad: The string to use to pad the left side of the ngram sequence.\n * Only used if pad_width !== 0.\n * @param rightPad: The string to use to pad the right side of the ngram\n * sequence. Only used if pad_width !== 0.\n * @param padWidth: The number of padding elements to add to each side of each\n * sequence. Note that padding will never be greater than `nGramWidths`-1\n * regardless of this value. If `padWidth`=-1, then add max(`nGramWidths`)-1\n * elements.\n * @param preserveShortSequences: If true, then ensure that at least one ngram\n * is generated for each input sequence. In particular, if an input sequence\n * is shorter than min(ngramWidth) + 2*padWidth, then generate a single\n * ngram containing the entire sequence. If false, then no ngrams are\n * generated for these short input sequences.\n * @return A map with the following properties:\n * - nGrams: The values tensor of the output ngrams ragged tensor.\n * - nGramsSplits: The splits tensor of the output ngrams ragged tensor.\n *\n * @doc {heading: 'Operations', subheading: 'String'}\n */\nfunction stringNGrams_(\n data: Tensor1D|TensorLike, dataSplits: Tensor|TensorLike, separator: string,\n nGramWidths: number[], leftPad: string, rightPad: string, padWidth: number,\n preserveShortSequences: boolean): NamedTensorMap {\n const $data = convertToTensor(data, 'data', 'stringNGrams', 'string');\n if ($data.dtype !== 'string') {\n throw new Error('Data must be of datatype string');\n }\n if ($data.shape.length !== 1) {\n throw new Error(`Data must be a vector, saw: ${$data.shape}`);\n }\n\n const $dataSplits = convertToTensor(dataSplits, 'dataSplits', 'stringNGrams');\n if ($dataSplits.dtype !== 'int32') {\n throw new Error('Data splits must be of datatype int32');\n }\n\n const attrs: StringNGramsAttrs = {\n separator,\n nGramWidths,\n leftPad,\n rightPad,\n padWidth,\n preserveShortSequences\n };\n\n const inputs: StringNGramsInputs = {data: $data, dataSplits: $dataSplits};\n const result: Tensor[] =\n ENGINE.runKernel(StringNGrams, inputs as {}, attrs as {});\n return {nGrams: result[0], nGramsSplits: result[1]};\n}\n\nexport const stringNGrams = op({stringNGrams_});\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {StringSplit, StringSplitAttrs, StringSplitInputs} from '../../kernel_names';\nimport {Scalar, Tensor, Tensor1D} from '../../tensor';\nimport {NamedTensorMap} from '../../tensor_types';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {ScalarLike, TensorLike} from '../../types';\nimport {op} from '../operation';\n\n/**\n * Split elements of `input` based on `delimiter` into a SparseTensor .\n *\n * Let N be the size of source (typically N will be the batch size). Split each\n * element of `input` based on `delimiter` and return a SparseTensor containing\n * the splitted tokens. Empty tokens are ignored if `skipEmpty` is set to True.\n *\n * `delimiter` can be empty, or a string of split characters. If `delimiter` is\n * an empty string, each element of `input` is split into individual\n * character strings. Otherwise every character of `delimiter` is a potential\n * split point.\n *\n * ```js\n * const result = tf.string.stringSplit(['hello world', 'a b c'], ' ');\n * result['indices'].print(); // [[0, 0], [0, 1], [1, 0], [1, 1], [1, 2]]\n * result['values'].print(); // ['hello', 'world', 'a', 'b', 'c']\n * result['shape'].print(); // [2, 3]\n * ```\n * @param input: 1-D. Strings to split.\n * @param delimiter: 0-D. Delimiter characters, or empty string.\n * @param skipEmpty: Optional. If true, skip the empty strings from the result.\n * Defaults to true.\n * @return A map with the following properties:\n * - indices: A dense matrix of int32 representing the indices of the sparse\n * tensor.\n * - values: A vector of strings corresponding to the splited values.\n * - shape: a length-2 vector of int32 representing the shape of the sparse\n * tensor, where the first value is N and the second value is the maximum number\n * of tokens in a single input entry.\n *\n * @doc {heading: 'Operations', subheading: 'String'}\n */\nfunction stringSplit_(\n input: Tensor1D|TensorLike, delimiter: Scalar|ScalarLike,\n skipEmpty = true): NamedTensorMap {\n const $input = convertToTensor(input, 'input', 'stringSplit', 'string');\n const $delimiter =\n convertToTensor(delimiter, 'delimiter', 'stringSplit', 'string');\n\n if ($input.rank !== 1) {\n throw new Error(\n `Input should be Tensor1D but received shape ${$input.shape}`);\n }\n if ($delimiter.rank !== 0) {\n throw new Error(\n `Delimiter should be a scalar but received shape ${$delimiter.shape}`);\n }\n\n const attrs: StringSplitAttrs = {skipEmpty};\n const inputs: StringSplitInputs = {input: $input, delimiter: $delimiter};\n const result: Tensor[] =\n ENGINE.runKernel(StringSplit, inputs as {}, attrs as {});\n return {indices: result[0], values: result[1], shape: result[2]};\n}\n\nexport const stringSplit = op({stringSplit_});\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../../engine';\nimport {StringToHashBucketFast, StringToHashBucketFastAttrs, StringToHashBucketFastInputs} from '../../kernel_names';\nimport {Tensor} from '../../tensor';\nimport {convertToTensor} from '../../tensor_util_env';\nimport {TensorLike} from '../../types';\nimport {op} from '../operation';\n\n/**\n * Converts each string in the input Tensor to its hash mod by a number of\n * buckets.\n *\n * The hash function is deterministic on the content of the string within the\n * process and will never change. However, it is not suitable for cryptography.\n * This function may be used when CPU time is scarce and inputs are trusted or\n * unimportant. There is a risk of adversaries constructing inputs that all hash\n * to the same bucket.\n *\n * ```js\n * const result = tf.string.stringToHashBucketFast(\n * ['Hello', 'TensorFlow', '2.x'], 3);\n * result.print(); // [0, 2, 2]\n * ```\n * @param input: The strings to assign a hash bucket.\n * @param numBuckets: The number of buckets.\n * @return A Tensor of the same shape as the input tensor.\n *\n * @doc {heading: 'Operations', subheading: 'String'}\n */\nfunction stringToHashBucketFast_(\n input: Tensor|TensorLike, numBuckets: number): Tensor {\n const $input =\n convertToTensor(input, 'input', 'stringToHashBucketFast', 'string');\n const attrs: StringToHashBucketFastAttrs = {numBuckets};\n\n if (numBuckets <= 0) {\n throw new Error(`Number of buckets must be at least 1`);\n }\n\n const inputs: StringToHashBucketFastInputs = {input: $input};\n return ENGINE.runKernel(StringToHashBucketFast, inputs as {}, attrs as {});\n}\n\nexport const stringToHashBucketFast = op({stringToHashBucketFast_});\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// Modularized ops.\nexport {abs} from './abs';\nexport {acos} from './acos';\nexport {acosh} from './acosh';\nexport {add} from './add';\nexport {addN} from './add_n';\nexport {all} from './all';\nexport {any} from './any';\nexport {argMax} from './arg_max';\nexport {argMin} from './arg_min';\nexport {asin} from './asin';\nexport {asinh} from './asinh';\nexport {atan} from './atan';\nexport {atan2} from './atan2';\nexport {atanh} from './atanh';\nexport {avgPool} from './avg_pool';\nexport {avgPool3d} from './avg_pool_3d';\nexport {basicLSTMCell} from './basic_lstm_cell';\nexport {batchToSpaceND} from './batch_to_space_nd';\nexport {batchNorm} from './batchnorm';\nexport {batchNorm2d} from './batchnorm2d';\nexport {batchNorm3d} from './batchnorm3d';\nexport {batchNorm4d} from './batchnorm4d';\nexport {bincount} from './bincount';\nexport {broadcastArgs} from './broadcast_args';\nexport {broadcastTo} from './broadcast_to';\nexport {buffer} from './buffer';\nexport {cast} from './cast';\nexport {ceil} from './ceil';\nexport {clipByValue} from './clip_by_value';\nexport {clone} from './clone';\nexport {complex} from './complex';\nexport {concat} from './concat';\nexport {concat1d} from './concat_1d';\nexport {concat2d} from './concat_2d';\nexport {concat3d} from './concat_3d';\nexport {concat4d} from './concat_4d';\nexport {conv1d} from './conv1d';\nexport {conv2d} from './conv2d';\nexport {conv2dTranspose} from './conv2d_transpose';\nexport {conv3d} from './conv3d';\nexport {conv3dTranspose} from './conv3d_transpose';\nexport {cos} from './cos';\nexport {cosh} from './cosh';\nexport {cumprod} from './cumprod';\nexport {cumsum} from './cumsum';\nexport {denseBincount} from './dense_bincount';\nexport {depthToSpace} from './depth_to_space';\nexport {depthwiseConv2d} from './depthwise_conv2d';\nexport {diag} from './diag';\nexport {dilation2d} from './dilation2d';\nexport {div} from './div';\nexport {divNoNan} from './div_no_nan';\nexport {dot} from './dot';\nexport {einsum} from './einsum';\nexport {elu} from './elu';\nexport {equal} from './equal';\nexport {erf} from './erf';\nexport {euclideanNorm} from './euclidean_norm';\nexport {exp} from './exp';\nexport {expandDims} from './expand_dims';\nexport {expm1} from './expm1';\nexport {eye} from './eye';\nexport {fill} from './fill';\nexport {floor} from './floor';\nexport {floorDiv} from './floorDiv';\nexport {gather} from './gather';\nexport {greater} from './greater';\nexport {greaterEqual} from './greater_equal';\nexport {imag} from './imag';\nexport {isFinite} from './is_finite';\nexport {isInf} from './is_inf';\nexport {isNaN} from './is_nan';\nexport {leakyRelu} from './leaky_relu';\nexport {less} from './less';\nexport {lessEqual} from './less_equal';\nexport {linspace} from './linspace';\nexport {localResponseNormalization} from './local_response_normalization';\nexport {log} from './log';\nexport {log1p} from './log1p';\nexport {logSigmoid} from './log_sigmoid';\nexport {logSoftmax} from './log_softmax';\nexport {logSumExp} from './log_sum_exp';\nexport {logicalAnd} from './logical_and';\nexport {logicalNot} from './logical_not';\nexport {logicalOr} from './logical_or';\nexport {logicalXor} from './logical_xor';\nexport {lowerBound} from './lower_bound';\nexport {matMul} from './mat_mul';\nexport {max} from './max';\nexport {maxPool} from './max_pool';\nexport {maxPool3d} from './max_pool_3d';\nexport {maxPoolWithArgmax} from './max_pool_with_argmax';\nexport {maximum} from './maximum';\nexport {mean} from './mean';\nexport {meshgrid} from './meshgrid';\nexport {min} from './min';\nexport {minimum} from './minimum';\nexport {mirrorPad} from './mirror_pad';\nexport {mod} from './mod';\nexport {moments} from './moments';\nexport {mul} from './mul';\nexport {LSTMCellFunc, multiRNNCell} from './multi_rnn_cell';\nexport {multinomial} from './multinomial';\nexport {neg} from './neg';\nexport {notEqual} from './not_equal';\nexport {oneHot} from './one_hot';\nexport {ones} from './ones';\nexport {onesLike} from './ones_like';\nexport {outerProduct} from './outer_product';\nexport {pad} from './pad';\nexport {pad1d} from './pad1d';\nexport {pad2d} from './pad2d';\nexport {pad3d} from './pad3d';\nexport {pad4d} from './pad4d';\nexport {pool} from './pool';\nexport {pow} from './pow';\nexport {prelu} from './prelu';\nexport {print} from './print';\nexport {prod} from './prod';\nexport {raggedGather} from './ragged_gather';\nexport {raggedRange} from './ragged_range';\nexport {raggedTensorToTensor} from './ragged_tensor_to_tensor';\nexport {rand} from './rand';\nexport {randomGamma} from './random_gamma';\nexport {randomNormal} from './random_normal';\nexport {randomStandardNormal} from './random_standard_normal';\nexport {randomUniform} from './random_uniform';\nexport {range} from './range';\nexport {real} from './real';\nexport {reciprocal} from './reciprocal';\nexport {relu} from './relu';\nexport {relu6} from './relu6';\nexport {reshape} from './reshape';\nexport {reverse} from './reverse';\nexport {reverse1d} from './reverse_1d';\nexport {reverse2d} from './reverse_2d';\nexport {reverse3d} from './reverse_3d';\nexport {reverse4d} from './reverse_4d';\nexport {round} from './round';\nexport {rsqrt} from './rsqrt';\nexport {scalar} from './scalar';\nexport {selu} from './selu';\nexport {separableConv2d} from './separable_conv2d';\nexport {setdiff1dAsync} from './setdiff1d_async';\nexport {sigmoid} from './sigmoid';\nexport {sign} from './sign';\nexport {sin} from './sin';\nexport {sinh} from './sinh';\nexport {slice} from './slice';\nexport {slice1d} from './slice1d';\nexport {slice2d} from './slice2d';\nexport {slice3d} from './slice3d';\nexport {slice4d} from './slice4d';\nexport {softmax} from './softmax';\nexport {softplus} from './softplus';\nexport {spaceToBatchND} from './space_to_batch_nd';\nexport {fft} from './spectral/fft';\nexport {ifft} from './spectral/ifft';\nexport {irfft} from './spectral/irfft';\nexport {rfft} from './spectral/rfft';\nexport {split} from './split';\nexport {sqrt} from './sqrt';\nexport {square} from './square';\nexport {squaredDifference} from './squared_difference';\nexport {squeeze} from './squeeze';\nexport {stack} from './stack';\nexport {step} from './step';\nexport {stridedSlice} from './strided_slice';\nexport {sub} from './sub';\nexport {sum} from './sum';\nexport {tan} from './tan';\nexport {tanh} from './tanh';\nexport {tensor} from './tensor';\nexport {tensor1d} from './tensor1d';\nexport {tensor2d} from './tensor2d';\nexport {tensor3d} from './tensor3d';\nexport {tensor4d} from './tensor4d';\nexport {tensor5d} from './tensor5d';\nexport {tensor6d} from './tensor6d';\nexport {tile} from './tile';\nexport {topk} from './topk';\nexport {truncatedNormal} from './truncated_normal';\nexport {unique} from './unique';\nexport {unsortedSegmentSum} from './unsorted_segment_sum';\nexport {unstack} from './unstack';\nexport {upperBound} from './upper_bound';\nexport {variable} from './variable';\nexport {where} from './where';\nexport {whereAsync} from './where_async';\nexport {zeros} from './zeros';\nexport {zerosLike} from './zeros_like';\n\nexport * from './boolean_mask';\nexport * from './transpose';\nexport * from './norm';\nexport * from './moving_average';\nexport * from './scatter_nd';\nexport * from './search_sorted';\nexport * from './sparse_to_dense';\nexport * from './gather_nd';\nexport * from './dropout';\nexport * from './signal_ops_util';\nexport * from './in_top_k';\n\nexport {op, OP_SCOPE_SUFFIX} from './operation';\n\nimport {rfft} from './spectral/rfft';\nimport {fft} from './spectral/fft';\nimport {ifft} from './spectral/ifft';\nimport {irfft} from './spectral/irfft';\nconst spectral = {\n fft,\n ifft,\n rfft,\n irfft\n};\n\nimport * as fused from './fused_ops';\n\nimport {hammingWindow} from './signal/hamming_window';\nimport {hannWindow} from './signal/hann_window';\nimport {frame} from './signal/frame';\nimport {stft} from './signal/stft';\nconst signal = {\n hammingWindow,\n hannWindow,\n frame,\n stft,\n};\n\n// Image Ops namespace\nimport {cropAndResize} from './image/crop_and_resize';\nimport {flipLeftRight} from './image/flip_left_right';\nimport {grayscaleToRGB} from './image/grayscale_to_rgb';\nimport {rotateWithOffset} from './image/rotate_with_offset';\nimport {nonMaxSuppression} from './image/non_max_suppression';\nimport {nonMaxSuppressionAsync} from './image/non_max_suppression_async';\nimport {nonMaxSuppressionWithScore} from './image/non_max_suppression_with_score';\nimport {nonMaxSuppressionWithScoreAsync} from './image/non_max_suppression_with_score_async';\nimport {nonMaxSuppressionPadded} from './image/non_max_suppression_padded';\nimport {nonMaxSuppressionPaddedAsync} from './image/non_max_suppression_padded_async';\nimport {resizeBilinear} from './image/resize_bilinear';\nimport {resizeNearestNeighbor} from './image/resize_nearest_neighbor';\nimport {threshold} from './image/threshold';\nimport {transform} from './image/transform';\nconst image = {\n flipLeftRight,\n grayscaleToRGB,\n resizeNearestNeighbor,\n resizeBilinear,\n rotateWithOffset,\n cropAndResize,\n nonMaxSuppression,\n nonMaxSuppressionAsync,\n nonMaxSuppressionWithScore,\n nonMaxSuppressionWithScoreAsync,\n nonMaxSuppressionPadded,\n nonMaxSuppressionPaddedAsync,\n threshold,\n transform\n};\n\n// linalg namespace\nimport {bandPart} from './linalg/band_part';\nimport {gramSchmidt} from './linalg/gram_schmidt';\nimport {qr} from './linalg/qr';\nconst linalg = {\n bandPart,\n gramSchmidt,\n qr\n};\n\n// losses namespace;\nimport {absoluteDifference} from './losses/absolute_difference';\nimport {computeWeightedLoss} from './losses/compute_weighted_loss';\nimport {cosineDistance} from './losses/cosine_distance';\nimport {hingeLoss} from './losses/hinge_loss';\nimport {huberLoss} from './losses/huber_loss';\nimport {logLoss} from './losses/log_loss';\nimport {meanSquaredError} from './losses/mean_squared_error';\nimport {sigmoidCrossEntropy} from './losses/sigmoid_cross_entropy';\nimport {softmaxCrossEntropy} from './losses/softmax_cross_entropy';\nconst losses = {\n absoluteDifference,\n computeWeightedLoss,\n cosineDistance,\n hingeLoss,\n huberLoss,\n logLoss,\n meanSquaredError,\n sigmoidCrossEntropy,\n softmaxCrossEntropy\n};\n\nimport {sparseFillEmptyRows} from './sparse/sparse_fill_empty_rows';\nimport {sparseReshape} from './sparse/sparse_reshape';\nimport {sparseSegmentMean} from './sparse/sparse_segment_mean';\nimport {sparseSegmentSum} from './sparse/sparse_segment_sum';\nconst sparse = {\n sparseFillEmptyRows,\n sparseReshape,\n sparseSegmentMean,\n sparseSegmentSum\n};\n\nimport {stringNGrams} from './string/string_n_grams';\nimport {stringSplit} from './string/string_split';\nimport {stringToHashBucketFast} from './string/string_to_hash_bucket_fast';\n// tslint:disable-next-line:variable-name\nconst string = {\n stringNGrams,\n stringSplit,\n stringToHashBucketFast\n};\n\n// Second level exports.\nexport {image, linalg, losses, spectral, fused, signal, sparse, string};\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {dispose} from '../globals';\nimport {variableGrads} from '../gradients';\nimport {scalar} from '../ops/ops';\nimport {Serializable} from '../serialization';\nimport {Scalar, Variable} from '../tensor';\nimport {NamedTensor, NamedTensorMap} from '../tensor_types';\n\n/**\n * A variable that belongs to an optimizer.\n *\n * The `originalName` field is required for keeping track of the canonical\n * name of the variable, which is usually the name of the model weight that\n * the variable is related to plus a suffix, e.g., 'dense1/kernel/momentum'.\n * The name of the `Variable` object itself cannot be used directly due to\n * possible deduplication: Every `Variable` must have a unique name but more\n * than one optimizer objects of the same type may be created for the same model\n * or the same `Variable`.\n */\nexport interface OptimizerVariable {\n originalName: string;\n variable: Variable;\n}\n\n/** @doc {heading: 'Training', subheading: 'Classes', namespace: 'train'} */\nexport abstract class Optimizer extends Serializable {\n protected iterations_: number;\n\n /**\n * Executes `f()` and minimizes the scalar output of `f()` by computing\n * gradients of y with respect to the list of trainable variables provided by\n * `varList`. If no list is provided, it defaults to all trainable variables.\n *\n * @param f The function to execute and whose output to minimize.\n * @param returnCost Whether to return the scalar cost value produced by\n * executing `f()`.\n * @param varList An optional list of variables to update. If specified, only\n * the trainable variables in varList will be updated by minimize. Defaults to\n * all trainable variables.\n *\n * @doc {heading: 'Training', subheading: 'Optimizers'}\n */\n minimize(f: () => Scalar, returnCost = false, varList?: Variable[]): Scalar\n |null {\n const {value, grads} = this.computeGradients(f, varList);\n\n if (varList != null) {\n const gradArray: NamedTensor[] =\n varList.map(v => ({name: v.name, tensor: grads[v.name]}));\n this.applyGradients(gradArray);\n } else {\n this.applyGradients(grads);\n }\n\n // Dispose gradients.\n dispose(grads);\n\n if (returnCost) {\n return value;\n } else {\n value.dispose();\n return null;\n }\n }\n\n /**\n * The number of iterations that this optimizer instance has been invoked for.\n */\n get iterations(): number {\n if (this.iterations_ == null) {\n this.iterations_ = 0;\n }\n return this.iterations_;\n }\n\n protected incrementIterations() {\n this.iterations_ = this.iterations + 1;\n }\n\n /**\n * Executes f() and computes the gradient of the scalar output of f() with\n * respect to the list of trainable variables provided by `varList`. If no\n * list is provided, it defaults to all trainable variables.\n *\n * @param f The function to execute and whose output to use for computing\n * gradients with respect to variables.\n * @param varList An optional list of variables to compute gradients with\n * respect to. If specified, only the trainable variables in varList will have\n * gradients computed with respect to. Defaults to all trainable variables.\n *\n * @doc {heading: 'Training', subheading: 'Optimizers'}\n */\n computeGradients(f: () => Scalar, varList?: Variable[]):\n {value: Scalar, grads: NamedTensorMap} {\n return variableGrads(f, varList);\n }\n\n /**\n * Updates variables by using the computed gradients.\n *\n * @param variableGradients A mapping of variable name to its gradient value.\n *\n * @doc {heading: 'Training', subheading: 'Optimizers'}\n */\n abstract applyGradients(variableGradients: NamedTensorMap|\n NamedTensor[]): void;\n\n /**\n * Dispose the variables (if any) owned by this optimizer instance.\n */\n dispose(): void {\n if (this.iterations_ != null) {\n dispose(this.iterations_);\n }\n }\n\n async saveIterations(): Promise {\n if (this.iterations_ == null) {\n this.iterations_ = 0;\n }\n return {\n name: 'iter', // Named for Python compatibility.\n // TODO(cais): Use 'int64' type when available.\n tensor: scalar(this.iterations_, 'int32')\n };\n }\n\n async getWeights(): Promise {\n throw new Error('getWeights() is not implemented for this optimizer yet.');\n }\n\n async setWeights(weightValues: NamedTensor[]): Promise {\n throw new Error(\n `setWeights() is not implemented for this optimizer class ` +\n `${this.getClassName()}`);\n }\n\n /**\n * Extract the first element of the weight values and set it\n * as the iterations counter variable of this instance of optimizer.\n *\n * @param weightValues\n * @returns Weight values with the first element consumed and excluded.\n */\n protected async extractIterations(weightValues: NamedTensor[]):\n Promise {\n this.iterations_ = (await weightValues[0].tensor.data())[0];\n return weightValues.slice(1);\n }\n}\n\nObject.defineProperty(Optimizer, Symbol.hasInstance, {\n value: (instance: Optimizer) => {\n return instance.minimize != null && instance.computeGradients != null &&\n instance.applyGradients != null;\n }\n});\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {dispose, tidy} from '../globals';\nimport {add} from '../ops/add';\nimport {div} from '../ops/div';\nimport {mul} from '../ops/mul';\nimport {sqrt} from '../ops/ops';\nimport {square} from '../ops/square';\nimport {zerosLike} from '../ops/zeros_like';\nimport {ConfigDict, registerClass, Serializable, SerializableConstructor} from '../serialization';\nimport {NamedTensor, NamedVariableMap} from '../tensor_types';\n\nimport {Optimizer, OptimizerVariable} from './optimizer';\n\n/** @doclink Optimizer */\nexport class AdadeltaOptimizer extends Optimizer {\n /** @nocollapse */\n static className = 'Adadelta'; // Name matters for Python compatibility.\n private accumulatedGrads: OptimizerVariable[] = [];\n private accumulatedUpdates: OptimizerVariable[] = [];\n\n constructor(\n protected learningRate: number, protected rho: number,\n protected epsilon: number = null) {\n super();\n\n if (epsilon == null) {\n this.epsilon = ENGINE.backend.epsilon();\n }\n }\n\n applyGradients(variableGradients: NamedVariableMap|NamedTensor[]) {\n const variableNames = Array.isArray(variableGradients) ?\n variableGradients.map(item => item.name) :\n Object.keys(variableGradients);\n\n variableNames.forEach((name, i) => {\n const value = ENGINE.registeredVariables[name];\n const trainable = false;\n if (this.accumulatedGrads[i] == null) {\n this.accumulatedGrads[i] = {\n originalName: `${name}/accum_grad`,\n variable: tidy(() => zerosLike(value).variable(trainable))\n };\n }\n if (this.accumulatedUpdates[i] == null) {\n this.accumulatedUpdates[i] = {\n originalName: `${name}/accum_var`,\n variable: tidy(() => zerosLike(value).variable(trainable))\n };\n }\n\n const gradient = Array.isArray(variableGradients) ?\n variableGradients[i].tensor :\n variableGradients[name];\n if (gradient == null) {\n return;\n }\n\n const accumulatedGrad = this.accumulatedGrads[i].variable;\n const accumulatedUpdate = this.accumulatedUpdates[i].variable;\n\n tidy(() => {\n const newAccumulatedGrad =\n add(mul(accumulatedGrad, this.rho),\n mul(square(gradient), 1 - this.rho));\n\n const updates =\n mul(div(sqrt(add(accumulatedUpdate, this.epsilon)),\n sqrt(add(accumulatedGrad, this.epsilon))),\n gradient);\n\n const newAccumulatedUpdate =\n add(mul(accumulatedUpdate, this.rho),\n mul(square(updates), 1 - this.rho));\n\n accumulatedGrad.assign(newAccumulatedGrad);\n accumulatedUpdate.assign(newAccumulatedUpdate);\n\n const newValue = add(mul(updates, -this.learningRate), value);\n value.assign(newValue);\n });\n });\n this.incrementIterations();\n }\n\n dispose(): void {\n if (this.accumulatedUpdates != null) {\n dispose(this.accumulatedGrads.map(v => v.variable));\n dispose(this.accumulatedUpdates.map(v => v.variable));\n }\n }\n\n async getWeights(): Promise {\n // Order matters for Python compatibility.\n const variables: OptimizerVariable[] =\n [...this.accumulatedGrads, ...this.accumulatedUpdates];\n return [await this.saveIterations()].concat(\n variables.map(v => ({name: v.originalName, tensor: v.variable})));\n }\n\n async setWeights(weightValues: NamedTensor[]): Promise {\n weightValues = await this.extractIterations(weightValues);\n const variableCount = weightValues.length / 2;\n const trainable = false;\n this.accumulatedGrads =\n weightValues.slice(0, variableCount).map(v => ({\n originalName: v.name,\n variable: v.tensor.variable(\n trainable)\n }));\n this.accumulatedUpdates =\n weightValues.slice(variableCount, variableCount * 2)\n .map(v => ({\n originalName: v.name,\n variable: v.tensor.variable(trainable)\n }));\n }\n\n getConfig(): ConfigDict {\n return {\n 'learningRate': this.learningRate,\n 'rho': this.rho,\n 'epsilon': this.epsilon\n };\n }\n\n /** @nocollapse */\n static fromConfig(\n cls: SerializableConstructor, config: ConfigDict): T {\n return new cls(config['learningRate'], config['rho'], config['epsilon']);\n }\n}\nregisterClass(AdadeltaOptimizer);\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {dispose, tidy} from '../globals';\nimport {add} from '../ops/add';\nimport {div} from '../ops/div';\nimport {fill} from '../ops/fill';\nimport {mul} from '../ops/mul';\nimport {sqrt} from '../ops/sqrt';\nimport {square} from '../ops/square';\nimport {ConfigDict, registerClass, Serializable, SerializableConstructor} from '../serialization';\nimport {NamedTensor, NamedVariableMap} from '../tensor_types';\n\nimport {Optimizer, OptimizerVariable} from './optimizer';\n\n/** @doclink Optimizer */\nexport class AdagradOptimizer extends Optimizer {\n /** @nocollapse */\n static className = 'Adagrad'; // Note: Name matters for Python compatibility.\n\n private accumulatedGrads: OptimizerVariable[] = [];\n\n constructor(\n protected learningRate: number, private initialAccumulatorValue = 0.1) {\n super();\n }\n\n applyGradients(variableGradients: NamedVariableMap|NamedTensor[]) {\n const variableNames = Array.isArray(variableGradients) ?\n variableGradients.map(item => item.name) :\n Object.keys(variableGradients);\n\n variableNames.forEach((name, i) => {\n const value = ENGINE.registeredVariables[name];\n if (this.accumulatedGrads[i] == null) {\n const trainable = false;\n this.accumulatedGrads[i] = {\n originalName: `${name}/accumulator`,\n variable: tidy(\n () => fill(value.shape, this.initialAccumulatorValue)\n .variable(trainable))\n };\n }\n\n const gradient = Array.isArray(variableGradients) ?\n variableGradients[i].tensor :\n variableGradients[name];\n if (gradient == null) {\n return;\n }\n\n const accumulatedGrad = this.accumulatedGrads[i].variable;\n\n tidy(() => {\n const newAccumulatedGrad = add(accumulatedGrad, square(gradient));\n accumulatedGrad.assign(newAccumulatedGrad);\n\n const newValue = add(\n mul(div(gradient,\n sqrt(add(newAccumulatedGrad, ENGINE.backend.epsilon()))),\n -this.learningRate),\n value);\n value.assign(newValue);\n });\n });\n this.incrementIterations();\n }\n\n dispose(): void {\n if (this.accumulatedGrads != null) {\n dispose(this.accumulatedGrads.map(v => v.variable));\n }\n }\n\n async getWeights(): Promise {\n // Order matters for Python compatibility.\n return [await this.saveIterations()].concat(this.accumulatedGrads.map(\n v => ({name: v.originalName, tensor: v.variable})));\n }\n\n async setWeights(weightValues: NamedTensor[]): Promise {\n weightValues = await this.extractIterations(weightValues);\n const trainable = false;\n this.accumulatedGrads = weightValues.map(\n v => ({originalName: v.name, variable: v.tensor.variable(trainable)}));\n }\n\n getConfig(): ConfigDict {\n return {\n 'learningRate': this.learningRate,\n 'initialAccumulatorValue': this.initialAccumulatorValue,\n };\n }\n\n /** @nocollapse */\n static fromConfig(\n cls: SerializableConstructor, config: ConfigDict): T {\n return new cls(config['learningRate'], config['initialAccumulatorValue']);\n }\n}\nregisterClass(AdagradOptimizer);\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {dispose, tidy} from '../globals';\nimport {add} from '../ops/add';\nimport {div} from '../ops/div';\nimport {mul} from '../ops/mul';\nimport {pow} from '../ops/pow';\nimport {scalar} from '../ops/scalar';\nimport {sqrt} from '../ops/sqrt';\nimport {square} from '../ops/square';\nimport {sub} from '../ops/sub';\nimport {zerosLike} from '../ops/zeros_like';\nimport {ConfigDict, registerClass, Serializable, SerializableConstructor} from '../serialization';\nimport {Variable} from '../tensor';\nimport {NamedTensor, NamedVariableMap} from '../tensor_types';\n\nimport {Optimizer, OptimizerVariable} from './optimizer';\n\nexport class AdamOptimizer extends Optimizer {\n /** @nocollapse */\n static className = 'Adam'; // Note: Name matters for Python compatibility.\n private accBeta1: Variable;\n private accBeta2: Variable;\n\n private accumulatedFirstMoment: OptimizerVariable[] = [];\n private accumulatedSecondMoment: OptimizerVariable[] = [];\n\n constructor(\n protected learningRate: number, protected beta1: number,\n protected beta2: number, protected epsilon: number = null) {\n super();\n tidy(() => {\n // accB* will be updated by batch.\n this.accBeta1 = scalar(beta1).variable();\n this.accBeta2 = scalar(beta2).variable();\n });\n\n if (epsilon == null) {\n this.epsilon = ENGINE.backend.epsilon();\n }\n }\n\n applyGradients(variableGradients: NamedVariableMap|NamedTensor[]) {\n const varNames = Array.isArray(variableGradients) ?\n variableGradients.map(v => v.name) :\n Object.keys(variableGradients);\n tidy(() => {\n const oneMinusAccBeta1 = sub(1, this.accBeta1);\n const oneMinusAccBeta2 = sub(1, this.accBeta2);\n\n varNames.forEach((name, i) => {\n const value = ENGINE.registeredVariables[name];\n const trainable = false;\n if (this.accumulatedFirstMoment[i] == null) {\n this.accumulatedFirstMoment[i] = {\n originalName: `${name}/m`,\n variable: tidy(() => zerosLike(value).variable(trainable))\n };\n }\n if (this.accumulatedSecondMoment[i] == null) {\n this.accumulatedSecondMoment[i] = {\n originalName: `${name}/v`,\n variable: tidy(() => zerosLike(value).variable(trainable))\n };\n }\n\n const gradient = Array.isArray(variableGradients) ?\n variableGradients[i].tensor :\n variableGradients[name];\n if (gradient == null) {\n return;\n }\n\n const firstMoment = this.accumulatedFirstMoment[i].variable;\n const secondMoment = this.accumulatedSecondMoment[i].variable;\n\n const newFirstMoment =\n add(mul(firstMoment, this.beta1), mul(gradient, 1 - this.beta1));\n const newSecondMoment =\n add(mul(secondMoment, this.beta2),\n mul(square(gradient), 1 - this.beta2));\n\n const biasCorrectedFirstMoment = div(newFirstMoment, oneMinusAccBeta1);\n const biasCorrectedSecondMoment =\n div(newSecondMoment, oneMinusAccBeta2);\n\n firstMoment.assign(newFirstMoment);\n secondMoment.assign(newSecondMoment);\n\n const newValue =\n add(mul(div(biasCorrectedFirstMoment,\n add(sqrt(biasCorrectedSecondMoment), this.epsilon)),\n -this.learningRate),\n value);\n value.assign(newValue);\n });\n\n this.accBeta1.assign(mul(this.accBeta1, this.beta1));\n this.accBeta2.assign(mul(this.accBeta2, this.beta2));\n });\n this.incrementIterations();\n }\n\n dispose(): void {\n this.accBeta1.dispose();\n this.accBeta2.dispose();\n\n if (this.accumulatedFirstMoment != null) {\n dispose(this.accumulatedFirstMoment.map(v => v.variable));\n }\n if (this.accumulatedSecondMoment != null) {\n dispose(this.accumulatedSecondMoment.map(v => v.variable));\n }\n }\n\n async getWeights(): Promise {\n // Order matters for Python compatibility.\n const variables: OptimizerVariable[] =\n [...this.accumulatedFirstMoment, ...this.accumulatedSecondMoment];\n return [await this.saveIterations()].concat(\n variables.map(v => ({name: v.originalName, tensor: v.variable})));\n }\n\n async setWeights(weightValues: NamedTensor[]): Promise {\n weightValues = await this.extractIterations(weightValues);\n tidy(() => {\n this.accBeta1.assign(pow(this.beta1, this.iterations_ + 1));\n this.accBeta2.assign(pow(this.beta2, this.iterations_ + 1));\n });\n\n const variableCount = weightValues.length / 2;\n const trainable = false;\n this.accumulatedFirstMoment =\n weightValues.slice(0, variableCount).map(v => ({\n originalName: v.name,\n variable: v.tensor.variable(\n trainable)\n }));\n this.accumulatedSecondMoment =\n weightValues.slice(variableCount, variableCount * 2)\n .map(v => ({\n originalName: v.name,\n variable: v.tensor.variable(trainable)\n }));\n }\n\n getConfig(): ConfigDict {\n return {\n 'learningRate': this.learningRate,\n 'beta1': this.beta1,\n 'beta2': this.beta2,\n 'epsilon': this.epsilon,\n };\n }\n\n /** @nocollapse */\n static fromConfig(\n cls: SerializableConstructor, config: ConfigDict): T {\n return new cls(\n config['learningRate'], config['beta1'], config['beta2'],\n config['epsilon']);\n }\n}\nregisterClass(AdamOptimizer);\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {dispose, tidy} from '../globals';\nimport {abs} from '../ops/abs';\nimport {add} from '../ops/add';\nimport {div} from '../ops/div';\nimport {maximum} from '../ops/maximum';\nimport {mul} from '../ops/mul';\nimport {scalar} from '../ops/scalar';\nimport {sub} from '../ops/sub';\nimport {zerosLike} from '../ops/zeros_like';\nimport {ConfigDict, registerClass, Serializable, SerializableConstructor} from '../serialization';\nimport {Variable} from '../tensor';\nimport {NamedTensor, NamedVariableMap} from '../tensor_types';\n\nimport {Optimizer, OptimizerVariable} from './optimizer';\n\nexport class AdamaxOptimizer extends Optimizer {\n /** @nocollapse */\n static className = 'Adamax'; // Note: Name matters for Python compatbility.\n private accBeta1: Variable;\n private iteration: Variable;\n\n private accumulatedFirstMoment: OptimizerVariable[] = [];\n private accumulatedWeightedInfNorm: OptimizerVariable[] = [];\n\n constructor(\n protected learningRate: number, protected beta1: number,\n protected beta2: number, protected epsilon: number = null,\n protected decay = 0.0) {\n super();\n\n tidy(() => {\n this.iteration = scalar(0).variable();\n this.accBeta1 = scalar(beta1).variable();\n });\n\n if (epsilon == null) {\n this.epsilon = ENGINE.backend.epsilon();\n }\n }\n\n applyGradients(variableGradients: NamedVariableMap|NamedTensor[]) {\n const variableNames = Array.isArray(variableGradients) ?\n variableGradients.map(item => item.name) :\n Object.keys(variableGradients);\n\n tidy(() => {\n const oneMinusAccBeta1 = sub(1, this.accBeta1);\n const lr =\n div(-this.learningRate, add(mul(this.iteration, this.decay), 1));\n\n variableNames.forEach((name, i) => {\n const value = ENGINE.registeredVariables[name];\n const trainable = false;\n if (this.accumulatedFirstMoment[i] == null) {\n this.accumulatedFirstMoment[i] = {\n originalName: `${name}/m`,\n variable: zerosLike(value).variable(trainable)\n };\n }\n if (this.accumulatedWeightedInfNorm[i] == null) {\n this.accumulatedWeightedInfNorm[i] = {\n originalName: `${name}/v`,\n variable: zerosLike(value).variable(trainable)\n };\n }\n\n const gradient = Array.isArray(variableGradients) ?\n variableGradients[i].tensor :\n variableGradients[name];\n if (gradient == null) {\n return;\n }\n\n const firstMoment = this.accumulatedFirstMoment[i].variable;\n const weightedInfNorm = this.accumulatedWeightedInfNorm[i].variable;\n\n const newFirstMoment =\n add(mul(firstMoment, this.beta1), mul(gradient, 1 - this.beta1));\n\n const ut0 = mul(weightedInfNorm, this.beta2);\n const ut1 = abs(gradient);\n\n const newWeightedInfNorm = maximum(ut0, ut1);\n\n firstMoment.assign(newFirstMoment);\n weightedInfNorm.assign(newWeightedInfNorm);\n\n const newValue =\n add(mul(div(lr, oneMinusAccBeta1),\n div(newFirstMoment, add(newWeightedInfNorm, this.epsilon))),\n value);\n\n value.assign(newValue);\n });\n\n this.iteration.assign(add(this.iteration, 1));\n this.accBeta1.assign(mul(this.accBeta1, this.beta1));\n });\n this.incrementIterations();\n }\n\n dispose(): void {\n this.accBeta1.dispose();\n this.iteration.dispose();\n\n if (this.accumulatedFirstMoment != null) {\n dispose(this.accumulatedFirstMoment.map(v => v.variable));\n }\n if (this.accumulatedWeightedInfNorm != null) {\n dispose(this.accumulatedWeightedInfNorm.map(v => v.variable));\n }\n }\n\n async getWeights(): Promise {\n throw new Error('getWeights() is not implemented for Adamax yet.');\n }\n\n async setWeights(weightValues: NamedTensor[]): Promise {\n throw new Error('setWeights() is not implemented for Adamax yet.');\n }\n\n getConfig(): ConfigDict {\n return {\n 'learningRate': this.learningRate,\n 'beta1': this.beta1,\n 'beta2': this.beta2,\n 'epsilon': this.epsilon,\n 'decay': this.decay\n };\n }\n\n /** @nocollapse */\n static fromConfig(\n cls: SerializableConstructor, config: ConfigDict): T {\n return new cls(\n config['learningRate'], config['beta1'], config['beta2'],\n config['epsilon'], config['decay']);\n }\n}\nregisterClass(AdamaxOptimizer);\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {keep, tidy} from '../globals';\nimport {add} from '../ops/add';\nimport {mul} from '../ops/mul';\nimport {scalar} from '../ops/scalar';\nimport {ConfigDict, registerClass, Serializable, SerializableConstructor} from '../serialization';\nimport {Scalar} from '../tensor';\nimport {NamedTensor, NamedTensorMap} from '../tensor_types';\n\nimport {Optimizer} from './optimizer';\n\n/** @doclink Optimizer */\nexport class SGDOptimizer extends Optimizer {\n /** @nocollapse */\n static className = 'SGD'; // Note: Name matters for Python compatibility.\n protected c: Scalar;\n\n constructor(protected learningRate: number) {\n super();\n this.setLearningRate(learningRate);\n }\n\n applyGradients(variableGradients: NamedTensorMap|NamedTensor[]) {\n const varNames = Array.isArray(variableGradients) ?\n variableGradients.map(v => v.name) :\n Object.keys(variableGradients);\n varNames.forEach((name, i) => {\n const gradient = Array.isArray(variableGradients) ?\n variableGradients[i].tensor :\n variableGradients[name];\n if (gradient == null) {\n return;\n }\n const value = ENGINE.registeredVariables[name];\n tidy(() => {\n const newValue = add(mul(this.c, gradient), value);\n value.assign(newValue);\n });\n });\n this.incrementIterations();\n }\n\n /**\n * Sets the learning rate of the optimizer.\n */\n setLearningRate(learningRate: number) {\n this.learningRate = learningRate;\n if (this.c != null) {\n this.c.dispose();\n }\n this.c = keep(scalar(-learningRate));\n }\n\n dispose() {\n this.c.dispose();\n }\n\n async getWeights(): Promise {\n return [await this.saveIterations()];\n }\n\n async setWeights(weightValues: NamedTensor[]): Promise {\n weightValues = await this.extractIterations(weightValues);\n if (weightValues.length !== 0) {\n throw new Error('SGD optimizer does not have settable weights.');\n }\n }\n\n getConfig(): ConfigDict {\n return {'learningRate': this.learningRate};\n }\n\n /** @nocollapse */\n static fromConfig(\n cls: SerializableConstructor, config: ConfigDict): T {\n return new cls(config['learningRate']);\n }\n}\nregisterClass(SGDOptimizer);\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {dispose, tidy} from '../globals';\nimport {add} from '../ops/add';\nimport {mul} from '../ops/mul';\nimport {scalar} from '../ops/scalar';\nimport {zerosLike} from '../ops/zeros_like';\nimport {ConfigDict, registerClass, Serializable, SerializableConstructor} from '../serialization';\nimport {Scalar, Tensor} from '../tensor';\nimport {NamedTensor, NamedVariableMap} from '../tensor_types';\n\nimport {OptimizerVariable} from './optimizer';\nimport {SGDOptimizer} from './sgd_optimizer';\n\n/** @doclink Optimizer */\nexport class MomentumOptimizer extends SGDOptimizer {\n /** @nocollapse */\n static className = 'Momentum'; // Name matters for Python compatibility.\n private m: Scalar;\n private accumulations: OptimizerVariable[] = [];\n\n constructor(\n protected learningRate: number, private momentum: number,\n private useNesterov = false) {\n super(learningRate);\n this.m = scalar(this.momentum);\n }\n\n applyGradients(variableGradients: NamedVariableMap|NamedTensor[]) {\n const variableNames = Array.isArray(variableGradients) ?\n variableGradients.map(item => item.name) :\n Object.keys(variableGradients);\n\n variableNames.forEach((name, i) => {\n const value = ENGINE.registeredVariables[name];\n if (this.accumulations[i] == null) {\n const trainable = false;\n this.accumulations[i] = {\n originalName: `${name}/momentum`,\n variable: tidy(() => zerosLike(value).variable(trainable))\n };\n }\n\n const accumulation = this.accumulations[i].variable;\n const gradient = Array.isArray(variableGradients) ?\n variableGradients[i].tensor :\n variableGradients[name];\n if (gradient == null) {\n return;\n }\n\n tidy(() => {\n let newValue: Tensor;\n const newAccumulation = add(mul(this.m, accumulation), gradient);\n if (this.useNesterov) {\n newValue = add(\n mul(this.c, add(gradient, mul(newAccumulation, this.m))), value);\n } else {\n newValue = add(mul(this.c, newAccumulation), value);\n }\n accumulation.assign(newAccumulation);\n value.assign(newValue);\n });\n });\n this.incrementIterations();\n }\n\n dispose(): void {\n this.m.dispose();\n if (this.accumulations != null) {\n dispose(this.accumulations.map(v => v.variable));\n }\n }\n\n /**\n * Sets the momentum of the optimizer.\n *\n * @param momentum\n */\n setMomentum(momentum: number) {\n this.momentum = momentum;\n }\n\n async getWeights(): Promise {\n // Order matters for Python compatibility.\n return [await this.saveIterations()].concat(this.accumulations.map(\n v => ({name: v.originalName, tensor: v.variable})));\n }\n\n async setWeights(weightValues: NamedTensor[]): Promise {\n weightValues = await this.extractIterations(weightValues);\n const trainable = false;\n this.accumulations = weightValues.map(\n v => ({originalName: v.name, variable: v.tensor.variable(trainable)}));\n }\n\n getConfig(): ConfigDict {\n return {\n 'learningRate': this.learningRate,\n 'momentum': this.momentum,\n 'useNesterov': this.useNesterov\n };\n }\n\n /** @nocollapse */\n static fromConfig(\n cls: SerializableConstructor, config: ConfigDict): T {\n return new cls(\n config['learningRate'], config['momentum'], config['useNesterov']);\n }\n}\nregisterClass(MomentumOptimizer);\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ENGINE} from '../engine';\nimport {dispose, tidy} from '../globals';\nimport {add} from '../ops/add';\nimport {div} from '../ops/div';\nimport {mul} from '../ops/mul';\nimport {sqrt} from '../ops/sqrt';\nimport {square} from '../ops/square';\nimport {sub} from '../ops/sub';\nimport {zerosLike} from '../ops/zeros_like';\nimport {ConfigDict, registerClass, Serializable, SerializableConstructor} from '../serialization';\nimport {NamedTensor, NamedTensorMap} from '../tensor_types';\n\nimport {Optimizer, OptimizerVariable} from './optimizer';\n\n/** @doclink Optimizer */\nexport class RMSPropOptimizer extends Optimizer {\n /** @nocollapse */\n static className = 'RMSProp'; // Note: Name matters for Python compatibility.\n private centered: boolean;\n\n private accumulatedMeanSquares: OptimizerVariable[] = [];\n private accumulatedMoments: OptimizerVariable[] = [];\n private accumulatedMeanGrads: OptimizerVariable[] = [];\n\n constructor(\n protected learningRate: number, protected decay = 0.9,\n protected momentum = 0.0, protected epsilon: number = null,\n centered = false) {\n super();\n\n this.centered = centered;\n\n if (epsilon == null) {\n this.epsilon = ENGINE.backend.epsilon();\n }\n if (learningRate == null) {\n throw new Error(`learningRate for RMSPropOptimizer must be defined.`);\n }\n }\n\n applyGradients(variableGradients: NamedTensorMap|NamedTensor[]) {\n const variableNames = Array.isArray(variableGradients) ?\n variableGradients.map(item => item.name) :\n Object.keys(variableGradients);\n\n variableNames.forEach((name, i) => {\n const value = ENGINE.registeredVariables[name];\n const trainable = false;\n if (this.accumulatedMeanSquares[i] == null) {\n this.accumulatedMeanSquares[i] = {\n originalName: `${name}/rms`,\n variable: tidy(() => zerosLike(value).variable(trainable))\n };\n }\n if (this.accumulatedMoments[i] == null) {\n this.accumulatedMoments[i] = {\n originalName: `${name}/momentum`,\n variable: tidy(() => zerosLike(value).variable(trainable))\n };\n }\n if (this.accumulatedMeanGrads[i] == null && this.centered) {\n this.accumulatedMeanGrads[i] = {\n originalName: `${name}/mg`,\n variable: tidy(() => zerosLike(value).variable(trainable))\n };\n }\n\n const gradient = Array.isArray(variableGradients) ?\n variableGradients[i].tensor :\n variableGradients[name];\n if (gradient == null) {\n return;\n }\n\n const accumulatedMeanSquare = this.accumulatedMeanSquares[i].variable;\n const accumulatedMoments = this.accumulatedMoments[i].variable;\n tidy(() => {\n const newAccumulatedMeanSquare =\n add(mul(accumulatedMeanSquare, this.decay),\n mul(square(gradient), 1 - this.decay));\n\n if (this.centered) {\n const accumulatedMeanGrad = this.accumulatedMeanGrads[i].variable;\n // Centered gradient\n const newAccumulatedMeanGrad =\n add(mul(accumulatedMeanGrad, this.decay),\n mul(gradient, 1 - this.decay));\n\n const gradContribution =\n div(mul(gradient, this.learningRate),\n sqrt(\n sub(newAccumulatedMeanSquare,\n add(square(newAccumulatedMeanGrad), this.epsilon))));\n const newAccumulatedMoments =\n add(mul(accumulatedMoments, this.momentum), gradContribution);\n\n accumulatedMeanSquare.assign(newAccumulatedMeanSquare);\n accumulatedMeanGrad.assign(newAccumulatedMeanGrad);\n accumulatedMoments.assign(newAccumulatedMoments);\n\n const newValue = sub(value, newAccumulatedMoments);\n value.assign(newValue);\n } else {\n // Plain gradient\n const newAccumulatedMeanSquare =\n add(mul(accumulatedMeanSquare, this.decay),\n mul(square(gradient), 1 - this.decay));\n\n const newAccumulatedMoments =\n add(mul(accumulatedMoments, this.momentum),\n div(mul(gradient, this.learningRate),\n sqrt(add(newAccumulatedMeanSquare, this.epsilon))));\n\n accumulatedMeanSquare.assign(newAccumulatedMeanSquare);\n accumulatedMoments.assign(newAccumulatedMoments);\n\n const newValue = sub(value, newAccumulatedMoments);\n value.assign(newValue);\n }\n });\n });\n this.incrementIterations();\n }\n\n dispose(): void {\n if (this.accumulatedMeanSquares != null) {\n dispose(this.accumulatedMeanSquares.map(v => v.variable));\n }\n if (this.accumulatedMeanGrads != null && this.centered) {\n dispose(this.accumulatedMeanGrads.map(v => v.variable));\n }\n if (this.accumulatedMoments != null) {\n dispose(this.accumulatedMoments.map(v => v.variable));\n }\n }\n\n async getWeights(): Promise {\n // Order matters for Python compatibility.\n const variables: OptimizerVariable[] =\n [...this.accumulatedMeanSquares, ...this.accumulatedMoments];\n if (this.centered) {\n variables.push(...this.accumulatedMeanGrads);\n }\n return [await this.saveIterations()].concat(\n variables.map(v => ({name: v.originalName, tensor: v.variable})));\n }\n\n async setWeights(weightValues: NamedTensor[]): Promise {\n weightValues = await this.extractIterations(weightValues);\n const variableCount =\n this.centered ? weightValues.length / 3 : weightValues.length / 2;\n const trainable = false;\n this.accumulatedMeanSquares =\n weightValues.slice(0, variableCount).map(v => ({\n originalName: v.name,\n variable: v.tensor.variable(\n trainable)\n }));\n this.accumulatedMoments =\n weightValues.slice(variableCount, variableCount * 2)\n .map(v => ({\n originalName: v.name,\n variable: v.tensor.variable(trainable)\n }));\n if (this.centered) {\n this.accumulatedMeanGrads =\n weightValues.slice(variableCount * 2, variableCount * 3)\n .map(v => ({\n originalName: v.name,\n variable: v.tensor.variable(trainable)\n }));\n }\n }\n\n getConfig(): ConfigDict {\n return {\n 'learningRate': this.learningRate,\n 'decay': this.decay,\n 'momentum': this.momentum,\n 'epsilon': this.epsilon,\n 'centered': this.centered\n };\n }\n\n /** @nocollapse */\n static fromConfig(\n cls: SerializableConstructor, config: ConfigDict): T {\n return new cls(\n config['learningRate'], config['decay'], config['momentum'],\n config['epsilon'], config['centered']);\n }\n}\nregisterClass(RMSPropOptimizer);\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {AdadeltaOptimizer} from './adadelta_optimizer';\nimport {AdagradOptimizer} from './adagrad_optimizer';\nimport {AdamOptimizer} from './adam_optimizer';\nimport {AdamaxOptimizer} from './adamax_optimizer';\nimport {MomentumOptimizer} from './momentum_optimizer';\nimport {RMSPropOptimizer} from './rmsprop_optimizer';\nimport {SGDOptimizer} from './sgd_optimizer';\n\nexport class OptimizerConstructors {\n /**\n * Constructs a `tf.SGDOptimizer` that uses stochastic gradient descent.\n *\n * ```js\n * // Fit a quadratic function by learning the coefficients a, b, c.\n * const xs = tf.tensor1d([0, 1, 2, 3]);\n * const ys = tf.tensor1d([1.1, 5.9, 16.8, 33.9]);\n *\n * const a = tf.scalar(Math.random()).variable();\n * const b = tf.scalar(Math.random()).variable();\n * const c = tf.scalar(Math.random()).variable();\n *\n * // y = a * x^2 + b * x + c.\n * const f = x => a.mul(x.square()).add(b.mul(x)).add(c);\n * const loss = (pred, label) => pred.sub(label).square().mean();\n *\n * const learningRate = 0.01;\n * const optimizer = tf.train.sgd(learningRate);\n *\n * // Train the model.\n * for (let i = 0; i < 10; i++) {\n * optimizer.minimize(() => loss(f(xs), ys));\n * }\n *\n * // Make predictions.\n * console.log(\n * `a: ${a.dataSync()}, b: ${b.dataSync()}, c: ${c.dataSync()}`);\n * const preds = f(xs).dataSync();\n * preds.forEach((pred, i) => {\n * console.log(`x: ${i}, pred: ${pred}`);\n * });\n * ```\n *\n * @param learningRate The learning rate to use for the SGD algorithm.\n *\n * @doc {heading: 'Training', subheading: 'Optimizers', namespace: 'train'}\n */\n static sgd(learningRate: number): SGDOptimizer {\n return new SGDOptimizer(learningRate);\n }\n\n /**\n * Constructs a `tf.MomentumOptimizer` that uses momentum gradient\n * descent.\n *\n * See\n * [http://proceedings.mlr.press/v28/sutskever13.pdf](\n * http://proceedings.mlr.press/v28/sutskever13.pdf)\n *\n * @param learningRate The learning rate to use for the Momentum gradient\n * descent algorithm.\n * @param momentum The momentum to use for the momentum gradient descent\n * algorithm.\n *\n * @doc {heading: 'Training', subheading: 'Optimizers', namespace: 'train'}\n */\n static momentum(learningRate: number, momentum: number, useNesterov = false):\n MomentumOptimizer {\n return new MomentumOptimizer(learningRate, momentum, useNesterov);\n }\n\n /**\n * Constructs a `tf.RMSPropOptimizer` that uses RMSProp gradient\n * descent. This implementation uses plain momentum and is not centered\n * version of RMSProp.\n *\n * See\n * [http://www.cs.toronto.edu/~tijmen/csc321/slides/lecture_slides_lec6.pdf](\n * http://www.cs.toronto.edu/~tijmen/csc321/slides/lecture_slides_lec6.pdf)\n *\n * @param learningRate The learning rate to use for the RMSProp gradient\n * descent algorithm.\n * @param decay The discounting factor for the history/coming gradient.\n * @param momentum The momentum to use for the RMSProp gradient descent\n * algorithm.\n * @param epsilon Small value to avoid zero denominator.\n * @param centered If true, gradients are normalized by the estimated\n * variance of the gradient.\n *\n * @doc {heading: 'Training', subheading: 'Optimizers', namespace: 'train'}\n */\n static rmsprop(\n learningRate: number, decay = .9, momentum = 0.0, epsilon: number = null,\n centered = false): RMSPropOptimizer {\n return new RMSPropOptimizer(\n learningRate, decay, momentum, epsilon, centered);\n }\n\n /**\n * Constructs a `tf.AdamOptimizer` that uses the Adam algorithm.\n * See [https://arxiv.org/abs/1412.6980](https://arxiv.org/abs/1412.6980)\n *\n * @param learningRate The learning rate to use for the Adam gradient\n * descent algorithm.\n * @param beta1 The exponential decay rate for the 1st moment estimates.\n * @param beta2 The exponential decay rate for the 2nd moment estimates.\n * @param epsilon A small constant for numerical stability.\n *\n * @doc {heading: 'Training', subheading: 'Optimizers', namespace: 'train'}\n */\n static adam(\n learningRate = 0.001, beta1 = 0.9, beta2 = 0.999,\n epsilon: number = null): AdamOptimizer {\n return new AdamOptimizer(learningRate, beta1, beta2, epsilon);\n }\n\n /**\n * Constructs a `tf.AdadeltaOptimizer` that uses the Adadelta algorithm.\n * See [https://arxiv.org/abs/1212.5701](https://arxiv.org/abs/1212.5701)\n *\n * @param learningRate The learning rate to use for the Adadelta gradient\n * descent algorithm.\n * @param rho The learning rate decay over each update.\n * @param epsilon A constant epsilon used to better condition the grad\n * update.\n *\n * @doc {heading: 'Training', subheading: 'Optimizers', namespace: 'train'}\n */\n static adadelta(learningRate = .001, rho = .95, epsilon: number = null):\n AdadeltaOptimizer {\n return new AdadeltaOptimizer(learningRate, rho, epsilon);\n }\n\n /**\n * Constructs a `tf.AdamaxOptimizer` that uses the Adamax algorithm.\n * See [https://arxiv.org/abs/1412.6980](https://arxiv.org/abs/1412.6980)\n *\n * @param learningRate The learning rate to use for the Adamax gradient\n * descent algorithm.\n * @param beta1 The exponential decay rate for the 1st moment estimates.\n * @param beta2 The exponential decay rate for the 2nd moment estimates.\n * @param epsilon A small constant for numerical stability.\n * @param decay The learning rate decay over each update.\n *\n * @doc {heading: 'Training', subheading: 'Optimizers', namespace: 'train'}\n */\n static adamax(\n learningRate = 0.002, beta1 = 0.9, beta2 = 0.999, epsilon: number = null,\n decay = 0.0): AdamaxOptimizer {\n return new AdamaxOptimizer(learningRate, beta1, beta2, epsilon, decay);\n }\n\n /**\n * Constructs a `tf.AdagradOptimizer` that uses the Adagrad algorithm.\n * See\n * [http://www.jmlr.org/papers/volume12/duchi11a/duchi11a.pdf](\n * http://www.jmlr.org/papers/volume12/duchi11a/duchi11a.pdf)\n * or\n * [http://ruder.io/optimizing-gradient-descent/index.html#adagrad](\n * http://ruder.io/optimizing-gradient-descent/index.html#adagrad)\n *\n * @param learningRate The learning rate to use for the Adagrad gradient\n * descent algorithm.\n * @param initialAccumulatorValue Starting value for the accumulators, must be\n * positive.\n *\n * @doc {heading: 'Training', subheading: 'Optimizers', namespace: 'train'}\n */\n static adagrad(learningRate: number, initialAccumulatorValue = 0.1):\n AdagradOptimizer {\n return new AdagradOptimizer(learningRate, initialAccumulatorValue);\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// So typings can propagate.\nimport {AdadeltaOptimizer} from './optimizers/adadelta_optimizer';\nimport {AdagradOptimizer} from './optimizers/adagrad_optimizer';\nimport {AdamOptimizer} from './optimizers/adam_optimizer';\nimport {AdamaxOptimizer} from './optimizers/adamax_optimizer';\nimport {MomentumOptimizer} from './optimizers/momentum_optimizer';\nimport {OptimizerConstructors} from './optimizers/optimizer_constructors';\nimport {RMSPropOptimizer} from './optimizers/rmsprop_optimizer';\nimport {SGDOptimizer} from './optimizers/sgd_optimizer';\n\n// tslint:disable-next-line:no-unused-expression\n[MomentumOptimizer, SGDOptimizer, AdadeltaOptimizer, AdagradOptimizer,\n RMSPropOptimizer, AdamaxOptimizer, AdamOptimizer];\n\nexport const train = {\n sgd: OptimizerConstructors.sgd,\n momentum: OptimizerConstructors.momentum,\n adadelta: OptimizerConstructors.adadelta,\n adagrad: OptimizerConstructors.adagrad,\n rmsprop: OptimizerConstructors.rmsprop,\n adamax: OptimizerConstructors.adamax,\n adam: OptimizerConstructors.adam\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nconst delayCallback: Function = (() => {\n if (typeof requestAnimationFrame !== 'undefined') {\n return requestAnimationFrame;\n } else if (typeof setImmediate !== 'undefined') {\n return setImmediate;\n }\n return (f: Function) => f(); // no delays\n})();\n\n/**\n * Returns a promise that resolves when a requestAnimationFrame has completed.\n *\n * On Node.js this uses setImmediate instead of requestAnimationFrame.\n *\n * This is simply a sugar method so that users can do the following:\n * `await tf.nextFrame();`\n *\n * @doc {heading: 'Performance', subheading: 'Timing'}\n */\nfunction nextFrame(): Promise {\n return new Promise(resolve => delayCallback(() => resolve()));\n}\n\nexport {nextFrame};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport * as util from '../util';\n\nexport function assertParamsConsistent(shapes: number[][], axis: number) {\n const rank = shapes[0].length;\n shapes.forEach((shape, i) => {\n util.assert(\n shape.length === rank,\n () =>\n `Error in concat${rank}D: rank of tensors[${i}] must be the same ` +\n `as the rank of the rest (${rank})`);\n });\n\n util.assert(\n axis >= 0 && axis < rank,\n () => `Error in concat${rank}D: axis must be between 0 and ${rank - 1}.`);\n\n const firstShape = shapes[0];\n shapes.forEach((shape, i) => {\n for (let r = 0; r < rank; r++) {\n util.assert(\n (r === axis) || (shape[r] === firstShape[r]),\n () => `Error in concat${rank}D: Shape of tensors[${i}] (${shape}) ` +\n `does not match the shape of the rest (${firstShape}) ` +\n `along the non-concatenated axis ${i}.`);\n }\n });\n}\n\nexport function computeOutShape(shapes: number[][], axis: number): number[] {\n const outputShape = shapes[0].slice();\n for (let i = 1; i < shapes.length; i++) {\n outputShape[axis] += shapes[i][axis];\n }\n return outputShape;\n}\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nexport enum RowPartitionType {\n FIRST_DIM_SIZE,\n VALUE_ROWIDS,\n ROW_LENGTHS,\n ROW_SPLITS,\n ROW_LIMITS,\n ROW_STARTS\n}\n\nexport function combineRaggedTensorToTensorShapes(\n raggedRank: number, shape: number[], valueShape: number[]) {\n // Test for consistency of valueShape and shape specified.\n // If shape is unspecified and valueShape is specified, then copy\n // over the size from the valueShape dimension.\n\n let outputShape: number[] = new Array();\n if (valueShape == null && shape == null) {\n return outputShape;\n }\n\n if (shape == null) {\n // Here, value_shape must be of known size.\n while (outputShape.length < raggedRank + valueShape.length) {\n outputShape.push(-1);\n }\n } else {\n outputShape = shape.slice();\n }\n if (valueShape == null) {\n return outputShape;\n }\n // At this point, valueShape and output_shape have known ranks.\n if (raggedRank + valueShape.length !== outputShape.length) {\n throw new Error(\n `rt input.shape and shape=${shape} are incompatible: rt input.rank = ${\n raggedRank +\n valueShape.length}, but shape.rank = ${outputShape.length}`);\n }\n\n for (let i = 1; i < valueShape.length; ++i) {\n const valueDim = valueShape[i];\n const outputShapeDimIndex =\n outputShape[outputShape.length - valueShape.length + i];\n const outputShapeDim = outputShape[outputShapeDimIndex];\n\n if (valueDim >= 0) {\n if (outputShapeDim >= 0) {\n if (outputShapeDim !== valueDim) {\n throw new Error(`rt input.shape and shape=${\n shape} are incompatible: rt input.shape[${i + raggedRank}] = ${\n valueDim} but shape[${i + raggedRank}] = ${outputShapeDim}`);\n }\n } else {\n outputShape[outputShapeDimIndex] = valueDim;\n }\n }\n }\n return outputShape;\n}\n\nexport function getRowPartitionTypesHelper(rowPartitionTypeStrings: string[]) {\n const stringToType = {\n 'FIRST_DIM_SIZE': RowPartitionType.FIRST_DIM_SIZE,\n 'VALUE_ROWIDS': RowPartitionType.VALUE_ROWIDS,\n 'ROW_LENGTHS': RowPartitionType.ROW_LENGTHS,\n 'ROW_SPLITS': RowPartitionType.ROW_SPLITS,\n 'ROW_LIMITS': RowPartitionType.ROW_LIMITS,\n 'ROW_STARTS': RowPartitionType.ROW_STARTS\n };\n\n const result: RowPartitionType[] = [];\n for (const typeStr of rowPartitionTypeStrings) {\n if (typeStr in stringToType) {\n result.push(stringToType[typeStr as keyof typeof stringToType]);\n } else {\n break;\n }\n }\n\n return result;\n}\n\nexport function getRaggedRank(rowPartitionTypes: RowPartitionType[]) {\n if (rowPartitionTypes.length === 0) {\n return 0;\n }\n if (rowPartitionTypes[0] === RowPartitionType.FIRST_DIM_SIZE) {\n return rowPartitionTypes.length - 1;\n }\n return rowPartitionTypes.length;\n}\n\nexport function validateDefaultValueShape(\n defaultValueShape: number[], valueShape: number[]) {\n if (defaultValueShape == null || valueShape == null) {\n return;\n }\n\n const defaultNDims = defaultValueShape.length;\n const valuesNDims = valueShape.length;\n if (defaultNDims >= valuesNDims) {\n throw new Error(`defaultValue.shape=${\n defaultValueShape} and ragged tensor flatValues.shape=${\n valueShape}, are incompatible: defaultValue.rank = ${\n defaultNDims} must be less than ragged tensor input flatValues.rank = ${\n valuesNDims})`);\n }\n for (let i = 0; i < Math.min(defaultNDims, valuesNDims - 1); ++i) {\n const defaultDim = defaultValueShape[i];\n const valueDim = valueShape[i + 1];\n if (defaultDim >= 0 && valueDim >= 0 && defaultDim !== 1 &&\n defaultDim !== valueDim) {\n throw new Error(`defaultValue.shape=${\n defaultValueShape}, and ragged tensor input flatValues.shape=${\n valueShape} are incompatible: defaultValue.shape[${\n i - defaultValueShape.length}] = ${\n defaultDim} but ragged tensor input.flatValues.shape[${\n i - defaultValueShape.length}] = ${valueDim}`);\n }\n }\n}\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/**\n * Inputs of size above this threshold will be parallelized by calling multiple\n * shader programs.\n */\nimport {nearestDivisor} from '../util';\n\nexport const PARALLELIZE_THRESHOLD = 30;\n\nexport interface ReduceInfo {\n windowSize: number;\n batchSize: number;\n inSize: number;\n outSize: number;\n}\n\nexport function computeOptimalWindowSize(inSize: number): number {\n if (inSize <= PARALLELIZE_THRESHOLD) {\n return inSize;\n }\n return nearestDivisor(inSize, Math.floor(Math.sqrt(inSize)));\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// Returns the image center in pixels.\nexport function getImageCenter(\n center: number|[number, number], imageHeight: number,\n imageWidth: number): [number, number] {\n const centerX =\n imageWidth * (typeof center === 'number' ? center : center[0]);\n const centerY =\n imageHeight * (typeof center === 'number' ? center : center[1]);\n return [centerX, centerY];\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/**\n * Gets the new shape of the input Tensor after it's been reshaped\n * to:\n * [blockShape[0], ..., blockShape[M-1], batch / prod(blockShape),\n * inputShape[1], ..., inputShape[N-1]]\n *\n * See step 1: https://www.tensorflow.org/api_docs/python/tf/batch_to_space_nd\n */\nexport function getReshaped(\n inputShape: number[], blockShape: number[], prod: number,\n batchToSpace = true): number[] {\n let reshaped: number[] = [];\n if (batchToSpace) {\n reshaped = reshaped.concat(blockShape.slice(0));\n reshaped.push(inputShape[0] / prod);\n reshaped = reshaped.concat(inputShape.slice(1));\n } else {\n reshaped = reshaped.concat(inputShape[0]);\n const spatialLength = blockShape.length;\n for (let i = 0; i < spatialLength; ++i) {\n reshaped =\n reshaped.concat([inputShape[i + 1] / blockShape[i], blockShape[i]]);\n }\n reshaped = reshaped.concat(inputShape.slice(spatialLength + 1));\n }\n return reshaped;\n}\n\n/**\n * Gets the permutation that will transpose the dimensions of the\n * reshaped tensor to shape:\n *\n * [batch / prod(block_shape),inputShape[1], blockShape[0], ...,\n * inputShape[M], blockShape[M-1],inputShape[M+1], ..., inputShape[N-1]]\n *\n * see step 2: https://www.tensorflow.org/api_docs/python/tf/batch_to_space_nd\n */\nexport function getPermuted(\n reshapedRank: number, blockShapeRank: number,\n batchToSpace = true): number[] {\n const permuted = [];\n if (batchToSpace) {\n permuted.push(blockShapeRank);\n for (let i = blockShapeRank + 1; i < reshapedRank; ++i) {\n if (i <= 2 * blockShapeRank) {\n permuted.push(i);\n permuted.push(i - (blockShapeRank + 1));\n } else {\n permuted.push(i);\n }\n }\n } else {\n const permutedBeforeBatch = [];\n const permutedAfterBatch = [];\n for (let i = 1; i < reshapedRank; ++i) {\n if (i >= blockShapeRank * 2 + 1 || i % 2 === 1) {\n permutedAfterBatch.push(i);\n } else {\n permutedBeforeBatch.push(i);\n }\n }\n permuted.push(...permutedBeforeBatch);\n permuted.push(0);\n permuted.push(...permutedAfterBatch);\n }\n return permuted;\n}\n\n/**\n * Gets the shape of the reshaped and permuted input Tensor before any cropping\n * is applied. The new shape will be:\n *\n * [batch / prod(blockShape),inputShape[1] * blockShape[0], ...,\n * inputShape[M] * blockShape[M-1],inputShape[M+1], ..., inputShape[N-1]]\n *\n * See step 3: https://www.tensorflow.org/api_docs/python/tf/batch_to_space_nd\n */\nexport function getReshapedPermuted(\n inputShape: number[], blockShape: number[], prod: number,\n batchToSpace = true): number[] {\n const reshapedPermuted = [];\n\n if (batchToSpace) {\n reshapedPermuted.push(inputShape[0] / prod);\n } else {\n reshapedPermuted.push(inputShape[0] * prod);\n }\n\n for (let i = 1; i < inputShape.length; ++i) {\n if (i <= blockShape.length) {\n if (batchToSpace) {\n reshapedPermuted.push(blockShape[i - 1] * inputShape[i]);\n } else {\n reshapedPermuted.push(inputShape[i] / blockShape[i - 1]);\n }\n } else {\n reshapedPermuted.push(inputShape[i]);\n }\n }\n\n return reshapedPermuted;\n}\n\n/**\n * Converts the crops argument into the beginning coordinates of a slice\n * operation.\n */\nexport function getSliceBeginCoords(\n crops: number[][], blockShape: number): number[] {\n const sliceBeginCoords = [0];\n for (let i = 0; i < blockShape; ++i) {\n sliceBeginCoords.push(crops[i][0]);\n }\n return sliceBeginCoords;\n}\n\n/**\n * Converts the crops argument into the size of a slice operation. When\n * combined with getSliceBeginCoords this function allows the reshaped and\n * permuted Tensor to be cropped to its final output shape of:\n *\n * inputShape[1] * blockShape[0] - crops[0,0] - crops[0,1], ...,\n * inputShape[M] * blockShape[M-1] -crops[M-1,0] -\n * crops[M-1,1],inputShape[M+1], ..., inputShape[N-1]]\n *\n * See step 4: https://www.tensorflow.org/api_docs/python/tf/batch_to_space_nd\n */\nexport function getSliceSize(\n uncroppedShape: number[], crops: number[][], blockShape: number): number[] {\n const sliceSize = uncroppedShape.slice(0, 1);\n for (let i = 0; i < blockShape; ++i) {\n sliceSize.push(uncroppedShape[i + 1] - crops[i][0] - crops[i][1]);\n }\n\n return sliceSize;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nexport const SELU_SCALEALPHA = 1.7580993408473768599402175208123;\nexport const SELU_SCALE = 1.0507009873554804934193349852946;\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nexport const ERF_P = 0.3275911;\nexport const ERF_A1 = 0.254829592;\nexport const ERF_A2 = -0.284496736;\nexport const ERF_A3 = 1.421413741;\nexport const ERF_A4 = -1.453152027;\nexport const ERF_A5 = 1.061405429;\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {TypedArray} from '../types';\n/**\n * Merges real and imaginary Float32Arrays into a single complex Float32Array.\n *\n * The memory layout is interleaved as follows:\n * real: [r0, r1, r2]\n * imag: [i0, i1, i2]\n * complex: [r0, i0, r1, i1, r2, i2]\n *\n * This is the inverse of splitRealAndImagArrays.\n *\n * @param real The real values of the complex tensor values.\n * @param imag The imag values of the complex tensor values.\n * @returns A complex tensor as a Float32Array with merged values.\n */\nexport function mergeRealAndImagArrays(\n real: Float32Array, imag: Float32Array): Float32Array {\n if (real.length !== imag.length) {\n throw new Error(\n `Cannot merge real and imag arrays of different lengths. real:` +\n `${real.length}, imag: ${imag.length}.`);\n }\n const result = new Float32Array(real.length * 2);\n for (let i = 0; i < result.length; i += 2) {\n result[i] = real[i / 2];\n result[i + 1] = imag[i / 2];\n }\n return result;\n}\n\n/**\n * Splits a complex Float32Array into real and imag parts.\n *\n * The memory layout is interleaved as follows:\n * complex: [r0, i0, r1, i1, r2, i2]\n * real: [r0, r1, r2]\n * imag: [i0, i1, i2]\n *\n * This is the inverse of mergeRealAndImagArrays.\n *\n * @param complex The complex tensor values.\n * @returns An object with real and imag Float32Array components of the complex\n * tensor.\n */\nexport function splitRealAndImagArrays(complex: Float32Array):\n {real: Float32Array, imag: Float32Array} {\n const real = new Float32Array(complex.length / 2);\n const imag = new Float32Array(complex.length / 2);\n for (let i = 0; i < complex.length; i += 2) {\n real[i / 2] = complex[i];\n imag[i / 2] = complex[i + 1];\n }\n return {real, imag};\n}\n\n/**\n * Extracts even indexed complex values in the given array.\n * @param complex The complex tensor values\n */\nexport function complexWithEvenIndex(complex: Float32Array):\n {real: Float32Array, imag: Float32Array} {\n const len = Math.ceil(complex.length / 4);\n const real = new Float32Array(len);\n const imag = new Float32Array(len);\n for (let i = 0; i < complex.length; i += 4) {\n real[Math.floor(i / 4)] = complex[i];\n imag[Math.floor(i / 4)] = complex[i + 1];\n }\n return {real, imag};\n}\n\n/**\n * Extracts odd indexed comple values in the given array.\n * @param complex The complex tensor values\n */\nexport function complexWithOddIndex(complex: Float32Array):\n {real: Float32Array, imag: Float32Array} {\n const len = Math.floor(complex.length / 4);\n const real = new Float32Array(len);\n const imag = new Float32Array(len);\n for (let i = 2; i < complex.length; i += 4) {\n real[Math.floor(i / 4)] = complex[i];\n imag[Math.floor(i / 4)] = complex[i + 1];\n }\n return {real, imag};\n}\n\n/**\n * Get the map representing a complex value in the given array.\n * @param complex The complex tensor values.\n * @param index An index of the target complex value.\n */\nexport function getComplexWithIndex(\n complex: Float32Array, index: number): {real: number, imag: number} {\n const real = complex[index * 2];\n const imag = complex[index * 2 + 1];\n return {real, imag};\n}\n\n/**\n * Insert a given complex value into the TypedArray.\n * @param data The array in which the complex value is inserted.\n * @param c The complex value to be inserted.\n * @param index An index of the target complex value.\n */\nexport function assignToTypedArray(\n data: TypedArray, real: number, imag: number, index: number) {\n data[index * 2] = real;\n data[index * 2 + 1] = imag;\n}\n\n/**\n * Make the list of exponent terms used by FFT.\n */\nexport function exponents(\n n: number, inverse: boolean): {real: Float32Array, imag: Float32Array} {\n const real = new Float32Array(n / 2);\n const imag = new Float32Array(n / 2);\n for (let i = 0; i < Math.ceil(n / 2); i++) {\n const x = (inverse ? 2 : -2) * Math.PI * (i / n);\n real[i] = Math.cos(x);\n imag[i] = Math.sin(x);\n }\n return {real, imag};\n}\n\n/**\n * Make the exponent term used by FFT.\n */\nexport function exponent(\n k: number, n: number, inverse: boolean): {real: number, imag: number} {\n const x = (inverse ? 2 : -2) * Math.PI * (k / n);\n const real = Math.cos(x);\n const imag = Math.sin(x);\n return {real, imag};\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/**\n * Utility functions for computing einsum (tensor contraction and summation\n * based on Einstein summation.)\n */\n\nimport {Tensor} from '../tensor';\nimport {assert} from '../util_base';\n\nconst ARROW = '->';\nconst ARROW_REGEX = /->/g;\nconst COMMA = ',';\nconst ELLIPSIS = '...';\n\n/**\n * Parse an equation for einsum.\n *\n * @param equation The einsum equation (e.g., \"ij,jk->ik\").\n * @param numTensors Number of tensors provided along with `equation`. Used to\n * check matching number of input tensors.\n * @returns An object consisting of the following fields:\n * - allDims: all dimension names as strings.\n * - summedDims: a list of all dimensions being summed over, as indices to\n * the elements of `allDims`.\n * - idDims: indices of the dimensions in each input tensor, as indices to\n * the elements of `allDims.\n */\nexport function decodeEinsumEquation(equation: string, numTensors: number): {\n allDims: string[],\n summedDims: number[],\n idDims: number[][],\n} {\n equation = equation.replace(/\\s/g, ''); // Remove witespace in equation.\n const numArrows =\n (equation.length - equation.replace(ARROW_REGEX, '').length) /\n ARROW.length;\n if (numArrows < 1) {\n throw new Error('Equations without an arrow are not supported.');\n } else if (numArrows > 1) {\n throw new Error(`Equation must contain exactly one arrow (\"${ARROW}\").`);\n }\n const [inputString, outputString] = equation.split(ARROW);\n assert(\n inputString.indexOf(ELLIPSIS) === -1,\n () => `The ellipsis notation (\"${ELLIPSIS}\") is not supported yet.`);\n const inputTerms = inputString.split(COMMA);\n const numInputs = inputTerms.length;\n if (numTensors !== numInputs) {\n throw new Error(\n `Expected ${numInputs} input tensors, received ${numTensors}`);\n }\n if (numInputs > 2) {\n throw new Error(\n 'Support for more than 2 input tensors is not implemented yet.');\n }\n\n const allDims: string[] = [];\n for (let i = 0; i < outputString.length; ++i) {\n const dimName = outputString[i];\n if (!inputTerms.some(inputTerm => inputTerm.indexOf(dimName) !== -1)) {\n throw new Error(\n `Output subscripts contain the label ${dimName} ` +\n `not present in the input subscripts.`);\n }\n if (allDims.indexOf(dimName) === -1) {\n allDims.push(dimName);\n }\n }\n for (let i = 0; i < inputString.length; ++i) {\n const dimName = inputString[i];\n if (allDims.indexOf(dimName) === -1 && dimName !== COMMA) {\n allDims.push(dimName);\n }\n }\n\n const idDims: number[][] = new Array(inputTerms.length);\n for (let i = 0; i < numInputs; ++i) {\n if (new Set(inputTerms[i].split('')).size !== inputTerms[i].length) {\n throw new Error(\n `Found duplicate axes in input component ${inputTerms[i]}. ` +\n `Support for duplicate axes in input is not implemented yet.`);\n }\n idDims[i] = [];\n for (let j = 0; j < inputTerms[i].length; ++j) {\n idDims[i].push(allDims.indexOf(inputTerms[i][j]));\n }\n }\n\n const numDims = allDims.length; // Number of unique dimensions.\n const numOutDims = outputString.length; // Number of output dimensions.\n const summedDims: number[] = []; // Dimensions being summed over.\n for (let i = numOutDims; i < numDims; ++i) {\n summedDims.push(i);\n }\n return {allDims, summedDims, idDims};\n}\n\n/**\n * Get the permutation for a given input tensor.\n *\n * @param nDims Total number of dimension of all tensors involved in the einsum\n * operation.\n * @param idDims Dimension indices involve in the tensor in question.\n * @returns An object consisting of the following fields:\n * - permutationIndices: Indices to permute the axes of the tensor with.\n * - expandDims: Indices to the dimension that need to be expanded from the\n * tensor after permutation.\n */\nexport function getEinsumPermutation(nDims: number, idDims: number[]):\n {permutationIndices: number[], expandDims: number[]} {\n let permutationIndices: number[] = new Array(nDims);\n permutationIndices.fill(-1);\n for (let i = 0; i < idDims.length; ++i) {\n permutationIndices[idDims[i]] = i;\n }\n const expandDims: number[] = [];\n for (let i = 0; i < nDims; ++i) {\n if (permutationIndices[i] === -1) {\n expandDims.push(i);\n }\n }\n permutationIndices = permutationIndices.filter(d => d !== -1);\n return {permutationIndices, expandDims};\n}\n\n/**\n * Checks that the dimension sizes from different input tensors match the\n * equation.\n */\nexport function checkEinsumDimSizes(\n nDims: number, idDims: number[][], tensors: Tensor[]) {\n const dimSizes: number[] = new Array(nDims);\n for (let i = 0; i < tensors.length; ++i) {\n const shape: number[] = tensors[i].shape;\n for (let j = 0; j < idDims[i].length; ++j) {\n if (dimSizes[idDims[i][j]] === undefined) {\n dimSizes[idDims[i][j]] = shape[j];\n } else {\n assert(\n dimSizes[idDims[i][j]] === shape[j],\n () => `Expected dimension ${dimSizes[idDims[i][j]]} at axis ${j} ` +\n `of input shaped ${JSON.stringify(shape)}, ` +\n `but got dimension ${shape[j]}`);\n }\n }\n }\n}\n\n/**\n * Gets path of computation for einsum.\n *\n * @param summedDims indices to the dimensions being summed over.\n * @param idDims A look up table for the dimensions present in each input\n * tensor. Each consituent array contains indices for the dimensions in the\n * corresponding input tensor.\n *\n * @return A map with two fields:\n * - path: The path of computation, with each element indicating the dimension\n * being summed over after the element-wise multiplication in that step.\n * - steps: With the same length as `path`. Each element contains the indices\n * to the input tensors being used for element-wise multiplication in the\n * corresponding step.\n */\nexport function getEinsumComputePath(summedDims: number[], idDims: number[][]):\n {path: number[], steps: number[][]} {\n const path: number[] = summedDims;\n const steps: number[][] = [];\n let nSteps = 0;\n if (summedDims.length === 0) {\n // Einsum that involes no summing: e.g., transpose and outer product.\n path.push(-1);\n }\n nSteps = summedDims.length + 1;\n for (let i = 0; i < nSteps; ++i) {\n steps.push([]);\n }\n const computedTermIndices: number[] = [];\n for (let i = 0; i < path.length; ++i) {\n const summedDim = path[i];\n const termIndices = findTermsWithDim(idDims, summedDim);\n for (const termIndex of termIndices) {\n if (computedTermIndices.indexOf(termIndex) === -1) {\n steps[i].push(termIndex);\n computedTermIndices.push(termIndex);\n }\n }\n }\n return {path, steps};\n}\n\n/** Determines if an axes permutation is the identity permutation. */\nexport function isIdentityPermutation(perm: number[]): boolean {\n return perm.every((dim: number, index: number) => dim === index);\n}\n\nfunction findTermsWithDim(idDims: number[][], dim: number): number[] {\n const termIndices: number[] = [];\n for (let i = 0; i < idDims.length; ++i) {\n if (idDims[i].length === 0 || idDims[i].indexOf(dim) !== -1 || dim === -1) {\n termIndices.push(i);\n }\n }\n return termIndices;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {TensorInfo} from '../kernel_registry';\nimport {Tensor} from '../tensor';\nimport {assert} from '../util';\n\n/**\n * Prepare the split size array. When the input is a number, the axis is evenly\n * divided among the split size. When the input contains the negative value, the\n * rest of the axis is allocated toward that.\n */\nexport function prepareSplitSize(\n x: Tensor|TensorInfo, numOrSizeSplits: number[]|number,\n axis = 0): number[] {\n let splitSizes = [];\n if (typeof (numOrSizeSplits) === 'number') {\n assert(\n x.shape[axis] % numOrSizeSplits === 0,\n () => 'Number of splits must evenly divide the axis.');\n splitSizes =\n new Array(numOrSizeSplits).fill(x.shape[axis] / numOrSizeSplits);\n } else {\n const numOfNegs = numOrSizeSplits.reduce((count, value) => {\n if (value === -1) {\n count += 1;\n }\n return count;\n }, 0);\n assert(\n numOfNegs <= 1,\n () => 'There should be only one negative value in split array.');\n const negIndex = numOrSizeSplits.indexOf(-1);\n // Allow the number of split array to be -1, which indicates the rest\n // of dimension is allocated to that split.\n if (negIndex !== -1) {\n const total = numOrSizeSplits.reduce((a, b) => b > 0 ? a + b : a);\n numOrSizeSplits[negIndex] = x.shape[axis] - total;\n }\n assert(\n x.shape[axis] === numOrSizeSplits.reduce((a, b) => a + b),\n () => 'The sum of sizes must match the size of the axis dimension.');\n splitSizes = numOrSizeSplits;\n }\n\n return splitSizes;\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/**\n * Generates sparse fill empty rows indices, dense shape mismatch error message.\n *\n * @param indicesLength The first dimension of indices.\n */\nexport function getSparseFillEmptyRowsIndicesDenseShapeMismatch(\n indicesLength: number) {\n return `Received SparseTensor with denseShape[0] = 0 but\n indices.shape[0] = ${indicesLength}`;\n}\n\n/**\n * Generates sparse fill empty rows negative index error message.\n *\n * @param index The index with a negative value.\n * @param value The negative value.\n */\nexport function getSparseFillEmptyRowsNegativeIndexErrorMessage(\n index: number, value: number) {\n return `indices(${index}, 0) is invalid: ${value} < 0`;\n}\n\n/**\n * Generates sparse fill empty rows out of range index error message.\n *\n * @param index The index with an out of range value.\n * @param value The out of range value.\n * @param limit The upper limit for indices.\n */\nexport function getSparseFillEmptyRowsOutOfRangeIndexErrorMessage(\n index: number, value: number, limit: number) {\n return `indices(${index}, 0) is invalid: ${value} >= ${limit}`;\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {sizeFromShape} from '../../util';\n\n/**\n * Generates sparse reshape multiple negative 1 output dimension error message.\n *\n * @param dim1 The first dimension with a negative 1 value.\n * @param dim2 The second dimension with a negative 1 value.\n */\nexport function getSparseReshapeMultipleNegativeOneOutputDimErrorMessage(\n dim1: number, dim2: number) {\n return `only one output dimension may be -1, not both ${dim1} and ${dim2}`;\n}\n\n/**\n * Generates sparse reshape negative output dimension error message.\n *\n * @param dim The dimension with a negative value.\n * @param value The negative value.\n */\nexport function getSparseReshapeNegativeOutputDimErrorMessage(\n dim: number, value: number) {\n return `size ${dim} must be non-negative, not ${value}`;\n}\n\n/**\n * Generates sparse reshape empty tensor zero output dimension error message.\n *\n */\nexport function getSparseReshapeEmptyTensorZeroOutputDimErrorMessage() {\n return 'reshape cannot infer the missing input size for an empty tensor ' +\n 'unless all specified input sizes are non-zero';\n}\n\n/**\n * Generates sparse reshape input output multiple mismatch error message.\n *\n * @param inputShape the input shape.\n * @param outputShape the requested output shape.\n */\nexport function getSparseReshapeInputOutputMultipleErrorMessage(\n inputShape: number[], outputShape: number[]) {\n const inputSize = sizeFromShape(inputShape);\n const outputSize = sizeFromShape(outputShape);\n return `Input to reshape is a SparseTensor with ${inputSize}\n dense values, but the requested shape requires a multiple of ${\n outputSize}. inputShape=${inputShape} outputShape= ${outputShape}`;\n}\n\n/**\n * Generates sparse reshape input output inequality error message.\n *\n * @param inputShape the input shape.\n * @param outputShape the requested output shape.\n */\nexport function getSparseReshapeInputOutputMismatchErrorMessage(\n inputShape: number[], outputShape: number[]) {\n const inputSize = sizeFromShape(inputShape);\n const outputSize = sizeFromShape(outputShape);\n return `Input to reshape is a tensor with ${\n inputSize} dense values, but the requested shape has ${\n outputSize}. inputShape=${inputShape} outputShape=${outputShape}`;\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/**\n * Generates sparse segment reduction negative segment ids error message.\n *\n */\nexport function getSparseSegmentReductionNegativeSegmentIdsErrorMessage() {\n return `segment ids must be >= 0`;\n}\n\n/**\n * Generates sparse segment reduction non increasing segment ids error message.\n *\n */\nexport function getSparseSegmentReductionNonIncreasingSegmentIdsErrorMessage() {\n return `segment ids are not increasing`;\n}\n\n/**\n * Generates sparse segment reduction segment id out of range error message.\n *\n * @param segmentId The segment id index that is out of range.\n * @param outputRows Upper bound of valid segment id values.\n */\nexport function getSparseSegmentReductionSegmentIdOutOfRangeErrorMessage(\n segmentId: number, outputRows: number) {\n return `Segment id ${segmentId} out of range [0, ${\n outputRows}), possibly because segmentIds input is not sorted.`;\n}\n\n/**\n * Generates sparse segment reduction input indice out of range error message.\n *\n * @param index The index that holds the out of range value.\n * @param indexValue The value that is out of range.\n * @param inputRows Upper bound of valid index values.\n */\nexport function getSparseSegmentReductionIndicesOutOfRangeErrorMessage(\n index: number, indexValue: number, inputRows: number) {\n return `Bad: indices[${index}] == ${indexValue} out of range [0, ${\n inputRows})`;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {TensorInfo} from '../kernel_registry';\nimport {nearestDivisor} from '../util';\n\nimport {PARALLELIZE_THRESHOLD} from './reduce_util';\n\nexport interface SegOpInfo {\n windowSize: number;\n batchSize: number;\n inSize: number;\n numSegments: number;\n}\n\nexport function segOpComputeOptimalWindowSize(\n inSize: number, numSegments: number): number {\n let done = false;\n let res;\n\n if (inSize <= PARALLELIZE_THRESHOLD) {\n res = inSize;\n done = true;\n } else {\n res = nearestDivisor(inSize, Math.floor(Math.sqrt(inSize)));\n }\n\n while (!done) {\n if (res > numSegments || res === inSize) {\n done = true;\n } else {\n res = nearestDivisor(inSize, res + 1);\n }\n }\n return res;\n}\n\nexport function computeOutShape(\n aShape: number[], axis: number, numSegments: number): number[] {\n const outShape = [];\n const rank = aShape.length;\n for (let dim = 0; dim < rank; dim++) {\n if (dim !== axis) {\n outShape.push(aShape[dim]);\n } else {\n outShape.push(numSegments);\n }\n }\n return outShape;\n}\n\nexport interface GatherOpShapeInfo {\n batchSize: number;\n sliceSize: number;\n outerSize: number;\n dimSize: number;\n outputShape: number[];\n}\n\nexport function collectGatherOpShapeInfo(\n x: TensorInfo, indices: TensorInfo, axis: number,\n batchDims: number): GatherOpShapeInfo {\n const indicesRank = indices.shape.length;\n const xRank = x.shape.length;\n\n if (batchDims !== 0) {\n if (batchDims < -indicesRank || batchDims > indicesRank) {\n throw new Error(`Expect batchDims in the range of [-${indicesRank}, ${\n indicesRank}], but got ${batchDims}`);\n }\n }\n\n if (batchDims < 0) {\n batchDims += indicesRank;\n }\n\n if (batchDims > xRank) {\n throw new Error(`batchDims (${batchDims}) must be less than rank(x) (\n ${xRank}).`);\n }\n\n if (axis < batchDims) {\n throw new Error(`batchDims (${\n batchDims}) must be less than or equal to axis (${axis}).`);\n }\n\n for (let i = 0; i < batchDims; ++i) {\n if (x.shape[i] !== indices.shape[i]) {\n throw new Error(\n `x.shape[${i}]: ${x.shape[i]} should be equal to indices.shape[${\n i}]: ${indices.shape[i]}.`);\n }\n }\n const dimSize = x.shape[axis];\n\n const outputShape: number[] = [];\n let batchSize = 1;\n let outerSize = 1;\n let sliceSize = 1;\n\n for (let i = 0; i < batchDims; ++i) {\n outputShape.push(x.shape[i]);\n batchSize *= x.shape[i];\n }\n\n for (let i = batchDims; i < axis; i++) {\n outputShape.push(x.shape[i]);\n outerSize *= x.shape[i];\n }\n\n for (let i = batchDims; i < indicesRank; i++) {\n outputShape.push(indices.shape[i]);\n }\n\n for (let i = axis + 1; i < xRank; i++) {\n outputShape.push(x.shape[i]);\n sliceSize *= x.shape[i];\n }\n\n return {batchSize, sliceSize, outerSize, dimSize, outputShape};\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {decodeString, encodeString} from '../util';\n\n// Utilities needed by backend consumers of tf-core.\nexport * from '../ops/axis_util';\nexport * from '../ops/broadcast_util';\nexport * from '../ops/concat_util';\nexport * from '../ops/conv_util';\nexport * from '../ops/fused_util';\nexport * from '../ops/fused_types';\nexport * from '../ops/ragged_to_dense_util';\nexport * from '../ops/reduce_util';\n\nimport * as slice_util from '../ops/slice_util';\nexport {slice_util};\n\nexport {BackendValues, TypedArray, upcastType, PixelData} from '../types';\nexport {MemoryInfo, TimingInfo} from '../engine';\nexport * from '../ops/rotate_util';\nexport * from '../ops/array_ops_util';\nexport * from '../ops/gather_nd_util';\nexport * from '../ops/scatter_nd_util';\nexport * from '../ops/selu_util';\nexport * from '../ops/fused_util';\nexport * from '../ops/erf_util';\nexport * from '../log';\nexport * from '../backends/complex_util';\nexport * from '../backends/einsum_util';\nexport * from '../ops/split_util';\nexport * from '../ops/sparse/sparse_fill_empty_rows_util';\nexport * from '../ops/sparse/sparse_reshape_util';\nexport * from '../ops/sparse/sparse_segment_reduction_util';\n\nimport * as segment_util from '../ops/segment_util';\nexport {segment_util};\n\nexport function fromUint8ToStringArray(vals: Uint8Array[]) {\n try {\n // Decode the bytes into string.\n return vals.map(val => decodeString(val));\n } catch (err) {\n throw new Error(\n `Failed to decode encoded string bytes into utf-8, error: ${err}`);\n }\n}\n\nexport function fromStringArrayToUint8(strings: string[]) {\n return strings.map(s => encodeString(s));\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nexport {nonMaxSuppressionV3Impl, nonMaxSuppressionV4Impl, nonMaxSuppressionV5Impl} from './non_max_suppression_impl';\nexport {whereImpl} from './where_impl';\n","/**\n * @license\n * Copyright 2020 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// base.ts is tfjs-core without auto registration of things like flags,\n// gradients, chained ops or the opHandler. See base_side_effects.ts for parts\n// tfjs core that are required side effects.\n\n/**\n * @fileoverview\n * @suppress {partialAlias} Optimization disabled due to passing the module\n * object into a function below:\n *\n * import * as ops from './ops/ops';\n * setOpHandler(ops);\n */\n\n// Serialization.\nimport * as io from './io/io';\nimport * as math from './math';\nimport * as broadcast_util from './ops/broadcast_util';\nimport * as browser from './ops/browser';\nimport * as gather_util from './ops/gather_nd_util';\nimport * as scatter_util from './ops/scatter_nd_util';\nimport * as slice_util from './ops/slice_util';\nimport * as serialization from './serialization';\nimport * as tensor_util from './tensor_util';\nimport * as test_util from './test_util';\nimport * as util from './util';\nimport {version} from './version';\n\nexport {InferenceModel, MetaGraph, MetaGraphInfo, ModelPredictConfig, ModelTensorInfo, SavedModelTensorInfo, SignatureDef, SignatureDefEntry, SignatureDefInfo} from './model_types';\nexport {AdadeltaOptimizer} from './optimizers/adadelta_optimizer';\nexport {AdagradOptimizer} from './optimizers/adagrad_optimizer';\nexport {AdamOptimizer} from './optimizers/adam_optimizer';\nexport {AdamaxOptimizer} from './optimizers/adamax_optimizer';\nexport {MomentumOptimizer} from './optimizers/momentum_optimizer';\nexport {Optimizer} from './optimizers/optimizer';\n// Optimizers.\nexport {OptimizerConstructors} from './optimizers/optimizer_constructors';\nexport {RMSPropOptimizer} from './optimizers/rmsprop_optimizer';\nexport {SGDOptimizer} from './optimizers/sgd_optimizer';\nexport {DataToGPUOptions, DataToGPUWebGLOption, GPUData, Scalar, Tensor, Tensor1D, Tensor2D, Tensor3D, Tensor4D, Tensor5D, TensorBuffer, Variable} from './tensor';\nexport {GradSaveFunc, NamedTensorMap, TensorContainer, TensorContainerArray, TensorContainerObject} from './tensor_types';\nexport {BackendValues, DataType, DataTypeMap, DataValues, NumericDataType, PixelData, Rank, RecursiveArray, ScalarLike, ShapeMap, sumOutType, TensorLike, TypedArray, upcastType, WebGLData} from './types';\n\nexport * from './ops/ops';\nexport {Reduction} from './ops/loss_ops_utils';\n\nexport * from './train';\nexport * from './globals';\nexport * from './kernel_registry';\nexport {customGrad, grad, grads, valueAndGrad, valueAndGrads, variableGrads} from './gradients';\n\nexport {TimingInfo, MemoryInfo, ForwardFunc} from './engine';\nexport {Environment, env, ENV} from './environment';\nexport {Platform} from './platforms/platform';\n\nexport {version as version_core};\n\n// Top-level method exports.\nexport {nextFrame} from './browser_util';\n\n// Second level exports.\nimport * as backend_util from './backends/backend_util';\nimport * as device_util from './device_util';\nexport {\n browser,\n io,\n math,\n serialization,\n test_util,\n util,\n backend_util,\n broadcast_util,\n tensor_util,\n slice_util,\n gather_util,\n scatter_util,\n device_util\n};\n\nimport * as kernel_impls from './backends/kernel_impls';\nexport {kernel_impls};\n// Backend specific.\nexport {KernelBackend, BackendTimingInfo, DataMover, DataStorage} from './backends/backend';\n\n// Export all kernel names / info.\nexport * from './kernel_names';\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// Required side effectful code.\nimport './base_side_effects';\n// All exports from this package should be in base.\nexport * from './base';\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env} from '@tensorflow/tfjs-core';\n\nconst contexts: {[key: string]: WebGLRenderingContext} = {};\n\nconst WEBGL_ATTRIBUTES: WebGLContextAttributes = {\n alpha: false,\n antialias: false,\n premultipliedAlpha: false,\n preserveDrawingBuffer: false,\n depth: false,\n stencil: false,\n failIfMajorPerformanceCaveat: true\n};\n\nexport function clearWebGLContext(webGLVersion: number) {\n delete contexts[webGLVersion];\n}\n\nexport function setWebGLContext(\n webGLVersion: number, gl: WebGLRenderingContext) {\n contexts[webGLVersion] = gl;\n}\n\nexport function getWebGLContext(\n webGLVersion: number,\n customCanvas?: HTMLCanvasElement|OffscreenCanvas): WebGLRenderingContext {\n if (!(webGLVersion in contexts) || customCanvas != null) {\n const newCtx = getWebGLRenderingContext(webGLVersion, customCanvas);\n if (newCtx !== null) {\n contexts[webGLVersion] = newCtx;\n } else {\n console.log('Could not get context for WebGL version', webGLVersion);\n return null;\n }\n }\n const gl = contexts[webGLVersion];\n if (gl == null || gl.isContextLost()) {\n delete contexts[webGLVersion];\n return getWebGLContext(webGLVersion);\n }\n\n gl.disable(gl.DEPTH_TEST);\n gl.disable(gl.STENCIL_TEST);\n gl.disable(gl.BLEND);\n gl.disable(gl.DITHER);\n gl.disable(gl.POLYGON_OFFSET_FILL);\n gl.disable(gl.SAMPLE_COVERAGE);\n gl.enable(gl.SCISSOR_TEST);\n gl.enable(gl.CULL_FACE);\n gl.cullFace(gl.BACK);\n\n return contexts[webGLVersion];\n}\n\nfunction createCanvas(webGLVersion: number) {\n if (typeof OffscreenCanvas !== 'undefined' && webGLVersion === 2) {\n return new OffscreenCanvas(300, 150);\n } else if (typeof document !== 'undefined') {\n return document.createElement('canvas');\n } else {\n throw new Error('Cannot create a canvas in this context');\n }\n}\n\nfunction getWebGLRenderingContext(\n webGLVersion: number,\n customCanvas?: HTMLCanvasElement|OffscreenCanvas): WebGLRenderingContext {\n if (webGLVersion !== 1 && webGLVersion !== 2) {\n throw new Error('Cannot get WebGL rendering context, WebGL is disabled.');\n }\n const canvas =\n customCanvas == null ? createCanvas(webGLVersion) : customCanvas;\n\n canvas.addEventListener('webglcontextlost', (ev: Event) => {\n ev.preventDefault();\n delete contexts[webGLVersion];\n }, false);\n\n if (env().getBool('SOFTWARE_WEBGL_ENABLED')) {\n WEBGL_ATTRIBUTES.failIfMajorPerformanceCaveat = false;\n }\n\n if (webGLVersion === 1) {\n return (canvas.getContext('webgl', WEBGL_ATTRIBUTES) ||\n (canvas as HTMLCanvasElement)\n .getContext('experimental-webgl', WEBGL_ATTRIBUTES));\n }\n return canvas.getContext('webgl2', WEBGL_ATTRIBUTES) as WebGLRenderingContext;\n}\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, DataId, DataType, env, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nexport enum PackingScheme {\n /**\n * All values in a single texel are densely packed without any constraints.\n *\n * This is how the shader encodes a tensor with shape = [2, 3, 4]\n * (indices are [batch, row, col]).\n *\n * 000|001 010|011 020|021\n * ------- ------- -------\n * 002|003 012|013 022|023\n *\n * 100|101 110|111 120|121\n * ------- ------- -------\n * 102|103 112|113 122|123\n *\n */\n DENSE,\n\n /**\n * Single texels contain only values from the same batch, and from adjacent\n * rows and columns.\n *\n * This is how the shader encodes a tensor with shape = [2, 3, 5]\n * (indices are [batch, row, col]).\n *\n * 000|001 002|003 004|xxx 020|021 022|023 024|xxx\n * ------- ------- ------- ------- ------- -------\n * 010|011 012|013 014|xxx xxx|xxx xxx|xxx xxx|xxx\n *\n * 100|101 102|103 104|xxx 120|121 122|123 124|xxx\n * ------- ------- ------- ------- ------- -------\n * 110|111 112|113 114|xxx xxx|xxx xxx|xxx xxx|xxx\n *\n */\n SHARED_BATCH\n}\n\nexport enum TextureUsage {\n RENDER,\n UPLOAD,\n PIXELS,\n DOWNLOAD\n}\n\nexport enum PhysicalTextureType {\n UNPACKED_FLOAT16,\n UNPACKED_FLOAT32,\n PACKED_4X1_UNSIGNED_BYTE,\n PACKED_2X2_FLOAT32,\n PACKED_2X2_FLOAT16\n}\n\nexport interface Texture {\n texture: WebGLTexture;\n texShape: [number, number];\n}\nexport interface TextureData {\n // Required.\n shape: number[];\n dtype: DataType;\n\n // Optional.\n values?: backend_util.BackendValues;\n texture?: Texture;\n // For complex numbers, the real and imaginary parts are stored as their own\n // individual tensorInfos, with a parent joining the two with the\n // complexTensors field. When this is defined, texture will be null.\n complexTensorInfos?: {real: TensorInfo, imag: TensorInfo};\n /** [rows, columns] shape of the texture. */\n texShape?: [number, number];\n usage?: TextureUsage;\n isPacked?: boolean;\n\n refCount: number;\n\n // Available when the tensor has been sliced.\n slice?: {\n // Offset in the 'flat index' space.\n flatOffset: number;\n // Used for counting how many sliced tensors point to the same texture.\n origDataId: DataId;\n };\n}\n\nexport function getUnpackedMatrixTextureShapeWidthHeight(\n rows: number, columns: number): [number, number] {\n return [columns, rows];\n}\n\nexport function getUnpackedArraySizeFromMatrixSize(\n matrixSize: number, channelsPerTexture: number): number {\n return matrixSize * channelsPerTexture;\n}\n\nexport function getColorMatrixTextureShapeWidthHeight(\n rows: number, columns: number): [number, number] {\n return [columns * 4, rows];\n}\n\n/**\n * Get shape for densely packed RGBA texture.\n */\nexport function getDenseTexShape(shape: number[]): [number, number] {\n const size = util.sizeFromShape(shape);\n const texelsNeeded = Math.ceil(size / 4);\n return util.sizeToSquarishShape(texelsNeeded);\n}\n\nexport function getMatrixSizeFromUnpackedArraySize(\n unpackedSize: number, channelsPerTexture: number): number {\n if (unpackedSize % channelsPerTexture !== 0) {\n throw new Error(\n `unpackedSize (${unpackedSize}) must be a multiple of ` +\n `${channelsPerTexture}`);\n }\n return unpackedSize / channelsPerTexture;\n}\n\nexport function decodeMatrixFromUnpackedColorRGBAArray(\n unpackedArray: Float32Array, matrix: Float32Array, channels: number) {\n const requiredSize = unpackedArray.length * channels / 4;\n if (matrix.length < requiredSize) {\n throw new Error(\n `matrix length (${matrix.length}) must be >= ${requiredSize}`);\n }\n let dst = 0;\n for (let src = 0; src < unpackedArray.length; src += 4) {\n for (let c = 0; c < channels; c++) {\n matrix[dst++] = unpackedArray[src + c];\n }\n }\n}\n\nexport function getPackedMatrixTextureShapeWidthHeight(\n rows: number, columns: number): [number, number] {\n return [\n Math.max(1, Math.ceil(columns / 2)), Math.max(1, Math.ceil(rows / 2))\n ];\n}\n\nexport function getPackedRGBAArraySizeFromMatrixShape(\n rows: number, columns: number): number {\n const [w, h] = getPackedMatrixTextureShapeWidthHeight(rows, columns);\n return w * h * 4;\n}\n\nexport interface TextureConfig {\n internalFormatFloat: number;\n textureFormatFloat: number;\n internalFormatPackedHalfFloat: number;\n internalFormatHalfFloat: number;\n internalFormatPackedFloat: number;\n\n // The format to use during a gl.readPixels call.\n downloadTextureFormat: number;\n // How many channels need to be unpacked after a gl.readPixels call.\n downloadUnpackNumChannels: number;\n\n defaultNumChannels: number;\n textureTypeHalfFloat: number;\n textureTypeFloat: number;\n}\n\nexport function getTextureConfig(\n // tslint:disable-next-line:no-any\n gl: WebGLRenderingContext, textureHalfFloatExtension?: any): TextureConfig {\n // tslint:disable-next-line:no-any\n const glany = gl as any;\n\n let internalFormatFloat: number;\n let internalFormatHalfFloat: number;\n let internalFormatPackedHalfFloat: number;\n let internalFormatPackedFloat: number;\n let textureFormatFloat: number;\n\n let downloadTextureFormat: number;\n let downloadUnpackNumChannels: number;\n\n let defaultNumChannels: number;\n let textureTypeHalfFloat: number;\n let textureTypeFloat: number;\n\n if (env().getNumber('WEBGL_VERSION') === 2) {\n internalFormatFloat = glany.R32F;\n internalFormatHalfFloat = glany.R16F;\n internalFormatPackedHalfFloat = glany.RGBA16F;\n internalFormatPackedFloat = glany.RGBA32F;\n textureFormatFloat = glany.RED;\n downloadUnpackNumChannels = 4;\n defaultNumChannels = 1;\n textureTypeHalfFloat = glany.HALF_FLOAT;\n textureTypeFloat = glany.FLOAT;\n downloadTextureFormat = glany.RGBA8;\n } else {\n internalFormatFloat = gl.RGBA;\n internalFormatHalfFloat = gl.RGBA;\n internalFormatPackedHalfFloat = gl.RGBA;\n internalFormatPackedFloat = glany.RGBA;\n textureFormatFloat = gl.RGBA;\n downloadUnpackNumChannels = 4;\n defaultNumChannels = 4;\n textureTypeHalfFloat = textureHalfFloatExtension != null ?\n textureHalfFloatExtension.HALF_FLOAT_OES :\n null;\n textureTypeFloat = gl.FLOAT;\n downloadTextureFormat = gl.RGBA;\n }\n\n return {\n internalFormatFloat,\n internalFormatHalfFloat,\n internalFormatPackedHalfFloat,\n internalFormatPackedFloat,\n textureFormatFloat,\n downloadTextureFormat,\n downloadUnpackNumChannels,\n defaultNumChannels,\n textureTypeHalfFloat,\n textureTypeFloat\n };\n}\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {getWebGLContext} from './canvas_util';\nimport {getTextureConfig} from './tex_util';\n\nexport function callAndCheck(gl: WebGLRenderingContext, func: () => T): T {\n const returnValue = func();\n if (env().getBool('DEBUG')) {\n checkWebGLError(gl);\n }\n return returnValue;\n}\n\nfunction checkWebGLError(gl: WebGLRenderingContext) {\n const error = gl.getError();\n if (error !== gl.NO_ERROR) {\n throw new Error('WebGL Error: ' + getWebGLErrorMessage(gl, error));\n }\n}\n\n// https://en.wikipedia.org/wiki/Half-precision_floating-point_format\nconst MIN_FLOAT16 = 5.96e-8;\nconst MAX_FLOAT16 = 65504;\n\nexport function canBeRepresented(num: number): boolean {\n if (env().getBool('WEBGL_RENDER_FLOAT32_ENABLED') || num === 0 ||\n (MIN_FLOAT16 < Math.abs(num) && Math.abs(num) < MAX_FLOAT16)) {\n return true;\n }\n return false;\n}\n\nexport function getWebGLErrorMessage(\n gl: WebGLRenderingContext, status: number): string {\n switch (status) {\n case gl.NO_ERROR:\n return 'NO_ERROR';\n case gl.INVALID_ENUM:\n return 'INVALID_ENUM';\n case gl.INVALID_VALUE:\n return 'INVALID_VALUE';\n case gl.INVALID_OPERATION:\n return 'INVALID_OPERATION';\n case gl.INVALID_FRAMEBUFFER_OPERATION:\n return 'INVALID_FRAMEBUFFER_OPERATION';\n case gl.OUT_OF_MEMORY:\n return 'OUT_OF_MEMORY';\n case gl.CONTEXT_LOST_WEBGL:\n return 'CONTEXT_LOST_WEBGL';\n default:\n return `Unknown error code ${status}`;\n }\n}\n\nexport function getExtensionOrThrow(\n gl: WebGLRenderingContext, extensionName: string): {} {\n return throwIfNull<{}>(\n gl, () => gl.getExtension(extensionName),\n 'Extension \"' + extensionName + '\" not supported on this browser.');\n}\n\nexport function createVertexShader(\n gl: WebGLRenderingContext, vertexShaderSource: string): WebGLShader {\n const vertexShader: WebGLShader = throwIfNull(\n gl, () => gl.createShader(gl.VERTEX_SHADER),\n 'Unable to create vertex WebGLShader.');\n callAndCheck(gl, () => gl.shaderSource(vertexShader, vertexShaderSource));\n callAndCheck(gl, () => gl.compileShader(vertexShader));\n if (gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS) === false) {\n console.log(gl.getShaderInfoLog(vertexShader));\n throw new Error('Failed to compile vertex shader.');\n }\n return vertexShader;\n}\n\nexport function createFragmentShader(\n gl: WebGLRenderingContext, fragmentShaderSource: string): WebGLShader {\n const fragmentShader: WebGLShader = throwIfNull(\n gl, () => gl.createShader(gl.FRAGMENT_SHADER),\n 'Unable to create fragment WebGLShader.');\n callAndCheck(gl, () => gl.shaderSource(fragmentShader, fragmentShaderSource));\n callAndCheck(gl, () => gl.compileShader(fragmentShader));\n if (env().get('ENGINE_COMPILE_ONLY')) {\n return fragmentShader;\n }\n if (gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS) === false) {\n logShaderSourceAndInfoLog(\n fragmentShaderSource, gl.getShaderInfoLog(fragmentShader));\n throw new Error('Failed to compile fragment shader.');\n }\n return fragmentShader;\n}\n\nconst lineNumberRegex = /ERROR: [0-9]+:([0-9]+):/g;\nexport function logShaderSourceAndInfoLog(\n shaderSource: string, shaderInfoLog: string) {\n const lineNumberRegexResult = lineNumberRegex.exec(shaderInfoLog);\n if (lineNumberRegexResult == null) {\n console.log(`Couldn't parse line number in error: ${shaderInfoLog}`);\n console.log(shaderSource);\n return;\n }\n\n const lineNumber = +lineNumberRegexResult[1];\n\n const shaderLines = shaderSource.split('\\n');\n const pad = shaderLines.length.toString().length + 2;\n const linesWithLineNumbers = shaderLines.map(\n (line, lineNumber) =>\n util.rightPad((lineNumber + 1).toString(), pad) + line);\n let maxLineLength = 0;\n for (let i = 0; i < linesWithLineNumbers.length; i++) {\n maxLineLength = Math.max(linesWithLineNumbers[i].length, maxLineLength);\n }\n\n const beforeErrorLines = linesWithLineNumbers.slice(0, lineNumber - 1);\n const errorLine = linesWithLineNumbers.slice(lineNumber - 1, lineNumber);\n const afterErrorLines = linesWithLineNumbers.slice(lineNumber);\n\n console.log(beforeErrorLines.join('\\n'));\n console.log(shaderInfoLog.split('\\n')[0]);\n console.log(\n `%c ${util.rightPad(errorLine[0], maxLineLength)}`,\n 'border:1px solid red; background-color:#e3d2d2; color:#a61717');\n console.log(afterErrorLines.join('\\n'));\n}\n\nexport function createProgram(gl: WebGLRenderingContext): WebGLProgram {\n return throwIfNull(\n gl, () => gl.createProgram(), 'Unable to create WebGLProgram.');\n}\n\nexport function linkProgram(gl: WebGLRenderingContext, program: WebGLProgram) {\n callAndCheck(gl, () => gl.linkProgram(program));\n if (env().get('ENGINE_COMPILE_ONLY')) {\n return;\n }\n if (gl.getProgramParameter(program, gl.LINK_STATUS) === false) {\n console.log(gl.getProgramInfoLog(program));\n throw new Error('Failed to link vertex and fragment shaders.');\n }\n}\n\nexport function validateProgram(\n gl: WebGLRenderingContext, program: WebGLProgram) {\n callAndCheck(gl, () => gl.validateProgram(program));\n if (gl.getProgramParameter(program, gl.VALIDATE_STATUS) === false) {\n console.log(gl.getProgramInfoLog(program));\n throw new Error('Shader program validation failed.');\n }\n}\n\nexport function createStaticVertexBuffer(\n gl: WebGLRenderingContext, data: Float32Array): WebGLBuffer {\n const buffer: WebGLBuffer = throwIfNull(\n gl, () => gl.createBuffer(), 'Unable to create WebGLBuffer');\n callAndCheck(gl, () => gl.bindBuffer(gl.ARRAY_BUFFER, buffer));\n callAndCheck(gl, () => gl.bufferData(gl.ARRAY_BUFFER, data, gl.STATIC_DRAW));\n return buffer;\n}\n\nexport function createStaticIndexBuffer(\n gl: WebGLRenderingContext, data: Uint16Array): WebGLBuffer {\n const buffer: WebGLBuffer = throwIfNull(\n gl, () => gl.createBuffer(), 'Unable to create WebGLBuffer');\n callAndCheck(gl, () => gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, buffer));\n callAndCheck(\n gl, () => gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, data, gl.STATIC_DRAW));\n return buffer;\n}\n\nexport function getNumChannels(): number {\n if (env().getNumber('WEBGL_VERSION') === 2) {\n return 1;\n }\n return 4;\n}\n\nexport function createTexture(gl: WebGLRenderingContext): WebGLTexture {\n return throwIfNull(\n gl, () => gl.createTexture(), 'Unable to create WebGLTexture.');\n}\n\nexport function validateTextureSize(width: number, height: number) {\n const maxTextureSize = env().getNumber('WEBGL_MAX_TEXTURE_SIZE');\n if ((width <= 0) || (height <= 0)) {\n const requested = `[${width}x${height}]`;\n throw new Error('Requested texture size ' + requested + ' is invalid.');\n }\n if ((width > maxTextureSize) || (height > maxTextureSize)) {\n const requested = `[${width}x${height}]`;\n const max = `[${maxTextureSize}x${maxTextureSize}]`;\n throw new Error(\n 'Requested texture size ' + requested +\n ' greater than WebGL maximum on this browser / GPU ' + max + '.');\n }\n}\n\nexport function createFramebuffer(gl: WebGLRenderingContext): WebGLFramebuffer {\n return throwIfNull(\n gl, () => gl.createFramebuffer(), 'Unable to create WebGLFramebuffer.');\n}\n\nexport function bindVertexBufferToProgramAttribute(\n gl: WebGLRenderingContext, program: WebGLProgram, attribute: string,\n buffer: WebGLBuffer, arrayEntriesPerItem: number, itemStrideInBytes: number,\n itemOffsetInBytes: number): boolean {\n const loc = gl.getAttribLocation(program, attribute);\n if (loc === -1) {\n // The GPU compiler decided to strip out this attribute because it's unused,\n // thus no need to bind.\n return false;\n }\n callAndCheck(gl, () => gl.bindBuffer(gl.ARRAY_BUFFER, buffer));\n callAndCheck(\n gl,\n () => gl.vertexAttribPointer(\n loc, arrayEntriesPerItem, gl.FLOAT, false, itemStrideInBytes,\n itemOffsetInBytes));\n callAndCheck(gl, () => gl.enableVertexAttribArray(loc));\n return true;\n}\n\nexport function bindTextureUnit(\n gl: WebGLRenderingContext, texture: WebGLTexture, textureUnit: number) {\n validateTextureUnit(gl, textureUnit);\n callAndCheck(gl, () => gl.activeTexture(gl.TEXTURE0 + textureUnit));\n callAndCheck(gl, () => gl.bindTexture(gl.TEXTURE_2D, texture));\n}\n\nexport function unbindTextureUnit(\n gl: WebGLRenderingContext, textureUnit: number) {\n validateTextureUnit(gl, textureUnit);\n callAndCheck(gl, () => gl.activeTexture(gl.TEXTURE0 + textureUnit));\n callAndCheck(gl, () => gl.bindTexture(gl.TEXTURE_2D, null));\n}\n\nexport function getProgramUniformLocationOrThrow(\n gl: WebGLRenderingContext, program: WebGLProgram,\n uniformName: string): WebGLUniformLocation {\n return throwIfNull(\n gl, () => gl.getUniformLocation(program, uniformName),\n 'uniform \"' + uniformName + '\" not present in program.');\n}\n\nexport function getProgramUniformLocation(\n gl: WebGLRenderingContext, program: WebGLProgram,\n uniformName: string): WebGLUniformLocation {\n return gl.getUniformLocation(program, uniformName);\n}\n\nexport function bindTextureToProgramUniformSampler(\n gl: WebGLRenderingContext, texture: WebGLTexture,\n uniformSamplerLocation: WebGLUniformLocation, textureUnit: number) {\n callAndCheck(gl, () => bindTextureUnit(gl, texture, textureUnit));\n callAndCheck(gl, () => gl.uniform1i(uniformSamplerLocation, textureUnit));\n}\n\nexport function bindCanvasToFramebuffer(gl: WebGLRenderingContext) {\n callAndCheck(gl, () => gl.bindFramebuffer(gl.FRAMEBUFFER, null));\n callAndCheck(gl, () => gl.viewport(0, 0, gl.canvas.width, gl.canvas.height));\n callAndCheck(gl, () => gl.scissor(0, 0, gl.canvas.width, gl.canvas.height));\n}\n\nexport function bindColorTextureToFramebuffer(\n gl: WebGLRenderingContext, texture: WebGLTexture,\n framebuffer: WebGLFramebuffer) {\n callAndCheck(gl, () => gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer));\n callAndCheck(\n gl,\n () => gl.framebufferTexture2D(\n gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0));\n}\n\nexport function unbindColorTextureFromFramebuffer(\n gl: WebGLRenderingContext, framebuffer: WebGLFramebuffer) {\n callAndCheck(gl, () => gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer));\n callAndCheck(\n gl,\n () => gl.framebufferTexture2D(\n gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, null, 0));\n}\n\nexport function validateFramebuffer(gl: WebGLRenderingContext) {\n const status = gl.checkFramebufferStatus(gl.FRAMEBUFFER);\n if (status !== gl.FRAMEBUFFER_COMPLETE) {\n throw new Error(\n 'Error binding framebuffer: ' + getFramebufferErrorMessage(gl, status));\n }\n}\n\nexport function getFramebufferErrorMessage(\n gl: WebGLRenderingContext, status: number): string {\n switch (status) {\n case gl.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:\n return 'FRAMEBUFFER_INCOMPLETE_ATTACHMENT';\n case gl.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:\n return 'FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT';\n case gl.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:\n return 'FRAMEBUFFER_INCOMPLETE_DIMENSIONS';\n case gl.FRAMEBUFFER_UNSUPPORTED:\n return 'FRAMEBUFFER_UNSUPPORTED';\n default:\n return `unknown error ${status}`;\n }\n}\n\nfunction throwIfNull(\n gl: WebGLRenderingContext, returnTOrNull: () => T | null,\n failureMessage: string): T {\n const tOrNull: T|null = callAndCheck(gl, () => returnTOrNull());\n if (tOrNull == null) {\n throw new Error(failureMessage);\n }\n return tOrNull;\n}\n\nfunction validateTextureUnit(gl: WebGLRenderingContext, textureUnit: number) {\n const maxTextureUnit = gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS - 1;\n const glTextureUnit = textureUnit + gl.TEXTURE0;\n if (glTextureUnit < gl.TEXTURE0 || glTextureUnit > maxTextureUnit) {\n const textureUnitRange = `[gl.TEXTURE0, gl.TEXTURE${maxTextureUnit}]`;\n throw new Error(`textureUnit must be in ${textureUnitRange}.`);\n }\n}\n\nexport function getBatchDim(shape: number[], dimsToSkip = 2): number {\n return util.sizeFromShape(shape.slice(0, shape.length - dimsToSkip));\n}\n\nexport function getRowsCols(shape: number[]): [number, number] {\n if (shape.length === 0) {\n throw Error('Cannot get rows and columns of an empty shape array.');\n }\n\n return [\n shape.length > 1 ? shape[shape.length - 2] : 1, shape[shape.length - 1]\n ];\n}\n\nexport function getShapeAs3D(shape: number[]): [number, number, number] {\n let shapeAs3D: [number, number, number] = [1, 1, 1];\n const isScalar = shape.length === 0 || (shape.length === 1 && shape[0] === 1);\n if (!isScalar) {\n shapeAs3D =\n [getBatchDim(shape), ...getRowsCols(shape)] as [number, number, number];\n }\n return shapeAs3D;\n}\n\nexport function getTextureShapeFromLogicalShape(\n logShape: number[], isPacked = false): [number, number] {\n let maxTexSize = env().getNumber('WEBGL_MAX_TEXTURE_SIZE');\n let maxSizeForNarrowTex =\n env().getNumber('WEBGL_MAX_SIZE_FOR_NARROW_TEXTURE');\n if (maxSizeForNarrowTex === Infinity &&\n env().getBool('WEBGL_AUTO_SQUARIFY_NARROW_TEXTURE_SHAPE')) {\n maxSizeForNarrowTex = maxTexSize / 2;\n }\n\n if (isPacked) {\n maxTexSize = maxTexSize * 2;\n maxSizeForNarrowTex = maxSizeForNarrowTex * 2;\n\n // This logic ensures we accurately count the number of packed texels needed\n // to accommodate the tensor. We can only pack values in the same texel if\n // they are from adjacent pairs of rows/cols within the same batch. So if a\n // tensor has 3 rows, we pretend it has 4 rows in order to account for the\n // fact that the texels containing the third row are half empty.\n logShape = logShape.map(\n (d, i) => i >= logShape.length - 2 ?\n util.nearestLargerEven(logShape[i]) :\n logShape[i]);\n\n // Packed texture height is at least 2 (the channel height of a single\n // texel).\n if (logShape.length === 1) {\n logShape = [2, logShape[0]];\n }\n }\n\n // If logical shape is 2, we don't squeeze, since we want to match physical.\n if (logShape.length !== 2) {\n const squeezeResult = util.squeezeShape(logShape);\n logShape = squeezeResult.newShape;\n }\n\n let size = util.sizeFromShape(logShape);\n let textureShape: [number, number] = null;\n if (logShape.length <= 1 && size <= maxTexSize) {\n textureShape = [1, size];\n } else if (\n logShape.length === 2 && logShape[0] <= maxTexSize &&\n logShape[1] <= maxTexSize) {\n textureShape = logShape as [number, number];\n } else if (\n logShape.length === 3 && logShape[0] * logShape[1] <= maxTexSize &&\n logShape[2] <= maxTexSize) {\n textureShape = [logShape[0] * logShape[1], logShape[2]];\n } else if (\n logShape.length === 3 && logShape[0] <= maxTexSize &&\n logShape[1] * logShape[2] <= maxTexSize) {\n textureShape = [logShape[0], logShape[1] * logShape[2]];\n } else if (\n logShape.length === 4 &&\n logShape[0] * logShape[1] * logShape[2] <= maxTexSize &&\n logShape[3] <= maxTexSize) {\n textureShape = [logShape[0] * logShape[1] * logShape[2], logShape[3]];\n } else if (\n logShape.length === 4 && logShape[0] <= maxTexSize &&\n logShape[1] * logShape[2] * logShape[3] <= maxTexSize) {\n textureShape = [logShape[0], logShape[1] * logShape[2] * logShape[3]];\n }\n\n // true if one edge length is 1 (1 or 2, if packed), while another edge\n // length exceeds maxSizeForNarrowTex.\n const isLongNarrowTex = textureShape != null &&\n Math.max(...textureShape) > maxSizeForNarrowTex &&\n Math.min(...textureShape) <= (isPacked ? 2 : 1) &&\n Math.min(...textureShape) > 0;\n\n if (textureShape == null || isLongNarrowTex) {\n if (isPacked) {\n // For packed textures size equals the number of channels required to\n // accommodate the texture data. However in order to squarify such that\n // inner dimensions stay even, we rewrite size to equal the number of\n // texels. Then in the return statement we rehydrate the squarified\n // dimensions to channel units.\n\n const batchDim = getBatchDim(logShape);\n let rows = 2, cols = 2;\n if (logShape.length) {\n [rows, cols] = getRowsCols(logShape);\n }\n size = batchDim * (rows / 2) * (cols / 2);\n textureShape =\n util.sizeToSquarishShape(size).map(d => d * 2) as [number, number];\n } else {\n textureShape = util.sizeToSquarishShape(size);\n }\n }\n\n return textureShape;\n}\n\nfunction isEven(n: number): boolean {\n return n % 2 === 0;\n}\n\n/**\n * This determines whether reshaping a packed texture requires rearranging\n * the data within the texture, assuming 2x2 packing.\n */\nexport function isReshapeFree(shape1: number[], shape2: number[]): boolean {\n shape1 = shape1.slice(-2);\n shape2 = shape2.slice(-2);\n\n if (util.arraysEqual(shape1, shape2)) {\n return true;\n }\n\n if (!shape1.length || !shape2.length) { // One of the shapes is a scalar.\n return true;\n }\n\n if (shape1[0] === 0 || shape1[1] === 0 || shape2[0] === 0 ||\n shape2[1] === 0) {\n return true;\n }\n\n if (shape1.length !== shape2.length) { // One of the shapes is a vector.\n const shape1Cols = shape1.slice(-1)[0];\n const shape2Cols = shape2.slice(-1)[0];\n if (shape1Cols === shape2Cols) {\n return true;\n }\n\n if (isEven(shape1Cols) && isEven(shape2Cols) &&\n (shape1[0] === 1 || shape2[0] === 1)) {\n return true;\n }\n }\n return shape1[1] === shape2[1] && isEven(shape1[0]) && isEven(shape2[0]);\n}\n\n// We cache webgl params because the environment gets reset between\n// unit tests and we don't want to constantly query the WebGLContext for\n// MAX_TEXTURE_SIZE.\nlet MAX_TEXTURE_SIZE: number;\nlet MAX_TEXTURES_IN_SHADER: number;\n\nexport function getWebGLMaxTextureSize(webGLVersion: number): number {\n if (MAX_TEXTURE_SIZE == null) {\n const gl = getWebGLContext(webGLVersion);\n MAX_TEXTURE_SIZE = gl.getParameter(gl.MAX_TEXTURE_SIZE);\n }\n return MAX_TEXTURE_SIZE;\n}\n\nexport function resetMaxTextureSize() {\n MAX_TEXTURE_SIZE = null;\n}\nexport function resetMaxTexturesInShader() {\n MAX_TEXTURES_IN_SHADER = null;\n}\n\nexport function getMaxTexturesInShader(webGLVersion: number): number {\n if (MAX_TEXTURES_IN_SHADER == null) {\n const gl = getWebGLContext(webGLVersion);\n MAX_TEXTURES_IN_SHADER = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);\n }\n // We cap at 16 to avoid spurious runtime \"memory exhausted\" error.\n return Math.min(16, MAX_TEXTURES_IN_SHADER);\n}\n\nexport function getWebGLDisjointQueryTimerVersion(webGLVersion: number):\n number {\n if (webGLVersion === 0) {\n return 0;\n }\n\n let queryTimerVersion: number;\n const gl = getWebGLContext(webGLVersion);\n\n if (hasExtension(gl, 'EXT_disjoint_timer_query_webgl2') &&\n webGLVersion === 2) {\n queryTimerVersion = 2;\n } else if (hasExtension(gl, 'EXT_disjoint_timer_query')) {\n queryTimerVersion = 1;\n } else {\n queryTimerVersion = 0;\n }\n return queryTimerVersion;\n}\n\nexport function hasExtension(gl: WebGLRenderingContext, extensionName: string) {\n const ext = gl.getExtension(extensionName);\n return ext != null;\n}\n\nexport function isWebGLVersionEnabled(webGLVersion: 1|2) {\n try {\n const gl = getWebGLContext(webGLVersion);\n if (gl != null) {\n return true;\n }\n } catch (e) {\n console.log('Error when getting WebGL context: ', e);\n return false;\n }\n return false;\n}\n\nexport function isCapableOfRenderingToFloatTexture(webGLVersion: number):\n boolean {\n if (webGLVersion === 0) {\n return false;\n }\n\n const gl = getWebGLContext(webGLVersion);\n\n if (webGLVersion === 1) {\n if (!hasExtension(gl, 'OES_texture_float')) {\n return false;\n }\n } else {\n if (!hasExtension(gl, 'EXT_color_buffer_float')) {\n return false;\n }\n }\n\n const isFrameBufferComplete = createFloatTextureAndBindToFramebuffer(gl);\n return isFrameBufferComplete;\n}\n\n/**\n * Check if we can download values from a float/half-float texture.\n *\n * Note that for performance reasons we use binding a texture to a framebuffer\n * as a proxy for ability to download float values later using readPixels. The\n * texture params of this texture will not match those in readPixels exactly\n * but if we are unable to bind some kind of float texture to the frameBuffer\n * then we definitely will not be able to read float values from it.\n */\nexport function isDownloadFloatTextureEnabled(webGLVersion: number): boolean {\n if (webGLVersion === 0) {\n return false;\n }\n\n const gl = getWebGLContext(webGLVersion);\n\n if (webGLVersion === 1) {\n if (!hasExtension(gl, 'OES_texture_float')) {\n return false;\n }\n if (!hasExtension(gl, 'WEBGL_color_buffer_float')) {\n return false;\n }\n } else {\n if (hasExtension(gl, 'EXT_color_buffer_float')) {\n return createFloatTextureAndBindToFramebuffer(gl);\n }\n\n const COLOR_BUFFER_HALF_FLOAT = 'EXT_color_buffer_half_float';\n if (hasExtension(gl, COLOR_BUFFER_HALF_FLOAT)) {\n const textureHalfFloatExtension =\n gl.getExtension(COLOR_BUFFER_HALF_FLOAT);\n return createHalfFloatTextureAndBindToFramebuffer(\n gl, textureHalfFloatExtension);\n }\n\n return false;\n }\n\n const isFrameBufferComplete = createFloatTextureAndBindToFramebuffer(gl);\n return isFrameBufferComplete;\n}\n\nfunction createFloatTextureAndBindToFramebuffer(gl: WebGLRenderingContext):\n boolean {\n const texConfig = getTextureConfig(gl);\n\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n\n const width = 1;\n const height = 1;\n gl.texImage2D(\n gl.TEXTURE_2D, 0, texConfig.internalFormatFloat, width, height, 0,\n texConfig.textureFormatFloat, texConfig.textureTypeFloat, null);\n\n const frameBuffer = gl.createFramebuffer();\n gl.bindFramebuffer(gl.FRAMEBUFFER, frameBuffer);\n gl.framebufferTexture2D(\n gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);\n\n const isFrameBufferComplete =\n gl.checkFramebufferStatus(gl.FRAMEBUFFER) === gl.FRAMEBUFFER_COMPLETE;\n\n gl.bindTexture(gl.TEXTURE_2D, null);\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n gl.deleteTexture(texture);\n gl.deleteFramebuffer(frameBuffer);\n\n return isFrameBufferComplete;\n}\n\nfunction createHalfFloatTextureAndBindToFramebuffer(\n // tslint:disable-next-line:no-any\n gl: WebGLRenderingContext, textureHalfFloatExtension: any): boolean {\n const texConfig = getTextureConfig(gl, textureHalfFloatExtension);\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n\n const width = 1;\n const height = 1;\n gl.texImage2D(\n gl.TEXTURE_2D, 0, texConfig.internalFormatHalfFloat, width, height, 0,\n texConfig.textureFormatFloat, texConfig.textureTypeHalfFloat, null);\n\n const frameBuffer = gl.createFramebuffer();\n gl.bindFramebuffer(gl.FRAMEBUFFER, frameBuffer);\n gl.framebufferTexture2D(\n gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);\n\n const isFrameBufferComplete =\n gl.checkFramebufferStatus(gl.FRAMEBUFFER) === gl.FRAMEBUFFER_COMPLETE;\n\n gl.bindTexture(gl.TEXTURE_2D, null);\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n gl.deleteTexture(texture);\n gl.deleteFramebuffer(frameBuffer);\n\n return isFrameBufferComplete;\n}\n\nexport function isWebGLFenceEnabled(webGLVersion: number) {\n if (webGLVersion !== 2) {\n return false;\n }\n const gl = getWebGLContext(webGLVersion);\n\n // tslint:disable-next-line:no-any\n const isEnabled = (gl as any).fenceSync != null;\n return isEnabled;\n}\n\nexport function assertNotComplex(\n tensor: TensorInfo|TensorInfo[], opName: string): void {\n if (!Array.isArray(tensor)) {\n tensor = [tensor];\n }\n tensor.forEach(t => {\n if (t != null) {\n util.assert(\n t.dtype !== 'complex64',\n () => `${opName} does not support complex64 tensors ` +\n 'in the WebGL backend.');\n }\n });\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {device_util, env} from '@tensorflow/tfjs-core';\n\nimport {getMaxTexturesInShader, getWebGLDisjointQueryTimerVersion, getWebGLMaxTextureSize, isCapableOfRenderingToFloatTexture, isDownloadFloatTextureEnabled, isWebGLFenceEnabled, isWebGLVersionEnabled} from './webgl_util';\n\nconst ENV = env();\n\n/**\n * This file contains WebGL-specific flag registrations.\n */\n\n/**\n * True if WebGL is supported.\n */\nENV.registerFlag('HAS_WEBGL', () => ENV.getNumber('WEBGL_VERSION') > 0);\n\n/** 0: No WebGL, 1: WebGL 1.0, 2: WebGL 2.0. */\nENV.registerFlag('WEBGL_VERSION', () => {\n if (isWebGLVersionEnabled(2)) {\n return 2;\n } else if (isWebGLVersionEnabled(1)) {\n return 1;\n }\n return 0;\n});\n\n/** Whether to check for numerical representation problems. */\nENV.registerFlag('WEBGL_CHECK_NUMERICAL_PROBLEMS', () => false);\n\nENV.registerFlag(\n 'WEBGL_BUFFER_SUPPORTED', () => ENV.get('WEBGL_VERSION') === 2);\n\n/** Whether the WebGL backend will sometimes forward ops to the CPU. */\nENV.registerFlag('WEBGL_CPU_FORWARD', () => true);\n\n/** Whether the WebGL backend will always use f16 textures for rendering. */\nENV.registerFlag('WEBGL_FORCE_F16_TEXTURES', () => false);\n\n/** Whether to turn all packing related flags on. */\nENV.registerFlag('WEBGL_PACK', () => ENV.getBool('HAS_WEBGL'));\n\n/** Whether we will pack the batchnormalization op. */\nENV.registerFlag('WEBGL_PACK_NORMALIZATION', () => ENV.getBool('WEBGL_PACK'));\n\n/** Whether we will pack the clip op. */\nENV.registerFlag('WEBGL_PACK_CLIP', () => ENV.getBool('WEBGL_PACK'));\n\n/** Whether we will pack the depthwise conv op. */\nENV.registerFlag('WEBGL_PACK_DEPTHWISECONV', () => ENV.getBool('WEBGL_PACK'));\n\n/** Whether we will pack binary ops. */\nENV.registerFlag(\n 'WEBGL_PACK_BINARY_OPERATIONS', () => ENV.getBool('WEBGL_PACK'));\n\n/** Whether we will pack unary ops. */\nENV.registerFlag(\n 'WEBGL_PACK_UNARY_OPERATIONS', () => ENV.getBool('WEBGL_PACK'));\n\n/** Whether we will pack array ops. */\nENV.registerFlag(\n 'WEBGL_PACK_ARRAY_OPERATIONS', () => ENV.getBool('WEBGL_PACK'));\n\n/** Whether we will pack image ops. */\nENV.registerFlag(\n 'WEBGL_PACK_IMAGE_OPERATIONS', () => ENV.getBool('WEBGL_PACK'));\n\n/** Whether we will pack reduce ops. */\nENV.registerFlag('WEBGL_PACK_REDUCE', () => ENV.getBool('WEBGL_PACK'));\n\n/** Whether packed WebGL kernels lazily unpack their outputs. */\nENV.registerFlag('WEBGL_LAZILY_UNPACK', () => ENV.getBool('WEBGL_PACK'));\n\n/** Whether we will use the im2col algorithm to speed up convolutions. */\nENV.registerFlag('WEBGL_CONV_IM2COL', () => ENV.getBool('WEBGL_PACK'));\n\n/** The maximum texture dimension. */\nENV.registerFlag(\n 'WEBGL_MAX_TEXTURE_SIZE',\n () => getWebGLMaxTextureSize(ENV.getNumber('WEBGL_VERSION')));\n\n/** The maximum texture dimension. */\nENV.registerFlag(\n 'WEBGL_MAX_TEXTURES_IN_SHADER',\n () => getMaxTexturesInShader(ENV.getNumber('WEBGL_VERSION')));\n\n/**\n * The disjoint_query_timer extension version.\n * 0: disabled, 1: EXT_disjoint_timer_query, 2:\n * EXT_disjoint_timer_query_webgl2.\n * In Firefox with WebGL 2.0,\n * EXT_disjoint_timer_query_webgl2 is not available, so we must use the\n * WebGL 1.0 extension.\n */\nENV.registerFlag('WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION', () => {\n const webGLVersion = ENV.getNumber('WEBGL_VERSION');\n\n if (webGLVersion === 0) {\n return 0;\n }\n return getWebGLDisjointQueryTimerVersion(webGLVersion);\n});\n\n/**\n * Whether the timer object from the disjoint_query_timer extension gives\n * timing information that is reliable.\n */\nENV.registerFlag(\n 'WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE',\n () => ENV.getNumber('WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION') > 0 &&\n !device_util.isMobile());\n\n/**\n * Whether the device is physically capable of rendering to float32 textures.\n */\nENV.registerFlag(\n 'WEBGL_RENDER_FLOAT32_CAPABLE',\n () => isCapableOfRenderingToFloatTexture(ENV.getNumber('WEBGL_VERSION')));\n\n/**\n * Whether rendering to float32 textures is enabled. If disabled, renders to\n * float16 textures.\n */\nENV.registerFlag('WEBGL_RENDER_FLOAT32_ENABLED', () => {\n return ENV.getBool('WEBGL_FORCE_F16_TEXTURES') ?\n false :\n ENV.getBool('WEBGL_RENDER_FLOAT32_CAPABLE');\n});\n\n/**\n * Whether downloading float textures is enabled (16 or 32 bit). If disabled,\n * uses IEEE 754 encoding of the float32 values to 4 uint8 when downloading.\n */\nENV.registerFlag(\n 'WEBGL_DOWNLOAD_FLOAT_ENABLED',\n () => isDownloadFloatTextureEnabled(ENV.getNumber('WEBGL_VERSION')));\n\n/** Whether the fence API is available. */\nENV.registerFlag(\n 'WEBGL_FENCE_API_ENABLED',\n () => isWebGLFenceEnabled(ENV.getNumber('WEBGL_VERSION')));\n\n/**\n * Tensors with size <= than this will be uploaded as uniforms, not textures.\n */\nENV.registerFlag('WEBGL_SIZE_UPLOAD_UNIFORM', () => {\n // Use uniform uploads only when 32bit floats are supported. In\n // 16bit\n // environments there are problems with comparing a 16bit texture value\n // with a 32bit uniform value.\n const useUniforms = ENV.getBool('WEBGL_RENDER_FLOAT32_ENABLED');\n return useUniforms ? 4 : 0;\n});\n\n/**\n * If the total number of bytes allocated on the GPU is greater than this\n * number, we will aggressively delete textures upon disposal with\n * gl.deleteMatrixTexture, rather than making them available for reuse.\n *\n * Default value -1 indicates that we will never aggressively delete textures.\n */\nENV.registerFlag(\n 'WEBGL_DELETE_TEXTURE_THRESHOLD',\n () => {\n return -1;\n },\n threshold => {\n if (threshold < 0 && threshold !== -1) {\n throw new Error(\n `WEBGL_DELETE_TEXTURE_THRESHOLD must be -1 (indicating never ` +\n `delete) or at least 0, but got ${threshold}.`);\n }\n });\n\n/**\n * Trigger a manual GL command flush if the threshold of time has passed since\n * previous Kernel execution. This can be useful for Andorid device where GL\n * command flush are delayed un til the end of javascript task. This value is\n * measured in millisecond. Typically you want to set this value to close to 1.\n *\n * Default value 1 for mobile chrome, and -1 for rest cases. -1 indicates that\n * we will not enforce manual flush and depend on system default flush schedule.\n */\nENV.registerFlag(\n 'WEBGL_FLUSH_THRESHOLD',\n () => {\n return device_util.isMobile() ? 1 : -1;\n },\n threshold => {\n if (threshold < 0 && threshold !== -1) {\n throw new Error(\n `WEBGL_FLUSH_THRESHOLD must be -1 (indicating never ` +\n `manual flush) or at least 0, but got ${threshold}.`);\n }\n });\n\n/**\n * Threshold for input tensor size that determines whether WebGL backend will\n * delegate computation to CPU.\n *\n * Default value is 128.\n */\nENV.registerFlag('CPU_HANDOFF_SIZE_THRESHOLD', () => 128);\n\n/** Whether we will use shapes uniforms. */\nENV.registerFlag('WEBGL_USE_SHAPES_UNIFORMS', () => false);\n\n/**\n * Threshold for last dimension of input tensor that determines whether\n * WebGL backend for the Top K op will delegate computation to CPU. If input\n * is smaller than threshold then CPU will be used\n *\n * Default value is 100000.\n */\nENV.registerFlag('TOPK_LAST_DIM_CPU_HANDOFF_SIZE_THRESHOLD', () => 100000);\n\n/**\n * Threshold for K that determines whether\n * WebGL backend for the Top K op will delegate computation to CPU. If k\n * is larger than threshold then CPU will be used\n *\n * Default value is 128.\n */\nENV.registerFlag('TOPK_K_CPU_HANDOFF_THRESHOLD', () => 128);\n\n/** Whether we will use the experimental conv op. */\nENV.registerFlag('WEBGL_EXP_CONV', () => false);\n\n/**\n * If the device performance is low or if no hardware GPU is available, whether\n * software WebGL will be used.\n */\nENV.registerFlag('SOFTWARE_WEBGL_ENABLED', () => ENV.getBool('IS_TEST'));\n\n/**\n * For narrow texture (physical height or physical width is 1), if the length of\n * any texture edges exceed the threshold, the texture will be reshaped to be\n * more squarish.\n *\n * This flag is used to help some GPUs that could not provide correct\n * interpolations for long skinny triangles. We found Mali GPU probably has this\n * problem: https://github.com/tensorflow/tfjs/issues/6775.\n */\nENV.registerFlag('WEBGL_MAX_SIZE_FOR_NARROW_TEXTURE', () => Infinity);\n\n/**\n * If the flag is set to true, the max size of the narrow texture will be auto\n * computed and it will be considerred as a threshold to reshape the narrow\n * texture to be more squarish.\n *\n * This flag is used to help some GPUs that could not provide correct\n * interpolations for long skinny triangles. We found Mali GPU probably has this\n * problem: https://github.com/tensorflow/tfjs/issues/6775.\n */\nENV.registerFlag('WEBGL_AUTO_SQUARIFY_NARROW_TEXTURE_SHAPE', () => false);\n\n/**\n * Whether to use the customized isnan. It's only useful for webgl2 since webgl1\n * doesn't have the builtin isnan.\n */\nENV.registerFlag('WEBGL2_ISNAN_CUSTOM', () => false);\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {env} from '@tensorflow/tfjs-core';\n\nexport type GLSL = {\n version: string,\n attribute: string,\n varyingVs: string,\n varyingFs: string,\n texture2D: string,\n output: string,\n defineOutput: string,\n defineSpecialNaN: string,\n defineSpecialInf: string,\n defineRound: string\n};\n\nexport function getGlslDifferences(): GLSL {\n let version: string;\n let attribute: string;\n let varyingVs: string;\n let varyingFs: string;\n let texture2D: string;\n let output: string;\n let defineOutput: string;\n let defineSpecialNaN: string;\n let defineSpecialInf: string;\n let defineRound: string;\n\n if (env().getNumber('WEBGL_VERSION') === 2) {\n version = '#version 300 es';\n attribute = 'in';\n varyingVs = 'out';\n varyingFs = 'in';\n texture2D = 'texture';\n output = 'outputColor';\n defineOutput = 'out vec4 outputColor;';\n\n // Use custom isnan definition to work across differences between\n // implementations on various platforms. While this should happen in ANGLE\n // we still see differences between android and windows (on chrome) when\n // using isnan directly. Since WebGL2 supports uint type and\n // floatBitsToUinT built-in function, we could implment isnan following\n // IEEE 754 rules.\n // NaN defination in IEEE 754-1985 is :\n // - sign = either 0 or 1.\n // - biased exponent = all 1 bits.\n // - fraction = anything except all 0 bits (since all 0 bits represents\n // infinity).\n // https://en.wikipedia.org/wiki/IEEE_754-1985#Representation_of_non-numbers\n defineSpecialNaN = env().getBool('WEBGL2_ISNAN_CUSTOM') ? `\n bool isnan_custom(float val) {\n uint floatToUint = floatBitsToUint(val);\n return (floatToUint & 0x7fffffffu) > 0x7f800000u;\n }\n\n bvec4 isnan_custom(vec4 val) {\n return bvec4(isnan_custom(val.x),\n isnan_custom(val.y), isnan_custom(val.z), isnan_custom(val.w));\n }\n\n #define isnan(value) isnan_custom(value)\n ` :\n '';\n // In webgl 2 we do not need to specify a custom isinf so there is no\n // need for a special INFINITY constant.\n defineSpecialInf = ``;\n defineRound = `\n #define round(value) newRound(value)\n int newRound(float value) {\n return int(floor(value + 0.5));\n }\n\n ivec4 newRound(vec4 value) {\n return ivec4(floor(value + vec4(0.5)));\n }\n `;\n } else {\n version = '';\n attribute = 'attribute';\n varyingVs = 'varying';\n varyingFs = 'varying';\n texture2D = 'texture2D';\n output = 'gl_FragColor';\n defineOutput = '';\n // WebGL1 has no built in isnan so we define one here.\n defineSpecialNaN = `\n #define isnan(value) isnan_custom(value)\n bool isnan_custom(float val) {\n return (val > 0. || val < 1. || val == 0.) ? false : true;\n }\n bvec4 isnan_custom(vec4 val) {\n return bvec4(isnan(val.x), isnan(val.y), isnan(val.z), isnan(val.w));\n }\n `;\n defineSpecialInf = `\n uniform float INFINITY;\n\n bool isinf(float val) {\n return abs(val) == INFINITY;\n }\n bvec4 isinf(vec4 val) {\n return equal(abs(val), vec4(INFINITY));\n }\n `;\n defineRound = `\n int round(float value) {\n return int(floor(value + 0.5));\n }\n\n ivec4 round(vec4 value) {\n return ivec4(floor(value + vec4(0.5)));\n }\n `;\n }\n\n return {\n version,\n attribute,\n varyingVs,\n varyingFs,\n texture2D,\n output,\n defineOutput,\n defineSpecialNaN,\n defineSpecialInf,\n defineRound\n };\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {util} from '@tensorflow/tfjs-core';\n\n/**\n * Produces GLSL code that derives logical coordinates from a flat\n * index. The code performs integer division with each stride and decrements\n * the index until the index equals the final dimension coordinate.\n */\nexport function getLogicalCoordinatesFromFlatIndex(\n coords: string[], shape: number[], index = 'index'): string {\n const strides = util.computeStrides(shape);\n return strides\n .map((stride, i) => {\n const line1 = `int ${coords[i]} = ${index} / ${stride}`;\n const line2 = i === strides.length - 1 ?\n `int ${coords[i + 1]} = ${index} - ${coords[i]} * ${stride}` :\n `index -= ${coords[i]} * ${stride}`;\n return `${line1}; ${line2};`;\n })\n .join('');\n}\n\nexport function getOutputLogicalCoordinatesFromFlatIndexByUniform(\n coords: string[], shape: number[], index = 'index'): string {\n const strides = util.computeStrides(shape);\n return strides\n .map((_, i) => {\n const line1 = `int ${coords[i]} = ${index} / outShapeStrides[${i}]`;\n const line2 = i === strides.length - 1 ?\n `int ${coords[i + 1]} = ${index} - ${coords[i]} * outShapeStrides[${\n i}]` :\n `index -= ${coords[i]} * outShapeStrides[${i}]`;\n return `${line1}; ${line2};`;\n })\n .join('');\n}\n\n// Produces GLSL code that computes strides.\nfunction symbolicallyComputeStrides(\n indicesArr: number[], variableName: string): string[] {\n const numCoords = indicesArr.length;\n const shape = indicesArr.map(d => `${variableName}[${d}]`);\n const strides = new Array(numCoords - 1);\n strides[numCoords - 2] = shape[numCoords - 1];\n for (let i = numCoords - 3; i >= 0; --i) {\n strides[i] = `(${strides[i + 1]} * ${shape[i + 1]})`;\n }\n\n return strides;\n}\n\nexport function getLogicalCoordinatesFromFlatIndexByUniform(\n coords: string[], variableName: string, index = 'index'): string {\n const indicesArray = coords.map((_, i) => i);\n const strides = symbolicallyComputeStrides(indicesArray, variableName);\n return strides\n .map((_, i) => {\n const line1 = `int ${coords[i]} = ${index} / ${strides[i]}`;\n const line2 = i === strides.length - 1 ?\n `int ${coords[i + 1]} = ${index} - ${coords[i]} * ${strides[i]}` :\n `index -= ${coords[i]} * ${strides[i]}`;\n return `${line1}; ${line2};`;\n })\n .join('');\n}\n\nfunction buildVec(x: string[]): string {\n if (x.length === 1) {\n return `${x[0]}`;\n }\n return `vec${x.length}(${x.join(',')})`;\n}\n\n/**\n * Produces GLSL code that computes the dot product of the input x and y\n * vectors. Handles splitting inputs into increments of vec4s when necessary.\n */\nexport function dotify(x: string[], y: string[]): string {\n if (x.length !== y.length) {\n throw new Error(\n `Vectors to be dotted must be of the same length -` +\n `got ${x.length} and ${y.length}`);\n }\n\n const slices: string[] = [];\n const nearestVec4 = Math.floor(x.length / 4);\n const nearestVec4Remainder = x.length % 4;\n\n for (let i = 0; i < nearestVec4; i++) {\n const xSlice = x.slice(i * 4, i * 4 + 4);\n const ySlice = y.slice(i * 4, i * 4 + 4);\n slices.push(`${buildVec(xSlice)}, ${buildVec(ySlice)}`);\n }\n\n if (nearestVec4Remainder !== 0) {\n let xSlice = x.slice(nearestVec4 * 4);\n let ySlice = y.slice(nearestVec4 * 4);\n if (xSlice.length === 1) {\n xSlice = xSlice.map(d => `float(${d})`);\n ySlice = ySlice.map(d => `float(${d})`);\n }\n slices.push(`${buildVec(xSlice)}, ${buildVec(ySlice)}`);\n }\n\n return slices.map((d, i) => `dot(${d})`).join('+');\n}\n\n/**\n * Produces GLSL that computes the flat index from 3D coordinates.\n */\nexport function getFlatIndexFrom3D(shape: [number, number, number]): string {\n const strides = util.computeStrides(shape).map(d => d.toString());\n\n return `\n int getFlatIndex(ivec3 coords) {\n return coords.x * ${strides[0]} + coords.y * ${strides[1]} + coords.z;\n }\n`;\n}\n\nexport function getFlatIndexFrom3DOutput(): string {\n return `\n int getFlatIndex(ivec3 coords) {\n return coords.x * outShapeStrides[0] + coords.y * outShapeStrides[1] + coords.z;\n }\n`;\n}\n\nexport const ENCODE_FLOAT_SNIPPET = `\n const float FLOAT_MAX = 1.70141184e38;\n const float FLOAT_MIN = 1.17549435e-38;\n\n lowp vec4 encode_float(highp float v) {\n if (isnan(v)) {\n return vec4(255, 255, 255, 255);\n }\n\n highp float av = abs(v);\n\n if(av < FLOAT_MIN) {\n return vec4(0.0, 0.0, 0.0, 0.0);\n } else if(v > FLOAT_MAX) {\n return vec4(0.0, 0.0, 128.0, 127.0) / 255.0;\n } else if(v < -FLOAT_MAX) {\n return vec4(0.0, 0.0, 128.0, 255.0) / 255.0;\n }\n\n highp vec4 c = vec4(0,0,0,0);\n\n highp float e = floor(log2(av));\n highp float m = exp2(fract(log2(av))) - 1.0;\n\n c[2] = floor(128.0 * m);\n m -= c[2] / 128.0;\n c[1] = floor(32768.0 * m);\n m -= c[1] / 32768.0;\n c[0] = floor(8388608.0 * m);\n\n highp float ebias = e + 127.0;\n c[3] = floor(ebias / 2.0);\n ebias -= c[3] * 2.0;\n c[2] += floor(ebias) * 128.0;\n\n c[3] += 128.0 * step(0.0, -v);\n\n return c / 255.0;\n }\n`;\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// Please make sure the shaker key in makeShaderKey in gpgpu_math.ts is well\n// mapped if any shader source code is changed in this file.\n\nimport {backend_util, util} from '@tensorflow/tfjs-core';\nconst {getBroadcastDims} = backend_util;\nimport {getGlslDifferences, GLSL} from './glsl_version';\nimport * as shader_util from './shader_compiler_util';\n\nexport type ShapeInfo = {\n logicalShape: number[],\n texShape: [number, number],\n isUniform: boolean,\n isPacked: boolean,\n flatOffset: number\n};\n\nexport type InputInfo = {\n name: string,\n shapeInfo: ShapeInfo\n};\n\nexport type UniformType =\n 'float'|'vec2'|'vec3'|'vec4'|'int'|'ivec2'|'ivec3'|'ivec4';\n\ninterface ProgramParams {\n userCode: string;\n enableShapeUniforms?: boolean;\n packedInputs?: boolean;\n customUniforms?:\n Array<{name: string; arrayIndex?: number; type: UniformType;}>;\n}\n\nexport function makeShader(\n inputsInfo: InputInfo[], outputShape: ShapeInfo,\n program: ProgramParams): string {\n const prefixSnippets: string[] = [];\n inputsInfo.forEach(x => {\n const size = util.sizeFromShape(x.shapeInfo.logicalShape);\n\n // Snippet when we decided to upload the values as uniform.\n if (x.shapeInfo.isUniform) {\n prefixSnippets.push(\n `uniform float ${x.name}${size > 1 ? `[${size}]` : ''};`);\n } else {\n prefixSnippets.push(`uniform sampler2D ${x.name};`);\n prefixSnippets.push(`uniform int offset${x.name};`);\n }\n\n if (program.enableShapeUniforms) {\n const {uniformShape} = getUniformInfoFromShape(\n program.packedInputs, x.shapeInfo.logicalShape, x.shapeInfo.texShape);\n switch (uniformShape.length) {\n case 1:\n prefixSnippets.push(`uniform int ${x.name}Shape;`);\n break;\n case 2:\n prefixSnippets.push(`uniform ivec2 ${x.name}Shape;`);\n break;\n case 3:\n prefixSnippets.push(`uniform ivec3 ${x.name}Shape;`);\n break;\n case 4:\n prefixSnippets.push(`uniform ivec4 ${x.name}Shape;`);\n break;\n default:\n break;\n }\n prefixSnippets.push(`uniform ivec2 ${x.name}TexShape;`);\n }\n });\n\n if (program.enableShapeUniforms) {\n switch (outputShape.logicalShape.length) {\n case 1:\n prefixSnippets.push(`uniform int outShape;`);\n break;\n case 2:\n prefixSnippets.push(`uniform ivec2 outShape;`);\n prefixSnippets.push(`uniform int outShapeStrides;`);\n break;\n case 3:\n prefixSnippets.push(`uniform ivec3 outShape;`);\n prefixSnippets.push(`uniform ivec2 outShapeStrides;`);\n break;\n case 4:\n prefixSnippets.push(`uniform ivec4 outShape;`);\n prefixSnippets.push(`uniform ivec3 outShapeStrides;`);\n break;\n default:\n break;\n }\n prefixSnippets.push(`uniform ivec2 outTexShape;`);\n }\n if (program.customUniforms) {\n program.customUniforms.forEach((d) => {\n prefixSnippets.push(`uniform ${d.type} ${d.name}${\n d.arrayIndex ? `[${d.arrayIndex}]` : ''};`);\n });\n }\n const inputPrefixSnippet = prefixSnippets.join('\\n');\n\n const inputSamplingSnippet = inputsInfo\n .map(\n x => getInputSamplingSnippet(\n x, outputShape, program.packedInputs,\n program.enableShapeUniforms))\n .join('\\n');\n const outTexShape = outputShape.texShape;\n const glsl = getGlslDifferences();\n const floatTextureSampleSnippet = getFloatTextureSampleSnippet(glsl);\n let outputSamplingSnippet: string;\n let floatTextureSetOutputSnippet: string;\n let shaderPrefix = getShaderPrefix(glsl);\n\n if (outputShape.isPacked) {\n outputSamplingSnippet = getPackedOutputSamplingSnippet(\n outputShape.logicalShape, outTexShape, program.enableShapeUniforms);\n floatTextureSetOutputSnippet = getFloatTextureSetRGBASnippet(glsl);\n } else {\n outputSamplingSnippet = getOutputSamplingSnippet(\n outputShape.logicalShape, outTexShape, program.enableShapeUniforms);\n floatTextureSetOutputSnippet = getFloatTextureSetRSnippet(glsl);\n }\n\n if (program.packedInputs) {\n shaderPrefix += SHADER_PACKED_PREFIX;\n }\n\n const source = [\n shaderPrefix, floatTextureSampleSnippet, floatTextureSetOutputSnippet,\n inputPrefixSnippet, outputSamplingSnippet, inputSamplingSnippet,\n program.userCode\n ].join('\\n');\n return source;\n}\n\nfunction getSamplerFromInInfo(\n inInfo: InputInfo, enableShapeUniforms = false): string {\n const shape = inInfo.shapeInfo.logicalShape;\n switch (shape.length) {\n case 0:\n return getSamplerScalar(inInfo, enableShapeUniforms);\n case 1:\n return getSampler1D(inInfo, enableShapeUniforms);\n case 2:\n return getSampler2D(inInfo, enableShapeUniforms);\n case 3:\n return getSampler3D(inInfo, enableShapeUniforms);\n case 4:\n return getSampler4D(inInfo, enableShapeUniforms);\n case 5:\n return getSampler5D(inInfo);\n case 6:\n return getSampler6D(inInfo);\n default:\n throw new Error(\n `${shape.length}-D input sampling` +\n ` is not yet supported`);\n }\n}\n\nfunction getPackedSamplerFromInInfo(\n inInfo: InputInfo, enableShapeUniforms: boolean): string {\n const shape = inInfo.shapeInfo.logicalShape;\n switch (shape.length) {\n case 0:\n return getPackedSamplerScalar(inInfo);\n case 1:\n return getPackedSampler1D(inInfo, enableShapeUniforms);\n case 2:\n return getPackedSampler2D(inInfo, enableShapeUniforms);\n case 3:\n return getPackedSampler3D(inInfo, enableShapeUniforms);\n default:\n return getPackedSamplerND(inInfo, enableShapeUniforms);\n }\n}\n\nfunction getInputSamplingSnippet(\n inInfo: InputInfo, outShapeInfo: ShapeInfo, usesPackedTextures = false,\n enableShapeUniforms: boolean): string {\n let res = '';\n if (usesPackedTextures) {\n res += getPackedSamplerFromInInfo(inInfo, enableShapeUniforms);\n } else {\n res += getSamplerFromInInfo(inInfo, enableShapeUniforms);\n }\n\n const inShape = inInfo.shapeInfo.logicalShape;\n const outShape = outShapeInfo.logicalShape;\n if (inShape.length <= outShape.length) {\n if (usesPackedTextures) {\n res += getPackedSamplerAtOutputCoords(inInfo, outShapeInfo);\n } else {\n res += getSamplerAtOutputCoords(inInfo, outShapeInfo);\n }\n }\n return res;\n}\n\nfunction getPackedOutputSamplingSnippet(\n outShape: number[], outTexShape: [number, number],\n enableShapeUniforms: boolean): string {\n switch (outShape.length) {\n case 0:\n return getOutputScalarCoords();\n case 1:\n return getOutputPacked1DCoords(\n outShape as [number], outTexShape, enableShapeUniforms);\n case 2:\n return getOutputPacked2DCoords(\n outShape as [number, number], outTexShape, enableShapeUniforms);\n case 3:\n return getOutputPacked3DCoords(\n outShape as [number, number, number], outTexShape,\n enableShapeUniforms);\n default:\n return getOutputPackedNDCoords(\n outShape, outTexShape, enableShapeUniforms);\n }\n}\n\nfunction getOutputSamplingSnippet(\n outShape: number[], outTexShape: [number, number],\n enableShapeUniforms: boolean): string {\n switch (outShape.length) {\n case 0:\n return getOutputScalarCoords();\n case 1:\n return getOutput1DCoords(\n outShape as [number], outTexShape, enableShapeUniforms);\n case 2:\n return getOutput2DCoords(\n outShape as [number, number], outTexShape, enableShapeUniforms);\n case 3:\n return getOutput3DCoords(\n outShape as [number, number, number], outTexShape,\n enableShapeUniforms);\n case 4:\n return getOutput4DCoords(\n outShape as [number, number, number, number], outTexShape,\n enableShapeUniforms);\n case 5:\n return getOutput5DCoords(\n outShape as [number, number, number, number, number], outTexShape);\n case 6:\n return getOutput6DCoords(\n outShape as [number, number, number, number, number, number],\n outTexShape);\n default:\n throw new Error(\n `${outShape.length}-D output sampling is not yet supported`);\n }\n}\n\nfunction getFloatTextureSampleSnippet(glsl: GLSL): string {\n return `\n float sampleTexture(sampler2D textureSampler, vec2 uv) {\n return ${glsl.texture2D}(textureSampler, uv).r;\n }\n `;\n}\n\nfunction getFloatTextureSetRSnippet(glsl: GLSL): string {\n return `\n void setOutput(float val) {\n ${glsl.output} = vec4(val, 0, 0, 0);\n }\n `;\n}\n\nfunction getFloatTextureSetRGBASnippet(glsl: GLSL): string {\n return `\n void setOutput(vec4 val) {\n ${glsl.output} = val;\n }\n `;\n}\n\nfunction getShaderPrefix(glsl: GLSL): string {\n const SHADER_PREFIX = `${glsl.version}\n precision highp float;\n precision highp int;\n precision highp sampler2D;\n ${glsl.varyingFs} vec2 resultUV;\n ${glsl.defineOutput}\n const vec2 halfCR = vec2(0.5, 0.5);\n\n struct ivec5\n {\n int x;\n int y;\n int z;\n int w;\n int u;\n };\n\n struct ivec6\n {\n int x;\n int y;\n int z;\n int w;\n int u;\n int v;\n };\n\n uniform float NAN;\n ${glsl.defineSpecialNaN}\n ${glsl.defineSpecialInf}\n ${glsl.defineRound}\n\n int imod(int x, int y) {\n return x - y * (x / y);\n }\n\n int idiv(int a, int b, float sign) {\n int res = a / b;\n int mod = imod(a, b);\n if (sign < 0. && mod != 0) {\n res -= 1;\n }\n return res;\n }\n\n //Based on the work of Dave Hoskins\n //https://www.shadertoy.com/view/4djSRW\n #define HASHSCALE1 443.8975\n float random(float seed){\n vec2 p = resultUV * seed;\n vec3 p3 = fract(vec3(p.xyx) * HASHSCALE1);\n p3 += dot(p3, p3.yzx + 19.19);\n return fract((p3.x + p3.y) * p3.z);\n }\n\n ${SAMPLE_1D_SNIPPET}\n ${SAMPLE_2D_SNIPPET}\n ${SAMPLE_3D_SNIPPET}\n `;\n\n return SHADER_PREFIX;\n}\n\nconst SAMPLE_1D_SNIPPET = `\nvec2 uvFromFlat(int texNumR, int texNumC, int index) {\n int texR = index / texNumC;\n int texC = index - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\nvec2 packedUVfrom1D(int texNumR, int texNumC, int index) {\n int texelIndex = index / 2;\n int texR = texelIndex / texNumC;\n int texC = texelIndex - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n`;\n\nconst SAMPLE_2D_SNIPPET = `\nvec2 packedUVfrom2D(int texelsInLogicalRow, int texNumR,\n int texNumC, int row, int col) {\n int texelIndex = (row / 2) * texelsInLogicalRow + (col / 2);\n int texR = texelIndex / texNumC;\n int texC = texelIndex - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n`;\n\nconst SAMPLE_3D_SNIPPET = `\nvec2 packedUVfrom3D(int texNumR, int texNumC,\n int texelsInBatch, int texelsInLogicalRow, int b,\n int row, int col) {\n int index = b * texelsInBatch + (row / 2) * texelsInLogicalRow + (col / 2);\n int texR = index / texNumC;\n int texC = index - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n`;\n\nconst SHADER_PACKED_PREFIX = `\n float getChannel(vec4 frag, vec2 innerDims) {\n vec2 modCoord = mod(innerDims, 2.);\n return modCoord.x == 0. ?\n (modCoord.y == 0. ? frag.r : frag.g) :\n (modCoord.y == 0. ? frag.b : frag.a);\n }\n float getChannel(vec4 frag, int dim) {\n float modCoord = mod(float(dim), 2.);\n return modCoord == 0. ? frag.r : frag.g;\n }\n`;\n\nfunction getOutputScalarCoords() {\n return `\n int getOutputCoords() {\n return 0;\n }\n `;\n}\n\nfunction getOutputPacked1DCoords(\n shape: [number], texShape: [number, number],\n enableShapeUniforms: boolean): string {\n const packedTexShape =\n [Math.ceil(texShape[0] / 2), Math.ceil(texShape[1] / 2)];\n if (packedTexShape[0] === 1) {\n if (enableShapeUniforms) {\n return `\n int getOutputCoords() {\n return 2 * int(resultUV.x * ceil(float(outTexShape[1]) / 2.0));\n }\n `;\n }\n\n return `\n int getOutputCoords() {\n return 2 * int(resultUV.x * ${packedTexShape[1]}.0);\n }\n `;\n }\n\n if (packedTexShape[1] === 1) {\n if (enableShapeUniforms) {\n return `\n int getOutputCoords() {\n return 2 * int(resultUV.y * ceil(float(outTexShape[0]) / 2.0));\n }\n `;\n }\n\n return `\n int getOutputCoords() {\n return 2 * int(resultUV.y * ${packedTexShape[0]}.0);\n }\n `;\n }\n\n if (enableShapeUniforms) {\n return `\n int getOutputCoords() {\n ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(packedTexShape[0], packedTexShape[1]));\n return 2 * (resTexRC.x * packedTexShape[1] + resTexRC.y);\n }\n `;\n }\n\n return `\n int getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${packedTexShape[0]}, ${packedTexShape[1]}));\n return 2 * (resTexRC.x * ${packedTexShape[1]} + resTexRC.y);\n }\n `;\n}\n\nfunction getOutput1DCoords(\n shape: [number], texShape: [number, number],\n enableShapeUniforms: boolean): string {\n if (texShape[0] === 1) {\n if (enableShapeUniforms) {\n return `\n int getOutputCoords() {\n return int(resultUV.x * float(outTexShape[1]));\n }\n `;\n }\n return `\n int getOutputCoords() {\n return int(resultUV.x * ${texShape[1]}.0);\n }\n `;\n }\n if (texShape[1] === 1) {\n if (enableShapeUniforms) {\n return `\n int getOutputCoords() {\n return int(resultUV.y * float(outTexShape[0]));\n }\n `;\n }\n return `\n int getOutputCoords() {\n return int(resultUV.y * ${texShape[0]}.0);\n }\n `;\n }\n if (enableShapeUniforms) {\n return `\n int getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(outTexShape[0], outTexShape[1]));\n return resTexRC.x * outTexShape[1] + resTexRC.y;\n }\n `;\n }\n return `\n int getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${texShape[0]}, ${texShape[1]}));\n return resTexRC.x * ${texShape[1]} + resTexRC.y;\n }\n `;\n}\n\nfunction getOutputPacked3DCoords(\n shape: [number, number, number], texShape: [number, number],\n enableShapeUniforms: boolean): string {\n if (enableShapeUniforms) {\n return `\n ivec3 getOutputCoords() {\n ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));\n int texelsInLogicalRow = int(ceil(float(outShape[2]) / 2.0));\n int texelsInBatch = texelsInLogicalRow * int(ceil(float(outShape[1]) / 2.0));\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(packedTexShape[0], packedTexShape[1]));\n int index = resTexRC.x * packedTexShape[1] + resTexRC.y;\n\n int b = index / texelsInBatch;\n index -= b * texelsInBatch;\n\n int r = 2 * (index / texelsInLogicalRow);\n int c = imod(index, texelsInLogicalRow) * 2;\n\n return ivec3(b, r, c);\n }\n `;\n }\n\n const packedTexShape =\n [Math.ceil(texShape[0] / 2), Math.ceil(texShape[1] / 2)];\n const texelsInLogicalRow = Math.ceil(shape[2] / 2);\n const texelsInBatch = texelsInLogicalRow * Math.ceil(shape[1] / 2);\n\n return `\n ivec3 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${packedTexShape[0]}, ${packedTexShape[1]}));\n int index = resTexRC.x * ${packedTexShape[1]} + resTexRC.y;\n\n int b = index / ${texelsInBatch};\n index -= b * ${texelsInBatch};\n\n int r = 2 * (index / ${texelsInLogicalRow});\n int c = imod(index, ${texelsInLogicalRow}) * 2;\n\n return ivec3(b, r, c);\n }\n `;\n}\n\nfunction getOutput3DCoords(\n shape: [number, number, number], texShape: [number, number],\n enableShapeUniforms: boolean): string {\n if (enableShapeUniforms) {\n const coordsFromIndexSnippet =\n shader_util.getOutputLogicalCoordinatesFromFlatIndexByUniform(\n ['r', 'c', 'd'], shape);\n\n return `\n ivec3 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(outTexShape[0], outTexShape[1]));\n int index = resTexRC.x * outTexShape[1] + resTexRC.y;\n ${coordsFromIndexSnippet}\n return ivec3(r, c, d);\n }\n`;\n }\n const coordsFromIndexSnippet =\n shader_util.getLogicalCoordinatesFromFlatIndex(['r', 'c', 'd'], shape);\n\n return `\n ivec3 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${texShape[0]}, ${texShape[1]}));\n int index = resTexRC.x * ${texShape[1]} + resTexRC.y;\n ${coordsFromIndexSnippet}\n return ivec3(r, c, d);\n }\n `;\n}\n\nfunction getOutputPackedNDCoords(\n shape: number[], texShape: [number, number],\n enableShapeUniforms: boolean): string {\n if (enableShapeUniforms) {\n // TODO: support 5d and 6d\n return `\n ivec4 getOutputCoords() {\n ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(packedTexShape[0], packedTexShape[1]));\n int index = resTexRC.x * packedTexShape[1] + resTexRC.y;\n\n int texelsInLogicalRow = int(ceil(float(outShape[3]) / 2.0));\n int texelsInBatch = texelsInLogicalRow * int(ceil(float(outShape[2]) / 2.0));\n int texelsInBatchN = texelsInBatch * outShape[1];\n\n int b2 = index / texelsInBatchN;\n index -= b2 * texelsInBatchN;\n\n int b = index / texelsInBatch;\n index -= b * texelsInBatch;\n\n int r = 2 * (index / texelsInLogicalRow);\n int c = imod(index, texelsInLogicalRow) * 2;\n\n return ivec4(b2, b, r, c);\n }\n `;\n }\n const packedTexShape =\n [Math.ceil(texShape[0] / 2), Math.ceil(texShape[1] / 2)];\n\n const texelsInLogicalRow = Math.ceil(shape[shape.length - 1] / 2);\n const texelsInBatch =\n texelsInLogicalRow * Math.ceil(shape[shape.length - 2] / 2);\n let texelsInBatchN = texelsInBatch;\n let batches = ``;\n let coords = 'b, r, c';\n\n for (let b = 2; b < shape.length - 1; b++) {\n texelsInBatchN *= shape[shape.length - b - 1];\n batches = `\n int b${b} = index / ${texelsInBatchN};\n index -= b${b} * ${texelsInBatchN};\n ` + batches;\n coords = `b${b}, ` + coords;\n }\n\n return `\n ivec${shape.length} getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${packedTexShape[0]}, ${packedTexShape[1]}));\n int index = resTexRC.x * ${packedTexShape[1]} + resTexRC.y;\n\n ${batches}\n\n int b = index / ${texelsInBatch};\n index -= b * ${texelsInBatch};\n\n int r = 2 * (index / ${texelsInLogicalRow});\n int c = imod(index, ${texelsInLogicalRow}) * 2;\n\n return ivec${shape.length}(${coords});\n }\n `;\n}\n\nfunction getOutput4DCoords(\n shape: [number, number, number, number], texShape: [number, number],\n enableShapeUniforms: boolean): string {\n if (enableShapeUniforms) {\n const coordsFromIndexSnippet =\n shader_util.getOutputLogicalCoordinatesFromFlatIndexByUniform(\n ['r', 'c', 'd', 'd2'], shape);\n\n return `\n ivec4 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(outTexShape[0], outTexShape[1]));\n int index = resTexRC.x * outTexShape[1] + resTexRC.y;\n ${coordsFromIndexSnippet}\n return ivec4(r, c, d, d2);\n }\n `;\n }\n const coordsFromIndexSnippet = shader_util.getLogicalCoordinatesFromFlatIndex(\n ['r', 'c', 'd', 'd2'], shape);\n\n return `\n ivec4 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${texShape[0]}, ${texShape[1]}));\n int index = resTexRC.x * ${texShape[1]} + resTexRC.y;\n ${coordsFromIndexSnippet}\n return ivec4(r, c, d, d2);\n }\n `;\n}\n\nfunction getOutput5DCoords(\n shape: [number, number, number, number, number],\n texShape: [number, number]): string {\n const coordsFromIndexSnippet = shader_util.getLogicalCoordinatesFromFlatIndex(\n ['r', 'c', 'd', 'd2', 'd3'], shape);\n\n return `\n ivec5 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx * vec2(${texShape[0]},\n ${texShape[1]}));\n\n int index = resTexRC.x * ${texShape[1]} + resTexRC.y;\n\n ${coordsFromIndexSnippet}\n\n ivec5 outShape = ivec5(r, c, d, d2, d3);\n return outShape;\n }\n `;\n}\n\nfunction getOutput6DCoords(\n shape: [number, number, number, number, number, number],\n texShape: [number, number]): string {\n const coordsFromIndexSnippet = shader_util.getLogicalCoordinatesFromFlatIndex(\n ['r', 'c', 'd', 'd2', 'd3', 'd4'], shape);\n\n return `\n ivec6 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${texShape[0]}, ${texShape[1]}));\n int index = resTexRC.x * ${texShape[1]} + resTexRC.y;\n\n ${coordsFromIndexSnippet}\n\n ivec6 result = ivec6(r, c, d, d2, d3, d4);\n return result;\n }\n `;\n}\n\nfunction getOutputPacked2DCoords(\n shape: [number, number], texShape: [number, number],\n enableShapeUniforms: boolean): string {\n const packedTexShape =\n [Math.ceil(texShape[0] / 2), Math.ceil(texShape[1] / 2)];\n if (util.arraysEqual(shape, texShape)) {\n if (enableShapeUniforms) {\n return `\n ivec2 getOutputCoords() {\n ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));\n return 2 * ivec2(resultUV.yx * vec2(packedTexShape[0], packedTexShape[1]));\n }\n `;\n }\n\n return `\n ivec2 getOutputCoords() {\n return 2 * ivec2(resultUV.yx * vec2(${packedTexShape[0]}, ${\n packedTexShape[1]}));\n }\n `;\n }\n\n // texels needed to accommodate a logical row\n const texelsInLogicalRow = Math.ceil(shape[1] / 2);\n\n /**\n * getOutputCoords\n *\n * resTexRC: The rows and columns of the texels. If you move over one\n * texel to the right in the packed texture, you are moving over one column\n * (not two).\n *\n * index: The texel index\n */\n if (enableShapeUniforms) {\n return `\n ivec2 getOutputCoords() {\n ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));\n int texelsInLogicalRow = int(ceil(float(outShape[1]) / 2.0));\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(packedTexShape[0], packedTexShape[1]));\n\n int index = resTexRC.x * packedTexShape[1] + resTexRC.y;\n int r = 2 * (index / texelsInLogicalRow);\n int c = imod(index, texelsInLogicalRow) * 2;\n\n return ivec2(r, c);\n }\n `;\n }\n\n return `\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${packedTexShape[0]}, ${packedTexShape[1]}));\n\n int index = resTexRC.x * ${packedTexShape[1]} + resTexRC.y;\n int r = 2 * (index / ${texelsInLogicalRow});\n int c = imod(index, ${texelsInLogicalRow}) * 2;\n\n return ivec2(r, c);\n }\n `;\n}\n\nfunction getOutput2DCoords(\n shape: [number, number], texShape: [number, number],\n enableShapeUniforms: boolean): string {\n if (util.arraysEqual(shape, texShape)) {\n if (enableShapeUniforms) {\n return `\n ivec2 getOutputCoords() {\n return ivec2(resultUV.yx * vec2(outTexShape[0], outTexShape[1]));\n }\n `;\n }\n return `\n ivec2 getOutputCoords() {\n return ivec2(resultUV.yx * vec2(${texShape[0]}, ${texShape[1]}));\n }\n `;\n }\n if (shape[1] === 1) {\n if (enableShapeUniforms) {\n return `\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(outTexShape[0], outTexShape[1]));\n int index = resTexRC.x * outTexShape[1] + resTexRC.y;\n return ivec2(index, 0);\n }\n `;\n }\n return `\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${texShape[0]}, ${texShape[1]}));\n int index = resTexRC.x * ${texShape[1]} + resTexRC.y;\n return ivec2(index, 0);\n }\n `;\n }\n if (shape[0] === 1) {\n if (enableShapeUniforms) {\n return `\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(outTexShape[0], outTexShape[1]));\n int index = resTexRC.x * outTexShape[1] + resTexRC.y;\n return ivec2(0, index);\n }\n `;\n }\n return `\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${texShape[0]}, ${texShape[1]}));\n int index = resTexRC.x * ${texShape[1]} + resTexRC.y;\n return ivec2(0, index);\n }\n `;\n }\n if (enableShapeUniforms) {\n return `\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(outTexShape[0], outTexShape[1]));\n int index = resTexRC.x * outTexShape[1] + resTexRC.y;\n int r = index / outShape[1];\n int c = index - r * outShape[1];\n return ivec2(r, c);\n }\n `;\n }\n return `\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(${texShape[0]}, ${texShape[1]}));\n int index = resTexRC.x * ${texShape[1]} + resTexRC.y;\n int r = index / ${shape[1]};\n int c = index - r * ${shape[1]};\n return ivec2(r, c);\n }\n `;\n}\n\nfunction getFlatOffsetUniformName(texName: string): string {\n return `offset${texName}`;\n}\n\nfunction getPackedSamplerScalar(inputInfo: InputInfo): string {\n const texName = inputInfo.name;\n const funcName = 'get' + texName.charAt(0).toUpperCase() + texName.slice(1);\n const glsl = getGlslDifferences();\n return `\n vec4 ${funcName}() {\n return ${glsl.texture2D}(${texName}, halfCR);\n }\n `;\n}\n\nfunction getSamplerScalar(\n inputInfo: InputInfo, enableShapeUniforms: boolean): string {\n const texName = inputInfo.name;\n const funcName = 'get' + texName.charAt(0).toUpperCase() + texName.slice(1);\n if (inputInfo.shapeInfo.isUniform) {\n return `float ${funcName}() {return ${texName};}`;\n }\n const [texNumR, texNumC] = inputInfo.shapeInfo.texShape;\n if (texNumR === 1 && texNumC === 1) {\n return `\n float ${funcName}() {\n return sampleTexture(${texName}, halfCR);\n }\n `;\n }\n\n const offset = getFlatOffsetUniformName(texName);\n if (enableShapeUniforms) {\n return `\n float ${funcName}() {\n vec2 uv = uvFromFlat(${texName}TexShape[0], ${texName}TexShape[1], ${\n offset});\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n\n const [tNumR, tNumC] = inputInfo.shapeInfo.texShape;\n return `\n float ${funcName}() {\n vec2 uv = uvFromFlat(${tNumR}, ${tNumC}, ${offset});\n return sampleTexture(${texName}, uv);\n }\n `;\n}\n\nfunction getPackedSampler1D(\n inputInfo: InputInfo, enableShapeUniforms: boolean): string {\n const texName = inputInfo.name;\n const funcName = 'get' + texName.charAt(0).toUpperCase() + texName.slice(1);\n const texShape = inputInfo.shapeInfo.texShape;\n const glsl = getGlslDifferences();\n if (enableShapeUniforms) {\n return `\n vec4 ${funcName}(int index) {\n ivec2 packedTexShape = ivec2(ceil(float(${\n texName}TexShape[0]) / 2.0), ceil(float(${texName}TexShape[1]) / 2.0));\n vec2 uv = packedUVfrom1D(\n packedTexShape[0], packedTexShape[1], index);\n return ${glsl.texture2D}(${texName}, uv);\n }\n `;\n }\n const packedTexShape =\n [Math.ceil(texShape[0] / 2), Math.ceil(texShape[1] / 2)];\n return `\n vec4 ${funcName}(int index) {\n vec2 uv = packedUVfrom1D(\n ${packedTexShape[0]}, ${packedTexShape[1]}, index);\n return ${glsl.texture2D}(${texName}, uv);\n }\n `;\n}\n\nfunction getSampler1D(\n inputInfo: InputInfo, enableShapeUniforms: boolean): string {\n const texName = inputInfo.name;\n const funcName = 'get' + texName.charAt(0).toUpperCase() + texName.slice(1);\n\n if (inputInfo.shapeInfo.isUniform) {\n // Uniform arrays will be less than 65505 (no risk of float16 overflow).\n return `\n float ${funcName}(int index) {\n ${getUniformSampler(inputInfo)}\n }\n `;\n }\n\n const texShape = inputInfo.shapeInfo.texShape;\n const tNumR = texShape[0];\n const tNumC = texShape[1];\n\n if (tNumC === 1 && tNumR === 1) {\n return `\n float ${funcName}(int index) {\n return sampleTexture(${texName}, halfCR);\n }\n `;\n }\n const offset = getFlatOffsetUniformName(texName);\n if (tNumC === 1) {\n if (enableShapeUniforms) {\n return `\n float ${funcName}(int index) {\n vec2 uv = vec2(0.5, (float(index + ${offset}) + 0.5) / float(${\n texName}TexShape[0]));\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n\n return `\n float ${funcName}(int index) {\n vec2 uv = vec2(0.5, (float(index + ${offset}) + 0.5) / ${tNumR}.0);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n if (tNumR === 1) {\n if (enableShapeUniforms) {\n return `\n float ${funcName}(int index) {\n vec2 uv = vec2((float(index + ${offset}) + 0.5) / float(${\n texName}TexShape[1]), 0.5);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n\n return `\n float ${funcName}(int index) {\n vec2 uv = vec2((float(index + ${offset}) + 0.5) / ${tNumC}.0, 0.5);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n\n if (enableShapeUniforms) {\n return `\n float ${funcName}(int index) {\n vec2 uv = uvFromFlat(${texName}TexShape[0], ${\n texName}TexShape[1], index + ${offset});\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n\n return `\n float ${funcName}(int index) {\n vec2 uv = uvFromFlat(${tNumR}, ${tNumC}, index + ${offset});\n return sampleTexture(${texName}, uv);\n }\n `;\n}\n\nfunction getPackedSampler2D(\n inputInfo: InputInfo, enableShapeUniforms: boolean): string {\n const shape = inputInfo.shapeInfo.logicalShape;\n const texName = inputInfo.name;\n const funcName = 'get' + texName.charAt(0).toUpperCase() + texName.slice(1);\n const texShape = inputInfo.shapeInfo.texShape;\n\n const texNumR = texShape[0];\n const texNumC = texShape[1];\n const glsl = getGlslDifferences();\n if (texShape != null && util.arraysEqual(shape, texShape)) {\n if (enableShapeUniforms) {\n return `\n vec4 ${funcName}(int row, int col) {\n vec2 uv = (vec2(col, row) + halfCR) / vec2(${texName}TexShape[1], ${\n texName}TexShape[0]);\n\n return ${glsl.texture2D}(${texName}, uv);\n }\n `;\n }\n return `\n vec4 ${funcName}(int row, int col) {\n vec2 uv = (vec2(col, row) + halfCR) / vec2(${texNumC}.0, ${texNumR}.0);\n\n return ${glsl.texture2D}(${texName}, uv);\n }\n `;\n }\n\n if (enableShapeUniforms) {\n return `\n vec4 ${funcName}(int row, int col) {\n ivec2 packedTexShape = ivec2(ceil(float(${\n texName}TexShape[0]) / 2.0), ceil(float(${texName}TexShape[1]) / 2.0));\n int valuesPerRow = int(ceil(float(${texName}Shape[1]) / 2.0));\n vec2 uv = packedUVfrom2D(valuesPerRow, packedTexShape[0], packedTexShape[1], row, col);\n return ${glsl.texture2D}(${texName}, uv);\n }\n `;\n }\n const packedTexShape =\n [Math.ceil(texShape[0] / 2), Math.ceil(texShape[1] / 2)];\n const valuesPerRow = Math.ceil(shape[1] / 2);\n\n return `\n vec4 ${funcName}(int row, int col) {\n vec2 uv = packedUVfrom2D(${valuesPerRow}, ${packedTexShape[0]}, ${\n packedTexShape[1]}, row, col);\n return ${glsl.texture2D}(${texName}, uv);\n }\n `;\n}\n\nfunction getSampler2D(\n inputInfo: InputInfo, enableShapeUniforms: boolean): string {\n const shape = inputInfo.shapeInfo.logicalShape;\n const texName = inputInfo.name;\n const funcName = 'get' + texName.charAt(0).toUpperCase() + texName.slice(1);\n const texShape = inputInfo.shapeInfo.texShape;\n\n if (texShape != null && util.arraysEqual(shape, texShape)) {\n if (enableShapeUniforms) {\n return `\n float ${funcName}(int row, int col) {\n vec2 uv = (vec2(col, row) + halfCR) / vec2(${texName}TexShape[1], ${\n texName}TexShape[0]);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n\n const texNumR = texShape[0];\n const texNumC = texShape[1];\n return `\n float ${funcName}(int row, int col) {\n vec2 uv = (vec2(col, row) + halfCR) / vec2(${texNumC}.0, ${texNumR}.0);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n\n const {newShape, keptDims} = util.squeezeShape(shape);\n const squeezedShape = newShape;\n if (squeezedShape.length < shape.length) {\n const newInputInfo = squeezeInputInfo(inputInfo, squeezedShape);\n const params = ['row', 'col'];\n return `\n ${getSamplerFromInInfo(newInputInfo, enableShapeUniforms)}\n float ${funcName}(int row, int col) {\n return ${funcName}(${getSqueezedParams(params, keptDims)});\n }\n `;\n }\n\n if (inputInfo.shapeInfo.isUniform) {\n // Uniform arrays will be less than 65505 (no risk of float16 overflow).\n return `\n float ${funcName}(int row, int col) {\n int index = round(dot(vec2(row, col), vec2(${shape[1]}, 1)));\n ${getUniformSampler(inputInfo)}\n }\n `;\n }\n\n const texNumR = texShape[0];\n const texNumC = texShape[1];\n const offset = getFlatOffsetUniformName(texName);\n if (texNumC === 1) {\n // index is used directly as physical (no risk of float16 overflow).\n if (enableShapeUniforms) {\n return `\n float ${funcName}(int row, int col) {\n float index = dot(vec3(row, col, ${offset}), vec3(${\n texName}Shape[1], 1, 1));\n vec2 uv = vec2(0.5, (index + 0.5) / float(${texName}TexShape[0]));\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n return `\n float ${funcName}(int row, int col) {\n float index = dot(vec3(row, col, ${offset}), vec3(${shape[1]}, 1, 1));\n vec2 uv = vec2(0.5, (index + 0.5) / ${texNumR}.0);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n if (texNumR === 1) {\n // index is used directly as physical (no risk of float16 overflow).\n if (enableShapeUniforms) {\n return `\n float ${funcName}(int row, int col) {\n float index = dot(vec3(row, col, ${offset}), vec3(${\n texName}Shape[1], 1, 1));\n vec2 uv = vec2((index + 0.5) / float(${texName}TexShape[1]), 0.5);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n return `\n float ${funcName}(int row, int col) {\n float index = dot(vec3(row, col, ${offset}), vec3(${shape[1]}, 1, 1));\n vec2 uv = vec2((index + 0.5) / ${texNumC}.0, 0.5);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n\n if (enableShapeUniforms) {\n return `\n float ${funcName}(int row, int col) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * ${texName}Shape[1] + col + ${offset};\n vec2 uv = uvFromFlat(${texName}TexShape[0], ${\n texName}TexShape[1], index);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n return `\n float ${funcName}(int row, int col) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * ${shape[1]} + col + ${offset};\n vec2 uv = uvFromFlat(${texNumR}, ${texNumC}, index);\n return sampleTexture(${texName}, uv);\n }\n`;\n}\n\nfunction getPackedSampler3D(\n inputInfo: InputInfo, enableShapeUniforms: boolean): string {\n const shape = inputInfo.shapeInfo.logicalShape;\n const texName = inputInfo.name;\n const funcName = 'get' + texName.charAt(0).toUpperCase() + texName.slice(1);\n const texShape = inputInfo.shapeInfo.texShape;\n const packedTexShape =\n [Math.ceil(texShape[0] / 2), Math.ceil(texShape[1] / 2)];\n\n if (shape[0] === 1) {\n const squeezedShape = shape.slice(1);\n const keptDims = [1, 2];\n const newInputInfo = squeezeInputInfo(inputInfo, squeezedShape);\n const params = ['b', 'row', 'col'];\n return `\n ${getPackedSamplerFromInInfo(newInputInfo, enableShapeUniforms)}\n vec4 ${funcName}(int b, int row, int col) {\n return ${funcName}(${getSqueezedParams(params, keptDims)});\n }\n `;\n }\n\n const glsl = getGlslDifferences();\n if (enableShapeUniforms) {\n return `\n vec4 ${funcName}(int b, int row, int col) {\n ivec2 packedTexShape = ivec2(ceil(float(${\n texName}TexShape[0]) / 2.0), ceil(float(${texName}TexShape[1]) / 2.0));\n int valuesPerRow = int(ceil(float(${texName}Shape[2]) / 2.0));\n int texelsInBatch = valuesPerRow * int(ceil(float(${\n texName}Shape[1]) / 2.0));\n vec2 uv = packedUVfrom3D(\n packedTexShape[0], packedTexShape[1], texelsInBatch, valuesPerRow, b, row, col);\n return ${glsl.texture2D}(${texName}, uv);\n }\n `;\n }\n\n const texNumR = packedTexShape[0];\n const texNumC = packedTexShape[1];\n\n const valuesPerRow = Math.ceil(shape[2] / 2);\n const texelsInBatch = valuesPerRow * Math.ceil(shape[1] / 2);\n\n return `\n vec4 ${funcName}(int b, int row, int col) {\n vec2 uv = packedUVfrom3D(\n ${texNumR}, ${texNumC}, ${texelsInBatch}, ${valuesPerRow}, b, row, col);\n return ${glsl.texture2D}(${texName}, uv);\n }\n `;\n}\n\nfunction getSampler3D(\n inputInfo: InputInfo, enableShapeUniforms: boolean): string {\n const shape = inputInfo.shapeInfo.logicalShape;\n const texName = inputInfo.name;\n const funcName = 'get' + texName.charAt(0).toUpperCase() + texName.slice(1);\n const stride0 = shape[1] * shape[2];\n const stride1 = shape[2];\n\n const {newShape, keptDims} = util.squeezeShape(shape);\n const squeezedShape = newShape;\n if (squeezedShape.length < shape.length) {\n const newInputInfo = squeezeInputInfo(inputInfo, squeezedShape);\n const params = ['row', 'col', 'depth'];\n return `\n ${getSamplerFromInInfo(newInputInfo, enableShapeUniforms)}\n float ${funcName}(int row, int col, int depth) {\n return ${funcName}(${getSqueezedParams(params, keptDims)});\n }\n `;\n }\n\n if (inputInfo.shapeInfo.isUniform) {\n // Uniform arrays will be less than 65505 (no risk of float16 overflow).\n return `\n float ${funcName}(int row, int col, int depth) {\n int index = round(dot(vec3(row, col, depth),\n vec3(${stride0}, ${stride1}, 1)));\n ${getUniformSampler(inputInfo)}\n }\n `;\n }\n\n const texShape = inputInfo.shapeInfo.texShape;\n const texNumR = texShape[0];\n const texNumC = texShape[1];\n const flatOffset = inputInfo.shapeInfo.flatOffset;\n if (texNumC === stride0 && flatOffset == null) {\n // texC is used directly as physical (no risk of float16 overflow).\n if (enableShapeUniforms) {\n return `\n float ${funcName}(int row, int col, int depth) {\n int stride1 = ${texName}Shape[2];\n float texR = float(row);\n float texC = dot(vec2(col, depth), vec2(stride1, 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${texName}TexShape[1], ${texName}TexShape[0]);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n return `\n float ${funcName}(int row, int col, int depth) {\n float texR = float(row);\n float texC = dot(vec2(col, depth), vec2(${stride1}, 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${texNumC}.0, ${texNumR}.0);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n\n if (texNumC === stride1 && flatOffset == null) {\n // texR is used directly as physical (no risk of float16 overflow).\n if (enableShapeUniforms) {\n return `\n float ${funcName}(int row, int col, int depth) {\n float texR = dot(vec2(row, col), vec2(${texName}Shape[1], 1));\n float texC = float(depth);\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2(${texName}TexShape[1], ${\n texName}TexShape[0]);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n return `\n float ${funcName}(int row, int col, int depth) {\n float texR = dot(vec2(row, col), vec2(${shape[1]}, 1));\n float texC = float(depth);\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2(${texNumC}.0, ${texNumR}.0);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n\n const offset = getFlatOffsetUniformName(texName);\n if (enableShapeUniforms) {\n return `\n float ${funcName}(int row, int col, int depth) {\n // Explicitly use integer operations as dot() only works on floats.\n int stride0 = ${texName}Shape[1] * ${texName}Shape[2];\n int stride1 = ${texName}Shape[2];\n int index = row * stride0 + col * stride1 + depth + ${offset};\n vec2 uv = uvFromFlat(${texName}TexShape[0], ${texName}TexShape[1], index);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n return `\n float ${funcName}(int row, int col, int depth) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * ${stride0} + col * ${stride1} + depth + ${offset};\n vec2 uv = uvFromFlat(${texNumR}, ${texNumC}, index);\n return sampleTexture(${texName}, uv);\n }\n `;\n}\n\nfunction getPackedSamplerND(\n inputInfo: InputInfo, enableShapeUniforms: boolean): string {\n const texName = inputInfo.name;\n const funcName = 'get' + texName.charAt(0).toUpperCase() + texName.slice(1);\n const glsl = getGlslDifferences();\n if (enableShapeUniforms) {\n // TODO: support 5d and 6d\n return `\n vec4 ${funcName}(int b2, int b, int row, int col) {\n int valuesPerRow = int(ceil(float(${texName}Shape[3]) / 2.0));\n int texelsInBatch = valuesPerRow * int(ceil(float(${\n texName}Shape[2]) / 2.0));\n int index = b * texelsInBatch + (row / 2) * valuesPerRow + (col / 2);\n texelsInBatch *= ${texName}Shape[1];\n index = b2 * texelsInBatch + index;\n ivec2 packedTexShape = ivec2(ceil(float(${\n texName}TexShape[0]) / 2.0), ceil(float(${texName}TexShape[1]) / 2.0));\n int texR = index / packedTexShape[1];\n int texC = index - texR * packedTexShape[1];\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2(packedTexShape[1], packedTexShape[0]); return ${\n glsl.texture2D}(${texName}, uv);\n }\n `;\n }\n const shape = inputInfo.shapeInfo.logicalShape;\n const rank = shape.length;\n const texShape = inputInfo.shapeInfo.texShape;\n const packedTexShape =\n [Math.ceil(texShape[0] / 2), Math.ceil(texShape[1] / 2)];\n const texNumR = packedTexShape[0];\n const texNumC = packedTexShape[1];\n\n const valuesPerRow = Math.ceil(shape[rank - 1] / 2);\n let texelsInBatch = valuesPerRow * Math.ceil(shape[rank - 2] / 2);\n let params = `int b, int row, int col`;\n let index = `b * ${texelsInBatch} + (row / 2) * ${valuesPerRow} + (col / 2)`;\n for (let b = 2; b < rank - 1; b++) {\n params = `int b${b}, ` + params;\n texelsInBatch *= shape[rank - b - 1];\n index = `b${b} * ${texelsInBatch} + ` + index;\n }\n return `\n vec4 ${funcName}(${params}) {\n int index = ${index};\n int texR = index / ${texNumC};\n int texC = index - texR * ${texNumC};\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2(${texNumC}, ${texNumR});\n return ${glsl.texture2D}(${texName}, uv);\n }\n `;\n}\n\nfunction getSampler4D(\n inputInfo: InputInfo, enableShapeUniforms: boolean): string {\n const shape = inputInfo.shapeInfo.logicalShape;\n const texName = inputInfo.name;\n const funcName = 'get' + texName.charAt(0).toUpperCase() + texName.slice(1);\n const stride2 = shape[3];\n const stride1 = shape[2] * stride2;\n const stride0 = shape[1] * stride1;\n\n const {newShape, keptDims} = util.squeezeShape(shape);\n if (newShape.length < shape.length) {\n const newInputInfo = squeezeInputInfo(inputInfo, newShape);\n const params = ['row', 'col', 'depth', 'depth2'];\n return `\n ${getSamplerFromInInfo(newInputInfo, enableShapeUniforms)}\n float ${funcName}(int row, int col, int depth, int depth2) {\n return ${funcName}(${getSqueezedParams(params, keptDims)});\n }\n `;\n }\n\n if (inputInfo.shapeInfo.isUniform) {\n // Uniform arrays will be less than 65505 (no risk of float16 overflow).\n return `\n float ${funcName}(int row, int col, int depth, int depth2) {\n int index = round(dot(vec4(row, col, depth, depth2),\n vec4(${stride0}, ${stride1}, ${stride2}, 1)));\n ${getUniformSampler(inputInfo)}\n }\n `;\n }\n\n const flatOffset = inputInfo.shapeInfo.flatOffset;\n const texShape = inputInfo.shapeInfo.texShape;\n const texNumR = texShape[0];\n const texNumC = texShape[1];\n\n const stride2Str = `int stride2 = ${texName}Shape[3];`;\n const stride1Str = `int stride1 = ${texName}Shape[2] * stride2;`;\n const stride0Str = `int stride0 = ${texName}Shape[1] * stride1;`;\n if (texNumC === stride0 && flatOffset == null) {\n // texC is used directly as physical (no risk of float16 overflow).\n if (enableShapeUniforms) {\n return `\n float ${funcName}(int row, int col, int depth, int depth2) {\n ${stride2Str}\n ${stride1Str}\n float texR = float(row);\n float texC =\n dot(vec3(col, depth, depth2),\n vec3(stride1, stride2, 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${texName}TexShape[1], ${texName}TexShape[0]);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n return `\n float ${funcName}(int row, int col, int depth, int depth2) {\n float texR = float(row);\n float texC =\n dot(vec3(col, depth, depth2),\n vec3(${stride1}, ${stride2}, 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${texNumC}.0, ${texNumR}.0);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n if (texNumC === stride2 && flatOffset == null) {\n // texR is used directly as physical (no risk of float16 overflow).\n if (enableShapeUniforms) {\n return `\n float ${funcName}(int row, int col, int depth, int depth2) {\n float texR = dot(vec3(row, col, depth),\n vec3(${texName}Shape[1] * ${texName}Shape[2], ${\n texName}Shape[2], 1));\n float texC = float(depth2);\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${texName}TexShape[1], ${texName}TexShape[0]);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n return `\n float ${funcName}(int row, int col, int depth, int depth2) {\n float texR = dot(vec3(row, col, depth),\n vec3(${shape[1] * shape[2]}, ${shape[2]}, 1));\n float texC = float(depth2);\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${texNumC}.0, ${texNumR}.0);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n\n const offset = getFlatOffsetUniformName(texName);\n if (enableShapeUniforms) {\n return `\n float ${funcName}(int row, int col, int depth, int depth2) {\n // Explicitly use integer operations as dot() only works on floats.\n ${stride2Str}\n ${stride1Str}\n ${stride0Str}\n int index = row * stride0 + col * stride1 +\n depth * stride2 + depth2;\n vec2 uv = uvFromFlat(${texName}TexShape[0], ${\n texName}TexShape[1], index + ${offset});\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n return `\n float ${funcName}(int row, int col, int depth, int depth2) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * ${stride0} + col * ${stride1} +\n depth * ${stride2} + depth2;\n vec2 uv = uvFromFlat(${texNumR}, ${texNumC}, index + ${offset});\n return sampleTexture(${texName}, uv);\n }\n `;\n}\n\nfunction getSampler5D(inputInfo: InputInfo): string {\n const shape = inputInfo.shapeInfo.logicalShape;\n const texName = inputInfo.name;\n const funcName = 'get' + texName.charAt(0).toUpperCase() + texName.slice(1);\n const stride3 = shape[4];\n const stride2 = shape[3] * stride3;\n const stride1 = shape[2] * stride2;\n const stride0 = shape[1] * stride1;\n\n const {newShape, keptDims} = util.squeezeShape(shape);\n if (newShape.length < shape.length) {\n const newInputInfo = squeezeInputInfo(inputInfo, newShape);\n const params = ['row', 'col', 'depth', 'depth2', 'depth3'];\n return `\n ${getSamplerFromInInfo(newInputInfo)}\n float ${funcName}(int row, int col, int depth, int depth2, int depth3) {\n return ${funcName}(${getSqueezedParams(params, keptDims)});\n }\n `;\n }\n\n if (inputInfo.shapeInfo.isUniform) {\n // Uniform arrays will be less than 65505 (no risk of float16 overflow).\n return `\n float ${funcName}(int row, int col, int depth, int depth2, int depth3) {\n float index = dot(\n vec4(row, col, depth, depth2),\n vec4(${stride0}, ${stride1}, ${stride2}, ${stride3})) +\n depth3;\n ${getUniformSampler(inputInfo)}\n }\n `;\n }\n\n const flatOffset = inputInfo.shapeInfo.flatOffset;\n const texShape = inputInfo.shapeInfo.texShape;\n const texNumR = texShape[0];\n const texNumC = texShape[1];\n\n if (texNumC === stride0 && flatOffset == null) {\n // texC is used directly as physical (no risk of float16 overflow).\n return `\n float ${funcName}(int row, int col, int depth, int depth2, int depth3) {\n int texR = row;\n float texC = dot(vec4(col, depth, depth2, depth3),\n vec4(${stride1}, ${stride2}, ${stride3}, 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${texNumC}.0, ${texNumR}.0);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n\n if (texNumC === stride3 && flatOffset == null) {\n // texR is used directly as physical (no risk of float16 overflow).\n return `\n float ${funcName}(int row, int col, int depth, int depth2, int depth3) {\n float texR = dot(\n vec4(row, col, depth, depth2),\n vec4(${shape[1] * shape[2] * shape[3]},\n ${shape[2] * shape[3]}, ${shape[3]}, 1));\n int texC = depth3;\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${texNumC}.0, ${texNumR}.0);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n\n const offset = getFlatOffsetUniformName(texName);\n return `\n float ${funcName}(int row, int col, int depth, int depth2, int depth3) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * ${stride0} + col * ${stride1} + depth * ${stride2} +\n depth2 * ${stride3} + depth3 + ${offset};\n vec2 uv = uvFromFlat(${texNumR}, ${texNumC}, index);\n return sampleTexture(${texName}, uv);\n }\n `;\n}\n\nfunction getSampler6D(inputInfo: InputInfo): string {\n const shape = inputInfo.shapeInfo.logicalShape;\n const texName = inputInfo.name;\n const funcName = 'get' + texName.charAt(0).toUpperCase() + texName.slice(1);\n\n const {newShape, keptDims} = util.squeezeShape(shape);\n if (newShape.length < shape.length) {\n const newInputInfo = squeezeInputInfo(inputInfo, newShape);\n const params = ['row', 'col', 'depth', 'depth2', 'depth3', 'depth4'];\n return `\n ${getSamplerFromInInfo(newInputInfo)}\n float ${funcName}(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n return ${funcName}(${getSqueezedParams(params, keptDims)});\n }\n `;\n }\n\n const stride4 = shape[5];\n const stride3 = shape[4] * stride4;\n const stride2 = shape[3] * stride3;\n const stride1 = shape[2] * stride2;\n const stride0 = shape[1] * stride1;\n\n if (inputInfo.shapeInfo.isUniform) {\n // Uniform arrays will be less than 65505 (no risk of float16 overflow).\n return `\n float ${funcName}(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n int index = round(dot(\n vec4(row, col, depth, depth2),\n vec4(${stride0}, ${stride1}, ${stride2}, ${stride3})) +\n dot(\n vec2(depth3, depth4),\n vec2(${stride4}, 1)));\n ${getUniformSampler(inputInfo)}\n }\n `;\n }\n\n const flatOffset = inputInfo.shapeInfo.flatOffset;\n const texShape = inputInfo.shapeInfo.texShape;\n const texNumR = texShape[0];\n const texNumC = texShape[1];\n if (texNumC === stride0 && flatOffset == null) {\n // texC is used directly as physical (no risk of float16 overflow).\n return `\n float ${funcName}(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n int texR = row;\n float texC = dot(vec4(col, depth, depth2, depth3),\n vec4(${stride1}, ${stride2}, ${stride3}, ${stride4})) +\n float(depth4);\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${texNumC}.0, ${texNumR}.0);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n if (texNumC === stride4 && flatOffset == null) {\n // texR is used directly as physical (no risk of float16 overflow).\n return `\n float ${funcName}(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n float texR = dot(vec4(row, col, depth, depth2),\n vec4(${shape[1] * shape[2] * shape[3] * shape[4]},\n ${shape[2] * shape[3] * shape[4]},\n ${shape[3] * shape[4]},\n ${shape[4]})) + float(depth3);\n int texC = depth4;\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${texNumC}.0, ${texNumR}.0);\n return sampleTexture(${texName}, uv);\n }\n `;\n }\n const offset = getFlatOffsetUniformName(texName);\n return `\n float ${funcName}(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * ${stride0} + col * ${stride1} + depth * ${stride2} +\n depth2 * ${stride3} + depth3 * ${stride4} + depth4 + ${offset};\n vec2 uv = uvFromFlat(${texNumR}, ${texNumC}, index);\n return sampleTexture(${texName}, uv);\n }\n `;\n}\n\nfunction getUniformSampler(inputInfo: InputInfo): string {\n const texName = inputInfo.name;\n const inSize = util.sizeFromShape(inputInfo.shapeInfo.logicalShape);\n\n if (inSize < 2) {\n return `return ${texName};`;\n }\n\n return `\n for (int i = 0; i < ${inSize}; i++) {\n if (i == index) {\n return ${texName}[i];\n }\n }\n `;\n}\n\nfunction getPackedSamplerAtOutputCoords(\n inputInfo: InputInfo, outShapeInfo: ShapeInfo) {\n const texName = inputInfo.name;\n const texFuncSnippet = texName.charAt(0).toUpperCase() + texName.slice(1);\n const funcName = 'get' + texFuncSnippet + 'AtOutCoords';\n const inRank = inputInfo.shapeInfo.logicalShape.length;\n const outRank = outShapeInfo.logicalShape.length;\n\n const broadcastDims = getBroadcastDims(\n inputInfo.shapeInfo.logicalShape, outShapeInfo.logicalShape);\n\n const type = getCoordsDataType(outRank);\n const rankDiff = outRank - inRank;\n let coordsSnippet: string;\n const fields = ['x', 'y', 'z', 'w', 'u', 'v'];\n\n if (inRank === 0) {\n coordsSnippet = '';\n } else if (outRank < 2 && broadcastDims.length >= 1) {\n coordsSnippet = 'coords = 0;';\n } else {\n coordsSnippet =\n broadcastDims.map(d => `coords.${fields[d + rankDiff]} = 0;`)\n .join('\\n');\n }\n let unpackedCoordsSnippet = '';\n if (outRank < 2 && inRank > 0) {\n unpackedCoordsSnippet = 'coords';\n } else {\n unpackedCoordsSnippet = inputInfo.shapeInfo.logicalShape\n .map((s, i) => `coords.${fields[i + rankDiff]}`)\n .join(', ');\n }\n\n let output = `return outputValue;`;\n const inSize = util.sizeFromShape(inputInfo.shapeInfo.logicalShape);\n const isInputScalar = inSize === 1;\n const outSize = util.sizeFromShape(outShapeInfo.logicalShape);\n const isOutputScalar = outSize === 1;\n\n if (inRank === 1 && !isInputScalar && !isOutputScalar) {\n output = `\n return vec4(outputValue.xy, outputValue.xy);\n `;\n } else if (isInputScalar && !isOutputScalar) {\n if (outRank === 1) {\n output = `\n return vec4(outputValue.x, outputValue.x, 0., 0.);\n `;\n } else {\n output = `\n return vec4(outputValue.x);\n `;\n }\n } else if (broadcastDims.length) {\n const rows = inRank - 2;\n const cols = inRank - 1;\n\n if (broadcastDims.indexOf(rows) > -1 && broadcastDims.indexOf(cols) > -1) {\n output = `return vec4(outputValue.x);`;\n } else if (broadcastDims.indexOf(rows) > -1) {\n output = `return vec4(outputValue.x, outputValue.y, ` +\n `outputValue.x, outputValue.y);`;\n } else if (broadcastDims.indexOf(cols) > -1) {\n output = `return vec4(outputValue.xx, outputValue.zz);`;\n }\n }\n\n return `\n vec4 ${funcName}() {\n ${type} coords = getOutputCoords();\n ${coordsSnippet}\n vec4 outputValue = get${texFuncSnippet}(${unpackedCoordsSnippet});\n ${output}\n }\n `;\n}\n\nfunction getSamplerAtOutputCoords(\n inputInfo: InputInfo, outShapeInfo: ShapeInfo) {\n const texName = inputInfo.name;\n const texFuncSnippet = texName.charAt(0).toUpperCase() + texName.slice(1);\n const funcName = 'get' + texFuncSnippet + 'AtOutCoords';\n const outTexShape = outShapeInfo.texShape;\n const inTexShape = inputInfo.shapeInfo.texShape;\n const inRank = inputInfo.shapeInfo.logicalShape.length;\n const outRank = outShapeInfo.logicalShape.length;\n\n if (!inputInfo.shapeInfo.isUniform && inRank === outRank &&\n inputInfo.shapeInfo.flatOffset == null &&\n util.arraysEqual(inTexShape, outTexShape)) {\n return `\n float ${funcName}() {\n return sampleTexture(${texName}, resultUV);\n }\n `;\n }\n\n const type = getCoordsDataType(outRank);\n const broadcastDims = getBroadcastDims(\n inputInfo.shapeInfo.logicalShape, outShapeInfo.logicalShape);\n const rankDiff = outRank - inRank;\n let coordsSnippet: string;\n const fields = ['x', 'y', 'z', 'w', 'u', 'v'];\n\n if (inRank === 0) {\n coordsSnippet = '';\n } else if (outRank < 2 && broadcastDims.length >= 1) {\n coordsSnippet = 'coords = 0;';\n } else {\n coordsSnippet =\n broadcastDims.map(d => `coords.${fields[d + rankDiff]} = 0;`)\n .join('\\n');\n }\n let unpackedCoordsSnippet = '';\n if (outRank < 2 && inRank > 0) {\n unpackedCoordsSnippet = 'coords';\n } else {\n unpackedCoordsSnippet = inputInfo.shapeInfo.logicalShape\n .map((s, i) => `coords.${fields[i + rankDiff]}`)\n .join(', ');\n }\n\n return `\n float ${funcName}() {\n ${type} coords = getOutputCoords();\n ${coordsSnippet}\n return get${texFuncSnippet}(${unpackedCoordsSnippet});\n }\n `;\n}\n\nexport function getCoordsDataType(rank: number): string {\n if (rank <= 1) {\n return 'int';\n } else if (rank === 2) {\n return 'ivec2';\n } else if (rank === 3) {\n return 'ivec3';\n } else if (rank === 4) {\n return 'ivec4';\n } else if (rank === 5) {\n return 'ivec5';\n } else if (rank === 6) {\n return 'ivec6';\n } else {\n throw Error(`GPU for rank ${rank} is not yet supported`);\n }\n}\n\nexport function getUniformInfoFromShape(\n isPacked: boolean, shape: number[], texShape: number[]) {\n const {newShape, keptDims} = util.squeezeShape(shape);\n const rank = shape.length;\n const useSqueezePackedShape = isPacked && rank === 3 && shape[0] === 1;\n const squeezeShape = useSqueezePackedShape ? shape.slice(1) : newShape;\n const useSqueezeShape =\n (!isPacked && rank > 1 && !util.arraysEqual(shape, texShape) &&\n newShape.length < rank) ||\n useSqueezePackedShape;\n const uniformShape = useSqueezeShape ? squeezeShape : shape;\n return {useSqueezeShape, uniformShape, keptDims};\n}\n\n/** Returns a new input info (a copy) that has a squeezed logical shape. */\nexport function squeezeInputInfo(\n inInfo: InputInfo, squeezedShape: number[]): InputInfo {\n // Deep copy.\n const newInputInfo: InputInfo = JSON.parse(JSON.stringify(inInfo));\n newInputInfo.shapeInfo.logicalShape = squeezedShape;\n return newInputInfo;\n}\n\nfunction getSqueezedParams(params: string[], keptDims: number[]): string {\n return keptDims.map(d => params[d]).join(', ');\n}\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, env, Tensor, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {GPGPUContext} from './gpgpu_context';\nimport * as shader_compiler from './shader_compiler';\nimport {InputInfo, ShapeInfo, UniformType} from './shader_compiler';\nimport {PackingScheme, TextureData, TextureUsage} from './tex_util';\nimport {createFragmentShader} from './webgl_util';\n\nexport interface GPGPUProgram {\n variableNames: string[];\n outputShape: number[];\n userCode: string;\n enableShapeUniforms?: boolean;\n /** If true, this program expects packed input textures. Defaults to false. */\n packedInputs?: boolean;\n /** If true, this program produces a packed texture. Defaults to false. */\n packedOutput?: boolean;\n /**\n * Affects what type of texture we allocate for the output. Defaults to\n * `TextureUsage.RENDER`.\n */\n outTexUsage?: TextureUsage;\n /**\n * The type of scheme to use when packing texels for the output values.\n * See `PackingScheme` for details. Defaults to `PackingScheme.SHARED_BATCH`.\n */\n outPackingScheme?: PackingScheme;\n customUniforms?:\n Array<{name: string; arrayIndex?: number; type: UniformType;}>;\n}\n\nexport interface GPGPUBinary {\n webGLProgram: WebGLProgram;\n program: GPGPUProgram;\n uniformLocations: {[name: string]: WebGLUniformLocation};\n customUniformLocations?: WebGLUniformLocation[];\n source: string;\n fragmentShader: WebGLShader;\n inShapeInfos: ShapeInfo[];\n outShapeInfo: ShapeInfo;\n infLoc: WebGLUniformLocation;\n nanLoc: WebGLUniformLocation;\n inShapesLocations?: {[name: string]: WebGLUniformLocation};\n inTexShapesLocations?: {[name: string]: WebGLUniformLocation};\n outShapeLocation?: WebGLUniformLocation;\n outShapeStridesLocation?: WebGLUniformLocation;\n outTexShapeLocation?: WebGLUniformLocation;\n}\n\nexport interface GPGPUBinaryLocations {\n uniformLocations: {[name: string]: WebGLUniformLocation};\n customUniformLocations?: WebGLUniformLocation[];\n infLoc: WebGLUniformLocation;\n nanLoc: WebGLUniformLocation;\n inShapesLocations?: {[name: string]: WebGLUniformLocation};\n inTexShapesLocations?: {[name: string]: WebGLUniformLocation};\n outShapeLocation?: WebGLUniformLocation;\n outShapeStridesLocation?: WebGLUniformLocation;\n outTexShapeLocation?: WebGLUniformLocation;\n}\n\nexport interface TensorData {\n shape: number[];\n texData: TextureData;\n isUniform: boolean;\n // Available when we decide to upload as uniform instead of texture.\n uniformValues?: TypedArray;\n}\n\nexport function compileProgram(\n gpgpu: GPGPUContext, program: GPGPUProgram, inputs: TensorData[],\n output: TensorData): GPGPUBinary {\n const inputInfos: InputInfo[] = inputs.map((input, i) => {\n const shapeInfo: ShapeInfo = {\n logicalShape: input.shape,\n texShape: input.isUniform ? null : input.texData.texShape,\n isUniform: input.isUniform,\n isPacked: input.isUniform ? false : input.texData.isPacked,\n flatOffset: null\n };\n if (input.texData != null && input.texData.slice != null &&\n input.texData.slice.flatOffset > 0) {\n shapeInfo.flatOffset = input.texData.slice.flatOffset;\n }\n return {name: program.variableNames[i], shapeInfo};\n });\n const inShapeInfos = inputInfos.map(x => x.shapeInfo);\n const outShapeInfo: ShapeInfo = {\n logicalShape: output.shape,\n texShape: output.texData.texShape,\n isUniform: false,\n isPacked: output.texData.isPacked,\n flatOffset: null\n };\n const source = shader_compiler.makeShader(inputInfos, outShapeInfo, program);\n const fragmentShader = createFragmentShader(gpgpu.gl, source);\n const webGLProgram = gpgpu.createProgram(fragmentShader);\n\n if (!env().get('ENGINE_COMPILE_ONLY')) {\n return {\n program,\n fragmentShader,\n source,\n webGLProgram,\n inShapeInfos,\n outShapeInfo,\n ...getUniformLocations(gpgpu, program, webGLProgram)\n };\n } else {\n return {\n program,\n fragmentShader,\n source,\n webGLProgram,\n inShapeInfos,\n outShapeInfo,\n uniformLocations: null,\n customUniformLocations: null,\n infLoc: null,\n nanLoc: null,\n inShapesLocations: null,\n inTexShapesLocations: null,\n outShapeLocation: null,\n outShapeStridesLocation: null,\n outTexShapeLocation: null\n };\n }\n}\n\nexport function getUniformLocations(\n gpgpu: GPGPUContext, program: GPGPUProgram,\n webGLProgram: WebGLProgram): GPGPUBinaryLocations {\n const uniformLocations: {[name: string]: WebGLUniformLocation} = {};\n const inShapesLocations: {[name: string]: WebGLUniformLocation} = {};\n const inTexShapesLocations: {[name: string]: WebGLUniformLocation} = {};\n const customUniformLocations: WebGLUniformLocation[] = [];\n let outShapeLocation: WebGLUniformLocation;\n let outTexShapeLocation: WebGLUniformLocation;\n let outShapeStridesLocation: WebGLUniformLocation;\n let infLoc: WebGLUniformLocation = null;\n let nanLoc: WebGLUniformLocation = null;\n\n // Add special uniforms (NAN, INFINITY)\n nanLoc = gpgpu.getUniformLocation(webGLProgram, 'NAN', false);\n if (env().getNumber('WEBGL_VERSION') === 1) {\n infLoc = gpgpu.getUniformLocation(webGLProgram, 'INFINITY', false);\n }\n\n // Add user-defined uniforms\n const shouldThrow = false;\n for (let i = 0; i < program.variableNames.length; i++) {\n const varName = program.variableNames[i];\n uniformLocations[varName] =\n gpgpu.getUniformLocation(webGLProgram, varName, shouldThrow);\n uniformLocations[`offset${varName}`] =\n gpgpu.getUniformLocation(webGLProgram, `offset${varName}`, shouldThrow);\n if (program.enableShapeUniforms) {\n inShapesLocations[`${varName}Shape`] = gpgpu.getUniformLocation(\n webGLProgram, `${varName}Shape`, shouldThrow);\n inTexShapesLocations[`${varName}TexShape`] = gpgpu.getUniformLocation(\n webGLProgram, `${varName}TexShape`, shouldThrow);\n }\n }\n\n if (program.enableShapeUniforms) {\n outShapeLocation =\n gpgpu.getUniformLocation(webGLProgram, 'outShape', shouldThrow);\n outShapeStridesLocation =\n gpgpu.getUniformLocation(webGLProgram, 'outShapeStrides', shouldThrow);\n outTexShapeLocation =\n gpgpu.getUniformLocation(webGLProgram, 'outTexShape', shouldThrow);\n }\n\n if (program.customUniforms) {\n program.customUniforms.forEach((d, i) => {\n customUniformLocations[i] =\n gpgpu.getUniformLocation(webGLProgram, d.name, shouldThrow);\n });\n }\n\n return {\n uniformLocations,\n customUniformLocations,\n infLoc,\n nanLoc,\n inShapesLocations,\n inTexShapesLocations,\n outShapeLocation,\n outShapeStridesLocation,\n outTexShapeLocation\n };\n}\n\nfunction validateBinaryAndProgram(\n shapeInfos: ShapeInfo[], inputs: TensorData[]) {\n if (shapeInfos.length !== inputs.length) {\n throw Error(\n `Binary was compiled with ${shapeInfos.length} inputs, but ` +\n `was executed with ${inputs.length} inputs`);\n }\n\n shapeInfos.forEach((s, i) => {\n const shapeA = s.logicalShape;\n const input = inputs[i];\n const shapeB = input.shape;\n\n if (!util.arraysEqual(shapeA, shapeB)) {\n throw Error(\n `Binary was compiled with different shapes than ` +\n `the current args. Shapes ${shapeA} and ${shapeB} must match`);\n }\n // The input is uploaded as uniform.\n if (s.isUniform && input.isUniform) {\n return;\n }\n\n const texShapeA = s.texShape;\n const texShapeB = input.isUniform ? null : input.texData.texShape;\n if (!util.arraysEqual(texShapeA, texShapeB)) {\n throw Error(\n `Binary was compiled with different texture shapes than the` +\n ` current args. Shape ${texShapeA} and ${texShapeB} must match`);\n }\n });\n}\n\nexport function runProgram(\n gpgpu: GPGPUContext, binary: GPGPUBinary, inputs: TensorData[],\n output: TensorData, customUniformValues?: number[][]): void {\n if (!binary.program.enableShapeUniforms) {\n validateBinaryAndProgram(binary.inShapeInfos, inputs);\n validateBinaryAndProgram([binary.outShapeInfo], [output]);\n }\n\n const outTex = output.texData.texture;\n const outTexShape = output.texData.texShape;\n if (output.texData.isPacked) {\n gpgpu.setOutputPackedMatrixTexture(\n outTex.texture, outTexShape[0], outTexShape[1]);\n } else {\n gpgpu.setOutputMatrixTexture(\n outTex.texture, outTexShape[0], outTexShape[1]);\n }\n gpgpu.setProgram(binary.webGLProgram);\n\n // Set special uniforms (NAN, INFINITY)\n if (env().getNumber('WEBGL_VERSION') === 1) {\n if (binary.infLoc !== null) {\n gpgpu.gl.uniform1f(binary.infLoc, Infinity);\n }\n }\n if (binary.nanLoc !== null) {\n gpgpu.gl.uniform1f(binary.nanLoc, NaN);\n }\n\n // Set user-defined inputs\n inputs.forEach((input, i) => {\n const varName = binary.program.variableNames[i];\n const varLoc = binary.uniformLocations[varName];\n const varOffsetLoc = binary.uniformLocations[`offset${varName}`];\n const varShapeLoc = binary.inShapesLocations[`${varName}Shape`];\n const varTexShapeLoc = binary.inTexShapesLocations[`${varName}TexShape`];\n\n if (varShapeLoc) {\n const {uniformShape} = shader_compiler.getUniformInfoFromShape(\n binary.program.packedInputs, input.shape, input.texData.texShape);\n switch (uniformShape.length) {\n case 1:\n gpgpu.gl.uniform1iv(varShapeLoc, new Int32Array(uniformShape));\n break;\n case 2:\n gpgpu.gl.uniform2iv(varShapeLoc, new Int32Array(uniformShape));\n break;\n case 3:\n gpgpu.gl.uniform3iv(varShapeLoc, new Int32Array(uniformShape));\n break;\n case 4:\n gpgpu.gl.uniform4iv(varShapeLoc, new Int32Array(uniformShape));\n break;\n default:\n break;\n }\n }\n if (varTexShapeLoc) {\n gpgpu.gl.uniform2i(\n varTexShapeLoc, input.texData.texShape[0], input.texData.texShape[1]);\n }\n\n if (varLoc == null) {\n // The compiler inferred that this variable is not used in this shader.\n return;\n }\n\n if (input.isUniform) {\n // Upload the values of the tensor as uniform.\n if (util.sizeFromShape(input.shape) < 2) {\n gpgpu.gl.uniform1f(varLoc, input.uniformValues[0]);\n } else {\n let vals = input.uniformValues;\n if (!(vals instanceof Float32Array)) {\n vals = new Float32Array(vals);\n }\n gpgpu.gl.uniform1fv(varLoc, vals);\n }\n return;\n }\n\n // If the input was sliced, upload the flat offset index.\n if (input.texData.slice != null && varOffsetLoc != null) {\n gpgpu.gl.uniform1i(varOffsetLoc, input.texData.slice.flatOffset);\n }\n\n gpgpu.setInputMatrixTexture(input.texData.texture.texture, varLoc, i);\n });\n\n const outShapeLoc = binary.outShapeLocation;\n if (outShapeLoc) {\n switch (output.shape.length) {\n case 1:\n gpgpu.gl.uniform1iv(outShapeLoc, new Int32Array(output.shape));\n break;\n case 2:\n gpgpu.gl.uniform2iv(outShapeLoc, new Int32Array(output.shape));\n break;\n case 3:\n gpgpu.gl.uniform3iv(outShapeLoc, new Int32Array(output.shape));\n break;\n case 4:\n gpgpu.gl.uniform4iv(outShapeLoc, new Int32Array(output.shape));\n break;\n default:\n break;\n }\n }\n if (binary.outShapeStridesLocation) {\n const strides = util.computeStrides(output.shape);\n switch (output.shape.length) {\n case 2:\n gpgpu.gl.uniform1iv(\n binary.outShapeStridesLocation, new Int32Array(strides));\n break;\n case 3:\n gpgpu.gl.uniform2iv(\n binary.outShapeStridesLocation, new Int32Array(strides));\n break;\n case 4:\n gpgpu.gl.uniform3iv(\n binary.outShapeStridesLocation, new Int32Array(strides));\n break;\n default:\n break;\n }\n }\n if (binary.outTexShapeLocation) {\n gpgpu.gl.uniform2i(\n binary.outTexShapeLocation, output.texData.texShape[0],\n output.texData.texShape[1]);\n }\n\n if (binary.program.customUniforms && customUniformValues) {\n binary.program.customUniforms.forEach((d, i) => {\n const customLoc = binary.customUniformLocations[i];\n const customValue = customUniformValues[i];\n if (d.type === 'float') {\n gpgpu.gl.uniform1fv(customLoc, customValue);\n } else if (d.type === 'vec2') {\n gpgpu.gl.uniform2fv(customLoc, customValue);\n } else if (d.type === 'vec3') {\n gpgpu.gl.uniform3fv(customLoc, customValue);\n } else if (d.type === 'vec4') {\n gpgpu.gl.uniform4fv(customLoc, customValue);\n } else if (d.type === 'int') {\n gpgpu.gl.uniform1iv(customLoc, customValue);\n } else if (d.type === 'ivec2') {\n gpgpu.gl.uniform2iv(customLoc, customValue);\n } else if (d.type === 'ivec3') {\n gpgpu.gl.uniform3iv(customLoc, customValue);\n } else if (d.type === 'ivec4') {\n gpgpu.gl.uniform4iv(customLoc, customValue);\n } else {\n throw Error(`uniform type ${d.type} is not supported yet.`);\n }\n });\n }\n gpgpu.executeProgram();\n}\n\nexport function makeShaderKey(\n program: GPGPUProgram, inputs: TensorData[], output: TensorData): string {\n let keyInputs = '';\n inputs.concat(output).forEach(x => {\n const hasOffset = x.texData != null && x.texData.slice != null &&\n x.texData.slice.flatOffset > 0;\n // TODO: Remove the condition of !x.isUniform.\n if (program.enableShapeUniforms && !x.isUniform) {\n const xTexShape = x.texData.texShape;\n const {useSqueezeShape, uniformShape, keptDims} =\n shader_compiler.getUniformInfoFromShape(\n program.packedInputs, x.shape, xTexShape);\n let rank1 = '', rank2 = '', rank34 = '';\n if (uniformShape.length === 1 && program.packedInputs) {\n const packedTexShape =\n [Math.ceil(xTexShape[0] / 2), Math.ceil(xTexShape[1] / 2)];\n rank1 = `${packedTexShape[0] > 1}_${packedTexShape[1] > 1}`;\n } else if (uniformShape.length === 2 && !program.packedInputs) {\n rank2 = `${uniformShape[0] > 1}_${uniformShape[1] > 1}`;\n } else if (uniformShape.length > 2 && !program.packedInputs) {\n const strides = util.computeStrides(uniformShape);\n rank34 = `${strides[0] === xTexShape[1]}_${\n strides[strides.length - 1] === xTexShape[1]}`;\n }\n const xRank = x.shape.length;\n const isLogicalShapTexShapeEqual =\n uniformShape.length === 2 && util.arraysEqual(x.shape, xTexShape);\n const isScalar = util.sizeFromShape(x.shape) === 1;\n const broadcastDims =\n backend_util.getBroadcastDims(x.shape, output.shape);\n const isInOutTexShapeEqual = !program.packedInputs &&\n xRank === output.shape.length &&\n util.arraysEqual(xTexShape, output.texData.texShape);\n const isTexShapeGreaterThanOne =\n program.packedInputs || uniformShape.length > 2 ?\n '' :\n `${xTexShape[0] > 1}_${xTexShape[1] > 1}`;\n // These key components are needed due to shader_compiler is embedding\n // them in the shader.\n // |xRank| is used to determine the coords length. See\n // get[Packed]SamplerAtOutputCoords.\n // |isInOutTexShapeEqual| is used to determine whether going to an\n // optimization path in getSamplerAtOutputCoords.\n // |useSqueezeShape| is extracted from squeezeInputInfo of\n // getSampler[2|3|4]D/getPackedSampler3D.\n // |isScalar| is extracted from isInputScalar/isOutputScalar in\n // getPackedSamplerAtOutputCoords.\n // |broadcastDims| is extracted from get[Packed]SamplerAtOutputCoords.\n // |isLogicalShapTexShapeEqual| is used in\n // getOutput[Packed]2DCoords/get[Packed]Sampler2D.\n // |rank1| is used in getOutputPacked1DCoords.\n // |rank2| is used in getOutput2DCoords.\n // |rank34| is used in getSampler3D/getSampler4D.\n // |isTexShapeGreaterThanOne| are used in\n // getSampler[Scalar|1D|2D]/getOutput1DCoords.\n keyInputs += `${xRank}_${isInOutTexShapeEqual}_${\n useSqueezeShape ? keptDims : ''}_${uniformShape.length}_${isScalar}_${\n broadcastDims}_${isLogicalShapTexShapeEqual}_${rank1}_${rank2}_${\n rank34}_${isTexShapeGreaterThanOne}_${hasOffset}`;\n } else {\n const texShape = x.isUniform ? 'uniform' : x.texData.texShape;\n keyInputs += `${x.shape}_${texShape}_${hasOffset}`;\n }\n });\n const keyUserCode = program.userCode;\n let key = program.constructor.name;\n // Fast string concat. See https://jsperf.com/string-concatenation/14.\n key += '_' + keyInputs + '_' + keyUserCode +\n `${env().getNumber('WEBGL_VERSION')}`;\n return key;\n}\n\nexport function useShapeUniforms(rank: number) {\n // TODO: Remove the limitaion of rank <= 4.\n return env().getBool('WEBGL_USE_SHAPES_UNIFORMS') && rank <= 4;\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getGlslDifferences} from './glsl_version';\nimport {GPGPUProgram, useShapeUniforms} from './gpgpu_math';\nimport * as shader_util from './shader_compiler_util';\nimport {PackingScheme} from './tex_util';\n\nexport class DecodeMatrixProgram implements GPGPUProgram {\n variableNames = ['A'];\n userCode: string;\n outputShape: [number, number, number];\n packedInputs = false;\n packedOutput = true;\n outPackingScheme = PackingScheme.DENSE;\n enableShapeUniforms: boolean;\n customUniforms = [{name: 'texShape', type: 'ivec2' as const }];\n\n constructor(outputShape: [number, number, number]) {\n const glsl = getGlslDifferences();\n this.outputShape = outputShape;\n this.enableShapeUniforms = useShapeUniforms(this.outputShape.length);\n\n this.userCode = `\n ivec3 outCoordsFromFlatIndex(int index) {\n ${\n this.enableShapeUniforms ?\n shader_util.getOutputLogicalCoordinatesFromFlatIndexByUniform(\n ['r', 'c', 'd'], outputShape) :\n shader_util.getLogicalCoordinatesFromFlatIndex(\n ['r', 'c', 'd'], outputShape)}\n return ivec3(r, c, d);\n }\n\n void main() {\n ivec2 resTexRC = ivec2(resultUV.yx * vec2(texShape[0], texShape[1]));\n int index = 4 * (resTexRC.x * texShape[1] + resTexRC.y);\n\n vec4 result = vec4(0.);\n\n for (int i=0; i<4; i++) {\n int flatIndex = index + i;\n ivec3 rc = outCoordsFromFlatIndex(flatIndex);\n result[i] = getA(rc.x, rc.y, rc.z);\n }\n\n ${glsl.output} = result;\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getGlslDifferences} from './glsl_version';\nimport {GPGPUProgram, useShapeUniforms} from './gpgpu_math';\nimport * as shader_util from './shader_compiler_util';\nimport {PackingScheme} from './tex_util';\n\nexport class DecodeMatrixPackedProgram implements GPGPUProgram {\n variableNames = ['A'];\n userCode: string;\n packedInputs = true;\n packedOutput = true;\n outputShape: [number, number, number];\n outPackingScheme = PackingScheme.DENSE;\n enableShapeUniforms: boolean;\n customUniforms = [{name: 'texShape', type: 'ivec2' as const }];\n\n constructor(outputShape: [number, number, number]) {\n const glsl = getGlslDifferences();\n this.outputShape = outputShape;\n this.enableShapeUniforms = useShapeUniforms(this.outputShape.length);\n\n this.userCode = `\n ivec3 outCoordsFromFlatIndex(int index) {\n ${\n this.enableShapeUniforms ?\n shader_util.getOutputLogicalCoordinatesFromFlatIndexByUniform(\n ['r', 'c', 'd'], outputShape) :\n shader_util.getLogicalCoordinatesFromFlatIndex(\n ['r', 'c', 'd'], outputShape)}\n return ivec3(r, c, d);\n }\n\n void main() {\n ivec2 resTexRC = ivec2(resultUV.yx * vec2(texShape[0], texShape[1]));\n int index = 4 * (resTexRC.x * texShape[1] + resTexRC.y);\n\n vec4 result = vec4(0.);\n\n for (int i=0; i<4; i++) {\n int flatIndex = index + i;\n ivec3 rc = outCoordsFromFlatIndex(flatIndex);\n result[i] = getChannel(getA(rc.x, rc.y, rc.z), vec2(rc.y, rc.z));\n }\n\n ${glsl.output} = result;\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getGlslDifferences} from './glsl_version';\nimport {GPGPUProgram} from './gpgpu_math';\nimport {ENCODE_FLOAT_SNIPPET} from './shader_compiler_util';\nimport {TextureUsage} from './tex_util';\n\nexport class EncodeFloatProgram implements GPGPUProgram {\n variableNames = ['A'];\n userCode: string;\n outputShape: number[];\n outTexUsage = TextureUsage.DOWNLOAD;\n\n constructor(outputShape: number[]) {\n const glsl = getGlslDifferences();\n this.outputShape = outputShape;\n this.userCode = `\n ${ENCODE_FLOAT_SNIPPET}\n\n void main() {\n float x = getAAtOutCoords();\n ${glsl.output} = encode_float(x);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getGlslDifferences} from './glsl_version';\nimport {GPGPUProgram} from './gpgpu_math';\nimport {ENCODE_FLOAT_SNIPPET} from './shader_compiler_util';\nimport {TextureUsage} from './tex_util';\n\nexport class EncodeFloatPackedProgram implements GPGPUProgram {\n variableNames = ['A'];\n userCode: string;\n outputShape: number[];\n packedInputs = true;\n packedOutput = false;\n outTexUsage = TextureUsage.DOWNLOAD;\n\n constructor(outputShape: [number, number, number]) {\n const glsl = getGlslDifferences();\n this.outputShape = outputShape;\n this.userCode = `\n ${ENCODE_FLOAT_SNIPPET}\n\n void main() {\n ivec3 coords = getOutputCoords();\n float x = getChannel(getAAtOutCoords(), vec2(coords.y, coords.z));\n ${glsl.output} = encode_float(x);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getGlslDifferences} from './glsl_version';\nimport {GPGPUProgram, useShapeUniforms} from './gpgpu_math';\nimport * as shader_util from './shader_compiler_util';\n\nconst CHANNEL_CHAR_TO_INDEX_MAP: Record = {\n 'R': 0,\n 'G': 1,\n 'B': 2,\n 'A': 3\n};\n\nexport class EncodeMatrixProgram implements GPGPUProgram {\n variableNames = ['A'];\n userCode: string;\n outputShape: number[];\n enableShapeUniforms: boolean;\n customUniforms = [{name: 'texShape', type: 'ivec2' as const }];\n\n constructor(\n outputShape: [number, number, number], inputIsUnsignedByte = false,\n usedChannels = 'RGBA') {\n const glsl = getGlslDifferences();\n this.outputShape = outputShape;\n this.enableShapeUniforms = useShapeUniforms(this.outputShape.length);\n\n let output = `result`;\n if (inputIsUnsignedByte) {\n output = `floor(result * 255. + 0.5)`;\n }\n\n let mainLoop = '';\n for (let usedChannelIndex = 0; usedChannelIndex < usedChannels.length;\n usedChannelIndex++) {\n const curChannel = usedChannels[usedChannelIndex];\n mainLoop += `\n if(offset == ${usedChannelIndex}) {\n result = values[${CHANNEL_CHAR_TO_INDEX_MAP[curChannel]}];\n }`;\n }\n\n this.userCode = `\n ${\n this.enableShapeUniforms ? shader_util.getFlatIndexFrom3DOutput() :\n shader_util.getFlatIndexFrom3D(outputShape)}\n\n void main() {\n ivec3 coords = getOutputCoords();\n int flatIndex = getFlatIndex(coords);\n float result = 0.;\n int offset = imod(flatIndex, ${usedChannels.length});\n\n flatIndex = idiv(flatIndex, ${usedChannels.length}, 1.);\n\n int r = flatIndex / texShape[1];\n if (r < texShape[0]) {\n int c = imod(flatIndex, texShape[1]);\n vec2 uv = (vec2(c, r) + halfCR) / vec2(texShape[1], texShape[0]);\n vec4 values = ${glsl.texture2D}(A, uv);\n ${mainLoop}\n }\n ${glsl.output} = vec4(${output}, 0., 0., 0.);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getGlslDifferences} from './glsl_version';\nimport {GPGPUProgram, useShapeUniforms} from './gpgpu_math';\nimport * as shader_util from './shader_compiler_util';\n\n/*\nThis is how the shader encodes a tensor with shape = [2, 3, 5]\n(indices are [batch, row, col]).\n\n000|001 002|003 004|xxx 020|021 022|023 024|xxx\n------- ------- ------- ------- ------- -------\n010|011 012|013 014|xxx xxx|xxx xxx|xxx xxx|xxx\n\n100|101 102|103 104|xxx 120|121 122|123 124|xxx\n------- ------- ------- ------- ------- -------\n110|111 112|113 114|xxx xxx|xxx xxx|xxx xxx|xxx\n\nSingle texels contain only values from the same batch, and from adjacent rows\nand columns.\n */\n\nexport class EncodeMatrixPackedProgram implements GPGPUProgram {\n variableNames = ['A'];\n userCode: string;\n outputShape: number[];\n packedInputs = false;\n packedOutput = true;\n enableShapeUniforms: boolean;\n customUniforms = [{name: 'texShape', type: 'ivec2' as const }];\n\n constructor(\n outputShape: [number, number, number], inputIsUnsignedByte = false) {\n const glsl = getGlslDifferences();\n this.outputShape = outputShape;\n this.enableShapeUniforms = useShapeUniforms(this.outputShape.length);\n\n let mainLoop = '';\n let output = 'result';\n if (inputIsUnsignedByte) {\n output = 'floor(result * 255. + 0.5)';\n }\n\n for (let row = 0; row <= 1; row++) {\n for (let col = 0; col <= 1; col++) {\n const channel = row * 2 + col;\n\n mainLoop += `\n localCoords = coords;\n if(localCoords[2] + ${col} < ${\n this.enableShapeUniforms ? 'outShape[2]' : `${outputShape[2]}`}) {\n localCoords[2] += ${col};\n if (localCoords[1] + ${row} < ${\n this.enableShapeUniforms ? 'outShape[1]' : `${outputShape[1]}`}) {\n localCoords[1] += ${row};\n\n flatIndex = getFlatIndex(localCoords);\n offset = imod(flatIndex, 4);\n\n flatIndex = idiv(flatIndex, 4, 1.);\n\n int r = flatIndex / texShape[1];\n int c = imod(flatIndex, texShape[1]);\n vec2 uv = (vec2(c, r) + halfCR) / vec2(texShape[1], texShape[0]);\n values = ${glsl.texture2D}(A, uv);\n\n if (offset == 0) {\n result[${channel}] = values[0];\n } else if (offset == 1) {\n result[${channel}] = values[1];\n } else if (offset == 2) {\n result[${channel}] = values[2];\n } else {\n result[${channel}] = values[3];\n }\n }\n }\n `;\n }\n }\n\n this.userCode = `\n ${\n this.enableShapeUniforms ? shader_util.getFlatIndexFrom3DOutput() :\n shader_util.getFlatIndexFrom3D(outputShape)}\n\n void main() {\n ivec3 coords = getOutputCoords();\n\n vec4 result = vec4(0.);\n int flatIndex, r, c, offset;\n ivec3 localCoords;\n vec2 uv;\n vec4 values;\n\n ${mainLoop}\n\n ${glsl.output} = ${output};\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env, PixelData, TypedArray} from '@tensorflow/tfjs-core';\n\nimport {getGlslDifferences} from './glsl_version';\nimport * as tex_util from './tex_util';\nimport {Texture, TextureConfig} from './tex_util';\nimport * as webgl_util from './webgl_util';\n\nexport function createVertexShader(gl: WebGLRenderingContext): WebGLShader {\n const glsl = getGlslDifferences();\n const vertexShaderSource = `${glsl.version}\n precision highp float;\n ${glsl.attribute} vec3 clipSpacePos;\n ${glsl.attribute} vec2 uv;\n ${glsl.varyingVs} vec2 resultUV;\n\n void main() {\n gl_Position = vec4(clipSpacePos, 1);\n resultUV = uv;\n }`;\n return webgl_util.createVertexShader(gl, vertexShaderSource);\n}\n\nexport function createVertexBuffer(gl: WebGLRenderingContext): WebGLBuffer {\n // [x y z u v] * [upper-left, lower-left, upper-right, lower-right]\n const vertexArray = new Float32Array(\n [-1, 1, 0, 0, 1, -1, -1, 0, 0, 0, 1, 1, 0, 1, 1, 1, -1, 0, 1, 0]);\n return webgl_util.createStaticVertexBuffer(gl, vertexArray);\n}\n\nexport function createIndexBuffer(gl: WebGLRenderingContext): WebGLBuffer {\n // OpenGL (and WebGL) have \"CCW == front\" winding\n const triangleVertexIndices = new Uint16Array([0, 1, 2, 2, 1, 3]);\n return webgl_util.createStaticIndexBuffer(gl, triangleVertexIndices);\n}\n\nfunction createAndConfigureTexture(\n gl: WebGLRenderingContext, width: number, height: number,\n internalFormat: number, textureFormat: number,\n textureType: number): Texture {\n webgl_util.validateTextureSize(width, height);\n const texture = webgl_util.createTexture(gl);\n\n const tex2d = gl.TEXTURE_2D;\n webgl_util.callAndCheck(gl, () => gl.bindTexture(tex2d, texture));\n webgl_util.callAndCheck(\n gl, () => gl.texParameteri(tex2d, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE));\n webgl_util.callAndCheck(\n gl, () => gl.texParameteri(tex2d, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE));\n webgl_util.callAndCheck(\n gl, () => gl.texParameteri(tex2d, gl.TEXTURE_MIN_FILTER, gl.NEAREST));\n webgl_util.callAndCheck(\n gl, () => gl.texParameteri(tex2d, gl.TEXTURE_MAG_FILTER, gl.NEAREST));\n if (env().getNumber('WEBGL_VERSION') === 1) {\n webgl_util.callAndCheck(\n gl,\n () => gl.texImage2D(\n tex2d, 0, internalFormat, width, height, 0, textureFormat,\n textureType, null));\n } else {\n webgl_util.callAndCheck(\n gl,\n () => (gl as WebGL2RenderingContext)\n .texStorage2D(tex2d, 1, internalFormat, width, height));\n }\n webgl_util.callAndCheck(gl, () => gl.bindTexture(gl.TEXTURE_2D, null));\n\n return {texture, texShape: [height, width]};\n}\n\nexport function getInternalFormatForFloat32MatrixTexture(\n textureConfig: TextureConfig) {\n return textureConfig.internalFormatFloat;\n}\n\nexport function createFloat32MatrixTexture(\n gl: WebGLRenderingContext, rows: number, columns: number,\n textureConfig: TextureConfig): Texture {\n const [width, height] =\n tex_util.getUnpackedMatrixTextureShapeWidthHeight(rows, columns);\n return createAndConfigureTexture(\n gl, width, height,\n getInternalFormatForFloat32MatrixTexture(textureConfig),\n textureConfig.textureFormatFloat, gl.FLOAT);\n}\n\nexport function getInternalFormatForFloat16MatrixTexture(\n textureConfig: TextureConfig) {\n return textureConfig.internalFormatHalfFloat;\n}\n\nexport function createFloat16MatrixTexture(\n gl: WebGLRenderingContext, rows: number, columns: number,\n textureConfig: TextureConfig): Texture {\n const [width, height] =\n tex_util.getUnpackedMatrixTextureShapeWidthHeight(rows, columns);\n return createAndConfigureTexture(\n gl, width, height,\n getInternalFormatForFloat16MatrixTexture(textureConfig),\n textureConfig.textureFormatFloat, textureConfig.textureTypeHalfFloat);\n}\n\nexport function getInternalFormatForUnsignedBytesMatrixTexture(\n textureConfig: TextureConfig) {\n return textureConfig.downloadTextureFormat;\n}\n\nexport function createUnsignedBytesMatrixTexture(\n gl: WebGLRenderingContext, rows: number, columns: number,\n textureConfig: TextureConfig): Texture {\n const [width, height] =\n tex_util.getUnpackedMatrixTextureShapeWidthHeight(rows, columns);\n return createAndConfigureTexture(\n gl, width, height,\n getInternalFormatForUnsignedBytesMatrixTexture(textureConfig), gl.RGBA,\n gl.UNSIGNED_BYTE);\n}\n\nexport function getInternalFormatForPackedMatrixTexture(\n textureConfig: TextureConfig) {\n return textureConfig.internalFormatPackedFloat;\n}\n\nexport function createPackedMatrixTexture(\n gl: WebGLRenderingContext, rows: number, columns: number,\n textureConfig: TextureConfig): Texture {\n const [width, height] =\n tex_util.getPackedMatrixTextureShapeWidthHeight(rows, columns);\n return createAndConfigureTexture(\n gl, width, height, getInternalFormatForPackedMatrixTexture(textureConfig),\n gl.RGBA, gl.FLOAT);\n}\n\nexport function getInternalFormatForFloat16PackedMatrixTexture(\n textureConfig: TextureConfig) {\n return textureConfig.internalFormatPackedHalfFloat;\n}\n\nexport function createFloat16PackedMatrixTexture(\n gl: WebGLRenderingContext, rows: number, columns: number,\n textureConfig: TextureConfig): Texture {\n const [width, height] =\n tex_util.getPackedMatrixTextureShapeWidthHeight(rows, columns);\n return createAndConfigureTexture(\n gl, width, height,\n getInternalFormatForFloat16PackedMatrixTexture(textureConfig), gl.RGBA,\n textureConfig.textureTypeHalfFloat);\n}\n\nexport function bindVertexProgramAttributeStreams(\n gl: WebGLRenderingContext, program: WebGLProgram,\n vertexBuffer: WebGLBuffer): boolean {\n const posOffset = 0; // x is the first buffer element\n const uvOffset = 3 * 4; // uv comes after [x y z]\n const stride = (3 * 4) + (2 * 4); // xyz + uv, each entry is 4-byte float.\n webgl_util.callAndCheck(\n gl, () => gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer));\n const success = webgl_util.bindVertexBufferToProgramAttribute(\n gl, program, 'clipSpacePos', vertexBuffer, 3, stride, posOffset);\n return success &&\n webgl_util.bindVertexBufferToProgramAttribute(\n gl, program, 'uv', vertexBuffer, 2, stride, uvOffset);\n}\n\nexport function uploadDenseMatrixToTexture(\n gl: WebGLRenderingContext, texture: WebGLTexture, width: number,\n height: number, data: TypedArray, textureConfig: TextureConfig) {\n webgl_util.callAndCheck(gl, () => gl.bindTexture(gl.TEXTURE_2D, texture));\n\n let dataForUpload: TypedArray, texelDataType: number, internalFormat: number;\n if (data instanceof Uint8Array) {\n dataForUpload = new Uint8Array(width * height * 4);\n texelDataType = gl.UNSIGNED_BYTE;\n internalFormat = gl.RGBA;\n } else {\n dataForUpload = new Float32Array(width * height * 4);\n texelDataType = gl.FLOAT;\n internalFormat = textureConfig.internalFormatPackedFloat;\n }\n\n dataForUpload.set(data);\n if (env().getNumber('WEBGL_VERSION') === 2) {\n webgl_util.callAndCheck(\n gl,\n () => gl.texSubImage2D(\n gl.TEXTURE_2D, 0, 0, 0, width, height, gl.RGBA, texelDataType,\n dataForUpload));\n } else {\n webgl_util.callAndCheck(\n gl,\n () => gl.texImage2D(\n gl.TEXTURE_2D, 0, internalFormat, width, height, 0, gl.RGBA,\n texelDataType, dataForUpload));\n }\n\n webgl_util.callAndCheck(gl, () => gl.bindTexture(gl.TEXTURE_2D, null));\n}\n\nexport function uploadPixelDataToTexture(\n gl: WebGLRenderingContext, texture: WebGLTexture,\n pixels: PixelData|ImageData|HTMLImageElement|HTMLCanvasElement|\n HTMLVideoElement|ImageBitmap) {\n webgl_util.callAndCheck(gl, () => gl.bindTexture(gl.TEXTURE_2D, texture));\n if ((pixels as PixelData).data instanceof Uint8Array) {\n if (env().getNumber('WEBGL_VERSION') === 2) {\n webgl_util.callAndCheck(\n gl,\n () => gl.texSubImage2D(\n gl.TEXTURE_2D, 0, 0, 0, pixels.width, pixels.height, gl.RGBA,\n gl.UNSIGNED_BYTE, (pixels as PixelData).data));\n } else {\n webgl_util.callAndCheck(\n gl,\n () => gl.texImage2D(\n gl.TEXTURE_2D, 0, gl.RGBA, pixels.width, pixels.height, 0,\n gl.RGBA, gl.UNSIGNED_BYTE, (pixels as PixelData).data));\n }\n } else {\n if (env().getNumber('WEBGL_VERSION') === 2) {\n webgl_util.callAndCheck(\n gl,\n () => gl.texSubImage2D(\n gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE,\n (pixels as ImageData | HTMLImageElement | HTMLCanvasElement |\n HTMLVideoElement | ImageBitmap)));\n } else {\n webgl_util.callAndCheck(\n gl,\n () => gl.texImage2D(\n gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE,\n pixels as ImageData | HTMLImageElement | HTMLCanvasElement |\n HTMLVideoElement | ImageBitmap));\n }\n }\n\n webgl_util.callAndCheck(gl, () => gl.bindTexture(gl.TEXTURE_2D, null));\n}\n\nexport function createBufferFromOutputTexture(\n gl2: WebGL2RenderingContext, rows: number, columns: number,\n textureConfig: TextureConfig): WebGLBuffer {\n // Create and bind the buffer.\n const buffer = gl2.createBuffer();\n webgl_util.callAndCheck(\n gl2, () => gl2.bindBuffer(gl2.PIXEL_PACK_BUFFER, buffer));\n\n // Initialize the buffer to the size of the texture in bytes.\n const bytesPerFloat = 4;\n const valuesPerTexel = 4;\n const bufferSizeBytes = bytesPerFloat * valuesPerTexel * rows * columns;\n\n webgl_util.callAndCheck(\n gl2,\n () => gl2.bufferData(\n gl2.PIXEL_PACK_BUFFER, bufferSizeBytes, gl2.STREAM_READ));\n\n // Enqueue a command on the GPU command queue to copy of texture into the\n // buffer.\n webgl_util.callAndCheck(\n gl2, () => gl2.readPixels(0, 0, columns, rows, gl2.RGBA, gl2.FLOAT, 0));\n\n webgl_util.callAndCheck(\n gl2, () => gl2.bindBuffer(gl2.PIXEL_PACK_BUFFER, null));\n\n return buffer;\n}\n\nexport function downloadFloat32MatrixFromBuffer(\n gl: WebGLRenderingContext, buffer: WebGLBuffer,\n size: number): Float32Array {\n const gl2 = gl as WebGL2RenderingContext;\n\n const downloadTarget = new Float32Array(size);\n\n gl2.bindBuffer(gl2.PIXEL_PACK_BUFFER, buffer);\n gl2.getBufferSubData(gl2.PIXEL_PACK_BUFFER, 0, downloadTarget);\n gl2.bindBuffer(gl2.PIXEL_PACK_BUFFER, null);\n\n return downloadTarget;\n}\n\nexport function downloadByteEncodedFloatMatrixFromOutputTexture(\n gl: WebGLRenderingContext, rows: number, columns: number,\n textureConfig: TextureConfig) {\n const [w, h] =\n tex_util.getUnpackedMatrixTextureShapeWidthHeight(rows, columns);\n\n const numChannels = 4;\n const downloadTarget = new Uint8Array(\n tex_util.getUnpackedArraySizeFromMatrixSize(rows * columns, numChannels));\n\n webgl_util.callAndCheck(\n gl,\n () => gl.readPixels(\n 0, 0, w, h, textureConfig.downloadTextureFormat, gl.UNSIGNED_BYTE,\n downloadTarget));\n\n // By wrapping the buffer in a Float32Array, we use native browser IEEE 754\n // decoding of the 4 bytes that back each 32 bit float.\n return new Float32Array(downloadTarget.buffer);\n}\n\nexport function downloadPackedMatrixFromBuffer(\n gl: WebGLRenderingContext, buffer: WebGLBuffer, batch: number, rows: number,\n cols: number, physicalRows: number, physicalCols: number,\n textureConfig: TextureConfig): Float32Array {\n const gl2 = gl as WebGL2RenderingContext;\n\n const downloadTarget =\n new Float32Array(tex_util.getPackedRGBAArraySizeFromMatrixShape(\n physicalRows, physicalCols));\n\n gl2.bindBuffer(gl2.PIXEL_PACK_BUFFER, buffer);\n gl2.getBufferSubData(gl2.PIXEL_PACK_BUFFER, 0, downloadTarget);\n gl2.bindBuffer(gl2.PIXEL_PACK_BUFFER, null);\n\n return downloadTarget;\n}\n\nexport function downloadMatrixFromPackedOutputTexture(\n gl: WebGLRenderingContext, physicalRows: number,\n physicalCols: number): Float32Array {\n const packedRGBA = new Float32Array(physicalRows * physicalCols * 4);\n webgl_util.callAndCheck(\n gl,\n () => gl.readPixels(\n 0, 0, physicalCols, physicalRows, gl.RGBA, gl.FLOAT, packedRGBA));\n\n return packedRGBA;\n}\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env, PixelData, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {getWebGLContext, setWebGLContext} from './canvas_util';\nimport * as gpgpu_util from './gpgpu_util';\nimport * as tex_util from './tex_util';\nimport {Texture, TextureConfig} from './tex_util';\nimport {WebGL1DisjointQueryTimerExtension, WebGL2DisjointQueryTimerExtension, WebGLParallelCompilationExtension} from './webgl_types';\nimport * as webgl_util from './webgl_util';\n\nexport interface FenceContext {\n query: WebGLQuery|WebGLSync;\n isFencePassed(): boolean;\n}\n\nexport class GPGPUContext {\n gl: WebGLRenderingContext;\n textureFloatExtension: {};\n textureHalfFloatExtension: {};\n colorBufferFloatExtension: {};\n colorBufferHalfFloatExtension: {};\n disjointQueryTimerExtension: WebGL2DisjointQueryTimerExtension|\n WebGL1DisjointQueryTimerExtension;\n parallelCompilationExtension: WebGLParallelCompilationExtension;\n vertexBuffer: WebGLBuffer;\n indexBuffer: WebGLBuffer;\n framebuffer: WebGLFramebuffer;\n outputTexture: WebGLTexture|null = null;\n program: WebGLProgram|null = null;\n private disposed = false;\n private disjoint: boolean;\n private vertexShader: WebGLShader;\n textureConfig: TextureConfig;\n\n constructor(gl?: WebGLRenderingContext) {\n const glVersion = env().getNumber('WEBGL_VERSION');\n if (gl != null) {\n this.gl = gl;\n setWebGLContext(glVersion, gl);\n } else {\n this.gl = getWebGLContext(glVersion);\n }\n // WebGL 2.0 enables texture floats without an extension.\n let COLOR_BUFFER_FLOAT = 'WEBGL_color_buffer_float';\n const COLOR_BUFFER_HALF_FLOAT = 'EXT_color_buffer_half_float';\n this.parallelCompilationExtension =\n this.gl.getExtension('KHR_parallel_shader_compile');\n if (env().getNumber('WEBGL_VERSION') === 1) {\n const TEXTURE_FLOAT = 'OES_texture_float';\n const TEXTURE_HALF_FLOAT = 'OES_texture_half_float';\n\n this.textureFloatExtension =\n webgl_util.getExtensionOrThrow(this.gl, TEXTURE_FLOAT);\n if (webgl_util.hasExtension(this.gl, TEXTURE_HALF_FLOAT)) {\n this.textureHalfFloatExtension =\n webgl_util.getExtensionOrThrow(this.gl, TEXTURE_HALF_FLOAT);\n } else if (env().get('WEBGL_FORCE_F16_TEXTURES')) {\n throw new Error(\n 'GL context does not support half float textures, yet the ' +\n 'environment flag WEBGL_FORCE_F16_TEXTURES is set to true.');\n }\n\n this.colorBufferFloatExtension = this.gl.getExtension(COLOR_BUFFER_FLOAT);\n if (webgl_util.hasExtension(this.gl, COLOR_BUFFER_HALF_FLOAT)) {\n this.colorBufferHalfFloatExtension =\n webgl_util.getExtensionOrThrow(this.gl, COLOR_BUFFER_HALF_FLOAT);\n } else if (env().get('WEBGL_FORCE_F16_TEXTURES')) {\n throw new Error(\n 'GL context does not support color renderable half floats, yet ' +\n 'the environment flag WEBGL_FORCE_F16_TEXTURES is set to true.');\n }\n } else {\n COLOR_BUFFER_FLOAT = 'EXT_color_buffer_float';\n if (webgl_util.hasExtension(this.gl, COLOR_BUFFER_FLOAT)) {\n this.colorBufferFloatExtension =\n this.gl.getExtension(COLOR_BUFFER_FLOAT);\n } else if (webgl_util.hasExtension(this.gl, COLOR_BUFFER_HALF_FLOAT)) {\n this.colorBufferHalfFloatExtension =\n this.gl.getExtension(COLOR_BUFFER_HALF_FLOAT);\n } else {\n throw new Error('GL context does not support color renderable floats');\n }\n }\n\n this.vertexBuffer = gpgpu_util.createVertexBuffer(this.gl);\n this.indexBuffer = gpgpu_util.createIndexBuffer(this.gl);\n this.framebuffer = webgl_util.createFramebuffer(this.gl);\n\n this.textureConfig =\n tex_util.getTextureConfig(this.gl, this.textureHalfFloatExtension);\n }\n\n private get debug(): boolean {\n return env().getBool('DEBUG');\n }\n\n public dispose() {\n if (this.disposed) {\n return;\n }\n if (this.program != null) {\n console.warn(\n 'Disposing a GPGPUContext that still has a bound WebGLProgram.' +\n ' This is probably a resource leak, delete the program with ' +\n 'GPGPUContext.deleteProgram before disposing.');\n }\n if (this.outputTexture != null) {\n console.warn(\n 'Disposing a GPGPUContext that still has a bound output matrix ' +\n 'texture. This is probably a resource leak, delete the output ' +\n 'matrix texture with GPGPUContext.deleteMatrixTexture before ' +\n 'disposing.');\n }\n const gl = this.gl;\n webgl_util.callAndCheck(gl, () => gl.finish());\n webgl_util.callAndCheck(gl, () => gl.bindFramebuffer(gl.FRAMEBUFFER, null));\n webgl_util.callAndCheck(gl, () => gl.deleteFramebuffer(this.framebuffer));\n webgl_util.callAndCheck(gl, () => gl.bindBuffer(gl.ARRAY_BUFFER, null));\n webgl_util.callAndCheck(\n gl, () => gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null));\n webgl_util.callAndCheck(gl, () => gl.deleteBuffer(this.indexBuffer));\n this.disposed = true;\n }\n\n public createFloat32MatrixTexture(rows: number, columns: number): Texture {\n this.throwIfDisposed();\n return gpgpu_util.createFloat32MatrixTexture(\n this.gl, rows, columns, this.textureConfig);\n }\n\n public createFloat16MatrixTexture(rows: number, columns: number): Texture {\n this.throwIfDisposed();\n return gpgpu_util.createFloat16MatrixTexture(\n this.gl, rows, columns, this.textureConfig);\n }\n\n public createUnsignedBytesMatrixTexture(rows: number, columns: number):\n Texture {\n this.throwIfDisposed();\n return gpgpu_util.createUnsignedBytesMatrixTexture(\n this.gl, rows, columns, this.textureConfig);\n }\n\n public uploadPixelDataToTexture(\n texture: WebGLTexture,\n pixels: PixelData|ImageData|HTMLImageElement|HTMLCanvasElement|\n ImageBitmap) {\n this.throwIfDisposed();\n gpgpu_util.uploadPixelDataToTexture(this.gl, texture, pixels);\n }\n\n public uploadDenseMatrixToTexture(\n texture: WebGLTexture, width: number, height: number, data: TypedArray) {\n this.throwIfDisposed();\n gpgpu_util.uploadDenseMatrixToTexture(\n this.gl, texture, width, height, data, this.textureConfig);\n }\n\n public createFloat16PackedMatrixTexture(rows: number, columns: number):\n Texture {\n this.throwIfDisposed();\n return gpgpu_util.createFloat16PackedMatrixTexture(\n this.gl, rows, columns, this.textureConfig);\n }\n\n public createPackedMatrixTexture(rows: number, columns: number): Texture {\n this.throwIfDisposed();\n return gpgpu_util.createPackedMatrixTexture(\n this.gl, rows, columns, this.textureConfig);\n }\n\n public deleteMatrixTexture(texture: WebGLTexture) {\n this.throwIfDisposed();\n if (this.outputTexture === texture) {\n webgl_util.unbindColorTextureFromFramebuffer(this.gl, this.framebuffer);\n this.outputTexture = null;\n }\n webgl_util.callAndCheck(this.gl, () => this.gl.deleteTexture(texture));\n }\n\n public downloadByteEncodedFloatMatrixFromOutputTexture(\n texture: WebGLTexture, rows: number, columns: number): Float32Array {\n return this.downloadMatrixDriver(\n texture,\n () => gpgpu_util.downloadByteEncodedFloatMatrixFromOutputTexture(\n this.gl, rows, columns, this.textureConfig));\n }\n\n public downloadPackedMatrixFromBuffer(\n buffer: WebGLBuffer, batch: number, rows: number, columns: number,\n physicalRows: number, physicalCols: number): Float32Array {\n return gpgpu_util.downloadPackedMatrixFromBuffer(\n this.gl, buffer, batch, rows, columns, physicalRows, physicalCols,\n this.textureConfig);\n }\n\n public downloadFloat32MatrixFromBuffer(buffer: WebGLBuffer, size: number):\n Float32Array {\n return gpgpu_util.downloadFloat32MatrixFromBuffer(this.gl, buffer, size);\n }\n\n public createBufferFromTexture(\n texture: WebGLTexture, rows: number, columns: number): WebGLBuffer {\n this.bindTextureToFrameBuffer(texture);\n const result = gpgpu_util.createBufferFromOutputTexture(\n this.gl as WebGL2RenderingContext, rows, columns, this.textureConfig);\n this.unbindTextureToFrameBuffer();\n return result;\n }\n\n public createAndWaitForFence(): Promise {\n const fenceContext = this.createFence(this.gl);\n return this.pollFence(fenceContext);\n }\n\n private createFence(gl: WebGLRenderingContext): FenceContext {\n let query: WebGLQuery|WebGLSync;\n let isFencePassed: () => boolean;\n\n if (env().getBool('WEBGL_FENCE_API_ENABLED')) {\n const gl2 = gl as WebGL2RenderingContext;\n\n const sync = gl2.fenceSync(gl2.SYNC_GPU_COMMANDS_COMPLETE, 0);\n gl.flush();\n\n isFencePassed = () => {\n const status = gl2.clientWaitSync(sync, 0, 0);\n return status === gl2.ALREADY_SIGNALED ||\n status === gl2.CONDITION_SATISFIED;\n };\n\n query = sync;\n } else if (\n env().getNumber('WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION') > 0) {\n query = this.beginQuery();\n this.endQuery();\n isFencePassed = () => this.isQueryAvailable(\n query,\n env().getNumber('WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION'));\n } else {\n // If we have no way to fence, return true immediately. This will fire in\n // WebGL 1.0 when there is no disjoint query timer. In this case, because\n // the fence passes immediately, we'll immediately ask for a download of\n // the texture, which will cause the UI thread to hang.\n isFencePassed = () => true;\n }\n\n return {query, isFencePassed};\n }\n\n public downloadMatrixFromPackedTexture(\n texture: WebGLTexture, physicalRows: number,\n physicalCols: number): Float32Array {\n return this.downloadMatrixDriver(\n texture,\n () => gpgpu_util.downloadMatrixFromPackedOutputTexture(\n this.gl, physicalRows, physicalCols));\n }\n\n private vertexAttrsAreBound = false;\n\n public createProgram(fragmentShader: WebGLShader): WebGLProgram {\n this.throwIfDisposed();\n const gl = this.gl;\n if (this.vertexShader == null) {\n this.vertexShader = gpgpu_util.createVertexShader(gl);\n }\n const program: WebGLProgram = webgl_util.createProgram(gl);\n webgl_util.callAndCheck(\n gl, () => gl.attachShader(program, this.vertexShader));\n webgl_util.callAndCheck(gl, () => gl.attachShader(program, fragmentShader));\n webgl_util.linkProgram(gl, program);\n if (this.debug) {\n webgl_util.validateProgram(gl, program);\n }\n if (!this.vertexAttrsAreBound) {\n this.setProgram(program);\n this.vertexAttrsAreBound = gpgpu_util.bindVertexProgramAttributeStreams(\n gl, this.program, this.vertexBuffer);\n }\n return program;\n }\n\n public deleteProgram(program: WebGLProgram) {\n this.throwIfDisposed();\n if (program === this.program) {\n this.program = null;\n }\n if (program != null) {\n webgl_util.callAndCheck(this.gl, () => this.gl.deleteProgram(program));\n }\n }\n\n public setProgram(program: WebGLProgram|null) {\n this.throwIfDisposed();\n this.program = program;\n if ((this.program != null) && this.debug) {\n webgl_util.validateProgram(this.gl, this.program);\n }\n webgl_util.callAndCheck(this.gl, () => this.gl.useProgram(program));\n }\n\n public getUniformLocation(\n program: WebGLProgram, uniformName: string,\n shouldThrow = true): WebGLUniformLocation {\n this.throwIfDisposed();\n if (shouldThrow) {\n return webgl_util.getProgramUniformLocationOrThrow(\n this.gl, program, uniformName);\n } else {\n return webgl_util.getProgramUniformLocation(\n this.gl, program, uniformName);\n }\n }\n\n public getAttributeLocation(program: WebGLProgram, attribute: string):\n number {\n this.throwIfDisposed();\n return webgl_util.callAndCheck(\n this.gl, () => this.gl.getAttribLocation(program, attribute));\n }\n\n public getUniformLocationNoThrow(program: WebGLProgram, uniformName: string):\n WebGLUniformLocation {\n this.throwIfDisposed();\n return this.gl.getUniformLocation(program, uniformName);\n }\n\n public setInputMatrixTexture(\n inputMatrixTexture: WebGLTexture, uniformLocation: WebGLUniformLocation,\n textureUnit: number) {\n this.throwIfDisposed();\n this.throwIfNoProgram();\n webgl_util.bindTextureToProgramUniformSampler(\n this.gl, inputMatrixTexture, uniformLocation, textureUnit);\n }\n\n public setOutputMatrixTexture(\n outputMatrixTexture: WebGLTexture, rows: number, columns: number) {\n this.setOutputMatrixTextureDriver(outputMatrixTexture, columns, rows);\n }\n\n public setOutputPackedMatrixTexture(\n outputPackedMatrixTexture: WebGLTexture, rows: number, columns: number) {\n this.throwIfDisposed();\n const [width, height] =\n tex_util.getPackedMatrixTextureShapeWidthHeight(rows, columns);\n this.setOutputMatrixTextureDriver(outputPackedMatrixTexture, width, height);\n }\n\n public setOutputMatrixWriteRegion(\n startRow: number, numRows: number, startColumn: number,\n numColumns: number) {\n this.setOutputMatrixWriteRegionDriver(\n startColumn, startRow, numColumns, numRows);\n }\n\n public setOutputPackedMatrixWriteRegion(\n startRow: number, numRows: number, startColumn: number,\n numColumns: number) {\n throw new Error('setOutputPackedMatrixWriteRegion not implemented.');\n }\n\n public debugValidate() {\n if (this.program != null) {\n webgl_util.validateProgram(this.gl, this.program);\n }\n webgl_util.validateFramebuffer(this.gl);\n }\n\n public executeProgram() {\n this.throwIfDisposed();\n this.throwIfNoProgram();\n const gl = this.gl;\n if (this.debug) {\n this.debugValidate();\n }\n webgl_util.callAndCheck(\n gl, () => gl.drawElements(gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0));\n }\n\n public blockUntilAllProgramsCompleted() {\n this.throwIfDisposed();\n webgl_util.callAndCheck(this.gl, () => this.gl.finish());\n }\n\n private getQueryTimerExtension(): WebGL1DisjointQueryTimerExtension\n |WebGL2DisjointQueryTimerExtension {\n if (this.disjointQueryTimerExtension == null) {\n this.disjointQueryTimerExtension =\n webgl_util.getExtensionOrThrow(\n this.gl,\n env().getNumber(\n 'WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION') === 2 ?\n 'EXT_disjoint_timer_query_webgl2' :\n 'EXT_disjoint_timer_query') as\n WebGL1DisjointQueryTimerExtension |\n WebGL2DisjointQueryTimerExtension;\n }\n return this.disjointQueryTimerExtension;\n }\n\n private getQueryTimerExtensionWebGL2(): WebGL2DisjointQueryTimerExtension {\n return this.getQueryTimerExtension();\n }\n\n private getQueryTimerExtensionWebGL1(): WebGL1DisjointQueryTimerExtension {\n return this.getQueryTimerExtension() as WebGL1DisjointQueryTimerExtension;\n }\n\n beginQuery(): WebGLQuery {\n if (env().getNumber('WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION') === 2) {\n const gl2 = this.gl as WebGL2RenderingContext;\n const ext = this.getQueryTimerExtensionWebGL2();\n\n const query = gl2.createQuery();\n gl2.beginQuery(ext.TIME_ELAPSED_EXT, query);\n return query;\n }\n const ext = this.getQueryTimerExtensionWebGL1();\n const query = ext.createQueryEXT() as WebGLQuery;\n ext.beginQueryEXT(ext.TIME_ELAPSED_EXT, query);\n return query;\n }\n\n endQuery() {\n if (env().getNumber('WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION') === 2) {\n const gl2 = this.gl as WebGL2RenderingContext;\n const ext = this.getQueryTimerExtensionWebGL2();\n gl2.endQuery(ext.TIME_ELAPSED_EXT);\n return;\n }\n const ext = this.getQueryTimerExtensionWebGL1();\n ext.endQueryEXT(ext.TIME_ELAPSED_EXT);\n }\n\n public async waitForQueryAndGetTime(query: WebGLQuery): Promise {\n await util.repeatedTry(\n () => this.disposed || // while testing contexts are created / disposed\n // in rapid succession, so without this check we\n // may poll for the query timer indefinitely\n this.isQueryAvailable(\n query,\n env().getNumber(\n 'WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION')));\n return this.getQueryTime(\n query, env().getNumber('WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION'));\n }\n\n private getQueryTime(query: WebGLQuery, queryTimerVersion: number): number {\n if (queryTimerVersion === 0) {\n return null;\n }\n\n if (queryTimerVersion === 2) {\n const gl2 = this.gl as WebGL2RenderingContext;\n\n const timeElapsedNanos = gl2.getQueryParameter(query, gl2.QUERY_RESULT);\n // Return milliseconds.\n return timeElapsedNanos / 1000000;\n } else {\n const ext = this.getQueryTimerExtensionWebGL1();\n\n const timeElapsedNanos =\n ext.getQueryObjectEXT(query, ext.QUERY_RESULT_EXT);\n // Return milliseconds.\n return timeElapsedNanos / 1000000;\n }\n }\n\n private isQueryAvailable(query: WebGLQuery, queryTimerVersion: number):\n boolean {\n if (queryTimerVersion === 0) {\n return true;\n }\n\n if (queryTimerVersion === 2) {\n const gl2 = this.gl as WebGL2RenderingContext;\n const ext = this.getQueryTimerExtensionWebGL2();\n\n const available =\n gl2.getQueryParameter(query, gl2.QUERY_RESULT_AVAILABLE);\n if (this.disjoint == null) {\n this.disjoint = this.gl.getParameter(ext.GPU_DISJOINT_EXT);\n }\n\n return available && !this.disjoint;\n } else {\n const ext = this.getQueryTimerExtensionWebGL1();\n\n const available =\n ext.getQueryObjectEXT(query, ext.QUERY_RESULT_AVAILABLE_EXT);\n if (this.disjoint == null) {\n this.disjoint = this.gl.getParameter(ext.GPU_DISJOINT_EXT);\n }\n\n return available && !this.disjoint;\n }\n }\n\n pollFence(fenceContext: FenceContext) {\n return new Promise(resolve => {\n this.addItemToPoll(() => fenceContext.isFencePassed(), () => resolve());\n });\n }\n\n private itemsToPoll: PollItem[] = [];\n\n pollItems(): void {\n // Find the last query that has finished.\n const index = linearSearchLastTrue(this.itemsToPoll.map(x => x.isDoneFn));\n for (let i = 0; i <= index; ++i) {\n const {resolveFn} = this.itemsToPoll[i];\n resolveFn();\n }\n this.itemsToPoll = this.itemsToPoll.slice(index + 1);\n }\n\n private addItemToPoll(isDoneFn: () => boolean, resolveFn: () => void) {\n this.itemsToPoll.push({isDoneFn, resolveFn});\n if (this.itemsToPoll.length > 1) {\n // We already have a running loop that polls.\n return;\n }\n // Start a new loop that polls.\n let scheduleFn = undefined;\n if ('setTimeoutCustom' in env().platform) {\n scheduleFn = env().platform.setTimeoutCustom.bind(env().platform);\n }\n util.repeatedTry(() => {\n this.pollItems();\n // End the loop if no more items to poll.\n return this.itemsToPoll.length === 0;\n }, () => 0, null, scheduleFn);\n }\n\n private bindTextureToFrameBuffer(texture: WebGLTexture) {\n this.throwIfDisposed();\n webgl_util.bindColorTextureToFramebuffer(\n this.gl, texture, this.framebuffer);\n if (this.debug) {\n webgl_util.validateFramebuffer(this.gl);\n }\n }\n\n private unbindTextureToFrameBuffer() {\n if (this.outputTexture != null) {\n webgl_util.bindColorTextureToFramebuffer(\n this.gl, this.outputTexture, this.framebuffer);\n if (this.debug) {\n webgl_util.validateFramebuffer(this.gl);\n }\n } else {\n webgl_util.unbindColorTextureFromFramebuffer(this.gl, this.framebuffer);\n }\n }\n\n private downloadMatrixDriver(\n texture: WebGLTexture,\n downloadAndDecode: () => Float32Array): Float32Array {\n this.bindTextureToFrameBuffer(texture);\n const result = downloadAndDecode();\n this.unbindTextureToFrameBuffer();\n\n return result;\n }\n\n private setOutputMatrixTextureDriver(\n outputMatrixTextureMaybePacked: WebGLTexture, width: number,\n height: number) {\n this.throwIfDisposed();\n const gl = this.gl;\n webgl_util.bindColorTextureToFramebuffer(\n gl, outputMatrixTextureMaybePacked, this.framebuffer);\n if (this.debug) {\n webgl_util.validateFramebuffer(gl);\n }\n this.outputTexture = outputMatrixTextureMaybePacked;\n webgl_util.callAndCheck(gl, () => gl.viewport(0, 0, width, height));\n webgl_util.callAndCheck(gl, () => gl.scissor(0, 0, width, height));\n }\n\n private setOutputMatrixWriteRegionDriver(\n x: number, y: number, width: number, height: number) {\n this.throwIfDisposed();\n webgl_util.callAndCheck(\n this.gl, () => this.gl.scissor(x, y, width, height));\n }\n\n private throwIfDisposed() {\n if (this.disposed) {\n throw new Error('Attempted to use disposed GPGPUContext.');\n }\n }\n\n private throwIfNoProgram() {\n if (this.program == null) {\n throw new Error('No GPU program is currently set.');\n }\n }\n}\n\ntype PollItem = {\n isDoneFn: () => boolean,\n resolveFn: () => void\n};\n\n/**\n * Finds the index of the last true element using linear search.\n * Note: We can't do binary search because Chrome expects us to explicitly\n * test all fences before download:\n * https://github.com/tensorflow/tfjs/issues/1145\n */\nexport function linearSearchLastTrue(arr: Array<() => boolean>): number {\n let i = 0;\n for (; i < arr.length; ++i) {\n const isDone = arr[i]();\n if (!isDone) {\n break;\n }\n }\n return i - 1;\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {TensorInfo, util} from '@tensorflow/tfjs-core';\n\nexport function assertNotComplex(\n tensor: TensorInfo|TensorInfo[], opName: string): void {\n if (!Array.isArray(tensor)) {\n tensor = [tensor];\n }\n tensor.forEach(t => {\n if (t != null) {\n util.assert(\n t.dtype !== 'complex64',\n () => `${\n opName} does not support complex64 tensors in the CPU backend.`);\n }\n });\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the License);\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an AS IS BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Abs, AbsInputs, KernelConfig, KernelFunc, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendCPU} from '../backend_cpu';\nimport {assertNotComplex} from '../cpu_util';\n\nexport function simpleAbsImpl(vals: TypedArray): Float32Array {\n const resultValues = new Float32Array(vals.length);\n for (let i = 0; i < vals.length; ++i) {\n resultValues[i] = Math.abs(vals[i]);\n }\n return resultValues;\n}\n\nexport const abs = (args: {inputs: AbsInputs, backend: MathBackendCPU}) => {\n const {x} = args.inputs;\n const cpuBackend = args.backend;\n\n assertNotComplex(x, 'abs');\n\n let resultValues = new Float32Array(util.sizeFromShape(x.shape));\n const values = cpuBackend.data.get(x.dataId).values as TypedArray;\n resultValues = simpleAbsImpl(values);\n\n return cpuBackend.makeOutput(resultValues, x.shape, x.dtype);\n};\n\nexport const absConfig: KernelConfig = {\n kernelName: Abs,\n backendName: 'cpu',\n kernelFunc: abs as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, DataType, DataValues, NumericDataType, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {SimpleBinaryKernelImpl, SimpleBinaryOperation} from './binary_types';\n\n/**\n * Template that creates implementation for binary ops. Supports broadcast.\n */\nexport function createSimpleBinaryKernelImpl(op: SimpleBinaryOperation):\n SimpleBinaryKernelImpl {\n return (aShape: number[], bShape: number[], aVals: DataValues,\n bVals: DataValues, dtype: DataType): [TypedArray, number[]] => {\n const newShape = backend_util.assertAndGetBroadcastShape(aShape, bShape);\n\n const resultRank = newShape.length;\n const resultStrides = util.computeStrides(newShape);\n const resultSize = util.sizeFromShape(newShape);\n\n const result =\n util.getTypedArrayFromDType(dtype as NumericDataType, resultSize);\n\n const aRank = aShape.length;\n const bRank = bShape.length;\n\n const aStrides = util.computeStrides(aShape);\n const bStrides = util.computeStrides(bShape);\n\n const aBroadcastDims = backend_util.getBroadcastDims(aShape, newShape);\n const bBroadcastDims = backend_util.getBroadcastDims(bShape, newShape);\n\n if (aBroadcastDims.length + bBroadcastDims.length === 0) {\n for (let i = 0; i < result.length; ++i) {\n result[i] = op(aVals[i % aVals.length], bVals[i % bVals.length]);\n }\n } else {\n for (let i = 0; i < result.length; ++i) {\n const loc = util.indexToLoc(i, resultRank, resultStrides);\n\n const aLoc = loc.slice(-aRank);\n aBroadcastDims.forEach(d => aLoc[d] = 0);\n const aIndex = util.locToIndex(aLoc, aRank, aStrides);\n\n const bLoc = loc.slice(-bRank);\n bBroadcastDims.forEach(d => bLoc[d] = 0);\n const bIndex = util.locToIndex(bLoc, bRank, bStrides);\n\n result[i] = op(aVals[aIndex], bVals[bIndex]);\n }\n }\n\n return [result, newShape];\n };\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Complex, ComplexInputs, KernelConfig, KernelFunc, TensorInfo, TypedArray} from '@tensorflow/tfjs-core';\n\nimport {MathBackendCPU} from '../backend_cpu';\n\nexport function complex(args: {inputs: ComplexInputs, backend: MathBackendCPU}):\n TensorInfo {\n const {inputs, backend} = args;\n const {real, imag} = inputs;\n\n const realVals = backend.data.get(real.dataId).values as TypedArray;\n const imagVals = backend.data.get(imag.dataId).values as TypedArray;\n\n const complexInfo = backend.makeTensorInfo(real.shape, 'complex64');\n\n const complex = backend.data.get(complexInfo.dataId);\n\n // The complex tensor owns the underlying real and imag tensorInfos, only the\n // complex tensor tracks refCount, when complexData is disposed the\n // underlying tensorData will be disposed.\n complex.complexTensorInfos = {\n real: backend.makeTensorInfo(real.shape, 'float32', realVals),\n imag: backend.makeTensorInfo(imag.shape, 'float32', imagVals)\n };\n\n return complexInfo;\n}\n\nexport const complexConfig: KernelConfig = {\n kernelName: Complex,\n backendName: 'cpu',\n kernelFunc: complex as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataType, TensorInfo, util} from '@tensorflow/tfjs-core';\nimport {MathBackendCPU} from '../backend_cpu';\nimport {complex} from '../kernels/Complex';\n\n/**\n * Generates a tensorInfo with all zeros value.\n * @param backend cpu backend.\n * @param shape Shape for the zeros tensor.\n * @param dtype Optional. If set, the result has this dtype.\n */\nexport function zeros(\n backend: MathBackendCPU, shape: number[],\n dtype: DataType = 'float32'): TensorInfo {\n if (dtype === 'complex64') {\n const real = zeros(backend, shape, 'float32');\n const imag = zeros(backend, shape, 'float32');\n\n return complex({inputs: {real, imag}, backend});\n }\n\n const values = util.makeZerosTypedArray(util.sizeFromShape(shape), dtype);\n\n return backend.makeTensorInfo(shape, dtype, values);\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Identity, IdentityInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendCPU} from '../backend_cpu';\n\nexport function identity(\n args: {inputs: IdentityInputs, backend: MathBackendCPU}): TensorInfo {\n const {inputs, backend} = args;\n const {x} = inputs;\n\n backend.incRef(x.dataId);\n\n return {dataId: x.dataId, shape: x.shape, dtype: x.dtype};\n}\n\nexport const identityConfig: KernelConfig = {\n kernelName: Identity,\n backendName: 'cpu',\n kernelFunc: identity as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Real, RealInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendCPU} from '../backend_cpu';\n\nexport function real(args: {inputs: RealInputs, backend: MathBackendCPU}):\n TensorInfo {\n const {inputs, backend} = args;\n const {input} = inputs;\n\n const real = backend.data.get(input.dataId).complexTensorInfos.real;\n const realVal = backend.data.get(real.dataId).values;\n\n // When complex tensor is disposed, its underlying parts will be disposed too.\n // Make new tensor out of the real value of the complex. This makes sure the\n // value is still accessible even if complex tensor is disposed.\n return backend.makeTensorInfo(real.shape, real.dtype, realVal);\n}\n\nexport const realConfig: KernelConfig = {\n kernelName: Real,\n backendName: 'cpu',\n kernelFunc: real as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Cast, CastAttrs, CastInputs, DataType, KernelConfig, KernelFunc, TensorInfo, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendCPU} from '../backend_cpu';\nimport {createSimpleBinaryKernelImpl} from '../utils/binary_impl';\nimport {zeros} from '../utils/zeros_impl';\n\nimport {complex} from './Complex';\nimport {identity} from './Identity';\nimport {real} from './Real';\n\nexport function castImpl(\n values: TypedArray, shape: number[], inputType: DataType,\n dtype: DataType): [number[], DataType, TypedArray] {\n if (dtype === 'int32') {\n const resultValues = Int32Array.from(values);\n return [shape, 'int32', resultValues];\n }\n\n if (dtype === 'bool') {\n // This is essentially the result of notEqual(x, 0). We avoid using\n // kernel notEqual to avoid circular dependency, i.e. binary_utils ->\n // cast -> notEqual -> binary_utils.\n const zero = util.toTypedArray([0], inputType);\n\n const [resultData, resultShape] = createSimpleBinaryKernelImpl(\n (a, b) => (a !== b) ? 1 : 0)(shape, [], values, zero, 'bool');\n\n return [resultShape, 'bool', resultData];\n }\n throw new Error(`Error in Cast: failed to cast ${inputType} to ${dtype}`);\n}\n\nexport function cast(\n args: {inputs: CastInputs, backend: MathBackendCPU, attrs: CastAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {dtype} = attrs;\n\n // Casting to complex64.\n if (dtype === 'complex64') {\n if (x.dtype === 'complex64') {\n return identity({inputs: {x}, backend});\n }\n\n const zerosTensorInfo = zeros(backend, x.shape, x.dtype);\n const floatX = cast({inputs: {x}, backend, attrs: {dtype: 'float32'}});\n\n const result =\n complex({inputs: {real: floatX, imag: zerosTensorInfo}, backend});\n\n backend.disposeIntermediateTensorInfo(zerosTensorInfo);\n backend.disposeIntermediateTensorInfo(floatX);\n\n return result;\n }\n\n // Casting from complex64\n if (x.dtype === 'complex64') {\n const realPart = real({inputs: {input: x}, backend});\n const result = cast({inputs: {x: realPart}, backend, attrs: {dtype}});\n\n backend.disposeIntermediateTensorInfo(realPart);\n\n return result;\n }\n\n if (!util.hasEncodingLoss(x.dtype, dtype)) {\n // We don't change the underlying data, since we cast to higher\n // precision.\n const result = identity({inputs: {x}, backend});\n return {dataId: result.dataId, shape: result.shape, dtype};\n }\n\n const values = backend.data.get(x.dataId).values as TypedArray;\n const [resultShape, resultType, resultData] =\n castImpl(values, x.shape, x.dtype, dtype);\n return backend.makeTensorInfo(resultShape, resultType, resultData);\n}\n\nexport const castConfig: KernelConfig = {\n kernelName: Cast,\n backendName: 'cpu',\n kernelFunc: cast as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, BinaryInputs, DataType, KernelFunc, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendCPU} from '../backend_cpu';\nimport {assertNotComplex} from '../cpu_util';\nimport {cast} from '../kernels/Cast';\nimport {complex} from '../kernels/Complex';\n\nimport {ComplexBinaryKernelImpl, ComplexBinaryOperation, SimpleBinaryKernelImpl} from './binary_types';\n\n/**\n * Template that creates a `KernelFunc` for binary ops.\n * @param name Kernel name.\n * @param binaryKernelImpl A `SimpleBinaryKernelImpl` for the kernel.\n * @param binaryKernelComplexImpl Optional. If exists, represents a\n * `ComplexBinaryKernelImpl` for the kernel, will be used when input dtype\n * is `complex64`.\n * @param dtype Optional. If set, the result has this dtype. Otherwise, the\n * result has the same dtype as the first input. This is mainly used in\n * comparison kernels, such as Equal, Less, Greater, etc.\n */\nexport function binaryKernelFunc(\n name: string, simpleImpl: SimpleBinaryKernelImpl,\n complexImpl?: ComplexBinaryKernelImpl, dtype?: DataType): KernelFunc {\n if (complexImpl == null) {\n return ({inputs, backend}) => {\n const {a, b} = inputs as BinaryInputs;\n const cpuBackend = backend as MathBackendCPU;\n\n assertNotComplex([a, b], name);\n\n const aVals = cpuBackend.data.get(a.dataId).values as TypedArray;\n const bVals = cpuBackend.data.get(b.dataId).values as TypedArray;\n\n const decodedAVals = a.dtype === 'string' ?\n // tslint:disable-next-line: no-any\n backend_util.fromUint8ToStringArray(aVals as any as Uint8Array[]) :\n aVals;\n const decodedBVals = a.dtype === 'string' ?\n // tslint:disable-next-line: no-any\n backend_util.fromUint8ToStringArray(bVals as any as Uint8Array[]) :\n bVals;\n const $dtype = dtype || a.dtype;\n\n const [resultData, resultShape] =\n simpleImpl(a.shape, b.shape, decodedAVals, decodedBVals, $dtype);\n\n return cpuBackend.makeTensorInfo(resultShape, $dtype, resultData);\n };\n }\n\n return ({inputs, backend}) => {\n const {a, b} = inputs as BinaryInputs;\n const cpuBackend = backend as MathBackendCPU;\n\n if (a.dtype === 'complex64' || b.dtype === 'complex64') {\n const $aComplex = cast(\n {inputs: {x: a}, backend: cpuBackend, attrs: {dtype: 'complex64'}});\n\n const $aComplexVals = cpuBackend.data.get($aComplex.dataId);\n\n const aReal = $aComplexVals.complexTensorInfos.real;\n const aImag = $aComplexVals.complexTensorInfos.imag;\n\n const aRealVals =\n cpuBackend.data.get(aReal.dataId).values as Float32Array;\n const aImagVals =\n cpuBackend.data.get(aImag.dataId).values as Float32Array;\n\n const $bComplex = cast(\n {inputs: {x: b}, backend: cpuBackend, attrs: {dtype: 'complex64'}});\n\n const $bComplexVals = cpuBackend.data.get($bComplex.dataId);\n\n const bReal = $bComplexVals.complexTensorInfos.real;\n const bImag = $bComplexVals.complexTensorInfos.imag;\n\n const bRealVals =\n cpuBackend.data.get(bReal.dataId).values as Float32Array;\n const bImagVals =\n cpuBackend.data.get(bImag.dataId).values as Float32Array;\n\n const [resultRealData, resultImagData, resultShape] = complexImpl(\n a.shape, b.shape, aRealVals, aImagVals, bRealVals, bImagVals);\n\n const resultReal =\n cpuBackend.makeTensorInfo(resultShape, 'float32', resultRealData);\n\n const resultImag =\n cpuBackend.makeTensorInfo(resultShape, 'float32', resultImagData);\n\n const result = complex(\n {inputs: {real: resultReal, imag: resultImag}, backend: cpuBackend});\n\n cpuBackend.disposeIntermediateTensorInfo($aComplex);\n cpuBackend.disposeIntermediateTensorInfo($bComplex);\n cpuBackend.disposeIntermediateTensorInfo(resultReal);\n cpuBackend.disposeIntermediateTensorInfo(resultImag);\n\n return result;\n } else {\n const aVals = cpuBackend.data.get(a.dataId).values as TypedArray;\n const bVals = cpuBackend.data.get(b.dataId).values as TypedArray;\n\n const $dtype = dtype || a.dtype;\n\n const [resultData, resultShape] =\n simpleImpl(a.shape, b.shape, aVals, bVals, $dtype);\n\n return cpuBackend.makeTensorInfo(resultShape, $dtype, resultData);\n }\n };\n}\n\n/**\n * Template that creates the complex type implementation for binary ops.\n * Supports broadcast.\n */\nexport function createComplexBinaryKernelImpl(op: ComplexBinaryOperation):\n ComplexBinaryKernelImpl {\n return (aShape: number[], bShape: number[], aRealVals: Float32Array,\n aImagVals: Float32Array, bRealVals: Float32Array,\n bImagVals: Float32Array): [TypedArray, TypedArray, number[]] => {\n const resultShape = backend_util.assertAndGetBroadcastShape(aShape, bShape);\n const resultSize = util.sizeFromShape(resultShape);\n const resultRank = resultShape.length;\n const resultStrides = util.computeStrides(resultShape);\n\n const resultRealVals = util.getTypedArrayFromDType('float32', resultSize);\n const resultImagVals = util.getTypedArrayFromDType('float32', resultSize);\n\n const aBroadcastDims = backend_util.getBroadcastDims(aShape, resultShape);\n const bBroadcastDims = backend_util.getBroadcastDims(bShape, resultShape);\n\n const aVals = backend_util.mergeRealAndImagArrays(aRealVals, aImagVals);\n const bVals = backend_util.mergeRealAndImagArrays(bRealVals, bImagVals);\n\n const aRank = aShape.length;\n const aStrides = util.computeStrides(aShape);\n\n const bRank = bShape.length;\n const bStrides = util.computeStrides(bShape);\n\n if (aBroadcastDims.length + bBroadcastDims.length === 0) {\n for (let i = 0; i < resultRealVals.length; i++) {\n const aIdx = i % aVals.length;\n const bIdx = i % bVals.length;\n\n const result =\n op(aVals[aIdx * 2], aVals[aIdx * 2 + 1], bVals[bIdx * 2],\n bVals[bIdx * 2 + 1]);\n\n resultRealVals[i] = result.real;\n resultImagVals[i] = result.imag;\n }\n } else {\n for (let i = 0; i < resultRealVals.length; i++) {\n const loc = util.indexToLoc(i, resultRank, resultStrides);\n\n const aLoc = loc.slice(-aRank);\n aBroadcastDims.forEach(d => aLoc[d] = 0);\n const aIndex = util.locToIndex(aLoc, aRank, aStrides);\n\n const bLoc = loc.slice(-bRank);\n bBroadcastDims.forEach(d => bLoc[d] = 0);\n const bIndex = util.locToIndex(bLoc, bRank, bStrides);\n\n const opResult =\n op(aVals[aIndex * 2], aVals[aIndex * 2 + 1], bVals[bIndex * 2],\n bVals[bIndex * 2 + 1]);\n\n resultRealVals[i] = opResult.real;\n resultImagVals[i] = opResult.imag;\n }\n }\n return [resultRealVals, resultImagVals, resultShape];\n };\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Add, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {createSimpleBinaryKernelImpl} from '../utils/binary_impl';\nimport {binaryKernelFunc, createComplexBinaryKernelImpl} from '../utils/binary_utils';\n\nexport const addImpl =\n createSimpleBinaryKernelImpl(((a: number, b: number) => a + b));\nexport const addComplexImpl =\n createComplexBinaryKernelImpl(((aReal, aImag, bReal, bImag) => {\n return {real: aReal + bReal, imag: aImag + bImag};\n }));\n\nexport const add = binaryKernelFunc(Add, addImpl, addComplexImpl);\n\nexport const addConfig: KernelConfig = {\n kernelName: Add,\n backendName: 'cpu',\n kernelFunc: add\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {buffer, DataType, Rank, TensorBuffer, TypedArray, util} from '@tensorflow/tfjs-core';\n\nexport function bincountImpl(\n xVals: TypedArray, weightsVals: TypedArray, weightsDtype: DataType,\n weightsShape: number[], size: number): TypedArray {\n const weightsSize = util.sizeFromShape(weightsShape);\n const outVals = util.makeZerosTypedArray(size, weightsDtype) as TypedArray;\n\n for (let i = 0; i < xVals.length; i++) {\n const value = xVals[i];\n if (value < 0) {\n throw new Error('Input x must be non-negative!');\n }\n\n if (value >= size) {\n continue;\n }\n\n if (weightsSize > 0) {\n outVals[value] += weightsVals[i];\n } else {\n outVals[value] += 1;\n }\n }\n\n return outVals;\n}\n\nexport function bincountReduceImpl(\n xBuf: TensorBuffer, weightsBuf: TensorBuffer, size: number,\n binaryOutput = false): TensorBuffer {\n const numRows = xBuf.shape[0];\n const numCols = xBuf.shape[1];\n\n const outBuf = buffer([numRows, size], weightsBuf.dtype);\n\n for (let i = 0; i < numRows; i++) {\n for (let j = 0; j < numCols; j++) {\n const value = xBuf.get(i, j);\n if (value < 0) {\n throw new Error('Input x must be non-negative!');\n }\n\n if (value >= size) {\n continue;\n }\n\n if (binaryOutput) {\n outBuf.set(1, i, value);\n } else {\n if (weightsBuf.size > 0) {\n outBuf.set(outBuf.get(i, value) + weightsBuf.get(i, j), i, value);\n } else {\n outBuf.set(outBuf.get(i, value) + 1, i, value);\n }\n }\n }\n }\n\n return outBuf as TensorBuffer;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {NumericDataType, util} from '@tensorflow/tfjs-core';\n\nimport {SimpleUnaryImpl, SimpleUnaryOperation} from './unary_types';\n\n/**\n * Template that creates implementation for unary op.\n */\nexport function createSimpleUnaryImpl(op: SimpleUnaryOperation):\n SimpleUnaryImpl {\n return (values, dtype, attrs) => {\n const newValues =\n util.getTypedArrayFromDType(dtype as NumericDataType, values.length);\n for (let i = 0; i < values.length; ++i) {\n newValues[i] = op(values[i], attrs);\n }\n return newValues;\n };\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataType, KernelFunc, TypedArray, UnaryInputs, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendCPU} from '../backend_cpu';\nimport {assertNotComplex} from '../cpu_util';\n\nimport {SimpleUnaryImpl, SimpleUnaryOperation} from './unary_types';\n\n/**\n * Template that creates a `KernelFunc` for unary ops.\n * @param name Kernel name.\n * @param op A `SimpleUnaryOperation` for the kernel.\n * @param dtype Optional. If set, the result has this dtype. Otherwise, the\n * result has the same dtype as the input. This is mainly used in certain\n * kernels that return bool type, such as isFinite, isInf, etc.\n */\nexport function unaryKernelFunc(\n name: string, op: SimpleUnaryOperation, dtype?: DataType): KernelFunc {\n return ({inputs, attrs, backend}) => {\n const {x} = inputs as UnaryInputs;\n assertNotComplex(x, name);\n if (x.dtype === 'string' || dtype === 'string') {\n throw new Error('unaryKernelFunc does not support string input/output');\n }\n\n const cpuBackend = backend as MathBackendCPU;\n const values = cpuBackend.data.get(x.dataId).values as TypedArray;\n const xSize = util.sizeFromShape(x.shape);\n const $dtype = dtype || x.dtype;\n const newValues = util.getArrayFromDType($dtype, xSize);\n for (let i = 0; i < xSize; ++i) {\n newValues[i] = op(values[i], attrs);\n }\n return cpuBackend.makeTensorInfo(x.shape, $dtype, newValues);\n };\n}\n\n/**\n * Template that creates a `KernelFunc` for unary ops from the given\n * `SimpleUnaryImpl`..\n * @param name Kernel name.\n * @param unaryImpl A `SimpleUnaryImpl` that implements the op.\n * @param dtype Optional. If set, the result has this dtype. Otherwise, the\n * result has the same dtype as the input. This is mainly used in certain\n * kernels that return bool type, such as isFinite, isInf, etc.\n */\nexport function unaryKernelFuncFromImpl(\n name: string, unaryImpl: SimpleUnaryImpl, dtype?: DataType): KernelFunc {\n return ({inputs, attrs, backend}) => {\n const {x} = inputs as UnaryInputs;\n assertNotComplex(x, name);\n if (x.dtype === 'string' || dtype === 'string') {\n throw new Error('unaryKernelFunc does not support string input/output');\n }\n\n const cpuBackend = backend as MathBackendCPU;\n const values = cpuBackend.data.get(x.dataId).values as TypedArray;\n const $dtype = dtype || x.dtype;\n const newValues = unaryImpl(values, $dtype, attrs);\n return cpuBackend.makeTensorInfo(x.shape, $dtype, newValues);\n };\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the License);\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an AS IS BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Ceil, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {createSimpleUnaryImpl} from '../utils/unary_impl';\nimport {unaryKernelFuncFromImpl} from '../utils/unary_utils';\n\nexport const ceilImpl = createSimpleUnaryImpl((xi) => Math.ceil(xi));\nexport const ceil = unaryKernelFuncFromImpl(Ceil, ceilImpl);\n\nexport const ceilConfig: KernelConfig = {\n kernelName: Ceil,\n backendName: 'cpu',\n kernelFunc: ceil,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, BackendValues, DataType, TypedArray, util} from '@tensorflow/tfjs-core';\n\nexport function concatImpl(\n inputs: Array<{vals: BackendValues, shape: number[]}>, outShape: number[],\n dtype: DataType, simplyConcat: boolean): TypedArray|string[] {\n const outVals = util.getArrayFromDType(dtype, util.sizeFromShape(outShape));\n\n if (simplyConcat && dtype !== 'string') {\n // Use built-in TypedArray.set() method for speed.\n let offset = 0;\n inputs.forEach(input => {\n const size = util.sizeFromShape(input.shape);\n\n (outVals as TypedArray).set(input.vals as TypedArray, offset);\n offset += size;\n });\n } else {\n let colOffset = 0;\n\n inputs.forEach(input => {\n const decodedData = dtype === 'string' ?\n backend_util.fromUint8ToStringArray(input.vals as Uint8Array[]) :\n input.vals as TypedArray;\n\n let tIdx = 0;\n\n for (let row = 0; row < input.shape[0]; ++row) {\n const resIdx = row * outShape[1] + colOffset;\n for (let col = 0; col < input.shape[1]; ++col) {\n outVals[resIdx + col] = decodedData[tIdx++];\n }\n }\n\n colOffset += input.shape[1];\n });\n }\n\n return outVals;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Equal, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {createSimpleBinaryKernelImpl} from '../utils/binary_impl';\nimport {binaryKernelFunc} from '../utils/binary_utils';\n\nexport const equalImpl =\n createSimpleBinaryKernelImpl((a: number, b: number) => (a === b) ? 1 : 0);\nexport const equal =\n binaryKernelFunc(Equal, equalImpl, null /* complexImpl */, 'bool');\n\nexport const equalConfig: KernelConfig = {\n kernelName: Equal,\n backendName: 'cpu',\n kernelFunc: equal\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the License);\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an AS IS BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Exp, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {createSimpleUnaryImpl} from '../utils/unary_impl';\nimport {unaryKernelFuncFromImpl} from '../utils/unary_utils';\n\nexport const expImpl = createSimpleUnaryImpl((xi) => Math.exp(xi));\nexport const exp = unaryKernelFuncFromImpl(Exp, expImpl, 'float32');\n\nexport const expConfig: KernelConfig = {\n kernelName: Exp,\n backendName: 'cpu',\n kernelFunc: exp,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the License);\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an AS IS BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Expm1, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {createSimpleUnaryImpl} from '../utils/unary_impl';\nimport {unaryKernelFuncFromImpl} from '../utils/unary_utils';\n\nexport const expm1Impl = createSimpleUnaryImpl((xi) => Math.expm1(xi));\nexport const expm1 = unaryKernelFuncFromImpl(Expm1, expm1Impl);\n\nexport const expm1Config: KernelConfig = {\n kernelName: Expm1,\n backendName: 'cpu',\n kernelFunc: expm1,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the License);\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an AS IS BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Floor, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {createSimpleUnaryImpl} from '../utils/unary_impl';\nimport {unaryKernelFuncFromImpl} from '../utils/unary_utils';\n\nexport const floorImpl = createSimpleUnaryImpl((xi) => Math.floor(xi));\nexport const floor = unaryKernelFuncFromImpl(Floor, floorImpl);\n\nexport const floorConfig: KernelConfig = {\n kernelName: Floor,\n backendName: 'cpu',\n kernelFunc: floor,\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {buffer, DataType, Rank, TensorBuffer, TypedArray} from '@tensorflow/tfjs-core';\n\nexport function gatherNdImpl(\n indicesData: TypedArray, paramsBuf: TensorBuffer, dtype: DataType,\n numSlices: number, sliceRank: number, sliceSize: number, strides: number[],\n paramsShape: number[], paramsSize: number): TensorBuffer {\n const outBuf = buffer([numSlices, sliceSize], dtype);\n\n for (let i = 0; i < numSlices; i++) {\n const index = [];\n let flattenIndex = 0;\n for (let j = 0; j < sliceRank; j++) {\n const dim = indicesData[i * sliceRank + j];\n flattenIndex += dim * strides[j];\n index.push(dim);\n }\n if (flattenIndex < 0 || flattenIndex >= paramsSize / sliceSize) {\n throw new Error(\n `Invalid indices: ${index} does not index into ${paramsShape}`);\n }\n\n for (let k = 0; k < sliceSize; k++) {\n outBuf.values[i * sliceSize + k] =\n paramsBuf.get(...paramsBuf.indexToLoc(flattenIndex * sliceSize + k));\n }\n }\n\n return outBuf as TensorBuffer;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {buffer, DataType, Rank, TensorBuffer} from '@tensorflow/tfjs-core';\n\nexport function gatherV2Impl(\n xBuf: TensorBuffer, indicesBuf: TensorBuffer,\n flattenOutputShape: number[]): TensorBuffer {\n const outBuf = buffer(flattenOutputShape, xBuf.dtype);\n for (let i = 0; i < outBuf.size; ++i) {\n const newLoc = outBuf.indexToLoc(i);\n\n const originalLoc: number[] = newLoc.slice();\n const batchIdx = originalLoc[0];\n const indicesIdx = originalLoc[2];\n const indicesIndex = indicesBuf.locToIndex([batchIdx, indicesIdx]);\n originalLoc[2] = indicesBuf.values[indicesIndex] as number;\n\n const originalIndex = xBuf.locToIndex(originalLoc);\n\n if (0 <= originalIndex && originalIndex < xBuf.values.length) {\n outBuf.values[i] = xBuf.values[originalIndex];\n } // Else, index is out of bounds, so leave the default zero val in outBuf.\n }\n\n return outBuf as TensorBuffer;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Greater, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {createSimpleBinaryKernelImpl} from '../utils/binary_impl';\nimport {binaryKernelFunc} from '../utils/binary_utils';\n\nexport const greaterImpl =\n createSimpleBinaryKernelImpl((a: number, b: number) => (a > b) ? 1 : 0);\nexport const greater =\n binaryKernelFunc(Greater, greaterImpl, null /* complexImpl */, 'bool');\n\nexport const greaterConfig: KernelConfig = {\n kernelName: Greater,\n backendName: 'cpu',\n kernelFunc: greater\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GreaterEqual, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {createSimpleBinaryKernelImpl} from '../utils/binary_impl';\nimport {binaryKernelFunc} from '../utils/binary_utils';\n\nexport const greaterEqualImpl =\n createSimpleBinaryKernelImpl((a: number, b: number) => (a >= b) ? 1 : 0);\nexport const greaterEqual = binaryKernelFunc(\n GreaterEqual, greaterEqualImpl, null /* complexImpl */, 'bool');\n\nexport const greaterEqualConfig: KernelConfig = {\n kernelName: GreaterEqual,\n backendName: 'cpu',\n kernelFunc: greaterEqual\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Less} from '@tensorflow/tfjs-core';\n\nimport {createSimpleBinaryKernelImpl} from '../utils/binary_impl';\nimport {binaryKernelFunc} from '../utils/binary_utils';\n\nexport const lessImpl =\n createSimpleBinaryKernelImpl((a: number, b: number) => (a < b) ? 1 : 0);\nexport const less =\n binaryKernelFunc(Less, lessImpl, null /* complexImpl */, 'bool');\n\nexport const lessConfig: KernelConfig = {\n kernelName: Less,\n backendName: 'cpu',\n kernelFunc: less\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, LessEqual} from '@tensorflow/tfjs-core';\n\nimport {createSimpleBinaryKernelImpl} from '../utils/binary_impl';\nimport {binaryKernelFunc} from '../utils/binary_utils';\n\nexport const lessEqualImpl =\n createSimpleBinaryKernelImpl((a: number, b: number) => (a <= b) ? 1 : 0);\nexport const lessEqual =\n binaryKernelFunc(LessEqual, lessEqualImpl, null /* complexImpl */, 'bool');\n\nexport const lessEqualConfig: KernelConfig = {\n kernelName: LessEqual,\n backendName: 'cpu',\n kernelFunc: lessEqual\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {TypedArray, util} from '@tensorflow/tfjs-core';\n\nexport function linSpaceImpl(\n start: number, stop: number, num: number): TypedArray {\n const step = (stop - start) / (num - 1);\n\n const values = util.makeZerosTypedArray(num, 'float32');\n values[0] = start;\n for (let i = 1; i < values.length; i++) {\n values[i] = values[i - 1] + step;\n }\n\n return values;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the License);\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an AS IS BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Log} from '@tensorflow/tfjs-core';\n\nimport {createSimpleUnaryImpl} from '../utils/unary_impl';\nimport {unaryKernelFuncFromImpl} from '../utils/unary_utils';\n\nexport const logImpl = createSimpleUnaryImpl((xi) => Math.log(xi));\nexport const log = unaryKernelFuncFromImpl(Log, logImpl);\n\nexport const logConfig: KernelConfig = {\n kernelName: Log,\n backendName: 'cpu',\n kernelFunc: log,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataType, NumericDataType, TypedArray, util} from '@tensorflow/tfjs-core';\n\nexport function maxImpl(\n aVals: TypedArray, reduceSize: number, outShape: number[],\n dtype: DataType): TypedArray {\n const vals = util.getTypedArrayFromDType(\n dtype as NumericDataType, util.sizeFromShape(outShape));\n\n for (let i = 0; i < vals.length; ++i) {\n const offset = i * reduceSize;\n let max = aVals[offset];\n for (let j = 0; j < reduceSize; ++j) {\n const value = aVals[offset + j];\n if (Number.isNaN(value) ||\n value > max) { // comparison with NaN always return false\n max = value;\n }\n }\n vals[i] = max;\n }\n return vals;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Maximum} from '@tensorflow/tfjs-core';\n\nimport {createSimpleBinaryKernelImpl} from '../utils/binary_impl';\nimport {binaryKernelFunc} from '../utils/binary_utils';\n\nexport const maximumImpl = createSimpleBinaryKernelImpl(\n ((aValue, bValue) => Math.max(aValue as number, bValue as number)));\nexport const maximum = binaryKernelFunc(Maximum, maximumImpl);\n\nexport const maximumConfig: KernelConfig = {\n kernelName: Maximum,\n backendName: 'cpu',\n kernelFunc: maximum\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Minimum} from '@tensorflow/tfjs-core';\n\nimport {createSimpleBinaryKernelImpl} from '../utils/binary_impl';\nimport {binaryKernelFunc} from '../utils/binary_utils';\n\nexport const minimumImpl = createSimpleBinaryKernelImpl(\n ((aValue, bValue) => Math.min(aValue as number, bValue as number)));\nexport const minimum = binaryKernelFunc(Minimum, minimumImpl);\n\nexport const minimumConfig: KernelConfig = {\n kernelName: Minimum,\n backendName: 'cpu',\n kernelFunc: minimum\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Multiply} from '@tensorflow/tfjs-core';\nimport {createSimpleBinaryKernelImpl} from '../utils/binary_impl';\nimport {binaryKernelFunc, createComplexBinaryKernelImpl} from '../utils/binary_utils';\n\nexport const multiplyImpl = createSimpleBinaryKernelImpl(\n ((aValue: number, bValue: number) => aValue * bValue));\nexport const multiplyComplexImpl =\n createComplexBinaryKernelImpl(((aReal, aImag, bReal, bImag) => {\n return {\n real: aReal * bReal - aImag * bImag,\n imag: aReal * bImag + aImag * bReal\n };\n }));\n\nexport const multiply =\n binaryKernelFunc(Multiply, multiplyImpl, multiplyComplexImpl);\n\nexport const multiplyConfig: KernelConfig = {\n kernelName: Multiply,\n backendName: 'cpu',\n kernelFunc: multiply\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataType, KernelConfig, KernelFunc, Neg, TensorInfo, TypedArray, UnaryInputs, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendCPU} from '../backend_cpu';\nimport {assertNotComplex} from '../cpu_util';\nimport {multiplyImpl} from './Multiply';\n\nexport function negImpl(xVals: TypedArray, xShape: number[], xDtype: DataType):\n [TypedArray, number[]] {\n const minusOne =\n util.createScalarValue(-1 as {} as 'float32', xDtype) as TypedArray;\n return multiplyImpl([], xShape, minusOne, xVals, xDtype);\n}\n\nexport function neg(args: {inputs: UnaryInputs, backend: MathBackendCPU}):\n TensorInfo {\n const {inputs, backend} = args;\n const {x} = inputs;\n\n assertNotComplex(x, 'neg');\n\n const xVals = backend.data.get(x.dataId).values as TypedArray;\n const [res, newShape] = negImpl(xVals, x.shape, x.dtype);\n\n return backend.makeTensorInfo(newShape, x.dtype, res);\n}\n\nexport const negConfig: KernelConfig = {\n kernelName: Neg,\n backendName: 'cpu',\n kernelFunc: neg as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, NotEqual} from '@tensorflow/tfjs-core';\n\nimport {createSimpleBinaryKernelImpl} from '../utils/binary_impl';\nimport {binaryKernelFunc} from '../utils/binary_utils';\n\nexport const notEqualImpl =\n createSimpleBinaryKernelImpl(((a, b) => (a !== b) ? 1 : 0));\nexport const notEqual =\n binaryKernelFunc(NotEqual, notEqualImpl, null /* complexOp */, 'bool');\n\nexport const notEqualConfig: KernelConfig = {\n kernelName: NotEqual,\n backendName: 'cpu',\n kernelFunc: notEqual\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataType, NumericDataType, TypedArray} from '@tensorflow/tfjs-core';\nimport {util} from '@tensorflow/tfjs-core';\n\nexport function transposeImpl(\n xVals: TypedArray, xShape: number[], dtype: DataType, perm: number[],\n newShape: number[]): TypedArray {\n const xRank = xShape.length;\n const xSize = util.sizeFromShape(xShape);\n const xStrides = util.computeStrides(xShape);\n const newStrides = util.computeStrides(newShape);\n\n const result = util.getTypedArrayFromDType(\n dtype as NumericDataType, util.sizeFromShape(newShape));\n\n for (let i = 0; i < xSize; ++i) {\n const loc = util.indexToLoc(i, xRank, xStrides);\n\n // Permute location.\n const newLoc: number[] = new Array(loc.length);\n for (let i = 0; i < newLoc.length; i++) {\n newLoc[i] = loc[perm[i]];\n }\n\n const newIndex = util.locToIndex(newLoc, xRank, newStrides);\n result[newIndex] = xVals[i];\n }\n return result;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, TensorInfo, Transpose, TransposeAttrs, TransposeInputs, TypedArray} from '@tensorflow/tfjs-core';\n\nimport {MathBackendCPU} from '../backend_cpu';\nimport {assertNotComplex} from '../cpu_util';\n\nimport {transposeImpl} from './Transpose_impl';\n\nexport function transpose(args: {\n inputs: TransposeInputs,\n attrs: TransposeAttrs,\n backend: MathBackendCPU\n}): TensorInfo {\n const {inputs, attrs, backend} = args;\n const {x} = inputs;\n const {perm} = attrs;\n\n assertNotComplex(x, 'transpose');\n\n const xRank = x.shape.length;\n\n const newShape: number[] = new Array(xRank);\n for (let i = 0; i < newShape.length; i++) {\n newShape[i] = x.shape[perm[i]];\n }\n\n const values = backend.data.get(x.dataId).values as TypedArray;\n const result = transposeImpl(values, x.shape, x.dtype, perm, newShape);\n\n const dataId = backend.write(result, newShape, x.dtype);\n return {dataId, shape: newShape, dtype: x.dtype};\n}\n\nexport const transposeConfig: KernelConfig = {\n kernelName: Transpose,\n backendName: 'cpu',\n kernelFunc: transpose as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, DataType, KernelConfig, KernelFunc, Prod, ProdAttrs, ProdInputs, TensorInfo, TypedArray, upcastType, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendCPU} from '../backend_cpu';\nimport {assertNotComplex} from '../cpu_util';\nimport {transpose} from './Transpose';\n\nexport function prodImpl(\n xShape: number[], xDtype: DataType, xVals: TypedArray,\n reductionAxes: number[]):\n {outVals: TypedArray, outShape: number[], outDtype: DataType} {\n const [outShape, reduceShape] =\n backend_util.computeOutAndReduceShapes(xShape, reductionAxes);\n const outDtype = upcastType(xDtype, 'int32');\n const outVals = util.makeZerosTypedArray(\n util.sizeFromShape(outShape), outDtype) as TypedArray;\n const reduceSize = util.sizeFromShape(reduceShape);\n\n for (let i = 0; i < outVals.length; ++i) {\n const offset = i * reduceSize;\n let prod = 1;\n for (let j = 0; j < reduceSize; ++j) {\n prod *= xVals[offset + j];\n }\n outVals[i] = prod;\n }\n\n return {outVals, outShape, outDtype};\n}\n\nexport function prod(\n args: {inputs: ProdInputs, backend: MathBackendCPU, attrs: ProdAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {axis, keepDims} = attrs;\n\n assertNotComplex(x, 'prod');\n\n const xRank = x.shape.length;\n const axes = util.parseAxisParam(axis, x.shape);\n\n const permutation = backend_util.getAxesPermutation(axes, xRank);\n let reductionAxes = axes;\n let permutedX = x;\n const intermediateTensorInfos = [];\n if (permutation != null) {\n permutedX = transpose({inputs: {x}, backend, attrs: {perm: permutation}});\n intermediateTensorInfos.push(permutedX);\n reductionAxes = backend_util.getInnerMostAxes(reductionAxes.length, xRank);\n }\n\n const xVals = backend.data.get(permutedX.dataId).values as TypedArray;\n const {outVals, outShape, outDtype} =\n prodImpl(permutedX.shape, permutedX.dtype, xVals, reductionAxes);\n\n let resultShape = outShape;\n if (keepDims) {\n resultShape = backend_util.expandShapeToKeepDim(outShape, axes);\n }\n\n intermediateTensorInfos.forEach(\n t => backend.disposeIntermediateTensorInfo(t));\n\n return backend.makeTensorInfo(resultShape, outDtype, outVals);\n}\n\nexport const prodConfig: KernelConfig = {\n kernelName: Prod,\n backendName: 'cpu',\n kernelFunc: prod as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataType, TypedArray, util} from '@tensorflow/tfjs-core';\n\nfunction validateIndices(\n indices: TypedArray, indicesShape: number[], numParams: number) {\n indices.forEach((index: number, i: number) => {\n if (index < 0 || index >= numParams) {\n const locString =\n util.indexToLoc(\n i, indicesShape.length, util.computeStrides(indicesShape))\n .join(',');\n throw new Error(\n `indices[${locString}] = ${index} is not in [0, ${numParams})`);\n }\n });\n}\n\nfunction validateSplits(\n paramsNestedSplits: TypedArray[], numParamsDenseValues: number) {\n // Validate\n for (let dim = 0; dim < paramsNestedSplits.length; ++dim) {\n const splits = paramsNestedSplits[dim];\n const lastSplit = (dim === paramsNestedSplits.length - 1) ?\n numParamsDenseValues :\n paramsNestedSplits[dim + 1].length;\n if (splits.length === 0) {\n throw new Error('Ragged splits may not be empty');\n }\n if (splits[0] < 0) {\n throw new Error('Ragged splits must be non-negative');\n }\n if (splits[splits.length - 1] > lastSplit) {\n throw new Error('Ragged splits must not point past values');\n }\n for (let i = 1; i < splits.length; ++i) {\n if (splits[i - 1] > splits[i]) {\n throw new Error('Ragged splits must be sorted in ascending order');\n }\n }\n }\n}\n\n// Construct the `splits` output tensors, encoded using a nested vector.\n// Also find the slices of values that need to be copied, and store them\n// in `valueSlices`. The total number of values that will be copied (which\n// we need for allocating the output values tensor) is stored in `numValues`.\nfunction makeSplits(\n indices: TypedArray, indicesShape: number[],\n paramsNestedSplits: TypedArray[], numParamsDenseValues: number) {\n const valueSlices: Array<[number, number]> = [];\n let numValues = 0;\n\n const numSplits = indicesShape.length - 1 + paramsNestedSplits.length;\n const outSplits = new Array(numSplits).fill(null).map(() => [0]);\n\n validateSplits(paramsNestedSplits, numParamsDenseValues);\n\n // Add `splits` that come from all but the last dimension of the dense\n // Tensor `indices`. In particular, for each dimension D, we add a\n // splits tensor whose values are:\n // range(reduceProd(splits.shape[:D]) + 1) * splits.shape[D+1]\n // E.g., if indices.shape=[2, 3, 4] then we will add splits tensors:\n // [0, 3, 6] # length=2+1, stride=3\n // [0, 4, 8, 12, 16, 20, 24] # length=2*3+1, stride=4\n let nrows = 1;\n for (let dim = 0; dim < indicesShape.length - 1; ++dim) {\n nrows *= indicesShape[dim];\n const rowLength = indicesShape[dim + 1];\n for (let i = 1; i < nrows + 1; ++i) {\n outSplits[dim].push(i * rowLength);\n }\n }\n\n // Add `splits` that come from `paramsNestedSplits`. Starting with the\n // outermost ragged dimension (i.e., the first `splits` tensor), we work\n // our way in, finding the range of values that should be copied. As we\n // go, we update the output `splits` for each dimension with the appropriate\n // values. In particular, the *lengths* of the slices from `param_splits`\n // should be copied to generate corresponding slice lengths in the output\n // splits. E.g., if we are copying a ragged row with length 4, then we\n // should add a new split point to outSplits that is 4 greater than the\n // previous split point in outSplits.\n for (let i = 0; i < indices.length; ++i) {\n let start = indices[i];\n let limit = indices[i] + 1;\n\n // Copy splits.\n for (let dim = 0; dim < paramsNestedSplits.length; ++dim) {\n const splits = paramsNestedSplits[dim];\n const outDim = dim + indicesShape.length - 1;\n if (outDim >= 0) {\n const outSplitsOutDim = outSplits[outDim];\n const delta =\n outSplitsOutDim[outSplitsOutDim.length - 1] - splits[start];\n for (let j = start; j < limit; ++j) {\n outSplits[outDim].push(splits[j + 1] + delta);\n }\n }\n start = splits[start];\n limit = splits[limit];\n }\n if (limit !== start) {\n valueSlices.push([start, limit]);\n numValues += limit - start;\n }\n }\n\n return {outSplits, valueSlices, numValues};\n}\n\nfunction getSplits(outSplits: number[][]) {\n const splitsOut: TypedArray[] = [];\n for (let i = 0; i < outSplits.length; ++i) {\n const numSplits = outSplits[i].length;\n const splits = util.getArrayFromDType('int32', numSplits) as TypedArray;\n splitsOut.push(splits);\n\n outSplits[i].forEach((value, j: number) => splits[j] = value);\n }\n\n return splitsOut;\n}\n\nfunction computeFlatOuterDims(orig: number[], numOutDims: number) {\n const outDims = orig.slice(0, numOutDims);\n while (outDims.length < numOutDims) {\n outDims.push(1);\n }\n\n for (let inDim = numOutDims; inDim < orig.length; inDim++) {\n outDims[numOutDims - 1] *= orig[inDim];\n }\n\n return outDims;\n}\n// For each slice in `(start, limit)` in `valueSlices`, append\n// `paramsDenseValues[start,...,limit] to `values`. `valueSize` indicates\n// the number of scalars contained in each value paramsDenseValues[i].\nfunction writeValueSlices(\n paramsDenseValues: TypedArray, paramsDenseValuesShape: number[],\n valueSlices: Array<[number, number]>, valueSize: number, values: TypedArray,\n valuesShape: number[]) {\n const denseM = computeFlatOuterDims(paramsDenseValuesShape, 2)[1];\n const valuesM = computeFlatOuterDims(valuesShape, 2)[1];\n\n let outPos = 0;\n for (const slice of valueSlices) {\n for (let i = slice[0]; i < slice[1]; ++i) {\n for (let j = 0; j < valueSize; ++j) {\n values[outPos * valuesM + j] = paramsDenseValues[i * denseM + j];\n }\n ++outPos;\n }\n }\n}\n\nfunction getValues(\n paramsDenseValues: TypedArray, paramsDenseValuesShape: number[],\n paramsDenseValuesDType: DataType, valueSlices: Array<[number, number]>,\n numValues: number): [TypedArray, number[]] {\n const valuesShape = paramsDenseValuesShape.slice();\n valuesShape[0] = numValues;\n\n const valuesOut = util.getArrayFromDType(\n paramsDenseValuesDType,\n util.sizeFromShape(valuesShape)) as TypedArray;\n\n const numElements = paramsDenseValues.length;\n const valueSize =\n numElements === 0 ? 0 : (numElements / paramsDenseValuesShape[0]);\n writeValueSlices(\n paramsDenseValues, paramsDenseValuesShape, valueSlices, valueSize,\n valuesOut, valuesShape);\n\n return [valuesOut, valuesShape];\n}\nexport function raggedGatherImpl(\n paramsNestedSplits: TypedArray[], paramsNestedSplitsShapes: number[][],\n paramsDenseValues: TypedArray, paramsDenseValuesShape: number[],\n paramsDenseValuesDType: DataType, indices: TypedArray,\n indicesShape: number[],\n outputRaggedRank: number): [TypedArray[], TypedArray, number[]] {\n if (paramsNestedSplits.length === 0) {\n throw new Error('paramsNestedSplits must be non empty');\n }\n\n if (paramsNestedSplitsShapes[0].length === 0) {\n throw new Error('Split tensors must not be scalars');\n }\n const numParams = paramsNestedSplitsShapes[0][0] - 1;\n validateIndices(indices, indicesShape, numParams);\n\n if (paramsDenseValuesShape.length === 0) {\n throw new Error('params.rank must be nonzero');\n }\n const numParamsDenseValues = paramsDenseValuesShape[0];\n\n // Calculate the `splits`, and store the value slices that we need to\n // copy in `valueSlices`.\n const {outSplits, valueSlices, numValues} = makeSplits(\n indices, indicesShape, paramsNestedSplits, numParamsDenseValues);\n\n // Write the output tensors.\n const outputNestedSplits = getSplits(outSplits);\n const outputDenseValues = getValues(\n paramsDenseValues, paramsDenseValuesShape, paramsDenseValuesDType,\n valueSlices, numValues);\n\n return [outputNestedSplits, outputDenseValues[0], outputDenseValues[1]];\n}\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataType, TypedArray, util} from '@tensorflow/tfjs-core';\n\nconst INT32_MAX = 2147483647;\n\nexport function raggedRangeImpl(\n starts: TypedArray, startsShape: number[], startsDType: DataType,\n limits: TypedArray, limitsShape: number[], deltas: TypedArray,\n deltasShape: number[]): [TypedArray, TypedArray] {\n // Check input tensor shapes.\n if (startsShape.length > 1) {\n throw new Error('starts must be a scalar or vector');\n }\n if (limitsShape.length > 1) {\n throw new Error('limits must be a scalar or vector');\n }\n if (deltasShape.length > 1) {\n throw new Error('deltas must be a scalar or vector');\n }\n\n // Determine which tensors we need to broadcast.\n const broadcastStarts = startsShape.length === 0;\n const broadcastLimits = limitsShape.length === 0;\n const broadcastDeltas = deltasShape.length === 0;\n\n // nRows (number of output rows) is the size of the non-broadcast inputs,\n // or 1 if all inputs are scalars.\n const inSizes: number[] = [];\n if (!broadcastStarts) {\n inSizes.push(startsShape[0]);\n }\n if (!broadcastLimits) {\n inSizes.push(limitsShape[0]);\n }\n if (!broadcastDeltas) {\n inSizes.push(deltasShape[0]);\n }\n\n for (let i = 1; i < inSizes.length; ++i) {\n if (inSizes[i] !== inSizes[i - 1]) {\n throw new Error('starts, limits, and deltas must have the same shape');\n }\n }\n const nRows = inSizes.length === 0 ? 1 : inSizes[0];\n\n // Construct the rtNestedSplits tensor.\n const rtNestedSplits =\n util.getArrayFromDType('int32', nRows + 1) as TypedArray;\n rtNestedSplits[0] = 0;\n for (let row = 0; row < nRows; ++row) {\n const start = broadcastStarts ? starts[0] : starts[row];\n const limit = broadcastLimits ? limits[0] : limits[row];\n const delta = broadcastDeltas ? deltas[0] : deltas[row];\n if (delta === 0) {\n throw new Error('Requires delta != 0');\n }\n let size: number; // The number of elements in the specified range.\n if (((delta > 0) && (limit < start)) || ((delta < 0) && (limit > start))) {\n size = 0;\n } else {\n size = Math.ceil(Math.abs((limit - start) / delta));\n\n if (size > INT32_MAX) {\n throw new Error(`Requires ((limit - start) / delta) <= ${INT32_MAX}`);\n }\n }\n rtNestedSplits[row + 1] = rtNestedSplits[row] + size;\n }\n\n const nVals = rtNestedSplits[nRows];\n\n // Construct the rtDenseValues tensor.\n const rtDenseValues =\n util.getArrayFromDType(startsDType, nVals) as TypedArray;\n\n let valueIndex = 0;\n for (let row = 0; row < nRows; ++row) {\n const rowSize = rtNestedSplits[row + 1] - rtNestedSplits[row];\n let value = broadcastStarts ? starts[0] : starts[row];\n const delta = broadcastDeltas ? deltas[0] : deltas[row];\n for (let i = 0; i < rowSize; ++i) {\n rtDenseValues[valueIndex++] = value;\n value += delta;\n }\n }\n\n return [rtNestedSplits, rtDenseValues];\n}\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, broadcastTo, DataType, reshape, tidy, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport RowPartitionType = backend_util.RowPartitionType;\n// Based on\n// https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/kernels/ragged_tensor_to_tensor_op.cc\nclass RaggedTensorToTensorOp {\n private readonly rowPartitionTypes: RowPartitionType[];\n private readonly raggedRank: number;\n constructor(\n private shape: TypedArray, private shapeShape: number[],\n private values: TypedArray, private valuesShape: number[],\n private valuesDType: DataType, private defaultValue: TypedArray,\n private defaultValueShape: number[],\n private readonly rowPartitionValues: TypedArray[],\n private readonly rowPartitionValuesShapes: number[][],\n rowPartitionTypeStrings: string[]) {\n this.rowPartitionTypes =\n backend_util.getRowPartitionTypesHelper(rowPartitionTypeStrings);\n this.raggedRank = backend_util.getRaggedRank(this.rowPartitionTypes);\n }\n\n private getRowPartitionTypeByDimension(dimension: number) {\n if (this.rowPartitionTypes[0] === RowPartitionType.FIRST_DIM_SIZE) {\n return this.rowPartitionTypes[dimension + 1];\n } else {\n return this.rowPartitionTypes[dimension];\n }\n }\n\n // Returns the relationship between dimension and dimension + 1.\n private getRowPartitionTensor(dimension: number) {\n if (this.rowPartitionTypes[0] === RowPartitionType.FIRST_DIM_SIZE) {\n return this.rowPartitionValues[dimension + 1];\n } else {\n return this.rowPartitionValues[dimension];\n }\n }\n\n private getMaxWidth(dimension: number) {\n const rowPartitionTensor = this.getRowPartitionTensor(dimension - 1);\n switch (this.getRowPartitionTypeByDimension(dimension - 1)) {\n case RowPartitionType.VALUE_ROWIDS:\n return RaggedTensorToTensorOp.getMaxWidthValueRowID(rowPartitionTensor);\n case RowPartitionType.ROW_SPLITS:\n return RaggedTensorToTensorOp.getMaxWidthRowSplit(rowPartitionTensor);\n default:\n throw new Error(`Cannot handle partition type ${\n RowPartitionType[this.getRowPartitionTypeByDimension(\n dimension - 1)]}`);\n }\n }\n\n static getMaxWidthRowSplit(rowSplit: TypedArray) {\n const tensorLength = rowSplit.length;\n if (tensorLength === 0 || tensorLength === 1) {\n return 0;\n }\n let maxWidth = 0;\n for (let i = 0; i < tensorLength - 1; ++i) {\n const currentWidth = rowSplit[i + 1] - rowSplit[i];\n if (currentWidth > maxWidth) {\n maxWidth = currentWidth;\n }\n }\n return maxWidth;\n }\n\n static getMaxWidthValueRowID(valueRowIds: TypedArray) {\n const indexLength = valueRowIds.length;\n if (indexLength === 0) {\n return 0;\n }\n let firstEqualIndex = 0;\n let firstEqualIndexValue = valueRowIds[0];\n let maxWidth = 0;\n for (let i = 1; i < indexLength; ++i) {\n const value = valueRowIds[i];\n if (value !== firstEqualIndexValue) {\n firstEqualIndexValue = value;\n maxWidth = Math.max(i - firstEqualIndex, maxWidth);\n firstEqualIndex = i;\n }\n }\n return Math.max(indexLength - firstEqualIndex, maxWidth);\n }\n\n private tensorShapeFromTensor(\n t: TypedArray, tShape: number[], isPartial = true) {\n if (tShape.length === 0) {\n if (t[0] === -1) {\n return [];\n }\n throw new Error(\n `The only valid scalar shape tensor is the fully unknown shape specified as -1.`);\n }\n // MakePartialShape/MakeShapeHelper.\n return makeShape(t, isPartial);\n }\n\n private calculateOutputSize(firstDim: number) {\n const valueShape = this.valuesShape;\n const defaultValueShape = this.defaultValueShape;\n\n backend_util.validateDefaultValueShape(defaultValueShape, valueShape);\n\n const shape = this.tensorShapeFromTensor(this.shape, this.shapeShape);\n const outputShape = backend_util.combineRaggedTensorToTensorShapes(\n this.raggedRank, shape, valueShape);\n\n const result = outputShape;\n\n if (result[0] < 0) {\n result[0] = firstDim;\n }\n for (let i = 1; i <= this.raggedRank; ++i) {\n if (result[i] < 0) {\n result[i] = this.getMaxWidth(i);\n }\n }\n\n return result;\n }\n\n /**\n * The outputIndex represents the index in the output tensor\n * where the first element of a particular dimension would be written.\n * If it is -1, it indicates that the index is out of scope.\n * Example, given firstDimension = 10, firstDimensionOutput = 6,\n * and outputIndexMultiplier = 100:\n * result = [0 100 200 300 400 500 -1 -1 -1 -1]\n * If firstDimensionOutput = 11 instead, then:\n * result = [0 100 200 300 400 500 600 700 800 900]\n */\n private calculateFirstParentOutputIndex(\n firstDimension: number, outputIndexMultiplier: number,\n firstDimensionOutput: number) {\n const minDimension = Math.min(firstDimension, firstDimensionOutput);\n const result: number[] = [];\n let currentOutputIndex = 0;\n for (let i = 0; i < minDimension;\n ++i, currentOutputIndex += outputIndexMultiplier) {\n result.push(currentOutputIndex);\n }\n for (let i = minDimension; i < firstDimension; ++i) {\n result.push(-1);\n }\n util.assert(\n result.length === firstDimension,\n () => 'Final length of result must be equal to firstDimension.');\n\n return result;\n }\n\n private calculateOutputIndexRowSplit(\n rowSplit: TypedArray, parentOutputIndex: number[],\n outputIndexMultiplier: number, outputSize: number) {\n const rowSplitSize = rowSplit.length;\n const result: number[] = [];\n for (let i = 0; i < rowSplitSize - 1; ++i) {\n const rowLength = rowSplit[i + 1] - rowSplit[i];\n let realLength = Math.min(outputSize, rowLength);\n let parentOutputIndexCurrent = parentOutputIndex[i];\n\n if (parentOutputIndexCurrent === -1) {\n realLength = 0;\n }\n for (let j = 0; j < realLength; ++j) {\n result.push(parentOutputIndexCurrent);\n parentOutputIndexCurrent += outputIndexMultiplier;\n }\n for (let j = 0; j < rowLength - realLength; ++j) {\n result.push(-1);\n }\n }\n if (rowSplitSize > 0 && result.length !== rowSplit[rowSplitSize - 1]) {\n throw new Error('Invalid row split size.');\n }\n\n return result;\n }\n\n // Calculate the output index of the first element of a list.\n // The parentOutputIndex is the same computation for the previous list.\n // -1 indicates an element or list that is out of range.\n // The outputIndexMultiplier is the number of output indices one moves\n // forward for each column.\n // E.g., given:\n // valueRowIds:[0 1 2 2 2 3 5 5 6]\n // parentOutputIndex:[1000 1100 2000 2100 -1 3000 4000]\n // outputIndexMultiplier: 10\n // outputSize: 2\n // You get:\n // result = [1000 1100 2000 2010 -1 2100 -1 -1 3000]\n // result[0] = parentOutputIndex[valueRowIds[0]]\n // result[1] = parentOutputIndex[valueRowIds[1]]\n // result[2] = parentOutputIndex[valueRowIds[2]]\n // result[3] = parentOutputIndex[valueRowIds[2] + 10]\n // result[4] = -1 because it is the third element the size is 2.\n // result[5] = parentOutputIndex[valueRowIds[3]]\n // result[6] = -1 because parentOutputIndex[valueRowIds[6]] == -1\n // result[7] = -1 because parentOutputIndex[valueRowIds[6]] == -1\n // result[8] = parentOutputIndex[valueRowIds[7]]\n private calculateOutputIndexValueRowID(\n valueRowIds: TypedArray, parentOutputIndex: number[],\n outputIndexMultiplier: number, outputSize: number) {\n const indexSize = valueRowIds.length;\n const result: number[] = [];\n if (indexSize === 0) {\n return [];\n }\n\n let currentOutputColumn = 0;\n let currentValueRowId = valueRowIds[0];\n\n if (currentValueRowId >= parentOutputIndex.length) {\n throw new Error(\n `Got currentValueRowId=${currentValueRowId}, which is not less than ${\n parentOutputIndex.length}`);\n }\n\n let currentOutputIndex = parentOutputIndex[currentValueRowId];\n result.push(currentOutputIndex);\n for (let i = 1; i < indexSize; ++i) {\n const nextValueRowId = valueRowIds[i];\n if (nextValueRowId === currentValueRowId) {\n if (currentOutputIndex >= 0) {\n ++currentOutputColumn;\n if (currentOutputColumn < outputSize) {\n currentOutputIndex += outputIndexMultiplier;\n } else {\n currentOutputIndex = -1;\n }\n }\n } else {\n currentOutputColumn = 0;\n currentValueRowId = nextValueRowId;\n\n if (nextValueRowId >= parentOutputIndex.length) {\n throw new Error(\n `Got nextValueRowId=${nextValueRowId} which is not less than ${\n parentOutputIndex.length}`);\n }\n\n currentOutputIndex = parentOutputIndex[nextValueRowId];\n }\n result.push(currentOutputIndex);\n }\n\n if (result.length !== valueRowIds.length) {\n throw new Error('Invalid row ids.');\n }\n\n return result;\n }\n\n private calculateOutputIndex(\n dimension: number, parentOutputIndex: number[],\n outputIndexMultiplier: number, outputSize: number) {\n const rowPartitionTensor = this.getRowPartitionTensor(dimension);\n const partitionType = this.getRowPartitionTypeByDimension(dimension);\n switch (partitionType) {\n case RowPartitionType.VALUE_ROWIDS:\n return this.calculateOutputIndexValueRowID(\n rowPartitionTensor, parentOutputIndex, outputIndexMultiplier,\n outputSize);\n case RowPartitionType.ROW_SPLITS:\n if (rowPartitionTensor.length - 1 > parentOutputIndex.length) {\n throw new Error(`Row partition size is greater than output size: ${\n rowPartitionTensor.length - 1} > ${parentOutputIndex.length}`);\n }\n return this.calculateOutputIndexRowSplit(\n rowPartitionTensor, parentOutputIndex, outputIndexMultiplier,\n outputSize);\n default:\n throw new Error(\n `Unsupported partition type: ${RowPartitionType[partitionType]}`);\n }\n }\n\n private getFirstDimensionSize() {\n const firstPartitionTensor = this.rowPartitionValues[0];\n if (this.rowPartitionTypes.length === 0) {\n throw new Error('No row_partition_types given.');\n }\n const firstPartitionType = this.rowPartitionTypes[0];\n switch (firstPartitionType) {\n case RowPartitionType.FIRST_DIM_SIZE:\n return firstPartitionTensor[0];\n case RowPartitionType.VALUE_ROWIDS:\n throw new Error('Cannot handle VALUE_ROWIDS in first dimension.');\n case RowPartitionType.ROW_SPLITS:\n return this.rowPartitionValuesShapes[0][0] - 1;\n default:\n throw new Error(\n `Cannot handle type ${RowPartitionType[firstPartitionType]}`);\n }\n }\n\n compute(): [number[], TypedArray] {\n const firstPartitionTensor = this.rowPartitionValues[0];\n if (firstPartitionTensor.length <= 0) {\n throw new Error(\n 'Invalid first partition input. ' +\n 'Tensor requires at least one element.');\n }\n const firstDimension = this.getFirstDimensionSize();\n const outputSize = this.calculateOutputSize(firstDimension);\n const multiplier: number[] = new Array(this.raggedRank + 1);\n\n multiplier[multiplier.length - 1] = 1;\n for (let i = multiplier.length - 2; i >= 0; --i) {\n multiplier[i] = multiplier[i + 1] * outputSize[i + 1];\n }\n // Full size of the tensor.\n const outputShape: number[] = makeShape(outputSize, false);\n const outputTensor =\n util.getArrayFromDType(\n this.valuesDType, util.sizeFromShape(outputShape)) as TypedArray;\n\n const fullSize = multiplier[0] * outputSize[0];\n if (fullSize > 0) {\n let outputIndex = this.calculateFirstParentOutputIndex(\n firstDimension, multiplier[0], outputSize[0]);\n for (let i = 1; i <= this.raggedRank; ++i) {\n const newOutputIndex = this.calculateOutputIndex(\n i - 1, outputIndex, multiplier[i], outputSize[i]);\n outputIndex = newOutputIndex;\n }\n\n this.setOutput(this.raggedRank, outputIndex, outputTensor, outputShape);\n }\n\n return [outputShape, outputTensor];\n }\n setOutput(\n raggedRank: number, outputIndex: number[], outputTensor: TypedArray,\n outputShape: number[]) {\n if (outputTensor.length === 0) {\n return;\n }\n\n const valuesBase = this.values;\n const outputBase = outputTensor;\n\n let elementShape = outputShape.slice();\n elementShape = elementShape.slice(raggedRank + 1);\n const valueElementSize = util.sizeFromShape(elementShape);\n const outputIndexSize = outputIndex.length;\n\n // Broadcast the default value to value_element_size. (We can skip this\n // if defaultValueTensor.size == 1, since we use fill when that's true.)\n let defaultValue = this.defaultValue;\n if (defaultValue.length !== valueElementSize && defaultValue.length !== 1) {\n const srcShape = this.defaultValueShape;\n tidy(() => {\n const defaultValueTensor = reshape(defaultValue, srcShape);\n const bCastDefault = broadcastTo(defaultValueTensor, elementShape);\n defaultValue = bCastDefault.dataSync();\n });\n }\n\n // Loop through the outputIndex array, finding contiguous regions that\n // should be copied. Once we find the end of a contiguous region, copy it\n // and add any necessary padding (with defaultValue).\n let srcStart = 0; // Start of contiguous region (in values)\n let dstStart = 0; // Destination for contiguous region (in output)\n let dstEnd = 0; // Destination for contiguous region (in output)\n for (let srcI = 0; srcI <= outputIndexSize; ++srcI) {\n // dstI is the destination where the value at srcI should be copied.\n let dstI = srcI < outputIndexSize ? outputIndex[srcI] : -1;\n\n // If we're still in a contiguous region, then update dstEnd go to the\n // next srcI.\n if (dstI === dstEnd) {\n ++dstEnd;\n continue;\n }\n\n // We found the end of contiguous region. This can be because we found\n // a gap (dstI > dstEnd), or a source value that shouldn't be copied\n // because it's out-of-bounds (dstI == -1), or the end of the tensor\n // (dstI === -1).\n if (dstStart < dstEnd) {\n // Copy the contiguous region.\n const src = valuesBase.subarray(srcStart * valueElementSize);\n const dst = outputBase.subarray(dstStart * valueElementSize);\n const nVals = (dstEnd - dstStart) * valueElementSize;\n copyArray(dst, src, nVals);\n }\n\n // Add any necessary padding (w/ defaultValue).\n if (srcI >= outputIndexSize) {\n // We reached the end of values: pad to the end of output.\n const outputSize = outputTensor.length;\n dstI = Math.floor(outputSize / valueElementSize);\n }\n if (dstI > dstEnd) {\n if (this.defaultValue.length === 1) {\n outputBase\n .subarray(dstEnd * valueElementSize, dstI * valueElementSize)\n .fill(this.defaultValue[0]);\n dstEnd = dstI;\n } else {\n while (dstI > dstEnd) {\n const dst = outputBase.slice(dstEnd * valueElementSize);\n copyArray(dst, defaultValue, valueElementSize);\n ++dstEnd;\n }\n }\n }\n\n // Update indices.\n if (dstI < 0) {\n // srcI should be skipped -- leave it out of the contiguous region.\n srcStart = srcI + 1;\n dstStart = dstEnd;\n } else {\n // srcI should be copied -- include it in the contiguous region.\n srcStart = srcI;\n dstStart = dstEnd;\n dstEnd = dstStart + 1;\n }\n }\n }\n}\n\nfunction copyArray(dst: TypedArray, src: TypedArray, size: number) {\n for (let i = 0; i < size; i++) {\n dst[i] = src[i];\n }\n}\n\nfunction makeShape(shape: number[]|TypedArray, isPartial: boolean) {\n const out: number[] = [];\n for (let dim of shape) {\n if (dim < 0) {\n if (!isPartial) {\n throw new Error(`Dimension ${dim} must be >= 0`);\n }\n if (dim < -1) {\n throw new Error(`Dimension ${dim} must be >= -1`);\n }\n dim = -1;\n }\n out.push(dim);\n }\n\n return out;\n}\n\nexport function raggedTensorToTensorImpl(\n shape: TypedArray, shapesShape: number[], values: TypedArray,\n valuesShape: number[], valuesDType: DataType, defaultValue: TypedArray,\n defaultValueShape: number[], rowPartitionValues: TypedArray[],\n rowPartitionValuesShapes: number[][],\n rowPartitionTypes: string[]): [number[], TypedArray] {\n return new RaggedTensorToTensorOp(\n shape, shapesShape, values, valuesShape, valuesDType, defaultValue,\n defaultValueShape, rowPartitionValues, rowPartitionValuesShapes,\n rowPartitionTypes)\n .compute();\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataTypeMap, util} from '@tensorflow/tfjs-core';\n\nexport function rangeImpl(\n start: number, stop: number, step: number,\n dtype: 'float32'|'int32'): DataTypeMap['float32' | 'int32'] {\n const sameStartStop = start === stop;\n const increasingRangeNegativeStep = start < stop && step < 0;\n const decreasingRangePositiveStep = stop < start && step > 1;\n\n if (sameStartStop || increasingRangeNegativeStep ||\n decreasingRangePositiveStep) {\n return util.makeZerosTypedArray(0, dtype);\n }\n\n const numElements = Math.abs(Math.ceil((stop - start) / step));\n const values = util.makeZerosTypedArray(numElements, dtype);\n\n if (stop < start && step === 1) {\n // Auto adjust the step's sign if it hasn't been set\n // (or was set to 1)\n step = -1;\n }\n\n values[0] = start;\n for (let i = 1; i < values.length; i++) {\n values[i] = values[i - 1] + step;\n }\n return values;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the License);\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an AS IS BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Rsqrt} from '@tensorflow/tfjs-core';\n\nimport {createSimpleUnaryImpl} from '../utils/unary_impl';\nimport {unaryKernelFuncFromImpl} from '../utils/unary_utils';\n\nexport const rsqrtImpl = createSimpleUnaryImpl((xi) => 1 / Math.sqrt(xi));\nexport const rsqrt = unaryKernelFuncFromImpl(Rsqrt, rsqrtImpl);\n\nexport const rsqrtConfig: KernelConfig = {\n kernelName: Rsqrt,\n backendName: 'cpu',\n kernelFunc: rsqrt,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {buffer, Rank, ShapeMap, TensorBuffer, TypedArray} from '@tensorflow/tfjs-core';\n\ninterface DefaultValueTypeMap {\n bool: boolean;\n int32: number;\n float32: number;\n string: string;\n}\n\nexport function\nscatterImpl(\n indices: TensorBuffer, updates: TensorBuffer,\n shape: number[], outputSize: number, sliceSize: number, numUpdates: number,\n sliceRank: number, strides: number[], defaultValue: DefaultValueTypeMap[D],\n sumDupeIndices: boolean): TensorBuffer {\n const flattenShape = [outputSize / sliceSize, sliceSize];\n\n const indicesData = indices.values as TypedArray;\n const updatesData = updates.values;\n\n if (outputSize === 0) {\n return buffer(shape as ShapeMap[R], updates.dtype);\n }\n\n const outBuf = buffer(flattenShape, updates.dtype);\n if (typeof defaultValue === 'string') {\n (outBuf.values as string[]).fill(defaultValue);\n } else if (typeof defaultValue === 'number') {\n (outBuf.values as TypedArray).fill(defaultValue);\n } else if (typeof defaultValue === 'boolean') {\n (outBuf.values as TypedArray).fill(+defaultValue);\n }\n\n for (let i = 0; i < numUpdates; i++) {\n const index = [];\n let flattenIndex = 0;\n for (let j = 0; j < sliceRank; j++) {\n const dim = indicesData[i * sliceRank + j];\n index.push(dim);\n flattenIndex += dim * strides[j];\n }\n\n if (flattenIndex < 0 || flattenIndex >= outputSize / sliceSize) {\n throw new Error(`Invalid indices: ${index} does not index into ${shape}`);\n }\n\n for (let k = 0; k < sliceSize; k++) {\n if (sumDupeIndices) {\n (outBuf.values as TypedArray)[flattenIndex * sliceSize + k] +=\n (updatesData as TypedArray)[i * sliceSize + k];\n } else {\n outBuf.values[flattenIndex * sliceSize + k] = updates.rank === 0 ?\n updatesData[0] :\n updatesData[i * sliceSize + k];\n }\n }\n }\n\n return outBuf as TensorBuffer;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the License);\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an AS IS BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Sigmoid} from '@tensorflow/tfjs-core';\n\nimport {createSimpleUnaryImpl} from '../utils/unary_impl';\nimport {unaryKernelFunc} from '../utils/unary_utils';\n\nexport const sigmoidImpl =\n createSimpleUnaryImpl((xi) => 1 / (1 + Math.exp(-xi)));\nexport const sigmoid =\n unaryKernelFunc(Sigmoid, (xi) => 1 / (1 + Math.exp(-xi)));\n\nexport const sigmoidConfig: KernelConfig = {\n kernelName: Sigmoid,\n backendName: 'cpu',\n kernelFunc: sigmoid,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, BackendValues, buffer, DataType, KernelConfig, KernelFunc, Slice, slice_util, SliceAttrs, SliceInputs, TensorInfo, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendCPU} from '../backend_cpu';\nimport {assertNotComplex} from '../cpu_util';\n\nexport function sliceImpl(\n vals: BackendValues, begin: number[], size: number[], shape: number[],\n dtype: DataType): BackendValues {\n const isContinous = slice_util.isSliceContinous(shape, begin, size);\n const length = util.sizeFromShape(size);\n const xStrides = util.computeStrides(shape);\n\n if (isContinous) {\n const flatOffset = slice_util.computeFlatOffset(begin, xStrides);\n\n if (dtype === 'string') {\n return (vals as Uint8Array[]).slice(flatOffset, flatOffset + length);\n }\n\n return (vals as TypedArray).subarray(flatOffset, flatOffset + length);\n }\n\n const decodedData = dtype === 'string' ?\n backend_util.fromUint8ToStringArray(vals as Uint8Array[]) :\n vals as TypedArray;\n\n const inBuf = buffer(shape, dtype, decodedData);\n const outBuf = buffer(size, dtype);\n for (let i = 0; i < outBuf.size; ++i) {\n const outLoc = outBuf.indexToLoc(i);\n const inLoc = outLoc.map((idx: number, j) => idx + begin[j]);\n outBuf.set(inBuf.get(...inLoc), ...outLoc);\n }\n\n if (dtype === 'string') {\n return backend_util.fromStringArrayToUint8(outBuf.values as string[]);\n }\n return outBuf.values as TypedArray;\n}\n\nexport function slice(\n args: {inputs: SliceInputs, backend: MathBackendCPU, attrs: SliceAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {begin, size} = attrs;\n\n assertNotComplex(x, 'slice');\n\n const [$begin, $size] = slice_util.parseSliceParams(x, begin, size);\n slice_util.assertParamsValid(x, $begin, $size);\n\n const vals = backend.data.get(x.dataId).values;\n const outVals = sliceImpl(vals, $begin, $size, x.shape, x.dtype);\n return backend.makeTensorInfo($size, x.dtype, outVals);\n}\n\nexport const sliceConfig: KernelConfig = {\n kernelName: Slice,\n backendName: 'cpu',\n kernelFunc: slice as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, DataType, TypedArray, util} from '@tensorflow/tfjs-core';\n\nexport function sparseFillEmptyRowsImpl(\n indices: TypedArray, indicesShape: number[], indicesDType: DataType,\n values: TypedArray, valuesDType: DataType, denseShape: TypedArray,\n defaultValue: number):\n [TypedArray, number[], TypedArray, boolean[], number[]] {\n const indicesCount = indicesShape[0];\n const denseRows = denseShape[0];\n\n const emptyRowIndicator: boolean[] = new Array(denseRows);\n const reverseIndexMap: number[] = new Array(indicesCount);\n\n const rank = indicesShape[1];\n\n if (denseRows === 0) {\n if (indicesCount !== 0) {\n throw new Error(\n backend_util.getSparseFillEmptyRowsIndicesDenseShapeMismatch(\n indicesCount));\n }\n const outputIndices = util.getArrayFromDType(indicesDType, 0) as TypedArray;\n const outputValues = util.getArrayFromDType(valuesDType, 0) as TypedArray;\n return [\n outputIndices, [0, rank], outputValues, emptyRowIndicator, reverseIndexMap\n ];\n }\n\n let rowsAreOrdered = true;\n let lastIndicesRow = 0;\n const csrOffset: number[] = new Array(denseRows).fill(0);\n\n for (let i = 0; i < indicesCount; ++i) {\n // indices is a 2d tensor with shape of [N, rank]\n const row = indices[i * rank];\n if (row < 0) {\n throw new Error(\n backend_util.getSparseFillEmptyRowsNegativeIndexErrorMessage(i, row));\n }\n if (row >= denseRows) {\n throw new Error(\n backend_util.getSparseFillEmptyRowsOutOfRangeIndexErrorMessage(\n i, row, denseRows));\n }\n ++csrOffset[row];\n rowsAreOrdered = rowsAreOrdered && (row >= lastIndicesRow);\n lastIndicesRow = row;\n }\n\n let allRowsFull = true;\n for (let row = 0; row < denseRows; ++row) {\n // csrOffset here describes the number of elements in this dense row\n const rowEmpty = (csrOffset[row] === 0);\n emptyRowIndicator[row] = rowEmpty;\n allRowsFull = allRowsFull && !rowEmpty;\n // In filled version, each row has at least one element.\n csrOffset[row] = Math.max(csrOffset[row], 1);\n // Update csrOffset to represent the number of elements up to and\n // including denseRows + 1:\n // csrOffset[0] == #{elements of row 0}\n // csrOffset[1] == #{elements of row 1} + #{elements of row 0}\n // ..\n // csrOffset[i] == starting index for elements in row i + 1.\n if (row > 0) {\n csrOffset[row] += csrOffset[row - 1];\n }\n }\n\n if (allRowsFull && rowsAreOrdered) {\n const outputIndices: TypedArray = indices;\n const outputValues: TypedArray = values;\n for (let i = 0; i < indicesCount; ++i) {\n reverseIndexMap[i] = i;\n }\n return [\n outputIndices, [indicesCount, rank], outputValues, emptyRowIndicator,\n reverseIndexMap\n ];\n } else {\n const fullIndicesCount = csrOffset[denseRows - 1];\n const outputIndices =\n util.getArrayFromDType(indicesDType, fullIndicesCount * rank) as\n TypedArray;\n const outputValues =\n util.getArrayFromDType(valuesDType, fullIndicesCount) as TypedArray;\n const filledCount: number[] = new Array(denseRows).fill(0);\n\n // Fill in values for rows that are not missing\n for (let i = 0; i < indicesCount; ++i) {\n // indices is a 2d tensor with shape of [N, rank]\n const row = indices[i * rank];\n const offset = filledCount[row];\n const outputI = ((row === 0) ? 0 : csrOffset[row - 1]) + offset;\n filledCount[row]++; // Increment the filled count for this row.\n for (let j = 0; j < rank; ++j) {\n // indices and outputIndices are 2d tensors with shape of [N, rank]\n outputIndices[outputI * rank + j] = indices[i * rank + j];\n }\n outputValues[outputI] = values[i];\n // We'll need this reverse index map to backprop correctly.\n reverseIndexMap[i] = outputI;\n }\n\n // Fill in values for rows that are missing\n for (let row = 0; row < denseRows; ++row) {\n const rowCount = filledCount[row];\n if (rowCount === 0) { // We haven't filled this row\n const startingIndex = (row === 0) ? 0 : csrOffset[row - 1];\n // Remaining index values were set to zero already.\n // Just need to set the row index in the right location.\n // outputIndices is a 2d tensor with shape of [N, rank]\n outputIndices[startingIndex * rank + 0] = row;\n for (let col = 1; col < rank; ++col) {\n outputIndices[startingIndex * rank + col] = 0;\n }\n outputValues[startingIndex] = defaultValue;\n }\n }\n return [\n outputIndices, [fullIndicesCount, rank], outputValues, emptyRowIndicator,\n reverseIndexMap\n ];\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, DataType, TypedArray, util} from '@tensorflow/tfjs-core';\n\nexport function sparseReshapeImpl(\n inputIndices: TypedArray, inputIndicesShape: number[], inputDType: DataType,\n inputShape: number[],\n targetShape: number[]): [TypedArray, number[], number[]] {\n const denseSize = util.sizeFromShape(inputShape);\n const nnz = inputIndicesShape[0];\n const outputRank = targetShape.length;\n\n // Compute the output shape. Determine product of specified dimensions, and\n // find the index of the unspecified one.\n const outputShape: number[] = [];\n let product = 1;\n let unknownIndex = -1;\n for (let d = 0; d < outputRank; ++d) {\n const size = targetShape[d];\n if (size === -1) {\n if (unknownIndex !== -1) {\n throw new Error(\n backend_util\n .getSparseReshapeMultipleNegativeOneOutputDimErrorMessage(\n unknownIndex, d));\n }\n unknownIndex = d;\n outputShape.push(1);\n } else {\n if (size < 0) {\n throw new Error(\n backend_util.getSparseReshapeNegativeOutputDimErrorMessage(\n d, size));\n }\n product *= size;\n outputShape.push(size);\n }\n }\n if (unknownIndex !== -1) {\n if (product <= 0) {\n throw new Error(\n backend_util.getSparseReshapeEmptyTensorZeroOutputDimErrorMessage());\n }\n const missing = Math.trunc(denseSize / product);\n if (product * missing !== denseSize) {\n throw new Error(\n backend_util.getSparseReshapeInputOutputMultipleErrorMessage(\n inputShape, outputShape));\n }\n\n outputShape[unknownIndex] = missing;\n }\n const outputSize = util.sizeFromShape(outputShape);\n if (outputSize !== denseSize) {\n throw new Error(\n backend_util.getSparseReshapeInputOutputMismatchErrorMessage(\n inputShape, outputShape));\n }\n\n const inputRank = inputShape.length;\n const inputStrides: number[] = [];\n if (inputRank > 0) {\n inputStrides[inputRank - 1] = 1;\n for (let d = inputRank - 2; d >= 0; --d) {\n inputStrides[d] = inputStrides[d + 1] * inputShape[d + 1];\n }\n }\n\n const outputStrides: number[] = [];\n if (outputRank > 0) {\n outputStrides[outputRank - 1] = 1;\n for (let d = outputRank - 2; d >= 0; --d) {\n outputStrides[d] = outputStrides[d + 1] * outputShape[d + 1];\n }\n }\n\n const newIndices =\n util.getArrayFromDType(inputDType, nnz * outputRank) as TypedArray;\n for (let i = 0; i < nnz; ++i) {\n let id = 0;\n for (let j = 0; j < inputRank; ++j) {\n // inputIndices is a 2d tensor with shape of [nnz, inputRank]\n id += inputIndices[i * inputRank + j] * inputStrides[j];\n }\n for (let j = 0; j < outputRank; ++j) {\n // newIndices is a 2d tensor with shape of [nnz, outputRank]\n newIndices[i * outputRank + j] = Math.trunc(id / outputStrides[j]);\n id %= outputStrides[j];\n }\n }\n return [newIndices, [nnz, outputRank], outputShape];\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, DataType, TypedArray, util} from '@tensorflow/tfjs-core';\n\nexport function sparseSegmentReductionImpl(\n input: TypedArray, inputShape: number[], inputDType: DataType,\n indices: TypedArray, segmentIds: TypedArray, isMean = false,\n defaultValue = 0): [TypedArray, number[]] {\n const numIndices = indices.length;\n\n // Flatten the array to two dimensions\n const inputFlat: number[] = [inputShape[0], input.length / inputShape[0]];\n const numCol = inputFlat[1];\n // Note that the current implementation assumes that segmentIds values are\n // sorted.\n const lastSegmentIdPlusOne =\n numIndices > 0 ? segmentIds[numIndices - 1] + 1 : 0;\n const outputRows = lastSegmentIdPlusOne;\n\n if (outputRows < 0) {\n throw new Error(\n backend_util.getSparseSegmentReductionNegativeSegmentIdsErrorMessage());\n }\n\n const outputShape = inputShape.slice();\n outputShape[0] = outputRows;\n\n const outputLength =\n outputShape.reduce((product, value) => product * value, 1);\n // Output array is initialized with the value 0 by default.\n const output = util.getArrayFromDType(inputDType, outputLength) as TypedArray;\n\n // Note that we do not initialize the output buffer with a default value, so\n // we need to explicitly set missing indices to the default value.\n if (numIndices === 0) {\n if (outputRows > 0) {\n output.fill(defaultValue);\n }\n return [output, outputShape];\n }\n\n if (outputRows <= 0) {\n throw new Error(\n backend_util.getSparseSegmentReductionNegativeSegmentIdsErrorMessage());\n }\n\n let start = 0, end = 1;\n // Index from which the output is not initialized.\n let uninitializedIndex = 0;\n let outIndex = segmentIds[start];\n\n while (true) {\n // We initialize nextIndex to 0 to avoid may be uninitialized warning\n let nextIndex = 0;\n if (end < numIndices) {\n nextIndex = segmentIds[end];\n if (outIndex === nextIndex) {\n ++end;\n continue;\n }\n // We have a new segment here. Verify that the segment ids are growing.\n if (outIndex >= nextIndex) {\n throw new Error(backend_util\n .getSparseSegmentReductionNonIncreasingSegmentIdsErrorMessage());\n }\n }\n\n if (outIndex < 0 || outIndex >= outputRows) {\n throw new Error(\n backend_util.getSparseSegmentReductionSegmentIdOutOfRangeErrorMessage(\n outIndex, outputRows));\n }\n\n // If there is a gap between two indices, we need to set that gap to the\n // default value.\n if (outIndex > uninitializedIndex) {\n output.fill(defaultValue, uninitializedIndex * numCol, outIndex * numCol);\n }\n\n for (let i = start; i < end; ++i) {\n const index = indices[i];\n if (index < 0 || index >= inputFlat[0]) {\n throw new Error(\n backend_util.getSparseSegmentReductionIndicesOutOfRangeErrorMessage(\n i, indices[i], inputFlat[0]));\n }\n for (let j = 0; j < numCol; j++) {\n output[outIndex * numCol + j] += input[index * numCol + j];\n }\n }\n\n if (isMean) {\n for (let j = 0; j < numCol; j++) {\n output[outIndex * numCol + j] /= end - start;\n }\n }\n\n start = end;\n ++end;\n uninitializedIndex = outIndex + 1;\n outIndex = nextIndex;\n if (end > numIndices) {\n break;\n }\n }\n\n // Fill the gap at the end with the default value.\n if (uninitializedIndex < outputRows) {\n output.fill(defaultValue, uninitializedIndex * numCol, outputRows * numCol);\n }\n\n return [output, outputShape];\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the License);\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an AS IS BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Sqrt} from '@tensorflow/tfjs-core';\n\nimport {createSimpleUnaryImpl} from '../utils/unary_impl';\nimport {unaryKernelFunc} from '../utils/unary_utils';\n\nexport const sqrtImpl = createSimpleUnaryImpl((xi) => Math.sqrt(xi));\nexport const sqrt = unaryKernelFunc(Sqrt, (xi) => Math.sqrt(xi));\n\nexport const sqrtConfig: KernelConfig = {\n kernelName: Sqrt,\n backendName: 'cpu',\n kernelFunc: sqrt,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, SquaredDifference} from '@tensorflow/tfjs-core';\n\nimport {createSimpleBinaryKernelImpl} from '../utils/binary_impl';\nimport {binaryKernelFunc} from '../utils/binary_utils';\n\nexport const squaredDifferenceImpl =\n createSimpleBinaryKernelImpl(((a: number, b: number) => {\n const diff = a - b;\n return diff * diff;\n }));\nexport const squaredDifference =\n binaryKernelFunc(SquaredDifference, squaredDifferenceImpl);\n\nexport const squaredDifferenceConfig: KernelConfig = {\n kernelName: SquaredDifference,\n backendName: 'cpu',\n kernelFunc: squaredDifference\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {buffer, Rank, TensorBuffer} from '@tensorflow/tfjs-core';\n\nexport function stridedSliceImpl(\n outShape: number[], xBuf: TensorBuffer, strides: number[],\n begin: number[]): TensorBuffer {\n const outBuf = buffer(outShape, xBuf.dtype);\n\n for (let i = 0; i < outBuf.size; i++) {\n const loc = outBuf.indexToLoc(i);\n\n const newLoc: number[] = new Array(loc.length);\n for (let j = 0; j < newLoc.length; j++) {\n newLoc[j] = loc[j] * strides[j] + begin[j];\n }\n outBuf.set(xBuf.get(...newLoc), ...loc);\n }\n\n return outBuf as TensorBuffer;\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {util} from '@tensorflow/tfjs-core';\n\n/**\n * The StringNGramsOp class creates ngrams from ragged string data.\n * The constructor contains all attributes related to the operation such as\n * padding widths and strings, and the compute function can be used to\n * compute the ngrams for different ragged tensor inputs.\n */\nclass StringNGramsOp {\n private separator: Uint8Array;\n private nGramWidths: number[];\n private padWidth: number;\n private leftPad: Uint8Array;\n private rightPad: Uint8Array;\n private preserveShort: boolean;\n\n constructor(\n separator: string, nGramWidths: number[], leftPad: string,\n rightPad: string, padWidth: number, preserveShortSequences: boolean) {\n this.separator = util.encodeString(separator);\n this.nGramWidths = nGramWidths;\n this.leftPad = util.encodeString(leftPad);\n this.rightPad = util.encodeString(rightPad);\n this.padWidth = padWidth;\n this.preserveShort = preserveShortSequences;\n }\n\n private getPadWidth(nGramWidth: number) {\n // Ngrams can be padded with either a fixed pad width or a dynamic pad\n // width depending on the 'padWidth' arg, but in no case should the padding\n // ever be wider than 'nGramWidth' - 1.\n return Math.min(\n this.padWidth < 0 ? nGramWidth - 1 : this.padWidth, nGramWidth - 1);\n }\n\n private getNumNGrams(length: number, nGramWidth: number) {\n const padWidth = this.getPadWidth(nGramWidth);\n return Math.max(0, ((length + 2 * padWidth) - nGramWidth) + 1);\n }\n\n private createNGrams(\n data: Uint8Array[], splitIndex: number, output: Uint8Array[],\n outputStartIndex: number, numNGrams: number, nGramWidth: number) {\n for (let nGramIndex = 0; nGramIndex < numNGrams; ++nGramIndex) {\n const padWidth = this.getPadWidth(nGramWidth);\n const leftPadding = Math.max(0, padWidth - nGramIndex);\n const rightPadding =\n Math.max(0, padWidth - (numNGrams - (nGramIndex + 1)));\n const numTokens = nGramWidth - (leftPadding + rightPadding);\n const dataStartIndex =\n splitIndex + (leftPadding > 0 ? 0 : nGramIndex - padWidth);\n\n // Calculate the total expected size of the nGram so we can reserve the\n // correct amount of space in the string.\n let nGramSize = 0;\n // Size of the left padding.\n nGramSize += leftPadding * this.leftPad.length;\n // Size of the tokens.\n for (let n = 0; n < numTokens; ++n) {\n nGramSize += data[dataStartIndex + n].length;\n }\n // Size of the right padding.\n nGramSize += rightPadding * this.rightPad.length;\n // Size of the separators.\n const numSeparators = leftPadding + rightPadding + numTokens - 1;\n nGramSize += numSeparators * this.separator.length;\n\n // Build the nGram.\n output[outputStartIndex + nGramIndex] = new Uint8Array(nGramSize);\n const nGram = output[outputStartIndex + nGramIndex];\n\n let nextNGramIndex = 0;\n const appendToNGram = (str: Uint8Array) =>\n str.forEach((value) => nGram[nextNGramIndex++] = value);\n\n for (let n = 0; n < leftPadding; ++n) {\n appendToNGram(this.leftPad);\n appendToNGram(this.separator);\n }\n // Only output first numTokens - 1 pairs of data and separator\n for (let n = 0; n < numTokens - 1; ++n) {\n appendToNGram(data[dataStartIndex + n]);\n appendToNGram(this.separator);\n }\n // Handle case when there are no tokens or no right padding as these\n // can result in consecutive separators.\n if (numTokens > 0) {\n // If we have tokens, then output last and then pair each separator\n // with the right padding that follows, to ensure nGram ends either with\n // the token or with the right pad.\n appendToNGram(data[dataStartIndex + numTokens - 1]);\n for (let n = 0; n < rightPadding; ++n) {\n appendToNGram(this.separator);\n appendToNGram(this.rightPad);\n }\n } else {\n // If we don't have tokens, then the last item inserted into the nGram\n // has been the separator from the left padding loop above. Hence,\n // output right pad and separator and make sure to finish with a\n // padding, not a separator.\n for (let n = 0; n < rightPadding - 1; ++n) {\n appendToNGram(this.rightPad);\n appendToNGram(this.separator);\n }\n appendToNGram(this.rightPad);\n }\n }\n }\n\n // Data and splits together form the definition of the ragged tensor,\n // where data is 1 dimensional and contains the values of the tensor\n // and splits denotes the indices at which each row starts.\n public compute(data: Uint8Array[], splits: Int32Array):\n [Uint8Array[], Int32Array] {\n // Validate that the splits are valid indices into data, only if there are\n // splits specified.\n const inputDataSize = data.length;\n const splitsSize = splits.length;\n if (splitsSize > 0) {\n let prevSplit = splits[0];\n if (prevSplit !== 0) {\n throw new Error(`First split value must be 0, got ${prevSplit}`);\n }\n for (let i = 1; i < splitsSize; ++i) {\n let validSplits = splits[i] >= prevSplit;\n validSplits = validSplits && (splits[i] <= inputDataSize);\n if (!validSplits) {\n throw new Error(`Invalid split value ${splits[i]}, must be in [${\n prevSplit}, ${inputDataSize}]`);\n }\n prevSplit = splits[i];\n }\n if (prevSplit !== inputDataSize) {\n throw new Error(`Last split value must be data size. Expected ${\n inputDataSize}, got ${prevSplit}`);\n }\n }\n\n const numBatchItems = splitsSize - 1;\n const nGramsSplits = util.getArrayFromDType('int32', splitsSize);\n // If there is no data or size, return an empty ragged tensor.\n if (inputDataSize === 0 || splitsSize === 0) {\n const empty: Uint8Array[] = new Array(inputDataSize);\n for (let i = 0; i <= numBatchItems; ++i) {\n nGramsSplits[i] = 0;\n }\n return [empty, nGramsSplits];\n }\n\n nGramsSplits[0] = 0;\n for (let i = 1; i <= numBatchItems; ++i) {\n const length = splits[i] - splits[i - 1];\n let numNGrams = 0;\n this.nGramWidths.forEach((nGramWidth) => {\n numNGrams += this.getNumNGrams(length, nGramWidth);\n });\n if (this.preserveShort && length > 0 && numNGrams === 0) {\n numNGrams = 1;\n }\n nGramsSplits[i] = nGramsSplits[i - 1] + numNGrams;\n }\n\n const nGrams: Uint8Array[] = new Array(nGramsSplits[numBatchItems]);\n\n for (let i = 0; i < numBatchItems; ++i) {\n const splitIndex = splits[i];\n let outputStartIdx = nGramsSplits[i];\n this.nGramWidths.forEach((nGramWidth) => {\n const length = splits[i + 1] - splits[i];\n const numNGrams = this.getNumNGrams(length, nGramWidth);\n this.createNGrams(\n data, splitIndex, nGrams, outputStartIdx, numNGrams, nGramWidth);\n outputStartIdx += numNGrams;\n });\n // If we're preserving short sequences, check to see if no sequence was\n // generated by comparing the current output start idx to the original\n // one (nGramSplitsdata). If no ngrams were generated, then they will\n // be equal (since we increment outputStartIdx by numNGrams every\n // time we create a set of ngrams.)\n if (this.preserveShort && outputStartIdx === nGramsSplits[i]) {\n const dataLength = splits[i + 1] - splits[i];\n // One legitimate reason to not have any ngrams when this.preserveShort\n // is true is if the sequence itself is empty. In that case, move on.\n if (dataLength === 0) {\n continue;\n }\n // We don't have to worry about dynamic padding sizes here: if padding\n // was dynamic, every sequence would have had sufficient padding to\n // generate at least one nGram.\n const nGramWidth = dataLength + 2 * this.padWidth;\n const numNGrams = 1;\n this.createNGrams(\n data, splitIndex, nGrams, outputStartIdx, numNGrams, nGramWidth);\n }\n }\n return [nGrams, nGramsSplits];\n }\n}\n\nexport function stringNGramsImpl(\n data: Uint8Array[], dataSplits: Int32Array, separator: string,\n nGramWidths: number[], leftPad: string, rightPad: string, padWidth: number,\n preserveShortSequences: boolean): [Uint8Array[], Int32Array] {\n return new StringNGramsOp(\n separator, nGramWidths, leftPad, rightPad, padWidth,\n preserveShortSequences)\n .compute(data, dataSplits);\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {TypedArray, util} from '@tensorflow/tfjs-core';\n\nfunction split(\n str: Uint8Array, delimiters: Uint8Array, skipEmpty: boolean,\n result: Uint8Array[]): void {\n if (!str.length) {\n return;\n }\n // When the delimiter is empty, the input is split into individual characters.\n if (delimiters.length === 0) {\n for (let i = 0; i < str.length; ++i) {\n result.push(str.subarray(i, i + 1));\n }\n return;\n }\n // When there is one delimiter, the input is split only at that delimiter.\n if (delimiters.length === 1) {\n const delimiter = delimiters[0];\n let f = str.indexOf(delimiter);\n while (f !== -1) {\n const token = str.subarray(0, f);\n if (!skipEmpty || token.length !== 0) {\n result.push(token);\n }\n str = str.subarray(f + 1);\n f = str.indexOf(delimiter);\n }\n if (!skipEmpty || str.length !== 0) {\n result.push(str);\n }\n return;\n }\n // When there are multiple delimiters, the input is split at every instance\n // one of the delimiters appears.\n let tokenStart = 0;\n for (let i = 0; i < str.length + 1; i++) {\n if ((i === str.length) || (delimiters.indexOf(str[i]) !== -1)) {\n const token = str.subarray(tokenStart, i);\n if (!skipEmpty || token.length !== 0) {\n result.push(token);\n }\n tokenStart = i + 1;\n }\n }\n}\n\nexport function stringSplitImpl(\n input: Uint8Array[], delimiter: Uint8Array,\n skipEmpty: boolean): [TypedArray, Uint8Array[], [number, number]] {\n const batchSize = input.length;\n\n // Empty delimiter means split the input character by character.\n const tokens: Uint8Array[] = [];\n\n let outputSize = 0;\n let maxNumEntries = 0;\n const numIndices: number[] = new Array(batchSize);\n for (let i = 0; i < batchSize; ++i) {\n const prevTokensLength = tokens.length;\n split(input[i], delimiter, skipEmpty, tokens);\n const nEntries = tokens.length - prevTokensLength;\n numIndices[i] = nEntries;\n outputSize += nEntries;\n maxNumEntries = Math.max(maxNumEntries, nEntries);\n }\n\n const indices = util.getArrayFromDType('int32', outputSize * 2) as TypedArray;\n const values: Uint8Array[] = new Array(outputSize);\n const shape: [number, number] = [batchSize, maxNumEntries];\n\n let c = 0;\n for (let i = 0; i < batchSize; ++i) {\n for (let j = 0; j < numIndices[i]; ++j) {\n // indices is a 2d tensor with shape of [outputSize, 2]\n indices[c * 2] = i;\n indices[c * 2 + 1] = j;\n values[c] = tokens[c];\n ++c;\n }\n }\n\n return [indices, values, shape];\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {TypedArray, util} from '@tensorflow/tfjs-core';\n\nexport function stringToHashBucketFastImpl(\n input: Uint8Array[], numBuckets: number): TypedArray {\n const output = util.getArrayFromDType('int32', input.length) as TypedArray;\n\n for (let i = 0; i < input.length; ++i) {\n output[i] =\n util.fingerPrint64(input[i]).modulo(numBuckets).getLowBitsUnsigned();\n }\n\n return output;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Sub} from '@tensorflow/tfjs-core';\n\nimport {createSimpleBinaryKernelImpl} from '../utils/binary_impl';\nimport {binaryKernelFunc, createComplexBinaryKernelImpl} from '../utils/binary_utils';\n\nexport const subImpl = createSimpleBinaryKernelImpl(\n ((aValue: number, bValue: number) => aValue - bValue));\nexport const subComplexImpl =\n createComplexBinaryKernelImpl(((aReal, aImag, bReal, bImag) => {\n return {real: aReal - bReal, imag: aImag - bImag};\n }));\nexport const sub = binaryKernelFunc(Sub, subImpl, subComplexImpl);\n\nexport const subConfig: KernelConfig = {\n kernelName: Sub,\n backendName: 'cpu',\n kernelFunc: sub\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {buffer, DataType, Rank, TensorBuffer} from '@tensorflow/tfjs-core';\n\n/**\n * An implementation of the tile kernel shared between webgl and cpu for string\n * tensors only.\n */\n\nexport function tileImpl(\n xBuf: TensorBuffer,\n reps: number[]): TensorBuffer {\n const newShape: number[] = new Array(xBuf.rank);\n for (let i = 0; i < newShape.length; i++) {\n newShape[i] = xBuf.shape[i] * reps[i];\n }\n const result = buffer(newShape, xBuf.dtype);\n for (let i = 0; i < result.values.length; ++i) {\n const newLoc = result.indexToLoc(i);\n\n const originalLoc: number[] = new Array(xBuf.rank);\n for (let j = 0; j < originalLoc.length; j++) {\n originalLoc[j] = newLoc[j] % xBuf.shape[j];\n }\n\n const originalIndex = xBuf.locToIndex(originalLoc);\n\n result.values[i] = xBuf.values[originalIndex];\n }\n return result as TensorBuffer;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/** An implementation of the TopK kernel shared between webgl and cpu. */\n\nimport {buffer, NumericDataType, Rank, ShapeMap, Tensor, TensorBuffer, TypedArray, util} from '@tensorflow/tfjs-core';\n\ntype Pair = {\n value: number,\n index: number\n};\n\nconst comparePair = (a: Pair, b: Pair) => {\n const valueDiff = b.value - a.value;\n return valueDiff === 0 ? a.index - b.index : valueDiff;\n};\n\n/**\n * Partitions array where all elements smaller than the (k+1) smallest element\n * are found to the left of it, and all larger to the right of it.\n * Based on the Floyd-Rivest Algorithm, ref:\n * https://en.wikipedia.org/wiki/Floyd%E2%80%93Rivest_algorithm\n * @param array: Array to partition\n * @param left: Left index for the interval\n * @param right: Right index for the interval\n * @param k: Desired index value, where array[k] is the (k+1)th smallest element\n * when left = 0\n */\nfunction select(array: Pair[], k: number, left = 0, right = array.length - 1) {\n while (right > left) {\n // Use select recursively to sample a smaller set of size s\n // the arbitrary constants 600 and 0.5 are used in the original\n // version to minimize execution time.\n if (right - left > 600) {\n const n = right - left + 1;\n const i = k - left + 1;\n const z = Math.log(n);\n const s = 0.5 * Math.exp(2 * z / 3);\n const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * Math.sign(i - n / 2);\n const newLeft = Math.max(left, Math.floor(k - i * s / n + sd));\n const newRight = Math.min(right, Math.floor(k + (n - i) * s / n + sd));\n select(array, k, newLeft, newRight);\n }\n // partition the elements between left and right around t\n const t = array[k];\n let i = left;\n let j = right;\n\n util.swap(array, left, k);\n\n if (comparePair(array[right], t) > 0) {\n util.swap(array, left, right);\n }\n while (i < j) {\n util.swap(array, i, j);\n i++;\n j--;\n while (comparePair(array[i], t) < 0) {\n i = i + 1;\n }\n while (comparePair(array[j], t) > 0) {\n j = j - 1;\n }\n }\n if (comparePair(array[left], t) === 0) {\n util.swap(array, left, j);\n } else {\n j = j + 1;\n util.swap(array, j, right);\n }\n // Adjust left and right towards the boundaries of the subset\n // containing the (k - left + 1)th smallest element.\n if (j <= k) {\n left = j + 1;\n }\n if (k <= j) {\n right = j - 1;\n }\n }\n}\n\nexport function topKImpl(\n x: TypedArray, xShape: number[], xDtype: NumericDataType, k: number,\n sorted: boolean):\n [TensorBuffer, TensorBuffer] {\n // Reshape into a 2d tensor [batch, lastDim] and compute topk along lastDim.\n const lastDim = xShape[xShape.length - 1];\n const [batch, size] = [x.length / lastDim, lastDim];\n const allTopKVals = util.getTypedArrayFromDType(xDtype, batch * k);\n const allTopKIndices = util.getTypedArrayFromDType('int32', batch * k);\n\n for (let b = 0; b < batch; b++) {\n const offset = b * size;\n const vals = x.subarray(offset, offset + size);\n\n let valAndInd: Pair[] = new Array(vals.length);\n vals.forEach(\n (value: number, index: number) => valAndInd[index] = {value, index});\n\n if (k < valAndInd.length) {\n select(valAndInd, k);\n valAndInd = valAndInd.slice(0, k);\n }\n\n if (sorted) {\n valAndInd.sort(comparePair);\n }\n \n const outOffset = b * k;\n const topKVals = allTopKVals.subarray(outOffset, outOffset + k);\n const topKIndices = allTopKIndices.subarray(outOffset, outOffset + k);\n for (let i = 0; i < k; i++) {\n topKVals[i] = valAndInd[i].value;\n topKIndices[i] = valAndInd[i].index;\n }\n }\n // Reshape back to the original input shape, except that the last\n // dimension is k.\n const outputShape = xShape.slice();\n outputShape[outputShape.length - 1] = k;\n\n return [\n buffer(outputShape as ShapeMap[R], xDtype, allTopKVals),\n buffer(outputShape as ShapeMap[R], 'int32', allTopKIndices)\n ];\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {BackendValues, DataType, TensorBuffer, TypedArray, util} from '@tensorflow/tfjs-core';\n\nexport function uniqueImpl(\n values: BackendValues, axis: number, shape: number[], dtype: DataType): {\n outputValues: BackendValues,\n outputShape: number[],\n indices: BackendValues\n} {\n // Normalize and validate axis.\n const $axis = util.parseAxisParam(axis, shape)[0];\n\n // Calculate the new shape that is suitable for extracting data along the\n // given axis.\n //\n // The rank is 3.\n // The size of the 1st dimension is the size of all the axes < the given axis.\n // The size of the 2nd dimension is the same as the size of the given axis.\n // The size of the 3rd dimension is the size of all the axes > the given axis.\n //\n // For example, for a 4D tensor with shape=[2, 3, 5, 4] and axis=2, the\n // newShape would be: [2*3, 5, 4].\n //\n // Note that this is not the final output shape. This will be the shape for an\n // intermediate TensorBuffer (see inputBuffer below) to allow us to extract\n // values along the given axis. To demonstrate how it works, consider the\n // following example:\n //\n // Input: a 3D tensor, with shape [1, 2, 3]\n // [\n // [\n // [1,2,3],\n // [4,5,6]\n // ]\n // ]\n // Axis: 2 (the last axis).\n // Along axis 2, we expect to extract 3 tensors: [1,4], [2,5], [3,6].\n //\n // For this example, newShape would be: [2, 3, 1], where 2 is calculated from\n // 1*2. The re-shaped data would look like:\n //\n // [\n // [\n // [1], [2], [3]\n // ],\n // [\n // [4], [5], [6]\n // ]\n // ]\n //\n // Then, we can construct a 3-level nested loop by the following dimension\n // order to extract the values along the axis (dimension1):\n // i: dimension1 // 0,1,2 (newShape[1])\n // m: dimension0 // 0,1 (newShape[0])\n // n: dimension2 // 0 (newShape[2])\n //\n // m, i, n\n // ---------\n // Iteration 0: data at [0, 0, 0] => \"1\"\n // Iteration 1: data at [1, 0, 0] => \"4\"\n // We got [1,4].\n // Iteration 2: data at [0, 1, 0] => \"2\"\n // Iteration 3: data at [1, 1, 0] => \"5\"\n // We got [2,5].\n // Iteration 4: data at [0, 2, 0] => \"3\"\n // Iteration 5: data at [1, 2, 0] => \"6\"\n // We got [3,6].\n const newShape = [1, shape[0], 1];\n for (let i = 0; i < $axis; i++) {\n newShape[0] *= shape[i];\n }\n newShape[1] = shape[$axis];\n for (let i = $axis + 1; i < shape.length; i++) {\n newShape[2] *= shape[i];\n }\n\n // A map from unique elements (their string representations) to their values\n // in \"indices\" (below).\n const uniqueElements: {[key: string]: number} = {};\n // The indices of each unique element in the original tensor along the given\n // axis. It is 1D and has the same size as the given axis.\n const indices = new Int32Array(shape[$axis]);\n // Create a buffer so we can easily extract value at a given location.\n const inputBuffer = new TensorBuffer(newShape, dtype, values as TypedArray);\n // The indices along the given axis that have unique elements. This is a\n // de-duped version of \"indices\" above.\n const uniqueIndices: number[] = [];\n const is1DTensor = newShape[0] === 1 && newShape[2] === 1;\n for (let i = 0; i < shape[$axis]; i++) {\n // Extract values along the axis.\n let element: string;\n if (is1DTensor) {\n // Fast path for 1D tensor input.\n element = values[i].toString();\n } else {\n const axisValues = [];\n for (let m = 0; m < newShape[0]; m++) {\n for (let n = 0; n < newShape[2]; n++) {\n axisValues.push(inputBuffer.get(m, i, n));\n }\n }\n element = axisValues.join(',');\n }\n\n // Dedup and update various indices.\n if (uniqueElements[element] !== undefined) {\n indices[i] = uniqueElements[element];\n } else {\n const uniqueIndex = Object.keys(uniqueElements).length;\n uniqueElements[element] = uniqueIndex;\n indices[i] = uniqueIndex;\n uniqueIndices.push(i);\n }\n }\n\n // Now we know where each of the unique elements are located along the axis\n // (uniqueIndices). Extract them from input buffer and store them in the\n // output buffer.\n const outputTmpShape = newShape.slice();\n outputTmpShape[1] = Object.keys(uniqueElements).length;\n const outputBuffer = new TensorBuffer(outputTmpShape, dtype);\n uniqueIndices.forEach((uniqueElementIndex, i) => {\n for (let m = 0; m < newShape[0]; m++) {\n for (let n = 0; n < newShape[2]; n++) {\n outputBuffer.set(inputBuffer.get(m, uniqueElementIndex, n), m, i, n);\n }\n }\n });\n\n // The output shape can be calculated from the input shape with the size of\n // the given axis replaced by the number of unique elements along that axis.\n const outputShape = shape.slice();\n outputShape[$axis] = outputTmpShape[1];\n\n return {\n outputValues: outputBuffer.values as BackendValues,\n outputShape,\n indices,\n };\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// Shared functionality among backends.\nexport {simpleAbsImpl} from './kernels/Abs';\nexport {addImpl} from './kernels/Add';\nexport {bincountImpl, bincountReduceImpl} from './kernels/Bincount_impl';\nexport {castImpl} from './kernels/Cast';\nexport {ceilImpl} from './kernels/Ceil';\nexport {concatImpl} from './kernels/Concat_impl';\nexport {equalImpl} from './kernels/Equal';\nexport {expImpl} from './kernels/Exp';\nexport {expm1Impl} from './kernels/Expm1';\nexport {floorImpl} from './kernels/Floor';\nexport {gatherNdImpl} from './kernels/GatherNd_Impl';\nexport {gatherV2Impl} from './kernels/GatherV2_impl';\nexport {greaterImpl} from './kernels/Greater';\nexport {greaterEqualImpl} from './kernels/GreaterEqual';\nexport {lessImpl} from './kernels/Less';\nexport {lessEqualImpl} from './kernels/LessEqual';\nexport {linSpaceImpl} from './kernels/LinSpace_impl';\nexport {logImpl} from './kernels/Log';\nexport {maxImpl} from './kernels/Max_impl';\nexport {maximumImpl} from './kernels/Maximum';\nexport {minimumImpl} from './kernels/Minimum';\nexport {multiplyImpl} from './kernels/Multiply';\nexport {negImpl} from './kernels/Neg';\nexport {notEqualImpl} from './kernels/NotEqual';\nexport {prodImpl} from './kernels/Prod';\nexport {raggedGatherImpl} from './kernels/RaggedGather_impl';\nexport {raggedRangeImpl} from './kernels/RaggedRange_impl';\nexport {raggedTensorToTensorImpl} from './kernels/RaggedTensorToTensor_impl';\nexport {rangeImpl} from './kernels/Range_impl';\nexport {rsqrtImpl} from './kernels/Rsqrt';\nexport {scatterImpl} from './kernels/Scatter_impl';\nexport {sigmoidImpl} from './kernels/Sigmoid';\nexport {sliceImpl} from './kernels/Slice';\nexport {sparseFillEmptyRowsImpl} from './kernels/SparseFillEmptyRows_impl';\nexport {sparseReshapeImpl} from './kernels/SparseReshape_impl';\nexport {sparseSegmentReductionImpl} from './kernels/SparseSegmentReduction_impl';\nexport {sqrtImpl} from './kernels/Sqrt';\nexport {squaredDifferenceImpl} from './kernels/SquaredDifference';\nexport {stridedSliceImpl} from './kernels/StridedSlice_impl';\nexport {stringNGramsImpl} from './kernels/StringNGrams_impl';\nexport {stringSplitImpl} from './kernels/StringSplit_impl';\nexport {stringToHashBucketFastImpl} from './kernels/StringToHashBucketFast_impl';\nexport {subImpl} from './kernels/Sub';\nexport {tileImpl} from './kernels/Tile_impl';\nexport {topKImpl} from './kernels/TopK_impl';\nexport {transposeImpl} from './kernels/Transpose_impl';\nexport {uniqueImpl} from './kernels/Unique_impl';\nexport {ComplexBinaryKernelImpl, SimpleBinaryKernelImpl} from './utils/binary_types';\n","\n/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// Import shared functionality from tfjs-backend-cpu without triggering\n// side effects.\n// tslint:disable-next-line: no-imports-from-dist\nimport * as shared from '@tensorflow/tfjs-backend-cpu/dist/shared';\n// tslint:disable-next-line: no-imports-from-dist\nimport {SimpleBinaryKernelImpl} from '@tensorflow/tfjs-backend-cpu/dist/shared';\n// tslint:disable-next-line: no-imports-from-dist\nimport {SimpleUnaryImpl} from '@tensorflow/tfjs-backend-cpu/dist/utils/unary_types';\n\nexport type SimpleBinaryKernelImplCPU = SimpleBinaryKernelImpl;\nexport type SimpleUnaryKernelImplCPU = SimpleUnaryImpl;\nconst {\n addImpl: addImplCPU,\n bincountImpl: bincountImplCPU,\n bincountReduceImpl: bincountReduceImplCPU,\n castImpl: castImplCPU,\n ceilImpl: ceilImplCPU,\n concatImpl: concatImplCPU,\n equalImpl: equalImplCPU,\n expImpl: expImplCPU,\n expm1Impl: expm1ImplCPU,\n floorImpl: floorImplCPU,\n gatherNdImpl: gatherNdImplCPU,\n gatherV2Impl: gatherV2ImplCPU,\n greaterImpl: greaterImplCPU,\n greaterEqualImpl: greaterEqualImplCPU,\n lessImpl: lessImplCPU,\n lessEqualImpl: lessEqualImplCPU,\n linSpaceImpl: linSpaceImplCPU,\n logImpl: logImplCPU,\n maxImpl: maxImplCPU,\n maximumImpl: maximumImplCPU,\n minimumImpl: minimumImplCPU,\n multiplyImpl: multiplyImplCPU,\n negImpl: negImplCPU,\n notEqualImpl: notEqualImplCPU,\n prodImpl: prodImplCPU,\n raggedGatherImpl: raggedGatherImplCPU,\n raggedRangeImpl: raggedRangeImplCPU,\n raggedTensorToTensorImpl: raggedTensorToTensorImplCPU,\n rangeImpl: rangeImplCPU,\n rsqrtImpl: rsqrtImplCPU,\n scatterImpl: scatterImplCPU,\n sigmoidImpl: sigmoidImplCPU,\n simpleAbsImpl: simpleAbsImplCPU,\n sliceImpl: sliceImplCPU,\n sparseFillEmptyRowsImpl: sparseFillEmptyRowsImplCPU,\n sparseReshapeImpl: sparseReshapeImplCPU,\n sparseSegmentReductionImpl: sparseSegmentReductionImplCPU,\n sqrtImpl: sqrtImplCPU,\n stridedSliceImpl: stridedSliceImplCPU,\n stringNGramsImpl: stringNGramsImplCPU,\n stringSplitImpl: stringSplitImplCPU,\n stringToHashBucketFastImpl: stringToHashBucketFastImplCPU,\n subImpl: subImplCPU,\n tileImpl: tileImplCPU,\n topKImpl: topKImplCPU,\n transposeImpl: transposeImplCPU,\n uniqueImpl: uniqueImplCPU,\n} = shared;\n\nexport {\n addImplCPU,\n bincountImplCPU,\n bincountReduceImplCPU,\n castImplCPU,\n ceilImplCPU,\n concatImplCPU,\n equalImplCPU,\n expImplCPU,\n expm1ImplCPU,\n floorImplCPU,\n gatherNdImplCPU,\n gatherV2ImplCPU,\n greaterEqualImplCPU,\n greaterImplCPU,\n lessEqualImplCPU,\n lessImplCPU,\n linSpaceImplCPU,\n logImplCPU,\n maxImplCPU,\n maximumImplCPU,\n minimumImplCPU,\n multiplyImplCPU,\n negImplCPU,\n notEqualImplCPU,\n prodImplCPU,\n raggedGatherImplCPU,\n raggedRangeImplCPU,\n raggedTensorToTensorImplCPU,\n scatterImplCPU,\n sigmoidImplCPU,\n simpleAbsImplCPU,\n sliceImplCPU,\n sparseFillEmptyRowsImplCPU,\n sparseReshapeImplCPU,\n sparseSegmentReductionImplCPU,\n sqrtImplCPU,\n stridedSliceImplCPU,\n stringNGramsImplCPU,\n stringSplitImplCPU,\n stringToHashBucketFastImplCPU,\n subImplCPU,\n rangeImplCPU,\n rsqrtImplCPU,\n tileImplCPU,\n topKImplCPU,\n transposeImplCPU,\n uniqueImplCPU,\n};\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nexport function getVecChannels(name: string, rank: number): string[] {\n return ['x', 'y', 'z', 'w', 'u', 'v'].slice(0, rank).map(d => `${name}.${d}`);\n}\n\nexport function getChannels(name: string, rank: number): string[] {\n if (rank === 1) {\n return [name];\n }\n return getVecChannels(name, rank);\n}\n\nexport function getSourceCoords(rank: number, dims: string[]): string {\n if (rank === 1) {\n return 'rc';\n }\n\n let coords = '';\n for (let i = 0; i < rank; i++) {\n coords += dims[i];\n if (i < rank - 1) {\n coords += ',';\n }\n }\n return coords;\n}","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram, useShapeUniforms} from './gpgpu_math';\nimport {getChannels} from './packing_util';\nimport {getCoordsDataType} from './shader_compiler';\n\nexport class PackProgram implements GPGPUProgram {\n variableNames = ['A'];\n outputShape: number[];\n userCode: string;\n packedInputs = false;\n packedOutput = true;\n enableShapeUniforms: boolean;\n rank: number;\n\n constructor(\n outputShape:\n number[]) { // TODO(https://github.com/tensorflow/tfjs/issues/893):\n // Only input / output 3D tensors.\n this.outputShape = outputShape;\n this.rank = outputShape.length;\n this.enableShapeUniforms = useShapeUniforms(this.outputShape.length);\n\n if (this.rank === 0) {\n this.userCode = `\n void main() {\n setOutput(vec4(getA(), 0., 0., 0.));\n }\n `;\n } else {\n const channels = getChannels('rc', this.rank);\n const dtype = getCoordsDataType(this.rank);\n const outOfBoundsCondition = this.getOutOfBoundsCondition(channels);\n const setup = this.getSetup(channels);\n const output = this.getOutput(channels);\n\n this.userCode = `\n void main() {\n ${dtype} rc = getOutputCoords();\n\n if(${outOfBoundsCondition}) {\n setOutput(vec4(0));\n } else {\n ${setup}\n\n setOutput(vec4(${output}));\n }\n }\n `;\n }\n }\n\n private getSourceCoordsArr(dims: string[]): string[] {\n const coords = [];\n\n for (let row = 0; row <= 1; row++) {\n for (let col = 0; col <= 1; col++) {\n let coord = `${row === 0 ? 'r' : 'rp1'}, ${col === 0 ? 'c' : 'cp1'}`;\n\n for (let d = 2; d < this.rank; d++) {\n coord = `${dims[dims.length - 1 - d]},` + coord;\n }\n\n coords.push(coord);\n }\n }\n return coords;\n }\n\n private getOutOfBoundsCondition(dims: string[]): string {\n if (this.rank === 1) {\n return `rc > ${\n this.enableShapeUniforms ? 'outShape' : this.outputShape[0]}`;\n }\n\n let cond = '';\n for (let i = this.rank - 2; i < this.rank; i++) {\n cond += `${dims[i]} >= ${\n this.enableShapeUniforms ? `outShape[${i}]` : this.outputShape[i]}`;\n if (i < this.rank - 1) {\n cond += '||';\n }\n }\n\n return cond;\n }\n\n private getSetup(dims: string[]): string {\n if (this.rank === 1) {\n return '';\n }\n\n const innerDims = dims.slice(-2);\n const col = this.enableShapeUniforms ? `outShape[${this.rank} - 1]` :\n this.outputShape[this.rank - 1];\n const row = this.enableShapeUniforms ? `outShape[${this.rank} - 2]` :\n this.outputShape[this.rank - 2];\n\n return `\n int r = ${innerDims[0]};\n int c = ${innerDims[1]};\n int rp1 = r + 1;\n int cp1 = c + 1;\n\n bool cEdge = cp1 >= ${col};\n bool rEdge = rp1 >= ${row};\n `;\n }\n\n private getOutput(dims: string[]): string {\n const sourceCoords = this.getSourceCoordsArr(dims);\n if (this.rank === 1) {\n const outShape =\n this.enableShapeUniforms ? 'outShape' : this.outputShape[0];\n return `getA(rc), (rc + 1 >= ${outShape} ? 0. : getA(rc + 1)), 0, 0`;\n }\n\n return `getA(${sourceCoords[0]}),\n cEdge ? 0. : getA(${sourceCoords[1]}),\n rEdge ? 0. : getA(${sourceCoords[2]}),\n rEdge || cEdge ? 0. : getA(${sourceCoords[3]})`;\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram, useShapeUniforms} from './gpgpu_math';\nimport * as shader_util from './shader_compiler_util';\n\nexport class ReshapePackedProgram implements GPGPUProgram {\n variableNames = ['A'];\n packedInputs = true;\n packedOutput = true;\n outputShape: number[];\n userCode: string;\n enableShapeUniforms: boolean;\n customUniforms = [{name: 'inputShape', type: 'ivec3' as const }];\n\n constructor(outputShape: [number, number, number], inputShape: [\n number, number, number\n ]) {\n this.outputShape = outputShape;\n this.enableShapeUniforms = useShapeUniforms(this.outputShape.length);\n\n let mainLoop = ``;\n for (let i = 0; i < 4; i++) {\n let thisRC = `thisRC = rc;`;\n if (i % 2 === 1) {\n thisRC += `thisRC.z += 1;`;\n }\n if (i > 1) {\n thisRC += `thisRC.y += 1;`;\n }\n\n mainLoop += `\n ${thisRC}\n ${i > 0 ? `if(thisRC.y < rows && thisRC.z < cols){` : ''}\n int flatIndex = getFlatIndex(thisRC);\n\n ivec3 inputRC = inputCoordsFromReshapedOutCoords(flatIndex);\n vec2 inputRCInnerDims = vec2(float(inputRC.y),float(inputRC.z));\n\n result[${i}] =\n getChannel(getA(inputRC.x, inputRC.y, inputRC.z), inputRCInnerDims);\n ${i > 0 ? '}' : ''}\n `;\n }\n\n this.userCode = `\n ${getReshapedInputCoords(inputShape, this.enableShapeUniforms)}\n ${\n this.enableShapeUniforms ? shader_util.getFlatIndexFrom3DOutput() :\n shader_util.getFlatIndexFrom3D(outputShape)}\n\n void main() {\n ivec3 rc = getOutputCoords();\n\n vec4 result = vec4(0.);\n\n ivec3 thisRC;\n int rows = ${this.enableShapeUniforms ? 'outShape[1]' : outputShape[1]};\n int cols = ${this.enableShapeUniforms ? 'outShape[2]' : outputShape[2]};\n\n ${mainLoop}\n\n setOutput(result);\n }\n `;\n }\n}\n\nfunction getReshapedInputCoords(\n shape: [number, number, number], enableShapeUniforms: boolean): string {\n const coordsFromIndexSnippet = enableShapeUniforms ?\n shader_util.getLogicalCoordinatesFromFlatIndexByUniform(\n ['r', 'c', 'd'], 'inputShape') :\n shader_util.getLogicalCoordinatesFromFlatIndex(['r', 'c', 'd'], shape);\n\n return `\n ivec3 inputCoordsFromReshapedOutCoords(int index) {\n ${coordsFromIndexSnippet}\n return ivec3(r, c, d);\n }\n `;\n}\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env} from '@tensorflow/tfjs-core';\n\nimport {GPGPUContext} from './gpgpu_context';\nimport {getInternalFormatForFloat16MatrixTexture, getInternalFormatForFloat16PackedMatrixTexture, getInternalFormatForFloat32MatrixTexture, getInternalFormatForPackedMatrixTexture, getInternalFormatForUnsignedBytesMatrixTexture} from './gpgpu_util';\nimport {getPackedMatrixTextureShapeWidthHeight, getUnpackedMatrixTextureShapeWidthHeight, PhysicalTextureType, Texture, TextureConfig, TextureUsage} from './tex_util';\n\nexport class TextureManager {\n private numUsedTextures = 0;\n private numFreeTextures = 0;\n private _numBytesAllocated = 0;\n private _numBytesFree = 0; // How many bytes that have been allocated\n // are available for reuse.\n private freeTextures: {[shape: string]: Texture[]} = {};\n private logEnabled = false;\n private usedTextures: {[shape: string]: Texture[]} = {};\n\n constructor(private gpgpu: GPGPUContext) {}\n\n acquireTexture(\n shapeRC: [number, number], usage: TextureUsage,\n isPacked: boolean): Texture {\n const physicalTexType = getPhysicalFromLogicalTextureType(usage, isPacked);\n\n const shapeKey = getKeyFromTextureShape(shapeRC, physicalTexType, isPacked);\n if (!(shapeKey in this.freeTextures)) {\n this.freeTextures[shapeKey] = [];\n }\n if (!(shapeKey in this.usedTextures)) {\n this.usedTextures[shapeKey] = [];\n }\n\n const texBytes = computeBytes(\n shapeRC, physicalTexType, this.gpgpu.gl, this.gpgpu.textureConfig,\n isPacked);\n\n if (this.freeTextures[shapeKey].length > 0) {\n this.numFreeTextures--;\n this.numUsedTextures++;\n this._numBytesFree -= texBytes;\n this.log();\n const newTexture = this.freeTextures[shapeKey].shift();\n this.usedTextures[shapeKey].push(newTexture);\n return newTexture;\n }\n\n let newTexture: Texture;\n if (physicalTexType === PhysicalTextureType.PACKED_2X2_FLOAT32) {\n newTexture = this.gpgpu.createPackedMatrixTexture(shapeRC[0], shapeRC[1]);\n } else if (physicalTexType === PhysicalTextureType.PACKED_2X2_FLOAT16) {\n newTexture =\n this.gpgpu.createFloat16PackedMatrixTexture(shapeRC[0], shapeRC[1]);\n } else if (physicalTexType === PhysicalTextureType.UNPACKED_FLOAT32) {\n newTexture =\n this.gpgpu.createFloat32MatrixTexture(shapeRC[0], shapeRC[1]);\n } else if (physicalTexType === PhysicalTextureType.UNPACKED_FLOAT16) {\n newTexture =\n this.gpgpu.createFloat16MatrixTexture(shapeRC[0], shapeRC[1]);\n } else if (\n physicalTexType === PhysicalTextureType.PACKED_4X1_UNSIGNED_BYTE) {\n newTexture =\n this.gpgpu.createUnsignedBytesMatrixTexture(shapeRC[0], shapeRC[1]);\n }\n this.usedTextures[shapeKey].push(newTexture);\n\n this.numUsedTextures++;\n this._numBytesAllocated += texBytes;\n this.log();\n\n return newTexture;\n }\n\n releaseTexture(\n texture: Texture, shape: [number, number], logicalTexType: TextureUsage,\n isPacked: boolean): void {\n if (this.freeTextures == null) {\n // Already disposed.\n return;\n }\n const physicalTexType =\n getPhysicalFromLogicalTextureType(logicalTexType, isPacked);\n const shapeKey = getKeyFromTextureShape(shape, physicalTexType, isPacked);\n if (!(shapeKey in this.freeTextures)) {\n this.freeTextures[shapeKey] = [];\n }\n\n const texBytes = computeBytes(\n shape, physicalTexType, this.gpgpu.gl, this.gpgpu.textureConfig,\n isPacked);\n const deleteTexThreshold = env().get('WEBGL_DELETE_TEXTURE_THRESHOLD');\n if (deleteTexThreshold !== -1 &&\n this._numBytesAllocated > deleteTexThreshold) {\n this.gpgpu.deleteMatrixTexture(texture.texture);\n this._numBytesAllocated -= texBytes;\n } else {\n this.freeTextures[shapeKey].push(texture);\n this.numFreeTextures++;\n this._numBytesFree += texBytes;\n }\n\n this.numUsedTextures--;\n\n const texList = this.usedTextures[shapeKey];\n const texIndex = texList.indexOf(texture);\n if (texIndex < 0) {\n throw new Error(\n 'Cannot release a texture that was never provided by this ' +\n 'texture manager');\n }\n texList.splice(texIndex, 1);\n this.log();\n }\n\n private log() {\n if (!this.logEnabled) {\n return;\n }\n const total = this.numFreeTextures + this.numUsedTextures;\n console.log(\n 'Free/Used', `${this.numFreeTextures} / ${this.numUsedTextures}`,\n `(${total})`);\n const freeRatio = this._numBytesFree / this._numBytesAllocated;\n console.log(`Bytes allocated: ${this._numBytesAllocated}`);\n console.log(`Bytes unused: ${this._numBytesFree} (${\n Math.round(100 * freeRatio)}%)`);\n }\n\n get numBytesAllocated(): number {\n return this._numBytesAllocated;\n }\n\n get numBytesFree(): number {\n return this._numBytesFree;\n }\n\n getNumUsedTextures(): number {\n return this.numUsedTextures;\n }\n\n getNumFreeTextures(): number {\n return this.numFreeTextures;\n }\n\n dispose() {\n if (this.freeTextures == null) {\n // Already disposed.\n return;\n }\n for (const texShape in this.freeTextures) {\n this.freeTextures[texShape].forEach(tex => {\n this.gpgpu.deleteMatrixTexture(tex.texture);\n });\n }\n for (const texShape in this.usedTextures) {\n this.usedTextures[texShape].forEach(tex => {\n this.gpgpu.deleteMatrixTexture(tex.texture);\n });\n }\n this.freeTextures = null;\n this.usedTextures = null;\n this.numUsedTextures = 0;\n this.numFreeTextures = 0;\n this._numBytesAllocated = 0;\n this._numBytesFree = 0;\n }\n}\n\nfunction numBytesForInternalFormat(\n gl: WebGLRenderingContext, internalFormat: number): number {\n // tslint:disable-next-line:no-any\n const glany = gl as any;\n if (internalFormat === glany.R32F) {\n return 4;\n } else if (internalFormat === glany.R16F) {\n return 2;\n } else if (internalFormat === glany.RGBA32F) {\n return 16;\n } else if (internalFormat === gl.RGBA) {\n return 16;\n } else if (internalFormat === glany.RGBA16F) {\n return 8;\n } else if (internalFormat === glany.RGBA8) {\n return 4;\n }\n throw new Error(`Unknown internal format ${internalFormat}`);\n}\n\nexport function computeBytes(\n shape: [number, number], physicalTexType: PhysicalTextureType,\n gl: WebGLRenderingContext, textureConfig: TextureConfig,\n isPacked: boolean): number {\n // It is not possible to infer packed status from the texture type because\n // depending on the textureConfig, different texture types may resolve to the\n // same internal format (e.g. in WebGL1, the internal format for\n // UNPACKED_FLOAT16 textures is gl.RGBA). Therefore we pass in `isPacked`\n // explicitly.\n const internalFormat =\n internalFormatForPhysicalTexType(physicalTexType, textureConfig);\n\n let numElements: number;\n if (isPacked) {\n const [packedWidth, packedHeight] =\n getPackedMatrixTextureShapeWidthHeight(shape[0], shape[1]);\n numElements = packedWidth * packedHeight;\n\n } else {\n const [width, height] =\n getUnpackedMatrixTextureShapeWidthHeight(shape[0], shape[1]);\n numElements = width * height;\n }\n\n const bytesPerElement = numBytesForInternalFormat(gl, internalFormat);\n return numElements * bytesPerElement;\n}\n\nfunction internalFormatForPhysicalTexType(\n physicalTexType: PhysicalTextureType,\n textureConfig: TextureConfig): number {\n switch (physicalTexType) {\n case PhysicalTextureType.PACKED_2X2_FLOAT32:\n return getInternalFormatForPackedMatrixTexture(textureConfig);\n case PhysicalTextureType.PACKED_2X2_FLOAT16:\n return getInternalFormatForFloat16PackedMatrixTexture(textureConfig);\n case PhysicalTextureType.UNPACKED_FLOAT32:\n return getInternalFormatForFloat32MatrixTexture(textureConfig);\n case PhysicalTextureType.UNPACKED_FLOAT16:\n return getInternalFormatForFloat16MatrixTexture(textureConfig);\n case PhysicalTextureType.PACKED_4X1_UNSIGNED_BYTE:\n return getInternalFormatForUnsignedBytesMatrixTexture(textureConfig);\n default:\n throw new Error(`Unknown physical texture type ${physicalTexType}`);\n }\n}\n\nfunction getPhysicalTextureForRendering(isPacked: boolean):\n PhysicalTextureType {\n if (env().getBool('WEBGL_RENDER_FLOAT32_ENABLED')) {\n if (isPacked) {\n return PhysicalTextureType.PACKED_2X2_FLOAT32;\n }\n return PhysicalTextureType.UNPACKED_FLOAT32;\n }\n\n if (isPacked) {\n return PhysicalTextureType.PACKED_2X2_FLOAT16;\n }\n return PhysicalTextureType.UNPACKED_FLOAT16;\n}\n\nfunction getPhysicalFromLogicalTextureType(\n logicalTexType: TextureUsage, isPacked: boolean): PhysicalTextureType {\n if (logicalTexType === TextureUsage.UPLOAD) {\n return PhysicalTextureType.PACKED_2X2_FLOAT32;\n } else if (logicalTexType === TextureUsage.RENDER || logicalTexType == null) {\n return getPhysicalTextureForRendering(isPacked);\n } else if (\n logicalTexType === TextureUsage.DOWNLOAD ||\n logicalTexType === TextureUsage.PIXELS) {\n return PhysicalTextureType.PACKED_4X1_UNSIGNED_BYTE;\n }\n throw new Error(`Unknown logical texture type ${logicalTexType}`);\n}\n\nfunction getKeyFromTextureShape(\n shapeRowsCol: [number, number], physicalTexType: PhysicalTextureType,\n isPacked: boolean): string {\n return `${shapeRowsCol[0]}_${shapeRowsCol[1]}_${physicalTexType}_${isPacked}`;\n}\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram, useShapeUniforms} from './gpgpu_math';\n\nexport class UnaryOpProgram implements GPGPUProgram {\n variableNames = ['A'];\n userCode: string;\n outputShape: number[];\n enableShapeUniforms: boolean;\n\n constructor(aShape: number[], opSnippet: string) {\n this.outputShape = aShape;\n this.enableShapeUniforms = useShapeUniforms(this.outputShape.length);\n this.userCode = `\n float unaryOperation(float x) {\n ${opSnippet}\n }\n\n void main() {\n float x = getAAtOutCoords();\n float y = unaryOperation(x);\n\n setOutput(y);\n }\n `;\n }\n}\n\nexport const CHECK_NAN_SNIPPET = `if (isnan(x)) return x;`;\n\nexport const LINEAR = `return x;`;\n\nexport const ABS = `return abs(x);`;\n\nexport function STEP(alpha = 0.0) {\n return CHECK_NAN_SNIPPET + `\n return x > 0.0 ? 1.0 : float(${alpha});\n `;\n}\n\nexport const ELU = `return (x >= 0.0) ? x : (exp(x) - 1.0);`;\nexport const RELU = CHECK_NAN_SNIPPET + `\n return (x < 0.0) ? 0.0 : x;\n`;\n\nexport const RELU6 = CHECK_NAN_SNIPPET + `\n return (x < 0.0) ? 0.0 : min(6.0, x);\n`;\n\nexport const CLONE = 'return x;';\n\nexport const SIGMOID = `return 1.0 / (1.0 + exp(-1.0 * x));`;\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram, useShapeUniforms} from './gpgpu_math';\n\nexport const LINEAR = `return x;`;\n\nexport const ELU = `\n vec4 result;\n\n result.r = (x.r >= 0.0) ? x.r : (exp(x.r) - 1.0);\n result.g = (x.g >= 0.0) ? x.g : (exp(x.g) - 1.0);\n result.b = (x.b >= 0.0) ? x.b : (exp(x.b) - 1.0);\n result.a = (x.a >= 0.0) ? x.a : (exp(x.a) - 1.0);\n\n return result;\n`;\n\nexport const RELU = `\n vec4 result = x * vec4(greaterThanEqual(x, vec4(0.0)));\n bvec4 isNaN = isnan(x);\n\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n`;\n\nexport const RELU6 = `\n vec4 result = min(x, vec4(6.)) * vec4(greaterThanEqual(x, vec4(0.0)));\n bvec4 isNaN = isnan(x);\n\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n`;\n\nexport const SIGMOID = `return 1.0 / (1.0 + exp(-1.0 * x));`;\n\nexport class UnaryOpPackedProgram implements GPGPUProgram {\n variableNames = ['A'];\n userCode: string;\n enableShapeUniforms: boolean;\n outputShape: number[];\n packedInputs = true;\n packedOutput = true;\n\n constructor(aShape: number[], opSnippet: string) {\n this.outputShape = aShape;\n this.enableShapeUniforms = useShapeUniforms(this.outputShape.length);\n this.userCode = `\n vec4 unaryOperation(vec4 x) {\n ${opSnippet}\n }\n\n void main() {\n vec4 x = getAAtOutCoords();\n vec4 y = unaryOperation(x);\n\n setOutput(y);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram, useShapeUniforms} from './gpgpu_math';\nimport {getChannels, getSourceCoords} from './packing_util';\nimport {getCoordsDataType} from './shader_compiler';\n\nexport class UnpackProgram implements GPGPUProgram {\n variableNames = ['A'];\n packedInputs = true;\n packedOutput = false;\n outputShape: number[];\n userCode: string;\n enableShapeUniforms: boolean;\n\n constructor(outputShape: number[]) {\n this.outputShape = outputShape;\n this.enableShapeUniforms = useShapeUniforms(this.outputShape.length);\n const rank = outputShape.length;\n\n const channels = getChannels('rc', rank);\n const dtype = getCoordsDataType(rank);\n const sourceCoords = getSourceCoords(rank, channels);\n const innerDims = channels.slice(-2);\n const coords = rank <= 1 ? 'rc' : `vec2(${innerDims.join(',')})`;\n\n this.userCode = `\n void main() {\n ${dtype} rc = getOutputCoords();\n vec4 packedInput = getA(${sourceCoords});\n\n setOutput(getChannel(packedInput, ${coords}));\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// Import webgl flags.\nimport './flags_webgl';\n\nimport * as tf from '@tensorflow/tfjs-core';\nimport {backend_util, BackendValues, buffer, DataId, DataStorage, DataToGPUWebGLOption, DataType, engine, env, GPUData, kernel_impls, KernelBackend, MemoryInfo, nextFrame, NumericDataType, Rank, RecursiveArray, scalar, ShapeMap, Tensor, Tensor2D, TensorBuffer, TensorInfo, tidy, TimingInfo, TypedArray, util, WebGLData} from '@tensorflow/tfjs-core';\nimport {getWebGLContext} from './canvas_util';\nimport {DecodeMatrixProgram} from './decode_matrix_gpu';\nimport {DecodeMatrixPackedProgram} from './decode_matrix_packed_gpu';\nimport {EncodeFloatProgram} from './encode_float_gpu';\nimport {EncodeFloatPackedProgram} from './encode_float_packed_gpu';\nimport {EncodeMatrixProgram} from './encode_matrix_gpu';\nimport {EncodeMatrixPackedProgram} from './encode_matrix_packed_gpu';\nimport {GPGPUContext} from './gpgpu_context';\nimport * as gpgpu_math from './gpgpu_math';\nimport {getUniformLocations, GPGPUBinary, GPGPUProgram, TensorData} from './gpgpu_math';\nimport {simpleAbsImplCPU} from './kernel_utils/shared';\nimport {PackProgram} from './pack_gpu';\nimport {ReshapePackedProgram} from './reshape_packed_gpu';\nimport * as tex_util from './tex_util';\nimport {Texture, TextureData, TextureUsage} from './tex_util';\nimport {TextureManager} from './texture_manager';\nimport * as unary_op from './unaryop_gpu';\nimport {UnaryOpProgram} from './unaryop_gpu';\nimport {UnaryOpPackedProgram} from './unaryop_packed_gpu';\nimport {UnpackProgram} from './unpack_gpu';\nimport * as webgl_util from './webgl_util';\n\nconst whereImpl = kernel_impls.whereImpl;\n\nexport const EPSILON_FLOAT32 = 1e-7;\nexport const EPSILON_FLOAT16 = 1e-4;\n\ntype KernelInfo = {\n name: string; query: Promise;\n};\n\nexport type TimerNode = RecursiveArray|KernelInfo;\nexport interface CPUTimerQuery {\n startMs: number;\n endMs?: number;\n}\n\nexport interface WebGLMemoryInfo extends MemoryInfo {\n numBytesInGPU: number;\n // Tracks the total number of bytes allocated on the GPU, accounting for the\n // physical texture type.\n numBytesInGPUAllocated: number;\n // Tracks byte size of textures that were created and then made available for\n // reuse (disposed).\n numBytesInGPUFree: number;\n unreliable: boolean;\n}\n\nexport interface WebGLTimingInfo extends TimingInfo {\n uploadWaitMs: number;\n downloadWaitMs: number;\n}\n\nconst binaryCaches: {[webGLVersion: string]: {[key: string]: GPGPUBinary}} = {};\n\nexport function getBinaryCache(webGLVersion: number) {\n if (webGLVersion in binaryCaches) {\n return binaryCaches[webGLVersion];\n }\n binaryCaches[webGLVersion] = {};\n return binaryCaches[webGLVersion];\n}\n\n// Empirically determined constant used to determine size threshold for handing\n// off execution to the CPU.\nconst CPU_HANDOFF_SIZE_THRESHOLD =\n env().getNumber('CPU_HANDOFF_SIZE_THRESHOLD');\n\n// Empirically determined constant used to decide the number of MB on GPU\n// before we warn about high memory use. The MB are this constant * screen area\n// * dpi / 1024 / 1024.\nconst BEFORE_PAGING_CONSTANT = 600;\nfunction numMBBeforeWarning(): number {\n if (env().global.screen == null) {\n return 1024; // 1 GB.\n }\n return (env().global.screen.height * env().global.screen.width *\n window.devicePixelRatio) *\n BEFORE_PAGING_CONSTANT / 1024 / 1024;\n}\n\nexport class MathBackendWebGL extends KernelBackend {\n texData: DataStorage;\n gpgpu: GPGPUContext;\n\n private static nextDataId = 0;\n private nextDataId(): number {\n return MathBackendWebGL.nextDataId++;\n }\n // Maps data ids that have a pending read operation, to list of subscribers.\n private pendingRead = new WeakMap void>>();\n // List of data ids that are scheduled for disposal, but are waiting on a\n // pending read operation.\n private pendingDisposal = new WeakSet();\n\n // Used to count the number of 'shallow' sliced tensors that point to the\n // same data id.\n dataRefCount = new WeakMap();\n private numBytesInGPU = 0;\n\n private canvas: HTMLCanvasElement|OffscreenCanvas;\n\n private programTimersStack: TimerNode[];\n private activeTimers: TimerNode[];\n // Accumulated time spent (including blocking) in uploading data to webgl.\n private uploadWaitMs = 0;\n // Accumulated time spent (including blocking in downloading data from webgl.\n private downloadWaitMs = 0;\n\n // record the last manual GL Flush time.\n private lastGlFlushTime = 0;\n\n // Number of bits of precision of this backend.\n private floatPrecisionValue: 32|16;\n\n private textureManager: TextureManager;\n private binaryCache: {[key: string]: GPGPUBinary};\n private gpgpuCreatedLocally: boolean;\n private numMBBeforeWarning: number;\n private warnedAboutMemory = false;\n\n constructor(gpuResource?: GPGPUContext|HTMLCanvasElement|OffscreenCanvas) {\n super();\n if (!env().getBool('HAS_WEBGL')) {\n throw new Error('WebGL is not supported on this device');\n }\n\n let newGPGPU;\n if (gpuResource != null) {\n if (gpuResource instanceof GPGPUContext) {\n newGPGPU = gpuResource;\n } else {\n const gl =\n getWebGLContext(env().getNumber('WEBGL_VERSION'), gpuResource);\n newGPGPU = new GPGPUContext(gl);\n }\n this.binaryCache = {};\n this.gpgpuCreatedLocally = false;\n } else {\n const gl = getWebGLContext(env().getNumber('WEBGL_VERSION'));\n newGPGPU = new GPGPUContext(gl);\n this.binaryCache = getBinaryCache(env().getNumber('WEBGL_VERSION'));\n this.gpgpuCreatedLocally = true;\n }\n\n this.gpgpu = newGPGPU;\n this.canvas = this.gpgpu.gl.canvas;\n this.textureManager = new TextureManager(this.gpgpu);\n this.numMBBeforeWarning = numMBBeforeWarning();\n this.texData = new DataStorage(this, engine());\n }\n\n numDataIds() {\n return this.texData.numDataIds() - this.pendingDeletes;\n }\n\n // Writes a new entry to the data store with a WebGL texture, and registers it\n // to the texture manager.\n writeTexture(\n texture: WebGLTexture, shape: number[], dtype: DataType,\n texHeight: number, texWidth: number, channels: string): DataId {\n // Temporarily create an tensor info to make the texture compatible with\n // the runWebGLProgram's input.\n const input = this.makeTensorInfo(shape, dtype);\n const inData = this.texData.get(input.dataId);\n // Even though the input texture could be unpacked or dense packed, it is\n // always considered as unpacked for EncodeMatrixProgram.\n inData.isPacked = false;\n\n // Bind texture to the input tensor.\n inData.texture = {texture, texShape: [texHeight, texWidth]};\n inData.texShape = [texHeight, texWidth];\n\n const shapeAs3D = webgl_util.getShapeAs3D(shape);\n const program =\n new EncodeMatrixProgram(shapeAs3D, false /* isByteArray */, channels);\n const output =\n this.runWebGLProgram(program, [input], dtype, [[texHeight, texWidth]]);\n output.shape = shape;\n\n // Unbind the texture from the input tensor to avoid the texture being\n // released.\n inData.texture = null;\n this.disposeIntermediateTensorInfo(input);\n\n return output.dataId;\n }\n\n write(values: BackendValues, shape: number[], dtype: DataType): DataId {\n if (env().getBool('WEBGL_CHECK_NUMERICAL_PROBLEMS') ||\n env().getBool('DEBUG')) {\n this.checkNumericalProblems(values);\n }\n if (dtype === 'complex64' && values != null) {\n throw new Error(\n `Cannot write to a complex64 dtype. ` +\n `Please use tf.complex(real, imag).`);\n }\n const dataId = {id: this.nextDataId()};\n this.texData.set(\n dataId,\n {shape, dtype, values, usage: TextureUsage.UPLOAD, refCount: 1});\n return dataId;\n }\n\n /** Return refCount of a `TensorData`. */\n refCount(dataId: DataId): number {\n if (this.texData.has(dataId)) {\n const tensorData = this.texData.get(dataId);\n return tensorData.refCount;\n }\n return 0;\n }\n\n /** Increase refCount of a `TextureData`. */\n incRef(dataId: DataId): void {\n const texData = this.texData.get(dataId);\n texData.refCount++;\n }\n\n /** Decrease refCount of a `TextureData`. */\n decRef(dataId: DataId): void {\n if (this.texData.has(dataId)) {\n const texData = this.texData.get(dataId);\n texData.refCount--;\n }\n }\n\n move(\n dataId: DataId, values: BackendValues, shape: number[], dtype: DataType,\n refCount: number): void {\n if (env().getBool('DEBUG')) {\n this.checkNumericalProblems(values);\n }\n if (dtype === 'complex64') {\n throw new Error(\n `Cannot write to a complex64 dtype. ` +\n `Please use tf.complex(real, imag).`);\n }\n this.texData.set(\n dataId, {shape, dtype, values, usage: TextureUsage.UPLOAD, refCount});\n }\n\n disposeIntermediateTensorInfo(tensorInfo: TensorInfo): void {\n this.disposeData(tensorInfo.dataId);\n }\n\n readSync(dataId: DataId): BackendValues {\n const texData = this.texData.get(dataId);\n const {values, dtype, complexTensorInfos, slice, shape, isPacked} = texData;\n\n // The presence of `slice` indicates this tensor is a shallow slice of a\n // different tensor, and is using that original tensor's texture. Run\n // `clone` in order to copy that texture and read from it.\n if (slice != null) {\n let program;\n if (isPacked) {\n program = new UnaryOpPackedProgram(shape, unary_op.CLONE);\n } else {\n program = new UnaryOpProgram(shape, unary_op.CLONE);\n }\n const res =\n this.runWebGLProgram(program, [{dataId, shape, dtype}], dtype);\n const data = this.readSync(res.dataId);\n this.disposeIntermediateTensorInfo(res);\n return data;\n }\n if (values != null) {\n return this.convertAndCacheOnCPU(dataId);\n }\n if (dtype === 'string') {\n return values;\n }\n const shouldTimeProgram = this.activeTimers != null;\n let start: number;\n if (shouldTimeProgram) {\n start = util.now();\n }\n\n let result: Float32Array;\n if (dtype === 'complex64') {\n const realValues =\n this.readSync(complexTensorInfos.real.dataId) as Float32Array;\n const imagValues =\n this.readSync(complexTensorInfos.imag.dataId) as Float32Array;\n result = backend_util.mergeRealAndImagArrays(realValues, imagValues);\n } else {\n result = this.getValuesFromTexture(dataId);\n }\n\n if (shouldTimeProgram) {\n this.downloadWaitMs += util.now() - start;\n }\n return this.convertAndCacheOnCPU(dataId, result);\n }\n\n async read(dataId: DataId): Promise {\n if (this.pendingRead.has(dataId)) {\n const subscribers = this.pendingRead.get(dataId);\n return new Promise(resolve => subscribers.push(resolve));\n }\n const texData = this.texData.get(dataId);\n const {values, shape, slice, dtype, complexTensorInfos, isPacked} = texData;\n\n // The presence of `slice` indicates this tensor is a shallow slice of a\n // different tensor, and is using that original tensor's texture. Run\n // `clone` in order to copy that texture and read from it.\n if (slice != null) {\n let program;\n if (isPacked) {\n program = new UnaryOpPackedProgram(shape, unary_op.CLONE);\n } else {\n program = new UnaryOpProgram(shape, unary_op.CLONE);\n }\n const res =\n this.runWebGLProgram(program, [{dataId, shape, dtype}], dtype);\n const data = this.read(res.dataId);\n this.disposeIntermediateTensorInfo(res);\n return data;\n }\n\n if (values != null) {\n return this.convertAndCacheOnCPU(dataId);\n }\n\n if (env().getBool('DEBUG')) {\n // getBool('WEBGL_DOWNLOAD_FLOAT_ENABLED') caused a blocking GPU call.\n // For performance reason, only check it for debugging. In production,\n // it doesn't handle this use case anyway, so behavior is not changed.\n if (!env().getBool('WEBGL_DOWNLOAD_FLOAT_ENABLED') &&\n env().getNumber('WEBGL_VERSION') === 2) {\n throw new Error(\n `tensor.data() with WEBGL_DOWNLOAD_FLOAT_ENABLED=false and ` +\n `WEBGL_VERSION=2 not yet supported.`);\n }\n }\n\n let buffer: WebGLBuffer = null;\n let tmpDownloadTarget: TensorInfo;\n\n if (dtype !== 'complex64' && env().get('WEBGL_BUFFER_SUPPORTED')) {\n // Possibly copy the texture into a buffer before inserting a fence.\n tmpDownloadTarget = this.decode(dataId);\n const tmpData = this.texData.get(tmpDownloadTarget.dataId);\n\n buffer = this.gpgpu.createBufferFromTexture(\n tmpData.texture.texture, ...tex_util.getDenseTexShape(shape));\n }\n\n this.pendingRead.set(dataId, []);\n\n if (dtype !== 'complex64') {\n // Create a fence and wait for it to resolve.\n await this.gpgpu.createAndWaitForFence();\n }\n\n // Download the values from the GPU.\n let vals: Float32Array;\n if (dtype === 'complex64') {\n const ps = await Promise.all([\n this.read(complexTensorInfos.real.dataId),\n this.read(complexTensorInfos.imag.dataId)\n ]);\n\n const realValues = ps[0];\n const imagValues = ps[1];\n vals = backend_util.mergeRealAndImagArrays(\n realValues as Float32Array, imagValues as Float32Array);\n } else if (buffer == null) {\n vals = this.getValuesFromTexture(dataId);\n } else {\n const size = util.sizeFromShape(shape);\n vals = this.gpgpu.downloadFloat32MatrixFromBuffer(buffer, size);\n }\n if (tmpDownloadTarget != null) {\n this.disposeIntermediateTensorInfo(tmpDownloadTarget);\n }\n if (buffer != null) {\n const gl = this.gpgpu.gl;\n webgl_util.callAndCheck(gl, () => gl.deleteBuffer(buffer));\n }\n const dTypeVals = this.convertAndCacheOnCPU(dataId, vals);\n\n const subscribers = this.pendingRead.get(dataId);\n this.pendingRead.delete(dataId);\n\n // Notify all pending reads.\n subscribers.forEach(resolve => resolve(dTypeVals));\n if (this.pendingDisposal.has(dataId)) {\n this.pendingDisposal.delete(dataId);\n if (this.disposeData(dataId)) {\n engine().removeDataId(dataId, this);\n }\n this.pendingDeletes--;\n }\n return dTypeVals;\n }\n\n /**\n * Read tensor to a new texture that is densely packed for ease of use.\n * @param dataId The source tensor.\n * @param options\n * customTexShape: Optional. If set, will use the user defined texture\n * shape to create the texture.\n */\n readToGPU(dataId: DataId, options: DataToGPUWebGLOption = {}): GPUData {\n const texData = this.texData.get(dataId);\n const {values, shape, slice, dtype, isPacked, texture} = texData;\n\n if (dtype === 'complex64') {\n throw new Error('Does not support reading texture for complex64 dtype.');\n }\n\n // The presence of `slice` indicates this tensor is a shallow slice of a\n // different tensor, and is using that original tensor's texture. Run\n // `clone` in order to copy that texture and read from it.\n if (slice != null) {\n let program;\n if (isPacked) {\n program = new UnaryOpPackedProgram(shape, unary_op.CLONE);\n } else {\n program = new UnaryOpProgram(shape, unary_op.CLONE);\n }\n const res =\n this.runWebGLProgram(program, [{dataId, shape, dtype}], dtype);\n const gpuResouorce = this.readToGPU(res, options);\n this.disposeIntermediateTensorInfo(res);\n return gpuResouorce;\n }\n\n if (texture == null) {\n if (values != null) {\n throw new Error('Data is not on GPU but on CPU.');\n } else {\n throw new Error('There is no data on GPU or CPU.');\n }\n }\n\n // Decode the texture so that it is stored densely (using four channels).\n const tmpTarget = this.decode(dataId, options.customTexShape);\n\n // Make engine track this tensor, so that we can dispose it later.\n const tensorRef = engine().makeTensorFromTensorInfo(tmpTarget);\n\n const tmpData = this.texData.get(tmpTarget.dataId);\n return {tensorRef, ...tmpData.texture};\n }\n\n bufferSync(t: TensorInfo):\n TensorBuffer {\n const data = this.readSync(t.dataId);\n if (t.dtype === 'string') {\n try {\n // Decode the bytes into string.\n const strings = (data as Uint8Array[]).map(d => util.decodeString(d));\n return buffer(t.shape as ShapeMap[R], t.dtype, strings) as\n TensorBuffer;\n } catch {\n throw new Error('Failed to decode encoded string bytes into utf-8');\n }\n }\n return buffer(t.shape as ShapeMap[R], t.dtype, data as TypedArray) as\n TensorBuffer;\n }\n\n private checkNumericalProblems(values: BackendValues): void {\n if (values == null) {\n return;\n }\n for (let i = 0; i < values.length; i++) {\n const num = values[i] as number;\n if (!webgl_util.canBeRepresented(num)) {\n if (env().getBool('WEBGL_RENDER_FLOAT32_CAPABLE')) {\n throw Error(\n `The value ${num} cannot be represented with your ` +\n `current settings. Consider enabling float32 rendering: ` +\n `'tf.env().set('WEBGL_RENDER_FLOAT32_ENABLED', true);'`);\n }\n throw Error(`The value ${num} cannot be represented on this device.`);\n }\n }\n }\n\n private getValuesFromTexture(dataId: DataId): Float32Array {\n const {shape, dtype, isPacked} = this.texData.get(dataId);\n const size = util.sizeFromShape(shape);\n if (env().getBool('WEBGL_DOWNLOAD_FLOAT_ENABLED')) {\n const tmpTarget = this.decode(dataId);\n const tmpData = this.texData.get(tmpTarget.dataId);\n const vals =\n this.gpgpu\n .downloadMatrixFromPackedTexture(\n tmpData.texture.texture, ...tex_util.getDenseTexShape(shape))\n .subarray(0, size);\n\n this.disposeIntermediateTensorInfo(tmpTarget);\n\n return vals;\n }\n\n const shouldUsePackedProgram =\n env().getBool('WEBGL_PACK') && isPacked === true;\n const outputShape =\n shouldUsePackedProgram ? webgl_util.getShapeAs3D(shape) : shape;\n const program = shouldUsePackedProgram ?\n new EncodeFloatPackedProgram(outputShape as [number, number, number]) :\n new EncodeFloatProgram(outputShape);\n const output = this.runWebGLProgram(\n program, [{shape: outputShape, dtype, dataId}], 'float32');\n const tmpData = this.texData.get(output.dataId);\n const vals = this.gpgpu\n .downloadByteEncodedFloatMatrixFromOutputTexture(\n tmpData.texture.texture, tmpData.texShape[0],\n tmpData.texShape[1])\n .subarray(0, size);\n this.disposeIntermediateTensorInfo(output);\n\n return vals;\n }\n\n timerAvailable(): boolean {\n return env().getNumber('WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE') > 0;\n }\n\n time(f: () => void): Promise {\n const oldActiveTimers = this.activeTimers;\n const newActiveTimers: TimerNode[] = [];\n\n let outerMostTime = false;\n if (this.programTimersStack == null) {\n this.programTimersStack = newActiveTimers;\n outerMostTime = true;\n } else {\n this.activeTimers.push(newActiveTimers);\n }\n this.activeTimers = newActiveTimers;\n\n f();\n\n // needing to split these up because util.flatten only accepts certain types\n const flattenedActiveTimerQueries =\n util.flatten(this.activeTimers.map((d: KernelInfo) => d.query))\n .filter(d => d != null);\n const flattenedActiveTimerNames =\n util.flatten(this.activeTimers.map((d: KernelInfo) => d.name))\n .filter(d => d != null);\n\n this.activeTimers = oldActiveTimers;\n\n if (outerMostTime) {\n this.programTimersStack = null;\n }\n\n const res: WebGLTimingInfo = {\n uploadWaitMs: this.uploadWaitMs,\n downloadWaitMs: this.downloadWaitMs,\n kernelMs: null,\n wallMs: null // will be filled by the engine\n };\n\n return (async () => {\n if (env().getNumber('WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE') >\n 0) {\n const kernelMs = await Promise.all(flattenedActiveTimerQueries);\n\n res['kernelMs'] = util.sum(kernelMs);\n res['getExtraProfileInfo'] = () =>\n kernelMs\n .map((d, i) => ({name: flattenedActiveTimerNames[i], ms: d}))\n .map(d => `${d.name}: ${d.ms}`)\n .join(', ');\n } else {\n res['kernelMs'] = {\n error: 'WebGL query timers are not supported in this environment.'\n };\n }\n\n this.uploadWaitMs = 0;\n this.downloadWaitMs = 0;\n return res;\n })();\n }\n memory(): WebGLMemoryInfo {\n return {\n unreliable: false,\n numBytesInGPU: this.numBytesInGPU,\n numBytesInGPUAllocated: this.textureManager.numBytesAllocated,\n numBytesInGPUFree: this.textureManager.numBytesFree\n } as WebGLMemoryInfo;\n }\n\n private startTimer(): WebGLQuery|CPUTimerQuery {\n if (env().getNumber('WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE') > 0) {\n return this.gpgpu.beginQuery();\n }\n return {startMs: util.now(), endMs: null};\n }\n\n private endTimer(query: WebGLQuery|CPUTimerQuery): WebGLQuery|CPUTimerQuery {\n if (env().getNumber('WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE') > 0) {\n this.gpgpu.endQuery();\n return query;\n }\n (query as CPUTimerQuery).endMs = util.now();\n return query;\n }\n\n private async getQueryTime(query: WebGLQuery|CPUTimerQuery): Promise {\n if (env().getNumber('WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE') > 0) {\n return this.gpgpu.waitForQueryAndGetTime(query as WebGLQuery);\n }\n const timerQuery = query as CPUTimerQuery;\n return timerQuery.endMs - timerQuery.startMs;\n }\n\n private pendingDeletes = 0;\n\n /**\n * Decrease the RefCount on the dataId and dispose the memory if the dataId\n * has 0 refCount. If there are pending read on the data, the disposal would\n * added to the pending delete queue. Return true if the dataId is removed\n * from backend or the backend does not contain the dataId, false if the\n * dataId is not removed. Memory may or may not be released even when dataId\n * is removed, which also depends on dataRefCount, see `releaseGPU`.\n * @param dataId\n * @oaram force Optional, remove the data regardless of refCount\n */\n disposeData(dataId: DataId, force = false): boolean {\n if (this.pendingDisposal.has(dataId)) {\n return false;\n }\n\n // No-op if already disposed.\n if (!this.texData.has(dataId)) {\n return true;\n }\n\n // if force flag is set, change refCount to 0, this would ensure disposal\n // when added to the pendingDisposal queue. Memory may or may not be\n // released, which also depends on dataRefCount, see `releaseGPU`.\n if (force) {\n this.texData.get(dataId).refCount = 0;\n } else {\n this.texData.get(dataId).refCount--;\n }\n\n if (!force && this.texData.get(dataId).refCount > 0) {\n return false;\n }\n\n if (this.pendingRead.has(dataId)) {\n this.pendingDisposal.add(dataId);\n this.pendingDeletes++;\n return false;\n }\n\n this.releaseGPUData(dataId);\n const {complexTensorInfos} = this.texData.get(dataId);\n if (complexTensorInfos != null) {\n this.disposeData(complexTensorInfos.real.dataId, force);\n this.disposeData(complexTensorInfos.imag.dataId, force);\n }\n\n this.texData.delete(dataId);\n\n return true;\n }\n\n private releaseGPUData(dataId: DataId): void {\n const {texture, dtype, texShape, usage, isPacked, slice} =\n this.texData.get(dataId);\n const key = slice && slice.origDataId || dataId;\n const refCount = this.dataRefCount.get(key);\n\n if (refCount > 1) {\n this.dataRefCount.set(key, refCount - 1);\n } else {\n this.dataRefCount.delete(key);\n if (texture != null) {\n this.numBytesInGPU -= this.computeBytes(texShape, dtype);\n this.textureManager.releaseTexture(texture, texShape, usage, isPacked);\n }\n }\n\n const texData = this.texData.get(dataId);\n texData.texture = null;\n texData.texShape = null;\n texData.isPacked = false;\n texData.slice = null;\n }\n\n getTexture(dataId: DataId): WebGLTexture {\n this.uploadToGPU(dataId);\n return this.texData.get(dataId).texture.texture;\n }\n\n /**\n * Returns internal information for the specific data bucket. Used in unit\n * tests.\n */\n getDataInfo(dataId: DataId): TextureData {\n return this.texData.get(dataId);\n }\n\n /*\n Tests whether all the inputs to an op are small and on the CPU. This heuristic\n determines when it would be faster to execute a kernel on the CPU. WebGL\n kernels opt into running this check and forwarding when appropriate.\n TODO(https://github.com/tensorflow/tfjs/issues/872): Develop a more\n sustainable strategy for optimizing backend execution of ops.\n */\n shouldExecuteOnCPU(\n inputs: TensorInfo[],\n sizeThreshold = CPU_HANDOFF_SIZE_THRESHOLD): boolean {\n return env().getBool('WEBGL_CPU_FORWARD') &&\n inputs.every(\n input => this.texData.get(input.dataId).texture == null &&\n util.sizeFromShape(input.shape) < sizeThreshold);\n }\n\n getGPGPUContext(): GPGPUContext {\n return this.gpgpu;\n }\n\n where(condition: Tensor): Tensor2D {\n backend_util.warn(\n 'tf.where() in webgl locks the UI thread. ' +\n 'Call tf.whereAsync() instead');\n const condVals = condition.dataSync();\n return whereImpl(condition.shape, condVals);\n }\n\n private packedUnaryOp(x: TensorInfo, op: string, dtype: DataType) {\n const program = new UnaryOpPackedProgram(x.shape, op);\n const outInfo = this.compileAndRun(program, [x], dtype);\n return engine().makeTensorFromTensorInfo(outInfo);\n }\n\n // TODO(msoulanille) remove this once the backend has been modularized\n // a copy is needed here to break a circular dependency.\n // Also remove the op from unary_op.\n abs(x: T): T {\n // TODO: handle cases when x is complex.\n if (this.shouldExecuteOnCPU([x]) && x.dtype !== 'complex64') {\n const outValues =\n simpleAbsImplCPU(this.texData.get(x.dataId).values as TypedArray);\n return this.makeOutput(x.shape, x.dtype, outValues);\n }\n\n if (env().getBool('WEBGL_PACK_UNARY_OPERATIONS')) {\n return this.packedUnaryOp(x, unary_op.ABS, x.dtype) as T;\n }\n\n const program = new UnaryOpProgram(x.shape, unary_op.ABS);\n const outInfo = this.compileAndRun(program, [x]);\n return engine().makeTensorFromTensorInfo(outInfo) as T;\n }\n\n makeTensorInfo(\n shape: number[], dtype: DataType,\n values?: BackendValues|string[]): TensorInfo {\n let dataId;\n if (dtype === 'string' && values != null && values.length > 0 &&\n util.isString(values[0])) {\n const encodedValues =\n (values as {} as string[]).map(d => util.encodeString(d));\n\n dataId = this.write(encodedValues, shape, dtype);\n } else {\n dataId = this.write(values as TypedArray, shape, dtype);\n }\n\n this.texData.get(dataId).usage = null;\n return {dataId, shape, dtype};\n }\n\n private makeOutput(\n shape: number[], dtype: DataType, values?: BackendValues): T {\n return engine().makeTensorFromTensorInfo(\n this.makeTensorInfo(shape, dtype, values), this) as T;\n }\n\n unpackTensor(input: TensorInfo): TensorInfo {\n const program = new UnpackProgram(input.shape);\n return this.runWebGLProgram(program, [input], input.dtype);\n }\n\n packTensor(input: TensorInfo): TensorInfo {\n const program = new PackProgram(input.shape);\n const preventEagerUnpackingOutput = true;\n return this.runWebGLProgram(\n program, [input], input.dtype, null /* customUniformValues */,\n preventEagerUnpackingOutput);\n }\n\n private packedReshape(input: TensorInfo, afterShape: number[]): TensorInfo {\n const input3DShape = [\n webgl_util.getBatchDim(input.shape),\n ...webgl_util.getRowsCols(input.shape)\n ] as [number, number, number];\n const input3D: TensorInfo = {\n dtype: input.dtype,\n shape: input3DShape,\n dataId: input.dataId\n };\n const afterShapeAs3D = [\n webgl_util.getBatchDim(afterShape), ...webgl_util.getRowsCols(afterShape)\n ] as [number, number, number];\n\n const program = new ReshapePackedProgram(afterShapeAs3D, input3DShape);\n const preventEagerUnpackingOfOutput = true;\n const customValues = [input3DShape];\n const output = this.runWebGLProgram(\n program, [input3D], input.dtype, customValues,\n preventEagerUnpackingOfOutput);\n return {dataId: output.dataId, shape: afterShape, dtype: output.dtype};\n }\n\n private decode(dataId: DataId, customTexShape?: [number, number]):\n TensorInfo {\n const texData = this.texData.get(dataId);\n const {isPacked, shape, dtype} = texData;\n if (customTexShape != null) {\n const size = util.sizeFromShape(shape);\n const texSize = customTexShape[0] * customTexShape[1] * 4;\n util.assert(\n size <= texSize,\n () => 'customTexShape is too small. ' +\n 'Row * Column * 4 should be equal or larger than the ' +\n 'size of the tensor data.');\n }\n const shapeAs3D =\n webgl_util.getShapeAs3D(shape) as [number, number, number];\n let program;\n if (isPacked) {\n program = new DecodeMatrixPackedProgram(shapeAs3D);\n } else {\n program = new DecodeMatrixProgram(shapeAs3D);\n }\n const preventEagerUnpackingOfOutput = true;\n const customValues =\n [customTexShape != null ? customTexShape :\n tex_util.getDenseTexShape(shapeAs3D)];\n const out = this.runWebGLProgram(\n program, [{shape: shapeAs3D, dtype, dataId}], dtype, customValues,\n preventEagerUnpackingOfOutput, customTexShape);\n return {dtype, shape, dataId: out.dataId};\n }\n\n runWebGLProgram(\n program: GPGPUProgram, inputs: TensorInfo[], outputDtype: DataType,\n customUniformValues?: number[][], preventEagerUnpackingOfOutput = false,\n customTexShape?: [number, number]): TensorInfo {\n const output = this.makeTensorInfo(program.outputShape, outputDtype);\n const outData = this.texData.get(output.dataId);\n if (program.packedOutput) {\n outData.isPacked = true;\n }\n if (program.outPackingScheme === tex_util.PackingScheme.DENSE) {\n const texelShape = customTexShape != null ?\n customTexShape :\n tex_util.getDenseTexShape(program.outputShape);\n // For a densely packed output, we explicitly set texShape\n // so it doesn't get assigned later according to our typical packing\n // scheme wherein a single texel can only contain values from adjacent\n // rows/cols.\n outData.texShape = texelShape.map(d => d * 2) as [number, number];\n }\n if (program.outTexUsage != null) {\n outData.usage = program.outTexUsage;\n }\n\n if (util.sizeFromShape(output.shape) === 0) {\n // Short-circuit the computation since the result is empty (has 0 in its\n // shape).\n outData.values =\n util.getTypedArrayFromDType(output.dtype as 'float32', 0);\n return output;\n }\n\n const dataToDispose: TensorInfo[] = [];\n const inputsData: TensorData[] = inputs.map(input => {\n if (input.dtype === 'complex64') {\n throw new Error(\n `GPGPUProgram does not support complex64 input. For complex64 ` +\n `dtypes, please separate the program into real and imaginary ` +\n `parts.`);\n }\n\n let texData = this.texData.get(input.dataId);\n\n if (texData.texture == null) {\n if (!program.packedInputs &&\n util.sizeFromShape(input.shape) <=\n env().getNumber('WEBGL_SIZE_UPLOAD_UNIFORM')) {\n // Upload small tensors that live on the CPU as uniforms, not as\n // textures. Do this only when the environment supports 32bit floats\n // due to problems when comparing 16bit floats with 32bit floats.\n // TODO(https://github.com/tensorflow/tfjs/issues/821): Make it\n // possible for packed shaders to sample from uniforms.\n return {\n shape: input.shape,\n texData: null,\n isUniform: true,\n uniformValues: texData.values as TypedArray\n };\n }\n\n // This ensures that if a packed program's inputs have not yet been\n // uploaded to the GPU, they get uploaded as packed right off the bat.\n if (program.packedInputs) {\n texData.isPacked = true;\n texData.shape = input.shape;\n }\n }\n\n this.uploadToGPU(input.dataId);\n if (!!texData.isPacked !== !!program.packedInputs) {\n input = texData.isPacked ? this.unpackTensor(input) :\n this.packTensor(input);\n dataToDispose.push(input);\n texData = this.texData.get(input.dataId);\n } else if (\n texData.isPacked &&\n !webgl_util.isReshapeFree(texData.shape, input.shape)) {\n // This is a special case where a texture exists for a tensor\n // but the shapes are incompatible (due to packing constraints) because\n // the tensor did not have a chance to go through the packed reshape\n // shader. This only happens when we reshape the *same* tensor to form\n // *distinct* inputs to an op, e.g. dotting a vector with itself. This\n // case will disappear once packed uploading is the default.\n\n const savedInput = input;\n const targetShape = input.shape;\n\n input.shape = texData.shape;\n input = this.packedReshape(input as Tensor, targetShape);\n dataToDispose.push(input);\n texData = this.texData.get(input.dataId);\n\n savedInput.shape = targetShape;\n }\n\n return {shape: input.shape, texData, isUniform: false};\n });\n\n this.uploadToGPU(output.dataId);\n const outputData:\n TensorData = {shape: output.shape, texData: outData, isUniform: false};\n const key = gpgpu_math.makeShaderKey(program, inputsData, outputData);\n const binary = this.getAndSaveBinary(key, () => {\n return gpgpu_math.compileProgram(\n this.gpgpu, program, inputsData, outputData);\n });\n const shouldTimeProgram = this.activeTimers != null;\n let query: WebGLQuery|CPUTimerQuery;\n if (shouldTimeProgram) {\n query = this.startTimer();\n }\n\n if (!env().get('ENGINE_COMPILE_ONLY')) {\n gpgpu_math.runProgram(\n this.gpgpu, binary, inputsData, outputData, customUniformValues);\n }\n\n dataToDispose.forEach(info => this.disposeIntermediateTensorInfo(info));\n\n if (shouldTimeProgram) {\n query = this.endTimer(query);\n this.activeTimers.push(\n {name: program.constructor.name, query: this.getQueryTime(query)});\n }\n\n const glFlushThreshold = env().get('WEBGL_FLUSH_THRESHOLD');\n // Manually GL flush requested\n if (glFlushThreshold > 0) {\n const time = util.now();\n if ((time - this.lastGlFlushTime) > glFlushThreshold) {\n this.gpgpu.gl.flush();\n this.lastGlFlushTime = time;\n }\n }\n\n if (!env().getBool('WEBGL_LAZILY_UNPACK') && outData.isPacked &&\n preventEagerUnpackingOfOutput === false) {\n const unpacked = this.unpackTensor(output);\n this.disposeIntermediateTensorInfo(output);\n return unpacked;\n }\n return output;\n }\n\n compileAndRun(\n program: GPGPUProgram, inputs: TensorInfo[], outputDtype?: DataType,\n customUniformValues?: number[][],\n preventEagerUnpackingOfOutput = false): TensorInfo {\n outputDtype = outputDtype || inputs[0].dtype;\n const outInfo = this.runWebGLProgram(\n program, inputs, outputDtype, customUniformValues,\n preventEagerUnpackingOfOutput);\n return outInfo;\n }\n\n private getAndSaveBinary(key: string, getBinary: () => GPGPUBinary):\n GPGPUBinary {\n if (!(key in this.binaryCache)) {\n this.binaryCache[key] = getBinary();\n }\n return this.binaryCache[key];\n }\n\n getTextureManager(): TextureManager {\n return this.textureManager;\n }\n\n private disposed = false;\n\n dispose() {\n if (this.disposed) {\n return;\n }\n // Avoid disposing the compiled webgl programs during unit testing because\n // it slows down test execution.\n if (!env().getBool('IS_TEST')) {\n const allKeys = Object.keys(this.binaryCache);\n allKeys.forEach(key => {\n this.gpgpu.deleteProgram(this.binaryCache[key].webGLProgram);\n delete this.binaryCache[key];\n });\n }\n this.textureManager.dispose();\n if (this.canvas != null &&\n (typeof (HTMLCanvasElement) !== 'undefined' &&\n this.canvas instanceof HTMLCanvasElement)) {\n this.canvas.remove();\n } else {\n this.canvas = null;\n }\n if (this.gpgpuCreatedLocally) {\n this.gpgpu.program = null;\n this.gpgpu.dispose();\n }\n this.disposed = true;\n }\n\n floatPrecision(): 16|32 {\n if (this.floatPrecisionValue == null) {\n this.floatPrecisionValue = tidy(() => {\n if (!env().get('WEBGL_RENDER_FLOAT32_ENABLED')) {\n // Momentarily switching DEBUG flag to false so we don't throw an\n // error trying to upload a small value.\n const debugFlag = env().getBool('DEBUG');\n env().set('DEBUG', false);\n const underflowCheckValue = this.abs(scalar(1e-8)).dataSync()[0];\n env().set('DEBUG', debugFlag);\n\n if (underflowCheckValue > 0) {\n return 32;\n }\n }\n return 16;\n });\n }\n return this.floatPrecisionValue;\n }\n\n /** Returns the smallest representable number. */\n epsilon(): number {\n return this.floatPrecision() === 32 ? EPSILON_FLOAT32 : EPSILON_FLOAT16;\n }\n\n uploadToGPU(dataId: DataId): void {\n const texData = this.texData.get(dataId);\n const {shape, dtype, values, texture, usage, isPacked} = texData;\n\n if (texture != null) {\n // Array is already on GPU. No-op.\n return;\n }\n const shouldTimeProgram = this.activeTimers != null;\n let start: number;\n if (shouldTimeProgram) {\n start = util.now();\n }\n\n let texShape = texData.texShape;\n if (texShape == null) {\n // This texShape may not be the final texture shape. For packed or dense\n // textures, the texShape will be changed when textures are created.\n texShape = webgl_util.getTextureShapeFromLogicalShape(shape, isPacked);\n texData.texShape = texShape;\n }\n\n if (values != null) {\n const shapeAs3D = webgl_util.getShapeAs3D(shape);\n\n let program;\n let width = texShape[1], height = texShape[0];\n const isByteArray =\n values instanceof Uint8Array || values instanceof Uint8ClampedArray;\n\n // texture for float array is PhysicalTextureType.PACKED_2X2_FLOAT32, we\n // need to make sure the upload uses the same packed size\n if (isPacked || !isByteArray) {\n [width, height] = tex_util.getPackedMatrixTextureShapeWidthHeight(\n texShape[0], texShape[1]);\n }\n\n if (isPacked) {\n program = new EncodeMatrixPackedProgram(shapeAs3D, isByteArray);\n } else {\n program = new EncodeMatrixProgram(shapeAs3D, isByteArray);\n }\n\n // TexShape for float array needs to be the original shape, which byte\n // array needs to be packed size. This allow the data upload shape to be\n // matched with texture creation logic.\n const tempDenseInputTexShape: [number, number] =\n isByteArray ? [height, width] : texShape;\n const tempDenseInputHandle =\n this.makeTensorInfo(tempDenseInputTexShape, dtype);\n const tempDenseInputTexData =\n this.texData.get(tempDenseInputHandle.dataId);\n if (isByteArray) {\n tempDenseInputTexData.usage = TextureUsage.PIXELS;\n } else {\n tempDenseInputTexData.usage = TextureUsage.UPLOAD;\n }\n tempDenseInputTexData.texShape = tempDenseInputTexShape;\n this.gpgpu.uploadDenseMatrixToTexture(\n this.getTexture(tempDenseInputHandle.dataId), width, height,\n values as TypedArray);\n\n const customValues = [[height, width]];\n // We want the output to remain packed regardless of the value of\n // WEBGL_PACK.\n const preventEagerUnpacking = true;\n const encodedOutputTarget = this.runWebGLProgram(\n program, [tempDenseInputHandle], dtype, customValues,\n preventEagerUnpacking);\n\n // Have the original texture assume the identity of the encoded output.\n const outputTexData = this.texData.get(encodedOutputTarget.dataId);\n texData.texShape = outputTexData.texShape;\n texData.isPacked = outputTexData.isPacked;\n texData.usage = outputTexData.usage;\n\n if (!env().get('ENGINE_COMPILE_ONLY')) {\n texData.texture = outputTexData.texture;\n // Once uploaded, don't store the values on cpu.\n texData.values = null;\n this.texData.delete(encodedOutputTarget.dataId);\n } else {\n this.disposeData(encodedOutputTarget.dataId);\n }\n\n this.disposeIntermediateTensorInfo(tempDenseInputHandle);\n\n if (shouldTimeProgram) {\n this.uploadWaitMs += util.now() - start;\n }\n } else {\n const newTexture = this.acquireTexture(texShape, usage, dtype, isPacked);\n texData.texture = newTexture;\n }\n }\n\n private convertAndCacheOnCPU(dataId: DataId, float32Values?: Float32Array):\n TypedArray {\n const texData = this.texData.get(dataId);\n const {dtype} = texData;\n\n this.releaseGPUData(dataId);\n\n if (float32Values != null) {\n texData.values = float32ToTypedArray(float32Values, dtype as 'float32');\n }\n return texData.values as TypedArray;\n }\n\n private acquireTexture(\n texShape: [number, number], texType: TextureUsage, dtype: DataType,\n isPacked: boolean): Texture {\n this.numBytesInGPU += this.computeBytes(texShape, dtype);\n if (!this.warnedAboutMemory &&\n this.numBytesInGPU > this.numMBBeforeWarning * 1024 * 1024) {\n const mb = (this.numBytesInGPU / 1024 / 1024).toFixed(2);\n this.warnedAboutMemory = true;\n console.warn(\n `High memory usage in GPU: ${mb} MB, ` +\n `most likely due to a memory leak`);\n }\n return this.textureManager.acquireTexture(texShape, texType, isPacked);\n }\n\n private computeBytes(shape: [number, number], dtype: DataType) {\n return shape[0] * shape[1] * util.bytesPerElement(dtype);\n }\n\n checkCompileCompletion() {\n for (const [, binary] of Object.entries(this.binaryCache)) {\n this.checkCompletion_(binary);\n }\n }\n\n async checkCompileCompletionAsync(): Promise {\n const ps = [];\n if (this.gpgpu.parallelCompilationExtension) {\n for (const [, binary] of Object.entries(this.binaryCache)) {\n ps.push(this.checkCompletionAsync_(binary));\n }\n return Promise.all(ps);\n } else {\n for (const [, binary] of Object.entries(this.binaryCache)) {\n const p: Promise = new Promise((resolve) => {\n try {\n this.checkCompletion_(binary);\n resolve(true);\n } catch (error) {\n throw error;\n }\n });\n ps.push(p);\n }\n return Promise.all(ps);\n }\n }\n\n private async checkCompletionAsync_(binary: GPGPUBinary): Promise {\n if (this.gpgpu.gl.getProgramParameter(\n binary.webGLProgram,\n this.gpgpu.parallelCompilationExtension.COMPLETION_STATUS_KHR)) {\n return this.checkCompletion_(binary);\n } else {\n await nextFrame();\n return this.checkCompletionAsync_(binary);\n }\n }\n\n private checkCompletion_(binary: GPGPUBinary): boolean {\n if (this.gpgpu.gl.getProgramParameter(\n binary.webGLProgram, this.gpgpu.gl.LINK_STATUS) === false) {\n console.log(this.gpgpu.gl.getProgramInfoLog(binary.webGLProgram));\n if (this.gpgpu.gl.getShaderParameter(\n binary.fragmentShader, this.gpgpu.gl.COMPILE_STATUS) === false) {\n webgl_util.logShaderSourceAndInfoLog(\n binary.source,\n this.gpgpu.gl.getShaderInfoLog(binary.fragmentShader));\n throw new Error('Failed to compile fragment shader.');\n }\n throw new Error('Failed to link vertex and fragment shaders.');\n }\n return true;\n }\n\n getUniformLocations() {\n for (const [, binary] of Object.entries(this.binaryCache)) {\n const {\n uniformLocations,\n customUniformLocations,\n infLoc,\n nanLoc,\n inShapesLocations,\n inTexShapesLocations,\n outShapeLocation,\n outShapeStridesLocation,\n outTexShapeLocation\n } = getUniformLocations(this.gpgpu, binary.program, binary.webGLProgram);\n binary.uniformLocations = uniformLocations;\n binary.customUniformLocations = customUniformLocations;\n binary.infLoc = infLoc;\n binary.nanLoc = nanLoc;\n binary.inShapesLocations = inShapesLocations;\n binary.inTexShapesLocations = inTexShapesLocations;\n binary.outShapeLocation = outShapeLocation;\n binary.outShapeStridesLocation = outShapeStridesLocation;\n binary.outTexShapeLocation = outTexShapeLocation;\n }\n }\n\n /**\n * Create a TF.js tensor out of an existing WebGL texture. A new texture will\n * be created.\n */\n createTensorFromTexture(values: WebGLData, shape: number[], dtype: DataType):\n Tensor {\n const {texture, height, width, channels} = values;\n const backend = engine().backend as MathBackendWebGL;\n\n // Have to throw an error, otherwise WebGL just warns and returns wrong\n // values.\n if (!backend.gpgpu.gl.isTexture(texture)) {\n throw new Error(\n `The texture is invalid. Also, please make sure the texture and ` +\n `the TFJS WebGL backend are using the same canvas. If you want to ` +\n `use your own custom canvas, you have to create and use the custom ` +\n `TFJS WebGL backend created from the canvas through ` +\n `'new tf.MathBackendWebGL(customCanvas)'.`);\n }\n\n const dataId =\n backend.writeTexture(texture, shape, dtype, height, width, channels);\n return engine().makeTensorFromDataId(dataId, shape, dtype, backend);\n }\n}\n\nfunction float32ToTypedArray(\n a: Float32Array, dtype: D): tf.DataTypeMap[D] {\n if (dtype === 'float32' || dtype === 'complex64') {\n return a as tf.DataTypeMap[D];\n } else if (dtype === 'int32' || dtype === 'bool') {\n const result = (dtype === 'int32') ? new Int32Array(a.length) :\n new Uint8Array(a.length);\n for (let i = 0; i < result.length; ++i) {\n result[i] = Math.round(a[i]);\n }\n return result as tf.DataTypeMap[D];\n } else {\n throw new Error(`Unknown dtype ${dtype}`);\n }\n}\n","/** @license See the LICENSE file. */\n\n// This code is auto-generated, do not modify this file!\nconst version = '4.0.0';\nexport {version};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env} from '@tensorflow/tfjs-core';\n\nimport * as gpgpu_util from './gpgpu_util';\nimport * as webgl_util from './webgl_util';\n\nexport {MathBackendWebGL, WebGLMemoryInfo, WebGLTimingInfo} from './backend_webgl';\nexport {setWebGLContext} from './canvas_util';\nexport {GPGPUContext} from './gpgpu_context';\nexport {GPGPUProgram} from './gpgpu_math';\n// WebGL specific utils.\nexport {gpgpu_util, webgl_util};\n\n/**\n * Enforce use of half precision textures if available on the platform.\n *\n * @doc {heading: 'Environment', namespace: 'webgl'}\n */\nexport function forceHalfFloat(): void {\n env().set('WEBGL_FORCE_F16_TEXTURES', true);\n}\n","/**\n * @license\n * Copyright 2020 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// base.ts is the webgl backend without auto kernel registration.\n\nimport {device_util, registerBackend} from '@tensorflow/tfjs-core';\nimport {MathBackendWebGL} from './backend_webgl';\nexport {version as version_webgl} from './version';\n\nif (device_util.isBrowser()) {\n registerBackend('webgl', () => new MathBackendWebGL(), 2 /* priority */);\n}\n\n// Export webgl utilities\nexport * from './webgl';\n\n// Export forceHalfFlost under webgl namespace for the union bundle.\nimport {forceHalfFloat} from './webgl';\nexport const webgl = {forceHalfFloat};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\n\nimport {GPGPUProgram, useShapeUniforms} from './gpgpu_math';\n\nexport const CHECK_NAN_SNIPPET = `\n if (isnan(a)) return a;\n if (isnan(b)) return b;\n`;\n\nexport const SQUARED_DIFFERENCE = 'return (a - b) * (a - b);';\nexport class BinaryOpProgram implements GPGPUProgram {\n variableNames = ['A', 'B'];\n outputShape: number[];\n userCode: string;\n enableShapeUniforms: boolean;\n\n constructor(op: string, aShape: number[], bShape: number[]) {\n this.outputShape = backend_util.assertAndGetBroadcastShape(aShape, bShape);\n this.enableShapeUniforms = useShapeUniforms(this.outputShape.length);\n this.userCode = `\n float binaryOperation(float a, float b) {\n ${op}\n }\n\n void main() {\n float a = getAAtOutCoords();\n float b = getBAtOutCoords();\n setOutput(binaryOperation(a, b));\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, util} from '@tensorflow/tfjs-core';\n\nimport {GPGPUProgram, useShapeUniforms} from './gpgpu_math';\nimport {getChannels} from './packing_util';\nimport {getCoordsDataType} from './shader_compiler';\n\nexport const CHECK_NAN_SNIPPET_PACKED = `\n result.r = isNaN.r ? NAN : result.r;\n result.g = isNaN.g ? NAN : result.g;\n result.b = isNaN.b ? NAN : result.b;\n result.a = isNaN.a ? NAN : result.a;\n`;\n\nexport const ELU_DER = `\n vec4 bGTEZero = vec4(greaterThanEqual(b, vec4(0.)));\n return (bGTEZero * a) + ((vec4(1.0) - bGTEZero) * (a * (b + vec4(1.0))));\n`;\n\nexport const NOT_EQUAL = `\n return vec4(notEqual(a, b));\n`;\n\nexport class BinaryOpPackedProgram implements GPGPUProgram {\n variableNames = ['A', 'B'];\n outputShape: number[];\n userCode: string;\n supportsBroadcasting = true;\n packedInputs = true;\n packedOutput = true;\n enableShapeUniforms: boolean;\n\n constructor(\n op: string, aShape: number[], bShape: number[],\n checkOutOfBounds = false) {\n this.outputShape = backend_util.assertAndGetBroadcastShape(aShape, bShape);\n const rank = this.outputShape.length;\n this.enableShapeUniforms = useShapeUniforms(rank);\n let checkOutOfBoundsString = '';\n if (checkOutOfBounds) {\n if (rank === 0 || util.sizeFromShape(this.outputShape) === 1) {\n checkOutOfBoundsString = `\n result.y = 0.;\n result.z = 0.;\n result.w = 0.;\n `;\n } else {\n const dtype = getCoordsDataType(rank);\n checkOutOfBoundsString = `\n ${dtype} coords = getOutputCoords();\n `;\n if (rank === 1) {\n if (this.enableShapeUniforms) {\n checkOutOfBoundsString += `\n result.y = (coords + 1) >= outShape ? 0. : result.y;\n result.z = 0.;\n result.w = 0.;\n `;\n } else {\n checkOutOfBoundsString += `\n result.y = (coords + 1) >= ${this.outputShape[0]} ? 0. : result.y;\n result.z = 0.;\n result.w = 0.;\n `;\n }\n } else {\n const channels = getChannels('coords', rank);\n if (this.enableShapeUniforms) {\n checkOutOfBoundsString += `\n bool nextRowOutOfBounds =\n (${channels[rank - 2]} + 1) >= outShape[${rank} - 2];\n bool nextColOutOfBounds =\n (${channels[rank - 1]} + 1) >= outShape[${rank} - 1];\n result.y = nextColOutOfBounds ? 0. : result.y;\n result.z = nextRowOutOfBounds ? 0. : result.z;\n result.w = nextColOutOfBounds || nextRowOutOfBounds ? 0. : result.w;\n `;\n } else {\n checkOutOfBoundsString += `\n bool nextRowOutOfBounds =\n (${channels[rank - 2]} + 1) >= ${this.outputShape[rank - 2]};\n bool nextColOutOfBounds =\n (${channels[rank - 1]} + 1) >= ${this.outputShape[rank - 1]};\n result.y = nextColOutOfBounds ? 0. : result.y;\n result.z = nextRowOutOfBounds ? 0. : result.z;\n result.w = nextColOutOfBounds || nextRowOutOfBounds ? 0. : result.w;\n `;\n }\n }\n }\n }\n\n this.userCode = `\n vec4 binaryOperation(vec4 a, vec4 b) {\n ${op}\n }\n\n void main() {\n vec4 a = getAAtOutCoords();\n vec4 b = getBAtOutCoords();\n\n vec4 result = binaryOperation(a, b);\n ${checkOutOfBoundsString}\n\n setOutput(result);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Identity, IdentityInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\n\nexport function identity(\n args: {inputs: IdentityInputs, backend: MathBackendWebGL}): TensorInfo {\n const {inputs, backend} = args;\n const {x} = inputs;\n\n backend.incRef(x.dataId);\n\n return {dataId: x.dataId, shape: x.shape, dtype: x.dtype};\n}\n\nexport const identityConfig: KernelConfig = {\n kernelName: Identity,\n backendName: 'webgl',\n kernelFunc: identity as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Complex, ComplexInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {identity} from './Identity';\n\n/**\n * In WebGL data is stored in GPU textures which can't be efficiently copied, so\n * complex tensors share data with their real and imaginary components. Complex\n * tensors' reference to the components is tracked by refCount on the individual\n * component. The refCounts are increased by the identity call.\n *\n * When a complex tensor is disposed, it will reduce the refCount on the\n * components by calling disposeData on each.\n */\nexport function complex(\n args: {inputs: ComplexInputs, backend: MathBackendWebGL}): TensorInfo {\n const {inputs, backend} = args;\n const {real, imag} = inputs;\n\n const complexInfo = backend.makeTensorInfo(real.shape, 'complex64');\n const complex = backend.texData.get(complexInfo.dataId);\n\n const realTensorInfo = identity({inputs: {x: real}, backend});\n\n const imagTensorInfo = identity({inputs: {x: imag}, backend});\n\n complex.complexTensorInfos = {real: realTensorInfo, imag: imagTensorInfo};\n\n return complexInfo;\n}\n\nexport const complexConfig: KernelConfig = {\n kernelName: Complex,\n backendName: 'webgl',\n kernelFunc: complex as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env, KernelConfig, KernelFunc, LeakyRelu, LeakyReluAttrs, LeakyReluInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {BinaryOpProgram} from '../binaryop_gpu';\nimport {BinaryOpPackedProgram} from '../binaryop_packed_gpu';\n\nexport const LEAKYRELU = `return (a < 0.) ? b * a : a;`;\nexport const LEAKYRELU_PACKED = `\n vec4 aLessThanZero = vec4(lessThan(a, vec4(0.)));\n return (aLessThanZero * (b * a)) + ((vec4(1.0) - aLessThanZero) * a);\n`;\n\nexport function leakyRelu(args: {\n inputs: LeakyReluInputs,\n backend: MathBackendWebGL,\n attrs: LeakyReluAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {alpha} = attrs;\n\n const $alpha = backend.makeTensorInfo(\n [], 'float32',\n util.createScalarValue(alpha as {} as 'float32', 'float32'));\n\n const program = env().getBool('WEBGL_PACK_BINARY_OPERATIONS') ?\n new BinaryOpPackedProgram(LEAKYRELU_PACKED, x.shape, $alpha.shape) :\n new BinaryOpProgram(LEAKYRELU, x.shape, $alpha.shape);\n const result = backend.runWebGLProgram(program, [x, $alpha], 'float32');\n\n backend.disposeIntermediateTensorInfo($alpha);\n\n return result;\n}\n\nexport const leakyReluConfig: KernelConfig = {\n kernelName: LeakyRelu,\n backendName: 'webgl',\n kernelFunc: leakyRelu as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env, KernelConfig, KernelFunc, Prelu, PreluInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {BinaryOpProgram} from '../binaryop_gpu';\nimport {BinaryOpPackedProgram} from '../binaryop_packed_gpu';\n\nexport const PRELU = `return (a < 0.) ? b * a : a;`;\nexport const PRELU_PACKED = `\n vec4 aLessThanZero = vec4(lessThan(a, vec4(0.)));\n return (aLessThanZero * (b * a)) + ((vec4(1.0) - aLessThanZero) * a);\n`;\n\nexport function prelu(args: {inputs: PreluInputs, backend: MathBackendWebGL}):\n TensorInfo {\n const {inputs, backend} = args;\n const {x, alpha} = inputs;\n\n const program = env().getBool('WEBGL_PACK_BINARY_OPERATIONS') ?\n new BinaryOpPackedProgram(PRELU_PACKED, x.shape, alpha.shape) :\n new BinaryOpProgram(PRELU, x.shape, alpha.shape);\n return backend.runWebGLProgram(program, [x, alpha], 'float32');\n}\n\nexport const preluConfig: KernelConfig = {\n kernelName: Prelu,\n backendName: 'webgl',\n kernelFunc: prelu as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, BinaryInputs, DataType, env, KernelFunc, TypedArray, UnaryInputs, upcastType} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {BinaryOpProgram} from '../binaryop_gpu';\nimport {BinaryOpPackedProgram} from '../binaryop_packed_gpu';\nimport {complex} from '../kernels/Complex';\nimport {LEAKYRELU, LEAKYRELU_PACKED} from '../kernels/LeakyRelu';\nimport {PRELU, PRELU_PACKED} from '../kernels/Prelu';\nimport * as unary_op from '../unaryop_gpu';\nimport {UnaryOpProgram} from '../unaryop_gpu';\nimport * as unary_packed_op from '../unaryop_packed_gpu';\nimport {UnaryOpPackedProgram} from '../unaryop_packed_gpu';\n\nimport {SimpleBinaryKernelImplCPU, SimpleUnaryKernelImplCPU} from './shared';\n\nexport const CHECK_NAN_SNIPPET_UNARY = `if (isnan(x)) return x;`;\n\ntype UnaryKernelFuncConfig = {\n opSnippet: string,\n packedOpSnippet?: string,\n cpuKernelImpl?: SimpleUnaryKernelImplCPU,\n dtype?: DataType\n};\n\n/**\n * Template that creates a `KernelFunc` for unary ops.\n * @param opSnippet Op snippet to create `UnaryOpProgram`.\n * @param packedOpSnippet Op snippet to create `UnaryOpPackedProgram`.\n * @param dtype Optional. If set, the result has this dtype. Otherwise, the\n * result has the same dtype as the first input. This is mainly used in\n * comparison kernels, such as Equal, Less, Greater, etc.\n */\nexport function unaryKernelFunc(\n {opSnippet, packedOpSnippet, cpuKernelImpl, dtype}: UnaryKernelFuncConfig):\n KernelFunc {\n return ({inputs, backend}) => {\n const {x} = inputs as UnaryInputs;\n const webglBackend = backend as MathBackendWebGL;\n\n const $dtype = dtype || x.dtype;\n if (webglBackend.shouldExecuteOnCPU([x]) && cpuKernelImpl != null) {\n const xData = webglBackend.texData.get(x.dataId);\n const outValues = cpuKernelImpl(xData.values as TypedArray, $dtype);\n return webglBackend.makeTensorInfo(x.shape, $dtype, outValues);\n }\n\n const shouldUsePackedProgram =\n env().getBool('WEBGL_PACK_UNARY_OPERATIONS') && packedOpSnippet != null;\n let program: UnaryOpProgram|UnaryOpPackedProgram;\n if (shouldUsePackedProgram) {\n program = new UnaryOpPackedProgram(x.shape, packedOpSnippet);\n } else {\n program = new UnaryOpProgram(x.shape, opSnippet);\n }\n\n return webglBackend.runWebGLProgram(program, [x], $dtype);\n };\n}\n\ntype BinaryKernelFuncConfig = {\n opSnippet: string,\n packedOpSnippet?: string,\n checkOutOfBounds?: boolean,\n supportsComplex?: boolean,\n cpuKernelImpl?: SimpleBinaryKernelImplCPU,\n dtype?: DataType\n};\n\n/**\n * Template that creates a `KernelFunc` for binary ops.\n * @param opSnippet Op snippet to create `BinaryOpProgram`.\n * @param packedOpSnippet Op snippet to create `BinaryOpPackedProgram`.\n * @param checkOutOfBoundsForPackedProgram Whether to set checkOutOfBounds=true\n * when creating BinaryOpPackedProgram.\n * @param dtype Optional. If set, the result has this dtype. Otherwise, the\n * result has the same dtype as the first input. This is mainly used in\n * comparison kernels, such as Equal, Less, Greater, etc.\n */\nexport function binaryKernelFunc({\n opSnippet,\n packedOpSnippet,\n checkOutOfBounds = false,\n supportsComplex = false,\n cpuKernelImpl,\n dtype\n}: BinaryKernelFuncConfig): KernelFunc {\n return ({inputs, backend}) => {\n const {a, b} = inputs as BinaryInputs;\n const webglBackend = backend as MathBackendWebGL;\n\n if (supportsComplex && a.dtype === 'complex64') {\n const aData = webglBackend.texData.get(a.dataId);\n const bData = webglBackend.texData.get(b.dataId);\n\n const [real, imag] = [\n [aData.complexTensorInfos.real, bData.complexTensorInfos.real],\n [aData.complexTensorInfos.imag, bData.complexTensorInfos.imag]\n ].map(complexParts => {\n const [aPart, bPart] = complexParts;\n\n const aHandle = {\n dataId: aPart.dataId,\n dtype: aPart.dtype,\n shape: a.shape\n };\n const bHandle = {\n dataId: bPart.dataId,\n dtype: bPart.dtype,\n shape: b.shape\n };\n\n const program = new BinaryOpProgram(opSnippet, a.shape, b.shape);\n return webglBackend.runWebGLProgram(\n program, [aHandle, bHandle], upcastType(aPart.dtype, bPart.dtype));\n });\n\n const complexOutput =\n complex({inputs: {real, imag}, backend: webglBackend});\n\n webglBackend.disposeIntermediateTensorInfo(real);\n webglBackend.disposeIntermediateTensorInfo(imag);\n\n // TODO(annxingyuan): Implement CPU forwarding for complex inputs.\n\n return complexOutput;\n }\n\n const $dtype = dtype || upcastType(a.dtype, b.dtype);\n if ((a.dtype === 'string' || b.dtype === 'string' ||\n webglBackend.shouldExecuteOnCPU([a, b])) &&\n cpuKernelImpl != null) {\n const aVals = webglBackend.texData.get(a.dataId).values as TypedArray;\n const bVals = webglBackend.texData.get(b.dataId).values as TypedArray;\n\n const decodedAVals = a.dtype === 'string' ?\n // tslint:disable-next-line: no-any\n backend_util.fromUint8ToStringArray(aVals as any as Uint8Array[]) :\n aVals;\n const decodedBVals = a.dtype === 'string' ?\n // tslint:disable-next-line: no-any\n backend_util.fromUint8ToStringArray(bVals as any as Uint8Array[]) :\n bVals;\n const [outValues, outShape] =\n cpuKernelImpl(a.shape, b.shape, decodedAVals, decodedBVals, $dtype);\n\n const out = webglBackend.makeTensorInfo(outShape, $dtype);\n const outData = webglBackend.texData.get(out.dataId);\n outData.values = outValues;\n return out;\n }\n\n const shouldUsePackedProgram =\n env().getBool('WEBGL_PACK_BINARY_OPERATIONS') &&\n packedOpSnippet != null;\n let program: BinaryOpProgram|BinaryOpPackedProgram;\n if (shouldUsePackedProgram) {\n program = new BinaryOpPackedProgram(\n packedOpSnippet, a.shape, b.shape, checkOutOfBounds);\n } else {\n program = new BinaryOpProgram(opSnippet, a.shape, b.shape);\n }\n\n return webglBackend.runWebGLProgram(program, [a, b], $dtype);\n };\n}\n\nexport function mapActivationToShaderProgram(\n activation: backend_util.Activation, packed = false): string {\n if (activation === 'linear') {\n if (packed) {\n return unary_packed_op.LINEAR;\n }\n return unary_op.LINEAR;\n } else if (activation === 'relu') {\n if (packed) {\n return unary_packed_op.RELU;\n }\n return unary_op.RELU;\n } else if (activation === 'elu') {\n if (packed) {\n return unary_packed_op.ELU;\n }\n return unary_op.ELU;\n } else if (activation === 'relu6') {\n if (packed) {\n return unary_packed_op.RELU6;\n }\n return unary_op.RELU6;\n } else if (activation === 'prelu') {\n if (packed) {\n return PRELU_PACKED;\n }\n return PRELU;\n } else if (activation === 'leakyrelu') {\n if (packed) {\n return LEAKYRELU_PACKED;\n }\n return LEAKYRELU;\n } else if (activation === 'sigmoid') {\n if (packed) {\n return unary_packed_op.SIGMOID;\n }\n return unary_op.SIGMOID;\n }\n throw new Error(`Activation ${\n activation} has not been implemented for the WebGL backend.`);\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram, useShapeUniforms} from './gpgpu_math';\n\nexport class MatMulPackedProgram implements GPGPUProgram {\n variableNames = ['matrixA', 'matrixB'];\n packedInputs = true;\n packedOutput = true;\n outputShape: number[];\n userCode: string;\n enableShapeUniforms: boolean;\n\n constructor(\n aShape: [number, number, number], bShape: [number, number, number],\n outputShape: [number, number, number], transposeA = false,\n transposeB = false, addBias = false, activation: string = null,\n hasPreluActivation = false, hasLeakyreluActivation = false) {\n this.outputShape = outputShape;\n this.enableShapeUniforms = useShapeUniforms(this.outputShape.length);\n\n const sharedDim = transposeA ? aShape[1] : aShape[2];\n const sharedDimensionPacked = Math.ceil(sharedDim / 2);\n\n const aSample = transposeA ? 'i * 2, rc.y' : 'rc.y, i * 2';\n const bSample = transposeB ? 'rc.z, i * 2' : 'i * 2, rc.z';\n const aSwizzle = transposeA ? ['a.xxyy', 'a.zzww'] : ['a.xxzz', 'a.yyww'];\n const bSwizzle = transposeB ? ['b.xzxz', 'b.ywyw'] : ['b.xyxy', 'b.zwzw'];\n\n let activationSnippet = '', applyActivationSnippet = '';\n if (activation) {\n if (hasPreluActivation) {\n activationSnippet = `vec4 activation(vec4 a) {\n vec4 b = getPreluActivationWeightsAtOutCoords();\n ${activation}\n }`;\n } else if (hasLeakyreluActivation) {\n activationSnippet = `vec4 activation(vec4 a) {\n vec4 b = getLeakyreluAlphaAtOutCoords();\n ${activation}\n }`;\n } else {\n activationSnippet = `vec4 activation(vec4 x) {\n ${activation}\n }`;\n }\n\n applyActivationSnippet = `result = activation(result);`;\n }\n\n const addBiasSnippet = addBias ? 'result += getBiasAtOutCoords();' : '';\n if (addBias) {\n this.variableNames.push('bias');\n }\n\n if (hasPreluActivation) {\n this.variableNames.push('preluActivationWeights');\n }\n\n if (hasLeakyreluActivation) {\n this.variableNames.push('leakyreluAlpha');\n }\n\n let batchASnippet = 'rc.x';\n let batchBSnippet = 'rc.x';\n if (aShape[0] < bShape[0]) {\n batchASnippet = `int(min(float(rc.x), ${aShape[0] - 1}.))`;\n } else if (bShape[0] < aShape[0]) {\n batchBSnippet = `int(min(float(rc.x), ${bShape[0] - 1}.))`;\n }\n\n this.userCode = `\n ${activationSnippet}\n // Don't use uniform for sharedDimensionPacked for performance.\n const float sharedDimension = ${sharedDimensionPacked}.0;\n\n vec4 dot2x2ARowBCol(ivec3 rc) {\n vec4 result = vec4(0);\n for (int i = 0; i < ${sharedDimensionPacked}; i++) {\n int batchA = ${batchASnippet};\n int batchB = ${batchBSnippet};\n vec4 a = getMatrixA(batchA, ${aSample});\n vec4 b = getMatrixB(batchB, ${bSample});\n\n // These swizzled products need to be separately added.\n // See: https://github.com/tensorflow/tfjs/issues/1735\n result += (${aSwizzle[0]} * ${bSwizzle[0]});\n result += (${aSwizzle[1]} * ${bSwizzle[1]});\n }\n return result;\n }\n\n void main() {\n ivec3 rc = getOutputCoords();\n vec4 result = dot2x2ARowBCol(rc);\n\n ${addBiasSnippet}\n\n ${applyActivationSnippet}\n\n setOutput(result);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {GPGPUProgram} from './gpgpu_math';\n\n// (Ar + Ai)(Br + Bi) =\n// ArBr + ArBi + AiBr + AiBi = ArBr - AB + ArBi + AiBr\n// Yr = ArBr - AB\n// Yi = ArBi + AiBr\nexport const COMPLEX_MULTIPLY = {\n REAL: 'return areal * breal - aimag * bimag;',\n IMAG: 'return areal * bimag + aimag * breal;'\n};\n\nexport class BinaryOpComplexProgram implements GPGPUProgram {\n variableNames = ['AReal', 'AImag', 'BReal', 'BImag'];\n userCode: string;\n outputShape: number[];\n\n constructor(op: string, aShape: number[], bShape: number[]) {\n this.outputShape = backend_util.assertAndGetBroadcastShape(aShape, bShape);\n\n this.userCode = `\n float binaryOpComplex(\n float areal, float aimag, float breal, float bimag) {\n ${op}\n }\n\n void main() {\n float areal = getARealAtOutCoords();\n float aimag = getAImagAtOutCoords();\n float breal = getBRealAtOutCoords();\n float bimag = getBImagAtOutCoords();\n setOutput(binaryOpComplex(areal, aimag, breal, bimag));\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, BinaryInputs, env, KernelConfig, Multiply, TensorInfo, TypedArray} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport * as binaryop_complex_gpu from '../binaryop_complex_gpu';\nimport {BinaryOpComplexProgram} from '../binaryop_complex_gpu';\nimport {BinaryOpProgram} from '../binaryop_gpu';\nimport {BinaryOpPackedProgram} from '../binaryop_packed_gpu';\nimport {multiplyImplCPU as cpuMultiply} from '../kernel_utils/shared';\n\nimport {complex} from './Complex';\n\nconst MUL = 'return a * b;';\n\nexport function multiply(\n args: {inputs: BinaryInputs, backend: MathBackendWebGL}): TensorInfo {\n const {inputs, backend} = args;\n const {a, b} = inputs;\n const dtype = backend_util.upcastType(a.dtype, b.dtype);\n\n if (a.dtype === 'complex64') {\n const aData = backend.texData.get(a.dataId);\n const bData = backend.texData.get(b.dataId);\n\n const realProgram = new BinaryOpComplexProgram(\n binaryop_complex_gpu.COMPLEX_MULTIPLY.REAL, a.shape, b.shape);\n const imagProgram = new BinaryOpComplexProgram(\n binaryop_complex_gpu.COMPLEX_MULTIPLY.IMAG, a.shape, b.shape);\n\n const inputs = [\n {\n dataId: aData.complexTensorInfos.real.dataId,\n dtype: aData.complexTensorInfos.real.dtype,\n shape: a.shape\n },\n {\n dataId: aData.complexTensorInfos.imag.dataId,\n dtype: aData.complexTensorInfos.imag.dtype,\n shape: a.shape\n },\n {\n dataId: bData.complexTensorInfos.real.dataId,\n dtype: bData.complexTensorInfos.real.dtype,\n shape: b.shape\n },\n {\n dataId: bData.complexTensorInfos.imag.dataId,\n dtype: bData.complexTensorInfos.imag.dtype,\n shape: b.shape\n }\n ];\n\n const realPart = backend.runWebGLProgram(realProgram, inputs, 'float32');\n const imagPart = backend.runWebGLProgram(imagProgram, inputs, 'float32');\n\n const complexOutput =\n complex({inputs: {real: realPart, imag: imagPart}, backend});\n\n backend.disposeIntermediateTensorInfo(realPart);\n backend.disposeIntermediateTensorInfo(imagPart);\n\n // TODO(annxingyuan): CPU forwarding for complex inputs.\n return complexOutput;\n }\n\n if (backend.shouldExecuteOnCPU([a, b])) {\n const aData = backend.texData.get(a.dataId);\n const bData = backend.texData.get(b.dataId);\n const [outValues, outShape] = cpuMultiply(\n a.shape, b.shape, aData.values as TypedArray,\n bData.values as TypedArray, dtype);\n\n const out = backend.makeTensorInfo(outShape, dtype);\n const outData = backend.texData.get(out.dataId);\n outData.values = outValues;\n return out;\n }\n\n let program: BinaryOpProgram|BinaryOpPackedProgram;\n if (env().getBool('WEBGL_PACK_BINARY_OPERATIONS')) {\n program = new BinaryOpPackedProgram(MUL, a.shape, b.shape);\n } else {\n program = new BinaryOpProgram(MUL, a.shape, b.shape);\n }\n\n return backend.runWebGLProgram(program, [a, b], dtype);\n}\n\nexport const multiplyConfig: KernelConfig = {\n kernelName: Multiply,\n backendName: 'webgl',\n kernelFunc: multiply\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {ReshapePackedProgram} from '../reshape_packed_gpu';\nimport {getBatchDim, getRowsCols} from '../webgl_util';\n\nexport function packedReshape(\n input: TensorInfo, afterShape: number[],\n backend: MathBackendWebGL): TensorInfo {\n const input3DShape =\n [getBatchDim(input.shape),\n ...getRowsCols(input.shape)] as [number, number, number];\n const input3D: TensorInfo = {\n dtype: input.dtype,\n shape: input3DShape,\n dataId: input.dataId\n };\n const afterShapeAs3D =\n [getBatchDim(afterShape),\n ...getRowsCols(afterShape)] as [number, number, number];\n\n const program = new ReshapePackedProgram(afterShapeAs3D, input3DShape);\n const preventEagerUnpackingOfOutput = true;\n const customValues = [input3DShape];\n const output = backend.runWebGLProgram(\n program, [input3D], input.dtype, customValues,\n preventEagerUnpackingOfOutput);\n return {dataId: output.dataId, shape: afterShape, dtype: output.dtype};\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Reshape, ReshapeAttrs, ReshapeInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {packedReshape} from '../kernel_utils/reshape';\nimport {isReshapeFree} from '../webgl_util';\n\nexport function reshape(args: {\n inputs: ReshapeInputs,\n backend: MathBackendWebGL,\n attrs: ReshapeAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {shape} = attrs;\n const webglBackend = backend;\n\n const xSize = util.sizeFromShape(x.shape);\n const $shape = util.inferFromImplicitShape(shape, xSize);\n const $xSize = util.sizeFromShape($shape);\n\n util.assert(\n xSize === $xSize,\n () => `The new shape (${$shape}) has ${$xSize} elements and the old ` +\n `shape (${x.shape}) has ${xSize} elements. The new shape and old ` +\n `shape must have the same number of elements.`);\n\n const xTexData = webglBackend.texData.get(x.dataId);\n if (xTexData.isPacked && !isReshapeFree(x.shape, $shape) &&\n !(xTexData.texture !== null && isReshapeFree(xTexData.shape, $shape))) {\n return packedReshape(x, $shape, webglBackend);\n }\n\n webglBackend.incRef(x.dataId);\n\n return {dataId: x.dataId, shape: $shape, dtype: x.dtype};\n}\n\nexport const reshapeConfig: KernelConfig = {\n kernelName: Reshape,\n backendName: 'webgl',\n kernelFunc: reshape as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, util} from '@tensorflow/tfjs-core';\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class MeanProgram implements GPGPUProgram {\n variableNames = ['x'];\n outputShape: number[];\n userCode: string;\n\n constructor(reduceInfo: backend_util.ReduceInfo, divisor?: number) {\n const {windowSize, batchSize, inSize, outSize} = reduceInfo;\n this.outputShape = [batchSize, outSize];\n\n const windowSizeNearestVec4 = Math.floor(windowSize / 4) * 4;\n const windowSizeVec4Remainder = windowSize % 4;\n\n let updateSnippet = `sumValue += dot(values, ones);`;\n if (divisor != null) {\n const denominator = 1 / divisor;\n updateSnippet = `sumValue += dot(values * ${\n util.isInt(denominator) ? denominator.toPrecision(2) :\n denominator}, ones);`;\n }\n\n let checkOutOfBounds = '';\n if (inSize % windowSize > 0) {\n checkOutOfBounds = `\n if (inIdx < 0 || inIdx >= ${inSize}) {\n return 0.0;\n }\n `;\n }\n\n this.userCode = `\n const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n float getValue(int batch, int inIdx) {\n ${checkOutOfBounds}\n return getX(batch, inIdx);\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int outIdx = coords[1];\n int inOffset = outIdx * ${windowSize};\n\n float sumValue = 0.0;\n\n for (int i = 0; i < ${windowSizeNearestVec4}; i += 4) {\n int inIdx = inOffset + i;\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n getValue(batch, inIdx + 3)\n );\n\n ${updateSnippet}\n }\n\n int inIdx = inOffset + ${windowSizeNearestVec4};\n if (${windowSizeVec4Remainder === 1}) {\n vec4 values = vec4(getValue(batch, inIdx), 0.0, 0.0, 0.0);\n\n ${updateSnippet}\n } else if (${windowSizeVec4Remainder === 2}) {\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1), 0.0, 0.0);\n\n ${updateSnippet}\n } else if (${windowSizeVec4Remainder === 3}) {\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2), 0.0);\n\n ${updateSnippet}\n }\n setOutput(sumValue);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class ReduceProgram implements GPGPUProgram {\n variableNames = ['x'];\n outputShape: number[];\n userCode: string;\n\n constructor(\n reduceInfo: backend_util.ReduceInfo,\n reduceType: 'all'|'any'|'max'|'min'|'sum'|'prod') {\n const {windowSize, batchSize, inSize, outSize} = reduceInfo;\n this.outputShape = [batchSize, outSize];\n\n let initializationValue = '0.0';\n let compareOp = ``;\n\n if (reduceType === 'prod') {\n initializationValue = '1.0';\n } else if (reduceType === 'min') {\n // WebGL on Firefox Linux can't compile 1/0 so we do 1/eps.\n initializationValue = '1.0 / 1e-20';\n compareOp = `min`;\n } else if (reduceType === 'max') {\n // WebGL on Firefox Linux can't compile 1/0 so we do 1/eps.\n initializationValue = '-1.0 / 1e-20';\n compareOp = `max`;\n }\n\n let returnValue = `${reduceType}(${reduceType}(${reduceType}(` +\n 'minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])';\n\n if (reduceType === 'sum') {\n returnValue = `sumValue`;\n } else if (reduceType === 'prod') {\n returnValue = `prodValue`;\n } else if (reduceType === 'all') {\n returnValue = `allValue`;\n } else if (reduceType === 'any') {\n returnValue = `anyValue`;\n }\n\n const windowSizeNearestVec4 = Math.floor(windowSize / 4) * 4;\n const windowSizeVec4Remainder = windowSize % 4;\n\n let updateSnippet = `\n if (${reduceType === 'sum'}) {\n sumValue += dot(values, ones);\n } else if (${reduceType === 'prod'}) {\n vec2 tmp = vec2(values[0], values[1]) * vec2(values[2], values[3]);\n prodValue *= tmp[0] * tmp[1];\n } else {\n minMaxValue = ${compareOp}(values, minMaxValue);\n if (${reduceType === 'min'} || ${reduceType === 'max'}) {\n minMaxValue = ${compareOp}(values, minMaxValue);\n bvec4 isNaN = isnan(values);\n if (isNaN.r || isNaN.g || isNaN.b || isNaN.a) {\n minMaxValue = vec4(NAN);\n }\n }\n }\n `;\n\n let vecType = `vec4`;\n\n if (reduceType === 'all') {\n initializationValue = '1.0';\n updateSnippet = `\n bool reducedAllValue = all(values);\n float floatedReducedAllValue = float(reducedAllValue);\n allValue = float(allValue >= 1.0 && floatedReducedAllValue >= 1.0);\n `;\n vecType = `bvec4`;\n } else if (reduceType === 'any') {\n initializationValue = '0.0';\n updateSnippet = `\n bool reducedAnyValue = any(values);\n float floatedReducedAnyValue = float(reducedAnyValue);\n anyValue = float(anyValue >= 1.0 || floatedReducedAnyValue >= 1.0);\n `;\n vecType = `bvec4`;\n }\n\n let checkOutOfBounds = '';\n if (inSize % windowSize > 0) {\n checkOutOfBounds = `\n if (inIdx < 0 || inIdx >= ${inSize}) {\n return initializationValue;\n }\n `;\n }\n this.userCode = `\n const float initializationValue = ${initializationValue};\n const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n float getValue(int batch, int inIdx) {\n ${checkOutOfBounds}\n return getX(batch, inIdx);\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int outIdx = coords[1];\n int inOffset = outIdx * ${windowSize};\n\n vec4 minMaxValue = vec4(${initializationValue});\n float prodValue = 1.0;\n float sumValue = 0.0;\n float allValue = 1.0;\n float anyValue = 0.0;\n\n for (int i = 0; i < ${windowSizeNearestVec4}; i += 4) {\n int inIdx = inOffset + i;\n ${vecType} values = ${vecType}(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n getValue(batch, inIdx + 3)\n );\n\n ${updateSnippet}\n }\n\n int inIdx = inOffset + ${windowSizeNearestVec4};\n if (${windowSizeVec4Remainder === 1}) {\n ${vecType} values = ${vecType}(\n getValue(batch, inIdx),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n ${updateSnippet}\n } else if (${windowSizeVec4Remainder === 2}) {\n ${vecType} values = ${vecType}(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n initializationValue,\n initializationValue\n );\n\n ${updateSnippet}\n } else if (${windowSizeVec4Remainder === 3}) {\n ${vecType} values = ${vecType}(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n initializationValue\n );\n\n ${updateSnippet}\n }\n setOutput(${returnValue});\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, DataType, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {MeanProgram} from '../mean_gpu';\nimport {ReduceProgram} from '../reduce_gpu';\n\ntype ReduceTypes = 'all'|'any'|'max'|'min'|'sum'|'prod'|'mean';\n\n// Returns an array of configuration objects that describe each stage of the\n// reduction.\nfunction getReductionStages(inShape: number[]):\n Array<{inSize: number, windowSize: number, outSize: number}> {\n const stages = [];\n\n while (stages.length === 0 || stages[stages.length - 1].outSize !== 1) {\n const outSize: number =\n stages.length ? stages[stages.length - 1].outSize : inShape[1];\n const windowSize = backend_util.computeOptimalWindowSize(outSize);\n stages.push({\n inSize: outSize,\n windowSize,\n outSize: Math.ceil(outSize / windowSize)\n });\n }\n\n return stages;\n}\n\nexport function reduce(\n x: TensorInfo, dtype: DataType, reductionType: ReduceTypes,\n backend: MathBackendWebGL): TensorInfo {\n const reductionStages = getReductionStages(x.shape);\n\n let result = x;\n for (let i = 0; i < reductionStages.length; i++) {\n const {inSize, windowSize, outSize} = reductionStages[i];\n\n let program: ReduceProgram|MeanProgram;\n let previousResult: TensorInfo;\n if (reductionType === 'mean') {\n program = i === 0 ?\n new MeanProgram(\n {windowSize, inSize, batchSize: x.shape[0], outSize}, inSize) :\n new MeanProgram({windowSize, inSize, batchSize: x.shape[0], outSize});\n } else {\n program = new ReduceProgram(\n {windowSize, inSize, batchSize: x.shape[0], outSize}, reductionType);\n }\n\n previousResult = result;\n result = backend.runWebGLProgram(program, [result], dtype);\n\n if (previousResult.dataId !== x.dataId) {\n backend.disposeIntermediateTensorInfo(previousResult);\n }\n }\n\n return result;\n}\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {getCoordsDataType} from './shader_compiler';\n\nexport class TransposeProgram implements GPGPUProgram {\n variableNames = ['A'];\n outputShape: number[];\n userCode: string;\n rank: number;\n\n constructor(aShape: number[], newDim: number[]) {\n const outputShape: number[] = new Array(aShape.length);\n for (let i = 0; i < outputShape.length; i++) {\n outputShape[i] = aShape[newDim[i]];\n }\n this.outputShape = outputShape;\n this.rank = outputShape.length;\n const dtype = getCoordsDataType(this.rank);\n const switched = getSwitchedCoords(newDim);\n\n this.userCode = `\n void main() {\n ${dtype} resRC = getOutputCoords();\n setOutput(getA(${switched}));\n }\n `;\n }\n}\n\nfunction getSwitchedCoords(newDim: number[]): string {\n const rank = newDim.length;\n if (rank > 6) {\n throw Error(`Transpose for rank ${rank} is not yet supported`);\n }\n const originalOrder =\n ['resRC.x', 'resRC.y', 'resRC.z', 'resRC.w', 'resRC.u', 'resRC.v'];\n const switchedCoords = new Array(rank);\n for (let i = 0; i < newDim.length; i++) {\n switchedCoords[newDim[i]] = originalOrder[i];\n }\n return switchedCoords.join();\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {getVecChannels} from './packing_util';\nimport {getCoordsDataType} from './shader_compiler';\n\nexport class TransposePackedProgram implements GPGPUProgram {\n variableNames = ['A'];\n outputShape: number[];\n userCode: string;\n rank: number;\n packedInputs = true;\n packedOutput = true;\n\n constructor(aShape: number[], newDim: number[]) {\n const outputShape: number[] = new Array(aShape.length);\n for (let i = 0; i < outputShape.length; i++) {\n outputShape[i] = aShape[newDim[i]];\n }\n this.outputShape = outputShape;\n this.rank = outputShape.length;\n if (this.rank > 6) {\n throw Error(\n `Packed transpose for rank ${this.rank} is not yet supported.`);\n }\n const dtype = getCoordsDataType(this.rank);\n\n const outputOrder = getVecChannels('rc', this.rank);\n const switchedOrder = new Array(this.rank);\n for (let i = 0; i < newDim.length; i++) {\n switchedOrder[newDim[i]] = outputOrder[i];\n }\n const innerDims = `vec2(${switchedOrder.slice(-2).join()})`;\n const nextColumn =\n `++${outputOrder[this.rank - 1]} < ${outputShape[this.rank - 1]}`;\n const getc = `getChannel(getA(${switchedOrder.join()}), ${innerDims})`;\n\n this.userCode = `\n void main() {\n ${dtype} rc = getOutputCoords();\n vec4 result = vec4(0.);\n result[0] = ${getc};\n if(${nextColumn}) {\n result[1] = ${getc};\n }\n --${outputOrder[this.rank - 1]};\n if(++${outputOrder[this.rank - 2]} < ${outputShape[this.rank - 2]}) {\n result[2] = ${getc};\n if(${nextColumn}) {\n result[3] = ${getc};\n }\n }\n setOutput(result);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {transposeImplCPU} from '../kernel_utils/shared';\nimport {TransposeProgram} from '../transpose_gpu';\nimport {TransposePackedProgram} from '../transpose_packed_gpu';\n\nexport function transposeImpl(\n x: TensorInfo, perm: number[], backend: MathBackendWebGL): TensorInfo {\n const program = env().getBool('WEBGL_PACK_ARRAY_OPERATIONS') ?\n new TransposePackedProgram(x.shape, perm) :\n new TransposeProgram(x.shape, perm);\n return backend.runWebGLProgram(program, [x], x.dtype);\n}\n\nexport {transposeImplCPU};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, sumOutType, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {reduce} from '../kernel_utils/reduce';\nimport {reshape} from './Reshape';\n\nimport {transposeImpl} from './Transpose_impl';\n\nexport function sumImpl(\n x: TensorInfo, axis: number|number[], keepDims: boolean,\n backend: MathBackendWebGL): TensorInfo {\n const reductionIndices = axis;\n\n const xRank = x.shape.length;\n\n const origAxes = util.parseAxisParam(reductionIndices, x.shape);\n let axes = origAxes;\n const permutedAxes = backend_util.getAxesPermutation(axes, xRank);\n const sumInputIsTransposed = permutedAxes != null;\n\n let sumInput = x;\n if (sumInputIsTransposed) {\n sumInput = transposeImpl(x, permutedAxes, backend);\n\n axes = backend_util.getInnerMostAxes(axes.length, xRank);\n }\n\n backend_util.assertAxesAreInnerMostDims('sum', axes, xRank);\n const [sumOutShape, reduceShape] =\n backend_util.computeOutAndReduceShapes(sumInput.shape, axes);\n\n let outShape = sumOutShape;\n if (keepDims) {\n // rather than reshape at the end, set the target shape here.\n outShape = backend_util.expandShapeToKeepDim(sumOutShape, origAxes);\n }\n\n const inSize = util.sizeFromShape(reduceShape);\n const xSize = util.sizeFromShape(x.shape);\n const batchSize = xSize / inSize;\n const reshapedInput = reshape(\n {inputs: {x: sumInput}, attrs: {shape: [batchSize, inSize]}, backend});\n\n const outType = sumOutType(x.dtype);\n\n const reduced = reduce(reshapedInput, outType, 'sum', backend);\n const out =\n reshape({inputs: {x: reduced}, attrs: {shape: outShape}, backend});\n\n backend.disposeIntermediateTensorInfo(reshapedInput);\n backend.disposeIntermediateTensorInfo(reduced);\n if (sumInputIsTransposed) {\n backend.disposeIntermediateTensorInfo(sumInput);\n }\n\n return out;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Sum, SumAttrs, SumInputs} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\n\nimport {sumImpl} from './Sum_impl';\n\nexport function sum(\n args: {inputs: SumInputs, attrs: SumAttrs, backend: MathBackendWebGL}) {\n const {inputs, backend, attrs} = args;\n\n const {x} = inputs;\n const {axis, keepDims} = attrs;\n\n return sumImpl(x, axis, keepDims, backend);\n}\n\nexport const sumConfig: KernelConfig = {\n kernelName: Sum,\n backendName: 'webgl',\n kernelFunc: sum as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, TensorInfo, Transpose, TransposeAttrs, TransposeInputs, TypedArray} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\n\nimport {transposeImpl} from './Transpose_impl';\nimport {transposeImplCPU as cpuTranspose} from './Transpose_impl';\n\nexport function transpose(args: {\n inputs: TransposeInputs,\n attrs: TransposeAttrs,\n backend: MathBackendWebGL\n}) {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {perm} = attrs;\n const webglBackend = backend;\n\n const xRank = x.shape.length;\n\n const newShape: number[] = new Array(xRank);\n for (let i = 0; i < newShape.length; i++) {\n newShape[i] = x.shape[perm[i]];\n }\n\n let out: TensorInfo;\n if (webglBackend.shouldExecuteOnCPU([x])) {\n const xTexData = webglBackend.texData.get(x.dataId);\n const values = xTexData.values as TypedArray;\n const outValues = cpuTranspose(values, x.shape, x.dtype, perm, newShape);\n\n out = webglBackend.makeTensorInfo(newShape, x.dtype);\n const outData = webglBackend.texData.get(out.dataId);\n outData.values = outValues;\n } else {\n out = transposeImpl(x, perm, webglBackend);\n }\n return out;\n}\n\nexport const transposeConfig: KernelConfig = {\n kernelName: Transpose,\n backendName: 'webgl',\n kernelFunc: transpose as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, broadcast_util, TensorInfo, upcastType, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {mapActivationToShaderProgram} from '../kernel_utils/kernel_funcs_utils';\nimport {MatMulPackedProgram} from '../mulmat_packed_gpu';\n\nimport {multiply} from './Multiply';\nimport {reshape} from './Reshape';\nimport {sum} from './Sum';\nimport {transpose} from './Transpose';\n\n// Empirically determined minimal shared dimension in matmul before we forward\n// to a.mul(b).sum() in order to take advantage of GPU parallelism. See\n// https://github.com/tensorflow/tfjs-core/pull/1379 for benchmarks.\nexport const MATMUL_SHARED_DIM_THRESHOLD = 1000;\n\ntype BatchMatMulConfig = {\n a: TensorInfo,\n b: TensorInfo,\n transposeA: boolean,\n transposeB: boolean,\n backend: MathBackendWebGL,\n bias?: TensorInfo,\n preluActivationWeights?: TensorInfo,\n leakyreluAlpha?: number,\n activation?: backend_util.Activation\n};\n\nexport function batchMatMulImpl({\n a,\n b,\n transposeA,\n transposeB,\n backend,\n bias = null,\n preluActivationWeights = null,\n leakyreluAlpha = 0,\n activation = null\n}: BatchMatMulConfig): TensorInfo {\n const aRank = a.shape.length;\n const bRank = b.shape.length;\n\n const innerShapeA = transposeA ? a.shape[aRank - 2] : a.shape[aRank - 1];\n const innerShapeB = transposeB ? b.shape[bRank - 1] : b.shape[bRank - 2];\n\n const outerShapeA = transposeA ? a.shape[aRank - 1] : a.shape[aRank - 2];\n const outerShapeB = transposeB ? b.shape[bRank - 2] : b.shape[bRank - 1];\n\n const outerDimsA = a.shape.slice(0, -2);\n const outerDimsB = b.shape.slice(0, -2);\n\n const batchDimA = util.sizeFromShape(outerDimsA);\n const batchDimB = util.sizeFromShape(outerDimsB);\n\n const outShapeOuterDims = broadcast_util.assertAndGetBroadcastShape(\n a.shape.slice(0, -2), b.shape.slice(0, -2));\n const outShape = outShapeOuterDims.concat([outerShapeA, outerShapeB]);\n\n util.assert(\n innerShapeA === innerShapeB,\n () => `Error in matMul: inner shapes (${innerShapeA}) and (` +\n `${innerShapeB}) of Tensors with shapes ${a.shape} and ` +\n `${b.shape} and transposeA=${transposeA}` +\n ` and transposeB=${transposeB} must match.`);\n\n const a3dShape: [number, number, number] = transposeA ?\n [batchDimA, innerShapeA, outerShapeA] :\n [batchDimA, outerShapeA, innerShapeA];\n const b3dShape: [number, number, number] = transposeB ?\n [batchDimB, outerShapeB, innerShapeB] :\n [batchDimB, innerShapeB, outerShapeB];\n\n // The rest of the implementation is designed to operate on rank-3 tensors\n const a3d = reshape({inputs: {x: a}, backend, attrs: {shape: a3dShape}});\n const b3d = reshape({inputs: {x: b}, backend, attrs: {shape: b3dShape}});\n\n const intermediates: TensorInfo[] = [a3d, b3d];\n\n const batchDim = Math.max(batchDimA, batchDimB);\n const sharedDim = transposeA ? a3d.shape[1] : a3d.shape[2];\n\n const hasBias = bias != null;\n const hasPreluActivationWeights = preluActivationWeights != null;\n const hasLeakyreluAlpha = activation === 'leakyrelu';\n const fusedActivation = activation != null ?\n mapActivationToShaderProgram(activation, true) :\n null;\n const containsFusedOps = hasBias || hasPreluActivationWeights ||\n hasLeakyreluAlpha || fusedActivation != null;\n let out: TensorInfo;\n\n // Since the matrices are vectors, it is faster to call mul().sum()\n // because sum() is O(sqrt(N)) due to divide-and-conquer.\n if ((outerShapeA === 1 || outerShapeB === 1) &&\n sharedDim > MATMUL_SHARED_DIM_THRESHOLD && containsFusedOps === false) {\n let aVec = a3d;\n let bVec = b3d;\n if (transposeA) {\n aVec = transpose({inputs: {x: a3d}, backend, attrs: {perm: [0, 2, 1]}});\n intermediates.push(aVec);\n }\n if (transposeB) {\n bVec = transpose({inputs: {x: b3d}, backend, attrs: {perm: [0, 2, 1]}});\n intermediates.push(bVec);\n }\n\n const shouldReshapeA = outerShapeB !== 1;\n const shouldReshapeB = outerShapeB === 1;\n\n let aVec3d = aVec;\n if (shouldReshapeA) {\n aVec3d = reshape({\n inputs: {x: aVec},\n backend,\n attrs: {shape: [batchDim, sharedDim, 1]}\n });\n\n intermediates.push(aVec3d);\n }\n\n const axis = outerShapeB === 1 ? 2 : 1;\n\n let bVec3d = bVec;\n if (shouldReshapeB) {\n bVec3d = reshape({\n inputs: {x: bVec},\n backend,\n attrs: {shape: [batchDim, 1, sharedDim]}\n });\n\n intermediates.push(bVec3d);\n }\n\n const product = multiply({inputs: {a: aVec3d, b: bVec3d}, backend});\n out = sum({inputs: {x: product}, backend, attrs: {axis, keepDims: true}});\n intermediates.push(product);\n } else {\n const dtype = upcastType(a.dtype, b.dtype);\n\n const program = new MatMulPackedProgram(\n a3dShape, b3dShape, [batchDim, outerShapeA, outerShapeB], transposeA,\n transposeB, hasBias, fusedActivation, hasPreluActivationWeights,\n hasLeakyreluAlpha);\n\n const inputs: TensorInfo[] = [a3d, b3d];\n if (bias != null) {\n inputs.push(bias);\n }\n if (hasPreluActivationWeights) {\n inputs.push(preluActivationWeights);\n }\n if (hasLeakyreluAlpha) {\n const $leakyreluAlpha = backend.makeTensorInfo(\n [], 'float32',\n util.createScalarValue(leakyreluAlpha as {} as 'float32', 'float32'));\n inputs.push($leakyreluAlpha);\n intermediates.push($leakyreluAlpha);\n }\n\n out = backend.runWebGLProgram(program, inputs, dtype);\n }\n\n const outReshaped =\n reshape({inputs: {x: out}, backend, attrs: {shape: outShape}});\n intermediates.push(out);\n for (const i of intermediates) {\n backend.disposeIntermediateTensorInfo(i);\n }\n return outReshaped;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the License);\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an AS IS BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {_FusedMatMul, _FusedMatMulAttrs, _FusedMatMulInputs, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {batchMatMulImpl} from './BatchMatMul_impl';\n\nexport function _fusedMatMul(args: {\n inputs: _FusedMatMulInputs,\n attrs: _FusedMatMulAttrs,\n backend: MathBackendWebGL\n}) {\n const {inputs, backend, attrs} = args;\n const {a, b, bias, preluActivationWeights} = inputs;\n const {transposeA, transposeB, activation, leakyreluAlpha} = attrs;\n\n return batchMatMulImpl({\n a,\n b,\n transposeA,\n transposeB,\n backend,\n bias,\n preluActivationWeights,\n leakyreluAlpha,\n activation\n });\n}\n\nexport const _fusedMatMulConfig: KernelConfig = {\n kernelName: _FusedMatMul,\n backendName: 'webgl',\n kernelFunc: _fusedMatMul as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Abs, AbsInputs, env, KernelConfig, KernelFunc, TensorInfo, TypedArray} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {simpleAbsImplCPU} from '../kernel_utils/shared';\nimport {UnaryOpProgram} from '../unaryop_gpu';\nimport {UnaryOpPackedProgram} from '../unaryop_packed_gpu';\n\nconst ABS = `return abs(x);`;\n\nexport function abs(args: {inputs: AbsInputs, backend: MathBackendWebGL}):\n TensorInfo {\n const {inputs, backend} = args;\n const {x} = inputs;\n\n // TODO: handle cases when x is complex. Once the cpu implementation\n // can handle complex values, refactor to use unaryKernelFunc.\n if (backend.shouldExecuteOnCPU([x]) && x.dtype !== 'complex64') {\n const xData = backend.texData.get(x.dataId);\n const outValues = simpleAbsImplCPU(xData.values as TypedArray);\n return backend.makeTensorInfo(x.shape, x.dtype, outValues);\n }\n\n let program: UnaryOpProgram|UnaryOpPackedProgram;\n if (env().getBool('WEBGL_PACK_UNARY_OPERATIONS')) {\n program = new UnaryOpPackedProgram(x.shape, ABS);\n } else {\n program = new UnaryOpProgram(x.shape, ABS);\n }\n return backend.runWebGLProgram(program, [x], x.dtype);\n}\n\nexport const absConfig: KernelConfig = {\n kernelName: Abs,\n backendName: 'webgl',\n kernelFunc: abs as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Acos, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {CHECK_NAN_SNIPPET} from '../unaryop_gpu';\n\nconst ACOS = CHECK_NAN_SNIPPET + `\n if (abs(x) > 1.) {\n return NAN;\n }\n return acos(x);\n`;\n\nexport const acos = unaryKernelFunc({opSnippet: ACOS});\n\nexport const acosConfig: KernelConfig = {\n kernelName: Acos,\n backendName: 'webgl',\n kernelFunc: acos,\n};\n","\n/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Acosh, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {CHECK_NAN_SNIPPET} from '../unaryop_gpu';\n\nconst ACOSH = CHECK_NAN_SNIPPET + `\n if (x < 1.0) return NAN;\nreturn log(x + sqrt(x * x - 1.0));`;\n\nexport const acosh = unaryKernelFunc({opSnippet: ACOSH});\n\nexport const acoshConfig: KernelConfig = {\n kernelName: Acosh,\n backendName: 'webgl',\n kernelFunc: acosh,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Add, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {addImplCPU as cpuAdd} from '../kernel_utils/shared';\n\nconst ADD = 'return a + b;';\n\nexport const addKernelFunc = binaryKernelFunc({\n opSnippet: ADD,\n packedOpSnippet: ADD,\n supportsComplex: true,\n cpuKernelImpl: cpuAdd\n});\n\nexport const addConfig: KernelConfig = {\n kernelName: Add,\n backendName: 'webgl',\n kernelFunc: addKernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class AddNProgram implements GPGPUProgram {\n variableNames: string[];\n outputShape: number[] = [];\n userCode: string;\n\n constructor(outputShape: number[], shapes: number[][]) {\n this.outputShape = outputShape;\n this.variableNames = shapes.map((_, i) => `T${i}`);\n\n const snippets: string[] = [];\n // Get target elements from every input tensor.\n this.variableNames.forEach(variable => {\n snippets.push(`float v${variable} = get${variable}AtOutCoords();`);\n });\n\n // Calculate the sum of all elements.\n const operation = this.variableNames\n .map(variable => {\n return `v${variable}`;\n })\n .join(' + ');\n\n this.userCode = `\n void main() {\n ${snippets.join('\\n ')}\n\n float result = ${operation};\n setOutput(result);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class AddNPackedProgram implements GPGPUProgram {\n variableNames: string[];\n outputShape: number[] = [];\n userCode: string;\n packedInputs = true;\n packedOutput = true;\n\n constructor(outputShape: number[], shapes: number[][]) {\n this.outputShape = outputShape;\n this.variableNames = shapes.map((_, i) => `T${i}`);\n\n const snippets: string[] = [];\n // Get target elements from every input tensor.\n this.variableNames.forEach(variable => {\n snippets.push(`vec4 v${variable} = get${variable}AtOutCoords();`);\n });\n\n // Calculate the sum of all elements.\n const operation = this.variableNames\n .map(variable => {\n return `v${variable}`;\n })\n .join(' + ');\n\n this.userCode = `\n void main() {\n ${snippets.join('\\n ')}\n\n vec4 result = ${operation};\n setOutput(result);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {AddN, AddNInputs, env, KernelConfig, KernelFunc, TensorInfo, upcastType} from '@tensorflow/tfjs-core';\n\nimport {AddNProgram} from '../addn_gpu';\nimport {AddNPackedProgram} from '../addn_packed_gpu';\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {identity} from './Identity';\n\nexport function addN(args: {inputs: AddNInputs, backend: MathBackendWebGL}):\n TensorInfo {\n const {inputs, backend} = args;\n\n const tensors = inputs;\n if (tensors.length === 1) {\n return identity({inputs: {x: tensors[0]}, backend});\n }\n\n // Limit the number of uploaded textures for optimization.\n if (tensors.length > env().get('WEBGL_MAX_TEXTURES_IN_SHADER')) {\n const midIndex = Math.floor(tensors.length / 2);\n const leftSide = addN({inputs: tensors.slice(0, midIndex), backend});\n const rightSide = addN({inputs: tensors.slice(midIndex), backend});\n return addN({inputs: [leftSide, rightSide], backend});\n }\n\n const dtype =\n tensors.map(t => t.dtype).reduce((d1, d2) => upcastType(d1, d2));\n const shapes = tensors.map(t => t.shape);\n // We can make sure shapes are identical in op level.\n const usePackedOp = env().getBool('WEBGL_PACK');\n const program = usePackedOp ?\n new AddNPackedProgram(tensors[0].shape, shapes) :\n new AddNProgram(tensors[0].shape, shapes);\n return backend.runWebGLProgram(program, tensors, dtype);\n}\n\nexport const addNConfig: KernelConfig = {\n kernelName: AddN,\n backendName: 'webgl',\n kernelFunc: addN as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {All, AllAttrs, AllInputs, backend_util, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {reduce} from '../kernel_utils/reduce';\n\nimport {reshape} from './Reshape';\nimport {transpose} from './Transpose';\n\nexport function all(\n args: {inputs: AllInputs, backend: MathBackendWebGL, attrs: AllAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {axis, keepDims} = attrs;\n\n const xRank = x.shape.length;\n\n const origAxes = util.parseAxisParam(axis, x.shape);\n let axes = origAxes;\n const permutedAxes = backend_util.getAxesPermutation(axes, xRank);\n let permutedX = x;\n if (permutedAxes != null) {\n permutedX = transpose({inputs: {x}, backend, attrs: {perm: permutedAxes}});\n axes = backend_util.getInnerMostAxes(axes.length, xRank);\n }\n\n backend_util.assertAxesAreInnerMostDims('all', axes, xRank);\n const [outShape, reduceShape] =\n backend_util.computeOutAndReduceShapes(permutedX.shape, axes);\n const inSize = util.sizeFromShape(reduceShape);\n\n const a2D =\n reshape({inputs: {x: permutedX}, backend, attrs: {shape: [-1, inSize]}});\n const reduced = reduce(a2D, a2D.dtype, 'all', backend);\n\n let res;\n if (keepDims) {\n const newShape = backend_util.expandShapeToKeepDim(outShape, origAxes);\n res = reshape({inputs: {x: reduced}, backend, attrs: {shape: newShape}});\n } else {\n res = reshape({inputs: {x: reduced}, backend, attrs: {shape: outShape}});\n }\n\n backend.disposeIntermediateTensorInfo(a2D);\n backend.disposeIntermediateTensorInfo(reduced);\n\n if (permutedAxes != null) {\n backend.disposeIntermediateTensorInfo(permutedX);\n }\n\n return res;\n}\n\nexport const allConfig: KernelConfig = {\n kernelName: All,\n backendName: 'webgl',\n kernelFunc: all as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Any, AnyAttrs, AnyInputs, backend_util, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {reduce} from '../kernel_utils/reduce';\nimport {reshape} from './Reshape';\nimport {transpose} from './Transpose';\n\nexport function any(\n args: {inputs: AnyInputs, backend: MathBackendWebGL, attrs: AnyAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {axis, keepDims} = attrs;\n\n const xRank = x.shape.length;\n\n const origAxes = util.parseAxisParam(axis, x.shape);\n let axes = origAxes;\n const permutedAxes = backend_util.getAxesPermutation(axes, xRank);\n let permutedX = x;\n if (permutedAxes != null) {\n permutedX = transpose({inputs: {x}, backend, attrs: {perm: permutedAxes}});\n axes = backend_util.getInnerMostAxes(axes.length, xRank);\n }\n\n backend_util.assertAxesAreInnerMostDims('any', axes, xRank);\n const [outShape, reduceShape] =\n backend_util.computeOutAndReduceShapes(permutedX.shape, axes);\n const inSize = util.sizeFromShape(reduceShape);\n\n const a2D =\n reshape({inputs: {x: permutedX}, backend, attrs: {shape: [-1, inSize]}});\n const reduced = reduce(a2D, a2D.dtype, 'any', backend);\n\n let res;\n if (keepDims) {\n const newShape = backend_util.expandShapeToKeepDim(outShape, origAxes);\n res = reshape({inputs: {x: reduced}, backend, attrs: {shape: newShape}});\n } else {\n res = reshape({inputs: {x: reduced}, backend, attrs: {shape: outShape}});\n }\n\n backend.disposeIntermediateTensorInfo(a2D);\n backend.disposeIntermediateTensorInfo(reduced);\n\n if (permutedAxes != null) {\n backend.disposeIntermediateTensorInfo(permutedX);\n }\n\n return res;\n}\n\nexport const anyConfig: KernelConfig = {\n kernelName: Any,\n backendName: 'webgl',\n kernelFunc: any as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class ArgMinMaxProgram implements GPGPUProgram {\n variableNames = ['A'];\n outputShape: number[];\n userCode: string;\n\n constructor(\n reduceInfo: backend_util.ReduceInfo, op: 'max'|'min',\n firstPass: boolean) {\n const {windowSize, batchSize, outSize} = reduceInfo;\n if (!firstPass) {\n this.variableNames.push('bestIndicesA');\n }\n this.outputShape = [batchSize, outSize];\n const compOp = (op === 'max') ? '>' : '<';\n const indexSnippet = firstPass ?\n 'inOffset + i;' :\n 'round(getBestIndicesA(batch, inOffset + i));';\n\n this.userCode = `\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int outIdx = coords[1];\n int inOffset = outIdx * ${windowSize};\n\n int bestIndex = inOffset;\n float bestValue = getA(batch, bestIndex);\n\n for (int i = 0; i < ${windowSize}; i++) {\n int inIdx = ${indexSnippet};\n float candidate = getA(batch, inIdx);\n if (candidate ${compOp} bestValue) {\n bestValue = candidate;\n bestIndex = inIdx;\n }\n }\n setOutput(float(bestIndex));\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {util} from '@tensorflow/tfjs-core';\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {getChannels} from './packing_util';\nimport {getCoordsDataType} from './shader_compiler';\n\nexport class ArgMinMaxPackedProgram implements GPGPUProgram {\n variableNames = ['A'];\n outputShape: number[];\n userCode: string;\n packedInputs = true;\n packedOutput = true;\n\n constructor(\n shape: number[], windowSize: number, op: 'max'|'min',\n firstPass: boolean) {\n util.assert(\n shape.length > 2,\n () => `Packed arg${\n op.charAt(0).toUpperCase() +\n op.slice(1)} supports only inputs with rank above 2.`);\n const inSize = shape[shape.length - 1];\n const outSize = Math.ceil(inSize / windowSize);\n this.outputShape = shape.slice(0, -1);\n if (outSize > 1) {\n this.outputShape.push(outSize);\n }\n if (!firstPass) {\n this.variableNames.push('bestIndicesA');\n }\n const outShape = this.outputShape;\n const rank = outShape.length;\n const dtype = getCoordsDataType(rank);\n const coords = getChannels('coords', rank);\n\n let sourceLocSetup;\n let sourceRank;\n if (outSize === 1) {\n sourceRank = rank + 1;\n const sourceLocDType = getCoordsDataType(sourceRank);\n sourceLocSetup = `\n ${sourceLocDType} sourceLocR = ${sourceLocDType}(${coords.join()}, 0);\n ++${coords[rank - 1]};\n ${sourceLocDType} sourceLocG = ${sourceLocDType}(${coords.join()}, 0);\n ++${coords[rank - 2]};\n ${sourceLocDType} sourceLocA = ${sourceLocDType}(${coords.join()}, 0);\n --${coords[rank - 1]};\n ${sourceLocDType} sourceLocB = ${sourceLocDType}(${coords.join()}, 0);\n --${coords[rank - 2]};`;\n } else {\n sourceRank = rank;\n sourceLocSetup = `\n ${dtype} sourceLocR = coords;\n ++${coords[rank - 1]};\n ${dtype} sourceLocG = coords;\n ++${coords[rank - 2]};\n ${dtype} sourceLocA = coords;\n --${coords[rank - 1]};\n ${dtype} sourceLocB = coords;\n --${coords[rank - 2]};`;\n }\n const channels = ['x', 'y', 'z', 'w', 'u', 'v'].slice(0, sourceRank);\n const inChannel = '.' + channels[sourceRank - 1]; // e.g. \".b\" for rank 3.\n const intChannels = channels.map(x => 'int ' + x);\n const srcRCoords =\n getChannels('sourceLocR', sourceRank - 1).concat('inIdx.r');\n const srcGCoords =\n getChannels('sourceLocG', sourceRank - 1).concat('inIdx.g');\n const srcBCoords =\n getChannels('sourceLocB', sourceRank - 1).concat('inIdx.b');\n const srcACoords =\n getChannels('sourceLocA', sourceRank - 1).concat('inIdx.a');\n\n const compOp = (op === 'max') ? 'greaterThan' : 'lessThan';\n const fetchCandidateIdx = firstPass ? '' : `\n inIdx = round(vec4(getBestIndicesAChannel(${srcRCoords.join()}),\n getBestIndicesAChannel(${srcGCoords.join()}),\n getBestIndicesAChannel(${srcBCoords.join()}),\n getBestIndicesAChannel(${srcACoords.join()})));`;\n\n const fetchValue = `vec4(\n getAChannel(${srcRCoords.join()}),\n hasNextCol ? getAChannel(${srcGCoords.join()}) : 0.,\n hasNextRow ? getAChannel(${srcBCoords.join()}) : 0.,\n hasNextRow && hasNextCol ? getAChannel(${srcACoords.join()}) : 0.)`;\n\n const getBestIndicesAChannelSnippet = firstPass ? '' : `\n float getBestIndicesAChannel(${intChannels.join()}) {\n return getChannel(getBestIndicesA(${channels.join()}),\n vec2(${channels.slice(-2).join()}));\n }`;\n\n this.userCode = `\n float getAChannel(${intChannels.join()}) {\n return getChannel(getA(${channels.join()}),\n vec2(${channels.slice(-2).join()}));\n }\n ${getBestIndicesAChannelSnippet}\n void main() {\n ${dtype} coords = getOutputCoords();\n bool hasNextCol = ${coords[rank - 1]} < ${outShape[rank - 1] - 1};\n bool hasNextRow = ${coords[rank - 2]} < ${outShape[rank - 2] - 1};\n ${sourceLocSetup}\n ivec4 srcIdx = ivec4(sourceLocR${inChannel}, sourceLocG${inChannel},\n sourceLocB${inChannel}, sourceLocA${inChannel}) * ${windowSize};\n ivec4 inIdx = srcIdx;\n vec4 bestIndex = vec4(inIdx);\n vec4 bestValue = ${fetchValue};\n\n for (int i = 0; i < ${windowSize}; i++) {\n inIdx = srcIdx;\n ${fetchCandidateIdx}\n vec4 candidate = ${fetchValue};\n bvec4 nan = isnan(candidate);\n bvec4 replace = bvec4(\n vec4(${compOp}(candidate, bestValue)) * (vec4(1.0) - vec4(nan)));\n\n bestValue = vec4(replace.x ? candidate.x : bestValue.x,\n replace.y ? candidate.y : bestValue.y,\n replace.z ? candidate.z : bestValue.z,\n replace.w ? candidate.w : bestValue.w);\n bestIndex = mix(bestIndex, vec4(inIdx), vec4(replace));\n srcIdx++;\n }\n setOutput(bestIndex);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, env, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {ArgMinMaxProgram} from '../argminmax_gpu';\nimport {ArgMinMaxPackedProgram} from '../argminmax_packed_gpu';\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {reshape} from '../kernels/Reshape';\n\nfunction argReduce(\n backend: MathBackendWebGL, x: TensorInfo, reduceType: 'max'|'min',\n bestIndicesA: TensorInfo = null): TensorInfo {\n let batchSize = x.shape[0];\n let inSize = x.shape[1];\n if (bestIndicesA != null) {\n batchSize = bestIndicesA.shape[0];\n inSize = bestIndicesA.shape[1];\n }\n const windowSize = backend_util.computeOptimalWindowSize(inSize);\n const reduceInfo =\n {windowSize, inSize, batchSize, outSize: Math.ceil(inSize / windowSize)};\n const program =\n new ArgMinMaxProgram(reduceInfo, reduceType, bestIndicesA == null);\n const inputs = [x];\n if (bestIndicesA != null) {\n inputs.push(bestIndicesA);\n }\n const output = backend.runWebGLProgram(program, inputs, 'int32');\n // No need to run another GPGPU program.\n if (output.shape[1] === 1) {\n return output;\n }\n const result = argReduce(backend, x, reduceType, output);\n backend.disposeIntermediateTensorInfo(output);\n return result;\n}\n\nfunction argReducePacked(\n backend: MathBackendWebGL, x: TensorInfo, reduceType: 'max'|'min',\n bestIndicesA: TensorInfo = null): TensorInfo {\n const inShape = bestIndicesA != null ? bestIndicesA.shape : x.shape;\n const inSize = inShape[inShape.length - 1];\n const windowSize = backend_util.computeOptimalWindowSize(inSize);\n const program = new ArgMinMaxPackedProgram(\n inShape, windowSize, reduceType, bestIndicesA == null);\n const inputs = bestIndicesA == null ? [x] : [x, bestIndicesA];\n const output = backend.runWebGLProgram(program, inputs, 'int32');\n if (output.shape.length === x.shape.length) {\n const result = argReducePacked(backend, x, reduceType, output);\n backend.disposeIntermediateTensorInfo(output);\n return result;\n }\n return output;\n}\n\nexport function argMinMaxReduce(\n backend: MathBackendWebGL, x: TensorInfo, axis: number,\n reduceType: 'min'|'max'): TensorInfo {\n const axes = [axis];\n backend_util.assertAxesAreInnerMostDims(\n 'arg' + reduceType.charAt(0).toUpperCase() + reduceType.slice(1), axes,\n x.shape.length);\n if (!env().getBool('WEBGL_PACK_REDUCE') || x.shape.length <= 2) {\n const intermediateTensorInfos = [];\n // Eagerly unpack x input since it is passed in to all the shaders which\n // require unpacked inputs.\n const xtexData = backend.texData.get(x.dataId);\n const xIsPacked = xtexData !== null && xtexData.isPacked;\n let xUnPacked = x;\n if (xIsPacked) {\n xUnPacked = backend.unpackTensor(x);\n intermediateTensorInfos.push(xUnPacked);\n }\n\n const [outShape, reduceShape] =\n backend_util.computeOutAndReduceShapes(xUnPacked.shape, axes);\n const inSize = util.sizeFromShape(reduceShape);\n const a2D = reshape(\n {inputs: {x: xUnPacked}, backend, attrs: {shape: [-1, inSize]}});\n intermediateTensorInfos.push(a2D);\n\n const reduced = argReduce(backend, a2D, reduceType);\n intermediateTensorInfos.push(reduced);\n const reshaped =\n reshape({inputs: {x: reduced}, backend, attrs: {shape: outShape}});\n\n intermediateTensorInfos.forEach(\n t => backend.disposeIntermediateTensorInfo(t));\n return reshaped;\n }\n return argReducePacked(backend, x, reduceType);\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ArgMax, ArgMaxAttrs, ArgMaxInputs, backend_util, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {argMinMaxReduce} from '../kernel_utils/arg_min_max';\n\nimport {transpose} from './Transpose';\n\nexport function argMax(\n args:\n {inputs: ArgMaxInputs, backend: MathBackendWebGL, attrs: ArgMaxAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {axis} = attrs;\n\n let axes = util.parseAxisParam(axis, x.shape);\n const permutedAxes = backend_util.getAxesPermutation(axes, x.shape.length);\n let $x = x;\n const intermediateTensorInfos = [];\n if (permutedAxes != null) {\n $x = transpose({inputs: {x}, backend, attrs: {perm: permutedAxes}});\n intermediateTensorInfos.push($x);\n axes = backend_util.getInnerMostAxes(axes.length, $x.shape.length);\n }\n\n backend_util.assertAxesAreInnerMostDims('argMax', [axes[0]], $x.shape.length);\n const out = argMinMaxReduce(backend, $x, axes[0], 'max');\n\n intermediateTensorInfos.forEach(\n t => backend.disposeIntermediateTensorInfo(t));\n return out;\n}\n\nexport const argMaxConfig: KernelConfig = {\n kernelName: ArgMax,\n backendName: 'webgl',\n kernelFunc: argMax as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ArgMin, ArgMinAttrs, ArgMinInputs, backend_util, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {argMinMaxReduce} from '../kernel_utils/arg_min_max';\nimport {transpose} from './Transpose';\n\nexport function argMin(\n args:\n {inputs: ArgMinInputs, backend: MathBackendWebGL, attrs: ArgMinAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {axis} = attrs;\n\n let axes = util.parseAxisParam(axis, x.shape);\n const permutedAxes = backend_util.getAxesPermutation(axes, x.shape.length);\n let $x = x;\n const intermediateTensorInfos = [];\n if (permutedAxes != null) {\n $x = transpose({inputs: {x}, backend, attrs: {perm: permutedAxes}});\n intermediateTensorInfos.push($x);\n axes = backend_util.getInnerMostAxes(axes.length, $x.shape.length);\n }\n\n backend_util.assertAxesAreInnerMostDims('argMin', [axes[0]], $x.shape.length);\n\n const out = argMinMaxReduce(backend, $x, axes[0], 'min');\n\n intermediateTensorInfos.forEach(\n t => backend.disposeIntermediateTensorInfo(t));\n return out;\n}\n\nexport const argMinConfig: KernelConfig = {\n kernelName: ArgMin,\n backendName: 'webgl',\n kernelFunc: argMin as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Asin, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {CHECK_NAN_SNIPPET} from '../unaryop_gpu';\n\nconst ASIN = CHECK_NAN_SNIPPET + `\n if (abs(x) > 1.) {\n return NAN;\n }\n return asin(x);\n`;\n\nexport const asin = unaryKernelFunc({opSnippet: ASIN});\n\nexport const asinConfig: KernelConfig = {\n kernelName: Asin,\n backendName: 'webgl',\n kernelFunc: asin,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Asinh, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {CHECK_NAN_SNIPPET} from '../unaryop_gpu';\n\nconst ASINH = CHECK_NAN_SNIPPET + `return log(x + sqrt(x * x + 1.0));`;\n\nexport const asinh = unaryKernelFunc({opSnippet: ASINH});\n\nexport const asinhConfig: KernelConfig = {\n kernelName: Asinh,\n backendName: 'webgl',\n kernelFunc: asinh,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Atan, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {CHECK_NAN_SNIPPET} from '../unaryop_gpu';\n\nconst ATAN = CHECK_NAN_SNIPPET + `\n return atan(x);\n`;\n\nexport const atan = unaryKernelFunc({opSnippet: ATAN});\n\nexport const atanConfig: KernelConfig = {\n kernelName: Atan,\n backendName: 'webgl',\n kernelFunc: atan,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Atan2} from '@tensorflow/tfjs-core';\nimport {KernelConfig} from '@tensorflow/tfjs-core';\nimport {CHECK_NAN_SNIPPET} from '../binaryop_gpu';\nimport {CHECK_NAN_SNIPPET_PACKED} from '../binaryop_packed_gpu';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst ATAN2 = CHECK_NAN_SNIPPET + `\n return atan(a, b);\n`;\n\nconst ATAN2_PACKED = `\n vec4 result = atan(a, b);\n bvec4 isNaNA = isnan(a);\n bvec4 isNaNB = isnan(b);\n bvec4 isNaN = bvec4(isNaNA.x || isNaNB.x, isNaNA.y || isNaNB.y, isNaNA.z || isNaNB.z, isNaNA.w || isNaNB.w);\n ` +\n CHECK_NAN_SNIPPET_PACKED + `\n return result;\n`;\n\nexport const atan2 =\n binaryKernelFunc({opSnippet: ATAN2, packedOpSnippet: ATAN2_PACKED});\n\nexport const atan2Config: KernelConfig = {\n kernelName: Atan2,\n backendName: 'webgl',\n kernelFunc: atan2,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Atanh, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {CHECK_NAN_SNIPPET} from '../unaryop_gpu';\n\nconst ATANH = CHECK_NAN_SNIPPET + `\n if ((x < -1.0) || (x > 1.0)) return NAN;\nreturn (log(1.0 + x) - log(1.0 - x)) / 2.0;`;\n\nexport const atanh = unaryKernelFunc({opSnippet: ATANH});\n\nexport const atanhConfig: KernelConfig = {\n kernelName: Atanh,\n backendName: 'webgl',\n kernelFunc: atanh,\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class Pool2DProgram implements GPGPUProgram {\n variableNames = ['x'];\n outputShape: number[];\n userCode: string;\n\n constructor(\n convInfo: backend_util.Conv2DInfo, poolType: 'max'|'avg',\n computePositions: boolean, flattenPositions = false,\n includeBatchInIndex = false) {\n if (poolType === 'avg' && computePositions) {\n throw new Error('Cannot compute positions for average pool.');\n }\n\n const filterWidth = convInfo.filterWidth;\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n const dilationHeight = convInfo.dilationHeight;\n const dilationWidth = convInfo.dilationWidth;\n const effectiveFilterHeight = convInfo.effectiveFilterHeight;\n const effectiveFilterWidth = convInfo.effectiveFilterWidth;\n\n const padTop = convInfo.padInfo.top;\n const padLeft = convInfo.padInfo.left;\n this.outputShape = convInfo.outShape;\n\n const isAvgPool = poolType === 'avg';\n const batchFlattenPositionStr = `((batch * ${convInfo.inHeight} + xR) * ${\n convInfo.inWidth} + xC) * ${convInfo.inChannels} + d`;\n const flattenPositionStr =\n `(xR * ${convInfo.inWidth} + xC) * ${convInfo.inChannels} + d`;\n\n let initializationValue = '0.0';\n if (!isAvgPool) {\n // WebGL on Firefox Linux can't compile 1/0 so we do 1/eps.\n initializationValue = '-1.0 / 1e-20';\n }\n\n if (computePositions) {\n const compareOp = '>=';\n\n this.userCode = `\n const ivec2 strides = ivec2(${strideHeight}, ${strideWidth});\n const ivec2 pads = ivec2(${padTop}, ${padLeft});\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d = coords[3];\n\n ivec2 xRCCorner = coords.yz * strides - pads;\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n // max/min x(?, ?, d) to get y(yR, yC, d).\n // ? = to be determined\n float minMaxValue = 0.0;\n float minMaxValueFound = 0.0;\n int minMaxPosition = 0;\n float avgValue = 0.0;\n\n for (int wR = 0; wR < ${effectiveFilterHeight};\n wR += ${dilationHeight}) {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= ${convInfo.inHeight}) {\n continue;\n }\n\n for (int wC = 0; wC < ${effectiveFilterWidth};\n wC += ${dilationWidth}) {\n int xC = xCCorner + wC;\n\n if (xC < 0 || xC >= ${convInfo.inWidth}) {\n continue;\n }\n\n float value = getX(batch, xR, xC, d);\n\n // If a min / max value has already been found, use it. If not,\n // use the current value.\n float currMinMaxValue = mix(\n value, minMaxValue, minMaxValueFound);\n if (value ${compareOp} currMinMaxValue) {\n minMaxValue = value;\n minMaxValueFound = 1.0;\n minMaxPosition = ${\n flattenPositions ? (includeBatchInIndex ? batchFlattenPositionStr :\n flattenPositionStr) :\n `wR * ${effectiveFilterWidth} + wC`};\n }\n }\n }\n setOutput(float(minMaxPosition));\n }\n `;\n return;\n }\n\n const compareOp = 'max';\n\n let returnValue = `${poolType}(${poolType}(${poolType}(` +\n 'minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])';\n if (poolType === 'avg') {\n returnValue = `avgValue / count`;\n }\n\n const filterWidthNearestVec4 = Math.floor(filterWidth / 4) * 4;\n const filterWidthVec4Remainder = filterWidth % 4;\n\n const updateSnippet = `\n if (${isAvgPool}) {\n avgValue += dot(values, ones);\n } else {\n minMaxValue = ${compareOp}(values, minMaxValue);\n }\n `;\n\n this.userCode = `\n const ivec2 strides = ivec2(${strideHeight}, ${strideWidth});\n const ivec2 pads = ivec2(${padTop}, ${padLeft});\n const float initializationValue = ${initializationValue};\n const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n float count = 0.0;\n\n float getValue(int batch, int xR, int xC, int d) {\n if (xC < 0 || xC >= ${convInfo.inWidth}) {\n return initializationValue;\n }\n count += 1.0;\n return getX(batch, xR, xC, d);\n }\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d = coords[3];\n\n ivec2 xRCCorner = coords.yz * strides - pads;\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n // max/min x(?, ?, d) to get y(yR, yC, d).\n // ? = to be determined\n vec4 minMaxValue = vec4(${initializationValue});\n float avgValue = 0.0;\n count = 0.0;\n\n for (int wR = 0; wR < ${effectiveFilterHeight};\n wR += ${dilationHeight}) {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= ${convInfo.inHeight}) {\n continue;\n }\n\n for (int wC = 0; wC < ${filterWidthNearestVec4}; wC += 4) {\n int xC = xCCorner + wC * ${dilationWidth};\n\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + ${dilationWidth}, d),\n getValue(batch, xR, xC + 2 * ${dilationWidth}, d),\n getValue(batch, xR, xC + 3 * ${dilationWidth}, d)\n );\n\n ${updateSnippet}\n }\n\n int xC = xCCorner + ${filterWidthNearestVec4};\n if (${filterWidthVec4Remainder === 1}) {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n ${updateSnippet}\n } else if (${filterWidthVec4Remainder === 2}) {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + ${dilationWidth}, d),\n initializationValue,\n initializationValue\n );\n\n ${updateSnippet}\n } else if (${filterWidthVec4Remainder === 3}) {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + ${dilationWidth}, d),\n getValue(batch, xR, xC + 2 * ${dilationWidth}, d),\n initializationValue\n );\n\n ${updateSnippet}\n }\n }\n setOutput(${returnValue});\n }\n `;\n }\n}\n\nexport class Pool3DProgram implements GPGPUProgram {\n variableNames = ['x'];\n outputShape: number[];\n userCode: string;\n\n constructor(\n convInfo: backend_util.Conv3DInfo, poolType: 'max'|'avg',\n computePositions: boolean, flattenPositions = false,\n includeBatchInIndex = false) {\n if (poolType === 'avg' && computePositions) {\n throw new Error('Cannot compute positions for average pool.');\n }\n\n const filterWidth = convInfo.filterWidth;\n const strideDepth = convInfo.strideDepth;\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n const dilationDepth = convInfo.dilationDepth;\n const dilationHeight = convInfo.dilationHeight;\n const dilationWidth = convInfo.dilationWidth;\n const effectiveFilterDepth = convInfo.effectiveFilterDepth;\n const effectiveFilterHeight = convInfo.effectiveFilterHeight;\n const effectiveFilterWidth = convInfo.effectiveFilterWidth;\n\n const padFront = convInfo.padInfo.front;\n const padTop = convInfo.padInfo.top;\n const padLeft = convInfo.padInfo.left;\n this.outputShape = convInfo.outShape;\n\n const isAvgPool = poolType === 'avg';\n\n let initializationValue = '0.0';\n if (!isAvgPool) {\n // WebGL on Firefox Linux can't compile 1/0 so we do 1/eps.\n initializationValue = '-1.0 / 1e-20';\n }\n\n if (computePositions) {\n const compareOp = '>=';\n\n this.userCode = `\n const ivec3 strides =\n ivec3(${strideDepth}, ${strideHeight}, ${strideWidth});\n const ivec3 pads = ivec3(${padFront}, ${padTop}, ${padLeft});\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int ch = coords.u;\n\n ivec3 xCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;\n int xDCorner = xCorner.x;\n int xRCorner = xCorner.y;\n int xCCorner = xCorner.z;\n\n // max/min x(?, ?, ?, ch) to get y(yD, yR, yC, ch).\n // ? = to be determined\n float minMaxValue = 0.0;\n float minMaxValueFound = 0.0;\n int minMaxPosition = 0;\n\n for (int wD = 0; wD < ${effectiveFilterDepth};\n wD += ${dilationDepth}) {\n int xD = xDCorner + wD;\n\n if (xD < 0 || xD >= ${convInfo.inDepth}) {\n continue;\n }\n\n for (int wR = 0; wR < ${effectiveFilterHeight};\n wR += ${dilationHeight}) {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= ${convInfo.inHeight}) {\n continue;\n }\n\n for (int wC = 0; wC < ${effectiveFilterWidth};\n wC += ${dilationWidth}) {\n int xC = xCCorner + wC;\n\n if (xC < 0 || xC >= ${convInfo.inWidth}) {\n continue;\n }\n\n float value = getX(batch, xD, xR, xC, ch);\n\n // If a min / max value has already been found, use it. If not,\n // use the current value.\n float currMinMaxValue = mix(\n value, minMaxValue, minMaxValueFound);\n if (value ${compareOp} currMinMaxValue) {\n minMaxValue = value;\n minMaxValueFound = 1.0;\n minMaxPosition = ${\n flattenPositions ?\n (includeBatchInIndex ?\n `(((batch * ${convInfo.inDepth} + xD) * ${\n convInfo.inHeight} + xR) * ${convInfo.inWidth} + xC) * ${\n convInfo.inChannels} + ch` :\n `((xD * ${convInfo.inHeight} + xR) * ${\n convInfo.inWidth} + xC) * ${convInfo.inChannels} + ch`) :\n `wD * ${effectiveFilterHeight} * ${effectiveFilterWidth} +\n wR * ${effectiveFilterWidth} + wC`};\n }\n }\n }\n }\n setOutput(float(minMaxPosition));\n }\n `;\n return;\n }\n\n const compareOp = 'max';\n\n let returnValue = `${poolType}(${poolType}(${poolType}(` +\n 'minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])';\n if (poolType === 'avg') {\n returnValue = `avgValue / count`;\n }\n\n const filterWidthNearestVec4 = Math.floor(filterWidth / 4) * 4;\n const filterWidthVec4Remainder = filterWidth % 4;\n\n const updateSnippet = `\n if (${isAvgPool}) {\n avgValue += dot(values, ones);\n } else {\n minMaxValue = ${compareOp}(values, minMaxValue);\n }\n `;\n\n this.userCode = `\n const ivec3 strides =\n ivec3(${strideDepth}, ${strideHeight}, ${strideWidth});\n const ivec3 pads = ivec3(${padFront}, ${padTop}, ${padLeft});\n const float initializationValue = ${initializationValue};\n const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n float count = 0.0;\n\n float getValue(int batch, int xD, int xR, int xC, int ch) {\n if (xC < 0 || xC >= ${convInfo.inWidth}) {\n return initializationValue;\n }\n count += 1.0;\n return getX(batch, xD, xR, xC, ch);\n }\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int ch = coords.u;\n\n ivec3 xCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;\n int xDCorner = xCorner.x;\n int xRCorner = xCorner.y;\n int xCCorner = xCorner.z;\n\n // max/min x(?, ?, ?, d) to get y(yD, yR, yC, ch).\n // ? = to be determined\n vec4 minMaxValue = vec4(${initializationValue});\n float avgValue = 0.0;\n count = 0.0;\n\n for (int wD = 0; wD < ${effectiveFilterDepth};\n wD += ${dilationDepth}) {\n int xD = xDCorner + wD;\n\n if (xD < 0 || xD >= ${convInfo.inDepth}) {\n continue;\n }\n\n for (int wR = 0; wR < ${effectiveFilterHeight};\n wR += ${dilationHeight}) {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= ${convInfo.inHeight}) {\n continue;\n }\n\n for (int wC = 0; wC < ${filterWidthNearestVec4}; wC += 4) {\n int xC = xCCorner + wC * ${dilationWidth};\n\n vec4 values = vec4(\n getValue(batch, xD, xR, xC, ch),\n getValue(batch, xD, xR, xC + ${dilationWidth}, ch),\n getValue(batch, xD, xR, xC + 2 * ${dilationWidth}, ch),\n getValue(batch, xD, xR, xC + 3 * ${dilationWidth}, ch)\n );\n\n ${updateSnippet}\n }\n\n int xC = xCCorner + ${filterWidthNearestVec4};\n if (${filterWidthVec4Remainder === 1}) {\n vec4 values = vec4(\n getValue(batch, xD, xR, xC, ch),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n ${updateSnippet}\n } else if (${filterWidthVec4Remainder === 2}) {\n vec4 values = vec4(\n getValue(batch, xD, xR, xC, ch),\n getValue(batch, xD, xR, xC + ${dilationWidth}, ch),\n initializationValue,\n initializationValue\n );\n\n ${updateSnippet}\n } else if (${filterWidthVec4Remainder === 3}) {\n vec4 values = vec4(\n getValue(batch, xD, xR, xC, ch),\n getValue(batch, xD, xR, xC + ${dilationWidth}, ch),\n getValue(batch, xD, xR, xC + 2 * ${dilationWidth}, ch),\n initializationValue\n );\n\n ${updateSnippet}\n }\n }\n setOutput(${returnValue});\n }\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {AvgPool, AvgPoolAttrs, AvgPoolInputs, backend_util, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {Pool2DProgram} from '../pool_gpu';\nimport {assertNotComplex} from '../webgl_util';\nimport {identity} from './Identity';\n\nexport function avgPool(args: {\n inputs: AvgPoolInputs,\n backend: MathBackendWebGL,\n attrs: AvgPoolAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n assertNotComplex(x, 'avgPool');\n const {filterSize, strides, pad, dimRoundingMode} = attrs;\n const dilations = 1;\n\n util.assert(\n backend_util.eitherStridesOrDilationsAreOne(strides, dilations),\n () => 'Error in avgPool: Either strides or dilations must be 1. ' +\n `Got strides ${strides} and dilations '${dilations}'`);\n\n const convInfo = backend_util.computePool2DInfo(\n x.shape as [number, number, number, number], filterSize, strides,\n dilations, pad, dimRoundingMode);\n if (convInfo.filterWidth === 1 && convInfo.filterHeight === 1 &&\n util.arraysEqual(convInfo.inShape, convInfo.outShape)) {\n return identity({inputs: {x}, backend});\n }\n const avgPoolProgram = new Pool2DProgram(convInfo, 'avg', false);\n return backend.runWebGLProgram(avgPoolProgram, [x], 'float32');\n}\n\nexport const avgPoolConfig: KernelConfig = {\n kernelName: AvgPool,\n backendName: 'webgl',\n kernelFunc: avgPool as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {AvgPool3D, AvgPool3DAttrs, AvgPool3DInputs, backend_util, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {Pool3DProgram} from '../pool_gpu';\n\nexport function avgPool3D(args: {\n inputs: AvgPool3DInputs,\n backend: MathBackendWebGL,\n attrs: AvgPool3DAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {filterSize, strides, pad, dimRoundingMode, dataFormat} = attrs;\n const dilations: [number, number, number] = [1, 1, 1];\n\n const convInfo = backend_util.computePool3DInfo(\n x.shape as [number, number, number, number, number], filterSize, strides,\n dilations, pad, dimRoundingMode, dataFormat);\n const avgPoolProgram = new Pool3DProgram(convInfo, 'avg', false);\n return backend.runWebGLProgram(avgPoolProgram, [x], 'float32');\n}\n\nexport const avgPool3DConfig: KernelConfig = {\n kernelName: AvgPool3D,\n backendName: 'webgl',\n kernelFunc: avgPool3D as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class AvgPool2DBackpropProgram implements GPGPUProgram {\n variableNames = ['dy'];\n outputShape: number[];\n userCode: string;\n\n constructor(convInfo: backend_util.Conv2DInfo) {\n this.outputShape = convInfo.inShape;\n const filterHeight = convInfo.filterHeight;\n const filterWidth = convInfo.filterWidth;\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n const dilationHeight = convInfo.dilationHeight;\n const dilationWidth = convInfo.dilationWidth;\n const effectiveFilterHeight = convInfo.effectiveFilterHeight;\n const effectiveFilterWidth = convInfo.effectiveFilterWidth;\n\n const padTop = effectiveFilterHeight - 1 - convInfo.padInfo.top;\n const padLeft = effectiveFilterWidth - 1 - convInfo.padInfo.left;\n\n const avgMultiplier = 1 / (filterHeight * filterWidth);\n\n this.userCode = `\n const ivec2 pads = ivec2(${padTop}, ${padLeft});\n const float avgMultiplier = float(${avgMultiplier});\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n\n ivec2 dyRCCorner = coords.yz - pads;\n int dyRCorner = dyRCCorner.x;\n int dyCCorner = dyRCCorner.y;\n\n // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < ${effectiveFilterHeight};\n wR += ${dilationHeight}) {\n float dyR = float(dyRCorner + wR) / ${strideHeight}.0;\n\n if (dyR < 0.0 || dyR >= ${convInfo.outHeight}.0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < ${effectiveFilterWidth};\n wC+= ${dilationWidth}) {\n float dyC = float(dyCCorner + wC) / ${strideWidth}.0;\n\n if (dyC < 0.0 || dyC >= ${convInfo.outWidth}.0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(b, idyR, idyC, d);\n\n dotProd += dyValue * avgMultiplier;\n }\n }\n setOutput(dotProd);\n }\n `;\n }\n}\n\nexport class AvgPool3DBackpropProgram implements GPGPUProgram {\n variableNames = ['dy'];\n outputShape: number[];\n userCode: string;\n\n constructor(convInfo: backend_util.Conv3DInfo) {\n this.outputShape = convInfo.inShape;\n const filterDepth = convInfo.filterDepth;\n const filterHeight = convInfo.filterHeight;\n const filterWidth = convInfo.filterWidth;\n const strideDepth = convInfo.strideDepth;\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n const dilationDepth = convInfo.dilationDepth;\n const dilationHeight = convInfo.dilationHeight;\n const dilationWidth = convInfo.dilationWidth;\n const effectiveFilterDepth = convInfo.effectiveFilterDepth;\n const effectiveFilterHeight = convInfo.effectiveFilterHeight;\n const effectiveFilterWidth = convInfo.effectiveFilterWidth;\n\n const padFront = effectiveFilterDepth - 1 - convInfo.padInfo.front;\n const padTop = effectiveFilterHeight - 1 - convInfo.padInfo.top;\n const padLeft = effectiveFilterWidth - 1 - convInfo.padInfo.left;\n\n const avgMultiplier = 1 / (filterDepth * filterHeight * filterWidth);\n\n this.userCode = `\n const ivec3 pads = ivec3(${padFront}, ${padTop}, ${padLeft});\n const float avgMultiplier = float(${avgMultiplier});\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int ch = coords.u;\n\n ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;\n int dyDCorner = dyCorner.x;\n int dyRCorner = dyCorner.y;\n int dyCCorner = dyCorner.z;\n\n // Convolve dy(?, ?, ?, d) with pos mask(:, :, :, ch) to get\n // dx(xD, xR, xC, ch).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n\n for (int wD = 0; wD < ${effectiveFilterDepth};\n wD += ${dilationDepth}) {\n float dyD = float(dyDCorner + wD) / ${strideDepth}.0;\n\n if (dyD < 0.0 || dyD >= ${convInfo.outDepth}.0 || fract(dyD) > 0.0) {\n continue;\n }\n int idyD = int(dyD);\n\n for (int wR = 0; wR < ${effectiveFilterHeight};\n wR += ${dilationHeight}) {\n float dyR = float(dyRCorner + wR) / ${strideHeight}.0;\n\n if (dyR < 0.0 || dyR >= ${convInfo.outHeight}.0 ||\n fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < ${effectiveFilterWidth};\n wC += ${dilationWidth}) {\n float dyC = float(dyCCorner + wC) / ${strideWidth}.0;\n\n if (dyC < 0.0 || dyC >= ${convInfo.outWidth}.0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(batch, idyD, idyR, idyC, ch);\n\n dotProd += dyValue * avgMultiplier;\n }\n }\n }\n setOutput(dotProd);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {AvgPool3DGrad, AvgPool3DGradAttrs, AvgPool3DGradInputs, backend_util, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {AvgPool3DBackpropProgram} from '../avg_pool_backprop_gpu';\nimport {MathBackendWebGL} from '../backend_webgl';\n\nexport function avgPool3DGrad(args: {\n inputs: AvgPool3DGradInputs,\n backend: MathBackendWebGL,\n attrs: AvgPool3DGradAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {dy, input} = inputs;\n const x = input;\n const {filterSize, strides, pad, dimRoundingMode} = attrs;\n const dilations: [number, number, number] = [1, 1, 1];\n\n const convInfo = backend_util.computePool3DInfo(\n x.shape as [number, number, number, number, number], filterSize, strides,\n dilations, pad, dimRoundingMode);\n const avgPoolBackpropProgram = new AvgPool3DBackpropProgram(convInfo);\n return backend.runWebGLProgram(avgPoolBackpropProgram, [dy], x.dtype);\n}\n\nexport const avgPool3DGradConfig: KernelConfig = {\n kernelName: AvgPool3DGrad,\n backendName: 'webgl',\n kernelFunc: avgPool3DGrad as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {AvgPoolGrad, AvgPoolGradAttrs, AvgPoolGradInputs, backend_util, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {AvgPool2DBackpropProgram} from '../avg_pool_backprop_gpu';\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {assertNotComplex} from '../webgl_util';\n\nexport function avgPoolGrad(args: {\n inputs: AvgPoolGradInputs,\n backend: MathBackendWebGL,\n attrs: AvgPoolGradAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {dy, input} = inputs;\n const x = input;\n assertNotComplex([dy, input], 'avgPoolGrad');\n const {filterSize, strides, pad} = attrs;\n\n const convInfo = backend_util.computePool2DInfo(\n x.shape as [number, number, number, number], filterSize, strides,\n 1 /* dilations */, pad);\n const avgPoolBackpropProgram = new AvgPool2DBackpropProgram(convInfo);\n return backend.runWebGLProgram(avgPoolBackpropProgram, [dy], x.dtype);\n}\n\nexport const avgPoolGradConfig: KernelConfig = {\n kernelName: AvgPoolGrad,\n backendName: 'webgl',\n kernelFunc: avgPoolGrad as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {BatchMatMul, BatchMatMulAttrs, BatchMatMulInputs, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {batchMatMulImpl} from './BatchMatMul_impl';\n\nexport function batchMatMul(args: {\n inputs: BatchMatMulInputs,\n attrs: BatchMatMulAttrs,\n backend: MathBackendWebGL\n}) {\n const {inputs, backend, attrs} = args;\n const {a, b} = inputs;\n const {transposeA, transposeB} = attrs;\n\n return batchMatMulImpl({a, b, transposeA, transposeB, backend});\n}\n\nexport const batchMatMulConfig: KernelConfig = {\n kernelName: BatchMatMul,\n backendName: 'webgl',\n kernelFunc: batchMatMul as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class BatchNormProgram implements GPGPUProgram {\n variableNames: string[];\n outputShape: number[] = [];\n userCode: string;\n\n constructor(\n xShape: number[], meanShape: number[], varianceShape: number[],\n offsetShape: number[]|null, scaleShape: number[]|null,\n varianceEpsilon: number) {\n this.variableNames = ['x', 'mean', 'variance'];\n backend_util.assertAndGetBroadcastShape(xShape, meanShape);\n backend_util.assertAndGetBroadcastShape(xShape, varianceShape);\n\n let offsetSnippet = '0.0';\n if (offsetShape != null) {\n backend_util.assertAndGetBroadcastShape(xShape, offsetShape);\n this.variableNames.push('offset');\n offsetSnippet = 'getOffsetAtOutCoords()';\n }\n\n let scaleSnippet = '1.0';\n if (scaleShape != null) {\n backend_util.assertAndGetBroadcastShape(xShape, scaleShape);\n this.variableNames.push('scale');\n scaleSnippet = 'getScaleAtOutCoords()';\n }\n\n this.outputShape = xShape;\n this.userCode = `\n void main() {\n float x = getXAtOutCoords();\n float mean = getMeanAtOutCoords();\n float variance = getVarianceAtOutCoords();\n float offset = ${offsetSnippet};\n float scale = ${scaleSnippet};\n float inv = scale * inversesqrt(variance + float(${varianceEpsilon}));\n setOutput(dot(vec3(x, -mean, offset), vec3(inv, inv, 1)));\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class BatchNormPackedProgram implements GPGPUProgram {\n variableNames: string[];\n outputShape: number[];\n userCode: string;\n packedInputs = true;\n packedOutput = true;\n\n constructor(\n xShape: number[], meanShape: number[], varianceShape: number[],\n offsetShape: number[]|null, scaleShape: number[]|null,\n varianceEpsilon: number) {\n this.variableNames = ['x', 'mean', 'variance'];\n backend_util.assertAndGetBroadcastShape(xShape, meanShape);\n backend_util.assertAndGetBroadcastShape(xShape, varianceShape);\n\n let offsetSnippet = 'vec4(0.0)';\n if (offsetShape != null) {\n backend_util.assertAndGetBroadcastShape(xShape, offsetShape);\n this.variableNames.push('offset');\n offsetSnippet = 'getOffsetAtOutCoords()';\n }\n\n let scaleSnippet = 'vec4(1.0)';\n if (scaleShape != null) {\n backend_util.assertAndGetBroadcastShape(xShape, scaleShape);\n this.variableNames.push('scale');\n scaleSnippet = 'getScaleAtOutCoords()';\n }\n\n this.outputShape = xShape;\n this.userCode = `\n void main() {\n vec4 offset = ${offsetSnippet};\n vec4 scale = ${scaleSnippet};\n\n vec4 x = getXAtOutCoords();\n vec4 mean = getMeanAtOutCoords();\n vec4 variance = getVarianceAtOutCoords();\n\n vec4 inv = scale * inversesqrt(variance + vec4(${varianceEpsilon}));\n\n setOutput((x - mean) * inv + offset);\n }\n `;\n }\n}\n","\n/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env, FusedBatchNorm, FusedBatchNormAttrs, FusedBatchNormInputs, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {BatchNormProgram} from '../batchnorm_gpu';\nimport {BatchNormPackedProgram} from '../batchnorm_packed_gpu';\n\nexport const batchNorm: (params: {\n inputs: FusedBatchNormInputs,\n backend: MathBackendWebGL,\n attrs: FusedBatchNormAttrs\n}) => TensorInfo = ({inputs, backend, attrs}) => {\n const {x, mean, variance, offset, scale} = inputs;\n\n util.assert(\n mean.shape.length === variance.shape.length,\n () => 'Batch normalization gradient requires mean and variance to have ' +\n 'equal ranks.');\n util.assert(\n offset == null || mean.shape.length === offset.shape.length,\n () => 'Batch normalization gradient requires mean and offset to have ' +\n 'equal ranks.');\n util.assert(\n scale == null || mean.shape.length === scale.shape.length,\n () => 'Batch normalization gradient requires mean and scale to have ' +\n 'equal ranks.');\n\n let {varianceEpsilon} = attrs;\n if (varianceEpsilon == null) {\n varianceEpsilon = 0.001;\n }\n\n const finalInputs = [x, mean, variance];\n\n let offsetShape = null;\n if (offset != null) {\n offsetShape = offset.shape;\n finalInputs.push(offset);\n }\n\n let scaleShape = null;\n if (scale != null) {\n scaleShape = scale.shape;\n finalInputs.push(scale);\n }\n\n const program = env().getBool('WEBGL_PACK_NORMALIZATION') ?\n new BatchNormPackedProgram(\n x.shape, mean.shape, variance.shape, offsetShape, scaleShape,\n varianceEpsilon) :\n new BatchNormProgram(\n x.shape, mean.shape, variance.shape, offsetShape, scaleShape,\n varianceEpsilon);\n const output =\n backend.runWebGLProgram(program, finalInputs, finalInputs[0].dtype);\n\n return output;\n};\n\nexport const batchNormConfig: KernelConfig = {\n kernelName: FusedBatchNorm,\n backendName: 'webgl',\n kernelFunc: batchNorm as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {getCoordsDataType, UniformType} from './shader_compiler';\n\nexport class SliceProgram implements GPGPUProgram {\n variableNames = ['source'];\n outputShape: number[];\n userCode: string;\n rank: number;\n customUniforms: Array<{name: string; arrayIndex: number; type: UniformType;}>;\n\n constructor(destSize: number[]) {\n this.outputShape = destSize;\n this.rank = destSize.length;\n\n const dtype = getCoordsDataType(this.rank);\n this.customUniforms = [{name: 'start', arrayIndex: this.rank, type: 'int'}];\n const sourceCoords = getCoords(this.rank);\n\n let body: string;\n const coordSum = destSize.map((_, i) => {\n return `sourceLoc.${coords[i]} = start[${i}] + coords.${coords[i]};`;\n });\n body = `\n ${dtype} sourceLoc;\n ${dtype} coords = getOutputCoords();\n ${coordSum.join('\\n')}\n `;\n this.userCode = `\n void main() {\n ${body}\n setOutput(getSource(${sourceCoords}));\n }\n `;\n }\n}\n\nconst coords = ['x', 'y', 'z', 'w', 'u', 'v'];\n\nfunction getCoords(rank: number): string {\n if (rank === 1) {\n return 'sourceLoc';\n } else if (rank <= 6) {\n return coords.slice(0, rank).map(x => 'sourceLoc.' + x).join(',');\n } else {\n throw Error(`Slicing for rank ${rank} is not yet supported`);\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {getChannels} from './packing_util';\nimport {getCoordsDataType, UniformType} from './shader_compiler';\n\nexport class SlicePackedProgram implements GPGPUProgram {\n variableNames = ['source'];\n packedInputs = true;\n packedOutput = true;\n outputShape: number[];\n userCode: string;\n rank: number;\n customUniforms: Array<{name: string; arrayIndex: number; type: UniformType;}>;\n\n constructor(destSize: number[]) {\n this.outputShape = destSize;\n this.rank = destSize.length;\n this.customUniforms = [{name: 'start', arrayIndex: this.rank, type: 'int'}];\n const dtype = getCoordsDataType(this.rank);\n const coords = getChannels('coords', this.rank);\n const sourceLoc = getChannels('sourceLoc', this.rank);\n\n const innerDims =\n this.rank === 1 ? 'sourceLoc' : `vec2(${sourceLoc.slice(-2).join()})`;\n const getChannel =\n `getChannel(getSource(${sourceLoc.join()}), ${innerDims})`;\n const upperRow = `\n result.x = ${getChannel};\n if (++${coords[this.rank - 1]} < ${destSize[this.rank - 1]}) {\n ++${sourceLoc[this.rank - 1]};\n result.y = ${getChannel};\n --${sourceLoc[this.rank - 1]};\n }\n `;\n const lowerRow = this.rank === 1 ? '' : `\n --${coords[this.rank - 1]};\n if (++${coords[this.rank - 2]} < ${destSize[this.rank - 2]}) {\n ++${sourceLoc[this.rank - 2]};\n result.z = ${getChannel};\n if (++${coords[this.rank - 1]} < ${destSize[this.rank - 1]}) {\n ++${sourceLoc[this.rank - 1]};\n result.w = ${getChannel};\n }\n }\n `;\n\n const sourceLocSetup = this.rank <= 4 ?\n `sourceLoc = coords +\n ${dtype}(${destSize.map((_, i) => `start[${i}]`).join()});` :\n destSize.map((_, i) => `${sourceLoc[i]} = ${coords[i]} + start[${i}];`)\n .join('\\n');\n this.userCode = `\n void main() {\n ${dtype} coords = getOutputCoords();\n ${dtype} sourceLoc;\n ${sourceLocSetup}\n vec4 result = vec4(0.);\n ${upperRow}\n ${lowerRow}\n setOutput(result);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env, KernelConfig, KernelFunc, Slice, slice_util, SliceAttrs, SliceInputs, TensorInfo, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {sliceImplCPU} from '../kernel_utils/shared';\nimport {SliceProgram} from '../slice_gpu';\nimport {SlicePackedProgram} from '../slice_packed_gpu';\n\nfunction shallowSlice(\n x: TensorInfo, begin: number[], size: number[], backend: MathBackendWebGL) {\n const xTexData = backend.texData.get(x.dataId);\n const t = backend.makeTensorInfo(size, x.dtype);\n const newTexData = backend.texData.get(t.dataId);\n // Copy texture data from the original tensor.\n Object.assign(newTexData, xTexData);\n newTexData.refCount = 1;\n newTexData.shape = size;\n newTexData.dtype = x.dtype;\n let flatOffset =\n slice_util.computeFlatOffset(begin, util.computeStrides(x.shape));\n if (xTexData.slice) {\n // We are slicing an already sliced tensor, so we have to accumulate\n // the offset.\n flatOffset += xTexData.slice.flatOffset;\n }\n newTexData.slice = {\n flatOffset,\n // Point to the original dataId, which is used to do ref counting.\n origDataId: xTexData.slice && xTexData.slice.origDataId || x.dataId\n };\n\n // Increase the ref count for that data bucket.\n const refCount = backend.dataRefCount.get(newTexData.slice.origDataId) || 1;\n backend.dataRefCount.set(newTexData.slice.origDataId, refCount + 1);\n return t;\n}\n\nexport function slice(\n args: {inputs: SliceInputs, backend: MathBackendWebGL, attrs: SliceAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {begin, size} = attrs;\n\n const [$begin, $size] = slice_util.parseSliceParams(x, begin, size);\n slice_util.assertParamsValid(x, $begin, $size);\n\n if (util.sizeFromShape($size) === 0) {\n return backend.makeTensorInfo($size, x.dtype, []);\n }\n\n // Run on cpu if dtype is string. For string, the backend represents it\n // as Uint8Array[], where each Uint8Array is a character. Given that the\n // computation is only on the outer array, uploading the whole data onto\n // gpu is wasteful. Also, currently webgl doesn't have a design to\n // upload and retrieve Uint8Array[] between cpu and gpu. Therefore, we\n // just run the kernel on cpu if dtype is string.\n if (backend.shouldExecuteOnCPU([x]) || x.dtype === 'string') {\n const xTexData = backend.texData.get(x.dataId);\n const outValues = sliceImplCPU(\n xTexData.values as TypedArray, $begin, $size, x.shape, x.dtype);\n return backend.makeTensorInfo($size, x.dtype, outValues);\n }\n\n const {isPacked} = backend.texData.get(x.dataId);\n const isContinous = slice_util.isSliceContinous(x.shape, $begin, $size);\n if (isPacked || !isContinous) {\n const program = env().getBool('WEBGL_PACK_ARRAY_OPERATIONS') ?\n new SlicePackedProgram($size) :\n new SliceProgram($size);\n const customValues = [$begin];\n return backend.runWebGLProgram(program, [x], x.dtype, customValues);\n }\n backend.uploadToGPU(x.dataId);\n return shallowSlice(x, $begin, $size, backend);\n}\n\nexport const sliceConfig: KernelConfig = {\n kernelName: Slice,\n backendName: 'webgl',\n kernelFunc: slice as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, BatchToSpaceND, BatchToSpaceNDAttrs, BatchToSpaceNDInputs, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\n\nimport {reshape} from './Reshape';\nimport {slice} from './Slice';\nimport {transpose} from './Transpose';\n\nexport const batchToSpaceND = (args: {\n inputs: BatchToSpaceNDInputs,\n backend: MathBackendWebGL,\n attrs: BatchToSpaceNDAttrs\n}): TensorInfo => {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {blockShape, crops} = attrs;\n\n util.assert(\n x.shape.length <= 4,\n () => 'batchToSpaceND for rank > 4 with a WebGL backend not ' +\n 'implemented yet');\n const prod = blockShape.reduce((a, b) => a * b);\n\n const reshaped = backend_util.getReshaped(x.shape, blockShape, prod);\n const permuted = backend_util.getPermuted(reshaped.length, blockShape.length);\n const reshapedPermuted =\n backend_util.getReshapedPermuted(x.shape, blockShape, prod);\n const sliceBeginCoords =\n backend_util.getSliceBeginCoords(crops, blockShape.length);\n const sliceSize =\n backend_util.getSliceSize(reshapedPermuted, crops, blockShape.length);\n\n const toDispose = [];\n\n const reshapedIntermediate =\n reshape({inputs: {x}, backend, attrs: {shape: reshaped}});\n const transposedIntermediate = transpose(\n {inputs: {x: reshapedIntermediate}, backend, attrs: {perm: permuted}});\n const reshapedIntermediate2 = reshape({\n inputs: {x: transposedIntermediate},\n backend,\n attrs: {shape: reshapedPermuted}\n });\n const sliced = slice({\n inputs: {x: reshapedIntermediate2},\n backend,\n attrs: {begin: sliceBeginCoords, size: sliceSize}\n });\n\n toDispose.push(reshapedIntermediate);\n toDispose.push(transposedIntermediate);\n toDispose.push(reshapedIntermediate2);\n\n toDispose.forEach(t => backend.disposeIntermediateTensorInfo(t));\n\n return sliced;\n};\n\nexport const batchToSpaceNDConfig: KernelConfig = {\n kernelName: BatchToSpaceND,\n backendName: 'webgl',\n kernelFunc: batchToSpaceND as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Bincount, BincountAttrs, BincountInputs, KernelConfig, KernelFunc, TensorInfo, TypedArray} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {bincountImplCPU} from '../kernel_utils/shared';\n\nexport function bincount(args: {\n inputs: BincountInputs,\n backend: MathBackendWebGL,\n attrs: BincountAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x, weights} = inputs;\n const {size} = attrs;\n\n const xVals = backend.readSync(x.dataId) as TypedArray;\n const weightsVals = backend.readSync(weights.dataId) as TypedArray;\n\n const outVals =\n bincountImplCPU(xVals, weightsVals, weights.dtype, weights.shape, size);\n\n return backend.makeTensorInfo([size], weights.dtype, outVals);\n}\n\nexport const bincountConfig: KernelConfig = {\n kernelName: Bincount,\n backendName: 'webgl',\n kernelFunc: bincount as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, BroadcastArgs, BroadcastArgsInputs, KernelConfig, TensorInfo, TypedArray} from '@tensorflow/tfjs-core';\nimport {MathBackendWebGL} from '../backend_webgl';\n\nexport function broadcastArgs(args: {\n inputs: BroadcastArgsInputs,\n backend: MathBackendWebGL,\n}): TensorInfo {\n const {inputs, backend} = args;\n const {s0, s1} = inputs;\n\n const s0Vals = backend.readSync(s0.dataId) as TypedArray;\n const s1Vals = backend.readSync(s1.dataId) as TypedArray;\n\n const broadcastShape = backend_util.assertAndGetBroadcastShape(\n Array.from(s0Vals), Array.from(s1Vals));\n\n return backend.makeTensorInfo(\n [broadcastShape.length], 'int32', Int32Array.from(broadcastShape));\n}\n\nexport const broadcastArgsConfig: KernelConfig = {\n kernelName: BroadcastArgs,\n backendName: 'webgl',\n kernelFunc: broadcastArgs\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {NotEqual} from '@tensorflow/tfjs-core';\nimport {KernelConfig} from '@tensorflow/tfjs-core';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {notEqualImplCPU} from '../kernel_utils/shared';\n\nconst NOT_EQUAL = `return float(a != b);`;\n\nexport const notEqual = binaryKernelFunc(\n {opSnippet: NOT_EQUAL, cpuKernelImpl: notEqualImplCPU, dtype: 'bool'});\n\nexport const notEqualConfig: KernelConfig = {\n kernelName: NotEqual,\n backendName: 'webgl',\n kernelFunc: notEqual,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Real, RealInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {identity} from './Identity';\n\nexport function real(args: {inputs: RealInputs, backend: MathBackendWebGL}):\n TensorInfo {\n const {inputs, backend} = args;\n const {input} = inputs;\n const inputData = backend.texData.get(input.dataId);\n\n return identity({inputs: {x: inputData.complexTensorInfos.real}, backend});\n}\n\nexport const realConfig: KernelConfig = {\n kernelName: Real,\n backendName: 'webgl',\n kernelFunc: real as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {UnaryOpProgram} from '../unaryop_gpu';\n\nconst TO_INT = `return float(int(x));`;\n\nexport function int(input: TensorInfo, backend: MathBackendWebGL): TensorInfo {\n const program = new UnaryOpProgram(input.shape, TO_INT);\n const output = backend.runWebGLProgram(program, [input], 'int32');\n return {dataId: output.dataId, shape: output.shape, dtype: output.dtype};\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport * as tf from '@tensorflow/tfjs-core';\nimport {BinaryInputs, Cast, CastAttrs, CastInputs, KernelConfig, KernelFunc, TensorInfo, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {castImplCPU} from '../kernel_utils/shared';\nimport {complex} from './Complex';\nimport {identity} from './Identity';\nimport {notEqual} from './NotEqual';\nimport {real} from './Real';\n\nimport {int} from '../kernel_utils/int';\n\nexport function cast(\n args: {inputs: CastInputs, backend: MathBackendWebGL, attrs: CastAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {dtype} = attrs;\n\n // Casting to complex64.\n if (dtype === 'complex64') {\n if (x.dtype === 'complex64') {\n return identity({inputs: {x}, backend});\n }\n\n // TODO(annxingyuan): Import kernel function once zeros is modularized.\n const zerosTensor = tf.zeros(x.shape);\n const floatX = cast({inputs: {x}, backend, attrs: {dtype: 'float32'}});\n\n const result =\n complex({inputs: {real: floatX, imag: zerosTensor}, backend});\n\n zerosTensor.dispose();\n backend.disposeIntermediateTensorInfo(floatX);\n\n return result;\n }\n\n // Casting from complex64\n if (x.dtype === 'complex64') {\n const realPart = real({inputs: {input: x}, backend});\n const result = cast({inputs: {x: realPart}, backend, attrs: {dtype}});\n backend.disposeIntermediateTensorInfo(realPart);\n return result;\n }\n\n if (!util.hasEncodingLoss(x.dtype, dtype)) {\n // We don't change the underlying data, since we cast to higher\n // precision.\n const result = identity({inputs: {x}, backend});\n return {dataId: result.dataId, shape: result.shape, dtype};\n }\n\n if (backend.shouldExecuteOnCPU([x])) {\n const values = backend.texData.get(x.dataId).values as TypedArray;\n const [resultShape, resultType, resultData] =\n castImplCPU(values, x.shape, x.dtype, dtype);\n return backend.makeTensorInfo(resultShape, resultType, resultData);\n }\n\n if (dtype === 'int32') {\n return int(x, backend);\n }\n\n if (dtype === 'bool') {\n const zerosTensorInfo = backend.makeTensorInfo(\n [], 'bool', util.getTypedArrayFromDType('bool', 1));\n\n const binaryInputs: BinaryInputs = {a: x, b: zerosTensorInfo};\n\n const result = notEqual({inputs: binaryInputs, backend}) as TensorInfo;\n backend.disposeIntermediateTensorInfo(zerosTensorInfo);\n return result;\n }\n\n throw new Error(`Error in Cast: failed to cast ${x.dtype} to ${dtype}`);\n}\n\nexport const castConfig: KernelConfig = {\n kernelName: Cast,\n backendName: 'webgl',\n kernelFunc: cast as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Ceil, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {ceilImplCPU} from '../kernel_utils/shared';\n\nconst CEIL = `return ceil(x);`;\n\nexport const ceil = unaryKernelFunc(\n {opSnippet: CEIL, packedOpSnippet: CEIL, cpuKernelImpl: ceilImplCPU});\n\nexport const ceilConfig: KernelConfig = {\n kernelName: Ceil,\n backendName: 'webgl',\n kernelFunc: ceil as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {UniformType} from './shader_compiler';\n\nexport class ClipProgram implements GPGPUProgram {\n variableNames = ['A'];\n userCode: string;\n outputShape: number[];\n customUniforms = [\n {name: 'minVal', type: 'float' as UniformType},\n {name: 'maxVal', type: 'float' as UniformType}\n ];\n\n constructor(aShape: number[]) {\n this.outputShape = aShape;\n this.userCode = `\n\n void main() {\n float value = getAAtOutCoords();\n if (isnan(value)) {\n setOutput(value);\n return;\n }\n\n setOutput(clamp(value, minVal, maxVal));\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {UniformType} from './shader_compiler';\n\nexport class ClipPackedProgram implements GPGPUProgram {\n variableNames = ['A'];\n packedInputs = true;\n packedOutput = true;\n userCode: string;\n outputShape: number[];\n customUniforms = [\n {name: 'minVal', type: 'float' as UniformType},\n {name: 'maxVal', type: 'float' as UniformType}\n ];\n\n constructor(aShape: number[]) {\n this.outputShape = aShape;\n this.userCode = `\n void main() {\n vec4 value = getAAtOutCoords();\n\n if (any(isnan(value))) {\n setOutput(value);\n return;\n }\n\n setOutput(clamp(value, vec4(minVal), vec4(maxVal)));\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ClipByValue, ClipByValueAttrs, ClipByValueInputs, env, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {ClipProgram} from '../clip_gpu';\nimport {ClipPackedProgram} from '../clip_packed_gpu';\n\nexport function clipByValue(args: {\n inputs: ClipByValueInputs,\n backend: MathBackendWebGL,\n attrs: ClipByValueAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {clipValueMin, clipValueMax} = attrs;\n\n let program;\n if (env().getBool('WEBGL_PACK_CLIP')) {\n program = new ClipPackedProgram(x.shape);\n } else {\n program = new ClipProgram(x.shape);\n }\n const customValues = [[clipValueMin], [clipValueMax]];\n return backend.runWebGLProgram(program, [x], x.dtype, customValues);\n}\n\nexport const clipByValueConfig: KernelConfig = {\n kernelName: ClipByValue,\n backendName: 'webgl',\n kernelFunc: clipByValue as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class ComplexAbsProgram implements GPGPUProgram {\n variableNames = ['real', 'imag'];\n userCode: string;\n outputShape: number[];\n\n constructor(shape: number[]) {\n this.outputShape = shape;\n this.userCode = `\n void main() {\n float re = abs(getRealAtOutCoords());\n float im = abs(getImagAtOutCoords());\n float mx = max(re, im);\n\n // sadly the length function in glsl is not underflow-safe\n // (at least not on Intel GPUs). So the safe solution is\n // to ensure underflow-safety in all cases.\n setOutput(\n mx == 0.0 ? 0.0 : mx * length(vec2(1, min(re, im)/mx))\n );\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ComplexAbs, ComplexAbsInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {ComplexAbsProgram} from '../complex_abs_gpu';\n\n// Returns a TensorInfo with the complex shape and the dataId of the\n// underlying part. We need to do this because a reshaped complex tensor is\n// not reflected in its parts.\nfunction makeComplexComponentTensorInfo(\n complexTensor: TensorInfo, complexPart: TensorInfo): TensorInfo {\n return {\n dataId: complexPart.dataId,\n dtype: complexPart.dtype,\n shape: complexTensor.shape\n };\n}\n\nexport function complexAbs(\n args: {inputs: ComplexAbsInputs, backend: MathBackendWebGL}): TensorInfo {\n const {inputs, backend} = args;\n const {x} = inputs;\n\n const xData = backend.texData.get(x.dataId);\n\n const program = new ComplexAbsProgram(x.shape);\n const programInputs = [\n makeComplexComponentTensorInfo(x, xData.complexTensorInfos.real),\n makeComplexComponentTensorInfo(x, xData.complexTensorInfos.imag),\n ];\n\n return backend.runWebGLProgram(\n program, programInputs, programInputs[0].dtype);\n}\n\nexport const complexAbsConfig: KernelConfig = {\n kernelName: ComplexAbs,\n backendName: 'webgl',\n kernelFunc: complexAbs as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class ConcatProgram implements GPGPUProgram {\n variableNames: string[];\n outputShape: number[] = [];\n userCode: string;\n\n // Concats 2d tensors along axis=1. See comments in MathBackendWebGL.concat().\n constructor(shapes: Array<[number, number]>) {\n this.outputShape = backend_util.computeOutShape(shapes, 1 /* axis */);\n this.variableNames = shapes.map((_, i) => `T${i}`);\n\n const offsets: number[] = new Array(shapes.length - 1);\n offsets[0] = shapes[0][1];\n for (let i = 1; i < offsets.length; i++) {\n offsets[i] = offsets[i - 1] + shapes[i][1];\n }\n\n const snippets = [`if (yC < ${offsets[0]}) setOutput(getT0(yR, yC));`];\n for (let i = 1; i < offsets.length; i++) {\n const shift = offsets[i - 1];\n snippets.push(\n `else if (yC < ${offsets[i]}) ` +\n `setOutput(getT${i}(yR, yC-${shift}));`);\n }\n const lastIndex = offsets.length;\n const lastShift = offsets[offsets.length - 1];\n snippets.push(`else setOutput(getT${lastIndex}(yR, yC-${lastShift}));`);\n\n this.userCode = `\n void main() {\n ivec2 coords = getOutputCoords();\n int yR = coords.x;\n int yC = coords.y;\n\n ${snippets.join('\\n ')}\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {getChannels} from './packing_util';\nimport {getCoordsDataType} from './shader_compiler';\n\nexport class ConcatPackedProgram implements GPGPUProgram {\n variableNames: string[];\n packedInputs = true;\n packedOutput = true;\n outputShape: number[] = [];\n userCode: string;\n\n constructor(shapes: number[][], axis: number) {\n this.outputShape = backend_util.computeOutShape(shapes, axis);\n const shape = this.outputShape;\n const rank = shape.length;\n const dtype = getCoordsDataType(rank);\n const coords = getChannels('coords', rank);\n const channels = ['x', 'y', 'z', 'w', 'u', 'v'].slice(0, rank);\n this.variableNames = shapes.map((_, i) => `T${i}`);\n\n const offsets: number[] = new Array(shapes.length - 1);\n offsets[0] = shapes[0][axis];\n for (let i = 1; i < offsets.length; i++) {\n offsets[i] = offsets[i - 1] + shapes[i][axis];\n }\n\n const channel = channels[axis];\n const lastChannels = channels.slice(-2);\n const allChannels = channels.join();\n\n let getValueSnippet = `if (${channel} < ${offsets[0]}) {\n return getChannel(\n getT0(${allChannels}), vec2(${lastChannels.join()}));\n }`;\n for (let i = 1; i < offsets.length; i++) {\n const shift = offsets[i - 1];\n // Note: the >= comparison below may seem unnecessary given the check\n // above but is needed to workaround branch execution issues on some\n // devices. It makes all the conditions exclusive without relying on\n // execution order.\n getValueSnippet += `\n if (${channel} < ${offsets[i]} && ${channel} >= ${offsets[i - 1]}) {\n return getChannel(\n getT${i}(${shiftedChannels(channels, channel, shift)}),\n vec2(${shiftedChannels(lastChannels, channel, shift)}));\n }`;\n }\n const lastIndex = offsets.length;\n const shift = offsets[offsets.length - 1];\n getValueSnippet += `\n return getChannel(\n getT${lastIndex}(${shiftedChannels(channels, channel, shift)}),\n vec2(${shiftedChannels(lastChannels, channel, shift)}));`;\n\n this.userCode = `\n float getValue(${channels.map(x => 'int ' + x)}) {\n ${getValueSnippet}\n }\n\n void main() {\n ${dtype} coords = getOutputCoords();\n vec4 result = vec4(getValue(${coords}), 0., 0., 0.);\n\n ${coords[rank - 1]} = ${coords[rank - 1]} + 1;\n if (${coords[rank - 1]} < ${shape[rank - 1]}) {\n result.g = getValue(${coords});\n }\n\n ${coords[rank - 2]} = ${coords[rank - 2]} + 1;\n if (${coords[rank - 2]} < ${shape[rank - 2]}) {\n result.a = getValue(${coords});\n }\n\n ${coords[rank - 1]} = ${coords[rank - 1]} - 1;\n if (${coords[rank - 2]} < ${shape[rank - 2]} &&\n ${coords[rank - 1]} < ${shape[rank - 1]}) {\n result.b = getValue(${coords});\n }\n setOutput(result);\n }\n `;\n }\n}\n\n/**\n * Return an expression for coordinates into a vector where a given channel\n * will be offset by [shift].\n *\n * @param channels the channels to consider\n * @param channel the channel we want shifted\n * @param shift the amount to subtract from the channel.\n *\n * @returns a string of the form 'x, y-[shift], z' where any one channel can\n * have the shift applied.\n */\nfunction shiftedChannels(channels: string[], channel: string, shift: number) {\n const channelIdx = channels.indexOf(channel);\n const res = channels.map((c, idx) => {\n if (idx === channelIdx) {\n return `${c} - ${shift}`;\n } else {\n return c;\n }\n });\n return res.join();\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Imag, ImagInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {identity} from './Identity';\n\nexport function imag(args: {inputs: ImagInputs, backend: MathBackendWebGL}):\n TensorInfo {\n const {inputs, backend} = args;\n const {input} = inputs;\n const inputData = backend.texData.get(input.dataId);\n\n return identity({inputs: {x: inputData.complexTensorInfos.imag}, backend});\n}\n\nexport const imagConfig: KernelConfig = {\n kernelName: Imag,\n backendName: 'webgl',\n kernelFunc: imag as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, ConcatInputs, env, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {ConcatProgram} from '../concat_gpu';\nimport {ConcatPackedProgram} from '../concat_packed_gpu';\nimport {concatImplCPU} from '../kernel_utils/shared';\n\nimport {complex} from './Complex';\nimport {imag} from './Imag';\nimport {real} from './Real';\nimport {reshape} from './Reshape';\n\nexport function concatImpl(\n inputs: ConcatInputs, axis: number, backend: MathBackendWebGL): TensorInfo {\n const dtype = inputs[0].dtype;\n if (dtype === 'complex64') {\n const reals = inputs.map((t) => real({inputs: {input: t}, backend}));\n const imags = inputs.map((t) => imag({inputs: {input: t}, backend}));\n\n const realConcated = concatImpl(reals, axis, backend);\n const imagConcated = concatImpl(imags, axis, backend);\n\n const result =\n complex({inputs: {real: realConcated, imag: imagConcated}, backend});\n\n reals.forEach(r => backend.disposeIntermediateTensorInfo(r));\n imags.forEach(i => backend.disposeIntermediateTensorInfo(i));\n backend.disposeIntermediateTensorInfo(realConcated);\n backend.disposeIntermediateTensorInfo(imagConcated);\n\n return result;\n }\n\n let runOnCpu = backend.shouldExecuteOnCPU(inputs);\n\n // Run on cpu if dtype is string. For string, the backend represents it\n // as Uint8Array[], where each Uint8Array is a character. Given that the\n // computation is only on the outer array, uploading the whole data onto\n // gpu is wasteful. Also, currently webgl doesn't have a design to\n // upload and retrieve Uint8Array[] between cpu and gpu. Therefore, we\n // just run the kernel on cpu if dtype is string.\n if (dtype === 'string') {\n runOnCpu = true;\n }\n\n if (runOnCpu) {\n // Any concat of n-dimensional tensors across any axis can be reduced to\n // a concatenation of two-dimensional tensors across the axis 1 by first\n // partitioning the axes of the original tensors into those less than the\n // axis to be concatenated and the rest. Then reshape the tensors\n // into a two-dimensional tensor by collapsing these two sets of axes and\n // concatenate the resulting matrices across the axis 1, finally reshaping\n // the result to have the proper shape.\n const tensors2D = inputs.map(t => {\n const innerSize = util.sizeFromShape(t.shape.slice(axis));\n const shape = [-1, innerSize];\n return reshape({inputs: {x: t}, backend, attrs: {shape}});\n });\n\n const inputsValShapes = tensors2D.map(t => {\n return {vals: backend.readSync(t.dataId), shape: t.shape};\n });\n\n // Concats 2d tensors along axis=1.\n const outShape =\n backend_util.computeOutShape(tensors2D.map(t => t.shape), 1 /* axis */);\n const simplyConcat = tensors2D[0].shape[0] === 1;\n const outVals =\n concatImplCPU(inputsValShapes, outShape, dtype, simplyConcat);\n\n const finalOutShape =\n backend_util.computeOutShape(inputs.map(t => t.shape), axis);\n\n const outInfo = backend.makeTensorInfo(finalOutShape, dtype, outVals);\n\n tensors2D.forEach(t => backend.disposeIntermediateTensorInfo(t));\n\n return outInfo;\n }\n\n const maxTexturesInShader = env().getNumber('WEBGL_MAX_TEXTURES_IN_SHADER');\n if (inputs.length > maxTexturesInShader) {\n const reducedInputs = [];\n for (let i = 0; i < inputs.length; i += maxTexturesInShader) {\n const subArray = inputs.slice(i, i + maxTexturesInShader);\n reducedInputs.push(concatImpl(subArray, axis, backend));\n }\n const result = concatImpl(reducedInputs, axis, backend);\n\n for (const i of reducedInputs) {\n backend.disposeIntermediateTensorInfo(i);\n }\n\n return result;\n }\n\n if (env().getBool('WEBGL_PACK_ARRAY_OPERATIONS') &&\n inputs[0].shape.length > 1) {\n const program = new ConcatPackedProgram(inputs.map(t => t.shape), axis);\n return backend.runWebGLProgram(program, inputs, dtype);\n }\n\n const {tensors2D, outShape} = computeTensors2D(inputs, axis, backend);\n const program =\n new ConcatProgram(tensors2D.map(t => t.shape as [number, number]));\n const result = backend.runWebGLProgram(program, tensors2D, dtype);\n\n tensors2D.forEach(r => backend.disposeIntermediateTensorInfo(r));\n const reshapedResult =\n reshape({inputs: {x: result}, attrs: {shape: outShape}, backend});\n backend.disposeIntermediateTensorInfo(result);\n\n return reshapedResult;\n}\n\nfunction computeTensors2D(\n inputs: ConcatInputs, axis: number, backend: MathBackendWebGL) {\n // Any concat of n-dimensional tensors across any axis can be reduced to\n // a concatenation of two-dimensional tensors across the axis 1 by first\n // partitioning the axes of the original tensors into those less than the\n // axis to be concatenated and the rest. Then reshape the tensors\n // into a two-dimensional tensor by collapsing these two sets of axes and\n // concatenate the resulting matrices across the axis 1, finally reshaping\n // the result to have the proper shape.\n const outShape = backend_util.computeOutShape(inputs.map(t => t.shape), axis);\n const tensors2D = inputs.map(\n x => reshape({\n inputs: {x},\n attrs: {shape: [-1, util.sizeFromShape(x.shape.slice(axis))]},\n backend\n }));\n\n return {tensors2D, outShape};\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, Concat, ConcatAttrs, ConcatInputs, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {concatImpl} from './Concat_impl';\nimport {identity} from './Identity';\n\nexport function concat(\n args:\n {inputs: ConcatInputs, attrs: ConcatAttrs, backend: MathBackendWebGL}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {axis} = attrs;\n\n const $axis = util.parseAxisParam(axis, inputs[0].shape)[0];\n\n const shapes = inputs.map(t => t.shape);\n backend_util.assertParamsConsistent(shapes, $axis);\n\n const outShape =\n backend_util.computeOutShape(inputs.map(t => t.shape), $axis);\n\n if (util.sizeFromShape(outShape) === 0) {\n return backend.makeTensorInfo(outShape, inputs[0].dtype, []);\n }\n\n // Keep only non-empty tensors (ignore tensors with 0 in their shape).\n const $inputs = inputs.filter(t => util.sizeFromShape(t.shape) > 0);\n if ($inputs.length === 1) {\n return identity({inputs: {x: $inputs[0]}, backend});\n }\n\n return concatImpl($inputs, $axis, backend);\n}\n\nexport const concatConfig: KernelConfig = {\n kernelName: Concat,\n backendName: 'webgl',\n kernelFunc: concat as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class Conv2DProgram implements GPGPUProgram {\n variableNames = ['x', 'W'];\n outputShape: number[];\n userCode: string;\n\n constructor(\n convInfo: backend_util.Conv2DInfo, addBias = false,\n activation: string = null, hasPreluActivationWeights = false,\n hasLeakyreluAlpha = false) {\n this.outputShape = convInfo.outShape;\n const padTop = convInfo.padInfo.top;\n const padLeft = convInfo.padInfo.left;\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n const dilationHeight = convInfo.dilationHeight;\n const dilationWidth = convInfo.dilationWidth;\n const filterHeight = convInfo.filterHeight;\n const filterWidth = convInfo.filterWidth;\n\n const inputDepthNearestVec4 = Math.floor(convInfo.inChannels / 4) * 4;\n const inputDepthVec4Remainder = convInfo.inChannels % 4;\n const isChannelsLast = convInfo.dataFormat === 'channelsLast';\n\n const rowDim = isChannelsLast ? 1 : 2;\n const colDim = isChannelsLast ? 2 : 3;\n const channelDim = isChannelsLast ? 3 : 1;\n\n let activationSnippet = '', applyActivationSnippet = '';\n if (activation) {\n if (hasPreluActivationWeights) {\n activationSnippet = `float activation(float a) {\n float b = getPreluActivationWeightsAtOutCoords();\n ${activation}\n }`;\n } else if (hasLeakyreluAlpha) {\n activationSnippet = `float activation(float a) {\n float b = getLeakyreluAlphaAtOutCoords();\n ${activation}\n }`;\n } else {\n activationSnippet = `\n float activation(float x) {\n ${activation}\n }\n `;\n }\n\n applyActivationSnippet = `result = activation(result);`;\n }\n\n const addBiasSnippet = addBias ? 'result += getBiasAtOutCoords();' : '';\n if (addBias) {\n this.variableNames.push('bias');\n }\n\n if (hasPreluActivationWeights) {\n this.variableNames.push('preluActivationWeights');\n }\n\n if (hasLeakyreluAlpha) {\n this.variableNames.push('leakyreluAlpha');\n }\n\n this.userCode = `\n ${activationSnippet}\n\n const ivec2 strides = ivec2(${strideHeight}, ${strideWidth});\n const ivec2 pads = ivec2(${padTop}, ${padLeft});\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d2 = coords[${channelDim}];\n\n ivec2 xRCCorner =\n ivec2(coords[${rowDim}], coords[${colDim}]) * strides - pads;\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n // Convolve x(?, ?, d1) with w(:, :, d1, d2) to get y(yR, yC, d2).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < ${filterHeight}; wR++) {\n int xR = xRCorner + wR * ${dilationHeight};\n\n if (xR < 0 || xR >= ${convInfo.inHeight}) {\n continue;\n }\n\n for (int wC = 0; wC < ${filterWidth}; wC++) {\n int xC = xCCorner + wC * ${dilationWidth};\n\n if (xC < 0 || xC >= ${convInfo.inWidth}) {\n continue;\n }\n\n for (int d1 = 0; d1 < ${inputDepthNearestVec4}; d1 += 4) {\n vec4 wValues = vec4(\n getW(wR, wC, d1, d2),\n getW(wR, wC, d1 + 1, d2),\n getW(wR, wC, d1 + 2, d2),\n getW(wR, wC, d1 + 3, d2)\n );\n\n if (${isChannelsLast}) {\n vec4 xValues = vec4(\n getX(batch, xR, xC, d1),\n getX(batch, xR, xC, d1 + 1),\n getX(batch, xR, xC, d1 + 2),\n getX(batch, xR, xC, d1 + 3)\n );\n dotProd += dot(xValues, wValues);\n } else {\n vec4 xValues = vec4(\n getX(batch, d1, xR, xC),\n getX(batch, d1 + 1, xR, xC),\n getX(batch, d1 + 2, xR, xC),\n getX(batch, d1 + 3, xR, xC)\n );\n dotProd += dot(xValues, wValues);\n }\n }\n\n if (${inputDepthVec4Remainder === 1}) {\n\n if (${isChannelsLast}) {\n dotProd +=\n getX(batch, xR, xC, ${inputDepthNearestVec4}) *\n getW(wR, wC, ${inputDepthNearestVec4}, d2);\n } else {\n dotProd +=\n getX(batch, ${inputDepthNearestVec4}, xR, xC) *\n getW(wR, wC, ${inputDepthNearestVec4}, d2);\n }\n\n } else if (${inputDepthVec4Remainder === 2}) {\n vec2 wValues = vec2(\n getW(wR, wC, ${inputDepthNearestVec4}, d2),\n getW(wR, wC, ${inputDepthNearestVec4} + 1, d2)\n );\n\n if (${isChannelsLast}) {\n vec2 xValues = vec2(\n getX(batch, xR, xC, ${inputDepthNearestVec4}),\n getX(batch, xR, xC, ${inputDepthNearestVec4} + 1)\n );\n dotProd += dot(xValues, wValues);\n } else {\n vec2 xValues = vec2(\n getX(batch, ${inputDepthNearestVec4}, xR, xC),\n getX(batch, ${inputDepthNearestVec4} + 1, xR, xC)\n );\n dotProd += dot(xValues, wValues);\n }\n\n } else if (${inputDepthVec4Remainder === 3}) {\n vec3 wValues = vec3(\n getW(wR, wC, ${inputDepthNearestVec4}, d2),\n getW(wR, wC, ${inputDepthNearestVec4} + 1, d2),\n getW(wR, wC, ${inputDepthNearestVec4} + 2, d2)\n );\n\n if (${isChannelsLast}) {\n vec3 xValues = vec3(\n getX(batch, xR, xC, ${inputDepthNearestVec4}),\n getX(batch, xR, xC, ${inputDepthNearestVec4} + 1),\n getX(batch, xR, xC, ${inputDepthNearestVec4} + 2)\n );\n dotProd += dot(xValues, wValues);\n } else {\n vec3 xValues = vec3(\n getX(batch, ${inputDepthNearestVec4}, xR, xC),\n getX(batch, ${inputDepthNearestVec4} + 1, xR, xC),\n getX(batch, ${inputDepthNearestVec4} + 2, xR, xC)\n );\n dotProd += dot(xValues, wValues);\n }\n\n }\n }\n }\n\n float result = dotProd;\n ${addBiasSnippet}\n ${applyActivationSnippet}\n setOutput(result);\n }\n `;\n }\n}\n\nexport class Conv3DProgram implements GPGPUProgram {\n variableNames = ['x', 'W'];\n outputShape: number[];\n userCode: string;\n\n constructor(convInfo: backend_util.Conv3DInfo) {\n this.outputShape = convInfo.outShape;\n const padFront = convInfo.padInfo.front;\n const padTop = convInfo.padInfo.top;\n const padLeft = convInfo.padInfo.left;\n const strideDepth = convInfo.strideDepth;\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n const dilationDepth = convInfo.dilationDepth;\n const dilationHeight = convInfo.dilationHeight;\n const dilationWidth = convInfo.dilationWidth;\n const filterDepth = convInfo.filterDepth;\n const filterHeight = convInfo.filterHeight;\n const filterWidth = convInfo.filterWidth;\n\n const inputDepthNearestVec4 = Math.floor(convInfo.inChannels / 4) * 4;\n const inputDepthVec4Remainder = convInfo.inChannels % 4;\n\n this.userCode = `\n const ivec3 strides = ivec3(${strideDepth}, ${strideHeight}, ${\n strideWidth});\n const ivec3 pads = ivec3(${padFront}, ${padTop}, ${padLeft});\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int d2 = coords.u;\n\n ivec3 xFRCCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;\n int xFCorner = xFRCCorner.x;\n int xRCorner = xFRCCorner.y;\n int xCCorner = xFRCCorner.z;\n\n // Convolve x(?, ?, ?, d1) with w(:, :, :, d1, d2) to get\n // y(yF, yR, yC, d2). ? = to be determined. : = across all\n // values in that axis.\n float dotProd = 0.0;\n for (int wF = 0; wF < ${filterDepth}; wF++) {\n int xF = xFCorner + wF * ${dilationDepth};\n\n if (xF < 0 || xF >= ${convInfo.inDepth}) {\n continue;\n }\n\n for (int wR = 0; wR < ${filterHeight}; wR++) {\n int xR = xRCorner + wR * ${dilationHeight};\n\n if (xR < 0 || xR >= ${convInfo.inHeight}) {\n continue;\n }\n\n for (int wC = 0; wC < ${filterWidth}; wC++) {\n int xC = xCCorner + wC * ${dilationWidth};\n\n if (xC < 0 || xC >= ${convInfo.inWidth}) {\n continue;\n }\n\n for (int d1 = 0; d1 < ${inputDepthNearestVec4}; d1 += 4) {\n vec4 xValues = vec4(\n getX(batch, xF, xR, xC, d1),\n getX(batch, xF, xR, xC, d1 + 1),\n getX(batch, xF, xR, xC, d1 + 2),\n getX(batch, xF, xR, xC, d1 + 3)\n );\n vec4 wValues = vec4(\n getW(wF, wR, wC, d1, d2),\n getW(wF, wR, wC, d1 + 1, d2),\n getW(wF, wR, wC, d1 + 2, d2),\n getW(wF, wR, wC, d1 + 3, d2)\n );\n\n dotProd += dot(xValues, wValues);\n }\n\n if (${inputDepthVec4Remainder === 1}) {\n dotProd +=\n getX(batch, xF, xR, xC, ${inputDepthNearestVec4}) *\n getW(wF, wR, wC, ${inputDepthNearestVec4}, d2);\n } else if (${inputDepthVec4Remainder === 2}) {\n vec2 xValues = vec2(\n getX(batch, xF, xR, xC, ${inputDepthNearestVec4}),\n getX(batch, xF, xR, xC, ${inputDepthNearestVec4} + 1)\n );\n vec2 wValues = vec2(\n getW(wF, wR, wC, ${inputDepthNearestVec4}, d2),\n getW(wF, wR, wC, ${inputDepthNearestVec4} + 1, d2)\n );\n dotProd += dot(xValues, wValues);\n } else if (${inputDepthVec4Remainder === 3}) {\n vec3 xValues = vec3(\n getX(batch, xF, xR, xC, ${inputDepthNearestVec4}),\n getX(batch, xF, xR, xC, ${inputDepthNearestVec4} + 1),\n getX(batch, xF, xR, xC, ${inputDepthNearestVec4} + 2)\n );\n vec3 wValues = vec3(\n getW(wF, wR, wC, ${inputDepthNearestVec4}, d2),\n getW(wF, wR, wC, ${inputDepthNearestVec4} + 1, d2),\n getW(wF, wR, wC, ${inputDepthNearestVec4} + 2, d2)\n );\n dotProd += dot(xValues, wValues);\n }\n }\n }\n }\n setOutput(dotProd);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n import {backend_util, util} from '@tensorflow/tfjs-core';\n\n import {GPGPUProgram, useShapeUniforms} from './gpgpu_math';\n\n export class Conv2DPackedProgram implements GPGPUProgram {\n variableNames = ['x', 'W'];\n packedInputs = true;\n packedOutput = true;\n outputShape: number[];\n userCode: string;\n enableShapeUniforms: boolean;\n customUniforms = [\n {name: 'pads', type: 'ivec2' as const },\n {name: 'strides', type: 'ivec2' as const },\n {name: 'dilations', type: 'ivec2' as const },\n {name: 'inDims', type: 'ivec2' as const },\n ];\n\n constructor(\n convInfo: backend_util.Conv2DInfo, addBias = false,\n activation: string = null, hasPreluActivation = false,\n hasLeakyReluAlpha = false) {\n this.outputShape = convInfo.outShape;\n this.enableShapeUniforms = useShapeUniforms(this.outputShape.length);\n const padLeft = convInfo.padInfo.left;\n const strideWidth = convInfo.strideWidth;\n const dilationWidth = convInfo.dilationWidth;\n const filterHeight = convInfo.filterHeight;\n const filterWidth = convInfo.filterWidth;\n const texelsAcross = filterWidth;\n\n let mainLoop = `\n int xR; int xC; int xCOffset;\n vec4 wTexel; vec4 previous; vec4 final;`;\n\n for (let c = 0; c < filterWidth; c++) {\n mainLoop += `\n vec4 xTexelC${c * 2};\n int xTexelC${c * 2}Ready;\n vec4 xTexelC${c * 2 + 1};\n int xTexelC${c * 2 + 1}Ready;\n vec4 xC${c};`;\n }\n\n /**\n * This vectorized implementation works by gathering the values needed for\n * each output channel's dot product into vec4's and then multiplying them\n * all together (this happens in the final double for-loop below). Most of\n * the main loop consists of constructing these vec4's with the minimum\n * number of texture2D calls, which means making use of all four returned\n * values from a texture2D call at once.\n */\n mainLoop += `\n for (int r = 0; r < ${filterHeight}; r++) {\n for (int d1 = 0; d1 < ${convInfo.inChannels}; d1 += 2) {\n `;\n for (let c = 0; c < filterWidth; c++) {\n mainLoop += `\n xTexelC${c * 2} = vec4(0.0);\n xTexelC${c * 2}Ready = 0;\n xTexelC${c * 2 + 1} = vec4(0.0);\n xTexelC${c * 2 + 1}Ready = 0;\n xC${c} = vec4(0.0);`;\n }\n mainLoop += `\n xR = xRCorner + r * dilations[0];\n if (xR >=0 && xR < inDims[0]) {\n `;\n\n for (let texelC = 0; texelC < (texelsAcross + 1) / 2; texelC++) {\n const colIndex = texelC * 2;\n\n mainLoop += `\n xC = xCCorner + ${colIndex * dilationWidth};\n `;\n\n if (strideWidth === 1) {\n if (colIndex < filterWidth) {\n // If padding is odd, the outer texels have to be composed.\n if (padLeft % 2 === 1) {\n // TODO: Ensure vec4 previous does not result in redundant sample,\n // and avoid setting xTexelRC's that exceed the boundary in the\n // first place rather than resetting them to vec4(0)).\n\n // To compute xCOffset:\n // - If padding is odd, we must add 1 to ensure we ask for an\n // even-numbered row.\n // - We subtract 2 to access the previous texel.\n\n mainLoop += `\n xCOffset = xC + 1;\n if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${\n colIndex}Ready == 0) {\n xTexelC${colIndex} = getX(batch, xR, xCOffset, d1);\n\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${colIndex}.zw = vec2(0.0);\n }\n xTexelC${colIndex}Ready = 1;\n }\n `;\n // This texel has been read in previous iteration if the dilation\n // is 1.\n if (dilationWidth === 1 && colIndex > 0) {\n mainLoop += `\n xC${colIndex} = vec4(xTexelC${colIndex - 2}.zw, xTexelC${\n colIndex}.xy);\n `;\n } else {\n mainLoop += `\n xCOffset = xC + 1 - 2;\n\n if (xCOffset >= 0 && xCOffset < inDims[1]) {\n previous = getX(batch, xR, xCOffset, d1);\n\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n previous.zw = vec2(0.0);\n }\n\n xC${colIndex} = vec4(previous.zw, xTexelC${colIndex}.xy);\n } else {\n xC${colIndex} = vec4(0.0, 0.0, xTexelC${colIndex}.xy);\n }\n `;\n }\n } else {\n // Padding is even, so xRC corresponds to a single texel.\n mainLoop += `\n if (xC >= 0 && xC < inDims[1] && xTexelC${colIndex}Ready == 0) {\n xTexelC${colIndex} = getX(batch, xR, xC, d1);\n if (xC + 1 >= inDims[1]) {\n xTexelC${colIndex}.zw = vec2(0.0);\n }\n xTexelC${colIndex}Ready = 1;\n }\n\n xC${colIndex} = xTexelC${colIndex};\n `;\n }\n\n if (colIndex + 1 < filterWidth) {\n // If dilation is even, the second entry should match the first\n // (either both are composed or both are single samples). But if\n // dilation is odd, then the second entry should be the opposite\n // of the first (if the first is composed, the second is a single\n // sample, and vice versa.)\n\n const nextTexelOffset = padLeft % 2 === 0 ?\n util.nearestLargerEven(dilationWidth) :\n dilationWidth;\n\n if ((dilationWidth % 2 === 0 && padLeft % 2 === 1) ||\n (dilationWidth % 2 !== 0 && padLeft % 2 !== 1)) {\n mainLoop += `\n xCOffset = xC + imod(pads[1], 2) + ${nextTexelOffset};\n\n if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${\n colIndex + 1}Ready == 0) {\n xTexelC${colIndex + 1} = getX(batch, xR, xCOffset, d1);\n\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${colIndex + 1}.zw = vec2(0.0);\n }\n xTexelC${colIndex + 1}Ready = 1;\n }\n `;\n\n // If dilation > 1 then the xRC's will not be able to share any\n // values, so each xRC will require two unique calls to getX.\n if (dilationWidth > 1) {\n mainLoop += `\n xCOffset -= 2;\n if (xCOffset >= 0 && xCOffset < inDims[1]) {\n previous = getX(batch, xR, xCOffset, d1);\n xC${colIndex + 1} = vec4(previous.zw, xTexelC${\n colIndex + 1}.xy);\n } else {\n xC${colIndex + 1} = vec4(0.0, 0.0, xTexelC${\n colIndex + 1}.xy);\n }\n `;\n } else {\n mainLoop += `\n xC${colIndex + 1} = vec4(xTexelC${colIndex}.zw, xTexelC${\n colIndex + 1}.xy);\n `;\n }\n\n } else {\n // If dilation is 1 and padding is odd, we have already read the\n // texel when constructing the previous x value. Here we can\n // simply skip the texture read.\n if (nextTexelOffset === 1) {\n mainLoop += `\n xC${colIndex + 1} = xTexelC${colIndex};\n `;\n } else {\n mainLoop += `\n xCOffset = xC + ${nextTexelOffset};\n\n if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${\n colIndex + 1}Ready == 0) {\n xTexelC${colIndex + 1} = getX(batch, xR, xCOffset, d1);\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${colIndex + 1}.zw = vec2(0.0);\n }\n xTexelC${colIndex + 1}Ready = 1;\n }\n\n xC${colIndex + 1} = xTexelC${colIndex + 1};\n `;\n }\n }\n }\n }\n } else { // stride === 2\n if (colIndex < filterWidth) {\n // Depending on whether padLeft is even or odd, we want either the\n // xy or zw channels from X texels for xC${colIndex}. If padLeft is\n // even, xC${colIndex +1} is simply the zw channels of texels we've\n // already sampled. But if padLeft is odd, xC{$c + 1}.zw will\n // need to come from the xy channels of a new texel, hence the `\n // vec4\n // final` initialized below.\n if (padLeft % 2 === 1) {\n mainLoop += `\n xCOffset = xC + 1 - strides[1];\n if(xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${\n colIndex}Ready == 0) {\n xTexelC${colIndex} = getX(batch, xR, xCOffset, d1);\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${colIndex}.zw = vec2(0.0);\n }\n xTexelC${colIndex}Ready = 1;\n }\n\n if(xC + 1 >= 0 && xC + 1 < inDims[1] && xTexelC${\n colIndex + 1}Ready == 0) {\n xTexelC${colIndex + 1} = getX(batch, xR, xC + 1, d1);\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xC + 2 >= inDims[1]) {\n xTexelC${colIndex + 1}.zw = vec2(0.0);\n }\n xTexelC${colIndex + 1}Ready = 1;\n }\n\n xC${colIndex} = vec4(xTexelC${colIndex}.zw, xTexelC${\n colIndex + 1}.zw);\n `;\n\n if (colIndex + 1 < filterWidth) {\n mainLoop += `\n final = vec4(0.0);\n xCOffset = xC + 1 + strides[1];\n if(xCOffset >= 0 && xCOffset < inDims[1]) {\n final = getX(batch, xR, xCOffset, d1);\n }\n xC${colIndex + 1} = vec4(xTexelC${colIndex + 1}.xy, final.xy);\n `;\n }\n } else {\n mainLoop += `\n if(xC >= 0 && xC < inDims[1] && xTexelC${colIndex}Ready == 0) {\n xTexelC${colIndex} = getX(batch, xR, xC, d1);\n if (xC + 1 >= inDims[1]) {\n xTexelC${colIndex}.zw = vec2(0.0);\n }\n xTexelC${colIndex}Ready = 1;\n }\n\n xCOffset = xC + strides[1];\n if(xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${\n colIndex + 1}Ready == 0) {\n xTexelC${colIndex + 1} = getX(batch, xR, xCOffset, d1);\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${colIndex + 1}.zw = vec2(0.);\n }\n xTexelC${colIndex + 1}Ready = 1;\n }\n\n xC${colIndex} = vec4(\n xTexelC${colIndex}.xy, xTexelC${colIndex + 1}.xy);\n `;\n\n if (colIndex + 1 < filterWidth) {\n mainLoop += `\n xC${colIndex + 1} = vec4(xTexelC${colIndex}.zw, xTexelC${\n colIndex + 1}.zw);\n `;\n }\n }\n }\n }\n\n // localize the dotProd accumulation within the loop, the theory is for\n // GPU with limited cache, accumulate sum across large amount of\n // veriables will cause lots of cache misses. (i.e. 5x5 filter will have\n // 50 variables)\n if (colIndex < filterWidth) {\n mainLoop += `\n wTexel = getW(r, ${colIndex}, d1, d2);\n dotProd += xC${colIndex}.xxzz * vec4(wTexel.xy, wTexel.xy);\n if(d1 + 1 < ${convInfo.inChannels}) {\n dotProd += xC${colIndex}.yyww * vec4(wTexel.zw, wTexel.zw);\n }\n `;\n\n if (colIndex + 1 < filterWidth) {\n mainLoop += `\n wTexel = getW(r, ${colIndex + 1}, d1, d2);\n dotProd += xC${colIndex + 1}.xxzz * vec4(wTexel.xy, wTexel.xy);\n if(d1 + 1 < ${convInfo.inChannels}) {\n dotProd += xC${colIndex + 1}.yyww * vec4(wTexel.zw, wTexel.zw);\n }\n `;\n }\n }\n }\n mainLoop += `\n }\n `;\n mainLoop += `\n }\n `;\n mainLoop += `\n }\n `;\n\n let activationSnippet = '', applyActivationSnippet = '';\n if (activation) {\n if (hasPreluActivation) {\n activationSnippet = `vec4 activation(vec4 a) {\n vec4 b = getPreluActivationWeightsAtOutCoords();\n ${activation}\n }`;\n } else if (hasLeakyReluAlpha) {\n activationSnippet = `vec4 activation(vec4 a) {\n vec4 b = getLeakyreluAlphaAtOutCoords();\n ${activation}\n }`;\n } else {\n activationSnippet = `vec4 activation(vec4 x) {\n ${activation}\n }`;\n }\n\n applyActivationSnippet = `result = activation(result);`;\n }\n\n const addBiasSnippet = addBias ? 'result += getBiasAtOutCoords();' : '';\n if (addBias) {\n this.variableNames.push('bias');\n }\n\n if (hasPreluActivation) {\n this.variableNames.push('preluActivationWeights');\n }\n if (hasLeakyReluAlpha) {\n this.variableNames.push('leakyreluAlpha');\n }\n\n this.userCode = `\n ${activationSnippet}\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords.x;\n ivec2 xRCCorner = coords.yz * strides - pads;\n int d2 = coords.w;\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n //intialize dotProd with a small epsilon seems to reduce GPU accuracy loss.\n vec4 dotProd = vec4(0.000000000000001);\n\n ${mainLoop}\n\n vec4 result = dotProd - vec4(0.000000000000001);\n ${addBiasSnippet}\n ${applyActivationSnippet}\n setOutput(result);\n }\n `;\n }\n }\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {getGlslDifferences} from './glsl_version';\nimport {GPGPUProgram, useShapeUniforms} from './gpgpu_math';\n\nexport class Im2ColPackedProgram implements GPGPUProgram {\n variableNames = ['A'];\n packedInputs = true;\n packedOutput = true;\n outputShape: number[];\n userCode: string;\n enableShapeUniforms: boolean;\n customUniforms = [\n {name: 'inputShape', type: 'ivec4' as const },\n {name: 'pad', type: 'ivec2' as const },\n {name: 'stride', type: 'ivec2' as const },\n {name: 'dilation', type: 'ivec2' as const },\n {name: 'inChannels', type: 'int' as const },\n {name: 'itemsPerBlockRow', type: 'int' as const },\n {name: 'outWidth', type: 'int' as const },\n ];\n\n constructor(outputShape: number[], convInfo: backend_util.Conv2DInfo) {\n this.outputShape = outputShape;\n this.enableShapeUniforms = useShapeUniforms(this.outputShape.length);\n const {dataFormat} = convInfo;\n const glsl = getGlslDifferences();\n const isChannelsLast = dataFormat === 'channelsLast';\n const rowDim = isChannelsLast ? 1 : 2;\n const colDim = isChannelsLast ? 2 : 3;\n\n const boundsCheckingSnippet = this.enableShapeUniforms ?\n 'if(blockIndex < outShape[2] && pos < outShape[1]) {' :\n `if(blockIndex < ${outputShape[2]} && pos < ${outputShape[1]}) {`;\n let unrolled = ``;\n\n for (let row = 0; row <= 1; row++) {\n for (let col = 0; col <= 1; col++) {\n unrolled += `\n blockIndex = rc.z + ${col};\n pos = rc.y + ${row};\n\n ${boundsCheckingSnippet}\n offsetY = int(blockIndex / outWidth) * stride[0] - pad[0];\n d0 = offsetY + dilation[0] * (pos / itemsPerBlockRow);\n\n if(d0 < inputShape[${rowDim}] && d0 >= 0) {\n // Use custom imod instead mod. On Intel GPU, mod may generate\n // unexpected value.\n // https://github.com/tensorflow/tfjs/issues/5447\n offsetX = imod(blockIndex, outWidth) * stride[1] - pad[1];\n d1 = offsetX + dilation[1] * (imod(pos, itemsPerBlockRow) /\n inChannels);\n\n if(d1 < inputShape[${colDim}] && d1 >= 0) {\n\n ch = imod(pos, inChannels);\n\n if (${isChannelsLast}) {\n innerDims = vec2(d1, ch);\n result[${row * 2 + col}] = getChannel(\n getA(rc.x, d0, int(innerDims.x),\n int(innerDims.y)), innerDims);\n } else {\n innerDims = vec2(d0, d1);\n result[${row * 2 + col}] = getChannel(\n getA(rc.x, ch, int(innerDims.x),\n int(innerDims.y)), innerDims);\n }\n }\n }\n }\n `;\n }\n }\n\n this.userCode = `\n void main() {\n ivec3 rc = getOutputCoords();\n\n vec4 result = vec4(0);\n\n int blockIndex, pos, offsetY, d0, offsetX, d1, ch;\n vec2 innerDims;\n\n ${unrolled}\n\n ${glsl.output} = result;\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, TensorInfo, util} from '@tensorflow/tfjs-core';\n\n// import {assertAndGetBroadcastShape} from\n// '../../../tfjs-core/src/ops/broadcast_util';\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {Im2ColPackedProgram} from '../im2col_packed_gpu';\nimport {mapActivationToShaderProgram} from '../kernel_utils/kernel_funcs_utils';\nimport {MatMulPackedProgram} from '../mulmat_packed_gpu';\nimport * as webgl_util from '../webgl_util';\n\nimport {batchMatMulImpl, MATMUL_SHARED_DIM_THRESHOLD} from './BatchMatMul_impl';\nimport {identity} from './Identity';\nimport {reshape} from './Reshape';\n\ntype Conv2DConfig = {\n x: TensorInfo,\n filter: TensorInfo,\n convInfo: backend_util.Conv2DInfo,\n backend: MathBackendWebGL,\n bias?: TensorInfo,\n preluActivationWeights?: TensorInfo,\n leakyreluAlpha?: number,\n activation?: backend_util.Activation\n};\n\n// Both conv2dByMatMul and conv2dWithIm2Row fuse height and width into one\n// dimension to compute batchMatMul, so bias and activation weights are also\n// supposed to fuse the two dimensions into one.\n//\n// This function computes the target shape for fusing height and width\n// dimensions. Returning null means the shape is already compatible.\n//\n// Even though the bias is not supposed to be a 3-D or a 4-D (including\n// batch) tensor and PReLU activiation weights is not supposed to be a 4-D\n// tensor, we still need to support them, because we haven't disabled\n// them for NHWC format.\n// https://github.com/tensorflow/tfjs/blob/b53bd47e880367ae57493f0ea628abaf08db2d5d/tfjs-core/src/ops/fused/conv2d.ts#L181-L196\nfunction getShapeForBatchMatMul(\n shape: number[], isChannelsLast: boolean): number[] {\n const length = shape.length;\n if (length >= 3) {\n return isChannelsLast ?\n [\n ...shape.slice(0, -3) /* batch */,\n shape[length - 3] * shape[length - 2] /* height * width */,\n shape[length - 1] /* channel */\n ] :\n [\n ...shape.slice(0, -3) /* batch */, shape[length - 3] /* channel */,\n shape[length - 2] * shape[length - 1] /* height * width */\n ];\n } else if (!isChannelsLast && length === 1 && shape[0] > 1) {\n return [shape[0], 1];\n } else {\n return null;\n }\n}\n\n// For 1x1 kernels that iterate through every point in the input, convolution\n// can be expressed as matrix multiplication (without need for memory\n// remapping).\nexport function conv2dByMatMul({\n x,\n filter,\n convInfo,\n backend,\n bias = null,\n preluActivationWeights = null,\n leakyreluAlpha = 0,\n activation = null\n}: Conv2DConfig) {\n // Reshapes conv2D input to 2D tensors, uses matMul and then reshape the\n // result from 2D to 4D.\n const xShape = x.shape;\n const xTexData = backend.texData.get(x.dataId);\n const sharedMatMulDim = convInfo.inChannels;\n const outerShapeX = xShape[0] * xShape[1] * xShape[2];\n const outerShapeFilter = convInfo.outChannels;\n const isChannelsLast = convInfo.dataFormat === 'channelsLast';\n const transposeA = false;\n const transposeB = false;\n\n let out: TensorInfo;\n const intermediates: TensorInfo[] = [];\n\n if (preluActivationWeights != null) {\n const targetShape =\n getShapeForBatchMatMul(preluActivationWeights.shape, isChannelsLast);\n if (targetShape != null) {\n preluActivationWeights = reshape({\n inputs: {x: preluActivationWeights},\n backend,\n attrs: {shape: targetShape}\n });\n intermediates.push(preluActivationWeights);\n }\n }\n\n if (bias != null) {\n const targetShape = getShapeForBatchMatMul(bias.shape, isChannelsLast);\n if (targetShape != null) {\n bias = reshape({inputs: {x: bias}, backend, attrs: {shape: targetShape}});\n intermediates.push(bias);\n }\n }\n\n // TODO: Once reduction ops are packed, batchMatMul will always be packed\n // and we can remove this condition.\n const batchMatMulWillBeUnpacked =\n (outerShapeX === 1 || outerShapeFilter === 1) &&\n sharedMatMulDim > MATMUL_SHARED_DIM_THRESHOLD;\n\n // The algorithm in the if condition assumes (1) the output will be packed,\n // (2) x is packed, (3) x isChannelsLast, (4) x's packed texture is already\n // on GPU, (5) col is odd, (6) the width, height and inChannels are the same\n // for xTexData.shape and xShape.\n const canOptimize = !batchMatMulWillBeUnpacked && xTexData.isPacked &&\n isChannelsLast && xTexData.texture != null && xShape[2] % 2 !== 0 &&\n util.arraysEqual(xTexData.shape.slice(-3), xShape.slice(-3));\n\n if (canOptimize) {\n // We avoid expensive packed 2x2 reshape by padding col count to next,\n // even number. When col is odd, the result of packed batchMatMul is\n // the same (has the same texture layout and and values in the texture) as\n // it is for next even col. We make the odd-cols tensor to look like\n // even-cols tensor before the operation and, after the batchMatMul,\n // fix the even-cols result to have odd number of cols.\n const targetShape = xShape[0] * xShape[1] * (xShape[2] + 1);\n const xReshaped: TensorInfo = {\n dataId: x.dataId,\n shape: [1, targetShape, convInfo.inChannels],\n dtype: x.dtype\n };\n // xTexData.shape gets referenced from GPGPUBinary.inShapeInfos.\n // Decrementing col count, after batchMatMul->...->compileProgram leads to\n // invalid col count within the reference in GPGPUBinary.inShapeInfos.\n // Alternative fix would be to provide a copy to GPGPUBinary.inShapeInfos\n // in compileProgram method, but that would affect compilation of all\n // programs - instead, provide a copy here, with even col count, before\n // calling batchMatMul->...->compileProgram and after that, the original\n // xTexData.shape is restored.\n const originalXTexDataShape = xTexData.shape;\n xTexData.shape = xTexData.shape.slice();\n xTexData.shape[xTexData.shape.length - 2]++;\n util.assert(\n webgl_util.isReshapeFree(xTexData.shape, xReshaped.shape),\n () => `packed reshape ${xTexData.shape} to ${\n xReshaped.shape} isn't free`);\n const filterReshaped = reshape({\n inputs: {x: filter},\n backend,\n attrs: {shape: [1, convInfo.inChannels, convInfo.outChannels]}\n });\n intermediates.push(filterReshaped);\n const pointwiseConv = batchMatMulImpl({\n a: xReshaped,\n b: filterReshaped,\n backend,\n transposeA,\n transposeB,\n bias,\n activation,\n preluActivationWeights,\n leakyreluAlpha\n });\n\n const pointwiseConvTexData = backend.texData.get(pointwiseConv.dataId);\n util.assert(\n pointwiseConvTexData.isPacked,\n () => 'batchMatMul result is expected to be packed');\n // Restore the input shape to original.\n xTexData.shape = originalXTexDataShape;\n // Set the output shape - there is no need for expensive reshape as data\n // layout is already correct.\n pointwiseConvTexData.shape = convInfo.outShape;\n\n out = identity({inputs: {x: pointwiseConv}, backend});\n out.shape = convInfo.outShape;\n\n intermediates.push(pointwiseConv);\n } else {\n const numCols = convInfo.outHeight * convInfo.outWidth;\n const xReshaped = reshape({\n inputs: {x},\n backend,\n attrs: {\n shape: isChannelsLast ?\n [convInfo.batchSize, numCols, convInfo.inChannels] :\n [convInfo.batchSize, convInfo.inChannels, numCols]\n }\n });\n const filterReshaped = reshape({\n inputs: {x: filter},\n backend,\n attrs: {shape: [1, convInfo.inChannels, convInfo.outChannels]}\n });\n const result = batchMatMulImpl({\n a: isChannelsLast ? xReshaped : filterReshaped,\n b: isChannelsLast ? filterReshaped : xReshaped,\n transposeA: !isChannelsLast,\n transposeB,\n backend,\n bias,\n activation,\n preluActivationWeights,\n leakyreluAlpha\n });\n\n out = reshape(\n {inputs: {x: result}, backend, attrs: {shape: convInfo.outShape}});\n\n intermediates.push(xReshaped);\n intermediates.push(filterReshaped);\n intermediates.push(result);\n }\n\n for (const i of intermediates) {\n backend.disposeIntermediateTensorInfo(i);\n }\n\n return out;\n}\n\n// Implements the im2row algorithm as outlined in \"High Performance\n// Convolutional Neural Networks for Document Processing\" (Suvisoft, 2006)\nexport function conv2dWithIm2Row({\n x,\n filter,\n convInfo,\n backend,\n bias = null,\n preluActivationWeights = null,\n leakyreluAlpha = 0,\n activation = null\n}: Conv2DConfig) {\n // Rearranges conv2d input so each block to be convolved over forms the\n // column of a new matrix with shape [filterWidth * filterHeight *\n // inChannels, outHeight * outWidth]. The filter is also rearranged so each\n // output channel forms a row of a new matrix with shape [outChannels,\n // filterWidth * filterHeight * inChannels]. The convolution is then\n // computed by multiplying these matrices and reshaping the result.\n const {\n filterWidth,\n filterHeight,\n inChannels,\n outWidth,\n outHeight,\n dataFormat\n } = convInfo;\n\n const isChannelsLast = dataFormat === 'channelsLast';\n\n const sharedDim = filterWidth * filterHeight * inChannels;\n const numCols = outHeight * outWidth;\n const x2ColShape = [convInfo.batchSize, sharedDim, numCols];\n const transposeA = true;\n const transposeB = false;\n\n const intermediates: TensorInfo[] = [];\n\n if (preluActivationWeights != null) {\n const targetShape =\n getShapeForBatchMatMul(preluActivationWeights.shape, isChannelsLast);\n if (targetShape != null) {\n preluActivationWeights = reshape({\n inputs: {x: preluActivationWeights},\n backend,\n attrs: {shape: targetShape}\n });\n intermediates.push(preluActivationWeights);\n }\n }\n\n if (bias != null) {\n const targetShape = getShapeForBatchMatMul(bias.shape, isChannelsLast);\n if (targetShape != null) {\n bias = reshape({inputs: {x: bias}, backend, attrs: {shape: targetShape}});\n intermediates.push(bias);\n }\n }\n\n const w2Row = reshape({\n inputs: {x: filter},\n backend,\n attrs: {shape: [1, sharedDim, util.sizeFromShape(filter.shape) / sharedDim]}\n });\n intermediates.push(w2Row);\n\n const im2ColProgram = new Im2ColPackedProgram(x2ColShape, convInfo);\n const customValues = [\n x.shape, [convInfo.padInfo.top, convInfo.padInfo.left],\n [convInfo.strideHeight, convInfo.strideWidth],\n [convInfo.dilationHeight, convInfo.dilationWidth], [convInfo.inChannels],\n [convInfo.filterWidth * convInfo.inChannels], [convInfo.outWidth]\n ];\n const im2Col =\n backend.runWebGLProgram(im2ColProgram, [x], 'float32', customValues);\n const im2ColReshaped =\n reshape({inputs: {x: im2Col}, backend, attrs: {shape: x2ColShape}});\n\n intermediates.push(im2Col);\n intermediates.push(im2ColReshaped);\n\n const hasBias = bias != null;\n const hasPreluActivationWeights = preluActivationWeights != null;\n const hasLeakyreluAlpha = activation === 'leakyrelu';\n const fusedActivation =\n activation ? mapActivationToShaderProgram(activation, true) : null;\n const matmulProgram = new MatMulPackedProgram(\n isChannelsLast ? im2ColReshaped.shape as [number, number, number] :\n w2Row.shape as [number, number, number],\n isChannelsLast ? w2Row.shape as [number, number, number] :\n im2ColReshaped.shape as [number, number, number],\n isChannelsLast ? [convInfo.batchSize, numCols, convInfo.outChannels] :\n [convInfo.batchSize, convInfo.outChannels, numCols],\n transposeA, transposeB, hasBias, fusedActivation,\n hasPreluActivationWeights, hasLeakyreluAlpha);\n const inputs: TensorInfo[] =\n isChannelsLast ? [im2ColReshaped, w2Row] : [w2Row, im2ColReshaped];\n if (bias) {\n inputs.push(bias);\n }\n if (hasPreluActivationWeights) {\n inputs.push(preluActivationWeights);\n }\n if (hasLeakyreluAlpha) {\n const $leakyreluAlpha = backend.makeTensorInfo(\n [], 'float32',\n util.createScalarValue(leakyreluAlpha as {} as 'float32', 'float32'));\n inputs.push($leakyreluAlpha);\n intermediates.push($leakyreluAlpha);\n }\n const product = backend.runWebGLProgram(matmulProgram, inputs, 'float32');\n const out = reshape(\n {inputs: {x: product}, backend, attrs: {shape: convInfo.outShape}});\n\n intermediates.push(product);\n for (const i of intermediates) {\n backend.disposeIntermediateTensorInfo(i);\n }\n\n return out;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, Conv2D, Conv2DAttrs, Conv2DInputs, env, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {Conv2DProgram} from '../conv_gpu';\nimport {Conv2DPackedProgram} from '../conv_packed_gpu';\nimport {conv2dByMatMul, conv2dWithIm2Row} from './Conv2D_impl';\nimport {reshape} from './Reshape';\n\nexport function conv2d(\n args:\n {inputs: Conv2DInputs, attrs: Conv2DAttrs, backend: MathBackendWebGL}) {\n const {inputs, backend, attrs} = args;\n const {x, filter} = inputs;\n const {strides, pad, dataFormat, dilations, dimRoundingMode} = attrs;\n\n const $dataFormat = backend_util.convertConv2DDataFormat(dataFormat);\n const convInfo = backend_util.computeConv2DInfo(\n x.shape as [number, number, number, number],\n filter.shape as [number, number, number, number], strides, dilations, pad,\n dimRoundingMode, false /* depthwise */, $dataFormat);\n let out: TensorInfo;\n\n if (convInfo.filterHeight === 1 && convInfo.filterWidth === 1 &&\n convInfo.dilationHeight === 1 && convInfo.dilationWidth === 1 &&\n convInfo.strideHeight === 1 && convInfo.strideWidth === 1 &&\n (convInfo.padInfo.type === 'SAME' || convInfo.padInfo.type === 'VALID')) {\n out = conv2dByMatMul({x, filter, convInfo, backend});\n } else if (convInfo.strideWidth <= 2 && $dataFormat === 'channelsLast'\n && env().getBool('WEBGL_EXP_CONV')\n ) {\n const program = new Conv2DPackedProgram(convInfo);\n const customValues = [\n [convInfo.padInfo.top, convInfo.padInfo.left],\n [convInfo.strideHeight, convInfo.strideWidth],\n [convInfo.dilationHeight, convInfo.dilationWidth],\n [convInfo.inHeight, convInfo.inWidth]\n ];\n out =\n backend.runWebGLProgram(program, [x, filter], 'float32', customValues);\n } else if (env().getBool('WEBGL_CONV_IM2COL')) {\n out = conv2dWithIm2Row({x, filter, convInfo, backend});\n } else {\n const program = new Conv2DProgram(convInfo);\n out = backend.runWebGLProgram(program, [x, filter], 'float32');\n }\n\n const outReshaped =\n reshape({inputs: {x: out}, backend, attrs: {shape: convInfo.outShape}});\n backend.disposeIntermediateTensorInfo(out);\n\n return outReshaped;\n}\n\nexport const conv2DConfig: KernelConfig = {\n kernelName: Conv2D,\n backendName: 'webgl',\n kernelFunc: conv2d as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class Conv2DDerFilterProgram implements GPGPUProgram {\n variableNames = ['x', 'dy'];\n outputShape: number[];\n userCode: string;\n\n constructor(convInfo: backend_util.Conv2DInfo) {\n this.outputShape = convInfo.filterShape;\n\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n const padTop = convInfo.padInfo.top;\n const padLeft = convInfo.padInfo.left;\n const isChannelsLast = convInfo.dataFormat === 'channelsLast';\n\n this.userCode = `\n void main() {\n ivec4 coords = getOutputCoords();\n int wR = coords.x;\n int wC = coords.y;\n int d1 = coords.z;\n int d2 = coords.w;\n\n // Convolve x(?, ?, d1) with dy(:, :, d2) to get dw(wR, wC, d1, d2).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n\n for (int b = 0; b < ${convInfo.batchSize}; b++) {\n for (int yR = 0; yR < ${convInfo.outHeight}; yR++) {\n int xR = wR + yR * ${strideHeight} - ${padTop};\n\n if (xR < 0 || xR >= ${convInfo.inHeight}) {\n continue;\n }\n\n for (int yC = 0; yC < ${convInfo.outWidth}; yC++) {\n int xC = wC + yC * ${strideWidth} - ${padLeft};\n\n if (xC < 0 || xC >= ${convInfo.inWidth}) {\n continue;\n }\n\n if (${isChannelsLast}) {\n float dyValue = getDy(b, yR, yC, d2);\n float xValue = getX(b, xR, xC, d1);\n dotProd += (xValue * dyValue);\n } else {\n float dyValue = getDy(b, d2, yR, yC);\n float xValue = getX(b, d1, xR, xC);\n dotProd += (xValue * dyValue);\n }\n\n }\n }\n }\n setOutput(dotProd);\n }\n `;\n }\n}\n\nexport class Conv2DDerInputProgram implements GPGPUProgram {\n variableNames = ['dy', 'W'];\n outputShape: number[];\n userCode: string;\n\n constructor(convInfo: backend_util.Conv2DInfo) {\n this.outputShape = convInfo.inShape;\n\n const filterHeight = convInfo.filterHeight;\n const filterWidth = convInfo.filterWidth;\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n const isChannelsLast = convInfo.dataFormat === 'channelsLast';\n\n const padTop = filterHeight - 1 - convInfo.padInfo.top;\n const padLeft = filterWidth - 1 - convInfo.padInfo.left;\n\n const rowDim = isChannelsLast ? 1 : 2;\n const colDim = isChannelsLast ? 2 : 3;\n const channelDim = isChannelsLast ? 3 : 1;\n\n this.userCode = `\n const ivec2 pads = ivec2(${padTop}, ${padLeft});\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d1 = coords[${channelDim}];\n\n ivec2 dyCorner = ivec2(coords[${rowDim}], coords[${colDim}]) - pads;\n int dyRCorner = dyCorner.x;\n int dyCCorner = dyCorner.y;\n\n // Convolve dy(?, ?, d2) with w(:, :, d1, d2) to compute dx(xR, xC, d1).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < ${filterHeight}; wR++) {\n float dyR = float(dyRCorner + wR) / ${strideHeight}.0;\n\n if (dyR < 0.0 || dyR >= ${convInfo.outHeight}.0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = ${filterHeight} - 1 - wR;\n\n for (int wC = 0; wC < ${filterWidth}; wC++) {\n float dyC = float(dyCCorner + wC) / ${strideWidth}.0;\n\n if (dyC < 0.0 || dyC >= ${convInfo.outWidth}.0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n int wCPerm = ${filterWidth} - 1 - wC;\n\n for (int d2 = 0; d2 < ${convInfo.outChannels}; d2++) {\n\n if (${isChannelsLast}) {\n float xValue = getDy(batch, idyR, idyC, d2);\n float wValue = getW(wRPerm, wCPerm, d1, d2);\n dotProd += xValue * wValue;\n } else {\n float xValue = getDy(batch, d2, idyR, idyC);\n float wValue = getW(wRPerm, wCPerm, d1, d2);\n dotProd += xValue * wValue;\n }\n\n }\n }\n }\n setOutput(dotProd);\n }\n `;\n }\n}\n\nexport class Conv3DDerFilterProgram implements GPGPUProgram {\n variableNames = ['x', 'dy'];\n outputShape: number[];\n userCode: string;\n\n constructor(convInfo: backend_util.Conv3DInfo) {\n this.outputShape = convInfo.filterShape;\n\n const strideDepth = convInfo.strideDepth;\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n const padFront = convInfo.padInfo.front;\n const padTop = convInfo.padInfo.top;\n const padLeft = convInfo.padInfo.left;\n\n this.userCode = `\n void main() {\n ivec5 coords = getOutputCoords();\n int wF = coords.x;\n int wR = coords.y;\n int wC = coords.z;\n int d1 = coords.w;\n int d2 = coords.u;\n\n float dotProd = 0.0;\n\n for (int b = 0; b < ${convInfo.batchSize}; b++) {\n for (int yF = 0; yF < ${convInfo.outDepth}; yF++) {\n int xF = wF + yF * ${strideDepth} - ${padFront};\n\n if (xF < 0 || xF >= ${convInfo.inDepth}) {\n continue;\n }\n\n for (int yR = 0; yR < ${convInfo.outHeight}; yR++) {\n int xR = wR + yR * ${strideHeight} - ${padTop};\n\n if (xR < 0 || xR >= ${convInfo.inHeight}) {\n continue;\n }\n\n for (int yC = 0; yC < ${convInfo.outWidth}; yC++) {\n int xC = wC + yC * ${strideWidth} - ${padLeft};\n\n if (xC < 0 || xC >= ${convInfo.inWidth}) {\n continue;\n }\n\n float dyValue = getDy(b, yF, yR, yC, d2);\n float xValue = getX(b, xF, xR, xC, d1);\n dotProd += (xValue * dyValue);\n }\n }\n }\n }\n setOutput(dotProd);\n }\n `;\n }\n}\n\nexport class Conv3DDerInputProgram implements GPGPUProgram {\n variableNames = ['dy', 'W'];\n outputShape: number[];\n userCode: string;\n\n constructor(convInfo: backend_util.Conv3DInfo) {\n this.outputShape = convInfo.inShape;\n\n const filterDepth = convInfo.filterDepth;\n const filterHeight = convInfo.filterHeight;\n const filterWidth = convInfo.filterWidth;\n const strideDepth = convInfo.strideDepth;\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n\n const padFront = filterDepth - 1 - convInfo.padInfo.front;\n const padTop = filterHeight - 1 - convInfo.padInfo.top;\n const padLeft = filterWidth - 1 - convInfo.padInfo.left;\n\n this.userCode = `\n const ivec3 pads = ivec3(${padFront}, ${padTop}, ${padLeft});\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int d1 = coords.u;\n\n\n ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;\n int dyFCorner = dyCorner.x;\n int dyRCorner = dyCorner.y;\n int dyCCorner = dyCorner.z;\n\n float dotProd = 0.0;\n for (int wF = 0; wF < ${filterDepth}; wF++) {\n float dyF = float(dyFCorner + wF) / ${strideDepth}.0;\n\n if (dyF < 0.0 || dyF >= ${convInfo.outDepth}.0 || fract(dyF) > 0.0) {\n continue;\n }\n int idyF = int(dyF);\n\n int wFPerm = ${filterDepth} - 1 - wF;\n\n for (int wR = 0; wR < ${filterHeight}; wR++) {\n float dyR = float(dyRCorner + wR) / ${strideHeight}.0;\n\n if (dyR < 0.0 || dyR >= ${convInfo.outHeight}.0 ||\n fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = ${filterHeight} - 1 - wR;\n\n for (int wC = 0; wC < ${filterWidth}; wC++) {\n float dyC = float(dyCCorner + wC) / ${strideWidth}.0;\n\n if (dyC < 0.0 || dyC >= ${convInfo.outWidth}.0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n int wCPerm = ${filterWidth} - 1 - wC;\n\n for (int d2 = 0; d2 < ${convInfo.outChannels}; d2++) {\n float xValue = getDy(batch, idyF, idyR, idyC, d2);\n float wValue = getW(wFPerm, wRPerm, wCPerm, d1, d2);\n dotProd += xValue * wValue;\n }\n }\n }\n }\n setOutput(dotProd);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, Conv2DBackpropFilter, Conv2DBackpropFilterAttrs, Conv2DBackpropFilterInputs, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {Conv2DDerFilterProgram} from '../conv_backprop_gpu';\n\nexport function conv2DBackpropFilter(args: {\n inputs: Conv2DBackpropFilterInputs,\n attrs: Conv2DBackpropFilterAttrs,\n backend: MathBackendWebGL\n}) {\n const {inputs, backend, attrs} = args;\n const {x, dy} = inputs;\n const {strides, pad, dataFormat, dimRoundingMode, filterShape} = attrs;\n\n const $dataFormat = backend_util.convertConv2DDataFormat(dataFormat);\n const convInfo = backend_util.computeConv2DInfo(\n x.shape as [number, number, number, number], filterShape, strides,\n 1 /* dilations */, pad, dimRoundingMode, false /* depthwise */,\n $dataFormat);\n\n const program = new Conv2DDerFilterProgram(convInfo);\n return backend.runWebGLProgram(program, [x, dy], 'float32');\n}\n\nexport const conv2DBackpropFilterConfig: KernelConfig = {\n kernelName: Conv2DBackpropFilter,\n backendName: 'webgl',\n kernelFunc: conv2DBackpropFilter as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, Conv2DBackpropInput, Conv2DBackpropInputAttrs, Conv2DBackpropInputInputs, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {Conv2DDerInputProgram} from '../conv_backprop_gpu';\n\nexport function conv2DBackpropInput(args: {\n inputs: Conv2DBackpropInputInputs,\n attrs: Conv2DBackpropInputAttrs,\n backend: MathBackendWebGL\n}) {\n const {inputs, backend, attrs} = args;\n const {dy, filter} = inputs;\n const {inputShape, strides, pad, dataFormat, dimRoundingMode} = attrs;\n\n const $dataFormat = backend_util.convertConv2DDataFormat(dataFormat);\n const convInfo = backend_util.computeConv2DInfo(\n inputShape, filter.shape as [number, number, number, number], strides,\n 1 /* dilations */, pad, dimRoundingMode, false, $dataFormat);\n\n const program = new Conv2DDerInputProgram(convInfo);\n return backend.runWebGLProgram(program, [dy, filter], 'float32');\n}\n\nexport const conv2DBackpropInputConfig: KernelConfig = {\n kernelName: Conv2DBackpropInput,\n backendName: 'webgl',\n kernelFunc: conv2DBackpropInput as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, Conv3D, Conv3DAttrs, Conv3DInputs, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {Conv3DProgram} from '../conv_gpu';\n\nexport function conv3D(\n args:\n {inputs: Conv3DInputs, attrs: Conv3DAttrs, backend: MathBackendWebGL}) {\n const {inputs, backend, attrs} = args;\n const {x, filter} = inputs;\n const {strides, pad, dilations} = attrs;\n\n const convInfo = backend_util.computeConv3DInfo(\n x.shape as [number, number, number, number, number],\n filter.shape as [number, number, number, number, number], strides,\n dilations, pad);\n\n const program = new Conv3DProgram(convInfo);\n return backend.runWebGLProgram(program, [x, filter], 'float32');\n}\n\nexport const conv3DConfig: KernelConfig = {\n kernelName: Conv3D,\n backendName: 'webgl',\n kernelFunc: conv3D as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, Conv3DBackpropFilterV2, Conv3DBackpropFilterV2Attrs, Conv3DBackpropFilterV2Inputs, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {Conv3DDerFilterProgram} from '../conv_backprop_gpu';\n\nexport function conv3DBackpropFilterV2(args: {\n inputs: Conv3DBackpropFilterV2Inputs,\n attrs: Conv3DBackpropFilterV2Attrs,\n backend: MathBackendWebGL\n}) {\n const {inputs, backend, attrs} = args;\n const {x, dy} = inputs;\n const {strides, pad, filterShape} = attrs;\n\n const convInfo = backend_util.computeConv3DInfo(\n x.shape as [number, number, number, number, number], filterShape, strides,\n 1 /* dilations */, pad);\n\n const program = new Conv3DDerFilterProgram(convInfo);\n return backend.runWebGLProgram(program, [x, dy], 'float32');\n}\n\nexport const conv3DBackpropFilterV2Config: KernelConfig = {\n kernelName: Conv3DBackpropFilterV2,\n backendName: 'webgl',\n kernelFunc: conv3DBackpropFilterV2 as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, Conv3DBackpropInputV2, Conv3DBackpropInputV2Attrs, Conv3DBackpropInputV2Inputs, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {Conv3DDerInputProgram} from '../conv_backprop_gpu';\n\nexport function conv3DBackpropInput(args: {\n inputs: Conv3DBackpropInputV2Inputs,\n attrs: Conv3DBackpropInputV2Attrs,\n backend: MathBackendWebGL\n}) {\n const {inputs, backend, attrs} = args;\n const {dy, filter} = inputs;\n const {pad, strides, inputShape} = attrs;\n\n const convInfo = backend_util.computeConv3DInfo(\n inputShape, filter.shape as [number, number, number, number, number],\n strides, 1 /* dilations */, pad);\n\n const program = new Conv3DDerInputProgram(convInfo);\n return backend.runWebGLProgram(program, [dy, filter], 'float32');\n}\n\nexport const conv3DBackpropInputConfig: KernelConfig = {\n kernelName: Conv3DBackpropInputV2,\n backendName: 'webgl',\n kernelFunc: conv3DBackpropInput as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Cos, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {CHECK_NAN_SNIPPET_UNARY, unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst COS = CHECK_NAN_SNIPPET_UNARY + `\n return cos(x);\n`;\n\nexport const cos = unaryKernelFunc({opSnippet: COS});\n\nexport const cosConfig: KernelConfig = {\n kernelName: Cos,\n backendName: 'webgl',\n kernelFunc: cos,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Cosh, KernelConfig} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst COSH = `\n float e2x = exp(-x);\n return (e2x + 1.0 / e2x) / 2.0;\n`;\n\nexport const cosh = unaryKernelFunc({opSnippet: COSH});\n\nexport const coshConfig: KernelConfig = {\n kernelName: Cosh,\n backendName: 'webgl',\n kernelFunc: cosh,\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class CropAndResizeProgram implements GPGPUProgram {\n variableNames = ['Image', 'Boxes', 'BoxInd'];\n outputShape: number[] = [];\n userCode: string;\n\n constructor(\n imageShape: [number, number, number, number], boxShape: [number, number],\n cropSize: [number, number], method: 'bilinear'|'nearest',\n extrapolationValue: number) {\n const [batch, imageHeight, imageWidth, depth] = imageShape;\n const [numBoxes, ] = boxShape;\n const [cropHeight, cropWidth] = cropSize;\n this.outputShape = [numBoxes, cropHeight, cropWidth, depth];\n const methodId = method === 'bilinear' ? 1 : 0;\n\n const [inputHeightFloat, inputWidthFloat] =\n [`${imageHeight - 1}.0`, `${imageWidth - 1}.0`];\n\n const [heightRatio, heightScale, inY] = cropHeight > 1 ?\n [\n `${(imageHeight - 1) / (cropHeight - 1)}`,\n '(y2-y1) * height_ratio',\n `y1*${inputHeightFloat} + float(y)*(height_scale)`,\n ] :\n [\n '0.0',\n '0.0',\n `0.5 * (y1+y2) * ${inputHeightFloat}`,\n ];\n const [widthRatio, widthScale, inX] = cropWidth > 1 ?\n [\n `${(imageWidth - 1) / (cropWidth - 1)}`,\n '(x2-x1) * width_ratio',\n `x1*${inputWidthFloat} + float(x)*(width_scale)`,\n ] :\n [\n '0.0',\n '0.0',\n `0.5 * (x1+x2) * ${inputWidthFloat}`,\n ];\n\n // Reference implementation\n // tslint:disable-next-line:max-line-length\n // https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/kernels/crop_and_resize_op_gpu.cu.cc\n this.userCode = `\n const float height_ratio = float(${heightRatio});\n const float width_ratio = float(${widthRatio});\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int y = coords[1];\n int x = coords[2];\n int d = coords[3];\n\n // get box vals\n float y1 = getBoxes(b,0);\n float x1 = getBoxes(b,1);\n float y2 = getBoxes(b,2);\n float x2 = getBoxes(b,3);\n\n // get image in batch index\n int bInd = round(getBoxInd(b));\n if(bInd < 0 || bInd >= ${batch}) {\n return;\n }\n\n float height_scale = ${heightScale};\n float width_scale = ${widthScale};\n\n float in_y = ${inY};\n if( in_y < 0.0 || in_y > ${inputHeightFloat} ) {\n setOutput(float(${extrapolationValue}));\n return;\n }\n float in_x = ${inX};\n if( in_x < 0.0 || in_x > ${inputWidthFloat} ) {\n setOutput(float(${extrapolationValue}));\n return;\n }\n\n vec2 sourceFracIndexCR = vec2(in_x,in_y);\n if(${methodId} == 1) {\n // Compute the four integer indices.\n ivec2 sourceFloorCR = ivec2(sourceFracIndexCR);\n ivec2 sourceCeilCR = ivec2(ceil(sourceFracIndexCR));\n\n float topLeft = getImage(b, sourceFloorCR.y, sourceFloorCR.x, d);\n float bottomLeft = getImage(b, sourceCeilCR.y, sourceFloorCR.x, d);\n float topRight = getImage(b, sourceFloorCR.y, sourceCeilCR.x, d);\n float bottomRight = getImage(b, sourceCeilCR.y, sourceCeilCR.x, d);\n\n vec2 fracCR = sourceFracIndexCR - vec2(sourceFloorCR);\n\n float top = topLeft + (topRight - topLeft) * fracCR.x;\n float bottom = bottomLeft + (bottomRight - bottomLeft) * fracCR.x;\n float newValue = top + (bottom - top) * fracCR.y;\n setOutput(newValue);\n } else {\n // Compute the coordinators of nearest neighbor point.\n ivec2 sourceNearestCR = ivec2(floor(\n sourceFracIndexCR + vec2(0.5,0.5)));\n float newValue = getImage(b, sourceNearestCR.y, sourceNearestCR.x, d);\n setOutput(newValue);\n }\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {CropAndResize, CropAndResizeAttrs, CropAndResizeInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {CropAndResizeProgram} from '../crop_and_resize_gpu';\n\nexport const cropAndResize = (args: {\n inputs: CropAndResizeInputs,\n backend: MathBackendWebGL,\n attrs: CropAndResizeAttrs\n}): TensorInfo => {\n const {inputs, backend, attrs} = args;\n const {image, boxes, boxInd} = inputs;\n const {cropSize, method, extrapolationValue} = attrs;\n\n const program = new CropAndResizeProgram(\n image.shape as [number, number, number, number],\n boxes.shape as [number, number], cropSize, method, extrapolationValue);\n return backend.runWebGLProgram(program, [image, boxes, boxInd], 'float32');\n};\n\nexport const cropAndResizeConfig: KernelConfig = {\n kernelName: CropAndResize,\n backendName: 'webgl',\n kernelFunc: cropAndResize as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {GPGPUProgram} from './gpgpu_math';\nimport {getCoordsDataType, UniformType} from './shader_compiler';\n\nexport enum CumOpType {\n Prod = '*',\n Sum = '+',\n}\n\nexport class CumProgram implements GPGPUProgram {\n variableNames = ['x'];\n userCode: string;\n customUniforms = [{name: 'index', type: 'float' as UniformType}];\n\n constructor(\n public op: CumOpType, public outputShape: number[], exclusive: boolean,\n reverse: boolean) {\n const rank = this.outputShape.length;\n const initVal = this.op === CumOpType.Prod ? '1.0' : '0.0';\n const val =\n exclusive ? initVal : `getX(${getCoords(rank, 'coords', this.op)})`;\n const length = this.outputShape[this.outputShape.length - 1];\n let condition = '';\n let idxString = '';\n // When exclusive is set, the cum op becomes roll op that copies the\n // value from the previous index based on the direction specified by the\n // reverse flag.\n if (exclusive) {\n condition = reverse ? `end != ${length - 1}` : 'end != 0';\n idxString = reverse ? 'end + 1' : 'end - 1';\n } else {\n condition = reverse ? `end + pow2 < ${length}` : 'end >= pow2';\n idxString = (reverse ? 'end + pow2' : 'end - pow2');\n }\n\n this.userCode = `\n void main() {\n ${getCoordsDataType(rank)} coords = getOutputCoords();\n int end = ${getFinalCoord(rank, 'coords', this.op)};\n float val = ${val};\n int pow2 = int(pow(2.0, index));\n if (${condition}) {\n int idx = ${idxString};\n ${getFinalCoord(rank, 'coords', this.op)} = idx;\n val ${this.op}= getX(${getCoords(rank, 'coords', this.op)});\n }\n setOutput(val);\n }\n `;\n }\n}\n\nfunction getCoords(rank: number, name: string, op: CumOpType): string {\n if (rank === 1) {\n return `${name}`;\n } else if (rank === 2) {\n return `${name}.x, ${name}.y`;\n } else if (rank === 3) {\n return `${name}.x, ${name}.y, ${name}.z`;\n } else if (rank === 4) {\n return `${name}.x, ${name}.y, ${name}.z, ${name}.w`;\n } else {\n throw new Error(`Cumulative ${op} for rank ${rank} is not yet supported`);\n }\n}\n\nfunction getFinalCoord(rank: number, name: string, op: CumOpType): string {\n if (rank === 1) {\n return `${name}`;\n } else if (rank === 2) {\n return `${name}.y`;\n } else if (rank === 3) {\n return `${name}.z`;\n } else if (rank === 4) {\n return `${name}.w`;\n } else {\n throw new Error(`Cumulative ${op} for rank ${rank} is not yet supported`);\n }\n}\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {CumOpType, CumProgram} from '../cum_gpu';\n\nimport {identity} from './Identity';\nimport {transpose} from './Transpose';\n\nexport function cumImpl(\n op: CumOpType, x: TensorInfo, backend: MathBackendWebGL, axis: number,\n exclusive: boolean, reverse: boolean): TensorInfo {\n const xRank = x.shape.length;\n const permutation = backend_util.getAxesPermutation([axis], xRank);\n let permutedX = x;\n if (permutation != null) {\n permutedX = transpose({inputs: {x}, backend, attrs: {perm: permutation}});\n }\n const permutedAxis = backend_util.getInnerMostAxes(1, xRank)[0];\n\n if (permutedAxis !== xRank - 1) {\n throw new Error(\n `WebGL cumprod shader expects an inner-most axis=${\n x.shape.length - 1} ` +\n `but got axis=${axis}`);\n }\n const size = permutedX.shape[permutedAxis];\n let result = identity({inputs: {x: permutedX}, backend});\n // Use cum parallel algorithm, inspired by:\n // https://developer.nvidia.com/gpugems/gpugems3/part-vi-gpu-computing/chapter-39-parallel-prefix-sum-scan-cuda\n // Note: although the algorithm is called sum, it works for any associtative\n // operator with an identity.\n\n for (let i = 0; i <= Math.ceil(Math.log2(size)) - 1; i++) {\n const program = new CumProgram(op, permutedX.shape, false, reverse);\n const customValues = [[i]];\n const prevResult = result;\n result =\n backend.runWebGLProgram(program, [result], result.dtype, customValues);\n backend.disposeIntermediateTensorInfo(prevResult);\n }\n // For exclusive cum, shift the end result in the direction of product or sum\n // and add 1 for product or 0 for sum to the front index.\n if (exclusive) {\n const program = new CumProgram(op, permutedX.shape, exclusive, reverse);\n const prevResult = result;\n result = backend.runWebGLProgram(program, [result], result.dtype);\n backend.disposeIntermediateTensorInfo(prevResult);\n }\n\n if (permutation != null) {\n const reversePermutation = backend_util.getUndoAxesPermutation(permutation);\n const reverseTransposedResult = transpose(\n {inputs: {x: result}, backend, attrs: {perm: reversePermutation}});\n\n backend.disposeIntermediateTensorInfo(result);\n backend.disposeIntermediateTensorInfo(permutedX);\n\n return reverseTransposedResult;\n }\n\n return result;\n}\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Cumprod, CumprodAttrs, CumprodInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {CumOpType} from '../cum_gpu';\nimport {cumImpl} from './Cum_impl';\n\nexport function cumprod(args: {\n inputs: CumprodInputs,\n backend: MathBackendWebGL,\n attrs: CumprodAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {axis, exclusive, reverse} = attrs;\n\n return cumImpl(CumOpType.Prod, x, backend, axis, exclusive, reverse);\n}\n\nexport const cumprodConfig: KernelConfig = {\n kernelName: Cumprod,\n backendName: 'webgl',\n kernelFunc: cumprod as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Cumsum, CumsumAttrs, CumsumInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {CumOpType} from '../cum_gpu';\nimport {cumImpl} from './Cum_impl';\n\nexport function cumsum(\n args:\n {inputs: CumsumInputs, backend: MathBackendWebGL, attrs: CumsumAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {axis, exclusive, reverse} = attrs;\n return cumImpl(CumOpType.Sum, x, backend, axis, exclusive, reverse);\n}\n\nexport const cumsumConfig: KernelConfig = {\n kernelName: Cumsum,\n backendName: 'webgl',\n kernelFunc: cumsum as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DenseBincount, DenseBincountAttrs, DenseBincountInputs, KernelConfig, KernelFunc, Rank, TensorInfo, TypedArray} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {bincountImplCPU, bincountReduceImplCPU} from '../kernel_utils/shared';\n\nexport function denseBincount(args: {\n inputs: DenseBincountInputs,\n backend: MathBackendWebGL,\n attrs: DenseBincountAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x, weights} = inputs;\n const {size, binaryOutput} = attrs;\n\n if (x.shape.length === 1) {\n const xVals = backend.readSync(x.dataId) as TypedArray;\n const weightsVals = backend.readSync(weights.dataId) as TypedArray;\n\n const outVals =\n bincountImplCPU(xVals, weightsVals, weights.dtype, weights.shape, size);\n\n return backend.makeTensorInfo([size], weights.dtype, outVals);\n } else if (x.shape.length === 2) {\n const xBuf = backend.bufferSync(x);\n const weightsBuf = backend.bufferSync(weights);\n\n const outBuf = bincountReduceImplCPU(xBuf, weightsBuf, size, binaryOutput);\n\n return backend.makeTensorInfo(outBuf.shape, weights.dtype, outBuf.values);\n }\n\n throw new Error(\n `Error in denseBincount: input must be at most rank 2, but got rank` +\n `${x.shape.length}.`);\n}\n\nexport const denseBincountConfig: KernelConfig = {\n kernelName: DenseBincount,\n backendName: 'webgl',\n kernelFunc: denseBincount as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class DepthToSpaceProgram implements GPGPUProgram {\n variableNames = ['x'];\n outputShape: number[] = [];\n userCode: string;\n blockSize: number;\n dataFormat: string;\n\n constructor(\n outputShape: number[], blockSize: number, dataFormat: 'NHWC'|'NCHW') {\n this.outputShape = outputShape;\n this.blockSize = blockSize;\n this.dataFormat = dataFormat;\n this.userCode = `\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int h = ${this.getHeightCoordString()};\n int w = ${this.getWidthCoordString()};\n int d = ${this.getDepthCoordString()};\n\n int in_h = h / ${blockSize};\n int offset_h = imod(h, ${blockSize});\n int in_w = w / ${blockSize};\n int offset_w = imod(w, ${blockSize});\n int offset_d = (offset_h * ${blockSize} + offset_w) *\n ${this.getOutputDepthSize()};\n int in_d = d + offset_d;\n\n float result = ${this.getInputSamplingString()};\n setOutput(result);\n }\n `;\n }\n\n private getHeightCoordString(): string {\n if (this.dataFormat === 'NHWC') {\n return `coords[1]`;\n } else {\n return `coords[2]`;\n }\n }\n\n private getWidthCoordString(): string {\n if (this.dataFormat === 'NHWC') {\n return `coords[2]`;\n } else {\n return `coords[3]`;\n }\n }\n\n private getDepthCoordString(): string {\n if (this.dataFormat === 'NHWC') {\n return `coords[3]`;\n } else {\n return `coords[1]`;\n }\n }\n\n private getOutputDepthSize(): number {\n if (this.dataFormat === 'NHWC') {\n return this.outputShape[3];\n } else {\n return this.outputShape[1];\n }\n }\n\n private getInputSamplingString(): string {\n if (this.dataFormat === 'NHWC') {\n return `getX(b, in_h, in_w, in_d)`;\n } else {\n return `getX(b, in_d, in_h, in_w)`;\n }\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DepthToSpace, DepthToSpaceAttrs, DepthToSpaceInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {DepthToSpaceProgram} from '../depth_to_space_gpu';\n\nexport function depthToSpace(args: {\n inputs: DepthToSpaceInputs,\n backend: MathBackendWebGL,\n attrs: DepthToSpaceAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {blockSize, dataFormat} = attrs;\n\n const batchSize = x.shape[0];\n const inputHeight = (dataFormat === 'NHWC') ? x.shape[1] : x.shape[2];\n const inputWidth = (dataFormat === 'NHWC') ? x.shape[2] : x.shape[3];\n const inputDepth = (dataFormat === 'NHWC') ? x.shape[3] : x.shape[1];\n\n const outputHeight = inputHeight * blockSize;\n const outputWidth = inputWidth * blockSize;\n const outputDepth = inputDepth / (blockSize * blockSize);\n\n const outputShape = (dataFormat === 'NHWC') ?\n [batchSize, outputHeight, outputWidth, outputDepth] :\n [batchSize, outputDepth, outputHeight, outputWidth];\n\n const program = new DepthToSpaceProgram(outputShape, blockSize, dataFormat);\n return backend.runWebGLProgram(program, [x], x.dtype);\n}\n\nexport const depthToSpaceConfig: KernelConfig = {\n kernelName: DepthToSpace,\n backendName: 'webgl',\n kernelFunc: depthToSpace as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {GPGPUProgram, useShapeUniforms} from './gpgpu_math';\n\nexport class DepthwiseConv2DProgram implements GPGPUProgram {\n variableNames = ['x', 'W'];\n outputShape: number[];\n userCode: string;\n enableShapeUniforms: boolean;\n customUniforms = [\n {name: 'pads', type: 'ivec2' as const },\n {name: 'strides', type: 'ivec2' as const },\n {name: 'dilations', type: 'ivec2' as const },\n {name: 'inDims', type: 'ivec2' as const },\n ];\n\n constructor(\n convInfo: backend_util.Conv2DInfo, addBias = false,\n activation: string = null, hasPreluActivation = false,\n hasLeakyReluAlpha = false) {\n this.outputShape = convInfo.outShape;\n this.enableShapeUniforms = useShapeUniforms(this.outputShape.length);\n\n const filterHeight = convInfo.filterHeight;\n const filterWidth = convInfo.filterWidth;\n const channelMul = convInfo.outChannels / convInfo.inChannels;\n\n let activationSnippet = '', applyActivationSnippet = '';\n if (activation) {\n if (hasPreluActivation) {\n activationSnippet = `float activation(float a) {\n float b = getPreluActivationWeightsAtOutCoords();\n ${activation}\n }`;\n } else if (hasLeakyReluAlpha) {\n activationSnippet = `float activation(float a) {\n float b = getLeakyreluAlphaAtOutCoords();\n ${activation}\n }`;\n } else {\n activationSnippet = `\n float activation(float x) {\n ${activation}\n }\n `;\n }\n\n applyActivationSnippet = `result = activation(result);`;\n }\n\n const addBiasSnippet = addBias ? 'result += getBiasAtOutCoords();' : '';\n if (addBias) {\n this.variableNames.push('bias');\n }\n\n if (hasPreluActivation) {\n this.variableNames.push('preluActivationWeights');\n }\n if (hasLeakyReluAlpha) {\n this.variableNames.push('leakyreluAlpha');\n }\n\n this.userCode = `\n ${activationSnippet}\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords.x;\n ivec2 xRCCorner = coords.yz * strides - pads;\n int d2 = coords.w;\n int d1 = d2 / ${channelMul};\n int q = d2 - d1 * ${channelMul};\n\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n // Convolve x(?, ?, d1) with w(:, :, d1, q) to get y(yR, yC, d2).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n // TO DO(dsmilkov): Flatten the two for loops and vec4 the operations.\n for (int wR = 0; wR < ${filterHeight}; wR++) {\n int xR = xRCorner + wR * dilations[0];\n\n if (xR < 0 || xR >= inDims[0]) {\n continue;\n }\n\n for (int wC = 0; wC < ${filterWidth}; wC++) {\n int xC = xCCorner + wC * dilations[1];\n\n if (xC < 0 || xC >= inDims[1]) {\n continue;\n }\n\n float xVal = getX(batch, xR, xC, d1);\n float wVal = getW(wR, wC, d1, q);\n dotProd += xVal * wVal;\n }\n }\n\n float result = dotProd;\n ${addBiasSnippet}\n ${applyActivationSnippet}\n setOutput(result);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, util} from '@tensorflow/tfjs-core';\n\nimport {GPGPUProgram, useShapeUniforms} from './gpgpu_math';\n\nexport class DepthwiseConvPacked2DProgram implements GPGPUProgram {\n variableNames = ['x', 'W'];\n packedInputs = true;\n packedOutput = true;\n outputShape: number[];\n userCode: string;\n enableShapeUniforms: boolean;\n customUniforms = [\n {name: 'pads', type: 'ivec2' as const },\n {name: 'strides', type: 'ivec2' as const },\n {name: 'dilations', type: 'ivec2' as const },\n {name: 'inDims', type: 'ivec2' as const },\n ];\n\n constructor(\n convInfo: backend_util.Conv2DInfo, addBias = false,\n activation: string = null, hasPreluActivation = false,\n hasLeakyReluAlpha = false) {\n this.outputShape = convInfo.outShape;\n this.enableShapeUniforms = useShapeUniforms(this.outputShape.length);\n const channelMul = convInfo.outChannels / convInfo.inChannels;\n const padLeft = convInfo.padInfo.left;\n const strideWidth = convInfo.strideWidth;\n const dilationWidth = convInfo.dilationWidth;\n const filterHeight = convInfo.filterHeight;\n const filterWidth = convInfo.filterWidth;\n const texelsAcross = filterWidth;\n\n let mainLoop = `\n int xR; int xC; int xCOffset;\n vec4 wTexel; vec4 previous; vec4 final;`;\n\n for (let c = 0; c < filterWidth; c++) {\n mainLoop += `\n vec4 xTexelC${c * 2};\n int xTexelC${c * 2}Ready;\n vec4 xTexelC${c * 2 + 1};\n int xTexelC${c * 2 + 1}Ready;\n vec4 xC${c};`;\n }\n\n /**\n * This vectorized implementation works by gathering the values needed for\n * each output channel's dot product into vec4's and then multiplying them\n * all together (this happens in the final double for-loop below). Most of\n * the main loop consists of constructing these vec4's with the minimum\n * number of texture2D calls, which means making use of all four returned\n * values from a texture2D call at once.\n */\n mainLoop += `\n for (int r = 0; r < ${filterHeight}; r++) {\n `;\n for (let c = 0; c < filterWidth; c++) {\n mainLoop += `\n xTexelC${c * 2} = vec4(0.0);\n xTexelC${c * 2}Ready = 0;\n xTexelC${c * 2 + 1} = vec4(0.0);\n xTexelC${c * 2 + 1}Ready = 0;\n xC${c} = vec4(0.0);`;\n }\n mainLoop += `\n xR = xRCorner + r * dilations[0];\n if (xR >=0 && xR < inDims[0]) {\n `;\n\n for (let texelC = 0; texelC < (texelsAcross + 1) / 2; texelC++) {\n const colIndex = texelC * 2;\n\n mainLoop += `\n xC = xCCorner + ${colIndex * dilationWidth};\n `;\n\n if (strideWidth === 1) {\n if (colIndex < filterWidth) {\n // If padding is odd, the outer texels have to be composed.\n if (padLeft % 2 === 1) {\n // TODO: Ensure vec4 previous does not result in redundant sample,\n // and avoid setting xTexelRC's that exceed the boundary in the\n // first place rather than resetting them to vec4(0)).\n\n // To compute xCOffset:\n // - If padding is odd, we must add 1 to ensure we ask for an\n // even-numbered row.\n // - We subtract 2 to access the previous texel.\n\n mainLoop += `\n xCOffset = xC + 1;\n if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${\n colIndex}Ready == 0) {\n xTexelC${colIndex} = getX(batch, xR, xCOffset, d1);\n\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${colIndex}.zw = vec2(0.0);\n }\n xTexelC${colIndex}Ready = 1;\n }\n `;\n // This texel has been read in previous iteration if the dilation\n // is 1.\n if (dilationWidth === 1 && colIndex > 0) {\n mainLoop += `\n xC${colIndex} = vec4(xTexelC${colIndex - 2}.zw, xTexelC${\n colIndex}.xy);\n `;\n } else {\n mainLoop += `\n xCOffset = xC + 1 - 2;\n\n if (xCOffset >= 0 && xCOffset < inDims[1]) {\n previous = getX(batch, xR, xCOffset, d1);\n\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n previous.zw = vec2(0.0);\n }\n\n xC${colIndex} = vec4(previous.zw, xTexelC${colIndex}.xy);\n } else {\n xC${colIndex} = vec4(0.0, 0.0, xTexelC${colIndex}.xy);\n }\n `;\n }\n } else {\n // Padding is even, so xRC corresponds to a single texel.\n mainLoop += `\n if (xC >= 0 && xC < inDims[1] && xTexelC${colIndex}Ready == 0) {\n xTexelC${colIndex} = getX(batch, xR, xC, d1);\n if (xC + 1 >= inDims[1]) {\n xTexelC${colIndex}.zw = vec2(0.0);\n }\n xTexelC${colIndex}Ready = 1;\n }\n\n xC${colIndex} = xTexelC${colIndex};\n `;\n }\n\n if (colIndex + 1 < filterWidth) {\n // If dilation is even, the second entry should match the first\n // (either both are composed or both are single samples). But if\n // dilation is odd, then the second entry should be the opposite\n // of the first (if the first is composed, the second is a single\n // sample, and vice versa.)\n\n const nextTexelOffset = padLeft % 2 === 0 ?\n util.nearestLargerEven(dilationWidth) :\n dilationWidth;\n\n if ((dilationWidth % 2 === 0 && padLeft % 2 === 1) ||\n (dilationWidth % 2 !== 0 && padLeft % 2 !== 1)) {\n mainLoop += `\n xCOffset = xC + imod(pads[1], 2) + ${nextTexelOffset};\n\n if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${\n colIndex + 1}Ready == 0) {\n xTexelC${colIndex + 1} = getX(batch, xR, xCOffset, d1);\n\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${colIndex + 1}.zw = vec2(0.0);\n }\n xTexelC${colIndex + 1}Ready = 1;\n }\n `;\n\n // If dilation > 1 then the xRC's will not be able to share any\n // values, so each xRC will require two unique calls to getX.\n if (dilationWidth > 1) {\n mainLoop += `\n xCOffset -= 2;\n if (xCOffset >= 0 && xCOffset < inDims[1]) {\n previous = getX(batch, xR, xCOffset, d1);\n xC${colIndex + 1} = vec4(previous.zw, xTexelC${\n colIndex + 1}.xy);\n } else {\n xC${colIndex + 1} = vec4(0.0, 0.0, xTexelC${\n colIndex + 1}.xy);\n }\n `;\n } else {\n mainLoop += `\n xC${colIndex + 1} = vec4(xTexelC${colIndex}.zw, xTexelC${\n colIndex + 1}.xy);\n `;\n }\n } else {\n // If dilation is 1 and padding is odd, we have already read the\n // texel when constructing the previous x value. Here we can\n // simply skip the texture read.\n if (nextTexelOffset === 1) {\n mainLoop += `\n xC${colIndex + 1} = xTexelC${colIndex};\n `;\n } else {\n mainLoop += `\n xCOffset = xC + ${nextTexelOffset};\n\n if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${\n colIndex + 1}Ready == 0) {\n xTexelC${colIndex + 1} = getX(batch, xR, xCOffset, d1);\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${colIndex + 1}.zw = vec2(0.0);\n }\n xTexelC${colIndex + 1}Ready = 1;\n }\n\n xC${colIndex + 1} = xTexelC${colIndex + 1};\n `;\n }\n }\n }\n }\n } else { // stride === 2\n if (colIndex < filterWidth) {\n // Depending on whether padLeft is even or odd, we want either the\n // xy or zw channels from X texels for xC${colIndex}. If padLeft is\n // even, xC${colIndex +1} is simply the zw channels of texels we've\n // already sampled. But if padLeft is odd, xC{$c + 1}.zw will\n // need to come from the xy channels of a new texel, hence the `\n // vec4\n // final` initialized below.\n if (padLeft % 2 === 1) {\n mainLoop += `\n xCOffset = xC + 1 - strides[1];\n if(xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${\n colIndex}Ready == 0) {\n xTexelC${colIndex} = getX(batch, xR, xCOffset, d1);\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${colIndex}.zw = vec2(0.0);\n }\n xTexelC${colIndex}Ready = 1;\n }\n\n if(xC + 1 >= 0 && xC + 1 < inDims[1] && xTexelC${\n colIndex + 1}Ready == 0) {\n xTexelC${colIndex + 1} = getX(batch, xR, xC + 1, d1);\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xC + 2 >= inDims[1]) {\n xTexelC${colIndex + 1}.zw = vec2(0.0);\n }\n xTexelC${colIndex + 1}Ready = 1;\n }\n\n xC${colIndex} = vec4(xTexelC${colIndex}.zw, xTexelC${\n colIndex + 1}.zw);\n `;\n\n if (colIndex + 1 < filterWidth) {\n mainLoop += `\n final = vec4(0.0);\n xCOffset = xC + 1 + strides[1];\n if(xCOffset >= 0 && xCOffset < inDims[1]) {\n final = getX(batch, xR, xCOffset, d1);\n }\n xC${colIndex + 1} = vec4(xTexelC${colIndex + 1}.xy, final.xy);\n `;\n }\n } else {\n mainLoop += `\n if(xC >= 0 && xC < inDims[1] && xTexelC${colIndex}Ready == 0) {\n xTexelC${colIndex} = getX(batch, xR, xC, d1);\n if (xC + 1 >= inDims[1]) {\n xTexelC${colIndex}.zw = vec2(0.0);\n }\n xTexelC${colIndex}Ready = 1;\n }\n\n xCOffset = xC + strides[1];\n if(xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${\n colIndex + 1}Ready == 0) {\n xTexelC${colIndex + 1} = getX(batch, xR, xCOffset, d1);\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC${colIndex + 1}.zw = vec2(0.);\n }\n xTexelC${colIndex + 1}Ready = 1;\n }\n\n xC${colIndex} = vec4(\n xTexelC${colIndex}.xy, xTexelC${colIndex + 1}.xy);\n `;\n\n if (colIndex + 1 < filterWidth) {\n mainLoop += `\n xC${colIndex + 1} = vec4(xTexelC${colIndex}.zw, xTexelC${\n colIndex + 1}.zw);\n `;\n }\n }\n }\n }\n\n // localize the dotProd accumulation within the loop, the theory is for\n // GPU with limited cache, accumulate sum across large amount of\n // veriables will cause lots of cache misses. (i.e. 5x5 filter will have\n // 50 variables)\n if (colIndex < filterWidth) {\n mainLoop += `\n wTexel = getW(r, ${colIndex}, d1, q);\n dotProd += xC${colIndex} * vec4(wTexel.xz, wTexel.xz);\n `;\n\n if (colIndex + 1 < filterWidth) {\n mainLoop += `\n wTexel = getW(r, ${colIndex + 1}, d1, q);\n dotProd += xC${colIndex + 1} * vec4(wTexel.xz, wTexel.xz);\n `;\n }\n }\n }\n mainLoop += `\n }\n `;\n mainLoop += `\n }\n `;\n\n let activationSnippet = '', applyActivationSnippet = '';\n if (activation) {\n if (hasPreluActivation) {\n activationSnippet = `vec4 activation(vec4 a) {\n vec4 b = getPreluActivationWeightsAtOutCoords();\n ${activation}\n }`;\n } else if (hasLeakyReluAlpha) {\n activationSnippet = `vec4 activation(vec4 a) {\n vec4 b = getLeakyreluAlphaAtOutCoords();\n ${activation}\n }`;\n } else {\n activationSnippet = `vec4 activation(vec4 x) {\n ${activation}\n }`;\n }\n\n applyActivationSnippet = `result = activation(result);`;\n }\n\n const addBiasSnippet = addBias ? 'result += getBiasAtOutCoords();' : '';\n if (addBias) {\n this.variableNames.push('bias');\n }\n\n if (hasPreluActivation) {\n this.variableNames.push('preluActivationWeights');\n }\n if (hasLeakyReluAlpha) {\n this.variableNames.push('leakyreluAlpha');\n }\n\n this.userCode = `\n ${activationSnippet}\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords.x;\n ivec2 xRCCorner = coords.yz * strides - pads;\n int d2 = coords.w;\n int d1 = d2 / ${channelMul};\n int q = d2 - d1 * ${channelMul};\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n //intialize dotProd with a small epsilon seems to reduce GPU accuracy loss.\n vec4 dotProd = vec4(0.000000000000001);\n\n ${mainLoop}\n\n vec4 result = dotProd - vec4(0.000000000000001);\n ${addBiasSnippet}\n ${applyActivationSnippet}\n setOutput(result);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, DepthwiseConv2dNative, DepthwiseConv2dNativeAttrs, DepthwiseConv2dNativeInputs, env, KernelConfig, KernelFunc, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {DepthwiseConv2DProgram} from '../conv_gpu_depthwise';\nimport {DepthwiseConvPacked2DProgram} from '../conv_packed_gpu_depthwise';\n\nexport function depthwiseConv2dNative(args: {\n inputs: DepthwiseConv2dNativeInputs,\n attrs: DepthwiseConv2dNativeAttrs,\n backend: MathBackendWebGL\n}) {\n const {inputs, backend, attrs} = args;\n const {x, filter} = inputs;\n const {strides, pad, dilations, dimRoundingMode} = attrs;\n\n let $dilations = dilations;\n if ($dilations == null) {\n $dilations = [1, 1];\n }\n\n util.assert(\n backend_util.eitherStridesOrDilationsAreOne(strides, $dilations),\n () => 'Error in depthwiseConv2d: Either strides or dilations must be ' +\n `1. Got strides ${strides} and dilations '${$dilations}'`);\n\n const convInfo = backend_util.computeConv2DInfo(\n x.shape as [number, number, number, number],\n filter.shape as [number, number, number, number], strides, $dilations,\n pad, dimRoundingMode, true /* depthwise */);\n\n let program: DepthwiseConv2DProgram|DepthwiseConvPacked2DProgram;\n if (env().getBool('WEBGL_PACK_DEPTHWISECONV') && convInfo.strideWidth <= 2 &&\n convInfo.outChannels / convInfo.inChannels === 1) {\n program = new DepthwiseConvPacked2DProgram(convInfo);\n } else {\n program = new DepthwiseConv2DProgram(convInfo);\n }\n const customValues = [\n [convInfo.padInfo.top, convInfo.padInfo.left],\n [convInfo.strideHeight, convInfo.strideWidth],\n [convInfo.dilationHeight, convInfo.dilationWidth],\n [convInfo.inHeight, convInfo.inWidth]\n ];\n return backend.runWebGLProgram(program, [x, filter], 'float32', customValues);\n}\n\nexport const depthwiseConv2dNativeConfig: KernelConfig = {\n kernelName: DepthwiseConv2dNative,\n backendName: 'webgl',\n kernelFunc: depthwiseConv2dNative as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class DepthwiseConv2DDerFilterProgram implements GPGPUProgram {\n variableNames = ['x', 'dy'];\n outputShape: number[];\n userCode: string;\n\n constructor(convInfo: backend_util.Conv2DInfo) {\n this.outputShape = convInfo.filterShape;\n\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n const padTop = convInfo.padInfo.top;\n const padLeft = convInfo.padInfo.left;\n const channelMul = convInfo.outChannels / convInfo.inChannels;\n\n this.userCode = `\n void main() {\n ivec4 coords = getOutputCoords();\n int wR = coords.x;\n int wC = coords.y;\n int d1 = coords.z;\n int dm = coords.w;\n int d2 = d1 * ${channelMul} + dm;\n\n float dotProd = 0.0;\n\n // TO DO: Vec4 over the batch size\n for (int b = 0; b < ${convInfo.batchSize}; b++) {\n for (int yR = 0; yR < ${convInfo.outHeight}; yR++) {\n int xR = wR + yR * ${strideHeight} - ${padTop};\n\n if (xR < 0 || xR >= ${convInfo.inHeight}) {\n continue;\n }\n\n for (int yC = 0; yC < ${convInfo.outWidth}; yC++) {\n int xC = wC + yC * ${strideWidth} - ${padLeft};\n\n if (xC < 0 || xC >= ${convInfo.inWidth}) {\n continue;\n }\n\n float dyValue = getDy(b, yR, yC, d2);\n float xValue = getX(b, xR, xC, d1);\n dotProd += (xValue * dyValue);\n }\n }\n }\n setOutput(dotProd);\n }\n `;\n }\n}\n\nexport class DepthwiseConv2DDerInputProgram implements GPGPUProgram {\n variableNames = ['dy', 'W'];\n outputShape: number[];\n userCode: string;\n\n constructor(convInfo: backend_util.Conv2DInfo) {\n this.outputShape = convInfo.inShape;\n\n const filterHeight = convInfo.filterHeight;\n const filterWidth = convInfo.filterWidth;\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n\n const padTop = filterHeight - 1 - convInfo.padInfo.top;\n const padLeft = filterWidth - 1 - convInfo.padInfo.left;\n const channelMul = convInfo.outChannels / convInfo.inChannels;\n\n this.userCode = `\n const ivec2 pads = ivec2(${padTop}, ${padLeft});\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d1 = coords[3];\n ivec2 dyCorner = coords.yz - pads;\n int dyRCorner = dyCorner.x;\n int dyCCorner = dyCorner.y;\n\n float dotProd = 0.0;\n\n for (int wR = 0; wR < ${filterHeight}; wR++) {\n float dyR = float(dyRCorner + wR) / ${strideHeight}.0;\n\n if (dyR < 0.0 || dyR >= ${convInfo.outHeight}.0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = ${filterHeight} - 1 - wR;\n\n for (int wC = 0; wC < ${filterWidth}; wC++) {\n float dyC = float(dyCCorner + wC) / ${strideWidth}.0;\n\n if (dyC < 0.0 || dyC >= ${convInfo.outWidth}.0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n int wCPerm = ${filterWidth} - 1 - wC;\n\n // TO DO: Vec4 over the channelMul\n for (int dm = 0; dm < ${channelMul}; dm++) {\n int d2 = d1 * ${channelMul} + dm;\n float xValue = getDy(batch, idyR, idyC, d2);\n float wValue = getW(wRPerm, wCPerm, d1, dm);\n dotProd += xValue * wValue;\n }\n }\n }\n setOutput(dotProd);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, DepthwiseConv2dNativeBackpropFilter, DepthwiseConv2dNativeBackpropFilterAttrs, DepthwiseConv2dNativeBackpropFilterInputs, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {DepthwiseConv2DDerFilterProgram} from '../conv_backprop_gpu_depthwise';\n\nexport function depthwiseConv2dNativeBackpropFilter(args: {\n inputs: DepthwiseConv2dNativeBackpropFilterInputs,\n attrs: DepthwiseConv2dNativeBackpropFilterAttrs,\n backend: MathBackendWebGL\n}) {\n const {inputs, backend, attrs} = args;\n const {x, dy} = inputs;\n const {strides, dilations, pad, dimRoundingMode, filterShape} = attrs;\n\n const convInfo = backend_util.computeConv2DInfo(\n x.shape as [number, number, number, number], filterShape, strides,\n dilations, pad, dimRoundingMode, true /* depthwise */);\n\n const program = new DepthwiseConv2DDerFilterProgram(convInfo);\n return backend.runWebGLProgram(program, [x, dy], 'float32');\n}\n\nexport const depthwiseConv2dNativeBackpropFilterConfig: KernelConfig = {\n kernelName: DepthwiseConv2dNativeBackpropFilter,\n backendName: 'webgl',\n kernelFunc: depthwiseConv2dNativeBackpropFilter as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, DepthwiseConv2dNativeBackpropInput, DepthwiseConv2dNativeBackpropInputAttrs, DepthwiseConv2dNativeBackpropInputInputs, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {DepthwiseConv2DDerInputProgram} from '../conv_backprop_gpu_depthwise';\n\nexport function depthwiseConv2dNativeBackpropInput(args: {\n inputs: DepthwiseConv2dNativeBackpropInputInputs,\n attrs: DepthwiseConv2dNativeBackpropInputAttrs,\n backend: MathBackendWebGL\n}) {\n const {inputs, backend, attrs} = args;\n const {dy, filter} = inputs;\n const {strides, dilations, pad, dimRoundingMode, inputShape} = attrs;\n\n const convInfo = backend_util.computeConv2DInfo(\n inputShape, filter.shape as [number, number, number, number], strides,\n dilations, pad, dimRoundingMode, true /* depthwise */);\n\n const program = new DepthwiseConv2DDerInputProgram(convInfo);\n return backend.runWebGLProgram(program, [dy, filter], 'float32');\n}\n\nexport const depthwiseConv2dNativeBackpropInputConfig: KernelConfig = {\n kernelName: DepthwiseConv2dNativeBackpropInput,\n backendName: 'webgl',\n kernelFunc: depthwiseConv2dNativeBackpropInput as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class DiagProgram implements GPGPUProgram {\n variableNames = ['X'];\n outputShape: number[];\n userCode: string;\n\n constructor(size: number) {\n this.outputShape = [size, size];\n this.userCode = `\n void main() {\n ivec2 coords = getOutputCoords();\n float val = coords[0] == coords[1] ? getX(coords[0]) : 0.0;\n setOutput(val);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Diag, DiagInputs, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {DiagProgram} from '../diag_gpu';\nimport {reshape} from './Reshape';\n\nexport function diag(args: {inputs: DiagInputs, backend: MathBackendWebGL}):\n TensorInfo {\n const {inputs, backend} = args;\n const {x} = inputs;\n\n const outShape = [...x.shape, ...x.shape];\n const xSize = util.sizeFromShape(x.shape);\n\n const flat = reshape({inputs: {x}, backend, attrs: {shape: [xSize]}});\n\n const program = new DiagProgram(xSize);\n const res = backend.runWebGLProgram(program, [flat], flat.dtype);\n\n const out = reshape({inputs: {x: res}, backend, attrs: {shape: outShape}});\n\n backend.disposeIntermediateTensorInfo(flat);\n backend.disposeIntermediateTensorInfo(res);\n\n return out;\n}\n\nexport const diagConfig: KernelConfig = {\n kernelName: Diag,\n backendName: 'webgl',\n kernelFunc: diag as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class Dilation2DProgram implements GPGPUProgram {\n variableNames = ['x', 'W'];\n outputShape: number[];\n userCode: string;\n\n constructor(convInfo: backend_util.Conv2DInfo) {\n this.outputShape = convInfo.outShape;\n\n const {\n inHeight,\n inWidth,\n padInfo,\n strideHeight,\n strideWidth,\n filterHeight,\n filterWidth,\n dilationHeight,\n dilationWidth\n } = convInfo;\n\n const {top: padTop, left: padLeft} = padInfo;\n\n this.userCode = `\n const ivec2 strides = ivec2(${strideHeight}, ${strideWidth});\n const ivec2 pads = ivec2(${padTop}, ${padLeft});\n const float neg_infinity = -3.4e38;\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords.x;\n int d1 = coords.w;\n ivec2 outTopLeftCorner =\n coords.yz * strides - pads;\n int hBeg = outTopLeftCorner.x;\n int wBeg = outTopLeftCorner.y;\n\n float curVal = neg_infinity;\n for (int h = 0; h < ${filterHeight}; h++) {\n int hIn = hBeg + h * ${dilationHeight};\n\n if (hIn >= 0 && hIn < ${inHeight}) {\n for (int w = 0; w < ${filterWidth}; w++) {\n int wIn = wBeg + w * ${dilationWidth};\n\n if (wIn >= 0 && wIn < ${inWidth}) {\n float xVal = getX(batch, hIn, wIn, d1);\n float wVal = getW(h, w, d1);\n\n float val = xVal + wVal;\n if (val > curVal) {\n curVal = val;\n }\n }\n }\n }\n }\n\n float result = curVal;\n setOutput(result);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, Dilation2D, Dilation2DAttrs, Dilation2DInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {Dilation2DProgram} from '../dilation_gpu';\nimport {reshape} from './Reshape';\n\nexport function dilation2D(args: {\n inputs: Dilation2DInputs,\n attrs: Dilation2DAttrs,\n backend: MathBackendWebGL\n}) {\n const {inputs, backend, attrs} = args;\n const {x, filter} = inputs;\n const {strides, pad, dilations} = attrs;\n\n const convInfo = backend_util.computeDilation2DInfo(\n x.shape as [number, number, number, number],\n filter.shape as [number, number, number], strides, pad,\n 'NHWC' /* dataFormat */, dilations);\n let out: TensorInfo;\n\n const program = new Dilation2DProgram(convInfo);\n out = backend.runWebGLProgram(program, [x, filter], 'float32');\n\n const outReshaped =\n reshape({inputs: {x: out}, backend, attrs: {shape: convInfo.outShape}});\n backend.disposeIntermediateTensorInfo(out);\n\n return outReshaped;\n}\n\nexport const dilation2DConfig: KernelConfig = {\n kernelName: Dilation2D,\n backendName: 'webgl',\n kernelFunc: dilation2D as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, Einsum, EinsumAttrs, EinsumInputs, KernelConfig, KernelFunc, Tensor, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\n\nimport {multiply} from './Multiply';\nimport {reshape} from './Reshape';\nimport {sum} from './Sum';\nimport {transpose} from './Transpose';\n\nexport function einsum(\n args:\n {inputs: EinsumInputs, backend: MathBackendWebGL, attrs: EinsumAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {equation} = attrs;\n const tensors = inputs as Tensor[];\n\n const {allDims, summedDims, idDims} =\n backend_util.decodeEinsumEquation(equation, tensors.length);\n backend_util.checkEinsumDimSizes(allDims.length, idDims, tensors);\n const {path, steps} = backend_util.getEinsumComputePath(summedDims, idDims);\n\n const nSteps = steps.length;\n let out: TensorInfo|null = null;\n let numDimsRemaining = allDims.length;\n const tensorsToDispose: TensorInfo[] = [];\n for (let i = 0; i < nSteps; ++i) {\n for (const idTerm of steps[i]) {\n const {permutationIndices: perm, expandDims: dimsToExpand} =\n backend_util.getEinsumPermutation(numDimsRemaining, idDims[idTerm]);\n let x: TensorInfo;\n if (backend_util.isIdentityPermutation(perm)) {\n x = tensors[idTerm];\n } else {\n x = transpose({inputs: {x: tensors[idTerm]}, backend, attrs: {perm}});\n tensorsToDispose.push(x);\n }\n const targetShape: number[] = x.shape.slice();\n for (let k = 0; k < dimsToExpand.length; ++k) {\n targetShape.splice(dimsToExpand[k], 0, 1);\n }\n\n if (!util.arraysEqual(x.shape, targetShape)) {\n x = reshape({inputs: {x}, backend, attrs: {shape: targetShape}});\n tensorsToDispose.push(x);\n }\n if (out === null) {\n out = x;\n } else {\n // tslint:disable-next-line: no-unnecessary-type-assertion\n out = multiply({inputs: {a: x, b: out}, backend}) as TensorInfo;\n tensorsToDispose.push(out);\n }\n }\n if (i < nSteps - 1) {\n if (path[i] >= 0) {\n out = sum({\n inputs: {x: out},\n backend,\n attrs: {\n axis: path[i] - (allDims.length - numDimsRemaining),\n keepDims: false\n }\n });\n tensorsToDispose.push(out);\n }\n numDimsRemaining--;\n }\n }\n\n // Clean up intermediate tensors.\n for (const tensorInfo of tensorsToDispose) {\n if (tensorInfo === out) {\n continue;\n }\n backend.disposeIntermediateTensorInfo(tensorInfo);\n }\n\n return out;\n}\n\nexport const einsumConfig: KernelConfig = {\n kernelName: Einsum,\n backendName: 'webgl',\n kernelFunc: einsum as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Elu, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst ELU = `return (x >= 0.0) ? x : (exp(x) - 1.0);`;\n\nconst ELU_PACKED = `\n vec4 result;\n\n result.r = (x.r >= 0.0) ? x.r : (exp(x.r) - 1.0);\n result.g = (x.g >= 0.0) ? x.g : (exp(x.g) - 1.0);\n result.b = (x.b >= 0.0) ? x.b : (exp(x.b) - 1.0);\n result.a = (x.a >= 0.0) ? x.a : (exp(x.a) - 1.0);\n\n return result;\n`;\n\nconst elu = unaryKernelFunc({opSnippet: ELU, packedOpSnippet: ELU_PACKED});\n\nexport const eluConfig: KernelConfig = {\n kernelName: Elu,\n backendName: 'webgl',\n kernelFunc: elu as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {EluGrad, EluGradInputs, env, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {BinaryOpProgram} from '../binaryop_gpu';\nimport {BinaryOpPackedProgram} from '../binaryop_packed_gpu';\n\nconst ELU_DER = `return (b >= 1.0) ? a : a * (b + 1.0);`;\nconst ELU_DER_PACKED = `\n vec4 bGTEZero = vec4(greaterThanEqual(b, vec4(0.)));\n return (bGTEZero * a) + ((vec4(1.0) - bGTEZero) * (a * (b + vec4(1.0))));\n`;\n\nexport const eluGrad =\n (args: {inputs: EluGradInputs, backend: MathBackendWebGL}): TensorInfo => {\n const {inputs, backend} = args;\n const {dy, y} = inputs;\n\n const program = env().getBool('WEBGL_PACK_BINARY_OPERATIONS') ?\n new BinaryOpPackedProgram(ELU_DER_PACKED, dy.shape, y.shape) :\n new BinaryOpProgram(ELU_DER, dy.shape, y.shape);\n return backend.runWebGLProgram(program, [dy, y], dy.dtype);\n };\n\nexport const eluGradConfig: KernelConfig = {\n kernelName: EluGrad,\n backendName: 'webgl',\n kernelFunc: eluGrad as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Equal, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {equalImplCPU} from '../kernel_utils/shared';\nconst PACKED_EQUAL = `\n return vec4(equal(a, b));\n`;\n\nconst EQUAL = `return float(a == b);`;\n\nexport const equal = binaryKernelFunc({\n opSnippet: EQUAL,\n packedOpSnippet: PACKED_EQUAL,\n dtype: 'bool',\n cpuKernelImpl: equalImplCPU,\n});\n\nexport const equalConfig: KernelConfig = {\n kernelName: Equal,\n backendName: 'webgl',\n kernelFunc: equal as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, Erf, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst ERF = `\n // Error function is calculated approximately with elementary function.\n // See \"Handbook of Mathematical Functions with Formulas,\n // Graphs, and Mathematical Tables\", Abramowitz and Stegun.\n float p = ${backend_util.ERF_P};\n float a1 = ${backend_util.ERF_A1};\n float a2 = ${backend_util.ERF_A2};\n float a3 = ${backend_util.ERF_A3};\n float a4 = ${backend_util.ERF_A4};\n float a5 = ${backend_util.ERF_A5};\n\n float sign = sign(x);\n x = abs(x);\n float t = 1.0 / (1.0 + p * x);\n return sign * (1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*exp(-x*x));\n`;\n\nexport const erf = unaryKernelFunc({opSnippet: ERF});\n\nexport const erfConfig: KernelConfig = {\n kernelName: Erf,\n backendName: 'webgl',\n kernelFunc: erf,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Exp, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {CHECK_NAN_SNIPPET_UNARY, unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {expImplCPU} from '../kernel_utils/shared';\n\nexport const EXP = CHECK_NAN_SNIPPET_UNARY + `\n return exp(x);\n`;\n\nconst EXP_PACKED = `\n vec4 result = exp(x);\n bvec4 isNaN = isnan(x);\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n`;\n\nexport const exp = unaryKernelFunc({\n opSnippet: EXP,\n packedOpSnippet: EXP_PACKED,\n cpuKernelImpl: expImplCPU,\n dtype: 'float32',\n});\n\nexport const expConfig: KernelConfig = {\n kernelName: Exp,\n backendName: 'webgl',\n kernelFunc: exp as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the License);\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an AS IS BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ExpandDims, ExpandDimsAttrs, ExpandDimsInputs, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {reshape} from './Reshape';\n\nexport function expandDims(args: {\n inputs: ExpandDimsInputs,\n attrs: ExpandDimsAttrs,\n backend: MathBackendWebGL\n}): TensorInfo {\n const {inputs, attrs, backend} = args;\n const {dim} = attrs;\n const {input} = inputs;\n\n const inputRank = input.shape.length;\n const newShape = input.shape.slice();\n let $dim = dim;\n if (dim < 0) {\n // Negative value is counted from the tail of rank.\n util.assert(\n -(inputRank + 1) <= dim,\n () => `Axis must be in the interval [${- (inputRank + 1)}, ${\n inputRank}]`);\n $dim = inputRank + dim + 1;\n }\n newShape.splice($dim, 0, 1);\n\n return reshape({inputs: {x: input}, backend, attrs: {shape: newShape}});\n}\n\nexport const expandDimsConfig: KernelConfig = {\n kernelName: ExpandDims,\n backendName: 'webgl',\n kernelFunc: expandDims as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Expm1, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {expm1ImplCPU} from '../kernel_utils/shared';\n\nconst EXPM1 = `return exp(x) - 1.0;`;\n\nexport const expm1 = unaryKernelFunc(\n {opSnippet: EXPM1, packedOpSnippet: EXPM1, cpuKernelImpl: expm1ImplCPU});\n\nexport const expm1Config: KernelConfig = {\n kernelName: Expm1,\n backendName: 'webgl',\n kernelFunc: expm1 as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class FFTProgram implements GPGPUProgram {\n variableNames = ['real', 'imag'];\n outputShape: number[];\n userCode: string;\n\n constructor(\n component: 'real'|'imag', inputShape: [number, number],\n inverse: boolean) {\n const innerDim = inputShape[1];\n this.outputShape = inputShape;\n\n const exponentMultiplierSnippet =\n inverse ? `2.0 * ${Math.PI}` : `-2.0 * ${Math.PI}`;\n const resultDenominator = inverse ? `${innerDim}.0` : '1.0';\n\n let opString: string;\n if (component === 'real') {\n opString = 'return real * expR - imag * expI;';\n } else if (component === 'imag') {\n opString = 'return real * expI + imag * expR;';\n } else {\n throw new Error(\n `FFT component must be either \"real\" or \"imag\", got ${component}.`);\n }\n\n this.userCode = `\n const float exponentMultiplier = ${exponentMultiplierSnippet};\n\n float unaryOpComplex(float real, float expR, float imag, float expI) {\n ${opString}\n }\n\n float mulMatDFT(int batch, int index) {\n float indexRatio = float(index) / float(${innerDim});\n float exponentMultiplierTimesIndexRatio =\n exponentMultiplier * indexRatio;\n\n float result = 0.0;\n\n for (int i = 0; i < ${innerDim}; i++) {\n // x = (-2|2 * PI / N) * index * i;\n float x = exponentMultiplierTimesIndexRatio * float(i);\n float expR = cos(x);\n float expI = sin(x);\n float real = getReal(batch, i);\n float imag = getImag(batch, i);\n\n result +=\n unaryOpComplex(real, expR, imag, expI) / ${resultDenominator};\n }\n\n return result;\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n setOutput(mulMatDFT(coords[0], coords[1]));\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {FFTProgram} from '../fft_gpu';\n\nimport {complex} from './Complex';\nimport {reshape} from './Reshape';\n\nexport function fftImpl(\n x: TensorInfo, inverse: boolean, backend: MathBackendWebGL): TensorInfo {\n const xData = backend.texData.get(x.dataId);\n\n const inputSize = util.sizeFromShape(x.shape);\n // Collapse all outer dimensions to a single batch dimension.\n const innerDimensionSize = x.shape[x.shape.length - 1];\n const batch = inputSize / innerDimensionSize;\n\n const input2D = reshape(\n {inputs: {x}, backend, attrs: {shape: [batch, innerDimensionSize]}});\n\n const xShape = input2D.shape as [number, number];\n const realProgram = new FFTProgram('real', xShape, inverse);\n const imagProgram = new FFTProgram('imag', xShape, inverse);\n\n const inputs = [\n {\n dataId: xData.complexTensorInfos.real.dataId,\n dtype: xData.complexTensorInfos.real.dtype,\n shape: xShape\n },\n {\n dataId: xData.complexTensorInfos.imag.dataId,\n dtype: xData.complexTensorInfos.imag.dtype,\n shape: xShape\n }\n ];\n\n const realPart = backend.runWebGLProgram(realProgram, inputs, 'float32');\n const imagPart = backend.runWebGLProgram(imagProgram, inputs, 'float32');\n\n const complexOutput =\n complex({inputs: {real: realPart, imag: imagPart}, backend});\n\n backend.disposeIntermediateTensorInfo(realPart);\n backend.disposeIntermediateTensorInfo(imagPart);\n\n const complexOutputReshaped =\n reshape({inputs: {x: complexOutput}, backend, attrs: {shape: x.shape}});\n\n backend.disposeIntermediateTensorInfo(input2D);\n backend.disposeIntermediateTensorInfo(complexOutput);\n return complexOutputReshaped;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {FFT, FFTInputs, KernelConfig, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\n\nimport {fftImpl} from './FFT_impl';\n\nexport function fft(args: {inputs: FFTInputs, backend: MathBackendWebGL}):\n TensorInfo {\n const {inputs, backend} = args;\n const {input} = inputs;\n\n return fftImpl(input, false /* inverse */, backend);\n}\n\nexport const fftConfig: KernelConfig = {\n kernelName: FFT,\n backendName: 'webgl',\n kernelFunc: fft\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {UniformType} from './shader_compiler';\n\nexport class FillProgram implements GPGPUProgram {\n variableNames: string[];\n outputShape: number[] = [];\n userCode: string;\n customUniforms = [{name: 'value', type: 'float' as UniformType}];\n\n constructor(shape: number[], value: number) {\n this.variableNames = ['x'];\n this.outputShape = shape;\n\n this.userCode = `\n void main() {\n // Input can be obtained from uniform value.\n setOutput(value);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Fill, FillAttrs, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {FillProgram} from '../fill_gpu';\n\nexport function fill(args: {backend: MathBackendWebGL, attrs: FillAttrs}):\n TensorInfo {\n const {backend, attrs} = args;\n const {shape, value} = attrs;\n let {dtype} = attrs;\n\n dtype = dtype || util.inferDtype(value);\n\n if (dtype === 'string') {\n // String type should be handled in CPU memory.\n const values = util.getArrayFromDType(dtype, util.sizeFromShape(shape));\n values.fill(value as string);\n return backend.makeTensorInfo(shape, dtype, values);\n } else {\n const program = new FillProgram(shape, value as number);\n const customValues = [[value as number]];\n return backend.runWebGLProgram(program, [], dtype, customValues);\n }\n}\n\nexport const fillConfig: KernelConfig = {\n kernelName: Fill,\n backendName: 'webgl',\n kernelFunc: fill as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class FlipLeftRightProgram implements GPGPUProgram {\n variableNames = ['Image'];\n outputShape: number[] = [];\n userCode: string;\n\n constructor(imageShape: [number, number, number, number]) {\n const imageWidth = imageShape[2];\n this.outputShape = imageShape;\n\n this.userCode = `\n void main() {\n ivec4 coords = getOutputCoords();\n int x = coords[2];\n\n int coordX = ${imageWidth} - x - 1;\n float outputValue;\n if(coordX >= 0 && coordX < ${imageWidth}) {\n outputValue = getImage(coords[0], coords[1], coordX, coords[3]);\n } else {\n outputValue = getImage(coords[0], coords[1], coords[2], coords[3]);\n }\n setOutput(outputValue);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Tensor4D} from '@tensorflow/tfjs-core';\nimport {FlipLeftRight, FlipLeftRightInputs} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {FlipLeftRightProgram} from '../flip_left_right_gpu';\n\nexport const flipLeftRightConfig: KernelConfig = {\n kernelName: FlipLeftRight,\n backendName: 'webgl',\n kernelFunc: ({inputs, backend}) => {\n const {image} = inputs as FlipLeftRightInputs;\n const webglBackend = backend as MathBackendWebGL;\n\n const program = new FlipLeftRightProgram((image as Tensor4D).shape);\n const output = webglBackend.runWebGLProgram(program, [image], image.dtype);\n return output;\n }\n};\n","\n/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Floor, KernelConfig} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {floorImplCPU} from '../kernel_utils/shared';\n\nconst FLOOR = `return floor(x);`;\n\nexport const floor = unaryKernelFunc(\n {opSnippet: FLOOR, packedOpSnippet: FLOOR, cpuKernelImpl: floorImplCPU});\n\nexport const floorConfig: KernelConfig = {\n kernelName: Floor,\n backendName: 'webgl',\n kernelFunc: floor,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {FloorDiv, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\n// We use native integer division to deal with floating point imprecision. Since\n// we implement floor division and glsl implements truncated division, we\n// correct for this by subtracting 1 from result when the result is negative and\n// there is a remainder.\nconst INT_DIV = `\n float s = sign(a) * sign(b);\n int ia = round(a);\n int ib = round(b);\n if (ib != 0) {\n // Windows (D3D) wants guaranteed non-zero int division at compile-time.\n return float(idiv(ia, ib, s));\n } else {\n return NAN;\n }\n`;\n\nconst INT_DIV_PACKED = `\n ivec4 ia = round(a);\n ivec4 ib = round(b);\n bvec4 cond = notEqual(ib, ivec4(0));\n ivec4 result = ivec4(0);\n vec4 s = sign(a) * sign(b);\n\n // Windows (D3D) wants guaranteed non-zero int division at compile-time.\n if (cond[0]) {\n result[0] = idiv(ia[0], ib[0], s[0]);\n }\n if (cond[1]) {\n result[1] = idiv(ia[1], ib[1], s[1]);\n }\n if (cond[2]) {\n result[2] = idiv(ia[2], ib[2], s[2]);\n }\n if (cond[3]) {\n result[3] = idiv(ia[3], ib[3], s[3]);\n }\n return vec4(result);\n`;\n\nexport const floorDiv = binaryKernelFunc(\n {opSnippet: INT_DIV, packedOpSnippet: INT_DIV_PACKED, dtype: 'int32'});\n\nexport const floorDivConfig: KernelConfig = {\n kernelName: FloorDiv,\n backendName: 'webgl',\n kernelFunc: floorDiv as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getGlslDifferences} from '../../glsl_version';\nimport {GPGPUProgram} from '../../gpgpu_math';\n\nexport class FromPixelsProgram implements GPGPUProgram {\n variableNames = ['A'];\n userCode: string;\n outputShape: number[];\n\n constructor(outputShape: number[]) {\n const glsl = getGlslDifferences();\n const [height, width, ] = outputShape;\n this.outputShape = outputShape;\n this.userCode = `\n void main() {\n ivec3 coords = getOutputCoords();\n int texR = coords[0];\n int texC = coords[1];\n int depth = coords[2];\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2(${width}.0, ${height}.0);\n\n vec4 values = ${glsl.texture2D}(A, uv);\n float value;\n if (depth == 0) {\n value = values.r;\n } else if (depth == 1) {\n value = values.g;\n } else if (depth == 2) {\n value = values.b;\n } else if (depth == 3) {\n value = values.a;\n }\n\n setOutput(floor(value * 255.0 + 0.5));\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getGlslDifferences} from '../../glsl_version';\nimport {GPGPUProgram} from '../../gpgpu_math';\n\nexport class FromPixelsPackedProgram implements GPGPUProgram {\n variableNames = ['A'];\n userCode: string;\n outputShape: number[];\n packedInputs = false;\n packedOutput = true;\n\n constructor(outputShape: number[]) {\n const glsl = getGlslDifferences();\n const [height, width, ] = outputShape;\n this.outputShape = outputShape;\n this.userCode = `\n void main() {\n ivec3 coords = getOutputCoords();\n int texR = coords[0];\n int texC = coords[1];\n int depth = coords[2];\n\n vec4 result = vec4(0.);\n\n for(int row=0; row<=1; row++) {\n for(int col=0; col<=1; col++) {\n texC = coords[1] + row;\n depth = coords[2] + col;\n\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(${width}.0, ${height}.0);\n vec4 values = ${glsl.texture2D}(A, uv);\n float value;\n if (depth == 0) {\n value = values.r;\n } else if (depth == 1) {\n value = values.g;\n } else if (depth == 2) {\n value = values.b;\n } else if (depth == 3) {\n value = values.a;\n }\n\n result[row * 2 + col] = floor(value * 255.0 + 0.5);\n }\n }\n\n ${glsl.output} = result;\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\nimport {FromPixels, FromPixelsAttrs, FromPixelsInputs} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {TextureUsage} from '../tex_util';\n\nimport {FromPixelsProgram} from './FromPixels_utils/from_pixels_gpu';\nimport {FromPixelsPackedProgram} from './FromPixels_utils/from_pixels_packed_gpu';\n\nexport const fromPixelsConfig: KernelConfig = {\n kernelName: FromPixels,\n backendName: 'webgl',\n kernelFunc: fromPixels as {} as KernelFunc,\n};\n\nlet fromPixels2DContext: CanvasRenderingContext2D;\nlet willReadFrequently = env().getBool('CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU');\n\nfunction fromPixels(args: {\n inputs: FromPixelsInputs,\n backend: MathBackendWebGL,\n attrs: FromPixelsAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n let {pixels} = inputs;\n const {numChannels} = attrs;\n\n const isVideo = typeof (HTMLVideoElement) !== 'undefined' &&\n pixels instanceof HTMLVideoElement;\n const isImage = typeof (HTMLImageElement) !== 'undefined' &&\n pixels instanceof HTMLImageElement;\n const [width, height] = isVideo ?\n [\n (pixels as HTMLVideoElement).videoWidth,\n (pixels as HTMLVideoElement).videoHeight\n ] :\n [pixels.width, pixels.height];\n\n const texShape: [number, number] = [height, width];\n const outShape = [height, width, numChannels];\n\n if (isImage || isVideo) {\n const newWillReadFrequently =\n env().getBool('CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU');\n if (fromPixels2DContext == null ||\n newWillReadFrequently !== willReadFrequently) {\n willReadFrequently = newWillReadFrequently;\n fromPixels2DContext =\n document.createElement('canvas').getContext(\n '2d', {willReadFrequently});\n }\n\n fromPixels2DContext.canvas.width = width;\n fromPixels2DContext.canvas.height = height;\n fromPixels2DContext.drawImage(\n pixels as HTMLVideoElement | HTMLImageElement | ImageBitmap, 0, 0,\n width, height);\n pixels = fromPixels2DContext.canvas;\n }\n\n const tempPixelHandle = backend.makeTensorInfo(texShape, 'int32');\n // This is a byte texture with pixels.\n backend.texData.get(tempPixelHandle.dataId).usage = TextureUsage.PIXELS;\n backend.gpgpu.uploadPixelDataToTexture(\n backend.getTexture(tempPixelHandle.dataId), pixels as ImageData);\n const program = env().getBool('WEBGL_PACK') ?\n new FromPixelsPackedProgram(outShape) :\n new FromPixelsProgram(outShape);\n const res = backend.runWebGLProgram(program, [tempPixelHandle], 'int32');\n backend.disposeData(tempPixelHandle.dataId);\n return res;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, env, FusedConv2D, FusedConv2DAttrs, FusedConv2DInputs, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {Conv2DProgram} from '../conv_gpu';\nimport {Conv2DPackedProgram} from '../conv_packed_gpu';\nimport {mapActivationToShaderProgram} from '../kernel_utils/kernel_funcs_utils';\n\nimport {conv2dByMatMul, conv2dWithIm2Row} from './Conv2D_impl';\nimport {reshape} from './Reshape';\n\nexport function fusedConv2d(args: {\n inputs: FusedConv2DInputs,\n attrs: FusedConv2DAttrs,\n backend: MathBackendWebGL\n}) {\n const {inputs, backend, attrs} = args;\n const {x, filter, bias, preluActivationWeights} = inputs;\n const {\n strides,\n pad,\n dataFormat,\n dilations,\n dimRoundingMode,\n activation,\n leakyreluAlpha\n } = attrs;\n\n const $dataFormat = backend_util.convertConv2DDataFormat(dataFormat);\n const convInfo = backend_util.computeConv2DInfo(\n x.shape as [number, number, number, number],\n filter.shape as [number, number, number, number], strides, dilations, pad,\n dimRoundingMode, false /* depthwise */, $dataFormat);\n let out: TensorInfo;\n const intermediates: TensorInfo[] = [];\n\n const hasBias = bias != null;\n const hasPreluActivationWeights = preluActivationWeights != null;\n const hasLeakyreluAlpha = activation === 'leakyrelu';\n\n const prepareInputs = (): TensorInfo[] => {\n const inputs: TensorInfo[] = [x, filter];\n\n // If the input is a 1-D tensor, align it with the channels.\n //\n // For fusedConv2d, the inputs (x, W, bias, preluActivationWeights) are\n // supposed to be aligned with the dataFormat. The 4-D tensor inputs or\n // scalar inputs are originally aligned, but the 1-D tensor inputs are\n // supposed to be aligned with the channels (only bias and PReLU activation\n // weights could be a 1-D tensor).\n const alignInputWithDataFormat =\n (input: TensorInfo, dataFormat: 'NHWC'|'NCHW'): TensorInfo => {\n if (dataFormat === 'NCHW' && input.shape.length === 1 &&\n input.shape[0] !== 1) {\n const alignedInput = reshape({\n inputs: {x: input},\n backend,\n attrs: {shape: [input.shape[0], 1, 1]}\n });\n intermediates.push(alignedInput);\n return alignedInput;\n }\n return input;\n };\n\n if (hasBias) {\n inputs.push(alignInputWithDataFormat(bias, dataFormat));\n }\n\n if (hasPreluActivationWeights) {\n inputs.push(alignInputWithDataFormat(preluActivationWeights, dataFormat));\n }\n\n if (hasLeakyreluAlpha) {\n const $leakyreluAlpha = backend.makeTensorInfo(\n [], 'float32',\n util.createScalarValue(leakyreluAlpha as {} as 'float32', 'float32'));\n inputs.push($leakyreluAlpha);\n intermediates.push($leakyreluAlpha);\n }\n return inputs;\n };\n\n if (convInfo.filterHeight === 1 && convInfo.filterWidth === 1 &&\n convInfo.dilationHeight === 1 && convInfo.dilationWidth === 1 &&\n convInfo.strideHeight === 1 && convInfo.strideWidth === 1 &&\n (convInfo.padInfo.type === 'SAME' || convInfo.padInfo.type === 'VALID')) {\n out = conv2dByMatMul({\n x,\n filter,\n convInfo,\n backend,\n bias,\n activation,\n preluActivationWeights,\n leakyreluAlpha\n });\n } else if (convInfo.strideWidth <= 2 && $dataFormat === 'channelsLast'\n && env().getBool('WEBGL_EXP_CONV')\n ) {\n const fusedActivation =\n activation ? mapActivationToShaderProgram(activation, true) : null;\n const program = new Conv2DPackedProgram(\n convInfo, hasBias, fusedActivation, hasPreluActivationWeights,\n hasLeakyreluAlpha);\n const customValues = [\n [convInfo.padInfo.top, convInfo.padInfo.left],\n [convInfo.strideHeight, convInfo.strideWidth],\n [convInfo.dilationHeight, convInfo.dilationWidth],\n [convInfo.inHeight, convInfo.inWidth]\n ];\n const inputs = prepareInputs();\n out = backend.runWebGLProgram(program, inputs, 'float32', customValues);\n } else if (env().getBool('WEBGL_CONV_IM2COL')) {\n out = conv2dWithIm2Row({\n x,\n filter,\n convInfo,\n backend,\n bias,\n activation,\n preluActivationWeights,\n leakyreluAlpha\n });\n } else {\n const fusedActivation =\n activation ? mapActivationToShaderProgram(activation, false) : null;\n const program = new Conv2DProgram(\n convInfo, hasBias, fusedActivation, hasPreluActivationWeights,\n hasLeakyreluAlpha);\n\n const inputs = prepareInputs();\n out = backend.runWebGLProgram(program, inputs, 'float32');\n }\n\n const outReshaped =\n reshape({inputs: {x: out}, backend, attrs: {shape: convInfo.outShape}});\n\n intermediates.push(out);\n intermediates.forEach(t => backend.disposeIntermediateTensorInfo(t));\n\n return outReshaped;\n}\n\nexport const fusedConv2DConfig: KernelConfig = {\n kernelName: FusedConv2D,\n backendName: 'webgl',\n kernelFunc: fusedConv2d as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, env, FusedDepthwiseConv2D, FusedDepthwiseConv2DAttrs, FusedDepthwiseConv2DInputs, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {DepthwiseConv2DProgram} from '../conv_gpu_depthwise';\nimport {DepthwiseConvPacked2DProgram} from '../conv_packed_gpu_depthwise';\nimport {mapActivationToShaderProgram} from '../kernel_utils/kernel_funcs_utils';\n\nexport function fusedDepthwiseConv2D(args: {\n inputs: FusedDepthwiseConv2DInputs,\n attrs: FusedDepthwiseConv2DAttrs,\n backend: MathBackendWebGL\n}) {\n const {inputs, backend, attrs} = args;\n const {x, filter, bias, preluActivationWeights} = inputs;\n const {strides, pad, dilations, dimRoundingMode, activation, leakyreluAlpha} =\n attrs;\n\n const intermediates: TensorInfo[] = [];\n\n let $dilations = dilations;\n if ($dilations == null) {\n $dilations = [1, 1];\n }\n\n util.assert(\n backend_util.eitherStridesOrDilationsAreOne(strides, $dilations),\n () => 'Error in depthwiseConv2d: Either strides or dilations must be ' +\n `1. Got strides ${strides} and dilations '${$dilations}'`);\n\n const convInfo = backend_util.computeConv2DInfo(\n x.shape as [number, number, number, number],\n filter.shape as [number, number, number, number], strides, $dilations,\n pad, dimRoundingMode, true /* depthwise */);\n\n const shouldPackDepthwiseConv = env().getBool('WEBGL_PACK_DEPTHWISECONV') &&\n convInfo.strideWidth <= 2 &&\n convInfo.outChannels / convInfo.inChannels === 1;\n const fusedActivation = activation ?\n mapActivationToShaderProgram(activation, shouldPackDepthwiseConv) :\n null;\n const programInputs: TensorInfo[] = [x, filter];\n\n const hasBias = bias != null;\n const hasPreluActivationWeights = preluActivationWeights != null;\n const hasLeakyreluAlpha = activation === 'leakyrelu';\n\n if (hasBias) {\n programInputs.push(bias);\n }\n if (hasPreluActivationWeights) {\n programInputs.push(preluActivationWeights);\n }\n if (hasLeakyreluAlpha) {\n const $leakyreluAlpha = backend.makeTensorInfo(\n [], 'float32',\n util.createScalarValue(leakyreluAlpha as {} as 'float32', 'float32'));\n programInputs.push($leakyreluAlpha);\n intermediates.push($leakyreluAlpha);\n }\n\n let program: DepthwiseConv2DProgram|DepthwiseConvPacked2DProgram;\n if (shouldPackDepthwiseConv) {\n program = new DepthwiseConvPacked2DProgram(\n convInfo, hasBias, fusedActivation, hasPreluActivationWeights,\n hasLeakyreluAlpha);\n } else {\n program = new DepthwiseConv2DProgram(\n convInfo, hasBias, fusedActivation, hasPreluActivationWeights,\n hasLeakyreluAlpha);\n }\n const customValues = [\n [convInfo.padInfo.top, convInfo.padInfo.left],\n [convInfo.strideHeight, convInfo.strideWidth],\n [convInfo.dilationHeight, convInfo.dilationWidth],\n [convInfo.inHeight, convInfo.inWidth]\n ];\n const result =\n backend.runWebGLProgram(program, programInputs, 'float32', customValues);\n\n intermediates.forEach(t => backend.disposeIntermediateTensorInfo(t));\n\n return result;\n}\n\nexport const fusedDepthwiseConv2DConfig: KernelConfig = {\n kernelName: FusedDepthwiseConv2D,\n backendName: 'webgl',\n kernelFunc: fusedDepthwiseConv2D as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {GPGPUProgram} from './gpgpu_math';\nimport {getCoordsDataType} from './shader_compiler';\n\nexport class GatherNDProgram implements GPGPUProgram {\n variableNames = ['x', 'indices'];\n outputShape: number[];\n userCode: string;\n constructor(\n private sliceDim: number, private strides: number[], shape: number[],\n private paramsShape: number[]) {\n this.outputShape = shape;\n const dtype = getCoordsDataType(shape.length);\n\n let mainLoop = `\n int index;`;\n for (let j = 0; j < this.sliceDim; j++) {\n mainLoop += `\n index = round(getIndices(coords[0], ${j}));\n out_of_bounds = out_of_bounds || index < 0;\n out_of_bounds = out_of_bounds || index >= ${this.paramsShape[j]};\n flattenIndex += index * ${this.strides[j]};`;\n }\n\n this.userCode = `\n void main() {\n ${dtype} coords = getOutputCoords();\n int flattenIndex = 0;\n bool out_of_bounds = false;\n\n ${mainLoop}\n\n setOutput(out_of_bounds ? 0.0 : getX(flattenIndex, coords[1]));\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, GatherNd, GatherNdInputs, KernelConfig, KernelFunc, Rank, TensorInfo, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {GatherNDProgram} from '../gather_nd_gpu';\nimport {gatherNdImplCPU} from '../kernel_utils/shared';\n\nimport {reshape} from './Reshape';\n\nexport function gatherNd(\n args: {inputs: GatherNdInputs, backend: MathBackendWebGL}): TensorInfo {\n const {inputs, backend} = args;\n const {params, indices} = inputs;\n\n const indicesShape = indices.shape;\n const sliceRank = indicesShape[indicesShape.length - 1];\n const paramsSize = util.sizeFromShape(params.shape);\n\n const [resultShape, numSlices, sliceSize, strides] =\n backend_util.prepareAndValidate(params, indices);\n\n const flattenIndices = reshape(\n {inputs: {x: indices}, backend, attrs: {shape: [numSlices, sliceRank]}});\n const flattenX = reshape({\n inputs: {x: params},\n backend,\n attrs: {shape: [(util.sizeFromShape(params.shape) / sliceSize), sliceSize]}\n });\n\n if (backend.shouldExecuteOnCPU([params, indices]) ||\n params.dtype === 'string') {\n const indicesData = backend.readSync(indices.dataId) as TypedArray;\n const paramsBuf = backend.bufferSync(params);\n const outValue = gatherNdImplCPU(\n indicesData, paramsBuf, params.dtype, numSlices, sliceRank, sliceSize,\n strides, params.shape, paramsSize);\n\n return backend.makeTensorInfo(resultShape, params.dtype, outValue.values);\n }\n const program =\n new GatherNDProgram(sliceRank, strides, [numSlices, sliceSize], \n params.shape);\n const res = backend.runWebGLProgram(\n program, [flattenX, flattenIndices], flattenX.dtype);\n\n const reshaped =\n reshape({inputs: {x: res}, backend, attrs: {shape: resultShape}});\n\n backend.disposeIntermediateTensorInfo(flattenIndices);\n backend.disposeIntermediateTensorInfo(flattenX);\n backend.disposeIntermediateTensorInfo(res);\n\n return reshaped;\n}\n\nexport const gatherNdConfig: KernelConfig = {\n kernelName: GatherNd,\n backendName: 'webgl',\n kernelFunc: gatherNd as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {getCoordsDataType} from './shader_compiler';\n\nexport type GatherShape = [number, number, number, number];\n\nexport class GatherProgram implements GPGPUProgram {\n variableNames = ['A', 'indices'];\n outputShape: number[];\n userCode: string;\n rank: number;\n\n constructor(aShape: GatherShape, outputShape: GatherShape) {\n this.outputShape = outputShape;\n this.rank = outputShape.length;\n const dtype = getCoordsDataType(this.rank);\n const sourceCoords = getSourceCoords(aShape, 2);\n\n this.userCode = `\n void main() {\n ${dtype} resRC = getOutputCoords();\n int index = int(getIndices(resRC.x, resRC.z));\n float inBounds = (index >= 0) && (index < ${aShape[2]}) ? 1.0 : 0.0;\n setOutput(inBounds * getA(${sourceCoords}));\n }\n `;\n }\n}\n\n// The input and output are always flattened into rank 4 tensors.\nfunction getSourceCoords(aShape: GatherShape, axis: number): string {\n const currentCoords = ['resRC.x', 'resRC.y', 'resRC.z', 'resRC.w'];\n\n const sourceCoords = [];\n for (let i = 0; i < aShape.length; i++) {\n if (i === 2) {\n sourceCoords.push('index');\n } else {\n sourceCoords.push(`${currentCoords[i]}`);\n }\n }\n return sourceCoords.join();\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, GatherV2, GatherV2Attrs, GatherV2Inputs, KernelConfig, KernelFunc, TensorInfo, TypedArray, util, env} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {GatherProgram, GatherShape} from '../gather_gpu';\nimport {gatherV2ImplCPU} from '../kernel_utils/shared';\n\nimport {reshape} from './Reshape';\n\nexport function gatherV2(args: {\n inputs: GatherV2Inputs,\n backend: MathBackendWebGL,\n attrs: GatherV2Attrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x, indices} = inputs;\n const {axis, batchDims} = attrs;\n\n const parsedAxis = util.parseAxisParam(axis, x.shape)[0];\n if (env().get('DEBUG')) {\n // In debug mode, throw error when any index is out of bound.\n // Otherwise, just fill out of bounds with zeroes.\n const indicesVals = backend.readSync(indices.dataId) as TypedArray;\n const axisDim = x.shape[parsedAxis];\n for (let i = 0; i < indicesVals.length; ++i) {\n const index = indicesVals[i];\n util.assert(\n index <= axisDim - 1 && index >= 0,\n () =>\n `GatherV2: the index value ${index} is not in [0, ${axisDim - 1}]`);\n }\n }\n\n const shapeInfo = backend_util.segment_util.collectGatherOpShapeInfo(\n x, indices, parsedAxis, batchDims);\n\n const indicesSize = util.sizeFromShape(indices.shape);\n\n const toDispose = [];\n\n const flattenX = reshape({\n inputs: {x},\n backend,\n attrs: {\n shape: [\n shapeInfo.batchSize, shapeInfo.outerSize, shapeInfo.dimSize,\n shapeInfo.sliceSize\n ]\n }\n });\n\n const flattenIndex = reshape({\n inputs: {x: indices},\n backend,\n attrs: {shape: [shapeInfo.batchSize, indicesSize / shapeInfo.batchSize]}\n });\n\n toDispose.push(flattenX);\n toDispose.push(flattenIndex);\n\n const flattenOutputShape = [\n shapeInfo.batchSize, shapeInfo.outerSize, indicesSize / shapeInfo.batchSize,\n shapeInfo.sliceSize\n ];\n\n if (backend.shouldExecuteOnCPU([x, indices]) || x.dtype === 'string') {\n const indicesBuf = backend.bufferSync(flattenIndex);\n const xBuf = backend.bufferSync(flattenX);\n const outBuf = gatherV2ImplCPU(xBuf, indicesBuf, flattenOutputShape);\n\n toDispose.forEach(t => backend.disposeIntermediateTensorInfo(t));\n\n return backend.makeTensorInfo(\n shapeInfo.outputShape, outBuf.dtype, outBuf.values as TypedArray);\n }\n\n const program = new GatherProgram(flattenX.shape as GatherShape,\n flattenOutputShape as GatherShape);\n const res = backend.runWebGLProgram(\n program, [flattenX, flattenIndex], flattenX.dtype);\n toDispose.push(res);\n\n const reshaped = reshape(\n {inputs: {x: res}, backend, attrs: {shape: shapeInfo.outputShape}});\n toDispose.forEach(t => backend.disposeIntermediateTensorInfo(t));\n return reshaped;\n}\n\nexport const gatherV2Config: KernelConfig = {\n kernelName: GatherV2,\n backendName: 'webgl',\n kernelFunc: gatherV2 as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Greater, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {greaterImplCPU} from '../kernel_utils/shared';\n\nconst GREATER = `return float(a > b);`;\nconst GREATER_PACKED = `\n return vec4(greaterThan(a, b));\n`;\n\nexport const greater = binaryKernelFunc({\n opSnippet: GREATER,\n packedOpSnippet: GREATER_PACKED,\n cpuKernelImpl: greaterImplCPU,\n dtype: 'bool'\n});\n\nexport const greaterConfig: KernelConfig = {\n kernelName: Greater,\n backendName: 'webgl',\n kernelFunc: greater as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GreaterEqual, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {greaterEqualImplCPU} from '../kernel_utils/shared';\n\nconst GREATER_EQUAL = `return float(a >= b);`;\nconst GREATER_EQUAL_PACKED = `\n return vec4(greaterThanEqual(a, b));\n`;\n\nexport const greaterEqual = binaryKernelFunc({\n opSnippet: GREATER_EQUAL,\n packedOpSnippet: GREATER_EQUAL_PACKED,\n dtype: 'bool',\n cpuKernelImpl: greaterEqualImplCPU\n});\n\nexport const greaterEqualConfig: KernelConfig = {\n kernelName: GreaterEqual,\n backendName: 'webgl',\n kernelFunc: greaterEqual as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {IFFT, IFFTInputs, KernelConfig, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\n\nimport {fftImpl} from './FFT_impl';\n\nexport function ifft(args: {inputs: IFFTInputs, backend: MathBackendWebGL}):\n TensorInfo {\n const {inputs, backend} = args;\n const {input} = inputs;\n\n return fftImpl(input, true /* inverse */, backend);\n}\n\nexport const ifftConfig: KernelConfig = {\n kernelName: IFFT,\n backendName: 'webgl',\n kernelFunc: ifft\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {IsFinite, KernelConfig} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst IS_FINITE = `return float(!isnan(x) && !isinf(x));`;\n\nexport const isFinite = unaryKernelFunc({opSnippet: IS_FINITE, dtype: 'bool'});\n\nexport const isFiniteConfig: KernelConfig = {\n kernelName: IsFinite,\n backendName: 'webgl',\n kernelFunc: isFinite,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {IsInf, KernelConfig} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst IS_INF = `return float(isinf(x));`;\n\nexport const isInf = unaryKernelFunc({opSnippet: IS_INF, dtype: 'bool'});\n\nexport const isInfConfig: KernelConfig = {\n kernelName: IsInf,\n backendName: 'webgl',\n kernelFunc: isInf,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {IsNan, KernelConfig} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst IS_NAN = `return float(isnan(x));`;\n\nexport const isNaN = unaryKernelFunc({opSnippet: IS_NAN, dtype: 'bool'});\n\nexport const isNaNConfig: KernelConfig = {\n kernelName: IsNan,\n backendName: 'webgl',\n kernelFunc: isNaN,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Less} from '@tensorflow/tfjs-core';\n\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {lessImplCPU} from '../kernel_utils/shared';\n\nconst LESS = `return float(a < b);`;\nconst LESS_PACKED = `\n return vec4(lessThan(a, b));\n`;\n\nexport const less = binaryKernelFunc({\n opSnippet: LESS,\n packedOpSnippet: LESS_PACKED,\n cpuKernelImpl: lessImplCPU,\n dtype: 'bool'\n});\n\nexport const lessConfig: KernelConfig = {\n kernelName: Less,\n backendName: 'webgl',\n kernelFunc: less as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, LessEqual} from '@tensorflow/tfjs-core';\n\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {lessEqualImplCPU} from '../kernel_utils/shared';\n\nexport const LESS_EQUAL = `return float(a <= b);`;\nexport const LESS_EQUAL_PACKED = `\n return vec4(lessThanEqual(a, b));\n`;\n\nexport const lessEqual = binaryKernelFunc({\n opSnippet: LESS_EQUAL,\n packedOpSnippet: LESS_EQUAL_PACKED,\n cpuKernelImpl: lessEqualImplCPU,\n dtype: 'bool'\n});\n\nexport const lessEqualConfig: KernelConfig = {\n kernelName: LessEqual,\n backendName: 'webgl',\n kernelFunc: lessEqual as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, LinSpace, LinSpaceAttrs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {linSpaceImplCPU} from '../kernel_utils/shared';\n\nexport function linSpace(\n args: {backend: MathBackendWebGL, attrs: LinSpaceAttrs}): TensorInfo {\n const {backend, attrs} = args;\n const {start, stop, num} = attrs;\n\n // TODO: Use CPU implementation due to the precision problem in Safari.\n const outVals = linSpaceImplCPU(start, stop, num);\n return backend.makeTensorInfo([outVals.length], 'float32', outVals);\n}\n\nexport const linSpaceConfig: KernelConfig = {\n kernelName: LinSpace,\n backendName: 'webgl',\n kernelFunc: linSpace as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Log} from '@tensorflow/tfjs-core';\n\nimport {CHECK_NAN_SNIPPET_UNARY, unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {logImplCPU} from '../kernel_utils/shared';\n\n// Windows chrome return 0 if the input is negative value. We will specifically\n// return NaN if the input is 0 to solve compatiblity issue.\nconst LOG = CHECK_NAN_SNIPPET_UNARY + `\n return x < 0.0 ? 0./0. : log(x);\n`;\n\nconst LOG_PACKED = `\n vec4 result = log(x);\n bvec4 isNaN = isnan(x);\n result.r = isNaN.r ? x.r : (x.r < 0.0 ? 0./0. : result.r);\n result.g = isNaN.g ? x.g : (x.g < 0.0 ? 0./0. : result.g);\n result.b = isNaN.b ? x.b : (x.b < 0.0 ? 0./0. : result.b);\n result.a = isNaN.a ? x.a : (x.a < 0.0 ? 0./0. : result.a);\n return result;\n`;\n\nexport const log = unaryKernelFunc(\n {opSnippet: LOG, packedOpSnippet: LOG_PACKED, cpuKernelImpl: logImplCPU});\n\nexport const logConfig: KernelConfig = {\n kernelName: Log,\n backendName: 'webgl',\n kernelFunc: log as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Log1p} from '@tensorflow/tfjs-core';\n\nimport {CHECK_NAN_SNIPPET_UNARY, unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst LOG1P = CHECK_NAN_SNIPPET_UNARY + `\n return log(1.0 + x);\n`;\n\nexport const log1p = unaryKernelFunc({opSnippet: LOG1P});\n\nexport const log1pConfig: KernelConfig = {\n kernelName: Log1p,\n backendName: 'webgl',\n kernelFunc: log1p,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, LogicalAnd} from '@tensorflow/tfjs-core';\n\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst LOGICAL_AND = `return float(a >= 1.0 && b >= 1.0);`;\nconst LOGICAL_AND_PACKED = `\n return vec4(\n vec4(greaterThanEqual(a, vec4(1.0))) *\n vec4(greaterThanEqual(b, vec4(1.0))));\n`;\n\nexport const logicalAnd = binaryKernelFunc({\n opSnippet: LOGICAL_AND,\n packedOpSnippet: LOGICAL_AND_PACKED,\n dtype: 'bool'\n});\n\nexport const logicalAndConfig: KernelConfig = {\n kernelName: LogicalAnd,\n backendName: 'webgl',\n kernelFunc: logicalAnd as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, LogicalNot} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst LOGICAL_NOT = `return float(!(x >= 1.0));`;\n\nexport const logicalNot = unaryKernelFunc({opSnippet: LOGICAL_NOT});\n\nexport const logicalNotConfig: KernelConfig = {\n kernelName: LogicalNot,\n backendName: 'webgl',\n kernelFunc: logicalNot,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, LogicalOr} from '@tensorflow/tfjs-core';\n\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst LOGICAL_OR = `return float(a >= 1.0 || b >= 1.0);`;\nconst LOGICAL_OR_PACKED = `\n return min(\n vec4(greaterThanEqual(a, vec4(1.0))) +\n vec4(greaterThanEqual(b, vec4(1.0))),\n vec4(1.0));\n`;\n\nexport const logicalOr = binaryKernelFunc(\n {opSnippet: LOGICAL_OR, packedOpSnippet: LOGICAL_OR_PACKED, dtype: 'bool'});\n\nexport const logicalOrConfig: KernelConfig = {\n kernelName: LogicalOr,\n backendName: 'webgl',\n kernelFunc: logicalOr as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class LRNProgram implements GPGPUProgram {\n variableNames = ['x'];\n outputShape: number[] = [];\n userCode: string;\n\n constructor(\n xShape: number[], radius: number, bias: number, alpha: number,\n beta: number) {\n const rad = radius;\n const maxD = xShape[3] - 1;\n this.outputShape = xShape;\n\n // optimize pow(bias + alpha * sum, -beta)\n // src: https://github.com/tensorflow/tensorflow/..\n // blob/26033a1644a9c4a5fbe3170ab2e864b6a4ccd4ca/..\n // tensorflow/core/kernels/mkl_lrn_op.cc#L320\n let powOperator;\n const basis = `float(${bias}) + float(${alpha}) * sum`;\n if (beta === 0.5) {\n powOperator = `inversesqrt(${basis})`;\n } else if (beta === 1.0) {\n powOperator = `1.0/(${basis})`;\n } else {\n powOperator = `exp(log(${basis}) * float(-${beta}));`;\n }\n\n this.userCode = `\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int r = coords[1];\n int c = coords[2];\n int d = coords[3];\n float x = getX(b, r, c, d);\n float sum = 0.0;\n for (int j = -${rad}; j <= ${rad}; j++) {\n int idx = d + j;\n if (idx >= 0 && idx <= ${maxD}) {\n float z = getX(b, r, c, idx);\n sum += z * z;\n }\n }\n float val = x * ${powOperator};\n setOutput(val);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class LRNPackedProgram implements GPGPUProgram {\n variableNames = ['x'];\n outputShape: number[] = [];\n userCode: string;\n packedInputs = true;\n packedOutput = true;\n\n constructor(\n xShape: number[], radius: number, bias: number, alpha: number,\n beta: number) {\n const rad = radius;\n const maxD = xShape[3] - 1;\n this.outputShape = xShape;\n\n // optimize pow(bias + alpha * sum, -beta)\n // src: https://github.com/tensorflow/tensorflow/..\n // blob/26033a1644a9c4a5fbe3170ab2e864b6a4ccd4ca/..\n // tensorflow/core/kernels/mkl_lrn_op.cc#L320\n let powOperator;\n const basis = `float(${bias}) + float(${alpha}) * sum`;\n if (beta === 0.5) {\n powOperator = `inversesqrt(${basis})`;\n } else if (beta === 1.0) {\n powOperator = `1.0/(${basis})`;\n } else {\n powOperator = `exp(log(${basis}) * float(-${beta}));`;\n }\n\n this.userCode = `\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords.x;\n int r = coords.y;\n int c = coords.z;\n int d = coords.w;\n\n bool hasNextCol = d < ${this.outputShape[3]};\n bool hasNextRow = c < ${this.outputShape[2]};\n\n vec4 sum = vec4(0.);\n vec4 xFragAtOutputCoords = getX(b, r, c, d);\n\n vec4 xAtOutputCoords = vec4(\n getChannel(xFragAtOutputCoords, vec2(c, d)),\n hasNextCol ?\n getChannel(xFragAtOutputCoords, vec2(c, d + 1)) : 0.0,\n hasNextRow ?\n getChannel(xFragAtOutputCoords , vec2(c + 1, d)) : 0.0,\n (hasNextRow && hasNextCol) ?\n getChannel(xFragAtOutputCoords, vec2(c + 1, d + 1)) : 0.0\n );\n\n int firstChannel = d - ${rad};\n vec2 cache = vec2(0.);\n if(firstChannel >= 0){\n vec4 firstChannelFrag = getX(b, r, c, firstChannel);\n cache.x = getChannel(firstChannelFrag, vec2(c, firstChannel));\n if(hasNextRow){\n cache.y = getChannel(firstChannelFrag, vec2(c + 1, firstChannel));\n }\n }\n\n ivec2 depth = ivec2(d, d + 1);\n for (int j = - ${rad}; j <= ${rad}; j++) {\n ivec2 idx = depth + j;\n bvec2 aboveLowerBound = greaterThanEqual(idx, ivec2(0));\n bvec2 belowUpperBound = lessThanEqual(idx, ivec2(${maxD}));\n\n bool depthInRange = aboveLowerBound.x && belowUpperBound.x;\n bool depthPlusOneInRange = aboveLowerBound.y && belowUpperBound.y;\n\n if(depthInRange || depthPlusOneInRange){\n vec4 z = vec4(0.);\n vec4 xFragAtCurrentDepth;\n z.xz = cache.xy;\n if(depthPlusOneInRange && hasNextCol){\n xFragAtCurrentDepth = idx.y != d ?\n getX(b, r, c, idx.y) : xFragAtOutputCoords;\n z.y = getChannel(xFragAtCurrentDepth, vec2(c, idx.y));\n if(hasNextRow){\n z.w = getChannel(xFragAtCurrentDepth, vec2(c + 1, idx.y));\n }\n }\n cache.xy = z.yw;\n sum += z * z;\n }\n }\n vec4 result = xAtOutputCoords * ${powOperator};\n setOutput(result);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env, KernelConfig, KernelFunc, LRN, LRNAttrs, LRNInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {LRNProgram} from '../lrn_gpu';\nimport {LRNPackedProgram} from '../lrn_packed_gpu';\n\nexport const lrn =\n (args: {inputs: LRNInputs, backend: MathBackendWebGL, attrs: LRNAttrs}):\n TensorInfo => {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {depthRadius, bias, alpha, beta} = attrs;\n\n const program = env().getBool('WEBGL_PACK_NORMALIZATION') ?\n new LRNPackedProgram(x.shape, depthRadius, bias, alpha, beta) :\n new LRNProgram(x.shape, depthRadius, bias, alpha, beta);\n return backend.runWebGLProgram(program, [x], x.dtype);\n };\n\n// tslint:disable-next-line: variable-name\nexport const LRNConfig: KernelConfig = {\n kernelName: LRN,\n backendName: 'webgl',\n kernelFunc: lrn as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class LRNGradProgram implements GPGPUProgram {\n variableNames = ['inputImage', 'outputImage', 'dy'];\n outputShape: number[] = [];\n userCode: string;\n depthRadius: number;\n bias: number;\n alpha: number;\n beta: number;\n depth: number;\n\n constructor(\n inputShape: number[], depthRadius: number, bias: number, alpha: number,\n beta: number) {\n this.outputShape = inputShape;\n this.depth = inputShape[3];\n this.depthRadius = depthRadius;\n this.bias = bias;\n this.alpha = alpha;\n this.beta = beta;\n this.userCode = `\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int r = coords[1];\n int c = coords[2];\n\n float result = 0.0;\n for (int d = 0; d < ${this.depth}; ++d) {\n int depthBegin = int(max(0.0, float(d - ${depthRadius})));\n int depthEnd = int(min(float(${this.depth}),\n float(d + ${depthRadius} + 1)));\n\n const int MIN_DEPTH_BEGIN = 0;\n const int MAX_DEPTH_END = ${this.depth};\n\n float norm = 0.0;\n for (int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k) {\n if (k < depthBegin){\n continue;\n }\n else if (k >= depthBegin && k < depthEnd) {\n norm += getInputImage(b, r, c, k) * getInputImage(b, r, c, k);\n }\n else {\n break;\n }\n }\n\n norm = float(${alpha}) * norm + float(${bias});\n\n for(int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k){\n if (k < depthBegin){\n continue;\n }\n else if (k >= depthBegin && k < depthEnd){\n float dyi = -2.0 * float(${alpha})\n * float(${beta})\n * getInputImage(b ,r ,c, k) * getOutputImage(b, r, c, d)\n / norm;\n if (k == d) {\n dyi += pow(norm, -1.0 * ${beta});\n }\n if (k == coords[3]) {\n dyi *= getDy(b, r, c, d);\n result += dyi;\n }\n }\n else {\n break;\n }\n }\n }\n setOutput(result);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, LRNGrad, LRNGradAttrs, LRNGradInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {LRNGradProgram} from '../lrn_grad_gpu';\n\nexport const lrnGrad = (args: {\n inputs: LRNGradInputs,\n backend: MathBackendWebGL,\n attrs: LRNGradAttrs\n}): TensorInfo => {\n const {inputs, backend, attrs} = args;\n const {x, y, dy} = inputs;\n const {depthRadius, bias, alpha, beta} = attrs;\n\n const program = new LRNGradProgram(x.shape, depthRadius, bias, alpha, beta);\n return backend.runWebGLProgram(program, [x, y, dy], x.dtype);\n};\n\n// tslint:disable-next-line: variable-name\nexport const LRNGradConfig: KernelConfig = {\n kernelName: LRNGrad,\n backendName: 'webgl',\n kernelFunc: lrnGrad as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {reduce} from '../kernel_utils/reduce';\nimport {reshape} from '../kernels/Reshape';\n\nexport function maxImpl(\n x: TensorInfo, reduceShape: number[], outShape: number[],\n backend: MathBackendWebGL): TensorInfo {\n const inSize = util.sizeFromShape(reduceShape);\n const xSize = util.sizeFromShape(x.shape);\n const batchSize = xSize / inSize;\n const reshapedInput =\n reshape({inputs: {x}, attrs: {shape: [batchSize, inSize]}, backend});\n\n const reduced = reduce(reshapedInput, x.dtype, 'max', backend);\n const reshapedOutput =\n reshape({inputs: {x: reduced}, attrs: {shape: outShape}, backend});\n\n backend.disposeIntermediateTensorInfo(reshapedInput);\n backend.disposeIntermediateTensorInfo(reduced);\n\n return reshapedOutput;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelFunc, Max, MaxAttrs, MaxInputs, TensorInfo} from '@tensorflow/tfjs-core';\nimport {backend_util, KernelConfig, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {maxImplCPU} from '../kernel_utils/shared';\n\nimport {maxImpl} from './Max_impl';\nimport {transposeImpl, transposeImplCPU} from './Transpose_impl';\n\nexport function max(\n args: {inputs: MaxInputs, backend: MathBackendWebGL, attrs: MaxAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {reductionIndices, keepDims} = attrs;\n\n const xRank = x.shape.length;\n\n const origAxes = util.parseAxisParam(reductionIndices, x.shape);\n let axes = origAxes;\n const permutedAxes = backend_util.getAxesPermutation(axes, xRank);\n const maxInputIsTransposed = permutedAxes != null;\n const shouldExecuteOnCPU = backend.shouldExecuteOnCPU([x]);\n\n let maxInput = x;\n if (maxInputIsTransposed) {\n if (shouldExecuteOnCPU) {\n const xTexData = backend.texData.get(maxInput.dataId);\n const values = xTexData.values as TypedArray;\n\n const newShape: number[] = new Array(xRank);\n for (let i = 0; i < newShape.length; i++) {\n newShape[i] = x.shape[permutedAxes[i]];\n }\n const maxInputValues =\n transposeImplCPU(values, x.shape, x.dtype, permutedAxes, newShape);\n\n maxInput = backend.makeTensorInfo(newShape, x.dtype);\n const maxInputData = backend.texData.get(maxInput.dataId);\n maxInputData.values = maxInputValues;\n } else {\n maxInput = transposeImpl(x, permutedAxes, backend);\n }\n\n axes = backend_util.getInnerMostAxes(axes.length, xRank);\n }\n\n backend_util.assertAxesAreInnerMostDims('max', axes, xRank);\n const [maxOutShape, reduceShape] =\n backend_util.computeOutAndReduceShapes(maxInput.shape, axes);\n\n let outShape = maxOutShape;\n if (keepDims) {\n // rather than reshape at the end, set the target shape here.\n outShape = backend_util.expandShapeToKeepDim(maxOutShape, origAxes);\n }\n\n let out;\n if (shouldExecuteOnCPU) {\n const xTexData = backend.texData.get(maxInput.dataId);\n const values = xTexData.values as TypedArray;\n\n const outValues =\n maxImplCPU(values, util.sizeFromShape(reduceShape), outShape, x.dtype);\n\n out = backend.makeTensorInfo(outShape, x.dtype);\n const outData = backend.texData.get(out.dataId);\n outData.values = outValues;\n } else {\n out = maxImpl(maxInput, reduceShape, outShape, backend);\n }\n\n if (maxInputIsTransposed) {\n backend.disposeIntermediateTensorInfo(maxInput);\n }\n\n return out;\n}\n\nexport const maxConfig: KernelConfig = {\n kernelName: Max,\n backendName: 'webgl',\n kernelFunc: max as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Maximum} from '@tensorflow/tfjs-core';\n\nimport {CHECK_NAN_SNIPPET} from '../binaryop_gpu';\nimport {CHECK_NAN_SNIPPET_PACKED} from '../binaryop_packed_gpu';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {maximumImplCPU} from '../kernel_utils/shared';\n\nconst MAXIMUM = CHECK_NAN_SNIPPET + `\n return max(a, b);\n`;\n\nconst MAXIMUM_PACKED = `\n vec4 result = vec4(max(a, b));\n bvec4 isNaNA = isnan(a);\n bvec4 isNaNB = isnan(b);\n bvec4 isNaN = bvec4(isNaNA.x || isNaNB.x, isNaNA.y || isNaNB.y, isNaNA.z || isNaNB.z, isNaNA.w || isNaNB.w);\n ` +\n CHECK_NAN_SNIPPET_PACKED + `\n return result;\n`;\n\nexport const maximum = binaryKernelFunc({\n opSnippet: MAXIMUM,\n packedOpSnippet: MAXIMUM_PACKED,\n cpuKernelImpl: maximumImplCPU\n});\n\nexport const maximumConfig: KernelConfig = {\n kernelName: Maximum,\n backendName: 'webgl',\n kernelFunc: maximum as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {backend_util, KernelConfig, KernelFunc, MaxPool, MaxPoolAttrs, MaxPoolInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {Pool2DProgram} from '../pool_gpu';\nimport {assertNotComplex} from '../webgl_util';\nimport {identity} from './Identity';\n\nexport function maxPool(args: {\n inputs: MaxPoolInputs,\n backend: MathBackendWebGL,\n attrs: MaxPoolAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n assertNotComplex(x, 'maxPool');\n const {filterSize, strides, pad, dimRoundingMode} = attrs;\n const dilations = 1;\n\n util.assert(\n backend_util.eitherStridesOrDilationsAreOne(strides, dilations),\n () => 'Error in maxPool: Either strides or dilations must be 1. ' +\n `Got strides ${strides} and dilations '${dilations}'`);\n\n const convInfo = backend_util.computePool2DInfo(\n x.shape as [number, number, number, number], filterSize, strides,\n dilations, pad, dimRoundingMode);\n if (convInfo.filterWidth === 1 && convInfo.filterHeight === 1 &&\n util.arraysEqual(convInfo.inShape, convInfo.outShape)) {\n return identity({inputs: {x}, backend});\n }\n const maxPoolProgram = new Pool2DProgram(convInfo, 'max', false);\n return backend.runWebGLProgram(maxPoolProgram, [x], x.dtype);\n}\n\nexport const maxPoolConfig: KernelConfig = {\n kernelName: MaxPool,\n backendName: 'webgl',\n kernelFunc: maxPool as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {backend_util, KernelConfig, KernelFunc, MaxPool3D, MaxPool3DAttrs, MaxPool3DInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {Pool3DProgram} from '../pool_gpu';\n\nexport function maxPool3d(args: {\n inputs: MaxPool3DInputs,\n backend: MathBackendWebGL,\n attrs: MaxPool3DAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {filterSize, strides, pad, dataFormat, dimRoundingMode} = attrs;\n const dilations: [number, number, number] = [1, 1, 1];\n\n const convInfo = backend_util.computePool3DInfo(\n x.shape as [number, number, number, number, number], filterSize, strides,\n dilations, pad, dimRoundingMode, dataFormat);\n const maxPoolProgram = new Pool3DProgram(convInfo, 'max', false);\n return backend.runWebGLProgram(maxPoolProgram, [x], x.dtype);\n}\n\nexport const maxPool3DConfig: KernelConfig = {\n kernelName: MaxPool3D,\n backendName: 'webgl',\n kernelFunc: maxPool3d as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class MaxPool2DBackpropProgram implements GPGPUProgram {\n variableNames = ['dy', 'maxPos'];\n outputShape: number[];\n userCode: string;\n\n constructor(convInfo: backend_util.Conv2DInfo) {\n this.outputShape = convInfo.inShape;\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n const dilationHeight = convInfo.dilationHeight;\n const effectiveFilterHeight = convInfo.effectiveFilterHeight;\n const effectiveFilterWidth = convInfo.effectiveFilterWidth;\n\n const padTop = effectiveFilterHeight - 1 - convInfo.padInfo.top;\n const padLeft = effectiveFilterWidth - 1 - convInfo.padInfo.left;\n\n const lastIndex = effectiveFilterHeight * effectiveFilterWidth - 1;\n this.userCode = `\n const ivec2 pads = ivec2(${padTop}, ${padLeft});\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n\n ivec2 dyRCCorner = coords.yz - pads;\n int dyRCorner = dyRCCorner.x;\n int dyCCorner = dyRCCorner.y;\n\n // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < ${effectiveFilterHeight};\n wR += ${dilationHeight}) {\n float dyR = float(dyRCorner + wR) / ${strideHeight}.0;\n\n if (dyR < 0.0 || dyR >= ${convInfo.outHeight}.0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < ${effectiveFilterWidth}; wC++) {\n float dyC = float(dyCCorner + wC) / ${strideWidth}.0;\n\n if (dyC < 0.0 || dyC >= ${convInfo.outWidth}.0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(b, idyR, idyC, d);\n int maxPosValue = ${lastIndex} - int(getMaxPos(b, idyR, idyC, d));\n\n // Get the current value, check it against the value from the\n // position matrix.\n int curPosValue = wR * ${effectiveFilterWidth} + wC;\n float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0);\n\n dotProd += dyValue * mask;\n }\n }\n setOutput(dotProd);\n }\n `;\n }\n}\n\nexport class MaxPool3DBackpropProgram implements GPGPUProgram {\n variableNames = ['dy', 'maxPos'];\n outputShape: number[];\n userCode: string;\n\n constructor(convInfo: backend_util.Conv3DInfo) {\n this.outputShape = convInfo.inShape;\n const strideDepth = convInfo.strideDepth;\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n const dilationDepth = convInfo.dilationDepth;\n const dilationHeight = convInfo.dilationHeight;\n const dilationWidth = convInfo.dilationWidth;\n const effectiveFilterDepth = convInfo.effectiveFilterDepth;\n const effectiveFilterHeight = convInfo.effectiveFilterHeight;\n const effectiveFilterWidth = convInfo.effectiveFilterWidth;\n\n const padFront = effectiveFilterDepth - 1 - convInfo.padInfo.front;\n const padTop = effectiveFilterHeight - 1 - convInfo.padInfo.top;\n const padLeft = effectiveFilterWidth - 1 - convInfo.padInfo.left;\n\n const lastIndex =\n effectiveFilterDepth * effectiveFilterHeight * effectiveFilterWidth - 1;\n this.userCode = `\n const ivec3 pads = ivec3(${padFront}, ${padTop}, ${padLeft});\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int ch = coords.u;\n\n ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;\n int dyDCorner = dyCorner.x;\n int dyRCorner = dyCorner.y;\n int dyCCorner = dyCorner.z;\n\n // Convolve dy(?, ?, ?, ch) with pos mask(:, :, :, d) to get\n // dx(xD, xR, xC, ch).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n\n for (int wD = 0; wD < ${effectiveFilterDepth};\n wD += ${dilationDepth}) {\n float dyD = float(dyDCorner + wD) / ${strideDepth}.0;\n\n if (dyD < 0.0 || dyD >= ${convInfo.outDepth}.0 || fract(dyD) > 0.0) {\n continue;\n }\n int idyD = int(dyD);\n\n for (int wR = 0; wR < ${effectiveFilterHeight};\n wR += ${dilationHeight}) {\n float dyR = float(dyRCorner + wR) / ${strideHeight}.0;\n\n if (dyR < 0.0 || dyR >= ${convInfo.outHeight}.0 ||\n fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < ${effectiveFilterWidth};\n wC += ${dilationWidth}) {\n float dyC = float(dyCCorner + wC) / ${strideWidth}.0;\n\n if (dyC < 0.0 || dyC >= ${convInfo.outWidth}.0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(batch, idyD, idyR, idyC, ch);\n int maxPosValue = ${lastIndex} -\n int(getMaxPos(batch, idyD, idyR, idyC, ch));\n\n // Get the current value, check it against the value from the\n // position matrix.\n int curPosValue =\n wD * ${effectiveFilterHeight} * ${effectiveFilterWidth} +\n wR * ${effectiveFilterWidth} + wC;\n float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0);\n\n dotProd += dyValue * mask;\n }\n }\n }\n setOutput(dotProd);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {backend_util, KernelConfig, KernelFunc, MaxPool3DGrad, MaxPool3DGradAttrs, MaxPool3DGradInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {MaxPool3DBackpropProgram} from '../max_pool_backprop_gpu';\nimport {Pool3DProgram} from '../pool_gpu';\n\nexport function maxPool3DGrad(args: {\n inputs: MaxPool3DGradInputs,\n backend: MathBackendWebGL,\n attrs: MaxPool3DGradAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {dy, input} = inputs;\n const x = input;\n const {filterSize, strides, pad, dimRoundingMode} = attrs;\n const dilations: [number, number, number] = [1, 1, 1];\n\n const convInfo = backend_util.computePool3DInfo(\n x.shape as [number, number, number, number, number], filterSize, strides,\n dilations, pad, dimRoundingMode);\n\n const maxPool3dPositionsProgram =\n new Pool3DProgram(convInfo, 'max', true /* get positions */);\n const maxPool3dPositions =\n backend.runWebGLProgram(maxPool3dPositionsProgram, [x], x.dtype);\n const maxPoolBackpropProgram = new MaxPool3DBackpropProgram(convInfo);\n const result = backend.runWebGLProgram(\n maxPoolBackpropProgram, [dy, maxPool3dPositions], x.dtype);\n backend.disposeIntermediateTensorInfo(maxPool3dPositions);\n return result;\n}\n\nexport const maxPool3DGradConfig: KernelConfig = {\n kernelName: MaxPool3DGrad,\n backendName: 'webgl',\n kernelFunc: maxPool3DGrad as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {backend_util, KernelConfig, KernelFunc, MaxPoolGrad, MaxPoolGradAttrs, MaxPoolGradInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {MaxPool2DBackpropProgram} from '../max_pool_backprop_gpu';\nimport {Pool2DProgram} from '../pool_gpu';\nimport {assertNotComplex} from '../webgl_util';\n\nexport function maxPoolGrad(args: {\n inputs: MaxPoolGradInputs,\n backend: MathBackendWebGL,\n attrs: MaxPoolGradAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {dy, input, output} = inputs;\n const x = input;\n assertNotComplex([input, output], 'maxPoolGrad');\n const {filterSize, strides, pad, dimRoundingMode} = attrs;\n\n const convInfo = backend_util.computePool2DInfo(\n x.shape as [number, number, number, number], filterSize, strides,\n 1 /* dilations */, pad, dimRoundingMode);\n const getPositions = true;\n const maxPoolPositionsProgram =\n new Pool2DProgram(convInfo, 'max', getPositions);\n const maxPoolPositions: TensorInfo =\n backend.runWebGLProgram(maxPoolPositionsProgram, [x], x.dtype);\n\n const maxPoolBackPropProgram = new MaxPool2DBackpropProgram(convInfo);\n const result = backend.runWebGLProgram(\n maxPoolBackPropProgram, [dy, maxPoolPositions], x.dtype);\n backend.disposeIntermediateTensorInfo(maxPoolPositions);\n return result;\n}\n\nexport const maxPoolGradConfig: KernelConfig = {\n kernelName: MaxPoolGrad,\n backendName: 'webgl',\n kernelFunc: maxPoolGrad as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {Pool2DProgram} from '../pool_gpu';\n\nexport function maxPoolWithArgmaxImpl(\n x: TensorInfo, includeBatchInIndex: boolean,\n convInfo: backend_util.Conv2DInfo,\n backend: MathBackendWebGL): TensorInfo[] {\n let program = new Pool2DProgram(convInfo, 'max', false);\n const poolOutput = backend.runWebGLProgram(program, [x], 'float32');\n\n program = new Pool2DProgram(convInfo, 'max', true, true, includeBatchInIndex);\n const indexOutput = backend.runWebGLProgram(program, [x], 'float32');\n return [poolOutput, indexOutput];\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {MaxPoolWithArgmax, MaxPoolWithArgmaxAttrs, MaxPoolWithArgmaxInputs} from '@tensorflow/tfjs-core';\nimport {backend_util, KernelConfig, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\n\nimport {maxPoolWithArgmaxImpl} from './MaxPoolWithArgmax_impl';\n\nexport const maxPoolWithArgmaxConfig: KernelConfig = {\n kernelName: MaxPoolWithArgmax,\n backendName: 'webgl',\n kernelFunc: ({inputs, attrs, backend}) => {\n const {x} = inputs as MaxPoolWithArgmaxInputs;\n const {filterSize, strides, pad, includeBatchInIndex} =\n attrs as {} as MaxPoolWithArgmaxAttrs;\n const webglBackend = backend as MathBackendWebGL;\n\n util.assert(\n x.shape.length === 4,\n () => `Error in maxPool: input must be rank 4 but got rank ${\n x.shape.length}.`);\n const dilations: [number, number] = [1, 1];\n util.assert(\n backend_util.eitherStridesOrDilationsAreOne(strides, dilations),\n () => 'Error in maxPool: Either strides or dilations must be 1. ' +\n `Got strides ${strides} and dilations '${dilations}'`);\n\n const convInfo = backend_util.computePool2DInfo(\n x.shape as [number, number, number, number], filterSize, strides,\n dilations, pad);\n\n const [result, indexes] =\n maxPoolWithArgmaxImpl(x, includeBatchInIndex, convInfo, webglBackend);\n return [result, indexes];\n }\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {reduce} from '../kernel_utils/reduce';\nimport {reshape} from '../kernels/Reshape';\n\nexport function meanImpl(\n x: TensorInfo, reduceShape: number[], outShape: number[],\n backend: MathBackendWebGL): TensorInfo {\n const inSize = util.sizeFromShape(reduceShape);\n const xSize = util.sizeFromShape(x.shape);\n const batchSize = xSize / inSize;\n const reshapedInput =\n reshape({inputs: {x}, attrs: {shape: [batchSize, inSize]}, backend});\n\n const reduced = reduce(reshapedInput, 'float32', 'mean', backend);\n const reshapedOutput =\n reshape({inputs: {x: reduced}, attrs: {shape: outShape}, backend});\n\n backend.disposeIntermediateTensorInfo(reshapedInput);\n backend.disposeIntermediateTensorInfo(reduced);\n\n return reshapedOutput;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, Mean, MeanAttrs, MeanInputs, TensorInfo, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\n\nimport {meanImpl} from './Mean_impl';\nimport {transposeImpl, transposeImplCPU} from './Transpose_impl';\n\nexport const meanConfig: KernelConfig = {\n kernelName: Mean,\n backendName: 'webgl',\n kernelFunc: ({inputs, attrs, backend}) => {\n const {x} = inputs as MeanInputs;\n const {keepDims, axis} = attrs as {} as MeanAttrs;\n const webglBackend = backend as MathBackendWebGL;\n\n const xRank = x.shape.length;\n const origAxes = util.parseAxisParam(axis, x.shape);\n\n let axes = origAxes;\n const permutedAxes = backend_util.getAxesPermutation(axes, xRank);\n const meanInputIsTransposed = permutedAxes != null;\n const shouldExecuteOnCPU = webglBackend.shouldExecuteOnCPU([x]);\n\n const intermediates: TensorInfo[] = [];\n\n let meanInput = x;\n if (meanInputIsTransposed) {\n if (shouldExecuteOnCPU) {\n const xTexData = webglBackend.texData.get(meanInput.dataId);\n const values = xTexData.values as TypedArray;\n\n const newShape: number[] = new Array(xRank);\n for (let i = 0; i < newShape.length; i++) {\n newShape[i] = x.shape[permutedAxes[i]];\n }\n const meanInputValues =\n transposeImplCPU(values, x.shape, x.dtype, permutedAxes, newShape);\n\n meanInput = webglBackend.makeTensorInfo(newShape, x.dtype);\n const meanInputData = webglBackend.texData.get(meanInput.dataId);\n meanInputData.values = meanInputValues;\n } else {\n meanInput = transposeImpl(x, permutedAxes, webglBackend);\n }\n\n intermediates.push(meanInput);\n axes = backend_util.getInnerMostAxes(axes.length, xRank);\n }\n\n backend_util.assertAxesAreInnerMostDims('sum', axes, xRank);\n const [meanOutShape, reduceShape] =\n backend_util.computeOutAndReduceShapes(meanInput.shape, axes);\n\n let outShape = meanOutShape;\n if (keepDims) {\n // rather than reshape at the end, set the target shape here.\n outShape = backend_util.expandShapeToKeepDim(meanOutShape, origAxes);\n }\n\n const out = meanImpl(meanInput, reduceShape, outShape, webglBackend);\n for (const i of intermediates) {\n webglBackend.disposeIntermediateTensorInfo(i);\n }\n\n return out;\n }\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, Min, MinAttrs, MinInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {reduce} from '../kernel_utils/reduce';\n\nimport {reshape} from './Reshape';\nimport {transpose} from './Transpose';\n\nexport function min(\n args: {inputs: MinInputs, backend: MathBackendWebGL, attrs: MinAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {axis, keepDims} = attrs;\n\n const xRank = x.shape.length;\n\n const origAxes = util.parseAxisParam(axis, x.shape);\n let axes = origAxes;\n const permutedAxes = backend_util.getAxesPermutation(axes, xRank);\n let permutedX = x;\n if (permutedAxes != null) {\n permutedX = transpose({inputs: {x}, backend, attrs: {perm: permutedAxes}});\n axes = backend_util.getInnerMostAxes(axes.length, x.shape.length);\n }\n\n backend_util.assertAxesAreInnerMostDims('min', axes, xRank);\n const [outShape, reduceShape] =\n backend_util.computeOutAndReduceShapes(permutedX.shape, axes);\n const inSize = util.sizeFromShape(reduceShape);\n const a2D =\n reshape({inputs: {x: permutedX}, backend, attrs: {shape: [-1, inSize]}});\n const reduced = reduce(a2D, a2D.dtype, 'min', backend);\n\n let res;\n if (keepDims) {\n const newShape = backend_util.expandShapeToKeepDim(outShape, origAxes);\n res = reshape({inputs: {x: reduced}, backend, attrs: {shape: newShape}});\n } else {\n res = reshape({inputs: {x: reduced}, backend, attrs: {shape: outShape}});\n }\n\n backend.disposeIntermediateTensorInfo(a2D);\n backend.disposeIntermediateTensorInfo(reduced);\n\n if (permutedAxes != null) {\n backend.disposeIntermediateTensorInfo(permutedX);\n }\n\n return res;\n}\n\nexport const minConfig: KernelConfig = {\n kernelName: Min,\n backendName: 'webgl',\n kernelFunc: min as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Minimum} from '@tensorflow/tfjs-core';\n\nimport {CHECK_NAN_SNIPPET} from '../binaryop_gpu';\nimport {CHECK_NAN_SNIPPET_PACKED} from '../binaryop_packed_gpu';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {minimumImplCPU} from '../kernel_utils/shared';\n\nconst MINIMUM = CHECK_NAN_SNIPPET + `\n return min(a, b);\n`;\n\nconst MINIMUM_PACKED = `\n vec4 result = vec4(min(a, b));\n bvec4 isNaNA = isnan(a);\n bvec4 isNaNB = isnan(b);\n bvec4 isNaN = bvec4(isNaNA.x || isNaNB.x, isNaNA.y || isNaNB.y, isNaNA.z || isNaNB.z, isNaNA.w || isNaNB.w);\n ` +\n CHECK_NAN_SNIPPET_PACKED + `\n return result;\n`;\n\nexport const minimum = binaryKernelFunc({\n opSnippet: MINIMUM,\n packedOpSnippet: MINIMUM_PACKED,\n cpuKernelImpl: minimumImplCPU\n});\n\nexport const minimumConfig: KernelConfig = {\n kernelName: Minimum,\n backendName: 'webgl',\n kernelFunc: minimum as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {getCoordsDataType} from './shader_compiler';\n\nexport class MirrorPadProgram implements GPGPUProgram {\n variableNames = ['x'];\n outputShape: number[];\n userCode: string;\n\n constructor(\n xShape: number[], paddings: Array<[number, number]>,\n mode: 'reflect'|'symmetric') {\n this.outputShape = paddings.map(\n (p, i) => p[0] /* beforePad */ + xShape[i] + p[1] /* afterPad */);\n const rank = xShape.length;\n const dtype = getCoordsDataType(rank);\n\n const start = paddings.map(p => p[0]).join(',');\n const end = paddings.map((p, i) => p[0] + xShape[i]).join(',');\n const unpackedCoords =\n ['coords[0]', 'coords[1]', 'coords[2]', 'coords[3]'].slice(0, rank);\n const offset = mode === 'reflect' ? 0 : 1;\n\n if (rank === 1) {\n this.userCode = `\n int start = ${start};\n int end = ${end};\n\n void main() {\n int outC = getOutputCoords();\n if (outC < start) {\n outC = start * 2 - outC - ${offset};\n } else if(outC >= end) {\n outC = (end - 1) * 2 - outC + ${offset};\n }\n setOutput(getX(outC - start));\n }\n `;\n return;\n }\n this.userCode = `\n ${dtype} start = ${dtype}(${start});\n ${dtype} end = ${dtype}(${end});\n\n void main() {\n ${dtype} outC = getOutputCoords();\n for (int i = 0; i < ${rank}; i++) {\n if (outC[i] < start[i]) {\n outC[i] = start[i] * 2 - outC[i] - ${offset};\n } else if(outC[i] >= end[i]) {\n outC[i] = (end[i] - 1) * 2 - outC[i] + ${offset};\n }\n }\n ${dtype} coords = outC - start;\n setOutput(getX(${unpackedCoords}));\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {getChannels} from './packing_util';\nimport {getCoordsDataType} from './shader_compiler';\n\n/**\n * Example shader code for\n * `mirrorPad(tf.tensor1d([1, 2, 3], 'int32'), [[2, 2]], 'reflect')`\n * ```\n * const int start = int(2);\n * const int end = int(5);\n *\n * void main() {\n * int outputLoc = getOutputCoords();\n * vec4 result = vec4(0.);\n *\n * int rc = outputLoc;\n *\n * int source = rc;\n * if (source < start) {\n * source = start * 2 - source - 0;\n * } else if (source >= end) {\n * source = (end - 1) * 2 - source + 0;\n * }\n * source -= start;\n *\n * result[0] = getChannel(getX(source), source);\n * rc += 1;\n * if(rc < 6) {\n * int source = rc;\n * if (source < start) {\n * source = start * 2 - source - 0;\n * } else if (source >= end) {\n * source = (end - 1) * 2 - source + 0;\n * }\n * source -= start;\n *\n * result[1] = getChannel(getX(source), source);\n * }\n *\n * setOutput(result);\n * }\n * ```\n */\nexport class MirrorPadPackedProgram implements GPGPUProgram {\n variableNames = ['x'];\n packedInputs = true;\n packedOutput = true;\n outputShape: number[];\n userCode: string;\n\n constructor(\n xShape: number[], paddings: Array<[number, number]>,\n mode: 'reflect'|'symmetric') {\n this.outputShape = paddings.map(\n (p, i) => p[0] /* beforePad */ + xShape[i] + p[1] /* afterPad */);\n const rank = xShape.length;\n const dtype = getCoordsDataType(rank);\n\n const start = paddings.map(p => p[0]).join(',');\n const end = paddings.map((p, i) => p[0] + xShape[i]).join(',');\n const coords = getChannels('rc', rank);\n const source = getChannels('source', rank);\n const cLimit = `${coords[rank - 1]} < ${this.outputShape[rank - 1]}`;\n const innerDims =\n rank === 1 ? 'source' : `vec2(${source.slice(-2).join()})`;\n const offset = mode === 'reflect' ? 0 : 1;\n\n let mainLoop = '';\n if (rank === 1) {\n const padSetup = `\n ${dtype} source = rc;\n if (source < start) {\n source = start * 2 - source - ${offset};\n } else if (source >= end) {\n source = (end - 1) * 2 - source + ${offset};\n }\n source -= start;\n `;\n mainLoop = `\n ${dtype} rc = outputLoc;\n ${padSetup}\n result[0] = getChannel(getX(${source.join()}), ${innerDims});\n ${coords[rank - 1]} += 1;\n if(${cLimit}) {\n ${padSetup}\n result[1] = getChannel(getX(${source.join()}), ${innerDims});\n }\n `;\n } else {\n const padSetup = `\n ${dtype} source = rc;\n ${dtype} lt = ${dtype}(lessThan(source, start));\n ${dtype} gte = ${dtype}(greaterThanEqual(source, end));\n ${dtype} orig = 1 - (lt + gte);\n source = orig * source +\n lt * (start * 2 - source - ${offset}) +\n gte * ((end - 1) * 2 - source + ${offset});\n source -= start;\n `;\n\n mainLoop = `\n ${dtype} rc = outputLoc;\n ${padSetup}\n result[0] = getChannel(getX(${source.join()}), ${innerDims});\n ${coords[rank - 1]} += 1;\n if(${cLimit}) {\n ${padSetup}\n result[1] = getChannel(getX(${source.join()}), ${innerDims});\n }\n rc = outputLoc;\n ${coords[rank - 2]} += 1;\n if(${coords[rank - 2]} < ${this.outputShape[rank - 2]}) {\n ${padSetup}\n result[2] = getChannel(getX(${source.join()}), ${innerDims});\n ${coords[rank - 1]} += 1;\n if(${cLimit}) {\n ${padSetup}\n result[3] = getChannel(getX(${source.join()}), ${innerDims});\n }\n }\n `;\n }\n\n this.userCode = `\n const ${dtype} start = ${dtype}(${start});\n const ${dtype} end = ${dtype}(${end});\n\n void main() {\n ${dtype} outputLoc = getOutputCoords();\n vec4 result = vec4(0.);\n ${mainLoop}\n setOutput(result);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env, KernelConfig, KernelFunc, MirrorPad, MirrorPadAttrs, MirrorPadInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {MirrorPadProgram} from '../mirror_pad_gpu';\nimport {MirrorPadPackedProgram} from '../mirror_pad_packed_gpu';\n\nexport const mirrorPadKernelFunc: (params: {\n inputs: MirrorPadInputs,\n backend: MathBackendWebGL,\n attrs: MirrorPadAttrs\n}) => TensorInfo = ({inputs, backend, attrs}) => {\n const {x} = inputs;\n const {paddings, mode} = attrs;\n\n const program = env().getBool('WEBGL_PACK_ARRAY_OPERATIONS') ?\n new MirrorPadPackedProgram(x.shape, paddings, mode) :\n new MirrorPadProgram(x.shape, paddings, mode);\n\n const output = backend.runWebGLProgram(program, [x], x.dtype);\n\n return output;\n};\n\nexport const mirrorPadConfig: KernelConfig = {\n kernelName: MirrorPad,\n backendName: 'webgl',\n kernelFunc: mirrorPadKernelFunc as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Mod} from '@tensorflow/tfjs-core';\n\nimport {CHECK_NAN_SNIPPET_PACKED} from '../binaryop_packed_gpu';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst MOD = `if (b == 0.0) return NAN;\n return mod(a, b);`;\n\nconst MOD_PACKED = `\n vec4 result = mod(a, b);\n bvec4 isNaN = equal(b, vec4(0.0));\n ` +\n CHECK_NAN_SNIPPET_PACKED + `\n return result;\n`;\n\nexport const mod = binaryKernelFunc({\n opSnippet: MOD,\n packedOpSnippet: MOD_PACKED,\n});\n\nexport const modConfig: KernelConfig = {\n kernelName: Mod,\n backendName: 'webgl',\n kernelFunc: mod as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {UniformType} from './shader_compiler';\n\nexport class MultinomialProgram implements GPGPUProgram {\n variableNames = ['probs'];\n outputShape: number[];\n userCode: string;\n customUniforms = [{name: 'seed', type: 'float' as UniformType}];\n\n constructor(batchSize: number, numOutcomes: number, numSamples: number) {\n this.outputShape = [batchSize, numSamples];\n\n this.userCode = `\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n\n float r = random(seed);\n float cdf = 0.0;\n\n for (int i = 0; i < ${numOutcomes - 1}; i++) {\n cdf += getProbs(batch, i);\n\n if (r < cdf) {\n setOutput(float(i));\n return;\n }\n }\n\n // If no other event happened, last event happened.\n setOutput(float(${numOutcomes - 1}));\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {RealDiv} from '@tensorflow/tfjs-core';\nimport {KernelConfig} from '@tensorflow/tfjs-core';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\n// Without the equality check div produces 0.9999 for a = b, which when\n// floored can cause errors.\nconst DIV = `\nif (a == b) {\n return 1.0;\n};\nreturn a / b;`;\n\n// We do the same as in ./binaryop_gpu, with vec4 and ivec4.\n// On Linux, the vectorized implementation produces NaNs when a and b are 0.\nconst DIV_PACKED = `\n // vec4 one = vec4(equal(a, b));\n // return one + (vec4(1.0) - one) * a / b;\n vec4 result = a / b;\n if(a.x == b.x) {\n result.x = 1.;\n }\n if(a.y == b.y) {\n result.y = 1.;\n }\n if(a.z == b.z) {\n result.z = 1.;\n }\n if(a.w == b.w) {\n result.w = 1.;\n }\n\n return result;\n`;\n\nexport const realDiv = binaryKernelFunc(\n {opSnippet: DIV, packedOpSnippet: DIV_PACKED, checkOutOfBounds: true});\n\nexport const realDivConfig: KernelConfig = {\n kernelName: RealDiv,\n backendName: 'webgl',\n kernelFunc: realDiv,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Sub} from '@tensorflow/tfjs-core';\n\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {subImplCPU as cpuSub} from '../kernel_utils/shared';\n\nconst SUB = 'return a - b;';\n\nexport const sub = binaryKernelFunc({\n opSnippet: SUB,\n packedOpSnippet: SUB,\n supportsComplex: true,\n cpuKernelImpl: cpuSub\n});\n\nexport const subConfig: KernelConfig = {\n kernelName: Sub,\n backendName: 'webgl',\n kernelFunc: sub\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, Softmax, SoftmaxAttrs, SoftmaxInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\n\nimport {exp} from './Exp';\nimport {max} from './Max';\nimport {realDiv} from './RealDiv';\nimport {reshape} from './Reshape';\nimport {sub} from './Sub';\nimport {sum} from './Sum';\n\nexport function softmax(args: {\n inputs: SoftmaxInputs,\n backend: MathBackendWebGL,\n attrs: SoftmaxAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {logits} = inputs;\n const {dim} = attrs;\n\n const axes = util.parseAxisParam([dim], logits.shape);\n\n const maxLogit = max({\n inputs: {x: logits},\n backend,\n attrs: {reductionIndices: axes, keepDims: false}\n });\n\n const expandedShape = backend_util.expandShapeToKeepDim(maxLogit.shape, axes);\n\n const maxLogitsReshaped =\n reshape({inputs: {x: maxLogit}, backend, attrs: {shape: expandedShape}});\n const a =\n sub({inputs: {a: logits, b: maxLogitsReshaped}, backend}) as TensorInfo;\n const b = exp({inputs: {x: a}, backend}) as TensorInfo;\n const sumExp =\n sum({inputs: {x: b}, backend, attrs: {axis: axes, keepDims: false}});\n const sumExpReshaped =\n reshape({inputs: {x: sumExp}, backend, attrs: {shape: expandedShape}});\n\n const res =\n realDiv({inputs: {a: b, b: sumExpReshaped}, backend}) as TensorInfo;\n\n backend.disposeIntermediateTensorInfo(maxLogit);\n backend.disposeIntermediateTensorInfo(maxLogitsReshaped);\n backend.disposeIntermediateTensorInfo(a);\n backend.disposeIntermediateTensorInfo(b);\n backend.disposeIntermediateTensorInfo(sumExp);\n backend.disposeIntermediateTensorInfo(sumExpReshaped);\n\n return res;\n}\n\nexport const softmaxConfig: KernelConfig = {\n kernelName: Softmax,\n backendName: 'webgl',\n kernelFunc: softmax as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Multinomial, MultinomialAttrs, MultinomialInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {MultinomialProgram} from '../multinomial_gpu';\n\nimport {softmax} from './Softmax';\n\nexport function multinomial(args: {\n inputs: MultinomialInputs,\n backend: MathBackendWebGL,\n attrs: MultinomialAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {logits} = inputs;\n const {numSamples, seed, normalized} = attrs;\n\n const probs = normalized ?\n logits :\n softmax(\n {inputs: {logits}, backend, attrs: {dim: logits.shape.length - 1}});\n const batchSize = probs.shape[0];\n const numOutcomes = probs.shape[1];\n const program = new MultinomialProgram(batchSize, numOutcomes, numSamples);\n const customValues = [[seed]];\n const res = backend.runWebGLProgram(program, [probs], 'int32', customValues);\n if (!normalized) {\n backend.disposeIntermediateTensorInfo(probs);\n }\n return res;\n}\n\nexport const multinomialConfig: KernelConfig = {\n kernelName: Multinomial,\n backendName: 'webgl',\n kernelFunc: multinomial as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env, KernelConfig, KernelFunc, Neg, NegInputs, TensorInfo, TypedArray} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {negImplCPU} from '../kernel_utils/shared';\nimport {CHECK_NAN_SNIPPET, UnaryOpProgram} from '../unaryop_gpu';\nimport {UnaryOpPackedProgram} from '../unaryop_packed_gpu';\n\nconst NEG = CHECK_NAN_SNIPPET + `\n return -x;\n`;\n\nconst NEG_PACKED = `\n vec4 result = -x;\n bvec4 isNaN = isnan(x);\n\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n`;\n\n// This doesn't use unaryKernelFunc because negImplCPU is not of type\n// SimpleUnaryKernelImplCPU.\nexport function neg(args: {inputs: NegInputs, backend: MathBackendWebGL}):\n TensorInfo {\n const {inputs, backend} = args;\n const {x} = inputs;\n\n if (backend.shouldExecuteOnCPU([x])) {\n const xData = backend.texData.get(x.dataId);\n const [outValues, newShape] =\n negImplCPU(xData.values as TypedArray, x.shape, x.dtype);\n return backend.makeTensorInfo(newShape, x.dtype, outValues);\n }\n\n let program: UnaryOpProgram|UnaryOpPackedProgram;\n if (env().getBool('WEBGL_PACK_UNARY_OPERATIONS')) {\n program = new UnaryOpPackedProgram(x.shape, NEG_PACKED);\n } else {\n program = new UnaryOpProgram(x.shape, NEG);\n }\n\n return backend.runWebGLProgram(program, [x], x.dtype);\n}\n\nexport const negConfig: KernelConfig = {\n kernelName: Neg,\n backendName: 'webgl',\n kernelFunc: neg as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, kernel_impls, KernelConfig, KernelFunc, NonMaxSuppressionV3, NonMaxSuppressionV3Attrs, NonMaxSuppressionV3Inputs, TypedArray} from '@tensorflow/tfjs-core';\n\nconst nonMaxSuppressionV3Impl = kernel_impls.nonMaxSuppressionV3Impl;\nimport {MathBackendWebGL} from '../backend_webgl';\n\nexport function nonMaxSuppressionV3(args: {\n inputs: NonMaxSuppressionV3Inputs,\n backend: MathBackendWebGL,\n attrs: NonMaxSuppressionV3Attrs\n}) {\n backend_util.warn(\n 'tf.nonMaxSuppression() in webgl locks the UI thread. ' +\n 'Call tf.nonMaxSuppressionAsync() instead');\n\n const {inputs, backend, attrs} = args;\n const {boxes, scores} = inputs;\n const {maxOutputSize, iouThreshold, scoreThreshold} = attrs;\n\n const boxesVals = backend.readSync(boxes.dataId) as TypedArray;\n const scoresVals = backend.readSync(scores.dataId) as TypedArray;\n\n const {selectedIndices} = nonMaxSuppressionV3Impl(\n boxesVals, scoresVals, maxOutputSize, iouThreshold, scoreThreshold);\n\n return backend.makeTensorInfo(\n [selectedIndices.length], 'int32', new Int32Array(selectedIndices));\n}\n\nexport const nonMaxSuppressionV3Config: KernelConfig = {\n kernelName: NonMaxSuppressionV3,\n backendName: 'webgl',\n kernelFunc: nonMaxSuppressionV3 as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, kernel_impls, KernelConfig, KernelFunc, NonMaxSuppressionV4, NonMaxSuppressionV4Attrs, NonMaxSuppressionV4Inputs, TensorInfo, TypedArray} from '@tensorflow/tfjs-core';\nconst nonMaxSuppressionV4Impl = kernel_impls.nonMaxSuppressionV4Impl;\n\nimport {MathBackendWebGL} from '../backend_webgl';\n\nexport function nonMaxSuppressionV4(args: {\n inputs: NonMaxSuppressionV4Inputs,\n backend: MathBackendWebGL,\n attrs: NonMaxSuppressionV4Attrs\n}): [TensorInfo, TensorInfo] {\n backend_util.warn(\n 'tf.nonMaxSuppression() in webgl locks the UI thread. ' +\n 'Call tf.nonMaxSuppressionAsync() instead');\n\n const {inputs, backend, attrs} = args;\n const {boxes, scores} = inputs;\n const {maxOutputSize, iouThreshold, scoreThreshold, padToMaxOutputSize} =\n attrs;\n\n const boxesVals = backend.readSync(boxes.dataId) as TypedArray;\n const scoresVals = backend.readSync(scores.dataId) as TypedArray;\n\n const {selectedIndices, validOutputs} = nonMaxSuppressionV4Impl(\n boxesVals, scoresVals, maxOutputSize, iouThreshold, scoreThreshold,\n padToMaxOutputSize);\n\n return [\n backend.makeTensorInfo(\n [selectedIndices.length], 'int32', new Int32Array(selectedIndices)),\n backend.makeTensorInfo([], 'int32', new Int32Array([validOutputs]))\n ];\n}\n\nexport const nonMaxSuppressionV4Config: KernelConfig = {\n kernelName: NonMaxSuppressionV4,\n backendName: 'webgl',\n kernelFunc: nonMaxSuppressionV4 as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, kernel_impls, KernelConfig, KernelFunc, NonMaxSuppressionV5, NonMaxSuppressionV5Attrs, NonMaxSuppressionV5Inputs, TensorInfo, TypedArray} from '@tensorflow/tfjs-core';\n\nconst nonMaxSuppressionV5Impl = kernel_impls.nonMaxSuppressionV5Impl;\nimport {MathBackendWebGL} from '../backend_webgl';\n\nexport function nonMaxSuppressionV5(args: {\n inputs: NonMaxSuppressionV5Inputs,\n backend: MathBackendWebGL,\n attrs: NonMaxSuppressionV5Attrs\n}): [TensorInfo, TensorInfo] {\n backend_util.warn(\n 'tf.nonMaxSuppression() in webgl locks the UI thread. ' +\n 'Call tf.nonMaxSuppressionAsync() instead');\n\n const {inputs, backend, attrs} = args;\n const {boxes, scores} = inputs;\n const {maxOutputSize, iouThreshold, scoreThreshold, softNmsSigma} = attrs;\n\n const boxesVals = backend.readSync(boxes.dataId) as TypedArray;\n const scoresVals = backend.readSync(scores.dataId) as TypedArray;\n\n const maxOutputSizeVal = maxOutputSize;\n const iouThresholdVal = iouThreshold;\n const scoreThresholdVal = scoreThreshold;\n const softNmsSigmaVal = softNmsSigma;\n\n const {selectedIndices, selectedScores} = nonMaxSuppressionV5Impl(\n boxesVals, scoresVals, maxOutputSizeVal, iouThresholdVal,\n scoreThresholdVal, softNmsSigmaVal);\n\n return [\n backend.makeTensorInfo(\n [selectedIndices.length], 'int32', new Int32Array(selectedIndices)),\n backend.makeTensorInfo(\n [selectedScores.length], 'float32', new Float32Array(selectedScores))\n ];\n}\n\nexport const nonMaxSuppressionV5Config: KernelConfig = {\n kernelName: NonMaxSuppressionV5,\n backendName: 'webgl',\n kernelFunc: nonMaxSuppressionV5 as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class OneHotProgram implements GPGPUProgram {\n variableNames = ['indices'];\n outputShape: number[];\n userCode: string;\n\n // Caching uniform location for speed.\n seedLoc: WebGLUniformLocation;\n\n constructor(\n numIndices: number, depth: number, onValue: number, offValue: number) {\n this.outputShape = [numIndices, depth];\n\n this.userCode = `\n void main() {\n ivec2 coords = getOutputCoords();\n int index = round(getIndices(coords.x));\n setOutput(mix(float(${offValue}), float(${onValue}),\n float(index == coords.y)));\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, OneHot, OneHotAttrs, OneHotInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {OneHotProgram} from '../onehot_gpu';\nimport {reshape} from './Reshape';\n\nexport const oneHot = (args: {\n inputs: OneHotInputs,\n backend: MathBackendWebGL,\n attrs: OneHotAttrs\n}): TensorInfo => {\n const {inputs, backend, attrs} = args;\n const {indices} = inputs;\n const {dtype, depth, onValue, offValue} = attrs;\n\n const indicesSize = util.sizeFromShape(indices.shape);\n const program = new OneHotProgram(indicesSize, depth, onValue, offValue);\n const reshaped =\n reshape({inputs: {x: indices}, backend, attrs: {shape: [indicesSize]}});\n const result = backend.runWebGLProgram(program, [reshaped], dtype);\n backend.disposeIntermediateTensorInfo(reshaped);\n\n const outShape = [...indices.shape, depth];\n const out = reshape({inputs: {x: result}, backend, attrs: {shape: outShape}});\n backend.disposeIntermediateTensorInfo(result);\n return out;\n};\n\nexport const oneHotConfig: KernelConfig = {\n kernelName: OneHot,\n backendName: 'webgl',\n kernelFunc: oneHot as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, TensorInfo, ZerosLike, ZerosLikeInputs} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\n\nimport {complex} from './Complex';\nimport {fill} from './Fill';\nimport {imag} from './Imag';\nimport {real} from './Real';\n\nexport function zerosLike(\n args: {inputs: ZerosLikeInputs, backend: MathBackendWebGL}): TensorInfo {\n const {inputs, backend} = args;\n const {x} = inputs;\n\n if (x.dtype === 'complex64') {\n const realPart = real({inputs: {input: x}, backend});\n const r = zerosLike({inputs: {x: realPart}, backend});\n const imagPart = imag({inputs: {input: x}, backend});\n const i = zerosLike({inputs: {x: imagPart}, backend});\n\n const result = complex({inputs: {real: r, imag: i}, backend});\n\n backend.disposeIntermediateTensorInfo(realPart);\n backend.disposeIntermediateTensorInfo(r);\n backend.disposeIntermediateTensorInfo(imagPart);\n backend.disposeIntermediateTensorInfo(i);\n\n return result;\n } else {\n return fill({\n attrs: {\n shape: x.shape,\n dtype: x.dtype,\n value: x.dtype === 'string' ? '' : 0\n },\n backend\n });\n }\n}\n\nexport const zerosLikeConfig: KernelConfig = {\n kernelName: ZerosLike,\n backendName: 'webgl',\n kernelFunc: zerosLike as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, OnesLike, OnesLikeInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\n\nimport {complex} from './Complex';\nimport {fill} from './Fill';\nimport {imag} from './Imag';\nimport {real} from './Real';\nimport {zerosLike} from './ZerosLike';\n\nexport function onesLike(\n args: {inputs: OnesLikeInputs, backend: MathBackendWebGL}): TensorInfo {\n const {inputs, backend} = args;\n const {x} = inputs;\n\n if (x.dtype === 'string') {\n throw new Error('onesLike is not supported under string dtype');\n } else if (x.dtype === 'complex64') {\n const realPart = real({inputs: {input: x}, backend});\n const r = onesLike({inputs: {x: realPart}, backend});\n const imagPart = imag({inputs: {input: x}, backend});\n const i = zerosLike({inputs: {x: imagPart}, backend});\n\n const result = complex({inputs: {real: r, imag: i}, backend});\n\n backend.disposeIntermediateTensorInfo(realPart);\n backend.disposeIntermediateTensorInfo(r);\n backend.disposeIntermediateTensorInfo(imagPart);\n backend.disposeIntermediateTensorInfo(i);\n\n return result;\n } else {\n // TODO(cais, smilkov): Add WebGL shader for onesLike:\n // https://github.com/tensorflow/tfjs/issues/1293\n return fill({attrs: {shape: x.shape, dtype: x.dtype, value: 1}, backend});\n }\n}\n\nexport const onesLikeConfig: KernelConfig = {\n kernelName: OnesLike,\n backendName: 'webgl',\n kernelFunc: onesLike as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Pack, PackAttrs, PackInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {concat} from './Concat';\nimport {expandDims} from './ExpandDims';\n\nexport function pack(\n args: {inputs: PackInputs, backend: MathBackendWebGL, attrs: PackAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {axis} = attrs;\n\n if (inputs.length === 1) {\n return expandDims(\n {inputs: {input: inputs[0]}, backend, attrs: {dim: axis}});\n }\n\n const shape = inputs[0].shape;\n const dtype = inputs[0].dtype;\n\n inputs.forEach(t => {\n util.assertShapesMatch(\n shape, t.shape,\n 'All tensors passed to stack must have matching shapes');\n util.assert(\n dtype === t.dtype,\n () => 'All tensors passed to stack must have matching dtypes');\n });\n\n const intermediateTensorInfos: TensorInfo[] = [];\n const expandedTensors = inputs.map(t => {\n const expandedT =\n expandDims({inputs: {input: t}, backend, attrs: {dim: axis}});\n intermediateTensorInfos.push(expandedT);\n return expandedT;\n });\n\n const result = concat({inputs: expandedTensors, backend, attrs: {axis}});\n\n intermediateTensorInfos.forEach(\n t => backend.disposeIntermediateTensorInfo(t));\n\n return result;\n}\n\nexport const packConfig: KernelConfig = {\n kernelName: Pack,\n backendName: 'webgl',\n kernelFunc: pack as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {getCoordsDataType, UniformType} from './shader_compiler';\n\nexport class PadProgram implements GPGPUProgram {\n variableNames = ['x'];\n outputShape: number[];\n userCode: string;\n customUniforms = [{name: 'value', type: 'float' as UniformType}];\n\n constructor(\n xShape: number[], paddings: Array<[number, number]>,\n constantValue: number) {\n this.outputShape = paddings.map(\n (p, i) => p[0] /* beforePad */ + xShape[i] + p[1] /* afterPad */);\n const rank = xShape.length;\n const type = getCoordsDataType(rank);\n\n const start = paddings.map(p => p[0]).join(',');\n const end = paddings.map((p, i) => p[0] + xShape[i]).join(',');\n const unpackedCoords =\n ['coords[0]', 'coords[1]', 'coords[2]', 'coords[3]'].slice(0, rank);\n\n if (rank === 1) {\n this.userCode = `\n int start = ${start};\n int end = ${end};\n\n void main() {\n int outC = getOutputCoords();\n if (outC < start || outC >= end) {\n setOutput(value);\n } else {\n setOutput(getX(outC - start));\n }\n }\n `;\n return;\n }\n this.userCode = `\n ${type} start = ${type}(${start});\n ${type} end = ${type}(${end});\n\n void main() {\n ${type} outC = getOutputCoords();\n if (any(lessThan(outC, start)) || any(greaterThanEqual(outC, end))) {\n setOutput(value);\n } else {\n ${type} coords = outC - start;\n setOutput(getX(${unpackedCoords}));\n }\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {getChannels} from './packing_util';\nimport {getCoordsDataType, UniformType} from './shader_compiler';\n\nexport class PadPackedProgram implements GPGPUProgram {\n variableNames = ['x'];\n packedInputs = true;\n packedOutput = true;\n outputShape: number[];\n userCode: string;\n customUniforms = [{name: 'value', type: 'float' as UniformType}];\n\n constructor(\n xShape: number[], paddings: Array<[number, number]>,\n constantValue: number) {\n this.outputShape = paddings.map(\n (p, i) => p[0] /* beforePad */ + xShape[i] + p[1] /* afterPad */);\n const rank = xShape.length;\n const dtype = getCoordsDataType(rank);\n\n const start = paddings.map(p => p[0]).join(',');\n const end = paddings.map((p, i) => p[0] + xShape[i]).join(',');\n const coords = getChannels('rc', rank);\n const source = getChannels('source', rank);\n const cLimit = `${coords[rank - 1]} < ${this.outputShape[rank - 1]}`;\n const innerDims =\n rank === 1 ? 'source' : `vec2(${source.slice(-2).join()})`;\n\n const componentSetup = [\n `${dtype} rc = outputLoc;`, `${coords[rank - 1]} += 1;\n if(${cLimit}) {\n `,\n rank === 1 ? '' : `}\n rc = outputLoc;\n ${coords[rank - 2]} += 1;\n if(${coords[rank - 2]} < ${this.outputShape[rank - 2]}) {`,\n rank === 1 ? '' : ` ${coords[rank - 1]} += 1;\n if(${cLimit}) {`\n ];\n\n const paddingArea = rank === 1 ?\n 'rc < start || rc >= end' :\n 'any(lessThan(rc, start)) || any(greaterThanEqual(rc, end))';\n let mainLoop = '';\n for (let i = 0, j = rank === 1 ? 2 : 4; i < j; i++) {\n mainLoop += `\n ${componentSetup[i]}\n if (${paddingArea}) {\n result[${i}] = float(value);\n } else {\n ${dtype} source = rc - start;\n result[${i}] = getChannel(getX(${source.join()}), ${innerDims});\n }\n `;\n }\n mainLoop += (rank === 1 ? `} ` : `}}`);\n\n this.userCode = `\n const ${dtype} start = ${dtype}(${start});\n const ${dtype} end = ${dtype}(${end});\n\n void main() {\n ${dtype} outputLoc = getOutputCoords();\n vec4 result = vec4(0.);\n ${mainLoop}\n setOutput(result);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env, KernelConfig, KernelFunc, PadV2, PadV2Attrs, PadV2Inputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {PadProgram} from '../pad_gpu';\nimport {PadPackedProgram} from '../pad_packed_gpu';\nimport {fill} from './Fill';\n\nexport const padV2 =\n (args: {inputs: PadV2Inputs, backend: MathBackendWebGL, attrs: PadV2Attrs}):\n TensorInfo => {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {paddings, constantValue} = attrs;\n\n if (util.sizeFromShape(x.shape) === 0) {\n // Short-circuit the computation, since x doesn't have value, only\n // the shape is used to compute output shape to pad.\n const outputShape = paddings.map(\n (p, i) =>\n p[0] /* beforePad */ + x.shape[i] + p[1] /* afterPad */);\n return fill({\n backend,\n attrs: {shape: outputShape, value: constantValue, dtype: x.dtype}\n });\n }\n\n const program = env().getBool('WEBGL_PACK_ARRAY_OPERATIONS') ?\n new PadPackedProgram(x.shape, paddings, constantValue) :\n new PadProgram(x.shape, paddings, constantValue);\n const customValues = [[constantValue]];\n return backend.runWebGLProgram(program, [x], x.dtype, customValues);\n };\n\nexport const padV2Config: KernelConfig = {\n kernelName: PadV2,\n backendName: 'webgl',\n kernelFunc: padV2 as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Pow} from '@tensorflow/tfjs-core';\n\nimport {CHECK_NAN_SNIPPET_PACKED} from '../binaryop_packed_gpu';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst POW = `\n if(a < 0.0 && floor(b) < b){\n return NAN;\n }\n if (b == 0.0) {\n return 1.0;\n }\n return (round(mod(b, 2.0)) != 1) ?\n pow(abs(a), b) : sign(a) * pow(abs(a), b);\n`;\n\nconst POW_PACKED = `\n // isModRound1 has 1 for components with round(mod(b, 2.0)) == 1, 0 otherwise.\n vec4 isModRound1 = vec4(equal(round(mod(b, 2.0)), ivec4(1)));\n vec4 multiplier = sign(a) * isModRound1 + (vec4(1.0) - isModRound1);\n vec4 result = multiplier * pow(abs(a), b);\n\n // Ensure that a^0 = 1, including 0^0 = 1 as this correspond to TF and JS\n bvec4 isExpZero = equal(b, vec4(0.0));\n result.r = isExpZero.r ? 1.0 : result.r;\n result.g = isExpZero.g ? 1.0 : result.g;\n result.b = isExpZero.b ? 1.0 : result.b;\n result.a = isExpZero.a ? 1.0 : result.a;\n\n bvec4 isNaN1 = lessThan(a, vec4(0.0));\n bvec4 isNaN2 = lessThan(floor(b), b);\n bvec4 isNaN = bvec4(isNaN1.x && isNaN2.x, isNaN1.y && isNaN2.y, isNaN1.z && isNaN2.z, isNaN1.w && isNaN2.w);\n ` +\n CHECK_NAN_SNIPPET_PACKED + `\n return result;\n`;\n\nexport const pow =\n binaryKernelFunc({opSnippet: POW, packedOpSnippet: POW_PACKED});\n\nexport const powConfig: KernelConfig = {\n kernelName: Pow,\n backendName: 'webgl',\n kernelFunc: pow as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, Prod, ProdAttrs, ProdInputs, sumOutType, TensorInfo, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {reduce} from '../kernel_utils/reduce';\nimport {prodImplCPU} from '../kernel_utils/shared';\n\nimport {reshape} from './Reshape';\nimport {transpose} from './Transpose';\n\nexport function prod(\n args: {inputs: ProdInputs, backend: MathBackendWebGL, attrs: ProdAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {axis, keepDims} = attrs;\n\n const xRank = x.shape.length;\n const toDispose = [];\n\n const origAxes = util.parseAxisParam(axis, x.shape);\n let axes = origAxes;\n const permutedAxes = backend_util.getAxesPermutation(axes, xRank);\n let permutedX = x;\n if (permutedAxes != null) {\n permutedX = transpose({inputs: {x}, backend, attrs: {perm: permutedAxes}});\n axes = backend_util.getInnerMostAxes(axes.length, xRank);\n toDispose.push(permutedX);\n }\n\n backend_util.assertAxesAreInnerMostDims('prod', axes, xRank);\n\n let res;\n if (backend.shouldExecuteOnCPU([permutedX])) {\n const xVals = backend.texData.get(permutedX.dataId).values as TypedArray;\n const {outVals, outShape, outDtype} =\n prodImplCPU(permutedX.shape, permutedX.dtype, xVals, axes);\n res = backend.makeTensorInfo(outShape, outDtype, outVals);\n } else {\n const [outShape, reduceShape] =\n backend_util.computeOutAndReduceShapes(permutedX.shape, axes);\n const inSize = util.sizeFromShape(reduceShape);\n const a2D = reshape(\n {inputs: {x: permutedX}, backend, attrs: {shape: [-1, inSize]}});\n const outputDType = sumOutType(x.dtype);\n const reduced = reduce(a2D, outputDType, 'prod', backend);\n res = reshape({inputs: {x: reduced}, backend, attrs: {shape: outShape}});\n\n toDispose.push(a2D);\n toDispose.push(reduced);\n }\n\n if (keepDims) {\n toDispose.push(res);\n const newShape = backend_util.expandShapeToKeepDim(res.shape, origAxes);\n res = reshape({inputs: {x: res}, backend, attrs: {shape: newShape}});\n }\n\n toDispose.forEach(t => backend.disposeIntermediateTensorInfo(t));\n\n return res;\n}\n\nexport const prodConfig: KernelConfig = {\n kernelName: Prod,\n backendName: 'webgl',\n kernelFunc: prod as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, RaggedGather, RaggedGatherAttrs, RaggedGatherInputs, TensorInfo, TypedArray} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {raggedGatherImplCPU} from '../kernel_utils/shared';\n\nexport function raggedGather(args: {\n inputs: RaggedGatherInputs,\n backend: MathBackendWebGL,\n attrs: RaggedGatherAttrs\n}): TensorInfo[] {\n const {inputs, backend, attrs} = args;\n const {paramsNestedSplits, paramsDenseValues, indices} = inputs;\n const {outputRaggedRank} = attrs;\n\n const $paramsNestedSplits =\n paramsNestedSplits.map(t => backend.readSync(t.dataId) as TypedArray);\n const $paramsNestedSplitsShapes = paramsNestedSplits.map(t => t.shape);\n const $paramsDenseValues =\n backend.readSync(paramsDenseValues.dataId) as TypedArray;\n const $indices = backend.readSync(indices.dataId) as TypedArray;\n\n const [outputNestedSplits, outputDenseValues, outputDenseValuesShape] =\n raggedGatherImplCPU(\n $paramsNestedSplits, $paramsNestedSplitsShapes, $paramsDenseValues,\n paramsDenseValues.shape, paramsDenseValues.dtype, $indices,\n indices.shape, outputRaggedRank);\n\n const outputNestedSplitsTensors = outputNestedSplits.map(\n (splits) => backend.makeTensorInfo([splits.length], 'int32', splits));\n\n const outputDenseValuesTensor = backend.makeTensorInfo(\n outputDenseValuesShape, paramsDenseValues.dtype, outputDenseValues);\n\n return outputNestedSplitsTensors.concat([outputDenseValuesTensor]);\n}\n\nexport const raggedGatherConfig: KernelConfig = {\n kernelName: RaggedGather,\n backendName: 'webgl',\n kernelFunc: raggedGather as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, RaggedRange, RaggedRangeInputs, TensorInfo, TypedArray} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {raggedRangeImplCPU} from '../kernel_utils/shared';\n\nexport function raggedRange(\n args: {inputs: RaggedRangeInputs, backend: MathBackendWebGL}):\n [TensorInfo, TensorInfo] {\n const {inputs, backend} = args;\n const {starts, limits, deltas} = inputs;\n\n const $starts = backend.readSync(starts.dataId) as TypedArray;\n const $limits = backend.readSync(limits.dataId) as TypedArray;\n const $deltas = backend.readSync(deltas.dataId) as TypedArray;\n\n const [rtNestedSplitsData, rtDenseValuesData] = raggedRangeImplCPU(\n $starts, starts.shape, starts.dtype, $limits, limits.shape, $deltas,\n deltas.shape);\n\n const rtNestedSplits = backend.makeTensorInfo(\n [rtNestedSplitsData.length], 'int32', rtNestedSplitsData);\n const rtDenseValues = backend.makeTensorInfo(\n [rtDenseValuesData.length], starts.dtype, rtDenseValuesData);\n\n return [rtNestedSplits, rtDenseValues];\n}\n\nexport const raggedRangeConfig: KernelConfig = {\n kernelName: RaggedRange,\n backendName: 'webgl',\n kernelFunc: raggedRange as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, RaggedTensorToTensor, RaggedTensorToTensorAttrs, RaggedTensorToTensorInputs, TensorInfo, TypedArray} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {raggedTensorToTensorImplCPU} from '../kernel_utils/shared';\n\nexport function raggedTensorToTensor(args: {\n inputs: RaggedTensorToTensorInputs,\n backend: MathBackendWebGL,\n attrs: RaggedTensorToTensorAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {shape, values, defaultValue, rowPartitionTensors} = inputs;\n const {rowPartitionTypes} = attrs;\n\n const $shape = backend.readSync(shape.dataId) as TypedArray;\n const $values = backend.readSync(values.dataId) as TypedArray;\n const $defaultValue = backend.readSync(defaultValue.dataId) as TypedArray;\n const $rowPartitionValues =\n rowPartitionTensors.map(t => backend.readSync(t.dataId) as TypedArray);\n const rowPartitionValuesShapes = rowPartitionTensors.map(t => t.shape);\n\n const [outputShape, output] = raggedTensorToTensorImplCPU(\n $shape, shape.shape, $values, values.shape, values.dtype, $defaultValue,\n defaultValue.shape, $rowPartitionValues, rowPartitionValuesShapes,\n rowPartitionTypes);\n return backend.makeTensorInfo(outputShape, values.dtype, output);\n}\n\nexport const raggedTensorToTensorConfig: KernelConfig = {\n kernelName: RaggedTensorToTensor,\n backendName: 'webgl',\n kernelFunc: raggedTensorToTensor as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Range, RangeAttrs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {rangeImplCPU} from '../kernel_utils/shared';\n\nexport const range =\n (args: {backend: MathBackendWebGL, attrs: RangeAttrs}): TensorInfo => {\n const {backend, attrs} = args;\n const {start, stop, step, dtype} = attrs;\n const values = rangeImplCPU(start, stop, step, dtype);\n return backend.makeTensorInfo([values.length], dtype, values);\n };\n\nexport const rangeConfig: KernelConfig = {\n kernelName: Range,\n backendName: 'webgl',\n kernelFunc: range as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Reciprocal} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst RECIPROCAL = `return 1.0 / x;`;\n\nexport const reciprocal = unaryKernelFunc({opSnippet: RECIPROCAL});\n\nexport const reciprocalConfig: KernelConfig = {\n kernelName: Reciprocal,\n backendName: 'webgl',\n kernelFunc: reciprocal,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Relu} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {CHECK_NAN_SNIPPET} from '../unaryop_gpu';\n\nconst RELU = CHECK_NAN_SNIPPET + `\n return (x < 0.0) ? 0.0 : x;\n`;\n\nconst RELU_PACKED = `\n vec4 result = x * vec4(greaterThanEqual(x, vec4(0.0)));\n bvec4 isNaN = isnan(x);\n\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n`;\n\nexport const relu =\n unaryKernelFunc({opSnippet: RELU, packedOpSnippet: RELU_PACKED});\n\nexport const reluConfig: KernelConfig = {\n kernelName: Relu,\n backendName: 'webgl',\n kernelFunc: relu as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Relu6} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {CHECK_NAN_SNIPPET} from '../unaryop_gpu';\n\nconst RELU6 = CHECK_NAN_SNIPPET + `\n return (x < 0.0) ? 0.0 : min(6.0, x);\n`;\n\nconst RELU6_PACKED = `\n vec4 result = min(x, vec4(6.)) * vec4(greaterThanEqual(x, vec4(0.0)));\n bvec4 isNaN = isnan(x);\n\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n`;\n\nexport const relu6 =\n unaryKernelFunc({opSnippet: RELU6, packedOpSnippet: RELU6_PACKED});\n\nexport const relu6Config: KernelConfig = {\n kernelName: Relu6,\n backendName: 'webgl',\n kernelFunc: relu6 as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class ResizeBilinearProgram implements GPGPUProgram {\n variableNames = ['A'];\n outputShape: number[] = [];\n userCode: string;\n\n constructor(\n inputShape: [number, number, number, number], newHeight: number,\n newWidth: number, alignCorners: boolean, halfPixelCenters: boolean) {\n const [batch, oldHeight, oldWidth, depth] = inputShape;\n this.outputShape = [batch, newHeight, newWidth, depth];\n\n const effectiveInSize: [number, number] = [\n (alignCorners && newHeight > 1) ? oldHeight - 1 : oldHeight,\n (alignCorners && newWidth > 1) ? oldWidth - 1 : oldWidth\n ];\n\n const effectiveOutSize: [number, number] = [\n (alignCorners && newHeight > 1) ? newHeight - 1 : newHeight,\n (alignCorners && newWidth > 1) ? newWidth - 1 : newWidth\n ];\n\n let sourceFracIndexRC: string;\n if (halfPixelCenters) {\n sourceFracIndexRC =\n `(vec2(yRC) + vec2(0.5)) * effectiveInputOverOutputRatioRC` +\n ` - vec2(0.5)`;\n } else {\n sourceFracIndexRC = `vec2(yRC) * effectiveInputOverOutputRatioRC`;\n }\n\n this.userCode = `\n const vec2 effectiveInputOverOutputRatioRC = vec2(\n ${effectiveInSize[0] / effectiveOutSize[0]},\n ${effectiveInSize[1] / effectiveOutSize[1]});\n const vec2 inputShapeRC = vec2(${oldHeight}.0, ${oldWidth}.0);\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n ivec2 yRC = coords.yz;\n\n // Fractional source index.\n vec2 sourceFracIndexRC = ${sourceFracIndexRC};\n\n // Compute the four integer indices.\n ivec2 sourceFloorRC = ivec2(max(sourceFracIndexRC, vec2(0.0)));\n ivec2 sourceCeilRC = ivec2(\n min(inputShapeRC - 1.0, ceil(sourceFracIndexRC)));\n\n float topLeft = getA(b, sourceFloorRC.x, sourceFloorRC.y, d);\n float bottomLeft = getA(b, sourceCeilRC.x, sourceFloorRC.y, d);\n float topRight = getA(b, sourceFloorRC.x, sourceCeilRC.y, d);\n float bottomRight = getA(b, sourceCeilRC.x, sourceCeilRC.y, d);\n\n vec2 fracRC = sourceFracIndexRC - vec2(sourceFloorRC);\n\n float top = topLeft + (topRight - topLeft) * fracRC.y;\n float bottom = bottomLeft + (bottomRight - bottomLeft) * fracRC.y;\n float newValue = top + (bottom - top) * fracRC.x;\n\n setOutput(newValue);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class ResizeBilinearPackedProgram implements GPGPUProgram {\n variableNames = ['A'];\n packedInputs = true;\n packedOutput = true;\n outputShape: number[] = [];\n userCode: string;\n\n constructor(\n inputShape: [number, number, number, number], newHeight: number,\n newWidth: number, alignCorners: boolean, halfPixelCenters: boolean) {\n const [batch, oldHeight, oldWidth, depth] = inputShape;\n this.outputShape = [batch, newHeight, newWidth, depth];\n\n const effectiveInSize: [number, number] = [\n (alignCorners && newHeight > 1) ? oldHeight - 1 : oldHeight,\n (alignCorners && newWidth > 1) ? oldWidth - 1 : oldWidth\n ];\n\n const effectiveOutSize: [number, number] = [\n (alignCorners && newHeight > 1) ? newHeight - 1 : newHeight,\n (alignCorners && newWidth > 1) ? newWidth - 1 : newWidth\n ];\n\n let sourceFracIndexRC: string;\n if (halfPixelCenters) {\n sourceFracIndexRC = `(vec3(yRC) + vec3(0.5)) * ` +\n `effectiveInputOverOutputRatioRC - vec3(0.5)`;\n } else {\n sourceFracIndexRC = `vec3(yRC) * effectiveInputOverOutputRatioRC`;\n }\n\n this.userCode = `\n const vec3 effectiveInputOverOutputRatioRC = vec3(\n ${effectiveInSize[0] / effectiveOutSize[0]},\n ${effectiveInSize[1] / effectiveOutSize[1]},\n ${effectiveInSize[1] / effectiveOutSize[1]});\n const vec3 inputShapeRC = vec3(${oldHeight}.0, ${oldWidth}.0,\n ${oldWidth}.0);\n\n float getAValue(int b, int r, int c, int d) {\n return getChannel(getA(b, r, c, d), vec2(c, d));\n }\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n // Calculate values for next column in yRC.z.\n ivec3 yRC = coords.yzz + ivec3(0, 0, 1);\n\n // Fractional source index.\n vec3 sourceFracIndexRC = ${sourceFracIndexRC};\n\n // Compute the four integer indices.\n ivec3 sourceFloorRC = ivec3(max(sourceFracIndexRC, vec3(0.0)));\n ivec3 sourceCeilRC = ivec3(\n min(inputShapeRC - 1.0, ceil(sourceFracIndexRC)));\n\n // Should we calculate next column and row elements in 2x2 packed cell.\n bool hasNextCol = d < ${depth - 1};\n bool hasNextRow = coords.z < ${newWidth - 1};\n\n // In parallel, construct four corners for all four components in\n // packed 2x2 cell.\n vec4 topLeft = vec4(\n getAValue(b, sourceFloorRC.x, sourceFloorRC.y, d),\n hasNextCol ? getAValue(b, sourceFloorRC.x, sourceFloorRC.y, d + 1)\n : 0.0,\n hasNextRow ? getAValue(b, sourceFloorRC.x, sourceFloorRC.z, d)\n : 0.0,\n (hasNextRow && hasNextCol) ?\n getAValue(b, sourceFloorRC.x, sourceFloorRC.z, d + 1) : 0.0);\n\n vec4 bottomLeft = vec4(\n getAValue(b, sourceCeilRC.x, sourceFloorRC.y, d),\n hasNextCol ? getAValue(b, sourceCeilRC.x, sourceFloorRC.y, d + 1)\n : 0.0,\n hasNextRow ? getAValue(b, sourceCeilRC.x, sourceFloorRC.z, d)\n : 0.0,\n (hasNextRow && hasNextCol) ?\n getAValue(b, sourceCeilRC.x, sourceFloorRC.z, d + 1) : 0.0);\n\n vec4 topRight = vec4(\n getAValue(b, sourceFloorRC.x, sourceCeilRC.y, d),\n hasNextCol ? getAValue(b, sourceFloorRC.x, sourceCeilRC.y, d + 1)\n : 0.0,\n hasNextRow ? getAValue(b, sourceFloorRC.x, sourceCeilRC.z, d)\n : 0.0,\n (hasNextRow && hasNextCol) ?\n getAValue(b, sourceFloorRC.x, sourceCeilRC.z, d + 1) : 0.0);\n\n vec4 bottomRight = vec4(\n getAValue(b, sourceCeilRC.x, sourceCeilRC.y, d),\n hasNextCol ? getAValue(b, sourceCeilRC.x, sourceCeilRC.y, d + 1)\n : 0.0,\n hasNextRow ? getAValue(b, sourceCeilRC.x, sourceCeilRC.z, d)\n : 0.0,\n (hasNextRow && hasNextCol) ?\n getAValue(b, sourceCeilRC.x, sourceCeilRC.z, d + 1) : 0.0);\n\n vec3 fracRC = sourceFracIndexRC - vec3(sourceFloorRC);\n\n vec4 top = mix(topLeft, topRight, fracRC.yyzz);\n vec4 bottom = mix(bottomLeft, bottomRight, fracRC.yyzz);\n vec4 newValue = mix(top, bottom, fracRC.x);\n\n setOutput(newValue);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env, KernelConfig, KernelFunc, ResizeBilinear, ResizeBilinearAttrs, ResizeBilinearInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {ResizeBilinearProgram} from '../resize_bilinear_gpu';\nimport {ResizeBilinearPackedProgram} from '../resize_bilinear_packed_gpu';\n\nexport function resizeBilinear(args: {\n inputs: ResizeBilinearInputs,\n backend: MathBackendWebGL,\n attrs: ResizeBilinearAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {images} = inputs;\n const {alignCorners, halfPixelCenters, size} = attrs;\n\n const [newHeight, newWidth] = size;\n\n const program = env().getBool('WEBGL_PACK_IMAGE_OPERATIONS') ?\n new ResizeBilinearPackedProgram(\n images.shape as [number, number, number, number], newHeight, newWidth,\n alignCorners, halfPixelCenters) :\n new ResizeBilinearProgram(\n images.shape as [number, number, number, number], newHeight, newWidth,\n alignCorners, halfPixelCenters);\n return backend.runWebGLProgram(program, [images], 'float32');\n}\n\nexport const resizeBilinearConfig: KernelConfig = {\n kernelName: ResizeBilinear,\n backendName: 'webgl',\n kernelFunc: resizeBilinear as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class ResizeBilinearBackpropProgram implements GPGPUProgram {\n variableNames = ['dy'];\n outputShape: number[] = [];\n userCode: string;\n\n constructor(\n dyShape: [number, number, number, number],\n inputShape: [number, number, number, number], alignCorners: boolean) {\n this.outputShape = inputShape;\n const [, xHeight, xWidth, ] = inputShape;\n const [, yHeight, yWidth] = dyShape;\n\n // In the backwards pass, we want to find the pixels that were generated for\n // each pixel in the input image the forward pass and add the corresponding\n // coefficient from dy to the gradient (with some interpolation).\n\n const effectiveXSize: [number, number] = [\n (alignCorners && yHeight > 1) ? xHeight - 1 : xHeight,\n (alignCorners && yWidth > 1) ? xWidth - 1 : xWidth\n ];\n\n const effectiveYSize: [number, number] = [\n (alignCorners && yHeight > 1) ? yHeight - 1 : yHeight,\n (alignCorners && yWidth > 1) ? yWidth - 1 : yWidth\n ];\n\n const heightScale = effectiveXSize[0] / effectiveYSize[0];\n const widthScale = effectiveXSize[1] / effectiveYSize[1];\n\n const invHeightScale = 1 / heightScale;\n const invWidthScale = 1 / widthScale;\n\n // This defines the size of the window of values around a particular\n // index in dy that we want to search for contributions to dx.\n const winHeight = (Math.ceil(invHeightScale) * 2) + 2;\n const winWidth = (Math.ceil(invWidthScale) * 2) + 2;\n\n this.userCode = `\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n int r = coords[1];\n int c = coords[2];\n\n float accumulator = 0.0;\n\n const float heightScale = float(${heightScale});\n const float widthScale = float(${widthScale});\n\n const float invHeightScale = float(${invHeightScale});\n const float invWidthScale = float(${invWidthScale});\n\n const int winHeight = int(${winHeight});\n const int winWidth = int(${winWidth});\n\n // Compute bounds for where in dy we will look\n float startRLerp = floor(float(r) * invHeightScale);\n int startDyR = int(startRLerp - float(winHeight / 2));\n\n float startCLerp = floor(float(c) * invWidthScale);\n int startDyC = int(startCLerp - float(winWidth / 2));\n\n // Loop over dy\n for (int dyROffset = 0; dyROffset < winHeight; dyROffset++) {\n int dyR = dyROffset + startDyR;\n\n // Guard against the window exceeding the bounds of dy\n if (dyR < 0 || dyR >= ${yHeight}) {\n continue;\n }\n\n for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) {\n int dyC = dyCOffset + startDyC;\n\n // Guard against the window exceeding the bounds of dy\n if (dyC < 0 || dyC >= ${yWidth}) {\n continue;\n }\n\n float dxR = float(dyR) * heightScale;\n int topDxRIndex = int(floor(dxR));\n int bottomDxRIndex = int(min(ceil(dxR), ${xHeight - 1}.0));\n float dxRLerp = dxR - float(topDxRIndex);\n float inverseDxRLerp = 1.0 - dxRLerp;\n\n float dxC = float(dyC) * widthScale;\n int leftDxCIndex = int(floor(dxC));\n int rightDxCIndex = int(min(ceil(dxC), ${xWidth - 1}.0));\n float dxCLerp = dxC - float(leftDxCIndex);\n float inverseDxCLerp = 1.0 - dxCLerp;\n\n if (r == topDxRIndex && c == leftDxCIndex) {\n // topLeft\n accumulator +=\n getDy(b, dyR, dyC, d) * inverseDxRLerp * inverseDxCLerp;\n }\n\n if (r == topDxRIndex && c == rightDxCIndex) {\n // topRight\n accumulator += getDy(b, dyR, dyC, d) * inverseDxRLerp * dxCLerp;\n }\n\n if (r == bottomDxRIndex && c == leftDxCIndex) {\n // bottomLeft\n accumulator += getDy(b, dyR, dyC, d) * dxRLerp * inverseDxCLerp;\n }\n\n if (r == bottomDxRIndex && c == rightDxCIndex) {\n // bottomRight\n accumulator += getDy(b, dyR, dyC, d) * dxRLerp * dxCLerp;\n }\n }\n }\n // End loop over dy\n\n setOutput(accumulator);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, ResizeBilinearGrad, ResizeBilinearGradAttrs, ResizeBilinearGradInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {ResizeBilinearBackpropProgram} from '../resize_bilinear_backprop_gpu';\n\nexport function resizeBilinearGrad(args: {\n inputs: ResizeBilinearGradInputs,\n backend: MathBackendWebGL,\n attrs: ResizeBilinearGradAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {images, dy} = inputs;\n const {alignCorners} = attrs;\n\n const program = new ResizeBilinearBackpropProgram(\n dy.shape as [number, number, number, number],\n images.shape as [number, number, number, number], alignCorners);\n\n return backend.runWebGLProgram(program, [dy], dy.dtype);\n}\n\nexport const resizeBilinearGradConfig: KernelConfig = {\n kernelName: ResizeBilinearGrad,\n backendName: 'webgl',\n kernelFunc: resizeBilinearGrad as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class ResizeNearestNeighborProgram implements GPGPUProgram {\n variableNames = ['A'];\n outputShape: number[] = [];\n userCode: string;\n\n constructor(\n inputShape: [number, number, number, number], newHeight: number,\n newWidth: number, alignCorners: boolean, halfPixelCenters: boolean) {\n const [batch, oldHeight, oldWidth, depth] = inputShape;\n this.outputShape = [batch, newHeight, newWidth, depth];\n\n const effectiveInSize: [number, number] = [\n (alignCorners && newHeight > 1) ? oldHeight - 1 : oldHeight,\n (alignCorners && newWidth > 1) ? oldWidth - 1 : oldWidth\n ];\n\n const effectiveOutSize: [number, number] = [\n (alignCorners && newHeight > 1) ? newHeight - 1 : newHeight,\n (alignCorners && newWidth > 1) ? newWidth - 1 : newWidth\n ];\n\n // When align corners is false, we rounds the value with floor.\n const roundBase = alignCorners ? '0.5' : '0.0';\n\n let sourceFracIndexRC: string;\n if (halfPixelCenters) {\n sourceFracIndexRC =\n `max((vec2(yRC) + vec2(0.5)) * effectiveInputOverOutputRatioRC` +\n `, vec2(0.0))`;\n } else {\n sourceFracIndexRC = `vec2(yRC) * effectiveInputOverOutputRatioRC`;\n }\n this.userCode = `\n const vec2 effectiveInputOverOutputRatioRC = vec2(\n ${effectiveInSize[0] / effectiveOutSize[0]},\n ${effectiveInSize[1] / effectiveOutSize[1]});\n const vec2 inputShapeRC = vec2(${oldHeight}.0, ${oldWidth}.0);\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n ivec2 yRC = coords.yz;\n\n // Fractional source index.\n vec2 sourceFracIndexRC = ${sourceFracIndexRC};\n\n // Compute the coordinators of nearest neighbor point.\n ivec2 sourceNearestRC = ivec2(\n min(inputShapeRC - 1.0, floor(sourceFracIndexRC + ${roundBase})));\n float newValue = getA(b, sourceNearestRC.x, sourceNearestRC.y, d);\n\n setOutput(newValue);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class ResizeNearestNeighborPackedProgram implements GPGPUProgram {\n variableNames = ['A'];\n packedInputs = true;\n packedOutput = true;\n outputShape: number[] = [];\n userCode: string;\n\n constructor(\n inputShape: [number, number, number, number], newHeight: number,\n newWidth: number, alignCorners: boolean, halfPixelCenters: boolean) {\n const [batch, oldHeight, oldWidth, depth] = inputShape;\n this.outputShape = [batch, newHeight, newWidth, depth];\n\n const effectiveInSize: [number, number] = [\n (alignCorners && newHeight > 1) ? oldHeight - 1 : oldHeight,\n (alignCorners && newWidth > 1) ? oldWidth - 1 : oldWidth\n ];\n\n const effectiveOutSize: [number, number] = [\n (alignCorners && newHeight > 1) ? newHeight - 1 : newHeight,\n (alignCorners && newWidth > 1) ? newWidth - 1 : newWidth\n ];\n\n // When align corners is false, we rounds the value with floor.\n const roundBase = alignCorners ? '0.5' : '0.0';\n let sourceFracIndexRC: string;\n if (halfPixelCenters) {\n sourceFracIndexRC = `max((vec3(yRC) + vec3(0.5)) * ` +\n `effectiveInputOverOutputRatioRC, vec3(0.0))`;\n } else {\n sourceFracIndexRC = `vec3(yRC) * effectiveInputOverOutputRatioRC`;\n }\n\n this.userCode = `\n const vec3 effectiveInputOverOutputRatioRC = vec3(\n ${effectiveInSize[0] / effectiveOutSize[0]},\n ${effectiveInSize[1] / effectiveOutSize[1]},\n ${effectiveInSize[1] / effectiveOutSize[1]});\n const vec3 inputShapeRC = vec3(${oldHeight}.0, ${oldWidth}.0,\n ${oldWidth}.0);\n\n float getAValue(int b, int r, int c, int d) {\n return getChannel(getA(b, r, c, d), vec2(c, d));\n }\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n // Calculate values for next column in yRC.z.\n ivec3 yRC = coords.yzz + ivec3(0, 0, 1);\n\n // Fractional source index.\n vec3 sourceFracIndexRC = ${sourceFracIndexRC};\n\n // Compute the coordinators of nearest neighbor point.\n ivec3 sourceNearestRC = ivec3(\n min(inputShapeRC - 1.0, floor(sourceFracIndexRC + ${roundBase})));\n\n // Should we calculate next column and row elements in 2x2 packed cell.\n bool hasNextCol = d < ${depth - 1};\n bool hasNextRow = coords.z < ${newWidth - 1};\n\n vec4 newValue = vec4(\n getAValue(b, sourceNearestRC.x, sourceNearestRC.y, d),\n hasNextCol ? getAValue(b, sourceNearestRC.x, sourceNearestRC.y, d + 1)\n : 0.0,\n hasNextRow ? getAValue(b, sourceNearestRC.x, sourceNearestRC.z, d)\n : 0.0,\n (hasNextRow && hasNextCol) ?\n getAValue(b, sourceNearestRC.x, sourceNearestRC.z, d + 1) : 0.0);\n\n setOutput(newValue);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env, KernelConfig, KernelFunc, ResizeNearestNeighbor, ResizeNearestNeighborAttrs, ResizeNearestNeighborInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {ResizeNearestNeighborProgram} from '../resize_nearest_neighbor_gpu';\nimport {ResizeNearestNeighborPackedProgram} from '../resize_nearest_neighbor_packed_gpu';\n\nexport function resizeNearestNeighbor(args: {\n inputs: ResizeNearestNeighborInputs,\n backend: MathBackendWebGL,\n attrs: ResizeNearestNeighborAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {images} = inputs;\n const {alignCorners, halfPixelCenters, size} = attrs;\n\n const [newHeight, newWidth] = size;\n\n const program = env().getBool('WEBGL_PACK_IMAGE_OPERATIONS') ?\n new ResizeNearestNeighborPackedProgram(\n images.shape as [number, number, number, number], newHeight, newWidth,\n alignCorners, halfPixelCenters) :\n new ResizeNearestNeighborProgram(\n images.shape as [number, number, number, number], newHeight, newWidth,\n alignCorners, halfPixelCenters);\n return backend.runWebGLProgram(program, [images], images.dtype);\n}\n\nexport const resizeNearestNeighborConfig: KernelConfig = {\n kernelName: ResizeNearestNeighbor,\n backendName: 'webgl',\n kernelFunc: resizeNearestNeighbor as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class ResizeNearestNeigborBackpropProgram implements GPGPUProgram {\n variableNames = ['dy'];\n outputShape: number[] = [];\n userCode: string;\n\n constructor(\n dyShape: [number, number, number, number],\n inputShape: [number, number, number, number], alignCorners: boolean) {\n this.outputShape = inputShape;\n const [, xHeight, xWidth, ] = inputShape;\n const [, yHeight, yWidth] = dyShape;\n\n // In the backwards pass, we want to find the pixels that were generated for\n // each pixel in the input image the forward pass and add the corresponding\n // coefficient from dy to the gradient (with some interpolation).\n\n const effectiveXSize: [number, number] = [\n (alignCorners && yHeight > 1) ? xHeight - 1 : xHeight,\n (alignCorners && yWidth > 1) ? xWidth - 1 : xWidth\n ];\n\n const effectiveYSize: [number, number] = [\n (alignCorners && yHeight > 1) ? yHeight - 1 : yHeight,\n (alignCorners && yWidth > 1) ? yWidth - 1 : yWidth\n ];\n\n const heightScale = effectiveXSize[0] / effectiveYSize[0];\n const widthScale = effectiveXSize[1] / effectiveYSize[1];\n\n const invHeightScale = 1 / heightScale;\n const invWidthScale = 1 / widthScale;\n\n // This defines the size of the window of values around a particular\n // index in dy that we want to search for contributions to dx.\n const winHeight = (Math.ceil(invHeightScale) * 2) + 2;\n const winWidth = (Math.ceil(invWidthScale) * 2) + 2;\n\n this.userCode = `\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n int r = coords[1];\n int c = coords[2];\n\n float accumulator = 0.0;\n\n const float heightScale = float(${heightScale});\n const float widthScale = float(${widthScale});\n\n const float invHeightScale = float(${invHeightScale});\n const float invWidthScale = float(${invWidthScale});\n\n const int winHeight = int(${winHeight});\n const int winWidth = int(${winWidth});\n\n // Compute bounds for where in dy we will look\n float startRLerp = floor(float(r) * invHeightScale);\n int startDyR = int(floor(startRLerp - float(winHeight / 2)));\n\n float startCLerp = floor(float(c) * invWidthScale);\n int startDyC = int(floor(startCLerp - float(winWidth / 2)));\n\n // Loop over dy\n for (int dyROffset = 0; dyROffset < winHeight; dyROffset++) {\n int dyR = dyROffset + startDyR;\n\n // Guard against the window exceeding the bounds of dy\n if (dyR < 0 || dyR >= ${yHeight}) {\n continue;\n }\n\n for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) {\n int dyC = dyCOffset + startDyC;\n\n // Guard against the window exceeding the bounds of dy\n if (dyC < 0 || dyC >= ${yWidth}) {\n continue;\n }\n\n float sourceFracRow =\n float(${effectiveXSize[0]}) *\n (float(dyR) / float(${effectiveYSize[0]}));\n\n float sourceFracCol =\n float(${effectiveXSize[1]}) *\n (float(dyC) / float(${effectiveYSize[1]}));\n\n int sourceNearestRow = int(min(\n float(int(${xHeight}) - 1),\n ${alignCorners} ? float(round(sourceFracRow)) :\n float(floor(sourceFracRow))));\n\n int sourceNearestCol = int(min(\n float(int(${xWidth}) - 1),\n ${alignCorners} ? float(round(sourceFracCol)) :\n float(floor(sourceFracCol))));\n\n if (r == sourceNearestRow && c == sourceNearestCol) {\n accumulator += getDy(b, dyR, dyC, d);\n }\n }\n }\n // End loop over dy\n\n setOutput(accumulator);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, ResizeNearestNeighborGrad, ResizeNearestNeighborGradAttrs, ResizeNearestNeighborGradInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {ResizeNearestNeigborBackpropProgram} from '../resize_nearest_neighbor_backprop_gpu';\n\nexport function resizeNearestNeighborGrad(args: {\n inputs: ResizeNearestNeighborGradInputs,\n backend: MathBackendWebGL,\n attrs: ResizeNearestNeighborGradAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {images, dy} = inputs;\n const {alignCorners} = attrs;\n\n const program = new ResizeNearestNeigborBackpropProgram(\n dy.shape as [number, number, number, number],\n images.shape as [number, number, number, number], alignCorners);\n return backend.runWebGLProgram(program, [dy], dy.dtype);\n}\n\nexport const resizeNearestNeighborGradConfig: KernelConfig = {\n kernelName: ResizeNearestNeighborGrad,\n backendName: 'webgl',\n kernelFunc: resizeNearestNeighborGrad as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {getCoordsDataType} from './shader_compiler';\n\nexport class ReverseProgram implements GPGPUProgram {\n variableNames = ['x'];\n outputShape: number[];\n userCode: string;\n\n constructor(xShape: number[], axis: number[]) {\n const rank = xShape.length;\n if (rank > 4) {\n throw new Error(\n `WebGL backend: Reverse of rank-${rank} tensor is not yet supported`);\n }\n this.outputShape = xShape;\n\n if (rank === 1) {\n this.userCode = `\n void main() {\n int coord = getOutputCoords();\n setOutput(getX(${xShape[0]} - coord - 1));\n }\n `;\n return;\n }\n const getInCoord = (i: number) => {\n if (axis.indexOf(i) !== -1 && xShape[i] !== 1) {\n return `${xShape[i]} - coords[${i}] - 1`;\n }\n return `coords[${i}]`;\n };\n const inCoords = xShape.map((_, i) => getInCoord(i)).join(',');\n const type = getCoordsDataType(rank);\n\n this.userCode = `\n void main() {\n ${type} coords = getOutputCoords();\n setOutput(getX(${inCoords}));\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {getChannels} from './packing_util';\nimport {getCoordsDataType} from './shader_compiler';\n\nexport class ReversePackedProgram implements GPGPUProgram {\n variableNames = ['x'];\n outputShape: number[];\n userCode: string;\n packedInputs = true;\n packedOutput = true;\n\n constructor(xShape: number[], axis: number[]) {\n const rank = xShape.length;\n if (rank > 4) {\n throw new Error(\n `WebGL backend: Reverse of rank-${rank} tensor is not yet supported`);\n }\n this.outputShape = xShape;\n const channels = getChannels('rc', rank);\n const nextColumn =\n `${channels[rank - 1]} + 1 < ${this.outputShape[rank - 1]}`;\n const nextRow = `${channels[rank - 2]} + 1 < ${this.outputShape[rank - 2]}`;\n const type = getCoordsDataType(rank);\n if (rank === 1) {\n this.userCode = `\n void main(){\n int rc = getOutputCoords();\n vec4 result = vec4(0.);\n result.r = getChannel(getX(${xShape[0]} - rc - 1),\n ${xShape[0]} - rc - 1);\n if(${nextColumn}){\n result.g = getChannel(getX(${xShape[0]} - (rc + 1) - 1),\n ${xShape[0]} - (rc + 1) - 1);\n }\n setOutput(result);\n }\n `;\n } else {\n this.userCode = `\n void main() {\n ${type} rc = getOutputCoords();\n vec4 result = vec4(0.);\n result.r = ${getR(channels.slice())};\n if(${nextColumn}){\n result.g = ${getG(channels.slice())};\n }\n if(${nextRow}) {\n result.b = ${getB(channels.slice())};\n if(${nextColumn}) {\n result.a = ${getA(channels.slice())};\n }\n }\n setOutput(result);\n }\n `;\n }\n\n function getR(channels: string[]): string {\n return getChannel(channels);\n }\n\n function getG(channels: string[]): string {\n channels[rank - 1] = '(' + channels[rank - 1] + ` + 1)`;\n return getChannel(channels);\n }\n\n function getB(channels: string[]): string {\n channels[rank - 2] = '(' + channels[rank - 2] + ` + 1)`;\n return getChannel(channels);\n }\n\n function getA(channels: string[]): string {\n channels[rank - 1] = '(' + channels[rank - 1] + ` + 1)`;\n channels[rank - 2] = '(' + channels[rank - 2] + ` + 1)`;\n return getChannel(channels);\n }\n\n function getChannel(channels: string[]): string {\n const inCoordsArray = xShape.map((_, i) => getInCoord(i, channels));\n const inCoords = inCoordsArray.join(',');\n const innerDims = inCoordsArray.slice(-2).join(',');\n return `getChannel(getX(${inCoords}), vec2(${innerDims}))`;\n }\n\n function getInCoord(i: number, channels1: string[]): string {\n if (axis.indexOf(i) !== -1 && xShape[i] !== 1) {\n return `${xShape[i]} - ${channels1[i]} - 1`;\n } else {\n return `${channels1[i]}`;\n }\n }\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env, KernelConfig, KernelFunc, Reverse, ReverseAttrs, ReverseInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {ReverseProgram} from '../reverse_gpu';\nimport {ReversePackedProgram} from '../reverse_packed_gpu';\n\nimport {identity} from './Identity';\n\nexport function reverse(args: {\n inputs: ReverseInputs,\n backend: MathBackendWebGL,\n attrs: ReverseAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {dims} = attrs;\n\n const xRank = x.shape.length;\n\n const $dims = util.parseAxisParam(dims, x.shape);\n if (xRank === 0) {\n return identity({inputs: {x}, backend});\n }\n\n const program = env().getBool('WEBGL_PACK_ARRAY_OPERATIONS') ?\n new ReversePackedProgram(x.shape, $dims) :\n new ReverseProgram(x.shape, $dims);\n\n return backend.runWebGLProgram(program, [x], x.dtype);\n}\n\nexport const reverseConfig: KernelConfig = {\n kernelName: Reverse,\n backendName: 'webgl',\n kernelFunc: reverse as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {UniformType} from './shader_compiler';\n\nexport class RotateProgram implements GPGPUProgram {\n variableNames = ['Image'];\n outputShape: number[] = [];\n userCode: string;\n customUniforms = [{name: 'params', type: 'vec4' as UniformType}];\n constructor(\n imageShape: [number, number, number, number],\n fillValue: number|[number, number, number]) {\n const imageHeight = imageShape[1];\n const imageWidth = imageShape[2];\n this.outputShape = imageShape;\n\n let fillSnippet = '';\n if (typeof fillValue === 'number') {\n fillSnippet = `float outputValue = ${fillValue.toFixed(2)};`;\n } else {\n fillSnippet = `\n vec3 fill = vec3(${fillValue.join(',')});\n float outputValue = fill[coords[3]];`;\n }\n\n this.userCode = `\n void main() {\n ivec4 coords = getOutputCoords();\n int x = coords[2];\n int y = coords[1];\n float coordXFloat = (float(x) - params[0]) * params[3] -\n (float(y) - params[1]) * params[2];\n float coordYFloat = (float(x) - params[0]) * params[2] +\n (float(y) - params[1]) * params[3];\n int coordX = int(round(coordXFloat + params[0]));\n int coordY = int(round(coordYFloat + params[1]));\n ${fillSnippet}\n if(coordX >= 0 && coordX < ${imageWidth} && coordY >= 0 && coordY < ${\n imageHeight}) {\n outputValue = getImage(coords[0], coordY, coordX, coords[3]);\n }\n setOutput(outputValue);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, Tensor4D} from '@tensorflow/tfjs-core';\nimport {RotateWithOffset, RotateWithOffsetAttrs, RotateWithOffsetInputs} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {RotateProgram} from '../rotate_gpu';\n\nexport const rotateWithOffsetConfig: KernelConfig = {\n kernelName: RotateWithOffset,\n backendName: 'webgl',\n kernelFunc: ({inputs, attrs, backend}) => {\n const {image} = inputs as RotateWithOffsetInputs;\n const {radians, fillValue, center} = attrs as {} as RotateWithOffsetAttrs;\n const webglBackend = backend as MathBackendWebGL;\n\n const program = new RotateProgram((image as Tensor4D).shape, fillValue);\n const [centerX, centerY] =\n backend_util.getImageCenter(center, image.shape[1], image.shape[2]);\n const customValues =\n [[centerX, centerY, Math.sin(radians), Math.cos(radians)]];\n const output = webglBackend.runWebGLProgram(\n program, [image], image.dtype, customValues);\n return output;\n }\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Round} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst ROUND = `\n // OpenGL ES does not support round function.\n // The algorithm is based on banker's rounding.\n float base = floor(x);\n if ((x - base) < 0.5) {\n return floor(x);\n } else if ((x - base) > 0.5) {\n return ceil(x);\n } else {\n if (mod(base, 2.0) == 0.0) {\n return base;\n } else {\n return base + 1.0;\n }\n }\n`;\n\nexport const round = unaryKernelFunc({opSnippet: ROUND});\n\nexport const roundConfig: KernelConfig = {\n kernelName: Round,\n backendName: 'webgl',\n kernelFunc: round,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Rsqrt} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {rsqrtImplCPU} from '../kernel_utils/shared';\n\nconst RSQRT = `return inversesqrt(x);`;\n\nexport const rsqrt =\n unaryKernelFunc({opSnippet: RSQRT, cpuKernelImpl: rsqrtImplCPU});\n\nexport const rsqrtConfig: KernelConfig = {\n kernelName: Rsqrt,\n backendName: 'webgl',\n kernelFunc: rsqrt as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {getCoordsDataType} from './shader_compiler';\n\nexport class ScatterProgram implements GPGPUProgram {\n variableNames = ['updates', 'indices', 'defaultValue'];\n outputShape: number[];\n userCode: string;\n\n constructor(\n updateSize: number, sliceDim: number, indicesRank: number,\n updatesRank: number, strides: number[], shape: number[],\n summingDupeIndex = true) {\n this.outputShape = shape;\n const stridesType = getCoordsDataType(strides.length);\n const dtype = getCoordsDataType(shape.length);\n let indicesString = '';\n if (indicesRank === 1) {\n indicesString = 'i';\n } else if (indicesRank === 2) {\n indicesString = 'i, j';\n }\n const indicesSnippet = `getIndices(${indicesString})`;\n\n let updatesString = '';\n if (updatesRank === 1) {\n updatesString = 'i';\n } else if (updatesRank === 2) {\n updatesString = 'i, coords[1]';\n }\n const updatesSnippet = `getUpdates(${updatesString})`;\n\n const strideString = sliceDim > 1 ? 'strides[j]' : 'strides';\n this.userCode = `\n ${stridesType} strides = ${stridesType}(${strides});\n\n void main() {\n ${dtype} coords = getOutputCoords();\n float sum = 0.0;\n bool found = false;\n for (int i = 0; i < ${updateSize}; i++) {\n int flattenedIndex = 0;\n for (int j = 0; j < ${sliceDim}; j++) {\n int index = round(${indicesSnippet});\n flattenedIndex += index * ${strideString};\n }\n if (flattenedIndex == coords[0]) {\n sum += ${updatesSnippet};\n found = true;\n }\n }\n setOutput(mix(getDefaultValue(), sum, float(found)));\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, ScatterNd, ScatterNdAttrs, ScatterNdInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {ScatterProgram} from '../scatter_gpu';\nimport {reshape} from './Reshape';\n\nexport function scatterNd(args: {\n inputs: ScatterNdInputs,\n backend: MathBackendWebGL,\n attrs: ScatterNdAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {indices, updates} = inputs;\n const {shape} = attrs;\n\n const {sliceRank, numUpdates, sliceSize, strides, outputSize} =\n backend_util.calculateShapes(updates, indices, shape);\n\n const flattenShape = [outputSize / sliceSize, sliceSize];\n\n if (outputSize === 0) {\n return backend.makeTensorInfo(shape, indices.dtype);\n }\n\n const flattenIndices = reshape(\n {inputs: {x: indices}, backend, attrs: {shape: [numUpdates, sliceRank]}});\n const flattenX = reshape(\n {inputs: {x: updates}, backend, attrs: {shape: [numUpdates, sliceSize]}});\n\n const defaultValue = backend.makeTensorInfo(\n [], 'float32', new Float32Array([0])); // scalar(0)\n const program = new ScatterProgram(\n numUpdates, sliceRank, flattenIndices.shape.length, flattenX.shape.length,\n strides, flattenShape);\n const res = backend.runWebGLProgram(\n program, [flattenX, flattenIndices, defaultValue], flattenX.dtype);\n\n const reshaped = reshape({inputs: {x: res}, backend, attrs: {shape}});\n\n backend.disposeIntermediateTensorInfo(flattenIndices);\n backend.disposeIntermediateTensorInfo(flattenX);\n backend.disposeIntermediateTensorInfo(res);\n backend.disposeIntermediateTensorInfo(defaultValue);\n\n return reshaped;\n}\n\nexport const scatterNdConfig: KernelConfig = {\n kernelName: ScatterNd,\n backendName: 'webgl',\n kernelFunc: scatterNd as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env} from '@tensorflow/tfjs-core';\nimport {GPGPUProgram} from './gpgpu_math';\nimport {UniformType} from './shader_compiler';\n\nexport class SearchSortedProgram implements GPGPUProgram {\n variableNames = ['sortedSequence', 'values'];\n outputShape: number[];\n userCode: string;\n customUniforms = [{name: 'numInputs', type: 'int' as UniformType}];\n\n constructor(\n batchSize: number, numInputs: number, numValues: number,\n side: 'left'|'right') {\n this.outputShape = [batchSize, numValues];\n\n const webGL2LoopHead = 'while (left < right) {';\n // WebGL1 doesn't accept non constant loop conditions, so upper bound loop\n // iterations.\n const webGL1LoopHead = `for (int i = 0; i < ${\n Math.ceil(Math.log2(numInputs + 1))}; ++i) { if (left >= right) break;`;\n const loopHead = env().getNumber('WEBGL_VERSION') === 2 ? webGL2LoopHead :\n webGL1LoopHead;\n\n // left corresponds to lower bound and right to upper bound.\n const boundComparator = side === 'left' ? '<' : '<=';\n this.userCode = `\n int findBound(int batch, float value) {\n int left = 0;\n int right = numInputs;\n int mid;\n ${loopHead}\n mid = (left + right) / 2;\n if (getSortedSequence(batch, mid) ${boundComparator} value) {\n left = mid + 1;\n } else {\n right = mid;\n }\n }\n return right;\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int valueIndex = coords[1];\n\n float value = getValues(batch, valueIndex);\n\n setOutput(float(findBound(batch, value)));\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, SearchSorted, SearchSortedAttrs, SearchSortedInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {SearchSortedProgram} from '../search_sorted_gpu';\n\nexport function searchSorted(args: {\n inputs: SearchSortedInputs,\n backend: MathBackendWebGL,\n attrs: SearchSortedAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {sortedSequence, values} = inputs;\n const {side} = attrs;\n\n const program = new SearchSortedProgram(\n sortedSequence.shape[0], sortedSequence.shape[1], values.shape[1], side);\n const customValues = [[sortedSequence.shape[1]]];\n return backend.runWebGLProgram(\n program, [sortedSequence, values], 'int32', customValues);\n}\n\nexport const searchSortedConfig: KernelConfig = {\n kernelName: SearchSorted,\n backendName: 'webgl',\n kernelFunc: searchSorted as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {getCoordsDataType} from './shader_compiler';\n\nexport class SelectProgram implements GPGPUProgram {\n variableNames = ['c', 'a', 'b'];\n outputShape: number[];\n userCode: string;\n\n constructor(cRank: number, shape: number[], rank: number) {\n this.outputShape = shape;\n\n let cCoords;\n let abCoords;\n if (rank > 4) {\n throw Error(`Where for rank ${rank} is not yet supported`);\n }\n\n if (rank === 1) {\n abCoords = `resRC`;\n cCoords = `resRC`;\n } else {\n const currentCoords = ['resRC.x', 'resRC.y', 'resRC.z', 'resRC.w'];\n const cCoordVars = [];\n const abCoordVars = [];\n for (let i = 0; i < shape.length; i++) {\n abCoordVars.push(`${currentCoords[i]}`);\n if (i < cRank) {\n cCoordVars.push(`${currentCoords[i]}`);\n }\n }\n cCoords = cCoordVars.join();\n abCoords = abCoordVars.join();\n }\n\n const dtype = getCoordsDataType(rank);\n\n this.userCode = `\n void main() {\n ${dtype} resRC = getOutputCoords();\n float cVal = getC(${cCoords});\n if (cVal >= 1.0) {\n setOutput(getA(${abCoords}));\n } else {\n setOutput(getB(${abCoords}));\n }\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Select, SelectInputs, TensorInfo, upcastType} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {SelectProgram} from '../select_gpu';\n\nexport function select(args: {inputs: SelectInputs, backend: MathBackendWebGL}):\n TensorInfo {\n const {inputs, backend} = args;\n const {condition, t, e} = inputs;\n\n const program =\n new SelectProgram(condition.shape.length, t.shape, t.shape.length);\n return backend.runWebGLProgram(\n program, [condition, t, e], upcastType(t.dtype, e.dtype));\n}\n\nexport const selectConfig: KernelConfig = {\n kernelName: Select,\n backendName: 'webgl',\n kernelFunc: select as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, Selu} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst SELU = `\n // Stable and Attracting Fixed Point (0, 1) for Normalized Weights.\n // see: https://arxiv.org/abs/1706.02515\n float scaleAlpha = ${backend_util.SELU_SCALEALPHA};\n float scale = ${backend_util.SELU_SCALE};\n return (x >= 0.0) ? scale * x : scaleAlpha * (exp(x) - 1.0);\n`;\n\nexport const selu = unaryKernelFunc({opSnippet: SELU});\n\nexport const seluConfig: KernelConfig = {\n kernelName: Selu,\n backendName: 'webgl',\n kernelFunc: selu,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Sigmoid} from '@tensorflow/tfjs-core';\n\nimport {CHECK_NAN_SNIPPET_UNARY, unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {sigmoidImplCPU} from '../kernel_utils/shared';\n\nconst SIGMOID = CHECK_NAN_SNIPPET_UNARY + `\n return 1.0 / (1.0 + exp(-1.0 * x));\n`;\n\nconst SIGMOID_PACKED = `\n vec4 result = 1.0 / (1.0 + exp(-1.0 * x));\n bvec4 isNaN = isnan(x);\n\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n`;\nexport const sigmoid = unaryKernelFunc({\n opSnippet: SIGMOID,\n packedOpSnippet: SIGMOID_PACKED,\n cpuKernelImpl: sigmoidImplCPU\n});\n\nexport const sigmoidConfig: KernelConfig = {\n kernelName: Sigmoid,\n backendName: 'webgl',\n kernelFunc: sigmoid,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Sign} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\n// Sign does not propagate NANs.\nconst SIGN = `\n if (isnan(x)) { return 0.0; }\n return sign(x);\n`;\n\nexport const sign = unaryKernelFunc({opSnippet: SIGN});\n\nexport const signConfig: KernelConfig = {\n kernelName: Sign,\n backendName: 'webgl',\n kernelFunc: sign,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Sin} from '@tensorflow/tfjs-core';\n\nimport {CHECK_NAN_SNIPPET_UNARY, unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst SIN = CHECK_NAN_SNIPPET_UNARY + `\n return sin(x);\n`;\n\nexport const sin = unaryKernelFunc({opSnippet: SIN});\n\nexport const sinConfig: KernelConfig = {\n kernelName: Sin,\n backendName: 'webgl',\n kernelFunc: sin,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Sinh} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst SINH = `\n float e2x = exp(x);\n return (e2x - 1.0 / e2x) / 2.0;\n`;\n\nexport const sinh = unaryKernelFunc({opSnippet: SINH});\n\nexport const sinhConfig: KernelConfig = {\n kernelName: Sinh,\n backendName: 'webgl',\n kernelFunc: sinh,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Softplus} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst SOFTPLUS = `\n float epsilon = 1.1920928955078125e-7;\n float threshold = log(epsilon) + 2.0;\n\n bool too_large = x > -threshold;\n bool too_small = x < threshold;\n\n float result;\n float exp_x = exp(x);\n\n if (too_large){\n result = x;\n }\n else if (too_small){\n result = exp_x;\n }\n else{\n result = log(exp_x + 1.0);\n }\n return result;\n`;\n\nexport const softplus = unaryKernelFunc({opSnippet: SOFTPLUS});\n\nexport const softplusConfig: KernelConfig = {\n kernelName: Softplus,\n backendName: 'webgl',\n kernelFunc: softplus,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, SpaceToBatchND, SpaceToBatchNDAttrs, SpaceToBatchNDInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\n\nimport {padV2} from './PadV2';\nimport {reshape} from './Reshape';\nimport {transpose} from './Transpose';\n\nexport const spaceToBatchND = (args: {\n inputs: SpaceToBatchNDInputs,\n backend: MathBackendWebGL,\n attrs: SpaceToBatchNDAttrs\n}): TensorInfo => {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {blockShape, paddings} = attrs;\n\n util.assert(\n x.shape.length <= 4,\n () => 'spaceToBatchND for rank > 4 with a WebGL backend not ' +\n 'implemented yet');\n\n const prod = blockShape.reduce((a, b) => a * b);\n\n const completePaddings: Array<[number, number]> = [[0, 0]];\n completePaddings.push(...paddings as Array<[number, number]>);\n for (let i = 1 + blockShape.length; i < x.shape.length; ++i) {\n completePaddings.push([0, 0]);\n }\n\n const toDispose = [];\n\n const paddedX = padV2({\n inputs: {x},\n backend,\n attrs: {paddings: completePaddings, constantValue: 0}\n });\n\n const reshapedPaddedShape =\n backend_util.getReshaped(paddedX.shape, blockShape, prod, false);\n\n const permutedReshapedPaddedPermutation = backend_util.getPermuted(\n reshapedPaddedShape.length, blockShape.length, false);\n\n const flattenShape =\n backend_util.getReshapedPermuted(paddedX.shape, blockShape, prod, false);\n\n const reshapedPaddedX = reshape(\n {inputs: {x: paddedX}, backend, attrs: {shape: reshapedPaddedShape}});\n\n const paddedXT = transpose({\n inputs: {x: reshapedPaddedX},\n backend,\n attrs: {perm: permutedReshapedPaddedPermutation}\n });\n\n const result =\n reshape({inputs: {x: paddedXT}, backend, attrs: {shape: flattenShape}});\n\n toDispose.push(paddedX);\n toDispose.push(reshapedPaddedX);\n toDispose.push(paddedXT);\n\n toDispose.forEach(t => backend.disposeIntermediateTensorInfo(t));\n\n return result;\n};\n\nexport const spaceToBatchNDConfig: KernelConfig = {\n kernelName: SpaceToBatchND,\n backendName: 'webgl',\n kernelFunc: spaceToBatchND as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, SparseFillEmptyRows, SparseFillEmptyRowsInputs, TensorInfo, TypedArray} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {sparseFillEmptyRowsImplCPU} from '../kernel_utils/shared';\n\nexport function sparseFillEmptyRows(args: {\n inputs: SparseFillEmptyRowsInputs,\n backend: MathBackendWebGL\n}): [TensorInfo, TensorInfo, TensorInfo, TensorInfo] {\n const {inputs, backend} = args;\n const {indices, values, denseShape, defaultValue} = inputs;\n if (denseShape.shape.length !== 1) {\n throw new Error(`Dense shape must be a vector, saw:\n ${denseShape.shape}`);\n }\n if (indices.shape.length !== 2) {\n throw new Error(`Indices must be a matrix, saw:\n ${indices.shape}`);\n }\n if (values.shape.length !== 1) {\n throw new Error(`Values must be a vector, saw:\n ${values.shape}`);\n }\n if (defaultValue.shape.length !== 0) {\n throw new Error(`Default value must be a scalar, saw:\n ${defaultValue.shape}`);\n }\n\n const $indices = backend.readSync(indices.dataId) as TypedArray;\n const $values = backend.readSync(values.dataId) as TypedArray;\n const $denseShape = backend.readSync(denseShape.dataId) as TypedArray;\n const $defaultValue =\n backend.readSync(defaultValue.dataId)[0] as number;\n\n const [outputIndices, outputIndicesShape, outputValues,\n emptyRowIndicator, reverseIndexMap] =\n sparseFillEmptyRowsImplCPU(\n $indices, indices.shape, indices.dtype, $values, values.dtype,\n $denseShape, $defaultValue);\n return [\n backend.makeTensorInfo(outputIndicesShape, indices.dtype, outputIndices),\n backend.makeTensorInfo(\n [outputIndicesShape[0]], values.dtype, outputValues),\n backend.makeTensorInfo(\n [emptyRowIndicator.length], 'bool',\n new Uint8Array(\n emptyRowIndicator.map((value: boolean) => Number(value)))),\n backend.makeTensorInfo(\n [reverseIndexMap.length], indices.dtype,\n new Int32Array(reverseIndexMap)),\n ];\n}\n\nexport const sparseFillEmptyRowsConfig: KernelConfig = {\n kernelName: SparseFillEmptyRows,\n backendName: 'webgl',\n kernelFunc: sparseFillEmptyRows as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, SparseReshape, SparseReshapeInputs, TensorInfo, TypedArray} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {sparseReshapeImplCPU} from '../kernel_utils/shared';\n\nexport function sparseReshape(\n args: {inputs: SparseReshapeInputs, backend: MathBackendWebGL}):\n [TensorInfo, TensorInfo] {\n const {inputs, backend} = args;\n const {inputIndices, inputShape, newShape} = inputs;\n if (inputIndices.shape.length !== 2) {\n throw new Error(`Input indices should be a matrix but received shape ${\n inputIndices.shape}`);\n }\n if (inputShape.shape.length !== 1) {\n throw new Error(`Input shape should be a vector but received shape ${\n inputShape.shape}`);\n }\n\n if (newShape.shape.length !== 1) {\n throw new Error(\n `Target shape should be a vector but received shape ${newShape.shape}`);\n }\n\n const $inputShape =\n Array.from(backend.readSync(inputShape.dataId) as TypedArray);\n const $inputIndices = backend.readSync(inputIndices.dataId) as TypedArray;\n const targetShape =\n Array.from(backend.readSync(newShape.dataId) as TypedArray);\n\n const [newIndices, indicesShape, outputShape] = sparseReshapeImplCPU(\n $inputIndices, inputIndices.shape, inputIndices.dtype, $inputShape,\n targetShape);\n return [\n backend.makeTensorInfo(indicesShape, inputIndices.dtype, newIndices),\n backend.makeTensorInfo(\n [outputShape.length], newShape.dtype, new Int32Array(outputShape)),\n ];\n}\n\nexport const sparseReshapeConfig: KernelConfig = {\n kernelName: SparseReshape,\n backendName: 'webgl',\n kernelFunc: sparseReshape,\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, SparseSegmentMean, SparseSegmentMeanInputs, TensorInfo, TypedArray} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {sparseSegmentReductionImplCPU} from '../kernel_utils/shared';\n\nexport function sparseSegmentMean(\n args: {inputs: SparseSegmentMeanInputs, backend: MathBackendWebGL}):\n TensorInfo {\n const {inputs, backend} = args;\n const {data, indices, segmentIds} = inputs;\n if (data.shape.length < 1) {\n throw new Error(\n `Data should be at least 1 dimensional but received scalar`);\n }\n if (indices.shape.length !== 1) {\n throw new Error(`Indices should be a vector but received shape\n ${indices.shape}`);\n }\n if (segmentIds.shape.length !== 1) {\n throw new Error(`Segment ids should be a vector but received shape\n ${segmentIds.shape}`);\n }\n\n const $data = backend.readSync(data.dataId) as TypedArray;\n const $indices = backend.readSync(indices.dataId) as TypedArray;\n const $segmentIds = backend.readSync(segmentIds.dataId) as TypedArray;\n\n const [outputData, outputDataShape] = sparseSegmentReductionImplCPU(\n $data, data.shape, data.dtype, $indices, $segmentIds, true);\n return backend.makeTensorInfo(outputDataShape, data.dtype, outputData);\n}\n\nexport const sparseSegmentMeanConfig: KernelConfig = {\n kernelName: SparseSegmentMean,\n backendName: 'webgl',\n kernelFunc: sparseSegmentMean as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, SparseSegmentSum, SparseSegmentSumInputs, TensorInfo, TypedArray} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {sparseSegmentReductionImplCPU} from '../kernel_utils/shared';\n\nexport function sparseSegmentSum(\n args: {inputs: SparseSegmentSumInputs, backend: MathBackendWebGL}):\n TensorInfo {\n const {inputs, backend} = args;\n const {data, indices, segmentIds} = inputs;\n if (data.shape.length < 1) {\n throw new Error(\n `Data should be at least 1 dimensional but received scalar`);\n }\n if (indices.shape.length !== 1) {\n throw new Error(`Indices should be a vector but received shape\n ${indices.shape}`);\n }\n if (segmentIds.shape.length !== 1) {\n throw new Error(`Segment ids should be a vector but received shape\n ${segmentIds.shape}`);\n }\n\n const $data = backend.readSync(data.dataId) as TypedArray;\n const $indices = backend.readSync(indices.dataId) as TypedArray;\n const $segmentIds = backend.readSync(segmentIds.dataId) as TypedArray;\n\n const [outputData, outputDataShape] = sparseSegmentReductionImplCPU(\n $data, data.shape, data.dtype, $indices, $segmentIds);\n return backend.makeTensorInfo(outputDataShape, data.dtype, outputData);\n}\n\nexport const sparseSegmentSumConfig: KernelConfig = {\n kernelName: SparseSegmentSum,\n backendName: 'webgl',\n kernelFunc: sparseSegmentSum as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, Rank, SparseToDense, SparseToDenseAttrs, SparseToDenseInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {scatterImplCPU} from '../kernel_utils/shared';\nimport {ScatterProgram} from '../scatter_gpu';\n\nimport {reshape} from './Reshape';\n\nexport function sparseToDense(args: {\n inputs: SparseToDenseInputs,\n backend: MathBackendWebGL,\n attrs: SparseToDenseAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {sparseIndices, sparseValues, defaultValue} = inputs;\n const {outputShape} = attrs;\n\n const {sliceRank, numUpdates, sliceSize, strides, outputSize} =\n backend_util.calculateShapes(sparseValues, sparseIndices, outputShape);\n const sumDupeIndices = false;\n\n if (sparseValues.dtype === 'string') {\n const indicesBuf = backend.bufferSync(sparseIndices);\n const updatesBuf = backend.bufferSync(sparseValues);\n const $defaultValue = util.decodeString(\n backend.readSync(defaultValue.dataId)[0] as Uint8Array);\n const outBuf = scatterImplCPU(\n indicesBuf, updatesBuf, outputShape, outputSize, sliceSize, numUpdates,\n sliceRank, strides, $defaultValue, sumDupeIndices);\n return backend.makeTensorInfo(outputShape, outBuf.dtype, outBuf.values);\n }\n const program = new ScatterProgram(\n numUpdates, sliceRank, sparseIndices.shape.length,\n sparseValues.shape.length, strides, [outputSize, 1], sumDupeIndices);\n\n const res = backend.runWebGLProgram(\n program, [sparseValues, sparseIndices, defaultValue], sparseValues.dtype);\n\n const reshaped =\n reshape({inputs: {x: res}, backend, attrs: {shape: outputShape}});\n\n backend.disposeIntermediateTensorInfo(res);\n return reshaped;\n}\n\nexport const sparseToDenseConfig: KernelConfig = {\n kernelName: SparseToDense,\n backendName: 'webgl',\n kernelFunc: sparseToDense as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, SplitV, SplitVAttrs, SplitVInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {slice} from './Slice';\n\nexport function splitV(\n args:\n {inputs: SplitVInputs, backend: MathBackendWebGL, attrs: SplitVAttrs}):\n TensorInfo[] {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {numOrSizeSplits, axis} = attrs;\n\n const $axis = util.parseAxisParam(axis, x.shape)[0];\n const splitSizes = backend_util.prepareSplitSize(x, numOrSizeSplits, $axis);\n\n const xRank = x.shape.length;\n const begin = new Array(xRank).fill(0);\n const size = x.shape.slice();\n\n return splitSizes.map(s => {\n const sliceSize = [...size];\n sliceSize[$axis] = s;\n const sliceT =\n slice({inputs: {x}, backend, attrs: {begin, size: sliceSize}});\n begin[$axis] += s;\n return sliceT;\n });\n}\n\nexport const splitVConfig: KernelConfig = {\n kernelName: SplitV,\n backendName: 'webgl',\n kernelFunc: splitV as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Sqrt} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {sqrtImplCPU} from '../kernel_utils/shared';\n\nconst SQRT = `return sqrt(x);`;\n\nexport const sqrt = unaryKernelFunc(\n {opSnippet: SQRT, packedOpSnippet: SQRT, cpuKernelImpl: sqrtImplCPU});\n\nexport const sqrtConfig: KernelConfig = {\n kernelName: Sqrt,\n backendName: 'webgl',\n kernelFunc: sqrt as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Square} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst SQUARE = `return x * x;`;\n\nexport const square = unaryKernelFunc({opSnippet: SQUARE});\n\nexport const squareConfig: KernelConfig = {\n kernelName: Square,\n backendName: 'webgl',\n kernelFunc: square,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, SquaredDifference} from '@tensorflow/tfjs-core';\n\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst SQUARED_DIFFERENCE = 'return (a - b) * (a - b);';\n\nexport const squaredDifference = binaryKernelFunc(\n {opSnippet: SQUARED_DIFFERENCE, packedOpSnippet: SQUARED_DIFFERENCE});\n\nexport const squaredDifferenceConfig: KernelConfig = {\n kernelName: SquaredDifference,\n backendName: 'webgl',\n kernelFunc: squaredDifference,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Step, StepAttrs, TensorInfo, UnaryInputs} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {CHECK_NAN_SNIPPET, UnaryOpProgram} from '../unaryop_gpu';\n\nexport function step(\n {inputs, attrs, backend}:\n {inputs: UnaryInputs, attrs: StepAttrs, backend: MathBackendWebGL}):\n TensorInfo {\n const {x} = inputs;\n const opSnippet = CHECK_NAN_SNIPPET + `\n return x > 0.0 ? 1.0 : float(${attrs.alpha});\n `;\n\n const program = new UnaryOpProgram(x.shape, opSnippet);\n\n return backend.runWebGLProgram(program, [x], x.dtype);\n}\n\nexport const stepConfig: KernelConfig = {\n kernelName: Step,\n backendName: 'webgl',\n kernelFunc: step as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {getCoordsDataType} from './shader_compiler';\n\nexport class StridedSliceProgram implements GPGPUProgram {\n variableNames = ['x'];\n outputShape: number[];\n userCode: string;\n\n constructor(begin: number[], strides: number[], size: number[]) {\n this.outputShape = size;\n const rank = size.length;\n const inputDtype = getCoordsDataType(size.length);\n const dtype = getCoordsDataType(size.length);\n\n let newCoords = '';\n if (rank === 1) {\n newCoords = 'coords * strides + begin';\n } else {\n let outputAxis = 0;\n newCoords =\n size.map((_, i) => {\n outputAxis++;\n return size.length === 1 ?\n `coords * strides[${i}] + begin[${i}]` :\n `coords[${outputAxis - 1}] * strides[${i}] + begin[${i}]`;\n })\n .join(',');\n }\n\n this.userCode = `\n ${inputDtype} begin = ${inputDtype}(${begin});\n ${inputDtype} strides = ${inputDtype}(${strides});\n\n void main() {\n ${dtype} coords = getOutputCoords();\n setOutput(getX(${newCoords}));\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {buffer, KernelConfig, KernelFunc, Rank, slice_util, StridedSlice, StridedSliceAttrs, StridedSliceInputs, TensorBuffer, TensorInfo, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {stridedSliceImplCPU} from '../kernel_utils/shared';\nimport {StridedSliceProgram} from '../strided_slice_gpu';\n\nimport {reshape} from './Reshape';\nimport {slice} from './Slice';\n\nexport function stridedSlice(args: {\n inputs: StridedSliceInputs,\n backend: MathBackendWebGL,\n attrs: StridedSliceAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {\n begin,\n end,\n strides,\n beginMask,\n endMask,\n ellipsisMask,\n newAxisMask,\n shrinkAxisMask\n } = attrs;\n\n const {\n finalShapeSparse,\n finalShape,\n isIdentity,\n sliceDim0,\n isSimpleSlice,\n begin: $begin,\n end: $end,\n strides: $strides\n } =\n slice_util.sliceInfo(\n x.shape, begin, end, strides, beginMask, endMask, ellipsisMask,\n newAxisMask, shrinkAxisMask);\n\n let result;\n\n if (isIdentity) {\n // Optimization #1, slice is a no-op plus reshape\n result = reshape({inputs: {x}, backend, attrs: {shape: finalShape}});\n } else if (sliceDim0 || isSimpleSlice) {\n // Optimization #2, slice is memory contiguous (only occurs in dim 0)\n util.assert(\n x.shape.length >= 1,\n () => `Input must have rank at least 1, got: ${x.shape.length}`);\n\n const size = slice_util.computeOutShape($begin, $end, $strides);\n // To tolerate begin[0] > end[0] (a 0-output slice), we min(begin, end).\n const sliced = slice({inputs: {x}, backend, attrs: {begin: $begin, size}});\n result =\n reshape({inputs: {x: sliced}, backend, attrs: {shape: finalShape}});\n backend.disposeIntermediateTensorInfo(sliced);\n } else {\n const shouldExecuteOnCPU = backend.shouldExecuteOnCPU([x]);\n if (shouldExecuteOnCPU) {\n // tslint:disable-next-line: no-unnecessary-type-assertion\n const values = backend.readSync(x.dataId) as TypedArray;\n // tslint:disable-next-line: no-unnecessary-type-assertion\n const xBuf = buffer(x.shape, x.dtype, values) as TensorBuffer;\n const resultValues =\n stridedSliceImplCPU(finalShapeSparse, xBuf, $strides, $begin);\n result = backend.makeTensorInfo(finalShape, x.dtype, resultValues.values);\n } else {\n const program =\n new StridedSliceProgram($begin, $strides, finalShapeSparse);\n result = backend.runWebGLProgram(program, [x], x.dtype);\n }\n }\n\n const resultReshaped =\n reshape({inputs: {x: result}, backend, attrs: {shape: finalShape}});\n\n backend.disposeIntermediateTensorInfo(result);\n\n return resultReshaped;\n}\n\nexport const stridedSliceConfig: KernelConfig = {\n kernelName: StridedSlice,\n backendName: 'webgl',\n kernelFunc: stridedSlice as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, StringNGrams, StringNGramsAttrs, StringNGramsInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {stringNGramsImplCPU} from '../kernel_utils/shared';\n\nexport function stringNGrams(args: {\n inputs: StringNGramsInputs,\n backend: MathBackendWebGL,\n attrs: StringNGramsAttrs\n}): [TensorInfo, TensorInfo] {\n const {inputs, backend, attrs} = args;\n const {\n separator,\n nGramWidths,\n leftPad,\n rightPad,\n padWidth,\n preserveShortSequences\n } = attrs;\n const {data, dataSplits} = inputs;\n const $data = backend.readSync(data.dataId) as Uint8Array[];\n const $dataSplits = backend.readSync(dataSplits.dataId) as Int32Array;\n\n const [nGrams, nGramsSplits] = stringNGramsImplCPU(\n $data, $dataSplits, separator, nGramWidths, leftPad, rightPad, padWidth,\n preserveShortSequences);\n return [\n backend.makeTensorInfo([nGrams.length], 'string', nGrams),\n backend.makeTensorInfo(dataSplits.shape, 'int32', nGramsSplits),\n ];\n}\n\nexport const stringNGramsConfig: KernelConfig = {\n kernelName: StringNGrams,\n backendName: 'webgl',\n kernelFunc: stringNGrams as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, StringSplit, StringSplitAttrs, StringSplitInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {stringSplitImplCPU} from '../kernel_utils/shared';\n\nexport function stringSplit(args: {\n inputs: StringSplitInputs,\n backend: MathBackendWebGL,\n attrs: StringSplitAttrs\n}): [TensorInfo, TensorInfo, TensorInfo] {\n const {inputs, backend, attrs} = args;\n const {skipEmpty} = attrs;\n const {input, delimiter} = inputs;\n\n if (input.dtype !== 'string') {\n throw new Error('Input must be of datatype string');\n }\n if (input.shape.length !== 1) {\n throw new Error(`Input must be a vector, got shape: ${input.shape}`);\n }\n if (delimiter.shape.length !== 0) {\n throw new Error(\n `Delimiter must be a scalar, got shape: ${delimiter.shape}`);\n }\n\n const $input = backend.readSync(input.dataId) as Uint8Array[];\n const $delimiter = backend.readSync(delimiter.dataId)[0] as Uint8Array;\n\n const [indices, values, shape] =\n stringSplitImplCPU($input, $delimiter, skipEmpty);\n const outputSize = values.length;\n return [\n backend.makeTensorInfo([outputSize, 2], 'int32', indices),\n backend.makeTensorInfo([outputSize], 'string', values),\n backend.makeTensorInfo([2], 'int32', new Int32Array(shape))\n ];\n}\n\nexport const stringSplitConfig: KernelConfig = {\n kernelName: StringSplit,\n backendName: 'webgl',\n kernelFunc: stringSplit as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, StringToHashBucketFast, StringToHashBucketFastAttrs, StringToHashBucketFastInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {stringToHashBucketFastImplCPU} from '../kernel_utils/shared';\n\nexport function stringToHashBucketFast(args: {\n inputs: StringToHashBucketFastInputs,\n backend: MathBackendWebGL,\n attrs: StringToHashBucketFastAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {numBuckets} = attrs;\n const {input} = inputs;\n\n if (input.dtype !== 'string') {\n throw new Error('Input must be of datatype string');\n }\n if (numBuckets <= 0) {\n throw new Error(`Number of buckets must be at least 1`);\n }\n\n const $input = backend.readSync(input.dataId) as Uint8Array[];\n\n const output = stringToHashBucketFastImplCPU($input, numBuckets);\n return backend.makeTensorInfo(input.shape, 'int32', output);\n}\n\nexport const stringToHashBucketFastConfig: KernelConfig = {\n kernelName: StringToHashBucketFast,\n backendName: 'webgl',\n kernelFunc: stringToHashBucketFast as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Tan} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst TAN = `return tan(x);`;\n\nexport const tan = unaryKernelFunc({opSnippet: TAN});\n\nexport const tanConfig: KernelConfig = {\n kernelName: Tan,\n backendName: 'webgl',\n kernelFunc: tan,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Tanh} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nconst TANH = `\n float e2x = exp(-2.0 * abs(x));\n return sign(x) * (1.0 - e2x) / (1.0 + e2x);\n`;\n\nexport const tanh = unaryKernelFunc({opSnippet: TANH});\n\nexport const tanhConfig: KernelConfig = {\n kernelName: Tanh,\n backendName: 'webgl',\n kernelFunc: tanh,\n};\n","/**\n * @license\n * Copyright 2017 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\nimport {getCoordsDataType} from './shader_compiler';\n\nexport class TileProgram implements GPGPUProgram {\n variableNames = ['A'];\n outputShape: number[];\n userCode: string;\n rank: number;\n\n constructor(aShape: number[], reps: number[]) {\n const outputShape: number[] = new Array(aShape.length);\n for (let i = 0; i < outputShape.length; i++) {\n outputShape[i] = aShape[i] * reps[i];\n }\n this.outputShape = outputShape;\n this.rank = outputShape.length;\n const dtype = getCoordsDataType(this.rank);\n const sourceCoords = getSourceCoords(aShape);\n\n this.userCode = `\n void main() {\n ${dtype} resRC = getOutputCoords();\n setOutput(getA(${sourceCoords}));\n }\n `;\n }\n}\n\nfunction getSourceCoords(aShape: number[]): string {\n const rank = aShape.length;\n if (rank > 5) {\n throw Error(`Tile for rank ${rank} is not yet supported`);\n }\n if (rank === 1) {\n return `imod(resRC, ${aShape[0]})`;\n }\n\n const currentCoords = ['resRC.x', 'resRC.y', 'resRC.z', 'resRC.w', 'resRC.u'];\n\n const sourceCoords = [];\n for (let i = 0; i < aShape.length; i++) {\n sourceCoords.push(`imod(${currentCoords[i]}, ${aShape[i]})`);\n }\n return sourceCoords.join();\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {buffer, KernelConfig, KernelFunc, TensorInfo, Tile, TileAttrs, TileInputs, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {tileImplCPU} from '../kernel_utils/shared';\nimport {TileProgram} from '../tile_gpu';\n\nexport function tile(\n params: {inputs: TileInputs, backend: MathBackendWebGL, attrs: TileAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = params;\n const {x} = inputs;\n const {reps} = attrs;\n\n // tile gpu program cannot handle rank > 5 case.\n if (x.dtype === 'string' || x.shape.length > 5) {\n // Even thought string tensor is always on CPU, just to be consistent on how\n // to access tensor data.\n const data = backend.readSync(x.dataId);\n const value = x.dtype === 'string' ?\n (data as Uint8Array[]).map(d => util.decodeString(d)) :\n data as TypedArray;\n const buf = buffer(x.shape, x.dtype, value);\n const outBuf = tileImplCPU(buf, reps);\n return backend.makeTensorInfo(outBuf.shape, outBuf.dtype, outBuf.values);\n }\n\n const program = new TileProgram(x.shape, reps);\n const output = backend.runWebGLProgram(program, [x], x.dtype);\n\n return output;\n}\n\nexport const tileConfig: KernelConfig = {\n kernelName: Tile,\n backendName: 'webgl',\n kernelFunc: tile as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {GPGPUProgram} from './gpgpu_math';\nimport {UniformType} from './shader_compiler';\n\n// Based on Algorithm 2 of Bitonic Top K, ref:\n// https://anilshanbhag.in/static/papers/gputopk_sigmod18.pdf\n// The original algorithm is based on computing the top K only, however\n// since for TFJS we require the indices of the top K values as well then the\n// algorithm found here is a bit modified. Rather than producing the values\n// at each step, the indices containing the top K are generated instead.\n// The output values are not generated to reduce the number of outputs in the\n// GPU, the values can easily be retrieved from the indices using a gather\n// op.\nexport class SwapProgram implements GPGPUProgram {\n variableNames = ['x', 'indices'];\n outputShape: number[];\n userCode: string;\n // |n| Size of the original input of TopK.\n // |firstPass|indicates if this is the first time swap is being used which\n // means no indices input containing the top K is present yet.\n // |inc| Swaps pairs of indices (0, inc), (1, inc + 1), (2, inc + 2) ...\n customUniforms = [\n {name: 'n', type: 'int' as UniformType},\n {name: 'firstPass', type: 'int' as UniformType},\n {name: 'negativeInf', type: 'float' as UniformType},\n {name: 'dir', type: 'int' as UniformType},\n {name: 'inc', type: 'int' as UniformType}\n ];\n\n /**\n * @param shape desired output shape (can be larger than input shape, output\n * will be padded with -Infinity)\n */\n constructor(shape: number[]) {\n this.outputShape = shape;\n\n this.userCode = `\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int elemIdx = coords[1];\n\n // We compare elements pair-wise within a group of size 2 * inc.\n // The comparing rule for each group alternates between ascending\n // and descending. Within each group, we compare each pair at\n // positions i and i+inc. To decide whether an element at position i\n // is x0 or x1, we mod it by 2 * inc, if the result is smaller than\n // inc, it is in the first half of the group, we denote it as x0,\n // otherwise we denote it as x1.\n // For example, as shown in the Bitonic top K paper referenced above,\n // Figure5(a) shows that element[1] is in the\n // second half of the group when group size is 2, but it is in the\n // first half of the group when group size is 4.\n\n bool isFirstInPair = imod(elemIdx, 2 * inc) < inc;\n int i = isFirstInPair ? elemIdx : elemIdx - inc;\n\n int i0 = firstPass == 1 ? i : int(getIndices(batch, i));\n int i1 = firstPass == 1 ? i + inc : int(getIndices(batch, i + inc));\n float x0 = i0 < n ? getX(batch, i0) : negativeInf;\n float x1 = i1 < n ? getX(batch, i1) : negativeInf;\n\n // Denotes which direction indices are in (ascending or descending).\n bool reverse = imod(elemIdx, 2 * dir) >= dir;\n bool isGreater = x0 > x1 || (x0 == x1 && i1 > i0);\n if (reverse == isGreater) { // Elements in opposite order of direction\n int iTemp = i0;\n i0 = i1;\n i1 = iTemp;\n }\n if (isFirstInPair) {\n setOutput(float(i0));\n } else {\n setOutput(float(i1));\n }\n }\n `;\n }\n}\n\nexport class MergeProgram implements GPGPUProgram {\n variableNames = ['x', 'indices'];\n outputShape: number[];\n userCode: string;\n // |n| Size of the original input of TopK\n // |firstPass| indicates if this is the first time swap is being used which\n // means no indices input containing the top K is present yet.\n // |k| Top k elements desired\n customUniforms = [\n {name: 'n', type: 'int' as UniformType},\n {name: 'firstPass', type: 'int' as UniformType},\n {name: 'k', type: 'int' as UniformType}\n ];\n\n /**\n * @param shape desired output shape (must be half of the input size)\n */\n constructor(shape: number[]) {\n this.outputShape = shape;\n\n this.userCode = `\n void main() {\n // Takes max of indices (0, k), (1, k + 1), (2, k + 2) ...\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int elemIdx = coords[1];\n\n // The output size is half of the previous size.\n // If the previous sequence is | | | | _ _ _ _ | | | | _ _ _ _ (k=4),\n // we only need to output the indices at positions |, the indices at\n // positions _ can be thrown away, see Figure5(b) After Phase 2\n // (Merge phase) in the Bitonic Top K paper referenced above.\n // For example, the paper shows we only need to output the orange bars.\n // The output sequence should look like this | | | | | | | |.\n // Because the sequence is halved, to map the output index back\n // to the previous sequence to find the corresponding value,\n // we need to double the index. When we double the index,\n // we basically interpolate a position, so 2i looks like\n // | _ | _ | _ | _ | _ | _ | _. We move the | to the first k position\n // of each 2k positions by - elemIdx % k. E.g. for output at\n // index 4,5,6,7, we want to get the corresponding element at\n // original index 8,9,10,11, for output at index 8,9,10,11,\n // we want to get the corresponding element at original index\n // 16,17,18,19, so on and so forth.\n\n int i = elemIdx < k ? elemIdx : (elemIdx * 2 - imod(elemIdx, k));\n int i0 = firstPass == 1 ? i : int(getIndices(batch, i));\n int i1 = firstPass == 1 ? i + k : int(getIndices(batch, i + k));\n\n float x0 = getX(batch, i0);\n float x1 = i1 < n ? getX(batch, i1) : x0;\n\n setOutput(x0 >= x1 ? float(i0) : float(i1));\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env, KernelConfig, KernelFunc, NumericDataType, TensorInfo, TopK, TopKAttrs, TopKInputs, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {topKImplCPU} from '../kernel_utils/shared';\nimport {MergeProgram, SwapProgram} from '../top_k_gpu';\nimport {fill} from './Fill';\nimport {gatherV2} from './GatherV2';\nimport {reshape} from './Reshape';\nimport {slice} from './Slice';\n\nfunction disposeIntermediateTensorInfoOrNull(\n backend: MathBackendWebGL, tensorInfo: TensorInfo) {\n if (tensorInfo !== null) {\n backend.disposeIntermediateTensorInfo(tensorInfo);\n }\n}\n\nfunction roundUpToPow2(num: number) {\n let pow2 = 1;\n while (pow2 < num) {\n pow2 *= 2;\n }\n return pow2;\n}\n\n// Based on Algorithm 2 of Bitonic Top K, ref:\n// https://anilshanbhag.in/static/papers/gputopk_sigmod18.pdf\nexport function topK(\n args: {inputs: TopKInputs, backend: MathBackendWebGL, attrs: TopKAttrs}):\n TensorInfo[] {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {k, sorted} = attrs;\n\n // Empirically determined constant used to determine last dim threshold for\n // handing off execution to the CPU.\n const TOPK_LAST_DIM_CPU_HANDOFF_SIZE_THRESHOLD =\n env().getNumber('TOPK_LAST_DIM_CPU_HANDOFF_SIZE_THRESHOLD');\n\n // Empirically determined constant used to determine k threshold for handing\n // off execution to the CPU.\n const TOPK_K_CPU_HANDOFF_THRESHOLD =\n env().getNumber('TOPK_K_CPU_HANDOFF_THRESHOLD');\n\n const xShape = x.shape;\n const lastDim = xShape[xShape.length - 1];\n\n if (backend.shouldExecuteOnCPU([x]) ||\n lastDim < TOPK_LAST_DIM_CPU_HANDOFF_SIZE_THRESHOLD ||\n k > TOPK_K_CPU_HANDOFF_THRESHOLD) {\n const xVals = backend.readSync(x.dataId) as TypedArray;\n const [allTopKVals, allTopKIndices] =\n topKImplCPU(xVals, xShape, x.dtype as NumericDataType, k, sorted);\n\n return [\n backend.makeTensorInfo(\n allTopKVals.shape, allTopKVals.dtype, allTopKVals.values),\n backend.makeTensorInfo(\n allTopKIndices.shape, allTopKIndices.dtype, allTopKIndices.values)\n ];\n }\n\n if (k === 0) {\n xShape[xShape.length - 1] = 0;\n return [\n backend.makeTensorInfo(xShape, x.dtype, []),\n backend.makeTensorInfo(xShape, 'int32', [])\n ];\n }\n\n if (lastDim === 1 /* firstPass */) {\n return [\n x, fill({attrs: {shape: xShape, dtype: 'int32', value: 0}, backend})\n ];\n }\n\n // Eagerly unpack x input since it is passed in to all the shaders which\n // require unpacked inputs.\n const xtexData = backend.texData.get(x.dataId);\n const xIsPacked = xtexData !== null && xtexData.isPacked;\n const xUnPacked = xIsPacked ? backend.unpackTensor(x) : x;\n\n // Reshape into a 2d tensor [batch, lastDim] and compute topk along lastDim.\n const xSize = util.sizeFromShape(xShape);\n const batch = xSize / lastDim;\n const x2D = reshape(\n {inputs: {x: xUnPacked}, attrs: {shape: [batch, lastDim]}, backend});\n\n if (xIsPacked) {\n disposeIntermediateTensorInfoOrNull(backend, xUnPacked);\n }\n\n const kPow2 = roundUpToPow2(k);\n const lastDimPow2 = roundUpToPow2(lastDim);\n\n // Only the indices containing the top K are kept at every step to reduce\n // number of outputs in the GPU algorithms, so once the final set of indices\n // is computed then gather is used to grab the corresponding values\n // from the original input.\n let indices: TensorInfo = null;\n\n // GPU algorithm always takes in an indices input but this input is not used\n // on the first run of a GPU algorithm, therefore if indices is null we simply\n // pass in x2D instead of it but the value will not actually be used\n const getInputs = () => indices === null ? [x2D, x2D] : [x2D, indices];\n\n const runSwap = (dir: number, inc: number, shape: number[]) => {\n const inputs = getInputs();\n const program = new SwapProgram(shape);\n const fistPass = indices === null ? 1 : 0;\n const customValues =\n [[lastDim], [fistPass], [Number.NEGATIVE_INFINITY], [dir], [inc]];\n const prevIndices = indices;\n indices = backend.runWebGLProgram(program, inputs, 'int32', customValues);\n disposeIntermediateTensorInfoOrNull(backend, prevIndices);\n };\n\n // Step 1: local sort\n for (let len = 1; len < kPow2; len *= 2) {\n const dir = len * 2;\n for (let inc = len; inc >= 1; inc /= 2) {\n runSwap(dir, inc, [batch, lastDimPow2]);\n }\n }\n\n // Step 2: merge\n for (let indicesSize = lastDimPow2; indicesSize > kPow2; indicesSize /= 2) {\n const inputs = getInputs();\n const mergeProgram = new MergeProgram([batch, indicesSize / 2]);\n const firstPass = indices === null ? 1 : 0;\n const customValues = [[lastDim], [firstPass], [kPow2]];\n const prevIndices = indices;\n indices =\n backend.runWebGLProgram(mergeProgram, inputs, 'int32', customValues);\n disposeIntermediateTensorInfoOrNull(backend, prevIndices);\n\n // Step 3: rebuild\n const len = kPow2 / 2;\n const dir = len * 2;\n for (let inc = len; inc >= 1; inc /= 2) {\n runSwap(dir, inc, indices.shape);\n }\n }\n\n // Keep only the requested top K results instead of kPow2\n let prevIndices = indices;\n indices = slice(\n {inputs: {x: indices}, backend, attrs: {begin: 0, size: [batch, k]}});\n disposeIntermediateTensorInfoOrNull(backend, prevIndices);\n\n // Gather values on last dimension\n let values = gatherV2(\n {inputs: {x: x2D, indices}, backend, attrs: {axis: 1, batchDims: 1}});\n disposeIntermediateTensorInfoOrNull(backend, x2D);\n\n // Reshape back to the original input shape, except that the last\n // dimension is k.\n const newShape = xShape.slice(0, -1);\n newShape.push(k);\n\n prevIndices = indices;\n indices = reshape({inputs: {x: indices}, attrs: {shape: newShape}, backend});\n disposeIntermediateTensorInfoOrNull(backend, prevIndices);\n\n const prevValues = values;\n values = reshape({inputs: {x: values}, attrs: {shape: newShape}, backend});\n disposeIntermediateTensorInfoOrNull(backend, prevValues);\n\n return [values, indices];\n}\n\nexport const topKConfig: KernelConfig = {\n kernelName: TopK,\n backendName: 'webgl',\n kernelFunc: topK as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class TransformProgram implements GPGPUProgram {\n variableNames = ['Image', 'Transforms'];\n outputShape: number[];\n userCode: string;\n\n constructor(\n imageHeight: number, imageWidth: number,\n interpolation: 'nearest'|'bilinear',\n fillMode: 'constant'|'reflect'|'wrap'|'nearest', fillValue: number,\n outShape: [number, number, number, number]) {\n this.outputShape = outShape;\n const interpolationModeId = interpolation === 'nearest' ? 1 : 2;\n let fillModeId;\n switch (fillMode) {\n case 'constant':\n fillModeId = 1;\n break;\n case 'reflect':\n fillModeId = 2;\n break;\n case 'wrap':\n fillModeId = 3;\n break;\n case 'nearest':\n fillModeId = 4;\n break;\n default:\n fillModeId = 1;\n break;\n }\n this.userCode = `\n float mapCoord(float outCoord, float len) {\n float inCoord = outCoord;\n if(${fillModeId} == 2) {\n if (inCoord < 0.0) {\n if (len <= 1.0) {\n inCoord = 0.0;\n } else {\n float sz2 = 2.0 * len;\n if (inCoord < sz2) {\n inCoord = sz2 * float(int(float(-inCoord / sz2))) +\n inCoord;\n }\n inCoord = inCoord < -len ? inCoord + sz2 : -inCoord - 1.0;\n }\n } else if (inCoord > len - 1.0) {\n if (len <= 1.0) {\n inCoord = 0.0;\n } else {\n float sz2 = 2.0 * len;\n inCoord -= sz2 * float(int(float(inCoord / sz2)));\n if (inCoord >= len) {\n inCoord = sz2 - inCoord - 1.0;\n }\n }\n }\n return clamp(inCoord, 0.0, len - 1.0);\n } else if (${fillModeId} == 3) {\n if (inCoord < 0.0) {\n if (len <= 1.0) {\n inCoord = 0.0;\n } else {\n float sz = len - 1.0;\n inCoord += len * (float(int(float(-inCoord / sz))) + 1.0);\n }\n } else if (inCoord > len - 1.0) {\n if (len <= 1.0) {\n inCoord = 0.0;\n } else {\n float sz = len - 1.0;\n inCoord -= len * float(int(float(inCoord / sz)));\n }\n }\n return clamp(inCoord, 0.0, len - 1.0);\n } else if (${fillModeId} == 4) {\n return clamp(outCoord, 0.0, len - 1.0);\n } else {\n return outCoord;\n }\n }\n\n float readWithFillValue(int batch, int coordY, int coordX,\n int channel) {\n float outputValue;\n if (0 <= coordY && coordY < ${\n imageHeight} && 0 <= coordX && coordX < ${imageWidth}) {\n outputValue = getImage(batch, coordY, coordX, channel);\n } else {\n outputValue = float(${fillValue});\n }\n return outputValue;\n }\n\n void main() {\n ivec4 coords = getOutputCoords();\n float outputValue;\n int batch = coords[0];\n int x = coords[2];\n int y = coords[1];\n int channel = coords[3];\n float xf = float(x);\n float yf = float(y);\n float a1 = getTransforms(batch, 0);\n float a2 = getTransforms(batch, 1);\n float a3 = getTransforms(batch, 2);\n float b1 = getTransforms(batch, 3);\n float b2 = getTransforms(batch, 4);\n float b3 = getTransforms(batch, 5);\n float c1 = getTransforms(batch, 6);\n float c2 = getTransforms(batch, 7);\n float projection = c1 * xf + c2 * yf + 1.0;\n if (projection == 0.0) {\n outputValue = float(${fillValue});\n } else {\n float inX = (a1 * xf + a2 * yf + a3) / projection;\n float inY = (b1 * xf + b2 * yf + b3) / projection;\n float mapX = mapCoord(inX, float(${imageWidth}));\n float mapY = mapCoord(inY, float(${imageHeight}));\n\n if (${interpolationModeId} == 1) {\n int coordY = int(round(mapY));\n int coordX = int(round(mapX));\n outputValue = readWithFillValue(batch, coordY, coordX,\n channel);\n } else {\n float yFloor = floor(mapY);\n float xFloor = floor(mapX);\n float yCeil = yFloor + 1.0;\n float xCeil = xFloor + 1.0;\n float valueYFloor = (xCeil - mapX) *\n readWithFillValue(batch, int(yFloor), int(xFloor), channel) +\n (mapX - xFloor) *\n readWithFillValue(batch, int(yFloor), int(xCeil), channel);\n float valueYCeil = (xCeil - mapX) *\n readWithFillValue(batch, int(yCeil), int(xFloor), channel) +\n (mapX - xFloor) *\n readWithFillValue(batch, int(yCeil), int(xCeil), channel);\n outputValue = (yCeil - mapY) * valueYFloor +\n (mapY - yFloor) * valueYCeil;\n }\n }\n setOutput(outputValue);\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, TensorInfo, Transform, TransformAttrs, TransformInputs} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {TransformProgram} from '../transform_gpu';\n\nexport function transform(args: {\n inputs: TransformInputs,\n backend: MathBackendWebGL,\n attrs: TransformAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {image, transforms} = inputs;\n const {interpolation, fillMode, fillValue, outputShape} = attrs;\n\n const [batch, imageHeight, imageWidth, numChannels] = image.shape;\n const [outHeight, outWidth] =\n outputShape != null ? outputShape : [imageHeight, imageWidth];\n const outShape =\n [batch, outHeight, outWidth,\n numChannels] as [number, number, number, number];\n\n const program = new TransformProgram(\n imageHeight, imageWidth, interpolation, fillMode, fillValue, outShape);\n return backend.runWebGLProgram(program, [image, transforms], 'float32');\n}\n\nexport const transformConfig: KernelConfig = {\n kernelName: Transform,\n backendName: 'webgl',\n kernelFunc: transform as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the License);\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an AS IS BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, TensorInfo, Unique, UniqueAttrs, UniqueInputs} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {uniqueImplCPU} from '../kernel_utils/shared';\nimport {assertNotComplex} from '../webgl_util';\n\nexport function unique(\n args:\n {inputs: UniqueInputs, attrs: UniqueAttrs, backend: MathBackendWebGL}):\n TensorInfo[] {\n const {inputs, attrs, backend} = args;\n const {axis} = attrs;\n const {x} = inputs;\n assertNotComplex(x, 'unique');\n\n // For now, always forward calculation to the CPU backend.\n console.warn(\n 'WARNING: ',\n 'UI might be locked temporarily as data is being downloaded');\n const values = backend.readSync(x.dataId);\n const {outputValues, outputShape, indices} =\n uniqueImplCPU(values, axis, x.shape, x.dtype);\n return [\n backend.makeTensorInfo(outputShape, x.dtype, outputValues),\n backend.makeTensorInfo([indices.length], 'int32', indices),\n ];\n}\n\nexport const uniqueConfig: KernelConfig = {\n kernelName: Unique,\n backendName: 'webgl',\n kernelFunc: unique as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, TensorInfo, Unpack, UnpackAttrs, UnpackInputs} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\n\nimport {reshape} from './Reshape';\nimport {slice} from './Slice';\n\nexport function unpack(\n args:\n {inputs: UnpackInputs, backend: MathBackendWebGL, attrs: UnpackAttrs}):\n TensorInfo[] {\n const {inputs, backend, attrs} = args;\n const {value} = inputs;\n let {axis} = attrs;\n\n if (axis < 0) {\n axis += value.shape.length;\n }\n\n const x = value;\n const xRank = x.shape.length;\n\n const num = value.shape[axis];\n const outShape: number[] = new Array(xRank - 1);\n let outIndex = 0;\n for (let i = 0; i < xRank; i++) {\n if (i !== axis) {\n outShape[outIndex++] = x.shape[i];\n }\n }\n\n const toDispose = [];\n\n const begin = new Array(xRank).fill(0);\n const size = x.shape.slice();\n size[axis] = 1;\n const res: TensorInfo[] = new Array(num);\n for (let i = 0; i < res.length; i++) {\n begin[axis] = i;\n const sliced = slice({inputs: {x}, backend, attrs: {begin, size}});\n const reshaped =\n reshape({inputs: {x: sliced}, backend, attrs: {shape: outShape}});\n res[i] = reshaped;\n\n toDispose.push(sliced);\n }\n\n toDispose.forEach(t => backend.disposeIntermediateTensorInfo(t));\n return res;\n}\n\nexport const unpackConfig: KernelConfig = {\n kernelName: Unpack,\n backendName: 'webgl',\n kernelFunc: unpack as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {GPGPUProgram} from './gpgpu_math';\n\nexport class SegmentOpProgram implements GPGPUProgram {\n variableNames = ['x', 'segmentIds'];\n outputShape: number[];\n userCode: string;\n\n constructor(\n segOpInfo: backend_util.segment_util.SegOpInfo,\n segOpType: 'unsortedSegmentSum') {\n const windowSize = segOpInfo.windowSize;\n const batchSize = segOpInfo.batchSize;\n const inSize = segOpInfo.inSize;\n const numSegments = segOpInfo.numSegments;\n const outSize = numSegments * Math.ceil(inSize / windowSize);\n this.outputShape = [batchSize, outSize];\n\n const initializationValue = '0.0';\n const returnValue = `sumValue`;\n\n const windowSizeNearestVec4 = Math.floor(windowSize / 4) * 4;\n const windowSizeVec4Remainder = windowSize % 4;\n\n const updateSnippet = `\n sumValue += dot(values, segFilter);\n `;\n\n let checkValueOutOfBounds = '';\n if (inSize % windowSize > 0) {\n checkValueOutOfBounds = `\n if (inIdx < 0 || inIdx >= ${inSize}) {\n return initializationValue;\n }\n `;\n }\n\n let checkSegmentIdOutOfBounds = '';\n if (inSize % windowSize > 0) {\n checkSegmentIdOutOfBounds = `\n if (inIdx < 0 || inIdx >= ${inSize}) {\n return -1.0;\n }\n `;\n }\n\n this.userCode = `\n const float initializationValue = ${initializationValue};\n\n float getValue(int batch, int inIdx) {\n ${checkValueOutOfBounds}\n return getX(batch, inIdx);\n }\n\n float getSegmentIdAtIndex(int inIdx) {\n ${checkSegmentIdOutOfBounds}\n return getSegmentIds(inIdx);\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int outIdx = coords[1];\n int inOffset = int(floor(float(outIdx) / float(\n ${numSegments})) * float(${windowSize}));\n int currentSeg = int(mod(float(outIdx), float(${numSegments})));\n\n float sumValue = 0.0;\n\n for (int i = 0; i < ${windowSizeNearestVec4}; i += 4) {\n int inIdx = inOffset + i;\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n getValue(batch, inIdx + 3)\n );\n\n vec4 segFilter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 3)) == currentSeg ? 1 : 0\n );\n\n ${updateSnippet}\n }\n\n int inIdx = inOffset + ${windowSizeNearestVec4};\n if (${windowSizeVec4Remainder === 1}) {\n vec4 values = vec4(\n getValue(batch, inIdx),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n int inIdxSeg = int(getSegmentIdAtIndex(inIdx));\n\n vec4 segFilter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n 0,\n 0,\n 0\n );\n\n ${updateSnippet}\n } else if (${windowSizeVec4Remainder === 2}) {\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n initializationValue,\n initializationValue\n );\n\n vec4 segFilter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n 0,\n 0\n );\n\n ${updateSnippet}\n } else if (${windowSizeVec4Remainder === 3}) {\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n initializationValue\n );\n\n vec4 segFilter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0,\n 0\n );\n\n ${updateSnippet}\n }\n setOutput(${returnValue});\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, DataType, KernelConfig, KernelFunc, sumOutType, TensorInfo, UnsortedSegmentSum, UnsortedSegmentSumAttrs, UnsortedSegmentSumInputs, util} from '@tensorflow/tfjs-core';\n\nimport {MathBackendWebGL} from '../backend_webgl';\nimport {SegmentOpProgram} from '../segment_gpu';\n\nimport {range} from './Range';\nimport {reshape} from './Reshape';\nimport {tile} from './Tile';\nimport {transpose} from './Transpose';\n\nexport function unsortedSegmentSum(args: {\n inputs: UnsortedSegmentSumInputs,\n backend: MathBackendWebGL,\n attrs: UnsortedSegmentSumAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x, segmentIds} = inputs;\n const {numSegments} = attrs;\n\n const xRank = x.shape.length;\n\n const toDispose = [];\n\n let axis = 0;\n const permutation = backend_util.getAxesPermutation([axis], xRank);\n let permutedX = x;\n if (permutation != null) {\n permutedX = transpose({inputs: {x}, backend, attrs: {perm: permutation}});\n toDispose.push(permutedX);\n axis = backend_util.getInnerMostAxes(1, xRank)[0];\n }\n\n const outShape = backend_util.segment_util.computeOutShape(\n permutedX.shape, axis, numSegments);\n const inSize = util.sizeFromShape([permutedX.shape[axis]]);\n const a2D =\n reshape({inputs: {x: permutedX}, backend, attrs: {shape: [-1, inSize]}});\n toDispose.push(a2D);\n\n const outputDType = sumOutType(x.dtype);\n\n const segOpCompute =\n (x: TensorInfo, segOpType: 'unsortedSegmentSum', segmentIds: TensorInfo,\n dtype: DataType, numSegments: number): TensorInfo => {\n const batchSize = x.shape[0];\n const inSize = x.shape[1];\n const windowSize =\n backend_util.segment_util.segOpComputeOptimalWindowSize(\n inSize, numSegments);\n const segOpInfo = {windowSize, inSize, batchSize, numSegments};\n const program = new SegmentOpProgram(segOpInfo, segOpType);\n const output = backend.compileAndRun(program, [x, segmentIds], dtype);\n toDispose.push(output);\n // No need to run another GPGPU program.\n if (output.shape[1] === numSegments) {\n return output;\n }\n const rangeInfo = range({\n backend,\n attrs: {start: 0, stop: numSegments, step: 1, dtype: 'float32'}\n });\n const tileInfo = tile({\n inputs: {x: rangeInfo},\n backend,\n attrs: {reps: [inSize / windowSize]}\n });\n\n toDispose.push(rangeInfo);\n toDispose.push(tileInfo);\n\n const result =\n segOpCompute(output, segOpType, tileInfo, dtype, numSegments);\n return result;\n };\n\n const segOpResult = segOpCompute(\n a2D, 'unsortedSegmentSum', segmentIds, outputDType, numSegments);\n\n const reshaped =\n reshape({inputs: {x: segOpResult}, backend, attrs: {shape: outShape}});\n\n let result = reshaped;\n if (permutation != null) {\n toDispose.push(reshaped);\n const perm = backend_util.getUndoAxesPermutation(permutation);\n result = transpose({inputs: {x: result}, backend, attrs: {perm}});\n }\n\n toDispose.forEach(t => backend.disposeIntermediateTensorInfo(t));\n return result;\n}\n\nexport const unsortedSegmentSumConfig: KernelConfig = {\n kernelName: UnsortedSegmentSum,\n backendName: 'webgl',\n kernelFunc: unsortedSegmentSum as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, registerKernel} from '@tensorflow/tfjs-core';\n\nimport {_fusedMatMulConfig} from './kernels/_FusedMatMul';\nimport {absConfig} from './kernels/Abs';\nimport {acosConfig} from './kernels/Acos';\nimport {acoshConfig} from './kernels/Acosh';\nimport {addConfig} from './kernels/Add';\nimport {addNConfig} from './kernels/AddN';\nimport {allConfig} from './kernels/All';\nimport {anyConfig} from './kernels/Any';\nimport {argMaxConfig} from './kernels/ArgMax';\nimport {argMinConfig} from './kernels/ArgMin';\nimport {asinConfig} from './kernels/Asin';\nimport {asinhConfig} from './kernels/Asinh';\nimport {atanConfig} from './kernels/Atan';\nimport {atan2Config} from './kernels/Atan2';\nimport {atanhConfig} from './kernels/Atanh';\nimport {avgPoolConfig} from './kernels/AvgPool';\nimport {avgPool3DConfig} from './kernels/AvgPool3D';\nimport {avgPool3DGradConfig} from './kernels/AvgPool3DGrad';\nimport {avgPoolGradConfig} from './kernels/AvgPoolGrad';\nimport {batchMatMulConfig} from './kernels/BatchMatMul';\nimport {batchNormConfig} from './kernels/BatchNorm';\nimport {batchToSpaceNDConfig} from './kernels/BatchToSpaceND';\nimport {bincountConfig} from './kernels/Bincount';\nimport {broadcastArgsConfig} from './kernels/BroadcastArgs';\nimport {castConfig} from './kernels/Cast';\nimport {ceilConfig} from './kernels/Ceil';\nimport {clipByValueConfig} from './kernels/ClipByValue';\nimport {complexConfig} from './kernels/Complex';\nimport {complexAbsConfig} from './kernels/ComplexAbs';\nimport {concatConfig} from './kernels/Concat';\nimport {conv2DConfig} from './kernels/Conv2D';\nimport {conv2DBackpropFilterConfig} from './kernels/Conv2DBackpropFilter';\nimport {conv2DBackpropInputConfig} from './kernels/Conv2DBackpropInput';\nimport {conv3DConfig} from './kernels/Conv3D';\nimport {conv3DBackpropFilterV2Config} from './kernels/Conv3DBackpropFilterV2';\nimport {conv3DBackpropInputConfig} from './kernels/Conv3DBackpropInputV2';\nimport {cosConfig} from './kernels/Cos';\nimport {coshConfig} from './kernels/Cosh';\nimport {cropAndResizeConfig} from './kernels/CropAndResize';\nimport {cumprodConfig} from './kernels/Cumprod';\nimport {cumsumConfig} from './kernels/Cumsum';\nimport {denseBincountConfig} from './kernels/DenseBincount';\nimport {depthToSpaceConfig} from './kernels/DepthToSpace';\nimport {depthwiseConv2dNativeConfig} from './kernels/DepthwiseConv2dNative';\nimport {depthwiseConv2dNativeBackpropFilterConfig} from './kernels/DepthwiseConv2dNativeBackpropFilter';\nimport {depthwiseConv2dNativeBackpropInputConfig} from './kernels/DepthwiseConv2dNativeBackpropInput';\nimport {diagConfig} from './kernels/Diag';\nimport {dilation2DConfig} from './kernels/Dilation2D';\nimport {einsumConfig} from './kernels/Einsum';\nimport {eluConfig} from './kernels/Elu';\nimport {eluGradConfig} from './kernels/EluGrad';\nimport {equalConfig} from './kernels/Equal';\nimport {erfConfig} from './kernels/Erf';\nimport {expConfig} from './kernels/Exp';\nimport {expandDimsConfig} from './kernels/ExpandDims';\nimport {expm1Config} from './kernels/Expm1';\nimport {fftConfig} from './kernels/FFT';\nimport {fillConfig} from './kernels/Fill';\nimport {flipLeftRightConfig} from './kernels/FlipLeftRight';\nimport {floorConfig} from './kernels/Floor';\nimport {floorDivConfig} from './kernels/FloorDiv';\nimport {fromPixelsConfig} from './kernels/FromPixels';\nimport {fusedConv2DConfig} from './kernels/FusedConv2D';\nimport {fusedDepthwiseConv2DConfig} from './kernels/FusedDepthwiseConv2D';\nimport {gatherNdConfig} from './kernels/GatherNd';\nimport {gatherV2Config} from './kernels/GatherV2';\nimport {greaterConfig} from './kernels/Greater';\nimport {greaterEqualConfig} from './kernels/GreaterEqual';\nimport {identityConfig} from './kernels/Identity';\nimport {ifftConfig} from './kernels/IFFT';\nimport {imagConfig} from './kernels/Imag';\nimport {isFiniteConfig} from './kernels/IsFinite';\nimport {isInfConfig} from './kernels/IsInf';\nimport {isNaNConfig} from './kernels/IsNaN';\nimport {leakyReluConfig} from './kernels/LeakyRelu';\nimport {lessConfig} from './kernels/Less';\nimport {lessEqualConfig} from './kernels/LessEqual';\nimport {linSpaceConfig} from './kernels/LinSpace';\nimport {logConfig} from './kernels/Log';\nimport {log1pConfig} from './kernels/Log1p';\nimport {logicalAndConfig} from './kernels/LogicalAnd';\nimport {logicalNotConfig} from './kernels/LogicalNot';\nimport {logicalOrConfig} from './kernels/LogicalOr';\nimport {LRNConfig} from './kernels/LRN';\nimport {LRNGradConfig} from './kernels/LRNGrad';\nimport {maxConfig} from './kernels/Max';\nimport {maximumConfig} from './kernels/Maximum';\nimport {maxPoolConfig} from './kernels/MaxPool';\nimport {maxPool3DConfig} from './kernels/MaxPool3D';\nimport {maxPool3DGradConfig} from './kernels/MaxPool3DGrad';\nimport {maxPoolGradConfig} from './kernels/MaxPoolGrad';\nimport {maxPoolWithArgmaxConfig} from './kernels/MaxPoolWithArgmax';\nimport {meanConfig} from './kernels/Mean';\nimport {minConfig} from './kernels/Min';\nimport {minimumConfig} from './kernels/Minimum';\nimport {mirrorPadConfig} from './kernels/MirrorPad';\nimport {modConfig} from './kernels/Mod';\nimport {multinomialConfig} from './kernels/Multinomial';\nimport {multiplyConfig} from './kernels/Multiply';\nimport {negConfig} from './kernels/Neg';\nimport {nonMaxSuppressionV3Config} from './kernels/NonMaxSuppressionV3';\nimport {nonMaxSuppressionV4Config} from './kernels/NonMaxSuppressionV4';\nimport {nonMaxSuppressionV5Config} from './kernels/NonMaxSuppressionV5';\nimport {notEqualConfig} from './kernels/NotEqual';\nimport {oneHotConfig} from './kernels/OneHot';\nimport {onesLikeConfig} from './kernels/OnesLike';\nimport {packConfig} from './kernels/Pack';\nimport {padV2Config} from './kernels/PadV2';\nimport {powConfig} from './kernels/Pow';\nimport {preluConfig} from './kernels/Prelu';\nimport {prodConfig} from './kernels/Prod';\nimport {raggedGatherConfig} from './kernels/RaggedGather';\nimport {raggedRangeConfig} from './kernels/RaggedRange';\nimport {raggedTensorToTensorConfig} from './kernels/RaggedTensorToTensor';\nimport {rangeConfig} from './kernels/Range';\nimport {realConfig} from './kernels/Real';\nimport {realDivConfig} from './kernels/RealDiv';\nimport {reciprocalConfig} from './kernels/Reciprocal';\nimport {reluConfig} from './kernels/Relu';\nimport {relu6Config} from './kernels/Relu6';\nimport {reshapeConfig} from './kernels/Reshape';\nimport {resizeBilinearConfig} from './kernels/ResizeBilinear';\nimport {resizeBilinearGradConfig} from './kernels/ResizeBilinearGrad';\nimport {resizeNearestNeighborConfig} from './kernels/ResizeNearestNeighbor';\nimport {resizeNearestNeighborGradConfig} from './kernels/ResizeNearestNeighborGrad';\nimport {reverseConfig} from './kernels/Reverse';\nimport {rotateWithOffsetConfig} from './kernels/RotateWithOffset';\nimport {roundConfig} from './kernels/Round';\nimport {rsqrtConfig} from './kernels/Rsqrt';\nimport {scatterNdConfig} from './kernels/ScatterNd';\nimport {searchSortedConfig} from './kernels/SearchSorted';\nimport {selectConfig} from './kernels/Select';\nimport {seluConfig} from './kernels/Selu';\nimport {sigmoidConfig} from './kernels/Sigmoid';\nimport {signConfig} from './kernels/Sign';\nimport {sinConfig} from './kernels/Sin';\nimport {sinhConfig} from './kernels/Sinh';\nimport {sliceConfig} from './kernels/Slice';\nimport {softmaxConfig} from './kernels/Softmax';\nimport {softplusConfig} from './kernels/Softplus';\nimport {spaceToBatchNDConfig} from './kernels/SpaceToBatchND';\nimport {sparseFillEmptyRowsConfig} from './kernels/SparseFillEmptyRows';\nimport {sparseReshapeConfig} from './kernels/SparseReshape';\nimport {sparseSegmentMeanConfig} from './kernels/SparseSegmentMean';\nimport {sparseSegmentSumConfig} from './kernels/SparseSegmentSum';\nimport {sparseToDenseConfig} from './kernels/SparseToDense';\nimport {splitVConfig} from './kernels/SplitV';\nimport {sqrtConfig} from './kernels/Sqrt';\nimport {squareConfig} from './kernels/Square';\nimport {squaredDifferenceConfig} from './kernels/SquaredDifference';\nimport {stepConfig} from './kernels/Step';\nimport {stridedSliceConfig} from './kernels/StridedSlice';\nimport {stringNGramsConfig} from './kernels/StringNGrams';\nimport {stringSplitConfig} from './kernels/StringSplit';\nimport {stringToHashBucketFastConfig} from './kernels/StringToHashBucketFast';\nimport {subConfig} from './kernels/Sub';\nimport {sumConfig} from './kernels/Sum';\nimport {tanConfig} from './kernels/Tan';\nimport {tanhConfig} from './kernels/Tanh';\nimport {tileConfig} from './kernels/Tile';\nimport {topKConfig} from './kernels/TopK';\nimport {transformConfig} from './kernels/Transform';\nimport {transposeConfig} from './kernels/Transpose';\nimport {uniqueConfig} from './kernels/Unique';\nimport {unpackConfig} from './kernels/Unpack';\nimport {unsortedSegmentSumConfig} from './kernels/UnsortedSegmentSum';\nimport {zerosLikeConfig} from './kernels/ZerosLike';\n\n// List all kernel configs here\nconst kernelConfigs: KernelConfig[] = [\n _fusedMatMulConfig,\n absConfig,\n acosConfig,\n acoshConfig,\n addConfig,\n addNConfig,\n allConfig,\n anyConfig,\n argMaxConfig,\n argMinConfig,\n asinConfig,\n asinhConfig,\n atanConfig,\n atan2Config,\n atanhConfig,\n avgPoolConfig,\n avgPool3DConfig,\n avgPool3DGradConfig,\n avgPoolGradConfig,\n batchMatMulConfig,\n batchNormConfig,\n batchToSpaceNDConfig,\n bincountConfig,\n broadcastArgsConfig,\n castConfig,\n ceilConfig,\n clipByValueConfig,\n complexConfig,\n complexAbsConfig,\n concatConfig,\n conv2DConfig,\n conv2DBackpropFilterConfig,\n conv2DBackpropInputConfig,\n conv3DConfig,\n conv3DBackpropFilterV2Config,\n conv3DBackpropInputConfig,\n cosConfig,\n coshConfig,\n cropAndResizeConfig,\n cumprodConfig,\n cumsumConfig,\n denseBincountConfig,\n depthToSpaceConfig,\n depthwiseConv2dNativeConfig,\n depthwiseConv2dNativeBackpropFilterConfig,\n depthwiseConv2dNativeBackpropInputConfig,\n diagConfig,\n dilation2DConfig,\n einsumConfig,\n eluConfig,\n eluGradConfig,\n equalConfig,\n erfConfig,\n expConfig,\n expandDimsConfig,\n expm1Config,\n fftConfig,\n fillConfig,\n flipLeftRightConfig,\n floorConfig,\n floorDivConfig,\n fromPixelsConfig,\n fusedConv2DConfig,\n fusedDepthwiseConv2DConfig,\n gatherNdConfig,\n gatherV2Config,\n greaterConfig,\n greaterEqualConfig,\n identityConfig,\n ifftConfig,\n imagConfig,\n isFiniteConfig,\n isInfConfig,\n isNaNConfig,\n leakyReluConfig,\n lessConfig,\n lessEqualConfig,\n linSpaceConfig,\n logConfig,\n log1pConfig,\n logicalAndConfig,\n logicalNotConfig,\n logicalOrConfig,\n LRNConfig,\n LRNGradConfig,\n maxConfig,\n maximumConfig,\n maxPoolConfig,\n maxPool3DConfig,\n maxPool3DGradConfig,\n maxPoolGradConfig,\n maxPoolWithArgmaxConfig,\n meanConfig,\n minConfig,\n minimumConfig,\n mirrorPadConfig,\n modConfig,\n multinomialConfig,\n multiplyConfig,\n negConfig,\n nonMaxSuppressionV3Config,\n nonMaxSuppressionV4Config,\n nonMaxSuppressionV5Config,\n notEqualConfig,\n oneHotConfig,\n onesLikeConfig,\n packConfig,\n padV2Config,\n powConfig,\n preluConfig,\n prodConfig,\n raggedGatherConfig,\n raggedRangeConfig,\n raggedTensorToTensorConfig,\n rangeConfig,\n realConfig,\n realDivConfig,\n reciprocalConfig,\n reluConfig,\n relu6Config,\n reshapeConfig,\n resizeBilinearConfig,\n resizeBilinearGradConfig,\n resizeNearestNeighborConfig,\n resizeNearestNeighborGradConfig,\n reverseConfig,\n rotateWithOffsetConfig,\n roundConfig,\n rsqrtConfig,\n scatterNdConfig,\n searchSortedConfig,\n selectConfig,\n seluConfig,\n sigmoidConfig,\n signConfig,\n sinConfig,\n sinhConfig,\n sliceConfig,\n softmaxConfig,\n softplusConfig,\n spaceToBatchNDConfig,\n sparseFillEmptyRowsConfig,\n sparseReshapeConfig,\n sparseSegmentMeanConfig,\n sparseSegmentSumConfig,\n sparseToDenseConfig,\n splitVConfig,\n sqrtConfig,\n squareConfig,\n squaredDifferenceConfig,\n stepConfig,\n stridedSliceConfig,\n stringNGramsConfig,\n stringSplitConfig,\n stringToHashBucketFastConfig,\n subConfig,\n sumConfig,\n tanConfig,\n tanhConfig,\n tileConfig,\n topKConfig,\n transformConfig,\n transposeConfig,\n uniqueConfig,\n unpackConfig,\n unsortedSegmentSumConfig,\n zerosLikeConfig\n];\n\nfor (const kernelConfig of kernelConfigs) {\n registerKernel(kernelConfig);\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// All exports from this package should be in base.\nexport * from './base';\nimport './register_all_kernels';\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env} from '@tensorflow/tfjs-core';\n\nconst ENV = env();\n\n/** The batched dispatching calls size in the device queue. */\nENV.registerFlag('WEBGPU_DEFERRED_SUBMIT_BATCH_SIZE', () => 15);\n\n/**\n * Whether we forward execution to the CPU backend if tensors are small and\n * reside on the CPU.\n */\nENV.registerFlag('WEBGPU_CPU_FORWARD', () => true);\n\n/**\n * This flag is used to test different types of matmul programs.\n *\n * See MatMulProgramType in webgpu_util.ts for a list of available values.\n */\nENV.registerFlag('WEBGPU_MATMUL_PROGRAM_TYPE', () => -1);\n\n/**\n * Whether to use conv2dTranspose_naive which directly implement the\n * conv2dTranspose logic rather than using a matmul to simulate.\n */\nENV.registerFlag('WEBGPU_USE_NAIVE_CONV2D_TRANSPOSE', () => false);\n\n/**\n * Whether we use low power GPU. Otherwise, a high performance GPU will be\n * requested.\n */\nENV.registerFlag('WEBGPU_USE_LOW_POWER_GPU', () => false);\n\n/**\n * Threshold for input tensor size that determines whether WebGPU backend will\n * delegate computation to CPU.\n *\n * Default value is 1000.\n */\nENV.registerFlag('WEBGPU_CPU_HANDOFF_SIZE_THRESHOLD', () => 1000);\n\n/**\n * Whether to use a dummy canvas to make profiling tools like PIX work with\n * TFJS webgpu backend.\n */\nENV.registerFlag('WEBGPU_USE_PROFILE_TOOL', () => false);\n\n/**\n * Whether to use import API.\n */\nENV.registerFlag('WEBGPU_IMPORT_EXTERNAL_TEXTURE', () => true);\n\n/**\n * Whether to use conv2dNaive for debugging.\n */\nENV.registerFlag('WEBGPU_USE_NAIVE_CONV2D_DEBUG', () => false);\n","/**\n * @license\n * Copyright 2022 Google LLC.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// TODO: Remove it once webgpu/types is successfully upgraded.\n// https://github.com/tensorflow/tfjs/issues/6869\nexport interface GPUAdapterInfo {\n vendor: string;\n architecture: string;\n}\n\nexport class AdapterInfo {\n private vendor: string;\n\n constructor(adapterInfo: GPUAdapterInfo) {\n if (adapterInfo) {\n this.vendor = adapterInfo.vendor;\n }\n }\n\n isIntel(): boolean {\n return this.vendor === 'intel';\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nexport class BufferManager {\n private numUsedBuffers = 0;\n private numFreeBuffers = 0;\n private freeBuffers: Map = new Map();\n private usedBuffers: Map = new Map();\n\n public numBytesUsed = 0;\n public numBytesAllocated = 0;\n\n constructor(private device: GPUDevice) {}\n\n acquireUploadBuffer(size: number, usage: GPUBufferUsageFlags) {\n return this.acquireBuffer(size, usage, true);\n }\n\n acquireBuffer(\n size: number, usage: GPUBufferUsageFlags, mappedAtCreation = false) {\n const key = getBufferKey(size, usage);\n if (!this.freeBuffers.has(key)) {\n this.freeBuffers.set(key, []);\n }\n\n if (!this.usedBuffers.has(key)) {\n this.usedBuffers.set(key, []);\n }\n\n this.numBytesUsed += size;\n this.numUsedBuffers++;\n\n if (this.freeBuffers.get(key).length > 0) {\n this.numFreeBuffers--;\n\n const newBuffer = this.freeBuffers.get(key).shift();\n this.usedBuffers.get(key).push(newBuffer);\n return newBuffer;\n }\n\n this.numBytesAllocated += size;\n const newBuffer = this.device.createBuffer({size, usage, mappedAtCreation});\n this.usedBuffers.get(key).push(newBuffer);\n\n return newBuffer;\n }\n\n releaseBuffer(buffer: GPUBuffer, size: number, usage: GPUBufferUsageFlags) {\n if (this.freeBuffers.size === 0) {\n return;\n }\n\n const key = getBufferKey(size, usage);\n if (!this.freeBuffers.has(key)) {\n this.freeBuffers.set(key, []);\n }\n\n this.freeBuffers.get(key).push(buffer);\n this.numFreeBuffers++;\n this.numUsedBuffers--;\n\n const bufferList = this.usedBuffers.get(key);\n const bufferIndex = bufferList.indexOf(buffer);\n if (bufferIndex < 0) {\n throw new Error(\n 'Cannot release a buffer that was never provided by this ' +\n 'buffer manager');\n }\n bufferList.splice(bufferIndex, 1);\n this.numBytesUsed -= size;\n }\n\n releaseUploadBuffer(\n buffer: GPUBuffer, size: number, usage: GPUBufferUsageFlags) {\n buffer.mapAsync(GPUMapMode.WRITE)\n .then(\n () => {\n this.releaseBuffer(buffer, size, usage);\n },\n (err) => {\n // Do nothing;\n });\n }\n\n getNumUsedBuffers(): number {\n return this.numUsedBuffers;\n }\n\n getNumFreeBuffers(): number {\n return this.numFreeBuffers;\n }\n\n dispose() {\n this.freeBuffers.forEach((buffers, key) => {\n buffers.forEach(buffer => {\n buffer.destroy();\n });\n });\n\n this.usedBuffers.forEach((buffers, key) => {\n buffers.forEach(buffer => {\n buffer.destroy();\n });\n });\n\n this.freeBuffers = new Map();\n this.usedBuffers = new Map();\n this.numUsedBuffers = 0;\n this.numFreeBuffers = 0;\n this.numBytesUsed = 0;\n this.numBytesAllocated = 0;\n }\n}\n\nfunction getBufferKey(size: number, usage: GPUBufferUsageFlags) {\n return `${size}_${usage}`;\n}\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nexport class TextureManager {\n private numUsedTextures = 0;\n private numFreeTextures = 0;\n private freeTextures: Map = new Map();\n private usedTextures: Map = new Map();\n\n public numBytesUsed = 0;\n public numBytesAllocated = 0;\n\n constructor(private device: GPUDevice) {}\n\n acquireTexture(\n width: number, height: number, format: GPUTextureFormat,\n usage: GPUTextureUsageFlags) {\n const bytesPerElement = getBytesPerElement(format);\n const byteSize = width * height * bytesPerElement;\n const key = getTextureKey(width, height, format, usage);\n if (!this.freeTextures.has(key)) {\n this.freeTextures.set(key, []);\n }\n\n if (!this.usedTextures.has(key)) {\n this.usedTextures.set(key, []);\n }\n\n this.numBytesUsed += byteSize;\n this.numUsedTextures++;\n\n if (this.freeTextures.get(key).length > 0) {\n this.numFreeTextures--;\n\n const newTexture = this.freeTextures.get(key).shift();\n this.usedTextures.get(key).push(newTexture);\n return newTexture;\n }\n\n this.numBytesAllocated += byteSize;\n\n const newTexture = this.device.createTexture({\n size: [width, height],\n format,\n usage,\n });\n this.usedTextures.get(key).push(newTexture);\n\n return newTexture;\n }\n\n releaseTexture(\n texture: GPUTexture, width: number, height: number,\n format: GPUTextureFormat, usage: GPUTextureUsageFlags) {\n if (this.freeTextures.size === 0) {\n return;\n }\n\n const key = getTextureKey(width, height, format, usage);\n if (!this.freeTextures.has(key)) {\n this.freeTextures.set(key, []);\n }\n\n this.freeTextures.get(key).push(texture);\n this.numFreeTextures++;\n this.numUsedTextures--;\n\n const textureList = this.usedTextures.get(key);\n const textureIndex = textureList.indexOf(texture);\n if (textureIndex < 0) {\n throw new Error(\n 'Cannot release a texture that was never provided by this ' +\n 'texture manager');\n }\n textureList.splice(textureIndex, 1);\n const bytesPerElement = getBytesPerElement(format);\n const byteSize = width * height * bytesPerElement;\n this.numBytesUsed -= byteSize;\n }\n\n getNumUsedTextures(): number {\n return this.numUsedTextures;\n }\n\n getNumFreeTextures(): number {\n return this.numFreeTextures;\n }\n\n dispose() {\n this.freeTextures.forEach((textures, key) => {\n textures.forEach(texture => {\n texture.destroy();\n });\n });\n\n this.usedTextures.forEach((textures, key) => {\n textures.forEach(texture => {\n texture.destroy();\n });\n });\n\n this.freeTextures = new Map();\n this.usedTextures = new Map();\n this.numUsedTextures = 0;\n this.numFreeTextures = 0;\n this.numBytesUsed = 0;\n this.numBytesAllocated = 0;\n }\n}\n\nfunction getTextureKey(\n width: number, height: number, format: GPUTextureFormat,\n usage: GPUTextureUsageFlags) {\n return `${width}_${height}_${format}_${usage}`;\n}\n\nfunction getBytesPerElement(format: GPUTextureFormat) {\n if (format === 'rgba8unorm') {\n return 16;\n } else {\n throw new Error(`${format} is not supported!`);\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// Generates GLSL that computes strides.\nexport function symbolicallyComputeStrides(\n indicesArr: number[], variableName: string): string[] {\n if (Math.max(...indicesArr) > 3) {\n throw new Error('Cannot symbolically compute strides for rank > 4 tensor.');\n }\n\n const numCoords = indicesArr.length;\n const shape = indicesArr.map(d => `${variableName}[${d}]`);\n const strides = new Array(numCoords - 1);\n strides[numCoords - 2] = shape[numCoords - 1];\n for (let i = numCoords - 3; i >= 0; --i) {\n strides[i] = `(${strides[i + 1]} * ${shape[i + 1]})`;\n }\n\n return strides;\n}\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, DataType, Rank, ShapeMap, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {symbolicallyComputeStrides} from './shader_util';\n\nexport interface WebGPUProgram {\n // Whether to use atomic built-in functions.\n atomic?: boolean;\n // dispatch specifies geometry of thread groups - derived from dispatchLayout.\n dispatch: [number, number, number];\n // dispatchLayout enumerates how tensor dimensions are distributed among\n // dispatch x,y,z dimensions.\n dispatchLayout: {x: number[], y?: number[], z?: number[]};\n isFromPixels?: boolean;\n isVec4?: boolean;\n outputShape: number[];\n // The unique key to distinguish different shader source code.\n shaderKey: string;\n // Whether to use output size for bounds checking.\n size?: boolean;\n uniforms?: string;\n variableNames: string[];\n // Describe each variable's type and must have one-one mapping with\n // variableNames. If not set, all variables type will be either f32 or\n // vec4 based on isVec4 member.\n variableTypes?: string[];\n // workGroupSize.x * workGroupSize.y * workGroupSize.z = the number of threads\n // in a thread group. Individual dimensions determines thread layout within\n // the group.\n workGroupSize: [number, number, number];\n // Size of register cache in one dimension (assumes square cache).\n // Each thread writes to workPerThread * workPerThread locations in the output\n // buffer.\n workPerThread?: number;\n getUserCode: () => string;\n}\n\nexport const compileProgram =\n (device: GPUDevice, program: WebGPUProgram, inputsData: InputInfo[],\n output: TensorInfo): GPUComputePipeline => {\n const outputData = {dtype: output.dtype, shape: output.shape};\n const source = makeShader(inputsData, outputData, program);\n const module = device.createShaderModule(\n {code: source, label: program.constructor.name});\n const pipeline = device.createComputePipeline({\n compute: {module, entryPoint: '_start'},\n label: program.constructor.name,\n layout: 'auto'\n });\n\n return pipeline;\n };\n\nexport function getCoordsDataType(rank: number): string {\n if (rank <= 1) {\n return 'i32';\n } else if (rank === 2) {\n return `vec2`;\n } else if (rank === 3) {\n return `vec3`;\n } else if (rank === 4) {\n return `vec4`;\n } else if (rank === 5) {\n return `vec5`;\n } else if (rank === 6) {\n return `vec6`;\n } else {\n throw Error(`GPU for rank ${rank} is not yet supported`);\n }\n}\n\nexport function getCoordsXYZ(index: number): string {\n if (index === 0) {\n return 'x';\n } else if (index === 1) {\n return 'y';\n } else if (index === 2) {\n return 'z';\n } else if (index === 3) {\n return 'w';\n } else if (index === 4) {\n return 'u';\n } else if (index === 5) {\n return 'v';\n } else {\n throw Error(`Index ${index} is not yet supported`);\n }\n}\n\nexport function getMainHeaderString(): string;\nexport function getMainHeaderString(index: string): string;\nexport function getMainHeaderString(...params: string[]): string {\n let snippet: string;\n switch (params.length) {\n case 0:\n snippet = `\n ${getWorkGroupSizeString()}\n fn _start(@builtin(local_invocation_id) LocalId : vec3,\n @builtin(global_invocation_id) GlobalId : vec3,\n @builtin(num_workgroups) NumWorkgroups : vec3) {\n localId = LocalId;\n globalId = GlobalId;\n numWorkgroups = NumWorkgroups;\n main();\n }\n\n fn main()\n `;\n break;\n case 1:\n snippet = `\n ${getWorkGroupSizeString()}\n fn _start(@builtin(local_invocation_id) LocalId : vec3,\n @builtin(global_invocation_id) GlobalId : vec3,\n @builtin(num_workgroups) NumWorkgroups : vec3) {\n localId = LocalId;\n globalId = GlobalId;\n numWorkgroups = NumWorkgroups;\n main(getGlobalIndex());\n }\n\n fn main(${params[0]} : i32)\n `;\n break;\n default:\n throw Error('Unreachable');\n }\n return snippet;\n}\n\nexport function getWorkGroupSizeString(): string {\n return `\n @compute @workgroup_size(workGroupSizeX, workGroupSizeY, workGroupSizeZ)\n`;\n}\n\nfunction makeShader(\n inputInfo: InputInfo[], outputData: {dtype: DataType, shape: number[]},\n program: WebGPUProgram): string {\n const prefixSnippets: string[] = [];\n prefixSnippets.push(`\n const workGroupSizeX = ${program.workGroupSize[0]}u;\n const workGroupSizeY = ${program.workGroupSize[1]}u;\n const workGroupSizeZ = ${program.workGroupSize[2]}u;\n\n var localId: vec3;\n var globalId: vec3;\n var numWorkgroups: vec3;\n\n // Only used when the y/z dimension of workgroup size is 1.\n fn getGlobalIndex() -> i32 {\n ${\n isFlatDispatch(program) ?\n ` return i32(globalId.x);` :\n ` let localInvocationIndex = localId.z * workGroupSizeX * workGroupSizeY +\n localId.y * workGroupSizeX + localId.x;\n let workGroupID = (globalId - localId)/vec3(\n workGroupSizeX, workGroupSizeY, workGroupSizeZ);\n\n return i32((workGroupID.z * numWorkgroups.x * numWorkgroups.y +\n workGroupID.y * numWorkgroups.x + workGroupID.x) *\n (workGroupSizeX * workGroupSizeY * workGroupSizeZ) +\n localInvocationIndex);\n `}\n }\n `);\n\n if (program.isFromPixels) {\n prefixSnippets.push(`\n struct Uniform {\n size : i32,\n numChannels : i32,\n outShapeStrides : vec2,\n };\n\n @group(0) @binding(0) var result: array<${\n mapToWgslTypes(outputData.dtype, program.isVec4)}>;\n @group(0) @binding(2) var uniforms: Uniform;\n `);\n return [\n commonSnippet,\n prefixSnippets.join('\\n'),\n getCoordsFromIndexSnippet(outputData.shape),\n program.getUserCode(),\n ].join('\\n');\n }\n\n let uniformDeclaration = 'struct Uniforms { NAN : f32, ';\n program.variableNames.forEach((x, i) => {\n const perDataType = getCoordsDataType(inputInfo[i].shape.length);\n uniformDeclaration +=\n `${x.charAt(0).toLowerCase() + x.slice(1)}Shape : ${perDataType}, `;\n });\n const outputDataType = getCoordsDataType(outputData.shape.length);\n uniformDeclaration += `outShape : ${outputDataType}, `;\n const stridesLength = outputData.shape.length - 1;\n const stridesDataType = getCoordsDataType(stridesLength);\n uniformDeclaration += `\n outShapeStrides: ${stridesDataType}, `;\n\n if (program.size) {\n uniformDeclaration += 'size : i32, ';\n }\n\n if (program.uniforms) {\n uniformDeclaration += program.uniforms;\n }\n uniformDeclaration += '};';\n uniformDeclaration = insertAlignment(uniformDeclaration);\n\n prefixSnippets.push(uniformDeclaration);\n\n // Output buffer.\n if (program.atomic) {\n prefixSnippets.push(`\n @group(0) @binding(0) var result: array>;\n `);\n } else {\n prefixSnippets.push(`\n @group(0) @binding(0) var result: array<${\n mapToWgslTypes(outputData.dtype, program.isVec4)}>;\n `);\n }\n program.variableNames.forEach((x, i) => {\n prefixSnippets.push(`\n @group(0) @binding(${1 + i}) var ${x}: array<${\n program.variableTypes ?\n program.variableTypes[i] :\n mapToWgslTypes(inputInfo[i].dtype, program.isVec4)}>;\n `);\n });\n\n if (uniformDeclaration !== '') {\n prefixSnippets.push(`\n @group(0) @binding(${\n 1 + program.variableNames.length}) var uniforms: Uniforms;\n `);\n }\n\n const coordsSnippet =\n getOutputCoordsSnippet(outputData.shape, program.dispatchLayout);\n\n const sources = [\n commonSnippet, prefixSnippets.join('\\n'),\n getCoordsFromIndexSnippet(outputData.shape), coordsSnippet,\n getOutputIndexFromCoordsSnippet(outputData.shape.length)\n ];\n if (!program.atomic) {\n sources.push(\n setOutputSnippet(outputData.shape, outputData.dtype, program.isVec4));\n }\n\n const inputSnippet =\n inputInfo\n .map(\n (x, i) => getInputSnippet(\n x, outputData.shape,\n program.variableTypes ?\n (program.variableTypes[i] === 'vec4') :\n program.isVec4,\n program.dispatchLayout.x.length === outputData.shape.length))\n .join('\\n');\n sources.push(inputSnippet);\n\n sources.push(program.getUserCode());\n const source = sources.join('\\n');\n return source;\n}\n\nexport function makeShaderKey(\n program: WebGPUProgram, shapes: Array, inputsData: InputInfo[],\n output: TensorInfo): string {\n let key = program.shaderKey;\n if (program.isFromPixels) {\n return key;\n }\n\n const types = inputsData.map(d => d.dtype).concat(output.dtype);\n const broadcastDims =\n inputsData.map(d => backend_util.getBroadcastDims(d.shape, output.shape));\n const inputShapesEqualsOutShape =\n inputsData.map(d => util.arraysEqual(d.shape, output.shape)).join('_');\n const broadcastDimsKey = broadcastDims.map(d => d.join('_')).join(';');\n\n const flatDispatchString = isFlatDispatch(program) ? 'flatDispatch' : '';\n\n key += '_' + (program.workGroupSize ? program.workGroupSize.join(',') : '') +\n shapes.map(shape => shape.length).join(',') + types.join(',') +\n program.variableNames.join(',') + broadcastDimsKey +\n inputShapesEqualsOutShape + flatDispatchString;\n\n return key;\n}\n\nconst commonSnippet = `\n struct vec5 {x: i32, y: i32, z: i32, w: i32, u: i32};\n struct vec6 {x: i32, y: i32, z: i32, w: i32, u: i32, v: i32};\n\n // Checks whether coordinates lie within the bounds of the shape.\n fn coordsInBounds2D(coord : vec2, shape : vec2) -> bool {\n return all(coord >= vec2(0)) && all(coord < shape);\n }\n fn coordsInBounds3D(coord : vec3, shape : vec3) -> bool {\n return all(coord >= vec3(0)) && all(coord < shape);\n }\n fn coordsInBounds4D(coord : vec4, shape : vec4) -> bool {\n return all(coord >= vec4(0)) && all(coord < shape);\n }\n\n fn getIndexFromCoords1D(coord : i32, shape : i32) -> i32 {\n return coord;\n }\n fn getIndexFromCoords2D(coords : vec2, shape : vec2) -> i32 {\n return dot(coords, vec2(shape.y, 1));\n }\n fn getIndexFromCoords3D(coords : vec3, shape : vec3) -> i32 {\n return dot(coords, vec3(shape.y * shape.z, shape.z, 1));\n }\n fn getIndexFromCoords4D(coords : vec4, shape : vec4) -> i32 {\n return dot(coords, vec4(\n shape.y * shape.z * shape.w, shape.z * shape.w, shape.w, 1));\n }\n fn getIndexFromCoords5D(coords : vec5, shape : vec5) -> i32 {\n let shapeStrides: vec5 = vec5(shape.y * shape.z * shape.w * shape.u, shape.z * shape.w * shape.u, shape.w * shape.u, shape.u, 1);\n return coords.x*shapeStrides.x + coords.y*shapeStrides.y + coords.z*shapeStrides.z + coords.w*shapeStrides.w + coords.u*shapeStrides.u;\n }\n fn getIndexFromCoords6D(coords : vec6, shape : vec6) -> i32 {\n let shapeStrides: vec6 = vec6(shape.y * shape.z * shape.w * shape.u * shape.v, shape.z * shape.w * shape.u * shape.v, shape.w * shape.u * shape.v, shape.u * shape.v, shape.v, 1);\n return coords.x*shapeStrides.x + coords.y*shapeStrides.y + coords.z*shapeStrides.z + coords.w*shapeStrides.w + coords.u*shapeStrides.u + coords.v*shapeStrides.v;\n }\n\n fn idiv(a: i32, b: i32, sign: f32) -> i32 {\n var res: i32 = a / b;\n let modulo: i32 = a % b;\n if (sign < 0. && modulo != 0) {\n res = res - 1;\n }\n return res;\n }\n\n // NaN defination in IEEE 754-1985 is :\n // - sign = either 0 or 1.\n // - biased exponent = all 1 bits.\n // - fraction = anything except all 0 bits (since all 0 bits represents infinity).\n // https://en.wikipedia.org/wiki/IEEE_754-1985#Representation_of_non-numbers\n fn isnan(val: f32) -> bool {\n let floatToUint: u32 = bitcast(val);\n return (floatToUint & 0x7fffffffu) > 0x7f800000u;\n }\n fn isnanVec4(val : vec4) -> vec4 {\n return vec4(isnan(val[0]), isnan(val[1]), isnan(val[2]), isnan(val[3]));\n }\n`;\n\ntype InputInfo = {\n dtype: DataType; shape: number[]; name: string;\n};\nexport type WGSLDataType = 'f32'|'i32'|'vec4'|'vec4'|'vec4';\n\n/**\n * Derives logical coordinates from a flat index. Performs integer division\n * with each stride and decrements the index until the index equals the final\n * dimension coordinate.\n */\nfunction getCoordsFromIndexSnippet(shape: number[]): string {\n const rank = shape.length;\n\n if (rank <= 1) {\n return `fn getCoordsFromIndex(index : i32) -> i32 { return index; }`;\n }\n\n const strides = util.computeStrides(shape);\n const dtype = getCoordsDataType(rank);\n\n const coords: string[] = [];\n for (let i = 0; i < rank; i++) {\n coords.push(`d${i}`);\n }\n\n if (strides.length === 1) {\n return ` fn getCoordsFromIndex(index : i32) -> vec2 {\n let d0 = index / uniforms.outShapeStrides; let d1 = index - d0 * uniforms.outShapeStrides;\n return vec2(d0, d1);\n }`;\n }\n let snippet;\n snippet = 'var index2 = index;' +\n strides\n .map((_, i) => {\n const line1 =\n `let ${coords[i]} = index2 / uniforms.outShapeStrides.${\n getCoordsXYZ(i)}`;\n const line2 = i === strides.length - 1 ?\n `let ${coords[i + 1]} = index2 - ${\n coords[i]} * uniforms.outShapeStrides.${getCoordsXYZ(i)}` :\n `index2 = index2 - ${coords[i]} * uniforms.outShapeStrides.${\n getCoordsXYZ(i)}`;\n return `${line1}; ${line2};`;\n })\n .join('');\n\n return `\n fn getCoordsFromIndex(index : i32) -> ${dtype} {\n ${snippet}\n return ${dtype}(${coords.join(',')});\n }\n `;\n}\n\nfunction getInputAtCoordsSnippet(\n inputInfo: InputInfo, isVec4: boolean): string {\n const texName = inputInfo.name;\n const rank = inputInfo.shape.length;\n const type = getCoordsDataType(rank);\n const funcName = 'get' + texName.charAt(0).toUpperCase() + texName.slice(1);\n const dims = ['d0', 'd1', 'd2', 'd3', 'd4', 'd5'].slice(0, rank);\n const inputs = dims.map(d => `${d} : i32`).join(', ');\n\n if (rank < 1) {\n if (isVec4) {\n return `\n fn ${funcName}() -> vec4 {\n return vec4(${texName}[0]);\n }\n `;\n }\n\n return `\n fn ${funcName}() ->f32 {\n return f32(${texName}[0]);\n }\n `;\n }\n\n const shapeStr =\n `uniforms.${texName.charAt(0).toLowerCase() + texName.slice(1)}Shape`;\n let rankStr = `${rank}D`;\n if (rank === 0) {\n rankStr = '1D';\n }\n\n if (isVec4) {\n return `\n fn ${funcName}(${inputs}) -> vec4 {\n return vec4(${texName}[getIndexFromCoords${rankStr}(${type}(${\n dims.join(',')}),\n ${shapeStr}) / 4]);\n }\n `;\n }\n\n return `\n fn ${funcName}(${inputs}) -> f32 {\n return f32(${texName}[getIndexFromCoords${rankStr}(${type}(${\n dims.join(',')}),\n ${shapeStr})]);\n }\n `;\n}\n\nfunction getInputByOutputSnippet(\n inputInfo: InputInfo, outShape: number[], isVec4: boolean,\n isFlatDispatchLayout: boolean): string {\n const texName = inputInfo.name;\n const texFuncSnippet = texName.charAt(0).toUpperCase() + texName.slice(1);\n\n const funcName = 'get' + texFuncSnippet + 'ByOutput';\n\n const inRank = inputInfo.shape.length;\n const outRank = outShape.length;\n const type = getCoordsDataType(outRank);\n\n // If the inShape equals the outShape and the dispatch layout is flat, we can\n // directly use |gl_GlobalInvocationID.x| as the index and don't need coords\n // conversion between these two shapes.\n if (util.arraysEqual(inputInfo.shape, outShape) && isFlatDispatchLayout) {\n if (isVec4) {\n return `\n fn ${funcName}Index(globalIndex : i32) -> vec4 {\n return vec4(${texName}[globalIndex]);\n }\n\n fn ${funcName}Coords(coords : ${type}) -> vec4 {\n return vec4(${texName}[${\n outRank > 1 ? 'getOutputIndexFromCoords(coords)' : 'coords'} / 4]);\n }\n `;\n } else {\n return `\n fn ${funcName}Index(globalIndex : i32) -> f32 {\n return f32(${texName}[globalIndex]);\n }\n\n fn ${funcName}Coords(coords : ${type}) -> f32 {\n return f32(${texName}[${\n outRank > 1 ? 'getOutputIndexFromCoords(coords)' : 'coords'}]);\n }\n `;\n }\n }\n\n const broadcastDims =\n backend_util.getBroadcastDims(inputInfo.shape, outShape);\n const rankDiff = outRank - inRank;\n\n let coordsSnippet = '';\n\n if (inRank === 0) {\n if (isVec4) {\n return `\n fn ${funcName}Index(globalIndex : i32) -> vec4 {\n return get${texFuncSnippet}();\n }\n\n fn ${funcName}Coords(coords : ${type}) -> vec4 {\n return get${texFuncSnippet}();\n }\n `;\n }\n return `\n fn ${funcName}Index(globalIndex : i32) -> f32{\n return get${texFuncSnippet}();\n }\n\n fn ${funcName}Coords(coords : ${type}) -> f32{\n return get${texFuncSnippet}();\n }\n `;\n } else {\n if (outRank < 2 && broadcastDims.length >= 1) {\n coordsSnippet = 'coords = 0;';\n } else {\n coordsSnippet =\n broadcastDims.map(d => `coords.${getCoordsXYZ(d + rankDiff)} = 0;`)\n .join('\\n');\n }\n }\n\n let unpackedCoordsSnippet = '';\n if (outRank < 2 && inRank > 0) {\n unpackedCoordsSnippet = 'coords';\n } else {\n if (outRank > 1) {\n const coordsType = getCoordsDataType(inRank);\n const coordsValues =\n inputInfo.shape.map((s, i) => `coords.${getCoordsXYZ(i + rankDiff)}`)\n .join(', ');\n unpackedCoordsSnippet = `${coordsType}(${coordsValues})`;\n } else {\n unpackedCoordsSnippet = 'coords';\n }\n }\n\n const shapeStr =\n `uniforms.${texName.charAt(0).toLowerCase() + texName.slice(1)}Shape`;\n const rankStr = `${inRank}D`;\n if (isVec4) {\n return `\n fn ${funcName}Index(globalIndex : i32) -> vec4 {\n var coords = getCoordsFromIndex(globalIndex);\n ${coordsSnippet}\n return ${texName}[getIndexFromCoords${rankStr}(${\n unpackedCoordsSnippet}, ${shapeStr}) / 4];\n }\n\n fn ${funcName}Coords(coordsIn : ${type}) -> vec4 {\n var coords = coordsIn;\n ${coordsSnippet}\n return ${texName}[getIndexFromCoords${rankStr}(${\n unpackedCoordsSnippet}, ${shapeStr}) / 4];\n }\n `;\n }\n\n return `\n fn ${funcName}Index(globalIndex : i32) -> f32 {\n var coords = getCoordsFromIndex(globalIndex);\n ${coordsSnippet}\n return f32(${texName}[getIndexFromCoords${rankStr}(${\n unpackedCoordsSnippet}, ${shapeStr})]);\n }\n\n fn ${funcName}Coords(coordsIn : ${type}) -> f32 {\n var coords = coordsIn;\n ${coordsSnippet}\n return f32(${texName}[getIndexFromCoords${rankStr}(${\n unpackedCoordsSnippet}, ${shapeStr})]);\n }\n`;\n}\n\nfunction getInputSnippet(\n inputInfo: InputInfo, outShape: number[], isVec4: boolean,\n isFlatDispatchLayout: boolean): string {\n let res = getInputAtCoordsSnippet(inputInfo, isVec4);\n\n const inShape = inputInfo.shape;\n if (inShape.length <= outShape.length) {\n res += getInputByOutputSnippet(\n inputInfo, outShape, isVec4, isFlatDispatchLayout);\n }\n\n return res;\n}\n\n/**\n * Generates getOutputCoords() function that computes output coordinates from\n * dispatch geometry to reduce arithmetic.\n */\nfunction getOutputCoordsSnippet(\n outShape: number[],\n dispatchLayout: {x: number[], y?: number[], z?: number[]}): string {\n const {x, y = [], z = []} = dispatchLayout;\n\n const outRank = outShape.length;\n const rank = x.length + y.length + z.length;\n // getOutputCoords is only meaningful when the output rank is same with\n // dispatch layout rank.\n if (rank !== outRank) {\n return '';\n }\n\n if (x.length === outRank) {\n const dtype = getCoordsDataType(outRank);\n const snippet = `fn getOutputCoords() -> ${dtype}{\n let globalIndex = getGlobalIndex();\n return getCoordsFromIndex(globalIndex);\n }\n `;\n return snippet;\n }\n\n let gatherDimensionsStr = '';\n const dims = [x, y, z];\n\n for (let i = 0; i < dims.length; i++) {\n const arr = dims[i];\n\n if (arr.length === 0) {\n continue;\n }\n\n if (arr.length === 1) {\n gatherDimensionsStr += `let d${arr[0]} = i32(globalId[${i}]);`;\n } else {\n const strides = symbolicallyComputeStrides(arr, 'uniforms.outShape');\n gatherDimensionsStr += `var index${i} = i32(globalId[${i}]);`;\n for (let j = 0; j < strides.length; j++) {\n gatherDimensionsStr += `let d${arr[j]} = index${i} / ${strides[j]};`;\n\n if (j === strides.length - 1) {\n gatherDimensionsStr += `let d${arr[j + 1]} = ` +\n `index${i} - d${arr[j]} * ${strides[j]};`;\n } else {\n gatherDimensionsStr +=\n `index${i} = index${i} - d${arr[j]} * ${strides[j]};`;\n }\n }\n }\n }\n\n const dimensions = [];\n for (let i = 0; i < rank; i++) {\n dimensions.push(`d${i}`);\n }\n\n const dtype = getCoordsDataType(rank);\n let snippet = `fn getOutputCoords() -> ${dtype} {\n ${gatherDimensionsStr}\n`;\n if (dimensions.length === 0) {\n snippet += `return ${dtype}(0); }`;\n } else {\n snippet += `return ${dtype}(${dimensions.join(',')}); }`;\n }\n\n return snippet;\n}\n\nfunction getOutputIndexFromCoordsSnippet(outRank: number) {\n let snippet = '';\n switch (outRank) {\n case 0:\n case 1:\n snippet += `\n fn getOutputIndexFromCoords(coords : i32) -> i32 {\n return coords;\n }\n `;\n break;\n case 2:\n snippet += `\n fn getOutputIndexFromCoords(coords : vec2) -> i32 {\n return dot(coords, vec2(uniforms.outShapeStrides, 1));\n }\n `;\n break;\n case 3:\n snippet += `\n fn getOutputIndexFromCoords(coords : vec3) -> i32 {\n return dot(coords, vec3(uniforms.outShapeStrides.x, uniforms.outShapeStrides.y, 1));\n }\n `;\n break;\n case 4:\n snippet += `\n fn getOutputIndexFromCoords(coords : vec4) -> i32 {\n return dot(coords, vec4(\n uniforms.outShapeStrides.x, uniforms.outShapeStrides.y, uniforms.outShapeStrides.z, 1));\n }\n `;\n break;\n case 5:\n snippet += `\n fn getOutputIndexFromCoords(coords : vec5) -> i32 {\n return coords.x * uniforms.outShapeStrides.x +\n coords.y * uniforms.outShapeStrides.y +\n coords.z * uniforms.outShapeStrides.z +\n coords.w * uniforms.outShapeStrides.w +\n coords.u;\n }\n `;\n break;\n case 6:\n snippet += `\n fn getOutputIndexFromCoords(coords : vec6) -> i32 {\n return coords.x * uniforms.outShapeStrides.x +\n coords.y * uniforms.outShapeStrides.y +\n coords.z * uniforms.outShapeStrides.z +\n coords.w * uniforms.outShapeStrides.w +\n coords.u * uniforms.outShapeStrides.u +\n coords.v;\n }\n `;\n break;\n default:\n util.assert(false, () => `Unsupported ${outRank}D shape`);\n break;\n }\n return snippet;\n}\n\nfunction isFlatDispatch(program: WebGPUProgram): boolean {\n return program.dispatch[1] === 1 && program.dispatch[2] === 1;\n}\n\nexport function mapToWgslTypes(type: DataType, isVec4: boolean): WGSLDataType|\n DataType {\n if (type === 'float32') {\n return isVec4 ? 'vec4' : 'f32';\n } else if (type === 'int32') {\n return isVec4 ? 'vec4' : 'i32';\n } else if (type === 'bool') {\n // Type 'bool' cannot be used in storage class,\n // https://www.w3.org/TR/WGSL/#host-shareable-types.\n return isVec4 ? 'vec4' : 'i32';\n }\n\n return type;\n}\n\nfunction setOutputSnippet(\n outShape: number[], outBufferType: DataType, isVec4: boolean): string {\n const outRank = outShape.length;\n const wgslType = mapToWgslTypes(outBufferType, isVec4);\n let snippet;\n if (isVec4) {\n snippet = `fn setOutputAtIndex(flatIndex : i32, value : vec4) {\n result[flatIndex] = ${wgslType}(value);\n }\n fn setOutputAtIndexI32(flatIndex : i32, value : vec4) {\n result[flatIndex] = ${wgslType}(value);\n }`;\n } else {\n snippet = `fn setOutputAtIndex(flatIndex : i32, value : f32) {\n result[flatIndex] = ${wgslType}(value);\n }\n fn setOutputAtIndexI32(flatIndex : i32, value : i32) {\n result[flatIndex] = ${wgslType}(value);\n }`;\n }\n if (outRank >= 2) {\n const dims = ['d0', 'd1', 'd2', 'd3', 'd4', 'd5'].slice(0, outRank);\n const type = getCoordsDataType(outRank);\n\n if (isVec4) {\n snippet += `\n fn setOutputAtCoords(${\n dims.map(d => `${d} : i32`).join(', ')}, value : vec4) {\n let flatIndex = getOutputIndexFromCoords(${type}(${dims.join(', ')}));\n setOutputAtIndex(flatIndex / 4, value);\n }\n fn setOutputAtCoordsI32(${\n dims.map(d => `${d} : i32`).join(', ')}, value : vec4) {\n let flatIndex = getOutputIndexFromCoords(${type}(${dims.join(', ')}));\n setOutputAtIndexI32(flatIndex / 4, value);\n }\n `;\n } else {\n snippet += `\n fn setOutputAtCoords(${\n dims.map(d => `${d} : i32`).join(', ')}, value : f32) {\n let flatIndex = getOutputIndexFromCoords(${type}(${dims.join(', ')}));\n setOutputAtIndex(flatIndex, value);\n }\n fn setOutputAtCoordsI32(${\n dims.map(d => `${d} : i32`).join(', ')}, value : i32) {\n let flatIndex = getOutputIndexFromCoords(${type}(${dims.join(', ')}));\n setOutputAtIndexI32(flatIndex, value);\n }\n `;\n }\n }\n\n return snippet;\n}\n\nfunction insertAlignment(uniformShader: string) {\n // insert alignment when current pattern is vec5 or vec6\n const curInsertRe = /(\\w+)\\s*:\\s*vec(5|6)/g;\n uniformShader = uniformShader.replace(curInsertRe, (match) => {\n return '@align(16) ' + match;\n });\n\n // insert alignment when previous pattern is vec5 or vec6\n const preInsertRe = /vec(5|6)\\s*,\\s*(\\w+)/g;\n uniformShader = uniformShader.replace(preInsertRe, (_, p1, p2) => {\n return `vec${p1}, @align(16) ${p2}`;\n });\n return uniformShader;\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {DataType} from '@tensorflow/tfjs-core';\n\nconst arrayProduct = (arr: number[]) => {\n let product = 1;\n for (let i = 0; i < arr.length; i++) {\n product *= arr[i];\n }\n return product;\n};\n\nexport function tilesFitEvenlyIntoShape(\n tileSize: number[], shape: number[]): boolean {\n if (tileSize.length !== shape.length) {\n throw new Error(\n `Cannot compute whether rank ${tileSize.length}` +\n ` tiles fit evenly into rank ${shape.length} shape` +\n ` - ranks must match.`);\n }\n return shape.every(\n (dim: number, dimIdx: number) => dim % tileSize[dimIdx] === 0);\n}\n\n// Computes dispatch geometry based on layout of output dimensions and\n// workGroupSize.\nexport function computeDispatch(\n layout: {x: number[], y?: number[], z?: number[]}, outputShape: number[],\n workGroupSize: [number, number, number] = [1, 1, 1],\n elementsPerThread: [number, number, number] =\n [1, 1, 1]): [number, number, number] {\n const [dispatchX, dispatchY, dispatchZ] = [\n Math.ceil(\n arrayProduct(layout.x.map(d => outputShape[d])) /\n (workGroupSize[0] * elementsPerThread[0])),\n layout.y ? Math.ceil(\n arrayProduct(layout.y.map(d => outputShape[d])) /\n (workGroupSize[1] * elementsPerThread[1])) :\n 1,\n layout.z ? Math.ceil(\n arrayProduct(layout.z.map(d => outputShape[d])) /\n (workGroupSize[2] * elementsPerThread[2])) :\n 1\n ];\n return [dispatchX, dispatchY, dispatchZ];\n}\n\nexport type WorkGroupInfo = {\n workGroupSize: [number, number, number],\n elementsPerThread: [number, number, number],\n};\n\nexport function computeWorkGroupInfoForMatMul(\n dimAOuter: number, dimInner: number, dimBOuter: number,\n transposeA = false): WorkGroupInfo {\n // These are experimental values. Usually, we need to adjust the work group\n // size based on the input shapes to improve the EU occupancy.\n // TODO: WebGPU limits the maximum allowed shared memory size as 16K. To make\n // sure it doesn't exceed this limitations. Temporarily reduce the work group\n // size to [8, 8, 1] and the work per thread size is [4, 4, 1]. But we should\n // revisit it and find the balance between work group size and work per thread\n // size.\n const workGroupSize: [number, number, number] = [8, 8, 1];\n const elementsPerThread: [number, number, number] = [4, 4, 1];\n\n if (!transposeA) {\n if (dimAOuter <= 8) {\n elementsPerThread[1] = 1;\n }\n\n if (dimInner <= 16 && dimBOuter <= 16) {\n workGroupSize[0] = 4;\n }\n }\n\n return {workGroupSize, elementsPerThread};\n}\n\nexport function computeWorkGroupSizeForConv2d(\n layout: {x: number[], y?: number[], z?: number[]}, outputShape: number[],\n isVec4 = false): [number, number, number] {\n if (isVec4) {\n return [8, 8, 1];\n }\n\n const dim0 = arrayProduct(layout.x.map(d => outputShape[d]));\n const dim1 = arrayProduct(layout.y.map(d => outputShape[d]));\n // TODO(jiajia.qin@intel.com): More fine tune based on outputShape.\n // These are experimental values. Usually, we need to adjust the work group\n // size based on the output shape. For example, when one dimension is smaller\n // than 4, it will be wasteful if we assign a larger size for this dimension,\n // which results lots of threads doing useless work and reduces parallelism\n // of hardware threads. But it is always a balance between work group size\n // and shared memory. If one dimension is too small, such as 1, shared memory\n // will won't be fully utilized.\n if (dim0 <= 4) {\n return [4, 16, 1];\n }\n if (dim1 <= 4) {\n return [16, 4, 1];\n }\n\n return [16, 16, 1];\n}\n\nexport function computeWorkPerThreadForConv2d(\n layout: {x: number[], y?: number[], z?: number[]}, outputShape: number[],\n isVec4 = false): [number, number, number] {\n if (isVec4) {\n return [4, 4, 1];\n }\n\n const dim0 = arrayProduct(layout.x.map(d => outputShape[d]));\n const dim1 = arrayProduct(layout.y.map(d => outputShape[d]));\n // TODO(jiajia.qin@intel.com): More fine tune based on outputShape.\n // The following conditions correspond to the values set in\n // computeWorkGroupSizeForConv2d.\n if (dim0 <= 4) {\n return [1, 2, 1];\n }\n if (dim1 <= 4) {\n return [2, 1, 1];\n }\n\n return [2, 2, 1];\n}\n\nexport function flatDispatchLayout(shape: number[]) {\n return {x: shape.map((d, i) => i)};\n}\n\nexport function GPUBytesPerElement(dtype: DataType): number {\n if (dtype === 'float32' || dtype === 'int32' || dtype === 'bool' ||\n dtype === 'string') {\n return 4;\n } else if (dtype === 'complex64') {\n return 8;\n } else {\n throw new Error(`Unknown dtype ${dtype}`);\n }\n}\n\nexport function ArrayBufferToTypedArray(data: ArrayBuffer, dtype: DataType) {\n if (dtype === 'float32') {\n return new Float32Array(data);\n } else if (dtype === 'int32') {\n return new Int32Array(data);\n } else if (dtype === 'bool' || dtype === 'string') {\n return Uint8Array.from(new Int32Array(data));\n } else {\n throw new Error(`Unknown dtype ${dtype}`);\n }\n}\n\nexport function isWebGPUSupported(): boolean {\n return ((typeof window !== 'undefined') ||\n //@ts-ignore\n (typeof WorkerGlobalScope !== 'undefined')) &&\n !!navigator.gpu;\n}\n\nexport enum MatMulProgramType {\n MatMulReduceProgram,\n MatMulSplitKProgram,\n MatMulSmallOutputSizeProgram,\n MatMulPackedProgram,\n MatMulMax\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport './flags_webgpu';\n\nimport {backend_util, buffer, DataStorage, DataType, engine, env, GPUData, KernelBackend, Rank, RecursiveArray, ShapeMap, TensorBuffer, TensorInfo, TimingInfo, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {AdapterInfo, GPUAdapterInfo} from './adapter_info';\nimport {BufferManager} from './buffer_manager';\nimport {TextureManager} from './texture_manager';\nimport * as webgpu_program from './webgpu_program';\nimport * as webgpu_util from './webgpu_util';\n\nexport interface WebGPUMemoryInfo extends backend_util.MemoryInfo {\n numBytesInGPU: number;\n numBytesAllocatedInGPU: number;\n unreliable: boolean;\n}\n\nexport type BufferInfo = {\n size: number,\n usage: GPUBufferUsageFlags,\n buffer: GPUBuffer\n};\n\nexport type TextureInfo = {\n width: number,\n height: number,\n format: GPUTextureFormat,\n usage: GPUTextureUsageFlags,\n texture: GPUTexture|GPUExternalTexture\n};\n\ntype TensorData = {\n values: backend_util.BackendValues,\n dtype: DataType,\n shape: number[],\n refCount: number,\n resourceInfo?: BufferInfo|TextureInfo,\n // For complex numbers, the real and imaginary parts are stored as their own\n // individual tensors, with a parent joining the two with the\n // complexTensorInfos field.\n complexTensorInfos?: {real: TensorInfo, imag: TensorInfo}\n};\n\ninterface DataId {}\n\nexport type WebGPUKernelInfo = {\n name: string; query: Promise;\n};\n\nexport type TimerNode = RecursiveArray|WebGPUKernelInfo;\n\nexport interface WebGPUTimingInfo extends TimingInfo {\n uploadWaitMs: number;\n downloadWaitMs: number;\n}\n\ntype ProgramUniform = Array<{type: string; data: number[]}>;\n\n// Empirically determined constant used to determine size threshold for handing\n// off execution to the CPU.\nconst CPU_HANDOFF_SIZE_THRESHOLD =\n env().getNumber('WEBGPU_CPU_HANDOFF_SIZE_THRESHOLD');\n\n// Reshape dispatch, not to exceed device limits.\nconst reshapeDispatch =\n (device: GPUDevice,\n program: webgpu_program.WebGPUProgram): [number, number, number] => {\n const MAX_COMPUTE_PER_DIMENSION_DISPATCH_SIZE =\n device.limits.maxComputeWorkgroupsPerDimension;\n const layout = program['dispatchLayout'];\n const dispatch = program['dispatch'];\n if (dispatch.every((d) => d <= MAX_COMPUTE_PER_DIMENSION_DISPATCH_SIZE)) {\n return dispatch;\n }\n\n util.assert(\n dispatch[0] > MAX_COMPUTE_PER_DIMENSION_DISPATCH_SIZE &&\n layout.y === undefined && layout.z === undefined,\n () => 'Dispatch size exceeds WebGPU limits in Y or Z dimension.');\n\n let dispatchAverage = Math.ceil(Math.sqrt(dispatch[0]));\n if (dispatchAverage > MAX_COMPUTE_PER_DIMENSION_DISPATCH_SIZE) {\n dispatchAverage = Math.ceil(Math.cbrt(dispatch[0]));\n util.assert(\n dispatchAverage <= MAX_COMPUTE_PER_DIMENSION_DISPATCH_SIZE,\n () => 'Total dispatch size exceeds WebGPU maximum.');\n return [dispatchAverage, dispatchAverage, dispatchAverage];\n } else {\n return [dispatchAverage, dispatchAverage, 1];\n }\n };\n\nexport class WebGPUBackend extends KernelBackend {\n bufferManager: BufferManager;\n adapterInfo: AdapterInfo;\n device: GPUDevice;\n queue: GPUQueue;\n tensorMap: DataStorage;\n textureManager: TextureManager;\n\n private activeTimers: TimerNode[];\n private currentCommandEncoder: GPUCommandEncoder;\n private currentComputePass: GPUComputePassEncoder;\n private commandQueueOwnedIds = new WeakSet();\n private dispatchNumberInEncoder = 0;\n private disposed = false;\n private downloadWaitMs = 0;\n private dummyCanvas: HTMLCanvasElement;\n private dummyContext: GPUCanvasContext;\n private tensorDataPendingDisposal: DataId[] = [];\n private static nextDataId = 0;\n private pipelineCache: {[key: string]: GPUComputePipeline};\n private programTimersStack: TimerNode[];\n private querySet: GPUQuerySet;\n private stagingPendingDisposal: BufferInfo[] = [];\n private supportTimeQuery: boolean;\n private uniformPendingDisposal: BufferInfo[] = [];\n private uploadWaitMs = 0;\n\n private nextDataId(): number {\n return WebGPUBackend.nextDataId++;\n }\n\n constructor(device: GPUDevice, adapterInfo?: GPUAdapterInfo) {\n super();\n if (!webgpu_util.isWebGPUSupported()) {\n throw new Error('WebGPU is not supported on this device');\n }\n this.pipelineCache = {};\n this.device = device;\n this.queue = device.queue;\n this.currentCommandEncoder = null;\n this.currentComputePass = null;\n this.supportTimeQuery = device.features.has('timestamp-query');\n this.adapterInfo = new AdapterInfo(adapterInfo);\n\n this.bufferManager = new BufferManager(this.device);\n this.textureManager = new TextureManager(this.device);\n this.tensorMap = new DataStorage(this, engine());\n if (this.supportTimeQuery) {\n this.querySet = this.device.createQuerySet({\n type: 'timestamp',\n count: 2,\n });\n }\n\n // Profiling tools like PIX needs this dummy canvas to\n // trigger capturing a frame.\n if (env().getBool('WEBGPU_USE_PROFILE_TOOL')) {\n this.dummyCanvas = document.createElement('canvas');\n this.dummyCanvas.width = 1;\n this.dummyCanvas.height = 1;\n\n this.dummyContext = this.dummyCanvas.getContext('webgpu');\n this.dummyContext.configure({\n device,\n format: 'bgra8unorm',\n });\n\n document.body.appendChild(this.dummyCanvas);\n }\n }\n\n floatPrecision(): 32 {\n return 32;\n }\n\n defaultGpuBufferUsage(): number {\n return GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC |\n GPUBufferUsage.COPY_DST;\n }\n\n /**\n * Dispose the memory if the dataId has 0 refCount. Return true if the memory\n * is released or memory is not managed in this backend, false if memory is\n * not cleared.\n * @param dataId\n * @oaram force Optional, remove the data regardless of refCount\n */\n disposeData(dataId: DataId, force = false): boolean {\n if (this.tensorDataPendingDisposal.indexOf(dataId) >= 0) {\n return false;\n }\n if (!this.tensorMap.has(dataId)) {\n return true;\n }\n\n const tensorData = this.tensorMap.get(dataId);\n this.decRef(dataId);\n if (!force && tensorData.refCount > 0) {\n return false;\n }\n\n // complex is never in commandQueueOwnedIds\n if (this.commandQueueOwnedIds.has(dataId)) {\n this.tensorDataPendingDisposal.push(dataId);\n return false;\n }\n\n const {complexTensorInfos} = this.tensorMap.get(dataId);\n if (complexTensorInfos != null) {\n this.disposeData(complexTensorInfos.real.dataId, force);\n this.disposeData(complexTensorInfos.imag.dataId, force);\n }\n\n this.releaseResource(dataId);\n this.tensorMap.delete(dataId);\n\n return true;\n }\n\n memory(): WebGPUMemoryInfo {\n return {\n numBytesInGPU: this.bufferManager.numBytesUsed,\n numBytesAllocatedInGPU: this.bufferManager.numBytesAllocated,\n unreliable: false\n } as WebGPUMemoryInfo;\n }\n\n releaseResource(dataId: DataId) {\n const tensorData = this.tensorMap.get(dataId);\n if (!tensorData || !tensorData.resourceInfo) {\n return;\n }\n if ('texture' in tensorData.resourceInfo) {\n const textureInfo = tensorData.resourceInfo;\n if (textureInfo.texture instanceof GPUTexture) {\n this.textureManager.releaseTexture(\n textureInfo.texture, textureInfo.width, textureInfo.height,\n textureInfo.format, textureInfo.usage);\n }\n textureInfo.texture = null;\n } else {\n const bufferInfo = tensorData.resourceInfo;\n this.bufferManager.releaseBuffer(\n bufferInfo.buffer, bufferInfo.size, bufferInfo.usage);\n bufferInfo.buffer = null;\n }\n tensorData.resourceInfo = null;\n }\n\n /** Return refCount of a `TensorData`. */\n refCount(dataId: DataId): number {\n if (this.tensorMap.has(dataId)) {\n const tensorData = this.tensorMap.get(dataId);\n return tensorData.refCount;\n }\n return 0;\n }\n\n /** Increase refCount of a `TensorData`. */\n incRef(dataId: DataId): void {\n const tensorData = this.tensorMap.get(dataId);\n tensorData.refCount++;\n }\n\n /** Decrease refCount of a `TensorData`. */\n decRef(dataId: DataId): void {\n if (this.tensorMap.has(dataId)) {\n const tensorData = this.tensorMap.get(dataId);\n tensorData.refCount--;\n }\n }\n\n write(values: backend_util.BackendValues, shape: number[], dtype: DataType):\n DataId {\n if (dtype === 'complex64' && values != null) {\n throw new Error(\n `Cannot write to a complex64 dtype. ` +\n `Please use tf.complex(real, imag).`);\n }\n const dataId = {id: this.nextDataId()};\n this.tensorMap.set(dataId, {dtype, shape, values, refCount: 1});\n return dataId;\n }\n\n move(\n dataId: DataId, values: backend_util.BackendValues, shape: number[],\n dtype: DataType, refCount: number): void {\n if (dtype === 'complex64') {\n throw new Error(\n `Cannot write to a complex64 dtype. ` +\n `Please use tf.complex(real, imag).`);\n }\n this.tensorMap.set(dataId, {dtype, shape, values, refCount});\n }\n\n submitQueue() {\n this.ensureComputePassEnded();\n this.queue.submit([this.currentCommandEncoder.finish()]);\n this.currentCommandEncoder = null;\n this.dispatchNumberInEncoder = 0;\n\n this.commandQueueOwnedIds = new WeakSet();\n\n this.tensorDataPendingDisposal.forEach(d => {\n this.releaseResource(d);\n this.tensorMap.delete(d);\n });\n this.uniformPendingDisposal.forEach(\n d => this.bufferManager.releaseBuffer(d.buffer, d.size, d.usage));\n this.stagingPendingDisposal.forEach(\n d => this.bufferManager.releaseUploadBuffer(d.buffer, d.size, d.usage));\n\n this.tensorDataPendingDisposal = [];\n this.uniformPendingDisposal = [];\n this.stagingPendingDisposal = [];\n }\n\n ensureCommandEncoderReady() {\n if (!this.currentCommandEncoder) {\n this.currentCommandEncoder = this.device.createCommandEncoder();\n }\n }\n\n ensureComputePassEnded() {\n if (this.currentComputePass) {\n this.currentComputePass.end();\n this.currentComputePass = null;\n }\n }\n\n getComputePass() {\n if (!this.currentComputePass) {\n this.currentComputePass = this.currentCommandEncoder.beginComputePass();\n }\n return this.currentComputePass;\n }\n\n public async getBufferData(buffer: GPUBuffer, size: number):\n Promise {\n const staging = this.bufferManager.acquireBuffer(\n size, GPUBufferUsage.COPY_DST | GPUBufferUsage.MAP_READ);\n this.ensureCommandEncoderReady();\n this.ensureComputePassEnded();\n this.currentCommandEncoder.copyBufferToBuffer(buffer, 0, staging, 0, size);\n this.submitQueue();\n\n await staging.mapAsync(GPUMapMode.READ);\n const values = staging.getMappedRange().slice(0);\n\n staging.unmap();\n if (staging != null) {\n this.bufferManager.releaseBuffer(\n staging, size, GPUBufferUsage.COPY_DST | GPUBufferUsage.MAP_READ);\n }\n\n // Need to get texture from swapChain to enable profiling tool\n // to capture a frame\n if (env().getBool('WEBGPU_USE_PROFILE_TOOL')) {\n util.assert(\n this.dummyContext !== undefined,\n () => `Fail to get context for profiling tool`);\n this.dummyContext.getCurrentTexture();\n }\n\n return values as backend_util.BackendValues;\n }\n\n private convertAndCacheOnCPU(dataId: DataId, data: backend_util.TypedArray):\n backend_util.TypedArray {\n const tensorData = this.tensorMap.get(dataId);\n this.releaseResource(dataId);\n tensorData.values = data;\n return tensorData.values;\n }\n\n // TODO: Remove once this is fixed:\n // https://github.com/tensorflow/tfjs/issues/1595\n readSync(dataId: object): backend_util.BackendValues {\n const tensorData = this.tensorMap.get(dataId);\n const {values} = tensorData;\n\n if (values == null) {\n throw new Error(\n 'WebGPU readSync is only available for CPU-resident tensors.');\n }\n\n return values;\n }\n\n async read(dataId: object): Promise {\n if (!this.tensorMap.has(dataId)) {\n throw new Error(`Tensor ${dataId} was not registered!`);\n }\n const tensorData = this.tensorMap.get(dataId);\n\n const {values} = tensorData;\n\n if (values != null) {\n // TODO(xing.xu@intel.com): Merge backend_util.BackendValues and\n // backend_util.TypedArray.\n return this.convertAndCacheOnCPU(\n dataId, values as backend_util.TypedArray) as\n backend_util.BackendValues;\n }\n\n // Download the values from the GPU.\n let vals: backend_util.BackendValues;\n if (tensorData.dtype === 'complex64') {\n const ps = await Promise.all([\n this.read(tensorData.complexTensorInfos.real.dataId),\n this.read(tensorData.complexTensorInfos.imag.dataId)\n ]);\n\n const realValues = ps[0];\n const imagValues = ps[1];\n vals = backend_util.mergeRealAndImagArrays(\n realValues as Float32Array, imagValues as Float32Array);\n } else {\n const bufferInfo = tensorData.resourceInfo as BufferInfo;\n const data = await this.getBufferData(bufferInfo.buffer, bufferInfo.size);\n vals = webgpu_util.ArrayBufferToTypedArray(\n data as ArrayBuffer, tensorData.dtype);\n }\n this.convertAndCacheOnCPU(dataId, vals);\n return vals;\n }\n\n /**\n * Read tensor to a new GPUBuffer.\n * @param dataId The source tensor.\n */\n readToGPU(dataId: DataId): GPUData {\n const srcTensorData = this.tensorMap.get(dataId);\n const {values, dtype, shape, resourceInfo} = srcTensorData;\n\n if (dtype === 'complex64') {\n throw new Error('Does not support reading buffer for complex64 dtype.');\n }\n\n if (resourceInfo == null) {\n if (values != null) {\n throw new Error('Data is not on GPU but on CPU.');\n } else {\n throw new Error('There is no data on GPU or CPU.');\n }\n }\n\n const size = (resourceInfo as BufferInfo).size;\n const buffer = this.bufferManager.acquireBuffer(size, resourceInfo.usage);\n this.ensureCommandEncoderReady();\n this.ensureComputePassEnded();\n this.currentCommandEncoder.copyBufferToBuffer(\n (resourceInfo as BufferInfo).buffer, 0, buffer, 0, size);\n this.submitQueue();\n\n const tensorInfo = this.makeTensorInfo(shape, dtype);\n // Make engine track this tensor, so that we can dispose it later.\n const tensorRef = engine().makeTensorFromTensorInfo(tensorInfo);\n\n const tensorData = this.tensorMap.get(tensorInfo.dataId);\n tensorData\n .resourceInfo = {size, usage: this.defaultGpuBufferUsage(), buffer};\n\n return {tensorRef, buffer, bufSize: size};\n }\n\n bufferSync(t: TensorInfo):\n TensorBuffer {\n const data = this.readSync(t.dataId);\n if (t.dtype === 'string') {\n try {\n // Decode the bytes into string.\n const strings = (data as Uint8Array[]).map(d => util.decodeString(d));\n return buffer(t.shape as ShapeMap[R], t.dtype, strings) as\n TensorBuffer;\n } catch {\n throw new Error('Failed to decode encoded string bytes into utf-8');\n }\n }\n return buffer(t.shape as ShapeMap[R], t.dtype, data as TypedArray) as\n TensorBuffer;\n }\n\n async time(f: () => void): Promise {\n if (!this.supportTimeQuery) {\n console.warn(\n `This device doesn't support timestamp-query extension. ` +\n `Start Chrome browser with flag ` +\n `--disable-dawn-features=disallow_unsafe_apis then try again. ` +\n `Otherwise, zero will be shown for the kernel time when profiling ` +\n `mode is enabled. Using performance.now is not workable for webgpu ` +\n `since it doesn't support synchronous data read from GPU.`);\n }\n const oldActiveTimers = this.activeTimers;\n const newActiveTimers: TimerNode[] = [];\n\n let outerMostTime = false;\n if (this.programTimersStack == null) {\n this.programTimersStack = newActiveTimers;\n outerMostTime = true;\n } else {\n this.activeTimers.push(newActiveTimers);\n }\n this.activeTimers = newActiveTimers;\n\n f();\n\n const flattenedActiveTimerQueries =\n util.flatten(this.activeTimers.map((d: WebGPUKernelInfo) => d.query))\n .filter(d => d != null);\n const flattenedActiveTimerNames =\n util.flatten(this.activeTimers.map((d: WebGPUKernelInfo) => d.name))\n .filter(d => d != null);\n\n this.activeTimers = oldActiveTimers;\n\n if (outerMostTime) {\n this.programTimersStack = null;\n }\n const res: WebGPUTimingInfo = {\n uploadWaitMs: this.uploadWaitMs,\n downloadWaitMs: this.downloadWaitMs,\n kernelMs: null,\n wallMs: null\n };\n\n const kernelMs = await Promise.all(flattenedActiveTimerQueries);\n res['kernelMs'] = util.sum(kernelMs);\n res['getExtraProfileInfo'] = () =>\n kernelMs.map((d, i) => ({name: flattenedActiveTimerNames[i], ms: d}))\n .map(d => `${d.name}: ${d.ms}`)\n .join(', ');\n this.uploadWaitMs = 0;\n this.downloadWaitMs = 0;\n return res;\n }\n\n makeTensorInfo(\n shape: number[], dtype: DataType,\n values?: backend_util.BackendValues|string[]): TensorInfo {\n if (dtype === 'string' && values != null && values.length > 0 &&\n util.isString(values[0])) {\n values = (values as {} as string[]).map(d => util.encodeString(d));\n }\n const dataId =\n this.write(values as backend_util.BackendValues, shape, dtype);\n return {dataId, shape, dtype};\n }\n\n private tensorToBinding(tensor?: TensorInfo): GPUBindingResource {\n if (!tensor) {\n return null;\n }\n\n const tensorData = this.tensorMap.get(tensor.dataId);\n if ('texture' in tensorData.resourceInfo) {\n const info = tensorData.resourceInfo;\n if (info.texture instanceof GPUExternalTexture) {\n return info.texture;\n } else {\n return info.texture.createView();\n }\n }\n const bufferInfo = tensorData.resourceInfo;\n return {offset: 0, size: bufferInfo.size, buffer: bufferInfo.buffer};\n }\n\n async getQueryTime(query: GPUQuerySet): Promise {\n if (this.supportTimeQuery) {\n return this.getTimeFromQuerySet(query);\n } else {\n return 0;\n }\n }\n\n uploadToGPU(dataId: DataId): void {\n const tensorData = this.tensorMap.get(dataId);\n // Already on the GPU.\n if (tensorData.resourceInfo) {\n return;\n }\n\n const size = webgpu_util.GPUBytesPerElement(tensorData.dtype) *\n util.sizeFromShape(tensorData.shape);\n const buffer =\n this.bufferManager.acquireBuffer(size, this.defaultGpuBufferUsage());\n\n tensorData\n .resourceInfo = {size, usage: this.defaultGpuBufferUsage(), buffer};\n if (tensorData.values) {\n const stagingBuffer = this.bufferManager.acquireUploadBuffer(\n size, GPUBufferUsage.MAP_WRITE | GPUBufferUsage.COPY_SRC);\n const arrayBuffer = stagingBuffer.getMappedRange();\n if (tensorData.dtype === 'int32' || tensorData.dtype === 'bool') {\n new Int32Array(arrayBuffer).set(tensorData.values as TypedArray);\n } else {\n new Float32Array(arrayBuffer).set(tensorData.values as Float32Array);\n }\n stagingBuffer.unmap();\n this.ensureCommandEncoderReady();\n this.ensureComputePassEnded();\n this.currentCommandEncoder.copyBufferToBuffer(\n stagingBuffer, 0, buffer, 0, size);\n\n const stagingInfo = {\n size,\n usage: GPUBufferUsage.MAP_WRITE | GPUBufferUsage.COPY_SRC,\n buffer: stagingBuffer\n };\n this.stagingPendingDisposal.push(stagingInfo);\n // TODO: WebGPU doesn't support read data synchronously from GPU to CPU.\n // So it will report error when switching backend from WebGPU to others.\n // There are two situations: 1) swithcing the backend after running a\n // model; 2) swithcing the backend within the model. Temporarilly keep the\n // values on CPU to solve the first issue.\n // tensorData.values = null;\n }\n }\n\n private makeUniforms(programUniform: ProgramUniform): GPUBindingResource {\n let currentOffset = 0;\n let preLength = 0;\n const offsets: number[] = [];\n programUniform.forEach((d) => {\n if (d.data.length === 0) {\n d.data = [1];\n }\n // https://www.w3.org/TR/WGSL/#alignof\n let baseAlignment: number;\n switch (d.data.length) {\n case 1:\n baseAlignment = 4;\n break;\n case 2:\n baseAlignment = 8;\n break;\n case 3:\n baseAlignment = 16;\n break;\n case 4:\n baseAlignment = 16;\n break;\n case 5:\n baseAlignment = 16;\n break;\n case 6:\n baseAlignment = 16;\n break;\n default:\n util.assert(false, () => `Unsupported ${d.data.length}D shape`);\n }\n\n if (preLength === 5 || preLength === 6) {\n baseAlignment = 16;\n }\n currentOffset = Math.ceil(currentOffset / baseAlignment) * baseAlignment;\n preLength = d.data.length;\n offsets.push(currentOffset);\n currentOffset += d.data.length * 4;\n });\n\n const arrayBuffer = new ArrayBuffer(currentOffset);\n programUniform.forEach((d, i) => {\n const offset = offsets[i];\n if (d.type === 'int32') {\n new Int32Array(arrayBuffer, offset, d.data.length).set(d.data);\n } else if (d.type === 'uint32') {\n new Uint32Array(arrayBuffer, offset, d.data.length).set(d.data);\n } else {\n new Float32Array(arrayBuffer, offset, d.data.length).set(d.data);\n }\n });\n\n const uniformBuffer = this.bufferManager.acquireBuffer(\n currentOffset, GPUBufferUsage.COPY_DST | GPUBufferUsage.UNIFORM);\n this.queue.writeBuffer(uniformBuffer, 0, arrayBuffer, 0, currentOffset);\n\n const uniformInfo = {\n size: currentOffset,\n usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.UNIFORM,\n buffer: uniformBuffer\n };\n this.uniformPendingDisposal.push(uniformInfo);\n\n return {offset: 0, size: currentOffset, buffer: uniformBuffer};\n }\n\n public runWebGPUProgram(\n program: webgpu_program.WebGPUProgram, inputs: TensorInfo[],\n outputDtype: DataType, programDefinedUniform?: ProgramUniform,\n output?: TensorInfo): TensorInfo {\n if (!output) {\n output = this.makeTensorInfo(program.outputShape, outputDtype);\n }\n if (util.sizeFromShape(output.shape) === 0) {\n // Short-circuit the computation since the result is empty (has 0 in its\n // shape).\n this.tensorMap.get(output.dataId).values =\n util.getTypedArrayFromDType(output.dtype as 'float32', 0);\n return output;\n }\n this.uploadToGPU(output.dataId);\n program.dispatch = reshapeDispatch(this.device, program);\n\n // There are five kinds of uniforms: NAN, shapes, shape strides, program\n // size, program defined uniforms.\n let programUniform: ProgramUniform = [];\n let bufferShapes: number[][] = [];\n if (!program.isFromPixels) {\n programUniform.push({type: 'float32', data: [NaN]});\n bufferShapes = inputs.concat(output).map(d => d.shape);\n const uniformsType = 'int32';\n bufferShapes.map(d => {\n programUniform.push({type: uniformsType, data: d});\n });\n const strides = util.computeStrides(output.shape);\n programUniform.push({type: uniformsType, data: strides});\n if (program.size) {\n const size = util.sizeFromShape(program.outputShape);\n programUniform.push(\n {type: uniformsType, data: [program.isVec4 ? size / 4 : size]});\n }\n }\n\n const inputsData = inputs.map((input: TensorInfo, i: number) => {\n if (input.dtype === 'complex64') {\n throw new Error(\n `GPGPUProgram does not support complex64 input. For complex64 ` +\n `dtypes, please separate the program into real and imaginary ` +\n `parts.`);\n }\n this.uploadToGPU(input.dataId);\n\n return {\n // Returning dtype from tensorMap because it reflects dtype\n // of underlying buffer, rather than abstract dtype.\n dtype: this.tensorMap.get(input.dataId).dtype,\n shape: input.shape,\n name: program.variableNames[i]\n };\n });\n\n const key =\n webgpu_program.makeShaderKey(program, bufferShapes, inputsData, output);\n\n let pipeline;\n if (key in this.pipelineCache) {\n pipeline = this.pipelineCache[key];\n } else {\n pipeline = webgpu_program.compileProgram(\n this.device, program, inputsData, output);\n this.pipelineCache[key] = pipeline;\n }\n\n if (programDefinedUniform) {\n programUniform = [...programUniform, ...programDefinedUniform];\n }\n const bindings = [\n this.tensorToBinding(output), ...inputs.map(t => this.tensorToBinding(t)),\n this.makeUniforms(programUniform)\n ];\n\n const bindGroup = this.device.createBindGroup({\n layout: pipeline.getBindGroupLayout(0),\n entries: bindings.map((b, i) => ({binding: i, resource: b})),\n });\n\n this.ensureCommandEncoderReady();\n const pass = this.getComputePass();\n const shouldTimeProgram = this.activeTimers != null;\n if (shouldTimeProgram) {\n if (this.supportTimeQuery) {\n // tslint:disable-next-line:no-any\n (pass as any).writeTimestamp(this.querySet, 0);\n }\n }\n pass.setPipeline(pipeline);\n pass.setBindGroup(0, bindGroup);\n pass.dispatchWorkgroups(\n program.dispatch[0], program.dispatch[1], program.dispatch[2]);\n if (shouldTimeProgram) {\n if (this.supportTimeQuery) {\n // tslint:disable-next-line:no-any\n (pass as any).writeTimestamp(this.querySet, 1);\n }\n }\n this.dispatchNumberInEncoder++;\n\n inputs.forEach(input => {\n this.commandQueueOwnedIds.add(input.dataId);\n });\n this.commandQueueOwnedIds.add(output.dataId);\n\n if (env().get('WEBGPU_DEFERRED_SUBMIT_BATCH_SIZE') as\n number <= this.dispatchNumberInEncoder) {\n this.submitQueue();\n }\n\n if (shouldTimeProgram) {\n this.activeTimers.push({\n name: program.constructor.name,\n query: this.getQueryTime(this.querySet)\n });\n }\n return output;\n }\n\n async getTimeFromQuerySet(querySet: GPUQuerySet) {\n const queryBuffer = this.bufferManager.acquireBuffer(\n 16, GPUBufferUsage.COPY_SRC | GPUBufferUsage.QUERY_RESOLVE);\n const dst = this.bufferManager.acquireBuffer(\n 16, GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST);\n\n this.ensureCommandEncoderReady();\n this.ensureComputePassEnded();\n this.currentCommandEncoder.resolveQuerySet(querySet, 0, 2, queryBuffer, 0);\n this.currentCommandEncoder.copyBufferToBuffer(queryBuffer, 0, dst, 0, 16);\n this.submitQueue();\n await dst.mapAsync(GPUMapMode.READ);\n const arrayBuf = new BigUint64Array(dst.getMappedRange());\n const timeElapsedNanos = Number((arrayBuf[1] - arrayBuf[0]));\n dst.unmap();\n this.bufferManager.releaseBuffer(\n dst, 16, GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST);\n this.bufferManager.releaseBuffer(\n queryBuffer, 16,\n GPUBufferUsage.COPY_SRC | GPUBufferUsage.QUERY_RESOLVE);\n // Return milliseconds.\n return timeElapsedNanos / 1000000;\n }\n\n shouldExecuteOnCPU(\n inputs: TensorInfo[],\n sizeThreshold = CPU_HANDOFF_SIZE_THRESHOLD): boolean {\n return env().getBool('WEBGPU_CPU_FORWARD') &&\n inputs.every(\n input => this.tensorMap.get(input.dataId).resourceInfo == null &&\n util.sizeFromShape(input.shape) < sizeThreshold);\n }\n\n numDataIds() {\n return this.tensorMap.numDataIds() - this.tensorDataPendingDisposal.length;\n }\n\n dispose() {\n if (this.disposed) {\n return;\n }\n this.bufferManager.dispose();\n this.textureManager.dispose();\n this.disposed = true;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport * as webgpu_util from './webgpu_util';\nexport {WebGPUBackend} from './backend_webgpu';\nexport {WebGPUProgram} from './webgpu_program';\nexport {webgpu_util};\n","/**\n * @license\n * Copyright 2022 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport './flags_webgpu';\n\nimport {env, registerBackend} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from './backend_webgpu';\nimport {isWebGPUSupported} from './webgpu_util';\n\nif (isWebGPUSupported()) {\n registerBackend('webgpu', async () => {\n // Remove it once we figure out how to correctly read the tensor data\n // before the tensor is disposed in profiling mode.\n env().set('CHECK_COMPUTATION_FOR_ERRORS', false);\n\n const gpuDescriptor: GPURequestAdapterOptions = {\n powerPreference: env().get('WEBGPU_USE_LOW_POWER_GPU') ?\n 'low-power' :\n 'high-performance'\n };\n\n const adapter = await navigator.gpu.requestAdapter(gpuDescriptor);\n const adapterLimits = adapter.limits;\n const deviceDescriptor: GPUDeviceDescriptor = {};\n const supportTimeQuery = adapter.features.has('timestamp-query');\n deviceDescriptor.requiredLimits = {\n 'maxComputeWorkgroupStorageSize':\n adapterLimits.maxComputeWorkgroupStorageSize,\n 'maxComputeWorkgroupsPerDimension':\n adapterLimits.maxComputeWorkgroupsPerDimension,\n 'maxStorageBufferBindingSize': adapterLimits.maxStorageBufferBindingSize,\n };\n\n if (supportTimeQuery) {\n deviceDescriptor.requiredFeatures = ['timestamp-query'];\n }\n const device: GPUDevice = await adapter.requestDevice(deviceDescriptor);\n // tslint:disable-next-line:no-any\n const adapterInfo = await (adapter as any).requestAdapterInfo();\n return new WebGPUBackend(device, adapterInfo);\n }, 3 /*priority*/);\n}\n\n// Export webgpu utilities\nexport * from './webgpu';\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nexport enum BinaryOpType {\n MUL,\n ADD,\n ATAN2,\n SUB,\n DIV,\n EQUAL,\n GREATER,\n GREATER_EQUAL,\n LESS,\n LESS_EQUAL,\n LOGICAL_AND,\n NOT_EQUAL,\n SQUARED_DIFFERENCE,\n INT_DIV,\n POW,\n PRELU,\n MAX,\n MIN,\n COMPLEX_MULTIPLY_REAL,\n COMPLEX_MULTIPLY_IMAG\n}\n\nconst CHECK_NAN_SNIPPET = `\n if (isnan(a)) { return a; }\n if (isnan(b)) { return b; }\n `;\n\nconst CHECK_NAN_SNIPPET_VEC4_INNER = `\n if (isNaN.r) {\n resultTemp.r = valueForNaN;\n }\n if (isNaN.g) {\n resultTemp.g = valueForNaN;\n }\n if (isNaN.b) {\n resultTemp.b = valueForNaN;\n }\n if (isNaN.a) {\n resultTemp.a = valueForNaN;\n }\n `;\n\nconst CHECK_NAN_SNIPPET_VEC4 = `\n let isNaN = isnanVec4(a) | isnanVec4(b);\n ${CHECK_NAN_SNIPPET_VEC4_INNER}\n `;\n\nconst ADD = 'return a + b;';\n// (Ar + Ai)(Br + Bi) =\n// ArBr + ArBi + AiBr + AiBi = ArBr - AB + ArBi + AiBr\n// Yr = ArBr - AB\n// Yi = ArBi + AiBr\nconst COMPLEX_MULTIPLY_REAL = 'return areal * breal - aimag * bimag;';\nconst COMPLEX_MULTIPLY_IMAG = 'return areal * bimag + aimag * breal;';\nconst DIV = 'return a / b;';\nconst MUL = 'return a * b;';\nconst SQUARED_DIFFERENCE = 'return (a - b) * (a - b);';\nconst SUB = 'return a - b;';\nconst EQUAL = 'return f32(a == b);';\nconst EQUAL_VEC4 = 'return vec4(a == b);';\nconst GREATER = 'return f32(a > b);';\nconst GREATER_VEC4 = 'return vec4(a > b);';\nconst GREATER_EQUAL = 'return f32(a >= b);';\nconst GREATER_EQUAL_VEC4 = 'return vec4(a >= b);';\nconst LESS = 'return f32(a < b);';\nconst LESS_VEC4 = 'return vec4(a < b);';\nconst LESS_EQUAL = 'return f32(a <= b);';\nconst LESS_EQUAL_VEC4 = 'return vec4(a <= b);';\nconst LOGICAL_AND = 'return f32(f32(a) >= 1.0 && f32(b) >= 1.0);';\nconst LOGICAL_AND_VEC4 = `return (vec4(a >= vec4(1.0)) *\n vec4(b >= vec4(1.0)));`;\nconst INT_DIV = `\n let s = sign(a) * sign(b);\n let ia = i32(round(a));\n let ib = i32(round(b));\n return f32(idiv(ia, ib, s));\n `;\n\nconst INT_DIV_VEC4 = `\n let ia = vec4(round(a));\n let ib = vec4(round(b));\n let cond = ib != vec4(0);\n var resultTemp = vec4(0);\n let s = sign(a) * sign(b);\n\n // Windows (D3D) wants guaranteed non-zero int division at compile-time.\n if (cond[0]) {\n resultTemp[0] = idiv(ia[0], ib[0], s[0]);\n }\n if (cond[1]) {\n resultTemp[1] = idiv(ia[1], ib[1], s[1]);\n }\n if (cond[2]) {\n resultTemp[2] = idiv(ia[2], ib[2], s[2]);\n }\n if (cond[3]) {\n resultTemp[3] = idiv(ia[3], ib[3], s[3]);\n }\n return vec4(resultTemp);\n `;\n\nconst NOT_EQUAL = `\n if (isnan(a) || isnan(b)) {\n return 1.0;\n }\n return f32(a != b);\n`;\nconst NOT_EQUAL_VEC4 = `\n var resultTemp = vec4(a != b);\n let valueForNaN = 1.0;\n ${CHECK_NAN_SNIPPET_VEC4}\n\n return resultTemp;\n`;\nconst POW = `\n if(a < 0.0 && floor(b) < b) {\n return uniforms.NAN;\n }\n if (b == 0.0) {\n return 1.0;\n }\n if (round(abs(b) % 2.0) != 1.0) {\n return pow(abs(a), b);\n }\n return sign(a) * pow(abs(a), b);\n `;\nconst POW_VEC4 = `\n let isModRound1Bool = vec4(round(abs(b) % vec4(2.0))) == vec4(1);\n let isModRound1 = vec4(isModRound1Bool);\n let multiplier = sign(a) * isModRound1 + (vec4(1.0) - isModRound1);\n var resultTemp = multiplier * pow(abs(a), b);\n\n // Ensure that a^0 = 1, including 0^0 = 1 as this correspond to TF and JS\n let isExpZero = b == vec4(0.0);\n if (isExpZero.r) {\n resultTemp.r = 1.0;\n }\n if (isExpZero.g) {\n resultTemp.g = 1.0;\n }\n if (isExpZero.b) {\n resultTemp.b = 1.0;\n }\n if (isExpZero.a) {\n resultTemp.a = 1.0;\n }\n let isNaN = (a < vec4(0.0)) & (floor(b) < b);\n let valueForNaN = uniforms.NAN;\n ${CHECK_NAN_SNIPPET_VEC4_INNER}\n return resultTemp;\n `;\n\nconst PRELU = `if (a < 0.0) { return b * a; } return a;`;\nconst PRELU_VEC4 = `\n let aLessThanZero = vec4(a < vec4(0.0));\n return (aLessThanZero * (b * a)) + ((vec4(1.0) - aLessThanZero) * a);\n `;\n\nfunction getBinaryWithNanString(\n op: string, useVec4: boolean, valueForNaN = 'uniforms.NAN') {\n const checkNanSnippet = useVec4 ? CHECK_NAN_SNIPPET_VEC4 : CHECK_NAN_SNIPPET;\n return useVec4 ? `\n let valueForNaN = ${valueForNaN};\n var resultTemp = vec4(${op}(a, b));\n ` + checkNanSnippet +\n `\n return resultTemp;\n ` :\n checkNanSnippet + `\n return ${op}(a, b);\n `;\n}\n\nexport function getBinaryOpString(\n type: BinaryOpType, useVec4?: boolean): string {\n switch (type) {\n case BinaryOpType.MUL:\n return MUL;\n case BinaryOpType.ADD:\n return ADD;\n case BinaryOpType.ATAN2:\n return getBinaryWithNanString('atan2', useVec4);\n case BinaryOpType.SUB:\n return SUB;\n case BinaryOpType.DIV:\n return DIV;\n case BinaryOpType.EQUAL:\n return useVec4 ? EQUAL_VEC4 : EQUAL;\n case BinaryOpType.GREATER:\n return useVec4 ? GREATER_VEC4 : GREATER;\n case BinaryOpType.GREATER_EQUAL:\n return useVec4 ? GREATER_EQUAL_VEC4 : GREATER_EQUAL;\n case BinaryOpType.LESS:\n return useVec4 ? LESS_VEC4 : LESS;\n case BinaryOpType.LESS_EQUAL:\n return useVec4 ? LESS_EQUAL_VEC4 : LESS_EQUAL;\n case BinaryOpType.LOGICAL_AND:\n return useVec4 ? LOGICAL_AND_VEC4 : LOGICAL_AND;\n case BinaryOpType.NOT_EQUAL:\n return useVec4 ? NOT_EQUAL_VEC4 : NOT_EQUAL;\n case BinaryOpType.SQUARED_DIFFERENCE:\n return SQUARED_DIFFERENCE;\n case BinaryOpType.INT_DIV:\n return useVec4 ? INT_DIV_VEC4 : INT_DIV;\n case BinaryOpType.PRELU:\n return useVec4 ? PRELU_VEC4 : PRELU;\n case BinaryOpType.MAX:\n return getBinaryWithNanString('max', useVec4);\n case BinaryOpType.MIN:\n return getBinaryWithNanString('min', useVec4);\n case BinaryOpType.POW:\n return useVec4 ? POW_VEC4 : POW;\n case BinaryOpType.COMPLEX_MULTIPLY_REAL:\n return COMPLEX_MULTIPLY_REAL;\n case BinaryOpType.COMPLEX_MULTIPLY_IMAG:\n return COMPLEX_MULTIPLY_IMAG;\n default:\n throw new Error(`BinaryType ${type} is not implemented!`);\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nexport enum UnaryOpType {\n ABS,\n CEIL,\n COS,\n COSH,\n ELU,\n EXP,\n EXPM1,\n FLOOR,\n IS_NAN,\n LINEAR,\n LOG,\n LOGICAL_NOT,\n NEG,\n RELU,\n RELU6,\n LEAKYRELU,\n RECIPROCAL,\n RSQRT,\n SIN,\n SINH,\n SIGMOID,\n SQRT,\n SQUARE,\n TANH,\n TO_INT\n}\n\nconst ABS = `return abs(a);`;\nconst CEIL = `return ceil(a);`;\nconst COS = `return cos(a);`;\nconst COSH = `\n let e2x = exp(-a);\n return (e2x + 1.0 / e2x) / 2.0;\n`;\nconst EXPM1 = `return exp(a) - 1.0;`;\nconst ELU = `if (a >= 0.0) { return a; } return (exp(a) - 1.0);`;\nconst ELU_VEC4 = `\n var resFloat = exp(a) - vec4(1.0);\n if (a.r >= 0.0) {\n resFloat.r = a.r;\n }\n if (a.g >= 0.0) {\n resFloat.g = a.g;\n }\n if (a.b >= 0.0) {\n resFloat.b = a.b;\n }\n if (a.a >= 0.0) {\n resFloat.a = a.a;\n }\n return resFloat;\n`;\nconst EXP = `return exp(a);`;\nconst FLOOR = `return floor(a);`;\nconst IS_NAN = `return f32(isnan(a));`;\nconst LINEAR = `return a;`;\nconst LOG = `if (a < 0.0) { return uniforms.NAN; }\n return log(a);`;\nconst LOGICAL_NOT = `return f32(!(a >= 1.0));`;\nconst NEG = `return -a;`;\nconst LEAKYRELU = `if (a < 0.0) { return uniforms.alpha * a; } return a;`;\nconst LEAKYRELU_VEC4 = `\n let aLessThanZero = vec4(a < vec4(0.0));\n return (aLessThanZero * (uniforms.alpha * a)) + ((vec4(1.0) - aLessThanZero) * a);\n`;\nconst RECIPROCAL = `return 1.0 / a;`;\nconst RELU = `return select(a, 0.0, a < 0.0);`;\nconst RELU6 = 'return clamp(a, 0.0, 6.0);';\nconst RELU6_VEC4 =\n 'return clamp(a, vec4(0.0, 0.0, 0.0, 0.0), vec4(6.0, 6.0, 6.0, 6.0));';\nconst RELU_VEC4 = `\n return select(a, vec4(0.0), a < vec4(0.0));\n`;\nconst RSQRT = `return 1.0/sqrt(a);`;\nconst SIGMOID = `return 1.0 / (1.0 + exp(-1.0 * a));`;\nconst SIN = `return sin(a);`;\nconst SINH = `\n let e2x = exp(a);\n return (e2x - 1.0 / e2x) / 2.0;\n`;\nconst SQRT = `return sqrt(a);`;\nconst SQUARE = `return a * a;`;\nconst TANH = `\n let e2x = exp(-2.0 * abs(a));\n return sign(a) * (1.0 - e2x) / (1.0 + e2x);\n`;\nconst TO_INT = `return f32(i32((a)));`;\n\nexport function getUnaryOpString(type: UnaryOpType, useVec4?: boolean): string {\n switch (type) {\n case UnaryOpType.ABS:\n return ABS;\n case UnaryOpType.COS:\n return COS;\n case UnaryOpType.COSH:\n return COSH;\n case UnaryOpType.CEIL:\n return CEIL;\n case UnaryOpType.ELU:\n return useVec4 ? ELU_VEC4 : ELU;\n case UnaryOpType.EXP:\n return EXP;\n case UnaryOpType.EXPM1:\n return EXPM1;\n case UnaryOpType.FLOOR:\n return FLOOR;\n case UnaryOpType.IS_NAN:\n return IS_NAN;\n case UnaryOpType.LINEAR:\n return LINEAR;\n case UnaryOpType.LOG:\n return LOG;\n case UnaryOpType.LOGICAL_NOT:\n return LOGICAL_NOT;\n case UnaryOpType.NEG:\n return NEG;\n case UnaryOpType.LEAKYRELU:\n return useVec4 ? LEAKYRELU_VEC4 : LEAKYRELU;\n case UnaryOpType.RECIPROCAL:\n return RECIPROCAL;\n case UnaryOpType.RELU:\n return useVec4 ? RELU_VEC4 : RELU;\n case UnaryOpType.RELU6:\n return useVec4 ? RELU6_VEC4 : RELU6;\n case UnaryOpType.RSQRT:\n return RSQRT;\n case UnaryOpType.SIGMOID:\n return SIGMOID;\n case UnaryOpType.SIN:\n return SIN;\n case UnaryOpType.SINH:\n return SINH;\n case UnaryOpType.SQRT:\n return SQRT;\n case UnaryOpType.SQUARE:\n return SQUARE;\n case UnaryOpType.TANH:\n return TANH;\n case UnaryOpType.TO_INT:\n return TO_INT;\n\n default:\n throw new Error(`BinaryType ${type} is not implemented!`);\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\n\nimport {BinaryOpType, getBinaryOpString} from './binary_op_util';\nimport {getUnaryOpString, UnaryOpType} from './unary_op_util';\n\nexport const typeSnippet = (component: number) => {\n switch (component) {\n case 1:\n return 'f32';\n case 2:\n return 'vec2';\n case 3:\n return 'vec3';\n case 4:\n return 'vec4';\n default:\n throw new Error(`${component}-component is not supported.`);\n }\n};\n\nexport function activationFnSnippet(\n activation: backend_util.Activation, hasPreluActivationWeights = false,\n packed = false, coordsLength = 3): string {\n if (activation === null) {\n return '';\n }\n\n let activationOpSnippet = '';\n if (activation === 'linear') {\n activationOpSnippet = getUnaryOpString(UnaryOpType.LINEAR);\n } else if (activation === 'relu') {\n activationOpSnippet = getUnaryOpString(UnaryOpType.RELU, packed);\n } else if (activation === 'elu') {\n activationOpSnippet = getUnaryOpString(UnaryOpType.ELU, packed);\n } else if (activation === 'relu6') {\n activationOpSnippet = getUnaryOpString(UnaryOpType.RELU6, packed);\n } else if (activation === 'prelu') {\n activationOpSnippet = getBinaryOpString(BinaryOpType.PRELU, packed);\n } else if (activation === 'sigmoid') {\n activationOpSnippet = getUnaryOpString(UnaryOpType.SIGMOID, packed);\n } else if (activation === 'leakyrelu') {\n activationOpSnippet = getUnaryOpString(UnaryOpType.LEAKYRELU, packed);\n } else {\n throw new Error(`Activation ${\n activation} has not been implemented for the WebGPU backend.`);\n }\n const elementSize = packed ? 4 : 1;\n const dataType = typeSnippet(elementSize);\n let activationFnSnippet = '';\n if (hasPreluActivationWeights) {\n activationFnSnippet = `\n fn activation(a : ${dataType}, coords : vec${coordsLength}) -> ${\n dataType} {\n let b = getPreluActivationWeightsByOutputCoords(coords);\n ${activationOpSnippet}\n }`;\n } else {\n activationFnSnippet = `\n fn activation(a : ${dataType}, coords : vec${coordsLength}) -> ${\n dataType} {\n ${activationOpSnippet}\n }`;\n }\n return activationFnSnippet;\n}\n\nexport function biasActivationSnippet(\n hasBias: boolean, activation: backend_util.Activation): string {\n return `\n ${hasBias ? 'value = value + getBiasByOutputCoords(coords);' : ''}\n ${activation ? 'value = activation(value, coords);' : ''}\n `;\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, TensorInfo, util} from '@tensorflow/tfjs-core';\nimport {activationFnSnippet, biasActivationSnippet, typeSnippet} from './activation_util';\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, computeWorkGroupInfoForMatMul} from './webgpu_util';\n\nexport function matMulReadFnSource(\n batchAEqualOne: boolean, batchBEqualOne: boolean, transposeA: boolean,\n transposeB: boolean, fitAOuter = false, fitBOuter = false, fitInner = false,\n component = 1) {\n util.assert(\n transposeA && component === 1 || !transposeA,\n () => `transposeA ${transposeA} is not compatible with component size ${\n component}`);\n const sampleA = `\n let batch = ${batchAEqualOne ? '0' : 'batchIn'};\n ${\n transposeA ? `value = getA(batch, col, row);` :\n `value = getA(batch, row, col);`}\n\n `;\n const sampleB = transposeB ? `value = getB(batch, col, row);` :\n `value = getB(batch, row, col);`;\n\n return `\n fn mm_readA(batchIn: i32, row: i32, colIn: i32) -> ${typeSnippet(component)} {\n var value = ${typeSnippet(component)}(0.0);\n let col = colIn * ${component};\n ${\n fitAOuter && fitInner ?\n sampleA :\n `\n ${\n transposeA ?\n `if(row < uniforms.dimAOuter && col < uniforms.dimInner)` :\n `if(row < uniforms.aShape[1] && col < uniforms.aShape[2])`}\n {\n ${sampleA}\n }\n `}\n return value;\n }\n\n fn mm_readB(batchIn: i32, row: i32, colIn: i32) -> ${typeSnippet(component)} {\n let col = colIn * ${component};\n let batch = ${batchBEqualOne ? '0' : 'batchIn'};\n var value = ${typeSnippet(component)}(0.0);\n ${sampleB}\n return value;\n }\n `;\n}\n\nexport function matMulReadWriteFnSource(\n hasBias: boolean, activation: backend_util.Activation,\n batchAEqualOne: boolean, batchBEqualOne: boolean, transposeA: boolean,\n transposeB: boolean, fitAOuter = false, fitBOuter = false, fitInner = false,\n component = 1) {\n return `\n ${\n matMulReadFnSource(\n batchAEqualOne, batchBEqualOne, transposeA, transposeB, fitAOuter,\n fitBOuter, fitInner, component)}\n fn mm_write(batch: i32, row: i32, colIn: i32, valueIn: ${\n typeSnippet(component)}) {\n let col = colIn * ${component};\n ${\n fitAOuter && fitBOuter ?\n '' :\n 'if (row < uniforms.dimAOuter && col < uniforms.dimBOuter)'}\n {\n var value = valueIn;\n let coords = vec3(batch, row, col);\n ${biasActivationSnippet(hasBias, activation)}\n setOutputAtCoords(coords[0], coords[1], coords[2], value);\n }\n }\n `;\n}\n\nconst writeDataToSubAVec4Snippet = (transpose: boolean) => {\n if (transpose) {\n return `\n mm_Asub[inputRow][inputCol] = mm_readA(batch,\n kStart + inputRow,\n globalRowStart / InnerElementSize + inputCol);\n `;\n\n } else {\n return `\n mm_Asub[inputRow][inputCol] = mm_readA(batch,\n globalRow + innerRow,\n kStart / InnerElementSize + inputCol);\n `;\n }\n};\n\nconst calculateResultSnippet =\n (transposeA: boolean, innerElementSize: number) => {\n if (transposeA) {\n return `\n let ACached0 = mm_Asub[k * InnerElementSize][localRow];\n let ACached1 = mm_Asub[k * InnerElementSize + 1][localRow];\n let ACached2 = mm_Asub[k * InnerElementSize + 2][localRow];\n ${\n innerElementSize === 3 ?\n '' :\n 'let ACached3 = mm_Asub[k * InnerElementSize + 3][localRow];'}\n for (var i = 0; i < RowPerThread; i = i + 1) {\n acc[i] = BCached0 * ACached0[i] + acc[i];\n acc[i] = BCached1 * ACached1[i] + acc[i];\n acc[i] = BCached2 * ACached2[i] + acc[i];\n ${\n innerElementSize === 3 ?\n '' :\n 'acc[i] = BCached3 * ACached3[i] + acc[i];'}\n }`;\n } else {\n return `\n for (var i = 0; i < RowPerThread; i = i + 1) {\n let ACached = mm_Asub[tileRow + i][k];\n acc[i] = BCached0 * ACached.x + acc[i];\n acc[i] = BCached1 * ACached.y + acc[i];\n acc[i] = BCached2 * ACached.z + acc[i];\n ${\n innerElementSize === 3 ? '' :\n 'acc[i] = BCached3 * ACached.w + acc[i];'}\n }`;\n }\n };\n\nexport function makeMatMulPackedVec4Source(\n workPerThread: number[], workGroupSize: [number, number, number],\n transposeA = false, tileInner = 32, splitK = false, splitedDimInner = 32,\n isVectorA = false): string {\n const tileAOuter = workGroupSize[1] * workPerThread[1];\n const tileBOuter = workGroupSize[0] * workPerThread[0];\n const tileAWidth = transposeA ? tileAOuter : tileInner;\n const tileAHight = transposeA ? tileInner : tileAOuter;\n const innerElementSize = tileAWidth / workGroupSize[0];\n const rowPerThreadB = tileInner / workGroupSize[1];\n util.assert(\n ((transposeA && innerElementSize === 4 && workPerThread[1] === 4) ||\n (!transposeA && (innerElementSize === 3 || innerElementSize === 4))) &&\n tileAWidth % workGroupSize[0] === 0 &&\n tileInner % workGroupSize[1] === 0 && workPerThread[0] === 4,\n () => `If transposeA ${transposeA} is true, innerElementSize ${\n innerElementSize} and workPerThread[1] ${workPerThread[1]} must be 4.\n Otherwise, innerElementSize ${innerElementSize} must be 3 or 4.\n tileAWidth ${tileAWidth} must be divisible by workGroupSize[0]${\n workGroupSize[0]}. tileInner ${\n tileInner} must be divisible by workGroupSize[1] ${\n workGroupSize[1]}. ColPerThread ${workPerThread[0]} must be 4.`);\n return `\n var mm_Asub : array, ${\n tileAWidth / innerElementSize}>, ${tileAHight}>;\n var mm_Bsub : array, ${\n tileBOuter / workPerThread[0]}>, ${tileInner}>;\n\n const RowPerThread = ${workPerThread[1]};\n const ColPerThread = ${workPerThread[0]};\n const InnerElementSize = ${innerElementSize};\n const TileInner = ${tileInner};\n\n @compute @workgroup_size(workGroupSizeX, workGroupSizeY, workGroupSizeZ)\n fn _start(@builtin(local_invocation_id) LocalId : vec3,\n @builtin(global_invocation_id) GlobalId : vec3,\n @builtin(num_workgroups) NumWorkgroups: vec3,\n @builtin(workgroup_id) workgroupId: vec3) {\n localId = LocalId;\n globalId = GlobalId;\n numWorkgroups = NumWorkgroups;\n\n let localRow = i32(localId.y);\n let tileRow = ${isVectorA ? '0' : 'localRow * RowPerThread'};\n let tileCol = i32(localId.x);\n\n let globalRow = ${isVectorA ? '0' : 'i32(globalId.y) * RowPerThread'};\n let globalCol = i32(globalId.x);\n let batch = ${splitK ? '0' : 'i32(globalId.z)'};\n let globalRowStart = i32(workgroupId.y) * ${tileAOuter};\n\n let numTiles = ${\n splitK ? `${Math.ceil(splitedDimInner / tileInner)}` :\n '(uniforms.dimInner - 1) / TileInner + 1'};\n var kStart = ${splitK ? `i32(globalId.z) * ${splitedDimInner}` : '0'};\n\n var acc: array, RowPerThread>;\n\n // Loop over shared dimension.\n let tileRowB = localRow * ${rowPerThreadB};\n for (var t = 0; t < numTiles; t = t + 1) {\n // Load one tile of A into local memory.\n for (var innerRow = 0; innerRow < RowPerThread; innerRow = innerRow + 1) {\n let inputRow = tileRow + innerRow;\n let inputCol = tileCol;\n ${writeDataToSubAVec4Snippet(transposeA)}\n }\n\n // Load one tile of B into local memory.\n for (var innerRow = 0; innerRow < ${\n rowPerThreadB}; innerRow = innerRow + 1) {\n let inputRow = tileRowB + innerRow;\n let inputCol = tileCol;\n mm_Bsub[inputRow][inputCol] = mm_readB(batch, kStart + inputRow, globalCol);\n }\n kStart = kStart + TileInner;\n workgroupBarrier();\n\n // Compute acc values for a single thread.\n for (var k = 0; k < TileInner / InnerElementSize; k = k + 1) {\n let BCached0 = mm_Bsub[k * InnerElementSize][tileCol];\n let BCached1 = mm_Bsub[k * InnerElementSize + 1][tileCol];\n let BCached2 = mm_Bsub[k * InnerElementSize + 2][tileCol];\n ${\n innerElementSize === 3 ?\n '' :\n 'let BCached3 = mm_Bsub[k * InnerElementSize + 3][tileCol];'}\n\n ${calculateResultSnippet(transposeA, innerElementSize)}\n }\n\n workgroupBarrier();\n }\n\n for (var innerRow = 0; innerRow < RowPerThread; innerRow = innerRow + 1) {\n mm_write(batch, globalRow + innerRow, globalCol, acc[innerRow]);\n }\n }`;\n}\n\nconst writeDataToSubASnippet = (transpose: boolean) => {\n if (transpose) {\n return `\n mm_Asub[inputRow][inputCol] = mm_readA(batch,\n kStart + inputRow,\n globalRowStart + inputCol);\n `;\n\n } else {\n return `\n mm_Asub[inputRow][inputCol] = mm_readA(batch,\n globalRowStart + inputRow,\n kStart + inputCol);\n `;\n }\n};\n\nconst readDataFromSubASnippet = (transposeA: boolean) => {\n return transposeA ? 'let ACached = mm_Asub[k][tileRow + innerRow];' :\n\n 'let ACached = mm_Asub[tileRow + innerRow][k];';\n};\n\n// sequentialAccessByThreads means sequential data in memory is accessed by\n// threads, instead of a single thread (default behavior).\nexport function makeMatMulPackedSource(\n workPerThread: number[], workGroupSize: [number, number, number],\n transposeA = false, tileInner = 32, splitK = false, splitedDimInner = 32,\n sequentialAccessByThreads = false): string {\n const tileAOuter = workPerThread[1] * workGroupSize[1];\n const tileBOuter = workPerThread[0] * workGroupSize[0];\n const tileAWidth = transposeA ? tileAOuter : tileInner;\n const tileAHight = transposeA ? tileInner : tileAOuter;\n util.assert(\n tileAHight % workGroupSize[1] === 0 &&\n tileAWidth % workGroupSize[0] === 0 &&\n tileInner % workGroupSize[1] === 0,\n () => `tileAHight ${tileAHight} must be divisible by workGroupSize[1]${\n workGroupSize[1]}, tileAWidth ${\n tileAWidth} must be divisible by workGroupSize[0]${\n workGroupSize[0]}, tileInner ${\n tileInner} must be divisible by workGroupSize[1]${workGroupSize[1]}`);\n const rowPerThreadA = tileAHight / workGroupSize[1];\n const colPerThreadA = tileAWidth / workGroupSize[0];\n const rowPerThreadB = tileInner / workGroupSize[1];\n const matmulSnippet = sequentialAccessByThreads ?\n `\n let localRow = i32(localId.y);\n let localCol = i32(localId.x);\n let globalRowStart = i32(workgroupId.y) * ${tileAOuter};\n let globalColStart = i32(workgroupId.x) * ${tileBOuter};\n\n // Loop over shared dimension.\n for (var t = 0; t < numTiles; t = t + 1) {\n // Load one tile of A into local memory.\n for (var inputRow = localRow; inputRow < ${\n tileAHight}; inputRow = inputRow + ${workGroupSize[1]}) {\n for (var inputCol = localCol; inputCol < ${\n tileAWidth}; inputCol = inputCol + ${workGroupSize[0]}) {\n ${writeDataToSubASnippet(transposeA)}\n }\n }\n // Load one tile of B into local memory.\n for (var inputRow = localRow; inputRow < ${\n tileInner}; inputRow = inputRow + ${workGroupSize[1]}) {\n for (var inputCol = localCol; inputCol < ${\n tileBOuter}; inputCol = inputCol + ${workGroupSize[0]}) {\n mm_Bsub[inputRow][inputCol] = mm_readB(batch,\n kStart + inputRow,\n globalColStart + inputCol);\n }\n }\n kStart = kStart + TileInner;\n workgroupBarrier();\n\n // Compute acc values for a single thread.\n var BCached : array;\n for (var k = 0; k < TileInner; k = k + 1) {\n for (var inner = 0; inner < ColPerThread; inner = inner + 1) {\n BCached[inner] = mm_Bsub[k][localCol + inner * ${workGroupSize[0]}];\n }\n for (var innerRow = 0; innerRow < RowPerThread; innerRow = innerRow + 1) {\n let ACached = ${\n transposeA ?\n `mm_Asub[k][localRow + innerRow * ${workGroupSize[1]}];` :\n `mm_Asub[localRow + innerRow * ${workGroupSize[1]}][k];`}\n for (var innerCol = 0; innerCol < ColPerThread; innerCol = innerCol + 1) {\n acc[innerRow][innerCol] = acc[innerRow][innerCol] +\n ACached * BCached[innerCol];\n }\n }\n }\n workgroupBarrier();\n }\n for (var innerRow = 0; innerRow < RowPerThread; innerRow = innerRow + 1) {\n let gRow = globalRowStart + localRow + innerRow * ${workGroupSize[1]};\n for (var innerCol = 0; innerCol < ColPerThread; innerCol = innerCol + 1) {\n let gCol = globalColStart + localCol + innerCol * ${workGroupSize[0]};\n mm_write(batch, gRow, gCol, acc[innerRow][innerCol]);\n }\n }\n ` :\n `\n let tileRow = i32(localId.y) * RowPerThread;\n let tileCol = i32(localId.x) * ColPerThread;\n\n let globalRow = i32(globalId.y) * RowPerThread;\n let globalCol = i32(globalId.x) * ColPerThread;\n let globalRowStart = i32(workgroupId.y) * ${tileAOuter};\n\n let tileRowA = i32(localId.y) * ${rowPerThreadA};\n let tileColA = i32(localId.x) * ${colPerThreadA};\n let tileRowB = i32(localId.y) * ${rowPerThreadB};\n // Loop over shared dimension.\n for (var t = 0; t < numTiles; t = t + 1) {\n // Load one tile of A into local memory.\n for (var innerRow = 0; innerRow < ${\n rowPerThreadA}; innerRow = innerRow + 1) {\n for (var innerCol = 0; innerCol < ${\n colPerThreadA}; innerCol = innerCol + 1) {\n let inputRow = tileRowA + innerRow;\n let inputCol = tileColA + innerCol;\n ${writeDataToSubASnippet(transposeA)}\n }\n }\n\n // Load one tile of B into local memory.\n for (var innerRow = 0; innerRow < ${\n rowPerThreadB}; innerRow = innerRow + 1) {\n for (var innerCol = 0; innerCol < ColPerThread; innerCol = innerCol + 1) {\n let inputRow = tileRowB + innerRow;\n let inputCol = tileCol + innerCol;\n mm_Bsub[inputRow][inputCol] = mm_readB(batch,\n kStart + inputRow,\n globalCol + innerCol);\n }\n }\n kStart = kStart + TileInner;\n workgroupBarrier();\n\n // Compute acc values for a single thread.\n var BCached : array;\n for (var k = 0; k < TileInner; k = k + 1) {\n for (var inner = 0; inner < ColPerThread; inner = inner + 1) {\n BCached[inner] = mm_Bsub[k][tileCol + inner];\n }\n\n for (var innerRow = 0; innerRow < RowPerThread; innerRow = innerRow + 1) {\n ${readDataFromSubASnippet(transposeA)}\n for (var innerCol = 0; innerCol < ColPerThread; innerCol = innerCol + 1) {\n acc[innerRow][innerCol] = acc[innerRow][innerCol] + ACached * BCached[innerCol];\n }\n }\n }\n\n workgroupBarrier();\n }\n\n for (var innerRow = 0; innerRow < RowPerThread; innerRow = innerRow + 1) {\n for (var innerCol = 0; innerCol < ColPerThread; innerCol = innerCol + 1) {\n mm_write(batch, globalRow + innerRow, globalCol + innerCol,\n acc[innerRow][innerCol]);\n }\n }\n `;\n\n return `\n var mm_Asub : array, ${tileAHight}>;\n var mm_Bsub : array, ${tileInner}>;\n const RowPerThread = ${workPerThread[1]};\n const ColPerThread = ${workPerThread[0]};\n const TileInner = ${tileInner};\n\n @compute @workgroup_size(workGroupSizeX, workGroupSizeY, workGroupSizeZ)\n fn _start(@builtin(local_invocation_id) LocalId : vec3,\n @builtin(global_invocation_id) GlobalId : vec3,\n @builtin(num_workgroups) NumWorkgroups: vec3,\n @builtin(workgroup_id) workgroupId: vec3) {\n localId = LocalId;\n globalId = GlobalId;\n numWorkgroups = NumWorkgroups;\n\n let batch = ${splitK ? '0' : 'i32(globalId.z)'};\n let numTiles = ${\n splitK ? `${Math.ceil(splitedDimInner / tileInner)}` :\n '(uniforms.dimInner - 1) / TileInner + 1'};\n var kStart = ${splitK ? `i32(globalId.z) * ${splitedDimInner}` : '0'};\n\n var acc : array, RowPerThread>;\n\n // Without this initialization strange values show up in acc.\n for (var innerRow = 0; innerRow < RowPerThread; innerRow = innerRow + 1) {\n for (var innerCol = 0; innerCol < ColPerThread; innerCol = innerCol + 1) {\n acc[innerRow][innerCol] = 0.0;\n }\n }\n ${matmulSnippet}\n }\n `;\n}\n\nconst readVectorASnippet = (transpose: boolean) => {\n return transpose ? `\n mm_readA(batch, colA, globalRow),\n mm_readA(batch, colA + 1, globalRow),\n mm_readA(batch, colA + 2, globalRow),\n mm_readA(batch, colA + 3, globalRow)\n ` :\n `\n mm_readA(batch, globalRow, colA),\n mm_readA(batch, globalRow, colA + 1),\n mm_readA(batch, globalRow, colA + 2),\n mm_readA(batch, globalRow, colA + 3)\n `;\n};\n\nexport function makeVectorMatrixProductSource(\n workGroupSize: [number, number, number], transposeA = false): string {\n util.assert(\n workGroupSize[1] === 1 && workGroupSize[2] === 1,\n () => `A linear work group size is required. But got ${workGroupSize}.`);\n return `\n const TileSize = ${workGroupSize[0] * 4};\n var mm_Asub : array, ${workGroupSize[0]}>;\n\n ${main()} {\n let tileCol = i32(localId.x);\n let globalCol = i32(globalId.x);\n let globalRow = i32(globalId.y);\n\n let numTiles = (uniforms.dimInner - 1) / TileSize + 1;\n let batch = i32(globalId.z);\n // Without this initialization strange values show up in acc.\n var acc = 0.0;\n\n // Loop over shared dimension.\n for (var t = 0; t < numTiles; t = t + 1) {\n // Load one tile of A into local memory.\n let colA = t * TileSize + tileCol * 4;\n mm_Asub[tileCol] = vec4(${readVectorASnippet(transposeA)});\n workgroupBarrier();\n\n // Compute acc values for a single thread.\n for (var k = 0; k < TileSize / 4; k = k + 1) {\n let rowB = t * TileSize + k * 4;\n let BCached = vec4(mm_readB(batch, rowB, globalCol),\n mm_readB(batch, rowB + 1, globalCol),\n mm_readB(batch, rowB + 2, globalCol),\n mm_readB(batch, rowB + 3, globalCol));\n\n let ACached = mm_Asub[k];\n acc = acc + dot(ACached, BCached);\n }\n\n workgroupBarrier();\n }\n\n mm_write(batch, globalRow, globalCol, acc);\n }\n `;\n}\n\nexport class MatMulPackedProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[], y: number[], z: number[]};\n dispatch: [number, number, number];\n variableNames = ['A', 'B'];\n uniforms = `dimAOuter : i32, dimBOuter : i32, dimInner : i32,`;\n workGroupSize: [number, number, number];\n elementsPerThread: [number, number, number];\n transposeA: boolean;\n transposeB: boolean;\n addBias: boolean;\n activation: backend_util.Activation;\n hasPreluActivationWeights: boolean;\n batchAEqualOne: boolean;\n batchBEqualOne: boolean;\n fitAOuter: boolean;\n fitBOuter: boolean;\n fitInner: boolean;\n tileInner: number;\n isVectorA: boolean;\n isVec4: boolean;\n private sequentialAccessByThreads: boolean;\n\n constructor(\n aShape: [number, number, number], outputShape: [number, number, number],\n batchAEqualOne: boolean, batchBEqualOne: boolean, transposeA = false,\n transposeB = false, bias: TensorInfo = null,\n activation: backend_util.Activation = null,\n preluActivationWeights: TensorInfo = null,\n sequentialAccessByThreads = false) {\n this.outputShape = outputShape;\n this.dispatchLayout = {x: [2], y: [1], z: [0]};\n const dimInner = transposeA ? aShape[1] : aShape[2];\n this.isVec4 = ((dimInner % 4 === 0 && !transposeA) ||\n (outputShape[1] % 4 === 0 && transposeA)) &&\n outputShape[2] % 4 === 0 && !transposeB;\n this.isVectorA = outputShape[1] === 1 && !transposeA;\n\n if (!this.isVec4 && this.isVectorA) {\n // For makeVectorMatrixProductSource\n this.elementsPerThread = [1, 1, 1];\n this.workGroupSize = [32, 1, 1];\n } else {\n const workGroupInfo = computeWorkGroupInfoForMatMul(\n outputShape[1], dimInner, outputShape[2], transposeA);\n this.workGroupSize = workGroupInfo.workGroupSize;\n this.elementsPerThread = workGroupInfo.elementsPerThread;\n }\n\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize,\n this.elementsPerThread);\n\n const addBias = bias != null;\n const hasPreluActivationWeights = preluActivationWeights != null;\n if (addBias) {\n this.variableNames.push('bias');\n }\n\n if (hasPreluActivationWeights) {\n this.variableNames.push('preluActivationWeights');\n }\n\n this.sequentialAccessByThreads = sequentialAccessByThreads;\n this.transposeA = transposeA;\n this.transposeB = transposeB;\n this.addBias = addBias;\n this.activation = activation;\n this.hasPreluActivationWeights = hasPreluActivationWeights;\n this.batchAEqualOne = batchAEqualOne;\n this.batchBEqualOne = batchBEqualOne;\n [this.fitAOuter, this.fitBOuter, this.fitInner] =\n this.getShapeFit(outputShape[1], outputShape[2], dimInner);\n this.shaderKey = `matMulPacked_${this.elementsPerThread}_${transposeA}_${\n transposeB}_${this.activation}_${this.fitAOuter}_${this.fitBOuter}_${\n this.fitInner}_${this.isVec4}_${this.isVectorA}_${\n this.batchAEqualOne}_${this.batchBEqualOne}_${\n this.sequentialAccessByThreads}`;\n }\n\n getShapeFit(dimAOuter: number, dimBOuter: number, dimInner: number):\n boolean[] {\n const tileAOuter = this.workGroupSize[1] * this.elementsPerThread[1];\n const tileBOuter = this.workGroupSize[0] * this.elementsPerThread[0];\n\n if (!this.isVec4 && this.isVectorA) {\n // For makeVectorMatrixProductSource\n this.tileInner = this.workGroupSize[0] * 4;\n } else {\n this.tileInner = tileBOuter;\n }\n\n const fitAOuter = dimAOuter % tileAOuter === 0;\n const fitBOuter = dimBOuter % tileBOuter === 0;\n const fitInner = dimInner % this.tileInner === 0;\n return [fitAOuter, fitBOuter, fitInner];\n }\n\n getUserCode(): string {\n const userCode = `\n ${\n activationFnSnippet(\n this.activation, this.hasPreluActivationWeights, this.isVec4)}\n ${\n matMulReadWriteFnSource(\n this.addBias, this.activation, this.batchAEqualOne,\n this.batchBEqualOne,\n false /* transposeA is implemented in makeMatMulPackedSource */,\n this.transposeB, this.fitAOuter, this.fitBOuter, this.fitInner,\n this.isVec4 ? 4 : 1)}\n ${\n this.isVec4 ?\n makeMatMulPackedVec4Source(\n this.elementsPerThread, this.workGroupSize, this.transposeA,\n this.tileInner, false, null, this.isVectorA) :\n (this.isVectorA ? makeVectorMatrixProductSource(\n this.workGroupSize, this.transposeA) :\n makeMatMulPackedSource(\n this.elementsPerThread, this.workGroupSize,\n this.transposeA, this.tileInner, false, null,\n this.sequentialAccessByThreads))}\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {activationFnSnippet} from './activation_util';\nimport {matMulReadWriteFnSource} from './matmul_packed_webgpu';\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch} from './webgpu_util';\n\nexport function makeMatMulReduceSource(): string {\n return `\n var sumValues : array;\n ${main()} {\n let coords = getOutputCoords();\n let batch = coords[0];\n let row = coords[1];\n let col = coords[2];\n var sum = 0.0;\n let Length = uniforms.dimInner;\n for (var k = i32(localId.x); k < Length; k = k + i32(workGroupSizeX)) {\n let dataA = mm_readA(batch, row, k);\n let dataB = mm_readB(batch, k, col);\n sum = sum + dataA * dataB;\n }\n sumValues[localId.x] = sum;\n workgroupBarrier();\n\n for(var currentSize = workGroupSizeX / 2u; currentSize > 1u;\n currentSize = currentSize / 2u) {\n if (localId.x < currentSize)\n {\n sumValues[localId.x] = sumValues[localId.x] + sumValues[localId.x + currentSize];\n }\n workgroupBarrier();\n }\n\n if (localId.x == 0u) {\n sum = sumValues[0] + sumValues[1];\n mm_write(batch, row, col, sum);\n }\n }\n `;\n}\n\nexport class MatMulReduceProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[], y: number[], z: number[]};\n dispatch: [number, number, number];\n variableNames = ['A', 'B'];\n uniforms = `dimAOuter : i32, dimBOuter : i32, dimInner : i32,`;\n workGroupSize: [number, number, number] = [256, 1, 1];\n transposeA: boolean;\n transposeB: boolean;\n addBias: boolean;\n activation: backend_util.Activation;\n hasPreluActivationWeights: boolean;\n batchAEqualOne: boolean;\n batchBEqualOne: boolean;\n\n constructor(\n outputShape: [number, number, number], batchAEqualOne: boolean,\n batchBEqualOne: boolean, transposeA = false, transposeB = false,\n bias: TensorInfo = null, activation: backend_util.Activation = null,\n preluActivationWeights: TensorInfo = null) {\n this.outputShape = outputShape;\n this.dispatchLayout = {x: [], y: [1, 2], z: [0]};\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize);\n\n const addBias = bias != null;\n const hasPreluActivationWeights = preluActivationWeights != null;\n if (addBias) {\n this.variableNames.push('bias');\n }\n\n if (hasPreluActivationWeights) {\n this.variableNames.push('preluActivationWeights');\n }\n\n this.transposeA = transposeA;\n this.transposeB = transposeB;\n this.addBias = addBias;\n this.activation = activation;\n this.hasPreluActivationWeights = hasPreluActivationWeights;\n this.batchAEqualOne = batchAEqualOne;\n this.batchBEqualOne = batchBEqualOne;\n this.shaderKey = `matMulReduce_${this.activation}_${transposeA}_${\n transposeB}_${this.batchAEqualOne}_${this.batchBEqualOne}`;\n }\n\n getUserCode(): string {\n const userCode = `\n ${activationFnSnippet(this.activation, this.hasPreluActivationWeights)}\n ${\n matMulReadWriteFnSource(\n this.addBias, this.activation, this.batchAEqualOne,\n this.batchBEqualOne, this.transposeA, this.transposeB)}\n ${makeMatMulReduceSource()}\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, TensorInfo} from '@tensorflow/tfjs-core';\nimport {activationFnSnippet} from './activation_util';\nimport {matMulReadWriteFnSource} from './matmul_packed_webgpu';\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\n\nexport function makeMatMulSmallOutputSizeSource(\n workGroupSize: [number, number, number]): string {\n const tileAOuter = workGroupSize[1];\n const tileBOuter = workGroupSize[0];\n const tileInner = tileAOuter > tileBOuter ? tileAOuter : tileBOuter;\n return `\n var mm_Asub : array, ${tileAOuter}>;\n var mm_Bsub : array, ${tileInner}>;\n\n // If the output size is small for matrix multiplication, avoid to use vec4\n // and handle some elements per thread to optimally utilize the ALU.\n // Read data from global memory to registers firstly, then store them into\n // shared memory, so it is instruction-Level parallelism for arithmetic\n // operations and others handle IO operations between barrier api, makes ALU\n // and load/store units work simultaneously, could improves the performance.\n ${main()} {\n let tileRow = i32(localId.y);\n let tileCol = i32(localId.x);\n let globalRow = i32(globalId.y);\n let globalCol = i32(globalId.x);\n let batch = i32(globalId.z);\n\n // uniforms.dimInner should be greater than 0.\n let numTiles = (uniforms.dimInner - 1) / ${tileInner} + 1;\n var acc = 0.0;\n\n var globalColA = tileCol;\n var globalRowB = 0;\n var regA = mm_readA(batch, globalRow, globalColA);\n var regB0 = mm_readB(batch, globalRowB + 2 * tileRow, globalCol);\n var regB1 = mm_readB(batch, globalRowB + 2 * tileRow + 1, globalCol);\n globalColA = globalColA + ${tileInner};\n globalRowB = globalRowB + ${tileInner};\n\n for (var t = 0; t < numTiles; t = t + 1) {\n mm_Asub[tileRow][tileCol] = regA;\n mm_Bsub[2 * tileRow][tileCol] = regB0;\n mm_Bsub[2 * tileRow + 1][tileCol] = regB1;\n\n workgroupBarrier();\n\n regA = mm_readA(batch, globalRow, globalColA);\n regB0 = mm_readB(batch, globalRowB + 2 * tileRow, globalCol);\n regB1 = mm_readB(batch, globalRowB + 2 * tileRow + 1, globalCol);\n globalColA = globalColA + ${tileInner};\n globalRowB = globalRowB + ${tileInner};\n\n for (var k = 0; k < ${tileInner}; k = k + 1) {\n acc = acc + mm_Asub[tileRow][k] * mm_Bsub[k][tileCol];\n }\n workgroupBarrier();\n }\n\n mm_write(batch, globalRow, globalCol, acc);\n }\n `;\n}\n\nexport class MatMulSmallOutputSizeProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[], y: number[], z: number[]};\n dispatch: [number, number, number];\n variableNames = ['A', 'B'];\n uniforms = `dimAOuter : i32, dimBOuter : i32, dimInner : i32,`;\n workGroupSize: [number, number, number] = [16, 8, 1];\n transposeA: boolean;\n transposeB: boolean;\n addBias: boolean;\n activation: backend_util.Activation;\n hasPreluActivationWeights: boolean;\n batchAEqualOne: boolean;\n batchBEqualOne: boolean;\n\n constructor(\n aShape: [number, number, number], bShape: [number, number, number],\n outputShape: [number, number, number], transposeA = false,\n transposeB = false, bias: TensorInfo = null,\n activation: backend_util.Activation = null,\n preluActivationWeights: TensorInfo = null) {\n this.outputShape = outputShape;\n\n this.dispatchLayout = {x: [2], y: [1], z: [0]};\n this.dispatch = [\n Math.ceil(outputShape[2] / this.workGroupSize[0]),\n Math.ceil(outputShape[1] / this.workGroupSize[1]), outputShape[0]\n ];\n\n const addBias = bias != null;\n if (addBias) {\n this.variableNames.push('bias');\n }\n\n const hasPreluActivationWeights = preluActivationWeights != null;\n if (hasPreluActivationWeights) {\n this.variableNames.push('preluActivationWeights');\n }\n\n this.transposeA = transposeA;\n this.transposeB = transposeB;\n this.addBias = addBias;\n this.activation = activation;\n this.hasPreluActivationWeights = hasPreluActivationWeights;\n this.batchAEqualOne = aShape[0] === 1;\n this.batchBEqualOne = bShape[0] === 1;\n this.shaderKey = `matMulSmallOutputSize_${this.activation}_${transposeA}_${\n transposeB}_${this.batchAEqualOne}_${this.batchBEqualOne}`;\n }\n\n getUserCode(): string {\n const userCode = `\n ${activationFnSnippet(this.activation, this.hasPreluActivationWeights)}\n ${\n matMulReadWriteFnSource(\n this.addBias, this.activation, this.batchAEqualOne,\n this.batchBEqualOne, this.transposeA, this.transposeB)}\n ${makeMatMulSmallOutputSizeSource(this.workGroupSize)}\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {activationFnSnippet, biasActivationSnippet, typeSnippet} from './activation_util';\nimport {makeMatMulPackedSource, makeMatMulPackedVec4Source, matMulReadFnSource} from './matmul_packed_webgpu';\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class MatMulSplitKProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[], y: number[], z: number[]};\n dispatch: [number, number, number];\n variableNames = ['A', 'B'];\n uniforms = `dimAOuter : i32, dimBOuter : i32, dimInner : i32,`;\n workGroupSize: [number, number, number] = [8, 8, 1];\n elementsPerThread: [number, number, number];\n transposeA: boolean;\n transposeB: boolean;\n atomic = true;\n batchAEqualOne: boolean;\n batchBEqualOne: boolean;\n isVec4 = false;\n splitedDimInner = 128;\n\n constructor(\n outputShape: [number, number, number], dimInner: number,\n batchAEqualOne: boolean, batchBEqualOne: boolean, transposeA = false,\n transposeB = false) {\n util.assert(\n outputShape[0] === 1,\n () => 'MatMulSplitKProgram only supports batch = 1.');\n this.outputShape = outputShape;\n this.dispatchLayout = {x: [2], y: [1], z: [0, 3]};\n this.isVec4 = (transposeA && this.outputShape[1] % 4 === 0 ||\n !transposeA && dimInner % 4 === 0) &&\n this.outputShape[2] % 4 === 0;\n this.elementsPerThread = [4, 4, this.splitedDimInner];\n\n if (!this.isVec4) {\n if (this.outputShape[1] < 16) {\n this.elementsPerThread[1] = 1;\n }\n if (this.outputShape[2] < 16) {\n this.elementsPerThread[0] = 1;\n }\n }\n\n this.dispatch = computeDispatch(\n this.dispatchLayout,\n [\n this.outputShape[0], this.outputShape[1], this.outputShape[2],\n dimInner\n ],\n this.workGroupSize, this.elementsPerThread);\n\n this.transposeA = transposeA;\n this.transposeB = transposeB;\n this.batchAEqualOne = batchAEqualOne;\n this.batchBEqualOne = batchBEqualOne;\n this.shaderKey =\n `matMulSplitK_${transposeA}_${transposeB}_${batchAEqualOne}_${\n batchBEqualOne}_${this.elementsPerThread}_${this.isVec4}`;\n }\n\n getUserCode(): string {\n // atomicAdd only supports uint/int type. For float, we use\n // atomicCompareExchangeWeak to simulate.\n const atomicAddSnippet = (component: number) => {\n return `\n for (var i = 0; i < ${component}; i = i + 1)\n {\n var oldValue = atomicLoad(&(result[flatIndex + i]));\n var exchanged = false;\n for (; !exchanged;) {\n let newValueF32 = bitcast(oldValue) + ${\n component > 1 ? 'value[i]' : 'value'};\n let newValue = bitcast(newValueF32);\n let res = atomicCompareExchangeWeak(&(result[flatIndex + i]), oldValue, newValue);\n oldValue = res.old_value;\n exchanged = res.exchanged;\n }\n }\n `;\n };\n\n const component = this.isVec4 ? 4 : 1;\n const userCode = `\n ${\n matMulReadFnSource(\n this.batchAEqualOne, this.batchBEqualOne, false, this.transposeB,\n false, false, false, component)}\n fn mm_write(batch: i32, row : i32, colIn : i32, value : ${\n typeSnippet(component)}) {\n let col = colIn * ${component};\n if (row < uniforms.dimAOuter && col < uniforms.dimBOuter) {\n let coords = vec3(batch, row, col);\n let flatIndex = getOutputIndexFromCoords(coords);\n // The problem is that we should initialize output to zero before using.\n // Otherwise, the original value will be added to the result.\n ${atomicAddSnippet(component)}\n }\n }\n ${\n this.isVec4 ? makeMatMulPackedVec4Source(\n this.elementsPerThread, this.workGroupSize,\n this.transposeA, 32, true, this.splitedDimInner) :\n makeMatMulPackedSource(\n this.elementsPerThread, this.workGroupSize,\n this.transposeA, 32, true, this.splitedDimInner)}\n `;\n return userCode;\n }\n}\n\nexport class BiasActivationProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n uniforms = '';\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames = ['x'];\n workGroupSize: [number, number, number] = [64, 1, 1];\n size = true;\n private addBias: boolean;\n private activation: backend_util.Activation;\n private hasPreluActivationWeights: boolean;\n\n constructor(\n outputShape: number[], bias: TensorInfo = null,\n activation: backend_util.Activation = null,\n preluActivationWeights: TensorInfo = null) {\n this.outputShape = outputShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize);\n this.addBias = bias != null;\n this.hasPreluActivationWeights = preluActivationWeights != null;\n this.activation = activation;\n if (this.addBias) {\n this.variableNames.push('bias');\n }\n\n if (this.hasPreluActivationWeights) {\n this.variableNames.push('preluActivationWeights');\n }\n\n this.shaderKey = `biasActivation_${activation}`;\n }\n\n getUserCode(): string {\n return `\n ${activationFnSnippet(this.activation, this.hasPreluActivationWeights)}\n ${main('index')} {\n if (index < uniforms.size) {\n let coords = getCoordsFromIndex(index);\n var value = getXByOutputIndex(index);\n ${biasActivationSnippet(this.addBias, this.activation)}\n setOutputAtIndex(index, value);\n }\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class FillProgram implements WebGPUProgram {\n variableNames: string[] = [];\n outputShape: number[] = [];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n uniforms = 'value : f32,';\n workGroupSize: [number, number, number] = [64, 1, 1];\n size = true;\n\n constructor(shape: number[]) {\n this.outputShape = shape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize);\n\n this.shaderKey = 'fill';\n }\n\n getUserCode(): string {\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n setOutputAtIndex(index, uniforms.value);\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Fill, FillAttrs, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {FillProgram} from '../fill_webgpu';\n\nexport function fill(args: {backend: WebGPUBackend, attrs: FillAttrs}):\n TensorInfo {\n const {backend, attrs} = args;\n const {shape, value} = attrs;\n let {dtype} = attrs;\n\n dtype = dtype || util.inferDtype(value);\n\n if (dtype === 'string') {\n // String type should be handled in CPU memory.\n const values = util.getArrayFromDType(dtype, util.sizeFromShape(shape));\n values.fill(value as string);\n return backend.makeTensorInfo(shape, dtype, values);\n } else {\n const program = new FillProgram(shape);\n const uniformData = [{type: 'float32', data: [value as number]}];\n return backend.runWebGPUProgram(program, [], dtype, uniformData);\n }\n}\n\nexport const fillConfig: KernelConfig = {\n kernelName: Fill,\n backendName: 'webgpu',\n kernelFunc: fill as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Reshape, ReshapeAttrs, ReshapeInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\n\nexport function reshape(\n args: {inputs: ReshapeInputs, backend: WebGPUBackend, attrs: ReshapeAttrs}):\n TensorInfo {\n const {inputs, attrs} = args;\n const {x} = inputs;\n const {shape} = attrs;\n\n const xSize = util.sizeFromShape(x.shape);\n const $shape = util.inferFromImplicitShape(shape, xSize);\n const $xSize = util.sizeFromShape($shape);\n\n util.assert(\n xSize === $xSize,\n () => `The new shape (${$shape}) has ${$xSize} elements and the old ` +\n `shape (${x.shape}) has ${xSize} elements. The new shape and old ` +\n `shape must have the same number of elements.`);\n\n // Backend needs to track refCount for the dataId for reshape op\n args.backend.incRef(x.dataId);\n return {dataId: x.dataId, shape: $shape, dtype: x.dtype};\n}\n\nexport const reshapeConfig: KernelConfig = {\n kernelName: Reshape,\n backendName: 'webgpu',\n kernelFunc: reshape as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, broadcast_util, env, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {MatMulPackedProgram} from '../matmul_packed_webgpu';\nimport {MatMulReduceProgram} from '../matmul_reduce_webgpu';\nimport {MatMulSmallOutputSizeProgram} from '../matmul_small_output_size_webgpu';\nimport {BiasActivationProgram, MatMulSplitKProgram} from '../matmul_splitK_webgpu';\nimport {WebGPUProgram} from '../webgpu_program';\nimport {MatMulProgramType} from '../webgpu_util';\n\nimport {fill} from './Fill';\nimport {reshape} from './Reshape';\n\ntype BatchMatMulConfig = {\n a: TensorInfo,\n b: TensorInfo,\n transposeA: boolean,\n transposeB: boolean,\n backend: WebGPUBackend,\n bias?: TensorInfo,\n preluActivationWeights?: TensorInfo,\n leakyreluAlpha?: number,\n activation?: backend_util.Activation\n};\n\nexport function batchMatMulImpl({\n a,\n b,\n transposeA,\n transposeB,\n backend,\n bias = null,\n preluActivationWeights = null,\n leakyreluAlpha = 0,\n activation = null\n}: BatchMatMulConfig): TensorInfo {\n const aRank = a.shape.length;\n const bRank = b.shape.length;\n\n const innerShapeA = transposeA ? a.shape[aRank - 2] : a.shape[aRank - 1];\n const innerShapeB = transposeB ? b.shape[bRank - 1] : b.shape[bRank - 2];\n\n const outerShapeA = transposeA ? a.shape[aRank - 1] : a.shape[aRank - 2];\n const outerShapeB = transposeB ? b.shape[bRank - 2] : b.shape[bRank - 1];\n\n const outerDimsA = a.shape.slice(0, -2);\n const outerDimsB = b.shape.slice(0, -2);\n\n const batchDimA = util.sizeFromShape(outerDimsA);\n const batchDimB = util.sizeFromShape(outerDimsB);\n\n const outShapeOuterDims = broadcast_util.assertAndGetBroadcastShape(\n a.shape.slice(0, -2), b.shape.slice(0, -2));\n const outShape = outShapeOuterDims.concat([outerShapeA, outerShapeB]);\n\n util.assert(\n innerShapeA === innerShapeB,\n () => `Error in matMul: inner shapes (${innerShapeA}) and (` +\n `${innerShapeB}) of Tensors with shapes ${a.shape} and ` +\n `${b.shape} and transposeA=${transposeA}` +\n ` and transposeB=${transposeB} must match.`);\n\n const a3dShape: [number, number, number] = transposeA ?\n [batchDimA, innerShapeA, outerShapeA] :\n [batchDimA, outerShapeA, innerShapeA];\n const b3dShape: [number, number, number] = transposeB ?\n [batchDimB, outerShapeB, innerShapeB] :\n [batchDimB, innerShapeB, outerShapeB];\n\n // The rest of the implementation is designed to operate on rank-3 tensors\n const a3d = reshape({inputs: {x: a}, backend, attrs: {shape: a3dShape}});\n const b3d = reshape({inputs: {x: b}, backend, attrs: {shape: b3dShape}});\n const intermediates: TensorInfo[] = [a3d, b3d];\n\n const batchDim = Math.max(batchDimA, batchDimB);\n const batchAEqualOne = batchDimA === 1;\n const batchBEqualOne = batchDimB === 1;\n\n const inputs: TensorInfo[] = [a3d, b3d];\n const dimensions = [\n {type: 'int32', data: [outerShapeA]}, {type: 'int32', data: [outerShapeB]},\n {type: 'int32', data: [innerShapeA]}\n ];\n\n let program: WebGPUProgram;\n let out: TensorInfo;\n const outputShape: [number, number, number] =\n [batchDim, outerShapeA, outerShapeB];\n let matmulProgramType = env().get('WEBGPU_MATMUL_PROGRAM_TYPE') as number;\n if (matmulProgramType < 0) {\n if (outerShapeA * outerShapeB <= 128) {\n matmulProgramType = MatMulProgramType.MatMulReduceProgram;\n } else if (\n // These boundaries are based on bodypix-ResNet50-image-0.5.\n // TODO: Relax or tight these boundaries when we have a complete matmul\n // test coverage.\n batchDim === 1 && outerShapeA <= 128 && outerShapeB <= 48 &&\n innerShapeB >= 2000) {\n matmulProgramType = MatMulProgramType.MatMulSplitKProgram;\n } else if (\n // When the output size is absolutely small or relatively small, we may\n // use MatMulSmallOutputSizeProgram to get better performance.\n // Absolutely small size means that the output size is smaller than [16,\n // 512]. Relatively small size means that one demension size of the\n // output is smaller than 16, and the output size is also more than or\n // equal two times smaller than each of the two input sizes. For\n // example, if input sizes are [12, 2048] and [2048, 1024], the output\n // size is [12, 1024], which is relatively small compared to input\n // sizes.\n (outerShapeA <= 16 &&\n (outerShapeB <= 512 || innerShapeB >= 2 * outerShapeB)) ||\n (outerShapeB <= 16 &&\n (outerShapeA <= 512 || innerShapeA >= 2 * outerShapeA))) {\n matmulProgramType = MatMulProgramType.MatMulSmallOutputSizeProgram;\n } else {\n matmulProgramType = MatMulProgramType.MatMulPackedProgram;\n }\n }\n\n switch (matmulProgramType) {\n case MatMulProgramType.MatMulReduceProgram:\n program = new MatMulReduceProgram(\n outputShape, batchAEqualOne, batchBEqualOne, transposeA, transposeB,\n bias, activation, preluActivationWeights);\n break;\n case MatMulProgramType.MatMulSplitKProgram: {\n // The output buffer must be initailzed to zero before using since we\n // use atomicAdd in MatMulSplitKProgram.\n out = fill(\n {backend, attrs: {shape: outputShape, value: 0, dtype: a.dtype}});\n program = new MatMulSplitKProgram(\n outputShape, innerShapeB, batchAEqualOne, batchBEqualOne, transposeA,\n transposeB);\n if (bias || activation) {\n out =\n backend.runWebGPUProgram(program, inputs, a.dtype, dimensions, out);\n const biasActivationProgram = new BiasActivationProgram(\n out.shape, bias, activation, preluActivationWeights);\n let uniformData = null;\n const activationInputs: TensorInfo[] = [out];\n if (bias) {\n activationInputs.push(bias);\n }\n if (preluActivationWeights) {\n activationInputs.push(preluActivationWeights);\n }\n if (activation === 'leakyrelu') {\n uniformData = [{type: 'float32', data: [leakyreluAlpha]}];\n biasActivationProgram.uniforms += ' alpha : f32,';\n }\n const outActivated = backend.runWebGPUProgram(\n biasActivationProgram, activationInputs, out.dtype, uniformData);\n intermediates.push(out);\n const outReshaped = reshape(\n {inputs: {x: outActivated}, backend, attrs: {shape: outShape}});\n intermediates.push(outActivated);\n for (const i of intermediates) {\n backend.disposeData(i.dataId);\n }\n return outReshaped;\n }\n break;\n }\n case MatMulProgramType.MatMulSmallOutputSizeProgram:\n program = new MatMulSmallOutputSizeProgram(\n a3dShape, b3dShape, outputShape, transposeA, transposeB, bias,\n activation, preluActivationWeights);\n break;\n case MatMulProgramType.MatMulPackedProgram:\n // Experiments show that sequential access is more friendly for Intel\n // GPUs.\n const sequentialAccessByThreads = backend.adapterInfo.isIntel();\n program = new MatMulPackedProgram(\n a3dShape, outputShape, batchAEqualOne, batchBEqualOne, transposeA,\n transposeB, bias, activation, preluActivationWeights,\n sequentialAccessByThreads);\n break;\n default:\n throw new Error(`Unsupported MatMulProgramType ${matmulProgramType}.`);\n }\n\n if (bias) {\n inputs.push(bias);\n }\n if (preluActivationWeights) {\n inputs.push(preluActivationWeights);\n }\n if (activation === 'leakyrelu') {\n dimensions.push({type: 'float32', data: [leakyreluAlpha]});\n program.uniforms += ' alpha : f32,';\n }\n out = backend.runWebGPUProgram(program, inputs, a.dtype, dimensions, out);\n const outReshaped =\n reshape({inputs: {x: out}, backend, attrs: {shape: outShape}});\n intermediates.push(out);\n for (const i of intermediates) {\n backend.disposeData(i.dataId);\n }\n return outReshaped;\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {_FusedMatMul, _FusedMatMulAttrs, _FusedMatMulInputs, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {batchMatMulImpl} from './BatchMatMul_impl';\n\nexport function _fusedMatMul(args: {\n inputs: _FusedMatMulInputs,\n attrs: _FusedMatMulAttrs,\n backend: WebGPUBackend\n}) {\n const {inputs, backend, attrs} = args;\n const {a, b, bias, preluActivationWeights} = inputs;\n const {transposeA, transposeB, activation, leakyreluAlpha} = attrs;\n\n return batchMatMulImpl({\n a,\n b,\n transposeA,\n transposeB,\n backend,\n bias,\n preluActivationWeights,\n leakyreluAlpha,\n activation\n });\n}\n\nexport const _fusedMatMulConfig: KernelConfig = {\n kernelName: _FusedMatMul,\n backendName: 'webgpu',\n kernelFunc: _fusedMatMul as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {BinaryOpType, getBinaryOpString} from './binary_op_util';\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class BinaryOpComplexProgram implements WebGPUProgram {\n variableNames = ['AReal', 'AImag', 'BReal', 'BImag'];\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n workGroupSize: [number, number, number] = [128, 1, 1];\n op: BinaryOpType;\n size = true;\n\n constructor(op: BinaryOpType, aShape: number[], bShape: number[]) {\n this.outputShape = backend_util.assertAndGetBroadcastShape(aShape, bShape);\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize);\n\n this.shaderKey = `binaryOpComplex_${op}`;\n this.op = op;\n }\n\n getUserCode(): string {\n const opStr = getBinaryOpString(this.op, false);\n const userCode = `\n fn binaryOpComplex(\n areal : f32, aimag : f32, breal : f32, bimag : f32) -> f32 {\n ${opStr}\n }\n\n ${main('index')} {\n if(index < uniforms.size) {\n let areal = getARealByOutputIndex(index);\n let aimag = getAImagByOutputIndex(index);\n let breal = getBRealByOutputIndex(index);\n let bimag = getBImagByOutputIndex(index);\n setOutputAtIndex(index, binaryOpComplex(areal, aimag, breal, bimag));\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, util} from '@tensorflow/tfjs-core';\n\nimport {BinaryOpType, getBinaryOpString} from './binary_op_util';\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class BinaryOpProgram implements WebGPUProgram {\n dispatch: [number, number, number];\n dispatchLayout: {x: number[]};\n isVec4: boolean;\n op: BinaryOpType;\n outputShape: number[];\n shaderKey: string;\n size = true;\n variableNames = ['A', 'B'];\n workGroupSize: [number, number, number];\n workPerThread: number;\n\n private lastDimensionSize: number;\n private useSharedMemoryWithA: boolean;\n private useSharedMemoryWithB: boolean;\n private type: string;\n\n constructor(op: BinaryOpType, aShape: number[], bShape: number[]) {\n this.outputShape = backend_util.assertAndGetBroadcastShape(aShape, bShape);\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.op = op;\n\n this.useSharedMemoryWithA =\n aShape.length <= 1 && bShape.length > 1 && aShape[0] < 128;\n this.useSharedMemoryWithB =\n bShape.length <= 1 && aShape.length > 1 && bShape[0] < 128;\n\n if (this.useSharedMemoryWithA || this.useSharedMemoryWithB) {\n this.isVec4 = false;\n // lastDimensionSize is used as sharedBuf array size, so can not be\n // used as uniform.\n this.lastDimensionSize =\n this.useSharedMemoryWithB ? bShape[0] : aShape[0];\n this.shaderKey = `binary_${this.type}_${op}_${this.lastDimensionSize}_${\n this.useSharedMemoryWithB}`;\n this.type = 'shared';\n // This is an experimental value when using shared memory.\n // Note that the maximum of workgroup X dimension is 256.\n this.workGroupSize = [256, 1, 1];\n this.workPerThread = 1;\n } else {\n if (util.arraysEqual(aShape, bShape) &&\n util.sizeFromShape(aShape) % 4 === 0) {\n this.isVec4 = true;\n this.type = 'vec4';\n this.workPerThread = 4;\n } else {\n this.isVec4 = false;\n this.type = 'plain';\n this.workPerThread = 1;\n }\n this.shaderKey = `binary_${this.type}_${op}`;\n // TODO(jiajia.qin@intel.com): Heuristically select a good work group\n // size.\n this.workGroupSize = [128, 1, 1];\n }\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize,\n [this.workPerThread, 1, 1]);\n }\n\n getUserCode(): string {\n let userCode;\n const dType = this.isVec4 ? 'vec4' : 'f32';\n const opFnStr = `\n fn binaryOperation(a : ${dType}, b : ${dType}) -> ${dType} {\n ${getBinaryOpString(this.op, this.isVec4)}\n };\n `;\n\n if (this.type === 'shared') {\n const sharedIndexSnippet = this.lastDimensionSize > 1 ?\n `coords[${this.outputShape.length - 1}]` :\n '0';\n const accessDataSnippet = this.useSharedMemoryWithB ?\n `let a = getAByOutputIndex(index);\n let b = sharedBuf[${sharedIndexSnippet}];` :\n `let a = sharedBuf[${sharedIndexSnippet}];\n let b = getBByOutputIndex(index);`;\n userCode = `\n ${opFnStr}\n var sharedBuf : array;\n ${main('index')} {\n // Fill in the shared memory buffer.\n let localIndex = i32(localId.x);\n if(localIndex < ${this.lastDimensionSize}) {\n sharedBuf[localIndex] = f32(${\n this.useSharedMemoryWithB ? 'B' : 'A'}[localIndex]);\n }\n workgroupBarrier();\n\n if(index < uniforms.size) {\n let coords = getCoordsFromIndex(index);\n ${accessDataSnippet}\n setOutputAtIndex(index, binaryOperation(a, b));\n }\n }\n `;\n } else {\n userCode = `\n ${opFnStr}\n ${main('index')} {\n if (index < uniforms.size) {\n let a = getAByOutputIndex(index);\n let b = getBByOutputIndex(index);\n setOutputAtIndex(index, binaryOperation(a, b));\n }\n }\n `;\n }\n\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Identity, IdentityInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\nimport {WebGPUBackend} from '../backend_webgpu';\n\nexport function identity(\n args: {inputs: IdentityInputs, backend: WebGPUBackend}): TensorInfo {\n const {inputs} = args;\n const {x} = inputs;\n\n args.backend.incRef(x.dataId);\n return {dataId: x.dataId, shape: x.shape, dtype: x.dtype};\n}\n\nexport const identityConfig: KernelConfig = {\n kernelName: Identity,\n backendName: 'webgpu',\n kernelFunc: identity as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Complex, ComplexInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {identity} from './Identity';\n\n/**\n * Complex tensors share data with their real and imaginary components. Complex\n * tensors' reference to the components is tracked by refCount on the individual\n * component. The refCounts are increased by the identity call.\n *\n * When a complex tensor is disposed, it will reduce the refCount on the\n * components by calling disposeData on each.\n */\nexport function complex(args: {inputs: ComplexInputs, backend: WebGPUBackend}):\n TensorInfo {\n const {inputs, backend} = args;\n const {real, imag} = inputs;\n\n const complexInfo = backend.makeTensorInfo(real.shape, 'complex64');\n const complex = backend.tensorMap.get(complexInfo.dataId);\n\n const realTensorInfo = identity({inputs: {x: real}, backend});\n\n const imagTensorInfo = identity({inputs: {x: imag}, backend});\n\n complex.complexTensorInfos = {real: realTensorInfo, imag: imagTensorInfo};\n\n return complexInfo;\n}\n\nexport const complexConfig: KernelConfig = {\n kernelName: Complex,\n backendName: 'webgpu',\n kernelFunc: complex as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getUnaryOpString, UnaryOpType} from './unary_op_util';\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class UnaryOpProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames = ['A'];\n workGroupSize: [number, number, number];\n op: UnaryOpType;\n uniforms?: string;\n size = true;\n\n constructor(outputShape: number[], op: UnaryOpType) {\n // TODO(jiajia.qin@intel.com): Heuristically select a good work group size.\n const workGroupSizeX = 128;\n this.workGroupSize = [workGroupSizeX, 1, 1];\n this.outputShape = outputShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize);\n this.op = op;\n this.shaderKey = `unary_${op}`;\n }\n\n getUserCode(): string {\n return `\n fn unaryOperation(a : f32) -> f32 {\n ${getUnaryOpString(this.op, false)}\n }\n ${main('index')} {\n if (index < uniforms.size) {\n let a = getAByOutputIndex(index);\n setOutputAtIndex(index, unaryOperation(a));\n }\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, BinaryInputs, DataType, KernelFunc, TensorInfo, TypedArray, UnaryInputs, upcastType} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {BinaryOpComplexProgram} from '../binary_op_complex_webgpu';\nimport {BinaryOpType} from '../binary_op_util';\nimport {BinaryOpProgram} from '../binary_op_webgpu';\nimport {complex} from '../kernels/Complex';\nimport {UnaryOpType} from '../unary_op_util';\nimport {UnaryOpProgram} from '../unary_op_webgpu';\n\nimport {SimpleBinaryKernelImplCPU, SimpleUnaryKernelImplCPU} from './shared';\n\ntype UnaryKernelFuncConfig = {\n opType: UnaryOpType,\n cpuKernelImpl?: SimpleUnaryKernelImplCPU,\n dtype?: DataType\n};\n\n/**\n * Template that creates a `KernelFunc` for unary ops.\n * @param opType Op type to create `UnaryOpProgram`.\n * @param cpuKernelImpl Optional. Shared functionality from tfjs-backend-cpu, it\n * will be involved when necessary.\n * @param dtype Optional. If set, the result has this dtype. Otherwise, the\n * result has the same dtype as the first input. This is mainly used in\n * comparison kernels, such as Equal, Less, Greater, etc.\n */\nexport function unaryKernelFunc(\n {opType, cpuKernelImpl, dtype}: UnaryKernelFuncConfig): KernelFunc {\n return ({inputs, backend}) => {\n const {x} = inputs as UnaryInputs;\n const webgpuBackend = backend as WebGPUBackend;\n\n const $dtype = dtype || x.dtype;\n if (webgpuBackend.shouldExecuteOnCPU([x]) && cpuKernelImpl != null) {\n const xData = webgpuBackend.tensorMap.get(x.dataId);\n const outValues = cpuKernelImpl(xData.values as TypedArray, $dtype);\n return webgpuBackend.makeTensorInfo(x.shape, $dtype, outValues);\n }\n\n const program: UnaryOpProgram = new UnaryOpProgram(x.shape, opType);\n return webgpuBackend.runWebGPUProgram(program, [x], $dtype);\n };\n}\n\ntype BinaryKernelFuncConfig = {\n opType: BinaryOpType,\n cpuKernelImpl?: SimpleBinaryKernelImplCPU,\n supportsComplex?: boolean,\n dtype?: DataType\n};\n\n/**\n * Template that creates a `KernelFunc` for binary ops.\n * @param opType Op type to create `BinaryOpProgram`.\n * @param cpuKernelImpl Optional. Shared functionality from tfjs-backend-cpu, it\n * will be involved when necessary.\n * @param dtype Optional. If set, the result has this dtype. Otherwise, the\n * result has the same dtype as the first input. This is mainly used in\n * comparison kernels, such as Equal, Less, Greater, etc.\n */\nexport function binaryKernelFunc(\n {opType, cpuKernelImpl, supportsComplex = false, dtype}:\n BinaryKernelFuncConfig): KernelFunc {\n return ({inputs, backend}) => {\n const {a, b} = inputs as BinaryInputs;\n const webgpuBackend = backend as WebGPUBackend;\n\n if (supportsComplex && a.dtype === 'complex64') {\n const aData = webgpuBackend.tensorMap.get(a.dataId);\n const bData = webgpuBackend.tensorMap.get(b.dataId);\n let real: TensorInfo, imag: TensorInfo;\n if (opType !== BinaryOpType.MUL) {\n [real, imag] = [\n [aData.complexTensorInfos.real, bData.complexTensorInfos.real],\n [aData.complexTensorInfos.imag, bData.complexTensorInfos.imag]\n ].map(complexParts => {\n const [aPart, bPart] = complexParts;\n\n const aHandle = {\n dataId: aPart.dataId,\n dtype: aPart.dtype,\n shape: a.shape\n };\n const bHandle = {\n dataId: bPart.dataId,\n dtype: bPart.dtype,\n shape: b.shape\n };\n\n const program = new BinaryOpProgram(opType, a.shape, b.shape);\n return webgpuBackend.runWebGPUProgram(\n program, [aHandle, bHandle],\n upcastType(aPart.dtype, bPart.dtype));\n });\n } else {\n const realProgram = new BinaryOpComplexProgram(\n BinaryOpType.COMPLEX_MULTIPLY_REAL, a.shape, b.shape);\n const imagProgram = new BinaryOpComplexProgram(\n BinaryOpType.COMPLEX_MULTIPLY_IMAG, a.shape, b.shape);\n\n const inputs = [\n {\n dataId: aData.complexTensorInfos.real.dataId,\n dtype: aData.complexTensorInfos.real.dtype,\n shape: a.shape\n },\n {\n dataId: aData.complexTensorInfos.imag.dataId,\n dtype: aData.complexTensorInfos.imag.dtype,\n shape: a.shape\n },\n {\n dataId: bData.complexTensorInfos.real.dataId,\n dtype: bData.complexTensorInfos.real.dtype,\n shape: b.shape\n },\n {\n dataId: bData.complexTensorInfos.imag.dataId,\n dtype: bData.complexTensorInfos.imag.dtype,\n shape: b.shape\n }\n ];\n\n real = webgpuBackend.runWebGPUProgram(realProgram, inputs, 'float32');\n imag = webgpuBackend.runWebGPUProgram(imagProgram, inputs, 'float32');\n }\n\n const complexOutput =\n complex({inputs: {real, imag}, backend: webgpuBackend});\n\n webgpuBackend.disposeData(real.dataId);\n webgpuBackend.disposeData(imag.dataId);\n\n // TODO: Implement CPU forwarding for complex inputs.\n\n return complexOutput;\n }\n\n const $dtype = dtype || upcastType(a.dtype, b.dtype);\n if ((a.dtype === 'string' || b.dtype === 'string' ||\n webgpuBackend.shouldExecuteOnCPU([a, b])) &&\n cpuKernelImpl != null) {\n const aData = webgpuBackend.tensorMap.get(a.dataId).values as TypedArray;\n const bData = webgpuBackend.tensorMap.get(b.dataId).values as TypedArray;\n const decodedAVals = a.dtype === 'string' ?\n // tslint:disable-next-line: no-any\n backend_util.fromUint8ToStringArray(aData as any as Uint8Array[]) :\n aData;\n const decodedBVals = a.dtype === 'string' ?\n // tslint:disable-next-line: no-any\n backend_util.fromUint8ToStringArray(bData as any as Uint8Array[]) :\n bData;\n const [outValues, outShape] =\n cpuKernelImpl(a.shape, b.shape, decodedAVals, decodedBVals, $dtype);\n\n return webgpuBackend.makeTensorInfo(outShape, $dtype, outValues);\n }\n const program = new BinaryOpProgram(opType, a.shape, b.shape);\n return webgpuBackend.runWebGPUProgram(program, [a, b], $dtype);\n };\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// Import shared functionality from tfjs-backend-cpu without triggering\n// side effects.\n// tslint:disable-next-line: no-imports-from-dist\nimport * as shared from '@tensorflow/tfjs-backend-cpu/dist/shared';\n// tslint:disable-next-line: no-imports-from-dist\nimport {SimpleBinaryKernelImpl} from '@tensorflow/tfjs-backend-cpu/dist/shared';\n// tslint:disable-next-line: no-imports-from-dist\nimport {SimpleUnaryImpl} from '@tensorflow/tfjs-backend-cpu/dist/utils/unary_types';\n\nexport type SimpleBinaryKernelImplCPU = SimpleBinaryKernelImpl;\nexport type SimpleUnaryKernelImplCPU = SimpleUnaryImpl;\nconst {\n addImpl: addImplCPU,\n castImpl: castImplCPU,\n ceilImpl: ceilImplCPU,\n concatImpl: concatImplCPU,\n equalImpl: equalImplCPU,\n expImpl: expImplCPU,\n expm1Impl: expm1ImplCPU,\n floorImpl: floorImplCPU,\n gatherNdImpl: gatherNdImplCPU,\n gatherV2Impl: gatherV2ImplCPU,\n greaterEqualImpl: greaterEqualImplCPU,\n greaterImpl: greaterImplCPU,\n lessEqualImpl: lessEqualImplCPU,\n lessImpl: lessImplCPU,\n logImpl: logImplCPU,\n maxImpl: maxImplCPU,\n maximumImpl: maximumImplCPU,\n minimumImpl: minimumImplCPU,\n multiplyImpl: multiplyImplCPU,\n negImpl: negImplCPU,\n notEqualImpl: notEqualImplCPU,\n prodImpl: prodImplCPU,\n rangeImpl: rangeImplCPU,\n rsqrtImpl: rsqrtImplCPU,\n scatterImpl: scatterImplCPU,\n simpleAbsImpl: simpleAbsImplCPU,\n sliceImpl: sliceImplCPU,\n stridedSliceImpl: stridedSliceImplCPU,\n stringNGramsImpl: stringNGramsImplCPU,\n subImpl: subImplCPU,\n tileImpl: tileImplCPU,\n topKImpl: topKImplCPU,\n transposeImpl: transposeImplCPU,\n uniqueImpl: uniqueImplCPU,\n} = shared;\n\nexport {\n addImplCPU,\n castImplCPU,\n ceilImplCPU,\n concatImplCPU,\n equalImplCPU,\n expImplCPU,\n expm1ImplCPU,\n floorImplCPU,\n gatherNdImplCPU,\n gatherV2ImplCPU,\n greaterEqualImplCPU,\n greaterImplCPU,\n lessEqualImplCPU,\n lessImplCPU,\n logImplCPU,\n maxImplCPU,\n maximumImplCPU,\n minimumImplCPU,\n multiplyImplCPU,\n prodImplCPU,\n negImplCPU,\n notEqualImplCPU,\n scatterImplCPU,\n simpleAbsImplCPU,\n sliceImplCPU,\n stridedSliceImplCPU,\n stringNGramsImplCPU,\n subImplCPU,\n rangeImplCPU,\n rsqrtImplCPU,\n tileImplCPU,\n topKImplCPU,\n transposeImplCPU,\n uniqueImplCPU,\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Abs, KernelConfig} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {simpleAbsImplCPU} from '../kernel_utils/shared';\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const abs =\n unaryKernelFunc({opType: UnaryOpType.ABS, cpuKernelImpl: simpleAbsImplCPU});\n\nexport const absConfig: KernelConfig = {\n kernelName: Abs,\n backendName: 'webgpu',\n kernelFunc: abs\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Add, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {BinaryOpType} from '../binary_op_util';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {addImplCPU as cpuAdd} from '../kernel_utils/shared';\n\nexport const addKernelFunc = binaryKernelFunc(\n {opType: BinaryOpType.ADD, cpuKernelImpl: cpuAdd, supportsComplex: true});\n\nexport const addConfig: KernelConfig = {\n kernelName: Add,\n backendName: 'webgpu',\n kernelFunc: addKernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class AddNPackedProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames: string[];\n workPerThread = 1;\n workGroupSize: [number, number, number] = [64, 1, 1];\n size = true;\n\n constructor(shapes: number[][]) {\n this.outputShape = shapes[0];\n this.variableNames = shapes.map((_, i) => `T${i}`);\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize,\n [this.workPerThread, 1, 1]);\n this.shaderKey = 'addN';\n }\n\n getUserCode(): string {\n const snippets: string[] = [];\n // Get target elements from every input tensor.\n this.variableNames.forEach(variable => {\n snippets.push(`let v${variable} = get${variable}ByOutputCoords(coords);`);\n });\n // Calculate the sum of all elements.\n const operation = this.variableNames\n .map(variable => {\n return `v${variable}`;\n })\n .join(' + ');\n\n const userCode = `\n ${main('index')} {\n for (var i = 0; i < ${this.workPerThread}; i = i + 1) {\n let flatIndex = index * ${this.workPerThread} + i;\n if (flatIndex < uniforms.size) {\n let coords = getCoordsFromIndex(flatIndex);\n ${snippets.join('\\n ')}\n setOutputAtIndex(flatIndex, ${operation});\n }\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {AddN, AddNInputs, KernelConfig, KernelFunc, TensorInfo, upcastType} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\n\nimport {AddNPackedProgram} from '../addn_packed_webgpu';\nimport {identity} from './Identity';\n\nexport function addN(args: {inputs: AddNInputs, backend: WebGPUBackend}):\n TensorInfo {\n const {inputs, backend} = args;\n\n const tensors = inputs;\n if (tensors.length === 1) {\n return identity({inputs: {x: tensors[0]}, backend});\n }\n\n const dtype =\n tensors.map(t => t.dtype).reduce((d1, d2) => upcastType(d1, d2));\n const shapes = tensors.map(t => t.shape);\n const program = new AddNPackedProgram(shapes);\n return backend.runWebGPUProgram(program, tensors, dtype);\n}\n\nexport const addNConfig: KernelConfig = {\n kernelName: AddN,\n backendName: 'webgpu',\n kernelFunc: addN as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, util} from '@tensorflow/tfjs-core';\nimport {getCoordsXYZ, getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class ArgMinMaxProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n workGroupSize: [number, number, number] = [64, 1, 1];\n variableNames = ['x'];\n uniforms = 'infinityValue : f32,';\n inputShape: number[];\n reductionFactor: number;\n op: string;\n size = true;\n private type: string;\n\n constructor(inputShape: number[], axis: number, reduceType: 'min'|'max') {\n const axes = [axis];\n\n this.op = reduceType === 'min' ? '<' : '>';\n\n // |outShape| is the shape with the removed axis\n const [outputShape, reduceShape] =\n backend_util.computeOutAndReduceShapes(inputShape, axes);\n\n this.outputShape = outputShape.length === 0 ? [1] : outputShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n // The shared algorithm is mainly used for large reduce size. It fully\n // utilizes the threads in one workgroup to do the reduction. However,\n // when the reduce size is very small or the output shape is too large. It's\n // better to use the plain algorithm to reduce the number of workgroups to\n // speedup. The threthold can be further tuned.\n if (util.sizeFromShape(reduceShape) < 32 ||\n util.sizeFromShape(outputShape) > 1000) {\n this.type = 'plain';\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize);\n } else {\n this.type = 'shared';\n // A work group only outputs a data, so we transfer [1, 1, 1] to compute\n // dispatch size.\n this.dispatch =\n computeDispatch(this.dispatchLayout, this.outputShape, [1, 1, 1]);\n }\n\n this.inputShape = inputShape;\n this.shaderKey = `argMinMax_${this.op}_${this.type}`;\n }\n\n getUserCode(): string {\n const getInputShapeLastDim = () => {\n if (this.inputShape.length === 1) {\n return 'uniforms.xShape';\n } else {\n return `uniforms.xShape.${getCoordsXYZ(this.inputShape.length - 1)}`;\n }\n };\n\n const splitOutputCoords = () => {\n let snippet = '';\n if (this.outputShape.length === 1) {\n if (this.inputShape.length !== 1) {\n snippet += 'outputCoords,';\n }\n } else {\n for (let i = 0; i < this.outputShape.length; i++) {\n snippet += `outputCoords.${getCoordsXYZ(i)},`;\n }\n }\n return snippet;\n };\n\n if (this.type === 'shared') {\n const sharedMemorySnippet = `\n var xBestIndices : array;\n var xBestValues : array;\n `;\n const userCode = `\n fn DIV_CEIL(a : u32, b : u32) -> u32 {\n return ((a - 1u) / b + 1u);\n }\n\n ${sharedMemorySnippet}\n\n ${main('index')} {\n let outputIndex = index / i32(workGroupSizeX);\n let reduceLength = ${getInputShapeLastDim()};\n\n var bestIndex = i32(localId.x);\n var bestValue = uniforms.infinityValue;\n let outputCoords = getCoordsFromIndex(outputIndex);\n for (var k = i32(localId.x); k < reduceLength && outputIndex < uniforms.size;\n k = k + i32(workGroupSizeX)) {\n let candidate = getX(${splitOutputCoords()} k);\n if (!isnan(candidate) && candidate ${this.op} bestValue) {\n bestValue = candidate;\n bestIndex = k;\n }\n }\n xBestValues[localId.x] = bestValue;\n xBestIndices[localId.x] = bestIndex;\n workgroupBarrier();\n\n var reduceSize = min(u32(reduceLength), workGroupSizeX);\n for (var currentSize = reduceSize / 2u; reduceSize > 1u;\n currentSize = reduceSize / 2u) {\n let interval = DIV_CEIL(reduceSize, 2u);\n if (localId.x < currentSize) {\n let candidate = xBestValues[localId.x + interval];\n if (candidate ${this.op} bestValue) {\n bestValue = candidate;\n xBestValues[localId.x] = bestValue;\n xBestIndices[localId.x] = xBestIndices[localId.x + interval];\n }\n }\n reduceSize = interval;\n workgroupBarrier();\n }\n\n if (localId.x == 0u && outputIndex < uniforms.size) {\n setOutputAtIndexI32(outputIndex, xBestIndices[localId.x]);\n }\n }\n `;\n return userCode;\n } else {\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n let outputCoords = getCoordsFromIndex(index);\n var bestIndex = 0;\n var bestValue = getX(${splitOutputCoords()} 0);\n let reduceLength = ${getInputShapeLastDim()};\n for (var i = 1; i < reduceLength; i++) {\n let candidate = getX(${splitOutputCoords()} i);\n if (candidate ${this.op} bestValue) {\n bestValue = candidate;\n bestIndex = i;\n }\n }\n setOutputAtIndexI32(index, bestIndex);\n }\n }\n `;\n return userCode;\n }\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getWorkGroupSizeString, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch} from './webgpu_util';\n\nexport class TransposeSharedProgram implements WebGPUProgram {\n variableNames = ['A'];\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[], y: number[]};\n dispatch: [number, number, number];\n // Note that the maximum number of workgroup invocations by webgpu is 256.\n workGroupSize: [number, number, number] = [16, 16, 1];\n\n constructor(aShape: number[], newDim: number[]) {\n const outputShape: number[] = new Array(aShape.length);\n for (let i = 0; i < outputShape.length; i++) {\n outputShape[i] = aShape[newDim[i]];\n }\n this.outputShape = outputShape;\n this.dispatchLayout = {x: [0], y: [1]};\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize, [1, 1, 1]);\n\n this.shaderKey = 'transposeShared';\n }\n\n getUserCode(): string {\n const userCode = `\n const TILE_DIM = ${this.workGroupSize[0]};\n var tile : array, ${\n this.workGroupSize[0]}>;\n ${getWorkGroupSizeString()}\n fn _start(@builtin(local_invocation_id) localId : vec3,\n @builtin(workgroup_id) workgroupId : vec3) {\n var x = i32(workgroupId.x) * TILE_DIM + i32(localId.x);\n var y = i32(workgroupId.y) * TILE_DIM + i32(localId.y);\n let width = uniforms.outShape[0];\n let height = uniforms.outShape[1];\n if (x < width && y < height) {\n tile[localId.y][localId.x] = A[y * width + x];\n }\n workgroupBarrier();\n\n x = i32(workgroupId.y) * TILE_DIM + i32(localId.x);\n y = i32(workgroupId.x) * TILE_DIM + i32(localId.y);\n if (x < height && y < width) {\n setOutputAtIndex((y * height + x), tile[localId.x]\n [localId.y]);\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getCoordsDataType, getCoordsXYZ, getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class TransposeProgram implements WebGPUProgram {\n variableNames = ['A'];\n shaderKey: string;\n outputShape: number[];\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n workPerThread = 1;\n workGroupSize: [number, number, number] = [64, 1, 1];\n newDim: number[];\n size = true;\n\n constructor(aShape: number[], newDim: number[]) {\n const outputShape: number[] = new Array(aShape.length);\n for (let i = 0; i < outputShape.length; i++) {\n outputShape[i] = aShape[newDim[i]];\n }\n this.outputShape = outputShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize,\n [this.workPerThread, 1, 1]);\n\n this.newDim = newDim;\n this.shaderKey = `transpose_${newDim}`;\n }\n\n getUserCode(): string {\n const dtype = getCoordsDataType(this.outputShape.length);\n const switched = getSwitchedCoords(this.newDim);\n\n const userCode = `\n ${main('index')} {\n for(var i = 0; i < ${this.workPerThread}; i = i + 1) {\n let flatIndex = index * ${this.workPerThread} + i;\n if(flatIndex < uniforms.size) {\n let resRC = getCoordsFromIndex(flatIndex);\n setOutputAtIndex(flatIndex, A[getIndexFromCoords${\n this.outputShape.length}D(\n ${dtype}(${switched}), uniforms.aShape)]);\n }\n }\n }\n `;\n return userCode;\n }\n}\n\nfunction getSwitchedCoords(newDim: number[]): string {\n const rank = newDim.length;\n if (rank > 6) {\n throw Error(`Transpose for rank ${rank} is not yet supported`);\n }\n const switchedCoords = new Array(rank);\n for (let i = 0; i < newDim.length; i++) {\n switchedCoords[newDim[i]] = `resRC.${getCoordsXYZ(i)}`;\n }\n\n return switchedCoords.join();\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Transpose, TransposeAttrs, TransposeInputs, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {transposeImplCPU as cpuTranspose} from '../kernel_utils/shared';\n\nimport {TransposeSharedProgram} from '../transpose_shared_webgpu';\nimport {TransposeProgram} from '../transpose_webgpu';\n\nexport function transpose(args: {\n inputs: TransposeInputs,\n attrs: TransposeAttrs,\n backend: WebGPUBackend\n}) {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {perm} = attrs;\n const webgpuBackend = backend;\n\n const xRank = x.shape.length;\n const newShape: number[] = new Array(xRank);\n for (let i = 0; i < newShape.length; i++) {\n newShape[i] = x.shape[perm[i]];\n }\n if (backend.shouldExecuteOnCPU([x])) {\n const xData = webgpuBackend.tensorMap.get(x.dataId);\n const values = xData.values as TypedArray;\n const outValues = cpuTranspose(values, x.shape, x.dtype, perm, newShape);\n return backend.makeTensorInfo(newShape, x.dtype, outValues);\n }\n if (x.shape.length === 2 && util.arraysEqual(perm, [1, 0])) {\n const program = new TransposeSharedProgram(x.shape, perm);\n return webgpuBackend.runWebGPUProgram(program, [x], x.dtype);\n }\n const program = new TransposeProgram(x.shape, perm);\n return webgpuBackend.runWebGPUProgram(program, [x], x.dtype);\n}\n\nexport const transposeConfig: KernelConfig = {\n kernelName: Transpose,\n backendName: 'webgpu',\n kernelFunc: transpose as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ArgMax, ArgMaxAttrs, ArgMaxInputs, backend_util, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {ArgMinMaxProgram} from '../argminmax_webgpu';\nimport {WebGPUBackend} from '../backend_webgpu';\n\nimport {transpose} from './Transpose';\n\nexport function argMax(\n args: {inputs: ArgMaxInputs, backend: WebGPUBackend, attrs: ArgMaxAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {axis} = attrs;\n\n let axes = util.parseAxisParam(axis, x.shape);\n const permutedAxes = backend_util.getAxesPermutation(axes, x.shape.length);\n let $x = x;\n const intermediateTensorInfos = [];\n if (permutedAxes != null) {\n $x = transpose({inputs: {x}, backend, attrs: {perm: permutedAxes}});\n intermediateTensorInfos.push($x);\n axes = backend_util.getInnerMostAxes(axes.length, $x.shape.length);\n }\n\n backend_util.assertAxesAreInnerMostDims('argMax', [axes[0]], $x.shape.length);\n const program = new ArgMinMaxProgram($x.shape, axes[0], 'max');\n const uniformData = [{type: 'float32', data: [Number.NEGATIVE_INFINITY]}];\n const out = backend.runWebGPUProgram(program, [$x], 'int32', uniformData);\n intermediateTensorInfos.forEach(t => backend.disposeData(t.dataId));\n return out;\n}\n\nexport const argMaxConfig: KernelConfig = {\n kernelName: ArgMax,\n backendName: 'webgpu',\n kernelFunc: argMax as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ArgMin, ArgMinAttrs, ArgMinInputs, backend_util, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {ArgMinMaxProgram} from '../argminmax_webgpu';\nimport {WebGPUBackend} from '../backend_webgpu';\n\nimport {transpose} from './Transpose';\n\nexport function argMin(\n args: {inputs: ArgMinInputs, backend: WebGPUBackend, attrs: ArgMinAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {axis} = attrs;\n\n let axes = util.parseAxisParam(axis, x.shape);\n const permutedAxes = backend_util.getAxesPermutation(axes, x.shape.length);\n let $x = x;\n const intermediateTensorInfos = [];\n if (permutedAxes != null) {\n $x = transpose({inputs: {x}, backend, attrs: {perm: permutedAxes}});\n intermediateTensorInfos.push($x);\n axes = backend_util.getInnerMostAxes(axes.length, $x.shape.length);\n }\n\n backend_util.assertAxesAreInnerMostDims('argMin', [axes[0]], $x.shape.length);\n const program = new ArgMinMaxProgram($x.shape, axes[0], 'min');\n const uniformData = [{type: 'float32', data: [Number.POSITIVE_INFINITY]}];\n const out = backend.runWebGPUProgram(program, [$x], 'int32', uniformData);\n intermediateTensorInfos.forEach(t => backend.disposeData(t.dataId));\n return out;\n}\n\nexport const argMinConfig: KernelConfig = {\n kernelName: ArgMin,\n backendName: 'webgpu',\n kernelFunc: argMin as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Atan2, KernelConfig} from '@tensorflow/tfjs-core';\nimport {BinaryOpType} from '../binary_op_util';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nexport const atan2 = binaryKernelFunc({opType: BinaryOpType.ATAN2});\n\nexport const atan2Config: KernelConfig = {\n kernelName: Atan2,\n backendName: 'webgpu',\n kernelFunc: atan2\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class Pool2DProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames = ['x'];\n uniforms =\n `stride : vec2, pad : vec2, dilation : vec2, convDims : vec2, filterDims : vec2,`;\n // TODO(jiajia.qin@intel.com): Dynamically choose different workGroupSize for\n // different output shapes.\n workGroupSize: [number, number, number] = [128, 1, 1];\n poolType: 'max'|'avg';\n size = true;\n\n constructor(convInfo: backend_util.Conv2DInfo, poolType: 'max'|'avg') {\n this.outputShape = convInfo.outShape;\n\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize);\n\n this.shaderKey = `pool2D_${poolType}`;\n this.poolType = poolType;\n }\n\n getUserCode(): string {\n let updateSnippet = `resultValue = max(value, resultValue);`;\n if (this.poolType === 'avg') {\n updateSnippet = `resultValue = resultValue + value; count = count + 1.0;`;\n }\n\n let returnValue = `resultValue`;\n if (this.poolType === 'avg') {\n returnValue = `resultValue / count`;\n }\n\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n let coords = getCoordsFromIndex(index);\n let batch = coords[0];\n let xRCCorner = vec2(coords.yz) * uniforms.stride - uniforms.pad;\n let xRCorner = xRCCorner.x;\n let xCCorner = xRCCorner.y;\n\n var resultValue = ${\n this.poolType === 'avg' ? '0.0' : '-1.0 / pow(10.0, -20.0)'};\n var count = 0.0;\n\n for (var wR = 0; wR < uniforms.filterDims.x; wR = wR + uniforms.dilation.x) {\n let xR = xRCorner + wR;\n\n if (xR < 0 || xR >= uniforms.convDims.x) {\n continue;\n }\n\n for (var wC = 0; wC < uniforms.filterDims.y; wC = wC + uniforms.dilation.y) {\n let xC = xCCorner + wC;\n if (xC < 0 || xC >= uniforms.convDims.y) {\n continue;\n }\n\n let value = getX(batch, xR, xC, coords[3]);\n ${updateSnippet}\n }\n }\n\n setOutputAtIndex(index, ${returnValue});\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class PoolWithFilterSizeEqualsOneProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames = ['x'];\n uniforms = `stride : vec2,`;\n workGroupSize: [number, number, number] = [256, 1, 1];\n size = true;\n\n constructor(convInfo: backend_util.Conv2DInfo) {\n this.outputShape = convInfo.outShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize);\n\n this.shaderKey = 'poolWithFilterSizeEqualsOne';\n }\n\n getUserCode(): string {\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n let coords = getCoordsFromIndex(index);\n let batch = coords[0];\n let d = coords[3];\n\n let xRCCorner = coords.yz * uniforms.stride;\n let xRCorner = xRCCorner.x;\n let xCCorner = xRCCorner.y;\n\n let value = getX(batch, xRCorner, xCCorner, d);\n setOutputAtIndex(index, value);\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class ReduceProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n workGroupSize: [number, number, number] = [64, 1, 1];\n variableNames = ['x'];\n uniforms = 'reduceSize : i32,';\n reduceType: 'max'|'mean'|'min'|'prod'|'sum';\n inputShape: number[];\n size = true;\n\n constructor(\n reduceInfo: backend_util.ReduceInfo,\n reduceType: 'max'|'mean'|'min'|'prod'|'sum') {\n this.inputShape = [reduceInfo.batchSize, reduceInfo.inSize];\n const [outputShape, ] =\n backend_util.computeOutAndReduceShapes(this.inputShape, [1]);\n this.outputShape = outputShape.length === 0 ? [1] : outputShape;\n\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n // A work group only outputs a data, so we transfer [1, 1, 1] to compute\n // dispatch size.\n this.dispatch =\n computeDispatch(this.dispatchLayout, this.outputShape, [1, 1, 1]);\n\n this.reduceType = reduceType;\n this.shaderKey = `reduce_${reduceType}`;\n }\n\n getUserCode(): string {\n let reduceOp = ``;\n let initValue = '0.0';\n if (this.reduceType === 'min' || this.reduceType === 'max') {\n reduceOp = `\n if (isnan(candidate)) {\n bestValue = uniforms.NAN;\n } else if (!isnan(bestValue) && candidate ${\n this.reduceType === 'min' ? '<' : '>'} bestValue)\n { bestValue = candidate; }`;\n initValue = 'f32(x[offset])';\n } else if (this.reduceType === 'sum' || this.reduceType === 'mean') {\n reduceOp = ' bestValue = bestValue + candidate; ';\n } else if (this.reduceType === 'prod') {\n reduceOp = ' bestValue = bestValue * candidate; ';\n initValue = '1.0';\n }\n\n const outputSnippet = this.reduceType === 'mean' ?\n // tslint:disable-next-line:max-line-length\n `setOutputAtIndex(outputIndex, bestValue / f32(uniforms.reduceSize));` :\n `setOutputAtIndex(outputIndex, bestValue);`;\n\n const sharedMemorySnippet = `\n var xBestValues : array;\n `;\n\n const userCode = `\n fn DIV_CEIL(a : u32, b : u32) -> u32 {\n return ((a - 1u) / b + 1u);\n }\n\n ${sharedMemorySnippet}\n fn getOffset(outputIndex : i32) -> i32 {\n let outputCoords = getCoordsFromIndex(outputIndex);\n let offset = ${\n this.outputShape.length === 1 ?\n 'outputCoords' :\n 'outputCoords[0]'} * uniforms.reduceSize;\n return offset;\n }\n ${main('index')} {\n let outputIndex = index / i32(workGroupSizeX);\n let offset = getOffset(outputIndex);\n var bestValue = ${initValue};\n let Length = uniforms.reduceSize;\n let WorkPerThread = DIV_CEIL(u32(Length), workGroupSizeX);\n for (var k = i32(localId.x); k < Length && outputIndex < uniforms.size;\n k = k + i32(workGroupSizeX)) {\n let candidate = f32(x[offset + k]);\n ${reduceOp}\n }\n xBestValues[localId.x] = bestValue;\n workgroupBarrier();\n\n var reduceSize = min(u32(Length), workGroupSizeX);\n for (var currentSize = reduceSize / 2u; reduceSize > 1u;\n currentSize = reduceSize / 2u) {\n let interval = DIV_CEIL(reduceSize, 2u);\n if (localId.x < currentSize) {\n let candidate = xBestValues[localId.x + interval];\n ${reduceOp}\n xBestValues[localId.x] = bestValue;\n }\n reduceSize = interval;\n workgroupBarrier();\n }\n\n if (localId.x == 0u && outputIndex < uniforms.size) {\n ${outputSnippet}\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, sumOutType, TensorInfo, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {maxImplCPU} from './shared';\nimport {prodImplCPU} from './shared';\nimport {ReduceProgram} from '../reduce_webgpu';\nimport {reshape} from '../kernels/Reshape';\nimport {transpose} from '../kernels/Transpose';\n\ntype ReduceTypes = 'max'|'mean'|'min'|'prod'|'sum';\n\nexport function reduce(\n x: TensorInfo, axis: number|number[], keepDims: boolean,\n reduceType: ReduceTypes, backend: WebGPUBackend): TensorInfo {\n const xRank = x.shape.length;\n const toDispose = [];\n\n const origAxes = util.parseAxisParam(axis, x.shape);\n let axes = origAxes;\n const permutedAxes = backend_util.getAxesPermutation(axes, xRank);\n\n let input = x;\n if (permutedAxes != null) {\n input = transpose({inputs: {x}, attrs: {perm: permutedAxes}, backend});\n axes = backend_util.getInnerMostAxes(axes.length, xRank);\n toDispose.push(input);\n }\n\n backend_util.assertAxesAreInnerMostDims(reduceType, axes, xRank);\n\n const [reduceOutShape, reduceShape] =\n backend_util.computeOutAndReduceShapes(input.shape, axes);\n let resOutShape = reduceOutShape;\n if (keepDims) {\n // rather than reshape at the end, set the target shape here.\n resOutShape = backend_util.expandShapeToKeepDim(reduceOutShape, origAxes);\n }\n\n let res;\n if ((reduceType === 'max' || reduceType === 'prod') &&\n backend.shouldExecuteOnCPU([input])) {\n const xVals = backend.tensorMap.get(input.dataId).values as TypedArray;\n switch (reduceType) {\n case 'max':\n const outValues = maxImplCPU(\n xVals, util.sizeFromShape(reduceShape), resOutShape, x.dtype);\n res = backend.makeTensorInfo(resOutShape, x.dtype, outValues);\n break;\n case 'prod':\n const {outVals, outShape, outDtype} =\n prodImplCPU(input.shape, input.dtype, xVals, axes);\n res = backend.makeTensorInfo(outShape, outDtype, outVals);\n break;\n default:\n throw new Error(\n `${reduceType} CPU implementation is not yet supported.`);\n }\n } else {\n const inSize = util.sizeFromShape(reduceShape);\n const xSize = util.sizeFromShape(input.shape);\n const batchSize = xSize / inSize;\n\n const reduceInfo = {windowSize: inSize, inSize, batchSize, outSize: 1};\n const dtype = reduceType === 'mean' ? 'float32' : sumOutType(x.dtype);\n const uniformData = [\n {type: 'int32', data: [inSize]},\n ];\n const program = new ReduceProgram(reduceInfo, reduceType);\n const reduced =\n backend.runWebGPUProgram(program, [input], dtype, uniformData);\n toDispose.push(reduced);\n\n res = reshape({inputs: {x: reduced}, attrs: {shape: resOutShape}, backend});\n }\n\n toDispose.forEach(t => backend.disposeData(t.dataId));\n\n return res;\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Max, MaxAttrs, MaxInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {reduce} from '../kernel_utils/reduce';\n\nexport function max(\n args: {inputs: MaxInputs, backend: WebGPUBackend, attrs: MaxAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {reductionIndices, keepDims} = attrs;\n\n return reduce(x, reductionIndices, keepDims, 'max', backend);\n}\n\nexport const maxConfig: KernelConfig = {\n kernelName: Max,\n backendName: 'webgpu',\n kernelFunc: max as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Mean, MeanAttrs, MeanInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {reduce} from '../kernel_utils/reduce';\n\nexport function mean(\n args: {inputs: MeanInputs, attrs: MeanAttrs, backend: WebGPUBackend}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {keepDims, axis} = attrs;\n\n return reduce(x, axis, keepDims, 'mean', backend);\n}\n\nexport const meanConfig: KernelConfig = {\n kernelName: Mean,\n backendName: 'webgpu',\n kernelFunc: mean as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {backend_util, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {Pool2DProgram} from '../pool2d_webgpu';\nimport {PoolWithFilterSizeEqualsOneProgram} from '../pool_filtersizeone_webgpu';\n\nimport {identity} from './Identity';\nimport {max} from './Max';\nimport {mean} from './Mean';\nimport {reshape} from './Reshape';\n\ntype PoolType = 'max'|'avg';\nexport function poolImpl(\n x: TensorInfo, convInfo: backend_util.Conv2DInfo, poolType: PoolType,\n backend: WebGPUBackend): TensorInfo {\n if (convInfo.filterWidth === 1 && convInfo.filterHeight === 1 &&\n util.arraysEqual(convInfo.inShape, convInfo.outShape)) {\n return identity({inputs: {x}, backend});\n }\n\n if (convInfo.filterWidth === convInfo.inWidth &&\n convInfo.filterHeight === convInfo.inHeight && convInfo.batchSize === 1 &&\n convInfo.padInfo.type === 'VALID') {\n const length = x.shape.length;\n const reshapeX = reshape({\n inputs: {x},\n backend,\n attrs: {\n shape: [\n x.shape[length - 3] * x.shape[length - 2] /* height * width */,\n x.shape[length - 1] /* channel */\n ]\n }\n });\n let reduceX;\n if (poolType === 'avg') {\n reduceX = mean(\n {inputs: {x: reshapeX}, backend, attrs: {axis: 0, keepDims: false}});\n } else {\n util.assert(poolType === 'max', () => `Invalid pool type ${poolType}`);\n reduceX = max({\n inputs: {x: reshapeX},\n backend,\n attrs: {reductionIndices: 0, keepDims: false}\n });\n }\n\n const result = reshape(\n {inputs: {x: reduceX}, backend, attrs: {shape: convInfo.outShape}});\n backend.disposeData(reshapeX.dataId);\n backend.disposeData(reduceX.dataId);\n return result;\n }\n\n let program: Pool2DProgram|PoolWithFilterSizeEqualsOneProgram;\n const dimensions =\n [{type: 'int32', data: [convInfo.strideHeight, convInfo.strideWidth]}];\n if (convInfo.filterHeight === 1 && convInfo.filterWidth === 1) {\n program = new PoolWithFilterSizeEqualsOneProgram(convInfo);\n } else {\n if (poolType === 'avg') {\n program = new Pool2DProgram(convInfo, 'avg');\n } else {\n util.assert(poolType === 'max', () => `Invalid pool type ${poolType}`);\n program = new Pool2DProgram(convInfo, 'max');\n }\n\n dimensions.push(\n {type: 'int32', data: [convInfo.padInfo.top, convInfo.padInfo.left]}, {\n type: 'int32',\n data: [convInfo.dilationHeight, convInfo.dilationWidth]\n },\n {type: 'int32', data: [convInfo.inHeight, convInfo.inWidth]}, {\n type: 'int32',\n data: [convInfo.effectiveFilterHeight, convInfo.effectiveFilterWidth]\n });\n }\n\n return backend.runWebGPUProgram(program, [x], x.dtype, dimensions);\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {AvgPool, AvgPoolAttrs, AvgPoolInputs, backend_util, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {poolImpl} from './Pool_impl';\n\nexport function avgPool(\n args: {inputs: AvgPoolInputs, backend: WebGPUBackend, attrs: AvgPoolAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {filterSize, strides, pad, dimRoundingMode} = attrs;\n const dilations = 1;\n const convInfo = backend_util.computePool2DInfo(\n x.shape as [number, number, number, number], filterSize, strides,\n dilations, pad, dimRoundingMode);\n\n return poolImpl(x, convInfo, 'avg', backend);\n}\n\nexport const avgPoolConfig: KernelConfig = {\n kernelName: AvgPool,\n backendName: 'webgpu',\n kernelFunc: avgPool as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {BatchMatMul, BatchMatMulAttrs, BatchMatMulInputs, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {batchMatMulImpl} from './BatchMatMul_impl';\n\nexport function batchMatMul(args: {\n inputs: BatchMatMulInputs,\n attrs: BatchMatMulAttrs,\n backend: WebGPUBackend\n}) {\n const {inputs, backend, attrs} = args;\n const {a, b} = inputs;\n const {transposeA, transposeB} = attrs;\n\n return batchMatMulImpl({a, b, transposeA, transposeB, backend});\n}\n\nexport const batchMatMulConfig: KernelConfig = {\n kernelName: BatchMatMul,\n backendName: 'webgpu',\n kernelFunc: batchMatMul as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getCoordsDataType, getCoordsXYZ, getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class SliceProgram implements WebGPUProgram {\n variableNames = ['source'];\n uniforms: string;\n outputShape: number[];\n shaderKey: string;\n rank: number;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n workPerThread = 1;\n workGroupSize: [number, number, number] = [64, 1, 1];\n start: number[];\n size = true;\n\n constructor(start: number[], destSize: number[]) {\n this.outputShape = destSize;\n this.rank = destSize.length;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize,\n [this.workPerThread, 1, 1]);\n\n this.start = start;\n this.uniforms = `start : ${getCoordsDataType(start.length)}, `;\n this.shaderKey = 'slice';\n }\n\n getUserCode(): string {\n const dtype = getCoordsDataType(this.rank);\n const sourceCoords = getCoords(this.rank);\n let coordSum;\n if (this.start.length === 1) {\n coordSum = this.outputShape.map((_, i) => {\n return `sourceLoc = uniforms.start + coords;`;\n });\n } else {\n coordSum = this.outputShape.map((_, i) => {\n return `sourceLoc.${coords[i]} = uniforms.start.${\n getCoordsXYZ(i)} + coords.${coords[i]};`;\n });\n }\n\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n var sourceLoc : ${dtype};\n let coords = getCoordsFromIndex(index);\n ${coordSum.join('\\n')}\n setOutputAtIndex(index, getSource(${sourceCoords}));\n }\n }\n `;\n return userCode;\n }\n}\n\nconst coords = ['x', 'y', 'z', 'w', 'u', 'v'];\n\nfunction getCoords(rank: number): string {\n if (rank === 1) {\n return 'sourceLoc';\n } else if (rank <= 6) {\n return coords.slice(0, rank).map(coord => `sourceLoc.${coord}`).join(',');\n } else {\n throw Error(`Slicing for rank ${rank} is not yet supported`);\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Slice, slice_util, SliceAttrs, SliceInputs, TensorInfo, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {sliceImplCPU} from '../kernel_utils/shared';\nimport {SliceProgram} from '../slice_webgpu';\n\nexport function slice(\n args: {inputs: SliceInputs, backend: WebGPUBackend, attrs: SliceAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {begin, size} = attrs;\n\n const [$begin, $size] = slice_util.parseSliceParams(x, begin, size);\n slice_util.assertParamsValid(x, $begin, $size);\n\n if (backend.shouldExecuteOnCPU([x]) || x.dtype === 'string') {\n const xBufferInfo = backend.tensorMap.get(x.dataId);\n const outValues = sliceImplCPU(\n xBufferInfo.values as TypedArray, $begin, $size, x.shape, x.dtype);\n return backend.makeTensorInfo($size, x.dtype, outValues);\n }\n\n if (util.sizeFromShape($size) === 0) {\n return backend.makeTensorInfo($size, x.dtype, []);\n }\n\n // TODO(xing.xu): Add shadow slice support.\n const program = new SliceProgram($begin, $size);\n const uniformData = [{type: 'int32', data: $begin}];\n return backend.runWebGPUProgram(program, [x], x.dtype, uniformData);\n}\n\nexport const sliceConfig: KernelConfig = {\n kernelName: Slice,\n backendName: 'webgpu',\n kernelFunc: slice as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, BatchToSpaceND, BatchToSpaceNDAttrs, BatchToSpaceNDInputs, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\n\nimport {reshape} from './Reshape';\nimport {slice} from './Slice';\nimport {transpose} from './Transpose';\n\nexport const batchToSpaceND = (args: {\n inputs: BatchToSpaceNDInputs,\n backend: WebGPUBackend,\n attrs: BatchToSpaceNDAttrs\n}): TensorInfo => {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {blockShape, crops} = attrs;\n\n util.assert(\n x.shape.length <= 4,\n () => 'batchToSpaceND for rank > 4 with a WebGPU backend not ' +\n 'implemented yet');\n const prod = blockShape.reduce((a, b) => a * b);\n\n const reshaped = backend_util.getReshaped(x.shape, blockShape, prod);\n const permuted = backend_util.getPermuted(reshaped.length, blockShape.length);\n const reshapedPermuted =\n backend_util.getReshapedPermuted(x.shape, blockShape, prod);\n const sliceBeginCoords =\n backend_util.getSliceBeginCoords(crops, blockShape.length);\n const sliceSize =\n backend_util.getSliceSize(reshapedPermuted, crops, blockShape.length);\n\n const toDispose = [];\n\n const reshapedIntermediate =\n reshape({inputs: {x}, backend, attrs: {shape: reshaped}});\n const transposedIntermediate = transpose(\n {inputs: {x: reshapedIntermediate}, backend, attrs: {perm: permuted}});\n const reshapedIntermediate2 = reshape({\n inputs: {x: transposedIntermediate},\n backend,\n attrs: {shape: reshapedPermuted}\n });\n const sliced = slice({\n inputs: {x: reshapedIntermediate2},\n backend,\n attrs: {begin: sliceBeginCoords, size: sliceSize}\n });\n\n toDispose.push(reshapedIntermediate);\n toDispose.push(transposedIntermediate);\n toDispose.push(reshapedIntermediate2);\n\n toDispose.forEach(t => backend.disposeData(t.dataId));\n\n return sliced;\n};\n\nexport const batchToSpaceNDConfig: KernelConfig = {\n kernelName: BatchToSpaceND,\n backendName: 'webgpu',\n kernelFunc: batchToSpaceND as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, NotEqual} from '@tensorflow/tfjs-core';\n\nimport {BinaryOpType} from '../binary_op_util';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {notEqualImplCPU as cpuNotEqual} from '../kernel_utils/shared';\n\nexport const notEqual = binaryKernelFunc({\n opType: BinaryOpType.NOT_EQUAL,\n dtype: 'bool',\n cpuKernelImpl: cpuNotEqual\n});\n\nexport const notEqualConfig: KernelConfig = {\n kernelName: NotEqual,\n backendName: 'webgpu',\n kernelFunc: notEqual\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Real, RealInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {identity} from './Identity';\n\nexport function real(args: {inputs: RealInputs, backend: WebGPUBackend}):\n TensorInfo {\n const {inputs, backend} = args;\n const {input} = inputs;\n const inputData = backend.tensorMap.get(input.dataId);\n\n return identity({inputs: {x: inputData.complexTensorInfos.real}, backend});\n}\n\nexport const realConfig: KernelConfig = {\n kernelName: Real,\n backendName: 'webgpu',\n kernelFunc: real as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {TensorInfo} from '@tensorflow/tfjs-core';\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {UnaryOpType} from '../unary_op_util';\nimport {UnaryOpProgram} from '../unary_op_webgpu';\n\nexport function int(input: TensorInfo, backend: WebGPUBackend): TensorInfo {\n const program = new UnaryOpProgram(input.shape, UnaryOpType.TO_INT);\n const output = backend.runWebGPUProgram(program, [input], 'int32');\n return {dataId: output.dataId, shape: output.shape, dtype: output.dtype};\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport * as tf from '@tensorflow/tfjs-core';\nimport {BinaryInputs, Cast, CastAttrs, CastInputs, KernelConfig, KernelFunc, TensorInfo, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {castImplCPU} from '../kernel_utils/shared';\n\nimport {complex} from './Complex';\nimport {identity} from './Identity';\nimport {notEqual} from './NotEqual';\nimport {real} from './Real';\n\nimport {int} from '../kernel_utils/int';\n\nexport function cast(\n args: {inputs: CastInputs, backend: WebGPUBackend, attrs: CastAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {dtype} = attrs;\n\n // Casting to complex64.\n if (dtype === 'complex64') {\n if (x.dtype === 'complex64') {\n return identity({inputs: {x}, backend});\n }\n\n // TODO: Import kernel function once zeros is modularized.\n const zerosTensor = tf.zeros(x.shape);\n const floatX = cast({inputs: {x}, backend, attrs: {dtype: 'float32'}});\n\n const result =\n complex({inputs: {real: floatX, imag: zerosTensor}, backend});\n\n zerosTensor.dispose();\n backend.disposeData(floatX.dataId);\n\n return result;\n }\n\n // Casting from complex64\n if (x.dtype === 'complex64') {\n const realPart = real({inputs: {input: x}, backend});\n const result = cast({inputs: {x: realPart}, backend, attrs: {dtype}});\n backend.disposeData(realPart.dataId);\n return result;\n }\n\n if (!util.hasEncodingLoss(x.dtype, dtype)) {\n // We don't change the underlying data, since we cast to higher\n // precision.\n const result = identity({inputs: {x}, backend});\n return {dataId: result.dataId, shape: result.shape, dtype};\n }\n\n if (backend.shouldExecuteOnCPU([x])) {\n const values = backend.tensorMap.get(x.dataId).values as TypedArray;\n const [resultShape, resultType, resultData] =\n castImplCPU(values, x.shape, x.dtype, dtype);\n return backend.makeTensorInfo(resultShape, resultType, resultData);\n }\n\n if (dtype === 'int32') {\n return int(x, backend);\n }\n\n if (dtype === 'bool') {\n const zerosTensorInfo = backend.makeTensorInfo(\n [], 'bool', util.getTypedArrayFromDType('bool', 1));\n\n const binaryInputs: BinaryInputs = {a: x, b: zerosTensorInfo};\n\n const result = notEqual({inputs: binaryInputs, backend}) as TensorInfo;\n backend.disposeData(zerosTensorInfo.dataId);\n return result;\n }\n\n throw new Error(`Error in Cast: failed to cast ${x.dtype} to ${dtype}`);\n}\n\nexport const castConfig: KernelConfig = {\n kernelName: Cast,\n backendName: 'webgpu',\n kernelFunc: cast as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Ceil, KernelConfig} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {ceilImplCPU} from '../kernel_utils/shared';\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const ceil =\n unaryKernelFunc({opType: UnaryOpType.CEIL, cpuKernelImpl: ceilImplCPU});\n\nexport const ceilConfig: KernelConfig = {\n kernelName: Ceil,\n backendName: 'webgpu',\n kernelFunc: ceil\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class ClipVec4Program implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n variableNames = ['A'];\n uniforms = 'minVal : f32, maxVal : f32,';\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n workPerThread = 4;\n workGroupSize: [number, number, number] = [64, 1, 1];\n isVec4 = true;\n size = true;\n\n constructor(outputShape: number[]) {\n this.outputShape = outputShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize,\n [this.workPerThread, 1, 1]);\n this.shaderKey = 'clipVec4';\n }\n\n getUserCode(): string {\n const userCode = `\n ${main('index')} {\n if(index < uniforms.size) {\n let value = getAByOutputIndex(index);\n var clampedValue : vec4;\n for (var i = 0; i < 4; i = i + 1) {\n if (isnan(value[i])) {\n clampedValue[i] = value[i];\n } else {\n clampedValue[i] = clamp(value[i], uniforms.minVal, uniforms.maxVal);\n }\n }\n\n setOutputAtIndex(index, clampedValue);\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class ClipProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n variableNames = ['A'];\n uniforms = 'minVal : f32, maxVal : f32,';\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n workGroupSize: [number, number, number] = [64, 1, 1];\n minVal: number;\n maxVal: number;\n size = true;\n\n constructor(outputShape: number[]) {\n this.outputShape = outputShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize);\n\n this.shaderKey = 'clip';\n }\n\n getUserCode(): string {\n const userCode = `\n ${main('index')} {\n if(index < uniforms.size) {\n let value = getAByOutputIndex(index);\n if (isnan(value)) {\n setOutputAtIndex(index, value);\n return;\n }\n setOutputAtIndex(index, clamp(value, uniforms.minVal, uniforms.maxVal));\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ClipByValue, ClipByValueAttrs, ClipByValueInputs, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\n\nimport {ClipVec4Program} from '../clip_vec4_webgpu';\nimport {ClipProgram} from '../clip_webgpu';\n\nexport function clipByValue(args: {\n inputs: ClipByValueInputs,\n backend: WebGPUBackend,\n attrs: ClipByValueAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {clipValueMin, clipValueMax} = attrs;\n\n let program: ClipProgram|ClipVec4Program;\n const uniformData = [\n {type: 'float32', data: [clipValueMin]},\n {type: 'float32', data: [clipValueMax]}\n ];\n if (util.sizeFromShape(x.shape) % 4 === 0) {\n program = new ClipVec4Program(x.shape);\n } else {\n program = new ClipProgram(x.shape);\n }\n return backend.runWebGPUProgram(program, [x], x.dtype, uniformData);\n}\n\nexport const clipByValueConfig: KernelConfig = {\n kernelName: ClipByValue,\n backendName: 'webgpu',\n kernelFunc: clipByValue as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class ConcatProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames: string[];\n uniforms = '';\n workPerThread = 1;\n workGroupSize: [number, number, number] = [64, 1, 1];\n size = true;\n offsetLength: number;\n\n constructor(shapes: Array<[number, number]>) {\n this.outputShape =\n backend_util.computeOutShape(shapes, 1 /* axis */) as [number, number];\n this.variableNames = shapes.map((_, i) => `T${i}`);\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize,\n [this.workPerThread, 1, 1]);\n\n this.offsetLength = shapes.length - 1;\n for (let i = 0; i < this.offsetLength; i++) {\n this.uniforms += `offset${i} : i32,`;\n }\n this.shaderKey = 'concat';\n }\n\n getUserCode(): string {\n const snippets: string[] = [];\n if (this.offsetLength > 0) {\n snippets.push(\n `if (yC < uniforms.offset0){ setOutputAtCoords(coords.x, coords.y, getT0(yR, yC)); }`);\n for (let i = 1; i < this.offsetLength; i++) {\n snippets.push(\n `else if (yC < uniforms.offset${[i]}){ ` +\n `setOutputAtCoords(coords.x, coords.y, getT${\n i}(yR, yC - uniforms.offset${i - 1})); }`);\n }\n const lastIndex = this.offsetLength;\n const lastShiftIndex = this.offsetLength - 1;\n snippets.push(`else { setOutputAtCoords(coords.x, coords.y, getT${\n lastIndex}(yR, yC - uniforms.offset${lastShiftIndex})); }`);\n } else {\n snippets.push(`setOutputAtCoords(coords.x, coords.y, getT0(yR, yC));`);\n }\n\n const userCode = `\n ${main('index')} {\n for(var i = 0; i < ${this.workPerThread}; i = i + 1) {\n let flatIndex = index * ${this.workPerThread} + i;\n if(flatIndex < uniforms.size) {\n let coords = getCoordsFromIndex(flatIndex);\n let yR = coords.x;\n let yC = coords.y;\n\n ${snippets.join('\\n ')}\n }\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Imag, ImagInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {identity} from './Identity';\n\nexport function imag(args: {inputs: ImagInputs, backend: WebGPUBackend}):\n TensorInfo {\n const {inputs, backend} = args;\n const {input} = inputs;\n const inputData = backend.tensorMap.get(input.dataId);\n\n return identity({inputs: {x: inputData.complexTensorInfos.imag}, backend});\n}\n\nexport const imagConfig: KernelConfig = {\n kernelName: Imag,\n backendName: 'webgpu',\n kernelFunc: imag as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, ConcatInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {ConcatProgram} from '../concat_webgpu';\nimport {concatImplCPU} from '../kernel_utils/shared';\n\nimport {complex} from './Complex';\nimport {imag} from './Imag';\nimport {real} from './Real';\nimport {reshape} from './Reshape';\n\nexport function concatImpl(\n inputs: ConcatInputs, axis: number, backend: WebGPUBackend): TensorInfo {\n const dtype = inputs[0].dtype;\n if (dtype === 'complex64') {\n const reals = inputs.map((t) => real({inputs: {input: t}, backend}));\n const imags = inputs.map((t) => imag({inputs: {input: t}, backend}));\n\n const realConcated = concatImpl(reals, axis, backend);\n const imagConcated = concatImpl(imags, axis, backend);\n\n const result =\n complex({inputs: {real: realConcated, imag: imagConcated}, backend});\n\n reals.forEach(r => backend.disposeData(r.dataId));\n imags.forEach(i => backend.disposeData(i.dataId));\n backend.disposeData(realConcated.dataId);\n backend.disposeData(imagConcated.dataId);\n\n return result;\n }\n\n let runOnCpu = backend.shouldExecuteOnCPU(inputs);\n\n // Run on cpu if dtype is string. For string, the backend represents it\n // as Uint8Array[], where each Uint8Array is a character. Given that the\n // computation is only on the outer array, uploading the whole data onto\n // gpu is wasteful. Also, currently webgpu doesn't have a design to\n // upload and retrieve Uint8Array[] between cpu and gpu. Therefore, we\n // just run the kernel on cpu if dtype is string.\n if (dtype === 'string') {\n runOnCpu = true;\n }\n\n if (runOnCpu) {\n // Any concat of n-dimensional tensors across any axis can be reduced to\n // a concatenation of two-dimensional tensors across the axis 1 by first\n // partitioning the axes of the original tensors into those less than the\n // axis to be concatenated and the rest. Then reshape the tensors\n // into a two-dimensional tensor by collapsing these two sets of axes and\n // concatenate the resulting matrices across the axis 1, finally reshaping\n // the result to have the proper shape.\n const tensors2D = inputs.map(t => {\n const innerSize = util.sizeFromShape(t.shape.slice(axis));\n const shape = [-1, innerSize];\n return reshape({inputs: {x: t}, backend, attrs: {shape}});\n });\n\n const inputsValShapes = tensors2D.map(t => {\n return {vals: backend.readSync(t.dataId), shape: t.shape};\n });\n\n // Concats 2d tensors along axis=1.\n const outShape =\n backend_util.computeOutShape(tensors2D.map(t => t.shape), 1 /* axis */);\n const simplyConcat = tensors2D[0].shape[0] === 1;\n const outVals =\n concatImplCPU(inputsValShapes, outShape, dtype, simplyConcat);\n\n const finalOutShape =\n backend_util.computeOutShape(inputs.map(t => t.shape), axis);\n\n const outInfo = backend.makeTensorInfo(finalOutShape, dtype, outVals);\n\n tensors2D.forEach(t => backend.disposeData(t.dataId));\n\n return outInfo;\n }\n\n // There is a storage buffer limitation in compute stage, one for output so\n // the maximum for input is limits.maxStorageBuffersPerShaderStage - 1\n const maxInputNum = backend.device.limits.maxStorageBuffersPerShaderStage - 1;\n if (inputs.length > maxInputNum) {\n const reducedInputs = [];\n for (let i = 0; i < inputs.length; i += maxInputNum) {\n const subArray = inputs.slice(i, i + maxInputNum);\n reducedInputs.push(concatImpl(subArray, axis, backend));\n }\n const result = concatImpl(reducedInputs, axis, backend);\n\n for (const i of reducedInputs) {\n backend.disposeData(i.dataId);\n }\n\n return result;\n }\n\n const {tensors2D, outShape} = computeTensors2D(inputs, axis, backend);\n const shapes = (tensors2D).map(t => t.shape as [number, number]);\n const program = new ConcatProgram(shapes);\n\n const uniformData: Array<{type: string; data: number[]}> = [];\n const offsets: number[] = new Array(shapes.length - 1);\n if (offsets.length > 0) {\n offsets[0] = shapes[0][1];\n uniformData.push({type: 'int32', data: [offsets[0]]});\n for (let i = 1; i < offsets.length; i++) {\n offsets[i] = offsets[i - 1] + shapes[i][1];\n uniformData.push({type: 'int32', data: [offsets[i]]});\n }\n }\n\n const res = backend.runWebGPUProgram(\n program, tensors2D, tensors2D[0].dtype, uniformData);\n tensors2D.forEach(r => backend.disposeData(r.dataId));\n\n const reshapedResult =\n reshape({inputs: {x: res}, backend, attrs: {shape: outShape}});\n backend.disposeData(res.dataId);\n return reshapedResult;\n}\n\nfunction computeTensors2D(\n inputs: ConcatInputs, axis: number, backend: WebGPUBackend) {\n const outShape = backend_util.computeOutShape(inputs.map(t => t.shape), axis);\n const tensors2D = inputs.map(t => reshape({\n inputs: {x: t},\n backend,\n attrs: {\n shape: [\n util.sizeFromShape(t.shape.slice(0, axis)),\n util.sizeFromShape(t.shape.slice(axis))\n ]\n }\n }));\n\n return {tensors2D, outShape};\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, Concat, ConcatAttrs, ConcatInputs, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\n\nimport {concatImpl} from './Concat_impl';\nimport {identity} from './Identity';\n\nexport function concat(\n args: {inputs: ConcatInputs, attrs: ConcatAttrs, backend: WebGPUBackend}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {axis} = attrs;\n\n const $axis = util.parseAxisParam(axis, inputs[0].shape)[0];\n\n const shapes = inputs.map(t => t.shape);\n backend_util.assertParamsConsistent(shapes, $axis);\n\n const outShape =\n backend_util.computeOutShape(inputs.map(t => t.shape), $axis);\n if (util.sizeFromShape(outShape) === 0) {\n return backend.makeTensorInfo(outShape, inputs[0].dtype, []);\n }\n\n // Keep only non-empty tensors (ignore tensors with 0 in their shape).\n const $inputs = inputs.filter(t => util.sizeFromShape(t.shape) > 0);\n if ($inputs.length === 1) {\n return identity({inputs: {x: $inputs[0]}, backend});\n }\n\n return concatImpl($inputs, $axis, backend);\n}\n\nexport const concatConfig: KernelConfig = {\n kernelName: Concat,\n backendName: 'webgpu',\n kernelFunc: concat as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\n\nimport {activationFnSnippet, biasActivationSnippet, typeSnippet} from './activation_util';\nimport {makeMatMulPackedSource, makeMatMulPackedVec4Source} from './matmul_packed_webgpu';\nimport {WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, computeWorkGroupSizeForConv2d, computeWorkPerThreadForConv2d} from './webgpu_util';\n\nfunction conv2dCommonSnippet(\n isChannelsLast: boolean, fitAOuter: boolean, fitBOuter: boolean,\n fitInner: boolean, addBias = false,\n activation: backend_util.Activation = null,\n hasPreluActivationWeights = false, innerElementSizeX = 4,\n innerElementSizeW = 4, innerElementSize = 4) {\n const getXSnippet = (innerElementSize: number) => {\n switch (innerElementSize) {\n case 1:\n return 'resData = x[xIndex];';\n case 3:\n return 'resData = vec3(x[xIndex], x[xIndex + 1], x[xIndex + 2]);';\n case 4:\n return 'resData = x[xIndex / 4];';\n default:\n throw new Error(\n `innerElementSize ${innerElementSize} is not supported.`);\n }\n };\n const getWSnippet = (innerElementSize: number) => {\n switch (innerElementSize) {\n case 1:\n return 'return W[row * uniforms.wShape[3] + colIn];';\n case 4:\n return 'return W[row * uniforms.wShape[3] / 4 + colIn];';\n default:\n throw new Error(\n `innerElementSize ${innerElementSize} is not supported.`);\n }\n };\n const coordASnippet = isChannelsLast ? `\n let coord = vec4(batch, xRow, xCol, xCh);\n ` :\n `\n let coord = vec4(batch, xCh, xRow, xCol);\n `;\n\n const coordResSnippet = isChannelsLast ? `\n let coords = vec4(\n batch,\n row / outWidth,\n row % outWidth,\n col);\n ` :\n `\n let coords = vec4(\n batch,\n row,\n col / outWidth,\n col % outWidth);\n `;\n\n const xHight = isChannelsLast ? 'uniforms.xShape[1]' : 'uniforms.xShape[2]';\n const xWidth = isChannelsLast ? 'uniforms.xShape[2]' : 'uniforms.xShape[3]';\n const row = isChannelsLast ? 'row' : 'col';\n const col = isChannelsLast ? 'col' : 'row';\n const readXSnippet = `\n let inChannels = uniforms.wShape[2];\n let outWidth = ${\n isChannelsLast ? 'uniforms.outShape[2]' : 'uniforms.outShape[3]'};\n let outRow = ${row} / outWidth;\n let outCol = ${row} % outWidth;\n\n let WRow = ${col} / (uniforms.filterDims[1] * inChannels);\n let WCol = ${col} / inChannels % uniforms.filterDims[1];\n let xRow = outRow * uniforms.stride[0] + uniforms.dilation[0] * WRow - uniforms.pad[0];\n let xCol = outCol * uniforms.stride[1] + uniforms.dilation[1] * WCol - uniforms.pad[1];\n let xCh = ${col} % inChannels;\n var resData = ${typeSnippet(innerElementSizeX)}(0.0);\n // The bounds checking is always needed since we use it to pad zero for\n // the 'same' padding type.\n if (xRow >= 0 && xRow < ${xHight} && xCol >= 0 && xCol < ${xWidth}) {\n ${coordASnippet}\n let xIndex = getIndexFromCoords4D(coord, uniforms.xShape);\n ${getXSnippet(innerElementSizeX)}\n }\n return resData;`;\n\n const sampleX = isChannelsLast ? (fitAOuter && fitInner ? `\n let col = colIn * ${innerElementSizeX};\n ${readXSnippet}` :\n `\n let col = colIn * ${innerElementSizeX};\n if (row < uniforms.dimAOuter && col < uniforms.dimInner) {\n ${readXSnippet}\n }\n return ${typeSnippet(innerElementSizeX)}(0.0);`) :\n (fitInner && fitBOuter ? `\n let col = colIn * ${innerElementSizeX};\n ${readXSnippet}` :\n `\n let col = colIn * ${innerElementSizeX};\n if (row < uniforms.dimInner && col < uniforms.dimBOuter) {\n ${readXSnippet}\n }\n return ${typeSnippet(innerElementSizeX)}(0.0);`);\n\n const sampleW = `${getWSnippet(innerElementSizeW)}`;\n\n const resType = typeSnippet(innerElementSize);\n const aType = isChannelsLast ? typeSnippet(innerElementSizeX) :\n typeSnippet(innerElementSizeW);\n const bType = isChannelsLast ? typeSnippet(innerElementSizeW) :\n typeSnippet(innerElementSizeX);\n const userCode = `\n ${\n activationFnSnippet(\n activation, hasPreluActivationWeights, innerElementSize === 4, 4)}\n fn mm_readA(batch: i32, row : i32, colIn : i32) -> ${aType} {\n ${isChannelsLast ? sampleX : sampleW}\n }\n\n fn mm_readB(batch: i32, row : i32, colIn : i32) -> ${bType} {\n ${isChannelsLast ? sampleW : sampleX}\n }\n\n fn mm_write(batch: i32, row : i32, colIn : i32, valueIn : ${resType}) {\n let col = colIn * ${innerElementSize};\n if (row < uniforms.dimAOuter && col < uniforms.dimBOuter)\n {\n var value = valueIn;\n let outWidth = ${\n isChannelsLast ? 'uniforms.outShape[2]' : 'uniforms.outShape[3]'};\n ${coordResSnippet}\n ${biasActivationSnippet(addBias, activation)}\n setOutputAtCoords(coords[0], coords[1], coords[2], coords[3], value);\n }\n }`;\n return userCode;\n}\n\nexport class Conv2DMMProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[], y: number[], z: number[]};\n dispatch: [number, number, number];\n variableNames = ['x', 'W'];\n variableTypes: string[];\n uniforms =\n `filterDims : vec2, pad : vec2, stride : vec2, dilation : vec2, dimAOuter : i32, dimBOuter : i32, dimInner : i32,`;\n workGroupSize: [number, number, number];\n elementsPerThread: [number, number, number];\n addBias: boolean;\n activation: backend_util.Activation;\n hasPreluActivationWeights: boolean;\n isChannelsLast: boolean;\n fitAOuter: boolean;\n fitBOuter: boolean;\n fitInner: boolean;\n tileAOuter: number;\n tileBOuter: number;\n tileInner: number;\n innerElementSize: number;\n isVec4?: boolean;\n private sequentialAccessByThreads: boolean;\n\n constructor(\n convInfo: backend_util.Conv2DInfo, dimAOuter: number, dimBOuter: number,\n dimInner: number, addBias = false,\n activation: backend_util.Activation = null,\n hasPreluActivationWeights = false, sequentialAccessByThreads = false) {\n this.outputShape = convInfo.outShape;\n this.isChannelsLast = convInfo.dataFormat === 'channelsLast';\n this.isVec4 =\n (((convInfo.inChannels % 4 === 0 || convInfo.inChannels % 3 === 0) &&\n this.isChannelsLast) ||\n (convInfo.outWidth % 4 === 0 && !this.isChannelsLast)) &&\n convInfo.outChannels % 4 === 0;\n this.dispatchLayout = this.isChannelsLast ? {x: [3], y: [1, 2], z: [0]} :\n {x: [2, 3], y: [1], z: [0]};\n this.workGroupSize = computeWorkGroupSizeForConv2d(\n this.dispatchLayout, this.outputShape, this.isVec4);\n this.elementsPerThread = computeWorkPerThreadForConv2d(\n this.dispatchLayout, this.outputShape, this.isVec4);\n\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize,\n this.elementsPerThread);\n\n if (this.isVec4) {\n if (this.isChannelsLast && convInfo.inChannels % 4 !== 0) {\n this.innerElementSize = 3;\n this.variableTypes = ['f32', 'vec4'];\n } else {\n this.innerElementSize = 4;\n this.variableTypes = ['vec4', 'vec4'];\n }\n\n if (addBias) {\n this.variableNames.push('bias');\n this.variableTypes.push('vec4');\n }\n\n if (hasPreluActivationWeights) {\n this.variableNames.push('preluActivationWeights');\n this.variableTypes.push('vec4');\n }\n } else {\n this.innerElementSize = this.elementsPerThread[0];\n if (addBias) {\n this.variableNames.push('bias');\n }\n\n if (hasPreluActivationWeights) {\n this.variableNames.push('preluActivationWeights');\n }\n }\n\n this.sequentialAccessByThreads = sequentialAccessByThreads;\n this.addBias = addBias;\n this.activation = activation;\n this.hasPreluActivationWeights = hasPreluActivationWeights;\n\n this.tileAOuter = this.workGroupSize[1] * this.elementsPerThread[1];\n this.tileBOuter = this.workGroupSize[0] * this.elementsPerThread[0];\n this.tileInner = Math.max(\n this.workGroupSize[0] * this.innerElementSize, this.workGroupSize[1]);\n\n this.fitAOuter = dimAOuter % this.tileAOuter === 0;\n this.fitBOuter = dimBOuter % this.tileBOuter === 0;\n this.fitInner = dimInner % this.tileInner === 0;\n\n this.shaderKey = `conv2DMM_${this.elementsPerThread}_${this.activation}}_${\n this.fitAOuter}_${this.fitBOuter}_${this.fitInner}_${this.isVec4}_${\n this.innerElementSize}_${this.isChannelsLast}_${\n this.sequentialAccessByThreads}`;\n }\n\n getUserCode(): string {\n const matMulSource = this.isVec4 ?\n makeMatMulPackedVec4Source(\n this.elementsPerThread, this.workGroupSize, !this.isChannelsLast,\n this.tileInner) :\n makeMatMulPackedSource(\n this.elementsPerThread, this.workGroupSize, !this.isChannelsLast,\n this.tileInner, false, null, this.sequentialAccessByThreads);\n const elementsSize =\n this.isVec4 ? [this.innerElementSize, 4, 4] : [1, 1, 1];\n const userCode = `\n ${\n conv2dCommonSnippet(\n this.isChannelsLast, this.fitAOuter, this.fitBOuter, this.fitInner,\n this.addBias, this.activation, this.hasPreluActivationWeights,\n elementsSize[0], elementsSize[1], elementsSize[2])}\n ${matMulSource}\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\n\nimport {activationFnSnippet, biasActivationSnippet} from './activation_util';\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch} from './webgpu_util';\n\nexport class Conv2DNaiveProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[], y: number[], z: number[]};\n dispatch: [number, number, number];\n variableNames = ['x', 'W'];\n uniforms =\n 'filterDims: vec2, pad: vec2, stride: vec2, dilation: vec2,';\n workGroupSize: [number, number, number] = [4, 4, 8];\n addBias: boolean;\n activation: backend_util.Activation;\n hasPreluActivationWeights: boolean;\n isChannelsLast: boolean;\n\n constructor(\n convInfo: backend_util.Conv2DInfo, addBias = false,\n activation: backend_util.Activation = null,\n hasPreluActivationWeights = false) {\n this.outputShape = convInfo.outShape;\n this.isChannelsLast = convInfo.dataFormat === 'channelsLast';\n this.dispatchLayout = this.isChannelsLast ? {x: [2], y: [1], z: [0, 3]} :\n {x: [3], y: [2], z: [0, 1]};\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize);\n this.addBias = addBias;\n this.activation = activation;\n this.hasPreluActivationWeights = hasPreluActivationWeights;\n\n if (addBias) {\n this.variableNames.push('bias');\n }\n\n if (hasPreluActivationWeights) {\n this.variableNames.push('preluActivationWeights');\n }\n\n this.shaderKey = `conv2dnaive_${this.activation}_${this.isChannelsLast}`;\n }\n\n getUserCode(): string {\n const userCode = `\n ${\n activationFnSnippet(\n this.activation, this.hasPreluActivationWeights, false, 4)}\n fn readInp(batch : i32, row : i32, col : i32, chan : i32) -> f32{\n let coords = vec4(batch, row, col, chan);\n if (coordsInBounds4D(coords, uniforms.xShape)) {\n return getX(batch, row, col, chan);\n } else {\n return 0.0;\n }\n }\n fn readFilt(row : i32, col : i32, xChannel : i32, outChannel : i32) -> f32{\n let coords = vec4(row, col, xChannel, outChannel);\n if(coordsInBounds4D(coords, uniforms.wShape)) {\n return getW(row, col, xChannel, outChannel);\n } else {\n return 0.0;\n }\n }\n fn writeResult(batch : i32, row : i32, col : i32, chan : i32, valueIn : f32) {\n let coords = ${\n this.isChannelsLast ? `vec4(batch, row, col, chan);` :\n `vec4(batch, chan, row, col);`}\n if (coordsInBounds4D(coords, uniforms.outShape)) {\n var value = valueIn;\n ${biasActivationSnippet(this.addBias, this.activation)}\n setOutputAtCoords(coords.x, coords.y, coords.z, coords.w, value);\n }\n }\n ${main('index')} {\n let coords = getOutputCoords();\n let batch = coords[0];\n let outChannel = ${this.isChannelsLast ? `coords[3];` : `coords[1];`}\n let outRow = ${this.isChannelsLast ? `coords[1];` : `coords[2];`}\n let outCol = ${this.isChannelsLast ? `coords[2];` : `coords[3];`}\n var acc : f32 = 0.0;\n for (var row = 0; row < uniforms.filterDims[0]; row = row + 1) {\n for (var col = 0; col < uniforms.filterDims[1]; col = col + 1) {\n let xRow = outRow * uniforms.stride[0] + uniforms.dilation[0] * row - uniforms.pad[0];\n let xCol = outCol * uniforms.stride[1] + uniforms.dilation[1] * col - uniforms.pad[1];\n for (var xChannel = 0; xChannel < ${\n this.isChannelsLast ? `uniforms.xShape[3];` :\n `uniforms.xShape[1];`} xChannel = xChannel + 1) {\n ${\n this.isChannelsLast ? `let v = readInp(batch, xRow, xCol, xChannel);` :\n `let v = readInp(batch, xChannel, xRow, xCol);`}\n let f = readFilt(row, col, xChannel, outChannel);\n acc = acc + v * f;\n }\n }\n }\n writeResult(batch, outRow, outCol, outChannel, acc);\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, env, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {Conv2DMMProgram} from '../conv2d_mm_webgpu';\nimport {Conv2DNaiveProgram} from '../conv2d_naive_webgpu';\nimport {WebGPUProgram} from '../webgpu_program';\n\nimport {batchMatMulImpl} from './BatchMatMul_impl';\nimport {reshape} from './Reshape';\n\ntype Conv2DConfig = {\n x: TensorInfo,\n filter: TensorInfo,\n convInfo: backend_util.Conv2DInfo,\n backend: WebGPUBackend,\n bias?: TensorInfo,\n preluActivationWeights?: TensorInfo,\n leakyreluAlpha?: number,\n activation?: backend_util.Activation\n};\n\n// conv2dByMatMul fuses height and width into one dimension to compute\n// batchMatMul, so bias and activation weights are also supposed to fuse the two\n// dimensions into one.\n//\n// This function computes the target shape for fusing height and width\n// dimensions. Returning null means the shape is already compatible.\nfunction getShapeForBatchMatMul(\n shape: number[], isChannelsLast: boolean): number[] {\n const length = shape.length;\n if (length >= 3) {\n return isChannelsLast ?\n [\n ...shape.slice(0, -3) /* batch */,\n shape[length - 3] * shape[length - 2] /* height * width */,\n shape[length - 1] /* channel */\n ] :\n [\n ...shape.slice(0, -3) /* batch */, shape[length - 3] /* channel */,\n shape[length - 2] * shape[length - 1] /* height * width */\n ];\n } else if (!isChannelsLast && length === 1 && shape[0] > 1) {\n return [shape[0], 1];\n } else {\n return null;\n }\n}\n\n// For 1x1 kernels that iterate through every point in the input, convolution\n// can be expressed as matrix multiplication (without need for memory\n// remapping).\nfunction conv2dByMatMul({\n x,\n filter,\n convInfo,\n backend,\n bias = null,\n preluActivationWeights = null,\n leakyreluAlpha = 0,\n activation = null\n}: Conv2DConfig) {\n const isChannelsLast = convInfo.dataFormat === 'channelsLast';\n const transposeA = isChannelsLast ? false : true;\n const transposeB = false;\n\n const sameSize = isChannelsLast &&\n convInfo.filterHeight === convInfo.inHeight &&\n convInfo.filterWidth === convInfo.inWidth &&\n convInfo.padInfo.type === 'VALID';\n const intermediates: TensorInfo[] = [];\n let xReshaped;\n let filterReshaped;\n\n if (sameSize) {\n const sharedDim =\n convInfo.inHeight * convInfo.inWidth * convInfo.inChannels;\n xReshaped = reshape({\n inputs: {x},\n backend,\n attrs: {shape: [1, convInfo.batchSize, sharedDim]}\n });\n filterReshaped = reshape({\n inputs: {x: filter},\n backend,\n attrs: {shape: [1, sharedDim, convInfo.outChannels]}\n });\n } else {\n xReshaped = reshape({\n inputs: {x},\n backend,\n attrs: {\n shape: isChannelsLast ?\n [\n convInfo.batchSize, convInfo.inHeight * convInfo.inWidth,\n convInfo.inChannels\n ] :\n [\n convInfo.batchSize, convInfo.inChannels,\n convInfo.inHeight * convInfo.inWidth\n ]\n }\n });\n filterReshaped = reshape({\n inputs: {x: filter},\n backend,\n attrs: {shape: [1, convInfo.inChannels, convInfo.outChannels]}\n });\n }\n intermediates.push(xReshaped);\n intermediates.push(filterReshaped);\n\n if (preluActivationWeights != null) {\n const targetShape =\n getShapeForBatchMatMul(preluActivationWeights.shape, isChannelsLast);\n if (targetShape != null) {\n preluActivationWeights = reshape({\n inputs: {x: preluActivationWeights},\n backend,\n attrs: {shape: targetShape}\n });\n intermediates.push(preluActivationWeights);\n }\n }\n\n if (bias != null) {\n const targetShape = getShapeForBatchMatMul(bias.shape, isChannelsLast);\n if (targetShape != null) {\n bias = reshape({inputs: {x: bias}, backend, attrs: {shape: targetShape}});\n intermediates.push(bias);\n }\n }\n\n const result = batchMatMulImpl({\n a: isChannelsLast ? xReshaped : filterReshaped,\n b: isChannelsLast ? filterReshaped : xReshaped,\n transposeA,\n transposeB,\n backend,\n bias,\n activation,\n preluActivationWeights,\n leakyreluAlpha\n });\n const out = reshape(\n {inputs: {x: result}, backend, attrs: {shape: convInfo.outShape}});\n intermediates.push(result);\n\n for (const i of intermediates) {\n backend.disposeData(i.dataId);\n }\n\n return out;\n}\n\nexport function conv2DImpl({\n x,\n filter,\n convInfo,\n backend,\n bias = null,\n preluActivationWeights = null,\n leakyreluAlpha = 0,\n activation = null\n}: Conv2DConfig) {\n const hasBias = bias != null;\n const hasPreluActivationWeights = preluActivationWeights != null;\n const isChannelsLast = convInfo.dataFormat === 'channelsLast';\n const sameSize = isChannelsLast &&\n convInfo.filterHeight === convInfo.inHeight &&\n convInfo.filterWidth === convInfo.inWidth &&\n convInfo.padInfo.type === 'VALID';\n const useNaiveConv2d = env().getBool('WEBGPU_USE_NAIVE_CONV2D_DEBUG');\n\n if (!useNaiveConv2d &&\n (sameSize ||\n (convInfo.filterHeight === 1 && convInfo.filterWidth === 1 &&\n convInfo.dilationHeight === 1 && convInfo.dilationWidth === 1 &&\n convInfo.strideHeight === 1 && convInfo.strideWidth === 1 &&\n (convInfo.padInfo.type === 'SAME' ||\n convInfo.padInfo.type === 'VALID')))) {\n return conv2dByMatMul({\n x,\n filter,\n convInfo,\n backend,\n bias,\n activation,\n preluActivationWeights,\n leakyreluAlpha\n });\n }\n\n let program: WebGPUProgram;\n const padInfo = [convInfo.padInfo.top, convInfo.padInfo.left];\n const dimensions = [\n {type: 'int32', data: [convInfo.filterHeight, convInfo.filterWidth]},\n {type: 'int32', data: [...padInfo]},\n {type: 'int32', data: [convInfo.strideHeight, convInfo.strideWidth]},\n {type: 'int32', data: [convInfo.dilationHeight, convInfo.dilationWidth]}\n ];\n if (useNaiveConv2d) {\n program = new Conv2DNaiveProgram(\n convInfo, hasBias, activation, hasPreluActivationWeights);\n } else {\n const dimAOuter = isChannelsLast ? convInfo.outHeight * convInfo.outWidth :\n convInfo.outChannels;\n const dimBOuter = isChannelsLast ? convInfo.outChannels :\n convInfo.outHeight * convInfo.outWidth;\n const dimInner =\n convInfo.filterHeight * convInfo.filterWidth * convInfo.inChannels;\n dimensions.push(\n {type: 'int32', data: [dimAOuter]}, {type: 'int32', data: [dimBOuter]},\n {type: 'int32', data: [dimInner]});\n\n // Experiments show that sequential access is more friendly for Intel GPUs.\n const sequentialAccessByThreads = backend.adapterInfo.isIntel();\n program = new Conv2DMMProgram(\n convInfo, dimAOuter, dimBOuter, dimInner, hasBias, activation,\n hasPreluActivationWeights, sequentialAccessByThreads);\n }\n\n const intermediates: TensorInfo[] = [];\n const inputVar: TensorInfo[] = [x, filter];\n if (hasBias) {\n if (!isChannelsLast && bias.shape.length === 1) {\n bias = reshape(\n {inputs: {x: bias}, backend, attrs: {shape: [bias.shape[0], 1, 1]}});\n intermediates.push(bias);\n }\n inputVar.push(bias);\n }\n if (hasPreluActivationWeights) {\n if (!isChannelsLast && preluActivationWeights.shape.length === 1) {\n preluActivationWeights = reshape({\n inputs: {x: preluActivationWeights},\n backend,\n attrs: {shape: [preluActivationWeights.shape[0], 1, 1]}\n });\n intermediates.push(preluActivationWeights);\n }\n inputVar.push(preluActivationWeights);\n }\n if (activation === 'leakyrelu') {\n dimensions.push({type: 'float32', data: [leakyreluAlpha]});\n program.uniforms += ' alpha : f32,';\n }\n const out = backend.runWebGPUProgram(program, inputVar, x.dtype, dimensions);\n for (const i of intermediates) {\n backend.disposeData(i.dataId);\n }\n return out;\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, Conv2D, Conv2DAttrs, Conv2DInputs, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\n\nimport {conv2DImpl} from './Conv2D_impl';\n\nexport function conv2d(\n args: {inputs: Conv2DInputs, attrs: Conv2DAttrs, backend: WebGPUBackend}) {\n const {inputs, attrs, backend} = args;\n const {x, filter} = inputs;\n const {strides, pad, dataFormat, dilations, dimRoundingMode} = attrs;\n const $dataFormat = backend_util.convertConv2DDataFormat(dataFormat);\n const convInfo = backend_util.computeConv2DInfo(\n x.shape as [number, number, number, number],\n filter.shape as [number, number, number, number], strides, dilations, pad,\n dimRoundingMode, false /* depthwise */, $dataFormat);\n return conv2DImpl({x, filter, convInfo, backend});\n}\n\nexport const conv2DConfig: KernelConfig = {\n kernelName: Conv2D,\n backendName: 'webgpu',\n kernelFunc: conv2d as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, util} from '@tensorflow/tfjs-core';\nimport {typeSnippet} from './activation_util';\nimport {makeMatMulPackedSource, makeMatMulPackedVec4Source} from './matmul_packed_webgpu';\nimport {WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, computeWorkGroupSizeForConv2d, computeWorkPerThreadForConv2d} from './webgpu_util';\n\nfunction conv2dTransposeCommonSnippet(innerElementSize = 4) {\n const getWSnippet = (innerElementSize: number) => {\n switch (innerElementSize) {\n case 1:\n return 'return W[getIndexFromCoords4D(coord, uniforms.wShape)];';\n case 4:\n return `\n let coord1 = vec4(coordX, coordY, col + 1, rowInner);\n let coord2 = vec4(coordX, coordY, col + 2, rowInner);\n let coord3 = vec4(coordX, coordY, col + 3, rowInner);\n let v0 = W[getIndexFromCoords4D(coord, uniforms.wShape)];\n let v1 = W[getIndexFromCoords4D(coord1, uniforms.wShape)];\n let v2 = W[getIndexFromCoords4D(coord2, uniforms.wShape)];\n let v3 = W[getIndexFromCoords4D(coord3, uniforms.wShape)];\n return vec4(v0, v1, v2, v3);\n `;\n default:\n throw new Error(\n `innerElementSize ${innerElementSize} is not supported.`);\n }\n };\n\n const readASnippet = `\n let outRow = row / uniforms.outShape[2];\n let outCol = row % uniforms.outShape[2];\n\n let WRow = col / (uniforms.filterDims[1] * uniforms.outBackprop[3]);\n let WCol = col / uniforms.outBackprop[3] % uniforms.filterDims[1];\n let xR = f32(outRow - uniforms.pads[0] + WRow) / f32(uniforms.stride[0]);\n let xC = f32(outCol - uniforms.pads[1] + WCol) / f32(uniforms.stride[1]);\n if (xR < 0.0 || xR >= f32(uniforms.outBackprop[1]) || fract(xR) > 0.0) {\n return ${typeSnippet(innerElementSize)}(0.0);\n }\n if (xC < 0.0 || xC >= f32(uniforms.outBackprop[2]) || fract(xC) > 0.0) {\n return ${typeSnippet(innerElementSize)}(0.0);\n }\n let coord = vec4(\n batch,\n i32(xR),\n i32(xC),\n col % uniforms.outBackprop[3]);\n return x[getIndexFromCoords4D(coord, uniforms.xShape)/${\n innerElementSize}];`;\n\n const sampleA = `if (row < uniforms.dimAOuter && col < uniforms.dimInner) {\n ${readASnippet}\n }\n return ${typeSnippet(innerElementSize)}(0.0);`;\n\n const userCode = `\n fn mm_readA(batch: i32, row : i32, colIn : i32) -> ${\n typeSnippet(innerElementSize)} {\n let col = colIn * ${innerElementSize};\n ${sampleA}\n }\n\n fn mm_readB(batch: i32, row : i32, colIn : i32) -> ${\n typeSnippet(innerElementSize)} {\n let col = colIn * ${innerElementSize};\n let coordX = uniforms.filterDims.x - 1 -\n row / (uniforms.filterDims[1] * uniforms.outBackprop[3]);\n let coordY = uniforms.filterDims.y - 1 -\n (row / uniforms.outBackprop[3]) % uniforms.filterDims[1];\n if (row < uniforms.dimInner && col < uniforms.dimBOuter &&\n coordX >= 0 && coordY >= 0) {\n let rowInner = row % uniforms.outBackprop[3];\n let coord = vec4(coordX, coordY, col, rowInner);\n ${getWSnippet(innerElementSize)}\n }\n return ${typeSnippet(innerElementSize)}(0.0);\n }\n\n fn mm_write(batch: i32, row : i32, colIn : i32, valueInput : ${\n typeSnippet(innerElementSize)}) {\n let col = colIn * ${innerElementSize};\n if (row < uniforms.dimAOuter && (col + ${\n innerElementSize - 1}) < uniforms.dimBOuter) {\n var value = valueInput;\n let outCoord = vec4(\n batch,\n row / uniforms.outShape[2],\n row % uniforms.outShape[2],\n col);\n result[getIndexFromCoords4D(outCoord, uniforms.outShape)/${\n innerElementSize}] = value;\n }\n }`;\n return userCode;\n}\n\nexport class Conv2DDerInputMMProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[], y: number[], z: number[]};\n dispatch: [number, number, number];\n variableNames = ['x', 'W'];\n variableTypes: string[];\n uniforms =\n 'filterDims : vec2, pads : vec2, stride : vec2, outBackprop : vec4, dimAOuter : i32, dimBOuter : i32, dimInner : i32,';\n workGroupSize: [number, number, number];\n elementsPerThread: [number, number, number];\n isVec4?: boolean;\n\n constructor(convInfo: backend_util.Conv2DInfo) {\n this.outputShape = convInfo.inShape;\n\n util.assert(\n convInfo.dataFormat === 'channelsLast',\n () => 'TODO: NCHW is unimplemented');\n this.isVec4 =\n convInfo.inChannels % 4 === 0 && convInfo.outChannels % 4 === 0;\n this.dispatchLayout = {x: [3], y: [1, 2], z: [0]};\n this.workGroupSize = computeWorkGroupSizeForConv2d(\n this.dispatchLayout, this.outputShape, this.isVec4);\n this.elementsPerThread = computeWorkPerThreadForConv2d(\n this.dispatchLayout, this.outputShape, this.isVec4);\n\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize,\n this.elementsPerThread);\n\n if (this.isVec4) {\n this.variableTypes = ['vec4', 'f32'];\n }\n\n this.shaderKey =\n `conv2DDerInputMM_${this.isVec4}_${this.elementsPerThread}`;\n }\n\n getUserCode(): string {\n const matMulSource = this.isVec4 ?\n makeMatMulPackedVec4Source(this.elementsPerThread, this.workGroupSize) :\n makeMatMulPackedSource(this.elementsPerThread, this.workGroupSize);\n const userCode = `\n ${conv2dTransposeCommonSnippet(this.isVec4 ? 4 : 1)}\n ${matMulSource}\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class Conv2DDerInputProgram implements WebGPUProgram {\n variableNames = ['dy', 'W'];\n uniforms =\n 'filterDims : vec2, pads : vec2, stride : vec2, outBackprop : vec4,';\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n workGroupSize: [number, number, number] = [64, 1, 1];\n isChannelsLast: boolean;\n size = true;\n\n constructor(convInfo: backend_util.Conv2DInfo) {\n this.outputShape = convInfo.inShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize);\n this.isChannelsLast = convInfo.dataFormat === 'channelsLast';\n this.shaderKey = `conv2DDerInput_${this.isChannelsLast}`;\n }\n\n getUserCode(): string {\n const rowDim = this.isChannelsLast ? 1 : 2;\n const colDim = this.isChannelsLast ? 2 : 3;\n const channelDim = this.isChannelsLast ? 3 : 1;\n return `\n ${main('index')} {\n if(index < uniforms.size) {\n let coords = getCoordsFromIndex(index);\n let batch = coords[0];\n let d1 = coords[${channelDim}];\n\n let dyCorner = vec2(coords[${rowDim}], coords[${\n colDim}]) - uniforms.pads;\n let dyRCorner = dyCorner.x;\n let dyCCorner = dyCorner.y;\n\n // Convolve dy(?, ?, d2) with w(:, :, d1, d2) to compute dx(xR, xC, d1).\n // ? = to be determined. : = across all values in that axis.\n var dotProd = 0.0;\n for (var wR = 0; wR < uniforms.filterDims.x; wR = wR + 1) {\n let dyR = (f32(dyRCorner) + f32(wR)) / f32(uniforms.stride.x);\n let wRPerm = uniforms.filterDims.x - 1 - wR;\n if (dyR < 0.0 || dyR >= f32(uniforms.outBackprop[1]) || fract(dyR) > 0.0 ||\n wRPerm < 0) {\n continue;\n }\n let idyR = i32(dyR);\n\n for (var wC = 0; wC < uniforms.filterDims.y; wC = wC + 1) {\n let dyC = (f32(dyCCorner) + f32(wC)) / f32(uniforms.stride.y);\n let wCPerm = uniforms.filterDims.y - 1 - wC;\n if (dyC < 0.0 || dyC >= f32(uniforms.outBackprop[2]) ||\n fract(dyC) > 0.0 || wCPerm < 0) {\n continue;\n }\n let idyC = i32(dyC);\n\n for (var d2 = 0; d2 < uniforms.outBackprop[3]; d2 = d2 + 1) {\n if (${this.isChannelsLast}) {\n let xValue = getDy(batch, idyR, idyC, d2);\n let wValue = getW(wRPerm, wCPerm, d1, d2);\n dotProd = dotProd + xValue * wValue;\n } else {\n let xValue = getDy(batch, d2, idyR, idyC);\n let wValue = getW(wRPerm, wCPerm, d1, d2);\n dotProd = dotProd + xValue * wValue;\n }\n\n }\n }\n }\n setOutputAtIndex(index, dotProd);\n }\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, Conv2DBackpropInput, Conv2DBackpropInputAttrs, Conv2DBackpropInputInputs, env, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {Conv2DDerInputMMProgram} from '../conv_backprop_mm_webgpu';\nimport {Conv2DDerInputProgram} from '../conv_backprop_webgpu';\n\nexport function conv2DBackpropInput(args: {\n inputs: Conv2DBackpropInputInputs,\n attrs: Conv2DBackpropInputAttrs,\n backend: WebGPUBackend\n}) {\n const {inputs, backend, attrs} = args;\n const {dy, filter} = inputs;\n const {inputShape, strides, pad, dataFormat, dimRoundingMode} = attrs;\n\n const $dataFormat = backend_util.convertConv2DDataFormat(dataFormat);\n const convInfo = backend_util.computeConv2DInfo(\n inputShape, filter.shape as [number, number, number, number], strides,\n 1 /* dilations */, pad, dimRoundingMode, false, $dataFormat);\n\n const dimensions = [\n {type: 'int32', data: [convInfo.filterHeight, convInfo.filterWidth]},\n {\n type: 'int32',\n data: [\n convInfo.filterHeight - 1 - convInfo.padInfo.top,\n convInfo.filterWidth - 1 - convInfo.padInfo.left\n ]\n },\n {type: 'int32', data: [convInfo.strideHeight, convInfo.strideWidth]},\n {\n type: 'int32',\n data: [\n convInfo.batchSize, convInfo.outHeight, convInfo.outWidth,\n convInfo.outChannels\n ]\n },\n ];\n let program: Conv2DDerInputProgram|Conv2DDerInputMMProgram;\n // When filter size is small, Conv2DDerInputProgram is much faster than\n // Conv2DDerInputMMProgram.\n if (env().getBool('WEBGPU_USE_NAIVE_CONV2D_TRANSPOSE') ||\n convInfo.filterHeight <= 2 && convInfo.filterWidth <= 2 &&\n convInfo.outChannels <= 16 && convInfo.inChannels === 1) {\n program = new Conv2DDerInputProgram(convInfo);\n } else {\n program = new Conv2DDerInputMMProgram(convInfo);\n const dimAOuter = convInfo.inHeight * convInfo.inWidth;\n const dimBOuter = convInfo.inChannels;\n const dimInner =\n convInfo.filterHeight * convInfo.filterWidth * convInfo.outChannels;\n dimensions.push(\n {type: 'uint32', data: [dimAOuter]},\n {type: 'uint32', data: [dimBOuter]},\n {type: 'uint32', data: [dimInner]});\n }\n return backend.runWebGPUProgram(program, [dy, filter], 'float32', dimensions);\n}\n\nexport const conv2DBackpropInputConfig: KernelConfig = {\n kernelName: Conv2DBackpropInput,\n backendName: 'webgpu',\n kernelFunc: conv2DBackpropInput as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Cos, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const cos = unaryKernelFunc({opType: UnaryOpType.COS});\n\nexport const cosConfig: KernelConfig = {\n kernelName: Cos,\n backendName: 'webgpu',\n kernelFunc: cos\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Cosh, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const cosh = unaryKernelFunc({opType: UnaryOpType.COSH});\n\nexport const coshConfig: KernelConfig = {\n kernelName: Cosh,\n backendName: 'webgpu',\n kernelFunc: cosh\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class CropAndResizeProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames = ['Image', 'Boxes', 'BoxInd'];\n uniforms = 'extrapolationValue : f32,';\n workGroupSize: [number, number, number] = [64, 1, 1];\n methodId: number;\n cropHeightBiggerThan1: boolean;\n cropWidthBiggerThan1: boolean;\n size = true;\n\n constructor(\n channnel: number, boxShape: [number, number], cropSize: [number, number],\n method: 'bilinear'|'nearest') {\n const [numBoxes, ] = boxShape;\n this.outputShape = [numBoxes, cropSize[0], cropSize[1], channnel];\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize);\n\n this.methodId = method === 'bilinear' ? 1 : 0;\n this.cropHeightBiggerThan1 = this.outputShape[1] > 1;\n this.cropWidthBiggerThan1 = this.outputShape[2] > 1;\n this.shaderKey = `cropAndResize_${this.methodId}_${\n this.cropHeightBiggerThan1}_${this.cropWidthBiggerThan1}`;\n }\n\n getUserCode(): string {\n const [inputHeightFloat, inputWidthFloat] =\n [`f32(uniforms.imageShape[1] - 1)`, `f32(uniforms.imageShape[2] - 1)`];\n\n const [heightRatio, heightScale, inY] = this.cropHeightBiggerThan1 ?\n [\n `(${inputHeightFloat} / f32(uniforms.outShape[1] - 1))`,\n '(y2-y1) * height_ratio',\n `y1*${inputHeightFloat} + f32(y)*(height_scale)`,\n ] :\n [\n '0.0',\n '0.0',\n `0.5 * (y1+y2) * ${inputHeightFloat}`,\n ];\n const [widthRatio, widthScale, inX] = this.cropWidthBiggerThan1 ?\n [\n `(${inputWidthFloat} / f32(uniforms.outShape[2] - 1))`,\n '(x2-x1) * width_ratio',\n `x1*${inputWidthFloat} + f32(x)*(width_scale)`,\n ] :\n [\n '0.0',\n '0.0',\n `0.5 * (x1+x2) * ${inputWidthFloat}`,\n ];\n\n // Reference implementation\n // tslint:disable-next-line:max-line-length\n // https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/kernels/crop_and_resize_op_gpu.cu.cc\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n let coords = getCoordsFromIndex(index);\n let height_ratio = f32(${heightRatio});\n let width_ratio = f32(${widthRatio});\n let b = coords[0];\n let y = coords[1];\n let x = coords[2];\n let d = coords[3];\n // get box vals\n let y1 = getBoxes(b, 0);\n let x1 = getBoxes(b, 1);\n let y2 = getBoxes(b, 2);\n let x2 = getBoxes(b, 3);\n // get image in batch index\n let bInd = i32(round(getBoxInd(b)));\n if(bInd < 0 || bInd >= uniforms.outShape[0]) {\n return;\n }\n let height_scale = ${heightScale};\n let width_scale = ${widthScale};\n let in_y = ${inY};\n if( in_y < 0.0 || in_y > ${inputHeightFloat} ) {\n setOutputAtIndex(index, uniforms.extrapolationValue);\n return;\n }\n let in_x = ${inX};\n if( in_x < 0.0 || in_x > ${inputWidthFloat} ) {\n setOutputAtIndex(index, uniforms.extrapolationValue);\n return;\n }\n let sourceFracIndexCR = vec2(in_x,in_y);\n if(${this.methodId} == 1) {\n // Compute the four integer indices.\n let sourceFloorCR = vec2(sourceFracIndexCR);\n let sourceCeilCR = vec2(ceil(sourceFracIndexCR));\n let topLeft = getImage(bInd, sourceFloorCR.y, sourceFloorCR.x, d);\n let bottomLeft = getImage(bInd, sourceCeilCR.y, sourceFloorCR.x, d);\n let topRight = getImage(bInd, sourceFloorCR.y, sourceCeilCR.x, d);\n let bottomRight = getImage(bInd, sourceCeilCR.y, sourceCeilCR.x, d);\n let fracCR = sourceFracIndexCR - vec2(sourceFloorCR);\n let top = topLeft + (topRight - topLeft) * fracCR.x;\n let bottom = bottomLeft + (bottomRight - bottomLeft) * fracCR.x;\n let newValue = top + (bottom - top) * fracCR.y;\n setOutputAtIndex(index, newValue);\n } else {\n // Compute the coordinators of nearest neighbor point.\n let sourceNearestCR = vec2(floor(\n sourceFracIndexCR + vec2(0.5,0.5)));\n let newValue = getImage(\n bInd, sourceNearestCR.y, sourceNearestCR.x, d);\n setOutputAtIndex(index, newValue);\n }\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {CropAndResize, CropAndResizeAttrs, CropAndResizeInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {CropAndResizeProgram} from '../crop_and_resize_webgpu';\n\nexport const cropAndResize = (args: {\n inputs: CropAndResizeInputs,\n backend: WebGPUBackend,\n attrs: CropAndResizeAttrs\n}): TensorInfo => {\n const {inputs, backend, attrs} = args;\n const {image, boxes, boxInd} = inputs;\n const {cropSize, method, extrapolationValue} = attrs;\n\n const program = new CropAndResizeProgram(\n image.shape[3], boxes.shape as [number, number], cropSize, method);\n const uniformData = [{type: 'float32', data: [extrapolationValue]}];\n return backend.runWebGPUProgram(\n program, [image, boxes, boxInd], 'float32', uniformData);\n};\n\nexport const cropAndResizeConfig: KernelConfig = {\n kernelName: CropAndResize,\n backendName: 'webgpu',\n kernelFunc: cropAndResize as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport enum CumOpType {\n Prod = '*',\n Sum = '+',\n}\n\nexport class CumProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames = ['x'];\n workGroupSize: [number, number, number];\n // pow(i32, i32) is not supported, use pow(f32, f32) instead.\n uniforms = 'index : f32,';\n size = true;\n exclusive: boolean;\n reverse: boolean;\n op: CumOpType;\n\n constructor(\n op: CumOpType, shape: number[], exclusive: boolean, reverse: boolean) {\n const workGroupSizeX = 128;\n this.workGroupSize = [workGroupSizeX, 1, 1];\n this.outputShape = shape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize);\n this.exclusive = exclusive;\n this.reverse = reverse;\n this.op = op;\n this.shaderKey = `cum_${this.op}_${this.exclusive}_${this.reverse}`;\n }\n\n getUserCode(): string {\n const rank = this.outputShape.length;\n const initVal = this.op === CumOpType.Prod ? '1.0' : '0.0';\n const val = this.exclusive ? initVal :\n `getX(${getCoords(rank, 'coords', this.op)})`;\n const length = this.outputShape[this.outputShape.length - 1];\n let condition = '';\n let idxString = '';\n // When exclusive is set, the cum op becomes roll op that copies the\n // value from the previous index based on the direction specified by the\n // reverse flag.\n if (this.exclusive) {\n condition = this.reverse ? `end != ${length - 1}` : 'end != 0';\n idxString = this.reverse ? 'end + 1' : 'end - 1';\n } else {\n condition = this.reverse ? `end + pow2 < ${length}` : 'end >= pow2';\n idxString = (this.reverse ? 'end + pow2' : 'end - pow2');\n }\n return `\n ${main('index')} {\n if (index < uniforms.size) {\n var coords = getCoordsFromIndex(index);\n\n let end = ${getFinalCoord(rank, 'coords', this.op)};\n var val = ${val};\n let pow2 = i32(pow(2.0, uniforms.index));\n if (${condition}) {\n let idx = ${idxString};\n ${getFinalCoord(rank, 'coords', this.op)} = idx;\n val ${this.op}= getX(${getCoords(rank, 'coords', this.op)});\n }\n setOutputAtIndex(index, val);\n }\n }\n `;\n }\n}\n\nfunction getCoords(rank: number, name: string, op: CumOpType): string {\n if (rank === 1) {\n return `${name}`;\n } else if (rank === 2) {\n return `${name}.x, ${name}.y`;\n } else if (rank === 3) {\n return `${name}.x, ${name}.y, ${name}.z`;\n } else if (rank === 4) {\n return `${name}.x, ${name}.y, ${name}.z, ${name}.w`;\n } else {\n throw Error(`Cumulative ${op} for rank ${rank} is not yet supported`);\n }\n}\n\nfunction getFinalCoord(rank: number, name: string, op: CumOpType): string {\n if (rank === 1) {\n return `${name}`;\n } else if (rank === 2) {\n return `${name}.y`;\n } else if (rank === 3) {\n return `${name}.z`;\n } else if (rank === 4) {\n return `${name}.w`;\n } else {\n throw Error(`Cumulative ${op} for rank ${rank} is not yet supported`);\n }\n}\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {CumOpType, CumProgram} from '../cum_webgpu';\n\nimport {identity} from './Identity';\nimport {transpose} from './Transpose';\n\nexport function cumImpl(\n op: CumOpType, x: TensorInfo, backend: WebGPUBackend, axis: number,\n exclusive: boolean, reverse: boolean): TensorInfo {\n const xRank = x.shape.length;\n const permutation = backend_util.getAxesPermutation([axis], xRank);\n let permutedX = x;\n if (permutation != null) {\n permutedX = transpose({inputs: {x}, backend, attrs: {perm: permutation}});\n }\n const permutedAxis = backend_util.getInnerMostAxes(1, xRank)[0];\n\n if (permutedAxis !== xRank - 1) {\n throw new Error(\n `WebGPU cumprod shader expects an inner-most axis=${\n x.shape.length - 1} ` +\n `but got axis=${axis}`);\n }\n const size = permutedX.shape[permutedAxis];\n let result = identity({inputs: {x: permutedX}, backend});\n // Use cum parallel algorithm, inspired by:\n // https://developer.nvidia.com/gpugems/gpugems3/part-vi-gpu-computing/chapter-39-parallel-prefix-sum-scan-cuda\n // Note: although the algorithm is called sum, it works for any associtative\n // operator with an identity.\n\n for (let i = 0; i <= Math.ceil(Math.log2(size)) - 1; i++) {\n const program = new CumProgram(op, permutedX.shape, false, reverse);\n const prevResult = result;\n const uniformData = [{type: 'float32', data: [i]}];\n result =\n backend.runWebGPUProgram(program, [result], result.dtype, uniformData);\n backend.disposeData(prevResult.dataId);\n }\n // For exclusive cum, shift the end result in the direction of product or sum\n // and add 1 for product or 0 for sum to the front index.\n if (exclusive) {\n const program = new CumProgram(op, permutedX.shape, exclusive, reverse);\n const prevResult = result;\n const uniformData = [{type: 'float32', data: [0]}];\n result =\n backend.runWebGPUProgram(program, [result], result.dtype, uniformData);\n backend.disposeData(prevResult.dataId);\n }\n\n if (permutation != null) {\n const reversePermutation = backend_util.getUndoAxesPermutation(permutation);\n const reverseTransposedResult = transpose(\n {inputs: {x: result}, backend, attrs: {perm: reversePermutation}});\n\n backend.disposeData(result.dataId);\n backend.disposeData(permutedX.dataId);\n\n return reverseTransposedResult;\n }\n\n return result;\n}\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Cumprod, CumprodAttrs, CumprodInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {CumOpType} from '../cum_webgpu';\nimport {cumImpl} from './Cum_impl';\n\nexport function cumprod(\n args: {inputs: CumprodInputs, backend: WebGPUBackend, attrs: CumprodAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {axis, exclusive, reverse} = attrs;\n return cumImpl(CumOpType.Prod, x, backend, axis, exclusive, reverse);\n}\n\nexport const cumprodConfig: KernelConfig = {\n kernelName: Cumprod,\n backendName: 'webgpu',\n kernelFunc: cumprod as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Cumsum, CumsumAttrs, CumsumInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {CumOpType} from '../cum_webgpu';\nimport {cumImpl} from './Cum_impl';\n\nexport function cumsum(\n args: {inputs: CumsumInputs, backend: WebGPUBackend, attrs: CumsumAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {axis, exclusive, reverse} = attrs;\n return cumImpl(CumOpType.Sum, x, backend, axis, exclusive, reverse);\n}\n\nexport const cumsumConfig: KernelConfig = {\n kernelName: Cumsum,\n backendName: 'webgpu',\n kernelFunc: cumsum as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class DepthToSpaceProgram implements WebGPUProgram {\n variableNames = ['x'];\n outputShape: number[];\n dataFormat: string;\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n workGroupSize: [number, number, number] = [64, 1, 1];\n size = true;\n uniforms = 'blockSize : i32,';\n\n constructor(outputShape: number[], dataFormat: 'NHWC'|'NCHW') {\n this.outputShape = outputShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize);\n this.shaderKey = `depthToSpace_${dataFormat}`;\n this.dataFormat = dataFormat;\n }\n\n getUserCode(): string {\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n let coords = getCoordsFromIndex(index);\n let b = coords[0];\n let h = ${this.getHeightCoordString()};\n let w = ${this.getWidthCoordString()};\n let d = ${this.getDepthCoordString()};\n\n let in_h = h / uniforms.blockSize;\n let offset_h = h % uniforms.blockSize;\n let in_w = w / uniforms.blockSize;\n let offset_w = w % uniforms.blockSize;\n let offset_d = (offset_h * uniforms.blockSize + offset_w) *\n ${this.getOutputDepthSize()};\n let in_d = d + offset_d;\n\n let rlt = ${this.getInputSamplingString()};\n setOutputAtIndex(index, rlt);\n }\n }`;\n return userCode;\n }\n\n private getHeightCoordString(): string {\n if (this.dataFormat === 'NHWC') {\n return `coords[1]`;\n } else {\n return `coords[2]`;\n }\n }\n\n private getWidthCoordString(): string {\n if (this.dataFormat === 'NHWC') {\n return `coords[2]`;\n } else {\n return `coords[3]`;\n }\n }\n\n private getDepthCoordString(): string {\n if (this.dataFormat === 'NHWC') {\n return `coords[3]`;\n } else {\n return `coords[1]`;\n }\n }\n\n private getOutputDepthSize(): string {\n if (this.dataFormat === 'NHWC') {\n return `uniforms.outShape[3]`;\n } else {\n return `uniforms.outShape[1]`;\n }\n }\n\n private getInputSamplingString(): string {\n if (this.dataFormat === 'NHWC') {\n return `getX(b, in_h, in_w, in_d)`;\n } else {\n return `getX(b, in_d, in_h, in_w)`;\n }\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DepthToSpace, DepthToSpaceAttrs, DepthToSpaceInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {DepthToSpaceProgram} from '../depth_to_space_webgpu';\n\nexport function depthToSpace(args: {\n inputs: DepthToSpaceInputs,\n backend: WebGPUBackend,\n attrs: DepthToSpaceAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {blockSize, dataFormat} = attrs;\n\n const batchSize = x.shape[0];\n const inputHeight = (dataFormat === 'NHWC') ? x.shape[1] : x.shape[2];\n const inputWidth = (dataFormat === 'NHWC') ? x.shape[2] : x.shape[3];\n const inputDepth = (dataFormat === 'NHWC') ? x.shape[3] : x.shape[1];\n\n const outputHeight = inputHeight * blockSize;\n const outputWidth = inputWidth * blockSize;\n const outputDepth = inputDepth / (blockSize * blockSize);\n\n const outputShape = (dataFormat === 'NHWC') ?\n [batchSize, outputHeight, outputWidth, outputDepth] :\n [batchSize, outputDepth, outputHeight, outputWidth];\n\n const uniformData = [\n {type: 'int32', data: [blockSize]},\n ];\n\n const program = new DepthToSpaceProgram(outputShape, dataFormat);\n return backend.runWebGPUProgram(program, [x], x.dtype, uniformData);\n}\n\nexport const depthToSpaceConfig: KernelConfig = {\n kernelName: DepthToSpace,\n backendName: 'webgpu',\n kernelFunc: depthToSpace as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\n\nimport {activationFnSnippet, biasActivationSnippet} from './activation_util';\nimport {getWorkGroupSizeString, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch} from './webgpu_util';\n\nexport class DepthwiseConv2DNCHWSharedProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[], y: number[], z: number[]};\n dispatch: [number, number, number];\n variableNames = ['x', 'W'];\n uniforms = `pad : vec2, inDims : vec2,`;\n workGroupSize: [number, number, number] = [16, 16, 1];\n addBias: boolean;\n activation: backend_util.Activation;\n hasPreluActivation: boolean;\n filterHeight: number;\n filterWidth: number;\n\n constructor(\n outputShape: number[], filterHeight: number, filterWidth: number,\n addBias = false, activation: backend_util.Activation = null,\n hasPreluActivation = false) {\n this.outputShape = outputShape;\n this.dispatchLayout = {x: [3], y: [2], z: [0, 1]};\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize);\n\n if (addBias) {\n this.variableNames.push('bias');\n }\n if (hasPreluActivation) {\n this.variableNames.push('preluActivationWeights');\n }\n\n this.addBias = addBias;\n this.activation = activation;\n this.hasPreluActivation = hasPreluActivation;\n this.filterHeight = filterHeight;\n this.filterWidth = filterWidth;\n this.shaderKey = `depthwiseNCHW_${this.activation}_${this.filterHeight}_${\n this.filterWidth}`;\n }\n\n getUserCode(): string {\n const filterSize = this.filterWidth * this.filterHeight;\n const workGroupSize =\n this.workGroupSize[0] * this.workGroupSize[1] * this.workGroupSize[2];\n const tileAHeight = this.workGroupSize[1] + this.filterHeight - 1;\n const tileAWidth = this.workGroupSize[0] + this.filterWidth - 1;\n\n const userCode = `\n ${activationFnSnippet(this.activation, this.hasPreluActivation, false, 4)}\n\n var mm_Asub : array, ${tileAHeight}>;\n var mm_Bsub : array, ${\n this.filterHeight}>;\n fn readX(batch : i32, channel : i32, row : i32, col : i32) -> f32 {\n var value = 0.0;\n if (row >=0 && row < uniforms.inDims[0] && col >=0 && col < uniforms.inDims[1])\n {\n value = getX(batch, channel, row, col);\n }\n return value;\n }\n\n ${getWorkGroupSizeString()}\n fn _start(@builtin(local_invocation_id) LocalId : vec3,\n @builtin(global_invocation_id) GlobalId : vec3,\n @builtin(local_invocation_index) LocalIndex: u32,\n @builtin(num_workgroups) NumWorkgroups: vec3) {\n localId = LocalId;\n globalId = GlobalId;\n let localIndex = i32(LocalIndex);\n numWorkgroups = NumWorkgroups;\n let coords = getOutputCoords();\n let batch = coords[0];\n let xRCCorner = vec2(coords.zw) - uniforms.pad;\n let channelMul = uniforms.wShape[3];\n let d1 = coords[1] / channelMul;\n let q = coords[1] % channelMul;\n\n let inputRowStart = xRCCorner.x;\n let inputColStart = xRCCorner.y;\n\n let localRow = i32(localId.y);\n let localCol = i32(localId.x);\n\n // Load one tile of X into local memory.\n for (var inputRow = localRow; inputRow < ${\n tileAHeight}; inputRow = inputRow + ${this.workGroupSize[1]}) {\n for (var inputCol = localCol; inputCol < ${\n tileAWidth}; inputCol = inputCol + ${this.workGroupSize[0]}) {\n let rowOffset = inputRow - localRow;\n let colOffset = inputCol - localCol;\n mm_Asub[inputRow][inputCol] = readX(batch, d1, inputRowStart + rowOffset, inputColStart + colOffset);\n }\n }\n\n // Load one tile of W into local memory.\n var wIndex = localIndex;\n ${\n filterSize < workGroupSize ?\n `if (wIndex < ${filterSize})` :\n `for(; wIndex < ${filterSize}; wIndex = wIndex + ${workGroupSize})`}\n\n {\n let wRow = wIndex / ${this.filterWidth};\n let wCol = wIndex % ${this.filterWidth};\n mm_Bsub[wRow][wCol] = getW(wRow, wCol, d1, q);\n }\n\n workgroupBarrier();\n\n var value = 0.0;\n for (var wR = 0; wR < ${this.filterHeight}; wR = wR + 1) {\n for (var wC = 0; wC < ${this.filterWidth}; wC = wC + 1) {\n let xVal = mm_Asub[localRow + wR][localCol + wC];\n let wVal = mm_Bsub[wR][wC];\n value = fma(xVal, wVal, value);\n }\n }\n ${biasActivationSnippet(this.addBias, this.activation)}\n if (coordsInBounds4D(coords, uniforms.outShape)) {\n setOutputAtCoords(coords[0], coords[1], coords[2], coords[3], value);\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, util} from '@tensorflow/tfjs-core';\nimport {activationFnSnippet, biasActivationSnippet} from './activation_util';\nimport {getWorkGroupSizeString, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch} from './webgpu_util';\n\nexport class DepthwiseConv2DVec4Program implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[], y: number[], z: number[]};\n dispatch: [number, number, number];\n variableNames = ['x', 'W'];\n uniforms = 'pad : vec2, inDims : vec2,';\n workGroupSize: [number, number, number] = [4, 4, 4];\n workPerThread = 4;\n convInfo: backend_util.Conv2DInfo;\n addBias: boolean;\n activation: backend_util.Activation;\n hasPreluActivation: boolean;\n isVec4 = true;\n\n constructor(\n convInfo: backend_util.Conv2DInfo, addBias = false,\n activation: backend_util.Activation = null, hasPreluActivation = false) {\n this.outputShape = convInfo.outShape;\n this.dispatchLayout = {x: [3], y: [2], z: [0, 1]};\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize,\n [4, this.workPerThread, 1]);\n\n util.assert(\n convInfo.dataFormat === 'channelsLast',\n () => 'TODO: NCHW is unimplemented');\n\n if (addBias) {\n this.variableNames.push('bias');\n }\n if (hasPreluActivation) {\n this.variableNames.push('preluActivationWeights');\n }\n\n this.convInfo = convInfo;\n this.addBias = addBias;\n this.activation = activation;\n this.hasPreluActivation = hasPreluActivation;\n\n this.shaderKey =\n `depthwiseVec4_${activation}_${this.convInfo.filterHeight}_${\n this.convInfo.filterWidth}_${this.convInfo.strideHeight}_${\n this.convInfo.strideWidth}_${this.workPerThread}`;\n }\n\n getUserCode(): string {\n const xNumber = (this.workPerThread - 1) * this.convInfo.strideWidth +\n this.convInfo.filterWidth;\n\n const userCode = `\n ${activationFnSnippet(this.activation, this.hasPreluActivation, true, 4)}\n fn readX(batch : i32, row : i32, col : i32, channel : i32) -> vec4 {\n var value = vec4(0.0);\n if (col >=0 && col < uniforms.inDims[1]) {\n value = getX(batch, row, col, channel);\n }\n return value;\n }\n\n const strideHeight = ${this.convInfo.strideHeight};\n const strideWidth = ${this.convInfo.strideWidth};\n ${getWorkGroupSizeString()}\n fn _start(@builtin(global_invocation_id) globalId: vec3) {\n let batch = i32(globalId.z) / uniforms.outShape[1];\n let r = i32(globalId.z) % uniforms.outShape[1];\n let c = i32(globalId.y) * ${this.workPerThread};\n let d1 = i32(globalId.x) * 4;\n let xRCCorner = vec2(r, c) * vec2(strideHeight, strideWidth) - uniforms.pad;\n\n let xRCorner = xRCCorner.x;\n let xCCorner = xRCCorner.y;\n var xVals : array, ${xNumber}>;\n var dotProd : array, ${this.workPerThread}>;\n for (var i = 0; i < ${this.workPerThread}; i++) {\n dotProd[i] = vec4(0.0);\n }\n\n // Use constant instead of uniform can give better performance.\n for (var wR = 0; wR < ${this.convInfo.filterHeight}; wR = wR + 1) {\n let xR = xRCorner + wR;\n if (xR >=0 && xR < uniforms.inDims[0]) {\n for (var i = 0; i < ${xNumber}; i++) {\n xVals[i] = readX(batch, xR, xCCorner + i, d1);\n }\n for (var wC = 0; wC < ${this.convInfo.filterWidth}; wC = wC + 1) {\n let wValue = getW(wR, wC, d1, 0);\n for (var i = 0; i < ${this.workPerThread}; i++) {\n dotProd[i] = fma(xVals[i * strideWidth + wC], wValue, dotProd[i]);\n }\n }\n }\n }\n\n for (var i = 0; i < ${this.workPerThread}; i = i + 1) {\n let coords = vec4(batch, r, c + i, d1);\n if (coordsInBounds4D(coords, uniforms.outShape)) {\n var value = dotProd[i];\n ${biasActivationSnippet(this.addBias, this.activation)}\n setOutputAtCoords(coords[0], coords[1], coords[2], coords[3], value);\n }\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\n\nimport {activationFnSnippet, biasActivationSnippet} from './activation_util';\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class DepthwiseConv2DProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[], y?: number[], z?: number[]};\n dispatch: [number, number, number];\n variableNames = ['x', 'W'];\n uniforms = `pad : vec2, inDims : vec2, filterHeight : i32,\n filterWidth : i32, stride : vec2, dilation : vec2,`;\n // This is an experimental value.\n workGroupSize: [number, number, number] = [256, 1, 1];\n convInfo: backend_util.Conv2DInfo;\n addBias: boolean;\n activation: backend_util.Activation;\n hasPreluActivation: boolean;\n isChannelsLast: boolean;\n\n constructor(\n convInfo: backend_util.Conv2DInfo, addBias = false,\n activation: backend_util.Activation = null, hasPreluActivation = false) {\n this.outputShape = convInfo.outShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize);\n this.isChannelsLast = convInfo.dataFormat === 'channelsLast';\n\n if (addBias) {\n this.variableNames.push('bias');\n }\n if (hasPreluActivation) {\n this.variableNames.push('preluActivationWeights');\n }\n\n this.convInfo = convInfo;\n this.addBias = addBias;\n this.activation = activation;\n this.hasPreluActivation = hasPreluActivation;\n this.shaderKey = `depthwise_${this.activation}_${this.isChannelsLast}`;\n }\n\n getUserCode(): string {\n const getXSnippet = this.isChannelsLast ? 'getX(batch, xR, xC, d1);' :\n 'getX(batch, d1, xR, xC);';\n\n const userCode = `\n ${activationFnSnippet(this.activation, this.hasPreluActivation, false, 4)}\n\n ${main()} {\n let coords = getOutputCoords();\n let batch = coords[0];\n let xRCCorner = vec2(coords.${\n this.isChannelsLast ? 'yz' : 'zw'}) * uniforms.stride - uniforms.pad;\n let d2 = coords[${this.isChannelsLast ? 3 : 1}];\n let channelMul = uniforms.wShape[3];\n let d1 = d2 / channelMul;\n let q = d2 % channelMul;\n\n let inputRowStart = xRCCorner.x;\n let inputColStart = xRCCorner.y;\n let inputRowEnd = inputRowStart + uniforms.filterHeight *\n uniforms.dilation[0];\n let inputColEnd = inputColStart + uniforms.filterWidth *\n uniforms.dilation[1];\n\n // Convolve x(?, ?, d1)|x(d1, ?, ?) with w(:, :, d1, q) to get\n // y(yR, yC, d2)|y(d2, yR, yC). ? = to be determined. : = across all\n // values in that axis. x(?, ?, d1) and y(yR, yC, d2) is for NHWC.\n // x(d1, ?, ?) and y(d2, yR, yC) is for NCHW.\n var value = 0.0;\n\n // Extract if checking out of for loop for performance.\n if (inputRowStart >= 0 && inputColStart >= 0 &&\n inputRowEnd < uniforms.inDims[0] &&\n inputColEnd < uniforms.inDims[1]) {\n for (var wR = 0; wR < uniforms.filterHeight; wR = wR + 1) {\n let xR = inputRowStart + wR * uniforms.dilation[0];\n\n for (var wC = 0; wC < uniforms.filterWidth; wC = wC + 1) {\n let xC = inputColStart + wC * uniforms.dilation[1];\n\n let xVal = ${getXSnippet};\n let wVal = getW(wR, wC, d1, q);\n value = value + xVal * wVal;\n }\n }\n } else {\n for (var wR = 0; wR < uniforms.filterHeight; wR = wR + 1) {\n let xR = inputRowStart + wR * uniforms.dilation[0];\n\n if (xR < 0 || xR >= uniforms.inDims[0]) {\n continue;\n }\n\n for (var wC = 0; wC < uniforms.filterWidth; wC = wC + 1) {\n let xC = inputColStart + wC * uniforms.dilation[1];\n\n if (xC < 0 || xC >= uniforms.inDims[1]) {\n continue;\n }\n\n let xVal = ${getXSnippet};\n let wVal = getW(wR, wC, d1, q);\n value = value + xVal * wVal;\n }\n }\n }\n ${biasActivationSnippet(this.addBias, this.activation)}\n if (coordsInBounds4D(coords, uniforms.outShape)) {\n setOutputAtCoords(coords[0], coords[1], coords[2], coords[3], value);\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, DepthwiseConv2dNative, DepthwiseConv2dNativeAttrs, DepthwiseConv2dNativeInputs, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {DepthwiseConv2DNCHWSharedProgram} from '../depthwise_conv2d_nchw_shared_webgpu';\nimport {DepthwiseConv2DVec4Program} from '../depthwise_conv2d_vec4_webgpu';\nimport {DepthwiseConv2DProgram} from '../depthwise_conv2d_webgpu';\n\nexport function depthwiseConv2dNative(args: {\n inputs: DepthwiseConv2dNativeInputs,\n attrs: DepthwiseConv2dNativeAttrs,\n backend: WebGPUBackend\n}) {\n const {inputs, backend, attrs} = args;\n const {x, filter} = inputs;\n const {strides, pad, dataFormat, dilations, dimRoundingMode} = attrs;\n const $dataFormat = backend_util.convertConv2DDataFormat(dataFormat);\n let $dilations = dilations;\n if ($dilations == null) {\n $dilations = [1, 1];\n }\n\n const convInfo = backend_util.computeConv2DInfo(\n x.shape as [number, number, number, number],\n filter.shape as [number, number, number, number], strides, $dilations,\n pad, dimRoundingMode, true /* depthwise */, $dataFormat);\n const dimensions = [\n {type: 'int32', data: [convInfo.padInfo.top, convInfo.padInfo.left]},\n {type: 'int32', data: [convInfo.inHeight, convInfo.inWidth]},\n ];\n\n const isChannelsLast = convInfo.dataFormat === 'channelsLast';\n let program: DepthwiseConv2DProgram|DepthwiseConv2DVec4Program|\n DepthwiseConv2DNCHWSharedProgram;\n if (!isChannelsLast && convInfo.inHeight > 16 && convInfo.inWidth > 16 &&\n convInfo.strideHeight === 1 && convInfo.strideWidth === 1 &&\n convInfo.dilationWidth === 1 && convInfo.dilationHeight === 1 &&\n convInfo.inChannels === convInfo.outChannels) {\n program = new DepthwiseConv2DNCHWSharedProgram(\n convInfo.outShape, convInfo.filterHeight, convInfo.filterWidth);\n } else if (\n isChannelsLast && convInfo.inHeight > 4 && convInfo.inWidth > 4 &&\n convInfo.strideWidth <= 2 &&\n convInfo.inChannels === convInfo.outChannels &&\n convInfo.dilationHeight === 1 && convInfo.dilationWidth === 1 &&\n convInfo.inChannels % 4 === 0) {\n program = new DepthwiseConv2DVec4Program(convInfo);\n } else {\n program = new DepthwiseConv2DProgram(convInfo);\n dimensions.push(\n {type: 'int32', data: [convInfo.filterHeight]},\n {type: 'int32', data: [convInfo.filterWidth]},\n {type: 'int32', data: [convInfo.strideHeight, convInfo.strideWidth]}, {\n type: 'int32',\n data: [convInfo.dilationHeight, convInfo.dilationWidth]\n });\n }\n\n return backend.runWebGPUProgram(program, [x, filter], x.dtype, dimensions);\n}\n\nexport const depthwiseConv2dNativeConfig: KernelConfig = {\n kernelName: DepthwiseConv2dNative,\n backendName: 'webgpu',\n kernelFunc: depthwiseConv2dNative as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Multiply} from '@tensorflow/tfjs-core';\n\nimport {BinaryOpType} from '../binary_op_util';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {multiplyImplCPU as cpuMultiply} from '../kernel_utils/shared';\n\nexport const multiplyKernelFunc = binaryKernelFunc({\n opType: BinaryOpType.MUL,\n cpuKernelImpl: cpuMultiply,\n supportsComplex: true\n});\n\nexport const multiplyConfig: KernelConfig = {\n kernelName: Multiply,\n backendName: 'webgpu',\n kernelFunc: multiplyKernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Sum, SumAttrs, SumInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {reduce} from '../kernel_utils/reduce';\n\nexport function sum(\n args: {inputs: SumInputs, backend: WebGPUBackend, attrs: SumAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {axis, keepDims} = attrs;\n\n return reduce(x, axis, keepDims, 'sum', backend);\n}\n\nexport const sumConfig: KernelConfig = {\n kernelName: Sum,\n backendName: 'webgpu',\n kernelFunc: sum as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, Einsum, EinsumAttrs, EinsumInputs, KernelConfig, KernelFunc, Tensor, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\n\nimport {multiplyKernelFunc} from './Multiply';\nimport {reshape} from './Reshape';\nimport {sum} from './Sum';\nimport {transpose} from './Transpose';\n\nexport function einsum(\n args: {inputs: EinsumInputs, backend: WebGPUBackend, attrs: EinsumAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {equation} = attrs;\n const tensors = inputs as Tensor[];\n\n const {allDims, summedDims, idDims} =\n backend_util.decodeEinsumEquation(equation, tensors.length);\n backend_util.checkEinsumDimSizes(allDims.length, idDims, tensors);\n const {path, steps} = backend_util.getEinsumComputePath(summedDims, idDims);\n\n const nSteps = steps.length;\n let out: TensorInfo|null = null;\n let numDimsRemaining = allDims.length;\n const tensorsToDispose: TensorInfo[] = [];\n for (let i = 0; i < nSteps; ++i) {\n for (const idTerm of steps[i]) {\n const {permutationIndices: perm, expandDims: dimsToExpand} =\n backend_util.getEinsumPermutation(numDimsRemaining, idDims[idTerm]);\n let x: TensorInfo;\n if (backend_util.isIdentityPermutation(perm)) {\n x = tensors[idTerm];\n } else {\n x = transpose({inputs: {x: tensors[idTerm]}, backend, attrs: {perm}});\n tensorsToDispose.push(x);\n }\n const targetShape: number[] = x.shape.slice();\n for (let k = 0; k < dimsToExpand.length; ++k) {\n targetShape.splice(dimsToExpand[k], 0, 1);\n }\n\n if (!util.arraysEqual(x.shape, targetShape)) {\n x = reshape({inputs: {x}, backend, attrs: {shape: targetShape}});\n tensorsToDispose.push(x);\n }\n if (out === null) {\n out = x;\n } else {\n // tslint:disable-next-line: no-unnecessary-type-assertion\n out =\n multiplyKernelFunc({inputs: {a: x, b: out}, backend}) as TensorInfo;\n tensorsToDispose.push(out);\n }\n }\n if (i < nSteps - 1) {\n if (path[i] >= 0) {\n out = sum({\n inputs: {x: out},\n backend,\n attrs: {\n axis: path[i] - (allDims.length - numDimsRemaining),\n keepDims: false\n }\n });\n tensorsToDispose.push(out);\n }\n numDimsRemaining--;\n }\n }\n\n // Clean up intermediate tensors.\n for (const tensorInfo of tensorsToDispose) {\n if (tensorInfo === out) {\n continue;\n }\n backend.disposeData(tensorInfo.dataId);\n }\n\n return out;\n}\n\nexport const einsumConfig: KernelConfig = {\n kernelName: Einsum,\n backendName: 'webgpu',\n kernelFunc: einsum as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Elu, KernelConfig} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const elu = unaryKernelFunc({opType: UnaryOpType.ELU});\n\nexport const eluConfig: KernelConfig = {\n kernelName: Elu,\n backendName: 'webgpu',\n kernelFunc: elu\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Equal, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {BinaryOpType} from '../binary_op_util';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {equalImplCPU as cpuEqual} from '../kernel_utils/shared';\n\nexport const equal = binaryKernelFunc(\n {opType: BinaryOpType.EQUAL, dtype: 'bool', cpuKernelImpl: cpuEqual});\n\nexport const equalConfig: KernelConfig = {\n kernelName: Equal,\n backendName: 'webgpu',\n kernelFunc: equal\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Exp, KernelConfig} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {expImplCPU} from '../kernel_utils/shared';\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const exp = unaryKernelFunc({\n opType: UnaryOpType.EXP,\n cpuKernelImpl: expImplCPU,\n dtype: 'float32',\n});\n\nexport const expConfig: KernelConfig = {\n kernelName: Exp,\n backendName: 'webgpu',\n kernelFunc: exp\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the License);\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an AS IS BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ExpandDims, ExpandDimsAttrs, ExpandDimsInputs, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {reshape} from './Reshape';\n\nexport function expandDims(args: {\n inputs: ExpandDimsInputs,\n attrs: ExpandDimsAttrs,\n backend: WebGPUBackend\n}): TensorInfo {\n const {inputs, attrs, backend} = args;\n const {dim} = attrs;\n const {input} = inputs;\n\n const inputRank = input.shape.length;\n const newShape = input.shape.slice();\n let $dim = dim;\n if (dim < 0) {\n // Negative value is counted from the tail of rank.\n util.assert(\n -(inputRank + 1) <= dim,\n () => `Axis must be in the interval [${- (inputRank + 1)}, ${\n inputRank}]`);\n $dim = inputRank + dim + 1;\n }\n newShape.splice($dim, 0, 1);\n\n return reshape({inputs: {x: input}, backend, attrs: {shape: newShape}});\n}\n\nexport const expandDimsConfig: KernelConfig = {\n kernelName: ExpandDims,\n backendName: 'webgpu',\n kernelFunc: expandDims as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Expm1, KernelConfig} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {expm1ImplCPU} from '../kernel_utils/shared';\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const expm1 =\n unaryKernelFunc({opType: UnaryOpType.EXPM1, cpuKernelImpl: expm1ImplCPU});\n\nexport const expm1Config: KernelConfig = {\n kernelName: Expm1,\n backendName: 'webgpu',\n kernelFunc: expm1\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class FlipLeftRightProgram implements WebGPUProgram {\n outputShape: number[] = [];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames = ['x'];\n workGroupSize: [number, number, number] = [64, 1, 1];\n size = true;\n\n constructor(imageShape: [number, number, number, number]) {\n this.outputShape = imageShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize);\n this.shaderKey = 'flipLeftRight';\n }\n\n getUserCode(): string {\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n let coords = getCoordsFromIndex(index);\n let coordX = uniforms.xShape[2] - coords[2] - 1;\n let outputValue = getX(coords[0], coords[1], coordX, coords[3]);\n setOutputAtIndex(index, outputValue);\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Tensor4D} from '@tensorflow/tfjs-core';\nimport {FlipLeftRight, FlipLeftRightInputs} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {FlipLeftRightProgram} from '../flip_left_right_webgpu';\n\nexport const flipLeftRightConfig: KernelConfig = {\n kernelName: FlipLeftRight,\n backendName: 'webgpu',\n kernelFunc: ({inputs, backend}) => {\n const {image} = inputs as FlipLeftRightInputs;\n const webgpuBackend = backend as WebGPUBackend;\n\n const program = new FlipLeftRightProgram((image as Tensor4D).shape);\n const output =\n webgpuBackend.runWebGPUProgram(program, [image], image.dtype);\n return output;\n }\n};\n","\n/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Floor, KernelConfig} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {floorImplCPU} from '../kernel_utils/shared';\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const floor =\n unaryKernelFunc({opType: UnaryOpType.FLOOR, cpuKernelImpl: floorImplCPU});\n\nexport const floorConfig: KernelConfig = {\n kernelName: Floor,\n backendName: 'webgpu',\n kernelFunc: floor\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {FloorDiv, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {BinaryOpType} from '../binary_op_util';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nexport const floorDiv =\n binaryKernelFunc({opType: BinaryOpType.INT_DIV, dtype: 'int32'});\n\nexport const floorDivConfig: KernelConfig = {\n kernelName: FloorDiv,\n backendName: 'webgpu',\n kernelFunc: floorDiv\n};\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class FromPixelsProgram implements WebGPUProgram {\n dispatch: [number, number, number];\n dispatchLayout: {x: number[]};\n isFromPixels = true;\n outputShape: number[] = [0];\n shaderKey: string;\n importVideo: boolean;\n variableNames: string[] = [];\n workGroupSize: [number, number, number] =\n [256, 1, 1]; // The empirical value.\n\n constructor(outputShape: number[], numChannels: number, importVideo = false) {\n this.outputShape = outputShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize,\n [numChannels, 1, 1]);\n\n this.importVideo = importVideo;\n this.shaderKey = `fromPixels_${this.importVideo}`;\n }\n\n getUserCode(): string {\n const textureLoad = this.importVideo ?\n 'textureLoad(src, vec2(coords.yx));' :\n 'textureLoad(src, vec2(coords.yx), 0)';\n const textureType =\n this.importVideo ? 'texture_external' : 'texture_2d';\n return `\n @binding(1) @group(0) var src: ${textureType};\n ${main('index')} {\n let flatIndex = index * uniforms.numChannels;\n if (flatIndex < uniforms.size) {\n let coords = getCoordsFromIndex(flatIndex);\n let values = ${textureLoad};\n for (var i = 0; i < uniforms.numChannels; i = i + 1) {\n result[flatIndex + i] = i32(floor(255.0 * values[i]));\n }\n }\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use backend file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\nimport {FromPixels, FromPixelsAttrs, FromPixelsInputs, util} from '@tensorflow/tfjs-core';\nimport {backend_util, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {TextureInfo, WebGPUBackend} from '../backend_webgpu';\nimport {FromPixelsProgram} from '../from_pixels_webgpu';\n\nexport const fromPixelsConfig: KernelConfig = {\n kernelName: FromPixels,\n backendName: 'webgpu',\n kernelFunc: fromPixels as {} as KernelFunc,\n};\n\nlet fromPixels2DContext: CanvasRenderingContext2D;\nlet willReadFrequently = env().getBool('CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU');\nconst videoToTextureMap = new Map();\n\nexport function fromPixels(args: {\n inputs: FromPixelsInputs,\n backend: WebGPUBackend,\n attrs: FromPixelsAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n let {pixels} = inputs;\n const {numChannels} = attrs;\n\n if (pixels == null) {\n throw new Error('pixels passed to tf.browser.fromPixels() can not be null');\n }\n\n const isVideo = typeof (HTMLVideoElement) !== 'undefined' &&\n pixels instanceof HTMLVideoElement;\n const isImage = typeof (HTMLImageElement) !== 'undefined' &&\n pixels instanceof HTMLImageElement;\n const isCanvas = (typeof (HTMLCanvasElement) !== 'undefined' &&\n pixels instanceof HTMLCanvasElement) ||\n (typeof (OffscreenCanvas) !== 'undefined' &&\n pixels instanceof OffscreenCanvas);\n const isImageBitmap =\n typeof (ImageBitmap) !== 'undefined' && pixels instanceof ImageBitmap;\n\n const [width, height] = isVideo ?\n [\n (pixels as HTMLVideoElement).videoWidth,\n (pixels as HTMLVideoElement).videoHeight\n ] :\n [pixels.width, pixels.height];\n const outputShape = [height, width, numChannels];\n\n // Disable importExternalTexture temporarily as it has problem in spec and\n // browser impl\n const importVideo =\n false && env().getBool('WEBGPU_IMPORT_EXTERNAL_TEXTURE') && isVideo;\n const isVideoOrImage = isVideo || isImage;\n if (isImageBitmap || isCanvas || isVideoOrImage) {\n let textureInfo: TextureInfo;\n if (importVideo) {\n const videoElement = pixels as HTMLVideoElement;\n if (!(videoToTextureMap.has(videoElement)) ||\n (videoToTextureMap.get(videoElement) as GPUExternalTexture).expired) {\n const externalTextureDescriptor = {source: videoElement};\n videoToTextureMap.set(\n videoElement,\n backend.device.importExternalTexture(externalTextureDescriptor));\n }\n\n textureInfo = {\n width,\n height,\n format: null,\n usage: null,\n texture: videoToTextureMap.get(videoElement) as GPUExternalTexture\n };\n } else {\n if (isVideoOrImage) {\n const newWillReadFrequently =\n env().getBool('CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU');\n if (fromPixels2DContext == null ||\n newWillReadFrequently !== willReadFrequently) {\n willReadFrequently = newWillReadFrequently;\n fromPixels2DContext =\n document.createElement('canvas').getContext(\n '2d', {willReadFrequently}) as CanvasRenderingContext2D;\n }\n fromPixels2DContext.canvas.width = width;\n fromPixels2DContext.canvas.height = height;\n fromPixels2DContext.drawImage(\n pixels as HTMLVideoElement | HTMLImageElement, 0, 0, width, height);\n pixels = fromPixels2DContext.canvas;\n }\n\n const usage = GPUTextureUsage.COPY_DST |\n GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING;\n const format = 'rgba8unorm' as GPUTextureFormat;\n const texture = backend.textureManager.acquireTexture(\n outputShape[1], outputShape[0], format, usage);\n backend.queue.copyExternalImageToTexture(\n {source: pixels as HTMLCanvasElement | ImageBitmap}, {texture},\n [outputShape[1], outputShape[0]]);\n textureInfo = {width, height, format, usage, texture};\n }\n\n const size = util.sizeFromShape(outputShape);\n const strides = util.computeStrides(outputShape);\n const program =\n new FromPixelsProgram(outputShape, numChannels, importVideo);\n\n const uniformData = [\n {type: 'uint32', data: [size]}, {type: 'uint32', data: [numChannels]},\n {type: 'uint32', data: [...strides]}\n ];\n const input = backend.makeTensorInfo([height, width], 'int32');\n const info = backend.tensorMap.get(input.dataId);\n info.resourceInfo = textureInfo;\n\n const result =\n backend.runWebGPUProgram(program, [input], 'int32', uniformData);\n backend.disposeData(input.dataId);\n return result;\n }\n\n // TODO: Encoding should happen on GPU once we no longer have to download\n // image data to the CPU.\n const imageData = (pixels as ImageData | backend_util.PixelData).data;\n let pixelArray = imageData;\n if (numChannels != null && numChannels !== 4) {\n pixelArray = new Uint8Array(pixels.width * pixels.height * numChannels);\n\n const dataLength = imageData.length;\n let j = 0;\n for (let i = 0; i < dataLength; i++) {\n if (i % 4 < numChannels) {\n pixelArray[j++] = imageData[i];\n }\n }\n }\n\n const output =\n backend.makeTensorInfo(outputShape, 'int32', new Int32Array(pixelArray));\n backend.uploadToGPU(output.dataId);\n return output;\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util} from '@tensorflow/tfjs-core';\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class BatchNormProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[], y?: number[], z?: number[]};\n dispatch: [number, number, number];\n variableNames: string[];\n uniforms = 'varianceEpsilon : f32,';\n // This is an experimental value.\n workGroupSize: [number, number, number] = [128, 1, 1];\n offsetShape: number[]|null;\n scaleShape: number[]|null;\n varianceEpsilon: number;\n size = true;\n\n constructor(\n xShape: number[], meanShape: number[], varianceShape: number[],\n offsetShape: number[]|null, scaleShape: number[]|null) {\n this.variableNames = ['x', 'mean', 'variance'];\n backend_util.assertAndGetBroadcastShape(xShape, meanShape);\n backend_util.assertAndGetBroadcastShape(xShape, varianceShape);\n this.outputShape = xShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize);\n\n if (offsetShape != null) {\n backend_util.assertAndGetBroadcastShape(xShape, offsetShape);\n this.variableNames.push('offset');\n }\n if (scaleShape != null) {\n backend_util.assertAndGetBroadcastShape(xShape, scaleShape);\n this.variableNames.push('scale');\n }\n this.offsetShape = offsetShape;\n this.scaleShape = scaleShape;\n this.shaderKey = 'batchNorm';\n }\n\n getUserCode(): string {\n let offsetSnippet = '0.0';\n if (this.offsetShape != null) {\n offsetSnippet = 'getOffsetByOutputIndex(index)';\n }\n\n let scaleSnippet = '1.0';\n if (this.scaleShape != null) {\n scaleSnippet = 'getScaleByOutputIndex(index)';\n }\n\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size)\n {\n let xValue = getXByOutputIndex(index);\n let meanValue = getMeanByOutputIndex(index);\n let varianValue = getVarianceByOutputIndex(index);\n let offsetValue = ${offsetSnippet};\n let scaleValue = ${scaleSnippet};\n let inv = scaleValue * inverseSqrt(varianValue + f32(uniforms.varianceEpsilon));\n setOutputAtIndex(index,dot(vec3(xValue, -meanValue, offsetValue), vec3(inv, inv, 1.0)));\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {FusedBatchNorm, FusedBatchNormAttrs, FusedBatchNormInputs, KernelConfig, Tensor} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\n\nimport {BatchNormProgram} from '../batchnorm_webgpu';\n\nexport const fusedBatchNormConfig: KernelConfig = {\n kernelName: FusedBatchNorm,\n backendName: 'webgpu',\n kernelFunc: ({inputs, attrs, backend}) => {\n const {x, scale, offset, mean, variance} = inputs as FusedBatchNormInputs;\n const {varianceEpsilon} = attrs as unknown as FusedBatchNormAttrs;\n const webGPUBackend = backend as WebGPUBackend;\n const batchNormInputs = [x as Tensor, mean as Tensor, variance as Tensor];\n let offsetShape = null;\n if (offset != null) {\n offsetShape = offset.shape;\n batchNormInputs.push(offset as Tensor);\n }\n let scaleShape = null;\n if (scale != null) {\n scaleShape = scale.shape;\n batchNormInputs.push(scale as Tensor);\n }\n const program = new BatchNormProgram(\n x.shape, mean.shape, variance.shape, offsetShape, scaleShape);\n const uniformData = [{type: 'float32', data: [varianceEpsilon]}];\n return webGPUBackend.runWebGPUProgram(\n program, batchNormInputs, x.dtype, uniformData);\n }\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, FusedConv2D, FusedConv2DAttrs, FusedConv2DInputs, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\n\nimport {conv2DImpl} from './Conv2D_impl';\n\nexport function fusedConv2d(args: {\n inputs: FusedConv2DInputs,\n attrs: FusedConv2DAttrs,\n backend: WebGPUBackend\n}) {\n const {inputs, backend, attrs} = args;\n const {x, filter, bias, preluActivationWeights} = inputs;\n const {\n strides,\n pad,\n dataFormat,\n dilations,\n dimRoundingMode,\n activation,\n leakyreluAlpha\n } = attrs;\n\n const $dataFormat = backend_util.convertConv2DDataFormat(dataFormat);\n const convInfo = backend_util.computeConv2DInfo(\n x.shape as [number, number, number, number],\n filter.shape as [number, number, number, number], strides, dilations, pad,\n dimRoundingMode, false /* depthwise */, $dataFormat);\n\n return conv2DImpl({\n x,\n filter,\n convInfo,\n backend,\n bias,\n preluActivationWeights,\n leakyreluAlpha,\n activation\n });\n}\n\nexport const fusedConv2DConfig: KernelConfig = {\n kernelName: FusedConv2D,\n backendName: 'webgpu',\n kernelFunc: fusedConv2d as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, FusedDepthwiseConv2D, FusedDepthwiseConv2DAttrs, FusedDepthwiseConv2DInputs, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {DepthwiseConv2DVec4Program} from '../depthwise_conv2d_vec4_webgpu';\nimport {DepthwiseConv2DProgram} from '../depthwise_conv2d_webgpu';\n\nexport function fusedDepthwiseConv2D(args: {\n inputs: FusedDepthwiseConv2DInputs,\n attrs: FusedDepthwiseConv2DAttrs,\n backend: WebGPUBackend\n}) {\n const {inputs, backend, attrs} = args;\n const {x, filter, bias, preluActivationWeights} = inputs;\n const {strides, pad, dilations, dimRoundingMode, activation, leakyreluAlpha} =\n attrs;\n\n let $dilations = dilations;\n if ($dilations == null) {\n $dilations = [1, 1];\n }\n\n util.assert(\n backend_util.eitherStridesOrDilationsAreOne(strides, $dilations),\n () => 'Error in depthwiseConv2d: Either strides or dilations must be ' +\n `1. Got strides ${strides} and dilations '${$dilations}'`);\n\n const convInfo = backend_util.computeConv2DInfo(\n x.shape as [number, number, number, number],\n filter.shape as [number, number, number, number], strides, $dilations,\n pad, dimRoundingMode, true /* depthwise */);\n\n const programInputs: TensorInfo[] = [x, filter];\n\n const hasBias = bias != null;\n const hasPreluActivationWeights = preluActivationWeights != null;\n\n if (hasBias) {\n programInputs.push(bias);\n }\n if (hasPreluActivationWeights) {\n programInputs.push(preluActivationWeights);\n }\n\n const dimensions = [\n {type: 'int32', data: [convInfo.padInfo.top, convInfo.padInfo.left]},\n {type: 'int32', data: [convInfo.inHeight, convInfo.inWidth]},\n ];\n\n let program: DepthwiseConv2DProgram|DepthwiseConv2DVec4Program;\n if (convInfo.inHeight > 4 && convInfo.inWidth > 4 &&\n convInfo.strideWidth <= 2 &&\n convInfo.inChannels === convInfo.outChannels &&\n convInfo.dilationHeight === 1 && convInfo.dilationWidth === 1 &&\n convInfo.inChannels % 4 === 0) {\n program = new DepthwiseConv2DVec4Program(\n convInfo, hasBias, activation, hasPreluActivationWeights);\n } else {\n program = new DepthwiseConv2DProgram(\n convInfo, hasBias, activation, hasPreluActivationWeights);\n dimensions.push(\n {type: 'int32', data: [convInfo.filterHeight]},\n {type: 'int32', data: [convInfo.filterWidth]},\n {type: 'int32', data: [convInfo.strideHeight, convInfo.strideWidth]}, {\n type: 'int32',\n data: [convInfo.dilationHeight, convInfo.dilationWidth]\n });\n }\n if (activation === 'leakyrelu') {\n dimensions.push({type: 'float32', data: [leakyreluAlpha]});\n program.uniforms += ' alpha : f32,';\n }\n const result =\n backend.runWebGPUProgram(program, programInputs, 'float32', dimensions);\n\n return result;\n}\n\nexport const fusedDepthwiseConv2DConfig: KernelConfig = {\n kernelName: FusedDepthwiseConv2D,\n backendName: 'webgpu',\n kernelFunc: fusedDepthwiseConv2D as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getCoordsDataType, getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class GatherNDProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames: string[] = ['A', 'indices'];\n uniforms: string;\n workGroupSize: [number, number, number] = [64, 1, 1];\n size = true;\n sliceDim: number;\n constructor(sliceDim: number, shape: number[]) {\n this.outputShape = shape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize);\n this.shaderKey = `gathernd_${sliceDim}`;\n this.sliceDim = sliceDim;\n this.uniforms = `sliceDim : i32, strides : ${getCoordsDataType(sliceDim)},`;\n }\n\n getUserCode(): string {\n let strideString;\n if (this.sliceDim > 1) {\n strideString = 'uniforms.strides[j]';\n } else {\n strideString = 'uniforms.strides';\n }\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n let coords = getCoordsFromIndex(index);\n var flattenIndex = 0;\n for (var j = 0; j < uniforms.sliceDim; j = j + 1) {\n let indexTemp = i32(round(getIndices(coords[0], j)));\n let strideNum = ${strideString};\n flattenIndex = flattenIndex + indexTemp * strideNum;\n }\n\n setOutputAtIndex(index, getA(flattenIndex, coords[1]));\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, GatherNd, GatherNdInputs, KernelConfig, KernelFunc, Rank, TensorInfo, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {GatherNDProgram} from '../gather_nd_webgpu';\nimport {gatherNdImplCPU} from '../kernel_utils/shared';\n\nimport {reshape} from './Reshape';\n\nexport function gatherNd(\n args: {inputs: GatherNdInputs, backend: WebGPUBackend}): TensorInfo {\n const {inputs, backend} = args;\n const {params, indices} = inputs;\n\n const indicesShape = indices.shape;\n const sliceRank = indicesShape[indicesShape.length - 1];\n const paramsSize = util.sizeFromShape(params.shape);\n\n const [resultShape, numSlices, sliceSize, strides] =\n backend_util.prepareAndValidate(params, indices);\n\n const flattenIndices = reshape(\n {inputs: {x: indices}, backend, attrs: {shape: [numSlices, sliceRank]}});\n const flattenX = reshape({\n inputs: {x: params},\n backend,\n attrs: {shape: [(util.sizeFromShape(params.shape) / sliceSize), sliceSize]}\n });\n if (backend.shouldExecuteOnCPU([params, indices]) ||\n params.dtype === 'string') {\n const indicesData = backend.readSync(indices.dataId) as TypedArray;\n const paramsBuf = backend.bufferSync(params);\n const outValue = gatherNdImplCPU(\n indicesData, paramsBuf, params.dtype, numSlices, sliceRank, sliceSize,\n strides, params.shape, paramsSize);\n\n return backend.makeTensorInfo(resultShape, params.dtype, outValue.values);\n }\n const program = new GatherNDProgram(sliceRank, [numSlices, sliceSize]);\n const uniformData =\n [{type: 'int32', data: [sliceRank]}, {type: 'int32', data: strides}];\n const res = backend.runWebGPUProgram(\n program, [flattenX, flattenIndices], flattenX.dtype, uniformData);\n\n const reshaped =\n reshape({inputs: {x: res}, backend, attrs: {shape: resultShape}});\n\n backend.disposeData(flattenIndices.dataId);\n backend.disposeData(flattenX.dataId);\n backend.disposeData(res.dataId);\n\n return reshaped;\n}\n\nexport const gatherNdConfig: KernelConfig = {\n kernelName: GatherNd,\n backendName: 'webgpu',\n kernelFunc: gatherNd as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class GatherProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames: string[] = ['A', 'indices'];\n workGroupSize: [number, number, number] = [64, 1, 1];\n aShape: number[];\n size = true;\n\n constructor(aShape: number[], outputShape: number[]) {\n this.outputShape = aShape.slice();\n this.aShape = aShape;\n this.outputShape = outputShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize);\n this.shaderKey = `gather`;\n }\n\n getUserCode(): string {\n const sourceCoords = getSourceCoords(this.aShape);\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n let resRC = getCoordsFromIndex(index);\n let indexZ = i32(getIndices(resRC.x, resRC.z));\n let inBounds = select(0.0, 1.0, indexZ >= 0 && indexZ < uniforms.aShape[2]);\n setOutputAtIndex(index, inBounds * getA(${sourceCoords}));\n }\n }\n `;\n return userCode;\n }\n}\n\n// The input and output are always flattened into rank 4 tensors.\nfunction getSourceCoords(aShape: number[]): string {\n const currentCoords = ['resRC.x', 'resRC.y', 'resRC.z', 'resRC.w'];\n const sourceCoords = [];\n for (let i = 0; i < aShape.length; i++) {\n if (i === 2) {\n sourceCoords.push('indexZ');\n } else {\n sourceCoords.push(`${currentCoords[i]}`);\n }\n }\n return sourceCoords.join();\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, buffer, GatherV2, GatherV2Attrs, GatherV2Inputs, KernelConfig, KernelFunc, Rank, TensorBuffer, TensorInfo, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {gatherV2ImplCPU} from '../kernel_utils/shared';\n\nimport {GatherProgram} from '../gather_webgpu';\nimport {reshape} from './Reshape';\n\nexport function gatherV2(\n args:\n {inputs: GatherV2Inputs, backend: WebGPUBackend, attrs: GatherV2Attrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x, indices} = inputs;\n const {axis, batchDims} = attrs;\n\n // Unlike WebGL, WebGPU won't check if index is out of bound by calling\n // backend.readSync() function in debug mode.\n const parsedAxis = util.parseAxisParam(axis, x.shape)[0];\n\n const shapeInfo = backend_util.segment_util.collectGatherOpShapeInfo(\n x, indices, parsedAxis, batchDims);\n\n const indicesSize = util.sizeFromShape(indices.shape);\n\n const toDispose = [];\n\n const flattenX = reshape({\n inputs: {x},\n backend,\n attrs: {\n shape: [\n shapeInfo.batchSize, shapeInfo.outerSize, shapeInfo.dimSize,\n shapeInfo.sliceSize\n ]\n }\n });\n\n const flattenIndex = reshape({\n inputs: {x: indices},\n backend,\n attrs: {shape: [shapeInfo.batchSize, indicesSize / shapeInfo.batchSize]}\n });\n\n toDispose.push(flattenX);\n toDispose.push(flattenIndex);\n\n const flattenOutputShape = [\n shapeInfo.batchSize, shapeInfo.outerSize, indicesSize / shapeInfo.batchSize,\n shapeInfo.sliceSize\n ];\n\n if (backend.shouldExecuteOnCPU([x, indices])) {\n const indicesBufferInfo = backend.tensorMap.get(flattenIndex.dataId);\n const indicesValues = indicesBufferInfo.values as TypedArray;\n const indicesBuf =\n buffer(flattenIndex.shape, flattenIndex.dtype, indicesValues) as\n TensorBuffer;\n const xBufferInfo = backend.tensorMap.get(flattenX.dataId);\n const xValues = xBufferInfo.values as TypedArray;\n const xBuf =\n buffer(flattenX.shape, flattenX.dtype, xValues) as TensorBuffer;\n const outBuf = gatherV2ImplCPU(xBuf, indicesBuf, flattenOutputShape);\n\n toDispose.forEach(t => backend.disposeData(t.dataId));\n\n return backend.makeTensorInfo(\n shapeInfo.outputShape, outBuf.dtype, outBuf.values as TypedArray);\n }\n\n const program = new GatherProgram(flattenX.shape, flattenOutputShape);\n const res = backend.runWebGPUProgram(\n program, [flattenX, flattenIndex], flattenX.dtype);\n toDispose.push(res);\n\n const reshaped = reshape(\n {inputs: {x: res}, backend, attrs: {shape: shapeInfo.outputShape}});\n toDispose.forEach(t => backend.disposeData(t.dataId));\n return reshaped;\n}\n\nexport const gatherV2Config: KernelConfig = {\n kernelName: GatherV2,\n backendName: 'webgpu',\n kernelFunc: gatherV2 as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Greater, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {BinaryOpType} from '../binary_op_util';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {greaterImplCPU as cpuGreater} from '../kernel_utils/shared';\n\nexport const greater = binaryKernelFunc({\n opType: BinaryOpType.GREATER,\n cpuKernelImpl: cpuGreater,\n dtype: 'bool',\n});\n\nexport const greaterConfig: KernelConfig = {\n kernelName: Greater,\n backendName: 'webgpu',\n kernelFunc: greater\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {GreaterEqual, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {BinaryOpType} from '../binary_op_util';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {greaterEqualImplCPU as cpuGreaterEqual} from '../kernel_utils/shared';\n\nexport const greaterEqual = binaryKernelFunc({\n opType: BinaryOpType.GREATER_EQUAL,\n dtype: 'bool',\n cpuKernelImpl: cpuGreaterEqual\n});\n\nexport const greaterEqualConfig: KernelConfig = {\n kernelName: GreaterEqual,\n backendName: 'webgpu',\n kernelFunc: greaterEqual\n};\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {IsNan, KernelConfig} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const isNaN =\n unaryKernelFunc({opType: UnaryOpType.IS_NAN, dtype: 'bool'});\n\nexport const isNaNConfig: KernelConfig = {\n kernelName: IsNan,\n backendName: 'webgpu',\n kernelFunc: isNaN\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, LeakyRelu, LeakyReluAttrs, LeakyReluInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {UnaryOpType} from '../unary_op_util';\nimport {UnaryOpProgram} from '../unary_op_webgpu';\n\nexport function leakyRelu(args: {\n inputs: LeakyReluInputs,\n backend: WebGPUBackend,\n attrs: LeakyReluAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {alpha} = attrs;\n const uniformData = [{type: 'float32', data: [alpha]}];\n const program = new UnaryOpProgram(x.shape, UnaryOpType.LEAKYRELU);\n program.uniforms = 'alpha : f32,';\n return backend.runWebGPUProgram(program, [x], 'float32', uniformData);\n}\n\nexport const leakyReluConfig: KernelConfig = {\n kernelName: LeakyRelu,\n backendName: 'webgpu',\n kernelFunc: leakyRelu as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Less} from '@tensorflow/tfjs-core';\n\nimport {BinaryOpType} from '../binary_op_util';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {lessImplCPU as cpuLess} from '../kernel_utils/shared';\n\nexport const less = binaryKernelFunc(\n {opType: BinaryOpType.LESS, dtype: 'bool', cpuKernelImpl: cpuLess});\n\nexport const lessConfig: KernelConfig = {\n kernelName: Less,\n backendName: 'webgpu',\n kernelFunc: less\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, LessEqual} from '@tensorflow/tfjs-core';\n\nimport {BinaryOpType} from '../binary_op_util';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {lessEqualImplCPU as cpuLessEqual} from '../kernel_utils/shared';\n\nexport const lessEqual = binaryKernelFunc({\n opType: BinaryOpType.LESS_EQUAL,\n dtype: 'bool',\n cpuKernelImpl: cpuLessEqual\n});\n\nexport const lessEqualConfig: KernelConfig = {\n kernelName: LessEqual,\n backendName: 'webgpu',\n kernelFunc: lessEqual\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Log} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {logImplCPU} from '../kernel_utils/shared';\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const log =\n unaryKernelFunc({opType: UnaryOpType.LOG, cpuKernelImpl: logImplCPU});\n\nexport const logConfig: KernelConfig = {\n kernelName: Log,\n backendName: 'webgpu',\n kernelFunc: log\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, LogicalAnd} from '@tensorflow/tfjs-core';\n\nimport {BinaryOpType} from '../binary_op_util';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nexport const logicalAnd =\n binaryKernelFunc({opType: BinaryOpType.LOGICAL_AND, dtype: 'bool'});\n\nexport const logicalAndConfig: KernelConfig = {\n kernelName: LogicalAnd,\n backendName: 'webgpu',\n kernelFunc: logicalAnd\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, LogicalNot} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const logicalNot = unaryKernelFunc({opType: UnaryOpType.LOGICAL_NOT});\n\nexport const logicalNotConfig: KernelConfig = {\n kernelName: LogicalNot,\n backendName: 'webgpu',\n kernelFunc: logicalNot\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Maximum} from '@tensorflow/tfjs-core';\n\nimport {BinaryOpType} from '../binary_op_util';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {maximumImplCPU as cpuMaximum} from '../kernel_utils/shared';\n\nexport const maximum = binaryKernelFunc({\n opType: BinaryOpType.MAX,\n cpuKernelImpl: cpuMaximum,\n});\n\nexport const maximumConfig: KernelConfig = {\n kernelName: Maximum,\n backendName: 'webgpu',\n kernelFunc: maximum\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {backend_util, KernelConfig, KernelFunc, MaxPool, MaxPoolAttrs, MaxPoolInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {poolImpl} from './Pool_impl';\n\nexport function maxPool(\n args: {inputs: MaxPoolInputs, backend: WebGPUBackend, attrs: MaxPoolAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {filterSize, strides, pad, dimRoundingMode} = attrs;\n const dilations = 1;\n const convInfo = backend_util.computePool2DInfo(\n x.shape as [number, number, number, number], filterSize, strides,\n dilations, pad, dimRoundingMode);\n\n return poolImpl(x, convInfo, 'max', backend);\n}\n\nexport const maxPoolConfig: KernelConfig = {\n kernelName: MaxPool,\n backendName: 'webgpu',\n kernelFunc: maxPool as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Min, MinAttrs, MinInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {reduce} from '../kernel_utils/reduce';\n\nexport function min(\n args: {inputs: MinInputs, backend: WebGPUBackend, attrs: MinAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {axis, keepDims} = attrs;\n\n return reduce(x, axis, keepDims, 'min', backend);\n}\n\nexport const minConfig: KernelConfig = {\n kernelName: Min,\n backendName: 'webgpu',\n kernelFunc: min as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Minimum} from '@tensorflow/tfjs-core';\n\nimport {BinaryOpType} from '../binary_op_util';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {minimumImplCPU as cpuMinimum} from '../kernel_utils/shared';\n\nexport const minimum = binaryKernelFunc({\n opType: BinaryOpType.MIN,\n cpuKernelImpl: cpuMinimum,\n});\n\nexport const minimumConfig: KernelConfig = {\n kernelName: Minimum,\n backendName: 'webgpu',\n kernelFunc: minimum\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getCoordsDataType, getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class MirrorPadProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n uniforms = '';\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames = ['x'];\n workGroupSize: [number, number, number] = [64, 1, 1];\n xShape: number[];\n offset: number;\n size = true;\n\n constructor(\n xShape: number[], paddings: Array<[number, number]>,\n mode: 'reflect'|'symmetric') {\n this.outputShape = paddings.map(\n (p, i) => p[0] /* beforePad */ + xShape[i] + p[1] /* afterPad */);\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize);\n\n this.xShape = xShape;\n paddings.map((_, i) => {\n this.uniforms += ` pad${i} : vec2,`;\n });\n this.offset = mode === 'reflect' ? 0 : 1;\n this.shaderKey = `mirrorPad_${mode}`;\n }\n\n getUserCode(): string {\n const rank = this.xShape.length;\n // The length of paddings are same with the rank of the input tensor.\n const start = this.xShape.map((_, i) => `uniforms.pad${i}[0]`).join(',');\n const end = this.xShape\n .map(\n (_, i) => `uniforms.pad${i}[0] + uniforms.xShape${\n rank > 1 ? `[${i}]` : ''}`)\n .join(',');\n\n const shaderStart = rank === 1 ? 'start' : 'start[i]';\n const shaderEnd = rank === 1 ? 'end' : 'end[i]';\n const shaderOutC = rank === 1 ? 'outC' : 'outC[i]';\n const dtype = getCoordsDataType(rank);\n const unpackedCoords = rank > 1 ?\n ['coords[0]', 'coords[1]', 'coords[2]', 'coords[3]'].slice(0, rank) :\n 'coords';\n\n return `\n ${main('index')} {\n if (index < uniforms.size) {\n let start = ${dtype}(${start});\n let end = ${dtype}(${end});\n var outC = getCoordsFromIndex(index);\n for (var i = 0; i < ${rank}; i = i + 1) {\n if (${shaderOutC} < ${shaderStart}) {\n ${shaderOutC} = ${shaderStart} * 2 - ${shaderOutC} - ${\n this.offset};\n } else if(${shaderOutC} >= ${shaderEnd}) {\n ${shaderOutC} = (${shaderEnd} - 1) * 2 - ${shaderOutC} + ${\n this.offset};\n }\n }\n let coords = outC - start;\n setOutputAtIndex(index, getX(${unpackedCoords}));\n }\n }\n `;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, MirrorPad, MirrorPadAttrs, MirrorPadInputs} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\n\nimport {MirrorPadProgram} from '../mirror_pad_webgpu';\n\nexport const mirrorPadConfig: KernelConfig = {\n kernelName: MirrorPad,\n backendName: 'webgpu',\n kernelFunc: ({inputs, attrs, backend}) => {\n const {x} = inputs as MirrorPadInputs;\n const {paddings, mode} = attrs as unknown as MirrorPadAttrs;\n const webGPUBackend = backend as WebGPUBackend;\n\n const uniformData = paddings.map(p => {\n return {type: 'int32', data: [p[0], p[1]]};\n });\n const program = new MirrorPadProgram(x.shape, paddings, mode);\n const output =\n webGPUBackend.runWebGPUProgram(program, [x], x.dtype, uniformData);\n\n return output;\n }\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Neg, NegInputs, TensorInfo, TypedArray} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {negImplCPU} from '../kernel_utils/shared';\n\nimport {UnaryOpType} from '../unary_op_util';\nimport {UnaryOpProgram} from '../unary_op_webgpu';\n\n// This doesn't use unaryKernelFunc because negImplCPU is not of type\n// SimpleUnaryKernelImplCPU.\nexport function neg(args: {inputs: NegInputs, backend: WebGPUBackend}):\n TensorInfo {\n const {inputs, backend} = args;\n const {x} = inputs;\n\n if (backend.shouldExecuteOnCPU([x])) {\n const xData = backend.tensorMap.get(x.dataId);\n const [outValues, newShape] =\n negImplCPU(xData.values as TypedArray, x.shape, x.dtype);\n return backend.makeTensorInfo(newShape, x.dtype, outValues);\n }\n\n const program = new UnaryOpProgram(x.shape, UnaryOpType.NEG);\n\n return backend.runWebGPUProgram(program, [x], x.dtype);\n}\n\nexport const negConfig: KernelConfig = {\n kernelName: Neg,\n backendName: 'webgpu',\n kernelFunc: neg as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {kernel_impls, KernelConfig, KernelFunc, NonMaxSuppressionV3, NonMaxSuppressionV3Attrs, NonMaxSuppressionV3Inputs, TypedArray} from '@tensorflow/tfjs-core';\nimport {WebGPUBackend} from '../backend_webgpu';\n\nexport function nonMaxSuppressionV3(args: {\n inputs: NonMaxSuppressionV3Inputs,\n backend: WebGPUBackend,\n attrs: NonMaxSuppressionV3Attrs\n}) {\n console.warn(\n 'tf.nonMaxSuppression() in webgpu locks the UI thread. ' +\n 'Call tf.nonMaxSuppressionAsync() instead');\n\n const {inputs, backend, attrs} = args;\n const {boxes, scores} = inputs;\n const {maxOutputSize, iouThreshold, scoreThreshold} = attrs;\n\n const boxesVals = backend.readSync(boxes.dataId) as TypedArray;\n const scoresVals = backend.readSync(scores.dataId) as TypedArray;\n\n const {selectedIndices} = kernel_impls.nonMaxSuppressionV3Impl(\n boxesVals, scoresVals, maxOutputSize, iouThreshold, scoreThreshold);\n\n return backend.makeTensorInfo(\n [selectedIndices.length], 'int32', new Int32Array(selectedIndices));\n}\n\nexport const nonMaxSuppressionV3Config: KernelConfig = {\n kernelName: NonMaxSuppressionV3,\n backendName: 'webgpu',\n kernelFunc: nonMaxSuppressionV3 as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {kernel_impls, KernelConfig, KernelFunc, NonMaxSuppressionV5, NonMaxSuppressionV5Attrs, NonMaxSuppressionV5Inputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nexport type TypedArray = Float32Array|Int32Array|Uint8Array;\n\nexport function nonMaxSuppressionV5(args: {\n inputs: NonMaxSuppressionV5Inputs,\n backend: WebGPUBackend,\n attrs: NonMaxSuppressionV5Attrs\n}): [TensorInfo, TensorInfo] {\n console.warn(\n 'tf.nonMaxSuppression() in webgpu locks the UI thread. ' +\n 'Call tf.nonMaxSuppressionAsync() instead');\n\n const {inputs, backend, attrs} = args;\n const {boxes, scores} = inputs;\n const {maxOutputSize, iouThreshold, scoreThreshold, softNmsSigma} = attrs;\n\n const boxesVals = backend.readSync(boxes.dataId) as TypedArray;\n const scoresVals = backend.readSync(scores.dataId) as TypedArray;\n\n const maxOutputSizeVal = maxOutputSize;\n const iouThresholdVal = iouThreshold;\n const scoreThresholdVal = scoreThreshold;\n const softNmsSigmaVal = softNmsSigma;\n\n const {selectedIndices, selectedScores} =\n kernel_impls.nonMaxSuppressionV5Impl(\n boxesVals, scoresVals, maxOutputSizeVal, iouThresholdVal,\n scoreThresholdVal, softNmsSigmaVal);\n\n return [\n backend.makeTensorInfo(\n [selectedIndices.length], 'int32', new Int32Array(selectedIndices)),\n backend.makeTensorInfo(\n [selectedScores.length], 'float32', new Float32Array(selectedScores))\n ];\n}\n\nexport const nonMaxSuppressionV5Config: KernelConfig = {\n kernelName: NonMaxSuppressionV5,\n backendName: 'webgpu',\n kernelFunc: nonMaxSuppressionV5 as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, TensorInfo, ZerosLike, ZerosLikeInputs} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\n\nimport {complex} from './Complex';\nimport {fill} from './Fill';\nimport {imag} from './Imag';\nimport {real} from './Real';\n\nexport function zerosLike(\n args: {inputs: ZerosLikeInputs, backend: WebGPUBackend}): TensorInfo {\n const {inputs, backend} = args;\n const {x} = inputs;\n if (x.dtype === 'complex64') {\n const realPart = real({inputs: {input: x}, backend});\n const r = zerosLike({inputs: {x: realPart}, backend});\n const imagPart = imag({inputs: {input: x}, backend});\n const i = zerosLike({inputs: {x: imagPart}, backend});\n\n const result = complex({inputs: {real: r, imag: i}, backend});\n\n backend.disposeData(realPart.dataId);\n backend.disposeData(r.dataId);\n backend.disposeData(imagPart.dataId);\n backend.disposeData(i.dataId);\n\n return result;\n } else {\n return fill({\n attrs: {\n shape: x.shape,\n dtype: x.dtype,\n value: x.dtype === 'string' ? '' : 0\n },\n backend\n });\n }\n}\n\nexport const zerosLikeConfig: KernelConfig = {\n kernelName: ZerosLike,\n backendName: 'webgpu',\n kernelFunc: zerosLike as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, OnesLike, OnesLikeInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\n\nimport {complex} from './Complex';\nimport {fill} from './Fill';\nimport {imag} from './Imag';\nimport {real} from './Real';\nimport {zerosLike} from './ZerosLike';\n\nexport function onesLike(\n args: {inputs: OnesLikeInputs, backend: WebGPUBackend}): TensorInfo {\n const {inputs, backend} = args;\n const {x} = inputs;\n\n if (x.dtype === 'string') {\n throw new Error('onesLike is not supported under string dtype');\n } else if (x.dtype === 'complex64') {\n const realPart = real({inputs: {input: x}, backend});\n const r = onesLike({inputs: {x: realPart}, backend});\n const imagPart = imag({inputs: {input: x}, backend});\n const i = zerosLike({inputs: {x: imagPart}, backend});\n\n const result = complex({inputs: {real: r, imag: i}, backend});\n\n backend.disposeData(realPart.dataId);\n backend.disposeData(r.dataId);\n backend.disposeData(imagPart.dataId);\n backend.disposeData(i.dataId);\n\n return result;\n } else {\n return fill({attrs: {shape: x.shape, dtype: x.dtype, value: 1}, backend});\n }\n}\n\nexport const onesLikeConfig: KernelConfig = {\n kernelName: OnesLike,\n backendName: 'webgpu',\n kernelFunc: onesLike as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Pack, PackAttrs, PackInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {concat} from './Concat';\nimport {expandDims} from './ExpandDims';\n\nexport function pack(\n args: {inputs: PackInputs, backend: WebGPUBackend, attrs: PackAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {axis} = attrs;\n\n if (inputs.length === 1) {\n return expandDims(\n {inputs: {input: inputs[0]}, backend, attrs: {dim: axis}});\n }\n\n const shape = inputs[0].shape;\n const dtype = inputs[0].dtype;\n\n inputs.forEach(t => {\n util.assertShapesMatch(\n shape, t.shape,\n 'All tensors passed to stack must have matching shapes');\n util.assert(\n dtype === t.dtype,\n () => 'All tensors passed to stack must have matching dtypes');\n });\n\n const intermediateTensorInfos: TensorInfo[] = [];\n const expandedTensors = inputs.map(t => {\n const expandedT =\n expandDims({inputs: {input: t}, backend, attrs: {dim: axis}});\n intermediateTensorInfos.push(expandedT);\n return expandedT;\n });\n\n const result = concat({inputs: expandedTensors, backend, attrs: {axis}});\n\n intermediateTensorInfos.forEach(t => backend.disposeData(t.dataId));\n\n return result;\n}\n\nexport const packConfig: KernelConfig = {\n kernelName: Pack,\n backendName: 'webgpu',\n kernelFunc: pack as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getCoordsDataType, getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class PadProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames = ['x'];\n uniforms = 'constantValue : f32,';\n workGroupSize: [number, number, number] = [64, 1, 1];\n xShape: number[];\n size = true;\n\n constructor(xShape: number[], paddings: Array<[number, number]>) {\n this.outputShape = paddings.map(\n (p, i) => p[0] /* beforePad */ + xShape[i] + p[1] /* afterPad */);\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize);\n paddings.map((_, i) => {\n this.uniforms += ` pad${i} : vec2,`;\n });\n this.xShape = xShape;\n this.shaderKey = 'pad';\n }\n\n getUserCode(): string {\n const rank = this.xShape.length;\n const type = getCoordsDataType(rank);\n // The length of paddings are same with the rank of the input tensor.\n const start = this.xShape.map((_, i) => `uniforms.pad${i}[0]`).join(',');\n const end = this.xShape\n .map(\n (_, i) => `uniforms.pad${i}[0] + uniforms.xShape${\n rank > 1 ? `[${i}]` : ''}`)\n .join(',');\n const startValue = rank > 1 ? `${type}(${start})` : `${start}`;\n const endValue = rank > 1 ? `${type}(${end})` : `${end}`;\n\n const leftPadCondition = rank > 1 ? `any(outC < start)` : `outC < start`;\n const rightPadCondition = rank > 1 ? `any(outC >= end)` : `outC >= end`;\n\n const unpackedCoords = rank > 1 ?\n ['coords[0]', 'coords[1]', 'coords[2]', 'coords[3]'].slice(0, rank) :\n 'coords';\n\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n let start = ${startValue};\n let end = ${endValue};\n let outC = getCoordsFromIndex(index);\n\n if (${leftPadCondition} || ${rightPadCondition}) {\n setOutputAtIndex(index, uniforms.constantValue);\n } else {\n let coords = outC - start;\n setOutputAtIndex(index, getX(${unpackedCoords}));\n }\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, PadV2, PadV2Attrs, PadV2Inputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {identity} from './Identity';\nimport {PadProgram} from '../pad_webgpu';\nimport {fill} from './Fill';\n\nexport const padV2 =\n (args: {inputs: PadV2Inputs,\n backend: WebGPUBackend,\n attrs: PadV2Attrs}): TensorInfo => {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {paddings, constantValue} = attrs;\n if (paddings.every(p => util.arraysEqual(p, [0, 0]))) {\n return identity({inputs: {x}, backend});\n }\n if (util.sizeFromShape(x.shape) === 0) {\n // Short-circuit the computation, since x doesn't have value, only\n // the shape is used to compute output shape to pad.\n const outputShape = paddings.map(\n (p, i) =>\n p[0] /* beforePad */ + x.shape[i] + p[1] /* afterPad */);\n return fill({\n backend,\n attrs: {shape: outputShape, value: constantValue, dtype: x.dtype}\n });\n }\n const uniformData = [{type: 'float32', data: [constantValue]}];\n paddings.map(p => uniformData.push({type: 'int32', data: [p[0], p[1]]}));\n const program = new PadProgram(x.shape, paddings);\n return backend.runWebGPUProgram(program, [x], x.dtype, uniformData);\n };\n\nexport const padV2Config: KernelConfig = {\n kernelName: PadV2,\n backendName: 'webgpu',\n kernelFunc: padV2 as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Pow} from '@tensorflow/tfjs-core';\n\nimport {BinaryOpType} from '../binary_op_util';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nexport const pow = binaryKernelFunc({\n opType: BinaryOpType.POW,\n});\n\nexport const powConfig: KernelConfig = {\n kernelName: Pow,\n backendName: 'webgpu',\n kernelFunc: pow\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Prelu, PreluInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\n\nimport {BinaryOpType} from '../binary_op_util';\nimport {BinaryOpProgram} from '../binary_op_webgpu';\n\nexport function prelu(args: {inputs: PreluInputs, backend: WebGPUBackend}):\n TensorInfo {\n const {inputs, backend} = args;\n const {x, alpha} = inputs;\n\n const program = new BinaryOpProgram(BinaryOpType.PRELU, x.shape, alpha.shape);\n return backend.runWebGPUProgram(program, [x, alpha], 'float32');\n}\n\nexport const preluConfig: KernelConfig = {\n kernelName: Prelu,\n backendName: 'webgpu',\n kernelFunc: prelu as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Prod, ProdAttrs, ProdInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {reduce} from '../kernel_utils/reduce';\n\nexport function prod(\n args: {inputs: ProdInputs, backend: WebGPUBackend, attrs: ProdAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {axis, keepDims} = attrs;\n\n return reduce(x, axis, keepDims, 'prod', backend);\n}\n\nexport const prodConfig: KernelConfig = {\n kernelName: Prod,\n backendName: 'webgpu',\n kernelFunc: prod as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Range, RangeAttrs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {rangeImplCPU} from '../kernel_utils/shared';\n\nexport const range =\n (args: {backend: WebGPUBackend, attrs: RangeAttrs}): TensorInfo => {\n const {backend, attrs} = args;\n const {start, stop, step, dtype} = attrs;\n const values = rangeImplCPU(start, stop, step, dtype);\n return backend.makeTensorInfo([values.length], dtype, values);\n };\n\nexport const rangeConfig: KernelConfig = {\n kernelName: Range,\n backendName: 'webgpu',\n kernelFunc: range as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, RealDiv} from '@tensorflow/tfjs-core';\n\nimport {BinaryOpType} from '../binary_op_util';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nexport const realDiv = binaryKernelFunc({opType: BinaryOpType.DIV});\n\nexport const realDivConfig: KernelConfig = {\n kernelName: RealDiv,\n backendName: 'webgpu',\n kernelFunc: realDiv as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Reciprocal} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const reciprocal = unaryKernelFunc({opType: UnaryOpType.RECIPROCAL});\n\nexport const reciprocalConfig: KernelConfig = {\n kernelName: Reciprocal,\n backendName: 'webgpu',\n kernelFunc: reciprocal\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Relu} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const relu = unaryKernelFunc({opType: UnaryOpType.RELU});\n\nexport const reluConfig: KernelConfig = {\n kernelName: Relu,\n backendName: 'webgpu',\n kernelFunc: relu\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Relu6} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const relu6 = unaryKernelFunc({opType: UnaryOpType.RELU6});\n\nexport const relu6Config: KernelConfig = {\n kernelName: Relu6,\n backendName: 'webgpu',\n kernelFunc: relu6\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class ResizeBilinearProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames = ['x'];\n uniforms = 'adjustHeightWidth : vec2, halfPixelCenters : f32,';\n workGroupSize: [number, number, number] = [64, 1, 1];\n size = true;\n\n constructor(\n inputShape: [number, number, number, number], newHeight: number,\n newWidth: number) {\n this.outputShape = [inputShape[0], newHeight, newWidth, inputShape[3]];\n\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize);\n\n this.shaderKey = `resizeBilinear`;\n }\n\n getUserCode(): string {\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n let coords = getCoordsFromIndex(index);\n let b = coords[0];\n let d = coords[3];\n let rc = coords.yz;\n\n let effectiveInSize = vec2(\n f32(uniforms.xShape.y) - uniforms.adjustHeightWidth[0],\n f32(uniforms.xShape.z) - uniforms.adjustHeightWidth[1]);\n\n let effectiveOutSize = vec2(\n f32(uniforms.outShape.y) - uniforms.adjustHeightWidth[0],\n f32(uniforms.outShape.z) - uniforms.adjustHeightWidth[1]);\n\n let effectiveInputOverOutputRatioRC =\n effectiveInSize / effectiveOutSize;\n\n // Fractional source index\n let sourceFracIndexRC =\n (vec2(rc) + vec2(uniforms.halfPixelCenters)) *\n effectiveInputOverOutputRatioRC - vec2(uniforms.halfPixelCenters);\n\n // Compute the four integer indices.\n let sourceFloorRC = vec2(sourceFracIndexRC);\n let sourceCeilRC = vec2(\n min(vec2(uniforms.xShape.yz) - vec2(1.0), ceil(sourceFracIndexRC)));\n\n let topLeft = getX(b, sourceFloorRC.x, sourceFloorRC.y, d);\n let bottomLeft = getX(b, sourceCeilRC.x, sourceFloorRC.y, d);\n let topRight = getX(b, sourceFloorRC.x, sourceCeilRC.y, d);\n let bottomRight = getX(b, sourceCeilRC.x, sourceCeilRC.y, d);\n\n let fracRC = sourceFracIndexRC - vec2(sourceFloorRC);\n\n let top = topLeft + (topRight - topLeft) * fracRC.y;\n let bottom = bottomLeft + (bottomRight - bottomLeft) * fracRC.y;\n let newValue = top + (bottom - top) * fracRC.x;\n\n setOutputAtIndex(index, newValue);\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, ResizeBilinear, ResizeBilinearAttrs, ResizeBilinearInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {ResizeBilinearProgram} from '../resize_bilinear_webgpu';\n\nexport function resizeBilinear(args: {\n inputs: ResizeBilinearInputs,\n backend: WebGPUBackend,\n attrs: ResizeBilinearAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {images} = inputs;\n const {alignCorners, size, halfPixelCenters} = attrs;\n\n const [newHeight, newWidth] = size;\n const adjustHeight = alignCorners && newHeight > 1 ? 1.0 : 0.0;\n const adjustWidth = alignCorners && newWidth > 1 ? 1.0 : 0.0;\n const halfPixelCentersValue = halfPixelCenters ? 0.5 : 0.0;\n const uniformData = [\n {type: 'float32', data: [adjustHeight, adjustWidth]},\n {type: 'float32', data: [halfPixelCentersValue]}\n ];\n\n const program = new ResizeBilinearProgram(\n images.shape as [number, number, number, number], newHeight, newWidth);\n\n return backend.runWebGPUProgram(program, [images], 'float32', uniformData);\n}\n\nexport const resizeBilinearConfig: KernelConfig = {\n kernelName: ResizeBilinear,\n backendName: 'webgpu',\n kernelFunc: resizeBilinear as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class ResizeNearestNeighborProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames = ['x'];\n uniforms = 'adjustHeightWidth : vec2, roundBase : f32,';\n workGroupSize: [number, number, number] = [64, 1, 1];\n halfPixelCenters: boolean;\n size = true;\n\n constructor(\n inputShape: [number, number, number, number], newHeight: number,\n newWidth: number, halfPixelCenters: boolean) {\n this.outputShape = [inputShape[0], newHeight, newWidth, inputShape[3]];\n\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize);\n\n this.halfPixelCenters = halfPixelCenters;\n this.shaderKey = `resizeNearest_${halfPixelCenters}`;\n }\n\n getUserCode(): string {\n let sourceFracIndexRC: string;\n if (this.halfPixelCenters) {\n sourceFracIndexRC =\n `max((vec2(rc) + vec2(0.5)) * effectiveInputOverOutputRatioRC` +\n `, vec2(0.0))`;\n } else {\n sourceFracIndexRC = `vec2(rc) * effectiveInputOverOutputRatioRC`;\n }\n\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n let coords = getCoordsFromIndex(index);\n let b = coords[0];\n let d = coords[3];\n let rc = coords.yz;\n\n let effectiveInSize = vec2(\n f32(uniforms.xShape.y) - uniforms.adjustHeightWidth[0],\n f32(uniforms.xShape.z) - uniforms.adjustHeightWidth[1]);\n\n let effectiveOutSize = vec2(\n f32(uniforms.outShape.y) - uniforms.adjustHeightWidth[0],\n f32(uniforms.outShape.z) - uniforms.adjustHeightWidth[1]);\n\n let effectiveInputOverOutputRatioRC =\n effectiveInSize / effectiveOutSize;\n\n // Fractional source index\n let sourceFracIndexRC = ${sourceFracIndexRC};\n\n // Compute the coordinators of nearest neighbor point.\n let inputShapeRC = vec2(f32(uniforms.xShape.y), f32(uniforms.xShape.z));\n let sourceNearestRC = vec2(\n min(inputShapeRC - 1.0, floor(sourceFracIndexRC + uniforms.roundBase)));\n let newValue = getX(b, sourceNearestRC.x, sourceNearestRC.y, d);\n\n setOutputAtIndex(index, newValue);\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, ResizeNearestNeighbor, ResizeNearestNeighborAttrs, ResizeNearestNeighborInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {ResizeNearestNeighborProgram} from '../resize_nearest_neighbor_webgpu';\n\nexport function resizeNearestNeighbor(args: {\n inputs: ResizeNearestNeighborInputs,\n backend: WebGPUBackend,\n attrs: ResizeNearestNeighborAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {images} = inputs;\n const {alignCorners, halfPixelCenters, size} = attrs;\n\n const [newHeight, newWidth] = size;\n const adjustHeight = alignCorners && newHeight > 1 ? 1.0 : 0.0;\n const adjustWidth = alignCorners && newWidth > 1 ? 1.0 : 0.0;\n // When align corners is false, we rounds the value with floor.\n const roundBase = alignCorners ? 0.5 : 0.0;\n const uniformData = [\n {type: 'float32', data: [adjustHeight, adjustWidth]},\n {type: 'float32', data: [roundBase]}\n ];\n\n const program = new ResizeNearestNeighborProgram(\n images.shape as [number, number, number, number], newHeight, newWidth,\n halfPixelCenters);\n return backend.runWebGPUProgram(program, [images], images.dtype, uniformData);\n}\n\nexport const resizeNearestNeighborConfig: KernelConfig = {\n kernelName: ResizeNearestNeighbor,\n backendName: 'webgpu',\n kernelFunc: resizeNearestNeighbor as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class RotateProgram implements WebGPUProgram {\n outputShape: number[] = [];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames = ['x'];\n uniforms: string;\n workGroupSize: [number, number, number] = [64, 1, 1];\n fillSnippet: string;\n size = true;\n\n constructor(\n imageShape: [number, number, number, number],\n fillValue: number|[number, number, number]) {\n this.outputShape = imageShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize);\n this.uniforms = `centerX : f32, centerY : f32, sinRadians : f32,\n cosRadians : f32,`;\n this.shaderKey = 'rotate';\n this.outputShape = imageShape;\n\n if (typeof fillValue === 'number') {\n this.uniforms += ` fillValue : f32,`;\n this.fillSnippet = `var outputValue = uniforms.fillValue;`;\n this.shaderKey += '_float';\n } else {\n this.uniforms += ` fillValue : vec3,`;\n this.fillSnippet = `var outputValue = uniforms.fillValue[coords[3]];`;\n this.shaderKey += '_vec3';\n }\n }\n\n getUserCode(): string {\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n let coords = getCoordsFromIndex(index);\n let coordXFloat = (f32(coords[2]) - uniforms.centerX) *\n uniforms.cosRadians - (f32(coords[1]) - uniforms.centerY) *\n uniforms.sinRadians;\n let coordYFloat = (f32(coords[2]) - uniforms.centerX) *\n uniforms.sinRadians + (f32(coords[1]) - uniforms.centerY) *\n uniforms.cosRadians;\n let coordX = i32(round(coordXFloat + uniforms.centerX));\n let coordY = i32(round(coordYFloat + uniforms.centerY));\n ${this.fillSnippet}\n if(coordX >= 0 && coordX < uniforms.xShape[2] && coordY >= 0 &&\n coordY < uniforms.xShape[1]) {\n outputValue = getX(coords[0], coordY, coordX, coords[3]);\n }\n setOutputAtIndex(index, outputValue);\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, Tensor4D} from '@tensorflow/tfjs-core';\nimport {RotateWithOffset, RotateWithOffsetAttrs, RotateWithOffsetInputs} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {RotateProgram} from '../rotate_webgpu';\n\nexport const rotateWithOffsetConfig: KernelConfig = {\n kernelName: RotateWithOffset,\n backendName: 'webgpu',\n kernelFunc: ({inputs, attrs, backend}) => {\n const {image} = inputs as RotateWithOffsetInputs;\n const {radians, fillValue, center} = attrs as {} as RotateWithOffsetAttrs;\n const webgpuBackend = backend as WebGPUBackend;\n\n const program = new RotateProgram((image as Tensor4D).shape, fillValue);\n const [centerX, centerY] =\n backend_util.getImageCenter(center, image.shape[1], image.shape[2]);\n const uniformData = [\n {type: 'float32', data: [centerX]},\n {type: 'float32', data: [centerY]},\n {type: 'float32', data: [Math.sin(radians)]},\n {type: 'float32', data: [Math.cos(radians)]}\n ];\n\n if (typeof fillValue === 'number') {\n uniformData.push(\n {type: 'float32', data: [Number.parseFloat(fillValue.toFixed(2))]});\n } else {\n uniformData.push({type: 'float32', data: fillValue});\n }\n\n const output = webgpuBackend.runWebGPUProgram(\n program, [image], image.dtype, uniformData);\n return output;\n }\n };\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Rsqrt} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {rsqrtImplCPU} from '../kernel_utils/shared';\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const rsqrt =\n unaryKernelFunc({opType: UnaryOpType.RSQRT, cpuKernelImpl: rsqrtImplCPU});\n\nexport const rsqrtConfig: KernelConfig = {\n kernelName: Rsqrt,\n backendName: 'webgpu',\n kernelFunc: rsqrt\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataType} from '@tensorflow/tfjs-core';\nimport {getCoordsDataType, getMainHeaderString as main, mapToWgslTypes, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class ScatterProgram implements WebGPUProgram {\n variableNames = ['updates', 'indices'];\n uniforms: string;\n outputShape: number[];\n sumDupeIndices: boolean;\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n workGroupSize: [number, number, number] = [64, 1, 1];\n updatesRank: number;\n indicesRank: number;\n sliceDimGreaterThanOne: boolean;\n atomic = true;\n type: DataType;\n\n constructor(\n flattenXShape: number[], sliceDim: number, indicesRank: number,\n updatesRank: number, strides: number[], shape: number[],\n outputDtype: DataType, sumDupeIndices = true) {\n this.outputShape = shape;\n this.type = outputDtype;\n this.sumDupeIndices = sumDupeIndices;\n this.dispatchLayout = flatDispatchLayout(flattenXShape);\n // Dispatching based on |updates| shape instead of output shape.\n this.dispatch =\n computeDispatch(this.dispatchLayout, flattenXShape, this.workGroupSize);\n this.sliceDimGreaterThanOne = sliceDim > 1;\n this.shaderKey = `scatter_${indicesRank}_${updatesRank}_${\n this.sliceDimGreaterThanOne}_${outputDtype}_${sumDupeIndices}`;\n const stridesType = getCoordsDataType(strides.length);\n this.uniforms = `sliceDim : i32, strides: ${stridesType}, size: i32,`;\n this.updatesRank = updatesRank;\n this.indicesRank = indicesRank;\n }\n\n getUserCode(): string {\n let indicesString = '';\n if (this.indicesRank === 1) {\n indicesString = 'coords[0]';\n } else if (this.indicesRank === 2) {\n indicesString = 'coords[0], j';\n }\n const indicesSnippet = `getIndices(${indicesString})`;\n\n const strideString = this.sliceDimGreaterThanOne ? 'uniforms.strides[j]' :\n 'uniforms.strides';\n\n let outCoordsString = '';\n let getUpdatesCoordsFromFlatIndex = '';\n if (this.dispatchLayout.x.length === 1) {\n outCoordsString = 'flattenedIndex';\n getUpdatesCoordsFromFlatIndex = `\n fn getUpdatesCoordsFromFlatIndex(index : i32) -> i32 {\n return index;\n }\n `;\n } else if (this.dispatchLayout.x.length === 2) {\n outCoordsString = 'vec2(flattenedIndex, coords[1])';\n getUpdatesCoordsFromFlatIndex = `\n fn getUpdatesCoordsFromFlatIndex(index : i32) -> vec2 {\n // N.B. |updates| could be a scalar tensor, conceptually representing a\n // 2D tensor with all values equal to that. By design, its size must be\n // the same as |outShape[1]| in one dimension, and |indicesShape[0]|\n // gives the other.\n let sliceSize = uniforms.outShape[1];\n let d0 = index / sliceSize;\n let d1 = index - d0 * sliceSize;\n return vec2(d0, d1);\n }\n `;\n }\n const updatesString =\n Array.from({length: this.updatesRank}, (_, idx) => `coords[${idx}]`);\n const updatesSnippet = `getUpdates(${updatesString.join(', ')})`;\n\n const atomicRMW = (ptr: string, val: string) => {\n let atomicAddSnippet = `atomicAdd(${ptr}, bitcast(${val}))`;\n if (this.type === 'float32') {\n atomicAddSnippet = `\n {\n var oldBits = 0;\n var newBits = bitcast(${val});\n loop {\n let info = atomicCompareExchangeWeak(${ptr}, oldBits, newBits);\n if (info.exchanged) {\n break;\n }\n oldBits = info.old_value;\n let oldValue = bitcast(oldBits);\n let newValue = oldValue + (${val});\n newBits = bitcast(newValue);\n }\n }\n `;\n }\n const atomicStoreSnippet = `atomicStore(${ptr}, bitcast(${val}));`;\n return this.sumDupeIndices ? atomicAddSnippet : atomicStoreSnippet;\n };\n\n const userCode = `\n ${getUpdatesCoordsFromFlatIndex}\n\n ${main('index')} {\n if (index < uniforms.size) {\n let coords = getUpdatesCoordsFromFlatIndex(index);\n var flattenedIndex = 0;\n for (var j = 0; j < uniforms.sliceDim; j = j + 1) {\n let indexInside = i32(round(${indicesSnippet}));\n flattenedIndex = flattenedIndex + indexInside * ${strideString};\n }\n let updateValue =\n ${mapToWgslTypes(this.type, false)}(${updatesSnippet});\n let flatIndex = getOutputIndexFromCoords(${outCoordsString});\n\n ${atomicRMW('&result[flatIndex]', 'updateValue')};\n }\n }`;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, ScatterNd, ScatterNdAttrs, ScatterNdInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {ScatterProgram} from '../scatter_webgpu';\n\nimport {fill} from './Fill';\nimport {reshape} from './Reshape';\n\nexport function scatterNd(args: {\n inputs: ScatterNdInputs,\n backend: WebGPUBackend,\n attrs: ScatterNdAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {indices, updates} = inputs;\n const {shape} = attrs;\n\n const {sliceRank, numUpdates, sliceSize, strides, outputSize} =\n backend_util.calculateShapes(updates, indices, shape);\n\n const flattenShape = [outputSize / sliceSize, sliceSize];\n\n if (outputSize === 0) {\n return backend.makeTensorInfo(shape, indices.dtype);\n }\n\n const flattenIndices = reshape(\n {inputs: {x: indices}, backend, attrs: {shape: [numUpdates, sliceRank]}});\n const flattenX = reshape(\n {inputs: {x: updates}, backend, attrs: {shape: [numUpdates, sliceSize]}});\n\n const type = flattenX.dtype;\n const output =\n fill({backend, attrs: {shape: flattenShape, value: 0, dtype: type}});\n const size = util.sizeFromShape(flattenX.shape);\n const uniformData = [\n {type: 'int32', data: [sliceRank]}, {type: 'int32', data: strides},\n {type: 'int32', data: [size]}\n ];\n const program = new ScatterProgram(\n flattenX.shape, sliceRank, flattenIndices.shape.length,\n flattenX.shape.length, strides, flattenShape, type);\n const res = backend.runWebGPUProgram(\n program, [flattenX, flattenIndices], type, uniformData, output);\n\n const reshaped = reshape({inputs: {x: res}, backend, attrs: {shape}});\n\n backend.disposeData(flattenIndices.dataId);\n backend.disposeData(flattenX.dataId);\n backend.disposeData(res.dataId);\n\n return reshaped;\n}\n\nexport const scatterNdConfig: KernelConfig = {\n kernelName: ScatterNd,\n backendName: 'webgpu',\n kernelFunc: scatterNd as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class SelectProgram implements WebGPUProgram {\n variableNames = ['c', 'a', 'b'];\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n workGroupSize: [number, number, number] = [64, 1, 1];\n cRank: number;\n rank: number;\n size = true;\n\n constructor(cRank: number, shape: number[], rank: number) {\n this.outputShape = shape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize);\n\n this.cRank = cRank;\n this.rank = rank;\n this.shaderKey = 'select';\n }\n\n getUserCode(): string {\n // TODO(WGSL): below code can be merged with getUserCode.\n let cCoords;\n let abCoords;\n if (this.rank > 4) {\n throw Error(`Where for rank ${this.rank} is not yet supported`);\n }\n\n if (this.rank === 1) {\n abCoords = `resRC`;\n cCoords = `resRC`;\n } else {\n const currentCoords = ['resRC.x', 'resRC.y', 'resRC.z', 'resRC.w'];\n const cCoordVars = [];\n const abCoordVars = [];\n for (let i = 0; i < this.outputShape.length; i++) {\n abCoordVars.push(`${currentCoords[i]}`);\n if (i < this.cRank) {\n cCoordVars.push(`${currentCoords[i]}`);\n }\n }\n cCoords = cCoordVars.join();\n abCoords = abCoordVars.join();\n }\n\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n let resRC = getCoordsFromIndex(index);\n let cVal = getC(${cCoords});\n if (cVal >= 1.0) {\n setOutputAtIndex(index, getA(${abCoords}));\n } else {\n setOutputAtIndex(index, getB(${abCoords}));\n }\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Select, SelectInputs, TensorInfo, upcastType} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {SelectProgram} from '../select_webgpu';\n\nexport function select(args: {inputs: SelectInputs, backend: WebGPUBackend}):\n TensorInfo {\n const {inputs, backend} = args;\n const {condition, t, e} = inputs;\n\n const program =\n new SelectProgram(condition.shape.length, t.shape, t.shape.length);\n return backend.runWebGPUProgram(\n program, [condition, t, e], upcastType(t.dtype, e.dtype));\n}\n\nexport const selectConfig: KernelConfig = {\n kernelName: Select,\n backendName: 'webgpu',\n kernelFunc: select as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Sigmoid} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const sigmoid = unaryKernelFunc({opType: UnaryOpType.SIGMOID});\n\nexport const sigmoidConfig: KernelConfig = {\n kernelName: Sigmoid,\n backendName: 'webgpu',\n kernelFunc: sigmoid,\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Sin} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const sin = unaryKernelFunc({opType: UnaryOpType.SIN});\n\nexport const sinConfig: KernelConfig = {\n kernelName: Sin,\n backendName: 'webgpu',\n kernelFunc: sin\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Sinh} from '@tensorflow/tfjs-core';\n\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const sinh = unaryKernelFunc({opType: UnaryOpType.SINH});\n\nexport const sinhConfig: KernelConfig = {\n kernelName: Sinh,\n backendName: 'webgpu',\n kernelFunc: sinh\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Sub} from '@tensorflow/tfjs-core';\n\nimport {BinaryOpType} from '../binary_op_util';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {subImplCPU as cpuSub} from '../kernel_utils/shared';\n\nexport const sub = binaryKernelFunc(\n {opType: BinaryOpType.SUB, cpuKernelImpl: cpuSub, supportsComplex: true});\n\nexport const subConfig: KernelConfig = {\n kernelName: Sub,\n backendName: 'webgpu',\n kernelFunc: sub\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, Softmax, SoftmaxAttrs, SoftmaxInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\n\nimport {exp} from './Exp';\nimport {max} from './Max';\nimport {realDiv} from './RealDiv';\nimport {reshape} from './Reshape';\nimport {sub} from './Sub';\nimport {sum} from './Sum';\n\nexport function softmax(\n args: {inputs: SoftmaxInputs, backend: WebGPUBackend, attrs: SoftmaxAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {logits} = inputs;\n const {dim} = attrs;\n\n const axes = util.parseAxisParam([dim], logits.shape);\n\n const maxLogit = max({\n inputs: {x: logits},\n backend,\n attrs: {reductionIndices: axes, keepDims: false}\n });\n\n const expandedShape = backend_util.expandShapeToKeepDim(maxLogit.shape, axes);\n\n const maxLogitsReshaped =\n reshape({inputs: {x: maxLogit}, backend, attrs: {shape: expandedShape}});\n const a =\n sub({inputs: {a: logits, b: maxLogitsReshaped}, backend}) as TensorInfo;\n const b = exp({inputs: {x: a}, backend}) as TensorInfo;\n const sumExp =\n sum({inputs: {x: b}, backend, attrs: {axis: axes, keepDims: false}});\n const sumExpReshaped =\n reshape({inputs: {x: sumExp}, backend, attrs: {shape: expandedShape}});\n const res =\n realDiv({inputs: {a: b, b: sumExpReshaped}, backend}) as TensorInfo;\n\n backend.disposeData(maxLogit.dataId);\n backend.disposeData(maxLogitsReshaped.dataId);\n backend.disposeData(a.dataId);\n backend.disposeData(b.dataId);\n backend.disposeData(sumExp.dataId);\n backend.disposeData(sumExpReshaped.dataId);\n\n return res;\n}\n\nexport const softmaxConfig: KernelConfig = {\n kernelName: Softmax,\n backendName: 'webgpu',\n kernelFunc: softmax as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, SpaceToBatchND, SpaceToBatchNDAttrs, SpaceToBatchNDInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\n\nimport {padV2} from './PadV2';\nimport {reshape} from './Reshape';\nimport {transpose} from './Transpose';\n\nexport const spaceToBatchND = (args: {\n inputs: SpaceToBatchNDInputs,\n backend: WebGPUBackend,\n attrs: SpaceToBatchNDAttrs\n}): TensorInfo => {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {blockShape, paddings} = attrs;\n\n util.assert(\n x.shape.length <= 4,\n () => 'spaceToBatchND for rank > 4 with a WebGPU backend not ' +\n 'implemented yet');\n\n const prod = blockShape.reduce((a, b) => a * b);\n\n const completePaddings: Array<[number, number]> = [[0, 0]];\n completePaddings.push(...paddings as Array<[number, number]>);\n for (let i = 1 + blockShape.length; i < x.shape.length; ++i) {\n completePaddings.push([0, 0]);\n }\n\n const toDispose = [];\n\n const paddedX = padV2({\n inputs: {x},\n backend,\n attrs: {paddings: completePaddings, constantValue: 0}\n });\n\n const reshapedPaddedShape =\n backend_util.getReshaped(paddedX.shape, blockShape, prod, false);\n\n const permutedReshapedPaddedPermutation = backend_util.getPermuted(\n reshapedPaddedShape.length, blockShape.length, false);\n\n const flattenShape =\n backend_util.getReshapedPermuted(paddedX.shape, blockShape, prod, false);\n\n const reshapedPaddedX = reshape(\n {inputs: {x: paddedX}, backend, attrs: {shape: reshapedPaddedShape}});\n\n const paddedXT = transpose({\n inputs: {x: reshapedPaddedX},\n backend,\n attrs: {perm: permutedReshapedPaddedPermutation}\n });\n\n const result =\n reshape({inputs: {x: paddedXT}, backend, attrs: {shape: flattenShape}});\n\n toDispose.push(paddedX);\n toDispose.push(reshapedPaddedX);\n toDispose.push(paddedXT);\n\n toDispose.forEach(t => backend.disposeData(t.dataId));\n\n return result;\n};\n\nexport const spaceToBatchNDConfig: KernelConfig = {\n kernelName: SpaceToBatchND,\n backendName: 'webgpu',\n kernelFunc: spaceToBatchND as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class TileProgram implements WebGPUProgram {\n variableNames = ['A'];\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n workGroupSize: [number, number, number] = [64, 1, 1];\n size = true;\n rank: number;\n\n constructor(aShape: number[], reps: number[]) {\n const outputShape: number[] = new Array(aShape.length);\n for (let i = 0; i < outputShape.length; i++) {\n outputShape[i] = aShape[i] * reps[i];\n }\n this.outputShape = outputShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize);\n this.rank = this.outputShape.length;\n this.shaderKey = 'tile';\n }\n\n getUserCode(): string {\n const sourceCoords = getSourceCoords(this.rank, 'uniforms.');\n\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n let resRC = getCoordsFromIndex(index);\n setOutputAtIndex(index, getA(${sourceCoords}));\n }\n }\n `;\n return userCode;\n }\n}\n\nfunction getSourceCoords(rank: number, uniformPrefix = ''): string {\n if (rank >= 5) {\n throw Error(`Tile for rank ${rank} is not yet supported`);\n }\n if (rank === 1) {\n return `(resRC % ${uniformPrefix}aShape)`;\n }\n\n const currentCoords = ['resRC.x', 'resRC.y', 'resRC.z', 'resRC.w'];\n const sourceCoords = [];\n for (let i = 0; i < rank; i++) {\n sourceCoords.push(`(${currentCoords[i]} % ${uniformPrefix}aShape[${i}])`);\n }\n return sourceCoords.join();\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {buffer, KernelConfig, KernelFunc, TensorInfo, Tile, TileAttrs, TileInputs, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {tileImplCPU} from '../kernel_utils/shared';\nimport {TileProgram} from '../tile_webgpu';\n\nexport function tile(\n params: {inputs: TileInputs, backend: WebGPUBackend, attrs: TileAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = params;\n const {x} = inputs;\n const {reps} = attrs;\n\n // tile gpu program cannot handle rank >= 5 case.\n if (backend.shouldExecuteOnCPU([x]) || x.dtype === 'string' ||\n x.shape.length >= 5) {\n // Even thought string tensor is always on CPU, just to be consistent on how\n // to access tensor data.\n const data = backend.readSync(x.dataId);\n const value = x.dtype === 'string' ?\n (data as Uint8Array[]).map(d => util.decodeString(d)) :\n data as TypedArray;\n const buf = buffer(x.shape, x.dtype, value);\n const outBuf = tileImplCPU(buf, reps);\n return backend.makeTensorInfo(outBuf.shape, outBuf.dtype, outBuf.values);\n }\n\n const program = new TileProgram(x.shape, reps);\n const output = backend.runWebGPUProgram(program, [x], x.dtype);\n\n return output;\n}\n\nexport const tileConfig: KernelConfig = {\n kernelName: Tile,\n backendName: 'webgpu',\n kernelFunc: tile as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, Rank, SparseToDense, SparseToDenseAttrs, SparseToDenseInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {scatterImplCPU} from '../kernel_utils/shared';\nimport {ScatterProgram} from '../scatter_webgpu';\n\nimport {identity} from './Identity';\nimport {reshape} from './Reshape';\nimport {tile} from './Tile';\n\nexport function sparseToDense(args: {\n inputs: SparseToDenseInputs,\n backend: WebGPUBackend,\n attrs: SparseToDenseAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {sparseIndices, sparseValues, defaultValue} = inputs;\n const {outputShape} = attrs;\n\n const {sliceRank, numUpdates, sliceSize, strides, outputSize} =\n backend_util.calculateShapes(sparseValues, sparseIndices, outputShape);\n\n const sumDupeIndices = false;\n if (sparseValues.dtype === 'string') {\n const indicesBuf = backend.bufferSync(sparseIndices);\n const updatesBuf = backend.bufferSync(sparseValues);\n const $defaultValue = util.decodeString(\n backend.readSync(defaultValue.dataId)[0] as Uint8Array);\n const outBuf = scatterImplCPU(\n indicesBuf, updatesBuf, outputShape, outputSize, sliceSize, numUpdates,\n sliceRank, strides, $defaultValue, sumDupeIndices);\n return backend.makeTensorInfo(outputShape, outBuf.dtype, outBuf.values);\n }\n\n const flattenShape = [outputSize / sliceSize, sliceSize];\n\n const $sparseIndices = reshape({\n inputs: {x: sparseIndices},\n backend,\n attrs: {shape: [numUpdates, sliceRank]}\n });\n const $sparseValues = sparseValues.shape.length ?\n reshape({\n inputs: {x: sparseValues},\n backend,\n attrs: {shape: [numUpdates, sliceSize]}\n }) :\n identity({inputs: {x: sparseValues}, backend});\n\n const type = $sparseValues.dtype;\n const zero =\n backend.makeTensorInfo([], type, util.makeZerosTypedArray(1, type));\n\n // Fill output tensor with the default value.\n const $defaultValue = reshape({\n inputs: {x: defaultValue},\n backend,\n attrs: {shape: Array(flattenShape.length).fill(1)}\n });\n const $denseValues =\n tile({inputs: {x: $defaultValue}, backend, attrs: {reps: flattenShape}});\n\n const size = util.sizeFromShape([numUpdates, sliceSize]);\n const uniformData = [\n {type: 'int32', data: [sliceRank]},\n {type: 'int32', data: strides},\n {type: 'int32', data: [size]},\n ];\n\n switch (numUpdates) {\n case 0:\n break;\n case 1:\n if (true) {\n const program = new ScatterProgram(\n [numUpdates, sliceSize], sliceRank, $sparseIndices.shape.length,\n $sparseValues.shape.length, strides, flattenShape, type,\n sumDupeIndices);\n backend.runWebGPUProgram(\n program, [$sparseValues, $sparseIndices], type, uniformData,\n $denseValues);\n }\n break;\n default:\n if (true) {\n // First replace the default value with 0 at indices.\n const program = new ScatterProgram(\n [numUpdates, sliceSize], sliceRank, $sparseIndices.shape.length,\n zero.shape.length, strides, flattenShape, type, sumDupeIndices);\n backend.runWebGPUProgram(\n program, [zero, $sparseIndices], type, uniformData, $denseValues);\n }\n {\n // Then replace 0 with the (sum of) sparse value(s) at indices.\n const program = new ScatterProgram(\n [numUpdates, sliceSize], sliceRank, $sparseIndices.shape.length,\n $sparseValues.shape.length, strides, flattenShape, type);\n backend.runWebGPUProgram(\n program, [$sparseValues, $sparseIndices], type, uniformData,\n $denseValues);\n }\n }\n\n const denseValues = reshape(\n {inputs: {x: $denseValues}, backend, attrs: {shape: outputShape}});\n\n backend.disposeData($sparseIndices.dataId);\n backend.disposeData($sparseValues.dataId);\n backend.disposeData($defaultValue.dataId);\n backend.disposeData(zero.dataId);\n backend.disposeData($denseValues.dataId);\n return denseValues;\n}\n\nexport const sparseToDenseConfig: KernelConfig = {\n kernelName: SparseToDense,\n backendName: 'webgpu',\n kernelFunc: sparseToDense as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, SplitV, SplitVAttrs, SplitVInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {slice} from './Slice';\n\nexport function splitV(\n args: {inputs: SplitVInputs, backend: WebGPUBackend, attrs: SplitVAttrs}):\n TensorInfo[] {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {numOrSizeSplits, axis} = attrs;\n\n const $axis = util.parseAxisParam(axis, x.shape)[0];\n const splitSizes = backend_util.prepareSplitSize(x, numOrSizeSplits, $axis);\n\n const xRank = x.shape.length;\n const begin = new Array(xRank).fill(0);\n const size = x.shape.slice();\n\n return splitSizes.map(s => {\n const sliceSize = [...size];\n sliceSize[$axis] = s;\n const sliceT =\n slice({inputs: {x}, backend, attrs: {begin, size: sliceSize}});\n begin[$axis] += s;\n return sliceT;\n });\n}\n\nexport const splitVConfig: KernelConfig = {\n kernelName: SplitV,\n backendName: 'webgpu',\n kernelFunc: splitV as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Sqrt} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const sqrt = unaryKernelFunc({opType: UnaryOpType.SQRT});\n\nexport const sqrtConfig: KernelConfig = {\n kernelName: Sqrt,\n backendName: 'webgpu',\n kernelFunc: sqrt\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Square, SquareInputs} from '@tensorflow/tfjs-core';\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {UnaryOpProgram} from '../unary_op_webgpu';\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const squareConfig: KernelConfig = {\n kernelName: Square,\n backendName: 'webgpu',\n kernelFunc: ({inputs, backend}) => {\n const {x} = inputs as SquareInputs;\n const webGPUBackend = backend as WebGPUBackend;\n const program = new UnaryOpProgram(x.shape, UnaryOpType.SQUARE);\n return webGPUBackend.runWebGPUProgram(program, [x], x.dtype);\n }\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, SquaredDifference} from '@tensorflow/tfjs-core';\n\nimport {BinaryOpType} from '../binary_op_util';\nimport {binaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\n\nexport const squaredDifference = binaryKernelFunc({\n opType: BinaryOpType.SQUARED_DIFFERENCE,\n});\n\nexport const squaredDifferenceConfig: KernelConfig = {\n kernelName: SquaredDifference,\n backendName: 'webgpu',\n kernelFunc: squaredDifference\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getCoordsDataType, getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class StridedSliceProgram implements WebGPUProgram {\n variableNames = ['x'];\n uniforms: string;\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n // TODO(xing.xu): Increase the workPerThread.\n workPerThread = 1;\n workGroupSize: [number, number, number] = [64, 1, 1];\n size = true;\n\n constructor(destSize: number[]) {\n this.outputShape = destSize;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize,\n [this.workPerThread, 1, 1]);\n\n const dtype = getCoordsDataType(this.outputShape.length);\n this.uniforms = `begin : ${dtype}, strides : ${dtype}, `;\n this.shaderKey = 'stridedSlice';\n }\n\n getUserCode(): string {\n const rank = this.outputShape.length;\n let newCoords = '';\n if (rank === 1) {\n newCoords = 'coords * uniforms.strides + uniforms.begin';\n } else {\n let outputAxis = 0;\n newCoords =\n this.outputShape\n .map((_, i) => {\n outputAxis++;\n return this.outputShape.length === 1 ?\n `coords * uniforms.strides[${i}] + uniforms.begin[${i}]` :\n `coords[${outputAxis - 1}] * uniforms.strides[${\n i}] + uniforms.begin[${i}]`;\n })\n .join(',');\n }\n\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n let coords = getCoordsFromIndex(index);\n setOutputAtIndex(index, getX(${newCoords}));\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {buffer, KernelConfig, KernelFunc, Rank, slice_util, StridedSlice, StridedSliceAttrs, StridedSliceInputs, TensorBuffer, TensorInfo, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {stridedSliceImplCPU} from '../kernel_utils/shared';\n\nimport {reshape} from './Reshape';\nimport {slice} from './Slice';\nimport {StridedSliceProgram} from '../strided_slice_webgpu';\n\nexport function stridedSlice(args: {\n inputs: StridedSliceInputs,\n backend: WebGPUBackend,\n attrs: StridedSliceAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {\n begin,\n end,\n strides,\n beginMask,\n endMask,\n ellipsisMask,\n newAxisMask,\n shrinkAxisMask\n } = attrs;\n\n const {\n finalShapeSparse,\n finalShape,\n isIdentity,\n sliceDim0,\n isSimpleSlice,\n begin: $begin,\n end: $end,\n strides: $strides\n } =\n slice_util.sliceInfo(\n x.shape, begin, end, strides, beginMask, endMask, ellipsisMask,\n newAxisMask, shrinkAxisMask);\n\n let result;\n\n if (isIdentity) {\n // Optimization #1, slice is a no-op plus reshape\n result = reshape({inputs: {x}, backend, attrs: {shape: finalShape}});\n } else if (sliceDim0 || isSimpleSlice) {\n // Optimization #2, slice is memory contiguous (only occurs in dim 0)\n util.assert(\n x.shape.length >= 1,\n () => `Input must have rank at least 1, got: ${x.shape.length}`);\n\n const size = slice_util.computeOutShape($begin, $end, $strides);\n // To tolerate begin[0] > end[0] (a 0-output slice), we min(begin, end).\n const sliced = slice({inputs: {x}, backend, attrs: {begin: $begin, size}});\n result =\n reshape({inputs: {x: sliced}, backend, attrs: {shape: finalShape}});\n backend.disposeData(sliced.dataId);\n } else {\n const shouldExecuteOnCPU = backend.shouldExecuteOnCPU([x]);\n if (shouldExecuteOnCPU) {\n const values = backend.readSync(x.dataId) as TypedArray;\n const xBuf = buffer(x.shape, x.dtype, values) as TensorBuffer;\n const resultValues =\n stridedSliceImplCPU(finalShapeSparse, xBuf, $strides, $begin);\n result = backend.makeTensorInfo(finalShape, x.dtype, resultValues.values);\n } else {\n const program = new StridedSliceProgram(finalShapeSparse);\n const uniformData =\n [{type: 'int32', data: $begin}, {type: 'int32', data: $strides}];\n const resultValues =\n backend.runWebGPUProgram(program, [x], x.dtype, uniformData);\n result = reshape(\n {inputs: {x: resultValues}, backend, attrs: {shape: finalShape}});\n backend.disposeData(resultValues.dataId);\n }\n }\n\n return result;\n}\n\nexport const stridedSliceConfig: KernelConfig = {\n kernelName: StridedSlice,\n backendName: 'webgpu',\n kernelFunc: stridedSlice as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, StringNGrams, StringNGramsAttrs, StringNGramsInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {stringNGramsImplCPU} from '../kernel_utils/shared';\n\nexport function stringNGrams(args: {\n inputs: StringNGramsInputs,\n backend: WebGPUBackend,\n attrs: StringNGramsAttrs\n}): [TensorInfo, TensorInfo] {\n const {inputs, backend, attrs} = args;\n const {\n separator,\n nGramWidths,\n leftPad,\n rightPad,\n padWidth,\n preserveShortSequences\n } = attrs;\n const {data, dataSplits} = inputs;\n const $data = backend.readSync(data.dataId) as Uint8Array[];\n const $dataSplits = backend.readSync(dataSplits.dataId) as Int32Array;\n\n const [nGrams, nGramsSplits] = stringNGramsImplCPU(\n $data, $dataSplits, separator, nGramWidths, leftPad, rightPad, padWidth,\n preserveShortSequences);\n return [\n backend.makeTensorInfo([nGrams.length], 'string', nGrams),\n backend.makeTensorInfo(dataSplits.shape, 'int32', nGramsSplits),\n ];\n}\n\nexport const stringNGramsConfig: KernelConfig = {\n kernelName: StringNGrams,\n backendName: 'webgpu',\n kernelFunc: stringNGrams as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Tanh} from '@tensorflow/tfjs-core';\nimport {unaryKernelFunc} from '../kernel_utils/kernel_funcs_utils';\nimport {UnaryOpType} from '../unary_op_util';\n\nexport const tanh = unaryKernelFunc({opType: UnaryOpType.TANH});\n\nexport const tanhConfig: KernelConfig = {\n kernelName: Tanh,\n backendName: 'webgpu',\n kernelFunc: tanh\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\n// Based on Algorithm 2 of Bitonic Top K, ref:\n// https://anilshanbhag.in/static/papers/gputopk_sigmod18.pdf\n// The original algorithm is based on computing the top K only, however\n// since for TFJS we require the indices of the top K values as well then the\n// algorithm found here is a bit modified. Rather than producing the values\n// at each step, the indices containing the top K are generated instead.\n// The output values are not generated to reduce the number of outputs in the\n// GPU, the values can easily be retrieved from the indices using a gather\n// op.\n\nexport class SwapProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames = ['x', 'indices'];\n uniforms: string;\n workGroupSize: [number, number, number] = [256, 1, 1];\n size = true;\n\n constructor(shape: number[]) {\n this.outputShape = shape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize);\n this.uniforms = `inputSize : i32, firstPass : i32, negativeInf : f32,\n dir : i32, inc : i32,`;\n this.shaderKey = 'swap';\n }\n\n getUserCode(): string {\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n let outC = getCoordsFromIndex(index);\n let batch = outC[0];\n let elemIdx = outC[1];\n // We compare elements pair-wise within a group of size 2 * inc.\n // The comparing rule for each group alternates between ascending\n // and descending. Within each group, we compare each pair at\n // positions i and i+inc. To decide whether an element at position i\n // is x0 or x1, we mod it by 2 * inc, if the result is smaller than\n // inc, it is in the first half of the group, we denote it as x0,\n // otherwise we denote it as x1.\n // For example, as shown in the Bitonic top K paper referenced\n // above, Figure5(a) shows that element[1] is in the second half of\n // the group when group size is 2, but it is in the first half of\n // the group when group size is 4.\n let isFirstInPair = elemIdx % (2 * uniforms.inc) < uniforms.inc;\n var i = 0;\n if (isFirstInPair) {\n i = elemIdx;\n } else {\n i = elemIdx - uniforms.inc;\n }\n\n var i0 = 0;\n if (uniforms.firstPass == 1) {\n i0 = i;\n } else {\n i0 = i32(getIndices(batch, i));\n }\n\n var i1 = 0;\n if (uniforms.firstPass == 1) {\n i1 = i + uniforms.inc;\n } else {\n i1 = i32(getIndices(batch, i + uniforms.inc));\n }\n\n var x0 = f32(0.0);\n var x1 = f32(0.0);\n if (i0 < uniforms.inputSize) {\n x0 = getX(batch, i0);\n } else {\n x0 = uniforms.negativeInf;\n }\n if (i1 < uniforms.inputSize) {\n x1 = getX(batch, i1);\n } else {\n x1 = uniforms.negativeInf;\n }\n\n let reverse = elemIdx % (2 * uniforms.dir) >= uniforms.dir;\n let isGreater = x0 > x1 || (x0 == x1 && i1 > i0);\n if (reverse == isGreater) {\n // Elements in opposite order of direction\n let iTemp = i0;\n i0 = i1;\n i1 = iTemp;\n }\n if (isFirstInPair) {\n setOutputAtIndex(index, f32(i0));\n } else {\n setOutputAtIndex(index, f32(i1));\n }\n }\n }\n `;\n return userCode;\n }\n}\n\nexport class MergeProgram implements WebGPUProgram {\n outputShape: number[];\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n variableNames = ['x', 'indices'];\n uniforms: string;\n workGroupSize: [number, number, number] = [256, 1, 1];\n size = true;\n\n constructor(shape: number[]) {\n this.outputShape = shape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize);\n // |n| Size of the original input of TopK\n // |firstPass| indicates if this is the first time swap is being used which\n // means no indices input containing the top K is present yet.\n // |k| Top k elements desired\n this.uniforms = `inputSize : i32, firstPass : i32, k : i32,`;\n this.shaderKey = 'merge';\n }\n\n getUserCode(): string {\n const userCode = `\n ${main('index')} {\n if (index < uniforms.size) {\n let outC = getCoordsFromIndex(index);\n let batch = outC[0];\n let elemIdx = outC[1];\n // The output size is half of the previous size.\n // If the previous sequence is | | | | _ _ _ _ | | | | _ _ _ _\n // (k=4), we only need to output the indices at positions |, the\n // indices at positions _ can be thrown away, see Figure5(b) After\n // Phase 2 (Merge phase) in the Bitonic Top K paper referenced\n // above.\n // For example, the paper shows we only need to output the orange\n // bars. The output sequence should look like this | | | | | | | |.\n // Because the sequence is halved, to map the output index back to\n // the previous sequence to find the corresponding value, we need\n // to double the index. When we double the index, we basically\n // interpolate a position, so 2i looks like\n // | _ | _ | _ | _ | _ | _ | _. We move the | to the first k\n // position of each 2k positions by - elemIdx % k. E.g. for output\n // at index 4,5,6,7, we want to get the corresponding element at\n // original index 8,9,10,11, for output at index 8,9,10,11,\n // we want to get the corresponding element at original index\n // 16,17,18,19, so on and so forth.\n\n var i = 0;\n if (elemIdx < uniforms.k) {\n i = elemIdx;\n } else {\n i = elemIdx * 2 - elemIdx % uniforms.k;\n }\n var i0 = 0;\n if (uniforms.firstPass == 1) {\n i0 = i;\n } else {\n i0 = i32(getIndices(batch, i));\n }\n var i1 = 0;\n if (uniforms.firstPass == 1) {\n i1 = i + uniforms.k;\n } else {\n i1 = i32(getIndices(batch, i + uniforms.k));\n }\n\n let x0 = getX(batch, i0);\n var x1 = f32(0.0);\n if (i1 < uniforms.inputSize) {\n x1 = getX(batch, i1);\n } else {\n x1 = x0;\n }\n\n if (x0 >= x1) {\n setOutputAtIndex(index, f32(i0));\n } else {\n setOutputAtIndex(index, f32(i1));\n }\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, NumericDataType, TensorInfo, TopK, TopKAttrs, TopKInputs, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {topKImplCPU} from '../kernel_utils/shared';\nimport {MergeProgram, SwapProgram} from '../top_k_webgpu';\nimport {fill} from './Fill';\nimport {gatherV2} from './GatherV2';\nimport {reshape} from './Reshape';\nimport {slice} from './Slice';\n\nfunction disposeIntermediateTensorInfoOrNull(\n backend: WebGPUBackend, tensorInfo: TensorInfo) {\n if (tensorInfo !== null) {\n backend.disposeData(tensorInfo.dataId);\n }\n}\n\nfunction roundUpToPow2(num: number) {\n let pow2 = 1;\n while (pow2 < num) {\n pow2 *= 2;\n }\n return pow2;\n}\n\n// Based on Algorithm 2 of Bitonic Top K, ref:\n// https://anilshanbhag.in/static/papers/gputopk_sigmod18.pdf\nexport function topK(\n args: {inputs: TopKInputs, backend: WebGPUBackend, attrs: TopKAttrs}):\n TensorInfo[] {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {k, sorted}= attrs;\n\n const xShape = x.shape;\n const lastDim = xShape[xShape.length - 1];\n\n if (backend.shouldExecuteOnCPU([x])) {\n const xVals = backend.readSync(x.dataId) as TypedArray;\n const [allTopKVals, allTopKIndices] =\n topKImplCPU(xVals, xShape, x.dtype as NumericDataType, k, sorted);\n\n return [\n backend.makeTensorInfo(\n allTopKVals.shape, allTopKVals.dtype, allTopKVals.values),\n backend.makeTensorInfo(\n allTopKIndices.shape, allTopKIndices.dtype, allTopKIndices.values)\n ];\n }\n\n if (k === 0) {\n xShape[xShape.length - 1] = 0;\n return [\n backend.makeTensorInfo(xShape, x.dtype, []),\n backend.makeTensorInfo(xShape, 'int32', [])\n ];\n }\n\n if (lastDim === 1 /* firstPass */) {\n return [\n x, fill({attrs: {shape: xShape, dtype: 'int32', value: 0}, backend})\n ];\n }\n\n // Reshape into a 2d tensor [batch, lastDim] and compute topk along lastDim.\n const xSize = util.sizeFromShape(xShape);\n const batch = xSize / lastDim;\n const x2D = reshape({inputs: {x}, attrs: {shape: [batch, lastDim]}, backend});\n\n const kPow2 = roundUpToPow2(k);\n const lastDimPow2 = roundUpToPow2(lastDim);\n\n // Only the indices containing the top K are kept at every step to reduce\n // number of outputs in the GPU algorithms, so once the final set of indices\n // is computed then gather is used to grab the corresponding values\n // from the original input.\n let indices: TensorInfo = null;\n\n // GPU algorithm always takes in an indices input but this input is not used\n // on the first run of a GPU algorithm, therefore if indices is null we simply\n // pass in x2D instead of it but the value will not actually be used\n const getInputs = () => indices === null ? [x2D, x2D] : [x2D, indices];\n\n const runSwap = (dir: number, inc: number, shape: number[]) => {\n const inputs = getInputs();\n const program = new SwapProgram(shape);\n const firstPass = indices === null ? 1 : 0;\n const uniformDataSwap = [\n {type: 'int32', data: [lastDim]},\n {type: 'int32', data: [firstPass]},\n {type: 'float32', data: [Number.NEGATIVE_INFINITY]},\n {type: 'int32', data: [dir]},\n {type: 'int32', data: [inc]}\n ];\n const prevIndices = indices;\n indices = backend.runWebGPUProgram(\n program, inputs, 'int32', uniformDataSwap);\n disposeIntermediateTensorInfoOrNull(backend, prevIndices);\n };\n\n // Step 1: local sort\n for (let len = 1; len < kPow2; len *= 2) {\n const dir = len * 2;\n for (let inc = len; inc >= 1; inc /= 2) {\n runSwap(dir, inc, [batch, lastDimPow2]);\n }\n }\n\n // Step 2: merge\n for (let indicesSize = lastDimPow2; indicesSize > kPow2; indicesSize /= 2) {\n const inputs = getInputs();\n const mergeProgram = new MergeProgram([batch, indicesSize / 2]);\n const firstPass = indices === null ? 1 : 0;\n const uniformDataMerge = [\n {type: 'int32', data: [lastDim]},\n {type: 'int32', data: [firstPass]},\n {type: 'int32', data: [kPow2]}\n ];\n const prevIndices = indices;\n indices = backend.runWebGPUProgram(\n mergeProgram, inputs, 'int32', uniformDataMerge);\n disposeIntermediateTensorInfoOrNull(backend, prevIndices);\n\n // Step 3: rebuild\n const len = kPow2 / 2;\n const dir = len * 2;\n for (let inc = len; inc >= 1; inc /= 2) {\n runSwap(dir, inc, indices.shape);\n }\n }\n\n // Keep only the requested top K results instead of kPow2\n let prevIndices = indices;\n indices = slice(\n {inputs: {x: indices}, backend, attrs: {begin: 0, size: [batch, k]}});\n disposeIntermediateTensorInfoOrNull(backend, prevIndices);\n\n // Gather values on last dimension\n let values = gatherV2(\n {inputs: {x: x2D, indices}, backend, attrs: {axis: 1, batchDims: 1}});\n disposeIntermediateTensorInfoOrNull(backend, x2D);\n\n // Reshape back to the original input shape, except that the last\n // dimension is k.\n const newShape = xShape.slice(0, -1);\n newShape.push(k);\n\n prevIndices = indices;\n indices = reshape({inputs: {x: indices}, attrs: {shape: newShape}, backend});\n disposeIntermediateTensorInfoOrNull(backend, prevIndices);\n\n const prevValues = values;\n values = reshape({inputs: {x: values}, attrs: {shape: newShape}, backend});\n disposeIntermediateTensorInfoOrNull(backend, prevValues);\n\n return [values, indices];\n}\n\nexport const topKConfig: KernelConfig = {\n kernelName: TopK,\n backendName: 'webgpu',\n kernelFunc: topK as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {getMainHeaderString as main, WebGPUProgram} from './webgpu_program';\nimport {computeDispatch, flatDispatchLayout} from './webgpu_util';\n\nexport class TransformProgram implements WebGPUProgram {\n variableNames = ['Image', 'Transforms'];\n outputShape: number[];\n uniforms = 'interpolationModeId : i32, fillModeId : i32, fillValue : f32,';\n shaderKey: string;\n dispatchLayout: {x: number[]};\n dispatch: [number, number, number];\n workGroupSize: [number, number, number] = [64, 1, 1];\n size = true;\n\n constructor(outShape: [number, number, number, number]) {\n this.outputShape = outShape;\n this.dispatchLayout = flatDispatchLayout(this.outputShape);\n this.dispatch = computeDispatch(\n this.dispatchLayout, this.outputShape, this.workGroupSize);\n this.shaderKey = 'transform';\n }\n\n getUserCode(): string {\n const userCode = `\n fn mapCoord(outCoord : f32, len : f32) -> f32{\n var inCoord = outCoord;\n if(uniforms.fillModeId == 2) {\n if (inCoord < 0.0) {\n if (len <= 1.0) {\n inCoord = 0.0;\n } else {\n let sz2 = 2.0 * len;\n if (inCoord < sz2) {\n inCoord = sz2 * f32(i32(f32(-inCoord / sz2))) +\n inCoord;\n }\n if (inCoord < -len) {\n inCoord = inCoord + sz2;\n } else {\n inCoord = -inCoord - 1.0;\n }\n }\n } else if (inCoord > len - 1.0) {\n if (len <= 1.0) {\n inCoord = 0.0;\n } else {\n let sz2 = 2.0 * len;\n inCoord = inCoord - sz2 * f32(i32(f32(inCoord / sz2)));\n if (inCoord >= len) {\n inCoord = sz2 - inCoord - 1.0;\n }\n }\n }\n return clamp(inCoord, 0.0, len - 1.0);\n } else if (uniforms.fillModeId == 3) {\n if (inCoord < 0.0) {\n if (len <= 1.0) {\n inCoord = 0.0;\n } else {\n let sz = len - 1.0;\n inCoord = inCoord + len * (f32(i32(f32(-inCoord / sz))) + 1.0);\n }\n } else if (inCoord > len - 1.0) {\n if (len <= 1.0) {\n inCoord = 0.0;\n } else {\n let sz = len - 1.0;\n inCoord = inCoord - len * f32(i32(f32(inCoord / sz)));\n }\n }\n return clamp(inCoord, 0.0, len - 1.0);\n } else if (uniforms.fillModeId == 4) {\n return clamp(outCoord, 0.0, len - 1.0);\n }\n return outCoord;\n }\n fn readWithFillValue(batch : i32, coordY : i32, coordX : i32,\n channel : i32) -> f32 {\n var outputValue : f32;\n if (0 <= coordY && coordY < uniforms.imageShape[1] && 0 <= coordX && coordX < uniforms.imageShape[2]) {\n outputValue = getImage(batch, coordY, coordX, channel);\n } else {\n outputValue = uniforms.fillValue;\n }\n return outputValue;\n }\n\n ${main('index')} {\n if (index < uniforms.size) {\n let coords = getCoordsFromIndex(index);\n var outputValue : f32;\n let batch = coords[0];\n let x = coords[2];\n let y = coords[1];\n let channel = coords[3];\n let xf = f32(x);\n let yf = f32(y);\n let a1 = getTransforms(batch, 0);\n let a2 = getTransforms(batch, 1);\n let a3 = getTransforms(batch, 2);\n let b1 = getTransforms(batch, 3);\n let b2 = getTransforms(batch, 4);\n let b3 = getTransforms(batch, 5);\n let c1 = getTransforms(batch, 6);\n let c2 = getTransforms(batch, 7);\n let projection = c1 * xf + c2 * yf + 1.0;\n if (projection == 0.0) {\n outputValue = uniforms.fillValue;\n } else {\n let inX = (a1 * xf + a2 * yf + a3) / projection;\n let inY = (b1 * xf + b2 * yf + b3) / projection;\n let mapX = mapCoord(inX, f32(uniforms.imageShape[2]));\n let mapY = mapCoord(inY, f32(uniforms.imageShape[1]));\n\n if (uniforms.interpolationModeId == 1) {\n let coordY = i32(round(mapY));\n let coordX = i32(round(mapX));\n outputValue = readWithFillValue(batch, coordY, coordX,\n channel);\n } else {\n let yFloor = floor(mapY);\n let xFloor = floor(mapX);\n let yCeil = yFloor + 1.0;\n let xCeil = xFloor + 1.0;\n let valueYFloor = (xCeil - mapX) *\n readWithFillValue(batch, i32(yFloor), i32(xFloor), channel) +\n (mapX - xFloor) *\n readWithFillValue(batch, i32(yFloor), i32(xCeil), channel);\n let valueYCeil = (xCeil - mapX) *\n readWithFillValue(batch, i32(yCeil), i32(xFloor), channel) +\n (mapX - xFloor) *\n readWithFillValue(batch, i32(yCeil), i32(xCeil), channel);\n outputValue = (yCeil - mapY) * valueYFloor +\n (mapY - yFloor) * valueYCeil;\n }\n }\n setOutputAtIndex(index, outputValue);\n }\n }\n `;\n return userCode;\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, TensorInfo, Transform, TransformAttrs, TransformInputs} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\nimport {TransformProgram} from '../transform_webgpu';\n\nexport function transform(args: {\n inputs: TransformInputs,\n backend: WebGPUBackend,\n attrs: TransformAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {image, transforms} = inputs;\n const {interpolation, fillMode, fillValue, outputShape} = attrs;\n\n const [batch, imageHeight, imageWidth, numChannels] = image.shape;\n const [outHeight, outWidth] =\n outputShape != null ? outputShape : [imageHeight, imageWidth];\n const outShape =\n [batch, outHeight, outWidth,\n numChannels] as [number, number, number, number];\n\n const program = new TransformProgram(outShape);\n const interpolationModeId = interpolation === 'nearest' ? 1 : 2;\n let fillModeId: number;\n switch (fillMode) {\n case 'constant':\n fillModeId = 1;\n break;\n case 'reflect':\n fillModeId = 2;\n break;\n case 'wrap':\n fillModeId = 3;\n break;\n case 'nearest':\n fillModeId = 4;\n break;\n default:\n fillModeId = 1;\n break;\n }\n const uniformData = [\n {type: 'int32', data: [interpolationModeId]},\n {type: 'int32', data: [fillModeId]}, {type: 'float32', data: [fillValue]}\n ];\n return backend.runWebGPUProgram(\n program, [image, transforms], 'float32', uniformData);\n}\n\nexport const transformConfig: KernelConfig = {\n kernelName: Transform,\n backendName: 'webgpu',\n kernelFunc: transform as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, TensorInfo, Unpack, UnpackAttrs, UnpackInputs} from '@tensorflow/tfjs-core';\n\nimport {WebGPUBackend} from '../backend_webgpu';\n\nimport {reshape} from './Reshape';\nimport {slice} from './Slice';\n\nexport function unpack(\n args:\n {inputs: UnpackInputs, backend: WebGPUBackend, attrs: UnpackAttrs}):\n TensorInfo[] {\n const {inputs, backend, attrs} = args;\n const {value} = inputs;\n let {axis} = attrs;\n\n if (axis < 0) {\n axis += value.shape.length;\n }\n\n const x = value;\n const xRank = x.shape.length;\n\n const num = value.shape[axis];\n const outShape: number[] = new Array(xRank - 1);\n let outIndex = 0;\n for (let i = 0; i < xRank; i++) {\n if (i !== axis) {\n outShape[outIndex++] = x.shape[i];\n }\n }\n\n const toDispose = [];\n\n const begin = new Array(xRank).fill(0);\n const size = x.shape.slice();\n size[axis] = 1;\n const res: TensorInfo[] = new Array(num);\n for (let i = 0; i < res.length; i++) {\n begin[axis] = i;\n const sliced = slice({inputs: {x}, backend, attrs: {begin, size}});\n const reshaped =\n reshape({inputs: {x: sliced}, backend, attrs: {shape: outShape}});\n res[i] = reshaped;\n\n toDispose.push(sliced);\n }\n\n toDispose.forEach(t => backend.disposeData(t.dataId));\n return res;\n}\n\nexport const unpackConfig: KernelConfig = {\n kernelName: Unpack,\n backendName: 'webgpu',\n kernelFunc: unpack as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, registerKernel} from '@tensorflow/tfjs-core';\n\nimport {_fusedMatMulConfig} from './kernels/_FusedMatMul';\nimport {absConfig} from './kernels/Abs';\nimport {addConfig} from './kernels/Add';\nimport {addNConfig} from './kernels/AddN';\nimport {argMaxConfig} from './kernels/ArgMax';\nimport {argMinConfig} from './kernels/ArgMin';\nimport {atan2Config} from './kernels/Atan2';\nimport {avgPoolConfig} from './kernels/AvgPool';\nimport {batchMatMulConfig} from './kernels/BatchMatMul';\nimport {batchToSpaceNDConfig} from './kernels/BatchToSpaceND';\nimport {castConfig} from './kernels/Cast';\nimport {ceilConfig} from './kernels/Ceil';\nimport {clipByValueConfig} from './kernels/ClipByValue';\nimport {complexConfig} from './kernels/Complex';\nimport {concatConfig} from './kernels/Concat';\nimport {conv2DConfig} from './kernels/Conv2D';\nimport {conv2DBackpropInputConfig} from './kernels/Conv2DBackpropInput';\nimport {cosConfig} from './kernels/Cos';\nimport {coshConfig} from './kernels/Cosh';\nimport {cropAndResizeConfig} from './kernels/CropAndResize';\nimport {cumprodConfig} from './kernels/Cumprod';\nimport {cumsumConfig} from './kernels/Cumsum';\nimport {depthToSpaceConfig} from './kernels/DepthToSpace';\nimport {depthwiseConv2dNativeConfig} from './kernels/DepthwiseConv2dNative';\nimport {einsumConfig} from './kernels/Einsum';\nimport {eluConfig} from './kernels/Elu';\nimport {equalConfig} from './kernels/Equal';\nimport {expConfig} from './kernels/Exp';\nimport {expandDimsConfig} from './kernels/ExpandDims';\nimport {expm1Config} from './kernels/Expm1';\nimport {fillConfig} from './kernels/Fill';\nimport {flipLeftRightConfig} from './kernels/FlipLeftRight';\nimport {floorConfig} from './kernels/Floor';\nimport {floorDivConfig} from './kernels/FloorDiv';\nimport {fromPixelsConfig} from './kernels/FromPixels';\nimport {fusedBatchNormConfig} from './kernels/FusedBatchNorm';\nimport {fusedConv2DConfig} from './kernels/FusedConv2D';\nimport {fusedDepthwiseConv2DConfig} from './kernels/FusedDepthwiseConv2D';\nimport {gatherNdConfig} from './kernels/GatherNd';\nimport {gatherV2Config} from './kernels/GatherV2';\nimport {greaterConfig} from './kernels/Greater';\nimport {greaterEqualConfig} from './kernels/GreaterEqual';\nimport {identityConfig} from './kernels/Identity';\nimport {imagConfig} from './kernels/Imag';\nimport {isNaNConfig} from './kernels/IsNaN';\nimport {leakyReluConfig} from './kernels/LeakyRelu';\nimport {lessConfig} from './kernels/Less';\nimport {lessEqualConfig} from './kernels/LessEqual';\nimport {logConfig} from './kernels/Log';\nimport {logicalAndConfig} from './kernels/LogicalAnd';\nimport {logicalNotConfig} from './kernels/LogicalNot';\nimport {maxConfig} from './kernels/Max';\nimport {maximumConfig} from './kernels/Maximum';\nimport {maxPoolConfig} from './kernels/MaxPool';\nimport {meanConfig} from './kernels/Mean';\nimport {minConfig} from './kernels/Min';\nimport {minimumConfig} from './kernels/Minimum';\nimport {mirrorPadConfig} from './kernels/MirrorPad';\nimport {multiplyConfig} from './kernels/Multiply';\nimport {negConfig} from './kernels/Neg';\nimport {nonMaxSuppressionV3Config} from './kernels/NonMaxSuppressionV3';\nimport {nonMaxSuppressionV5Config} from './kernels/NonMaxSuppressionV5';\nimport {notEqualConfig} from './kernels/NotEqual';\nimport {onesLikeConfig} from './kernels/OnesLike';\nimport {packConfig} from './kernels/Pack';\nimport {padV2Config} from './kernels/PadV2';\nimport {powConfig} from './kernels/Pow';\nimport {preluConfig} from './kernels/Prelu';\nimport {prodConfig} from './kernels/Prod';\nimport {rangeConfig} from './kernels/Range';\nimport {realConfig} from './kernels/Real';\nimport {realDivConfig} from './kernels/RealDiv';\nimport {reciprocalConfig} from './kernels/Reciprocal';\nimport {reluConfig} from './kernels/Relu';\nimport {relu6Config} from './kernels/Relu6';\nimport {reshapeConfig} from './kernels/Reshape';\nimport {resizeBilinearConfig} from './kernels/ResizeBilinear';\nimport {resizeNearestNeighborConfig} from './kernels/ResizeNearestNeighbor';\nimport {rotateWithOffsetConfig} from './kernels/RotateWithOffset';\nimport {rsqrtConfig} from './kernels/Rsqrt';\nimport {scatterNdConfig} from './kernels/ScatterNd';\nimport {selectConfig} from './kernels/Select';\nimport {sigmoidConfig} from './kernels/Sigmoid';\nimport {sinConfig} from './kernels/Sin';\nimport {sinhConfig} from './kernels/Sinh';\nimport {sliceConfig} from './kernels/Slice';\nimport {softmaxConfig} from './kernels/Softmax';\nimport {spaceToBatchNDConfig} from './kernels/SpaceToBatchND';\nimport {sparseToDenseConfig} from './kernels/SparseToDense';\nimport {splitVConfig} from './kernels/SplitV';\nimport {sqrtConfig} from './kernels/Sqrt';\nimport {squareConfig} from './kernels/Square';\nimport {squaredDifferenceConfig} from './kernels/SquaredDifference';\nimport {stridedSliceConfig} from './kernels/StridedSlice';\nimport {stringNGramsConfig} from './kernels/StringNGrams';\nimport {subConfig} from './kernels/Sub';\nimport {sumConfig} from './kernels/Sum';\nimport {tanhConfig} from './kernels/Tanh';\nimport {tileConfig} from './kernels/Tile';\nimport {topKConfig} from './kernels/TopK';\nimport {transformConfig} from './kernels/Transform';\nimport {transposeConfig} from './kernels/Transpose';\nimport {unpackConfig} from './kernels/Unpack';\nimport {zerosLikeConfig} from './kernels/ZerosLike';\n\n// List all kernel configs here\nconst kernelConfigs: KernelConfig[] = [\n _fusedMatMulConfig,\n absConfig,\n addConfig,\n addNConfig,\n argMaxConfig,\n argMinConfig,\n atan2Config,\n avgPoolConfig,\n batchMatMulConfig,\n batchToSpaceNDConfig,\n castConfig,\n ceilConfig,\n clipByValueConfig,\n complexConfig,\n concatConfig,\n conv2DConfig,\n conv2DBackpropInputConfig,\n cosConfig,\n coshConfig,\n cropAndResizeConfig,\n cumprodConfig,\n cumsumConfig,\n depthToSpaceConfig,\n depthwiseConv2dNativeConfig,\n einsumConfig,\n eluConfig,\n equalConfig,\n expConfig,\n expandDimsConfig,\n expm1Config,\n fillConfig,\n flipLeftRightConfig,\n fromPixelsConfig,\n floorConfig,\n floorDivConfig,\n fusedBatchNormConfig,\n fusedConv2DConfig,\n fusedDepthwiseConv2DConfig,\n gatherNdConfig,\n gatherV2Config,\n greaterConfig,\n greaterEqualConfig,\n identityConfig,\n imagConfig,\n isNaNConfig,\n leakyReluConfig,\n lessConfig,\n lessEqualConfig,\n logConfig,\n logicalAndConfig,\n logicalNotConfig,\n maxConfig,\n maximumConfig,\n maxPoolConfig,\n meanConfig,\n minConfig,\n minimumConfig,\n mirrorPadConfig,\n multiplyConfig,\n negConfig,\n nonMaxSuppressionV3Config,\n nonMaxSuppressionV5Config,\n notEqualConfig,\n onesLikeConfig,\n packConfig,\n padV2Config,\n powConfig,\n preluConfig,\n prodConfig,\n rangeConfig,\n realConfig,\n realDivConfig,\n reciprocalConfig,\n reluConfig,\n relu6Config,\n reshapeConfig,\n resizeBilinearConfig,\n resizeNearestNeighborConfig,\n rotateWithOffsetConfig,\n rsqrtConfig,\n scatterNdConfig,\n selectConfig,\n sigmoidConfig,\n sinConfig,\n sinhConfig,\n sliceConfig,\n stridedSliceConfig,\n stringNGramsConfig,\n softmaxConfig,\n spaceToBatchNDConfig,\n sparseToDenseConfig,\n splitVConfig,\n sqrtConfig,\n squareConfig,\n squaredDifferenceConfig,\n subConfig,\n sumConfig,\n tanhConfig,\n tileConfig,\n topKConfig,\n transformConfig,\n transposeConfig,\n unpackConfig,\n zerosLikeConfig\n];\n\nfor (const kernelConfig of kernelConfigs) {\n registerKernel(kernelConfig);\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nexport * from './base';\nimport './register_all_kernels';\n","(function(){/*\n\n Copyright The Closure Library Authors.\n SPDX-License-Identifier: Apache-2.0\n*/\n'use strict';var D;function ba(a){var b=0;return function(){return b>>0)+\"_\",f=0;return b});\nJ(\"Symbol.iterator\",function(a){if(a)return a;a=Symbol(\"Symbol.iterator\");for(var b=\"Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array\".split(\" \"),c=0;cc&&(c=Math.max(c+f,0));cg)d[c++]=g;else{if(2048>g)d[c++]=g>>6|192;else{if(55296<=g&&57343>=g){if(56319>=g&&f=e){g=1024*(g-55296)+e-56320+65536;d[c++]=g>>18|240;d[c++]=g>>12&63|128;d[c++]=g>>6&63|128;d[c++]=g&63|128;continue}else f--}if(b)throw Error(\"Found an unpaired surrogate\");g=65533}d[c++]=\ng>>12|224;d[c++]=g>>6&63|128}d[c++]=g&63|128}}a=d.subarray(0,c)}return a};var Fa={},Ga=null;function Ha(a,b){void 0===b&&(b=0);Ia();b=Fa[b];for(var c=Array(Math.floor(a.length/3)),d=b[64]||\"\",f=0,g=0;f>2];e=b[(e&3)<<4|h>>4];h=b[(h&15)<<2|k>>6];k=b[k&63];c[g++]=l+e+h+k}l=0;k=d;switch(a.length-f){case 2:l=a[f+1],k=b[(l&15)<<2]||d;case 1:a=a[f],c[g]=b[a>>2]+b[(a&3)<<4|l>>4]+k+d}return c.join(\"\")}\nfunction Ka(a){var b=a.length,c=3*b/4;c%3?c=Math.floor(c):-1!=\"=.\".indexOf(a[b-1])&&(c=-1!=\"=.\".indexOf(a[b-2])?c-2:c-1);var d=new Uint8Array(c),f=0;La(a,function(g){d[f++]=g});return d.subarray(0,f)}\nfunction La(a,b){function c(k){for(;d>4);64!=e&&(b(g<<4&240|e>>2),64!=h&&b(e<<6&192|h))}}\nfunction Ia(){if(!Ga){Ga={};for(var a=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\".split(\"\"),b=[\"+/=\",\"+/\",\"-_=\",\"-_.\",\"-_\"],c=0;5>c;c++){var d=a.concat(b[c].split(\"\"));Fa[c]=d;for(var f=0;fc)return a.g+=1,d;c=b[a.g+1];d|=(c&127)<<7;if(128>c)return a.g+=2,d;c=b[a.g+2];d|=(c&127)<<14;if(128>c)return a.g+=3,d;c=b[a.g+3];d|=(c&127)<<21;if(128>c)return a.g+=4,d;c=b[a.g+4];d|=(c&15)<<28;if(128>c)return a.g+=5,d>>>0;a.g+=5;128<=b[a.g++]&&128<=b[a.g++]&&128<=b[a.g++]&&128<=b[a.g++]&&a.g++;return d}\nfunction S(a){var b=a.h[a.g];var c=a.h[a.g+1];var d=a.h[a.g+2],f=a.h[a.g+3];a.g+=4;c=(b<<0|c<<8|d<<16|f<<24)>>>0;a=2*(c>>31)+1;b=c>>>23&255;c&=8388607;return 255==b?c?NaN:Infinity*a:0==b?a*Math.pow(2,-149)*c:a*Math.pow(2,b-150)*(c+Math.pow(2,23))}var Sa=[];function Ta(){this.g=new Uint8Array(64);this.h=0}Ta.prototype.push=function(a){if(!(this.h+1>>=7;a.push(b)};function Ua(a){var b={},c=void 0===b.N?!1:b.N;this.o={v:void 0===b.v?!1:b.v};this.N=c;b=this.o;Sa.length?(c=Sa.pop(),b&&(c.v=b.v),a&&Qa(c,a),a=c):a=new Pa(a,b);this.g=a;this.m=this.g.g;this.h=this.i=this.l=-1;this.j=!1}Ua.prototype.reset=function(){this.g.reset();this.h=this.l=-1};function Va(a){var b=a.g;(b=b.g==b.i)||(b=a.j)||(b=a.g,b=b.l||0>b.g||b.g>b.i);if(b)return!1;a.m=a.g.g;b=Ra(a.g);var c=b&7;if(0!=c&&5!=c&&1!=c&&2!=c&&3!=c&&4!=c)return a.j=!0,!1;a.i=b;a.l=b>>>3;a.h=c;return!0}\nfunction Wa(a){switch(a.h){case 0:if(0!=a.h)Wa(a);else{for(a=a.g;a.h[a.g]&128;)a.g++;a.g++}break;case 1:1!=a.h?Wa(a):(a=a.g,a.g+=8);break;case 2:if(2!=a.h)Wa(a);else{var b=Ra(a.g);a=a.g;a.g+=b}break;case 5:5!=a.h?Wa(a):(a=a.g,a.g+=4);break;case 3:b=a.l;do{if(!Va(a)){a.j=!0;break}if(4==a.h){a.l!=b&&(a.j=!0);break}Wa(a)}while(1);break;default:a.j=!0}}\nfunction Xa(a,b,c){var d=a.g.i,f=Ra(a.g),g=a.g.g+f;a.g.i=g;c(b,a);c=g-a.g.g;if(0!==c)throw Error(\"Message parsing ended unexpectedly. Expected to read \"+f+\" bytes, instead read \"+(f-c)+\" bytes, either the data ended unexpectedly or the message misreported its own length\");a.g.g=g;a.g.i=d;return b}\nfunction Ya(a){var b=Ra(a.g);a=a.g;var c=a.g;a.g+=b;a=a.h;var d;if(Ba)(d=Aa)||(d=Aa=new TextDecoder(\"utf-8\",{fatal:!1})),d=d.decode(a.subarray(c,c+b));else{b=c+b;for(var f=[],g=null,e,h,k;ce?f.push(e):224>e?c>=b?f.push(65533):(h=a[c++],194>e||128!==(h&192)?(c--,f.push(65533)):f.push((e&31)<<6|h&63)):240>e?c>=b-1?f.push(65533):(h=a[c++],128!==(h&192)||224===e&&160>h||237===e&&160<=h||128!==((d=a[c++])&192)?(c--,f.push(65533)):f.push((e&15)<<12|(h&63)<<6|d&63)):244>=e?c>=b-2?f.push(65533):\n(h=a[c++],128!==(h&192)||0!==(e<<28)+(h-144)>>30||128!==((d=a[c++])&192)||128!==((k=a[c++])&192)?(c--,f.push(65533)):(e=(e&7)<<18|(h&63)<<12|(d&63)<<6|k&63,e-=65536,f.push((e>>10&1023)+55296,(e&1023)+56320))):f.push(65533),8192<=f.length&&(g=za(g,f),f.length=0);d=za(g,f)}return d};function Za(){this.h=[];this.i=0;this.g=new Ta}function $a(a,b){0!==b.length&&(a.h.push(b),a.i+=b.length)}function ab(a){var b=a.i+a.g.length();if(0===b)return new Uint8Array(0);b=new Uint8Array(b);for(var c=a.h,d=c.length,f=0,g=0;gd?1:0)?-d:d;0===d?0<1/d?Q=R=0:(R=0,Q=2147483648):isNaN(d)?(R=0,Q=2147483647):3.4028234663852886E38>>0):1.1754943508222875E-38>d?(d=Math.round(d/Math.pow(2,-149)),R=0,Q=(c<<31|d)>>>0):(b=Math.floor(Math.log(d)/Math.LN2),d*=Math.pow(2,-b),d=Math.round(8388608*d),16777216<=d&&++b,R=0,Q=(c<<31|b+127<<23|d&8388607)>>>0);c=Q;a.push(c>>>0&255);a.push(c>>>8&255);a.push(c>>>16&255);a.push(c>>>24&255)}};var bb=\"function\"===typeof Uint8Array;function cb(a,b,c){if(null!=a)return\"object\"===typeof a?bb&&a instanceof Uint8Array?c(a):db(a,b,c):b(a)}function db(a,b,c){if(Array.isArray(a)){for(var d=Array(a.length),f=0;f=a.l?a.h?a.h[b]:void 0:a.g[b+a.j]}function kb(a){var b=void 0===b?!1:b;var c=W(a,1,b);null==c&&(c=ib);c===ib&&(c=eb([]),X(a,1,c,b));return c}function Y(a,b,c){a=W(a,b);a=null==a?a:+a;return null==a?void 0===c?0:c:a}function X(a,b,c,d){(void 0===d?0:d)||b>=a.l?(jb(a),a.h[b]=c):a.g[b+a.j]=c}\nfunction lb(a,b){a.i||(a.i={});var c=a.i[1];if(!c){var d=kb(a);c=[];for(var f=0;fB;B=Math.abs(B);var q=B>>>0;B=Math.floor((B-q)/4294967296);B>>>=0;C&&(B=~B>>>\n0,q=(~q>>>0)+1,4294967295>>7|q<<25)>>>0,q>>>=7;r.push(C)}qb(p,A);I=ab(I);F.call(E,K,I);if(z.O)for(E=0;EB;B++)C.push(q&127|128),q>>=7;C.push(1)}U(r,2,W(A,2));C=W(A,3);null!=C&&(C=Ea(C),T(r.g,26),T(r.g,C.length),$a(r,r.g.end()),$a(r,C));C=W(A,4);null!=C&&(C=Ea(C),T(r.g,34),T(r.g,C.length),$a(r,r.g.end()),$a(r,\nC));qb(A,r);p=ab(p);K.call(F,I,p)}}m=m.data;break a;default:m={}}}v=m;w=n.stream;switch(n.type){case \"video\":e.pushTexture2d(Object.assign(Object.assign({},v),{stream:w,timestamp:g}));break;case \"detections\":t=v;t.stream=w;t.timestamp=g;e.pushDetectionList(t);break;default:throw Error(\"Unknown input config type: '\"+n.type+\"'\");}}f.i.send(e);return N(y,f.C,4);case 4:e.delete(),y.g=0}})})};\nfunction Vb(a,b,c){return Z(a,function f(){var g,e,h,k,l,n,v=this,w,t,y,m,u,x,z,E;return O(f,function(F){switch(F.g){case 1:if(!c)return F.return(b);g={};e=0;h=M(Object.keys(c));for(k=h.next();!k.done;k=h.next())l=k.value,n=c[l],\"string\"!==typeof n&&\"texture\"===n.type&&void 0!==b[n.stream]&&++e;1aa&&128<=L;aa++)L=H.h[H.g++],Ja|=(L&127)<<7*aa;128<=L&&(L=H.h[H.g++],Ja|=(L&127)<<28,q|=(L&127)>>4);if(128<=L)for(aa=0;5>aa&&128<=\nL;aa++)L=H.h[H.g++],q|=(L&127)<<7*aa+3;if(128>L){H=Ja>>>0;L=q>>>0;if(q=L&2147483648)H=~H+1>>>0,L=~L>>>0,0==H&&(L=L+1>>>0);H=4294967296*L+(H>>>0);q=q?-H:H}else H.l=!0,q=void 0;X(B,6,q);break;default:if(!rb(B,r))break a}}B={Z:Y(B,1),$:Y(B,2),height:Y(B,3),width:Y(B,4),rotation:Y(B,5,0),X:ob(B,6)};r=Eb(I.get(C));H=p.get(C);a:for(q=new ub,H=new Ua(H);Va(H);)switch(H.i){case 10:q.addClassification(Xa(H,new sb,tb));break;default:if(!rb(q,H))break a}B={T:B,O:r,M:Cb(q)};A.push(B)}K=A}else K=[];g[t]=K;F.g=\n7;break}if(\"proto_list\"===y.type){if(m){K=Array(m.size());for(I=0;I\n void;\n\nfunction setup(backend: BackendWasm) {\n wasmFusedMatMul = backend.wasm.cwrap(_FusedMatMul, null /* void */, [\n 'number', // a_id\n 'array', // a_shape\n 'number', // a_shape.length\n 'number', // b_id\n 'array', // b_shape\n 'number', // b_shape.length\n 'number', // transpose_a\n 'number', // transpose_b\n 'number', // activation\n 'number', // biasId\n 'number', // preluActivationWeightsId\n 'number', // leakyreluAlpha\n 'number' // out_id\n ]);\n}\n\nfunction fusedBatchMatMul(args: {\n inputs: _FusedMatMulInputs,\n backend: BackendWasm,\n attrs: _FusedMatMulAttrs\n}) {\n const {inputs, backend, attrs} = args;\n const {a, b, bias, preluActivationWeights} = inputs;\n\n if (a.dtype !== 'float32' || b.dtype !== 'float32') {\n throw new Error(\n `_FusedMatMul for non non-float32 tensors not yet supported.`);\n }\n\n const {transposeA, transposeB, activation, leakyreluAlpha} = attrs;\n const aId = backend.dataIdMap.get(a.dataId).id;\n const bId = backend.dataIdMap.get(b.dataId).id;\n\n let biasId = 0;\n if (bias != null) {\n const biasData = backend.dataIdMap.get(bias.dataId);\n if (biasData.shape.length !== 1) {\n throw new Error(\n `_FusedMatMul only supports rank-1 bias but got ` +\n `rank ${biasData.shape.length}.`);\n }\n biasId = biasData.id;\n }\n const preluActivationWeightsId = preluActivationWeights == null ?\n 0 :\n backend.dataIdMap.get(preluActivationWeights.dataId).id;\n const fusedActivation =\n FusableActivation[activation as {} as keyof typeof FusableActivation];\n if (fusedActivation == null) {\n throw new Error(\n `${activation} activation not yet supported for FusedConv2D ` +\n `in the wasm backend.`);\n }\n\n const leftDim = transposeA ? a.shape[2] : a.shape[1];\n const rightDim = transposeB ? b.shape[1] : b.shape[2];\n const batchDims = broadcast_util.assertAndGetBroadcastShape(\n a.shape.slice(0, -2), b.shape.slice(0, -2));\n\n const out = backend.makeOutput([...batchDims, leftDim, rightDim], a.dtype);\n const outId = backend.dataIdMap.get(out.dataId).id;\n\n const aShapeBytes = new Uint8Array(new Int32Array(a.shape).buffer);\n const bShapeBytes = new Uint8Array(new Int32Array(b.shape).buffer);\n\n wasmFusedMatMul(\n aId, aShapeBytes, a.shape.length, bId, bShapeBytes, b.shape.length,\n transposeA, transposeB, fusedActivation, biasId, preluActivationWeightsId,\n leakyreluAlpha || 0, outId);\n\n return out;\n}\n\nexport const _fusedMatMulConfig: KernelConfig = {\n kernelName: _FusedMatMul,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: fusedBatchMatMul as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataType, KernelConfig, TensorInfo, UnaryInputs, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {CppDType} from './types';\n\nexport function createUnaryKernelConfig(\n kernelName: string, outType?: DataType): KernelConfig {\n let wasmFunc: (xId: number, dtype: number, outId: number) => void;\n\n function setupFunc(backend: BackendWasm): void {\n wasmFunc = backend.wasm.cwrap(kernelName, null /* void */, [\n 'number', // x_id\n 'number', // dtype\n 'number', // out_id\n ]);\n }\n\n function kernelFunc(args: {backend: BackendWasm, inputs: UnaryInputs}):\n TensorInfo {\n const {backend, inputs: {x}} = args;\n const xId = backend.dataIdMap.get(x.dataId).id;\n const out = backend.makeOutput(x.shape, outType || x.dtype);\n const outId = backend.dataIdMap.get(out.dataId).id;\n\n // Short-circuit zero-sized tensors.\n if (util.sizeFromShape(out.shape) === 0) {\n return out;\n }\n\n wasmFunc(xId, CppDType[x.dtype], outId);\n return out;\n }\n\n return {kernelName, backendName: 'wasm', setupFunc, kernelFunc};\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Abs, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {createUnaryKernelConfig} from './unary_kernel';\n\nexport const absConfig: KernelConfig = createUnaryKernelConfig(Abs);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, BinaryInputs, DataType, KernelConfig, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {CppDType} from './types';\n\nexport function createBinaryKernelConfig(\n kernelName: string, supportsFullBroadcast: boolean,\n dtype?: DataType): KernelConfig {\n let wasmFunc:\n (aId: number, aShape: Uint8Array, aShapeLen: number, bId: number,\n bShape: Uint8Array, bShapeLen: number, dtype: number, outId: number) =>\n void;\n\n function setupFunc(backend: BackendWasm): void {\n wasmFunc = backend.wasm.cwrap(kernelName, null /* void */, [\n 'number', // a_id,\n 'array', // a_shape\n 'number', // a_shape.length\n 'number', // b_id\n 'array', // b_shape\n 'number', // b_shape.length\n 'number', // dtype\n 'number' // out_id\n ]);\n }\n\n function kernelFunc(args: {backend: BackendWasm, inputs: BinaryInputs}):\n TensorInfo {\n const {backend, inputs} = args;\n const {a, b} = inputs;\n const aId = backend.dataIdMap.get(a.dataId).id;\n const bId = backend.dataIdMap.get(b.dataId).id;\n\n const outputType = dtype != null ? dtype : a.dtype;\n const newShape = backend_util.assertAndGetBroadcastShape(a.shape, b.shape);\n const out = backend.makeOutput(newShape, outputType);\n\n // Short-circuit zero-sized tensors.\n if (util.sizeFromShape(newShape) === 0) {\n return out;\n }\n\n const aShapeBytes = new Uint8Array(new Int32Array(a.shape).buffer);\n const bShapeBytes = new Uint8Array(new Int32Array(b.shape).buffer);\n const outId = backend.dataIdMap.get(out.dataId).id;\n const kernelFunc = () => wasmFunc(\n aId, aShapeBytes, a.shape.length, bId, bShapeBytes, b.shape.length,\n CppDType[a.dtype], outId);\n\n kernelFunc();\n return out;\n }\n\n return {kernelName, backendName: 'wasm', setupFunc, kernelFunc};\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Add, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {createBinaryKernelConfig} from './binary_kernel';\n\nconst supportsFullBroadcast = true;\n\nexport const addConfig: KernelConfig =\n createBinaryKernelConfig(Add, supportsFullBroadcast);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {AddN, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {CppDType} from './types';\n\nlet wasmFunc:\n (inputIds: Uint8Array, inputIdsLen: number, dtype: number, outId: number) =>\n void;\n\nfunction setupFunc(backend: BackendWasm): void {\n wasmFunc = backend.wasm.cwrap(AddN, null /* void */, [\n 'array', // input_ids\n 'number', // input_ids.length\n 'number', // dtype\n 'number', // out_id\n ]);\n}\n\nfunction addn(args: {inputs: TensorInfo[], backend: BackendWasm}) {\n const {inputs, backend} = args;\n const out = backend.makeOutput(inputs[0].shape, inputs[0].dtype);\n\n // Short-circuit zero-sized tensors.\n if (util.sizeFromShape(out.shape) === 0) {\n return out;\n }\n\n const inputIds = inputs.map(x => backend.dataIdMap.get(x.dataId).id);\n const inputIdsBytes = new Uint8Array(new Int32Array(inputIds).buffer);\n const outId = backend.dataIdMap.get(out.dataId).id;\n wasmFunc(inputIdsBytes, inputIds.length, CppDType[out.dtype], outId);\n\n return out;\n}\n\nexport const addNConfig: KernelConfig = {\n kernelName: AddN,\n backendName: 'wasm',\n setupFunc,\n kernelFunc: addn as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Identity, IdentityInputs, KernelConfig, KernelFunc, tensor} from '@tensorflow/tfjs-core';\nimport {TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nexport function identity(args: {inputs: IdentityInputs, backend: BackendWasm}):\n TensorInfo {\n const {inputs: {x}, backend} = args;\n\n if (x.dtype === 'string') {\n return tensor(backend.readSync(x.dataId), x.shape, x.dtype);\n }\n\n const out = backend.makeOutput(x.shape, x.dtype);\n const inVals = backend.typedArrayFromHeap(x);\n const outVals = backend.typedArrayFromHeap(out);\n outVals.set(inVals);\n return out;\n}\n\nexport const identityConfig: KernelConfig = {\n kernelName: Identity,\n backendName: 'wasm',\n kernelFunc: identity as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, TensorInfo, Transpose, TransposeAttrs, TransposeInputs} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {identity} from './Identity';\nimport {CppDType} from './types';\n\nlet wasmTranspose: (\n xId: number, xShape: Uint8Array, xShapeLength: number, dtype: CppDType,\n outId: number, perm: Uint8Array, permLength: number) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmTranspose = backend.wasm.cwrap(Transpose, null /* void */, [\n 'number', // xId\n 'array', // x.shape\n 'number', // x.shape.length\n 'number', // dtype\n 'number', // outId\n 'array', // perm\n 'number', // perm.length\n ]);\n}\n\nexport function transpose(\n args:\n {inputs: TransposeInputs, backend: BackendWasm, attrs: TransposeAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n // Reduce any dimensions with size one. Lower-rank transpose kernel performs\n // better due to simpler memory access pattern.\n const [reducedShape, perm] = removeOneSizeDims(inputs.x.shape, attrs.perm);\n\n let permIsNoOp = true;\n for (let i = 0; i < perm.length; i++) {\n if (perm[i] !== i) {\n permIsNoOp = false;\n }\n }\n const outShape = computeOutShape(inputs.x.shape, attrs.perm);\n const x = {\n dataId: inputs.x.dataId,\n shape: reducedShape,\n dtype: inputs.x.dtype\n };\n\n if (permIsNoOp) {\n const cloned = identity({inputs, backend});\n cloned.shape = outShape;\n return cloned;\n }\n\n const out = backend.makeOutput(outShape, x.dtype);\n const xId = backend.dataIdMap.get(x.dataId).id;\n const outId = backend.dataIdMap.get(out.dataId).id;\n const permBytes = new Uint8Array(new Int32Array(perm).buffer);\n const xShapeBytes = new Uint8Array(new Int32Array(x.shape).buffer);\n\n wasmTranspose(\n xId, xShapeBytes, x.shape.length, CppDType[x.dtype], outId, permBytes,\n perm.length);\n return out;\n}\n\nfunction computeOutShape(inShape: number[], perm: number[]): number[] {\n const outShape = new Array(inShape.length);\n for (let i = 0; i < outShape.length; i++) {\n outShape[i] = inShape[perm[i]];\n }\n return outShape;\n}\n\nfunction removeOneSizeDims(\n shape: number[], perm: number[]): [number[], number[]] {\n const newShape: number[] = [];\n const newPerm: number[] = [];\n for (let i = 0; i < shape.length; ++i) {\n if (shape[i] !== 1) {\n newShape.push(shape[i]);\n }\n if (shape[perm[i]] !== 1) {\n newPerm.push(perm[i]);\n }\n }\n for (let i = 0; i < newPerm.length; ++i) {\n let minValIdx = -1;\n for (let j = 0; j < newPerm.length; ++j) {\n if (newPerm[j] >= i &&\n (minValIdx === -1 || newPerm[minValIdx] > newPerm[j])) {\n minValIdx = j;\n }\n }\n newPerm[minValIdx] = i;\n }\n return [newShape, newPerm];\n}\n\nexport const transposeConfig: KernelConfig = {\n kernelName: Transpose,\n backendName: 'wasm',\n kernelFunc: transpose as {} as KernelFunc,\n setupFunc: setup,\n};\n","/**\n * @license\n * Copyright 2020 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, TensorInfo, util} from '@tensorflow/tfjs-core';\nimport {BackendWasm} from '../backend_wasm';\nimport {transpose} from './Transpose';\n\n/**\n * Compute permutation axes and do a transpose if necessary.\n *\n * Used by reduction ops.\n * @param x input TensorInfo\n * @param axis reduction axes\n * @param backend wasm backend instance\n */\nexport function permuteAxesAndTranspose(\n x: TensorInfo, axis: number|number[], backend: BackendWasm): {\n transposed: TensorInfo|null,\n axes: number[],\n originalAxes: number[],\n inputWasTransposed: boolean\n} {\n const xShape = x.shape;\n const xRank = x.shape.length;\n\n const originalAxes = util.parseAxisParam(axis, xShape);\n let axes = originalAxes;\n const permutedAxes = backend_util.getAxesPermutation(axes, xRank);\n let xTransposed = null;\n let inputWasTransposed = false;\n if (permutedAxes != null) {\n const newShape: number[] = new Array(xRank);\n for (let i = 0; i < newShape.length; i++) {\n newShape[i] = xShape[permutedAxes[i]];\n }\n\n axes = backend_util.getInnerMostAxes(axes.length, xRank);\n xTransposed =\n transpose({inputs: {x}, attrs: {perm: permutedAxes}, backend});\n\n const xId = backend.dataIdMap.get(x.dataId).id;\n const transposedId = backend.dataIdMap.get(xTransposed.dataId).id;\n if (transposedId !== xId) {\n inputWasTransposed = true;\n }\n }\n\n return {transposed: xTransposed, originalAxes, axes, inputWasTransposed};\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {All, AllAttrs, AllInputs, backend_util, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {permuteAxesAndTranspose} from './kernel_utils';\n\nlet wasmAll: (xId: number, reduceSize: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm): void {\n wasmAll = backend.wasm.cwrap(All, null /*void*/, ['number, number, number']);\n}\n\nfunction all(args: {backend: BackendWasm, inputs: AllInputs, attrs: AllAttrs}):\n TensorInfo {\n const {backend, inputs, attrs} = args;\n const {axis, keepDims} = attrs;\n const {x} = inputs;\n const xId = backend.dataIdMap.get(x.dataId).id;\n let inputId = xId;\n let input = x;\n\n const {transposed, axes, originalAxes, inputWasTransposed} =\n permuteAxesAndTranspose(x, axis, backend);\n\n if (inputWasTransposed) {\n const transposedId = backend.dataIdMap.get(transposed.dataId).id;\n input = transposed;\n inputId = transposedId;\n }\n\n const inputRank = input.shape.length;\n backend_util.assertAxesAreInnerMostDims('all', axes, inputRank);\n const [outShape, reduceShape] =\n backend_util.computeOutAndReduceShapes(input.shape, axes);\n const reduceSize = util.sizeFromShape(reduceShape);\n\n const out = backend.makeOutput(outShape, x.dtype);\n if (util.sizeFromShape(input.shape) !== 0) {\n const outId = backend.dataIdMap.get(out.dataId).id;\n wasmAll(inputId, reduceSize, outId);\n }\n\n if (inputWasTransposed) {\n // dispose of the transposed tensor.\n backend.disposeData(transposed.dataId);\n }\n\n if (keepDims) {\n // reshape\n const newShape = backend_util.expandShapeToKeepDim(out.shape, originalAxes);\n out.shape = newShape;\n }\n\n return out;\n}\n\nexport const allConfig: KernelConfig = {\n kernelName: All,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: all as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Any, AnyAttrs, AnyInputs, backend_util, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {permuteAxesAndTranspose} from './kernel_utils';\n\nlet wasmAny: (xId: number, reduceSize: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm): void {\n wasmAny = backend.wasm.cwrap(Any, null /*void*/, ['number, number, number']);\n}\n\nfunction any(args: {backend: BackendWasm, inputs: AnyInputs, attrs: AnyAttrs}):\n TensorInfo {\n const {backend, inputs, attrs} = args;\n const {axis, keepDims} = attrs;\n const {x} = inputs;\n const xId = backend.dataIdMap.get(x.dataId).id;\n let inputId = xId;\n let input = x;\n\n const {transposed, axes, originalAxes, inputWasTransposed} =\n permuteAxesAndTranspose(x, axis, backend);\n\n if (inputWasTransposed) {\n const transposedId = backend.dataIdMap.get(transposed.dataId).id;\n input = transposed;\n inputId = transposedId;\n }\n\n const inputRank = input.shape.length;\n backend_util.assertAxesAreInnerMostDims('any', axes, inputRank);\n const [outShape, reduceShape] =\n backend_util.computeOutAndReduceShapes(input.shape, axes);\n const reduceSize = util.sizeFromShape(reduceShape);\n\n const out = backend.makeOutput(outShape, x.dtype);\n if (util.sizeFromShape(input.shape) !== 0) {\n const outId = backend.dataIdMap.get(out.dataId).id;\n wasmAny(inputId, reduceSize, outId);\n }\n\n if (inputWasTransposed) {\n // dispose of the transposed tensor.\n backend.disposeData(transposed.dataId);\n }\n\n if (keepDims) {\n // reshape\n const newShape = backend_util.expandShapeToKeepDim(out.shape, originalAxes);\n out.shape = newShape;\n }\n\n return out;\n}\n\nexport const anyConfig: KernelConfig = {\n kernelName: Any,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: any as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ArgMax, ArgMaxAttrs, ArgMaxInputs, KernelConfig, KernelFunc, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {permuteAxesAndTranspose} from './kernel_utils';\nimport {CppDType} from './types';\n\nlet wasmFunc: (\n xId: number, dtype: number, outerSize: number, innerSize: number,\n outId: number) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmFunc = backend.wasm.cwrap(ArgMax, null /* void */, [\n 'number', // x_id\n 'number', // dtype\n 'number', // outer_size\n 'number', // inner_size\n 'number' // out_id\n ]);\n}\n\nfunction argmax(\n args: {inputs: ArgMaxInputs, backend: BackendWasm, attrs: ArgMaxAttrs}) {\n const {backend, inputs, attrs} = args;\n const {axis} = attrs as {} as ArgMaxAttrs;\n const {x} = inputs as {} as ArgMaxInputs;\n const xId = backend.dataIdMap.get(x.dataId).id;\n let inputId = xId;\n let input = x;\n\n const {transposed, axes, inputWasTransposed} =\n permuteAxesAndTranspose(x, axis, backend);\n\n if (inputWasTransposed) {\n const transposedId = backend.dataIdMap.get(transposed.dataId).id;\n if (transposedId !== xId) {\n // transpose was not a no-op. We will need to dispose of this\n // once we are done.\n input = transposed;\n inputId = transposedId;\n }\n }\n\n const outShape = input.shape.slice(0, -1);\n const out = backend.makeOutput(outShape, 'int32');\n const outId = backend.dataIdMap.get(out.dataId).id;\n const outerSize = util.sizeFromShape(out.shape);\n const innerSize = input.shape[axes[0]];\n wasmFunc(inputId, CppDType[input.dtype], outerSize, innerSize, outId);\n\n if (inputWasTransposed) {\n // dispose of the transposed tensor.\n backend.disposeData(transposed.dataId);\n }\n\n return out;\n}\n\nexport const argMaxConfig: KernelConfig = {\n kernelName: ArgMax,\n backendName: 'wasm',\n kernelFunc: argmax as {} as KernelFunc,\n setupFunc: setup\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {AvgPool, AvgPoolAttrs, AvgPoolInputs, backend_util, KernelConfig, KernelFunc, Tensor4D} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nlet wasmAvgPool: (\n xId: number, batchSize: number, inputHeight: number, inputWidth: number,\n filterHeight: number, filterWidth: number, padTop: number, padRight: number,\n padBottom: number, padLeft: number, strideHeight: number,\n strideWidth: number, channels: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmAvgPool = backend.wasm.cwrap(AvgPool, null /* void */, [\n 'number', // xId\n 'number', // batchSize\n 'number', // inputHeight\n 'number', // inputWidth\n 'number', // filterHeight\n 'number', // filterWidth\n 'number', // padTop\n 'number', // padRight\n 'number', // padBottom\n 'number', // padLeft\n 'number', // strideHeight\n 'number', // strideWidth\n 'number', // channels\n 'number', // outId\n ]);\n}\n\nfunction avgPool(\n args: {inputs: AvgPoolInputs, backend: BackendWasm, attrs: AvgPoolAttrs}) {\n const {inputs, attrs, backend} = args;\n\n const x = inputs.x as Tensor4D;\n const xId = backend.dataIdMap.get(x.dataId).id;\n\n const {filterSize, strides, pad, dimRoundingMode} = attrs;\n const convInfo = backend_util.computePool2DInfo(\n x.shape, filterSize, strides, 1 /* dilations */, pad, dimRoundingMode);\n\n const filterHeight = convInfo.filterHeight;\n const filterWidth = convInfo.filterWidth;\n const padTop = convInfo.padInfo.top;\n const padRight = convInfo.padInfo.right;\n const padBottom = convInfo.padInfo.bottom;\n const padLeft = convInfo.padInfo.left;\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n const channels = convInfo.inChannels;\n\n if (convInfo.dataFormat !== 'channelsLast') {\n throw new Error(\n `wasm backend does not support dataFormat:'` +\n `${convInfo.dataFormat}'. Please use 'channelsLast'.`);\n }\n\n if (convInfo.dilationWidth !== 1 || convInfo.dilationHeight !== 1) {\n throw new Error(\n `was backend only supports average pooling with dilation = [1, 1], ` +\n `got [${convInfo.dilationHeight}, ${convInfo.dilationWidth}].`);\n }\n\n const out = backend.makeOutput(convInfo.outShape, 'float32');\n const outId = backend.dataIdMap.get(out.dataId).id;\n\n wasmAvgPool(\n xId, x.shape[0], x.shape[1], x.shape[2], filterHeight, filterWidth,\n padTop, padRight, padBottom, padLeft, strideHeight, strideWidth, channels,\n outId);\n return out;\n}\n\nexport const avgPoolConfig: KernelConfig = {\n kernelName: AvgPool,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: avgPool as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Reshape, ReshapeAttrs, ReshapeInputs, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nexport function reshape(\n args: {inputs: ReshapeInputs, attrs: ReshapeAttrs, backend: BackendWasm}) {\n const {inputs, attrs} = args;\n const {x} = inputs;\n const {shape} = attrs;\n\n const xSize = util.sizeFromShape(x.shape);\n const $shape = util.inferFromImplicitShape(shape, xSize);\n\n util.assert(\n xSize === util.sizeFromShape($shape),\n () => `new shape: ${$shape}, old shape: ${x.shape}. New shape and old ` +\n `shape must have the same number of elements.`);\n\n // Backend needs to track refCount for the dataId for reshape op\n args.backend.incRef(x.dataId);\n return {dataId: x.dataId, shape: $shape, dtype: x.dtype};\n}\n\nexport const reshapeConfig: KernelConfig = {\n kernelName: Reshape,\n backendName: 'wasm',\n kernelFunc: reshape as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {BatchMatMul, BatchMatMulAttrs, BatchMatMulInputs, broadcast_util, KernelConfig, KernelFunc, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {reshape} from './Reshape';\n\nlet wasmBatchMatMul: (\n aId: number, aShape: Uint8Array, aShapeSize: number, bId: number,\n bShape: Uint8Array, bShapeSize: number, transposeA: boolean,\n transposeB: boolean, outId: number) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmBatchMatMul = backend.wasm.cwrap(BatchMatMul, null /* void */, [\n 'number', // a_id\n 'array', // a_shape\n 'number', // a_shape.length\n 'number', // b_id\n 'array', // b_shape\n 'number', // b_shape.length\n 'number', // transpose_a\n 'number', // transpose_b\n 'number' // out_id\n ]);\n}\n\nfunction batchMatMul(args: {\n inputs: BatchMatMulInputs,\n backend: BackendWasm,\n attrs: BatchMatMulAttrs\n}) {\n const {inputs, backend, attrs} = args;\n const {a, b} = inputs;\n const {transposeA, transposeB} = attrs;\n\n if (a.dtype !== 'float32' || b.dtype !== 'float32') {\n throw new Error(\n `BatchMatMul for non non-float32 tensors not yet supported.`);\n }\n\n const aRank = a.shape.length;\n const bRank = b.shape.length;\n\n const innerShapeA = transposeA ? a.shape[aRank - 2] : a.shape[aRank - 1];\n const innerShapeB = transposeB ? b.shape[bRank - 1] : b.shape[bRank - 2];\n\n const outerShapeA = transposeA ? a.shape[aRank - 1] : a.shape[aRank - 2];\n const outerShapeB = transposeB ? b.shape[bRank - 2] : b.shape[bRank - 1];\n\n const outerDimsA = a.shape.slice(0, -2);\n const outerDimsB = b.shape.slice(0, -2);\n\n const batchDimA = util.sizeFromShape(outerDimsA);\n const batchDimB = util.sizeFromShape(outerDimsB);\n\n const outShapeOuterDims = broadcast_util.assertAndGetBroadcastShape(\n a.shape.slice(0, -2), b.shape.slice(0, -2));\n const outShape = outShapeOuterDims.concat([outerShapeA, outerShapeB]);\n\n util.assert(\n innerShapeA === innerShapeB,\n () => `Error in matMul: inner shapes (${innerShapeA}) and (` +\n `${innerShapeB}) of Tensors with shapes ${a.shape} and ` +\n `${b.shape} and transposeA=${transposeA}` +\n ` and transposeB=${transposeB} must match.`);\n\n const a3dShape = transposeA ? [batchDimA, innerShapeA, outerShapeA] :\n [batchDimA, outerShapeA, innerShapeA];\n const b3dShape = transposeB ? [batchDimB, outerShapeB, innerShapeB] :\n [batchDimB, innerShapeB, outerShapeB];\n\n // The rest of the implementation is designed to operate on rank-3 tensors\n const a3d = reshape({inputs: {x: a}, backend, attrs: {shape: a3dShape}});\n const b3d = reshape({inputs: {x: b}, backend, attrs: {shape: b3dShape}});\n\n const a3dId = backend.dataIdMap.get(a3d.dataId).id;\n const b3dId = backend.dataIdMap.get(b3d.dataId).id;\n\n const leftDim = transposeA ? a3d.shape[2] : a3d.shape[1];\n const rightDim = transposeB ? b3d.shape[1] : b3d.shape[2];\n const batchDim = Math.max(batchDimA, batchDimB);\n\n const out = backend.makeOutput([batchDim, leftDim, rightDim], a3d.dtype);\n const outId = backend.dataIdMap.get(out.dataId).id;\n\n const aShapeBytes = new Uint8Array(new Int32Array(a3d.shape).buffer);\n const bShapeBytes = new Uint8Array(new Int32Array(b3d.shape).buffer);\n\n wasmBatchMatMul(\n a3dId, aShapeBytes, a3d.shape.length, b3dId, bShapeBytes,\n b3d.shape.length, transposeA, transposeB, outId);\n\n backend.disposeData(a3d.dataId);\n backend.disposeData(b3d.dataId);\n\n out.shape = outShape;\n return out;\n}\n\nexport const batchMatMulConfig: KernelConfig = {\n kernelName: BatchMatMul,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: batchMatMul as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n// Import shared functionality from tfjs-backend-cpu without triggering\n// side effects.\n// tslint:disable-next-line: no-imports-from-dist\nimport {concatImpl as concatImplCPU} from '@tensorflow/tfjs-backend-cpu/dist/shared';\n// tslint:disable-next-line: no-imports-from-dist\nimport {sliceImpl as sliceImplCPU} from '@tensorflow/tfjs-backend-cpu/dist/shared';\n// tslint:disable-next-line: no-imports-from-dist\nimport {rangeImpl as rangeImplCPU} from '@tensorflow/tfjs-backend-cpu/dist/shared';\n// tslint:disable-next-line: no-imports-from-dist\nimport {stringNGramsImpl as stringNGramsImplCPU} from '@tensorflow/tfjs-backend-cpu/dist/shared';\n// tslint:disable-next-line: no-imports-from-dist\nimport {stringSplitImpl as stringSplitImplCPU} from '@tensorflow/tfjs-backend-cpu/dist/shared';\n// tslint:disable-next-line: no-imports-from-dist\nimport {stringToHashBucketFastImpl as stringToHashBucketFastImplCPU} from '@tensorflow/tfjs-backend-cpu/dist/shared';\n\nexport {\n concatImplCPU,\n rangeImplCPU,\n sliceImplCPU,\n stringNGramsImplCPU,\n stringSplitImplCPU,\n stringToHashBucketFastImplCPU\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, Slice, slice_util, SliceAttrs, SliceInputs, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\nimport {sliceImplCPU} from '../kernel_utils/shared';\n\nexport function slice(\n args: {inputs: SliceInputs, attrs: SliceAttrs, backend: BackendWasm}) {\n const {inputs: {x}, attrs: {begin, size}, backend} = args;\n\n const [begin_, size_] = slice_util.parseSliceParams(x, begin, size);\n\n const isContinous = slice_util.isSliceContinous(x.shape, begin_, size_);\n const xVals = backend.readSync(x.dataId);\n const out = backend.makeOutput(size_, x.dtype);\n const xStrides = util.computeStrides(x.shape);\n const outData = backend.dataIdMap.get(out.dataId);\n\n if (isContinous) {\n const flatOffset = slice_util.computeFlatOffset(begin_, xStrides);\n\n if (x.dtype === 'string') {\n outData.stringBytes =\n (xVals as Uint8Array[])\n .slice(flatOffset, flatOffset + util.sizeFromShape(size_));\n } else {\n const outVals = backend.typedArrayFromHeap(out);\n outVals.set(\n (xVals as TypedArray)\n .subarray(flatOffset, flatOffset + util.sizeFromShape(size_)));\n }\n\n return out;\n }\n\n if (x.dtype === 'string') {\n const res = sliceImplCPU(xVals, begin_, size_, x.shape, x.dtype);\n outData.stringBytes = res as Uint8Array[];\n return out;\n }\n\n const outVals = backend.typedArrayFromHeap(out);\n const rank = x.shape.length;\n if (rank === 2) {\n slice2d(\n xVals as TypedArray, xStrides[0], outVals, begin_ as [number, number],\n size_ as [number, number]);\n } else if (rank === 3) {\n slice3d(\n xVals as TypedArray, xStrides[0], xStrides[1], outVals,\n begin_ as [number, number, number], size_ as [number, number, number]);\n } else if (rank === 4) {\n slice4d(\n xVals as TypedArray, xStrides[0], xStrides[1], xStrides[2], outVals,\n begin_ as [number, number, number, number],\n size_ as [number, number, number, number]);\n } else {\n const res =\n sliceImplCPU(xVals, begin_, size_, x.shape, x.dtype) as TypedArray;\n outVals.set(res);\n }\n\n return out;\n}\n\nfunction slice2d(\n xVals: backend_util.TypedArray, xStride: number,\n outVals: backend_util.TypedArray, begin: [number, number],\n size: [number, number]): void {\n let outOffset = 0;\n const beginI = begin[0];\n const beginJ = begin[1];\n const endI = beginI + size[0];\n for (let i = beginI; i < endI; i++) {\n const xOffset = i * xStride + beginJ;\n outVals.set(xVals.subarray(xOffset, xOffset + size[1]), outOffset);\n outOffset += size[1];\n }\n}\n\nfunction slice3d(\n xVals: backend_util.TypedArray, xStride1: number, xStride2: number,\n outVals: backend_util.TypedArray, begin: [number, number, number],\n size: [number, number, number]): void {\n let outOffset = 0;\n const beginI = begin[0];\n const beginJ = begin[1];\n const beginK = begin[2];\n const endI = beginI + size[0];\n const endJ = beginJ + size[1];\n for (let i = beginI; i < endI; i++) {\n for (let j = beginJ; j < endJ; j++) {\n const xOffset = i * xStride1 + j * xStride2 + beginK;\n outVals.set(xVals.subarray(xOffset, xOffset + size[2]), outOffset);\n outOffset += size[2];\n }\n }\n}\n\nfunction slice4d(\n xVals: backend_util.TypedArray, xStride1: number, xStride2: number,\n xStride3: number, outVals: backend_util.TypedArray,\n begin: [number, number, number, number],\n size: [number, number, number, number]): void {\n let outOffset = 0;\n const beginI = begin[0];\n const beginJ = begin[1];\n const beginK = begin[2];\n const endI = beginI + size[0];\n const endJ = beginJ + size[1];\n const endK = beginK + size[2];\n const beginL = begin[3];\n\n for (let i = beginI; i < endI; i++) {\n for (let j = beginJ; j < endJ; j++) {\n for (let k = beginK; k < endK; k++) {\n const xOffset = i * xStride1 + j * xStride2 + k * xStride3 + beginL;\n outVals.set(xVals.subarray(xOffset, xOffset + size[3]), outOffset);\n outOffset += size[3];\n }\n }\n }\n}\n\nexport const sliceConfig: KernelConfig = {\n kernelName: Slice,\n backendName: 'wasm',\n kernelFunc: slice as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, BatchToSpaceND, BatchToSpaceNDAttrs, BatchToSpaceNDInputs, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {reshape} from './Reshape';\nimport {slice} from './Slice';\nimport {transpose} from './Transpose';\n\nfunction batchToSpaceND(args: {\n inputs: BatchToSpaceNDInputs,\n backend: BackendWasm,\n attrs: BatchToSpaceNDAttrs\n}) {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {blockShape, crops} = attrs;\n\n const prod = blockShape.reduce((a, b) => a * b);\n\n const reshaped = backend_util.getReshaped(x.shape, blockShape, prod);\n const permuted = backend_util.getPermuted(reshaped.length, blockShape.length);\n const reshapedPermuted =\n backend_util.getReshapedPermuted(x.shape, blockShape, prod);\n const sliceBeginCoords =\n backend_util.getSliceBeginCoords(crops, blockShape.length);\n const sliceSize =\n backend_util.getSliceSize(reshapedPermuted, crops, blockShape.length);\n\n const xReshaped = reshape({inputs: {x}, backend, attrs: {shape: reshaped}});\n const xTransposed =\n transpose({inputs: {x: xReshaped}, backend, attrs: {perm: permuted}});\n const xTransposedReshaped = reshape(\n {inputs: {x: xTransposed}, backend, attrs: {shape: reshapedPermuted}});\n const result = slice({\n inputs: {x: xTransposedReshaped},\n backend,\n attrs: {begin: sliceBeginCoords, size: sliceSize}\n });\n\n backend.disposeData(xReshaped.dataId);\n backend.disposeData(xTransposed.dataId);\n backend.disposeData(xReshaped.dataId);\n\n return result;\n}\n\nexport const batchToSpaceNDConfig: KernelConfig = {\n kernelName: BatchToSpaceND,\n backendName: 'wasm',\n kernelFunc: batchToSpaceND as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Cast, CastAttrs, CastInputs, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\nimport {TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nexport function cast(\n args: {inputs: CastInputs, attrs: CastAttrs, backend: BackendWasm}):\n TensorInfo {\n const {inputs: {x}, attrs: {dtype}, backend} = args;\n const out = backend.makeOutput(x.shape, dtype);\n const inVals = backend.typedArrayFromHeap(x);\n const outVals = backend.typedArrayFromHeap(out);\n outVals.set(inVals);\n return out;\n}\n\nexport const castConfig: KernelConfig = {\n kernelName: Cast,\n backendName: 'wasm',\n kernelFunc: cast as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, Ceil} from '@tensorflow/tfjs-core';\n\nimport {createUnaryKernelConfig} from './unary_kernel';\n\nexport const ceilConfig: KernelConfig = createUnaryKernelConfig(Ceil);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ClipByValue, ClipByValueAttrs, ClipByValueInputs, KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nlet wasmClip: (xId: number, min: number, max: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmClip = backend.wasm.cwrap(ClipByValue, null /* void */, [\n 'number', // x_id\n 'number', // min\n 'number', // max\n 'number' // out_id\n ]);\n}\n\nfunction clip(args: {\n inputs: ClipByValueInputs,\n backend: BackendWasm,\n attrs: ClipByValueAttrs\n}) {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {clipValueMin, clipValueMax} = attrs;\n const xId = backend.dataIdMap.get(x.dataId).id;\n const out = backend.makeOutput(x.shape, x.dtype);\n const outId = backend.dataIdMap.get(out.dataId).id;\n wasmClip(xId, clipValueMin, clipValueMax, outId);\n return out;\n}\n\nexport const clipByValueConfig: KernelConfig = {\n kernelName: ClipByValue,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: clip as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, Concat, ConcatAttrs, ConcatInputs, KernelConfig, KernelFunc, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\nimport {concatImplCPU} from '../kernel_utils/shared';\nimport {identity} from './Identity';\nimport {reshape} from './Reshape';\n\nexport function concat(\n args: {inputs: ConcatInputs, backend: BackendWasm, attrs: ConcatAttrs}) {\n const {inputs, backend} = args;\n\n const axis = util.parseAxisParam(args.attrs.axis, inputs[0].shape)[0];\n\n const shapes = inputs.map(t => t.shape);\n backend_util.assertParamsConsistent(shapes, axis);\n\n let outShape = backend_util.computeOutShape(inputs.map(t => t.shape), axis);\n\n // Keep only non-empty tensors (ignore tensors with 0 in their shape).\n const $inputs = inputs.filter(t => util.sizeFromShape(t.shape) > 0);\n if ($inputs.length === 1) {\n return identity({inputs: {x: $inputs[0]}, backend});\n }\n\n const out = backend.makeOutput(outShape, inputs[0].dtype);\n\n if (util.sizeFromShape(outShape) === 0) {\n return out;\n }\n\n if ($inputs[0].dtype === 'string') {\n // Any concat of n-dimensional tensors across any axis can be reduced to\n // a concatenation of two-dimensional tensors across the axis 1 by first\n // partitioning the axes of the original tensors into those less than the\n // axis to be concatenated and the rest. Then reshape the tensors\n // into a two-dimensional tensor by collapsing these two sets of axes and\n // concatenate the resulting matrices across the axis 1, finally reshaping\n // the result to have the proper shape.\n const inputs2D = $inputs.map(t => {\n const innerSize = util.sizeFromShape(t.shape.slice(axis));\n const shape = [-1, innerSize];\n return reshape({inputs: {x: t}, backend, attrs: {shape}});\n });\n\n const inputsValShapes = inputs2D.map(t => {\n return {vals: backend.readSync(t.dataId), shape: t.shape};\n });\n\n // Concats 2d tensors along axis=1.\n outShape =\n backend_util.computeOutShape(inputs2D.map(t => t.shape), 1 /* axis */);\n const simplyConcat = inputs2D[0].shape[0] === 1;\n const outVals = concatImplCPU(\n inputsValShapes, outShape, inputs[0].dtype,\n simplyConcat) as string[];\n\n const finalOutShape =\n backend_util.computeOutShape($inputs.map(t => t.shape), axis);\n\n out.shape = finalOutShape;\n const outData = backend.dataIdMap.get(out.dataId);\n outData.stringBytes = backend_util.fromStringArrayToUint8(outVals);\n\n inputs2D.forEach(t => backend.disposeData(t.dataId));\n\n return out;\n }\n\n const batchDim = util.sizeFromShape($inputs[0].shape.slice(0, axis));\n let sumInnerDims = 0;\n const innerDims = $inputs.map(input => {\n const innerDim = util.sizeFromShape(input.shape.slice(axis));\n sumInnerDims += innerDim;\n return innerDim;\n });\n const inVals = $inputs.map(input => backend.typedArrayFromHeap(input));\n const outVals = backend.typedArrayFromHeap(out);\n for (let b = 0; b < batchDim; b++) {\n let outOffset = b * sumInnerDims;\n for (let i = 0; i < inVals.length; i++) {\n const innerDim = innerDims[i];\n const inOffset = b * innerDim;\n const vals = inVals[i].subarray(inOffset, inOffset + innerDim);\n outVals.set(vals, outOffset);\n outOffset += innerDim;\n }\n }\n return out;\n}\n\nexport const concatConfig: KernelConfig = {\n kernelName: Concat,\n backendName: 'wasm',\n kernelFunc: concat as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, Conv2D, Conv2DAttrs, Conv2DInputs, KernelConfig, KernelFunc, Tensor4D} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nlet wasmConv2d: (\n xId: number, batchSize: number, inputHeight: number, inputWidth: number,\n filterId: number, filterHeight: number, filterWidth: number, padTop: number,\n padRight: number, padBottom: number, padLeft: number, isSamePad: number,\n dilationHeight: number, dilationWidth: number, strideHeight: number,\n strideWidth: number, inputChannels: number, outputChannels: number,\n outId: number) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmConv2d = backend.wasm.cwrap(Conv2D, null /* void */, [\n 'number', // xId\n 'number', // batchSize\n 'number', // inputHeight\n 'number', // inputWidth\n 'number', // filterId\n 'number', // filterHeight\n 'number', // filterWidth\n 'number', // padTop\n 'number', // padRight\n 'number', // padBottom\n 'number', // padLeft\n 'number', // isSamePad\n 'number', // dilationHeight\n 'number', // dilationWidth\n 'number', // strideHeight\n 'number', // strideWidth\n 'number', // inputChannels\n 'number', // outputChannels\n 'number', // outId\n ]);\n}\n\nfunction conv2d(\n args: {inputs: Conv2DInputs, backend: BackendWasm, attrs: Conv2DAttrs}) {\n const {inputs, attrs, backend} = args;\n\n const {x, filter} = inputs;\n const xId = backend.dataIdMap.get(x.dataId).id;\n const filterId = backend.dataIdMap.get(filter.dataId).id;\n\n const {strides, dilations, pad, dimRoundingMode, dataFormat} = attrs;\n const $dataFormat = backend_util.convertConv2DDataFormat(dataFormat);\n const convInfo = backend_util.computeConv2DInfo(\n (x as Tensor4D).shape, (filter as Tensor4D).shape, strides, dilations,\n pad, dimRoundingMode, false, $dataFormat);\n\n const filterHeight = convInfo.filterHeight;\n const filterWidth = convInfo.filterWidth;\n const padTop = convInfo.padInfo.top;\n const padRight = convInfo.padInfo.right;\n const padBottom = convInfo.padInfo.bottom;\n const padLeft = convInfo.padInfo.left;\n const dilationHeight = convInfo.dilationHeight;\n const dilationWidth = convInfo.dilationWidth;\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n const inputChannels = convInfo.inChannels;\n const outputChannels = convInfo.outChannels;\n const isSamePad = convInfo.padInfo.type === 'SAME' ? 1 : 0;\n\n if (convInfo.dataFormat !== 'channelsLast') {\n throw new Error(\n `wasm backend Conv2D does not support dataFormat:'` +\n `${convInfo.dataFormat}'. Please use 'channelsLast'.`);\n }\n\n const out = backend.makeOutput(convInfo.outShape, 'float32');\n const outId = backend.dataIdMap.get(out.dataId).id;\n wasmConv2d(\n xId, x.shape[0], x.shape[1], x.shape[2], filterId, filterHeight,\n filterWidth, padTop, padRight, padBottom, padLeft, isSamePad,\n dilationHeight, dilationWidth, strideHeight, strideWidth, inputChannels,\n outputChannels, outId);\n return out;\n}\n\nexport const conv2DConfig: KernelConfig = {\n kernelName: Conv2D,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: conv2d as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, Conv2DBackpropInput, Conv2DBackpropInputAttrs, Conv2DBackpropInputInputs, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nlet wasmConv2DBackpropInput: (\n dyId: number, filterId: number, batchSize: number, filterHeight: number,\n filterWidth: number, inHeight: number, inWidth: number, inChannels: number,\n outHeight: number, outWidth: number, outChannels: number,\n strideHeight: number, strideWidth: number, topPad: number, leftPad: number,\n fltS0: number, fltS1: number, fltS2: number, xBatchStride: number,\n xRowStride: number, xColStride: number, xChannelStride: number,\n yBatchStride: number, yRowStride: number, yColStride: number,\n yChannelStride: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm): void {\n wasmConv2DBackpropInput = backend.wasm.cwrap(Conv2DBackpropInput, null, [\n 'number', // dyId\n 'number', // filterId\n 'number', // batchSize\n 'number', // filterHeight\n 'number', // filterWidth\n 'number', // inHeight\n 'number', // inWidth\n 'number', // inChannels\n 'number', // outHeight\n 'number', // outWidth\n 'number', // outChannels\n 'number', // strideHeight\n 'number', // strideWidth\n 'number', // topPad\n 'number', // leftPad\n 'number', // fltS0\n 'number', // fltS1\n 'number', // fltS2\n 'number', // xBatchStride\n 'number', // xRowStride\n 'number', // xColStride\n 'number', // xChannelStride\n 'number', // yBatchStride\n 'number', // yRowStride\n 'number', // yColStride\n 'number', // yChannelStride\n 'number', // outId\n ]);\n}\n\nfunction conv2DBackpropInput(args: {\n backend: BackendWasm,\n inputs: Conv2DBackpropInputInputs,\n attrs: Conv2DBackpropInputAttrs\n}): TensorInfo {\n const {backend, inputs, attrs} = args;\n const {dy, filter} = inputs;\n const {strides, pad, dataFormat, dimRoundingMode, inputShape} = attrs;\n\n const dilations = 1;\n\n const $dataFormat = backend_util.convertConv2DDataFormat(dataFormat);\n const convInfo = backend_util.computeConv2DInfo(\n inputShape, filter.shape as [number, number, number, number], strides,\n dilations, pad, dimRoundingMode, false /* depthwise */, $dataFormat);\n const {\n batchSize,\n filterHeight,\n filterWidth,\n inChannels,\n inHeight,\n inWidth,\n outChannels,\n outHeight,\n outWidth,\n strideHeight,\n strideWidth\n } = convInfo;\n\n const topPad = filterHeight - 1 - convInfo.padInfo.top;\n const leftPad = filterWidth - 1 - convInfo.padInfo.left;\n\n const isChannelsLast = convInfo.dataFormat === 'channelsLast';\n const dxStrides = util.computeStrides(convInfo.inShape);\n const dyStrides = util.computeStrides(dy.shape);\n const [fltS0, fltS1, fltS2] = util.computeStrides(filter.shape);\n const xBatchStride = dxStrides[0];\n const xRowStride = isChannelsLast ? dxStrides[1] : dxStrides[2];\n const xColStride = isChannelsLast ? dxStrides[2] : 1;\n const xChannelStride = isChannelsLast ? 1 : dxStrides[1];\n const yBatchStride = dyStrides[0];\n const yRowStride = isChannelsLast ? dyStrides[1] : dyStrides[2];\n const yColStride = isChannelsLast ? dyStrides[2] : 1;\n const yChannelStride = isChannelsLast ? 1 : dyStrides[1];\n\n const out = backend.makeOutput(convInfo.inShape, 'float32');\n const outId = backend.dataIdMap.get(out.dataId).id;\n const dyId = backend.dataIdMap.get(dy.dataId).id;\n const filterId = backend.dataIdMap.get(filter.dataId).id;\n\n wasmConv2DBackpropInput(\n dyId, filterId, batchSize, filterHeight, filterWidth, inHeight, inWidth,\n inChannels, outHeight, outWidth, outChannels, strideHeight, strideWidth,\n topPad, leftPad, fltS0, fltS1, fltS2, xBatchStride, xRowStride,\n xColStride, xChannelStride, yBatchStride, yRowStride, yColStride,\n yChannelStride, outId);\n return out;\n}\n\nexport const conv2DBackpropInputConfig: KernelConfig = {\n kernelName: Conv2DBackpropInput,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: conv2DBackpropInput as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Cos, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {createUnaryKernelConfig} from './unary_kernel';\n\nexport const cosConfig: KernelConfig = createUnaryKernelConfig(Cos);\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Cosh, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {createUnaryKernelConfig} from './unary_kernel';\n\nexport const coshConfig: KernelConfig = createUnaryKernelConfig(Cosh);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {CropAndResize, CropAndResizeAttrs, CropAndResizeInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {cast} from './Cast';\n\n// Must match enum in CropAndResize.cc\nenum InterpolationMethod {\n bilinear = 0,\n nearest = 1\n}\n\nlet wasmCropAndResize: (\n imagesId: number, boxesId: number, boxIndId: number, numBoxes: number,\n imagesShape: Uint8Array, cropHeight: number, cropWidth: number,\n method: number, extrapolationValue: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm): void {\n wasmCropAndResize = backend.wasm.cwrap(CropAndResize, null /*void*/, [\n 'number', // imagesId\n 'number', // boxesId\n 'number', // boxIndId\n 'number', // numBoxes\n 'array', // images shape\n 'number', // cropHeight\n 'number', // cropWidth\n 'number', // method\n 'number', // extrapolation value\n 'number' // out id\n ]);\n}\n\nfunction cropAndResize(args: {\n backend: BackendWasm,\n inputs: CropAndResizeInputs,\n attrs: CropAndResizeAttrs\n}): TensorInfo {\n const {backend, inputs, attrs} = args;\n const {method, extrapolationValue, cropSize} = attrs;\n const {image, boxes, boxInd} = inputs;\n\n const numBoxes = boxes.shape[0];\n\n const [cropHeight, cropWidth] = cropSize as [number, number];\n const outShape = [numBoxes, cropHeight, cropWidth, image.shape[3]];\n\n let imagesData = backend.dataIdMap.get(image.dataId);\n let castedData;\n if (image.dtype !== 'float32') {\n castedData = cast({backend, inputs: {x: image}, attrs: {dtype: 'float32'}});\n imagesData = backend.dataIdMap.get(castedData.dataId);\n }\n\n const imagesId = imagesData.id;\n const boxesId = backend.dataIdMap.get(boxes.dataId).id;\n const boxIndId = backend.dataIdMap.get(boxInd.dataId).id;\n\n const out = backend.makeOutput(outShape, 'float32');\n const outId = backend.dataIdMap.get(out.dataId).id;\n\n const imagesShapeBytes = new Uint8Array(new Int32Array(image.shape).buffer);\n\n wasmCropAndResize(\n imagesId, boxesId, boxIndId, numBoxes, imagesShapeBytes, cropHeight,\n cropWidth,\n InterpolationMethod[method as {} as keyof typeof InterpolationMethod],\n extrapolationValue, outId);\n\n if (castedData != null) {\n backend.disposeData(castedData.dataId);\n }\n\n return out;\n}\n\nexport const cropAndResizeConfig: KernelConfig = {\n kernelName: CropAndResize,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: cropAndResize as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, Cumprod, CumprodAttrs, CumprodInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {CppDType} from './types';\n\nimport {transpose} from './Transpose';\n\nlet wasmCumprod: (xId: number, exclusive: number, reverse: number,\n finalDim: number, outId: number, dtype: CppDType) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmCumprod = backend.wasm.cwrap(Cumprod, null /* void */, [\n 'number', // x_id\n 'number', // exclusive\n 'number', // reverse\n 'number', // final_dim\n 'number', // out_id\n 'number' // dtype\n ]);\n}\n\nexport function cumprod(\n args: {inputs: CumprodInputs, backend: BackendWasm, attrs: CumprodAttrs}):\nTensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {axis, exclusive, reverse} = attrs;\n const xRank = x.shape.length;\n\n util.assert(x.dtype === 'float32' || x.dtype === 'int32',\n () => `cumprod does not support ${x.dtype} tensors in the WASM backend`);\n // permute required axis to inner most axis\n const permutation = backend_util.getAxesPermutation([axis], xRank);\n let permutedX = x;\n if (permutation !== null) {\n permutedX = transpose({inputs: {x}, attrs: {perm: permutation}, backend});\n }\n const permutedAxis = backend_util.getInnerMostAxes(1, xRank)[0];\n backend_util.assertAxesAreInnerMostDims('cumprod', [permutedAxis], xRank);\n\n const permutedOut = backend.makeOutput(permutedX.shape, permutedX.dtype);\n const finalDim = permutedX.shape[permutedAxis];\n const permutedXId = backend.dataIdMap.get(permutedX.dataId).id;\n const permutedOutId = backend.dataIdMap.get(permutedOut.dataId).id;\n wasmCumprod(permutedXId, exclusive ? 1 : 0, reverse ? 1 : 0, finalDim,\n permutedOutId, CppDType[x.dtype]);\n\n // transpose data back if permuted\n let out = permutedOut;\n if (permutation !== null) {\n const undoPermutation = backend_util.getUndoAxesPermutation(permutation);\n out = transpose(\n {inputs: {x: permutedOut}, attrs: {perm: undoPermutation}, backend});\n backend.disposeData(permutedX.dataId);\n backend.disposeData(permutedOut.dataId);\n }\n return out;\n}\n\nexport const cumprodConfig: KernelConfig = {\n kernelName: Cumprod,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: cumprod as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, Cumsum, CumsumAttrs, CumsumInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {CppDType} from './types';\n\nimport {transpose} from './Transpose';\n\nlet wasmCumsum: (xId: number, exclusive: number, reverse: number,\n finalDim: number, outId: number, dtype: CppDType) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmCumsum = backend.wasm.cwrap(Cumsum, null /* void */, [\n 'number', // x_id\n 'number', // exclusive\n 'number', // reverse\n 'number', // final_dim\n 'number', // out_id\n 'number' // dtype\n ]);\n}\n\nexport function cumsum(\n args: {inputs: CumsumInputs, backend: BackendWasm, attrs: CumsumAttrs}):\nTensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {axis, exclusive, reverse} = attrs;\n const xRank = x.shape.length;\n\n util.assert(x.dtype === 'float32' || x.dtype === 'int32',\n () => `cumsum does not support ${x.dtype} tensors in the WASM backend`);\n // permute required axis to inner most axis\n const permutation = backend_util.getAxesPermutation([axis], xRank);\n let permutedX = x;\n if (permutation !== null) {\n permutedX = transpose({inputs: {x}, attrs: {perm: permutation}, backend});\n }\n const permutedAxis = backend_util.getInnerMostAxes(1, xRank)[0];\n backend_util.assertAxesAreInnerMostDims('cumsum', [permutedAxis], xRank);\n\n const permutedOut = backend.makeOutput(permutedX.shape, permutedX.dtype);\n const finalDim = permutedX.shape[permutedAxis];\n const permutedXId = backend.dataIdMap.get(permutedX.dataId).id;\n const permutedOutId = backend.dataIdMap.get(permutedOut.dataId).id;\n wasmCumsum(permutedXId, exclusive ? 1 : 0, reverse ? 1 : 0, finalDim,\n permutedOutId, CppDType[x.dtype]);\n\n // transpose data back if permuted\n let out = permutedOut;\n if (permutation !== null) {\n const undoPermutation = backend_util.getUndoAxesPermutation(permutation);\n out = transpose(\n {inputs: {x: permutedOut}, attrs: {perm: undoPermutation}, backend});\n backend.disposeData(permutedX.dataId);\n backend.disposeData(permutedOut.dataId);\n }\n return out;\n}\n\nexport const cumsumConfig: KernelConfig = {\n kernelName: Cumsum,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: cumsum as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DepthToSpace, DepthToSpaceAttrs, DepthToSpaceInputs, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nlet wasmDepthToSpace: (\n xId: number, blockSize: number, channelsLast: number, xStrides: Uint8Array,\n xStridesLength: number, outputShape: Uint8Array, outputStrides: Uint8Array,\n outSize: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm): void {\n wasmDepthToSpace = backend.wasm.cwrap(DepthToSpace, null /*void*/, [\n 'number', // xId\n 'number', // blockSize\n 'number', // channelsLast\n 'array', // xStrides\n 'number', // xStridesLength\n 'array', // outputShape\n 'array', // outputStrides\n 'number', // outSize\n 'number', // outId\n ]);\n}\n\nexport function depthToSpace(args: {\n backend: BackendWasm,\n inputs: DepthToSpaceInputs,\n attrs: DepthToSpaceAttrs\n}): TensorInfo {\n const {backend, inputs, attrs} = args;\n const {x} = inputs;\n const {blockSize, dataFormat} = attrs;\n\n const batchSize = x.shape[0];\n const inputHeight = (dataFormat === 'NHWC') ? x.shape[1] : x.shape[2];\n const inputWidth = (dataFormat === 'NHWC') ? x.shape[2] : x.shape[3];\n const inputDepth = (dataFormat === 'NHWC') ? x.shape[3] : x.shape[1];\n\n const outputHeight = inputHeight * blockSize;\n const outputWidth = inputWidth * blockSize;\n const outputDepth = inputDepth / (blockSize * blockSize);\n\n const outputShape = (dataFormat === 'NHWC') ?\n [batchSize, outputHeight, outputWidth, outputDepth] :\n [batchSize, outputDepth, outputHeight, outputWidth];\n\n const out = backend.makeOutput(outputShape, 'float32');\n\n const xData = backend.dataIdMap.get(x.dataId);\n const xId = xData.id;\n const xStridesBytes =\n new Uint8Array(new Int32Array(util.computeStrides(x.shape)).buffer);\n\n const outputShapeBytes = new Uint8Array(new Int32Array(outputShape).buffer);\n const outStridesBytes =\n new Uint8Array(new Int32Array(util.computeStrides(outputShape)).buffer);\n\n const outId = backend.dataIdMap.get(out.dataId).id;\n const channelsLast = dataFormat === 'NHWC' ? 1 : 0;\n wasmDepthToSpace(\n xId, blockSize, channelsLast, xStridesBytes, x.shape.length - 1,\n outputShapeBytes, outStridesBytes, outputShape.length, outId);\n\n return out;\n}\n\nexport const depthToSpaceConfig: KernelConfig = {\n kernelName: DepthToSpace,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: depthToSpace as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, DepthwiseConv2dNative, DepthwiseConv2dNativeAttrs, DepthwiseConv2dNativeInputs, KernelConfig, KernelFunc, Tensor4D} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nlet wasmDepthwiseConv2d: (\n xId: number, batchSize: number, inputHeight: number, inputWidth: number,\n filterId: number, filterHeight: number, filterWidth: number, padTop: number,\n padRight: number, padBottom: number, padLeft: number, isSamePad: number,\n dilationHeight: number, dilationWidth: number, strideHeight: number,\n strideWidth: number, inputChannels: number, outputChannels: number,\n outId: number) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmDepthwiseConv2d =\n backend.wasm.cwrap(DepthwiseConv2dNative, null /* void */, [\n 'number', // xId\n 'number', // batchSize\n 'number', // inputHeight\n 'number', // inputWidth\n 'number', // filterId\n 'number', // filterHeight\n 'number', // filterWidth\n 'number', // padTop\n 'number', // padRight\n 'number', // padBottom\n 'number', // padLeft\n 'number', // isSamePad\n 'number', // dilationHeight\n 'number', // dilationWidth\n 'number', // strideHeight\n 'number', // strideWidth\n 'number', // inputChannels\n 'number', // outputChannels\n 'number', // outId\n ]);\n}\n\nfunction depthwiseConv2d(args: {\n inputs: DepthwiseConv2dNativeInputs,\n backend: BackendWasm,\n attrs: DepthwiseConv2dNativeAttrs\n}) {\n const {inputs, attrs, backend} = args;\n\n const {x, filter} = inputs;\n const xId = backend.dataIdMap.get(x.dataId).id;\n const filterId = backend.dataIdMap.get(filter.dataId).id;\n\n const {strides, dilations, pad, dimRoundingMode} = attrs;\n\n const $dilations = dilations == null ? [1, 1] : dilations;\n\n const convInfo = backend_util.computeConv2DInfo(\n (x as Tensor4D).shape, (filter as Tensor4D).shape, strides,\n ($dilations as number | [number, number]), pad, dimRoundingMode,\n true /* depthwise */);\n\n const filterHeight = convInfo.filterHeight;\n const filterWidth = convInfo.filterWidth;\n const padTop = convInfo.padInfo.top;\n const padRight = convInfo.padInfo.right;\n const padBottom = convInfo.padInfo.bottom;\n const padLeft = convInfo.padInfo.left;\n const dilationHeight = convInfo.dilationHeight;\n const dilationWidth = convInfo.dilationWidth;\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n const inputChannels = convInfo.inChannels;\n const outputChannels = convInfo.outChannels;\n const isSamePad = convInfo.padInfo.type === 'SAME' ? 1 : 0;\n\n if (convInfo.dataFormat !== 'channelsLast') {\n throw new Error(\n `wasm backend DepthwiseConv2dNative does not support dataFormat:'` +\n `${convInfo.dataFormat}'. Please use 'channelsLast'.`);\n }\n\n const out = backend.makeOutput(convInfo.outShape, 'float32');\n const outId = backend.dataIdMap.get(out.dataId).id;\n wasmDepthwiseConv2d(\n xId, x.shape[0], x.shape[1], x.shape[2], filterId, filterHeight,\n filterWidth, padTop, padRight, padBottom, padLeft, isSamePad,\n dilationHeight, dilationWidth, strideHeight, strideWidth, inputChannels,\n outputChannels, outId);\n return out;\n}\n\nexport const depthwiseConv2dNativeConfig: KernelConfig = {\n kernelName: DepthwiseConv2dNative,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: depthwiseConv2d as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Elu, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {createUnaryKernelConfig} from './unary_kernel';\n\nexport const eluConfig: KernelConfig = createUnaryKernelConfig(Elu);\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Equal, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {createBinaryKernelConfig} from './binary_kernel';\n\nconst supportsFullBroadcast = false;\nexport const equalConfig: KernelConfig =\n createBinaryKernelConfig(Equal, supportsFullBroadcast, 'bool');\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Exp, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {createUnaryKernelConfig} from './unary_kernel';\n\nexport const expConfig: KernelConfig = createUnaryKernelConfig(Exp, 'float32');\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {ExpandDims, ExpandDimsAttrs, ExpandDimsInputs, KernelConfig, KernelFunc, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\nimport {reshape} from './Reshape';\n\nexport function expandDims(args: {\n inputs: ExpandDimsInputs,\n attrs: ExpandDimsAttrs,\n backend: BackendWasm\n}) {\n const {inputs, attrs, backend} = args;\n const {input} = inputs;\n const {dim} = attrs;\n\n const inputRank = input.shape.length;\n const newShape = input.shape.slice();\n let $dim = dim;\n if (dim < 0) {\n // Negative value is counted from the tail of rank.\n util.assert(\n -(inputRank + 1) <= dim,\n () => `Axis must be in the interval [${- (inputRank + 1)}, ${\n inputRank}]`);\n $dim = inputRank + dim + 1;\n }\n newShape.splice($dim, 0, 1);\n\n return reshape({inputs: {x: input}, backend, attrs: {shape: newShape}});\n}\n\nexport const expandDimsConfig: KernelConfig = {\n kernelName: ExpandDims,\n backendName: 'wasm',\n kernelFunc: expandDims as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc} from '@tensorflow/tfjs-core';\nimport {Fill, FillAttrs} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nexport function fill(args: {attrs: FillAttrs, backend: BackendWasm}) {\n const {attrs: {shape, value, dtype}, backend} = args;\n const out = backend.makeOutput(shape, dtype);\n const outVals = backend.typedArrayFromHeap(out);\n outVals.fill(value as number);\n return out;\n}\n\nexport const fillConfig: KernelConfig = {\n kernelName: Fill,\n backendName: 'wasm',\n kernelFunc: fill as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {FlipLeftRight, FlipLeftRightInputs, KernelConfig, KernelFunc, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nlet wasmFlipLeftRight: (\n xId: number, batch: number, imageHeight: number, imageWidth: number,\n numChannels: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmFlipLeftRight = backend.wasm.cwrap(FlipLeftRight, null /* void */, [\n 'number', // xId\n 'number', // batch\n 'number', // imageHeight\n 'number', // imageWidth\n 'number', // numChannels\n 'number', // outId\n ]);\n}\n\nexport function flipLeftRight(\n args: {inputs: FlipLeftRightInputs, backend: BackendWasm}): TensorInfo {\n const {inputs, backend} = args;\n const {image} = inputs;\n\n const out = backend.makeOutput(image.shape, image.dtype);\n const imageId = backend.dataIdMap.get(image.dataId).id;\n const outId = backend.dataIdMap.get(out.dataId).id;\n\n const [batch, imageHeight, imageWidth, numChannels] = image.shape;\n\n wasmFlipLeftRight(\n imageId, batch, imageHeight, imageWidth, numChannels, outId);\n return out;\n}\n\nexport const flipLeftRightConfig: KernelConfig = {\n kernelName: FlipLeftRight,\n backendName: 'wasm',\n kernelFunc: flipLeftRight as {} as KernelFunc,\n setupFunc: setup\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Floor, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {createUnaryKernelConfig} from './unary_kernel';\nexport const floorConfig: KernelConfig = createUnaryKernelConfig(Floor);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {FloorDiv, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {createBinaryKernelConfig} from './binary_kernel';\n\nconst supportsFullBroadcast = false;\nexport const floorDivConfig: KernelConfig =\n createBinaryKernelConfig(FloorDiv, supportsFullBroadcast);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {FusedBatchNorm, FusedBatchNormAttrs, FusedBatchNormInputs, KernelConfig, KernelFunc, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nlet wasmBatchNorm: (\n xId: number, meanId: number, varianceId: number, offsetId: number,\n scaleId: number, varianceEpsilon: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm): void {\n wasmBatchNorm = backend.wasm.cwrap(\n FusedBatchNorm, null /* void */,\n ['number', 'number', 'number', 'number', 'number', 'number', 'number']);\n}\n\nfunction fusedBatchNorm(args: {\n backend: BackendWasm,\n inputs: FusedBatchNormInputs,\n attrs: FusedBatchNormAttrs\n}): TensorInfo {\n const {backend, inputs, attrs} = args;\n const {varianceEpsilon} = attrs;\n const {x, mean, variance, offset, scale} = inputs;\n const xId = backend.dataIdMap.get(x.dataId).id;\n const meanId = backend.dataIdMap.get(mean.dataId).id;\n const varianceId = backend.dataIdMap.get(variance.dataId).id;\n const offsetId = offset != null ? backend.dataIdMap.get(offset.dataId).id : 0;\n const scaleId = scale != null ? backend.dataIdMap.get(scale.dataId).id : 0;\n\n const out = backend.makeOutput(x.shape, x.dtype);\n // Short-circuit zero-sized tensors.\n if (util.sizeFromShape(x.shape) === 0) {\n return out;\n }\n\n const outId = backend.dataIdMap.get(out.dataId).id;\n\n wasmBatchNorm(\n xId, meanId, varianceId, offsetId, scaleId, varianceEpsilon, outId);\n return out;\n}\n\nexport const fusedBatchNormConfig: KernelConfig = {\n kernelName: FusedBatchNorm,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: fusedBatchNorm as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, FusedConv2D, FusedConv2DAttrs, FusedConv2DInputs, KernelConfig, KernelFunc, Tensor4D} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {FusableActivation} from './types';\n\nlet wasmFusedConv2d:\n (xId: number, batchSize: number, inputHeight: number, inputWidth: number,\n filterId: number, filterHeight: number, filterWidth: number,\n biasId: number, padTop: number, padRight: number, padBottom: number,\n padLeft: number, isSamePad: number, dilationHeight: number,\n dilationWidth: number, strideHeight: number, strideWidth: number,\n inputChannels: number, outputChannels: number, activation: number,\n preluActivationWeightsId: number, leakyreluAlpha: number, outId: number) =>\n void;\n\nfunction setup(backend: BackendWasm) {\n wasmFusedConv2d = backend.wasm.cwrap(FusedConv2D, null /* void */, [\n 'number', // xId\n 'number', // batchSize\n 'number', // inputHeight\n 'number', // inputWidth\n 'number', // filterId\n 'number', // filterHeight\n 'number', // filterWidth\n 'number', // biasId\n 'number', // padTop\n 'number', // padRight\n 'number', // padBottom\n 'number', // padLeft\n 'number', // isSamePad\n 'number', // dilationHeight\n 'number', // dilationWidth\n 'number', // strideHeight\n 'number', // strideWidth\n 'number', // inputChannels\n 'number', // outputChannels\n 'number', // activation\n 'number', // preluActivationWeightsId\n 'number', // leakyreluAlpha\n 'number', // outId\n ]);\n}\n\nfunction fusedConv2d(args: {\n inputs: FusedConv2DInputs,\n backend: BackendWasm,\n attrs: FusedConv2DAttrs\n}) {\n const {inputs, attrs, backend} = args;\n const {x, filter, bias, preluActivationWeights} = inputs;\n const {\n strides,\n pad,\n dilations,\n dataFormat,\n dimRoundingMode,\n activation,\n leakyreluAlpha\n } = attrs;\n\n const convInfo = backend_util.computeConv2DInfo(\n (x as Tensor4D).shape, (filter as Tensor4D).shape, strides, dilations,\n pad, dimRoundingMode);\n\n const fusedActivation =\n FusableActivation[activation as {} as keyof typeof FusableActivation];\n if (fusedActivation == null) {\n throw new Error(\n `${activation} activation not yet supported for FusedConv2D ` +\n `in the wasm backend.`);\n }\n\n const xId = backend.dataIdMap.get(x.dataId).id;\n const filterId = backend.dataIdMap.get(filter.dataId).id;\n\n const outputChannels = convInfo.outChannels;\n\n let biasId = 0;\n if (bias != null) {\n const biasData = backend.dataIdMap.get(bias.dataId);\n if (biasData.shape.length !== 1) {\n throw new Error(\n `FusedConv2D only supports rank-1 bias but got ` +\n `rank ${biasData.shape.length}.`);\n }\n if (biasData.shape[0] !== outputChannels) {\n throw new Error(\n `FusedConv2D bias shape (${biasData.shape}) does not ` +\n `match the number of output channels (${outputChannels})`);\n }\n biasId = biasData.id;\n }\n\n const filterHeight = convInfo.filterHeight;\n const filterWidth = convInfo.filterWidth;\n const padTop = convInfo.padInfo.top;\n const padRight = convInfo.padInfo.right;\n const padBottom = convInfo.padInfo.bottom;\n const padLeft = convInfo.padInfo.left;\n const dilationHeight = convInfo.dilationHeight;\n const dilationWidth = convInfo.dilationWidth;\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n const inputChannels = convInfo.inChannels;\n const isSamePad = convInfo.padInfo.type === 'SAME' ? 1 : 0;\n const batchSize = convInfo.batchSize;\n const inHeight = convInfo.inHeight;\n const inWidth = convInfo.inWidth;\n\n if (dataFormat !== 'NHWC') {\n throw new Error(\n `wasm backend FusedConv2D does not support dataFormat:'` +\n `${dataFormat}'. Please use 'NHWC'.`);\n }\n\n const out = backend.makeOutput(convInfo.outShape, 'float32');\n const outId = backend.dataIdMap.get(out.dataId).id;\n const preluActivationWeightsId = preluActivationWeights == null ?\n 0 :\n backend.dataIdMap.get(preluActivationWeights.dataId).id;\n\n wasmFusedConv2d(\n xId, batchSize, inHeight, inWidth, filterId, filterHeight, filterWidth,\n biasId, padTop, padRight, padBottom, padLeft, isSamePad, dilationHeight,\n dilationWidth, strideHeight, strideWidth, inputChannels, outputChannels,\n fusedActivation, preluActivationWeightsId, leakyreluAlpha || 0, outId);\n\n return out;\n}\n\nexport const fusedConv2DConfig: KernelConfig = {\n kernelName: FusedConv2D,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: fusedConv2d as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, FusedDepthwiseConv2D, FusedDepthwiseConv2DAttrs, FusedDepthwiseConv2DInputs, KernelConfig, KernelFunc, Tensor4D} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {FusableActivation} from './types';\n\nlet wasmFusedDepthwiseConv2d:\n (xId: number, batchSize: number, inputHeight: number, inputWidth: number,\n filterId: number, filterHeight: number, filterWidth: number,\n biasId: number, padTop: number, padRight: number, padBottom: number,\n padLeft: number, isSamePad: number, dilationHeight: number,\n dilationWidth: number, strideHeight: number, strideWidth: number,\n inputChannels: number, outputChannels: number, activation: number,\n preluActivationWeightsId: number, leakyreluAlpha: number, outId: number) =>\n void;\n\nfunction setup(backend: BackendWasm) {\n wasmFusedDepthwiseConv2d =\n backend.wasm.cwrap(FusedDepthwiseConv2D, null /* void */, [\n 'number', // xId\n 'number', // batchSize\n 'number', // inputHeight\n 'number', // inputWidth\n 'number', // filterId\n 'number', // filterHeight\n 'number', // filterWidth\n 'number', // biasId\n 'number', // padTop\n 'number', // padRight\n 'number', // padBottom\n 'number', // padLeft\n 'number', // isSamePad\n 'number', // dilationHeight\n 'number', // dilationWidth\n 'number', // strideHeight\n 'number', // strideWidth\n 'number', // inputChannels\n 'number', // outputChannels\n 'number', // activation\n 'number', // preluActivationWeightsId\n 'number', // leakyreluAlpha\n 'number', // outId\n ]);\n}\n\nfunction fusedDepthwiseConv2d(args: {\n inputs: FusedDepthwiseConv2DInputs,\n backend: BackendWasm,\n attrs: FusedDepthwiseConv2DAttrs\n}) {\n const {inputs, attrs, backend} = args;\n const {x, filter, bias, preluActivationWeights} = inputs;\n const {\n strides,\n pad,\n dilations,\n dataFormat,\n dimRoundingMode,\n activation,\n leakyreluAlpha\n } = attrs;\n\n const convInfo = backend_util.computeConv2DInfo(\n (x as Tensor4D).shape, (filter as Tensor4D).shape, strides, dilations,\n pad, dimRoundingMode, true /* depthwise */);\n\n const fusedActivation =\n FusableActivation[activation as {} as keyof typeof FusableActivation];\n if (fusedActivation == null) {\n throw new Error(\n `${activation} activation not yet supported for FusedDepthwiseConv2D ` +\n `in the wasm backend.`);\n }\n\n const xId = backend.dataIdMap.get(x.dataId).id;\n const filterId = backend.dataIdMap.get(filter.dataId).id;\n\n const outputChannels = convInfo.outChannels;\n\n let biasId = 0;\n if (bias != null) {\n const biasData = backend.dataIdMap.get(bias.dataId);\n if (biasData.shape.length !== 1) {\n throw new Error(\n `FusedDepthwiseConv2D only supports rank-1 bias but got ` +\n `rank ${biasData.shape.length}.`);\n }\n if (biasData.shape[0] !== outputChannels) {\n throw new Error(\n `FusedDepthwiseConv2D bias shape (${biasData.shape}) does not ` +\n `match the number of output channels (${outputChannels})`);\n }\n biasId = biasData.id;\n }\n\n const filterHeight = convInfo.filterHeight;\n const filterWidth = convInfo.filterWidth;\n const padTop = convInfo.padInfo.top;\n const padRight = convInfo.padInfo.right;\n const padBottom = convInfo.padInfo.bottom;\n const padLeft = convInfo.padInfo.left;\n const dilationHeight = convInfo.dilationHeight;\n const dilationWidth = convInfo.dilationWidth;\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n const inputChannels = convInfo.inChannels;\n const isSamePad = convInfo.padInfo.type === 'SAME' ? 1 : 0;\n const batchSize = convInfo.batchSize;\n const inHeight = convInfo.inHeight;\n const inWidth = convInfo.inWidth;\n\n if (dataFormat !== 'NHWC') {\n throw new Error(\n `wasm backend FusedDepthwiseConv2D does not support dataFormat:'` +\n `${dataFormat}'. Please use 'NHWC'.`);\n }\n\n const out = backend.makeOutput(convInfo.outShape, 'float32');\n const outId = backend.dataIdMap.get(out.dataId).id;\n const preluActivationWeightsId = preluActivationWeights == null ?\n 0 :\n backend.dataIdMap.get(preluActivationWeights.dataId).id;\n\n wasmFusedDepthwiseConv2d(\n xId, batchSize, inHeight, inWidth, filterId, filterHeight, filterWidth,\n biasId, padTop, padRight, padBottom, padLeft, isSamePad, dilationHeight,\n dilationWidth, strideHeight, strideWidth, inputChannels, outputChannels,\n fusedActivation, preluActivationWeightsId, leakyreluAlpha || 0, outId);\n\n return out;\n}\n\nexport const fusedDepthwiseConv2DConfig: KernelConfig = {\n kernelName: FusedDepthwiseConv2D,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: fusedDepthwiseConv2d as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {gather_util, GatherNd, GatherNdInputs, KernelConfig, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {CppDType} from './types';\n\nlet wasmGatherNd: (\n xId: number, dtype: CppDType, indicesId: number, numSlices: number,\n sliceRank: number, sliceSize: number, strides: Uint8Array, outId: number) =>\n void;\n\nfunction setup(backend: BackendWasm): void {\n wasmGatherNd = backend.wasm.cwrap(GatherNd, null /*void*/, [\n 'number', // xId\n 'number', // dtype\n 'number', // indicesId\n 'number', // numSlices\n 'number', // sliceRank\n 'number', // sliceSize\n 'array', // strides\n 'number' // outId\n ]);\n}\n\nfunction gatherNd(args: {backend: BackendWasm, inputs: GatherNdInputs}):\n TensorInfo {\n const {backend, inputs} = args;\n const {params, indices} = inputs;\n\n const [resultShape, numSlices, sliceSize, strides] =\n gather_util.prepareAndValidate(params, indices);\n\n const out = backend.makeOutput(resultShape, params.dtype);\n if (numSlices === 0) {\n return out;\n }\n\n const indicesShape = indices.shape;\n const sliceRank = indicesShape[indicesShape.length - 1];\n\n const xData = backend.dataIdMap.get(params.dataId);\n const xId = xData.id;\n const indicesData = backend.dataIdMap.get(indices.dataId);\n const indicesId = indicesData.id;\n\n const stridesBytes = new Uint8Array(new Int32Array(strides).buffer);\n\n const outId = backend.dataIdMap.get(out.dataId).id;\n wasmGatherNd(\n xId, CppDType[params.dtype], indicesId, numSlices, sliceRank, sliceSize,\n stridesBytes, outId);\n\n return out;\n}\n\nexport const gatherNdConfig: KernelConfig = {\n kernelName: GatherNd,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: gatherNd\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, GatherV2, GatherV2Attrs, GatherV2Inputs, KernelConfig, KernelFunc, Tensor, TensorInfo, TypedArray, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {reshape} from './Reshape';\nimport {CppDType} from './types';\n\nlet wasmGather: (\n xId: number, dtype: CppDType, xStrides: Uint8Array, stridesSize: number,\n indicesId: number, batchSize: number, outStrides: Uint8Array,\n outId: number) => void;\n\nfunction setup(backend: BackendWasm): void {\n wasmGather = backend.wasm.cwrap('Gather', null /*void*/, [\n 'number', // xId\n 'number', // dtype\n 'array', // xStrides\n 'number', // stridesSize\n 'number', // indicesId\n 'number', // batchSize\n 'array', // outStrides\n 'number' // outId\n ]);\n}\n\nfunction gatherV2(\n args: {backend: BackendWasm, inputs: GatherV2Inputs, attrs: GatherV2Attrs}):\n TensorInfo {\n const {backend, inputs, attrs} = args;\n const {x, indices} = inputs;\n const {axis, batchDims} = attrs;\n\n // Throw error when any index is out of bound.\n const parsedAxis = util.parseAxisParam(axis, x.shape)[0];\n const indicesVals = backend.readSync(indices.dataId) as TypedArray;\n const axisDim = x.shape[parsedAxis];\n for (let i = 0; i < indicesVals.length; ++i) {\n const index = indicesVals[i];\n util.assert(\n index <= axisDim - 1 && index >= 0,\n () =>\n `GatherV2: the index value ${index} is not in [0, ${axisDim - 1}]`);\n }\n\n const shapeInfo = backend_util.segment_util.collectGatherOpShapeInfo(\n x as Tensor, indices as Tensor, parsedAxis, batchDims);\n\n const flattenX = reshape({\n inputs: {x},\n attrs: {\n shape: [\n shapeInfo.batchSize, shapeInfo.outerSize, shapeInfo.dimSize,\n shapeInfo.sliceSize\n ]\n },\n backend\n });\n const indicesSize = util.sizeFromShape(indices.shape);\n const flattenIndex = reshape({\n inputs: {x: indices},\n attrs: {shape: [shapeInfo.batchSize, indicesSize / shapeInfo.batchSize]},\n backend\n });\n const flattenOutputShape = [\n shapeInfo.batchSize, shapeInfo.outerSize, indicesSize / shapeInfo.batchSize,\n shapeInfo.sliceSize\n ];\n\n const out = backend.makeOutput(flattenOutputShape, x.dtype);\n if (util.sizeFromShape(x.shape) === 0) {\n return out;\n }\n const stridesSize = flattenX.shape.length - 1;\n\n const xData = backend.dataIdMap.get(flattenX.dataId);\n const xId = xData.id;\n\n const indicesData = backend.dataIdMap.get(flattenIndex.dataId);\n const indicesId = indicesData.id;\n\n const outId = backend.dataIdMap.get(out.dataId).id;\n\n const xStridesBytes = new Uint8Array(\n new Int32Array(util.computeStrides(flattenX.shape)).buffer);\n const outStridesBytes = new Uint8Array(\n new Int32Array(util.computeStrides(flattenOutputShape)).buffer);\n\n wasmGather(\n xId, CppDType[x.dtype], xStridesBytes, stridesSize, indicesId,\n shapeInfo.batchSize, outStridesBytes, outId);\n\n backend.disposeData(flattenX.dataId);\n backend.disposeData(flattenIndex.dataId);\n\n // reshape\n out.shape = shapeInfo.outputShape;\n return out;\n}\n\nexport const gatherV2Config: KernelConfig = {\n kernelName: GatherV2,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: gatherV2 as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Greater, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {createBinaryKernelConfig} from './binary_kernel';\n\nconst supportsFullBroadcast = false;\nexport const greaterConfig: KernelConfig =\n createBinaryKernelConfig(Greater, supportsFullBroadcast, 'bool');\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {GreaterEqual, KernelConfig} from '@tensorflow/tfjs-core';\n\nimport {createBinaryKernelConfig} from './binary_kernel';\n\nconst supportsFullBroadcast = false;\nexport const greaterEqualConfig: KernelConfig =\n createBinaryKernelConfig(GreaterEqual, supportsFullBroadcast, 'bool');\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, LeakyRelu, LeakyReluAttrs, LeakyReluInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {CppDType} from './types';\n\nlet wasmFunc: (\n xId: number, dtype: number, leakyreluAlpha: number, outId: number) => void;\n\nfunction setupFunc(backend: BackendWasm): void {\n wasmFunc = backend.wasm.cwrap(LeakyRelu, null /* void */, [\n 'number', // x_id\n 'number', // dtype\n 'number', // leakyrelu_alpha\n 'number', // out_id\n ]);\n}\n\nexport function leakyRelu(\n args:\n {inputs: LeakyReluInputs, attrs: LeakyReluAttrs, backend: BackendWasm}):\n TensorInfo {\n const {inputs: {x}, attrs: {alpha}, backend} = args;\n\n const xId = backend.dataIdMap.get(x.dataId).id;\n // According to TF API, LeakyRelu returns float32 when input is either float32\n // or int32.\n const out = backend.makeOutput(x.shape, 'float32');\n\n if (util.sizeFromShape(x.shape) !== 0) {\n const outId = backend.dataIdMap.get(out.dataId).id;\n wasmFunc(xId, CppDType[x.dtype], alpha, outId);\n }\n\n return out;\n}\n\nexport const leakyReluConfig: KernelConfig = {\n kernelName: LeakyRelu,\n backendName: 'wasm',\n setupFunc,\n kernelFunc: leakyRelu as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, Less} from '@tensorflow/tfjs-core';\n\nimport {createBinaryKernelConfig} from './binary_kernel';\nconst supportsFullBroadcast = false;\nexport const lessConfig: KernelConfig =\n createBinaryKernelConfig(Less, supportsFullBroadcast, 'bool');\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, LessEqual} from '@tensorflow/tfjs-core';\n\nimport {createBinaryKernelConfig} from './binary_kernel';\nconst supportsFullBroadcast = false;\nexport const lessEqualConfig: KernelConfig =\n createBinaryKernelConfig(LessEqual, supportsFullBroadcast, 'bool');\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, Log} from '@tensorflow/tfjs-core';\n\nimport {createUnaryKernelConfig} from './unary_kernel';\nexport const logConfig: KernelConfig = createUnaryKernelConfig(Log);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, LogicalAnd} from '@tensorflow/tfjs-core';\n\nimport {createBinaryKernelConfig} from './binary_kernel';\nconst supportsFullBroadcast = false;\nexport const logicalAndConfig: KernelConfig =\n createBinaryKernelConfig(LogicalAnd, supportsFullBroadcast, 'bool');\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, LogicalNot} from '@tensorflow/tfjs-core';\n\nimport {createUnaryKernelConfig} from './unary_kernel';\n\nexport const logicalNotConfig: KernelConfig =\n createUnaryKernelConfig(LogicalNot);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, LogicalOr} from '@tensorflow/tfjs-core';\n\nimport {createBinaryKernelConfig} from './binary_kernel';\nconst supportsFullBroadcast = false;\nexport const logicalOrConfig: KernelConfig =\n createBinaryKernelConfig(LogicalOr, supportsFullBroadcast, 'bool');\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, LogicalXor} from '@tensorflow/tfjs-core';\n\nimport {createBinaryKernelConfig} from './binary_kernel';\nconst supportsFullBroadcast = false;\nexport const logicalXorConfig: KernelConfig =\n createBinaryKernelConfig(LogicalXor, supportsFullBroadcast, 'bool');\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, Max, MaxAttrs, MaxInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {permuteAxesAndTranspose} from './kernel_utils';\nimport {CppDType} from './types';\n\nlet wasmMax: (xId: number, dtype: number, reduceSize: number, outId: number) =>\n void;\n\nfunction setup(backend: BackendWasm): void {\n wasmMax = backend.wasm.cwrap(Max, null /*void*/, [\n 'number', // x_id\n 'number', // dtype\n 'number', // reduce_size\n 'number', // out_id\n ]);\n}\n\nfunction max(args: {backend: BackendWasm, inputs: MaxInputs, attrs: MaxAttrs}):\n TensorInfo {\n const {backend, inputs, attrs} = args;\n const {reductionIndices: axis, keepDims} = attrs;\n const {x} = inputs;\n const xId = backend.dataIdMap.get(x.dataId).id;\n let inputId = xId;\n let input = x;\n\n const {transposed, axes, originalAxes, inputWasTransposed} =\n permuteAxesAndTranspose(x, axis, backend);\n\n if (inputWasTransposed) {\n const transposedId = backend.dataIdMap.get(transposed.dataId).id;\n input = transposed;\n inputId = transposedId;\n }\n\n const inputRank = input.shape.length;\n backend_util.assertAxesAreInnerMostDims('max', axes, inputRank);\n const [outShape, reduceShape] =\n backend_util.computeOutAndReduceShapes(input.shape, axes);\n const reduceSize = util.sizeFromShape(reduceShape);\n\n const out = backend.makeOutput(outShape, x.dtype);\n if (util.sizeFromShape(input.shape) !== 0) {\n const outId = backend.dataIdMap.get(out.dataId).id;\n wasmMax(inputId, CppDType[x.dtype], reduceSize, outId);\n }\n\n if (inputWasTransposed) {\n // dispose of the transposed tensor.\n backend.disposeData(transposed.dataId);\n }\n\n if (keepDims) {\n // reshape\n const newShape = backend_util.expandShapeToKeepDim(out.shape, originalAxes);\n out.shape = newShape;\n }\n\n return out;\n}\n\nexport const maxConfig: KernelConfig = {\n kernelName: Max,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: max as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, Maximum} from '@tensorflow/tfjs-core';\n\nimport {createBinaryKernelConfig} from './binary_kernel';\nconst supportsFullBroadcast = false;\nexport const maximumConfig: KernelConfig =\n createBinaryKernelConfig(Maximum, supportsFullBroadcast);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, MaxPool, MaxPoolAttrs, MaxPoolInputs, Tensor4D, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nlet wasmMaxPool: (\n xId: number, batchSize: number, inputHeight: number, inputWidth: number,\n filterHeight: number, filterWidth: number, padTop: number, padRight: number,\n padBottom: number, padLeft: number, dilationHeight: number,\n dilationWidth: number, strideHeight: number, strideWidth: number,\n inputChannels: number, outputChannels: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmMaxPool = backend.wasm.cwrap(MaxPool, null /* void */, [\n 'number', // xId\n 'number', // batchSize\n 'number', // inputHeight\n 'number', // inputWidth\n 'number', // filterHeight\n 'number', // filterWidth\n 'number', // padTop\n 'number', // padRight\n 'number', // padBottom\n 'number', // padLeft\n 'number', // dilationHeight\n 'number', // dilationWidth\n 'number', // strideHeight\n 'number', // strideWidth\n 'number', // inputChannels\n 'number', // outputChannels\n 'number', // outId\n ]);\n}\n\nfunction maxPool(\n args: {inputs: MaxPoolInputs, backend: BackendWasm, attrs: MaxPoolAttrs}) {\n const {inputs, attrs, backend} = args;\n\n const x = inputs.x as Tensor4D;\n const xId = backend.dataIdMap.get(x.dataId).id;\n\n // TF API supports int32 input. CPU and WebGL backend also support int32\n // input. WASM backend doesn't support it because it uses xnnpack which only\n // supports float32.\n //\n // Add the following assert only for the WASM backend instead of at core op\n // level.\n //\n // TODO: add support for int32 input.\n util.assert(\n x.dtype === 'float32',\n () =>\n `Error in MaxPool: only float32 input is supported. Got ${x.dtype}.`);\n\n const {filterSize, strides, pad, dimRoundingMode} = attrs;\n const convInfo = backend_util.computePool2DInfo(\n x.shape, filterSize, strides, 1 /* dilations */, pad, dimRoundingMode);\n\n const filterHeight = convInfo.filterHeight;\n const filterWidth = convInfo.filterWidth;\n const padTop = convInfo.padInfo.top;\n const padRight = convInfo.padInfo.right;\n const padBottom = convInfo.padInfo.bottom;\n const padLeft = convInfo.padInfo.left;\n const dilationHeight = convInfo.dilationHeight;\n const dilationWidth = convInfo.dilationWidth;\n const strideHeight = convInfo.strideHeight;\n const strideWidth = convInfo.strideWidth;\n const inputChannels = convInfo.inChannels;\n const outputChannels = convInfo.outChannels;\n\n if (convInfo.dataFormat !== 'channelsLast') {\n throw new Error(\n `wasm backend does not support dataFormat:'` +\n `${convInfo.dataFormat}'. Please use 'channelsLast'.`);\n }\n\n const out = backend.makeOutput(convInfo.outShape, 'float32');\n const outId = backend.dataIdMap.get(out.dataId).id;\n\n wasmMaxPool(\n xId, x.shape[0], x.shape[1], x.shape[2], filterHeight, filterWidth,\n padTop, padRight, padBottom, padLeft, dilationHeight, dilationWidth,\n strideHeight, strideWidth, inputChannels, outputChannels, outId);\n return out;\n}\n\nexport const maxPoolConfig: KernelConfig = {\n kernelName: MaxPool,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: maxPool as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, Mean, MeanAttrs, MeanInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\nimport {cast} from './Cast';\n\nimport {permuteAxesAndTranspose} from './kernel_utils';\n\nlet wasmMean: (xId: number, reduceSize: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm): void {\n wasmMean =\n backend.wasm.cwrap(Mean, null /*void*/, ['number, number, number']);\n}\n\nexport function mean(\n args: {backend: BackendWasm, inputs: MeanInputs, attrs: MeanAttrs}):\n TensorInfo {\n const {backend, inputs, attrs} = args;\n const {axis, keepDims} = attrs;\n const {x} = inputs;\n const xId = backend.dataIdMap.get(x.dataId).id;\n let inputId = xId;\n let input = x;\n\n const {transposed, axes, originalAxes, inputWasTransposed} =\n permuteAxesAndTranspose(x, axis, backend);\n\n let reductionAxes = axes;\n if (inputWasTransposed) {\n const transposedId = backend.dataIdMap.get(transposed.dataId).id;\n if (transposedId !== xId) {\n // transpose was not a no-op. We will need to dispose of this\n // once we are done.\n input = transposed;\n inputId = transposedId;\n reductionAxes = backend_util.getInnerMostAxes(\n reductionAxes.length, input.shape.length);\n }\n }\n\n backend_util.assertAxesAreInnerMostDims(\n 'mean', reductionAxes, input.shape.length);\n const [outShape, reduceShape] =\n backend_util.computeOutAndReduceShapes(input.shape, reductionAxes);\n const reduceSize = util.sizeFromShape(reduceShape);\n let castedInput = input;\n if (input.dtype !== 'float32') {\n castedInput =\n cast({backend, inputs: {x: input}, attrs: {dtype: 'float32'}});\n inputId = backend.dataIdMap.get(castedInput.dataId).id;\n }\n\n const out = backend.makeOutput(outShape, 'float32');\n if (util.sizeFromShape(input.shape) !== 0) {\n const outId = backend.dataIdMap.get(out.dataId).id;\n wasmMean(inputId, reduceSize, outId);\n }\n\n if (inputWasTransposed) {\n // dispose of the transposed tensor.\n backend.disposeData(transposed.dataId);\n }\n\n if (keepDims) {\n // reshape\n const newShape = backend_util.expandShapeToKeepDim(out.shape, originalAxes);\n out.shape = newShape;\n }\n\n if (input.dtype !== 'float32') {\n backend.disposeData(castedInput.dataId);\n }\n\n return out;\n}\n\nexport const meanConfig: KernelConfig = {\n kernelName: Mean,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: mean as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, Min, MinAttrs, MinInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {permuteAxesAndTranspose} from './kernel_utils';\nimport {CppDType} from './types';\n\nlet wasmMin: (xId: number, dtype: number, reduceSize: number, outId: number) =>\n void;\n\nfunction setup(backend: BackendWasm): void {\n wasmMin = backend.wasm.cwrap(Min, null /*void*/, [\n 'number', // x_id\n 'number', // dtype\n 'number', // reduce_size\n 'number', // out_id\n ]);\n}\n\nfunction min(args: {backend: BackendWasm, inputs: MinInputs, attrs: MinAttrs}):\n TensorInfo {\n const {backend, inputs, attrs} = args;\n const {axis, keepDims} = attrs;\n const {x} = inputs;\n const xId = backend.dataIdMap.get(x.dataId).id;\n let inputId = xId;\n let input = x;\n\n const {transposed, axes, originalAxes, inputWasTransposed} =\n permuteAxesAndTranspose(x, axis, backend);\n\n if (inputWasTransposed) {\n const transposedId = backend.dataIdMap.get(transposed.dataId).id;\n if (transposedId !== xId) {\n // transpose was not a no-op. We will need to dispose of this\n // once we are done.\n input = transposed;\n inputId = transposedId;\n }\n }\n\n const inputRank = input.shape.length;\n\n backend_util.assertAxesAreInnerMostDims('min', axes, inputRank);\n const [outShape, reduceShape] =\n backend_util.computeOutAndReduceShapes(input.shape, axes);\n const reduceSize = util.sizeFromShape(reduceShape);\n\n const out = backend.makeOutput(outShape, input.dtype);\n if (util.sizeFromShape(input.shape) !== 0) {\n const outId = backend.dataIdMap.get(out.dataId).id;\n wasmMin(inputId, CppDType[x.dtype], reduceSize, outId);\n }\n\n if (inputWasTransposed) {\n // dispose of the transposed tensor.\n backend.disposeData(transposed.dataId);\n }\n\n if (keepDims) {\n // reshape\n const newShape = backend_util.expandShapeToKeepDim(out.shape, originalAxes);\n out.shape = newShape;\n }\n\n return out;\n}\n\nexport const minConfig: KernelConfig = {\n kernelName: Min,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: min as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, Minimum} from '@tensorflow/tfjs-core';\n\nimport {createBinaryKernelConfig} from './binary_kernel';\nconst supportsFullBroadcast = false;\nexport const minimumConfig: KernelConfig =\n createBinaryKernelConfig(Minimum, supportsFullBroadcast);\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, MirrorPad, MirrorPadAttrs, MirrorPadInputs} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {CppDType} from './types';\n\n// Must match enum in MirrorPad.cc\nenum MirrorPaddingMode {\n reflect = 0,\n symmetric = 1\n}\n\nlet wasmMirrorPad: (\n xId: number, xShapeBytes: Uint8Array, xShapeLength: number, xDtype: number,\n prePaddingsBytes: Uint8Array, postPaddingsBytes: Uint8Array, mode: number,\n outId: number) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmMirrorPad = backend.wasm.cwrap(MirrorPad, null /* void */, [\n 'number', // xId\n 'array', // x.shape\n 'number', // x.shape.length\n 'number', // x.dtype\n 'array', // pre-paddings\n 'array', // post-paddings\n 'number', // mode\n 'number', // outId\n ]);\n}\n\nfunction mirrorPad(args: {\n inputs: MirrorPadInputs,\n backend: BackendWasm,\n attrs: MirrorPadAttrs\n}) {\n const {inputs: {x}, backend, attrs: {paddings, mode}} = args;\n\n const outShape = paddings.map(\n (p, i) => p[0] /* beforePad */ + x.shape[i] + p[1] /* afterPad */);\n const xId = backend.dataIdMap.get(x.dataId).id;\n const out = backend.makeOutput(outShape, x.dtype);\n const outId = backend.dataIdMap.get(out.dataId).id;\n const xShapeBytes = new Uint8Array(new Int32Array(x.shape).buffer);\n\n const prePaddingsFlat = paddings.map(padTuple => padTuple[0]);\n const postPaddingsFlat = paddings.map(padTuple => padTuple[1]);\n const prePaddingsBytes =\n new Uint8Array(new Int32Array(prePaddingsFlat).buffer);\n const postPaddingsBytes =\n new Uint8Array(new Int32Array(postPaddingsFlat).buffer);\n\n wasmMirrorPad(\n xId, xShapeBytes, x.shape.length, CppDType[x.dtype], prePaddingsBytes,\n postPaddingsBytes, MirrorPaddingMode[mode], outId);\n return out;\n}\n\nexport const mirrorPadConfig: KernelConfig = {\n kernelName: MirrorPad,\n backendName: 'wasm',\n kernelFunc: mirrorPad as {} as KernelFunc,\n setupFunc: setup\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Multiply} from '@tensorflow/tfjs-core';\n\nimport {createBinaryKernelConfig} from './binary_kernel';\n\nconst supportsFullBroadcast = true;\nexport const multiplyConfig: KernelConfig =\n createBinaryKernelConfig(Multiply, supportsFullBroadcast);\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, Neg} from '@tensorflow/tfjs-core';\n\nimport {createUnaryKernelConfig} from './unary_kernel';\nexport const negConfig: KernelConfig = createUnaryKernelConfig(Neg);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {BackendWasm} from '../backend_wasm';\n\n// Analogous to `struct Result` in `non_max_suppression_impl.h`.\ninterface Result {\n pSelectedIndices: number;\n selectedSize: number;\n pSelectedScores: number;\n pValidOutputs: number;\n}\n/**\n * Parse the result of the c++ method, which has the shape equivalent to\n * `Result`.\n */\nexport function parseResultStruct(\n backend: BackendWasm, resOffset: number): Result {\n const result = new Int32Array(backend.wasm.HEAPU8.buffer, resOffset, 4);\n const pSelectedIndices = result[0];\n const selectedSize = result[1];\n const pSelectedScores = result[2];\n const pValidOutputs = result[3];\n // Since the result was allocated on the heap, we have to delete it.\n backend.wasm._free(resOffset);\n return {pSelectedIndices, selectedSize, pSelectedScores, pValidOutputs};\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, NonMaxSuppressionV3, NonMaxSuppressionV3Attrs, NonMaxSuppressionV3Inputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {parseResultStruct} from './NonMaxSuppression_util';\n\nlet wasmFunc: (\n boxesId: number, scoresId: number, maxOutputSize: number,\n iouThreshold: number, scoreThreshold: number) => number;\n\nfunction setup(backend: BackendWasm): void {\n wasmFunc = backend.wasm.cwrap(\n NonMaxSuppressionV3,\n 'number', // Result*\n [\n 'number', // boxesId\n 'number', // scoresId\n 'number', // maxOutputSize\n 'number', // iouThreshold\n 'number', // scoreThreshold\n ]);\n}\n\nfunction kernelFunc(args: {\n backend: BackendWasm,\n inputs: NonMaxSuppressionV3Inputs,\n attrs: NonMaxSuppressionV3Attrs\n}): TensorInfo {\n const {backend, inputs, attrs} = args;\n const {iouThreshold, maxOutputSize, scoreThreshold} = attrs;\n const {boxes, scores} = inputs;\n\n const boxesId = backend.dataIdMap.get(boxes.dataId).id;\n const scoresId = backend.dataIdMap.get(scores.dataId).id;\n\n const resOffset =\n wasmFunc(boxesId, scoresId, maxOutputSize, iouThreshold, scoreThreshold);\n\n const {pSelectedIndices, selectedSize, pSelectedScores, pValidOutputs} =\n parseResultStruct(backend, resOffset);\n\n // Since we are not using scores for V3, we have to delete it from the heap.\n backend.wasm._free(pSelectedScores);\n backend.wasm._free(pValidOutputs);\n\n const selectedIndicesTensor =\n backend.makeOutput([selectedSize], 'int32', pSelectedIndices);\n\n return selectedIndicesTensor;\n}\n\nexport const nonMaxSuppressionV3Config: KernelConfig = {\n kernelName: NonMaxSuppressionV3,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: kernelFunc as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, NonMaxSuppressionV4, NonMaxSuppressionV4Attrs, NonMaxSuppressionV4Inputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {parseResultStruct} from './NonMaxSuppression_util';\n\nlet wasmFunc: (\n boxesId: number, scoresId: number, maxOutputSize: number,\n iouThreshold: number, scoreThreshold: number,\n padToMaxOutputSize: boolean) => number;\n\nfunction setup(backend: BackendWasm): void {\n wasmFunc = backend.wasm.cwrap(\n NonMaxSuppressionV4,\n 'number', // Result*\n [\n 'number', // boxesId\n 'number', // scoresId\n 'number', // maxOutputSize\n 'number', // iouThreshold\n 'number', // scoreThreshold\n 'bool', // padToMaxOutputSize\n ]);\n}\n\nfunction nonMaxSuppressionV4(args: {\n backend: BackendWasm,\n inputs: NonMaxSuppressionV4Inputs,\n attrs: NonMaxSuppressionV4Attrs\n}): TensorInfo[] {\n const {backend, inputs, attrs} = args;\n const {iouThreshold, maxOutputSize, scoreThreshold, padToMaxOutputSize} =\n attrs;\n const {boxes, scores} = inputs;\n\n const boxesId = backend.dataIdMap.get(boxes.dataId).id;\n const scoresId = backend.dataIdMap.get(scores.dataId).id;\n\n const resOffset = wasmFunc(\n boxesId, scoresId, maxOutputSize, iouThreshold, scoreThreshold,\n padToMaxOutputSize);\n\n const {pSelectedIndices, selectedSize, pSelectedScores, pValidOutputs} =\n parseResultStruct(backend, resOffset);\n\n // Since we are not using scores for V4, we have to delete it from the heap.\n backend.wasm._free(pSelectedScores);\n\n const selectedIndicesTensor =\n backend.makeOutput([selectedSize], 'int32', pSelectedIndices);\n\n const validOutputsTensor = backend.makeOutput([], 'int32', pValidOutputs);\n\n return [selectedIndicesTensor, validOutputsTensor];\n}\n\nexport const nonMaxSuppressionV4Config: KernelConfig = {\n kernelName: NonMaxSuppressionV4,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: nonMaxSuppressionV4 as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, NonMaxSuppressionV5, NonMaxSuppressionV5Attrs, NonMaxSuppressionV5Inputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {parseResultStruct} from './NonMaxSuppression_util';\n\nlet wasmFunc:\n (boxesId: number, scoresId: number, maxOutputSize: number,\n iouThreshold: number, scoreThreshold: number, softNmsSigma: number) =>\n number;\n\nfunction setup(backend: BackendWasm): void {\n wasmFunc = backend.wasm.cwrap(\n NonMaxSuppressionV5,\n 'number', // Result*\n [\n 'number', // boxesId\n 'number', // scoresId\n 'number', // maxOutputSize\n 'number', // iouThreshold\n 'number', // scoreThreshold\n 'number', // softNmsSigma\n ]);\n}\n\nfunction kernelFunc(args: {\n backend: BackendWasm,\n inputs: NonMaxSuppressionV5Inputs,\n attrs: NonMaxSuppressionV5Attrs\n}): TensorInfo[] {\n const {backend, inputs, attrs} = args;\n const {iouThreshold, maxOutputSize, scoreThreshold, softNmsSigma} = attrs;\n const {boxes, scores} = inputs;\n\n const boxesId = backend.dataIdMap.get(boxes.dataId).id;\n const scoresId = backend.dataIdMap.get(scores.dataId).id;\n\n const resOffset = wasmFunc(\n boxesId, scoresId, maxOutputSize, iouThreshold, scoreThreshold,\n softNmsSigma);\n\n const {pSelectedIndices, selectedSize, pSelectedScores, pValidOutputs} =\n parseResultStruct(backend, resOffset);\n\n // Since we are not using validOutputs for V5, we have to delete it from the\n // heap.\n backend.wasm._free(pValidOutputs);\n\n const selectedIndicesTensor =\n backend.makeOutput([selectedSize], 'int32', pSelectedIndices);\n const selectedScoresTensor =\n backend.makeOutput([selectedSize], 'float32', pSelectedScores);\n\n return [selectedIndicesTensor, selectedScoresTensor];\n}\n\nexport const nonMaxSuppressionV5Config: KernelConfig = {\n kernelName: NonMaxSuppressionV5,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: kernelFunc as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, NotEqual} from '@tensorflow/tfjs-core';\n\nimport {createBinaryKernelConfig} from './binary_kernel';\nconst supportsFullBroadcast = false;\nexport const notEqualConfig: KernelConfig =\n createBinaryKernelConfig(NotEqual, supportsFullBroadcast, 'bool');\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, OneHot, OneHotAttrs, OneHotInputs} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nlet wasmOneHot: (\n indicesId: number, depth: number, onValue: number, offValue: number,\n outId: number) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmOneHot = backend.wasm.cwrap(OneHot, null /* void */, [\n 'number', // indices_id\n 'number', // depth,\n 'number', // onValue\n 'number', // offValue\n 'number' // out_id\n ]);\n}\n\nfunction oneHot(\n args: {inputs: OneHotInputs, attrs: OneHotAttrs, backend: BackendWasm}) {\n const {inputs, backend, attrs} = args;\n const {indices} = inputs;\n const {dtype, depth, onValue, offValue} = attrs;\n\n const out = backend.makeOutput([...indices.shape, depth], dtype);\n const outId = backend.dataIdMap.get(out.dataId).id;\n\n const indicesData = backend.dataIdMap.get(indices.dataId);\n const indicesId = indicesData.id;\n\n wasmOneHot(indicesId, depth, onValue, offValue, outId);\n\n return out;\n}\n\nexport const oneHotConfig: KernelConfig = {\n kernelName: OneHot,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: oneHot as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, OnesLike, OnesLikeInputs} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nfunction onesLike(args: {inputs: OnesLikeInputs, backend: BackendWasm}) {\n const {inputs: {x}, backend} = args;\n const out = backend.makeOutput(x.shape, x.dtype);\n const outVals = backend.typedArrayFromHeap(out);\n outVals.fill(1);\n return out;\n}\n\nexport const onesLikeConfig: KernelConfig = {\n kernelName: OnesLike,\n backendName: 'wasm',\n kernelFunc: onesLike as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Pack, PackAttrs, PackInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\nimport {BackendWasm} from '../backend_wasm';\n\nimport {concat} from './Concat';\nimport {expandDims} from './ExpandDims';\n\nexport function pack(\n args: {inputs: PackInputs, backend: BackendWasm, attrs: PackAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {axis} = attrs;\n\n if (inputs.length === 1) {\n return expandDims(\n {inputs: {input: inputs[0]}, backend, attrs: {dim: axis}});\n }\n\n const shape = inputs[0].shape;\n const dtype = inputs[0].dtype;\n\n inputs.forEach(t => {\n util.assertShapesMatch(\n shape, t.shape,\n 'All tensors passed to stack must have matching shapes');\n util.assert(\n dtype === t.dtype,\n () => 'All tensors passed to stack must have matching dtypes');\n });\n\n const intermediateTensorInfos: TensorInfo[] = [];\n const expandedTensors = inputs.map(t => {\n const expandedT =\n expandDims({inputs: {input: t}, backend, attrs: {dim: axis}});\n intermediateTensorInfos.push(expandedT);\n return expandedT;\n });\n\n const result = concat({inputs: expandedTensors, backend, attrs: {axis}});\n\n intermediateTensorInfos.forEach(t => backend.disposeData(t.dataId));\n\n return result;\n}\n\nexport const packConfig: KernelConfig = {\n kernelName: Pack,\n backendName: 'wasm',\n kernelFunc: pack as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, PadV2, PadV2Attrs, PadV2Inputs, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {fill} from './Fill';\n\nimport {CppDType} from './types';\n\nlet wasmPadV2: (\n xId: number, xShapeBytes: Uint8Array, xShapeLength: number, xDtype: number,\n prePaddingsBytes: Uint8Array, postPaddingsBytes: Uint8Array,\n constantValue: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmPadV2 = backend.wasm.cwrap(PadV2, null /* void */, [\n 'number', // xId\n 'array', // x.shape\n 'number', // x.shape.length\n 'number', // x.dtype\n 'array', // pre-paddings\n 'array', // post-paddings\n 'number', // constantValue\n 'number', // outId\n ]);\n}\n\nfunction pad(\n args: {inputs: PadV2Inputs, backend: BackendWasm, attrs: PadV2Attrs}) {\n const {inputs: {x}, backend, attrs: {paddings, constantValue}} = args;\n\n const outShape = paddings.map(\n (p, i) => p[0] /* beforePad */ + x.shape[i] + p[1] /* afterPad */);\n\n if (util.sizeFromShape(x.shape) === 0) {\n // Short-circuit the computation, since x doesn't have value, only\n // the shape is used to compute output shape to pad.\n return fill({\n backend,\n attrs: {shape: outShape, value: constantValue, dtype: x.dtype}\n });\n }\n\n const xId = backend.dataIdMap.get(x.dataId).id;\n const out = backend.makeOutput(outShape, x.dtype);\n const outTensorData = backend.dataIdMap.get(out.dataId);\n const outId = outTensorData.id;\n\n const xShapeBytes = new Uint8Array(new Int32Array(x.shape).buffer);\n\n const prePaddingsFlat = paddings.map(padTuple => padTuple[0]);\n const postPaddingsFlat = paddings.map(padTuple => padTuple[1]);\n const prePaddingsBytes =\n new Uint8Array(new Int32Array(prePaddingsFlat).buffer);\n const postPaddingsBytes =\n new Uint8Array(new Int32Array(postPaddingsFlat).buffer);\n\n wasmPadV2(\n xId, xShapeBytes, x.shape.length, CppDType[x.dtype], prePaddingsBytes,\n postPaddingsBytes, constantValue, outId);\n return out;\n}\n\nexport const padV2Config: KernelConfig = {\n kernelName: PadV2,\n backendName: 'wasm',\n kernelFunc: pad as {} as KernelFunc,\n setupFunc: setup\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, Pow} from '@tensorflow/tfjs-core';\n\nimport {createBinaryKernelConfig} from './binary_kernel';\nconst supportsFullBroadcast = false;\nexport const powConfig: KernelConfig =\n createBinaryKernelConfig(Pow, supportsFullBroadcast);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Prelu, PreluInputs} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {cast} from './Cast';\n\nlet wasmPrelu: (xId: number, weightsId: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmPrelu = backend.wasm.cwrap(Prelu, null /* void */, [\n 'number', // x_id\n 'number', // weights_id\n 'number' // out_id\n ]);\n}\n\nfunction prelu(args: {inputs: PreluInputs, backend: BackendWasm}) {\n const {inputs, backend} = args;\n const {x, alpha} = inputs;\n const xId = backend.dataIdMap.get(x.dataId).id;\n const weightsId = backend.dataIdMap.get(alpha.dataId).id;\n\n let inputId = xId;\n const input = x;\n let castedInput = input;\n if (input.dtype !== 'float32') {\n castedInput = cast({backend, inputs: {x}, attrs: {dtype: 'float32'}});\n inputId = backend.dataIdMap.get(castedInput.dataId).id;\n }\n\n const out = backend.makeOutput(x.shape, 'float32');\n const outId = backend.dataIdMap.get(out.dataId).id;\n wasmPrelu(inputId, weightsId, outId);\n\n if (input.dtype !== 'float32') {\n backend.disposeData(castedInput.dataId);\n }\n return out;\n}\n\nexport const preluConfig: KernelConfig = {\n kernelName: Prelu,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: prelu as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, Prod, ProdAttrs, ProdInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {permuteAxesAndTranspose} from './kernel_utils';\n\nimport {CppDType} from './types';\n\nlet wasmProd: (\n xId: number, reduceSize: number,\n dtype: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm): void {\n wasmProd = backend.wasm.cwrap(Prod, null /*void*/, [\n 'number',\n 'number',\n 'number',\n 'number'\n ]);\n}\n\nfunction prod(args: {\n backend: BackendWasm,\n inputs: ProdInputs,\n attrs: ProdAttrs\n}): TensorInfo {\n const {backend, inputs, attrs} = args;\n const {axis, keepDims} = attrs;\n const {x} = inputs;\n const xId = backend.dataIdMap.get(x.dataId).id;\n let inputId = xId;\n let input = x;\n\n const {transposed, axes, originalAxes, inputWasTransposed} =\n permuteAxesAndTranspose(x, axis, backend);\n\n let reductionAxes = axes;\n if (inputWasTransposed) {\n const transposedId = backend.dataIdMap.get(transposed.dataId).id;\n if (transposedId !== xId) {\n // transpose was not a no-op. We will need to dispose of this\n // once we are done.\n input = transposed;\n inputId = transposedId;\n reductionAxes = backend_util.getInnerMostAxes(\n reductionAxes.length, input.shape.length);\n }\n }\n\n backend_util.assertAxesAreInnerMostDims(\n 'prod', reductionAxes, input.shape.length);\n const [outShape, reduceShape] =\n backend_util.computeOutAndReduceShapes(input.shape, reductionAxes);\n const reduceSize = util.sizeFromShape(reduceShape);\n\n const out = backend.makeOutput(outShape, input.dtype);\n if (util.sizeFromShape(input.shape) !== 0) {\n const outId = backend.dataIdMap.get(out.dataId).id;\n wasmProd(inputId, reduceSize, CppDType[out.dtype], outId);\n }\n\n if (inputWasTransposed) {\n // dispose of the transposed tensor.\n backend.disposeData(transposed.dataId);\n }\n\n if (keepDims) {\n // reshape\n const newShape = backend_util.expandShapeToKeepDim(out.shape, originalAxes);\n out.shape = newShape;\n }\n\n return out;\n}\n\nexport const prodConfig: KernelConfig = {\n kernelName: Prod,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: prod as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Range, RangeAttrs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\nimport {rangeImplCPU} from '../kernel_utils/shared';\n\nexport const range =\n (args: {backend: BackendWasm, attrs: RangeAttrs}): TensorInfo => {\n const {backend, attrs} = args;\n const {start, stop, step, dtype} = attrs;\n const values = rangeImplCPU(start, stop, step, dtype);\n\n const out = backend.makeOutput([values.length], dtype);\n const outVals = backend.typedArrayFromHeap(out);\n outVals.set(values);\n return out;\n };\n\nexport const rangeConfig: KernelConfig = {\n kernelName: Range,\n backendName: 'wasm',\n kernelFunc: range as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, RealDiv} from '@tensorflow/tfjs-core';\n\nimport {createBinaryKernelConfig} from './binary_kernel';\n\nconst supportsFullBroadcast = true;\nexport const realDivConfig: KernelConfig =\n createBinaryKernelConfig(RealDiv, supportsFullBroadcast);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, Relu} from '@tensorflow/tfjs-core';\n\nimport {createUnaryKernelConfig} from './unary_kernel';\nexport const reluConfig: KernelConfig = createUnaryKernelConfig(Relu);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, Relu6} from '@tensorflow/tfjs-core';\n\nimport {createUnaryKernelConfig} from './unary_kernel';\nexport const relu6Config: KernelConfig = createUnaryKernelConfig(Relu6);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, ResizeBilinear, ResizeBilinearAttrs, ResizeBilinearInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {cast} from './Cast';\n\nlet wasmResizeBilinear: (\n xId: number, batch: number, oldHeight: number, oldWidth: number,\n numChannels: number, newHeight: number, newWidth: number,\n alignCorners: number, halfPixelCenters: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm): void {\n wasmResizeBilinear = backend.wasm.cwrap(ResizeBilinear, null /*void*/, [\n 'number', // xId\n 'number', // batch\n 'number', // oldHeight\n 'number', // oldWidth\n 'number', // numChannels\n 'number', // newHeight\n 'number', // newWidth\n 'number', // alignCorners\n 'number', // halfPixelCenters\n 'number' // outId\n ]);\n}\n\nfunction resizeBilinear(args: {\n backend: BackendWasm,\n inputs: ResizeBilinearInputs,\n attrs: ResizeBilinearAttrs\n}): TensorInfo {\n const {backend, inputs, attrs} = args;\n\n const {images} = inputs;\n const {alignCorners, halfPixelCenters, size} = attrs;\n const [newHeight, newWidth] = size;\n\n const [batch, oldHeight, oldWidth, numChannels] = images.shape;\n const outShape = [batch, newHeight, newWidth, numChannels];\n\n let xData = backend.dataIdMap.get(images.dataId);\n let castedData;\n if (xData.dtype !== 'float32') {\n castedData =\n cast({backend, inputs: {x: images}, attrs: {dtype: 'float32'}});\n xData = backend.dataIdMap.get(castedData.dataId);\n }\n const xId = xData.id;\n\n const out = backend.makeOutput(outShape, 'float32');\n if (util.sizeFromShape(images.shape) === 0) {\n return out;\n }\n const outId = backend.dataIdMap.get(out.dataId).id;\n\n wasmResizeBilinear(\n xId, batch, oldHeight, oldWidth, numChannels, newHeight, newWidth,\n alignCorners ? 1 : 0, halfPixelCenters ? 1 : 0, outId);\n\n if (castedData != null) {\n backend.disposeData(castedData.dataId);\n }\n\n return out;\n}\n\nexport const resizeBilinearConfig: KernelConfig = {\n kernelName: ResizeBilinear,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: resizeBilinear as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the 'License');\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an 'AS IS' BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {\n KernelConfig,\n KernelFunc,\n ResizeNearestNeighbor,\n ResizeNearestNeighborAttrs,\n ResizeNearestNeighborInputs,\n TensorInfo,\n util,\n} from '@tensorflow/tfjs-core';\n\nimport { BackendWasm } from '../backend_wasm';\n\nimport { cast } from './Cast';\n\nlet wasmResizeNearestNeighbor: (\n xId: number,\n batch: number,\n oldHeight: number,\n oldWidth: number,\n numChannels: number,\n newHeight: number,\n newWidth: number,\n alignCorners: number,\n halfPixelCenters: number,\n outId: number\n) => void;\n\nfunction setup(backend: BackendWasm): void {\n wasmResizeNearestNeighbor = backend.wasm.cwrap(\n ResizeNearestNeighbor,\n null /*void*/,\n [\n 'number', // xId\n 'number', // batch\n 'number', // oldHeight\n 'number', // oldWidth\n 'number', // numChannels\n 'number', // newHeight\n 'number', // newWidth\n 'number', // alignCorners\n 'number', // halfPixelCenters\n 'number', // outId\n ]\n );\n}\n\nfunction resizeNearestNeighbor(args: {\n backend: BackendWasm;\n inputs: ResizeNearestNeighborInputs;\n attrs: ResizeNearestNeighborAttrs;\n}): TensorInfo {\n const { backend, inputs, attrs } = args;\n const { images } = inputs;\n const { alignCorners, halfPixelCenters, size } = attrs;\n\n const [newHeight, newWidth] = size;\n\n const [batch, oldHeight, oldWidth, numChannels] = images.shape;\n const outShape = [batch, newHeight, newWidth, numChannels];\n\n const out = backend.makeOutput(outShape, 'float32');\n if (util.sizeFromShape(images.shape) === 0) {\n return out;\n }\n\n let xData = backend.dataIdMap.get(images.dataId);\n let castedData;\n if (xData.dtype !== 'float32') {\n castedData = cast({\n backend,\n inputs: { x: images },\n attrs: { dtype: 'float32' },\n });\n xData = backend.dataIdMap.get(castedData.dataId);\n }\n\n const xId = xData.id;\n const outId = backend.dataIdMap.get(out.dataId).id;\n\n wasmResizeNearestNeighbor(\n xId,\n batch,\n oldHeight,\n oldWidth,\n numChannels,\n newHeight,\n newWidth,\n alignCorners ? 1 : 0,\n halfPixelCenters ? 1 : 0,\n outId\n );\n\n if (castedData != null) {\n backend.disposeData(castedData.dataId);\n }\n\n return out;\n}\n\nexport const resizeNearestNeighborConfig: KernelConfig = {\n kernelName: ResizeNearestNeighbor,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: resizeNearestNeighbor as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Reverse, ReverseAttrs, ReverseInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {identity} from './Identity';\nimport {reshape} from './Reshape';\n\nlet wasmReverse: (\n xId: number, axes: Uint8Array, axesLength: number, outShape: Uint8Array,\n outShapeLength: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmReverse = backend.wasm.cwrap(Reverse, null, [\n 'number', // x_id\n 'array', // axes\n 'number', // axes_length\n 'array', // out_shape\n 'number', // out_shape_length\n 'number' // out_id\n ]);\n}\n\nexport function reverse(\n args: {inputs: ReverseInputs, backend: BackendWasm, attrs: ReverseAttrs}):\n TensorInfo {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {dims} = attrs;\n\n const axes = util.parseAxisParam(dims, x.shape);\n\n if (x.shape.length === 0) {\n return identity({inputs: {x}, backend});\n }\n\n const out = backend.makeOutput(x.shape, x.dtype);\n const xId = backend.dataIdMap.get(x.dataId).id;\n const outId = backend.dataIdMap.get(out.dataId).id;\n\n const axesBytes = new Uint8Array(new Int32Array(axes).buffer);\n const outShapeBytes = new Uint8Array(new Int32Array(x.shape).buffer);\n\n wasmReverse(\n xId, axesBytes, axes.length, outShapeBytes, x.shape.length, outId);\n\n const reshaped =\n reshape({inputs: {x: out}, attrs: {shape: x.shape}, backend});\n\n backend.disposeData(out.dataId);\n return reshaped;\n}\n\nexport const reverseConfig: KernelConfig = {\n kernelName: Reverse,\n backendName: 'wasm',\n kernelFunc: reverse as {} as KernelFunc,\n setupFunc: setup\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, RotateWithOffset, RotateWithOffsetAttrs, RotateWithOffsetInputs, TensorInfo} from '@tensorflow/tfjs-core';\nimport {backend_util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nlet wasmRotate: (\n xId: number, batch: number, imageHeight: number, imageWidth: number,\n numChannels: number, radians: number, centerX: number, centerY: number,\n fillBytes: Uint8Array, fillLength: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmRotate = backend.wasm.cwrap(RotateWithOffset, null /* void */, [\n 'number', // xId\n 'number', // batch\n 'number', // imageHeight\n 'number', // imageWidth\n 'number', // numChannels\n 'number', // radians\n 'number', // centerX\n 'number', // centerY\n 'array', // fillBytes\n 'number', // fillLength\n 'number', // outId\n ]);\n}\n\nexport function rotateWithOffset(args: {\n inputs: RotateWithOffsetInputs,\n backend: BackendWasm,\n attrs: RotateWithOffsetAttrs\n}): TensorInfo {\n const {inputs, backend, attrs} = args;\n const {image} = inputs;\n const {radians, fillValue, center} = attrs;\n\n const out = backend.makeOutput(image.shape, image.dtype);\n const imageId = backend.dataIdMap.get(image.dataId).id;\n const outId = backend.dataIdMap.get(out.dataId).id;\n\n const [batch, imageHeight, imageWidth, numChannels] = image.shape;\n\n const [centerX, centerY] =\n backend_util.getImageCenter(center, imageHeight, imageWidth);\n\n const fillIsBlack = fillValue === 0;\n const fullOpacityValue = 255;\n\n const fillValues = typeof fillValue === 'number' ?\n [fillValue, fillValue, fillValue, fillIsBlack ? 0 : fullOpacityValue] :\n [...fillValue, fullOpacityValue];\n const fillBytes = new Uint8Array(new Int32Array(fillValues).buffer);\n\n wasmRotate(\n imageId, batch, imageHeight, imageWidth, numChannels, radians, centerX,\n centerY, fillBytes, fillValues.length, outId);\n return out;\n}\n\nexport const rotateWithOffsetConfig: KernelConfig = {\n kernelName: RotateWithOffset,\n backendName: 'wasm',\n kernelFunc: rotateWithOffset as {} as KernelFunc,\n setupFunc: setup\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, Round} from '@tensorflow/tfjs-core';\n\nimport {createUnaryKernelConfig} from './unary_kernel';\n\nexport const roundConfig: KernelConfig = createUnaryKernelConfig(Round);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, Rsqrt} from '@tensorflow/tfjs-core';\n\nimport {createUnaryKernelConfig} from './unary_kernel';\nexport const rsqrtConfig: KernelConfig = createUnaryKernelConfig(Rsqrt);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, scatter_util, ScatterNd, ScatterNdAttrs, ScatterNdInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {CppDType} from './types';\n\nlet wasmScatterNd: (\n indicesId: number, updatesId: number, dtype: CppDType, sliceRank: number,\n numUpdates: number, sliceSize: number, strides: Uint8Array,\n outputSize: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm): void {\n wasmScatterNd = backend.wasm.cwrap(ScatterNd, null /*void*/, [\n 'number', // indicesId\n 'number', // updatesId\n 'number', // dtype\n 'number', // sliceRank\n 'number', // numUpdates\n 'number', // sliceSize\n 'array', // strides\n 'number', // outputSize\n 'number' // outId\n ]);\n}\n\nfunction scatterNd(\n args:\n {backend: BackendWasm, inputs: ScatterNdInputs, attrs: ScatterNdAttrs}):\n TensorInfo {\n const {backend, inputs, attrs} = args;\n const {indices, updates} = inputs;\n const {shape} = attrs;\n\n const out = backend.makeOutput(shape, updates.dtype);\n if (util.sizeFromShape(shape) === 0) {\n return out;\n }\n\n const {sliceRank, numUpdates, sliceSize, strides, outputSize} =\n scatter_util.calculateShapes(updates, indices, shape);\n\n const indicesData = backend.dataIdMap.get(indices.dataId);\n const indicesId = indicesData.id;\n\n const updatesData = backend.dataIdMap.get(updates.dataId);\n const updatesId = updatesData.id;\n\n const stridesBytes = new Uint8Array(new Int32Array(strides).buffer);\n\n const outId = backend.dataIdMap.get(out.dataId).id;\n wasmScatterNd(\n indicesId, updatesId, CppDType[updates.dtype], sliceRank, numUpdates,\n sliceSize, stridesBytes, outputSize, outId);\n\n return out;\n}\n\nexport const scatterNdConfig: KernelConfig = {\n kernelName: ScatterNd,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: scatterNd as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Select, SelectInputs, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nlet wasmSelect: (\n conditionId: number, tId: number, eId: number, offset: number,\n outId: number) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmSelect = backend.wasm.cwrap('SelectV2', null, [\n 'number', // conditionId\n 'number', // tId\n 'number', // eId\n 'number', // offset\n 'number', // outId\n ]);\n}\n\nfunction select(args: {inputs: SelectInputs, backend: BackendWasm}) {\n const {inputs, backend} = args;\n const {condition, t, e} = inputs;\n\n const conditionId = backend.dataIdMap.get(condition.dataId).id;\n const tId = backend.dataIdMap.get(t.dataId).id;\n const eId = backend.dataIdMap.get(e.dataId).id;\n const out = backend.makeOutput(t.shape, t.dtype);\n const outId = backend.dataIdMap.get(out.dataId).id;\n\n const cRank = condition.shape.length;\n const tRank = t.shape.length;\n\n const offset = cRank === 0 || cRank > 1 || tRank === 1 ?\n 1 :\n util.sizeFromShape(t.shape.slice(1));\n\n wasmSelect(conditionId, tId, eId, offset, outId);\n return out;\n}\n\nexport const selectConfig: KernelConfig = {\n kernelName: Select,\n backendName: 'wasm',\n kernelFunc: select as {} as KernelFunc,\n setupFunc: setup\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Sigmoid, SigmoidInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nlet wasmFunc: (xId: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm): void {\n wasmFunc = backend.wasm.cwrap(Sigmoid, null /* void */, ['number', 'number']);\n}\n\nfunction sigmoid(args: {backend: BackendWasm, inputs: SigmoidInputs}):\n TensorInfo {\n const {backend, inputs: {x}} = args;\n const xId = backend.dataIdMap.get(x.dataId).id;\n const out = backend.makeOutput(x.shape, x.dtype);\n const outId = backend.dataIdMap.get(out.dataId).id;\n\n // Short-circuit zero-sized tensors.\n if (util.sizeFromShape(out.shape) === 0) {\n return out;\n }\n\n wasmFunc(xId, outId);\n return out;\n}\n\nexport const sigmoidConfig: KernelConfig = {\n kernelName: 'Sigmoid',\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: sigmoid as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, Sin} from '@tensorflow/tfjs-core';\n\nimport {createUnaryKernelConfig} from './unary_kernel';\nexport const sinConfig: KernelConfig = createUnaryKernelConfig(Sin);\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Softmax, SoftmaxAttrs, SoftmaxInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nlet wasmFunc: (xId: number, outId: number, channels: number, batch: number) =>\n void;\n\nfunction setup(backend: BackendWasm): void {\n wasmFunc = backend.wasm.cwrap(Softmax, null /* void */, [\n 'number', // xId\n 'number', // outId\n 'number', // channels\n 'number' // batch\n ]);\n}\n\nfunction softmax(\n args: {backend: BackendWasm, inputs: SoftmaxInputs, attrs: SoftmaxAttrs}):\n TensorInfo {\n const {backend, inputs: {logits}, attrs: {dim}} = args;\n const xId = backend.dataIdMap.get(logits.dataId).id;\n const out = backend.makeOutput(logits.shape, logits.dtype);\n const outId = backend.dataIdMap.get(out.dataId).id;\n\n const channels = logits.shape[dim];\n const batch = util.sizeFromShape(logits.shape) / channels;\n\n // Short-circuit zero-sized tensors.\n if (util.sizeFromShape(out.shape) === 0) {\n return out;\n }\n\n wasmFunc(xId, outId, channels, batch);\n return out;\n}\n\nexport const softmaxConfig: KernelConfig = {\n kernelName: Softmax,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: softmax as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, ReshapeAttrs, ReshapeInputs, SpaceToBatchND, SpaceToBatchNDAttrs, SpaceToBatchNDInputs, TensorInfo, TransposeAttrs, TransposeInputs, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {padV2Config} from './PadV2';\nimport {reshape} from './Reshape';\nimport {transpose} from './Transpose';\n\nfunction spaceToBatchND(args: {\n inputs: SpaceToBatchNDInputs,\n backend: BackendWasm,\n attrs: SpaceToBatchNDAttrs\n}) {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const {blockShape, paddings} = attrs;\n\n const prod = util.sizeFromShape(blockShape);\n\n const completePaddings: Array<[number, number]> = [[0, 0]];\n completePaddings.push(...(paddings as Array<[number, number]>));\n\n for (let i = 1 + blockShape.length; i < x.shape.length; ++i) {\n completePaddings.push([0, 0]);\n }\n\n const paddedX = padV2Config.kernelFunc({\n inputs: {x},\n backend,\n attrs: {paddings: completePaddings, constantValue: 0}\n }) as TensorInfo;\n\n const reshapedPaddedShape =\n backend_util.getReshaped(paddedX.shape, blockShape, prod, false);\n\n const permutedReshapedPaddedPermutation = backend_util.getPermuted(\n reshapedPaddedShape.length, blockShape.length, false);\n\n const flattenShape =\n backend_util.getReshapedPermuted(paddedX.shape, blockShape, prod, false);\n\n const reshapeInputs: ReshapeInputs = {x: paddedX};\n const reshapeAttrs: ReshapeAttrs = {shape: reshapedPaddedShape};\n const paddedXReshaped =\n reshape({inputs: reshapeInputs, backend, attrs: reshapeAttrs});\n\n const transposeInputs: TransposeInputs = {x: paddedXReshaped};\n const transposeAttrs:\n TransposeAttrs = {perm: permutedReshapedPaddedPermutation};\n const paddedXT =\n transpose({inputs: transposeInputs, backend, attrs: transposeAttrs});\n\n const resultReshapeInputs: ReshapeInputs = {x: paddedXT};\n const resultReshapeAttrs: ReshapeAttrs = {shape: flattenShape};\n const result = reshape(\n {inputs: resultReshapeInputs, backend, attrs: resultReshapeAttrs});\n\n backend.disposeData(paddedX.dataId);\n backend.disposeData(paddedXReshaped.dataId);\n backend.disposeData(paddedXT.dataId);\n\n return result;\n}\n\nexport const spaceToBatchNDConfig: KernelConfig = {\n kernelName: SpaceToBatchND,\n backendName: 'wasm',\n kernelFunc: spaceToBatchND as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, SparseFillEmptyRows, SparseFillEmptyRowsInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\nimport {slice} from './Slice';\n\nimport {CppDType} from './types';\n\nlet wasmSparseFillEmptyRows: (\n indicesId: number, valuesId: number, valuesDType: number,\n indicesCount: number, denseRows: number, rank: number,\n defaultValueId: number, outputIndicesId: number, outputValuesId: number,\n emptyRowIndicatorId: number, reverseIndexMapId: number,\n exceptionValuesId: number) => number;\n\nexport function setup(backend: BackendWasm): void {\n wasmSparseFillEmptyRows =\n backend.wasm.cwrap('SparseFillEmptyRows', 'number', [\n 'number', // indicesId\n 'number', // valuesId\n 'number', // valuesDType\n 'number', // indicesCount\n 'number', // denseRows\n 'number', // rank\n 'number', // defaultValueId\n 'number', // outputIndicesId\n 'number', // outputValuesId\n 'number', // emptyRowIndicatorId\n 'number', // reverseIndexMapId\n 'number', // exceptionValuesId\n ]);\n}\n\nexport function sparseFillEmptyRows(args: {\n backend: BackendWasm,\n inputs: SparseFillEmptyRowsInputs,\n}): [TensorInfo, TensorInfo, TensorInfo, TensorInfo] {\n const {backend, inputs} = args;\n const {indices, values, denseShape, defaultValue} = inputs;\n\n const indicesCount = indices.shape[0];\n const rank = indices.shape[1];\n const denseRows = backend.readSync(denseShape.dataId)[0] as number;\n\n // Set output size to maximum possible and resize later (actual result\n // might be smaller).\n const maxOutputIndicesShape = [indicesCount + denseRows, rank];\n\n const indicesId = backend.dataIdMap.get(indices.dataId).id;\n const valuesId = backend.dataIdMap.get(values.dataId).id;\n const defaultValueId = backend.dataIdMap.get(defaultValue.dataId).id;\n\n const outputIndices =\n backend.makeOutput(maxOutputIndicesShape, indices.dtype);\n const outputIndicesId = backend.dataIdMap.get(outputIndices.dataId).id;\n\n const outputValues =\n backend.makeOutput(maxOutputIndicesShape.slice(0, 1), values.dtype);\n const outputValuesId = backend.dataIdMap.get(outputValues.dataId).id;\n\n const emptyRowIndicator = backend.makeOutput([denseRows], 'bool');\n const emptyRowIndicatorId =\n backend.dataIdMap.get(emptyRowIndicator.dataId).id;\n\n const reverseIndexMap = backend.makeOutput([indicesCount], indices.dtype);\n const reverseIndexMapId = backend.dataIdMap.get(reverseIndexMap.dataId).id;\n\n const exceptionValues = backend.makeOutput([4], 'int32');\n const exceptionValuesId = backend.dataIdMap.get(exceptionValues.dataId).id;\n\n const outputRows = wasmSparseFillEmptyRows(\n indicesId, valuesId, CppDType[values.dtype], indicesCount, denseRows,\n rank, defaultValueId, outputIndicesId, outputValuesId,\n emptyRowIndicatorId, reverseIndexMapId, exceptionValuesId);\n\n const exceptionValuesArray =\n backend.readSync(exceptionValues.dataId) as Int32Array;\n\n let exceptionMessage: string;\n switch (exceptionValuesArray[0]) {\n case 1: {\n exceptionMessage =\n backend_util.getSparseFillEmptyRowsIndicesDenseShapeMismatch(\n exceptionValuesArray[1]);\n break;\n }\n case 2: {\n exceptionMessage =\n backend_util.getSparseFillEmptyRowsNegativeIndexErrorMessage(\n exceptionValuesArray[1], exceptionValuesArray[2]);\n break;\n }\n case 3:\n exceptionMessage =\n backend_util.getSparseFillEmptyRowsOutOfRangeIndexErrorMessage(\n exceptionValuesArray[1], exceptionValuesArray[2],\n exceptionValuesArray[3]);\n break;\n default:\n exceptionMessage = '';\n }\n\n backend.disposeData(exceptionValues.dataId);\n if (exceptionMessage) {\n backend.disposeData(outputIndices.dataId);\n backend.disposeData(outputValues.dataId);\n backend.disposeData(emptyRowIndicator.dataId);\n backend.disposeData(reverseIndexMap.dataId);\n throw new Error(exceptionMessage);\n }\n\n let resizedIndices = outputIndices;\n let resizedValues = outputValues;\n // Overestimated output size.\n if (outputRows !== maxOutputIndicesShape[0]) {\n resizedIndices = slice({\n inputs: {x: outputIndices},\n attrs: {begin: 0, size: [outputRows, rank]},\n backend\n });\n resizedValues = slice({\n inputs: {x: outputValues},\n attrs: {begin: 0, size: outputRows},\n backend\n });\n backend.disposeData(outputIndices.dataId);\n backend.disposeData(outputValues.dataId);\n }\n\n return [resizedIndices, resizedValues, emptyRowIndicator, reverseIndexMap];\n}\n\nexport const sparseFillEmptyRowsConfig: KernelConfig = {\n kernelName: SparseFillEmptyRows,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: sparseFillEmptyRows as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, SparseReshape, SparseReshapeInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nlet wasmSparseReshape: (\n inputIndicesId: number, inputShapeId: number, newShapeId: number,\n nnz: number, newIndicesId: number, outputShapeId: number,\n exceptionValuesId: number) => void;\n\nfunction setup(backend: BackendWasm): void {\n wasmSparseReshape = backend.wasm.cwrap(SparseReshape, null /*void*/, [\n 'number', // inputIndicesId\n 'number', // inputShapeId\n 'number', // newShapeId\n 'number', // nnz\n 'number', // newIndicesId\n 'number', // outputShapeId\n 'number', // exceptionValuesId\n ]);\n}\n\nfunction sparseReshape(args: {\n backend: BackendWasm,\n inputs: SparseReshapeInputs,\n}): [TensorInfo, TensorInfo] {\n const {backend, inputs} = args;\n const {inputIndices, inputShape, newShape} = inputs;\n\n if (inputIndices.shape.length !== 2) {\n throw new Error(`Input indices should be a matrix but received shape\n ${inputIndices.shape}`);\n }\n if (inputShape.shape.length !== 1) {\n throw new Error(`Input shape should be a vector but received shape\n ${inputShape.shape}`);\n }\n if (newShape.shape.length !== 1) {\n throw new Error(\n `Target shape should be a vector but received shape ${newShape.shape}`);\n }\n\n const inputIndicesId = backend.dataIdMap.get(inputIndices.dataId).id;\n const inputShapeId = backend.dataIdMap.get(inputShape.dataId).id;\n const newShapeId = backend.dataIdMap.get(newShape.dataId).id;\n\n const nnz = inputIndices.shape[0];\n const outputRank = util.sizeFromShape(newShape.shape);\n\n const newIndices = backend.makeOutput([nnz, outputRank], inputIndices.dtype);\n const newIndicesId = backend.dataIdMap.get(newIndices.dataId).id;\n\n const outputShape = backend.makeOutput([outputRank], newShape.dtype);\n const outputShapeId = backend.dataIdMap.get(outputShape.dataId).id;\n\n const exceptionValues = backend.makeOutput([3], 'int32');\n const exceptionValuesId = backend.dataIdMap.get(exceptionValues.dataId).id;\n\n wasmSparseReshape(\n inputIndicesId, inputShapeId, newShapeId, nnz, newIndicesId,\n outputShapeId, exceptionValuesId);\n\n const exceptionValuesArray =\n backend.readSync(exceptionValues.dataId) as Int32Array;\n\n let exceptionMessage: string;\n switch (exceptionValuesArray[0]) {\n case 0: {\n exceptionMessage =\n backend_util.getSparseReshapeMultipleNegativeOneOutputDimErrorMessage(\n exceptionValuesArray[1], exceptionValuesArray[2]);\n break;\n }\n case 1: {\n exceptionMessage =\n backend_util.getSparseReshapeNegativeOutputDimErrorMessage(\n exceptionValuesArray[1], exceptionValuesArray[2]);\n break;\n }\n case 2:\n exceptionMessage =\n backend_util.getSparseReshapeEmptyTensorZeroOutputDimErrorMessage();\n break;\n case 3: {\n const inputShapeValues =\n Array.from(backend.readSync(inputShape.dataId) as Int32Array),\n outputShapeValues =\n Array.from(backend.readSync(outputShape.dataId) as Int32Array);\n exceptionMessage =\n backend_util.getSparseReshapeInputOutputMultipleErrorMessage(\n inputShapeValues, outputShapeValues);\n break;\n }\n case 4: {\n const inputShapeValues =\n Array.from(backend.readSync(inputShape.dataId) as Int32Array),\n outputShapeValues =\n Array.from(backend.readSync(outputShape.dataId) as Int32Array);\n exceptionMessage =\n backend_util.getSparseReshapeInputOutputMismatchErrorMessage(\n inputShapeValues, outputShapeValues);\n break;\n }\n default:\n exceptionMessage = '';\n }\n\n backend.disposeData(exceptionValues.dataId);\n if (exceptionMessage) {\n backend.disposeData(newIndices.dataId);\n backend.disposeData(outputShape.dataId);\n throw new Error(exceptionMessage);\n }\n\n return [newIndices, outputShape];\n}\n\nexport const sparseReshapeConfig: KernelConfig = {\n kernelName: SparseReshape,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: sparseReshape as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, SparseSegmentMeanInputs, SparseSegmentSumInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {CppDType} from './types';\n\nlet wasmSparseSegmentReduction: (\n dataId: number, dtype: number, numRow: number, indicesId: number,\n segmentIdsId: number, outputId: number, exceptionValuesId: number,\n isMean: boolean, defaultValue: number) => void;\n\nexport function setup(backend: BackendWasm): void {\n wasmSparseSegmentReduction =\n backend.wasm.cwrap('SparseSegmentReduction', null /*void*/, [\n 'number', // dataId\n 'number', // dtype\n 'number', // numRow\n 'number', // indicesId\n 'number', // segmentIdsId\n 'number', // outputId\n 'number', // exceptionValuesId,\n 'number', // isMean\n 'number', // defaultValue\n ]);\n}\n\nexport function sparseSegmentReduction(\n args: {\n backend: BackendWasm,\n inputs: SparseSegmentSumInputs|SparseSegmentMeanInputs,\n },\n isMean: boolean): TensorInfo {\n const {backend, inputs} = args;\n const {data, indices, segmentIds} = inputs;\n\n const numIndices = indices.shape[0];\n const segmentIdsBack =\n (backend.readSync(segmentIds.dataId, numIndices - 1, numIndices) as\n Int32Array)[0];\n const lastSegmentIdPlusOne = numIndices > 0 ? segmentIdsBack + 1 : 0;\n const outputRows = lastSegmentIdPlusOne;\n\n if (outputRows < 0) {\n throw (new Error(\n backend_util\n .getSparseSegmentReductionNegativeSegmentIdsErrorMessage()));\n }\n\n const outputShape = data.shape.slice();\n outputShape[0] = outputRows;\n\n const dataId = backend.dataIdMap.get(data.dataId).id;\n const indicesId = backend.dataIdMap.get(indices.dataId).id;\n const segmentIdsId = backend.dataIdMap.get(segmentIds.dataId).id;\n\n const output = backend.makeOutput(outputShape, data.dtype);\n const outputId = backend.dataIdMap.get(output.dataId).id;\n\n const exceptionValues = backend.makeOutput([4], 'int32');\n const exceptionValuesId = backend.dataIdMap.get(exceptionValues.dataId).id;\n\n wasmSparseSegmentReduction(\n dataId, CppDType[data.dtype], data.shape[0], indicesId, segmentIdsId,\n outputId, exceptionValuesId, isMean, 0);\n\n const exceptionValuesArray =\n backend.readSync(exceptionValues.dataId) as Int32Array;\n\n let exceptionMessage: string;\n switch (exceptionValuesArray[0]) {\n case 0: {\n exceptionMessage =\n backend_util\n .getSparseSegmentReductionNegativeSegmentIdsErrorMessage();\n break;\n }\n case 1: {\n exceptionMessage =\n backend_util\n .getSparseSegmentReductionNonIncreasingSegmentIdsErrorMessage();\n break;\n }\n case 2:\n exceptionMessage =\n backend_util.getSparseSegmentReductionSegmentIdOutOfRangeErrorMessage(\n exceptionValuesArray[1], exceptionValuesArray[2]);\n break;\n case 3:\n exceptionMessage =\n backend_util.getSparseSegmentReductionIndicesOutOfRangeErrorMessage(\n exceptionValuesArray[1], exceptionValuesArray[2],\n exceptionValuesArray[3]);\n break;\n default:\n exceptionMessage = '';\n }\n\n backend.disposeData(exceptionValues.dataId);\n if (exceptionMessage) {\n backend.disposeData(output.dataId);\n throw new Error(exceptionMessage);\n }\n\n return output;\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, SparseSegmentMean, SparseSegmentMeanInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {setup, sparseSegmentReduction} from './SparseSegmentReduction';\n\nfunction sparseSegmentMean(args: {\n backend: BackendWasm,\n inputs: SparseSegmentMeanInputs,\n}): TensorInfo {\n return sparseSegmentReduction(args, true);\n}\n\nexport const sparseSegmentMeanConfig: KernelConfig = {\n kernelName: SparseSegmentMean,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: sparseSegmentMean as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, SparseSegmentSum, SparseSegmentSumInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {setup, sparseSegmentReduction} from './SparseSegmentReduction';\n\nfunction sparseSegmentSum(args: {\n backend: BackendWasm,\n inputs: SparseSegmentSumInputs,\n}): TensorInfo {\n return sparseSegmentReduction(args, false);\n}\n\nexport const sparseSegmentSumConfig: KernelConfig = {\n kernelName: SparseSegmentSum,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: sparseSegmentSum as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, SplitV, SplitVAttrs, SplitVInputs, util} from '@tensorflow/tfjs-core';\nimport {backend_util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {slice} from './Slice';\n\nexport function splitV(\n args: {inputs: SplitVInputs, attrs: SplitVAttrs, backend: BackendWasm}) {\n const {inputs, attrs, backend} = args;\n const {x} = inputs;\n const {numOrSizeSplits, axis} = attrs;\n\n const $axis = util.parseAxisParam(axis, x.shape)[0];\n\n const splitSizes = backend_util.prepareSplitSize(x, numOrSizeSplits, $axis);\n const begin = new Array(x.shape.length).fill(0);\n const size = x.shape.slice();\n return splitSizes.map(s => {\n const xSliceSize = [...size];\n xSliceSize[$axis] = s;\n const xSlice =\n slice({inputs: {x}, attrs: {begin, size: xSliceSize}, backend});\n begin[$axis] += s;\n return xSlice;\n });\n}\n\nexport const splitVConfig: KernelConfig = {\n kernelName: SplitV,\n backendName: 'wasm',\n kernelFunc: splitV as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, Sqrt} from '@tensorflow/tfjs-core';\n\nimport {createUnaryKernelConfig} from './unary_kernel';\nexport const sqrtConfig: KernelConfig = createUnaryKernelConfig(Sqrt);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, Square} from '@tensorflow/tfjs-core';\n\nimport {createUnaryKernelConfig} from './unary_kernel';\nexport const squareConfig: KernelConfig = createUnaryKernelConfig(Square);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, SquaredDifference} from '@tensorflow/tfjs-core';\nimport {createBinaryKernelConfig} from './binary_kernel';\nconst supportsFullBroadcast = true;\nexport const squaredDifferenceConfig: KernelConfig =\n createBinaryKernelConfig(SquaredDifference, supportsFullBroadcast);\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Step, StepAttrs, StepInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {CppDType} from './types';\n\nlet wasmStep: (xId: number, alpha: number, dtype: number, outId: number) =>\n void;\n\nfunction setup(backend: BackendWasm): void {\n wasmStep = backend.wasm.cwrap(Step, null /*void*/, [\n 'number', // x_id\n 'number', // alpha\n 'number', // dtype\n 'number', // out_id\n ]);\n}\n\nfunction step(\n args: {backend: BackendWasm, inputs: StepInputs, attrs: StepAttrs}):\n TensorInfo {\n const {backend, inputs, attrs} = args;\n const {alpha} = attrs;\n const {x} = inputs;\n const xId = backend.dataIdMap.get(x.dataId).id;\n\n const out = backend.makeOutput(x.shape, x.dtype);\n const outId = backend.dataIdMap.get(out.dataId).id;\n wasmStep(xId, alpha, CppDType[x.dtype], outId);\n return out;\n}\n\nexport const stepConfig: KernelConfig = {\n kernelName: Step,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: step as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, slice_util, StridedSlice, StridedSliceAttrs, StridedSliceInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\nimport {reshape} from './Reshape';\nimport {slice} from './Slice';\n\nlet wasmStridedSlice: (\n xId: number, xStridesBytes: Uint8Array, xRank: number,\n beginBytes: Uint8Array, endBytes: Uint8Array, stridesBytes: Uint8Array,\n outShapeBytes: Uint8Array, outStridesBytes: Uint8Array,\n outShapeLength: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm): void {\n wasmStridedSlice = backend.wasm.cwrap(StridedSlice, null /*void*/, [\n 'number', // xId\n 'array', // xStrides\n 'number', // xRank\n 'array', // beginBytes\n 'array', // endBytes\n 'array', // stridesBytes\n 'array', // outShapeBytes\n 'array', // outStridesBytes\n 'number', // outShapeLength\n 'number', // outId\n ]);\n}\n\nexport function stridedSlice(args: {\n backend: BackendWasm,\n inputs: StridedSliceInputs,\n attrs: StridedSliceAttrs\n}): TensorInfo {\n const {backend, inputs, attrs} = args;\n const {x} = inputs;\n\n const {\n begin,\n end,\n strides,\n beginMask,\n endMask,\n ellipsisMask,\n newAxisMask,\n shrinkAxisMask\n } = attrs;\n\n const {\n finalShapeSparse,\n finalShape,\n isIdentity,\n sliceDim0,\n isSimpleSlice,\n begin: $begin,\n end: $end,\n strides: $strides\n } =\n slice_util.sliceInfo(\n x.shape, begin, end, strides, beginMask, endMask, ellipsisMask,\n newAxisMask, shrinkAxisMask);\n\n let result;\n\n if (isIdentity) {\n // Optimization #1, slice is a no-op plus reshape\n result = reshape({inputs: {x}, backend, attrs: {shape: finalShape}});\n } else if (sliceDim0 || isSimpleSlice) {\n // Optimization #2, slice is memory contiguous (only occurs in dim 0)\n util.assert(\n x.shape.length >= 1,\n () => `Input must have rank at least 1, got: ${x.shape.length}`);\n\n const size = slice_util.computeOutShape($begin, $end, $strides);\n // To tolerate begin[0] > end[0] (a 0-output slice), we min(begin, end).\n const sliced = slice({inputs: {x}, backend, attrs: {begin: $begin, size}});\n result =\n reshape({inputs: {x: sliced}, backend, attrs: {shape: finalShape}});\n backend.disposeData(sliced.dataId);\n } else {\n const out = backend.makeOutput(finalShapeSparse, 'float32');\n\n const xId = backend.dataIdMap.get(x.dataId).id;\n const xStridesBytes =\n new Uint8Array(new Int32Array(util.computeStrides(x.shape)).buffer);\n const beginBytes = new Uint8Array(new Int32Array($begin).buffer);\n const endBytes = new Uint8Array(new Int32Array($end).buffer);\n const stridesBytes = new Uint8Array(new Int32Array($strides).buffer);\n\n const outputShapeBytes =\n new Uint8Array(new Int32Array(finalShapeSparse).buffer);\n const outStridesBytes = new Uint8Array(\n new Int32Array(util.computeStrides(finalShapeSparse)).buffer);\n const outId = backend.dataIdMap.get(out.dataId).id;\n\n wasmStridedSlice(\n xId, xStridesBytes, x.shape.length, beginBytes, endBytes, stridesBytes,\n outputShapeBytes, outStridesBytes, finalShapeSparse.length, outId);\n\n result = reshape({inputs: {x: out}, backend, attrs: {shape: finalShape}});\n\n backend.disposeData(out.dataId);\n }\n\n return result;\n}\n\nexport const stridedSliceConfig: KernelConfig = {\n kernelName: StridedSlice,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: stridedSlice as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, StringNGrams, StringNGramsAttrs, StringNGramsInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\nimport {stringNGramsImplCPU} from '../kernel_utils/shared';\n\nfunction stringNGrams(args: {\n backend: BackendWasm,\n inputs: StringNGramsInputs,\n attrs: StringNGramsAttrs\n}): [TensorInfo, TensorInfo] {\n const {backend, inputs, attrs} = args;\n const {data, dataSplits} = inputs;\n const {\n separator,\n nGramWidths,\n leftPad,\n rightPad,\n padWidth,\n preserveShortSequences,\n } = attrs;\n\n const $data = backend.readSync(data.dataId) as Uint8Array[];\n const $dataSplits = backend.readSync(dataSplits.dataId) as Int32Array;\n\n const [nGrams, nGramsSplits] = stringNGramsImplCPU(\n $data, $dataSplits, separator, nGramWidths, leftPad, rightPad, padWidth,\n preserveShortSequences);\n\n const nGramsOut = backend.makeOutput([nGrams.length], 'string');\n const nGramsOutData = backend.dataIdMap.get(nGramsOut.dataId);\n nGramsOutData.stringBytes = nGrams;\n\n const nGramsSplitsOut = backend.makeOutput(dataSplits.shape, 'int32');\n const nGramsSplitsOutVals = backend.typedArrayFromHeap(nGramsSplitsOut);\n nGramsSplitsOutVals.set(nGramsSplits);\n\n return [nGramsOut, nGramsSplitsOut];\n}\n\nexport const stringNGramsConfig: KernelConfig = {\n kernelName: StringNGrams,\n backendName: 'wasm',\n kernelFunc: stringNGrams as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, StringSplit, StringSplitAttrs, StringSplitInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\nimport {stringSplitImplCPU} from '../kernel_utils/shared';\n\nfunction stringSplit(args: {\n backend: BackendWasm,\n inputs: StringSplitInputs,\n attrs: StringSplitAttrs\n}): [TensorInfo, TensorInfo, TensorInfo] {\n const {backend, inputs, attrs} = args;\n const {input, delimiter} = inputs;\n const {skipEmpty} = attrs;\n\n const inputVals = backend.readSync(input.dataId) as Uint8Array[];\n const delimiterVals = backend.readSync(delimiter.dataId) as Uint8Array[];\n\n const [indices, values, shape] =\n stringSplitImplCPU(inputVals, delimiterVals[0], skipEmpty);\n const outputSize = values.length;\n\n const indicesOut = backend.makeOutput([outputSize, 2], 'int32');\n const indicesOutVals = backend.typedArrayFromHeap(indicesOut);\n indicesOutVals.set(indices);\n\n const valuesOut = backend.makeOutput([outputSize], 'string');\n const valuesOutData = backend.dataIdMap.get(valuesOut.dataId);\n valuesOutData.stringBytes = values;\n\n const shapeOut = backend.makeOutput([2], 'int32');\n const shapeOutVals = backend.typedArrayFromHeap(shapeOut);\n shapeOutVals.set(shape);\n\n return [indicesOut, valuesOut, shapeOut];\n}\n\nexport const stringSplitConfig: KernelConfig = {\n kernelName: StringSplit,\n backendName: 'wasm',\n kernelFunc: stringSplit as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, StringToHashBucketFast, StringToHashBucketFastAttrs, StringToHashBucketFastInputs, TensorInfo} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\nimport {stringToHashBucketFastImplCPU} from '../kernel_utils/shared';\n\nfunction stringToHashBucketFast(args: {\n backend: BackendWasm,\n inputs: StringToHashBucketFastInputs,\n attrs: StringToHashBucketFastAttrs\n}): TensorInfo {\n const {backend, inputs, attrs} = args;\n const {input} = inputs;\n const {numBuckets} = attrs;\n\n const inputVals = backend.readSync(input.dataId) as Uint8Array[];\n\n const values = stringToHashBucketFastImplCPU(inputVals, numBuckets);\n\n const out = backend.makeOutput(input.shape, 'int32');\n const outVals = backend.typedArrayFromHeap(out);\n outVals.set(values);\n return out;\n}\n\nexport const stringToHashBucketFastConfig: KernelConfig = {\n kernelName: StringToHashBucketFast,\n backendName: 'wasm',\n kernelFunc: stringToHashBucketFast as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, Sub} from '@tensorflow/tfjs-core';\nimport {createBinaryKernelConfig} from './binary_kernel';\nconst supportsFullBroadcast = true;\nexport const subConfig: KernelConfig =\n createBinaryKernelConfig(Sub, supportsFullBroadcast);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {backend_util, KernelConfig, KernelFunc, Sum, SumAttrs, SumInputs, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {permuteAxesAndTranspose} from './kernel_utils';\nimport {CppDType} from './types';\n\nlet wasmSum: (xId: number, reduceSize: number, dtype: number, outId: number) =>\n void;\n\nfunction setup(backend: BackendWasm): void {\n wasmSum = backend.wasm.cwrap(Sum, null /*void*/, [\n 'number', // input_id\n 'number', // reduce_size\n 'number', // dtype\n 'number', // out_id\n ]);\n}\n\nfunction sum(args: {backend: BackendWasm, inputs: SumInputs, attrs: SumAttrs}):\n TensorInfo {\n const {backend, inputs, attrs} = args;\n const {axis, keepDims} = attrs;\n const {x} = inputs;\n const xId = backend.dataIdMap.get(x.dataId).id;\n let inputId = xId;\n let input = x;\n\n const {transposed, axes, originalAxes, inputWasTransposed} =\n permuteAxesAndTranspose(x, axis, backend);\n\n let reductionAxes = axes;\n if (inputWasTransposed) {\n const transposedId = backend.dataIdMap.get(transposed.dataId).id;\n if (transposedId !== xId) {\n // transpose was not a no-op. We will need to dispose of this\n // once we are done.\n input = transposed;\n inputId = transposedId;\n reductionAxes = backend_util.getInnerMostAxes(\n reductionAxes.length, input.shape.length);\n }\n }\n\n backend_util.assertAxesAreInnerMostDims(\n 'sum', reductionAxes, input.shape.length);\n const [outShape, reduceShape] =\n backend_util.computeOutAndReduceShapes(input.shape, reductionAxes);\n const reduceSize = util.sizeFromShape(reduceShape);\n\n const out = backend.makeOutput(outShape, input.dtype);\n if (util.sizeFromShape(input.shape) !== 0) {\n const outId = backend.dataIdMap.get(out.dataId).id;\n wasmSum(inputId, reduceSize, CppDType[out.dtype], outId);\n }\n\n if (inputWasTransposed) {\n // dispose of the transposed tensor.\n backend.disposeData(transposed.dataId);\n }\n\n if (keepDims) {\n // reshape\n const newShape = backend_util.expandShapeToKeepDim(out.shape, originalAxes);\n out.shape = newShape;\n }\n\n return out;\n}\n\nexport const sumConfig: KernelConfig = {\n kernelName: Sum,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: sum as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, Tan} from '@tensorflow/tfjs-core';\n\nimport {createUnaryKernelConfig} from './unary_kernel';\nexport const tanConfig: KernelConfig = createUnaryKernelConfig(Tan);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {KernelConfig, Tanh} from '@tensorflow/tfjs-core';\n\nimport {createUnaryKernelConfig} from './unary_kernel';\nexport const tanhConfig: KernelConfig = createUnaryKernelConfig(Tanh);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, Tile, TileAttrs, TileInputs} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {CppDType} from './types';\n\nlet wasmTile: (\n xId: number, xShape: Uint8Array, xShapeSize: number, newShape: Uint8Array,\n newShapeSize: number, dtype: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmTile = backend.wasm.cwrap(Tile, null /* void */, [\n 'number', // x_id\n 'array', // x_shape\n 'number', // x_shape.length\n 'array', // new_shape\n 'number', // new_shape.length\n 'number' // out_id\n ]);\n}\n\nfunction tile(\n args: {inputs: TileInputs, backend: BackendWasm, attrs: TileAttrs}) {\n const {inputs, backend, attrs} = args;\n const {x} = inputs;\n const xId = backend.dataIdMap.get(x.dataId).id;\n const {reps} = attrs;\n\n const newShape: number[] = new Array(x.shape.length);\n for (let i = 0; i < newShape.length; i++) {\n newShape[i] = x.shape[i] * reps[i];\n }\n const xShapeBytes = new Uint8Array(new Int32Array(x.shape).buffer);\n const newShapeBytes = new Uint8Array(new Int32Array(newShape).buffer);\n\n const out = backend.makeOutput(newShape, x.dtype);\n const outId = backend.dataIdMap.get(out.dataId).id;\n wasmTile(\n xId, xShapeBytes, x.shape.length, newShapeBytes, newShape.length,\n CppDType[out.dtype], outId);\n return out;\n}\n\nexport const tileConfig: KernelConfig = {\n kernelName: Tile,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: tile as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, TensorInfo, TopK, TopKAttrs, TopKInputs} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\nimport {CppDType} from './types';\n\nlet wasmTopK: (\n xId: number, xShapeBytes: Uint8Array, xShapeLength: number,\n xDtype: CppDType, k: number, sorted: boolean, outValuesId: number,\n outIndicesId: number) => void;\n\nfunction setup(backend: BackendWasm) {\n wasmTopK = backend.wasm.cwrap(TopK, null /* void */, [\n 'number', // xId\n 'array', // x.shape\n 'number', // x.shape.length\n 'number', // x.dtype\n 'number', // k\n 'bool', // sorted\n 'number', // outValuesId\n 'number', // outIndicesId\n ]);\n}\n\nexport const topk:\n (args: {inputs: TopKInputs, backend: BackendWasm, attrs: TopKAttrs}) =>\n TensorInfo[] | TensorInfo = ({inputs, backend, attrs}) => {\n const {x} = inputs;\n const {k, sorted} = attrs;\n\n const xId = backend.dataIdMap.get(x.dataId).id;\n const xShapeBytes = new Uint8Array(new Int32Array(x.shape).buffer);\n const outputShape = x.shape.slice();\n outputShape[outputShape.length - 1] = k;\n const outValues = backend.makeOutput(outputShape, x.dtype);\n const outValuesId = backend.dataIdMap.get(outValues.dataId).id;\n const outIndices = backend.makeOutput(outputShape, 'int32');\n const outIndicesId = backend.dataIdMap.get(outIndices.dataId).id;\n\n wasmTopK(\n xId, xShapeBytes, x.shape.length, CppDType[x.dtype], k, sorted,\n outValuesId, outIndicesId);\n\n return [outValues, outIndices];\n };\n\nexport const topKConfig: KernelConfig = {\n kernelName: TopK,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: topk as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, TensorInfo, Transform, TransformAttrs, TransformInputs, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nlet wasmTransform: (\n imageId: number, transformsId: number, isBatchTransform: boolean,\n batch: number, outHeight: number, outWidth: number, numChannels: number,\n imageWidth: number, imageHeight: number, inputStrides: Uint8Array,\n inputStridesLength: number, outputStrides: Uint8Array,\n outputStridesLength: number, interpolationModeId: number,\n fillModeId: number, fillValue: number, outId: number) => void;\n\nfunction setup(backend: BackendWasm): void {\n wasmTransform = backend.wasm.cwrap(Transform, null /*void*/, [\n 'number', // imageId\n 'number', // transformsId\n 'bool', // isBatchTransform\n 'number', // batch\n 'number', // outHeight\n 'number', // outWidth\n 'number', // numChannels\n 'number', // imageWidth\n 'number', // imageHeight\n 'array', // inputStrides\n 'number', // inputStridesLength\n 'array', // outputStrides\n 'number', // outputStridesLength\n 'number', // interpolationModeId\n 'number', // fillModeId\n 'number', // fillValue\n 'number' // outId\n ]);\n}\n\nfunction transform(\n args:\n {backend: BackendWasm, inputs: TransformInputs, attrs: TransformAttrs}):\n TensorInfo {\n const {backend, inputs, attrs} = args;\n const {image, transforms} = inputs;\n const {interpolation, fillMode, fillValue, outputShape} = attrs;\n\n const [batch, imageHeight, imageWidth, numChannels] = image.shape;\n const [outHeight, outWidth] =\n outputShape != null ? outputShape : [imageHeight, imageWidth];\n const outShape =\n [batch, outHeight, outWidth,\n numChannels] as [number, number, number, number];\n const inputStrides =\n new Uint8Array(new Int32Array(util.computeStrides(image.shape)).buffer);\n\n const outputStrides =\n new Uint8Array(new Int32Array(util.computeStrides(outShape)).buffer);\n\n const out = backend.makeOutput(outShape, image.dtype);\n const outId = backend.dataIdMap.get(out.dataId).id;\n\n const imageData = backend.dataIdMap.get(image.dataId);\n const imageId = imageData.id;\n\n const transformsData = backend.dataIdMap.get(transforms.dataId);\n const transformsId = transformsData.id;\n\n const interpolationModeId = interpolation === 'nearest' ? 1 : 2;\n let fillModeId;\n switch (fillMode) {\n case 'constant':\n fillModeId = 1;\n break;\n case 'reflect':\n fillModeId = 2;\n break;\n case 'wrap':\n fillModeId = 3;\n break;\n case 'nearest':\n fillModeId = 4;\n break;\n default:\n fillModeId = 1;\n break;\n }\n\n wasmTransform(\n imageId, transformsId, (transforms.shape[0] > 1), batch, outHeight,\n outWidth, numChannels, imageWidth, imageHeight, inputStrides,\n image.shape.length - 1, outputStrides, outShape.length - 1,\n interpolationModeId, fillModeId, fillValue, outId);\n\n return out;\n}\n\nexport const transformConfig: KernelConfig = {\n kernelName: Transform,\n backendName: 'wasm',\n setupFunc: setup,\n kernelFunc: transform as {} as KernelFunc\n};\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, TensorInfo, Unpack, UnpackAttrs, UnpackInputs} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nimport {slice} from './Slice';\n\nfunction unpack(\n args: {inputs: UnpackInputs, backend: BackendWasm, attrs: UnpackAttrs}):\n TensorInfo[] {\n const {inputs, backend, attrs} = args;\n const {value} = inputs;\n let {axis} = attrs;\n\n if (axis < 0) {\n axis += value.shape.length;\n }\n\n const numOutputs = value.shape[axis];\n const rank = value.shape.length;\n const outShape: number[] = new Array(rank - 1);\n let outIndex = 0;\n for (let i = 0; i < rank; i++) {\n if (i !== axis) {\n outShape[outIndex++] = value.shape[i];\n }\n }\n const outs: TensorInfo[] = new Array(numOutputs);\n const begin = new Array(rank).fill(0);\n const size = value.shape.slice();\n size[axis] = 1;\n for (let i = 0; i < outs.length; i++) {\n begin[axis] = i;\n outs[i] = slice({inputs: {x: value}, attrs: {begin, size}, backend});\n }\n return outs.map(({dataId, dtype}) => ({dataId, dtype, shape: outShape}));\n}\n\nexport const unpackConfig: KernelConfig = {\n kernelName: Unpack,\n backendName: 'wasm',\n kernelFunc: unpack as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {KernelConfig, KernelFunc, ZerosLike, ZerosLikeInputs} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm} from '../backend_wasm';\n\nfunction zerosLike(args: {inputs: ZerosLikeInputs, backend: BackendWasm}) {\n const {inputs: {x}, backend} = args;\n const out = backend.makeOutput(x.shape, x.dtype);\n const outVals = backend.typedArrayFromHeap(out);\n outVals.fill(0);\n return out;\n}\n\nexport const zerosLikeConfig: KernelConfig = {\n kernelName: ZerosLike,\n backendName: 'wasm',\n kernelFunc: zerosLike as {} as KernelFunc,\n};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n// We explicitly import the modular kernels so they get registered in the\n// global registry when we compile the library. A modular build would replace\n// the contents of this file and import only the kernels that are needed.\nimport {KernelConfig, registerKernel} from '@tensorflow/tfjs-core';\n\nimport {_fusedMatMulConfig} from './kernels/_FusedMatMul';\nimport {absConfig} from './kernels/Abs';\nimport {addConfig} from './kernels/Add';\nimport {addNConfig} from './kernels/AddN';\nimport {allConfig} from './kernels/All';\nimport {anyConfig} from './kernels/Any';\nimport {argMaxConfig} from './kernels/ArgMax';\nimport {avgPoolConfig} from './kernels/AvgPool';\nimport {batchMatMulConfig} from './kernels/BatchMatMul';\nimport {batchToSpaceNDConfig} from './kernels/BatchToSpaceND';\nimport {castConfig} from './kernels/Cast';\nimport {ceilConfig} from './kernels/Ceil';\nimport {clipByValueConfig} from './kernels/ClipByValue';\nimport {concatConfig} from './kernels/Concat';\nimport {conv2DConfig} from './kernels/Conv2D';\nimport {conv2DBackpropInputConfig} from './kernels/Conv2DBackpropInput';\nimport {cosConfig} from './kernels/Cos';\nimport {coshConfig} from './kernels/Cosh';\nimport {cropAndResizeConfig} from './kernels/CropAndResize';\nimport {cumprodConfig} from './kernels/Cumprod';\nimport {cumsumConfig} from './kernels/Cumsum';\nimport {depthToSpaceConfig} from './kernels/DepthToSpace';\nimport {depthwiseConv2dNativeConfig} from './kernels/DepthwiseConv2dNative';\nimport {eluConfig} from './kernels/Elu';\nimport {equalConfig} from './kernels/Equal';\nimport {expConfig} from './kernels/Exp';\nimport {expandDimsConfig} from './kernels/ExpandDims';\nimport {fillConfig} from './kernels/Fill';\nimport {flipLeftRightConfig} from './kernels/FlipLeftRight';\nimport {floorConfig} from './kernels/Floor';\nimport {floorDivConfig} from './kernels/FloorDiv';\nimport {fusedBatchNormConfig} from './kernels/FusedBatchNorm';\nimport {fusedConv2DConfig} from './kernels/FusedConv2D';\nimport {fusedDepthwiseConv2DConfig} from './kernels/FusedDepthwiseConv2D';\nimport {gatherNdConfig} from './kernels/GatherNd';\nimport {gatherV2Config} from './kernels/GatherV2';\nimport {greaterConfig} from './kernels/Greater';\nimport {greaterEqualConfig} from './kernels/GreaterEqual';\nimport {identityConfig} from './kernels/Identity';\nimport {leakyReluConfig} from './kernels/LeakyRelu';\nimport {lessConfig} from './kernels/Less';\nimport {lessEqualConfig} from './kernels/LessEqual';\nimport {logConfig} from './kernels/Log';\nimport {logicalAndConfig} from './kernels/LogicalAnd';\nimport {logicalNotConfig} from './kernels/LogicalNot';\nimport {logicalOrConfig} from './kernels/LogicalOr';\nimport {logicalXorConfig} from './kernels/LogicalXor';\nimport {maxConfig} from './kernels/Max';\nimport {maximumConfig} from './kernels/Maximum';\nimport {maxPoolConfig} from './kernels/MaxPool';\nimport {meanConfig} from './kernels/Mean';\nimport {minConfig} from './kernels/Min';\nimport {minimumConfig} from './kernels/Minimum';\nimport {mirrorPadConfig} from './kernels/MirrorPad';\nimport {multiplyConfig} from './kernels/Multiply';\nimport {negConfig} from './kernels/Neg';\nimport {nonMaxSuppressionV3Config} from './kernels/NonMaxSuppressionV3';\nimport {nonMaxSuppressionV4Config} from './kernels/NonMaxSuppressionV4';\nimport {nonMaxSuppressionV5Config} from './kernels/NonMaxSuppressionV5';\nimport {notEqualConfig} from './kernels/NotEqual';\nimport {oneHotConfig} from './kernels/OneHot';\nimport {onesLikeConfig} from './kernels/OnesLike';\nimport {packConfig} from './kernels/Pack';\nimport {padV2Config} from './kernels/PadV2';\nimport {powConfig} from './kernels/Pow';\nimport {preluConfig} from './kernels/Prelu';\nimport {prodConfig} from './kernels/Prod';\nimport {rangeConfig} from './kernels/Range';\nimport {realDivConfig} from './kernels/RealDiv';\nimport {reluConfig} from './kernels/Relu';\nimport {relu6Config} from './kernels/Relu6';\nimport {reshapeConfig} from './kernels/Reshape';\nimport {resizeBilinearConfig} from './kernels/ResizeBilinear';\nimport {resizeNearestNeighborConfig} from './kernels/ResizeNearestNeighbor';\nimport {reverseConfig} from './kernels/Reverse';\nimport {rotateWithOffsetConfig} from './kernels/RotateWithOffset';\nimport {roundConfig} from './kernels/Round';\nimport {rsqrtConfig} from './kernels/Rsqrt';\nimport {scatterNdConfig} from './kernels/ScatterNd';\nimport {selectConfig} from './kernels/Select';\nimport {sigmoidConfig} from './kernels/Sigmoid';\nimport {sinConfig} from './kernels/Sin';\nimport {sliceConfig} from './kernels/Slice';\nimport {softmaxConfig} from './kernels/Softmax';\nimport {spaceToBatchNDConfig} from './kernels/SpaceToBatchND';\nimport {sparseFillEmptyRowsConfig} from './kernels/SparseFillEmptyRows';\nimport {sparseReshapeConfig} from './kernels/SparseReshape';\nimport {sparseSegmentMeanConfig} from './kernels/SparseSegmentMean';\nimport {sparseSegmentSumConfig} from './kernels/SparseSegmentSum';\nimport {splitVConfig} from './kernels/SplitV';\nimport {sqrtConfig} from './kernels/Sqrt';\nimport {squareConfig} from './kernels/Square';\nimport {squaredDifferenceConfig} from './kernels/SquaredDifference';\nimport {stepConfig} from './kernels/Step';\nimport {stridedSliceConfig} from './kernels/StridedSlice';\nimport {stringNGramsConfig} from './kernels/StringNGrams';\nimport {stringSplitConfig} from './kernels/StringSplit';\nimport {stringToHashBucketFastConfig} from './kernels/StringToHashBucketFast';\nimport {subConfig} from './kernels/Sub';\nimport {sumConfig} from './kernels/Sum';\nimport {tanConfig} from './kernels/Tan';\nimport {tanhConfig} from './kernels/Tanh';\nimport {tileConfig} from './kernels/Tile';\nimport {topKConfig} from './kernels/TopK';\nimport {transformConfig} from './kernels/Transform';\nimport {transposeConfig} from './kernels/Transpose';\nimport {unpackConfig} from './kernels/Unpack';\nimport {zerosLikeConfig} from './kernels/ZerosLike';\n\n// List all kernel configs here\nconst kernelConfigs: KernelConfig[] = [\n _fusedMatMulConfig,\n absConfig,\n addConfig,\n addNConfig,\n allConfig,\n anyConfig,\n argMaxConfig,\n avgPoolConfig,\n batchMatMulConfig,\n batchToSpaceNDConfig,\n castConfig,\n ceilConfig,\n clipByValueConfig,\n concatConfig,\n conv2DConfig,\n conv2DBackpropInputConfig,\n cosConfig,\n coshConfig,\n cropAndResizeConfig,\n cumprodConfig,\n cumsumConfig,\n depthToSpaceConfig,\n depthwiseConv2dNativeConfig,\n eluConfig,\n equalConfig,\n expConfig,\n expandDimsConfig,\n fillConfig,\n flipLeftRightConfig,\n floorConfig,\n floorDivConfig,\n fusedBatchNormConfig,\n fusedConv2DConfig,\n fusedDepthwiseConv2DConfig,\n gatherNdConfig,\n gatherV2Config,\n greaterConfig,\n greaterEqualConfig,\n identityConfig,\n leakyReluConfig,\n lessConfig,\n lessEqualConfig,\n logConfig,\n logicalAndConfig,\n logicalNotConfig,\n logicalOrConfig,\n logicalXorConfig,\n maxConfig,\n maximumConfig,\n maxPoolConfig,\n meanConfig,\n minConfig,\n minimumConfig,\n mirrorPadConfig,\n multiplyConfig,\n negConfig,\n nonMaxSuppressionV3Config,\n nonMaxSuppressionV4Config,\n nonMaxSuppressionV5Config,\n notEqualConfig,\n oneHotConfig,\n onesLikeConfig,\n packConfig,\n padV2Config,\n powConfig,\n preluConfig,\n prodConfig,\n rangeConfig,\n realDivConfig,\n reluConfig,\n relu6Config,\n reshapeConfig,\n resizeBilinearConfig,\n resizeNearestNeighborConfig,\n reverseConfig,\n rotateWithOffsetConfig,\n roundConfig,\n rsqrtConfig,\n scatterNdConfig,\n selectConfig,\n sigmoidConfig,\n sinConfig,\n sliceConfig,\n softmaxConfig,\n spaceToBatchNDConfig,\n sparseFillEmptyRowsConfig,\n sparseReshapeConfig,\n sparseSegmentMeanConfig,\n sparseSegmentSumConfig,\n splitVConfig,\n sqrtConfig,\n squareConfig,\n squaredDifferenceConfig,\n stepConfig,\n stridedSliceConfig,\n stringNGramsConfig,\n stringSplitConfig,\n stringToHashBucketFastConfig,\n subConfig,\n sumConfig,\n tanConfig,\n tanhConfig,\n tileConfig,\n topKConfig,\n transformConfig,\n transposeConfig,\n unpackConfig,\n zerosLikeConfig\n];\n\nfor (const kernelConfig of kernelConfigs) {\n registerKernel(kernelConfig);\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env} from '@tensorflow/tfjs-core';\n\nconst ENV = env();\n\n/**\n * True if SIMD is supported.\n */\n// From: https://github.com/GoogleChromeLabs/wasm-feature-detect\nENV.registerFlag('WASM_HAS_SIMD_SUPPORT', async () => {\n try {\n // This typed array passed in to WebAssembly.validate is WebAssembly binary\n // code. In this case it is a small program that contains SIMD\n // instructions.\n return WebAssembly.validate(new Uint8Array([\n 0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3,\n 2, 1, 0, 10, 9, 1, 7, 0, 65, 0, 253, 15, 26, 11\n ]));\n } catch (e) {\n return false;\n }\n});\n\n/**\n * True if threads are supported.\n */\n// From: https://github.com/GoogleChromeLabs/wasm-feature-detect\nENV.registerFlag('WASM_HAS_MULTITHREAD_SUPPORT', async () => {\n // TODO(annxingyuan): Enable node support once this is resolved:\n // https://github.com/tensorflow/tfjs/issues/3830\n if (ENV.get('IS_NODE')) {\n return false;\n }\n\n try {\n // Test for transferability of SABs (needed for Firefox)\n // https://groups.google.com/forum/#!msg/mozilla.dev.platform/IHkBZlHETpA/dwsMNchWEQAJ\n new MessageChannel().port1.postMessage(new SharedArrayBuffer(1));\n // This typed array is a WebAssembly program containing threaded\n // instructions.\n return WebAssembly.validate(new Uint8Array([\n 0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5,\n 4, 1, 3, 1, 1, 10, 11, 1, 9, 0, 65, 0, 254, 16, 2, 0, 26, 11\n ]));\n } catch (e) {\n return false;\n }\n});\n","\nvar WasmBackendModuleThreadedSimd = (() => {\n var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;\n if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;\n return (\nfunction(WasmBackendModuleThreadedSimd) {\n WasmBackendModuleThreadedSimd = WasmBackendModuleThreadedSimd || {};\n\nfunction GROWABLE_HEAP_I8(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAP8}function GROWABLE_HEAP_U8(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAPU8}function GROWABLE_HEAP_I16(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAP16}function GROWABLE_HEAP_I32(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAP32}function GROWABLE_HEAP_U32(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAPU32}function GROWABLE_HEAP_F32(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAPF32}function GROWABLE_HEAP_F64(){if(wasmMemory.buffer!=buffer){updateGlobalBufferAndViews(wasmMemory.buffer)}return HEAPF64}var Module=typeof WasmBackendModuleThreadedSimd!=\"undefined\"?WasmBackendModuleThreadedSimd:{};var readyPromiseResolve,readyPromiseReject;Module[\"ready\"]=new Promise(function(resolve,reject){readyPromiseResolve=resolve;readyPromiseReject=reject});var beforeListeners;if(typeof process!==\"undefined\"&&process.listeners){beforeListeners={uncaughtException:process.listeners(\"uncaughtException\"),unhandledRejection:process.listeners(\"unhandledRejection\")}}var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram=\"./this.program\";var quit_=(status,toThrow)=>{throw toThrow};var ENVIRONMENT_IS_WEB=typeof window==\"object\";var ENVIRONMENT_IS_WORKER=typeof importScripts==\"function\";var ENVIRONMENT_IS_NODE=typeof process==\"object\"&&typeof process.versions==\"object\"&&typeof process.versions.node==\"string\";var ENVIRONMENT_IS_PTHREAD=Module[\"ENVIRONMENT_IS_PTHREAD\"]||false;var scriptDirectory=\"\";function locateFile(path){if(Module[\"locateFile\"]){return Module[\"locateFile\"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;function logExceptionOnExit(e){if(e instanceof ExitStatus)return;let toLog=e;err(\"exiting due to exception: \"+toLog)}if(ENVIRONMENT_IS_NODE){if(ENVIRONMENT_IS_WORKER){scriptDirectory=require(\"path\").dirname(scriptDirectory)+\"/\"}else{scriptDirectory=__dirname+\"/\"}var fs,nodePath;if(typeof require===\"function\"){fs=require(\"fs\");nodePath=require(\"path\")}read_=(filename,binary)=>{filename=nodePath[\"normalize\"](filename);return fs.readFileSync(filename,binary?undefined:\"utf8\")};readBinary=filename=>{var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}return ret};readAsync=(filename,onload,onerror)=>{filename=nodePath[\"normalize\"](filename);fs.readFile(filename,function(err,data){if(err)onerror(err);else onload(data.buffer)})};if(process[\"argv\"].length>1){thisProgram=process[\"argv\"][1].replace(/\\\\/g,\"/\")}arguments_=process[\"argv\"].slice(2);process[\"on\"](\"uncaughtException\",function(ex){if(!(ex instanceof ExitStatus)){throw ex}});process[\"on\"](\"unhandledRejection\",function(reason){throw reason});quit_=(status,toThrow)=>{if(keepRuntimeAlive()){process[\"exitCode\"]=status;throw toThrow}logExceptionOnExit(toThrow);process[\"exit\"](status)};Module[\"inspect\"]=function(){return\"[Emscripten Module object]\"};let nodeWorkerThreads;try{nodeWorkerThreads=require(\"worker_threads\")}catch(e){console.error('The \"worker_threads\" module is not supported in this node.js build - perhaps a newer version is needed?');throw e}global.Worker=nodeWorkerThreads.Worker}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!=\"undefined\"&&document.currentScript){scriptDirectory=document.currentScript.src}if(typeof _scriptDir !== \"undefined\" && _scriptDir){scriptDirectory=_scriptDir}if(scriptDirectory.indexOf(\"blob:\")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,\"\").lastIndexOf(\"/\")+1)}else{scriptDirectory=\"\"}if(!ENVIRONMENT_IS_NODE){read_=url=>{var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,false);xhr.responseType=\"arraybuffer\";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=(url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,true);xhr.responseType=\"arraybuffer\";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}setWindowTitle=title=>document.title=title}else{}if(ENVIRONMENT_IS_NODE){if(typeof performance==\"undefined\"){global.performance=require(\"perf_hooks\").performance}}var defaultPrint=console.log.bind(console);var defaultPrintErr=console.warn.bind(console);if(ENVIRONMENT_IS_NODE){defaultPrint=str=>fs.writeSync(1,str+\"\\n\");defaultPrintErr=str=>fs.writeSync(2,str+\"\\n\")}var out=Module[\"print\"]||defaultPrint;var err=Module[\"printErr\"]||defaultPrintErr;Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module[\"arguments\"])arguments_=Module[\"arguments\"];if(Module[\"thisProgram\"])thisProgram=Module[\"thisProgram\"];if(Module[\"quit\"])quit_=Module[\"quit\"];var POINTER_SIZE=4;var Atomics_load=Atomics.load;var Atomics_store=Atomics.store;var Atomics_compareExchange=Atomics.compareExchange;var wasmBinary;if(Module[\"wasmBinary\"])wasmBinary=Module[\"wasmBinary\"];var noExitRuntime=Module[\"noExitRuntime\"]||true;if(typeof WebAssembly!=\"object\"){abort(\"no native wasm support detected\")}var wasmMemory;var wasmModule;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort(text)}}var UTF8Decoder=typeof TextDecoder!=\"undefined\"?new TextDecoder(\"utf8\"):undefined;function UTF8ArrayToString(heapOrArray,idx,maxBytesToRead){var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heapOrArray[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.buffer instanceof SharedArrayBuffer?heapOrArray.slice(idx,endPtr):heapOrArray.subarray(idx,endPtr))}var str=\"\";while(idx>10,56320|ch&1023)}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(GROWABLE_HEAP_U8(),ptr,maxBytesToRead):\"\"}function stringToUTF8Array(str,heap,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,GROWABLE_HEAP_U8(),outPtr,maxBytesToWrite)}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;if(ENVIRONMENT_IS_PTHREAD){buffer=Module[\"buffer\"]}function updateGlobalBufferAndViews(buf){buffer=buf;Module[\"HEAP8\"]=HEAP8=new Int8Array(buf);Module[\"HEAP16\"]=HEAP16=new Int16Array(buf);Module[\"HEAP32\"]=HEAP32=new Int32Array(buf);Module[\"HEAPU8\"]=HEAPU8=new Uint8Array(buf);Module[\"HEAPU16\"]=HEAPU16=new Uint16Array(buf);Module[\"HEAPU32\"]=HEAPU32=new Uint32Array(buf);Module[\"HEAPF32\"]=HEAPF32=new Float32Array(buf);Module[\"HEAPF64\"]=HEAPF64=new Float64Array(buf)}var INITIAL_MEMORY=Module[\"INITIAL_MEMORY\"]||16777216;if(ENVIRONMENT_IS_PTHREAD){wasmMemory=Module[\"wasmMemory\"];buffer=Module[\"buffer\"]}else{if(Module[\"wasmMemory\"]){wasmMemory=Module[\"wasmMemory\"]}else{wasmMemory=new WebAssembly.Memory({\"initial\":INITIAL_MEMORY/65536,\"maximum\":2147483648/65536,\"shared\":true});if(!(wasmMemory.buffer instanceof SharedArrayBuffer)){err(\"requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag\");if(ENVIRONMENT_IS_NODE){console.log(\"(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)\")}throw Error(\"bad memory\")}}}if(wasmMemory){buffer=wasmMemory.buffer}INITIAL_MEMORY=buffer.byteLength;updateGlobalBufferAndViews(buffer);var wasmTable;var __ATPRERUN__=[];var __ATINIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function keepRuntimeAlive(){return noExitRuntime}function preRun(){if(Module[\"preRun\"]){if(typeof Module[\"preRun\"]==\"function\")Module[\"preRun\"]=[Module[\"preRun\"]];while(Module[\"preRun\"].length){addOnPreRun(Module[\"preRun\"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;if(ENVIRONMENT_IS_PTHREAD)return;callRuntimeCallbacks(__ATINIT__)}function postRun(){if(ENVIRONMENT_IS_PTHREAD)return;if(Module[\"postRun\"]){if(typeof Module[\"postRun\"]==\"function\")Module[\"postRun\"]=[Module[\"postRun\"]];while(Module[\"postRun\"].length){addOnPostRun(Module[\"postRun\"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnInit(cb){__ATINIT__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function addRunDependency(id){runDependencies++;if(Module[\"monitorRunDependencies\"]){Module[\"monitorRunDependencies\"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module[\"monitorRunDependencies\"]){Module[\"monitorRunDependencies\"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){if(ENVIRONMENT_IS_PTHREAD){postMessage({\"cmd\":\"onAbort\",\"arg\":what})}else{if(Module[\"onAbort\"]){Module[\"onAbort\"](what)}}what=\"Aborted(\"+what+\")\";err(what);ABORT=true;EXITSTATUS=1;what+=\". Build with -sASSERTIONS for more info.\";var e=new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e}var dataURIPrefix=\"data:application/octet-stream;base64,\";function isDataURI(filename){return filename.startsWith(dataURIPrefix)}function isFileURI(filename){return filename.startsWith(\"file://\")}var wasmBinaryFile;wasmBinaryFile=\"tfjs-backend-wasm-threaded-simd.wasm\";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(file){try{if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw\"both async and sync fetching of the wasm failed\"}catch(err){abort(err)}}function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch==\"function\"&&!isFileURI(wasmBinaryFile)){return fetch(wasmBinaryFile,{credentials:\"same-origin\"}).then(function(response){if(!response[\"ok\"]){throw\"failed to load wasm binary file at '\"+wasmBinaryFile+\"'\"}return response[\"arrayBuffer\"]()}).catch(function(){return getBinary(wasmBinaryFile)})}else{if(readAsync){return new Promise(function(resolve,reject){readAsync(wasmBinaryFile,function(response){resolve(new Uint8Array(response))},reject)})}}}return Promise.resolve().then(function(){return getBinary(wasmBinaryFile)})}function createWasm(){var info={\"env\":asmLibraryArg,\"wasi_snapshot_preview1\":asmLibraryArg};function receiveInstance(instance,module){var exports=instance.exports;Module[\"asm\"]=exports;registerTLSInit(Module[\"asm\"][\"_emscripten_tls_init\"]);wasmTable=Module[\"asm\"][\"__indirect_function_table\"];addOnInit(Module[\"asm\"][\"__wasm_call_ctors\"]);wasmModule=module;if(!ENVIRONMENT_IS_PTHREAD){var numWorkersToLoad=PThread.unusedWorkers.length;PThread.unusedWorkers.forEach(function(w){PThread.loadWasmModuleToWorker(w,function(){if(!--numWorkersToLoad)removeRunDependency(\"wasm-instantiate\")})})}}if(!ENVIRONMENT_IS_PTHREAD){addRunDependency(\"wasm-instantiate\")}function receiveInstantiationResult(result){receiveInstance(result[\"instance\"],result[\"module\"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(function(instance){return instance}).then(receiver,function(reason){err(\"failed to asynchronously prepare wasm: \"+reason);abort(reason)})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming==\"function\"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&!ENVIRONMENT_IS_NODE&&typeof fetch==\"function\"){return fetch(wasmBinaryFile,{credentials:\"same-origin\"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiationResult,function(reason){err(\"wasm streaming compile failed: \"+reason);err(\"falling back to ArrayBuffer instantiation\");return instantiateArrayBuffer(receiveInstantiationResult)})})}else{return instantiateArrayBuffer(receiveInstantiationResult)}}if(Module[\"instantiateWasm\"]){try{var exports=Module[\"instantiateWasm\"](info,receiveInstance);return exports}catch(e){err(\"Module.instantiateWasm callback failed with error: \"+e);readyPromiseReject(e)}}instantiateAsync().catch(readyPromiseReject);return{}}var tempDouble;var tempI64;var ASM_CONSTS={};function ExitStatus(status){this.name=\"ExitStatus\";this.message=\"Program terminated with exit(\"+status+\")\";this.status=status}function killThread(pthread_ptr){var worker=PThread.pthreads[pthread_ptr];delete PThread.pthreads[pthread_ptr];worker.terminate();__emscripten_thread_free_data(pthread_ptr);PThread.runningWorkers.splice(PThread.runningWorkers.indexOf(worker),1);worker.pthread_ptr=0}function cancelThread(pthread_ptr){var worker=PThread.pthreads[pthread_ptr];worker.postMessage({\"cmd\":\"cancel\"})}function cleanupThread(pthread_ptr){var worker=PThread.pthreads[pthread_ptr];assert(worker);PThread.returnWorkerToPool(worker)}function spawnThread(threadParams){var worker=PThread.getNewWorker();if(!worker){return 6}PThread.runningWorkers.push(worker);PThread.pthreads[threadParams.pthread_ptr]=worker;worker.pthread_ptr=threadParams.pthread_ptr;var msg={\"cmd\":\"run\",\"start_routine\":threadParams.startRoutine,\"arg\":threadParams.arg,\"pthread_ptr\":threadParams.pthread_ptr};worker.runPthread=()=>{msg.time=performance.now();worker.postMessage(msg,threadParams.transferList)};if(worker.loaded){worker.runPthread();delete worker.runPthread}return 0}var SYSCALLS={varargs:undefined,get:function(){SYSCALLS.varargs+=4;var ret=GROWABLE_HEAP_I32()[SYSCALLS.varargs-4>>2];return ret},getStr:function(ptr){var ret=UTF8ToString(ptr);return ret}};function _proc_exit(code){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(1,1,code);EXITSTATUS=code;if(!keepRuntimeAlive()){PThread.terminateAllThreads();if(Module[\"onExit\"])Module[\"onExit\"](code);ABORT=true}quit_(code,new ExitStatus(code))}function exitJS(status,implicit){EXITSTATUS=status;if(!implicit){if(ENVIRONMENT_IS_PTHREAD){exitOnMainThread(status);throw\"unwind\"}else{}}_proc_exit(status)}var _exit=exitJS;function handleException(e){if(e instanceof ExitStatus||e==\"unwind\"){return EXITSTATUS}quit_(1,e)}var PThread={unusedWorkers:[],runningWorkers:[],tlsInitFunctions:[],pthreads:{},init:function(){if(ENVIRONMENT_IS_PTHREAD){PThread.initWorker()}else{PThread.initMainThread()}},initMainThread:function(){var pthreadPoolSize=8;while(pthreadPoolSize--){PThread.allocateUnusedWorker()}},initWorker:function(){noExitRuntime=false},setExitStatus:function(status){EXITSTATUS=status},terminateAllThreads:function(){for(var worker of Object.values(PThread.pthreads)){PThread.returnWorkerToPool(worker)}for(var worker of PThread.unusedWorkers){worker.terminate()}PThread.unusedWorkers=[]},returnWorkerToPool:function(worker){var pthread_ptr=worker.pthread_ptr;delete PThread.pthreads[pthread_ptr];PThread.unusedWorkers.push(worker);PThread.runningWorkers.splice(PThread.runningWorkers.indexOf(worker),1);worker.pthread_ptr=0;__emscripten_thread_free_data(pthread_ptr)},receiveObjectTransfer:function(data){},threadInitTLS:function(){PThread.tlsInitFunctions.forEach(f=>f())},loadWasmModuleToWorker:function(worker,onFinishedLoading){worker.onmessage=e=>{var d=e[\"data\"];var cmd=d[\"cmd\"];if(worker.pthread_ptr)PThread.currentProxiedOperationCallerThread=worker.pthread_ptr;if(d[\"targetThread\"]&&d[\"targetThread\"]!=_pthread_self()){var targetWorker=PThread.pthreads[d.targetThread];if(targetWorker){targetWorker.postMessage(d,d[\"transferList\"])}else{err('Internal error! Worker sent a message \"'+cmd+'\" to target pthread '+d[\"targetThread\"]+\", but that thread no longer exists!\")}PThread.currentProxiedOperationCallerThread=undefined;return}if(cmd===\"processProxyingQueue\"){executeNotifiedProxyingQueue(d[\"queue\"])}else if(cmd===\"spawnThread\"){spawnThread(d)}else if(cmd===\"cleanupThread\"){cleanupThread(d[\"thread\"])}else if(cmd===\"killThread\"){killThread(d[\"thread\"])}else if(cmd===\"cancelThread\"){cancelThread(d[\"thread\"])}else if(cmd===\"loaded\"){worker.loaded=true;if(onFinishedLoading)onFinishedLoading(worker);if(worker.runPthread){worker.runPthread();delete worker.runPthread}}else if(cmd===\"print\"){out(\"Thread \"+d[\"threadId\"]+\": \"+d[\"text\"])}else if(cmd===\"printErr\"){err(\"Thread \"+d[\"threadId\"]+\": \"+d[\"text\"])}else if(cmd===\"alert\"){alert(\"Thread \"+d[\"threadId\"]+\": \"+d[\"text\"])}else if(d.target===\"setimmediate\"){worker.postMessage(d)}else if(cmd===\"onAbort\"){if(Module[\"onAbort\"]){Module[\"onAbort\"](d[\"arg\"])}}else if(cmd){err(\"worker sent an unknown command \"+cmd)}PThread.currentProxiedOperationCallerThread=undefined};worker.onerror=e=>{var message=\"worker sent an error!\";err(message+\" \"+e.filename+\":\"+e.lineno+\": \"+e.message);throw e};if(ENVIRONMENT_IS_NODE){worker.on(\"message\",function(data){worker.onmessage({data:data})});worker.on(\"error\",function(e){worker.onerror(e)});worker.on(\"detachedExit\",function(){})}worker.postMessage({\"cmd\":\"load\",\"urlOrBlob\":Module[\"mainScriptUrlOrBlob\"]||_scriptDir,\"wasmMemory\":wasmMemory,\"wasmModule\":wasmModule})},allocateUnusedWorker:function(){var pthreadMainJs=locateFile(\"tfjs-backend-wasm-threaded-simd.worker.js\");PThread.unusedWorkers.push(new Worker(pthreadMainJs))},getNewWorker:function(){if(PThread.unusedWorkers.length==0){PThread.allocateUnusedWorker();PThread.loadWasmModuleToWorker(PThread.unusedWorkers[0])}return PThread.unusedWorkers.pop()}};Module[\"PThread\"]=PThread;function callRuntimeCallbacks(callbacks){while(callbacks.length>0){callbacks.shift()(Module)}}function withStackSave(f){var stack=stackSave();var ret=f();stackRestore(stack);return ret}function demangle(func){return func}function demangleAll(text){var regex=/\\b_Z[\\w\\d_]+/g;return text.replace(regex,function(x){var y=demangle(x);return x===y?x:y+\" [\"+x+\"]\"})}function establishStackSpace(){var pthread_ptr=_pthread_self();var stackTop=GROWABLE_HEAP_I32()[pthread_ptr+44>>2];var stackSize=GROWABLE_HEAP_I32()[pthread_ptr+48>>2];var stackMax=stackTop-stackSize;_emscripten_stack_set_limits(stackTop,stackMax);stackRestore(stackTop)}Module[\"establishStackSpace\"]=establishStackSpace;function exitOnMainThread(returnCode){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(2,0,returnCode);try{_exit(returnCode)}catch(e){handleException(e)}}var wasmTableMirror=[];function getWasmTableEntry(funcPtr){var func=wasmTableMirror[funcPtr];if(!func){if(funcPtr>=wasmTableMirror.length)wasmTableMirror.length=funcPtr+1;wasmTableMirror[funcPtr]=func=wasmTable.get(funcPtr)}return func}function invokeEntryPoint(ptr,arg){var result=getWasmTableEntry(ptr)(arg);if(keepRuntimeAlive()){PThread.setExitStatus(result)}else{__emscripten_thread_exit(result)}}Module[\"invokeEntryPoint\"]=invokeEntryPoint;function jsStackTrace(){var error=new Error;if(!error.stack){try{throw new Error}catch(e){error=e}if(!error.stack){return\"(no stack trace available)\"}}return error.stack.toString()}function registerTLSInit(tlsInitFunc){PThread.tlsInitFunctions.push(tlsInitFunc)}function writeArrayToMemory(array,buffer){GROWABLE_HEAP_I8().set(array,buffer)}function ___emscripten_init_main_thread_js(tb){__emscripten_thread_init(tb,!ENVIRONMENT_IS_WORKER,1,!ENVIRONMENT_IS_WEB);PThread.threadInitTLS()}function ___emscripten_thread_cleanup(thread){if(!ENVIRONMENT_IS_PTHREAD)cleanupThread(thread);else postMessage({\"cmd\":\"cleanupThread\",\"thread\":thread})}function pthreadCreateProxied(pthread_ptr,attr,startRoutine,arg){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(3,1,pthread_ptr,attr,startRoutine,arg);return ___pthread_create_js(pthread_ptr,attr,startRoutine,arg)}function ___pthread_create_js(pthread_ptr,attr,startRoutine,arg){if(typeof SharedArrayBuffer==\"undefined\"){err(\"Current environment does not support SharedArrayBuffer, pthreads are not available!\");return 6}var transferList=[];var error=0;if(ENVIRONMENT_IS_PTHREAD&&(transferList.length===0||error)){return pthreadCreateProxied(pthread_ptr,attr,startRoutine,arg)}if(error)return error;var threadParams={startRoutine:startRoutine,pthread_ptr:pthread_ptr,arg:arg,transferList:transferList};if(ENVIRONMENT_IS_PTHREAD){threadParams.cmd=\"spawnThread\";postMessage(threadParams,transferList);return 0}return spawnThread(threadParams)}function __emscripten_default_pthread_stack_size(){return 2097152}var nowIsMonotonic=true;function __emscripten_get_now_is_monotonic(){return nowIsMonotonic}function executeNotifiedProxyingQueue(queue){Atomics.store(GROWABLE_HEAP_I32(),queue>>2,1);if(_pthread_self()){__emscripten_proxy_execute_task_queue(queue)}Atomics.compareExchange(GROWABLE_HEAP_I32(),queue>>2,1,0)}Module[\"executeNotifiedProxyingQueue\"]=executeNotifiedProxyingQueue;function __emscripten_notify_task_queue(targetThreadId,currThreadId,mainThreadId,queue){if(targetThreadId==currThreadId){setTimeout(()=>executeNotifiedProxyingQueue(queue))}else if(ENVIRONMENT_IS_PTHREAD){postMessage({\"targetThread\":targetThreadId,\"cmd\":\"processProxyingQueue\",\"queue\":queue})}else{var worker=PThread.pthreads[targetThreadId];if(!worker){return}worker.postMessage({\"cmd\":\"processProxyingQueue\",\"queue\":queue})}return 1}function __emscripten_set_offscreencanvas_size(target,width,height){return-1}function _abort(){abort(\"\")}function warnOnce(text){if(!warnOnce.shown)warnOnce.shown={};if(!warnOnce.shown[text]){warnOnce.shown[text]=1;if(ENVIRONMENT_IS_NODE)text=\"warning: \"+text;err(text)}}function _emscripten_check_blocking_allowed(){if(ENVIRONMENT_IS_NODE)return;if(ENVIRONMENT_IS_WORKER)return;warnOnce(\"Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread\")}function _emscripten_date_now(){return Date.now()}function getHeapMax(){return 2147483648}function _emscripten_get_heap_max(){return getHeapMax()}var _emscripten_get_now;if(ENVIRONMENT_IS_NODE){_emscripten_get_now=()=>{var t=process[\"hrtime\"]();return t[0]*1e3+t[1]/1e6}}else if(ENVIRONMENT_IS_PTHREAD){_emscripten_get_now=()=>performance.now()-Module[\"__performance_now_clock_drift\"]}else _emscripten_get_now=()=>performance.now();function _emscripten_memcpy_big(dest,src,num){GROWABLE_HEAP_U8().copyWithin(dest,src,src+num)}function _emscripten_num_logical_cores(){if(ENVIRONMENT_IS_NODE)return require(\"os\").cpus().length;return navigator[\"hardwareConcurrency\"]}function _emscripten_proxy_to_main_thread_js(index,sync){var numCallArgs=arguments.length-2;var outerArgs=arguments;return withStackSave(()=>{var serializedNumCallArgs=numCallArgs;var args=stackAlloc(serializedNumCallArgs*8);var b=args>>3;for(var i=0;i>3;for(var i=0;i>>16);updateGlobalBufferAndViews(wasmMemory.buffer);return 1}catch(e){}}function _emscripten_resize_heap(requestedSize){var oldSize=GROWABLE_HEAP_U8().length;requestedSize=requestedSize>>>0;if(requestedSize<=oldSize){return false}var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}let alignUp=(x,multiple)=>x+(multiple-x%multiple)%multiple;for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignUp(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=emscripten_realloc_buffer(newSize);if(replacement){return true}}return false}function _emscripten_unwind_to_js_event_loop(){throw\"unwind\"}function _fd_close(fd){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(4,1,fd);return 52}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(5,1,fd,offset_low,offset_high,whence,newOffset);return 70}var printCharBuffers=[null,[],[]];function printChar(stream,curr){var buffer=printCharBuffers[stream];if(curr===0||curr===10){(stream===1?out:err)(UTF8ArrayToString(buffer,0));buffer.length=0}else{buffer.push(curr)}}function _fd_write(fd,iov,iovcnt,pnum){if(ENVIRONMENT_IS_PTHREAD)return _emscripten_proxy_to_main_thread_js(6,1,fd,iov,iovcnt,pnum);var num=0;for(var i=0;i>2];var len=GROWABLE_HEAP_U32()[iov+4>>2];iov+=8;for(var j=0;j>2]=num;return 0}function getCFunc(ident){var func=Module[\"_\"+ident];return func}function ccall(ident,returnType,argTypes,args,opts){var toC={\"string\":str=>{var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=stackAlloc(len);stringToUTF8(str,ret,len)}return ret},\"array\":arr=>{var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType===\"string\"){return UTF8ToString(ret)}if(returnType===\"boolean\")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;itype===\"number\"||type===\"boolean\");var numericRet=returnType!==\"string\";if(numericRet&&numericArgs&&!opts){return getCFunc(ident)}return function(){return ccall(ident,returnType,argTypes,arguments,opts)}}PThread.init();var proxiedFunctionTable=[null,_proc_exit,exitOnMainThread,pthreadCreateProxied,_fd_close,_fd_seek,_fd_write];var asmLibraryArg={\"__emscripten_init_main_thread_js\":___emscripten_init_main_thread_js,\"__emscripten_thread_cleanup\":___emscripten_thread_cleanup,\"__pthread_create_js\":___pthread_create_js,\"_emscripten_default_pthread_stack_size\":__emscripten_default_pthread_stack_size,\"_emscripten_get_now_is_monotonic\":__emscripten_get_now_is_monotonic,\"_emscripten_notify_task_queue\":__emscripten_notify_task_queue,\"_emscripten_set_offscreencanvas_size\":__emscripten_set_offscreencanvas_size,\"abort\":_abort,\"emscripten_check_blocking_allowed\":_emscripten_check_blocking_allowed,\"emscripten_date_now\":_emscripten_date_now,\"emscripten_get_heap_max\":_emscripten_get_heap_max,\"emscripten_get_now\":_emscripten_get_now,\"emscripten_memcpy_big\":_emscripten_memcpy_big,\"emscripten_num_logical_cores\":_emscripten_num_logical_cores,\"emscripten_receive_on_main_thread_js\":_emscripten_receive_on_main_thread_js,\"emscripten_resize_heap\":_emscripten_resize_heap,\"emscripten_unwind_to_js_event_loop\":_emscripten_unwind_to_js_event_loop,\"exit\":_exit,\"fd_close\":_fd_close,\"fd_seek\":_fd_seek,\"fd_write\":_fd_write,\"memory\":wasmMemory||Module[\"wasmMemory\"]};var asm=createWasm();var ___wasm_call_ctors=Module[\"___wasm_call_ctors\"]=function(){return(___wasm_call_ctors=Module[\"___wasm_call_ctors\"]=Module[\"asm\"][\"__wasm_call_ctors\"]).apply(null,arguments)};var _init=Module[\"_init\"]=function(){return(_init=Module[\"_init\"]=Module[\"asm\"][\"init\"]).apply(null,arguments)};var _init_with_threads_count=Module[\"_init_with_threads_count\"]=function(){return(_init_with_threads_count=Module[\"_init_with_threads_count\"]=Module[\"asm\"][\"init_with_threads_count\"]).apply(null,arguments)};var _get_threads_count=Module[\"_get_threads_count\"]=function(){return(_get_threads_count=Module[\"_get_threads_count\"]=Module[\"asm\"][\"get_threads_count\"]).apply(null,arguments)};var _register_tensor=Module[\"_register_tensor\"]=function(){return(_register_tensor=Module[\"_register_tensor\"]=Module[\"asm\"][\"register_tensor\"]).apply(null,arguments)};var _dispose_data=Module[\"_dispose_data\"]=function(){return(_dispose_data=Module[\"_dispose_data\"]=Module[\"asm\"][\"dispose_data\"]).apply(null,arguments)};var _dispose=Module[\"_dispose\"]=function(){return(_dispose=Module[\"_dispose\"]=Module[\"asm\"][\"dispose\"]).apply(null,arguments)};var _Abs=Module[\"_Abs\"]=function(){return(_Abs=Module[\"_Abs\"]=Module[\"asm\"][\"Abs\"]).apply(null,arguments)};var _Add=Module[\"_Add\"]=function(){return(_Add=Module[\"_Add\"]=Module[\"asm\"][\"Add\"]).apply(null,arguments)};var _AddN=Module[\"_AddN\"]=function(){return(_AddN=Module[\"_AddN\"]=Module[\"asm\"][\"AddN\"]).apply(null,arguments)};var _All=Module[\"_All\"]=function(){return(_All=Module[\"_All\"]=Module[\"asm\"][\"All\"]).apply(null,arguments)};var _Any=Module[\"_Any\"]=function(){return(_Any=Module[\"_Any\"]=Module[\"asm\"][\"Any\"]).apply(null,arguments)};var _ArgMax=Module[\"_ArgMax\"]=function(){return(_ArgMax=Module[\"_ArgMax\"]=Module[\"asm\"][\"ArgMax\"]).apply(null,arguments)};var _AvgPool=Module[\"_AvgPool\"]=function(){return(_AvgPool=Module[\"_AvgPool\"]=Module[\"asm\"][\"AvgPool\"]).apply(null,arguments)};var _BatchMatMul=Module[\"_BatchMatMul\"]=function(){return(_BatchMatMul=Module[\"_BatchMatMul\"]=Module[\"asm\"][\"BatchMatMul\"]).apply(null,arguments)};var _Ceil=Module[\"_Ceil\"]=function(){return(_Ceil=Module[\"_Ceil\"]=Module[\"asm\"][\"Ceil\"]).apply(null,arguments)};var _ClipByValue=Module[\"_ClipByValue\"]=function(){return(_ClipByValue=Module[\"_ClipByValue\"]=Module[\"asm\"][\"ClipByValue\"]).apply(null,arguments)};var _Conv2D=Module[\"_Conv2D\"]=function(){return(_Conv2D=Module[\"_Conv2D\"]=Module[\"asm\"][\"Conv2D\"]).apply(null,arguments)};var _Conv2DBackpropInput=Module[\"_Conv2DBackpropInput\"]=function(){return(_Conv2DBackpropInput=Module[\"_Conv2DBackpropInput\"]=Module[\"asm\"][\"Conv2DBackpropInput\"]).apply(null,arguments)};var _Cos=Module[\"_Cos\"]=function(){return(_Cos=Module[\"_Cos\"]=Module[\"asm\"][\"Cos\"]).apply(null,arguments)};var _Cosh=Module[\"_Cosh\"]=function(){return(_Cosh=Module[\"_Cosh\"]=Module[\"asm\"][\"Cosh\"]).apply(null,arguments)};var _CropAndResize=Module[\"_CropAndResize\"]=function(){return(_CropAndResize=Module[\"_CropAndResize\"]=Module[\"asm\"][\"CropAndResize\"]).apply(null,arguments)};var _Cumprod=Module[\"_Cumprod\"]=function(){return(_Cumprod=Module[\"_Cumprod\"]=Module[\"asm\"][\"Cumprod\"]).apply(null,arguments)};var _Cumsum=Module[\"_Cumsum\"]=function(){return(_Cumsum=Module[\"_Cumsum\"]=Module[\"asm\"][\"Cumsum\"]).apply(null,arguments)};var _DepthToSpace=Module[\"_DepthToSpace\"]=function(){return(_DepthToSpace=Module[\"_DepthToSpace\"]=Module[\"asm\"][\"DepthToSpace\"]).apply(null,arguments)};var _DepthwiseConv2dNative=Module[\"_DepthwiseConv2dNative\"]=function(){return(_DepthwiseConv2dNative=Module[\"_DepthwiseConv2dNative\"]=Module[\"asm\"][\"DepthwiseConv2dNative\"]).apply(null,arguments)};var _Elu=Module[\"_Elu\"]=function(){return(_Elu=Module[\"_Elu\"]=Module[\"asm\"][\"Elu\"]).apply(null,arguments)};var _Equal=Module[\"_Equal\"]=function(){return(_Equal=Module[\"_Equal\"]=Module[\"asm\"][\"Equal\"]).apply(null,arguments)};var _Exp=Module[\"_Exp\"]=function(){return(_Exp=Module[\"_Exp\"]=Module[\"asm\"][\"Exp\"]).apply(null,arguments)};var _FlipLeftRight=Module[\"_FlipLeftRight\"]=function(){return(_FlipLeftRight=Module[\"_FlipLeftRight\"]=Module[\"asm\"][\"FlipLeftRight\"]).apply(null,arguments)};var _Floor=Module[\"_Floor\"]=function(){return(_Floor=Module[\"_Floor\"]=Module[\"asm\"][\"Floor\"]).apply(null,arguments)};var _FloorDiv=Module[\"_FloorDiv\"]=function(){return(_FloorDiv=Module[\"_FloorDiv\"]=Module[\"asm\"][\"FloorDiv\"]).apply(null,arguments)};var _FusedBatchNorm=Module[\"_FusedBatchNorm\"]=function(){return(_FusedBatchNorm=Module[\"_FusedBatchNorm\"]=Module[\"asm\"][\"FusedBatchNorm\"]).apply(null,arguments)};var _FusedConv2D=Module[\"_FusedConv2D\"]=function(){return(_FusedConv2D=Module[\"_FusedConv2D\"]=Module[\"asm\"][\"FusedConv2D\"]).apply(null,arguments)};var _FusedDepthwiseConv2D=Module[\"_FusedDepthwiseConv2D\"]=function(){return(_FusedDepthwiseConv2D=Module[\"_FusedDepthwiseConv2D\"]=Module[\"asm\"][\"FusedDepthwiseConv2D\"]).apply(null,arguments)};var _Gather=Module[\"_Gather\"]=function(){return(_Gather=Module[\"_Gather\"]=Module[\"asm\"][\"Gather\"]).apply(null,arguments)};var _GatherNd=Module[\"_GatherNd\"]=function(){return(_GatherNd=Module[\"_GatherNd\"]=Module[\"asm\"][\"GatherNd\"]).apply(null,arguments)};var _Greater=Module[\"_Greater\"]=function(){return(_Greater=Module[\"_Greater\"]=Module[\"asm\"][\"Greater\"]).apply(null,arguments)};var _GreaterEqual=Module[\"_GreaterEqual\"]=function(){return(_GreaterEqual=Module[\"_GreaterEqual\"]=Module[\"asm\"][\"GreaterEqual\"]).apply(null,arguments)};var _LeakyRelu=Module[\"_LeakyRelu\"]=function(){return(_LeakyRelu=Module[\"_LeakyRelu\"]=Module[\"asm\"][\"LeakyRelu\"]).apply(null,arguments)};var _Less=Module[\"_Less\"]=function(){return(_Less=Module[\"_Less\"]=Module[\"asm\"][\"Less\"]).apply(null,arguments)};var _LessEqual=Module[\"_LessEqual\"]=function(){return(_LessEqual=Module[\"_LessEqual\"]=Module[\"asm\"][\"LessEqual\"]).apply(null,arguments)};var _Log=Module[\"_Log\"]=function(){return(_Log=Module[\"_Log\"]=Module[\"asm\"][\"Log\"]).apply(null,arguments)};var _LogicalAnd=Module[\"_LogicalAnd\"]=function(){return(_LogicalAnd=Module[\"_LogicalAnd\"]=Module[\"asm\"][\"LogicalAnd\"]).apply(null,arguments)};var _LogicalNot=Module[\"_LogicalNot\"]=function(){return(_LogicalNot=Module[\"_LogicalNot\"]=Module[\"asm\"][\"LogicalNot\"]).apply(null,arguments)};var _LogicalOr=Module[\"_LogicalOr\"]=function(){return(_LogicalOr=Module[\"_LogicalOr\"]=Module[\"asm\"][\"LogicalOr\"]).apply(null,arguments)};var _LogicalXor=Module[\"_LogicalXor\"]=function(){return(_LogicalXor=Module[\"_LogicalXor\"]=Module[\"asm\"][\"LogicalXor\"]).apply(null,arguments)};var _Max=Module[\"_Max\"]=function(){return(_Max=Module[\"_Max\"]=Module[\"asm\"][\"Max\"]).apply(null,arguments)};var _MaxPool=Module[\"_MaxPool\"]=function(){return(_MaxPool=Module[\"_MaxPool\"]=Module[\"asm\"][\"MaxPool\"]).apply(null,arguments)};var _Maximum=Module[\"_Maximum\"]=function(){return(_Maximum=Module[\"_Maximum\"]=Module[\"asm\"][\"Maximum\"]).apply(null,arguments)};var _Mean=Module[\"_Mean\"]=function(){return(_Mean=Module[\"_Mean\"]=Module[\"asm\"][\"Mean\"]).apply(null,arguments)};var _Min=Module[\"_Min\"]=function(){return(_Min=Module[\"_Min\"]=Module[\"asm\"][\"Min\"]).apply(null,arguments)};var _Minimum=Module[\"_Minimum\"]=function(){return(_Minimum=Module[\"_Minimum\"]=Module[\"asm\"][\"Minimum\"]).apply(null,arguments)};var _MirrorPad=Module[\"_MirrorPad\"]=function(){return(_MirrorPad=Module[\"_MirrorPad\"]=Module[\"asm\"][\"MirrorPad\"]).apply(null,arguments)};var _Multiply=Module[\"_Multiply\"]=function(){return(_Multiply=Module[\"_Multiply\"]=Module[\"asm\"][\"Multiply\"]).apply(null,arguments)};var _Neg=Module[\"_Neg\"]=function(){return(_Neg=Module[\"_Neg\"]=Module[\"asm\"][\"Neg\"]).apply(null,arguments)};var _NonMaxSuppressionV3=Module[\"_NonMaxSuppressionV3\"]=function(){return(_NonMaxSuppressionV3=Module[\"_NonMaxSuppressionV3\"]=Module[\"asm\"][\"NonMaxSuppressionV3\"]).apply(null,arguments)};var _NonMaxSuppressionV4=Module[\"_NonMaxSuppressionV4\"]=function(){return(_NonMaxSuppressionV4=Module[\"_NonMaxSuppressionV4\"]=Module[\"asm\"][\"NonMaxSuppressionV4\"]).apply(null,arguments)};var _NonMaxSuppressionV5=Module[\"_NonMaxSuppressionV5\"]=function(){return(_NonMaxSuppressionV5=Module[\"_NonMaxSuppressionV5\"]=Module[\"asm\"][\"NonMaxSuppressionV5\"]).apply(null,arguments)};var _NotEqual=Module[\"_NotEqual\"]=function(){return(_NotEqual=Module[\"_NotEqual\"]=Module[\"asm\"][\"NotEqual\"]).apply(null,arguments)};var _OneHot=Module[\"_OneHot\"]=function(){return(_OneHot=Module[\"_OneHot\"]=Module[\"asm\"][\"OneHot\"]).apply(null,arguments)};var _PadV2=Module[\"_PadV2\"]=function(){return(_PadV2=Module[\"_PadV2\"]=Module[\"asm\"][\"PadV2\"]).apply(null,arguments)};var _Pow=Module[\"_Pow\"]=function(){return(_Pow=Module[\"_Pow\"]=Module[\"asm\"][\"Pow\"]).apply(null,arguments)};var _Prelu=Module[\"_Prelu\"]=function(){return(_Prelu=Module[\"_Prelu\"]=Module[\"asm\"][\"Prelu\"]).apply(null,arguments)};var _Prod=Module[\"_Prod\"]=function(){return(_Prod=Module[\"_Prod\"]=Module[\"asm\"][\"Prod\"]).apply(null,arguments)};var _RealDiv=Module[\"_RealDiv\"]=function(){return(_RealDiv=Module[\"_RealDiv\"]=Module[\"asm\"][\"RealDiv\"]).apply(null,arguments)};var _Relu=Module[\"_Relu\"]=function(){return(_Relu=Module[\"_Relu\"]=Module[\"asm\"][\"Relu\"]).apply(null,arguments)};var _Relu6=Module[\"_Relu6\"]=function(){return(_Relu6=Module[\"_Relu6\"]=Module[\"asm\"][\"Relu6\"]).apply(null,arguments)};var _ResizeBilinear=Module[\"_ResizeBilinear\"]=function(){return(_ResizeBilinear=Module[\"_ResizeBilinear\"]=Module[\"asm\"][\"ResizeBilinear\"]).apply(null,arguments)};var _ResizeNearestNeighbor=Module[\"_ResizeNearestNeighbor\"]=function(){return(_ResizeNearestNeighbor=Module[\"_ResizeNearestNeighbor\"]=Module[\"asm\"][\"ResizeNearestNeighbor\"]).apply(null,arguments)};var _Reverse=Module[\"_Reverse\"]=function(){return(_Reverse=Module[\"_Reverse\"]=Module[\"asm\"][\"Reverse\"]).apply(null,arguments)};var _RotateWithOffset=Module[\"_RotateWithOffset\"]=function(){return(_RotateWithOffset=Module[\"_RotateWithOffset\"]=Module[\"asm\"][\"RotateWithOffset\"]).apply(null,arguments)};var _Round=Module[\"_Round\"]=function(){return(_Round=Module[\"_Round\"]=Module[\"asm\"][\"Round\"]).apply(null,arguments)};var _Rsqrt=Module[\"_Rsqrt\"]=function(){return(_Rsqrt=Module[\"_Rsqrt\"]=Module[\"asm\"][\"Rsqrt\"]).apply(null,arguments)};var _ScatterNd=Module[\"_ScatterNd\"]=function(){return(_ScatterNd=Module[\"_ScatterNd\"]=Module[\"asm\"][\"ScatterNd\"]).apply(null,arguments)};var _SelectV2=Module[\"_SelectV2\"]=function(){return(_SelectV2=Module[\"_SelectV2\"]=Module[\"asm\"][\"SelectV2\"]).apply(null,arguments)};var _Sigmoid=Module[\"_Sigmoid\"]=function(){return(_Sigmoid=Module[\"_Sigmoid\"]=Module[\"asm\"][\"Sigmoid\"]).apply(null,arguments)};var _Sin=Module[\"_Sin\"]=function(){return(_Sin=Module[\"_Sin\"]=Module[\"asm\"][\"Sin\"]).apply(null,arguments)};var _Softmax=Module[\"_Softmax\"]=function(){return(_Softmax=Module[\"_Softmax\"]=Module[\"asm\"][\"Softmax\"]).apply(null,arguments)};var _SparseFillEmptyRows=Module[\"_SparseFillEmptyRows\"]=function(){return(_SparseFillEmptyRows=Module[\"_SparseFillEmptyRows\"]=Module[\"asm\"][\"SparseFillEmptyRows\"]).apply(null,arguments)};var _SparseReshape=Module[\"_SparseReshape\"]=function(){return(_SparseReshape=Module[\"_SparseReshape\"]=Module[\"asm\"][\"SparseReshape\"]).apply(null,arguments)};var _SparseSegmentReduction=Module[\"_SparseSegmentReduction\"]=function(){return(_SparseSegmentReduction=Module[\"_SparseSegmentReduction\"]=Module[\"asm\"][\"SparseSegmentReduction\"]).apply(null,arguments)};var _Sqrt=Module[\"_Sqrt\"]=function(){return(_Sqrt=Module[\"_Sqrt\"]=Module[\"asm\"][\"Sqrt\"]).apply(null,arguments)};var _Square=Module[\"_Square\"]=function(){return(_Square=Module[\"_Square\"]=Module[\"asm\"][\"Square\"]).apply(null,arguments)};var _SquaredDifference=Module[\"_SquaredDifference\"]=function(){return(_SquaredDifference=Module[\"_SquaredDifference\"]=Module[\"asm\"][\"SquaredDifference\"]).apply(null,arguments)};var _Step=Module[\"_Step\"]=function(){return(_Step=Module[\"_Step\"]=Module[\"asm\"][\"Step\"]).apply(null,arguments)};var _StridedSlice=Module[\"_StridedSlice\"]=function(){return(_StridedSlice=Module[\"_StridedSlice\"]=Module[\"asm\"][\"StridedSlice\"]).apply(null,arguments)};var _Sub=Module[\"_Sub\"]=function(){return(_Sub=Module[\"_Sub\"]=Module[\"asm\"][\"Sub\"]).apply(null,arguments)};var _Sum=Module[\"_Sum\"]=function(){return(_Sum=Module[\"_Sum\"]=Module[\"asm\"][\"Sum\"]).apply(null,arguments)};var _Tan=Module[\"_Tan\"]=function(){return(_Tan=Module[\"_Tan\"]=Module[\"asm\"][\"Tan\"]).apply(null,arguments)};var _Tanh=Module[\"_Tanh\"]=function(){return(_Tanh=Module[\"_Tanh\"]=Module[\"asm\"][\"Tanh\"]).apply(null,arguments)};var _Tile=Module[\"_Tile\"]=function(){return(_Tile=Module[\"_Tile\"]=Module[\"asm\"][\"Tile\"]).apply(null,arguments)};var _TopK=Module[\"_TopK\"]=function(){return(_TopK=Module[\"_TopK\"]=Module[\"asm\"][\"TopK\"]).apply(null,arguments)};var _Transform=Module[\"_Transform\"]=function(){return(_Transform=Module[\"_Transform\"]=Module[\"asm\"][\"Transform\"]).apply(null,arguments)};var _Transpose=Module[\"_Transpose\"]=function(){return(_Transpose=Module[\"_Transpose\"]=Module[\"asm\"][\"Transpose\"]).apply(null,arguments)};var __FusedMatMul=Module[\"__FusedMatMul\"]=function(){return(__FusedMatMul=Module[\"__FusedMatMul\"]=Module[\"asm\"][\"_FusedMatMul\"]).apply(null,arguments)};var _malloc=Module[\"_malloc\"]=function(){return(_malloc=Module[\"_malloc\"]=Module[\"asm\"][\"malloc\"]).apply(null,arguments)};var _free=Module[\"_free\"]=function(){return(_free=Module[\"_free\"]=Module[\"asm\"][\"free\"]).apply(null,arguments)};var __emscripten_tls_init=Module[\"__emscripten_tls_init\"]=function(){return(__emscripten_tls_init=Module[\"__emscripten_tls_init\"]=Module[\"asm\"][\"_emscripten_tls_init\"]).apply(null,arguments)};var _pthread_self=Module[\"_pthread_self\"]=function(){return(_pthread_self=Module[\"_pthread_self\"]=Module[\"asm\"][\"pthread_self\"]).apply(null,arguments)};var ___errno_location=Module[\"___errno_location\"]=function(){return(___errno_location=Module[\"___errno_location\"]=Module[\"asm\"][\"__errno_location\"]).apply(null,arguments)};var __emscripten_thread_init=Module[\"__emscripten_thread_init\"]=function(){return(__emscripten_thread_init=Module[\"__emscripten_thread_init\"]=Module[\"asm\"][\"_emscripten_thread_init\"]).apply(null,arguments)};var __emscripten_thread_crashed=Module[\"__emscripten_thread_crashed\"]=function(){return(__emscripten_thread_crashed=Module[\"__emscripten_thread_crashed\"]=Module[\"asm\"][\"_emscripten_thread_crashed\"]).apply(null,arguments)};var _emscripten_main_thread_process_queued_calls=Module[\"_emscripten_main_thread_process_queued_calls\"]=function(){return(_emscripten_main_thread_process_queued_calls=Module[\"_emscripten_main_thread_process_queued_calls\"]=Module[\"asm\"][\"emscripten_main_thread_process_queued_calls\"]).apply(null,arguments)};var _emscripten_main_browser_thread_id=Module[\"_emscripten_main_browser_thread_id\"]=function(){return(_emscripten_main_browser_thread_id=Module[\"_emscripten_main_browser_thread_id\"]=Module[\"asm\"][\"emscripten_main_browser_thread_id\"]).apply(null,arguments)};var _emscripten_run_in_main_runtime_thread_js=Module[\"_emscripten_run_in_main_runtime_thread_js\"]=function(){return(_emscripten_run_in_main_runtime_thread_js=Module[\"_emscripten_run_in_main_runtime_thread_js\"]=Module[\"asm\"][\"emscripten_run_in_main_runtime_thread_js\"]).apply(null,arguments)};var _emscripten_dispatch_to_thread_=Module[\"_emscripten_dispatch_to_thread_\"]=function(){return(_emscripten_dispatch_to_thread_=Module[\"_emscripten_dispatch_to_thread_\"]=Module[\"asm\"][\"emscripten_dispatch_to_thread_\"]).apply(null,arguments)};var __emscripten_proxy_execute_task_queue=Module[\"__emscripten_proxy_execute_task_queue\"]=function(){return(__emscripten_proxy_execute_task_queue=Module[\"__emscripten_proxy_execute_task_queue\"]=Module[\"asm\"][\"_emscripten_proxy_execute_task_queue\"]).apply(null,arguments)};var __emscripten_thread_free_data=Module[\"__emscripten_thread_free_data\"]=function(){return(__emscripten_thread_free_data=Module[\"__emscripten_thread_free_data\"]=Module[\"asm\"][\"_emscripten_thread_free_data\"]).apply(null,arguments)};var __emscripten_thread_exit=Module[\"__emscripten_thread_exit\"]=function(){return(__emscripten_thread_exit=Module[\"__emscripten_thread_exit\"]=Module[\"asm\"][\"_emscripten_thread_exit\"]).apply(null,arguments)};var _emscripten_stack_set_limits=Module[\"_emscripten_stack_set_limits\"]=function(){return(_emscripten_stack_set_limits=Module[\"_emscripten_stack_set_limits\"]=Module[\"asm\"][\"emscripten_stack_set_limits\"]).apply(null,arguments)};var stackSave=Module[\"stackSave\"]=function(){return(stackSave=Module[\"stackSave\"]=Module[\"asm\"][\"stackSave\"]).apply(null,arguments)};var stackRestore=Module[\"stackRestore\"]=function(){return(stackRestore=Module[\"stackRestore\"]=Module[\"asm\"][\"stackRestore\"]).apply(null,arguments)};var stackAlloc=Module[\"stackAlloc\"]=function(){return(stackAlloc=Module[\"stackAlloc\"]=Module[\"asm\"][\"stackAlloc\"]).apply(null,arguments)};var dynCall_iijjiiii=Module[\"dynCall_iijjiiii\"]=function(){return(dynCall_iijjiiii=Module[\"dynCall_iijjiiii\"]=Module[\"asm\"][\"dynCall_iijjiiii\"]).apply(null,arguments)};var dynCall_jiji=Module[\"dynCall_jiji\"]=function(){return(dynCall_jiji=Module[\"dynCall_jiji\"]=Module[\"asm\"][\"dynCall_jiji\"]).apply(null,arguments)};Module[\"keepRuntimeAlive\"]=keepRuntimeAlive;Module[\"wasmMemory\"]=wasmMemory;Module[\"cwrap\"]=cwrap;Module[\"ExitStatus\"]=ExitStatus;Module[\"PThread\"]=PThread;var calledRun;dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(args){args=args||arguments_;if(runDependencies>0){return}if(ENVIRONMENT_IS_PTHREAD){readyPromiseResolve(Module);initRuntime();postMessage({\"cmd\":\"loaded\"});return}preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module[\"calledRun\"]=true;if(ABORT)return;initRuntime();readyPromiseResolve(Module);if(Module[\"onRuntimeInitialized\"])Module[\"onRuntimeInitialized\"]();postRun()}if(Module[\"setStatus\"]){Module[\"setStatus\"](\"Running...\");setTimeout(function(){setTimeout(function(){Module[\"setStatus\"](\"\")},1);doRun()},1)}else{doRun()}}if(Module[\"preInit\"]){if(typeof Module[\"preInit\"]==\"function\")Module[\"preInit\"]=[Module[\"preInit\"]];while(Module[\"preInit\"].length>0){Module[\"preInit\"].pop()()}}run();var listenersAdded;if(beforeListeners){listenersAdded={uncaughtException:process.listeners(\"uncaughtException\").filter(function(listener){return!beforeListeners.uncaughtException.indexOf(listener)>-1}),unhandledRejection:process.listeners(\"unhandledRejection\").filter(function(listener){return!beforeListeners.unhandledRejection.indexOf(listener)>-1})}}var actualModule;if(typeof WasmBackendModule!==\"undefined\"){actualModule=WasmBackendModule}else if(typeof WasmBackendModuleThreadedSimd!==\"undefined\"){actualModule=WasmBackendModuleThreadedSimd}else{throw new Error(\"Could not find wasm module in post.js\")}if(listenersAdded){var tmpDispose=actualModule[\"_dispose\"];actualModule[\"_dispose\"]=function(){tmpDispose();listenersAdded.uncaughtException.forEach(function(listener){process.removeListener(\"uncaughtException\",listener)});listenersAdded.unhandledRejection.forEach(function(listener){process.removeListener(\"unhandledRejection\",listener)})}}\n\n\n return WasmBackendModuleThreadedSimd.ready\n}\n);\n})();\nif (typeof exports === 'object' && typeof module === 'object')\n module.exports = WasmBackendModuleThreadedSimd;\nelse if (typeof define === 'function' && define['amd'])\n define([], function() { return WasmBackendModuleThreadedSimd; });\nelse if (typeof exports === 'object')\n exports[\"WasmBackendModuleThreadedSimd\"] = WasmBackendModuleThreadedSimd;\n","module.exports.wasmWorkerContents = `\"use strict\";var Module={};var ENVIRONMENT_IS_NODE=typeof process==\"object\"&&typeof process.versions==\"object\"&&typeof process.versions.node==\"string\";if(ENVIRONMENT_IS_NODE){var nodeWorkerThreads=require(\"worker_threads\");var parentPort=nodeWorkerThreads.parentPort;parentPort.on(\"message\",data=>onmessage({data:data}));var fs=require(\"fs\");Object.assign(global,{self:global,require:require,Module:Module,location:{href:__filename},Worker:nodeWorkerThreads.Worker,importScripts:function(f){(0,eval)(fs.readFileSync(f,\"utf8\"))},postMessage:function(msg){parentPort.postMessage(msg)},performance:global.performance||{now:function(){return Date.now()}}})}var initializedJS=false;var pendingNotifiedProxyingQueues=[];function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(\" \");if(ENVIRONMENT_IS_NODE){fs.writeSync(2,text+\"\\n\");return}console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(\" \");postMessage({cmd:\"alert\",text:text,threadId:Module[\"_pthread_self\"]()})}var err=threadPrintErr;self.alert=threadAlert;Module[\"instantiateWasm\"]=(info,receiveInstance)=>{var instance=new WebAssembly.Instance(Module[\"wasmModule\"],info);receiveInstance(instance);Module[\"wasmModule\"]=null;return instance.exports};self.onunhandledrejection=e=>{throw e.reason??e};self.onmessage=e=>{try{if(e.data.cmd===\"load\"){Module[\"wasmModule\"]=e.data.wasmModule;Module[\"wasmMemory\"]=e.data.wasmMemory;Module[\"buffer\"]=Module[\"wasmMemory\"].buffer;Module[\"ENVIRONMENT_IS_PTHREAD\"]=true;if(typeof e.data.urlOrBlob==\"string\"){importScripts(e.data.urlOrBlob)}else{var objectUrl=URL.createObjectURL(e.data.urlOrBlob);importScripts(objectUrl);URL.revokeObjectURL(objectUrl)}WasmBackendModuleThreadedSimd(Module).then(function(instance){Module=instance})}else if(e.data.cmd===\"run\"){Module[\"__performance_now_clock_drift\"]=performance.now()-e.data.time;Module[\"__emscripten_thread_init\"](e.data.pthread_ptr,0,0,1);Module[\"establishStackSpace\"]();Module[\"PThread\"].receiveObjectTransfer(e.data);Module[\"PThread\"].threadInitTLS();if(!initializedJS){pendingNotifiedProxyingQueues.forEach(queue=>{Module[\"executeNotifiedProxyingQueue\"](queue)});pendingNotifiedProxyingQueues=[];initializedJS=true}try{Module[\"invokeEntryPoint\"](e.data.start_routine,e.data.arg)}catch(ex){if(ex!=\"unwind\"){if(ex instanceof Module[\"ExitStatus\"]){if(Module[\"keepRuntimeAlive\"]()){}else{Module[\"__emscripten_thread_exit\"](ex.status)}}else{throw ex}}}}else if(e.data.cmd===\"cancel\"){if(Module[\"_pthread_self\"]()){Module[\"__emscripten_thread_exit\"](-1)}}else if(e.data.target===\"setimmediate\"){}else if(e.data.cmd===\"processProxyingQueue\"){if(initializedJS){Module[\"executeNotifiedProxyingQueue\"](e.data.queue)}else{pendingNotifiedProxyingQueues.push(e.data.queue)}}else if(e.data.cmd){err(\"worker.js received unknown command \"+e.data.cmd);err(e.data)}}catch(ex){if(Module[\"__emscripten_thread_crashed\"]){Module[\"__emscripten_thread_crashed\"]()}throw ex}};`;","\nvar WasmBackendModule = (() => {\n var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;\n if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;\n return (\nfunction(WasmBackendModule) {\n WasmBackendModule = WasmBackendModule || {};\n\nvar Module=typeof WasmBackendModule!=\"undefined\"?WasmBackendModule:{};var readyPromiseResolve,readyPromiseReject;Module[\"ready\"]=new Promise(function(resolve,reject){readyPromiseResolve=resolve;readyPromiseReject=reject});var beforeListeners;if(typeof process!==\"undefined\"&&process.listeners){beforeListeners={uncaughtException:process.listeners(\"uncaughtException\"),unhandledRejection:process.listeners(\"unhandledRejection\")}}var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram=\"./this.program\";var quit_=(status,toThrow)=>{throw toThrow};var ENVIRONMENT_IS_WEB=typeof window==\"object\";var ENVIRONMENT_IS_WORKER=typeof importScripts==\"function\";var ENVIRONMENT_IS_NODE=typeof process==\"object\"&&typeof process.versions==\"object\"&&typeof process.versions.node==\"string\";var scriptDirectory=\"\";function locateFile(path){if(Module[\"locateFile\"]){return Module[\"locateFile\"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;function logExceptionOnExit(e){if(e instanceof ExitStatus)return;let toLog=e;err(\"exiting due to exception: \"+toLog)}if(ENVIRONMENT_IS_NODE){if(ENVIRONMENT_IS_WORKER){scriptDirectory=require(\"path\").dirname(scriptDirectory)+\"/\"}else{scriptDirectory=__dirname+\"/\"}var fs,nodePath;if(typeof require===\"function\"){fs=require(\"fs\");nodePath=require(\"path\")}read_=(filename,binary)=>{filename=nodePath[\"normalize\"](filename);return fs.readFileSync(filename,binary?undefined:\"utf8\")};readBinary=filename=>{var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}return ret};readAsync=(filename,onload,onerror)=>{filename=nodePath[\"normalize\"](filename);fs.readFile(filename,function(err,data){if(err)onerror(err);else onload(data.buffer)})};if(process[\"argv\"].length>1){thisProgram=process[\"argv\"][1].replace(/\\\\/g,\"/\")}arguments_=process[\"argv\"].slice(2);process[\"on\"](\"uncaughtException\",function(ex){if(!(ex instanceof ExitStatus)){throw ex}});process[\"on\"](\"unhandledRejection\",function(reason){throw reason});quit_=(status,toThrow)=>{if(keepRuntimeAlive()){process[\"exitCode\"]=status;throw toThrow}logExceptionOnExit(toThrow);process[\"exit\"](status)};Module[\"inspect\"]=function(){return\"[Emscripten Module object]\"}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!=\"undefined\"&&document.currentScript){scriptDirectory=document.currentScript.src}if(_scriptDir){scriptDirectory=_scriptDir}if(scriptDirectory.indexOf(\"blob:\")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,\"\").lastIndexOf(\"/\")+1)}else{scriptDirectory=\"\"}{read_=url=>{var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,false);xhr.responseType=\"arraybuffer\";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=(url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,true);xhr.responseType=\"arraybuffer\";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}setWindowTitle=title=>document.title=title}else{}var out=Module[\"print\"]||console.log.bind(console);var err=Module[\"printErr\"]||console.warn.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module[\"arguments\"])arguments_=Module[\"arguments\"];if(Module[\"thisProgram\"])thisProgram=Module[\"thisProgram\"];if(Module[\"quit\"])quit_=Module[\"quit\"];var POINTER_SIZE=4;var wasmBinary;if(Module[\"wasmBinary\"])wasmBinary=Module[\"wasmBinary\"];var noExitRuntime=Module[\"noExitRuntime\"]||true;if(typeof WebAssembly!=\"object\"){abort(\"no native wasm support detected\")}var wasmMemory;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort(text)}}var UTF8Decoder=typeof TextDecoder!=\"undefined\"?new TextDecoder(\"utf8\"):undefined;function UTF8ArrayToString(heapOrArray,idx,maxBytesToRead){var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heapOrArray[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str=\"\";while(idx>10,56320|ch&1023)}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):\"\"}function stringToUTF8Array(str,heap,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferAndViews(buf){buffer=buf;Module[\"HEAP8\"]=HEAP8=new Int8Array(buf);Module[\"HEAP16\"]=HEAP16=new Int16Array(buf);Module[\"HEAP32\"]=HEAP32=new Int32Array(buf);Module[\"HEAPU8\"]=HEAPU8=new Uint8Array(buf);Module[\"HEAPU16\"]=HEAPU16=new Uint16Array(buf);Module[\"HEAPU32\"]=HEAPU32=new Uint32Array(buf);Module[\"HEAPF32\"]=HEAPF32=new Float32Array(buf);Module[\"HEAPF64\"]=HEAPF64=new Float64Array(buf)}var INITIAL_MEMORY=Module[\"INITIAL_MEMORY\"]||16777216;var wasmTable;var __ATPRERUN__=[];var __ATINIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function keepRuntimeAlive(){return noExitRuntime}function preRun(){if(Module[\"preRun\"]){if(typeof Module[\"preRun\"]==\"function\")Module[\"preRun\"]=[Module[\"preRun\"]];while(Module[\"preRun\"].length){addOnPreRun(Module[\"preRun\"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;callRuntimeCallbacks(__ATINIT__)}function postRun(){if(Module[\"postRun\"]){if(typeof Module[\"postRun\"]==\"function\")Module[\"postRun\"]=[Module[\"postRun\"]];while(Module[\"postRun\"].length){addOnPostRun(Module[\"postRun\"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnInit(cb){__ATINIT__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function addRunDependency(id){runDependencies++;if(Module[\"monitorRunDependencies\"]){Module[\"monitorRunDependencies\"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module[\"monitorRunDependencies\"]){Module[\"monitorRunDependencies\"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){{if(Module[\"onAbort\"]){Module[\"onAbort\"](what)}}what=\"Aborted(\"+what+\")\";err(what);ABORT=true;EXITSTATUS=1;what+=\". Build with -sASSERTIONS for more info.\";var e=new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e}var dataURIPrefix=\"data:application/octet-stream;base64,\";function isDataURI(filename){return filename.startsWith(dataURIPrefix)}function isFileURI(filename){return filename.startsWith(\"file://\")}var wasmBinaryFile;wasmBinaryFile=\"tfjs-backend-wasm.wasm\";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(file){try{if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw\"both async and sync fetching of the wasm failed\"}catch(err){abort(err)}}function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch==\"function\"&&!isFileURI(wasmBinaryFile)){return fetch(wasmBinaryFile,{credentials:\"same-origin\"}).then(function(response){if(!response[\"ok\"]){throw\"failed to load wasm binary file at '\"+wasmBinaryFile+\"'\"}return response[\"arrayBuffer\"]()}).catch(function(){return getBinary(wasmBinaryFile)})}else{if(readAsync){return new Promise(function(resolve,reject){readAsync(wasmBinaryFile,function(response){resolve(new Uint8Array(response))},reject)})}}}return Promise.resolve().then(function(){return getBinary(wasmBinaryFile)})}function createWasm(){var info={\"env\":asmLibraryArg,\"wasi_snapshot_preview1\":asmLibraryArg};function receiveInstance(instance,module){var exports=instance.exports;Module[\"asm\"]=exports;wasmMemory=Module[\"asm\"][\"memory\"];updateGlobalBufferAndViews(wasmMemory.buffer);wasmTable=Module[\"asm\"][\"__indirect_function_table\"];addOnInit(Module[\"asm\"][\"__wasm_call_ctors\"]);removeRunDependency(\"wasm-instantiate\")}addRunDependency(\"wasm-instantiate\");function receiveInstantiationResult(result){receiveInstance(result[\"instance\"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(function(instance){return instance}).then(receiver,function(reason){err(\"failed to asynchronously prepare wasm: \"+reason);abort(reason)})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming==\"function\"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&!ENVIRONMENT_IS_NODE&&typeof fetch==\"function\"){return fetch(wasmBinaryFile,{credentials:\"same-origin\"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiationResult,function(reason){err(\"wasm streaming compile failed: \"+reason);err(\"falling back to ArrayBuffer instantiation\");return instantiateArrayBuffer(receiveInstantiationResult)})})}else{return instantiateArrayBuffer(receiveInstantiationResult)}}if(Module[\"instantiateWasm\"]){try{var exports=Module[\"instantiateWasm\"](info,receiveInstance);return exports}catch(e){err(\"Module.instantiateWasm callback failed with error: \"+e);readyPromiseReject(e)}}instantiateAsync().catch(readyPromiseReject);return{}}var tempDouble;var tempI64;function ExitStatus(status){this.name=\"ExitStatus\";this.message=\"Program terminated with exit(\"+status+\")\";this.status=status}function callRuntimeCallbacks(callbacks){while(callbacks.length>0){callbacks.shift()(Module)}}function demangle(func){return func}function demangleAll(text){var regex=/\\b_Z[\\w\\d_]+/g;return text.replace(regex,function(x){var y=demangle(x);return x===y?x:y+\" [\"+x+\"]\"})}function jsStackTrace(){var error=new Error;if(!error.stack){try{throw new Error}catch(e){error=e}if(!error.stack){return\"(no stack trace available)\"}}return error.stack.toString()}function writeArrayToMemory(array,buffer){HEAP8.set(array,buffer)}function _abort(){abort(\"\")}function getHeapMax(){return 2147483648}function _emscripten_get_heap_max(){return getHeapMax()}function _emscripten_memcpy_big(dest,src,num){HEAPU8.copyWithin(dest,src,src+num)}function emscripten_realloc_buffer(size){try{wasmMemory.grow(size-buffer.byteLength+65535>>>16);updateGlobalBufferAndViews(wasmMemory.buffer);return 1}catch(e){}}function _emscripten_resize_heap(requestedSize){var oldSize=HEAPU8.length;requestedSize=requestedSize>>>0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}let alignUp=(x,multiple)=>x+(multiple-x%multiple)%multiple;for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignUp(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=emscripten_realloc_buffer(newSize);if(replacement){return true}}return false}var SYSCALLS={varargs:undefined,get:function(){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret},getStr:function(ptr){var ret=UTF8ToString(ptr);return ret}};function _fd_close(fd){return 52}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){return 70}var printCharBuffers=[null,[],[]];function printChar(stream,curr){var buffer=printCharBuffers[stream];if(curr===0||curr===10){(stream===1?out:err)(UTF8ArrayToString(buffer,0));buffer.length=0}else{buffer.push(curr)}}function _fd_write(fd,iov,iovcnt,pnum){var num=0;for(var i=0;i>2];var len=HEAPU32[iov+4>>2];iov+=8;for(var j=0;j>2]=num;return 0}function getCFunc(ident){var func=Module[\"_\"+ident];return func}function ccall(ident,returnType,argTypes,args,opts){var toC={\"string\":str=>{var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=stackAlloc(len);stringToUTF8(str,ret,len)}return ret},\"array\":arr=>{var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType===\"string\"){return UTF8ToString(ret)}if(returnType===\"boolean\")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;itype===\"number\"||type===\"boolean\");var numericRet=returnType!==\"string\";if(numericRet&&numericArgs&&!opts){return getCFunc(ident)}return function(){return ccall(ident,returnType,argTypes,arguments,opts)}}var asmLibraryArg={\"abort\":_abort,\"emscripten_get_heap_max\":_emscripten_get_heap_max,\"emscripten_memcpy_big\":_emscripten_memcpy_big,\"emscripten_resize_heap\":_emscripten_resize_heap,\"fd_close\":_fd_close,\"fd_seek\":_fd_seek,\"fd_write\":_fd_write};var asm=createWasm();var ___wasm_call_ctors=Module[\"___wasm_call_ctors\"]=function(){return(___wasm_call_ctors=Module[\"___wasm_call_ctors\"]=Module[\"asm\"][\"__wasm_call_ctors\"]).apply(null,arguments)};var _init=Module[\"_init\"]=function(){return(_init=Module[\"_init\"]=Module[\"asm\"][\"init\"]).apply(null,arguments)};var _init_with_threads_count=Module[\"_init_with_threads_count\"]=function(){return(_init_with_threads_count=Module[\"_init_with_threads_count\"]=Module[\"asm\"][\"init_with_threads_count\"]).apply(null,arguments)};var _get_threads_count=Module[\"_get_threads_count\"]=function(){return(_get_threads_count=Module[\"_get_threads_count\"]=Module[\"asm\"][\"get_threads_count\"]).apply(null,arguments)};var _register_tensor=Module[\"_register_tensor\"]=function(){return(_register_tensor=Module[\"_register_tensor\"]=Module[\"asm\"][\"register_tensor\"]).apply(null,arguments)};var _dispose_data=Module[\"_dispose_data\"]=function(){return(_dispose_data=Module[\"_dispose_data\"]=Module[\"asm\"][\"dispose_data\"]).apply(null,arguments)};var _dispose=Module[\"_dispose\"]=function(){return(_dispose=Module[\"_dispose\"]=Module[\"asm\"][\"dispose\"]).apply(null,arguments)};var _Abs=Module[\"_Abs\"]=function(){return(_Abs=Module[\"_Abs\"]=Module[\"asm\"][\"Abs\"]).apply(null,arguments)};var _Add=Module[\"_Add\"]=function(){return(_Add=Module[\"_Add\"]=Module[\"asm\"][\"Add\"]).apply(null,arguments)};var _AddN=Module[\"_AddN\"]=function(){return(_AddN=Module[\"_AddN\"]=Module[\"asm\"][\"AddN\"]).apply(null,arguments)};var _All=Module[\"_All\"]=function(){return(_All=Module[\"_All\"]=Module[\"asm\"][\"All\"]).apply(null,arguments)};var _Any=Module[\"_Any\"]=function(){return(_Any=Module[\"_Any\"]=Module[\"asm\"][\"Any\"]).apply(null,arguments)};var _ArgMax=Module[\"_ArgMax\"]=function(){return(_ArgMax=Module[\"_ArgMax\"]=Module[\"asm\"][\"ArgMax\"]).apply(null,arguments)};var _AvgPool=Module[\"_AvgPool\"]=function(){return(_AvgPool=Module[\"_AvgPool\"]=Module[\"asm\"][\"AvgPool\"]).apply(null,arguments)};var _BatchMatMul=Module[\"_BatchMatMul\"]=function(){return(_BatchMatMul=Module[\"_BatchMatMul\"]=Module[\"asm\"][\"BatchMatMul\"]).apply(null,arguments)};var _Ceil=Module[\"_Ceil\"]=function(){return(_Ceil=Module[\"_Ceil\"]=Module[\"asm\"][\"Ceil\"]).apply(null,arguments)};var _ClipByValue=Module[\"_ClipByValue\"]=function(){return(_ClipByValue=Module[\"_ClipByValue\"]=Module[\"asm\"][\"ClipByValue\"]).apply(null,arguments)};var _Conv2D=Module[\"_Conv2D\"]=function(){return(_Conv2D=Module[\"_Conv2D\"]=Module[\"asm\"][\"Conv2D\"]).apply(null,arguments)};var _Conv2DBackpropInput=Module[\"_Conv2DBackpropInput\"]=function(){return(_Conv2DBackpropInput=Module[\"_Conv2DBackpropInput\"]=Module[\"asm\"][\"Conv2DBackpropInput\"]).apply(null,arguments)};var _Cos=Module[\"_Cos\"]=function(){return(_Cos=Module[\"_Cos\"]=Module[\"asm\"][\"Cos\"]).apply(null,arguments)};var _Cosh=Module[\"_Cosh\"]=function(){return(_Cosh=Module[\"_Cosh\"]=Module[\"asm\"][\"Cosh\"]).apply(null,arguments)};var _CropAndResize=Module[\"_CropAndResize\"]=function(){return(_CropAndResize=Module[\"_CropAndResize\"]=Module[\"asm\"][\"CropAndResize\"]).apply(null,arguments)};var _Cumprod=Module[\"_Cumprod\"]=function(){return(_Cumprod=Module[\"_Cumprod\"]=Module[\"asm\"][\"Cumprod\"]).apply(null,arguments)};var _Cumsum=Module[\"_Cumsum\"]=function(){return(_Cumsum=Module[\"_Cumsum\"]=Module[\"asm\"][\"Cumsum\"]).apply(null,arguments)};var _DepthToSpace=Module[\"_DepthToSpace\"]=function(){return(_DepthToSpace=Module[\"_DepthToSpace\"]=Module[\"asm\"][\"DepthToSpace\"]).apply(null,arguments)};var _DepthwiseConv2dNative=Module[\"_DepthwiseConv2dNative\"]=function(){return(_DepthwiseConv2dNative=Module[\"_DepthwiseConv2dNative\"]=Module[\"asm\"][\"DepthwiseConv2dNative\"]).apply(null,arguments)};var _Elu=Module[\"_Elu\"]=function(){return(_Elu=Module[\"_Elu\"]=Module[\"asm\"][\"Elu\"]).apply(null,arguments)};var _Equal=Module[\"_Equal\"]=function(){return(_Equal=Module[\"_Equal\"]=Module[\"asm\"][\"Equal\"]).apply(null,arguments)};var _Exp=Module[\"_Exp\"]=function(){return(_Exp=Module[\"_Exp\"]=Module[\"asm\"][\"Exp\"]).apply(null,arguments)};var _FlipLeftRight=Module[\"_FlipLeftRight\"]=function(){return(_FlipLeftRight=Module[\"_FlipLeftRight\"]=Module[\"asm\"][\"FlipLeftRight\"]).apply(null,arguments)};var _Floor=Module[\"_Floor\"]=function(){return(_Floor=Module[\"_Floor\"]=Module[\"asm\"][\"Floor\"]).apply(null,arguments)};var _FloorDiv=Module[\"_FloorDiv\"]=function(){return(_FloorDiv=Module[\"_FloorDiv\"]=Module[\"asm\"][\"FloorDiv\"]).apply(null,arguments)};var _FusedBatchNorm=Module[\"_FusedBatchNorm\"]=function(){return(_FusedBatchNorm=Module[\"_FusedBatchNorm\"]=Module[\"asm\"][\"FusedBatchNorm\"]).apply(null,arguments)};var _FusedConv2D=Module[\"_FusedConv2D\"]=function(){return(_FusedConv2D=Module[\"_FusedConv2D\"]=Module[\"asm\"][\"FusedConv2D\"]).apply(null,arguments)};var _FusedDepthwiseConv2D=Module[\"_FusedDepthwiseConv2D\"]=function(){return(_FusedDepthwiseConv2D=Module[\"_FusedDepthwiseConv2D\"]=Module[\"asm\"][\"FusedDepthwiseConv2D\"]).apply(null,arguments)};var _Gather=Module[\"_Gather\"]=function(){return(_Gather=Module[\"_Gather\"]=Module[\"asm\"][\"Gather\"]).apply(null,arguments)};var _GatherNd=Module[\"_GatherNd\"]=function(){return(_GatherNd=Module[\"_GatherNd\"]=Module[\"asm\"][\"GatherNd\"]).apply(null,arguments)};var _Greater=Module[\"_Greater\"]=function(){return(_Greater=Module[\"_Greater\"]=Module[\"asm\"][\"Greater\"]).apply(null,arguments)};var _GreaterEqual=Module[\"_GreaterEqual\"]=function(){return(_GreaterEqual=Module[\"_GreaterEqual\"]=Module[\"asm\"][\"GreaterEqual\"]).apply(null,arguments)};var _LeakyRelu=Module[\"_LeakyRelu\"]=function(){return(_LeakyRelu=Module[\"_LeakyRelu\"]=Module[\"asm\"][\"LeakyRelu\"]).apply(null,arguments)};var _Less=Module[\"_Less\"]=function(){return(_Less=Module[\"_Less\"]=Module[\"asm\"][\"Less\"]).apply(null,arguments)};var _LessEqual=Module[\"_LessEqual\"]=function(){return(_LessEqual=Module[\"_LessEqual\"]=Module[\"asm\"][\"LessEqual\"]).apply(null,arguments)};var _Log=Module[\"_Log\"]=function(){return(_Log=Module[\"_Log\"]=Module[\"asm\"][\"Log\"]).apply(null,arguments)};var _LogicalAnd=Module[\"_LogicalAnd\"]=function(){return(_LogicalAnd=Module[\"_LogicalAnd\"]=Module[\"asm\"][\"LogicalAnd\"]).apply(null,arguments)};var _LogicalNot=Module[\"_LogicalNot\"]=function(){return(_LogicalNot=Module[\"_LogicalNot\"]=Module[\"asm\"][\"LogicalNot\"]).apply(null,arguments)};var _LogicalOr=Module[\"_LogicalOr\"]=function(){return(_LogicalOr=Module[\"_LogicalOr\"]=Module[\"asm\"][\"LogicalOr\"]).apply(null,arguments)};var _LogicalXor=Module[\"_LogicalXor\"]=function(){return(_LogicalXor=Module[\"_LogicalXor\"]=Module[\"asm\"][\"LogicalXor\"]).apply(null,arguments)};var _Max=Module[\"_Max\"]=function(){return(_Max=Module[\"_Max\"]=Module[\"asm\"][\"Max\"]).apply(null,arguments)};var _MaxPool=Module[\"_MaxPool\"]=function(){return(_MaxPool=Module[\"_MaxPool\"]=Module[\"asm\"][\"MaxPool\"]).apply(null,arguments)};var _Maximum=Module[\"_Maximum\"]=function(){return(_Maximum=Module[\"_Maximum\"]=Module[\"asm\"][\"Maximum\"]).apply(null,arguments)};var _Mean=Module[\"_Mean\"]=function(){return(_Mean=Module[\"_Mean\"]=Module[\"asm\"][\"Mean\"]).apply(null,arguments)};var _Min=Module[\"_Min\"]=function(){return(_Min=Module[\"_Min\"]=Module[\"asm\"][\"Min\"]).apply(null,arguments)};var _Minimum=Module[\"_Minimum\"]=function(){return(_Minimum=Module[\"_Minimum\"]=Module[\"asm\"][\"Minimum\"]).apply(null,arguments)};var _MirrorPad=Module[\"_MirrorPad\"]=function(){return(_MirrorPad=Module[\"_MirrorPad\"]=Module[\"asm\"][\"MirrorPad\"]).apply(null,arguments)};var _Multiply=Module[\"_Multiply\"]=function(){return(_Multiply=Module[\"_Multiply\"]=Module[\"asm\"][\"Multiply\"]).apply(null,arguments)};var _Neg=Module[\"_Neg\"]=function(){return(_Neg=Module[\"_Neg\"]=Module[\"asm\"][\"Neg\"]).apply(null,arguments)};var _NonMaxSuppressionV3=Module[\"_NonMaxSuppressionV3\"]=function(){return(_NonMaxSuppressionV3=Module[\"_NonMaxSuppressionV3\"]=Module[\"asm\"][\"NonMaxSuppressionV3\"]).apply(null,arguments)};var _NonMaxSuppressionV4=Module[\"_NonMaxSuppressionV4\"]=function(){return(_NonMaxSuppressionV4=Module[\"_NonMaxSuppressionV4\"]=Module[\"asm\"][\"NonMaxSuppressionV4\"]).apply(null,arguments)};var _NonMaxSuppressionV5=Module[\"_NonMaxSuppressionV5\"]=function(){return(_NonMaxSuppressionV5=Module[\"_NonMaxSuppressionV5\"]=Module[\"asm\"][\"NonMaxSuppressionV5\"]).apply(null,arguments)};var _NotEqual=Module[\"_NotEqual\"]=function(){return(_NotEqual=Module[\"_NotEqual\"]=Module[\"asm\"][\"NotEqual\"]).apply(null,arguments)};var _OneHot=Module[\"_OneHot\"]=function(){return(_OneHot=Module[\"_OneHot\"]=Module[\"asm\"][\"OneHot\"]).apply(null,arguments)};var _PadV2=Module[\"_PadV2\"]=function(){return(_PadV2=Module[\"_PadV2\"]=Module[\"asm\"][\"PadV2\"]).apply(null,arguments)};var _Pow=Module[\"_Pow\"]=function(){return(_Pow=Module[\"_Pow\"]=Module[\"asm\"][\"Pow\"]).apply(null,arguments)};var _Prelu=Module[\"_Prelu\"]=function(){return(_Prelu=Module[\"_Prelu\"]=Module[\"asm\"][\"Prelu\"]).apply(null,arguments)};var _Prod=Module[\"_Prod\"]=function(){return(_Prod=Module[\"_Prod\"]=Module[\"asm\"][\"Prod\"]).apply(null,arguments)};var _RealDiv=Module[\"_RealDiv\"]=function(){return(_RealDiv=Module[\"_RealDiv\"]=Module[\"asm\"][\"RealDiv\"]).apply(null,arguments)};var _Relu=Module[\"_Relu\"]=function(){return(_Relu=Module[\"_Relu\"]=Module[\"asm\"][\"Relu\"]).apply(null,arguments)};var _Relu6=Module[\"_Relu6\"]=function(){return(_Relu6=Module[\"_Relu6\"]=Module[\"asm\"][\"Relu6\"]).apply(null,arguments)};var _ResizeBilinear=Module[\"_ResizeBilinear\"]=function(){return(_ResizeBilinear=Module[\"_ResizeBilinear\"]=Module[\"asm\"][\"ResizeBilinear\"]).apply(null,arguments)};var _ResizeNearestNeighbor=Module[\"_ResizeNearestNeighbor\"]=function(){return(_ResizeNearestNeighbor=Module[\"_ResizeNearestNeighbor\"]=Module[\"asm\"][\"ResizeNearestNeighbor\"]).apply(null,arguments)};var _Reverse=Module[\"_Reverse\"]=function(){return(_Reverse=Module[\"_Reverse\"]=Module[\"asm\"][\"Reverse\"]).apply(null,arguments)};var _RotateWithOffset=Module[\"_RotateWithOffset\"]=function(){return(_RotateWithOffset=Module[\"_RotateWithOffset\"]=Module[\"asm\"][\"RotateWithOffset\"]).apply(null,arguments)};var _Round=Module[\"_Round\"]=function(){return(_Round=Module[\"_Round\"]=Module[\"asm\"][\"Round\"]).apply(null,arguments)};var _Rsqrt=Module[\"_Rsqrt\"]=function(){return(_Rsqrt=Module[\"_Rsqrt\"]=Module[\"asm\"][\"Rsqrt\"]).apply(null,arguments)};var _ScatterNd=Module[\"_ScatterNd\"]=function(){return(_ScatterNd=Module[\"_ScatterNd\"]=Module[\"asm\"][\"ScatterNd\"]).apply(null,arguments)};var _SelectV2=Module[\"_SelectV2\"]=function(){return(_SelectV2=Module[\"_SelectV2\"]=Module[\"asm\"][\"SelectV2\"]).apply(null,arguments)};var _Sigmoid=Module[\"_Sigmoid\"]=function(){return(_Sigmoid=Module[\"_Sigmoid\"]=Module[\"asm\"][\"Sigmoid\"]).apply(null,arguments)};var _Sin=Module[\"_Sin\"]=function(){return(_Sin=Module[\"_Sin\"]=Module[\"asm\"][\"Sin\"]).apply(null,arguments)};var _Softmax=Module[\"_Softmax\"]=function(){return(_Softmax=Module[\"_Softmax\"]=Module[\"asm\"][\"Softmax\"]).apply(null,arguments)};var _SparseFillEmptyRows=Module[\"_SparseFillEmptyRows\"]=function(){return(_SparseFillEmptyRows=Module[\"_SparseFillEmptyRows\"]=Module[\"asm\"][\"SparseFillEmptyRows\"]).apply(null,arguments)};var _SparseReshape=Module[\"_SparseReshape\"]=function(){return(_SparseReshape=Module[\"_SparseReshape\"]=Module[\"asm\"][\"SparseReshape\"]).apply(null,arguments)};var _SparseSegmentReduction=Module[\"_SparseSegmentReduction\"]=function(){return(_SparseSegmentReduction=Module[\"_SparseSegmentReduction\"]=Module[\"asm\"][\"SparseSegmentReduction\"]).apply(null,arguments)};var _Sqrt=Module[\"_Sqrt\"]=function(){return(_Sqrt=Module[\"_Sqrt\"]=Module[\"asm\"][\"Sqrt\"]).apply(null,arguments)};var _Square=Module[\"_Square\"]=function(){return(_Square=Module[\"_Square\"]=Module[\"asm\"][\"Square\"]).apply(null,arguments)};var _SquaredDifference=Module[\"_SquaredDifference\"]=function(){return(_SquaredDifference=Module[\"_SquaredDifference\"]=Module[\"asm\"][\"SquaredDifference\"]).apply(null,arguments)};var _Step=Module[\"_Step\"]=function(){return(_Step=Module[\"_Step\"]=Module[\"asm\"][\"Step\"]).apply(null,arguments)};var _StridedSlice=Module[\"_StridedSlice\"]=function(){return(_StridedSlice=Module[\"_StridedSlice\"]=Module[\"asm\"][\"StridedSlice\"]).apply(null,arguments)};var _Sub=Module[\"_Sub\"]=function(){return(_Sub=Module[\"_Sub\"]=Module[\"asm\"][\"Sub\"]).apply(null,arguments)};var _Sum=Module[\"_Sum\"]=function(){return(_Sum=Module[\"_Sum\"]=Module[\"asm\"][\"Sum\"]).apply(null,arguments)};var _Tan=Module[\"_Tan\"]=function(){return(_Tan=Module[\"_Tan\"]=Module[\"asm\"][\"Tan\"]).apply(null,arguments)};var _Tanh=Module[\"_Tanh\"]=function(){return(_Tanh=Module[\"_Tanh\"]=Module[\"asm\"][\"Tanh\"]).apply(null,arguments)};var _Tile=Module[\"_Tile\"]=function(){return(_Tile=Module[\"_Tile\"]=Module[\"asm\"][\"Tile\"]).apply(null,arguments)};var _TopK=Module[\"_TopK\"]=function(){return(_TopK=Module[\"_TopK\"]=Module[\"asm\"][\"TopK\"]).apply(null,arguments)};var _Transform=Module[\"_Transform\"]=function(){return(_Transform=Module[\"_Transform\"]=Module[\"asm\"][\"Transform\"]).apply(null,arguments)};var _Transpose=Module[\"_Transpose\"]=function(){return(_Transpose=Module[\"_Transpose\"]=Module[\"asm\"][\"Transpose\"]).apply(null,arguments)};var __FusedMatMul=Module[\"__FusedMatMul\"]=function(){return(__FusedMatMul=Module[\"__FusedMatMul\"]=Module[\"asm\"][\"_FusedMatMul\"]).apply(null,arguments)};var _malloc=Module[\"_malloc\"]=function(){return(_malloc=Module[\"_malloc\"]=Module[\"asm\"][\"malloc\"]).apply(null,arguments)};var _free=Module[\"_free\"]=function(){return(_free=Module[\"_free\"]=Module[\"asm\"][\"free\"]).apply(null,arguments)};var ___errno_location=Module[\"___errno_location\"]=function(){return(___errno_location=Module[\"___errno_location\"]=Module[\"asm\"][\"__errno_location\"]).apply(null,arguments)};var stackSave=Module[\"stackSave\"]=function(){return(stackSave=Module[\"stackSave\"]=Module[\"asm\"][\"stackSave\"]).apply(null,arguments)};var stackRestore=Module[\"stackRestore\"]=function(){return(stackRestore=Module[\"stackRestore\"]=Module[\"asm\"][\"stackRestore\"]).apply(null,arguments)};var stackAlloc=Module[\"stackAlloc\"]=function(){return(stackAlloc=Module[\"stackAlloc\"]=Module[\"asm\"][\"stackAlloc\"]).apply(null,arguments)};var dynCall_iijjiiii=Module[\"dynCall_iijjiiii\"]=function(){return(dynCall_iijjiiii=Module[\"dynCall_iijjiiii\"]=Module[\"asm\"][\"dynCall_iijjiiii\"]).apply(null,arguments)};var dynCall_jiji=Module[\"dynCall_jiji\"]=function(){return(dynCall_jiji=Module[\"dynCall_jiji\"]=Module[\"asm\"][\"dynCall_jiji\"]).apply(null,arguments)};Module[\"cwrap\"]=cwrap;var calledRun;dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(args){args=args||arguments_;if(runDependencies>0){return}preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module[\"calledRun\"]=true;if(ABORT)return;initRuntime();readyPromiseResolve(Module);if(Module[\"onRuntimeInitialized\"])Module[\"onRuntimeInitialized\"]();postRun()}if(Module[\"setStatus\"]){Module[\"setStatus\"](\"Running...\");setTimeout(function(){setTimeout(function(){Module[\"setStatus\"](\"\")},1);doRun()},1)}else{doRun()}}if(Module[\"preInit\"]){if(typeof Module[\"preInit\"]==\"function\")Module[\"preInit\"]=[Module[\"preInit\"]];while(Module[\"preInit\"].length>0){Module[\"preInit\"].pop()()}}run();var listenersAdded;if(beforeListeners){listenersAdded={uncaughtException:process.listeners(\"uncaughtException\").filter(function(listener){return!beforeListeners.uncaughtException.indexOf(listener)>-1}),unhandledRejection:process.listeners(\"unhandledRejection\").filter(function(listener){return!beforeListeners.unhandledRejection.indexOf(listener)>-1})}}var actualModule;if(typeof WasmBackendModule!==\"undefined\"){actualModule=WasmBackendModule}else if(typeof WasmBackendModuleThreadedSimd!==\"undefined\"){actualModule=WasmBackendModuleThreadedSimd}else{throw new Error(\"Could not find wasm module in post.js\")}if(listenersAdded){var tmpDispose=actualModule[\"_dispose\"];actualModule[\"_dispose\"]=function(){tmpDispose();listenersAdded.uncaughtException.forEach(function(listener){process.removeListener(\"uncaughtException\",listener)});listenersAdded.unhandledRejection.forEach(function(listener){process.removeListener(\"unhandledRejection\",listener)})}}\n\n\n return WasmBackendModule.ready\n}\n);\n})();\nif (typeof exports === 'object' && typeof module === 'object')\n module.exports = WasmBackendModule;\nelse if (typeof define === 'function' && define['amd'])\n define([], function() { return WasmBackendModule; });\nelse if (typeof exports === 'object')\n exports[\"WasmBackendModule\"] = WasmBackendModule;\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport './flags_wasm';\n\nimport {backend_util, BackendTimingInfo, DataStorage, DataType, deprecationWarn, engine, env, KernelBackend, TensorInfo, util} from '@tensorflow/tfjs-core';\n\nimport {BackendWasmModule, WasmFactoryConfig} from '../wasm-out/tfjs-backend-wasm';\nimport {BackendWasmThreadedSimdModule} from '../wasm-out/tfjs-backend-wasm-threaded-simd';\nimport * as wasmFactoryThreadedSimd_import from '../wasm-out/tfjs-backend-wasm-threaded-simd.js';\n// @ts-ignore\nimport {wasmWorkerContents} from '../wasm-out/tfjs-backend-wasm-threaded-simd.worker.js';\nimport * as wasmFactory_import from '../wasm-out/tfjs-backend-wasm.js';\n\n// This workaround is required for importing in Node.js without using\n// the node bundle (for testing). This would not be necessary if we\n// flipped esModuleInterop to true, but we likely can't do that since\n// google3 does not use it.\nconst wasmFactoryThreadedSimd = (wasmFactoryThreadedSimd_import.default\n || wasmFactoryThreadedSimd_import) as\ntypeof wasmFactoryThreadedSimd_import.default;\nconst wasmFactory = (wasmFactory_import.default\n || wasmFactory_import) as typeof wasmFactory_import.default;\n\ninterface TensorData {\n id: number;\n memoryOffset: number;\n shape: number[];\n dtype: DataType;\n refCount: number;\n /** Only used for string tensors, storing encoded bytes. */\n stringBytes?: Uint8Array[];\n}\n\nexport type DataId = object; // object instead of {} to force non-primitive.\n\nexport class BackendWasm extends KernelBackend {\n // 0 is reserved for null data ids.\n private dataIdNextNumber = 1;\n dataIdMap: DataStorage;\n\n constructor(public wasm: BackendWasmModule|BackendWasmThreadedSimdModule) {\n super();\n this.wasm.tfjs.initWithThreadsCount(threadsCount);\n actualThreadsCount = this.wasm.tfjs.getThreadsCount();\n this.dataIdMap = new DataStorage(this, engine());\n }\n\n write(values: backend_util.BackendValues, shape: number[], dtype: DataType):\n DataId {\n const dataId = {id: this.dataIdNextNumber++};\n this.move(dataId, values, shape, dtype, 1);\n return dataId;\n }\n\n numDataIds(): number {\n return this.dataIdMap.numDataIds();\n }\n\n async time(f: () => void): Promise {\n const start = util.now();\n f();\n const kernelMs = util.now() - start;\n return {kernelMs};\n }\n\n move(\n dataId: DataId, values: backend_util.BackendValues, shape: number[],\n dtype: DataType, refCount: number): void {\n const id = this.dataIdNextNumber++;\n if (dtype === 'string') {\n const stringBytes = values as Uint8Array[];\n this.dataIdMap.set(\n dataId,\n {id, stringBytes, shape, dtype, memoryOffset: null, refCount});\n return;\n }\n\n const size = util.sizeFromShape(shape);\n const numBytes = size * util.bytesPerElement(dtype);\n const memoryOffset = this.wasm._malloc(numBytes);\n\n this.dataIdMap.set(dataId, {id, memoryOffset, shape, dtype, refCount});\n\n this.wasm.tfjs.registerTensor(id, size, memoryOffset);\n\n if (values != null) {\n this.wasm.HEAPU8.set(\n new Uint8Array(\n (values as backend_util.TypedArray).buffer,\n (values as backend_util.TypedArray).byteOffset, numBytes),\n memoryOffset);\n }\n }\n\n async read(dataId: DataId): Promise {\n return this.readSync(dataId);\n }\n\n readSync(dataId: DataId, start?: number, end?: number):\n backend_util.BackendValues {\n const {memoryOffset, dtype, shape, stringBytes} =\n this.dataIdMap.get(dataId);\n if (dtype === 'string') {\n // Slice all elements.\n if ((start == null || start === 0) &&\n (end == null || end >= stringBytes.length)) {\n return stringBytes;\n }\n return stringBytes.slice(start, end);\n }\n start = start || 0;\n end = end || util.sizeFromShape(shape);\n const bytesPerElement = util.bytesPerElement(dtype);\n const bytes = this.wasm.HEAPU8.slice(\n memoryOffset + start * bytesPerElement,\n memoryOffset + end * bytesPerElement);\n return typedArrayFromBuffer(bytes.buffer, dtype);\n }\n\n /**\n * Dispose the memory if the dataId has 0 refCount. Return true if the memory\n * is released, false otherwise.\n * @param dataId\n * @oaram force Optional, remove the data regardless of refCount\n */\n disposeData(dataId: DataId, force = false): boolean {\n if (this.dataIdMap.has(dataId)) {\n const data = this.dataIdMap.get(dataId);\n data.refCount--;\n if (!force && data.refCount > 0) {\n return false;\n }\n\n this.wasm._free(data.memoryOffset);\n this.wasm.tfjs.disposeData(data.id);\n this.dataIdMap.delete(dataId);\n }\n return true;\n }\n\n /** Return refCount of a `TensorData`. */\n refCount(dataId: DataId): number {\n if (this.dataIdMap.has(dataId)) {\n const tensorData = this.dataIdMap.get(dataId);\n return tensorData.refCount;\n }\n return 0;\n }\n\n incRef(dataId: DataId) {\n const data = this.dataIdMap.get(dataId);\n if (data != null) {\n data.refCount++;\n }\n }\n\n floatPrecision(): 32 {\n return 32;\n }\n\n // Returns the memory offset of a tensor. Useful for debugging and unit\n // testing.\n getMemoryOffset(dataId: DataId): number {\n return this.dataIdMap.get(dataId).memoryOffset;\n }\n\n dispose() {\n this.wasm.tfjs.dispose();\n if ('PThread' in this.wasm) {\n this.wasm.PThread.terminateAllThreads();\n }\n this.wasm = null;\n }\n\n memory() {\n return {unreliable: false};\n }\n\n /**\n * Make a tensor info for the output of an op. If `memoryOffset` is not\n * present, this method allocates memory on the WASM heap. If `memoryOffset`\n * is present, the memory was allocated elsewhere (in c++) and we just record\n * the pointer where that memory lives.\n */\n makeOutput(shape: number[], dtype: DataType, memoryOffset?: number):\n TensorInfo {\n let dataId: {};\n if (memoryOffset == null) {\n dataId = this.write(null /* values */, shape, dtype);\n } else {\n const id = this.dataIdNextNumber++;\n dataId = {id};\n this.dataIdMap.set(dataId, {id, memoryOffset, shape, dtype, refCount: 1});\n const size = util.sizeFromShape(shape);\n this.wasm.tfjs.registerTensor(id, size, memoryOffset);\n }\n return {dataId, shape, dtype};\n }\n\n typedArrayFromHeap({shape, dtype, dataId}: TensorInfo):\n backend_util.TypedArray {\n const buffer = this.wasm.HEAPU8.buffer;\n const {memoryOffset} = this.dataIdMap.get(dataId);\n const size = util.sizeFromShape(shape);\n switch (dtype) {\n case 'float32':\n return new Float32Array(buffer, memoryOffset, size);\n case 'int32':\n return new Int32Array(buffer, memoryOffset, size);\n case 'bool':\n return new Uint8Array(buffer, memoryOffset, size);\n default:\n throw new Error(`Unknown dtype ${dtype}`);\n }\n }\n}\n\nfunction createInstantiateWasmFunc(path: string) {\n // this will be replace by rollup plugin patchWechatWebAssembly in\n // minprogram's output.\n // tslint:disable-next-line:no-any\n return (imports: any, callback: any) => {\n util.fetch(path, {credentials: 'same-origin'}).then((response) => {\n if (!response['ok']) {\n imports.env.a(`failed to load wasm binary file at '${path}'`);\n }\n response.arrayBuffer().then(binary => {\n WebAssembly.instantiate(binary, imports).then(output => {\n callback(output.instance, output.module);\n });\n });\n });\n return {};\n };\n}\n\n/**\n * Returns the path of the WASM binary.\n * @param simdSupported whether SIMD is supported\n * @param threadsSupported whether multithreading is supported\n * @param wasmModuleFolder the directory containing the WASM binaries.\n */\nfunction getPathToWasmBinary(\n simdSupported: boolean, threadsSupported: boolean,\n wasmModuleFolder: string) {\n if (wasmPath != null) {\n // If wasmPath is defined, the user has supplied a full path to\n // the vanilla .wasm binary.\n return wasmPath;\n }\n\n let path: WasmBinaryName = 'tfjs-backend-wasm.wasm';\n if (simdSupported && threadsSupported) {\n path = 'tfjs-backend-wasm-threaded-simd.wasm';\n } else if (simdSupported) {\n path = 'tfjs-backend-wasm-simd.wasm';\n }\n\n if (wasmFileMap != null) {\n if (wasmFileMap[path] != null) {\n return wasmFileMap[path];\n }\n }\n\n return wasmModuleFolder + path;\n}\n\n/**\n * Initializes the wasm module and creates the js <--> wasm bridge.\n *\n * NOTE: We wrap the wasm module in a object with property 'wasm' instead of\n * returning Promise to avoid freezing Chrome (last tested\n * in Chrome 76).\n */\nexport async function init(): Promise<{wasm: BackendWasmModule}> {\n const [simdSupported, threadsSupported] = await Promise.all([\n env().getAsync('WASM_HAS_SIMD_SUPPORT'),\n env().getAsync('WASM_HAS_MULTITHREAD_SUPPORT')\n ]);\n\n return new Promise((resolve, reject) => {\n const factoryConfig: WasmFactoryConfig = {};\n\n /**\n * This function overrides the Emscripten module locateFile utility.\n * @param path The relative path to the file that needs to be loaded.\n * @param prefix The path to the main JavaScript file's directory.\n */\n factoryConfig.locateFile = (path, prefix) => {\n if (path.endsWith('.worker.js')) {\n // Escape '\\n' because Blob will turn it into a newline.\n // There should be a setting for this, but 'endings: \"native\"' does\n // not seem to work.\n const response = (wasmWorkerContents as string).replace(/\\n/g, '\\\\n');\n const blob = new Blob([response], {type: 'application/javascript'});\n return URL.createObjectURL(blob);\n }\n\n if (path.endsWith('.wasm')) {\n return getPathToWasmBinary(\n simdSupported as boolean, threadsSupported as boolean,\n wasmPathPrefix != null ? wasmPathPrefix : prefix);\n }\n return prefix + path;\n };\n\n // Use the instantiateWasm override when system fetch is not available.\n // Reference:\n // https://github.com/emscripten-core/emscripten/blob/2bca083cbbd5a4133db61fbd74d04f7feecfa907/tests/manual_wasm_instantiate.html#L170\n if (customFetch) {\n factoryConfig.instantiateWasm =\n createInstantiateWasmFunc(getPathToWasmBinary(\n simdSupported as boolean, threadsSupported as boolean,\n wasmPathPrefix != null ? wasmPathPrefix : ''));\n }\n\n let initialized = false;\n factoryConfig.onAbort = () => {\n if (initialized) {\n // Emscripten already called console.warn so no need to double log.\n return;\n }\n if (initAborted) {\n // Emscripten calls `onAbort` twice, resulting in double error\n // messages.\n return;\n }\n initAborted = true;\n const rejectMsg =\n 'Make sure the server can serve the `.wasm` file relative to the ' +\n 'bundled js file. For more details see https://github.com/tensorflow/tfjs/blob/master/tfjs-backend-wasm/README.md#using-bundlers';\n reject({message: rejectMsg});\n };\n\n let wasm: Promise;\n // If `wasmPath` has been defined we must initialize the vanilla module.\n if (threadsSupported && simdSupported && wasmPath == null) {\n factoryConfig.mainScriptUrlOrBlob = new Blob(\n [`var WasmBackendModuleThreadedSimd = ` +\n wasmFactoryThreadedSimd.toString()],\n {type: 'text/javascript'});\n wasm = wasmFactoryThreadedSimd(factoryConfig);\n } else {\n // The wasmFactory works for both vanilla and SIMD binaries.\n wasm = wasmFactory(factoryConfig);\n }\n\n // The `wasm` promise will resolve to the WASM module created by\n // the factory, but it might have had errors during creation. Most\n // errors are caught by the onAbort callback defined above.\n // However, some errors, such as those occurring from a\n // failed fetch, result in this promise being rejected. These are\n // caught and re-rejected below.\n wasm.then((module) => {\n initialized = true;\n initAborted = false;\n\n const voidReturnType: string = null;\n // Using the tfjs namespace to avoid conflict with emscripten's API.\n module.tfjs = {\n init: module.cwrap('init', null, []),\n initWithThreadsCount:\n module.cwrap('init_with_threads_count', null, ['number']),\n getThreadsCount: module.cwrap('get_threads_count', 'number', []),\n registerTensor: module.cwrap(\n 'register_tensor', null,\n [\n 'number', // id\n 'number', // size\n 'number', // memoryOffset\n ]),\n disposeData: module.cwrap('dispose_data', voidReturnType, ['number']),\n dispose: module.cwrap('dispose', voidReturnType, []),\n };\n\n resolve({wasm: module});\n }).catch(reject);\n });\n}\n\nfunction typedArrayFromBuffer(\n buffer: ArrayBuffer, dtype: DataType): backend_util.TypedArray {\n switch (dtype) {\n case 'float32':\n return new Float32Array(buffer);\n case 'int32':\n return new Int32Array(buffer);\n case 'bool':\n return new Uint8Array(buffer);\n default:\n throw new Error(`Unknown dtype ${dtype}`);\n }\n}\n\nconst wasmBinaryNames = [\n 'tfjs-backend-wasm.wasm', 'tfjs-backend-wasm-simd.wasm',\n 'tfjs-backend-wasm-threaded-simd.wasm'\n] as const ;\ntype WasmBinaryName = typeof wasmBinaryNames[number];\n\nlet wasmPath: string = null;\nlet wasmPathPrefix: string = null;\nlet wasmFileMap: {[key in WasmBinaryName]?: string} = {};\nlet initAborted = false;\nlet customFetch = false;\n\n/**\n * @deprecated Use `setWasmPaths` instead.\n * Sets the path to the `.wasm` file which will be fetched when the wasm\n * backend is initialized. See\n * https://github.com/tensorflow/tfjs/blob/master/tfjs-backend-wasm/README.md#using-bundlers\n * for more details.\n * @param path wasm file path or url\n * @param usePlatformFetch optional boolean to use platform fetch to download\n * the wasm file, default to false.\n *\n * @doc {heading: 'Environment', namespace: 'wasm'}\n */\nexport function setWasmPath(path: string, usePlatformFetch = false): void {\n deprecationWarn(\n 'setWasmPath has been deprecated in favor of setWasmPaths and' +\n ' will be removed in a future release.');\n if (initAborted) {\n throw new Error(\n 'The WASM backend was already initialized. Make sure you call ' +\n '`setWasmPath()` before you call `tf.setBackend()` or `tf.ready()`');\n }\n wasmPath = path;\n customFetch = usePlatformFetch;\n}\n\n/**\n * Configures the locations of the WASM binaries.\n *\n * ```js\n * setWasmPaths({\n * 'tfjs-backend-wasm.wasm': 'renamed.wasm',\n * 'tfjs-backend-wasm-simd.wasm': 'renamed-simd.wasm',\n * 'tfjs-backend-wasm-threaded-simd.wasm': 'renamed-threaded-simd.wasm'\n * });\n * tf.setBackend('wasm');\n * ```\n *\n * @param prefixOrFileMap This can be either a string or object:\n * - (string) The path to the directory where the WASM binaries are located.\n * Note that this prefix will be used to load each binary (vanilla,\n * SIMD-enabled, threading-enabled, etc.).\n * - (object) Mapping from names of WASM binaries to custom\n * full paths specifying the locations of those binaries. This is useful if\n * your WASM binaries are not all located in the same directory, or if your\n * WASM binaries have been renamed.\n * @param usePlatformFetch optional boolean to use platform fetch to download\n * the wasm file, default to false.\n *\n * @doc {heading: 'Environment', namespace: 'wasm'}\n */\nexport function setWasmPaths(\n prefixOrFileMap: string|{[key in WasmBinaryName]?: string},\n usePlatformFetch = false): void {\n if (initAborted) {\n throw new Error(\n 'The WASM backend was already initialized. Make sure you call ' +\n '`setWasmPaths()` before you call `tf.setBackend()` or ' +\n '`tf.ready()`');\n }\n\n if (typeof prefixOrFileMap === 'string') {\n wasmPathPrefix = prefixOrFileMap;\n } else {\n wasmFileMap = prefixOrFileMap;\n const missingPaths =\n wasmBinaryNames.filter(name => wasmFileMap[name] == null);\n if (missingPaths.length > 0) {\n throw new Error(\n `There were no entries found for the following binaries: ` +\n `${missingPaths.join(',')}. Please either call setWasmPaths with a ` +\n `map providing a path for each binary, or with a string indicating ` +\n `the directory where all the binaries can be found.`);\n }\n }\n\n customFetch = usePlatformFetch;\n}\n\n/** Used in unit tests. */\nexport function resetWasmPath(): void {\n wasmPath = null;\n wasmPathPrefix = null;\n wasmFileMap = {};\n customFetch = false;\n initAborted = false;\n}\n\nlet threadsCount = -1;\nlet actualThreadsCount = -1;\n\n/**\n * Sets the number of threads that will be used by XNNPACK to create\n * threadpool (default to the number of logical CPU cores).\n *\n * This must be called before calling `tf.setBackend('wasm')`.\n */\nexport function setThreadsCount(numThreads: number) {\n threadsCount = numThreads;\n}\n\n/**\n * Gets the actual threads count that is used by XNNPACK.\n *\n * It is set after the backend is intialized.\n */\nexport function getThreadsCount(): number {\n if (actualThreadsCount === -1) {\n throw new Error(`WASM backend not initialized.`);\n }\n return actualThreadsCount;\n}\n","/** @license See the LICENSE file. */\n\n// This code is auto-generated, do not modify this file!\nconst version = '4.0.0';\nexport {version};\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport './flags_wasm';\n\nimport {registerBackend} from '@tensorflow/tfjs-core';\n\nimport {BackendWasm, init} from './backend_wasm';\n\nexport {BackendWasm, getThreadsCount, setThreadsCount, setWasmPath, setWasmPaths} from './backend_wasm';\nexport {version as version_wasm} from './version';\n\nconst WASM_PRIORITY = 2;\nregisterBackend('wasm', async () => {\n const {wasm} = await init();\n return new BackendWasm(wasm);\n}, WASM_PRIORITY);\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport './register_all_kernels';\nexport * from './base';\n",null,null,null,null,null,"/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {env} from '@tensorflow/tfjs-core';\n\nconst ENV = env();\n\n/** Whether to keep intermediate tensors. */\nENV.registerFlag('KEEP_INTERMEDIATE_TENSORS', () => false, debugValue => {\n if (debugValue) {\n console.warn(\n 'Keep intermediate tensors is ON. This will print the values of all ' +\n 'intermediate tensors during model inference. Not all models ' +\n 'support this mode. For details, check e2e/benchmarks/ ' +\n 'model_config.js. This significantly impacts performance.');\n }\n});\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * =============================================================================\n */\n\n/* tslint:disable */\n\n/** Properties of an Any. */\nexport declare interface IAny {\n /** Any typeUrl */\n typeUrl?: (string|null);\n\n /** Any value */\n value?: (Uint8Array|null);\n}\n\n/** DataType enum. */\nexport enum DataType {\n // Not a legal value for DataType. Used to indicate a DataType field\n // has not been set.\n DT_INVALID = 0,\n\n // Data types that all computation devices are expected to be\n // capable to support.\n DT_FLOAT = 1,\n DT_DOUBLE = 2,\n DT_INT32 = 3,\n DT_UINT8 = 4,\n DT_INT16 = 5,\n DT_INT8 = 6,\n DT_STRING = 7,\n DT_COMPLEX64 = 8, // Single-precision complex\n DT_INT64 = 9,\n DT_BOOL = 10,\n DT_QINT8 = 11, // Quantized int8\n DT_QUINT8 = 12, // Quantized uint8\n DT_QINT32 = 13, // Quantized int32\n DT_BFLOAT16 = 14, // Float32 truncated to 16 bits. Only for cast ops.\n DT_QINT16 = 15, // Quantized int16\n DT_QUINT16 = 16, // Quantized uint16\n DT_UINT16 = 17,\n DT_COMPLEX128 = 18, // Double-precision complex\n DT_HALF = 19,\n DT_RESOURCE = 20,\n DT_VARIANT = 21, // Arbitrary C++ data types\n DT_UINT32 = 22,\n DT_UINT64 = 23,\n\n // Do not use! These are only for parameters. Every enum above\n // should have a corresponding value below (verified by types_test).\n DT_FLOAT_REF = 101,\n DT_DOUBLE_REF = 102,\n DT_INT32_REF = 103,\n DT_UINT8_REF = 104,\n DT_INT16_REF = 105,\n DT_INT8_REF = 106,\n DT_STRING_REF = 107,\n DT_COMPLEX64_REF = 108,\n DT_INT64_REF = 109,\n DT_BOOL_REF = 110,\n DT_QINT8_REF = 111,\n DT_QUINT8_REF = 112,\n DT_QINT32_REF = 113,\n DT_BFLOAT16_REF = 114,\n DT_QINT16_REF = 115,\n DT_QUINT16_REF = 116,\n DT_UINT16_REF = 117,\n DT_COMPLEX128_REF = 118,\n DT_HALF_REF = 119,\n DT_RESOURCE_REF = 120,\n DT_VARIANT_REF = 121,\n DT_UINT32_REF = 122,\n DT_UINT64_REF = 123,\n}\n\n/** Properties of a TensorShape. */\nexport declare interface ITensorShape {\n /** TensorShape dim */\n dim?: (TensorShape.IDim[]|null);\n\n /** TensorShape unknownRank */\n unknownRank?: (boolean|null);\n}\n\nexport namespace TensorShape {\n /** Properties of a Dim. */\n export declare interface IDim {\n /** Dim size */\n size?: (number|string|null);\n\n /** Dim name */\n name?: (string|null);\n }\n}\n\n/** Properties of a Tensor. */\nexport declare interface ITensor {\n /** Tensor dtype */\n dtype?: (DataType|null);\n\n /** Tensor tensorShape */\n tensorShape?: (ITensorShape|null);\n\n /** Tensor versionNumber */\n versionNumber?: (number|null);\n\n /** Tensor tensorContent */\n tensorContent?: (Uint8Array|null);\n\n /** Tensor floatVal */\n floatVal?: (number[]|null);\n\n /** Tensor doubleVal */\n doubleVal?: (number[]|null);\n\n /** Tensor intVal */\n intVal?: (number[]|null);\n\n /** Tensor stringVal */\n stringVal?: (Uint8Array[]|null);\n\n /** Tensor scomplexVal */\n scomplexVal?: (number[]|null);\n\n /** Tensor int64Val */\n int64Val?: ((number | string)[]|null);\n\n /** Tensor boolVal */\n boolVal?: (boolean[]|null);\n\n /** Tensor uint32Val */\n uint32Val?: (number[]|null);\n\n /** Tensor uint64Val */\n uint64Val?: ((number | string)[]|null);\n}\n\n/** Properties of an AttrValue. */\nexport declare interface IAttrValue {\n /** AttrValue list */\n list?: (AttrValue.IListValue|null);\n\n /** AttrValue s */\n s?: (string|null);\n\n /** AttrValue i */\n i?: (number|string|null);\n\n /** AttrValue f */\n f?: (number|null);\n\n /** AttrValue b */\n b?: (boolean|null);\n\n /** AttrValue type */\n type?: (DataType|null);\n\n /** AttrValue shape */\n shape?: (ITensorShape|null);\n\n /** AttrValue tensor */\n tensor?: (ITensor|null);\n\n /** AttrValue placeholder */\n placeholder?: (string|null);\n\n /** AttrValue func */\n func?: (INameAttrList|null);\n}\n\nexport namespace AttrValue {\n /** Properties of a ListValue. */\n export declare interface IListValue {\n /** ListValue s */\n s?: (string[]|null);\n\n /** ListValue i */\n i?: ((number | string)[]|null);\n\n /** ListValue f */\n f?: (number[]|null);\n\n /** ListValue b */\n b?: (boolean[]|null);\n\n /** ListValue type */\n type?: (DataType[]|null);\n\n /** ListValue shape */\n shape?: (ITensorShape[]|null);\n\n /** ListValue tensor */\n tensor?: (ITensor[]|null);\n\n /** ListValue func */\n func?: (INameAttrList[]|null);\n }\n}\n\n/** Properties of a NameAttrList. */\nexport declare interface INameAttrList {\n /** NameAttrList name */\n name?: (string|null);\n\n /** NameAttrList attr */\n attr?: ({[k: string]: IAttrValue}|null);\n}\n\n/** Properties of a NodeDef. */\nexport declare interface INodeDef {\n /** NodeDef name */\n name?: (string|null);\n\n /** NodeDef op */\n op?: (string|null);\n\n /** NodeDef input */\n input?: (string[]|null);\n\n /** NodeDef device */\n device?: (string|null);\n\n /** NodeDef attr */\n attr?: ({[k: string]: IAttrValue}|null);\n}\n\n/** Properties of a VersionDef. */\nexport declare interface IVersionDef {\n /** VersionDef producer */\n producer?: (number|null);\n\n /** VersionDef minConsumer */\n minConsumer?: (number|null);\n\n /** VersionDef badConsumers */\n badConsumers?: (number[]|null);\n}\n\n/** Properties of a GraphDef. */\nexport declare interface IGraphDef {\n /** GraphDef node */\n node?: (INodeDef[]|null);\n\n /** GraphDef versions */\n versions?: (IVersionDef|null);\n\n /** GraphDef library */\n library?: (IFunctionDefLibrary|null);\n}\n\n/** Properties of a CollectionDef. */\nexport declare interface ICollectionDef {\n /** CollectionDef nodeList */\n nodeList?: (CollectionDef.INodeList|null);\n\n /** CollectionDef bytesList */\n bytesList?: (CollectionDef.IBytesList|null);\n\n /** CollectionDef int64List */\n int64List?: (CollectionDef.IInt64List|null);\n\n /** CollectionDef floatList */\n floatList?: (CollectionDef.IFloatList|null);\n\n /** CollectionDef anyList */\n anyList?: (CollectionDef.IAnyList|null);\n}\n\nexport namespace CollectionDef {\n /** Properties of a NodeList. */\n export declare interface INodeList {\n /** NodeList value */\n value?: (string[]|null);\n }\n\n /** Properties of a BytesList. */\n export declare interface IBytesList {\n /** BytesList value */\n value?: (Uint8Array[]|null);\n }\n\n /** Properties of an Int64List. */\n export declare interface IInt64List {\n /** Int64List value */\n value?: ((number | string)[]|null);\n }\n\n /** Properties of a FloatList. */\n export declare interface IFloatList {\n /** FloatList value */\n value?: (number[]|null);\n }\n\n /** Properties of an AnyList. */\n export declare interface IAnyList {\n /** AnyList value */\n value?: (IAny[]|null);\n }\n}\n\n/** Properties of a SaverDef. */\nexport declare interface ISaverDef {\n /** SaverDef filenameTensorName */\n filenameTensorName?: (string|null);\n\n /** SaverDef saveTensorName */\n saveTensorName?: (string|null);\n\n /** SaverDef restoreOpName */\n restoreOpName?: (string|null);\n\n /** SaverDef maxToKeep */\n maxToKeep?: (number|null);\n\n /** SaverDef sharded */\n sharded?: (boolean|null);\n\n /** SaverDef keepCheckpointEveryNHours */\n keepCheckpointEveryNHours?: (number|null);\n\n /** SaverDef version */\n version?: (SaverDef.CheckpointFormatVersion|null);\n}\n\nexport namespace SaverDef {\n /** CheckpointFormatVersion enum. */\n export enum CheckpointFormatVersion {'LEGACY' = 0, 'V1' = 1, 'V2' = 2}\n}\n\n/** Properties of a TensorInfo. */\nexport declare interface ITensorInfo {\n /** TensorInfo name */\n name?: (string|null);\n\n /** TensorInfo cooSparse */\n cooSparse?: (TensorInfo.ICooSparse|null);\n\n /** TensorInfo dtype */\n dtype?: (DataType|string|null);\n\n /** TensorInfo tensorShape */\n tensorShape?: (ITensorShape|null);\n\n /** Resource id tensor was originally assigned to. */\n resourceId?: (number|null);\n}\n\nexport namespace TensorInfo {\n /** Properties of a CooSparse. */\n export declare interface ICooSparse {\n /** CooSparse valuesTensorName */\n valuesTensorName?: (string|null);\n\n /** CooSparse indicesTensorName */\n indicesTensorName?: (string|null);\n\n /** CooSparse denseShapeTensorName */\n denseShapeTensorName?: (string|null);\n }\n}\n\n/** Properties of a SignatureDef. */\nexport declare interface ISignatureDef {\n /** SignatureDef inputs */\n inputs?: ({[k: string]: ITensorInfo}|null);\n\n /** SignatureDef outputs */\n outputs?: ({[k: string]: ITensorInfo}|null);\n\n /** SignatureDef methodName */\n methodName?: (string|null);\n}\n\n/** Properties of an AssetFileDef. */\nexport declare interface IAssetFileDef {\n /** AssetFileDef tensorInfo */\n tensorInfo?: (ITensorInfo|null);\n\n /** AssetFileDef filename */\n filename?: (string|null);\n}\n\n/** Properties of an OpDef. */\nexport declare interface IOpDef {\n /** OpDef name */\n name?: (string|null);\n\n /** OpDef inputArg */\n inputArg?: (OpDef.IArgDef[]|null);\n\n /** OpDef outputArg */\n outputArg?: (OpDef.IArgDef[]|null);\n\n /** OpDef attr */\n attr?: (OpDef.IAttrDef[]|null);\n\n /** OpDef deprecation */\n deprecation?: (OpDef.IOpDeprecation|null);\n\n /** OpDef summary */\n summary?: (string|null);\n\n /** OpDef description */\n description?: (string|null);\n\n /** OpDef isCommutative */\n isCommutative?: (boolean|null);\n\n /** OpDef isAggregate */\n isAggregate?: (boolean|null);\n\n /** OpDef isStateful */\n isStateful?: (boolean|null);\n\n /** OpDef allowsUninitializedInput */\n allowsUninitializedInput?: (boolean|null);\n}\n\nexport namespace OpDef {\n /** Properties of an ArgDef. */\n export declare interface IArgDef {\n /** ArgDef name */\n name?: (string|null);\n\n /** ArgDef description */\n description?: (string|null);\n\n /** ArgDef type */\n type?: (DataType|null);\n\n /** ArgDef typeAttr */\n typeAttr?: (string|null);\n\n /** ArgDef numberAttr */\n numberAttr?: (string|null);\n\n /** ArgDef typeListAttr */\n typeListAttr?: (string|null);\n\n /** ArgDef isRef */\n isRef?: (boolean|null);\n }\n\n /** Properties of an AttrDef. */\n export declare interface IAttrDef {\n /** AttrDef name */\n name?: (string|null);\n\n /** AttrDef type */\n type?: (string|null);\n\n /** AttrDef defaultValue */\n defaultValue?: (IAttrValue|null);\n\n /** AttrDef description */\n description?: (string|null);\n\n /** AttrDef hasMinimum */\n hasMinimum?: (boolean|null);\n\n /** AttrDef minimum */\n minimum?: (number|string|null);\n\n /** AttrDef allowedValues */\n allowedValues?: (IAttrValue|null);\n }\n\n /** Properties of an OpDeprecation. */\n export declare interface IOpDeprecation {\n /** OpDeprecation version */\n version?: (number|null);\n\n /** OpDeprecation explanation */\n explanation?: (string|null);\n }\n}\n\n/** Properties of an OpList. */\nexport declare interface IOpList {\n /** OpList op */\n op?: (IOpDef[]|null);\n}\n\n/** Properties of a MetaGraphDef. */\nexport declare interface IMetaGraphDef {\n /** MetaGraphDef metaInfoDef */\n metaInfoDef?: (MetaGraphDef.IMetaInfoDef|null);\n\n /** MetaGraphDef graphDef */\n graphDef?: (IGraphDef|null);\n\n /** MetaGraphDef saverDef */\n saverDef?: (ISaverDef|null);\n\n /** MetaGraphDef collectionDef */\n collectionDef?: ({[k: string]: ICollectionDef}|null);\n\n /** MetaGraphDef signatureDef */\n signatureDef?: ({[k: string]: ISignatureDef}|null);\n\n /** MetaGraphDef assetFileDef */\n assetFileDef?: (IAssetFileDef[]|null);\n}\n\nexport namespace MetaGraphDef {\n /** Properties of a MetaInfoDef. */\n export declare interface IMetaInfoDef {\n /** MetaInfoDef metaGraphVersion */\n metaGraphVersion?: (string|null);\n\n /** MetaInfoDef strippedOpList */\n strippedOpList?: (IOpList|null);\n\n /** MetaInfoDef anyInfo */\n anyInfo?: (IAny|null);\n\n /** MetaInfoDef tags */\n tags?: (string[]|null);\n\n /** MetaInfoDef tensorflowVersion */\n tensorflowVersion?: (string|null);\n\n /** MetaInfoDef tensorflowGitVersion */\n tensorflowGitVersion?: (string|null);\n }\n}\n\n/** Properties of a SavedModel. */\nexport declare interface ISavedModel {\n /** SavedModel savedModelSchemaVersion */\n savedModelSchemaVersion?: (number|string|null);\n\n /** SavedModel metaGraphs */\n metaGraphs?: (IMetaGraphDef[]|null);\n}\n\n/** Properties of a FunctionDefLibrary. */\nexport declare interface IFunctionDefLibrary {\n /** FunctionDefLibrary function */\n 'function'?: (IFunctionDef[]|null);\n\n /** FunctionDefLibrary gradient */\n gradient?: (IGradientDef[]|null);\n}\n\n/** Properties of a FunctionDef. */\nexport declare interface IFunctionDef {\n /** FunctionDef signature */\n signature?: (IOpDef|null);\n\n /** FunctionDef attr */\n attr?: ({[k: string]: IAttrValue}|null);\n\n /** FunctionDef nodeDef */\n nodeDef?: (INodeDef[]|null);\n\n /** FunctionDef ret */\n ret?: ({[k: string]: string}|null);\n}\n\n/** Properties of a GradientDef. */\nexport declare interface IGradientDef {\n /** GradientDef functionName */\n functionName?: (string|null);\n\n /** GradientDef gradientFunc */\n gradientFunc?: (string|null);\n}\n","\n/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpExecutor, OpMapper} from '../types';\n\nconst CUSTOM_OPS: {[key: string]: OpMapper} = {};\n\n/**\n * Register an Op for graph model executor. This allows you to register\n * TensorFlow custom op or override existing op.\n *\n * Here is an example of registering a new MatMul Op.\n * ```js\n * const customMatmul = (node) =>\n * tf.matMul(\n * node.inputs[0], node.inputs[1],\n * node.attrs['transpose_a'], node.attrs['transpose_b']);\n *\n * tf.registerOp('MatMul', customMatmul);\n * ```\n * The inputs and attrs of the node object are based on the TensorFlow op\n * registry.\n *\n * @param name The Tensorflow Op name.\n * @param opFunc An op function which is called with the current graph node\n * during execution and needs to return a tensor or a list of tensors. The node\n * has the following attributes:\n * - attr: A map from attribute name to its value\n * - inputs: A list of input tensors\n *\n * @doc {heading: 'Models', subheading: 'Op Registry'}\n */\nexport function registerOp(name: string, opFunc: OpExecutor) {\n const opMapper: OpMapper = {\n tfOpName: name,\n category: 'custom',\n inputs: [],\n attrs: [],\n customExecutor: opFunc\n };\n\n CUSTOM_OPS[name] = opMapper;\n}\n\n/**\n * Retrieve the OpMapper object for the registered op.\n *\n * @param name The Tensorflow Op name.\n *\n * @doc {heading: 'Models', subheading: 'Op Registry'}\n */\nexport function getRegisteredOp(name: string): OpMapper {\n return CUSTOM_OPS[name];\n}\n\n/**\n * Deregister the Op for graph model executor.\n *\n * @param name The Tensorflow Op name.\n *\n * @doc {heading: 'Models', subheading: 'Op Registry'}\n */\nexport function deregisterOp(name: string) {\n delete CUSTOM_OPS[name];\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {clone, Tensor, util} from '@tensorflow/tfjs-core';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {ResourceManager} from '../../executor/resource_manager';\nimport {Node, ValueType} from '../types';\n\nexport function getParamValue(\n paramName: string, node: Node, tensorMap: NamedTensorsMap,\n context: ExecutionContext, resourceManager?: ResourceManager): ValueType {\n const inputParam = node.inputParams[paramName];\n if (inputParam && inputParam.inputIndexStart !== undefined) {\n const start = inputParam.inputIndexStart;\n const end = inputParam.inputIndexEnd === 0 ?\n undefined :\n (inputParam.inputIndexEnd === undefined ? start + 1 :\n inputParam.inputIndexEnd);\n if (inputParam.type === 'tensor') {\n return getTensor(\n node.inputNames[inputParam.inputIndexStart], tensorMap, context,\n resourceManager);\n }\n if (inputParam.type === 'tensors') {\n const inputs = node.inputNames.slice(start, end);\n\n return inputs.map(\n name => getTensor(name, tensorMap, context, resourceManager));\n }\n const tensor = getTensor(\n node.inputNames.slice(start)[0], tensorMap, context, resourceManager);\n const data = tensor.dataSync();\n return inputParam.type === 'number' ?\n data[0] :\n util.toNestedArray(tensor.shape, data);\n }\n const attrParam = node.attrParams[paramName];\n return attrParam && attrParam.value;\n}\n\n/**\n * Retrieve the tensor from tensorsMap based on input name.\n * @param name Node input name\n * @param tensorsMap Tensors map keyed by the node\n * @param context contains tensors and information for running the current node.\n * @param resourceManager Optional. Contains global resources of the model.\n */\nexport function getTensor(\n name: string, tensorsMap: NamedTensorsMap, context: ExecutionContext,\n resourceManager?: ResourceManager): Tensor {\n const [nodeName, index] = parseNodeName(name);\n\n if (resourceManager != null) {\n const tensor = resourceManager.getHashTableHandleByName(nodeName);\n if (tensor != null) {\n return tensor;\n }\n }\n\n const contextId = context.currentContextIds.find(contextId => {\n return !!tensorsMap[getNodeNameWithContextId(nodeName, contextId)];\n });\n\n return contextId !== undefined ?\n tensorsMap[getNodeNameWithContextId(nodeName, contextId)][index] :\n undefined;\n}\n\n/**\n * Retrieve the tensors based on input name for current context.\n * @param name Node input name\n * @param tensorsMap Tensors map keyed by the node\n */\nexport function getTensorsForCurrentContenxt(\n name: string, tensorsMap: NamedTensorsMap,\n context: ExecutionContext): Tensor[] {\n return tensorsMap[getNodeNameWithContextId(name, context.currentContextId)];\n}\n\n/**\n * Returns the node name, outputName and index from the Node input name.\n * @param inputName The input name of the node, in format of\n * node_name:output_index, i.e. MatMul:0, if the output_index is not set, it is\n * default to 0.\n * If the input name contains output name i.e. StringSplit:indices:0, it will\n * return ['StringSplit', 0, 'indices'].\n */\nexport function getNodeNameAndIndex(\n inputName: string, context?: ExecutionContext): [string, number, string] {\n const [nodeName, index, outputName] = parseNodeName(inputName);\n\n return [\n getNodeNameWithContextId(nodeName, context && context.currentContextId),\n index, outputName\n ];\n}\n\nfunction getNodeNameWithContextId(name: string, contextId?: string): string {\n return !!contextId ? `${name}-${contextId}` : name;\n}\n\nexport function parseNodeName(name: string): [string, number, string] {\n const parts = name.split(':');\n if (parts.length === 1) {\n return [name, 0, undefined];\n }\n\n const nodeName = parts[0];\n const outputName = parts.length === 3 ? parts[1] : undefined;\n const index = Number(parts[parts.length - 1]);\n return [nodeName, index, outputName];\n}\n\nexport function split(arr: number[], size: number) {\n const res = [];\n for (let i = 0; i < arr.length; i += size) {\n res.push(arr.slice(i, i + size));\n }\n return res;\n}\nexport function getPadding(\n node: Node, tensorMap: NamedTensorsMap,\n context: ExecutionContext): ValueType {\n let pad = getParamValue('pad', node, tensorMap, context);\n if (pad === 'explicit') {\n // This is 1d array, we need to convert it to 2d array\n pad = getParamValue('explicitPaddings', node, tensorMap, context);\n const explicitPadding: [\n [number, number], [number, number], [number, number], [number, number]\n ] = [[0, 0], [0, 0], [0, 0], [0, 0]];\n for (let i = 0; i < 4; i++) {\n explicitPadding[i][0] = (pad as number[])[i * 2];\n explicitPadding[i][1] = (pad as number[])[i * 2 + 1];\n }\n return explicitPadding;\n }\n return pad;\n}\n\n/**\n * Reuse the tensor if it is marked as keep, otherwise clone the tensor to\n * avoid disposal. This is important for TensorArray and TensorList ops, since\n * internally they use a tensor as the id for TensorArray and TensorList, and\n * to simplify lookup, they also use Tensor.id as the key to the internal map.\n * These id tensors have been marked as kept in the backend, we need avoid clone\n * them in order to create new Tensor.id.\n * @param tensor\n */\nexport function cloneTensor(tensor: Tensor): Tensor {\n return tensor.kept ? tensor : clone(tensor);\n}\n","\n/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpMapper} from '../types';\n\nexport const json: OpMapper[] = [\n {\n 'tfOpName': 'Add',\n 'category': 'arithmetic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'AddV2',\n 'category': 'arithmetic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'AddN',\n 'category': 'arithmetic',\n 'inputs': [\n {\n 'start': 0,\n 'end': 0,\n 'name': 'tensors',\n 'type': 'tensors'\n }\n ]\n },\n {\n 'tfOpName': 'BiasAdd',\n 'category': 'arithmetic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n },\n {\n 'tfName': 'data_format',\n 'name': 'dataFormat',\n 'type': 'string',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Sub',\n 'category': 'arithmetic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'RealDiv',\n 'category': 'arithmetic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Div',\n 'category': 'arithmetic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'DivNoNan',\n 'category': 'arithmetic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'FloorDiv',\n 'category': 'arithmetic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Mul',\n 'category': 'arithmetic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Maximum',\n 'category': 'arithmetic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Minimum',\n 'category': 'arithmetic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Pow',\n 'category': 'arithmetic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'SquaredDifference',\n 'category': 'arithmetic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Mod',\n 'category': 'arithmetic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'FloorMod',\n 'category': 'arithmetic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n }\n];\n","\n/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpMapper} from '../types';\n\nexport const json: OpMapper[] = [\n {\n 'tfOpName': 'Abs',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Acos',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Asin',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Atan',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Atan2',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'y',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Ceil',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'ClipByValue',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'clipValueMin',\n 'type': 'number'\n },\n {\n 'start': 2,\n 'name': 'clipValueMax',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Complex',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'real',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'imag',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'ComplexAbs',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Cos',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Cosh',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Elu',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Exp',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Floor',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Log',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Imag',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n },\n {\n 'tfName': 'Tout',\n 'name': 'outputType',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Neg',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Real',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n },\n {\n 'tfName': 'Tout',\n 'name': 'outputType',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Prelu',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'alpha',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Relu',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Relu6',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Selu',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Sigmoid',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Sin',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Sinh',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Sqrt',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Rsqrt',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Square',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Tan',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Tanh',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Sign',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Round',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Expm1',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Log1p',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Reciprocal',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Softplus',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Asinh',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Acosh',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Atanh',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Erf',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Prod',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'axes',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'keep_dims',\n 'name': 'keepDims',\n 'type': 'bool',\n 'notSupported': true\n },\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'LeakyRelu',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'alpha',\n 'name': 'alpha',\n 'type': 'number',\n 'defaultValue': 0.2\n },\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'IsNan',\n 'category': 'basic_math',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n }\n];\n","\n/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpMapper} from '../types';\n\nexport const json: OpMapper[] = [\n {\n 'tfOpName': 'EmptyTensorList',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'elementShape',\n 'type': 'shape'\n },\n {\n 'start': 1,\n 'name': 'maxNumElements',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'element_dtype',\n 'name': 'elementDType',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'LoopCond',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'pred',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'Switch',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'data',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'pred',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'Merge',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'end': 0,\n 'name': 'tensors',\n 'type': 'tensors'\n }\n ]\n },\n {\n 'tfOpName': 'Enter',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensor',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n },\n {\n 'tfName': 'frame_name',\n 'name': 'frameName',\n 'type': 'string'\n },\n {\n 'tfName': 'is_constant',\n 'name': 'isConstant',\n 'type': 'bool'\n }\n ]\n },\n {\n 'tfOpName': 'Exit',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensor',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'NextIteration',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensor',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'TensorArrayV3',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'size',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'dtype',\n 'name': 'dtype',\n 'type': 'dtype'\n },\n {\n 'tfName': 'element_shape',\n 'name': 'elementShape',\n 'type': 'shape'\n },\n {\n 'tfName': 'dynamic_size',\n 'name': 'dynamicSize',\n 'type': 'bool'\n },\n {\n 'tfName': 'clear_after_read',\n 'name': 'clearAfterRead',\n 'type': 'bool'\n },\n {\n 'tfName': 'identical_element_shapes',\n 'name': 'identicalElementShapes',\n 'type': 'bool'\n },\n {\n 'tfName': 'tensor_array_name',\n 'name': 'name',\n 'type': 'string'\n }\n ]\n },\n {\n 'tfOpName': 'TensorArrayWriteV3',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensorArrayId',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'index',\n 'type': 'number'\n },\n {\n 'start': 2,\n 'name': 'tensor',\n 'type': 'tensor'\n },\n {\n 'start': 3,\n 'name': 'flowIn',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'TensorArrayReadV3',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensorArrayId',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'index',\n 'type': 'number'\n },\n {\n 'start': 2,\n 'name': 'flowIn',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'dtype',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'TensorArrayGatherV3',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensorArrayId',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'indices',\n 'type': 'number[]'\n },\n {\n 'start': 2,\n 'name': 'flowIn',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'dtype',\n 'name': 'dtype',\n 'type': 'dtype'\n },\n {\n 'tfName': 'element_shape',\n 'name': 'elementShape',\n 'type': 'shape'\n }\n ]\n },\n {\n 'tfOpName': 'TensorArrayScatterV3',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensorArrayId',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'indices',\n 'type': 'number[]'\n },\n {\n 'start': 2,\n 'name': 'tensor',\n 'type': 'tensor'\n },\n {\n 'start': 3,\n 'name': 'flowIn',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'TensorArrayConcatV3',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensorArrayId',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'flowIn',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'dtype',\n 'name': 'dtype',\n 'type': 'dtype'\n },\n {\n 'tfName': 'element_shape_except0',\n 'name': 'elementShapeExcept0',\n 'type': 'shape',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'TensorArraySplitV3',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensorArrayId',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'tensor',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'lengths',\n 'type': 'number[]'\n },\n {\n 'start': 3,\n 'name': 'flowIn',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'TensorArraySizeV3',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensorArrayId',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'flowIn',\n 'type': 'number'\n }\n ]\n },\n {\n 'tfOpName': 'TensorArrayCloseV3',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensorArrayId',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'StatelessIf',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'cond',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'end': 0,\n 'name': 'args',\n 'type': 'tensors'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'then_branch',\n 'name': 'thenBranch',\n 'type': 'func'\n },\n {\n 'tfName': 'else_branch',\n 'name': 'elseBranch',\n 'type': 'func'\n }\n ]\n },\n {\n 'tfOpName': 'If',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'cond',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'end': 0,\n 'name': 'args',\n 'type': 'tensors'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'then_branch',\n 'name': 'thenBranch',\n 'type': 'func'\n },\n {\n 'tfName': 'else_branch',\n 'name': 'elseBranch',\n 'type': 'func'\n }\n ]\n },\n {\n 'tfOpName': 'StatelessWhile',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'end': 0,\n 'name': 'args',\n 'type': 'tensors'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'cond',\n 'name': 'cond',\n 'type': 'func'\n },\n {\n 'tfName': 'body',\n 'name': 'body',\n 'type': 'func'\n }\n ]\n },\n {\n 'tfOpName': 'While',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'end': 0,\n 'name': 'args',\n 'type': 'tensors'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'cond',\n 'name': 'cond',\n 'type': 'func'\n },\n {\n 'tfName': 'body',\n 'name': 'body',\n 'type': 'func'\n }\n ]\n },\n {\n 'tfOpName': 'TensorListScatter',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensor',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'indices',\n 'type': 'number[]'\n },\n {\n 'start': 2,\n 'name': 'elementShape',\n 'type': 'shape'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'element_dtype',\n 'name': 'elementDType',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'TensorListScatterV2',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensor',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'indices',\n 'type': 'number[]'\n },\n {\n 'start': 2,\n 'name': 'elementShape',\n 'type': 'shape'\n },\n {\n 'start': 3,\n 'name': 'numElements',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'element_dtype',\n 'name': 'elementDType',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'TensorListGather',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensorListId',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'indices',\n 'type': 'number[]'\n },\n {\n 'start': 2,\n 'name': 'elementShape',\n 'type': 'shape'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'element_dtype',\n 'name': 'elementDType',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'TensorListGetItem',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensorListId',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'index',\n 'type': 'number'\n },\n {\n 'start': 2,\n 'name': 'elementShape',\n 'type': 'shape'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'element_dtype',\n 'name': 'elementDType',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'TensorListSetItem',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensorListId',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'index',\n 'type': 'number'\n },\n {\n 'start': 2,\n 'name': 'tensor',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'element_dtype',\n 'name': 'elementDType',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'TensorListReserve',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'elementShape',\n 'type': 'shape'\n },\n {\n 'start': 1,\n 'name': 'numElements',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'element_dtype',\n 'name': 'elementDType',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'TensorListFromTensor',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensor',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'elementShape',\n 'type': 'shape'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'element_dtype',\n 'name': 'elementDType',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'TensorListStack',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensorListId',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'elementShape',\n 'type': 'shape'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'element_dtype',\n 'name': 'elementDType',\n 'type': 'dtype'\n },\n {\n 'tfName': 'num_elements',\n 'name': 'numElements',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'TensorListSplit',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensor',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'elementShape',\n 'type': 'shape'\n },\n {\n 'start': 2,\n 'name': 'lengths',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'element_dtype',\n 'name': 'elementDType',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'TensorListConcat',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensorListId',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'element_shape',\n 'name': 'elementShape',\n 'type': 'shape'\n },\n {\n 'tfName': 'element_dtype',\n 'name': 'elementDType',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'TensorListConcatV2',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensorListId',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'element_shape',\n 'name': 'elementShape',\n 'type': 'shape'\n },\n {\n 'tfName': 'element_dtype',\n 'name': 'elementDType',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'TensorListPopBack',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensorListId',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'elementShape',\n 'type': 'shape'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'element_dtype',\n 'name': 'elementDType',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'TensorListPushBack',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensorListId',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'tensor',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'element_dtype',\n 'name': 'elementDType',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'TensorListLength',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensorListId',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'TensorListResize',\n 'category': 'control',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensorListId',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'size',\n 'type': 'number'\n }\n ]\n }\n]\n;\n","\n/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpMapper} from '../types';\n\nexport const json: OpMapper[] = [\n {\n 'tfOpName': 'AvgPool',\n 'category': 'convolution',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'strides',\n 'name': 'strides',\n 'type': 'number[]'\n },\n {\n 'tfName': 'padding',\n 'name': 'pad',\n 'type': 'string'\n },\n {\n 'tfName': 'data_format',\n 'name': 'dataFormat',\n 'type': 'string',\n 'notSupported': true\n },\n {\n 'tfName': 'ksize',\n 'name': 'kernelSize',\n 'type': 'number[]'\n },\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'MaxPool',\n 'category': 'convolution',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'strides',\n 'name': 'strides',\n 'type': 'number[]'\n },\n {\n 'tfName': 'padding',\n 'name': 'pad',\n 'type': 'string'\n },\n {\n 'tfName': 'data_format',\n 'name': 'dataFormat',\n 'type': 'string',\n 'notSupported': true\n },\n {\n 'tfName': 'ksize',\n 'name': 'kernelSize',\n 'type': 'number[]'\n },\n {\n 'tfName': 'explicit_paddings',\n 'name': 'explicitPaddings',\n 'type': 'number[]',\n 'defaultValue': [],\n 'notSupported': true\n },\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'MaxPoolWithArgmax',\n 'category': 'convolution',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'strides',\n 'name': 'strides',\n 'type': 'number[]'\n },\n {\n 'tfName': 'padding',\n 'name': 'pad',\n 'type': 'string'\n },\n {\n 'tfName': 'ksize',\n 'name': 'kernelSize',\n 'type': 'number[]'\n },\n {\n 'tfName': 'include_batch_in_index',\n 'name': 'includeBatchInIndex',\n 'type': 'bool'\n },\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'AvgPool3D',\n 'category': 'convolution',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'strides',\n 'name': 'strides',\n 'type': 'number[]'\n },\n {\n 'tfName': 'padding',\n 'name': 'pad',\n 'type': 'string'\n },\n {\n 'tfName': 'data_format',\n 'name': 'dataFormat',\n 'type': 'string',\n 'notSupported': true\n },\n {\n 'tfName': 'ksize',\n 'name': 'kernelSize',\n 'type': 'number[]'\n },\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'MaxPool3D',\n 'category': 'convolution',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'strides',\n 'name': 'strides',\n 'type': 'number[]'\n },\n {\n 'tfName': 'padding',\n 'name': 'pad',\n 'type': 'string'\n },\n {\n 'tfName': 'data_format',\n 'name': 'dataFormat',\n 'type': 'string',\n 'notSupported': true\n },\n {\n 'tfName': 'ksize',\n 'name': 'kernelSize',\n 'type': 'number[]'\n },\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Conv1D',\n 'category': 'convolution',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'filter',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'stride',\n 'name': 'stride',\n 'type': 'number'\n },\n {\n 'tfName': 'padding',\n 'name': 'pad',\n 'type': 'string'\n },\n {\n 'tfName': 'data_format',\n 'name': 'dataFormat',\n 'type': 'string',\n 'defaultValue': 'NWC'\n },\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n },\n {\n 'tfName': 'dilation',\n 'name': 'dilation',\n 'type': 'number',\n 'defaultValue': 1\n }\n ]\n },\n {\n 'tfOpName': 'Conv2D',\n 'category': 'convolution',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'filter',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n },\n {\n 'tfName': 'strides',\n 'name': 'strides',\n 'type': 'number[]'\n },\n {\n 'tfName': 'padding',\n 'name': 'pad',\n 'type': 'string'\n },\n {\n 'tfName': 'useCudnnOnGpu',\n 'name': 'useCudnnOnGpu',\n 'type': 'bool'\n },\n {\n 'tfName': 'data_format',\n 'name': 'dataFormat',\n 'type': 'string',\n 'defaultValue': 'NHWC'\n },\n {\n 'tfName': 'explicit_paddings',\n 'name': 'explicitPaddings',\n 'type': 'number[]',\n 'defaultValue': []\n },\n {\n 'tfName': 'dilations',\n 'name': 'dilations',\n 'type': 'number[]'\n }\n ]\n },\n {\n 'tfOpName': '_FusedConv2D',\n 'category': 'convolution',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'filter',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'end': 0,\n 'name': 'args',\n 'type': 'tensors'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'num_args',\n 'name': 'numArgs',\n 'type': 'number'\n },\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n },\n {\n 'tfName': 'strides',\n 'name': 'strides',\n 'type': 'number[]'\n },\n {\n 'tfName': 'padding',\n 'name': 'pad',\n 'type': 'string'\n },\n {\n 'tfName': 'explicit_paddings',\n 'name': 'explicitPaddings',\n 'type': 'number[]',\n 'defaultValue': []\n },\n {\n 'tfName': 'use_cudnn_on_gpu',\n 'name': 'useCudnnOnGpu',\n 'type': 'bool',\n 'defaultValue': true\n },\n {\n 'tfName': 'data_format',\n 'name': 'dataFormat',\n 'type': 'string',\n 'defaultValue': 'NHWC'\n },\n {\n 'tfName': 'dilations',\n 'name': 'dilations',\n 'type': 'number[]',\n 'defaultValue': [\n 1,\n 1,\n 1,\n 1\n ]\n },\n {\n 'tfName': 'fused_ops',\n 'name': 'fusedOps',\n 'type': 'string[]',\n 'defaultValue': []\n },\n {\n 'tfName': 'epsilon',\n 'name': 'epsilon',\n 'type': 'number',\n 'defaultValue': 0.0001\n },\n {\n 'tfName': 'leakyrelu_alpha',\n 'name': 'leakyreluAlpha',\n 'type': 'number',\n 'defaultValue': 0.2\n }\n ]\n },\n {\n 'tfOpName': 'Conv2DBackpropInput',\n 'category': 'convolution',\n 'inputs': [\n {\n 'start': 2,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'filter',\n 'type': 'tensor'\n },\n {\n 'start': 0,\n 'name': 'outputShape',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'strides',\n 'name': 'strides',\n 'type': 'number[]'\n },\n {\n 'tfName': 'padding',\n 'name': 'pad',\n 'type': 'string'\n },\n {\n 'tfName': 'data_format',\n 'name': 'dataFormat',\n 'type': 'string',\n 'notSupported': true\n },\n {\n 'tfName': 'explicit_paddings',\n 'name': 'explicitPaddings',\n 'type': 'number[]',\n 'defaultValue': []\n },\n {\n 'tfName': 'dilations',\n 'name': 'dilations',\n 'type': 'number[]',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'DepthwiseConv2d',\n 'category': 'convolution',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'input',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'filter',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'strides',\n 'name': 'strides',\n 'type': 'number[]'\n },\n {\n 'tfName': 'padding',\n 'name': 'pad',\n 'type': 'string'\n },\n {\n 'tfName': 'data_format',\n 'name': 'dataFormat',\n 'type': 'string',\n 'defaultValue': 'NHWC'\n },\n {\n 'tfName': 'explicit_paddings',\n 'name': 'explicitPaddings',\n 'type': 'number[]',\n 'defaultValue': []\n },\n {\n 'tfName': 'dilations',\n 'name': 'dilations',\n 'type': 'number[]'\n }\n ]\n },\n {\n 'tfOpName': 'DepthwiseConv2dNative',\n 'category': 'convolution',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'input',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'filter',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'strides',\n 'name': 'strides',\n 'type': 'number[]'\n },\n {\n 'tfName': 'padding',\n 'name': 'pad',\n 'type': 'string'\n },\n {\n 'tfName': 'data_format',\n 'name': 'dataFormat',\n 'type': 'string',\n 'defaultValue': 'NHWC'\n },\n {\n 'tfName': 'explicit_paddings',\n 'name': 'explicitPaddings',\n 'type': 'number[]',\n 'defaultValue': []\n },\n {\n 'tfName': 'dilations',\n 'name': 'dilations',\n 'type': 'number[]'\n }\n ]\n },\n {\n 'tfOpName': 'FusedDepthwiseConv2dNative',\n 'category': 'convolution',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'filter',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'end': 0,\n 'name': 'args',\n 'type': 'tensors'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'num_args',\n 'name': 'numArgs',\n 'type': 'number'\n },\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n },\n {\n 'tfName': 'strides',\n 'name': 'strides',\n 'type': 'number[]'\n },\n {\n 'tfName': 'padding',\n 'name': 'pad',\n 'type': 'string'\n },\n {\n 'tfName': 'data_format',\n 'name': 'dataFormat',\n 'type': 'string',\n 'defaultValue': 'NHWC'\n },\n {\n 'tfName': 'dilations',\n 'name': 'dilations',\n 'type': 'number[]',\n 'defaultValue': [\n 1,\n 1,\n 1,\n 1\n ]\n },\n {\n 'tfName': 'fused_ops',\n 'name': 'fusedOps',\n 'type': 'string[]',\n 'defaultValue': []\n },\n {\n 'tfName': 'explicit_paddings',\n 'name': 'explicitPaddings',\n 'type': 'number[]',\n 'defaultValue': []\n }\n ]\n },\n {\n 'tfOpName': 'Conv3D',\n 'category': 'convolution',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'filter',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'strides',\n 'name': 'strides',\n 'type': 'number[]'\n },\n {\n 'tfName': 'padding',\n 'name': 'pad',\n 'type': 'string'\n },\n {\n 'tfName': 'data_format',\n 'name': 'dataFormat',\n 'type': 'string',\n 'defaultValue': 'NHWC'\n },\n {\n 'tfName': 'dilations',\n 'name': 'dilations',\n 'type': 'number[]'\n }\n ]\n },\n {\n 'tfOpName': 'Dilation2D',\n 'category': 'convolution',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'filter',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'strides',\n 'name': 'strides',\n 'type': 'number[]'\n },\n {\n 'tfName': 'rates',\n 'name': 'dilations',\n 'type': 'number[]'\n },\n {\n 'tfName': 'padding',\n 'name': 'pad',\n 'type': 'string'\n }\n ]\n }\n]\n;\n","\n/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpMapper} from '../types';\n\nexport const json: OpMapper[] = [\n {\n 'tfOpName': 'Fill',\n 'category': 'creation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'shape',\n 'type': 'number[]'\n },\n {\n 'start': 1,\n 'name': 'value',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'LinSpace',\n 'category': 'creation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'start',\n 'type': 'number'\n },\n {\n 'start': 1,\n 'name': 'stop',\n 'type': 'number'\n },\n {\n 'start': 2,\n 'name': 'num',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'OneHot',\n 'category': 'creation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'indices',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'depth',\n 'type': 'number'\n },\n {\n 'start': 2,\n 'name': 'onValue',\n 'type': 'number',\n 'defaultValue': 1\n },\n {\n 'start': 3,\n 'name': 'offValue',\n 'type': 'number',\n 'defaultValue': 0\n }\n ],\n 'attrs': [\n {\n 'tfName': 'axis',\n 'name': 'axis',\n 'type': 'number',\n 'notSupported': true\n },\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'Ones',\n 'category': 'creation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'shape',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'OnesLike',\n 'category': 'creation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'dtype',\n 'name': 'dtype',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'RandomStandardNormal',\n 'category': 'creation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'shape',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'seed',\n 'name': 'seed',\n 'type': 'number',\n 'defaultValue': 0\n },\n {\n 'tfName': 'seed2',\n 'name': 'seed2',\n 'type': 'number',\n 'defaultValue': 0,\n 'notSupported': true\n },\n {\n 'tfName': 'dtype',\n 'name': 'dtype',\n 'type': 'dtype'\n },\n {\n 'tfName': 'T',\n 'name': 'T',\n 'type': 'number',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'RandomUniform',\n 'category': 'creation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'shape',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'minval',\n 'name': 'minval',\n 'type': 'number',\n 'defaultValue': 0\n },\n {\n 'tfName': 'maxval',\n 'name': 'maxval',\n 'type': 'number',\n 'defaultValue': 1\n },\n {\n 'tfName': 'dtype',\n 'name': 'dtype',\n 'type': 'dtype'\n },\n {\n 'tfName': 'seed',\n 'name': 'seed',\n 'type': 'number',\n 'defaultValue': 0\n },\n {\n 'tfName': 'seed2',\n 'name': 'seed2',\n 'type': 'number',\n 'defaultValue': 0,\n 'notSupported': true\n },\n {\n 'tfName': 'T',\n 'name': 'T',\n 'type': 'number',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Range',\n 'category': 'creation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'start',\n 'type': 'number'\n },\n {\n 'start': 1,\n 'name': 'stop',\n 'type': 'number'\n },\n {\n 'start': 2,\n 'name': 'step',\n 'type': 'number',\n 'defaultValue': 0\n }\n ],\n 'attrs': [\n {\n 'tfName': 'Tidx',\n 'name': 'dtype',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'TruncatedNormal',\n 'category': 'creation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'shape',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'means',\n 'name': 'mean',\n 'type': 'number',\n 'defaultValue': 0\n },\n {\n 'tfName': 'stddev',\n 'name': 'stdDev',\n 'type': 'number',\n 'defaultValue': 1\n },\n {\n 'tfName': 'seed',\n 'name': 'seed',\n 'type': 'number'\n },\n {\n 'tfName': 'seed2',\n 'name': 'seed2',\n 'type': 'number',\n 'defaultValue': 0,\n 'notSupported': true\n },\n {\n 'tfName': 'dtype',\n 'name': 'dtype',\n 'type': 'dtype'\n },\n {\n 'tfName': 'T',\n 'name': 'T',\n 'type': 'number',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Zeros',\n 'category': 'creation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'shape',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'ZerosLike',\n 'category': 'creation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'Multinomial',\n 'category': 'creation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'logits',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'numSamples',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'seed',\n 'name': 'seed',\n 'type': 'number'\n },\n {\n 'tfName': 'seed2',\n 'name': 'seed2',\n 'type': 'number'\n },\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype'\n },\n {\n 'tfName': 'output_dtype',\n 'name': 'output_dtype',\n 'type': 'dtype'\n }\n ]\n }\n]\n;\n","\n/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpMapper} from '../types';\n\nexport const json: OpMapper[] = [\n {\n 'tfOpName': 'NonMaxSuppressionV2',\n 'category': 'dynamic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'boxes',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'scores',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'maxOutputSize',\n 'type': 'number'\n },\n {\n 'start': 3,\n 'name': 'iouThreshold',\n 'type': 'number'\n }\n ]\n },\n {\n 'tfOpName': 'NonMaxSuppressionV3',\n 'category': 'dynamic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'boxes',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'scores',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'maxOutputSize',\n 'type': 'number'\n },\n {\n 'start': 3,\n 'name': 'iouThreshold',\n 'type': 'number'\n },\n {\n 'start': 4,\n 'name': 'scoreThreshold',\n 'type': 'number'\n }\n ]\n },\n {\n 'tfOpName': 'NonMaxSuppressionV4',\n 'category': 'dynamic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'boxes',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'scores',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'maxOutputSize',\n 'type': 'number'\n },\n {\n 'start': 3,\n 'name': 'iouThreshold',\n 'type': 'number'\n },\n {\n 'start': 4,\n 'name': 'scoreThreshold',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n },\n {\n 'tfName': 'T_threshold',\n 'name': 'threshold',\n 'type': 'dtype',\n 'notSupported': true\n },\n {\n 'tfName': 'pad_to_max_output_size',\n 'name': 'padToMaxOutputSize',\n 'type': 'bool'\n }\n ]\n },\n {\n 'tfOpName': 'NonMaxSuppressionV5',\n 'category': 'dynamic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'boxes',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'scores',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'maxOutputSize',\n 'type': 'number'\n },\n {\n 'start': 3,\n 'name': 'iouThreshold',\n 'type': 'number'\n },\n {\n 'start': 4,\n 'name': 'scoreThreshold',\n 'type': 'number'\n },\n {\n 'start': 5,\n 'name': 'softNmsSigma',\n 'type': 'number'\n }\n ]\n },\n {\n 'tfOpName': 'Where',\n 'category': 'dynamic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'condition',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'ListDiff',\n 'category': 'dynamic',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'y',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n }\n];\n","\n/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpMapper} from '../types';\n\nexport const json: OpMapper[] = [\n {\n 'tfOpName': 'LowerBound',\n 'category': 'evaluation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'sortedSequence',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'values',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'TopKV2',\n 'category': 'evaluation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'k',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'sorted',\n 'name': 'sorted',\n 'type': 'bool'\n }\n ]\n },\n {\n 'tfOpName': 'UpperBound',\n 'category': 'evaluation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'sortedSequence',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'values',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'Unique',\n 'category': 'evaluation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'UniqueV2',\n 'category': 'evaluation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'axis',\n 'type': 'number'\n }\n ]\n }\n]\n;\n","\n/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpMapper} from '../types';\n\nexport const json: OpMapper[] = [\n {\n 'tfOpName': 'PlaceholderWithDefault',\n 'category': 'graph',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'default',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'shape',\n 'name': 'shape',\n 'type': 'shape'\n },\n {\n 'tfName': 'dtype',\n 'name': 'dtype',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'Placeholder',\n 'category': 'graph',\n 'attrs': [\n {\n 'tfName': 'shape',\n 'name': 'shape',\n 'type': 'shape'\n },\n {\n 'tfName': 'dtype',\n 'name': 'dtype',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'Const',\n 'category': 'graph'\n },\n {\n 'tfOpName': 'Identity',\n 'category': 'graph',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'IdentityN',\n 'category': 'graph',\n 'inputs': [\n {\n 'start': 0,\n 'end': 0,\n 'name': 'x',\n 'type': 'tensors'\n }\n ]\n },\n {\n 'tfOpName': 'Snapshot',\n 'category': 'graph',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'Rank',\n 'category': 'graph',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'Size',\n 'category': 'graph',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'Shape',\n 'category': 'graph',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'ShapeN',\n 'category': 'graph',\n 'inputs': [\n {\n 'start': 0,\n 'end': 0,\n 'name': 'x',\n 'type': 'tensors'\n }\n ]\n },\n {\n 'tfOpName': 'Print',\n 'category': 'graph',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'data',\n 'type': 'tensors'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'message',\n 'name': 'message',\n 'type': 'string'\n },\n {\n 'tfName': 'first_n',\n 'name': 'firstN',\n 'type': 'number',\n 'notSupported': true\n },\n {\n 'tfName': 'summarize',\n 'name': 'summarize',\n 'type': 'number',\n 'defaultValue': 3\n }\n ]\n },\n {\n 'tfOpName': 'NoOp',\n 'category': 'graph',\n 'inputs': []\n },\n {\n 'tfOpName': 'StopGradient',\n 'category': 'graph',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'FakeQuantWithMinMaxVars',\n 'category': 'graph',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'min',\n 'name': 'min',\n 'type': 'number'\n },\n {\n 'tfName': 'max',\n 'name': 'max',\n 'type': 'number'\n }\n ]\n }\n];\n","\n/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpMapper} from '../types';\n\nexport const json: OpMapper[] = [\n {\n 'tfOpName': 'HashTable',\n 'category': 'hash_table',\n 'inputs': [],\n 'attrs': [\n {\n 'tfName': 'shared_name',\n 'name': 'sharedName',\n 'type': 'string'\n },\n {\n 'tfName': 'use_node_name_sharing',\n 'name': 'useNodeNameSharing',\n 'type': 'bool'\n },\n {\n 'tfName': 'key_dtype',\n 'name': 'keyDType',\n 'type': 'dtype'\n },\n {\n 'tfName': 'value_dtype',\n 'name': 'valueDType',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'HashTableV2',\n 'category': 'hash_table',\n 'inputs': [],\n 'attrs': [\n {\n 'tfName': 'shared_name',\n 'name': 'sharedName',\n 'type': 'string'\n },\n {\n 'tfName': 'use_node_name_sharing',\n 'name': 'useNodeNameSharing',\n 'type': 'bool'\n },\n {\n 'tfName': 'key_dtype',\n 'name': 'keyDType',\n 'type': 'dtype'\n },\n {\n 'tfName': 'value_dtype',\n 'name': 'valueDType',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'LookupTableImport',\n 'category': 'hash_table',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tableHandle',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'keys',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'values',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'Tin',\n 'name': 'tIn',\n 'type': 'dtype',\n 'notSupported': true\n },\n {\n 'tfName': 'Tout',\n 'name': 'tOut',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'LookupTableImportV2',\n 'category': 'hash_table',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tableHandle',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'keys',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'values',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'Tin',\n 'name': 'tIn',\n 'type': 'dtype',\n 'notSupported': true\n },\n {\n 'tfName': 'Tout',\n 'name': 'tOut',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'LookupTableFind',\n 'category': 'hash_table',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tableHandle',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'keys',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'defaultValue',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'Tin',\n 'name': 'tIn',\n 'type': 'dtype',\n 'notSupported': true\n },\n {\n 'tfName': 'Tout',\n 'name': 'tOut',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'LookupTableFindV2',\n 'category': 'hash_table',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tableHandle',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'keys',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'defaultValue',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'Tin',\n 'name': 'tIn',\n 'type': 'dtype',\n 'notSupported': true\n },\n {\n 'tfName': 'Tout',\n 'name': 'tOut',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'LookupTableSize',\n 'category': 'hash_table',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tableHandle',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'LookupTableSizeV2',\n 'category': 'hash_table',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tableHandle',\n 'type': 'tensor'\n }\n ]\n }\n];\n","\n/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpMapper} from '../types';\n\nexport const json: OpMapper[] = [\n {\n 'tfOpName': 'ResizeBilinear',\n 'category': 'image',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'images',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'size',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'align_corners',\n 'name': 'alignCorners',\n 'type': 'bool'\n },\n {\n 'tfName': 'half_pixel_centers',\n 'name': 'halfPixelCenters',\n 'type': 'bool'\n },\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'ResizeNearestNeighbor',\n 'category': 'image',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'images',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'size',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'align_corners',\n 'name': 'alignCorners',\n 'type': 'bool'\n },\n {\n 'tfName': 'half_pixel_centers',\n 'name': 'halfPixelCenters',\n 'type': 'bool'\n },\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'CropAndResize',\n 'category': 'image',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'image',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'boxes',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'boxInd',\n 'type': 'tensor'\n },\n {\n 'start': 3,\n 'name': 'cropSize',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'method',\n 'name': 'method',\n 'type': 'string'\n },\n {\n 'tfName': 'extrapolation_value',\n 'name': 'extrapolationValue',\n 'type': 'number'\n }\n ]\n },\n {\n 'tfOpName': 'ImageProjectiveTransformV3',\n 'category': 'image',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'images',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'transforms',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'outputShape',\n 'type': 'number[]'\n },\n {\n 'start': 3,\n 'name': 'fillValue',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'interpolation',\n 'name': 'interpolation',\n 'type': 'string'\n },\n {\n 'tfName': 'fill_mode',\n 'name': 'fillMode',\n 'type': 'string'\n }\n ]\n }\n];\n","\n/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpMapper} from '../types';\n\nexport const json: OpMapper[] = [\n {\n 'tfOpName': 'Equal',\n 'category': 'logical',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'NotEqual',\n 'category': 'logical',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Greater',\n 'category': 'logical',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'GreaterEqual',\n 'category': 'logical',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Less',\n 'category': 'logical',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'LessEqual',\n 'category': 'logical',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'LogicalAnd',\n 'category': 'logical',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'LogicalNot',\n 'category': 'logical',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'LogicalOr',\n 'category': 'logical',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Select',\n 'category': 'logical',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'condition',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'SelectV2',\n 'category': 'logical',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'condition',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n }\n];\n","\n/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpMapper} from '../types';\n\nexport const json: OpMapper[] = [\n {\n 'tfOpName': '_FusedMatMul',\n 'category': 'matrices',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'end': 0,\n 'name': 'args',\n 'type': 'tensors'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'num_args',\n 'name': 'numArgs',\n 'type': 'number'\n },\n {\n 'tfName': 'fused_ops',\n 'name': 'fusedOps',\n 'type': 'string[]',\n 'defaultValue': []\n },\n {\n 'tfName': 'epsilon',\n 'name': 'epsilon',\n 'type': 'number',\n 'defaultValue': 0.0001\n },\n {\n 'tfName': 'transpose_a',\n 'name': 'transposeA',\n 'type': 'bool',\n 'defaultValue': false\n },\n {\n 'tfName': 'transpose_b',\n 'name': 'transposeB',\n 'type': 'bool',\n 'defaultValue': false\n },\n {\n 'tfName': 'leakyrelu_alpha',\n 'name': 'leakyreluAlpha',\n 'type': 'number',\n 'defaultValue': 0.2\n },\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'MatMul',\n 'category': 'matrices',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'transpose_a',\n 'name': 'transposeA',\n 'type': 'bool',\n 'defaultValue': false\n },\n {\n 'tfName': 'transpose_b',\n 'name': 'transposeB',\n 'type': 'bool',\n 'defaultValue': false\n },\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'BatchMatMul',\n 'category': 'matrices',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'adj_x',\n 'name': 'transposeA',\n 'type': 'bool',\n 'defaultValue': false\n },\n {\n 'tfName': 'adj_y',\n 'name': 'transposeB',\n 'type': 'bool',\n 'defaultValue': false\n },\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'BatchMatMulV2',\n 'category': 'matrices',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'a',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'b',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'adj_x',\n 'name': 'transposeA',\n 'type': 'bool',\n 'defaultValue': false\n },\n {\n 'tfName': 'adj_y',\n 'name': 'transposeB',\n 'type': 'bool',\n 'defaultValue': false\n },\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Transpose',\n 'category': 'matrices',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'perm',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Einsum',\n 'category': 'matrices',\n 'inputs': [\n {\n 'start': 0,\n 'end': 0,\n 'name': 'tensors',\n 'type': 'tensors'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'equation',\n 'name': 'equation',\n 'type': 'string'\n },\n {\n 'tfName': 'N',\n 'name': 'n',\n 'type': 'number',\n 'defaultValue': 2\n },\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype'\n }\n ]\n }\n]\n;\n","\n/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpMapper} from '../types';\n\nexport const json: OpMapper[] = [\n {\n 'tfOpName': 'EuclideanNorm',\n 'category': 'normalization',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'axis',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'keep_dims',\n 'name': 'keepDims',\n 'type': 'bool',\n 'defaultValue': false\n }\n ]\n },\n {\n 'tfOpName': 'FusedBatchNorm',\n 'category': 'normalization',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'scale',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'offset',\n 'type': 'tensor'\n },\n {\n 'start': 3,\n 'name': 'mean',\n 'type': 'tensor'\n },\n {\n 'start': 4,\n 'name': 'variance',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'epsilon',\n 'name': 'epsilon',\n 'type': 'number',\n 'defaultValue': 0.001\n },\n {\n 'tfName': 'data_format',\n 'name': 'dataFormat',\n 'type': 'string',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'FusedBatchNormV2',\n 'category': 'normalization',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'scale',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'offset',\n 'type': 'tensor'\n },\n {\n 'start': 3,\n 'name': 'mean',\n 'type': 'tensor'\n },\n {\n 'start': 4,\n 'name': 'variance',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'epsilon',\n 'name': 'epsilon',\n 'type': 'number',\n 'defaultValue': 0.001\n },\n {\n 'tfName': 'data_format',\n 'name': 'dataFormat',\n 'type': 'string',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'FusedBatchNormV3',\n 'category': 'normalization',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'scale',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'offset',\n 'type': 'tensor'\n },\n {\n 'start': 3,\n 'name': 'mean',\n 'type': 'tensor'\n },\n {\n 'start': 4,\n 'name': 'variance',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'epsilon',\n 'name': 'epsilon',\n 'type': 'number',\n 'defaultValue': 0.001\n },\n {\n 'tfName': 'data_format',\n 'name': 'dataFormat',\n 'type': 'string',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'LRN',\n 'category': 'normalization',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'depth_radius',\n 'name': 'radius',\n 'type': 'number',\n 'defaultValue': 5\n },\n {\n 'tfName': 'bias',\n 'name': 'bias',\n 'type': 'number',\n 'defaultValue': 1\n },\n {\n 'tfName': 'alpha',\n 'name': 'alpha',\n 'type': 'number',\n 'defaultValue': 1\n },\n {\n 'tfName': 'beta',\n 'name': 'beta',\n 'type': 'number',\n 'defaultValue': 0.5\n }\n ]\n },\n {\n 'tfOpName': 'Softmax',\n 'category': 'normalization',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'LogSoftmax',\n 'category': 'normalization',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'SparseToDense',\n 'category': 'normalization',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'sparseIndices',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'outputShape',\n 'type': 'number[]'\n },\n {\n 'start': 2,\n 'name': 'sparseValues',\n 'type': 'tensor'\n },\n {\n 'start': 3,\n 'name': 'defaultValue',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'validate_indices',\n 'name': 'validateIndices',\n 'type': 'bool',\n 'defaultValue': true,\n 'notSupported': true\n }\n ]\n }\n]\n;\n","\n/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpMapper} from '../types';\n\nexport const json: OpMapper[] = [\n {\n 'tfOpName': 'Bincount',\n 'category': 'reduction',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'size',\n 'type': 'number'\n },\n {\n 'start': 2,\n 'name': 'weights',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'DenseBincount',\n 'category': 'reduction',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'size',\n 'type': 'number'\n },\n {\n 'start': 2,\n 'name': 'weights',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'binary_output',\n 'name': 'binaryOutput',\n 'type': 'bool'\n }\n ]\n },\n {\n 'tfOpName': 'Max',\n 'category': 'reduction',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'axis',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'keep_dims',\n 'name': 'keepDims',\n 'type': 'bool'\n }\n ]\n },\n {\n 'tfOpName': 'Mean',\n 'category': 'reduction',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'axis',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'keep_dims',\n 'name': 'keepDims',\n 'type': 'bool'\n }\n ]\n },\n {\n 'tfOpName': 'Min',\n 'category': 'reduction',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'axis',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'keep_dims',\n 'name': 'keepDims',\n 'type': 'bool'\n }\n ]\n },\n {\n 'tfOpName': 'Sum',\n 'category': 'reduction',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'axis',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'keep_dims',\n 'name': 'keepDims',\n 'type': 'bool'\n }\n ]\n },\n {\n 'tfOpName': 'All',\n 'category': 'reduction',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'axis',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'keep_dims',\n 'name': 'keepDims',\n 'type': 'bool'\n }\n ]\n },\n {\n 'tfOpName': 'Any',\n 'category': 'reduction',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'axis',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'keep_dims',\n 'name': 'keepDims',\n 'type': 'bool'\n }\n ]\n },\n {\n 'tfOpName': 'ArgMax',\n 'category': 'reduction',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'axis',\n 'type': 'number'\n }\n ]\n },\n {\n 'tfOpName': 'ArgMin',\n 'category': 'reduction',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'axis',\n 'type': 'number'\n }\n ]\n },\n {\n 'tfOpName': 'Prod',\n 'category': 'reduction',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'axis',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'keep_dims',\n 'name': 'keepDims',\n 'type': 'bool'\n }\n ]\n },\n {\n 'tfOpName': 'Cumprod',\n 'category': 'reduction',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'axis',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'exclusive',\n 'name': 'exclusive',\n 'type': 'bool'\n },\n {\n 'tfName': 'reverse',\n 'name': 'reverse',\n 'type': 'bool'\n }\n ]\n },\n {\n 'tfOpName': 'Cumsum',\n 'category': 'reduction',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'axis',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'exclusive',\n 'name': 'exclusive',\n 'type': 'bool'\n },\n {\n 'tfName': 'reverse',\n 'name': 'reverse',\n 'type': 'bool'\n }\n ]\n }\n]\n;\n","\n/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpMapper} from '../types';\n\nexport const json: OpMapper[] = [\n {\n 'tfOpName': 'ConcatV2',\n 'category': 'slice_join',\n 'inputs': [\n {\n 'start': 0,\n 'end': -1,\n 'name': 'tensors',\n 'type': 'tensors'\n },\n {\n 'start': -1,\n 'name': 'axis',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'N',\n 'name': 'n',\n 'type': 'number',\n 'defaultValue': 2\n }\n ]\n },\n {\n 'tfOpName': 'Concat',\n 'category': 'slice_join',\n 'inputs': [\n {\n 'start': 1,\n 'end': 0,\n 'name': 'tensors',\n 'type': 'tensors'\n },\n {\n 'start': 0,\n 'name': 'axis',\n 'type': 'number'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'N',\n 'name': 'n',\n 'type': 'number',\n 'defaultValue': 2\n }\n ]\n },\n {\n 'tfOpName': 'GatherV2',\n 'category': 'slice_join',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'indices',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'axis',\n 'type': 'number',\n 'defaultValue': 0\n }\n ],\n 'attrs': [\n {\n 'tfName': 'batch_dims',\n 'name': 'batchDims',\n 'type': 'number',\n 'defaultValue': 0\n }\n ]\n },\n {\n 'tfOpName': 'Gather',\n 'category': 'slice_join',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'indices',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'validate_indices',\n 'name': 'validateIndices',\n 'type': 'bool',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Reverse',\n 'category': 'slice_join',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'dims',\n 'type': 'bool[]'\n }\n ]\n },\n {\n 'tfOpName': 'ReverseV2',\n 'category': 'slice_join',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'axis',\n 'type': 'number[]'\n }\n ]\n },\n {\n 'tfOpName': 'Slice',\n 'category': 'slice_join',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'begin',\n 'type': 'number[]'\n },\n {\n 'start': 2,\n 'name': 'size',\n 'type': 'number[]'\n }\n ]\n },\n {\n 'tfOpName': 'StridedSlice',\n 'category': 'slice_join',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'begin',\n 'type': 'number[]'\n },\n {\n 'start': 2,\n 'name': 'end',\n 'type': 'number[]'\n },\n {\n 'start': 3,\n 'name': 'strides',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'begin_mask',\n 'name': 'beginMask',\n 'type': 'number',\n 'defaultValue': 0\n },\n {\n 'tfName': 'end_mask',\n 'name': 'endMask',\n 'type': 'number',\n 'defaultValue': 0\n },\n {\n 'tfName': 'new_axis_mask',\n 'name': 'newAxisMask',\n 'type': 'number',\n 'defaultValue': 0\n },\n {\n 'tfName': 'ellipsis_mask',\n 'name': 'ellipsisMask',\n 'type': 'number',\n 'defaultValue': 0\n },\n {\n 'tfName': 'shrink_axis_mask',\n 'name': 'shrinkAxisMask',\n 'type': 'number',\n 'defaultValue': 0\n }\n ]\n },\n {\n 'tfOpName': 'Pack',\n 'category': 'slice_join',\n 'inputs': [\n {\n 'start': 0,\n 'end': 0,\n 'name': 'tensors',\n 'type': 'tensors'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'axis',\n 'name': 'axis',\n 'type': 'number',\n 'defaultValue': 0\n }\n ]\n },\n {\n 'tfOpName': 'Unpack',\n 'category': 'slice_join',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'tensor',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'axis',\n 'name': 'axis',\n 'type': 'number',\n 'defaultValue': 0\n },\n {\n 'tfName': 'num',\n 'name': 'num',\n 'type': 'number',\n 'defaultValue': 0,\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'Tile',\n 'category': 'slice_join',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'reps',\n 'type': 'number[]'\n }\n ]\n },\n {\n 'tfOpName': 'Split',\n 'category': 'slice_join',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'axis',\n 'type': 'number',\n 'defaultValue': 0\n },\n {\n 'start': 1,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'num_split',\n 'name': 'numOrSizeSplits',\n 'type': 'number',\n 'defaultValue': 1\n }\n ]\n },\n {\n 'tfOpName': 'SplitV',\n 'category': 'slice_join',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'numOrSizeSplits',\n 'type': 'number[]'\n },\n {\n 'start': 2,\n 'name': 'axis',\n 'type': 'number',\n 'defaultValue': 0\n }\n ]\n },\n {\n 'tfOpName': 'ScatterNd',\n 'category': 'slice_join',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'indices',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'values',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'shape',\n 'type': 'number[]'\n }\n ]\n },\n {\n 'tfOpName': 'GatherNd',\n 'category': 'slice_join',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'indices',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'SparseToDense',\n 'category': 'slice_join',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'sparseIndices',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'outputShape',\n 'type': 'number[]'\n },\n {\n 'start': 2,\n 'name': 'sparseValues',\n 'type': 'tensor'\n },\n {\n 'start': 3,\n 'name': 'defaultValue',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'validate_indices',\n 'name': 'validateIndices',\n 'type': 'bool',\n 'defaultValue': false,\n 'notSupported': true\n }\n ]\n }\n];\n","\n/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpMapper} from '../types';\n\nexport const json: OpMapper[] = [\n {\n 'tfOpName': 'SparseFillEmptyRows',\n 'category': 'sparse',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'indices',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'values',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'denseShape',\n 'type': 'tensor'\n },\n {\n 'start': 3,\n 'name': 'defaultValue',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'SparseReshape',\n 'category': 'sparse',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'inputIndices',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'inputShape',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'newShape',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'T',\n 'name': 'dtype',\n 'type': 'dtype',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'SparseSegmentMean',\n 'category': 'sparse',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'data',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'indices',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'segmentIds',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'SparseSegmentSum',\n 'category': 'sparse',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'data',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'indices',\n 'type': 'tensor'\n },\n {\n 'start': 2,\n 'name': 'segmentIds',\n 'type': 'tensor'\n }\n ]\n }\n];\n","\n/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpMapper} from '../types';\n\nexport const json: OpMapper[] = [\n {\n 'tfOpName': 'FFT',\n 'category': 'spectral',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'IFFT',\n 'category': 'spectral',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ]\n },\n {\n 'tfOpName': 'RFFT',\n 'category': 'spectral',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'fft_length',\n 'type': 'number',\n 'notSupported': true\n }\n ]\n },\n {\n 'tfOpName': 'IRFFT',\n 'category': 'spectral',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'fft_length',\n 'type': 'number',\n 'notSupported': true\n }\n ]\n }\n];\n","\n/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpMapper} from '../types';\n\nexport const json: OpMapper[] = [\n {\n 'tfOpName': 'StringNGrams',\n 'category': 'string',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'data',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'dataSplits',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'separator',\n 'name': 'separator',\n 'type': 'string'\n },\n {\n 'tfName': 'ngram_widths',\n 'name': 'nGramWidths',\n 'type': 'number[]'\n },\n {\n 'tfName': 'left_pad',\n 'name': 'leftPad',\n 'type': 'string'\n },\n {\n 'tfName': 'right_pad',\n 'name': 'rightPad',\n 'type': 'string'\n },\n {\n 'tfName': 'pad_width',\n 'name': 'padWidth',\n 'type': 'number'\n },\n {\n 'tfName': 'preserve_short_sequences',\n 'name': 'preserveShortSequences',\n 'type': 'bool'\n }\n ],\n 'outputs': [\n 'ngrams',\n 'ngrams_splits'\n ]\n },\n {\n 'tfOpName': 'StringSplit',\n 'category': 'string',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'input',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'delimiter',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'skip_empty',\n 'name': 'skipEmpty',\n 'type': 'bool'\n }\n ],\n 'outputs': [\n 'indices',\n 'values',\n 'shape'\n ]\n },\n {\n 'tfOpName': 'StringToHashBucketFast',\n 'category': 'string',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'input',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'num_buckets',\n 'name': 'numBuckets',\n 'type': 'number'\n }\n ]\n }\n];\n","\n/**\n * @license\n * Copyright 2022 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {OpMapper} from '../types';\n\nexport const json: OpMapper[] = [\n {\n 'tfOpName': 'Cast',\n 'category': 'transformation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'SrcT',\n 'name': 'sdtype',\n 'type': 'dtype',\n 'notSupported': true\n },\n {\n 'tfName': 'DstT',\n 'name': 'dtype',\n 'type': 'dtype'\n }\n ]\n },\n {\n 'tfOpName': 'ExpandDims',\n 'category': 'transformation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'axis',\n 'type': 'number'\n }\n ]\n },\n {\n 'tfOpName': 'MirrorPad',\n 'category': 'transformation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'padding',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'mode',\n 'name': 'mode',\n 'type': 'string'\n }\n ]\n },\n {\n 'tfOpName': 'Pad',\n 'category': 'transformation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'padding',\n 'type': 'number[]'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'constant_value',\n 'name': 'constantValue',\n 'type': 'number',\n 'defaultValue': 0\n }\n ]\n },\n {\n 'tfOpName': 'PadV2',\n 'category': 'transformation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'padding',\n 'type': 'number[]'\n },\n {\n 'start': 2,\n 'name': 'constantValue',\n 'type': 'number',\n 'defaultValue': 0\n }\n ]\n },\n {\n 'tfOpName': 'Reshape',\n 'category': 'transformation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'shape',\n 'type': 'number[]'\n }\n ]\n },\n {\n 'tfOpName': 'Squeeze',\n 'category': 'transformation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'axis',\n 'tfDeprecatedName': 'squeeze_dims',\n 'name': 'axis',\n 'type': 'number[]'\n }\n ]\n },\n {\n 'tfOpName': 'SpaceToBatchND',\n 'category': 'transformation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'blockShape',\n 'type': 'number[]'\n },\n {\n 'start': 2,\n 'name': 'paddings',\n 'type': 'number[]'\n }\n ]\n },\n {\n 'tfOpName': 'BatchToSpaceND',\n 'category': 'transformation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'blockShape',\n 'type': 'number[]'\n },\n {\n 'start': 2,\n 'name': 'crops',\n 'type': 'number[]'\n }\n ]\n },\n {\n 'tfOpName': 'DepthToSpace',\n 'category': 'transformation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n }\n ],\n 'attrs': [\n {\n 'tfName': 'block_size',\n 'name': 'blockSize',\n 'type': 'number'\n },\n {\n 'tfName': 'data_format',\n 'name': 'dataFormat',\n 'type': 'string'\n }\n ]\n },\n {\n 'tfOpName': 'BroadcastTo',\n 'category': 'transformation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 'x',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 'shape',\n 'type': 'number[]'\n }\n ],\n 'attrs': []\n },\n {\n 'tfOpName': 'BroadcastArgs',\n 'category': 'transformation',\n 'inputs': [\n {\n 'start': 0,\n 'name': 's0',\n 'type': 'tensor'\n },\n {\n 'start': 1,\n 'name': 's1',\n 'type': 'tensor'\n }\n ],\n 'attrs': []\n }\n];\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataType, env} from '@tensorflow/tfjs-core';\n\nimport * as tensorflow from '../data/compiled_api';\n\nimport {getRegisteredOp} from './custom_op/register';\nimport {getNodeNameAndIndex} from './executors/utils';\nimport * as arithmetic from './op_list/arithmetic';\nimport * as basicMath from './op_list/basic_math';\nimport * as control from './op_list/control';\nimport * as convolution from './op_list/convolution';\nimport * as creation from './op_list/creation';\nimport * as dynamic from './op_list/dynamic';\nimport * as evaluation from './op_list/evaluation';\nimport * as graph from './op_list/graph';\nimport * as hashTable from './op_list/hash_table';\nimport * as image from './op_list/image';\nimport * as logical from './op_list/logical';\nimport * as matrices from './op_list/matrices';\nimport * as normalization from './op_list/normalization';\nimport * as reduction from './op_list/reduction';\nimport * as sliceJoin from './op_list/slice_join';\nimport * as sparse from './op_list/sparse';\nimport * as spectral from './op_list/spectral';\nimport * as string from './op_list/string';\nimport * as transformation from './op_list/transformation';\nimport {Graph, InputParamValue, Node, OpMapper, ParamValue} from './types';\n\nexport class OperationMapper {\n private static _instance: OperationMapper;\n\n private opMappers: {[key: string]: OpMapper};\n\n // Singleton instance for the mapper\n public static get Instance() {\n return this._instance || (this._instance = new this());\n }\n\n // Loads the op mapping from the JSON file.\n private constructor() {\n const ops = [\n arithmetic, basicMath, control, convolution, creation, dynamic,\n evaluation, graph, hashTable, image, logical, matrices, normalization,\n reduction, sliceJoin, sparse, spectral, string, transformation\n ];\n const mappersJson: OpMapper[] = [].concat(...ops.map(op => op.json));\n\n this.opMappers = mappersJson.reduce<{[key: string]: OpMapper}>(\n (map, mapper: OpMapper) => {\n map[mapper.tfOpName] = mapper;\n return map;\n },\n {});\n }\n\n // Converts the model inference graph from Tensorflow GraphDef to local\n // representation for TensorFlow.js API\n transformGraph(\n graph: tensorflow.IGraphDef,\n signature: tensorflow.ISignatureDef = {}): Graph {\n const tfNodes = graph.node;\n const placeholders: Node[] = [];\n const weights: Node[] = [];\n const initNodes: Node[] = [];\n const nodes = tfNodes.reduce<{[key: string]: Node}>((map, node) => {\n map[node.name] = this.mapNode(node);\n if (node.op.startsWith('Placeholder')) {\n placeholders.push(map[node.name]);\n } else if (node.op === 'Const') {\n weights.push(map[node.name]);\n } else if (node.input == null || node.input.length === 0) {\n initNodes.push(map[node.name]);\n }\n return map;\n }, {});\n\n let inputs: Node[] = [];\n const outputs: Node[] = [];\n let inputNodeNameToKey: {[key: string]: string} = {};\n let outputNodeNameToKey: {[key: string]: string} = {};\n if (signature != null) {\n inputNodeNameToKey = this.mapSignatureEntries(signature.inputs);\n outputNodeNameToKey = this.mapSignatureEntries(signature.outputs);\n }\n const allNodes = Object.keys(nodes);\n allNodes.forEach(key => {\n const node = nodes[key];\n node.inputNames.forEach((name, index) => {\n const [nodeName, , outputName] = getNodeNameAndIndex(name);\n const inputNode = nodes[nodeName];\n if (inputNode.outputs != null) {\n const outputIndex = inputNode.outputs.indexOf(outputName);\n if (outputIndex !== -1) {\n const inputName = `${nodeName}:${outputIndex}`;\n // update the input name to use the mapped output index directly.\n node.inputNames[index] = inputName;\n }\n }\n node.inputs.push(inputNode);\n inputNode.children.push(node);\n });\n });\n\n // if signature has not outputs set, add any node that does not have\n // outputs.\n if (Object.keys(outputNodeNameToKey).length === 0) {\n allNodes.forEach(key => {\n const node = nodes[key];\n if (node.children.length === 0) {\n outputs.push(node);\n }\n });\n } else {\n Object.keys(outputNodeNameToKey).forEach(name => {\n const [nodeName, ] = getNodeNameAndIndex(name);\n const node = nodes[nodeName];\n if (node != null) {\n node.signatureKey = outputNodeNameToKey[name];\n outputs.push(node);\n }\n });\n }\n\n if (Object.keys(inputNodeNameToKey).length > 0) {\n Object.keys(inputNodeNameToKey).forEach(name => {\n const [nodeName, ] = getNodeNameAndIndex(name);\n const node = nodes[nodeName];\n if (node) {\n node.signatureKey = inputNodeNameToKey[name];\n inputs.push(node);\n }\n });\n } else {\n inputs = placeholders;\n }\n\n let functions = {};\n if (graph.library != null && graph.library.function != null) {\n functions = graph.library.function.reduce((functions, func) => {\n functions[func.signature.name] = this.mapFunction(func);\n return functions;\n }, {} as {[key: string]: Graph});\n }\n\n const result: Graph =\n {nodes, inputs, outputs, weights, placeholders, signature, functions};\n\n if (initNodes.length > 0) {\n result.initNodes = initNodes;\n }\n\n return result;\n }\n\n private mapSignatureEntries(entries: {[k: string]: tensorflow.ITensorInfo}) {\n return Object.keys(entries || {})\n .reduce<{[key: string]: string}>((prev, curr) => {\n prev[entries[curr].name] = curr;\n return prev;\n }, {});\n }\n\n private mapNode(node: tensorflow.INodeDef): Node {\n // Unsupported ops will cause an error at run-time (not parse time), since\n // they may not be used by the actual execution subgraph.\n const mapper =\n getRegisteredOp(node.op) || this.opMappers[node.op] || {} as OpMapper;\n if (node.attr == null) {\n node.attr = {};\n }\n\n const newNode: Node = {\n name: node.name,\n op: node.op,\n category: mapper.category,\n inputNames:\n (node.input ||\n []).map(input => input.startsWith('^') ? input.slice(1) : input),\n inputs: [],\n children: [],\n inputParams: {},\n attrParams: {},\n rawAttrs: node.attr,\n outputs: mapper.outputs\n };\n\n if (mapper.inputs != null) {\n newNode.inputParams =\n mapper.inputs.reduce<{[key: string]: InputParamValue}>(\n (map, param) => {\n map[param.name] = {\n type: param.type,\n inputIndexStart: param.start,\n inputIndexEnd: param.end\n };\n return map;\n },\n {});\n }\n if (mapper.attrs != null) {\n newNode.attrParams =\n mapper.attrs.reduce<{[key: string]: ParamValue}>((map, param) => {\n const type = param.type;\n let value = undefined;\n switch (param.type) {\n case 'string':\n value = getStringParam(\n node.attr, param.tfName, param.defaultValue as string);\n\n if (value === undefined && !!param.tfDeprecatedName) {\n value = getStringParam(\n node.attr, param.tfDeprecatedName,\n param.defaultValue as string);\n }\n break;\n case 'string[]':\n value = getStringArrayParam(\n node.attr, param.tfName, param.defaultValue as string[]);\n\n if (value === undefined && !!param.tfDeprecatedName) {\n value = getStringArrayParam(\n node.attr, param.tfDeprecatedName,\n param.defaultValue as string[]);\n }\n break;\n case 'number':\n value = getNumberParam(\n node.attr, param.tfName,\n (param.defaultValue || 0) as number);\n if (value === undefined && !!param.tfDeprecatedName) {\n value = getNumberParam(\n node.attr, param.tfDeprecatedName,\n param.defaultValue as number);\n }\n break;\n case 'number[]':\n value = getNumericArrayParam(\n node.attr, param.tfName, param.defaultValue as number[]);\n if (value === undefined && !!param.tfDeprecatedName) {\n value = getNumericArrayParam(\n node.attr, param.tfDeprecatedName,\n param.defaultValue as number[]);\n }\n break;\n case 'bool':\n value = getBoolParam(\n node.attr, param.tfName, param.defaultValue as boolean);\n if (value === undefined && !!param.tfDeprecatedName) {\n value = getBoolParam(\n node.attr, param.tfDeprecatedName,\n param.defaultValue as boolean);\n }\n break;\n case 'bool[]':\n value = getBoolArrayParam(\n node.attr, param.tfName, param.defaultValue as boolean[]);\n if (value === undefined && !!param.tfDeprecatedName) {\n value = getBoolArrayParam(\n node.attr, param.tfDeprecatedName,\n param.defaultValue as boolean[]);\n }\n break;\n case 'shape':\n value = getTensorShapeParam(\n node.attr, param.tfName, param.defaultValue as number[]);\n if (value === undefined && !!param.tfDeprecatedName) {\n value = getTensorShapeParam(\n node.attr, param.tfDeprecatedName,\n param.defaultValue as number[]);\n }\n break;\n case 'shape[]':\n value = getTensorShapeArrayParam(\n node.attr, param.tfName, param.defaultValue as number[][]);\n if (value === undefined && !!param.tfDeprecatedName) {\n value = getTensorShapeArrayParam(\n node.attr, param.tfDeprecatedName,\n param.defaultValue as number[][]);\n }\n break;\n case 'dtype':\n value = getDtypeParam(\n node.attr, param.tfName, param.defaultValue as DataType);\n if (value === undefined && !!param.tfDeprecatedName) {\n value = getDtypeParam(\n node.attr, param.tfDeprecatedName,\n param.defaultValue as DataType);\n }\n break;\n case 'dtype[]':\n value = getDtypeArrayParam(\n node.attr, param.tfName, param.defaultValue as DataType[]);\n if (value === undefined && !!param.tfDeprecatedName) {\n value = getDtypeArrayParam(\n node.attr, param.tfDeprecatedName,\n param.defaultValue as DataType[]);\n }\n break;\n case 'func':\n value = getFuncParam(\n node.attr, param.tfName, param.defaultValue as string);\n if (value === undefined && !!param.tfDeprecatedName) {\n value = getFuncParam(\n node.attr, param.tfDeprecatedName,\n param.defaultValue as string);\n }\n break;\n case 'tensor':\n case 'tensors':\n break;\n default:\n throw new Error(\n `Unsupported param type: ${param.type} for op: ${node.op}`);\n }\n map[param.name] = {value, type};\n return map;\n }, {});\n }\n return newNode;\n }\n\n // map the TFunctionDef to TFJS graph object\n private mapFunction(functionDef: tensorflow.IFunctionDef): Graph {\n const tfNodes = functionDef.nodeDef;\n const placeholders: Node[] = [];\n const weights: Node[] = [];\n let nodes: {[key: string]: Node} = {};\n if (tfNodes != null) {\n nodes = tfNodes.reduce<{[key: string]: Node}>((map, node) => {\n map[node.name] = this.mapNode(node);\n if (node.op === 'Const') {\n weights.push(map[node.name]);\n }\n return map;\n }, {});\n }\n const inputs: Node[] = [];\n const outputs: Node[] = [];\n\n functionDef.signature.inputArg.forEach(arg => {\n const [nodeName, ] = getNodeNameAndIndex(arg.name);\n const node: Node = {\n name: nodeName,\n op: 'Placeholder',\n inputs: [],\n inputNames: [],\n category: 'graph',\n inputParams: {},\n attrParams: {dtype: {value: parseDtypeParam(arg.type), type: 'dtype'}},\n children: []\n };\n node.signatureKey = arg.name;\n inputs.push(node);\n nodes[nodeName] = node;\n });\n\n const allNodes = Object.keys(nodes);\n allNodes.forEach(key => {\n const node = nodes[key];\n node.inputNames.forEach((name, index) => {\n const [nodeName, , outputName] = getNodeNameAndIndex(name);\n const inputNode = nodes[nodeName];\n if (inputNode.outputs != null) {\n const outputIndex = inputNode.outputs.indexOf(outputName);\n if (outputIndex !== -1) {\n const inputName = `${nodeName}:${outputIndex}`;\n // update the input name to use the mapped output index directly.\n node.inputNames[index] = inputName;\n }\n }\n node.inputs.push(inputNode);\n inputNode.children.push(node);\n });\n });\n\n const returnNodeMap = functionDef.ret;\n\n functionDef.signature.outputArg.forEach(output => {\n const [nodeName, index] = getNodeNameAndIndex(returnNodeMap[output.name]);\n const node = nodes[nodeName];\n if (node != null) {\n node.defaultOutput = index;\n outputs.push(node);\n }\n });\n\n const signature = this.mapArgsToSignature(functionDef);\n return {nodes, inputs, outputs, weights, placeholders, signature};\n }\n\n private mapArgsToSignature(functionDef: tensorflow.IFunctionDef):\n tensorflow.ISignatureDef {\n return {\n methodName: functionDef.signature.name,\n inputs: functionDef.signature.inputArg.reduce(\n (map, arg) => {\n map[arg.name] = this.mapArgToTensorInfo(arg);\n return map;\n },\n {} as {[key: string]: tensorflow.ITensorInfo}),\n outputs: functionDef.signature.outputArg.reduce(\n (map, arg) => {\n map[arg.name] = this.mapArgToTensorInfo(arg, functionDef.ret);\n return map;\n },\n {} as {[key: string]: tensorflow.ITensorInfo}),\n };\n }\n\n private mapArgToTensorInfo(\n arg: tensorflow.OpDef.IArgDef,\n nameMap?: {[key: string]: string}): tensorflow.ITensorInfo {\n let name = arg.name;\n if (nameMap != null) {\n name = nameMap[name];\n }\n return {name, dtype: arg.type};\n }\n}\n\nexport function decodeBase64(text: string): string {\n const global = env().global;\n if (typeof global.atob !== 'undefined') {\n return global.atob(text);\n } else if (typeof Buffer !== 'undefined') {\n return new Buffer(text, 'base64').toString();\n } else {\n throw new Error(\n 'Unable to decode base64 in this environment. ' +\n 'Missing built-in atob() or Buffer()');\n }\n}\n\nexport function parseStringParam(s: []|string, keepCase: boolean): string {\n const value =\n Array.isArray(s) ? String.fromCharCode.apply(null, s) : decodeBase64(s);\n return keepCase ? value : value.toLowerCase();\n}\n\nexport function getStringParam(\n attrs: {[key: string]: tensorflow.IAttrValue}, name: string, def: string,\n keepCase = false): string {\n const param = attrs[name];\n if (param != null) {\n return parseStringParam(param.s, keepCase);\n }\n return def;\n}\n\nexport function getBoolParam(\n attrs: {[key: string]: tensorflow.IAttrValue}, name: string,\n def: boolean): boolean {\n const param = attrs[name];\n return param ? param.b : def;\n}\n\nexport function getNumberParam(\n attrs: {[key: string]: tensorflow.IAttrValue}, name: string,\n def: number): number {\n const param = attrs[name] || {};\n const value =\n param['i'] != null ? param['i'] : (param['f'] != null ? param['f'] : def);\n return (typeof value === 'number') ? value : parseInt(value, 10);\n}\n\nexport function parseDtypeParam(value: string|tensorflow.DataType): DataType {\n if (typeof (value) === 'string') {\n // tslint:disable-next-line:no-any\n value = tensorflow.DataType[value as any];\n }\n switch (value) {\n case tensorflow.DataType.DT_FLOAT:\n case tensorflow.DataType.DT_HALF:\n return 'float32';\n case tensorflow.DataType.DT_INT32:\n case tensorflow.DataType.DT_INT64:\n case tensorflow.DataType.DT_INT8:\n case tensorflow.DataType.DT_UINT8:\n return 'int32';\n case tensorflow.DataType.DT_BOOL:\n return 'bool';\n case tensorflow.DataType.DT_DOUBLE:\n return 'float32';\n case tensorflow.DataType.DT_STRING:\n return 'string';\n default:\n // Unknown dtype error will happen at runtime (instead of parse time),\n // since these nodes might not be used by the actual subgraph execution.\n return null;\n }\n}\n\nexport function getFuncParam(\n attrs: {[key: string]: tensorflow.IAttrValue}, name: string,\n def: string): string {\n const param = attrs[name];\n if (param && param.func) {\n return param.func.name;\n }\n return def;\n}\n\nexport function getDtypeParam(\n attrs: {[key: string]: tensorflow.IAttrValue}, name: string,\n def: DataType): DataType {\n const param = attrs[name];\n if (param && param.type) {\n return parseDtypeParam(param.type);\n }\n return def;\n}\n\nexport function getDtypeArrayParam(\n attrs: {[key: string]: tensorflow.IAttrValue}, name: string,\n def: DataType[]): DataType[] {\n const param = attrs[name];\n if (param && param.list && param.list.type) {\n return param.list.type.map(v => parseDtypeParam(v));\n }\n return def;\n}\n\nexport function parseTensorShapeParam(shape: tensorflow.ITensorShape): number[]|\n undefined {\n if (shape.unknownRank) {\n return undefined;\n }\n if (shape.dim != null) {\n return shape.dim.map(\n dim =>\n (typeof dim.size === 'number') ? dim.size : parseInt(dim.size, 10));\n }\n return [];\n}\n\nexport function getTensorShapeParam(\n attrs: {[key: string]: tensorflow.IAttrValue}, name: string,\n def?: number[]): number[]|undefined {\n const param = attrs[name];\n if (param && param.shape) {\n return parseTensorShapeParam(param.shape);\n }\n return def;\n}\n\nexport function getNumericArrayParam(\n attrs: {[key: string]: tensorflow.IAttrValue}, name: string,\n def: number[]): number[] {\n const param = attrs[name];\n if (param) {\n return ((param.list.f && param.list.f.length ? param.list.f :\n param.list.i) ||\n [])\n .map(v => (typeof v === 'number') ? v : parseInt(v, 10));\n }\n return def;\n}\n\nexport function getStringArrayParam(\n attrs: {[key: string]: tensorflow.IAttrValue}, name: string, def: string[],\n keepCase = false): string[] {\n const param = attrs[name];\n if (param && param.list && param.list.s) {\n return param.list.s.map((v) => {\n return parseStringParam(v, keepCase);\n });\n }\n return def;\n}\n\nexport function getTensorShapeArrayParam(\n attrs: {[key: string]: tensorflow.IAttrValue}, name: string,\n def: number[][]): number[][] {\n const param = attrs[name];\n if (param && param.list && param.list.shape) {\n return param.list.shape.map((v) => {\n return parseTensorShapeParam(v);\n });\n }\n return def;\n}\n\nexport function getBoolArrayParam(\n attrs: {[key: string]: tensorflow.IAttrValue}, name: string,\n def: boolean[]): boolean[] {\n const param = attrs[name];\n if (param && param.list && param.list.b) {\n return param.list.b;\n }\n return def;\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataType, Tensor} from '@tensorflow/tfjs-core';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {getTensor} from '../executors/utils';\nimport {getBoolArrayParam, getBoolParam, getDtypeArrayParam, getDtypeParam, getNumberParam, getNumericArrayParam, getStringArrayParam, getStringParam, getTensorShapeArrayParam, getTensorShapeParam} from '../operation_mapper';\nimport {GraphNode, Node, ValueType} from '../types';\n\n/**\n * Helper class for lookup inputs and params for nodes in the model graph.\n */\nexport class NodeValueImpl implements GraphNode {\n public readonly inputs: Tensor[] = [];\n public readonly attrs: {[key: string]: ValueType} = {};\n constructor(\n private node: Node, private tensorMap: NamedTensorsMap,\n private context: ExecutionContext) {\n this.inputs = node.inputNames.map(name => this.getInput(name));\n if (node.rawAttrs != null) {\n this.attrs = Object.keys(node.rawAttrs)\n .reduce((attrs: {[key: string]: ValueType}, key) => {\n attrs[key] = this.getAttr(key);\n return attrs;\n }, {});\n }\n }\n\n /**\n * Return the value of the attribute or input param.\n * @param name String: name of attribute or input param.\n */\n private getInput(name: string): Tensor {\n return getTensor(name, this.tensorMap, this.context);\n }\n\n /**\n * Return the value of the attribute or input param.\n * @param name String: name of attribute or input param.\n */\n private getAttr(name: string, defaultValue?: ValueType): ValueType {\n const value = this.node.rawAttrs[name];\n if (value.tensor != null) {\n return getTensor(name, this.tensorMap, this.context);\n }\n if (value.i != null || value.f != null) {\n return getNumberParam(this.node.rawAttrs, name, defaultValue as number);\n }\n if (value.s != null) {\n return getStringParam(this.node.rawAttrs, name, defaultValue as string);\n }\n if (value.b != null) {\n return getBoolParam(this.node.rawAttrs, name, defaultValue as boolean);\n }\n if (value.shape != null) {\n return getTensorShapeParam(\n this.node.rawAttrs, name, defaultValue as number[]);\n }\n if (value.type != null) {\n return getDtypeParam(this.node.rawAttrs, name, defaultValue as DataType);\n }\n if (value.list != null) {\n if (value.list.i != null || value.list.f != null) {\n return getNumericArrayParam(\n this.node.rawAttrs, name, defaultValue as number[]);\n }\n if (value.list.s != null) {\n return getStringArrayParam(\n this.node.rawAttrs, name, defaultValue as string[]);\n }\n if (value.list.shape != null) {\n return getTensorShapeArrayParam(\n this.node.rawAttrs, name, defaultValue as number[][]);\n }\n if (value.list.b != null) {\n return getBoolArrayParam(\n this.node.rawAttrs, name, defaultValue as boolean[]);\n }\n if (value.list.type != null) {\n return getDtypeArrayParam(\n this.node.rawAttrs, name, defaultValue as DataType[]);\n }\n }\n\n return defaultValue;\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\n/**\n * This file exports ops used by the converters executors. By default it\n * re-exports all ops. In a custom build this is aliased to a file that will\n * only exports ops for a given model.json.\n */\nexport * from './ops';\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '@tensorflow/tfjs-core';\n// tslint:disable-next-line: no-imports-from-dist\nimport * as tfOps from '@tensorflow/tfjs-core/dist/ops/ops_for_converter';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {InternalOpExecutor, Node} from '../types';\n\nimport {getParamValue} from './utils';\n\nexport const executeOp: InternalOpExecutor =\n (node: Node, tensorMap: NamedTensorsMap,\n context: ExecutionContext, ops = tfOps): Tensor[] => {\n switch (node.op) {\n case 'BiasAdd':\n case 'AddV2':\n case 'Add': {\n return [ops.add(\n (getParamValue('a', node, tensorMap, context) as Tensor),\n getParamValue('b', node, tensorMap, context) as Tensor)];\n }\n case 'AddN': {\n return [ops.addN((\n getParamValue('tensors', node, tensorMap, context) as Tensor[]))];\n }\n case 'FloorMod':\n case 'Mod':\n return [ops.mod(\n getParamValue('a', node, tensorMap, context) as Tensor,\n getParamValue('b', node, tensorMap, context) as Tensor)];\n case 'Mul':\n return [ops.mul(\n getParamValue('a', node, tensorMap, context) as Tensor,\n getParamValue('b', node, tensorMap, context) as Tensor)];\n case 'RealDiv':\n case 'Div': {\n return [ops.div(\n getParamValue('a', node, tensorMap, context) as Tensor,\n getParamValue('b', node, tensorMap, context) as Tensor)];\n }\n case 'DivNoNan': {\n return [ops.divNoNan(\n getParamValue('a', node, tensorMap, context) as Tensor,\n getParamValue('b', node, tensorMap, context) as Tensor)];\n }\n case 'FloorDiv': {\n return [ops.floorDiv(\n getParamValue('a', node, tensorMap, context) as Tensor,\n getParamValue('b', node, tensorMap, context) as Tensor)];\n }\n case 'Sub': {\n return [ops.sub(\n getParamValue('a', node, tensorMap, context) as Tensor,\n getParamValue('b', node, tensorMap, context) as Tensor)];\n }\n case 'Minimum': {\n return [ops.minimum(\n getParamValue('a', node, tensorMap, context) as Tensor,\n getParamValue('b', node, tensorMap, context) as Tensor)];\n }\n case 'Maximum': {\n return [ops.maximum(\n getParamValue('a', node, tensorMap, context) as Tensor,\n getParamValue('b', node, tensorMap, context) as Tensor)];\n }\n case 'Pow': {\n return [ops.pow(\n getParamValue('a', node, tensorMap, context) as Tensor,\n getParamValue('b', node, tensorMap, context) as Tensor)];\n }\n case 'SquaredDifference': {\n return [ops.squaredDifference(\n getParamValue('a', node, tensorMap, context) as Tensor,\n getParamValue('b', node, tensorMap, context) as Tensor)];\n }\n default:\n throw TypeError(`Node type ${node.op} is not implemented`);\n }\n };\n\nexport const CATEGORY = 'arithmetic';\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '@tensorflow/tfjs-core';\n// tslint:disable-next-line: no-imports-from-dist\nimport * as tfOps from '@tensorflow/tfjs-core/dist/ops/ops_for_converter';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {InternalOpExecutor, Node} from '../types';\n\nimport {getParamValue, getTensor} from './utils';\n\nexport const executeOp: InternalOpExecutor =\n (node: Node, tensorMap: NamedTensorsMap,\n context: ExecutionContext, ops = tfOps): Tensor[] => {\n switch (node.op) {\n case 'Abs':\n case 'ComplexAbs':\n return [ops.abs(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Acos':\n return [ops.acos(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Acosh':\n return [ops.acosh(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Asin':\n return [ops.asin(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Asinh':\n return [ops.asinh(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Atan':\n return [ops.atan(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Atan2':\n return [ops.atan2(\n getParamValue('x', node, tensorMap, context) as Tensor,\n getParamValue('y', node, tensorMap, context) as Tensor)];\n case 'Atanh':\n return [ops.atanh(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Ceil':\n return [ops.ceil(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Complex':\n return [ops.complex(\n getParamValue('real', node, tensorMap, context) as Tensor,\n getParamValue('imag', node, tensorMap, context) as Tensor)];\n case 'Cos':\n return [ops.cos(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Cosh':\n return [ops.cosh(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Elu':\n return [ops.elu(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Erf':\n return [ops.erf(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Exp':\n return [ops.exp(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Expm1': {\n return [ops.expm1(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n }\n case 'Floor':\n return [ops.floor(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Log':\n return [ops.log(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Log1p': {\n return [ops.log1p(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n }\n case 'Imag':\n return [ops.imag(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n\n case 'Neg':\n return [ops.neg(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Reciprocal': {\n return [ops.reciprocal(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n }\n case 'Real':\n return [ops.real(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Relu':\n return [ops.relu(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Round': {\n return [ops.round(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n }\n case 'Selu':\n return [ops.selu(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Sigmoid':\n return [ops.sigmoid(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Sin':\n return [ops.sin(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Sign': {\n return [ops.sign(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n }\n case 'Sinh': {\n return [ops.sinh(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n }\n case 'Softplus': {\n return [ops.softplus(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n }\n case 'Sqrt': {\n return [ops.sqrt(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n }\n case 'Square': {\n return [ops.square(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n }\n case 'Tanh': {\n return [ops.tanh(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n }\n case 'Tan':\n return [ops.tan(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'ClipByValue':\n return [ops.clipByValue(\n getParamValue('x', node, tensorMap, context) as Tensor,\n getParamValue('clipValueMin', node, tensorMap, context) as number,\n getParamValue('clipValueMax', node, tensorMap, context) as\n number)];\n case 'Relu6':\n return [ops.relu6(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n case 'Rsqrt':\n return [ops.rsqrt(\n getTensor(node.inputNames[0], tensorMap, context))];\n case 'Prod':\n return [ops.prod(\n getParamValue('x', node, tensorMap, context) as Tensor,\n getParamValue('axes', node, tensorMap, context) as number[])];\n case 'LeakyRelu':\n return [ops.leakyRelu(\n getParamValue('x', node, tensorMap, context) as Tensor,\n getParamValue('alpha', node, tensorMap, context) as number)];\n case 'Prelu':\n return [ops.prelu(\n getParamValue('x', node, tensorMap, context) as Tensor,\n getParamValue('alpha', node, tensorMap, context) as Tensor)];\n case 'IsNan':\n return [ops.isNaN(\n getTensor(node.inputNames[0], tensorMap, context))];\n default:\n throw TypeError(`Node type ${node.op} is not implemented`);\n }\n };\n\nexport const CATEGORY = 'basic_math';\n","\n/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n/**\n * This differs from util.assertShapesMatch in that it allows values of\n * negative one, an undefined size of a dimensinon, in a shape to match\n * anything.\n */\n\nimport {Tensor, util} from '@tensorflow/tfjs-core';\n\n/**\n * Used by TensorList and TensorArray to verify if elementShape matches, support\n * negative value as the dim shape.\n * @param shapeA\n * @param shapeB\n * @param errorMessagePrefix\n */\nexport function assertShapesMatchAllowUndefinedSize(\n shapeA: number|number[], shapeB: number|number[],\n errorMessagePrefix = ''): void {\n // constant shape means unknown rank\n if (typeof shapeA === 'number' || typeof shapeB === 'number') {\n return;\n }\n util.assert(\n shapeA.length === shapeB.length,\n () => errorMessagePrefix + ` Shapes ${shapeA} and ${shapeB} must match`);\n for (let i = 0; i < shapeA.length; i++) {\n const dim0 = shapeA[i];\n const dim1 = shapeB[i];\n util.assert(\n dim0 < 0 || dim1 < 0 || dim0 === dim1,\n () =>\n errorMessagePrefix + ` Shapes ${shapeA} and ${shapeB} must match`);\n }\n}\n\nexport function fullDefinedShape(elementShape: number|number[]): boolean {\n if (typeof elementShape === 'number' || elementShape.some(dim => dim < 0)) {\n return false;\n }\n return true;\n}\n/**\n * Generate the output element shape from the list elementShape, list tensors\n * and input param.\n * @param listElementShape\n * @param tensors\n * @param elementShape\n */\nexport function inferElementShape(\n listElementShape: number|number[], tensors: Tensor[],\n elementShape: number|number[]): number[] {\n let partialShape = mergeElementShape(listElementShape, elementShape);\n const notfullDefinedShape = !fullDefinedShape(partialShape);\n if (notfullDefinedShape && tensors.length === 0) {\n throw new Error(\n `Tried to calculate elements of an empty list` +\n ` with non-fully-defined elementShape: ${partialShape}`);\n }\n if (notfullDefinedShape) {\n tensors.forEach(tensor => {\n partialShape = mergeElementShape(tensor.shape, partialShape);\n });\n }\n if (!fullDefinedShape(partialShape)) {\n throw new Error(`Non-fully-defined elementShape: ${partialShape}`);\n }\n return partialShape as number[];\n}\n\nexport function mergeElementShape(\n elementShapeA: number|number[], elementShapeB: number|number[]): number|\n number[] {\n if (typeof elementShapeA === 'number') {\n return elementShapeB;\n }\n if (typeof elementShapeB === 'number') {\n return elementShapeA;\n }\n\n if (elementShapeA.length !== elementShapeB.length) {\n throw new Error(`Incompatible ranks during merge: ${elementShapeA} vs. ${\n elementShapeB}`);\n }\n\n const result: number[] = [];\n for (let i = 0; i < elementShapeA.length; ++i) {\n const dim0 = elementShapeA[i];\n const dim1 = elementShapeB[i];\n if (dim0 >= 0 && dim1 >= 0 && dim0 !== dim1) {\n throw new Error(`Incompatible shape during merge: ${elementShapeA} vs. ${\n elementShapeB}`);\n }\n result[i] = dim0 >= 0 ? dim0 : dim1;\n }\n return result;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {concat, DataType, keep, reshape, scalar, slice, stack, Tensor, tensor, tidy, unstack} from '@tensorflow/tfjs-core';\n\nimport {assertShapesMatchAllowUndefinedSize} from './tensor_utils';\n\nexport interface TensorWithState {\n tensor?: Tensor;\n written?: boolean;\n read?: boolean;\n cleared?: boolean;\n}\n/**\n * The TensorArray object keeps an array of Tensors. It\n * allows reading from the array and writing to the array.\n */\nexport class TensorArray {\n private tensors: TensorWithState[] = [];\n private closed_ = false;\n readonly idTensor: Tensor;\n constructor(\n readonly name: string, readonly dtype: DataType, private maxSize: number,\n private elementShape: number[], readonly identicalElementShapes: boolean,\n readonly dynamicSize: boolean, readonly clearAfterRead: boolean) {\n this.idTensor = scalar(0);\n keep(this.idTensor);\n }\n\n get id() {\n return this.idTensor.id;\n }\n\n get closed() {\n return this.closed_;\n }\n\n /**\n * Dispose the tensors and idTensor and mark the TensoryArray as closed.\n */\n clearAndClose(keepIds?: Set) {\n this.tensors.forEach(tensor => {\n if (keepIds == null || !keepIds.has(tensor.tensor.id)) {\n tensor.tensor.dispose();\n }\n });\n this.tensors = [];\n this.closed_ = true;\n this.idTensor.dispose();\n }\n\n size(): number {\n return this.tensors.length;\n }\n\n /**\n * Read the value at location index in the TensorArray.\n * @param index Number the index to read from.\n */\n read(index: number): Tensor {\n if (this.closed_) {\n throw new Error(`TensorArray ${this.name} has already been closed.`);\n }\n\n if (index < 0 || index >= this.size()) {\n throw new Error(`Tried to read from index ${index}, but array size is: ${\n this.size()}`);\n }\n\n const tensorWithState = this.tensors[index];\n if (tensorWithState.cleared) {\n throw new Error(\n `TensorArray ${this.name}: Could not read index ${\n index} twice because it was cleared after a previous read ` +\n `(perhaps try setting clear_after_read = false?).`);\n }\n\n if (this.clearAfterRead) {\n tensorWithState.cleared = true;\n }\n\n tensorWithState.read = true;\n return tensorWithState.tensor;\n }\n\n /**\n * Helper method to read multiple tensors from the specified indices.\n */\n readMany(indices: number[]): Tensor[] {\n return indices.map(index => this.read(index));\n }\n\n /**\n * Write value into the index of the TensorArray.\n * @param index number the index to write to.\n * @param tensor\n */\n write(index: number, tensor: Tensor) {\n if (this.closed_) {\n throw new Error(`TensorArray ${this.name} has already been closed.`);\n }\n\n if (index < 0 || !this.dynamicSize && index >= this.maxSize) {\n throw new Error(`Tried to write to index ${\n index}, but array is not resizeable and size is: ${this.maxSize}`);\n }\n\n const t = this.tensors[index] || {};\n\n if (tensor.dtype !== this.dtype) {\n throw new Error(`TensorArray ${\n this.name}: Could not write to TensorArray index ${index},\n because the value dtype is ${\n tensor.dtype}, but TensorArray dtype is ${this.dtype}.`);\n }\n\n // Set the shape for the first time write to unknow shape tensor array\n if (this.size() === 0 &&\n (this.elementShape == null || this.elementShape.length === 0)) {\n this.elementShape = tensor.shape;\n }\n\n assertShapesMatchAllowUndefinedSize(\n this.elementShape, tensor.shape,\n `TensorArray ${this.name}: Could not write to TensorArray index ${\n index}.`);\n\n if (t.read) {\n throw new Error(\n `TensorArray ${this.name}: Could not write to TensorArray index ${\n index}, because it has already been read.`);\n }\n\n if (t.written) {\n throw new Error(\n `TensorArray ${this.name}: Could not write to TensorArray index ${\n index}, because it has already been written.`);\n }\n\n t.tensor = tensor;\n keep(tensor);\n t.written = true;\n\n this.tensors[index] = t;\n }\n\n /**\n * Helper method to write multiple tensors to the specified indices.\n */\n writeMany(indices: number[], tensors: Tensor[]) {\n if (indices.length !== tensors.length) {\n throw new Error(\n `TensorArray ${this.name}: could not write multiple tensors,` +\n `because the index size: ${\n indices.length} is not the same as tensors size: ${\n tensors.length}.`);\n }\n\n indices.forEach((i, index) => this.write(i, tensors[index]));\n }\n\n /**\n * Return selected values in the TensorArray as a packed Tensor. All of\n * selected values must have been written and their shapes must all match.\n * @param [indices] number[] Optional. Taking values in [0, max_value). If the\n * TensorArray is not dynamic, max_value=size(). If not specified returns\n * all tensors in the original order.\n * @param [dtype]\n */\n gather(indices?: number[], dtype?: DataType): Tensor {\n if (!!dtype && dtype !== this.dtype) {\n throw new Error(`TensorArray dtype is ${\n this.dtype} but gather requested dtype ${dtype}`);\n }\n\n if (!indices) {\n indices = [];\n for (let i = 0; i < this.size(); i++) {\n indices.push(i);\n }\n } else {\n indices = indices.slice(0, this.size());\n }\n\n if (indices.length === 0) {\n return tensor([], [0].concat(this.elementShape));\n }\n\n // Read all the PersistentTensors into a vector to keep track of\n // their memory.\n const tensors = this.readMany(indices);\n\n assertShapesMatchAllowUndefinedSize(\n this.elementShape, tensors[0].shape, 'TensorArray shape mismatch: ');\n\n return stack(tensors, 0);\n }\n\n /**\n * Return the values in the TensorArray as a concatenated Tensor.\n */\n concat(dtype?: DataType): Tensor {\n if (!!dtype && dtype !== this.dtype) {\n throw new Error(`TensorArray dtype is ${\n this.dtype} but concat requested dtype ${dtype}`);\n }\n\n if (this.size() === 0) {\n return tensor([], [0].concat(this.elementShape));\n }\n\n const indices = [];\n for (let i = 0; i < this.size(); i++) {\n indices.push(i);\n }\n // Collect all the tensors from the tensors array.\n const tensors = this.readMany(indices);\n\n assertShapesMatchAllowUndefinedSize(\n this.elementShape, tensors[0].shape,\n `TensorArray shape mismatch: tensor array shape (${\n this.elementShape}) vs first tensor shape (${tensors[0].shape})`);\n\n return concat(tensors, 0);\n }\n\n /**\n * Scatter the values of a Tensor in specific indices of a TensorArray.\n * @param indices nummber[] values in [0, max_value). If the\n * TensorArray is not dynamic, max_value=size().\n * @param tensor Tensor input tensor.\n */\n scatter(indices: number[], tensor: Tensor) {\n if (tensor.dtype !== this.dtype) {\n throw new Error(`TensorArray dtype is ${\n this.dtype} but tensor has dtype ${tensor.dtype}`);\n }\n\n if (indices.length !== tensor.shape[0]) {\n throw new Error(`Expected len(indices) == tensor.shape[0], but saw: ${\n indices.length} vs. ${tensor.shape[0]}`);\n }\n\n const maxIndex = Math.max(...indices);\n\n if (!this.dynamicSize && maxIndex >= this.maxSize) {\n throw new Error(\n `Max index must be < array size (${maxIndex} vs. ${this.maxSize})`);\n }\n\n this.writeMany(indices, unstack(tensor, 0));\n }\n\n /**\n * Split the values of a Tensor into the TensorArray.\n * @param length number[] with the lengths to use when splitting value along\n * its first dimension.\n * @param tensor Tensor, the tensor to split.\n */\n split(length: number[], tensor: Tensor) {\n if (tensor.dtype !== this.dtype) {\n throw new Error(`TensorArray dtype is ${\n this.dtype} but tensor has dtype ${tensor.dtype}`);\n }\n let totalLength = 0;\n const cumulativeLengths = length.map(len => {\n totalLength += len;\n return totalLength;\n });\n\n if (totalLength !== tensor.shape[0]) {\n throw new Error(`Expected sum of lengths to be equal to\n tensor.shape[0], but sum of lengths is\n ${totalLength}, and tensor's shape is: ${tensor.shape}`);\n }\n\n if (!this.dynamicSize && length.length !== this.maxSize) {\n throw new Error(\n `TensorArray's size is not equal to the size of lengths (${\n this.maxSize} vs. ${length.length}), ` +\n 'and the TensorArray is not marked as dynamically resizeable');\n }\n\n const elementPerRow = totalLength === 0 ? 0 : tensor.size / totalLength;\n const tensors: Tensor[] = [];\n tidy(() => {\n tensor = reshape(tensor, [1, totalLength, elementPerRow]);\n for (let i = 0; i < length.length; ++i) {\n const previousLength = (i === 0) ? 0 : cumulativeLengths[i - 1];\n const indices = [0, previousLength, 0];\n const sizes = [1, length[i], elementPerRow];\n tensors[i] = reshape(slice(tensor, indices, sizes), this.elementShape);\n }\n return tensors;\n });\n const indices = [];\n for (let i = 0; i < length.length; i++) {\n indices[i] = i;\n }\n this.writeMany(indices, tensors);\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {concat, DataType, keep, reshape, scalar, slice, stack, Tensor, tensor, tidy, unstack} from '@tensorflow/tfjs-core';\n\nimport {assertShapesMatchAllowUndefinedSize, inferElementShape, mergeElementShape} from './tensor_utils';\n\n/**\n * TensorList stores a container of `tf.Tensor` objects, which are accessible\n * via tensors field.\n *\n * In order to get a copy of the underlying list, use the copy method:\n * ```\n * TensorList b = a.copy();\n * b.tensors().pushBack(t); // This does not modify a.tensors().\n * ```\n *\n * Note that this is not a deep copy: the memory locations of the underlying\n * tensors will still point to the same locations of the corresponding tensors\n * in the original.\n */\n\nexport class TensorList {\n readonly idTensor: Tensor;\n maxNumElements: number;\n\n get id() {\n return this.idTensor.id;\n }\n /**\n *\n * @param tensors list of tensors\n * @param elementShape shape of each tensor, this can be a single number (any\n * shape is allowed) or partial shape (dim = -1).\n * @param elementDtype data type of each tensor\n * @param maxNumElements The maximum allowed size of `tensors`. Defaults to -1\n * meaning that the size of `tensors` is unbounded.\n */\n constructor(\n readonly tensors: Tensor[], readonly elementShape: number|number[],\n readonly elementDtype: DataType, maxNumElements = -1) {\n if (tensors != null) {\n tensors.forEach(tensor => {\n if (elementDtype !== tensor.dtype) {\n throw new Error(`Invalid data types; op elements ${\n elementDtype}, but list elements ${tensor.dtype}`);\n }\n assertShapesMatchAllowUndefinedSize(\n elementShape, tensor.shape, 'TensorList shape mismatch: ');\n\n keep(tensor);\n });\n }\n this.idTensor = scalar(0);\n this.maxNumElements = maxNumElements;\n keep(this.idTensor);\n }\n\n /**\n * Get a new TensorList containing a copy of the underlying tensor container.\n */\n copy(): TensorList {\n return new TensorList(\n [...this.tensors], this.elementShape, this.elementDtype);\n }\n\n /**\n * Dispose the tensors and idTensor and clear the tensor list.\n */\n clearAndClose(keepIds?: Set) {\n this.tensors.forEach(tensor => {\n if (keepIds == null || !keepIds.has(tensor.id)) {\n tensor.dispose();\n }\n });\n this.tensors.length = 0;\n this.idTensor.dispose();\n }\n /**\n * The size of the tensors in the tensor list.\n */\n size() {\n return this.tensors.length;\n }\n\n /**\n * Return a tensor that stacks a list of rank-R tf.Tensors into one rank-(R+1)\n * tf.Tensor.\n * @param elementShape shape of each tensor\n * @param elementDtype data type of each tensor\n * @param numElements the number of elements to stack\n */\n stack(elementShape: number[], elementDtype: DataType, numElements = -1):\n Tensor {\n if (elementDtype !== this.elementDtype) {\n throw new Error(`Invalid data types; op elements ${\n elementDtype}, but list elements ${this.elementDtype}`);\n }\n if (numElements !== -1 && this.tensors.length !== numElements) {\n throw new Error(`Operation expected a list with ${\n numElements} elements but got a list with ${\n this.tensors.length} elements.`);\n }\n assertShapesMatchAllowUndefinedSize(\n elementShape, this.elementShape, 'TensorList shape mismatch: ');\n const outputElementShape =\n inferElementShape(this.elementShape, this.tensors, elementShape);\n return tidy(() => {\n const reshapedTensors =\n this.tensors.map(tensor => reshape(tensor, outputElementShape));\n return stack(reshapedTensors, 0);\n });\n }\n\n /**\n * Pop a tensor from the end of the list.\n * @param elementShape shape of the tensor\n * @param elementDtype data type of the tensor\n */\n popBack(elementShape: number[], elementDtype: DataType): Tensor {\n if (elementDtype !== this.elementDtype) {\n throw new Error(`Invalid data types; op elements ${\n elementDtype}, but list elements ${this.elementDtype}`);\n }\n\n if (this.size() === 0) {\n throw new Error('Trying to pop from an empty list.');\n }\n const outputElementShape =\n inferElementShape(this.elementShape, this.tensors, elementShape);\n const tensor = this.tensors.pop();\n tensor.kept = false;\n\n assertShapesMatchAllowUndefinedSize(\n tensor.shape, elementShape, 'TensorList shape mismatch: ');\n\n return reshape(tensor, outputElementShape);\n }\n\n /**\n * Push a tensor to the end of the list.\n * @param tensor Tensor to be pushed.\n */\n pushBack(tensor: Tensor) {\n if (tensor.dtype !== this.elementDtype) {\n throw new Error(`Invalid data types; op elements ${\n tensor.dtype}, but list elements ${this.elementDtype}`);\n }\n\n assertShapesMatchAllowUndefinedSize(\n tensor.shape, this.elementShape, 'TensorList shape mismatch: ');\n\n if (this.maxNumElements === this.size()) {\n throw new Error(`Trying to push element into a full list.`);\n }\n keep(tensor);\n this.tensors.push(tensor);\n }\n\n /**\n * Update the size of the list.\n * @param size the new size of the list.\n */\n resize(size: number) {\n if (size < 0) {\n throw new Error(\n `TensorListResize expects size to be non-negative. Got: ${size}`);\n }\n\n if (this.maxNumElements !== -1 && size > this.maxNumElements) {\n throw new Error(`TensorListResize input size ${\n size} is greater maxNumElement ${this.maxNumElements}.`);\n }\n\n const destTensorList: TensorList = new TensorList(\n [], this.elementShape, this.elementDtype, this.maxNumElements);\n destTensorList.tensors.length = size;\n for (let i = 0; i < Math.min(this.tensors.length, size); ++i) {\n destTensorList.tensors[i] = this.tensors[i];\n }\n return destTensorList;\n }\n\n /**\n * Retrieve the element at the provided index\n * @param elementShape shape of the tensor\n * @param elementDtype dtype of the tensor\n * @param elementIndex index of the tensor\n */\n getItem(elementIndex: number, elementShape: number[], elementDtype: DataType):\n Tensor {\n if (elementDtype !== this.elementDtype) {\n throw new Error(`Invalid data types; op elements ${\n elementDtype}, but list elements ${this.elementDtype}`);\n }\n if (elementIndex < 0 || elementIndex > this.tensors.length) {\n throw new Error(`Trying to access element ${\n elementIndex} in a list with ${this.tensors.length} elements.`);\n }\n\n if (this.tensors[elementIndex] == null) {\n throw new Error(`element at index ${elementIndex} is null.`);\n }\n\n assertShapesMatchAllowUndefinedSize(\n this.tensors[elementIndex].shape, elementShape,\n 'TensorList shape mismatch: ');\n const outputElementShape =\n inferElementShape(this.elementShape, this.tensors, elementShape);\n return reshape(this.tensors[elementIndex], outputElementShape);\n }\n\n /**\n * Set the tensor at the index\n * @param elementIndex index of the tensor\n * @param tensor the tensor to be inserted into the list\n */\n setItem(elementIndex: number, tensor: Tensor) {\n if (tensor.dtype !== this.elementDtype) {\n throw new Error(`Invalid data types; op elements ${\n tensor.dtype}, but list elements ${this.elementDtype}`);\n }\n\n if (elementIndex < 0 ||\n this.maxNumElements !== -1 && elementIndex >= this.maxNumElements) {\n throw new Error(`Trying to set element ${\n elementIndex} in a list with max ${this.maxNumElements} elements.`);\n }\n\n assertShapesMatchAllowUndefinedSize(\n this.elementShape, tensor.shape, 'TensorList shape mismatch: ');\n keep(tensor);\n\n // dispose the previous value if it is replacing.\n if (this.tensors[elementIndex] != null) {\n this.tensors[elementIndex].kept = false;\n }\n\n this.tensors[elementIndex] = tensor;\n }\n\n /**\n * Return selected values in the TensorList as a stacked Tensor. All of\n * selected values must have been written and their shapes must all match.\n * @param indices indices of tensors to gather\n * @param elementDtype output tensor dtype\n * @param elementShape output tensor element shape\n */\n gather(indices: number[], elementDtype: DataType, elementShape: number[]):\n Tensor {\n if (elementDtype !== this.elementDtype) {\n throw new Error(`Invalid data types; op elements ${\n elementDtype}, but list elements ${this.elementDtype}`);\n }\n\n assertShapesMatchAllowUndefinedSize(\n this.elementShape, elementShape, 'TensorList shape mismatch: ');\n\n // When indices is greater than the size of the list, indices beyond the\n // size of the list are ignored.\n indices = indices.slice(0, this.size());\n const outputElementShape =\n inferElementShape(this.elementShape, this.tensors, elementShape);\n if (indices.length === 0) {\n return tensor([], [0].concat(outputElementShape));\n }\n\n return tidy(() => {\n const tensors =\n indices.map(i => reshape(this.tensors[i], outputElementShape));\n return stack(tensors, 0);\n });\n }\n\n /**\n * Return the values in the TensorList as a concatenated Tensor.\n * @param elementDtype output tensor dtype\n * @param elementShape output tensor element shape\n */\n concat(elementDtype: DataType, elementShape: number[]): Tensor {\n if (!!elementDtype && elementDtype !== this.elementDtype) {\n throw new Error(`TensorList dtype is ${\n this.elementDtype} but concat requested dtype ${elementDtype}`);\n }\n\n assertShapesMatchAllowUndefinedSize(\n this.elementShape, elementShape, 'TensorList shape mismatch: ');\n const outputElementShape =\n inferElementShape(this.elementShape, this.tensors, elementShape);\n\n if (this.size() === 0) {\n return tensor([], [0].concat(outputElementShape));\n }\n return tidy(() => {\n const tensors = this.tensors.map(t => reshape(t, outputElementShape));\n return concat(tensors, 0);\n });\n }\n}\n\n/**\n * Creates a TensorList which, when stacked, has the value of tensor.\n * @param tensor from tensor\n * @param elementShape output tensor element shape\n */\nexport function fromTensor(\n tensor: Tensor, elementShape: number[], elementDtype: DataType) {\n const dtype = tensor.dtype;\n if (tensor.shape.length < 1) {\n throw new Error(\n `Tensor must be at least a vector, but saw shape: ${tensor.shape}`);\n }\n if (tensor.dtype !== elementDtype) {\n throw new Error(`Invalid data types; op elements ${\n tensor.dtype}, but list elements ${elementDtype}`);\n }\n const tensorElementShape = tensor.shape.slice(1);\n assertShapesMatchAllowUndefinedSize(\n tensorElementShape, elementShape, 'TensorList shape mismatch: ');\n const tensorList: Tensor[] = unstack(tensor);\n return new TensorList(tensorList, elementShape, dtype);\n}\n\n/**\n * Return a TensorList of the given size with empty elements.\n * @param elementShape the shape of the future elements of the list\n * @param elementDtype the desired type of elements in the list\n * @param numElements the number of elements to reserve\n * @param maxNumElements the maximum number of elements in th list\n */\nexport function reserve(\n elementShape: number[], elementDtype: DataType, numElements: number,\n maxNumElements: number) {\n return new TensorList([], elementShape, elementDtype, maxNumElements);\n}\n\n/**\n * Put tensors at specific indices of a stacked tensor into a TensorList.\n * @param indices list of indices on how to scatter the tensor.\n * @param tensor input tensor.\n * @param elementShape the shape of the future elements of the list\n * @param numElements the number of elements to scatter\n */\nexport function scatter(\n tensor: Tensor, indices: number[], elementShape: number[],\n numElements?: number): TensorList {\n if (indices.length !== tensor.shape[0]) {\n throw new Error(`Expected len(indices) == tensor.shape[0], but saw: ${\n indices.length} vs. ${tensor.shape[0]}`);\n }\n\n const maxIndex = Math.max(...indices);\n\n if (numElements != null && numElements !== -1 && maxIndex >= numElements) {\n throw new Error(\n `Max index must be < array size (${maxIndex} vs. ${numElements})`);\n }\n\n const list = new TensorList([], elementShape, tensor.dtype, numElements);\n const tensors = unstack(tensor, 0);\n indices.forEach((value, index) => {\n list.setItem(value, tensors[index]);\n });\n return list;\n}\n\n/**\n * Split the values of a Tensor into a TensorList.\n * @param length the lengths to use when splitting value along\n * its first dimension.\n * @param tensor the tensor to split.\n * @param elementShape the shape of the future elements of the list\n */\nexport function split(\n tensor: Tensor, length: number[], elementShape: number[]) {\n let totalLength = 0;\n const cumulativeLengths = length.map(len => {\n totalLength += len;\n return totalLength;\n });\n\n if (totalLength !== tensor.shape[0]) {\n throw new Error(`Expected sum of lengths to be equal to\n tensor.shape[0], but sum of lengths is\n ${totalLength}, and tensor's shape is: ${tensor.shape}`);\n }\n\n const shapeWithoutFirstDim = tensor.shape.slice(1);\n const outputElementShape =\n mergeElementShape(shapeWithoutFirstDim, elementShape);\n const elementPerRow = totalLength === 0 ? 0 : tensor.size / totalLength;\n const tensors: Tensor[] = tidy(() => {\n const tensors = [];\n tensor = reshape(tensor, [1, totalLength, elementPerRow]);\n for (let i = 0; i < length.length; ++i) {\n const previousLength = (i === 0) ? 0 : cumulativeLengths[i - 1];\n const indices = [0, previousLength, 0];\n const sizes = [1, length[i], elementPerRow];\n tensors[i] = reshape(\n slice(tensor, indices, sizes), outputElementShape as number[]);\n }\n tensor.dispose();\n return tensors;\n });\n\n const list = new TensorList([], elementShape, tensor.dtype, length.length);\n\n for (let i = 0; i < tensors.length; i++) {\n list.setItem(i, tensors[i]);\n }\n return list;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataType, scalar, Tensor} from '@tensorflow/tfjs-core';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {TensorArray} from '../../executor/tensor_array';\nimport {fromTensor, reserve, scatter, split} from '../../executor/tensor_list';\nimport {InternalOpAsyncExecutor, Node} from '../types';\n\nimport {cloneTensor, getParamValue, getTensor} from './utils';\n\nexport const executeOp: InternalOpAsyncExecutor = async(\n node: Node, tensorMap: NamedTensorsMap,\n context: ExecutionContext): Promise => {\n switch (node.op) {\n case 'If':\n case 'StatelessIf': {\n const thenFunc =\n getParamValue('thenBranch', node, tensorMap, context) as string;\n const elseFunc =\n getParamValue('elseBranch', node, tensorMap, context) as string;\n const cond = getParamValue('cond', node, tensorMap, context) as Tensor;\n const args = getParamValue('args', node, tensorMap, context) as Tensor[];\n const condValue = await cond.data();\n if (condValue[0]) {\n return context.functionMap[thenFunc].executeFunctionAsync(\n args, context.tensorArrayMap, context.tensorListMap);\n } else {\n return context.functionMap[elseFunc].executeFunctionAsync(\n args, context.tensorArrayMap, context.tensorListMap);\n }\n }\n case 'While':\n case 'StatelessWhile': {\n const bodyFunc =\n getParamValue('body', node, tensorMap, context) as string;\n const condFunc =\n getParamValue('cond', node, tensorMap, context) as string;\n const args = getParamValue('args', node, tensorMap, context) as Tensor[];\n\n // Calculate the condition of the loop\n const condResult =\n (await context.functionMap[condFunc].executeFunctionAsync(\n args, context.tensorArrayMap, context.tensorListMap));\n const argIds = args.map(tensor => tensor.id);\n let condValue = await condResult[0].data();\n // Dispose the intermediate tensors for condition function\n condResult.forEach(tensor => {\n if (!tensor.kept && argIds.indexOf(tensor.id) === -1) {\n tensor.dispose();\n }\n });\n\n let result: Tensor[] = args;\n\n while (condValue[0]) {\n // Record the previous result for intermediate tensor tracking\n const origResult = result;\n // Execution the body of the loop\n result = await context.functionMap[bodyFunc].executeFunctionAsync(\n result, context.tensorArrayMap, context.tensorListMap);\n const resultIds = result.map(tensor => tensor.id);\n\n // Dispose the intermediate tensor for body function that is not global\n // kept, not input/output of the body function\n origResult.forEach(tensor => {\n if (!tensor.kept && argIds.indexOf(tensor.id) === -1 &&\n resultIds.indexOf(tensor.id) === -1) {\n tensor.dispose();\n }\n });\n\n // Recalcuate the condition of the loop using the latest results.\n const condResult =\n (await context.functionMap[condFunc].executeFunctionAsync(\n result, context.tensorArrayMap, context.tensorListMap));\n condValue = await condResult[0].data();\n // Dispose the intermediate tensors for condition function\n condResult.forEach(tensor => {\n if (!tensor.kept && argIds.indexOf(tensor.id) === -1 &&\n resultIds.indexOf(tensor.id) === -1) {\n tensor.dispose();\n }\n });\n }\n return result;\n }\n case 'LoopCond': {\n const pred = getParamValue('pred', node, tensorMap, context) as Tensor;\n return [cloneTensor(pred)];\n }\n case 'Switch': {\n const pred = getParamValue('pred', node, tensorMap, context) as Tensor;\n let data = getParamValue('data', node, tensorMap, context) as Tensor;\n if (!data.kept) {\n data = cloneTensor(data);\n }\n // Outputs nodes :0 => false, :1 => true\n return (await pred.data())[0] ? [undefined, data] : [data, undefined];\n }\n case 'Merge': {\n const inputName = node.inputNames.find(\n name => getTensor(name, tensorMap, context) !== undefined);\n if (inputName) {\n const data = getTensor(inputName, tensorMap, context);\n return [cloneTensor(data)];\n }\n return undefined;\n }\n case 'Enter': {\n const frameId =\n getParamValue('frameName', node, tensorMap, context) as string;\n const data = getParamValue('tensor', node, tensorMap, context) as Tensor;\n context.enterFrame(frameId);\n return [cloneTensor(data)];\n }\n case 'Exit': {\n const data = getParamValue('tensor', node, tensorMap, context) as Tensor;\n context.exitFrame();\n return [cloneTensor(data)];\n }\n case 'NextIteration': {\n const data = getParamValue('tensor', node, tensorMap, context) as Tensor;\n context.nextIteration();\n return [cloneTensor(data)];\n }\n case 'TensorArrayV3': {\n const size = getParamValue('size', node, tensorMap, context) as number;\n const dtype =\n getParamValue('dtype', node, tensorMap, context) as DataType;\n const elementShape =\n getParamValue('elementShape', node, tensorMap, context) as number[];\n const dynamicSize =\n getParamValue('dynamicSize', node, tensorMap, context) as boolean;\n const clearAfterRead =\n getParamValue('clearAfterRead', node, tensorMap, context) as boolean;\n const identicalElementShapes =\n getParamValue('identicalElementShapes', node, tensorMap, context) as\n boolean;\n const name = getParamValue('name', node, tensorMap, context) as string;\n const tensorArray = new TensorArray(\n name, dtype, size, elementShape, identicalElementShapes, dynamicSize,\n clearAfterRead);\n context.addTensorArray(tensorArray);\n return [tensorArray.idTensor, scalar(1.0)];\n }\n case 'TensorArrayWriteV3': {\n const id =\n getParamValue('tensorArrayId', node, tensorMap, context) as Tensor;\n const index = getParamValue('index', node, tensorMap, context) as number;\n const writeTensor =\n getParamValue('tensor', node, tensorMap, context) as Tensor;\n const writeTensorArray = context.getTensorArray(id.id);\n writeTensorArray.write(index, writeTensor);\n return [writeTensorArray.idTensor];\n }\n case 'TensorArrayReadV3': {\n const readId =\n getParamValue('tensorArrayId', node, tensorMap, context) as Tensor;\n const readIndex =\n getParamValue('index', node, tensorMap, context) as number;\n const readTensorArray = context.getTensorArray(readId.id);\n return [readTensorArray.read(readIndex)];\n }\n case 'TensorArrayGatherV3': {\n const gatherId =\n getParamValue('tensorArrayId', node, tensorMap, context) as Tensor;\n const gatherIndices =\n getParamValue('indices', node, tensorMap, context) as number[];\n const gatherDtype =\n getParamValue('dtype', node, tensorMap, context) as DataType;\n const gatherTensorArray = context.getTensorArray(gatherId.id);\n return [gatherTensorArray.gather(gatherIndices, gatherDtype)];\n }\n case 'TensorArrayScatterV3': {\n const scatterId =\n getParamValue('tensorArrayId', node, tensorMap, context) as Tensor;\n const scatterIndices =\n getParamValue('indices', node, tensorMap, context) as number[];\n const scatterTensor =\n getParamValue('tensor', node, tensorMap, context) as Tensor;\n const scatterTensorArray = context.getTensorArray(scatterId.id);\n scatterTensorArray.scatter(scatterIndices, scatterTensor);\n return [scatterTensorArray.idTensor];\n }\n case 'TensorArrayConcatV3': {\n const concatId =\n getParamValue('tensorArrayId', node, tensorMap, context) as Tensor;\n const concatTensorArray = context.getTensorArray(concatId.id);\n const concatDtype =\n getParamValue('dtype', node, tensorMap, context) as DataType;\n return [concatTensorArray.concat(concatDtype)];\n }\n case 'TensorArraySplitV3': {\n const splitId =\n getParamValue('tensorArrayId', node, tensorMap, context) as Tensor;\n const splitTensor =\n getParamValue('tensor', node, tensorMap, context) as Tensor;\n const lengths =\n getParamValue('lengths', node, tensorMap, context) as number[];\n const splitTensorArray = context.getTensorArray(splitId.id);\n splitTensorArray.split(lengths, splitTensor);\n return [splitTensorArray.idTensor];\n }\n case 'TensorArraySizeV3': {\n const sizeId =\n getParamValue('tensorArrayId', node, tensorMap, context) as Tensor;\n const sizeTensorArray = context.getTensorArray(sizeId.id);\n return [scalar(sizeTensorArray.size(), 'int32')];\n }\n case 'TensorArrayCloseV3': {\n const closeId =\n getParamValue('tensorArrayId', node, tensorMap, context) as Tensor;\n const closeTensorArray = context.getTensorArray(closeId.id);\n closeTensorArray.clearAndClose();\n return [closeTensorArray.idTensor];\n }\n case 'TensorListSetItem': {\n const idTensor =\n getParamValue('tensorListId', node, tensorMap, context) as Tensor;\n const index = getParamValue('index', node, tensorMap, context) as number;\n const writeTensor =\n getParamValue('tensor', node, tensorMap, context) as Tensor;\n const tensorList = context.getTensorList(idTensor.id);\n tensorList.setItem(index, writeTensor);\n return [tensorList.idTensor];\n }\n case 'TensorListGetItem': {\n const idTensor =\n getParamValue('tensorListId', node, tensorMap, context) as Tensor;\n const readIndex =\n getParamValue('index', node, tensorMap, context) as number;\n const elementShape =\n getParamValue('elementShape', node, tensorMap, context) as number[];\n\n const elementDType =\n getParamValue('elementDType', node, tensorMap, context) as DataType;\n const tensorList = context.getTensorList(idTensor.id);\n return [tensorList.getItem(readIndex, elementShape, elementDType)];\n }\n case 'TensorListScatterV2':\n case 'TensorListScatter': {\n const scatterIndices =\n getParamValue('indices', node, tensorMap, context) as number[];\n const scatterTensor =\n getParamValue('tensor', node, tensorMap, context) as Tensor;\n const elementShape =\n getParamValue('elementShape', node, tensorMap, context) as number[];\n const numElements =\n getParamValue('numElements', node, tensorMap, context) as number;\n const tensorList =\n scatter(scatterTensor, scatterIndices, elementShape, numElements);\n context.addTensorList(tensorList);\n return [tensorList.idTensor];\n }\n case 'TensorListReserve':\n case 'EmptyTensorList': {\n const elementShape =\n getParamValue('elementShape', node, tensorMap, context) as number[];\n const elementDtype =\n getParamValue('elementDType', node, tensorMap, context) as DataType;\n let numElementsParam;\n\n if (node.op === 'TensorListReserve') {\n numElementsParam = 'numElements';\n } else {\n numElementsParam = 'maxNumElements';\n }\n\n const numElements =\n getParamValue(numElementsParam, node, tensorMap, context) as number;\n const maxNumElements = node.op === 'TensorListReserve' ? -1 : numElements;\n const tensorList =\n reserve(elementShape, elementDtype, numElements, maxNumElements);\n context.addTensorList(tensorList);\n return [tensorList.idTensor];\n }\n case 'TensorListGather': {\n const gatherId =\n getParamValue('tensorListId', node, tensorMap, context) as Tensor;\n const gatherIndices =\n getParamValue('indices', node, tensorMap, context) as number[];\n const elementShape =\n getParamValue('elementShape', node, tensorMap, context) as number[];\n const elementDtype =\n getParamValue('elementDType', node, tensorMap, context) as DataType;\n const tensorList = context.getTensorList(gatherId.id);\n return [tensorList.gather(gatherIndices, elementDtype, elementShape)];\n }\n case 'TensorListStack': {\n const idTensor =\n getParamValue('tensorListId', node, tensorMap, context) as Tensor;\n const elementShape =\n getParamValue('elementShape', node, tensorMap, context) as number[];\n const elementDtype =\n getParamValue('elementDType', node, tensorMap, context) as DataType;\n const numElements =\n getParamValue('numElements', node, tensorMap, context) as number;\n const tensorList = context.getTensorList(idTensor.id);\n return [tensorList.stack(elementShape, elementDtype, numElements)];\n }\n case 'TensorListFromTensor': {\n const tensor =\n getParamValue('tensor', node, tensorMap, context) as Tensor;\n const elementShape =\n getParamValue('elementShape', node, tensorMap, context) as number[];\n const elementDtype =\n getParamValue('elementDType', node, tensorMap, context) as DataType;\n const tensorList = fromTensor(tensor, elementShape, elementDtype);\n context.addTensorList(tensorList);\n return [tensorList.idTensor];\n }\n case 'TensorListConcat':\n case 'TensorListConcatV2': {\n const concatId =\n getParamValue('tensorListId', node, tensorMap, context) as Tensor;\n const tensorList = context.getTensorList(concatId.id);\n const concatDtype =\n getParamValue('dtype', node, tensorMap, context) as DataType;\n const elementShape =\n getParamValue('elementShape', node, tensorMap, context) as number[];\n return [tensorList.concat(concatDtype, elementShape)];\n }\n case 'TensorListPushBack': {\n const idTensor =\n getParamValue('tensorListId', node, tensorMap, context) as Tensor;\n const writeTensor =\n getParamValue('tensor', node, tensorMap, context) as Tensor;\n const tensorList = context.getTensorList(idTensor.id);\n tensorList.pushBack(writeTensor);\n return [tensorList.idTensor];\n }\n case 'TensorListPopBack': {\n const idTensor =\n getParamValue('tensorListId', node, tensorMap, context) as Tensor;\n const elementShape =\n getParamValue('elementShape', node, tensorMap, context) as number[];\n const elementDType =\n getParamValue('elementDType', node, tensorMap, context) as DataType;\n const tensorList = context.getTensorList(idTensor.id);\n return [tensorList.popBack(elementShape, elementDType)];\n }\n case 'TensorListSplit': {\n const splitTensor =\n getParamValue('tensor', node, tensorMap, context) as Tensor;\n const elementShape =\n getParamValue('elementShape', node, tensorMap, context) as number[];\n const lengths =\n getParamValue('lengths', node, tensorMap, context) as number[];\n\n const tensorList = split(splitTensor, lengths, elementShape);\n context.addTensorList(tensorList);\n return [tensorList.idTensor];\n }\n case 'TensorListLength': {\n const idTensor =\n getParamValue('tensorListId', node, tensorMap, context) as Tensor;\n const tensorList = context.getTensorList(idTensor.id);\n return [scalar(tensorList.size(), 'int32')];\n }\n case 'TensorListResize': {\n const idTensor =\n getParamValue('tensorListId', node, tensorMap, context) as Tensor;\n const size = getParamValue('size', node, tensorMap, context) as number;\n\n const srcTensorList = context.getTensorList(idTensor.id);\n const destTensorList = srcTensorList.resize(size);\n context.addTensorList(destTensorList);\n return [destTensorList.idTensor];\n }\n default:\n throw TypeError(`Node type ${node.op} is not implemented`);\n }\n};\n\nexport const CATEGORY = 'control';\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Rank, Tensor, Tensor3D, Tensor4D, Tensor5D} from '@tensorflow/tfjs-core';\n// tslint:disable-next-line: no-imports-from-dist\nimport * as tfOps from '@tensorflow/tfjs-core/dist/ops/ops_for_converter';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {InternalOpExecutor, Node} from '../types';\n\nimport {getPadding, getParamValue} from './utils';\n\nfunction fusedConvAndDepthWiseParams(\n node: Node, tensorMap: NamedTensorsMap, context: ExecutionContext) {\n const [extraOp, activationFunc] =\n (getParamValue('fusedOps', node, tensorMap, context) as string[]);\n\n const isBiasAdd = extraOp === 'biasadd';\n const noBiasAdd = !isBiasAdd;\n const isPrelu = activationFunc === 'prelu';\n const isBatchNorm = extraOp === 'fusedbatchnorm';\n\n const numArgs =\n (getParamValue('numArgs', node, tensorMap, context) as number);\n if (isBiasAdd) {\n if (isPrelu && numArgs !== 2) {\n throw new Error(\n 'FusedConv2d and DepthwiseConv2d with BiasAdd and Prelu ' +\n 'must have two extra arguments: bias and alpha.');\n }\n if (!isPrelu && isBiasAdd && numArgs !== 1) {\n throw new Error(\n 'FusedConv2d and DepthwiseConv2d with BiasAdd must have ' +\n 'one extra argument: bias.');\n }\n }\n if (isBatchNorm) {\n throw new Error(\n 'FusedConv2d and DepthwiseConv2d with FusedBatchNorm is not supported');\n }\n const stride = getParamValue('strides', node, tensorMap, context) as number[];\n const pad = getPadding(node, tensorMap, context);\n const dataFormat =\n (getParamValue('dataFormat', node, tensorMap, context) as string)\n .toUpperCase();\n const dilations =\n getParamValue('dilations', node, tensorMap, context) as number[];\n let [biasArg, preluArg] =\n getParamValue('args', node, tensorMap, context) as Tensor[];\n if (noBiasAdd) {\n preluArg = biasArg;\n biasArg = undefined;\n }\n const leakyreluAlpha =\n getParamValue('leakyreluAlpha', node, tensorMap, context) as number;\n\n return {\n stride,\n pad,\n dataFormat,\n dilations,\n biasArg,\n preluArg,\n activationFunc,\n leakyreluAlpha\n };\n}\n\nexport const executeOp: InternalOpExecutor =\n (node: Node, tensorMap: NamedTensorsMap,\n context: ExecutionContext, ops = tfOps): Tensor[] => {\n switch (node.op) {\n case 'Conv1D': {\n const stride =\n getParamValue('stride', node, tensorMap, context) as number;\n const pad = getParamValue('pad', node, tensorMap, context);\n const dataFormat =\n (getParamValue('dataFormat', node, tensorMap, context) as string)\n .toUpperCase();\n const dilation =\n getParamValue('dilation', node, tensorMap, context) as number;\n return [ops.conv1d(\n getParamValue('x', node, tensorMap, context) as Tensor3D,\n getParamValue('filter', node, tensorMap, context) as Tensor3D,\n stride, pad as 'valid' | 'same', dataFormat as 'NWC' | 'NCW',\n dilation)];\n }\n case 'Conv2D': {\n const stride =\n getParamValue('strides', node, tensorMap, context) as number[];\n const pad = getPadding(node, tensorMap, context);\n const dataFormat =\n (getParamValue('dataFormat', node, tensorMap, context) as string)\n .toUpperCase();\n const dilations =\n getParamValue('dilations', node, tensorMap, context) as number[];\n return [ops.conv2d(\n getParamValue('x', node, tensorMap, context) as Tensor3D |\n Tensor4D,\n getParamValue('filter', node, tensorMap, context) as Tensor4D,\n [stride[1], stride[2]], pad as 'valid' | 'same',\n dataFormat as 'NHWC' | 'NCHW', [dilations[1], dilations[2]])];\n }\n case '_FusedConv2D': {\n const {\n stride,\n pad,\n dataFormat,\n dilations,\n biasArg,\n preluArg,\n activationFunc,\n leakyreluAlpha\n } = fusedConvAndDepthWiseParams(node, tensorMap, context);\n\n return [ops.fused.conv2d({\n x: getParamValue('x', node, tensorMap, context) as Tensor3D |\n Tensor4D,\n filter: getParamValue('filter', node, tensorMap, context) as\n Tensor4D,\n strides: [stride[1], stride[2]],\n pad: pad as 'valid' | 'same',\n dataFormat: dataFormat as 'NHWC' | 'NCHW',\n dilations: [dilations[1], dilations[2]],\n bias: biasArg,\n activation: activationFunc as tfOps.fused.Activation,\n preluActivationWeights: preluArg,\n leakyreluAlpha\n })];\n }\n\n case 'FusedDepthwiseConv2dNative': {\n const {\n stride,\n pad,\n dataFormat,\n dilations,\n biasArg,\n preluArg,\n activationFunc,\n leakyreluAlpha,\n } = fusedConvAndDepthWiseParams(node, tensorMap, context);\n\n return [ops.fused.depthwiseConv2d({\n x: getParamValue('x', node, tensorMap, context) as Tensor3D |\n Tensor4D,\n filter: getParamValue('filter', node, tensorMap, context) as\n Tensor4D,\n strides: [stride[1], stride[2]],\n pad: pad as 'valid' | 'same',\n dataFormat: dataFormat as 'NHWC' | 'NCHW',\n dilations: [dilations[1], dilations[2]],\n bias: biasArg,\n activation: activationFunc as tfOps.fused.Activation,\n preluActivationWeights: preluArg,\n leakyreluAlpha\n })];\n }\n case 'Conv2DBackpropInput':\n case 'Conv2dTranspose': {\n const shape = getParamValue(\n 'outputShape', node, tensorMap,\n context) as [number, number, number] |\n [number, number, number, number];\n const stride =\n getParamValue('strides', node, tensorMap, context) as number[];\n const pad = getPadding(node, tensorMap, context);\n return [ops.conv2dTranspose(\n getParamValue('x', node, tensorMap, context) as Tensor3D |\n Tensor4D,\n getParamValue('filter', node, tensorMap, context) as Tensor4D,\n shape, [stride[1], stride[2]], pad as 'valid' | 'same')];\n }\n case 'DepthwiseConv2dNative':\n case 'DepthwiseConv2d': {\n const stride =\n getParamValue('strides', node, tensorMap, context) as number[];\n const pad = getPadding(node, tensorMap, context);\n const dilations =\n getParamValue('dilations', node, tensorMap, context) as number[];\n const dataFormat =\n (getParamValue('dataFormat', node, tensorMap, context) as string)\n .toUpperCase();\n\n return [ops.depthwiseConv2d(\n getParamValue('input', node, tensorMap, context) as Tensor3D |\n Tensor4D,\n getParamValue('filter', node, tensorMap, context) as Tensor4D,\n [stride[1], stride[2]], pad as 'valid' | 'same',\n dataFormat as 'NHWC' | 'NCHW', [dilations[1], dilations[2]])];\n }\n case 'Conv3D': {\n const stride =\n getParamValue('strides', node, tensorMap, context) as number[];\n const pad = getParamValue('pad', node, tensorMap, context);\n const dataFormat =\n (getParamValue('dataFormat', node, tensorMap, context) as string)\n .toUpperCase();\n const dilations =\n getParamValue('dilations', node, tensorMap, context) as number[];\n return [ops.conv3d(\n getParamValue('x', node, tensorMap, context) as Tensor4D |\n Tensor,\n getParamValue('filter', node, tensorMap, context) as\n Tensor,\n [stride[1], stride[2], stride[3]], pad as 'valid' | 'same',\n dataFormat as 'NDHWC' | 'NCDHW',\n [dilations[1], dilations[2], dilations[3]])];\n }\n case 'AvgPool': {\n const stride =\n getParamValue('strides', node, tensorMap, context) as number[];\n const pad = getParamValue('pad', node, tensorMap, context);\n const kernelSize =\n getParamValue('kernelSize', node, tensorMap, context) as number[];\n\n return [ops.avgPool(\n getParamValue('x', node, tensorMap, context) as Tensor3D |\n Tensor4D,\n [kernelSize[1], kernelSize[2]], [stride[1], stride[2]],\n pad as 'valid' | 'same')];\n }\n case 'MaxPool': {\n const stride =\n getParamValue('strides', node, tensorMap, context) as number[];\n const pad = getParamValue('pad', node, tensorMap, context);\n const kernelSize =\n getParamValue('kernelSize', node, tensorMap, context) as number[];\n\n return [ops.maxPool(\n getParamValue('x', node, tensorMap, context) as Tensor3D |\n Tensor4D,\n [kernelSize[1], kernelSize[2]], [stride[1], stride[2]],\n pad as 'valid' | 'same')];\n }\n case 'MaxPoolWithArgmax': {\n const stride =\n getParamValue('strides', node, tensorMap, context) as number[];\n const pad = getParamValue('pad', node, tensorMap, context);\n const kernelSize =\n getParamValue('kernelSize', node, tensorMap, context) as number[];\n const includeBatchInIndex =\n getParamValue('includeBatchInIndex', node, tensorMap, context) as\n boolean;\n const {result, indexes} = ops.maxPoolWithArgmax(\n getParamValue('x', node, tensorMap, context) as Tensor4D,\n [kernelSize[1], kernelSize[2]], [stride[1], stride[2]],\n pad as 'valid' | 'same', includeBatchInIndex);\n return [result, indexes];\n }\n case 'AvgPool3D': {\n const stride =\n getParamValue('strides', node, tensorMap, context) as number[];\n const pad = getParamValue('pad', node, tensorMap, context);\n const kernelSize =\n getParamValue('kernelSize', node, tensorMap, context) as number[];\n\n return [ops.avgPool3d(\n getParamValue('x', node, tensorMap, context) as Tensor5D,\n [kernelSize[1], kernelSize[2], kernelSize[3]],\n [stride[1], stride[2], stride[3]], pad as 'valid' | 'same')];\n }\n\n case 'MaxPool3D': {\n const stride =\n getParamValue('strides', node, tensorMap, context) as number[];\n const pad = getParamValue('pad', node, tensorMap, context);\n const kernelSize =\n getParamValue('kernelSize', node, tensorMap, context) as number[];\n\n return [ops.maxPool3d(\n getParamValue('x', node, tensorMap, context) as Tensor5D,\n [kernelSize[1], kernelSize[2], kernelSize[3]],\n [stride[1], stride[2], stride[3]], pad as 'valid' | 'same')];\n }\n\n case 'Dilation2D': {\n const strides =\n getParamValue('strides', node, tensorMap, context) as number[];\n const pad = getParamValue('pad', node, tensorMap, context);\n const dilations =\n getParamValue('dilations', node, tensorMap, context) as number[];\n\n // strides: [1, stride_height, stride_width, 1].\n const strideHeight = strides[1];\n const strideWidth = strides[2];\n\n // dilations: [1, dilation_height, dilation_width, 1].\n const dilationHeight = dilations[1];\n const dilationWidth = dilations[2];\n\n return [ops.dilation2d(\n getParamValue('x', node, tensorMap, context) as Tensor3D |\n Tensor4D,\n getParamValue('filter', node, tensorMap, context) as Tensor3D,\n [strideHeight, strideWidth], pad as 'valid' | 'same',\n [dilationHeight, dilationWidth], 'NHWC' /* dataFormat */)];\n }\n\n default:\n throw TypeError(`Node type ${node.op} is not implemented`);\n }\n };\n\nexport const CATEGORY = 'convolution';\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataType, Tensor, Tensor1D} from '@tensorflow/tfjs-core';\n// tslint:disable-next-line: no-imports-from-dist\nimport * as tfOps from '@tensorflow/tfjs-core/dist/ops/ops_for_converter';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {InternalOpExecutor, Node} from '../types';\n\nimport {getParamValue} from './utils';\n\nexport const executeOp: InternalOpExecutor =\n (node: Node, tensorMap: NamedTensorsMap, context: ExecutionContext,\n ops = tfOps): Tensor[] => {\n switch (node.op) {\n case 'Fill': {\n const shape =\n getParamValue('shape', node, tensorMap, context) as number[];\n const dtype =\n getParamValue('dtype', node, tensorMap, context) as DataType;\n const value =\n getParamValue('value', node, tensorMap, context) as number;\n return [ops.fill(shape, value, dtype)];\n }\n case 'LinSpace': {\n const start =\n getParamValue('start', node, tensorMap, context) as number;\n const stop =\n getParamValue('stop', node, tensorMap, context) as number;\n const num = getParamValue('num', node, tensorMap, context) as number;\n return [ops.linspace(start, stop, num)];\n }\n case 'Multinomial': {\n const logits =\n getParamValue('logits', node, tensorMap, context) as Tensor1D;\n const numSamples =\n getParamValue('numSamples', node, tensorMap, context) as number;\n const seed =\n getParamValue('seed', node, tensorMap, context) as number;\n return [ops.multinomial(logits, numSamples, seed)];\n }\n case 'OneHot': {\n const indices =\n getParamValue('indices', node, tensorMap, context) as Tensor1D;\n const depth =\n getParamValue('depth', node, tensorMap, context) as number;\n const onValue =\n getParamValue('onValue', node, tensorMap, context) as number;\n const offValue =\n getParamValue('offValue', node, tensorMap, context) as number;\n const dtype =\n getParamValue('dtype', node, tensorMap, context) as DataType;\n return [ops.oneHot(indices, depth, onValue, offValue, dtype)];\n }\n case 'Ones': {\n return [ops.ones(\n getParamValue('shape', node, tensorMap, context) as number[],\n getParamValue('dtype', node, tensorMap, context) as DataType)];\n }\n case 'OnesLike': {\n return [ops.onesLike(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n }\n case 'RandomStandardNormal': {\n return [ops.randomStandardNormal(\n getParamValue('shape', node, tensorMap, context) as number[],\n getParamValue('dtype', node, tensorMap, context) as 'float32' |\n 'int32',\n getParamValue('seed', node, tensorMap, context) as number)];\n }\n case 'RandomUniform': {\n return [ops.randomUniform(\n // tslint:disable-next-line:no-any\n getParamValue('shape', node, tensorMap, context) as any,\n getParamValue('minval', node, tensorMap, context) as number,\n getParamValue('maxval', node, tensorMap, context) as number,\n getParamValue('dtype', node, tensorMap, context) as DataType)];\n }\n case 'Range': {\n const start =\n getParamValue('start', node, tensorMap, context) as number;\n const stop =\n getParamValue('stop', node, tensorMap, context) as number;\n const step =\n getParamValue('step', node, tensorMap, context) as number;\n return [ops.range(\n start, stop, step,\n getParamValue('dtype', node, tensorMap, context) as 'float32' |\n 'int32')];\n }\n case 'TruncatedNormal': {\n const shape =\n getParamValue('shape', node, tensorMap, context) as number[];\n const mean =\n getParamValue('mean', node, tensorMap, context) as number;\n const stdDev =\n getParamValue('stdDev', node, tensorMap, context) as number;\n const seed =\n getParamValue('seed', node, tensorMap, context) as number;\n return [ops.truncatedNormal(\n shape, mean, stdDev,\n getParamValue('dtype', node, tensorMap, context) as 'float32' |\n 'int32',\n seed)];\n }\n case 'Zeros': {\n return [ops.zeros(\n getParamValue('shape', node, tensorMap, context) as number[],\n getParamValue('dtype', node, tensorMap, context) as DataType)];\n }\n case 'ZerosLike': {\n return [ops.zerosLike(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n }\n default:\n throw TypeError(`Node type ${node.op} is not implemented`);\n }\n };\n\nexport const CATEGORY = 'creation';\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor, Tensor1D, Tensor2D} from '@tensorflow/tfjs-core';\n// tslint:disable-next-line: no-imports-from-dist\nimport * as tfOps from '@tensorflow/tfjs-core/dist/ops/ops_for_converter';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport { ResourceManager } from '../../executor/resource_manager';\nimport {InternalOpAsyncExecutor, Node} from '../types';\n\nimport {getParamValue} from './utils';\n\nfunction nmsParams(\n node: Node, tensorMap: NamedTensorsMap, context: ExecutionContext) {\n const boxes = getParamValue('boxes', node, tensorMap, context) as Tensor;\n const scores = getParamValue('scores', node, tensorMap, context) as Tensor;\n const maxOutputSize =\n getParamValue('maxOutputSize', node, tensorMap, context) as number;\n const iouThreshold =\n getParamValue('iouThreshold', node, tensorMap, context) as number;\n const scoreThreshold =\n getParamValue('scoreThreshold', node, tensorMap, context) as number;\n const softNmsSigma =\n getParamValue('softNmsSigma', node, tensorMap, context) as number;\n\n return {\n boxes,\n scores,\n maxOutputSize,\n iouThreshold,\n scoreThreshold,\n softNmsSigma\n };\n}\n\nexport const executeOp: InternalOpAsyncExecutor = async(\n node: Node, tensorMap: NamedTensorsMap,\n context: ExecutionContext, resourceManager: ResourceManager,\n ops = tfOps): Promise => {\n switch (node.op) {\n case 'NonMaxSuppressionV5': {\n const {\n boxes,\n scores,\n maxOutputSize,\n iouThreshold,\n scoreThreshold,\n softNmsSigma\n } = nmsParams(node, tensorMap, context);\n\n const result = await ops.image.nonMaxSuppressionWithScoreAsync(\n boxes as Tensor2D, scores as Tensor1D, maxOutputSize, iouThreshold,\n scoreThreshold, softNmsSigma);\n\n return [result.selectedIndices, result.selectedScores];\n }\n case 'NonMaxSuppressionV4': {\n const {boxes, scores, maxOutputSize, iouThreshold, scoreThreshold} =\n nmsParams(node, tensorMap, context);\n\n const padToMaxOutputSize =\n getParamValue('padToMaxOutputSize', node, tensorMap, context) as\n boolean;\n\n const result = await ops.image.nonMaxSuppressionPaddedAsync(\n boxes as Tensor2D, scores as Tensor1D, maxOutputSize, iouThreshold,\n scoreThreshold, padToMaxOutputSize);\n\n return [result.selectedIndices, result.validOutputs];\n }\n case 'NonMaxSuppressionV3':\n case 'NonMaxSuppressionV2': {\n const {boxes, scores, maxOutputSize, iouThreshold, scoreThreshold} =\n nmsParams(node, tensorMap, context);\n\n return [await ops.image.nonMaxSuppressionAsync(\n boxes as Tensor2D, scores as Tensor1D, maxOutputSize, iouThreshold,\n scoreThreshold)];\n }\n case 'Where': {\n const condition = ops.cast(\n (getParamValue('condition', node, tensorMap, context) as Tensor),\n 'bool');\n const result = [await ops.whereAsync(condition)];\n condition.dispose();\n return result;\n }\n case 'ListDiff': {\n return ops.setdiff1dAsync(\n getParamValue('x', node, tensorMap, context) as Tensor,\n getParamValue('y', node, tensorMap, context) as Tensor);\n }\n default:\n throw TypeError(`Node type ${node.op} is not implemented`);\n }\n};\n\nexport const CATEGORY = 'dynamic';\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '@tensorflow/tfjs-core';\n// tslint:disable-next-line: no-imports-from-dist\nimport * as tfOps from '@tensorflow/tfjs-core/dist/ops/ops_for_converter';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {InternalOpExecutor, Node} from '../types';\n\nimport {getParamValue} from './utils';\n\nexport const executeOp: InternalOpExecutor =\n (node: Node, tensorMap: NamedTensorsMap, context: ExecutionContext,\n ops = tfOps):\n Tensor[] => {\n switch (node.op) {\n case 'LowerBound': {\n const sortedSequence =\n getParamValue('sortedSequence', node, tensorMap, context) as\n Tensor;\n const values =\n getParamValue('values', node, tensorMap, context) as Tensor;\n return [ops.lowerBound(sortedSequence, values)];\n }\n case 'TopKV2': {\n const x = getParamValue('x', node, tensorMap, context) as Tensor;\n const k = getParamValue('k', node, tensorMap, context) as number;\n const sorted =\n getParamValue('sorted', node, tensorMap, context) as boolean;\n const result = ops.topk(x, k, sorted);\n return [result.values, result.indices];\n }\n case 'UpperBound': {\n const sortedSequence =\n getParamValue('sortedSequence', node, tensorMap, context) as\n Tensor;\n const values =\n getParamValue('values', node, tensorMap, context) as Tensor;\n return [ops.upperBound(sortedSequence, values)];\n }\n case 'Unique': {\n const x = getParamValue('x', node, tensorMap, context) as Tensor;\n const result = ops.unique(x);\n return [result.values, result.indices];\n }\n case 'UniqueV2': {\n const x = getParamValue('x', node, tensorMap, context) as Tensor;\n const axis =\n getParamValue('axis', node, tensorMap, context) as number;\n const result = ops.unique(x, axis);\n return [result.values, result.indices];\n }\n default:\n throw TypeError(`Node type ${node.op} is not implemented`);\n }\n };\n\nexport const CATEGORY = 'evaluation';\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '@tensorflow/tfjs-core';\n// tslint:disable-next-line: no-imports-from-dist\nimport * as tfOps from '@tensorflow/tfjs-core/dist/ops/ops_for_converter';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {InternalOpExecutor, Node} from '../types';\n\nimport {cloneTensor, getParamValue, getTensor} from './utils';\n\nexport const executeOp: InternalOpExecutor =\n (node: Node, tensorMap: NamedTensorsMap,\n context: ExecutionContext, ops = tfOps): Tensor[] => {\n switch (node.op) {\n case 'Const': {\n return tensorMap[node.name];\n }\n case 'PlaceholderWithDefault':\n const def =\n getParamValue('default', node, tensorMap, context) as Tensor;\n return [getTensor(node.name, tensorMap, context) || def];\n case 'Placeholder':\n return [getTensor(node.name, tensorMap, context)];\n case 'Identity':\n case 'StopGradient':\n case 'FakeQuantWithMinMaxVars': { // This op is currently ignored.\n const data = getParamValue('x', node, tensorMap, context) as Tensor;\n return [cloneTensor(data)];\n }\n case 'IdentityN':\n return (getParamValue('x', node, tensorMap, context) as Tensor[])\n .map((t: Tensor) => cloneTensor(t));\n case 'Snapshot':\n const snapshot =\n (getParamValue('x', node, tensorMap, context) as Tensor);\n return [cloneTensor(snapshot)];\n case 'Shape':\n return [ops.tensor1d(\n (getParamValue('x', node, tensorMap, context) as Tensor).shape,\n 'int32')];\n case 'ShapeN':\n return (getParamValue('x', node, tensorMap, context) as Tensor[])\n .map((t: Tensor) => ops.tensor1d(t.shape));\n case 'Size':\n return [ops.scalar(\n (getParamValue('x', node, tensorMap, context) as Tensor).size,\n 'int32')];\n case 'Rank':\n return [ops.scalar(\n (getParamValue('x', node, tensorMap, context) as Tensor).rank,\n 'int32')];\n case 'NoOp':\n return [ops.scalar(1)];\n case 'Print':\n const input = getParamValue('x', node, tensorMap, context) as Tensor;\n const data =\n getParamValue('data', node, tensorMap, context) as Tensor[];\n const message =\n getParamValue('message', node, tensorMap, context) as string;\n const summarize =\n getParamValue('summarize', node, tensorMap, context) as number;\n console.warn(\n 'The graph has a tf.print() operation,' +\n 'usually used for debugging, which slows down performance.');\n console.log(message);\n for (let i = 0; i < data.length; i++) {\n console.log(Array.prototype.slice.call(data[i].dataSync())\n .slice(0, summarize));\n }\n return [input];\n\n default:\n throw TypeError(`Node type ${node.op} is not implemented`);\n }\n };\n\nexport const CATEGORY = 'graph';\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {DataType, keep, scalar, stack, Tensor, tidy, unstack, util} from '@tensorflow/tfjs-core';\n// tslint:disable-next-line: no-imports-from-dist\nimport * as tfOps from '@tensorflow/tfjs-core/dist/ops/ops_for_converter';\n\n/**\n * Hashtable contains a set of tensors, which can be accessed by key.\n */\nexport class HashTable {\n readonly handle: Tensor;\n\n // tslint:disable-next-line: no-any\n private tensorMap: Map;\n\n get id() {\n return this.handle.id;\n }\n\n /**\n * Constructor of HashTable. Creates a hash table.\n *\n * @param keyDType `dtype` of the table keys.\n * @param valueDType `dtype` of the table values.\n */\n constructor(readonly keyDType: DataType, readonly valueDType: DataType) {\n this.handle = scalar(0);\n // tslint:disable-next-line: no-any\n this.tensorMap = new Map();\n\n keep(this.handle);\n }\n\n /**\n * Dispose the tensors and handle and clear the hashtable.\n */\n clearAndClose() {\n this.tensorMap.forEach(value => value.dispose());\n this.tensorMap.clear();\n this.handle.dispose();\n }\n\n /**\n * The number of items in the hash table.\n */\n size(): number {\n return this.tensorMap.size;\n }\n\n /**\n * The number of items in the hash table as a rank-0 tensor.\n */\n tensorSize(): Tensor {\n return tfOps.scalar(this.size(), 'int32');\n }\n\n /**\n * Replaces the contents of the table with the specified keys and values.\n * @param keys Keys to store in the hashtable.\n * @param values Values to store in the hashtable.\n */\n async import(keys: Tensor, values: Tensor): Promise {\n this.checkKeyAndValueTensor(keys, values);\n\n // We only store the primitive values of the keys, this allows lookup\n // to be O(1).\n const $keys = await keys.data();\n\n // Clear the hashTable before inserting new values.\n this.tensorMap.forEach(value => value.dispose());\n this.tensorMap.clear();\n\n return tidy(() => {\n const $values = unstack(values);\n\n const keysLength = $keys.length;\n const valuesLength = $values.length;\n\n util.assert(\n keysLength === valuesLength,\n () => `The number of elements doesn't match, keys has ` +\n `${keysLength} elements, the values has ${valuesLength} ` +\n `elements.`);\n\n for (let i = 0; i < keysLength; i++) {\n const key = $keys[i];\n const value = $values[i];\n\n keep(value);\n this.tensorMap.set(key, value);\n }\n\n return this.handle;\n });\n }\n\n /**\n * Looks up keys in a hash table, outputs the corresponding values.\n *\n * Performs batch lookups, for every element in the key tensor, `find`\n * stacks the corresponding value into the return tensor.\n *\n * If an element is not present in the table, the given `defaultValue` is\n * used.\n *\n * @param keys Keys to look up. Must have the same type as the keys of the\n * table.\n * @param defaultValue The scalar `defaultValue` is the value output for keys\n * not present in the table. It must also be of the same type as the\n * table values.\n */\n async find(keys: Tensor, defaultValue: Tensor): Promise {\n this.checkKeyAndValueTensor(keys, defaultValue);\n\n const $keys = await keys.data();\n\n return tidy(() => {\n const result: Tensor[] = [];\n\n for (let i = 0; i < $keys.length; i++) {\n const key = $keys[i];\n\n const value = this.findWithDefault(key, defaultValue);\n result.push(value);\n }\n\n return stack(result);\n });\n }\n\n // tslint:disable-next-line: no-any\n private findWithDefault(key: any, defaultValue: Tensor): Tensor {\n const result = this.tensorMap.get(key);\n\n return result != null ? result : defaultValue;\n }\n\n private checkKeyAndValueTensor(key: Tensor, value: Tensor) {\n if (key.dtype !== this.keyDType) {\n throw new Error(\n `Expect key dtype ${this.keyDType}, but got ` +\n `${key.dtype}`);\n }\n\n if (value.dtype !== this.valueDType) {\n throw new Error(\n `Expect value dtype ${this.valueDType}, but got ` +\n `${value.dtype}`);\n }\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataType, Tensor} from '@tensorflow/tfjs-core';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {HashTable} from '../../executor/hash_table';\nimport {ResourceManager} from '../../executor/resource_manager';\nimport {InternalOpAsyncExecutor, Node} from '../types';\n\nimport {getParamValue} from './utils';\n\nexport const executeOp: InternalOpAsyncExecutor = async(\n node: Node, tensorMap: NamedTensorsMap, context: ExecutionContext,\n resourceManager: ResourceManager): Promise => {\n switch (node.op) {\n case 'HashTable':\n case 'HashTableV2': {\n const existingTableHandle =\n resourceManager.getHashTableHandleByName(node.name);\n // Table is shared with initializer.\n if (existingTableHandle != null) {\n return [existingTableHandle];\n } else {\n const keyDType =\n getParamValue('keyDType', node, tensorMap, context) as DataType;\n const valueDType =\n getParamValue('valueDType', node, tensorMap, context) as DataType;\n\n const hashTable = new HashTable(keyDType, valueDType);\n resourceManager.addHashTable(node.name, hashTable);\n return [hashTable.handle];\n }\n }\n case 'LookupTableImport':\n case 'LookupTableImportV2': {\n const handle = getParamValue(\n 'tableHandle', node, tensorMap, context,\n resourceManager) as Tensor;\n const keys = getParamValue('keys', node, tensorMap, context) as Tensor;\n const values =\n getParamValue('values', node, tensorMap, context) as Tensor;\n\n const hashTable = resourceManager.getHashTableById(handle.id);\n\n return [await hashTable.import(keys, values)];\n }\n case 'LookupTableFind':\n case 'LookupTableFindV2': {\n const handle = getParamValue(\n 'tableHandle', node, tensorMap, context,\n resourceManager) as Tensor;\n const keys = getParamValue('keys', node, tensorMap, context) as Tensor;\n const defaultValue =\n getParamValue('defaultValue', node, tensorMap, context) as Tensor;\n\n const hashTable = resourceManager.getHashTableById(handle.id);\n return [await hashTable.find(keys, defaultValue)];\n }\n case 'LookupTableSize':\n case 'LookupTableSizeV2': {\n const handle = getParamValue(\n 'tableHandle', node, tensorMap, context,\n resourceManager) as Tensor;\n\n const hashTable = resourceManager.getHashTableById(handle.id);\n return [hashTable.tensorSize()];\n }\n default:\n throw TypeError(`Node type ${node.op} is not implemented`);\n }\n};\n\nexport const CATEGORY = 'hash_table';\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor, Tensor1D, Tensor2D, Tensor3D, Tensor4D} from '@tensorflow/tfjs-core';\n// tslint:disable-next-line: no-imports-from-dist\nimport * as tfOps from '@tensorflow/tfjs-core/dist/ops/ops_for_converter';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {InternalOpExecutor, Node} from '../types';\n\nimport {getParamValue} from './utils';\n\nexport const executeOp: InternalOpExecutor =\n (node: Node, tensorMap: NamedTensorsMap,\n context: ExecutionContext, ops = tfOps): Tensor[] => {\n switch (node.op) {\n case 'ResizeBilinear': {\n const images =\n getParamValue('images', node, tensorMap, context) as Tensor;\n const size =\n getParamValue('size', node, tensorMap, context) as number[];\n const alignCorners =\n getParamValue('alignCorners', node, tensorMap, context) as\n boolean;\n const halfPixelCenters =\n getParamValue('halfPixelCenters', node, tensorMap, context) as\n boolean;\n return [ops.image.resizeBilinear(\n images as Tensor3D | Tensor4D, [size[0], size[1]], alignCorners,\n halfPixelCenters)];\n }\n case 'ResizeNearestNeighbor': {\n const images =\n getParamValue('images', node, tensorMap, context) as Tensor;\n const size =\n getParamValue('size', node, tensorMap, context) as number[];\n const alignCorners =\n getParamValue('alignCorners', node, tensorMap, context) as\n boolean;\n const halfPixelCenters =\n getParamValue('halfPixelCenters', node, tensorMap, context) as\n boolean;\n return [ops.image.resizeNearestNeighbor(\n images as Tensor3D | Tensor4D, [size[0], size[1]], alignCorners,\n halfPixelCenters)];\n }\n case 'CropAndResize': {\n const image =\n getParamValue('image', node, tensorMap, context) as Tensor;\n const boxes =\n getParamValue('boxes', node, tensorMap, context) as Tensor;\n const boxInd =\n getParamValue('boxInd', node, tensorMap, context) as Tensor;\n const cropSize =\n getParamValue('cropSize', node, tensorMap, context) as number[];\n const method =\n getParamValue('method', node, tensorMap, context) as string;\n const extrapolationValue =\n getParamValue('extrapolationValue', node, tensorMap, context) as\n number;\n return [ops.image.cropAndResize(\n image as Tensor4D, boxes as Tensor2D, boxInd as Tensor1D,\n cropSize as [number, number], method as 'bilinear' | 'nearest',\n extrapolationValue)];\n }\n case 'ImageProjectiveTransformV3': {\n const images =\n getParamValue('images', node, tensorMap, context) as Tensor;\n const transforms =\n getParamValue('transforms', node, tensorMap, context) as Tensor;\n const outputShape =\n getParamValue('outputShape', node, tensorMap, context) as\n number[];\n const fillValue =\n getParamValue('fillValue', node, tensorMap, context) as number;\n const interpolation =\n getParamValue('interpolation', node, tensorMap, context) as\n string;\n const fillMode =\n getParamValue('fillMode', node, tensorMap, context) as string;\n return [ops.image.transform(\n images as Tensor4D,\n transforms as Tensor2D,\n interpolation.toLowerCase() as 'bilinear' | 'nearest',\n fillMode.toLowerCase() as 'constant' | 'reflect' | 'wrap' | 'nearest',\n fillValue,\n outputShape as [number, number])];\n }\n default:\n throw TypeError(`Node type ${node.op} is not implemented`);\n }\n };\n\nexport const CATEGORY = 'image';\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '@tensorflow/tfjs-core';\n// tslint:disable-next-line: no-imports-from-dist\nimport * as tfOps from '@tensorflow/tfjs-core/dist/ops/ops_for_converter';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {InternalOpExecutor, Node} from '../types';\n\nimport {getParamValue} from './utils';\n\nexport const executeOp: InternalOpExecutor =\n (node: Node, tensorMap: NamedTensorsMap,\n context: ExecutionContext, ops = tfOps): Tensor[] => {\n switch (node.op) {\n case 'Equal': {\n return [ops.equal(\n getParamValue('a', node, tensorMap, context) as Tensor,\n getParamValue('b', node, tensorMap, context) as Tensor)];\n }\n case 'NotEqual': {\n return [ops.notEqual(\n getParamValue('a', node, tensorMap, context) as Tensor,\n getParamValue('b', node, tensorMap, context) as Tensor)];\n }\n case 'Greater': {\n return [ops.greater(\n getParamValue('a', node, tensorMap, context) as Tensor,\n getParamValue('b', node, tensorMap, context) as Tensor)];\n }\n case 'GreaterEqual': {\n return [ops.greaterEqual(\n getParamValue('a', node, tensorMap, context) as Tensor,\n getParamValue('b', node, tensorMap, context) as Tensor)];\n }\n case 'Less': {\n return [ops.less(\n getParamValue('a', node, tensorMap, context) as Tensor,\n getParamValue('b', node, tensorMap, context) as Tensor)];\n }\n case 'LessEqual': {\n return [ops.lessEqual(\n getParamValue('a', node, tensorMap, context) as Tensor,\n getParamValue('b', node, tensorMap, context) as Tensor)];\n }\n case 'LogicalAnd': {\n return [ops.logicalAnd(\n getParamValue('a', node, tensorMap, context) as Tensor,\n getParamValue('b', node, tensorMap, context) as Tensor)];\n }\n case 'LogicalNot': {\n return [ops.logicalNot(\n getParamValue('a', node, tensorMap, context) as Tensor)];\n }\n case 'LogicalOr': {\n return [ops.logicalOr(\n getParamValue('a', node, tensorMap, context) as Tensor,\n getParamValue('b', node, tensorMap, context) as Tensor)];\n }\n case 'Select':\n case 'SelectV2': {\n return [ops.where(\n getParamValue('condition', node, tensorMap, context) as Tensor,\n getParamValue('a', node, tensorMap, context) as Tensor,\n getParamValue('b', node, tensorMap, context) as Tensor)];\n }\n default:\n throw TypeError(`Node type ${node.op} is not implemented`);\n }\n };\n\nexport const CATEGORY = 'logical';\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor, Tensor2D} from '@tensorflow/tfjs-core';\n// tslint:disable-next-line: no-imports-from-dist\nimport * as tfOps from '@tensorflow/tfjs-core/dist/ops/ops_for_converter';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {InternalOpExecutor, Node} from '../types';\n\nimport {getParamValue} from './utils';\n\nexport const executeOp: InternalOpExecutor =\n (node: Node, tensorMap: NamedTensorsMap,\n context: ExecutionContext, ops = tfOps): Tensor[] => {\n switch (node.op) {\n case 'BatchMatMul':\n case 'BatchMatMulV2':\n case 'MatMul':\n return [ops.matMul(\n getParamValue('a', node, tensorMap, context) as Tensor2D,\n getParamValue('b', node, tensorMap, context) as Tensor2D,\n getParamValue('transposeA', node, tensorMap, context) as boolean,\n getParamValue('transposeB', node, tensorMap, context) as\n boolean)];\n\n case 'Einsum':\n return [ops.einsum(\n getParamValue('equation', node, tensorMap, context) as string,\n ...getParamValue('tensors', node, tensorMap, context) as\n Tensor[])];\n\n case 'Transpose':\n return [ops.transpose(\n getParamValue('x', node, tensorMap, context) as Tensor,\n getParamValue('perm', node, tensorMap, context) as number[])];\n\n case '_FusedMatMul':\n const [extraOp, activationFunc] =\n (getParamValue('fusedOps', node, tensorMap, context) as string[]);\n\n const isBiasAdd = extraOp === 'biasadd';\n const isPrelu = activationFunc === 'prelu';\n\n const numArgs =\n (getParamValue('numArgs', node, tensorMap, context) as number);\n const leakyreluAlpha =\n getParamValue('leakyreluAlpha', node, tensorMap, context) as\n number;\n\n if (isBiasAdd) {\n if (isPrelu && numArgs !== 2) {\n throw new Error(\n 'Fused MatMul with BiasAdd and Prelu must have two ' +\n 'extra arguments: bias and alpha.');\n }\n if (!isPrelu && numArgs !== 1) {\n throw new Error(\n 'Fused MatMul with BiasAdd must have one extra argument: bias.');\n }\n }\n const [biasArg, preluArg] =\n getParamValue('args', node, tensorMap, context) as Tensor[];\n return [ops.fused.matMul({\n a: getParamValue('a', node, tensorMap, context) as Tensor2D,\n b: getParamValue('b', node, tensorMap, context) as Tensor2D,\n transposeA: getParamValue('transposeA', node, tensorMap, context) as\n boolean,\n transposeB: getParamValue('transposeB', node, tensorMap, context) as\n boolean,\n bias: biasArg,\n activation: activationFunc as tfOps.fused.Activation,\n preluActivationWeights: preluArg,\n leakyreluAlpha\n })];\n\n default:\n throw TypeError(`Node type ${node.op} is not implemented`);\n }\n };\n\nexport const CATEGORY = 'matrices';\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Scalar, Tensor, Tensor3D, Tensor4D} from '@tensorflow/tfjs-core';\n// tslint:disable-next-line: no-imports-from-dist\nimport * as tfOps from '@tensorflow/tfjs-core/dist/ops/ops_for_converter';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {InternalOpExecutor, Node} from '../types';\n\nimport {getParamValue} from './utils';\n\nexport const executeOp: InternalOpExecutor =\n (node: Node, tensorMap: NamedTensorsMap,\n context: ExecutionContext, ops = tfOps): Tensor[] => {\n switch (node.op) {\n case 'EuclideanNorm':\n return [ops.euclideanNorm(\n getParamValue('x', node, tensorMap, context) as Tensor,\n getParamValue('axis', node, tensorMap, context) as number[],\n getParamValue('keepDims', node, tensorMap, context) as boolean)];\n case 'FusedBatchNorm':\n case 'FusedBatchNormV2': {\n return [ops.batchNorm(\n getParamValue('x', node, tensorMap, context) as Tensor,\n getParamValue('mean', node, tensorMap, context) as Tensor,\n getParamValue('variance', node, tensorMap, context) as Tensor,\n getParamValue('offset', node, tensorMap, context) as Tensor,\n getParamValue('scale', node, tensorMap, context) as Tensor,\n getParamValue('epsilon', node, tensorMap, context) as number)];\n }\n case 'FusedBatchNormV3': {\n return [ops.batchNorm(\n getParamValue('x', node, tensorMap, context) as Tensor,\n getParamValue('mean', node, tensorMap, context) as Tensor,\n getParamValue('variance', node, tensorMap, context) as Tensor,\n getParamValue('offset', node, tensorMap, context) as Tensor,\n getParamValue('scale', node, tensorMap, context) as Tensor,\n getParamValue('epsilon', node, tensorMap, context) as number)];\n }\n case 'LRN': {\n return [ops.localResponseNormalization(\n getParamValue('x', node, tensorMap, context) as Tensor3D |\n Tensor4D,\n getParamValue('radius', node, tensorMap, context) as number,\n getParamValue('bias', node, tensorMap, context) as number,\n getParamValue('alpha', node, tensorMap, context) as number,\n getParamValue('beta', node, tensorMap, context) as number)];\n }\n case 'Softmax': {\n return [ops.softmax(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n }\n case 'LogSoftmax': {\n return [ops.logSoftmax(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n }\n case 'SparseToDense': {\n return [ops.sparseToDense(\n getParamValue('sparseIndices', node, tensorMap, context) as\n Tensor,\n getParamValue('outputShape', node, tensorMap, context) as Tensor,\n getParamValue('sparseValues', node, tensorMap, context) as\n number[],\n getParamValue('defaultValue', node, tensorMap, context) as\n Scalar)];\n }\n default:\n throw TypeError(`Node type ${node.op} is not implemented`);\n }\n };\n\nexport const CATEGORY = 'normalization';\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor, Tensor1D, Tensor2D} from '@tensorflow/tfjs-core';\n// tslint:disable-next-line: no-imports-from-dist\nimport * as tfOps from '@tensorflow/tfjs-core/dist/ops/ops_for_converter';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {InternalOpExecutor, Node} from '../types';\n\nimport {getParamValue} from './utils';\n\nexport const executeOp: InternalOpExecutor =\n (node: Node, tensorMap: NamedTensorsMap,\n context: ExecutionContext, ops = tfOps): Tensor[] => {\n switch (node.op) {\n case 'Max': {\n const axis =\n getParamValue('axis', node, tensorMap, context) as number[];\n const keepDims =\n getParamValue('keepDims', node, tensorMap, context) as boolean;\n return [ops.max(\n getParamValue('x', node, tensorMap, context) as Tensor, axis,\n keepDims)];\n }\n case 'Mean': {\n const axis =\n getParamValue('axis', node, tensorMap, context) as number[];\n const keepDims =\n getParamValue('keepDims', node, tensorMap, context) as boolean;\n return [ops.mean(\n getParamValue('x', node, tensorMap, context) as Tensor, axis,\n keepDims)];\n }\n case 'Min': {\n const axis =\n getParamValue('axis', node, tensorMap, context) as number[];\n const keepDims =\n getParamValue('keepDims', node, tensorMap, context) as boolean;\n return [ops.min(\n getParamValue('x', node, tensorMap, context) as Tensor, axis,\n keepDims)];\n }\n case 'Sum': {\n const axis =\n getParamValue('axis', node, tensorMap, context) as number[];\n const keepDims =\n getParamValue('keepDims', node, tensorMap, context) as boolean;\n return [ops.sum(\n getParamValue('x', node, tensorMap, context) as Tensor, axis,\n keepDims)];\n }\n case 'All': {\n const axis =\n getParamValue('axis', node, tensorMap, context) as number[];\n const keepDims =\n getParamValue('keepDims', node, tensorMap, context) as boolean;\n return [ops.all(\n getParamValue('x', node, tensorMap, context) as Tensor, axis,\n keepDims)];\n }\n case 'Any': {\n const axis =\n getParamValue('axis', node, tensorMap, context) as number[];\n const keepDims =\n getParamValue('keepDims', node, tensorMap, context) as boolean;\n return [ops.any(\n getParamValue('x', node, tensorMap, context) as Tensor, axis,\n keepDims)];\n }\n case 'ArgMax': {\n const axis =\n getParamValue('axis', node, tensorMap, context) as number;\n return [ops.argMax(\n getParamValue('x', node, tensorMap, context) as Tensor, axis)];\n }\n case 'ArgMin': {\n const axis =\n getParamValue('axis', node, tensorMap, context) as number;\n return [ops.argMin(\n getParamValue('x', node, tensorMap, context) as Tensor, axis)];\n }\n case 'Prod': {\n const axis =\n getParamValue('axis', node, tensorMap, context) as number[];\n const keepDims =\n getParamValue('keepDims', node, tensorMap, context) as boolean;\n return [ops.prod(\n getParamValue('x', node, tensorMap, context) as Tensor, axis,\n keepDims)];\n }\n case 'Cumprod': {\n const axis =\n getParamValue('axis', node, tensorMap, context) as number;\n const exclusive =\n getParamValue('exclusive', node, tensorMap, context) as boolean;\n const reverse =\n getParamValue('reverse', node, tensorMap, context) as boolean;\n return [ops.cumprod(\n getParamValue('x', node, tensorMap, context) as Tensor, axis,\n exclusive, reverse)];\n }\n case 'Cumsum': {\n const axis =\n getParamValue('axis', node, tensorMap, context) as number;\n const exclusive =\n getParamValue('exclusive', node, tensorMap, context) as boolean;\n const reverse =\n getParamValue('reverse', node, tensorMap, context) as boolean;\n return [ops.cumsum(\n getParamValue('x', node, tensorMap, context) as Tensor, axis,\n exclusive, reverse)];\n }\n case 'Bincount':\n const x = getParamValue('x', node, tensorMap, context) as Tensor1D;\n const weights =\n getParamValue('weights', node, tensorMap, context) as Tensor1D;\n const size =\n getParamValue('size', node, tensorMap, context) as number;\n\n return [ops.bincount(x, weights, size)];\n case 'DenseBincount': {\n const x = getParamValue('x', node, tensorMap, context) as Tensor1D |\n Tensor2D;\n const weights =\n getParamValue('weights', node, tensorMap, context) as Tensor1D |\n Tensor2D;\n const size =\n getParamValue('size', node, tensorMap, context) as number;\n\n const binaryOutput =\n getParamValue('binaryOutput', node, tensorMap, context) as\n boolean;\n\n return [ops.denseBincount(x, weights, size, binaryOutput)];\n }\n default:\n throw TypeError(`Node type ${node.op} is not implemented`);\n }\n };\n\nexport const CATEGORY = 'reduction';\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Scalar, Tensor, Tensor1D, tidy, util} from '@tensorflow/tfjs-core';\n// tslint:disable-next-line: no-imports-from-dist\nimport * as tfOps from '@tensorflow/tfjs-core/dist/ops/ops_for_converter';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {InternalOpExecutor, Node} from '../types';\n\nimport {getParamValue} from './utils';\n\nexport const executeOp: InternalOpExecutor =\n (node: Node, tensorMap: NamedTensorsMap,\n context: ExecutionContext, ops = tfOps): Tensor[] => {\n switch (node.op) {\n case 'ConcatV2':\n case 'Concat': {\n const n = getParamValue('n', node, tensorMap, context) as number;\n const axis =\n getParamValue('axis', node, tensorMap, context) as number;\n let inputs =\n getParamValue('tensors', node, tensorMap, context) as Tensor[];\n inputs = inputs.slice(0, n);\n return [ops.concat(inputs, axis)];\n }\n case 'Gather': {\n const input = getParamValue('x', node, tensorMap, context) as Tensor;\n const indices =\n getParamValue('indices', node, tensorMap, context) as Tensor1D;\n return [ops.gather(input, ops.cast(indices, 'int32'), 0)];\n }\n case 'GatherV2': {\n const axis =\n getParamValue('axis', node, tensorMap, context) as number;\n const batchDims =\n getParamValue('batchDims', node, tensorMap, context) as number;\n const input = getParamValue('x', node, tensorMap, context) as Tensor;\n const indices =\n getParamValue('indices', node, tensorMap, context) as Tensor1D;\n return [ops.gather(\n input, ops.cast(indices, 'int32'), axis, batchDims)];\n }\n case 'Reverse': {\n const dims =\n getParamValue('dims', node, tensorMap, context) as boolean[];\n const axis = [];\n for (let i = 0; i < dims.length; i++) {\n if (dims[i]) {\n axis.push(i);\n }\n }\n const input = getParamValue('x', node, tensorMap, context) as Tensor;\n return [ops.reverse(input, axis)];\n }\n case 'ReverseV2': {\n const axis =\n getParamValue('axis', node, tensorMap, context) as number[];\n const input = getParamValue('x', node, tensorMap, context) as Tensor;\n return [ops.reverse(input, axis)];\n }\n case 'Slice': {\n // tslint:disable-next-line:no-any\n const begin = getParamValue('begin', node, tensorMap, context) as any;\n // tslint:disable-next-line:no-any\n const size = getParamValue('size', node, tensorMap, context) as any;\n return [ops.slice(\n getParamValue('x', node, tensorMap, context) as Tensor, begin,\n size)];\n }\n case 'StridedSlice': {\n const begin =\n getParamValue('begin', node, tensorMap, context) as number[];\n const end =\n getParamValue('end', node, tensorMap, context) as number[];\n const strides =\n getParamValue('strides', node, tensorMap, context) as number[];\n const beginMask =\n getParamValue('beginMask', node, tensorMap, context) as number;\n const endMask =\n getParamValue('endMask', node, tensorMap, context) as number;\n const ellipsisMask =\n getParamValue('ellipsisMask', node, tensorMap, context) as number;\n const newAxisMask =\n getParamValue('newAxisMask', node, tensorMap, context) as number;\n const shrinkAxisMask =\n getParamValue('shrinkAxisMask', node, tensorMap, context) as\n number;\n const tensor = getParamValue('x', node, tensorMap, context) as Tensor;\n\n return [ops.stridedSlice(\n tensor, begin, end, strides, beginMask, endMask, ellipsisMask,\n newAxisMask, shrinkAxisMask)];\n }\n case 'Pack': {\n return tidy(() => {\n const axis =\n getParamValue('axis', node, tensorMap, context) as number;\n const tensors =\n getParamValue('tensors', node, tensorMap, context) as Tensor[];\n // Reshape the tensors to the first tensor's shape if they don't\n // match.\n const shape = tensors[0].shape;\n const squeezedShape = ops.squeeze(tensors[0]).shape;\n const mapped = tensors.map(tensor => {\n const sameShape = util.arraysEqual(tensor.shape, shape);\n if (!sameShape &&\n !util.arraysEqual(\n ops.squeeze(tensor).shape, squeezedShape)) {\n throw new Error('the input tensors shape does not match');\n }\n return sameShape ? tensor : ops.reshape(tensor, shape);\n });\n return [ops.stack(mapped, axis)];\n });\n }\n case 'Unpack': {\n const axis =\n getParamValue('axis', node, tensorMap, context) as number;\n const tensor =\n getParamValue('tensor', node, tensorMap, context) as Tensor;\n return ops.unstack(tensor, axis);\n }\n case 'Tile': {\n const reps =\n getParamValue('reps', node, tensorMap, context) as number[];\n return [ops.tile(\n getParamValue('x', node, tensorMap, context) as Tensor, reps)];\n }\n case 'Split':\n case 'SplitV': {\n const axis =\n getParamValue('axis', node, tensorMap, context) as number;\n const numOrSizeSplits =\n getParamValue('numOrSizeSplits', node, tensorMap, context) as\n number |\n number[];\n const tensor = getParamValue('x', node, tensorMap, context) as Tensor;\n\n return ops.split(tensor, numOrSizeSplits, axis);\n }\n case 'ScatterNd': {\n const indices =\n getParamValue('indices', node, tensorMap, context) as Tensor;\n const values =\n getParamValue('values', node, tensorMap, context) as Tensor;\n const shape =\n getParamValue('shape', node, tensorMap, context) as number[];\n return [ops.scatterND(indices, values, shape)];\n }\n case 'GatherNd': {\n const x = getParamValue('x', node, tensorMap, context) as Tensor;\n const indices =\n getParamValue('indices', node, tensorMap, context) as Tensor;\n return [ops.gatherND(x, indices)];\n }\n case 'SparseToDense': {\n const indices =\n getParamValue('sparseIndices', node, tensorMap, context) as\n Tensor;\n const shape =\n getParamValue('outputShape', node, tensorMap, context) as\n number[];\n const sparseValues =\n getParamValue('sparseValues', node, tensorMap, context) as Tensor;\n const defaultValue =\n getParamValue('defaultValue', node, tensorMap, context) as Scalar;\n return [ops.sparseToDense(\n indices, sparseValues, shape,\n sparseValues.dtype === defaultValue.dtype ?\n defaultValue :\n ops.cast(defaultValue, sparseValues.dtype))];\n }\n default:\n throw TypeError(`Node type ${node.op} is not implemented`);\n }\n };\n\nexport const CATEGORY = 'slice_join';\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Scalar, Tensor, Tensor1D, Tensor2D} from '@tensorflow/tfjs-core';\n// tslint:disable-next-line: no-imports-from-dist\nimport * as tfOps from '@tensorflow/tfjs-core/dist/ops/ops_for_converter';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {InternalOpExecutor, Node} from '../types';\n\nimport {getParamValue} from './utils';\n\nexport const executeOp: InternalOpExecutor =\n (node: Node, tensorMap: NamedTensorsMap,\n context: ExecutionContext, ops = tfOps): Tensor[] => {\n switch (node.op) {\n case 'SparseFillEmptyRows': {\n const {\n outputIndices,\n outputValues,\n emptyRowIndicator,\n reverseIndexMap\n } =\n ops.sparse.sparseFillEmptyRows(\n getParamValue('indices', node, tensorMap, context) as\n Tensor2D,\n getParamValue('values', node, tensorMap, context) as Tensor1D,\n getParamValue('denseShape', node, tensorMap, context) as\n Tensor1D,\n getParamValue('defaultValue', node, tensorMap, context) as\n Scalar);\n return [\n outputIndices, outputValues, emptyRowIndicator, reverseIndexMap\n ];\n }\n case 'SparseReshape': {\n const {outputIndices, outputShape} = ops.sparse.sparseReshape(\n getParamValue('inputIndices', node, tensorMap, context) as\n Tensor2D,\n getParamValue('inputShape', node, tensorMap, context) as Tensor1D,\n getParamValue('newShape', node, tensorMap, context) as Tensor1D);\n return [outputIndices, outputShape];\n }\n case 'SparseSegmentMean': {\n const outputData = ops.sparse.sparseSegmentMean(\n getParamValue('data', node, tensorMap, context) as Tensor,\n getParamValue('indices', node, tensorMap, context) as Tensor1D,\n getParamValue('segmentIds', node, tensorMap, context) as\n Tensor1D);\n return [outputData];\n }\n case 'SparseSegmentSum': {\n const outputData = ops.sparse.sparseSegmentSum(\n getParamValue('data', node, tensorMap, context) as Tensor,\n getParamValue('indices', node, tensorMap, context) as Tensor1D,\n getParamValue('segmentIds', node, tensorMap, context) as\n Tensor1D);\n return [outputData];\n }\n default:\n throw TypeError(`Node type ${node.op} is not implemented`);\n }\n };\n\nexport const CATEGORY = 'sparse';\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor} from '@tensorflow/tfjs-core';\n// tslint:disable-next-line: no-imports-from-dist\nimport * as tfOps from '@tensorflow/tfjs-core/dist/ops/ops_for_converter';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {InternalOpExecutor, Node} from '../types';\n\nimport {getParamValue} from './utils';\n\nexport const executeOp: InternalOpExecutor =\n (node: Node, tensorMap: NamedTensorsMap, context: ExecutionContext,\n ops = tfOps): Tensor[] => {\n switch (node.op) {\n case 'FFT': {\n return [ops.fft(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n }\n case 'IFFT': {\n return [ops.ifft(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n }\n case 'RFFT': {\n return [ops.rfft(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n }\n case 'IRFFT': {\n return [ops.irfft(\n getParamValue('x', node, tensorMap, context) as Tensor)];\n }\n default:\n throw TypeError(`Node type ${node.op} is not implemented`);\n }\n };\n\nexport const CATEGORY = 'spectral';\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Scalar, Tensor, Tensor1D} from '@tensorflow/tfjs-core';\n// tslint:disable-next-line: no-imports-from-dist\nimport * as tfOps from '@tensorflow/tfjs-core/dist/ops/ops_for_converter';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {InternalOpExecutor, Node} from '../types';\n\nimport {getParamValue} from './utils';\n\nexport const executeOp: InternalOpExecutor =\n (node: Node, tensorMap: NamedTensorsMap,\n context: ExecutionContext, ops = tfOps): Tensor[] => {\n switch (node.op) {\n case 'StringNGrams': {\n const {nGrams, nGramsSplits} = ops.string.stringNGrams(\n getParamValue('data', node, tensorMap, context) as Tensor1D,\n getParamValue('dataSplits', node, tensorMap, context) as Tensor,\n getParamValue('separator', node, tensorMap, context) as string,\n getParamValue('nGramWidths', node, tensorMap, context) as\n number[],\n getParamValue('leftPad', node, tensorMap, context) as string,\n getParamValue('rightPad', node, tensorMap, context) as string,\n getParamValue('padWidth', node, tensorMap, context) as number,\n getParamValue(\n 'preserveShortSequences', node, tensorMap, context) as\n boolean);\n return [nGrams, nGramsSplits];\n }\n case 'StringSplit': {\n const {indices, values, shape} = ops.string.stringSplit(\n getParamValue('input', node, tensorMap, context) as Tensor1D,\n getParamValue('delimiter', node, tensorMap, context) as Scalar,\n getParamValue('skipEmpty', node, tensorMap, context) as boolean);\n return [indices, values, shape];\n }\n case 'StringToHashBucketFast': {\n const output = ops.string.stringToHashBucketFast(\n getParamValue('input', node, tensorMap, context) as Tensor,\n getParamValue('numBuckets', node, tensorMap, context) as number);\n return [output];\n }\n default:\n throw TypeError(`Node type ${node.op} is not implemented`);\n }\n };\n\nexport const CATEGORY = 'string';\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {Tensor, Tensor4D} from '@tensorflow/tfjs-core';\n// tslint:disable-next-line: no-imports-from-dist\nimport * as tfOps from '@tensorflow/tfjs-core/dist/ops/ops_for_converter';\n\nimport {NamedTensorsMap} from '../../data/types';\nimport {ExecutionContext} from '../../executor/execution_context';\nimport {InternalOpExecutor, Node} from '../types';\n\nimport {getParamValue} from './utils';\n\nexport const executeOp: InternalOpExecutor =\n (node: Node, tensorMap: NamedTensorsMap,\n context: ExecutionContext, ops = tfOps): Tensor[] => {\n switch (node.op) {\n case 'Cast': {\n return [ops.cast(\n getParamValue('x', node, tensorMap, context) as Tensor,\n getParamValue('dtype', node, tensorMap, context) as 'int32' |\n 'float32' | 'bool')];\n }\n case 'ExpandDims': {\n const axis =\n getParamValue('axis', node, tensorMap, context) as number;\n return [ops.expandDims(\n getParamValue('x', node, tensorMap, context) as Tensor, axis)];\n }\n case 'Squeeze': {\n const axis =\n getParamValue('axis', node, tensorMap, context) as number[];\n return [ops.squeeze(\n getParamValue('x', node, tensorMap, context) as Tensor, axis)];\n }\n\n case 'Reshape': {\n return [ops.reshape(\n getParamValue('x', node, tensorMap, context) as Tensor,\n getParamValue('shape', node, tensorMap, context) as number[])];\n }\n case 'MirrorPad': {\n return [ops.mirrorPad(\n getParamValue('x', node, tensorMap, context) as Tensor,\n getParamValue('padding', node, tensorMap, context) as\n Array<[number, number]>,\n getParamValue('mode', node, tensorMap, context) as 'reflect' |\n 'symmetric')];\n }\n case 'PadV2':\n case 'Pad': {\n return [ops.pad(\n getParamValue('x', node, tensorMap, context) as Tensor,\n getParamValue('padding', node, tensorMap, context) as\n Array<[number, number]>,\n getParamValue('constantValue', node, tensorMap, context) as\n number)];\n }\n case 'SpaceToBatchND': {\n const blockShape =\n getParamValue('blockShape', node, tensorMap, context) as number[];\n const paddings =\n getParamValue('paddings', node, tensorMap, context) as number[][];\n return [ops.spaceToBatchND(\n getParamValue('x', node, tensorMap, context) as Tensor,\n blockShape, paddings)];\n }\n case 'BatchToSpaceND': {\n const blockShape =\n getParamValue('blockShape', node, tensorMap, context) as number[];\n const crops =\n getParamValue('crops', node, tensorMap, context) as number[][];\n return [ops.batchToSpaceND(\n getParamValue('x', node, tensorMap, context) as Tensor,\n blockShape, crops)];\n }\n case 'DepthToSpace': {\n const blockSize =\n getParamValue('blockSize', node, tensorMap, context) as number;\n const dataFormat =\n (getParamValue('dataFormat', node, tensorMap, context) as\n string).toUpperCase() as 'NHWC' |\n 'NCHW';\n return [ops.depthToSpace(\n getParamValue('x', node, tensorMap, context) as Tensor4D,\n blockSize, dataFormat)];\n }\n case 'BroadcastTo': {\n return [ops.broadcastTo(\n getParamValue('x', node, tensorMap, context) as Tensor,\n getParamValue('shape', node, tensorMap, context) as number[])];\n }\n case 'BroadcastArgs': {\n return [ops.broadcastArgs(\n getParamValue('s0', node, tensorMap, context) as Tensor,\n getParamValue('s1', node, tensorMap, context) as Tensor)];\n }\n default:\n throw TypeError(`Node type ${node.op} is not implemented`);\n }\n };\n\nexport const CATEGORY = 'transformation';\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport * as tfc from '@tensorflow/tfjs-core';\n\nimport {NamedTensorsMap} from '../data/types';\nimport {ExecutionContext} from '../executor/execution_context';\nimport {ResourceManager} from '../executor/resource_manager';\n\nimport {NodeValueImpl} from './custom_op/node_value_impl';\nimport {getRegisteredOp} from './custom_op/register';\nimport * as arithmetic from './executors/arithmetic_executor';\nimport * as basicMath from './executors/basic_math_executor';\nimport * as control from './executors/control_executor';\nimport * as convolution from './executors/convolution_executor';\nimport * as creation from './executors/creation_executor';\nimport * as dynamic from './executors/dynamic_executor';\nimport * as evaluation from './executors/evaluation_executor';\nimport * as graph from './executors/graph_executor';\nimport * as hashTable from './executors/hash_table_executor';\nimport * as image from './executors/image_executor';\nimport * as logical from './executors/logical_executor';\nimport * as matrices from './executors/matrices_executor';\nimport * as normalization from './executors/normalization_executor';\nimport * as reduction from './executors/reduction_executor';\nimport * as sliceJoin from './executors/slice_join_executor';\nimport * as sparse from './executors/sparse_executor';\nimport * as spectral from './executors/spectral_executor';\nimport * as string from './executors/string_executor';\nimport * as transformation from './executors/transformation_executor';\nimport {Node} from './types';\n\n/**\n * Executes the op defined by the node object.\n * @param node\n * @param tensorMap contains tensors for executed nodes and weights\n * @param context contains tensors and information for running the current node.\n * @param resourceManager Optional. Contains global resources of the model.\n */\nexport function executeOp(\n node: Node, tensorMap: NamedTensorsMap, context: ExecutionContext,\n resourceManager?: ResourceManager, tidy = tfc.tidy): tfc.Tensor[]|\n Promise {\n const value =\n ((node: Node, tensorMap: NamedTensorsMap, context: ExecutionContext) => {\n switch (node.category) {\n case 'arithmetic':\n return tidy(() => arithmetic.executeOp(node, tensorMap, context));\n case 'basic_math':\n return tidy(() => basicMath.executeOp(node, tensorMap, context));\n case 'control':\n return control.executeOp(node, tensorMap, context);\n case 'convolution':\n return tidy(() => convolution.executeOp(node, tensorMap, context));\n case 'creation':\n return tidy(() => creation.executeOp(node, tensorMap, context));\n case 'dynamic':\n return dynamic.executeOp(node, tensorMap, context);\n case 'evaluation':\n return tidy(() => evaluation.executeOp(node, tensorMap, context));\n case 'image':\n return tidy(() => image.executeOp(node, tensorMap, context));\n case 'graph':\n return tidy(() => graph.executeOp(node, tensorMap, context));\n case 'logical':\n return tidy(() => logical.executeOp(node, tensorMap, context));\n case 'matrices':\n return tidy(() => matrices.executeOp(node, tensorMap, context));\n case 'normalization':\n return tidy(\n () => normalization.executeOp(node, tensorMap, context));\n case 'reduction':\n return tidy(() => reduction.executeOp(node, tensorMap, context));\n case 'slice_join':\n return tidy(() => sliceJoin.executeOp(node, tensorMap, context));\n case 'sparse':\n return tidy(() => sparse.executeOp(node, tensorMap, context));\n case 'spectral':\n return tidy(() => spectral.executeOp(node, tensorMap, context));\n case 'string':\n return tidy(() => string.executeOp(node, tensorMap, context));\n case 'transformation':\n return tidy(\n () => transformation.executeOp(node, tensorMap, context));\n case 'hash_table':\n return hashTable.executeOp(\n node, tensorMap, context, resourceManager);\n case 'custom':\n const opMapper = getRegisteredOp(node.op);\n if (opMapper && opMapper.customExecutor) {\n return opMapper.customExecutor(\n new NodeValueImpl(node, tensorMap, context));\n } else {\n throw TypeError(`Custom op ${node.op} is not registered.`);\n }\n default:\n throw TypeError(\n `Unknown op '${node.op}'. File an issue at ` +\n `https://github.com/tensorflow/tfjs/issues so we can add it` +\n `, or register a custom execution with tf.registerOp()`);\n }\n })(node, tensorMap, context);\n if (tfc.util.isPromise(value)) {\n return value.then((data) => [].concat(data));\n }\n return [].concat(value);\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {Tensor} from '@tensorflow/tfjs-core';\n\nimport {NamedTensorsMap, TensorArrayMap, TensorListMap} from '../data/types';\n\nimport {TensorArray} from './tensor_array';\nimport {TensorList} from './tensor_list';\nimport {FunctionExecutor} from './types';\n\nexport interface ExecutionContextInfo {\n id: number; // the unique id of the context info\n frameName: string; // The frame name of the loop, this comes from\n // the TensorFlow NodeDef.\n iterationId: number; // The iteration id of the loop\n}\n\n/**\n * ExecutionContext captures the runtime environment of the node. It keeps\n * track of the current frame and iteration for the control flow ops.\n *\n * For example, typical Dynamic RNN model may contain loops, for which\n * TensorFlow will generate graphs with Enter/Exit nodes to control the\n * current execution frame, and NextIteration Nodes for iteration id increment.\n * For model with branch logic, TensorFLow will generate Switch/Merge ops.\n */\nexport class ExecutionContext {\n private rootContext = {id: 0, frameName: '', iterationId: 0};\n private contexts: ExecutionContextInfo[] = [this.rootContext];\n private lastId = 0;\n private _currentContextIds: string[];\n\n constructor(\n readonly weightMap: NamedTensorsMap = {},\n readonly tensorArrayMap: TensorArrayMap = {},\n readonly tensorListMap: TensorListMap = {},\n readonly functionMap: {[key: string]: FunctionExecutor} = {}) {\n this.generateCurrentContextIds();\n }\n\n private newFrame(id: number, frameName: string) {\n return {id, frameName, iterationId: 0};\n }\n\n /**\n * Set the current context\n * @param contexts: ExecutionContextInfo[] the current path of execution\n * frames\n */\n set currentContext(contexts: ExecutionContextInfo[]) {\n if (this.contexts !== contexts) {\n this.contexts = contexts;\n this.generateCurrentContextIds();\n }\n }\n\n get currentContext(): ExecutionContextInfo[] {\n return this.contexts;\n }\n\n /**\n * Returns the current context in string format.\n */\n get currentContextId(): string {\n return this._currentContextIds[0];\n }\n\n /**\n * Returns the current context and all parent contexts in string format.\n * This allow access to the nodes in the current and parent frames.\n */\n get currentContextIds(): string[] {\n return this._currentContextIds;\n }\n\n private generateCurrentContextIds() {\n const names = [];\n for (let i = 0; i < this.contexts.length - 1; i++) {\n const contexts = this.contexts.slice(0, this.contexts.length - i);\n names.push(this.contextIdforContexts(contexts));\n }\n names.push('');\n this._currentContextIds = names;\n }\n\n private contextIdforContexts(contexts: ExecutionContextInfo[]) {\n return contexts ?\n contexts\n .map(\n context => (context.id === 0 && context.iterationId === 0) ?\n '' :\n `${context.frameName}-${context.iterationId}`)\n .join('/') :\n '';\n }\n\n /**\n * Enter a new frame, a new context is pushed on the current context list.\n * @param frameId new frame id\n */\n enterFrame(frameId: string) {\n if (this.contexts) {\n this.lastId++;\n this.contexts = this.contexts.slice();\n this.contexts.push(this.newFrame(this.lastId, frameId));\n this._currentContextIds.unshift(this.contextIdforContexts(this.contexts));\n }\n }\n\n /**\n * Exit the current frame, the last context is removed from the current\n * context list.\n */\n exitFrame() {\n if (this.contexts && this.contexts.length > 1) {\n this.contexts = this.contexts.slice();\n this.contexts.splice(-1);\n this.currentContextIds.shift();\n } else {\n throw new Error('Cannot exit frame, the context is empty');\n }\n }\n\n /**\n * Enter the next iteration of a loop, the iteration id of last context is\n * increased.\n */\n nextIteration() {\n if (this.contexts && this.contexts.length > 0) {\n this.contexts = this.contexts.slice();\n this.lastId++;\n const context =\n Object.assign({}, this.contexts[this.contexts.length - 1]);\n context.iterationId += 1;\n context.id = this.lastId;\n this.contexts.splice(-1, 1, context);\n this._currentContextIds.splice(\n 0, 1, this.contextIdforContexts(this.contexts));\n } else {\n throw new Error('Cannot increase frame iteration, the context is empty');\n }\n }\n\n getWeight(name: string): Tensor[] {\n return this.weightMap[name];\n }\n\n addTensorArray(tensorArray: TensorArray) {\n this.tensorArrayMap[tensorArray.id] = tensorArray;\n }\n\n getTensorArray(id: number): TensorArray {\n return this.tensorArrayMap[id];\n }\n\n addTensorList(tensorList: TensorList) {\n this.tensorListMap[tensorList.id] = tensorList;\n }\n\n getTensorList(id: number): TensorList {\n return this.tensorListMap[id];\n }\n\n dispose(keepIds: Set) {\n for (const key in this.tensorArrayMap) {\n this.tensorArrayMap[key].clearAndClose(keepIds);\n }\n\n for (const key in this.tensorListMap) {\n this.tensorListMap[key].clearAndClose(keepIds);\n }\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {NamedTensorMap} from '@tensorflow/tfjs-core';\n\nimport {NamedTensorsMap} from '../data/types';\nimport {parseNodeName} from '../operations/executors/utils';\nimport {Graph, Node} from '../operations/types';\n\nexport interface ExecutionInfo {\n inputs: NamedTensorMap;\n outputs: Node[];\n usedNodes: Set;\n missingInputs: string[];\n dynamicNode: Node;\n syncInputs: string[];\n}\n\n/**\n * Given graph inputs and desired outputs, find the minimal set of nodes\n * to execute in order to compute the outputs. In addition return other useful\n * info such:\n * - Missing inputs needed to compute the output.\n * - Whether the subgraph contains dynamic ops (control flow, dynamic shape).\n * - Alternative inputs in order to avoid async (dynamic op) execution.\n */\nexport function getExecutionSubgraph(\n inputs: NamedTensorMap, outputs: Node[], weightMap: NamedTensorsMap,\n initNodes?: Node[]): ExecutionInfo {\n const usedNodes = new Set();\n const missingInputs: string[] = [];\n let dynamicNode: Node = null;\n let syncInputs: string[] = null;\n\n // Start with the outputs, going backwards and find all the nodes that are\n // needed to compute those outputs.\n const seen = new Set();\n const inputNodeNames =\n Object.keys(inputs).map(name => parseNodeName(name)[0]);\n\n let initNodeNames: string[] = [];\n if (initNodes != null) {\n initNodeNames = initNodes.map(node => parseNodeName(node.name)[0]);\n }\n\n const frontier = [...outputs];\n while (frontier.length > 0) {\n const node = frontier.pop();\n if (isControlFlow(node) || isDynamicShape(node) || isHashTable(node)) {\n if (dynamicNode == null) {\n dynamicNode = node;\n syncInputs = dynamicNode.children.map(child => child.name)\n .filter(name => usedNodes.has(name));\n }\n }\n usedNodes.add(node.name);\n\n // Weights are dead end since we already have their values.\n if (weightMap[node.name] != null) {\n continue;\n }\n // This node is a dead end since it's one of the user-provided inputs.\n if (inputNodeNames.indexOf(node.name) !== -1) {\n continue;\n }\n // This node is a dead end since it doesn't have any inputs.\n if (initNodeNames.indexOf(node.name) !== -1) {\n continue;\n }\n if (node.inputs.length === 0) {\n missingInputs.push(node.name);\n continue;\n }\n node.inputs.forEach(input => {\n // Don't add to the frontier if it is already there.\n if (seen.has(input.name)) {\n return;\n }\n seen.add(input.name);\n frontier.push(input);\n });\n }\n return {inputs, outputs, usedNodes, missingInputs, dynamicNode, syncInputs};\n}\n\n/**\n * Given the execution info, return a list of nodes in topological order that\n * need to be executed to compute the output.\n */\nexport function getNodesInTopologicalOrder(\n graph: Graph, weightMap: NamedTensorsMap,\n executionInfo: ExecutionInfo): Node[] {\n const {usedNodes, inputs} = executionInfo;\n const frontier: Node[] = [];\n const inputNodes = Object.keys(inputs)\n .map(name => parseNodeName(name)[0])\n .map(name => graph.nodes[name]);\n const initNodes = graph.initNodes;\n\n inputNodes.forEach(input => {\n if (usedNodes.has(input.name)) {\n frontier.push(input);\n }\n });\n graph.weights.forEach(weight => {\n if (usedNodes.has(weight.name)) {\n frontier.push(weight);\n }\n });\n if (initNodes != null) {\n initNodes.forEach(node => {\n if (usedNodes.has(node.name)) {\n frontier.push(node);\n }\n });\n }\n const seen = new Set();\n const orderedNodes: Node[] = [];\n while (frontier.length > 0) {\n const node = frontier.pop();\n seen.add(node.name);\n if (!weightMap[node.name]) {\n orderedNodes.push(node);\n }\n node.children.forEach(child => {\n if (!seen.has(child.name) && usedNodes.has(child.name) &&\n child.inputs.every(input => seen.has(input.name))) {\n frontier.push(child);\n }\n });\n }\n return orderedNodes;\n}\n\nconst CONTROL_FLOW_OPS = [\n 'Switch', 'Merge', 'Enter', 'Exit', 'NextIteration', 'StatelessIf',\n 'StatelessWhile', 'if', 'While'\n];\nconst DYNAMIC_SHAPE_OPS = [\n 'NonMaxSuppressionV2', 'NonMaxSuppressionV3', 'NonMaxSuppressionV5', 'Where'\n];\nconst HASH_TABLE_OPS = [\n 'HashTable', 'HashTableV2', 'LookupTableImport', 'LookupTableImportV2',\n 'LookupTableFind', 'LookupTableFindV2', 'LookupTableSize', 'LookupTableSizeV2'\n];\n\nexport function isControlFlow(node: Node) {\n return CONTROL_FLOW_OPS.indexOf(node.op) >= 0;\n}\n\nexport function isDynamicShape(node: Node) {\n return DYNAMIC_SHAPE_OPS.indexOf(node.op) >= 0;\n}\n\nexport function isHashTable(node: Node) {\n return HASH_TABLE_OPS.indexOf(node.op) >= 0;\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {DataType, env, NamedTensorMap, Tensor, tidy, util} from '@tensorflow/tfjs-core';\n\nimport {ISignatureDef} from '../data/compiled_api';\nimport {NamedTensorsMap, TensorArrayMap, TensorInfo, TensorListMap} from '../data/types';\nimport {getNodeNameAndIndex, getParamValue, getTensor, getTensorsForCurrentContenxt, parseNodeName} from '../operations/executors/utils';\nimport {executeOp} from '../operations/operation_executor';\nimport {Graph, Node} from '../operations/types';\n\nimport {ExecutionContext, ExecutionContextInfo} from './execution_context';\nimport {getExecutionSubgraph, getNodesInTopologicalOrder, isControlFlow} from './model_analysis';\nimport {ResourceManager} from './resource_manager';\nimport {FunctionExecutor} from './types';\n\ninterface NodeWithContexts {\n contexts: ExecutionContextInfo[];\n node: Node;\n}\n\nexport class GraphExecutor implements FunctionExecutor {\n private compiledMap: Map = new Map();\n private _weightMap: NamedTensorsMap = {};\n private _weightIds: number[];\n private _signature: ISignatureDef;\n private _inputs: Node[];\n private _outputs: Node[];\n private _initNodes: Node[]; // Internal init nodes to start initialization.\n private SEPERATOR = ',';\n private _functions: {[key: string]: Graph} = {};\n private _functionExecutorMap: {[key: string]: FunctionExecutor} = {};\n private _resourceManager: ResourceManager;\n private intermediateTensors: NamedTensorsMap = {};\n private keepIds: Set;\n private tensorsMap: NamedTensorsMap;\n private keepTensorForDebug = false;\n\n get weightIds(): number[] {\n return this.parent ? this.parent.weightIds : this._weightIds;\n }\n\n get functionExecutorMap(): {[key: string]: FunctionExecutor} {\n return this.parent ? this.parent.functionExecutorMap :\n this._functionExecutorMap;\n }\n\n get weightMap(): NamedTensorsMap {\n return this.parent ? this.parent.weightMap : this._weightMap;\n }\n\n set weightMap(weightMap: NamedTensorsMap) {\n const weightIds = Object.keys(weightMap).map(\n key => weightMap[key].map(tensor => tensor.id));\n this._weightIds = [].concat(...weightIds);\n this._weightMap = weightMap;\n }\n\n /**\n * Set `ResourceManager` shared by executors of a model.\n * @param resourceManager: `ResourceManager` of the `GraphModel`.\n */\n set resourceManager(resourceManager: ResourceManager) {\n this._resourceManager = resourceManager;\n }\n\n get inputs(): TensorInfo[] {\n return this._inputs.map(node => {\n return {\n name: node.name,\n shape: node.attrParams['shape'] ?\n node.attrParams['shape'].value as number[] :\n undefined,\n dtype: node.attrParams['dtype'] ?\n node.attrParams['dtype'].value as DataType :\n undefined\n };\n });\n }\n\n get outputs(): TensorInfo[] {\n return this._outputs.map(node => {\n return {\n name: node.name,\n shape: node.attrParams['shape'] ?\n node.attrParams['shape'].value as number[] :\n undefined,\n dtype: node.attrParams['dtype'] ?\n node.attrParams['dtype'].value as DataType :\n undefined\n };\n });\n }\n\n get inputNodes(): string[] {\n return this._inputs.map(node => node.signatureKey || node.name);\n }\n\n get outputNodes(): string[] {\n return this._outputs.map((node) => {\n const name = node.signatureKey || node.name;\n return node.defaultOutput ? (`${name}:${node.defaultOutput}`) : name;\n });\n }\n\n get functions(): {[key: string]: ISignatureDef} {\n return Object.keys(this._functions).reduce((map, key) => {\n map[key] = this._functions[key].signature;\n return map;\n }, {} as {[key: string]: ISignatureDef});\n }\n\n /**\n *\n * @param graph Graph the model or function graph to be executed.\n * @param parent When building function exector you need to set the parent\n * executor. Since the weights and function executor maps are set at parant\n * level, that function executor can access the function maps and weight maps\n * through the parent.\n */\n constructor(private graph: Graph, private parent?: GraphExecutor) {\n this._outputs = graph.outputs;\n this._inputs = graph.inputs;\n this._initNodes = graph.initNodes;\n this._signature = graph.signature;\n this._functions = graph.functions;\n // create sub-graph executors\n if (graph.functions != null) {\n Object.keys(graph.functions).forEach(name => {\n this._functionExecutorMap[name] =\n new GraphExecutor(graph.functions[name], this);\n });\n }\n }\n\n private getCompilationKey(inputs: Node[], outputs: Node[]): string {\n const sortedInputs = inputs.map(node => node.name).sort();\n const sortedOutputs = outputs.map(node => node.name).sort();\n return sortedInputs.join(this.SEPERATOR) + '--' +\n sortedOutputs.join(this.SEPERATOR);\n }\n\n /**\n * Compiles the inference graph and returns the minimal set of nodes that are\n * required for execution, in the correct execution order.\n */\n private compile(inputs: NamedTensorMap, outputs: Node[]): Node[] {\n const executionInfo =\n getExecutionSubgraph(inputs, outputs, this.weightMap, this._initNodes);\n const {missingInputs, dynamicNode, syncInputs} = executionInfo;\n if (dynamicNode != null) {\n throw new Error(\n `This execution contains the node '${dynamicNode.name}', which has ` +\n `the dynamic op '${dynamicNode.op}'. Please use ` +\n `model.executeAsync() instead. Alternatively, to avoid the ` +\n `dynamic ops, specify the inputs [${syncInputs}]`);\n }\n\n if (missingInputs.length > 0) {\n const outNames = outputs.map(n => n.name);\n const inNames = Object.keys(inputs);\n throw new Error(\n `Cannot compute the outputs [${outNames}] from the provided inputs ` +\n `[${inNames}]. Missing the following inputs: [${missingInputs}]`);\n }\n\n return getNodesInTopologicalOrder(\n this.graph, this.weightMap, executionInfo);\n }\n\n /**\n * Executes the inference for given input tensors.\n * @param inputs Tensor map for the model inputs, keyed by the input node\n * names.\n * @param outputs Optional. output node name from the Tensorflow model, if\n * no outputs are specified, the default outputs of the model would be used.\n * You can inspect intermediate nodes of the model by adding them to the\n * outputs array.\n */\n execute(inputs: NamedTensorMap, outputs?: string[]): Tensor[] {\n inputs = this.mapInputs(inputs);\n const names = Object.keys(inputs).sort();\n this.checkInputs(inputs);\n this.checkInputShapeAndType(inputs);\n outputs = this.mapOutputs(outputs);\n this.checkOutputs(outputs);\n const inputNodes =\n names.map(name => this.graph.nodes[parseNodeName(name)[0]]);\n const outputNodeNames = outputs.map(name => parseNodeName(name)[0]);\n let outputNodes = outputNodeNames.map(name => this.graph.nodes[name]);\n this.resetIntermediateTensors();\n // If no outputs are specified, then use the default outputs of the model.\n if (outputNodes.length === 0) {\n outputNodes = this._outputs;\n }\n\n const compilationKey = this.getCompilationKey(inputNodes, outputNodes);\n\n // Do nothing if the compiled graph cache contains the input.\n let orderedNodes = this.compiledMap.get(compilationKey);\n if (orderedNodes == null) {\n orderedNodes = this.compile(inputs, outputNodes);\n this.compiledMap.set(compilationKey, orderedNodes);\n }\n\n const tensorArrayMap: TensorArrayMap = {};\n const tensorListMap: TensorListMap = {};\n\n return tidy(() => {\n const context = new ExecutionContext(\n this.weightMap, tensorArrayMap, tensorListMap,\n this.functionExecutorMap);\n const tensorsMap: NamedTensorsMap = {...this.weightMap};\n\n Object.keys(inputs).forEach(name => {\n const [nodeName, index] = parseNodeName(name);\n const tensors: Tensor[] = [];\n tensors[index] = inputs[name];\n tensorsMap[nodeName] = tensors;\n });\n\n const tensorsToKeep = this.getFrozenTensorIds(tensorsMap);\n const intermediateTensorConsumerCount: {[key: number]: number} = {};\n for (let i = 0; i < orderedNodes.length; i++) {\n const node = orderedNodes[i];\n if (!tensorsMap[node.name]) {\n const tensors =\n executeOp(node, tensorsMap, context, this._resourceManager) as\n Tensor[];\n if (util.isPromise(tensors)) {\n throw new Error(\n `The execution of the op '${node.op}' returned a promise. ` +\n `Please use model.executeAsync() instead.`);\n }\n tensorsMap[node.name] = tensors;\n this.checkTensorForDisposal(\n node.name, node, tensorsMap, context, tensorsToKeep,\n outputNodeNames, intermediateTensorConsumerCount);\n }\n }\n // dispose the context for the root executor\n if (this.parent == null) {\n context.dispose(tensorsToKeep);\n }\n return outputs.map(name => getTensor(name, tensorsMap, context));\n });\n }\n\n private getFrozenTensorIds(tensorMap: NamedTensorsMap): Set {\n const ids = [].concat.apply(\n [],\n Object.keys(tensorMap)\n .map(key => tensorMap[key])\n .map(tensors => tensors.map(tensor => tensor.id)));\n return new Set(ids);\n }\n private checkTensorForDisposal(\n nodeName: string, node: Node, tensorMap: NamedTensorsMap,\n context: ExecutionContext, tensorsToKeep: Set,\n outputNames: string[],\n intermediateTensorConsumerCount: {[key: string]: number}) {\n // Skip output nodes and any control flow nodes, since its dependency is\n // tricky to track correctly.\n if (node.category === 'control' || outputNames.indexOf(nodeName) !== -1) {\n return;\n }\n\n tensorMap[nodeName].forEach(tensor => {\n if (tensor != null) {\n intermediateTensorConsumerCount[tensor.id] =\n (intermediateTensorConsumerCount[tensor.id] || 0) +\n node.children.length;\n }\n });\n node.inputs.forEach(input => {\n // Skip any control flow nodes, since its dependency is tricky to track\n // correctly.\n if (input.category !== 'control') {\n const tensors =\n getTensorsForCurrentContenxt(input.name, tensorMap, context);\n if (tensors != null) {\n tensors.forEach(tensor => {\n if (tensor && !tensor.kept && !tensorsToKeep.has(tensor.id)) {\n const count = intermediateTensorConsumerCount[tensor.id];\n if (count === 1) {\n if (!this.keepTensorForDebug) {\n tensor.dispose();\n } else {\n const [nodeName, index] =\n getNodeNameAndIndex(node.name, context);\n if (this.intermediateTensors[nodeName]) {\n this.intermediateTensors[nodeName][index] = tensor;\n } else {\n this.intermediateTensors[nodeName] = [];\n this.intermediateTensors[nodeName][index] = tensor;\n }\n }\n delete intermediateTensorConsumerCount[tensor.id];\n } else if (count != null) {\n // only intermediate nodes has count set, inputs and weights are\n // not.\n intermediateTensorConsumerCount[tensor.id]--;\n }\n }\n });\n }\n }\n });\n }\n\n /**\n * Executes the inference for given input tensors in Async fashion.\n * @param inputs Tensor map for the model inputs, keyed by the input node\n * names.\n * @param outputs output node name from the Tensorflow model, if no outputs\n * are specified, the default outputs of the model would be used. You can\n * inspect intermediate nodes of the model by adding them to the outputs\n * array.\n */\n async executeAsync(inputs: NamedTensorMap, outputs?: string[]):\n Promise {\n return this._executeAsync(inputs, outputs);\n }\n\n disposeIntermediateTensors() {\n if (!this.intermediateTensors) {\n return;\n }\n Object.keys(this.intermediateTensors)\n .forEach(\n key => this.intermediateTensors[key].forEach(\n tensor => tensor.dispose()));\n this.disposeTensorsMap();\n }\n\n private disposeTensorsMap() {\n if (!this.tensorsMap) {\n return;\n }\n Object.keys(this.tensorsMap).forEach(key => {\n const tensorArray = this.tensorsMap[key];\n tensorArray.forEach(tensor => {\n if (tensor && !tensor.kept && !tensor.isDisposed &&\n !this.keepIds.has(tensor.id)) {\n tensor.dispose();\n }\n });\n });\n }\n\n getIntermediateTensors(): NamedTensorsMap {\n return this.tensorsMap;\n }\n\n private resetIntermediateTensors() {\n for (const key in this.intermediateTensors) {\n this.intermediateTensors[key].forEach(tensor => tensor.dispose());\n delete this.intermediateTensors[key];\n }\n }\n\n /**\n * Executes the inference for given input tensors in Async fashion.\n * @param inputs Tensor map for the model inputs, keyed by the input node\n * names.\n * @param outputs Optional. output node name from the Tensorflow model,\n * if no outputs are specified, the default outputs of the model would be\n * used. You can inspect intermediate nodes of the model by adding them to the\n * outputs array.\n * @param isFunctionExecution Optional. Flag for executing a function.\n * @param tensorArrayMap Optional, global TensorArray map by id. Used for\n * function execution.\n * @param tensorArrayMap Optinal global TensorList map by id. Used for\n * function execution.\n */\n private async _executeAsync(\n inputs: NamedTensorMap, outputs?: string[], isFunctionExecution = false,\n tensorArrayMap: TensorArrayMap = {},\n tensorListMap: TensorListMap = {}): Promise {\n if (!isFunctionExecution) {\n inputs = this.mapInputs(inputs);\n this.checkInputs(inputs);\n this.checkInputShapeAndType(inputs);\n outputs = this.mapOutputs(outputs);\n this.checkOutputs(outputs);\n }\n\n // For model debug.\n try {\n this.keepTensorForDebug = env().getBool('KEEP_INTERMEDIATE_TENSORS');\n } catch (e) {\n console.warn(e.message);\n }\n this.resetIntermediateTensors();\n\n const context = new ExecutionContext(\n this.weightMap, tensorArrayMap, tensorListMap,\n this.functionExecutorMap);\n\n // Graph with control flow op requires runtime evaluation of the execution\n // order, while without control flow the execution order is pre-determined\n // in the compile method.\n this.tensorsMap = await this.executeWithControlFlow(\n inputs, context, outputs, isFunctionExecution);\n const results =\n outputs.map(name => getTensor(name, this.tensorsMap, context));\n\n // dispose all the intermediate tensors\n const outputIds = results.map(t => t.id);\n const inputIds = Object.keys(inputs).map(name => inputs[name].id);\n this.keepIds =\n new Set([...outputIds, ...inputIds, ...this.weightIds]);\n if (!this.keepTensorForDebug) {\n this.disposeTensorsMap();\n }\n\n // dispose the context for the root executor\n if (this.parent == null) {\n context.dispose(this.keepIds);\n }\n\n return results;\n }\n\n async executeFunctionAsync(\n inputs: Tensor[], tensorArrayMap: TensorArrayMap,\n tensorListMap: TensorListMap): Promise {\n const mappedInputs = inputs.reduce((map, tensor, index) => {\n map[this.inputs[index].name] = tensor;\n return map;\n }, {} as NamedTensorMap);\n\n return this._executeAsync(\n mappedInputs, this.outputNodes, true, tensorArrayMap, tensorListMap);\n }\n\n /**\n * When there are control flow nodes in the graph, the graph execution use\n * ExecutionContext to keep track of the frames and loop iterators.\n * @param inputs placeholder tensors for the graph.\n * @param context the execution context object for current execution.\n * @param outputNames Optional. output node name from the Tensorflow model,\n * if no outputs are specified, the default outputs of the model would be\n * used. You can inspect intermediate nodes of the model by adding them to the\n * outputs array.\n * @param isFunctionExecution Flag for executing a function.\n */\n private async executeWithControlFlow(\n inputs: NamedTensorMap, context: ExecutionContext, outputNames?: string[],\n isFunctionExecution?: boolean): Promise {\n const names = Object.keys(inputs);\n const inputNodes =\n names.map(name => this.graph.nodes[parseNodeName(name)[0]]);\n const outputNodeNames = outputNames.map(name => parseNodeName(name)[0]);\n let outputNodes = outputNodeNames.map(name => this.graph.nodes[name]);\n\n // If no outputs are specified, then use the default outputs of the model.\n if (outputNodes.length === 0) {\n outputNodes = this._outputs;\n }\n\n const {usedNodes, missingInputs, dynamicNode, syncInputs} =\n getExecutionSubgraph(\n inputs, outputNodes, this.weightMap, this._initNodes);\n\n // First nodes to execute include inputNodes, weights, and initNodes.\n const stack: NodeWithContexts[] = [\n ...inputNodes, ...this.graph.weights, ...(this._initNodes || [])\n ].map(node => {\n return {node, contexts: context.currentContext};\n });\n const tensorsMap: NamedTensorsMap = {...this.weightMap};\n Object.keys(inputs).forEach(name => {\n const [nodeName, index] = parseNodeName(name);\n const tensors: Tensor[] = [];\n tensors[index] = inputs[name];\n tensorsMap[nodeName] = tensors;\n });\n const intermediateTensorConsumerCount: {[key: number]: number} = {};\n const tensorsToKeep = this.getFrozenTensorIds(tensorsMap);\n const added: {[key: string]: boolean} = {};\n while (stack.length > 0) {\n const promises = this.processStack(\n inputNodes, stack, context, tensorsMap, added, tensorsToKeep,\n outputNodeNames, intermediateTensorConsumerCount, usedNodes);\n await Promise.all(promises);\n }\n if (dynamicNode == null && !isFunctionExecution) {\n console.warn(\n `This model execution did not contain any nodes with control flow ` +\n `or dynamic output shapes. You can use model.execute() instead.`);\n }\n const missingOutputs =\n outputNodes\n .filter(\n node => !isControlFlow(node) &&\n !getTensor(node.name, tensorsMap, context))\n .map(node => node.name);\n if (missingOutputs.length > 0) {\n let alternativeMsg = '';\n if (dynamicNode != null) {\n alternativeMsg =\n `Alternatively, to avoid the dynamic ops, use model.execute() ` +\n `and specify the inputs [${syncInputs}]`;\n }\n throw new Error(\n `Cannot compute the outputs [${missingOutputs}] from the provided ` +\n `inputs [${names}]. Consider providing the following inputs: ` +\n `[${missingInputs}]. ${alternativeMsg}`);\n }\n return tensorsMap;\n }\n\n private processStack(\n inputNodes: Node[], stack: NodeWithContexts[], context: ExecutionContext,\n tensorMap: NamedTensorsMap, added: {[key: string]: boolean},\n tensorsToKeep: Set, outputNames: string[],\n intermediateTensorConsumerCount: {[key: number]: number},\n usedNodes: Set) {\n const promises: Array> = [];\n while (stack.length > 0) {\n const item = stack.pop();\n context.currentContext = item.contexts;\n let nodeName = '';\n // The tensor of the Enter op with isConstant set should be set\n // in the parent scope, so it will be available as constant for the\n // whole loop.\n if (item.node.op === 'Enter' &&\n getParamValue('isConstant', item.node, tensorMap, context)) {\n [nodeName] = getNodeNameAndIndex(item.node.name, context);\n }\n\n // only process nodes that are not in the tensorMap yet, this include\n // inputNodes and internal initNodes.\n if (tensorMap[item.node.name] == null) {\n const tensors =\n executeOp(item.node, tensorMap, context, this._resourceManager);\n if (!nodeName) {\n [nodeName] = getNodeNameAndIndex(item.node.name, context);\n }\n const currentContext = context.currentContext;\n if (util.isPromise(tensors)) {\n promises.push(tensors.then(t => {\n tensorMap[nodeName] = t;\n context.currentContext = currentContext;\n this.checkTensorForDisposal(\n nodeName, item.node, tensorMap, context, tensorsToKeep,\n outputNames, intermediateTensorConsumerCount);\n this.processChildNodes(\n item.node, stack, context, tensorMap, added, usedNodes);\n return t;\n }));\n } else {\n tensorMap[nodeName] = tensors;\n this.checkTensorForDisposal(\n nodeName, item.node, tensorMap, context, tensorsToKeep,\n outputNames, intermediateTensorConsumerCount);\n this.processChildNodes(\n item.node, stack, context, tensorMap, added, usedNodes);\n }\n } else {\n this.processChildNodes(\n item.node, stack, context, tensorMap, added, usedNodes);\n }\n }\n return promises;\n }\n\n private processChildNodes(\n node: Node, stack: NodeWithContexts[], context: ExecutionContext,\n tensorMap: NamedTensorsMap, added: {[key: string]: boolean},\n usedNodes: Set) {\n node.children.forEach((childNode) => {\n const [nodeName, ] = getNodeNameAndIndex(childNode.name, context);\n if (added[nodeName] || !usedNodes.has(childNode.name)) {\n return;\n }\n // Merge op can be pushed if any of its inputs has value.\n if (childNode.op === 'Merge') {\n if (childNode.inputNames.some(name => {\n return !!getTensor(name, tensorMap, context);\n })) {\n added[nodeName] = true;\n stack.push({contexts: context.currentContext, node: childNode});\n }\n } else // Otherwise all inputs must to have value.\n if (childNode.inputNames.every(name => {\n return !!getTensor(name, tensorMap, context);\n })) {\n added[nodeName] = true;\n stack.push({contexts: context.currentContext, node: childNode});\n }\n });\n }\n\n /**\n * Releases the memory used by the weight tensors.\n */\n dispose() {\n Object.keys(this.weightMap)\n .forEach(\n key => this.weightMap[key].forEach(tensor => tensor.dispose()));\n }\n\n private checkInputShapeAndType(inputs: NamedTensorMap) {\n Object.keys(inputs).forEach(name => {\n const input = inputs[name];\n const [nodeName, ] = parseNodeName(name);\n const node = this.graph.nodes[nodeName];\n if (node.attrParams['shape'] && node.attrParams['shape'].value) {\n const shape = node.attrParams['shape'].value as number[];\n const match = shape.length === input.shape.length &&\n input.shape.every(\n (dim, index) => shape[index] === -1 || shape[index] === dim);\n util.assert(\n match,\n () => `The shape of dict['${node.name}'] provided in ` +\n `model.execute(dict) must be [${shape}], but was ` +\n `[${input.shape}]`);\n }\n if (node.attrParams['dtype'] && node.attrParams['dtype'].value) {\n util.assert(\n input.dtype === node.attrParams['dtype'].value as string,\n () => `The dtype of dict['${node.name}'] provided in ` +\n `model.execute(dict) must be ` +\n `${node.attrParams['dtype'].value}, but was ${input.dtype}`);\n }\n });\n }\n\n private mapInputs(inputs: NamedTensorMap) {\n const result: NamedTensorMap = {};\n for (const inputName in inputs) {\n if (this._signature != null && this._signature.inputs != null &&\n this._signature.inputs[inputName] != null) {\n const tensor = this._signature.inputs[inputName];\n result[tensor.name] = inputs[inputName];\n } else {\n result[inputName] = inputs[inputName];\n }\n }\n return result;\n }\n\n private checkInputs(inputs: NamedTensorMap) {\n const notInGraph = Object.keys(inputs).filter(name => {\n const [nodeName] = parseNodeName(name);\n return this.graph.nodes[nodeName] == null;\n });\n if (notInGraph.length > 0) {\n throw new Error(\n `The dict provided in model.execute(dict) has ` +\n `keys: [${notInGraph}] that are not part of graph`);\n }\n }\n\n private mapOutputs(outputs: string[]) {\n return outputs.map(name => {\n if (this._signature != null && this._signature.outputs != null &&\n this._signature.outputs[name] != null) {\n const tensor = this._signature.outputs[name];\n return tensor.name;\n }\n return name;\n }, {});\n }\n\n private checkOutputs(outputs: string[]): void {\n outputs.forEach(name => {\n const [normalizedName] = parseNodeName(name);\n if (!this.graph.nodes[normalizedName]) {\n throw new Error(`The output '${name}' is not found in the graph`);\n }\n });\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport {HashTableMap, NamedTensorMap} from '../data/types';\nimport {HashTable} from './hash_table';\n\n/**\n * Contains global resources of a model.\n */\nexport class ResourceManager {\n constructor(\n readonly hashTableNameToHandle: NamedTensorMap = {},\n readonly hashTableMap: HashTableMap = {}) {}\n\n /**\n * Register a `HashTable` in the resource manager.\n *\n * The `HashTable` can be retrieved by `resourceManager.getHashTableById`,\n * where id is the table handle tensor's id.\n *\n * @param name Op node name that creates the `HashTable`.\n * @param hashTable The `HashTable` to be added to resource manager.\n */\n addHashTable(name: string, hashTable: HashTable) {\n this.hashTableNameToHandle[name] = hashTable.handle;\n this.hashTableMap[hashTable.id] = hashTable;\n }\n\n /**\n * Get the table handle by node name.\n * @param name Op node name that creates the `HashTable`. This name is also\n * used in the inputs list of lookup and import `HashTable` ops.\n */\n getHashTableHandleByName(name: string) {\n return this.hashTableNameToHandle[name];\n }\n\n /**\n * Get the actual `HashTable` by its handle tensor's id.\n * @param id The id of the handle tensor.\n */\n getHashTableById(id: number): HashTable {\n return this.hashTableMap[id];\n }\n\n /**\n * Dispose `ResourceManager`, including its hashTables and tensors in them.\n */\n dispose() {\n for (const key in this.hashTableMap) {\n this.hashTableMap[key].clearAndClose();\n delete this.hashTableMap[key];\n }\n\n for (const name in this.hashTableNameToHandle) {\n this.hashTableNameToHandle[name].dispose();\n delete this.hashTableNameToHandle[name];\n }\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport {dispose, InferenceModel, io, ModelPredictConfig, NamedTensorMap, Tensor, util} from '@tensorflow/tfjs-core';\n\nimport * as tensorflow from '../data/compiled_api';\nimport {NamedTensorsMap, TensorInfo} from '../data/types';\nimport {OperationMapper} from '../operations/operation_mapper';\n\nimport {GraphExecutor} from './graph_executor';\nimport {ResourceManager} from './resource_manager';\n\nexport const TFHUB_SEARCH_PARAM = '?tfjs-format=file';\nexport const DEFAULT_MODEL_NAME = 'model.json';\ntype Url = string|io.IOHandler|io.IOHandlerSync;\ntype UrlIOHandler = T extends string ? io.IOHandler : T;\n\n/**\n * A `tf.GraphModel` is a directed, acyclic graph built from a\n * SavedModel GraphDef and allows inference execution.\n *\n * A `tf.GraphModel` can only be created by loading from a model converted from\n * a [TensorFlow SavedModel](https://www.tensorflow.org/guide/saved_model) using\n * the command line converter tool and loaded via `tf.loadGraphModel`.\n *\n * @doc {heading: 'Models', subheading: 'Classes'}\n */\nexport class GraphModel implements\n InferenceModel {\n private executor: GraphExecutor;\n private version = 'n/a';\n private handler: UrlIOHandler;\n private artifacts: io.ModelArtifacts;\n private initializer: GraphExecutor;\n private resourceIdToCapturedInput: {[key: number]: Tensor};\n private resourceManager: ResourceManager;\n private signature: tensorflow.ISignatureDef;\n private initializerSignature: tensorflow.ISignatureDef;\n private structuredOutputKeys: string[];\n private readonly io: typeof io;\n\n // Returns the version information for the tensorflow model GraphDef.\n get modelVersion(): string {\n return this.version;\n }\n\n get inputNodes(): string[] {\n return this.executor.inputNodes;\n }\n\n get outputNodes(): string[] {\n return this.executor.outputNodes;\n }\n\n get inputs(): TensorInfo[] {\n return this.executor.inputs;\n }\n\n get outputs(): TensorInfo[] {\n return this.executor.outputs;\n }\n\n get weights(): NamedTensorsMap {\n return this.executor.weightMap;\n }\n\n get metadata(): {} {\n return this.artifacts.userDefinedMetadata;\n }\n\n get modelSignature(): {} {\n return this.signature;\n }\n\n get modelStructuredOutputKeys(): {} {\n return this.structuredOutputKeys;\n }\n\n /**\n * @param modelUrl url for the model, or an `io.IOHandler`.\n * @param weightManifestUrl url for the weight file generated by\n * scripts/convert.py script.\n * @param requestOption options for Request, which allows to send credentials\n * and custom headers.\n * @param onProgress Optional, progress callback function, fired periodically\n * before the load is completed.\n */\n constructor(\n private modelUrl: ModelURL, private loadOptions: io.LoadOptions = {},\n tfio = io) {\n this.io = tfio;\n if (loadOptions == null) {\n this.loadOptions = {};\n }\n this.resourceManager = new ResourceManager();\n }\n\n private findIOHandler() {\n type IOHandler = UrlIOHandler;\n const path = this.modelUrl;\n if ((path as io.IOHandler).load != null) {\n // Path is an IO Handler.\n this.handler = path as IOHandler;\n } else if (this.loadOptions.requestInit != null) {\n this.handler = this.io.browserHTTPRequest(\n path as string, this.loadOptions) as IOHandler;\n } else {\n const handlers =\n this.io.getLoadHandlers(path as string, this.loadOptions);\n if (handlers.length === 0) {\n // For backward compatibility: if no load handler can be found,\n // assume it is a relative http path.\n handlers.push(\n this.io.browserHTTPRequest(path as string, this.loadOptions));\n } else if (handlers.length > 1) {\n throw new Error(\n `Found more than one (${handlers.length}) load handlers for ` +\n `URL '${[path]}'`);\n }\n this.handler = handlers[0] as IOHandler;\n }\n }\n\n /**\n * Loads the model and weight files, construct the in memory weight map and\n * compile the inference graph.\n */\n load(): UrlIOHandler extends io.IOHandlerSync? boolean:\n Promise {\n type IOHandler = UrlIOHandler;\n this.findIOHandler();\n if (this.handler.load == null) {\n throw new Error(\n 'Cannot proceed with model loading because the IOHandler provided ' +\n 'does not have the `load` method implemented.');\n }\n\n type Result =\n IOHandler extends io.IOHandlerSync ? boolean : Promise;\n\n const loadResult = this.handler.load() as ReturnType;\n if (util.isPromise(loadResult)) {\n return loadResult.then(artifacts => this.loadSync(artifacts)) as Result;\n }\n\n return this.loadSync(loadResult) as Result;\n }\n\n /**\n * Synchronously construct the in memory weight map and\n * compile the inference graph.\n *\n * @doc {heading: 'Models', subheading: 'Classes', ignoreCI: true}\n */\n loadSync(artifacts: io.ModelArtifacts) {\n this.artifacts = artifacts;\n const graph = this.artifacts.modelTopology as tensorflow.IGraphDef;\n\n let signature = this.artifacts.signature;\n if (this.artifacts.userDefinedMetadata != null) {\n const metadata = this.artifacts.userDefinedMetadata;\n if (metadata.signature != null) {\n signature = metadata.signature;\n }\n\n if (metadata.structuredOutputKeys != null) {\n this.structuredOutputKeys = metadata.structuredOutputKeys as string[];\n }\n }\n this.signature = signature;\n\n this.version = `${graph.versions.producer}.${graph.versions.minConsumer}`;\n const weightMap = this.io.decodeWeights(\n this.artifacts.weightData, this.artifacts.weightSpecs);\n this.executor = new GraphExecutor(\n OperationMapper.Instance.transformGraph(graph, this.signature));\n this.executor.weightMap = this.convertTensorMapToTensorsMap(weightMap);\n // Attach a model-level resourceManager to each executor to share resources,\n // such as `HashTable`.\n this.executor.resourceManager = this.resourceManager;\n\n if (artifacts.modelInitializer != null &&\n (artifacts.modelInitializer as tensorflow.IGraphDef).node != null) {\n const initializer =\n OperationMapper.Instance.transformGraph(artifacts.modelInitializer);\n this.initializer = new GraphExecutor(initializer);\n this.initializer.weightMap = this.executor.weightMap;\n // Attach a model-level resourceManager to the initializer, the\n // hashTables created from when executing the initializer will be stored\n // in the resourceManager.\n this.initializer.resourceManager = this.resourceManager;\n this.initializerSignature = artifacts.initializerSignature;\n }\n\n return true;\n }\n\n /**\n * Save the configuration and/or weights of the GraphModel.\n *\n * An `IOHandler` is an object that has a `save` method of the proper\n * signature defined. The `save` method manages the storing or\n * transmission of serialized data (\"artifacts\") that represent the\n * model's topology and weights onto or via a specific medium, such as\n * file downloads, local storage, IndexedDB in the web browser and HTTP\n * requests to a server. TensorFlow.js provides `IOHandler`\n * implementations for a number of frequently used saving mediums, such as\n * `tf.io.browserDownloads` and `tf.io.browserLocalStorage`. See `tf.io`\n * for more details.\n *\n * This method also allows you to refer to certain types of `IOHandler`s\n * as URL-like string shortcuts, such as 'localstorage://' and\n * 'indexeddb://'.\n *\n * Example 1: Save `model`'s topology and weights to browser [local\n * storage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage);\n * then load it back.\n *\n * ```js\n * const modelUrl =\n * 'https://storage.googleapis.com/tfjs-models/savedmodel/mobilenet_v2_1.0_224/model.json';\n * const model = await tf.loadGraphModel(modelUrl);\n * const zeros = tf.zeros([1, 224, 224, 3]);\n * model.predict(zeros).print();\n *\n * const saveResults = await model.save('localstorage://my-model-1');\n *\n * const loadedModel = await tf.loadGraphModel('localstorage://my-model-1');\n * console.log('Prediction from loaded model:');\n * model.predict(zeros).print();\n * ```\n *\n * @param handlerOrURL An instance of `IOHandler` or a URL-like,\n * scheme-based string shortcut for `IOHandler`.\n * @param config Options for saving the model.\n * @returns A `Promise` of `SaveResult`, which summarizes the result of\n * the saving, such as byte sizes of the saved artifacts for the model's\n * topology and weight values.\n *\n * @doc {heading: 'Models', subheading: 'Classes', ignoreCI: true}\n */\n async save(handlerOrURL: io.IOHandler|string, config?: io.SaveConfig):\n Promise {\n if (typeof handlerOrURL === 'string') {\n const handlers = this.io.getSaveHandlers(handlerOrURL);\n if (handlers.length === 0) {\n throw new Error(\n `Cannot find any save handlers for URL '${handlerOrURL}'`);\n } else if (handlers.length > 1) {\n throw new Error(\n `Found more than one (${handlers.length}) save handlers for ` +\n `URL '${handlerOrURL}'`);\n }\n handlerOrURL = handlers[0];\n }\n if (handlerOrURL.save == null) {\n throw new Error(\n 'GraphModel.save() cannot proceed because the IOHandler ' +\n 'provided does not have the `save` attribute defined.');\n }\n\n return handlerOrURL.save(this.artifacts);\n }\n\n /**\n * Execute the inference for the input tensors.\n *\n * @param input The input tensors, when there is single input for the model,\n * inputs param should be a `tf.Tensor`. For models with mutliple inputs,\n * inputs params should be in either `tf.Tensor`[] if the input order is\n * fixed, or otherwise NamedTensorMap format.\n *\n * For model with multiple inputs, we recommend you use NamedTensorMap as the\n * input type, if you use `tf.Tensor`[], the order of the array needs to\n * follow the\n * order of inputNodes array. @see {@link GraphModel.inputNodes}\n *\n * You can also feed any intermediate nodes using the NamedTensorMap as the\n * input type. For example, given the graph\n * InputNode => Intermediate => OutputNode,\n * you can execute the subgraph Intermediate => OutputNode by calling\n * model.execute('IntermediateNode' : tf.tensor(...));\n *\n * This is useful for models that uses tf.dynamic_rnn, where the intermediate\n * state needs to be fed manually.\n *\n * For batch inference execution, the tensors for each input need to be\n * concatenated together. For example with mobilenet, the required input shape\n * is [1, 244, 244, 3], which represents the [batch, height, width, channel].\n * If we are provide a batched data of 100 images, the input tensor should be\n * in the shape of [100, 244, 244, 3].\n *\n * @param config Prediction configuration for specifying the batch size.\n * Currently the batch size option is ignored for graph model.\n *\n * @returns Inference result tensors. If the model is converted and it\n * originally had structured_outputs in tensorflow, then a NamedTensorMap\n * will be returned matching the structured_outputs. If no structured_outputs\n * are present, the output will be single `tf.Tensor` if the model has single\n * output node, otherwise Tensor[].\n *\n * @doc {heading: 'Models', subheading: 'Classes'}\n */\n predict(inputs: Tensor|Tensor[]|NamedTensorMap, config?: ModelPredictConfig):\n Tensor|Tensor[]|NamedTensorMap {\n const outputTensors = this.execute(inputs, this.outputNodes);\n if (this.structuredOutputKeys) {\n const outputTensorsArray =\n outputTensors instanceof Tensor ? [outputTensors] : outputTensors;\n const outputTensorMap: NamedTensorMap = {};\n\n outputTensorsArray.forEach(\n (outputTensor, i) => outputTensorMap[this.structuredOutputKeys[i]] =\n outputTensor);\n\n return outputTensorMap;\n }\n return outputTensors;\n }\n\n private normalizeInputs(inputs: Tensor|Tensor[]|\n NamedTensorMap): NamedTensorMap {\n if (!(inputs instanceof Tensor) && !Array.isArray(inputs)) {\n // The input is already a NamedTensorMap.\n if (this.signature != null && this.signature.inputs != null) {\n for (const input in this.signature.inputs) {\n const tensor = this.signature.inputs[input];\n if (tensor.resourceId != null) {\n inputs[input] = this.resourceIdToCapturedInput[tensor.resourceId];\n }\n }\n }\n return inputs;\n }\n inputs = Array.isArray(inputs) ? inputs : [inputs];\n\n const numCapturedInputs =\n Object.keys(this.resourceIdToCapturedInput).length;\n if (inputs.length + numCapturedInputs !== this.inputNodes.length) {\n throw new Error(`Input tensor count mismatch, the graph model has ${\n this.inputNodes.length -\n numCapturedInputs} non-resource placeholders, while there are ${\n inputs.length} input tensors provided.`);\n }\n\n let inputIndex = 0;\n return this.inputNodes.reduce((map, inputName) => {\n const signature =\n this.signature ? this.signature.inputs[inputName] : null;\n if (signature != null && signature.resourceId != null) {\n map[inputName] = this.resourceIdToCapturedInput[signature.resourceId];\n } else {\n map[inputName] = (inputs as Tensor[])[inputIndex++];\n }\n return map;\n }, {} as NamedTensorMap);\n }\n\n private normalizeOutputs(outputs: string|string[]): string[] {\n outputs = outputs || this.outputNodes;\n return !Array.isArray(outputs) ? [outputs] : outputs;\n }\n\n private executeInitializerGraph() {\n if (this.initializer == null) {\n return [];\n }\n if (this.initializerSignature == null) {\n return this.initializer.execute({}, []);\n } else {\n return this.initializer.execute(\n {}, Object.keys(this.initializerSignature.outputs));\n }\n }\n\n private async executeInitializerGraphAsync() {\n if (this.initializer == null) {\n return [];\n }\n if (this.initializerSignature == null) {\n return this.initializer.executeAsync({}, []);\n } else {\n return this.initializer.executeAsync(\n {}, Object.keys(this.initializerSignature.outputs));\n }\n }\n\n private setResourceIdToCapturedInput(outputs: Tensor[]) {\n this.resourceIdToCapturedInput = {};\n\n if (this.initializerSignature) {\n const outputNames = Object.keys(this.initializerSignature.outputs);\n for (let i = 0; i < outputNames.length; i++) {\n const outputName = outputNames[i];\n const tensorInfo = this.initializerSignature.outputs[outputName];\n this.resourceIdToCapturedInput[tensorInfo.resourceId] = outputs[i];\n }\n }\n }\n\n /**\n * Executes inference for the model for given input tensors.\n * @param inputs tensor, tensor array or tensor map of the inputs for the\n * model, keyed by the input node names.\n * @param outputs output node name from the TensorFlow model, if no\n * outputs are specified, the default outputs of the model would be used.\n * You can inspect intermediate nodes of the model by adding them to the\n * outputs array.\n *\n * @returns A single tensor if provided with a single output or no outputs\n * are provided and there is only one default output, otherwise return a\n * tensor array. The order of the tensor array is the same as the outputs\n * if provided, otherwise the order of outputNodes attribute of the model.\n *\n * @doc {heading: 'Models', subheading: 'Classes'}\n */\n execute(inputs: Tensor|Tensor[]|NamedTensorMap, outputs?: string|string[]):\n Tensor|Tensor[] {\n if (this.resourceIdToCapturedInput == null) {\n this.setResourceIdToCapturedInput(this.executeInitializerGraph());\n }\n inputs = this.normalizeInputs(inputs);\n outputs = this.normalizeOutputs(outputs);\n const result = this.executor.execute(inputs, outputs);\n return result.length > 1 ? result : result[0];\n }\n\n /**\n * Executes inference for the model for given input tensors in async\n * fashion, use this method when your model contains control flow ops.\n * @param inputs tensor, tensor array or tensor map of the inputs for the\n * model, keyed by the input node names.\n * @param outputs output node name from the TensorFlow model, if no outputs\n * are specified, the default outputs of the model would be used. You can\n * inspect intermediate nodes of the model by adding them to the outputs\n * array.\n *\n * @returns A Promise of single tensor if provided with a single output or\n * no outputs are provided and there is only one default output, otherwise\n * return a tensor map.\n *\n * @doc {heading: 'Models', subheading: 'Classes'}\n */\n async executeAsync(\n inputs: Tensor|Tensor[]|NamedTensorMap,\n outputs?: string|string[]): Promise {\n if (this.resourceIdToCapturedInput == null) {\n this.setResourceIdToCapturedInput(\n await this.executeInitializerGraphAsync());\n }\n inputs = this.normalizeInputs(inputs);\n outputs = this.normalizeOutputs(outputs);\n const result = await this.executor.executeAsync(inputs, outputs);\n return result.length > 1 ? result : result[0];\n }\n\n /**\n * Get intermediate tensors for model debugging mode (flag\n * KEEP_INTERMEDIATE_TENSORS is true).\n *\n * @doc {heading: 'Models', subheading: 'Classes'}\n */\n getIntermediateTensors(): NamedTensorsMap {\n return this.executor.getIntermediateTensors();\n }\n\n /**\n * Dispose intermediate tensors for model debugging mode (flag\n * KEEP_INTERMEDIATE_TENSORS is true).\n *\n * @doc {heading: 'Models', subheading: 'Classes'}\n */\n disposeIntermediateTensors() {\n this.executor.disposeIntermediateTensors();\n }\n\n private convertTensorMapToTensorsMap(map: NamedTensorMap): NamedTensorsMap {\n return Object.keys(map).reduce((newMap: NamedTensorsMap, key) => {\n newMap[key] = [map[key]];\n return newMap;\n }, {});\n }\n\n /**\n * Releases the memory used by the weight tensors and resourceManager.\n *\n * @doc {heading: 'Models', subheading: 'Classes'}\n */\n dispose() {\n this.executor.dispose();\n\n if (this.initializer) {\n this.initializer.dispose();\n if (this.resourceIdToCapturedInput) {\n dispose(this.resourceIdToCapturedInput);\n }\n }\n\n this.resourceManager.dispose();\n }\n}\n\n/**\n * Load a graph model given a URL to the model definition.\n *\n * Example of loading MobileNetV2 from a URL and making a prediction with a\n * zeros input:\n *\n * ```js\n * const modelUrl =\n * 'https://storage.googleapis.com/tfjs-models/savedmodel/mobilenet_v2_1.0_224/model.json';\n * const model = await tf.loadGraphModel(modelUrl);\n * const zeros = tf.zeros([1, 224, 224, 3]);\n * model.predict(zeros).print();\n * ```\n *\n * Example of loading MobileNetV2 from a TF Hub URL and making a prediction\n * with a zeros input:\n *\n * ```js\n * const modelUrl =\n * 'https://tfhub.dev/google/imagenet/mobilenet_v2_140_224/classification/2';\n * const model = await tf.loadGraphModel(modelUrl, {fromTFHub: true});\n * const zeros = tf.zeros([1, 224, 224, 3]);\n * model.predict(zeros).print();\n * ```\n * @param modelUrl The url or an `io.IOHandler` that loads the model.\n * @param options Options for the HTTP request, which allows to send\n * credentials\n * and custom headers.\n *\n * @doc {heading: 'Models', subheading: 'Loading'}\n */\nexport async function loadGraphModel(\n modelUrl: string|io.IOHandler, options: io.LoadOptions = {},\n tfio = io): Promise {\n if (modelUrl == null) {\n throw new Error(\n 'modelUrl in loadGraphModel() cannot be null. Please provide a url ' +\n 'or an IOHandler that loads the model');\n }\n if (options == null) {\n options = {};\n }\n\n if (options.fromTFHub && typeof modelUrl === 'string') {\n modelUrl = getTFHubUrl(modelUrl);\n }\n const model = new GraphModel(modelUrl, options, tfio);\n await model.load();\n return model;\n}\n\n/**\n * Load a graph model given a synchronous IO handler with a 'load' method.\n *\n * @param modelSource The `io.IOHandlerSync` that loads the model, or the\n * `io.ModelArtifacts` that encode the model, or a tuple of\n * `[io.ModelJSON, ArrayBuffer]` of which the first element encodes the\n * model and the second contains the weights.\n *\n * @doc {heading: 'Models', subheading: 'Loading'}\n */\nexport function loadGraphModelSync(modelSource: io.IOHandlerSync\n | io.ModelArtifacts | [io.ModelJSON, /* Weights */ ArrayBuffer]):\n GraphModel {\n\n if (modelSource == null) {\n throw new Error(\n 'modelUrl in loadGraphModelSync() cannot be null. Please provide ' +\n 'model artifacts or an IOHandler that loads the model');\n }\n\n let ioHandler: io.IOHandlerSync;\n if (modelSource instanceof Array) {\n const [modelJSON, weights] = modelSource;\n if (!modelJSON) {\n throw new Error('modelJSON must be the first element of the array');\n }\n if (!weights || !(weights instanceof ArrayBuffer)) {\n throw new Error('An ArrayBuffer of weights must be the second element of'\n + ' the array');\n }\n if (!('modelTopology' in modelJSON)) {\n throw new Error('Model JSON is missing \\'modelTopology\\'');\n }\n if (!('weightsManifest' in modelJSON)) {\n throw new Error('Model JSON is missing \\'weightsManifest\\'');\n }\n\n const weightSpecs = io.getWeightSpecs(modelJSON.weightsManifest);\n const modelArtifacts = io.getModelArtifactsForJSONSync(modelJSON,\n weightSpecs,\n weights);\n ioHandler = io.fromMemorySync(modelArtifacts);\n } else if ('load' in modelSource) {\n // Then modelSource is already an IOHandlerSync.\n ioHandler = modelSource;\n } else if ('modelTopology' in modelSource && 'weightSpecs' in modelSource\n && 'weightData' in modelSource) {\n // modelSource is of type ModelArtifacts.\n ioHandler = io.fromMemorySync(modelSource);\n } else {\n throw new Error('Unknown model format');\n }\n\n const model = new GraphModel(ioHandler);\n model.load();\n return model;\n}\n\nfunction getTFHubUrl(modelUrl: string): string {\n if (!modelUrl.endsWith('/')) {\n modelUrl = (modelUrl) + '/';\n }\n return `${modelUrl}${DEFAULT_MODEL_NAME}${TFHUB_SEARCH_PARAM}`;\n}\n","/** @license See the LICENSE file. */\n\n// This code is auto-generated, do not modify this file!\nconst version = '4.0.0';\nexport {version};\n","/**\n * @license\n * Copyright 2018 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport './flags';\n\nexport {IAttrValue, INameAttrList, INodeDef, ITensor, ITensorShape} from './data/compiled_api';\nexport {GraphModel, loadGraphModel, loadGraphModelSync} from './executor/graph_model';\nexport {deregisterOp, registerOp} from './operations/custom_op/register';\nexport {GraphNode, OpExecutor} from './operations/types';\nexport {version as version_converter} from './version';\n",null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nexport function setupStats() {\n const stats = new Stats();\n stats.customFpsPanel = stats.addPanel(new Stats.Panel('FPS', '#0ff', '#002'));\n stats.showPanel(stats.domElement.children.length - 1);\n\n const parent = document.getElementById('stats');\n parent.appendChild(stats.domElement);\n\n const statsPanes = parent.querySelectorAll('canvas');\n\n for (let i = 0; i < statsPanes.length; ++i) {\n statsPanes[i].style.width = '140px';\n statsPanes[i].style.height = '80px';\n }\n return stats;\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport * as posedetection from '@tensorflow-models/pose-detection';\nexport const DEFAULT_LINE_WIDTH = 2;\nexport const DEFAULT_RADIUS = 2;\n\nexport const STATE = {\n backend: '',\n flags: {},\n modelConfig: {}\n};\nexport const BLAZEPOSE_CONFIG = {\n maxPoses: 1,\n type: 'heavy',\n scoreThreshold: 0.65\n};\nexport const POSENET_CONFIG = {\n maxPoses: 1,\n scoreThreshold: 0.5\n};\nexport const MOVENET_CONFIG = {\n maxPoses: 1,\n type: 'lightning',\n scoreThreshold: 0.3\n};\n/**\n * This map descripes tunable flags and theior corresponding types.\n *\n * The flags (keys) in the map satisfy the following two conditions:\n * - Is tunable. For example, `IS_BROWSER` and `IS_CHROME` is not tunable,\n * because they are fixed when running the scripts.\n * - Does not depend on other flags when registering in `ENV.registerFlag()`.\n * This rule aims to make the list streamlined, and, since there are\n * dependencies between flags, only modifying an independent flag without\n * modifying its dependents may cause inconsistency.\n * (`WEBGL_RENDER_FLOAT32_CAPABLE` is an exception, because only exposing\n * `WEBGL_FORCE_F16_TEXTURES` may confuse users.)\n */\nexport const TUNABLE_FLAG_VALUE_RANGE_MAP = {\n WEBGL_VERSION: [1, 2],\n WASM_HAS_SIMD_SUPPORT: [true, false],\n WASM_HAS_MULTITHREAD_SUPPORT: [true, false],\n WEBGL_CPU_FORWARD: [true, false],\n WEBGL_PACK: [true, false],\n WEBGL_FORCE_F16_TEXTURES: [true, false],\n WEBGL_RENDER_FLOAT32_CAPABLE: [true, false],\n WEBGL_FLUSH_THRESHOLD: [-1, 0, 0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2],\n CHECK_COMPUTATION_FOR_ERRORS: [true, false],\n};\n\nexport const BACKEND_FLAGS_MAP = {\n ['tfjs-wasm']: ['WASM_HAS_SIMD_SUPPORT', 'WASM_HAS_MULTITHREAD_SUPPORT'],\n ['tfjs-webgl']: [\n 'WEBGL_VERSION', 'WEBGL_CPU_FORWARD', 'WEBGL_PACK',\n 'WEBGL_FORCE_F16_TEXTURES', 'WEBGL_RENDER_FLOAT32_CAPABLE',\n 'WEBGL_FLUSH_THRESHOLD'\n ],\n ['tfjs-webgpu']: [],\n ['mediapipe-gpu']: []\n};\n\nexport const MODEL_BACKEND_MAP = {\n [posedetection.SupportedModels.PoseNet]: ['tfjs-webgl', 'tfjs-webgpu'],\n [posedetection.SupportedModels.MoveNet]: ['tfjs-webgl', 'tfjs-wasm', 'tfjs-webgpu'],\n [posedetection.SupportedModels.BlazePose]: ['mediapipe-gpu', 'tfjs-webgl', 'tfjs-webgpu']\n}\n\nexport const TUNABLE_FLAG_NAME_MAP = {\n PROD: 'production mode',\n WEBGL_VERSION: 'webgl version',\n WASM_HAS_SIMD_SUPPORT: 'wasm SIMD',\n WASM_HAS_MULTITHREAD_SUPPORT: 'wasm multithread',\n WEBGL_CPU_FORWARD: 'cpu forward',\n WEBGL_PACK: 'webgl pack',\n WEBGL_FORCE_F16_TEXTURES: 'enforce float16',\n WEBGL_RENDER_FLOAT32_CAPABLE: 'enable float32',\n WEBGL_FLUSH_THRESHOLD: 'GL flush wait time(ms)'\n};\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport * as posedetection from '@tensorflow-models/pose-detection';\n\nimport * as params from './params';\n\nexport class Context {\n constructor() {\n this.video = document.getElementById('video');\n this.canvas = document.getElementById('output');\n this.source = document.getElementById('currentVID');\n this.ctx = this.canvas.getContext('2d');\n const stream = this.canvas.captureStream();\n const options = {mimeType: 'video/webm; codecs=vp9'};\n this.mediaRecorder = new MediaRecorder(stream, options);\n this.mediaRecorder.ondataavailable = this.handleDataAvailable;\n }\n\n drawCtx() {\n this.ctx.drawImage(\n this.video, 0, 0, this.video.videoWidth, this.video.videoHeight);\n }\n\n clearCtx() {\n this.ctx.clearRect(0, 0, this.video.videoWidth, this.video.videoHeight);\n }\n\n /**\n * Draw the keypoints and skeleton on the video.\n * @param poses A list of poses to render.\n */\n drawResults(poses) {\n for (const pose of poses) {\n this.drawResult(pose);\n }\n }\n\n /**\n * Draw the keypoints and skeleton on the video.\n * @param pose A pose with keypoints to render.\n */\n drawResult(pose) {\n if (pose.keypoints != null) {\n this.drawKeypoints(pose.keypoints);\n this.drawSkeleton(pose.keypoints);\n }\n }\n\n /**\n * Draw the keypoints on the video.\n * @param keypoints A list of keypoints.\n */\n drawKeypoints(keypoints) {\n const keypointInd =\n posedetection.util.getKeypointIndexBySide(params.STATE.model);\n this.ctx.fillStyle = 'White';\n this.ctx.strokeStyle = 'White';\n this.ctx.lineWidth = params.DEFAULT_LINE_WIDTH;\n\n for (const i of keypointInd.middle) {\n this.drawKeypoint(keypoints[i]);\n }\n\n this.ctx.fillStyle = 'Green';\n for (const i of keypointInd.left) {\n this.drawKeypoint(keypoints[i]);\n }\n\n this.ctx.fillStyle = 'Orange';\n for (const i of keypointInd.right) {\n this.drawKeypoint(keypoints[i]);\n }\n }\n\n drawKeypoint(keypoint) {\n // If score is null, just show the keypoint.\n const score = keypoint.score != null ? keypoint.score : 1;\n const scoreThreshold = params.STATE.modelConfig.scoreThreshold || 0;\n\n if (score >= scoreThreshold) {\n const circle = new Path2D();\n circle.arc(keypoint.x, keypoint.y, params.DEFAULT_RADIUS, 0, 2 * Math.PI);\n this.ctx.fill(circle);\n this.ctx.stroke(circle);\n }\n }\n\n /**\n * Draw the skeleton of a body on the video.\n * @param keypoints A list of keypoints.\n */\n drawSkeleton(keypoints) {\n this.ctx.fillStyle = 'White';\n this.ctx.strokeStyle = 'White';\n this.ctx.lineWidth = params.DEFAULT_LINE_WIDTH;\n\n posedetection.util.getAdjacentPairs(params.STATE.model).forEach(([\n i, j\n ]) => {\n const kp1 = keypoints[i];\n const kp2 = keypoints[j];\n\n // If score is null, just show the keypoint.\n const score1 = kp1.score != null ? kp1.score : 1;\n const score2 = kp2.score != null ? kp2.score : 1;\n const scoreThreshold = params.STATE.modelConfig.scoreThreshold || 0;\n\n if (score1 >= scoreThreshold && score2 >= scoreThreshold) {\n this.ctx.beginPath();\n this.ctx.moveTo(kp1.x, kp1.y);\n this.ctx.lineTo(kp2.x, kp2.y);\n this.ctx.stroke();\n }\n });\n }\n\n start() {\n this.mediaRecorder.start();\n }\n\n stop() {\n this.mediaRecorder.stop();\n }\n\n handleDataAvailable(event) {\n if (event.data.size > 0) {\n const recordedChunks = [event.data];\n\n // Download.\n const blob = new Blob(recordedChunks, {type: 'video/webm'});\n const url = URL.createObjectURL(blob);\n const a = document.createElement('a');\n document.body.appendChild(a);\n a.style = 'display: none';\n a.href = url;\n a.download = 'pose.webm';\n a.click();\n window.URL.revokeObjectURL(url);\n }\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport * as posedetection from '@tensorflow-models/pose-detection';\nimport * as tf from '@tensorflow/tfjs-core';\n\nimport * as params from './params';\n\n/**\n * Records each flag's default value under the runtime environment and is a\n * constant in runtime.\n */\nlet TUNABLE_FLAG_DEFAULT_VALUE_MAP;\n\nconst stringValueMap = {};\nlet backendFolder;\n\nexport async function setupDatGui(urlParams) {\n const gui = new dat.GUI({width: 300});\n gui.domElement.id = 'gui';\n\n // The model folder contains options for model selection.\n const modelFolder = gui.addFolder('Model');\n\n const model = urlParams.get('model');\n let type = urlParams.get('type');\n const backendFromURL = urlParams.get('backend');\n\n switch (model) {\n case 'posenet':\n params.STATE.model = posedetection.SupportedModels.PoseNet;\n break;\n case 'movenet':\n params.STATE.model = posedetection.SupportedModels.MoveNet;\n if (type !== 'lightning' && type !== 'thunder') {\n // Nulify invalid value.\n type = null;\n }\n break;\n case 'blazepose':\n params.STATE.model = posedetection.SupportedModels.BlazePose;\n if (type !== 'full' && type !== 'lite' && type !== 'heavy') {\n // Nulify invalid value.\n type = null;\n }\n break;\n default:\n alert(`${urlParams.get('model')}`);\n break;\n }\n\n const modelController = modelFolder.add(\n params.STATE, 'model', Object.values(posedetection.SupportedModels));\n\n modelController.onChange(_ => {\n params.STATE.isModelChanged = true;\n showModelConfigs(modelFolder);\n showBackendConfigs(backendFolder);\n });\n\n showModelConfigs(modelFolder, type);\n\n modelFolder.open();\n\n backendFolder = gui.addFolder('Backend');\n params.STATE.backend = backendFromURL;\n\n showBackendConfigs(backendFolder);\n\n backendFolder.open();\n\n return gui;\n}\n\nexport async function showBackendConfigs(folderController) {\n if (folderController == null) {\n folderController = backendFolder;\n }\n // Clean up backend configs for the previous model.\n const fixedSelectionCount = 0;\n while (folderController.__controllers.length > fixedSelectionCount) {\n folderController.remove(\n folderController\n .__controllers[folderController.__controllers.length - 1]);\n }\n const backends = params.MODEL_BACKEND_MAP[params.STATE.model];\n if(params.STATE.backend == null) {\n // The first element of the array is the default backend for the model.\n params.STATE.backend = backends[0];\n }\n const backendController =\n folderController.add(params.STATE, 'backend', backends);\n backendController.name('runtime-backend');\n backendController.onChange(async backend => {\n params.STATE.isBackendChanged = true;\n await showFlagSettings(folderController, backend);\n });\n await showFlagSettings(folderController, params.STATE.backend);\n}\n\nfunction showModelConfigs(folderController, type) {\n // Clean up model configs for the previous model.\n // The first constroller under the `folderController` is the model\n // selection.\n const fixedSelectionCount = 1;\n while (folderController.__controllers.length > fixedSelectionCount) {\n folderController.remove(\n folderController\n .__controllers[folderController.__controllers.length - 1]);\n }\n\n switch (params.STATE.model) {\n case posedetection.SupportedModels.PoseNet:\n addPoseNetControllers(folderController);\n break;\n case posedetection.SupportedModels.MoveNet:\n addMoveNetControllers(folderController, type);\n break;\n case posedetection.SupportedModels.BlazePose:\n addBlazePoseControllers(folderController, type);\n break;\n default:\n alert(`Model ${params.STATE.model} is not supported.`);\n }\n}\n\n// The PoseNet model config folder contains options for PoseNet config\n// settings.\nfunction addPoseNetControllers(modelConfigFolder) {\n params.STATE.modelConfig = {...params.POSENET_CONFIG};\n\n modelConfigFolder.add(params.STATE.modelConfig, 'maxPoses', [1, 2, 3, 4, 5]);\n modelConfigFolder.add(params.STATE.modelConfig, 'scoreThreshold', 0, 1);\n}\n\n// The MoveNet model config folder contains options for MoveNet config\n// settings.\nfunction addMoveNetControllers(modelConfigFolder, type) {\n params.STATE.modelConfig = {...params.MOVENET_CONFIG};\n params.STATE.modelConfig.type = type != null ? type : 'lightning';\n\n const typeController = modelConfigFolder.add(\n params.STATE.modelConfig, 'type', ['lightning', 'thunder']);\n typeController.onChange(_ => {\n // Set isModelChanged to true, so that we don't render any result during\n // changing models.\n params.STATE.isModelChanged = true;\n });\n\n modelConfigFolder.add(params.STATE.modelConfig, 'scoreThreshold', 0, 1);\n}\n\n// The BlazePose model config folder contains options for BlazePose config\n// settings.\nfunction addBlazePoseControllers(modelConfigFolder, type) {\n params.STATE.modelConfig = {...params.BLAZEPOSE_CONFIG};\n params.STATE.modelConfig.type = type != null ? type : 'heavy';\n\n const typeController = modelConfigFolder.add(\n params.STATE.modelConfig, 'type', ['heavy', 'full', 'lite']);\n typeController.onChange(_ => {\n // Set isModelChanged to true, so that we don't render any result during\n // changing models.\n params.STATE.isModelChanged = true;\n });\n\n modelConfigFolder.add(params.STATE.modelConfig, 'scoreThreshold', 0, 1);\n}\n\n/**\n * Query all tunable flags' default value and populate `STATE.flags` with them.\n */\nasync function initDefaultValueMap() {\n // Clean up the cache to query tunable flags' default values.\n TUNABLE_FLAG_DEFAULT_VALUE_MAP = {};\n params.STATE.flags = {};\n for (const backend in params.BACKEND_FLAGS_MAP) {\n for (let index = 0; index < params.BACKEND_FLAGS_MAP[backend].length;\n index++) {\n const flag = params.BACKEND_FLAGS_MAP[backend][index];\n TUNABLE_FLAG_DEFAULT_VALUE_MAP[flag] = await tf.env().getAsync(flag);\n }\n }\n\n // Initialize STATE.flags with tunable flags' default values.\n for (const flag in TUNABLE_FLAG_DEFAULT_VALUE_MAP) {\n if (params.BACKEND_FLAGS_MAP[params.STATE.backend].indexOf(flag) > -1) {\n params.STATE.flags[flag] = TUNABLE_FLAG_DEFAULT_VALUE_MAP[flag];\n }\n }\n}\n\n/**\n * Heuristically determine flag's value range based on flag's default value.\n *\n * Assume that the flag's default value has already chosen the best option for\n * the runtime environment, so users can only tune the flag value downwards.\n *\n * For example, if the default value of `WEBGL_RENDER_FLOAT32_CAPABLE` is false,\n * the tunable range is [false]; otherwise, the tunable range is [true. false].\n *\n * @param {string} flag\n */\nfunction getTunableRange(flag) {\n const defaultValue = TUNABLE_FLAG_DEFAULT_VALUE_MAP[flag];\n if (flag === 'WEBGL_FORCE_F16_TEXTURES') {\n return [false, true];\n } else if (flag === 'WEBGL_VERSION') {\n const tunableRange = [];\n for (let value = 1; value <= defaultValue; value++) {\n tunableRange.push(value);\n }\n return tunableRange;\n } else if (flag === 'WEBGL_FLUSH_THRESHOLD') {\n const tunableRange = [-1];\n for (let value = 0; value <= 2; value += 0.25) {\n tunableRange.push(value);\n }\n return tunableRange;\n } else if (typeof defaultValue === 'boolean') {\n return defaultValue ? [false, true] : [false];\n } else if (params.TUNABLE_FLAG_VALUE_RANGE_MAP[flag] != null) {\n return params.TUNABLE_FLAG_VALUE_RANGE_MAP[flag];\n } else {\n return [defaultValue];\n }\n}\n\n/**\n * Show flag settings for the given backend under the UI element of\n * `folderController`.\n *\n * @param {dat.gui.GUI} folderController\n * @param {string} backendName\n */\nfunction showBackendFlagSettings(folderController, backendName) {\n const tunableFlags = params.BACKEND_FLAGS_MAP[backendName];\n for (let index = 0; index < tunableFlags.length; index++) {\n const flag = tunableFlags[index];\n const flagName = params.TUNABLE_FLAG_NAME_MAP[flag] || flag;\n\n // When tunable (bool) and range (array) attributes of `flagRegistry` is\n // implemented, we can apply them to here.\n const flagValueRange = getTunableRange(flag);\n // Heuristically consider a flag with at least two options as tunable.\n if (flagValueRange.length < 2) {\n console.warn(\n `The ${flag} is considered as untunable, ` +\n `because its value range is [${flagValueRange}].`);\n continue;\n }\n\n let flagController;\n if (typeof flagValueRange[0] === 'boolean') {\n // Show checkbox for boolean flags.\n flagController = folderController.add(params.STATE.flags, flag);\n } else {\n // Show dropdown for other types of flags.\n flagController =\n folderController.add(params.STATE.flags, flag, flagValueRange);\n\n // Because dat.gui always casts dropdown option values to string, we need\n // `stringValueMap` and `onFinishChange()` to recover the value type.\n if (stringValueMap[flag] == null) {\n stringValueMap[flag] = {};\n for (let index = 0; index < flagValueRange.length; index++) {\n const realValue = flagValueRange[index];\n const stringValue = String(flagValueRange[index]);\n stringValueMap[flag][stringValue] = realValue;\n }\n }\n flagController.onFinishChange(stringValue => {\n params.STATE.flags[flag] = stringValueMap[flag][stringValue];\n });\n }\n flagController.name(flagName).onChange(() => {\n params.STATE.isFlagChanged = true;\n });\n }\n}\n\n/**\n * Set up flag settings under the UI element of `folderController`:\n * - If it is the first call, initialize the flags' default value and show flag\n * settings for both the general and the given backend.\n * - Else, clean up flag settings for the previous backend and show flag\n * settings for the new backend.\n *\n * @param {dat.gui.GUI} folderController\n * @param {string} backendName\n */\nasync function showFlagSettings(folderController, backendName) {\n await initDefaultValueMap();\n\n // Clean up flag settings for the previous backend.\n // The first constroller under the `folderController` is the backend\n // setting.\n const fixedSelectionCount = 1;\n while (folderController.__controllers.length > fixedSelectionCount) {\n folderController.remove(\n folderController\n .__controllers[folderController.__controllers.length - 1]);\n }\n\n // Show flag settings for the new backend.\n showBackendFlagSettings(folderController, backendName);\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\nimport * as tf from '@tensorflow/tfjs-core';\nimport {showBackendConfigs} from './option_panel';\nimport {STATE, TUNABLE_FLAG_VALUE_RANGE_MAP} from './params';\n\nexport function isMobile() {\n const isAndroid = /Android/i.test(navigator.userAgent);\n const isiOS = /iPhone|iPad|iPod/i.test(navigator.userAgent);\n return isAndroid || isiOS;\n}\n\n/**\n * Reset the target backend.\n *\n * @param backendName The name of the backend to be reset.\n */\nasync function resetBackend(backendName) {\n const ENGINE = tf.engine();\n if (!(backendName in ENGINE.registryFactory)) {\n if(backendName === 'webgpu') {\n alert('webgpu backend is not registered. Your browser may not support WebGPU yet. To test this backend, please use a supported browser, e.g. Chrome canary with --enable-unsafe-webgpu flag');\n STATE.backend = !!STATE.lastTFJSBackend ? STATE.lastTFJSBackend : 'tfjs-webgl';\n showBackendConfigs();\n return;\n } else {\n throw new Error(`${backendName} backend is not registered.`);\n }\n }\n\n if (backendName in ENGINE.registry) {\n const backendFactory = tf.findBackendFactory(backendName);\n tf.removeBackend(backendName);\n tf.registerBackend(backendName, backendFactory);\n }\n\n await tf.setBackend(backendName);\n STATE.lastTFJSBackend = `tfjs-${backendName}`;\n}\n\n/**\n * Set environment flags.\n *\n * This is a wrapper function of `tf.env().setFlags()` to constrain users to\n * only set tunable flags (the keys of `TUNABLE_FLAG_TYPE_MAP`).\n *\n * ```js\n * const flagConfig = {\n * WEBGL_PACK: false,\n * };\n * await setEnvFlags(flagConfig);\n *\n * console.log(tf.env().getBool('WEBGL_PACK')); // false\n * console.log(tf.env().getBool('WEBGL_PACK_BINARY_OPERATIONS')); // false\n * ```\n *\n * @param flagConfig An object to store flag-value pairs.\n */\nexport async function setBackendAndEnvFlags(flagConfig, backend) {\n if (flagConfig == null) {\n return;\n } else if (typeof flagConfig !== 'object') {\n throw new Error(\n `An object is expected, while a(n) ${typeof flagConfig} is found.`);\n }\n\n // Check the validation of flags and values.\n for (const flag in flagConfig) {\n // TODO: check whether flag can be set as flagConfig[flag].\n if (!(flag in TUNABLE_FLAG_VALUE_RANGE_MAP)) {\n throw new Error(`${flag} is not a tunable or valid environment flag.`);\n }\n if (TUNABLE_FLAG_VALUE_RANGE_MAP[flag].indexOf(flagConfig[flag]) === -1) {\n throw new Error(\n `${flag} value is expected to be in the range [${\n TUNABLE_FLAG_VALUE_RANGE_MAP[flag]}], while ${flagConfig[flag]}` +\n ' is found.');\n }\n }\n\n tf.env().setFlags(flagConfig);\n\n const [runtime, $backend] = backend.split('-');\n\n if (runtime === 'tfjs') {\n await resetBackend($backend);\n }\n}\n","/**\n * @license\n * Copyright 2021 Google LLC. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * =============================================================================\n */\n\nimport '@tensorflow/tfjs-backend-webgl';\nimport '@tensorflow/tfjs-backend-webgpu';\nimport * as mpPose from '@mediapipe/pose';\n\nimport * as tfjsWasm from '@tensorflow/tfjs-backend-wasm';\n\ntfjsWasm.setWasmPaths(\n `https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@${\n tfjsWasm.version_wasm}/dist/`);\n\nimport * as posedetection from '@tensorflow-models/pose-detection';\nimport * as tf from '@tensorflow/tfjs-core';\n\nimport {setupStats} from './stats_panel';\nimport {Context} from './camera';\nimport {setupDatGui} from './option_panel';\nimport {STATE} from './params';\nimport {setBackendAndEnvFlags} from './util';\n\nlet detector, camera, stats;\nlet startInferenceTime, numInferences = 0;\nlet inferenceTimeSum = 0, lastPanelUpdate = 0;\nlet rafId;\nconst statusElement = document.getElementById('status');\n\nasync function createDetector() {\n switch (STATE.model) {\n case posedetection.SupportedModels.PoseNet:\n return posedetection.createDetector(STATE.model, {\n quantBytes: 4,\n architecture: 'MobileNetV1',\n outputStride: 16,\n inputResolution: {width: 500, height: 500},\n multiplier: 0.75\n });\n case posedetection.SupportedModels.BlazePose:\n const runtime = STATE.backend.split('-')[0];\n if (runtime === 'mediapipe') {\n return posedetection.createDetector(STATE.model, {\n runtime,\n modelType: STATE.modelConfig.type,\n solutionPath: `https://cdn.jsdelivr.net/npm/@mediapipe/pose@${mpPose.VERSION}`\n });\n } else if (runtime === 'tfjs') {\n return posedetection.createDetector(\n STATE.model, {runtime, modelType: STATE.modelConfig.type});\n }\n case posedetection.SupportedModels.MoveNet:\n const modelType = STATE.modelConfig.type == 'lightning' ?\n posedetection.movenet.modelType.SINGLEPOSE_LIGHTNING :\n posedetection.movenet.modelType.SINGLEPOSE_THUNDER;\n return posedetection.createDetector(STATE.model, {modelType});\n }\n}\n\nasync function checkGuiUpdate() {\n if (STATE.isModelChanged || STATE.isFlagChanged || STATE.isBackendChanged) {\n STATE.isModelChanged = true;\n\n window.cancelAnimationFrame(rafId);\n\n detector.dispose();\n\n if (STATE.isFlagChanged || STATE.isBackendChanged) {\n await setBackendAndEnvFlags(STATE.flags, STATE.backend);\n }\n\n detector = await createDetector(STATE.model);\n STATE.isFlagChanged = false;\n STATE.isBackendChanged = false;\n STATE.isModelChanged = false;\n }\n}\n\nfunction beginEstimatePosesStats() {\n startInferenceTime = (performance || Date).now();\n}\n\nfunction endEstimatePosesStats() {\n const endInferenceTime = (performance || Date).now();\n inferenceTimeSum += endInferenceTime - startInferenceTime;\n ++numInferences;\n\n const panelUpdateMilliseconds = 1000;\n if (endInferenceTime - lastPanelUpdate >= panelUpdateMilliseconds) {\n const averageInferenceTime = inferenceTimeSum / numInferences;\n inferenceTimeSum = 0;\n numInferences = 0;\n stats.customFpsPanel.update(\n 1000.0 / averageInferenceTime, 120 /* maxValue */);\n lastPanelUpdate = endInferenceTime;\n }\n}\n\nasync function renderResult() {\n // FPS only counts the time it takes to finish estimatePoses.\n beginEstimatePosesStats();\n\n const poses = await detector.estimatePoses(\n camera.video,\n {maxPoses: STATE.modelConfig.maxPoses, flipHorizontal: false});\n\n endEstimatePosesStats();\n\n camera.drawCtx();\n\n // The null check makes sure the UI is not in the middle of changing to a\n // different model. If during model change, the result is from an old\n // model, which shouldn't be rendered.\n if (poses.length > 0 && !STATE.isModelChanged) {\n camera.drawResults(poses);\n }\n}\n\nasync function updateVideo(event) {\n // Clear reference to any previous uploaded video.\n URL.revokeObjectURL(camera.video.currentSrc);\n const file = event.target.files[0];\n camera.source.src = URL.createObjectURL(file);\n\n // Wait for video to be loaded.\n camera.video.load();\n await new Promise((resolve) => {\n camera.video.onloadeddata = () => {\n resolve(video);\n };\n });\n\n const videoWidth = camera.video.videoWidth;\n const videoHeight = camera.video.videoHeight;\n // Must set below two lines, otherwise video element doesn't show.\n camera.video.width = videoWidth;\n camera.video.height = videoHeight;\n camera.canvas.width = videoWidth;\n camera.canvas.height = videoHeight;\n\n statusElement.innerHTML = 'Video is loaded.';\n}\n\nasync function runFrame() {\n await checkGuiUpdate();\n if (video.paused) {\n // video has finished.\n camera.mediaRecorder.stop();\n camera.clearCtx();\n camera.video.style.visibility = 'visible';\n return;\n }\n await renderResult();\n rafId = requestAnimationFrame(runFrame);\n}\n\nasync function run() {\n statusElement.innerHTML = 'Warming up model.';\n\n // Warming up pipeline.\n const [runtime, $backend] = STATE.backend.split('-');\n\n if (runtime === 'tfjs') {\n const warmUpTensor =\n tf.fill([camera.video.height, camera.video.width, 3], 0, 'float32');\n await detector.estimatePoses(\n warmUpTensor,\n {maxPoses: STATE.modelConfig.maxPoses, flipHorizontal: false});\n warmUpTensor.dispose();\n statusElement.innerHTML = 'Model is warmed up.';\n }\n\n camera.video.style.visibility = 'hidden';\n video.pause();\n video.currentTime = 0;\n video.play();\n camera.mediaRecorder.start();\n\n await new Promise((resolve) => {\n camera.video.onseeked = () => {\n resolve(video);\n };\n });\n\n await runFrame();\n}\n\nasync function app() {\n // Gui content will change depending on which model is in the query string.\n const urlParams = new URLSearchParams(window.location.search);\n if (!urlParams.has('model')) {\n alert('Cannot find model in the query string.');\n return;\n }\n\n await setupDatGui(urlParams);\n stats = setupStats();\n camera = new Context();\n\n await setBackendAndEnvFlags(STATE.flags, STATE.backend);\n detector = await createDetector();\n\n const runButton = document.getElementById('submit');\n runButton.onclick = run;\n\n const uploadButton = document.getElementById('videofile');\n uploadButton.onchange = updateVideo;\n};\n\napp();\n"]} \ No newline at end of file diff --git a/mounts/zoperepo/__root__/tf_upload_demo/tflw-pose-detection_upload.js/__source__.js b/mounts/zoperepo/__root__/tf_upload_demo/tflw-pose-detection_upload.js/__source__.js deleted file mode 100644 index ac8b7bf..0000000 --- a/mounts/zoperepo/__root__/tf_upload_demo/tflw-pose-detection_upload.js/__source__.js +++ /dev/null @@ -1,124010 +0,0 @@ -var GLOBAL_POSES = []; -var cur_frame_time; -var last_frame_time; -var delta_t; - - -// modules are defined as an array -// [ module function, map of requires ] -// -// map of requires is short require name -> numeric require -// -// anything defined in a previous bundle is accessed via the -// orig method which is the require for previous bundles -parcelRequire = (function (modules, cache, entry, globalName) { - // Save the require from previous bundle to this closure if any - var previousRequire = typeof parcelRequire === 'function' && parcelRequire; - var nodeRequire = typeof require === 'function' && require; - - function newRequire(name, jumped) { - if (!cache[name]) { - if (!modules[name]) { - // if we cannot find the module within our internal map or - // cache jump to the current global require ie. the last bundle - // that was added to the page. - var currentRequire = typeof parcelRequire === 'function' && parcelRequire; - if (!jumped && currentRequire) { - return currentRequire(name, true); - } - - // If there are other bundles on this page the require from the - // previous one is saved to 'previousRequire'. Repeat this as - // many times as there are bundles until the module is found or - // we exhaust the require chain. - if (previousRequire) { - return previousRequire(name, true); - } - - // Try the node require function if it exists. - if (nodeRequire && typeof name === 'string') { - return nodeRequire(name); - } - - var err = new Error('Cannot find module \'' + name + '\''); - err.code = 'MODULE_NOT_FOUND'; - throw err; - } - - localRequire.resolve = resolve; - localRequire.cache = {}; - - var module = cache[name] = new newRequire.Module(name); - - modules[name][0].call(module.exports, localRequire, module, module.exports, this); - } - - return cache[name].exports; - - function localRequire(x){ - return newRequire(localRequire.resolve(x)); - } - - function resolve(x){ - return modules[name][1][x] || x; - } - } - - function Module(moduleName) { - this.id = moduleName; - this.bundle = newRequire; - this.exports = {}; - } - - newRequire.isParcelRequire = true; - newRequire.Module = Module; - newRequire.modules = modules; - newRequire.cache = cache; - newRequire.parent = previousRequire; - newRequire.register = function (id, exports) { - modules[id] = [function (require, module) { - module.exports = exports; - }, {}]; - }; - - var error; - for (var i = 0; i < entry.length; i++) { - try { - newRequire(entry[i]); - } catch (e) { - // Save first error but execute all entries - if (!error) { - error = e; - } - } - } - - if (entry.length) { - // Expose entry point to Node, AMD or browser globals - // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js - var mainExports = newRequire(entry[entry.length - 1]); - - // CommonJS - if (typeof exports === "object" && typeof module !== "undefined") { - module.exports = mainExports; - - // RequireJS - } else if (typeof define === "function" && define.amd) { - define(function () { - return mainExports; - }); - - //
    ID